sykpcomposer 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +10999 -5461
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +74 -26
- package/dist/index.umd.js.map +1 -1
- package/dist/src/components/ExampleTheme.d.ts +43 -0
- package/dist/src/components/plugins/ToolbarPlugin.d.ts +2 -0
- package/dist/src/components/plugins/TreeViewPlugin.d.ts +9 -0
- package/dist/style.css +1 -0
- package/package.json +45 -45
package/dist/index.umd.js
CHANGED
|
@@ -1,40 +1,88 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`+
|
|
3
|
-
`),
|
|
4
|
-
`)
|
|
5
|
-
`+
|
|
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 \``+
|
|
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
|
|
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 <`+
|
|
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
|
-
`,yp=Dt?la:wo,ca="֑-߿יִ-﷽ﹰ-ﻼ",aa="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",Tp=new RegExp("^[^"+aa+"]*["+ca+"]"),xp=new RegExp("^[^"+ca+"]*["+aa+"]"),st={bold:No,code:So,highlight:Oo,italic:Co,strikethrough:yr,subscript:Eo,superscript:vo,underline:Tr},Np={directionless:yi,unmergeable:bo},ua={center:xi,end:Ei,justify:Ci,left:Ti,right:Ni,start:Si},Cp={[xi]:"center",[Ei]:"end",[Ci]:"justify",[Ti]:"left",[Ni]:"right",[Si]:"start"},Sp={normal:sa,segmented:mi,token:_i},Ep={[sa]:"normal",[mi]:"segmented",[_i]:"token"};function Do(...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 vp=100;let vi=!1,Oi=0;function Op(){return vi}function bp(n){Oi=n.timeStamp}function wp(n){Oi===0&&Lo(n).addEventListener("textInput",bp,!0)}function bi(n,e,t){return e.__lexicalLineBreak===n||n[`__lexicalKey_${t._key}`]!==void 0}function Dp(n){return n.getEditorState().read(()=>{const e=re();return e!==null?e.clone():null})}function Mp(n,e,t){const r=lt(t._window);let o=null,s=null;r!==null&&r.anchorNode===n&&(o=r.anchorOffset,s=r.focusOffset);const i=n.nodeValue;i!==null&&Pi(e,i,o,s,!1)}function Ap(n,e,t){if(U(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return e.nodeType===Mt&&t.isAttached()}function fa(n,e,t){vi=!0;const r=performance.now()-Oi>vp;try{Ke(n,()=>{const o=re()||Dp(n),s=new Map,i=n.getRootElement(),l=n._editorState,c=n._blockCursorElement;let a=!1,u="";for(let f=0;f<e.length;f++){const h=e[f],g=h.type,p=h.target;let _=Cr(p,l);if(!(_===null&&p!==i||le(_))){if(g==="characterData")r&&B(_)&&Ap(o,p,_)&&Mp(p,_,n);else if(g==="childList"){a=!0;const y=h.addedNodes;for(let N=0;N<y.length;N++){const C=y[N],S=Na(C),E=C.parentNode;if(E!=null&&C!==c&&S===null&&(C.nodeName!=="BR"||!bi(C,E,n))){if(Dt){const v=C.innerText||C.nodeValue;v&&(u+=v)}E.removeChild(C)}}const m=h.removedNodes,T=m.length;if(T>0){let N=0;for(let C=0;C<T;C++){const S=m[C];(S.nodeName==="BR"&&bi(S,p,n)||c===S)&&(p.appendChild(S),N++)}T!==N&&(p===i&&(_=Ea(l)),s.set(p,_))}}}}if(s.size>0)for(const[f,h]of s)if(w(h)){const g=h.getChildrenKeys();let p=f.firstChild;for(let _=0;_<g.length;_++){const y=g[_],m=n.getElementByKey(y);m!==null&&(p==null?(f.appendChild(m),p=m):p!==m&&f.replaceChild(m,p),p=p.nextSibling)}}else B(h)&&h.markDirty();const d=t.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){const h=d[f],g=h.addedNodes,p=h.target;for(let _=0;_<g.length;_++){const y=g[_],m=y.parentNode;m!=null&&y.nodeName==="BR"&&!bi(y,p,n)&&m.removeChild(y)}}t.takeRecords()}o!==null&&(a&&(o.dirty=!0,it(o)),Dt&&Ra(n)&&o.insertRawText(u))})}finally{vi=!1}}function da(n){const e=n._observer;if(e!==null){const t=e.takeRecords();fa(n,t,e)}}function ha(n){wp(n),n._observer=new MutationObserver((e,t)=>{fa(n,e,t)})}function ga(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 pa(n,e){const t=n.mergeWithSibling(e),r=ie()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function _a(n){let e=n;if(e.__text===""&&e.isSimpleText()&&!e.isUnmergeable()){e.remove();return}let t;for(;(t=e.getPreviousSibling())!==null&&B(t)&&t.isSimpleText()&&!t.isUnmergeable();)if(t.__text==="")t.remove();else if(ga(t,e)){e=pa(t,e);break}else break;let r;for(;(r=e.getNextSibling())!==null&&B(r)&&r.isSimpleText()&&!r.isUnmergeable();)if(r.__text==="")r.remove();else if(ga(e,r)){e=pa(e,r);break}else break}function ma(n){return ya(n.anchor),ya(n.focus),n}function ya(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),B(r)){n.set(r.__key,o?r.getTextContentSize():0,"text");break}else if(!w(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element")}}let Ta=1;function kp(){Ta=1}function Pp(){return""+Ta++}function Rp(n,e){const t=n._nodes.get(e);if(t===void 0)throw Error(`registeredNode: Type ${e} not found`);return t}const $p=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function Ip(n){return le(Cr(n))}function wi(n){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return le(Cr(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&Nr(e)==null)}function xr(n,e,t){const r=n.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(t)&&e!==null&&!wi(e)&&Di(e)===n}catch{return!1}}function Mo(n){return n instanceof ts}function Di(n){let e=n;for(;e!=null;){const t=Nr(e);if(Mo(t))return t;e=$o(e)}return null}function Nr(n){return n?n.__lexicalEditor:null}function Lp(n){return Tp.test(n)?"rtl":xp.test(n)?"ltr":null}function en(n){return n.isToken()||n.isSegmented()}function Fp(n){return n.nodeType===Mt}function Ao(n){let e=n;for(;e!=null;){if(Fp(e))return e;e=e.firstChild}return null}function Mi(n,e,t){const r=st[e];if(t!==null&&(n&r)===(t&r))return n;let o=n^r;return e==="subscript"?o&=~st.superscript:e==="superscript"&&(o&=~st.subscript),o}function Bp(n){return B(n)||on(n)||le(n)}function xa(n,e){if(e!=null){Kp(n,e),n.__key=e;return}be(),Su();const t=ie(),r=at(),o=Pp();r._nodeMap.set(o,n),w(n)?t._dirtyElements.set(o,!0):t._dirtyLeaves.add(o),t._cloneNotNeeded.add(o),t._dirtyType=oa,n.__key=o}function Kp(n,e){const t=Fm();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 zp(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 tn(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 ko(n){Su();const e=n.getLatest(),t=e.__parent,r=at(),o=ie(),s=r._nodeMap,i=o._dirtyElements;t!==null&&zp(t,s,i);const l=e.__key;o._dirtyType=oa,w(n)?i.set(l,!0):o._dirtyLeaves.add(l)}function Wp(n){const e=n.getPreviousSibling(),t=n.getNextSibling();e!==null&&ko(e),t!==null&&ko(t)}function ye(n){be();const e=ie(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const r=Se(t);r!==null&&r.getWritable()}if(n!==null){const r=Se(n);r!==null&&r.getWritable()}}}function At(){return Mn()?null:ie()._compositionKey}function Se(n,e){const r=(e||at())._nodeMap.get(n);return r===void 0?null:r}function Na(n,e){const t=ie(),r=n[`__lexicalKey_${t._key}`];return r!==void 0?Se(r,e):null}function Cr(n,e){let t=n;for(;t!=null;){const r=Na(t,e);if(r!==null)return r;t=$o(t)}return null}function Ca(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function Sa(n){return n.read(()=>Be().getTextContent())}function Up(n,e){Ke(n,()=>{const t=at();if(t.isEmpty())return;if(e==="root"){Be().markDirty();return}const r=t._nodeMap;for(const[,o]of r)o.markDirty()},n._pendingEditorState===null?{tag:"history-merge"}:void 0)}function Be(){return Ea(at())}function Ea(n){return n._nodeMap.get("root")}function it(n){be();const e=at();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 jp(){be();const n=ie();da(n)}function Nn(n){const e=ie(),t=Hp(n,e);if(t===null){const r=e.getRootElement();return n===r?Se("root"):null}return Se(t)}function va(n,e){return e?n.getTextContentSize():0}function Hp(n,e){let t=n;for(;t!=null;){const r=t[`__lexicalKey_${e._key}`];if(r!==void 0)return r;t=$o(t)}return null}function Oa(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function Ai(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function ba(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function wa(n){return n.nodeType===Mt?n.nodeValue:null}function ki(n,e,t){const r=lt(e._window);if(r===null)return;const o=r.anchorNode;let{anchorOffset:s,focusOffset:i}=r;if(o!==null){let l=wa(o);const c=Cr(o);if(l!==null&&B(c)){if(l===wo&&t){const a=t.length;l=t,s=a,i=a}l!==null&&Pi(c,l,s,i,n)}}}function Pi(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]===wo&&(l=e.slice(0,-1));const c=s.getTextContent();if(o||l!==c){if(l===""){if(ye(null),!gi&&!xo&&!pi){const p=ie();setTimeout(()=>{p.update(()=>{s.isAttached()&&s.remove()})},20)}else s.remove();return}const a=s.getParent(),u=Dn(),d=s.getTextContentSize(),f=At(),h=s.getKey();if(s.isToken()||f!==null&&h===f&&!i||U(u)&&(a!==null&&!a.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===n.__key&&u.anchor.offset===0&&!s.canInsertTextBefore()&&!i||u.focus.key===n.__key&&u.focus.offset===d&&!s.canInsertTextAfter()&&!i)){s.markDirty();return}const g=re();if(!U(g)||t===null||r===null){s.setTextContent(l);return}if(g.setTextNodeRange(s,t,s,r),s.isSegmented()){const p=s.getTextContent(),_=Ee(p);s.replace(_),s=_}s.setTextContent(l)}}}function Yp(n){const e=n.getPreviousSibling();return(B(e)||w(e)&&e.isInline())&&!e.canInsertTextAfter()}function Vp(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||Yp(e):t===e.getTextContentSize()?!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||o:!1}function Jp(n,e,t,r){return n==="Tab"&&!e&&!t&&!r}function Gp(n,e,t,r){return n.toLowerCase()==="b"&&!e&&Sr(t,r)}function qp(n,e,t,r){return n.toLowerCase()==="i"&&!e&&Sr(t,r)}function Xp(n,e,t,r){return n.toLowerCase()==="u"&&!e&&Sr(t,r)}function Zp(n,e){return Aa(n)&&!e}function Qp(n,e){return Aa(n)&&e}function e_(n,e){return Ye&&e&&n.toLowerCase()==="o"}function t_(n,e,t){return Er(n)&&(Ye?e:t)}function n_(n,e,t){return vr(n)&&(Ye?e:t)}function r_(n,e){return Ye&&e&&Er(n)}function o_(n,e){return Ye&&e&&vr(n)}function s_(n,e,t,r){return Ye?e||t?!1:Er(n)||n.toLowerCase()==="h"&&r:r||e||t?!1:Er(n)}function i_(n,e,t,r,o){return Ye?t||r||o?!1:vr(n)||n.toLowerCase()==="d"&&e:e||r||o?!1:vr(n)}function l_(n,e,t,r){return n.toLowerCase()==="z"&&!e&&Sr(t,r)}function c_(n,e,t,r){return Ye?n.toLowerCase()==="z"&&t&&e:n.toLowerCase()==="y"&&r||n.toLowerCase()==="z"&&r&&e}function a_(n,e,t,r){return e?!1:n.toLowerCase()==="c"?Ye?t:r:!1}function u_(n,e,t,r){return e?!1:n.toLowerCase()==="x"?Ye?t:r:!1}function Da(n){return n==="ArrowLeft"}function Ma(n){return n==="ArrowRight"}function f_(n){return n==="ArrowUp"}function d_(n){return n==="ArrowDown"}function h_(n,e,t,r){return Da(n)&&!e&&!r&&!t}function g_(n,e,t,r,o){return Da(n)&&!r&&!t&&(e||o)}function p_(n,e,t,r){return Ma(n)&&!e&&!r&&!t}function __(n,e,t,r,o){return Ma(n)&&!r&&!t&&(e||o)}function m_(n,e,t){return f_(n)&&!e&&!t}function y_(n,e,t){return d_(n)&&!e&&!t}function T_(n,e,t,r){return n||e||t||r}function x_(n){return n===" "}function Sr(n,e){return Ye?n:e}function Aa(n){return n==="Enter"}function Er(n){return n==="Backspace"}function N_(n){return n==="Escape"}function vr(n){return n==="Delete"}function ka(n,e,t){return n.toLowerCase()==="a"&&Sr(e,t)}function C_(){const n=Be(),e=n.select(0,n.getChildrenSize());it(ma(e))}function Or(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=Do(o);return t[e]=s,s}return o}function Ri(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 u=a.get(i),d=u==="destroyed"&&o==="created";(u===void 0||d)&&a.set(i,d?"updated":o)}function S_(n){const e=n.getType(),t=at();if(t._readOnly){const s=Ba(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 Pa(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 $i(n,e){const t=n.offset;if(n.type==="element"){const r=n.getNode();return Pa(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?Pa(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):o}}return null}function Ra(n){const e=Lo(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function P(n,e,t){return Du(n,e,t)}function Po(n){return!$e(n)&&!n.isLastChild()&&!n.isInline()}function Ro(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 $o(n){const e=n.assignedSlot||n.parentElement;return e!==null&&e.nodeType===11?e.host:e}function E_(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 u=a===r.body;if(u)l=0,c=Lo(n).innerHeight;else{const f=a.getBoundingClientRect();l=f.top,c=f.bottom}let d=0;if(s<l?d=-(l-s):i>c&&(d=i-c),d!==0)if(u)o.scrollBy(0,d);else{const f=a.scrollTop;a.scrollTop+=d;const h=a.scrollTop-f;s-=h,i-=h}if(u)break;a=$o(a)}}function v_(n){return ie()._updateTags.has(n)}function O_(n){be(),ie()._updateTags.add(n)}function b_(n){const e=re();if(!U(e)||!w(n))return e;const{anchor:t,focus:r}=e,o=t.getNode(),s=r.getNode();return Io(o,n)&&t.set(n.__key,0,"element"),Io(s,n)&&r.set(n.__key,0,"element"),e}function Io(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function w_(n){const e=n.ownerDocument;return e&&e.defaultView||null}function Lo(n){const e=n._window;if(e===null)throw Error("window object not found");return e}function D_(n){return w(n)&&n.isInline()||le(n)&&n.isInline()}function $a(n){let e=n.getParentOrThrow();for(;e!==null;){if(kt(e))return e;e=e.getParentOrThrow()}return e}function kt(n){return $e(n)||w(n)&&n.isShadowRoot()}function Ia(n){const e=n.constructor.clone(n);return xa(e,null),e}function br(n){const e=ie(),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 Ii(n,e){const t=n.getParent();if($e(t)&&!w(e)&&!le(e))throw Error("Only element or decorator nodes can be inserted in to the root node")}function M_(n){const e=Se(n);if(e===null)throw Error(`Expected node with key ${n} to exist but it's not in the nodeMap.`);return e}function A_(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=Do(r);r=e.blockCursor=o}r!==void 0&&t.classList.add(...r)}return t}function Li(n){return(le(n)||w(n)&&!n.canBeEmpty())&&!n.isInline()}function Fi(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function k_(n,e,t){let r=n._blockCursorElement;if(U(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 u=s.getChildAtIndex(i-1);Li(u)&&(c=!0)}else{const u=s.getChildAtIndex(i);if(Li(u)){const d=u.getPreviousSibling();(d===null||Li(d))&&(c=!0,a=n.getElementByKey(u.__key))}}if(c){const u=n.getElementByKey(s.__key);r===null&&(n._blockCursorElement=r=A_(n._config)),e.style.caretColor="transparent",a===null?u.appendChild(r):u.insertBefore(r,a);return}}r!==null&&Fi(r,n,e)}function lt(n){return He?(n||window).getSelection():null}function P_(n,e){let t=n.getChildAtIndex(e);if(t==null&&(t=n),kt(n))throw Error("Can not call $splitNode() on root element");const r=i=>{const l=i.getParentOrThrow(),c=kt(l),a=i===t&&!c?i:Ia(i);if(c){if(!(w(i)&&w(a)))throw Error("Children of a root must be ElementNode");return i.insertAfter(a),[i,a,a]}else{const[u,d,f]=r(l),h=i.getNextSiblings();return f.append(a,...h),[u,d,a]}},[o,s]=r(t);return[o,s]}function R_(n){return Fo(n)&&n.tagName==="A"}function Fo(n){return n.nodeType===1}function La(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 Bi(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 Cn(n){if($e(n)||le(n)&&!n.isInline())return!0;if(!w(n)||kt(n))return!1;const e=n.getFirstChild(),t=e===null||on(e)||B(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function Ki(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function $_(){return ie()}const Fa=new WeakMap,I_=new Map;function Ba(n){if(!n._readOnly&&n.isEmpty())return I_;if(!n._readOnly)throw Error("getCachedTypeToNodeMap called with a writable EditorState");let e=Fa.get(n);if(!e){e=new Map,Fa.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 Ka(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 L_(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=Ca(n)),delete o[i])}function za(n,e,t,r,o,s){let i=n.getFirstChild();for(;i!==null;){const l=i.__key;i.__parent===e&&(w(i)&&za(i,l,t,r,o,s),t.has(l)||s.delete(l),o.push(l)),i=i.getNextSibling()}}function F_(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()||(w(c)&&za(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 he="",we="",ct=null,Ve="",Tt="",Pt,De,wr,Wa=!1,Dr=!1,Bo,Ko=null,zi,Wi,nn,Je,Ui,Mr;function zo(n,e){const t=nn.get(n);if(e!==null){const r=Vi(n);r.parentNode===e&&e.removeChild(r)}if(Je.has(n)||De._keyToDOMMap.delete(n),w(t)){const r=Uo(t,nn);ji(r,0,r.length-1,null)}t!==void 0&&Ri(Mr,wr,Bo,t,"destroyed")}function ji(n,e,t,r){let o=e;for(;o<=t;++o){const s=n[o];s!==void 0&&zo(s,r)}}function rn(n,e){n.setProperty("text-align",e)}const B_="40px";function Ua(n,e){const t=Pt.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")||B_;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${r})`)}function ja(n,e){const t=n.style;e===0?rn(t,""):e===Ti?rn(t,"left"):e===xi?rn(t,"center"):e===Ni?rn(t,"right"):e===Ci?rn(t,"justify"):e===Si?rn(t,"start"):e===Ei&&rn(t,"end")}function Wo(n,e,t){const r=Je.get(n);if(r===void 0)throw Error("createNode: node does not exist in nodeMap");const o=r.createDOM(Pt,De);if(J_(n,o,De),B(r)?o.setAttribute("data-lexical-text","true"):le(r)&&o.setAttribute("data-lexical-decorator","true"),w(r)){const s=r.__indent,i=r.__size;if(s!==0&&Ua(o,s),i!==0){const c=i-1,a=Uo(r,Je);K_(a,c,r,o)}const l=r.__format;l!==0&&ja(o,l),r.isInline()||Ya(null,r,o),Po(r)&&(he+=yt,Tt+=yt)}else{const s=r.getTextContent();if(le(r)){const i=r.decorate(De,Pt);i!==null&&Ja(n,i),o.contentEditable="false"}else B(r)&&(r.isDirectionless()||(we+=s));he+=s,Tt+=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),Ri(Mr,wr,Bo,r,"created"),o}function K_(n,e,t,r){const o=we;we="",Hi(n,t,0,e,r,null),Va(t,r),we=o}function Hi(n,e,t,r,o,s){const i=he;he="";let l=t;for(;l<=r;++l){Wo(n[l],o,s);const c=Je.get(n[l]);c!==null&&B(c)&&(ct===null&&(ct=c.getFormat()),Ve===""&&(Ve=c.getStyle()))}Po(e)&&(he+=yt),o.__lexicalTextContent=he,he=i+he}function Ha(n,e){const t=e.get(n);return on(t)||le(t)&&t.isInline()}function Ya(n,e,t){const r=n!==null&&(n.__size===0||Ha(n.__last,nn)),o=e.__size===0||Ha(e.__last,Je);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 z_(n){fl(n)&&ct!=null&&ct!==n.__textFormat&&!Dr&&(n.setTextFormat(ct),n.setTextStyle(Ve))}function W_(n){fl(n)&&Ve!==""&&Ve!==n.__textStyle&&!Dr&&n.setTextStyle(Ve)}function Va(n,e){const t=e.__lexicalDirTextContent,r=e.__lexicalDir;if(t!==we||r!==Ko){const o=we==="",s=o?Ko:Lp(we);if(s!==r){const i=e.classList,l=Pt.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 u=Do(c);c=l[r]=u}i.remove(...c)}if(s===null||o&&s==="ltr")e.removeAttribute("dir");else{if(a!==void 0){if(typeof a=="string"){const u=Do(a);a=l[s]=u}a!==void 0&&i.add(...a)}e.dir=s}if(!Dr){const u=n.getWritable();u.__dir=s}}Ko=s,e.__lexicalDirTextContent=we,e.__lexicalDir=s}}function U_(n,e,t){const r=we;we="",ct=null,Ve="",j_(n,e,t),Va(e,t),z_(e),W_(e),we=r}function Uo(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 j_(n,e,t){const r=he,o=n.__size,s=e.__size;if(he="",o===1&&s===1){const i=n.__first,l=e.__first;if(i===l)Ar(i,t);else{const a=Vi(i),u=Wo(l,null,null);try{t.replaceChild(u,a)}catch(d){if(typeof d=="object"&&d!=null){const f=`${d.toString()} Parent: ${t.tagName}, new child: {tag: ${u.tagName} key: ${l}}, old child: {tag: ${a.tagName}, key: ${i}}.`;throw new Error(f)}else throw d}zo(i,null)}const c=Je.get(l);B(c)&&(ct===null&&(ct=c.getFormat()),Ve===""&&(Ve=c.getStyle()))}else{const i=Uo(n,nn),l=Uo(e,Je);if(o===0)s!==0&&Hi(l,e,0,s-1,t,null);else if(s===0){if(o!==0){const a=t.__lexicalLineBreak==null;ji(i,0,o-1,a?null:t),a&&(t.textContent="")}}else Y_(e,i,l,o,s,t)}Po(e)&&(he+=yt),t.__lexicalTextContent=he,he=r+he}function Ar(n,e){const t=nn.get(n);let r=Je.get(n);if(t===void 0||r===void 0)throw Error("reconcileNode: prevNode or nextNode does not exist in nodeMap");const o=Wa||Wi.has(n)||zi.has(n),s=Ro(De,n);if(t===r&&!o){if(w(t)){const i=s.__lexicalTextContent;i!==void 0&&(he+=i,Tt+=i);const l=s.__lexicalDirTextContent;l!==void 0&&(we+=l)}else{const i=t.getTextContent();B(t)&&!t.isDirectionless()&&(we+=i),Tt+=i,he+=i}return s}if(t!==r&&o&&Ri(Mr,wr,Bo,r,"updated"),r.updateDOM(t,s,Pt)){const i=Wo(n,null,null);if(e===null)throw Error("reconcileNode: parentDOM is null");return e.replaceChild(i,s),zo(n,null),i}if(w(t)&&w(r)){const i=r.__indent;i!==t.__indent&&Ua(s,i);const l=r.__format;l!==t.__format&&ja(s,l),o&&(U_(t,r,s),!$e(r)&&!r.isInline()&&Ya(t,r,s)),Po(r)&&(he+=yt,Tt+=yt)}else{const i=r.getTextContent();if(le(r)){const l=r.decorate(De,Pt);l!==null&&Ja(n,l)}else B(r)&&!r.isDirectionless()&&(we+=i);he+=i,Tt+=i}if(!Dr&&$e(r)&&r.__cachedText!==Tt){const i=r.getWritable();i.__cachedText=Tt,r=i}return Object.freeze(r),s}function Ja(n,e){let t=De._pendingDecorators;const r=De._decorators;if(t===null){if(r[n]===e)return;t=Ca(De)}t[n]=e}function H_(n){return n.firstChild}function Yi(n){let e=n.nextSibling;return e!==null&&e===De._blockCursorElement&&(e=e.nextSibling),e}function Y_(n,e,t,r,o,s){const i=r-1,l=o-1;let c,a,u=H_(s),d=0,f=0;for(;d<=i&&f<=l;){const p=e[d],_=t[f];if(p===_)u=Yi(Ar(_,s)),d++,f++;else{c===void 0&&(c=new Set(e)),a===void 0&&(a=new Set(t));const m=a.has(p),T=c.has(_);if(!m)u=Yi(Vi(p)),zo(p,s),d++;else if(!T)Wo(_,s,u),f++;else{const N=Ro(De,_);N===u?u=Yi(Ar(_,s)):(u!=null?s.insertBefore(N,u):s.appendChild(N),Ar(_,s)),d++,f++}}const y=Je.get(_);y!==null&&B(y)&&(ct===null&&(ct=y.getFormat()),Ve===""&&(Ve=y.getStyle()))}const h=d>i,g=f>l;if(h&&!g){const p=t[l+1],_=p===void 0?null:De.getElementByKey(p);Hi(t,n,f,l,s,_)}else g&&!h&&ji(e,d,i,s)}function V_(n,e,t,r,o,s){he="",Tt="",we="",Wa=r===xn,Ko=null,De=t,Pt=t._config,wr=t._nodes,Bo=De._listeners.mutation,zi=o,Wi=s,nn=n._nodeMap,Je=e._nodeMap,Dr=e._readOnly,Ui=new Map(t._keyToDOMMap);const i=new Map;return Mr=i,Ar("root",null),De=void 0,wr=void 0,zi=void 0,Wi=void 0,nn=void 0,Je=void 0,Pt=void 0,Ui=void 0,Mr=void 0,i}function J_(n,e,t){const r=t._keyToDOMMap;e["__lexicalKey_"+t._key]=n,r.set(n,e)}function Vi(n){const e=Ui.get(n);if(e===void 0)throw Error(`Reconciliation: could not find DOM element for node key ${n}`);return e}const xt=Object.freeze({}),Ji=30,Gi=[["keydown",rm],["pointerdown",q_],["compositionstart",tm],["compositionend",nm],["input",em],["click",G_],["cut",xt],["copy",xt],["dragstart",xt],["dragover",xt],["dragend",xt],["paste",xt],["focus",xt],["blur",xt],["drop",xt]];To&&Gi.push(["beforeinput",(n,e)=>Q_(n,e)]);let kr=0,Ga=null,qa=0,Sn=null;const jo=new WeakMap;let qi=!1,Xi=!1,Pr=!1,Rr=!1,Xa=[0,"",0,"root",0];function Za(n,e,t,r,o){const s=n.anchor,i=n.focus,l=s.getNode(),c=ie(),a=lt(c._window),u=a!==null?a.anchorNode:null,d=s.key,f=c.getElementByKey(d),h=t.length;return d!==i.key||!B(l)||(!o&&(!To||qa<r+50)||l.isDirty()&&h<2||Oa(t))&&s.offset!==i.offset&&!l.isComposing()||en(l)||l.isDirty()&&h>1||(o||!To)&&f!==null&&!l.isComposing()&&u!==Ao(f)||a!==null&&e!==null&&(!e.collapsed||e.startContainer!==a.anchorNode||e.startOffset!==a.anchorOffset)||l.getFormat()!==n.format||l.getStyle()!==n.style||Vp(n,l)}function Qa(n,e){return n!==null&&n.nodeValue!==null&&n.nodeType===Mt&&e!==0&&e!==n.nodeValue.length}function eu(n,e,t){const{anchorNode:r,anchorOffset:o,focusNode:s,focusOffset:i}=n;qi&&(qi=!1,Qa(r,o)&&Qa(s,i))||Ke(e,()=>{if(!t){it(null);return}if(!xr(e,r,s))return;const l=re();if(U(l)){const c=l.anchor,a=c.getNode();if(l.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(l.dirty=!0);const u=Lo(e).event,d=u?u.timeStamp:performance.now(),[f,h,g,p,_]=Xa,y=Be(),m=e.isComposing()===!1&&y.getTextContent()==="";if(d<_+200&&c.offset===g&&c.key===p)l.format=f,l.style=h;else if(c.type==="text"){if(!B(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 T=c.getNode();l.style="",T instanceof sn&&T.getChildrenSize()===0?(l.format=T.getTextFormat(),l.style=T.getTextStyle()):l.format=0}}else{const u=c.key,f=l.focus.key,h=l.getNodes(),g=h.length,p=l.isBackward(),_=p?i:o,y=p?o:i,m=p?f:u,T=p?u:f;let N=ia,C=!1;for(let S=0;S<g;S++){const E=h[S],v=E.getTextContentSize();if(B(E)&&v!==0&&!(S===0&&E.__key===m&&_===v||S===g-1&&E.__key===T&&y===0)&&(C=!0,N&=E.getFormat(),N===0))break}l.format=C?N:0}}P(e,mo,void 0)})}function G_(n,e){Ke(e,()=>{const t=re(),r=lt(e._window),o=Dn();if(r){if(U(t)){const s=t.anchor,i=s.getNode();if(s.type==="element"&&s.offset===0&&t.isCollapsed()&&!$e(i)&&Be().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&&(w(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===mr||i===Mt){const l=qo(o,r,e,n);it(l)}}}}P(e,Lc,n)})}function q_(n,e){const t=n.target,r=n.pointerType;t instanceof Node&&r!=="touch"&&Ke(e,()=>{Ip(t)||(Xi=!0)})}function tu(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function X_(n,e){return n!==e||w(n)||w(e)||!n.isToken()||!e.isToken()}function Z_(n){return Ga==="MediaLast"&&n<kr+Ji}function Q_(n,e){const t=n.inputType,r=tu(n);t==="deleteCompositionText"||Dt&&Ra(e)||t!=="insertCompositionText"&&Ke(e,()=>{const o=re();if(t==="deleteContentBackward"){if(o===null){const u=Dn();if(!U(u))return;it(u.clone())}if(U(o)){const u=o.anchor.key===o.focus.key;if(Z_(n.timeStamp)&&e.isComposing()&&u){if(ye(null),kr=0,setTimeout(()=>{Ke(e,()=>{ye(null)})},Ji),U(o)){const d=o.anchor.getNode();if(d.markDirty(),o.format=d.getFormat(),!B(d))throw Error("Anchor node must be a TextNode");o.style=d.getStyle()}}else{ye(null),n.preventDefault();const d=o.anchor.getNode().getTextContent(),f=o.anchor.offset===0&&o.focus.offset===d.length;mp&&u&&!f||P(e,hr,!0)}return}}if(!U(o))return;const s=n.data;Sn!==null&&ki(!1,e,Sn),(!o.dirty||Sn!==null)&&o.isCollapsed()&&!$e(o.anchor.getNode())&&r!==null&&o.applyDOMRange(r),Sn=null;const i=o.anchor,l=o.focus,c=i.getNode(),a=l.getNode();if(t==="insertText"||t==="insertTranspose"){if(s===`
|
|
14
|
-
`)n.preventDefault(),
|
|
15
|
-
`){const r=re();if(U(r)){const o=r.focus;r.anchor.set(o.key,o.offset,o.type),P(n,yo,null);return}}}ki(!0,n,e)}function nm(n,e){Dt?Rr=!0:Ke(e,()=>{Zi(e,n.data)})}function rm(n,e){if(kr=n.timeStamp,Ga=n.key,e.isComposing())return;const{key:t,shiftKey:r,ctrlKey:o,metaKey:s,altKey:i}=n;if(!P(e,Fc,n)&&t!=null){if(p_(t,o,i,s))P(e,Bc,n);else if(__(t,o,r,i,s))P(e,Kc,n);else if(h_(t,o,i,s))P(e,zc,n);else if(g_(t,o,r,i,s))P(e,Wc,n);else if(m_(t,o,s))P(e,Uc,n);else if(y_(t,o,s))P(e,jc,n);else if(Qp(t,r))Pr=!0,P(e,yo,n);else if(x_(t))P(e,Hc,n);else if(e_(t,o))n.preventDefault(),Pr=!0,P(e,gr,!0);else if(Zp(t,r))Pr=!1,P(e,yo,n);else if(s_(t,i,s,o))Er(t)?P(e,Yc,n):(n.preventDefault(),P(e,hr,!0));else if(N_(t))P(e,Vc,n);else if(i_(t,o,r,i,s))vr(t)?P(e,Jc,n):(n.preventDefault(),P(e,hr,!1));else if(t_(t,i,o))n.preventDefault(),P(e,pr,!0);else if(n_(t,i,o))n.preventDefault(),P(e,pr,!1);else if(r_(t,s))n.preventDefault(),P(e,_r,!0);else if(o_(t,s))n.preventDefault(),P(e,_r,!1);else if(Gp(t,i,s,o))n.preventDefault(),P(e,wt,"bold");else if(Xp(t,i,s,o))n.preventDefault(),P(e,wt,"underline");else if(qp(t,i,s,o))n.preventDefault(),P(e,wt,"italic");else if(Jp(t,i,o,s))P(e,Gc,n);else if(l_(t,r,s,o))n.preventDefault(),P(e,ai,void 0);else if(c_(t,r,s,o))n.preventDefault(),P(e,ui,void 0);else{const l=e._editorState._selection;$r(l)?a_(t,r,s,o)?(n.preventDefault(),P(e,fi,n)):u_(t,r,s,o)?(n.preventDefault(),P(e,di,n)):ka(t,s,o)&&(n.preventDefault(),P(e,hi,n)):!Dt&&ka(t,s,o)&&(n.preventDefault(),P(e,hi,n))}T_(o,r,i,s)&&P(e,na,n)}}function nu(n){let e=n.__lexicalEventHandles;return e===void 0&&(e=[],n.__lexicalEventHandles=e),e}const En=new Map;function ru(n){const e=n.target,t=e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView,r=lt(t);if(r===null)return;const o=Di(r.anchorNode);if(o===null)return;Xi&&(Xi=!1,Ke(o,()=>{const u=Dn(),d=r.anchorNode;if(d===null)return;const f=d.nodeType;if(f!==mr&&f!==Mt)return;const h=qo(u,r,o,n);it(h)}));const s=Ai(o),i=s[s.length-1],l=i._key,c=En.get(l),a=c||i;a!==o&&eu(r,a,!1),eu(r,o,!0),o!==i?En.set(l,o):c&&En.delete(l)}function ou(n){n._lexicalHandled=!0}function su(n){return n._lexicalHandled===!0}function om(n,e){const t=n.ownerDocument,r=jo.get(t);(r===void 0||r<1)&&t.addEventListener("selectionchange",ru),jo.set(t,(r||0)+1),n.__lexicalEditor=e;const o=nu(n);for(let s=0;s<Gi.length;s++){const[i,l]=Gi[s],c=typeof l=="function"?a=>{su(a)||(ou(a),(e.isEditable()||i==="click")&&l(a,e))}:a=>{if(su(a))return;ou(a);const u=e.isEditable();switch(i){case"cut":return u&&P(e,di,a);case"copy":return P(e,fi,a);case"paste":return u&&P(e,li,a);case"dragstart":return u&&P(e,Xc,a);case"dragover":return u&&P(e,Zc,a);case"dragend":return u&&P(e,Qc,a);case"focus":return u&&P(e,ea,a);case"blur":return u&&P(e,ta,a);case"drop":return u&&P(e,qc,a)}};n.addEventListener(i,c),o.push(()=>{n.removeEventListener(i,c)})}}function sm(n){const e=n.ownerDocument,t=jo.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");jo.set(e,r),r===0&&e.removeEventListener("selectionchange",ru);const o=Nr(n);if(Mo(o))im(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=nu(n);for(let i=0;i<s.length;i++)s[i]();n.__lexicalEventHandles=[]}function im(n){if(n._parentEditor!==null){const e=Ai(n),r=e[e.length-1]._key;En.get(r)===n&&En.delete(r)}else En.delete(n._key)}function lm(){qi=!0}function cm(n,e,t,r,o){Xa=[n,e,t,r,o]}function Qi(n,e,t){be();const r=n.__key,o=n.getParent();if(o===null)return;const s=b_(n);let i=!1;if(U(s)&&e){const l=s.anchor,c=s.focus;l.key===r&&(Zo(l,n,o,n.getPreviousSibling(),n.getNextSibling()),i=!0),c.key===r&&(Zo(c,n,o,n.getPreviousSibling(),n.getNextSibling()),i=!0)}else $r(s)&&e&&n.isSelected()&&n.selectPrevious();if(U(s)&&e&&!i){const l=n.getIndexWithinParent();tn(n),Xo(s,o,l,-1)}else tn(n);!t&&!kt(o)&&!o.canBeEmpty()&&o.isEmpty()&&Qi(o,e),e&&$e(o)&&o.isEmpty()&&o.selectEnd()}class Ho{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,xa(this,e),this.__type!=="root"&&(be(),am(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=Se(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||re();if(t==null)return!1;const r=t.getNodes().some(s=>s.__key===this.__key);if(B(this))return r;if(U(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const s=this.getParent();if(le(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:Se(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(kt(t)){if(!(w(e)||e===this&&le(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:Se(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:Se(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();w(this)&&t.unshift(this),w(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=w(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 u=null,d=a;do{if(d===null)throw Error("getNodesBetween: ancestor is null");if(u=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d!==null)u===null&&!o.has(d.__key)&&r.push(d);else break}while(u===null);s=u}return t||r.reverse(),r}isDirty(){const t=ie()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){const e=Se(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(){be();const e=at(),t=ie(),r=e._nodeMap,o=this.__key,s=this.getLatest(),i=t._cloneNotNeeded,l=re();if(l!==null&&l.setCachedNodes(null),i.has(o))return ko(s),s;const c=Ka(s);return i.add(o),ko(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){Qi(this,!0,e)}replace(e,t){be();let r=re();r!==null&&(r=r.clone()),Ii(this,e);const o=this.getLatest(),s=this.__key,i=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;tn(l);const u=o.getPreviousSibling(),d=o.getNextSibling(),f=o.__prev,h=o.__next,g=o.__parent;if(Qi(o,!1,!0),u===null)c.__first=i;else{const p=u.getWritable();p.__next=i}if(l.__prev=f,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(!(w(this)&&w(l)))throw Error("includeChildren should only be true for ElementNodes");this.getChildren().forEach(p=>{l.append(p)})}if(U(r)){it(r);const p=r.anchor,_=r.focus;p.key===s&&du(p,l),_.key===s&&du(_,l)}return At()===s&&ye(i),l}insertAfter(e,t=!0){be(),Ii(this,e);const r=this.getWritable(),o=e.getWritable(),s=o.getParent(),i=re();let l=!1,c=!1;if(s!==null){const h=e.getIndexWithinParent();if(tn(o),U(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(),u=this.getParentOrThrow().getWritable(),d=o.__key,f=r.__next;if(a===null)u.__last=d;else{const h=a.getWritable();h.__prev=d}if(u.__size++,r.__next=d,o.__next=f,o.__prev=r.__key,o.__parent=r.__parent,t&&U(i)){const h=this.getIndexWithinParent();Xo(i,u,h+1);const g=u.__key;l&&i.anchor.set(g,h+2,"element"),c&&i.focus.set(g,h+2,"element")}return e}insertBefore(e,t=!0){be(),Ii(this,e);const r=this.getWritable(),o=e.getWritable(),s=o.__key;tn(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 u=re();if(t&&U(u)){const d=this.getParentOrThrow();Xo(u,d,a)}return e}isParentRequired(){return!1}createParentElementNode(){return Nt()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){be();const r=this.getPreviousSibling(),o=this.getParentOrThrow();if(r===null)return o.select(0,0);if(w(r))return r.select();if(!B(r)){const s=r.getIndexWithinParent()+1;return o.select(s,s)}return r.select(e,t)}selectNext(e,t){be();const r=this.getNextSibling(),o=this.getParentOrThrow();if(r===null)return o.select();if(w(r))return r.select(0,0);if(!B(r)){const s=r.getIndexWithinParent();return o.select(s,s)}return r.select(e,t)}markDirty(){this.getWritable()}}function am(n,e){const t=ie()._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 um(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 vn extends Ho{static getType(){return"linebreak"}static clone(e){return new vn(e.__key)}constructor(e){super(e)}getTextContent(){return`
|
|
16
|
-
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>
|
|
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(
|
|
19
|
-
`),
|
|
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
|
-
`?r.push(On()):i===" "?r.push(Jo()):r.push(Ee(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"&&Cm(i,l,o,s);const c=i.offset;let a=l.offset;const u=this.getNodes(),d=u.length;let f=u[0];if(!B(f))throw Error("insertText: first node is not a text node");const g=f.getTextContent().length,p=f.getParentOrThrow(),_=d-1;let y=u[_];if(d===1&&l.type==="element"&&(a=g,l.set(i.key,a,"text")),this.isCollapsed()&&c===g&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!p.canInsertTextAfter()&&f.getNextSibling()===null)){let m=f.getNextSibling();if((!B(m)||!m.canInsertTextBefore()||en(m))&&(m=Ee(),m.setFormat(o),m.setStyle(s),p.canInsertTextAfter()?f.insertAfter(m):p.insertAfter(m)),m.select(0,0),f=m,e!==""){this.insertText(e);return}}else if(this.isCollapsed()&&c===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!p.canInsertTextBefore()&&f.getPreviousSibling()===null)){let m=f.getPreviousSibling();if((!B(m)||en(m))&&(m=Ee(),m.setFormat(o),p.canInsertTextBefore()?f.insertBefore(m):p.insertBefore(m)),m.select(),f=m,e!==""){this.insertText(e);return}}else if(f.isSegmented()&&c!==g){const m=Ee(f.getTextContent());m.setFormat(o),f.replace(m),f=m}else if(!this.isCollapsed()&&e!==""){const m=y.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||w(m)&&(!m.canInsertTextBefore()||!m.canInsertTextAfter())){this.insertText(""),mu(this.anchor,this.focus,null),this.insertText(e);return}}if(d===1){if(f.isToken()){const C=Ee(e);C.select(),f.replace(C);return}const m=f.getFormat(),T=f.getStyle();if(c===a&&(m!==o||T!==s))if(f.getTextContent()==="")f.setFormat(o),f.setStyle(s);else{const C=Ee(e);if(C.setFormat(o),C.setStyle(s),C.select(),c===0)f.insertBefore(C,!1);else{const[S]=f.splitText(c);S.insertAfter(C,!1)}C.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);return}else if(fu(f)){const C=Ee(e);C.setFormat(o),C.setStyle(s),C.select(),f.replace(C);return}const N=a-c;f=f.spliceText(c,N,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=m,this.style=T))}else{const m=new Set([...f.getParentKeys(),...y.getParentKeys()]),T=w(f)?f:f.getParentOrThrow();let N=w(y)?y:y.getParentOrThrow(),C=y;if(!T.is(N)&&N.isInline())do C=N,N=N.getParentOrThrow();while(N.isInline());if(l.type==="text"&&(a!==0||y.getTextContent()==="")||l.type==="element"&&y.getIndexWithinParent()<a)if(B(y)&&!y.isToken()&&a!==y.getTextContentSize()){if(y.isSegmented()){const M=Ee(y.getTextContent());y.replace(M),y=M}!$e(l.getNode())&&l.type==="text"&&(y=y.spliceText(0,a,"")),m.add(y.__key)}else{const M=y.getParentOrThrow();!M.canBeEmpty()&&M.getChildrenSize()===1?M.remove():y.remove()}else m.add(y.__key);const S=N.getChildren(),E=new Set(u),v=T.is(N),O=T.isInline()&&f.getNextSibling()===null?T:f;for(let M=S.length-1;M>=0;M--){const I=S[M];if(I.is(f)||w(I)&&I.isParentOf(f))break;I.isAttached()&&(!E.has(I)||I.is(C)?v||O.insertAfter(I,!1):I.remove())}if(!v){let M=N,I=null;for(;M!==null;){const J=M.getChildren(),X=J.length;(X===0||J[X-1].is(I))&&(m.delete(M.__key),I=M),M=M.getParent()}}if(!f.isToken())f=f.spliceText(c,g-c,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);else if(c===g)f.select();else{const M=Ee(e);M.select(),f.replace(M)}for(let M=1;M<d;M++){const I=u[M],J=I.__key;m.has(J)||I.remove()}}}removeText(){this.insertText("")}formatText(e){if(this.isCollapsed()){this.toggleFormat(e),ye(null);return}const t=this.getNodes(),r=[];for(const m of t)B(m)&&r.push(m);const o=r.length;if(o===0){this.toggleFormat(e),ye(null);return}const s=this.anchor,i=this.focus,l=this.isBackward(),c=l?i:s,a=l?s:i;let u=0,d=r[0],f=c.type==="element"?0:c.offset;if(c.type==="text"&&f===d.getTextContentSize()&&(u=1,d=r[1],f=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(f===_)return;if(en(d)||f===0&&_===d.getTextContentSize())d.setFormat(h);else{const m=d.splitText(f,_),T=f===0?m[0]:m[1];T.setFormat(h),c.type==="text"&&c.set(T.__key,0,"text"),a.type==="text"&&a.set(T.__key,_-f,"text")}this.format=h;return}f!==0&&!en(d)&&([,d]=d.splitText(f),f=0),d.setFormat(h);const y=p.getFormatFlags(e,h);_>0&&(_!==p.getTextContentSize()&&!en(p)&&([p]=p.splitText(_)),p.setFormat(y));for(let m=u+1;m<g;m++){const T=r[m],N=T.getFormatFlags(e,y);T.setFormat(N)}c.type==="text"&&c.set(d.__key,f,"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 _=re();if(!U(_))throw Error("Expected RangeSelection after insertParagraph");return _.insertNodes(e)}const t=this.isBackward()?this.focus:this.anchor,r=Ki(t.getNode(),Cn),o=e[e.length-1];if("__language"in r&&w(r)){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const _=il(this);r.splice(_,0,e),o.selectEnd()}return}const s=_=>(w(_)||le(_))&&!_.isInline();if(!e.some(s)){if(!w(r))throw Error("Expected 'firstBlock' to be an ElementNode");const _=il(this);r.splice(_,0,e),o.selectEnd();return}const i=Im(e),l=i.getLastDescendant(),c=i.getChildren(),a=_=>w(_)&&Cn(_)&&!_.isEmpty()&&w(r)&&(!r.isEmpty()||r.canMergeWhenEmpty()),d=!w(r)||!r.isEmpty()?this.insertParagraph():null,f=c[c.length-1];let h=c[0];if(a(h)){if(!w(r))throw Error("Expected 'firstBlock' to be an ElementNode");r.append(...h.getChildren()),h=c[1]}h&&um(r,h);const g=Ki(l,Cn);d&&w(g)&&(d.canMergeWhenEmpty()||Cn(f))&&(g.append(...d.getChildren()),d.remove()),w(r)&&r.isEmpty()&&r.remove(),l.selectEnd();const p=w(r)?r.getLastChild():null;on(p)&&g!==r&&p.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=Nt();return Be().splice(this.anchor.offset,0,[i]),i.select(),i}const e=il(this),t=Ki(this.anchor.getNode(),Cn);if(!w(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=On();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]=ol(this);if(t===0)return[];if(t===1){if(B(i)&&!this.isCollapsed()){const d=c>a?a:c,f=c>a?c:a,h=i.splitText(d,f),g=d===0?h[0]:h[1];return g!=null?[g]:[]}return[i]}const u=o.isBefore(s);if(B(i)){const d=u?c:a;d===i.getTextContentSize()?e.shift():d!==0&&([,i]=i.splitText(d),e[0]=i)}if(B(l)){const f=l.getTextContent().length,h=u?a:c;h===0?e.pop():h!==f&&([l]=l.splitText(h),e[r]=l)}return e}modify(e,t,r){const o=this.focus,s=this.anchor,i=e==="move",l=$i(o,t);if(le(l)&&!l.isIsolated()){if(i&&l.isKeyboardSelectable()){const h=sl();h.add(l.__key),it(h);return}const f=t?l.getPreviousSibling():l.getNextSibling();if(B(f)){const h=f.__key,g=t?f.getTextContent().length:0;o.set(h,g,"text"),i&&s.set(h,g,"text");return}else{const h=l.getParentOrThrow();let g,p;w(f)?(p=f.__key,g=t?f.getChildrenSize():0):(g=l.getIndexWithinParent(),p=h.__key,t||g++),o.set(p,g,"element"),i&&s.set(p,g,"element");return}}const c=ie(),a=lt(c._window);if(!a)return;const u=c._blockCursorElement,d=c._rootElement;if(d!==null&&u!==null&&w(l)&&!l.isInline()&&!l.canBeEmpty()&&Fi(u,c,d),Em(a,e,t?"backward":"forward",r),a.rangeCount>0){const f=a.getRangeAt(0),h=this.anchor.getNode(),g=$e(h)?h:$a(h);if(this.applyDOMRange(f),this.dirty=!0,!i){const p=this.getNodes(),_=[];let y=!1;for(let m=0;m<p.length;m++){const T=p[m];Io(T,g)?_.push(T):y=!0}if(y&&_.length>0)if(t){const m=_[0];w(m)?m.selectStart():m.getParentOrThrow().selectStart()}else{const m=_[_.length-1];w(m)?m.selectEnd():m.getParentOrThrow().selectEnd()}(a.anchorNode!==f.startContainer||a.anchorOffset!==f.startOffset)&&Sm(this)}}}forwardDeletion(e,t,r){if(!r&&(e.type==="element"&&w(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(w(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=$i(s,e);if(le(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&w(o)&&o.getChildrenSize()===0){o.remove();const l=sl();l.add(i.__key),it(l)}else i.remove(),ie().dispatchCommand(mo,void 0);return}else if(!e&&w(i)&&w(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){gu(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){gu(o,e,c);return}}vm(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&$e(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 $r(n){return n instanceof Go}function hu(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function ol(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]:[hu(t),hu(r)]}function Sm(n){const e=n.focus,t=n.anchor,r=t.key,o=t.offset,s=t.type;$t(t,e.key,e.offset,e.type),$t(e,r,o,s),n._cachedNodes=null}function Em(n,e,t,r){n.modify(e,t,r)}function vm(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,u=c?l:i,d=u-1;if(a!==d){const f=o.getTextContent().slice(a,u);Oa(f)||(e?r.offset=d:t.offset=d)}}}function gu(n,e,t){const r=n,s=r.getTextContent().split(/(?=\s)/g),i=s.length;let l=0,c=0;for(let u=0;u<i;u++){const d=s[u],f=u===i-1;if(c=l,l+=d.length,e&&l===t||l>t||f){s.splice(u,1),f&&(c=void 0);break}}const a=s.join("").trim();a===""?r.remove():(r.setTextContent(a),r.select(c,c))}function Om(n,e,t){const r=n.getParent();return t===null||r===null||!r.canBeEmpty()||r!==t.getNode()}function pu(n,e,t,r){let o=e,s;if(n.nodeType===mr){let i=!1;const l=n.childNodes,c=l.length,a=r._blockCursorElement;o===c&&(i=!0,o=c-1);let u=l[o],d=!1;if(u===a)u=l[o+1],d=!0;else if(a!==null){const f=a.parentNode;if(n===f){const h=Array.prototype.indexOf.call(f.children,a);e>h&&o--}}if(s=Nn(u),B(s))o=va(s,i);else{let f=Nn(n);if(f===null)return null;if(w(f)){o=Math.min(f.getChildrenSize(),o);let h=f.getChildAtIndex(o);if(w(h)&&Om(h,o,t)){const g=i?h.getLastDescendant():h.getFirstDescendant();g===null?f=h:(h=g,f=w(h)?h:h.getParentOrThrow()),o=0}B(h)?(s=h,f=null,o=va(h,i)):h!==f&&i&&!d&&o++}else{const h=f.getIndexWithinParent();e===0&&le(f)&&Nn(n)===f?o=h:o=h+1,f=f.getParentOrThrow()}if(w(f))return Ge(f.__key,o,"element")}}else s=Nn(n);return B(s)?Ge(s.__key,o,"text"):null}function _u(n,e,t){const r=n.offset,o=n.getNode();if(r===0){const s=o.getPreviousSibling(),i=o.getParent();if(!e)w(s)&&!t&&s.isInline()?(n.key=s.__key,n.offset=s.getChildrenSize(),n.type="element"):B(s)&&(n.key=s.__key,n.offset=s.getTextContent().length);else if((t||!e)&&s===null&&w(i)&&i.isInline()){const l=i.getPreviousSibling();B(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&&w(s)&&s.isInline())n.key=s.__key,n.offset=0,n.type="element";else if((t||e)&&s===null&&w(i)&&i.isInline()&&!i.canInsertTextAfter()){const l=i.getNextSibling();B(l)&&(n.key=l.__key,n.offset=0)}}}function mu(n,e,t){if(n.type==="text"&&e.type==="text"){const r=n.isBefore(e),o=n.is(e);_u(n,r,o),_u(e,!r,o),o&&(e.key=n.key,e.offset=n.offset,e.type=n.type);const s=ie();if(s.isComposing()&&s._compositionKey!==n.key&&U(t)){const i=t.anchor,l=t.focus;$t(n,i.key,i.offset,i.type),$t(e,l.key,l.offset,l.type)}}}function yu(n,e,t,r,o,s){if(n===null||t===null||!xr(o,n,t))return null;const i=pu(n,e,U(s)?s.anchor:null,o);if(i===null)return null;const l=pu(t,r,U(s)?s.focus:null,o);if(l===null)return null;if(i.type==="element"&&l.type==="element"){const c=Nn(n),a=Nn(t);if(le(c)&&le(a))return null}return mu(i,l,s),[i,l]}function bm(n){return w(n)&&!n.isInline()}function Tu(n,e,t,r,o,s){const i=at(),l=new It(Ge(n,e,o),Ge(t,r,s),0,"");return l.dirty=!0,i._selection=l,l}function wm(){const n=Ge("root",0,"element"),e=Ge("root",0,"element");return new It(n,e,0,"")}function sl(){return new Go(new Set)}function Dm(n){const t=n.getEditorState()._selection,r=lt(n._window);return U(t)||t==null?qo(t,r,n,null):t.clone()}function Mm(n,e){return qo(null,n,e,null)}function qo(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=!Op()&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&s&&s.detail===3||i==="drop"||i===void 0);let a,u,d,f;if(!U(n)||c){if(e===null)return null;if(a=e.anchorNode,u=e.focusNode,d=e.anchorOffset,f=e.focusOffset,l&&U(n)&&!xr(t,a,u))return n.clone()}else return n.clone();const h=yu(a,d,u,f,t,n);if(h===null)return null;const[g,p]=h;return new It(g,p,U(n)?n.format:0,U(n)?n.style:"")}function re(){return at()._selection}function Dn(){return ie()._editorState._selection}function Xo(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 u=Math.max(0,a+r);o.set(c,u,"element"),s.set(c,u,"element"),xu(n)}}else{const a=n.isBackward(),u=a?s:o,d=u.getNode(),f=a?o:s,h=f.getNode();if(e.is(d)){const g=u.offset;(t<=g&&r>0||t<g&&r<0)&&u.set(c,Math.max(0,g+r),"element")}if(e.is(h)){const g=f.offset;(t<=g&&r>0||t<g&&r<0)&&f.set(c,Math.max(0,g+r),"element")}}xu(n)}function xu(n){const e=n.anchor,t=e.offset,r=n.focus,o=r.offset,s=e.getNode(),i=r.getNode();if(n.isCollapsed()){if(!w(s))return;const l=s.getChildrenSize(),c=t>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(B(a)){let u=0;c&&(u=a.getTextContentSize()),e.set(a.__key,u,"text"),r.set(a.__key,u,"text")}return}if(w(s)){const l=s.getChildrenSize(),c=t>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(B(a)){let u=0;c&&(u=a.getTextContentSize()),e.set(a.__key,u,"text")}}if(w(i)){const l=i.getChildrenSize(),c=o>=l,a=c?i.getChildAtIndex(l-1):i.getChildAtIndex(o);if(B(a)){let u=0;c&&(u=a.getTextContentSize()),r.set(a.__key,u,"text")}}}function Am(n,e){const r=e.getEditorState()._selection,o=n._selection;if(U(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 Zo(n,e,t,r,o){let s=null,i=0,l=null;r!==null?(s=r.__key,B(r)?(i=r.getTextContentSize(),l="text"):w(r)&&(i=r.getChildrenSize(),l="element")):o!==null&&(s=o.__key,B(o)?l="text":w(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 Nu(n,e,t,r,o){n.type==="text"?(n.key=t,e||(n.offset+=o)):n.offset>r.getIndexWithinParent()&&(n.offset-=1)}function km(n,e,t,r,o,s,i){const l=r.anchorNode,c=r.focusNode,a=r.anchorOffset,u=r.focusOffset,d=document.activeElement;if(o.has("collaboration")&&d!==s||d!==null&&wi(d))return;if(!U(e)){n!==null&&xr(t,l,c)&&r.removeAllRanges();return}const f=e.anchor,h=e.focus,g=f.key,p=h.key,_=Ro(t,g),y=Ro(t,p),m=f.offset,T=h.offset,N=e.format,C=e.style,S=e.isCollapsed();let E=_,v=y,O=!1;if(f.type==="text"){E=Ao(_);const M=f.getNode();O=M.getFormat()!==N||M.getStyle()!==C}else U(n)&&n.anchor.type==="text"&&(O=!0);if(h.type==="text"&&(v=Ao(y)),!(E===null||v===null)&&(S&&(n===null||O||U(n)&&(n.format!==N||n.style!==C))&&cm(N,C,m,g,performance.now()),!(a===m&&u===T&&l===E&&c===v&&!(r.type==="Range"&&S)&&((d===null||!s.contains(d))&&s.focus({preventScroll:!0}),f.type!=="element")))){try{r.setBaseAndExtent(E,m,v,T)}catch(M){console.warn(M)}if(!o.has("skip-scroll-into-view")&&e.isCollapsed()&&s!==null&&s===document.activeElement){const M=e instanceof It&&e.anchor.type==="element"?E.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(M!==null){let I;if(M instanceof Text){const J=document.createRange();J.selectNode(M),I=J.getBoundingClientRect()}else I=M.getBoundingClientRect();E_(t,I,s)}}lm()}}function Pm(n){let e=re()||Dn();e===null&&(e=Be().selectEnd()),e.insertNodes(n)}function Rm(){const n=re();return n===null?"":n.getTextContent()}function il(n){let e=n;n.isCollapsed()||e.removeText();const t=re();if(U(t)&&(e=t),!U(e))throw Error("Unexpected dirty selection to be null");const r=e.anchor;let o=r.getNode(),s=r.offset;for(;!Cn(o);)[o,s]=$m(o,s);return s}function $m(n,e){const t=n.getParent();if(!t){const o=Nt();return Be().append(o),o.select(),[Be(),0]}if(B(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(!w(n)||e===0)return[t,n.getIndexWithinParent()];const r=n.getChildAtIndex(e);if(r){const o=new It(Ge(n.__key,e,"element"),Ge(n.__key,e,"element"),0,""),s=n.insertNewAfter(o);s&&s.append(r,...r.getNextSiblings())}return[t,n.getIndexWithinParent()+1]}function Im(n){const e=Nt();let t=null;for(let r=0;r<n.length;r++){const o=n[r],s=on(o);if(s||le(o)&&o.isInline()||w(o)&&o.isInline()||B(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 ge=null,Te=null,Re=!1,ll=!1,Qo=0;const Cu={characterData:!0,childList:!0,subtree:!0};function Mn(){return Re||ge!==null&&ge._readOnly}function be(){if(Re)throw Error("Cannot use method in read-only mode.")}function Su(){if(Qo>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 at(){if(ge===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().${Eu()}`);return ge}function ie(){if(Te===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().${Eu()}`);return Te}function Eu(){let n=0;const e=new Set,t=ts.version;if(typeof window<"u")for(const o of document.querySelectorAll("[contenteditable]")){const s=Nr(o);if(Mo(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 Lm(){return Te}function Fm(){return ge}function vu(n,e,t){const r=e.__type,o=Rp(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 Ou(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function Bm(n,e){const t=e._dirtyLeaves,r=n._nodeMap;for(const o of t){const s=r.get(o);B(s)&&s.isAttached()&&s.isSimpleText()&&!s.isUnmergeable()&&_a(s)}}function Km(n,e){const t=e._dirtyLeaves,r=e._dirtyElements,o=n._nodeMap,s=At(),i=new Map;let l=t,c=l.size,a=r,u=a.size;for(;c>0||u>0;){if(c>0){e._dirtyLeaves=new Set;for(const d of l){const f=o.get(d);B(f)&&f.isAttached()&&f.isSimpleText()&&!f.isUnmergeable()&&_a(f),f!==void 0&&Ou(f,s)&&vu(e,f,i),t.add(d)}if(l=e._dirtyLeaves,c=l.size,c>0){Qo++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map;for(const d of a){const f=d[0],h=d[1];if(f!=="root"&&!h)continue;const g=o.get(f);g!==void 0&&Ou(g,s)&&vu(e,g,i),r.set(f,h)}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,u=a.size,Qo++}e._dirtyLeaves=t,e._dirtyElements=r}function zm(n){return cl(n,ie()._nodes)}function cl(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(w(s)&&Array.isArray(i))for(let l=0;l<i.length;l++){const c=i[l],a=cl(c,e);s.append(a)}return s}function Wm(n,e,t){const r=ul(),o=ge,s=Re,i=Te,l=e._dirtyElements,c=e._dirtyLeaves,a=e._cloneNotNeeded,u=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._cloneNotNeeded=new Set,e._dirtyType=0,ge=r,Re=!1,Te=e;try{const d=e._nodes,f=n.root;cl(f,d),t&&t(),r._readOnly=!0,wu(r)}catch(d){d instanceof Error&&e._onError(d)}finally{e._dirtyElements=l,e._dirtyLeaves=c,e._cloneNotNeeded=a,e._dirtyType=u,ge=o,Re=s,Te=i}return r}function bu(n,e,t){const r=ge,o=Re,s=Te;ge=e,Re=!0,Te=n;try{return t()}finally{ge=r,Re=o,Te=s}}function wu(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 Lt(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!==Qt,a=ge,u=Re,d=Te,f=n._updating,h=n._observer;let g=null;if(n._pendingEditorState=null,n._editorState=t,!o&&c&&h!==null){Te=n,ge=t,Re=!1,n._updating=!0;try{const S=n._dirtyType,E=n._dirtyElements,v=n._dirtyLeaves;h.disconnect(),g=V_(s,t,n,S,E,v)}catch(S){if(S instanceof Error&&n._onError(S),!ll)$u(n,null,r,t),ha(n),n._dirtyType=xn,ll=!0,Lt(n,s),ll=!1;else throw S;return}finally{h.observe(r,Cu),n._updating=f,ge=a,Re=u,Te=d}}t._readOnly||(t._readOnly=!0,wu(t),U(l)&&(Object.freeze(l.anchor),Object.freeze(l.focus)),Object.freeze(l));const p=n._dirtyLeaves,_=n._dirtyElements,y=n._normalizedNodes,m=n._updateTags,T=n._deferred;c&&(n._dirtyType=Qt,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements=new Map,n._normalizedNodes=new Set,n._updateTags=new Set),L_(n,t);const N=o?null:lt(n._window);if(n._editable&&N!==null&&(c||l===null||l.dirty)){Te=n,ge=t;try{if(h!==null&&h.disconnect(),c||l===null||l.dirty){const S=n._blockCursorElement;S!==null&&Fi(S,n,r),km(i,l,n,N,m,r)}k_(n,r,l),h!==null&&h.observe(r,Cu)}finally{Te=d,ge=a}}g!==null&&jm(n,g,m,p,s),!U(l)&&l!==null&&(i===null||!i.is(l))&&n.dispatchCommand(mo,void 0);const C=n._pendingDecorators;C!==null&&(n._decorators=C,n._pendingDecorators=null,Ir("decorator",n,!0,C)),Um(n,e||s,t),Ir("update",n,!0,{dirtyElements:_,dirtyLeaves:p,editorState:t,normalizedNodes:y,prevEditorState:e||s,tags:m}),Ym(n,T),Hm(n)}function Um(n,e,t){const r=Sa(e),o=Sa(t);r!==o&&Ir("textcontent",n,!0,o)}function jm(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],u=e.get(a);u!==void 0&&c(u,{dirtyLeaves:r,prevEditorState:o,updateTags:t})}}function Ir(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 Du(n,e,t){if(n._updating===!1||Te!==n){let o=!1;return n.update(()=>{o=Du(n,e,t)}),o}const r=Ai(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 u=Array.from(a),d=u.length;for(let f=0;f<d;f++)if(u[f](t,n)===!0)return!0}}}return!1}function Hm(n){const e=n._updates;if(e.length!==0){const t=e.shift();if(t){const[r,o]=t;Au(n,r,o)}}}function Ym(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 Mu(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 Au(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,u=!1;(a===null||a._readOnly)&&(a=n._pendingEditorState=Gm(a||c),u=!0),a._flushSync=l;const d=ge,f=Re,h=Te,g=n._updating;ge=a,Re=!1,n._updating=!0,Te=n;try{u&&(n._headless?c._selection!==null&&(a._selection=c._selection.clone()):a._selection=Dm(n));const _=n._compositionKey;e(),i=Mu(n,i),Am(a,n),n._dirtyType!==Qt&&(i?Bm(a,n):Km(a,n),Mu(n),F_(c,a,n._dirtyLeaves,n._dirtyElements));const y=n._compositionKey;_!==y&&(a._flushSync=!0);const m=a._selection;if(U(m)){const T=a._nodeMap,N=m.anchor.key,C=m.focus.key;if(T.get(N)===void 0||T.get(C)===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 $r(m)&&m._nodes.size===0&&(a._selection=null)}catch(_){_ instanceof Error&&n._onError(_),n._pendingEditorState=c,n._dirtyType=xn,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),Lt(n);return}finally{ge=d,Re=f,Te=h,n._updating=g,Qo=0}n._dirtyType!==Qt||Jm(a,n)?a._flushSync?(a._flushSync=!1,Lt(n)):u&&$p(()=>{Lt(n)}):(a._flushSync=!1,u&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function Ke(n,e,t){n._updating?n._updates.push([e,t]):Au(n,e,t)}class Lr extends Ho{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 Cp[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=ie()._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(B(t)&&e.push(t),w(t)){const r=t.getAllTextNodes();e.push(...r)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;w(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;w(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 w(s)&&s.getLastDescendant()||s||null}const o=t[e];return w(o)&&o.getFirstDescendant()||o||null}getFirstChild(){const t=this.getLatest().__first;return t===null?null:Se(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:Se(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(),w(s)&&o!==r-1&&!s.isInline()&&(e+=yt)}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(),w(s)&&o!==r-1&&!s.isInline()&&(e+=yt.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=ua[e];return(this.getFormat()&t)!==0}return!1}select(e,t){be();const r=re();let o=e,s=t;const i=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const c=this.getFirstChild();if(B(c)||w(c))return c.select(0,0)}else if((e===void 0||e===i)&&(t===void 0||t===i)){const c=this.getLastChild();if(B(c)||w(c))return c.select()}}o===void 0&&(o=i),s===void 0&&(s=i);const l=this.__key;if(U(r))r.anchor.set(l,o,"element"),r.focus.set(l,s,"element"),r.dirty=!0;else return Tu(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!==""?ua[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=[],u=this.getChildAtIndex(e+t);let d=null,f=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();tn(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&&f--,tn(_);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(u!==null){const g=u.getWritable();if(h!==null){const p=h.getWritable();g.__prev=h.__key,p.__next=u.__key}else g.__prev=null}if(i.__size=f,a.length){const g=re();if(U(g)){const p=new Set(a),_=new Set(c),{anchor:y,focus:m}=g;ku(y,p,_)&&Zo(y,y.getNode(),this,d,u),ku(m,p,_)&&Zo(m,m.getNode(),this,d,u),f===0&&!this.canBeEmpty()&&!kt(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 w(n){return n instanceof Lr}function ku(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 al extends Ho{constructor(e){super(e)}decorate(e,t){throw Error("decorate: base method not extended")}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function le(n){return n instanceof al}class An extends Lr{static getType(){return"root"}static clone(){return new An}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){throw Error("getTopLevelElementOrThrow: root nodes are not top level elements")}getTextContent(){const e=this.__cachedText;return(Mn()||ie()._dirtyType===Qt)&&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(!w(r)&&!le(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=Be();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 Vm(){return new An}function $e(n){return n instanceof An}function Jm(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 Gm(n){return new es(new Map(n._nodeMap))}function ul(){return new es(new Map([["root",Vm()]]))}function Pu(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(w(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=Pu(i);r.push(l)}}return e}class es{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 bu(t&&t.editor||null,this,e)}clone(e){const t=new es(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return bu(null,this,()=>({root:Pu(Be())}))}}let Ru=class extends Lr{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}};class sn extends Lr{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=st[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 sn(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),r=Or(e.theme,"paragraph");return r!==void 0&&t.classList.add(...r),t}updateDOM(e,t,r){return!1}static importDOM(){return{p:e=>({conversion:qm,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Fo(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=Nt();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=Nt();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||B(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 qm(n){const e=Nt();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 Nt(){return br(new sn)}function fl(n){return n instanceof sn}const Xm=!0,Zm=0,Qm=1,ey=2,ty=3,ny=4;function $u(n,e,t,r){const o=n._keyToDOMMap;o.clear(),n._editorState=ul(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=Qt,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 ry(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 oy(n){const e=n||{},t=Lm(),r=e.theme||{},o=n===void 0?t:e.parentEditor||null,s=e.disableEvents||!1,i=ul(),l=e.namespace||(o!==null?o._config.namespace:ba()),c=e.editorState,a=[An,bn,vn,wn,sn,Ru,...e.nodes||[]],{onError:u,html:d}=e,f=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 S=_;_=S.replace,y=S.with,m=S.withKlass||null}{const S=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"&&S!=="root"&&S!=="artificial"){const v=_.prototype;["getType","clone"].forEach(O=>{_.hasOwnProperty(O)||console.warn(`${E} must implement static "${O}" 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`),v instanceof al&&(v.hasOwnProperty("decorate")||console.warn(`${v.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`),v.hasOwnProperty("exportJSON")||console.warn(`${E} should implement "exportJSON" method to ensure JSON and default HTML serialization works as expected`)}}const T=_.getType(),N=_.transform(),C=new Set;N!==null&&C.add(N),h.set(T,{exportDOM:d&&d.export?d.export.get(_):void 0,klass:_,replace:y,replaceWithKlass:m,transforms:C})}}const g=new ts(i,o,h,{disableEvents:s,namespace:l,theme:r},u||console.error,ry(h,d?d.import:void 0),f);return c!==void 0&&(g._pendingEditorState=c,g._dirtyType=xn),g}class ts{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=Qt,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=ba(),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?Xm: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=Ba(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 Up(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 P(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=Or(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=e,$u(this,t,e,o),t!==null&&(this._config.disableEvents||sm(t),r!=null&&t.classList.remove(...r)),e!==null){const s=w_(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=xn,ha(this),this._updateTags.add("history-merge"),Lt(this),this._config.disableEvents||om(e,this),r!=null&&e.classList.add(...r)}else this._editorState=o,this._pendingEditorState=null,this._window=null;Ir("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.");da(this);const r=this._pendingEditorState,o=this._updateTags,s=t!==void 0?t.tag:null;r!==null&&!r.isEmpty()&&(s!=null&&o.add(s),Lt(this)),this._pendingEditorState=e,this._dirtyType=xn,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&o.add(s),Lt(this)}parseEditorState(e,t){const r=typeof e=="string"?JSON.parse(e):e;return Wm(r,this,t)}read(e){return Lt(this),this.getEditorState().read(e,{editor:this})}update(e,t){Ke(this,e,t)}focus(e,t={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),Ke(this,()=>{const o=re(),s=Be();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=lt(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Ir("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}ts.version="0.17.1+dev.esm";const sy=Object.freeze(Object.defineProperty({__proto__:null,$addUpdateTag:O_,$applyNodeReplacement:br,$cloneWithProperties:Ka,$copyNode:Ia,$createLineBreakNode:On,$createNodeSelection:sl,$createParagraphNode:Nt,$createPoint:Ge,$createRangeSelection:wm,$createRangeSelectionFromDom:Mm,$createTabNode:Jo,$createTextNode:Ee,$getAdjacentNode:$i,$getCharacterOffsets:ol,$getEditor:$_,$getNearestNodeFromDOMNode:Cr,$getNearestRootOrShadowRoot:$a,$getNodeByKey:Se,$getNodeByKeyOrThrow:M_,$getPreviousSelection:Dn,$getRoot:Be,$getSelection:re,$getTextContent:Rm,$hasAncestor:Io,$hasUpdateTag:v_,$insertNodes:Pm,$isBlockElementNode:bm,$isDecoratorNode:le,$isElementNode:w,$isInlineElementOrDecoratorNode:D_,$isLeafNode:Bp,$isLineBreakNode:on,$isNodeSelection:$r,$isParagraphNode:fl,$isRangeSelection:U,$isRootNode:$e,$isRootOrShadowRoot:kt,$isTabNode:fu,$isTextNode:B,$isTokenOrSegmented:en,$nodesOfType:S_,$normalizeSelection__EXPERIMENTAL:ma,$parseSerializedNode:zm,$selectAll:C_,$setCompositionKey:ye,$setSelection:it,$splitNode:P_,ArtificialNode__DO_NOT_USE:Ru,BLUR_COMMAND:ta,CAN_REDO_COMMAND:hp,CAN_UNDO_COMMAND:gp,CLEAR_EDITOR_COMMAND:fp,CLEAR_HISTORY_COMMAND:dp,CLICK_COMMAND:Lc,COMMAND_PRIORITY_CRITICAL:ny,COMMAND_PRIORITY_EDITOR:Zm,COMMAND_PRIORITY_HIGH:ty,COMMAND_PRIORITY_LOW:Qm,COMMAND_PRIORITY_NORMAL:ey,CONTROLLED_TEXT_INSERTION_COMMAND:Tn,COPY_COMMAND:fi,CUT_COMMAND:di,DELETE_CHARACTER_COMMAND:hr,DELETE_LINE_COMMAND:_r,DELETE_WORD_COMMAND:pr,DRAGEND_COMMAND:Qc,DRAGOVER_COMMAND:Zc,DRAGSTART_COMMAND:Xc,DROP_COMMAND:qc,DecoratorNode:al,ElementNode:Lr,FOCUS_COMMAND:ea,FORMAT_ELEMENT_COMMAND:up,FORMAT_TEXT_COMMAND:wt,INDENT_CONTENT_COMMAND:cp,INSERT_LINE_BREAK_COMMAND:gr,INSERT_PARAGRAPH_COMMAND:ii,INSERT_TAB_COMMAND:lp,IS_ALL_FORMATTING:ia,IS_BOLD:No,IS_CODE:So,IS_HIGHLIGHT:Oo,IS_ITALIC:Co,IS_STRIKETHROUGH:yr,IS_SUBSCRIPT:Eo,IS_SUPERSCRIPT:vo,IS_UNDERLINE:Tr,KEY_ARROW_DOWN_COMMAND:jc,KEY_ARROW_LEFT_COMMAND:zc,KEY_ARROW_RIGHT_COMMAND:Bc,KEY_ARROW_UP_COMMAND:Uc,KEY_BACKSPACE_COMMAND:Yc,KEY_DELETE_COMMAND:Jc,KEY_DOWN_COMMAND:Fc,KEY_ENTER_COMMAND:yo,KEY_ESCAPE_COMMAND:Vc,KEY_MODIFIER_COMMAND:na,KEY_SPACE_COMMAND:Hc,KEY_TAB_COMMAND:Gc,LineBreakNode:vn,MOVE_TO_END:Kc,MOVE_TO_START:Wc,OUTDENT_CONTENT_COMMAND:ap,PASTE_COMMAND:li,ParagraphNode:sn,REDO_COMMAND:ui,REMOVE_TEXT_COMMAND:ci,RootNode:An,SELECTION_CHANGE_COMMAND:mo,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:ip,SELECT_ALL_COMMAND:hi,TEXT_TYPE_TO_FORMAT:st,TabNode:wn,TextNode:bn,UNDO_COMMAND:ai,createCommand:H,createEditor:oy,getEditorPropertyFromDOMNode:Nr,getNearestEditorFromDOMNode:Di,isBlockDomNode:Bi,isCurrentlyReadOnlyMode:Mn,isHTMLAnchorElement:R_,isHTMLElement:Fo,isInlineDomNode:La,isLexicalEditor:Mo,isSelectionCapturedInDecoratorInput:wi,isSelectionWithinEditor:xr,resetRandomKey:kp},Symbol.toStringTag,{value:"Module"}));function iy(n){return{}}const ns={},ly={},Iu={},Fr={},Br={},dl={},kn={},hl={},gl={},Kr={},zr={},Ft={},pl={},_l={},Lu={},Fu={},Bu={},Ku={},zu={},Wu={},Uu={},rs={},ju={},Hu={},Yu={},Vu={},Ju={},cy={},ay={},uy={},Gu={},fy={},qu={},Xu={},Zu={},ml={},yl={},Tl={},dy={},hy={},gy={},py={},Qu={},ef={},tf={},qe=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,_y=qe&&"documentMode"in document?document.documentMode:null,Xe=qe&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Bt=qe&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),os=!(!qe||!("InputEvent"in window)||_y)&&"getTargetRanges"in new window.InputEvent("input"),xl=qe&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ss=qe&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,my=qe&&/Android/.test(navigator.userAgent),nf=qe&&/^(?=.*Chrome).*/i.test(navigator.userAgent),yy=qe&&my&&nf,Nl=qe&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!nf,Wr=1,Kt=3,ln=0,rf=1,Pn=2,Ty=0,xy=1,Ny=2,Cy=1,Sy=2,Ur=4,jr=8,Ey=16,vy=32,Oy=64,is=128,of=112|(3|Ur|jr)|is,Cl=1,Sl=2,El=3,vl=4,Ol=5,bl=6,ls=xl||ss||Nl?" ":"",Ct=`
|
|
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
|
-
`,by=Bt?" ":ls,sf="֑-߿יִ-﷽ﹰ-ﻼ",lf="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",wy=new RegExp("^[^"+lf+"]*["+sf+"]"),Dy=new RegExp("^[^"+sf+"]*["+lf+"]"),ut={bold:1,code:16,highlight:is,italic:2,strikethrough:Ur,subscript:32,superscript:64,underline:jr},My={directionless:1,unmergeable:2},cf={center:Sl,end:bl,justify:vl,left:Cl,right:El,start:Ol},Ay={[Sl]:"center",[bl]:"end",[vl]:"justify",[Cl]:"left",[El]:"right",[Ol]:"start"},ky={normal:0,segmented:2,token:1},Py={[Ty]:"normal",[Ny]:"segmented",[xy]:"token"};function Ry(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var A=Ry(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 cs(...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 $y=100;let wl=!1,Dl=0;function Iy(n){Dl=n.timeStamp}function Ml(n,e,t){return e.__lexicalLineBreak===n||n[`__lexicalKey_${t._key}`]!==void 0}function Ly(n,e,t){const r=dt(t._window);let o=null,s=null;r!==null&&r.anchorNode===n&&(o=r.anchorOffset,s=r.focusOffset);const i=n.nodeValue;i!==null&&Il(e,i,o,s,!1)}function Fy(n,e,t){if(j(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return e.nodeType===Kt&&t.isAttached()}function af(n,e,t){wl=!0;const r=performance.now()-Dl>$y;try{We(n,()=>{const o=oe()||function(f){return f.getEditorState().read(()=>{const h=oe();return h!==null?h.clone():null})}(n),s=new Map,i=n.getRootElement(),l=n._editorState,c=n._blockCursorElement;let a=!1,u="";for(let f=0;f<e.length;f++){const h=e[f],g=h.type,p=h.target;let _=Vr(p,l);if(!(_===null&&p!==i||ae(_))){if(g==="characterData")r&&K(_)&&Fy(o,p,_)&&Ly(p,_,n);else if(g==="childList"){a=!0;const y=h.addedNodes;for(let N=0;N<y.length;N++){const C=y[N],S=Tf(C),E=C.parentNode;if(E!=null&&C!==c&&S===null&&(C.nodeName!=="BR"||!Ml(C,E,n))){if(Bt){const v=C.innerText||C.nodeValue;v&&(u+=v)}E.removeChild(C)}}const m=h.removedNodes,T=m.length;if(T>0){let N=0;for(let C=0;C<T;C++){const S=m[C];(S.nodeName==="BR"&&Ml(S,p,n)||c===S)&&(p.appendChild(S),N++)}T!==N&&(p===i&&(_=Cf(l)),s.set(p,_))}}}}if(s.size>0)for(const[f,h]of s)if(D(h)){const g=h.getChildrenKeys();let p=f.firstChild;for(let _=0;_<g.length;_++){const y=g[_],m=n.getElementByKey(y);m!==null&&(p==null?(f.appendChild(m),p=m):p!==m&&f.replaceChild(m,p),p=p.nextSibling)}}else K(h)&&h.markDirty();const d=t.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){const h=d[f],g=h.addedNodes,p=h.target;for(let _=0;_<g.length;_++){const y=g[_],m=y.parentNode;m==null||y.nodeName!=="BR"||Ml(y,p,n)||m.removeChild(y)}}t.takeRecords()}o!==null&&(a&&(o.dirty=!0,ft(o)),Bt&&kf(n)&&o.insertRawText(u))})}finally{wl=!1}}function uf(n){const e=n._observer;e!==null&&af(n,e.takeRecords(),e)}function ff(n){(function(e){Dl===0&&_s(e).addEventListener("textInput",Iy,!0)})(n),n._observer=new MutationObserver((e,t)=>{af(n,e,t)})}function df(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 hf(n,e){const t=n.mergeWithSibling(e),r=ce()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function gf(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&K(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(df(e,r)){r=hf(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&K(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(df(r,t)){r=hf(r,t);break}break}t.remove()}}else r.remove()}function pf(n){return _f(n.anchor),_f(n.focus),n}function _f(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),K(r)){n.set(r.__key,o?r.getTextContentSize():0,"text");break}if(!D(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element")}}let mf=1;function By(){mf=1}const Ky=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function Al(n){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return ae(Vr(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&Yr(e)==null)}function Hr(n,e,t){const r=n.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(t)&&e!==null&&!Al(e)&&kl(e)===n}catch{return!1}}function as(n){return n instanceof Rs}function kl(n){let e=n;for(;e!=null;){const t=Yr(e);if(as(t))return t;e=gs(e)}return null}function Yr(n){return n?n.__lexicalEditor:null}function cn(n){return n.isToken()||n.isSegmented()}function zy(n){return n.nodeType===Kt}function us(n){let e=n;for(;e!=null;){if(zy(e))return e;e=e.firstChild}return null}function Pl(n,e,t){const r=ut[e];if(t!==null&&(n&r)==(t&r))return n;let o=n^r;return e==="subscript"?o&=~ut.superscript:e==="superscript"&&(o&=~ut.subscript),o}function Wy(n){return K(n)||dn(n)||ae(n)}function yf(n,e){if(e!=null)return void(n.__key=e);ke(),Nd();const t=ce(),r=gt(),o=""+mf++;r._nodeMap.set(o,n),D(n)?t._dirtyElements.set(o,!0):t._dirtyLeaves.add(o),t._cloneNotNeeded.add(o),t._dirtyType=rf,n.__key=o}function an(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 fs(n){Nd();const e=n.getLatest(),t=e.__parent,r=gt(),o=ce(),s=r._nodeMap,i=o._dirtyElements;t!==null&&function(c,a,u){let d=c;for(;d!==null;){if(u.has(d))return;const f=a.get(d);if(f===void 0)break;u.set(d,!1),d=f.__parent}}(t,s,i);const l=e.__key;o._dirtyType=rf,D(n)?i.set(l,!0):o._dirtyLeaves.add(l)}function xe(n){ke();const e=ce(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const r=ve(t);r!==null&&r.getWritable()}if(n!==null){const r=ve(n);r!==null&&r.getWritable()}}}function zt(){return Wn()?null:ce()._compositionKey}function ve(n,e){const t=(e||gt())._nodeMap.get(n);return t===void 0?null:t}function Tf(n,e){const t=n[`__lexicalKey_${ce()._key}`];return t!==void 0?ve(t,e):null}function Vr(n,e){let t=n;for(;t!=null;){const r=Tf(t,e);if(r!==null)return r;t=gs(t)}return null}function xf(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function Nf(n){return n.read(()=>ze().getTextContent())}function ze(){return Cf(gt())}function Cf(n){return n._nodeMap.get("root")}function ft(n){ke();const e=gt();n!==null&&(n.dirty=!0,n.setCachedNodes(null)),e._selection=n}function Rn(n){const e=ce(),t=function(r,o){let s=r;for(;s!=null;){const i=s[`__lexicalKey_${o._key}`];if(i!==void 0)return i;s=gs(s)}return null}(n,e);return t===null?n===e.getRootElement()?ve("root"):null:ve(t)}function Sf(n,e){return e?n.getTextContentSize():0}function Ef(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function Rl(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function vf(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Of(n){return n.nodeType===Kt?n.nodeValue:null}function $l(n,e,t){const r=dt(e._window);if(r===null)return;const o=r.anchorNode;let{anchorOffset:s,focusOffset:i}=r;if(o!==null){let l=Of(o);const c=Vr(o);if(l!==null&&K(c)){if(l===ls&&t){const a=t.length;l=t,s=a,i=a}l!==null&&Il(c,l,s,i,n)}}}function Il(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]===ls&&(l=e.slice(0,-1));const c=s.getTextContent();if(o||l!==c){if(l===""){if(xe(null),xl||ss||Nl)s.remove();else{const p=ce();setTimeout(()=>{p.update(()=>{s.isAttached()&&s.remove()})},20)}return}const a=s.getParent(),u=zn(),d=s.getTextContentSize(),f=zt(),h=s.getKey();if(s.isToken()||f!==null&&h===f&&!i||j(u)&&(a!==null&&!a.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===n.__key&&u.anchor.offset===0&&!s.canInsertTextBefore()&&!i||u.focus.key===n.__key&&u.focus.offset===d&&!s.canInsertTextAfter()&&!i))return void s.markDirty();const g=oe();if(!j(g)||t===null||r===null)return void s.setTextContent(l);if(g.setTextNodeRange(s,t,s,r),s.isSegmented()){const p=Oe(s.getTextContent());s.replace(p),s=p}s.setTextContent(l)}}}function Uy(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(K(i)||D(i)&&i.isInline())&&!i.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||o)}function bf(n){return n==="ArrowLeft"}function wf(n){return n==="ArrowRight"}function Jr(n,e){return Xe?n:e}function Df(n){return n==="Enter"}function Gr(n){return n==="Backspace"}function qr(n){return n==="Delete"}function Mf(n,e,t){return n.toLowerCase()==="a"&&Jr(e,t)}function jy(){const n=ze();ft(pf(n.select(0,n.getChildrenSize())))}function Xr(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=cs(o);return t[e]=s,s}return o}function Ll(n,e,t,r,o){if(t.size===0)return;const s=r.__type,i=r.__key,l=e.get(s);l===void 0&&A(33,s);const c=l.klass;let a=n.get(c);a===void 0&&(a=new Map,n.set(c,a));const u=a.get(i),d=u==="destroyed"&&o==="created";(u===void 0||d)&&a.set(i,d?"updated":o)}function Hy(n){const e=n.getType(),t=gt();if(t._readOnly){const s=Lf(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 Af(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 Fl(n,e){const t=n.offset;if(n.type==="element")return Af(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?Af(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):o}}return null}function kf(n){const e=_s(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function R(n,e,t){return Od(n,e,t)}function ds(n){return!Le(n)&&!n.isLastChild()&&!n.isInline()}function hs(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&A(75,e),t}function gs(n){const e=n.assignedSlot||n.parentElement;return e!==null&&e.nodeType===11?e.host:e}function Yy(n){return ce()._updateTags.has(n)}function Vy(n){ke(),ce()._updateTags.add(n)}function ps(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function _s(n){const e=n._window;return e===null&&A(78),e}function Jy(n){return D(n)&&n.isInline()||ae(n)&&n.isInline()}function Pf(n){let e=n.getParentOrThrow();for(;e!==null;){if(Wt(e))return e;e=e.getParentOrThrow()}return e}function Wt(n){return Le(n)||D(n)&&n.isShadowRoot()}function Rf(n){const e=n.constructor.clone(n);return yf(e,null),e}function Zr(n){const e=ce(),t=n.constructor.getType(),r=e._nodes.get(t);r===void 0&&A(97);const o=r.replace;if(o!==null){const s=o(n);return s instanceof n.constructor||A(98),s}return n}function Bl(n,e){!Le(n.getParent())||D(e)||ae(e)||A(99)}function Gy(n){const e=ve(n);return e===null&&A(63,n),e}function Kl(n){return(ae(n)||D(n)&&!n.canBeEmpty())&&!n.isInline()}function zl(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function qy(n,e,t){let r=n._blockCursorElement;if(j(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())Kl(s.getChildAtIndex(i-1))&&(l=!0);else{const a=s.getChildAtIndex(i);if(Kl(a)){const u=a.getPreviousSibling();(u===null||Kl(u))&&(l=!0,c=n.getElementByKey(a.__key))}}if(l){const a=n.getElementByKey(s.__key);return r===null&&(n._blockCursorElement=r=function(u){const d=u.theme,f=document.createElement("div");f.contentEditable="false",f.setAttribute("data-lexical-cursor","true");let h=d.blockCursor;if(h!==void 0){if(typeof h=="string"){const g=cs(h);h=d.blockCursor=g}h!==void 0&&f.classList.add(...h)}return f}(n._config)),e.style.caretColor="transparent",void(c===null?a.appendChild(r):a.insertBefore(r,c))}}r!==null&&zl(r,n,e)}function dt(n){return qe?(n||window).getSelection():null}function Xy(n,e){let t=n.getChildAtIndex(e);t==null&&(t=n),Wt(n)&&A(102);const r=i=>{const l=i.getParentOrThrow(),c=Wt(l),a=i!==t||c?Rf(i):i;if(c)return D(i)&&D(a)||A(133),i.insertAfter(a),[i,a,a];{const[u,d,f]=r(l),h=i.getNextSiblings();return f.append(a,...h),[u,d,a]}},[o,s]=r(t);return[o,s]}function Zy(n){return ms(n)&&n.tagName==="A"}function ms(n){return n.nodeType===1}function $f(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 Wl(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 $n(n){if(Le(n)||ae(n)&&!n.isInline())return!0;if(!D(n)||Wt(n))return!1;const e=n.getFirstChild(),t=e===null||dn(e)||K(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function Ul(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function Qy(){return ce()}const If=new WeakMap,eT=new Map;function Lf(n){if(!n._readOnly&&n.isEmpty())return eT;n._readOnly||A(192);let e=If.get(n);if(!e){e=new Map,If.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 Ff(n){const e=n.constructor.clone(n);return e.afterCloneFrom(n),e}function Bf(n,e,t,r,o,s){let i=n.getFirstChild();for(;i!==null;){const l=i.__key;i.__parent===e&&(D(i)&&Bf(i,l,t,r,o,s),t.has(l)||s.delete(l),o.push(l)),i=i.getNextSibling()}}let Ut,Me,Qr,ys,jl,Hl,un,Ze,Yl,eo,pe="",Ae="",ht=null,Qe="",St="",Kf=!1,to=!1,Ts=null;function xs(n,e){const t=un.get(n);if(e!==null){const r=ql(n);r.parentNode===e&&e.removeChild(r)}if(Ze.has(n)||Me._keyToDOMMap.delete(n),D(t)){const r=Cs(t,un);Vl(r,0,r.length-1,null)}t!==void 0&&Ll(eo,Qr,ys,t,"destroyed")}function Vl(n,e,t,r){let o=e;for(;o<=t;++o){const s=n[o];s!==void 0&&xs(s,r)}}function fn(n,e){n.setProperty("text-align",e)}const tT="40px";function zf(n,e){const t=Ut.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")||tT;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${r})`)}function Wf(n,e){const t=n.style;e===0?fn(t,""):e===Cl?fn(t,"left"):e===Sl?fn(t,"center"):e===El?fn(t,"right"):e===vl?fn(t,"justify"):e===Ol?fn(t,"start"):e===bl&&fn(t,"end")}function Ns(n,e,t){const r=Ze.get(n);r===void 0&&A(60);const o=r.createDOM(Ut,Me);if(function(s,i,l){const c=l._keyToDOMMap;i["__lexicalKey_"+l._key]=s,c.set(s,i)}(n,o,Me),K(r)?o.setAttribute("data-lexical-text","true"):ae(r)&&o.setAttribute("data-lexical-decorator","true"),D(r)){const s=r.__indent,i=r.__size;if(s!==0&&zf(o,s),i!==0){const c=i-1;(function(a,u,d,f){const h=Ae;Ae="",Jl(a,d,0,u,f,null),Hf(d,f),Ae=h})(Cs(r,Ze),c,r,o)}const l=r.__format;l!==0&&Wf(o,l),r.isInline()||jf(null,r,o),ds(r)&&(pe+=Ct,St+=Ct)}else{const s=r.getTextContent();if(ae(r)){const i=r.decorate(Me,Ut);i!==null&&Yf(n,i),o.contentEditable="false"}else K(r)&&(r.isDirectionless()||(Ae+=s));pe+=s,St+=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 Ll(eo,Qr,ys,r,"created"),o}function Jl(n,e,t,r,o,s){const i=pe;pe="";let l=t;for(;l<=r;++l){Ns(n[l],o,s);const c=Ze.get(n[l]);c!==null&&K(c)&&(ht===null&&(ht=c.getFormat()),Qe===""&&(Qe=c.getStyle()))}ds(e)&&(pe+=Ct),o.__lexicalTextContent=pe,pe=i+pe}function Uf(n,e){const t=e.get(n);return dn(t)||ae(t)&&t.isInline()}function jf(n,e,t){const r=n!==null&&(n.__size===0||Uf(n.__last,un)),o=e.__size===0||Uf(e.__last,Ze);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 Hf(n,e){const t=e.__lexicalDirTextContent,r=e.__lexicalDir;if(t!==Ae||r!==Ts){const s=Ae==="",i=s?Ts:(o=Ae,wy.test(o)?"rtl":Dy.test(o)?"ltr":null);if(i!==r){const l=e.classList,c=Ut.theme;let a=r!==null?c[r]:void 0,u=i!==null?c[i]:void 0;if(a!==void 0){if(typeof a=="string"){const d=cs(a);a=c[r]=d}l.remove(...a)}if(i===null||s&&i==="ltr")e.removeAttribute("dir");else{if(u!==void 0){if(typeof u=="string"){const d=cs(u);u=c[i]=d}u!==void 0&&l.add(...u)}e.dir=i}to||(n.getWritable().__dir=i)}Ts=i,e.__lexicalDirTextContent=Ae,e.__lexicalDir=i}var o}function nT(n,e,t){const r=Ae;var o;Ae="",ht=null,Qe="",function(s,i,l){const c=pe,a=s.__size,u=i.__size;if(pe="",a===1&&u===1){const d=s.__first,f=i.__first;if(d===f)no(d,l);else{const g=ql(d),p=Ns(f,null,null);try{l.replaceChild(p,g)}catch(_){if(typeof _=="object"&&_!=null){const y=`${_.toString()} Parent: ${l.tagName}, new child: {tag: ${p.tagName} key: ${f}}, old child: {tag: ${g.tagName}, key: ${d}}.`;throw new Error(y)}throw _}xs(d,null)}const h=Ze.get(f);K(h)&&(ht===null&&(ht=h.getFormat()),Qe===""&&(Qe=h.getStyle()))}else{const d=Cs(s,un),f=Cs(i,Ze);if(a===0)u!==0&&Jl(f,i,0,u-1,l,null);else if(u===0){if(a!==0){const h=l.__lexicalLineBreak==null;Vl(d,0,a-1,h?null:l),h&&(l.textContent="")}}else(function(h,g,p,_,y,m){const T=_-1,N=y-1;let C,S,E=(M=m,M.firstChild),v=0,O=0;for(var M;v<=T&&O<=N;){const X=g[v],G=p[O];if(X===G)E=Gl(no(G,m)),v++,O++;else{C===void 0&&(C=new Set(g)),S===void 0&&(S=new Set(p));const me=S.has(X),Z=C.has(G);if(me)if(Z){const Xt=hs(Me,G);Xt===E?E=Gl(no(G,m)):(E!=null?m.insertBefore(Xt,E):m.appendChild(Xt),no(G,m)),v++,O++}else Ns(G,m,E),O++;else E=Gl(ql(X)),xs(X,m),v++}const ne=Ze.get(G);ne!==null&&K(ne)&&(ht===null&&(ht=ne.getFormat()),Qe===""&&(Qe=ne.getStyle()))}const I=v>T,J=O>N;if(I&&!J){const X=p[N+1];Jl(p,h,O,N,m,X===void 0?null:Me.getElementByKey(X))}else J&&!I&&Vl(g,v,T,m)})(i,d,f,a,u,l)}ds(i)&&(pe+=Ct),l.__lexicalTextContent=pe,pe=c+pe}(n,e,t),Hf(e,t),hc(o=e)&&ht!=null&&ht!==o.__textFormat&&!to&&(o.setTextFormat(ht),o.setTextStyle(Qe)),function(s){hc(s)&&Qe!==""&&Qe!==s.__textStyle&&!to&&s.setTextStyle(Qe)}(e),Ae=r}function Cs(n,e){const t=[];let r=n.__first;for(;r!==null;){const o=e.get(r);o===void 0&&A(101),t.push(r),r=o.__next}return t}function no(n,e){const t=un.get(n);let r=Ze.get(n);t!==void 0&&r!==void 0||A(61);const o=Kf||Hl.has(n)||jl.has(n),s=hs(Me,n);if(t===r&&!o){if(D(t)){const i=s.__lexicalTextContent;i!==void 0&&(pe+=i,St+=i);const l=s.__lexicalDirTextContent;l!==void 0&&(Ae+=l)}else{const i=t.getTextContent();K(t)&&!t.isDirectionless()&&(Ae+=i),St+=i,pe+=i}return s}if(t!==r&&o&&Ll(eo,Qr,ys,r,"updated"),r.updateDOM(t,s,Ut)){const i=Ns(n,null,null);return e===null&&A(62),e.replaceChild(i,s),xs(n,null),i}if(D(t)&&D(r)){const i=r.__indent;i!==t.__indent&&zf(s,i);const l=r.__format;l!==t.__format&&Wf(s,l),o&&(nT(t,r,s),Le(r)||r.isInline()||jf(t,r,s)),ds(r)&&(pe+=Ct,St+=Ct)}else{const i=r.getTextContent();if(ae(r)){const l=r.decorate(Me,Ut);l!==null&&Yf(n,l)}else K(r)&&!r.isDirectionless()&&(Ae+=i);pe+=i,St+=i}if(!to&&Le(r)&&r.__cachedText!==St){const i=r.getWritable();i.__cachedText=St,r=i}return s}function Yf(n,e){let t=Me._pendingDecorators;const r=Me._decorators;if(t===null){if(r[n]===e)return;t=xf(Me)}t[n]=e}function Gl(n){let e=n.nextSibling;return e!==null&&e===Me._blockCursorElement&&(e=e.nextSibling),e}function rT(n,e,t,r,o,s){pe="",St="",Ae="",Kf=r===Pn,Ts=null,Me=t,Ut=t._config,Qr=t._nodes,ys=Me._listeners.mutation,jl=o,Hl=s,un=n._nodeMap,Ze=e._nodeMap,to=e._readOnly,Yl=new Map(t._keyToDOMMap);const i=new Map;return eo=i,no("root",null),Me=void 0,Qr=void 0,jl=void 0,Hl=void 0,un=void 0,Ze=void 0,Ut=void 0,Yl=void 0,eo=void 0,i}function ql(n){const e=Yl.get(n);return e===void 0&&A(75,n),e}const Et=Object.freeze({}),Xl=30,Zl=[["keydown",function(n,e){if(ro=n.timeStamp,Vf=n.key,e.isComposing())return;const{key:t,shiftKey:r,ctrlKey:o,metaKey:s,altKey:i}=n;R(e,Lu,n)||t!=null&&(function(l,c,a,u){return wf(l)&&!c&&!u&&!a}(t,o,i,s)?R(e,Fu,n):function(l,c,a,u,d){return wf(l)&&!u&&!a&&(c||d)}(t,o,r,i,s)?R(e,Bu,n):function(l,c,a,u){return bf(l)&&!c&&!u&&!a}(t,o,i,s)?R(e,Ku,n):function(l,c,a,u,d){return bf(l)&&!u&&!a&&(c||d)}(t,o,r,i,s)?R(e,zu,n):function(l,c,a){return function(u){return u==="ArrowUp"}(l)&&!c&&!a}(t,o,s)?R(e,Wu,n):function(l,c,a){return function(u){return u==="ArrowDown"}(l)&&!c&&!a}(t,o,s)?R(e,Uu,n):function(l,c){return Df(l)&&c}(t,r)?(oo=!0,R(e,rs,n)):function(l){return l===" "}(t)?R(e,ju,n):function(l,c){return Xe&&c&&l.toLowerCase()==="o"}(t,o)?(n.preventDefault(),oo=!0,R(e,Br,!0)):function(l,c){return Df(l)&&!c}(t,r)?(oo=!1,R(e,rs,n)):function(l,c,a,u){return Xe?!c&&!a&&(Gr(l)||l.toLowerCase()==="h"&&u):!(u||c||a)&&Gr(l)}(t,i,s,o)?Gr(t)?R(e,Hu,n):(n.preventDefault(),R(e,Fr,!0)):function(l){return l==="Escape"}(t)?R(e,Yu,n):function(l,c,a,u,d){return Xe?!(a||u||d)&&(qr(l)||l.toLowerCase()==="d"&&c):!(c||u||d)&&qr(l)}(t,o,r,i,s)?qr(t)?R(e,Vu,n):(n.preventDefault(),R(e,Fr,!1)):function(l,c,a){return Gr(l)&&(Xe?c:a)}(t,i,o)?(n.preventDefault(),R(e,Kr,!0)):function(l,c,a){return qr(l)&&(Xe?c:a)}(t,i,o)?(n.preventDefault(),R(e,Kr,!1)):function(l,c){return Xe&&c&&Gr(l)}(t,s)?(n.preventDefault(),R(e,zr,!0)):function(l,c){return Xe&&c&&qr(l)}(t,s)?(n.preventDefault(),R(e,zr,!1)):function(l,c,a,u){return l.toLowerCase()==="b"&&!c&&Jr(a,u)}(t,i,s,o)?(n.preventDefault(),R(e,Ft,"bold")):function(l,c,a,u){return l.toLowerCase()==="u"&&!c&&Jr(a,u)}(t,i,s,o)?(n.preventDefault(),R(e,Ft,"underline")):function(l,c,a,u){return l.toLowerCase()==="i"&&!c&&Jr(a,u)}(t,i,s,o)?(n.preventDefault(),R(e,Ft,"italic")):function(l,c,a,u){return l==="Tab"&&!c&&!a&&!u}(t,i,o,s)?R(e,Ju,n):function(l,c,a,u){return l.toLowerCase()==="z"&&!c&&Jr(a,u)}(t,r,s,o)?(n.preventDefault(),R(e,pl,void 0)):function(l,c,a,u){return Xe?l.toLowerCase()==="z"&&a&&c:l.toLowerCase()==="y"&&u||l.toLowerCase()==="z"&&u&&c}(t,r,s,o)?(n.preventDefault(),R(e,_l,void 0)):io(e._editorState._selection)?function(l,c,a,u){return!c&&l.toLowerCase()==="c"&&(Xe?a:u)}(t,r,s,o)?(n.preventDefault(),R(e,ml,n)):function(l,c,a,u){return!c&&l.toLowerCase()==="x"&&(Xe?a:u)}(t,r,s,o)?(n.preventDefault(),R(e,yl,n)):Mf(t,s,o)&&(n.preventDefault(),R(e,Tl,n)):!Bt&&Mf(t,s,o)&&(n.preventDefault(),R(e,Tl,n)),function(l,c,a,u){return l||c||a||u}(o,r,i,s)&&R(e,tf,n))}],["pointerdown",function(n,e){const t=n.target,r=n.pointerType;t instanceof Node&&r!=="touch"&&We(e,()=>{ae(Vr(t))||(ec=!0)})}],["compositionstart",function(n,e){We(e,()=>{const t=oe();if(j(t)&&!e.isComposing()){const r=t.anchor,o=t.anchor.getNode();xe(r.key),(n.timeStamp<ro+Xl||r.type==="element"||!t.isCollapsed()||o.getFormat()!==t.format||K(o)&&o.getStyle()!==t.style)&&R(e,kn,by)}})}],["compositionend",function(n,e){Bt?so=!0:We(e,()=>{tc(e,n.data)})}],["input",function(n,e){n.stopPropagation(),We(e,()=>{const t=oe(),r=n.data,o=Qf(n);if(r!=null&&j(t)&&qf(t,o,r,n.timeStamp,!1)){so&&(tc(e,r),so=!1);const s=t.anchor.getNode(),i=dt(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;os&&!t.isCollapsed()&&K(s)&&i.anchorNode!==null&&s.getTextContent().slice(0,c)+r+s.getTextContent().slice(c+a)===Of(i.anchorNode)||R(e,kn,r);const u=r.length;Bt&&u>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=u),xl||ss||Nl||!e.isComposing()||(ro=0,xe(null))}else $l(!1,e,r!==null?r:void 0),so&&(tc(e,r||void 0),so=!1);ke(),uf(ce())}),In=null}],["click",function(n,e){We(e,()=>{const t=oe(),r=dt(e._window),o=zn();if(r){if(j(t)){const s=t.anchor,i=s.getNode();s.type==="element"&&s.offset===0&&t.isCollapsed()&&!Le(i)&&ze().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&o!==null&&t.is(o)?(r.removeAllRanges(),t.dirty=!0):n.detail===3&&!t.isCollapsed()&&i!==t.focus.getNode()&&(D(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===Wr||i===Kt)&&ft(Ds(o,r,e,n))}}}R(e,Iu,n)})}],["cut",Et],["copy",Et],["dragstart",Et],["dragover",Et],["dragend",Et],["paste",Et],["focus",Et],["blur",Et],["drop",Et]];os&&Zl.push(["beforeinput",(n,e)=>function(t,r){const o=t.inputType,s=Qf(t);o==="deleteCompositionText"||Bt&&kf(r)||o!=="insertCompositionText"&&We(r,()=>{const i=oe();if(o==="deleteContentBackward"){if(i===null){const h=zn();if(!j(h))return;ft(h.clone())}if(j(i)){const h=i.anchor.key===i.focus.key;if(l=t.timeStamp,Vf==="MediaLast"&&l<ro+Xl&&r.isComposing()&&h){if(xe(null),ro=0,setTimeout(()=>{We(r,()=>{xe(null)})},Xl),j(i)){const g=i.anchor.getNode();g.markDirty(),i.format=g.getFormat(),K(g)||A(142),i.style=g.getStyle()}}else{xe(null),t.preventDefault();const g=i.anchor.getNode().getTextContent(),p=i.anchor.offset===0&&i.focus.offset===g.length;yy&&h&&!p||R(r,Fr,!0)}return}}var l;if(!j(i))return;const c=t.data;In!==null&&$l(!1,r,In),i.dirty&&In===null||!i.isCollapsed()||Le(i.anchor.getNode())||s===null||i.applyDOMRange(s),In=null;const a=i.anchor,u=i.focus,d=a.getNode(),f=u.getNode();if(o!=="insertText"&&o!=="insertTranspose")switch(t.preventDefault(),o){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":R(r,kn,t);break;case"insertFromComposition":xe(null),R(r,kn,t);break;case"insertLineBreak":xe(null),R(r,Br,!1);break;case"insertParagraph":xe(null),oo&&!ss?(oo=!1,R(r,Br,!1)):R(r,dl,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":R(r,hl,t);break;case"deleteByComposition":(function(h,g){return h!==g||D(h)||D(g)||!h.isToken()||!g.isToken()})(d,f)&&R(r,gl,t);break;case"deleteByDrag":case"deleteByCut":R(r,gl,t);break;case"deleteContent":R(r,Fr,!1);break;case"deleteWordBackward":R(r,Kr,!0);break;case"deleteWordForward":R(r,Kr,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":R(r,zr,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":R(r,zr,!1);break;case"formatStrikeThrough":R(r,Ft,"strikethrough");break;case"formatBold":R(r,Ft,"bold");break;case"formatItalic":R(r,Ft,"italic");break;case"formatUnderline":R(r,Ft,"underline");break;case"historyUndo":R(r,pl,void 0);break;case"historyRedo":R(r,_l,void 0)}else{if(c===`
|
|
24
|
-
`)t.preventDefault(),
|
|
25
|
-
`){const r=
|
|
26
|
-
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const r=t.parentElement;if(r!==null&&
|
|
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
|
-
`?o.push(
|
|
29
|
-
`),u
|
|
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
|
-
`?r.push(Bn()):i===" "?r.push(bs()):r.push(Oe(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,T){const N=_.getNode(),C=N.getChildAtIndex(_.offset),S=Oe(),E=Le(N)?vt().append(S):S;S.setFormat(m),S.setStyle(T),C===null?N.append(E):C.insertBefore(E),_.is(y)&&y.set(S.__key,0,"text"),_.set(S.__key,0,"text")}(i,l,o,s);const c=i.offset;let a=l.offset;const u=this.getNodes(),d=u.length;let f=u[0];K(f)||A(26);const h=f.getTextContent().length,g=f.getParentOrThrow();let p=u[d-1];if(d===1&&l.type==="element"&&(a=h,l.set(i.key,a,"text")),this.isCollapsed()&&c===h&&(f.isSegmented()||f.isToken()||!f.canInsertTextAfter()||!g.canInsertTextAfter()&&f.getNextSibling()===null)){let _=f.getNextSibling();if(K(_)&&_.canInsertTextBefore()&&!cn(_)||(_=Oe(),_.setFormat(o),_.setStyle(s),g.canInsertTextAfter()?f.insertAfter(_):g.insertAfter(_)),_.select(0,0),f=_,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&c===0&&(f.isSegmented()||f.isToken()||!f.canInsertTextBefore()||!g.canInsertTextBefore()&&f.getPreviousSibling()===null)){let _=f.getPreviousSibling();if(K(_)&&!cn(_)||(_=Oe(),_.setFormat(o),g.canInsertTextBefore()?f.insertBefore(_):g.insertBefore(_)),_.select(),f=_,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&c!==h){const _=Oe(f.getTextContent());_.setFormat(o),f.replace(_),f=_}else if(!this.isCollapsed()&&e!==""){const _=p.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||D(_)&&(!_.canInsertTextBefore()||!_.canInsertTextAfter()))return this.insertText(""),pd(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(f.isToken()){const T=Oe(e);return T.select(),void f.replace(T)}const _=f.getFormat(),y=f.getStyle();if(c!==a||_===o&&y===s){if(ad(f)){const T=Oe(e);return T.setFormat(o),T.setStyle(s),T.select(),void f.replace(T)}}else{if(f.getTextContent()!==""){const T=Oe(e);if(T.setFormat(o),T.setStyle(s),T.select(),c===0)f.insertBefore(T,!1);else{const[N]=f.splitText(c);N.insertAfter(T,!1)}return void(T.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(o),f.setStyle(s)}const m=a-c;f=f.spliceText(c,m,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=_,this.style=y))}else{const _=new Set([...f.getParentKeys(),...p.getParentKeys()]),y=D(f)?f:f.getParentOrThrow();let m=D(p)?p:p.getParentOrThrow(),T=p;if(!y.is(m)&&m.isInline())do T=m,m=m.getParentOrThrow();while(m.isInline());if(l.type==="text"&&(a!==0||p.getTextContent()==="")||l.type==="element"&&p.getIndexWithinParent()<a)if(K(p)&&!p.isToken()&&a!==p.getTextContentSize()){if(p.isSegmented()){const v=Oe(p.getTextContent());p.replace(v),p=v}Le(l.getNode())||l.type!=="text"||(p=p.spliceText(0,a,"")),_.add(p.__key)}else{const v=p.getParentOrThrow();v.canBeEmpty()||v.getChildrenSize()!==1?p.remove():v.remove()}else _.add(p.__key);const N=m.getChildren(),C=new Set(u),S=y.is(m),E=y.isInline()&&f.getNextSibling()===null?y:f;for(let v=N.length-1;v>=0;v--){const O=N[v];if(O.is(f)||D(O)&&O.isParentOf(f))break;O.isAttached()&&(!C.has(O)||O.is(T)?S||E.insertAfter(O,!1):O.remove())}if(!S){let v=m,O=null;for(;v!==null;){const M=v.getChildren(),I=M.length;(I===0||M[I-1].is(O))&&(_.delete(v.__key),O=v),v=v.getParent()}}if(f.isToken())if(c===h)f.select();else{const v=Oe(e);v.select(),f.replace(v)}else f=f.spliceText(c,h-c,e,!0),f.getTextContent()===""?f.remove():f.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let v=1;v<d;v++){const O=u[v],M=O.__key;_.has(M)||O.remove()}}}removeText(){this.insertText("")}formatText(e){if(this.isCollapsed())return this.toggleFormat(e),void xe(null);const t=this.getNodes(),r=[];for(const m of t)K(m)&&r.push(m);const o=r.length;if(o===0)return this.toggleFormat(e),void xe(null);const s=this.anchor,i=this.focus,l=this.isBackward(),c=l?i:s,a=l?s:i;let u=0,d=r[0],f=c.type==="element"?0:c.offset;if(c.type==="text"&&f===d.getTextContentSize()&&(u=1,d=r[1],f=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(f===_)return;if(cn(d)||f===0&&_===d.getTextContentSize())d.setFormat(h);else{const m=d.splitText(f,_),T=f===0?m[0]:m[1];T.setFormat(h),c.type==="text"&&c.set(T.__key,0,"text"),a.type==="text"&&a.set(T.__key,_-f,"text")}return void(this.format=h)}f===0||cn(d)||([,d]=d.splitText(f),f=0),d.setFormat(h);const y=p.getFormatFlags(e,h);_>0&&(_===p.getTextContentSize()||cn(p)||([p]=p.splitText(_)),p.setFormat(y));for(let m=u+1;m<g;m++){const T=r[m],N=T.getFormatFlags(e,y);T.setFormat(N)}c.type==="text"&&c.set(d.__key,f,"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=oe();return j(h)||A(134),h.insertNodes(e)}const t=Ul((this.isBackward()?this.focus:this.anchor).getNode(),$n),r=e[e.length-1];if("__language"in t&&D(t)){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const h=ac(this);t.splice(h,0,e),r.selectEnd()}return}if(!e.some(h=>(D(h)||ae(h))&&!h.isInline())){D(t)||A(135);const h=ac(this);return t.splice(h,0,e),void r.selectEnd()}const o=function(h){const g=vt();let p=null;for(let _=0;_<h.length;_++){const y=h[_],m=dn(y);if(m||ae(y)&&y.isInline()||D(y)&&y.isInline()||K(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=!D(t)||!t.isEmpty()?this.insertParagraph():null,c=i[i.length-1];let a=i[0];var u;D(u=a)&&$n(u)&&!u.isEmpty()&&D(t)&&(!t.isEmpty()||t.canMergeWhenEmpty())&&(D(t)||A(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()||A(140),y=y.getNextSibling(),m.push(y);let T=h;for(const N of m)T=T.insertAfter(N)}(t,a);const d=Ul(s,$n);l&&D(d)&&(l.canMergeWhenEmpty()||$n(c))&&(d.append(...l.getChildren()),l.remove()),D(t)&&t.isEmpty()&&t.remove(),s.selectEnd();const f=D(t)?t.getLastChild():null;dn(f)&&d!==t&&f.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=vt();return ze().splice(this.anchor.offset,0,[i]),i.select(),i}const e=ac(this),t=Ul(this.anchor.getNode(),$n);D(t)||A(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=Bn();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]=lc(this);if(t===0)return[];if(t===1){if(K(i)&&!this.isCollapsed()){const d=c>a?a:c,f=c>a?c:a,h=i.splitText(d,f),g=d===0?h[0]:h[1];return g!=null?[g]:[]}return[i]}const u=o.isBefore(s);if(K(i)){const d=u?c:a;d===i.getTextContentSize()?e.shift():d!==0&&([,i]=i.splitText(d),e[0]=i)}if(K(l)){const d=l.getTextContent().length,f=u?a:c;f===0?e.pop():f!==d&&([l]=l.splitText(f),e[r]=l)}return e}modify(e,t,r){const o=this.focus,s=this.anchor,i=e==="move",l=Fl(o,t);if(ae(l)&&!l.isIsolated()){if(i&&l.isKeyboardSelectable()){const h=cc();return h.add(l.__key),void ft(h)}const f=t?l.getPreviousSibling():l.getNextSibling();if(K(f)){const h=f.__key,g=t?f.getTextContent().length:0;return o.set(h,g,"text"),void(i&&s.set(h,g,"text"))}{const h=l.getParentOrThrow();let g,p;return D(f)?(p=f.__key,g=t?f.getChildrenSize():0):(g=l.getIndexWithinParent(),p=h.__key,t||g++),o.set(p,g,"element"),void(i&&s.set(p,g,"element"))}}const c=ce(),a=dt(c._window);if(!a)return;const u=c._blockCursorElement,d=c._rootElement;if(d===null||u===null||!D(l)||l.isInline()||l.canBeEmpty()||zl(u,c,d),function(f,h,g,p){f.modify(h,g,p)}(a,e,t?"backward":"forward",r),a.rangeCount>0){const f=a.getRangeAt(0),h=this.anchor.getNode(),g=Le(h)?h:Pf(h);if(this.applyDOMRange(f),this.dirty=!0,!i){const p=this.getNodes(),_=[];let y=!1;for(let m=0;m<p.length;m++){const T=p[m];ps(T,g)?_.push(T):y=!0}if(y&&_.length>0)if(t){const m=_[0];D(m)?m.selectStart():m.getParentOrThrow().selectStart()}else{const m=_[_.length-1];D(m)?m.selectEnd():m.getParentOrThrow().selectEnd()}a.anchorNode===f.startContainer&&a.anchorOffset===f.startOffset||function(m){const T=m.focus,N=m.anchor,C=N.key,S=N.offset,E=N.type;Ht(N,T.key,T.offset,T.type),Ht(T,C,S,E),m._cachedNodes=null}(this)}}}forwardDeletion(e,t,r){if(!r&&(e.type==="element"&&D(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(D(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=Fl(s,e);if(ae(i)&&!i.isIsolated()){if(i.isKeyboardSelectable()&&D(o)&&o.getChildrenSize()===0){o.remove();const l=cc();l.add(i.__key),ft(l)}else i.remove(),ce().dispatchCommand(ns,void 0);return}if(!e&&D(i)&&D(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 dd(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 dd(o,e,c)}(function(c,a){const u=c.anchor,d=c.focus,f=u.getNode(),h=d.getNode();if(f===h&&u.type==="text"&&d.type==="text"){const g=u.offset,p=d.offset,_=g<p,y=_?g:p,m=_?p:g,T=m-1;y!==T&&(Ef(f.getTextContent().slice(y,m))||(a?d.offset=T:u.offset=T))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&Le(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 io(n){return n instanceof ws}function fd(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function lc(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]:[fd(t),fd(r)]}function dd(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 u=a===s-1;if(l=i,i+=o[a].length,e&&i===t||i>t||u){o.splice(a,1),u&&(l=void 0);break}}const c=o.join("").trim();c===""?r.remove():(r.setTextContent(c),r.select(l,l))}function hd(n,e,t,r){let o,s=e;if(n.nodeType===Wr){let i=!1;const l=n.childNodes,c=l.length,a=r._blockCursorElement;s===c&&(i=!0,s=c-1);let u=l[s],d=!1;if(u===a)u=l[s+1],d=!0;else if(a!==null){const f=a.parentNode;n===f&&e>Array.prototype.indexOf.call(f.children,a)&&s--}if(o=Rn(u),K(o))s=Sf(o,i);else{let f=Rn(n);if(f===null)return null;if(D(f)){s=Math.min(f.getChildrenSize(),s);let h=f.getChildAtIndex(s);if(D(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?f=h:(h=g,f=D(h)?h:h.getParentOrThrow()),s=0}K(h)?(o=h,f=null,s=Sf(h,i)):h!==f&&i&&!d&&s++}else{const h=f.getIndexWithinParent();s=e===0&&ae(f)&&Rn(n)===f?h:h+1,f=f.getParentOrThrow()}if(D(f))return et(f.__key,s,"element")}}else o=Rn(n);return K(o)?et(o.__key,s,"text"):null}function gd(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&&D(i)&&i.isInline()){const l=i.getPreviousSibling();K(l)&&(n.key=l.__key,n.offset=l.getTextContent().length)}}else D(s)&&!t&&s.isInline()?(n.key=s.__key,n.offset=s.getChildrenSize(),n.type="element"):K(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&&D(s)&&s.isInline())n.key=s.__key,n.offset=0,n.type="element";else if((t||e)&&s===null&&D(i)&&i.isInline()&&!i.canInsertTextAfter()){const l=i.getNextSibling();K(l)&&(n.key=l.__key,n.offset=0)}}}function pd(n,e,t){if(n.type==="text"&&e.type==="text"){const r=n.isBefore(e),o=n.is(e);gd(n,r,o),gd(e,!r,o),o&&(e.key=n.key,e.offset=n.offset,e.type=n.type);const s=ce();if(s.isComposing()&&s._compositionKey!==n.key&&j(t)){const i=t.anchor,l=t.focus;Ht(n,i.key,i.offset,i.type),Ht(e,l.key,l.offset,l.type)}}}function _d(n,e,t,r,o,s){if(n===null||t===null||!Hr(o,n,t))return null;const i=hd(n,e,j(s)?s.anchor:null,o);if(i===null)return null;const l=hd(t,r,j(s)?s.focus:null,o);if(l===null)return null;if(i.type==="element"&&l.type==="element"){const c=Rn(n),a=Rn(t);if(ae(c)&&ae(a))return null}return pd(i,l,s),[i,l]}function dT(n){return D(n)&&!n.isInline()}function md(n,e,t,r,o,s){const i=gt(),l=new Yt(et(n,e,o),et(t,r,s),0,"");return l.dirty=!0,i._selection=l,l}function hT(){const n=et("root",0,"element"),e=et("root",0,"element");return new Yt(n,e,0,"")}function cc(){return new ws(new Set)}function gT(n,e){return Ds(null,n,e,null)}function Ds(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=!wl&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&s&&s.detail===3||i==="drop"||i===void 0);let a,u,d,f;if(j(n)&&!c)return n.clone();if(e===null)return null;if(a=e.anchorNode,u=e.focusNode,d=e.anchorOffset,f=e.focusOffset,l&&j(n)&&!Hr(t,a,u))return n.clone();const h=_d(a,d,u,f,t,n);if(h===null)return null;const[g,p]=h;return new Yt(g,p,j(n)?n.format:0,j(n)?n.style:"")}function oe(){return gt()._selection}function zn(){return ce()._editorState._selection}function Ms(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 u=Math.max(0,a+r);o.set(c,u,"element"),s.set(c,u,"element"),yd(n)}}else{const a=n.isBackward(),u=a?s:o,d=u.getNode(),f=a?o:s,h=f.getNode();if(e.is(d)){const g=u.offset;(t<=g&&r>0||t<g&&r<0)&&u.set(c,Math.max(0,g+r),"element")}if(e.is(h)){const g=f.offset;(t<=g&&r>0||t<g&&r<0)&&f.set(c,Math.max(0,g+r),"element")}}yd(n)}function yd(n){const e=n.anchor,t=e.offset,r=n.focus,o=r.offset,s=e.getNode(),i=r.getNode();if(n.isCollapsed()){if(!D(s))return;const l=s.getChildrenSize(),c=t>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(K(a)){let u=0;c&&(u=a.getTextContentSize()),e.set(a.__key,u,"text"),r.set(a.__key,u,"text")}}else{if(D(s)){const l=s.getChildrenSize(),c=t>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(K(a)){let u=0;c&&(u=a.getTextContentSize()),e.set(a.__key,u,"text")}}if(D(i)){const l=i.getChildrenSize(),c=o>=l,a=c?i.getChildAtIndex(l-1):i.getChildAtIndex(o);if(K(a)){let u=0;c&&(u=a.getTextContentSize()),r.set(a.__key,u,"text")}}}}function As(n,e,t,r,o){let s=null,i=0,l=null;r!==null?(s=r.__key,K(r)?(i=r.getTextContentSize(),l="text"):D(r)&&(i=r.getChildrenSize(),l="element")):o!==null&&(s=o.__key,K(o)?l="text":D(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 Td(n,e,t,r,o){n.type==="text"?(n.key=t,e||(n.offset+=o)):n.offset>r.getIndexWithinParent()&&(n.offset-=1)}function pT(n,e,t,r,o,s,i){const l=r.anchorNode,c=r.focusNode,a=r.anchorOffset,u=r.focusOffset,d=document.activeElement;if(o.has("collaboration")&&d!==s||d!==null&&Al(d))return;if(!j(e))return void(n!==null&&Hr(t,l,c)&&r.removeAllRanges());const f=e.anchor,h=e.focus,g=f.key,p=h.key,_=hs(t,g),y=hs(t,p),m=f.offset,T=h.offset,N=e.format,C=e.style,S=e.isCollapsed();let E=_,v=y,O=!1;if(f.type==="text"){E=us(_);const ne=f.getNode();O=ne.getFormat()!==N||ne.getStyle()!==C}else j(n)&&n.anchor.type==="text"&&(O=!0);var M,I,J,X,G;if(h.type==="text"&&(v=us(y)),E!==null&&v!==null&&(S&&(n===null||O||j(n)&&(n.format!==N||n.style!==C))&&(M=N,I=C,J=m,X=g,G=performance.now(),Gf=[M,I,J,X,G]),a!==m||u!==T||l!==E||c!==v||r.type==="Range"&&S||(d!==null&&s.contains(d)||s.focus({preventScroll:!0}),f.type==="element"))){try{r.setBaseAndExtent(E,m,v,T)}catch{}if(!o.has("skip-scroll-into-view")&&e.isCollapsed()&&s!==null&&s===document.activeElement){const ne=e instanceof Yt&&e.anchor.type==="element"?E.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(ne!==null){let me;if(ne instanceof Text){const Z=document.createRange();Z.selectNode(ne),me=Z.getBoundingClientRect()}else me=ne.getBoundingClientRect();(function(Z,Xt,ho){const go=ho.ownerDocument,po=go.defaultView;if(po===null)return;let{top:sr,bottom:ir}=Xt,lr=0,cr=0,Ue=ho;for(;Ue!==null;){const mn=Ue===go.body;if(mn)lr=0,cr=_s(Z).innerHeight;else{const Zt=Ue.getBoundingClientRect();lr=Zt.top,cr=Zt.bottom}let mt=0;if(sr<lr?mt=-(lr-sr):ir>cr&&(mt=ir-cr),mt!==0)if(mn)po.scrollBy(0,mt);else{const Zt=Ue.scrollTop;Ue.scrollTop+=mt;const yn=Ue.scrollTop-Zt;sr-=yn,ir-=yn}if(mn)break;Ue=gs(Ue)}})(t,me,s)}}Ql=!0}}function _T(n){let e=oe()||zn();e===null&&(e=ze().selectEnd()),e.insertNodes(n)}function mT(){const n=oe();return n===null?"":n.getTextContent()}function ac(n){let e=n;n.isCollapsed()||e.removeText();const t=oe();j(t)&&(e=t),j(e)||A(161);const r=e.anchor;let o=r.getNode(),s=r.offset;for(;!$n(o);)[o,s]=yT(o,s);return s}function yT(n,e){const t=n.getParent();if(!t){const o=vt();return ze().append(o),o.select(),[ze(),0]}if(K(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(!D(n)||e===0)return[t,n.getIndexWithinParent()];const r=n.getChildAtIndex(e);if(r){const o=new Yt(et(n.__key,e,"element"),et(n.__key,e,"element"),0,""),s=n.insertNewAfter(o);s&&s.append(r,...r.getNextSiblings())}return[t,n.getIndexWithinParent()+1]}let Ne=null,Ce=null,Ie=!1,uc=!1,ks=0;const xd={characterData:!0,childList:!0,subtree:!0};function Wn(){return Ie||Ne!==null&&Ne._readOnly}function ke(){Ie&&A(13)}function Nd(){ks>99&&A(14)}function gt(){return Ne===null&&A(195,Cd()),Ne}function ce(){return Ce===null&&A(196,Cd()),Ce}function Cd(){let n=0;const e=new Set,t=Rs.version;if(typeof window<"u")for(const o of document.querySelectorAll("[contenteditable]")){const s=Yr(o);if(as(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 TT(){return Ce}function Sd(n,e,t){const r=e.__type,o=function(l,c){const a=l._nodes.get(c);return a===void 0&&A(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 Ed(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function xT(n){return fc(n,ce()._nodes)}function fc(n,e){const t=n.type,r=e.get(t);r===void 0&&A(17,t);const o=r.klass;n.type!==o.getType()&&A(18,o.name);const s=o.importJSON(n),i=n.children;if(D(s)&&Array.isArray(i))for(let l=0;l<i.length;l++){const c=fc(i[l],e);s.append(c)}return s}function vd(n,e,t){const r=Ne,o=Ie,s=Ce;Ne=e,Ie=!0,Ce=n;try{return t()}finally{Ne=r,Ie=o,Ce=s}}function Vt(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!==ln,a=Ne,u=Ie,d=Ce,f=n._updating,h=n._observer;let g=null;if(n._pendingEditorState=null,n._editorState=t,!o&&c&&h!==null){Ce=n,Ne=t,Ie=!1,n._updating=!0;try{const S=n._dirtyType,E=n._dirtyElements,v=n._dirtyLeaves;h.disconnect(),g=rT(s,t,n,S,E,v)}catch(S){if(S instanceof Error&&n._onError(S),uc)throw S;return Pd(n,null,r,t),ff(n),n._dirtyType=Pn,uc=!0,Vt(n,s),void(uc=!1)}finally{h.observe(r,xd),n._updating=f,Ne=a,Ie=u,Ce=d}}t._readOnly||(t._readOnly=!0);const p=n._dirtyLeaves,_=n._dirtyElements,y=n._normalizedNodes,m=n._updateTags,T=n._deferred;c&&(n._dirtyType=ln,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements=new Map,n._normalizedNodes=new Set,n._updateTags=new Set),function(S,E){const v=S._decorators;let O=S._pendingDecorators||v;const M=E._nodeMap;let I;for(I in O)M.has(I)||(O===v&&(O=xf(S)),delete O[I])}(n,t);const N=o?null:dt(n._window);if(n._editable&&N!==null&&(c||l===null||l.dirty)){Ce=n,Ne=t;try{if(h!==null&&h.disconnect(),c||l===null||l.dirty){const S=n._blockCursorElement;S!==null&&zl(S,n,r),pT(i,l,n,N,m,r)}qy(n,r,l),h!==null&&h.observe(r,xd)}finally{Ce=d,Ne=a}}g!==null&&function(S,E,v,O,M){const I=Array.from(S._listeners.mutation),J=I.length;for(let X=0;X<J;X++){const[G,ne]=I[X],me=E.get(ne);me!==void 0&&G(me,{dirtyLeaves:O,prevEditorState:M,updateTags:v})}}(n,g,m,p,s),j(l)||l===null||i!==null&&i.is(l)||n.dispatchCommand(ns,void 0);const C=n._pendingDecorators;C!==null&&(n._decorators=C,n._pendingDecorators=null,lo("decorator",n,!0,C)),function(S,E,v){const O=Nf(E),M=Nf(v);O!==M&&lo("textcontent",S,!0,M)}(n,e||s,t),lo("update",n,!0,{dirtyElements:_,dirtyLeaves:p,editorState:t,normalizedNodes:y,prevEditorState:e||s,tags:m}),function(S,E){if(S._deferred=[],E.length!==0){const v=S._updating;S._updating=!0;try{for(let O=0;O<E.length;O++)E[O]()}finally{S._updating=v}}}(n,T),function(S){const E=S._updates;if(E.length!==0){const v=E.shift();if(v){const[O,M]=v;wd(S,O,M)}}}(n)}function lo(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 Od(n,e,t){if(n._updating===!1||Ce!==n){let o=!1;return n.update(()=>{o=Od(n,e,t)}),o}const r=Rl(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 u=0;u<a;u++)if(c[u](t,n)===!0)return!0}}}return!1}function bd(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&&A(191),a._flushSync=!0}l&&n._deferred.push(l),c&&n._updateTags.add(c)}s()}}return r}function wd(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,u=!1;(a===null||a._readOnly)&&(a=n._pendingEditorState=new Ps(new Map((a||c)._nodeMap)),u=!0),a._flushSync=l;const d=Ne,f=Ie,h=Ce,g=n._updating;Ne=a,Ie=!1,n._updating=!0,Ce=n;try{u&&(n._headless?c._selection!==null&&(a._selection=c._selection.clone()):a._selection=function(m){const T=m.getEditorState()._selection,N=dt(m._window);return j(T)||T==null?Ds(T,N,m,null):T.clone()}(n));const _=n._compositionKey;e(),i=bd(n,i),function(m,T){const N=T.getEditorState()._selection,C=m._selection;if(j(C)){const S=C.anchor,E=C.focus;let v;if(S.type==="text"&&(v=S.getNode(),v.selectionTransform(N,C)),E.type==="text"){const O=E.getNode();v!==O&&O.selectionTransform(N,C)}}}(a,n),n._dirtyType!==ln&&(i?function(m,T){const N=T._dirtyLeaves,C=m._nodeMap;for(const S of N){const E=C.get(S);K(E)&&E.isAttached()&&E.isSimpleText()&&!E.isUnmergeable()&&gf(E)}}(a,n):function(m,T){const N=T._dirtyLeaves,C=T._dirtyElements,S=m._nodeMap,E=zt(),v=new Map;let O=N,M=O.size,I=C,J=I.size;for(;M>0||J>0;){if(M>0){T._dirtyLeaves=new Set;for(const X of O){const G=S.get(X);K(G)&&G.isAttached()&&G.isSimpleText()&&!G.isUnmergeable()&&gf(G),G!==void 0&&Ed(G,E)&&Sd(T,G,v),N.add(X)}if(O=T._dirtyLeaves,M=O.size,M>0){ks++;continue}}T._dirtyLeaves=new Set,T._dirtyElements=new Map;for(const X of I){const G=X[0],ne=X[1];if(G!=="root"&&!ne)continue;const me=S.get(G);me!==void 0&&Ed(me,E)&&Sd(T,me,v),C.set(G,ne)}O=T._dirtyLeaves,M=O.size,I=T._dirtyElements,J=I.size,ks++}T._dirtyLeaves=N,T._dirtyElements=C}(a,n),bd(n),function(m,T,N,C){const S=m._nodeMap,E=T._nodeMap,v=[];for(const[O]of C){const M=E.get(O);M!==void 0&&(M.isAttached()||(D(M)&&Bf(M,O,S,E,v,C),S.has(O)||C.delete(O),v.push(O)))}for(const O of v)E.delete(O);for(const O of N){const M=E.get(O);M===void 0||M.isAttached()||(S.has(O)||N.delete(O),E.delete(O))}}(c,a,n._dirtyLeaves,n._dirtyElements)),_!==n._compositionKey&&(a._flushSync=!0);const y=a._selection;if(j(y)){const m=a._nodeMap,T=y.anchor.key,N=y.focus.key;m.get(T)!==void 0&&m.get(N)!==void 0||A(19)}else io(y)&&y._nodes.size===0&&(a._selection=null)}catch(_){return _ instanceof Error&&n._onError(_),n._pendingEditorState=c,n._dirtyType=Pn,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),void Vt(n)}finally{Ne=d,Ie=f,Ce=h,n._updating=g,ks=0}n._dirtyType!==ln||function(_,y){const m=y.getEditorState()._selection,T=_._selection;if(T!==null){if(T.dirty||!T.is(m))return!0}else if(m!==null)return!0;return!1}(a,n)?a._flushSync?(a._flushSync=!1,Vt(n)):u&&Ky(()=>{Vt(n)}):(a._flushSync=!1,u&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function We(n,e,t){n._updating?n._updates.push([e,t]):wd(n,e,t)}class co extends Es{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 Ay[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=ce()._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(K(t)&&e.push(t),D(t)){const r=t.getAllTextNodes();e.push(...r)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;D(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;D(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 D(s)&&s.getLastDescendant()||s||null}const o=t[e];return D(o)&&o.getFirstDescendant()||o||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:ve(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&A(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:ve(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&A(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(),D(s)&&o!==r-1&&!s.isInline()&&(e+=Ct)}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(),D(s)&&o!==r-1&&!s.isInline()&&(e+=Ct.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=cf[e];return!!(this.getFormat()&t)}return!1}select(e,t){ke();const r=oe();let o=e,s=t;const i=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const c=this.getFirstChild();if(K(c)||D(c))return c.select(0,0)}else if(!(e!==void 0&&e!==i||t!==void 0&&t!==i)){const c=this.getLastChild();if(K(c)||D(c))return c.select()}}o===void 0&&(o=i),s===void 0&&(s=i);const l=this.__key;return j(r)?(r.anchor.set(l,o,"element"),r.focus.set(l,s,"element"),r.dirty=!0,r):md(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!==""?cf[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=[],u=this.getChildAtIndex(e+t);let d=null,f=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&&A(100);const _=g.getNextSibling(),y=g.__key;an(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&&f--,an(_);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&&A(76),_.__parent=l,c.push(y),h=p}if(e+t===s)h!==null&&(h.getWritable().__next=null,i.__last=h.__key);else if(u!==null){const g=u.getWritable();if(h!==null){const p=h.getWritable();g.__prev=h.__key,p.__next=u.__key}else g.__prev=null}if(i.__size=f,a.length){const g=oe();if(j(g)){const p=new Set(a),_=new Set(c),{anchor:y,focus:m}=g;Dd(y,p,_)&&As(y,y.getNode(),this,d,u),Dd(m,p,_)&&As(m,m.getNode(),this,d,u),f!==0||this.canBeEmpty()||Wt(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 D(n){return n instanceof co}function Dd(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 Md extends Es{constructor(e){super(e)}decorate(e,t){A(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function ae(n){return n instanceof Md}class Un extends co{static getType(){return"root"}static clone(){return new Un}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){A(51)}getTextContent(){const e=this.__cachedText;return!Wn()&&ce()._dirtyType!==ln||e===null?super.getTextContent():e}remove(){A(52)}replace(e){A(53)}insertBefore(e){A(54)}insertAfter(e){A(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const r=e[t];D(r)||ae(r)||A(56)}return super.append(...e)}static importJSON(e){const t=ze();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 Le(n){return n instanceof Un}function dc(){return new Ps(new Map([["root",new Un]]))}function Ad(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType()&&A(130,t.name),D(n)){const r=e.children;Array.isArray(r)||A(59,t.name);const o=n.getChildren();for(let s=0;s<o.length;s++){const i=Ad(o[s]);r.push(i)}}return e}class Ps{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 vd(t&&t.editor||null,this,e)}clone(e){const t=new Ps(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return vd(null,this,()=>({root:Ad(ze())}))}}class kd extends co{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class gn extends co{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=ut[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 gn(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),r=Xr(e.theme,"paragraph");return r!==void 0&&t.classList.add(...r),t}updateDOM(e,t,r){return!1}static importDOM(){return{p:e=>({conversion:NT,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&ms(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=vt();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=vt();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||K(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 NT(n){const e=vt();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 vt(){return Zr(new gn)}function hc(n){return n instanceof gn}const CT=0,ST=1,ET=2,vT=3,OT=4;function Pd(n,e,t,r){const o=n._keyToDOMMap;o.clear(),n._editorState=dc(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=ln,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 bT(n){const e=n||{},t=TT(),r=e.theme||{},o=n===void 0?t:e.parentEditor||null,s=e.disableEvents||!1,i=dc(),l=e.namespace||(o!==null?o._config.namespace:vf()),c=e.editorState,a=[Un,hn,Fn,Kn,gn,kd,...e.nodes||[]],{onError:u,html:d}=e,f=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 S=_;_=S.replace,y=S.with,m=S.withKlass||null}const T=_.getType(),N=_.transform(),C=new Set;N!==null&&C.add(N),h.set(T,{exportDOM:d&&d.export?d.export.get(_):void 0,klass:_,replace:y,replaceWithKlass:m,transforms:C})}}const g=new Rs(i,o,h,{disableEvents:s,namespace:l,theme:r},u||console.error,function(p,_){const y=new Map,m=new Set,T=N=>{Object.keys(N).forEach(C=>{let S=y.get(C);S===void 0&&(S=[],y.set(C,S)),S.push(N[C])})};return p.forEach(N=>{const C=N.klass.importDOM;if(C==null||m.has(C))return;m.add(C);const S=C.call(N.klass);S!==null&&T(S)}),_&&T(_),y}(h,d?d.import:void 0),f);return c!==void 0&&(g._pendingEditorState=c,g._dirtyType=Pn),g}class Rs{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=ln,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=vf(),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&&A(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&&A(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&&A(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const r=this._editorState,o=Lf(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(),We(i,()=>{const c=gt();if(c.isEmpty())return;if(l==="root")return void ze().markDirty();const a=c._nodeMap;for(const[,u]of a)u.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 R(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=Xr(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=e,Pd(this,t,e,o),t!==null&&(this._config.disableEvents||oT(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=Pn,ff(this),this._updateTags.add("history-merge"),Vt(this),this._config.disableEvents||function(l,c){const a=l.ownerDocument,u=Ss.get(a);(u===void 0||u<1)&&a.addEventListener("selectionchange",td),Ss.set(a,(u||0)+1),l.__lexicalEditor=c;const d=ed(l);for(let f=0;f<Zl.length;f++){const[h,g]=Zl[f],p=typeof g=="function"?_=>{rd(_)||(nd(_),(c.isEditable()||h==="click")&&g(_,c))}:_=>{if(rd(_))return;nd(_);const y=c.isEditable();switch(h){case"cut":return y&&R(c,yl,_);case"copy":return R(c,ml,_);case"paste":return y&&R(c,hl,_);case"dragstart":return y&&R(c,qu,_);case"dragover":return y&&R(c,Xu,_);case"dragend":return y&&R(c,Zu,_);case"focus":return y&&R(c,Qu,_);case"blur":return y&&R(c,ef,_);case"drop":return y&&R(c,Gu,_)}};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;lo("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&A(38),uf(this);const r=this._pendingEditorState,o=this._updateTags,s=t!==void 0?t.tag:null;r===null||r.isEmpty()||(s!=null&&o.add(s),Vt(this)),this._pendingEditorState=e,this._dirtyType=Pn,this._dirtyElements.set("root",!1),this._compositionKey=null,s!=null&&o.add(s),Vt(this)}parseEditorState(e,t){return function(r,o,s){const i=dc(),l=Ne,c=Ie,a=Ce,u=o._dirtyElements,d=o._dirtyLeaves,f=o._cloneNotNeeded,h=o._dirtyType;o._dirtyElements=new Map,o._dirtyLeaves=new Set,o._cloneNotNeeded=new Set,o._dirtyType=0,Ne=i,Ie=!1,Ce=o;try{const g=o._nodes;fc(r.root,g),s&&s(),i._readOnly=!0}catch(g){g instanceof Error&&o._onError(g)}finally{o._dirtyElements=u,o._dirtyLeaves=d,o._cloneNotNeeded=f,o._dirtyType=h,Ne=l,Ie=c,Ce=a}return i}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return Vt(this),this.getEditorState().read(e,{editor:this})}update(e,t){We(this,e,t)}focus(e,t={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),We(this,()=>{const o=oe(),s=ze();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=dt(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,lo("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Rs.version="0.17.1+prod.esm";const wT=Object.freeze(Object.defineProperty({__proto__:null,$addUpdateTag:Vy,$applyNodeReplacement:Zr,$cloneWithProperties:Ff,$copyNode:Rf,$createLineBreakNode:Bn,$createNodeSelection:cc,$createParagraphNode:vt,$createPoint:et,$createRangeSelection:hT,$createRangeSelectionFromDom:gT,$createTabNode:bs,$createTextNode:Oe,$getAdjacentNode:Fl,$getCharacterOffsets:lc,$getEditor:Qy,$getNearestNodeFromDOMNode:Vr,$getNearestRootOrShadowRoot:Pf,$getNodeByKey:ve,$getNodeByKeyOrThrow:Gy,$getPreviousSelection:zn,$getRoot:ze,$getSelection:oe,$getTextContent:mT,$hasAncestor:ps,$hasUpdateTag:Yy,$insertNodes:_T,$isBlockElementNode:dT,$isDecoratorNode:ae,$isElementNode:D,$isInlineElementOrDecoratorNode:Jy,$isLeafNode:Wy,$isLineBreakNode:dn,$isNodeSelection:io,$isParagraphNode:hc,$isRangeSelection:j,$isRootNode:Le,$isRootOrShadowRoot:Wt,$isTabNode:ad,$isTextNode:K,$isTokenOrSegmented:cn,$nodesOfType:Hy,$normalizeSelection__EXPERIMENTAL:pf,$parseSerializedNode:xT,$selectAll:jy,$setCompositionKey:xe,$setSelection:ft,$splitNode:Xy,ArtificialNode__DO_NOT_USE:kd,BLUR_COMMAND:ef,CAN_REDO_COMMAND:gy,CAN_UNDO_COMMAND:py,CLEAR_EDITOR_COMMAND:dy,CLEAR_HISTORY_COMMAND:hy,CLICK_COMMAND:Iu,COMMAND_PRIORITY_CRITICAL:OT,COMMAND_PRIORITY_EDITOR:CT,COMMAND_PRIORITY_HIGH:vT,COMMAND_PRIORITY_LOW:ST,COMMAND_PRIORITY_NORMAL:ET,CONTROLLED_TEXT_INSERTION_COMMAND:kn,COPY_COMMAND:ml,CUT_COMMAND:yl,DELETE_CHARACTER_COMMAND:Fr,DELETE_LINE_COMMAND:zr,DELETE_WORD_COMMAND:Kr,DRAGEND_COMMAND:Zu,DRAGOVER_COMMAND:Xu,DRAGSTART_COMMAND:qu,DROP_COMMAND:Gu,DecoratorNode:Md,ElementNode:co,FOCUS_COMMAND:Qu,FORMAT_ELEMENT_COMMAND:fy,FORMAT_TEXT_COMMAND:Ft,INDENT_CONTENT_COMMAND:ay,INSERT_LINE_BREAK_COMMAND:Br,INSERT_PARAGRAPH_COMMAND:dl,INSERT_TAB_COMMAND:cy,IS_ALL_FORMATTING:of,IS_BOLD:Cy,IS_CODE:Ey,IS_HIGHLIGHT:is,IS_ITALIC:Sy,IS_STRIKETHROUGH:Ur,IS_SUBSCRIPT:vy,IS_SUPERSCRIPT:Oy,IS_UNDERLINE:jr,KEY_ARROW_DOWN_COMMAND:Uu,KEY_ARROW_LEFT_COMMAND:Ku,KEY_ARROW_RIGHT_COMMAND:Fu,KEY_ARROW_UP_COMMAND:Wu,KEY_BACKSPACE_COMMAND:Hu,KEY_DELETE_COMMAND:Vu,KEY_DOWN_COMMAND:Lu,KEY_ENTER_COMMAND:rs,KEY_ESCAPE_COMMAND:Yu,KEY_MODIFIER_COMMAND:tf,KEY_SPACE_COMMAND:ju,KEY_TAB_COMMAND:Ju,LineBreakNode:Fn,MOVE_TO_END:Bu,MOVE_TO_START:zu,OUTDENT_CONTENT_COMMAND:uy,PASTE_COMMAND:hl,ParagraphNode:gn,REDO_COMMAND:_l,REMOVE_TEXT_COMMAND:gl,RootNode:Un,SELECTION_CHANGE_COMMAND:ns,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:ly,SELECT_ALL_COMMAND:Tl,TEXT_TYPE_TO_FORMAT:ut,TabNode:Kn,TextNode:hn,UNDO_COMMAND:pl,createCommand:iy,createEditor:bT,getEditorPropertyFromDOMNode:Yr,getNearestEditorFromDOMNode:kl,isBlockDomNode:Wl,isCurrentlyReadOnlyMode:Wn,isHTMLAnchorElement:Zy,isHTMLElement:ms,isInlineDomNode:$f,isLexicalEditor:as,isSelectionCapturedInDecoratorInput:Al,isSelectionWithinEditor:Hr,resetRandomKey:By},Symbol.toStringTag,{value:"Module"})),F=process.env.NODE_ENV==="development"?sy:wT,Jt=F.$cloneWithProperties,$s=F.$createLineBreakNode,ao=F.$createParagraphNode,Rd=F.$createTabNode,jn=F.$createTextNode,$d=F.$getAdjacentNode,Id=F.$getCharacterOffsets,Ld=F.$getEditor,Fd=F.$getNodeByKey,Hn=F.$getPreviousSelection,_e=F.$getRoot,z=F.$getSelection,Bd=F.$hasAncestor,Yn=F.$isBlockElementNode,Vn=F.$isDecoratorNode,W=F.$isElementNode,Kd=F.$isLeafNode,zd=F.$isLineBreakNode,Wd=F.$isParagraphNode,$=F.$isRangeSelection,Jn=F.$isRootNode,Fe=F.$isRootOrShadowRoot,L=F.$isTextNode,Gn=F.$isTokenOrSegmented,Ud=F.$parseSerializedNode,jd=F.$selectAll,Is=F.$setSelection,Ls=F.$splitNode,Fs=F.ArtificialNode__DO_NOT_USE,Gt=F.CAN_REDO_COMMAND,qt=F.CAN_UNDO_COMMAND,Hd=F.CLEAR_EDITOR_COMMAND,Yd=F.CLEAR_HISTORY_COMMAND,Vd=F.COMMAND_PRIORITY_CRITICAL,V=F.COMMAND_PRIORITY_EDITOR,Jd=F.CONTROLLED_TEXT_INSERTION_COMMAND,Bs=F.COPY_COMMAND,Gd=F.CUT_COMMAND,qn=F.DELETE_CHARACTER_COMMAND,qd=F.DELETE_LINE_COMMAND,Xd=F.DELETE_WORD_COMMAND,Zd=F.DRAGSTART_COMMAND,Qd=F.DROP_COMMAND,Ks=F.INSERT_LINE_BREAK_COMMAND,eh=F.INSERT_PARAGRAPH_COMMAND,th=F.KEY_ARROW_LEFT_COMMAND,nh=F.KEY_ARROW_RIGHT_COMMAND,rh=F.KEY_BACKSPACE_COMMAND,oh=F.KEY_DELETE_COMMAND,sh=F.KEY_ENTER_COMMAND,ih=F.PASTE_COMMAND,lh=F.REDO_COMMAND,ch=F.REMOVE_TEXT_COMMAND,ah=F.SELECTION_INSERT_CLIPBOARD_NODES_COMMAND,uh=F.SELECT_ALL_COMMAND,Xn=F.TextNode,fh=F.UNDO_COMMAND,DT=F.createEditor,dh=F.isBlockDomNode,hh=F.isHTMLAnchorElement,gh=F.isHTMLElement,Zn=F.isInlineDomNode,ph=F.isSelectionWithinEditor;function MT(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var AT=MT(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 _h=q.createContext(null);function kT(n,e){let t=null;return n!=null&&(t=n[1]),{getTheme:function(){return e??(t!=null?t.getTheme():null)}}}function pn(){const n=q.useContext(_h);return n==null&&AT(8),n}const mh=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,PT=mh?q.useLayoutEffect:q.useEffect,zs={tag:"history-merge"};function RT({initialConfig:n,children:e}){const t=q.useMemo(()=>{const{theme:r,namespace:o,nodes:s,onError:i,editorState:l,html:c}=n,a=kT(null,r),u=DT({editable:n.editable,html:c,namespace:o,nodes:s,onError:d=>i(d,u),theme:r});return function(d,f){if(f!==null){if(f===void 0)d.update(()=>{const h=_e();if(h.isEmpty()){const g=ao();h.append(g);const p=mh?document.activeElement:null;(z()!==null||p!==null&&p===d.getRootElement())&&g.select()}},zs);else if(f!==null)switch(typeof f){case"string":{const h=d.parseEditorState(f);d.setEditorState(h,zs);break}case"object":d.setEditorState(f,zs);break;case"function":d.update(()=>{_e().isEmpty()&&f(d)},zs)}}}(u,l),[u,a]},[]);return PT(()=>{const r=n.editable,[o]=t;o.setEditable(r===void 0||r)},[]),ue.exports.jsx(_h.Provider,{value:t,children:e})}const $T=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?q.useLayoutEffect:q.useEffect;function IT(n){return{initialValueFn:()=>n.isEditable(),subscribe:e=>n.registerEditableListener(e)}}function LT(){return function(n){const[e]=pn(),t=q.useMemo(()=>n(e),[e,n]),r=q.useRef(t.initialValueFn()),[o,s]=q.useState(r.current);return $T(()=>{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}(IT)}function yh(){return _e().getTextContent()}function gc(n,e=!0){if(n)return!1;let t=yh();return e&&(t=t.trim()),t===""}function FT(n,e){return()=>gc(n,e)}function Th(n){if(!gc(n,!1))return!1;const t=_e().getChildren(),r=t.length;if(r>1)return!1;for(let o=0;o<r;o++){const s=t[o];if(Vn(s))return!1;if(W(s)){if(!Wd(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 BT(n){return()=>Th(n)}function KT(n,e){let t=n.getFirstChild(),r=0;e:for(;t!==null;){if(W(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 zT(n,e,t,r){const o=d=>d instanceof t,s=d=>{const f=jn(d.getTextContent());f.setFormat(d.getFormat()),d.replace(f)},i=d=>d.getLatest().__mode,l=d=>{if(!d.isSimpleText())return;let f=d.getPreviousSibling(),h=d.getTextContent(),g=d,p;if(L(f)){const y=f.getTextContent(),m=y+h,T=e(m);if(o(f))if(T===null||i(f)!==0){s(f);return}else{const N=T.end-y.length;if(N>0){const C=h.slice(0,N),S=y+C;if(f.select(),f.setTextContent(S),N===h.length)d.remove();else{const E=h.slice(N);d.setTextContent(E)}return}}else if(T===null||T.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 C=e(y);if(C===null){o(N)?s(N):N.markDirty();return}else if(C.start!==0)return}}if(p===null)return;if(p.start===0&&L(f)&&f.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 T=r(m);if(T.setFormat(m.getFormat()),m.replace(T),g==null)return;_=0,f=T}},c=d=>{const f=d.getTextContent(),h=e(f);if(h===null||h.start!==0){s(d);return}if(f.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(Xn,l),u=n.registerNodeTransform(t,c);return[a,u]}const WT=Object.freeze(Object.defineProperty({__proto__:null,$canShowPlaceholder:Th,$canShowPlaceholderCurry:BT,$findTextIntersectionFromCharacters:KT,$isRootTextContentEmpty:gc,$isRootTextContentEmptyCurry:FT,$rootTextContent:yh,registerLexicalTextEntity:zT},Symbol.toStringTag,{value:"Module"}));function xh(){return _e().getTextContent()}function pc(n,e=!0){if(n)return!1;let t=xh();return e&&(t=t.trim()),t===""}function UT(n,e){return()=>pc(n,e)}function Nh(n){if(!pc(n,!1))return!1;const e=_e().getChildren(),t=e.length;if(t>1)return!1;for(let r=0;r<t;r++){const o=e[r];if(Vn(o))return!1;if(W(o)){if(!Wd(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 jT(n){return()=>Nh(n)}function HT(n,e){let t=n.getFirstChild(),r=0;e:for(;t!==null;){if(W(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 YT(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var VT=YT(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 JT(n,e,t,r){const o=i=>i instanceof t,s=i=>{const l=jn(i.getTextContent());l.setFormat(i.getFormat()),i.replace(l)};return[n.registerNodeTransform(Xn,i=>{if(!i.isSimpleText())return;let l,c=i.getPreviousSibling(),a=i.getTextContent(),u=i;if(L(c)){const f=c.getTextContent(),h=e(f+a);if(o(c)){if(h===null||(g=>g.getLatest().__mode)(c)!==0)return void s(c);{const g=h.end-f.length;if(g>0){const p=f+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<f.length)return}let d=0;for(;;){l=e(a);let f,h=l===null?"":a.slice(l.end);if(a=h,h===""){const p=u.getNextSibling();if(L(p)){h=u.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?[f,u]=u.splitText(l.end):[,f,u]=u.splitText(l.start+d,l.end+d),f===void 0&&VT(165,"nodeToReplace");const g=r(f);if(g.setFormat(f.getFormat()),f.replace(g),u==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 u=i.getNextSibling();L(u)&&u.isTextEntity()&&(s(u),o(i)&&s(i))})]}const GT=Object.freeze(Object.defineProperty({__proto__:null,$canShowPlaceholder:Nh,$canShowPlaceholderCurry:jT,$findTextIntersectionFromCharacters:HT,$isRootTextContentEmpty:pc,$isRootTextContentEmptyCurry:UT,$rootTextContent:xh,registerLexicalTextEntity:JT},Symbol.toStringTag,{value:"Module"})),Ch=(process.env.NODE_ENV==="development"?WT:GT).$canShowPlaceholderCurry,Ws=new Map;function Sh(n){let e=n;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function Eh(n){const e=n.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(n)]}function qT(n,e,t,r,o){const s=e.getKey(),i=r.getKey(),l=document.createRange();let c=n.getElementByKey(s),a=n.getElementByKey(i),u=t,d=o;if(L(e)&&(c=Sh(c)),L(r)&&(a=Sh(a)),e===void 0||r===void 0||c===null||a===null)return null;c.nodeName==="BR"&&([c,u]=Eh(c)),a.nodeName==="BR"&&([a,d]=Eh(a));const f=c.firstChild;c===a&&f!=null&&f.nodeName==="BR"&&u===0&&d===0&&(d=1);try{l.setStart(c,u),l.setEnd(a,d)}catch{return null}return l.collapsed&&(u!==d||s!==i)&&(l.setStart(a,d),l.setEnd(c,u)),l}function XT(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,u)=>{const d=a.top-u.top;return Math.abs(d)<=3?a.left-u.left:d});let c;for(let a=0;a<l;a++){const u=i[a],d=c&&c.top<=u.top&&c.top+c.height>u.top&&c.left+c.width>u.left,f=u.width+s===r.width;if(d||f){i.splice(a--,1),l--;continue}c=u}return i}function vh(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 Us(n){let e=Ws.get(n);return e===void 0&&(e=vh(n),Ws.set(n,e)),Object.freeze(e),e}function ZT(n){let e="";for(const t in n)t&&(e+=`${t}: ${n[t]};`);return e}function QT(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[u,d]=Id(n),f=i.is(l),h=e.is(s?l:i),g=e.is(s?i:l);let p=0,_;if(f)p=u>d?d:u,_=u>d?u:d;else if(h)p=s?d:u,_=void 0;else if(g){const y=s?u:d;p=0,_=y}return e.__text=e.__text.slice(p,_),e}}return e}function ex(n){if(n.type==="text")return n.offset===n.getNode().getTextContentSize();const e=n.getNode();if(!W(e))throw Error("isAtNodeEnd: node must be a TextNode or ElementNode");return n.offset===e.getChildrenSize()}function Oh(n,e,t){let r=e.getNode(),o=t;if(W(r)){const s=r.getDescendantByIndex(e.offset);s!==null&&(r=s)}for(;o>0&&r!==null;){if(W(r)){const a=r.getLastDescendant();a!==null&&(r=a)}let s=r.getPreviousSibling(),i=0;if(s===null){let a=r.getParentOrThrow(),u=a.getPreviousSibling();for(;u===null;){if(a=a.getParent(),a===null){s=null;break}u=a.getPreviousSibling()}a!==null&&(i=a.isInline()?0:2,s=u)}let l=r.getTextContent();l===""&&W(r)&&!r.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(r)||o>=c){const a=r.getParent();r.remove(),a!=null&&a.getChildrenSize()===0&&!
|
|
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(r)||o>=c){const a=r.getParent();r.remove(),a==null||a.getChildrenSize()!==0||Jn(a)||a.remove(),o-=c+i,r=s}else{const a=r.getKey(),u=n.getEditorState().read(()=>{const h=Fd(a);return L(h)&&h.isSimpleText()?h.getTextContent():null}),d=c-o,f=l.slice(0,d);if(u!==null&&u!==l){const h=Hn();let g=r;if(r.isSimpleText())r.setTextContent(u);else{const p=jn(u);r.replace(p),g=p}if($(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=jn(f);r.replace(h)}o=0}}}function yx(n){const e=n.getStyle(),t=Ph(e);js.set(e,t)}function er(n,e){const t=Hs("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),js.set(o,r)}function Tx(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()&&$(n))return void er(n,e);const u=c.getTextContent().length,d=i.offset;let f=s.offset;const h=s.isBefore(i);let g=h?f:d,p=h?d:f;const _=h?s.type:i.type,y=h?i.type:s.type,m=h?i.key:s.key;if(L(c)&&g===u){const T=c.getNextSibling();L(T)&&(f=0,g=0,c=T)}if(t.length===1){if(L(c)&&c.canHaveFormat()){if(g=_==="element"?0:f>d?d:f,p=y==="element"?u:f>d?f:d,g===p)return;if(Gn(c)||g===0&&p===u)er(c,e),c.select(g,p);else{const T=c.splitText(g,p),N=g===0?T[0]:T[1];er(N,e),N.select(0,p-g)}}}else{if(L(c)&&g<c.getTextContentSize()&&c.canHaveFormat()&&(g===0||Gn(c)||(c=c.splitText(g)[1],g=0,h?s.set(c.getKey(),g,"text"):i.set(c.getKey(),g,"text")),er(c,e)),L(a)&&a.canHaveFormat()){const T=a.getTextContent().length;a.__key!==m&&p!==0&&(p=T),p===T||Gn(a)||([a]=a.splitText(p)),p===0&&y!=="element"||er(a,e)}for(let T=1;T<l;T++){const N=t[T],C=N.getKey();L(N)&&N.canHaveFormat()&&C!==c.getKey()&&C!==a.getKey()&&!N.isToken()&&er(N,e)}}}function xx(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=_e(),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(),Fh);s&&o.indexOf(s)===-1&&o.push(s);for(let i=0;i<o.length;i++){const l=o[i];if(!Fh(l))continue;W(l)||mc(178);const c=e();c.setFormat(l.getFormatType()),c.setIndent(l.getIndent()),l.replace(c,!0)}}function $h(n){return n.getNode().isAttached()}function Nx(n){let e=n;for(;e!==null&&!Fe(e);){const t=e.getLatest(),r=e.getParent();t.getChildrenSize()===0&&e.remove(!0),e=r}}function Cx(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(),u=a.getChildren();let d=e();return d.setFormat(a.getFormatType()),d.setIndent(a.getIndent()),u.forEach(f=>d.append(f)),t&&(d=t.append(d)),void a.replace(d)}let l=null,c=[];for(let a=0;a<i;a++){const u=s[a];Fe(u)?(yc(n,c,c.length,e,t),c=[],l=u):l===null||l!==null&&Bd(u,l)?c.push(u):(yc(n,c,c.length,e,t),c=[u])}yc(n,c,c.length,e,t)}function yc(n,e,t,r,o=null){if(e.length===0)return;const s=e[0],i=new Map,l=[];let c=W(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(),Fe(c))break}const u=new Set;for(let g=0;g<t;g++){const p=e[g];W(p)&&p.getChildrenSize()===0&&u.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&&Kd(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(T=>{m.append(T),d.add(T.getKey()),W(T)&&T.getChildrenKeys().forEach(N=>d.add(N))}),Nx(_)}}else if(u.has(p.getKey())){W(p)||mc(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 f=null;if(Fe(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(W(g)&&(c=g),g===null)if(o)c.append(o);else for(let p=0;p<l.length;p++){const _=l[p];c.append(_),f=_}else if(o!==null)g.insertBefore(o);else for(let p=0;p<l.length;p++){const _=l[p];g.insertBefore(_),f=_}}else if(o)c.insertAfter(o);else for(let g=l.length-1;g>=0;g--){const p=l[g];c.insertAfter(p),f=p}const h=Hn();$(h)&&$h(h.anchor)&&$h(h.focus)?Is(h.clone()):f!==null?f.selectEnd():n.dirty=!0}function Sx(n,e){const t=$d(n.focus,e);return Vn(t)&&!t.isIsolated()||W(t)&&!t.isInline()&&!t.canBeEmpty()}function Ih(n,e,t,r){n.modify(e?"extend":"move",t,r)}function Lh(n){const e=n.anchor.getNode();return(Jn(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function Ex(n,e,t){const r=Lh(n);Ih(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":W(o)||o===null||(o=o.getParentOrThrow()),L(s)?(l="text",c=s.getTextContentSize()):W(s)||s===null||(s=s.getParentOrThrow()),o&&s&&(e.set(o.getKey(),0,i),t.set(s.getKey(),c,l))}function Ox(n,e,t){const r=Hs(n.getStyle());return r!==null&&r[e]||t}function bx(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($(n)&&n.isCollapsed()&&n.style!==""){const u=Hs(n.style);if(u!==null&&e in u)return u[e]}for(let u=0;u<o.length;u++){const d=o[u];if((u===0||c!==0||!d.is(a))&&L(d)){const f=Ox(d,e,t);if(r===null)r=f;else if(r!==f){r="";break}}}return r===null?t:r}function Fh(n){if(Vn(n)||!W(n)||Fe(n))return!1;const e=n.getFirstChild(),t=e===null||zd(e)||L(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}const wx=Object.freeze(Object.defineProperty({__proto__:null,$addNodeStyle:yx,$getSelectionStyleValueForProperty:bx,$isAtNodeEnd:mx,$isParentElementRTL:Lh,$moveCaretSelection:Ih,$moveCharacter:Ex,$patchStyleText:Tx,$selectAll:vx,$setBlocksType:xx,$shouldOverrideDefaultCharacterSelection:Sx,$sliceSelectedTextNodeContent:_x,$trimTextContentFromAnchor:Rh,$wrapNodes:Cx,createDOMRange:gx,createRectsFromDOMRange:px,getStyleObjectFromCSS:Hs,trimTextContentFromAnchor:Rh,$cloneWithProperties:Jt},Symbol.toStringTag,{value:"Module"})),uo=process.env.NODE_ENV==="development"?dx:wx,Bh=uo.$addNodeStyle,Ys=uo.$moveCharacter,Vs=uo.$shouldOverrideDefaultCharacterSelection,Js=uo.$sliceSelectedTextNodeContent,Kh=uo.createRectsFromDOMRange,tt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Dx=tt&&"documentMode"in document?document.documentMode:null,Mx=tt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ax=tt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),kx=tt&&"InputEvent"in window&&!Dx?"getTargetRanges"in new window.InputEvent("input"):!1,Px=tt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Rx=tt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,zh=tt&&/Android/.test(navigator.userAgent),Tc=tt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),$x=tt&&zh&&Tc,Ix=tt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Tc;function Wh(...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 Uh(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}function pt(n){return`${n}px`}const Lx={attributes:!0,characterData:!0,childList:!0,subtree:!0};function jh(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:f,top:h}=r.getBoundingClientRect(),g=o,p=Kh(n,e);l.isConnected||g.append(l);let _=!1;for(let y=0;y<p.length;y++){const m=p[y],T=i[y]||document.createElement("div"),N=T.style;N.position!=="absolute"&&(N.position="absolute",_=!0);const C=pt(m.left-f);N.left!==C&&(N.left=C,_=!0);const S=pt(m.top-h);N.top!==S&&(T.style.top=S,_=!0);const E=pt(m.width);N.width!==E&&(T.style.width=E,_=!0);const v=pt(m.height);N.height!==v&&(T.style.height=v,_=!0),T.parentNode!==l&&(l.append(T),_=!0),i[y]=T}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 f of i)f.remove();i=[]}function u(){const f=n.getRootElement();if(f===null)return a();const h=f.parentElement;if(!(h instanceof HTMLElement))return a();a(),r=f,o=h,s=new MutationObserver(g=>{const p=n.getRootElement(),_=p&&p.parentElement;if(p!==r||_!==o)return u();for(const y of g)if(!l.contains(y.target))return c()}),s.observe(h,Lx),c()}const d=n.registerRootListener(u);return()=>{d(),a()}}function Fx(n,e){let t=null,r=null,o=null,s=null,i=()=>{};function l(c){c.read(()=>{const a=z();if(!$(a)){t=null,r=null,o=null,s=null,i(),i=()=>{};return}const{anchor:u,focus:d}=a,f=u.getNode(),h=f.getKey(),g=u.offset,p=d.getNode(),_=p.getKey(),y=d.offset,m=n.getElementByKey(h),T=n.getElementByKey(_),N=t===null||m===null||g!==r||h!==t.getKey()||f!==t&&(!(t instanceof Xn)||f.updateDOM(t,m,n._config)),C=o===null||T===null||y!==s||_!==o.getKey()||p!==o&&(!(o instanceof Xn)||p.updateDOM(o,T,n._config));if(N||C){const S=n.getElementByKey(u.getNode().getKey()),E=n.getElementByKey(d.getNode().getKey());if(S!==null&&E!==null&&S.tagName==="SPAN"&&E.tagName==="SPAN"){const v=document.createRange();let O,M,I,J;d.isBefore(u)?(O=E,M=d.offset,I=S,J=u.offset):(O=S,M=u.offset,I=E,J=d.offset);const X=O.firstChild;if(X===null)throw Error("Expected text node to be first child of span");const G=I.firstChild;if(G===null)throw Error("Expected text node to be first child of span");v.setStart(X,M),v.setEnd(G,J),i(),i=jh(n,v,ne=>{for(const me of ne){const Z=me.style;Z.background!=="Highlight"&&(Z.background="Highlight"),Z.color!=="HighlightText"&&(Z.color="HighlightText"),Z.zIndex!=="-1"&&(Z.zIndex="-1"),Z.pointerEvents!=="none"&&(Z.pointerEvents="none"),Z.marginTop!==pt(-1.5)&&(Z.marginTop=pt(-1.5)),Z.paddingTop!==pt(4)&&(Z.paddingTop=pt(4)),Z.paddingBottom!==pt(0)&&(Z.paddingBottom=pt(0))}e!==void 0&&e(ne)})}}t=f,r=g,o=p,s=y})}return l(n.getEditorState()),Uh(n.registerUpdateListener(({editorState:c})=>l(c)),i,()=>{i()})}const Bx=kx,Kx=tt,zx=zh,Wx=$x,Ux=Mx,jx=Ix,Hx=Tc,Hh=Ax,Yx=Rx,Vx=Px;function Jx(n,...e){const t=Wh(...e);t.length>0&&n.classList.add(...t)}function Gx(n,...e){const t=Wh(...e);t.length>0&&n.classList.remove(...t)}function Yh(n,e){for(const t of e)if(n.type.startsWith(t))return!0;return!1}function qx(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 u=a.result;typeof u=="string"&&s.push({file:c,result:u}),i()}),Yh(c,e)?a.readAsDataURL(c):i()};i()})}function Xx(n,e){const t=[],r=(n||_e()).getLatest(),o=e||W(r)&&r.getLastDescendant()||r;let s=r,i=Zx(s);for(;s!==null&&!s.is(o);)if(t.push({depth:i,node:s}),W(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 Zx(n){let e=n,t=0;for(;(e=e.getParent())!==null;)t++;return t}function Qx(n){let e=n;if(W(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 eN(n,e){let t=n;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function tN(n){const e=Vh(n,t=>W(t)&&!t.isInline());if(!W(e))throw Error(`Expected node ${n.__key} to have closest block element node.`);return e}const Vh=(n,e)=>{let t=n;for(;t!==_e()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function nN(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 f=c[d];if(o(f))return null}let a=l,u=l;for(;a!==null;)if(u=a,a=a.getParent(),o(a))return{child:u,parent:a};return null},i=l=>{const c=s(l);if(c!==null){const{child:a,parent:u}=c;if(a.is(l)){r(u,l);const d=a.getNextSiblings(),f=d.length;if(u.insertAfter(a),f!==0){const h=t(u);a.insertAfter(h);for(let g=0;g<f;g++)h.append(d[g])}!u.canBeEmpty()&&u.getChildrenSize()===0&&u.remove()}}};return n.registerNodeTransform(e,i)}function rN(n,e){const r=new Map,o=n._pendingEditorState;for(const[i,l]of e._nodeMap)r.set(i,Jt(l));o&&(o._nodeMap=r),n._dirtyType=2;const s=e._selection;Is(s===null?null:s.clone())}function oN(n){const e=z()||Hn();if($(e)){const{focus:t}=e,r=t.getNode(),o=t.offset;if(Fe(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]=Ls(s,i);l.insertBefore(n),l.selectStart()}}else{if(e!=null){const r=e.getNodes();r[r.length-1].getTopLevelElementOrThrow().insertAfter(n)}else _e().append(n);const t=ao();n.insertAfter(t),t.select()}return n.getLatest()}function sN(n,e){const t=e();return n.replace(t),t.append(n),t}function iN(n,e){return n!==null?Object.getPrototypeOf(n).constructor.name===e.name:!1}function lN(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 cN(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function aN(n){if(Hh)return 1;let e=1;for(;n;)e*=Number(window.getComputedStyle(n).getPropertyValue("zoom")),n=n.parentElement;return e}function uN(n){return n._parentEditor!==null}const fN=Object.freeze(Object.defineProperty({__proto__:null,$dfs:Xx,$filter:lN,$findMatchingParent:Vh,$getNearestBlockElementAncestorOrThrow:tN,$getNearestNodeOfType:eN,$getNextRightPreorderNode:Qx,$insertFirst:cN,$insertNodeToNearestRoot:oN,$isEditorIsNestedEditor:uN,$restoreEditorState:rN,$wrapNodeInElement:sN,CAN_USE_BEFORE_INPUT:Bx,CAN_USE_DOM:Kx,IS_ANDROID:zx,IS_ANDROID_CHROME:Wx,IS_APPLE:Ux,IS_APPLE_WEBKIT:jx,IS_CHROME:Hx,IS_FIREFOX:Hh,IS_IOS:Yx,IS_SAFARI:Vx,addClassNamesToElement:Jx,calculateZoomLevel:aN,isMimeType:Yh,markSelection:Fx,mediaFileReader:qx,mergeRegister:Uh,objectKlassEquals:iN,positionNodeOnRange:jh,registerNestedElementResolver:nN,removeClassNamesFromElement:Gx,$splitNode:Ls,isBlockDomNode:dh,isHTMLAnchorElement:hh,isHTMLElement:gh,isInlineDomNode:Zn},Symbol.toStringTag,{value:"Module"}));function dN(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var fo=dN(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 nt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,hN=nt&&"documentMode"in document?document.documentMode:null,gN=nt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),pN=nt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),_N=!(!nt||!("InputEvent"in window)||hN)&&"getTargetRanges"in new window.InputEvent("input"),mN=nt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),yN=nt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Jh=nt&&/Android/.test(navigator.userAgent),xc=nt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),TN=nt&&Jh&&xc,xN=nt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!xc;function Gh(...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 qh(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}function _t(n){return`${n}px`}const NN={attributes:!0,characterData:!0,childList:!0,subtree:!0};function Xh(n,e,t){let r=null,o=null,s=null,i=[];const l=document.createElement("div");function c(){r===null&&fo(182),o===null&&fo(183);const{left:d,top:f}=r.getBoundingClientRect(),h=o,g=Kh(n,e);l.isConnected||h.append(l);let p=!1;for(let _=0;_<g.length;_++){const y=g[_],m=i[_]||document.createElement("div"),T=m.style;T.position!=="absolute"&&(T.position="absolute",p=!0);const N=_t(y.left-d);T.left!==N&&(T.left=N,p=!0);const C=_t(y.top-f);T.top!==C&&(m.style.top=C,p=!0);const S=_t(y.width);T.width!==S&&(m.style.width=S,p=!0);const E=_t(y.height);T.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 u=n.registerRootListener(function d(){const f=n.getRootElement();if(f===null)return a();const h=f.parentElement;if(!(h instanceof HTMLElement))return a();a(),r=f,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,NN),c()});return()=>{u(),a()}}function CN(n,e){let t=null,r=null,o=null,s=null,i=()=>{};function l(c){c.read(()=>{const a=z();if(!$(a))return t=null,r=null,o=null,s=null,i(),void(i=()=>{});const{anchor:u,focus:d}=a,f=u.getNode(),h=f.getKey(),g=u.offset,p=d.getNode(),_=p.getKey(),y=d.offset,m=n.getElementByKey(h),T=n.getElementByKey(_),N=t===null||m===null||g!==r||h!==t.getKey()||f!==t&&(!(t instanceof Xn)||f.updateDOM(t,m,n._config)),C=o===null||T===null||y!==s||_!==o.getKey()||p!==o&&(!(o instanceof Xn)||p.updateDOM(o,T,n._config));if(N||C){const S=n.getElementByKey(u.getNode().getKey()),E=n.getElementByKey(d.getNode().getKey());if(S!==null&&E!==null&&S.tagName==="SPAN"&&E.tagName==="SPAN"){const v=document.createRange();let O,M,I,J;d.isBefore(u)?(O=E,M=d.offset,I=S,J=u.offset):(O=S,M=u.offset,I=E,J=d.offset);const X=O.firstChild;X===null&&fo(181);const G=I.firstChild;G===null&&fo(181),v.setStart(X,M),v.setEnd(G,J),i(),i=Xh(n,v,ne=>{for(const me of ne){const Z=me.style;Z.background!=="Highlight"&&(Z.background="Highlight"),Z.color!=="HighlightText"&&(Z.color="HighlightText"),Z.zIndex!=="-1"&&(Z.zIndex="-1"),Z.pointerEvents!=="none"&&(Z.pointerEvents="none"),Z.marginTop!==_t(-1.5)&&(Z.marginTop=_t(-1.5)),Z.paddingTop!==_t(4)&&(Z.paddingTop=_t(4)),Z.paddingBottom!==_t(0)&&(Z.paddingBottom=_t(0))}e!==void 0&&e(ne)})}}t=f,r=g,o=p,s=y})}return l(n.getEditorState()),qh(n.registerUpdateListener(({editorState:c})=>l(c)),i,()=>{i()})}const SN=_N,EN=nt,vN=Jh,ON=TN,bN=gN,wN=xN,DN=xc,Zh=pN,MN=yN,AN=mN;function kN(n,...e){const t=Gh(...e);t.length>0&&n.classList.add(...t)}function PN(n,...e){const t=Gh(...e);t.length>0&&n.classList.remove(...t)}function Qh(n,e){for(const t of e)if(n.type.startsWith(t))return!0;return!1}function RN(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 u=a.result;typeof u=="string"&&s.push({file:c,result:u}),i()}),Qh(c,e)?a.readAsDataURL(c):i()};i()})}function $N(n,e){const t=[],r=(n||_e()).getLatest(),o=e||W(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}),W(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 IN(n){let e=n;if(W(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 LN(n,e){let t=n;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function FN(n){const e=eg(n,t=>W(t)&&!t.isInline());return W(e)||fo(4,n.__key),e}const eg=(n,e)=>{let t=n;for(;t!==_e()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function BN(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 f=c[d];if(o(f))return null}let a=l,u=l;for(;a!==null;)if(u=a,a=a.getParent(),o(a))return{child:u,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(),u=a.length;if(c.insertAfter(l),u!==0){const d=t(c);l.insertAfter(d);for(let f=0;f<u;f++)d.append(a[f])}c.canBeEmpty()||c.getChildrenSize()!==0||c.remove()}}})}function KN(n,e){const t=new Map,r=n._pendingEditorState;for(const[s,i]of e._nodeMap)t.set(s,Jt(i));r&&(r._nodeMap=t),n._dirtyType=2;const o=e._selection;Is(o===null?null:o.clone())}function zN(n){const e=z()||Hn();if($(e)){const{focus:t}=e,r=t.getNode(),o=t.offset;if(Fe(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]=Ls(s,i);l.insertBefore(n),l.selectStart()}}else{if(e!=null){const r=e.getNodes();r[r.length-1].getTopLevelElementOrThrow().insertAfter(n)}else _e().append(n);const t=ao();n.insertAfter(t),t.select()}return n.getLatest()}function WN(n,e){const t=e();return n.replace(t),t.append(n),t}function UN(n,e){return n!==null&&Object.getPrototypeOf(n).constructor.name===e.name}function jN(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 HN(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function YN(n){if(Zh)return 1;let e=1;for(;n;)e*=Number(window.getComputedStyle(n).getPropertyValue("zoom")),n=n.parentElement;return e}function VN(n){return n._parentEditor!==null}const JN=Object.freeze(Object.defineProperty({__proto__:null,$dfs:$N,$filter:jN,$findMatchingParent:eg,$getNearestBlockElementAncestorOrThrow:FN,$getNearestNodeOfType:LN,$getNextRightPreorderNode:IN,$insertFirst:HN,$insertNodeToNearestRoot:zN,$isEditorIsNestedEditor:VN,$restoreEditorState:KN,$wrapNodeInElement:WN,CAN_USE_BEFORE_INPUT:SN,CAN_USE_DOM:EN,IS_ANDROID:vN,IS_ANDROID_CHROME:ON,IS_APPLE:bN,IS_APPLE_WEBKIT:wN,IS_CHROME:DN,IS_FIREFOX:Zh,IS_IOS:MN,IS_SAFARI:AN,addClassNamesToElement:kN,calculateZoomLevel:YN,isMimeType:Qh,markSelection:CN,mediaFileReader:RN,mergeRegister:qh,objectKlassEquals:UN,positionNodeOnRange:Xh,registerNestedElementResolver:BN,removeClassNamesFromElement:PN,$splitNode:Ls,isBlockDomNode:dh,isHTMLAnchorElement:hh,isHTMLElement:gh,isInlineDomNode:Zn},Symbol.toStringTag,{value:"Module"})),Gs=process.env.NODE_ENV==="development"?fN:JN,qs=Gs.isBlockDomNode,tg=Gs.isHTMLElement,_n=Gs.mergeRegister,Xs=Gs.objectKlassEquals;function GN(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,u,d,f,h,g]=c;n.update(()=>{const p=z();if($(p)){const _=p.anchor;let y=_.getNode(),m=0,T=0;if(L(y)&&a>=0&&u>=0&&(m=a,T=a+u,p.setTextNodeRange(y,m,y,T)),(m!==T||d!=="")&&(p.insertRawText(d),y=_.getNode()),L(y)){m=f,T=f+h;const N=y.getTextContentSize();m=m>N?N:m,T=T>N?N:T,p.setTextNodeRange(y,m,y,T)}r.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}const qN=Object.freeze(Object.defineProperty({__proto__:null,registerDragonSupport:GN},Symbol.toStringTag,{value:"Module"}));function XN(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,u,d,f,h,g]=c;n.update(()=>{const p=z();if($(p)){const _=p.anchor;let y=_.getNode(),m=0,T=0;if(L(y)&&a>=0&&u>=0&&(m=a,T=a+u,p.setTextNodeRange(y,m,y,T)),m===T&&d===""||(p.insertRawText(d),y=_.getNode()),L(y)){m=f,T=f+h;const N=y.getTextContentSize();m=m>N?N:m,T=T>N?N:T,p.setTextNodeRange(y,m,y,T)}r.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}const ZN=Object.freeze(Object.defineProperty({__proto__:null,registerDragonSupport:XN},Symbol.toStringTag,{value:"Module"})),QN=(process.env.NODE_ENV==="development"?qN:ZN).registerDragonSupport;function eC(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(!rg.has(i.nodeName)){const l=og(i,n,o,!1);l!==null&&(r=r.concat(l))}}return rC(o),r}function tC(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=_e().getChildren();for(let s=0;s<o.length;s++){const i=o[s];ng(n,i,t,e)}return t.innerHTML}function ng(n,e,t,r=null){let o=r!==null?e.isSelected(r):!0;const s=W(e)&&e.excludeFromCopy("html");let i=e;if(r!==null){let h=Jt(e);h=L(h)&&r!==null?Js(r,h):h,i=h}const l=W(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:u,after:d}=a;if(!u)return!1;const f=document.createDocumentFragment();for(let h=0;h<l.length;h++){const g=l[h],p=ng(n,g,f,r);!o&&W(e)&&p&&e.extractWithChild(g,r,"html")&&(o=!0)}if(o&&!s){if(tg(u)&&u.append(f),t.append(u),d){const h=d.call(i,u);h&&u.replaceWith(h)}}else t.append(f);return o}function nC(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 rg=new Set(["STYLE","SCRIPT"]);function og(n,e,t,r,o=new Map,s){let i=[];if(rg.has(n.nodeName))return i;let l=null;const c=nC(n,e),a=c?c(n):null;let u=null;if(a!==null){u=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 f=[];const h=l!=null&&Fe(l)?!1:l!=null&&Yn(l)||r;for(let g=0;g<d.length;g++)f.push(...og(d[g],e,t,h,new Map(o),l));return u!=null&&(f=u(f)),qs(n)&&(h?f=sg(n,f,()=>{const g=new Fs;return t.push(g),g}):f=sg(n,f,ao)),l==null?f.length>0?i=i.concat(f):qs(n)&&oC(n)&&(i=i.concat($s())):W(l)&&l.append(...f),i}function sg(n,e,t){const r=n.style.textAlign,o=[];let s=[];for(let i=0;i<e.length;i++){const l=e[i];if(Yn(l))r&&!l.getFormat()&&l.setFormat(r),o.push(l);else if(s.push(l),i===e.length-1||i<e.length-1&&Yn(e[i+1])){const c=t();c.setFormat(r),c.append(...s),o.push(c),s=[]}}return o}function rC(n){for(const e of n)e.getNextSibling()instanceof Fs&&e.insertAfter($s());for(const e of n){const t=e.getChildren();for(const r of t)e.insertBefore(r);e.remove()}}function oC(n){return n.nextSibling==null||n.previousSibling==null?!1:Zn(n.nextSibling)&&Zn(n.previousSibling)}const sC=Object.freeze(Object.defineProperty({__proto__:null,$generateHtmlFromNodes:tC,$generateNodesFromDOM:eC},Symbol.toStringTag,{value:"Module"}));function iC(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(!lg.has(i.nodeName)){const l=cg(i,n,o,!1);l!==null&&(r=r.concat(l))}}return function(s){for(const i of s)i.getNextSibling()instanceof Fs&&i.insertAfter($s());for(const i of s){const l=i.getChildren();for(const c of l)i.insertBefore(c);i.remove()}}(o),r}function lC(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=_e().getChildren();for(let o=0;o<r.length;o++)ig(n,r[o],t,e);return t.innerHTML}function ig(n,e,t,r=null){let o=r===null||e.isSelected(r);const s=W(e)&&e.excludeFromCopy("html");let i=e;if(r!==null){let h=Jt(e);h=L(h)&&r!==null?Js(r,h):h,i=h}const l=W(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:u,after:d}=a;if(!u)return!1;const f=document.createDocumentFragment();for(let h=0;h<l.length;h++){const g=l[h],p=ig(n,g,f,r);!o&&W(e)&&p&&e.extractWithChild(g,r,"html")&&(o=!0)}if(o&&!s){if(tg(u)&&u.append(f),t.append(u),d){const h=d.call(i,u);h&&u.replaceWith(h)}}else t.append(f);return o}const lg=new Set(["STYLE","SCRIPT"]);function cg(n,e,t,r,o=new Map,s){let i=[];if(lg.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 T of y){const N=T(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 u=null;if(a!==null){u=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 f=[];const h=(l==null||!Fe(l))&&(l!=null&&Yn(l)||r);for(let g=0;g<d.length;g++)f.push(...cg(d[g],e,t,h,new Map(o),l));return u!=null&&(f=u(f)),qs(n)&&(f=cC(n,f,h?()=>{const g=new Fs;return t.push(g),g}:ao)),l==null?f.length>0?i=i.concat(f):qs(n)&&function(g){return g.nextSibling==null||g.previousSibling==null?!1:Zn(g.nextSibling)&&Zn(g.previousSibling)}(n)&&(i=i.concat($s())):W(l)&&l.append(...f),i}function cC(n,e,t){const r=n.style.textAlign,o=[];let s=[];for(let i=0;i<e.length;i++){const l=e[i];if(Yn(l))r&&!l.getFormat()&&l.setFormat(r),o.push(l);else if(s.push(l),i===e.length-1||i<e.length-1&&Yn(e[i+1])){const c=t();c.setFormat(r),c.append(...s),o.push(c),s=[]}}return o}const aC=Object.freeze(Object.defineProperty({__proto__:null,$generateHtmlFromNodes:lC,$generateNodesFromDOM:iC},Symbol.toStringTag,{value:"Module"})),ag=process.env.NODE_ENV==="development"?sC:aC,ug=ag.$generateHtmlFromNodes,fg=ag.$generateNodesFromDOM,uC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",dg=n=>uC?(n||window).getSelection():null;function hg(n,e=z()){if(e==null)throw Error("Expected valid LexicalSelection");return $(e)&&e.isCollapsed()||e.getNodes().length===0?"":ug(n,e)}function gg(n,e=z()){if(e==null)throw Error("Expected valid LexicalSelection");return $(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(_g(n,e))}function fC(n,e){const t=n.getData("text/plain")||n.getData("text/uri-list");t!=null&&e.insertRawText(t)}function dC(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=mg(i.nodes);return Nc(t,l,e)}}catch{}const o=n.getData("text/html");if(o)try{const l=new DOMParser().parseFromString(o,"text/html"),c=fg(t,l);return Nc(t,c,e)}catch{}const s=n.getData("text/plain")||n.getData("text/uri-list");if(s!=null)if($(e)){const i=s.split(/(\r?\n|\t)/);i[i.length-1]===""&&i.pop();for(let l=0;l<i.length;l++){const c=z();if($(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([
|
|
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([Rd()]):c.insertText(a)}}}else e.insertRawText(s)}function Cc(n,e,t){n.dispatchCommand(ah,{nodes:e,selection:t})||t.insertNodes(e)}function Eg(n,e,t,r=[]){let o=e===null||t.isSelected(e);const s=W(t)&&t.excludeFromCopy("html");let i=t;if(e!==null){let a=Jt(t);a=L(a)&&e!==null?Js(e,a):a,i=a}const l=W(i)?i.getChildren():[],c=function(a){const u=a.exportJSON(),d=a.constructor;if(u.type!==d.getType()&&Zs(58,d.name),W(a)){const f=u.children;Array.isArray(f)||Zs(59,d.name)}return u}(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 u=l[a],d=Eg(n,e,u,c.children);!o&&W(t)&&d&&t.extractWithChild(u,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 u=c.children[a];r.push(u)}return o}function vg(n,e){const t=[],r=_e().getChildren();for(let o=0;o<r.length;o++)Eg(n,e,r[o],t);return{namespace:n._config.namespace,nodes:t}}function Og(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t],o=Ud(r);L(o)&&Bh(o),e.push(o)}return e}let nr=null;async function CC(n,e,t){if(nr!==null)return!1;if(e!==null)return new Promise((c,a)=>{n.update(()=>{c(bg(n,e,t))})});const r=n.getRootElement(),o=n._window==null?window.document:n._window.document,s=Ng(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 u=n.registerCommand(Bs,d=>(Xs(d,ClipboardEvent)&&(u(),nr!==null&&(window.clearTimeout(nr),nr=null),c(bg(n,d,t))),!0),Vd);nr=window.setTimeout(()=>{u(),nr=null,c(!1)},50),o.execCommand("copy"),i.remove()})}function bg(n,e,t){if(t===void 0){const o=Ng(n._window);if(!o)return!1;const s=o.anchorNode,i=o.focusNode;if(s!==null&&i!==null&&!ph(n,s,i))return!1;const l=z();if(l===null)return!1;t=wg(l)}e.preventDefault();const r=e.clipboardData;return r!==null&&(Dg(r,t),!0)}const SC=[["text/html",Cg],["application/x-lexical-editor",Sg]];function wg(n=z()){const e={"text/plain":n?n.getTextContent():""};if(n){const t=Ld();for(const[r,o]of SC){const s=o(t,n);s!==null&&(e[r]=s)}}return e}function Dg(n,e){for(const t in e){const r=e[t];r!==void 0&&n.setData(t,r)}}const EC=Object.freeze(Object.defineProperty({__proto__:null,$generateJSONFromSelectedNodes:vg,$generateNodesFromSerializedNodes:Og,$getClipboardDataFromSelection:wg,$getHtmlContent:Cg,$getLexicalContent:Sg,$insertDataTransferForPlainText:xC,$insertDataTransferForRichText:NC,$insertGeneratedNodes:Cc,copyToClipboard:CC,setLexicalClipboardDataTransfer:Dg},Symbol.toStringTag,{value:"Module"})),Mg=process.env.NODE_ENV==="development"?mC:EC,Ag=Mg.$getHtmlContent,Qs=Mg.$insertDataTransferForPlainText,rr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",vC=rr&&"documentMode"in document?document.documentMode:null,OC=rr&&"InputEvent"in window&&!vC?"getTargetRanges"in new window.InputEvent("input"):!1,bC=rr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),wC=rr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,DC=rr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),MC=rr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!DC;function kg(n,e){e.update(()=>{if(n!==null){const t=Xs(n,KeyboardEvent)?null:n.clipboardData,r=z();if(r!==null&&t!=null){n.preventDefault();const o=Ag(e);o!==null&&t.setData("text/html",o),t.setData("text/plain",r.getTextContent())}}})}function AC(n,e){n.preventDefault(),e.update(()=>{const t=z(),{clipboardData:r}=n;r!=null&&$(t)&&Qs(r,t)},{tag:"paste"})}function kC(n,e){kg(n,e),e.update(()=>{const t=z();$(t)&&t.removeText()})}function PC(n){return _n(n.registerCommand(qn,t=>{const r=z();return $(r)?(r.deleteCharacter(t),!0):!1},V),n.registerCommand(Xd,t=>{const r=z();return $(r)?(r.deleteWord(t),!0):!1},V),n.registerCommand(qd,t=>{const r=z();return $(r)?(r.deleteLine(t),!0):!1},V),n.registerCommand(Jd,t=>{const r=z();if(!$(r))return!1;if(typeof t=="string")r.insertText(t);else{const o=t.dataTransfer;if(o!=null)Qs(o,r);else{const s=t.data;s&&r.insertText(s)}}return!0},V),n.registerCommand(ch,()=>{const t=z();return $(t)?(t.removeText(),!0):!1},V),n.registerCommand(Ks,t=>{const r=z();return $(r)?(r.insertLineBreak(t),!0):!1},V),n.registerCommand(eh,()=>{const t=z();return $(t)?(t.insertLineBreak(),!0):!1},V),n.registerCommand(th,t=>{const r=z();if(!$(r))return!1;const o=t,s=o.shiftKey;return Vs(r,!0)?(o.preventDefault(),Ys(r,s,!0),!0):!1},V),n.registerCommand(nh,t=>{const r=z();if(!$(r))return!1;const o=t,s=o.shiftKey;return Vs(r,!1)?(o.preventDefault(),Ys(r,s,!1),!0):!1},V),n.registerCommand(rh,t=>{const r=z();return $(r)?(t.preventDefault(),n.dispatchCommand(qn,!0)):!1},V),n.registerCommand(oh,t=>{const r=z();return $(r)?(t.preventDefault(),n.dispatchCommand(qn,!1)):!1},V),n.registerCommand(sh,t=>{const r=z();if(!$(r))return!1;if(t!==null){if((wC||bC||MC)&&OC)return!1;t.preventDefault()}return n.dispatchCommand(Ks,!1)},V),n.registerCommand(uh,()=>(jd(),!0),V),n.registerCommand(Bs,t=>{const r=z();return $(r)?(kg(t,n),!0):!1},V),n.registerCommand(Gd,t=>{const r=z();return $(r)?(kC(t,n),!0):!1},V),n.registerCommand(ih,t=>{const r=z();return $(r)?(AC(t,n),!0):!1},V),n.registerCommand(Qd,t=>{const r=z();return $(r)?(t.preventDefault(),!0):!1},V),n.registerCommand(Zd,t=>{const r=z();return $(r)?(t.preventDefault(),!0):!1},V))}const RC=Object.freeze(Object.defineProperty({__proto__:null,registerPlainText:PC},Symbol.toStringTag,{value:"Module"})),or=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,$C=or&&"documentMode"in document?document.documentMode:null,IC=!(!or||!("InputEvent"in window)||$C)&&"getTargetRanges"in new window.InputEvent("input"),LC=or&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),FC=or&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,BC=or&&/^(?=.*Chrome).*/i.test(navigator.userAgent),KC=or&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!BC;function Pg(n,e){e.update(()=>{if(n!==null){const t=Xs(n,KeyboardEvent)?null:n.clipboardData,r=z();if(r!==null&&t!=null){n.preventDefault();const o=Ag(e);o!==null&&t.setData("text/html",o),t.setData("text/plain",r.getTextContent())}}})}function zC(n){return _n(n.registerCommand(qn,e=>{const t=z();return!!$(t)&&(t.deleteCharacter(e),!0)},V),n.registerCommand(Xd,e=>{const t=z();return!!$(t)&&(t.deleteWord(e),!0)},V),n.registerCommand(qd,e=>{const t=z();return!!$(t)&&(t.deleteLine(e),!0)},V),n.registerCommand(Jd,e=>{const t=z();if(!$(t))return!1;if(typeof e=="string")t.insertText(e);else{const r=e.dataTransfer;if(r!=null)Qs(r,t);else{const o=e.data;o&&t.insertText(o)}}return!0},V),n.registerCommand(ch,()=>{const e=z();return!!$(e)&&(e.removeText(),!0)},V),n.registerCommand(Ks,e=>{const t=z();return!!$(t)&&(t.insertLineBreak(e),!0)},V),n.registerCommand(eh,()=>{const e=z();return!!$(e)&&(e.insertLineBreak(),!0)},V),n.registerCommand(th,e=>{const t=z();if(!$(t))return!1;const r=e,o=r.shiftKey;return!!Vs(t,!0)&&(r.preventDefault(),Ys(t,o,!0),!0)},V),n.registerCommand(nh,e=>{const t=z();if(!$(t))return!1;const r=e,o=r.shiftKey;return!!Vs(t,!1)&&(r.preventDefault(),Ys(t,o,!1),!0)},V),n.registerCommand(rh,e=>{const t=z();return!!$(t)&&(e.preventDefault(),n.dispatchCommand(qn,!0))},V),n.registerCommand(oh,e=>{const t=z();return!!$(t)&&(e.preventDefault(),n.dispatchCommand(qn,!1))},V),n.registerCommand(sh,e=>{const t=z();if(!$(t))return!1;if(e!==null){if((FC||LC||KC)&&IC)return!1;e.preventDefault()}return n.dispatchCommand(Ks,!1)},V),n.registerCommand(uh,()=>(jd(),!0),V),n.registerCommand(Bs,e=>{const t=z();return!!$(t)&&(Pg(e,n),!0)},V),n.registerCommand(Gd,e=>{const t=z();return!!$(t)&&(function(r,o){Pg(r,o),o.update(()=>{const s=z();$(s)&&s.removeText()})}(e,n),!0)},V),n.registerCommand(ih,e=>{const t=z();return!!$(t)&&(function(r,o){r.preventDefault(),o.update(()=>{const s=z(),{clipboardData:i}=r;i!=null&&$(s)&&Qs(i,s)},{tag:"paste"})}(e,n),!0)},V),n.registerCommand(Qd,e=>{const t=z();return!!$(t)&&(e.preventDefault(),!0)},V),n.registerCommand(Zd,e=>{const t=z();return!!$(t)&&(e.preventDefault(),!0)},V))}const WC=Object.freeze(Object.defineProperty({__proto__:null,registerPlainText:zC},Symbol.toStringTag,{value:"Module"})),UC=(process.env.NODE_ENV==="development"?RC:WC).registerPlainText,Sc=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?q.useLayoutEffect:q.useEffect;function Rg(n){return n.getEditorState().read(Ch(n.isComposing()))}function jC({contentEditable:n,placeholder:e=null,ErrorBoundary:t}){const[r]=pn(),o=function(s,i){const[l,c]=q.useState(()=>s.getDecorators());return Sc(()=>s.registerDecoratorListener(a=>{Rc.flushSync(()=>{c(a)})}),[s]),q.useEffect(()=>{c(s.getDecorators())},[s]),q.useMemo(()=>{const a=[],u=Object.keys(l);for(let d=0;d<u.length;d++){const f=u[d],h=ue.exports.jsx(i,{onError:p=>s._onError(p),children:ue.exports.jsx(q.Suspense,{fallback:null,children:l[f]})}),g=s.getElementByKey(f);g!==null&&a.push(Rc.createPortal(h,g,f))}return a},[i,l,s])}(r,t);return function(s){Sc(()=>_n(UC(s),QN(s)),[s])}(r),ue.exports.jsxs(ue.exports.Fragment,{children:[n,ue.exports.jsx(HC,{content:e}),o]})}function HC({content:n}){const[e]=pn(),t=function(o){const[s,i]=q.useState(()=>Rg(o));return Sc(()=>{function l(){const c=Rg(o);i(c)}return l(),_n(o.registerUpdateListener(()=>{l()}),o.registerEditableListener(()=>{l()}))},[o]),s}(e),r=LT();return t?typeof n=="function"?n(r):n:null}const $g=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?q.useLayoutEffect:q.useEffect;function YC({editor:n,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:r,ariaDescribedBy:o,ariaExpanded:s,ariaLabel:i,ariaLabelledBy:l,ariaMultiline:c,ariaOwns:a,ariaRequired:u,autoCapitalize:d,className:f,id:h,role:g="textbox",spellCheck:p=!0,style:_,tabIndex:y,"data-testid":m,...T},N){const[C,S]=q.useState(n.isEditable()),E=q.useCallback(O=>{O&&O.ownerDocument&&O.ownerDocument.defaultView?n.setRootElement(O):n.setRootElement(null)},[n]),v=q.useMemo(()=>function(...O){return M=>{O.forEach(I=>{typeof I=="function"?I(M):I!=null&&(I.current=M)})}}(N,E),[E,N]);return $g(()=>(S(n.isEditable()),n.registerEditableListener(O=>{S(O)})),[n]),ue.exports.jsx("div",{...T,"aria-activedescendant":C?e:void 0,"aria-autocomplete":C?t:"none","aria-controls":C?r:void 0,"aria-describedby":o,"aria-expanded":C&&g==="combobox"?!!s:void 0,"aria-label":i,"aria-labelledby":l,"aria-multiline":c,"aria-owns":C?a:void 0,"aria-readonly":!C||void 0,"aria-required":u,autoCapitalize:d,className:f,contentEditable:C,"data-testid":m,id:h,ref:v,role:C?g:void 0,spellCheck:p,style:_,tabIndex:y})}const VC=q.forwardRef(YC);function Ig(n){return n.getEditorState().read(Ch(n.isComposing()))}const JC=q.forwardRef(GC);function GC(n,e){const{placeholder:t,...r}=n,[o]=pn();return ue.exports.jsxs(ue.exports.Fragment,{children:[ue.exports.jsx(VC,{editor:o,...r,ref:e}),t!=null&&ue.exports.jsx(qC,{editor:o,content:t})]})}function qC({content:n,editor:e}){const t=function(i){const[l,c]=q.useState(()=>Ig(i));return $g(()=>{function a(){const u=Ig(i);c(u)}return a(),_n(i.registerUpdateListener(()=>{a()}),i.registerEditableListener(()=>{a()}))},[i]),l}(e),[r,o]=q.useState(e.isEditable());if(q.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:ue.exports.jsx("div",{"aria-hidden":!0,children:s})}const ei=0,Ec=1,vc=2,rt=0,XC=1,Lg=2,ZC=3,QC=4;function eS(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&&!Jn(l)&&o.push(l)}return o}function tS(n,e,t,r,o){if(n===null||t.size===0&&r.size===0&&!o)return rt;const s=e._selection,i=n._selection;if(o)return XC;if(!$(s)||!$(i)||!i.isCollapsed()||!s.isCollapsed())return rt;const l=eS(e,t,r);if(l.length===0)return rt;if(l.length>1){const y=e._nodeMap,m=y.get(s.anchor.key),T=y.get(i.anchor.key);return m&&T&&!n._nodeMap.has(m.__key)&&L(m)&&m.__text.length===1&&s.anchor.offset===1?Lg:rt}const c=l[0],a=n._nodeMap.get(c.__key);if(!L(a)||!L(c)||a.__mode!==c.__mode)return rt;const u=a.__text,d=c.__text;if(u===d)return rt;const f=s.anchor,h=i.anchor;if(f.key!==h.key||f.type!=="text")return rt;const g=f.offset,p=h.offset,_=d.length-u.length;return _===1&&p===g-1?Lg:_===-1&&p===g+1?ZC:_===-1&&p===g?QC:rt}function nS(n,e,t){const r=e._nodeMap.get(n),o=t._nodeMap.get(n),s=e._selection,i=t._selection;return!($(s)&&$(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 rS(n,e){let t=Date.now(),r=rt;return(o,s,i,l,c,a)=>{const u=Date.now();if(a.has("historic"))return r=rt,t=u,vc;const d=tS(o,s,l,c,n.isComposing()),f=(()=>{const h=i===null||i.editor===n,g=a.has("history-push");if(!g&&h&&a.has("history-merge"))return ei;if(o===null)return Ec;const _=s._selection;if(!(l.size>0||c.size>0))return _!==null?ei:vc;if(g===!1&&d!==rt&&d===r&&u<t+e&&h)return ei;if(l.size===1){const m=Array.from(l)[0];if(nS(m,o,s))return ei}return Ec})();return t=u,r=d,f}}function oS(n,e){const t=e.redoStack,r=e.undoStack;if(t.length!==0){const o=e.current;o!==null&&(r.push(o),n.dispatchCommand(qt,!0));const s=t.pop();t.length===0&&n.dispatchCommand(Gt,!1),e.current=s||null,s&&s.editor.setEditorState(s.editorState,{tag:"historic"})}}function sS(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(Gt,!0)),r.length===0&&n.dispatchCommand(qt,!1),e.current=i||null,i&&i.editor.setEditorState(i.editorState,{tag:"historic"})}}function Fg(n){n.undoStack=[],n.redoStack=[],n.current=null}function iS(n,e,t){const r=rS(n,t),o=({editorState:i,prevEditorState:l,dirtyLeaves:c,dirtyElements:a,tags:u})=>{const d=e.current,f=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,u);if(p===Ec)f.length!==0&&(e.redoStack=[],n.dispatchCommand(Gt,!1)),d!==null&&(h.push({...d}),n.dispatchCommand(qt,!0));else if(p===vc)return;e.current={editor:n,editorState:i}};return _n(n.registerCommand(fh,()=>(sS(n,e),!0),V),n.registerCommand(lh,()=>(oS(n,e),!0),V),n.registerCommand(Hd,()=>(Fg(e),!1),V),n.registerCommand(Yd,()=>(Fg(e),n.dispatchCommand(Gt,!1),n.dispatchCommand(qt,!1),!0),V),n.registerUpdateListener(o))}function lS(){return{current:null,redoStack:[],undoStack:[]}}const cS=Object.freeze(Object.defineProperty({__proto__:null,createEmptyHistoryState:lS,registerHistory:iS},Symbol.toStringTag,{value:"Module"})),ti=0,Oc=1,bc=2,ot=0,aS=1,Bg=2,uS=3,fS=4;function dS(n,e,t,r,o){if(n===null||t.size===0&&r.size===0&&!o)return ot;const s=e._selection,i=n._selection;if(o)return aS;if(!($(s)&&$(i)&&i.isCollapsed()&&s.isCollapsed()))return ot;const l=function(y,m,T){const N=y._nodeMap,C=[];for(const S of m){const E=N.get(S);E!==void 0&&C.push(E)}for(const[S,E]of T){if(!E)continue;const v=N.get(S);v===void 0||Jn(v)||C.push(v)}return C}(e,t,r);if(l.length===0)return ot;if(l.length>1){const y=e._nodeMap,m=y.get(s.anchor.key),T=y.get(i.anchor.key);return m&&T&&!n._nodeMap.has(m.__key)&&L(m)&&m.__text.length===1&&s.anchor.offset===1?Bg:ot}const c=l[0],a=n._nodeMap.get(c.__key);if(!L(a)||!L(c)||a.__mode!==c.__mode)return ot;const u=a.__text,d=c.__text;if(u===d)return ot;const f=s.anchor,h=i.anchor;if(f.key!==h.key||f.type!=="text")return ot;const g=f.offset,p=h.offset,_=d.length-u.length;return _===1&&p===g-1?Bg:_===-1&&p===g+1?uS:_===-1&&p===g?fS:ot}function hS(n,e){let t=Date.now(),r=ot;return(o,s,i,l,c,a)=>{const u=Date.now();if(a.has("historic"))return r=ot,t=u,bc;const d=dS(o,s,l,c,n.isComposing()),f=(()=>{const h=i===null||i.editor===n,g=a.has("history-push");if(!g&&h&&a.has("history-merge"))return ti;if(o===null)return Oc;const p=s._selection;return l.size>0||c.size>0?g===!1&&d!==ot&&d===r&&u<t+e&&h||l.size===1&&function(_,y,m){const T=y._nodeMap.get(_),N=m._nodeMap.get(_),C=y._selection,S=m._selection;return!($(C)&&$(S)&&C.anchor.type==="element"&&C.focus.type==="element"&&S.anchor.type==="text"&&S.focus.type==="text"||!L(T)||!L(N)||T.__parent!==N.__parent)&&JSON.stringify(y.read(()=>T.exportJSON()))===JSON.stringify(m.read(()=>N.exportJSON()))}(Array.from(l)[0],o,s)?ti:Oc:p!==null?ti:bc})();return t=u,r=d,f}}function Kg(n){n.undoStack=[],n.redoStack=[],n.current=null}function gS(n,e,t){const r=hS(n,t);return _n(n.registerCommand(fh,()=>(function(s,i){const l=i.redoStack,c=i.undoStack;if(c.length!==0){const a=i.current,u=c.pop();a!==null&&(l.push(a),s.dispatchCommand(Gt,!0)),c.length===0&&s.dispatchCommand(qt,!1),i.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:"historic"})}}(n,e),!0),V),n.registerCommand(lh,()=>(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(qt,!0));const u=l.pop();l.length===0&&s.dispatchCommand(Gt,!1),i.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:"historic"})}}(n,e),!0),V),n.registerCommand(Hd,()=>(Kg(e),!1),V),n.registerCommand(Yd,()=>(Kg(e),n.dispatchCommand(Gt,!1),n.dispatchCommand(qt,!1),!0),V),n.registerUpdateListener(({editorState:s,prevEditorState:i,dirtyLeaves:l,dirtyElements:c,tags:a})=>{const u=e.current,d=e.redoStack,f=e.undoStack,h=u===null?null:u.editorState;if(u!==null&&s===h)return;const g=r(i,s,u,l,c,a);if(g===Oc)d.length!==0&&(e.redoStack=[],n.dispatchCommand(Gt,!1)),u!==null&&(f.push({...u}),n.dispatchCommand(qt,!0));else if(g===bc)return;e.current={editor:n,editorState:s}}))}function pS(){return{current:null,redoStack:[],undoStack:[]}}const _S=Object.freeze(Object.defineProperty({__proto__:null,createEmptyHistoryState:pS,registerHistory:gS},Symbol.toStringTag,{value:"Module"})),zg=process.env.NODE_ENV==="development"?cS:_S,mS=zg.createEmptyHistoryState,yS=zg.registerHistory;function TS({delay:n,externalHistoryState:e}){const[t]=pn();return function(r,o,s=1e3){const i=q.useMemo(()=>o||mS(),[o]);q.useEffect(()=>yS(r,i,s),[s,r,i])}(t,e,n),null}const xS=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?q.useLayoutEffect:q.useEffect;function NS({ignoreHistoryMergeTagChange:n=!0,ignoreSelectionChange:e=!1,onChange:t}){const[r]=pn();return xS(()=>{if(t)return r.registerUpdateListener(({editorState:o,dirtyElements:s,dirtyLeaves:i,prevEditorState:l,tags:c})=>{e&&s.size===0&&i.size===0||n&&c.has("history-merge")||l.isEmpty()||t(o,r,c)})},[r,n,e,t]),null}function wc(n,e){return wc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},wc(n,e)}var Wg={error:null},CS=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=Wg,s.resetErrorBoundary=function(){for(var a,u=arguments.length,d=new Array(u),f=0;f<u;f++)d[f]=arguments[f];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,wc(e,t),r.getDerivedStateFromError=function(s){return{error:s}};var o=r.prototype;return o.reset=function(){this.setState(Wg)},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,u,d=this.state.error,f=this.props.resetKeys;d!==null&&i.error!==null&&((a=s.resetKeys)===void 0&&(a=[]),(u=f)===void 0&&(u=[]),a.length!==u.length||a.some(function(h,g){return!Object.is(h,u[g])}))&&((l=(c=this.props).onResetKeysChange)==null||l.call(c,s.resetKeys,f),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 u={error:s,resetErrorBoundary:this.resetErrorBoundary};if(si.isValidElement(a))return a;if(typeof l=="function")return l(u);if(c)return si.createElement(c,u);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},r}(si.Component);function SS({children:n,onError:e}){return ue.exports.jsx(CS,{fallback:ue.exports.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:n})}const ES={};function vS(n){n.read(()=>{const e=_e(),t=z();console.log(e,t)})}function OS(){const[n]=pn();return q.useEffect(()=>{n.focus()},[n]),null}function bS(n){console.error(n)}function wS(){const n={namespace:"MyEditor",theme:ES,onError:bS};return ue.exports.jsxs(RT,{initialConfig:n,children:[ue.exports.jsx(jC,{contentEditable:ue.exports.jsx(JC,{}),placeholder:ue.exports.jsx("div",{children:"Enter some text..."}),ErrorBoundary:SS}),ue.exports.jsx(NS,{onChange:vS}),ue.exports.jsx(TS,{}),ue.exports.jsx(OS,{})]})}bt.Editor=wS,Object.defineProperty(bt,Symbol.toStringTag,{value:"Module"})});
|
|
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
|
+
selection`+f,a+=`
|
|
47
|
+
|
|
48
|
+
commands:`,e.length)for(const{index:u,type:h,payload:g}of e)a+=`
|
|
49
|
+
└ ${u}. { type: ${h}, payload: ${g instanceof Event?g.constructor.name:g} }`;else a+=`
|
|
50
|
+
└ None dispatched.`;const{version:d}=n.constructor;return a+=`
|
|
51
|
+
|
|
52
|
+
editor${d?` (v${d})`:""}:`,a+=`
|
|
53
|
+
└ namespace ${i.namespace}`,l!==null&&(a+=`
|
|
54
|
+
└ compositionKey ${l}`),a+=`
|
|
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
|
+
|
|
64
|
+
Stack:
|
|
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
|
+
├ 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):ty(u)?function(h){return`: table
|
|
71
|
+
└ { table: ${h.tableKey}, anchorCell: ${h.anchor.key}, focusCell: ${h.focus.key} }`}(u):function(h){return Ve(h)?`: node
|
|
72
|
+
└ [${Array.from(h._nodes).join(", ")}]`:""}(u)});if(a+=`
|
|
73
|
+
selection`+f,a+=`
|
|
74
|
+
|
|
75
|
+
commands:`,e.length)for(const{index:u,type:h,payload:g}of e)a+=`
|
|
76
|
+
└ ${u}. { type: ${h}, payload: ${g instanceof Event?g.constructor.name:g} }`;else a+=`
|
|
77
|
+
└ None dispatched.`;const{version:d}=n.constructor;return a+=`
|
|
78
|
+
|
|
79
|
+
editor${d?` (v${d})`:""}:`,a+=`
|
|
80
|
+
└ namespace ${i.namespace}`,l!==null&&(a+=`
|
|
81
|
+
└ compositionKey ${l}`),a+=`
|
|
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
|
+
|
|
86
|
+
Stack:
|
|
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"})});
|
|
40
88
|
//# sourceMappingURL=index.umd.js.map
|