sykpcomposer 1.0.1 → 1.0.3

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/index.umd.js CHANGED
@@ -1,48 +1,48 @@
1
- (function(xn,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],I):(xn=typeof globalThis<"u"?globalThis:xn||self,I(xn.ViteButton={},xn.React,xn.ReactDOM))})(this,function(xn,I,mf){"use strict";function Oy(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const Ys=Oy(I);var W={exports:{}},wr={};var yf;function vy(){if(yf)return wr;yf=1;var n=I,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,r=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(l,c,a){var f,d={},u=null,h=null;a!==void 0&&(u=""+a),c.key!==void 0&&(u=""+c.key),c.ref!==void 0&&(h=c.ref);for(f in c)o.call(c,f)&&!s.hasOwnProperty(f)&&(d[f]=c[f]);if(l&&l.defaultProps)for(f in c=l.defaultProps,c)d[f]===void 0&&(d[f]=c[f]);return{$$typeof:e,type:l,key:u,ref:h,props:d,_owner:r.current}}return wr.Fragment=t,wr.jsx=i,wr.jsxs=i,wr}var br={};var Cf;function My(){return Cf||(Cf=1,process.env.NODE_ENV!=="production"&&function(){var n=I,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator,p="@@iterator";function _(E){if(E===null||typeof E!="object")return null;var k=g&&E[g]||E[p];return typeof k=="function"?k:null}var y=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function m(E){{for(var k=arguments.length,z=new Array(k>1?k-1:0),oe=1;oe<k;oe++)z[oe-1]=arguments[oe];C("error",E,z)}}function C(E,k,z){{var oe=y.ReactDebugCurrentFrame,de=oe.getStackAddendum();de!==""&&(k+="%s",z=z.concat([de]));var me=z.map(function(fe){return String(fe)});me.unshift("Warning: "+k),Function.prototype.apply.call(console[E],console,me)}}var N=!1,S=!1,T=!1,b=!1,x=!1,w;w=Symbol.for("react.module.reference");function O(E){return!!(typeof E=="string"||typeof E=="function"||E===o||E===s||x||E===r||E===a||E===f||b||E===h||N||S||T||typeof E=="object"&&E!==null&&(E.$$typeof===u||E.$$typeof===d||E.$$typeof===i||E.$$typeof===l||E.$$typeof===c||E.$$typeof===w||E.getModuleId!==void 0))}function D(E,k,z){var oe=E.displayName;if(oe)return oe;var de=k.displayName||k.name||"";return de!==""?z+"("+de+")":z}function B(E){return E.displayName||"Context"}function Y(E){if(E==null)return null;if(typeof E.tag=="number"&&m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof E=="function")return E.displayName||E.name||null;if(typeof E=="string")return E;switch(E){case o:return"Fragment";case t:return"Portal";case s:return"Profiler";case r:return"StrictMode";case a:return"Suspense";case f:return"SuspenseList"}if(typeof E=="object")switch(E.$$typeof){case l:var k=E;return B(k)+".Consumer";case i:var z=E;return B(z._context)+".Provider";case c:return D(E,E.render,"ForwardRef");case d:var oe=E.displayName||null;return oe!==null?oe:Y(E.type)||"Memo";case u:{var de=E,me=de._payload,fe=de._init;try{return Y(fe(me))}catch{return null}}}return null}var J=Object.assign,V=0,re,F,ce,se,We,ue,Ae;function Ge(){}Ge.__reactDisabledLog=!0;function Xe(){{if(V===0){re=console.log,F=console.info,ce=console.warn,se=console.error,We=console.group,ue=console.groupCollapsed,Ae=console.groupEnd;var E={configurable:!0,enumerable:!0,value:Ge,writable:!0};Object.defineProperties(console,{info:E,log:E,warn:E,error:E,group:E,groupCollapsed:E,groupEnd:E})}V++}}function qe(){{if(V--,V===0){var E={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:J({},E,{value:re}),info:J({},E,{value:F}),warn:J({},E,{value:ce}),error:J({},E,{value:se}),group:J({},E,{value:We}),groupCollapsed:J({},E,{value:ue}),groupEnd:J({},E,{value:Ae})})}V<0&&m("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Te=y.ReactCurrentDispatcher,nt;function ze(E,k,z){{if(nt===void 0)try{throw Error()}catch(de){var oe=de.stack.trim().match(/\n( *(at )?)/);nt=oe&&oe[1]||""}return`
2
- `+nt+E}}var ve=!1,St;{var eo=typeof WeakMap=="function"?WeakMap:Map;St=new eo}function ff(E,k){if(!E||ve)return"";{var z=St.get(E);if(z!==void 0)return z}var oe;ve=!0;var de=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var me;me=Te.current,Te.current=null,Xe();try{if(k){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(Tn){oe=Tn}Reflect.construct(E,[],fe)}else{try{fe.call()}catch(Tn){oe=Tn}E.call(fe.prototype)}}else{try{throw Error()}catch(Tn){oe=Tn}E()}}catch(Tn){if(Tn&&oe&&typeof Tn.stack=="string"){for(var ae=Tn.stack.split(`
3
- `),ht=oe.stack.split(`
4
- `),$e=ae.length-1,Le=ht.length-1;$e>=1&&Le>=0&&ae[$e]!==ht[Le];)Le--;for(;$e>=1&&Le>=0;$e--,Le--)if(ae[$e]!==ht[Le]){if($e!==1||Le!==1)do if($e--,Le--,Le<0||ae[$e]!==ht[Le]){var At=`
5
- `+ae[$e].replace(" at new "," at ");return E.displayName&&At.includes("<anonymous>")&&(At=At.replace("<anonymous>",E.displayName)),typeof E=="function"&&St.set(E,At),At}while($e>=1&&Le>=0);break}}}finally{ve=!1,Te.current=me,qe(),Error.prepareStackTrace=de}var Er=E?E.displayName||E.name:"",by=Er?ze(Er):"";return typeof E=="function"&&St.set(E,by),by}function pv(E,k,z){return ff(E,!1)}function _v(E){var k=E.prototype;return!!(k&&k.isReactComponent)}function ac(E,k,z){if(E==null)return"";if(typeof E=="function")return ff(E,_v(E));if(typeof E=="string")return ze(E);switch(E){case a:return ze("Suspense");case f:return ze("SuspenseList")}if(typeof E=="object")switch(E.$$typeof){case c:return pv(E.render);case d:return ac(E.type,k,z);case u:{var oe=E,de=oe._payload,me=oe._init;try{return ac(me(de),k,z)}catch{}}}return""}var uc=Object.prototype.hasOwnProperty,gy={},py=y.ReactDebugCurrentFrame;function fc(E){if(E){var k=E._owner,z=ac(E.type,E._source,k?k.type:null);py.setExtraStackFrame(z)}else py.setExtraStackFrame(null)}function mv(E,k,z,oe,de){{var me=Function.call.bind(uc);for(var fe in E)if(me(E,fe)){var ae=void 0;try{if(typeof E[fe]!="function"){var ht=Error((oe||"React class")+": "+z+" type `"+fe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof E[fe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ht.name="Invariant Violation",ht}ae=E[fe](k,fe,oe,z,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch($e){ae=$e}ae&&!(ae instanceof Error)&&(fc(de),m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",oe||"React class",z,fe,typeof ae),fc(null)),ae instanceof Error&&!(ae.message in gy)&&(gy[ae.message]=!0,fc(de),m("Failed %s type: %s",z,ae.message),fc(null))}}}var yv=Array.isArray;function df(E){return yv(E)}function Cv(E){{var k=typeof Symbol=="function"&&Symbol.toStringTag,z=k&&E[Symbol.toStringTag]||E.constructor.name||"Object";return z}}function Nv(E){try{return _y(E),!1}catch{return!0}}function _y(E){return""+E}function my(E){if(Nv(E))return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Cv(E)),_y(E)}var Hs=y.ReactCurrentOwner,Sv={key:!0,ref:!0,__self:!0,__source:!0},yy,Cy,hf;hf={};function Tv(E){if(uc.call(E,"ref")){var k=Object.getOwnPropertyDescriptor(E,"ref").get;if(k&&k.isReactWarning)return!1}return E.ref!==void 0}function xv(E){if(uc.call(E,"key")){var k=Object.getOwnPropertyDescriptor(E,"key").get;if(k&&k.isReactWarning)return!1}return E.key!==void 0}function Ev(E,k){if(typeof E.ref=="string"&&Hs.current&&k&&Hs.current.stateNode!==k){var z=Y(Hs.current.type);hf[z]||(m('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',Y(Hs.current.type),E.ref),hf[z]=!0)}}function wv(E,k){{var z=function(){yy||(yy=!0,m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",k))};z.isReactWarning=!0,Object.defineProperty(E,"key",{get:z,configurable:!0})}}function bv(E,k){{var z=function(){Cy||(Cy=!0,m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",k))};z.isReactWarning=!0,Object.defineProperty(E,"ref",{get:z,configurable:!0})}}var Ov=function(E,k,z,oe,de,me,fe){var ae={$$typeof:e,type:E,key:k,ref:z,props:fe,_owner:me};return ae._store={},Object.defineProperty(ae._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ae,"_self",{configurable:!1,enumerable:!1,writable:!1,value:oe}),Object.defineProperty(ae,"_source",{configurable:!1,enumerable:!1,writable:!1,value:de}),Object.freeze&&(Object.freeze(ae.props),Object.freeze(ae)),ae};function vv(E,k,z,oe,de){{var me,fe={},ae=null,ht=null;z!==void 0&&(my(z),ae=""+z),xv(k)&&(my(k.key),ae=""+k.key),Tv(k)&&(ht=k.ref,Ev(k,de));for(me in k)uc.call(k,me)&&!Sv.hasOwnProperty(me)&&(fe[me]=k[me]);if(E&&E.defaultProps){var $e=E.defaultProps;for(me in $e)fe[me]===void 0&&(fe[me]=$e[me])}if(ae||ht){var Le=typeof E=="function"?E.displayName||E.name||"Unknown":E;ae&&wv(fe,Le),ht&&bv(fe,Le)}return Ov(E,ae,ht,de,oe,Hs.current,fe)}}var gf=y.ReactCurrentOwner,Ny=y.ReactDebugCurrentFrame;function xr(E){if(E){var k=E._owner,z=ac(E.type,E._source,k?k.type:null);Ny.setExtraStackFrame(z)}else Ny.setExtraStackFrame(null)}var pf;pf=!1;function _f(E){return typeof E=="object"&&E!==null&&E.$$typeof===e}function Sy(){{if(gf.current){var E=Y(gf.current.type);if(E)return`
1
+ (function(xn,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],I):(xn=typeof globalThis<"u"?globalThis:xn||self,I(xn.ViteButton={},xn.React,xn.ReactDOM))})(this,function(xn,I,mf){"use strict";function vy(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const Hs=vy(I);var W={exports:{}},Er={};var uc,yf;function Cf(){if(yf)return uc;yf=1;var n=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function r(s){if(s==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(s)}function o(){try{if(!Object.assign)return!1;var s=new String("abc");if(s[5]="de",Object.getOwnPropertyNames(s)[0]==="5")return!1;for(var i={},l=0;l<10;l++)i["_"+String.fromCharCode(l)]=l;var c=Object.getOwnPropertyNames(i).map(function(f){return i[f]});if(c.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(f){a[f]=f}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return uc=o()?Object.assign:function(s,i){for(var l,c=r(s),a,f=1;f<arguments.length;f++){l=Object(arguments[f]);for(var d in l)e.call(l,d)&&(c[d]=l[d]);if(n){a=n(l);for(var u=0;u<a.length;u++)t.call(l,a[u])&&(c[a[u]]=l[a[u]])}}return c},uc}var Nf;function My(){if(Nf)return Er;Nf=1,Cf();var n=I,e=60103;if(Er.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var t=Symbol.for;e=t("react.element"),Er.Fragment=t("react.fragment")}var r=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o=Object.prototype.hasOwnProperty,s={key:!0,ref:!0,__self:!0,__source:!0};function i(l,c,a){var f,d={},u=null,h=null;a!==void 0&&(u=""+a),c.key!==void 0&&(u=""+c.key),c.ref!==void 0&&(h=c.ref);for(f in c)o.call(c,f)&&!s.hasOwnProperty(f)&&(d[f]=c[f]);if(l&&l.defaultProps)for(f in c=l.defaultProps,c)d[f]===void 0&&(d[f]=c[f]);return{$$typeof:e,type:l,key:u,ref:h,props:d,_owner:r.current}}return Er.jsx=i,Er.jsxs=i,Er}var fc={};var Sf;function Dy(){return Sf||(Sf=1,function(n){process.env.NODE_ENV!=="production"&&function(){var e=I,t=Cf(),r=60103,o=60106;n.Fragment=60107;var s=60108,i=60114,l=60109,c=60110,a=60112,f=60113,d=60120,u=60115,h=60116,g=60121,p=60122,_=60117,y=60129,m=60131;if(typeof Symbol=="function"&&Symbol.for){var C=Symbol.for;r=C("react.element"),o=C("react.portal"),n.Fragment=C("react.fragment"),s=C("react.strict_mode"),i=C("react.profiler"),l=C("react.provider"),c=C("react.context"),a=C("react.forward_ref"),f=C("react.suspense"),d=C("react.suspense_list"),u=C("react.memo"),h=C("react.lazy"),g=C("react.block"),p=C("react.server.block"),_=C("react.fundamental"),C("react.scope"),C("react.opaque.id"),y=C("react.debug_trace_mode"),C("react.offscreen"),m=C("react.legacy_hidden")}var N=typeof Symbol=="function"&&Symbol.iterator,S="@@iterator";function T(b){if(b===null||typeof b!="object")return null;var $=N&&b[N]||b[S];return typeof $=="function"?$:null}var E=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(b){{for(var $=arguments.length,j=new Array($>1?$-1:0),re=1;re<$;re++)j[re-1]=arguments[re];w("error",b,j)}}function w(b,$,j){{var re=E.ReactDebugCurrentFrame,_e=re.getStackAddendum();_e!==""&&($+="%s",j=j.concat([_e]));var me=j.map(function(fe){return""+fe});me.unshift("Warning: "+$),Function.prototype.apply.call(console[b],console,me)}}var O=!1;function D(b){return!!(typeof b=="string"||typeof b=="function"||b===n.Fragment||b===i||b===y||b===s||b===f||b===d||b===m||O||typeof b=="object"&&b!==null&&(b.$$typeof===h||b.$$typeof===u||b.$$typeof===l||b.$$typeof===c||b.$$typeof===a||b.$$typeof===_||b.$$typeof===g||b[0]===p))}function B(b,$,j){var re=$.displayName||$.name||"";return b.displayName||(re!==""?j+"("+re+")":j)}function q(b){return b.displayName||"Context"}function Y(b){if(b==null)return null;if(typeof b.tag=="number"&&x("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof b=="function")return b.displayName||b.name||null;if(typeof b=="string")return b;switch(b){case n.Fragment:return"Fragment";case o:return"Portal";case i:return"Profiler";case s:return"StrictMode";case f:return"Suspense";case d:return"SuspenseList"}if(typeof b=="object")switch(b.$$typeof){case c:var $=b;return q($)+".Consumer";case l:var j=b;return q(j._context)+".Provider";case a:return B(b,b.render,"ForwardRef");case u:return Y(b.type);case g:return Y(b._render);case h:{var re=b,_e=re._payload,me=re._init;try{return Y(me(_e))}catch{return null}}}return null}var J=0,oe,F,ce,se,We,ae,Ae;function Ge(){}Ge.__reactDisabledLog=!0;function Xe(){{if(J===0){oe=console.log,F=console.info,ce=console.warn,se=console.error,We=console.group,ae=console.groupCollapsed,Ae=console.groupEnd;var b={configurable:!0,enumerable:!0,value:Ge,writable:!0};Object.defineProperties(console,{info:b,log:b,warn:b,error:b,group:b,groupCollapsed:b,groupEnd:b})}J++}}function qe(){{if(J--,J===0){var b={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:t({},b,{value:oe}),info:t({},b,{value:F}),warn:t({},b,{value:ce}),error:t({},b,{value:se}),group:t({},b,{value:We}),groupCollapsed:t({},b,{value:ae}),groupEnd:t({},b,{value:Ae})})}J<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Te=E.ReactCurrentDispatcher,nt;function ze(b,$,j){{if(nt===void 0)try{throw Error()}catch(_e){var re=_e.stack.trim().match(/\n( *(at )?)/);nt=re&&re[1]||""}return`
2
+ `+nt+b}}var ve=!1,St;{var er=typeof WeakMap=="function"?WeakMap:Map;St=new er}function ff(b,$){if(!b||ve)return"";{var j=St.get(b);if(j!==void 0)return j}var re;ve=!0;var _e=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var me;me=Te.current,Te.current=null,Xe();try{if($){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(Tn){re=Tn}Reflect.construct(b,[],fe)}else{try{fe.call()}catch(Tn){re=Tn}b.call(fe.prototype)}}else{try{throw Error()}catch(Tn){re=Tn}b()}}catch(Tn){if(Tn&&re&&typeof Tn.stack=="string"){for(var ue=Tn.stack.split(`
3
+ `),ht=re.stack.split(`
4
+ `),$e=ue.length-1,Le=ht.length-1;$e>=1&&Le>=0&&ue[$e]!==ht[Le];)Le--;for(;$e>=1&&Le>=0;$e--,Le--)if(ue[$e]!==ht[Le]){if($e!==1||Le!==1)do if($e--,Le--,Le<0||ue[$e]!==ht[Le]){var Sn=`
5
+ `+ue[$e].replace(" at new "," at ");return typeof b=="function"&&St.set(b,Sn),Sn}while($e>=1&&Le>=0);break}}}finally{ve=!1,Te.current=me,qe(),Error.prepareStackTrace=_e}var wo=b?b.displayName||b.name:"",Oy=wo?ze(wo):"";return typeof b=="function"&&St.set(b,Oy),Oy}function _y(b,$,j){return ff(b,!1)}function _v(b){var $=b.prototype;return!!($&&$.isReactComponent)}function cc(b,$,j){if(b==null)return"";if(typeof b=="function")return ff(b,_v(b));if(typeof b=="string")return ze(b);switch(b){case f:return ze("Suspense");case d:return ze("SuspenseList")}if(typeof b=="object")switch(b.$$typeof){case a:return _y(b.render);case u:return cc(b.type,$,j);case g:return _y(b._render);case h:{var re=b,_e=re._payload,me=re._init;try{return cc(me(_e),$,j)}catch{}}}return""}var my={},yy=E.ReactDebugCurrentFrame;function ac(b){if(b){var $=b._owner,j=cc(b.type,b._source,$?$.type:null);yy.setExtraStackFrame(j)}else yy.setExtraStackFrame(null)}function mv(b,$,j,re,_e){{var me=Function.call.bind(Object.prototype.hasOwnProperty);for(var fe in b)if(me(b,fe)){var ue=void 0;try{if(typeof b[fe]!="function"){var ht=Error((re||"React class")+": "+j+" type `"+fe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof b[fe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ht.name="Invariant Violation",ht}ue=b[fe]($,fe,re,j,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch($e){ue=$e}ue&&!(ue instanceof Error)&&(ac(_e),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",re||"React class",j,fe,typeof ue),ac(null)),ue instanceof Error&&!(ue.message in my)&&(my[ue.message]=!0,ac(_e),x("Failed %s type: %s",j,ue.message),ac(null))}}}var Us=E.ReactCurrentOwner,df=Object.prototype.hasOwnProperty,yv={key:!0,ref:!0,__self:!0,__source:!0},Cy,Ny,hf;hf={};function Cv(b){if(df.call(b,"ref")){var $=Object.getOwnPropertyDescriptor(b,"ref").get;if($&&$.isReactWarning)return!1}return b.ref!==void 0}function Nv(b){if(df.call(b,"key")){var $=Object.getOwnPropertyDescriptor(b,"key").get;if($&&$.isReactWarning)return!1}return b.key!==void 0}function Sv(b,$){if(typeof b.ref=="string"&&Us.current&&$&&Us.current.stateNode!==$){var j=Y(Us.current.type);hf[j]||(x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',Y(Us.current.type),b.ref),hf[j]=!0)}}function Tv(b,$){{var j=function(){Cy||(Cy=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",$))};j.isReactWarning=!0,Object.defineProperty(b,"key",{get:j,configurable:!0})}}function xv(b,$){{var j=function(){Ny||(Ny=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",$))};j.isReactWarning=!0,Object.defineProperty(b,"ref",{get:j,configurable:!0})}}var Ev=function(b,$,j,re,_e,me,fe){var ue={$$typeof:r,type:b,key:$,ref:j,props:fe,_owner:me};return ue._store={},Object.defineProperty(ue._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ue,"_self",{configurable:!1,enumerable:!1,writable:!1,value:re}),Object.defineProperty(ue,"_source",{configurable:!1,enumerable:!1,writable:!1,value:_e}),Object.freeze&&(Object.freeze(ue.props),Object.freeze(ue)),ue};function wv(b,$,j,re,_e){{var me,fe={},ue=null,ht=null;j!==void 0&&(ue=""+j),Nv($)&&(ue=""+$.key),Cv($)&&(ht=$.ref,Sv($,_e));for(me in $)df.call($,me)&&!yv.hasOwnProperty(me)&&(fe[me]=$[me]);if(b&&b.defaultProps){var $e=b.defaultProps;for(me in $e)fe[me]===void 0&&(fe[me]=$e[me])}if(ue||ht){var Le=typeof b=="function"?b.displayName||b.name||"Unknown":b;ue&&Tv(fe,Le),ht&&xv(fe,Le)}return Ev(b,ue,ht,_e,re,Us.current,fe)}}var gf=E.ReactCurrentOwner,Sy=E.ReactDebugCurrentFrame;function Eo(b){if(b){var $=b._owner,j=cc(b.type,b._source,$?$.type:null);Sy.setExtraStackFrame(j)}else Sy.setExtraStackFrame(null)}var pf;pf=!1;function _f(b){return typeof b=="object"&&b!==null&&b.$$typeof===r}function Ty(){{if(gf.current){var b=Y(gf.current.type);if(b)return`
6
6
 
7
- Check the render method of \``+E+"`."}return""}}function Mv(E){{if(E!==void 0){var k=E.fileName.replace(/^.*[\\\/]/,""),z=E.lineNumber;return`
7
+ Check the render method of \``+b+"`."}return""}}function bv(b){{if(b!==void 0){var $=b.fileName.replace(/^.*[\\\/]/,""),j=b.lineNumber;return`
8
8
 
9
- Check your code at `+k+":"+z+"."}return""}}var Ty={};function Dv(E){{var k=Sy();if(!k){var z=typeof E=="string"?E:E.displayName||E.name;z&&(k=`
9
+ Check your code at `+$+":"+j+"."}return""}}var xy={};function Ov(b){{var $=Ty();if(!$){var j=typeof b=="string"?b:b.displayName||b.name;j&&($=`
10
10
 
11
- Check the top-level render call using <`+z+">.")}return k}}function xy(E,k){{if(!E._store||E._store.validated||E.key!=null)return;E._store.validated=!0;var z=Dv(k);if(Ty[z])return;Ty[z]=!0;var oe="";E&&E._owner&&E._owner!==gf.current&&(oe=" It was passed a child from "+Y(E._owner.type)+"."),xr(E),m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',z,oe),xr(null)}}function Ey(E,k){{if(typeof E!="object")return;if(df(E))for(var z=0;z<E.length;z++){var oe=E[z];_f(oe)&&xy(oe,k)}else if(_f(E))E._store&&(E._store.validated=!0);else if(E){var de=_(E);if(typeof de=="function"&&de!==E.entries)for(var me=de.call(E),fe;!(fe=me.next()).done;)_f(fe.value)&&xy(fe.value,k)}}}function Av(E){{var k=E.type;if(k==null||typeof k=="string")return;var z;if(typeof k=="function")z=k.propTypes;else if(typeof k=="object"&&(k.$$typeof===c||k.$$typeof===d))z=k.propTypes;else return;if(z){var oe=Y(k);mv(z,E.props,"prop",oe,E)}else if(k.PropTypes!==void 0&&!pf){pf=!0;var de=Y(k);m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",de||"Unknown")}typeof k.getDefaultProps=="function"&&!k.getDefaultProps.isReactClassApproved&&m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function kv(E){{for(var k=Object.keys(E.props),z=0;z<k.length;z++){var oe=k[z];if(oe!=="children"&&oe!=="key"){xr(E),m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",oe),xr(null);break}}E.ref!==null&&(xr(E),m("Invalid attribute `ref` supplied to `React.Fragment`."),xr(null))}}function wy(E,k,z,oe,de,me){{var fe=O(E);if(!fe){var ae="";(E===void 0||typeof E=="object"&&E!==null&&Object.keys(E).length===0)&&(ae+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ht=Mv(de);ht?ae+=ht:ae+=Sy();var $e;E===null?$e="null":df(E)?$e="array":E!==void 0&&E.$$typeof===e?($e="<"+(Y(E.type)||"Unknown")+" />",ae=" Did you accidentally export a JSX literal instead of a component?"):$e=typeof E,m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",$e,ae)}var Le=vv(E,k,z,de,me);if(Le==null)return Le;if(fe){var At=k.children;if(At!==void 0)if(oe)if(df(At)){for(var Er=0;Er<At.length;Er++)Ey(At[Er],E);Object.freeze&&Object.freeze(At)}else m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ey(At,E)}return E===o?kv(Le):Av(Le),Le}}function Rv(E,k,z){return wy(E,k,z,!0)}function $v(E,k,z){return wy(E,k,z,!1)}var Pv=$v,Iv=Rv;br.Fragment=o,br.jsx=Pv,br.jsxs=Iv}()),br}(function(n){process.env.NODE_ENV==="production"?n.exports=vy():n.exports=My()})(W);function ne(n){return{type:n}}const Js=ne("SELECTION_CHANGE_COMMAND"),Dy=ne("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Nf=ne("CLICK_COMMAND"),Or=ne("DELETE_CHARACTER_COMMAND"),vr=ne("INSERT_LINE_BREAK_COMMAND"),dc=ne("INSERT_PARAGRAPH_COMMAND"),wo=ne("CONTROLLED_TEXT_INSERTION_COMMAND"),hc=ne("PASTE_COMMAND"),gc=ne("REMOVE_TEXT_COMMAND"),Mr=ne("DELETE_WORD_COMMAND"),Dr=ne("DELETE_LINE_COMMAND"),En=ne("FORMAT_TEXT_COMMAND"),pc=ne("UNDO_COMMAND"),_c=ne("REDO_COMMAND"),Sf=ne("KEYDOWN_COMMAND"),Tf=ne("KEY_ARROW_RIGHT_COMMAND"),xf=ne("MOVE_TO_END"),Ef=ne("KEY_ARROW_LEFT_COMMAND"),wf=ne("MOVE_TO_START"),bf=ne("KEY_ARROW_UP_COMMAND"),Of=ne("KEY_ARROW_DOWN_COMMAND"),Vs=ne("KEY_ENTER_COMMAND"),vf=ne("KEY_SPACE_COMMAND"),Mf=ne("KEY_BACKSPACE_COMMAND"),Df=ne("KEY_ESCAPE_COMMAND"),Af=ne("KEY_DELETE_COMMAND"),kf=ne("KEY_TAB_COMMAND"),Ay=ne("INSERT_TAB_COMMAND"),ky=ne("INDENT_CONTENT_COMMAND"),Ry=ne("OUTDENT_CONTENT_COMMAND"),Rf=ne("DROP_COMMAND"),$y=ne("FORMAT_ELEMENT_COMMAND"),$f=ne("DRAGSTART_COMMAND"),Pf=ne("DRAGOVER_COMMAND"),If=ne("DRAGEND_COMMAND"),mc=ne("COPY_COMMAND"),yc=ne("CUT_COMMAND"),Cc=ne("SELECT_ALL_COMMAND"),Py=ne("CLEAR_EDITOR_COMMAND"),Iy=ne("CLEAR_HISTORY_COMMAND"),Ly=ne("CAN_REDO_COMMAND"),Fy=ne("CAN_UNDO_COMMAND"),Lf=ne("FOCUS_COMMAND"),Ff=ne("BLUR_COMMAND"),Bf=ne("KEY_MODIFIER_COMMAND"),kt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",By=kt&&"documentMode"in document?document.documentMode:null,Rt=kt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),wn=kt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Gs=kt&&"InputEvent"in window&&!By?"getTargetRanges"in new window.InputEvent("input"):!1,Nc=kt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Xs=kt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Ky=kt&&/Android/.test(navigator.userAgent),Kf=kt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Wy=kt&&Ky&&Kf,Sc=kt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Kf,Ar=1,bn=3,to=0,Wf=1,bo=2,zf=0,Tc=1,xc=2,qs=1,Qs=1<<1,kr=1<<2,Rr=1<<3,Zs=1<<4,ei=1<<5,ti=1<<6,ni=1<<7,Uf=qs|Qs|kr|Rr|Zs|ei|ti|ni,Ec=1,oi=1<<1,wc=1,bc=2,Oc=3,vc=4,Mc=5,Dc=6,jf=" ",ri=Nc||Xs||Sc?jf:"​",un=`
11
+ Check the top-level render call using <`+j+">.")}return $}}function Ey(b,$){{if(!b._store||b._store.validated||b.key!=null)return;b._store.validated=!0;var j=Ov($);if(xy[j])return;xy[j]=!0;var re="";b&&b._owner&&b._owner!==gf.current&&(re=" It was passed a child from "+Y(b._owner.type)+"."),Eo(b),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',j,re),Eo(null)}}function wy(b,$){{if(typeof b!="object")return;if(Array.isArray(b))for(var j=0;j<b.length;j++){var re=b[j];_f(re)&&Ey(re,$)}else if(_f(b))b._store&&(b._store.validated=!0);else if(b){var _e=T(b);if(typeof _e=="function"&&_e!==b.entries)for(var me=_e.call(b),fe;!(fe=me.next()).done;)_f(fe.value)&&Ey(fe.value,$)}}}function vv(b){{var $=b.type;if($==null||typeof $=="string")return;var j;if(typeof $=="function")j=$.propTypes;else if(typeof $=="object"&&($.$$typeof===a||$.$$typeof===u))j=$.propTypes;else return;if(j){var re=Y($);mv(j,b.props,"prop",re,b)}else if($.PropTypes!==void 0&&!pf){pf=!0;var _e=Y($);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",_e||"Unknown")}typeof $.getDefaultProps=="function"&&!$.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Mv(b){{for(var $=Object.keys(b.props),j=0;j<$.length;j++){var re=$[j];if(re!=="children"&&re!=="key"){Eo(b),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",re),Eo(null);break}}b.ref!==null&&(Eo(b),x("Invalid attribute `ref` supplied to `React.Fragment`."),Eo(null))}}function by(b,$,j,re,_e,me){{var fe=D(b);if(!fe){var ue="";(b===void 0||typeof b=="object"&&b!==null&&Object.keys(b).length===0)&&(ue+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ht=bv(_e);ht?ue+=ht:ue+=Ty();var $e;b===null?$e="null":Array.isArray(b)?$e="array":b!==void 0&&b.$$typeof===r?($e="<"+(Y(b.type)||"Unknown")+" />",ue=" Did you accidentally export a JSX literal instead of a component?"):$e=typeof b,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",$e,ue)}var Le=wv(b,$,j,_e,me);if(Le==null)return Le;if(fe){var Sn=$.children;if(Sn!==void 0)if(re)if(Array.isArray(Sn)){for(var wo=0;wo<Sn.length;wo++)wy(Sn[wo],b);Object.freeze&&Object.freeze(Sn)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else wy(Sn,b)}return b===n.Fragment?Mv(Le):vv(Le),Le}}function Dv(b,$,j){return by(b,$,j,!0)}function Av(b,$,j){return by(b,$,j,!1)}var kv=Av,Rv=Dv;n.jsx=kv,n.jsxs=Rv}()}(fc)),fc}(function(n){process.env.NODE_ENV==="production"?n.exports=My():n.exports=Dy()})(W);function ne(n){return{type:n}}const Ys=ne("SELECTION_CHANGE_COMMAND"),Ay=ne("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Tf=ne("CLICK_COMMAND"),bo=ne("DELETE_CHARACTER_COMMAND"),Oo=ne("INSERT_LINE_BREAK_COMMAND"),dc=ne("INSERT_PARAGRAPH_COMMAND"),wr=ne("CONTROLLED_TEXT_INSERTION_COMMAND"),hc=ne("PASTE_COMMAND"),gc=ne("REMOVE_TEXT_COMMAND"),vo=ne("DELETE_WORD_COMMAND"),Mo=ne("DELETE_LINE_COMMAND"),En=ne("FORMAT_TEXT_COMMAND"),pc=ne("UNDO_COMMAND"),_c=ne("REDO_COMMAND"),xf=ne("KEYDOWN_COMMAND"),Ef=ne("KEY_ARROW_RIGHT_COMMAND"),wf=ne("MOVE_TO_END"),bf=ne("KEY_ARROW_LEFT_COMMAND"),Of=ne("MOVE_TO_START"),vf=ne("KEY_ARROW_UP_COMMAND"),Mf=ne("KEY_ARROW_DOWN_COMMAND"),Js=ne("KEY_ENTER_COMMAND"),Df=ne("KEY_SPACE_COMMAND"),Af=ne("KEY_BACKSPACE_COMMAND"),kf=ne("KEY_ESCAPE_COMMAND"),Rf=ne("KEY_DELETE_COMMAND"),$f=ne("KEY_TAB_COMMAND"),ky=ne("INSERT_TAB_COMMAND"),Ry=ne("INDENT_CONTENT_COMMAND"),$y=ne("OUTDENT_CONTENT_COMMAND"),Pf=ne("DROP_COMMAND"),Py=ne("FORMAT_ELEMENT_COMMAND"),If=ne("DRAGSTART_COMMAND"),Lf=ne("DRAGOVER_COMMAND"),Ff=ne("DRAGEND_COMMAND"),mc=ne("COPY_COMMAND"),yc=ne("CUT_COMMAND"),Cc=ne("SELECT_ALL_COMMAND"),Iy=ne("CLEAR_EDITOR_COMMAND"),Ly=ne("CLEAR_HISTORY_COMMAND"),Fy=ne("CAN_REDO_COMMAND"),By=ne("CAN_UNDO_COMMAND"),Bf=ne("FOCUS_COMMAND"),Kf=ne("BLUR_COMMAND"),Wf=ne("KEY_MODIFIER_COMMAND"),At=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ky=At&&"documentMode"in document?document.documentMode:null,kt=At&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),wn=At&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Vs=At&&"InputEvent"in window&&!Ky?"getTargetRanges"in new window.InputEvent("input"):!1,Nc=At&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Gs=At&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Wy=At&&/Android/.test(navigator.userAgent),zf=At&&/^(?=.*Chrome).*/i.test(navigator.userAgent),zy=At&&Wy&&zf,Sc=At&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!zf,Do=1,bn=3,tr=0,jf=1,br=2,Uf=0,Tc=1,xc=2,Xs=1,qs=1<<1,Ao=1<<2,ko=1<<3,Qs=1<<4,Zs=1<<5,ei=1<<6,ti=1<<7,Hf=Xs|qs|Ao|ko|Qs|Zs|ei|ti,Ec=1,ni=1<<1,wc=1,bc=2,Oc=3,vc=4,Mc=5,Dc=6,Yf=" ",ri=Nc||Gs||Sc?Yf:"​",an=`
12
12
 
13
- `,zy=wn?jf:ri,Hf="֑-߿יִ-﷽ﹰ-ﻼ",Yf="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Uy=new RegExp("^[^"+Yf+"]*["+Hf+"]"),jy=new RegExp("^[^"+Hf+"]*["+Yf+"]"),Gt={bold:qs,code:Zs,highlight:ni,italic:Qs,strikethrough:kr,subscript:ei,superscript:ti,underline:Rr},Hy={directionless:Ec,unmergeable:oi},Jf={center:bc,end:Dc,justify:vc,left:wc,right:Oc,start:Mc},Yy={[bc]:"center",[Dc]:"end",[vc]:"justify",[wc]:"left",[Oc]:"right",[Mc]:"start"},Jy={normal:zf,segmented:xc,token:Tc},Vy={[zf]:"normal",[xc]:"segmented",[Tc]:"token"};function si(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[o]of t.matchAll(/\S+/g))e.push(o);return e}const Gy=100;let Ac=!1,kc=0;function Xy(){return Ac}function qy(n){kc=n.timeStamp}function Qy(n){kc===0&&hi(n).addEventListener("textInput",qy,!0)}function Rc(n,e,t){return e.__lexicalLineBreak===n||n[`__lexicalKey_${t._key}`]!==void 0}function Zy(n){return n.getEditorState().read(()=>{const e=he();return e!==null?e.clone():null})}function eC(n,e,t){const o=qt(t._window);let r=null,s=null;o!==null&&o.anchorNode===n&&(r=o.anchorOffset,s=o.focusOffset);const i=n.nodeValue;i!==null&&Bc(e,i,r,s,!1)}function tC(n,e,t){if(ee(n)){const o=n.anchor.getNode();if(o.is(t)&&n.format!==o.getFormat())return!1}return e.nodeType===bn&&t.isAttached()}function Vf(n,e,t){Ac=!0;const o=performance.now()-kc>Gy;try{xt(n,()=>{const r=he()||Zy(n),s=new Map,i=n.getRootElement(),l=n._editorState,c=n._blockCursorElement;let a=!1,f="";for(let u=0;u<e.length;u++){const h=e[u],g=h.type,p=h.target;let _=Ir(p,l);if(!(_===null&&p!==i||xe(_))){if(g==="characterData")o&&X(_)&&tC(r,p,_)&&eC(p,_,n);else if(g==="childList"){a=!0;const y=h.addedNodes;for(let N=0;N<y.length;N++){const S=y[N],T=rd(S),b=S.parentNode;if(b!=null&&S!==c&&T===null&&(S.nodeName!=="BR"||!Rc(S,b,n))){if(wn){const x=S.innerText||S.nodeValue;x&&(f+=x)}b.removeChild(S)}}const m=h.removedNodes,C=m.length;if(C>0){let N=0;for(let S=0;S<C;S++){const T=m[S];(T.nodeName==="BR"&&Rc(T,p,n)||c===T)&&(p.appendChild(T),N++)}C!==N&&(p===i&&(_=ld(l)),s.set(p,_))}}}}if(s.size>0)for(const[u,h]of s)if(R(h)){const g=h.getChildrenKeys();let p=u.firstChild;for(let _=0;_<g.length;_++){const y=g[_],m=n.getElementByKey(y);m!==null&&(p==null?(u.appendChild(m),p=m):p!==m&&u.replaceChild(m,p),p=p.nextSibling)}}else X(h)&&h.markDirty();const d=t.takeRecords();if(d.length>0){for(let u=0;u<d.length;u++){const h=d[u],g=h.addedNodes,p=h.target;for(let _=0;_<g.length;_++){const y=g[_],m=y.parentNode;m!=null&&y.nodeName==="BR"&&!Rc(y,p,n)&&m.removeChild(y)}}t.takeRecords()}r!==null&&(a&&(r.dirty=!0,Xt(r)),wn&&md(n)&&r.insertRawText(f))})}finally{Ac=!1}}function Gf(n){const e=n._observer;if(e!==null){const t=e.takeRecords();Vf(n,t,e)}}function Xf(n){Qy(n),n._observer=new MutationObserver((e,t)=>{Vf(n,e,t)})}function qf(n,e){const t=n.__mode,o=n.__format,r=n.__style,s=e.__mode,i=e.__format,l=e.__style;return(t===null||t===s)&&(o===null||o===i)&&(r===null||r===l)}function Qf(n,e){const t=n.mergeWithSibling(e),o=Se()._normalizedNodes;return o.add(n.__key),o.add(e.__key),t}function Zf(n){let e=n;if(e.__text===""&&e.isSimpleText()&&!e.isUnmergeable()){e.remove();return}let t;for(;(t=e.getPreviousSibling())!==null&&X(t)&&t.isSimpleText()&&!t.isUnmergeable();)if(t.__text==="")t.remove();else if(qf(t,e)){e=Qf(t,e);break}else break;let o;for(;(o=e.getNextSibling())!==null&&X(o)&&o.isSimpleText()&&!o.isUnmergeable();)if(o.__text==="")o.remove();else if(qf(e,o)){e=Qf(e,o);break}else break}function ed(n){return td(n.anchor),td(n.focus),n}function td(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let o,r;if(t===e.getChildrenSize()?(o=e.getChildAtIndex(t-1),r=!0):(o=e.getChildAtIndex(t),r=!1),X(o)){n.set(o.__key,r?o.getTextContentSize():0,"text");break}else if(!R(o))break;n.set(o.__key,r?o.getChildrenSize():0,"element")}}let nd=1;function nC(){nd=1}function oC(){return""+nd++}function rC(n,e){const t=n._nodes.get(e);if(t===void 0)throw Error(`registeredNode: Type ${e} not found`);return t}const sC=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function iC(n){return xe(Ir(n))}function $c(n){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return xe(Ir(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&Pr(e)==null)}function $r(n,e,t){const o=n.getRootElement();try{return o!==null&&o.contains(e)&&o.contains(t)&&e!==null&&!$c(e)&&Pc(e)===n}catch{return!1}}function ii(n){return n instanceof Ai}function Pc(n){let e=n;for(;e!=null;){const t=Pr(e);if(ii(t))return t;e=fi(e)}return null}function Pr(n){return n?n.__lexicalEditor:null}function lC(n){return Uy.test(n)?"rtl":jy.test(n)?"ltr":null}function no(n){return n.isToken()||n.isSegmented()}function cC(n){return n.nodeType===bn}function li(n){let e=n;for(;e!=null;){if(cC(e))return e;e=e.firstChild}return null}function Ic(n,e,t){const o=Gt[e];if(t!==null&&(n&o)===(t&o))return n;let r=n^o;return e==="subscript"?r&=~Gt.superscript:e==="superscript"&&(r&=~Gt.subscript),r}function aC(n){return X(n)||io(n)||xe(n)}function od(n,e){if(e!=null){uC(n,e),n.__key=e;return}ot(),ih();const t=Se(),o=Zt(),r=oC();o._nodeMap.set(r,n),R(n)?t._dirtyElements.set(r,!0):t._dirtyLeaves.add(r),t._cloneNotNeeded.add(r),t._dirtyType=Wf,n.__key=r}function uC(n,e){const t=cS();if(!t)return;const o=t._nodeMap.get(e);if(o&&o.constructor!==n.constructor)throw n.constructor.name!==o.constructor.name?Error(`Lexical node with constructor ${n.constructor.name} attempted to re-use key from node in active editor state with constructor ${o.constructor.name}. Keys must not be re-used when the type is changed.`):Error(`Lexical node with constructor ${n.constructor.name} attempted to re-use key from node in active editor state with different constructor with the same name (possibly due to invalid Hot Module Replacement). Keys must not be re-used when the type is changed.`)}function fC(n,e,t){let o=n;for(;o!==null;){if(t.has(o))return;const r=e.get(o);if(r===void 0)break;t.set(o,!1),o=r.__parent}}function oo(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),o=e.getWritable(),r=n.getPreviousSibling(),s=n.getNextSibling();if(r===null)if(s!==null){const i=s.getWritable();o.__first=s.__key,i.__prev=null}else o.__first=null;else{const i=r.getWritable();if(s!==null){const l=s.getWritable();l.__prev=i.__key,i.__next=l.__key}else i.__next=null;t.__prev=null}if(s===null)if(r!==null){const i=r.getWritable();o.__last=r.__key,i.__next=null}else o.__last=null;else{const i=s.getWritable();if(r!==null){const l=r.getWritable();l.__next=i.__key,i.__prev=l.__key}else i.__prev=null;t.__next=null}o.__size--,t.__parent=null}}function ci(n){ih();const e=n.getLatest(),t=e.__parent,o=Zt(),r=Se(),s=o._nodeMap,i=r._dirtyElements;t!==null&&fC(t,s,i);const l=e.__key;r._dirtyType=Wf,R(n)?i.set(l,!0):r._dirtyLeaves.add(l)}function dC(n){const e=n.getPreviousSibling(),t=n.getNextSibling();e!==null&&ci(e),t!==null&&ci(t)}function Ue(n){ot();const e=Se(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const o=Qe(t);o!==null&&o.getWritable()}if(n!==null){const o=Qe(n);o!==null&&o.getWritable()}}}function On(){return Io()?null:Se()._compositionKey}function Qe(n,e){const o=(e||Zt())._nodeMap.get(n);return o===void 0?null:o}function rd(n,e){const t=Se(),o=n[`__lexicalKey_${t._key}`];return o!==void 0?Qe(o,e):null}function Ir(n,e){let t=n;for(;t!=null;){const o=rd(t,e);if(o!==null)return o;t=fi(t)}return null}function sd(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function id(n){return n.read(()=>Tt().getTextContent())}function hC(n,e){xt(n,()=>{const t=Zt();if(t.isEmpty())return;if(e==="root"){Tt().markDirty();return}const o=t._nodeMap;for(const[,r]of o)r.markDirty()},n._pendingEditorState===null?{tag:"history-merge"}:void 0)}function Tt(){return ld(Zt())}function ld(n){return n._nodeMap.get("root")}function Xt(n){ot();const e=Zt();if(n!==null){if(Object.isFrozen(n))throw Error("$setSelection called on frozen selection object. Ensure selection is cloned before passing in.");n.dirty=!0,n.setCachedNodes(null)}e._selection=n}function gC(){ot();const n=Se();Gf(n)}function Oo(n){const e=Se(),t=pC(n,e);if(t===null){const o=e.getRootElement();return n===o?Qe("root"):null}return Qe(t)}function cd(n,e){return e?n.getTextContentSize():0}function pC(n,e){let t=n;for(;t!=null;){const o=t[`__lexicalKey_${e._key}`];if(o!==void 0)return o;t=fi(t)}return null}function ad(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function Lc(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function ud(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function fd(n){return n.nodeType===bn?n.nodeValue:null}function Fc(n,e,t){const o=qt(e._window);if(o===null)return;const r=o.anchorNode;let{anchorOffset:s,focusOffset:i}=o;if(r!==null){let l=fd(r);const c=Ir(r);if(l!==null&&X(c)){if(l===ri&&t){const a=t.length;l=t,s=a,i=a}l!==null&&Bc(c,l,s,i,n)}}}function Bc(n,e,t,o,r){let s=n;if(s.isAttached()&&(r||!s.isDirty())){const i=s.isComposing();let l=e;(i||r)&&e[e.length-1]===ri&&(l=e.slice(0,-1));const c=s.getTextContent();if(r||l!==c){if(l===""){if(Ue(null),!Nc&&!Xs&&!Sc){const p=Se();setTimeout(()=>{p.update(()=>{s.isAttached()&&s.remove()})},20)}else s.remove();return}const a=s.getParent(),f=Po(),d=s.getTextContentSize(),u=On(),h=s.getKey();if(s.isToken()||u!==null&&h===u&&!i||ee(f)&&(a!==null&&!a.canInsertTextBefore()&&f.anchor.offset===0||f.anchor.key===n.__key&&f.anchor.offset===0&&!s.canInsertTextBefore()&&!i||f.focus.key===n.__key&&f.focus.offset===d&&!s.canInsertTextAfter()&&!i)){s.markDirty();return}const g=he();if(!ee(g)||t===null||o===null){s.setTextContent(l);return}if(g.setTextNodeRange(s,t,s,o),s.isSegmented()){const p=s.getTextContent(),_=Ze(p);s.replace(_),s=_}s.setTextContent(l)}}}function _C(n){const e=n.getPreviousSibling();return(X(e)||R(e)&&e.isInline())&&!e.canInsertTextAfter()}function mC(n,e){if(e.isSegmented())return!0;if(!n.isCollapsed())return!1;const t=n.anchor.offset,o=e.getParentOrThrow(),r=e.isToken();return t===0?!e.canInsertTextBefore()||!o.canInsertTextBefore()&&!e.isComposing()||r||_C(e):t===e.getTextContentSize()?!e.canInsertTextAfter()||!o.canInsertTextAfter()&&!e.isComposing()||r:!1}function yC(n,e,t,o){return n==="Tab"&&!e&&!t&&!o}function CC(n,e,t,o){return n.toLowerCase()==="b"&&!e&&Lr(t,o)}function NC(n,e,t,o){return n.toLowerCase()==="i"&&!e&&Lr(t,o)}function SC(n,e,t,o){return n.toLowerCase()==="u"&&!e&&Lr(t,o)}function TC(n,e){return gd(n)&&!e}function xC(n,e){return gd(n)&&e}function EC(n,e){return Rt&&e&&n.toLowerCase()==="o"}function wC(n,e,t){return Fr(n)&&(Rt?e:t)}function bC(n,e,t){return Br(n)&&(Rt?e:t)}function OC(n,e){return Rt&&e&&Fr(n)}function vC(n,e){return Rt&&e&&Br(n)}function MC(n,e,t,o){return Rt?e||t?!1:Fr(n)||n.toLowerCase()==="h"&&o:o||e||t?!1:Fr(n)}function DC(n,e,t,o,r){return Rt?t||o||r?!1:Br(n)||n.toLowerCase()==="d"&&e:e||o||r?!1:Br(n)}function AC(n,e,t,o){return n.toLowerCase()==="z"&&!e&&Lr(t,o)}function kC(n,e,t,o){return Rt?n.toLowerCase()==="z"&&t&&e:n.toLowerCase()==="y"&&o||n.toLowerCase()==="z"&&o&&e}function RC(n,e,t,o){return e?!1:n.toLowerCase()==="c"?Rt?t:o:!1}function $C(n,e,t,o){return e?!1:n.toLowerCase()==="x"?Rt?t:o:!1}function dd(n){return n==="ArrowLeft"}function hd(n){return n==="ArrowRight"}function PC(n){return n==="ArrowUp"}function IC(n){return n==="ArrowDown"}function LC(n,e,t,o){return dd(n)&&!e&&!o&&!t}function FC(n,e,t,o,r){return dd(n)&&!o&&!t&&(e||r)}function BC(n,e,t,o){return hd(n)&&!e&&!o&&!t}function KC(n,e,t,o,r){return hd(n)&&!o&&!t&&(e||r)}function WC(n,e,t){return PC(n)&&!e&&!t}function zC(n,e,t){return IC(n)&&!e&&!t}function UC(n,e,t,o){return n||e||t||o}function jC(n){return n===" "}function Lr(n,e){return Rt?n:e}function gd(n){return n==="Enter"}function Fr(n){return n==="Backspace"}function HC(n){return n==="Escape"}function Br(n){return n==="Delete"}function pd(n,e,t){return n.toLowerCase()==="a"&&Lr(e,t)}function YC(){const n=Tt(),e=n.select(0,n.getChildrenSize());Xt(ed(e))}function Kr(n,e){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const t=n.__lexicalClassNameCache,o=t[e];if(o!==void 0)return o;const r=n[e];if(typeof r=="string"){const s=si(r);return t[e]=s,s}return r}function Kc(n,e,t,o,r){if(t.size===0)return;const s=o.__type,i=o.__key,l=e.get(s);if(l===void 0)throw Error(`Type ${s} not in registeredNodes`);const c=l.klass;let a=n.get(c);a===void 0&&(a=new Map,n.set(c,a));const f=a.get(i),d=f==="destroyed"&&r==="created";(f===void 0||d)&&a.set(i,d?"updated":r)}function JC(n){const e=n.getType(),t=Zt();if(t._readOnly){const s=Td(t).get(e);return s?Array.from(s.values()):[]}const o=t._nodeMap,r=[];for(const[,s]of o)s instanceof n&&s.__type===e&&s.isAttached()&&r.push(s);return r}function _d(n,e,t){const o=n.getParent();let r=t,s=n;return o!==null&&(e&&t===0?(r=s.getIndexWithinParent(),s=o):!e&&t===s.getChildrenSize()&&(r=s.getIndexWithinParent()+1,s=o)),s.getChildAtIndex(e?r-1:r)}function Wc(n,e){const t=n.offset;if(n.type==="element"){const o=n.getNode();return _d(o,e,t)}else{const o=n.getNode();if(e&&t===0||!e&&t===o.getTextContentSize()){const r=e?o.getPreviousSibling():o.getNextSibling();return r===null?_d(o.getParentOrThrow(),e,o.getIndexWithinParent()+(e?0:1)):r}}return null}function md(n){const e=hi(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function j(n,e,t){return dh(n,e,t)}function ai(n){return!pt(n)&&!n.isLastChild()&&!n.isInline()}function ui(n,e){const t=n._keyToDOMMap.get(e);if(t===void 0)throw Error(`Reconciliation: could not find DOM element for node key ${e}`);return t}function fi(n){const e=n.assignedSlot||n.parentElement;return e!==null&&e.nodeType===11?e.host:e}function VC(n,e,t){const o=t.ownerDocument,r=o.defaultView;if(r===null)return;let{top:s,bottom:i}=e,l=0,c=0,a=t;for(;a!==null;){const f=a===o.body;if(f)l=0,c=hi(n).innerHeight;else{const u=a.getBoundingClientRect();l=u.top,c=u.bottom}let d=0;if(s<l?d=-(l-s):i>c&&(d=i-c),d!==0)if(f)r.scrollBy(0,d);else{const u=a.scrollTop;a.scrollTop+=d;const h=a.scrollTop-u;s-=h,i-=h}if(f)break;a=fi(a)}}function GC(n){return Se()._updateTags.has(n)}function XC(n){ot(),Se()._updateTags.add(n)}function qC(n){const e=he();if(!ee(e)||!R(n))return e;const{anchor:t,focus:o}=e,r=t.getNode(),s=o.getNode();return di(r,n)&&t.set(n.__key,0,"element"),di(s,n)&&o.set(n.__key,0,"element"),e}function di(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function QC(n){const e=n.ownerDocument;return e&&e.defaultView||null}function hi(n){const e=n._window;if(e===null)throw Error("window object not found");return e}function ZC(n){return R(n)&&n.isInline()||xe(n)&&n.isInline()}function yd(n){let e=n.getParentOrThrow();for(;e!==null;){if(vn(e))return e;e=e.getParentOrThrow()}return e}function vn(n){return pt(n)||R(n)&&n.isShadowRoot()}function Cd(n){const e=n.constructor.clone(n);return od(e,null),e}function Wr(n){const e=Se(),t=n.constructor.getType(),o=e._nodes.get(t);if(o===void 0)throw Error('$initializeNode failed. Ensure node has been registered to the editor. You can do this by passing the node class via the "nodes" array in the editor config.');const r=o.replace;if(r!==null){const s=r(n);if(!(s instanceof n.constructor))throw Error("$initializeNode failed. Ensure replacement node is a subclass of the original node.");return s}return n}function zc(n,e){const t=n.getParent();if(pt(t)&&!R(e)&&!xe(e))throw Error("Only element or decorator nodes can be inserted in to the root node")}function eN(n){const e=Qe(n);if(e===null)throw Error(`Expected node with key ${n} to exist but it's not in the nodeMap.`);return e}function tN(n){const e=n.theme,t=document.createElement("div");t.contentEditable="false",t.setAttribute("data-lexical-cursor","true");let o=e.blockCursor;if(o!==void 0){if(typeof o=="string"){const r=si(o);o=e.blockCursor=r}o!==void 0&&t.classList.add(...o)}return t}function Uc(n){return(xe(n)||R(n)&&!n.canBeEmpty())&&!n.isInline()}function jc(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const o=n.parentElement;o!==null&&o.removeChild(n)}function nN(n,e,t){let o=n._blockCursorElement;if(ee(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const r=t.anchor,s=r.getNode(),i=r.offset,l=s.getChildrenSize();let c=!1,a=null;if(i===l){const f=s.getChildAtIndex(i-1);Uc(f)&&(c=!0)}else{const f=s.getChildAtIndex(i);if(Uc(f)){const d=f.getPreviousSibling();(d===null||Uc(d))&&(c=!0,a=n.getElementByKey(f.__key))}}if(c){const f=n.getElementByKey(s.__key);o===null&&(n._blockCursorElement=o=tN(n._config)),e.style.caretColor="transparent",a===null?f.appendChild(o):f.insertBefore(o,a);return}}o!==null&&jc(o,n,e)}function qt(n){return kt?(n||window).getSelection():null}function oN(n,e){let t=n.getChildAtIndex(e);if(t==null&&(t=n),vn(n))throw Error("Can not call $splitNode() on root element");const o=i=>{const l=i.getParentOrThrow(),c=vn(l),a=i===t&&!c?i:Cd(i);if(c){if(!(R(i)&&R(a)))throw Error("Children of a root must be ElementNode");return i.insertAfter(a),[i,a,a]}else{const[f,d,u]=o(l),h=i.getNextSiblings();return u.append(a,...h),[f,d,a]}},[r,s]=o(t);return[r,s]}function rN(n){return gi(n)&&n.tagName==="A"}function gi(n){return n.nodeType===1}function Nd(n){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return n.nodeName.match(e)!==null}function Hc(n){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return n.nodeName.match(e)!==null}function vo(n){if(pt(n)||xe(n)&&!n.isInline())return!0;if(!R(n)||vn(n))return!1;const e=n.getFirstChild(),t=e===null||io(e)||X(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function Yc(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function sN(){return Se()}const Sd=new WeakMap,iN=new Map;function Td(n){if(!n._readOnly&&n.isEmpty())return iN;if(!n._readOnly)throw Error("getCachedTypeToNodeMap called with a writable EditorState");let e=Sd.get(n);if(!e){e=new Map,Sd.set(n,e);for(const[t,o]of n._nodeMap){const r=o.__type;let s=e.get(r);s||(s=new Map,e.set(r,s)),s.set(t,o)}}return e}function xd(n){const e=n.constructor,t=e.clone(n);t.afterCloneFrom(n);{if(t.__key!==n.__key)throw Error(`$cloneWithProperties: ${e.name}.clone(node) (with type '${e.getType()}') did not return a node with the same key, make sure to specify node.__key as the last argument to the constructor`);if(!(t.__parent===n.__parent&&t.__next===n.__next&&t.__prev===n.__prev))throw Error(`$cloneWithProperties: ${e.name}.clone(node) (with type '${e.getType()}') overrided afterCloneFrom but did not call super.afterCloneFrom(prevNode)`)}return t}function lN(n,e){const t=n._decorators;let r=n._pendingDecorators||t;const s=e._nodeMap;let i;for(i in r)s.has(i)||(r===t&&(r=sd(n)),delete r[i])}function Ed(n,e,t,o,r,s){let i=n.getFirstChild();for(;i!==null;){const l=i.__key;i.__parent===e&&(R(i)&&Ed(i,l,t,o,r,s),t.has(l)||s.delete(l),r.push(l)),i=i.getNextSibling()}}function cN(n,e,t,o){const r=n._nodeMap,s=e._nodeMap,i=[];for(const[l]of o){const c=s.get(l);c!==void 0&&(c.isAttached()||(R(c)&&Ed(c,l,r,s,i,o),r.has(l)||o.delete(l),i.push(l)))}for(const l of i)s.delete(l);for(const l of t){const c=s.get(l);c!==void 0&&!c.isAttached()&&(r.has(l)||t.delete(l),s.delete(l))}}let Fe="",ct="",Qt=null,$t="",fn="",Mn,at,zr,wd=!1,Ur=!1,pi,_i=null,Jc,Vc,ro,Pt,Gc,jr;function mi(n,e){const t=ro.get(n);if(e!==null){const o=Zc(n);o.parentNode===e&&e.removeChild(o)}if(Pt.has(n)||at._keyToDOMMap.delete(n),R(t)){const o=Ci(t,ro);Xc(o,0,o.length-1,null)}t!==void 0&&Kc(jr,zr,pi,t,"destroyed")}function Xc(n,e,t,o){let r=e;for(;r<=t;++r){const s=n[r];s!==void 0&&mi(s,o)}}function so(n,e){n.setProperty("text-align",e)}const aN="40px";function bd(n,e){const t=Mn.theme.indent;if(typeof t=="string"){const r=n.classList.contains(t);e>0&&!r?n.classList.add(t):e<1&&r&&n.classList.remove(t)}const o=getComputedStyle(n).getPropertyValue("--lexical-indent-base-value")||aN;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${o})`)}function Od(n,e){const t=n.style;e===0?so(t,""):e===wc?so(t,"left"):e===bc?so(t,"center"):e===Oc?so(t,"right"):e===vc?so(t,"justify"):e===Mc?so(t,"start"):e===Dc&&so(t,"end")}function yi(n,e,t){const o=Pt.get(n);if(o===void 0)throw Error("createNode: node does not exist in nodeMap");const r=o.createDOM(Mn,at);if(yN(n,r,at),X(o)?r.setAttribute("data-lexical-text","true"):xe(o)&&r.setAttribute("data-lexical-decorator","true"),R(o)){const s=o.__indent,i=o.__size;if(s!==0&&bd(r,s),i!==0){const c=i-1,a=Ci(o,Pt);uN(a,c,o,r)}const l=o.__format;l!==0&&Od(r,l),o.isInline()||Md(null,o,r),ai(o)&&(Fe+=un,fn+=un)}else{const s=o.getTextContent();if(xe(o)){const i=o.decorate(at,Mn);i!==null&&Ad(n,i),r.contentEditable="false"}else X(o)&&(o.isDirectionless()||(ct+=s));Fe+=s,fn+=s}if(e!==null)if(t!=null)e.insertBefore(r,t);else{const s=e.__lexicalLineBreak;s!=null?e.insertBefore(r,s):e.appendChild(r)}return Object.freeze(o),Kc(jr,zr,pi,o,"created"),r}function uN(n,e,t,o){const r=ct;ct="",qc(n,t,0,e,o,null),Dd(t,o),ct=r}function qc(n,e,t,o,r,s){const i=Fe;Fe="";let l=t;for(;l<=o;++l){yi(n[l],r,s);const c=Pt.get(n[l]);c!==null&&X(c)&&(Qt===null&&(Qt=c.getFormat()),$t===""&&($t=c.getStyle()))}ai(e)&&(Fe+=un),r.__lexicalTextContent=Fe,Fe=i+Fe}function vd(n,e){const t=e.get(n);return io(t)||xe(t)&&t.isInline()}function Md(n,e,t){const o=n!==null&&(n.__size===0||vd(n.__last,ro)),r=e.__size===0||vd(e.__last,Pt);if(o){if(!r){const s=t.__lexicalLineBreak;if(s!=null)try{t.removeChild(s)}catch(i){if(typeof i=="object"&&i!=null){const l=`${i.toString()} Parent: ${t.tagName}, child: ${s.tagName}.`;throw new Error(l)}else throw i}t.__lexicalLineBreak=null}}else if(r){const s=document.createElement("br");t.__lexicalLineBreak=s,t.appendChild(s)}}function fN(n){ma(n)&&Qt!=null&&Qt!==n.__textFormat&&!Ur&&(n.setTextFormat(Qt),n.setTextStyle($t))}function dN(n){ma(n)&&$t!==""&&$t!==n.__textStyle&&!Ur&&n.setTextStyle($t)}function Dd(n,e){const t=e.__lexicalDirTextContent,o=e.__lexicalDir;if(t!==ct||o!==_i){const r=ct==="",s=r?_i:lC(ct);if(s!==o){const i=e.classList,l=Mn.theme;let c=o!==null?l[o]:void 0,a=s!==null?l[s]:void 0;if(c!==void 0){if(typeof c=="string"){const f=si(c);c=l[o]=f}i.remove(...c)}if(s===null||r&&s==="ltr")e.removeAttribute("dir");else{if(a!==void 0){if(typeof a=="string"){const f=si(a);a=l[s]=f}a!==void 0&&i.add(...a)}e.dir=s}if(!Ur){const f=n.getWritable();f.__dir=s}}_i=s,e.__lexicalDirTextContent=ct,e.__lexicalDir=s}}function hN(n,e,t){const o=ct;ct="",Qt=null,$t="",gN(n,e,t),Dd(e,t),fN(e),dN(e),ct=o}function Ci(n,e){const t=[];let o=n.__first;for(;o!==null;){const r=e.get(o);if(r===void 0)throw Error("createChildrenArray: node does not exist in nodeMap");t.push(o),o=r.__next}return t}function gN(n,e,t){const o=Fe,r=n.__size,s=e.__size;if(Fe="",r===1&&s===1){const i=n.__first,l=e.__first;if(i===l)Hr(i,t);else{const a=Zc(i),f=yi(l,null,null);try{t.replaceChild(f,a)}catch(d){if(typeof d=="object"&&d!=null){const u=`${d.toString()} Parent: ${t.tagName}, new child: {tag: ${f.tagName} key: ${l}}, old child: {tag: ${a.tagName}, key: ${i}}.`;throw new Error(u)}else throw d}mi(i,null)}const c=Pt.get(l);X(c)&&(Qt===null&&(Qt=c.getFormat()),$t===""&&($t=c.getStyle()))}else{const i=Ci(n,ro),l=Ci(e,Pt);if(r===0)s!==0&&qc(l,e,0,s-1,t,null);else if(s===0){if(r!==0){const a=t.__lexicalLineBreak==null;Xc(i,0,r-1,a?null:t),a&&(t.textContent="")}}else _N(e,i,l,r,s,t)}ai(e)&&(Fe+=un),t.__lexicalTextContent=Fe,Fe=o+Fe}function Hr(n,e){const t=ro.get(n);let o=Pt.get(n);if(t===void 0||o===void 0)throw Error("reconcileNode: prevNode or nextNode does not exist in nodeMap");const r=wd||Vc.has(n)||Jc.has(n),s=ui(at,n);if(t===o&&!r){if(R(t)){const i=s.__lexicalTextContent;i!==void 0&&(Fe+=i,fn+=i);const l=s.__lexicalDirTextContent;l!==void 0&&(ct+=l)}else{const i=t.getTextContent();X(t)&&!t.isDirectionless()&&(ct+=i),fn+=i,Fe+=i}return s}if(t!==o&&r&&Kc(jr,zr,pi,o,"updated"),o.updateDOM(t,s,Mn)){const i=yi(n,null,null);if(e===null)throw Error("reconcileNode: parentDOM is null");return e.replaceChild(i,s),mi(n,null),i}if(R(t)&&R(o)){const i=o.__indent;i!==t.__indent&&bd(s,i);const l=o.__format;l!==t.__format&&Od(s,l),r&&(hN(t,o,s),!pt(o)&&!o.isInline()&&Md(t,o,s)),ai(o)&&(Fe+=un,fn+=un)}else{const i=o.getTextContent();if(xe(o)){const l=o.decorate(at,Mn);l!==null&&Ad(n,l)}else X(o)&&!o.isDirectionless()&&(ct+=i);Fe+=i,fn+=i}if(!Ur&&pt(o)&&o.__cachedText!==fn){const i=o.getWritable();i.__cachedText=fn,o=i}return Object.freeze(o),s}function Ad(n,e){let t=at._pendingDecorators;const o=at._decorators;if(t===null){if(o[n]===e)return;t=sd(at)}t[n]=e}function pN(n){return n.firstChild}function Qc(n){let e=n.nextSibling;return e!==null&&e===at._blockCursorElement&&(e=e.nextSibling),e}function _N(n,e,t,o,r,s){const i=o-1,l=r-1;let c,a,f=pN(s),d=0,u=0;for(;d<=i&&u<=l;){const p=e[d],_=t[u];if(p===_)f=Qc(Hr(_,s)),d++,u++;else{c===void 0&&(c=new Set(e)),a===void 0&&(a=new Set(t));const m=a.has(p),C=c.has(_);if(!m)f=Qc(Zc(p)),mi(p,s),d++;else if(!C)yi(_,s,f),u++;else{const N=ui(at,_);N===f?f=Qc(Hr(_,s)):(f!=null?s.insertBefore(N,f):s.appendChild(N),Hr(_,s)),d++,u++}}const y=Pt.get(_);y!==null&&X(y)&&(Qt===null&&(Qt=y.getFormat()),$t===""&&($t=y.getStyle()))}const h=d>i,g=u>l;if(h&&!g){const p=t[l+1],_=p===void 0?null:at.getElementByKey(p);qc(t,n,u,l,s,_)}else g&&!h&&Xc(e,d,i,s)}function mN(n,e,t,o,r,s){Fe="",fn="",ct="",wd=o===bo,_i=null,at=t,Mn=t._config,zr=t._nodes,pi=at._listeners.mutation,Jc=r,Vc=s,ro=n._nodeMap,Pt=e._nodeMap,Ur=e._readOnly,Gc=new Map(t._keyToDOMMap);const i=new Map;return jr=i,Hr("root",null),at=void 0,zr=void 0,Jc=void 0,Vc=void 0,ro=void 0,Pt=void 0,Mn=void 0,Gc=void 0,jr=void 0,i}function yN(n,e,t){const o=t._keyToDOMMap;e["__lexicalKey_"+t._key]=n,o.set(n,e)}function Zc(n){const e=Gc.get(n);if(e===void 0)throw Error(`Reconciliation: could not find DOM element for node key ${n}`);return e}const dn=Object.freeze({}),ea=30,ta=[["keydown",ON],["pointerdown",NN],["compositionstart",wN],["compositionend",bN],["input",EN],["click",CN],["cut",dn],["copy",dn],["dragstart",dn],["dragover",dn],["dragend",dn],["paste",dn],["focus",dn],["blur",dn],["drop",dn]];Gs&&ta.push(["beforeinput",(n,e)=>xN(n,e)]);let Yr=0,kd=null,Rd=0,Mo=null;const Ni=new WeakMap;let na=!1,oa=!1,Jr=!1,Vr=!1,$d=[0,"",0,"root",0];function Pd(n,e,t,o,r){const s=n.anchor,i=n.focus,l=s.getNode(),c=Se(),a=qt(c._window),f=a!==null?a.anchorNode:null,d=s.key,u=c.getElementByKey(d),h=t.length;return d!==i.key||!X(l)||(!r&&(!Gs||Rd<o+50)||l.isDirty()&&h<2||ad(t))&&s.offset!==i.offset&&!l.isComposing()||no(l)||l.isDirty()&&h>1||(r||!Gs)&&u!==null&&!l.isComposing()&&f!==li(u)||a!==null&&e!==null&&(!e.collapsed||e.startContainer!==a.anchorNode||e.startOffset!==a.anchorOffset)||l.getFormat()!==n.format||l.getStyle()!==n.style||mC(n,l)}function Id(n,e){return n!==null&&n.nodeValue!==null&&n.nodeType===bn&&e!==0&&e!==n.nodeValue.length}function Ld(n,e,t){const{anchorNode:o,anchorOffset:r,focusNode:s,focusOffset:i}=n;na&&(na=!1,Id(o,r)&&Id(s,i))||xt(e,()=>{if(!t){Xt(null);return}if(!$r(e,o,s))return;const l=he();if(ee(l)){const c=l.anchor,a=c.getNode();if(l.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(l.dirty=!0);const f=hi(e).event,d=f?f.timeStamp:performance.now(),[u,h,g,p,_]=$d,y=Tt(),m=e.isComposing()===!1&&y.getTextContent()==="";if(d<_+200&&c.offset===g&&c.key===p)l.format=u,l.style=h;else if(c.type==="text"){if(!X(a))throw Error("Point.getNode() must return TextNode when type is text");l.format=a.getFormat(),l.style=a.getStyle()}else if(c.type==="element"&&!m){const C=c.getNode();l.style="",C instanceof lo&&C.getChildrenSize()===0?(l.format=C.getTextFormat(),l.style=C.getTextStyle()):l.format=0}}else{const f=c.key,u=l.focus.key,h=l.getNodes(),g=h.length,p=l.isBackward(),_=p?i:r,y=p?r:i,m=p?u:f,C=p?f:u;let N=Uf,S=!1;for(let T=0;T<g;T++){const b=h[T],x=b.getTextContentSize();if(X(b)&&x!==0&&!(T===0&&b.__key===m&&_===x||T===g-1&&b.__key===C&&y===0)&&(S=!0,N&=b.getFormat(),N===0))break}l.format=S?N:0}}j(e,Js,void 0)})}function CN(n,e){xt(e,()=>{const t=he(),o=qt(e._window),r=Po();if(o){if(ee(t)){const s=t.anchor,i=s.getNode();if(s.type==="element"&&s.offset===0&&t.isCollapsed()&&!pt(i)&&Tt().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&r!==null&&t.is(r))o.removeAllRanges(),t.dirty=!0;else if(n.detail===3&&!t.isCollapsed()){const c=t.focus.getNode();i!==c&&(R(i)?i.select(0):i.getParentOrThrow().select(0))}}else if(n.pointerType==="touch"){const s=o.anchorNode;if(s!==null){const i=s.nodeType;if(i===Ar||i===bn){const l=bi(r,o,e,n);Xt(l)}}}}j(e,Nf,n)})}function NN(n,e){const t=n.target,o=n.pointerType;t instanceof Node&&o!=="touch"&&xt(e,()=>{iC(t)||(oa=!0)})}function Fd(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function SN(n,e){return n!==e||R(n)||R(e)||!n.isToken()||!e.isToken()}function TN(n){return kd==="MediaLast"&&n<Yr+ea}function xN(n,e){const t=n.inputType,o=Fd(n);t==="deleteCompositionText"||wn&&md(e)||t!=="insertCompositionText"&&xt(e,()=>{const r=he();if(t==="deleteContentBackward"){if(r===null){const f=Po();if(!ee(f))return;Xt(f.clone())}if(ee(r)){const f=r.anchor.key===r.focus.key;if(TN(n.timeStamp)&&e.isComposing()&&f){if(Ue(null),Yr=0,setTimeout(()=>{xt(e,()=>{Ue(null)})},ea),ee(r)){const d=r.anchor.getNode();if(d.markDirty(),r.format=d.getFormat(),!X(d))throw Error("Anchor node must be a TextNode");r.style=d.getStyle()}}else{Ue(null),n.preventDefault();const d=r.anchor.getNode().getTextContent(),u=r.anchor.offset===0&&r.focus.offset===d.length;Wy&&f&&!u||j(e,Or,!0)}return}}if(!ee(r))return;const s=n.data;Mo!==null&&Fc(!1,e,Mo),(!r.dirty||Mo!==null)&&r.isCollapsed()&&!pt(r.anchor.getNode())&&o!==null&&r.applyDOMRange(o),Mo=null;const i=r.anchor,l=r.focus,c=i.getNode(),a=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(s===`
14
- `)n.preventDefault(),j(e,vr,!1);else if(s===un)n.preventDefault(),j(e,dc,void 0);else if(s==null&&n.dataTransfer){const f=n.dataTransfer.getData("text/plain");n.preventDefault(),r.insertRawText(f)}else s!=null&&Pd(r,o,s,n.timeStamp,!0)?(n.preventDefault(),j(e,wo,s)):Mo=s;Rd=n.timeStamp;return}switch(n.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":{j(e,wo,n);break}case"insertFromComposition":{Ue(null),j(e,wo,n);break}case"insertLineBreak":{Ue(null),j(e,vr,!1);break}case"insertParagraph":{Ue(null),Jr&&!Xs?(Jr=!1,j(e,vr,!1)):j(e,dc,void 0);break}case"insertFromPaste":case"insertFromPasteAsQuotation":{j(e,hc,n);break}case"deleteByComposition":{SN(c,a)&&j(e,gc,n);break}case"deleteByDrag":case"deleteByCut":{j(e,gc,n);break}case"deleteContent":{j(e,Or,!1);break}case"deleteWordBackward":{j(e,Mr,!0);break}case"deleteWordForward":{j(e,Mr,!1);break}case"deleteHardLineBackward":case"deleteSoftLineBackward":{j(e,Dr,!0);break}case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":{j(e,Dr,!1);break}case"formatStrikeThrough":{j(e,En,"strikethrough");break}case"formatBold":{j(e,En,"bold");break}case"formatItalic":{j(e,En,"italic");break}case"formatUnderline":{j(e,En,"underline");break}case"historyUndo":{j(e,pc,void 0);break}case"historyRedo":{j(e,_c,void 0);break}}})}function EN(n,e){n.stopPropagation(),xt(e,()=>{const t=he(),o=n.data,r=Fd(n);if(o!=null&&ee(t)&&Pd(t,r,o,n.timeStamp,!1)){Vr&&(ra(e,o),Vr=!1);const i=t.anchor.getNode(),l=qt(e._window);if(l===null)return;const c=t.isBackward(),a=c?t.anchor.offset:t.focus.offset,f=c?t.focus.offset:t.anchor.offset;(!Gs||t.isCollapsed()||!X(i)||l.anchorNode===null||i.getTextContent().slice(0,a)+o+i.getTextContent().slice(a+f)!==fd(l.anchorNode))&&j(e,wo,o);const d=o.length;wn&&d>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=d),!Nc&&!Xs&&!Sc&&e.isComposing()&&(Yr=0,Ue(null))}else Fc(!1,e,o!==null?o:void 0),Vr&&(ra(e,o||void 0),Vr=!1);gC()}),Mo=null}function wN(n,e){xt(e,()=>{const t=he();if(ee(t)&&!e.isComposing()){const o=t.anchor,r=t.anchor.getNode();Ue(o.key),(n.timeStamp<Yr+ea||o.type==="element"||!t.isCollapsed()||r.getFormat()!==t.format||X(r)&&r.getStyle()!==t.style)&&j(e,wo,zy)}})}function ra(n,e){const t=n._compositionKey;if(Ue(null),t!==null&&e!=null){if(e===""){const o=Qe(t),r=li(n.getElementByKey(t));r!==null&&r.nodeValue!==null&&X(o)&&Bc(o,r.nodeValue,null,null,!0);return}if(e[e.length-1]===`
15
- `){const o=he();if(ee(o)){const r=o.focus;o.anchor.set(r.key,r.offset,r.type),j(n,Vs,null);return}}}Fc(!0,n,e)}function bN(n,e){wn?Vr=!0:xt(e,()=>{ra(e,n.data)})}function ON(n,e){if(Yr=n.timeStamp,kd=n.key,e.isComposing())return;const{key:t,shiftKey:o,ctrlKey:r,metaKey:s,altKey:i}=n;if(!j(e,Sf,n)&&t!=null){if(BC(t,r,i,s))j(e,Tf,n);else if(KC(t,r,o,i,s))j(e,xf,n);else if(LC(t,r,i,s))j(e,Ef,n);else if(FC(t,r,o,i,s))j(e,wf,n);else if(WC(t,r,s))j(e,bf,n);else if(zC(t,r,s))j(e,Of,n);else if(xC(t,o))Jr=!0,j(e,Vs,n);else if(jC(t))j(e,vf,n);else if(EC(t,r))n.preventDefault(),Jr=!0,j(e,vr,!0);else if(TC(t,o))Jr=!1,j(e,Vs,n);else if(MC(t,i,s,r))Fr(t)?j(e,Mf,n):(n.preventDefault(),j(e,Or,!0));else if(HC(t))j(e,Df,n);else if(DC(t,r,o,i,s))Br(t)?j(e,Af,n):(n.preventDefault(),j(e,Or,!1));else if(wC(t,i,r))n.preventDefault(),j(e,Mr,!0);else if(bC(t,i,r))n.preventDefault(),j(e,Mr,!1);else if(OC(t,s))n.preventDefault(),j(e,Dr,!0);else if(vC(t,s))n.preventDefault(),j(e,Dr,!1);else if(CC(t,i,s,r))n.preventDefault(),j(e,En,"bold");else if(SC(t,i,s,r))n.preventDefault(),j(e,En,"underline");else if(NC(t,i,s,r))n.preventDefault(),j(e,En,"italic");else if(yC(t,i,r,s))j(e,kf,n);else if(AC(t,o,s,r))n.preventDefault(),j(e,pc,void 0);else if(kC(t,o,s,r))n.preventDefault(),j(e,_c,void 0);else{const l=e._editorState._selection;Gr(l)?RC(t,o,s,r)?(n.preventDefault(),j(e,mc,n)):$C(t,o,s,r)?(n.preventDefault(),j(e,yc,n)):pd(t,s,r)&&(n.preventDefault(),j(e,Cc,n)):!wn&&pd(t,s,r)&&(n.preventDefault(),j(e,Cc,n))}UC(r,o,i,s)&&j(e,Bf,n)}}function Bd(n){let e=n.__lexicalEventHandles;return e===void 0&&(e=[],n.__lexicalEventHandles=e),e}const Do=new Map;function Kd(n){const e=n.target,t=e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView,o=qt(t);if(o===null)return;const r=Pc(o.anchorNode);if(r===null)return;oa&&(oa=!1,xt(r,()=>{const f=Po(),d=o.anchorNode;if(d===null)return;const u=d.nodeType;if(u!==Ar&&u!==bn)return;const h=bi(f,o,r,n);Xt(h)}));const s=Lc(r),i=s[s.length-1],l=i._key,c=Do.get(l),a=c||i;a!==r&&Ld(o,a,!1),Ld(o,r,!0),r!==i?Do.set(l,r):c&&Do.delete(l)}function Wd(n){n._lexicalHandled=!0}function zd(n){return n._lexicalHandled===!0}function vN(n,e){const t=n.ownerDocument,o=Ni.get(t);(o===void 0||o<1)&&t.addEventListener("selectionchange",Kd),Ni.set(t,(o||0)+1),n.__lexicalEditor=e;const r=Bd(n);for(let s=0;s<ta.length;s++){const[i,l]=ta[s],c=typeof l=="function"?a=>{zd(a)||(Wd(a),(e.isEditable()||i==="click")&&l(a,e))}:a=>{if(zd(a))return;Wd(a);const f=e.isEditable();switch(i){case"cut":return f&&j(e,yc,a);case"copy":return j(e,mc,a);case"paste":return f&&j(e,hc,a);case"dragstart":return f&&j(e,$f,a);case"dragover":return f&&j(e,Pf,a);case"dragend":return f&&j(e,If,a);case"focus":return f&&j(e,Lf,a);case"blur":return f&&j(e,Ff,a);case"drop":return f&&j(e,Rf,a)}};n.addEventListener(i,c),r.push(()=>{n.removeEventListener(i,c)})}}function MN(n){const e=n.ownerDocument,t=Ni.get(e);if(t===void 0)throw Error("Root element not registered");const o=t-1;if(!(o>=0))throw Error("Root element count less than 0");Ni.set(e,o),o===0&&e.removeEventListener("selectionchange",Kd);const r=Pr(n);if(ii(r))DN(r),n.__lexicalEditor=null;else if(r)throw Error("Attempted to remove event handlers from a node that does not belong to this build of Lexical");const s=Bd(n);for(let i=0;i<s.length;i++)s[i]();n.__lexicalEventHandles=[]}function DN(n){if(n._parentEditor!==null){const e=Lc(n),o=e[e.length-1]._key;Do.get(o)===n&&Do.delete(o)}else Do.delete(n._key)}function AN(){na=!0}function kN(n,e,t,o,r){$d=[n,e,t,o,r]}function sa(n,e,t){ot();const o=n.__key,r=n.getParent();if(r===null)return;const s=qC(n);let i=!1;if(ee(s)&&e){const l=s.anchor,c=s.focus;l.key===o&&(vi(l,n,r,n.getPreviousSibling(),n.getNextSibling()),i=!0),c.key===o&&(vi(c,n,r,n.getPreviousSibling(),n.getNextSibling()),i=!0)}else Gr(s)&&e&&n.isSelected()&&n.selectPrevious();if(ee(s)&&e&&!i){const l=n.getIndexWithinParent();oo(n),Oi(s,r,l,-1)}else oo(n);!t&&!vn(r)&&!r.canBeEmpty()&&r.isEmpty()&&sa(r,e),e&&pt(r)&&r.isEmpty()&&r.selectEnd()}class Si{static getType(){throw Error(`LexicalNode: Node ${this.name} does not implement .getType().`)}static clone(e){throw Error(`LexicalNode: Node ${this.name} does not implement .clone().`)}afterCloneFrom(e){this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,od(this,e),this.__type!=="root"&&(ot(),RN(this.__type,this.constructor))}getType(){return this.__type}isInline(){throw Error(`LexicalNode: Node ${this.constructor.name} does not implement .isInline().`)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=Qe(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||he();if(t==null)return!1;const o=t.getNodes().some(s=>s.__key===this.__key);if(X(this))return o;if(ee(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const s=this.getParent();if(xe(this)&&this.isInline()&&s){const i=t.isBackward()?t.focus:t.anchor,l=i.getNode();if(i.offset===l.getChildrenSize()&&l.is(s)&&l.getLastChildOrThrow().is(this))return!1}}return o}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),o=0;for(;t!==null;){if(this.is(t))return o;o++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:Qe(e)}getParentOrThrow(){const e=this.getParent();if(e===null)throw Error(`Expected node ${this.__key} to have a parent.`);return e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(vn(t)){if(!(R(e)||e===this&&xe(e)))throw Error("Children of root nodes must be elements or decorators");return e}e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();if(e===null)throw Error(`Expected node ${this.__key} to have a top parent element.`);return e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const t=this.getLatest().__prev;return t===null?null:Qe(t)}getPreviousSiblings(){const e=[],t=this.getParent();if(t===null)return e;let o=t.getFirstChild();for(;o!==null&&!o.is(this);)e.push(o),o=o.getNextSibling();return e}getNextSibling(){const t=this.getLatest().__next;return t===null?null:Qe(t)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=this.getParents(),o=e.getParents();R(this)&&t.unshift(this),R(e)&&o.unshift(e);const r=t.length,s=o.length;if(r===0||s===0||t[r-1]!==o[s-1])return null;const i=new Set(o);for(let l=0;l<r;l++){const c=t[l];if(i.has(c))return c}return null}is(e){return e==null?!1:this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;const t=this.getCommonAncestor(e);let o=0,r=0,s=this;for(;;){const i=s.getParentOrThrow();if(i===t){o=s.getIndexWithinParent();break}s=i}for(s=e;;){const i=s.getParentOrThrow();if(i===t){r=s.getIndexWithinParent();break}s=i}return o<r}isParentOf(e){const t=this.__key;if(t===e.__key)return!1;let o=e;for(;o!==null;){if(o.__key===t)return!0;o=o.getParent()}return!1}getNodesBetween(e){const t=this.isBefore(e),o=[],r=new Set;let s=this;for(;s!==null;){const i=s.__key;if(r.has(i)||(r.add(i),o.push(s)),s===e)break;const l=R(s)?t?s.getFirstChild():s.getLastChild():null;if(l!==null){s=l;continue}const c=t?s.getNextSibling():s.getPreviousSibling();if(c!==null){s=c;continue}const a=s.getParentOrThrow();if(r.has(a.__key)||o.push(a),a===e)break;let f=null,d=a;do{if(d===null)throw Error("getNodesBetween: ancestor is null");if(f=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d!==null)f===null&&!r.has(d.__key)&&o.push(d);else break}while(f===null);s=f}return t||o.reverse(),o}isDirty(){const t=Se()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){const e=Qe(this.__key);if(e===null)throw Error("Lexical node does not exist in active editor state. Avoid using the same node references between nested closures from editorState.read/editor.update.");return e}getWritable(){ot();const e=Zt(),t=Se(),o=e._nodeMap,r=this.__key,s=this.getLatest(),i=t._cloneNotNeeded,l=he();if(l!==null&&l.setCachedNodes(null),i.has(r))return ci(s),s;const c=xd(s);return i.add(r),ci(c),o.set(r,c),c}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){throw Error("createDOM: base method not extended")}updateDOM(e,t,o){throw Error("updateDOM: base method not extended")}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){throw Error("exportJSON: base method not extended")}static importJSON(e){throw Error(`LexicalNode: Node ${this.name} does not implement .importJSON().`)}static transform(){return null}remove(e){sa(this,!0,e)}replace(e,t){ot();let o=he();o!==null&&(o=o.clone()),zc(this,e);const r=this.getLatest(),s=this.__key,i=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;oo(l);const f=r.getPreviousSibling(),d=r.getNextSibling(),u=r.__prev,h=r.__next,g=r.__parent;if(sa(r,!1,!0),f===null)c.__first=i;else{const p=f.getWritable();p.__next=i}if(l.__prev=u,d===null)c.__last=i;else{const p=d.getWritable();p.__prev=i}if(l.__next=h,l.__parent=g,c.__size=a,t){if(!(R(this)&&R(l)))throw Error("includeChildren should only be true for ElementNodes");this.getChildren().forEach(p=>{l.append(p)})}if(ee(o)){Xt(o);const p=o.anchor,_=o.focus;p.key===s&&Gd(p,l),_.key===s&&Gd(_,l)}return On()===s&&Ue(i),l}insertAfter(e,t=!0){ot(),zc(this,e);const o=this.getWritable(),r=e.getWritable(),s=r.getParent(),i=he();let l=!1,c=!1;if(s!==null){const h=e.getIndexWithinParent();if(oo(r),ee(i)){const g=s.__key,p=i.anchor,_=i.focus;l=p.type==="element"&&p.key===g&&p.offset===h+1,c=_.type==="element"&&_.key===g&&_.offset===h+1}}const a=this.getNextSibling(),f=this.getParentOrThrow().getWritable(),d=r.__key,u=o.__next;if(a===null)f.__last=d;else{const h=a.getWritable();h.__prev=d}if(f.__size++,o.__next=d,r.__next=u,r.__prev=o.__key,r.__parent=o.__parent,t&&ee(i)){const h=this.getIndexWithinParent();Oi(i,f,h+1);const g=f.__key;l&&i.anchor.set(g,h+2,"element"),c&&i.focus.set(g,h+2,"element")}return e}insertBefore(e,t=!0){ot(),zc(this,e);const o=this.getWritable(),r=e.getWritable(),s=r.__key;oo(r);const i=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),c=o.__prev,a=this.getIndexWithinParent();if(i===null)l.__first=s;else{const d=i.getWritable();d.__next=s}l.__size++,o.__prev=s,r.__prev=c,r.__next=o.__key,r.__parent=o.__parent;const f=he();if(t&&ee(f)){const d=this.getParentOrThrow();Oi(f,d,a)}return e}isParentRequired(){return!1}createParentElementNode(){return hn()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){ot();const o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if(R(o))return o.select();if(!X(o)){const s=o.getIndexWithinParent()+1;return r.select(s,s)}return o.select(e,t)}selectNext(e,t){ot();const o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if(R(o))return o.select(0,0);if(!X(o)){const s=o.getIndexWithinParent();return r.select(s,s)}return o.select(e,t)}markDirty(){this.getWritable()}}function RN(n,e){const t=Se()._nodes.get(n);if(t===void 0)throw Error(`Create node: Attempted to create node ${e.name} that was not configured to be used on the editor.`);const o=t.klass;if(o!==e)throw Error(`Create node: Type ${n} in node ${e.name} does not match registered node ${o.name} with the same type`)}function $N(n,e,t){const o=e.getParentOrThrow().getLastChild();let r=e;const s=[e];for(;r!==o;){if(!r.getNextSibling())throw Error("insertRangeAfter: lastToInsert must be a later sibling of firstToInsert");r=r.getNextSibling(),s.push(r)}let i=n;for(const l of s)i=i.insertAfter(l)}class Ao extends Si{static getType(){return"linebreak"}static clone(e){return new Ao(e.__key)}constructor(e){super(e)}getTextContent(){return`
16
- `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>IN(e)||LN(e)?null:{conversion:PN,priority:0}}}static importJSON(e){return ko()}exportJSON(){return{type:"linebreak",version:1}}}function PN(n){return{node:ko()}}function ko(){return Wr(new Ao)}function io(n){return n instanceof Ao}function IN(n){const e=n.parentElement;if(e!==null&&Hc(e)){const t=e.firstChild;if(t===n||t.nextSibling===n&&Ti(t)){const o=e.lastChild;if(o===n||o.previousSibling===n&&Ti(o))return!0}}return!1}function LN(n){const e=n.parentElement;if(e!==null&&Hc(e)){const t=e.firstChild;if(t===n||t.nextSibling===n&&Ti(t))return!1;const o=e.lastChild;if(o===n||o.previousSibling===n&&Ti(o))return!0}return!1}function Ti(n){return n.nodeType===bn&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}function ia(n,e){return e&Zs?"code":e&ni?"mark":e&ei?"sub":e&ti?"sup":null}function la(n,e){return e&qs?"strong":e&Qs?"em":"span"}function Ud(n,e,t,o,r){const s=o.classList;let i=Kr(r,"base");i!==void 0&&s.add(...i),i=Kr(r,"underlineStrikethrough");let l=!1;const c=e&Rr&&e&kr,a=t&Rr&&t&kr;i!==void 0&&(a?(l=!0,c||s.add(...i)):c&&s.remove(...i));for(const f in Gt){const u=Gt[f];if(i=Kr(r,f),i!==void 0)if(t&u){if(l&&(f==="underline"||f==="strikethrough")){e&u&&s.remove(...i);continue}(!(e&u)||c&&f==="underline"||f==="strikethrough")&&s.add(...i)}else e&u&&s.remove(...i)}}function FN(n,e){const t=n.length,o=e.length;let r=0,s=0;for(;r<t&&r<o&&n[r]===e[r];)r++;for(;s+r<t&&s+r<o&&n[t-s-1]===e[o-s-1];)s++;return[r,t-r-s,e.slice(r,o-s)]}function jd(n,e,t){const o=e.firstChild,r=t.isComposing(),i=n+(r?ri:"");if(o==null)e.textContent=i;else{const l=o.nodeValue;if(l!==i)if(r||wn){const[c,a,f]=FN(l,i);a!==0&&o.deleteData(c,a),o.insertData(c,f)}else o.nodeValue=i}}function Hd(n,e,t,o,r,s){jd(r,n,e);const l=s.theme.text;l!==void 0&&Ud(t,0,o,n,l)}function xi(n,e){const t=document.createElement(e);return t.appendChild(n),t}let Ro=class extends Si{static getType(){return"text"}static clone(e){return new Ro(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return Vy[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===Tc}isComposing(){return this.__key===On()}isSegmented(){return this.getLatest().__mode===xc}isDirectionless(){return(this.getLatest().__detail&Ec)!==0}isUnmergeable(){return(this.getLatest().__detail&oi)!==0}hasFormat(e){const t=Gt[e];return(this.getFormat()&t)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){const r=this.getLatest().__format;return Ic(r,e,t)}canHaveFormat(){return!0}createDOM(e,t){const o=this.__format,r=ia(this,o),s=la(this,o),i=r===null?s:r,l=document.createElement(i);let c=l;this.hasFormat("code")&&l.setAttribute("spellcheck","false"),r!==null&&(c=document.createElement(s),l.appendChild(c));const a=this.__text;Hd(c,this,s,o,a,e);const f=this.__style;return f!==""&&(l.style.cssText=f),l}updateDOM(e,t,o){const r=this.__text,s=e.__format,i=this.__format,l=ia(this,s),c=ia(this,i),a=la(this,s),f=la(this,i);if((l===null?a:l)!==(c===null?f:c))return!0;if(l===c&&a!==f){const m=t.firstChild;if(m==null)throw Error("updateDOM: prevInnerDOM is null or undefined");const C=document.createElement(f);return Hd(C,this,f,i,r,o),t.replaceChild(C,m),!1}let h=t;if(c!==null&&l!==null&&(h=t.firstChild,h==null))throw Error("updateDOM: innerDOM is null or undefined");jd(r,h,this);const p=o.theme.text;p!==void 0&&s!==i&&Ud(f,s,i,h,p);const _=e.__style,y=this.__style;return _!==y&&(t.style.cssText=y),!1}static importDOM(){return{"#text":()=>({conversion:UN,priority:0}),b:()=>({conversion:KN,priority:0}),code:()=>({conversion:Dn,priority:0}),em:()=>({conversion:Dn,priority:0}),i:()=>({conversion:Dn,priority:0}),s:()=>({conversion:Dn,priority:0}),span:()=>({conversion:BN,priority:0}),strong:()=>({conversion:Dn,priority:0}),sub:()=>({conversion:Dn,priority:0}),sup:()=>({conversion:Dn,priority:0}),u:()=>({conversion:Dn,priority:0})}}static importJSON(e){const t=Ze(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);if(!(t!==null&&gi(t)))throw Error("Expected TextNode createDOM to always return a HTMLElement");return t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=xi(t,"b")),this.hasFormat("italic")&&(t=xi(t,"i")),this.hasFormat("strikethrough")&&(t=xi(t,"s")),this.hasFormat("underline")&&(t=xi(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format=typeof e=="string"?Gt[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?Hy[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=this.getFormat(),o=Ic(t,e,null);return this.setFormat(o)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=Ec,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=oi,e}setMode(e){const t=Jy[e];if(this.__mode===t)return this;const o=this.getWritable();return o.__mode=t,o}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){ot();let o=e,r=t;const s=he(),i=this.getTextContent(),l=this.__key;if(typeof i=="string"){const c=i.length;o===void 0&&(o=c),r===void 0&&(r=c)}else o=0,r=0;if(ee(s)){const c=On();(c===s.anchor.key||c===s.focus.key)&&Ue(l),s.setTextNodeRange(this,o,this,r)}else return nh(l,o,l,r,"text","text");return s}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,o,r){const s=this.getWritable(),i=s.__text,l=o.length;let c=e;c<0&&(c=l+c,c<0&&(c=0));const a=he();if(r&&ee(a)){const d=e+l;a.setTextNodeRange(s,d,s,d)}const f=i.slice(0,c)+o+i.slice(c+t);return s.__text=f,s}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){ot();const t=this.getLatest(),o=t.getTextContent(),r=t.__key,s=On(),i=new Set(e),l=[],c=o.length;let a="";for(let S=0;S<c;S++)a!==""&&i.has(S)&&(l.push(a),a=""),a+=o[S];a!==""&&l.push(a);const f=l.length;if(f===0)return[];if(l[0]===o)return[t];const d=l[0],u=t.getParent();let h;const g=t.getFormat(),p=t.getStyle(),_=t.__detail;let y=!1;t.isSegmented()?(h=Ze(d),h.__format=g,h.__style=p,h.__detail=_,y=!0):(h=t.getWritable(),h.__text=d);const m=he(),C=[h];let N=d.length;for(let S=1;S<f;S++){const T=l[S],b=T.length,x=Ze(T).getWritable();x.__format=g,x.__style=p,x.__detail=_;const w=x.__key,O=N+b;if(ee(m)){const D=m.anchor,B=m.focus;D.key===r&&D.type==="text"&&D.offset>N&&D.offset<=O&&(D.key=w,D.offset-=N,m.dirty=!0),B.key===r&&B.type==="text"&&B.offset>N&&B.offset<=O&&(B.key=w,B.offset-=N,m.dirty=!0)}s===r&&Ue(w),N=O,C.push(x)}if(u!==null){dC(this);const S=u.getWritable(),T=this.getIndexWithinParent();y?(S.splice(T,0,C),this.remove()):S.splice(T,1,C),ee(m)&&Oi(m,u,T,f-1)}return C}mergeWithSibling(e){const t=e===this.getPreviousSibling();if(!t&&e!==this.getNextSibling())throw Error("mergeWithSibling: sibling must be a previous or next sibling");const o=this.__key,r=e.__key,s=this.__text,i=s.length;On()===r&&Ue(o);const c=he();if(ee(c)){const u=c.anchor,h=c.focus;u!==null&&u.key===r&&(rh(u,t,o,e,i),c.dirty=!0),h!==null&&h.key===r&&(rh(h,t,o,e,i),c.dirty=!0)}const a=e.__text,f=t?a+s:s+a;this.setTextContent(f);const d=this.getWritable();return e.remove(),d}isTextEntity(){return!1}};function BN(n){const t=n.style;return{forChild:ca(t),node:null}}function KN(n){const e=n,t=e.style.fontWeight==="normal";return{forChild:ca(e.style,t?void 0:"bold"),node:null}}const Yd=new WeakMap;function WN(n){return n.nodeName==="PRE"||n.nodeType===Ar&&n.style!==void 0&&n.style.whiteSpace!==void 0&&n.style.whiteSpace.startsWith("pre")}function zN(n){let e,t=n.parentNode;const o=[n];for(;t!==null&&(e=Yd.get(t))===void 0&&!WN(t);)o.push(t),t=t.parentNode;const r=e===void 0?t:e;for(let s=0;s<o.length;s++)Yd.set(o[s],r);return r}function UN(n){const e=n;if(n.parentElement===null)throw Error("Expected parentElement of Text not to be null");let o=e.textContent||"";if(zN(e)!==null){const r=o.split(/(\r?\n|\t)/),s=[],i=r.length;for(let l=0;l<i;l++){const c=r[l];c===`
13
+ `,jy=wn?Yf:ri,Jf="֑-߿יִ-﷽ﹰ-ﻼ",Vf="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Uy=new RegExp("^[^"+Vf+"]*["+Jf+"]"),Hy=new RegExp("^[^"+Jf+"]*["+Vf+"]"),Vt={bold:Xs,code:Qs,highlight:ti,italic:qs,strikethrough:Ao,subscript:Zs,superscript:ei,underline:ko},Yy={directionless:Ec,unmergeable:ni},Gf={center:bc,end:Dc,justify:vc,left:wc,right:Oc,start:Mc},Jy={[bc]:"center",[Dc]:"end",[vc]:"justify",[wc]:"left",[Oc]:"right",[Mc]:"start"},Vy={normal:Uf,segmented:xc,token:Tc},Gy={[Uf]:"normal",[xc]:"segmented",[Tc]:"token"};function oi(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[r]of t.matchAll(/\S+/g))e.push(r);return e}const Xy=100;let Ac=!1,kc=0;function qy(){return Ac}function Qy(n){kc=n.timeStamp}function Zy(n){kc===0&&di(n).addEventListener("textInput",Qy,!0)}function Rc(n,e,t){return e.__lexicalLineBreak===n||n[`__lexicalKey_${t._key}`]!==void 0}function eC(n){return n.getEditorState().read(()=>{const e=de();return e!==null?e.clone():null})}function tC(n,e,t){const r=Xt(t._window);let o=null,s=null;r!==null&&r.anchorNode===n&&(o=r.anchorOffset,s=r.focusOffset);const i=n.nodeValue;i!==null&&Bc(e,i,o,s,!1)}function nC(n,e,t){if(ee(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return e.nodeType===bn&&t.isAttached()}function Xf(n,e,t){Ac=!0;const r=performance.now()-kc>Xy;try{xt(n,()=>{const o=de()||eC(n),s=new Map,i=n.getRootElement(),l=n._editorState,c=n._blockCursorElement;let a=!1,f="";for(let u=0;u<e.length;u++){const h=e[u],g=h.type,p=h.target;let _=Po(p,l);if(!(_===null&&p!==i||xe(_))){if(g==="characterData")r&&G(_)&&nC(o,p,_)&&tC(p,_,n);else if(g==="childList"){a=!0;const y=h.addedNodes;for(let N=0;N<y.length;N++){const S=y[N],T=id(S),E=S.parentNode;if(E!=null&&S!==c&&T===null&&(S.nodeName!=="BR"||!Rc(S,E,n))){if(wn){const x=S.innerText||S.nodeValue;x&&(f+=x)}E.removeChild(S)}}const m=h.removedNodes,C=m.length;if(C>0){let N=0;for(let S=0;S<C;S++){const T=m[S];(T.nodeName==="BR"&&Rc(T,p,n)||c===T)&&(p.appendChild(T),N++)}C!==N&&(p===i&&(_=ad(l)),s.set(p,_))}}}}if(s.size>0)for(const[u,h]of s)if(k(h)){const g=h.getChildrenKeys();let p=u.firstChild;for(let _=0;_<g.length;_++){const y=g[_],m=n.getElementByKey(y);m!==null&&(p==null?(u.appendChild(m),p=m):p!==m&&u.replaceChild(m,p),p=p.nextSibling)}}else G(h)&&h.markDirty();const d=t.takeRecords();if(d.length>0){for(let u=0;u<d.length;u++){const h=d[u],g=h.addedNodes,p=h.target;for(let _=0;_<g.length;_++){const y=g[_],m=y.parentNode;m!=null&&y.nodeName==="BR"&&!Rc(y,p,n)&&m.removeChild(y)}}t.takeRecords()}o!==null&&(a&&(o.dirty=!0,Gt(o)),wn&&Cd(n)&&o.insertRawText(f))})}finally{Ac=!1}}function qf(n){const e=n._observer;if(e!==null){const t=e.takeRecords();Xf(n,t,e)}}function Qf(n){Zy(n),n._observer=new MutationObserver((e,t)=>{Xf(n,e,t)})}function Zf(n,e){const t=n.__mode,r=n.__format,o=n.__style,s=e.__mode,i=e.__format,l=e.__style;return(t===null||t===s)&&(r===null||r===i)&&(o===null||o===l)}function ed(n,e){const t=n.mergeWithSibling(e),r=Se()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function td(n){let e=n;if(e.__text===""&&e.isSimpleText()&&!e.isUnmergeable()){e.remove();return}let t;for(;(t=e.getPreviousSibling())!==null&&G(t)&&t.isSimpleText()&&!t.isUnmergeable();)if(t.__text==="")t.remove();else if(Zf(t,e)){e=ed(t,e);break}else break;let r;for(;(r=e.getNextSibling())!==null&&G(r)&&r.isSimpleText()&&!r.isUnmergeable();)if(r.__text==="")r.remove();else if(Zf(e,r)){e=ed(e,r);break}else break}function nd(n){return rd(n.anchor),rd(n.focus),n}function rd(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,o;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),o=!0):(r=e.getChildAtIndex(t),o=!1),G(r)){n.set(r.__key,o?r.getTextContentSize():0,"text");break}else if(!k(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element")}}let od=1;function rC(){od=1}function oC(){return""+od++}function sC(n,e){const t=n._nodes.get(e);if(t===void 0)throw Error(`registeredNode: Type ${e} not found`);return t}const iC=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function lC(n){return xe(Po(n))}function $c(n){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return xe(Po(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&$o(e)==null)}function Ro(n,e,t){const r=n.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(t)&&e!==null&&!$c(e)&&Pc(e)===n}catch{return!1}}function si(n){return n instanceof Di}function Pc(n){let e=n;for(;e!=null;){const t=$o(e);if(si(t))return t;e=ui(e)}return null}function $o(n){return n?n.__lexicalEditor:null}function cC(n){return Uy.test(n)?"rtl":Hy.test(n)?"ltr":null}function nr(n){return n.isToken()||n.isSegmented()}function aC(n){return n.nodeType===bn}function ii(n){let e=n;for(;e!=null;){if(aC(e))return e;e=e.firstChild}return null}function Ic(n,e,t){const r=Vt[e];if(t!==null&&(n&r)===(t&r))return n;let o=n^r;return e==="subscript"?o&=~Vt.superscript:e==="superscript"&&(o&=~Vt.subscript),o}function uC(n){return G(n)||ir(n)||xe(n)}function sd(n,e){if(e!=null){fC(n,e),n.__key=e;return}rt(),ch();const t=Se(),r=Qt(),o=oC();r._nodeMap.set(o,n),k(n)?t._dirtyElements.set(o,!0):t._dirtyLeaves.add(o),t._cloneNotNeeded.add(o),t._dirtyType=jf,n.__key=o}function fC(n,e){const t=aS();if(!t)return;const r=t._nodeMap.get(e);if(r&&r.constructor!==n.constructor)throw n.constructor.name!==r.constructor.name?Error(`Lexical node with constructor ${n.constructor.name} attempted to re-use key from node in active editor state with constructor ${r.constructor.name}. Keys must not be re-used when the type is changed.`):Error(`Lexical node with constructor ${n.constructor.name} attempted to re-use key from node in active editor state with different constructor with the same name (possibly due to invalid Hot Module Replacement). Keys must not be re-used when the type is changed.`)}function dC(n,e,t){let r=n;for(;r!==null;){if(t.has(r))return;const o=e.get(r);if(o===void 0)break;t.set(r,!1),r=o.__parent}}function rr(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),o=n.getPreviousSibling(),s=n.getNextSibling();if(o===null)if(s!==null){const i=s.getWritable();r.__first=s.__key,i.__prev=null}else r.__first=null;else{const i=o.getWritable();if(s!==null){const l=s.getWritable();l.__prev=i.__key,i.__next=l.__key}else i.__next=null;t.__prev=null}if(s===null)if(o!==null){const i=o.getWritable();r.__last=o.__key,i.__next=null}else r.__last=null;else{const i=s.getWritable();if(o!==null){const l=o.getWritable();l.__next=i.__key,i.__prev=l.__key}else i.__prev=null;t.__next=null}r.__size--,t.__parent=null}}function li(n){ch();const e=n.getLatest(),t=e.__parent,r=Qt(),o=Se(),s=r._nodeMap,i=o._dirtyElements;t!==null&&dC(t,s,i);const l=e.__key;o._dirtyType=jf,k(n)?i.set(l,!0):o._dirtyLeaves.add(l)}function hC(n){const e=n.getPreviousSibling(),t=n.getNextSibling();e!==null&&li(e),t!==null&&li(t)}function je(n){rt();const e=Se(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const r=Qe(t);r!==null&&r.getWritable()}if(n!==null){const r=Qe(n);r!==null&&r.getWritable()}}}function On(){return Ir()?null:Se()._compositionKey}function Qe(n,e){const r=(e||Qt())._nodeMap.get(n);return r===void 0?null:r}function id(n,e){const t=Se(),r=n[`__lexicalKey_${t._key}`];return r!==void 0?Qe(r,e):null}function Po(n,e){let t=n;for(;t!=null;){const r=id(t,e);if(r!==null)return r;t=ui(t)}return null}function ld(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function cd(n){return n.read(()=>Tt().getTextContent())}function gC(n,e){xt(n,()=>{const t=Qt();if(t.isEmpty())return;if(e==="root"){Tt().markDirty();return}const r=t._nodeMap;for(const[,o]of r)o.markDirty()},n._pendingEditorState===null?{tag:"history-merge"}:void 0)}function Tt(){return ad(Qt())}function ad(n){return n._nodeMap.get("root")}function Gt(n){rt();const e=Qt();if(n!==null){if(Object.isFrozen(n))throw Error("$setSelection called on frozen selection object. Ensure selection is cloned before passing in.");n.dirty=!0,n.setCachedNodes(null)}e._selection=n}function pC(){rt();const n=Se();qf(n)}function Or(n){const e=Se(),t=_C(n,e);if(t===null){const r=e.getRootElement();return n===r?Qe("root"):null}return Qe(t)}function ud(n,e){return e?n.getTextContentSize():0}function _C(n,e){let t=n;for(;t!=null;){const r=t[`__lexicalKey_${e._key}`];if(r!==void 0)return r;t=ui(t)}return null}function fd(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function Lc(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function dd(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function hd(n){return n.nodeType===bn?n.nodeValue:null}function Fc(n,e,t){const r=Xt(e._window);if(r===null)return;const o=r.anchorNode;let{anchorOffset:s,focusOffset:i}=r;if(o!==null){let l=hd(o);const c=Po(o);if(l!==null&&G(c)){if(l===ri&&t){const a=t.length;l=t,s=a,i=a}l!==null&&Bc(c,l,s,i,n)}}}function Bc(n,e,t,r,o){let s=n;if(s.isAttached()&&(o||!s.isDirty())){const i=s.isComposing();let l=e;(i||o)&&e[e.length-1]===ri&&(l=e.slice(0,-1));const c=s.getTextContent();if(o||l!==c){if(l===""){if(je(null),!Nc&&!Gs&&!Sc){const p=Se();setTimeout(()=>{p.update(()=>{s.isAttached()&&s.remove()})},20)}else s.remove();return}const a=s.getParent(),f=Pr(),d=s.getTextContentSize(),u=On(),h=s.getKey();if(s.isToken()||u!==null&&h===u&&!i||ee(f)&&(a!==null&&!a.canInsertTextBefore()&&f.anchor.offset===0||f.anchor.key===n.__key&&f.anchor.offset===0&&!s.canInsertTextBefore()&&!i||f.focus.key===n.__key&&f.focus.offset===d&&!s.canInsertTextAfter()&&!i)){s.markDirty();return}const g=de();if(!ee(g)||t===null||r===null){s.setTextContent(l);return}if(g.setTextNodeRange(s,t,s,r),s.isSegmented()){const p=s.getTextContent(),_=Ze(p);s.replace(_),s=_}s.setTextContent(l)}}}function mC(n){const e=n.getPreviousSibling();return(G(e)||k(e)&&e.isInline())&&!e.canInsertTextAfter()}function yC(n,e){if(e.isSegmented())return!0;if(!n.isCollapsed())return!1;const t=n.anchor.offset,r=e.getParentOrThrow(),o=e.isToken();return t===0?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||o||mC(e):t===e.getTextContentSize()?!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||o:!1}function CC(n,e,t,r){return n==="Tab"&&!e&&!t&&!r}function NC(n,e,t,r){return n.toLowerCase()==="b"&&!e&&Io(t,r)}function SC(n,e,t,r){return n.toLowerCase()==="i"&&!e&&Io(t,r)}function TC(n,e,t,r){return n.toLowerCase()==="u"&&!e&&Io(t,r)}function xC(n,e){return _d(n)&&!e}function EC(n,e){return _d(n)&&e}function wC(n,e){return kt&&e&&n.toLowerCase()==="o"}function bC(n,e,t){return Lo(n)&&(kt?e:t)}function OC(n,e,t){return Fo(n)&&(kt?e:t)}function vC(n,e){return kt&&e&&Lo(n)}function MC(n,e){return kt&&e&&Fo(n)}function DC(n,e,t,r){return kt?e||t?!1:Lo(n)||n.toLowerCase()==="h"&&r:r||e||t?!1:Lo(n)}function AC(n,e,t,r,o){return kt?t||r||o?!1:Fo(n)||n.toLowerCase()==="d"&&e:e||r||o?!1:Fo(n)}function kC(n,e,t,r){return n.toLowerCase()==="z"&&!e&&Io(t,r)}function RC(n,e,t,r){return kt?n.toLowerCase()==="z"&&t&&e:n.toLowerCase()==="y"&&r||n.toLowerCase()==="z"&&r&&e}function $C(n,e,t,r){return e?!1:n.toLowerCase()==="c"?kt?t:r:!1}function PC(n,e,t,r){return e?!1:n.toLowerCase()==="x"?kt?t:r:!1}function gd(n){return n==="ArrowLeft"}function pd(n){return n==="ArrowRight"}function IC(n){return n==="ArrowUp"}function LC(n){return n==="ArrowDown"}function FC(n,e,t,r){return gd(n)&&!e&&!r&&!t}function BC(n,e,t,r,o){return gd(n)&&!r&&!t&&(e||o)}function KC(n,e,t,r){return pd(n)&&!e&&!r&&!t}function WC(n,e,t,r,o){return pd(n)&&!r&&!t&&(e||o)}function zC(n,e,t){return IC(n)&&!e&&!t}function jC(n,e,t){return LC(n)&&!e&&!t}function UC(n,e,t,r){return n||e||t||r}function HC(n){return n===" "}function Io(n,e){return kt?n:e}function _d(n){return n==="Enter"}function Lo(n){return n==="Backspace"}function YC(n){return n==="Escape"}function Fo(n){return n==="Delete"}function md(n,e,t){return n.toLowerCase()==="a"&&Io(e,t)}function JC(){const n=Tt(),e=n.select(0,n.getChildrenSize());Gt(nd(e))}function Bo(n,e){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const t=n.__lexicalClassNameCache,r=t[e];if(r!==void 0)return r;const o=n[e];if(typeof o=="string"){const s=oi(o);return t[e]=s,s}return o}function Kc(n,e,t,r,o){if(t.size===0)return;const s=r.__type,i=r.__key,l=e.get(s);if(l===void 0)throw Error(`Type ${s} not in registeredNodes`);const c=l.klass;let a=n.get(c);a===void 0&&(a=new Map,n.set(c,a));const f=a.get(i),d=f==="destroyed"&&o==="created";(f===void 0||d)&&a.set(i,d?"updated":o)}function VC(n){const e=n.getType(),t=Qt();if(t._readOnly){const s=Ed(t).get(e);return s?Array.from(s.values()):[]}const r=t._nodeMap,o=[];for(const[,s]of r)s instanceof n&&s.__type===e&&s.isAttached()&&o.push(s);return o}function yd(n,e,t){const r=n.getParent();let o=t,s=n;return r!==null&&(e&&t===0?(o=s.getIndexWithinParent(),s=r):!e&&t===s.getChildrenSize()&&(o=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(e?o-1:o)}function Wc(n,e){const t=n.offset;if(n.type==="element"){const r=n.getNode();return yd(r,e,t)}else{const r=n.getNode();if(e&&t===0||!e&&t===r.getTextContentSize()){const o=e?r.getPreviousSibling():r.getNextSibling();return o===null?yd(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):o}}return null}function Cd(n){const e=di(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function U(n,e,t){return gh(n,e,t)}function ci(n){return!pt(n)&&!n.isLastChild()&&!n.isInline()}function ai(n,e){const t=n._keyToDOMMap.get(e);if(t===void 0)throw Error(`Reconciliation: could not find DOM element for node key ${e}`);return t}function ui(n){const e=n.assignedSlot||n.parentElement;return e!==null&&e.nodeType===11?e.host:e}function GC(n,e,t){const r=t.ownerDocument,o=r.defaultView;if(o===null)return;let{top:s,bottom:i}=e,l=0,c=0,a=t;for(;a!==null;){const f=a===r.body;if(f)l=0,c=di(n).innerHeight;else{const u=a.getBoundingClientRect();l=u.top,c=u.bottom}let d=0;if(s<l?d=-(l-s):i>c&&(d=i-c),d!==0)if(f)o.scrollBy(0,d);else{const u=a.scrollTop;a.scrollTop+=d;const h=a.scrollTop-u;s-=h,i-=h}if(f)break;a=ui(a)}}function XC(n){return Se()._updateTags.has(n)}function qC(n){rt(),Se()._updateTags.add(n)}function QC(n){const e=de();if(!ee(e)||!k(n))return e;const{anchor:t,focus:r}=e,o=t.getNode(),s=r.getNode();return fi(o,n)&&t.set(n.__key,0,"element"),fi(s,n)&&r.set(n.__key,0,"element"),e}function fi(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function ZC(n){const e=n.ownerDocument;return e&&e.defaultView||null}function di(n){const e=n._window;if(e===null)throw Error("window object not found");return e}function eN(n){return k(n)&&n.isInline()||xe(n)&&n.isInline()}function Nd(n){let e=n.getParentOrThrow();for(;e!==null;){if(vn(e))return e;e=e.getParentOrThrow()}return e}function vn(n){return pt(n)||k(n)&&n.isShadowRoot()}function Sd(n){const e=n.constructor.clone(n);return sd(e,null),e}function Ko(n){const e=Se(),t=n.constructor.getType(),r=e._nodes.get(t);if(r===void 0)throw Error('$initializeNode failed. Ensure node has been registered to the editor. You can do this by passing the node class via the "nodes" array in the editor config.');const o=r.replace;if(o!==null){const s=o(n);if(!(s instanceof n.constructor))throw Error("$initializeNode failed. Ensure replacement node is a subclass of the original node.");return s}return n}function zc(n,e){const t=n.getParent();if(pt(t)&&!k(e)&&!xe(e))throw Error("Only element or decorator nodes can be inserted in to the root node")}function tN(n){const e=Qe(n);if(e===null)throw Error(`Expected node with key ${n} to exist but it's not in the nodeMap.`);return e}function nN(n){const e=n.theme,t=document.createElement("div");t.contentEditable="false",t.setAttribute("data-lexical-cursor","true");let r=e.blockCursor;if(r!==void 0){if(typeof r=="string"){const o=oi(r);r=e.blockCursor=o}r!==void 0&&t.classList.add(...r)}return t}function jc(n){return(xe(n)||k(n)&&!n.canBeEmpty())&&!n.isInline()}function Uc(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function rN(n,e,t){let r=n._blockCursorElement;if(ee(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const o=t.anchor,s=o.getNode(),i=o.offset,l=s.getChildrenSize();let c=!1,a=null;if(i===l){const f=s.getChildAtIndex(i-1);jc(f)&&(c=!0)}else{const f=s.getChildAtIndex(i);if(jc(f)){const d=f.getPreviousSibling();(d===null||jc(d))&&(c=!0,a=n.getElementByKey(f.__key))}}if(c){const f=n.getElementByKey(s.__key);r===null&&(n._blockCursorElement=r=nN(n._config)),e.style.caretColor="transparent",a===null?f.appendChild(r):f.insertBefore(r,a);return}}r!==null&&Uc(r,n,e)}function Xt(n){return At?(n||window).getSelection():null}function oN(n,e){let t=n.getChildAtIndex(e);if(t==null&&(t=n),vn(n))throw Error("Can not call $splitNode() on root element");const r=i=>{const l=i.getParentOrThrow(),c=vn(l),a=i===t&&!c?i:Sd(i);if(c){if(!(k(i)&&k(a)))throw Error("Children of a root must be ElementNode");return i.insertAfter(a),[i,a,a]}else{const[f,d,u]=r(l),h=i.getNextSiblings();return u.append(a,...h),[f,d,a]}},[o,s]=r(t);return[o,s]}function sN(n){return hi(n)&&n.tagName==="A"}function hi(n){return n.nodeType===1}function Td(n){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return n.nodeName.match(e)!==null}function Hc(n){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return n.nodeName.match(e)!==null}function vr(n){if(pt(n)||xe(n)&&!n.isInline())return!0;if(!k(n)||vn(n))return!1;const e=n.getFirstChild(),t=e===null||ir(e)||G(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function Yc(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function iN(){return Se()}const xd=new WeakMap,lN=new Map;function Ed(n){if(!n._readOnly&&n.isEmpty())return lN;if(!n._readOnly)throw Error("getCachedTypeToNodeMap called with a writable EditorState");let e=xd.get(n);if(!e){e=new Map,xd.set(n,e);for(const[t,r]of n._nodeMap){const o=r.__type;let s=e.get(o);s||(s=new Map,e.set(o,s)),s.set(t,r)}}return e}function wd(n){const e=n.constructor,t=e.clone(n);t.afterCloneFrom(n);{if(t.__key!==n.__key)throw Error(`$cloneWithProperties: ${e.name}.clone(node) (with type '${e.getType()}') did not return a node with the same key, make sure to specify node.__key as the last argument to the constructor`);if(!(t.__parent===n.__parent&&t.__next===n.__next&&t.__prev===n.__prev))throw Error(`$cloneWithProperties: ${e.name}.clone(node) (with type '${e.getType()}') overrided afterCloneFrom but did not call super.afterCloneFrom(prevNode)`)}return t}function cN(n,e){const t=n._decorators;let o=n._pendingDecorators||t;const s=e._nodeMap;let i;for(i in o)s.has(i)||(o===t&&(o=ld(n)),delete o[i])}function bd(n,e,t,r,o,s){let i=n.getFirstChild();for(;i!==null;){const l=i.__key;i.__parent===e&&(k(i)&&bd(i,l,t,r,o,s),t.has(l)||s.delete(l),o.push(l)),i=i.getNextSibling()}}function aN(n,e,t,r){const o=n._nodeMap,s=e._nodeMap,i=[];for(const[l]of r){const c=s.get(l);c!==void 0&&(c.isAttached()||(k(c)&&bd(c,l,o,s,i,r),o.has(l)||r.delete(l),i.push(l)))}for(const l of i)s.delete(l);for(const l of t){const c=s.get(l);c!==void 0&&!c.isAttached()&&(o.has(l)||t.delete(l),s.delete(l))}}let Fe="",ct="",qt=null,Rt="",un="",Mn,at,Wo,Od=!1,zo=!1,gi,pi=null,Jc,Vc,or,$t,Gc,jo;function _i(n,e){const t=or.get(n);if(e!==null){const r=Zc(n);r.parentNode===e&&e.removeChild(r)}if($t.has(n)||at._keyToDOMMap.delete(n),k(t)){const r=yi(t,or);Xc(r,0,r.length-1,null)}t!==void 0&&Kc(jo,Wo,gi,t,"destroyed")}function Xc(n,e,t,r){let o=e;for(;o<=t;++o){const s=n[o];s!==void 0&&_i(s,r)}}function sr(n,e){n.setProperty("text-align",e)}const uN="40px";function vd(n,e){const t=Mn.theme.indent;if(typeof t=="string"){const o=n.classList.contains(t);e>0&&!o?n.classList.add(t):e<1&&o&&n.classList.remove(t)}const r=getComputedStyle(n).getPropertyValue("--lexical-indent-base-value")||uN;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${r})`)}function Md(n,e){const t=n.style;e===0?sr(t,""):e===wc?sr(t,"left"):e===bc?sr(t,"center"):e===Oc?sr(t,"right"):e===vc?sr(t,"justify"):e===Mc?sr(t,"start"):e===Dc&&sr(t,"end")}function mi(n,e,t){const r=$t.get(n);if(r===void 0)throw Error("createNode: node does not exist in nodeMap");const o=r.createDOM(Mn,at);if(CN(n,o,at),G(r)?o.setAttribute("data-lexical-text","true"):xe(r)&&o.setAttribute("data-lexical-decorator","true"),k(r)){const s=r.__indent,i=r.__size;if(s!==0&&vd(o,s),i!==0){const c=i-1,a=yi(r,$t);fN(a,c,r,o)}const l=r.__format;l!==0&&Md(o,l),r.isInline()||Ad(null,r,o),ci(r)&&(Fe+=an,un+=an)}else{const s=r.getTextContent();if(xe(r)){const i=r.decorate(at,Mn);i!==null&&Rd(n,i),o.contentEditable="false"}else G(r)&&(r.isDirectionless()||(ct+=s));Fe+=s,un+=s}if(e!==null)if(t!=null)e.insertBefore(o,t);else{const s=e.__lexicalLineBreak;s!=null?e.insertBefore(o,s):e.appendChild(o)}return Object.freeze(r),Kc(jo,Wo,gi,r,"created"),o}function fN(n,e,t,r){const o=ct;ct="",qc(n,t,0,e,r,null),kd(t,r),ct=o}function qc(n,e,t,r,o,s){const i=Fe;Fe="";let l=t;for(;l<=r;++l){mi(n[l],o,s);const c=$t.get(n[l]);c!==null&&G(c)&&(qt===null&&(qt=c.getFormat()),Rt===""&&(Rt=c.getStyle()))}ci(e)&&(Fe+=an),o.__lexicalTextContent=Fe,Fe=i+Fe}function Dd(n,e){const t=e.get(n);return ir(t)||xe(t)&&t.isInline()}function Ad(n,e,t){const r=n!==null&&(n.__size===0||Dd(n.__last,or)),o=e.__size===0||Dd(e.__last,$t);if(r){if(!o){const s=t.__lexicalLineBreak;if(s!=null)try{t.removeChild(s)}catch(i){if(typeof i=="object"&&i!=null){const l=`${i.toString()} Parent: ${t.tagName}, child: ${s.tagName}.`;throw new Error(l)}else throw i}t.__lexicalLineBreak=null}}else if(o){const s=document.createElement("br");t.__lexicalLineBreak=s,t.appendChild(s)}}function dN(n){ma(n)&&qt!=null&&qt!==n.__textFormat&&!zo&&(n.setTextFormat(qt),n.setTextStyle(Rt))}function hN(n){ma(n)&&Rt!==""&&Rt!==n.__textStyle&&!zo&&n.setTextStyle(Rt)}function kd(n,e){const t=e.__lexicalDirTextContent,r=e.__lexicalDir;if(t!==ct||r!==pi){const o=ct==="",s=o?pi:cC(ct);if(s!==r){const i=e.classList,l=Mn.theme;let c=r!==null?l[r]:void 0,a=s!==null?l[s]:void 0;if(c!==void 0){if(typeof c=="string"){const f=oi(c);c=l[r]=f}i.remove(...c)}if(s===null||o&&s==="ltr")e.removeAttribute("dir");else{if(a!==void 0){if(typeof a=="string"){const f=oi(a);a=l[s]=f}a!==void 0&&i.add(...a)}e.dir=s}if(!zo){const f=n.getWritable();f.__dir=s}}pi=s,e.__lexicalDirTextContent=ct,e.__lexicalDir=s}}function gN(n,e,t){const r=ct;ct="",qt=null,Rt="",pN(n,e,t),kd(e,t),dN(e),hN(e),ct=r}function yi(n,e){const t=[];let r=n.__first;for(;r!==null;){const o=e.get(r);if(o===void 0)throw Error("createChildrenArray: node does not exist in nodeMap");t.push(r),r=o.__next}return t}function pN(n,e,t){const r=Fe,o=n.__size,s=e.__size;if(Fe="",o===1&&s===1){const i=n.__first,l=e.__first;if(i===l)Uo(i,t);else{const a=Zc(i),f=mi(l,null,null);try{t.replaceChild(f,a)}catch(d){if(typeof d=="object"&&d!=null){const u=`${d.toString()} Parent: ${t.tagName}, new child: {tag: ${f.tagName} key: ${l}}, old child: {tag: ${a.tagName}, key: ${i}}.`;throw new Error(u)}else throw d}_i(i,null)}const c=$t.get(l);G(c)&&(qt===null&&(qt=c.getFormat()),Rt===""&&(Rt=c.getStyle()))}else{const i=yi(n,or),l=yi(e,$t);if(o===0)s!==0&&qc(l,e,0,s-1,t,null);else if(s===0){if(o!==0){const a=t.__lexicalLineBreak==null;Xc(i,0,o-1,a?null:t),a&&(t.textContent="")}}else mN(e,i,l,o,s,t)}ci(e)&&(Fe+=an),t.__lexicalTextContent=Fe,Fe=r+Fe}function Uo(n,e){const t=or.get(n);let r=$t.get(n);if(t===void 0||r===void 0)throw Error("reconcileNode: prevNode or nextNode does not exist in nodeMap");const o=Od||Vc.has(n)||Jc.has(n),s=ai(at,n);if(t===r&&!o){if(k(t)){const i=s.__lexicalTextContent;i!==void 0&&(Fe+=i,un+=i);const l=s.__lexicalDirTextContent;l!==void 0&&(ct+=l)}else{const i=t.getTextContent();G(t)&&!t.isDirectionless()&&(ct+=i),un+=i,Fe+=i}return s}if(t!==r&&o&&Kc(jo,Wo,gi,r,"updated"),r.updateDOM(t,s,Mn)){const i=mi(n,null,null);if(e===null)throw Error("reconcileNode: parentDOM is null");return e.replaceChild(i,s),_i(n,null),i}if(k(t)&&k(r)){const i=r.__indent;i!==t.__indent&&vd(s,i);const l=r.__format;l!==t.__format&&Md(s,l),o&&(gN(t,r,s),!pt(r)&&!r.isInline()&&Ad(t,r,s)),ci(r)&&(Fe+=an,un+=an)}else{const i=r.getTextContent();if(xe(r)){const l=r.decorate(at,Mn);l!==null&&Rd(n,l)}else G(r)&&!r.isDirectionless()&&(ct+=i);Fe+=i,un+=i}if(!zo&&pt(r)&&r.__cachedText!==un){const i=r.getWritable();i.__cachedText=un,r=i}return Object.freeze(r),s}function Rd(n,e){let t=at._pendingDecorators;const r=at._decorators;if(t===null){if(r[n]===e)return;t=ld(at)}t[n]=e}function _N(n){return n.firstChild}function Qc(n){let e=n.nextSibling;return e!==null&&e===at._blockCursorElement&&(e=e.nextSibling),e}function mN(n,e,t,r,o,s){const i=r-1,l=o-1;let c,a,f=_N(s),d=0,u=0;for(;d<=i&&u<=l;){const p=e[d],_=t[u];if(p===_)f=Qc(Uo(_,s)),d++,u++;else{c===void 0&&(c=new Set(e)),a===void 0&&(a=new Set(t));const m=a.has(p),C=c.has(_);if(!m)f=Qc(Zc(p)),_i(p,s),d++;else if(!C)mi(_,s,f),u++;else{const N=ai(at,_);N===f?f=Qc(Uo(_,s)):(f!=null?s.insertBefore(N,f):s.appendChild(N),Uo(_,s)),d++,u++}}const y=$t.get(_);y!==null&&G(y)&&(qt===null&&(qt=y.getFormat()),Rt===""&&(Rt=y.getStyle()))}const h=d>i,g=u>l;if(h&&!g){const p=t[l+1],_=p===void 0?null:at.getElementByKey(p);qc(t,n,u,l,s,_)}else g&&!h&&Xc(e,d,i,s)}function yN(n,e,t,r,o,s){Fe="",un="",ct="",Od=r===br,pi=null,at=t,Mn=t._config,Wo=t._nodes,gi=at._listeners.mutation,Jc=o,Vc=s,or=n._nodeMap,$t=e._nodeMap,zo=e._readOnly,Gc=new Map(t._keyToDOMMap);const i=new Map;return jo=i,Uo("root",null),at=void 0,Wo=void 0,Jc=void 0,Vc=void 0,or=void 0,$t=void 0,Mn=void 0,Gc=void 0,jo=void 0,i}function CN(n,e,t){const r=t._keyToDOMMap;e["__lexicalKey_"+t._key]=n,r.set(n,e)}function Zc(n){const e=Gc.get(n);if(e===void 0)throw Error(`Reconciliation: could not find DOM element for node key ${n}`);return e}const fn=Object.freeze({}),ea=30,ta=[["keydown",vN],["pointerdown",SN],["compositionstart",bN],["compositionend",ON],["input",wN],["click",NN],["cut",fn],["copy",fn],["dragstart",fn],["dragover",fn],["dragend",fn],["paste",fn],["focus",fn],["blur",fn],["drop",fn]];Vs&&ta.push(["beforeinput",(n,e)=>EN(n,e)]);let Ho=0,$d=null,Pd=0,Mr=null;const Ci=new WeakMap;let na=!1,ra=!1,Yo=!1,Jo=!1,Id=[0,"",0,"root",0];function Ld(n,e,t,r,o){const s=n.anchor,i=n.focus,l=s.getNode(),c=Se(),a=Xt(c._window),f=a!==null?a.anchorNode:null,d=s.key,u=c.getElementByKey(d),h=t.length;return d!==i.key||!G(l)||(!o&&(!Vs||Pd<r+50)||l.isDirty()&&h<2||fd(t))&&s.offset!==i.offset&&!l.isComposing()||nr(l)||l.isDirty()&&h>1||(o||!Vs)&&u!==null&&!l.isComposing()&&f!==ii(u)||a!==null&&e!==null&&(!e.collapsed||e.startContainer!==a.anchorNode||e.startOffset!==a.anchorOffset)||l.getFormat()!==n.format||l.getStyle()!==n.style||yC(n,l)}function Fd(n,e){return n!==null&&n.nodeValue!==null&&n.nodeType===bn&&e!==0&&e!==n.nodeValue.length}function Bd(n,e,t){const{anchorNode:r,anchorOffset:o,focusNode:s,focusOffset:i}=n;na&&(na=!1,Fd(r,o)&&Fd(s,i))||xt(e,()=>{if(!t){Gt(null);return}if(!Ro(e,r,s))return;const l=de();if(ee(l)){const c=l.anchor,a=c.getNode();if(l.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(l.dirty=!0);const f=di(e).event,d=f?f.timeStamp:performance.now(),[u,h,g,p,_]=Id,y=Tt(),m=e.isComposing()===!1&&y.getTextContent()==="";if(d<_+200&&c.offset===g&&c.key===p)l.format=u,l.style=h;else if(c.type==="text"){if(!G(a))throw Error("Point.getNode() must return TextNode when type is text");l.format=a.getFormat(),l.style=a.getStyle()}else if(c.type==="element"&&!m){const C=c.getNode();l.style="",C instanceof lr&&C.getChildrenSize()===0?(l.format=C.getTextFormat(),l.style=C.getTextStyle()):l.format=0}}else{const f=c.key,u=l.focus.key,h=l.getNodes(),g=h.length,p=l.isBackward(),_=p?i:o,y=p?o:i,m=p?u:f,C=p?f:u;let N=Hf,S=!1;for(let T=0;T<g;T++){const E=h[T],x=E.getTextContentSize();if(G(E)&&x!==0&&!(T===0&&E.__key===m&&_===x||T===g-1&&E.__key===C&&y===0)&&(S=!0,N&=E.getFormat(),N===0))break}l.format=S?N:0}}U(e,Ys,void 0)})}function NN(n,e){xt(e,()=>{const t=de(),r=Xt(e._window),o=Pr();if(r){if(ee(t)){const s=t.anchor,i=s.getNode();if(s.type==="element"&&s.offset===0&&t.isCollapsed()&&!pt(i)&&Tt().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&o!==null&&t.is(o))r.removeAllRanges(),t.dirty=!0;else if(n.detail===3&&!t.isCollapsed()){const c=t.focus.getNode();i!==c&&(k(i)?i.select(0):i.getParentOrThrow().select(0))}}else if(n.pointerType==="touch"){const s=r.anchorNode;if(s!==null){const i=s.nodeType;if(i===Do||i===bn){const l=wi(o,r,e,n);Gt(l)}}}}U(e,Tf,n)})}function SN(n,e){const t=n.target,r=n.pointerType;t instanceof Node&&r!=="touch"&&xt(e,()=>{lC(t)||(ra=!0)})}function Kd(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function TN(n,e){return n!==e||k(n)||k(e)||!n.isToken()||!e.isToken()}function xN(n){return $d==="MediaLast"&&n<Ho+ea}function EN(n,e){const t=n.inputType,r=Kd(n);t==="deleteCompositionText"||wn&&Cd(e)||t!=="insertCompositionText"&&xt(e,()=>{const o=de();if(t==="deleteContentBackward"){if(o===null){const f=Pr();if(!ee(f))return;Gt(f.clone())}if(ee(o)){const f=o.anchor.key===o.focus.key;if(xN(n.timeStamp)&&e.isComposing()&&f){if(je(null),Ho=0,setTimeout(()=>{xt(e,()=>{je(null)})},ea),ee(o)){const d=o.anchor.getNode();if(d.markDirty(),o.format=d.getFormat(),!G(d))throw Error("Anchor node must be a TextNode");o.style=d.getStyle()}}else{je(null),n.preventDefault();const d=o.anchor.getNode().getTextContent(),u=o.anchor.offset===0&&o.focus.offset===d.length;zy&&f&&!u||U(e,bo,!0)}return}}if(!ee(o))return;const s=n.data;Mr!==null&&Fc(!1,e,Mr),(!o.dirty||Mr!==null)&&o.isCollapsed()&&!pt(o.anchor.getNode())&&r!==null&&o.applyDOMRange(r),Mr=null;const i=o.anchor,l=o.focus,c=i.getNode(),a=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(s===`
14
+ `)n.preventDefault(),U(e,Oo,!1);else if(s===an)n.preventDefault(),U(e,dc,void 0);else if(s==null&&n.dataTransfer){const f=n.dataTransfer.getData("text/plain");n.preventDefault(),o.insertRawText(f)}else s!=null&&Ld(o,r,s,n.timeStamp,!0)?(n.preventDefault(),U(e,wr,s)):Mr=s;Pd=n.timeStamp;return}switch(n.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":{U(e,wr,n);break}case"insertFromComposition":{je(null),U(e,wr,n);break}case"insertLineBreak":{je(null),U(e,Oo,!1);break}case"insertParagraph":{je(null),Yo&&!Gs?(Yo=!1,U(e,Oo,!1)):U(e,dc,void 0);break}case"insertFromPaste":case"insertFromPasteAsQuotation":{U(e,hc,n);break}case"deleteByComposition":{TN(c,a)&&U(e,gc,n);break}case"deleteByDrag":case"deleteByCut":{U(e,gc,n);break}case"deleteContent":{U(e,bo,!1);break}case"deleteWordBackward":{U(e,vo,!0);break}case"deleteWordForward":{U(e,vo,!1);break}case"deleteHardLineBackward":case"deleteSoftLineBackward":{U(e,Mo,!0);break}case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":{U(e,Mo,!1);break}case"formatStrikeThrough":{U(e,En,"strikethrough");break}case"formatBold":{U(e,En,"bold");break}case"formatItalic":{U(e,En,"italic");break}case"formatUnderline":{U(e,En,"underline");break}case"historyUndo":{U(e,pc,void 0);break}case"historyRedo":{U(e,_c,void 0);break}}})}function wN(n,e){n.stopPropagation(),xt(e,()=>{const t=de(),r=n.data,o=Kd(n);if(r!=null&&ee(t)&&Ld(t,o,r,n.timeStamp,!1)){Jo&&(oa(e,r),Jo=!1);const i=t.anchor.getNode(),l=Xt(e._window);if(l===null)return;const c=t.isBackward(),a=c?t.anchor.offset:t.focus.offset,f=c?t.focus.offset:t.anchor.offset;(!Vs||t.isCollapsed()||!G(i)||l.anchorNode===null||i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+f)!==hd(l.anchorNode))&&U(e,wr,r);const d=r.length;wn&&d>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=d),!Nc&&!Gs&&!Sc&&e.isComposing()&&(Ho=0,je(null))}else Fc(!1,e,r!==null?r:void 0),Jo&&(oa(e,r||void 0),Jo=!1);pC()}),Mr=null}function bN(n,e){xt(e,()=>{const t=de();if(ee(t)&&!e.isComposing()){const r=t.anchor,o=t.anchor.getNode();je(r.key),(n.timeStamp<Ho+ea||r.type==="element"||!t.isCollapsed()||o.getFormat()!==t.format||G(o)&&o.getStyle()!==t.style)&&U(e,wr,jy)}})}function oa(n,e){const t=n._compositionKey;if(je(null),t!==null&&e!=null){if(e===""){const r=Qe(t),o=ii(n.getElementByKey(t));o!==null&&o.nodeValue!==null&&G(r)&&Bc(r,o.nodeValue,null,null,!0);return}if(e[e.length-1]===`
15
+ `){const r=de();if(ee(r)){const o=r.focus;r.anchor.set(o.key,o.offset,o.type),U(n,Js,null);return}}}Fc(!0,n,e)}function ON(n,e){wn?Jo=!0:xt(e,()=>{oa(e,n.data)})}function vN(n,e){if(Ho=n.timeStamp,$d=n.key,e.isComposing())return;const{key:t,shiftKey:r,ctrlKey:o,metaKey:s,altKey:i}=n;if(!U(e,xf,n)&&t!=null){if(KC(t,o,i,s))U(e,Ef,n);else if(WC(t,o,r,i,s))U(e,wf,n);else if(FC(t,o,i,s))U(e,bf,n);else if(BC(t,o,r,i,s))U(e,Of,n);else if(zC(t,o,s))U(e,vf,n);else if(jC(t,o,s))U(e,Mf,n);else if(EC(t,r))Yo=!0,U(e,Js,n);else if(HC(t))U(e,Df,n);else if(wC(t,o))n.preventDefault(),Yo=!0,U(e,Oo,!0);else if(xC(t,r))Yo=!1,U(e,Js,n);else if(DC(t,i,s,o))Lo(t)?U(e,Af,n):(n.preventDefault(),U(e,bo,!0));else if(YC(t))U(e,kf,n);else if(AC(t,o,r,i,s))Fo(t)?U(e,Rf,n):(n.preventDefault(),U(e,bo,!1));else if(bC(t,i,o))n.preventDefault(),U(e,vo,!0);else if(OC(t,i,o))n.preventDefault(),U(e,vo,!1);else if(vC(t,s))n.preventDefault(),U(e,Mo,!0);else if(MC(t,s))n.preventDefault(),U(e,Mo,!1);else if(NC(t,i,s,o))n.preventDefault(),U(e,En,"bold");else if(TC(t,i,s,o))n.preventDefault(),U(e,En,"underline");else if(SC(t,i,s,o))n.preventDefault(),U(e,En,"italic");else if(CC(t,i,o,s))U(e,$f,n);else if(kC(t,r,s,o))n.preventDefault(),U(e,pc,void 0);else if(RC(t,r,s,o))n.preventDefault(),U(e,_c,void 0);else{const l=e._editorState._selection;Vo(l)?$C(t,r,s,o)?(n.preventDefault(),U(e,mc,n)):PC(t,r,s,o)?(n.preventDefault(),U(e,yc,n)):md(t,s,o)&&(n.preventDefault(),U(e,Cc,n)):!wn&&md(t,s,o)&&(n.preventDefault(),U(e,Cc,n))}UC(o,r,i,s)&&U(e,Wf,n)}}function Wd(n){let e=n.__lexicalEventHandles;return e===void 0&&(e=[],n.__lexicalEventHandles=e),e}const Dr=new Map;function zd(n){const e=n.target,t=e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView,r=Xt(t);if(r===null)return;const o=Pc(r.anchorNode);if(o===null)return;ra&&(ra=!1,xt(o,()=>{const f=Pr(),d=r.anchorNode;if(d===null)return;const u=d.nodeType;if(u!==Do&&u!==bn)return;const h=wi(f,r,o,n);Gt(h)}));const s=Lc(o),i=s[s.length-1],l=i._key,c=Dr.get(l),a=c||i;a!==o&&Bd(r,a,!1),Bd(r,o,!0),o!==i?Dr.set(l,o):c&&Dr.delete(l)}function jd(n){n._lexicalHandled=!0}function Ud(n){return n._lexicalHandled===!0}function MN(n,e){const t=n.ownerDocument,r=Ci.get(t);(r===void 0||r<1)&&t.addEventListener("selectionchange",zd),Ci.set(t,(r||0)+1),n.__lexicalEditor=e;const o=Wd(n);for(let s=0;s<ta.length;s++){const[i,l]=ta[s],c=typeof l=="function"?a=>{Ud(a)||(jd(a),(e.isEditable()||i==="click")&&l(a,e))}:a=>{if(Ud(a))return;jd(a);const f=e.isEditable();switch(i){case"cut":return f&&U(e,yc,a);case"copy":return U(e,mc,a);case"paste":return f&&U(e,hc,a);case"dragstart":return f&&U(e,If,a);case"dragover":return f&&U(e,Lf,a);case"dragend":return f&&U(e,Ff,a);case"focus":return f&&U(e,Bf,a);case"blur":return f&&U(e,Kf,a);case"drop":return f&&U(e,Pf,a)}};n.addEventListener(i,c),o.push(()=>{n.removeEventListener(i,c)})}}function DN(n){const e=n.ownerDocument,t=Ci.get(e);if(t===void 0)throw Error("Root element not registered");const r=t-1;if(!(r>=0))throw Error("Root element count less than 0");Ci.set(e,r),r===0&&e.removeEventListener("selectionchange",zd);const o=$o(n);if(si(o))AN(o),n.__lexicalEditor=null;else if(o)throw Error("Attempted to remove event handlers from a node that does not belong to this build of Lexical");const s=Wd(n);for(let i=0;i<s.length;i++)s[i]();n.__lexicalEventHandles=[]}function AN(n){if(n._parentEditor!==null){const e=Lc(n),r=e[e.length-1]._key;Dr.get(r)===n&&Dr.delete(r)}else Dr.delete(n._key)}function kN(){na=!0}function RN(n,e,t,r,o){Id=[n,e,t,r,o]}function sa(n,e,t){rt();const r=n.__key,o=n.getParent();if(o===null)return;const s=QC(n);let i=!1;if(ee(s)&&e){const l=s.anchor,c=s.focus;l.key===r&&(Oi(l,n,o,n.getPreviousSibling(),n.getNextSibling()),i=!0),c.key===r&&(Oi(c,n,o,n.getPreviousSibling(),n.getNextSibling()),i=!0)}else Vo(s)&&e&&n.isSelected()&&n.selectPrevious();if(ee(s)&&e&&!i){const l=n.getIndexWithinParent();rr(n),bi(s,o,l,-1)}else rr(n);!t&&!vn(o)&&!o.canBeEmpty()&&o.isEmpty()&&sa(o,e),e&&pt(o)&&o.isEmpty()&&o.selectEnd()}class Ni{static getType(){throw Error(`LexicalNode: Node ${this.name} does not implement .getType().`)}static clone(e){throw Error(`LexicalNode: Node ${this.name} does not implement .clone().`)}afterCloneFrom(e){this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,sd(this,e),this.__type!=="root"&&(rt(),$N(this.__type,this.constructor))}getType(){return this.__type}isInline(){throw Error(`LexicalNode: Node ${this.constructor.name} does not implement .isInline().`)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=Qe(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||de();if(t==null)return!1;const r=t.getNodes().some(s=>s.__key===this.__key);if(G(this))return r;if(ee(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const s=this.getParent();if(xe(this)&&this.isInline()&&s){const i=t.isBackward()?t.focus:t.anchor,l=i.getNode();if(i.offset===l.getChildrenSize()&&l.is(s)&&l.getLastChildOrThrow().is(this))return!1}}return r}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),r=0;for(;t!==null;){if(this.is(t))return r;r++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:Qe(e)}getParentOrThrow(){const e=this.getParent();if(e===null)throw Error(`Expected node ${this.__key} to have a parent.`);return e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(vn(t)){if(!(k(e)||e===this&&xe(e)))throw Error("Children of root nodes must be elements or decorators");return e}e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();if(e===null)throw Error(`Expected node ${this.__key} to have a top parent element.`);return e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const t=this.getLatest().__prev;return t===null?null:Qe(t)}getPreviousSiblings(){const e=[],t=this.getParent();if(t===null)return e;let r=t.getFirstChild();for(;r!==null&&!r.is(this);)e.push(r),r=r.getNextSibling();return e}getNextSibling(){const t=this.getLatest().__next;return t===null?null:Qe(t)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=this.getParents(),r=e.getParents();k(this)&&t.unshift(this),k(e)&&r.unshift(e);const o=t.length,s=r.length;if(o===0||s===0||t[o-1]!==r[s-1])return null;const i=new Set(r);for(let l=0;l<o;l++){const c=t[l];if(i.has(c))return c}return null}is(e){return e==null?!1:this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;const t=this.getCommonAncestor(e);let r=0,o=0,s=this;for(;;){const i=s.getParentOrThrow();if(i===t){r=s.getIndexWithinParent();break}s=i}for(s=e;;){const i=s.getParentOrThrow();if(i===t){o=s.getIndexWithinParent();break}s=i}return r<o}isParentOf(e){const t=this.__key;if(t===e.__key)return!1;let r=e;for(;r!==null;){if(r.__key===t)return!0;r=r.getParent()}return!1}getNodesBetween(e){const t=this.isBefore(e),r=[],o=new Set;let s=this;for(;s!==null;){const i=s.__key;if(o.has(i)||(o.add(i),r.push(s)),s===e)break;const l=k(s)?t?s.getFirstChild():s.getLastChild():null;if(l!==null){s=l;continue}const c=t?s.getNextSibling():s.getPreviousSibling();if(c!==null){s=c;continue}const a=s.getParentOrThrow();if(o.has(a.__key)||r.push(a),a===e)break;let f=null,d=a;do{if(d===null)throw Error("getNodesBetween: ancestor is null");if(f=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d!==null)f===null&&!o.has(d.__key)&&r.push(d);else break}while(f===null);s=f}return t||r.reverse(),r}isDirty(){const t=Se()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){const e=Qe(this.__key);if(e===null)throw Error("Lexical node does not exist in active editor state. Avoid using the same node references between nested closures from editorState.read/editor.update.");return e}getWritable(){rt();const e=Qt(),t=Se(),r=e._nodeMap,o=this.__key,s=this.getLatest(),i=t._cloneNotNeeded,l=de();if(l!==null&&l.setCachedNodes(null),i.has(o))return li(s),s;const c=wd(s);return i.add(o),li(c),r.set(o,c),c}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){throw Error("createDOM: base method not extended")}updateDOM(e,t,r){throw Error("updateDOM: base method not extended")}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){throw Error("exportJSON: base method not extended")}static importJSON(e){throw Error(`LexicalNode: Node ${this.name} does not implement .importJSON().`)}static transform(){return null}remove(e){sa(this,!0,e)}replace(e,t){rt();let r=de();r!==null&&(r=r.clone()),zc(this,e);const o=this.getLatest(),s=this.__key,i=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;rr(l);const f=o.getPreviousSibling(),d=o.getNextSibling(),u=o.__prev,h=o.__next,g=o.__parent;if(sa(o,!1,!0),f===null)c.__first=i;else{const p=f.getWritable();p.__next=i}if(l.__prev=u,d===null)c.__last=i;else{const p=d.getWritable();p.__prev=i}if(l.__next=h,l.__parent=g,c.__size=a,t){if(!(k(this)&&k(l)))throw Error("includeChildren should only be true for ElementNodes");this.getChildren().forEach(p=>{l.append(p)})}if(ee(r)){Gt(r);const p=r.anchor,_=r.focus;p.key===s&&qd(p,l),_.key===s&&qd(_,l)}return On()===s&&je(i),l}insertAfter(e,t=!0){rt(),zc(this,e);const r=this.getWritable(),o=e.getWritable(),s=o.getParent(),i=de();let l=!1,c=!1;if(s!==null){const h=e.getIndexWithinParent();if(rr(o),ee(i)){const g=s.__key,p=i.anchor,_=i.focus;l=p.type==="element"&&p.key===g&&p.offset===h+1,c=_.type==="element"&&_.key===g&&_.offset===h+1}}const a=this.getNextSibling(),f=this.getParentOrThrow().getWritable(),d=o.__key,u=r.__next;if(a===null)f.__last=d;else{const h=a.getWritable();h.__prev=d}if(f.__size++,r.__next=d,o.__next=u,o.__prev=r.__key,o.__parent=r.__parent,t&&ee(i)){const h=this.getIndexWithinParent();bi(i,f,h+1);const g=f.__key;l&&i.anchor.set(g,h+2,"element"),c&&i.focus.set(g,h+2,"element")}return e}insertBefore(e,t=!0){rt(),zc(this,e);const r=this.getWritable(),o=e.getWritable(),s=o.__key;rr(o);const i=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),c=r.__prev,a=this.getIndexWithinParent();if(i===null)l.__first=s;else{const d=i.getWritable();d.__next=s}l.__size++,r.__prev=s,o.__prev=c,o.__next=r.__key,o.__parent=r.__parent;const f=de();if(t&&ee(f)){const d=this.getParentOrThrow();bi(f,d,a)}return e}isParentRequired(){return!1}createParentElementNode(){return dn()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){rt();const r=this.getPreviousSibling(),o=this.getParentOrThrow();if(r===null)return o.select(0,0);if(k(r))return r.select();if(!G(r)){const s=r.getIndexWithinParent()+1;return o.select(s,s)}return r.select(e,t)}selectNext(e,t){rt();const r=this.getNextSibling(),o=this.getParentOrThrow();if(r===null)return o.select();if(k(r))return r.select(0,0);if(!G(r)){const s=r.getIndexWithinParent();return o.select(s,s)}return r.select(e,t)}markDirty(){this.getWritable()}}function $N(n,e){const t=Se()._nodes.get(n);if(t===void 0)throw Error(`Create node: Attempted to create node ${e.name} that was not configured to be used on the editor.`);const r=t.klass;if(r!==e)throw Error(`Create node: Type ${n} in node ${e.name} does not match registered node ${r.name} with the same type`)}function PN(n,e,t){const r=e.getParentOrThrow().getLastChild();let o=e;const s=[e];for(;o!==r;){if(!o.getNextSibling())throw Error("insertRangeAfter: lastToInsert must be a later sibling of firstToInsert");o=o.getNextSibling(),s.push(o)}let i=n;for(const l of s)i=i.insertAfter(l)}class Ar extends Ni{static getType(){return"linebreak"}static clone(e){return new Ar(e.__key)}constructor(e){super(e)}getTextContent(){return`
16
+ `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>LN(e)||FN(e)?null:{conversion:IN,priority:0}}}static importJSON(e){return kr()}exportJSON(){return{type:"linebreak",version:1}}}function IN(n){return{node:kr()}}function kr(){return Ko(new Ar)}function ir(n){return n instanceof Ar}function LN(n){const e=n.parentElement;if(e!==null&&Hc(e)){const t=e.firstChild;if(t===n||t.nextSibling===n&&Si(t)){const r=e.lastChild;if(r===n||r.previousSibling===n&&Si(r))return!0}}return!1}function FN(n){const e=n.parentElement;if(e!==null&&Hc(e)){const t=e.firstChild;if(t===n||t.nextSibling===n&&Si(t))return!1;const r=e.lastChild;if(r===n||r.previousSibling===n&&Si(r))return!0}return!1}function Si(n){return n.nodeType===bn&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}function ia(n,e){return e&Qs?"code":e&ti?"mark":e&Zs?"sub":e&ei?"sup":null}function la(n,e){return e&Xs?"strong":e&qs?"em":"span"}function Hd(n,e,t,r,o){const s=r.classList;let i=Bo(o,"base");i!==void 0&&s.add(...i),i=Bo(o,"underlineStrikethrough");let l=!1;const c=e&ko&&e&Ao,a=t&ko&&t&Ao;i!==void 0&&(a?(l=!0,c||s.add(...i)):c&&s.remove(...i));for(const f in Vt){const u=Vt[f];if(i=Bo(o,f),i!==void 0)if(t&u){if(l&&(f==="underline"||f==="strikethrough")){e&u&&s.remove(...i);continue}(!(e&u)||c&&f==="underline"||f==="strikethrough")&&s.add(...i)}else e&u&&s.remove(...i)}}function BN(n,e){const t=n.length,r=e.length;let o=0,s=0;for(;o<t&&o<r&&n[o]===e[o];)o++;for(;s+o<t&&s+o<r&&n[t-s-1]===e[r-s-1];)s++;return[o,t-o-s,e.slice(o,r-s)]}function Yd(n,e,t){const r=e.firstChild,o=t.isComposing(),i=n+(o?ri:"");if(r==null)e.textContent=i;else{const l=r.nodeValue;if(l!==i)if(o||wn){const[c,a,f]=BN(l,i);a!==0&&r.deleteData(c,a),r.insertData(c,f)}else r.nodeValue=i}}function Jd(n,e,t,r,o,s){Yd(o,n,e);const l=s.theme.text;l!==void 0&&Hd(t,0,r,n,l)}function Ti(n,e){const t=document.createElement(e);return t.appendChild(n),t}let Rr=class extends Ni{static getType(){return"text"}static clone(e){return new Rr(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return Gy[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===Tc}isComposing(){return this.__key===On()}isSegmented(){return this.getLatest().__mode===xc}isDirectionless(){return(this.getLatest().__detail&Ec)!==0}isUnmergeable(){return(this.getLatest().__detail&ni)!==0}hasFormat(e){const t=Vt[e];return(this.getFormat()&t)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){const o=this.getLatest().__format;return Ic(o,e,t)}canHaveFormat(){return!0}createDOM(e,t){const r=this.__format,o=ia(this,r),s=la(this,r),i=o===null?s:o,l=document.createElement(i);let c=l;this.hasFormat("code")&&l.setAttribute("spellcheck","false"),o!==null&&(c=document.createElement(s),l.appendChild(c));const a=this.__text;Jd(c,this,s,r,a,e);const f=this.__style;return f!==""&&(l.style.cssText=f),l}updateDOM(e,t,r){const o=this.__text,s=e.__format,i=this.__format,l=ia(this,s),c=ia(this,i),a=la(this,s),f=la(this,i);if((l===null?a:l)!==(c===null?f:c))return!0;if(l===c&&a!==f){const m=t.firstChild;if(m==null)throw Error("updateDOM: prevInnerDOM is null or undefined");const C=document.createElement(f);return Jd(C,this,f,i,o,r),t.replaceChild(C,m),!1}let h=t;if(c!==null&&l!==null&&(h=t.firstChild,h==null))throw Error("updateDOM: innerDOM is null or undefined");Yd(o,h,this);const p=r.theme.text;p!==void 0&&s!==i&&Hd(f,s,i,h,p);const _=e.__style,y=this.__style;return _!==y&&(t.style.cssText=y),!1}static importDOM(){return{"#text":()=>({conversion:UN,priority:0}),b:()=>({conversion:WN,priority:0}),code:()=>({conversion:Dn,priority:0}),em:()=>({conversion:Dn,priority:0}),i:()=>({conversion:Dn,priority:0}),s:()=>({conversion:Dn,priority:0}),span:()=>({conversion:KN,priority:0}),strong:()=>({conversion:Dn,priority:0}),sub:()=>({conversion:Dn,priority:0}),sup:()=>({conversion:Dn,priority:0}),u:()=>({conversion:Dn,priority:0})}}static importJSON(e){const t=Ze(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);if(!(t!==null&&hi(t)))throw Error("Expected TextNode createDOM to always return a HTMLElement");return t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=Ti(t,"b")),this.hasFormat("italic")&&(t=Ti(t,"i")),this.hasFormat("strikethrough")&&(t=Ti(t,"s")),this.hasFormat("underline")&&(t=Ti(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format=typeof e=="string"?Vt[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?Yy[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=this.getFormat(),r=Ic(t,e,null);return this.setFormat(r)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=Ec,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=ni,e}setMode(e){const t=Vy[e];if(this.__mode===t)return this;const r=this.getWritable();return r.__mode=t,r}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){rt();let r=e,o=t;const s=de(),i=this.getTextContent(),l=this.__key;if(typeof i=="string"){const c=i.length;r===void 0&&(r=c),o===void 0&&(o=c)}else r=0,o=0;if(ee(s)){const c=On();(c===s.anchor.key||c===s.focus.key)&&je(l),s.setTextNodeRange(this,r,this,o)}else return oh(l,r,l,o,"text","text");return s}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,r,o){const s=this.getWritable(),i=s.__text,l=r.length;let c=e;c<0&&(c=l+c,c<0&&(c=0));const a=de();if(o&&ee(a)){const d=e+l;a.setTextNodeRange(s,d,s,d)}const f=i.slice(0,c)+r+i.slice(c+t);return s.__text=f,s}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){rt();const t=this.getLatest(),r=t.getTextContent(),o=t.__key,s=On(),i=new Set(e),l=[],c=r.length;let a="";for(let S=0;S<c;S++)a!==""&&i.has(S)&&(l.push(a),a=""),a+=r[S];a!==""&&l.push(a);const f=l.length;if(f===0)return[];if(l[0]===r)return[t];const d=l[0],u=t.getParent();let h;const g=t.getFormat(),p=t.getStyle(),_=t.__detail;let y=!1;t.isSegmented()?(h=Ze(d),h.__format=g,h.__style=p,h.__detail=_,y=!0):(h=t.getWritable(),h.__text=d);const m=de(),C=[h];let N=d.length;for(let S=1;S<f;S++){const T=l[S],E=T.length,x=Ze(T).getWritable();x.__format=g,x.__style=p,x.__detail=_;const w=x.__key,O=N+E;if(ee(m)){const D=m.anchor,B=m.focus;D.key===o&&D.type==="text"&&D.offset>N&&D.offset<=O&&(D.key=w,D.offset-=N,m.dirty=!0),B.key===o&&B.type==="text"&&B.offset>N&&B.offset<=O&&(B.key=w,B.offset-=N,m.dirty=!0)}s===o&&je(w),N=O,C.push(x)}if(u!==null){hC(this);const S=u.getWritable(),T=this.getIndexWithinParent();y?(S.splice(T,0,C),this.remove()):S.splice(T,1,C),ee(m)&&bi(m,u,T,f-1)}return C}mergeWithSibling(e){const t=e===this.getPreviousSibling();if(!t&&e!==this.getNextSibling())throw Error("mergeWithSibling: sibling must be a previous or next sibling");const r=this.__key,o=e.__key,s=this.__text,i=s.length;On()===o&&je(r);const c=de();if(ee(c)){const u=c.anchor,h=c.focus;u!==null&&u.key===o&&(ih(u,t,r,e,i),c.dirty=!0),h!==null&&h.key===o&&(ih(h,t,r,e,i),c.dirty=!0)}const a=e.__text,f=t?a+s:s+a;this.setTextContent(f);const d=this.getWritable();return e.remove(),d}isTextEntity(){return!1}};function KN(n){const t=n.style;return{forChild:ca(t),node:null}}function WN(n){const e=n,t=e.style.fontWeight==="normal";return{forChild:ca(e.style,t?void 0:"bold"),node:null}}const Vd=new WeakMap;function zN(n){return n.nodeName==="PRE"||n.nodeType===Do&&n.style!==void 0&&n.style.whiteSpace!==void 0&&n.style.whiteSpace.startsWith("pre")}function jN(n){let e,t=n.parentNode;const r=[n];for(;t!==null&&(e=Vd.get(t))===void 0&&!zN(t);)r.push(t),t=t.parentNode;const o=e===void 0?t:e;for(let s=0;s<r.length;s++)Vd.set(r[s],o);return o}function UN(n){const e=n;if(n.parentElement===null)throw Error("Expected parentElement of Text not to be null");let r=e.textContent||"";if(jN(e)!==null){const o=r.split(/(\r?\n|\t)/),s=[],i=o.length;for(let l=0;l<i;l++){const c=o[l];c===`
17
17
  `||c===`\r
18
- `?s.push(ko()):c===" "?s.push(Ei()):c!==""&&s.push(Ze(c))}return{node:s}}if(o=o.replace(/\r/g,"").replace(/[ \t\n]+/g," "),o==="")return{node:null};if(o[0]===" "){let r=e,s=!0;for(;r!==null&&(r=Jd(r,!1))!==null;){const i=r.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(o=o.slice(1)),s=!1;break}}s&&(o=o.slice(1))}if(o[o.length-1]===" "){let r=e,s=!0;for(;r!==null&&(r=Jd(r,!0))!==null;)if((r.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){s=!1;break}s&&(o=o.slice(0,o.length-1))}return o===""?{node:null}:{node:Ze(o)}}function Jd(n,e){let t=n;for(;;){let o;for(;(o=e?t.nextSibling:t.previousSibling)===null;){const s=t.parentElement;if(s===null)return null;t=s}if(t=o,t.nodeType===Ar){const s=t.style.display;if(s===""&&!Nd(t)||s!==""&&!s.startsWith("inline"))return null}let r=t;for(;(r=e?t.firstChild:t.lastChild)!==null;)t=r;if(t.nodeType===bn)return t;if(t.nodeName==="BR")return null}}const jN={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Dn(n){const e=jN[n.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:ca(n.style,e),node:null}}function Ze(n=""){return Wr(new Ro(n))}function X(n){return n instanceof Ro}function ca(n,e){const t=n.fontWeight,o=n.textDecoration.split(" "),r=t==="700"||t==="bold",s=o.includes("line-through"),i=n.fontStyle==="italic",l=o.includes("underline"),c=n.verticalAlign;return a=>(X(a)&&(r&&!a.hasFormat("bold")&&a.toggleFormat("bold"),s&&!a.hasFormat("strikethrough")&&a.toggleFormat("strikethrough"),i&&!a.hasFormat("italic")&&a.toggleFormat("italic"),l&&!a.hasFormat("underline")&&a.toggleFormat("underline"),c==="sub"&&!a.hasFormat("subscript")&&a.toggleFormat("subscript"),c==="super"&&!a.hasFormat("superscript")&&a.toggleFormat("superscript"),e&&!a.hasFormat(e)&&a.toggleFormat(e)),a)}class $o extends Ro{static getType(){return"tab"}static clone(e){return new $o(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text}constructor(e){super(" ",e),this.__detail=oi}static importDOM(){return null}static importJSON(e){const t=Ei();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){throw Error("TabNode does not support setTextContent")}setDetail(e){throw Error("TabNode does not support setDetail")}setMode(e){throw Error("TabNode does not support setMode")}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Ei(){return Wr(new $o)}function Vd(n){return n instanceof $o}class HN{constructor(e,t,o){this._selection=null,this.key=e,this.offset=t,this.type=o}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode(),o=e.getNode();const r=this.offset,s=e.offset;if(R(t)){const i=t.getDescendantByIndex(r);t=i??t}if(R(o)){const i=o.getDescendantByIndex(s);o=i??o}return t===o?r<s:t.isBefore(o)}getNode(){const e=this.key,t=Qe(e);if(t===null)throw Error("Point.getNode: node not found");return t}set(e,t,o){const r=this._selection,s=this.key;this.key=e,this.offset=t,this.type=o,Io()||(On()===s&&Ue(e),r!==null&&(r.setCachedNodes(null),r.dirty=!0))}}function It(n,e,t){return new HN(n,e,t)}function aa(n,e){let t=e.__key,o=n.offset,r="element";if(X(e)){r="text";const s=e.getTextContentSize();o>s&&(o=s)}else if(!R(e)){const s=e.getNextSibling();if(X(s))t=s.__key,o=0,r="text";else{const i=e.getParent();i&&(t=i.__key,o=e.getIndexWithinParent()+1)}}n.set(t,o,r)}function Gd(n,e){if(R(e)){const t=e.getLastDescendant();R(t)||X(t)?aa(n,t):aa(n,e)}else aa(n,e)}function YN(n,e,t,o){const r=n.getNode(),s=r.getChildAtIndex(n.offset),i=Ze(),l=pt(r)?hn().append(i):i;i.setFormat(t),i.setStyle(o),s===null?r.append(l):s.insertBefore(l),n.is(e)&&e.set(i.__key,0,"text"),n.set(i.__key,0,"text")}function An(n,e,t,o){n.key=e,n.offset=t,n.type=o}class wi{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Gr(e))return!1;const t=this._nodes,o=e._nodes;return t.size===o.size&&Array.from(t).every(r=>o.has(r))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new wi(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),o=t.length,r=t[o-1];let s;if(X(r))s=r.select();else{const i=r.getIndexWithinParent()+1;s=r.getParentOrThrow().select(i,i)}s.insertNodes(e);for(let i=0;i<o;i++)t[i].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,o=[];for(const r of t){const s=Qe(r);s!==null&&o.push(s)}return Io()||(this._cachedNodes=o),o}getTextContent(){const e=this.getNodes();let t="";for(let o=0;o<e.length;o++)t+=e[o].getTextContent();return t}}function ee(n){return n instanceof kn}class kn{constructor(e,t,o,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=o,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return ee(e)?this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style:!1}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor,o=this.focus,r=t.isBefore(o),s=r?t:o,i=r?o:t;let l=s.getNode(),c=i.getNode();const a=s.offset,f=i.offset;if(R(l)){const u=l.getDescendantByIndex(a);l=u??l}if(R(c)){let u=c.getDescendantByIndex(f);u!==null&&u!==l&&c.getChildAtIndex(f)===u&&(u=u.getPreviousSibling()),c=u??c}let d;return l.is(c)?R(l)&&l.getChildrenSize()>0?d=[]:d=[l]:d=l.getNodesBetween(c),Io()||(this._cachedNodes=d),d}setTextNodeRange(e,t,o,r){An(this.anchor,e.__key,t,"text"),An(this.focus,o.__key,r,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const t=e[0],o=e[e.length-1],r=this.anchor,s=this.focus,i=r.isBefore(s),[l,c]=ua(this);let a="",f=!0;for(let d=0;d<e.length;d++){const u=e[d];if(R(u)&&!u.isInline())f||(a+=`
19
- `),u.isEmpty()?f=!1:f=!0;else if(f=!1,X(u)){let h=u.getTextContent();u===t?u===o?(r.type!=="element"||s.type!=="element"||s.offset===r.offset)&&(h=l<c?h.slice(l,c):h.slice(c,l)):h=i?h.slice(l):h.slice(c):u===o&&(h=i?h.slice(0,c):h.slice(0,l)),a+=h}else(xe(u)||io(u))&&(u!==o||!this.isCollapsed())&&(a+=u.getTextContent())}return a}applyDOMRange(e){const t=Se(),r=t.getEditorState()._selection,s=th(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,r);if(s===null)return;const[i,l]=s;An(this.anchor,i.key,i.offset,i.type),An(this.focus,l.key,l.offset,l.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new kn(It(e.key,e.offset,e.type),It(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Ic(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=Gt[e];return(this.format&t)!==0}insertRawText(e){const t=e.split(/(\r?\n|\t)/),o=[],r=t.length;for(let s=0;s<r;s++){const i=t[s];i===`
18
+ `?s.push(kr()):c===" "?s.push(xi()):c!==""&&s.push(Ze(c))}return{node:s}}if(r=r.replace(/\r/g,"").replace(/[ \t\n]+/g," "),r==="")return{node:null};if(r[0]===" "){let o=e,s=!0;for(;o!==null&&(o=Gd(o,!1))!==null;){const i=o.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(r=r.slice(1)),s=!1;break}}s&&(r=r.slice(1))}if(r[r.length-1]===" "){let o=e,s=!0;for(;o!==null&&(o=Gd(o,!0))!==null;)if((o.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){s=!1;break}s&&(r=r.slice(0,r.length-1))}return r===""?{node:null}:{node:Ze(r)}}function Gd(n,e){let t=n;for(;;){let r;for(;(r=e?t.nextSibling:t.previousSibling)===null;){const s=t.parentElement;if(s===null)return null;t=s}if(t=r,t.nodeType===Do){const s=t.style.display;if(s===""&&!Td(t)||s!==""&&!s.startsWith("inline"))return null}let o=t;for(;(o=e?t.firstChild:t.lastChild)!==null;)t=o;if(t.nodeType===bn)return t;if(t.nodeName==="BR")return null}}const HN={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Dn(n){const e=HN[n.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:ca(n.style,e),node:null}}function Ze(n=""){return Ko(new Rr(n))}function G(n){return n instanceof Rr}function ca(n,e){const t=n.fontWeight,r=n.textDecoration.split(" "),o=t==="700"||t==="bold",s=r.includes("line-through"),i=n.fontStyle==="italic",l=r.includes("underline"),c=n.verticalAlign;return a=>(G(a)&&(o&&!a.hasFormat("bold")&&a.toggleFormat("bold"),s&&!a.hasFormat("strikethrough")&&a.toggleFormat("strikethrough"),i&&!a.hasFormat("italic")&&a.toggleFormat("italic"),l&&!a.hasFormat("underline")&&a.toggleFormat("underline"),c==="sub"&&!a.hasFormat("subscript")&&a.toggleFormat("subscript"),c==="super"&&!a.hasFormat("superscript")&&a.toggleFormat("superscript"),e&&!a.hasFormat(e)&&a.toggleFormat(e)),a)}class $r extends Rr{static getType(){return"tab"}static clone(e){return new $r(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text}constructor(e){super(" ",e),this.__detail=ni}static importDOM(){return null}static importJSON(e){const t=xi();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){throw Error("TabNode does not support setTextContent")}setDetail(e){throw Error("TabNode does not support setDetail")}setMode(e){throw Error("TabNode does not support setMode")}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function xi(){return Ko(new $r)}function Xd(n){return n instanceof $r}class YN{constructor(e,t,r){this._selection=null,this.key=e,this.offset=t,this.type=r}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode(),r=e.getNode();const o=this.offset,s=e.offset;if(k(t)){const i=t.getDescendantByIndex(o);t=i??t}if(k(r)){const i=r.getDescendantByIndex(s);r=i??r}return t===r?o<s:t.isBefore(r)}getNode(){const e=this.key,t=Qe(e);if(t===null)throw Error("Point.getNode: node not found");return t}set(e,t,r){const o=this._selection,s=this.key;this.key=e,this.offset=t,this.type=r,Ir()||(On()===s&&je(e),o!==null&&(o.setCachedNodes(null),o.dirty=!0))}}function Pt(n,e,t){return new YN(n,e,t)}function aa(n,e){let t=e.__key,r=n.offset,o="element";if(G(e)){o="text";const s=e.getTextContentSize();r>s&&(r=s)}else if(!k(e)){const s=e.getNextSibling();if(G(s))t=s.__key,r=0,o="text";else{const i=e.getParent();i&&(t=i.__key,r=e.getIndexWithinParent()+1)}}n.set(t,r,o)}function qd(n,e){if(k(e)){const t=e.getLastDescendant();k(t)||G(t)?aa(n,t):aa(n,e)}else aa(n,e)}function JN(n,e,t,r){const o=n.getNode(),s=o.getChildAtIndex(n.offset),i=Ze(),l=pt(o)?dn().append(i):i;i.setFormat(t),i.setStyle(r),s===null?o.append(l):s.insertBefore(l),n.is(e)&&e.set(i.__key,0,"text"),n.set(i.__key,0,"text")}function An(n,e,t,r){n.key=e,n.offset=t,n.type=r}class Ei{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Vo(e))return!1;const t=this._nodes,r=e._nodes;return t.size===r.size&&Array.from(t).every(o=>r.has(o))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new Ei(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),r=t.length,o=t[r-1];let s;if(G(o))s=o.select();else{const i=o.getIndexWithinParent()+1;s=o.getParentOrThrow().select(i,i)}s.insertNodes(e);for(let i=0;i<r;i++)t[i].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,r=[];for(const o of t){const s=Qe(o);s!==null&&r.push(s)}return Ir()||(this._cachedNodes=r),r}getTextContent(){const e=this.getNodes();let t="";for(let r=0;r<e.length;r++)t+=e[r].getTextContent();return t}}function ee(n){return n instanceof kn}class kn{constructor(e,t,r,o){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=r,this.style=o,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return ee(e)?this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style:!1}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor,r=this.focus,o=t.isBefore(r),s=o?t:r,i=o?r:t;let l=s.getNode(),c=i.getNode();const a=s.offset,f=i.offset;if(k(l)){const u=l.getDescendantByIndex(a);l=u??l}if(k(c)){let u=c.getDescendantByIndex(f);u!==null&&u!==l&&c.getChildAtIndex(f)===u&&(u=u.getPreviousSibling()),c=u??c}let d;return l.is(c)?k(l)&&l.getChildrenSize()>0?d=[]:d=[l]:d=l.getNodesBetween(c),Ir()||(this._cachedNodes=d),d}setTextNodeRange(e,t,r,o){An(this.anchor,e.__key,t,"text"),An(this.focus,r.__key,o,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const t=e[0],r=e[e.length-1],o=this.anchor,s=this.focus,i=o.isBefore(s),[l,c]=ua(this);let a="",f=!0;for(let d=0;d<e.length;d++){const u=e[d];if(k(u)&&!u.isInline())f||(a+=`
19
+ `),u.isEmpty()?f=!1:f=!0;else if(f=!1,G(u)){let h=u.getTextContent();u===t?u===r?(o.type!=="element"||s.type!=="element"||s.offset===o.offset)&&(h=l<c?h.slice(l,c):h.slice(c,l)):h=i?h.slice(l):h.slice(c):u===r&&(h=i?h.slice(0,c):h.slice(0,l)),a+=h}else(xe(u)||ir(u))&&(u!==r||!this.isCollapsed())&&(a+=u.getTextContent())}return a}applyDOMRange(e){const t=Se(),o=t.getEditorState()._selection,s=rh(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,o);if(s===null)return;const[i,l]=s;An(this.anchor,i.key,i.offset,i.type),An(this.focus,l.key,l.offset,l.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new kn(Pt(e.key,e.offset,e.type),Pt(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Ic(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=Vt[e];return(this.format&t)!==0}insertRawText(e){const t=e.split(/(\r?\n|\t)/),r=[],o=t.length;for(let s=0;s<o;s++){const i=t[s];i===`
20
20
  `||i===`\r
21
- `?o.push(ko()):i===" "?o.push(Ei()):o.push(Ze(i))}this.insertNodes(o)}insertText(e){const t=this.anchor,o=this.focus,r=this.format,s=this.style;let i=t,l=o;!this.isCollapsed()&&o.isBefore(t)&&(i=o,l=t),i.type==="element"&&YN(i,l,r,s);const c=i.offset;let a=l.offset;const f=this.getNodes(),d=f.length;let u=f[0];if(!X(u))throw Error("insertText: first node is not a text node");const g=u.getTextContent().length,p=u.getParentOrThrow(),_=d-1;let y=f[_];if(d===1&&l.type==="element"&&(a=g,l.set(i.key,a,"text")),this.isCollapsed()&&c===g&&(u.isSegmented()||u.isToken()||!u.canInsertTextAfter()||!p.canInsertTextAfter()&&u.getNextSibling()===null)){let m=u.getNextSibling();if((!X(m)||!m.canInsertTextBefore()||no(m))&&(m=Ze(),m.setFormat(r),m.setStyle(s),p.canInsertTextAfter()?u.insertAfter(m):p.insertAfter(m)),m.select(0,0),u=m,e!==""){this.insertText(e);return}}else if(this.isCollapsed()&&c===0&&(u.isSegmented()||u.isToken()||!u.canInsertTextBefore()||!p.canInsertTextBefore()&&u.getPreviousSibling()===null)){let m=u.getPreviousSibling();if((!X(m)||no(m))&&(m=Ze(),m.setFormat(r),p.canInsertTextBefore()?u.insertBefore(m):p.insertBefore(m)),m.select(),u=m,e!==""){this.insertText(e);return}}else if(u.isSegmented()&&c!==g){const m=Ze(u.getTextContent());m.setFormat(r),u.replace(m),u=m}else if(!this.isCollapsed()&&e!==""){const m=y.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||R(m)&&(!m.canInsertTextBefore()||!m.canInsertTextAfter())){this.insertText(""),eh(this.anchor,this.focus,null),this.insertText(e);return}}if(d===1){if(u.isToken()){const S=Ze(e);S.select(),u.replace(S);return}const m=u.getFormat(),C=u.getStyle();if(c===a&&(m!==r||C!==s))if(u.getTextContent()==="")u.setFormat(r),u.setStyle(s);else{const S=Ze(e);if(S.setFormat(r),S.setStyle(s),S.select(),c===0)u.insertBefore(S,!1);else{const[T]=u.splitText(c);T.insertAfter(S,!1)}S.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);return}else if(Vd(u)){const S=Ze(e);S.setFormat(r),S.setStyle(s),S.select(),u.replace(S);return}const N=a-c;u=u.spliceText(c,N,e,!0),u.getTextContent()===""?u.remove():this.anchor.type==="text"&&(u.isComposing()?this.anchor.offset-=e.length:(this.format=m,this.style=C))}else{const m=new Set([...u.getParentKeys(),...y.getParentKeys()]),C=R(u)?u:u.getParentOrThrow();let N=R(y)?y:y.getParentOrThrow(),S=y;if(!C.is(N)&&N.isInline())do S=N,N=N.getParentOrThrow();while(N.isInline());if(l.type==="text"&&(a!==0||y.getTextContent()==="")||l.type==="element"&&y.getIndexWithinParent()<a)if(X(y)&&!y.isToken()&&a!==y.getTextContentSize()){if(y.isSegmented()){const O=Ze(y.getTextContent());y.replace(O),y=O}!pt(l.getNode())&&l.type==="text"&&(y=y.spliceText(0,a,"")),m.add(y.__key)}else{const O=y.getParentOrThrow();!O.canBeEmpty()&&O.getChildrenSize()===1?O.remove():y.remove()}else m.add(y.__key);const T=N.getChildren(),b=new Set(f),x=C.is(N),w=C.isInline()&&u.getNextSibling()===null?C:u;for(let O=T.length-1;O>=0;O--){const D=T[O];if(D.is(u)||R(D)&&D.isParentOf(u))break;D.isAttached()&&(!b.has(D)||D.is(S)?x||w.insertAfter(D,!1):D.remove())}if(!x){let O=N,D=null;for(;O!==null;){const B=O.getChildren(),Y=B.length;(Y===0||B[Y-1].is(D))&&(m.delete(O.__key),D=O),O=O.getParent()}}if(!u.isToken())u=u.spliceText(c,g-c,e,!0),u.getTextContent()===""?u.remove():u.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);else if(c===g)u.select();else{const O=Ze(e);O.select(),u.replace(O)}for(let O=1;O<d;O++){const D=f[O],B=D.__key;m.has(B)||D.remove()}}}removeText(){this.insertText("")}formatText(e){if(this.isCollapsed()){this.toggleFormat(e),Ue(null);return}const t=this.getNodes(),o=[];for(const m of t)X(m)&&o.push(m);const r=o.length;if(r===0){this.toggleFormat(e),Ue(null);return}const s=this.anchor,i=this.focus,l=this.isBackward(),c=l?i:s,a=l?s:i;let f=0,d=o[0],u=c.type==="element"?0:c.offset;if(c.type==="text"&&u===d.getTextContentSize()&&(f=1,d=o[1],u=0),d==null)return;const h=d.getFormatFlags(e,null),g=r-1;let p=o[g];const _=a.type==="text"?a.offset:p.getTextContentSize();if(d.is(p)){if(u===_)return;if(no(d)||u===0&&_===d.getTextContentSize())d.setFormat(h);else{const m=d.splitText(u,_),C=u===0?m[0]:m[1];C.setFormat(h),c.type==="text"&&c.set(C.__key,0,"text"),a.type==="text"&&a.set(C.__key,_-u,"text")}this.format=h;return}u!==0&&!no(d)&&([,d]=d.splitText(u),u=0),d.setFormat(h);const y=p.getFormatFlags(e,h);_>0&&(_!==p.getTextContentSize()&&!no(p)&&([p]=p.splitText(_)),p.setFormat(y));for(let m=f+1;m<g;m++){const C=o[m],N=C.getFormatFlags(e,y);C.setFormat(N)}c.type==="text"&&c.set(d.__key,u,"text"),a.type==="text"&&a.set(p.__key,_,"text"),this.format=h|y}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const _=he();if(!ee(_))throw Error("Expected RangeSelection after insertParagraph");return _.insertNodes(e)}const t=this.isBackward()?this.focus:this.anchor,o=Yc(t.getNode(),vo),r=e[e.length-1];if("__language"in o&&R(o)){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const _=da(this);o.splice(_,0,e),r.selectEnd()}return}const s=_=>(R(_)||xe(_))&&!_.isInline();if(!e.some(s)){if(!R(o))throw Error("Expected 'firstBlock' to be an ElementNode");const _=da(this);o.splice(_,0,e),r.selectEnd();return}const i=iS(e),l=i.getLastDescendant(),c=i.getChildren(),a=_=>R(_)&&vo(_)&&!_.isEmpty()&&R(o)&&(!o.isEmpty()||o.canMergeWhenEmpty()),d=!R(o)||!o.isEmpty()?this.insertParagraph():null,u=c[c.length-1];let h=c[0];if(a(h)){if(!R(o))throw Error("Expected 'firstBlock' to be an ElementNode");o.append(...h.getChildren()),h=c[1]}h&&$N(o,h);const g=Yc(l,vo);d&&R(g)&&(d.canMergeWhenEmpty()||vo(u))&&(g.append(...d.getChildren()),d.remove()),R(o)&&o.isEmpty()&&o.remove(),l.selectEnd();const p=R(o)?o.getLastChild():null;io(p)&&g!==o&&p.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=hn();return Tt().splice(this.anchor.offset,0,[i]),i.select(),i}const e=da(this),t=Yc(this.anchor.getNode(),vo);if(!R(t))throw Error("Expected ancestor to be an ElementNode");const o=t.getChildAtIndex(e),r=o?[o,...o.getNextSiblings()]:[],s=t.insertNewAfter(this,!1);return s?(s.append(...r),s.selectStart(),s):null}insertLineBreak(e){const t=ko();if(this.insertNodes([t]),e){const o=t.getParentOrThrow(),r=t.getIndexWithinParent();o.select(r,r)}}extract(){const e=this.getNodes(),t=e.length,o=t-1,r=this.anchor,s=this.focus;let i=e[0],l=e[o];const[c,a]=ua(this);if(t===0)return[];if(t===1){if(X(i)&&!this.isCollapsed()){const d=c>a?a:c,u=c>a?c:a,h=i.splitText(d,u),g=d===0?h[0]:h[1];return g!=null?[g]:[]}return[i]}const f=r.isBefore(s);if(X(i)){const d=f?c:a;d===i.getTextContentSize()?e.shift():d!==0&&([,i]=i.splitText(d),e[0]=i)}if(X(l)){const u=l.getTextContent().length,h=f?a:c;h===0?e.pop():h!==u&&([l]=l.splitText(h),e[o]=l)}return e}modify(e,t,o){const r=this.focus,s=this.anchor,i=e==="move",l=Wc(r,t);if(xe(l)&&!l.isIsolated()){if(i&&l.isKeyboardSelectable()){const h=fa();h.add(l.__key),Xt(h);return}const u=t?l.getPreviousSibling():l.getNextSibling();if(X(u)){const h=u.__key,g=t?u.getTextContent().length:0;r.set(h,g,"text"),i&&s.set(h,g,"text");return}else{const h=l.getParentOrThrow();let g,p;R(u)?(p=u.__key,g=t?u.getChildrenSize():0):(g=l.getIndexWithinParent(),p=h.__key,t||g++),r.set(p,g,"element"),i&&s.set(p,g,"element");return}}const c=Se(),a=qt(c._window);if(!a)return;const f=c._blockCursorElement,d=c._rootElement;if(d!==null&&f!==null&&R(l)&&!l.isInline()&&!l.canBeEmpty()&&jc(f,c,d),VN(a,e,t?"backward":"forward",o),a.rangeCount>0){const u=a.getRangeAt(0),h=this.anchor.getNode(),g=pt(h)?h:yd(h);if(this.applyDOMRange(u),this.dirty=!0,!i){const p=this.getNodes(),_=[];let y=!1;for(let m=0;m<p.length;m++){const C=p[m];di(C,g)?_.push(C):y=!0}if(y&&_.length>0)if(t){const m=_[0];R(m)?m.selectStart():m.getParentOrThrow().selectStart()}else{const m=_[_.length-1];R(m)?m.selectEnd():m.getParentOrThrow().selectEnd()}(a.anchorNode!==u.startContainer||a.anchorOffset!==u.startOffset)&&JN(this)}}}forwardDeletion(e,t,o){if(!o&&(e.type==="element"&&R(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const r=t.getParent(),s=t.getNextSibling()||(r===null?null:r.getNextSibling());if(R(s)&&s.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const o=this.anchor;let r=o.getNode();if(this.forwardDeletion(o,r,e))return;const s=this.focus,i=Wc(s,e);if(xe(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&R(r)&&r.getChildrenSize()===0){r.remove();const l=fa();l.add(i.__key),Xt(l)}else i.remove(),Se().dispatchCommand(Js,void 0);return}else if(!e&&R(i)&&R(r)&&r.isEmpty()){r.remove(),i.selectStart();return}if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&o.offset===0&&(o.type==="element"?o.getNode():o.getNode().getParentOrThrow()).collapseAtStart(this))return}else{const l=s.type==="text"?s.getNode():null;if(r=o.type==="text"?o.getNode():null,l!==null&&l.isSegmented()){const c=s.offset,a=l.getTextContentSize();if(l.is(r)||e&&c!==a||!e&&c!==0){qd(l,e,c);return}}else if(r!==null&&r.isSegmented()){const c=o.offset,a=r.getTextContentSize();if(r.is(l)||e&&c!==0||!e&&c!==a){qd(r,e,c);return}}GN(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const o=this.anchor.getNode();o.isEmpty()&&pt(o.getParent())&&o.getIndexWithinParent()===0&&o.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t=this.anchor.type==="element";if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),(e?this.focus:this.anchor).offset===0&&this.modify("extend",e,"character"),t){const r=e?this.anchor:this.focus;r.set(r.key,r.offset+1,r.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,o=t.getNode();if(this.forwardDeletion(t,o,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Gr(n){return n instanceof wi}function Xd(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function ua(n){const e=n.getStartEndPoints();if(e===null)return[0,0];const[t,o]=e;return t.type==="element"&&o.type==="element"&&t.key===o.key&&t.offset===o.offset?[0,0]:[Xd(t),Xd(o)]}function JN(n){const e=n.focus,t=n.anchor,o=t.key,r=t.offset,s=t.type;An(t,e.key,e.offset,e.type),An(e,o,r,s),n._cachedNodes=null}function VN(n,e,t,o){n.modify(e,t,o)}function GN(n,e){const t=n.anchor,o=n.focus,r=t.getNode(),s=o.getNode();if(r===s&&t.type==="text"&&o.type==="text"){const i=t.offset,l=o.offset,c=i<l,a=c?i:l,f=c?l:i,d=f-1;if(a!==d){const u=r.getTextContent().slice(a,f);ad(u)||(e?o.offset=d:t.offset=d)}}}function qd(n,e,t){const o=n,s=o.getTextContent().split(/(?=\s)/g),i=s.length;let l=0,c=0;for(let f=0;f<i;f++){const d=s[f],u=f===i-1;if(c=l,l+=d.length,e&&l===t||l>t||u){s.splice(f,1),u&&(c=void 0);break}}const a=s.join("").trim();a===""?o.remove():(o.setTextContent(a),o.select(c,c))}function XN(n,e,t){const o=n.getParent();return t===null||o===null||!o.canBeEmpty()||o!==t.getNode()}function Qd(n,e,t,o){let r=e,s;if(n.nodeType===Ar){let i=!1;const l=n.childNodes,c=l.length,a=o._blockCursorElement;r===c&&(i=!0,r=c-1);let f=l[r],d=!1;if(f===a)f=l[r+1],d=!0;else if(a!==null){const u=a.parentNode;if(n===u){const h=Array.prototype.indexOf.call(u.children,a);e>h&&r--}}if(s=Oo(f),X(s))r=cd(s,i);else{let u=Oo(n);if(u===null)return null;if(R(u)){r=Math.min(u.getChildrenSize(),r);let h=u.getChildAtIndex(r);if(R(h)&&XN(h,r,t)){const g=i?h.getLastDescendant():h.getFirstDescendant();g===null?u=h:(h=g,u=R(h)?h:h.getParentOrThrow()),r=0}X(h)?(s=h,u=null,r=cd(h,i)):h!==u&&i&&!d&&r++}else{const h=u.getIndexWithinParent();e===0&&xe(u)&&Oo(n)===u?r=h:r=h+1,u=u.getParentOrThrow()}if(R(u))return It(u.__key,r,"element")}}else s=Oo(n);return X(s)?It(s.__key,r,"text"):null}function Zd(n,e,t){const o=n.offset,r=n.getNode();if(o===0){const s=r.getPreviousSibling(),i=r.getParent();if(!e)R(s)&&!t&&s.isInline()?(n.key=s.__key,n.offset=s.getChildrenSize(),n.type="element"):X(s)&&(n.key=s.__key,n.offset=s.getTextContent().length);else if((t||!e)&&s===null&&R(i)&&i.isInline()){const l=i.getPreviousSibling();X(l)&&(n.key=l.__key,n.offset=l.getTextContent().length)}}else if(o===r.getTextContent().length){const s=r.getNextSibling(),i=r.getParent();if(e&&R(s)&&s.isInline())n.key=s.__key,n.offset=0,n.type="element";else if((t||e)&&s===null&&R(i)&&i.isInline()&&!i.canInsertTextAfter()){const l=i.getNextSibling();X(l)&&(n.key=l.__key,n.offset=0)}}}function eh(n,e,t){if(n.type==="text"&&e.type==="text"){const o=n.isBefore(e),r=n.is(e);Zd(n,o,r),Zd(e,!o,r),r&&(e.key=n.key,e.offset=n.offset,e.type=n.type);const s=Se();if(s.isComposing()&&s._compositionKey!==n.key&&ee(t)){const i=t.anchor,l=t.focus;An(n,i.key,i.offset,i.type),An(e,l.key,l.offset,l.type)}}}function th(n,e,t,o,r,s){if(n===null||t===null||!$r(r,n,t))return null;const i=Qd(n,e,ee(s)?s.anchor:null,r);if(i===null)return null;const l=Qd(t,o,ee(s)?s.focus:null,r);if(l===null)return null;if(i.type==="element"&&l.type==="element"){const c=Oo(n),a=Oo(t);if(xe(c)&&xe(a))return null}return eh(i,l,s),[i,l]}function qN(n){return R(n)&&!n.isInline()}function nh(n,e,t,o,r,s){const i=Zt(),l=new kn(It(n,e,r),It(t,o,s),0,"");return l.dirty=!0,i._selection=l,l}function QN(){const n=It("root",0,"element"),e=It("root",0,"element");return new kn(n,e,0,"")}function fa(){return new wi(new Set)}function ZN(n){const t=n.getEditorState()._selection,o=qt(n._window);return ee(t)||t==null?bi(t,o,n,null):t.clone()}function eS(n,e){return bi(null,n,e,null)}function bi(n,e,t,o){const r=t._window;if(r===null)return null;const s=o||r.event,i=s?s.type:void 0,l=i==="selectionchange",c=!Xy()&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&s&&s.detail===3||i==="drop"||i===void 0);let a,f,d,u;if(!ee(n)||c){if(e===null)return null;if(a=e.anchorNode,f=e.focusNode,d=e.anchorOffset,u=e.focusOffset,l&&ee(n)&&!$r(t,a,f))return n.clone()}else return n.clone();const h=th(a,d,f,u,t,n);if(h===null)return null;const[g,p]=h;return new kn(g,p,ee(n)?n.format:0,ee(n)?n.style:"")}function he(){return Zt()._selection}function Po(){return Se()._editorState._selection}function Oi(n,e,t,o=1){const r=n.anchor,s=n.focus,i=r.getNode(),l=s.getNode();if(!e.is(i)&&!e.is(l))return;const c=e.__key;if(n.isCollapsed()){const a=r.offset;if(t<=a&&o>0||t<a&&o<0){const f=Math.max(0,a+o);r.set(c,f,"element"),s.set(c,f,"element"),oh(n)}}else{const a=n.isBackward(),f=a?s:r,d=f.getNode(),u=a?r:s,h=u.getNode();if(e.is(d)){const g=f.offset;(t<=g&&o>0||t<g&&o<0)&&f.set(c,Math.max(0,g+o),"element")}if(e.is(h)){const g=u.offset;(t<=g&&o>0||t<g&&o<0)&&u.set(c,Math.max(0,g+o),"element")}}oh(n)}function oh(n){const e=n.anchor,t=e.offset,o=n.focus,r=o.offset,s=e.getNode(),i=o.getNode();if(n.isCollapsed()){if(!R(s))return;const l=s.getChildrenSize(),c=t>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(X(a)){let f=0;c&&(f=a.getTextContentSize()),e.set(a.__key,f,"text"),o.set(a.__key,f,"text")}return}if(R(s)){const l=s.getChildrenSize(),c=t>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(X(a)){let f=0;c&&(f=a.getTextContentSize()),e.set(a.__key,f,"text")}}if(R(i)){const l=i.getChildrenSize(),c=r>=l,a=c?i.getChildAtIndex(l-1):i.getChildAtIndex(r);if(X(a)){let f=0;c&&(f=a.getTextContentSize()),o.set(a.__key,f,"text")}}}function tS(n,e){const o=e.getEditorState()._selection,r=n._selection;if(ee(r)){const s=r.anchor,i=r.focus;let l;if(s.type==="text"&&(l=s.getNode(),l.selectionTransform(o,r)),i.type==="text"){const c=i.getNode();l!==c&&c.selectionTransform(o,r)}}}function vi(n,e,t,o,r){let s=null,i=0,l=null;o!==null?(s=o.__key,X(o)?(i=o.getTextContentSize(),l="text"):R(o)&&(i=o.getChildrenSize(),l="element")):r!==null&&(s=r.__key,X(r)?l="text":R(r)&&(l="element")),s!==null&&l!==null?n.set(s,i,l):(i=e.getIndexWithinParent(),i===-1&&(i=t.getChildrenSize()),n.set(t.__key,i,"element"))}function rh(n,e,t,o,r){n.type==="text"?(n.key=t,e||(n.offset+=r)):n.offset>o.getIndexWithinParent()&&(n.offset-=1)}function nS(n,e,t,o,r,s,i){const l=o.anchorNode,c=o.focusNode,a=o.anchorOffset,f=o.focusOffset,d=document.activeElement;if(r.has("collaboration")&&d!==s||d!==null&&$c(d))return;if(!ee(e)){n!==null&&$r(t,l,c)&&o.removeAllRanges();return}const u=e.anchor,h=e.focus,g=u.key,p=h.key,_=ui(t,g),y=ui(t,p),m=u.offset,C=h.offset,N=e.format,S=e.style,T=e.isCollapsed();let b=_,x=y,w=!1;if(u.type==="text"){b=li(_);const O=u.getNode();w=O.getFormat()!==N||O.getStyle()!==S}else ee(n)&&n.anchor.type==="text"&&(w=!0);if(h.type==="text"&&(x=li(y)),!(b===null||x===null)&&(T&&(n===null||w||ee(n)&&(n.format!==N||n.style!==S))&&kN(N,S,m,g,performance.now()),!(a===m&&f===C&&l===b&&c===x&&!(o.type==="Range"&&T)&&((d===null||!s.contains(d))&&s.focus({preventScroll:!0}),u.type!=="element")))){try{o.setBaseAndExtent(b,m,x,C)}catch(O){console.warn(O)}if(!r.has("skip-scroll-into-view")&&e.isCollapsed()&&s!==null&&s===document.activeElement){const O=e instanceof kn&&e.anchor.type==="element"?b.childNodes[m]||null:o.rangeCount>0?o.getRangeAt(0):null;if(O!==null){let D;if(O instanceof Text){const B=document.createRange();B.selectNode(O),D=B.getBoundingClientRect()}else D=O.getBoundingClientRect();VC(t,D,s)}}AN()}}function oS(n){let e=he()||Po();e===null&&(e=Tt().selectEnd()),e.insertNodes(n)}function rS(){const n=he();return n===null?"":n.getTextContent()}function da(n){let e=n;n.isCollapsed()||e.removeText();const t=he();if(ee(t)&&(e=t),!ee(e))throw Error("Unexpected dirty selection to be null");const o=e.anchor;let r=o.getNode(),s=o.offset;for(;!vo(r);)[r,s]=sS(r,s);return s}function sS(n,e){const t=n.getParent();if(!t){const r=hn();return Tt().append(r),r.select(),[Tt(),0]}if(X(n)){const r=n.splitText(e);if(r.length===0)return[t,n.getIndexWithinParent()];const s=e===0?0:1,i=r[0].getIndexWithinParent()+s;return[t,i]}if(!R(n)||e===0)return[t,n.getIndexWithinParent()];const o=n.getChildAtIndex(e);if(o){const r=new kn(It(n.__key,e,"element"),It(n.__key,e,"element"),0,""),s=n.insertNewAfter(r);s&&s.append(o,...o.getNextSiblings())}return[t,n.getIndexWithinParent()+1]}function iS(n){const e=hn();let t=null;for(let o=0;o<n.length;o++){const r=n[o],s=io(r);if(s||xe(r)&&r.isInline()||R(r)&&r.isInline()||X(r)||r.isParentRequired()){if(t===null&&(t=r.createParentElementNode(),e.append(t),s))continue;t!==null&&t.append(r)}else e.append(r),t=null}return e}let Be=null,je=null,gt=!1,ha=!1,Mi=0;const sh={characterData:!0,childList:!0,subtree:!0};function Io(){return gt||Be!==null&&Be._readOnly}function ot(){if(gt)throw Error("Cannot use method in read-only mode.")}function ih(){if(Mi>99)throw Error("One or more transforms are endlessly triggering additional transforms. May have encountered infinite recursion caused by transforms that have their preconditions too lose and/or conflict with each other.")}function Zt(){if(Be===null)throw Error(`Unable to find an active editor state. State helpers or node methods can only be used synchronously during the callback of editor.update(), editor.read(), or editorState.read().${lh()}`);return Be}function Se(){if(je===null)throw Error(`Unable to find an active editor. This method can only be used synchronously during the callback of editor.update() or editor.read().${lh()}`);return je}function lh(){let n=0;const e=new Set,t=Ai.version;if(typeof window<"u")for(const r of document.querySelectorAll("[contenteditable]")){const s=Pr(r);if(ii(s))n++;else if(s){let i=String(s.constructor.version||"<0.17.1");i===t&&(i+=" (separately built, likely a bundler configuration issue)"),e.add(i)}}let o=` Detected on the page: ${n} compatible editor(s) with version ${t}`;return e.size&&(o+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),o}function lS(){return je}function cS(){return Be}function ch(n,e,t){const o=e.__type,r=rC(n,o);let s=t.get(o);s===void 0&&(s=Array.from(r.transforms),t.set(o,s));const i=s.length;for(let l=0;l<i&&(s[l](e),!!e.isAttached());l++);}function ah(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function aS(n,e){const t=e._dirtyLeaves,o=n._nodeMap;for(const r of t){const s=o.get(r);X(s)&&s.isAttached()&&s.isSimpleText()&&!s.isUnmergeable()&&Zf(s)}}function uS(n,e){const t=e._dirtyLeaves,o=e._dirtyElements,r=n._nodeMap,s=On(),i=new Map;let l=t,c=l.size,a=o,f=a.size;for(;c>0||f>0;){if(c>0){e._dirtyLeaves=new Set;for(const d of l){const u=r.get(d);X(u)&&u.isAttached()&&u.isSimpleText()&&!u.isUnmergeable()&&Zf(u),u!==void 0&&ah(u,s)&&ch(e,u,i),t.add(d)}if(l=e._dirtyLeaves,c=l.size,c>0){Mi++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map;for(const d of a){const u=d[0],h=d[1];if(u!=="root"&&!h)continue;const g=r.get(u);g!==void 0&&ah(g,s)&&ch(e,g,i),o.set(u,h)}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,f=a.size,Mi++}e._dirtyLeaves=t,e._dirtyElements=o}function fS(n){return ga(n,Se()._nodes)}function ga(n,e){const t=n.type,o=e.get(t);if(o===void 0)throw Error(`parseEditorState: type "${t}" + not found`);const r=o.klass;if(n.type!==r.getType())throw Error(`LexicalNode: Node ${r.name} does not implement .importJSON().`);const s=r.importJSON(n),i=n.children;if(R(s)&&Array.isArray(i))for(let l=0;l<i.length;l++){const c=i[l],a=ga(c,e);s.append(a)}return s}function dS(n,e,t){const o=_a(),r=Be,s=gt,i=je,l=e._dirtyElements,c=e._dirtyLeaves,a=e._cloneNotNeeded,f=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._cloneNotNeeded=new Set,e._dirtyType=0,Be=o,gt=!1,je=e;try{const d=e._nodes,u=n.root;ga(u,d),t&&t(),o._readOnly=!0,fh(o)}catch(d){d instanceof Error&&e._onError(d)}finally{e._dirtyElements=l,e._dirtyLeaves=c,e._cloneNotNeeded=a,e._dirtyType=f,Be=r,gt=s,je=i}return o}function uh(n,e,t){const o=Be,r=gt,s=je;Be=e,gt=!0,je=n;try{return t()}finally{Be=o,gt=r,je=s}}function fh(n){const e=n._nodeMap;e.set=()=>{throw new Error("Cannot call set() on a frozen Lexical node map")},e.clear=()=>{throw new Error("Cannot call clear() on a frozen Lexical node map")},e.delete=()=>{throw new Error("Cannot call delete() on a frozen Lexical node map")}}function Rn(n,e){const t=n._pendingEditorState,o=n._rootElement,r=n._headless||o===null;if(t===null)return;const s=n._editorState,i=s._selection,l=t._selection,c=n._dirtyType!==to,a=Be,f=gt,d=je,u=n._updating,h=n._observer;let g=null;if(n._pendingEditorState=null,n._editorState=t,!r&&c&&h!==null){je=n,Be=t,gt=!1,n._updating=!0;try{const T=n._dirtyType,b=n._dirtyElements,x=n._dirtyLeaves;h.disconnect(),g=mN(s,t,n,T,b,x)}catch(T){if(T instanceof Error&&n._onError(T),!ha)yh(n,null,o,t),Xf(n),n._dirtyType=bo,ha=!0,Rn(n,s),ha=!1;else throw T;return}finally{h.observe(o,sh),n._updating=u,Be=a,gt=f,je=d}}t._readOnly||(t._readOnly=!0,fh(t),ee(l)&&(Object.freeze(l.anchor),Object.freeze(l.focus)),Object.freeze(l));const p=n._dirtyLeaves,_=n._dirtyElements,y=n._normalizedNodes,m=n._updateTags,C=n._deferred;c&&(n._dirtyType=to,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements=new Map,n._normalizedNodes=new Set,n._updateTags=new Set),lN(n,t);const N=r?null:qt(n._window);if(n._editable&&N!==null&&(c||l===null||l.dirty)){je=n,Be=t;try{if(h!==null&&h.disconnect(),c||l===null||l.dirty){const T=n._blockCursorElement;T!==null&&jc(T,n,o),nS(i,l,n,N,m,o)}nN(n,o,l),h!==null&&h.observe(o,sh)}finally{je=d,Be=a}}g!==null&&gS(n,g,m,p,s),!ee(l)&&l!==null&&(i===null||!i.is(l))&&n.dispatchCommand(Js,void 0);const S=n._pendingDecorators;S!==null&&(n._decorators=S,n._pendingDecorators=null,Xr("decorator",n,!0,S)),hS(n,e||s,t),Xr("update",n,!0,{dirtyElements:_,dirtyLeaves:p,editorState:t,normalizedNodes:y,prevEditorState:e||s,tags:m}),_S(n,C),pS(n)}function hS(n,e,t){const o=id(e),r=id(t);o!==r&&Xr("textcontent",n,!0,r)}function gS(n,e,t,o,r){const s=Array.from(n._listeners.mutation),i=s.length;for(let l=0;l<i;l++){const[c,a]=s[l],f=e.get(a);f!==void 0&&c(f,{dirtyLeaves:o,prevEditorState:r,updateTags:t})}}function Xr(n,e,t,...o){const r=e._updating;e._updating=t;try{const s=Array.from(e._listeners[n]);for(let i=0;i<s.length;i++)s[i].apply(null,o)}finally{e._updating=r}}function dh(n,e,t){if(n._updating===!1||je!==n){let r=!1;return n.update(()=>{r=dh(n,e,t)}),r}const o=Lc(n);for(let r=4;r>=0;r--)for(let s=0;s<o.length;s++){const c=o[s]._commands.get(e);if(c!==void 0){const a=c[r];if(a!==void 0){const f=Array.from(a),d=f.length;for(let u=0;u<d;u++)if(f[u](t,n)===!0)return!0}}}return!1}function pS(n){const e=n._updates;if(e.length!==0){const t=e.shift();if(t){const[o,r]=t;gh(n,o,r)}}}function _S(n,e){if(n._deferred=[],e.length!==0){const t=n._updating;n._updating=!0;try{for(let o=0;o<e.length;o++)e[o]()}finally{n._updating=t}}}function hh(n,e){const t=n._updates;let o=e||!1;for(;t.length!==0;){const r=t.shift();if(r){const[s,i]=r;let l,c;if(i!==void 0){if(l=i.onUpdate,c=i.tag,i.skipTransforms&&(o=!0),i.discrete){const a=n._pendingEditorState;if(a===null)throw Error("Unexpected empty pending editor state on discrete nested update");a._flushSync=!0}l&&n._deferred.push(l),c&&n._updateTags.add(c)}s()}}return o}function gh(n,e,t){const o=n._updateTags;let r,s,i=!1,l=!1;t!==void 0&&(r=t.onUpdate,s=t.tag,s!=null&&o.add(s),i=t.skipTransforms||!1,l=t.discrete||!1),r&&n._deferred.push(r);const c=n._editorState;let a=n._pendingEditorState,f=!1;(a===null||a._readOnly)&&(a=n._pendingEditorState=CS(a||c),f=!0),a._flushSync=l;const d=Be,u=gt,h=je,g=n._updating;Be=a,gt=!1,n._updating=!0,je=n;try{f&&(n._headless?c._selection!==null&&(a._selection=c._selection.clone()):a._selection=ZN(n));const _=n._compositionKey;e(),i=hh(n,i),tS(a,n),n._dirtyType!==to&&(i?aS(a,n):uS(a,n),hh(n),cN(c,a,n._dirtyLeaves,n._dirtyElements));const y=n._compositionKey;_!==y&&(a._flushSync=!0);const m=a._selection;if(ee(m)){const C=a._nodeMap,N=m.anchor.key,S=m.focus.key;if(C.get(N)===void 0||C.get(S)===void 0)throw Error("updateEditor: selection has been lost because the previously selected nodes have been removed and selection wasn't moved to another node. Ensure selection changes after removing/replacing a selected node.")}else Gr(m)&&m._nodes.size===0&&(a._selection=null)}catch(_){_ instanceof Error&&n._onError(_),n._pendingEditorState=c,n._dirtyType=bo,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),Rn(n);return}finally{Be=d,gt=u,je=h,n._updating=g,Mi=0}n._dirtyType!==to||yS(a,n)?a._flushSync?(a._flushSync=!1,Rn(n)):f&&sC(()=>{Rn(n)}):(a._flushSync=!1,f&&(o.clear(),n._deferred=[],n._pendingEditorState=null))}function xt(n,e,t){n._updating?n._updates.push([e,t]):gh(n,e,t)}let qr=class extends Si{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return Yy[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const t=Se()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(X(t)&&e.push(t),R(t)){const o=t.getAllTextNodes();e.push(...o)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;R(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;R(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),o=t.length;if(e>=o){const s=t[o-1];return R(s)&&s.getLastDescendant()||s||null}const r=t[e];return R(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const t=this.getLatest().__first;return t===null?null:Qe(t)}getFirstChildOrThrow(){const e=this.getFirstChild();if(e===null)throw Error(`Expected node ${this.__key} to have a first child.`);return e}getLastChild(){const t=this.getLatest().__last;return t===null?null:Qe(t)}getLastChildOrThrow(){const e=this.getLastChild();if(e===null)throw Error(`Expected node ${this.__key} to have a last child.`);return e}getChildAtIndex(e){const t=this.getChildrenSize();let o,r;if(e<t/2){for(o=this.getFirstChild(),r=0;o!==null&&r<=e;){if(r===e)return o;o=o.getNextSibling(),r++}return null}for(o=this.getLastChild(),r=t-1;o!==null&&r>=e;){if(r===e)return o;o=o.getPreviousSibling(),r--}return null}getTextContent(){let e="";const t=this.getChildren(),o=t.length;for(let r=0;r<o;r++){const s=t[r];e+=s.getTextContent(),R(s)&&r!==o-1&&!s.isInline()&&(e+=un)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),o=t.length;for(let r=0;r<o;r++){const s=t[r];e+=s.getTextContentSize(),R(s)&&r!==o-1&&!s.isInline()&&(e+=un.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=Jf[e];return(this.getFormat()&t)!==0}return!1}select(e,t){ot();const o=he();let r=e,s=t;const i=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const c=this.getFirstChild();if(X(c)||R(c))return c.select(0,0)}else if((e===void 0||e===i)&&(t===void 0||t===i)){const c=this.getLastChild();if(X(c)||R(c))return c.select()}}r===void 0&&(r=i),s===void 0&&(s=i);const l=this.__key;if(ee(o))o.anchor.set(l,r,"element"),o.focus.set(l,s,"element"),o.dirty=!0;else return nh(l,r,l,s,"element","element");return o}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(o=>o.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){const t=this.getWritable();return t.__format=e!==""?Jf[e]:0,this}setStyle(e){const t=this.getWritable();return t.__style=e||"",this}setIndent(e){const t=this.getWritable();return t.__indent=e,this}splice(e,t,o){const r=o.length,s=this.getChildrenSize(),i=this.getWritable(),l=i.__key,c=[],a=[],f=this.getChildAtIndex(e+t);let d=null,u=s-t+r;if(e!==0)if(e===s)d=this.getLastChild();else{const g=this.getChildAtIndex(e);g!==null&&(d=g.getPreviousSibling())}if(t>0){let g=d===null?this.getFirstChild():d.getNextSibling();for(let p=0;p<t;p++){if(g===null)throw Error("splice: sibling not found");const _=g.getNextSibling(),y=g.__key,m=g.getWritable();oo(m),a.push(y),g=_}}let h=d;for(let g=0;g<r;g++){const p=o[g];h!==null&&p.is(h)&&(d=h=h.getPreviousSibling());const _=p.getWritable();_.__parent===l&&u--,oo(_);const y=p.__key;if(h===null)i.__first=y,_.__prev=null;else{const m=h.getWritable();m.__next=y,_.__prev=m.__key}if(p.__key===l)throw Error("append: attempting to append self");_.__parent=l,c.push(y),h=p}if(e+t===s){if(h!==null){const g=h.getWritable();g.__next=null,i.__last=h.__key}}else if(f!==null){const g=f.getWritable();if(h!==null){const p=h.getWritable();g.__prev=h.__key,p.__next=f.__key}else g.__prev=null}if(i.__size=u,a.length){const g=he();if(ee(g)){const p=new Set(a),_=new Set(c),{anchor:y,focus:m}=g;ph(y,p,_)&&vi(y,y.getNode(),this,d,f),ph(m,p,_)&&vi(m,m.getNode(),this,d,f),u===0&&!this.canBeEmpty()&&!vn(this)&&this.remove()}}return i}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,o){return!1}canMergeWhenEmpty(){return!1}};function R(n){return n instanceof qr}function ph(n,e,t){let o=n.getNode();for(;o;){const r=o.__key;if(e.has(r)&&!t.has(r))return!0;o=o.getParent()}return!1}class pa extends Si{constructor(e){super(e)}decorate(e,t){throw Error("decorate: base method not extended")}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function xe(n){return n instanceof pa}class Lo extends qr{static getType(){return"root"}static clone(){return new Lo}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){throw Error("getTopLevelElementOrThrow: root nodes are not top level elements")}getTextContent(){const e=this.__cachedText;return(Io()||Se()._dirtyType===to)&&e!==null?e:super.getTextContent()}remove(){throw Error("remove: cannot be called on root nodes")}replace(e){throw Error("replace: cannot be called on root nodes")}insertBefore(e){throw Error("insertBefore: cannot be called on root nodes")}insertAfter(e){throw Error("insertAfter: cannot be called on root nodes")}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const o=e[t];if(!R(o)&&!xe(o))throw Error("rootNode.append: Only element or decorator nodes can be appended to the root node")}return super.append(...e)}static importJSON(e){const t=Tt();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function mS(){return new Lo}function pt(n){return n instanceof Lo}function yS(n,e){const t=e.getEditorState()._selection,o=n._selection;if(o!==null){if(o.dirty||!o.is(t))return!0}else if(t!==null)return!0;return!1}function CS(n){return new Di(new Map(n._nodeMap))}function _a(){return new Di(new Map([["root",mS()]]))}function _h(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType())throw Error(`LexicalNode: Node ${t.name} does not match the serialized type. Check if .exportJSON() is implemented and it is returning the correct type.`);if(R(n)){const o=e.children;if(!Array.isArray(o))throw Error(`LexicalNode: Node ${t.name} is an element but .exportJSON() does not have a children array.`);const r=n.getChildren();for(let s=0;s<r.length;s++){const i=r[s],l=_h(i);o.push(l)}}return e}class Di{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return uh(t&&t.editor||null,this,e)}clone(e){const t=new Di(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return uh(null,this,()=>({root:_h(Tt())}))}}let mh=class extends qr{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}};class lo extends qr{constructor(e){super(e),this.__textFormat=0,this.__textStyle=""}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=Gt[e];return(this.getTextFormat()&t)!==0}getTextStyle(){return this.getLatest().__textStyle}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}static clone(e){return new lo(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),o=Kr(e.theme,"paragraph");return o!==void 0&&t.classList.add(...o),t}updateDOM(e,t,o){return!1}static importDOM(){return{p:e=>({conversion:NS,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&gi(t)){this.isEmpty()&&t.append(document.createElement("br"));const o=this.getFormatType();t.style.textAlign=o;const r=this.getDirection();r&&(t.dir=r);const s=this.getIndent();s>0&&(t.style.textIndent=`${s*20}px`)}return{element:t}}static importJSON(e){const t=hn();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){const o=hn();o.setTextFormat(e.format),o.setTextStyle(e.style);const r=this.getDirection();return o.setDirection(r),o.setFormat(this.getFormatType()),o.setStyle(this.getTextStyle()),this.insertAfter(o,t),o}collapseAtStart(){const e=this.getChildren();if(e.length===0||X(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function NS(n){const e=hn();if(n.style){e.setFormat(n.style.textAlign);const t=parseInt(n.style.textIndent,10)/20;t>0&&e.setIndent(t)}return{node:e}}function hn(){return Wr(new lo)}function ma(n){return n instanceof lo}const SS=!0,TS=0,xS=1,ES=2,wS=3,bS=4;function yh(n,e,t,o){const r=n._keyToDOMMap;r.clear(),n._editorState=_a(),n._pendingEditorState=o,n._compositionKey=null,n._dirtyType=to,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,n._updateTags=new Set,n._updates=[],n._blockCursorElement=null;const s=n._observer;s!==null&&(s.disconnect(),n._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",r.set("root",t))}function OS(n,e){const t=new Map,o=new Set,r=s=>{Object.keys(s).forEach(i=>{let l=t.get(i);l===void 0&&(l=[],t.set(i,l)),l.push(s[i])})};return n.forEach(s=>{const i=s.klass.importDOM;if(i==null||o.has(i))return;o.add(i);const l=i.call(s.klass);l!==null&&r(l)}),e&&r(e),t}function vS(n){const e=n||{},t=lS(),o=e.theme||{},r=n===void 0?t:e.parentEditor||null,s=e.disableEvents||!1,i=_a(),l=e.namespace||(r!==null?r._config.namespace:ud()),c=e.editorState,a=[Lo,Ro,Ao,$o,lo,mh,...e.nodes||[]],{onError:f,html:d}=e,u=e.editable!==void 0?e.editable:!0;let h;if(n===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let p=0;p<a.length;p++){let _=a[p],y=null,m=null;if(typeof _!="function"){const T=_;_=T.replace,y=T.with,m=T.withKlass||null}{const T=Object.prototype.hasOwnProperty.call(_,"getType")&&_.getType(),b=_.name;if(m&&!(m.prototype instanceof _))throw Error(`${m.name} doesn't extend the ${b}`);if(b!=="RootNode"&&T!=="root"&&T!=="artificial"){const x=_.prototype;["getType","clone"].forEach(w=>{_.hasOwnProperty(w)||console.warn(`${b} must implement static "${w}" method`)}),!_.hasOwnProperty("importDOM")&&_.hasOwnProperty("exportDOM")&&console.warn(`${b} should implement "importDOM" if using a custom "exportDOM" method to ensure HTML serialization (important for copy & paste) works as expected`),x instanceof pa&&(x.hasOwnProperty("decorate")||console.warn(`${x.constructor.name} must implement "decorate" method`)),_.hasOwnProperty("importJSON")||console.warn(`${b} should implement "importJSON" method to ensure JSON and default HTML serialization works as expected`),x.hasOwnProperty("exportJSON")||console.warn(`${b} should implement "exportJSON" method to ensure JSON and default HTML serialization works as expected`)}}const C=_.getType(),N=_.transform(),S=new Set;N!==null&&S.add(N),h.set(C,{exportDOM:d&&d.export?d.export.get(_):void 0,klass:_,replace:y,replaceWithKlass:m,transforms:S})}}const g=new Ai(i,r,h,{disableEvents:s,namespace:l,theme:o},f||console.error,OS(h,d?d.import:void 0),u);return c!==void 0&&(g._pendingEditorState=c,g._dirtyType=bo),g}class Ai{constructor(e,t,o,r,s,i,l){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=o,this._decorators={},this._pendingDecorators=null,this._dirtyType=to,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=ud(),this._onError=s,this._htmlConversions=i,this._editable=l,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,o){if(o===void 0)throw Error('Listener for type "command" requires a "priority".');const r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);const s=r.get(e);if(s===void 0)throw Error(`registerCommand: Command ${String(e)} not found in command map`);const i=s[o];return i.add(t),()=>{i.delete(t),s.every(l=>l.size===0)&&r.delete(e)}}registerMutationListener(e,t,o){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,s=this._listeners.mutation;s.set(t,r);const i=o&&o.skipInitialization;return(i===void 0?SS:i)||this.initializeMutationListener(t,r),()=>{s.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());if(t===void 0)throw Error(`Node ${e.name} has not been registered. Ensure node has been passed to createEditor.`);return t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const o=this._editorState,r=Td(o).get(t.getType());if(!r)return;const s=new Map;for(const i of r.keys())s.set(i,"created");s.size>0&&e(s,{dirtyLeaves:new Set,prevEditorState:o,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const o=this.getRegisteredNode(e);return o.transforms.add(t),o}registerNodeTransform(e,t){const o=this.registerNodeTransformToKlass(e,t),r=[o],s=o.replaceWithKlass;if(s!=null){const i=this.registerNodeTransformToKlass(s,t);r.push(i)}return hC(this,e.getType()),()=>{r.forEach(i=>i.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return j(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const o=Kr(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,yh(this,t,e,r),t!==null&&(this._config.disableEvents||MN(t),o!=null&&t.classList.remove(...o)),e!==null){const s=QC(e),i=e.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=s,this._dirtyType=bo,Xf(this),this._updateTags.add("history-merge"),Rn(this),this._config.disableEvents||vN(e,this),o!=null&&e.classList.add(...o)}else this._editorState=r,this._pendingEditorState=null,this._window=null;Xr("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){if(e.isEmpty())throw Error("setEditorState: the editor state is empty. Ensure the editor state's root node never becomes empty.");Gf(this);const o=this._pendingEditorState,r=this._updateTags,s=t!==void 0?t.tag:null;o!==null&&!o.isEmpty()&&(s!=null&&r.add(s),Rn(this)),this._pendingEditorState=e,this._dirtyType=bo,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&r.add(s),Rn(this)}parseEditorState(e,t){const o=typeof e=="string"?JSON.parse(e):e;return dS(o,this,t)}read(e){return Rn(this),this.getEditorState().read(e,{editor:this})}update(e,t){xt(this,e,t)}focus(e,t={}){const o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),xt(this,()=>{const r=he(),s=Tt();r!==null?r.dirty=!0:s.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?s.selectStart():s.selectEnd())},{onUpdate:()=>{o.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=qt(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Xr("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Ai.version="0.17.1+dev.esm";const MS=Object.freeze(Object.defineProperty({__proto__:null,$addUpdateTag:XC,$applyNodeReplacement:Wr,$cloneWithProperties:xd,$copyNode:Cd,$createLineBreakNode:ko,$createNodeSelection:fa,$createParagraphNode:hn,$createPoint:It,$createRangeSelection:QN,$createRangeSelectionFromDom:eS,$createTabNode:Ei,$createTextNode:Ze,$getAdjacentNode:Wc,$getCharacterOffsets:ua,$getEditor:sN,$getNearestNodeFromDOMNode:Ir,$getNearestRootOrShadowRoot:yd,$getNodeByKey:Qe,$getNodeByKeyOrThrow:eN,$getPreviousSelection:Po,$getRoot:Tt,$getSelection:he,$getTextContent:rS,$hasAncestor:di,$hasUpdateTag:GC,$insertNodes:oS,$isBlockElementNode:qN,$isDecoratorNode:xe,$isElementNode:R,$isInlineElementOrDecoratorNode:ZC,$isLeafNode:aC,$isLineBreakNode:io,$isNodeSelection:Gr,$isParagraphNode:ma,$isRangeSelection:ee,$isRootNode:pt,$isRootOrShadowRoot:vn,$isTabNode:Vd,$isTextNode:X,$isTokenOrSegmented:no,$nodesOfType:JC,$normalizeSelection__EXPERIMENTAL:ed,$parseSerializedNode:fS,$selectAll:YC,$setCompositionKey:Ue,$setSelection:Xt,$splitNode:oN,ArtificialNode__DO_NOT_USE:mh,BLUR_COMMAND:Ff,CAN_REDO_COMMAND:Ly,CAN_UNDO_COMMAND:Fy,CLEAR_EDITOR_COMMAND:Py,CLEAR_HISTORY_COMMAND:Iy,CLICK_COMMAND:Nf,COMMAND_PRIORITY_CRITICAL:bS,COMMAND_PRIORITY_EDITOR:TS,COMMAND_PRIORITY_HIGH:wS,COMMAND_PRIORITY_LOW:xS,COMMAND_PRIORITY_NORMAL:ES,CONTROLLED_TEXT_INSERTION_COMMAND:wo,COPY_COMMAND:mc,CUT_COMMAND:yc,DELETE_CHARACTER_COMMAND:Or,DELETE_LINE_COMMAND:Dr,DELETE_WORD_COMMAND:Mr,DRAGEND_COMMAND:If,DRAGOVER_COMMAND:Pf,DRAGSTART_COMMAND:$f,DROP_COMMAND:Rf,DecoratorNode:pa,ElementNode:qr,FOCUS_COMMAND:Lf,FORMAT_ELEMENT_COMMAND:$y,FORMAT_TEXT_COMMAND:En,INDENT_CONTENT_COMMAND:ky,INSERT_LINE_BREAK_COMMAND:vr,INSERT_PARAGRAPH_COMMAND:dc,INSERT_TAB_COMMAND:Ay,IS_ALL_FORMATTING:Uf,IS_BOLD:qs,IS_CODE:Zs,IS_HIGHLIGHT:ni,IS_ITALIC:Qs,IS_STRIKETHROUGH:kr,IS_SUBSCRIPT:ei,IS_SUPERSCRIPT:ti,IS_UNDERLINE:Rr,KEY_ARROW_DOWN_COMMAND:Of,KEY_ARROW_LEFT_COMMAND:Ef,KEY_ARROW_RIGHT_COMMAND:Tf,KEY_ARROW_UP_COMMAND:bf,KEY_BACKSPACE_COMMAND:Mf,KEY_DELETE_COMMAND:Af,KEY_DOWN_COMMAND:Sf,KEY_ENTER_COMMAND:Vs,KEY_ESCAPE_COMMAND:Df,KEY_MODIFIER_COMMAND:Bf,KEY_SPACE_COMMAND:vf,KEY_TAB_COMMAND:kf,LineBreakNode:Ao,MOVE_TO_END:xf,MOVE_TO_START:wf,OUTDENT_CONTENT_COMMAND:Ry,PASTE_COMMAND:hc,ParagraphNode:lo,REDO_COMMAND:_c,REMOVE_TEXT_COMMAND:gc,RootNode:Lo,SELECTION_CHANGE_COMMAND:Js,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:Dy,SELECT_ALL_COMMAND:Cc,TEXT_TYPE_TO_FORMAT:Gt,TabNode:$o,TextNode:Ro,UNDO_COMMAND:pc,createCommand:ne,createEditor:vS,getEditorPropertyFromDOMNode:Pr,getNearestEditorFromDOMNode:Pc,isBlockDomNode:Hc,isCurrentlyReadOnlyMode:Io,isHTMLAnchorElement:rN,isHTMLElement:gi,isInlineDomNode:Nd,isLexicalEditor:ii,isSelectionCapturedInDecoratorInput:$c,isSelectionWithinEditor:$r,resetRandomKey:nC},Symbol.toStringTag,{value:"Module"}));function DS(n){return{}}const ki={},AS={},Ch={},Qr={},Zr={},ya={},Fo={},Ca={},Na={},es={},ts={},$n={},Sa={},Ta={},Nh={},Sh={},Th={},xh={},Eh={},wh={},bh={},Ri={},Oh={},vh={},Mh={},Dh={},Ah={},kS={},RS={},$S={},kh={},PS={},Rh={},$h={},Ph={},xa={},Ea={},wa={},IS={},LS={},FS={},BS={},Ih={},Lh={},Fh={},Lt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,KS=Lt&&"documentMode"in document?document.documentMode:null,Ft=Lt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pn=Lt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),$i=!(!Lt||!("InputEvent"in window)||KS)&&"getTargetRanges"in new window.InputEvent("input"),ba=Lt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Pi=Lt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,WS=Lt&&/Android/.test(navigator.userAgent),Bh=Lt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),zS=Lt&&WS&&Bh,Oa=Lt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Bh,ns=1,In=3,co=0,Kh=1,Bo=2,US=0,jS=1,HS=2,YS=1,JS=2,os=4,rs=8,VS=16,GS=32,XS=64,Ii=128,Wh=112|(3|os|rs)|Ii,va=1,Ma=2,Da=3,Aa=4,ka=5,Ra=6,Li=ba||Pi||Oa?" ":"​",gn=`
21
+ `?r.push(kr()):i===" "?r.push(xi()):r.push(Ze(i))}this.insertNodes(r)}insertText(e){const t=this.anchor,r=this.focus,o=this.format,s=this.style;let i=t,l=r;!this.isCollapsed()&&r.isBefore(t)&&(i=r,l=t),i.type==="element"&&JN(i,l,o,s);const c=i.offset;let a=l.offset;const f=this.getNodes(),d=f.length;let u=f[0];if(!G(u))throw Error("insertText: first node is not a text node");const g=u.getTextContent().length,p=u.getParentOrThrow(),_=d-1;let y=f[_];if(d===1&&l.type==="element"&&(a=g,l.set(i.key,a,"text")),this.isCollapsed()&&c===g&&(u.isSegmented()||u.isToken()||!u.canInsertTextAfter()||!p.canInsertTextAfter()&&u.getNextSibling()===null)){let m=u.getNextSibling();if((!G(m)||!m.canInsertTextBefore()||nr(m))&&(m=Ze(),m.setFormat(o),m.setStyle(s),p.canInsertTextAfter()?u.insertAfter(m):p.insertAfter(m)),m.select(0,0),u=m,e!==""){this.insertText(e);return}}else if(this.isCollapsed()&&c===0&&(u.isSegmented()||u.isToken()||!u.canInsertTextBefore()||!p.canInsertTextBefore()&&u.getPreviousSibling()===null)){let m=u.getPreviousSibling();if((!G(m)||nr(m))&&(m=Ze(),m.setFormat(o),p.canInsertTextBefore()?u.insertBefore(m):p.insertBefore(m)),m.select(),u=m,e!==""){this.insertText(e);return}}else if(u.isSegmented()&&c!==g){const m=Ze(u.getTextContent());m.setFormat(o),u.replace(m),u=m}else if(!this.isCollapsed()&&e!==""){const m=y.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||k(m)&&(!m.canInsertTextBefore()||!m.canInsertTextAfter())){this.insertText(""),nh(this.anchor,this.focus,null),this.insertText(e);return}}if(d===1){if(u.isToken()){const S=Ze(e);S.select(),u.replace(S);return}const m=u.getFormat(),C=u.getStyle();if(c===a&&(m!==o||C!==s))if(u.getTextContent()==="")u.setFormat(o),u.setStyle(s);else{const S=Ze(e);if(S.setFormat(o),S.setStyle(s),S.select(),c===0)u.insertBefore(S,!1);else{const[T]=u.splitText(c);T.insertAfter(S,!1)}S.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);return}else if(Xd(u)){const S=Ze(e);S.setFormat(o),S.setStyle(s),S.select(),u.replace(S);return}const N=a-c;u=u.spliceText(c,N,e,!0),u.getTextContent()===""?u.remove():this.anchor.type==="text"&&(u.isComposing()?this.anchor.offset-=e.length:(this.format=m,this.style=C))}else{const m=new Set([...u.getParentKeys(),...y.getParentKeys()]),C=k(u)?u:u.getParentOrThrow();let N=k(y)?y:y.getParentOrThrow(),S=y;if(!C.is(N)&&N.isInline())do S=N,N=N.getParentOrThrow();while(N.isInline());if(l.type==="text"&&(a!==0||y.getTextContent()==="")||l.type==="element"&&y.getIndexWithinParent()<a)if(G(y)&&!y.isToken()&&a!==y.getTextContentSize()){if(y.isSegmented()){const O=Ze(y.getTextContent());y.replace(O),y=O}!pt(l.getNode())&&l.type==="text"&&(y=y.spliceText(0,a,"")),m.add(y.__key)}else{const O=y.getParentOrThrow();!O.canBeEmpty()&&O.getChildrenSize()===1?O.remove():y.remove()}else m.add(y.__key);const T=N.getChildren(),E=new Set(f),x=C.is(N),w=C.isInline()&&u.getNextSibling()===null?C:u;for(let O=T.length-1;O>=0;O--){const D=T[O];if(D.is(u)||k(D)&&D.isParentOf(u))break;D.isAttached()&&(!E.has(D)||D.is(S)?x||w.insertAfter(D,!1):D.remove())}if(!x){let O=N,D=null;for(;O!==null;){const B=O.getChildren(),q=B.length;(q===0||B[q-1].is(D))&&(m.delete(O.__key),D=O),O=O.getParent()}}if(!u.isToken())u=u.spliceText(c,g-c,e,!0),u.getTextContent()===""?u.remove():u.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);else if(c===g)u.select();else{const O=Ze(e);O.select(),u.replace(O)}for(let O=1;O<d;O++){const D=f[O],B=D.__key;m.has(B)||D.remove()}}}removeText(){this.insertText("")}formatText(e){if(this.isCollapsed()){this.toggleFormat(e),je(null);return}const t=this.getNodes(),r=[];for(const m of t)G(m)&&r.push(m);const o=r.length;if(o===0){this.toggleFormat(e),je(null);return}const s=this.anchor,i=this.focus,l=this.isBackward(),c=l?i:s,a=l?s:i;let f=0,d=r[0],u=c.type==="element"?0:c.offset;if(c.type==="text"&&u===d.getTextContentSize()&&(f=1,d=r[1],u=0),d==null)return;const h=d.getFormatFlags(e,null),g=o-1;let p=r[g];const _=a.type==="text"?a.offset:p.getTextContentSize();if(d.is(p)){if(u===_)return;if(nr(d)||u===0&&_===d.getTextContentSize())d.setFormat(h);else{const m=d.splitText(u,_),C=u===0?m[0]:m[1];C.setFormat(h),c.type==="text"&&c.set(C.__key,0,"text"),a.type==="text"&&a.set(C.__key,_-u,"text")}this.format=h;return}u!==0&&!nr(d)&&([,d]=d.splitText(u),u=0),d.setFormat(h);const y=p.getFormatFlags(e,h);_>0&&(_!==p.getTextContentSize()&&!nr(p)&&([p]=p.splitText(_)),p.setFormat(y));for(let m=f+1;m<g;m++){const C=r[m],N=C.getFormatFlags(e,y);C.setFormat(N)}c.type==="text"&&c.set(d.__key,u,"text"),a.type==="text"&&a.set(p.__key,_,"text"),this.format=h|y}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const _=de();if(!ee(_))throw Error("Expected RangeSelection after insertParagraph");return _.insertNodes(e)}const t=this.isBackward()?this.focus:this.anchor,r=Yc(t.getNode(),vr),o=e[e.length-1];if("__language"in r&&k(r)){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const _=da(this);r.splice(_,0,e),o.selectEnd()}return}const s=_=>(k(_)||xe(_))&&!_.isInline();if(!e.some(s)){if(!k(r))throw Error("Expected 'firstBlock' to be an ElementNode");const _=da(this);r.splice(_,0,e),o.selectEnd();return}const i=lS(e),l=i.getLastDescendant(),c=i.getChildren(),a=_=>k(_)&&vr(_)&&!_.isEmpty()&&k(r)&&(!r.isEmpty()||r.canMergeWhenEmpty()),d=!k(r)||!r.isEmpty()?this.insertParagraph():null,u=c[c.length-1];let h=c[0];if(a(h)){if(!k(r))throw Error("Expected 'firstBlock' to be an ElementNode");r.append(...h.getChildren()),h=c[1]}h&&PN(r,h);const g=Yc(l,vr);d&&k(g)&&(d.canMergeWhenEmpty()||vr(u))&&(g.append(...d.getChildren()),d.remove()),k(r)&&r.isEmpty()&&r.remove(),l.selectEnd();const p=k(r)?r.getLastChild():null;ir(p)&&g!==r&&p.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=dn();return Tt().splice(this.anchor.offset,0,[i]),i.select(),i}const e=da(this),t=Yc(this.anchor.getNode(),vr);if(!k(t))throw Error("Expected ancestor to be an ElementNode");const r=t.getChildAtIndex(e),o=r?[r,...r.getNextSiblings()]:[],s=t.insertNewAfter(this,!1);return s?(s.append(...o),s.selectStart(),s):null}insertLineBreak(e){const t=kr();if(this.insertNodes([t]),e){const r=t.getParentOrThrow(),o=t.getIndexWithinParent();r.select(o,o)}}extract(){const e=this.getNodes(),t=e.length,r=t-1,o=this.anchor,s=this.focus;let i=e[0],l=e[r];const[c,a]=ua(this);if(t===0)return[];if(t===1){if(G(i)&&!this.isCollapsed()){const d=c>a?a:c,u=c>a?c:a,h=i.splitText(d,u),g=d===0?h[0]:h[1];return g!=null?[g]:[]}return[i]}const f=o.isBefore(s);if(G(i)){const d=f?c:a;d===i.getTextContentSize()?e.shift():d!==0&&([,i]=i.splitText(d),e[0]=i)}if(G(l)){const u=l.getTextContent().length,h=f?a:c;h===0?e.pop():h!==u&&([l]=l.splitText(h),e[r]=l)}return e}modify(e,t,r){const o=this.focus,s=this.anchor,i=e==="move",l=Wc(o,t);if(xe(l)&&!l.isIsolated()){if(i&&l.isKeyboardSelectable()){const h=fa();h.add(l.__key),Gt(h);return}const u=t?l.getPreviousSibling():l.getNextSibling();if(G(u)){const h=u.__key,g=t?u.getTextContent().length:0;o.set(h,g,"text"),i&&s.set(h,g,"text");return}else{const h=l.getParentOrThrow();let g,p;k(u)?(p=u.__key,g=t?u.getChildrenSize():0):(g=l.getIndexWithinParent(),p=h.__key,t||g++),o.set(p,g,"element"),i&&s.set(p,g,"element");return}}const c=Se(),a=Xt(c._window);if(!a)return;const f=c._blockCursorElement,d=c._rootElement;if(d!==null&&f!==null&&k(l)&&!l.isInline()&&!l.canBeEmpty()&&Uc(f,c,d),GN(a,e,t?"backward":"forward",r),a.rangeCount>0){const u=a.getRangeAt(0),h=this.anchor.getNode(),g=pt(h)?h:Nd(h);if(this.applyDOMRange(u),this.dirty=!0,!i){const p=this.getNodes(),_=[];let y=!1;for(let m=0;m<p.length;m++){const C=p[m];fi(C,g)?_.push(C):y=!0}if(y&&_.length>0)if(t){const m=_[0];k(m)?m.selectStart():m.getParentOrThrow().selectStart()}else{const m=_[_.length-1];k(m)?m.selectEnd():m.getParentOrThrow().selectEnd()}(a.anchorNode!==u.startContainer||a.anchorOffset!==u.startOffset)&&VN(this)}}}forwardDeletion(e,t,r){if(!r&&(e.type==="element"&&k(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const o=t.getParent(),s=t.getNextSibling()||(o===null?null:o.getNextSibling());if(k(s)&&s.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let o=r.getNode();if(this.forwardDeletion(r,o,e))return;const s=this.focus,i=Wc(s,e);if(xe(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&k(o)&&o.getChildrenSize()===0){o.remove();const l=fa();l.add(i.__key),Gt(l)}else i.remove(),Se().dispatchCommand(Ys,void 0);return}else if(!e&&k(i)&&k(o)&&o.isEmpty()){o.remove(),i.selectStart();return}if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&r.offset===0&&(r.type==="element"?r.getNode():r.getNode().getParentOrThrow()).collapseAtStart(this))return}else{const l=s.type==="text"?s.getNode():null;if(o=r.type==="text"?r.getNode():null,l!==null&&l.isSegmented()){const c=s.offset,a=l.getTextContentSize();if(l.is(o)||e&&c!==a||!e&&c!==0){Zd(l,e,c);return}}else if(o!==null&&o.isSegmented()){const c=r.offset,a=o.getTextContentSize();if(o.is(l)||e&&c!==0||!e&&c!==a){Zd(o,e,c);return}}XN(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&pt(r.getParent())&&r.getIndexWithinParent()===0&&r.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t=this.anchor.type==="element";if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),(e?this.focus:this.anchor).offset===0&&this.modify("extend",e,"character"),t){const o=e?this.anchor:this.focus;o.set(o.key,o.offset+1,o.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,r=t.getNode();if(this.forwardDeletion(t,r,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Vo(n){return n instanceof Ei}function Qd(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function ua(n){const e=n.getStartEndPoints();if(e===null)return[0,0];const[t,r]=e;return t.type==="element"&&r.type==="element"&&t.key===r.key&&t.offset===r.offset?[0,0]:[Qd(t),Qd(r)]}function VN(n){const e=n.focus,t=n.anchor,r=t.key,o=t.offset,s=t.type;An(t,e.key,e.offset,e.type),An(e,r,o,s),n._cachedNodes=null}function GN(n,e,t,r){n.modify(e,t,r)}function XN(n,e){const t=n.anchor,r=n.focus,o=t.getNode(),s=r.getNode();if(o===s&&t.type==="text"&&r.type==="text"){const i=t.offset,l=r.offset,c=i<l,a=c?i:l,f=c?l:i,d=f-1;if(a!==d){const u=o.getTextContent().slice(a,f);fd(u)||(e?r.offset=d:t.offset=d)}}}function Zd(n,e,t){const r=n,s=r.getTextContent().split(/(?=\s)/g),i=s.length;let l=0,c=0;for(let f=0;f<i;f++){const d=s[f],u=f===i-1;if(c=l,l+=d.length,e&&l===t||l>t||u){s.splice(f,1),u&&(c=void 0);break}}const a=s.join("").trim();a===""?r.remove():(r.setTextContent(a),r.select(c,c))}function qN(n,e,t){const r=n.getParent();return t===null||r===null||!r.canBeEmpty()||r!==t.getNode()}function eh(n,e,t,r){let o=e,s;if(n.nodeType===Do){let i=!1;const l=n.childNodes,c=l.length,a=r._blockCursorElement;o===c&&(i=!0,o=c-1);let f=l[o],d=!1;if(f===a)f=l[o+1],d=!0;else if(a!==null){const u=a.parentNode;if(n===u){const h=Array.prototype.indexOf.call(u.children,a);e>h&&o--}}if(s=Or(f),G(s))o=ud(s,i);else{let u=Or(n);if(u===null)return null;if(k(u)){o=Math.min(u.getChildrenSize(),o);let h=u.getChildAtIndex(o);if(k(h)&&qN(h,o,t)){const g=i?h.getLastDescendant():h.getFirstDescendant();g===null?u=h:(h=g,u=k(h)?h:h.getParentOrThrow()),o=0}G(h)?(s=h,u=null,o=ud(h,i)):h!==u&&i&&!d&&o++}else{const h=u.getIndexWithinParent();e===0&&xe(u)&&Or(n)===u?o=h:o=h+1,u=u.getParentOrThrow()}if(k(u))return Pt(u.__key,o,"element")}}else s=Or(n);return G(s)?Pt(s.__key,o,"text"):null}function th(n,e,t){const r=n.offset,o=n.getNode();if(r===0){const s=o.getPreviousSibling(),i=o.getParent();if(!e)k(s)&&!t&&s.isInline()?(n.key=s.__key,n.offset=s.getChildrenSize(),n.type="element"):G(s)&&(n.key=s.__key,n.offset=s.getTextContent().length);else if((t||!e)&&s===null&&k(i)&&i.isInline()){const l=i.getPreviousSibling();G(l)&&(n.key=l.__key,n.offset=l.getTextContent().length)}}else if(r===o.getTextContent().length){const s=o.getNextSibling(),i=o.getParent();if(e&&k(s)&&s.isInline())n.key=s.__key,n.offset=0,n.type="element";else if((t||e)&&s===null&&k(i)&&i.isInline()&&!i.canInsertTextAfter()){const l=i.getNextSibling();G(l)&&(n.key=l.__key,n.offset=0)}}}function nh(n,e,t){if(n.type==="text"&&e.type==="text"){const r=n.isBefore(e),o=n.is(e);th(n,r,o),th(e,!r,o),o&&(e.key=n.key,e.offset=n.offset,e.type=n.type);const s=Se();if(s.isComposing()&&s._compositionKey!==n.key&&ee(t)){const i=t.anchor,l=t.focus;An(n,i.key,i.offset,i.type),An(e,l.key,l.offset,l.type)}}}function rh(n,e,t,r,o,s){if(n===null||t===null||!Ro(o,n,t))return null;const i=eh(n,e,ee(s)?s.anchor:null,o);if(i===null)return null;const l=eh(t,r,ee(s)?s.focus:null,o);if(l===null)return null;if(i.type==="element"&&l.type==="element"){const c=Or(n),a=Or(t);if(xe(c)&&xe(a))return null}return nh(i,l,s),[i,l]}function QN(n){return k(n)&&!n.isInline()}function oh(n,e,t,r,o,s){const i=Qt(),l=new kn(Pt(n,e,o),Pt(t,r,s),0,"");return l.dirty=!0,i._selection=l,l}function ZN(){const n=Pt("root",0,"element"),e=Pt("root",0,"element");return new kn(n,e,0,"")}function fa(){return new Ei(new Set)}function eS(n){const t=n.getEditorState()._selection,r=Xt(n._window);return ee(t)||t==null?wi(t,r,n,null):t.clone()}function tS(n,e){return wi(null,n,e,null)}function wi(n,e,t,r){const o=t._window;if(o===null)return null;const s=r||o.event,i=s?s.type:void 0,l=i==="selectionchange",c=!qy()&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&s&&s.detail===3||i==="drop"||i===void 0);let a,f,d,u;if(!ee(n)||c){if(e===null)return null;if(a=e.anchorNode,f=e.focusNode,d=e.anchorOffset,u=e.focusOffset,l&&ee(n)&&!Ro(t,a,f))return n.clone()}else return n.clone();const h=rh(a,d,f,u,t,n);if(h===null)return null;const[g,p]=h;return new kn(g,p,ee(n)?n.format:0,ee(n)?n.style:"")}function de(){return Qt()._selection}function Pr(){return Se()._editorState._selection}function bi(n,e,t,r=1){const o=n.anchor,s=n.focus,i=o.getNode(),l=s.getNode();if(!e.is(i)&&!e.is(l))return;const c=e.__key;if(n.isCollapsed()){const a=o.offset;if(t<=a&&r>0||t<a&&r<0){const f=Math.max(0,a+r);o.set(c,f,"element"),s.set(c,f,"element"),sh(n)}}else{const a=n.isBackward(),f=a?s:o,d=f.getNode(),u=a?o:s,h=u.getNode();if(e.is(d)){const g=f.offset;(t<=g&&r>0||t<g&&r<0)&&f.set(c,Math.max(0,g+r),"element")}if(e.is(h)){const g=u.offset;(t<=g&&r>0||t<g&&r<0)&&u.set(c,Math.max(0,g+r),"element")}}sh(n)}function sh(n){const e=n.anchor,t=e.offset,r=n.focus,o=r.offset,s=e.getNode(),i=r.getNode();if(n.isCollapsed()){if(!k(s))return;const l=s.getChildrenSize(),c=t>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(G(a)){let f=0;c&&(f=a.getTextContentSize()),e.set(a.__key,f,"text"),r.set(a.__key,f,"text")}return}if(k(s)){const l=s.getChildrenSize(),c=t>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(G(a)){let f=0;c&&(f=a.getTextContentSize()),e.set(a.__key,f,"text")}}if(k(i)){const l=i.getChildrenSize(),c=o>=l,a=c?i.getChildAtIndex(l-1):i.getChildAtIndex(o);if(G(a)){let f=0;c&&(f=a.getTextContentSize()),r.set(a.__key,f,"text")}}}function nS(n,e){const r=e.getEditorState()._selection,o=n._selection;if(ee(o)){const s=o.anchor,i=o.focus;let l;if(s.type==="text"&&(l=s.getNode(),l.selectionTransform(r,o)),i.type==="text"){const c=i.getNode();l!==c&&c.selectionTransform(r,o)}}}function Oi(n,e,t,r,o){let s=null,i=0,l=null;r!==null?(s=r.__key,G(r)?(i=r.getTextContentSize(),l="text"):k(r)&&(i=r.getChildrenSize(),l="element")):o!==null&&(s=o.__key,G(o)?l="text":k(o)&&(l="element")),s!==null&&l!==null?n.set(s,i,l):(i=e.getIndexWithinParent(),i===-1&&(i=t.getChildrenSize()),n.set(t.__key,i,"element"))}function ih(n,e,t,r,o){n.type==="text"?(n.key=t,e||(n.offset+=o)):n.offset>r.getIndexWithinParent()&&(n.offset-=1)}function rS(n,e,t,r,o,s,i){const l=r.anchorNode,c=r.focusNode,a=r.anchorOffset,f=r.focusOffset,d=document.activeElement;if(o.has("collaboration")&&d!==s||d!==null&&$c(d))return;if(!ee(e)){n!==null&&Ro(t,l,c)&&r.removeAllRanges();return}const u=e.anchor,h=e.focus,g=u.key,p=h.key,_=ai(t,g),y=ai(t,p),m=u.offset,C=h.offset,N=e.format,S=e.style,T=e.isCollapsed();let E=_,x=y,w=!1;if(u.type==="text"){E=ii(_);const O=u.getNode();w=O.getFormat()!==N||O.getStyle()!==S}else ee(n)&&n.anchor.type==="text"&&(w=!0);if(h.type==="text"&&(x=ii(y)),!(E===null||x===null)&&(T&&(n===null||w||ee(n)&&(n.format!==N||n.style!==S))&&RN(N,S,m,g,performance.now()),!(a===m&&f===C&&l===E&&c===x&&!(r.type==="Range"&&T)&&((d===null||!s.contains(d))&&s.focus({preventScroll:!0}),u.type!=="element")))){try{r.setBaseAndExtent(E,m,x,C)}catch(O){console.warn(O)}if(!o.has("skip-scroll-into-view")&&e.isCollapsed()&&s!==null&&s===document.activeElement){const O=e instanceof kn&&e.anchor.type==="element"?E.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(O!==null){let D;if(O instanceof Text){const B=document.createRange();B.selectNode(O),D=B.getBoundingClientRect()}else D=O.getBoundingClientRect();GC(t,D,s)}}kN()}}function oS(n){let e=de()||Pr();e===null&&(e=Tt().selectEnd()),e.insertNodes(n)}function sS(){const n=de();return n===null?"":n.getTextContent()}function da(n){let e=n;n.isCollapsed()||e.removeText();const t=de();if(ee(t)&&(e=t),!ee(e))throw Error("Unexpected dirty selection to be null");const r=e.anchor;let o=r.getNode(),s=r.offset;for(;!vr(o);)[o,s]=iS(o,s);return s}function iS(n,e){const t=n.getParent();if(!t){const o=dn();return Tt().append(o),o.select(),[Tt(),0]}if(G(n)){const o=n.splitText(e);if(o.length===0)return[t,n.getIndexWithinParent()];const s=e===0?0:1,i=o[0].getIndexWithinParent()+s;return[t,i]}if(!k(n)||e===0)return[t,n.getIndexWithinParent()];const r=n.getChildAtIndex(e);if(r){const o=new kn(Pt(n.__key,e,"element"),Pt(n.__key,e,"element"),0,""),s=n.insertNewAfter(o);s&&s.append(r,...r.getNextSiblings())}return[t,n.getIndexWithinParent()+1]}function lS(n){const e=dn();let t=null;for(let r=0;r<n.length;r++){const o=n[r],s=ir(o);if(s||xe(o)&&o.isInline()||k(o)&&o.isInline()||G(o)||o.isParentRequired()){if(t===null&&(t=o.createParentElementNode(),e.append(t),s))continue;t!==null&&t.append(o)}else e.append(o),t=null}return e}let Be=null,Ue=null,gt=!1,ha=!1,vi=0;const lh={characterData:!0,childList:!0,subtree:!0};function Ir(){return gt||Be!==null&&Be._readOnly}function rt(){if(gt)throw Error("Cannot use method in read-only mode.")}function ch(){if(vi>99)throw Error("One or more transforms are endlessly triggering additional transforms. May have encountered infinite recursion caused by transforms that have their preconditions too lose and/or conflict with each other.")}function Qt(){if(Be===null)throw Error(`Unable to find an active editor state. State helpers or node methods can only be used synchronously during the callback of editor.update(), editor.read(), or editorState.read().${ah()}`);return Be}function Se(){if(Ue===null)throw Error(`Unable to find an active editor. This method can only be used synchronously during the callback of editor.update() or editor.read().${ah()}`);return Ue}function ah(){let n=0;const e=new Set,t=Di.version;if(typeof window<"u")for(const o of document.querySelectorAll("[contenteditable]")){const s=$o(o);if(si(s))n++;else if(s){let i=String(s.constructor.version||"<0.17.1");i===t&&(i+=" (separately built, likely a bundler configuration issue)"),e.add(i)}}let r=` Detected on the page: ${n} compatible editor(s) with version ${t}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function cS(){return Ue}function aS(){return Be}function uh(n,e,t){const r=e.__type,o=sC(n,r);let s=t.get(r);s===void 0&&(s=Array.from(o.transforms),t.set(r,s));const i=s.length;for(let l=0;l<i&&(s[l](e),!!e.isAttached());l++);}function fh(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function uS(n,e){const t=e._dirtyLeaves,r=n._nodeMap;for(const o of t){const s=r.get(o);G(s)&&s.isAttached()&&s.isSimpleText()&&!s.isUnmergeable()&&td(s)}}function fS(n,e){const t=e._dirtyLeaves,r=e._dirtyElements,o=n._nodeMap,s=On(),i=new Map;let l=t,c=l.size,a=r,f=a.size;for(;c>0||f>0;){if(c>0){e._dirtyLeaves=new Set;for(const d of l){const u=o.get(d);G(u)&&u.isAttached()&&u.isSimpleText()&&!u.isUnmergeable()&&td(u),u!==void 0&&fh(u,s)&&uh(e,u,i),t.add(d)}if(l=e._dirtyLeaves,c=l.size,c>0){vi++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map;for(const d of a){const u=d[0],h=d[1];if(u!=="root"&&!h)continue;const g=o.get(u);g!==void 0&&fh(g,s)&&uh(e,g,i),r.set(u,h)}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,f=a.size,vi++}e._dirtyLeaves=t,e._dirtyElements=r}function dS(n){return ga(n,Se()._nodes)}function ga(n,e){const t=n.type,r=e.get(t);if(r===void 0)throw Error(`parseEditorState: type "${t}" + not found`);const o=r.klass;if(n.type!==o.getType())throw Error(`LexicalNode: Node ${o.name} does not implement .importJSON().`);const s=o.importJSON(n),i=n.children;if(k(s)&&Array.isArray(i))for(let l=0;l<i.length;l++){const c=i[l],a=ga(c,e);s.append(a)}return s}function hS(n,e,t){const r=_a(),o=Be,s=gt,i=Ue,l=e._dirtyElements,c=e._dirtyLeaves,a=e._cloneNotNeeded,f=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._cloneNotNeeded=new Set,e._dirtyType=0,Be=r,gt=!1,Ue=e;try{const d=e._nodes,u=n.root;ga(u,d),t&&t(),r._readOnly=!0,hh(r)}catch(d){d instanceof Error&&e._onError(d)}finally{e._dirtyElements=l,e._dirtyLeaves=c,e._cloneNotNeeded=a,e._dirtyType=f,Be=o,gt=s,Ue=i}return r}function dh(n,e,t){const r=Be,o=gt,s=Ue;Be=e,gt=!0,Ue=n;try{return t()}finally{Be=r,gt=o,Ue=s}}function hh(n){const e=n._nodeMap;e.set=()=>{throw new Error("Cannot call set() on a frozen Lexical node map")},e.clear=()=>{throw new Error("Cannot call clear() on a frozen Lexical node map")},e.delete=()=>{throw new Error("Cannot call delete() on a frozen Lexical node map")}}function Rn(n,e){const t=n._pendingEditorState,r=n._rootElement,o=n._headless||r===null;if(t===null)return;const s=n._editorState,i=s._selection,l=t._selection,c=n._dirtyType!==tr,a=Be,f=gt,d=Ue,u=n._updating,h=n._observer;let g=null;if(n._pendingEditorState=null,n._editorState=t,!o&&c&&h!==null){Ue=n,Be=t,gt=!1,n._updating=!0;try{const T=n._dirtyType,E=n._dirtyElements,x=n._dirtyLeaves;h.disconnect(),g=yN(s,t,n,T,E,x)}catch(T){if(T instanceof Error&&n._onError(T),!ha)Nh(n,null,r,t),Qf(n),n._dirtyType=br,ha=!0,Rn(n,s),ha=!1;else throw T;return}finally{h.observe(r,lh),n._updating=u,Be=a,gt=f,Ue=d}}t._readOnly||(t._readOnly=!0,hh(t),ee(l)&&(Object.freeze(l.anchor),Object.freeze(l.focus)),Object.freeze(l));const p=n._dirtyLeaves,_=n._dirtyElements,y=n._normalizedNodes,m=n._updateTags,C=n._deferred;c&&(n._dirtyType=tr,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements=new Map,n._normalizedNodes=new Set,n._updateTags=new Set),cN(n,t);const N=o?null:Xt(n._window);if(n._editable&&N!==null&&(c||l===null||l.dirty)){Ue=n,Be=t;try{if(h!==null&&h.disconnect(),c||l===null||l.dirty){const T=n._blockCursorElement;T!==null&&Uc(T,n,r),rS(i,l,n,N,m,r)}rN(n,r,l),h!==null&&h.observe(r,lh)}finally{Ue=d,Be=a}}g!==null&&pS(n,g,m,p,s),!ee(l)&&l!==null&&(i===null||!i.is(l))&&n.dispatchCommand(Ys,void 0);const S=n._pendingDecorators;S!==null&&(n._decorators=S,n._pendingDecorators=null,Go("decorator",n,!0,S)),gS(n,e||s,t),Go("update",n,!0,{dirtyElements:_,dirtyLeaves:p,editorState:t,normalizedNodes:y,prevEditorState:e||s,tags:m}),mS(n,C),_S(n)}function gS(n,e,t){const r=cd(e),o=cd(t);r!==o&&Go("textcontent",n,!0,o)}function pS(n,e,t,r,o){const s=Array.from(n._listeners.mutation),i=s.length;for(let l=0;l<i;l++){const[c,a]=s[l],f=e.get(a);f!==void 0&&c(f,{dirtyLeaves:r,prevEditorState:o,updateTags:t})}}function Go(n,e,t,...r){const o=e._updating;e._updating=t;try{const s=Array.from(e._listeners[n]);for(let i=0;i<s.length;i++)s[i].apply(null,r)}finally{e._updating=o}}function gh(n,e,t){if(n._updating===!1||Ue!==n){let o=!1;return n.update(()=>{o=gh(n,e,t)}),o}const r=Lc(n);for(let o=4;o>=0;o--)for(let s=0;s<r.length;s++){const c=r[s]._commands.get(e);if(c!==void 0){const a=c[o];if(a!==void 0){const f=Array.from(a),d=f.length;for(let u=0;u<d;u++)if(f[u](t,n)===!0)return!0}}}return!1}function _S(n){const e=n._updates;if(e.length!==0){const t=e.shift();if(t){const[r,o]=t;_h(n,r,o)}}}function mS(n,e){if(n._deferred=[],e.length!==0){const t=n._updating;n._updating=!0;try{for(let r=0;r<e.length;r++)e[r]()}finally{n._updating=t}}}function ph(n,e){const t=n._updates;let r=e||!1;for(;t.length!==0;){const o=t.shift();if(o){const[s,i]=o;let l,c;if(i!==void 0){if(l=i.onUpdate,c=i.tag,i.skipTransforms&&(r=!0),i.discrete){const a=n._pendingEditorState;if(a===null)throw Error("Unexpected empty pending editor state on discrete nested update");a._flushSync=!0}l&&n._deferred.push(l),c&&n._updateTags.add(c)}s()}}return r}function _h(n,e,t){const r=n._updateTags;let o,s,i=!1,l=!1;t!==void 0&&(o=t.onUpdate,s=t.tag,s!=null&&r.add(s),i=t.skipTransforms||!1,l=t.discrete||!1),o&&n._deferred.push(o);const c=n._editorState;let a=n._pendingEditorState,f=!1;(a===null||a._readOnly)&&(a=n._pendingEditorState=NS(a||c),f=!0),a._flushSync=l;const d=Be,u=gt,h=Ue,g=n._updating;Be=a,gt=!1,n._updating=!0,Ue=n;try{f&&(n._headless?c._selection!==null&&(a._selection=c._selection.clone()):a._selection=eS(n));const _=n._compositionKey;e(),i=ph(n,i),nS(a,n),n._dirtyType!==tr&&(i?uS(a,n):fS(a,n),ph(n),aN(c,a,n._dirtyLeaves,n._dirtyElements));const y=n._compositionKey;_!==y&&(a._flushSync=!0);const m=a._selection;if(ee(m)){const C=a._nodeMap,N=m.anchor.key,S=m.focus.key;if(C.get(N)===void 0||C.get(S)===void 0)throw Error("updateEditor: selection has been lost because the previously selected nodes have been removed and selection wasn't moved to another node. Ensure selection changes after removing/replacing a selected node.")}else Vo(m)&&m._nodes.size===0&&(a._selection=null)}catch(_){_ instanceof Error&&n._onError(_),n._pendingEditorState=c,n._dirtyType=br,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),Rn(n);return}finally{Be=d,gt=u,Ue=h,n._updating=g,vi=0}n._dirtyType!==tr||CS(a,n)?a._flushSync?(a._flushSync=!1,Rn(n)):f&&iC(()=>{Rn(n)}):(a._flushSync=!1,f&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function xt(n,e,t){n._updating?n._updates.push([e,t]):_h(n,e,t)}let Xo=class extends Ni{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return Jy[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const t=Se()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(G(t)&&e.push(t),k(t)){const r=t.getAllTextNodes();e.push(...r)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;k(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;k(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),r=t.length;if(e>=r){const s=t[r-1];return k(s)&&s.getLastDescendant()||s||null}const o=t[e];return k(o)&&o.getFirstDescendant()||o||null}getFirstChild(){const t=this.getLatest().__first;return t===null?null:Qe(t)}getFirstChildOrThrow(){const e=this.getFirstChild();if(e===null)throw Error(`Expected node ${this.__key} to have a first child.`);return e}getLastChild(){const t=this.getLatest().__last;return t===null?null:Qe(t)}getLastChildOrThrow(){const e=this.getLastChild();if(e===null)throw Error(`Expected node ${this.__key} to have a last child.`);return e}getChildAtIndex(e){const t=this.getChildrenSize();let r,o;if(e<t/2){for(r=this.getFirstChild(),o=0;r!==null&&o<=e;){if(o===e)return r;r=r.getNextSibling(),o++}return null}for(r=this.getLastChild(),o=t-1;r!==null&&o>=e;){if(o===e)return r;r=r.getPreviousSibling(),o--}return null}getTextContent(){let e="";const t=this.getChildren(),r=t.length;for(let o=0;o<r;o++){const s=t[o];e+=s.getTextContent(),k(s)&&o!==r-1&&!s.isInline()&&(e+=an)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),r=t.length;for(let o=0;o<r;o++){const s=t[o];e+=s.getTextContentSize(),k(s)&&o!==r-1&&!s.isInline()&&(e+=an.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=Gf[e];return(this.getFormat()&t)!==0}return!1}select(e,t){rt();const r=de();let o=e,s=t;const i=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const c=this.getFirstChild();if(G(c)||k(c))return c.select(0,0)}else if((e===void 0||e===i)&&(t===void 0||t===i)){const c=this.getLastChild();if(G(c)||k(c))return c.select()}}o===void 0&&(o=i),s===void 0&&(s=i);const l=this.__key;if(ee(r))r.anchor.set(l,o,"element"),r.focus.set(l,s,"element"),r.dirty=!0;else return oh(l,o,l,s,"element","element");return r}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(r=>r.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){const t=this.getWritable();return t.__format=e!==""?Gf[e]:0,this}setStyle(e){const t=this.getWritable();return t.__style=e||"",this}setIndent(e){const t=this.getWritable();return t.__indent=e,this}splice(e,t,r){const o=r.length,s=this.getChildrenSize(),i=this.getWritable(),l=i.__key,c=[],a=[],f=this.getChildAtIndex(e+t);let d=null,u=s-t+o;if(e!==0)if(e===s)d=this.getLastChild();else{const g=this.getChildAtIndex(e);g!==null&&(d=g.getPreviousSibling())}if(t>0){let g=d===null?this.getFirstChild():d.getNextSibling();for(let p=0;p<t;p++){if(g===null)throw Error("splice: sibling not found");const _=g.getNextSibling(),y=g.__key,m=g.getWritable();rr(m),a.push(y),g=_}}let h=d;for(let g=0;g<o;g++){const p=r[g];h!==null&&p.is(h)&&(d=h=h.getPreviousSibling());const _=p.getWritable();_.__parent===l&&u--,rr(_);const y=p.__key;if(h===null)i.__first=y,_.__prev=null;else{const m=h.getWritable();m.__next=y,_.__prev=m.__key}if(p.__key===l)throw Error("append: attempting to append self");_.__parent=l,c.push(y),h=p}if(e+t===s){if(h!==null){const g=h.getWritable();g.__next=null,i.__last=h.__key}}else if(f!==null){const g=f.getWritable();if(h!==null){const p=h.getWritable();g.__prev=h.__key,p.__next=f.__key}else g.__prev=null}if(i.__size=u,a.length){const g=de();if(ee(g)){const p=new Set(a),_=new Set(c),{anchor:y,focus:m}=g;mh(y,p,_)&&Oi(y,y.getNode(),this,d,f),mh(m,p,_)&&Oi(m,m.getNode(),this,d,f),u===0&&!this.canBeEmpty()&&!vn(this)&&this.remove()}}return i}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,r){return!1}canMergeWhenEmpty(){return!1}};function k(n){return n instanceof Xo}function mh(n,e,t){let r=n.getNode();for(;r;){const o=r.__key;if(e.has(o)&&!t.has(o))return!0;r=r.getParent()}return!1}class pa extends Ni{constructor(e){super(e)}decorate(e,t){throw Error("decorate: base method not extended")}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function xe(n){return n instanceof pa}class Lr extends Xo{static getType(){return"root"}static clone(){return new Lr}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){throw Error("getTopLevelElementOrThrow: root nodes are not top level elements")}getTextContent(){const e=this.__cachedText;return(Ir()||Se()._dirtyType===tr)&&e!==null?e:super.getTextContent()}remove(){throw Error("remove: cannot be called on root nodes")}replace(e){throw Error("replace: cannot be called on root nodes")}insertBefore(e){throw Error("insertBefore: cannot be called on root nodes")}insertAfter(e){throw Error("insertAfter: cannot be called on root nodes")}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const r=e[t];if(!k(r)&&!xe(r))throw Error("rootNode.append: Only element or decorator nodes can be appended to the root node")}return super.append(...e)}static importJSON(e){const t=Tt();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function yS(){return new Lr}function pt(n){return n instanceof Lr}function CS(n,e){const t=e.getEditorState()._selection,r=n._selection;if(r!==null){if(r.dirty||!r.is(t))return!0}else if(t!==null)return!0;return!1}function NS(n){return new Mi(new Map(n._nodeMap))}function _a(){return new Mi(new Map([["root",yS()]]))}function yh(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType())throw Error(`LexicalNode: Node ${t.name} does not match the serialized type. Check if .exportJSON() is implemented and it is returning the correct type.`);if(k(n)){const r=e.children;if(!Array.isArray(r))throw Error(`LexicalNode: Node ${t.name} is an element but .exportJSON() does not have a children array.`);const o=n.getChildren();for(let s=0;s<o.length;s++){const i=o[s],l=yh(i);r.push(l)}}return e}class Mi{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return dh(t&&t.editor||null,this,e)}clone(e){const t=new Mi(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return dh(null,this,()=>({root:yh(Tt())}))}}let Ch=class extends Xo{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}};class lr extends Xo{constructor(e){super(e),this.__textFormat=0,this.__textStyle=""}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=Vt[e];return(this.getTextFormat()&t)!==0}getTextStyle(){return this.getLatest().__textStyle}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}static clone(e){return new lr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),r=Bo(e.theme,"paragraph");return r!==void 0&&t.classList.add(...r),t}updateDOM(e,t,r){return!1}static importDOM(){return{p:e=>({conversion:SS,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&hi(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();t.style.textAlign=r;const o=this.getDirection();o&&(t.dir=o);const s=this.getIndent();s>0&&(t.style.textIndent=`${s*20}px`)}return{element:t}}static importJSON(e){const t=dn();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){const r=dn();r.setTextFormat(e.format),r.setTextStyle(e.style);const o=this.getDirection();return r.setDirection(o),r.setFormat(this.getFormatType()),r.setStyle(this.getTextStyle()),this.insertAfter(r,t),r}collapseAtStart(){const e=this.getChildren();if(e.length===0||G(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function SS(n){const e=dn();if(n.style){e.setFormat(n.style.textAlign);const t=parseInt(n.style.textIndent,10)/20;t>0&&e.setIndent(t)}return{node:e}}function dn(){return Ko(new lr)}function ma(n){return n instanceof lr}const TS=!0,xS=0,ES=1,wS=2,bS=3,OS=4;function Nh(n,e,t,r){const o=n._keyToDOMMap;o.clear(),n._editorState=_a(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=tr,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,n._updateTags=new Set,n._updates=[],n._blockCursorElement=null;const s=n._observer;s!==null&&(s.disconnect(),n._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",o.set("root",t))}function vS(n,e){const t=new Map,r=new Set,o=s=>{Object.keys(s).forEach(i=>{let l=t.get(i);l===void 0&&(l=[],t.set(i,l)),l.push(s[i])})};return n.forEach(s=>{const i=s.klass.importDOM;if(i==null||r.has(i))return;r.add(i);const l=i.call(s.klass);l!==null&&o(l)}),e&&o(e),t}function MS(n){const e=n||{},t=cS(),r=e.theme||{},o=n===void 0?t:e.parentEditor||null,s=e.disableEvents||!1,i=_a(),l=e.namespace||(o!==null?o._config.namespace:dd()),c=e.editorState,a=[Lr,Rr,Ar,$r,lr,Ch,...e.nodes||[]],{onError:f,html:d}=e,u=e.editable!==void 0?e.editable:!0;let h;if(n===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let p=0;p<a.length;p++){let _=a[p],y=null,m=null;if(typeof _!="function"){const T=_;_=T.replace,y=T.with,m=T.withKlass||null}{const T=Object.prototype.hasOwnProperty.call(_,"getType")&&_.getType(),E=_.name;if(m&&!(m.prototype instanceof _))throw Error(`${m.name} doesn't extend the ${E}`);if(E!=="RootNode"&&T!=="root"&&T!=="artificial"){const x=_.prototype;["getType","clone"].forEach(w=>{_.hasOwnProperty(w)||console.warn(`${E} must implement static "${w}" method`)}),!_.hasOwnProperty("importDOM")&&_.hasOwnProperty("exportDOM")&&console.warn(`${E} should implement "importDOM" if using a custom "exportDOM" method to ensure HTML serialization (important for copy & paste) works as expected`),x instanceof pa&&(x.hasOwnProperty("decorate")||console.warn(`${x.constructor.name} must implement "decorate" method`)),_.hasOwnProperty("importJSON")||console.warn(`${E} should implement "importJSON" method to ensure JSON and default HTML serialization works as expected`),x.hasOwnProperty("exportJSON")||console.warn(`${E} should implement "exportJSON" method to ensure JSON and default HTML serialization works as expected`)}}const C=_.getType(),N=_.transform(),S=new Set;N!==null&&S.add(N),h.set(C,{exportDOM:d&&d.export?d.export.get(_):void 0,klass:_,replace:y,replaceWithKlass:m,transforms:S})}}const g=new Di(i,o,h,{disableEvents:s,namespace:l,theme:r},f||console.error,vS(h,d?d.import:void 0),u);return c!==void 0&&(g._pendingEditorState=c,g._dirtyType=br),g}class Di{constructor(e,t,r,o,s,i,l){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=o,this._nodes=r,this._decorators={},this._pendingDecorators=null,this._dirtyType=tr,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=dd(),this._onError=s,this._htmlConversions=i,this._editable=l,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,r){if(r===void 0)throw Error('Listener for type "command" requires a "priority".');const o=this._commands;o.has(e)||o.set(e,[new Set,new Set,new Set,new Set,new Set]);const s=o.get(e);if(s===void 0)throw Error(`registerCommand: Command ${String(e)} not found in command map`);const i=s[r];return i.add(t),()=>{i.delete(t),s.every(l=>l.size===0)&&o.delete(e)}}registerMutationListener(e,t,r){const o=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,s=this._listeners.mutation;s.set(t,o);const i=r&&r.skipInitialization;return(i===void 0?TS:i)||this.initializeMutationListener(t,o),()=>{s.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());if(t===void 0)throw Error(`Node ${e.name} has not been registered. Ensure node has been passed to createEditor.`);return t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const r=this._editorState,o=Ed(r).get(t.getType());if(!o)return;const s=new Map;for(const i of o.keys())s.set(i,"created");s.size>0&&e(s,{dirtyLeaves:new Set,prevEditorState:r,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const r=this.getRegisteredNode(e);return r.transforms.add(t),r}registerNodeTransform(e,t){const r=this.registerNodeTransformToKlass(e,t),o=[r],s=r.replaceWithKlass;if(s!=null){const i=this.registerNodeTransformToKlass(s,t);o.push(i)}return gC(this,e.getType()),()=>{o.forEach(i=>i.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return U(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const r=Bo(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=e,Nh(this,t,e,o),t!==null&&(this._config.disableEvents||DN(t),r!=null&&t.classList.remove(...r)),e!==null){const s=ZC(e),i=e.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=s,this._dirtyType=br,Qf(this),this._updateTags.add("history-merge"),Rn(this),this._config.disableEvents||MN(e,this),r!=null&&e.classList.add(...r)}else this._editorState=o,this._pendingEditorState=null,this._window=null;Go("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){if(e.isEmpty())throw Error("setEditorState: the editor state is empty. Ensure the editor state's root node never becomes empty.");qf(this);const r=this._pendingEditorState,o=this._updateTags,s=t!==void 0?t.tag:null;r!==null&&!r.isEmpty()&&(s!=null&&o.add(s),Rn(this)),this._pendingEditorState=e,this._dirtyType=br,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&o.add(s),Rn(this)}parseEditorState(e,t){const r=typeof e=="string"?JSON.parse(e):e;return hS(r,this,t)}read(e){return Rn(this),this.getEditorState().read(e,{editor:this})}update(e,t){xt(this,e,t)}focus(e,t={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),xt(this,()=>{const o=de(),s=Tt();o!==null?o.dirty=!0:s.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?s.selectStart():s.selectEnd())},{onUpdate:()=>{r.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=Xt(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Go("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Di.version="0.17.1+dev.esm";const DS=Object.freeze(Object.defineProperty({__proto__:null,$addUpdateTag:qC,$applyNodeReplacement:Ko,$cloneWithProperties:wd,$copyNode:Sd,$createLineBreakNode:kr,$createNodeSelection:fa,$createParagraphNode:dn,$createPoint:Pt,$createRangeSelection:ZN,$createRangeSelectionFromDom:tS,$createTabNode:xi,$createTextNode:Ze,$getAdjacentNode:Wc,$getCharacterOffsets:ua,$getEditor:iN,$getNearestNodeFromDOMNode:Po,$getNearestRootOrShadowRoot:Nd,$getNodeByKey:Qe,$getNodeByKeyOrThrow:tN,$getPreviousSelection:Pr,$getRoot:Tt,$getSelection:de,$getTextContent:sS,$hasAncestor:fi,$hasUpdateTag:XC,$insertNodes:oS,$isBlockElementNode:QN,$isDecoratorNode:xe,$isElementNode:k,$isInlineElementOrDecoratorNode:eN,$isLeafNode:uC,$isLineBreakNode:ir,$isNodeSelection:Vo,$isParagraphNode:ma,$isRangeSelection:ee,$isRootNode:pt,$isRootOrShadowRoot:vn,$isTabNode:Xd,$isTextNode:G,$isTokenOrSegmented:nr,$nodesOfType:VC,$normalizeSelection__EXPERIMENTAL:nd,$parseSerializedNode:dS,$selectAll:JC,$setCompositionKey:je,$setSelection:Gt,$splitNode:oN,ArtificialNode__DO_NOT_USE:Ch,BLUR_COMMAND:Kf,CAN_REDO_COMMAND:Fy,CAN_UNDO_COMMAND:By,CLEAR_EDITOR_COMMAND:Iy,CLEAR_HISTORY_COMMAND:Ly,CLICK_COMMAND:Tf,COMMAND_PRIORITY_CRITICAL:OS,COMMAND_PRIORITY_EDITOR:xS,COMMAND_PRIORITY_HIGH:bS,COMMAND_PRIORITY_LOW:ES,COMMAND_PRIORITY_NORMAL:wS,CONTROLLED_TEXT_INSERTION_COMMAND:wr,COPY_COMMAND:mc,CUT_COMMAND:yc,DELETE_CHARACTER_COMMAND:bo,DELETE_LINE_COMMAND:Mo,DELETE_WORD_COMMAND:vo,DRAGEND_COMMAND:Ff,DRAGOVER_COMMAND:Lf,DRAGSTART_COMMAND:If,DROP_COMMAND:Pf,DecoratorNode:pa,ElementNode:Xo,FOCUS_COMMAND:Bf,FORMAT_ELEMENT_COMMAND:Py,FORMAT_TEXT_COMMAND:En,INDENT_CONTENT_COMMAND:Ry,INSERT_LINE_BREAK_COMMAND:Oo,INSERT_PARAGRAPH_COMMAND:dc,INSERT_TAB_COMMAND:ky,IS_ALL_FORMATTING:Hf,IS_BOLD:Xs,IS_CODE:Qs,IS_HIGHLIGHT:ti,IS_ITALIC:qs,IS_STRIKETHROUGH:Ao,IS_SUBSCRIPT:Zs,IS_SUPERSCRIPT:ei,IS_UNDERLINE:ko,KEY_ARROW_DOWN_COMMAND:Mf,KEY_ARROW_LEFT_COMMAND:bf,KEY_ARROW_RIGHT_COMMAND:Ef,KEY_ARROW_UP_COMMAND:vf,KEY_BACKSPACE_COMMAND:Af,KEY_DELETE_COMMAND:Rf,KEY_DOWN_COMMAND:xf,KEY_ENTER_COMMAND:Js,KEY_ESCAPE_COMMAND:kf,KEY_MODIFIER_COMMAND:Wf,KEY_SPACE_COMMAND:Df,KEY_TAB_COMMAND:$f,LineBreakNode:Ar,MOVE_TO_END:wf,MOVE_TO_START:Of,OUTDENT_CONTENT_COMMAND:$y,PASTE_COMMAND:hc,ParagraphNode:lr,REDO_COMMAND:_c,REMOVE_TEXT_COMMAND:gc,RootNode:Lr,SELECTION_CHANGE_COMMAND:Ys,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:Ay,SELECT_ALL_COMMAND:Cc,TEXT_TYPE_TO_FORMAT:Vt,TabNode:$r,TextNode:Rr,UNDO_COMMAND:pc,createCommand:ne,createEditor:MS,getEditorPropertyFromDOMNode:$o,getNearestEditorFromDOMNode:Pc,isBlockDomNode:Hc,isCurrentlyReadOnlyMode:Ir,isHTMLAnchorElement:sN,isHTMLElement:hi,isInlineDomNode:Td,isLexicalEditor:si,isSelectionCapturedInDecoratorInput:$c,isSelectionWithinEditor:Ro,resetRandomKey:rC},Symbol.toStringTag,{value:"Module"}));function AS(n){return{}}const Ai={},kS={},Sh={},qo={},Qo={},ya={},Fr={},Ca={},Na={},Zo={},es={},$n={},Sa={},Ta={},Th={},xh={},Eh={},wh={},bh={},Oh={},vh={},ki={},Mh={},Dh={},Ah={},kh={},Rh={},RS={},$S={},PS={},$h={},IS={},Ph={},Ih={},Lh={},xa={},Ea={},wa={},LS={},FS={},BS={},KS={},Fh={},Bh={},Kh={},It=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,WS=It&&"documentMode"in document?document.documentMode:null,Lt=It&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Pn=It&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Ri=!(!It||!("InputEvent"in window)||WS)&&"getTargetRanges"in new window.InputEvent("input"),ba=It&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),$i=It&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,zS=It&&/Android/.test(navigator.userAgent),Wh=It&&/^(?=.*Chrome).*/i.test(navigator.userAgent),jS=It&&zS&&Wh,Oa=It&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Wh,ts=1,In=3,cr=0,zh=1,Br=2,US=0,HS=1,YS=2,JS=1,VS=2,ns=4,rs=8,GS=16,XS=32,qS=64,Pi=128,jh=112|(3|ns|rs)|Pi,va=1,Ma=2,Da=3,Aa=4,ka=5,Ra=6,Ii=ba||$i||Oa?" ":"​",hn=`
22
22
 
23
- `,qS=Pn?" ":Li,zh="֑-߿יִ-﷽ﹰ-ﻼ",Uh="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",QS=new RegExp("^[^"+Uh+"]*["+zh+"]"),ZS=new RegExp("^[^"+zh+"]*["+Uh+"]"),en={bold:1,code:16,highlight:Ii,italic:2,strikethrough:os,subscript:32,superscript:64,underline:rs},eT={directionless:1,unmergeable:2},jh={center:Ma,end:Ra,justify:Aa,left:va,right:Da,start:ka},tT={[Ma]:"center",[Ra]:"end",[Aa]:"justify",[va]:"left",[Da]:"right",[ka]:"start"},nT={normal:0,segmented:2,token:1},oT={[US]:"normal",[HS]:"segmented",[jS]:"token"};function rT(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var K=rT(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Fi(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[o]of t.matchAll(/\S+/g))e.push(o);return e}const sT=100;let $a=!1,Pa=0;function iT(n){Pa=n.timeStamp}function Ia(n,e,t){return e.__lexicalLineBreak===n||n[`__lexicalKey_${t._key}`]!==void 0}function lT(n,e,t){const o=nn(t._window);let r=null,s=null;o!==null&&o.anchorNode===n&&(r=o.anchorOffset,s=o.focusOffset);const i=n.nodeValue;i!==null&&za(e,i,r,s,!1)}function cT(n,e,t){if(te(n)){const o=n.anchor.getNode();if(o.is(t)&&n.format!==o.getFormat())return!1}return e.nodeType===In&&t.isAttached()}function Hh(n,e,t){$a=!0;const o=performance.now()-Pa>sT;try{wt(n,()=>{const r=ge()||function(u){return u.getEditorState().read(()=>{const h=ge();return h!==null?h.clone():null})}(n),s=new Map,i=n.getRootElement(),l=n._editorState,c=n._blockCursorElement;let a=!1,f="";for(let u=0;u<e.length;u++){const h=e[u],g=h.type,p=h.target;let _=ls(p,l);if(!(_===null&&p!==i||we(_))){if(g==="characterData")o&&q(_)&&cT(r,p,_)&&lT(p,_,n);else if(g==="childList"){a=!0;const y=h.addedNodes;for(let N=0;N<y.length;N++){const S=y[N],T=tg(S),b=S.parentNode;if(b!=null&&S!==c&&T===null&&(S.nodeName!=="BR"||!Ia(S,b,n))){if(Pn){const x=S.innerText||S.nodeValue;x&&(f+=x)}b.removeChild(S)}}const m=h.removedNodes,C=m.length;if(C>0){let N=0;for(let S=0;S<C;S++){const T=m[S];(T.nodeName==="BR"&&Ia(T,p,n)||c===T)&&(p.appendChild(T),N++)}C!==N&&(p===i&&(_=rg(l)),s.set(p,_))}}}}if(s.size>0)for(const[u,h]of s)if($(h)){const g=h.getChildrenKeys();let p=u.firstChild;for(let _=0;_<g.length;_++){const y=g[_],m=n.getElementByKey(y);m!==null&&(p==null?(u.appendChild(m),p=m):p!==m&&u.replaceChild(m,p),p=p.nextSibling)}}else q(h)&&h.markDirty();const d=t.takeRecords();if(d.length>0){for(let u=0;u<d.length;u++){const h=d[u],g=h.addedNodes,p=h.target;for(let _=0;_<g.length;_++){const y=g[_],m=y.parentNode;m==null||y.nodeName!=="BR"||Ia(y,p,n)||m.removeChild(y)}}t.takeRecords()}r!==null&&(a&&(r.dirty=!0,tn(r)),Pn&&gg(n)&&r.insertRawText(f))})}finally{$a=!1}}function Yh(n){const e=n._observer;e!==null&&Hh(n,e.takeRecords(),e)}function Jh(n){(function(e){Pa===0&&Yi(e).addEventListener("textInput",iT,!0)})(n),n._observer=new MutationObserver((e,t)=>{Hh(n,e,t)})}function Vh(n,e){const t=n.__mode,o=n.__format,r=n.__style,s=e.__mode,i=e.__format,l=e.__style;return!(t!==null&&t!==s||o!==null&&o!==i||r!==null&&r!==l)}function Gh(n,e){const t=n.mergeWithSibling(e),o=Ee()._normalizedNodes;return o.add(n.__key),o.add(e.__key),t}function Xh(n){let e,t,o=n;if(o.__text!==""||!o.isSimpleText()||o.isUnmergeable()){for(;(e=o.getPreviousSibling())!==null&&q(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Vh(e,o)){o=Gh(e,o);break}break}e.remove()}for(;(t=o.getNextSibling())!==null&&q(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Vh(o,t)){o=Gh(o,t);break}break}t.remove()}}else o.remove()}function qh(n){return Qh(n.anchor),Qh(n.focus),n}function Qh(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let o,r;if(t===e.getChildrenSize()?(o=e.getChildAtIndex(t-1),r=!0):(o=e.getChildAtIndex(t),r=!1),q(o)){n.set(o.__key,r?o.getTextContentSize():0,"text");break}if(!$(o))break;n.set(o.__key,r?o.getChildrenSize():0,"element")}}let Zh=1;function aT(){Zh=1}const uT=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function La(n){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return we(ls(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&is(e)==null)}function ss(n,e,t){const o=n.getRootElement();try{return o!==null&&o.contains(e)&&o.contains(t)&&e!==null&&!La(e)&&Fa(e)===n}catch{return!1}}function Bi(n){return n instanceof ul}function Fa(n){let e=n;for(;e!=null;){const t=is(e);if(Bi(t))return t;e=ji(e)}return null}function is(n){return n?n.__lexicalEditor:null}function ao(n){return n.isToken()||n.isSegmented()}function fT(n){return n.nodeType===In}function Ki(n){let e=n;for(;e!=null;){if(fT(e))return e;e=e.firstChild}return null}function Ba(n,e,t){const o=en[e];if(t!==null&&(n&o)==(t&o))return n;let r=n^o;return e==="subscript"?r&=~en.superscript:e==="superscript"&&(r&=~en.subscript),r}function dT(n){return q(n)||go(n)||we(n)}function eg(n,e){if(e!=null)return void(n.__key=e);dt(),op();const t=Ee(),o=rn(),r=""+Zh++;o._nodeMap.set(r,n),$(n)?t._dirtyElements.set(r,!0):t._dirtyLeaves.add(r),t._cloneNotNeeded.add(r),t._dirtyType=Kh,n.__key=r}function uo(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),o=e.getWritable(),r=n.getPreviousSibling(),s=n.getNextSibling();if(r===null)if(s!==null){const i=s.getWritable();o.__first=s.__key,i.__prev=null}else o.__first=null;else{const i=r.getWritable();if(s!==null){const l=s.getWritable();l.__prev=i.__key,i.__next=l.__key}else i.__next=null;t.__prev=null}if(s===null)if(r!==null){const i=r.getWritable();o.__last=r.__key,i.__next=null}else o.__last=null;else{const i=s.getWritable();if(r!==null){const l=r.getWritable();l.__next=i.__key,i.__prev=l.__key}else i.__prev=null;t.__next=null}o.__size--,t.__parent=null}}function Wi(n){op();const e=n.getLatest(),t=e.__parent,o=rn(),r=Ee(),s=o._nodeMap,i=r._dirtyElements;t!==null&&function(c,a,f){let d=c;for(;d!==null;){if(f.has(d))return;const u=a.get(d);if(u===void 0)break;f.set(d,!1),d=u.__parent}}(t,s,i);const l=e.__key;r._dirtyType=Kh,$(n)?i.set(l,!0):r._dirtyLeaves.add(l)}function He(n){dt();const e=Ee(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const o=et(t);o!==null&&o.getWritable()}if(n!==null){const o=et(n);o!==null&&o.getWritable()}}}function Ln(){return Vo()?null:Ee()._compositionKey}function et(n,e){const t=(e||rn())._nodeMap.get(n);return t===void 0?null:t}function tg(n,e){const t=n[`__lexicalKey_${Ee()._key}`];return t!==void 0?et(t,e):null}function ls(n,e){let t=n;for(;t!=null;){const o=tg(t,e);if(o!==null)return o;t=ji(t)}return null}function ng(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function og(n){return n.read(()=>Et().getTextContent())}function Et(){return rg(rn())}function rg(n){return n._nodeMap.get("root")}function tn(n){dt();const e=rn();n!==null&&(n.dirty=!0,n.setCachedNodes(null)),e._selection=n}function Ko(n){const e=Ee(),t=function(o,r){let s=o;for(;s!=null;){const i=s[`__lexicalKey_${r._key}`];if(i!==void 0)return i;s=ji(s)}return null}(n,e);return t===null?n===e.getRootElement()?et("root"):null:et(t)}function sg(n,e){return e?n.getTextContentSize():0}function ig(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function Ka(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function lg(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function cg(n){return n.nodeType===In?n.nodeValue:null}function Wa(n,e,t){const o=nn(e._window);if(o===null)return;const r=o.anchorNode;let{anchorOffset:s,focusOffset:i}=o;if(r!==null){let l=cg(r);const c=ls(r);if(l!==null&&q(c)){if(l===Li&&t){const a=t.length;l=t,s=a,i=a}l!==null&&za(c,l,s,i,n)}}}function za(n,e,t,o,r){let s=n;if(s.isAttached()&&(r||!s.isDirty())){const i=s.isComposing();let l=e;(i||r)&&e[e.length-1]===Li&&(l=e.slice(0,-1));const c=s.getTextContent();if(r||l!==c){if(l===""){if(He(null),ba||Pi||Oa)s.remove();else{const p=Ee();setTimeout(()=>{p.update(()=>{s.isAttached()&&s.remove()})},20)}return}const a=s.getParent(),f=Jo(),d=s.getTextContentSize(),u=Ln(),h=s.getKey();if(s.isToken()||u!==null&&h===u&&!i||te(f)&&(a!==null&&!a.canInsertTextBefore()&&f.anchor.offset===0||f.anchor.key===n.__key&&f.anchor.offset===0&&!s.canInsertTextBefore()&&!i||f.focus.key===n.__key&&f.focus.offset===d&&!s.canInsertTextAfter()&&!i))return void s.markDirty();const g=ge();if(!te(g)||t===null||o===null)return void s.setTextContent(l);if(g.setTextNodeRange(s,t,s,o),s.isSegmented()){const p=tt(s.getTextContent());s.replace(p),s=p}s.setTextContent(l)}}}function hT(n,e){if(e.isSegmented())return!0;if(!n.isCollapsed())return!1;const t=n.anchor.offset,o=e.getParentOrThrow(),r=e.isToken();return t===0?!e.canInsertTextBefore()||!o.canInsertTextBefore()&&!e.isComposing()||r||function(s){const i=s.getPreviousSibling();return(q(i)||$(i)&&i.isInline())&&!i.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!o.canInsertTextAfter()&&!e.isComposing()||r)}function ag(n){return n==="ArrowLeft"}function ug(n){return n==="ArrowRight"}function cs(n,e){return Ft?n:e}function fg(n){return n==="Enter"}function as(n){return n==="Backspace"}function us(n){return n==="Delete"}function dg(n,e,t){return n.toLowerCase()==="a"&&cs(e,t)}function gT(){const n=Et();tn(qh(n.select(0,n.getChildrenSize())))}function fs(n,e){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const t=n.__lexicalClassNameCache,o=t[e];if(o!==void 0)return o;const r=n[e];if(typeof r=="string"){const s=Fi(r);return t[e]=s,s}return r}function Ua(n,e,t,o,r){if(t.size===0)return;const s=o.__type,i=o.__key,l=e.get(s);l===void 0&&K(33,s);const c=l.klass;let a=n.get(c);a===void 0&&(a=new Map,n.set(c,a));const f=a.get(i),d=f==="destroyed"&&r==="created";(f===void 0||d)&&a.set(i,d?"updated":r)}function pT(n){const e=n.getType(),t=rn();if(t._readOnly){const s=Cg(t).get(e);return s?Array.from(s.values()):[]}const o=t._nodeMap,r=[];for(const[,s]of o)s instanceof n&&s.__type===e&&s.isAttached()&&r.push(s);return r}function hg(n,e,t){const o=n.getParent();let r=t,s=n;return o!==null&&(e&&t===0?(r=s.getIndexWithinParent(),s=o):e||t!==s.getChildrenSize()||(r=s.getIndexWithinParent()+1,s=o)),s.getChildAtIndex(e?r-1:r)}function ja(n,e){const t=n.offset;if(n.type==="element")return hg(n.getNode(),e,t);{const o=n.getNode();if(e&&t===0||!e&&t===o.getTextContentSize()){const r=e?o.getPreviousSibling():o.getNextSibling();return r===null?hg(o.getParentOrThrow(),e,o.getIndexWithinParent()+(e?0:1)):r}}return null}function gg(n){const e=Yi(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function H(n,e,t){return cp(n,e,t)}function zi(n){return!mt(n)&&!n.isLastChild()&&!n.isInline()}function Ui(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&K(75,e),t}function ji(n){const e=n.assignedSlot||n.parentElement;return e!==null&&e.nodeType===11?e.host:e}function _T(n){return Ee()._updateTags.has(n)}function mT(n){dt(),Ee()._updateTags.add(n)}function Hi(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Yi(n){const e=n._window;return e===null&&K(78),e}function yT(n){return $(n)&&n.isInline()||we(n)&&n.isInline()}function pg(n){let e=n.getParentOrThrow();for(;e!==null;){if(Fn(e))return e;e=e.getParentOrThrow()}return e}function Fn(n){return mt(n)||$(n)&&n.isShadowRoot()}function _g(n){const e=n.constructor.clone(n);return eg(e,null),e}function ds(n){const e=Ee(),t=n.constructor.getType(),o=e._nodes.get(t);o===void 0&&K(97);const r=o.replace;if(r!==null){const s=r(n);return s instanceof n.constructor||K(98),s}return n}function Ha(n,e){!mt(n.getParent())||$(e)||we(e)||K(99)}function CT(n){const e=et(n);return e===null&&K(63,n),e}function Ya(n){return(we(n)||$(n)&&!n.canBeEmpty())&&!n.isInline()}function Ja(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const o=n.parentElement;o!==null&&o.removeChild(n)}function NT(n,e,t){let o=n._blockCursorElement;if(te(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const r=t.anchor,s=r.getNode(),i=r.offset;let l=!1,c=null;if(i===s.getChildrenSize())Ya(s.getChildAtIndex(i-1))&&(l=!0);else{const a=s.getChildAtIndex(i);if(Ya(a)){const f=a.getPreviousSibling();(f===null||Ya(f))&&(l=!0,c=n.getElementByKey(a.__key))}}if(l){const a=n.getElementByKey(s.__key);return o===null&&(n._blockCursorElement=o=function(f){const d=f.theme,u=document.createElement("div");u.contentEditable="false",u.setAttribute("data-lexical-cursor","true");let h=d.blockCursor;if(h!==void 0){if(typeof h=="string"){const g=Fi(h);h=d.blockCursor=g}h!==void 0&&u.classList.add(...h)}return u}(n._config)),e.style.caretColor="transparent",void(c===null?a.appendChild(o):a.insertBefore(o,c))}}o!==null&&Ja(o,n,e)}function nn(n){return Lt?(n||window).getSelection():null}function ST(n,e){let t=n.getChildAtIndex(e);t==null&&(t=n),Fn(n)&&K(102);const o=i=>{const l=i.getParentOrThrow(),c=Fn(l),a=i!==t||c?_g(i):i;if(c)return $(i)&&$(a)||K(133),i.insertAfter(a),[i,a,a];{const[f,d,u]=o(l),h=i.getNextSiblings();return u.append(a,...h),[f,d,a]}},[r,s]=o(t);return[r,s]}function TT(n){return Ji(n)&&n.tagName==="A"}function Ji(n){return n.nodeType===1}function mg(n){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return n.nodeName.match(e)!==null}function Va(n){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return n.nodeName.match(e)!==null}function Wo(n){if(mt(n)||we(n)&&!n.isInline())return!0;if(!$(n)||Fn(n))return!1;const e=n.getFirstChild(),t=e===null||go(e)||q(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function Ga(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function xT(){return Ee()}const yg=new WeakMap,ET=new Map;function Cg(n){if(!n._readOnly&&n.isEmpty())return ET;n._readOnly||K(192);let e=yg.get(n);if(!e){e=new Map,yg.set(n,e);for(const[t,o]of n._nodeMap){const r=o.__type;let s=e.get(r);s||(s=new Map,e.set(r,s)),s.set(t,o)}}return e}function Ng(n){const e=n.constructor.clone(n);return e.afterCloneFrom(n),e}function Sg(n,e,t,o,r,s){let i=n.getFirstChild();for(;i!==null;){const l=i.__key;i.__parent===e&&($(i)&&Sg(i,l,t,o,r,s),t.has(l)||s.delete(l),r.push(l)),i=i.getNextSibling()}}let Bn,ut,hs,Vi,Xa,qa,fo,Bt,Qa,gs,Ke="",ft="",on=null,Kt="",pn="",Tg=!1,ps=!1,Gi=null;function Xi(n,e){const t=fo.get(n);if(e!==null){const o=nu(n);o.parentNode===e&&e.removeChild(o)}if(Bt.has(n)||ut._keyToDOMMap.delete(n),$(t)){const o=Qi(t,fo);Za(o,0,o.length-1,null)}t!==void 0&&Ua(gs,hs,Vi,t,"destroyed")}function Za(n,e,t,o){let r=e;for(;r<=t;++r){const s=n[r];s!==void 0&&Xi(s,o)}}function ho(n,e){n.setProperty("text-align",e)}const wT="40px";function xg(n,e){const t=Bn.theme.indent;if(typeof t=="string"){const r=n.classList.contains(t);e>0&&!r?n.classList.add(t):e<1&&r&&n.classList.remove(t)}const o=getComputedStyle(n).getPropertyValue("--lexical-indent-base-value")||wT;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${o})`)}function Eg(n,e){const t=n.style;e===0?ho(t,""):e===va?ho(t,"left"):e===Ma?ho(t,"center"):e===Da?ho(t,"right"):e===Aa?ho(t,"justify"):e===ka?ho(t,"start"):e===Ra&&ho(t,"end")}function qi(n,e,t){const o=Bt.get(n);o===void 0&&K(60);const r=o.createDOM(Bn,ut);if(function(s,i,l){const c=l._keyToDOMMap;i["__lexicalKey_"+l._key]=s,c.set(s,i)}(n,r,ut),q(o)?r.setAttribute("data-lexical-text","true"):we(o)&&r.setAttribute("data-lexical-decorator","true"),$(o)){const s=o.__indent,i=o.__size;if(s!==0&&xg(r,s),i!==0){const c=i-1;(function(a,f,d,u){const h=ft;ft="",eu(a,d,0,f,u,null),Og(d,u),ft=h})(Qi(o,Bt),c,o,r)}const l=o.__format;l!==0&&Eg(r,l),o.isInline()||bg(null,o,r),zi(o)&&(Ke+=gn,pn+=gn)}else{const s=o.getTextContent();if(we(o)){const i=o.decorate(ut,Bn);i!==null&&vg(n,i),r.contentEditable="false"}else q(o)&&(o.isDirectionless()||(ft+=s));Ke+=s,pn+=s}if(e!==null)if(t!=null)e.insertBefore(r,t);else{const s=e.__lexicalLineBreak;s!=null?e.insertBefore(r,s):e.appendChild(r)}return Ua(gs,hs,Vi,o,"created"),r}function eu(n,e,t,o,r,s){const i=Ke;Ke="";let l=t;for(;l<=o;++l){qi(n[l],r,s);const c=Bt.get(n[l]);c!==null&&q(c)&&(on===null&&(on=c.getFormat()),Kt===""&&(Kt=c.getStyle()))}zi(e)&&(Ke+=gn),r.__lexicalTextContent=Ke,Ke=i+Ke}function wg(n,e){const t=e.get(n);return go(t)||we(t)&&t.isInline()}function bg(n,e,t){const o=n!==null&&(n.__size===0||wg(n.__last,fo)),r=e.__size===0||wg(e.__last,Bt);if(o){if(!r){const s=t.__lexicalLineBreak;if(s!=null)try{t.removeChild(s)}catch(i){if(typeof i=="object"&&i!=null){const l=`${i.toString()} Parent: ${t.tagName}, child: ${s.tagName}.`;throw new Error(l)}throw i}t.__lexicalLineBreak=null}}else if(r){const s=document.createElement("br");t.__lexicalLineBreak=s,t.appendChild(s)}}function Og(n,e){const t=e.__lexicalDirTextContent,o=e.__lexicalDir;if(t!==ft||o!==Gi){const s=ft==="",i=s?Gi:(r=ft,QS.test(r)?"rtl":ZS.test(r)?"ltr":null);if(i!==o){const l=e.classList,c=Bn.theme;let a=o!==null?c[o]:void 0,f=i!==null?c[i]:void 0;if(a!==void 0){if(typeof a=="string"){const d=Fi(a);a=c[o]=d}l.remove(...a)}if(i===null||s&&i==="ltr")e.removeAttribute("dir");else{if(f!==void 0){if(typeof f=="string"){const d=Fi(f);f=c[i]=d}f!==void 0&&l.add(...f)}e.dir=i}ps||(n.getWritable().__dir=i)}Gi=i,e.__lexicalDirTextContent=ft,e.__lexicalDir=i}var r}function bT(n,e,t){const o=ft;var r;ft="",on=null,Kt="",function(s,i,l){const c=Ke,a=s.__size,f=i.__size;if(Ke="",a===1&&f===1){const d=s.__first,u=i.__first;if(d===u)_s(d,l);else{const g=nu(d),p=qi(u,null,null);try{l.replaceChild(p,g)}catch(_){if(typeof _=="object"&&_!=null){const y=`${_.toString()} Parent: ${l.tagName}, new child: {tag: ${p.tagName} key: ${u}}, old child: {tag: ${g.tagName}, key: ${d}}.`;throw new Error(y)}throw _}Xi(d,null)}const h=Bt.get(u);q(h)&&(on===null&&(on=h.getFormat()),Kt===""&&(Kt=h.getStyle()))}else{const d=Qi(s,fo),u=Qi(i,Bt);if(a===0)f!==0&&eu(u,i,0,f-1,l,null);else if(f===0){if(a!==0){const h=l.__lexicalLineBreak==null;Za(d,0,a-1,h?null:l),h&&(l.textContent="")}}else(function(h,g,p,_,y,m){const C=_-1,N=y-1;let S,T,b=(O=m,O.firstChild),x=0,w=0;for(var O;x<=C&&w<=N;){const Y=g[x],J=p[w];if(Y===J)b=tu(_s(J,m)),x++,w++;else{S===void 0&&(S=new Set(g)),T===void 0&&(T=new Set(p));const re=T.has(Y),F=S.has(J);if(re)if(F){const ce=Ui(ut,J);ce===b?b=tu(_s(J,m)):(b!=null?m.insertBefore(ce,b):m.appendChild(ce),_s(J,m)),x++,w++}else qi(J,m,b),w++;else b=tu(nu(Y)),Xi(Y,m),x++}const V=Bt.get(J);V!==null&&q(V)&&(on===null&&(on=V.getFormat()),Kt===""&&(Kt=V.getStyle()))}const D=x>C,B=w>N;if(D&&!B){const Y=p[N+1];eu(p,h,w,N,m,Y===void 0?null:ut.getElementByKey(Y))}else B&&!D&&Za(g,x,C,m)})(i,d,u,a,f,l)}zi(i)&&(Ke+=gn),l.__lexicalTextContent=Ke,Ke=c+Ke}(n,e,t),Og(e,t),Cu(r=e)&&on!=null&&on!==r.__textFormat&&!ps&&(r.setTextFormat(on),r.setTextStyle(Kt)),function(s){Cu(s)&&Kt!==""&&Kt!==s.__textStyle&&!ps&&s.setTextStyle(Kt)}(e),ft=o}function Qi(n,e){const t=[];let o=n.__first;for(;o!==null;){const r=e.get(o);r===void 0&&K(101),t.push(o),o=r.__next}return t}function _s(n,e){const t=fo.get(n);let o=Bt.get(n);t!==void 0&&o!==void 0||K(61);const r=Tg||qa.has(n)||Xa.has(n),s=Ui(ut,n);if(t===o&&!r){if($(t)){const i=s.__lexicalTextContent;i!==void 0&&(Ke+=i,pn+=i);const l=s.__lexicalDirTextContent;l!==void 0&&(ft+=l)}else{const i=t.getTextContent();q(t)&&!t.isDirectionless()&&(ft+=i),pn+=i,Ke+=i}return s}if(t!==o&&r&&Ua(gs,hs,Vi,o,"updated"),o.updateDOM(t,s,Bn)){const i=qi(n,null,null);return e===null&&K(62),e.replaceChild(i,s),Xi(n,null),i}if($(t)&&$(o)){const i=o.__indent;i!==t.__indent&&xg(s,i);const l=o.__format;l!==t.__format&&Eg(s,l),r&&(bT(t,o,s),mt(o)||o.isInline()||bg(t,o,s)),zi(o)&&(Ke+=gn,pn+=gn)}else{const i=o.getTextContent();if(we(o)){const l=o.decorate(ut,Bn);l!==null&&vg(n,l)}else q(o)&&!o.isDirectionless()&&(ft+=i);Ke+=i,pn+=i}if(!ps&&mt(o)&&o.__cachedText!==pn){const i=o.getWritable();i.__cachedText=pn,o=i}return s}function vg(n,e){let t=ut._pendingDecorators;const o=ut._decorators;if(t===null){if(o[n]===e)return;t=ng(ut)}t[n]=e}function tu(n){let e=n.nextSibling;return e!==null&&e===ut._blockCursorElement&&(e=e.nextSibling),e}function OT(n,e,t,o,r,s){Ke="",pn="",ft="",Tg=o===Bo,Gi=null,ut=t,Bn=t._config,hs=t._nodes,Vi=ut._listeners.mutation,Xa=r,qa=s,fo=n._nodeMap,Bt=e._nodeMap,ps=e._readOnly,Qa=new Map(t._keyToDOMMap);const i=new Map;return gs=i,_s("root",null),ut=void 0,hs=void 0,Xa=void 0,qa=void 0,fo=void 0,Bt=void 0,Bn=void 0,Qa=void 0,gs=void 0,i}function nu(n){const e=Qa.get(n);return e===void 0&&K(75,n),e}const _n=Object.freeze({}),ou=30,ru=[["keydown",function(n,e){if(ms=n.timeStamp,Mg=n.key,e.isComposing())return;const{key:t,shiftKey:o,ctrlKey:r,metaKey:s,altKey:i}=n;H(e,Nh,n)||t!=null&&(function(l,c,a,f){return ug(l)&&!c&&!f&&!a}(t,r,i,s)?H(e,Sh,n):function(l,c,a,f,d){return ug(l)&&!f&&!a&&(c||d)}(t,r,o,i,s)?H(e,Th,n):function(l,c,a,f){return ag(l)&&!c&&!f&&!a}(t,r,i,s)?H(e,xh,n):function(l,c,a,f,d){return ag(l)&&!f&&!a&&(c||d)}(t,r,o,i,s)?H(e,Eh,n):function(l,c,a){return function(f){return f==="ArrowUp"}(l)&&!c&&!a}(t,r,s)?H(e,wh,n):function(l,c,a){return function(f){return f==="ArrowDown"}(l)&&!c&&!a}(t,r,s)?H(e,bh,n):function(l,c){return fg(l)&&c}(t,o)?(ys=!0,H(e,Ri,n)):function(l){return l===" "}(t)?H(e,Oh,n):function(l,c){return Ft&&c&&l.toLowerCase()==="o"}(t,r)?(n.preventDefault(),ys=!0,H(e,Zr,!0)):function(l,c){return fg(l)&&!c}(t,o)?(ys=!1,H(e,Ri,n)):function(l,c,a,f){return Ft?!c&&!a&&(as(l)||l.toLowerCase()==="h"&&f):!(f||c||a)&&as(l)}(t,i,s,r)?as(t)?H(e,vh,n):(n.preventDefault(),H(e,Qr,!0)):function(l){return l==="Escape"}(t)?H(e,Mh,n):function(l,c,a,f,d){return Ft?!(a||f||d)&&(us(l)||l.toLowerCase()==="d"&&c):!(c||f||d)&&us(l)}(t,r,o,i,s)?us(t)?H(e,Dh,n):(n.preventDefault(),H(e,Qr,!1)):function(l,c,a){return as(l)&&(Ft?c:a)}(t,i,r)?(n.preventDefault(),H(e,es,!0)):function(l,c,a){return us(l)&&(Ft?c:a)}(t,i,r)?(n.preventDefault(),H(e,es,!1)):function(l,c){return Ft&&c&&as(l)}(t,s)?(n.preventDefault(),H(e,ts,!0)):function(l,c){return Ft&&c&&us(l)}(t,s)?(n.preventDefault(),H(e,ts,!1)):function(l,c,a,f){return l.toLowerCase()==="b"&&!c&&cs(a,f)}(t,i,s,r)?(n.preventDefault(),H(e,$n,"bold")):function(l,c,a,f){return l.toLowerCase()==="u"&&!c&&cs(a,f)}(t,i,s,r)?(n.preventDefault(),H(e,$n,"underline")):function(l,c,a,f){return l.toLowerCase()==="i"&&!c&&cs(a,f)}(t,i,s,r)?(n.preventDefault(),H(e,$n,"italic")):function(l,c,a,f){return l==="Tab"&&!c&&!a&&!f}(t,i,r,s)?H(e,Ah,n):function(l,c,a,f){return l.toLowerCase()==="z"&&!c&&cs(a,f)}(t,o,s,r)?(n.preventDefault(),H(e,Sa,void 0)):function(l,c,a,f){return Ft?l.toLowerCase()==="z"&&a&&c:l.toLowerCase()==="y"&&f||l.toLowerCase()==="z"&&f&&c}(t,o,s,r)?(n.preventDefault(),H(e,Ta,void 0)):Ns(e._editorState._selection)?function(l,c,a,f){return!c&&l.toLowerCase()==="c"&&(Ft?a:f)}(t,o,s,r)?(n.preventDefault(),H(e,xa,n)):function(l,c,a,f){return!c&&l.toLowerCase()==="x"&&(Ft?a:f)}(t,o,s,r)?(n.preventDefault(),H(e,Ea,n)):dg(t,s,r)&&(n.preventDefault(),H(e,wa,n)):!Pn&&dg(t,s,r)&&(n.preventDefault(),H(e,wa,n)),function(l,c,a,f){return l||c||a||f}(r,o,i,s)&&H(e,Fh,n))}],["pointerdown",function(n,e){const t=n.target,o=n.pointerType;t instanceof Node&&o!=="touch"&&wt(e,()=>{we(ls(t))||(iu=!0)})}],["compositionstart",function(n,e){wt(e,()=>{const t=ge();if(te(t)&&!e.isComposing()){const o=t.anchor,r=t.anchor.getNode();He(o.key),(n.timeStamp<ms+ou||o.type==="element"||!t.isCollapsed()||r.getFormat()!==t.format||q(r)&&r.getStyle()!==t.style)&&H(e,Fo,qS)}})}],["compositionend",function(n,e){Pn?Cs=!0:wt(e,()=>{lu(e,n.data)})}],["input",function(n,e){n.stopPropagation(),wt(e,()=>{const t=ge(),o=n.data,r=Pg(n);if(o!=null&&te(t)&&kg(t,r,o,n.timeStamp,!1)){Cs&&(lu(e,o),Cs=!1);const s=t.anchor.getNode(),i=nn(e._window);if(i===null)return;const l=t.isBackward(),c=l?t.anchor.offset:t.focus.offset,a=l?t.focus.offset:t.anchor.offset;$i&&!t.isCollapsed()&&q(s)&&i.anchorNode!==null&&s.getTextContent().slice(0,c)+o+s.getTextContent().slice(c+a)===cg(i.anchorNode)||H(e,Fo,o);const f=o.length;Pn&&f>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=f),ba||Pi||Oa||!e.isComposing()||(ms=0,He(null))}else Wa(!1,e,o!==null?o:void 0),Cs&&(lu(e,o||void 0),Cs=!1);dt(),Yh(Ee())}),zo=null}],["click",function(n,e){wt(e,()=>{const t=ge(),o=nn(e._window),r=Jo();if(o){if(te(t)){const s=t.anchor,i=s.getNode();s.type==="element"&&s.offset===0&&t.isCollapsed()&&!mt(i)&&Et().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&r!==null&&t.is(r)?(o.removeAllRanges(),t.dirty=!0):n.detail===3&&!t.isCollapsed()&&i!==t.focus.getNode()&&($(i)?i.select(0):i.getParentOrThrow().select(0))}else if(n.pointerType==="touch"){const s=o.anchorNode;if(s!==null){const i=s.nodeType;(i===ns||i===In)&&tn(sl(r,o,e,n))}}}H(e,Ch,n)})}],["cut",_n],["copy",_n],["dragstart",_n],["dragover",_n],["dragend",_n],["paste",_n],["focus",_n],["blur",_n],["drop",_n]];$i&&ru.push(["beforeinput",(n,e)=>function(t,o){const r=t.inputType,s=Pg(t);r==="deleteCompositionText"||Pn&&gg(o)||r!=="insertCompositionText"&&wt(o,()=>{const i=ge();if(r==="deleteContentBackward"){if(i===null){const h=Jo();if(!te(h))return;tn(h.clone())}if(te(i)){const h=i.anchor.key===i.focus.key;if(l=t.timeStamp,Mg==="MediaLast"&&l<ms+ou&&o.isComposing()&&h){if(He(null),ms=0,setTimeout(()=>{wt(o,()=>{He(null)})},ou),te(i)){const g=i.anchor.getNode();g.markDirty(),i.format=g.getFormat(),q(g)||K(142),i.style=g.getStyle()}}else{He(null),t.preventDefault();const g=i.anchor.getNode().getTextContent(),p=i.anchor.offset===0&&i.focus.offset===g.length;zS&&h&&!p||H(o,Qr,!0)}return}}var l;if(!te(i))return;const c=t.data;zo!==null&&Wa(!1,o,zo),i.dirty&&zo===null||!i.isCollapsed()||mt(i.anchor.getNode())||s===null||i.applyDOMRange(s),zo=null;const a=i.anchor,f=i.focus,d=a.getNode(),u=f.getNode();if(r!=="insertText"&&r!=="insertTranspose")switch(t.preventDefault(),r){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":H(o,Fo,t);break;case"insertFromComposition":He(null),H(o,Fo,t);break;case"insertLineBreak":He(null),H(o,Zr,!1);break;case"insertParagraph":He(null),ys&&!Pi?(ys=!1,H(o,Zr,!1)):H(o,ya,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":H(o,Ca,t);break;case"deleteByComposition":(function(h,g){return h!==g||$(h)||$(g)||!h.isToken()||!g.isToken()})(d,u)&&H(o,Na,t);break;case"deleteByDrag":case"deleteByCut":H(o,Na,t);break;case"deleteContent":H(o,Qr,!1);break;case"deleteWordBackward":H(o,es,!0);break;case"deleteWordForward":H(o,es,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":H(o,ts,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":H(o,ts,!1);break;case"formatStrikeThrough":H(o,$n,"strikethrough");break;case"formatBold":H(o,$n,"bold");break;case"formatItalic":H(o,$n,"italic");break;case"formatUnderline":H(o,$n,"underline");break;case"historyUndo":H(o,Sa,void 0);break;case"historyRedo":H(o,Ta,void 0)}else{if(c===`
24
- `)t.preventDefault(),H(o,Zr,!1);else if(c===gn)t.preventDefault(),H(o,ya,void 0);else if(c==null&&t.dataTransfer){const h=t.dataTransfer.getData("text/plain");t.preventDefault(),i.insertRawText(h)}else c!=null&&kg(i,s,c,t.timeStamp,!0)?(t.preventDefault(),H(o,Fo,c)):zo=c;Dg=t.timeStamp}})}(n,e)]);let ms=0,Mg=null,Dg=0,zo=null;const Zi=new WeakMap;let su=!1,iu=!1,ys=!1,Cs=!1,Ag=[0,"",0,"root",0];function kg(n,e,t,o,r){const s=n.anchor,i=n.focus,l=s.getNode(),c=Ee(),a=nn(c._window),f=a!==null?a.anchorNode:null,d=s.key,u=c.getElementByKey(d),h=t.length;return d!==i.key||!q(l)||(!r&&(!$i||Dg<o+50)||l.isDirty()&&h<2||ig(t))&&s.offset!==i.offset&&!l.isComposing()||ao(l)||l.isDirty()&&h>1||(r||!$i)&&u!==null&&!l.isComposing()&&f!==Ki(u)||a!==null&&e!==null&&(!e.collapsed||e.startContainer!==a.anchorNode||e.startOffset!==a.anchorOffset)||l.getFormat()!==n.format||l.getStyle()!==n.style||hT(n,l)}function Rg(n,e){return n!==null&&n.nodeValue!==null&&n.nodeType===In&&e!==0&&e!==n.nodeValue.length}function $g(n,e,t){const{anchorNode:o,anchorOffset:r,focusNode:s,focusOffset:i}=n;su&&(su=!1,Rg(o,r)&&Rg(s,i))||wt(e,()=>{if(!t)return void tn(null);if(!ss(e,o,s))return;const l=ge();if(te(l)){const c=l.anchor,a=c.getNode();if(l.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(l.dirty=!0);const f=Yi(e).event,d=f?f.timeStamp:performance.now(),[u,h,g,p,_]=Ag,y=Et(),m=e.isComposing()===!1&&y.getTextContent()==="";if(d<_+200&&c.offset===g&&c.key===p)l.format=u,l.style=h;else if(c.type==="text")q(a)||K(141),l.format=a.getFormat(),l.style=a.getStyle();else if(c.type==="element"&&!m){const C=c.getNode();l.style="",C instanceof _o&&C.getChildrenSize()===0?(l.format=C.getTextFormat(),l.style=C.getTextStyle()):l.format=0}}else{const f=c.key,d=l.focus.key,u=l.getNodes(),h=u.length,g=l.isBackward(),p=g?i:r,_=g?r:i,y=g?d:f,m=g?f:d;let C=Wh,N=!1;for(let S=0;S<h;S++){const T=u[S],b=T.getTextContentSize();if(q(T)&&b!==0&&!(S===0&&T.__key===y&&p===b||S===h-1&&T.__key===m&&_===0)&&(N=!0,C&=T.getFormat(),C===0))break}l.format=N?C:0}}H(e,ki,void 0)})}function Pg(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function lu(n,e){const t=n._compositionKey;if(He(null),t!==null&&e!=null){if(e===""){const o=et(t),r=Ki(n.getElementByKey(t));return void(r!==null&&r.nodeValue!==null&&q(o)&&za(o,r.nodeValue,null,null,!0))}if(e[e.length-1]===`
25
- `){const o=ge();if(te(o)){const r=o.focus;return o.anchor.set(r.key,r.offset,r.type),void H(n,Ri,null)}}}Wa(!0,n,e)}function Ig(n){let e=n.__lexicalEventHandles;return e===void 0&&(e=[],n.__lexicalEventHandles=e),e}const Uo=new Map;function Lg(n){const e=n.target,t=nn(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const o=Fa(t.anchorNode);if(o===null)return;iu&&(iu=!1,wt(o,()=>{const a=Jo(),f=t.anchorNode;if(f===null)return;const d=f.nodeType;d!==ns&&d!==In||tn(sl(a,t,o,n))}));const r=Ka(o),s=r[r.length-1],i=s._key,l=Uo.get(i),c=l||s;c!==o&&$g(t,c,!1),$g(t,o,!0),o!==s?Uo.set(i,o):l&&Uo.delete(i)}function Fg(n){n._lexicalHandled=!0}function Bg(n){return n._lexicalHandled===!0}function vT(n){const e=n.ownerDocument,t=Zi.get(e);t===void 0&&K(162);const o=t-1;o>=0||K(164),Zi.set(e,o),o===0&&e.removeEventListener("selectionchange",Lg);const r=is(n);Bi(r)?(function(i){if(i._parentEditor!==null){const l=Ka(i),c=l[l.length-1]._key;Uo.get(c)===i&&Uo.delete(c)}else Uo.delete(i._key)}(r),n.__lexicalEditor=null):r&&K(198);const s=Ig(n);for(let i=0;i<s.length;i++)s[i]();n.__lexicalEventHandles=[]}function cu(n,e,t){dt();const o=n.__key,r=n.getParent();if(r===null)return;const s=function(l){const c=ge();if(!te(c)||!$(l))return c;const{anchor:a,focus:f}=c,d=a.getNode(),u=f.getNode();return Hi(d,l)&&a.set(l.__key,0,"element"),Hi(u,l)&&f.set(l.__key,0,"element"),c}(n);let i=!1;if(te(s)&&e){const l=s.anchor,c=s.focus;l.key===o&&(ll(l,n,r,n.getPreviousSibling(),n.getNextSibling()),i=!0),c.key===o&&(ll(c,n,r,n.getPreviousSibling(),n.getNextSibling()),i=!0)}else Ns(s)&&e&&n.isSelected()&&n.selectPrevious();if(te(s)&&e&&!i){const l=n.getIndexWithinParent();uo(n),il(s,r,l,-1)}else uo(n);t||Fn(r)||r.canBeEmpty()||!r.isEmpty()||cu(r,e),e&&mt(r)&&r.isEmpty()&&r.selectEnd()}class el{static getType(){K(64,this.name)}static clone(e){K(65,this.name)}afterCloneFrom(e){this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,eg(this,e)}getType(){return this.__type}isInline(){K(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=et(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||ge();if(t==null)return!1;const o=t.getNodes().some(r=>r.__key===this.__key);if(q(this))return o;if(te(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const r=this.getParent();if(we(this)&&this.isInline()&&r){const s=t.isBackward()?t.focus:t.anchor,i=s.getNode();if(s.offset===i.getChildrenSize()&&i.is(r)&&i.getLastChildOrThrow().is(this))return!1}}return o}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),o=0;for(;t!==null;){if(this.is(t))return o;o++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:et(e)}getParentOrThrow(){const e=this.getParent();return e===null&&K(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(Fn(t))return $(e)||e===this&&we(e)||K(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&K(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:et(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(t===null)return e;let o=t.getFirstChild();for(;o!==null&&!o.is(this);)e.push(o),o=o.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return e===null?null:et(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=this.getParents(),o=e.getParents();$(this)&&t.unshift(this),$(e)&&o.unshift(e);const r=t.length,s=o.length;if(r===0||s===0||t[r-1]!==o[s-1])return null;const i=new Set(o);for(let l=0;l<r;l++){const c=t[l];if(i.has(c))return c}return null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;const t=this.getCommonAncestor(e);let o=0,r=0,s=this;for(;;){const i=s.getParentOrThrow();if(i===t){o=s.getIndexWithinParent();break}s=i}for(s=e;;){const i=s.getParentOrThrow();if(i===t){r=s.getIndexWithinParent();break}s=i}return o<r}isParentOf(e){const t=this.__key;if(t===e.__key)return!1;let o=e;for(;o!==null;){if(o.__key===t)return!0;o=o.getParent()}return!1}getNodesBetween(e){const t=this.isBefore(e),o=[],r=new Set;let s=this;for(;s!==null;){const i=s.__key;if(r.has(i)||(r.add(i),o.push(s)),s===e)break;const l=$(s)?t?s.getFirstChild():s.getLastChild():null;if(l!==null){s=l;continue}const c=t?s.getNextSibling():s.getPreviousSibling();if(c!==null){s=c;continue}const a=s.getParentOrThrow();if(r.has(a.__key)||o.push(a),a===e)break;let f=null,d=a;do{if(d===null&&K(68),f=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d===null)break;f!==null||r.has(d.__key)||o.push(d)}while(f===null);s=f}return t||o.reverse(),o}isDirty(){const e=Ee()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=et(this.__key);return e===null&&K(113),e}getWritable(){dt();const e=rn(),t=Ee(),o=e._nodeMap,r=this.__key,s=this.getLatest(),i=t._cloneNotNeeded,l=ge();if(l!==null&&l.setCachedNodes(null),i.has(r))return Wi(s),s;const c=Ng(s);return i.add(r),Wi(c),o.set(r,c),c}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){K(70)}updateDOM(e,t,o){K(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){K(72)}static importJSON(e){K(18,this.name)}static transform(){return null}remove(e){cu(this,!0,e)}replace(e,t){dt();let o=ge();o!==null&&(o=o.clone()),Ha(this,e);const r=this.getLatest(),s=this.__key,i=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;uo(l);const f=r.getPreviousSibling(),d=r.getNextSibling(),u=r.__prev,h=r.__next,g=r.__parent;if(cu(r,!1,!0),f===null?c.__first=i:f.getWritable().__next=i,l.__prev=u,d===null?c.__last=i:d.getWritable().__prev=i,l.__next=h,l.__parent=g,c.__size=a,t&&($(this)&&$(l)||K(139),this.getChildren().forEach(p=>{l.append(p)})),te(o)){tn(o);const p=o.anchor,_=o.focus;p.key===s&&Yg(p,l),_.key===s&&Yg(_,l)}return Ln()===s&&He(i),l}insertAfter(e,t=!0){dt(),Ha(this,e);const o=this.getWritable(),r=e.getWritable(),s=r.getParent(),i=ge();let l=!1,c=!1;if(s!==null){const h=e.getIndexWithinParent();if(uo(r),te(i)){const g=s.__key,p=i.anchor,_=i.focus;l=p.type==="element"&&p.key===g&&p.offset===h+1,c=_.type==="element"&&_.key===g&&_.offset===h+1}}const a=this.getNextSibling(),f=this.getParentOrThrow().getWritable(),d=r.__key,u=o.__next;if(a===null?f.__last=d:a.getWritable().__prev=d,f.__size++,o.__next=d,r.__next=u,r.__prev=o.__key,r.__parent=o.__parent,t&&te(i)){const h=this.getIndexWithinParent();il(i,f,h+1);const g=f.__key;l&&i.anchor.set(g,h+2,"element"),c&&i.focus.set(g,h+2,"element")}return e}insertBefore(e,t=!0){dt(),Ha(this,e);const o=this.getWritable(),r=e.getWritable(),s=r.__key;uo(r);const i=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),c=o.__prev,a=this.getIndexWithinParent();i===null?l.__first=s:i.getWritable().__next=s,l.__size++,o.__prev=s,r.__prev=c,r.__next=o.__key,r.__parent=o.__parent;const f=ge();return t&&te(f)&&il(f,this.getParentOrThrow(),a),e}isParentRequired(){return!1}createParentElementNode(){return mn()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){dt();const o=this.getPreviousSibling(),r=this.getParentOrThrow();if(o===null)return r.select(0,0);if($(o))return o.select();if(!q(o)){const s=o.getIndexWithinParent()+1;return r.select(s,s)}return o.select(e,t)}selectNext(e,t){dt();const o=this.getNextSibling(),r=this.getParentOrThrow();if(o===null)return r.select();if($(o))return o.select(0,0);if(!q(o)){const s=o.getIndexWithinParent();return r.select(s,s)}return o.select(e,t)}markDirty(){this.getWritable()}}class jo extends el{static getType(){return"linebreak"}static clone(e){return new jo(e.__key)}constructor(e){super(e)}getTextContent(){return`
26
- `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const o=t.parentElement;if(o!==null&&Va(o)){const r=o.firstChild;if(r===t||r.nextSibling===t&&tl(r)){const s=o.lastChild;if(s===t||s.previousSibling===t&&tl(s))return!0}}return!1}(e)||function(t){const o=t.parentElement;if(o!==null&&Va(o)){const r=o.firstChild;if(r===t||r.nextSibling===t&&tl(r))return!1;const s=o.lastChild;if(s===t||s.previousSibling===t&&tl(s))return!0}return!1}(e)?null:{conversion:MT,priority:0}}}static importJSON(e){return Ho()}exportJSON(){return{type:"linebreak",version:1}}}function MT(n){return{node:Ho()}}function Ho(){return ds(new jo)}function go(n){return n instanceof jo}function tl(n){return n.nodeType===In&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}function au(n,e){return 16&e?"code":e&Ii?"mark":32&e?"sub":64&e?"sup":null}function uu(n,e){return 1&e?"strong":2&e?"em":"span"}function Kg(n,e,t,o,r){const s=o.classList;let i=fs(r,"base");i!==void 0&&s.add(...i),i=fs(r,"underlineStrikethrough");let l=!1;const c=e&rs&&e&os;i!==void 0&&(t&rs&&t&os?(l=!0,c||s.add(...i)):c&&s.remove(...i));for(const a in en){const f=en[a];if(i=fs(r,a),i!==void 0)if(t&f){if(l&&(a==="underline"||a==="strikethrough")){e&f&&s.remove(...i);continue}e&f&&(!c||a!=="underline")&&a!=="strikethrough"||s.add(...i)}else e&f&&s.remove(...i)}}function Wg(n,e,t){const o=e.firstChild,r=t.isComposing(),s=n+(r?Li:"");if(o==null)e.textContent=s;else{const i=o.nodeValue;if(i!==s)if(r||Pn){const[l,c,a]=function(f,d){const u=f.length,h=d.length;let g=0,p=0;for(;g<u&&g<h&&f[g]===d[g];)g++;for(;p+g<u&&p+g<h&&f[u-p-1]===d[h-p-1];)p++;return[g,u-g-p,d.slice(g,h-p)]}(i,s);c!==0&&o.deleteData(l,c),o.insertData(l,a)}else o.nodeValue=s}}function zg(n,e,t,o,r,s){Wg(r,n,e);const i=s.theme.text;i!==void 0&&Kg(0,0,o,n,i)}function nl(n,e){const t=document.createElement(e);return t.appendChild(n),t}class po extends el{static getType(){return"text"}static clone(e){return new po(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return oT[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Ln()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=en[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Ba(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const o=this.__format,r=au(0,o),s=uu(0,o),i=r===null?s:r,l=document.createElement(i);let c=l;this.hasFormat("code")&&l.setAttribute("spellcheck","false"),r!==null&&(c=document.createElement(s),l.appendChild(c)),zg(c,this,0,o,this.__text,e);const a=this.__style;return a!==""&&(l.style.cssText=a),l}updateDOM(e,t,o){const r=this.__text,s=e.__format,i=this.__format,l=au(0,s),c=au(0,i),a=uu(0,s),f=uu(0,i);if((l===null?a:l)!==(c===null?f:c))return!0;if(l===c&&a!==f){const p=t.firstChild;p==null&&K(48);const _=document.createElement(f);return zg(_,this,0,i,r,o),t.replaceChild(_,p),!1}let d=t;c!==null&&l!==null&&(d=t.firstChild,d==null&&K(49)),Wg(r,d,this);const u=o.theme.text;u!==void 0&&s!==i&&Kg(0,s,i,d,u);const h=e.__style,g=this.__style;return h!==g&&(t.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:RT,priority:0}),b:()=>({conversion:AT,priority:0}),code:()=>({conversion:Kn,priority:0}),em:()=>({conversion:Kn,priority:0}),i:()=>({conversion:Kn,priority:0}),s:()=>({conversion:Kn,priority:0}),span:()=>({conversion:DT,priority:0}),strong:()=>({conversion:Kn,priority:0}),sub:()=>({conversion:Kn,priority:0}),sup:()=>({conversion:Kn,priority:0}),u:()=>({conversion:Kn,priority:0})}}static importJSON(e){const t=tt(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);return t!==null&&Ji(t)||K(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=nl(t,"b")),this.hasFormat("italic")&&(t=nl(t,"i")),this.hasFormat("strikethrough")&&(t=nl(t,"s")),this.hasFormat("underline")&&(t=nl(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format=typeof e=="string"?en[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?eT[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Ba(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=nT[e];if(this.__mode===t)return this;const o=this.getWritable();return o.__mode=t,o}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){dt();let o=e,r=t;const s=ge(),i=this.getTextContent(),l=this.__key;if(typeof i=="string"){const c=i.length;o===void 0&&(o=c),r===void 0&&(r=c)}else o=0,r=0;if(!te(s))return Zg(l,o,l,r,"text","text");{const c=Ln();c!==s.anchor.key&&c!==s.focus.key||He(l),s.setTextNodeRange(this,o,this,r)}return s}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,o,r){const s=this.getWritable(),i=s.__text,l=o.length;let c=e;c<0&&(c=l+c,c<0&&(c=0));const a=ge();if(r&&te(a)){const d=e+l;a.setTextNodeRange(s,d,s,d)}const f=i.slice(0,c)+o+i.slice(c+t);return s.__text=f,s}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){dt();const t=this.getLatest(),o=t.getTextContent(),r=t.__key,s=Ln(),i=new Set(e),l=[],c=o.length;let a="";for(let S=0;S<c;S++)a!==""&&i.has(S)&&(l.push(a),a=""),a+=o[S];a!==""&&l.push(a);const f=l.length;if(f===0)return[];if(l[0]===o)return[t];const d=l[0],u=t.getParent();let h;const g=t.getFormat(),p=t.getStyle(),_=t.__detail;let y=!1;t.isSegmented()?(h=tt(d),h.__format=g,h.__style=p,h.__detail=_,y=!0):(h=t.getWritable(),h.__text=d);const m=ge(),C=[h];let N=d.length;for(let S=1;S<f;S++){const T=l[S],b=T.length,x=tt(T).getWritable();x.__format=g,x.__style=p,x.__detail=_;const w=x.__key,O=N+b;if(te(m)){const D=m.anchor,B=m.focus;D.key===r&&D.type==="text"&&D.offset>N&&D.offset<=O&&(D.key=w,D.offset-=N,m.dirty=!0),B.key===r&&B.type==="text"&&B.offset>N&&B.offset<=O&&(B.key=w,B.offset-=N,m.dirty=!0)}s===r&&He(w),N=O,C.push(x)}if(u!==null){(function(b){const x=b.getPreviousSibling(),w=b.getNextSibling();x!==null&&Wi(x),w!==null&&Wi(w)})(this);const S=u.getWritable(),T=this.getIndexWithinParent();y?(S.splice(T,0,C),this.remove()):S.splice(T,1,C),te(m)&&il(m,u,T,f-1)}return C}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||K(50);const o=this.__key,r=e.__key,s=this.__text,i=s.length;Ln()===r&&He(o);const l=ge();if(te(l)){const d=l.anchor,u=l.focus;d!==null&&d.key===r&&(tp(d,t,o,e,i),l.dirty=!0),u!==null&&u.key===r&&(tp(u,t,o,e,i),l.dirty=!0)}const c=e.__text,a=t?c+s:s+c;this.setTextContent(a);const f=this.getWritable();return e.remove(),f}isTextEntity(){return!1}}function DT(n){return{forChild:fu(n.style),node:null}}function AT(n){const e=n,t=e.style.fontWeight==="normal";return{forChild:fu(e.style,t?void 0:"bold"),node:null}}const Ug=new WeakMap;function kT(n){return n.nodeName==="PRE"||n.nodeType===ns&&n.style!==void 0&&n.style.whiteSpace!==void 0&&n.style.whiteSpace.startsWith("pre")}function RT(n){const e=n;n.parentElement===null&&K(129);let t=e.textContent||"";if(function(o){let r,s=o.parentNode;const i=[o];for(;s!==null&&(r=Ug.get(s))===void 0&&!kT(s);)i.push(s),s=s.parentNode;const l=r===void 0?s:r;for(let c=0;c<i.length;c++)Ug.set(i[c],l);return l}(e)!==null){const o=t.split(/(\r?\n|\t)/),r=[],s=o.length;for(let i=0;i<s;i++){const l=o[i];l===`
23
+ `,QS=Pn?" ":Ii,Uh="֑-߿יִ-﷽ﹰ-ﻼ",Hh="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",ZS=new RegExp("^[^"+Hh+"]*["+Uh+"]"),eT=new RegExp("^[^"+Uh+"]*["+Hh+"]"),Zt={bold:1,code:16,highlight:Pi,italic:2,strikethrough:ns,subscript:32,superscript:64,underline:rs},tT={directionless:1,unmergeable:2},Yh={center:Ma,end:Ra,justify:Aa,left:va,right:Da,start:ka},nT={[Ma]:"center",[Ra]:"end",[Aa]:"justify",[va]:"left",[Da]:"right",[ka]:"start"},rT={normal:0,segmented:2,token:1},oT={[US]:"normal",[YS]:"segmented",[HS]:"token"};function sT(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var K=sT(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function Li(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[r]of t.matchAll(/\S+/g))e.push(r);return e}const iT=100;let $a=!1,Pa=0;function lT(n){Pa=n.timeStamp}function Ia(n,e,t){return e.__lexicalLineBreak===n||n[`__lexicalKey_${t._key}`]!==void 0}function cT(n,e,t){const r=tn(t._window);let o=null,s=null;r!==null&&r.anchorNode===n&&(o=r.anchorOffset,s=r.focusOffset);const i=n.nodeValue;i!==null&&za(e,i,o,s,!1)}function aT(n,e,t){if(te(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return e.nodeType===In&&t.isAttached()}function Jh(n,e,t){$a=!0;const r=performance.now()-Pa>iT;try{wt(n,()=>{const o=he()||function(u){return u.getEditorState().read(()=>{const h=he();return h!==null?h.clone():null})}(n),s=new Map,i=n.getRootElement(),l=n._editorState,c=n._blockCursorElement;let a=!1,f="";for(let u=0;u<e.length;u++){const h=e[u],g=h.type,p=h.target;let _=is(p,l);if(!(_===null&&p!==i||we(_))){if(g==="characterData")r&&X(_)&&aT(o,p,_)&&cT(p,_,n);else if(g==="childList"){a=!0;const y=h.addedNodes;for(let N=0;N<y.length;N++){const S=y[N],T=rg(S),E=S.parentNode;if(E!=null&&S!==c&&T===null&&(S.nodeName!=="BR"||!Ia(S,E,n))){if(Pn){const x=S.innerText||S.nodeValue;x&&(f+=x)}E.removeChild(S)}}const m=h.removedNodes,C=m.length;if(C>0){let N=0;for(let S=0;S<C;S++){const T=m[S];(T.nodeName==="BR"&&Ia(T,p,n)||c===T)&&(p.appendChild(T),N++)}C!==N&&(p===i&&(_=ig(l)),s.set(p,_))}}}}if(s.size>0)for(const[u,h]of s)if(R(h)){const g=h.getChildrenKeys();let p=u.firstChild;for(let _=0;_<g.length;_++){const y=g[_],m=n.getElementByKey(y);m!==null&&(p==null?(u.appendChild(m),p=m):p!==m&&u.replaceChild(m,p),p=p.nextSibling)}}else X(h)&&h.markDirty();const d=t.takeRecords();if(d.length>0){for(let u=0;u<d.length;u++){const h=d[u],g=h.addedNodes,p=h.target;for(let _=0;_<g.length;_++){const y=g[_],m=y.parentNode;m==null||y.nodeName!=="BR"||Ia(y,p,n)||m.removeChild(y)}}t.takeRecords()}o!==null&&(a&&(o.dirty=!0,en(o)),Pn&&_g(n)&&o.insertRawText(f))})}finally{$a=!1}}function Vh(n){const e=n._observer;e!==null&&Jh(n,e.takeRecords(),e)}function Gh(n){(function(e){Pa===0&&Hi(e).addEventListener("textInput",lT,!0)})(n),n._observer=new MutationObserver((e,t)=>{Jh(n,e,t)})}function Xh(n,e){const t=n.__mode,r=n.__format,o=n.__style,s=e.__mode,i=e.__format,l=e.__style;return!(t!==null&&t!==s||r!==null&&r!==i||o!==null&&o!==l)}function qh(n,e){const t=n.mergeWithSibling(e),r=Ee()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function Qh(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&X(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Xh(e,r)){r=qh(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&X(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Xh(r,t)){r=qh(r,t);break}break}t.remove()}}else r.remove()}function Zh(n){return eg(n.anchor),eg(n.focus),n}function eg(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,o;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),o=!0):(r=e.getChildAtIndex(t),o=!1),X(r)){n.set(r.__key,o?r.getTextContentSize():0,"text");break}if(!R(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element")}}let tg=1;function uT(){tg=1}const fT=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function La(n){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return we(is(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&ss(e)==null)}function os(n,e,t){const r=n.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(t)&&e!==null&&!La(e)&&Fa(e)===n}catch{return!1}}function Fi(n){return n instanceof al}function Fa(n){let e=n;for(;e!=null;){const t=ss(e);if(Fi(t))return t;e=ji(e)}return null}function ss(n){return n?n.__lexicalEditor:null}function ar(n){return n.isToken()||n.isSegmented()}function dT(n){return n.nodeType===In}function Bi(n){let e=n;for(;e!=null;){if(dT(e))return e;e=e.firstChild}return null}function Ba(n,e,t){const r=Zt[e];if(t!==null&&(n&r)==(t&r))return n;let o=n^r;return e==="subscript"?o&=~Zt.superscript:e==="superscript"&&(o&=~Zt.subscript),o}function hT(n){return X(n)||hr(n)||we(n)}function ng(n,e){if(e!=null)return void(n.__key=e);dt(),sp();const t=Ee(),r=rn(),o=""+tg++;r._nodeMap.set(o,n),R(n)?t._dirtyElements.set(o,!0):t._dirtyLeaves.add(o),t._cloneNotNeeded.add(o),t._dirtyType=zh,n.__key=o}function ur(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),o=n.getPreviousSibling(),s=n.getNextSibling();if(o===null)if(s!==null){const i=s.getWritable();r.__first=s.__key,i.__prev=null}else r.__first=null;else{const i=o.getWritable();if(s!==null){const l=s.getWritable();l.__prev=i.__key,i.__next=l.__key}else i.__next=null;t.__prev=null}if(s===null)if(o!==null){const i=o.getWritable();r.__last=o.__key,i.__next=null}else r.__last=null;else{const i=s.getWritable();if(o!==null){const l=o.getWritable();l.__next=i.__key,i.__prev=l.__key}else i.__prev=null;t.__next=null}r.__size--,t.__parent=null}}function Ki(n){sp();const e=n.getLatest(),t=e.__parent,r=rn(),o=Ee(),s=r._nodeMap,i=o._dirtyElements;t!==null&&function(c,a,f){let d=c;for(;d!==null;){if(f.has(d))return;const u=a.get(d);if(u===void 0)break;f.set(d,!1),d=u.__parent}}(t,s,i);const l=e.__key;o._dirtyType=zh,R(n)?i.set(l,!0):o._dirtyLeaves.add(l)}function He(n){dt();const e=Ee(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const r=et(t);r!==null&&r.getWritable()}if(n!==null){const r=et(n);r!==null&&r.getWritable()}}}function Ln(){return Vr()?null:Ee()._compositionKey}function et(n,e){const t=(e||rn())._nodeMap.get(n);return t===void 0?null:t}function rg(n,e){const t=n[`__lexicalKey_${Ee()._key}`];return t!==void 0?et(t,e):null}function is(n,e){let t=n;for(;t!=null;){const r=rg(t,e);if(r!==null)return r;t=ji(t)}return null}function og(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function sg(n){return n.read(()=>Et().getTextContent())}function Et(){return ig(rn())}function ig(n){return n._nodeMap.get("root")}function en(n){dt();const e=rn();n!==null&&(n.dirty=!0,n.setCachedNodes(null)),e._selection=n}function Kr(n){const e=Ee(),t=function(r,o){let s=r;for(;s!=null;){const i=s[`__lexicalKey_${o._key}`];if(i!==void 0)return i;s=ji(s)}return null}(n,e);return t===null?n===e.getRootElement()?et("root"):null:et(t)}function lg(n,e){return e?n.getTextContentSize():0}function cg(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function Ka(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function ag(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function ug(n){return n.nodeType===In?n.nodeValue:null}function Wa(n,e,t){const r=tn(e._window);if(r===null)return;const o=r.anchorNode;let{anchorOffset:s,focusOffset:i}=r;if(o!==null){let l=ug(o);const c=is(o);if(l!==null&&X(c)){if(l===Ii&&t){const a=t.length;l=t,s=a,i=a}l!==null&&za(c,l,s,i,n)}}}function za(n,e,t,r,o){let s=n;if(s.isAttached()&&(o||!s.isDirty())){const i=s.isComposing();let l=e;(i||o)&&e[e.length-1]===Ii&&(l=e.slice(0,-1));const c=s.getTextContent();if(o||l!==c){if(l===""){if(He(null),ba||$i||Oa)s.remove();else{const p=Ee();setTimeout(()=>{p.update(()=>{s.isAttached()&&s.remove()})},20)}return}const a=s.getParent(),f=Jr(),d=s.getTextContentSize(),u=Ln(),h=s.getKey();if(s.isToken()||u!==null&&h===u&&!i||te(f)&&(a!==null&&!a.canInsertTextBefore()&&f.anchor.offset===0||f.anchor.key===n.__key&&f.anchor.offset===0&&!s.canInsertTextBefore()&&!i||f.focus.key===n.__key&&f.focus.offset===d&&!s.canInsertTextAfter()&&!i))return void s.markDirty();const g=he();if(!te(g)||t===null||r===null)return void s.setTextContent(l);if(g.setTextNodeRange(s,t,s,r),s.isSegmented()){const p=tt(s.getTextContent());s.replace(p),s=p}s.setTextContent(l)}}}function gT(n,e){if(e.isSegmented())return!0;if(!n.isCollapsed())return!1;const t=n.anchor.offset,r=e.getParentOrThrow(),o=e.isToken();return t===0?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||o||function(s){const i=s.getPreviousSibling();return(X(i)||R(i)&&i.isInline())&&!i.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||o)}function fg(n){return n==="ArrowLeft"}function dg(n){return n==="ArrowRight"}function ls(n,e){return Lt?n:e}function hg(n){return n==="Enter"}function cs(n){return n==="Backspace"}function as(n){return n==="Delete"}function gg(n,e,t){return n.toLowerCase()==="a"&&ls(e,t)}function pT(){const n=Et();en(Zh(n.select(0,n.getChildrenSize())))}function us(n,e){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const t=n.__lexicalClassNameCache,r=t[e];if(r!==void 0)return r;const o=n[e];if(typeof o=="string"){const s=Li(o);return t[e]=s,s}return o}function ja(n,e,t,r,o){if(t.size===0)return;const s=r.__type,i=r.__key,l=e.get(s);l===void 0&&K(33,s);const c=l.klass;let a=n.get(c);a===void 0&&(a=new Map,n.set(c,a));const f=a.get(i),d=f==="destroyed"&&o==="created";(f===void 0||d)&&a.set(i,d?"updated":o)}function _T(n){const e=n.getType(),t=rn();if(t._readOnly){const s=Sg(t).get(e);return s?Array.from(s.values()):[]}const r=t._nodeMap,o=[];for(const[,s]of r)s instanceof n&&s.__type===e&&s.isAttached()&&o.push(s);return o}function pg(n,e,t){const r=n.getParent();let o=t,s=n;return r!==null&&(e&&t===0?(o=s.getIndexWithinParent(),s=r):e||t!==s.getChildrenSize()||(o=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(e?o-1:o)}function Ua(n,e){const t=n.offset;if(n.type==="element")return pg(n.getNode(),e,t);{const r=n.getNode();if(e&&t===0||!e&&t===r.getTextContentSize()){const o=e?r.getPreviousSibling():r.getNextSibling();return o===null?pg(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):o}}return null}function _g(n){const e=Hi(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function H(n,e,t){return up(n,e,t)}function Wi(n){return!mt(n)&&!n.isLastChild()&&!n.isInline()}function zi(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&K(75,e),t}function ji(n){const e=n.assignedSlot||n.parentElement;return e!==null&&e.nodeType===11?e.host:e}function mT(n){return Ee()._updateTags.has(n)}function yT(n){dt(),Ee()._updateTags.add(n)}function Ui(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Hi(n){const e=n._window;return e===null&&K(78),e}function CT(n){return R(n)&&n.isInline()||we(n)&&n.isInline()}function mg(n){let e=n.getParentOrThrow();for(;e!==null;){if(Fn(e))return e;e=e.getParentOrThrow()}return e}function Fn(n){return mt(n)||R(n)&&n.isShadowRoot()}function yg(n){const e=n.constructor.clone(n);return ng(e,null),e}function fs(n){const e=Ee(),t=n.constructor.getType(),r=e._nodes.get(t);r===void 0&&K(97);const o=r.replace;if(o!==null){const s=o(n);return s instanceof n.constructor||K(98),s}return n}function Ha(n,e){!mt(n.getParent())||R(e)||we(e)||K(99)}function NT(n){const e=et(n);return e===null&&K(63,n),e}function Ya(n){return(we(n)||R(n)&&!n.canBeEmpty())&&!n.isInline()}function Ja(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function ST(n,e,t){let r=n._blockCursorElement;if(te(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const o=t.anchor,s=o.getNode(),i=o.offset;let l=!1,c=null;if(i===s.getChildrenSize())Ya(s.getChildAtIndex(i-1))&&(l=!0);else{const a=s.getChildAtIndex(i);if(Ya(a)){const f=a.getPreviousSibling();(f===null||Ya(f))&&(l=!0,c=n.getElementByKey(a.__key))}}if(l){const a=n.getElementByKey(s.__key);return r===null&&(n._blockCursorElement=r=function(f){const d=f.theme,u=document.createElement("div");u.contentEditable="false",u.setAttribute("data-lexical-cursor","true");let h=d.blockCursor;if(h!==void 0){if(typeof h=="string"){const g=Li(h);h=d.blockCursor=g}h!==void 0&&u.classList.add(...h)}return u}(n._config)),e.style.caretColor="transparent",void(c===null?a.appendChild(r):a.insertBefore(r,c))}}r!==null&&Ja(r,n,e)}function tn(n){return It?(n||window).getSelection():null}function TT(n,e){let t=n.getChildAtIndex(e);t==null&&(t=n),Fn(n)&&K(102);const r=i=>{const l=i.getParentOrThrow(),c=Fn(l),a=i!==t||c?yg(i):i;if(c)return R(i)&&R(a)||K(133),i.insertAfter(a),[i,a,a];{const[f,d,u]=r(l),h=i.getNextSiblings();return u.append(a,...h),[f,d,a]}},[o,s]=r(t);return[o,s]}function xT(n){return Yi(n)&&n.tagName==="A"}function Yi(n){return n.nodeType===1}function Cg(n){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return n.nodeName.match(e)!==null}function Va(n){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return n.nodeName.match(e)!==null}function Wr(n){if(mt(n)||we(n)&&!n.isInline())return!0;if(!R(n)||Fn(n))return!1;const e=n.getFirstChild(),t=e===null||hr(e)||X(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function Ga(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function ET(){return Ee()}const Ng=new WeakMap,wT=new Map;function Sg(n){if(!n._readOnly&&n.isEmpty())return wT;n._readOnly||K(192);let e=Ng.get(n);if(!e){e=new Map,Ng.set(n,e);for(const[t,r]of n._nodeMap){const o=r.__type;let s=e.get(o);s||(s=new Map,e.set(o,s)),s.set(t,r)}}return e}function Tg(n){const e=n.constructor.clone(n);return e.afterCloneFrom(n),e}function xg(n,e,t,r,o,s){let i=n.getFirstChild();for(;i!==null;){const l=i.__key;i.__parent===e&&(R(i)&&xg(i,l,t,r,o,s),t.has(l)||s.delete(l),o.push(l)),i=i.getNextSibling()}}let Bn,ut,ds,Ji,Xa,qa,fr,Ft,Qa,hs,Ke="",ft="",nn=null,Bt="",gn="",Eg=!1,gs=!1,Vi=null;function Gi(n,e){const t=fr.get(n);if(e!==null){const r=nu(n);r.parentNode===e&&e.removeChild(r)}if(Ft.has(n)||ut._keyToDOMMap.delete(n),R(t)){const r=qi(t,fr);Za(r,0,r.length-1,null)}t!==void 0&&ja(hs,ds,Ji,t,"destroyed")}function Za(n,e,t,r){let o=e;for(;o<=t;++o){const s=n[o];s!==void 0&&Gi(s,r)}}function dr(n,e){n.setProperty("text-align",e)}const bT="40px";function wg(n,e){const t=Bn.theme.indent;if(typeof t=="string"){const o=n.classList.contains(t);e>0&&!o?n.classList.add(t):e<1&&o&&n.classList.remove(t)}const r=getComputedStyle(n).getPropertyValue("--lexical-indent-base-value")||bT;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${r})`)}function bg(n,e){const t=n.style;e===0?dr(t,""):e===va?dr(t,"left"):e===Ma?dr(t,"center"):e===Da?dr(t,"right"):e===Aa?dr(t,"justify"):e===ka?dr(t,"start"):e===Ra&&dr(t,"end")}function Xi(n,e,t){const r=Ft.get(n);r===void 0&&K(60);const o=r.createDOM(Bn,ut);if(function(s,i,l){const c=l._keyToDOMMap;i["__lexicalKey_"+l._key]=s,c.set(s,i)}(n,o,ut),X(r)?o.setAttribute("data-lexical-text","true"):we(r)&&o.setAttribute("data-lexical-decorator","true"),R(r)){const s=r.__indent,i=r.__size;if(s!==0&&wg(o,s),i!==0){const c=i-1;(function(a,f,d,u){const h=ft;ft="",eu(a,d,0,f,u,null),Mg(d,u),ft=h})(qi(r,Ft),c,r,o)}const l=r.__format;l!==0&&bg(o,l),r.isInline()||vg(null,r,o),Wi(r)&&(Ke+=hn,gn+=hn)}else{const s=r.getTextContent();if(we(r)){const i=r.decorate(ut,Bn);i!==null&&Dg(n,i),o.contentEditable="false"}else X(r)&&(r.isDirectionless()||(ft+=s));Ke+=s,gn+=s}if(e!==null)if(t!=null)e.insertBefore(o,t);else{const s=e.__lexicalLineBreak;s!=null?e.insertBefore(o,s):e.appendChild(o)}return ja(hs,ds,Ji,r,"created"),o}function eu(n,e,t,r,o,s){const i=Ke;Ke="";let l=t;for(;l<=r;++l){Xi(n[l],o,s);const c=Ft.get(n[l]);c!==null&&X(c)&&(nn===null&&(nn=c.getFormat()),Bt===""&&(Bt=c.getStyle()))}Wi(e)&&(Ke+=hn),o.__lexicalTextContent=Ke,Ke=i+Ke}function Og(n,e){const t=e.get(n);return hr(t)||we(t)&&t.isInline()}function vg(n,e,t){const r=n!==null&&(n.__size===0||Og(n.__last,fr)),o=e.__size===0||Og(e.__last,Ft);if(r){if(!o){const s=t.__lexicalLineBreak;if(s!=null)try{t.removeChild(s)}catch(i){if(typeof i=="object"&&i!=null){const l=`${i.toString()} Parent: ${t.tagName}, child: ${s.tagName}.`;throw new Error(l)}throw i}t.__lexicalLineBreak=null}}else if(o){const s=document.createElement("br");t.__lexicalLineBreak=s,t.appendChild(s)}}function Mg(n,e){const t=e.__lexicalDirTextContent,r=e.__lexicalDir;if(t!==ft||r!==Vi){const s=ft==="",i=s?Vi:(o=ft,ZS.test(o)?"rtl":eT.test(o)?"ltr":null);if(i!==r){const l=e.classList,c=Bn.theme;let a=r!==null?c[r]:void 0,f=i!==null?c[i]:void 0;if(a!==void 0){if(typeof a=="string"){const d=Li(a);a=c[r]=d}l.remove(...a)}if(i===null||s&&i==="ltr")e.removeAttribute("dir");else{if(f!==void 0){if(typeof f=="string"){const d=Li(f);f=c[i]=d}f!==void 0&&l.add(...f)}e.dir=i}gs||(n.getWritable().__dir=i)}Vi=i,e.__lexicalDirTextContent=ft,e.__lexicalDir=i}var o}function OT(n,e,t){const r=ft;var o;ft="",nn=null,Bt="",function(s,i,l){const c=Ke,a=s.__size,f=i.__size;if(Ke="",a===1&&f===1){const d=s.__first,u=i.__first;if(d===u)ps(d,l);else{const g=nu(d),p=Xi(u,null,null);try{l.replaceChild(p,g)}catch(_){if(typeof _=="object"&&_!=null){const y=`${_.toString()} Parent: ${l.tagName}, new child: {tag: ${p.tagName} key: ${u}}, old child: {tag: ${g.tagName}, key: ${d}}.`;throw new Error(y)}throw _}Gi(d,null)}const h=Ft.get(u);X(h)&&(nn===null&&(nn=h.getFormat()),Bt===""&&(Bt=h.getStyle()))}else{const d=qi(s,fr),u=qi(i,Ft);if(a===0)f!==0&&eu(u,i,0,f-1,l,null);else if(f===0){if(a!==0){const h=l.__lexicalLineBreak==null;Za(d,0,a-1,h?null:l),h&&(l.textContent="")}}else(function(h,g,p,_,y,m){const C=_-1,N=y-1;let S,T,E=(O=m,O.firstChild),x=0,w=0;for(var O;x<=C&&w<=N;){const q=g[x],Y=p[w];if(q===Y)E=tu(ps(Y,m)),x++,w++;else{S===void 0&&(S=new Set(g)),T===void 0&&(T=new Set(p));const oe=T.has(q),F=S.has(Y);if(oe)if(F){const ce=zi(ut,Y);ce===E?E=tu(ps(Y,m)):(E!=null?m.insertBefore(ce,E):m.appendChild(ce),ps(Y,m)),x++,w++}else Xi(Y,m,E),w++;else E=tu(nu(q)),Gi(q,m),x++}const J=Ft.get(Y);J!==null&&X(J)&&(nn===null&&(nn=J.getFormat()),Bt===""&&(Bt=J.getStyle()))}const D=x>C,B=w>N;if(D&&!B){const q=p[N+1];eu(p,h,w,N,m,q===void 0?null:ut.getElementByKey(q))}else B&&!D&&Za(g,x,C,m)})(i,d,u,a,f,l)}Wi(i)&&(Ke+=hn),l.__lexicalTextContent=Ke,Ke=c+Ke}(n,e,t),Mg(e,t),Cu(o=e)&&nn!=null&&nn!==o.__textFormat&&!gs&&(o.setTextFormat(nn),o.setTextStyle(Bt)),function(s){Cu(s)&&Bt!==""&&Bt!==s.__textStyle&&!gs&&s.setTextStyle(Bt)}(e),ft=r}function qi(n,e){const t=[];let r=n.__first;for(;r!==null;){const o=e.get(r);o===void 0&&K(101),t.push(r),r=o.__next}return t}function ps(n,e){const t=fr.get(n);let r=Ft.get(n);t!==void 0&&r!==void 0||K(61);const o=Eg||qa.has(n)||Xa.has(n),s=zi(ut,n);if(t===r&&!o){if(R(t)){const i=s.__lexicalTextContent;i!==void 0&&(Ke+=i,gn+=i);const l=s.__lexicalDirTextContent;l!==void 0&&(ft+=l)}else{const i=t.getTextContent();X(t)&&!t.isDirectionless()&&(ft+=i),gn+=i,Ke+=i}return s}if(t!==r&&o&&ja(hs,ds,Ji,r,"updated"),r.updateDOM(t,s,Bn)){const i=Xi(n,null,null);return e===null&&K(62),e.replaceChild(i,s),Gi(n,null),i}if(R(t)&&R(r)){const i=r.__indent;i!==t.__indent&&wg(s,i);const l=r.__format;l!==t.__format&&bg(s,l),o&&(OT(t,r,s),mt(r)||r.isInline()||vg(t,r,s)),Wi(r)&&(Ke+=hn,gn+=hn)}else{const i=r.getTextContent();if(we(r)){const l=r.decorate(ut,Bn);l!==null&&Dg(n,l)}else X(r)&&!r.isDirectionless()&&(ft+=i);Ke+=i,gn+=i}if(!gs&&mt(r)&&r.__cachedText!==gn){const i=r.getWritable();i.__cachedText=gn,r=i}return s}function Dg(n,e){let t=ut._pendingDecorators;const r=ut._decorators;if(t===null){if(r[n]===e)return;t=og(ut)}t[n]=e}function tu(n){let e=n.nextSibling;return e!==null&&e===ut._blockCursorElement&&(e=e.nextSibling),e}function vT(n,e,t,r,o,s){Ke="",gn="",ft="",Eg=r===Br,Vi=null,ut=t,Bn=t._config,ds=t._nodes,Ji=ut._listeners.mutation,Xa=o,qa=s,fr=n._nodeMap,Ft=e._nodeMap,gs=e._readOnly,Qa=new Map(t._keyToDOMMap);const i=new Map;return hs=i,ps("root",null),ut=void 0,ds=void 0,Xa=void 0,qa=void 0,fr=void 0,Ft=void 0,Bn=void 0,Qa=void 0,hs=void 0,i}function nu(n){const e=Qa.get(n);return e===void 0&&K(75,n),e}const pn=Object.freeze({}),ru=30,ou=[["keydown",function(n,e){if(_s=n.timeStamp,Ag=n.key,e.isComposing())return;const{key:t,shiftKey:r,ctrlKey:o,metaKey:s,altKey:i}=n;H(e,Th,n)||t!=null&&(function(l,c,a,f){return dg(l)&&!c&&!f&&!a}(t,o,i,s)?H(e,xh,n):function(l,c,a,f,d){return dg(l)&&!f&&!a&&(c||d)}(t,o,r,i,s)?H(e,Eh,n):function(l,c,a,f){return fg(l)&&!c&&!f&&!a}(t,o,i,s)?H(e,wh,n):function(l,c,a,f,d){return fg(l)&&!f&&!a&&(c||d)}(t,o,r,i,s)?H(e,bh,n):function(l,c,a){return function(f){return f==="ArrowUp"}(l)&&!c&&!a}(t,o,s)?H(e,Oh,n):function(l,c,a){return function(f){return f==="ArrowDown"}(l)&&!c&&!a}(t,o,s)?H(e,vh,n):function(l,c){return hg(l)&&c}(t,r)?(ms=!0,H(e,ki,n)):function(l){return l===" "}(t)?H(e,Mh,n):function(l,c){return Lt&&c&&l.toLowerCase()==="o"}(t,o)?(n.preventDefault(),ms=!0,H(e,Qo,!0)):function(l,c){return hg(l)&&!c}(t,r)?(ms=!1,H(e,ki,n)):function(l,c,a,f){return Lt?!c&&!a&&(cs(l)||l.toLowerCase()==="h"&&f):!(f||c||a)&&cs(l)}(t,i,s,o)?cs(t)?H(e,Dh,n):(n.preventDefault(),H(e,qo,!0)):function(l){return l==="Escape"}(t)?H(e,Ah,n):function(l,c,a,f,d){return Lt?!(a||f||d)&&(as(l)||l.toLowerCase()==="d"&&c):!(c||f||d)&&as(l)}(t,o,r,i,s)?as(t)?H(e,kh,n):(n.preventDefault(),H(e,qo,!1)):function(l,c,a){return cs(l)&&(Lt?c:a)}(t,i,o)?(n.preventDefault(),H(e,Zo,!0)):function(l,c,a){return as(l)&&(Lt?c:a)}(t,i,o)?(n.preventDefault(),H(e,Zo,!1)):function(l,c){return Lt&&c&&cs(l)}(t,s)?(n.preventDefault(),H(e,es,!0)):function(l,c){return Lt&&c&&as(l)}(t,s)?(n.preventDefault(),H(e,es,!1)):function(l,c,a,f){return l.toLowerCase()==="b"&&!c&&ls(a,f)}(t,i,s,o)?(n.preventDefault(),H(e,$n,"bold")):function(l,c,a,f){return l.toLowerCase()==="u"&&!c&&ls(a,f)}(t,i,s,o)?(n.preventDefault(),H(e,$n,"underline")):function(l,c,a,f){return l.toLowerCase()==="i"&&!c&&ls(a,f)}(t,i,s,o)?(n.preventDefault(),H(e,$n,"italic")):function(l,c,a,f){return l==="Tab"&&!c&&!a&&!f}(t,i,o,s)?H(e,Rh,n):function(l,c,a,f){return l.toLowerCase()==="z"&&!c&&ls(a,f)}(t,r,s,o)?(n.preventDefault(),H(e,Sa,void 0)):function(l,c,a,f){return Lt?l.toLowerCase()==="z"&&a&&c:l.toLowerCase()==="y"&&f||l.toLowerCase()==="z"&&f&&c}(t,r,s,o)?(n.preventDefault(),H(e,Ta,void 0)):Cs(e._editorState._selection)?function(l,c,a,f){return!c&&l.toLowerCase()==="c"&&(Lt?a:f)}(t,r,s,o)?(n.preventDefault(),H(e,xa,n)):function(l,c,a,f){return!c&&l.toLowerCase()==="x"&&(Lt?a:f)}(t,r,s,o)?(n.preventDefault(),H(e,Ea,n)):gg(t,s,o)&&(n.preventDefault(),H(e,wa,n)):!Pn&&gg(t,s,o)&&(n.preventDefault(),H(e,wa,n)),function(l,c,a,f){return l||c||a||f}(o,r,i,s)&&H(e,Kh,n))}],["pointerdown",function(n,e){const t=n.target,r=n.pointerType;t instanceof Node&&r!=="touch"&&wt(e,()=>{we(is(t))||(iu=!0)})}],["compositionstart",function(n,e){wt(e,()=>{const t=he();if(te(t)&&!e.isComposing()){const r=t.anchor,o=t.anchor.getNode();He(r.key),(n.timeStamp<_s+ru||r.type==="element"||!t.isCollapsed()||o.getFormat()!==t.format||X(o)&&o.getStyle()!==t.style)&&H(e,Fr,QS)}})}],["compositionend",function(n,e){Pn?ys=!0:wt(e,()=>{lu(e,n.data)})}],["input",function(n,e){n.stopPropagation(),wt(e,()=>{const t=he(),r=n.data,o=Lg(n);if(r!=null&&te(t)&&$g(t,o,r,n.timeStamp,!1)){ys&&(lu(e,r),ys=!1);const s=t.anchor.getNode(),i=tn(e._window);if(i===null)return;const l=t.isBackward(),c=l?t.anchor.offset:t.focus.offset,a=l?t.focus.offset:t.anchor.offset;Ri&&!t.isCollapsed()&&X(s)&&i.anchorNode!==null&&s.getTextContent().slice(0,c)+r+s.getTextContent().slice(c+a)===ug(i.anchorNode)||H(e,Fr,r);const f=r.length;Pn&&f>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=f),ba||$i||Oa||!e.isComposing()||(_s=0,He(null))}else Wa(!1,e,r!==null?r:void 0),ys&&(lu(e,r||void 0),ys=!1);dt(),Vh(Ee())}),zr=null}],["click",function(n,e){wt(e,()=>{const t=he(),r=tn(e._window),o=Jr();if(r){if(te(t)){const s=t.anchor,i=s.getNode();s.type==="element"&&s.offset===0&&t.isCollapsed()&&!mt(i)&&Et().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&o!==null&&t.is(o)?(r.removeAllRanges(),t.dirty=!0):n.detail===3&&!t.isCollapsed()&&i!==t.focus.getNode()&&(R(i)?i.select(0):i.getParentOrThrow().select(0))}else if(n.pointerType==="touch"){const s=r.anchorNode;if(s!==null){const i=s.nodeType;(i===ts||i===In)&&en(ol(o,r,e,n))}}}H(e,Sh,n)})}],["cut",pn],["copy",pn],["dragstart",pn],["dragover",pn],["dragend",pn],["paste",pn],["focus",pn],["blur",pn],["drop",pn]];Ri&&ou.push(["beforeinput",(n,e)=>function(t,r){const o=t.inputType,s=Lg(t);o==="deleteCompositionText"||Pn&&_g(r)||o!=="insertCompositionText"&&wt(r,()=>{const i=he();if(o==="deleteContentBackward"){if(i===null){const h=Jr();if(!te(h))return;en(h.clone())}if(te(i)){const h=i.anchor.key===i.focus.key;if(l=t.timeStamp,Ag==="MediaLast"&&l<_s+ru&&r.isComposing()&&h){if(He(null),_s=0,setTimeout(()=>{wt(r,()=>{He(null)})},ru),te(i)){const g=i.anchor.getNode();g.markDirty(),i.format=g.getFormat(),X(g)||K(142),i.style=g.getStyle()}}else{He(null),t.preventDefault();const g=i.anchor.getNode().getTextContent(),p=i.anchor.offset===0&&i.focus.offset===g.length;jS&&h&&!p||H(r,qo,!0)}return}}var l;if(!te(i))return;const c=t.data;zr!==null&&Wa(!1,r,zr),i.dirty&&zr===null||!i.isCollapsed()||mt(i.anchor.getNode())||s===null||i.applyDOMRange(s),zr=null;const a=i.anchor,f=i.focus,d=a.getNode(),u=f.getNode();if(o!=="insertText"&&o!=="insertTranspose")switch(t.preventDefault(),o){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":H(r,Fr,t);break;case"insertFromComposition":He(null),H(r,Fr,t);break;case"insertLineBreak":He(null),H(r,Qo,!1);break;case"insertParagraph":He(null),ms&&!$i?(ms=!1,H(r,Qo,!1)):H(r,ya,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":H(r,Ca,t);break;case"deleteByComposition":(function(h,g){return h!==g||R(h)||R(g)||!h.isToken()||!g.isToken()})(d,u)&&H(r,Na,t);break;case"deleteByDrag":case"deleteByCut":H(r,Na,t);break;case"deleteContent":H(r,qo,!1);break;case"deleteWordBackward":H(r,Zo,!0);break;case"deleteWordForward":H(r,Zo,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":H(r,es,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":H(r,es,!1);break;case"formatStrikeThrough":H(r,$n,"strikethrough");break;case"formatBold":H(r,$n,"bold");break;case"formatItalic":H(r,$n,"italic");break;case"formatUnderline":H(r,$n,"underline");break;case"historyUndo":H(r,Sa,void 0);break;case"historyRedo":H(r,Ta,void 0)}else{if(c===`
24
+ `)t.preventDefault(),H(r,Qo,!1);else if(c===hn)t.preventDefault(),H(r,ya,void 0);else if(c==null&&t.dataTransfer){const h=t.dataTransfer.getData("text/plain");t.preventDefault(),i.insertRawText(h)}else c!=null&&$g(i,s,c,t.timeStamp,!0)?(t.preventDefault(),H(r,Fr,c)):zr=c;kg=t.timeStamp}})}(n,e)]);let _s=0,Ag=null,kg=0,zr=null;const Qi=new WeakMap;let su=!1,iu=!1,ms=!1,ys=!1,Rg=[0,"",0,"root",0];function $g(n,e,t,r,o){const s=n.anchor,i=n.focus,l=s.getNode(),c=Ee(),a=tn(c._window),f=a!==null?a.anchorNode:null,d=s.key,u=c.getElementByKey(d),h=t.length;return d!==i.key||!X(l)||(!o&&(!Ri||kg<r+50)||l.isDirty()&&h<2||cg(t))&&s.offset!==i.offset&&!l.isComposing()||ar(l)||l.isDirty()&&h>1||(o||!Ri)&&u!==null&&!l.isComposing()&&f!==Bi(u)||a!==null&&e!==null&&(!e.collapsed||e.startContainer!==a.anchorNode||e.startOffset!==a.anchorOffset)||l.getFormat()!==n.format||l.getStyle()!==n.style||gT(n,l)}function Pg(n,e){return n!==null&&n.nodeValue!==null&&n.nodeType===In&&e!==0&&e!==n.nodeValue.length}function Ig(n,e,t){const{anchorNode:r,anchorOffset:o,focusNode:s,focusOffset:i}=n;su&&(su=!1,Pg(r,o)&&Pg(s,i))||wt(e,()=>{if(!t)return void en(null);if(!os(e,r,s))return;const l=he();if(te(l)){const c=l.anchor,a=c.getNode();if(l.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(l.dirty=!0);const f=Hi(e).event,d=f?f.timeStamp:performance.now(),[u,h,g,p,_]=Rg,y=Et(),m=e.isComposing()===!1&&y.getTextContent()==="";if(d<_+200&&c.offset===g&&c.key===p)l.format=u,l.style=h;else if(c.type==="text")X(a)||K(141),l.format=a.getFormat(),l.style=a.getStyle();else if(c.type==="element"&&!m){const C=c.getNode();l.style="",C instanceof pr&&C.getChildrenSize()===0?(l.format=C.getTextFormat(),l.style=C.getTextStyle()):l.format=0}}else{const f=c.key,d=l.focus.key,u=l.getNodes(),h=u.length,g=l.isBackward(),p=g?i:o,_=g?o:i,y=g?d:f,m=g?f:d;let C=jh,N=!1;for(let S=0;S<h;S++){const T=u[S],E=T.getTextContentSize();if(X(T)&&E!==0&&!(S===0&&T.__key===y&&p===E||S===h-1&&T.__key===m&&_===0)&&(N=!0,C&=T.getFormat(),C===0))break}l.format=N?C:0}}H(e,Ai,void 0)})}function Lg(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function lu(n,e){const t=n._compositionKey;if(He(null),t!==null&&e!=null){if(e===""){const r=et(t),o=Bi(n.getElementByKey(t));return void(o!==null&&o.nodeValue!==null&&X(r)&&za(r,o.nodeValue,null,null,!0))}if(e[e.length-1]===`
25
+ `){const r=he();if(te(r)){const o=r.focus;return r.anchor.set(o.key,o.offset,o.type),void H(n,ki,null)}}}Wa(!0,n,e)}function Fg(n){let e=n.__lexicalEventHandles;return e===void 0&&(e=[],n.__lexicalEventHandles=e),e}const jr=new Map;function Bg(n){const e=n.target,t=tn(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const r=Fa(t.anchorNode);if(r===null)return;iu&&(iu=!1,wt(r,()=>{const a=Jr(),f=t.anchorNode;if(f===null)return;const d=f.nodeType;d!==ts&&d!==In||en(ol(a,t,r,n))}));const o=Ka(r),s=o[o.length-1],i=s._key,l=jr.get(i),c=l||s;c!==r&&Ig(t,c,!1),Ig(t,r,!0),r!==s?jr.set(i,r):l&&jr.delete(i)}function Kg(n){n._lexicalHandled=!0}function Wg(n){return n._lexicalHandled===!0}function MT(n){const e=n.ownerDocument,t=Qi.get(e);t===void 0&&K(162);const r=t-1;r>=0||K(164),Qi.set(e,r),r===0&&e.removeEventListener("selectionchange",Bg);const o=ss(n);Fi(o)?(function(i){if(i._parentEditor!==null){const l=Ka(i),c=l[l.length-1]._key;jr.get(c)===i&&jr.delete(c)}else jr.delete(i._key)}(o),n.__lexicalEditor=null):o&&K(198);const s=Fg(n);for(let i=0;i<s.length;i++)s[i]();n.__lexicalEventHandles=[]}function cu(n,e,t){dt();const r=n.__key,o=n.getParent();if(o===null)return;const s=function(l){const c=he();if(!te(c)||!R(l))return c;const{anchor:a,focus:f}=c,d=a.getNode(),u=f.getNode();return Ui(d,l)&&a.set(l.__key,0,"element"),Ui(u,l)&&f.set(l.__key,0,"element"),c}(n);let i=!1;if(te(s)&&e){const l=s.anchor,c=s.focus;l.key===r&&(il(l,n,o,n.getPreviousSibling(),n.getNextSibling()),i=!0),c.key===r&&(il(c,n,o,n.getPreviousSibling(),n.getNextSibling()),i=!0)}else Cs(s)&&e&&n.isSelected()&&n.selectPrevious();if(te(s)&&e&&!i){const l=n.getIndexWithinParent();ur(n),sl(s,o,l,-1)}else ur(n);t||Fn(o)||o.canBeEmpty()||!o.isEmpty()||cu(o,e),e&&mt(o)&&o.isEmpty()&&o.selectEnd()}class Zi{static getType(){K(64,this.name)}static clone(e){K(65,this.name)}afterCloneFrom(e){this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev}constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,ng(this,e)}getType(){return this.__type}isInline(){K(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=et(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||he();if(t==null)return!1;const r=t.getNodes().some(o=>o.__key===this.__key);if(X(this))return r;if(te(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const o=this.getParent();if(we(this)&&this.isInline()&&o){const s=t.isBackward()?t.focus:t.anchor,i=s.getNode();if(s.offset===i.getChildrenSize()&&i.is(o)&&i.getLastChildOrThrow().is(this))return!1}}return r}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),r=0;for(;t!==null;){if(this.is(t))return r;r++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:et(e)}getParentOrThrow(){const e=this.getParent();return e===null&&K(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(Fn(t))return R(e)||e===this&&we(e)||K(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&K(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:et(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(t===null)return e;let r=t.getFirstChild();for(;r!==null&&!r.is(this);)e.push(r),r=r.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return e===null?null:et(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=this.getParents(),r=e.getParents();R(this)&&t.unshift(this),R(e)&&r.unshift(e);const o=t.length,s=r.length;if(o===0||s===0||t[o-1]!==r[s-1])return null;const i=new Set(r);for(let l=0;l<o;l++){const c=t[l];if(i.has(c))return c}return null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){if(this===e)return!1;if(e.isParentOf(this))return!0;if(this.isParentOf(e))return!1;const t=this.getCommonAncestor(e);let r=0,o=0,s=this;for(;;){const i=s.getParentOrThrow();if(i===t){r=s.getIndexWithinParent();break}s=i}for(s=e;;){const i=s.getParentOrThrow();if(i===t){o=s.getIndexWithinParent();break}s=i}return r<o}isParentOf(e){const t=this.__key;if(t===e.__key)return!1;let r=e;for(;r!==null;){if(r.__key===t)return!0;r=r.getParent()}return!1}getNodesBetween(e){const t=this.isBefore(e),r=[],o=new Set;let s=this;for(;s!==null;){const i=s.__key;if(o.has(i)||(o.add(i),r.push(s)),s===e)break;const l=R(s)?t?s.getFirstChild():s.getLastChild():null;if(l!==null){s=l;continue}const c=t?s.getNextSibling():s.getPreviousSibling();if(c!==null){s=c;continue}const a=s.getParentOrThrow();if(o.has(a.__key)||r.push(a),a===e)break;let f=null,d=a;do{if(d===null&&K(68),f=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d===null)break;f!==null||o.has(d.__key)||r.push(d)}while(f===null);s=f}return t||r.reverse(),r}isDirty(){const e=Ee()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=et(this.__key);return e===null&&K(113),e}getWritable(){dt();const e=rn(),t=Ee(),r=e._nodeMap,o=this.__key,s=this.getLatest(),i=t._cloneNotNeeded,l=he();if(l!==null&&l.setCachedNodes(null),i.has(o))return Ki(s),s;const c=Tg(s);return i.add(o),Ki(c),r.set(o,c),c}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){K(70)}updateDOM(e,t,r){K(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){K(72)}static importJSON(e){K(18,this.name)}static transform(){return null}remove(e){cu(this,!0,e)}replace(e,t){dt();let r=he();r!==null&&(r=r.clone()),Ha(this,e);const o=this.getLatest(),s=this.__key,i=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;ur(l);const f=o.getPreviousSibling(),d=o.getNextSibling(),u=o.__prev,h=o.__next,g=o.__parent;if(cu(o,!1,!0),f===null?c.__first=i:f.getWritable().__next=i,l.__prev=u,d===null?c.__last=i:d.getWritable().__prev=i,l.__next=h,l.__parent=g,c.__size=a,t&&(R(this)&&R(l)||K(139),this.getChildren().forEach(p=>{l.append(p)})),te(r)){en(r);const p=r.anchor,_=r.focus;p.key===s&&Vg(p,l),_.key===s&&Vg(_,l)}return Ln()===s&&He(i),l}insertAfter(e,t=!0){dt(),Ha(this,e);const r=this.getWritable(),o=e.getWritable(),s=o.getParent(),i=he();let l=!1,c=!1;if(s!==null){const h=e.getIndexWithinParent();if(ur(o),te(i)){const g=s.__key,p=i.anchor,_=i.focus;l=p.type==="element"&&p.key===g&&p.offset===h+1,c=_.type==="element"&&_.key===g&&_.offset===h+1}}const a=this.getNextSibling(),f=this.getParentOrThrow().getWritable(),d=o.__key,u=r.__next;if(a===null?f.__last=d:a.getWritable().__prev=d,f.__size++,r.__next=d,o.__next=u,o.__prev=r.__key,o.__parent=r.__parent,t&&te(i)){const h=this.getIndexWithinParent();sl(i,f,h+1);const g=f.__key;l&&i.anchor.set(g,h+2,"element"),c&&i.focus.set(g,h+2,"element")}return e}insertBefore(e,t=!0){dt(),Ha(this,e);const r=this.getWritable(),o=e.getWritable(),s=o.__key;ur(o);const i=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),c=r.__prev,a=this.getIndexWithinParent();i===null?l.__first=s:i.getWritable().__next=s,l.__size++,r.__prev=s,o.__prev=c,o.__next=r.__key,o.__parent=r.__parent;const f=he();return t&&te(f)&&sl(f,this.getParentOrThrow(),a),e}isParentRequired(){return!1}createParentElementNode(){return _n()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){dt();const r=this.getPreviousSibling(),o=this.getParentOrThrow();if(r===null)return o.select(0,0);if(R(r))return r.select();if(!X(r)){const s=r.getIndexWithinParent()+1;return o.select(s,s)}return r.select(e,t)}selectNext(e,t){dt();const r=this.getNextSibling(),o=this.getParentOrThrow();if(r===null)return o.select();if(R(r))return r.select(0,0);if(!X(r)){const s=r.getIndexWithinParent();return o.select(s,s)}return r.select(e,t)}markDirty(){this.getWritable()}}class Ur extends Zi{static getType(){return"linebreak"}static clone(e){return new Ur(e.__key)}constructor(e){super(e)}getTextContent(){return`
26
+ `}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const r=t.parentElement;if(r!==null&&Va(r)){const o=r.firstChild;if(o===t||o.nextSibling===t&&el(o)){const s=r.lastChild;if(s===t||s.previousSibling===t&&el(s))return!0}}return!1}(e)||function(t){const r=t.parentElement;if(r!==null&&Va(r)){const o=r.firstChild;if(o===t||o.nextSibling===t&&el(o))return!1;const s=r.lastChild;if(s===t||s.previousSibling===t&&el(s))return!0}return!1}(e)?null:{conversion:DT,priority:0}}}static importJSON(e){return Hr()}exportJSON(){return{type:"linebreak",version:1}}}function DT(n){return{node:Hr()}}function Hr(){return fs(new Ur)}function hr(n){return n instanceof Ur}function el(n){return n.nodeType===In&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}function au(n,e){return 16&e?"code":e&Pi?"mark":32&e?"sub":64&e?"sup":null}function uu(n,e){return 1&e?"strong":2&e?"em":"span"}function zg(n,e,t,r,o){const s=r.classList;let i=us(o,"base");i!==void 0&&s.add(...i),i=us(o,"underlineStrikethrough");let l=!1;const c=e&rs&&e&ns;i!==void 0&&(t&rs&&t&ns?(l=!0,c||s.add(...i)):c&&s.remove(...i));for(const a in Zt){const f=Zt[a];if(i=us(o,a),i!==void 0)if(t&f){if(l&&(a==="underline"||a==="strikethrough")){e&f&&s.remove(...i);continue}e&f&&(!c||a!=="underline")&&a!=="strikethrough"||s.add(...i)}else e&f&&s.remove(...i)}}function jg(n,e,t){const r=e.firstChild,o=t.isComposing(),s=n+(o?Ii:"");if(r==null)e.textContent=s;else{const i=r.nodeValue;if(i!==s)if(o||Pn){const[l,c,a]=function(f,d){const u=f.length,h=d.length;let g=0,p=0;for(;g<u&&g<h&&f[g]===d[g];)g++;for(;p+g<u&&p+g<h&&f[u-p-1]===d[h-p-1];)p++;return[g,u-g-p,d.slice(g,h-p)]}(i,s);c!==0&&r.deleteData(l,c),r.insertData(l,a)}else r.nodeValue=s}}function Ug(n,e,t,r,o,s){jg(o,n,e);const i=s.theme.text;i!==void 0&&zg(0,0,r,n,i)}function tl(n,e){const t=document.createElement(e);return t.appendChild(n),t}class gr extends Zi{static getType(){return"text"}static clone(e){return new gr(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e,t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return oT[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Ln()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=Zt[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Ba(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const r=this.__format,o=au(0,r),s=uu(0,r),i=o===null?s:o,l=document.createElement(i);let c=l;this.hasFormat("code")&&l.setAttribute("spellcheck","false"),o!==null&&(c=document.createElement(s),l.appendChild(c)),Ug(c,this,0,r,this.__text,e);const a=this.__style;return a!==""&&(l.style.cssText=a),l}updateDOM(e,t,r){const o=this.__text,s=e.__format,i=this.__format,l=au(0,s),c=au(0,i),a=uu(0,s),f=uu(0,i);if((l===null?a:l)!==(c===null?f:c))return!0;if(l===c&&a!==f){const p=t.firstChild;p==null&&K(48);const _=document.createElement(f);return Ug(_,this,0,i,o,r),t.replaceChild(_,p),!1}let d=t;c!==null&&l!==null&&(d=t.firstChild,d==null&&K(49)),jg(o,d,this);const u=r.theme.text;u!==void 0&&s!==i&&zg(0,s,i,d,u);const h=e.__style,g=this.__style;return h!==g&&(t.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:$T,priority:0}),b:()=>({conversion:kT,priority:0}),code:()=>({conversion:Kn,priority:0}),em:()=>({conversion:Kn,priority:0}),i:()=>({conversion:Kn,priority:0}),s:()=>({conversion:Kn,priority:0}),span:()=>({conversion:AT,priority:0}),strong:()=>({conversion:Kn,priority:0}),sub:()=>({conversion:Kn,priority:0}),sup:()=>({conversion:Kn,priority:0}),u:()=>({conversion:Kn,priority:0})}}static importJSON(e){const t=tt(e.text);return t.setFormat(e.format),t.setDetail(e.detail),t.setMode(e.mode),t.setStyle(e.style),t}exportDOM(e){let{element:t}=super.exportDOM(e);return t!==null&&Yi(t)||K(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=tl(t,"b")),this.hasFormat("italic")&&(t=tl(t,"i")),this.hasFormat("strikethrough")&&(t=tl(t,"s")),this.hasFormat("underline")&&(t=tl(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format=typeof e=="string"?Zt[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?tT[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Ba(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=rT[e];if(this.__mode===t)return this;const r=this.getWritable();return r.__mode=t,r}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){dt();let r=e,o=t;const s=he(),i=this.getTextContent(),l=this.__key;if(typeof i=="string"){const c=i.length;r===void 0&&(r=c),o===void 0&&(o=c)}else r=0,o=0;if(!te(s))return tp(l,r,l,o,"text","text");{const c=Ln();c!==s.anchor.key&&c!==s.focus.key||He(l),s.setTextNodeRange(this,r,this,o)}return s}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,r,o){const s=this.getWritable(),i=s.__text,l=r.length;let c=e;c<0&&(c=l+c,c<0&&(c=0));const a=he();if(o&&te(a)){const d=e+l;a.setTextNodeRange(s,d,s,d)}const f=i.slice(0,c)+r+i.slice(c+t);return s.__text=f,s}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){dt();const t=this.getLatest(),r=t.getTextContent(),o=t.__key,s=Ln(),i=new Set(e),l=[],c=r.length;let a="";for(let S=0;S<c;S++)a!==""&&i.has(S)&&(l.push(a),a=""),a+=r[S];a!==""&&l.push(a);const f=l.length;if(f===0)return[];if(l[0]===r)return[t];const d=l[0],u=t.getParent();let h;const g=t.getFormat(),p=t.getStyle(),_=t.__detail;let y=!1;t.isSegmented()?(h=tt(d),h.__format=g,h.__style=p,h.__detail=_,y=!0):(h=t.getWritable(),h.__text=d);const m=he(),C=[h];let N=d.length;for(let S=1;S<f;S++){const T=l[S],E=T.length,x=tt(T).getWritable();x.__format=g,x.__style=p,x.__detail=_;const w=x.__key,O=N+E;if(te(m)){const D=m.anchor,B=m.focus;D.key===o&&D.type==="text"&&D.offset>N&&D.offset<=O&&(D.key=w,D.offset-=N,m.dirty=!0),B.key===o&&B.type==="text"&&B.offset>N&&B.offset<=O&&(B.key=w,B.offset-=N,m.dirty=!0)}s===o&&He(w),N=O,C.push(x)}if(u!==null){(function(E){const x=E.getPreviousSibling(),w=E.getNextSibling();x!==null&&Ki(x),w!==null&&Ki(w)})(this);const S=u.getWritable(),T=this.getIndexWithinParent();y?(S.splice(T,0,C),this.remove()):S.splice(T,1,C),te(m)&&sl(m,u,T,f-1)}return C}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||K(50);const r=this.__key,o=e.__key,s=this.__text,i=s.length;Ln()===o&&He(r);const l=he();if(te(l)){const d=l.anchor,u=l.focus;d!==null&&d.key===o&&(rp(d,t,r,e,i),l.dirty=!0),u!==null&&u.key===o&&(rp(u,t,r,e,i),l.dirty=!0)}const c=e.__text,a=t?c+s:s+c;this.setTextContent(a);const f=this.getWritable();return e.remove(),f}isTextEntity(){return!1}}function AT(n){return{forChild:fu(n.style),node:null}}function kT(n){const e=n,t=e.style.fontWeight==="normal";return{forChild:fu(e.style,t?void 0:"bold"),node:null}}const Hg=new WeakMap;function RT(n){return n.nodeName==="PRE"||n.nodeType===ts&&n.style!==void 0&&n.style.whiteSpace!==void 0&&n.style.whiteSpace.startsWith("pre")}function $T(n){const e=n;n.parentElement===null&&K(129);let t=e.textContent||"";if(function(r){let o,s=r.parentNode;const i=[r];for(;s!==null&&(o=Hg.get(s))===void 0&&!RT(s);)i.push(s),s=s.parentNode;const l=o===void 0?s:o;for(let c=0;c<i.length;c++)Hg.set(i[c],l);return l}(e)!==null){const r=t.split(/(\r?\n|\t)/),o=[],s=r.length;for(let i=0;i<s;i++){const l=r[i];l===`
27
27
  `||l===`\r
28
- `?r.push(Ho()):l===" "?r.push(ol()):l!==""&&r.push(tt(l))}return{node:r}}if(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," "),t==="")return{node:null};if(t[0]===" "){let o=e,r=!0;for(;o!==null&&(o=jg(o,!1))!==null;){const s=o.textContent||"";if(s.length>0){/[ \t\n]$/.test(s)&&(t=t.slice(1)),r=!1;break}}r&&(t=t.slice(1))}if(t[t.length-1]===" "){let o=e,r=!0;for(;o!==null&&(o=jg(o,!0))!==null;)if((o.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){r=!1;break}r&&(t=t.slice(0,t.length-1))}return t===""?{node:null}:{node:tt(t)}}function jg(n,e){let t=n;for(;;){let o;for(;(o=e?t.nextSibling:t.previousSibling)===null;){const s=t.parentElement;if(s===null)return null;t=s}if(t=o,t.nodeType===ns){const s=t.style.display;if(s===""&&!mg(t)||s!==""&&!s.startsWith("inline"))return null}let r=t;for(;(r=e?t.firstChild:t.lastChild)!==null;)t=r;if(t.nodeType===In)return t;if(t.nodeName==="BR")return null}}const $T={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Kn(n){const e=$T[n.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:fu(n.style,e),node:null}}function tt(n=""){return ds(new po(n))}function q(n){return n instanceof po}function fu(n,e){const t=n.fontWeight,o=n.textDecoration.split(" "),r=t==="700"||t==="bold",s=o.includes("line-through"),i=n.fontStyle==="italic",l=o.includes("underline"),c=n.verticalAlign;return a=>(q(a)&&(r&&!a.hasFormat("bold")&&a.toggleFormat("bold"),s&&!a.hasFormat("strikethrough")&&a.toggleFormat("strikethrough"),i&&!a.hasFormat("italic")&&a.toggleFormat("italic"),l&&!a.hasFormat("underline")&&a.toggleFormat("underline"),c!=="sub"||a.hasFormat("subscript")||a.toggleFormat("subscript"),c!=="super"||a.hasFormat("superscript")||a.toggleFormat("superscript"),e&&!a.hasFormat(e)&&a.toggleFormat(e)),a)}class Yo extends po{static getType(){return"tab"}static clone(e){return new Yo(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}static importJSON(e){const t=ol();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){K(126)}setDetail(e){K(127)}setMode(e){K(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function ol(){return ds(new Yo)}function Hg(n){return n instanceof Yo}class PT{constructor(e,t,o){this._selection=null,this.key=e,this.offset=t,this.type=o}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode(),o=e.getNode();const r=this.offset,s=e.offset;if($(t)){const i=t.getDescendantByIndex(r);t=i??t}if($(o)){const i=o.getDescendantByIndex(s);o=i??o}return t===o?r<s:t.isBefore(o)}getNode(){const e=et(this.key);return e===null&&K(20),e}set(e,t,o){const r=this._selection,s=this.key;this.key=e,this.offset=t,this.type=o,Vo()||(Ln()===s&&He(e),r!==null&&(r.setCachedNodes(null),r.dirty=!0))}}function Wt(n,e,t){return new PT(n,e,t)}function du(n,e){let t=e.__key,o=n.offset,r="element";if(q(e)){r="text";const s=e.getTextContentSize();o>s&&(o=s)}else if(!$(e)){const s=e.getNextSibling();if(q(s))t=s.__key,o=0,r="text";else{const i=e.getParent();i&&(t=i.__key,o=e.getIndexWithinParent()+1)}}n.set(t,o,r)}function Yg(n,e){if($(e)){const t=e.getLastDescendant();$(t)||q(t)?du(n,t):du(n,e)}else du(n,e)}function Wn(n,e,t,o){n.key=e,n.offset=t,n.type=o}class rl{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Ns(e))return!1;const t=this._nodes,o=e._nodes;return t.size===o.size&&Array.from(t).every(r=>o.has(r))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new rl(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),o=t.length,r=t[o-1];let s;if(q(r))s=r.select();else{const i=r.getIndexWithinParent()+1;s=r.getParentOrThrow().select(i,i)}s.insertNodes(e);for(let i=0;i<o;i++)t[i].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,o=[];for(const r of t){const s=et(r);s!==null&&o.push(s)}return Vo()||(this._cachedNodes=o),o}getTextContent(){const e=this.getNodes();let t="";for(let o=0;o<e.length;o++)t+=e[o].getTextContent();return t}}function te(n){return n instanceof zn}class zn{constructor(e,t,o,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=o,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!te(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor,o=this.focus,r=t.isBefore(o),s=r?t:o,i=r?o:t;let l=s.getNode(),c=i.getNode();const a=s.offset,f=i.offset;if($(l)){const u=l.getDescendantByIndex(a);l=u??l}if($(c)){let u=c.getDescendantByIndex(f);u!==null&&u!==l&&c.getChildAtIndex(f)===u&&(u=u.getPreviousSibling()),c=u??c}let d;return d=l.is(c)?$(l)&&l.getChildrenSize()>0?[]:[l]:l.getNodesBetween(c),Vo()||(this._cachedNodes=d),d}setTextNodeRange(e,t,o,r){Wn(this.anchor,e.__key,t,"text"),Wn(this.focus,o.__key,r,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const t=e[0],o=e[e.length-1],r=this.anchor,s=this.focus,i=r.isBefore(s),[l,c]=hu(this);let a="",f=!0;for(let d=0;d<e.length;d++){const u=e[d];if($(u)&&!u.isInline())f||(a+=`
29
- `),f=!u.isEmpty();else if(f=!1,q(u)){let h=u.getTextContent();u===t?u===o?r.type==="element"&&s.type==="element"&&s.offset!==r.offset||(h=l<c?h.slice(l,c):h.slice(c,l)):h=i?h.slice(l):h.slice(c):u===o&&(h=i?h.slice(0,c):h.slice(0,l)),a+=h}else!we(u)&&!go(u)||u===o&&this.isCollapsed()||(a+=u.getTextContent())}return a}applyDOMRange(e){const t=Ee(),o=t.getEditorState()._selection,r=Qg(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,o);if(r===null)return;const[s,i]=r;Wn(this.anchor,s.key,s.offset,s.type),Wn(this.focus,i.key,i.offset,i.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new zn(Wt(e.key,e.offset,e.type),Wt(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Ba(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=en[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),o=[],r=t.length;for(let s=0;s<r;s++){const i=t[s];i===`
28
+ `?o.push(Hr()):l===" "?o.push(nl()):l!==""&&o.push(tt(l))}return{node:o}}if(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," "),t==="")return{node:null};if(t[0]===" "){let r=e,o=!0;for(;r!==null&&(r=Yg(r,!1))!==null;){const s=r.textContent||"";if(s.length>0){/[ \t\n]$/.test(s)&&(t=t.slice(1)),o=!1;break}}o&&(t=t.slice(1))}if(t[t.length-1]===" "){let r=e,o=!0;for(;r!==null&&(r=Yg(r,!0))!==null;)if((r.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){o=!1;break}o&&(t=t.slice(0,t.length-1))}return t===""?{node:null}:{node:tt(t)}}function Yg(n,e){let t=n;for(;;){let r;for(;(r=e?t.nextSibling:t.previousSibling)===null;){const s=t.parentElement;if(s===null)return null;t=s}if(t=r,t.nodeType===ts){const s=t.style.display;if(s===""&&!Cg(t)||s!==""&&!s.startsWith("inline"))return null}let o=t;for(;(o=e?t.firstChild:t.lastChild)!==null;)t=o;if(t.nodeType===In)return t;if(t.nodeName==="BR")return null}}const PT={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Kn(n){const e=PT[n.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:fu(n.style,e),node:null}}function tt(n=""){return fs(new gr(n))}function X(n){return n instanceof gr}function fu(n,e){const t=n.fontWeight,r=n.textDecoration.split(" "),o=t==="700"||t==="bold",s=r.includes("line-through"),i=n.fontStyle==="italic",l=r.includes("underline"),c=n.verticalAlign;return a=>(X(a)&&(o&&!a.hasFormat("bold")&&a.toggleFormat("bold"),s&&!a.hasFormat("strikethrough")&&a.toggleFormat("strikethrough"),i&&!a.hasFormat("italic")&&a.toggleFormat("italic"),l&&!a.hasFormat("underline")&&a.toggleFormat("underline"),c!=="sub"||a.hasFormat("subscript")||a.toggleFormat("subscript"),c!=="super"||a.hasFormat("superscript")||a.toggleFormat("superscript"),e&&!a.hasFormat(e)&&a.toggleFormat(e)),a)}class Yr extends gr{static getType(){return"tab"}static clone(e){return new Yr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}static importJSON(e){const t=nl();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){K(126)}setDetail(e){K(127)}setMode(e){K(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function nl(){return fs(new Yr)}function Jg(n){return n instanceof Yr}class IT{constructor(e,t,r){this._selection=null,this.key=e,this.offset=t,this.type=r}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){let t=this.getNode(),r=e.getNode();const o=this.offset,s=e.offset;if(R(t)){const i=t.getDescendantByIndex(o);t=i??t}if(R(r)){const i=r.getDescendantByIndex(s);r=i??r}return t===r?o<s:t.isBefore(r)}getNode(){const e=et(this.key);return e===null&&K(20),e}set(e,t,r){const o=this._selection,s=this.key;this.key=e,this.offset=t,this.type=r,Vr()||(Ln()===s&&He(e),o!==null&&(o.setCachedNodes(null),o.dirty=!0))}}function Kt(n,e,t){return new IT(n,e,t)}function du(n,e){let t=e.__key,r=n.offset,o="element";if(X(e)){o="text";const s=e.getTextContentSize();r>s&&(r=s)}else if(!R(e)){const s=e.getNextSibling();if(X(s))t=s.__key,r=0,o="text";else{const i=e.getParent();i&&(t=i.__key,r=e.getIndexWithinParent()+1)}}n.set(t,r,o)}function Vg(n,e){if(R(e)){const t=e.getLastDescendant();R(t)||X(t)?du(n,t):du(n,e)}else du(n,e)}function Wn(n,e,t,r){n.key=e,n.offset=t,n.type=r}class rl{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Cs(e))return!1;const t=this._nodes,r=e._nodes;return t.size===r.size&&Array.from(t).every(o=>r.has(o))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new rl(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),r=t.length,o=t[r-1];let s;if(X(o))s=o.select();else{const i=o.getIndexWithinParent()+1;s=o.getParentOrThrow().select(i,i)}s.insertNodes(e);for(let i=0;i<r;i++)t[i].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,r=[];for(const o of t){const s=et(o);s!==null&&r.push(s)}return Vr()||(this._cachedNodes=r),r}getTextContent(){const e=this.getNodes();let t="";for(let r=0;r<e.length;r++)t+=e[r].getTextContent();return t}}function te(n){return n instanceof zn}class zn{constructor(e,t,r,o){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=r,this.style=o,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!te(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor,r=this.focus,o=t.isBefore(r),s=o?t:r,i=o?r:t;let l=s.getNode(),c=i.getNode();const a=s.offset,f=i.offset;if(R(l)){const u=l.getDescendantByIndex(a);l=u??l}if(R(c)){let u=c.getDescendantByIndex(f);u!==null&&u!==l&&c.getChildAtIndex(f)===u&&(u=u.getPreviousSibling()),c=u??c}let d;return d=l.is(c)?R(l)&&l.getChildrenSize()>0?[]:[l]:l.getNodesBetween(c),Vr()||(this._cachedNodes=d),d}setTextNodeRange(e,t,r,o){Wn(this.anchor,e.__key,t,"text"),Wn(this.focus,r.__key,o,"text"),this._cachedNodes=null,this.dirty=!0}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const t=e[0],r=e[e.length-1],o=this.anchor,s=this.focus,i=o.isBefore(s),[l,c]=hu(this);let a="",f=!0;for(let d=0;d<e.length;d++){const u=e[d];if(R(u)&&!u.isInline())f||(a+=`
29
+ `),f=!u.isEmpty();else if(f=!1,X(u)){let h=u.getTextContent();u===t?u===r?o.type==="element"&&s.type==="element"&&s.offset!==o.offset||(h=l<c?h.slice(l,c):h.slice(c,l)):h=i?h.slice(l):h.slice(c):u===r&&(h=i?h.slice(0,c):h.slice(0,l)),a+=h}else!we(u)&&!hr(u)||u===r&&this.isCollapsed()||(a+=u.getTextContent())}return a}applyDOMRange(e){const t=Ee(),r=t.getEditorState()._selection,o=ep(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,r);if(o===null)return;const[s,i]=o;Wn(this.anchor,s.key,s.offset,s.type),Wn(this.focus,i.key,i.offset,i.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new zn(Kt(e.key,e.offset,e.type),Kt(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Ba(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=Zt[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),r=[],o=t.length;for(let s=0;s<o;s++){const i=t[s];i===`
30
30
  `||i===`\r
31
- `?o.push(Ho()):i===" "?o.push(ol()):o.push(tt(i))}this.insertNodes(o)}insertText(e){const t=this.anchor,o=this.focus,r=this.format,s=this.style;let i=t,l=o;!this.isCollapsed()&&o.isBefore(t)&&(i=o,l=t),i.type==="element"&&function(_,y,m,C){const N=_.getNode(),S=N.getChildAtIndex(_.offset),T=tt(),b=mt(N)?mn().append(T):T;T.setFormat(m),T.setStyle(C),S===null?N.append(b):S.insertBefore(b),_.is(y)&&y.set(T.__key,0,"text"),_.set(T.__key,0,"text")}(i,l,r,s);const c=i.offset;let a=l.offset;const f=this.getNodes(),d=f.length;let u=f[0];q(u)||K(26);const h=u.getTextContent().length,g=u.getParentOrThrow();let p=f[d-1];if(d===1&&l.type==="element"&&(a=h,l.set(i.key,a,"text")),this.isCollapsed()&&c===h&&(u.isSegmented()||u.isToken()||!u.canInsertTextAfter()||!g.canInsertTextAfter()&&u.getNextSibling()===null)){let _=u.getNextSibling();if(q(_)&&_.canInsertTextBefore()&&!ao(_)||(_=tt(),_.setFormat(r),_.setStyle(s),g.canInsertTextAfter()?u.insertAfter(_):g.insertAfter(_)),_.select(0,0),u=_,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&c===0&&(u.isSegmented()||u.isToken()||!u.canInsertTextBefore()||!g.canInsertTextBefore()&&u.getPreviousSibling()===null)){let _=u.getPreviousSibling();if(q(_)&&!ao(_)||(_=tt(),_.setFormat(r),g.canInsertTextBefore()?u.insertBefore(_):g.insertBefore(_)),_.select(),u=_,e!=="")return void this.insertText(e)}else if(u.isSegmented()&&c!==h){const _=tt(u.getTextContent());_.setFormat(r),u.replace(_),u=_}else if(!this.isCollapsed()&&e!==""){const _=p.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||$(_)&&(!_.canInsertTextBefore()||!_.canInsertTextAfter()))return this.insertText(""),qg(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(u.isToken()){const C=tt(e);return C.select(),void u.replace(C)}const _=u.getFormat(),y=u.getStyle();if(c!==a||_===r&&y===s){if(Hg(u)){const C=tt(e);return C.setFormat(r),C.setStyle(s),C.select(),void u.replace(C)}}else{if(u.getTextContent()!==""){const C=tt(e);if(C.setFormat(r),C.setStyle(s),C.select(),c===0)u.insertBefore(C,!1);else{const[N]=u.splitText(c);N.insertAfter(C,!1)}return void(C.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}u.setFormat(r),u.setStyle(s)}const m=a-c;u=u.spliceText(c,m,e,!0),u.getTextContent()===""?u.remove():this.anchor.type==="text"&&(u.isComposing()?this.anchor.offset-=e.length:(this.format=_,this.style=y))}else{const _=new Set([...u.getParentKeys(),...p.getParentKeys()]),y=$(u)?u:u.getParentOrThrow();let m=$(p)?p:p.getParentOrThrow(),C=p;if(!y.is(m)&&m.isInline())do C=m,m=m.getParentOrThrow();while(m.isInline());if(l.type==="text"&&(a!==0||p.getTextContent()==="")||l.type==="element"&&p.getIndexWithinParent()<a)if(q(p)&&!p.isToken()&&a!==p.getTextContentSize()){if(p.isSegmented()){const x=tt(p.getTextContent());p.replace(x),p=x}mt(l.getNode())||l.type!=="text"||(p=p.spliceText(0,a,"")),_.add(p.__key)}else{const x=p.getParentOrThrow();x.canBeEmpty()||x.getChildrenSize()!==1?p.remove():x.remove()}else _.add(p.__key);const N=m.getChildren(),S=new Set(f),T=y.is(m),b=y.isInline()&&u.getNextSibling()===null?y:u;for(let x=N.length-1;x>=0;x--){const w=N[x];if(w.is(u)||$(w)&&w.isParentOf(u))break;w.isAttached()&&(!S.has(w)||w.is(C)?T||b.insertAfter(w,!1):w.remove())}if(!T){let x=m,w=null;for(;x!==null;){const O=x.getChildren(),D=O.length;(D===0||O[D-1].is(w))&&(_.delete(x.__key),w=x),x=x.getParent()}}if(u.isToken())if(c===h)u.select();else{const x=tt(e);x.select(),u.replace(x)}else u=u.spliceText(c,h-c,e,!0),u.getTextContent()===""?u.remove():u.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let x=1;x<d;x++){const w=f[x],O=w.__key;_.has(O)||w.remove()}}}removeText(){this.insertText("")}formatText(e){if(this.isCollapsed())return this.toggleFormat(e),void He(null);const t=this.getNodes(),o=[];for(const m of t)q(m)&&o.push(m);const r=o.length;if(r===0)return this.toggleFormat(e),void He(null);const s=this.anchor,i=this.focus,l=this.isBackward(),c=l?i:s,a=l?s:i;let f=0,d=o[0],u=c.type==="element"?0:c.offset;if(c.type==="text"&&u===d.getTextContentSize()&&(f=1,d=o[1],u=0),d==null)return;const h=d.getFormatFlags(e,null),g=r-1;let p=o[g];const _=a.type==="text"?a.offset:p.getTextContentSize();if(d.is(p)){if(u===_)return;if(ao(d)||u===0&&_===d.getTextContentSize())d.setFormat(h);else{const m=d.splitText(u,_),C=u===0?m[0]:m[1];C.setFormat(h),c.type==="text"&&c.set(C.__key,0,"text"),a.type==="text"&&a.set(C.__key,_-u,"text")}return void(this.format=h)}u===0||ao(d)||([,d]=d.splitText(u),u=0),d.setFormat(h);const y=p.getFormatFlags(e,h);_>0&&(_===p.getTextContentSize()||ao(p)||([p]=p.splitText(_)),p.setFormat(y));for(let m=f+1;m<g;m++){const C=o[m],N=C.getFormatFlags(e,y);C.setFormat(N)}c.type==="text"&&c.set(d.__key,u,"text"),a.type==="text"&&a.set(p.__key,_,"text"),this.format=h|y}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const h=ge();return te(h)||K(134),h.insertNodes(e)}const t=Ga((this.isBackward()?this.focus:this.anchor).getNode(),Wo),o=e[e.length-1];if("__language"in t&&$(t)){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const h=pu(this);t.splice(h,0,e),o.selectEnd()}return}if(!e.some(h=>($(h)||we(h))&&!h.isInline())){$(t)||K(135);const h=pu(this);return t.splice(h,0,e),void o.selectEnd()}const r=function(h){const g=mn();let p=null;for(let _=0;_<h.length;_++){const y=h[_],m=go(y);if(m||we(y)&&y.isInline()||$(y)&&y.isInline()||q(y)||y.isParentRequired()){if(p===null&&(p=y.createParentElementNode(),g.append(p),m))continue;p!==null&&p.append(y)}else g.append(y),p=null}return g}(e),s=r.getLastDescendant(),i=r.getChildren(),l=!$(t)||!t.isEmpty()?this.insertParagraph():null,c=i[i.length-1];let a=i[0];var f;$(f=a)&&Wo(f)&&!f.isEmpty()&&$(t)&&(!t.isEmpty()||t.canMergeWhenEmpty())&&($(t)||K(135),t.append(...a.getChildren()),a=i[1]),a&&function(h,g,p){const _=g.getParentOrThrow().getLastChild();let y=g;const m=[g];for(;y!==_;)y.getNextSibling()||K(140),y=y.getNextSibling(),m.push(y);let C=h;for(const N of m)C=C.insertAfter(N)}(t,a);const d=Ga(s,Wo);l&&$(d)&&(l.canMergeWhenEmpty()||Wo(c))&&(d.append(...l.getChildren()),l.remove()),$(t)&&t.isEmpty()&&t.remove(),s.selectEnd();const u=$(t)?t.getLastChild():null;go(u)&&d!==t&&u.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=mn();return Et().splice(this.anchor.offset,0,[i]),i.select(),i}const e=pu(this),t=Ga(this.anchor.getNode(),Wo);$(t)||K(136);const o=t.getChildAtIndex(e),r=o?[o,...o.getNextSiblings()]:[],s=t.insertNewAfter(this,!1);return s?(s.append(...r),s.selectStart(),s):null}insertLineBreak(e){const t=Ho();if(this.insertNodes([t]),e){const o=t.getParentOrThrow(),r=t.getIndexWithinParent();o.select(r,r)}}extract(){const e=this.getNodes(),t=e.length,o=t-1,r=this.anchor,s=this.focus;let i=e[0],l=e[o];const[c,a]=hu(this);if(t===0)return[];if(t===1){if(q(i)&&!this.isCollapsed()){const d=c>a?a:c,u=c>a?c:a,h=i.splitText(d,u),g=d===0?h[0]:h[1];return g!=null?[g]:[]}return[i]}const f=r.isBefore(s);if(q(i)){const d=f?c:a;d===i.getTextContentSize()?e.shift():d!==0&&([,i]=i.splitText(d),e[0]=i)}if(q(l)){const d=l.getTextContent().length,u=f?a:c;u===0?e.pop():u!==d&&([l]=l.splitText(u),e[o]=l)}return e}modify(e,t,o){const r=this.focus,s=this.anchor,i=e==="move",l=ja(r,t);if(we(l)&&!l.isIsolated()){if(i&&l.isKeyboardSelectable()){const h=gu();return h.add(l.__key),void tn(h)}const u=t?l.getPreviousSibling():l.getNextSibling();if(q(u)){const h=u.__key,g=t?u.getTextContent().length:0;return r.set(h,g,"text"),void(i&&s.set(h,g,"text"))}{const h=l.getParentOrThrow();let g,p;return $(u)?(p=u.__key,g=t?u.getChildrenSize():0):(g=l.getIndexWithinParent(),p=h.__key,t||g++),r.set(p,g,"element"),void(i&&s.set(p,g,"element"))}}const c=Ee(),a=nn(c._window);if(!a)return;const f=c._blockCursorElement,d=c._rootElement;if(d===null||f===null||!$(l)||l.isInline()||l.canBeEmpty()||Ja(f,c,d),function(u,h,g,p){u.modify(h,g,p)}(a,e,t?"backward":"forward",o),a.rangeCount>0){const u=a.getRangeAt(0),h=this.anchor.getNode(),g=mt(h)?h:pg(h);if(this.applyDOMRange(u),this.dirty=!0,!i){const p=this.getNodes(),_=[];let y=!1;for(let m=0;m<p.length;m++){const C=p[m];Hi(C,g)?_.push(C):y=!0}if(y&&_.length>0)if(t){const m=_[0];$(m)?m.selectStart():m.getParentOrThrow().selectStart()}else{const m=_[_.length-1];$(m)?m.selectEnd():m.getParentOrThrow().selectEnd()}a.anchorNode===u.startContainer&&a.anchorOffset===u.startOffset||function(m){const C=m.focus,N=m.anchor,S=N.key,T=N.offset,b=N.type;Wn(N,C.key,C.offset,C.type),Wn(C,S,T,b),m._cachedNodes=null}(this)}}}forwardDeletion(e,t,o){if(!o&&(e.type==="element"&&$(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const r=t.getParent(),s=t.getNextSibling()||(r===null?null:r.getNextSibling());if($(s)&&s.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const o=this.anchor;let r=o.getNode();if(this.forwardDeletion(o,r,e))return;const s=this.focus,i=ja(s,e);if(we(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&$(r)&&r.getChildrenSize()===0){r.remove();const l=gu();l.add(i.__key),tn(l)}else i.remove(),Ee().dispatchCommand(ki,void 0);return}if(!e&&$(i)&&$(r)&&r.isEmpty())return r.remove(),void i.selectStart();if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&o.offset===0&&(o.type==="element"?o.getNode():o.getNode().getParentOrThrow()).collapseAtStart(this))return}else{const l=s.type==="text"?s.getNode():null;if(r=o.type==="text"?o.getNode():null,l!==null&&l.isSegmented()){const c=s.offset,a=l.getTextContentSize();if(l.is(r)||e&&c!==a||!e&&c!==0)return void Vg(l,e,c)}else if(r!==null&&r.isSegmented()){const c=o.offset,a=r.getTextContentSize();if(r.is(l)||e&&c!==0||!e&&c!==a)return void Vg(r,e,c)}(function(c,a){const f=c.anchor,d=c.focus,u=f.getNode(),h=d.getNode();if(u===h&&f.type==="text"&&d.type==="text"){const g=f.offset,p=d.offset,_=g<p,y=_?g:p,m=_?p:g,C=m-1;y!==C&&(ig(u.getTextContent().slice(y,m))||(a?d.offset=C:f.offset=C))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const o=this.anchor.getNode();o.isEmpty()&&mt(o.getParent())&&o.getIndexWithinParent()===0&&o.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t=this.anchor.type==="element";if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),(e?this.focus:this.anchor).offset===0&&this.modify("extend",e,"character"),t){const o=e?this.anchor:this.focus;o.set(o.key,o.offset+1,o.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,o=t.getNode();if(this.forwardDeletion(t,o,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Ns(n){return n instanceof rl}function Jg(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function hu(n){const e=n.getStartEndPoints();if(e===null)return[0,0];const[t,o]=e;return t.type==="element"&&o.type==="element"&&t.key===o.key&&t.offset===o.offset?[0,0]:[Jg(t),Jg(o)]}function Vg(n,e,t){const o=n,r=o.getTextContent().split(/(?=\s)/g),s=r.length;let i=0,l=0;for(let a=0;a<s;a++){const f=a===s-1;if(l=i,i+=r[a].length,e&&i===t||i>t||f){r.splice(a,1),f&&(l=void 0);break}}const c=r.join("").trim();c===""?o.remove():(o.setTextContent(c),o.select(l,l))}function Gg(n,e,t,o){let r,s=e;if(n.nodeType===ns){let i=!1;const l=n.childNodes,c=l.length,a=o._blockCursorElement;s===c&&(i=!0,s=c-1);let f=l[s],d=!1;if(f===a)f=l[s+1],d=!0;else if(a!==null){const u=a.parentNode;n===u&&e>Array.prototype.indexOf.call(u.children,a)&&s--}if(r=Ko(f),q(r))s=sg(r,i);else{let u=Ko(n);if(u===null)return null;if($(u)){s=Math.min(u.getChildrenSize(),s);let h=u.getChildAtIndex(s);if($(h)&&function(g,p,_){const y=g.getParent();return _===null||y===null||!y.canBeEmpty()||y!==_.getNode()}(h,0,t)){const g=i?h.getLastDescendant():h.getFirstDescendant();g===null?u=h:(h=g,u=$(h)?h:h.getParentOrThrow()),s=0}q(h)?(r=h,u=null,s=sg(h,i)):h!==u&&i&&!d&&s++}else{const h=u.getIndexWithinParent();s=e===0&&we(u)&&Ko(n)===u?h:h+1,u=u.getParentOrThrow()}if($(u))return Wt(u.__key,s,"element")}}else r=Ko(n);return q(r)?Wt(r.__key,s,"text"):null}function Xg(n,e,t){const o=n.offset,r=n.getNode();if(o===0){const s=r.getPreviousSibling(),i=r.getParent();if(e){if((t||!e)&&s===null&&$(i)&&i.isInline()){const l=i.getPreviousSibling();q(l)&&(n.key=l.__key,n.offset=l.getTextContent().length)}}else $(s)&&!t&&s.isInline()?(n.key=s.__key,n.offset=s.getChildrenSize(),n.type="element"):q(s)&&(n.key=s.__key,n.offset=s.getTextContent().length)}else if(o===r.getTextContent().length){const s=r.getNextSibling(),i=r.getParent();if(e&&$(s)&&s.isInline())n.key=s.__key,n.offset=0,n.type="element";else if((t||e)&&s===null&&$(i)&&i.isInline()&&!i.canInsertTextAfter()){const l=i.getNextSibling();q(l)&&(n.key=l.__key,n.offset=0)}}}function qg(n,e,t){if(n.type==="text"&&e.type==="text"){const o=n.isBefore(e),r=n.is(e);Xg(n,o,r),Xg(e,!o,r),r&&(e.key=n.key,e.offset=n.offset,e.type=n.type);const s=Ee();if(s.isComposing()&&s._compositionKey!==n.key&&te(t)){const i=t.anchor,l=t.focus;Wn(n,i.key,i.offset,i.type),Wn(e,l.key,l.offset,l.type)}}}function Qg(n,e,t,o,r,s){if(n===null||t===null||!ss(r,n,t))return null;const i=Gg(n,e,te(s)?s.anchor:null,r);if(i===null)return null;const l=Gg(t,o,te(s)?s.focus:null,r);if(l===null)return null;if(i.type==="element"&&l.type==="element"){const c=Ko(n),a=Ko(t);if(we(c)&&we(a))return null}return qg(i,l,s),[i,l]}function IT(n){return $(n)&&!n.isInline()}function Zg(n,e,t,o,r,s){const i=rn(),l=new zn(Wt(n,e,r),Wt(t,o,s),0,"");return l.dirty=!0,i._selection=l,l}function LT(){const n=Wt("root",0,"element"),e=Wt("root",0,"element");return new zn(n,e,0,"")}function gu(){return new rl(new Set)}function FT(n,e){return sl(null,n,e,null)}function sl(n,e,t,o){const r=t._window;if(r===null)return null;const s=o||r.event,i=s?s.type:void 0,l=i==="selectionchange",c=!$a&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&s&&s.detail===3||i==="drop"||i===void 0);let a,f,d,u;if(te(n)&&!c)return n.clone();if(e===null)return null;if(a=e.anchorNode,f=e.focusNode,d=e.anchorOffset,u=e.focusOffset,l&&te(n)&&!ss(t,a,f))return n.clone();const h=Qg(a,d,f,u,t,n);if(h===null)return null;const[g,p]=h;return new zn(g,p,te(n)?n.format:0,te(n)?n.style:"")}function ge(){return rn()._selection}function Jo(){return Ee()._editorState._selection}function il(n,e,t,o=1){const r=n.anchor,s=n.focus,i=r.getNode(),l=s.getNode();if(!e.is(i)&&!e.is(l))return;const c=e.__key;if(n.isCollapsed()){const a=r.offset;if(t<=a&&o>0||t<a&&o<0){const f=Math.max(0,a+o);r.set(c,f,"element"),s.set(c,f,"element"),ep(n)}}else{const a=n.isBackward(),f=a?s:r,d=f.getNode(),u=a?r:s,h=u.getNode();if(e.is(d)){const g=f.offset;(t<=g&&o>0||t<g&&o<0)&&f.set(c,Math.max(0,g+o),"element")}if(e.is(h)){const g=u.offset;(t<=g&&o>0||t<g&&o<0)&&u.set(c,Math.max(0,g+o),"element")}}ep(n)}function ep(n){const e=n.anchor,t=e.offset,o=n.focus,r=o.offset,s=e.getNode(),i=o.getNode();if(n.isCollapsed()){if(!$(s))return;const l=s.getChildrenSize(),c=t>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(q(a)){let f=0;c&&(f=a.getTextContentSize()),e.set(a.__key,f,"text"),o.set(a.__key,f,"text")}}else{if($(s)){const l=s.getChildrenSize(),c=t>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(q(a)){let f=0;c&&(f=a.getTextContentSize()),e.set(a.__key,f,"text")}}if($(i)){const l=i.getChildrenSize(),c=r>=l,a=c?i.getChildAtIndex(l-1):i.getChildAtIndex(r);if(q(a)){let f=0;c&&(f=a.getTextContentSize()),o.set(a.__key,f,"text")}}}}function ll(n,e,t,o,r){let s=null,i=0,l=null;o!==null?(s=o.__key,q(o)?(i=o.getTextContentSize(),l="text"):$(o)&&(i=o.getChildrenSize(),l="element")):r!==null&&(s=r.__key,q(r)?l="text":$(r)&&(l="element")),s!==null&&l!==null?n.set(s,i,l):(i=e.getIndexWithinParent(),i===-1&&(i=t.getChildrenSize()),n.set(t.__key,i,"element"))}function tp(n,e,t,o,r){n.type==="text"?(n.key=t,e||(n.offset+=r)):n.offset>o.getIndexWithinParent()&&(n.offset-=1)}function BT(n,e,t,o,r,s,i){const l=o.anchorNode,c=o.focusNode,a=o.anchorOffset,f=o.focusOffset,d=document.activeElement;if(r.has("collaboration")&&d!==s||d!==null&&La(d))return;if(!te(e))return void(n!==null&&ss(t,l,c)&&o.removeAllRanges());const u=e.anchor,h=e.focus,g=u.key,p=h.key,_=Ui(t,g),y=Ui(t,p),m=u.offset,C=h.offset,N=e.format,S=e.style,T=e.isCollapsed();let b=_,x=y,w=!1;if(u.type==="text"){b=Ki(_);const V=u.getNode();w=V.getFormat()!==N||V.getStyle()!==S}else te(n)&&n.anchor.type==="text"&&(w=!0);var O,D,B,Y,J;if(h.type==="text"&&(x=Ki(y)),b!==null&&x!==null&&(T&&(n===null||w||te(n)&&(n.format!==N||n.style!==S))&&(O=N,D=S,B=m,Y=g,J=performance.now(),Ag=[O,D,B,Y,J]),a!==m||f!==C||l!==b||c!==x||o.type==="Range"&&T||(d!==null&&s.contains(d)||s.focus({preventScroll:!0}),u.type==="element"))){try{o.setBaseAndExtent(b,m,x,C)}catch{}if(!r.has("skip-scroll-into-view")&&e.isCollapsed()&&s!==null&&s===document.activeElement){const V=e instanceof zn&&e.anchor.type==="element"?b.childNodes[m]||null:o.rangeCount>0?o.getRangeAt(0):null;if(V!==null){let re;if(V instanceof Text){const F=document.createRange();F.selectNode(V),re=F.getBoundingClientRect()}else re=V.getBoundingClientRect();(function(F,ce,se){const We=se.ownerDocument,ue=We.defaultView;if(ue===null)return;let{top:Ae,bottom:Ge}=ce,Xe=0,qe=0,Te=se;for(;Te!==null;){const nt=Te===We.body;if(nt)Xe=0,qe=Yi(F).innerHeight;else{const ve=Te.getBoundingClientRect();Xe=ve.top,qe=ve.bottom}let ze=0;if(Ae<Xe?ze=-(Xe-Ae):Ge>qe&&(ze=Ge-qe),ze!==0)if(nt)ue.scrollBy(0,ze);else{const ve=Te.scrollTop;Te.scrollTop+=ze;const St=Te.scrollTop-ve;Ae-=St,Ge-=St}if(nt)break;Te=ji(Te)}})(t,re,s)}}su=!0}}function KT(n){let e=ge()||Jo();e===null&&(e=Et().selectEnd()),e.insertNodes(n)}function WT(){const n=ge();return n===null?"":n.getTextContent()}function pu(n){let e=n;n.isCollapsed()||e.removeText();const t=ge();te(t)&&(e=t),te(e)||K(161);const o=e.anchor;let r=o.getNode(),s=o.offset;for(;!Wo(r);)[r,s]=zT(r,s);return s}function zT(n,e){const t=n.getParent();if(!t){const r=mn();return Et().append(r),r.select(),[Et(),0]}if(q(n)){const r=n.splitText(e);if(r.length===0)return[t,n.getIndexWithinParent()];const s=e===0?0:1;return[t,r[0].getIndexWithinParent()+s]}if(!$(n)||e===0)return[t,n.getIndexWithinParent()];const o=n.getChildAtIndex(e);if(o){const r=new zn(Wt(n.__key,e,"element"),Wt(n.__key,e,"element"),0,""),s=n.insertNewAfter(r);s&&s.append(o,...o.getNextSiblings())}return[t,n.getIndexWithinParent()+1]}let Ye=null,Je=null,_t=!1,_u=!1,cl=0;const np={characterData:!0,childList:!0,subtree:!0};function Vo(){return _t||Ye!==null&&Ye._readOnly}function dt(){_t&&K(13)}function op(){cl>99&&K(14)}function rn(){return Ye===null&&K(195,rp()),Ye}function Ee(){return Je===null&&K(196,rp()),Je}function rp(){let n=0;const e=new Set,t=ul.version;if(typeof window<"u")for(const r of document.querySelectorAll("[contenteditable]")){const s=is(r);if(Bi(s))n++;else if(s){let i=String(s.constructor.version||"<0.17.1");i===t&&(i+=" (separately built, likely a bundler configuration issue)"),e.add(i)}}let o=` Detected on the page: ${n} compatible editor(s) with version ${t}`;return e.size&&(o+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),o}function UT(){return Je}function sp(n,e,t){const o=e.__type,r=function(l,c){const a=l._nodes.get(c);return a===void 0&&K(30,c),a}(n,o);let s=t.get(o);s===void 0&&(s=Array.from(r.transforms),t.set(o,s));const i=s.length;for(let l=0;l<i&&(s[l](e),e.isAttached());l++);}function ip(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function jT(n){return mu(n,Ee()._nodes)}function mu(n,e){const t=n.type,o=e.get(t);o===void 0&&K(17,t);const r=o.klass;n.type!==r.getType()&&K(18,r.name);const s=r.importJSON(n),i=n.children;if($(s)&&Array.isArray(i))for(let l=0;l<i.length;l++){const c=mu(i[l],e);s.append(c)}return s}function lp(n,e,t){const o=Ye,r=_t,s=Je;Ye=e,_t=!0,Je=n;try{return t()}finally{Ye=o,_t=r,Je=s}}function Un(n,e){const t=n._pendingEditorState,o=n._rootElement,r=n._headless||o===null;if(t===null)return;const s=n._editorState,i=s._selection,l=t._selection,c=n._dirtyType!==co,a=Ye,f=_t,d=Je,u=n._updating,h=n._observer;let g=null;if(n._pendingEditorState=null,n._editorState=t,!r&&c&&h!==null){Je=n,Ye=t,_t=!1,n._updating=!0;try{const T=n._dirtyType,b=n._dirtyElements,x=n._dirtyLeaves;h.disconnect(),g=OT(s,t,n,T,b,x)}catch(T){if(T instanceof Error&&n._onError(T),_u)throw T;return pp(n,null,o,t),Jh(n),n._dirtyType=Bo,_u=!0,Un(n,s),void(_u=!1)}finally{h.observe(o,np),n._updating=u,Ye=a,_t=f,Je=d}}t._readOnly||(t._readOnly=!0);const p=n._dirtyLeaves,_=n._dirtyElements,y=n._normalizedNodes,m=n._updateTags,C=n._deferred;c&&(n._dirtyType=co,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements=new Map,n._normalizedNodes=new Set,n._updateTags=new Set),function(T,b){const x=T._decorators;let w=T._pendingDecorators||x;const O=b._nodeMap;let D;for(D in w)O.has(D)||(w===x&&(w=ng(T)),delete w[D])}(n,t);const N=r?null:nn(n._window);if(n._editable&&N!==null&&(c||l===null||l.dirty)){Je=n,Ye=t;try{if(h!==null&&h.disconnect(),c||l===null||l.dirty){const T=n._blockCursorElement;T!==null&&Ja(T,n,o),BT(i,l,n,N,m,o)}NT(n,o,l),h!==null&&h.observe(o,np)}finally{Je=d,Ye=a}}g!==null&&function(T,b,x,w,O){const D=Array.from(T._listeners.mutation),B=D.length;for(let Y=0;Y<B;Y++){const[J,V]=D[Y],re=b.get(V);re!==void 0&&J(re,{dirtyLeaves:w,prevEditorState:O,updateTags:x})}}(n,g,m,p,s),te(l)||l===null||i!==null&&i.is(l)||n.dispatchCommand(ki,void 0);const S=n._pendingDecorators;S!==null&&(n._decorators=S,n._pendingDecorators=null,Ss("decorator",n,!0,S)),function(T,b,x){const w=og(b),O=og(x);w!==O&&Ss("textcontent",T,!0,O)}(n,e||s,t),Ss("update",n,!0,{dirtyElements:_,dirtyLeaves:p,editorState:t,normalizedNodes:y,prevEditorState:e||s,tags:m}),function(T,b){if(T._deferred=[],b.length!==0){const x=T._updating;T._updating=!0;try{for(let w=0;w<b.length;w++)b[w]()}finally{T._updating=x}}}(n,C),function(T){const b=T._updates;if(b.length!==0){const x=b.shift();if(x){const[w,O]=x;up(T,w,O)}}}(n)}function Ss(n,e,t,...o){const r=e._updating;e._updating=t;try{const s=Array.from(e._listeners[n]);for(let i=0;i<s.length;i++)s[i].apply(null,o)}finally{e._updating=r}}function cp(n,e,t){if(n._updating===!1||Je!==n){let r=!1;return n.update(()=>{r=cp(n,e,t)}),r}const o=Ka(n);for(let r=4;r>=0;r--)for(let s=0;s<o.length;s++){const i=o[s]._commands.get(e);if(i!==void 0){const l=i[r];if(l!==void 0){const c=Array.from(l),a=c.length;for(let f=0;f<a;f++)if(c[f](t,n)===!0)return!0}}}return!1}function ap(n,e){const t=n._updates;let o=e||!1;for(;t.length!==0;){const r=t.shift();if(r){const[s,i]=r;let l,c;if(i!==void 0){if(l=i.onUpdate,c=i.tag,i.skipTransforms&&(o=!0),i.discrete){const a=n._pendingEditorState;a===null&&K(191),a._flushSync=!0}l&&n._deferred.push(l),c&&n._updateTags.add(c)}s()}}return o}function up(n,e,t){const o=n._updateTags;let r,s,i=!1,l=!1;t!==void 0&&(r=t.onUpdate,s=t.tag,s!=null&&o.add(s),i=t.skipTransforms||!1,l=t.discrete||!1),r&&n._deferred.push(r);const c=n._editorState;let a=n._pendingEditorState,f=!1;(a===null||a._readOnly)&&(a=n._pendingEditorState=new al(new Map((a||c)._nodeMap)),f=!0),a._flushSync=l;const d=Ye,u=_t,h=Je,g=n._updating;Ye=a,_t=!1,n._updating=!0,Je=n;try{f&&(n._headless?c._selection!==null&&(a._selection=c._selection.clone()):a._selection=function(m){const C=m.getEditorState()._selection,N=nn(m._window);return te(C)||C==null?sl(C,N,m,null):C.clone()}(n));const _=n._compositionKey;e(),i=ap(n,i),function(m,C){const N=C.getEditorState()._selection,S=m._selection;if(te(S)){const T=S.anchor,b=S.focus;let x;if(T.type==="text"&&(x=T.getNode(),x.selectionTransform(N,S)),b.type==="text"){const w=b.getNode();x!==w&&w.selectionTransform(N,S)}}}(a,n),n._dirtyType!==co&&(i?function(m,C){const N=C._dirtyLeaves,S=m._nodeMap;for(const T of N){const b=S.get(T);q(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&Xh(b)}}(a,n):function(m,C){const N=C._dirtyLeaves,S=C._dirtyElements,T=m._nodeMap,b=Ln(),x=new Map;let w=N,O=w.size,D=S,B=D.size;for(;O>0||B>0;){if(O>0){C._dirtyLeaves=new Set;for(const Y of w){const J=T.get(Y);q(J)&&J.isAttached()&&J.isSimpleText()&&!J.isUnmergeable()&&Xh(J),J!==void 0&&ip(J,b)&&sp(C,J,x),N.add(Y)}if(w=C._dirtyLeaves,O=w.size,O>0){cl++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map;for(const Y of D){const J=Y[0],V=Y[1];if(J!=="root"&&!V)continue;const re=T.get(J);re!==void 0&&ip(re,b)&&sp(C,re,x),S.set(J,V)}w=C._dirtyLeaves,O=w.size,D=C._dirtyElements,B=D.size,cl++}C._dirtyLeaves=N,C._dirtyElements=S}(a,n),ap(n),function(m,C,N,S){const T=m._nodeMap,b=C._nodeMap,x=[];for(const[w]of S){const O=b.get(w);O!==void 0&&(O.isAttached()||($(O)&&Sg(O,w,T,b,x,S),T.has(w)||S.delete(w),x.push(w)))}for(const w of x)b.delete(w);for(const w of N){const O=b.get(w);O===void 0||O.isAttached()||(T.has(w)||N.delete(w),b.delete(w))}}(c,a,n._dirtyLeaves,n._dirtyElements)),_!==n._compositionKey&&(a._flushSync=!0);const y=a._selection;if(te(y)){const m=a._nodeMap,C=y.anchor.key,N=y.focus.key;m.get(C)!==void 0&&m.get(N)!==void 0||K(19)}else Ns(y)&&y._nodes.size===0&&(a._selection=null)}catch(_){return _ instanceof Error&&n._onError(_),n._pendingEditorState=c,n._dirtyType=Bo,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),void Un(n)}finally{Ye=d,_t=u,Je=h,n._updating=g,cl=0}n._dirtyType!==co||function(_,y){const m=y.getEditorState()._selection,C=_._selection;if(C!==null){if(C.dirty||!C.is(m))return!0}else if(m!==null)return!0;return!1}(a,n)?a._flushSync?(a._flushSync=!1,Un(n)):f&&uT(()=>{Un(n)}):(a._flushSync=!1,f&&(o.clear(),n._deferred=[],n._pendingEditorState=null))}function wt(n,e,t){n._updating?n._updates.push([e,t]):up(n,e,t)}class Ts extends el{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return tT[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=Ee()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(q(t)&&e.push(t),$(t)){const o=t.getAllTextNodes();e.push(...o)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;$(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;$(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),o=t.length;if(e>=o){const s=t[o-1];return $(s)&&s.getLastDescendant()||s||null}const r=t[e];return $(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:et(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&K(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:et(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&K(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let o,r;if(e<t/2){for(o=this.getFirstChild(),r=0;o!==null&&r<=e;){if(r===e)return o;o=o.getNextSibling(),r++}return null}for(o=this.getLastChild(),r=t-1;o!==null&&r>=e;){if(r===e)return o;o=o.getPreviousSibling(),r--}return null}getTextContent(){let e="";const t=this.getChildren(),o=t.length;for(let r=0;r<o;r++){const s=t[r];e+=s.getTextContent(),$(s)&&r!==o-1&&!s.isInline()&&(e+=gn)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),o=t.length;for(let r=0;r<o;r++){const s=t[r];e+=s.getTextContentSize(),$(s)&&r!==o-1&&!s.isInline()&&(e+=gn.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=jh[e];return!!(this.getFormat()&t)}return!1}select(e,t){dt();const o=ge();let r=e,s=t;const i=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const c=this.getFirstChild();if(q(c)||$(c))return c.select(0,0)}else if(!(e!==void 0&&e!==i||t!==void 0&&t!==i)){const c=this.getLastChild();if(q(c)||$(c))return c.select()}}r===void 0&&(r=i),s===void 0&&(s=i);const l=this.__key;return te(o)?(o.anchor.set(l,r,"element"),o.focus.set(l,s,"element"),o.dirty=!0,o):Zg(l,r,l,s,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(t=>t.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==""?jh[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,o){const r=o.length,s=this.getChildrenSize(),i=this.getWritable(),l=i.__key,c=[],a=[],f=this.getChildAtIndex(e+t);let d=null,u=s-t+r;if(e!==0)if(e===s)d=this.getLastChild();else{const g=this.getChildAtIndex(e);g!==null&&(d=g.getPreviousSibling())}if(t>0){let g=d===null?this.getFirstChild():d.getNextSibling();for(let p=0;p<t;p++){g===null&&K(100);const _=g.getNextSibling(),y=g.__key;uo(g.getWritable()),a.push(y),g=_}}let h=d;for(let g=0;g<r;g++){const p=o[g];h!==null&&p.is(h)&&(d=h=h.getPreviousSibling());const _=p.getWritable();_.__parent===l&&u--,uo(_);const y=p.__key;if(h===null)i.__first=y,_.__prev=null;else{const m=h.getWritable();m.__next=y,_.__prev=m.__key}p.__key===l&&K(76),_.__parent=l,c.push(y),h=p}if(e+t===s)h!==null&&(h.getWritable().__next=null,i.__last=h.__key);else if(f!==null){const g=f.getWritable();if(h!==null){const p=h.getWritable();g.__prev=h.__key,p.__next=f.__key}else g.__prev=null}if(i.__size=u,a.length){const g=ge();if(te(g)){const p=new Set(a),_=new Set(c),{anchor:y,focus:m}=g;fp(y,p,_)&&ll(y,y.getNode(),this,d,f),fp(m,p,_)&&ll(m,m.getNode(),this,d,f),u!==0||this.canBeEmpty()||Fn(this)||this.remove()}}return i}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,o){return!1}canMergeWhenEmpty(){return!1}}function $(n){return n instanceof Ts}function fp(n,e,t){let o=n.getNode();for(;o;){const r=o.__key;if(e.has(r)&&!t.has(r))return!0;o=o.getParent()}return!1}class dp extends el{constructor(e){super(e)}decorate(e,t){K(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function we(n){return n instanceof dp}class Go extends Ts{static getType(){return"root"}static clone(){return new Go}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){K(51)}getTextContent(){const e=this.__cachedText;return!Vo()&&Ee()._dirtyType!==co||e===null?super.getTextContent():e}remove(){K(52)}replace(e){K(53)}insertBefore(e){K(54)}insertAfter(e){K(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const o=e[t];$(o)||we(o)||K(56)}return super.append(...e)}static importJSON(e){const t=Et();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function mt(n){return n instanceof Go}function yu(){return new al(new Map([["root",new Go]]))}function hp(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType()&&K(130,t.name),$(n)){const o=e.children;Array.isArray(o)||K(59,t.name);const r=n.getChildren();for(let s=0;s<r.length;s++){const i=hp(r[s]);o.push(i)}}return e}class al{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return lp(t&&t.editor||null,this,e)}clone(e){const t=new al(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return lp(null,this,()=>({root:hp(Et())}))}}class gp extends Ts{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class _o extends Ts{constructor(e){super(e),this.__textFormat=0,this.__textStyle=""}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=en[e];return!!(this.getTextFormat()&t)}getTextStyle(){return this.getLatest().__textStyle}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}static clone(e){return new _o(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),o=fs(e.theme,"paragraph");return o!==void 0&&t.classList.add(...o),t}updateDOM(e,t,o){return!1}static importDOM(){return{p:e=>({conversion:HT,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Ji(t)){this.isEmpty()&&t.append(document.createElement("br"));const o=this.getFormatType();t.style.textAlign=o;const r=this.getDirection();r&&(t.dir=r);const s=this.getIndent();s>0&&(t.style.textIndent=20*s+"px")}return{element:t}}static importJSON(e){const t=mn();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){const o=mn();o.setTextFormat(e.format),o.setTextStyle(e.style);const r=this.getDirection();return o.setDirection(r),o.setFormat(this.getFormatType()),o.setStyle(this.getTextStyle()),this.insertAfter(o,t),o}collapseAtStart(){const e=this.getChildren();if(e.length===0||q(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function HT(n){const e=mn();if(n.style){e.setFormat(n.style.textAlign);const t=parseInt(n.style.textIndent,10)/20;t>0&&e.setIndent(t)}return{node:e}}function mn(){return ds(new _o)}function Cu(n){return n instanceof _o}const YT=0,JT=1,VT=2,GT=3,XT=4;function pp(n,e,t,o){const r=n._keyToDOMMap;r.clear(),n._editorState=yu(),n._pendingEditorState=o,n._compositionKey=null,n._dirtyType=co,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,n._updateTags=new Set,n._updates=[],n._blockCursorElement=null;const s=n._observer;s!==null&&(s.disconnect(),n._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",r.set("root",t))}function qT(n){const e=n||{},t=UT(),o=e.theme||{},r=n===void 0?t:e.parentEditor||null,s=e.disableEvents||!1,i=yu(),l=e.namespace||(r!==null?r._config.namespace:lg()),c=e.editorState,a=[Go,po,jo,Yo,_o,gp,...e.nodes||[]],{onError:f,html:d}=e,u=e.editable===void 0||e.editable;let h;if(n===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let p=0;p<a.length;p++){let _=a[p],y=null,m=null;if(typeof _!="function"){const T=_;_=T.replace,y=T.with,m=T.withKlass||null}const C=_.getType(),N=_.transform(),S=new Set;N!==null&&S.add(N),h.set(C,{exportDOM:d&&d.export?d.export.get(_):void 0,klass:_,replace:y,replaceWithKlass:m,transforms:S})}}const g=new ul(i,r,h,{disableEvents:s,namespace:l,theme:o},f||console.error,function(p,_){const y=new Map,m=new Set,C=N=>{Object.keys(N).forEach(S=>{let T=y.get(S);T===void 0&&(T=[],y.set(S,T)),T.push(N[S])})};return p.forEach(N=>{const S=N.klass.importDOM;if(S==null||m.has(S))return;m.add(S);const T=S.call(N.klass);T!==null&&C(T)}),_&&C(_),y}(h,d?d.import:void 0),u);return c!==void 0&&(g._pendingEditorState=c,g._dirtyType=Bo),g}class ul{constructor(e,t,o,r,s,i,l){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=o,this._decorators={},this._pendingDecorators=null,this._dirtyType=co,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=lg(),this._onError=s,this._htmlConversions=i,this._editable=l,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,o){o===void 0&&K(35);const r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);const s=r.get(e);s===void 0&&K(36,String(e));const i=s[o];return i.add(t),()=>{i.delete(t),s.every(l=>l.size===0)&&r.delete(e)}}registerMutationListener(e,t,o){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,s=this._listeners.mutation;s.set(t,r);const i=o&&o.skipInitialization;return i===void 0||i||this.initializeMutationListener(t,r),()=>{s.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&K(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const o=this._editorState,r=Cg(o).get(t.getType());if(!r)return;const s=new Map;for(const i of r.keys())s.set(i,"created");s.size>0&&e(s,{dirtyLeaves:new Set,prevEditorState:o,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const o=this.getRegisteredNode(e);return o.transforms.add(t),o}registerNodeTransform(e,t){const o=this.registerNodeTransformToKlass(e,t),r=[o],s=o.replaceWithKlass;if(s!=null){const c=this.registerNodeTransformToKlass(s,t);r.push(c)}var i,l;return i=this,l=e.getType(),wt(i,()=>{const c=rn();if(c.isEmpty())return;if(l==="root")return void Et().markDirty();const a=c._nodeMap;for(const[,f]of a)f.markDirty()},i._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{r.forEach(c=>c.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return H(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const o=fs(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,pp(this,t,e,r),t!==null&&(this._config.disableEvents||vT(t),o!=null&&t.classList.remove(...o)),e!==null){const s=function(l){const c=l.ownerDocument;return c&&c.defaultView||null}(e),i=e.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=s,this._dirtyType=Bo,Jh(this),this._updateTags.add("history-merge"),Un(this),this._config.disableEvents||function(l,c){const a=l.ownerDocument,f=Zi.get(a);(f===void 0||f<1)&&a.addEventListener("selectionchange",Lg),Zi.set(a,(f||0)+1),l.__lexicalEditor=c;const d=Ig(l);for(let u=0;u<ru.length;u++){const[h,g]=ru[u],p=typeof g=="function"?_=>{Bg(_)||(Fg(_),(c.isEditable()||h==="click")&&g(_,c))}:_=>{if(Bg(_))return;Fg(_);const y=c.isEditable();switch(h){case"cut":return y&&H(c,Ea,_);case"copy":return H(c,xa,_);case"paste":return y&&H(c,Ca,_);case"dragstart":return y&&H(c,Rh,_);case"dragover":return y&&H(c,$h,_);case"dragend":return y&&H(c,Ph,_);case"focus":return y&&H(c,Ih,_);case"blur":return y&&H(c,Lh,_);case"drop":return y&&H(c,kh,_)}};l.addEventListener(h,p),d.push(()=>{l.removeEventListener(h,p)})}}(e,this),o!=null&&e.classList.add(...o)}else this._editorState=r,this._pendingEditorState=null,this._window=null;Ss("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&K(38),Yh(this);const o=this._pendingEditorState,r=this._updateTags,s=t!==void 0?t.tag:null;o===null||o.isEmpty()||(s!=null&&r.add(s),Un(this)),this._pendingEditorState=e,this._dirtyType=Bo,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&r.add(s),Un(this)}parseEditorState(e,t){return function(o,r,s){const i=yu(),l=Ye,c=_t,a=Je,f=r._dirtyElements,d=r._dirtyLeaves,u=r._cloneNotNeeded,h=r._dirtyType;r._dirtyElements=new Map,r._dirtyLeaves=new Set,r._cloneNotNeeded=new Set,r._dirtyType=0,Ye=i,_t=!1,Je=r;try{const g=r._nodes;mu(o.root,g),s&&s(),i._readOnly=!0}catch(g){g instanceof Error&&r._onError(g)}finally{r._dirtyElements=f,r._dirtyLeaves=d,r._cloneNotNeeded=u,r._dirtyType=h,Ye=l,_t=c,Je=a}return i}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return Un(this),this.getEditorState().read(e,{editor:this})}update(e,t){wt(this,e,t)}focus(e,t={}){const o=this._rootElement;o!==null&&(o.setAttribute("autocapitalize","off"),wt(this,()=>{const r=ge(),s=Et();r!==null?r.dirty=!0:s.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?s.selectStart():s.selectEnd())},{onUpdate:()=>{o.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&o.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=nn(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Ss("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}ul.version="0.17.1+prod.esm";const QT=Object.freeze(Object.defineProperty({__proto__:null,$addUpdateTag:mT,$applyNodeReplacement:ds,$cloneWithProperties:Ng,$copyNode:_g,$createLineBreakNode:Ho,$createNodeSelection:gu,$createParagraphNode:mn,$createPoint:Wt,$createRangeSelection:LT,$createRangeSelectionFromDom:FT,$createTabNode:ol,$createTextNode:tt,$getAdjacentNode:ja,$getCharacterOffsets:hu,$getEditor:xT,$getNearestNodeFromDOMNode:ls,$getNearestRootOrShadowRoot:pg,$getNodeByKey:et,$getNodeByKeyOrThrow:CT,$getPreviousSelection:Jo,$getRoot:Et,$getSelection:ge,$getTextContent:WT,$hasAncestor:Hi,$hasUpdateTag:_T,$insertNodes:KT,$isBlockElementNode:IT,$isDecoratorNode:we,$isElementNode:$,$isInlineElementOrDecoratorNode:yT,$isLeafNode:dT,$isLineBreakNode:go,$isNodeSelection:Ns,$isParagraphNode:Cu,$isRangeSelection:te,$isRootNode:mt,$isRootOrShadowRoot:Fn,$isTabNode:Hg,$isTextNode:q,$isTokenOrSegmented:ao,$nodesOfType:pT,$normalizeSelection__EXPERIMENTAL:qh,$parseSerializedNode:jT,$selectAll:gT,$setCompositionKey:He,$setSelection:tn,$splitNode:ST,ArtificialNode__DO_NOT_USE:gp,BLUR_COMMAND:Lh,CAN_REDO_COMMAND:FS,CAN_UNDO_COMMAND:BS,CLEAR_EDITOR_COMMAND:IS,CLEAR_HISTORY_COMMAND:LS,CLICK_COMMAND:Ch,COMMAND_PRIORITY_CRITICAL:XT,COMMAND_PRIORITY_EDITOR:YT,COMMAND_PRIORITY_HIGH:GT,COMMAND_PRIORITY_LOW:JT,COMMAND_PRIORITY_NORMAL:VT,CONTROLLED_TEXT_INSERTION_COMMAND:Fo,COPY_COMMAND:xa,CUT_COMMAND:Ea,DELETE_CHARACTER_COMMAND:Qr,DELETE_LINE_COMMAND:ts,DELETE_WORD_COMMAND:es,DRAGEND_COMMAND:Ph,DRAGOVER_COMMAND:$h,DRAGSTART_COMMAND:Rh,DROP_COMMAND:kh,DecoratorNode:dp,ElementNode:Ts,FOCUS_COMMAND:Ih,FORMAT_ELEMENT_COMMAND:PS,FORMAT_TEXT_COMMAND:$n,INDENT_CONTENT_COMMAND:RS,INSERT_LINE_BREAK_COMMAND:Zr,INSERT_PARAGRAPH_COMMAND:ya,INSERT_TAB_COMMAND:kS,IS_ALL_FORMATTING:Wh,IS_BOLD:YS,IS_CODE:VS,IS_HIGHLIGHT:Ii,IS_ITALIC:JS,IS_STRIKETHROUGH:os,IS_SUBSCRIPT:GS,IS_SUPERSCRIPT:XS,IS_UNDERLINE:rs,KEY_ARROW_DOWN_COMMAND:bh,KEY_ARROW_LEFT_COMMAND:xh,KEY_ARROW_RIGHT_COMMAND:Sh,KEY_ARROW_UP_COMMAND:wh,KEY_BACKSPACE_COMMAND:vh,KEY_DELETE_COMMAND:Dh,KEY_DOWN_COMMAND:Nh,KEY_ENTER_COMMAND:Ri,KEY_ESCAPE_COMMAND:Mh,KEY_MODIFIER_COMMAND:Fh,KEY_SPACE_COMMAND:Oh,KEY_TAB_COMMAND:Ah,LineBreakNode:jo,MOVE_TO_END:Th,MOVE_TO_START:Eh,OUTDENT_CONTENT_COMMAND:$S,PASTE_COMMAND:Ca,ParagraphNode:_o,REDO_COMMAND:Ta,REMOVE_TEXT_COMMAND:Na,RootNode:Go,SELECTION_CHANGE_COMMAND:ki,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:AS,SELECT_ALL_COMMAND:wa,TEXT_TYPE_TO_FORMAT:en,TabNode:Yo,TextNode:po,UNDO_COMMAND:Sa,createCommand:DS,createEditor:qT,getEditorPropertyFromDOMNode:is,getNearestEditorFromDOMNode:Fa,isBlockDomNode:Va,isCurrentlyReadOnlyMode:Vo,isHTMLAnchorElement:TT,isHTMLElement:Ji,isInlineDomNode:mg,isLexicalEditor:Bi,isSelectionCapturedInDecoratorInput:La,isSelectionWithinEditor:ss,resetRandomKey:aT},Symbol.toStringTag,{value:"Module"})),P=process.env.NODE_ENV==="development"?MS:QT,rt=P.$applyNodeReplacement,jn=P.$cloneWithProperties,fl=P.$createLineBreakNode,ie=P.$createParagraphNode,dl=P.$createPoint,hl=P.$createRangeSelection,_p=P.$createRangeSelectionFromDom,gl=P.$createTabNode,bt=P.$createTextNode,Xo=P.$getAdjacentNode,mp=P.$getCharacterOffsets,yp=P.$getEditor,be=P.$getNearestNodeFromDOMNode,Ot=P.$getNodeByKey,Hn=P.$getPreviousSelection,Oe=P.$getRoot,M=P.$getSelection,Cp=P.$hasAncestor,Np=P.$insertNodes,qo=P.$isBlockElementNode,st=P.$isDecoratorNode,A=P.$isElementNode,Sp=P.$isLeafNode,pl=P.$isLineBreakNode,Ve=P.$isNodeSelection,_l=P.$isParagraphNode,v=P.$isRangeSelection,Yn=P.$isRootNode,it=P.$isRootOrShadowRoot,L=P.$isTextNode,Qo=P.$isTokenOrSegmented,ml=P.$normalizeSelection__EXPERIMENTAL,Tp=P.$parseSerializedNode,xp=P.$selectAll,Pe=P.$setSelection,yl=P.$splitNode,Cl=P.ArtificialNode__DO_NOT_USE,yn=P.CAN_REDO_COMMAND,Cn=P.CAN_UNDO_COMMAND,Ep=P.CLEAR_EDITOR_COMMAND,wp=P.CLEAR_HISTORY_COMMAND,bp=P.CLICK_COMMAND,ye=P.COMMAND_PRIORITY_CRITICAL,G=P.COMMAND_PRIORITY_EDITOR,vt=P.COMMAND_PRIORITY_HIGH,Nl=P.CONTROLLED_TEXT_INSERTION_COMMAND,Sl=P.COPY_COMMAND,Tl=P.CUT_COMMAND,Jn=P.DELETE_CHARACTER_COMMAND,Zo=P.DELETE_LINE_COMMAND,xl=P.DELETE_WORD_COMMAND,Op=P.DRAGOVER_COMMAND,vp=P.DRAGSTART_COMMAND,Mp=P.DROP_COMMAND,yt=P.ElementNode,Dp=P.FOCUS_COMMAND,Vn=P.FORMAT_ELEMENT_COMMAND,Gn=P.FORMAT_TEXT_COMMAND,Ap=P.INDENT_CONTENT_COMMAND,El=P.INSERT_LINE_BREAK_COMMAND,er=P.INSERT_PARAGRAPH_COMMAND,kp=P.INSERT_TAB_COMMAND,wl=P.KEY_ARROW_DOWN_COMMAND,bl=P.KEY_ARROW_LEFT_COMMAND,Ol=P.KEY_ARROW_RIGHT_COMMAND,vl=P.KEY_ARROW_UP_COMMAND,Ml=P.KEY_BACKSPACE_COMMAND,Dl=P.KEY_DELETE_COMMAND,Rp=P.KEY_ENTER_COMMAND,Al=P.KEY_ESCAPE_COMMAND,$p=P.KEY_TAB_COMMAND,kl=P.OUTDENT_CONTENT_COMMAND,Pp=P.PASTE_COMMAND,Nu=P.REDO_COMMAND,Ip=P.REMOVE_TEXT_COMMAND,zt=P.SELECTION_CHANGE_COMMAND,Rl=P.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,Lp=P.SELECT_ALL_COMMAND,tr=P.TextNode,Su=P.UNDO_COMMAND,nr=P.createCommand,ZT=P.createEditor,Fp=P.isBlockDomNode,Bp=P.isCurrentlyReadOnlyMode,Kp=P.isHTMLAnchorElement,Wp=P.isHTMLElement,or=P.isInlineDomNode,zp=P.isSelectionCapturedInDecoratorInput,Up=P.isSelectionWithinEditor,Fv="";function ex(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var tx=ex(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const jp=I.createContext(null);function nx(n,e){let t=null;return n!=null&&(t=n[1]),{getTheme:function(){return e??(t!=null?t.getTheme():null)}}}function Xn(){const n=I.useContext(jp);return n==null&&tx(8),n}const Hp=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,ox=Hp?I.useLayoutEffect:I.useEffect,$l={tag:"history-merge"};function rx({initialConfig:n,children:e}){const t=I.useMemo(()=>{const{theme:o,namespace:r,nodes:s,onError:i,editorState:l,html:c}=n,a=nx(null,o),f=ZT({editable:n.editable,html:c,namespace:r,nodes:s,onError:d=>i(d,f),theme:o});return function(d,u){if(u!==null){if(u===void 0)d.update(()=>{const h=Oe();if(h.isEmpty()){const g=ie();h.append(g);const p=Hp?document.activeElement:null;(M()!==null||p!==null&&p===d.getRootElement())&&g.select()}},$l);else if(u!==null)switch(typeof u){case"string":{const h=d.parseEditorState(u);d.setEditorState(h,$l);break}case"object":d.setEditorState(u,$l);break;case"function":d.update(()=>{Oe().isEmpty()&&u(d)},$l)}}}(f,l),[f,a]},[]);return ox(()=>{const o=n.editable,[r]=t;r.setEditable(o===void 0||o)},[]),W.exports.jsx(jp.Provider,{value:t,children:e})}function sx({defaultSelection:n}){const[e]=Xn();return I.useEffect(()=>{e.focus(()=>{const t=document.activeElement,o=e.getRootElement();o===null||t!==null&&o.contains(t)||o.focus({preventScroll:!0})},{defaultSelection:n})},[n,e]),null}function Yp(){return Oe().getTextContent()}function Tu(n,e=!0){if(n)return!1;let t=Yp();return e&&(t=t.trim()),t===""}function ix(n,e){return()=>Tu(n,e)}function Jp(n){if(!Tu(n,!1))return!1;const t=Oe().getChildren(),o=t.length;if(o>1)return!1;for(let r=0;r<o;r++){const s=t[r];if(st(s))return!1;if(A(s)){if(!_l(s)||s.__indent!==0)return!1;const i=s.getChildren(),l=i.length;for(let c=0;c<l;c++){const a=i[r];if(!L(a))return!1}}}return!0}function lx(n){return()=>Jp(n)}function cx(n,e){let t=n.getFirstChild(),o=0;e:for(;t!==null;){if(A(t)){const i=t.getFirstChild();if(i!==null){t=i;continue}}else if(L(t)){const i=t.getTextContentSize();if(o+i>e)return{node:t,offset:e-o};o+=i}const r=t.getNextSibling();if(r!==null){t=r;continue}let s=t.getParent();for(;s!==null;){const i=s.getNextSibling();if(i!==null){t=i;continue e}s=s.getParent()}break}return null}function ax(n,e,t,o){const r=d=>d instanceof t,s=d=>{const u=bt(d.getTextContent());u.setFormat(d.getFormat()),d.replace(u)},i=d=>d.getLatest().__mode,l=d=>{if(!d.isSimpleText())return;let u=d.getPreviousSibling(),h=d.getTextContent(),g=d,p;if(L(u)){const y=u.getTextContent(),m=y+h,C=e(m);if(r(u))if(C===null||i(u)!==0){s(u);return}else{const N=C.end-y.length;if(N>0){const S=h.slice(0,N),T=y+S;if(u.select(),u.setTextContent(T),N===h.length)d.remove();else{const b=h.slice(N);d.setTextContent(b)}return}}else if(C===null||C.start<y.length)return}let _=0;for(;;){p=e(h);let y=p===null?"":h.slice(p.end);if(h=y,y===""){const N=g.getNextSibling();if(L(N)){y=g.getTextContent()+N.getTextContent();const S=e(y);if(S===null){r(N)?s(N):N.markDirty();return}else if(S.start!==0)return}}if(p===null)return;if(p.start===0&&L(u)&&u.isTextEntity()){_+=p.end;continue}let m;if(p.start===0?[m,g]=g.splitText(p.end):[,m,g]=g.splitText(p.start+_,p.end+_),m===void 0)throw Error("nodeToReplace should not be undefined. You may want to check splitOffsets passed to the splitText.");const C=o(m);if(C.setFormat(m.getFormat()),m.replace(C),g==null)return;_=0,u=C}},c=d=>{const u=d.getTextContent(),h=e(u);if(h===null||h.start!==0){s(d);return}if(u.length>h.end){d.splitText(h.end);return}const g=d.getPreviousSibling();L(g)&&g.isTextEntity()&&(s(g),s(d));const p=d.getNextSibling();L(p)&&p.isTextEntity()&&(s(p),r(d)&&s(d))},a=n.registerNodeTransform(tr,l),f=n.registerNodeTransform(t,c);return[a,f]}const ux=Object.freeze(Object.defineProperty({__proto__:null,$canShowPlaceholder:Jp,$canShowPlaceholderCurry:lx,$findTextIntersectionFromCharacters:cx,$isRootTextContentEmpty:Tu,$isRootTextContentEmptyCurry:ix,$rootTextContent:Yp,registerLexicalTextEntity:ax},Symbol.toStringTag,{value:"Module"}));function Vp(){return Oe().getTextContent()}function xu(n,e=!0){if(n)return!1;let t=Vp();return e&&(t=t.trim()),t===""}function fx(n,e){return()=>xu(n,e)}function Gp(n){if(!xu(n,!1))return!1;const e=Oe().getChildren(),t=e.length;if(t>1)return!1;for(let o=0;o<t;o++){const r=e[o];if(st(r))return!1;if(A(r)){if(!_l(r)||r.__indent!==0)return!1;const s=r.getChildren(),i=s.length;for(let l=0;l<i;l++){const c=s[o];if(!L(c))return!1}}}return!0}function dx(n){return()=>Gp(n)}function hx(n,e){let t=n.getFirstChild(),o=0;e:for(;t!==null;){if(A(t)){const i=t.getFirstChild();if(i!==null){t=i;continue}}else if(L(t)){const i=t.getTextContentSize();if(o+i>e)return{node:t,offset:e-o};o+=i}const r=t.getNextSibling();if(r!==null){t=r;continue}let s=t.getParent();for(;s!==null;){const i=s.getNextSibling();if(i!==null){t=i;continue e}s=s.getParent()}break}return null}function gx(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var px=gx(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function _x(n,e,t,o){const r=i=>i instanceof t,s=i=>{const l=bt(i.getTextContent());l.setFormat(i.getFormat()),i.replace(l)};return[n.registerNodeTransform(tr,i=>{if(!i.isSimpleText())return;let l,c=i.getPreviousSibling(),a=i.getTextContent(),f=i;if(L(c)){const u=c.getTextContent(),h=e(u+a);if(r(c)){if(h===null||(g=>g.getLatest().__mode)(c)!==0)return void s(c);{const g=h.end-u.length;if(g>0){const p=u+a.slice(0,g);if(c.select(),c.setTextContent(p),g===a.length)i.remove();else{const _=a.slice(g);i.setTextContent(_)}return}}}else if(h===null||h.start<u.length)return}let d=0;for(;;){l=e(a);let u,h=l===null?"":a.slice(l.end);if(a=h,h===""){const p=f.getNextSibling();if(L(p)){h=f.getTextContent()+p.getTextContent();const _=e(h);if(_===null)return void(r(p)?s(p):p.markDirty());if(_.start!==0)return}}if(l===null)return;if(l.start===0&&L(c)&&c.isTextEntity()){d+=l.end;continue}l.start===0?[u,f]=f.splitText(l.end):[,u,f]=f.splitText(l.start+d,l.end+d),u===void 0&&px(165,"nodeToReplace");const g=o(u);if(g.setFormat(u.getFormat()),u.replace(g),f==null)return;d=0,c=g}}),n.registerNodeTransform(t,i=>{const l=i.getTextContent(),c=e(l);if(c===null||c.start!==0)return void s(i);if(l.length>c.end)return void i.splitText(c.end);const a=i.getPreviousSibling();L(a)&&a.isTextEntity()&&(s(a),s(i));const f=i.getNextSibling();L(f)&&f.isTextEntity()&&(s(f),r(i)&&s(i))})]}const mx=Object.freeze(Object.defineProperty({__proto__:null,$canShowPlaceholder:Gp,$canShowPlaceholderCurry:dx,$findTextIntersectionFromCharacters:hx,$isRootTextContentEmpty:xu,$isRootTextContentEmptyCurry:fx,$rootTextContent:Vp,registerLexicalTextEntity:_x},Symbol.toStringTag,{value:"Module"})),Xp=(process.env.NODE_ENV==="development"?ux:mx).$canShowPlaceholderCurry,Pl=new Map;function qp(n){let e=n;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function Qp(n){const e=n.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(n)]}function yx(n,e,t,o,r){const s=e.getKey(),i=o.getKey(),l=document.createRange();let c=n.getElementByKey(s),a=n.getElementByKey(i),f=t,d=r;if(L(e)&&(c=qp(c)),L(o)&&(a=qp(a)),e===void 0||o===void 0||c===null||a===null)return null;c.nodeName==="BR"&&([c,f]=Qp(c)),a.nodeName==="BR"&&([a,d]=Qp(a));const u=c.firstChild;c===a&&u!=null&&u.nodeName==="BR"&&f===0&&d===0&&(d=1);try{l.setStart(c,f),l.setEnd(a,d)}catch{return null}return l.collapsed&&(f!==d||s!==i)&&(l.setStart(a,d),l.setEnd(c,f)),l}function Cx(n,e){const t=n.getRootElement();if(t===null)return[];const o=t.getBoundingClientRect(),r=getComputedStyle(t),s=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),i=Array.from(e.getClientRects());let l=i.length;i.sort((a,f)=>{const d=a.top-f.top;return Math.abs(d)<=3?a.left-f.left:d});let c;for(let a=0;a<l;a++){const f=i[a],d=c&&c.top<=f.top&&c.top+c.height>f.top&&c.left+c.width>f.left,u=f.width+s===o.width;if(d||u){i.splice(a--,1),l--;continue}c=f}return i}function Zp(n){const e={},t=n.split(";");for(const o of t)if(o!==""){const[r,s]=o.split(/:([^]+)/);r&&s&&(e[r.trim()]=s.trim())}return e}function Il(n){let e=Pl.get(n);return e===void 0&&(e=Zp(n),Pl.set(n,e)),Object.freeze(e),e}function Nx(n){let e="";for(const t in n)t&&(e+=`${t}: ${n[t]};`);return e}function Sx(n,e){const t=n.getStartEndPoints();if(e.isSelected(n)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[o,r]=t,s=n.isBackward(),i=o.getNode(),l=r.getNode(),c=e.is(i),a=e.is(l);if(c||a){const[f,d]=mp(n),u=i.is(l),h=e.is(s?l:i),g=e.is(s?i:l);let p=0,_;if(u)p=f>d?d:f,_=f>d?f:d;else if(h)p=s?d:f,_=void 0;else if(g){const y=s?f:d;p=0,_=y}return e.__text=e.__text.slice(p,_),e}}return e}function Tx(n){if(n.type==="text")return n.offset===n.getNode().getTextContentSize();const e=n.getNode();if(!A(e))throw Error("isAtNodeEnd: node must be a TextNode or ElementNode");return n.offset===e.getChildrenSize()}function e_(n,e,t){let o=e.getNode(),r=t;if(A(o)){const s=o.getDescendantByIndex(e.offset);s!==null&&(o=s)}for(;r>0&&o!==null;){if(A(o)){const a=o.getLastDescendant();a!==null&&(o=a)}let s=o.getPreviousSibling(),i=0;if(s===null){let a=o.getParentOrThrow(),f=a.getPreviousSibling();for(;f===null;){if(a=a.getParent(),a===null){s=null;break}f=a.getPreviousSibling()}a!==null&&(i=a.isInline()?0:2,s=f)}let l=o.getTextContent();l===""&&A(o)&&!o.isInline()&&(l=`
31
+ `?r.push(Hr()):i===" "?r.push(nl()):r.push(tt(i))}this.insertNodes(r)}insertText(e){const t=this.anchor,r=this.focus,o=this.format,s=this.style;let i=t,l=r;!this.isCollapsed()&&r.isBefore(t)&&(i=r,l=t),i.type==="element"&&function(_,y,m,C){const N=_.getNode(),S=N.getChildAtIndex(_.offset),T=tt(),E=mt(N)?_n().append(T):T;T.setFormat(m),T.setStyle(C),S===null?N.append(E):S.insertBefore(E),_.is(y)&&y.set(T.__key,0,"text"),_.set(T.__key,0,"text")}(i,l,o,s);const c=i.offset;let a=l.offset;const f=this.getNodes(),d=f.length;let u=f[0];X(u)||K(26);const h=u.getTextContent().length,g=u.getParentOrThrow();let p=f[d-1];if(d===1&&l.type==="element"&&(a=h,l.set(i.key,a,"text")),this.isCollapsed()&&c===h&&(u.isSegmented()||u.isToken()||!u.canInsertTextAfter()||!g.canInsertTextAfter()&&u.getNextSibling()===null)){let _=u.getNextSibling();if(X(_)&&_.canInsertTextBefore()&&!ar(_)||(_=tt(),_.setFormat(o),_.setStyle(s),g.canInsertTextAfter()?u.insertAfter(_):g.insertAfter(_)),_.select(0,0),u=_,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&c===0&&(u.isSegmented()||u.isToken()||!u.canInsertTextBefore()||!g.canInsertTextBefore()&&u.getPreviousSibling()===null)){let _=u.getPreviousSibling();if(X(_)&&!ar(_)||(_=tt(),_.setFormat(o),g.canInsertTextBefore()?u.insertBefore(_):g.insertBefore(_)),_.select(),u=_,e!=="")return void this.insertText(e)}else if(u.isSegmented()&&c!==h){const _=tt(u.getTextContent());_.setFormat(o),u.replace(_),u=_}else if(!this.isCollapsed()&&e!==""){const _=p.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||R(_)&&(!_.canInsertTextBefore()||!_.canInsertTextAfter()))return this.insertText(""),Zg(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(u.isToken()){const C=tt(e);return C.select(),void u.replace(C)}const _=u.getFormat(),y=u.getStyle();if(c!==a||_===o&&y===s){if(Jg(u)){const C=tt(e);return C.setFormat(o),C.setStyle(s),C.select(),void u.replace(C)}}else{if(u.getTextContent()!==""){const C=tt(e);if(C.setFormat(o),C.setStyle(s),C.select(),c===0)u.insertBefore(C,!1);else{const[N]=u.splitText(c);N.insertAfter(C,!1)}return void(C.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}u.setFormat(o),u.setStyle(s)}const m=a-c;u=u.spliceText(c,m,e,!0),u.getTextContent()===""?u.remove():this.anchor.type==="text"&&(u.isComposing()?this.anchor.offset-=e.length:(this.format=_,this.style=y))}else{const _=new Set([...u.getParentKeys(),...p.getParentKeys()]),y=R(u)?u:u.getParentOrThrow();let m=R(p)?p:p.getParentOrThrow(),C=p;if(!y.is(m)&&m.isInline())do C=m,m=m.getParentOrThrow();while(m.isInline());if(l.type==="text"&&(a!==0||p.getTextContent()==="")||l.type==="element"&&p.getIndexWithinParent()<a)if(X(p)&&!p.isToken()&&a!==p.getTextContentSize()){if(p.isSegmented()){const x=tt(p.getTextContent());p.replace(x),p=x}mt(l.getNode())||l.type!=="text"||(p=p.spliceText(0,a,"")),_.add(p.__key)}else{const x=p.getParentOrThrow();x.canBeEmpty()||x.getChildrenSize()!==1?p.remove():x.remove()}else _.add(p.__key);const N=m.getChildren(),S=new Set(f),T=y.is(m),E=y.isInline()&&u.getNextSibling()===null?y:u;for(let x=N.length-1;x>=0;x--){const w=N[x];if(w.is(u)||R(w)&&w.isParentOf(u))break;w.isAttached()&&(!S.has(w)||w.is(C)?T||E.insertAfter(w,!1):w.remove())}if(!T){let x=m,w=null;for(;x!==null;){const O=x.getChildren(),D=O.length;(D===0||O[D-1].is(w))&&(_.delete(x.__key),w=x),x=x.getParent()}}if(u.isToken())if(c===h)u.select();else{const x=tt(e);x.select(),u.replace(x)}else u=u.spliceText(c,h-c,e,!0),u.getTextContent()===""?u.remove():u.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let x=1;x<d;x++){const w=f[x],O=w.__key;_.has(O)||w.remove()}}}removeText(){this.insertText("")}formatText(e){if(this.isCollapsed())return this.toggleFormat(e),void He(null);const t=this.getNodes(),r=[];for(const m of t)X(m)&&r.push(m);const o=r.length;if(o===0)return this.toggleFormat(e),void He(null);const s=this.anchor,i=this.focus,l=this.isBackward(),c=l?i:s,a=l?s:i;let f=0,d=r[0],u=c.type==="element"?0:c.offset;if(c.type==="text"&&u===d.getTextContentSize()&&(f=1,d=r[1],u=0),d==null)return;const h=d.getFormatFlags(e,null),g=o-1;let p=r[g];const _=a.type==="text"?a.offset:p.getTextContentSize();if(d.is(p)){if(u===_)return;if(ar(d)||u===0&&_===d.getTextContentSize())d.setFormat(h);else{const m=d.splitText(u,_),C=u===0?m[0]:m[1];C.setFormat(h),c.type==="text"&&c.set(C.__key,0,"text"),a.type==="text"&&a.set(C.__key,_-u,"text")}return void(this.format=h)}u===0||ar(d)||([,d]=d.splitText(u),u=0),d.setFormat(h);const y=p.getFormatFlags(e,h);_>0&&(_===p.getTextContentSize()||ar(p)||([p]=p.splitText(_)),p.setFormat(y));for(let m=f+1;m<g;m++){const C=r[m],N=C.getFormatFlags(e,y);C.setFormat(N)}c.type==="text"&&c.set(d.__key,u,"text"),a.type==="text"&&a.set(p.__key,_,"text"),this.format=h|y}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const h=he();return te(h)||K(134),h.insertNodes(e)}const t=Ga((this.isBackward()?this.focus:this.anchor).getNode(),Wr),r=e[e.length-1];if("__language"in t&&R(t)){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const h=pu(this);t.splice(h,0,e),r.selectEnd()}return}if(!e.some(h=>(R(h)||we(h))&&!h.isInline())){R(t)||K(135);const h=pu(this);return t.splice(h,0,e),void r.selectEnd()}const o=function(h){const g=_n();let p=null;for(let _=0;_<h.length;_++){const y=h[_],m=hr(y);if(m||we(y)&&y.isInline()||R(y)&&y.isInline()||X(y)||y.isParentRequired()){if(p===null&&(p=y.createParentElementNode(),g.append(p),m))continue;p!==null&&p.append(y)}else g.append(y),p=null}return g}(e),s=o.getLastDescendant(),i=o.getChildren(),l=!R(t)||!t.isEmpty()?this.insertParagraph():null,c=i[i.length-1];let a=i[0];var f;R(f=a)&&Wr(f)&&!f.isEmpty()&&R(t)&&(!t.isEmpty()||t.canMergeWhenEmpty())&&(R(t)||K(135),t.append(...a.getChildren()),a=i[1]),a&&function(h,g,p){const _=g.getParentOrThrow().getLastChild();let y=g;const m=[g];for(;y!==_;)y.getNextSibling()||K(140),y=y.getNextSibling(),m.push(y);let C=h;for(const N of m)C=C.insertAfter(N)}(t,a);const d=Ga(s,Wr);l&&R(d)&&(l.canMergeWhenEmpty()||Wr(c))&&(d.append(...l.getChildren()),l.remove()),R(t)&&t.isEmpty()&&t.remove(),s.selectEnd();const u=R(t)?t.getLastChild():null;hr(u)&&d!==t&&u.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=_n();return Et().splice(this.anchor.offset,0,[i]),i.select(),i}const e=pu(this),t=Ga(this.anchor.getNode(),Wr);R(t)||K(136);const r=t.getChildAtIndex(e),o=r?[r,...r.getNextSiblings()]:[],s=t.insertNewAfter(this,!1);return s?(s.append(...o),s.selectStart(),s):null}insertLineBreak(e){const t=Hr();if(this.insertNodes([t]),e){const r=t.getParentOrThrow(),o=t.getIndexWithinParent();r.select(o,o)}}extract(){const e=this.getNodes(),t=e.length,r=t-1,o=this.anchor,s=this.focus;let i=e[0],l=e[r];const[c,a]=hu(this);if(t===0)return[];if(t===1){if(X(i)&&!this.isCollapsed()){const d=c>a?a:c,u=c>a?c:a,h=i.splitText(d,u),g=d===0?h[0]:h[1];return g!=null?[g]:[]}return[i]}const f=o.isBefore(s);if(X(i)){const d=f?c:a;d===i.getTextContentSize()?e.shift():d!==0&&([,i]=i.splitText(d),e[0]=i)}if(X(l)){const d=l.getTextContent().length,u=f?a:c;u===0?e.pop():u!==d&&([l]=l.splitText(u),e[r]=l)}return e}modify(e,t,r){const o=this.focus,s=this.anchor,i=e==="move",l=Ua(o,t);if(we(l)&&!l.isIsolated()){if(i&&l.isKeyboardSelectable()){const h=gu();return h.add(l.__key),void en(h)}const u=t?l.getPreviousSibling():l.getNextSibling();if(X(u)){const h=u.__key,g=t?u.getTextContent().length:0;return o.set(h,g,"text"),void(i&&s.set(h,g,"text"))}{const h=l.getParentOrThrow();let g,p;return R(u)?(p=u.__key,g=t?u.getChildrenSize():0):(g=l.getIndexWithinParent(),p=h.__key,t||g++),o.set(p,g,"element"),void(i&&s.set(p,g,"element"))}}const c=Ee(),a=tn(c._window);if(!a)return;const f=c._blockCursorElement,d=c._rootElement;if(d===null||f===null||!R(l)||l.isInline()||l.canBeEmpty()||Ja(f,c,d),function(u,h,g,p){u.modify(h,g,p)}(a,e,t?"backward":"forward",r),a.rangeCount>0){const u=a.getRangeAt(0),h=this.anchor.getNode(),g=mt(h)?h:mg(h);if(this.applyDOMRange(u),this.dirty=!0,!i){const p=this.getNodes(),_=[];let y=!1;for(let m=0;m<p.length;m++){const C=p[m];Ui(C,g)?_.push(C):y=!0}if(y&&_.length>0)if(t){const m=_[0];R(m)?m.selectStart():m.getParentOrThrow().selectStart()}else{const m=_[_.length-1];R(m)?m.selectEnd():m.getParentOrThrow().selectEnd()}a.anchorNode===u.startContainer&&a.anchorOffset===u.startOffset||function(m){const C=m.focus,N=m.anchor,S=N.key,T=N.offset,E=N.type;Wn(N,C.key,C.offset,C.type),Wn(C,S,T,E),m._cachedNodes=null}(this)}}}forwardDeletion(e,t,r){if(!r&&(e.type==="element"&&R(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const o=t.getParent(),s=t.getNextSibling()||(o===null?null:o.getNextSibling());if(R(s)&&s.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let o=r.getNode();if(this.forwardDeletion(r,o,e))return;const s=this.focus,i=Ua(s,e);if(we(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&R(o)&&o.getChildrenSize()===0){o.remove();const l=gu();l.add(i.__key),en(l)}else i.remove(),Ee().dispatchCommand(Ai,void 0);return}if(!e&&R(i)&&R(o)&&o.isEmpty())return o.remove(),void i.selectStart();if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&r.offset===0&&(r.type==="element"?r.getNode():r.getNode().getParentOrThrow()).collapseAtStart(this))return}else{const l=s.type==="text"?s.getNode():null;if(o=r.type==="text"?r.getNode():null,l!==null&&l.isSegmented()){const c=s.offset,a=l.getTextContentSize();if(l.is(o)||e&&c!==a||!e&&c!==0)return void Xg(l,e,c)}else if(o!==null&&o.isSegmented()){const c=r.offset,a=o.getTextContentSize();if(o.is(l)||e&&c!==0||!e&&c!==a)return void Xg(o,e,c)}(function(c,a){const f=c.anchor,d=c.focus,u=f.getNode(),h=d.getNode();if(u===h&&f.type==="text"&&d.type==="text"){const g=f.offset,p=d.offset,_=g<p,y=_?g:p,m=_?p:g,C=m-1;y!==C&&(cg(u.getTextContent().slice(y,m))||(a?d.offset=C:f.offset=C))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&mt(r.getParent())&&r.getIndexWithinParent()===0&&r.collapseAtStart(this)}}deleteLine(e){if(this.isCollapsed()){const t=this.anchor.type==="element";if(t&&this.insertText(" "),this.modify("extend",e,"lineboundary"),(e?this.focus:this.anchor).offset===0&&this.modify("extend",e,"character"),t){const r=e?this.anchor:this.focus;r.set(r.key,r.offset+1,r.type)}}this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,r=t.getNode();if(this.forwardDeletion(t,r,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Cs(n){return n instanceof rl}function Gg(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function hu(n){const e=n.getStartEndPoints();if(e===null)return[0,0];const[t,r]=e;return t.type==="element"&&r.type==="element"&&t.key===r.key&&t.offset===r.offset?[0,0]:[Gg(t),Gg(r)]}function Xg(n,e,t){const r=n,o=r.getTextContent().split(/(?=\s)/g),s=o.length;let i=0,l=0;for(let a=0;a<s;a++){const f=a===s-1;if(l=i,i+=o[a].length,e&&i===t||i>t||f){o.splice(a,1),f&&(l=void 0);break}}const c=o.join("").trim();c===""?r.remove():(r.setTextContent(c),r.select(l,l))}function qg(n,e,t,r){let o,s=e;if(n.nodeType===ts){let i=!1;const l=n.childNodes,c=l.length,a=r._blockCursorElement;s===c&&(i=!0,s=c-1);let f=l[s],d=!1;if(f===a)f=l[s+1],d=!0;else if(a!==null){const u=a.parentNode;n===u&&e>Array.prototype.indexOf.call(u.children,a)&&s--}if(o=Kr(f),X(o))s=lg(o,i);else{let u=Kr(n);if(u===null)return null;if(R(u)){s=Math.min(u.getChildrenSize(),s);let h=u.getChildAtIndex(s);if(R(h)&&function(g,p,_){const y=g.getParent();return _===null||y===null||!y.canBeEmpty()||y!==_.getNode()}(h,0,t)){const g=i?h.getLastDescendant():h.getFirstDescendant();g===null?u=h:(h=g,u=R(h)?h:h.getParentOrThrow()),s=0}X(h)?(o=h,u=null,s=lg(h,i)):h!==u&&i&&!d&&s++}else{const h=u.getIndexWithinParent();s=e===0&&we(u)&&Kr(n)===u?h:h+1,u=u.getParentOrThrow()}if(R(u))return Kt(u.__key,s,"element")}}else o=Kr(n);return X(o)?Kt(o.__key,s,"text"):null}function Qg(n,e,t){const r=n.offset,o=n.getNode();if(r===0){const s=o.getPreviousSibling(),i=o.getParent();if(e){if((t||!e)&&s===null&&R(i)&&i.isInline()){const l=i.getPreviousSibling();X(l)&&(n.key=l.__key,n.offset=l.getTextContent().length)}}else R(s)&&!t&&s.isInline()?(n.key=s.__key,n.offset=s.getChildrenSize(),n.type="element"):X(s)&&(n.key=s.__key,n.offset=s.getTextContent().length)}else if(r===o.getTextContent().length){const s=o.getNextSibling(),i=o.getParent();if(e&&R(s)&&s.isInline())n.key=s.__key,n.offset=0,n.type="element";else if((t||e)&&s===null&&R(i)&&i.isInline()&&!i.canInsertTextAfter()){const l=i.getNextSibling();X(l)&&(n.key=l.__key,n.offset=0)}}}function Zg(n,e,t){if(n.type==="text"&&e.type==="text"){const r=n.isBefore(e),o=n.is(e);Qg(n,r,o),Qg(e,!r,o),o&&(e.key=n.key,e.offset=n.offset,e.type=n.type);const s=Ee();if(s.isComposing()&&s._compositionKey!==n.key&&te(t)){const i=t.anchor,l=t.focus;Wn(n,i.key,i.offset,i.type),Wn(e,l.key,l.offset,l.type)}}}function ep(n,e,t,r,o,s){if(n===null||t===null||!os(o,n,t))return null;const i=qg(n,e,te(s)?s.anchor:null,o);if(i===null)return null;const l=qg(t,r,te(s)?s.focus:null,o);if(l===null)return null;if(i.type==="element"&&l.type==="element"){const c=Kr(n),a=Kr(t);if(we(c)&&we(a))return null}return Zg(i,l,s),[i,l]}function LT(n){return R(n)&&!n.isInline()}function tp(n,e,t,r,o,s){const i=rn(),l=new zn(Kt(n,e,o),Kt(t,r,s),0,"");return l.dirty=!0,i._selection=l,l}function FT(){const n=Kt("root",0,"element"),e=Kt("root",0,"element");return new zn(n,e,0,"")}function gu(){return new rl(new Set)}function BT(n,e){return ol(null,n,e,null)}function ol(n,e,t,r){const o=t._window;if(o===null)return null;const s=r||o.event,i=s?s.type:void 0,l=i==="selectionchange",c=!$a&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&s&&s.detail===3||i==="drop"||i===void 0);let a,f,d,u;if(te(n)&&!c)return n.clone();if(e===null)return null;if(a=e.anchorNode,f=e.focusNode,d=e.anchorOffset,u=e.focusOffset,l&&te(n)&&!os(t,a,f))return n.clone();const h=ep(a,d,f,u,t,n);if(h===null)return null;const[g,p]=h;return new zn(g,p,te(n)?n.format:0,te(n)?n.style:"")}function he(){return rn()._selection}function Jr(){return Ee()._editorState._selection}function sl(n,e,t,r=1){const o=n.anchor,s=n.focus,i=o.getNode(),l=s.getNode();if(!e.is(i)&&!e.is(l))return;const c=e.__key;if(n.isCollapsed()){const a=o.offset;if(t<=a&&r>0||t<a&&r<0){const f=Math.max(0,a+r);o.set(c,f,"element"),s.set(c,f,"element"),np(n)}}else{const a=n.isBackward(),f=a?s:o,d=f.getNode(),u=a?o:s,h=u.getNode();if(e.is(d)){const g=f.offset;(t<=g&&r>0||t<g&&r<0)&&f.set(c,Math.max(0,g+r),"element")}if(e.is(h)){const g=u.offset;(t<=g&&r>0||t<g&&r<0)&&u.set(c,Math.max(0,g+r),"element")}}np(n)}function np(n){const e=n.anchor,t=e.offset,r=n.focus,o=r.offset,s=e.getNode(),i=r.getNode();if(n.isCollapsed()){if(!R(s))return;const l=s.getChildrenSize(),c=t>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(X(a)){let f=0;c&&(f=a.getTextContentSize()),e.set(a.__key,f,"text"),r.set(a.__key,f,"text")}}else{if(R(s)){const l=s.getChildrenSize(),c=t>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(X(a)){let f=0;c&&(f=a.getTextContentSize()),e.set(a.__key,f,"text")}}if(R(i)){const l=i.getChildrenSize(),c=o>=l,a=c?i.getChildAtIndex(l-1):i.getChildAtIndex(o);if(X(a)){let f=0;c&&(f=a.getTextContentSize()),r.set(a.__key,f,"text")}}}}function il(n,e,t,r,o){let s=null,i=0,l=null;r!==null?(s=r.__key,X(r)?(i=r.getTextContentSize(),l="text"):R(r)&&(i=r.getChildrenSize(),l="element")):o!==null&&(s=o.__key,X(o)?l="text":R(o)&&(l="element")),s!==null&&l!==null?n.set(s,i,l):(i=e.getIndexWithinParent(),i===-1&&(i=t.getChildrenSize()),n.set(t.__key,i,"element"))}function rp(n,e,t,r,o){n.type==="text"?(n.key=t,e||(n.offset+=o)):n.offset>r.getIndexWithinParent()&&(n.offset-=1)}function KT(n,e,t,r,o,s,i){const l=r.anchorNode,c=r.focusNode,a=r.anchorOffset,f=r.focusOffset,d=document.activeElement;if(o.has("collaboration")&&d!==s||d!==null&&La(d))return;if(!te(e))return void(n!==null&&os(t,l,c)&&r.removeAllRanges());const u=e.anchor,h=e.focus,g=u.key,p=h.key,_=zi(t,g),y=zi(t,p),m=u.offset,C=h.offset,N=e.format,S=e.style,T=e.isCollapsed();let E=_,x=y,w=!1;if(u.type==="text"){E=Bi(_);const J=u.getNode();w=J.getFormat()!==N||J.getStyle()!==S}else te(n)&&n.anchor.type==="text"&&(w=!0);var O,D,B,q,Y;if(h.type==="text"&&(x=Bi(y)),E!==null&&x!==null&&(T&&(n===null||w||te(n)&&(n.format!==N||n.style!==S))&&(O=N,D=S,B=m,q=g,Y=performance.now(),Rg=[O,D,B,q,Y]),a!==m||f!==C||l!==E||c!==x||r.type==="Range"&&T||(d!==null&&s.contains(d)||s.focus({preventScroll:!0}),u.type==="element"))){try{r.setBaseAndExtent(E,m,x,C)}catch{}if(!o.has("skip-scroll-into-view")&&e.isCollapsed()&&s!==null&&s===document.activeElement){const J=e instanceof zn&&e.anchor.type==="element"?E.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(J!==null){let oe;if(J instanceof Text){const F=document.createRange();F.selectNode(J),oe=F.getBoundingClientRect()}else oe=J.getBoundingClientRect();(function(F,ce,se){const We=se.ownerDocument,ae=We.defaultView;if(ae===null)return;let{top:Ae,bottom:Ge}=ce,Xe=0,qe=0,Te=se;for(;Te!==null;){const nt=Te===We.body;if(nt)Xe=0,qe=Hi(F).innerHeight;else{const ve=Te.getBoundingClientRect();Xe=ve.top,qe=ve.bottom}let ze=0;if(Ae<Xe?ze=-(Xe-Ae):Ge>qe&&(ze=Ge-qe),ze!==0)if(nt)ae.scrollBy(0,ze);else{const ve=Te.scrollTop;Te.scrollTop+=ze;const St=Te.scrollTop-ve;Ae-=St,Ge-=St}if(nt)break;Te=ji(Te)}})(t,oe,s)}}su=!0}}function WT(n){let e=he()||Jr();e===null&&(e=Et().selectEnd()),e.insertNodes(n)}function zT(){const n=he();return n===null?"":n.getTextContent()}function pu(n){let e=n;n.isCollapsed()||e.removeText();const t=he();te(t)&&(e=t),te(e)||K(161);const r=e.anchor;let o=r.getNode(),s=r.offset;for(;!Wr(o);)[o,s]=jT(o,s);return s}function jT(n,e){const t=n.getParent();if(!t){const o=_n();return Et().append(o),o.select(),[Et(),0]}if(X(n)){const o=n.splitText(e);if(o.length===0)return[t,n.getIndexWithinParent()];const s=e===0?0:1;return[t,o[0].getIndexWithinParent()+s]}if(!R(n)||e===0)return[t,n.getIndexWithinParent()];const r=n.getChildAtIndex(e);if(r){const o=new zn(Kt(n.__key,e,"element"),Kt(n.__key,e,"element"),0,""),s=n.insertNewAfter(o);s&&s.append(r,...r.getNextSiblings())}return[t,n.getIndexWithinParent()+1]}let Ye=null,Je=null,_t=!1,_u=!1,ll=0;const op={characterData:!0,childList:!0,subtree:!0};function Vr(){return _t||Ye!==null&&Ye._readOnly}function dt(){_t&&K(13)}function sp(){ll>99&&K(14)}function rn(){return Ye===null&&K(195,ip()),Ye}function Ee(){return Je===null&&K(196,ip()),Je}function ip(){let n=0;const e=new Set,t=al.version;if(typeof window<"u")for(const o of document.querySelectorAll("[contenteditable]")){const s=ss(o);if(Fi(s))n++;else if(s){let i=String(s.constructor.version||"<0.17.1");i===t&&(i+=" (separately built, likely a bundler configuration issue)"),e.add(i)}}let r=` Detected on the page: ${n} compatible editor(s) with version ${t}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function UT(){return Je}function lp(n,e,t){const r=e.__type,o=function(l,c){const a=l._nodes.get(c);return a===void 0&&K(30,c),a}(n,r);let s=t.get(r);s===void 0&&(s=Array.from(o.transforms),t.set(r,s));const i=s.length;for(let l=0;l<i&&(s[l](e),e.isAttached());l++);}function cp(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function HT(n){return mu(n,Ee()._nodes)}function mu(n,e){const t=n.type,r=e.get(t);r===void 0&&K(17,t);const o=r.klass;n.type!==o.getType()&&K(18,o.name);const s=o.importJSON(n),i=n.children;if(R(s)&&Array.isArray(i))for(let l=0;l<i.length;l++){const c=mu(i[l],e);s.append(c)}return s}function ap(n,e,t){const r=Ye,o=_t,s=Je;Ye=e,_t=!0,Je=n;try{return t()}finally{Ye=r,_t=o,Je=s}}function jn(n,e){const t=n._pendingEditorState,r=n._rootElement,o=n._headless||r===null;if(t===null)return;const s=n._editorState,i=s._selection,l=t._selection,c=n._dirtyType!==cr,a=Ye,f=_t,d=Je,u=n._updating,h=n._observer;let g=null;if(n._pendingEditorState=null,n._editorState=t,!o&&c&&h!==null){Je=n,Ye=t,_t=!1,n._updating=!0;try{const T=n._dirtyType,E=n._dirtyElements,x=n._dirtyLeaves;h.disconnect(),g=vT(s,t,n,T,E,x)}catch(T){if(T instanceof Error&&n._onError(T),_u)throw T;return mp(n,null,r,t),Gh(n),n._dirtyType=Br,_u=!0,jn(n,s),void(_u=!1)}finally{h.observe(r,op),n._updating=u,Ye=a,_t=f,Je=d}}t._readOnly||(t._readOnly=!0);const p=n._dirtyLeaves,_=n._dirtyElements,y=n._normalizedNodes,m=n._updateTags,C=n._deferred;c&&(n._dirtyType=cr,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements=new Map,n._normalizedNodes=new Set,n._updateTags=new Set),function(T,E){const x=T._decorators;let w=T._pendingDecorators||x;const O=E._nodeMap;let D;for(D in w)O.has(D)||(w===x&&(w=og(T)),delete w[D])}(n,t);const N=o?null:tn(n._window);if(n._editable&&N!==null&&(c||l===null||l.dirty)){Je=n,Ye=t;try{if(h!==null&&h.disconnect(),c||l===null||l.dirty){const T=n._blockCursorElement;T!==null&&Ja(T,n,r),KT(i,l,n,N,m,r)}ST(n,r,l),h!==null&&h.observe(r,op)}finally{Je=d,Ye=a}}g!==null&&function(T,E,x,w,O){const D=Array.from(T._listeners.mutation),B=D.length;for(let q=0;q<B;q++){const[Y,J]=D[q],oe=E.get(J);oe!==void 0&&Y(oe,{dirtyLeaves:w,prevEditorState:O,updateTags:x})}}(n,g,m,p,s),te(l)||l===null||i!==null&&i.is(l)||n.dispatchCommand(Ai,void 0);const S=n._pendingDecorators;S!==null&&(n._decorators=S,n._pendingDecorators=null,Ns("decorator",n,!0,S)),function(T,E,x){const w=sg(E),O=sg(x);w!==O&&Ns("textcontent",T,!0,O)}(n,e||s,t),Ns("update",n,!0,{dirtyElements:_,dirtyLeaves:p,editorState:t,normalizedNodes:y,prevEditorState:e||s,tags:m}),function(T,E){if(T._deferred=[],E.length!==0){const x=T._updating;T._updating=!0;try{for(let w=0;w<E.length;w++)E[w]()}finally{T._updating=x}}}(n,C),function(T){const E=T._updates;if(E.length!==0){const x=E.shift();if(x){const[w,O]=x;dp(T,w,O)}}}(n)}function Ns(n,e,t,...r){const o=e._updating;e._updating=t;try{const s=Array.from(e._listeners[n]);for(let i=0;i<s.length;i++)s[i].apply(null,r)}finally{e._updating=o}}function up(n,e,t){if(n._updating===!1||Je!==n){let o=!1;return n.update(()=>{o=up(n,e,t)}),o}const r=Ka(n);for(let o=4;o>=0;o--)for(let s=0;s<r.length;s++){const i=r[s]._commands.get(e);if(i!==void 0){const l=i[o];if(l!==void 0){const c=Array.from(l),a=c.length;for(let f=0;f<a;f++)if(c[f](t,n)===!0)return!0}}}return!1}function fp(n,e){const t=n._updates;let r=e||!1;for(;t.length!==0;){const o=t.shift();if(o){const[s,i]=o;let l,c;if(i!==void 0){if(l=i.onUpdate,c=i.tag,i.skipTransforms&&(r=!0),i.discrete){const a=n._pendingEditorState;a===null&&K(191),a._flushSync=!0}l&&n._deferred.push(l),c&&n._updateTags.add(c)}s()}}return r}function dp(n,e,t){const r=n._updateTags;let o,s,i=!1,l=!1;t!==void 0&&(o=t.onUpdate,s=t.tag,s!=null&&r.add(s),i=t.skipTransforms||!1,l=t.discrete||!1),o&&n._deferred.push(o);const c=n._editorState;let a=n._pendingEditorState,f=!1;(a===null||a._readOnly)&&(a=n._pendingEditorState=new cl(new Map((a||c)._nodeMap)),f=!0),a._flushSync=l;const d=Ye,u=_t,h=Je,g=n._updating;Ye=a,_t=!1,n._updating=!0,Je=n;try{f&&(n._headless?c._selection!==null&&(a._selection=c._selection.clone()):a._selection=function(m){const C=m.getEditorState()._selection,N=tn(m._window);return te(C)||C==null?ol(C,N,m,null):C.clone()}(n));const _=n._compositionKey;e(),i=fp(n,i),function(m,C){const N=C.getEditorState()._selection,S=m._selection;if(te(S)){const T=S.anchor,E=S.focus;let x;if(T.type==="text"&&(x=T.getNode(),x.selectionTransform(N,S)),E.type==="text"){const w=E.getNode();x!==w&&w.selectionTransform(N,S)}}}(a,n),n._dirtyType!==cr&&(i?function(m,C){const N=C._dirtyLeaves,S=m._nodeMap;for(const T of N){const E=S.get(T);X(E)&&E.isAttached()&&E.isSimpleText()&&!E.isUnmergeable()&&Qh(E)}}(a,n):function(m,C){const N=C._dirtyLeaves,S=C._dirtyElements,T=m._nodeMap,E=Ln(),x=new Map;let w=N,O=w.size,D=S,B=D.size;for(;O>0||B>0;){if(O>0){C._dirtyLeaves=new Set;for(const q of w){const Y=T.get(q);X(Y)&&Y.isAttached()&&Y.isSimpleText()&&!Y.isUnmergeable()&&Qh(Y),Y!==void 0&&cp(Y,E)&&lp(C,Y,x),N.add(q)}if(w=C._dirtyLeaves,O=w.size,O>0){ll++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map;for(const q of D){const Y=q[0],J=q[1];if(Y!=="root"&&!J)continue;const oe=T.get(Y);oe!==void 0&&cp(oe,E)&&lp(C,oe,x),S.set(Y,J)}w=C._dirtyLeaves,O=w.size,D=C._dirtyElements,B=D.size,ll++}C._dirtyLeaves=N,C._dirtyElements=S}(a,n),fp(n),function(m,C,N,S){const T=m._nodeMap,E=C._nodeMap,x=[];for(const[w]of S){const O=E.get(w);O!==void 0&&(O.isAttached()||(R(O)&&xg(O,w,T,E,x,S),T.has(w)||S.delete(w),x.push(w)))}for(const w of x)E.delete(w);for(const w of N){const O=E.get(w);O===void 0||O.isAttached()||(T.has(w)||N.delete(w),E.delete(w))}}(c,a,n._dirtyLeaves,n._dirtyElements)),_!==n._compositionKey&&(a._flushSync=!0);const y=a._selection;if(te(y)){const m=a._nodeMap,C=y.anchor.key,N=y.focus.key;m.get(C)!==void 0&&m.get(N)!==void 0||K(19)}else Cs(y)&&y._nodes.size===0&&(a._selection=null)}catch(_){return _ instanceof Error&&n._onError(_),n._pendingEditorState=c,n._dirtyType=Br,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),void jn(n)}finally{Ye=d,_t=u,Je=h,n._updating=g,ll=0}n._dirtyType!==cr||function(_,y){const m=y.getEditorState()._selection,C=_._selection;if(C!==null){if(C.dirty||!C.is(m))return!0}else if(m!==null)return!0;return!1}(a,n)?a._flushSync?(a._flushSync=!1,jn(n)):f&&fT(()=>{jn(n)}):(a._flushSync=!1,f&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function wt(n,e,t){n._updating?n._updates.push([e,t]):dp(n,e,t)}class Ss extends Zi{constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return nT[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=Ee()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(X(t)&&e.push(t),R(t)){const r=t.getAllTextNodes();e.push(...r)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;R(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;R(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),r=t.length;if(e>=r){const s=t[r-1];return R(s)&&s.getLastDescendant()||s||null}const o=t[e];return R(o)&&o.getFirstDescendant()||o||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:et(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&K(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:et(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&K(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let r,o;if(e<t/2){for(r=this.getFirstChild(),o=0;r!==null&&o<=e;){if(o===e)return r;r=r.getNextSibling(),o++}return null}for(r=this.getLastChild(),o=t-1;r!==null&&o>=e;){if(o===e)return r;r=r.getPreviousSibling(),o--}return null}getTextContent(){let e="";const t=this.getChildren(),r=t.length;for(let o=0;o<r;o++){const s=t[o];e+=s.getTextContent(),R(s)&&o!==r-1&&!s.isInline()&&(e+=hn)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),r=t.length;for(let o=0;o<r;o++){const s=t[o];e+=s.getTextContentSize(),R(s)&&o!==r-1&&!s.isInline()&&(e+=hn.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=Yh[e];return!!(this.getFormat()&t)}return!1}select(e,t){dt();const r=he();let o=e,s=t;const i=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const c=this.getFirstChild();if(X(c)||R(c))return c.select(0,0)}else if(!(e!==void 0&&e!==i||t!==void 0&&t!==i)){const c=this.getLastChild();if(X(c)||R(c))return c.select()}}o===void 0&&(o=i),s===void 0&&(s=i);const l=this.__key;return te(r)?(r.anchor.set(l,o,"element"),r.focus.set(l,s,"element"),r.dirty=!0,r):tp(l,o,l,s,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(t=>t.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==""?Yh[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,r){const o=r.length,s=this.getChildrenSize(),i=this.getWritable(),l=i.__key,c=[],a=[],f=this.getChildAtIndex(e+t);let d=null,u=s-t+o;if(e!==0)if(e===s)d=this.getLastChild();else{const g=this.getChildAtIndex(e);g!==null&&(d=g.getPreviousSibling())}if(t>0){let g=d===null?this.getFirstChild():d.getNextSibling();for(let p=0;p<t;p++){g===null&&K(100);const _=g.getNextSibling(),y=g.__key;ur(g.getWritable()),a.push(y),g=_}}let h=d;for(let g=0;g<o;g++){const p=r[g];h!==null&&p.is(h)&&(d=h=h.getPreviousSibling());const _=p.getWritable();_.__parent===l&&u--,ur(_);const y=p.__key;if(h===null)i.__first=y,_.__prev=null;else{const m=h.getWritable();m.__next=y,_.__prev=m.__key}p.__key===l&&K(76),_.__parent=l,c.push(y),h=p}if(e+t===s)h!==null&&(h.getWritable().__next=null,i.__last=h.__key);else if(f!==null){const g=f.getWritable();if(h!==null){const p=h.getWritable();g.__prev=h.__key,p.__next=f.__key}else g.__prev=null}if(i.__size=u,a.length){const g=he();if(te(g)){const p=new Set(a),_=new Set(c),{anchor:y,focus:m}=g;hp(y,p,_)&&il(y,y.getNode(),this,d,f),hp(m,p,_)&&il(m,m.getNode(),this,d,f),u!==0||this.canBeEmpty()||Fn(this)||this.remove()}}return i}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",version:1}}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,r){return!1}canMergeWhenEmpty(){return!1}}function R(n){return n instanceof Ss}function hp(n,e,t){let r=n.getNode();for(;r;){const o=r.__key;if(e.has(o)&&!t.has(o))return!0;r=r.getParent()}return!1}class gp extends Zi{constructor(e){super(e)}decorate(e,t){K(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function we(n){return n instanceof gp}class Gr extends Ss{static getType(){return"root"}static clone(){return new Gr}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){K(51)}getTextContent(){const e=this.__cachedText;return!Vr()&&Ee()._dirtyType!==cr||e===null?super.getTextContent():e}remove(){K(52)}replace(e){K(53)}insertBefore(e){K(54)}insertAfter(e){K(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const r=e[t];R(r)||we(r)||K(56)}return super.append(...e)}static importJSON(e){const t=Et();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}collapseAtStart(){return!0}}function mt(n){return n instanceof Gr}function yu(){return new cl(new Map([["root",new Gr]]))}function pp(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType()&&K(130,t.name),R(n)){const r=e.children;Array.isArray(r)||K(59,t.name);const o=n.getChildren();for(let s=0;s<o.length;s++){const i=pp(o[s]);r.push(i)}}return e}class cl{constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return ap(t&&t.editor||null,this,e)}clone(e){const t=new cl(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return ap(null,this,()=>({root:pp(Et())}))}}class _p extends Ss{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class pr extends Ss{constructor(e){super(e),this.__textFormat=0,this.__textStyle=""}static getType(){return"paragraph"}getTextFormat(){return this.getLatest().__textFormat}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}hasTextFormat(e){const t=Zt[e];return!!(this.getTextFormat()&t)}getTextStyle(){return this.getLatest().__textStyle}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}static clone(e){return new pr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),r=us(e.theme,"paragraph");return r!==void 0&&t.classList.add(...r),t}updateDOM(e,t,r){return!1}static importDOM(){return{p:e=>({conversion:YT,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Yi(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();t.style.textAlign=r;const o=this.getDirection();o&&(t.dir=o);const s=this.getIndent();s>0&&(t.style.textIndent=20*s+"px")}return{element:t}}static importJSON(e){const t=_n();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t.setTextFormat(e.textFormat),t}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle(),type:"paragraph",version:1}}insertNewAfter(e,t){const r=_n();r.setTextFormat(e.format),r.setTextStyle(e.style);const o=this.getDirection();return r.setDirection(o),r.setFormat(this.getFormatType()),r.setStyle(this.getTextStyle()),this.insertAfter(r,t),r}collapseAtStart(){const e=this.getChildren();if(e.length===0||X(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function YT(n){const e=_n();if(n.style){e.setFormat(n.style.textAlign);const t=parseInt(n.style.textIndent,10)/20;t>0&&e.setIndent(t)}return{node:e}}function _n(){return fs(new pr)}function Cu(n){return n instanceof pr}const JT=0,VT=1,GT=2,XT=3,qT=4;function mp(n,e,t,r){const o=n._keyToDOMMap;o.clear(),n._editorState=yu(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=cr,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,n._updateTags=new Set,n._updates=[],n._blockCursorElement=null;const s=n._observer;s!==null&&(s.disconnect(),n._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",o.set("root",t))}function QT(n){const e=n||{},t=UT(),r=e.theme||{},o=n===void 0?t:e.parentEditor||null,s=e.disableEvents||!1,i=yu(),l=e.namespace||(o!==null?o._config.namespace:ag()),c=e.editorState,a=[Gr,gr,Ur,Yr,pr,_p,...e.nodes||[]],{onError:f,html:d}=e,u=e.editable===void 0||e.editable;let h;if(n===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let p=0;p<a.length;p++){let _=a[p],y=null,m=null;if(typeof _!="function"){const T=_;_=T.replace,y=T.with,m=T.withKlass||null}const C=_.getType(),N=_.transform(),S=new Set;N!==null&&S.add(N),h.set(C,{exportDOM:d&&d.export?d.export.get(_):void 0,klass:_,replace:y,replaceWithKlass:m,transforms:S})}}const g=new al(i,o,h,{disableEvents:s,namespace:l,theme:r},f||console.error,function(p,_){const y=new Map,m=new Set,C=N=>{Object.keys(N).forEach(S=>{let T=y.get(S);T===void 0&&(T=[],y.set(S,T)),T.push(N[S])})};return p.forEach(N=>{const S=N.klass.importDOM;if(S==null||m.has(S))return;m.add(S);const T=S.call(N.klass);T!==null&&C(T)}),_&&C(_),y}(h,d?d.import:void 0),u);return c!==void 0&&(g._pendingEditorState=c,g._dirtyType=Br),g}class al{constructor(e,t,r,o,s,i,l){this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=o,this._nodes=r,this._decorators={},this._pendingDecorators=null,this._dirtyType=cr,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=ag(),this._onError=s,this._htmlConversions=i,this._editable=l,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,r){r===void 0&&K(35);const o=this._commands;o.has(e)||o.set(e,[new Set,new Set,new Set,new Set,new Set]);const s=o.get(e);s===void 0&&K(36,String(e));const i=s[r];return i.add(t),()=>{i.delete(t),s.every(l=>l.size===0)&&o.delete(e)}}registerMutationListener(e,t,r){const o=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,s=this._listeners.mutation;s.set(t,o);const i=r&&r.skipInitialization;return i===void 0||i||this.initializeMutationListener(t,o),()=>{s.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&K(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const r=this._editorState,o=Sg(r).get(t.getType());if(!o)return;const s=new Map;for(const i of o.keys())s.set(i,"created");s.size>0&&e(s,{dirtyLeaves:new Set,prevEditorState:r,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const r=this.getRegisteredNode(e);return r.transforms.add(t),r}registerNodeTransform(e,t){const r=this.registerNodeTransformToKlass(e,t),o=[r],s=r.replaceWithKlass;if(s!=null){const c=this.registerNodeTransformToKlass(s,t);o.push(c)}var i,l;return i=this,l=e.getType(),wt(i,()=>{const c=rn();if(c.isEmpty())return;if(l==="root")return void Et().markDirty();const a=c._nodeMap;for(const[,f]of a)f.markDirty()},i._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{o.forEach(c=>c.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return H(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const r=us(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=e,mp(this,t,e,o),t!==null&&(this._config.disableEvents||MT(t),r!=null&&t.classList.remove(...r)),e!==null){const s=function(l){const c=l.ownerDocument;return c&&c.defaultView||null}(e),i=e.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=s,this._dirtyType=Br,Gh(this),this._updateTags.add("history-merge"),jn(this),this._config.disableEvents||function(l,c){const a=l.ownerDocument,f=Qi.get(a);(f===void 0||f<1)&&a.addEventListener("selectionchange",Bg),Qi.set(a,(f||0)+1),l.__lexicalEditor=c;const d=Fg(l);for(let u=0;u<ou.length;u++){const[h,g]=ou[u],p=typeof g=="function"?_=>{Wg(_)||(Kg(_),(c.isEditable()||h==="click")&&g(_,c))}:_=>{if(Wg(_))return;Kg(_);const y=c.isEditable();switch(h){case"cut":return y&&H(c,Ea,_);case"copy":return H(c,xa,_);case"paste":return y&&H(c,Ca,_);case"dragstart":return y&&H(c,Ph,_);case"dragover":return y&&H(c,Ih,_);case"dragend":return y&&H(c,Lh,_);case"focus":return y&&H(c,Fh,_);case"blur":return y&&H(c,Bh,_);case"drop":return y&&H(c,$h,_)}};l.addEventListener(h,p),d.push(()=>{l.removeEventListener(h,p)})}}(e,this),r!=null&&e.classList.add(...r)}else this._editorState=o,this._pendingEditorState=null,this._window=null;Ns("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&K(38),Vh(this);const r=this._pendingEditorState,o=this._updateTags,s=t!==void 0?t.tag:null;r===null||r.isEmpty()||(s!=null&&o.add(s),jn(this)),this._pendingEditorState=e,this._dirtyType=Br,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&o.add(s),jn(this)}parseEditorState(e,t){return function(r,o,s){const i=yu(),l=Ye,c=_t,a=Je,f=o._dirtyElements,d=o._dirtyLeaves,u=o._cloneNotNeeded,h=o._dirtyType;o._dirtyElements=new Map,o._dirtyLeaves=new Set,o._cloneNotNeeded=new Set,o._dirtyType=0,Ye=i,_t=!1,Je=o;try{const g=o._nodes;mu(r.root,g),s&&s(),i._readOnly=!0}catch(g){g instanceof Error&&o._onError(g)}finally{o._dirtyElements=f,o._dirtyLeaves=d,o._cloneNotNeeded=u,o._dirtyType=h,Ye=l,_t=c,Je=a}return i}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return jn(this),this.getEditorState().read(e,{editor:this})}update(e,t){wt(this,e,t)}focus(e,t={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),wt(this,()=>{const o=he(),s=Et();o!==null?o.dirty=!0:s.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?s.selectStart():s.selectEnd())},{onUpdate:()=>{r.removeAttribute("autocapitalize"),e&&e()},tag:"focus"}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=tn(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Ns("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}al.version="0.17.1+prod.esm";const ZT=Object.freeze(Object.defineProperty({__proto__:null,$addUpdateTag:yT,$applyNodeReplacement:fs,$cloneWithProperties:Tg,$copyNode:yg,$createLineBreakNode:Hr,$createNodeSelection:gu,$createParagraphNode:_n,$createPoint:Kt,$createRangeSelection:FT,$createRangeSelectionFromDom:BT,$createTabNode:nl,$createTextNode:tt,$getAdjacentNode:Ua,$getCharacterOffsets:hu,$getEditor:ET,$getNearestNodeFromDOMNode:is,$getNearestRootOrShadowRoot:mg,$getNodeByKey:et,$getNodeByKeyOrThrow:NT,$getPreviousSelection:Jr,$getRoot:Et,$getSelection:he,$getTextContent:zT,$hasAncestor:Ui,$hasUpdateTag:mT,$insertNodes:WT,$isBlockElementNode:LT,$isDecoratorNode:we,$isElementNode:R,$isInlineElementOrDecoratorNode:CT,$isLeafNode:hT,$isLineBreakNode:hr,$isNodeSelection:Cs,$isParagraphNode:Cu,$isRangeSelection:te,$isRootNode:mt,$isRootOrShadowRoot:Fn,$isTabNode:Jg,$isTextNode:X,$isTokenOrSegmented:ar,$nodesOfType:_T,$normalizeSelection__EXPERIMENTAL:Zh,$parseSerializedNode:HT,$selectAll:pT,$setCompositionKey:He,$setSelection:en,$splitNode:TT,ArtificialNode__DO_NOT_USE:_p,BLUR_COMMAND:Bh,CAN_REDO_COMMAND:BS,CAN_UNDO_COMMAND:KS,CLEAR_EDITOR_COMMAND:LS,CLEAR_HISTORY_COMMAND:FS,CLICK_COMMAND:Sh,COMMAND_PRIORITY_CRITICAL:qT,COMMAND_PRIORITY_EDITOR:JT,COMMAND_PRIORITY_HIGH:XT,COMMAND_PRIORITY_LOW:VT,COMMAND_PRIORITY_NORMAL:GT,CONTROLLED_TEXT_INSERTION_COMMAND:Fr,COPY_COMMAND:xa,CUT_COMMAND:Ea,DELETE_CHARACTER_COMMAND:qo,DELETE_LINE_COMMAND:es,DELETE_WORD_COMMAND:Zo,DRAGEND_COMMAND:Lh,DRAGOVER_COMMAND:Ih,DRAGSTART_COMMAND:Ph,DROP_COMMAND:$h,DecoratorNode:gp,ElementNode:Ss,FOCUS_COMMAND:Fh,FORMAT_ELEMENT_COMMAND:IS,FORMAT_TEXT_COMMAND:$n,INDENT_CONTENT_COMMAND:$S,INSERT_LINE_BREAK_COMMAND:Qo,INSERT_PARAGRAPH_COMMAND:ya,INSERT_TAB_COMMAND:RS,IS_ALL_FORMATTING:jh,IS_BOLD:JS,IS_CODE:GS,IS_HIGHLIGHT:Pi,IS_ITALIC:VS,IS_STRIKETHROUGH:ns,IS_SUBSCRIPT:XS,IS_SUPERSCRIPT:qS,IS_UNDERLINE:rs,KEY_ARROW_DOWN_COMMAND:vh,KEY_ARROW_LEFT_COMMAND:wh,KEY_ARROW_RIGHT_COMMAND:xh,KEY_ARROW_UP_COMMAND:Oh,KEY_BACKSPACE_COMMAND:Dh,KEY_DELETE_COMMAND:kh,KEY_DOWN_COMMAND:Th,KEY_ENTER_COMMAND:ki,KEY_ESCAPE_COMMAND:Ah,KEY_MODIFIER_COMMAND:Kh,KEY_SPACE_COMMAND:Mh,KEY_TAB_COMMAND:Rh,LineBreakNode:Ur,MOVE_TO_END:Eh,MOVE_TO_START:bh,OUTDENT_CONTENT_COMMAND:PS,PASTE_COMMAND:Ca,ParagraphNode:pr,REDO_COMMAND:Ta,REMOVE_TEXT_COMMAND:Na,RootNode:Gr,SELECTION_CHANGE_COMMAND:Ai,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:kS,SELECT_ALL_COMMAND:wa,TEXT_TYPE_TO_FORMAT:Zt,TabNode:Yr,TextNode:gr,UNDO_COMMAND:Sa,createCommand:AS,createEditor:QT,getEditorPropertyFromDOMNode:ss,getNearestEditorFromDOMNode:Fa,isBlockDomNode:Va,isCurrentlyReadOnlyMode:Vr,isHTMLAnchorElement:xT,isHTMLElement:Yi,isInlineDomNode:Cg,isLexicalEditor:Fi,isSelectionCapturedInDecoratorInput:La,isSelectionWithinEditor:os,resetRandomKey:uT},Symbol.toStringTag,{value:"Module"})),P=process.env.NODE_ENV==="development"?DS:ZT,ot=P.$applyNodeReplacement,Un=P.$cloneWithProperties,ul=P.$createLineBreakNode,ie=P.$createParagraphNode,fl=P.$createPoint,dl=P.$createRangeSelection,yp=P.$createRangeSelectionFromDom,hl=P.$createTabNode,bt=P.$createTextNode,Xr=P.$getAdjacentNode,Cp=P.$getCharacterOffsets,Np=P.$getEditor,be=P.$getNearestNodeFromDOMNode,Ot=P.$getNodeByKey,Hn=P.$getPreviousSelection,Oe=P.$getRoot,M=P.$getSelection,Sp=P.$hasAncestor,Tp=P.$insertNodes,qr=P.$isBlockElementNode,st=P.$isDecoratorNode,A=P.$isElementNode,xp=P.$isLeafNode,gl=P.$isLineBreakNode,Ve=P.$isNodeSelection,pl=P.$isParagraphNode,v=P.$isRangeSelection,Yn=P.$isRootNode,it=P.$isRootOrShadowRoot,L=P.$isTextNode,Qr=P.$isTokenOrSegmented,_l=P.$normalizeSelection__EXPERIMENTAL,Ep=P.$parseSerializedNode,wp=P.$selectAll,Pe=P.$setSelection,ml=P.$splitNode,yl=P.ArtificialNode__DO_NOT_USE,mn=P.CAN_REDO_COMMAND,yn=P.CAN_UNDO_COMMAND,bp=P.CLEAR_EDITOR_COMMAND,Op=P.CLEAR_HISTORY_COMMAND,vp=P.CLICK_COMMAND,ye=P.COMMAND_PRIORITY_CRITICAL,V=P.COMMAND_PRIORITY_EDITOR,vt=P.COMMAND_PRIORITY_HIGH,Cl=P.CONTROLLED_TEXT_INSERTION_COMMAND,Nl=P.COPY_COMMAND,Sl=P.CUT_COMMAND,Jn=P.DELETE_CHARACTER_COMMAND,Zr=P.DELETE_LINE_COMMAND,Tl=P.DELETE_WORD_COMMAND,Mp=P.DRAGOVER_COMMAND,Dp=P.DRAGSTART_COMMAND,Ap=P.DROP_COMMAND,yt=P.ElementNode,kp=P.FOCUS_COMMAND,Vn=P.FORMAT_ELEMENT_COMMAND,Gn=P.FORMAT_TEXT_COMMAND,Rp=P.INDENT_CONTENT_COMMAND,xl=P.INSERT_LINE_BREAK_COMMAND,eo=P.INSERT_PARAGRAPH_COMMAND,$p=P.INSERT_TAB_COMMAND,El=P.KEY_ARROW_DOWN_COMMAND,wl=P.KEY_ARROW_LEFT_COMMAND,bl=P.KEY_ARROW_RIGHT_COMMAND,Ol=P.KEY_ARROW_UP_COMMAND,vl=P.KEY_BACKSPACE_COMMAND,Ml=P.KEY_DELETE_COMMAND,Pp=P.KEY_ENTER_COMMAND,Dl=P.KEY_ESCAPE_COMMAND,Ip=P.KEY_TAB_COMMAND,Al=P.OUTDENT_CONTENT_COMMAND,Lp=P.PASTE_COMMAND,Nu=P.REDO_COMMAND,Fp=P.REMOVE_TEXT_COMMAND,Wt=P.SELECTION_CHANGE_COMMAND,kl=P.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,Bp=P.SELECT_ALL_COMMAND,to=P.TextNode,Su=P.UNDO_COMMAND,no=P.createCommand,ex=P.createEditor,Kp=P.isBlockDomNode,Wp=P.isCurrentlyReadOnlyMode,zp=P.isHTMLAnchorElement,jp=P.isHTMLElement,ro=P.isInlineDomNode,Up=P.isSelectionCapturedInDecoratorInput,Hp=P.isSelectionWithinEditor,Pv="";function tx(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var nx=tx(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const Yp=I.createContext(null);function rx(n,e){let t=null;return n!=null&&(t=n[1]),{getTheme:function(){return e??(t!=null?t.getTheme():null)}}}function Xn(){const n=I.useContext(Yp);return n==null&&nx(8),n}const Jp=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,ox=Jp?I.useLayoutEffect:I.useEffect,Rl={tag:"history-merge"};function sx({initialConfig:n,children:e}){const t=I.useMemo(()=>{const{theme:r,namespace:o,nodes:s,onError:i,editorState:l,html:c}=n,a=rx(null,r),f=ex({editable:n.editable,html:c,namespace:o,nodes:s,onError:d=>i(d,f),theme:r});return function(d,u){if(u!==null){if(u===void 0)d.update(()=>{const h=Oe();if(h.isEmpty()){const g=ie();h.append(g);const p=Jp?document.activeElement:null;(M()!==null||p!==null&&p===d.getRootElement())&&g.select()}},Rl);else if(u!==null)switch(typeof u){case"string":{const h=d.parseEditorState(u);d.setEditorState(h,Rl);break}case"object":d.setEditorState(u,Rl);break;case"function":d.update(()=>{Oe().isEmpty()&&u(d)},Rl)}}}(f,l),[f,a]},[]);return ox(()=>{const r=n.editable,[o]=t;o.setEditable(r===void 0||r)},[]),W.exports.jsx(Yp.Provider,{value:t,children:e})}function ix({defaultSelection:n}){const[e]=Xn();return I.useEffect(()=>{e.focus(()=>{const t=document.activeElement,r=e.getRootElement();r===null||t!==null&&r.contains(t)||r.focus({preventScroll:!0})},{defaultSelection:n})},[n,e]),null}function Vp(){return Oe().getTextContent()}function Tu(n,e=!0){if(n)return!1;let t=Vp();return e&&(t=t.trim()),t===""}function lx(n,e){return()=>Tu(n,e)}function Gp(n){if(!Tu(n,!1))return!1;const t=Oe().getChildren(),r=t.length;if(r>1)return!1;for(let o=0;o<r;o++){const s=t[o];if(st(s))return!1;if(A(s)){if(!pl(s)||s.__indent!==0)return!1;const i=s.getChildren(),l=i.length;for(let c=0;c<l;c++){const a=i[o];if(!L(a))return!1}}}return!0}function cx(n){return()=>Gp(n)}function ax(n,e){let t=n.getFirstChild(),r=0;e:for(;t!==null;){if(A(t)){const i=t.getFirstChild();if(i!==null){t=i;continue}}else if(L(t)){const i=t.getTextContentSize();if(r+i>e)return{node:t,offset:e-r};r+=i}const o=t.getNextSibling();if(o!==null){t=o;continue}let s=t.getParent();for(;s!==null;){const i=s.getNextSibling();if(i!==null){t=i;continue e}s=s.getParent()}break}return null}function ux(n,e,t,r){const o=d=>d instanceof t,s=d=>{const u=bt(d.getTextContent());u.setFormat(d.getFormat()),d.replace(u)},i=d=>d.getLatest().__mode,l=d=>{if(!d.isSimpleText())return;let u=d.getPreviousSibling(),h=d.getTextContent(),g=d,p;if(L(u)){const y=u.getTextContent(),m=y+h,C=e(m);if(o(u))if(C===null||i(u)!==0){s(u);return}else{const N=C.end-y.length;if(N>0){const S=h.slice(0,N),T=y+S;if(u.select(),u.setTextContent(T),N===h.length)d.remove();else{const E=h.slice(N);d.setTextContent(E)}return}}else if(C===null||C.start<y.length)return}let _=0;for(;;){p=e(h);let y=p===null?"":h.slice(p.end);if(h=y,y===""){const N=g.getNextSibling();if(L(N)){y=g.getTextContent()+N.getTextContent();const S=e(y);if(S===null){o(N)?s(N):N.markDirty();return}else if(S.start!==0)return}}if(p===null)return;if(p.start===0&&L(u)&&u.isTextEntity()){_+=p.end;continue}let m;if(p.start===0?[m,g]=g.splitText(p.end):[,m,g]=g.splitText(p.start+_,p.end+_),m===void 0)throw Error("nodeToReplace should not be undefined. You may want to check splitOffsets passed to the splitText.");const C=r(m);if(C.setFormat(m.getFormat()),m.replace(C),g==null)return;_=0,u=C}},c=d=>{const u=d.getTextContent(),h=e(u);if(h===null||h.start!==0){s(d);return}if(u.length>h.end){d.splitText(h.end);return}const g=d.getPreviousSibling();L(g)&&g.isTextEntity()&&(s(g),s(d));const p=d.getNextSibling();L(p)&&p.isTextEntity()&&(s(p),o(d)&&s(d))},a=n.registerNodeTransform(to,l),f=n.registerNodeTransform(t,c);return[a,f]}const fx=Object.freeze(Object.defineProperty({__proto__:null,$canShowPlaceholder:Gp,$canShowPlaceholderCurry:cx,$findTextIntersectionFromCharacters:ax,$isRootTextContentEmpty:Tu,$isRootTextContentEmptyCurry:lx,$rootTextContent:Vp,registerLexicalTextEntity:ux},Symbol.toStringTag,{value:"Module"}));function Xp(){return Oe().getTextContent()}function xu(n,e=!0){if(n)return!1;let t=Xp();return e&&(t=t.trim()),t===""}function dx(n,e){return()=>xu(n,e)}function qp(n){if(!xu(n,!1))return!1;const e=Oe().getChildren(),t=e.length;if(t>1)return!1;for(let r=0;r<t;r++){const o=e[r];if(st(o))return!1;if(A(o)){if(!pl(o)||o.__indent!==0)return!1;const s=o.getChildren(),i=s.length;for(let l=0;l<i;l++){const c=s[r];if(!L(c))return!1}}}return!0}function hx(n){return()=>qp(n)}function gx(n,e){let t=n.getFirstChild(),r=0;e:for(;t!==null;){if(A(t)){const i=t.getFirstChild();if(i!==null){t=i;continue}}else if(L(t)){const i=t.getTextContentSize();if(r+i>e)return{node:t,offset:e-r};r+=i}const o=t.getNextSibling();if(o!==null){t=o;continue}let s=t.getParent();for(;s!==null;){const i=s.getNextSibling();if(i!==null){t=i;continue e}s=s.getParent()}break}return null}function px(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var _x=px(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function mx(n,e,t,r){const o=i=>i instanceof t,s=i=>{const l=bt(i.getTextContent());l.setFormat(i.getFormat()),i.replace(l)};return[n.registerNodeTransform(to,i=>{if(!i.isSimpleText())return;let l,c=i.getPreviousSibling(),a=i.getTextContent(),f=i;if(L(c)){const u=c.getTextContent(),h=e(u+a);if(o(c)){if(h===null||(g=>g.getLatest().__mode)(c)!==0)return void s(c);{const g=h.end-u.length;if(g>0){const p=u+a.slice(0,g);if(c.select(),c.setTextContent(p),g===a.length)i.remove();else{const _=a.slice(g);i.setTextContent(_)}return}}}else if(h===null||h.start<u.length)return}let d=0;for(;;){l=e(a);let u,h=l===null?"":a.slice(l.end);if(a=h,h===""){const p=f.getNextSibling();if(L(p)){h=f.getTextContent()+p.getTextContent();const _=e(h);if(_===null)return void(o(p)?s(p):p.markDirty());if(_.start!==0)return}}if(l===null)return;if(l.start===0&&L(c)&&c.isTextEntity()){d+=l.end;continue}l.start===0?[u,f]=f.splitText(l.end):[,u,f]=f.splitText(l.start+d,l.end+d),u===void 0&&_x(165,"nodeToReplace");const g=r(u);if(g.setFormat(u.getFormat()),u.replace(g),f==null)return;d=0,c=g}}),n.registerNodeTransform(t,i=>{const l=i.getTextContent(),c=e(l);if(c===null||c.start!==0)return void s(i);if(l.length>c.end)return void i.splitText(c.end);const a=i.getPreviousSibling();L(a)&&a.isTextEntity()&&(s(a),s(i));const f=i.getNextSibling();L(f)&&f.isTextEntity()&&(s(f),o(i)&&s(i))})]}const yx=Object.freeze(Object.defineProperty({__proto__:null,$canShowPlaceholder:qp,$canShowPlaceholderCurry:hx,$findTextIntersectionFromCharacters:gx,$isRootTextContentEmpty:xu,$isRootTextContentEmptyCurry:dx,$rootTextContent:Xp,registerLexicalTextEntity:mx},Symbol.toStringTag,{value:"Module"})),Qp=(process.env.NODE_ENV==="development"?fx:yx).$canShowPlaceholderCurry,$l=new Map;function Zp(n){let e=n;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function e_(n){const e=n.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(n)]}function Cx(n,e,t,r,o){const s=e.getKey(),i=r.getKey(),l=document.createRange();let c=n.getElementByKey(s),a=n.getElementByKey(i),f=t,d=o;if(L(e)&&(c=Zp(c)),L(r)&&(a=Zp(a)),e===void 0||r===void 0||c===null||a===null)return null;c.nodeName==="BR"&&([c,f]=e_(c)),a.nodeName==="BR"&&([a,d]=e_(a));const u=c.firstChild;c===a&&u!=null&&u.nodeName==="BR"&&f===0&&d===0&&(d=1);try{l.setStart(c,f),l.setEnd(a,d)}catch{return null}return l.collapsed&&(f!==d||s!==i)&&(l.setStart(a,d),l.setEnd(c,f)),l}function Nx(n,e){const t=n.getRootElement();if(t===null)return[];const r=t.getBoundingClientRect(),o=getComputedStyle(t),s=parseFloat(o.paddingLeft)+parseFloat(o.paddingRight),i=Array.from(e.getClientRects());let l=i.length;i.sort((a,f)=>{const d=a.top-f.top;return Math.abs(d)<=3?a.left-f.left:d});let c;for(let a=0;a<l;a++){const f=i[a],d=c&&c.top<=f.top&&c.top+c.height>f.top&&c.left+c.width>f.left,u=f.width+s===r.width;if(d||u){i.splice(a--,1),l--;continue}c=f}return i}function t_(n){const e={},t=n.split(";");for(const r of t)if(r!==""){const[o,s]=r.split(/:([^]+)/);o&&s&&(e[o.trim()]=s.trim())}return e}function Pl(n){let e=$l.get(n);return e===void 0&&(e=t_(n),$l.set(n,e)),Object.freeze(e),e}function Sx(n){let e="";for(const t in n)t&&(e+=`${t}: ${n[t]};`);return e}function Tx(n,e){const t=n.getStartEndPoints();if(e.isSelected(n)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[r,o]=t,s=n.isBackward(),i=r.getNode(),l=o.getNode(),c=e.is(i),a=e.is(l);if(c||a){const[f,d]=Cp(n),u=i.is(l),h=e.is(s?l:i),g=e.is(s?i:l);let p=0,_;if(u)p=f>d?d:f,_=f>d?f:d;else if(h)p=s?d:f,_=void 0;else if(g){const y=s?f:d;p=0,_=y}return e.__text=e.__text.slice(p,_),e}}return e}function xx(n){if(n.type==="text")return n.offset===n.getNode().getTextContentSize();const e=n.getNode();if(!A(e))throw Error("isAtNodeEnd: node must be a TextNode or ElementNode");return n.offset===e.getChildrenSize()}function n_(n,e,t){let r=e.getNode(),o=t;if(A(r)){const s=r.getDescendantByIndex(e.offset);s!==null&&(r=s)}for(;o>0&&r!==null;){if(A(r)){const a=r.getLastDescendant();a!==null&&(r=a)}let s=r.getPreviousSibling(),i=0;if(s===null){let a=r.getParentOrThrow(),f=a.getPreviousSibling();for(;f===null;){if(a=a.getParent(),a===null){s=null;break}f=a.getPreviousSibling()}a!==null&&(i=a.isInline()?0:2,s=f)}let l=r.getTextContent();l===""&&A(r)&&!r.isInline()&&(l=`
32
32
 
33
- `);const c=l.length;if(!L(o)||r>=c){const a=o.getParent();o.remove(),a!=null&&a.getChildrenSize()===0&&!Yn(a)&&a.remove(),r-=c+i,o=s}else{const a=o.getKey(),f=n.getEditorState().read(()=>{const h=Ot(a);return L(h)&&h.isSimpleText()?h.getTextContent():null}),d=c-r,u=l.slice(0,d);if(f!==null&&f!==l){const h=Hn();let g=o;if(o.isSimpleText())o.setTextContent(f);else{const p=bt(f);o.replace(p),g=p}if(v(h)&&h.isCollapsed()){const p=h.anchor.offset;g.select(p,p)}}else if(o.isSimpleText()){const h=e.key===a;let g=e.offset;g<r&&(g=c);const p=h?g-r:0,_=h?g:d;if(h&&p===0){const[y]=o.splitText(p,_);y.remove()}else{const[,y]=o.splitText(p,_);y.remove()}}else{const h=bt(u);o.replace(h)}r=0}}}function xx(n){const e=n.getStyle(),t=Zp(e);Pl.set(e,t)}function rr(n,e){const t=Il("getStyle"in n?n.getStyle():n.style),o=Object.entries(e).reduce((s,[i,l])=>(typeof l=="function"?s[i]=l(t[i],n):l===null?delete s[i]:s[i]=l,s),{...t}),r=Nx(o);n.setStyle(r),Pl.set(r,o)}function Ex(n,e){const t=n.getNodes(),o=t.length,r=n.getStartEndPoints();if(r===null)return;const[s,i]=r,l=o-1;let c=t[0],a=t[l];if(n.isCollapsed()&&v(n)){rr(n,e);return}const d=c.getTextContent().length,u=i.offset;let h=s.offset;const g=s.isBefore(i);let p=g?h:u,_=g?u:h;const y=g?s.type:i.type,m=g?i.type:s.type,C=g?i.key:s.key;if(L(c)&&p===d){const N=c.getNextSibling();L(N)&&(h=0,p=0,c=N)}if(t.length===1){if(L(c)&&c.canHaveFormat()){if(p=y==="element"?0:h>u?u:h,_=m==="element"?d:h>u?h:u,p===_)return;if(Qo(c)||p===0&&_===d)rr(c,e),c.select(p,_);else{const N=c.splitText(p,_),S=p===0?N[0]:N[1];rr(S,e),S.select(0,_-p)}}}else{if(L(c)&&p<c.getTextContentSize()&&c.canHaveFormat()&&(p!==0&&!Qo(c)&&(c=c.splitText(p)[1],p=0,g?s.set(c.getKey(),p,"text"):i.set(c.getKey(),p,"text")),rr(c,e)),L(a)&&a.canHaveFormat()){const S=a.getTextContent().length;a.__key!==C&&_!==0&&(_=S),_!==S&&!Qo(a)&&([a]=a.splitText(_)),(_!==0||m==="element")&&rr(a,e)}for(let N=1;N<l;N++){const S=t[N],T=S.getKey();L(S)&&S.canHaveFormat()&&T!==c.getKey()&&T!==a.getKey()&&!S.isToken()&&rr(S,e)}}}function wx(n,e){if(n===null)return;const t=n.getStartEndPoints(),o=t?t[0]:null;if(o!==null&&o.key==="root"){const i=e(),l=Oe(),c=l.getFirstChild();c?c.replace(i,!0):l.append(i);return}const r=n.getNodes(),s=o!==null?Rx(o.getNode(),r_):!1;s&&r.indexOf(s)===-1&&r.push(s);for(let i=0;i<r.length;i++){const l=r[i];if(!r_(l))continue;if(!A(l))throw Error("Expected block node to be an ElementNode");const c=e();c.setFormat(l.getFormatType()),c.setIndent(l.getIndent()),l.replace(c,!0)}}function t_(n){return n.getNode().isAttached()}function bx(n){let e=n;for(;e!==null&&!it(e);){const t=e.getLatest(),o=e.getParent();t.getChildrenSize()===0&&e.remove(!0),e=o}}function Ox(n,e,t=null){const o=n.getStartEndPoints(),r=o?o[0]:null,s=n.getNodes(),i=s.length;if(r!==null&&(i===0||i===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){const a=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),f=a.getChildren();let d=e();d.setFormat(a.getFormatType()),d.setIndent(a.getIndent()),f.forEach(u=>d.append(u)),t&&(d=t.append(d)),a.replace(d);return}let l=null,c=[];for(let a=0;a<i;a++){const f=s[a];it(f)?(Eu(n,c,c.length,e,t),c=[],l=f):l===null||l!==null&&Cp(f,l)?c.push(f):(Eu(n,c,c.length,e,t),c=[f])}Eu(n,c,c.length,e,t)}function Eu(n,e,t,o,r=null){if(e.length===0)return;const s=e[0],i=new Map,l=[];let c=A(s)?s:s.getParentOrThrow();c.isInline()&&(c=c.getParentOrThrow());let a=!1;for(;c!==null;){const g=c.getPreviousSibling();if(g!==null){c=g,a=!0;break}if(c=c.getParentOrThrow(),it(c))break}const f=new Set;for(let g=0;g<t;g++){const p=e[g];A(p)&&p.getChildrenSize()===0&&f.add(p.getKey())}const d=new Set;for(let g=0;g<t;g++){const p=e[g];let _=p.getParent();if(_!==null&&_.isInline()&&(_=_.getParent()),_!==null&&Sp(p)&&!d.has(p.getKey())){const y=_.getKey();if(i.get(y)===void 0){const m=o();m.setFormat(_.getFormatType()),m.setIndent(_.getIndent()),l.push(m),i.set(y,m),_.getChildren().forEach(C=>{m.append(C),d.add(C.getKey()),A(C)&&C.getChildrenKeys().forEach(N=>d.add(N))}),bx(_)}}else if(f.has(p.getKey())){if(!A(p))throw Error("Expected node in emptyElements to be an ElementNode");const y=o();y.setFormat(p.getFormatType()),y.setIndent(p.getIndent()),l.push(y),p.remove(!0)}}if(r!==null)for(let g=0;g<l.length;g++){const p=l[g];r.append(p)}let u=null;if(it(c))if(a)if(r!==null)c.insertAfter(r);else for(let g=l.length-1;g>=0;g--){const p=l[g];c.insertAfter(p)}else{const g=c.getFirstChild();if(A(g)&&(c=g),g===null)if(r)c.append(r);else for(let p=0;p<l.length;p++){const _=l[p];c.append(_),u=_}else if(r!==null)g.insertBefore(r);else for(let p=0;p<l.length;p++){const _=l[p];g.insertBefore(_),u=_}}else if(r)c.insertAfter(r);else for(let g=l.length-1;g>=0;g--){const p=l[g];c.insertAfter(p),u=p}const h=Hn();v(h)&&t_(h.anchor)&&t_(h.focus)?Pe(h.clone()):u!==null?u.selectEnd():n.dirty=!0}function vx(n,e){const t=Xo(n.focus,e);return st(t)&&!t.isIsolated()||A(t)&&!t.isInline()&&!t.canBeEmpty()}function n_(n,e,t,o){n.modify(e?"extend":"move",t,o)}function o_(n){const e=n.anchor.getNode();return(Yn(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Mx(n,e,t){const o=o_(n);n_(n,e,t?!o:o,"character")}function Dx(n){const e=n.anchor,t=n.focus,s=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();let i=s.getFirstDescendant(),l=s.getLastDescendant(),c="element",a="element",f=0;L(i)?c="text":!A(i)&&i!==null&&(i=i.getParentOrThrow()),L(l)?(a="text",f=l.getTextContentSize()):!A(l)&&l!==null&&(l=l.getParentOrThrow()),i&&l&&(e.set(i.getKey(),0,c),t.set(l.getKey(),f,a))}function Ax(n,e,t){const o=n.getStyle(),r=Il(o);return r!==null&&r[e]||t}function kx(n,e,t=""){let o=null;const r=n.getNodes(),s=n.anchor,i=n.focus,l=n.isBackward(),c=l?i.offset:s.offset,a=l?i.getNode():s.getNode();if(v(n)&&n.isCollapsed()&&n.style!==""){const f=n.style,d=Il(f);if(d!==null&&e in d)return d[e]}for(let f=0;f<r.length;f++){const d=r[f];if(!(f!==0&&c===0&&d.is(a))&&L(d)){const u=Ax(d,e,t);if(o===null)o=u;else if(o!==u){o="";break}}}return o===null?t:o}function r_(n){if(st(n)||!A(n)||it(n))return!1;const e=n.getFirstChild(),t=e===null||pl(e)||L(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function Rx(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}const $x=Object.freeze(Object.defineProperty({__proto__:null,$addNodeStyle:xx,$getSelectionStyleValueForProperty:kx,$isAtNodeEnd:Tx,$isParentElementRTL:o_,$moveCaretSelection:n_,$moveCharacter:Mx,$patchStyleText:Ex,$selectAll:Dx,$setBlocksType:wx,$shouldOverrideDefaultCharacterSelection:vx,$sliceSelectedTextNodeContent:Sx,$trimTextContentFromAnchor:e_,$wrapNodes:Ox,createDOMRange:yx,createRectsFromDOMRange:Cx,getStyleObjectFromCSS:Il,trimTextContentFromAnchor:e_,$cloneWithProperties:jn},Symbol.toStringTag,{value:"Module"}));function Px(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var wu=Px(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const Ll=new Map;function s_(n){let e=n;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function i_(n){const e=n.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(n)]}function Ix(n,e,t,o,r){const s=e.getKey(),i=o.getKey(),l=document.createRange();let c=n.getElementByKey(s),a=n.getElementByKey(i),f=t,d=r;if(L(e)&&(c=s_(c)),L(o)&&(a=s_(a)),e===void 0||o===void 0||c===null||a===null)return null;c.nodeName==="BR"&&([c,f]=i_(c)),a.nodeName==="BR"&&([a,d]=i_(a));const u=c.firstChild;c===a&&u!=null&&u.nodeName==="BR"&&f===0&&d===0&&(d=1);try{l.setStart(c,f),l.setEnd(a,d)}catch{return null}return!l.collapsed||f===d&&s===i||(l.setStart(a,d),l.setEnd(c,f)),l}function Lx(n,e){const t=n.getRootElement();if(t===null)return[];const o=t.getBoundingClientRect(),r=getComputedStyle(t),s=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),i=Array.from(e.getClientRects());let l,c=i.length;i.sort((a,f)=>{const d=a.top-f.top;return Math.abs(d)<=3?a.left-f.left:d});for(let a=0;a<c;a++){const f=i[a],d=l&&l.top<=f.top&&l.top+l.height>f.top&&l.left+l.width>f.left,u=f.width+s===o.width;d||u?(i.splice(a--,1),c--):l=f}return i}function l_(n){const e={},t=n.split(";");for(const o of t)if(o!==""){const[r,s]=o.split(/:([^]+)/);r&&s&&(e[r.trim()]=s.trim())}return e}function Fl(n){let e=Ll.get(n);return e===void 0&&(e=l_(n),Ll.set(n,e)),e}function Fx(n,e){const t=n.getStartEndPoints();if(e.isSelected(n)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[o,r]=t,s=n.isBackward(),i=o.getNode(),l=r.getNode(),c=e.is(i),a=e.is(l);if(c||a){const[f,d]=mp(n),u=i.is(l),h=e.is(s?l:i),g=e.is(s?i:l);let p,_=0;return u?(_=f>d?d:f,p=f>d?f:d):h?(_=s?d:f,p=void 0):g&&(_=0,p=s?f:d),e.__text=e.__text.slice(_,p),e}}return e}function Bx(n){if(n.type==="text")return n.offset===n.getNode().getTextContentSize();const e=n.getNode();return A(e)||wu(177),n.offset===e.getChildrenSize()}function c_(n,e,t){let o=e.getNode(),r=t;if(A(o)){const s=o.getDescendantByIndex(e.offset);s!==null&&(o=s)}for(;r>0&&o!==null;){if(A(o)){const a=o.getLastDescendant();a!==null&&(o=a)}let s=o.getPreviousSibling(),i=0;if(s===null){let a=o.getParentOrThrow(),f=a.getPreviousSibling();for(;f===null;){if(a=a.getParent(),a===null){s=null;break}f=a.getPreviousSibling()}a!==null&&(i=a.isInline()?0:2,s=f)}let l=o.getTextContent();l===""&&A(o)&&!o.isInline()&&(l=`
33
+ `);const c=l.length;if(!L(r)||o>=c){const a=r.getParent();r.remove(),a!=null&&a.getChildrenSize()===0&&!Yn(a)&&a.remove(),o-=c+i,r=s}else{const a=r.getKey(),f=n.getEditorState().read(()=>{const h=Ot(a);return L(h)&&h.isSimpleText()?h.getTextContent():null}),d=c-o,u=l.slice(0,d);if(f!==null&&f!==l){const h=Hn();let g=r;if(r.isSimpleText())r.setTextContent(f);else{const p=bt(f);r.replace(p),g=p}if(v(h)&&h.isCollapsed()){const p=h.anchor.offset;g.select(p,p)}}else if(r.isSimpleText()){const h=e.key===a;let g=e.offset;g<o&&(g=c);const p=h?g-o:0,_=h?g:d;if(h&&p===0){const[y]=r.splitText(p,_);y.remove()}else{const[,y]=r.splitText(p,_);y.remove()}}else{const h=bt(u);r.replace(h)}o=0}}}function Ex(n){const e=n.getStyle(),t=t_(e);$l.set(e,t)}function oo(n,e){const t=Pl("getStyle"in n?n.getStyle():n.style),r=Object.entries(e).reduce((s,[i,l])=>(typeof l=="function"?s[i]=l(t[i],n):l===null?delete s[i]:s[i]=l,s),{...t}),o=Sx(r);n.setStyle(o),$l.set(o,r)}function wx(n,e){const t=n.getNodes(),r=t.length,o=n.getStartEndPoints();if(o===null)return;const[s,i]=o,l=r-1;let c=t[0],a=t[l];if(n.isCollapsed()&&v(n)){oo(n,e);return}const d=c.getTextContent().length,u=i.offset;let h=s.offset;const g=s.isBefore(i);let p=g?h:u,_=g?u:h;const y=g?s.type:i.type,m=g?i.type:s.type,C=g?i.key:s.key;if(L(c)&&p===d){const N=c.getNextSibling();L(N)&&(h=0,p=0,c=N)}if(t.length===1){if(L(c)&&c.canHaveFormat()){if(p=y==="element"?0:h>u?u:h,_=m==="element"?d:h>u?h:u,p===_)return;if(Qr(c)||p===0&&_===d)oo(c,e),c.select(p,_);else{const N=c.splitText(p,_),S=p===0?N[0]:N[1];oo(S,e),S.select(0,_-p)}}}else{if(L(c)&&p<c.getTextContentSize()&&c.canHaveFormat()&&(p!==0&&!Qr(c)&&(c=c.splitText(p)[1],p=0,g?s.set(c.getKey(),p,"text"):i.set(c.getKey(),p,"text")),oo(c,e)),L(a)&&a.canHaveFormat()){const S=a.getTextContent().length;a.__key!==C&&_!==0&&(_=S),_!==S&&!Qr(a)&&([a]=a.splitText(_)),(_!==0||m==="element")&&oo(a,e)}for(let N=1;N<l;N++){const S=t[N],T=S.getKey();L(S)&&S.canHaveFormat()&&T!==c.getKey()&&T!==a.getKey()&&!S.isToken()&&oo(S,e)}}}function bx(n,e){if(n===null)return;const t=n.getStartEndPoints(),r=t?t[0]:null;if(r!==null&&r.key==="root"){const i=e(),l=Oe(),c=l.getFirstChild();c?c.replace(i,!0):l.append(i);return}const o=n.getNodes(),s=r!==null?$x(r.getNode(),i_):!1;s&&o.indexOf(s)===-1&&o.push(s);for(let i=0;i<o.length;i++){const l=o[i];if(!i_(l))continue;if(!A(l))throw Error("Expected block node to be an ElementNode");const c=e();c.setFormat(l.getFormatType()),c.setIndent(l.getIndent()),l.replace(c,!0)}}function r_(n){return n.getNode().isAttached()}function Ox(n){let e=n;for(;e!==null&&!it(e);){const t=e.getLatest(),r=e.getParent();t.getChildrenSize()===0&&e.remove(!0),e=r}}function vx(n,e,t=null){const r=n.getStartEndPoints(),o=r?r[0]:null,s=n.getNodes(),i=s.length;if(o!==null&&(i===0||i===1&&o.type==="element"&&o.getNode().getChildrenSize()===0)){const a=o.type==="text"?o.getNode().getParentOrThrow():o.getNode(),f=a.getChildren();let d=e();d.setFormat(a.getFormatType()),d.setIndent(a.getIndent()),f.forEach(u=>d.append(u)),t&&(d=t.append(d)),a.replace(d);return}let l=null,c=[];for(let a=0;a<i;a++){const f=s[a];it(f)?(Eu(n,c,c.length,e,t),c=[],l=f):l===null||l!==null&&Sp(f,l)?c.push(f):(Eu(n,c,c.length,e,t),c=[f])}Eu(n,c,c.length,e,t)}function Eu(n,e,t,r,o=null){if(e.length===0)return;const s=e[0],i=new Map,l=[];let c=A(s)?s:s.getParentOrThrow();c.isInline()&&(c=c.getParentOrThrow());let a=!1;for(;c!==null;){const g=c.getPreviousSibling();if(g!==null){c=g,a=!0;break}if(c=c.getParentOrThrow(),it(c))break}const f=new Set;for(let g=0;g<t;g++){const p=e[g];A(p)&&p.getChildrenSize()===0&&f.add(p.getKey())}const d=new Set;for(let g=0;g<t;g++){const p=e[g];let _=p.getParent();if(_!==null&&_.isInline()&&(_=_.getParent()),_!==null&&xp(p)&&!d.has(p.getKey())){const y=_.getKey();if(i.get(y)===void 0){const m=r();m.setFormat(_.getFormatType()),m.setIndent(_.getIndent()),l.push(m),i.set(y,m),_.getChildren().forEach(C=>{m.append(C),d.add(C.getKey()),A(C)&&C.getChildrenKeys().forEach(N=>d.add(N))}),Ox(_)}}else if(f.has(p.getKey())){if(!A(p))throw Error("Expected node in emptyElements to be an ElementNode");const y=r();y.setFormat(p.getFormatType()),y.setIndent(p.getIndent()),l.push(y),p.remove(!0)}}if(o!==null)for(let g=0;g<l.length;g++){const p=l[g];o.append(p)}let u=null;if(it(c))if(a)if(o!==null)c.insertAfter(o);else for(let g=l.length-1;g>=0;g--){const p=l[g];c.insertAfter(p)}else{const g=c.getFirstChild();if(A(g)&&(c=g),g===null)if(o)c.append(o);else for(let p=0;p<l.length;p++){const _=l[p];c.append(_),u=_}else if(o!==null)g.insertBefore(o);else for(let p=0;p<l.length;p++){const _=l[p];g.insertBefore(_),u=_}}else if(o)c.insertAfter(o);else for(let g=l.length-1;g>=0;g--){const p=l[g];c.insertAfter(p),u=p}const h=Hn();v(h)&&r_(h.anchor)&&r_(h.focus)?Pe(h.clone()):u!==null?u.selectEnd():n.dirty=!0}function Mx(n,e){const t=Xr(n.focus,e);return st(t)&&!t.isIsolated()||A(t)&&!t.isInline()&&!t.canBeEmpty()}function o_(n,e,t,r){n.modify(e?"extend":"move",t,r)}function s_(n){const e=n.anchor.getNode();return(Yn(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Dx(n,e,t){const r=s_(n);o_(n,e,t?!r:r,"character")}function Ax(n){const e=n.anchor,t=n.focus,s=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();let i=s.getFirstDescendant(),l=s.getLastDescendant(),c="element",a="element",f=0;L(i)?c="text":!A(i)&&i!==null&&(i=i.getParentOrThrow()),L(l)?(a="text",f=l.getTextContentSize()):!A(l)&&l!==null&&(l=l.getParentOrThrow()),i&&l&&(e.set(i.getKey(),0,c),t.set(l.getKey(),f,a))}function kx(n,e,t){const r=n.getStyle(),o=Pl(r);return o!==null&&o[e]||t}function Rx(n,e,t=""){let r=null;const o=n.getNodes(),s=n.anchor,i=n.focus,l=n.isBackward(),c=l?i.offset:s.offset,a=l?i.getNode():s.getNode();if(v(n)&&n.isCollapsed()&&n.style!==""){const f=n.style,d=Pl(f);if(d!==null&&e in d)return d[e]}for(let f=0;f<o.length;f++){const d=o[f];if(!(f!==0&&c===0&&d.is(a))&&L(d)){const u=kx(d,e,t);if(r===null)r=u;else if(r!==u){r="";break}}}return r===null?t:r}function i_(n){if(st(n)||!A(n)||it(n))return!1;const e=n.getFirstChild(),t=e===null||gl(e)||L(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function $x(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}const Px=Object.freeze(Object.defineProperty({__proto__:null,$addNodeStyle:Ex,$getSelectionStyleValueForProperty:Rx,$isAtNodeEnd:xx,$isParentElementRTL:s_,$moveCaretSelection:o_,$moveCharacter:Dx,$patchStyleText:wx,$selectAll:Ax,$setBlocksType:bx,$shouldOverrideDefaultCharacterSelection:Mx,$sliceSelectedTextNodeContent:Tx,$trimTextContentFromAnchor:n_,$wrapNodes:vx,createDOMRange:Cx,createRectsFromDOMRange:Nx,getStyleObjectFromCSS:Pl,trimTextContentFromAnchor:n_,$cloneWithProperties:Un},Symbol.toStringTag,{value:"Module"}));function Ix(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var wu=Ix(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const Il=new Map;function l_(n){let e=n;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function c_(n){const e=n.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(n)]}function Lx(n,e,t,r,o){const s=e.getKey(),i=r.getKey(),l=document.createRange();let c=n.getElementByKey(s),a=n.getElementByKey(i),f=t,d=o;if(L(e)&&(c=l_(c)),L(r)&&(a=l_(a)),e===void 0||r===void 0||c===null||a===null)return null;c.nodeName==="BR"&&([c,f]=c_(c)),a.nodeName==="BR"&&([a,d]=c_(a));const u=c.firstChild;c===a&&u!=null&&u.nodeName==="BR"&&f===0&&d===0&&(d=1);try{l.setStart(c,f),l.setEnd(a,d)}catch{return null}return!l.collapsed||f===d&&s===i||(l.setStart(a,d),l.setEnd(c,f)),l}function Fx(n,e){const t=n.getRootElement();if(t===null)return[];const r=t.getBoundingClientRect(),o=getComputedStyle(t),s=parseFloat(o.paddingLeft)+parseFloat(o.paddingRight),i=Array.from(e.getClientRects());let l,c=i.length;i.sort((a,f)=>{const d=a.top-f.top;return Math.abs(d)<=3?a.left-f.left:d});for(let a=0;a<c;a++){const f=i[a],d=l&&l.top<=f.top&&l.top+l.height>f.top&&l.left+l.width>f.left,u=f.width+s===r.width;d||u?(i.splice(a--,1),c--):l=f}return i}function a_(n){const e={},t=n.split(";");for(const r of t)if(r!==""){const[o,s]=r.split(/:([^]+)/);o&&s&&(e[o.trim()]=s.trim())}return e}function Ll(n){let e=Il.get(n);return e===void 0&&(e=a_(n),Il.set(n,e)),e}function Bx(n,e){const t=n.getStartEndPoints();if(e.isSelected(n)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[r,o]=t,s=n.isBackward(),i=r.getNode(),l=o.getNode(),c=e.is(i),a=e.is(l);if(c||a){const[f,d]=Cp(n),u=i.is(l),h=e.is(s?l:i),g=e.is(s?i:l);let p,_=0;return u?(_=f>d?d:f,p=f>d?f:d):h?(_=s?d:f,p=void 0):g&&(_=0,p=s?f:d),e.__text=e.__text.slice(_,p),e}}return e}function Kx(n){if(n.type==="text")return n.offset===n.getNode().getTextContentSize();const e=n.getNode();return A(e)||wu(177),n.offset===e.getChildrenSize()}function u_(n,e,t){let r=e.getNode(),o=t;if(A(r)){const s=r.getDescendantByIndex(e.offset);s!==null&&(r=s)}for(;o>0&&r!==null;){if(A(r)){const a=r.getLastDescendant();a!==null&&(r=a)}let s=r.getPreviousSibling(),i=0;if(s===null){let a=r.getParentOrThrow(),f=a.getPreviousSibling();for(;f===null;){if(a=a.getParent(),a===null){s=null;break}f=a.getPreviousSibling()}a!==null&&(i=a.isInline()?0:2,s=f)}let l=r.getTextContent();l===""&&A(r)&&!r.isInline()&&(l=`
34
34
 
35
- `);const c=l.length;if(!L(o)||r>=c){const a=o.getParent();o.remove(),a==null||a.getChildrenSize()!==0||Yn(a)||a.remove(),r-=c+i,o=s}else{const a=o.getKey(),f=n.getEditorState().read(()=>{const h=Ot(a);return L(h)&&h.isSimpleText()?h.getTextContent():null}),d=c-r,u=l.slice(0,d);if(f!==null&&f!==l){const h=Hn();let g=o;if(o.isSimpleText())o.setTextContent(f);else{const p=bt(f);o.replace(p),g=p}if(v(h)&&h.isCollapsed()){const p=h.anchor.offset;g.select(p,p)}}else if(o.isSimpleText()){const h=e.key===a;let g=e.offset;g<r&&(g=c);const p=h?g-r:0,_=h?g:d;if(h&&p===0){const[y]=o.splitText(p,_);y.remove()}else{const[,y]=o.splitText(p,_);y.remove()}}else{const h=bt(u);o.replace(h)}r=0}}}function Kx(n){const e=n.getStyle(),t=l_(e);Ll.set(e,t)}function sr(n,e){const t=Fl("getStyle"in n?n.getStyle():n.style),o=Object.entries(e).reduce((s,[i,l])=>(typeof l=="function"?s[i]=l(t[i],n):l===null?delete s[i]:s[i]=l,s),{...t}),r=function(s){let i="";for(const l in s)l&&(i+=`${l}: ${s[l]};`);return i}(o);n.setStyle(r),Ll.set(r,o)}function Wx(n,e){const t=n.getNodes(),o=t.length,r=n.getStartEndPoints();if(r===null)return;const[s,i]=r,l=o-1;let c=t[0],a=t[l];if(n.isCollapsed()&&v(n))return void sr(n,e);const f=c.getTextContent().length,d=i.offset;let u=s.offset;const h=s.isBefore(i);let g=h?u:d,p=h?d:u;const _=h?s.type:i.type,y=h?i.type:s.type,m=h?i.key:s.key;if(L(c)&&g===f){const C=c.getNextSibling();L(C)&&(u=0,g=0,c=C)}if(t.length===1){if(L(c)&&c.canHaveFormat()){if(g=_==="element"?0:u>d?d:u,p=y==="element"?f:u>d?u:d,g===p)return;if(Qo(c)||g===0&&p===f)sr(c,e),c.select(g,p);else{const C=c.splitText(g,p),N=g===0?C[0]:C[1];sr(N,e),N.select(0,p-g)}}}else{if(L(c)&&g<c.getTextContentSize()&&c.canHaveFormat()&&(g===0||Qo(c)||(c=c.splitText(g)[1],g=0,h?s.set(c.getKey(),g,"text"):i.set(c.getKey(),g,"text")),sr(c,e)),L(a)&&a.canHaveFormat()){const C=a.getTextContent().length;a.__key!==m&&p!==0&&(p=C),p===C||Qo(a)||([a]=a.splitText(p)),p===0&&y!=="element"||sr(a,e)}for(let C=1;C<l;C++){const N=t[C],S=N.getKey();L(N)&&N.canHaveFormat()&&S!==c.getKey()&&S!==a.getKey()&&!N.isToken()&&sr(N,e)}}}function zx(n,e){if(n===null)return;const t=n.getStartEndPoints(),o=t?t[0]:null;if(o!==null&&o.key==="root"){const i=e(),l=Oe(),c=l.getFirstChild();return void(c?c.replace(i,!0):l.append(i))}const r=n.getNodes(),s=o!==null&&function(i,l){let c=i;for(;c!==null&&c.getParent()!==null&&!l(c);)c=c.getParentOrThrow();return l(c)?c:null}(o.getNode(),d_);s&&r.indexOf(s)===-1&&r.push(s);for(let i=0;i<r.length;i++){const l=r[i];if(!d_(l))continue;A(l)||wu(178);const c=e();c.setFormat(l.getFormatType()),c.setIndent(l.getIndent()),l.replace(c,!0)}}function a_(n){return n.getNode().isAttached()}function Ux(n){let e=n;for(;e!==null&&!it(e);){const t=e.getLatest(),o=e.getParent();t.getChildrenSize()===0&&e.remove(!0),e=o}}function jx(n,e,t=null){const o=n.getStartEndPoints(),r=o?o[0]:null,s=n.getNodes(),i=s.length;if(r!==null&&(i===0||i===1&&r.type==="element"&&r.getNode().getChildrenSize()===0)){const a=r.type==="text"?r.getNode().getParentOrThrow():r.getNode(),f=a.getChildren();let d=e();return d.setFormat(a.getFormatType()),d.setIndent(a.getIndent()),f.forEach(u=>d.append(u)),t&&(d=t.append(d)),void a.replace(d)}let l=null,c=[];for(let a=0;a<i;a++){const f=s[a];it(f)?(bu(n,c,c.length,e,t),c=[],l=f):l===null||l!==null&&Cp(f,l)?c.push(f):(bu(n,c,c.length,e,t),c=[f])}bu(n,c,c.length,e,t)}function bu(n,e,t,o,r=null){if(e.length===0)return;const s=e[0],i=new Map,l=[];let c=A(s)?s:s.getParentOrThrow();c.isInline()&&(c=c.getParentOrThrow());let a=!1;for(;c!==null;){const g=c.getPreviousSibling();if(g!==null){c=g,a=!0;break}if(c=c.getParentOrThrow(),it(c))break}const f=new Set;for(let g=0;g<t;g++){const p=e[g];A(p)&&p.getChildrenSize()===0&&f.add(p.getKey())}const d=new Set;for(let g=0;g<t;g++){const p=e[g];let _=p.getParent();if(_!==null&&_.isInline()&&(_=_.getParent()),_!==null&&Sp(p)&&!d.has(p.getKey())){const y=_.getKey();if(i.get(y)===void 0){const m=o();m.setFormat(_.getFormatType()),m.setIndent(_.getIndent()),l.push(m),i.set(y,m),_.getChildren().forEach(C=>{m.append(C),d.add(C.getKey()),A(C)&&C.getChildrenKeys().forEach(N=>d.add(N))}),Ux(_)}}else if(f.has(p.getKey())){A(p)||wu(179);const y=o();y.setFormat(p.getFormatType()),y.setIndent(p.getIndent()),l.push(y),p.remove(!0)}}if(r!==null)for(let g=0;g<l.length;g++){const p=l[g];r.append(p)}let u=null;if(it(c))if(a)if(r!==null)c.insertAfter(r);else for(let g=l.length-1;g>=0;g--){const p=l[g];c.insertAfter(p)}else{const g=c.getFirstChild();if(A(g)&&(c=g),g===null)if(r)c.append(r);else for(let p=0;p<l.length;p++){const _=l[p];c.append(_),u=_}else if(r!==null)g.insertBefore(r);else for(let p=0;p<l.length;p++){const _=l[p];g.insertBefore(_),u=_}}else if(r)c.insertAfter(r);else for(let g=l.length-1;g>=0;g--){const p=l[g];c.insertAfter(p),u=p}const h=Hn();v(h)&&a_(h.anchor)&&a_(h.focus)?Pe(h.clone()):u!==null?u.selectEnd():n.dirty=!0}function Hx(n,e){const t=Xo(n.focus,e);return st(t)&&!t.isIsolated()||A(t)&&!t.isInline()&&!t.canBeEmpty()}function u_(n,e,t,o){n.modify(e?"extend":"move",t,o)}function f_(n){const e=n.anchor.getNode();return(Yn(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Yx(n,e,t){const o=f_(n);u_(n,e,t?!o:o,"character")}function Jx(n){const e=n.anchor,t=n.focus,o=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();let r=o.getFirstDescendant(),s=o.getLastDescendant(),i="element",l="element",c=0;L(r)?i="text":A(r)||r===null||(r=r.getParentOrThrow()),L(s)?(l="text",c=s.getTextContentSize()):A(s)||s===null||(s=s.getParentOrThrow()),r&&s&&(e.set(r.getKey(),0,i),t.set(s.getKey(),c,l))}function Vx(n,e,t){const o=Fl(n.getStyle());return o!==null&&o[e]||t}function Gx(n,e,t=""){let o=null;const r=n.getNodes(),s=n.anchor,i=n.focus,l=n.isBackward(),c=l?i.offset:s.offset,a=l?i.getNode():s.getNode();if(v(n)&&n.isCollapsed()&&n.style!==""){const f=Fl(n.style);if(f!==null&&e in f)return f[e]}for(let f=0;f<r.length;f++){const d=r[f];if((f===0||c!==0||!d.is(a))&&L(d)){const u=Vx(d,e,t);if(o===null)o=u;else if(o!==u){o="";break}}}return o===null?t:o}function d_(n){if(st(n)||!A(n)||it(n))return!1;const e=n.getFirstChild(),t=e===null||pl(e)||L(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}const Xx=Object.freeze(Object.defineProperty({__proto__:null,$addNodeStyle:Kx,$getSelectionStyleValueForProperty:Gx,$isAtNodeEnd:Bx,$isParentElementRTL:f_,$moveCaretSelection:u_,$moveCharacter:Yx,$patchStyleText:Wx,$selectAll:Jx,$setBlocksType:zx,$shouldOverrideDefaultCharacterSelection:Hx,$sliceSelectedTextNodeContent:Fx,$trimTextContentFromAnchor:c_,$wrapNodes:jx,createDOMRange:Ix,createRectsFromDOMRange:Lx,getStyleObjectFromCSS:Fl,trimTextContentFromAnchor:c_,$cloneWithProperties:jn},Symbol.toStringTag,{value:"Module"})),xs=process.env.NODE_ENV==="development"?$x:Xx,h_=xs.$addNodeStyle,Bl=xs.$moveCharacter,Kl=xs.$shouldOverrideDefaultCharacterSelection,Wl=xs.$sliceSelectedTextNodeContent,g_=xs.createRectsFromDOMRange,Ut=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",qx=Ut&&"documentMode"in document?document.documentMode:null,Qx=Ut&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Zx=Ut&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),eE=Ut&&"InputEvent"in window&&!qx?"getTargetRanges"in new window.InputEvent("input"):!1,tE=Ut&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),nE=Ut&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,p_=Ut&&/Android/.test(navigator.userAgent),Ou=Ut&&/^(?=.*Chrome).*/i.test(navigator.userAgent),oE=Ut&&p_&&Ou,rE=Ut&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Ou;function __(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[o]of t.matchAll(/\S+/g))e.push(o);return e}function m_(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}function sn(n){return`${n}px`}const sE={attributes:!0,characterData:!0,childList:!0,subtree:!0};function y_(n,e,t){let o=null,r=null,s=null,i=[];const l=document.createElement("div");function c(){if(o===null)throw Error("Unexpected null rootDOMNode");if(r===null)throw Error("Unexpected null parentDOMNode");const{left:u,top:h}=o.getBoundingClientRect(),g=r,p=g_(n,e);l.isConnected||g.append(l);let _=!1;for(let y=0;y<p.length;y++){const m=p[y],C=i[y]||document.createElement("div"),N=C.style;N.position!=="absolute"&&(N.position="absolute",_=!0);const S=sn(m.left-u);N.left!==S&&(N.left=S,_=!0);const T=sn(m.top-h);N.top!==T&&(C.style.top=T,_=!0);const b=sn(m.width);N.width!==b&&(C.style.width=b,_=!0);const x=sn(m.height);N.height!==x&&(C.style.height=x,_=!0),C.parentNode!==l&&(l.append(C),_=!0),i[y]=C}for(;i.length>p.length;)i.pop();_&&t(i)}function a(){r=null,o=null,s!==null&&s.disconnect(),s=null,l.remove();for(const u of i)u.remove();i=[]}function f(){const u=n.getRootElement();if(u===null)return a();const h=u.parentElement;if(!(h instanceof HTMLElement))return a();a(),o=u,r=h,s=new MutationObserver(g=>{const p=n.getRootElement(),_=p&&p.parentElement;if(p!==o||_!==r)return f();for(const y of g)if(!l.contains(y.target))return c()}),s.observe(h,sE),c()}const d=n.registerRootListener(f);return()=>{d(),a()}}function iE(n,e){let t=null,o=null,r=null,s=null,i=()=>{};function l(c){c.read(()=>{const a=M();if(!v(a)){t=null,o=null,r=null,s=null,i(),i=()=>{};return}const{anchor:f,focus:d}=a,u=f.getNode(),h=u.getKey(),g=f.offset,p=d.getNode(),_=p.getKey(),y=d.offset,m=n.getElementByKey(h),C=n.getElementByKey(_),N=t===null||m===null||g!==o||h!==t.getKey()||u!==t&&(!(t instanceof tr)||u.updateDOM(t,m,n._config)),S=r===null||C===null||y!==s||_!==r.getKey()||p!==r&&(!(r instanceof tr)||p.updateDOM(r,C,n._config));if(N||S){const T=n.getElementByKey(f.getNode().getKey()),b=n.getElementByKey(d.getNode().getKey());if(T!==null&&b!==null&&T.tagName==="SPAN"&&b.tagName==="SPAN"){const x=document.createRange();let w,O,D,B;d.isBefore(f)?(w=b,O=d.offset,D=T,B=f.offset):(w=T,O=f.offset,D=b,B=d.offset);const Y=w.firstChild;if(Y===null)throw Error("Expected text node to be first child of span");const J=D.firstChild;if(J===null)throw Error("Expected text node to be first child of span");x.setStart(Y,O),x.setEnd(J,B),i(),i=y_(n,x,V=>{for(const re of V){const F=re.style;F.background!=="Highlight"&&(F.background="Highlight"),F.color!=="HighlightText"&&(F.color="HighlightText"),F.zIndex!=="-1"&&(F.zIndex="-1"),F.pointerEvents!=="none"&&(F.pointerEvents="none"),F.marginTop!==sn(-1.5)&&(F.marginTop=sn(-1.5)),F.paddingTop!==sn(4)&&(F.paddingTop=sn(4)),F.paddingBottom!==sn(0)&&(F.paddingBottom=sn(0))}e!==void 0&&e(V)})}}t=u,o=g,r=p,s=y})}return l(n.getEditorState()),m_(n.registerUpdateListener(({editorState:c})=>l(c)),i,()=>{i()})}const lE=eE,cE=Ut,aE=p_,uE=oE,fE=Qx,dE=rE,hE=Ou,C_=Zx,gE=nE,pE=tE;function _E(n,...e){const t=__(...e);t.length>0&&n.classList.add(...t)}function mE(n,...e){const t=__(...e);t.length>0&&n.classList.remove(...t)}function N_(n,e){for(const t of e)if(n.type.startsWith(t))return!0;return!1}function yE(n,e){const t=n[Symbol.iterator]();return new Promise((o,r)=>{const s=[],i=()=>{const{done:l,value:c}=t.next();if(l)return o(s);const a=new FileReader;a.addEventListener("error",r),a.addEventListener("load",()=>{const f=a.result;typeof f=="string"&&s.push({file:c,result:f}),i()}),N_(c,e)?a.readAsDataURL(c):i()};i()})}function CE(n,e){const t=[],o=(n||Oe()).getLatest(),r=e||A(o)&&o.getLastDescendant()||o;let s=o,i=NE(s);for(;s!==null&&!s.is(r);)if(t.push({depth:i,node:s}),A(s)&&s.getChildrenSize()>0)s=s.getFirstChild(),i++;else{let l=null;for(;l===null&&s!==null;)l=s.getNextSibling(),l===null?(s=s.getParent(),i--):s=l}return s!==null&&s.is(r)&&t.push({depth:i,node:s}),t}function NE(n){let e=n,t=0;for(;(e=e.getParent())!==null;)t++;return t}function SE(n){let e=n;if(A(e)&&e.getChildrenSize()>0)e=e.getLastChild();else{let t=null;for(;t===null&&e!==null;)t=e.getPreviousSibling(),t===null?e=e.getParent():e=t}return e}function TE(n,e){let t=n;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function xE(n){const e=S_(n,t=>A(t)&&!t.isInline());if(!A(e))throw Error(`Expected node ${n.__key} to have closest block element node.`);return e}const S_=(n,e)=>{let t=n;for(;t!==Oe()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function EE(n,e,t,o){const r=l=>l instanceof e,s=l=>{const c=l.getChildren();for(let d=0;d<c.length;d++){const u=c[d];if(r(u))return null}let a=l,f=l;for(;a!==null;)if(f=a,a=a.getParent(),r(a))return{child:f,parent:a};return null},i=l=>{const c=s(l);if(c!==null){const{child:a,parent:f}=c;if(a.is(l)){o(f,l);const d=a.getNextSiblings(),u=d.length;if(f.insertAfter(a),u!==0){const h=t(f);a.insertAfter(h);for(let g=0;g<u;g++)h.append(d[g])}!f.canBeEmpty()&&f.getChildrenSize()===0&&f.remove()}}};return n.registerNodeTransform(e,i)}function wE(n,e){const o=new Map,r=n._pendingEditorState;for(const[i,l]of e._nodeMap)o.set(i,jn(l));r&&(r._nodeMap=o),n._dirtyType=2;const s=e._selection;Pe(s===null?null:s.clone())}function bE(n){const e=M()||Hn();if(v(e)){const{focus:t}=e,o=t.getNode(),r=t.offset;if(it(o)){const s=o.getChildAtIndex(r);s==null?o.append(n):s.insertBefore(n),n.selectNext()}else{let s,i;L(o)?(s=o.getParentOrThrow(),i=o.getIndexWithinParent(),r>0&&(i+=1,o.splitText(r))):(s=o,i=r);const[,l]=yl(s,i);l.insertBefore(n),l.selectStart()}}else{if(e!=null){const o=e.getNodes();o[o.length-1].getTopLevelElementOrThrow().insertAfter(n)}else Oe().append(n);const t=ie();n.insertAfter(t),t.select()}return n.getLatest()}function OE(n,e){const t=e();return n.replace(t),t.append(n),t}function vE(n,e){return n!==null?Object.getPrototypeOf(n).constructor.name===e.name:!1}function ME(n,e){const t=[];for(let o=0;o<n.length;o++){const r=e(n[o]);r!==null&&t.push(r)}return t}function DE(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function AE(n){if(C_)return 1;let e=1;for(;n;)e*=Number(window.getComputedStyle(n).getPropertyValue("zoom")),n=n.parentElement;return e}function kE(n){return n._parentEditor!==null}const RE=Object.freeze(Object.defineProperty({__proto__:null,$dfs:CE,$filter:ME,$findMatchingParent:S_,$getNearestBlockElementAncestorOrThrow:xE,$getNearestNodeOfType:TE,$getNextRightPreorderNode:SE,$insertFirst:DE,$insertNodeToNearestRoot:bE,$isEditorIsNestedEditor:kE,$restoreEditorState:wE,$wrapNodeInElement:OE,CAN_USE_BEFORE_INPUT:lE,CAN_USE_DOM:cE,IS_ANDROID:aE,IS_ANDROID_CHROME:uE,IS_APPLE:fE,IS_APPLE_WEBKIT:dE,IS_CHROME:hE,IS_FIREFOX:C_,IS_IOS:gE,IS_SAFARI:pE,addClassNamesToElement:_E,calculateZoomLevel:AE,isMimeType:N_,markSelection:iE,mediaFileReader:yE,mergeRegister:m_,objectKlassEquals:vE,positionNodeOnRange:y_,registerNestedElementResolver:EE,removeClassNamesFromElement:mE,$splitNode:yl,isBlockDomNode:Fp,isHTMLAnchorElement:Kp,isHTMLElement:Wp,isInlineDomNode:or},Symbol.toStringTag,{value:"Module"}));function $E(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Es=$E(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const jt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,PE=jt&&"documentMode"in document?document.documentMode:null,IE=jt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),LE=jt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),FE=!(!jt||!("InputEvent"in window)||PE)&&"getTargetRanges"in new window.InputEvent("input"),BE=jt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),KE=jt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,T_=jt&&/Android/.test(navigator.userAgent),vu=jt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),WE=jt&&T_&&vu,zE=jt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!vu;function x_(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[o]of t.matchAll(/\S+/g))e.push(o);return e}function E_(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}function ln(n){return`${n}px`}const UE={attributes:!0,characterData:!0,childList:!0,subtree:!0};function w_(n,e,t){let o=null,r=null,s=null,i=[];const l=document.createElement("div");function c(){o===null&&Es(182),r===null&&Es(183);const{left:d,top:u}=o.getBoundingClientRect(),h=r,g=g_(n,e);l.isConnected||h.append(l);let p=!1;for(let _=0;_<g.length;_++){const y=g[_],m=i[_]||document.createElement("div"),C=m.style;C.position!=="absolute"&&(C.position="absolute",p=!0);const N=ln(y.left-d);C.left!==N&&(C.left=N,p=!0);const S=ln(y.top-u);C.top!==S&&(m.style.top=S,p=!0);const T=ln(y.width);C.width!==T&&(m.style.width=T,p=!0);const b=ln(y.height);C.height!==b&&(m.style.height=b,p=!0),m.parentNode!==l&&(l.append(m),p=!0),i[_]=m}for(;i.length>g.length;)i.pop();p&&t(i)}function a(){r=null,o=null,s!==null&&s.disconnect(),s=null,l.remove();for(const d of i)d.remove();i=[]}const f=n.registerRootListener(function d(){const u=n.getRootElement();if(u===null)return a();const h=u.parentElement;if(!(h instanceof HTMLElement))return a();a(),o=u,r=h,s=new MutationObserver(g=>{const p=n.getRootElement(),_=p&&p.parentElement;if(p!==o||_!==r)return d();for(const y of g)if(!l.contains(y.target))return c()}),s.observe(h,UE),c()});return()=>{f(),a()}}function jE(n,e){let t=null,o=null,r=null,s=null,i=()=>{};function l(c){c.read(()=>{const a=M();if(!v(a))return t=null,o=null,r=null,s=null,i(),void(i=()=>{});const{anchor:f,focus:d}=a,u=f.getNode(),h=u.getKey(),g=f.offset,p=d.getNode(),_=p.getKey(),y=d.offset,m=n.getElementByKey(h),C=n.getElementByKey(_),N=t===null||m===null||g!==o||h!==t.getKey()||u!==t&&(!(t instanceof tr)||u.updateDOM(t,m,n._config)),S=r===null||C===null||y!==s||_!==r.getKey()||p!==r&&(!(r instanceof tr)||p.updateDOM(r,C,n._config));if(N||S){const T=n.getElementByKey(f.getNode().getKey()),b=n.getElementByKey(d.getNode().getKey());if(T!==null&&b!==null&&T.tagName==="SPAN"&&b.tagName==="SPAN"){const x=document.createRange();let w,O,D,B;d.isBefore(f)?(w=b,O=d.offset,D=T,B=f.offset):(w=T,O=f.offset,D=b,B=d.offset);const Y=w.firstChild;Y===null&&Es(181);const J=D.firstChild;J===null&&Es(181),x.setStart(Y,O),x.setEnd(J,B),i(),i=w_(n,x,V=>{for(const re of V){const F=re.style;F.background!=="Highlight"&&(F.background="Highlight"),F.color!=="HighlightText"&&(F.color="HighlightText"),F.zIndex!=="-1"&&(F.zIndex="-1"),F.pointerEvents!=="none"&&(F.pointerEvents="none"),F.marginTop!==ln(-1.5)&&(F.marginTop=ln(-1.5)),F.paddingTop!==ln(4)&&(F.paddingTop=ln(4)),F.paddingBottom!==ln(0)&&(F.paddingBottom=ln(0))}e!==void 0&&e(V)})}}t=u,o=g,r=p,s=y})}return l(n.getEditorState()),E_(n.registerUpdateListener(({editorState:c})=>l(c)),i,()=>{i()})}const HE=FE,YE=jt,JE=T_,VE=WE,GE=IE,XE=zE,qE=vu,b_=LE,QE=KE,ZE=BE;function ew(n,...e){const t=x_(...e);t.length>0&&n.classList.add(...t)}function tw(n,...e){const t=x_(...e);t.length>0&&n.classList.remove(...t)}function O_(n,e){for(const t of e)if(n.type.startsWith(t))return!0;return!1}function nw(n,e){const t=n[Symbol.iterator]();return new Promise((o,r)=>{const s=[],i=()=>{const{done:l,value:c}=t.next();if(l)return o(s);const a=new FileReader;a.addEventListener("error",r),a.addEventListener("load",()=>{const f=a.result;typeof f=="string"&&s.push({file:c,result:f}),i()}),O_(c,e)?a.readAsDataURL(c):i()};i()})}function ow(n,e){const t=[],o=(n||Oe()).getLatest(),r=e||A(o)&&o.getLastDescendant()||o;let s=o,i=function(l){let c=l,a=0;for(;(c=c.getParent())!==null;)a++;return a}(s);for(;s!==null&&!s.is(r);)if(t.push({depth:i,node:s}),A(s)&&s.getChildrenSize()>0)s=s.getFirstChild(),i++;else{let l=null;for(;l===null&&s!==null;)l=s.getNextSibling(),l===null?(s=s.getParent(),i--):s=l}return s!==null&&s.is(r)&&t.push({depth:i,node:s}),t}function rw(n){let e=n;if(A(e)&&e.getChildrenSize()>0)e=e.getLastChild();else{let t=null;for(;t===null&&e!==null;)t=e.getPreviousSibling(),e=t===null?e.getParent():t}return e}function sw(n,e){let t=n;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function iw(n){const e=v_(n,t=>A(t)&&!t.isInline());return A(e)||Es(4,n.__key),e}const v_=(n,e)=>{let t=n;for(;t!==Oe()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function lw(n,e,t,o){const r=s=>s instanceof e;return n.registerNodeTransform(e,s=>{const i=(l=>{const c=l.getChildren();for(let d=0;d<c.length;d++){const u=c[d];if(r(u))return null}let a=l,f=l;for(;a!==null;)if(f=a,a=a.getParent(),r(a))return{child:f,parent:a};return null})(s);if(i!==null){const{child:l,parent:c}=i;if(l.is(s)){o(c,s);const a=l.getNextSiblings(),f=a.length;if(c.insertAfter(l),f!==0){const d=t(c);l.insertAfter(d);for(let u=0;u<f;u++)d.append(a[u])}c.canBeEmpty()||c.getChildrenSize()!==0||c.remove()}}})}function cw(n,e){const t=new Map,o=n._pendingEditorState;for(const[s,i]of e._nodeMap)t.set(s,jn(i));o&&(o._nodeMap=t),n._dirtyType=2;const r=e._selection;Pe(r===null?null:r.clone())}function aw(n){const e=M()||Hn();if(v(e)){const{focus:t}=e,o=t.getNode(),r=t.offset;if(it(o)){const s=o.getChildAtIndex(r);s==null?o.append(n):s.insertBefore(n),n.selectNext()}else{let s,i;L(o)?(s=o.getParentOrThrow(),i=o.getIndexWithinParent(),r>0&&(i+=1,o.splitText(r))):(s=o,i=r);const[,l]=yl(s,i);l.insertBefore(n),l.selectStart()}}else{if(e!=null){const o=e.getNodes();o[o.length-1].getTopLevelElementOrThrow().insertAfter(n)}else Oe().append(n);const t=ie();n.insertAfter(t),t.select()}return n.getLatest()}function uw(n,e){const t=e();return n.replace(t),t.append(n),t}function fw(n,e){return n!==null&&Object.getPrototypeOf(n).constructor.name===e.name}function dw(n,e){const t=[];for(let o=0;o<n.length;o++){const r=e(n[o]);r!==null&&t.push(r)}return t}function hw(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function gw(n){if(b_)return 1;let e=1;for(;n;)e*=Number(window.getComputedStyle(n).getPropertyValue("zoom")),n=n.parentElement;return e}function pw(n){return n._parentEditor!==null}const _w=Object.freeze(Object.defineProperty({__proto__:null,$dfs:ow,$filter:dw,$findMatchingParent:v_,$getNearestBlockElementAncestorOrThrow:iw,$getNearestNodeOfType:sw,$getNextRightPreorderNode:rw,$insertFirst:hw,$insertNodeToNearestRoot:aw,$isEditorIsNestedEditor:pw,$restoreEditorState:cw,$wrapNodeInElement:uw,CAN_USE_BEFORE_INPUT:HE,CAN_USE_DOM:YE,IS_ANDROID:JE,IS_ANDROID_CHROME:VE,IS_APPLE:GE,IS_APPLE_WEBKIT:XE,IS_CHROME:qE,IS_FIREFOX:b_,IS_IOS:QE,IS_SAFARI:ZE,addClassNamesToElement:ew,calculateZoomLevel:gw,isMimeType:O_,markSelection:jE,mediaFileReader:nw,mergeRegister:E_,objectKlassEquals:fw,positionNodeOnRange:w_,registerNestedElementResolver:lw,removeClassNamesFromElement:tw,$splitNode:yl,isBlockDomNode:Fp,isHTMLAnchorElement:Kp,isHTMLElement:Wp,isInlineDomNode:or},Symbol.toStringTag,{value:"Module"})),Nn=process.env.NODE_ENV==="development"?RE:_w,U=Nn.$findMatchingParent,M_=Nn.$getNearestBlockElementAncestorOrThrow,Ie=Nn.addClassNamesToElement,zl=Nn.isBlockDomNode,D_=Nn.isHTMLAnchorElement,qn=Nn.isHTMLElement,Sn=Nn.mergeRegister,lt=Nn.objectKlassEquals,Ul=Nn.removeClassNamesFromElement,A_=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?I.useLayoutEffect:I.useEffect;function mw({editor:n,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:o,ariaDescribedBy:r,ariaExpanded:s,ariaLabel:i,ariaLabelledBy:l,ariaMultiline:c,ariaOwns:a,ariaRequired:f,autoCapitalize:d,className:u,id:h,role:g="textbox",spellCheck:p=!0,style:_,tabIndex:y,"data-testid":m,...C},N){const[S,T]=I.useState(n.isEditable()),b=I.useCallback(w=>{w&&w.ownerDocument&&w.ownerDocument.defaultView?n.setRootElement(w):n.setRootElement(null)},[n]),x=I.useMemo(()=>function(...w){return O=>{w.forEach(D=>{typeof D=="function"?D(O):D!=null&&(D.current=O)})}}(N,b),[b,N]);return A_(()=>(T(n.isEditable()),n.registerEditableListener(w=>{T(w)})),[n]),W.exports.jsx("div",{...C,"aria-activedescendant":S?e:void 0,"aria-autocomplete":S?t:"none","aria-controls":S?o:void 0,"aria-describedby":r,"aria-expanded":S&&g==="combobox"?!!s:void 0,"aria-label":i,"aria-labelledby":l,"aria-multiline":c,"aria-owns":S?a:void 0,"aria-readonly":!S||void 0,"aria-required":f,autoCapitalize:d,className:u,contentEditable:S,"data-testid":m,id:h,ref:x,role:S?g:void 0,spellCheck:p,style:_,tabIndex:y})}const yw=I.forwardRef(mw);function k_(n){return n.getEditorState().read(Xp(n.isComposing()))}const Cw=I.forwardRef(Nw);function Nw(n,e){const{placeholder:t,...o}=n,[r]=Xn();return W.exports.jsxs(W.exports.Fragment,{children:[W.exports.jsx(yw,{editor:r,...o,ref:e}),t!=null&&W.exports.jsx(Sw,{editor:r,content:t})]})}function Sw({content:n,editor:e}){const t=function(i){const[l,c]=I.useState(()=>k_(i));return A_(()=>{function a(){const f=k_(i);c(f)}return a(),Sn(i.registerUpdateListener(()=>{a()}),i.registerEditableListener(()=>{a()}))},[i]),l}(e),[o,r]=I.useState(e.isEditable());if(I.useLayoutEffect(()=>(r(e.isEditable()),e.registerEditableListener(i=>{r(i)})),[e]),!t)return null;let s=null;return typeof n=="function"?s=n(o):n!==null&&(s=n),s===null?null:W.exports.jsx("div",{"aria-hidden":!0,children:s})}const jl=0,Mu=1,Du=2,Ht=0,Tw=1,R_=2,xw=3,Ew=4;function ww(n,e,t){const o=n._nodeMap,r=[];for(const s of e){const i=o.get(s);i!==void 0&&r.push(i)}for(const[s,i]of t){if(!i)continue;const l=o.get(s);l!==void 0&&!Yn(l)&&r.push(l)}return r}function bw(n,e,t,o,r){if(n===null||t.size===0&&o.size===0&&!r)return Ht;const s=e._selection,i=n._selection;if(r)return Tw;if(!v(s)||!v(i)||!i.isCollapsed()||!s.isCollapsed())return Ht;const l=ww(e,t,o);if(l.length===0)return Ht;if(l.length>1){const y=e._nodeMap,m=y.get(s.anchor.key),C=y.get(i.anchor.key);return m&&C&&!n._nodeMap.has(m.__key)&&L(m)&&m.__text.length===1&&s.anchor.offset===1?R_:Ht}const c=l[0],a=n._nodeMap.get(c.__key);if(!L(a)||!L(c)||a.__mode!==c.__mode)return Ht;const f=a.__text,d=c.__text;if(f===d)return Ht;const u=s.anchor,h=i.anchor;if(u.key!==h.key||u.type!=="text")return Ht;const g=u.offset,p=h.offset,_=d.length-f.length;return _===1&&p===g-1?R_:_===-1&&p===g+1?xw:_===-1&&p===g?Ew:Ht}function Ow(n,e,t){const o=e._nodeMap.get(n),r=t._nodeMap.get(n),s=e._selection,i=t._selection;return!(v(s)&&v(i)&&s.anchor.type==="element"&&s.focus.type==="element"&&i.anchor.type==="text"&&i.focus.type==="text")&&L(o)&&L(r)&&o.__parent===r.__parent?JSON.stringify(e.read(()=>o.exportJSON()))===JSON.stringify(t.read(()=>r.exportJSON())):!1}function vw(n,e){let t=Date.now(),o=Ht;return(r,s,i,l,c,a)=>{const f=Date.now();if(a.has("historic"))return o=Ht,t=f,Du;const d=bw(r,s,l,c,n.isComposing()),u=(()=>{const h=i===null||i.editor===n,g=a.has("history-push");if(!g&&h&&a.has("history-merge"))return jl;if(r===null)return Mu;const _=s._selection;if(!(l.size>0||c.size>0))return _!==null?jl:Du;if(g===!1&&d!==Ht&&d===o&&f<t+e&&h)return jl;if(l.size===1){const m=Array.from(l)[0];if(Ow(m,r,s))return jl}return Mu})();return t=f,o=d,u}}function Mw(n,e){const t=e.redoStack,o=e.undoStack;if(t.length!==0){const r=e.current;r!==null&&(o.push(r),n.dispatchCommand(Cn,!0));const s=t.pop();t.length===0&&n.dispatchCommand(yn,!1),e.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:"historic"})}}function Dw(n,e){const t=e.redoStack,o=e.undoStack;if(o.length!==0){const s=e.current,i=o.pop();s!==null&&(t.push(s),n.dispatchCommand(yn,!0)),o.length===0&&n.dispatchCommand(Cn,!1),e.current=i||null,i&&i.editor.setEditorState(i.editorState,{tag:"historic"})}}function $_(n){n.undoStack=[],n.redoStack=[],n.current=null}function Aw(n,e,t){const o=vw(n,t),r=({editorState:i,prevEditorState:l,dirtyLeaves:c,dirtyElements:a,tags:f})=>{const d=e.current,u=e.redoStack,h=e.undoStack,g=d===null?null:d.editorState;if(d!==null&&i===g)return;const p=o(l,i,d,c,a,f);if(p===Mu)u.length!==0&&(e.redoStack=[],n.dispatchCommand(yn,!1)),d!==null&&(h.push({...d}),n.dispatchCommand(Cn,!0));else if(p===Du)return;e.current={editor:n,editorState:i}};return Sn(n.registerCommand(Su,()=>(Dw(n,e),!0),G),n.registerCommand(Nu,()=>(Mw(n,e),!0),G),n.registerCommand(Ep,()=>($_(e),!1),G),n.registerCommand(wp,()=>($_(e),n.dispatchCommand(yn,!1),n.dispatchCommand(Cn,!1),!0),G),n.registerUpdateListener(r))}function kw(){return{current:null,redoStack:[],undoStack:[]}}const Rw=Object.freeze(Object.defineProperty({__proto__:null,createEmptyHistoryState:kw,registerHistory:Aw},Symbol.toStringTag,{value:"Module"})),Hl=0,Au=1,ku=2,Yt=0,$w=1,P_=2,Pw=3,Iw=4;function Lw(n,e,t,o,r){if(n===null||t.size===0&&o.size===0&&!r)return Yt;const s=e._selection,i=n._selection;if(r)return $w;if(!(v(s)&&v(i)&&i.isCollapsed()&&s.isCollapsed()))return Yt;const l=function(y,m,C){const N=y._nodeMap,S=[];for(const T of m){const b=N.get(T);b!==void 0&&S.push(b)}for(const[T,b]of C){if(!b)continue;const x=N.get(T);x===void 0||Yn(x)||S.push(x)}return S}(e,t,o);if(l.length===0)return Yt;if(l.length>1){const y=e._nodeMap,m=y.get(s.anchor.key),C=y.get(i.anchor.key);return m&&C&&!n._nodeMap.has(m.__key)&&L(m)&&m.__text.length===1&&s.anchor.offset===1?P_:Yt}const c=l[0],a=n._nodeMap.get(c.__key);if(!L(a)||!L(c)||a.__mode!==c.__mode)return Yt;const f=a.__text,d=c.__text;if(f===d)return Yt;const u=s.anchor,h=i.anchor;if(u.key!==h.key||u.type!=="text")return Yt;const g=u.offset,p=h.offset,_=d.length-f.length;return _===1&&p===g-1?P_:_===-1&&p===g+1?Pw:_===-1&&p===g?Iw:Yt}function Fw(n,e){let t=Date.now(),o=Yt;return(r,s,i,l,c,a)=>{const f=Date.now();if(a.has("historic"))return o=Yt,t=f,ku;const d=Lw(r,s,l,c,n.isComposing()),u=(()=>{const h=i===null||i.editor===n,g=a.has("history-push");if(!g&&h&&a.has("history-merge"))return Hl;if(r===null)return Au;const p=s._selection;return l.size>0||c.size>0?g===!1&&d!==Yt&&d===o&&f<t+e&&h||l.size===1&&function(_,y,m){const C=y._nodeMap.get(_),N=m._nodeMap.get(_),S=y._selection,T=m._selection;return!(v(S)&&v(T)&&S.anchor.type==="element"&&S.focus.type==="element"&&T.anchor.type==="text"&&T.focus.type==="text"||!L(C)||!L(N)||C.__parent!==N.__parent)&&JSON.stringify(y.read(()=>C.exportJSON()))===JSON.stringify(m.read(()=>N.exportJSON()))}(Array.from(l)[0],r,s)?Hl:Au:p!==null?Hl:ku})();return t=f,o=d,u}}function I_(n){n.undoStack=[],n.redoStack=[],n.current=null}function Bw(n,e,t){const o=Fw(n,t);return Sn(n.registerCommand(Su,()=>(function(s,i){const l=i.redoStack,c=i.undoStack;if(c.length!==0){const a=i.current,f=c.pop();a!==null&&(l.push(a),s.dispatchCommand(yn,!0)),c.length===0&&s.dispatchCommand(Cn,!1),i.current=f||null,f&&f.editor.setEditorState(f.editorState,{tag:"historic"})}}(n,e),!0),G),n.registerCommand(Nu,()=>(function(s,i){const l=i.redoStack,c=i.undoStack;if(l.length!==0){const a=i.current;a!==null&&(c.push(a),s.dispatchCommand(Cn,!0));const f=l.pop();l.length===0&&s.dispatchCommand(yn,!1),i.current=f||null,f&&f.editor.setEditorState(f.editorState,{tag:"historic"})}}(n,e),!0),G),n.registerCommand(Ep,()=>(I_(e),!1),G),n.registerCommand(wp,()=>(I_(e),n.dispatchCommand(yn,!1),n.dispatchCommand(Cn,!1),!0),G),n.registerUpdateListener(({editorState:s,prevEditorState:i,dirtyLeaves:l,dirtyElements:c,tags:a})=>{const f=e.current,d=e.redoStack,u=e.undoStack,h=f===null?null:f.editorState;if(f!==null&&s===h)return;const g=o(i,s,f,l,c,a);if(g===Au)d.length!==0&&(e.redoStack=[],n.dispatchCommand(yn,!1)),f!==null&&(u.push({...f}),n.dispatchCommand(Cn,!0));else if(g===ku)return;e.current={editor:n,editorState:s}}))}function Kw(){return{current:null,redoStack:[],undoStack:[]}}const Ww=Object.freeze(Object.defineProperty({__proto__:null,createEmptyHistoryState:Kw,registerHistory:Bw},Symbol.toStringTag,{value:"Module"})),L_=process.env.NODE_ENV==="development"?Rw:Ww,zw=L_.createEmptyHistoryState,Uw=L_.registerHistory;function jw({delay:n,externalHistoryState:e}){const[t]=Xn();return function(o,r,s=1e3){const i=I.useMemo(()=>r||zw(),[r]);I.useEffect(()=>Uw(o,i,s),[s,o,i])}(t,e,n),null}const Hw=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?I.useLayoutEffect:I.useEffect;function Yw(n){return{initialValueFn:()=>n.isEditable(),subscribe:e=>n.registerEditableListener(e)}}function Jw(){return function(n){const[e]=Xn(),t=I.useMemo(()=>n(e),[e,n]),o=I.useRef(t.initialValueFn()),[r,s]=I.useState(o.current);return Hw(()=>{const{initialValueFn:i,subscribe:l}=t,c=i();return o.current!==c&&(o.current=c,s(c)),l(a=>{o.current=a,s(a)})},[t,n]),r}(Yw)}function Vw(n){const e=window.location.origin,t=o=>{if(o.origin!==e)return;const r=n.getRootElement();if(document.activeElement!==r)return;const s=o.data;if(typeof s=="string"){let i;try{i=JSON.parse(s)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){const l=i.payload;if(l&&l.functionId==="makeChanges"){const c=l.args;if(c){const[a,f,d,u,h,g]=c;n.update(()=>{const p=M();if(v(p)){const _=p.anchor;let y=_.getNode(),m=0,C=0;if(L(y)&&a>=0&&f>=0&&(m=a,C=a+f,p.setTextNodeRange(y,m,y,C)),(m!==C||d!=="")&&(p.insertRawText(d),y=_.getNode()),L(y)){m=u,C=u+h;const N=y.getTextContentSize();m=m>N?N:m,C=C>N?N:C,p.setTextNodeRange(y,m,y,C)}o.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}const Gw=Object.freeze(Object.defineProperty({__proto__:null,registerDragonSupport:Vw},Symbol.toStringTag,{value:"Module"}));function Xw(n){const e=window.location.origin,t=o=>{if(o.origin!==e)return;const r=n.getRootElement();if(document.activeElement!==r)return;const s=o.data;if(typeof s=="string"){let i;try{i=JSON.parse(s)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){const l=i.payload;if(l&&l.functionId==="makeChanges"){const c=l.args;if(c){const[a,f,d,u,h,g]=c;n.update(()=>{const p=M();if(v(p)){const _=p.anchor;let y=_.getNode(),m=0,C=0;if(L(y)&&a>=0&&f>=0&&(m=a,C=a+f,p.setTextNodeRange(y,m,y,C)),m===C&&d===""||(p.insertRawText(d),y=_.getNode()),L(y)){m=u,C=u+h;const N=y.getTextContentSize();m=m>N?N:m,C=C>N?N:C,p.setTextNodeRange(y,m,y,C)}o.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}const qw=Object.freeze(Object.defineProperty({__proto__:null,registerDragonSupport:Xw},Symbol.toStringTag,{value:"Module"})),Qw=(process.env.NODE_ENV==="development"?Gw:qw).registerDragonSupport;function Zw(n,e){const t=e.body?e.body.childNodes:[];let o=[];const r=[];for(let s=0;s<t.length;s++){const i=t[s];if(!B_.has(i.nodeName)){const l=K_(i,n,r,!1);l!==null&&(o=o.concat(l))}}return nb(r),o}function eb(n,e){if(typeof document>"u"||typeof window>"u"&&typeof global.window>"u")throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),r=Oe().getChildren();for(let s=0;s<r.length;s++){const i=r[s];F_(n,i,t,e)}return t.innerHTML}function F_(n,e,t,o=null){let r=o!==null?e.isSelected(o):!0;const s=A(e)&&e.excludeFromCopy("html");let i=e;if(o!==null){let h=jn(e);h=L(h)&&o!==null?Wl(o,h):h,i=h}const l=A(i)?i.getChildren():[],c=n._nodes.get(i.getType());let a;c&&c.exportDOM!==void 0?a=c.exportDOM(n,i):a=i.exportDOM(n);const{element:f,after:d}=a;if(!f)return!1;const u=document.createDocumentFragment();for(let h=0;h<l.length;h++){const g=l[h],p=F_(n,g,u,o);!r&&A(e)&&p&&e.extractWithChild(g,o,"html")&&(r=!0)}if(r&&!s){if(qn(f)&&f.append(u),t.append(f),d){const h=d.call(i,f);h&&f.replaceWith(h)}}else t.append(u);return r}function tb(n,e){const{nodeName:t}=n,o=e._htmlConversions.get(t.toLowerCase());let r=null;if(o!==void 0)for(const s of o){const i=s(n);i!==null&&(r===null||(r.priority||0)<(i.priority||0))&&(r=i)}return r!==null?r.conversion:null}const B_=new Set(["STYLE","SCRIPT"]);function K_(n,e,t,o,r=new Map,s){let i=[];if(B_.has(n.nodeName))return i;let l=null;const c=tb(n,e),a=c?c(n):null;let f=null;if(a!==null){f=a.after;const g=a.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,p]of r)if(l=p(l,s),!l)break;l&&i.push(...Array.isArray(g)?g:[l])}a.forChild!=null&&r.set(n.nodeName,a.forChild)}const d=n.childNodes;let u=[];const h=l!=null&&it(l)?!1:l!=null&&qo(l)||o;for(let g=0;g<d.length;g++)u.push(...K_(d[g],e,t,h,new Map(r),l));return f!=null&&(u=f(u)),zl(n)&&(h?u=W_(n,u,()=>{const g=new Cl;return t.push(g),g}):u=W_(n,u,ie)),l==null?u.length>0?i=i.concat(u):zl(n)&&ob(n)&&(i=i.concat(fl())):A(l)&&l.append(...u),i}function W_(n,e,t){const o=n.style.textAlign,r=[];let s=[];for(let i=0;i<e.length;i++){const l=e[i];if(qo(l))o&&!l.getFormat()&&l.setFormat(o),r.push(l);else if(s.push(l),i===e.length-1||i<e.length-1&&qo(e[i+1])){const c=t();c.setFormat(o),c.append(...s),r.push(c),s=[]}}return r}function nb(n){for(const e of n)e.getNextSibling()instanceof Cl&&e.insertAfter(fl());for(const e of n){const t=e.getChildren();for(const o of t)e.insertBefore(o);e.remove()}}function ob(n){return n.nextSibling==null||n.previousSibling==null?!1:or(n.nextSibling)&&or(n.previousSibling)}const rb=Object.freeze(Object.defineProperty({__proto__:null,$generateHtmlFromNodes:eb,$generateNodesFromDOM:Zw},Symbol.toStringTag,{value:"Module"}));function sb(n,e){const t=e.body?e.body.childNodes:[];let o=[];const r=[];for(let s=0;s<t.length;s++){const i=t[s];if(!U_.has(i.nodeName)){const l=j_(i,n,r,!1);l!==null&&(o=o.concat(l))}}return function(s){for(const i of s)i.getNextSibling()instanceof Cl&&i.insertAfter(fl());for(const i of s){const l=i.getChildren();for(const c of l)i.insertBefore(c);i.remove()}}(r),o}function ib(n,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),o=Oe().getChildren();for(let r=0;r<o.length;r++)z_(n,o[r],t,e);return t.innerHTML}function z_(n,e,t,o=null){let r=o===null||e.isSelected(o);const s=A(e)&&e.excludeFromCopy("html");let i=e;if(o!==null){let h=jn(e);h=L(h)&&o!==null?Wl(o,h):h,i=h}const l=A(i)?i.getChildren():[],c=n._nodes.get(i.getType());let a;a=c&&c.exportDOM!==void 0?c.exportDOM(n,i):i.exportDOM(n);const{element:f,after:d}=a;if(!f)return!1;const u=document.createDocumentFragment();for(let h=0;h<l.length;h++){const g=l[h],p=z_(n,g,u,o);!r&&A(e)&&p&&e.extractWithChild(g,o,"html")&&(r=!0)}if(r&&!s){if(qn(f)&&f.append(u),t.append(f),d){const h=d.call(i,f);h&&f.replaceWith(h)}}else t.append(u);return r}const U_=new Set(["STYLE","SCRIPT"]);function j_(n,e,t,o,r=new Map,s){let i=[];if(U_.has(n.nodeName))return i;let l=null;const c=function(g,p){const{nodeName:_}=g,y=p._htmlConversions.get(_.toLowerCase());let m=null;if(y!==void 0)for(const C of y){const N=C(g);N!==null&&(m===null||(m.priority||0)<(N.priority||0))&&(m=N)}return m!==null?m.conversion:null}(n,e),a=c?c(n):null;let f=null;if(a!==null){f=a.after;const g=a.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,p]of r)if(l=p(l,s),!l)break;l&&i.push(...Array.isArray(g)?g:[l])}a.forChild!=null&&r.set(n.nodeName,a.forChild)}const d=n.childNodes;let u=[];const h=(l==null||!it(l))&&(l!=null&&qo(l)||o);for(let g=0;g<d.length;g++)u.push(...j_(d[g],e,t,h,new Map(r),l));return f!=null&&(u=f(u)),zl(n)&&(u=lb(n,u,h?()=>{const g=new Cl;return t.push(g),g}:ie)),l==null?u.length>0?i=i.concat(u):zl(n)&&function(g){return g.nextSibling==null||g.previousSibling==null?!1:or(g.nextSibling)&&or(g.previousSibling)}(n)&&(i=i.concat(fl())):A(l)&&l.append(...u),i}function lb(n,e,t){const o=n.style.textAlign,r=[];let s=[];for(let i=0;i<e.length;i++){const l=e[i];if(qo(l))o&&!l.getFormat()&&l.setFormat(o),r.push(l);else if(s.push(l),i===e.length-1||i<e.length-1&&qo(e[i+1])){const c=t();c.setFormat(o),c.append(...s),r.push(c),s=[]}}return r}const cb=Object.freeze(Object.defineProperty({__proto__:null,$generateHtmlFromNodes:ib,$generateNodesFromDOM:sb},Symbol.toStringTag,{value:"Module"})),H_=process.env.NODE_ENV==="development"?rb:cb,Yl=H_.$generateHtmlFromNodes,Y_=H_.$generateNodesFromDOM,ab=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",J_=n=>ab?(n||window).getSelection():null;function V_(n,e=M()){if(e==null)throw Error("Expected valid LexicalSelection");return v(e)&&e.isCollapsed()||e.getNodes().length===0?"":Yl(n,e)}function G_(n,e=M()){if(e==null)throw Error("Expected valid LexicalSelection");return v(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(q_(n,e))}function ub(n,e){const t=n.getData("text/plain")||n.getData("text/uri-list");t!=null&&e.insertRawText(t)}function fb(n,e,t){const o=n.getData("application/x-lexical-editor");if(o)try{const i=JSON.parse(o);if(i.namespace===t._config.namespace&&Array.isArray(i.nodes)){const l=Q_(i.nodes);return Ru(t,l,e)}}catch{}const r=n.getData("text/html");if(r)try{const l=new DOMParser().parseFromString(r,"text/html"),c=Y_(t,l);return Ru(t,c,e)}catch{}const s=n.getData("text/plain")||n.getData("text/uri-list");if(s!=null)if(v(e)){const i=s.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let l=0;l<i.length;l++){const c=M();if(v(c)){const a=i[l];a===`
35
+ `);const c=l.length;if(!L(r)||o>=c){const a=r.getParent();r.remove(),a==null||a.getChildrenSize()!==0||Yn(a)||a.remove(),o-=c+i,r=s}else{const a=r.getKey(),f=n.getEditorState().read(()=>{const h=Ot(a);return L(h)&&h.isSimpleText()?h.getTextContent():null}),d=c-o,u=l.slice(0,d);if(f!==null&&f!==l){const h=Hn();let g=r;if(r.isSimpleText())r.setTextContent(f);else{const p=bt(f);r.replace(p),g=p}if(v(h)&&h.isCollapsed()){const p=h.anchor.offset;g.select(p,p)}}else if(r.isSimpleText()){const h=e.key===a;let g=e.offset;g<o&&(g=c);const p=h?g-o:0,_=h?g:d;if(h&&p===0){const[y]=r.splitText(p,_);y.remove()}else{const[,y]=r.splitText(p,_);y.remove()}}else{const h=bt(u);r.replace(h)}o=0}}}function Wx(n){const e=n.getStyle(),t=a_(e);Il.set(e,t)}function so(n,e){const t=Ll("getStyle"in n?n.getStyle():n.style),r=Object.entries(e).reduce((s,[i,l])=>(typeof l=="function"?s[i]=l(t[i],n):l===null?delete s[i]:s[i]=l,s),{...t}),o=function(s){let i="";for(const l in s)l&&(i+=`${l}: ${s[l]};`);return i}(r);n.setStyle(o),Il.set(o,r)}function zx(n,e){const t=n.getNodes(),r=t.length,o=n.getStartEndPoints();if(o===null)return;const[s,i]=o,l=r-1;let c=t[0],a=t[l];if(n.isCollapsed()&&v(n))return void so(n,e);const f=c.getTextContent().length,d=i.offset;let u=s.offset;const h=s.isBefore(i);let g=h?u:d,p=h?d:u;const _=h?s.type:i.type,y=h?i.type:s.type,m=h?i.key:s.key;if(L(c)&&g===f){const C=c.getNextSibling();L(C)&&(u=0,g=0,c=C)}if(t.length===1){if(L(c)&&c.canHaveFormat()){if(g=_==="element"?0:u>d?d:u,p=y==="element"?f:u>d?u:d,g===p)return;if(Qr(c)||g===0&&p===f)so(c,e),c.select(g,p);else{const C=c.splitText(g,p),N=g===0?C[0]:C[1];so(N,e),N.select(0,p-g)}}}else{if(L(c)&&g<c.getTextContentSize()&&c.canHaveFormat()&&(g===0||Qr(c)||(c=c.splitText(g)[1],g=0,h?s.set(c.getKey(),g,"text"):i.set(c.getKey(),g,"text")),so(c,e)),L(a)&&a.canHaveFormat()){const C=a.getTextContent().length;a.__key!==m&&p!==0&&(p=C),p===C||Qr(a)||([a]=a.splitText(p)),p===0&&y!=="element"||so(a,e)}for(let C=1;C<l;C++){const N=t[C],S=N.getKey();L(N)&&N.canHaveFormat()&&S!==c.getKey()&&S!==a.getKey()&&!N.isToken()&&so(N,e)}}}function jx(n,e){if(n===null)return;const t=n.getStartEndPoints(),r=t?t[0]:null;if(r!==null&&r.key==="root"){const i=e(),l=Oe(),c=l.getFirstChild();return void(c?c.replace(i,!0):l.append(i))}const o=n.getNodes(),s=r!==null&&function(i,l){let c=i;for(;c!==null&&c.getParent()!==null&&!l(c);)c=c.getParentOrThrow();return l(c)?c:null}(r.getNode(),g_);s&&o.indexOf(s)===-1&&o.push(s);for(let i=0;i<o.length;i++){const l=o[i];if(!g_(l))continue;A(l)||wu(178);const c=e();c.setFormat(l.getFormatType()),c.setIndent(l.getIndent()),l.replace(c,!0)}}function f_(n){return n.getNode().isAttached()}function Ux(n){let e=n;for(;e!==null&&!it(e);){const t=e.getLatest(),r=e.getParent();t.getChildrenSize()===0&&e.remove(!0),e=r}}function Hx(n,e,t=null){const r=n.getStartEndPoints(),o=r?r[0]:null,s=n.getNodes(),i=s.length;if(o!==null&&(i===0||i===1&&o.type==="element"&&o.getNode().getChildrenSize()===0)){const a=o.type==="text"?o.getNode().getParentOrThrow():o.getNode(),f=a.getChildren();let d=e();return d.setFormat(a.getFormatType()),d.setIndent(a.getIndent()),f.forEach(u=>d.append(u)),t&&(d=t.append(d)),void a.replace(d)}let l=null,c=[];for(let a=0;a<i;a++){const f=s[a];it(f)?(bu(n,c,c.length,e,t),c=[],l=f):l===null||l!==null&&Sp(f,l)?c.push(f):(bu(n,c,c.length,e,t),c=[f])}bu(n,c,c.length,e,t)}function bu(n,e,t,r,o=null){if(e.length===0)return;const s=e[0],i=new Map,l=[];let c=A(s)?s:s.getParentOrThrow();c.isInline()&&(c=c.getParentOrThrow());let a=!1;for(;c!==null;){const g=c.getPreviousSibling();if(g!==null){c=g,a=!0;break}if(c=c.getParentOrThrow(),it(c))break}const f=new Set;for(let g=0;g<t;g++){const p=e[g];A(p)&&p.getChildrenSize()===0&&f.add(p.getKey())}const d=new Set;for(let g=0;g<t;g++){const p=e[g];let _=p.getParent();if(_!==null&&_.isInline()&&(_=_.getParent()),_!==null&&xp(p)&&!d.has(p.getKey())){const y=_.getKey();if(i.get(y)===void 0){const m=r();m.setFormat(_.getFormatType()),m.setIndent(_.getIndent()),l.push(m),i.set(y,m),_.getChildren().forEach(C=>{m.append(C),d.add(C.getKey()),A(C)&&C.getChildrenKeys().forEach(N=>d.add(N))}),Ux(_)}}else if(f.has(p.getKey())){A(p)||wu(179);const y=r();y.setFormat(p.getFormatType()),y.setIndent(p.getIndent()),l.push(y),p.remove(!0)}}if(o!==null)for(let g=0;g<l.length;g++){const p=l[g];o.append(p)}let u=null;if(it(c))if(a)if(o!==null)c.insertAfter(o);else for(let g=l.length-1;g>=0;g--){const p=l[g];c.insertAfter(p)}else{const g=c.getFirstChild();if(A(g)&&(c=g),g===null)if(o)c.append(o);else for(let p=0;p<l.length;p++){const _=l[p];c.append(_),u=_}else if(o!==null)g.insertBefore(o);else for(let p=0;p<l.length;p++){const _=l[p];g.insertBefore(_),u=_}}else if(o)c.insertAfter(o);else for(let g=l.length-1;g>=0;g--){const p=l[g];c.insertAfter(p),u=p}const h=Hn();v(h)&&f_(h.anchor)&&f_(h.focus)?Pe(h.clone()):u!==null?u.selectEnd():n.dirty=!0}function Yx(n,e){const t=Xr(n.focus,e);return st(t)&&!t.isIsolated()||A(t)&&!t.isInline()&&!t.canBeEmpty()}function d_(n,e,t,r){n.modify(e?"extend":"move",t,r)}function h_(n){const e=n.anchor.getNode();return(Yn(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Jx(n,e,t){const r=h_(n);d_(n,e,t?!r:r,"character")}function Vx(n){const e=n.anchor,t=n.focus,r=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();let o=r.getFirstDescendant(),s=r.getLastDescendant(),i="element",l="element",c=0;L(o)?i="text":A(o)||o===null||(o=o.getParentOrThrow()),L(s)?(l="text",c=s.getTextContentSize()):A(s)||s===null||(s=s.getParentOrThrow()),o&&s&&(e.set(o.getKey(),0,i),t.set(s.getKey(),c,l))}function Gx(n,e,t){const r=Ll(n.getStyle());return r!==null&&r[e]||t}function Xx(n,e,t=""){let r=null;const o=n.getNodes(),s=n.anchor,i=n.focus,l=n.isBackward(),c=l?i.offset:s.offset,a=l?i.getNode():s.getNode();if(v(n)&&n.isCollapsed()&&n.style!==""){const f=Ll(n.style);if(f!==null&&e in f)return f[e]}for(let f=0;f<o.length;f++){const d=o[f];if((f===0||c!==0||!d.is(a))&&L(d)){const u=Gx(d,e,t);if(r===null)r=u;else if(r!==u){r="";break}}}return r===null?t:r}function g_(n){if(st(n)||!A(n)||it(n))return!1;const e=n.getFirstChild(),t=e===null||gl(e)||L(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}const qx=Object.freeze(Object.defineProperty({__proto__:null,$addNodeStyle:Wx,$getSelectionStyleValueForProperty:Xx,$isAtNodeEnd:Kx,$isParentElementRTL:h_,$moveCaretSelection:d_,$moveCharacter:Jx,$patchStyleText:zx,$selectAll:Vx,$setBlocksType:jx,$shouldOverrideDefaultCharacterSelection:Yx,$sliceSelectedTextNodeContent:Bx,$trimTextContentFromAnchor:u_,$wrapNodes:Hx,createDOMRange:Lx,createRectsFromDOMRange:Fx,getStyleObjectFromCSS:Ll,trimTextContentFromAnchor:u_,$cloneWithProperties:Un},Symbol.toStringTag,{value:"Module"})),Ts=process.env.NODE_ENV==="development"?Px:qx,p_=Ts.$addNodeStyle,Fl=Ts.$moveCharacter,Bl=Ts.$shouldOverrideDefaultCharacterSelection,Kl=Ts.$sliceSelectedTextNodeContent,__=Ts.createRectsFromDOMRange,zt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Qx=zt&&"documentMode"in document?document.documentMode:null,Zx=zt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),eE=zt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),tE=zt&&"InputEvent"in window&&!Qx?"getTargetRanges"in new window.InputEvent("input"):!1,nE=zt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),rE=zt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,m_=zt&&/Android/.test(navigator.userAgent),Ou=zt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),oE=zt&&m_&&Ou,sE=zt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Ou;function y_(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[r]of t.matchAll(/\S+/g))e.push(r);return e}function C_(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}function on(n){return`${n}px`}const iE={attributes:!0,characterData:!0,childList:!0,subtree:!0};function N_(n,e,t){let r=null,o=null,s=null,i=[];const l=document.createElement("div");function c(){if(r===null)throw Error("Unexpected null rootDOMNode");if(o===null)throw Error("Unexpected null parentDOMNode");const{left:u,top:h}=r.getBoundingClientRect(),g=o,p=__(n,e);l.isConnected||g.append(l);let _=!1;for(let y=0;y<p.length;y++){const m=p[y],C=i[y]||document.createElement("div"),N=C.style;N.position!=="absolute"&&(N.position="absolute",_=!0);const S=on(m.left-u);N.left!==S&&(N.left=S,_=!0);const T=on(m.top-h);N.top!==T&&(C.style.top=T,_=!0);const E=on(m.width);N.width!==E&&(C.style.width=E,_=!0);const x=on(m.height);N.height!==x&&(C.style.height=x,_=!0),C.parentNode!==l&&(l.append(C),_=!0),i[y]=C}for(;i.length>p.length;)i.pop();_&&t(i)}function a(){o=null,r=null,s!==null&&s.disconnect(),s=null,l.remove();for(const u of i)u.remove();i=[]}function f(){const u=n.getRootElement();if(u===null)return a();const h=u.parentElement;if(!(h instanceof HTMLElement))return a();a(),r=u,o=h,s=new MutationObserver(g=>{const p=n.getRootElement(),_=p&&p.parentElement;if(p!==r||_!==o)return f();for(const y of g)if(!l.contains(y.target))return c()}),s.observe(h,iE),c()}const d=n.registerRootListener(f);return()=>{d(),a()}}function lE(n,e){let t=null,r=null,o=null,s=null,i=()=>{};function l(c){c.read(()=>{const a=M();if(!v(a)){t=null,r=null,o=null,s=null,i(),i=()=>{};return}const{anchor:f,focus:d}=a,u=f.getNode(),h=u.getKey(),g=f.offset,p=d.getNode(),_=p.getKey(),y=d.offset,m=n.getElementByKey(h),C=n.getElementByKey(_),N=t===null||m===null||g!==r||h!==t.getKey()||u!==t&&(!(t instanceof to)||u.updateDOM(t,m,n._config)),S=o===null||C===null||y!==s||_!==o.getKey()||p!==o&&(!(o instanceof to)||p.updateDOM(o,C,n._config));if(N||S){const T=n.getElementByKey(f.getNode().getKey()),E=n.getElementByKey(d.getNode().getKey());if(T!==null&&E!==null&&T.tagName==="SPAN"&&E.tagName==="SPAN"){const x=document.createRange();let w,O,D,B;d.isBefore(f)?(w=E,O=d.offset,D=T,B=f.offset):(w=T,O=f.offset,D=E,B=d.offset);const q=w.firstChild;if(q===null)throw Error("Expected text node to be first child of span");const Y=D.firstChild;if(Y===null)throw Error("Expected text node to be first child of span");x.setStart(q,O),x.setEnd(Y,B),i(),i=N_(n,x,J=>{for(const oe of J){const F=oe.style;F.background!=="Highlight"&&(F.background="Highlight"),F.color!=="HighlightText"&&(F.color="HighlightText"),F.zIndex!=="-1"&&(F.zIndex="-1"),F.pointerEvents!=="none"&&(F.pointerEvents="none"),F.marginTop!==on(-1.5)&&(F.marginTop=on(-1.5)),F.paddingTop!==on(4)&&(F.paddingTop=on(4)),F.paddingBottom!==on(0)&&(F.paddingBottom=on(0))}e!==void 0&&e(J)})}}t=u,r=g,o=p,s=y})}return l(n.getEditorState()),C_(n.registerUpdateListener(({editorState:c})=>l(c)),i,()=>{i()})}const cE=tE,aE=zt,uE=m_,fE=oE,dE=Zx,hE=sE,gE=Ou,S_=eE,pE=rE,_E=nE;function mE(n,...e){const t=y_(...e);t.length>0&&n.classList.add(...t)}function yE(n,...e){const t=y_(...e);t.length>0&&n.classList.remove(...t)}function T_(n,e){for(const t of e)if(n.type.startsWith(t))return!0;return!1}function CE(n,e){const t=n[Symbol.iterator]();return new Promise((r,o)=>{const s=[],i=()=>{const{done:l,value:c}=t.next();if(l)return r(s);const a=new FileReader;a.addEventListener("error",o),a.addEventListener("load",()=>{const f=a.result;typeof f=="string"&&s.push({file:c,result:f}),i()}),T_(c,e)?a.readAsDataURL(c):i()};i()})}function NE(n,e){const t=[],r=(n||Oe()).getLatest(),o=e||A(r)&&r.getLastDescendant()||r;let s=r,i=SE(s);for(;s!==null&&!s.is(o);)if(t.push({depth:i,node:s}),A(s)&&s.getChildrenSize()>0)s=s.getFirstChild(),i++;else{let l=null;for(;l===null&&s!==null;)l=s.getNextSibling(),l===null?(s=s.getParent(),i--):s=l}return s!==null&&s.is(o)&&t.push({depth:i,node:s}),t}function SE(n){let e=n,t=0;for(;(e=e.getParent())!==null;)t++;return t}function TE(n){let e=n;if(A(e)&&e.getChildrenSize()>0)e=e.getLastChild();else{let t=null;for(;t===null&&e!==null;)t=e.getPreviousSibling(),t===null?e=e.getParent():e=t}return e}function xE(n,e){let t=n;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function EE(n){const e=x_(n,t=>A(t)&&!t.isInline());if(!A(e))throw Error(`Expected node ${n.__key} to have closest block element node.`);return e}const x_=(n,e)=>{let t=n;for(;t!==Oe()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function wE(n,e,t,r){const o=l=>l instanceof e,s=l=>{const c=l.getChildren();for(let d=0;d<c.length;d++){const u=c[d];if(o(u))return null}let a=l,f=l;for(;a!==null;)if(f=a,a=a.getParent(),o(a))return{child:f,parent:a};return null},i=l=>{const c=s(l);if(c!==null){const{child:a,parent:f}=c;if(a.is(l)){r(f,l);const d=a.getNextSiblings(),u=d.length;if(f.insertAfter(a),u!==0){const h=t(f);a.insertAfter(h);for(let g=0;g<u;g++)h.append(d[g])}!f.canBeEmpty()&&f.getChildrenSize()===0&&f.remove()}}};return n.registerNodeTransform(e,i)}function bE(n,e){const r=new Map,o=n._pendingEditorState;for(const[i,l]of e._nodeMap)r.set(i,Un(l));o&&(o._nodeMap=r),n._dirtyType=2;const s=e._selection;Pe(s===null?null:s.clone())}function OE(n){const e=M()||Hn();if(v(e)){const{focus:t}=e,r=t.getNode(),o=t.offset;if(it(r)){const s=r.getChildAtIndex(o);s==null?r.append(n):s.insertBefore(n),n.selectNext()}else{let s,i;L(r)?(s=r.getParentOrThrow(),i=r.getIndexWithinParent(),o>0&&(i+=1,r.splitText(o))):(s=r,i=o);const[,l]=ml(s,i);l.insertBefore(n),l.selectStart()}}else{if(e!=null){const r=e.getNodes();r[r.length-1].getTopLevelElementOrThrow().insertAfter(n)}else Oe().append(n);const t=ie();n.insertAfter(t),t.select()}return n.getLatest()}function vE(n,e){const t=e();return n.replace(t),t.append(n),t}function ME(n,e){return n!==null?Object.getPrototypeOf(n).constructor.name===e.name:!1}function DE(n,e){const t=[];for(let r=0;r<n.length;r++){const o=e(n[r]);o!==null&&t.push(o)}return t}function AE(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function kE(n){if(S_)return 1;let e=1;for(;n;)e*=Number(window.getComputedStyle(n).getPropertyValue("zoom")),n=n.parentElement;return e}function RE(n){return n._parentEditor!==null}const $E=Object.freeze(Object.defineProperty({__proto__:null,$dfs:NE,$filter:DE,$findMatchingParent:x_,$getNearestBlockElementAncestorOrThrow:EE,$getNearestNodeOfType:xE,$getNextRightPreorderNode:TE,$insertFirst:AE,$insertNodeToNearestRoot:OE,$isEditorIsNestedEditor:RE,$restoreEditorState:bE,$wrapNodeInElement:vE,CAN_USE_BEFORE_INPUT:cE,CAN_USE_DOM:aE,IS_ANDROID:uE,IS_ANDROID_CHROME:fE,IS_APPLE:dE,IS_APPLE_WEBKIT:hE,IS_CHROME:gE,IS_FIREFOX:S_,IS_IOS:pE,IS_SAFARI:_E,addClassNamesToElement:mE,calculateZoomLevel:kE,isMimeType:T_,markSelection:lE,mediaFileReader:CE,mergeRegister:C_,objectKlassEquals:ME,positionNodeOnRange:N_,registerNestedElementResolver:wE,removeClassNamesFromElement:yE,$splitNode:ml,isBlockDomNode:Kp,isHTMLAnchorElement:zp,isHTMLElement:jp,isInlineDomNode:ro},Symbol.toStringTag,{value:"Module"}));function PE(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var xs=PE(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const jt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,IE=jt&&"documentMode"in document?document.documentMode:null,LE=jt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),FE=jt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),BE=!(!jt||!("InputEvent"in window)||IE)&&"getTargetRanges"in new window.InputEvent("input"),KE=jt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),WE=jt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,E_=jt&&/Android/.test(navigator.userAgent),vu=jt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),zE=jt&&E_&&vu,jE=jt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!vu;function w_(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[r]of t.matchAll(/\S+/g))e.push(r);return e}function b_(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}function sn(n){return`${n}px`}const UE={attributes:!0,characterData:!0,childList:!0,subtree:!0};function O_(n,e,t){let r=null,o=null,s=null,i=[];const l=document.createElement("div");function c(){r===null&&xs(182),o===null&&xs(183);const{left:d,top:u}=r.getBoundingClientRect(),h=o,g=__(n,e);l.isConnected||h.append(l);let p=!1;for(let _=0;_<g.length;_++){const y=g[_],m=i[_]||document.createElement("div"),C=m.style;C.position!=="absolute"&&(C.position="absolute",p=!0);const N=sn(y.left-d);C.left!==N&&(C.left=N,p=!0);const S=sn(y.top-u);C.top!==S&&(m.style.top=S,p=!0);const T=sn(y.width);C.width!==T&&(m.style.width=T,p=!0);const E=sn(y.height);C.height!==E&&(m.style.height=E,p=!0),m.parentNode!==l&&(l.append(m),p=!0),i[_]=m}for(;i.length>g.length;)i.pop();p&&t(i)}function a(){o=null,r=null,s!==null&&s.disconnect(),s=null,l.remove();for(const d of i)d.remove();i=[]}const f=n.registerRootListener(function d(){const u=n.getRootElement();if(u===null)return a();const h=u.parentElement;if(!(h instanceof HTMLElement))return a();a(),r=u,o=h,s=new MutationObserver(g=>{const p=n.getRootElement(),_=p&&p.parentElement;if(p!==r||_!==o)return d();for(const y of g)if(!l.contains(y.target))return c()}),s.observe(h,UE),c()});return()=>{f(),a()}}function HE(n,e){let t=null,r=null,o=null,s=null,i=()=>{};function l(c){c.read(()=>{const a=M();if(!v(a))return t=null,r=null,o=null,s=null,i(),void(i=()=>{});const{anchor:f,focus:d}=a,u=f.getNode(),h=u.getKey(),g=f.offset,p=d.getNode(),_=p.getKey(),y=d.offset,m=n.getElementByKey(h),C=n.getElementByKey(_),N=t===null||m===null||g!==r||h!==t.getKey()||u!==t&&(!(t instanceof to)||u.updateDOM(t,m,n._config)),S=o===null||C===null||y!==s||_!==o.getKey()||p!==o&&(!(o instanceof to)||p.updateDOM(o,C,n._config));if(N||S){const T=n.getElementByKey(f.getNode().getKey()),E=n.getElementByKey(d.getNode().getKey());if(T!==null&&E!==null&&T.tagName==="SPAN"&&E.tagName==="SPAN"){const x=document.createRange();let w,O,D,B;d.isBefore(f)?(w=E,O=d.offset,D=T,B=f.offset):(w=T,O=f.offset,D=E,B=d.offset);const q=w.firstChild;q===null&&xs(181);const Y=D.firstChild;Y===null&&xs(181),x.setStart(q,O),x.setEnd(Y,B),i(),i=O_(n,x,J=>{for(const oe of J){const F=oe.style;F.background!=="Highlight"&&(F.background="Highlight"),F.color!=="HighlightText"&&(F.color="HighlightText"),F.zIndex!=="-1"&&(F.zIndex="-1"),F.pointerEvents!=="none"&&(F.pointerEvents="none"),F.marginTop!==sn(-1.5)&&(F.marginTop=sn(-1.5)),F.paddingTop!==sn(4)&&(F.paddingTop=sn(4)),F.paddingBottom!==sn(0)&&(F.paddingBottom=sn(0))}e!==void 0&&e(J)})}}t=u,r=g,o=p,s=y})}return l(n.getEditorState()),b_(n.registerUpdateListener(({editorState:c})=>l(c)),i,()=>{i()})}const YE=BE,JE=jt,VE=E_,GE=zE,XE=LE,qE=jE,QE=vu,v_=FE,ZE=WE,ew=KE;function tw(n,...e){const t=w_(...e);t.length>0&&n.classList.add(...t)}function nw(n,...e){const t=w_(...e);t.length>0&&n.classList.remove(...t)}function M_(n,e){for(const t of e)if(n.type.startsWith(t))return!0;return!1}function rw(n,e){const t=n[Symbol.iterator]();return new Promise((r,o)=>{const s=[],i=()=>{const{done:l,value:c}=t.next();if(l)return r(s);const a=new FileReader;a.addEventListener("error",o),a.addEventListener("load",()=>{const f=a.result;typeof f=="string"&&s.push({file:c,result:f}),i()}),M_(c,e)?a.readAsDataURL(c):i()};i()})}function ow(n,e){const t=[],r=(n||Oe()).getLatest(),o=e||A(r)&&r.getLastDescendant()||r;let s=r,i=function(l){let c=l,a=0;for(;(c=c.getParent())!==null;)a++;return a}(s);for(;s!==null&&!s.is(o);)if(t.push({depth:i,node:s}),A(s)&&s.getChildrenSize()>0)s=s.getFirstChild(),i++;else{let l=null;for(;l===null&&s!==null;)l=s.getNextSibling(),l===null?(s=s.getParent(),i--):s=l}return s!==null&&s.is(o)&&t.push({depth:i,node:s}),t}function sw(n){let e=n;if(A(e)&&e.getChildrenSize()>0)e=e.getLastChild();else{let t=null;for(;t===null&&e!==null;)t=e.getPreviousSibling(),e=t===null?e.getParent():t}return e}function iw(n,e){let t=n;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function lw(n){const e=D_(n,t=>A(t)&&!t.isInline());return A(e)||xs(4,n.__key),e}const D_=(n,e)=>{let t=n;for(;t!==Oe()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function cw(n,e,t,r){const o=s=>s instanceof e;return n.registerNodeTransform(e,s=>{const i=(l=>{const c=l.getChildren();for(let d=0;d<c.length;d++){const u=c[d];if(o(u))return null}let a=l,f=l;for(;a!==null;)if(f=a,a=a.getParent(),o(a))return{child:f,parent:a};return null})(s);if(i!==null){const{child:l,parent:c}=i;if(l.is(s)){r(c,s);const a=l.getNextSiblings(),f=a.length;if(c.insertAfter(l),f!==0){const d=t(c);l.insertAfter(d);for(let u=0;u<f;u++)d.append(a[u])}c.canBeEmpty()||c.getChildrenSize()!==0||c.remove()}}})}function aw(n,e){const t=new Map,r=n._pendingEditorState;for(const[s,i]of e._nodeMap)t.set(s,Un(i));r&&(r._nodeMap=t),n._dirtyType=2;const o=e._selection;Pe(o===null?null:o.clone())}function uw(n){const e=M()||Hn();if(v(e)){const{focus:t}=e,r=t.getNode(),o=t.offset;if(it(r)){const s=r.getChildAtIndex(o);s==null?r.append(n):s.insertBefore(n),n.selectNext()}else{let s,i;L(r)?(s=r.getParentOrThrow(),i=r.getIndexWithinParent(),o>0&&(i+=1,r.splitText(o))):(s=r,i=o);const[,l]=ml(s,i);l.insertBefore(n),l.selectStart()}}else{if(e!=null){const r=e.getNodes();r[r.length-1].getTopLevelElementOrThrow().insertAfter(n)}else Oe().append(n);const t=ie();n.insertAfter(t),t.select()}return n.getLatest()}function fw(n,e){const t=e();return n.replace(t),t.append(n),t}function dw(n,e){return n!==null&&Object.getPrototypeOf(n).constructor.name===e.name}function hw(n,e){const t=[];for(let r=0;r<n.length;r++){const o=e(n[r]);o!==null&&t.push(o)}return t}function gw(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function pw(n){if(v_)return 1;let e=1;for(;n;)e*=Number(window.getComputedStyle(n).getPropertyValue("zoom")),n=n.parentElement;return e}function _w(n){return n._parentEditor!==null}const mw=Object.freeze(Object.defineProperty({__proto__:null,$dfs:ow,$filter:hw,$findMatchingParent:D_,$getNearestBlockElementAncestorOrThrow:lw,$getNearestNodeOfType:iw,$getNextRightPreorderNode:sw,$insertFirst:gw,$insertNodeToNearestRoot:uw,$isEditorIsNestedEditor:_w,$restoreEditorState:aw,$wrapNodeInElement:fw,CAN_USE_BEFORE_INPUT:YE,CAN_USE_DOM:JE,IS_ANDROID:VE,IS_ANDROID_CHROME:GE,IS_APPLE:XE,IS_APPLE_WEBKIT:qE,IS_CHROME:QE,IS_FIREFOX:v_,IS_IOS:ZE,IS_SAFARI:ew,addClassNamesToElement:tw,calculateZoomLevel:pw,isMimeType:M_,markSelection:HE,mediaFileReader:rw,mergeRegister:b_,objectKlassEquals:dw,positionNodeOnRange:O_,registerNestedElementResolver:cw,removeClassNamesFromElement:nw,$splitNode:ml,isBlockDomNode:Kp,isHTMLAnchorElement:zp,isHTMLElement:jp,isInlineDomNode:ro},Symbol.toStringTag,{value:"Module"})),Cn=process.env.NODE_ENV==="development"?$E:mw,z=Cn.$findMatchingParent,A_=Cn.$getNearestBlockElementAncestorOrThrow,Ie=Cn.addClassNamesToElement,Wl=Cn.isBlockDomNode,k_=Cn.isHTMLAnchorElement,qn=Cn.isHTMLElement,Nn=Cn.mergeRegister,lt=Cn.objectKlassEquals,zl=Cn.removeClassNamesFromElement,R_=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?I.useLayoutEffect:I.useEffect;function yw({editor:n,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:r,ariaDescribedBy:o,ariaExpanded:s,ariaLabel:i,ariaLabelledBy:l,ariaMultiline:c,ariaOwns:a,ariaRequired:f,autoCapitalize:d,className:u,id:h,role:g="textbox",spellCheck:p=!0,style:_,tabIndex:y,"data-testid":m,...C},N){const[S,T]=I.useState(n.isEditable()),E=I.useCallback(w=>{w&&w.ownerDocument&&w.ownerDocument.defaultView?n.setRootElement(w):n.setRootElement(null)},[n]),x=I.useMemo(()=>function(...w){return O=>{w.forEach(D=>{typeof D=="function"?D(O):D!=null&&(D.current=O)})}}(N,E),[E,N]);return R_(()=>(T(n.isEditable()),n.registerEditableListener(w=>{T(w)})),[n]),W.exports.jsx("div",{...C,"aria-activedescendant":S?e:void 0,"aria-autocomplete":S?t:"none","aria-controls":S?r:void 0,"aria-describedby":o,"aria-expanded":S&&g==="combobox"?!!s:void 0,"aria-label":i,"aria-labelledby":l,"aria-multiline":c,"aria-owns":S?a:void 0,"aria-readonly":!S||void 0,"aria-required":f,autoCapitalize:d,className:u,contentEditable:S,"data-testid":m,id:h,ref:x,role:S?g:void 0,spellCheck:p,style:_,tabIndex:y})}const Cw=I.forwardRef(yw);function $_(n){return n.getEditorState().read(Qp(n.isComposing()))}const Nw=I.forwardRef(Sw);function Sw(n,e){const{placeholder:t,...r}=n,[o]=Xn();return W.exports.jsxs(W.exports.Fragment,{children:[W.exports.jsx(Cw,{editor:o,...r,ref:e}),t!=null&&W.exports.jsx(Tw,{editor:o,content:t})]})}function Tw({content:n,editor:e}){const t=function(i){const[l,c]=I.useState(()=>$_(i));return R_(()=>{function a(){const f=$_(i);c(f)}return a(),Nn(i.registerUpdateListener(()=>{a()}),i.registerEditableListener(()=>{a()}))},[i]),l}(e),[r,o]=I.useState(e.isEditable());if(I.useLayoutEffect(()=>(o(e.isEditable()),e.registerEditableListener(i=>{o(i)})),[e]),!t)return null;let s=null;return typeof n=="function"?s=n(r):n!==null&&(s=n),s===null?null:W.exports.jsx("div",{"aria-hidden":!0,children:s})}const jl=0,Mu=1,Du=2,Ut=0,xw=1,P_=2,Ew=3,ww=4;function bw(n,e,t){const r=n._nodeMap,o=[];for(const s of e){const i=r.get(s);i!==void 0&&o.push(i)}for(const[s,i]of t){if(!i)continue;const l=r.get(s);l!==void 0&&!Yn(l)&&o.push(l)}return o}function Ow(n,e,t,r,o){if(n===null||t.size===0&&r.size===0&&!o)return Ut;const s=e._selection,i=n._selection;if(o)return xw;if(!v(s)||!v(i)||!i.isCollapsed()||!s.isCollapsed())return Ut;const l=bw(e,t,r);if(l.length===0)return Ut;if(l.length>1){const y=e._nodeMap,m=y.get(s.anchor.key),C=y.get(i.anchor.key);return m&&C&&!n._nodeMap.has(m.__key)&&L(m)&&m.__text.length===1&&s.anchor.offset===1?P_:Ut}const c=l[0],a=n._nodeMap.get(c.__key);if(!L(a)||!L(c)||a.__mode!==c.__mode)return Ut;const f=a.__text,d=c.__text;if(f===d)return Ut;const u=s.anchor,h=i.anchor;if(u.key!==h.key||u.type!=="text")return Ut;const g=u.offset,p=h.offset,_=d.length-f.length;return _===1&&p===g-1?P_:_===-1&&p===g+1?Ew:_===-1&&p===g?ww:Ut}function vw(n,e,t){const r=e._nodeMap.get(n),o=t._nodeMap.get(n),s=e._selection,i=t._selection;return!(v(s)&&v(i)&&s.anchor.type==="element"&&s.focus.type==="element"&&i.anchor.type==="text"&&i.focus.type==="text")&&L(r)&&L(o)&&r.__parent===o.__parent?JSON.stringify(e.read(()=>r.exportJSON()))===JSON.stringify(t.read(()=>o.exportJSON())):!1}function Mw(n,e){let t=Date.now(),r=Ut;return(o,s,i,l,c,a)=>{const f=Date.now();if(a.has("historic"))return r=Ut,t=f,Du;const d=Ow(o,s,l,c,n.isComposing()),u=(()=>{const h=i===null||i.editor===n,g=a.has("history-push");if(!g&&h&&a.has("history-merge"))return jl;if(o===null)return Mu;const _=s._selection;if(!(l.size>0||c.size>0))return _!==null?jl:Du;if(g===!1&&d!==Ut&&d===r&&f<t+e&&h)return jl;if(l.size===1){const m=Array.from(l)[0];if(vw(m,o,s))return jl}return Mu})();return t=f,r=d,u}}function Dw(n,e){const t=e.redoStack,r=e.undoStack;if(t.length!==0){const o=e.current;o!==null&&(r.push(o),n.dispatchCommand(yn,!0));const s=t.pop();t.length===0&&n.dispatchCommand(mn,!1),e.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:"historic"})}}function Aw(n,e){const t=e.redoStack,r=e.undoStack;if(r.length!==0){const s=e.current,i=r.pop();s!==null&&(t.push(s),n.dispatchCommand(mn,!0)),r.length===0&&n.dispatchCommand(yn,!1),e.current=i||null,i&&i.editor.setEditorState(i.editorState,{tag:"historic"})}}function I_(n){n.undoStack=[],n.redoStack=[],n.current=null}function kw(n,e,t){const r=Mw(n,t),o=({editorState:i,prevEditorState:l,dirtyLeaves:c,dirtyElements:a,tags:f})=>{const d=e.current,u=e.redoStack,h=e.undoStack,g=d===null?null:d.editorState;if(d!==null&&i===g)return;const p=r(l,i,d,c,a,f);if(p===Mu)u.length!==0&&(e.redoStack=[],n.dispatchCommand(mn,!1)),d!==null&&(h.push({...d}),n.dispatchCommand(yn,!0));else if(p===Du)return;e.current={editor:n,editorState:i}};return Nn(n.registerCommand(Su,()=>(Aw(n,e),!0),V),n.registerCommand(Nu,()=>(Dw(n,e),!0),V),n.registerCommand(bp,()=>(I_(e),!1),V),n.registerCommand(Op,()=>(I_(e),n.dispatchCommand(mn,!1),n.dispatchCommand(yn,!1),!0),V),n.registerUpdateListener(o))}function Rw(){return{current:null,redoStack:[],undoStack:[]}}const $w=Object.freeze(Object.defineProperty({__proto__:null,createEmptyHistoryState:Rw,registerHistory:kw},Symbol.toStringTag,{value:"Module"})),Ul=0,Au=1,ku=2,Ht=0,Pw=1,L_=2,Iw=3,Lw=4;function Fw(n,e,t,r,o){if(n===null||t.size===0&&r.size===0&&!o)return Ht;const s=e._selection,i=n._selection;if(o)return Pw;if(!(v(s)&&v(i)&&i.isCollapsed()&&s.isCollapsed()))return Ht;const l=function(y,m,C){const N=y._nodeMap,S=[];for(const T of m){const E=N.get(T);E!==void 0&&S.push(E)}for(const[T,E]of C){if(!E)continue;const x=N.get(T);x===void 0||Yn(x)||S.push(x)}return S}(e,t,r);if(l.length===0)return Ht;if(l.length>1){const y=e._nodeMap,m=y.get(s.anchor.key),C=y.get(i.anchor.key);return m&&C&&!n._nodeMap.has(m.__key)&&L(m)&&m.__text.length===1&&s.anchor.offset===1?L_:Ht}const c=l[0],a=n._nodeMap.get(c.__key);if(!L(a)||!L(c)||a.__mode!==c.__mode)return Ht;const f=a.__text,d=c.__text;if(f===d)return Ht;const u=s.anchor,h=i.anchor;if(u.key!==h.key||u.type!=="text")return Ht;const g=u.offset,p=h.offset,_=d.length-f.length;return _===1&&p===g-1?L_:_===-1&&p===g+1?Iw:_===-1&&p===g?Lw:Ht}function Bw(n,e){let t=Date.now(),r=Ht;return(o,s,i,l,c,a)=>{const f=Date.now();if(a.has("historic"))return r=Ht,t=f,ku;const d=Fw(o,s,l,c,n.isComposing()),u=(()=>{const h=i===null||i.editor===n,g=a.has("history-push");if(!g&&h&&a.has("history-merge"))return Ul;if(o===null)return Au;const p=s._selection;return l.size>0||c.size>0?g===!1&&d!==Ht&&d===r&&f<t+e&&h||l.size===1&&function(_,y,m){const C=y._nodeMap.get(_),N=m._nodeMap.get(_),S=y._selection,T=m._selection;return!(v(S)&&v(T)&&S.anchor.type==="element"&&S.focus.type==="element"&&T.anchor.type==="text"&&T.focus.type==="text"||!L(C)||!L(N)||C.__parent!==N.__parent)&&JSON.stringify(y.read(()=>C.exportJSON()))===JSON.stringify(m.read(()=>N.exportJSON()))}(Array.from(l)[0],o,s)?Ul:Au:p!==null?Ul:ku})();return t=f,r=d,u}}function F_(n){n.undoStack=[],n.redoStack=[],n.current=null}function Kw(n,e,t){const r=Bw(n,t);return Nn(n.registerCommand(Su,()=>(function(s,i){const l=i.redoStack,c=i.undoStack;if(c.length!==0){const a=i.current,f=c.pop();a!==null&&(l.push(a),s.dispatchCommand(mn,!0)),c.length===0&&s.dispatchCommand(yn,!1),i.current=f||null,f&&f.editor.setEditorState(f.editorState,{tag:"historic"})}}(n,e),!0),V),n.registerCommand(Nu,()=>(function(s,i){const l=i.redoStack,c=i.undoStack;if(l.length!==0){const a=i.current;a!==null&&(c.push(a),s.dispatchCommand(yn,!0));const f=l.pop();l.length===0&&s.dispatchCommand(mn,!1),i.current=f||null,f&&f.editor.setEditorState(f.editorState,{tag:"historic"})}}(n,e),!0),V),n.registerCommand(bp,()=>(F_(e),!1),V),n.registerCommand(Op,()=>(F_(e),n.dispatchCommand(mn,!1),n.dispatchCommand(yn,!1),!0),V),n.registerUpdateListener(({editorState:s,prevEditorState:i,dirtyLeaves:l,dirtyElements:c,tags:a})=>{const f=e.current,d=e.redoStack,u=e.undoStack,h=f===null?null:f.editorState;if(f!==null&&s===h)return;const g=r(i,s,f,l,c,a);if(g===Au)d.length!==0&&(e.redoStack=[],n.dispatchCommand(mn,!1)),f!==null&&(u.push({...f}),n.dispatchCommand(yn,!0));else if(g===ku)return;e.current={editor:n,editorState:s}}))}function Ww(){return{current:null,redoStack:[],undoStack:[]}}const zw=Object.freeze(Object.defineProperty({__proto__:null,createEmptyHistoryState:Ww,registerHistory:Kw},Symbol.toStringTag,{value:"Module"})),B_=process.env.NODE_ENV==="development"?$w:zw,jw=B_.createEmptyHistoryState,Uw=B_.registerHistory;function Hw({delay:n,externalHistoryState:e}){const[t]=Xn();return function(r,o,s=1e3){const i=I.useMemo(()=>o||jw(),[o]);I.useEffect(()=>Uw(r,i,s),[s,r,i])}(t,e,n),null}const Yw=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?I.useLayoutEffect:I.useEffect;function Jw(n){return{initialValueFn:()=>n.isEditable(),subscribe:e=>n.registerEditableListener(e)}}function Vw(){return function(n){const[e]=Xn(),t=I.useMemo(()=>n(e),[e,n]),r=I.useRef(t.initialValueFn()),[o,s]=I.useState(r.current);return Yw(()=>{const{initialValueFn:i,subscribe:l}=t,c=i();return r.current!==c&&(r.current=c,s(c)),l(a=>{r.current=a,s(a)})},[t,n]),o}(Jw)}function Gw(n){const e=window.location.origin,t=r=>{if(r.origin!==e)return;const o=n.getRootElement();if(document.activeElement!==o)return;const s=r.data;if(typeof s=="string"){let i;try{i=JSON.parse(s)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){const l=i.payload;if(l&&l.functionId==="makeChanges"){const c=l.args;if(c){const[a,f,d,u,h,g]=c;n.update(()=>{const p=M();if(v(p)){const _=p.anchor;let y=_.getNode(),m=0,C=0;if(L(y)&&a>=0&&f>=0&&(m=a,C=a+f,p.setTextNodeRange(y,m,y,C)),(m!==C||d!=="")&&(p.insertRawText(d),y=_.getNode()),L(y)){m=u,C=u+h;const N=y.getTextContentSize();m=m>N?N:m,C=C>N?N:C,p.setTextNodeRange(y,m,y,C)}r.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}const Xw=Object.freeze(Object.defineProperty({__proto__:null,registerDragonSupport:Gw},Symbol.toStringTag,{value:"Module"}));function qw(n){const e=window.location.origin,t=r=>{if(r.origin!==e)return;const o=n.getRootElement();if(document.activeElement!==o)return;const s=r.data;if(typeof s=="string"){let i;try{i=JSON.parse(s)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){const l=i.payload;if(l&&l.functionId==="makeChanges"){const c=l.args;if(c){const[a,f,d,u,h,g]=c;n.update(()=>{const p=M();if(v(p)){const _=p.anchor;let y=_.getNode(),m=0,C=0;if(L(y)&&a>=0&&f>=0&&(m=a,C=a+f,p.setTextNodeRange(y,m,y,C)),m===C&&d===""||(p.insertRawText(d),y=_.getNode()),L(y)){m=u,C=u+h;const N=y.getTextContentSize();m=m>N?N:m,C=C>N?N:C,p.setTextNodeRange(y,m,y,C)}r.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}const Qw=Object.freeze(Object.defineProperty({__proto__:null,registerDragonSupport:qw},Symbol.toStringTag,{value:"Module"})),Zw=(process.env.NODE_ENV==="development"?Xw:Qw).registerDragonSupport;function eb(n,e){const t=e.body?e.body.childNodes:[];let r=[];const o=[];for(let s=0;s<t.length;s++){const i=t[s];if(!W_.has(i.nodeName)){const l=z_(i,n,o,!1);l!==null&&(r=r.concat(l))}}return rb(o),r}function tb(n,e){if(typeof document>"u"||typeof window>"u"&&typeof global.window>"u")throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),o=Oe().getChildren();for(let s=0;s<o.length;s++){const i=o[s];K_(n,i,t,e)}return t.innerHTML}function K_(n,e,t,r=null){let o=r!==null?e.isSelected(r):!0;const s=A(e)&&e.excludeFromCopy("html");let i=e;if(r!==null){let h=Un(e);h=L(h)&&r!==null?Kl(r,h):h,i=h}const l=A(i)?i.getChildren():[],c=n._nodes.get(i.getType());let a;c&&c.exportDOM!==void 0?a=c.exportDOM(n,i):a=i.exportDOM(n);const{element:f,after:d}=a;if(!f)return!1;const u=document.createDocumentFragment();for(let h=0;h<l.length;h++){const g=l[h],p=K_(n,g,u,r);!o&&A(e)&&p&&e.extractWithChild(g,r,"html")&&(o=!0)}if(o&&!s){if(qn(f)&&f.append(u),t.append(f),d){const h=d.call(i,f);h&&f.replaceWith(h)}}else t.append(u);return o}function nb(n,e){const{nodeName:t}=n,r=e._htmlConversions.get(t.toLowerCase());let o=null;if(r!==void 0)for(const s of r){const i=s(n);i!==null&&(o===null||(o.priority||0)<(i.priority||0))&&(o=i)}return o!==null?o.conversion:null}const W_=new Set(["STYLE","SCRIPT"]);function z_(n,e,t,r,o=new Map,s){let i=[];if(W_.has(n.nodeName))return i;let l=null;const c=nb(n,e),a=c?c(n):null;let f=null;if(a!==null){f=a.after;const g=a.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,p]of o)if(l=p(l,s),!l)break;l&&i.push(...Array.isArray(g)?g:[l])}a.forChild!=null&&o.set(n.nodeName,a.forChild)}const d=n.childNodes;let u=[];const h=l!=null&&it(l)?!1:l!=null&&qr(l)||r;for(let g=0;g<d.length;g++)u.push(...z_(d[g],e,t,h,new Map(o),l));return f!=null&&(u=f(u)),Wl(n)&&(h?u=j_(n,u,()=>{const g=new yl;return t.push(g),g}):u=j_(n,u,ie)),l==null?u.length>0?i=i.concat(u):Wl(n)&&ob(n)&&(i=i.concat(ul())):A(l)&&l.append(...u),i}function j_(n,e,t){const r=n.style.textAlign,o=[];let s=[];for(let i=0;i<e.length;i++){const l=e[i];if(qr(l))r&&!l.getFormat()&&l.setFormat(r),o.push(l);else if(s.push(l),i===e.length-1||i<e.length-1&&qr(e[i+1])){const c=t();c.setFormat(r),c.append(...s),o.push(c),s=[]}}return o}function rb(n){for(const e of n)e.getNextSibling()instanceof yl&&e.insertAfter(ul());for(const e of n){const t=e.getChildren();for(const r of t)e.insertBefore(r);e.remove()}}function ob(n){return n.nextSibling==null||n.previousSibling==null?!1:ro(n.nextSibling)&&ro(n.previousSibling)}const sb=Object.freeze(Object.defineProperty({__proto__:null,$generateHtmlFromNodes:tb,$generateNodesFromDOM:eb},Symbol.toStringTag,{value:"Module"}));function ib(n,e){const t=e.body?e.body.childNodes:[];let r=[];const o=[];for(let s=0;s<t.length;s++){const i=t[s];if(!H_.has(i.nodeName)){const l=Y_(i,n,o,!1);l!==null&&(r=r.concat(l))}}return function(s){for(const i of s)i.getNextSibling()instanceof yl&&i.insertAfter(ul());for(const i of s){const l=i.getChildren();for(const c of l)i.insertBefore(c);i.remove()}}(o),r}function lb(n,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),r=Oe().getChildren();for(let o=0;o<r.length;o++)U_(n,r[o],t,e);return t.innerHTML}function U_(n,e,t,r=null){let o=r===null||e.isSelected(r);const s=A(e)&&e.excludeFromCopy("html");let i=e;if(r!==null){let h=Un(e);h=L(h)&&r!==null?Kl(r,h):h,i=h}const l=A(i)?i.getChildren():[],c=n._nodes.get(i.getType());let a;a=c&&c.exportDOM!==void 0?c.exportDOM(n,i):i.exportDOM(n);const{element:f,after:d}=a;if(!f)return!1;const u=document.createDocumentFragment();for(let h=0;h<l.length;h++){const g=l[h],p=U_(n,g,u,r);!o&&A(e)&&p&&e.extractWithChild(g,r,"html")&&(o=!0)}if(o&&!s){if(qn(f)&&f.append(u),t.append(f),d){const h=d.call(i,f);h&&f.replaceWith(h)}}else t.append(u);return o}const H_=new Set(["STYLE","SCRIPT"]);function Y_(n,e,t,r,o=new Map,s){let i=[];if(H_.has(n.nodeName))return i;let l=null;const c=function(g,p){const{nodeName:_}=g,y=p._htmlConversions.get(_.toLowerCase());let m=null;if(y!==void 0)for(const C of y){const N=C(g);N!==null&&(m===null||(m.priority||0)<(N.priority||0))&&(m=N)}return m!==null?m.conversion:null}(n,e),a=c?c(n):null;let f=null;if(a!==null){f=a.after;const g=a.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,p]of o)if(l=p(l,s),!l)break;l&&i.push(...Array.isArray(g)?g:[l])}a.forChild!=null&&o.set(n.nodeName,a.forChild)}const d=n.childNodes;let u=[];const h=(l==null||!it(l))&&(l!=null&&qr(l)||r);for(let g=0;g<d.length;g++)u.push(...Y_(d[g],e,t,h,new Map(o),l));return f!=null&&(u=f(u)),Wl(n)&&(u=cb(n,u,h?()=>{const g=new yl;return t.push(g),g}:ie)),l==null?u.length>0?i=i.concat(u):Wl(n)&&function(g){return g.nextSibling==null||g.previousSibling==null?!1:ro(g.nextSibling)&&ro(g.previousSibling)}(n)&&(i=i.concat(ul())):A(l)&&l.append(...u),i}function cb(n,e,t){const r=n.style.textAlign,o=[];let s=[];for(let i=0;i<e.length;i++){const l=e[i];if(qr(l))r&&!l.getFormat()&&l.setFormat(r),o.push(l);else if(s.push(l),i===e.length-1||i<e.length-1&&qr(e[i+1])){const c=t();c.setFormat(r),c.append(...s),o.push(c),s=[]}}return o}const ab=Object.freeze(Object.defineProperty({__proto__:null,$generateHtmlFromNodes:lb,$generateNodesFromDOM:ib},Symbol.toStringTag,{value:"Module"})),J_=process.env.NODE_ENV==="development"?sb:ab,Hl=J_.$generateHtmlFromNodes,V_=J_.$generateNodesFromDOM,ub=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",G_=n=>ub?(n||window).getSelection():null;function X_(n,e=M()){if(e==null)throw Error("Expected valid LexicalSelection");return v(e)&&e.isCollapsed()||e.getNodes().length===0?"":Hl(n,e)}function q_(n,e=M()){if(e==null)throw Error("Expected valid LexicalSelection");return v(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(Z_(n,e))}function fb(n,e){const t=n.getData("text/plain")||n.getData("text/uri-list");t!=null&&e.insertRawText(t)}function db(n,e,t){const r=n.getData("application/x-lexical-editor");if(r)try{const i=JSON.parse(r);if(i.namespace===t._config.namespace&&Array.isArray(i.nodes)){const l=em(i.nodes);return Ru(t,l,e)}}catch{}const o=n.getData("text/html");if(o)try{const l=new DOMParser().parseFromString(o,"text/html"),c=V_(t,l);return Ru(t,c,e)}catch{}const s=n.getData("text/plain")||n.getData("text/uri-list");if(s!=null)if(v(e)){const i=s.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let l=0;l<i.length;l++){const c=M();if(v(c)){const a=i[l];a===`
36
36
  `||a===`\r
37
- `?c.insertParagraph():a===" "?c.insertNodes([gl()]):c.insertText(a)}}}else e.insertRawText(s)}function Ru(n,e,t){n.dispatchCommand(Rl,{nodes:e,selection:t})||t.insertNodes(e)}function db(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType())throw Error(`LexicalNode: Node ${t.name} does not implement .exportJSON().`);if(A(n)){const o=e.children;if(!Array.isArray(o))throw Error(`LexicalNode: Node ${t.name} is an element but .exportJSON() does not have a children array.`)}return e}function X_(n,e,t,o=[]){let r=e!==null?t.isSelected(e):!0;const s=A(t)&&t.excludeFromCopy("html");let i=t;if(e!==null){let a=jn(t);a=L(a)&&e!==null?Wl(e,a):a,i=a}const l=A(i)?i.getChildren():[],c=db(i);if(L(i)){const a=i.__text;a.length>0?c.text=a:r=!1}for(let a=0;a<l.length;a++){const f=l[a],d=X_(n,e,f,c.children);!r&&A(t)&&d&&t.extractWithChild(f,e,"clone")&&(r=!0)}if(r&&!s)o.push(c);else if(Array.isArray(c.children))for(let a=0;a<c.children.length;a++){const f=c.children[a];o.push(f)}return r}function q_(n,e){const t=[],r=Oe().getChildren();for(let s=0;s<r.length;s++){const i=r[s];X_(n,e,i,t)}return{namespace:n._config.namespace,nodes:t}}function Q_(n){const e=[];for(let t=0;t<n.length;t++){const o=n[t],r=Tp(o);L(r)&&h_(r),e.push(r)}return e}const hb=50;let ir=null;async function gb(n,e,t){if(ir!==null)return!1;if(e!==null)return new Promise((c,a)=>{n.update(()=>{c(Z_(n,e,t))})});const o=n.getRootElement(),r=n._window==null?window.document:n._window.document,s=J_(n._window);if(o===null||s===null)return!1;const i=r.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(r.createTextNode("#")),o.append(i);const l=new Range;return l.setStart(i,0),l.setEnd(i,1),s.removeAllRanges(),s.addRange(l),new Promise((c,a)=>{const f=n.registerCommand(Sl,d=>(lt(d,ClipboardEvent)&&(f(),ir!==null&&(window.clearTimeout(ir),ir=null),c(Z_(n,d,t))),!0),ye);ir=window.setTimeout(()=>{f(),ir=null,c(!1)},hb),r.execCommand("copy"),i.remove()})}function Z_(n,e,t){if(t===void 0){const r=J_(n._window);if(!r)return!1;const s=r.anchorNode,i=r.focusNode;if(s!==null&&i!==null&&!Up(n,s,i))return!1;const l=M();if(l===null)return!1;t=em(l)}e.preventDefault();const o=e.clipboardData;return o===null?!1:(tm(o,t),!0)}const pb=[["text/html",V_],["application/x-lexical-editor",G_]];function em(n=M()){const e={"text/plain":n?n.getTextContent():""};if(n){const t=yp();for(const[o,r]of pb){const s=r(t,n);s!==null&&(e[o]=s)}}return e}function tm(n,e){for(const t in e){const o=e[t];o!==void 0&&n.setData(t,o)}}const _b=Object.freeze(Object.defineProperty({__proto__:null,$generateJSONFromSelectedNodes:q_,$generateNodesFromSerializedNodes:Q_,$getClipboardDataFromSelection:em,$getHtmlContent:V_,$getLexicalContent:G_,$insertDataTransferForPlainText:ub,$insertDataTransferForRichText:fb,$insertGeneratedNodes:Ru,copyToClipboard:gb,setLexicalClipboardDataTransfer:tm},Symbol.toStringTag,{value:"Module"}));function mb(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Jl=mb(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const yb=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,nm=n=>yb?(n||window).getSelection():null;function om(n,e=M()){return e==null&&Jl(166),v(e)&&e.isCollapsed()||e.getNodes().length===0?"":Yl(n,e)}function rm(n,e=M()){return e==null&&Jl(166),v(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(im(n,e))}function Cb(n,e){const t=n.getData("text/plain")||n.getData("text/uri-list");t!=null&&e.insertRawText(t)}function Nb(n,e,t){const o=n.getData("application/x-lexical-editor");if(o)try{const i=JSON.parse(o);if(i.namespace===t._config.namespace&&Array.isArray(i.nodes))return $u(t,lm(i.nodes),e)}catch{}const r=n.getData("text/html");if(r)try{const i=new DOMParser().parseFromString(r,"text/html");return $u(t,Y_(t,i),e)}catch{}const s=n.getData("text/plain")||n.getData("text/uri-list");if(s!=null)if(v(e)){const i=s.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let l=0;l<i.length;l++){const c=M();if(v(c)){const a=i[l];a===`
37
+ `?c.insertParagraph():a===" "?c.insertNodes([hl()]):c.insertText(a)}}}else e.insertRawText(s)}function Ru(n,e,t){n.dispatchCommand(kl,{nodes:e,selection:t})||t.insertNodes(e)}function hb(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType())throw Error(`LexicalNode: Node ${t.name} does not implement .exportJSON().`);if(A(n)){const r=e.children;if(!Array.isArray(r))throw Error(`LexicalNode: Node ${t.name} is an element but .exportJSON() does not have a children array.`)}return e}function Q_(n,e,t,r=[]){let o=e!==null?t.isSelected(e):!0;const s=A(t)&&t.excludeFromCopy("html");let i=t;if(e!==null){let a=Un(t);a=L(a)&&e!==null?Kl(e,a):a,i=a}const l=A(i)?i.getChildren():[],c=hb(i);if(L(i)){const a=i.__text;a.length>0?c.text=a:o=!1}for(let a=0;a<l.length;a++){const f=l[a],d=Q_(n,e,f,c.children);!o&&A(t)&&d&&t.extractWithChild(f,e,"clone")&&(o=!0)}if(o&&!s)r.push(c);else if(Array.isArray(c.children))for(let a=0;a<c.children.length;a++){const f=c.children[a];r.push(f)}return o}function Z_(n,e){const t=[],o=Oe().getChildren();for(let s=0;s<o.length;s++){const i=o[s];Q_(n,e,i,t)}return{namespace:n._config.namespace,nodes:t}}function em(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t],o=Ep(r);L(o)&&p_(o),e.push(o)}return e}const gb=50;let io=null;async function pb(n,e,t){if(io!==null)return!1;if(e!==null)return new Promise((c,a)=>{n.update(()=>{c(tm(n,e,t))})});const r=n.getRootElement(),o=n._window==null?window.document:n._window.document,s=G_(n._window);if(r===null||s===null)return!1;const i=o.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(o.createTextNode("#")),r.append(i);const l=new Range;return l.setStart(i,0),l.setEnd(i,1),s.removeAllRanges(),s.addRange(l),new Promise((c,a)=>{const f=n.registerCommand(Nl,d=>(lt(d,ClipboardEvent)&&(f(),io!==null&&(window.clearTimeout(io),io=null),c(tm(n,d,t))),!0),ye);io=window.setTimeout(()=>{f(),io=null,c(!1)},gb),o.execCommand("copy"),i.remove()})}function tm(n,e,t){if(t===void 0){const o=G_(n._window);if(!o)return!1;const s=o.anchorNode,i=o.focusNode;if(s!==null&&i!==null&&!Hp(n,s,i))return!1;const l=M();if(l===null)return!1;t=nm(l)}e.preventDefault();const r=e.clipboardData;return r===null?!1:(rm(r,t),!0)}const _b=[["text/html",X_],["application/x-lexical-editor",q_]];function nm(n=M()){const e={"text/plain":n?n.getTextContent():""};if(n){const t=Np();for(const[r,o]of _b){const s=o(t,n);s!==null&&(e[r]=s)}}return e}function rm(n,e){for(const t in e){const r=e[t];r!==void 0&&n.setData(t,r)}}const mb=Object.freeze(Object.defineProperty({__proto__:null,$generateJSONFromSelectedNodes:Z_,$generateNodesFromSerializedNodes:em,$getClipboardDataFromSelection:nm,$getHtmlContent:X_,$getLexicalContent:q_,$insertDataTransferForPlainText:fb,$insertDataTransferForRichText:db,$insertGeneratedNodes:Ru,copyToClipboard:pb,setLexicalClipboardDataTransfer:rm},Symbol.toStringTag,{value:"Module"}));function yb(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Yl=yb(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const Cb=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,om=n=>Cb?(n||window).getSelection():null;function sm(n,e=M()){return e==null&&Yl(166),v(e)&&e.isCollapsed()||e.getNodes().length===0?"":Hl(n,e)}function im(n,e=M()){return e==null&&Yl(166),v(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(cm(n,e))}function Nb(n,e){const t=n.getData("text/plain")||n.getData("text/uri-list");t!=null&&e.insertRawText(t)}function Sb(n,e,t){const r=n.getData("application/x-lexical-editor");if(r)try{const i=JSON.parse(r);if(i.namespace===t._config.namespace&&Array.isArray(i.nodes))return $u(t,am(i.nodes),e)}catch{}const o=n.getData("text/html");if(o)try{const i=new DOMParser().parseFromString(o,"text/html");return $u(t,V_(t,i),e)}catch{}const s=n.getData("text/plain")||n.getData("text/uri-list");if(s!=null)if(v(e)){const i=s.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let l=0;l<i.length;l++){const c=M();if(v(c)){const a=i[l];a===`
38
38
  `||a===`\r
39
- `?c.insertParagraph():a===" "?c.insertNodes([gl()]):c.insertText(a)}}}else e.insertRawText(s)}function $u(n,e,t){n.dispatchCommand(Rl,{nodes:e,selection:t})||t.insertNodes(e)}function sm(n,e,t,o=[]){let r=e===null||t.isSelected(e);const s=A(t)&&t.excludeFromCopy("html");let i=t;if(e!==null){let a=jn(t);a=L(a)&&e!==null?Wl(e,a):a,i=a}const l=A(i)?i.getChildren():[],c=function(a){const f=a.exportJSON(),d=a.constructor;if(f.type!==d.getType()&&Jl(58,d.name),A(a)){const u=f.children;Array.isArray(u)||Jl(59,d.name)}return f}(i);if(L(i)){const a=i.__text;a.length>0?c.text=a:r=!1}for(let a=0;a<l.length;a++){const f=l[a],d=sm(n,e,f,c.children);!r&&A(t)&&d&&t.extractWithChild(f,e,"clone")&&(r=!0)}if(r&&!s)o.push(c);else if(Array.isArray(c.children))for(let a=0;a<c.children.length;a++){const f=c.children[a];o.push(f)}return r}function im(n,e){const t=[],o=Oe().getChildren();for(let r=0;r<o.length;r++)sm(n,e,o[r],t);return{namespace:n._config.namespace,nodes:t}}function lm(n){const e=[];for(let t=0;t<n.length;t++){const o=n[t],r=Tp(o);L(r)&&h_(r),e.push(r)}return e}let lr=null;async function Sb(n,e,t){if(lr!==null)return!1;if(e!==null)return new Promise((c,a)=>{n.update(()=>{c(cm(n,e,t))})});const o=n.getRootElement(),r=n._window==null?window.document:n._window.document,s=nm(n._window);if(o===null||s===null)return!1;const i=r.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(r.createTextNode("#")),o.append(i);const l=new Range;return l.setStart(i,0),l.setEnd(i,1),s.removeAllRanges(),s.addRange(l),new Promise((c,a)=>{const f=n.registerCommand(Sl,d=>(lt(d,ClipboardEvent)&&(f(),lr!==null&&(window.clearTimeout(lr),lr=null),c(cm(n,d,t))),!0),ye);lr=window.setTimeout(()=>{f(),lr=null,c(!1)},50),r.execCommand("copy"),i.remove()})}function cm(n,e,t){if(t===void 0){const r=nm(n._window);if(!r)return!1;const s=r.anchorNode,i=r.focusNode;if(s!==null&&i!==null&&!Up(n,s,i))return!1;const l=M();if(l===null)return!1;t=am(l)}e.preventDefault();const o=e.clipboardData;return o!==null&&(um(o,t),!0)}const Tb=[["text/html",om],["application/x-lexical-editor",rm]];function am(n=M()){const e={"text/plain":n?n.getTextContent():""};if(n){const t=yp();for(const[o,r]of Tb){const s=r(t,n);s!==null&&(e[o]=s)}}return e}function um(n,e){for(const t in e){const o=e[t];o!==void 0&&n.setData(t,o)}}const xb=Object.freeze(Object.defineProperty({__proto__:null,$generateJSONFromSelectedNodes:im,$generateNodesFromSerializedNodes:lm,$getClipboardDataFromSelection:am,$getHtmlContent:om,$getLexicalContent:rm,$insertDataTransferForPlainText:Cb,$insertDataTransferForRichText:Nb,$insertGeneratedNodes:$u,copyToClipboard:Sb,setLexicalClipboardDataTransfer:um},Symbol.toStringTag,{value:"Module"})),Pu=process.env.NODE_ENV==="development"?_b:xb,fm=Pu.$getClipboardDataFromSelection,Vl=Pu.$insertDataTransferForRichText,cr=Pu.copyToClipboard;function dm(n,e){if(typeof document.caretRangeFromPoint<"u"){const t=document.caretRangeFromPoint(n,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}else if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(n,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}else return null}const ar=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Eb=ar&&"documentMode"in document?document.documentMode:null,wb=ar&&"InputEvent"in window&&!Eb?"getTargetRanges"in new window.InputEvent("input"):!1,bb=ar&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Ob=ar&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,vb=ar&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Mb=ar&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!vb,Iu=nr("DRAG_DROP_PASTE_FILE");class ws extends yt{static getType(){return"quote"}static clone(e){return new ws(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return Ie(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:Ab,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&qn(t)){this.isEmpty()&&t.append(document.createElement("br"));const o=this.getFormatType();t.style.textAlign=o;const r=this.getDirection();r&&(t.dir=r)}return{element:t}}static importJSON(e){const t=Lu();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,t){const o=ie(),r=this.getDirection();return o.setDirection(r),this.insertAfter(o,t),o}collapseAtStart(){const e=ie();return this.getChildren().forEach(o=>e.append(o)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Lu(){return rt(new ws)}function Db(n){return n instanceof ws}class bs extends yt{static getType(){return"heading"}static clone(e){return new bs(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}createDOM(e){const t=this.__tag,o=document.createElement(t),s=e.theme.heading;if(s!==void 0){const i=s[t];Ie(o,i)}return o}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:ur,priority:0}),h2:e=>({conversion:ur,priority:0}),h3:e=>({conversion:ur,priority:0}),h4:e=>({conversion:ur,priority:0}),h5:e=>({conversion:ur,priority:0}),h6:e=>({conversion:ur,priority:0}),p:e=>{const o=e.firstChild;return o!==null&&hm(o)?{conversion:()=>({node:null}),priority:3}:null},span:e=>hm(e)?{conversion:t=>({node:fr("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&qn(t)){this.isEmpty()&&t.append(document.createElement("br"));const o=this.getFormatType();t.style.textAlign=o;const r=this.getDirection();r&&(t.dir=r)}return{element:t}}static importJSON(e){const t=fr(e.tag);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){const o=e?e.anchor.offset:0,r=this.getLastDescendant(),i=!r||e&&e.anchor.key===r.getKey()&&o===r.getTextContentSize()||!e?ie():fr(this.getTag()),l=this.getDirection();if(i.setDirection(l),this.insertAfter(i,t),o===0&&!this.isEmpty()&&e){const c=ie();c.select(),this.replace(c,!0)}return i}collapseAtStart(){const e=this.isEmpty()?ie():fr(this.getTag());return this.getChildren().forEach(o=>e.append(o)),this.replace(e),!0}extractWithChild(){return!0}}function hm(n){return n.nodeName.toLowerCase()==="span"?n.style.fontSize==="26pt":!1}function ur(n){const e=n.nodeName.toLowerCase();let t=null;return(e==="h1"||e==="h2"||e==="h3"||e==="h4"||e==="h5"||e==="h6")&&(t=fr(e),n.style!==null&&t.setFormat(n.style.textAlign)),{node:t}}function Ab(n){const e=Lu();return n.style!==null&&e.setFormat(n.style.textAlign),{node:e}}function fr(n){return rt(new bs(n))}function kb(n){return n instanceof bs}function Rb(n,e){n.preventDefault(),e.update(()=>{const t=M(),o=lt(n,InputEvent)||lt(n,KeyboardEvent)?null:n.clipboardData;o!=null&&t!==null&&Vl(o,t,e)},{tag:"paste"})}async function $b(n,e){await cr(e,lt(n,ClipboardEvent)?n:null),e.update(()=>{const t=M();v(t)?t.removeText():Ve(t)&&t.getNodes().forEach(o=>o.remove())})}function Os(n){let e=null;if(lt(n,DragEvent)?e=n.dataTransfer:lt(n,ClipboardEvent)&&(e=n.clipboardData),e===null)return[!1,[],!1];const t=e.types,o=t.includes("Files"),r=t.includes("text/html")||t.includes("text/plain");return[o,Array.from(e.files),r]}function gm(n){const e=M();if(!v(e))return!1;const t=new Set,o=e.getNodes();for(let r=0;r<o.length;r++){const s=o[r],i=s.getKey();if(t.has(i))continue;const l=U(s,a=>A(a)&&!a.isInline());if(l===null)continue;const c=l.getKey();l.canIndent()&&!t.has(c)&&(t.add(c),n(l))}return t.size>0}function Gl(n){const e=be(n);return st(e)}function Pb(n){const e=n.focus;return e.key==="root"&&e.offset===Oe().getChildrenSize()}function Ib(n){return Sn(n.registerCommand(bp,t=>{const o=M();return Ve(o)?(o.clear(),!0):!1},0),n.registerCommand(Jn,t=>{const o=M();return v(o)?(o.deleteCharacter(t),!0):!1},G),n.registerCommand(xl,t=>{const o=M();return v(o)?(o.deleteWord(t),!0):!1},G),n.registerCommand(Zo,t=>{const o=M();return v(o)?(o.deleteLine(t),!0):!1},G),n.registerCommand(Nl,t=>{const o=M();if(typeof t=="string")o!==null&&o.insertText(t);else{if(o===null)return!1;const r=t.dataTransfer;if(r!=null)Vl(r,o,n);else if(v(o)){const s=t.data;return s&&o.insertText(s),!0}}return!0},G),n.registerCommand(Ip,()=>{const t=M();return v(t)?(t.removeText(),!0):!1},G),n.registerCommand(Gn,t=>{const o=M();return v(o)?(o.formatText(t),!0):!1},G),n.registerCommand(Vn,t=>{const o=M();if(!v(o)&&!Ve(o))return!1;const r=o.getNodes();for(const s of r){const i=U(s,l=>A(l)&&!l.isInline());i!==null&&i.setFormat(t)}return!0},G),n.registerCommand(El,t=>{const o=M();return v(o)?(o.insertLineBreak(t),!0):!1},G),n.registerCommand(er,()=>{const t=M();return v(t)?(t.insertParagraph(),!0):!1},G),n.registerCommand(kp,()=>(Np([gl()]),!0),G),n.registerCommand(Ap,()=>gm(t=>{const o=t.getIndent();t.setIndent(o+1)}),G),n.registerCommand(kl,()=>gm(t=>{const o=t.getIndent();o>0&&t.setIndent(o-1)}),G),n.registerCommand(vl,t=>{const o=M();if(Ve(o)&&!Gl(t.target)){const r=o.getNodes();if(r.length>0)return r[0].selectPrevious(),!0}else if(v(o)){const r=Xo(o.focus,!0);if(!t.shiftKey&&st(r)&&!r.isIsolated()&&!r.isInline())return r.selectPrevious(),t.preventDefault(),!0}return!1},G),n.registerCommand(wl,t=>{const o=M();if(Ve(o)){const r=o.getNodes();if(r.length>0)return r[0].selectNext(0,0),!0}else if(v(o)){if(Pb(o))return t.preventDefault(),!0;const r=Xo(o.focus,!1);if(!t.shiftKey&&st(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),t.preventDefault(),!0}return!1},G),n.registerCommand(bl,t=>{const o=M();if(Ve(o)){const r=o.getNodes();if(r.length>0)return t.preventDefault(),r[0].selectPrevious(),!0}if(!v(o))return!1;if(Kl(o,!0)){const r=t.shiftKey;return t.preventDefault(),Bl(o,r,!0),!0}return!1},G),n.registerCommand(Ol,t=>{const o=M();if(Ve(o)&&!Gl(t.target)){const s=o.getNodes();if(s.length>0)return t.preventDefault(),s[0].selectNext(0,0),!0}if(!v(o))return!1;const r=t.shiftKey;return Kl(o,!1)?(t.preventDefault(),Bl(o,r,!1),!0):!1},G),n.registerCommand(Ml,t=>{if(Gl(t.target))return!1;const o=M();if(!v(o))return!1;t.preventDefault();const{anchor:r}=o,s=r.getNode();return o.isCollapsed()&&r.offset===0&&!Yn(s)&&M_(s).getIndent()>0?n.dispatchCommand(kl,void 0):n.dispatchCommand(Jn,!0)},G),n.registerCommand(Dl,t=>{if(Gl(t.target))return!1;const o=M();return v(o)?(t.preventDefault(),n.dispatchCommand(Jn,!1)):!1},G),n.registerCommand(Rp,t=>{const o=M();if(!v(o))return!1;if(t!==null){if((Ob||bb||Mb)&&wb)return!1;if(t.preventDefault(),t.shiftKey)return n.dispatchCommand(El,!1)}return n.dispatchCommand(er,void 0)},G),n.registerCommand(Al,()=>{const t=M();return v(t)?(n.blur(),!0):!1},G),n.registerCommand(Mp,t=>{const[,o]=Os(t);if(o.length>0){const s=t.clientX,i=t.clientY,l=dm(s,i);if(l!==null){const{offset:c,node:a}=l,f=be(a);if(f!==null){const d=hl();if(L(f))d.anchor.set(f.getKey(),c,"text"),d.focus.set(f.getKey(),c,"text");else{const h=f.getParentOrThrow().getKey(),g=f.getIndexWithinParent()+1;d.anchor.set(h,g,"element"),d.focus.set(h,g,"element")}const u=ml(d);Pe(u)}n.dispatchCommand(Iu,o)}return t.preventDefault(),!0}const r=M();return!!v(r)},G),n.registerCommand(vp,t=>{const[o]=Os(t),r=M();return!(o&&!v(r))},G),n.registerCommand(Op,t=>{const[o]=Os(t),r=M();if(o&&!v(r))return!1;const s=t.clientX,i=t.clientY,l=dm(s,i);if(l!==null){const c=be(l.node);st(c)&&t.preventDefault()}return!0},G),n.registerCommand(Lp,()=>(xp(),!0),G),n.registerCommand(Sl,t=>(cr(n,lt(t,ClipboardEvent)?t:null),!0),G),n.registerCommand(Tl,t=>($b(t,n),!0),G),n.registerCommand(Pp,t=>{const[,o,r]=Os(t);return o.length>0&&!r?(n.dispatchCommand(Iu,o),!0):zp(t.target)?!1:M()!==null?(Rb(t,n),!0):!1},G))}const Lb=Object.freeze(Object.defineProperty({__proto__:null,$createHeadingNode:fr,$createQuoteNode:Lu,$isHeadingNode:kb,$isQuoteNode:Db,DRAG_DROP_PASTE:Iu,HeadingNode:bs,QuoteNode:ws,eventFiles:Os,registerRichText:Ib},Symbol.toStringTag,{value:"Module"}));function pm(n,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(n,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(n,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const dr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Fb=dr&&"documentMode"in document?document.documentMode:null,Bb=!(!dr||!("InputEvent"in window)||Fb)&&"getTargetRanges"in new window.InputEvent("input"),Kb=dr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Wb=dr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,zb=dr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ub=dr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!zb,Fu=nr("DRAG_DROP_PASTE_FILE");class vs extends yt{static getType(){return"quote"}static clone(e){return new vs(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return Ie(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:Hb,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&qn(t)){this.isEmpty()&&t.append(document.createElement("br"));const o=this.getFormatType();t.style.textAlign=o;const r=this.getDirection();r&&(t.dir=r)}return{element:t}}static importJSON(e){const t=Bu();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,t){const o=ie(),r=this.getDirection();return o.setDirection(r),this.insertAfter(o,t),o}collapseAtStart(){const e=ie();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Bu(){return rt(new vs)}function jb(n){return n instanceof vs}class Ms extends yt{static getType(){return"heading"}static clone(e){return new Ms(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}createDOM(e){const t=this.__tag,o=document.createElement(t),r=e.theme.heading;if(r!==void 0){const s=r[t];Ie(o,s)}return o}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:hr,priority:0}),h2:e=>({conversion:hr,priority:0}),h3:e=>({conversion:hr,priority:0}),h4:e=>({conversion:hr,priority:0}),h5:e=>({conversion:hr,priority:0}),h6:e=>({conversion:hr,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&_m(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>_m(e)?{conversion:t=>({node:gr("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&qn(t)){this.isEmpty()&&t.append(document.createElement("br"));const o=this.getFormatType();t.style.textAlign=o;const r=this.getDirection();r&&(t.dir=r)}return{element:t}}static importJSON(e){const t=gr(e.tag);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){const o=e?e.anchor.offset:0,r=this.getLastDescendant(),s=!r||e&&e.anchor.key===r.getKey()&&o===r.getTextContentSize()||!e?ie():gr(this.getTag()),i=this.getDirection();if(s.setDirection(i),this.insertAfter(s,t),o===0&&!this.isEmpty()&&e){const l=ie();l.select(),this.replace(l,!0)}return s}collapseAtStart(){const e=this.isEmpty()?ie():gr(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function _m(n){return n.nodeName.toLowerCase()==="span"&&n.style.fontSize==="26pt"}function hr(n){const e=n.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=gr(e),n.style!==null&&t.setFormat(n.style.textAlign)),{node:t}}function Hb(n){const e=Bu();return n.style!==null&&e.setFormat(n.style.textAlign),{node:e}}function gr(n){return rt(new Ms(n))}function Yb(n){return n instanceof Ms}function Ds(n){let e=null;if(lt(n,DragEvent)?e=n.dataTransfer:lt(n,ClipboardEvent)&&(e=n.clipboardData),e===null)return[!1,[],!1];const t=e.types,o=t.includes("Files"),r=t.includes("text/html")||t.includes("text/plain");return[o,Array.from(e.files),r]}function mm(n){const e=M();if(!v(e))return!1;const t=new Set,o=e.getNodes();for(let r=0;r<o.length;r++){const s=o[r],i=s.getKey();if(t.has(i))continue;const l=U(s,a=>A(a)&&!a.isInline());if(l===null)continue;const c=l.getKey();l.canIndent()&&!t.has(c)&&(t.add(c),n(l))}return t.size>0}function Xl(n){const e=be(n);return st(e)}function Jb(n){return Sn(n.registerCommand(bp,e=>{const t=M();return!!Ve(t)&&(t.clear(),!0)},0),n.registerCommand(Jn,e=>{const t=M();return!!v(t)&&(t.deleteCharacter(e),!0)},G),n.registerCommand(xl,e=>{const t=M();return!!v(t)&&(t.deleteWord(e),!0)},G),n.registerCommand(Zo,e=>{const t=M();return!!v(t)&&(t.deleteLine(e),!0)},G),n.registerCommand(Nl,e=>{const t=M();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const o=e.dataTransfer;if(o!=null)Vl(o,t,n);else if(v(t)){const r=e.data;return r&&t.insertText(r),!0}}return!0},G),n.registerCommand(Ip,()=>{const e=M();return!!v(e)&&(e.removeText(),!0)},G),n.registerCommand(Gn,e=>{const t=M();return!!v(t)&&(t.formatText(e),!0)},G),n.registerCommand(Vn,e=>{const t=M();if(!v(t)&&!Ve(t))return!1;const o=t.getNodes();for(const r of o){const s=U(r,i=>A(i)&&!i.isInline());s!==null&&s.setFormat(e)}return!0},G),n.registerCommand(El,e=>{const t=M();return!!v(t)&&(t.insertLineBreak(e),!0)},G),n.registerCommand(er,()=>{const e=M();return!!v(e)&&(e.insertParagraph(),!0)},G),n.registerCommand(kp,()=>(Np([gl()]),!0),G),n.registerCommand(Ap,()=>mm(e=>{const t=e.getIndent();e.setIndent(t+1)}),G),n.registerCommand(kl,()=>mm(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),G),n.registerCommand(vl,e=>{const t=M();if(Ve(t)&&!Xl(e.target)){const o=t.getNodes();if(o.length>0)return o[0].selectPrevious(),!0}else if(v(t)){const o=Xo(t.focus,!0);if(!e.shiftKey&&st(o)&&!o.isIsolated()&&!o.isInline())return o.selectPrevious(),e.preventDefault(),!0}return!1},G),n.registerCommand(wl,e=>{const t=M();if(Ve(t)){const o=t.getNodes();if(o.length>0)return o[0].selectNext(0,0),!0}else if(v(t)){if(function(r){const s=r.focus;return s.key==="root"&&s.offset===Oe().getChildrenSize()}(t))return e.preventDefault(),!0;const o=Xo(t.focus,!1);if(!e.shiftKey&&st(o)&&!o.isIsolated()&&!o.isInline())return o.selectNext(),e.preventDefault(),!0}return!1},G),n.registerCommand(bl,e=>{const t=M();if(Ve(t)){const o=t.getNodes();if(o.length>0)return e.preventDefault(),o[0].selectPrevious(),!0}if(!v(t))return!1;if(Kl(t,!0)){const o=e.shiftKey;return e.preventDefault(),Bl(t,o,!0),!0}return!1},G),n.registerCommand(Ol,e=>{const t=M();if(Ve(t)&&!Xl(e.target)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectNext(0,0),!0}if(!v(t))return!1;const o=e.shiftKey;return!!Kl(t,!1)&&(e.preventDefault(),Bl(t,o,!1),!0)},G),n.registerCommand(Ml,e=>{if(Xl(e.target))return!1;const t=M();if(!v(t))return!1;e.preventDefault();const{anchor:o}=t,r=o.getNode();return t.isCollapsed()&&o.offset===0&&!Yn(r)&&M_(r).getIndent()>0?n.dispatchCommand(kl,void 0):n.dispatchCommand(Jn,!0)},G),n.registerCommand(Dl,e=>{if(Xl(e.target))return!1;const t=M();return!!v(t)&&(e.preventDefault(),n.dispatchCommand(Jn,!1))},G),n.registerCommand(Rp,e=>{const t=M();if(!v(t))return!1;if(e!==null){if((Wb||Kb||Ub)&&Bb)return!1;if(e.preventDefault(),e.shiftKey)return n.dispatchCommand(El,!1)}return n.dispatchCommand(er,void 0)},G),n.registerCommand(Al,()=>{const e=M();return!!v(e)&&(n.blur(),!0)},G),n.registerCommand(Mp,e=>{const[,t]=Ds(e);if(t.length>0){const r=pm(e.clientX,e.clientY);if(r!==null){const{offset:s,node:i}=r,l=be(i);if(l!==null){const c=hl();if(L(l))c.anchor.set(l.getKey(),s,"text"),c.focus.set(l.getKey(),s,"text");else{const f=l.getParentOrThrow().getKey(),d=l.getIndexWithinParent()+1;c.anchor.set(f,d,"element"),c.focus.set(f,d,"element")}const a=ml(c);Pe(a)}n.dispatchCommand(Fu,t)}return e.preventDefault(),!0}const o=M();return!!v(o)},G),n.registerCommand(vp,e=>{const[t]=Ds(e),o=M();return!(t&&!v(o))},G),n.registerCommand(Op,e=>{const[t]=Ds(e),o=M();if(t&&!v(o))return!1;const r=pm(e.clientX,e.clientY);if(r!==null){const s=be(r.node);st(s)&&e.preventDefault()}return!0},G),n.registerCommand(Lp,()=>(xp(),!0),G),n.registerCommand(Sl,e=>(cr(n,lt(e,ClipboardEvent)?e:null),!0),G),n.registerCommand(Tl,e=>(async function(t,o){await cr(o,lt(t,ClipboardEvent)?t:null),o.update(()=>{const r=M();v(r)?r.removeText():Ve(r)&&r.getNodes().forEach(s=>s.remove())})}(e,n),!0),G),n.registerCommand(Pp,e=>{const[,t,o]=Ds(e);return t.length>0&&!o?(n.dispatchCommand(Fu,t),!0):zp(e.target)?!1:M()!==null&&(function(r,s){r.preventDefault(),s.update(()=>{const i=M(),l=lt(r,InputEvent)||lt(r,KeyboardEvent)?null:r.clipboardData;l!=null&&i!==null&&Vl(l,i,s)},{tag:"paste"})}(e,n),!0)},G))}const Vb=Object.freeze(Object.defineProperty({__proto__:null,$createHeadingNode:gr,$createQuoteNode:Bu,$isHeadingNode:Yb,$isQuoteNode:jb,DRAG_DROP_PASTE:Fu,HeadingNode:Ms,QuoteNode:vs,eventFiles:Ds,registerRichText:Jb},Symbol.toStringTag,{value:"Module"})),Gb=(process.env.NODE_ENV==="development"?Lb:Vb).registerRichText,Ku=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?I.useLayoutEffect:I.useEffect;function ym(n){return n.getEditorState().read(Xp(n.isComposing()))}function Xb({contentEditable:n,placeholder:e=null,ErrorBoundary:t}){const[o]=Xn(),r=function(s,i){const[l,c]=I.useState(()=>s.getDecorators());return Ku(()=>s.registerDecoratorListener(a=>{mf.flushSync(()=>{c(a)})}),[s]),I.useEffect(()=>{c(s.getDecorators())},[s]),I.useMemo(()=>{const a=[],f=Object.keys(l);for(let d=0;d<f.length;d++){const u=f[d],h=W.exports.jsx(i,{onError:p=>s._onError(p),children:W.exports.jsx(I.Suspense,{fallback:null,children:l[u]})}),g=s.getElementByKey(u);g!==null&&a.push(mf.createPortal(h,g,u))}return a},[i,l,s])}(o,t);return function(s){Ku(()=>Sn(Gb(s),Qw(s)),[s])}(o),W.exports.jsxs(W.exports.Fragment,{children:[n,W.exports.jsx(qb,{content:e}),r]})}function qb({content:n}){const[e]=Xn(),t=function(r){const[s,i]=I.useState(()=>ym(r));return Ku(()=>{function l(){const c=ym(r);i(c)}return l(),Sn(r.registerUpdateListener(()=>{l()}),r.registerEditableListener(()=>{l()}))},[r]),s}(e),o=Jw();return t?typeof n=="function"?n(o):n:null}function Wu(n,e){return Wu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,o){return t.__proto__=o,t},Wu(n,e)}var Cm={error:null},Qb=function(n){var e,t;function o(){for(var s,i=arguments.length,l=new Array(i),c=0;c<i;c++)l[c]=arguments[c];return(s=n.call.apply(n,[this].concat(l))||this).state=Cm,s.resetErrorBoundary=function(){for(var a,f=arguments.length,d=new Array(f),u=0;u<f;u++)d[u]=arguments[u];s.props.onReset==null||(a=s.props).onReset.apply(a,d),s.reset()},s}t=n,(e=o).prototype=Object.create(t.prototype),e.prototype.constructor=e,Wu(e,t),o.getDerivedStateFromError=function(s){return{error:s}};var r=o.prototype;return r.reset=function(){this.setState(Cm)},r.componentDidCatch=function(s,i){var l,c;(l=(c=this.props).onError)==null||l.call(c,s,i)},r.componentDidUpdate=function(s,i){var l,c,a,f,d=this.state.error,u=this.props.resetKeys;d!==null&&i.error!==null&&((a=s.resetKeys)===void 0&&(a=[]),(f=u)===void 0&&(f=[]),a.length!==f.length||a.some(function(h,g){return!Object.is(h,f[g])}))&&((l=(c=this.props).onResetKeysChange)==null||l.call(c,s.resetKeys,u),this.reset())},r.render=function(){var s=this.state.error,i=this.props,l=i.fallbackRender,c=i.FallbackComponent,a=i.fallback;if(s!==null){var f={error:s,resetErrorBoundary:this.resetErrorBoundary};if(Ys.isValidElement(a))return a;if(typeof l=="function")return l(f);if(c)return Ys.createElement(c,f);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},o}(Ys.Component);function Zb({children:n,onError:e}){return W.exports.jsx(Qb,{fallback:W.exports.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:n})}const eO={code:"editor-code",heading:{h1:"editor-heading-h1",h2:"editor-heading-h2",h3:"editor-heading-h3",h4:"editor-heading-h4",h5:"editor-heading-h5"},image:"editor-image",link:"editor-link",list:{listitem:"editor-listitem",nested:{listitem:"editor-nested-listitem"},ol:"editor-list-ol",ul:"editor-list-ul"},ltr:"ltr",paragraph:"editor-paragraph",placeholder:"editor-placeholder",quote:"editor-quote",rtl:"rtl",text:{bold:"editor-text-bold",code:"editor-text-code",hashtag:"editor-text-hashtag",italic:"editor-text-italic",overflowed:"editor-text-overflowed",strikethrough:"editor-text-strikethrough",underline:"editor-text-underline",underlineStrikethrough:"editor-text-underlineStrikethrough"}},zu=1;function Nm(){return W.exports.jsx("div",{className:"divider"})}function tO(){const[n]=Xn(),e=I.useRef(null),[t,o]=I.useState(!1),[r,s]=I.useState(!1),[i,l]=I.useState(!1),[c,a]=I.useState(!1),[f,d]=I.useState(!1),[u,h]=I.useState(!1),g=I.useCallback(()=>{const p=M();v(p)&&(l(p.hasFormat("bold")),a(p.hasFormat("italic")),d(p.hasFormat("underline")),h(p.hasFormat("strikethrough")))},[]);return I.useEffect(()=>Sn(n.registerUpdateListener(({editorState:p})=>{p.read(()=>{g()})}),n.registerCommand(zt,(p,_)=>(g(),!1),zu),n.registerCommand(Cn,p=>(o(p),!1),zu),n.registerCommand(yn,p=>(s(p),!1),zu)),[n,g]),W.exports.jsxs("div",{className:"toolbar",ref:e,children:[W.exports.jsxs("button",{disabled:!t,onClick:()=>{n.dispatchCommand(Su,void 0)},className:"toolbar-item spaced","aria-label":"Undo",children:[W.exports.jsx("i",{className:"format undo"}),"Undo"]}),W.exports.jsxs("button",{disabled:!r,onClick:()=>{n.dispatchCommand(Nu,void 0)},className:"toolbar-item","aria-label":"Redo",children:[W.exports.jsx("i",{className:"format redo"}),"Redo"]}),W.exports.jsx(Nm,{}),W.exports.jsxs("button",{onClick:()=>{n.dispatchCommand(Gn,"bold")},className:"toolbar-item spaced "+(i?"active":""),"aria-label":"Format Bold",children:[W.exports.jsx("i",{className:"format bold"}),"Bold"]}),W.exports.jsxs("button",{onClick:()=>{n.dispatchCommand(Gn,"italic")},className:"toolbar-item spaced "+(c?"active":""),"aria-label":"Format Italics",children:[W.exports.jsx("i",{className:"format italic"}),"Italic"]}),W.exports.jsxs("button",{onClick:()=>{n.dispatchCommand(Gn,"underline")},className:"toolbar-item spaced "+(f?"active":""),"aria-label":"Format Underline",children:[W.exports.jsx("i",{className:"format underline"}),"Underline"]}),W.exports.jsxs("button",{onClick:()=>{n.dispatchCommand(Gn,"strikethrough")},className:"toolbar-item spaced "+(u?"active":""),"aria-label":"Format Strikethrough",children:[W.exports.jsx("i",{className:"format strikethrough"}),"Strikethrough"]}),W.exports.jsx(Nm,{}),W.exports.jsxs("button",{onClick:()=>{n.dispatchCommand(Vn,"left")},className:"toolbar-item spaced","aria-label":"Left Align",children:[W.exports.jsx("i",{className:"format left-align"}),"Left align"]}),W.exports.jsxs("button",{onClick:()=>{n.dispatchCommand(Vn,"center")},className:"toolbar-item spaced","aria-label":"Center Align",children:[W.exports.jsx("i",{className:"format center-align"}),"center align"]}),W.exports.jsxs("button",{onClick:()=>{n.dispatchCommand(Vn,"right")},className:"toolbar-item spaced","aria-label":"Right Align",children:[W.exports.jsx("i",{className:"format right-align"}),"right align"]}),W.exports.jsx("button",{onClick:()=>{n.dispatchCommand(Vn,"justify")},className:"toolbar-item","aria-label":"Justify Align",children:W.exports.jsx("i",{className:"format justify-align"})})," "]})}const nO=new Set(["http:","https:","mailto:","sms:","tel:"]);class pr extends yt{static getType(){return"link"}static clone(e){return new pr(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},o){super(o);const{target:r=null,rel:s=null,title:i=null}=t;this.__url=e,this.__target=r,this.__rel=s,this.__title=i}createDOM(e){const t=document.createElement("a");return t.href=this.sanitizeUrl(this.__url),this.__target!==null&&(t.target=this.__target),this.__rel!==null&&(t.rel=this.__rel),this.__title!==null&&(t.title=this.__title),Ie(t,e.theme.link),t}updateDOM(e,t,o){if(t instanceof HTMLAnchorElement){const r=this.__url,s=this.__target,i=this.__rel,l=this.__title;r!==e.__url&&(t.href=r),s!==e.__target&&(s?t.target=s:t.removeAttribute("target")),i!==e.__rel&&(i?t.rel=i:t.removeAttribute("rel")),l!==e.__title&&(l?t.title=l:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:oO,priority:1})}}static importJSON(e){const t=As(e.url,{rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}sanitizeUrl(e){try{const t=new URL(e);if(!nO.has(t.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){const t=this.getWritable();t.__url=e}getTarget(){return this.getLatest().__target}setTarget(e){const t=this.getWritable();t.__target=e}getRel(){return this.getLatest().__rel}setRel(e){const t=this.getWritable();t.__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){const t=this.getWritable();t.__title=e}insertNewAfter(e,t=!0){const o=As(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(o,t),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,o){if(!v(t))return!1;const r=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(s)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function oO(n){let e=null;if(D_(n)){const t=n.textContent;(t!==null&&t!==""||n.children.length>0)&&(e=As(n.getAttribute("href")||"",{rel:n.getAttribute("rel"),target:n.getAttribute("target"),title:n.getAttribute("title")}))}return{node:e}}function As(n,e){return rt(new pr(n,e))}function _r(n){return n instanceof pr}class ks extends pr{constructor(e,t={},o){super(e,t,o),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null?t.isUnlinked:!1}static getType(){return"autolink"}static clone(e){return new ks(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,o){return super.updateDOM(e,t,o)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){const t=Uu(e.url,{isUnlinked:e.isUnlinked,rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked,type:"autolink",version:1}}insertNewAfter(e,t=!0){const o=this.getParentOrThrow().insertNewAfter(e,t);if(A(o)){const r=Uu(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return o.append(r),r}return null}}function Uu(n,e){return rt(new ks(n,e))}function Sm(n){return n instanceof ks}const rO=nr("TOGGLE_LINK_COMMAND");function Tm(n,e={}){const{target:t,title:o}=e,r=e.rel===void 0?"noreferrer":e.rel,s=M();if(!v(s))return;const i=s.extract();if(n===null)i.forEach(l=>{const c=l.getParent();if(!Sm(c)&&_r(c)){const a=c.getChildren();for(let f=0;f<a.length;f++)c.insertBefore(a[f]);c.remove()}});else{if(i.length===1){const a=i[0],f=iO(a,_r);if(f!==null){f.setURL(n),t!==void 0&&f.setTarget(t),r!==null&&f.setRel(r),o!==void 0&&f.setTitle(o);return}}let l=null,c=null;i.forEach(a=>{const f=a.getParent();if(!(f===c||f===null||A(a)&&!a.isInline())){if(_r(f)){c=f,f.setURL(n),t!==void 0&&f.setTarget(t),r!==null&&c.setRel(r),o!==void 0&&c.setTitle(o);return}if(f.is(l)||(l=f,c=As(n,{rel:r,target:t,title:o}),_r(f)?a.getPreviousSibling()===null?f.insertBefore(c):f.insertAfter(c):a.insertBefore(c)),_r(a)){if(a.is(c))return;if(c!==null){const d=a.getChildren();for(let u=0;u<d.length;u++)c.append(d[u])}a.remove();return}c!==null&&c.append(a)}})}}const sO=Tm;function iO(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}const lO=Object.freeze(Object.defineProperty({__proto__:null,$createAutoLinkNode:Uu,$createLinkNode:As,$isAutoLinkNode:Sm,$isLinkNode:_r,$toggleLink:Tm,AutoLinkNode:ks,LinkNode:pr,TOGGLE_LINK_COMMAND:rO,toggleLink:sO},Symbol.toStringTag,{value:"Module"})),cO=new Set(["http:","https:","mailto:","sms:","tel:"]);class mr extends yt{static getType(){return"link"}static clone(e){return new mr(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},o){super(o);const{target:r=null,rel:s=null,title:i=null}=t;this.__url=e,this.__target=r,this.__rel=s,this.__title=i}createDOM(e){const t=document.createElement("a");return t.href=this.sanitizeUrl(this.__url),this.__target!==null&&(t.target=this.__target),this.__rel!==null&&(t.rel=this.__rel),this.__title!==null&&(t.title=this.__title),Ie(t,e.theme.link),t}updateDOM(e,t,o){if(t instanceof HTMLAnchorElement){const r=this.__url,s=this.__target,i=this.__rel,l=this.__title;r!==e.__url&&(t.href=r),s!==e.__target&&(s?t.target=s:t.removeAttribute("target")),i!==e.__rel&&(i?t.rel=i:t.removeAttribute("rel")),l!==e.__title&&(l?t.title=l:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:aO,priority:1})}}static importJSON(e){const t=Rs(e.url,{rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}sanitizeUrl(e){try{const t=new URL(e);if(!cO.has(t.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){this.getWritable().__title=e}insertNewAfter(e,t=!0){const o=Rs(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(o,t),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,o){if(!v(t))return!1;const r=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(s)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function aO(n){let e=null;if(D_(n)){const t=n.textContent;(t!==null&&t!==""||n.children.length>0)&&(e=Rs(n.getAttribute("href")||"",{rel:n.getAttribute("rel"),target:n.getAttribute("target"),title:n.getAttribute("title")}))}return{node:e}}function Rs(n,e){return rt(new mr(n,e))}function yr(n){return n instanceof mr}class $s extends mr{constructor(e,t={},o){super(e,t,o),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new $s(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,o){return super.updateDOM(e,t,o)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){const t=ju(e.url,{isUnlinked:e.isUnlinked,rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked,type:"autolink",version:1}}insertNewAfter(e,t=!0){const o=this.getParentOrThrow().insertNewAfter(e,t);if(A(o)){const r=ju(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return o.append(r),r}return null}}function ju(n,e){return rt(new $s(n,e))}function xm(n){return n instanceof $s}const uO=nr("TOGGLE_LINK_COMMAND");function Em(n,e={}){const{target:t,title:o}=e,r=e.rel===void 0?"noreferrer":e.rel,s=M();if(!v(s))return;const i=s.extract();if(n===null)i.forEach(l=>{const c=l.getParent();if(!xm(c)&&yr(c)){const a=c.getChildren();for(let f=0;f<a.length;f++)c.insertBefore(a[f]);c.remove()}});else{if(i.length===1){const a=function(f,d){let u=f;for(;u!==null&&u.getParent()!==null&&!d(u);)u=u.getParentOrThrow();return d(u)?u:null}(i[0],yr);if(a!==null)return a.setURL(n),t!==void 0&&a.setTarget(t),r!==null&&a.setRel(r),void(o!==void 0&&a.setTitle(o))}let l=null,c=null;i.forEach(a=>{const f=a.getParent();if(f!==c&&f!==null&&(!A(a)||a.isInline())){if(yr(f))return c=f,f.setURL(n),t!==void 0&&f.setTarget(t),r!==null&&c.setRel(r),void(o!==void 0&&c.setTitle(o));if(f.is(l)||(l=f,c=Rs(n,{rel:r,target:t,title:o}),yr(f)?a.getPreviousSibling()===null?f.insertBefore(c):f.insertAfter(c):a.insertBefore(c)),yr(a)){if(a.is(c))return;if(c!==null){const d=a.getChildren();for(let u=0;u<d.length;u++)c.append(d[u])}a.remove()}else c!==null&&c.append(a)}})}}const fO=Object.freeze(Object.defineProperty({__proto__:null,$createAutoLinkNode:ju,$createLinkNode:Rs,$isAutoLinkNode:xm,$isLinkNode:yr,$toggleLink:Em,AutoLinkNode:$s,LinkNode:mr,TOGGLE_LINK_COMMAND:uO,toggleLink:Em},Symbol.toStringTag,{value:"Module"})),wm=(process.env.NODE_ENV==="development"?lO:fO).$isLinkNode;class Ps extends yt{static getType(){return"mark"}static clone(e){return new Ps(Array.from(e.__ids),e.__key)}static importDOM(){return null}static importJSON(e){const t=ql(e.ids);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),ids:this.getIDs(),type:"mark",version:1}}constructor(e,t){super(t),this.__ids=e||[]}createDOM(e){const t=document.createElement("mark");return Ie(t,e.theme.mark),this.__ids.length>1&&Ie(t,e.theme.markOverlap),t}updateDOM(e,t,o){const r=e.__ids,s=this.__ids,i=r.length,l=s.length,c=o.theme.markOverlap;return i!==l&&(i===1?l===2&&Ie(t,c):l===1&&Ul(t,c)),!1}hasID(e){const t=this.getIDs();for(let o=0;o<t.length;o++)if(e===t[o])return!0;return!1}getIDs(){const e=this.getLatest();return mo(e)?e.__ids:[]}addID(e){const t=this.getWritable();if(mo(t)){const o=t.__ids;t.__ids=o;for(let r=0;r<o.length;r++)if(e===o[r])return;o.push(e)}}deleteID(e){const t=this.getWritable();if(mo(t)){const o=t.__ids;t.__ids=o;for(let r=0;r<o.length;r++)if(e===o[r]){o.splice(r,1);return}}}insertNewAfter(e,t=!0){const o=ql(this.__ids);return this.insertAfter(o,t),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,o){if(!v(t)||o==="html")return!1;const r=t.anchor,s=t.focus,i=r.getNode(),l=s.getNode(),a=t.isBackward()?r.offset-s.offset:s.offset-r.offset;return this.isParentOf(i)&&this.isParentOf(l)&&this.getTextContent().length===a}excludeFromCopy(e){return e!=="clone"}}function ql(n){return rt(new Ps(n))}function mo(n){return n instanceof Ps}function dO(n){const e=n.getChildren();let t=null;for(let o=0;o<e.length;o++){const r=e[o];t===null?n.insertBefore(r):t.insertAfter(r),t=r}n.remove()}function hO(n,e,t,o){const r=n.getNodes(),s=n.anchor.offset,i=n.focus.offset,l=r.length,c=e?i:s,a=e?s:i;let f,d;for(let u=0;u<l;u++){const h=r[u];if(A(d)&&d.isParentOf(h))continue;const g=u===0,p=u===l-1;let _=null;if(L(h)){const y=h.getTextContentSize(),m=g?c:0,C=p?a:y;if(m===0&&C===0)continue;const N=h.splitText(m,C);_=N.length>1&&(N.length===3||g&&!p||C===y)?N[1]:N[0]}else{if(mo(h))continue;A(h)&&h.isInline()&&(_=h)}if(_!==null){if(_&&_.is(f))continue;const y=_.getParent();(y==null||!y.is(f))&&(d=void 0),f=y,d===void 0&&(d=(o||ql)([t]),_.insertBefore(d)),d.append(_)}else f=void 0,d=void 0}A(d)&&(e?d.selectStart():d.selectEnd())}function gO(n,e){let t=n;for(;t!==null;){if(mo(t))return t.getIDs();if(L(t)&&e===t.getTextContentSize()){const o=t.getNextSibling();if(mo(o))return o.getIDs()}t=t.getParent()}return null}const pO=Object.freeze(Object.defineProperty({__proto__:null,$createMarkNode:ql,$getMarkIDs:gO,$isMarkNode:mo,$unwrapMarkNode:dO,$wrapSelectionInMarkNode:hO,MarkNode:Ps},Symbol.toStringTag,{value:"Module"}));class Is extends yt{static getType(){return"mark"}static clone(e){return new Is(Array.from(e.__ids),e.__key)}static importDOM(){return null}static importJSON(e){const t=Ql(e.ids);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),ids:this.getIDs(),type:"mark",version:1}}constructor(e,t){super(t),this.__ids=e||[]}createDOM(e){const t=document.createElement("mark");return Ie(t,e.theme.mark),this.__ids.length>1&&Ie(t,e.theme.markOverlap),t}updateDOM(e,t,o){const r=e.__ids,s=this.__ids,i=r.length,l=s.length,c=o.theme.markOverlap;return i!==l&&(i===1?l===2&&Ie(t,c):l===1&&Ul(t,c)),!1}hasID(e){const t=this.getIDs();for(let o=0;o<t.length;o++)if(e===t[o])return!0;return!1}getIDs(){const e=this.getLatest();return yo(e)?e.__ids:[]}addID(e){const t=this.getWritable();if(yo(t)){const o=t.__ids;t.__ids=o;for(let r=0;r<o.length;r++)if(e===o[r])return;o.push(e)}}deleteID(e){const t=this.getWritable();if(yo(t)){const o=t.__ids;t.__ids=o;for(let r=0;r<o.length;r++)if(e===o[r])return void o.splice(r,1)}}insertNewAfter(e,t=!0){const o=Ql(this.__ids);return this.insertAfter(o,t),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,o){if(!v(t)||o==="html")return!1;const r=t.anchor,s=t.focus,i=r.getNode(),l=s.getNode(),c=t.isBackward()?r.offset-s.offset:s.offset-r.offset;return this.isParentOf(i)&&this.isParentOf(l)&&this.getTextContent().length===c}excludeFromCopy(e){return e!=="clone"}}function Ql(n){return rt(new Is(n))}function yo(n){return n instanceof Is}function _O(n){const e=n.getChildren();let t=null;for(let o=0;o<e.length;o++){const r=e[o];t===null?n.insertBefore(r):t.insertAfter(r),t=r}n.remove()}function mO(n,e,t,o){const r=n.getNodes(),s=n.anchor.offset,i=n.focus.offset,l=r.length,c=e?i:s,a=e?s:i;let f,d;for(let u=0;u<l;u++){const h=r[u];if(A(d)&&d.isParentOf(h))continue;const g=u===0,p=u===l-1;let _=null;if(L(h)){const y=h.getTextContentSize(),m=g?c:0,C=p?a:y;if(m===0&&C===0)continue;const N=h.splitText(m,C);_=N.length>1&&(N.length===3||g&&!p||C===y)?N[1]:N[0]}else{if(yo(h))continue;A(h)&&h.isInline()&&(_=h)}if(_!==null){if(_&&_.is(f))continue;const y=_.getParent();y!=null&&y.is(f)||(d=void 0),f=y,d===void 0&&(d=(o||Ql)([t]),_.insertBefore(d)),d.append(_)}else f=void 0,d=void 0}A(d)&&(e?d.selectStart():d.selectEnd())}function yO(n,e){let t=n;for(;t!==null;){if(yo(t))return t.getIDs();if(L(t)&&e===t.getTextContentSize()){const o=t.getNextSibling();if(yo(o))return o.getIDs()}t=t.getParent()}return null}const CO=Object.freeze(Object.defineProperty({__proto__:null,$createMarkNode:Ql,$getMarkIDs:yO,$isMarkNode:yo,$unwrapMarkNode:_O,$wrapSelectionInMarkNode:mO,MarkNode:Is},Symbol.toStringTag,{value:"Module"})),bm=(process.env.NODE_ENV==="development"?pO:CO).$isMarkNode,Om=/^(\d+(?:\.\d+)?)px$/,NO=75,pe={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class Cr extends yt{static getType(){return"tablecell"}static clone(e){const t=new Cr(e.__headerState,e.__colSpan,e.__width,e.__key);return t.__rowSpan=e.__rowSpan,t.__backgroundColor=e.__backgroundColor,t}static importDOM(){return{td:e=>({conversion:vm,priority:0}),th:e=>({conversion:vm,priority:0})}}static importJSON(e){const t=e.colSpan||1,o=e.rowSpan||1,r=Mt(e.headerState,t,e.width||void 0);return r.__rowSpan=o,r.__backgroundColor=e.backgroundColor||null,r}constructor(e=pe.NO_STATUS,t=1,o,r){super(r),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=o,this.__backgroundColor=null}createDOM(e){const t=document.createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(t.style.backgroundColor=this.__backgroundColor),Ie(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const{element:t}=super.exportDOM(e);if(t){const o=t;o.style.border="1px solid black",this.__colSpan>1&&(o.colSpan=this.__colSpan),this.__rowSpan>1&&(o.rowSpan=this.__rowSpan),o.style.width=`${this.getWidth()||NO}px`,o.style.verticalAlign="top",o.style.textAlign="start";const r=this.getBackgroundColor();r!==null?o.style.backgroundColor=r:this.hasHeader()&&(o.style.backgroundColor="#f2f3f5")}return{element:t}}exportJSON(){return{...super.exportJSON(),backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,type:"tablecell",width:this.getWidth()}}getColSpan(){return this.__colSpan}setColSpan(e){return this.getWritable().__colSpan=e,this}getRowSpan(){return this.__rowSpan}setRowSpan(e){return this.getWritable().__rowSpan=e,this}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e){const t=this.getWritable();return t.__headerState=e,this.__headerState}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){const t=this.getWritable();return t.__width=e,this.__width}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){this.getWritable().__backgroundColor=e}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==pe.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function vm(n){const e=n,t=n.nodeName.toLowerCase();let o;Om.test(e.style.width)&&(o=parseFloat(e.style.width));const r=Mt(t==="th"?pe.ROW:pe.NO_STATUS,e.colSpan,o);r.__rowSpan=e.rowSpan;const s=e.style.backgroundColor;s!==""&&(r.__backgroundColor=s);const i=e.style,l=i.textDecoration.split(" "),c=i.fontWeight==="700"||i.fontWeight==="bold",a=l.includes("line-through"),f=i.fontStyle==="italic",d=l.includes("underline");return{after:u=>(u.length===0&&u.push(ie()),u),forChild:(u,h)=>{if(Q(h)&&!A(u)){const g=ie();return pl(u)&&u.getTextContent()===`
40
- `?null:(L(u)&&(c&&u.toggleFormat("bold"),a&&u.toggleFormat("strikethrough"),f&&u.toggleFormat("italic"),d&&u.toggleFormat("underline")),g.append(u),g)}return u},node:r}}function Mt(n,e=1,t){return rt(new Cr(n,e,t))}function Q(n){return n instanceof Cr}const SO=nr("INSERT_TABLE_COMMAND");class Ls extends yt{static getType(){return"tablerow"}static clone(e){return new Ls(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:TO,priority:0})}}static importJSON(e){return Co(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){return{...super.exportJSON(),...this.getHeight()&&{height:this.getHeight()},type:"tablerow",version:1}}createDOM(e){const t=document.createElement("tr");return this.__height&&(t.style.height=`${this.__height}px`),Ie(t,e.theme.tableRow),t}isShadowRoot(){return!0}setHeight(e){const t=this.getWritable();return t.__height=e,this.__height}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function TO(n){const e=n;let t;return Om.test(e.style.height)&&(t=parseFloat(e.style.height)),{node:Co(t)}}function Co(n){return rt(new Ls(n))}function ke(n){return n instanceof Ls}const xO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function EO(n,e,t=!0){const o=oc();for(let r=0;r<n;r++){const s=Co();for(let i=0;i<e;i++){let l=pe.NO_STATUS;typeof t=="object"?(r===0&&t.rows&&(l|=pe.ROW),i===0&&t.columns&&(l|=pe.COLUMN)):t&&(r===0&&(l|=pe.ROW),i===0&&(l|=pe.COLUMN));const c=Mt(l),a=ie();a.append(bt()),c.append(a),s.append(c)}o.append(s)}return o}function wO(n){const e=U(n,t=>Q(t));return Q(e)?e:null}function Hu(n){const e=U(n,t=>ke(t));if(ke(e))return e;throw new Error("Expected table cell to be inside of table row.")}function Yu(n){const e=U(n,t=>Me(t));if(Me(e))return e;throw new Error("Expected table cell to be inside of table.")}function bO(n){const e=Hu(n);return Yu(e).getChildren().findIndex(o=>o.is(e))}function OO(n){return Hu(n).getChildren().findIndex(t=>t.is(n))}function Mm(n,e){const t=Yu(n),{x:o,y:r}=t.getCordsFromCellNode(n,e);return{above:t.getCellNodeFromCords(o,r-1,e),below:t.getCellNodeFromCords(o,r+1,e),left:t.getCellNodeFromCords(o-1,r,e),right:t.getCellNodeFromCords(o+1,r,e)}}function vO(n,e){const t=n.getChildren();if(e>=t.length||e<0)throw new Error("Expected table cell to be inside of table row.");return t[e].remove(),n}function MO(n,e,t=!0,o,r){const s=n.getChildren();if(e>=s.length||e<0)throw new Error("Table row target index out of range");const i=s[e];if(ke(i))for(let l=0;l<o;l++){const c=i.getChildren(),a=c.length,f=Co();for(let d=0;d<a;d++){const u=c[d];if(!Q(u))throw Error("Expected table cell");const{above:h,below:g}=Mm(u,r);let p=pe.NO_STATUS;const _=h&&h.getWidth()||g&&g.getWidth()||void 0;(h&&h.hasHeaderState(pe.COLUMN)||g&&g.hasHeaderState(pe.COLUMN))&&(p|=pe.COLUMN);const y=Mt(p,1,_);y.append(ie()),f.append(y)}t?i.insertAfter(f):i.insertBefore(f)}else throw new Error("Row before insertion index does not exist.");return n}const Ju=(n,e)=>n===pe.BOTH||n===e?e:pe.NO_STATUS;function DO(n=!0){const e=M();if(!(v(e)||Ce(e)))throw Error("Expected a RangeSelection or TableSelection");const t=e.focus.getNode(),[o,,r]=Ct(t),[s,i]=Jt(r,o,o),l=s[0].length,{startRow:c}=i;if(n){const a=c+o.__rowSpan-1,f=s[a],d=Co();for(let h=0;h<l;h++){const{cell:g,startRow:p}=f[h];if(p+g.__rowSpan-1<=a){const y=f[h].cell.__headerState,m=Ju(y,pe.COLUMN);d.append(Mt(m).append(ie()))}else g.setRowSpan(g.__rowSpan+1)}const u=r.getChildAtIndex(a);if(!ke(u))throw Error("focusEndRow is not a TableRowNode");u.insertAfter(d)}else{const a=s[c],f=Co();for(let u=0;u<l;u++){const{cell:h,startRow:g}=a[u];if(g===c){const _=a[u].cell.__headerState,y=Ju(_,pe.COLUMN);f.append(Mt(y).append(ie()))}else h.setRowSpan(h.__rowSpan+1)}const d=r.getChildAtIndex(c);if(!ke(d))throw Error("focusEndRow is not a TableRowNode");d.insertBefore(f)}}function AO(n,e,t=!0,o,r){const s=n.getChildren(),i=[];for(let l=0;l<s.length;l++){const c=s[l];if(ke(c))for(let a=0;a<o;a++){const f=c.getChildren();if(e>=f.length||e<0)throw new Error("Table column target index out of range");const d=f[e];if(!Q(d))throw Error("Expected table cell");const{left:u,right:h}=Mm(d,r);let g=pe.NO_STATUS;(u&&u.hasHeaderState(pe.ROW)||h&&h.hasHeaderState(pe.ROW))&&(g|=pe.ROW);const p=Mt(g);p.append(ie()),i.push({newTableCell:p,targetCell:d})}}return i.forEach(({newTableCell:l,targetCell:c})=>{t?c.insertAfter(l):c.insertBefore(l)}),n}function kO(n=!0){const e=M();if(!(v(e)||Ce(e)))throw Error("Expected a RangeSelection or TableSelection");const t=e.anchor.getNode(),o=e.focus.getNode(),[r]=Ct(t),[s,,i]=Ct(o),[l,c,a]=Jt(i,s,r),f=l.length,d=n?Math.max(c.startColumn,a.startColumn):Math.min(c.startColumn,a.startColumn),u=n?d+s.__colSpan-1:d-1,h=i.getFirstChild();if(!ke(h))throw Error("Expected firstTable child to be a row");let g=null;function p(y=pe.NO_STATUS){const m=Mt(y).append(ie());return g===null&&(g=m),m}let _=h;e:for(let y=0;y<f;y++){if(y!==0){const x=_.getNextSibling();if(!ke(x))throw Error("Expected row nextSibling to be a row");_=x}const m=l[y],C=m[u<0?0:u].cell.__headerState,N=Ju(C,pe.ROW);if(u<0){Vu(_,p(N));continue}const{cell:S,startColumn:T,startRow:b}=m[u];if(T+S.__colSpan-1<=u){let x=S,w=b,O=u;for(;w!==y&&x.__rowSpan>1;)if(O-=S.__colSpan,O>=0){const{cell:D,startRow:B}=m[O];x=D,w=B}else{_.append(p(N));continue e}x.insertAfter(p(N))}else S.setColSpan(S.__colSpan+1)}g!==null&&Fs(g)}function RO(n,e){const t=n.getChildren();for(let o=0;o<t.length;o++){const r=t[o];if(ke(r)){const s=r.getChildren();if(e>=s.length||e<0)throw new Error("Table column target index out of range");s[e].remove()}}return n}function $O(){const n=M();if(!(v(n)||Ce(n)))throw Error("Expected a RangeSelection or TableSelection");const e=n.anchor.getNode(),t=n.focus.getNode(),[o,,r]=Ct(e),[s]=Ct(t),[i,l,c]=Jt(r,o,s),{startRow:a}=l,{startRow:f}=c,d=f+s.__rowSpan-1;if(i.length===d-a+1){r.remove();return}const u=i[0].length,h=i[d+1],g=r.getChildAtIndex(d+1);for(let p=d;p>=a;p--){for(let y=u-1;y>=0;y--){const{cell:m,startRow:C,startColumn:N}=i[p][y];if(N===y&&(p===a&&C<a&&m.setRowSpan(m.__rowSpan-(C-a)),C>=a&&C+m.__rowSpan-1>d)){if(m.setRowSpan(m.__rowSpan-(d-C+1)),g===null)throw Error("Expected nextRowNode not to be null");if(y===0)Vu(g,m);else{const{cell:S}=h[y-1];S.insertAfter(m)}}}const _=r.getChildAtIndex(p);if(!ke(_))throw Error(`Expected GridNode childAtIndex(${String(p)}) to be RowNode`);_.remove()}if(h!==void 0){const{cell:p}=h[0];Fs(p)}else{const p=i[a-1],{cell:_}=p[0];Fs(_)}}function PO(){const n=M();if(!(v(n)||Ce(n)))throw Error("Expected a RangeSelection or TableSelection");const e=n.anchor.getNode(),t=n.focus.getNode(),[o,,r]=Ct(e),[s]=Ct(t),[i,l,c]=Jt(r,o,s),{startColumn:a}=l,{startRow:f,startColumn:d}=c,u=Math.min(a,d),h=Math.max(a+o.__colSpan-1,d+s.__colSpan-1),g=h-u+1;if(i[0].length===h-u+1){r.selectPrevious(),r.remove();return}const _=i.length;for(let C=0;C<_;C++)for(let N=u;N<=h;N++){const{cell:S,startColumn:T}=i[C][N];if(T<u){if(N===u){const b=u-T;S.setColSpan(S.__colSpan-Math.min(g,S.__colSpan-b))}}else if(T+S.__colSpan-1>h){if(N===h){const b=h-T+1;S.setColSpan(S.__colSpan-b)}}else S.remove()}const y=i[f],m=a>d?y[a+o.__colSpan]:y[d+s.__colSpan];if(m!==void 0){const{cell:C}=m;Fs(C)}else{const C=d<a?y[d-1]:y[a-1],{cell:N}=C;Fs(N)}}function Fs(n){const e=n.getFirstDescendant();e==null?n.selectStart():e.getParentOrThrow().selectStart()}function Vu(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function IO(){const n=M();if(!(v(n)||Ce(n)))throw Error("Expected a RangeSelection or TableSelection");const e=n.anchor.getNode(),[t,o,r]=Ct(e),s=t.__colSpan,i=t.__rowSpan;if(s>1){for(let l=1;l<s;l++)t.insertAfter(Mt(pe.NO_STATUS).append(ie()));t.setColSpan(1)}if(i>1){const[l,c]=Jt(r,t,t),{startColumn:a,startRow:f}=c;let d;for(let u=1;u<i;u++){const h=f+u,g=l[h];if(d=(d||o).getNextSibling(),!ke(d))throw Error("Expected row next sibling to be a row");let p=null;for(let _=0;_<a;_++){const y=g[_],m=y.cell;y.startRow===h&&(p=m),m.__colSpan>1&&(_+=m.__colSpan-1)}if(p===null)for(let _=0;_<s;_++)Vu(d,Mt(pe.NO_STATUS).append(ie()));else for(let _=0;_<s;_++)p.insertAfter(Mt(pe.NO_STATUS).append(ie()))}t.setRowSpan(1)}}function Jt(n,e,t){const[o,r,s]=Dm(n,e,t);if(r===null)throw Error("Anchor not found in Grid");if(s===null)throw Error("Focus not found in Grid");return[o,r,s]}function Dm(n,e,t){const o=[];let r=null,s=null;function i(a,f,d){const u={cell:d,startColumn:f,startRow:a},h=d.__rowSpan,g=d.__colSpan;for(let p=0;p<h;p++){o[a+p]===void 0&&(o[a+p]=[]);for(let _=0;_<g;_++)o[a+p][f+_]=u}e!==null&&e.is(d)&&(r=u),t!==null&&t.is(d)&&(s=u)}function l(a,f){return o[a]===void 0||o[a][f]===void 0}const c=n.getChildren();for(let a=0;a<c.length;a++){const f=c[a];if(!ke(f))throw Error("Expected GridNode children to be TableRowNode");const d=f.getChildren();let u=0;for(const h of d){if(!Q(h))throw Error("Expected TableRowNode children to be TableCellNode");for(;!l(a,u);)u++;i(a,u,h),u+=h.__colSpan}}return[o,r,s]}function Ct(n){let e;if(n instanceof Cr)e=n;else if("__type"in n){const r=U(n,Q);if(!Q(r))throw Error("Expected to find a parent TableCellNode");e=r}else{const r=U(n.getNode(),Q);if(!Q(r))throw Error("Expected to find a parent TableCellNode");e=r}const t=e.getParent();if(!ke(t))throw Error("Expected TableCellNode to have a parent TableRowNode");const o=t.getParent();if(!Me(o))throw Error("Expected TableRowNode to have a parent GridNode");return[e,t,o]}function Gu(n){const[e,,t]=Ct(n),o=t.getChildren(),r=o.length,s=o[0].getChildren().length,i=new Array(r);for(let l=0;l<r;l++)i[l]=new Array(s);for(let l=0;l<r;l++){const a=o[l].getChildren();let f=0;for(let d=0;d<a.length;d++){for(;i[l][f];)f++;const u=a[d],h=u.__rowSpan||1,g=u.__colSpan||1;for(let p=0;p<h;p++)for(let _=0;_<g;_++)i[l+p][f+_]=u;if(e===u)return{colSpan:g,columnIndex:f,rowIndex:l,rowSpan:h};f+=g}}return null}class Zl{constructor(e,t,o){this.anchor=t,this.focus=o,t._selection=this,o._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return Ce(e)?this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus):!1}set(e,t,o){this.dirty=!0,this.tableKey=e,this.anchor.key=t,this.focus.key=o,this._cachedNodes=null}clone(){return new Zl(this.tableKey,this.anchor,this.focus)}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.focus.getNode();if(!A(t))throw Error("Expected TableSelection focus to be an ElementNode");ml(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const e=Ot(this.anchor.key);if(!Q(e))throw Error("Expected TableSelection anchor to be (or a child of) TableCellNode");const t=Gu(e);if(t===null)throw Error("getCellRect: expected to find AnchorNode");const o=Ot(this.focus.key);if(!Q(o))throw Error("Expected TableSelection focus to be (or a child of) TableCellNode");const r=Gu(o);if(r===null)throw Error("getCellRect: expected to find focusCellNode");const s=Math.min(t.columnIndex,r.columnIndex),i=Math.max(t.columnIndex,r.columnIndex),l=Math.min(t.rowIndex,r.rowIndex),c=Math.max(t.rowIndex,r.rowIndex);return{fromX:Math.min(s,i),fromY:Math.min(l,c),toX:Math.max(s,i),toY:Math.max(l,c)}}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor.getNode(),o=this.focus.getNode(),r=U(t,Q),s=U(o,Q);if(!Q(r))throw Error("Expected TableSelection anchor to be (or a child of) TableCellNode");if(!Q(s))throw Error("Expected TableSelection focus to be (or a child of) TableCellNode");const i=r.getParent();if(!ke(i))throw Error("Expected anchorCell to have a parent TableRowNode");const l=i.getParent();if(!Me(l))throw Error("Expected tableNode to have a parent TableNode");const c=s.getParents()[1];if(c!==l){if(l.isParentOf(s)){const b=c.getParent();if(b==null)throw Error("Expected focusCellParent to have a parent");this.set(this.tableKey,s.getKey(),b.getKey())}else{const b=l.getParent();if(b==null)throw Error("Expected gridParent to have a parent");this.set(this.tableKey,b.getKey(),s.getKey())}return this.getNodes()}const[a,f,d]=Jt(l,r,s);let u=Math.min(f.startColumn,d.startColumn),h=Math.min(f.startRow,d.startRow),g=Math.max(f.startColumn+f.cell.__colSpan-1,d.startColumn+d.cell.__colSpan-1),p=Math.max(f.startRow+f.cell.__rowSpan-1,d.startRow+d.cell.__rowSpan-1),_=u,y=h,m=u,C=h;function N(b){const{cell:x,startColumn:w,startRow:O}=b;u=Math.min(u,w),h=Math.min(h,O),g=Math.max(g,w+x.__colSpan-1),p=Math.max(p,O+x.__rowSpan-1)}for(;u<_||h<y||g>m||p>C;){if(u<_){const b=C-y,x=_-1;for(let w=0;w<=b;w++)N(a[y+w][x]);_=x}if(h<y){const b=m-_,x=y-1;for(let w=0;w<=b;w++)N(a[x][_+w]);y=x}if(g>m){const b=C-y,x=m+1;for(let w=0;w<=b;w++)N(a[y+w][x]);m=x}if(p>C){const b=m-_,x=C+1;for(let w=0;w<=b;w++)N(a[x][_+w]);C=x}}const S=[l];let T=null;for(let b=h;b<=p;b++)for(let x=u;x<=g;x++){const{cell:w}=a[b][x],O=w.getParent();if(!ke(O))throw Error("Expected TableCellNode parent to be a TableRowNode");O!==T&&S.push(O),S.push(w,...LO(w)),T=O}return Bp()||(this._cachedNodes=S),S}getTextContent(){const e=this.getNodes().filter(o=>Q(o));let t="";for(let o=0;o<e.length;o++){const r=e[o],s=r.__parent,i=(e[o+1]||{}).__parent;t+=r.getTextContent()+(i!==s?`
41
- `:" ")}return t}}function Ce(n){return n instanceof Zl}function Xu(){const n=dl("root",0,"element"),e=dl("root",0,"element");return new Zl("root",n,e)}function LO(n){const e=[],t=[n];for(;t.length>0;){const o=t.pop();if(o===void 0)throw Error("Stack.length > 0; can't be undefined");A(o)&&t.unshift(...o.getChildren()),o!==n&&e.push(o)}return e}class Am{constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.trackTable(),this.isSelecting=!1}getTable(){return this.table}removeListeners(){Array.from(this.listenersToRemove).forEach(e=>e())}trackTable(){const e=new MutationObserver(t=>{this.editor.update(()=>{let o=!1;for(let s=0;s<t.length;s++){const c=t[s].target.nodeName;if(c==="TABLE"||c==="TBODY"||c==="THEAD"||c==="TR"){o=!0;break}}if(!o)return;const r=this.editor.getElementByKey(this.tableNodeKey);if(!r)throw new Error("Expected to find TableElement in DOM");this.table=Nr(r)})});this.editor.update(()=>{const t=this.editor.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");this.table=Nr(t),e.observe(t,{attributes:!0,childList:!0,subtree:!0})})}clearHighlight(){const e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.enableHighlightStyle(),e.update(()=>{const t=Ot(this.tableNodeKey);if(!Me(t))throw new Error("Expected TableNode.");const o=e.getElementByKey(this.tableNodeKey);if(!o)throw new Error("Expected to find TableElement in DOM");const r=Nr(o);ec(e,r,null),Pe(null),e.dispatchCommand(zt,void 0)})}enableHighlightStyle(){const e=this.editor;e.update(()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");Ul(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1})}disableHighlightStyle(){const e=this.editor;e.update(()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");Ie(t,e._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0})}updateTableTableSelection(e){if(e!==null&&e.tableKey===this.tableNodeKey){const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.disableHighlightStyle(),ec(t,this.table,this.tableSelection)}else e==null?this.clearHighlight():(this.tableNodeKey=e.tableKey,this.updateTableTableSelection(e))}setFocusCellForSelection(e,t=!1){const o=this.editor;o.update(()=>{const r=Ot(this.tableNodeKey);if(!Me(r))throw new Error("Expected TableNode.");if(!o.getElementByKey(this.tableNodeKey))throw new Error("Expected to find TableElement in DOM");const i=e.x,l=e.y;if(this.focusCell=e,this.anchorCell!==null){const c=Rm(o._window);c&&c.setBaseAndExtent(this.anchorCell.elem,0,this.focusCell.elem,0)}if(!this.isHighlightingCells&&(this.anchorX!==i||this.anchorY!==l||t))this.isHighlightingCells=!0,this.disableHighlightStyle();else if(i===this.focusX&&l===this.focusY)return;if(this.focusX=i,this.focusY=l,this.isHighlightingCells){const c=be(e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null&&Q(c)&&r.is(No(c))){const a=c.getKey();this.tableSelection=this.tableSelection.clone()||Xu(),this.focusCellNodeKey=a,this.tableSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),Pe(this.tableSelection),o.dispatchCommand(zt,void 0),ec(o,this.table,this.tableSelection)}}})}setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.editor.update(()=>{const t=be(e.elem);if(Q(t)){const o=t.getKey();this.tableSelection=this.tableSelection!=null?this.tableSelection.clone():Xu(),this.anchorCellNodeKey=o}})}formatCells(e){this.editor.update(()=>{const t=M();if(!Ce(t))throw Error("Expected grid selection");const o=hl(),r=o.anchor,s=o.focus;t.getNodes().forEach(i=>{Q(i)&&i.getTextContentSize()!==0&&(r.set(i.getKey(),0,"element"),s.set(i.getKey(),i.getChildrenSize(),"element"),o.formatText(e))}),Pe(t),this.editor.dispatchCommand(zt,void 0)})}clearText(){const e=this.editor;e.update(()=>{const t=Ot(this.tableNodeKey);if(!Me(t))throw new Error("Expected TableNode.");const o=M();if(!Ce(o))throw Error("Expected grid selection");const r=o.getNodes().filter(Q);if(r.length===this.table.columns*this.table.rows){t.selectPrevious(),t.remove(),Oe().selectStart();return}r.forEach(s=>{if(A(s)){const i=ie(),l=bt();i.append(l),s.append(i),s.getChildren().forEach(c=>{c!==i&&c.remove()})}}),ec(e,this.table,null),Pe(null),e.dispatchCommand(zt,void 0)})}}const km="__lexicalTableSelection",Rm=n=>xO?(n||window).getSelection():null,FO=n=>(n.buttons&1)===1;function BO(n,e,t,o){const r=t.getRootElement();if(r===null)throw new Error("No root element.");const s=new Am(t,n.getKey()),i=t._window||window;KO(e,s);const l=()=>{const u=()=>{s.isSelecting=!1,i.removeEventListener("mouseup",u),i.removeEventListener("mousemove",h)},h=g=>{setTimeout(()=>{if(!FO(g)&&s.isSelecting){s.isSelecting=!1,i.removeEventListener("mouseup",u),i.removeEventListener("mousemove",h);return}const p=qu(g.target);p!==null&&(s.anchorX!==p.x||s.anchorY!==p.y)&&(g.preventDefault(),s.setFocusCellForSelection(p))},0)};return{onMouseMove:h,onMouseUp:u}};e.addEventListener("mousedown",u=>{setTimeout(()=>{if(u.button!==0||!i)return;const h=qu(u.target);h!==null&&(So(u),s.setAnchorCellForSelection(h));const{onMouseUp:g,onMouseMove:p}=l();s.isSelecting=!0,i.addEventListener("mouseup",g),i.addEventListener("mousemove",p)},0)});const c=u=>{u.button===0&&t.update(()=>{const h=M(),g=u.target;Ce(h)&&h.tableKey===s.tableNodeKey&&r.contains(g)&&s.clearHighlight()})};i.addEventListener("mousedown",c),s.listenersToRemove.add(()=>i.removeEventListener("mousedown",c)),s.listenersToRemove.add(t.registerCommand(wl,u=>Bs(t,u,"down",n,s),vt)),s.listenersToRemove.add(t.registerCommand(vl,u=>Bs(t,u,"up",n,s),vt)),s.listenersToRemove.add(t.registerCommand(bl,u=>Bs(t,u,"backward",n,s),vt)),s.listenersToRemove.add(t.registerCommand(Ol,u=>Bs(t,u,"forward",n,s),vt)),s.listenersToRemove.add(t.registerCommand(Al,u=>{const h=M();if(Ce(h)){const g=U(h.focus.getNode(),Q);if(Q(g))return So(u),g.selectEnd(),!0}return!1},vt));const a=u=>()=>{const h=M();if(!Qn(h,n))return!1;if(Ce(h))return s.clearText(),!0;if(v(h)){const g=U(h.anchor.getNode(),T=>Q(T));if(!Q(g))return!1;const p=h.anchor.getNode(),_=h.focus.getNode(),y=n.isParentOf(p),m=n.isParentOf(_);if(y&&!m||m&&!y)return s.clearText(),!0;const N=U(h.anchor.getNode(),T=>A(T)),S=N&&U(N,T=>A(T)&&Q(T.getParent()));if(!A(S)||!A(N))return!1;if(u===Zo&&S.getPreviousSibling()===null)return!0}return!1};[xl,Zo,Jn].forEach(u=>{s.listenersToRemove.add(t.registerCommand(u,a(u),ye))});const f=u=>{const h=M();if(!Qn(h,n)){const g=h?h.getNodes():null;if(g){const p=g.find(_=>Me(_)&&_.getKey()===s.tableNodeKey);if(Me(p)){if(!p.getParent())return!1;p.remove()}}return!1}if(Ce(h))return u&&(u.preventDefault(),u.stopPropagation()),s.clearText(),!0;if(v(h)){const g=U(h.anchor.getNode(),p=>Q(p));if(!Q(g))return!1}return!1};s.listenersToRemove.add(t.registerCommand(Ml,f,ye)),s.listenersToRemove.add(t.registerCommand(Dl,f,ye)),s.listenersToRemove.add(t.registerCommand(Tl,u=>{const h=M();if(h){if(!(Ce(h)||v(h)))return!1;cr(t,lt(u,ClipboardEvent)?u:null,fm(h));const g=f(u);return v(h)&&h.removeText(),g}return!1},ye)),s.listenersToRemove.add(t.registerCommand(Gn,u=>{const h=M();if(!Qn(h,n))return!1;if(Ce(h))return s.formatCells(u),!0;if(v(h)){const g=U(h.anchor.getNode(),p=>Q(p));if(!Q(g))return!1}return!1},ye)),s.listenersToRemove.add(t.registerCommand(Vn,u=>{const h=M();if(!Ce(h)||!Qn(h,n))return!1;const g=h.anchor.getNode(),p=h.focus.getNode();if(!Q(g)||!Q(p))return!1;const[_,y,m]=Jt(n,g,p),C=Math.max(y.startRow,m.startRow),N=Math.max(y.startColumn,m.startColumn),S=Math.min(y.startRow,m.startRow),T=Math.min(y.startColumn,m.startColumn);for(let b=S;b<=C;b++)for(let x=T;x<=N;x++){const w=_[b][x].cell;w.setFormat(u);const O=w.getChildren();for(let D=0;D<O.length;D++){const B=O[D];A(B)&&!B.isInline()&&B.setFormat(u)}}return!0},ye)),s.listenersToRemove.add(t.registerCommand(Nl,u=>{const h=M();if(!Qn(h,n))return!1;if(Ce(h))return s.clearHighlight(),!1;if(v(h)){const g=U(h.anchor.getNode(),p=>Q(p));if(!Q(g))return!1;if(typeof u=="string"){const p=Bm(t,h,n);if(p)return Fm(p,n,[bt(u)]),!0}}return!1},ye)),o&&s.listenersToRemove.add(t.registerCommand($p,u=>{const h=M();if(!v(h)||!h.isCollapsed()||!Qn(h,n))return!1;const g=nc(h.anchor.getNode());if(g===null)return!1;So(u);const p=n.getCordsFromCellNode(g,s.table);return Pm(s,n,p.x,p.y,u.shiftKey?"backward":"forward"),!0},ye)),s.listenersToRemove.add(t.registerCommand(Dp,u=>n.isSelected(),vt));function d(u){const h=n.getCordsFromCellNode(u,s.table);return n.getDOMCellFromCordsOrThrow(h.x,h.y,s.table)}return s.listenersToRemove.add(t.registerCommand(Rl,u=>{const{nodes:h,selection:g}=u,p=g.getStartEndPoints(),_=Ce(g),m=v(g)&&U(g.anchor.getNode(),ue=>Q(ue))!==null&&U(g.focus.getNode(),ue=>Q(ue))!==null||_;if(h.length!==1||!Me(h[0])||!m||p===null)return!1;const[C]=p,N=h[0],S=N.getChildren(),T=N.getFirstChildOrThrow().getChildrenSize(),b=N.getChildrenSize(),x=U(C.getNode(),ue=>Q(ue)),w=x&&U(x,ue=>ke(ue)),O=w&&U(w,ue=>Me(ue));if(!Q(x)||!ke(w)||!Me(O))return!1;const D=w.getIndexWithinParent(),B=Math.min(O.getChildrenSize()-1,D+b-1),Y=x.getIndexWithinParent(),J=Math.min(w.getChildrenSize()-1,Y+T-1),V=Math.min(Y,J),re=Math.min(D,B),F=Math.max(Y,J),ce=Math.max(D,B),se=O.getChildren();let We=0;for(let ue=re;ue<=ce;ue++){const Ae=se[ue];if(!ke(Ae))return!1;const Ge=S[We];if(!ke(Ge))return!1;const Xe=Ae.getChildren(),qe=Ge.getChildren();let Te=0;for(let nt=V;nt<=F;nt++){const ze=Xe[nt];if(!Q(ze))return!1;const ve=qe[Te];if(!Q(ve))return!1;const St=ze.getChildren();ve.getChildren().forEach(eo=>{L(eo)&&ie().append(eo),ze.append(eo)}),St.forEach(eo=>eo.remove()),Te++}We++}return!0},ye)),s.listenersToRemove.add(t.registerCommand(zt,()=>{const u=M(),h=Hn();if(v(u)){const{anchor:g,focus:p}=u,_=g.getNode(),y=p.getNode(),m=nc(_),C=nc(y),N=!!(m&&n.is(No(m))),S=!!(C&&n.is(No(C))),T=N!==S,b=N&&S,x=u.isBackward();if(T){const w=u.clone();if(S){const[O]=Jt(n,C,C),D=O[0][0].cell,B=O[O.length-1].at(-1).cell;w.focus.set(x?D.getKey():B.getKey(),x?D.getChildrenSize():B.getChildrenSize(),"element")}Pe(w),$m(t,s)}else b&&(m.is(C)||(s.setAnchorCellForSelection(d(m)),s.setFocusCellForSelection(d(C),!0),s.isSelecting||setTimeout(()=>{const{onMouseUp:w,onMouseMove:O}=l();s.isSelecting=!0,i.addEventListener("mouseup",w),i.addEventListener("mousemove",O)},0)))}else if(u&&Ce(u)&&u.is(h)&&u.tableKey===n.getKey()){const g=Rm(t._window);if(g&&g.anchorNode&&g.focusNode){const p=be(g.focusNode),_=p&&!n.is(No(p)),y=be(g.anchorNode),m=y&&n.is(No(y));if(_&&m&&g.rangeCount>0){const C=_p(g,t);C&&(C.anchor.set(n.getKey(),u.isBackward()?n.getChildrenSize():0,"element"),g.removeAllRanges(),Pe(C))}}}return u&&!u.is(h)&&(Ce(u)||Ce(h))&&s.tableSelection&&!s.tableSelection.is(h)?(Ce(u)&&u.tableKey===s.tableNodeKey?s.updateTableTableSelection(u):!Ce(u)&&Ce(h)&&h.tableKey===s.tableNodeKey&&s.updateTableTableSelection(null),!1):(s.hasHijackedSelectionStyles&&!n.isSelected()?zO(t,s):!s.hasHijackedSelectionStyles&&n.isSelected()&&$m(t,s),!1)},ye)),s.listenersToRemove.add(t.registerCommand(er,()=>{const u=M();if(!v(u)||!u.isCollapsed()||!Qn(u,n))return!1;const h=Bm(t,u,n);return h?(Fm(h,n),!0):!1},ye)),s}function KO(n,e){n[km]=e}function WO(n){return n[km]}function qu(n){let e=n;for(;e!=null;){const t=e.nodeName;if(t==="TD"||t==="TH"){const o=e._cell;return o===void 0?null:o}e=e.parentNode}return null}function Nr(n){const e=[],t={columns:0,domRows:e,rows:0};let o=n.firstChild,r=0,s=0;for(e.length=0;o!=null;){const i=o.nodeName;if(i==="TD"||i==="TH"){const a=o,f={elem:a,hasBackgroundColor:a.style.backgroundColor!=="",highlighted:!1,x:r,y:s};o._cell=f;let d=e[s];d===void 0&&(d=e[s]=[]),d[r]=f}else{const a=o.firstChild;if(a!=null){o=a;continue}}const l=o.nextSibling;if(l!=null){r++,o=l;continue}const c=o.parentNode;if(c!=null){const a=c.nextSibling;if(a==null)break;s++,r=0,o=a}}return t.columns=r+1,t.rows=s+1,t}function ec(n,e,t){const o=new Set(t?t.getNodes():[]);Qu(e,(r,s)=>{const i=r.elem;o.has(s)?(r.highlighted=!0,Im(n,r)):(r.highlighted=!1,Lm(n,r),i.getAttribute("style")||i.removeAttribute("style"))})}function Qu(n,e){const{domRows:t}=n;for(let o=0;o<t.length;o++){const r=t[o];if(r)for(let s=0;s<r.length;s++){const i=r[s];if(!i)continue;const l=be(i.elem);l!==null&&e(i,l,{x:s,y:o})}}}function $m(n,e){e.disableHighlightStyle(),Qu(e.table,t=>{t.highlighted=!0,Im(n,t)})}function zO(n,e){e.enableHighlightStyle(),Qu(e.table,t=>{const o=t.elem;t.highlighted=!1,Lm(n,t),o.getAttribute("style")||o.removeAttribute("style")})}const Pm=(n,e,t,o,r)=>{const s=r==="forward";switch(r){case"backward":case"forward":return t!==(s?n.table.columns-1:0)?tc(e.getCellNodeFromCordsOrThrow(t+(s?1:-1),o,n.table),s):o!==(s?n.table.rows-1:0)?tc(e.getCellNodeFromCordsOrThrow(s?0:n.table.columns-1,o+(s?1:-1),n.table),s):s?e.selectNext():e.selectPrevious(),!0;case"up":return o!==0?tc(e.getCellNodeFromCordsOrThrow(t,o-1,n.table),!1):e.selectPrevious(),!0;case"down":return o!==n.table.rows-1?tc(e.getCellNodeFromCordsOrThrow(t,o+1,n.table),!0):e.selectNext(),!0;default:return!1}},UO=(n,e,t,o,r)=>{const s=r==="forward";switch(r){case"backward":case"forward":return t!==(s?n.table.columns-1:0)&&n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t+(s?1:-1),o,n.table)),!0;case"up":return o!==0?(n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t,o-1,n.table)),!0):!1;case"down":return o!==n.table.rows-1?(n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t,o+1,n.table)),!0):!1;default:return!1}};function Qn(n,e){if(v(n)||Ce(n)){const t=e.isParentOf(n.anchor.getNode()),o=e.isParentOf(n.focus.getNode());return t&&o}return!1}function tc(n,e){e?n.selectStart():n.selectEnd()}const Zu="172,206,247";function Im(n,e){const t=e.elem,o=be(t);if(!Q(o))throw Error("Expected to find LexicalNode from Table Cell DOMNode");o.getBackgroundColor()===null?t.style.setProperty("background-color",`rgb(${Zu})`):t.style.setProperty("background-image",`linear-gradient(to right, rgba(${Zu},0.85), rgba(${Zu},0.85))`),t.style.setProperty("caret-color","transparent")}function Lm(n,e){const t=e.elem,o=be(t);if(!Q(o))throw Error("Expected to find LexicalNode from Table Cell DOMNode");o.getBackgroundColor()===null&&t.style.removeProperty("background-color"),t.style.removeProperty("background-image"),t.style.removeProperty("caret-color")}function nc(n){const e=U(n,Q);return Q(e)?e:null}function No(n){const e=U(n,Me);return Me(e)?e:null}function Bs(n,e,t,o,r){if((t==="up"||t==="down")&&jO(n))return!1;const s=M();if(!Qn(s,o)){if(v(s)){if(s.isCollapsed()&&t==="backward"){const i=s.anchor.type,l=s.anchor.offset;if(i!=="element"&&!(i==="text"&&l===0))return!1;const c=s.anchor.getNode();if(!c)return!1;const a=U(c,d=>A(d)&&!d.isInline());if(!a)return!1;const f=a.getPreviousSibling();return!f||!Me(f)?!1:(So(e),f.selectEnd(),!0)}else if(e.shiftKey&&(t==="up"||t==="down")){const i=s.focus.getNode();if(it(i)){const l=s.getNodes()[0];if(l){const c=U(l,Q);if(c&&o.isParentOf(c)){const a=o.getFirstDescendant(),f=o.getLastDescendant();if(!a||!f)return!1;const[d]=Ct(a),[u]=Ct(f),h=o.getCordsFromCellNode(d,r.table),g=o.getCordsFromCellNode(u,r.table),p=o.getDOMCellFromCordsOrThrow(h.x,h.y,r.table),_=o.getDOMCellFromCordsOrThrow(g.x,g.y,r.table);return r.setAnchorCellForSelection(p),r.setFocusCellForSelection(_,!0),!0}}return!1}else{const l=U(i,a=>A(a)&&!a.isInline());if(!l)return!1;const c=t==="down"?l.getNextSibling():l.getPreviousSibling();if(Me(c)&&r.tableNodeKey===c.getKey()){const a=c.getFirstDescendant(),f=c.getLastDescendant();if(!a||!f)return!1;const[d]=Ct(a),[u]=Ct(f),h=s.clone();return h.focus.set((t==="up"?d:u).getKey(),t==="up"?0:u.getChildrenSize(),"element"),Pe(h),!0}}}}return!1}if(v(s)&&s.isCollapsed()){const{anchor:i,focus:l}=s,c=U(i.getNode(),Q),a=U(l.getNode(),Q);if(!Q(c)||!c.is(a))return!1;const f=No(c);if(f!==o&&f!=null){const m=n.getElementByKey(f.getKey());if(m!=null)return r.table=Nr(m),Bs(n,e,t,f,r)}if(t==="backward"||t==="forward"){const m=i.type,C=i.offset,N=i.getNode();if(!N)return!1;const S=s.getNodes();return S.length===1&&st(S[0])?!1:HO(m,C,N,t)?VO(e,N,o,t):!1}const d=n.getElementByKey(c.__key),u=n.getElementByKey(i.key);if(u==null||d==null)return!1;let h;if(i.type==="element")h=u.getBoundingClientRect();else{const m=window.getSelection();if(m===null||m.rangeCount===0)return!1;h=m.getRangeAt(0).getBoundingClientRect()}const g=t==="up"?c.getFirstChild():c.getLastChild();if(g==null)return!1;const p=n.getElementByKey(g.__key);if(p==null)return!1;const _=p.getBoundingClientRect();if(t==="up"?_.top>h.top-h.height:h.bottom+h.height>_.bottom){So(e);const m=o.getCordsFromCellNode(c,r.table);if(e.shiftKey){const C=o.getDOMCellFromCordsOrThrow(m.x,m.y,r.table);r.setAnchorCellForSelection(C),r.setFocusCellForSelection(C,!0)}else return Pm(r,o,m.x,m.y,t);return!0}}else if(Ce(s)){const{anchor:i,focus:l}=s,c=U(i.getNode(),Q),a=U(l.getNode(),Q),[f]=s.getNodes(),d=n.getElementByKey(f.getKey());if(!Q(c)||!Q(a)||!Me(f)||d==null)return!1;r.updateTableTableSelection(s);const u=Nr(d),h=o.getCordsFromCellNode(c,u),g=o.getDOMCellFromCordsOrThrow(h.x,h.y,u);if(r.setAnchorCellForSelection(g),So(e),e.shiftKey){const p=o.getCordsFromCellNode(a,u);return UO(r,f,p.x,p.y,t)}else a.selectEnd();return!0}return!1}function So(n){n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()}function jO(n){const e=n.getRootElement();return e?e.hasAttribute("aria-controls")&&e.getAttribute("aria-controls")==="typeahead-menu":!1}function HO(n,e,t,o){return YO(n,t,o)||JO(n,e,t,o)}function YO(n,e,t){return n==="element"&&(t==="backward"?e.getPreviousSibling()===null:e.getNextSibling()===null)}function JO(n,e,t,o){const r=U(t,i=>A(i)&&!i.isInline());if(!r)return!1;const s=o==="backward"?e===0:e===t.getTextContentSize();return n==="text"&&s&&(o==="backward"?r.getPreviousSibling()===null:r.getNextSibling()===null)}function VO(n,e,t,o){const r=U(e,Q);if(!Q(r))return!1;const[s,i]=Jt(t,r,r);if(!GO(s,i,o))return!1;const l=XO(e,o,t);return!l||Me(l)?!1:(So(n),o==="backward"?l.selectEnd():l.selectStart(),!0)}function GO(n,e,t){const o=n[0][0],r=n[n.length-1][n[0].length-1],{startColumn:s,startRow:i}=e;return t==="backward"?s===o.startColumn&&i===o.startRow:s===r.startColumn&&i===r.startRow}function XO(n,e,t){const o=U(n,s=>A(s)&&!s.isInline());if(!o)return;const r=e==="backward"?o.getPreviousSibling():o.getNextSibling();return r&&Me(r)?r:e==="backward"?t.getPreviousSibling():t.getNextSibling()}function Fm(n,e,t){const o=ie();n==="first"?e.insertBefore(o):e.insertAfter(o),o.append(...t||[]),o.selectEnd()}function Bm(n,e,t){const o=t.getParent();if(!o)return;const r=n.getElementByKey(o.getKey());if(!r)return;const s=window.getSelection();if(!s||s.anchorNode!==r)return;const i=U(e.anchor.getNode(),_=>Q(_));if(!i)return;const l=U(i,_=>Me(_));if(!Me(l)||!l.is(t))return;const[c,a]=Jt(t,i,i),f=c[0][0],d=c[c.length-1][c[0].length-1],{startRow:u,startColumn:h}=a,g=u===f.startRow&&h===f.startColumn,p=u===d.startRow&&h===d.startColumn;return g?"first":p?"last":void 0}class Ks extends yt{static getType(){return"table"}static clone(e){return new Ks(e.__key)}static importDOM(){return{table:e=>({conversion:QO,priority:1})}}static importJSON(e){return oc()}constructor(e){super(e)}exportJSON(){return{...super.exportJSON(),type:"table",version:1}}createDOM(e,t){const o=document.createElement("table");return Ie(o,e.theme.table),o}updateDOM(){return!1}exportDOM(e){return{...super.exportDOM(e),after:t=>{if(t){const o=t.cloneNode(),r=document.createElement("colgroup"),s=document.createElement("tbody");qn(t)&&s.append(...t.children);const i=this.getFirstChildOrThrow();if(!ke(i))throw new Error("Expected to find row node.");const l=i.getChildrenSize();for(let c=0;c<l;c++){const a=document.createElement("col");r.append(a)}return o.replaceChildren(r,s),o}}}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:o,domRows:r}=t;for(let s=0;s<o;s++){const i=r[s];if(i==null)continue;const l=i.findIndex(c=>{if(!c)return;const{elem:a}=c;return be(a)===e});if(l!==-1)return{x:l,y:s}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,o){const{domRows:r}=o,s=r[t];if(s==null)return null;const i=e<s.length?e:s.length-1,l=s[i];return l??null}getDOMCellFromCordsOrThrow(e,t,o){const r=this.getDOMCellFromCords(e,t,o);if(!r)throw new Error("Cell not found at cords.");return r}getCellNodeFromCords(e,t,o){const r=this.getDOMCellFromCords(e,t,o);if(r==null)return null;const s=be(r.elem);return Q(s)?s:null}getCellNodeFromCordsOrThrow(e,t,o){const r=this.getCellNodeFromCords(e,t,o);if(!r)throw new Error("Node at cords not TableCellNode.");return r}canSelectBefore(){return!0}canIndent(){return!1}}function qO(n,e){const t=n.getElementByKey(e.getKey());if(t==null)throw new Error("Table Element Not Found");return Nr(t)}function QO(n){return{node:oc()}}function oc(){return rt(new Ks)}function Me(n){return n instanceof Ks}const ZO=Object.freeze(Object.defineProperty({__proto__:null,$computeTableMap:Jt,$computeTableMapSkipCellCheck:Dm,$createTableCellNode:Mt,$createTableNode:oc,$createTableNodeWithDimensions:EO,$createTableRowNode:Co,$createTableSelection:Xu,$deleteTableColumn:RO,$deleteTableColumn__EXPERIMENTAL:PO,$deleteTableRow__EXPERIMENTAL:$O,$findCellNode:nc,$findTableNode:No,$getElementForTableNode:qO,$getNodeTriplet:Ct,$getTableCellNodeFromLexicalNode:wO,$getTableCellNodeRect:Gu,$getTableColumnIndexFromTableCellNode:OO,$getTableNodeFromLexicalNodeOrThrow:Yu,$getTableRowIndexFromTableCellNode:bO,$getTableRowNodeFromTableCellNodeOrThrow:Hu,$insertTableColumn:AO,$insertTableColumn__EXPERIMENTAL:kO,$insertTableRow:MO,$insertTableRow__EXPERIMENTAL:DO,$isTableCellNode:Q,$isTableNode:Me,$isTableRowNode:ke,$isTableSelection:Ce,$removeTableRowAtIndex:vO,$unmergeCell:IO,INSERT_TABLE_COMMAND:SO,TableCellHeaderStates:pe,TableCellNode:Cr,TableNode:Ks,TableObserver:Am,TableRowNode:Ls,applyTableHandlers:BO,getDOMCellFromTarget:qu,getTableObserverFromTableElement:WO},Symbol.toStringTag,{value:"Module"})),Km=/^(\d+(?:\.\d+)?)px$/,_e={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class Sr extends yt{static getType(){return"tablecell"}static clone(e){const t=new Sr(e.__headerState,e.__colSpan,e.__width,e.__key);return t.__rowSpan=e.__rowSpan,t.__backgroundColor=e.__backgroundColor,t}static importDOM(){return{td:e=>({conversion:Wm,priority:0}),th:e=>({conversion:Wm,priority:0})}}static importJSON(e){const t=e.colSpan||1,o=e.rowSpan||1,r=Dt(e.headerState,t,e.width||void 0);return r.__rowSpan=o,r.__backgroundColor=e.backgroundColor||null,r}constructor(e=_e.NO_STATUS,t=1,o,r){super(r),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=o,this.__backgroundColor=null}createDOM(e){const t=document.createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(t.style.backgroundColor=this.__backgroundColor),Ie(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const{element:t}=super.exportDOM(e);if(t){const o=t;o.style.border="1px solid black",this.__colSpan>1&&(o.colSpan=this.__colSpan),this.__rowSpan>1&&(o.rowSpan=this.__rowSpan),o.style.width=`${this.getWidth()||75}px`,o.style.verticalAlign="top",o.style.textAlign="start";const r=this.getBackgroundColor();r!==null?o.style.backgroundColor=r:this.hasHeader()&&(o.style.backgroundColor="#f2f3f5")}return{element:t}}exportJSON(){return{...super.exportJSON(),backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,type:"tablecell",width:this.getWidth()}}getColSpan(){return this.__colSpan}setColSpan(e){return this.getWritable().__colSpan=e,this}getRowSpan(){return this.__rowSpan}setRowSpan(e){return this.getWritable().__rowSpan=e,this}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e){return this.getWritable().__headerState=e,this.__headerState}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){return this.getWritable().__width=e,this.__width}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){this.getWritable().__backgroundColor=e}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==_e.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function Wm(n){const e=n,t=n.nodeName.toLowerCase();let o;Km.test(e.style.width)&&(o=parseFloat(e.style.width));const r=Dt(t==="th"?_e.ROW:_e.NO_STATUS,e.colSpan,o);r.__rowSpan=e.rowSpan;const s=e.style.backgroundColor;s!==""&&(r.__backgroundColor=s);const i=e.style,l=i.textDecoration.split(" "),c=i.fontWeight==="700"||i.fontWeight==="bold",a=l.includes("line-through"),f=i.fontStyle==="italic",d=l.includes("underline");return{after:u=>(u.length===0&&u.push(ie()),u),forChild:(u,h)=>{if(Z(h)&&!A(u)){const g=ie();return pl(u)&&u.getTextContent()===`
42
- `?null:(L(u)&&(c&&u.toggleFormat("bold"),a&&u.toggleFormat("strikethrough"),f&&u.toggleFormat("italic"),d&&u.toggleFormat("underline")),g.append(u),g)}return u},node:r}}function Dt(n,e=1,t){return rt(new Sr(n,e,t))}function Z(n){return n instanceof Sr}const e0=nr("INSERT_TABLE_COMMAND");class Ws extends yt{static getType(){return"tablerow"}static clone(e){return new Ws(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:t0,priority:0})}}static importJSON(e){return To(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){return{...super.exportJSON(),...this.getHeight()&&{height:this.getHeight()},type:"tablerow",version:1}}createDOM(e){const t=document.createElement("tr");return this.__height&&(t.style.height=`${this.__height}px`),Ie(t,e.theme.tableRow),t}isShadowRoot(){return!0}setHeight(e){return this.getWritable().__height=e,this.__height}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function t0(n){const e=n;let t;return Km.test(e.style.height)&&(t=parseFloat(e.style.height)),{node:To(t)}}function To(n){return rt(new Ws(n))}function Re(n){return n instanceof Ws}function n0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var le=n0(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const o0=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0;function r0(n,e,t=!0){const o=cc();for(let r=0;r<n;r++){const s=To();for(let i=0;i<e;i++){let l=_e.NO_STATUS;typeof t=="object"?(r===0&&t.rows&&(l|=_e.ROW),i===0&&t.columns&&(l|=_e.COLUMN)):t&&(r===0&&(l|=_e.ROW),i===0&&(l|=_e.COLUMN));const c=Dt(l),a=ie();a.append(bt()),c.append(a),s.append(c)}o.append(s)}return o}function s0(n){const e=U(n,t=>Z(t));return Z(e)?e:null}function ef(n){const e=U(n,t=>Re(t));if(Re(e))return e;throw new Error("Expected table cell to be inside of table row.")}function tf(n){const e=U(n,t=>De(t));if(De(e))return e;throw new Error("Expected table cell to be inside of table.")}function i0(n){const e=ef(n);return tf(e).getChildren().findIndex(t=>t.is(e))}function l0(n){return ef(n).getChildren().findIndex(e=>e.is(n))}function zm(n,e){const t=tf(n),{x:o,y:r}=t.getCordsFromCellNode(n,e);return{above:t.getCellNodeFromCords(o,r-1,e),below:t.getCellNodeFromCords(o,r+1,e),left:t.getCellNodeFromCords(o-1,r,e),right:t.getCellNodeFromCords(o+1,r,e)}}function c0(n,e){const t=n.getChildren();if(e>=t.length||e<0)throw new Error("Expected table cell to be inside of table row.");return t[e].remove(),n}function a0(n,e,t=!0,o,r){const s=n.getChildren();if(e>=s.length||e<0)throw new Error("Table row target index out of range");const i=s[e];if(!Re(i))throw new Error("Row before insertion index does not exist.");for(let l=0;l<o;l++){const c=i.getChildren(),a=c.length,f=To();for(let d=0;d<a;d++){const u=c[d];Z(u)||le(12);const{above:h,below:g}=zm(u,r);let p=_e.NO_STATUS;const _=h&&h.getWidth()||g&&g.getWidth()||void 0;(h&&h.hasHeaderState(_e.COLUMN)||g&&g.hasHeaderState(_e.COLUMN))&&(p|=_e.COLUMN);const y=Dt(p,1,_);y.append(ie()),f.append(y)}t?i.insertAfter(f):i.insertBefore(f)}return n}const nf=(n,e)=>n===_e.BOTH||n===e?e:_e.NO_STATUS;function u0(n=!0){const e=M();v(e)||Ne(e)||le(188);const t=e.focus.getNode(),[o,,r]=Nt(t),[s,i]=Vt(r,o,o),l=s[0].length,{startRow:c}=i;if(n){const a=c+o.__rowSpan-1,f=s[a],d=To();for(let h=0;h<l;h++){const{cell:g,startRow:p}=f[h];if(p+g.__rowSpan-1<=a){const _=f[h].cell.__headerState,y=nf(_,_e.COLUMN);d.append(Dt(y).append(ie()))}else g.setRowSpan(g.__rowSpan+1)}const u=r.getChildAtIndex(a);Re(u)||le(145),u.insertAfter(d)}else{const a=s[c],f=To();for(let u=0;u<l;u++){const{cell:h,startRow:g}=a[u];if(g===c){const p=a[u].cell.__headerState,_=nf(p,_e.COLUMN);f.append(Dt(_).append(ie()))}else h.setRowSpan(h.__rowSpan+1)}const d=r.getChildAtIndex(c);Re(d)||le(145),d.insertBefore(f)}}function f0(n,e,t=!0,o,r){const s=n.getChildren(),i=[];for(let l=0;l<s.length;l++){const c=s[l];if(Re(c))for(let a=0;a<o;a++){const f=c.getChildren();if(e>=f.length||e<0)throw new Error("Table column target index out of range");const d=f[e];Z(d)||le(12);const{left:u,right:h}=zm(d,r);let g=_e.NO_STATUS;(u&&u.hasHeaderState(_e.ROW)||h&&h.hasHeaderState(_e.ROW))&&(g|=_e.ROW);const p=Dt(g);p.append(ie()),i.push({newTableCell:p,targetCell:d})}}return i.forEach(({newTableCell:l,targetCell:c})=>{t?c.insertAfter(l):c.insertBefore(l)}),n}function d0(n=!0){const e=M();v(e)||Ne(e)||le(188);const t=e.anchor.getNode(),o=e.focus.getNode(),[r]=Nt(t),[s,,i]=Nt(o),[l,c,a]=Vt(i,s,r),f=l.length,d=n?Math.max(c.startColumn,a.startColumn):Math.min(c.startColumn,a.startColumn),u=n?d+s.__colSpan-1:d-1,h=i.getFirstChild();Re(h)||le(120);let g=null;function p(y=_e.NO_STATUS){const m=Dt(y).append(ie());return g===null&&(g=m),m}let _=h;e:for(let y=0;y<f;y++){if(y!==0){const x=_.getNextSibling();Re(x)||le(121),_=x}const m=l[y],C=m[u<0?0:u].cell.__headerState,N=nf(C,_e.ROW);if(u<0){of(_,p(N));continue}const{cell:S,startColumn:T,startRow:b}=m[u];if(T+S.__colSpan-1<=u){let x=S,w=b,O=u;for(;w!==y&&x.__rowSpan>1;){if(O-=S.__colSpan,!(O>=0)){_.append(p(N));continue e}{const{cell:D,startRow:B}=m[O];x=D,w=B}}x.insertAfter(p(N))}else S.setColSpan(S.__colSpan+1)}g!==null&&zs(g)}function h0(n,e){const t=n.getChildren();for(let o=0;o<t.length;o++){const r=t[o];if(Re(r)){const s=r.getChildren();if(e>=s.length||e<0)throw new Error("Table column target index out of range");s[e].remove()}}return n}function g0(){const n=M();v(n)||Ne(n)||le(188);const e=n.anchor.getNode(),t=n.focus.getNode(),[o,,r]=Nt(e),[s]=Nt(t),[i,l,c]=Vt(r,o,s),{startRow:a}=l,{startRow:f}=c,d=f+s.__rowSpan-1;if(i.length===d-a+1)return void r.remove();const u=i[0].length,h=i[d+1],g=r.getChildAtIndex(d+1);for(let p=d;p>=a;p--){for(let y=u-1;y>=0;y--){const{cell:m,startRow:C,startColumn:N}=i[p][y];if(N===y&&(p===a&&C<a&&m.setRowSpan(m.__rowSpan-(C-a)),C>=a&&C+m.__rowSpan-1>d))if(m.setRowSpan(m.__rowSpan-(d-C+1)),g===null&&le(122),y===0)of(g,m);else{const{cell:S}=h[y-1];S.insertAfter(m)}}const _=r.getChildAtIndex(p);Re(_)||le(123,String(p)),_.remove()}if(h!==void 0){const{cell:p}=h[0];zs(p)}else{const p=i[a-1],{cell:_}=p[0];zs(_)}}function p0(){const n=M();v(n)||Ne(n)||le(188);const e=n.anchor.getNode(),t=n.focus.getNode(),[o,,r]=Nt(e),[s]=Nt(t),[i,l,c]=Vt(r,o,s),{startColumn:a}=l,{startRow:f,startColumn:d}=c,u=Math.min(a,d),h=Math.max(a+o.__colSpan-1,d+s.__colSpan-1),g=h-u+1;if(i[0].length===h-u+1)return r.selectPrevious(),void r.remove();const p=i.length;for(let m=0;m<p;m++)for(let C=u;C<=h;C++){const{cell:N,startColumn:S}=i[m][C];if(S<u){if(C===u){const T=u-S;N.setColSpan(N.__colSpan-Math.min(g,N.__colSpan-T))}}else if(S+N.__colSpan-1>h){if(C===h){const T=h-S+1;N.setColSpan(N.__colSpan-T)}}else N.remove()}const _=i[f],y=a>d?_[a+o.__colSpan]:_[d+s.__colSpan];if(y!==void 0){const{cell:m}=y;zs(m)}else{const m=d<a?_[d-1]:_[a-1],{cell:C}=m;zs(C)}}function zs(n){const e=n.getFirstDescendant();e==null?n.selectStart():e.getParentOrThrow().selectStart()}function of(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function _0(){const n=M();v(n)||Ne(n)||le(188);const e=n.anchor.getNode(),[t,o,r]=Nt(e),s=t.__colSpan,i=t.__rowSpan;if(s>1){for(let l=1;l<s;l++)t.insertAfter(Dt(_e.NO_STATUS).append(ie()));t.setColSpan(1)}if(i>1){const[l,c]=Vt(r,t,t),{startColumn:a,startRow:f}=c;let d;for(let u=1;u<i;u++){const h=f+u,g=l[h];d=(d||o).getNextSibling(),Re(d)||le(125);let p=null;for(let _=0;_<a;_++){const y=g[_],m=y.cell;y.startRow===h&&(p=m),m.__colSpan>1&&(_+=m.__colSpan-1)}if(p===null)for(let _=0;_<s;_++)of(d,Dt(_e.NO_STATUS).append(ie()));else for(let _=0;_<s;_++)p.insertAfter(Dt(_e.NO_STATUS).append(ie()))}t.setRowSpan(1)}}function Vt(n,e,t){const[o,r,s]=Um(n,e,t);return r===null&&le(110),s===null&&le(111),[o,r,s]}function Um(n,e,t){const o=[];let r=null,s=null;function i(a,f,d){const u={cell:d,startColumn:f,startRow:a},h=d.__rowSpan,g=d.__colSpan;for(let p=0;p<h;p++){o[a+p]===void 0&&(o[a+p]=[]);for(let _=0;_<g;_++)o[a+p][f+_]=u}e!==null&&e.is(d)&&(r=u),t!==null&&t.is(d)&&(s=u)}function l(a,f){return o[a]===void 0||o[a][f]===void 0}const c=n.getChildren();for(let a=0;a<c.length;a++){const f=c[a];Re(f)||le(146);const d=f.getChildren();let u=0;for(const h of d){for(Z(h)||le(147);!l(a,u);)u++;i(a,u,h),u+=h.__colSpan}}return[o,r,s]}function Nt(n){let e;if(n instanceof Sr)e=n;else if("__type"in n){const r=U(n,Z);Z(r)||le(148),e=r}else{const r=U(n.getNode(),Z);Z(r)||le(148),e=r}const t=e.getParent();Re(t)||le(149);const o=t.getParent();return De(o)||le(150),[e,t,o]}function rf(n){const[e,,t]=Nt(n),o=t.getChildren(),r=o.length,s=o[0].getChildren().length,i=new Array(r);for(let l=0;l<r;l++)i[l]=new Array(s);for(let l=0;l<r;l++){const c=o[l].getChildren();let a=0;for(let f=0;f<c.length;f++){for(;i[l][a];)a++;const d=c[f],u=d.__rowSpan||1,h=d.__colSpan||1;for(let g=0;g<u;g++)for(let p=0;p<h;p++)i[l+g][a+p]=d;if(e===d)return{colSpan:h,columnIndex:a,rowIndex:l,rowSpan:u};a+=h}}return null}class rc{constructor(e,t,o){this.anchor=t,this.focus=o,t._selection=this,o._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!Ne(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,o){this.dirty=!0,this.tableKey=e,this.anchor.key=t,this.focus.key=o,this._cachedNodes=null}clone(){return new rc(this.tableKey,this.anchor,this.focus)}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.focus.getNode();A(t)||le(151),ml(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const e=Ot(this.anchor.key);Z(e)||le(152);const t=rf(e);t===null&&le(153);const o=Ot(this.focus.key);Z(o)||le(154);const r=rf(o);r===null&&le(155);const s=Math.min(t.columnIndex,r.columnIndex),i=Math.max(t.columnIndex,r.columnIndex),l=Math.min(t.rowIndex,r.rowIndex),c=Math.max(t.rowIndex,r.rowIndex);return{fromX:Math.min(s,i),fromY:Math.min(l,c),toX:Math.max(s,i),toY:Math.max(l,c)}}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor.getNode(),o=this.focus.getNode(),r=U(t,Z),s=U(o,Z);Z(r)||le(152),Z(s)||le(154);const i=r.getParent();Re(i)||le(156);const l=i.getParent();De(l)||le(157);const c=s.getParents()[1];if(c!==l){if(l.isParentOf(s)){const b=c.getParent();b==null&&le(159),this.set(this.tableKey,s.getKey(),b.getKey())}else{const b=l.getParent();b==null&&le(158),this.set(this.tableKey,b.getKey(),s.getKey())}return this.getNodes()}const[a,f,d]=Vt(l,r,s);let u=Math.min(f.startColumn,d.startColumn),h=Math.min(f.startRow,d.startRow),g=Math.max(f.startColumn+f.cell.__colSpan-1,d.startColumn+d.cell.__colSpan-1),p=Math.max(f.startRow+f.cell.__rowSpan-1,d.startRow+d.cell.__rowSpan-1),_=u,y=h,m=u,C=h;function N(b){const{cell:x,startColumn:w,startRow:O}=b;u=Math.min(u,w),h=Math.min(h,O),g=Math.max(g,w+x.__colSpan-1),p=Math.max(p,O+x.__rowSpan-1)}for(;u<_||h<y||g>m||p>C;){if(u<_){const b=C-y,x=_-1;for(let w=0;w<=b;w++)N(a[y+w][x]);_=x}if(h<y){const b=m-_,x=y-1;for(let w=0;w<=b;w++)N(a[x][_+w]);y=x}if(g>m){const b=C-y,x=m+1;for(let w=0;w<=b;w++)N(a[y+w][x]);m=x}if(p>C){const b=m-_,x=C+1;for(let w=0;w<=b;w++)N(a[x][_+w]);C=x}}const S=[l];let T=null;for(let b=h;b<=p;b++)for(let x=u;x<=g;x++){const{cell:w}=a[b][x],O=w.getParent();Re(O)||le(160),O!==T&&S.push(O),S.push(w,...m0(w)),T=O}return Bp()||(this._cachedNodes=S),S}getTextContent(){const e=this.getNodes().filter(o=>Z(o));let t="";for(let o=0;o<e.length;o++){const r=e[o],s=r.__parent,i=(e[o+1]||{}).__parent;t+=r.getTextContent()+(i!==s?`
43
- `:" ")}return t}}function Ne(n){return n instanceof rc}function sf(){const n=dl("root",0,"element"),e=dl("root",0,"element");return new rc("root",n,e)}function m0(n){const e=[],t=[n];for(;t.length>0;){const o=t.pop();o===void 0&&le(112),A(o)&&t.unshift(...o.getChildren()),o!==n&&e.push(o)}return e}class jm{constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.trackTable(),this.isSelecting=!1}getTable(){return this.table}removeListeners(){Array.from(this.listenersToRemove).forEach(e=>e())}trackTable(){const e=new MutationObserver(t=>{this.editor.update(()=>{let o=!1;for(let s=0;s<t.length;s++){const i=t[s].target.nodeName;if(i==="TABLE"||i==="TBODY"||i==="THEAD"||i==="TR"){o=!0;break}}if(!o)return;const r=this.editor.getElementByKey(this.tableNodeKey);if(!r)throw new Error("Expected to find TableElement in DOM");this.table=Tr(r)})});this.editor.update(()=>{const t=this.editor.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");this.table=Tr(t),e.observe(t,{attributes:!0,childList:!0,subtree:!0})})}clearHighlight(){const e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.enableHighlightStyle(),e.update(()=>{if(!De(Ot(this.tableNodeKey)))throw new Error("Expected TableNode.");const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");const o=Tr(t);sc(e,o,null),Pe(null),e.dispatchCommand(zt,void 0)})}enableHighlightStyle(){const e=this.editor;e.update(()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");Ul(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1})}disableHighlightStyle(){const e=this.editor;e.update(()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");Ie(t,e._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0})}updateTableTableSelection(e){if(e!==null&&e.tableKey===this.tableNodeKey){const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.disableHighlightStyle(),sc(t,this.table,this.tableSelection)}else e==null?this.clearHighlight():(this.tableNodeKey=e.tableKey,this.updateTableTableSelection(e))}setFocusCellForSelection(e,t=!1){const o=this.editor;o.update(()=>{const r=Ot(this.tableNodeKey);if(!De(r))throw new Error("Expected TableNode.");if(!o.getElementByKey(this.tableNodeKey))throw new Error("Expected to find TableElement in DOM");const s=e.x,i=e.y;if(this.focusCell=e,this.anchorCell!==null){const l=Ym(o._window);l&&l.setBaseAndExtent(this.anchorCell.elem,0,this.focusCell.elem,0)}if(this.isHighlightingCells||this.anchorX===s&&this.anchorY===i&&!t){if(s===this.focusX&&i===this.focusY)return}else this.isHighlightingCells=!0,this.disableHighlightStyle();if(this.focusX=s,this.focusY=i,this.isHighlightingCells){const l=be(e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null&&Z(l)&&r.is(xo(l))){const c=l.getKey();this.tableSelection=this.tableSelection.clone()||sf(),this.focusCellNodeKey=c,this.tableSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),Pe(this.tableSelection),o.dispatchCommand(zt,void 0),sc(o,this.table,this.tableSelection)}}})}setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.editor.update(()=>{const t=be(e.elem);if(Z(t)){const o=t.getKey();this.tableSelection=this.tableSelection!=null?this.tableSelection.clone():sf(),this.anchorCellNodeKey=o}})}formatCells(e){this.editor.update(()=>{const t=M();Ne(t)||le(11);const o=hl(),r=o.anchor,s=o.focus;t.getNodes().forEach(i=>{Z(i)&&i.getTextContentSize()!==0&&(r.set(i.getKey(),0,"element"),s.set(i.getKey(),i.getChildrenSize(),"element"),o.formatText(e))}),Pe(t),this.editor.dispatchCommand(zt,void 0)})}clearText(){const e=this.editor;e.update(()=>{const t=Ot(this.tableNodeKey);if(!De(t))throw new Error("Expected TableNode.");const o=M();Ne(o)||le(11);const r=o.getNodes().filter(Z);r.length!==this.table.columns*this.table.rows?(r.forEach(s=>{if(A(s)){const i=ie(),l=bt();i.append(l),s.append(i),s.getChildren().forEach(c=>{c!==i&&c.remove()})}}),sc(e,this.table,null),Pe(null),e.dispatchCommand(zt,void 0)):(t.selectPrevious(),t.remove(),Oe().selectStart())})}}const Hm="__lexicalTableSelection",Ym=n=>o0?(n||window).getSelection():null;function y0(n,e,t,o){const r=t.getRootElement();if(r===null)throw new Error("No root element.");const s=new jm(t,n.getKey()),i=t._window||window;(function(d,u){d[Hm]=u})(e,s);const l=()=>{const d=()=>{s.isSelecting=!1,i.removeEventListener("mouseup",d),i.removeEventListener("mousemove",u)},u=h=>{setTimeout(()=>{if(1&~h.buttons&&s.isSelecting)return s.isSelecting=!1,i.removeEventListener("mouseup",d),void i.removeEventListener("mousemove",u);const g=lf(h.target);g===null||s.anchorX===g.x&&s.anchorY===g.y||(h.preventDefault(),s.setFocusCellForSelection(g))},0)};return{onMouseMove:u,onMouseUp:d}};e.addEventListener("mousedown",d=>{setTimeout(()=>{if(d.button!==0||!i)return;const u=lf(d.target);u!==null&&(Eo(d),s.setAnchorCellForSelection(u));const{onMouseUp:h,onMouseMove:g}=l();s.isSelecting=!0,i.addEventListener("mouseup",h),i.addEventListener("mousemove",g)},0)});const c=d=>{d.button===0&&t.update(()=>{const u=M(),h=d.target;Ne(u)&&u.tableKey===s.tableNodeKey&&r.contains(h)&&s.clearHighlight()})};i.addEventListener("mousedown",c),s.listenersToRemove.add(()=>i.removeEventListener("mousedown",c)),s.listenersToRemove.add(t.registerCommand(wl,d=>Us(t,d,"down",n,s),vt)),s.listenersToRemove.add(t.registerCommand(vl,d=>Us(t,d,"up",n,s),vt)),s.listenersToRemove.add(t.registerCommand(bl,d=>Us(t,d,"backward",n,s),vt)),s.listenersToRemove.add(t.registerCommand(Ol,d=>Us(t,d,"forward",n,s),vt)),s.listenersToRemove.add(t.registerCommand(Al,d=>{const u=M();if(Ne(u)){const h=U(u.focus.getNode(),Z);if(Z(h))return Eo(d),h.selectEnd(),!0}return!1},vt)),[xl,Zo,Jn].forEach(d=>{s.listenersToRemove.add(t.registerCommand(d,(u=>()=>{const h=M();if(!Zn(h,n))return!1;if(Ne(h))return s.clearText(),!0;if(v(h)){const g=U(h.anchor.getNode(),S=>Z(S));if(!Z(g))return!1;const p=h.anchor.getNode(),_=h.focus.getNode(),y=n.isParentOf(p),m=n.isParentOf(_);if(y&&!m||m&&!y)return s.clearText(),!0;const C=U(h.anchor.getNode(),S=>A(S)),N=C&&U(C,S=>A(S)&&Z(S.getParent()));if(!A(N)||!A(C))return!1;if(u===Zo&&N.getPreviousSibling()===null)return!0}return!1})(d),ye))});const a=d=>{const u=M();if(!Zn(u,n)){const h=u?u.getNodes():null;if(h){const g=h.find(p=>De(p)&&p.getKey()===s.tableNodeKey);if(De(g)){if(!g.getParent())return!1;g.remove()}}return!1}if(Ne(u))return d&&(d.preventDefault(),d.stopPropagation()),s.clearText(),!0;if(v(u)){const h=U(u.anchor.getNode(),g=>Z(g));if(!Z(h))return!1}return!1};function f(d){const u=n.getCordsFromCellNode(d,s.table);return n.getDOMCellFromCordsOrThrow(u.x,u.y,s.table)}return s.listenersToRemove.add(t.registerCommand(Ml,a,ye)),s.listenersToRemove.add(t.registerCommand(Dl,a,ye)),s.listenersToRemove.add(t.registerCommand(Tl,d=>{const u=M();if(u){if(!Ne(u)&&!v(u))return!1;cr(t,lt(d,ClipboardEvent)?d:null,fm(u));const h=a(d);return v(u)&&u.removeText(),h}return!1},ye)),s.listenersToRemove.add(t.registerCommand(Gn,d=>{const u=M();if(!Zn(u,n))return!1;if(Ne(u))return s.formatCells(d),!0;if(v(u)){const h=U(u.anchor.getNode(),g=>Z(g));if(!Z(h))return!1}return!1},ye)),s.listenersToRemove.add(t.registerCommand(Vn,d=>{const u=M();if(!Ne(u)||!Zn(u,n))return!1;const h=u.anchor.getNode(),g=u.focus.getNode();if(!Z(h)||!Z(g))return!1;const[p,_,y]=Vt(n,h,g),m=Math.max(_.startRow,y.startRow),C=Math.max(_.startColumn,y.startColumn),N=Math.min(_.startRow,y.startRow),S=Math.min(_.startColumn,y.startColumn);for(let T=N;T<=m;T++)for(let b=S;b<=C;b++){const x=p[T][b].cell;x.setFormat(d);const w=x.getChildren();for(let O=0;O<w.length;O++){const D=w[O];A(D)&&!D.isInline()&&D.setFormat(d)}}return!0},ye)),s.listenersToRemove.add(t.registerCommand(Nl,d=>{const u=M();if(!Zn(u,n))return!1;if(Ne(u))return s.clearHighlight(),!1;if(v(u)){const h=U(u.anchor.getNode(),g=>Z(g));if(!Z(h))return!1;if(typeof d=="string"){const g=Qm(t,u,n);if(g)return qm(g,n,[bt(d)]),!0}}return!1},ye)),o&&s.listenersToRemove.add(t.registerCommand($p,d=>{const u=M();if(!v(u)||!u.isCollapsed()||!Zn(u,n))return!1;const h=lc(u.anchor.getNode());if(h===null)return!1;Eo(d);const g=n.getCordsFromCellNode(h,s.table);return Vm(s,n,g.x,g.y,d.shiftKey?"backward":"forward"),!0},ye)),s.listenersToRemove.add(t.registerCommand(Dp,d=>n.isSelected(),vt)),s.listenersToRemove.add(t.registerCommand(Rl,d=>{const{nodes:u,selection:h}=d,g=h.getStartEndPoints(),p=Ne(h),_=v(h)&&U(h.anchor.getNode(),se=>Z(se))!==null&&U(h.focus.getNode(),se=>Z(se))!==null||p;if(u.length!==1||!De(u[0])||!_||g===null)return!1;const[y]=g,m=u[0],C=m.getChildren(),N=m.getFirstChildOrThrow().getChildrenSize(),S=m.getChildrenSize(),T=U(y.getNode(),se=>Z(se)),b=T&&U(T,se=>Re(se)),x=b&&U(b,se=>De(se));if(!Z(T)||!Re(b)||!De(x))return!1;const w=b.getIndexWithinParent(),O=Math.min(x.getChildrenSize()-1,w+S-1),D=T.getIndexWithinParent(),B=Math.min(b.getChildrenSize()-1,D+N-1),Y=Math.min(D,B),J=Math.min(w,O),V=Math.max(D,B),re=Math.max(w,O),F=x.getChildren();let ce=0;for(let se=J;se<=re;se++){const We=F[se];if(!Re(We))return!1;const ue=C[ce];if(!Re(ue))return!1;const Ae=We.getChildren(),Ge=ue.getChildren();let Xe=0;for(let qe=Y;qe<=V;qe++){const Te=Ae[qe];if(!Z(Te))return!1;const nt=Ge[Xe];if(!Z(nt))return!1;const ze=Te.getChildren();nt.getChildren().forEach(ve=>{L(ve)&&ie().append(ve),Te.append(ve)}),ze.forEach(ve=>ve.remove()),Xe++}ce++}return!0},ye)),s.listenersToRemove.add(t.registerCommand(zt,()=>{const d=M(),u=Hn();if(v(d)){const{anchor:h,focus:g}=d,p=h.getNode(),_=g.getNode(),y=lc(p),m=lc(_),C=!(!y||!n.is(xo(y))),N=!(!m||!n.is(xo(m))),S=C!==N,T=C&&N,b=d.isBackward();if(S){const x=d.clone();if(N){const[w]=Vt(n,m,m),O=w[0][0].cell,D=w[w.length-1].at(-1).cell;x.focus.set(b?O.getKey():D.getKey(),b?O.getChildrenSize():D.getChildrenSize(),"element")}Pe(x),Jm(t,s)}else T&&(y.is(m)||(s.setAnchorCellForSelection(f(y)),s.setFocusCellForSelection(f(m),!0),s.isSelecting||setTimeout(()=>{const{onMouseUp:x,onMouseMove:w}=l();s.isSelecting=!0,i.addEventListener("mouseup",x),i.addEventListener("mousemove",w)},0)))}else if(d&&Ne(d)&&d.is(u)&&d.tableKey===n.getKey()){const h=Ym(t._window);if(h&&h.anchorNode&&h.focusNode){const g=be(h.focusNode),p=g&&!n.is(xo(g)),_=be(h.anchorNode),y=_&&n.is(xo(_));if(p&&y&&h.rangeCount>0){const m=_p(h,t);m&&(m.anchor.set(n.getKey(),d.isBackward()?n.getChildrenSize():0,"element"),h.removeAllRanges(),Pe(m))}}}return d&&!d.is(u)&&(Ne(d)||Ne(u))&&s.tableSelection&&!s.tableSelection.is(u)?(Ne(d)&&d.tableKey===s.tableNodeKey?s.updateTableTableSelection(d):!Ne(d)&&Ne(u)&&u.tableKey===s.tableNodeKey&&s.updateTableTableSelection(null),!1):(s.hasHijackedSelectionStyles&&!n.isSelected()?function(h,g){g.enableHighlightStyle(),cf(g.table,p=>{const _=p.elem;p.highlighted=!1,Xm(h,p),_.getAttribute("style")||_.removeAttribute("style")})}(t,s):!s.hasHijackedSelectionStyles&&n.isSelected()&&Jm(t,s),!1)},ye)),s.listenersToRemove.add(t.registerCommand(er,()=>{const d=M();if(!v(d)||!d.isCollapsed()||!Zn(d,n))return!1;const u=Qm(t,d,n);return!!u&&(qm(u,n),!0)},ye)),s}function C0(n){return n[Hm]}function lf(n){let e=n;for(;e!=null;){const t=e.nodeName;if(t==="TD"||t==="TH"){const o=e._cell;return o===void 0?null:o}e=e.parentNode}return null}function Tr(n){const e=[],t={columns:0,domRows:e,rows:0};let o=n.firstChild,r=0,s=0;for(e.length=0;o!=null;){const i=o.nodeName;if(i==="TD"||i==="TH"){const a={elem:o,hasBackgroundColor:o.style.backgroundColor!=="",highlighted:!1,x:r,y:s};o._cell=a;let f=e[s];f===void 0&&(f=e[s]=[]),f[r]=a}else{const a=o.firstChild;if(a!=null){o=a;continue}}const l=o.nextSibling;if(l!=null){r++,o=l;continue}const c=o.parentNode;if(c!=null){const a=c.nextSibling;if(a==null)break;s++,r=0,o=a}}return t.columns=r+1,t.rows=s+1,t}function sc(n,e,t){const o=new Set(t?t.getNodes():[]);cf(e,(r,s)=>{const i=r.elem;o.has(s)?(r.highlighted=!0,Gm(n,r)):(r.highlighted=!1,Xm(n,r),i.getAttribute("style")||i.removeAttribute("style"))})}function cf(n,e){const{domRows:t}=n;for(let o=0;o<t.length;o++){const r=t[o];if(r)for(let s=0;s<r.length;s++){const i=r[s];if(!i)continue;const l=be(i.elem);l!==null&&e(i,l,{x:s,y:o})}}}function Jm(n,e){e.disableHighlightStyle(),cf(e.table,t=>{t.highlighted=!0,Gm(n,t)})}const Vm=(n,e,t,o,r)=>{const s=r==="forward";switch(r){case"backward":case"forward":return t!==(s?n.table.columns-1:0)?ic(e.getCellNodeFromCordsOrThrow(t+(s?1:-1),o,n.table),s):o!==(s?n.table.rows-1:0)?ic(e.getCellNodeFromCordsOrThrow(s?0:n.table.columns-1,o+(s?1:-1),n.table),s):s?e.selectNext():e.selectPrevious(),!0;case"up":return o!==0?ic(e.getCellNodeFromCordsOrThrow(t,o-1,n.table),!1):e.selectPrevious(),!0;case"down":return o!==n.table.rows-1?ic(e.getCellNodeFromCordsOrThrow(t,o+1,n.table),!0):e.selectNext(),!0;default:return!1}},N0=(n,e,t,o,r)=>{const s=r==="forward";switch(r){case"backward":case"forward":return t!==(s?n.table.columns-1:0)&&n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t+(s?1:-1),o,n.table)),!0;case"up":return o!==0&&(n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t,o-1,n.table)),!0);case"down":return o!==n.table.rows-1&&(n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t,o+1,n.table)),!0);default:return!1}};function Zn(n,e){if(v(n)||Ne(n)){const t=e.isParentOf(n.anchor.getNode()),o=e.isParentOf(n.focus.getNode());return t&&o}return!1}function ic(n,e){e?n.selectStart():n.selectEnd()}const af="172,206,247";function Gm(n,e){const t=e.elem,o=be(t);Z(o)||le(131),o.getBackgroundColor()===null?t.style.setProperty("background-color",`rgb(${af})`):t.style.setProperty("background-image",`linear-gradient(to right, rgba(${af},0.85), rgba(${af},0.85))`),t.style.setProperty("caret-color","transparent")}function Xm(n,e){const t=e.elem,o=be(t);Z(o)||le(131),o.getBackgroundColor()===null&&t.style.removeProperty("background-color"),t.style.removeProperty("background-image"),t.style.removeProperty("caret-color")}function lc(n){const e=U(n,Z);return Z(e)?e:null}function xo(n){const e=U(n,De);return De(e)?e:null}function Us(n,e,t,o,r){if((t==="up"||t==="down")&&function(i){const l=i.getRootElement();return l?l.hasAttribute("aria-controls")&&l.getAttribute("aria-controls")==="typeahead-menu":!1}(n))return!1;const s=M();if(!Zn(s,o)){if(v(s)){if(s.isCollapsed()&&t==="backward"){const i=s.anchor.type,l=s.anchor.offset;if(i!=="element"&&(i!=="text"||l!==0))return!1;const c=s.anchor.getNode();if(!c)return!1;const a=U(c,d=>A(d)&&!d.isInline());if(!a)return!1;const f=a.getPreviousSibling();return!(!f||!De(f))&&(Eo(e),f.selectEnd(),!0)}if(e.shiftKey&&(t==="up"||t==="down")){const i=s.focus.getNode();if(it(i)){const l=s.getNodes()[0];if(l){const c=U(l,Z);if(c&&o.isParentOf(c)){const a=o.getFirstDescendant(),f=o.getLastDescendant();if(!a||!f)return!1;const[d]=Nt(a),[u]=Nt(f),h=o.getCordsFromCellNode(d,r.table),g=o.getCordsFromCellNode(u,r.table),p=o.getDOMCellFromCordsOrThrow(h.x,h.y,r.table),_=o.getDOMCellFromCordsOrThrow(g.x,g.y,r.table);return r.setAnchorCellForSelection(p),r.setFocusCellForSelection(_,!0),!0}}return!1}{const l=U(i,a=>A(a)&&!a.isInline());if(!l)return!1;const c=t==="down"?l.getNextSibling():l.getPreviousSibling();if(De(c)&&r.tableNodeKey===c.getKey()){const a=c.getFirstDescendant(),f=c.getLastDescendant();if(!a||!f)return!1;const[d]=Nt(a),[u]=Nt(f),h=s.clone();return h.focus.set((t==="up"?d:u).getKey(),t==="up"?0:u.getChildrenSize(),"element"),Pe(h),!0}}}}return!1}if(v(s)&&s.isCollapsed()){const{anchor:i,focus:l}=s,c=U(i.getNode(),Z),a=U(l.getNode(),Z);if(!Z(c)||!c.is(a))return!1;const f=xo(c);if(f!==o&&f!=null){const y=n.getElementByKey(f.getKey());if(y!=null)return r.table=Tr(y),Us(n,e,t,f,r)}if(t==="backward"||t==="forward"){const y=i.type,m=i.offset,C=i.getNode();if(!C)return!1;const N=s.getNodes();return(N.length!==1||!st(N[0]))&&!!function(S,T,b,x){return function(w,O,D){return w==="element"&&(D==="backward"?O.getPreviousSibling()===null:O.getNextSibling()===null)}(S,b,x)||function(w,O,D,B){const Y=U(D,V=>A(V)&&!V.isInline());if(!Y)return!1;const J=B==="backward"?O===0:O===D.getTextContentSize();return w==="text"&&J&&(B==="backward"?Y.getPreviousSibling()===null:Y.getNextSibling()===null)}(S,T,b,x)}(y,m,C,t)&&function(S,T,b,x){const w=U(T,Z);if(!Z(w))return!1;const[O,D]=Vt(b,w,w);if(!function(Y,J,V){const re=Y[0][0],F=Y[Y.length-1][Y[0].length-1],{startColumn:ce,startRow:se}=J;return V==="backward"?ce===re.startColumn&&se===re.startRow:ce===F.startColumn&&se===F.startRow}(O,D,x))return!1;const B=function(Y,J,V){const re=U(Y,ce=>A(ce)&&!ce.isInline());if(!re)return;const F=J==="backward"?re.getPreviousSibling():re.getNextSibling();return F&&De(F)?F:J==="backward"?V.getPreviousSibling():V.getNextSibling()}(T,x,b);return!B||De(B)?!1:(Eo(S),x==="backward"?B.selectEnd():B.selectStart(),!0)}(e,C,o,t)}const d=n.getElementByKey(c.__key),u=n.getElementByKey(i.key);if(u==null||d==null)return!1;let h;if(i.type==="element")h=u.getBoundingClientRect();else{const y=window.getSelection();if(y===null||y.rangeCount===0)return!1;h=y.getRangeAt(0).getBoundingClientRect()}const g=t==="up"?c.getFirstChild():c.getLastChild();if(g==null)return!1;const p=n.getElementByKey(g.__key);if(p==null)return!1;const _=p.getBoundingClientRect();if(t==="up"?_.top>h.top-h.height:h.bottom+h.height>_.bottom){Eo(e);const y=o.getCordsFromCellNode(c,r.table);if(!e.shiftKey)return Vm(r,o,y.x,y.y,t);{const m=o.getDOMCellFromCordsOrThrow(y.x,y.y,r.table);r.setAnchorCellForSelection(m),r.setFocusCellForSelection(m,!0)}return!0}}else if(Ne(s)){const{anchor:i,focus:l}=s,c=U(i.getNode(),Z),a=U(l.getNode(),Z),[f]=s.getNodes(),d=n.getElementByKey(f.getKey());if(!Z(c)||!Z(a)||!De(f)||d==null)return!1;r.updateTableTableSelection(s);const u=Tr(d),h=o.getCordsFromCellNode(c,u),g=o.getDOMCellFromCordsOrThrow(h.x,h.y,u);if(r.setAnchorCellForSelection(g),Eo(e),e.shiftKey){const p=o.getCordsFromCellNode(a,u);return N0(r,f,p.x,p.y,t)}return a.selectEnd(),!0}return!1}function Eo(n){n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()}function qm(n,e,t){const o=ie();n==="first"?e.insertBefore(o):e.insertAfter(o),o.append(...t||[]),o.selectEnd()}function Qm(n,e,t){const o=t.getParent();if(!o)return;const r=n.getElementByKey(o.getKey());if(!r)return;const s=window.getSelection();if(!s||s.anchorNode!==r)return;const i=U(e.anchor.getNode(),_=>Z(_));if(!i)return;const l=U(i,_=>De(_));if(!De(l)||!l.is(t))return;const[c,a]=Vt(t,i,i),f=c[0][0],d=c[c.length-1][c[0].length-1],{startRow:u,startColumn:h}=a,g=u===f.startRow&&h===f.startColumn,p=u===d.startRow&&h===d.startColumn;return g?"first":p?"last":void 0}class js extends yt{static getType(){return"table"}static clone(e){return new js(e.__key)}static importDOM(){return{table:e=>({conversion:T0,priority:1})}}static importJSON(e){return cc()}constructor(e){super(e)}exportJSON(){return{...super.exportJSON(),type:"table",version:1}}createDOM(e,t){const o=document.createElement("table");return Ie(o,e.theme.table),o}updateDOM(){return!1}exportDOM(e){return{...super.exportDOM(e),after:t=>{if(t){const o=t.cloneNode(),r=document.createElement("colgroup"),s=document.createElement("tbody");qn(t)&&s.append(...t.children);const i=this.getFirstChildOrThrow();if(!Re(i))throw new Error("Expected to find row node.");const l=i.getChildrenSize();for(let c=0;c<l;c++){const a=document.createElement("col");r.append(a)}return o.replaceChildren(r,s),o}}}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:o,domRows:r}=t;for(let s=0;s<o;s++){const i=r[s];if(i==null)continue;const l=i.findIndex(c=>{if(!c)return;const{elem:a}=c;return be(a)===e});if(l!==-1)return{x:l,y:s}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,o){const{domRows:r}=o,s=r[t];if(s==null)return null;const i=s[e<s.length?e:s.length-1];return i??null}getDOMCellFromCordsOrThrow(e,t,o){const r=this.getDOMCellFromCords(e,t,o);if(!r)throw new Error("Cell not found at cords.");return r}getCellNodeFromCords(e,t,o){const r=this.getDOMCellFromCords(e,t,o);if(r==null)return null;const s=be(r.elem);return Z(s)?s:null}getCellNodeFromCordsOrThrow(e,t,o){const r=this.getCellNodeFromCords(e,t,o);if(!r)throw new Error("Node at cords not TableCellNode.");return r}canSelectBefore(){return!0}canIndent(){return!1}}function S0(n,e){const t=n.getElementByKey(e.getKey());if(t==null)throw new Error("Table Element Not Found");return Tr(t)}function T0(n){return{node:cc()}}function cc(){return rt(new js)}function De(n){return n instanceof js}const x0=Object.freeze(Object.defineProperty({__proto__:null,$computeTableMap:Vt,$computeTableMapSkipCellCheck:Um,$createTableCellNode:Dt,$createTableNode:cc,$createTableNodeWithDimensions:r0,$createTableRowNode:To,$createTableSelection:sf,$deleteTableColumn:h0,$deleteTableColumn__EXPERIMENTAL:p0,$deleteTableRow__EXPERIMENTAL:g0,$findCellNode:lc,$findTableNode:xo,$getElementForTableNode:S0,$getNodeTriplet:Nt,$getTableCellNodeFromLexicalNode:s0,$getTableCellNodeRect:rf,$getTableColumnIndexFromTableCellNode:l0,$getTableNodeFromLexicalNodeOrThrow:tf,$getTableRowIndexFromTableCellNode:i0,$getTableRowNodeFromTableCellNodeOrThrow:ef,$insertTableColumn:f0,$insertTableColumn__EXPERIMENTAL:d0,$insertTableRow:a0,$insertTableRow__EXPERIMENTAL:u0,$isTableCellNode:Z,$isTableNode:De,$isTableRowNode:Re,$isTableSelection:Ne,$removeTableRowAtIndex:c0,$unmergeCell:_0,INSERT_TABLE_COMMAND:e0,TableCellHeaderStates:_e,TableCellNode:Sr,TableNode:js,TableObserver:jm,TableRowNode:Ws,applyTableHandlers:y0,getDOMCellFromTarget:lf,getTableObserverFromTableElement:C0},Symbol.toStringTag,{value:"Module"})),Zm=(process.env.NODE_ENV==="development"?ZO:x0).$isTableSelection,ey=Object.freeze({" ":"\\t","\n":"\\n"}),ty=new RegExp(Object.keys(ey).join("|"),"g"),cn=Object.freeze({ancestorHasNextSibling:"|",ancestorIsLastChild:" ",hasNextSibling:"├",isLastChild:"└",selectedChar:"^",selectedLine:">"}),E0=[n=>n.hasFormat("bold")&&"Bold",n=>n.hasFormat("code")&&"Code",n=>n.hasFormat("italic")&&"Italic",n=>n.hasFormat("strikethrough")&&"Strikethrough",n=>n.hasFormat("subscript")&&"Subscript",n=>n.hasFormat("superscript")&&"Superscript",n=>n.hasFormat("underline")&&"Underline"],w0=[n=>n.hasTextFormat("bold")&&"Bold",n=>n.hasTextFormat("code")&&"Code",n=>n.hasTextFormat("italic")&&"Italic",n=>n.hasTextFormat("strikethrough")&&"Strikethrough",n=>n.hasTextFormat("subscript")&&"Subscript",n=>n.hasTextFormat("superscript")&&"Superscript",n=>n.hasTextFormat("underline")&&"Underline"],b0=[n=>n.isDirectionless()&&"Directionless",n=>n.isUnmergeable()&&"Unmergeable"],O0=[n=>n.isToken()&&"Token",n=>n.isSegmented()&&"Segmented"];function v0(n,e,t,o,r=!1){const s=n.getEditorState(),i=n._config,l=n._compositionKey,c=n._editable;if(t){let u="";return s.read(()=>{u=z0(Yl(n))}),u}let a=` root
44
- `;const f=s.read(()=>{const u=M();return ny(Oe(),(h,g)=>{const _=`(${h.getKey()})`,y=h.getType()||"",m=h.isSelected();a+=`${m?cn.selectedLine:" "} ${g.join(" ")} ${_} ${y} ${k0(h,o,r)}
45
- `,a+=W0({indent:g,isSelected:m,node:h,nodeKeyDisplay:_,selection:u,typeDisplay:y})}),u===null?": null":v(u)?M0(u):Zm(u)?A0(u):D0(u)});if(a+=`
39
+ `?c.insertParagraph():a===" "?c.insertNodes([hl()]):c.insertText(a)}}}else e.insertRawText(s)}function $u(n,e,t){n.dispatchCommand(kl,{nodes:e,selection:t})||t.insertNodes(e)}function lm(n,e,t,r=[]){let o=e===null||t.isSelected(e);const s=A(t)&&t.excludeFromCopy("html");let i=t;if(e!==null){let a=Un(t);a=L(a)&&e!==null?Kl(e,a):a,i=a}const l=A(i)?i.getChildren():[],c=function(a){const f=a.exportJSON(),d=a.constructor;if(f.type!==d.getType()&&Yl(58,d.name),A(a)){const u=f.children;Array.isArray(u)||Yl(59,d.name)}return f}(i);if(L(i)){const a=i.__text;a.length>0?c.text=a:o=!1}for(let a=0;a<l.length;a++){const f=l[a],d=lm(n,e,f,c.children);!o&&A(t)&&d&&t.extractWithChild(f,e,"clone")&&(o=!0)}if(o&&!s)r.push(c);else if(Array.isArray(c.children))for(let a=0;a<c.children.length;a++){const f=c.children[a];r.push(f)}return o}function cm(n,e){const t=[],r=Oe().getChildren();for(let o=0;o<r.length;o++)lm(n,e,r[o],t);return{namespace:n._config.namespace,nodes:t}}function am(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t],o=Ep(r);L(o)&&p_(o),e.push(o)}return e}let lo=null;async function Tb(n,e,t){if(lo!==null)return!1;if(e!==null)return new Promise((c,a)=>{n.update(()=>{c(um(n,e,t))})});const r=n.getRootElement(),o=n._window==null?window.document:n._window.document,s=om(n._window);if(r===null||s===null)return!1;const i=o.createElement("span");i.style.cssText="position: fixed; top: -1000px;",i.append(o.createTextNode("#")),r.append(i);const l=new Range;return l.setStart(i,0),l.setEnd(i,1),s.removeAllRanges(),s.addRange(l),new Promise((c,a)=>{const f=n.registerCommand(Nl,d=>(lt(d,ClipboardEvent)&&(f(),lo!==null&&(window.clearTimeout(lo),lo=null),c(um(n,d,t))),!0),ye);lo=window.setTimeout(()=>{f(),lo=null,c(!1)},50),o.execCommand("copy"),i.remove()})}function um(n,e,t){if(t===void 0){const o=om(n._window);if(!o)return!1;const s=o.anchorNode,i=o.focusNode;if(s!==null&&i!==null&&!Hp(n,s,i))return!1;const l=M();if(l===null)return!1;t=fm(l)}e.preventDefault();const r=e.clipboardData;return r!==null&&(dm(r,t),!0)}const xb=[["text/html",sm],["application/x-lexical-editor",im]];function fm(n=M()){const e={"text/plain":n?n.getTextContent():""};if(n){const t=Np();for(const[r,o]of xb){const s=o(t,n);s!==null&&(e[r]=s)}}return e}function dm(n,e){for(const t in e){const r=e[t];r!==void 0&&n.setData(t,r)}}const Eb=Object.freeze(Object.defineProperty({__proto__:null,$generateJSONFromSelectedNodes:cm,$generateNodesFromSerializedNodes:am,$getClipboardDataFromSelection:fm,$getHtmlContent:sm,$getLexicalContent:im,$insertDataTransferForPlainText:Nb,$insertDataTransferForRichText:Sb,$insertGeneratedNodes:$u,copyToClipboard:Tb,setLexicalClipboardDataTransfer:dm},Symbol.toStringTag,{value:"Module"})),Pu=process.env.NODE_ENV==="development"?mb:Eb,hm=Pu.$getClipboardDataFromSelection,Jl=Pu.$insertDataTransferForRichText,co=Pu.copyToClipboard;function gm(n,e){if(typeof document.caretRangeFromPoint<"u"){const t=document.caretRangeFromPoint(n,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}else if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(n,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}else return null}const ao=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",wb=ao&&"documentMode"in document?document.documentMode:null,bb=ao&&"InputEvent"in window&&!wb?"getTargetRanges"in new window.InputEvent("input"):!1,Ob=ao&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),vb=ao&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Mb=ao&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Db=ao&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Mb,Iu=no("DRAG_DROP_PASTE_FILE");class Es extends yt{static getType(){return"quote"}static clone(e){return new Es(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return Ie(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:kb,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&qn(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();t.style.textAlign=r;const o=this.getDirection();o&&(t.dir=o)}return{element:t}}static importJSON(e){const t=Lu();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,t){const r=ie(),o=this.getDirection();return r.setDirection(o),this.insertAfter(r,t),r}collapseAtStart(){const e=ie();return this.getChildren().forEach(r=>e.append(r)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Lu(){return ot(new Es)}function Ab(n){return n instanceof Es}class ws extends yt{static getType(){return"heading"}static clone(e){return new ws(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}createDOM(e){const t=this.__tag,r=document.createElement(t),s=e.theme.heading;if(s!==void 0){const i=s[t];Ie(r,i)}return r}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:uo,priority:0}),h2:e=>({conversion:uo,priority:0}),h3:e=>({conversion:uo,priority:0}),h4:e=>({conversion:uo,priority:0}),h5:e=>({conversion:uo,priority:0}),h6:e=>({conversion:uo,priority:0}),p:e=>{const r=e.firstChild;return r!==null&&pm(r)?{conversion:()=>({node:null}),priority:3}:null},span:e=>pm(e)?{conversion:t=>({node:fo("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&qn(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();t.style.textAlign=r;const o=this.getDirection();o&&(t.dir=o)}return{element:t}}static importJSON(e){const t=fo(e.tag);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){const r=e?e.anchor.offset:0,o=this.getLastDescendant(),i=!o||e&&e.anchor.key===o.getKey()&&r===o.getTextContentSize()||!e?ie():fo(this.getTag()),l=this.getDirection();if(i.setDirection(l),this.insertAfter(i,t),r===0&&!this.isEmpty()&&e){const c=ie();c.select(),this.replace(c,!0)}return i}collapseAtStart(){const e=this.isEmpty()?ie():fo(this.getTag());return this.getChildren().forEach(r=>e.append(r)),this.replace(e),!0}extractWithChild(){return!0}}function pm(n){return n.nodeName.toLowerCase()==="span"?n.style.fontSize==="26pt":!1}function uo(n){const e=n.nodeName.toLowerCase();let t=null;return(e==="h1"||e==="h2"||e==="h3"||e==="h4"||e==="h5"||e==="h6")&&(t=fo(e),n.style!==null&&t.setFormat(n.style.textAlign)),{node:t}}function kb(n){const e=Lu();return n.style!==null&&e.setFormat(n.style.textAlign),{node:e}}function fo(n){return ot(new ws(n))}function Rb(n){return n instanceof ws}function $b(n,e){n.preventDefault(),e.update(()=>{const t=M(),r=lt(n,InputEvent)||lt(n,KeyboardEvent)?null:n.clipboardData;r!=null&&t!==null&&Jl(r,t,e)},{tag:"paste"})}async function Pb(n,e){await co(e,lt(n,ClipboardEvent)?n:null),e.update(()=>{const t=M();v(t)?t.removeText():Ve(t)&&t.getNodes().forEach(r=>r.remove())})}function bs(n){let e=null;if(lt(n,DragEvent)?e=n.dataTransfer:lt(n,ClipboardEvent)&&(e=n.clipboardData),e===null)return[!1,[],!1];const t=e.types,r=t.includes("Files"),o=t.includes("text/html")||t.includes("text/plain");return[r,Array.from(e.files),o]}function _m(n){const e=M();if(!v(e))return!1;const t=new Set,r=e.getNodes();for(let o=0;o<r.length;o++){const s=r[o],i=s.getKey();if(t.has(i))continue;const l=z(s,a=>A(a)&&!a.isInline());if(l===null)continue;const c=l.getKey();l.canIndent()&&!t.has(c)&&(t.add(c),n(l))}return t.size>0}function Vl(n){const e=be(n);return st(e)}function Ib(n){const e=n.focus;return e.key==="root"&&e.offset===Oe().getChildrenSize()}function Lb(n){return Nn(n.registerCommand(vp,t=>{const r=M();return Ve(r)?(r.clear(),!0):!1},0),n.registerCommand(Jn,t=>{const r=M();return v(r)?(r.deleteCharacter(t),!0):!1},V),n.registerCommand(Tl,t=>{const r=M();return v(r)?(r.deleteWord(t),!0):!1},V),n.registerCommand(Zr,t=>{const r=M();return v(r)?(r.deleteLine(t),!0):!1},V),n.registerCommand(Cl,t=>{const r=M();if(typeof t=="string")r!==null&&r.insertText(t);else{if(r===null)return!1;const o=t.dataTransfer;if(o!=null)Jl(o,r,n);else if(v(r)){const s=t.data;return s&&r.insertText(s),!0}}return!0},V),n.registerCommand(Fp,()=>{const t=M();return v(t)?(t.removeText(),!0):!1},V),n.registerCommand(Gn,t=>{const r=M();return v(r)?(r.formatText(t),!0):!1},V),n.registerCommand(Vn,t=>{const r=M();if(!v(r)&&!Ve(r))return!1;const o=r.getNodes();for(const s of o){const i=z(s,l=>A(l)&&!l.isInline());i!==null&&i.setFormat(t)}return!0},V),n.registerCommand(xl,t=>{const r=M();return v(r)?(r.insertLineBreak(t),!0):!1},V),n.registerCommand(eo,()=>{const t=M();return v(t)?(t.insertParagraph(),!0):!1},V),n.registerCommand($p,()=>(Tp([hl()]),!0),V),n.registerCommand(Rp,()=>_m(t=>{const r=t.getIndent();t.setIndent(r+1)}),V),n.registerCommand(Al,()=>_m(t=>{const r=t.getIndent();r>0&&t.setIndent(r-1)}),V),n.registerCommand(Ol,t=>{const r=M();if(Ve(r)&&!Vl(t.target)){const o=r.getNodes();if(o.length>0)return o[0].selectPrevious(),!0}else if(v(r)){const o=Xr(r.focus,!0);if(!t.shiftKey&&st(o)&&!o.isIsolated()&&!o.isInline())return o.selectPrevious(),t.preventDefault(),!0}return!1},V),n.registerCommand(El,t=>{const r=M();if(Ve(r)){const o=r.getNodes();if(o.length>0)return o[0].selectNext(0,0),!0}else if(v(r)){if(Ib(r))return t.preventDefault(),!0;const o=Xr(r.focus,!1);if(!t.shiftKey&&st(o)&&!o.isIsolated()&&!o.isInline())return o.selectNext(),t.preventDefault(),!0}return!1},V),n.registerCommand(wl,t=>{const r=M();if(Ve(r)){const o=r.getNodes();if(o.length>0)return t.preventDefault(),o[0].selectPrevious(),!0}if(!v(r))return!1;if(Bl(r,!0)){const o=t.shiftKey;return t.preventDefault(),Fl(r,o,!0),!0}return!1},V),n.registerCommand(bl,t=>{const r=M();if(Ve(r)&&!Vl(t.target)){const s=r.getNodes();if(s.length>0)return t.preventDefault(),s[0].selectNext(0,0),!0}if(!v(r))return!1;const o=t.shiftKey;return Bl(r,!1)?(t.preventDefault(),Fl(r,o,!1),!0):!1},V),n.registerCommand(vl,t=>{if(Vl(t.target))return!1;const r=M();if(!v(r))return!1;t.preventDefault();const{anchor:o}=r,s=o.getNode();return r.isCollapsed()&&o.offset===0&&!Yn(s)&&A_(s).getIndent()>0?n.dispatchCommand(Al,void 0):n.dispatchCommand(Jn,!0)},V),n.registerCommand(Ml,t=>{if(Vl(t.target))return!1;const r=M();return v(r)?(t.preventDefault(),n.dispatchCommand(Jn,!1)):!1},V),n.registerCommand(Pp,t=>{const r=M();if(!v(r))return!1;if(t!==null){if((vb||Ob||Db)&&bb)return!1;if(t.preventDefault(),t.shiftKey)return n.dispatchCommand(xl,!1)}return n.dispatchCommand(eo,void 0)},V),n.registerCommand(Dl,()=>{const t=M();return v(t)?(n.blur(),!0):!1},V),n.registerCommand(Ap,t=>{const[,r]=bs(t);if(r.length>0){const s=t.clientX,i=t.clientY,l=gm(s,i);if(l!==null){const{offset:c,node:a}=l,f=be(a);if(f!==null){const d=dl();if(L(f))d.anchor.set(f.getKey(),c,"text"),d.focus.set(f.getKey(),c,"text");else{const h=f.getParentOrThrow().getKey(),g=f.getIndexWithinParent()+1;d.anchor.set(h,g,"element"),d.focus.set(h,g,"element")}const u=_l(d);Pe(u)}n.dispatchCommand(Iu,r)}return t.preventDefault(),!0}const o=M();return!!v(o)},V),n.registerCommand(Dp,t=>{const[r]=bs(t),o=M();return!(r&&!v(o))},V),n.registerCommand(Mp,t=>{const[r]=bs(t),o=M();if(r&&!v(o))return!1;const s=t.clientX,i=t.clientY,l=gm(s,i);if(l!==null){const c=be(l.node);st(c)&&t.preventDefault()}return!0},V),n.registerCommand(Bp,()=>(wp(),!0),V),n.registerCommand(Nl,t=>(co(n,lt(t,ClipboardEvent)?t:null),!0),V),n.registerCommand(Sl,t=>(Pb(t,n),!0),V),n.registerCommand(Lp,t=>{const[,r,o]=bs(t);return r.length>0&&!o?(n.dispatchCommand(Iu,r),!0):Up(t.target)?!1:M()!==null?($b(t,n),!0):!1},V))}const Fb=Object.freeze(Object.defineProperty({__proto__:null,$createHeadingNode:fo,$createQuoteNode:Lu,$isHeadingNode:Rb,$isQuoteNode:Ab,DRAG_DROP_PASTE:Iu,HeadingNode:ws,QuoteNode:Es,eventFiles:bs,registerRichText:Lb},Symbol.toStringTag,{value:"Module"}));function mm(n,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(n,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(n,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const ho=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Bb=ho&&"documentMode"in document?document.documentMode:null,Kb=!(!ho||!("InputEvent"in window)||Bb)&&"getTargetRanges"in new window.InputEvent("input"),Wb=ho&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),zb=ho&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,jb=ho&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ub=ho&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!jb,Fu=no("DRAG_DROP_PASTE_FILE");class Os extends yt{static getType(){return"quote"}static clone(e){return new Os(e.__key)}constructor(e){super(e)}createDOM(e){const t=document.createElement("blockquote");return Ie(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:Yb,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&qn(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();t.style.textAlign=r;const o=this.getDirection();o&&(t.dir=o)}return{element:t}}static importJSON(e){const t=Bu();return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),type:"quote"}}insertNewAfter(e,t){const r=ie(),o=this.getDirection();return r.setDirection(o),this.insertAfter(r,t),r}collapseAtStart(){const e=ie();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function Bu(){return ot(new Os)}function Hb(n){return n instanceof Os}class vs extends yt{static getType(){return"heading"}static clone(e){return new vs(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}createDOM(e){const t=this.__tag,r=document.createElement(t),o=e.theme.heading;if(o!==void 0){const s=o[t];Ie(r,s)}return r}updateDOM(e,t){return!1}static importDOM(){return{h1:e=>({conversion:go,priority:0}),h2:e=>({conversion:go,priority:0}),h3:e=>({conversion:go,priority:0}),h4:e=>({conversion:go,priority:0}),h5:e=>({conversion:go,priority:0}),h6:e=>({conversion:go,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&ym(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>ym(e)?{conversion:t=>({node:po("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&qn(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();t.style.textAlign=r;const o=this.getDirection();o&&(t.dir=o)}return{element:t}}static importJSON(e){const t=po(e.tag);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),tag:this.getTag(),type:"heading",version:1}}insertNewAfter(e,t=!0){const r=e?e.anchor.offset:0,o=this.getLastDescendant(),s=!o||e&&e.anchor.key===o.getKey()&&r===o.getTextContentSize()||!e?ie():po(this.getTag()),i=this.getDirection();if(s.setDirection(i),this.insertAfter(s,t),r===0&&!this.isEmpty()&&e){const l=ie();l.select(),this.replace(l,!0)}return s}collapseAtStart(){const e=this.isEmpty()?ie():po(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function ym(n){return n.nodeName.toLowerCase()==="span"&&n.style.fontSize==="26pt"}function go(n){const e=n.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=po(e),n.style!==null&&t.setFormat(n.style.textAlign)),{node:t}}function Yb(n){const e=Bu();return n.style!==null&&e.setFormat(n.style.textAlign),{node:e}}function po(n){return ot(new vs(n))}function Jb(n){return n instanceof vs}function Ms(n){let e=null;if(lt(n,DragEvent)?e=n.dataTransfer:lt(n,ClipboardEvent)&&(e=n.clipboardData),e===null)return[!1,[],!1];const t=e.types,r=t.includes("Files"),o=t.includes("text/html")||t.includes("text/plain");return[r,Array.from(e.files),o]}function Cm(n){const e=M();if(!v(e))return!1;const t=new Set,r=e.getNodes();for(let o=0;o<r.length;o++){const s=r[o],i=s.getKey();if(t.has(i))continue;const l=z(s,a=>A(a)&&!a.isInline());if(l===null)continue;const c=l.getKey();l.canIndent()&&!t.has(c)&&(t.add(c),n(l))}return t.size>0}function Gl(n){const e=be(n);return st(e)}function Vb(n){return Nn(n.registerCommand(vp,e=>{const t=M();return!!Ve(t)&&(t.clear(),!0)},0),n.registerCommand(Jn,e=>{const t=M();return!!v(t)&&(t.deleteCharacter(e),!0)},V),n.registerCommand(Tl,e=>{const t=M();return!!v(t)&&(t.deleteWord(e),!0)},V),n.registerCommand(Zr,e=>{const t=M();return!!v(t)&&(t.deleteLine(e),!0)},V),n.registerCommand(Cl,e=>{const t=M();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const r=e.dataTransfer;if(r!=null)Jl(r,t,n);else if(v(t)){const o=e.data;return o&&t.insertText(o),!0}}return!0},V),n.registerCommand(Fp,()=>{const e=M();return!!v(e)&&(e.removeText(),!0)},V),n.registerCommand(Gn,e=>{const t=M();return!!v(t)&&(t.formatText(e),!0)},V),n.registerCommand(Vn,e=>{const t=M();if(!v(t)&&!Ve(t))return!1;const r=t.getNodes();for(const o of r){const s=z(o,i=>A(i)&&!i.isInline());s!==null&&s.setFormat(e)}return!0},V),n.registerCommand(xl,e=>{const t=M();return!!v(t)&&(t.insertLineBreak(e),!0)},V),n.registerCommand(eo,()=>{const e=M();return!!v(e)&&(e.insertParagraph(),!0)},V),n.registerCommand($p,()=>(Tp([hl()]),!0),V),n.registerCommand(Rp,()=>Cm(e=>{const t=e.getIndent();e.setIndent(t+1)}),V),n.registerCommand(Al,()=>Cm(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),V),n.registerCommand(Ol,e=>{const t=M();if(Ve(t)&&!Gl(e.target)){const r=t.getNodes();if(r.length>0)return r[0].selectPrevious(),!0}else if(v(t)){const r=Xr(t.focus,!0);if(!e.shiftKey&&st(r)&&!r.isIsolated()&&!r.isInline())return r.selectPrevious(),e.preventDefault(),!0}return!1},V),n.registerCommand(El,e=>{const t=M();if(Ve(t)){const r=t.getNodes();if(r.length>0)return r[0].selectNext(0,0),!0}else if(v(t)){if(function(o){const s=o.focus;return s.key==="root"&&s.offset===Oe().getChildrenSize()}(t))return e.preventDefault(),!0;const r=Xr(t.focus,!1);if(!e.shiftKey&&st(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),e.preventDefault(),!0}return!1},V),n.registerCommand(wl,e=>{const t=M();if(Ve(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectPrevious(),!0}if(!v(t))return!1;if(Bl(t,!0)){const r=e.shiftKey;return e.preventDefault(),Fl(t,r,!0),!0}return!1},V),n.registerCommand(bl,e=>{const t=M();if(Ve(t)&&!Gl(e.target)){const o=t.getNodes();if(o.length>0)return e.preventDefault(),o[0].selectNext(0,0),!0}if(!v(t))return!1;const r=e.shiftKey;return!!Bl(t,!1)&&(e.preventDefault(),Fl(t,r,!1),!0)},V),n.registerCommand(vl,e=>{if(Gl(e.target))return!1;const t=M();if(!v(t))return!1;e.preventDefault();const{anchor:r}=t,o=r.getNode();return t.isCollapsed()&&r.offset===0&&!Yn(o)&&A_(o).getIndent()>0?n.dispatchCommand(Al,void 0):n.dispatchCommand(Jn,!0)},V),n.registerCommand(Ml,e=>{if(Gl(e.target))return!1;const t=M();return!!v(t)&&(e.preventDefault(),n.dispatchCommand(Jn,!1))},V),n.registerCommand(Pp,e=>{const t=M();if(!v(t))return!1;if(e!==null){if((zb||Wb||Ub)&&Kb)return!1;if(e.preventDefault(),e.shiftKey)return n.dispatchCommand(xl,!1)}return n.dispatchCommand(eo,void 0)},V),n.registerCommand(Dl,()=>{const e=M();return!!v(e)&&(n.blur(),!0)},V),n.registerCommand(Ap,e=>{const[,t]=Ms(e);if(t.length>0){const o=mm(e.clientX,e.clientY);if(o!==null){const{offset:s,node:i}=o,l=be(i);if(l!==null){const c=dl();if(L(l))c.anchor.set(l.getKey(),s,"text"),c.focus.set(l.getKey(),s,"text");else{const f=l.getParentOrThrow().getKey(),d=l.getIndexWithinParent()+1;c.anchor.set(f,d,"element"),c.focus.set(f,d,"element")}const a=_l(c);Pe(a)}n.dispatchCommand(Fu,t)}return e.preventDefault(),!0}const r=M();return!!v(r)},V),n.registerCommand(Dp,e=>{const[t]=Ms(e),r=M();return!(t&&!v(r))},V),n.registerCommand(Mp,e=>{const[t]=Ms(e),r=M();if(t&&!v(r))return!1;const o=mm(e.clientX,e.clientY);if(o!==null){const s=be(o.node);st(s)&&e.preventDefault()}return!0},V),n.registerCommand(Bp,()=>(wp(),!0),V),n.registerCommand(Nl,e=>(co(n,lt(e,ClipboardEvent)?e:null),!0),V),n.registerCommand(Sl,e=>(async function(t,r){await co(r,lt(t,ClipboardEvent)?t:null),r.update(()=>{const o=M();v(o)?o.removeText():Ve(o)&&o.getNodes().forEach(s=>s.remove())})}(e,n),!0),V),n.registerCommand(Lp,e=>{const[,t,r]=Ms(e);return t.length>0&&!r?(n.dispatchCommand(Fu,t),!0):Up(e.target)?!1:M()!==null&&(function(o,s){o.preventDefault(),s.update(()=>{const i=M(),l=lt(o,InputEvent)||lt(o,KeyboardEvent)?null:o.clipboardData;l!=null&&i!==null&&Jl(l,i,s)},{tag:"paste"})}(e,n),!0)},V))}const Gb=Object.freeze(Object.defineProperty({__proto__:null,$createHeadingNode:po,$createQuoteNode:Bu,$isHeadingNode:Jb,$isQuoteNode:Hb,DRAG_DROP_PASTE:Fu,HeadingNode:vs,QuoteNode:Os,eventFiles:Ms,registerRichText:Vb},Symbol.toStringTag,{value:"Module"})),Xb=(process.env.NODE_ENV==="development"?Fb:Gb).registerRichText,Ku=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?I.useLayoutEffect:I.useEffect;function Nm(n){return n.getEditorState().read(Qp(n.isComposing()))}function qb({contentEditable:n,placeholder:e=null,ErrorBoundary:t}){const[r]=Xn(),o=function(s,i){const[l,c]=I.useState(()=>s.getDecorators());return Ku(()=>s.registerDecoratorListener(a=>{mf.flushSync(()=>{c(a)})}),[s]),I.useEffect(()=>{c(s.getDecorators())},[s]),I.useMemo(()=>{const a=[],f=Object.keys(l);for(let d=0;d<f.length;d++){const u=f[d],h=W.exports.jsx(i,{onError:p=>s._onError(p),children:W.exports.jsx(I.Suspense,{fallback:null,children:l[u]})}),g=s.getElementByKey(u);g!==null&&a.push(mf.createPortal(h,g,u))}return a},[i,l,s])}(r,t);return function(s){Ku(()=>Nn(Xb(s),Zw(s)),[s])}(r),W.exports.jsxs(W.exports.Fragment,{children:[n,W.exports.jsx(Qb,{content:e}),o]})}function Qb({content:n}){const[e]=Xn(),t=function(o){const[s,i]=I.useState(()=>Nm(o));return Ku(()=>{function l(){const c=Nm(o);i(c)}return l(),Nn(o.registerUpdateListener(()=>{l()}),o.registerEditableListener(()=>{l()}))},[o]),s}(e),r=Vw();return t?typeof n=="function"?n(r):n:null}function Wu(n,e){return Wu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},Wu(n,e)}var Sm={error:null},Zb=function(n){var e,t;function r(){for(var s,i=arguments.length,l=new Array(i),c=0;c<i;c++)l[c]=arguments[c];return(s=n.call.apply(n,[this].concat(l))||this).state=Sm,s.resetErrorBoundary=function(){for(var a,f=arguments.length,d=new Array(f),u=0;u<f;u++)d[u]=arguments[u];s.props.onReset==null||(a=s.props).onReset.apply(a,d),s.reset()},s}t=n,(e=r).prototype=Object.create(t.prototype),e.prototype.constructor=e,Wu(e,t),r.getDerivedStateFromError=function(s){return{error:s}};var o=r.prototype;return o.reset=function(){this.setState(Sm)},o.componentDidCatch=function(s,i){var l,c;(l=(c=this.props).onError)==null||l.call(c,s,i)},o.componentDidUpdate=function(s,i){var l,c,a,f,d=this.state.error,u=this.props.resetKeys;d!==null&&i.error!==null&&((a=s.resetKeys)===void 0&&(a=[]),(f=u)===void 0&&(f=[]),a.length!==f.length||a.some(function(h,g){return!Object.is(h,f[g])}))&&((l=(c=this.props).onResetKeysChange)==null||l.call(c,s.resetKeys,u),this.reset())},o.render=function(){var s=this.state.error,i=this.props,l=i.fallbackRender,c=i.FallbackComponent,a=i.fallback;if(s!==null){var f={error:s,resetErrorBoundary:this.resetErrorBoundary};if(Hs.isValidElement(a))return a;if(typeof l=="function")return l(f);if(c)return Hs.createElement(c,f);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},r}(Hs.Component);function eO({children:n,onError:e}){return W.exports.jsx(Zb,{fallback:W.exports.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:n})}const tO={code:"editor-code",heading:{h1:"editor-heading-h1",h2:"editor-heading-h2",h3:"editor-heading-h3",h4:"editor-heading-h4",h5:"editor-heading-h5"},image:"editor-image",link:"editor-link",list:{listitem:"editor-listitem",nested:{listitem:"editor-nested-listitem"},ol:"editor-list-ol",ul:"editor-list-ul"},ltr:"ltr",paragraph:"editor-paragraph",placeholder:"editor-placeholder",quote:"editor-quote",rtl:"rtl",text:{bold:"editor-text-bold",code:"editor-text-code",hashtag:"editor-text-hashtag",italic:"editor-text-italic",overflowed:"editor-text-overflowed",strikethrough:"editor-text-strikethrough",underline:"editor-text-underline",underlineStrikethrough:"editor-text-underlineStrikethrough"}},zu=1;function Tm(){return W.exports.jsx("div",{className:"divider"})}function nO(){const[n]=Xn(),e=I.useRef(null),[t,r]=I.useState(!1),[o,s]=I.useState(!1),[i,l]=I.useState(!1),[c,a]=I.useState(!1),[f,d]=I.useState(!1),[u,h]=I.useState(!1),g=I.useCallback(()=>{const p=M();v(p)&&(l(p.hasFormat("bold")),a(p.hasFormat("italic")),d(p.hasFormat("underline")),h(p.hasFormat("strikethrough")))},[]);return I.useEffect(()=>Nn(n.registerUpdateListener(({editorState:p})=>{p.read(()=>{g()})}),n.registerCommand(Wt,(p,_)=>(g(),!1),zu),n.registerCommand(yn,p=>(r(p),!1),zu),n.registerCommand(mn,p=>(s(p),!1),zu)),[n,g]),W.exports.jsxs("div",{className:"toolbar",ref:e,children:[W.exports.jsxs("button",{disabled:!t,onClick:()=>{n.dispatchCommand(Su,void 0)},className:"toolbar-item spaced","aria-label":"Undo",children:[W.exports.jsx("i",{className:"format undo"}),"Undo"]}),W.exports.jsxs("button",{disabled:!o,onClick:()=>{n.dispatchCommand(Nu,void 0)},className:"toolbar-item","aria-label":"Redo",children:[W.exports.jsx("i",{className:"format redo"}),"Redo"]}),W.exports.jsx(Tm,{}),W.exports.jsxs("button",{onClick:()=>{n.dispatchCommand(Gn,"bold")},className:"toolbar-item spaced "+(i?"active":""),"aria-label":"Format Bold",children:[W.exports.jsx("i",{className:"format bold"}),"Bold"]}),W.exports.jsxs("button",{onClick:()=>{n.dispatchCommand(Gn,"italic")},className:"toolbar-item spaced "+(c?"active":""),"aria-label":"Format Italics",children:[W.exports.jsx("i",{className:"format italic"}),"Italic"]}),W.exports.jsxs("button",{onClick:()=>{n.dispatchCommand(Gn,"underline")},className:"toolbar-item spaced "+(f?"active":""),"aria-label":"Format Underline",children:[W.exports.jsx("i",{className:"format underline"}),"Underline"]}),W.exports.jsxs("button",{onClick:()=>{n.dispatchCommand(Gn,"strikethrough")},className:"toolbar-item spaced "+(u?"active":""),"aria-label":"Format Strikethrough",children:[W.exports.jsx("i",{className:"format strikethrough"}),"Strikethrough"]}),W.exports.jsx(Tm,{}),W.exports.jsxs("button",{onClick:()=>{n.dispatchCommand(Vn,"left")},className:"toolbar-item spaced","aria-label":"Left Align",children:[W.exports.jsx("i",{className:"format left-align"}),"Left align"]}),W.exports.jsxs("button",{onClick:()=>{n.dispatchCommand(Vn,"center")},className:"toolbar-item spaced","aria-label":"Center Align",children:[W.exports.jsx("i",{className:"format center-align"}),"center align"]}),W.exports.jsxs("button",{onClick:()=>{n.dispatchCommand(Vn,"right")},className:"toolbar-item spaced","aria-label":"Right Align",children:[W.exports.jsx("i",{className:"format right-align"}),"right align"]}),W.exports.jsx("button",{onClick:()=>{n.dispatchCommand(Vn,"justify")},className:"toolbar-item","aria-label":"Justify Align",children:W.exports.jsx("i",{className:"format justify-align"})})," "]})}const rO=new Set(["http:","https:","mailto:","sms:","tel:"]);class _o extends yt{static getType(){return"link"}static clone(e){return new _o(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},r){super(r);const{target:o=null,rel:s=null,title:i=null}=t;this.__url=e,this.__target=o,this.__rel=s,this.__title=i}createDOM(e){const t=document.createElement("a");return t.href=this.sanitizeUrl(this.__url),this.__target!==null&&(t.target=this.__target),this.__rel!==null&&(t.rel=this.__rel),this.__title!==null&&(t.title=this.__title),Ie(t,e.theme.link),t}updateDOM(e,t,r){if(t instanceof HTMLAnchorElement){const o=this.__url,s=this.__target,i=this.__rel,l=this.__title;o!==e.__url&&(t.href=o),s!==e.__target&&(s?t.target=s:t.removeAttribute("target")),i!==e.__rel&&(i?t.rel=i:t.removeAttribute("rel")),l!==e.__title&&(l?t.title=l:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:oO,priority:1})}}static importJSON(e){const t=Ds(e.url,{rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}sanitizeUrl(e){try{const t=new URL(e);if(!rO.has(t.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){const t=this.getWritable();t.__url=e}getTarget(){return this.getLatest().__target}setTarget(e){const t=this.getWritable();t.__target=e}getRel(){return this.getLatest().__rel}setRel(e){const t=this.getWritable();t.__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){const t=this.getWritable();t.__title=e}insertNewAfter(e,t=!0){const r=Ds(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(r,t),r}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,r){if(!v(t))return!1;const o=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(o)&&this.isParentOf(s)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function oO(n){let e=null;if(k_(n)){const t=n.textContent;(t!==null&&t!==""||n.children.length>0)&&(e=Ds(n.getAttribute("href")||"",{rel:n.getAttribute("rel"),target:n.getAttribute("target"),title:n.getAttribute("title")}))}return{node:e}}function Ds(n,e){return ot(new _o(n,e))}function mo(n){return n instanceof _o}class As extends _o{constructor(e,t={},r){super(e,t,r),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null?t.isUnlinked:!1}static getType(){return"autolink"}static clone(e){return new As(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,r){return super.updateDOM(e,t,r)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){const t=ju(e.url,{isUnlinked:e.isUnlinked,rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked,type:"autolink",version:1}}insertNewAfter(e,t=!0){const r=this.getParentOrThrow().insertNewAfter(e,t);if(A(r)){const o=ju(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return r.append(o),o}return null}}function ju(n,e){return ot(new As(n,e))}function xm(n){return n instanceof As}const sO=no("TOGGLE_LINK_COMMAND");function Em(n,e={}){const{target:t,title:r}=e,o=e.rel===void 0?"noreferrer":e.rel,s=M();if(!v(s))return;const i=s.extract();if(n===null)i.forEach(l=>{const c=l.getParent();if(!xm(c)&&mo(c)){const a=c.getChildren();for(let f=0;f<a.length;f++)c.insertBefore(a[f]);c.remove()}});else{if(i.length===1){const a=i[0],f=lO(a,mo);if(f!==null){f.setURL(n),t!==void 0&&f.setTarget(t),o!==null&&f.setRel(o),r!==void 0&&f.setTitle(r);return}}let l=null,c=null;i.forEach(a=>{const f=a.getParent();if(!(f===c||f===null||A(a)&&!a.isInline())){if(mo(f)){c=f,f.setURL(n),t!==void 0&&f.setTarget(t),o!==null&&c.setRel(o),r!==void 0&&c.setTitle(r);return}if(f.is(l)||(l=f,c=Ds(n,{rel:o,target:t,title:r}),mo(f)?a.getPreviousSibling()===null?f.insertBefore(c):f.insertAfter(c):a.insertBefore(c)),mo(a)){if(a.is(c))return;if(c!==null){const d=a.getChildren();for(let u=0;u<d.length;u++)c.append(d[u])}a.remove();return}c!==null&&c.append(a)}})}}const iO=Em;function lO(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}const cO=Object.freeze(Object.defineProperty({__proto__:null,$createAutoLinkNode:ju,$createLinkNode:Ds,$isAutoLinkNode:xm,$isLinkNode:mo,$toggleLink:Em,AutoLinkNode:As,LinkNode:_o,TOGGLE_LINK_COMMAND:sO,toggleLink:iO},Symbol.toStringTag,{value:"Module"})),aO=new Set(["http:","https:","mailto:","sms:","tel:"]);class yo extends yt{static getType(){return"link"}static clone(e){return new yo(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,t={},r){super(r);const{target:o=null,rel:s=null,title:i=null}=t;this.__url=e,this.__target=o,this.__rel=s,this.__title=i}createDOM(e){const t=document.createElement("a");return t.href=this.sanitizeUrl(this.__url),this.__target!==null&&(t.target=this.__target),this.__rel!==null&&(t.rel=this.__rel),this.__title!==null&&(t.title=this.__title),Ie(t,e.theme.link),t}updateDOM(e,t,r){if(t instanceof HTMLAnchorElement){const o=this.__url,s=this.__target,i=this.__rel,l=this.__title;o!==e.__url&&(t.href=o),s!==e.__target&&(s?t.target=s:t.removeAttribute("target")),i!==e.__rel&&(i?t.rel=i:t.removeAttribute("rel")),l!==e.__title&&(l?t.title=l:t.removeAttribute("title"))}return!1}static importDOM(){return{a:e=>({conversion:uO,priority:1})}}static importJSON(e){const t=ks(e.url,{rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}sanitizeUrl(e){try{const t=new URL(e);if(!aO.has(t.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){this.getWritable().__title=e}insertNewAfter(e,t=!0){const r=ks(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(r,t),r}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,r){if(!v(t))return!1;const o=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(o)&&this.isParentOf(s)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function uO(n){let e=null;if(k_(n)){const t=n.textContent;(t!==null&&t!==""||n.children.length>0)&&(e=ks(n.getAttribute("href")||"",{rel:n.getAttribute("rel"),target:n.getAttribute("target"),title:n.getAttribute("title")}))}return{node:e}}function ks(n,e){return ot(new yo(n,e))}function Co(n){return n instanceof yo}class Rs extends yo{constructor(e,t={},r){super(e,t,r),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new Rs(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,r){return super.updateDOM(e,t,r)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){const t=Uu(e.url,{isUnlinked:e.isUnlinked,rel:e.rel,target:e.target,title:e.title});return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked,type:"autolink",version:1}}insertNewAfter(e,t=!0){const r=this.getParentOrThrow().insertNewAfter(e,t);if(A(r)){const o=Uu(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return r.append(o),o}return null}}function Uu(n,e){return ot(new Rs(n,e))}function wm(n){return n instanceof Rs}const fO=no("TOGGLE_LINK_COMMAND");function bm(n,e={}){const{target:t,title:r}=e,o=e.rel===void 0?"noreferrer":e.rel,s=M();if(!v(s))return;const i=s.extract();if(n===null)i.forEach(l=>{const c=l.getParent();if(!wm(c)&&Co(c)){const a=c.getChildren();for(let f=0;f<a.length;f++)c.insertBefore(a[f]);c.remove()}});else{if(i.length===1){const a=function(f,d){let u=f;for(;u!==null&&u.getParent()!==null&&!d(u);)u=u.getParentOrThrow();return d(u)?u:null}(i[0],Co);if(a!==null)return a.setURL(n),t!==void 0&&a.setTarget(t),o!==null&&a.setRel(o),void(r!==void 0&&a.setTitle(r))}let l=null,c=null;i.forEach(a=>{const f=a.getParent();if(f!==c&&f!==null&&(!A(a)||a.isInline())){if(Co(f))return c=f,f.setURL(n),t!==void 0&&f.setTarget(t),o!==null&&c.setRel(o),void(r!==void 0&&c.setTitle(r));if(f.is(l)||(l=f,c=ks(n,{rel:o,target:t,title:r}),Co(f)?a.getPreviousSibling()===null?f.insertBefore(c):f.insertAfter(c):a.insertBefore(c)),Co(a)){if(a.is(c))return;if(c!==null){const d=a.getChildren();for(let u=0;u<d.length;u++)c.append(d[u])}a.remove()}else c!==null&&c.append(a)}})}}const dO=Object.freeze(Object.defineProperty({__proto__:null,$createAutoLinkNode:Uu,$createLinkNode:ks,$isAutoLinkNode:wm,$isLinkNode:Co,$toggleLink:bm,AutoLinkNode:Rs,LinkNode:yo,TOGGLE_LINK_COMMAND:fO,toggleLink:bm},Symbol.toStringTag,{value:"Module"})),Om=(process.env.NODE_ENV==="development"?cO:dO).$isLinkNode;class $s extends yt{static getType(){return"mark"}static clone(e){return new $s(Array.from(e.__ids),e.__key)}static importDOM(){return null}static importJSON(e){const t=Xl(e.ids);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),ids:this.getIDs(),type:"mark",version:1}}constructor(e,t){super(t),this.__ids=e||[]}createDOM(e){const t=document.createElement("mark");return Ie(t,e.theme.mark),this.__ids.length>1&&Ie(t,e.theme.markOverlap),t}updateDOM(e,t,r){const o=e.__ids,s=this.__ids,i=o.length,l=s.length,c=r.theme.markOverlap;return i!==l&&(i===1?l===2&&Ie(t,c):l===1&&zl(t,c)),!1}hasID(e){const t=this.getIDs();for(let r=0;r<t.length;r++)if(e===t[r])return!0;return!1}getIDs(){const e=this.getLatest();return _r(e)?e.__ids:[]}addID(e){const t=this.getWritable();if(_r(t)){const r=t.__ids;t.__ids=r;for(let o=0;o<r.length;o++)if(e===r[o])return;r.push(e)}}deleteID(e){const t=this.getWritable();if(_r(t)){const r=t.__ids;t.__ids=r;for(let o=0;o<r.length;o++)if(e===r[o]){r.splice(o,1);return}}}insertNewAfter(e,t=!0){const r=Xl(this.__ids);return this.insertAfter(r,t),r}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,r){if(!v(t)||r==="html")return!1;const o=t.anchor,s=t.focus,i=o.getNode(),l=s.getNode(),a=t.isBackward()?o.offset-s.offset:s.offset-o.offset;return this.isParentOf(i)&&this.isParentOf(l)&&this.getTextContent().length===a}excludeFromCopy(e){return e!=="clone"}}function Xl(n){return ot(new $s(n))}function _r(n){return n instanceof $s}function hO(n){const e=n.getChildren();let t=null;for(let r=0;r<e.length;r++){const o=e[r];t===null?n.insertBefore(o):t.insertAfter(o),t=o}n.remove()}function gO(n,e,t,r){const o=n.getNodes(),s=n.anchor.offset,i=n.focus.offset,l=o.length,c=e?i:s,a=e?s:i;let f,d;for(let u=0;u<l;u++){const h=o[u];if(A(d)&&d.isParentOf(h))continue;const g=u===0,p=u===l-1;let _=null;if(L(h)){const y=h.getTextContentSize(),m=g?c:0,C=p?a:y;if(m===0&&C===0)continue;const N=h.splitText(m,C);_=N.length>1&&(N.length===3||g&&!p||C===y)?N[1]:N[0]}else{if(_r(h))continue;A(h)&&h.isInline()&&(_=h)}if(_!==null){if(_&&_.is(f))continue;const y=_.getParent();(y==null||!y.is(f))&&(d=void 0),f=y,d===void 0&&(d=(r||Xl)([t]),_.insertBefore(d)),d.append(_)}else f=void 0,d=void 0}A(d)&&(e?d.selectStart():d.selectEnd())}function pO(n,e){let t=n;for(;t!==null;){if(_r(t))return t.getIDs();if(L(t)&&e===t.getTextContentSize()){const r=t.getNextSibling();if(_r(r))return r.getIDs()}t=t.getParent()}return null}const _O=Object.freeze(Object.defineProperty({__proto__:null,$createMarkNode:Xl,$getMarkIDs:pO,$isMarkNode:_r,$unwrapMarkNode:hO,$wrapSelectionInMarkNode:gO,MarkNode:$s},Symbol.toStringTag,{value:"Module"}));class Ps extends yt{static getType(){return"mark"}static clone(e){return new Ps(Array.from(e.__ids),e.__key)}static importDOM(){return null}static importJSON(e){const t=ql(e.ids);return t.setFormat(e.format),t.setIndent(e.indent),t.setDirection(e.direction),t}exportJSON(){return{...super.exportJSON(),ids:this.getIDs(),type:"mark",version:1}}constructor(e,t){super(t),this.__ids=e||[]}createDOM(e){const t=document.createElement("mark");return Ie(t,e.theme.mark),this.__ids.length>1&&Ie(t,e.theme.markOverlap),t}updateDOM(e,t,r){const o=e.__ids,s=this.__ids,i=o.length,l=s.length,c=r.theme.markOverlap;return i!==l&&(i===1?l===2&&Ie(t,c):l===1&&zl(t,c)),!1}hasID(e){const t=this.getIDs();for(let r=0;r<t.length;r++)if(e===t[r])return!0;return!1}getIDs(){const e=this.getLatest();return mr(e)?e.__ids:[]}addID(e){const t=this.getWritable();if(mr(t)){const r=t.__ids;t.__ids=r;for(let o=0;o<r.length;o++)if(e===r[o])return;r.push(e)}}deleteID(e){const t=this.getWritable();if(mr(t)){const r=t.__ids;t.__ids=r;for(let o=0;o<r.length;o++)if(e===r[o])return void r.splice(o,1)}}insertNewAfter(e,t=!0){const r=ql(this.__ids);return this.insertAfter(r,t),r}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,r){if(!v(t)||r==="html")return!1;const o=t.anchor,s=t.focus,i=o.getNode(),l=s.getNode(),c=t.isBackward()?o.offset-s.offset:s.offset-o.offset;return this.isParentOf(i)&&this.isParentOf(l)&&this.getTextContent().length===c}excludeFromCopy(e){return e!=="clone"}}function ql(n){return ot(new Ps(n))}function mr(n){return n instanceof Ps}function mO(n){const e=n.getChildren();let t=null;for(let r=0;r<e.length;r++){const o=e[r];t===null?n.insertBefore(o):t.insertAfter(o),t=o}n.remove()}function yO(n,e,t,r){const o=n.getNodes(),s=n.anchor.offset,i=n.focus.offset,l=o.length,c=e?i:s,a=e?s:i;let f,d;for(let u=0;u<l;u++){const h=o[u];if(A(d)&&d.isParentOf(h))continue;const g=u===0,p=u===l-1;let _=null;if(L(h)){const y=h.getTextContentSize(),m=g?c:0,C=p?a:y;if(m===0&&C===0)continue;const N=h.splitText(m,C);_=N.length>1&&(N.length===3||g&&!p||C===y)?N[1]:N[0]}else{if(mr(h))continue;A(h)&&h.isInline()&&(_=h)}if(_!==null){if(_&&_.is(f))continue;const y=_.getParent();y!=null&&y.is(f)||(d=void 0),f=y,d===void 0&&(d=(r||ql)([t]),_.insertBefore(d)),d.append(_)}else f=void 0,d=void 0}A(d)&&(e?d.selectStart():d.selectEnd())}function CO(n,e){let t=n;for(;t!==null;){if(mr(t))return t.getIDs();if(L(t)&&e===t.getTextContentSize()){const r=t.getNextSibling();if(mr(r))return r.getIDs()}t=t.getParent()}return null}const NO=Object.freeze(Object.defineProperty({__proto__:null,$createMarkNode:ql,$getMarkIDs:CO,$isMarkNode:mr,$unwrapMarkNode:mO,$wrapSelectionInMarkNode:yO,MarkNode:Ps},Symbol.toStringTag,{value:"Module"})),vm=(process.env.NODE_ENV==="development"?_O:NO).$isMarkNode,Mm=/^(\d+(?:\.\d+)?)px$/,SO=75,ge={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class No extends yt{static getType(){return"tablecell"}static clone(e){const t=new No(e.__headerState,e.__colSpan,e.__width,e.__key);return t.__rowSpan=e.__rowSpan,t.__backgroundColor=e.__backgroundColor,t}static importDOM(){return{td:e=>({conversion:Dm,priority:0}),th:e=>({conversion:Dm,priority:0})}}static importJSON(e){const t=e.colSpan||1,r=e.rowSpan||1,o=Mt(e.headerState,t,e.width||void 0);return o.__rowSpan=r,o.__backgroundColor=e.backgroundColor||null,o}constructor(e=ge.NO_STATUS,t=1,r,o){super(o),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=r,this.__backgroundColor=null}createDOM(e){const t=document.createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(t.style.backgroundColor=this.__backgroundColor),Ie(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const{element:t}=super.exportDOM(e);if(t){const r=t;r.style.border="1px solid black",this.__colSpan>1&&(r.colSpan=this.__colSpan),this.__rowSpan>1&&(r.rowSpan=this.__rowSpan),r.style.width=`${this.getWidth()||SO}px`,r.style.verticalAlign="top",r.style.textAlign="start";const o=this.getBackgroundColor();o!==null?r.style.backgroundColor=o:this.hasHeader()&&(r.style.backgroundColor="#f2f3f5")}return{element:t}}exportJSON(){return{...super.exportJSON(),backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,type:"tablecell",width:this.getWidth()}}getColSpan(){return this.__colSpan}setColSpan(e){return this.getWritable().__colSpan=e,this}getRowSpan(){return this.__rowSpan}setRowSpan(e){return this.getWritable().__rowSpan=e,this}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e){const t=this.getWritable();return t.__headerState=e,this.__headerState}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){const t=this.getWritable();return t.__width=e,this.__width}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){this.getWritable().__backgroundColor=e}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==ge.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function Dm(n){const e=n,t=n.nodeName.toLowerCase();let r;Mm.test(e.style.width)&&(r=parseFloat(e.style.width));const o=Mt(t==="th"?ge.ROW:ge.NO_STATUS,e.colSpan,r);o.__rowSpan=e.rowSpan;const s=e.style.backgroundColor;s!==""&&(o.__backgroundColor=s);const i=e.style,l=i.textDecoration.split(" "),c=i.fontWeight==="700"||i.fontWeight==="bold",a=l.includes("line-through"),f=i.fontStyle==="italic",d=l.includes("underline");return{after:u=>(u.length===0&&u.push(ie()),u),forChild:(u,h)=>{if(Q(h)&&!A(u)){const g=ie();return gl(u)&&u.getTextContent()===`
40
+ `?null:(L(u)&&(c&&u.toggleFormat("bold"),a&&u.toggleFormat("strikethrough"),f&&u.toggleFormat("italic"),d&&u.toggleFormat("underline")),g.append(u),g)}return u},node:o}}function Mt(n,e=1,t){return ot(new No(n,e,t))}function Q(n){return n instanceof No}const TO=no("INSERT_TABLE_COMMAND");class Is extends yt{static getType(){return"tablerow"}static clone(e){return new Is(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:xO,priority:0})}}static importJSON(e){return yr(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){return{...super.exportJSON(),...this.getHeight()&&{height:this.getHeight()},type:"tablerow",version:1}}createDOM(e){const t=document.createElement("tr");return this.__height&&(t.style.height=`${this.__height}px`),Ie(t,e.theme.tableRow),t}isShadowRoot(){return!0}setHeight(e){const t=this.getWritable();return t.__height=e,this.__height}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function xO(n){const e=n;let t;return Mm.test(e.style.height)&&(t=parseFloat(e.style.height)),{node:yr(t)}}function yr(n){return ot(new Is(n))}function ke(n){return n instanceof Is}const EO=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function wO(n,e,t=!0){const r=nc();for(let o=0;o<n;o++){const s=yr();for(let i=0;i<e;i++){let l=ge.NO_STATUS;typeof t=="object"?(o===0&&t.rows&&(l|=ge.ROW),i===0&&t.columns&&(l|=ge.COLUMN)):t&&(o===0&&(l|=ge.ROW),i===0&&(l|=ge.COLUMN));const c=Mt(l),a=ie();a.append(bt()),c.append(a),s.append(c)}r.append(s)}return r}function bO(n){const e=z(n,t=>Q(t));return Q(e)?e:null}function Hu(n){const e=z(n,t=>ke(t));if(ke(e))return e;throw new Error("Expected table cell to be inside of table row.")}function Yu(n){const e=z(n,t=>Me(t));if(Me(e))return e;throw new Error("Expected table cell to be inside of table.")}function OO(n){const e=Hu(n);return Yu(e).getChildren().findIndex(r=>r.is(e))}function vO(n){return Hu(n).getChildren().findIndex(t=>t.is(n))}function Am(n,e){const t=Yu(n),{x:r,y:o}=t.getCordsFromCellNode(n,e);return{above:t.getCellNodeFromCords(r,o-1,e),below:t.getCellNodeFromCords(r,o+1,e),left:t.getCellNodeFromCords(r-1,o,e),right:t.getCellNodeFromCords(r+1,o,e)}}function MO(n,e){const t=n.getChildren();if(e>=t.length||e<0)throw new Error("Expected table cell to be inside of table row.");return t[e].remove(),n}function DO(n,e,t=!0,r,o){const s=n.getChildren();if(e>=s.length||e<0)throw new Error("Table row target index out of range");const i=s[e];if(ke(i))for(let l=0;l<r;l++){const c=i.getChildren(),a=c.length,f=yr();for(let d=0;d<a;d++){const u=c[d];if(!Q(u))throw Error("Expected table cell");const{above:h,below:g}=Am(u,o);let p=ge.NO_STATUS;const _=h&&h.getWidth()||g&&g.getWidth()||void 0;(h&&h.hasHeaderState(ge.COLUMN)||g&&g.hasHeaderState(ge.COLUMN))&&(p|=ge.COLUMN);const y=Mt(p,1,_);y.append(ie()),f.append(y)}t?i.insertAfter(f):i.insertBefore(f)}else throw new Error("Row before insertion index does not exist.");return n}const Ju=(n,e)=>n===ge.BOTH||n===e?e:ge.NO_STATUS;function AO(n=!0){const e=M();if(!(v(e)||Ce(e)))throw Error("Expected a RangeSelection or TableSelection");const t=e.focus.getNode(),[r,,o]=Ct(t),[s,i]=Yt(o,r,r),l=s[0].length,{startRow:c}=i;if(n){const a=c+r.__rowSpan-1,f=s[a],d=yr();for(let h=0;h<l;h++){const{cell:g,startRow:p}=f[h];if(p+g.__rowSpan-1<=a){const y=f[h].cell.__headerState,m=Ju(y,ge.COLUMN);d.append(Mt(m).append(ie()))}else g.setRowSpan(g.__rowSpan+1)}const u=o.getChildAtIndex(a);if(!ke(u))throw Error("focusEndRow is not a TableRowNode");u.insertAfter(d)}else{const a=s[c],f=yr();for(let u=0;u<l;u++){const{cell:h,startRow:g}=a[u];if(g===c){const _=a[u].cell.__headerState,y=Ju(_,ge.COLUMN);f.append(Mt(y).append(ie()))}else h.setRowSpan(h.__rowSpan+1)}const d=o.getChildAtIndex(c);if(!ke(d))throw Error("focusEndRow is not a TableRowNode");d.insertBefore(f)}}function kO(n,e,t=!0,r,o){const s=n.getChildren(),i=[];for(let l=0;l<s.length;l++){const c=s[l];if(ke(c))for(let a=0;a<r;a++){const f=c.getChildren();if(e>=f.length||e<0)throw new Error("Table column target index out of range");const d=f[e];if(!Q(d))throw Error("Expected table cell");const{left:u,right:h}=Am(d,o);let g=ge.NO_STATUS;(u&&u.hasHeaderState(ge.ROW)||h&&h.hasHeaderState(ge.ROW))&&(g|=ge.ROW);const p=Mt(g);p.append(ie()),i.push({newTableCell:p,targetCell:d})}}return i.forEach(({newTableCell:l,targetCell:c})=>{t?c.insertAfter(l):c.insertBefore(l)}),n}function RO(n=!0){const e=M();if(!(v(e)||Ce(e)))throw Error("Expected a RangeSelection or TableSelection");const t=e.anchor.getNode(),r=e.focus.getNode(),[o]=Ct(t),[s,,i]=Ct(r),[l,c,a]=Yt(i,s,o),f=l.length,d=n?Math.max(c.startColumn,a.startColumn):Math.min(c.startColumn,a.startColumn),u=n?d+s.__colSpan-1:d-1,h=i.getFirstChild();if(!ke(h))throw Error("Expected firstTable child to be a row");let g=null;function p(y=ge.NO_STATUS){const m=Mt(y).append(ie());return g===null&&(g=m),m}let _=h;e:for(let y=0;y<f;y++){if(y!==0){const x=_.getNextSibling();if(!ke(x))throw Error("Expected row nextSibling to be a row");_=x}const m=l[y],C=m[u<0?0:u].cell.__headerState,N=Ju(C,ge.ROW);if(u<0){Vu(_,p(N));continue}const{cell:S,startColumn:T,startRow:E}=m[u];if(T+S.__colSpan-1<=u){let x=S,w=E,O=u;for(;w!==y&&x.__rowSpan>1;)if(O-=S.__colSpan,O>=0){const{cell:D,startRow:B}=m[O];x=D,w=B}else{_.append(p(N));continue e}x.insertAfter(p(N))}else S.setColSpan(S.__colSpan+1)}g!==null&&Ls(g)}function $O(n,e){const t=n.getChildren();for(let r=0;r<t.length;r++){const o=t[r];if(ke(o)){const s=o.getChildren();if(e>=s.length||e<0)throw new Error("Table column target index out of range");s[e].remove()}}return n}function PO(){const n=M();if(!(v(n)||Ce(n)))throw Error("Expected a RangeSelection or TableSelection");const e=n.anchor.getNode(),t=n.focus.getNode(),[r,,o]=Ct(e),[s]=Ct(t),[i,l,c]=Yt(o,r,s),{startRow:a}=l,{startRow:f}=c,d=f+s.__rowSpan-1;if(i.length===d-a+1){o.remove();return}const u=i[0].length,h=i[d+1],g=o.getChildAtIndex(d+1);for(let p=d;p>=a;p--){for(let y=u-1;y>=0;y--){const{cell:m,startRow:C,startColumn:N}=i[p][y];if(N===y&&(p===a&&C<a&&m.setRowSpan(m.__rowSpan-(C-a)),C>=a&&C+m.__rowSpan-1>d)){if(m.setRowSpan(m.__rowSpan-(d-C+1)),g===null)throw Error("Expected nextRowNode not to be null");if(y===0)Vu(g,m);else{const{cell:S}=h[y-1];S.insertAfter(m)}}}const _=o.getChildAtIndex(p);if(!ke(_))throw Error(`Expected GridNode childAtIndex(${String(p)}) to be RowNode`);_.remove()}if(h!==void 0){const{cell:p}=h[0];Ls(p)}else{const p=i[a-1],{cell:_}=p[0];Ls(_)}}function IO(){const n=M();if(!(v(n)||Ce(n)))throw Error("Expected a RangeSelection or TableSelection");const e=n.anchor.getNode(),t=n.focus.getNode(),[r,,o]=Ct(e),[s]=Ct(t),[i,l,c]=Yt(o,r,s),{startColumn:a}=l,{startRow:f,startColumn:d}=c,u=Math.min(a,d),h=Math.max(a+r.__colSpan-1,d+s.__colSpan-1),g=h-u+1;if(i[0].length===h-u+1){o.selectPrevious(),o.remove();return}const _=i.length;for(let C=0;C<_;C++)for(let N=u;N<=h;N++){const{cell:S,startColumn:T}=i[C][N];if(T<u){if(N===u){const E=u-T;S.setColSpan(S.__colSpan-Math.min(g,S.__colSpan-E))}}else if(T+S.__colSpan-1>h){if(N===h){const E=h-T+1;S.setColSpan(S.__colSpan-E)}}else S.remove()}const y=i[f],m=a>d?y[a+r.__colSpan]:y[d+s.__colSpan];if(m!==void 0){const{cell:C}=m;Ls(C)}else{const C=d<a?y[d-1]:y[a-1],{cell:N}=C;Ls(N)}}function Ls(n){const e=n.getFirstDescendant();e==null?n.selectStart():e.getParentOrThrow().selectStart()}function Vu(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function LO(){const n=M();if(!(v(n)||Ce(n)))throw Error("Expected a RangeSelection or TableSelection");const e=n.anchor.getNode(),[t,r,o]=Ct(e),s=t.__colSpan,i=t.__rowSpan;if(s>1){for(let l=1;l<s;l++)t.insertAfter(Mt(ge.NO_STATUS).append(ie()));t.setColSpan(1)}if(i>1){const[l,c]=Yt(o,t,t),{startColumn:a,startRow:f}=c;let d;for(let u=1;u<i;u++){const h=f+u,g=l[h];if(d=(d||r).getNextSibling(),!ke(d))throw Error("Expected row next sibling to be a row");let p=null;for(let _=0;_<a;_++){const y=g[_],m=y.cell;y.startRow===h&&(p=m),m.__colSpan>1&&(_+=m.__colSpan-1)}if(p===null)for(let _=0;_<s;_++)Vu(d,Mt(ge.NO_STATUS).append(ie()));else for(let _=0;_<s;_++)p.insertAfter(Mt(ge.NO_STATUS).append(ie()))}t.setRowSpan(1)}}function Yt(n,e,t){const[r,o,s]=km(n,e,t);if(o===null)throw Error("Anchor not found in Grid");if(s===null)throw Error("Focus not found in Grid");return[r,o,s]}function km(n,e,t){const r=[];let o=null,s=null;function i(a,f,d){const u={cell:d,startColumn:f,startRow:a},h=d.__rowSpan,g=d.__colSpan;for(let p=0;p<h;p++){r[a+p]===void 0&&(r[a+p]=[]);for(let _=0;_<g;_++)r[a+p][f+_]=u}e!==null&&e.is(d)&&(o=u),t!==null&&t.is(d)&&(s=u)}function l(a,f){return r[a]===void 0||r[a][f]===void 0}const c=n.getChildren();for(let a=0;a<c.length;a++){const f=c[a];if(!ke(f))throw Error("Expected GridNode children to be TableRowNode");const d=f.getChildren();let u=0;for(const h of d){if(!Q(h))throw Error("Expected TableRowNode children to be TableCellNode");for(;!l(a,u);)u++;i(a,u,h),u+=h.__colSpan}}return[r,o,s]}function Ct(n){let e;if(n instanceof No)e=n;else if("__type"in n){const o=z(n,Q);if(!Q(o))throw Error("Expected to find a parent TableCellNode");e=o}else{const o=z(n.getNode(),Q);if(!Q(o))throw Error("Expected to find a parent TableCellNode");e=o}const t=e.getParent();if(!ke(t))throw Error("Expected TableCellNode to have a parent TableRowNode");const r=t.getParent();if(!Me(r))throw Error("Expected TableRowNode to have a parent GridNode");return[e,t,r]}function Gu(n){const[e,,t]=Ct(n),r=t.getChildren(),o=r.length,s=r[0].getChildren().length,i=new Array(o);for(let l=0;l<o;l++)i[l]=new Array(s);for(let l=0;l<o;l++){const a=r[l].getChildren();let f=0;for(let d=0;d<a.length;d++){for(;i[l][f];)f++;const u=a[d],h=u.__rowSpan||1,g=u.__colSpan||1;for(let p=0;p<h;p++)for(let _=0;_<g;_++)i[l+p][f+_]=u;if(e===u)return{colSpan:g,columnIndex:f,rowIndex:l,rowSpan:h};f+=g}}return null}class Ql{constructor(e,t,r){this.anchor=t,this.focus=r,t._selection=this,r._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return Ce(e)?this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus):!1}set(e,t,r){this.dirty=!0,this.tableKey=e,this.anchor.key=t,this.focus.key=r,this._cachedNodes=null}clone(){return new Ql(this.tableKey,this.anchor,this.focus)}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.focus.getNode();if(!A(t))throw Error("Expected TableSelection focus to be an ElementNode");_l(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const e=Ot(this.anchor.key);if(!Q(e))throw Error("Expected TableSelection anchor to be (or a child of) TableCellNode");const t=Gu(e);if(t===null)throw Error("getCellRect: expected to find AnchorNode");const r=Ot(this.focus.key);if(!Q(r))throw Error("Expected TableSelection focus to be (or a child of) TableCellNode");const o=Gu(r);if(o===null)throw Error("getCellRect: expected to find focusCellNode");const s=Math.min(t.columnIndex,o.columnIndex),i=Math.max(t.columnIndex,o.columnIndex),l=Math.min(t.rowIndex,o.rowIndex),c=Math.max(t.rowIndex,o.rowIndex);return{fromX:Math.min(s,i),fromY:Math.min(l,c),toX:Math.max(s,i),toY:Math.max(l,c)}}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor.getNode(),r=this.focus.getNode(),o=z(t,Q),s=z(r,Q);if(!Q(o))throw Error("Expected TableSelection anchor to be (or a child of) TableCellNode");if(!Q(s))throw Error("Expected TableSelection focus to be (or a child of) TableCellNode");const i=o.getParent();if(!ke(i))throw Error("Expected anchorCell to have a parent TableRowNode");const l=i.getParent();if(!Me(l))throw Error("Expected tableNode to have a parent TableNode");const c=s.getParents()[1];if(c!==l){if(l.isParentOf(s)){const E=c.getParent();if(E==null)throw Error("Expected focusCellParent to have a parent");this.set(this.tableKey,s.getKey(),E.getKey())}else{const E=l.getParent();if(E==null)throw Error("Expected gridParent to have a parent");this.set(this.tableKey,E.getKey(),s.getKey())}return this.getNodes()}const[a,f,d]=Yt(l,o,s);let u=Math.min(f.startColumn,d.startColumn),h=Math.min(f.startRow,d.startRow),g=Math.max(f.startColumn+f.cell.__colSpan-1,d.startColumn+d.cell.__colSpan-1),p=Math.max(f.startRow+f.cell.__rowSpan-1,d.startRow+d.cell.__rowSpan-1),_=u,y=h,m=u,C=h;function N(E){const{cell:x,startColumn:w,startRow:O}=E;u=Math.min(u,w),h=Math.min(h,O),g=Math.max(g,w+x.__colSpan-1),p=Math.max(p,O+x.__rowSpan-1)}for(;u<_||h<y||g>m||p>C;){if(u<_){const E=C-y,x=_-1;for(let w=0;w<=E;w++)N(a[y+w][x]);_=x}if(h<y){const E=m-_,x=y-1;for(let w=0;w<=E;w++)N(a[x][_+w]);y=x}if(g>m){const E=C-y,x=m+1;for(let w=0;w<=E;w++)N(a[y+w][x]);m=x}if(p>C){const E=m-_,x=C+1;for(let w=0;w<=E;w++)N(a[x][_+w]);C=x}}const S=[l];let T=null;for(let E=h;E<=p;E++)for(let x=u;x<=g;x++){const{cell:w}=a[E][x],O=w.getParent();if(!ke(O))throw Error("Expected TableCellNode parent to be a TableRowNode");O!==T&&S.push(O),S.push(w,...FO(w)),T=O}return Wp()||(this._cachedNodes=S),S}getTextContent(){const e=this.getNodes().filter(r=>Q(r));let t="";for(let r=0;r<e.length;r++){const o=e[r],s=o.__parent,i=(e[r+1]||{}).__parent;t+=o.getTextContent()+(i!==s?`
41
+ `:" ")}return t}}function Ce(n){return n instanceof Ql}function Xu(){const n=fl("root",0,"element"),e=fl("root",0,"element");return new Ql("root",n,e)}function FO(n){const e=[],t=[n];for(;t.length>0;){const r=t.pop();if(r===void 0)throw Error("Stack.length > 0; can't be undefined");A(r)&&t.unshift(...r.getChildren()),r!==n&&e.push(r)}return e}class Rm{constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.trackTable(),this.isSelecting=!1}getTable(){return this.table}removeListeners(){Array.from(this.listenersToRemove).forEach(e=>e())}trackTable(){const e=new MutationObserver(t=>{this.editor.update(()=>{let r=!1;for(let s=0;s<t.length;s++){const c=t[s].target.nodeName;if(c==="TABLE"||c==="TBODY"||c==="THEAD"||c==="TR"){r=!0;break}}if(!r)return;const o=this.editor.getElementByKey(this.tableNodeKey);if(!o)throw new Error("Expected to find TableElement in DOM");this.table=So(o)})});this.editor.update(()=>{const t=this.editor.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");this.table=So(t),e.observe(t,{attributes:!0,childList:!0,subtree:!0})})}clearHighlight(){const e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.enableHighlightStyle(),e.update(()=>{const t=Ot(this.tableNodeKey);if(!Me(t))throw new Error("Expected TableNode.");const r=e.getElementByKey(this.tableNodeKey);if(!r)throw new Error("Expected to find TableElement in DOM");const o=So(r);Zl(e,o,null),Pe(null),e.dispatchCommand(Wt,void 0)})}enableHighlightStyle(){const e=this.editor;e.update(()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");zl(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1})}disableHighlightStyle(){const e=this.editor;e.update(()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");Ie(t,e._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0})}updateTableTableSelection(e){if(e!==null&&e.tableKey===this.tableNodeKey){const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.disableHighlightStyle(),Zl(t,this.table,this.tableSelection)}else e==null?this.clearHighlight():(this.tableNodeKey=e.tableKey,this.updateTableTableSelection(e))}setFocusCellForSelection(e,t=!1){const r=this.editor;r.update(()=>{const o=Ot(this.tableNodeKey);if(!Me(o))throw new Error("Expected TableNode.");if(!r.getElementByKey(this.tableNodeKey))throw new Error("Expected to find TableElement in DOM");const i=e.x,l=e.y;if(this.focusCell=e,this.anchorCell!==null){const c=Pm(r._window);c&&c.setBaseAndExtent(this.anchorCell.elem,0,this.focusCell.elem,0)}if(!this.isHighlightingCells&&(this.anchorX!==i||this.anchorY!==l||t))this.isHighlightingCells=!0,this.disableHighlightStyle();else if(i===this.focusX&&l===this.focusY)return;if(this.focusX=i,this.focusY=l,this.isHighlightingCells){const c=be(e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null&&Q(c)&&o.is(Cr(c))){const a=c.getKey();this.tableSelection=this.tableSelection.clone()||Xu(),this.focusCellNodeKey=a,this.tableSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),Pe(this.tableSelection),r.dispatchCommand(Wt,void 0),Zl(r,this.table,this.tableSelection)}}})}setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.editor.update(()=>{const t=be(e.elem);if(Q(t)){const r=t.getKey();this.tableSelection=this.tableSelection!=null?this.tableSelection.clone():Xu(),this.anchorCellNodeKey=r}})}formatCells(e){this.editor.update(()=>{const t=M();if(!Ce(t))throw Error("Expected grid selection");const r=dl(),o=r.anchor,s=r.focus;t.getNodes().forEach(i=>{Q(i)&&i.getTextContentSize()!==0&&(o.set(i.getKey(),0,"element"),s.set(i.getKey(),i.getChildrenSize(),"element"),r.formatText(e))}),Pe(t),this.editor.dispatchCommand(Wt,void 0)})}clearText(){const e=this.editor;e.update(()=>{const t=Ot(this.tableNodeKey);if(!Me(t))throw new Error("Expected TableNode.");const r=M();if(!Ce(r))throw Error("Expected grid selection");const o=r.getNodes().filter(Q);if(o.length===this.table.columns*this.table.rows){t.selectPrevious(),t.remove(),Oe().selectStart();return}o.forEach(s=>{if(A(s)){const i=ie(),l=bt();i.append(l),s.append(i),s.getChildren().forEach(c=>{c!==i&&c.remove()})}}),Zl(e,this.table,null),Pe(null),e.dispatchCommand(Wt,void 0)})}}const $m="__lexicalTableSelection",Pm=n=>EO?(n||window).getSelection():null,BO=n=>(n.buttons&1)===1;function KO(n,e,t,r){const o=t.getRootElement();if(o===null)throw new Error("No root element.");const s=new Rm(t,n.getKey()),i=t._window||window;WO(e,s);const l=()=>{const u=()=>{s.isSelecting=!1,i.removeEventListener("mouseup",u),i.removeEventListener("mousemove",h)},h=g=>{setTimeout(()=>{if(!BO(g)&&s.isSelecting){s.isSelecting=!1,i.removeEventListener("mouseup",u),i.removeEventListener("mousemove",h);return}const p=qu(g.target);p!==null&&(s.anchorX!==p.x||s.anchorY!==p.y)&&(g.preventDefault(),s.setFocusCellForSelection(p))},0)};return{onMouseMove:h,onMouseUp:u}};e.addEventListener("mousedown",u=>{setTimeout(()=>{if(u.button!==0||!i)return;const h=qu(u.target);h!==null&&(Nr(u),s.setAnchorCellForSelection(h));const{onMouseUp:g,onMouseMove:p}=l();s.isSelecting=!0,i.addEventListener("mouseup",g),i.addEventListener("mousemove",p)},0)});const c=u=>{u.button===0&&t.update(()=>{const h=M(),g=u.target;Ce(h)&&h.tableKey===s.tableNodeKey&&o.contains(g)&&s.clearHighlight()})};i.addEventListener("mousedown",c),s.listenersToRemove.add(()=>i.removeEventListener("mousedown",c)),s.listenersToRemove.add(t.registerCommand(El,u=>Fs(t,u,"down",n,s),vt)),s.listenersToRemove.add(t.registerCommand(Ol,u=>Fs(t,u,"up",n,s),vt)),s.listenersToRemove.add(t.registerCommand(wl,u=>Fs(t,u,"backward",n,s),vt)),s.listenersToRemove.add(t.registerCommand(bl,u=>Fs(t,u,"forward",n,s),vt)),s.listenersToRemove.add(t.registerCommand(Dl,u=>{const h=M();if(Ce(h)){const g=z(h.focus.getNode(),Q);if(Q(g))return Nr(u),g.selectEnd(),!0}return!1},vt));const a=u=>()=>{const h=M();if(!Qn(h,n))return!1;if(Ce(h))return s.clearText(),!0;if(v(h)){const g=z(h.anchor.getNode(),T=>Q(T));if(!Q(g))return!1;const p=h.anchor.getNode(),_=h.focus.getNode(),y=n.isParentOf(p),m=n.isParentOf(_);if(y&&!m||m&&!y)return s.clearText(),!0;const N=z(h.anchor.getNode(),T=>A(T)),S=N&&z(N,T=>A(T)&&Q(T.getParent()));if(!A(S)||!A(N))return!1;if(u===Zr&&S.getPreviousSibling()===null)return!0}return!1};[Tl,Zr,Jn].forEach(u=>{s.listenersToRemove.add(t.registerCommand(u,a(u),ye))});const f=u=>{const h=M();if(!Qn(h,n)){const g=h?h.getNodes():null;if(g){const p=g.find(_=>Me(_)&&_.getKey()===s.tableNodeKey);if(Me(p)){if(!p.getParent())return!1;p.remove()}}return!1}if(Ce(h))return u&&(u.preventDefault(),u.stopPropagation()),s.clearText(),!0;if(v(h)){const g=z(h.anchor.getNode(),p=>Q(p));if(!Q(g))return!1}return!1};s.listenersToRemove.add(t.registerCommand(vl,f,ye)),s.listenersToRemove.add(t.registerCommand(Ml,f,ye)),s.listenersToRemove.add(t.registerCommand(Sl,u=>{const h=M();if(h){if(!(Ce(h)||v(h)))return!1;co(t,lt(u,ClipboardEvent)?u:null,hm(h));const g=f(u);return v(h)&&h.removeText(),g}return!1},ye)),s.listenersToRemove.add(t.registerCommand(Gn,u=>{const h=M();if(!Qn(h,n))return!1;if(Ce(h))return s.formatCells(u),!0;if(v(h)){const g=z(h.anchor.getNode(),p=>Q(p));if(!Q(g))return!1}return!1},ye)),s.listenersToRemove.add(t.registerCommand(Vn,u=>{const h=M();if(!Ce(h)||!Qn(h,n))return!1;const g=h.anchor.getNode(),p=h.focus.getNode();if(!Q(g)||!Q(p))return!1;const[_,y,m]=Yt(n,g,p),C=Math.max(y.startRow,m.startRow),N=Math.max(y.startColumn,m.startColumn),S=Math.min(y.startRow,m.startRow),T=Math.min(y.startColumn,m.startColumn);for(let E=S;E<=C;E++)for(let x=T;x<=N;x++){const w=_[E][x].cell;w.setFormat(u);const O=w.getChildren();for(let D=0;D<O.length;D++){const B=O[D];A(B)&&!B.isInline()&&B.setFormat(u)}}return!0},ye)),s.listenersToRemove.add(t.registerCommand(Cl,u=>{const h=M();if(!Qn(h,n))return!1;if(Ce(h))return s.clearHighlight(),!1;if(v(h)){const g=z(h.anchor.getNode(),p=>Q(p));if(!Q(g))return!1;if(typeof u=="string"){const p=Wm(t,h,n);if(p)return Km(p,n,[bt(u)]),!0}}return!1},ye)),r&&s.listenersToRemove.add(t.registerCommand(Ip,u=>{const h=M();if(!v(h)||!h.isCollapsed()||!Qn(h,n))return!1;const g=tc(h.anchor.getNode());if(g===null)return!1;Nr(u);const p=n.getCordsFromCellNode(g,s.table);return Lm(s,n,p.x,p.y,u.shiftKey?"backward":"forward"),!0},ye)),s.listenersToRemove.add(t.registerCommand(kp,u=>n.isSelected(),vt));function d(u){const h=n.getCordsFromCellNode(u,s.table);return n.getDOMCellFromCordsOrThrow(h.x,h.y,s.table)}return s.listenersToRemove.add(t.registerCommand(kl,u=>{const{nodes:h,selection:g}=u,p=g.getStartEndPoints(),_=Ce(g),m=v(g)&&z(g.anchor.getNode(),ae=>Q(ae))!==null&&z(g.focus.getNode(),ae=>Q(ae))!==null||_;if(h.length!==1||!Me(h[0])||!m||p===null)return!1;const[C]=p,N=h[0],S=N.getChildren(),T=N.getFirstChildOrThrow().getChildrenSize(),E=N.getChildrenSize(),x=z(C.getNode(),ae=>Q(ae)),w=x&&z(x,ae=>ke(ae)),O=w&&z(w,ae=>Me(ae));if(!Q(x)||!ke(w)||!Me(O))return!1;const D=w.getIndexWithinParent(),B=Math.min(O.getChildrenSize()-1,D+E-1),q=x.getIndexWithinParent(),Y=Math.min(w.getChildrenSize()-1,q+T-1),J=Math.min(q,Y),oe=Math.min(D,B),F=Math.max(q,Y),ce=Math.max(D,B),se=O.getChildren();let We=0;for(let ae=oe;ae<=ce;ae++){const Ae=se[ae];if(!ke(Ae))return!1;const Ge=S[We];if(!ke(Ge))return!1;const Xe=Ae.getChildren(),qe=Ge.getChildren();let Te=0;for(let nt=J;nt<=F;nt++){const ze=Xe[nt];if(!Q(ze))return!1;const ve=qe[Te];if(!Q(ve))return!1;const St=ze.getChildren();ve.getChildren().forEach(er=>{L(er)&&ie().append(er),ze.append(er)}),St.forEach(er=>er.remove()),Te++}We++}return!0},ye)),s.listenersToRemove.add(t.registerCommand(Wt,()=>{const u=M(),h=Hn();if(v(u)){const{anchor:g,focus:p}=u,_=g.getNode(),y=p.getNode(),m=tc(_),C=tc(y),N=!!(m&&n.is(Cr(m))),S=!!(C&&n.is(Cr(C))),T=N!==S,E=N&&S,x=u.isBackward();if(T){const w=u.clone();if(S){const[O]=Yt(n,C,C),D=O[0][0].cell,B=O[O.length-1].at(-1).cell;w.focus.set(x?D.getKey():B.getKey(),x?D.getChildrenSize():B.getChildrenSize(),"element")}Pe(w),Im(t,s)}else E&&(m.is(C)||(s.setAnchorCellForSelection(d(m)),s.setFocusCellForSelection(d(C),!0),s.isSelecting||setTimeout(()=>{const{onMouseUp:w,onMouseMove:O}=l();s.isSelecting=!0,i.addEventListener("mouseup",w),i.addEventListener("mousemove",O)},0)))}else if(u&&Ce(u)&&u.is(h)&&u.tableKey===n.getKey()){const g=Pm(t._window);if(g&&g.anchorNode&&g.focusNode){const p=be(g.focusNode),_=p&&!n.is(Cr(p)),y=be(g.anchorNode),m=y&&n.is(Cr(y));if(_&&m&&g.rangeCount>0){const C=yp(g,t);C&&(C.anchor.set(n.getKey(),u.isBackward()?n.getChildrenSize():0,"element"),g.removeAllRanges(),Pe(C))}}}return u&&!u.is(h)&&(Ce(u)||Ce(h))&&s.tableSelection&&!s.tableSelection.is(h)?(Ce(u)&&u.tableKey===s.tableNodeKey?s.updateTableTableSelection(u):!Ce(u)&&Ce(h)&&h.tableKey===s.tableNodeKey&&s.updateTableTableSelection(null),!1):(s.hasHijackedSelectionStyles&&!n.isSelected()?jO(t,s):!s.hasHijackedSelectionStyles&&n.isSelected()&&Im(t,s),!1)},ye)),s.listenersToRemove.add(t.registerCommand(eo,()=>{const u=M();if(!v(u)||!u.isCollapsed()||!Qn(u,n))return!1;const h=Wm(t,u,n);return h?(Km(h,n),!0):!1},ye)),s}function WO(n,e){n[$m]=e}function zO(n){return n[$m]}function qu(n){let e=n;for(;e!=null;){const t=e.nodeName;if(t==="TD"||t==="TH"){const r=e._cell;return r===void 0?null:r}e=e.parentNode}return null}function So(n){const e=[],t={columns:0,domRows:e,rows:0};let r=n.firstChild,o=0,s=0;for(e.length=0;r!=null;){const i=r.nodeName;if(i==="TD"||i==="TH"){const a=r,f={elem:a,hasBackgroundColor:a.style.backgroundColor!=="",highlighted:!1,x:o,y:s};r._cell=f;let d=e[s];d===void 0&&(d=e[s]=[]),d[o]=f}else{const a=r.firstChild;if(a!=null){r=a;continue}}const l=r.nextSibling;if(l!=null){o++,r=l;continue}const c=r.parentNode;if(c!=null){const a=c.nextSibling;if(a==null)break;s++,o=0,r=a}}return t.columns=o+1,t.rows=s+1,t}function Zl(n,e,t){const r=new Set(t?t.getNodes():[]);Qu(e,(o,s)=>{const i=o.elem;r.has(s)?(o.highlighted=!0,Fm(n,o)):(o.highlighted=!1,Bm(n,o),i.getAttribute("style")||i.removeAttribute("style"))})}function Qu(n,e){const{domRows:t}=n;for(let r=0;r<t.length;r++){const o=t[r];if(o)for(let s=0;s<o.length;s++){const i=o[s];if(!i)continue;const l=be(i.elem);l!==null&&e(i,l,{x:s,y:r})}}}function Im(n,e){e.disableHighlightStyle(),Qu(e.table,t=>{t.highlighted=!0,Fm(n,t)})}function jO(n,e){e.enableHighlightStyle(),Qu(e.table,t=>{const r=t.elem;t.highlighted=!1,Bm(n,t),r.getAttribute("style")||r.removeAttribute("style")})}const Lm=(n,e,t,r,o)=>{const s=o==="forward";switch(o){case"backward":case"forward":return t!==(s?n.table.columns-1:0)?ec(e.getCellNodeFromCordsOrThrow(t+(s?1:-1),r,n.table),s):r!==(s?n.table.rows-1:0)?ec(e.getCellNodeFromCordsOrThrow(s?0:n.table.columns-1,r+(s?1:-1),n.table),s):s?e.selectNext():e.selectPrevious(),!0;case"up":return r!==0?ec(e.getCellNodeFromCordsOrThrow(t,r-1,n.table),!1):e.selectPrevious(),!0;case"down":return r!==n.table.rows-1?ec(e.getCellNodeFromCordsOrThrow(t,r+1,n.table),!0):e.selectNext(),!0;default:return!1}},UO=(n,e,t,r,o)=>{const s=o==="forward";switch(o){case"backward":case"forward":return t!==(s?n.table.columns-1:0)&&n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t+(s?1:-1),r,n.table)),!0;case"up":return r!==0?(n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t,r-1,n.table)),!0):!1;case"down":return r!==n.table.rows-1?(n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t,r+1,n.table)),!0):!1;default:return!1}};function Qn(n,e){if(v(n)||Ce(n)){const t=e.isParentOf(n.anchor.getNode()),r=e.isParentOf(n.focus.getNode());return t&&r}return!1}function ec(n,e){e?n.selectStart():n.selectEnd()}const Zu="172,206,247";function Fm(n,e){const t=e.elem,r=be(t);if(!Q(r))throw Error("Expected to find LexicalNode from Table Cell DOMNode");r.getBackgroundColor()===null?t.style.setProperty("background-color",`rgb(${Zu})`):t.style.setProperty("background-image",`linear-gradient(to right, rgba(${Zu},0.85), rgba(${Zu},0.85))`),t.style.setProperty("caret-color","transparent")}function Bm(n,e){const t=e.elem,r=be(t);if(!Q(r))throw Error("Expected to find LexicalNode from Table Cell DOMNode");r.getBackgroundColor()===null&&t.style.removeProperty("background-color"),t.style.removeProperty("background-image"),t.style.removeProperty("caret-color")}function tc(n){const e=z(n,Q);return Q(e)?e:null}function Cr(n){const e=z(n,Me);return Me(e)?e:null}function Fs(n,e,t,r,o){if((t==="up"||t==="down")&&HO(n))return!1;const s=M();if(!Qn(s,r)){if(v(s)){if(s.isCollapsed()&&t==="backward"){const i=s.anchor.type,l=s.anchor.offset;if(i!=="element"&&!(i==="text"&&l===0))return!1;const c=s.anchor.getNode();if(!c)return!1;const a=z(c,d=>A(d)&&!d.isInline());if(!a)return!1;const f=a.getPreviousSibling();return!f||!Me(f)?!1:(Nr(e),f.selectEnd(),!0)}else if(e.shiftKey&&(t==="up"||t==="down")){const i=s.focus.getNode();if(it(i)){const l=s.getNodes()[0];if(l){const c=z(l,Q);if(c&&r.isParentOf(c)){const a=r.getFirstDescendant(),f=r.getLastDescendant();if(!a||!f)return!1;const[d]=Ct(a),[u]=Ct(f),h=r.getCordsFromCellNode(d,o.table),g=r.getCordsFromCellNode(u,o.table),p=r.getDOMCellFromCordsOrThrow(h.x,h.y,o.table),_=r.getDOMCellFromCordsOrThrow(g.x,g.y,o.table);return o.setAnchorCellForSelection(p),o.setFocusCellForSelection(_,!0),!0}}return!1}else{const l=z(i,a=>A(a)&&!a.isInline());if(!l)return!1;const c=t==="down"?l.getNextSibling():l.getPreviousSibling();if(Me(c)&&o.tableNodeKey===c.getKey()){const a=c.getFirstDescendant(),f=c.getLastDescendant();if(!a||!f)return!1;const[d]=Ct(a),[u]=Ct(f),h=s.clone();return h.focus.set((t==="up"?d:u).getKey(),t==="up"?0:u.getChildrenSize(),"element"),Pe(h),!0}}}}return!1}if(v(s)&&s.isCollapsed()){const{anchor:i,focus:l}=s,c=z(i.getNode(),Q),a=z(l.getNode(),Q);if(!Q(c)||!c.is(a))return!1;const f=Cr(c);if(f!==r&&f!=null){const m=n.getElementByKey(f.getKey());if(m!=null)return o.table=So(m),Fs(n,e,t,f,o)}if(t==="backward"||t==="forward"){const m=i.type,C=i.offset,N=i.getNode();if(!N)return!1;const S=s.getNodes();return S.length===1&&st(S[0])?!1:YO(m,C,N,t)?GO(e,N,r,t):!1}const d=n.getElementByKey(c.__key),u=n.getElementByKey(i.key);if(u==null||d==null)return!1;let h;if(i.type==="element")h=u.getBoundingClientRect();else{const m=window.getSelection();if(m===null||m.rangeCount===0)return!1;h=m.getRangeAt(0).getBoundingClientRect()}const g=t==="up"?c.getFirstChild():c.getLastChild();if(g==null)return!1;const p=n.getElementByKey(g.__key);if(p==null)return!1;const _=p.getBoundingClientRect();if(t==="up"?_.top>h.top-h.height:h.bottom+h.height>_.bottom){Nr(e);const m=r.getCordsFromCellNode(c,o.table);if(e.shiftKey){const C=r.getDOMCellFromCordsOrThrow(m.x,m.y,o.table);o.setAnchorCellForSelection(C),o.setFocusCellForSelection(C,!0)}else return Lm(o,r,m.x,m.y,t);return!0}}else if(Ce(s)){const{anchor:i,focus:l}=s,c=z(i.getNode(),Q),a=z(l.getNode(),Q),[f]=s.getNodes(),d=n.getElementByKey(f.getKey());if(!Q(c)||!Q(a)||!Me(f)||d==null)return!1;o.updateTableTableSelection(s);const u=So(d),h=r.getCordsFromCellNode(c,u),g=r.getDOMCellFromCordsOrThrow(h.x,h.y,u);if(o.setAnchorCellForSelection(g),Nr(e),e.shiftKey){const p=r.getCordsFromCellNode(a,u);return UO(o,f,p.x,p.y,t)}else a.selectEnd();return!0}return!1}function Nr(n){n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()}function HO(n){const e=n.getRootElement();return e?e.hasAttribute("aria-controls")&&e.getAttribute("aria-controls")==="typeahead-menu":!1}function YO(n,e,t,r){return JO(n,t,r)||VO(n,e,t,r)}function JO(n,e,t){return n==="element"&&(t==="backward"?e.getPreviousSibling()===null:e.getNextSibling()===null)}function VO(n,e,t,r){const o=z(t,i=>A(i)&&!i.isInline());if(!o)return!1;const s=r==="backward"?e===0:e===t.getTextContentSize();return n==="text"&&s&&(r==="backward"?o.getPreviousSibling()===null:o.getNextSibling()===null)}function GO(n,e,t,r){const o=z(e,Q);if(!Q(o))return!1;const[s,i]=Yt(t,o,o);if(!XO(s,i,r))return!1;const l=qO(e,r,t);return!l||Me(l)?!1:(Nr(n),r==="backward"?l.selectEnd():l.selectStart(),!0)}function XO(n,e,t){const r=n[0][0],o=n[n.length-1][n[0].length-1],{startColumn:s,startRow:i}=e;return t==="backward"?s===r.startColumn&&i===r.startRow:s===o.startColumn&&i===o.startRow}function qO(n,e,t){const r=z(n,s=>A(s)&&!s.isInline());if(!r)return;const o=e==="backward"?r.getPreviousSibling():r.getNextSibling();return o&&Me(o)?o:e==="backward"?t.getPreviousSibling():t.getNextSibling()}function Km(n,e,t){const r=ie();n==="first"?e.insertBefore(r):e.insertAfter(r),r.append(...t||[]),r.selectEnd()}function Wm(n,e,t){const r=t.getParent();if(!r)return;const o=n.getElementByKey(r.getKey());if(!o)return;const s=window.getSelection();if(!s||s.anchorNode!==o)return;const i=z(e.anchor.getNode(),_=>Q(_));if(!i)return;const l=z(i,_=>Me(_));if(!Me(l)||!l.is(t))return;const[c,a]=Yt(t,i,i),f=c[0][0],d=c[c.length-1][c[0].length-1],{startRow:u,startColumn:h}=a,g=u===f.startRow&&h===f.startColumn,p=u===d.startRow&&h===d.startColumn;return g?"first":p?"last":void 0}class Bs extends yt{static getType(){return"table"}static clone(e){return new Bs(e.__key)}static importDOM(){return{table:e=>({conversion:ZO,priority:1})}}static importJSON(e){return nc()}constructor(e){super(e)}exportJSON(){return{...super.exportJSON(),type:"table",version:1}}createDOM(e,t){const r=document.createElement("table");return Ie(r,e.theme.table),r}updateDOM(){return!1}exportDOM(e){return{...super.exportDOM(e),after:t=>{if(t){const r=t.cloneNode(),o=document.createElement("colgroup"),s=document.createElement("tbody");qn(t)&&s.append(...t.children);const i=this.getFirstChildOrThrow();if(!ke(i))throw new Error("Expected to find row node.");const l=i.getChildrenSize();for(let c=0;c<l;c++){const a=document.createElement("col");o.append(a)}return r.replaceChildren(o,s),r}}}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:r,domRows:o}=t;for(let s=0;s<r;s++){const i=o[s];if(i==null)continue;const l=i.findIndex(c=>{if(!c)return;const{elem:a}=c;return be(a)===e});if(l!==-1)return{x:l,y:s}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,r){const{domRows:o}=r,s=o[t];if(s==null)return null;const i=e<s.length?e:s.length-1,l=s[i];return l??null}getDOMCellFromCordsOrThrow(e,t,r){const o=this.getDOMCellFromCords(e,t,r);if(!o)throw new Error("Cell not found at cords.");return o}getCellNodeFromCords(e,t,r){const o=this.getDOMCellFromCords(e,t,r);if(o==null)return null;const s=be(o.elem);return Q(s)?s:null}getCellNodeFromCordsOrThrow(e,t,r){const o=this.getCellNodeFromCords(e,t,r);if(!o)throw new Error("Node at cords not TableCellNode.");return o}canSelectBefore(){return!0}canIndent(){return!1}}function QO(n,e){const t=n.getElementByKey(e.getKey());if(t==null)throw new Error("Table Element Not Found");return So(t)}function ZO(n){return{node:nc()}}function nc(){return ot(new Bs)}function Me(n){return n instanceof Bs}const e0=Object.freeze(Object.defineProperty({__proto__:null,$computeTableMap:Yt,$computeTableMapSkipCellCheck:km,$createTableCellNode:Mt,$createTableNode:nc,$createTableNodeWithDimensions:wO,$createTableRowNode:yr,$createTableSelection:Xu,$deleteTableColumn:$O,$deleteTableColumn__EXPERIMENTAL:IO,$deleteTableRow__EXPERIMENTAL:PO,$findCellNode:tc,$findTableNode:Cr,$getElementForTableNode:QO,$getNodeTriplet:Ct,$getTableCellNodeFromLexicalNode:bO,$getTableCellNodeRect:Gu,$getTableColumnIndexFromTableCellNode:vO,$getTableNodeFromLexicalNodeOrThrow:Yu,$getTableRowIndexFromTableCellNode:OO,$getTableRowNodeFromTableCellNodeOrThrow:Hu,$insertTableColumn:kO,$insertTableColumn__EXPERIMENTAL:RO,$insertTableRow:DO,$insertTableRow__EXPERIMENTAL:AO,$isTableCellNode:Q,$isTableNode:Me,$isTableRowNode:ke,$isTableSelection:Ce,$removeTableRowAtIndex:MO,$unmergeCell:LO,INSERT_TABLE_COMMAND:TO,TableCellHeaderStates:ge,TableCellNode:No,TableNode:Bs,TableObserver:Rm,TableRowNode:Is,applyTableHandlers:KO,getDOMCellFromTarget:qu,getTableObserverFromTableElement:zO},Symbol.toStringTag,{value:"Module"})),zm=/^(\d+(?:\.\d+)?)px$/,pe={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class To extends yt{static getType(){return"tablecell"}static clone(e){const t=new To(e.__headerState,e.__colSpan,e.__width,e.__key);return t.__rowSpan=e.__rowSpan,t.__backgroundColor=e.__backgroundColor,t}static importDOM(){return{td:e=>({conversion:jm,priority:0}),th:e=>({conversion:jm,priority:0})}}static importJSON(e){const t=e.colSpan||1,r=e.rowSpan||1,o=Dt(e.headerState,t,e.width||void 0);return o.__rowSpan=r,o.__backgroundColor=e.backgroundColor||null,o}constructor(e=pe.NO_STATUS,t=1,r,o){super(o),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=r,this.__backgroundColor=null}createDOM(e){const t=document.createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(t.style.backgroundColor=this.__backgroundColor),Ie(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const{element:t}=super.exportDOM(e);if(t){const r=t;r.style.border="1px solid black",this.__colSpan>1&&(r.colSpan=this.__colSpan),this.__rowSpan>1&&(r.rowSpan=this.__rowSpan),r.style.width=`${this.getWidth()||75}px`,r.style.verticalAlign="top",r.style.textAlign="start";const o=this.getBackgroundColor();o!==null?r.style.backgroundColor=o:this.hasHeader()&&(r.style.backgroundColor="#f2f3f5")}return{element:t}}exportJSON(){return{...super.exportJSON(),backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,type:"tablecell",width:this.getWidth()}}getColSpan(){return this.__colSpan}setColSpan(e){return this.getWritable().__colSpan=e,this}getRowSpan(){return this.__rowSpan}setRowSpan(e){return this.getWritable().__rowSpan=e,this}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e){return this.getWritable().__headerState=e,this.__headerState}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){return this.getWritable().__width=e,this.__width}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){this.getWritable().__backgroundColor=e}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==pe.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function jm(n){const e=n,t=n.nodeName.toLowerCase();let r;zm.test(e.style.width)&&(r=parseFloat(e.style.width));const o=Dt(t==="th"?pe.ROW:pe.NO_STATUS,e.colSpan,r);o.__rowSpan=e.rowSpan;const s=e.style.backgroundColor;s!==""&&(o.__backgroundColor=s);const i=e.style,l=i.textDecoration.split(" "),c=i.fontWeight==="700"||i.fontWeight==="bold",a=l.includes("line-through"),f=i.fontStyle==="italic",d=l.includes("underline");return{after:u=>(u.length===0&&u.push(ie()),u),forChild:(u,h)=>{if(Z(h)&&!A(u)){const g=ie();return gl(u)&&u.getTextContent()===`
42
+ `?null:(L(u)&&(c&&u.toggleFormat("bold"),a&&u.toggleFormat("strikethrough"),f&&u.toggleFormat("italic"),d&&u.toggleFormat("underline")),g.append(u),g)}return u},node:o}}function Dt(n,e=1,t){return ot(new To(n,e,t))}function Z(n){return n instanceof To}const t0=no("INSERT_TABLE_COMMAND");class Ks extends yt{static getType(){return"tablerow"}static clone(e){return new Ks(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:n0,priority:0})}}static importJSON(e){return Sr(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){return{...super.exportJSON(),...this.getHeight()&&{height:this.getHeight()},type:"tablerow",version:1}}createDOM(e){const t=document.createElement("tr");return this.__height&&(t.style.height=`${this.__height}px`),Ie(t,e.theme.tableRow),t}isShadowRoot(){return!0}setHeight(e){return this.getWritable().__height=e,this.__height}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function n0(n){const e=n;let t;return zm.test(e.style.height)&&(t=parseFloat(e.style.height)),{node:Sr(t)}}function Sr(n){return ot(new Ks(n))}function Re(n){return n instanceof Ks}function r0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var le=r0(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});const o0=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0;function s0(n,e,t=!0){const r=lc();for(let o=0;o<n;o++){const s=Sr();for(let i=0;i<e;i++){let l=pe.NO_STATUS;typeof t=="object"?(o===0&&t.rows&&(l|=pe.ROW),i===0&&t.columns&&(l|=pe.COLUMN)):t&&(o===0&&(l|=pe.ROW),i===0&&(l|=pe.COLUMN));const c=Dt(l),a=ie();a.append(bt()),c.append(a),s.append(c)}r.append(s)}return r}function i0(n){const e=z(n,t=>Z(t));return Z(e)?e:null}function ef(n){const e=z(n,t=>Re(t));if(Re(e))return e;throw new Error("Expected table cell to be inside of table row.")}function tf(n){const e=z(n,t=>De(t));if(De(e))return e;throw new Error("Expected table cell to be inside of table.")}function l0(n){const e=ef(n);return tf(e).getChildren().findIndex(t=>t.is(e))}function c0(n){return ef(n).getChildren().findIndex(e=>e.is(n))}function Um(n,e){const t=tf(n),{x:r,y:o}=t.getCordsFromCellNode(n,e);return{above:t.getCellNodeFromCords(r,o-1,e),below:t.getCellNodeFromCords(r,o+1,e),left:t.getCellNodeFromCords(r-1,o,e),right:t.getCellNodeFromCords(r+1,o,e)}}function a0(n,e){const t=n.getChildren();if(e>=t.length||e<0)throw new Error("Expected table cell to be inside of table row.");return t[e].remove(),n}function u0(n,e,t=!0,r,o){const s=n.getChildren();if(e>=s.length||e<0)throw new Error("Table row target index out of range");const i=s[e];if(!Re(i))throw new Error("Row before insertion index does not exist.");for(let l=0;l<r;l++){const c=i.getChildren(),a=c.length,f=Sr();for(let d=0;d<a;d++){const u=c[d];Z(u)||le(12);const{above:h,below:g}=Um(u,o);let p=pe.NO_STATUS;const _=h&&h.getWidth()||g&&g.getWidth()||void 0;(h&&h.hasHeaderState(pe.COLUMN)||g&&g.hasHeaderState(pe.COLUMN))&&(p|=pe.COLUMN);const y=Dt(p,1,_);y.append(ie()),f.append(y)}t?i.insertAfter(f):i.insertBefore(f)}return n}const nf=(n,e)=>n===pe.BOTH||n===e?e:pe.NO_STATUS;function f0(n=!0){const e=M();v(e)||Ne(e)||le(188);const t=e.focus.getNode(),[r,,o]=Nt(t),[s,i]=Jt(o,r,r),l=s[0].length,{startRow:c}=i;if(n){const a=c+r.__rowSpan-1,f=s[a],d=Sr();for(let h=0;h<l;h++){const{cell:g,startRow:p}=f[h];if(p+g.__rowSpan-1<=a){const _=f[h].cell.__headerState,y=nf(_,pe.COLUMN);d.append(Dt(y).append(ie()))}else g.setRowSpan(g.__rowSpan+1)}const u=o.getChildAtIndex(a);Re(u)||le(145),u.insertAfter(d)}else{const a=s[c],f=Sr();for(let u=0;u<l;u++){const{cell:h,startRow:g}=a[u];if(g===c){const p=a[u].cell.__headerState,_=nf(p,pe.COLUMN);f.append(Dt(_).append(ie()))}else h.setRowSpan(h.__rowSpan+1)}const d=o.getChildAtIndex(c);Re(d)||le(145),d.insertBefore(f)}}function d0(n,e,t=!0,r,o){const s=n.getChildren(),i=[];for(let l=0;l<s.length;l++){const c=s[l];if(Re(c))for(let a=0;a<r;a++){const f=c.getChildren();if(e>=f.length||e<0)throw new Error("Table column target index out of range");const d=f[e];Z(d)||le(12);const{left:u,right:h}=Um(d,o);let g=pe.NO_STATUS;(u&&u.hasHeaderState(pe.ROW)||h&&h.hasHeaderState(pe.ROW))&&(g|=pe.ROW);const p=Dt(g);p.append(ie()),i.push({newTableCell:p,targetCell:d})}}return i.forEach(({newTableCell:l,targetCell:c})=>{t?c.insertAfter(l):c.insertBefore(l)}),n}function h0(n=!0){const e=M();v(e)||Ne(e)||le(188);const t=e.anchor.getNode(),r=e.focus.getNode(),[o]=Nt(t),[s,,i]=Nt(r),[l,c,a]=Jt(i,s,o),f=l.length,d=n?Math.max(c.startColumn,a.startColumn):Math.min(c.startColumn,a.startColumn),u=n?d+s.__colSpan-1:d-1,h=i.getFirstChild();Re(h)||le(120);let g=null;function p(y=pe.NO_STATUS){const m=Dt(y).append(ie());return g===null&&(g=m),m}let _=h;e:for(let y=0;y<f;y++){if(y!==0){const x=_.getNextSibling();Re(x)||le(121),_=x}const m=l[y],C=m[u<0?0:u].cell.__headerState,N=nf(C,pe.ROW);if(u<0){rf(_,p(N));continue}const{cell:S,startColumn:T,startRow:E}=m[u];if(T+S.__colSpan-1<=u){let x=S,w=E,O=u;for(;w!==y&&x.__rowSpan>1;){if(O-=S.__colSpan,!(O>=0)){_.append(p(N));continue e}{const{cell:D,startRow:B}=m[O];x=D,w=B}}x.insertAfter(p(N))}else S.setColSpan(S.__colSpan+1)}g!==null&&Ws(g)}function g0(n,e){const t=n.getChildren();for(let r=0;r<t.length;r++){const o=t[r];if(Re(o)){const s=o.getChildren();if(e>=s.length||e<0)throw new Error("Table column target index out of range");s[e].remove()}}return n}function p0(){const n=M();v(n)||Ne(n)||le(188);const e=n.anchor.getNode(),t=n.focus.getNode(),[r,,o]=Nt(e),[s]=Nt(t),[i,l,c]=Jt(o,r,s),{startRow:a}=l,{startRow:f}=c,d=f+s.__rowSpan-1;if(i.length===d-a+1)return void o.remove();const u=i[0].length,h=i[d+1],g=o.getChildAtIndex(d+1);for(let p=d;p>=a;p--){for(let y=u-1;y>=0;y--){const{cell:m,startRow:C,startColumn:N}=i[p][y];if(N===y&&(p===a&&C<a&&m.setRowSpan(m.__rowSpan-(C-a)),C>=a&&C+m.__rowSpan-1>d))if(m.setRowSpan(m.__rowSpan-(d-C+1)),g===null&&le(122),y===0)rf(g,m);else{const{cell:S}=h[y-1];S.insertAfter(m)}}const _=o.getChildAtIndex(p);Re(_)||le(123,String(p)),_.remove()}if(h!==void 0){const{cell:p}=h[0];Ws(p)}else{const p=i[a-1],{cell:_}=p[0];Ws(_)}}function _0(){const n=M();v(n)||Ne(n)||le(188);const e=n.anchor.getNode(),t=n.focus.getNode(),[r,,o]=Nt(e),[s]=Nt(t),[i,l,c]=Jt(o,r,s),{startColumn:a}=l,{startRow:f,startColumn:d}=c,u=Math.min(a,d),h=Math.max(a+r.__colSpan-1,d+s.__colSpan-1),g=h-u+1;if(i[0].length===h-u+1)return o.selectPrevious(),void o.remove();const p=i.length;for(let m=0;m<p;m++)for(let C=u;C<=h;C++){const{cell:N,startColumn:S}=i[m][C];if(S<u){if(C===u){const T=u-S;N.setColSpan(N.__colSpan-Math.min(g,N.__colSpan-T))}}else if(S+N.__colSpan-1>h){if(C===h){const T=h-S+1;N.setColSpan(N.__colSpan-T)}}else N.remove()}const _=i[f],y=a>d?_[a+r.__colSpan]:_[d+s.__colSpan];if(y!==void 0){const{cell:m}=y;Ws(m)}else{const m=d<a?_[d-1]:_[a-1],{cell:C}=m;Ws(C)}}function Ws(n){const e=n.getFirstDescendant();e==null?n.selectStart():e.getParentOrThrow().selectStart()}function rf(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function m0(){const n=M();v(n)||Ne(n)||le(188);const e=n.anchor.getNode(),[t,r,o]=Nt(e),s=t.__colSpan,i=t.__rowSpan;if(s>1){for(let l=1;l<s;l++)t.insertAfter(Dt(pe.NO_STATUS).append(ie()));t.setColSpan(1)}if(i>1){const[l,c]=Jt(o,t,t),{startColumn:a,startRow:f}=c;let d;for(let u=1;u<i;u++){const h=f+u,g=l[h];d=(d||r).getNextSibling(),Re(d)||le(125);let p=null;for(let _=0;_<a;_++){const y=g[_],m=y.cell;y.startRow===h&&(p=m),m.__colSpan>1&&(_+=m.__colSpan-1)}if(p===null)for(let _=0;_<s;_++)rf(d,Dt(pe.NO_STATUS).append(ie()));else for(let _=0;_<s;_++)p.insertAfter(Dt(pe.NO_STATUS).append(ie()))}t.setRowSpan(1)}}function Jt(n,e,t){const[r,o,s]=Hm(n,e,t);return o===null&&le(110),s===null&&le(111),[r,o,s]}function Hm(n,e,t){const r=[];let o=null,s=null;function i(a,f,d){const u={cell:d,startColumn:f,startRow:a},h=d.__rowSpan,g=d.__colSpan;for(let p=0;p<h;p++){r[a+p]===void 0&&(r[a+p]=[]);for(let _=0;_<g;_++)r[a+p][f+_]=u}e!==null&&e.is(d)&&(o=u),t!==null&&t.is(d)&&(s=u)}function l(a,f){return r[a]===void 0||r[a][f]===void 0}const c=n.getChildren();for(let a=0;a<c.length;a++){const f=c[a];Re(f)||le(146);const d=f.getChildren();let u=0;for(const h of d){for(Z(h)||le(147);!l(a,u);)u++;i(a,u,h),u+=h.__colSpan}}return[r,o,s]}function Nt(n){let e;if(n instanceof To)e=n;else if("__type"in n){const o=z(n,Z);Z(o)||le(148),e=o}else{const o=z(n.getNode(),Z);Z(o)||le(148),e=o}const t=e.getParent();Re(t)||le(149);const r=t.getParent();return De(r)||le(150),[e,t,r]}function of(n){const[e,,t]=Nt(n),r=t.getChildren(),o=r.length,s=r[0].getChildren().length,i=new Array(o);for(let l=0;l<o;l++)i[l]=new Array(s);for(let l=0;l<o;l++){const c=r[l].getChildren();let a=0;for(let f=0;f<c.length;f++){for(;i[l][a];)a++;const d=c[f],u=d.__rowSpan||1,h=d.__colSpan||1;for(let g=0;g<u;g++)for(let p=0;p<h;p++)i[l+g][a+p]=d;if(e===d)return{colSpan:h,columnIndex:a,rowIndex:l,rowSpan:u};a+=h}}return null}class rc{constructor(e,t,r){this.anchor=t,this.focus=r,t._selection=this,r._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!Ne(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,r){this.dirty=!0,this.tableKey=e,this.anchor.key=t,this.focus.key=r,this._cachedNodes=null}clone(){return new rc(this.tableKey,this.anchor,this.focus)}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.focus.getNode();A(t)||le(151),_l(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const e=Ot(this.anchor.key);Z(e)||le(152);const t=of(e);t===null&&le(153);const r=Ot(this.focus.key);Z(r)||le(154);const o=of(r);o===null&&le(155);const s=Math.min(t.columnIndex,o.columnIndex),i=Math.max(t.columnIndex,o.columnIndex),l=Math.min(t.rowIndex,o.rowIndex),c=Math.max(t.rowIndex,o.rowIndex);return{fromX:Math.min(s,i),fromY:Math.min(l,c),toX:Math.max(s,i),toY:Math.max(l,c)}}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this.anchor.getNode(),r=this.focus.getNode(),o=z(t,Z),s=z(r,Z);Z(o)||le(152),Z(s)||le(154);const i=o.getParent();Re(i)||le(156);const l=i.getParent();De(l)||le(157);const c=s.getParents()[1];if(c!==l){if(l.isParentOf(s)){const E=c.getParent();E==null&&le(159),this.set(this.tableKey,s.getKey(),E.getKey())}else{const E=l.getParent();E==null&&le(158),this.set(this.tableKey,E.getKey(),s.getKey())}return this.getNodes()}const[a,f,d]=Jt(l,o,s);let u=Math.min(f.startColumn,d.startColumn),h=Math.min(f.startRow,d.startRow),g=Math.max(f.startColumn+f.cell.__colSpan-1,d.startColumn+d.cell.__colSpan-1),p=Math.max(f.startRow+f.cell.__rowSpan-1,d.startRow+d.cell.__rowSpan-1),_=u,y=h,m=u,C=h;function N(E){const{cell:x,startColumn:w,startRow:O}=E;u=Math.min(u,w),h=Math.min(h,O),g=Math.max(g,w+x.__colSpan-1),p=Math.max(p,O+x.__rowSpan-1)}for(;u<_||h<y||g>m||p>C;){if(u<_){const E=C-y,x=_-1;for(let w=0;w<=E;w++)N(a[y+w][x]);_=x}if(h<y){const E=m-_,x=y-1;for(let w=0;w<=E;w++)N(a[x][_+w]);y=x}if(g>m){const E=C-y,x=m+1;for(let w=0;w<=E;w++)N(a[y+w][x]);m=x}if(p>C){const E=m-_,x=C+1;for(let w=0;w<=E;w++)N(a[x][_+w]);C=x}}const S=[l];let T=null;for(let E=h;E<=p;E++)for(let x=u;x<=g;x++){const{cell:w}=a[E][x],O=w.getParent();Re(O)||le(160),O!==T&&S.push(O),S.push(w,...y0(w)),T=O}return Wp()||(this._cachedNodes=S),S}getTextContent(){const e=this.getNodes().filter(r=>Z(r));let t="";for(let r=0;r<e.length;r++){const o=e[r],s=o.__parent,i=(e[r+1]||{}).__parent;t+=o.getTextContent()+(i!==s?`
43
+ `:" ")}return t}}function Ne(n){return n instanceof rc}function sf(){const n=fl("root",0,"element"),e=fl("root",0,"element");return new rc("root",n,e)}function y0(n){const e=[],t=[n];for(;t.length>0;){const r=t.pop();r===void 0&&le(112),A(r)&&t.unshift(...r.getChildren()),r!==n&&e.push(r)}return e}class Ym{constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.trackTable(),this.isSelecting=!1}getTable(){return this.table}removeListeners(){Array.from(this.listenersToRemove).forEach(e=>e())}trackTable(){const e=new MutationObserver(t=>{this.editor.update(()=>{let r=!1;for(let s=0;s<t.length;s++){const i=t[s].target.nodeName;if(i==="TABLE"||i==="TBODY"||i==="THEAD"||i==="TR"){r=!0;break}}if(!r)return;const o=this.editor.getElementByKey(this.tableNodeKey);if(!o)throw new Error("Expected to find TableElement in DOM");this.table=xo(o)})});this.editor.update(()=>{const t=this.editor.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");this.table=xo(t),e.observe(t,{attributes:!0,childList:!0,subtree:!0})})}clearHighlight(){const e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.enableHighlightStyle(),e.update(()=>{if(!De(Ot(this.tableNodeKey)))throw new Error("Expected TableNode.");const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");const r=xo(t);oc(e,r,null),Pe(null),e.dispatchCommand(Wt,void 0)})}enableHighlightStyle(){const e=this.editor;e.update(()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");zl(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1})}disableHighlightStyle(){const e=this.editor;e.update(()=>{const t=e.getElementByKey(this.tableNodeKey);if(!t)throw new Error("Expected to find TableElement in DOM");Ie(t,e._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0})}updateTableTableSelection(e){if(e!==null&&e.tableKey===this.tableNodeKey){const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.disableHighlightStyle(),oc(t,this.table,this.tableSelection)}else e==null?this.clearHighlight():(this.tableNodeKey=e.tableKey,this.updateTableTableSelection(e))}setFocusCellForSelection(e,t=!1){const r=this.editor;r.update(()=>{const o=Ot(this.tableNodeKey);if(!De(o))throw new Error("Expected TableNode.");if(!r.getElementByKey(this.tableNodeKey))throw new Error("Expected to find TableElement in DOM");const s=e.x,i=e.y;if(this.focusCell=e,this.anchorCell!==null){const l=Vm(r._window);l&&l.setBaseAndExtent(this.anchorCell.elem,0,this.focusCell.elem,0)}if(this.isHighlightingCells||this.anchorX===s&&this.anchorY===i&&!t){if(s===this.focusX&&i===this.focusY)return}else this.isHighlightingCells=!0,this.disableHighlightStyle();if(this.focusX=s,this.focusY=i,this.isHighlightingCells){const l=be(e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null&&Z(l)&&o.is(Tr(l))){const c=l.getKey();this.tableSelection=this.tableSelection.clone()||sf(),this.focusCellNodeKey=c,this.tableSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),Pe(this.tableSelection),r.dispatchCommand(Wt,void 0),oc(r,this.table,this.tableSelection)}}})}setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.editor.update(()=>{const t=be(e.elem);if(Z(t)){const r=t.getKey();this.tableSelection=this.tableSelection!=null?this.tableSelection.clone():sf(),this.anchorCellNodeKey=r}})}formatCells(e){this.editor.update(()=>{const t=M();Ne(t)||le(11);const r=dl(),o=r.anchor,s=r.focus;t.getNodes().forEach(i=>{Z(i)&&i.getTextContentSize()!==0&&(o.set(i.getKey(),0,"element"),s.set(i.getKey(),i.getChildrenSize(),"element"),r.formatText(e))}),Pe(t),this.editor.dispatchCommand(Wt,void 0)})}clearText(){const e=this.editor;e.update(()=>{const t=Ot(this.tableNodeKey);if(!De(t))throw new Error("Expected TableNode.");const r=M();Ne(r)||le(11);const o=r.getNodes().filter(Z);o.length!==this.table.columns*this.table.rows?(o.forEach(s=>{if(A(s)){const i=ie(),l=bt();i.append(l),s.append(i),s.getChildren().forEach(c=>{c!==i&&c.remove()})}}),oc(e,this.table,null),Pe(null),e.dispatchCommand(Wt,void 0)):(t.selectPrevious(),t.remove(),Oe().selectStart())})}}const Jm="__lexicalTableSelection",Vm=n=>o0?(n||window).getSelection():null;function C0(n,e,t,r){const o=t.getRootElement();if(o===null)throw new Error("No root element.");const s=new Ym(t,n.getKey()),i=t._window||window;(function(d,u){d[Jm]=u})(e,s);const l=()=>{const d=()=>{s.isSelecting=!1,i.removeEventListener("mouseup",d),i.removeEventListener("mousemove",u)},u=h=>{setTimeout(()=>{if(1&~h.buttons&&s.isSelecting)return s.isSelecting=!1,i.removeEventListener("mouseup",d),void i.removeEventListener("mousemove",u);const g=lf(h.target);g===null||s.anchorX===g.x&&s.anchorY===g.y||(h.preventDefault(),s.setFocusCellForSelection(g))},0)};return{onMouseMove:u,onMouseUp:d}};e.addEventListener("mousedown",d=>{setTimeout(()=>{if(d.button!==0||!i)return;const u=lf(d.target);u!==null&&(xr(d),s.setAnchorCellForSelection(u));const{onMouseUp:h,onMouseMove:g}=l();s.isSelecting=!0,i.addEventListener("mouseup",h),i.addEventListener("mousemove",g)},0)});const c=d=>{d.button===0&&t.update(()=>{const u=M(),h=d.target;Ne(u)&&u.tableKey===s.tableNodeKey&&o.contains(h)&&s.clearHighlight()})};i.addEventListener("mousedown",c),s.listenersToRemove.add(()=>i.removeEventListener("mousedown",c)),s.listenersToRemove.add(t.registerCommand(El,d=>zs(t,d,"down",n,s),vt)),s.listenersToRemove.add(t.registerCommand(Ol,d=>zs(t,d,"up",n,s),vt)),s.listenersToRemove.add(t.registerCommand(wl,d=>zs(t,d,"backward",n,s),vt)),s.listenersToRemove.add(t.registerCommand(bl,d=>zs(t,d,"forward",n,s),vt)),s.listenersToRemove.add(t.registerCommand(Dl,d=>{const u=M();if(Ne(u)){const h=z(u.focus.getNode(),Z);if(Z(h))return xr(d),h.selectEnd(),!0}return!1},vt)),[Tl,Zr,Jn].forEach(d=>{s.listenersToRemove.add(t.registerCommand(d,(u=>()=>{const h=M();if(!Zn(h,n))return!1;if(Ne(h))return s.clearText(),!0;if(v(h)){const g=z(h.anchor.getNode(),S=>Z(S));if(!Z(g))return!1;const p=h.anchor.getNode(),_=h.focus.getNode(),y=n.isParentOf(p),m=n.isParentOf(_);if(y&&!m||m&&!y)return s.clearText(),!0;const C=z(h.anchor.getNode(),S=>A(S)),N=C&&z(C,S=>A(S)&&Z(S.getParent()));if(!A(N)||!A(C))return!1;if(u===Zr&&N.getPreviousSibling()===null)return!0}return!1})(d),ye))});const a=d=>{const u=M();if(!Zn(u,n)){const h=u?u.getNodes():null;if(h){const g=h.find(p=>De(p)&&p.getKey()===s.tableNodeKey);if(De(g)){if(!g.getParent())return!1;g.remove()}}return!1}if(Ne(u))return d&&(d.preventDefault(),d.stopPropagation()),s.clearText(),!0;if(v(u)){const h=z(u.anchor.getNode(),g=>Z(g));if(!Z(h))return!1}return!1};function f(d){const u=n.getCordsFromCellNode(d,s.table);return n.getDOMCellFromCordsOrThrow(u.x,u.y,s.table)}return s.listenersToRemove.add(t.registerCommand(vl,a,ye)),s.listenersToRemove.add(t.registerCommand(Ml,a,ye)),s.listenersToRemove.add(t.registerCommand(Sl,d=>{const u=M();if(u){if(!Ne(u)&&!v(u))return!1;co(t,lt(d,ClipboardEvent)?d:null,hm(u));const h=a(d);return v(u)&&u.removeText(),h}return!1},ye)),s.listenersToRemove.add(t.registerCommand(Gn,d=>{const u=M();if(!Zn(u,n))return!1;if(Ne(u))return s.formatCells(d),!0;if(v(u)){const h=z(u.anchor.getNode(),g=>Z(g));if(!Z(h))return!1}return!1},ye)),s.listenersToRemove.add(t.registerCommand(Vn,d=>{const u=M();if(!Ne(u)||!Zn(u,n))return!1;const h=u.anchor.getNode(),g=u.focus.getNode();if(!Z(h)||!Z(g))return!1;const[p,_,y]=Jt(n,h,g),m=Math.max(_.startRow,y.startRow),C=Math.max(_.startColumn,y.startColumn),N=Math.min(_.startRow,y.startRow),S=Math.min(_.startColumn,y.startColumn);for(let T=N;T<=m;T++)for(let E=S;E<=C;E++){const x=p[T][E].cell;x.setFormat(d);const w=x.getChildren();for(let O=0;O<w.length;O++){const D=w[O];A(D)&&!D.isInline()&&D.setFormat(d)}}return!0},ye)),s.listenersToRemove.add(t.registerCommand(Cl,d=>{const u=M();if(!Zn(u,n))return!1;if(Ne(u))return s.clearHighlight(),!1;if(v(u)){const h=z(u.anchor.getNode(),g=>Z(g));if(!Z(h))return!1;if(typeof d=="string"){const g=ey(t,u,n);if(g)return Zm(g,n,[bt(d)]),!0}}return!1},ye)),r&&s.listenersToRemove.add(t.registerCommand(Ip,d=>{const u=M();if(!v(u)||!u.isCollapsed()||!Zn(u,n))return!1;const h=ic(u.anchor.getNode());if(h===null)return!1;xr(d);const g=n.getCordsFromCellNode(h,s.table);return Xm(s,n,g.x,g.y,d.shiftKey?"backward":"forward"),!0},ye)),s.listenersToRemove.add(t.registerCommand(kp,d=>n.isSelected(),vt)),s.listenersToRemove.add(t.registerCommand(kl,d=>{const{nodes:u,selection:h}=d,g=h.getStartEndPoints(),p=Ne(h),_=v(h)&&z(h.anchor.getNode(),se=>Z(se))!==null&&z(h.focus.getNode(),se=>Z(se))!==null||p;if(u.length!==1||!De(u[0])||!_||g===null)return!1;const[y]=g,m=u[0],C=m.getChildren(),N=m.getFirstChildOrThrow().getChildrenSize(),S=m.getChildrenSize(),T=z(y.getNode(),se=>Z(se)),E=T&&z(T,se=>Re(se)),x=E&&z(E,se=>De(se));if(!Z(T)||!Re(E)||!De(x))return!1;const w=E.getIndexWithinParent(),O=Math.min(x.getChildrenSize()-1,w+S-1),D=T.getIndexWithinParent(),B=Math.min(E.getChildrenSize()-1,D+N-1),q=Math.min(D,B),Y=Math.min(w,O),J=Math.max(D,B),oe=Math.max(w,O),F=x.getChildren();let ce=0;for(let se=Y;se<=oe;se++){const We=F[se];if(!Re(We))return!1;const ae=C[ce];if(!Re(ae))return!1;const Ae=We.getChildren(),Ge=ae.getChildren();let Xe=0;for(let qe=q;qe<=J;qe++){const Te=Ae[qe];if(!Z(Te))return!1;const nt=Ge[Xe];if(!Z(nt))return!1;const ze=Te.getChildren();nt.getChildren().forEach(ve=>{L(ve)&&ie().append(ve),Te.append(ve)}),ze.forEach(ve=>ve.remove()),Xe++}ce++}return!0},ye)),s.listenersToRemove.add(t.registerCommand(Wt,()=>{const d=M(),u=Hn();if(v(d)){const{anchor:h,focus:g}=d,p=h.getNode(),_=g.getNode(),y=ic(p),m=ic(_),C=!(!y||!n.is(Tr(y))),N=!(!m||!n.is(Tr(m))),S=C!==N,T=C&&N,E=d.isBackward();if(S){const x=d.clone();if(N){const[w]=Jt(n,m,m),O=w[0][0].cell,D=w[w.length-1].at(-1).cell;x.focus.set(E?O.getKey():D.getKey(),E?O.getChildrenSize():D.getChildrenSize(),"element")}Pe(x),Gm(t,s)}else T&&(y.is(m)||(s.setAnchorCellForSelection(f(y)),s.setFocusCellForSelection(f(m),!0),s.isSelecting||setTimeout(()=>{const{onMouseUp:x,onMouseMove:w}=l();s.isSelecting=!0,i.addEventListener("mouseup",x),i.addEventListener("mousemove",w)},0)))}else if(d&&Ne(d)&&d.is(u)&&d.tableKey===n.getKey()){const h=Vm(t._window);if(h&&h.anchorNode&&h.focusNode){const g=be(h.focusNode),p=g&&!n.is(Tr(g)),_=be(h.anchorNode),y=_&&n.is(Tr(_));if(p&&y&&h.rangeCount>0){const m=yp(h,t);m&&(m.anchor.set(n.getKey(),d.isBackward()?n.getChildrenSize():0,"element"),h.removeAllRanges(),Pe(m))}}}return d&&!d.is(u)&&(Ne(d)||Ne(u))&&s.tableSelection&&!s.tableSelection.is(u)?(Ne(d)&&d.tableKey===s.tableNodeKey?s.updateTableTableSelection(d):!Ne(d)&&Ne(u)&&u.tableKey===s.tableNodeKey&&s.updateTableTableSelection(null),!1):(s.hasHijackedSelectionStyles&&!n.isSelected()?function(h,g){g.enableHighlightStyle(),cf(g.table,p=>{const _=p.elem;p.highlighted=!1,Qm(h,p),_.getAttribute("style")||_.removeAttribute("style")})}(t,s):!s.hasHijackedSelectionStyles&&n.isSelected()&&Gm(t,s),!1)},ye)),s.listenersToRemove.add(t.registerCommand(eo,()=>{const d=M();if(!v(d)||!d.isCollapsed()||!Zn(d,n))return!1;const u=ey(t,d,n);return!!u&&(Zm(u,n),!0)},ye)),s}function N0(n){return n[Jm]}function lf(n){let e=n;for(;e!=null;){const t=e.nodeName;if(t==="TD"||t==="TH"){const r=e._cell;return r===void 0?null:r}e=e.parentNode}return null}function xo(n){const e=[],t={columns:0,domRows:e,rows:0};let r=n.firstChild,o=0,s=0;for(e.length=0;r!=null;){const i=r.nodeName;if(i==="TD"||i==="TH"){const a={elem:r,hasBackgroundColor:r.style.backgroundColor!=="",highlighted:!1,x:o,y:s};r._cell=a;let f=e[s];f===void 0&&(f=e[s]=[]),f[o]=a}else{const a=r.firstChild;if(a!=null){r=a;continue}}const l=r.nextSibling;if(l!=null){o++,r=l;continue}const c=r.parentNode;if(c!=null){const a=c.nextSibling;if(a==null)break;s++,o=0,r=a}}return t.columns=o+1,t.rows=s+1,t}function oc(n,e,t){const r=new Set(t?t.getNodes():[]);cf(e,(o,s)=>{const i=o.elem;r.has(s)?(o.highlighted=!0,qm(n,o)):(o.highlighted=!1,Qm(n,o),i.getAttribute("style")||i.removeAttribute("style"))})}function cf(n,e){const{domRows:t}=n;for(let r=0;r<t.length;r++){const o=t[r];if(o)for(let s=0;s<o.length;s++){const i=o[s];if(!i)continue;const l=be(i.elem);l!==null&&e(i,l,{x:s,y:r})}}}function Gm(n,e){e.disableHighlightStyle(),cf(e.table,t=>{t.highlighted=!0,qm(n,t)})}const Xm=(n,e,t,r,o)=>{const s=o==="forward";switch(o){case"backward":case"forward":return t!==(s?n.table.columns-1:0)?sc(e.getCellNodeFromCordsOrThrow(t+(s?1:-1),r,n.table),s):r!==(s?n.table.rows-1:0)?sc(e.getCellNodeFromCordsOrThrow(s?0:n.table.columns-1,r+(s?1:-1),n.table),s):s?e.selectNext():e.selectPrevious(),!0;case"up":return r!==0?sc(e.getCellNodeFromCordsOrThrow(t,r-1,n.table),!1):e.selectPrevious(),!0;case"down":return r!==n.table.rows-1?sc(e.getCellNodeFromCordsOrThrow(t,r+1,n.table),!0):e.selectNext(),!0;default:return!1}},S0=(n,e,t,r,o)=>{const s=o==="forward";switch(o){case"backward":case"forward":return t!==(s?n.table.columns-1:0)&&n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t+(s?1:-1),r,n.table)),!0;case"up":return r!==0&&(n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t,r-1,n.table)),!0);case"down":return r!==n.table.rows-1&&(n.setFocusCellForSelection(e.getDOMCellFromCordsOrThrow(t,r+1,n.table)),!0);default:return!1}};function Zn(n,e){if(v(n)||Ne(n)){const t=e.isParentOf(n.anchor.getNode()),r=e.isParentOf(n.focus.getNode());return t&&r}return!1}function sc(n,e){e?n.selectStart():n.selectEnd()}const af="172,206,247";function qm(n,e){const t=e.elem,r=be(t);Z(r)||le(131),r.getBackgroundColor()===null?t.style.setProperty("background-color",`rgb(${af})`):t.style.setProperty("background-image",`linear-gradient(to right, rgba(${af},0.85), rgba(${af},0.85))`),t.style.setProperty("caret-color","transparent")}function Qm(n,e){const t=e.elem,r=be(t);Z(r)||le(131),r.getBackgroundColor()===null&&t.style.removeProperty("background-color"),t.style.removeProperty("background-image"),t.style.removeProperty("caret-color")}function ic(n){const e=z(n,Z);return Z(e)?e:null}function Tr(n){const e=z(n,De);return De(e)?e:null}function zs(n,e,t,r,o){if((t==="up"||t==="down")&&function(i){const l=i.getRootElement();return l?l.hasAttribute("aria-controls")&&l.getAttribute("aria-controls")==="typeahead-menu":!1}(n))return!1;const s=M();if(!Zn(s,r)){if(v(s)){if(s.isCollapsed()&&t==="backward"){const i=s.anchor.type,l=s.anchor.offset;if(i!=="element"&&(i!=="text"||l!==0))return!1;const c=s.anchor.getNode();if(!c)return!1;const a=z(c,d=>A(d)&&!d.isInline());if(!a)return!1;const f=a.getPreviousSibling();return!(!f||!De(f))&&(xr(e),f.selectEnd(),!0)}if(e.shiftKey&&(t==="up"||t==="down")){const i=s.focus.getNode();if(it(i)){const l=s.getNodes()[0];if(l){const c=z(l,Z);if(c&&r.isParentOf(c)){const a=r.getFirstDescendant(),f=r.getLastDescendant();if(!a||!f)return!1;const[d]=Nt(a),[u]=Nt(f),h=r.getCordsFromCellNode(d,o.table),g=r.getCordsFromCellNode(u,o.table),p=r.getDOMCellFromCordsOrThrow(h.x,h.y,o.table),_=r.getDOMCellFromCordsOrThrow(g.x,g.y,o.table);return o.setAnchorCellForSelection(p),o.setFocusCellForSelection(_,!0),!0}}return!1}{const l=z(i,a=>A(a)&&!a.isInline());if(!l)return!1;const c=t==="down"?l.getNextSibling():l.getPreviousSibling();if(De(c)&&o.tableNodeKey===c.getKey()){const a=c.getFirstDescendant(),f=c.getLastDescendant();if(!a||!f)return!1;const[d]=Nt(a),[u]=Nt(f),h=s.clone();return h.focus.set((t==="up"?d:u).getKey(),t==="up"?0:u.getChildrenSize(),"element"),Pe(h),!0}}}}return!1}if(v(s)&&s.isCollapsed()){const{anchor:i,focus:l}=s,c=z(i.getNode(),Z),a=z(l.getNode(),Z);if(!Z(c)||!c.is(a))return!1;const f=Tr(c);if(f!==r&&f!=null){const y=n.getElementByKey(f.getKey());if(y!=null)return o.table=xo(y),zs(n,e,t,f,o)}if(t==="backward"||t==="forward"){const y=i.type,m=i.offset,C=i.getNode();if(!C)return!1;const N=s.getNodes();return(N.length!==1||!st(N[0]))&&!!function(S,T,E,x){return function(w,O,D){return w==="element"&&(D==="backward"?O.getPreviousSibling()===null:O.getNextSibling()===null)}(S,E,x)||function(w,O,D,B){const q=z(D,J=>A(J)&&!J.isInline());if(!q)return!1;const Y=B==="backward"?O===0:O===D.getTextContentSize();return w==="text"&&Y&&(B==="backward"?q.getPreviousSibling()===null:q.getNextSibling()===null)}(S,T,E,x)}(y,m,C,t)&&function(S,T,E,x){const w=z(T,Z);if(!Z(w))return!1;const[O,D]=Jt(E,w,w);if(!function(q,Y,J){const oe=q[0][0],F=q[q.length-1][q[0].length-1],{startColumn:ce,startRow:se}=Y;return J==="backward"?ce===oe.startColumn&&se===oe.startRow:ce===F.startColumn&&se===F.startRow}(O,D,x))return!1;const B=function(q,Y,J){const oe=z(q,ce=>A(ce)&&!ce.isInline());if(!oe)return;const F=Y==="backward"?oe.getPreviousSibling():oe.getNextSibling();return F&&De(F)?F:Y==="backward"?J.getPreviousSibling():J.getNextSibling()}(T,x,E);return!B||De(B)?!1:(xr(S),x==="backward"?B.selectEnd():B.selectStart(),!0)}(e,C,r,t)}const d=n.getElementByKey(c.__key),u=n.getElementByKey(i.key);if(u==null||d==null)return!1;let h;if(i.type==="element")h=u.getBoundingClientRect();else{const y=window.getSelection();if(y===null||y.rangeCount===0)return!1;h=y.getRangeAt(0).getBoundingClientRect()}const g=t==="up"?c.getFirstChild():c.getLastChild();if(g==null)return!1;const p=n.getElementByKey(g.__key);if(p==null)return!1;const _=p.getBoundingClientRect();if(t==="up"?_.top>h.top-h.height:h.bottom+h.height>_.bottom){xr(e);const y=r.getCordsFromCellNode(c,o.table);if(!e.shiftKey)return Xm(o,r,y.x,y.y,t);{const m=r.getDOMCellFromCordsOrThrow(y.x,y.y,o.table);o.setAnchorCellForSelection(m),o.setFocusCellForSelection(m,!0)}return!0}}else if(Ne(s)){const{anchor:i,focus:l}=s,c=z(i.getNode(),Z),a=z(l.getNode(),Z),[f]=s.getNodes(),d=n.getElementByKey(f.getKey());if(!Z(c)||!Z(a)||!De(f)||d==null)return!1;o.updateTableTableSelection(s);const u=xo(d),h=r.getCordsFromCellNode(c,u),g=r.getDOMCellFromCordsOrThrow(h.x,h.y,u);if(o.setAnchorCellForSelection(g),xr(e),e.shiftKey){const p=r.getCordsFromCellNode(a,u);return S0(o,f,p.x,p.y,t)}return a.selectEnd(),!0}return!1}function xr(n){n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()}function Zm(n,e,t){const r=ie();n==="first"?e.insertBefore(r):e.insertAfter(r),r.append(...t||[]),r.selectEnd()}function ey(n,e,t){const r=t.getParent();if(!r)return;const o=n.getElementByKey(r.getKey());if(!o)return;const s=window.getSelection();if(!s||s.anchorNode!==o)return;const i=z(e.anchor.getNode(),_=>Z(_));if(!i)return;const l=z(i,_=>De(_));if(!De(l)||!l.is(t))return;const[c,a]=Jt(t,i,i),f=c[0][0],d=c[c.length-1][c[0].length-1],{startRow:u,startColumn:h}=a,g=u===f.startRow&&h===f.startColumn,p=u===d.startRow&&h===d.startColumn;return g?"first":p?"last":void 0}class js extends yt{static getType(){return"table"}static clone(e){return new js(e.__key)}static importDOM(){return{table:e=>({conversion:x0,priority:1})}}static importJSON(e){return lc()}constructor(e){super(e)}exportJSON(){return{...super.exportJSON(),type:"table",version:1}}createDOM(e,t){const r=document.createElement("table");return Ie(r,e.theme.table),r}updateDOM(){return!1}exportDOM(e){return{...super.exportDOM(e),after:t=>{if(t){const r=t.cloneNode(),o=document.createElement("colgroup"),s=document.createElement("tbody");qn(t)&&s.append(...t.children);const i=this.getFirstChildOrThrow();if(!Re(i))throw new Error("Expected to find row node.");const l=i.getChildrenSize();for(let c=0;c<l;c++){const a=document.createElement("col");o.append(a)}return r.replaceChildren(o,s),r}}}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:r,domRows:o}=t;for(let s=0;s<r;s++){const i=o[s];if(i==null)continue;const l=i.findIndex(c=>{if(!c)return;const{elem:a}=c;return be(a)===e});if(l!==-1)return{x:l,y:s}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,r){const{domRows:o}=r,s=o[t];if(s==null)return null;const i=s[e<s.length?e:s.length-1];return i??null}getDOMCellFromCordsOrThrow(e,t,r){const o=this.getDOMCellFromCords(e,t,r);if(!o)throw new Error("Cell not found at cords.");return o}getCellNodeFromCords(e,t,r){const o=this.getDOMCellFromCords(e,t,r);if(o==null)return null;const s=be(o.elem);return Z(s)?s:null}getCellNodeFromCordsOrThrow(e,t,r){const o=this.getCellNodeFromCords(e,t,r);if(!o)throw new Error("Node at cords not TableCellNode.");return o}canSelectBefore(){return!0}canIndent(){return!1}}function T0(n,e){const t=n.getElementByKey(e.getKey());if(t==null)throw new Error("Table Element Not Found");return xo(t)}function x0(n){return{node:lc()}}function lc(){return ot(new js)}function De(n){return n instanceof js}const E0=Object.freeze(Object.defineProperty({__proto__:null,$computeTableMap:Jt,$computeTableMapSkipCellCheck:Hm,$createTableCellNode:Dt,$createTableNode:lc,$createTableNodeWithDimensions:s0,$createTableRowNode:Sr,$createTableSelection:sf,$deleteTableColumn:g0,$deleteTableColumn__EXPERIMENTAL:_0,$deleteTableRow__EXPERIMENTAL:p0,$findCellNode:ic,$findTableNode:Tr,$getElementForTableNode:T0,$getNodeTriplet:Nt,$getTableCellNodeFromLexicalNode:i0,$getTableCellNodeRect:of,$getTableColumnIndexFromTableCellNode:c0,$getTableNodeFromLexicalNodeOrThrow:tf,$getTableRowIndexFromTableCellNode:l0,$getTableRowNodeFromTableCellNodeOrThrow:ef,$insertTableColumn:d0,$insertTableColumn__EXPERIMENTAL:h0,$insertTableRow:u0,$insertTableRow__EXPERIMENTAL:f0,$isTableCellNode:Z,$isTableNode:De,$isTableRowNode:Re,$isTableSelection:Ne,$removeTableRowAtIndex:a0,$unmergeCell:m0,INSERT_TABLE_COMMAND:t0,TableCellHeaderStates:pe,TableCellNode:To,TableNode:js,TableObserver:Ym,TableRowNode:Ks,applyTableHandlers:C0,getDOMCellFromTarget:lf,getTableObserverFromTableElement:N0},Symbol.toStringTag,{value:"Module"})),ty=(process.env.NODE_ENV==="development"?e0:E0).$isTableSelection,ny=Object.freeze({" ":"\\t","\n":"\\n"}),ry=new RegExp(Object.keys(ny).join("|"),"g"),ln=Object.freeze({ancestorHasNextSibling:"|",ancestorIsLastChild:" ",hasNextSibling:"├",isLastChild:"└",selectedChar:"^",selectedLine:">"}),w0=[n=>n.hasFormat("bold")&&"Bold",n=>n.hasFormat("code")&&"Code",n=>n.hasFormat("italic")&&"Italic",n=>n.hasFormat("strikethrough")&&"Strikethrough",n=>n.hasFormat("subscript")&&"Subscript",n=>n.hasFormat("superscript")&&"Superscript",n=>n.hasFormat("underline")&&"Underline"],b0=[n=>n.hasTextFormat("bold")&&"Bold",n=>n.hasTextFormat("code")&&"Code",n=>n.hasTextFormat("italic")&&"Italic",n=>n.hasTextFormat("strikethrough")&&"Strikethrough",n=>n.hasTextFormat("subscript")&&"Subscript",n=>n.hasTextFormat("superscript")&&"Superscript",n=>n.hasTextFormat("underline")&&"Underline"],O0=[n=>n.isDirectionless()&&"Directionless",n=>n.isUnmergeable()&&"Unmergeable"],v0=[n=>n.isToken()&&"Token",n=>n.isSegmented()&&"Segmented"];function M0(n,e,t,r,o=!1){const s=n.getEditorState(),i=n._config,l=n._compositionKey,c=n._editable;if(t){let u="";return s.read(()=>{u=j0(Hl(n))}),u}let a=` root
44
+ `;const f=s.read(()=>{const u=M();return oy(Oe(),(h,g)=>{const _=`(${h.getKey()})`,y=h.getType()||"",m=h.isSelected();a+=`${m?ln.selectedLine:" "} ${g.join(" ")} ${_} ${y} ${R0(h,r,o)}
45
+ `,a+=z0({indent:g,isSelected:m,node:h,nodeKeyDisplay:_,selection:u,typeDisplay:y})}),u===null?": null":v(u)?D0(u):ty(u)?k0(u):A0(u)});if(a+=`
46
46
  selection`+f,a+=`
47
47
 
48
48
  commands:`,e.length)for(const{index:u,type:h,payload:g}of e)a+=`
@@ -52,22 +52,22 @@ Check the top-level render call using <`+z+">.")}return k}}function xy(E,k){{if(
52
52
  editor${d?` (v${d})`:""}:`,a+=`
53
53
  └ namespace ${i.namespace}`,l!==null&&(a+=`
54
54
  └ compositionKey ${l}`),a+=`
55
- └ editable ${String(c)}`,a}function M0(n){let e="";const t=ry(n);e+=`: range ${t!==""?`{ ${t} }`:""} ${n.style!==""?`{ style: ${n.style} } `:""}`;const o=n.anchor,r=n.focus,s=o.offset,i=r.offset;return e+=`
56
- ├ anchor { key: ${o.key}, offset: ${s===null?"null":s}, type: ${o.type} }`,e+=`
57
- └ focus { key: ${r.key}, offset: ${i===null?"null":i}, type: ${r.type} }`,e}function D0(n){return Ve(n)?`: node
58
- └ [${Array.from(n._nodes).join(", ")}]`:""}function A0(n){return`: table
59
- └ { table: ${n.tableKey}, anchorCell: ${n.anchor.key}, focusCell: ${n.focus.key} }`}function ny(n,e,t=[]){const o=n.getChildren(),r=o.length;o.forEach((s,i)=>{e(s,t.concat(i===r-1?cn.isLastChild:cn.hasNextSibling)),A(s)&&ny(s,e,t.concat(i===r-1?cn.ancestorIsLastChild:cn.ancestorHasNextSibling))})}function oy(n,e=!1){const t=Object.entries(ey).reduce((o,[r,s])=>o.replace(new RegExp(r,"g"),String(s)),n);return e?t.replace(/[^\s]/g,"*"):t}function k0(n,e,t=!1){const o=e?e(n,t):void 0;if(o!==void 0&&o.length>0)return o;if(L(n)){const r=n.getTextContent(),s=r.length===0?"(empty)":`"${oy(r,t)}"`,i=$0(n);return[s,i.length!==0?`{ ${i} }`:null].filter(Boolean).join(" ").trim()}else if(wm(n)){const r=n.getURL(),s=r.length===0?"(empty)":`"${oy(r,t)}"`,i=P0(n);return[s,i.length!==0?`{ ${i} }`:null].filter(Boolean).join(" ").trim()}else{if(bm(n))return`ids: [ ${n.getIDs().join(", ")} ]`;if(_l(n)){const r=R0(n);let s=r!==""?`{ ${r} }`:"";return s+=n.__style?`(${n.__style})`:"",s}else return""}}function R0(n){let e=w0.map(t=>t(n)).filter(Boolean).join(", ").toLocaleLowerCase();return e!==""&&(e="format: "+e),e}function $0(n){return[ry(n),I0(n),L0(n)].filter(Boolean).join(", ")}function P0(n){return[F0(n),B0(n),K0(n)].filter(Boolean).join(", ")}function I0(n){let e=b0.map(t=>t(n)).filter(Boolean).join(", ").toLocaleLowerCase();return e!==""&&(e="detail: "+e),e}function L0(n){let e=O0.map(t=>t(n)).filter(Boolean).join(", ").toLocaleLowerCase();return e!==""&&(e="mode: "+e),e}function ry(n){let e=E0.map(t=>t(n)).filter(Boolean).join(", ").toLocaleLowerCase();return e!==""&&(e="format: "+e),e}function F0(n){let e=n.getTarget();return e!=null&&(e="target: "+e),e}function B0(n){let e=n.getRel();return e!=null&&(e="rel: "+e),e}function K0(n){let e=n.getTitle();return e!=null&&(e="title: "+e),e}function W0({indent:n,isSelected:e,node:t,nodeKeyDisplay:o,selection:r,typeDisplay:s}){if(!L(t)||!v(r)||!e||A(t))return"";const i=r.anchor,l=r.focus;if(t.getTextContent()===""||i.getNode()===r.focus.getNode()&&i.offset===l.offset)return"";const[c,a]=U0(t,r);if(c===a)return"";const f=n[n.length-1]===cn.hasNextSibling?cn.ancestorHasNextSibling:cn.ancestorIsLastChild,d=[...n.slice(0,n.length-1),f],u=Array(c+1).fill(" "),h=Array(a-c).fill(cn.selectedChar),g=s.length+2,p=Array(o.length+g).fill(" ");return[cn.selectedLine,d.join(" "),[...p,...u,...h].join("")].join(" ")+`
60
- `}function z0(n){const e=document.createElement("div");return e.innerHTML=n.trim(),sy(e,0).innerHTML}function sy(n,e){const t=new Array(e+++1).join(" "),o=new Array(e-1).join(" ");let r;for(let s=0;s<n.children.length;s++)r=document.createTextNode(`
61
- `+t),n.insertBefore(r,n.children[s]),sy(n.children[s],e),n.lastElementChild===n.children[s]&&(r=document.createTextNode(`
62
- `+o),n.appendChild(r));return n}function U0(n,e){const t=e.getStartEndPoints();if(Ve(e)||t===null)return[-1,-1];const[o,r]=t,s=n.getTextContent(),i=s.length;let l=-1,c=-1;if(o.type==="text"&&r.type==="text"){const d=o.getNode(),u=r.getNode();d===u&&n===d&&o.offset!==r.offset?[l,c]=o.offset<r.offset?[o.offset,r.offset]:[r.offset,o.offset]:n===d?[l,c]=d.isBefore(u)?[o.offset,i]:[0,o.offset]:n===u?[l,c]=u.isBefore(d)?[r.offset,i]:[0,r.offset]:[l,c]=[0,i]}const a=(s.slice(0,l).match(ty)||[]).length,f=(s.slice(l,c).match(ty)||[]).length;return[l+a,c+a+f]}const j0=1e3,H0=I.forwardRef(function({treeTypeButtonClassName:e,timeTravelButtonClassName:t,timeTravelPanelSliderClassName:o,timeTravelPanelButtonClassName:r,viewClassName:s,timeTravelPanelClassName:i,editorState:l,setEditorState:c,setEditorReadOnly:a,generateContent:f},d){const[u,h]=I.useState([]),[g,p]=I.useState(""),[_,y]=I.useState(!1),[m,C]=I.useState(!1),N=I.useRef(0),S=I.useRef(null),[T,b]=I.useState(!1),[x,w]=I.useState(!1),[O,D]=I.useState(!1),B=I.useRef(),Y=I.useRef(0),J=I.useCallback(F=>{const ce=++Y.current;f(F).then(se=>{ce===Y.current&&p(se)}).catch(se=>{ce===Y.current&&p(`Error rendering tree: ${se.message}
55
+ └ editable ${String(c)}`,a}function D0(n){let e="";const t=iy(n);e+=`: range ${t!==""?`{ ${t} }`:""} ${n.style!==""?`{ style: ${n.style} } `:""}`;const r=n.anchor,o=n.focus,s=r.offset,i=o.offset;return e+=`
56
+ ├ anchor { key: ${r.key}, offset: ${s===null?"null":s}, type: ${r.type} }`,e+=`
57
+ └ focus { key: ${o.key}, offset: ${i===null?"null":i}, type: ${o.type} }`,e}function A0(n){return Ve(n)?`: node
58
+ └ [${Array.from(n._nodes).join(", ")}]`:""}function k0(n){return`: table
59
+ └ { table: ${n.tableKey}, anchorCell: ${n.anchor.key}, focusCell: ${n.focus.key} }`}function oy(n,e,t=[]){const r=n.getChildren(),o=r.length;r.forEach((s,i)=>{e(s,t.concat(i===o-1?ln.isLastChild:ln.hasNextSibling)),A(s)&&oy(s,e,t.concat(i===o-1?ln.ancestorIsLastChild:ln.ancestorHasNextSibling))})}function sy(n,e=!1){const t=Object.entries(ny).reduce((r,[o,s])=>r.replace(new RegExp(o,"g"),String(s)),n);return e?t.replace(/[^\s]/g,"*"):t}function R0(n,e,t=!1){const r=e?e(n,t):void 0;if(r!==void 0&&r.length>0)return r;if(L(n)){const o=n.getTextContent(),s=o.length===0?"(empty)":`"${sy(o,t)}"`,i=P0(n);return[s,i.length!==0?`{ ${i} }`:null].filter(Boolean).join(" ").trim()}else if(Om(n)){const o=n.getURL(),s=o.length===0?"(empty)":`"${sy(o,t)}"`,i=I0(n);return[s,i.length!==0?`{ ${i} }`:null].filter(Boolean).join(" ").trim()}else{if(vm(n))return`ids: [ ${n.getIDs().join(", ")} ]`;if(pl(n)){const o=$0(n);let s=o!==""?`{ ${o} }`:"";return s+=n.__style?`(${n.__style})`:"",s}else return""}}function $0(n){let e=b0.map(t=>t(n)).filter(Boolean).join(", ").toLocaleLowerCase();return e!==""&&(e="format: "+e),e}function P0(n){return[iy(n),L0(n),F0(n)].filter(Boolean).join(", ")}function I0(n){return[B0(n),K0(n),W0(n)].filter(Boolean).join(", ")}function L0(n){let e=O0.map(t=>t(n)).filter(Boolean).join(", ").toLocaleLowerCase();return e!==""&&(e="detail: "+e),e}function F0(n){let e=v0.map(t=>t(n)).filter(Boolean).join(", ").toLocaleLowerCase();return e!==""&&(e="mode: "+e),e}function iy(n){let e=w0.map(t=>t(n)).filter(Boolean).join(", ").toLocaleLowerCase();return e!==""&&(e="format: "+e),e}function B0(n){let e=n.getTarget();return e!=null&&(e="target: "+e),e}function K0(n){let e=n.getRel();return e!=null&&(e="rel: "+e),e}function W0(n){let e=n.getTitle();return e!=null&&(e="title: "+e),e}function z0({indent:n,isSelected:e,node:t,nodeKeyDisplay:r,selection:o,typeDisplay:s}){if(!L(t)||!v(o)||!e||A(t))return"";const i=o.anchor,l=o.focus;if(t.getTextContent()===""||i.getNode()===o.focus.getNode()&&i.offset===l.offset)return"";const[c,a]=U0(t,o);if(c===a)return"";const f=n[n.length-1]===ln.hasNextSibling?ln.ancestorHasNextSibling:ln.ancestorIsLastChild,d=[...n.slice(0,n.length-1),f],u=Array(c+1).fill(" "),h=Array(a-c).fill(ln.selectedChar),g=s.length+2,p=Array(r.length+g).fill(" ");return[ln.selectedLine,d.join(" "),[...p,...u,...h].join("")].join(" ")+`
60
+ `}function j0(n){const e=document.createElement("div");return e.innerHTML=n.trim(),ly(e,0).innerHTML}function ly(n,e){const t=new Array(e+++1).join(" "),r=new Array(e-1).join(" ");let o;for(let s=0;s<n.children.length;s++)o=document.createTextNode(`
61
+ `+t),n.insertBefore(o,n.children[s]),ly(n.children[s],e),n.lastElementChild===n.children[s]&&(o=document.createTextNode(`
62
+ `+r),n.appendChild(o));return n}function U0(n,e){const t=e.getStartEndPoints();if(Ve(e)||t===null)return[-1,-1];const[r,o]=t,s=n.getTextContent(),i=s.length;let l=-1,c=-1;if(r.type==="text"&&o.type==="text"){const d=r.getNode(),u=o.getNode();d===u&&n===d&&r.offset!==o.offset?[l,c]=r.offset<o.offset?[r.offset,o.offset]:[o.offset,r.offset]:n===d?[l,c]=d.isBefore(u)?[r.offset,i]:[0,r.offset]:n===u?[l,c]=u.isBefore(d)?[o.offset,i]:[0,o.offset]:[l,c]=[0,i]}const a=(s.slice(0,l).match(ry)||[]).length,f=(s.slice(l,c).match(ry)||[]).length;return[l+a,c+a+f]}const H0=1e3,Y0=I.forwardRef(function({treeTypeButtonClassName:e,timeTravelButtonClassName:t,timeTravelPanelSliderClassName:r,timeTravelPanelButtonClassName:o,viewClassName:s,timeTravelPanelClassName:i,editorState:l,setEditorState:c,setEditorReadOnly:a,generateContent:f},d){const[u,h]=I.useState([]),[g,p]=I.useState(""),[_,y]=I.useState(!1),[m,C]=I.useState(!1),N=I.useRef(0),S=I.useRef(null),[T,E]=I.useState(!1),[x,w]=I.useState(!1),[O,D]=I.useState(!1),B=I.useRef(),q=I.useRef(0),Y=I.useCallback(F=>{const ce=++q.current;f(F).then(se=>{ce===q.current&&p(se)}).catch(se=>{ce===q.current&&p(`Error rendering tree: ${se.message}
63
63
 
64
64
  Stack:
65
- ${se.stack}`)})},[f]);I.useEffect(()=>{!O&&l._nodeMap.size>j0&&(w(!0),!O)||B.current!==l&&(B.current=l,J(m),_||h(F=>[...F,[Date.now(),l]]))},[l,J,m,O,_]);const V=u.length;I.useEffect(()=>{if(T){let F;const ce=()=>{const se=N.current;if(se===V-1){b(!1);return}const We=u[se][0],Ae=u[se+1][0]-We;F=setTimeout(()=>{N.current++;const Ge=N.current,Xe=S.current;Xe!==null&&(Xe.value=String(Ge)),c(u[Ge][1]),ce()},Ae)};return ce(),()=>{clearTimeout(F)}}},[u,T,V,c]);const re=()=>{J(!m),C(!m)};return W.exports.jsxs("div",{className:s,children:[!O&&x?W.exports.jsxs("div",{style:{padding:20},children:[W.exports.jsx("span",{style:{marginRight:20},children:"Detected large EditorState, this can impact debugging performance."}),W.exports.jsx("button",{onClick:()=>{D(!0)},style:{background:"transparent",border:"1px solid white",color:"white",cursor:"pointer",padding:5},children:"Show full tree"})]}):null,O?null:W.exports.jsx("button",{onClick:()=>re(),className:e,type:"button",children:m?"Tree":"Export DOM"}),!_&&(O||!x)&&V>2&&W.exports.jsx("button",{onClick:()=>{a(!0),N.current=V-1,y(!0)},className:t,type:"button",children:"Time Travel"}),(O||!x)&&W.exports.jsx("pre",{ref:d,children:g}),_&&(O||!x)&&W.exports.jsxs("div",{className:i,children:[W.exports.jsx("button",{className:r,onClick:()=>{N.current===V-1&&(N.current=1),b(!T)},type:"button",children:T?"Pause":"Play"}),W.exports.jsx("input",{className:o,ref:S,onChange:F=>{const ce=Number(F.target.value),se=u[ce];se&&(N.current=ce,c(se[1]))},type:"range",min:"1",max:V-1}),W.exports.jsx("button",{className:r,onClick:()=>{a(!1);const F=u.length-1,ce=u[F];c(ce[1]);const se=S.current;se!==null&&(se.value=String(F)),y(!1),b(!1)},type:"button",children:"Exit"})]})]})});function iy(n,e){const t=new Set;let o=0;for(const[r]of n._commands)t.add(n.registerCommand(r,s=>(e(i=>{o+=1;const l=[...i];return l.push({index:o,payload:s,type:r.type?r.type:"UNKNOWN"}),l.length>10&&l.shift(),l}),!1),ye));return()=>t.forEach(r=>r())}function Y0(n){const[e,t]=I.useState([]);return I.useEffect(()=>iy(n,t),[n]),I.useMemo(()=>e,[e])}const J0=Object.freeze(Object.defineProperty({__proto__:null,TreeView:H0,generateContent:v0,registerLexicalCommandLogger:iy,useLexicalCommandsLog:Y0},Symbol.toStringTag,{value:"Module"})),ly=Object.freeze({" ":"\\t","\n":"\\n"}),cy=new RegExp(Object.keys(ly).join("|"),"g"),an=Object.freeze({ancestorHasNextSibling:"|",ancestorIsLastChild:" ",hasNextSibling:"├",isLastChild:"└",selectedChar:"^",selectedLine:">"}),V0=[n=>n.hasFormat("bold")&&"Bold",n=>n.hasFormat("code")&&"Code",n=>n.hasFormat("italic")&&"Italic",n=>n.hasFormat("strikethrough")&&"Strikethrough",n=>n.hasFormat("subscript")&&"Subscript",n=>n.hasFormat("superscript")&&"Superscript",n=>n.hasFormat("underline")&&"Underline"],G0=[n=>n.hasTextFormat("bold")&&"Bold",n=>n.hasTextFormat("code")&&"Code",n=>n.hasTextFormat("italic")&&"Italic",n=>n.hasTextFormat("strikethrough")&&"Strikethrough",n=>n.hasTextFormat("subscript")&&"Subscript",n=>n.hasTextFormat("superscript")&&"Superscript",n=>n.hasTextFormat("underline")&&"Underline"],X0=[n=>n.isDirectionless()&&"Directionless",n=>n.isUnmergeable()&&"Unmergeable"],q0=[n=>n.isToken()&&"Token",n=>n.isSegmented()&&"Segmented"];function Q0(n,e,t,o,r=!1){const s=n.getEditorState(),i=n._config,l=n._compositionKey,c=n._editable;if(t){let u="";return s.read(()=>{u=function(h){const g=document.createElement("div");return g.innerHTML=h.trim(),dy(g,0).innerHTML}(Yl(n))}),u}let a=` root
66
- `;const f=s.read(()=>{const u=M();return ay(Oe(),(h,g)=>{const p=`(${h.getKey()})`,_=h.getType()||"",y=h.isSelected();a+=`${y?an.selectedLine:" "} ${g.join(" ")} ${p} ${_} ${function(m,C,N=!1){const S=C?C(m,N):void 0;if(S!==void 0&&S.length>0)return S;if(L(m)){const T=m.getTextContent(),b=T.length===0?"(empty)":`"${uy(T,N)}"`,x=function(w){return[fy(w),Z0(w),ev(w)].filter(Boolean).join(", ")}(m);return[b,x.length!==0?`{ ${x} }`:null].filter(Boolean).join(" ").trim()}if(wm(m)){const T=m.getURL(),b=T.length===0?"(empty)":`"${uy(T,N)}"`,x=function(w){return[tv(w),nv(w),ov(w)].filter(Boolean).join(", ")}(m);return[b,x.length!==0?`{ ${x} }`:null].filter(Boolean).join(" ").trim()}if(bm(m))return`ids: [ ${m.getIDs().join(", ")} ]`;if(_l(m)){const T=function(x){let w=G0.map(O=>O(x)).filter(Boolean).join(", ").toLocaleLowerCase();return w!==""&&(w="format: "+w),w}(m);let b=T!==""?`{ ${T} }`:"";return b+=m.__style?`(${m.__style})`:"",b}return""}(h,o,r)}
67
- `,a+=function({indent:m,isSelected:C,node:N,nodeKeyDisplay:S,selection:T,typeDisplay:b}){if(!L(N)||!v(T)||!C||A(N))return"";const x=T.anchor,w=T.focus;if(N.getTextContent()===""||x.getNode()===T.focus.getNode()&&x.offset===w.offset)return"";const[O,D]=function(ce,se){const We=se.getStartEndPoints();if(Ve(se)||We===null)return[-1,-1];const[ue,Ae]=We,Ge=ce.getTextContent(),Xe=Ge.length;let qe=-1,Te=-1;if(ue.type==="text"&&Ae.type==="text"){const ve=ue.getNode(),St=Ae.getNode();ve===St&&ce===ve&&ue.offset!==Ae.offset?[qe,Te]=ue.offset<Ae.offset?[ue.offset,Ae.offset]:[Ae.offset,ue.offset]:[qe,Te]=ce===ve?ve.isBefore(St)?[ue.offset,Xe]:[0,ue.offset]:ce===St?St.isBefore(ve)?[Ae.offset,Xe]:[0,Ae.offset]:[0,Xe]}const nt=(Ge.slice(0,qe).match(cy)||[]).length,ze=(Ge.slice(qe,Te).match(cy)||[]).length;return[qe+nt,Te+nt+ze]}(N,T);if(O===D)return"";const B=m[m.length-1]===an.hasNextSibling?an.ancestorHasNextSibling:an.ancestorIsLastChild,Y=[...m.slice(0,m.length-1),B],J=Array(O+1).fill(" "),V=Array(D-O).fill(an.selectedChar),re=b.length+2,F=Array(S.length+re).fill(" ");return[an.selectedLine,Y.join(" "),[...F,...J,...V].join("")].join(" ")+`
68
- `}({indent:g,isSelected:y,node:h,nodeKeyDisplay:p,selection:u,typeDisplay:_})}),u===null?": null":v(u)?function(h){let g="";const p=fy(h);g+=`: range ${p!==""?`{ ${p} }`:""} ${h.style!==""?`{ style: ${h.style} } `:""}`;const _=h.anchor,y=h.focus,m=_.offset,C=y.offset;return g+=`
65
+ ${se.stack}`)})},[f]);I.useEffect(()=>{!O&&l._nodeMap.size>H0&&(w(!0),!O)||B.current!==l&&(B.current=l,Y(m),_||h(F=>[...F,[Date.now(),l]]))},[l,Y,m,O,_]);const J=u.length;I.useEffect(()=>{if(T){let F;const ce=()=>{const se=N.current;if(se===J-1){E(!1);return}const We=u[se][0],Ae=u[se+1][0]-We;F=setTimeout(()=>{N.current++;const Ge=N.current,Xe=S.current;Xe!==null&&(Xe.value=String(Ge)),c(u[Ge][1]),ce()},Ae)};return ce(),()=>{clearTimeout(F)}}},[u,T,J,c]);const oe=()=>{Y(!m),C(!m)};return W.exports.jsxs("div",{className:s,children:[!O&&x?W.exports.jsxs("div",{style:{padding:20},children:[W.exports.jsx("span",{style:{marginRight:20},children:"Detected large EditorState, this can impact debugging performance."}),W.exports.jsx("button",{onClick:()=>{D(!0)},style:{background:"transparent",border:"1px solid white",color:"white",cursor:"pointer",padding:5},children:"Show full tree"})]}):null,O?null:W.exports.jsx("button",{onClick:()=>oe(),className:e,type:"button",children:m?"Tree":"Export DOM"}),!_&&(O||!x)&&J>2&&W.exports.jsx("button",{onClick:()=>{a(!0),N.current=J-1,y(!0)},className:t,type:"button",children:"Time Travel"}),(O||!x)&&W.exports.jsx("pre",{ref:d,children:g}),_&&(O||!x)&&W.exports.jsxs("div",{className:i,children:[W.exports.jsx("button",{className:o,onClick:()=>{N.current===J-1&&(N.current=1),E(!T)},type:"button",children:T?"Pause":"Play"}),W.exports.jsx("input",{className:r,ref:S,onChange:F=>{const ce=Number(F.target.value),se=u[ce];se&&(N.current=ce,c(se[1]))},type:"range",min:"1",max:J-1}),W.exports.jsx("button",{className:o,onClick:()=>{a(!1);const F=u.length-1,ce=u[F];c(ce[1]);const se=S.current;se!==null&&(se.value=String(F)),y(!1),E(!1)},type:"button",children:"Exit"})]})]})});function cy(n,e){const t=new Set;let r=0;for(const[o]of n._commands)t.add(n.registerCommand(o,s=>(e(i=>{r+=1;const l=[...i];return l.push({index:r,payload:s,type:o.type?o.type:"UNKNOWN"}),l.length>10&&l.shift(),l}),!1),ye));return()=>t.forEach(o=>o())}function J0(n){const[e,t]=I.useState([]);return I.useEffect(()=>cy(n,t),[n]),I.useMemo(()=>e,[e])}const V0=Object.freeze(Object.defineProperty({__proto__:null,TreeView:Y0,generateContent:M0,registerLexicalCommandLogger:cy,useLexicalCommandsLog:J0},Symbol.toStringTag,{value:"Module"})),ay=Object.freeze({" ":"\\t","\n":"\\n"}),uy=new RegExp(Object.keys(ay).join("|"),"g"),cn=Object.freeze({ancestorHasNextSibling:"|",ancestorIsLastChild:" ",hasNextSibling:"├",isLastChild:"└",selectedChar:"^",selectedLine:">"}),G0=[n=>n.hasFormat("bold")&&"Bold",n=>n.hasFormat("code")&&"Code",n=>n.hasFormat("italic")&&"Italic",n=>n.hasFormat("strikethrough")&&"Strikethrough",n=>n.hasFormat("subscript")&&"Subscript",n=>n.hasFormat("superscript")&&"Superscript",n=>n.hasFormat("underline")&&"Underline"],X0=[n=>n.hasTextFormat("bold")&&"Bold",n=>n.hasTextFormat("code")&&"Code",n=>n.hasTextFormat("italic")&&"Italic",n=>n.hasTextFormat("strikethrough")&&"Strikethrough",n=>n.hasTextFormat("subscript")&&"Subscript",n=>n.hasTextFormat("superscript")&&"Superscript",n=>n.hasTextFormat("underline")&&"Underline"],q0=[n=>n.isDirectionless()&&"Directionless",n=>n.isUnmergeable()&&"Unmergeable"],Q0=[n=>n.isToken()&&"Token",n=>n.isSegmented()&&"Segmented"];function Z0(n,e,t,r,o=!1){const s=n.getEditorState(),i=n._config,l=n._compositionKey,c=n._editable;if(t){let u="";return s.read(()=>{u=function(h){const g=document.createElement("div");return g.innerHTML=h.trim(),gy(g,0).innerHTML}(Hl(n))}),u}let a=` root
66
+ `;const f=s.read(()=>{const u=M();return fy(Oe(),(h,g)=>{const p=`(${h.getKey()})`,_=h.getType()||"",y=h.isSelected();a+=`${y?cn.selectedLine:" "} ${g.join(" ")} ${p} ${_} ${function(m,C,N=!1){const S=C?C(m,N):void 0;if(S!==void 0&&S.length>0)return S;if(L(m)){const T=m.getTextContent(),E=T.length===0?"(empty)":`"${dy(T,N)}"`,x=function(w){return[hy(w),ev(w),tv(w)].filter(Boolean).join(", ")}(m);return[E,x.length!==0?`{ ${x} }`:null].filter(Boolean).join(" ").trim()}if(Om(m)){const T=m.getURL(),E=T.length===0?"(empty)":`"${dy(T,N)}"`,x=function(w){return[nv(w),rv(w),ov(w)].filter(Boolean).join(", ")}(m);return[E,x.length!==0?`{ ${x} }`:null].filter(Boolean).join(" ").trim()}if(vm(m))return`ids: [ ${m.getIDs().join(", ")} ]`;if(pl(m)){const T=function(x){let w=X0.map(O=>O(x)).filter(Boolean).join(", ").toLocaleLowerCase();return w!==""&&(w="format: "+w),w}(m);let E=T!==""?`{ ${T} }`:"";return E+=m.__style?`(${m.__style})`:"",E}return""}(h,r,o)}
67
+ `,a+=function({indent:m,isSelected:C,node:N,nodeKeyDisplay:S,selection:T,typeDisplay:E}){if(!L(N)||!v(T)||!C||A(N))return"";const x=T.anchor,w=T.focus;if(N.getTextContent()===""||x.getNode()===T.focus.getNode()&&x.offset===w.offset)return"";const[O,D]=function(ce,se){const We=se.getStartEndPoints();if(Ve(se)||We===null)return[-1,-1];const[ae,Ae]=We,Ge=ce.getTextContent(),Xe=Ge.length;let qe=-1,Te=-1;if(ae.type==="text"&&Ae.type==="text"){const ve=ae.getNode(),St=Ae.getNode();ve===St&&ce===ve&&ae.offset!==Ae.offset?[qe,Te]=ae.offset<Ae.offset?[ae.offset,Ae.offset]:[Ae.offset,ae.offset]:[qe,Te]=ce===ve?ve.isBefore(St)?[ae.offset,Xe]:[0,ae.offset]:ce===St?St.isBefore(ve)?[Ae.offset,Xe]:[0,Ae.offset]:[0,Xe]}const nt=(Ge.slice(0,qe).match(uy)||[]).length,ze=(Ge.slice(qe,Te).match(uy)||[]).length;return[qe+nt,Te+nt+ze]}(N,T);if(O===D)return"";const B=m[m.length-1]===cn.hasNextSibling?cn.ancestorHasNextSibling:cn.ancestorIsLastChild,q=[...m.slice(0,m.length-1),B],Y=Array(O+1).fill(" "),J=Array(D-O).fill(cn.selectedChar),oe=E.length+2,F=Array(S.length+oe).fill(" ");return[cn.selectedLine,q.join(" "),[...F,...Y,...J].join("")].join(" ")+`
68
+ `}({indent:g,isSelected:y,node:h,nodeKeyDisplay:p,selection:u,typeDisplay:_})}),u===null?": null":v(u)?function(h){let g="";const p=hy(h);g+=`: range ${p!==""?`{ ${p} }`:""} ${h.style!==""?`{ style: ${h.style} } `:""}`;const _=h.anchor,y=h.focus,m=_.offset,C=y.offset;return g+=`
69
69
  ├ anchor { key: ${_.key}, offset: ${m===null?"null":m}, type: ${_.type} }`,g+=`
70
- └ focus { key: ${y.key}, offset: ${C===null?"null":C}, type: ${y.type} }`,g}(u):Zm(u)?function(h){return`: table
70
+ └ focus { key: ${y.key}, offset: ${C===null?"null":C}, type: ${y.type} }`,g}(u):ty(u)?function(h){return`: table
71
71
  └ { table: ${h.tableKey}, anchorCell: ${h.anchor.key}, focusCell: ${h.focus.key} }`}(u):function(h){return Ve(h)?`: node
72
72
  └ [${Array.from(h._nodes).join(", ")}]`:""}(u)});if(a+=`
73
73
  selection`+f,a+=`
@@ -79,10 +79,10 @@ ${se.stack}`)})},[f]);I.useEffect(()=>{!O&&l._nodeMap.size>j0&&(w(!0),!O)||B.cur
79
79
  editor${d?` (v${d})`:""}:`,a+=`
80
80
  └ namespace ${i.namespace}`,l!==null&&(a+=`
81
81
  └ compositionKey ${l}`),a+=`
82
- └ editable ${String(c)}`,a}function ay(n,e,t=[]){const o=n.getChildren(),r=o.length;o.forEach((s,i)=>{e(s,t.concat(i===r-1?an.isLastChild:an.hasNextSibling)),A(s)&&ay(s,e,t.concat(i===r-1?an.ancestorIsLastChild:an.ancestorHasNextSibling))})}function uy(n,e=!1){const t=Object.entries(ly).reduce((o,[r,s])=>o.replace(new RegExp(r,"g"),String(s)),n);return e?t.replace(/[^\s]/g,"*"):t}function Z0(n){let e=X0.map(t=>t(n)).filter(Boolean).join(", ").toLocaleLowerCase();return e!==""&&(e="detail: "+e),e}function ev(n){let e=q0.map(t=>t(n)).filter(Boolean).join(", ").toLocaleLowerCase();return e!==""&&(e="mode: "+e),e}function fy(n){let e=V0.map(t=>t(n)).filter(Boolean).join(", ").toLocaleLowerCase();return e!==""&&(e="format: "+e),e}function tv(n){let e=n.getTarget();return e!=null&&(e="target: "+e),e}function nv(n){let e=n.getRel();return e!=null&&(e="rel: "+e),e}function ov(n){let e=n.getTitle();return e!=null&&(e="title: "+e),e}function dy(n,e){const t=new Array(1+e++).join(" "),o=new Array(e-1).join(" ");let r;for(let s=0;s<n.children.length;s++)r=document.createTextNode(`
83
- `+t),n.insertBefore(r,n.children[s]),dy(n.children[s],e),n.lastElementChild===n.children[s]&&(r=document.createTextNode(`
84
- `+o),n.appendChild(r));return n}const rv=I.forwardRef(function({treeTypeButtonClassName:n,timeTravelButtonClassName:e,timeTravelPanelSliderClassName:t,timeTravelPanelButtonClassName:o,viewClassName:r,timeTravelPanelClassName:s,editorState:i,setEditorState:l,setEditorReadOnly:c,generateContent:a},f){const[d,u]=I.useState([]),[h,g]=I.useState(""),[p,_]=I.useState(!1),[y,m]=I.useState(!1),C=I.useRef(0),N=I.useRef(null),[S,T]=I.useState(!1),[b,x]=I.useState(!1),[w,O]=I.useState(!1),D=I.useRef(),B=I.useRef(0),Y=I.useCallback(V=>{const re=++B.current;a(V).then(F=>{re===B.current&&g(F)}).catch(F=>{re===B.current&&g(`Error rendering tree: ${F.message}
82
+ └ editable ${String(c)}`,a}function fy(n,e,t=[]){const r=n.getChildren(),o=r.length;r.forEach((s,i)=>{e(s,t.concat(i===o-1?cn.isLastChild:cn.hasNextSibling)),A(s)&&fy(s,e,t.concat(i===o-1?cn.ancestorIsLastChild:cn.ancestorHasNextSibling))})}function dy(n,e=!1){const t=Object.entries(ay).reduce((r,[o,s])=>r.replace(new RegExp(o,"g"),String(s)),n);return e?t.replace(/[^\s]/g,"*"):t}function ev(n){let e=q0.map(t=>t(n)).filter(Boolean).join(", ").toLocaleLowerCase();return e!==""&&(e="detail: "+e),e}function tv(n){let e=Q0.map(t=>t(n)).filter(Boolean).join(", ").toLocaleLowerCase();return e!==""&&(e="mode: "+e),e}function hy(n){let e=G0.map(t=>t(n)).filter(Boolean).join(", ").toLocaleLowerCase();return e!==""&&(e="format: "+e),e}function nv(n){let e=n.getTarget();return e!=null&&(e="target: "+e),e}function rv(n){let e=n.getRel();return e!=null&&(e="rel: "+e),e}function ov(n){let e=n.getTitle();return e!=null&&(e="title: "+e),e}function gy(n,e){const t=new Array(1+e++).join(" "),r=new Array(e-1).join(" ");let o;for(let s=0;s<n.children.length;s++)o=document.createTextNode(`
83
+ `+t),n.insertBefore(o,n.children[s]),gy(n.children[s],e),n.lastElementChild===n.children[s]&&(o=document.createTextNode(`
84
+ `+r),n.appendChild(o));return n}const sv=I.forwardRef(function({treeTypeButtonClassName:n,timeTravelButtonClassName:e,timeTravelPanelSliderClassName:t,timeTravelPanelButtonClassName:r,viewClassName:o,timeTravelPanelClassName:s,editorState:i,setEditorState:l,setEditorReadOnly:c,generateContent:a},f){const[d,u]=I.useState([]),[h,g]=I.useState(""),[p,_]=I.useState(!1),[y,m]=I.useState(!1),C=I.useRef(0),N=I.useRef(null),[S,T]=I.useState(!1),[E,x]=I.useState(!1),[w,O]=I.useState(!1),D=I.useRef(),B=I.useRef(0),q=I.useCallback(J=>{const oe=++B.current;a(J).then(F=>{oe===B.current&&g(F)}).catch(F=>{oe===B.current&&g(`Error rendering tree: ${F.message}
85
85
 
86
86
  Stack:
87
- ${F.stack}`)})},[a]);I.useEffect(()=>{!w&&i._nodeMap.size>1e3&&(x(!0),!w)||D.current!==i&&(D.current=i,Y(y),p||u(V=>[...V,[Date.now(),i]]))},[i,Y,y,w,p]);const J=d.length;return I.useEffect(()=>{if(S){let V;const re=()=>{const F=C.current;if(F===J-1)return void T(!1);const ce=d[F][0],se=d[F+1][0];V=setTimeout(()=>{C.current++;const We=C.current,ue=N.current;ue!==null&&(ue.value=String(We)),l(d[We][1]),re()},se-ce)};return re(),()=>{clearTimeout(V)}}},[d,S,J,l]),W.exports.jsxs("div",{className:r,children:[!w&&b?W.exports.jsxs("div",{style:{padding:20},children:[W.exports.jsx("span",{style:{marginRight:20},children:"Detected large EditorState, this can impact debugging performance."}),W.exports.jsx("button",{onClick:()=>{O(!0)},style:{background:"transparent",border:"1px solid white",color:"white",cursor:"pointer",padding:5},children:"Show full tree"})]}):null,w?null:W.exports.jsx("button",{onClick:()=>(Y(!y),void m(!y)),className:n,type:"button",children:y?"Tree":"Export DOM"}),!p&&(w||!b)&&J>2&&W.exports.jsx("button",{onClick:()=>{c(!0),C.current=J-1,_(!0)},className:e,type:"button",children:"Time Travel"}),(w||!b)&&W.exports.jsx("pre",{ref:f,children:h}),p&&(w||!b)&&W.exports.jsxs("div",{className:s,children:[W.exports.jsx("button",{className:o,onClick:()=>{C.current===J-1&&(C.current=1),T(!S)},type:"button",children:S?"Pause":"Play"}),W.exports.jsx("input",{className:t,ref:N,onChange:V=>{const re=Number(V.target.value),F=d[re];F&&(C.current=re,l(F[1]))},type:"range",min:"1",max:J-1}),W.exports.jsx("button",{className:o,onClick:()=>{c(!1);const V=d.length-1,re=d[V];l(re[1]);const F=N.current;F!==null&&(F.value=String(V)),_(!1),T(!1)},type:"button",children:"Exit"})]})]})});function hy(n,e){const t=new Set;let o=0;for(const[r]of n._commands)t.add(n.registerCommand(r,s=>(e(i=>{o+=1;const l=[...i];return l.push({index:o,payload:s,type:r.type?r.type:"UNKNOWN"}),l.length>10&&l.shift(),l}),!1),ye));return()=>t.forEach(r=>r())}function sv(n){const[e,t]=I.useState([]);return I.useEffect(()=>hy(n,t),[n]),I.useMemo(()=>e,[e])}const iv=Object.freeze(Object.defineProperty({__proto__:null,TreeView:rv,generateContent:Q0,registerLexicalCommandLogger:hy,useLexicalCommandsLog:sv},Symbol.toStringTag,{value:"Module"})),uf=process.env.NODE_ENV==="development"?J0:iv,lv=uf.TreeView,cv=uf.generateContent,av=uf.useLexicalCommandsLog;function uv({treeTypeButtonClassName:n,timeTravelButtonClassName:e,timeTravelPanelSliderClassName:t,timeTravelPanelButtonClassName:o,viewClassName:r,timeTravelPanelClassName:s,editor:i,customPrintNode:l}){const c=Ys.createRef(),[a,f]=I.useState(i.getEditorState()),d=av(i);return I.useEffect(()=>Sn(i.registerUpdateListener(({editorState:u})=>{f(u)}),i.registerEditableListener(()=>{f(i.getEditorState())})),[i]),I.useEffect(()=>{const u=c.current;if(u!==null)return u.__lexicalEditor=i,()=>{u.__lexicalEditor=null}},[i,c]),W.exports.jsx(lv,{treeTypeButtonClassName:n,timeTravelButtonClassName:e,timeTravelPanelSliderClassName:t,timeTravelPanelButtonClassName:o,viewClassName:r,timeTravelPanelClassName:s,setEditorReadOnly:u=>{const h=i.getRootElement();h!=null&&(h.contentEditable=u?"false":"true")},editorState:a,setEditorState:u=>i.setEditorState(u),generateContent:async function(u){return cv(i,d,u,l)},ref:c})}function fv(){const[n]=Xn();return W.exports.jsx(uv,{viewClassName:"tree-view-output",treeTypeButtonClassName:"debug-treetype-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",editor:n})}function dv(){return W.exports.jsx("div",{className:"editor-placeholder",children:"Enter some rich text..."})}const hv={namespace:"React.js Demo",nodes:[],onError(n){throw n},theme:eO};function gv(){return W.exports.jsx(rx,{initialConfig:hv,children:W.exports.jsxs("div",{className:"editor-container",children:[W.exports.jsx(tO,{}),W.exports.jsxs("div",{className:"editor-inner",children:[W.exports.jsx(Xb,{contentEditable:W.exports.jsx(Cw,{className:"editor-input"}),placeholder:W.exports.jsx(dv,{}),ErrorBoundary:Zb}),W.exports.jsx(jw,{}),W.exports.jsx(sx,{}),W.exports.jsx(fv,{})]})]})})}xn.Editor=gv,Object.defineProperty(xn,Symbol.toStringTag,{value:"Module"})});
87
+ ${F.stack}`)})},[a]);I.useEffect(()=>{!w&&i._nodeMap.size>1e3&&(x(!0),!w)||D.current!==i&&(D.current=i,q(y),p||u(J=>[...J,[Date.now(),i]]))},[i,q,y,w,p]);const Y=d.length;return I.useEffect(()=>{if(S){let J;const oe=()=>{const F=C.current;if(F===Y-1)return void T(!1);const ce=d[F][0],se=d[F+1][0];J=setTimeout(()=>{C.current++;const We=C.current,ae=N.current;ae!==null&&(ae.value=String(We)),l(d[We][1]),oe()},se-ce)};return oe(),()=>{clearTimeout(J)}}},[d,S,Y,l]),W.exports.jsxs("div",{className:o,children:[!w&&E?W.exports.jsxs("div",{style:{padding:20},children:[W.exports.jsx("span",{style:{marginRight:20},children:"Detected large EditorState, this can impact debugging performance."}),W.exports.jsx("button",{onClick:()=>{O(!0)},style:{background:"transparent",border:"1px solid white",color:"white",cursor:"pointer",padding:5},children:"Show full tree"})]}):null,w?null:W.exports.jsx("button",{onClick:()=>(q(!y),void m(!y)),className:n,type:"button",children:y?"Tree":"Export DOM"}),!p&&(w||!E)&&Y>2&&W.exports.jsx("button",{onClick:()=>{c(!0),C.current=Y-1,_(!0)},className:e,type:"button",children:"Time Travel"}),(w||!E)&&W.exports.jsx("pre",{ref:f,children:h}),p&&(w||!E)&&W.exports.jsxs("div",{className:s,children:[W.exports.jsx("button",{className:r,onClick:()=>{C.current===Y-1&&(C.current=1),T(!S)},type:"button",children:S?"Pause":"Play"}),W.exports.jsx("input",{className:t,ref:N,onChange:J=>{const oe=Number(J.target.value),F=d[oe];F&&(C.current=oe,l(F[1]))},type:"range",min:"1",max:Y-1}),W.exports.jsx("button",{className:r,onClick:()=>{c(!1);const J=d.length-1,oe=d[J];l(oe[1]);const F=N.current;F!==null&&(F.value=String(J)),_(!1),T(!1)},type:"button",children:"Exit"})]})]})});function py(n,e){const t=new Set;let r=0;for(const[o]of n._commands)t.add(n.registerCommand(o,s=>(e(i=>{r+=1;const l=[...i];return l.push({index:r,payload:s,type:o.type?o.type:"UNKNOWN"}),l.length>10&&l.shift(),l}),!1),ye));return()=>t.forEach(o=>o())}function iv(n){const[e,t]=I.useState([]);return I.useEffect(()=>py(n,t),[n]),I.useMemo(()=>e,[e])}const lv=Object.freeze(Object.defineProperty({__proto__:null,TreeView:sv,generateContent:Z0,registerLexicalCommandLogger:py,useLexicalCommandsLog:iv},Symbol.toStringTag,{value:"Module"})),uf=process.env.NODE_ENV==="development"?V0:lv,cv=uf.TreeView,av=uf.generateContent,uv=uf.useLexicalCommandsLog;function fv({treeTypeButtonClassName:n,timeTravelButtonClassName:e,timeTravelPanelSliderClassName:t,timeTravelPanelButtonClassName:r,viewClassName:o,timeTravelPanelClassName:s,editor:i,customPrintNode:l}){const c=Hs.createRef(),[a,f]=I.useState(i.getEditorState()),d=uv(i);return I.useEffect(()=>Nn(i.registerUpdateListener(({editorState:u})=>{f(u)}),i.registerEditableListener(()=>{f(i.getEditorState())})),[i]),I.useEffect(()=>{const u=c.current;if(u!==null)return u.__lexicalEditor=i,()=>{u.__lexicalEditor=null}},[i,c]),W.exports.jsx(cv,{treeTypeButtonClassName:n,timeTravelButtonClassName:e,timeTravelPanelSliderClassName:t,timeTravelPanelButtonClassName:r,viewClassName:o,timeTravelPanelClassName:s,setEditorReadOnly:u=>{const h=i.getRootElement();h!=null&&(h.contentEditable=u?"false":"true")},editorState:a,setEditorState:u=>i.setEditorState(u),generateContent:async function(u){return av(i,d,u,l)},ref:c})}function dv(){const[n]=Xn();return W.exports.jsx(fv,{viewClassName:"tree-view-output",treeTypeButtonClassName:"debug-treetype-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",editor:n})}function hv(){return W.exports.jsx("div",{className:"editor-placeholder",children:"Enter some rich text..."})}const gv={namespace:"React.js Demo",nodes:[],onError(n){throw n},theme:tO};function pv(){return W.exports.jsx(sx,{initialConfig:gv,children:W.exports.jsxs("div",{className:"editor-container",children:[W.exports.jsx(nO,{}),W.exports.jsxs("div",{className:"editor-inner",children:[W.exports.jsx(qb,{contentEditable:W.exports.jsx(Nw,{className:"editor-input"}),placeholder:W.exports.jsx(hv,{}),ErrorBoundary:eO}),W.exports.jsx(Hw,{}),W.exports.jsx(ix,{}),W.exports.jsx(dv,{})]})]})})}xn.Editor=pv,Object.defineProperty(xn,Symbol.toStringTag,{value:"Module"})});
88
88
  //# sourceMappingURL=index.umd.js.map