sykpcomposer 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,40 @@
1
+ (function(bt,q){typeof exports=="object"&&typeof module<"u"?q(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],q):(bt=typeof globalThis<"u"?globalThis:bt||self,q(bt.ViteButton={},bt.React,bt.ReactDOM))})(this,function(bt,q,Rc){"use strict";function rp(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 si=rp(q);var ue={exports:{}},fr={};var $c;function op(){if($c)return fr;$c=1;var n=q,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(l,c,a){var u,d={},f=null,h=null;a!==void 0&&(f=""+a),c.key!==void 0&&(f=""+c.key),c.ref!==void 0&&(h=c.ref);for(u in c)r.call(c,u)&&!s.hasOwnProperty(u)&&(d[u]=c[u]);if(l&&l.defaultProps)for(u in c=l.defaultProps,c)d[u]===void 0&&(d[u]=c[u]);return{$$typeof:e,type:l,key:f,ref:h,props:d,_owner:o.current}}return fr.Fragment=t,fr.jsx=i,fr.jsxs=i,fr}var dr={};var Ic;function sp(){return Ic||(Ic=1,process.env.NODE_ENV!=="production"&&function(){var n=q,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator,p="@@iterator";function _(x){if(x===null||typeof x!="object")return null;var b=g&&x[g]||x[p];return typeof b=="function"?b:null}var y=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function m(x){{for(var b=arguments.length,k=new Array(b>1?b-1:0),Y=1;Y<b;Y++)k[Y-1]=arguments[Y];T("error",x,k)}}function T(x,b,k){{var Y=y.ReactDebugCurrentFrame,te=Y.getStackAddendum();te!==""&&(b+="%s",k=k.concat([te]));var se=k.map(function(ee){return String(ee)});se.unshift("Warning: "+b),Function.prototype.apply.call(console[x],console,se)}}var N=!1,C=!1,S=!1,E=!1,v=!1,O;O=Symbol.for("react.module.reference");function M(x){return!!(typeof x=="string"||typeof x=="function"||x===r||x===s||v||x===o||x===a||x===u||E||x===h||N||C||S||typeof x=="object"&&x!==null&&(x.$$typeof===f||x.$$typeof===d||x.$$typeof===i||x.$$typeof===l||x.$$typeof===c||x.$$typeof===O||x.getModuleId!==void 0))}function I(x,b,k){var Y=x.displayName;if(Y)return Y;var te=b.displayName||b.name||"";return te!==""?k+"("+te+")":k}function J(x){return x.displayName||"Context"}function X(x){if(x==null)return null;if(typeof x.tag=="number"&&m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof x=="function")return x.displayName||x.name||null;if(typeof x=="string")return x;switch(x){case r:return"Fragment";case t:return"Portal";case s:return"Profiler";case o:return"StrictMode";case a:return"Suspense";case u:return"SuspenseList"}if(typeof x=="object")switch(x.$$typeof){case l:var b=x;return J(b)+".Consumer";case i:var k=x;return J(k._context)+".Provider";case c:return I(x,x.render,"ForwardRef");case d:var Y=x.displayName||null;return Y!==null?Y:X(x.type)||"Memo";case f:{var te=x,se=te._payload,ee=te._init;try{return X(ee(se))}catch{return null}}}return null}var G=Object.assign,ne=0,me,Z,Xt,ho,go,po,sr;function ir(){}ir.__reactDisabledLog=!0;function lr(){{if(ne===0){me=console.log,Z=console.info,Xt=console.warn,ho=console.error,go=console.group,po=console.groupCollapsed,sr=console.groupEnd;var x={configurable:!0,enumerable:!0,value:ir,writable:!0};Object.defineProperties(console,{info:x,log:x,warn:x,error:x,group:x,groupCollapsed:x,groupEnd:x})}ne++}}function cr(){{if(ne--,ne===0){var x={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:G({},x,{value:me}),info:G({},x,{value:Z}),warn:G({},x,{value:Xt}),error:G({},x,{value:ho}),group:G({},x,{value:go}),groupCollapsed:G({},x,{value:po}),groupEnd:G({},x,{value:sr})})}ne<0&&m("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ue=y.ReactCurrentDispatcher,mn;function mt(x,b,k){{if(mn===void 0)try{throw Error()}catch(te){var Y=te.stack.trim().match(/\n( *(at )?)/);mn=Y&&Y[1]||""}return`
2
+ `+mn+x}}var Zt=!1,yn;{var DS=typeof WeakMap=="function"?WeakMap:Map;yn=new DS}function Ug(x,b){if(!x||Zt)return"";{var k=yn.get(x);if(k!==void 0)return k}var Y;Zt=!0;var te=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var se;se=Ue.current,Ue.current=null,lr();try{if(b){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(Ot){Y=Ot}Reflect.construct(x,[],ee)}else{try{ee.call()}catch(Ot){Y=Ot}x.call(ee.prototype)}}else{try{throw Error()}catch(Ot){Y=Ot}x()}}catch(Ot){if(Ot&&Y&&typeof Ot.stack=="string"){for(var Q=Ot.stack.split(`
3
+ `),Pe=Y.stack.split(`
4
+ `),fe=Q.length-1,de=Pe.length-1;fe>=1&&de>=0&&Q[fe]!==Pe[de];)de--;for(;fe>=1&&de>=0;fe--,de--)if(Q[fe]!==Pe[de]){if(fe!==1||de!==1)do if(fe--,de--,de<0||Q[fe]!==Pe[de]){var je=`
5
+ `+Q[fe].replace(" at new "," at ");return x.displayName&&je.includes("<anonymous>")&&(je=je.replace("<anonymous>",x.displayName)),typeof x=="function"&&yn.set(x,je),je}while(fe>=1&&de>=0);break}}}finally{Zt=!1,Ue.current=se,cr(),Error.prepareStackTrace=te}var ur=x?x.displayName||x.name:"",np=ur?mt(ur):"";return typeof x=="function"&&yn.set(x,np),np}function MS(x,b,k){return Ug(x,!1)}function AS(x){var b=x.prototype;return!!(b&&b.isReactComponent)}function ni(x,b,k){if(x==null)return"";if(typeof x=="function")return Ug(x,AS(x));if(typeof x=="string")return mt(x);switch(x){case a:return mt("Suspense");case u:return mt("SuspenseList")}if(typeof x=="object")switch(x.$$typeof){case c:return MS(x.render);case d:return ni(x.type,b,k);case f:{var Y=x,te=Y._payload,se=Y._init;try{return ni(se(te),b,k)}catch{}}}return""}var ri=Object.prototype.hasOwnProperty,jg={},Hg=y.ReactDebugCurrentFrame;function oi(x){if(x){var b=x._owner,k=ni(x.type,x._source,b?b.type:null);Hg.setExtraStackFrame(k)}else Hg.setExtraStackFrame(null)}function kS(x,b,k,Y,te){{var se=Function.call.bind(ri);for(var ee in x)if(se(x,ee)){var Q=void 0;try{if(typeof x[ee]!="function"){var Pe=Error((Y||"React class")+": "+k+" type `"+ee+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof x[ee]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Pe.name="Invariant Violation",Pe}Q=x[ee](b,ee,Y,k,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(fe){Q=fe}Q&&!(Q instanceof Error)&&(oi(te),m("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Y||"React class",k,ee,typeof Q),oi(null)),Q instanceof Error&&!(Q.message in jg)&&(jg[Q.message]=!0,oi(te),m("Failed %s type: %s",k,Q.message),oi(null))}}}var PS=Array.isArray;function Dc(x){return PS(x)}function RS(x){{var b=typeof Symbol=="function"&&Symbol.toStringTag,k=b&&x[Symbol.toStringTag]||x.constructor.name||"Object";return k}}function $S(x){try{return Yg(x),!1}catch{return!0}}function Yg(x){return""+x}function Vg(x){if($S(x))return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",RS(x)),Yg(x)}var _o=y.ReactCurrentOwner,IS={key:!0,ref:!0,__self:!0,__source:!0},Jg,Gg,Mc;Mc={};function LS(x){if(ri.call(x,"ref")){var b=Object.getOwnPropertyDescriptor(x,"ref").get;if(b&&b.isReactWarning)return!1}return x.ref!==void 0}function FS(x){if(ri.call(x,"key")){var b=Object.getOwnPropertyDescriptor(x,"key").get;if(b&&b.isReactWarning)return!1}return x.key!==void 0}function BS(x,b){if(typeof x.ref=="string"&&_o.current&&b&&_o.current.stateNode!==b){var k=X(_o.current.type);Mc[k]||(m('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',X(_o.current.type),x.ref),Mc[k]=!0)}}function KS(x,b){{var k=function(){Jg||(Jg=!0,m("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",b))};k.isReactWarning=!0,Object.defineProperty(x,"key",{get:k,configurable:!0})}}function zS(x,b){{var k=function(){Gg||(Gg=!0,m("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",b))};k.isReactWarning=!0,Object.defineProperty(x,"ref",{get:k,configurable:!0})}}var WS=function(x,b,k,Y,te,se,ee){var Q={$$typeof:e,type:x,key:b,ref:k,props:ee,_owner:se};return Q._store={},Object.defineProperty(Q._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Q,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Y}),Object.defineProperty(Q,"_source",{configurable:!1,enumerable:!1,writable:!1,value:te}),Object.freeze&&(Object.freeze(Q.props),Object.freeze(Q)),Q};function US(x,b,k,Y,te){{var se,ee={},Q=null,Pe=null;k!==void 0&&(Vg(k),Q=""+k),FS(b)&&(Vg(b.key),Q=""+b.key),LS(b)&&(Pe=b.ref,BS(b,te));for(se in b)ri.call(b,se)&&!IS.hasOwnProperty(se)&&(ee[se]=b[se]);if(x&&x.defaultProps){var fe=x.defaultProps;for(se in fe)ee[se]===void 0&&(ee[se]=fe[se])}if(Q||Pe){var de=typeof x=="function"?x.displayName||x.name||"Unknown":x;Q&&KS(ee,de),Pe&&zS(ee,de)}return WS(x,Q,Pe,te,Y,_o.current,ee)}}var Ac=y.ReactCurrentOwner,qg=y.ReactDebugCurrentFrame;function ar(x){if(x){var b=x._owner,k=ni(x.type,x._source,b?b.type:null);qg.setExtraStackFrame(k)}else qg.setExtraStackFrame(null)}var kc;kc=!1;function Pc(x){return typeof x=="object"&&x!==null&&x.$$typeof===e}function Xg(){{if(Ac.current){var x=X(Ac.current.type);if(x)return`
6
+
7
+ Check the render method of \``+x+"`."}return""}}function jS(x){{if(x!==void 0){var b=x.fileName.replace(/^.*[\\\/]/,""),k=x.lineNumber;return`
8
+
9
+ Check your code at `+b+":"+k+"."}return""}}var Zg={};function HS(x){{var b=Xg();if(!b){var k=typeof x=="string"?x:x.displayName||x.name;k&&(b=`
10
+
11
+ Check the top-level render call using <`+k+">.")}return b}}function Qg(x,b){{if(!x._store||x._store.validated||x.key!=null)return;x._store.validated=!0;var k=HS(b);if(Zg[k])return;Zg[k]=!0;var Y="";x&&x._owner&&x._owner!==Ac.current&&(Y=" It was passed a child from "+X(x._owner.type)+"."),ar(x),m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',k,Y),ar(null)}}function ep(x,b){{if(typeof x!="object")return;if(Dc(x))for(var k=0;k<x.length;k++){var Y=x[k];Pc(Y)&&Qg(Y,b)}else if(Pc(x))x._store&&(x._store.validated=!0);else if(x){var te=_(x);if(typeof te=="function"&&te!==x.entries)for(var se=te.call(x),ee;!(ee=se.next()).done;)Pc(ee.value)&&Qg(ee.value,b)}}}function YS(x){{var b=x.type;if(b==null||typeof b=="string")return;var k;if(typeof b=="function")k=b.propTypes;else if(typeof b=="object"&&(b.$$typeof===c||b.$$typeof===d))k=b.propTypes;else return;if(k){var Y=X(b);kS(k,x.props,"prop",Y,x)}else if(b.PropTypes!==void 0&&!kc){kc=!0;var te=X(b);m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",te||"Unknown")}typeof b.getDefaultProps=="function"&&!b.getDefaultProps.isReactClassApproved&&m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function VS(x){{for(var b=Object.keys(x.props),k=0;k<b.length;k++){var Y=b[k];if(Y!=="children"&&Y!=="key"){ar(x),m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Y),ar(null);break}}x.ref!==null&&(ar(x),m("Invalid attribute `ref` supplied to `React.Fragment`."),ar(null))}}function tp(x,b,k,Y,te,se){{var ee=M(x);if(!ee){var Q="";(x===void 0||typeof x=="object"&&x!==null&&Object.keys(x).length===0)&&(Q+=" 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 Pe=jS(te);Pe?Q+=Pe:Q+=Xg();var fe;x===null?fe="null":Dc(x)?fe="array":x!==void 0&&x.$$typeof===e?(fe="<"+(X(x.type)||"Unknown")+" />",Q=" Did you accidentally export a JSX literal instead of a component?"):fe=typeof x,m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",fe,Q)}var de=US(x,b,k,te,se);if(de==null)return de;if(ee){var je=b.children;if(je!==void 0)if(Y)if(Dc(je)){for(var ur=0;ur<je.length;ur++)ep(je[ur],x);Object.freeze&&Object.freeze(je)}else m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ep(je,x)}return x===r?VS(de):YS(de),de}}function JS(x,b,k){return tp(x,b,k,!0)}function GS(x,b,k){return tp(x,b,k,!1)}var qS=GS,XS=JS;dr.Fragment=r,dr.jsx=qS,dr.jsxs=XS}()),dr}(function(n){process.env.NODE_ENV==="production"?n.exports=op():n.exports=sp()})(ue);function H(n){return{type:n}}const mo=H("SELECTION_CHANGE_COMMAND"),ip=H("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Lc=H("CLICK_COMMAND"),hr=H("DELETE_CHARACTER_COMMAND"),gr=H("INSERT_LINE_BREAK_COMMAND"),ii=H("INSERT_PARAGRAPH_COMMAND"),Tn=H("CONTROLLED_TEXT_INSERTION_COMMAND"),li=H("PASTE_COMMAND"),ci=H("REMOVE_TEXT_COMMAND"),pr=H("DELETE_WORD_COMMAND"),_r=H("DELETE_LINE_COMMAND"),wt=H("FORMAT_TEXT_COMMAND"),ai=H("UNDO_COMMAND"),ui=H("REDO_COMMAND"),Fc=H("KEYDOWN_COMMAND"),Bc=H("KEY_ARROW_RIGHT_COMMAND"),Kc=H("MOVE_TO_END"),zc=H("KEY_ARROW_LEFT_COMMAND"),Wc=H("MOVE_TO_START"),Uc=H("KEY_ARROW_UP_COMMAND"),jc=H("KEY_ARROW_DOWN_COMMAND"),yo=H("KEY_ENTER_COMMAND"),Hc=H("KEY_SPACE_COMMAND"),Yc=H("KEY_BACKSPACE_COMMAND"),Vc=H("KEY_ESCAPE_COMMAND"),Jc=H("KEY_DELETE_COMMAND"),Gc=H("KEY_TAB_COMMAND"),lp=H("INSERT_TAB_COMMAND"),cp=H("INDENT_CONTENT_COMMAND"),ap=H("OUTDENT_CONTENT_COMMAND"),qc=H("DROP_COMMAND"),up=H("FORMAT_ELEMENT_COMMAND"),Xc=H("DRAGSTART_COMMAND"),Zc=H("DRAGOVER_COMMAND"),Qc=H("DRAGEND_COMMAND"),fi=H("COPY_COMMAND"),di=H("CUT_COMMAND"),hi=H("SELECT_ALL_COMMAND"),fp=H("CLEAR_EDITOR_COMMAND"),dp=H("CLEAR_HISTORY_COMMAND"),hp=H("CAN_REDO_COMMAND"),gp=H("CAN_UNDO_COMMAND"),ea=H("FOCUS_COMMAND"),ta=H("BLUR_COMMAND"),na=H("KEY_MODIFIER_COMMAND"),He=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",pp=He&&"documentMode"in document?document.documentMode:null,Ye=He&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Dt=He&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),To=He&&"InputEvent"in window&&!pp?"getTargetRanges"in new window.InputEvent("input"):!1,gi=He&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),xo=He&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,_p=He&&/Android/.test(navigator.userAgent),ra=He&&/^(?=.*Chrome).*/i.test(navigator.userAgent),mp=He&&_p&&ra,pi=He&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ra,mr=1,Mt=3,Qt=0,oa=1,xn=2,sa=0,_i=1,mi=2,No=1,Co=1<<1,yr=1<<2,Tr=1<<3,So=1<<4,Eo=1<<5,vo=1<<6,Oo=1<<7,ia=No|Co|yr|Tr|So|Eo|vo|Oo,yi=1,bo=1<<1,Ti=1,xi=2,Ni=3,Ci=4,Si=5,Ei=6,la=" ",wo=gi||xo||pi?la:"​",yt=`
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(),P(e,gr,!1);else if(s===yt)n.preventDefault(),P(e,ii,void 0);else if(s==null&&n.dataTransfer){const u=n.dataTransfer.getData("text/plain");n.preventDefault(),o.insertRawText(u)}else s!=null&&Za(o,r,s,n.timeStamp,!0)?(n.preventDefault(),P(e,Tn,s)):Sn=s;qa=n.timeStamp;return}switch(n.preventDefault(),t){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":{P(e,Tn,n);break}case"insertFromComposition":{ye(null),P(e,Tn,n);break}case"insertLineBreak":{ye(null),P(e,gr,!1);break}case"insertParagraph":{ye(null),Pr&&!xo?(Pr=!1,P(e,gr,!1)):P(e,ii,void 0);break}case"insertFromPaste":case"insertFromPasteAsQuotation":{P(e,li,n);break}case"deleteByComposition":{X_(c,a)&&P(e,ci,n);break}case"deleteByDrag":case"deleteByCut":{P(e,ci,n);break}case"deleteContent":{P(e,hr,!1);break}case"deleteWordBackward":{P(e,pr,!0);break}case"deleteWordForward":{P(e,pr,!1);break}case"deleteHardLineBackward":case"deleteSoftLineBackward":{P(e,_r,!0);break}case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":{P(e,_r,!1);break}case"formatStrikeThrough":{P(e,wt,"strikethrough");break}case"formatBold":{P(e,wt,"bold");break}case"formatItalic":{P(e,wt,"italic");break}case"formatUnderline":{P(e,wt,"underline");break}case"historyUndo":{P(e,ai,void 0);break}case"historyRedo":{P(e,ui,void 0);break}}})}function em(n,e){n.stopPropagation(),Ke(e,()=>{const t=re(),r=n.data,o=tu(n);if(r!=null&&U(t)&&Za(t,o,r,n.timeStamp,!1)){Rr&&(Zi(e,r),Rr=!1);const i=t.anchor.getNode(),l=lt(e._window);if(l===null)return;const c=t.isBackward(),a=c?t.anchor.offset:t.focus.offset,u=c?t.focus.offset:t.anchor.offset;(!To||t.isCollapsed()||!B(i)||l.anchorNode===null||i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+u)!==wa(l.anchorNode))&&P(e,Tn,r);const d=r.length;Dt&&d>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=d),!gi&&!xo&&!pi&&e.isComposing()&&(kr=0,ye(null))}else ki(!1,e,r!==null?r:void 0),Rr&&(Zi(e,r||void 0),Rr=!1);jp()}),Sn=null}function tm(n,e){Ke(e,()=>{const t=re();if(U(t)&&!e.isComposing()){const r=t.anchor,o=t.anchor.getNode();ye(r.key),(n.timeStamp<kr+Ji||r.type==="element"||!t.isCollapsed()||o.getFormat()!==t.format||B(o)&&o.getStyle()!==t.style)&&P(e,Tn,yp)}})}function Zi(n,e){const t=n._compositionKey;if(ye(null),t!==null&&e!=null){if(e===""){const r=Se(t),o=Ao(n.getElementByKey(t));o!==null&&o.nodeValue!==null&&B(r)&&Pi(r,o.nodeValue,null,null,!0);return}if(e[e.length-1]===`
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=>dm(e)||hm(e)?null:{conversion:fm,priority:0}}}static importJSON(e){return On()}exportJSON(){return{type:"linebreak",version:1}}}function fm(n){return{node:On()}}function On(){return br(new vn)}function on(n){return n instanceof vn}function dm(n){const e=n.parentElement;if(e!==null&&Bi(e)){const t=e.firstChild;if(t===n||t.nextSibling===n&&Yo(t)){const r=e.lastChild;if(r===n||r.previousSibling===n&&Yo(r))return!0}}return!1}function hm(n){const e=n.parentElement;if(e!==null&&Bi(e)){const t=e.firstChild;if(t===n||t.nextSibling===n&&Yo(t))return!1;const r=e.lastChild;if(r===n||r.previousSibling===n&&Yo(r))return!0}return!1}function Yo(n){return n.nodeType===Mt&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}function el(n,e){return e&So?"code":e&Oo?"mark":e&Eo?"sub":e&vo?"sup":null}function tl(n,e){return e&No?"strong":e&Co?"em":"span"}function iu(n,e,t,r,o){const s=r.classList;let i=Or(o,"base");i!==void 0&&s.add(...i),i=Or(o,"underlineStrikethrough");let l=!1;const c=e&Tr&&e&yr,a=t&Tr&&t&yr;i!==void 0&&(a?(l=!0,c||s.add(...i)):c&&s.remove(...i));for(const u in st){const f=st[u];if(i=Or(o,u),i!==void 0)if(t&f){if(l&&(u==="underline"||u==="strikethrough")){e&f&&s.remove(...i);continue}(!(e&f)||c&&u==="underline"||u==="strikethrough")&&s.add(...i)}else e&f&&s.remove(...i)}}function gm(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 lu(n,e,t){const r=e.firstChild,o=t.isComposing(),i=n+(o?wo:"");if(r==null)e.textContent=i;else{const l=r.nodeValue;if(l!==i)if(o||Dt){const[c,a,u]=gm(l,i);a!==0&&r.deleteData(c,a),r.insertData(c,u)}else r.nodeValue=i}}function cu(n,e,t,r,o,s){lu(o,n,e);const l=s.theme.text;l!==void 0&&iu(t,0,r,n,l)}function Vo(n,e){const t=document.createElement(e);return t.appendChild(n),t}let bn=class extends Ho{static getType(){return"text"}static clone(e){return new bn(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 Ep[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===_i}isComposing(){return this.__key===At()}isSegmented(){return this.getLatest().__mode===mi}isDirectionless(){return(this.getLatest().__detail&yi)!==0}isUnmergeable(){return(this.getLatest().__detail&bo)!==0}hasFormat(e){const t=st[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 Mi(o,e,t)}canHaveFormat(){return!0}createDOM(e,t){const r=this.__format,o=el(this,r),s=tl(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;cu(c,this,s,r,a,e);const u=this.__style;return u!==""&&(l.style.cssText=u),l}updateDOM(e,t,r){const o=this.__text,s=e.__format,i=this.__format,l=el(this,s),c=el(this,i),a=tl(this,s),u=tl(this,i);if((l===null?a:l)!==(c===null?u:c))return!0;if(l===c&&a!==u){const m=t.firstChild;if(m==null)throw Error("updateDOM: prevInnerDOM is null or undefined");const T=document.createElement(u);return cu(T,this,u,i,o,r),t.replaceChild(T,m),!1}let h=t;if(c!==null&&l!==null&&(h=t.firstChild,h==null))throw Error("updateDOM: innerDOM is null or undefined");lu(o,h,this);const p=r.theme.text;p!==void 0&&s!==i&&iu(u,s,i,h,p);const _=e.__style,y=this.__style;return _!==y&&(t.style.cssText=y),!1}static importDOM(){return{"#text":()=>({conversion:Tm,priority:0}),b:()=>({conversion:_m,priority:0}),code:()=>({conversion:Rt,priority:0}),em:()=>({conversion:Rt,priority:0}),i:()=>({conversion:Rt,priority:0}),s:()=>({conversion:Rt,priority:0}),span:()=>({conversion:pm,priority:0}),strong:()=>({conversion:Rt,priority:0}),sub:()=>({conversion:Rt,priority:0}),sup:()=>({conversion:Rt,priority:0}),u:()=>({conversion:Rt,priority:0})}}static importJSON(e){const t=Ee(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&&Fo(t)))throw Error("Expected TextNode createDOM to always return a HTMLElement");return t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=Vo(t,"b")),this.hasFormat("italic")&&(t=Vo(t,"i")),this.hasFormat("strikethrough")&&(t=Vo(t,"s")),this.hasFormat("underline")&&(t=Vo(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"?st[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?Np[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=this.getFormat(),r=Mi(t,e,null);return this.setFormat(r)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=yi,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=bo,e}setMode(e){const t=Sp[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){be();let r=e,o=t;const s=re(),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(U(s)){const c=At();(c===s.anchor.key||c===s.focus.key)&&ye(l),s.setTextNodeRange(this,r,this,o)}else return Tu(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=re();if(o&&U(a)){const d=e+l;a.setTextNodeRange(s,d,s,d)}const u=i.slice(0,c)+r+i.slice(c+t);return s.__text=u,s}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){be();const t=this.getLatest(),r=t.getTextContent(),o=t.__key,s=At(),i=new Set(e),l=[],c=r.length;let a="";for(let C=0;C<c;C++)a!==""&&i.has(C)&&(l.push(a),a=""),a+=r[C];a!==""&&l.push(a);const u=l.length;if(u===0)return[];if(l[0]===r)return[t];const d=l[0],f=t.getParent();let h;const g=t.getFormat(),p=t.getStyle(),_=t.__detail;let y=!1;t.isSegmented()?(h=Ee(d),h.__format=g,h.__style=p,h.__detail=_,y=!0):(h=t.getWritable(),h.__text=d);const m=re(),T=[h];let N=d.length;for(let C=1;C<u;C++){const S=l[C],E=S.length,v=Ee(S).getWritable();v.__format=g,v.__style=p,v.__detail=_;const O=v.__key,M=N+E;if(U(m)){const I=m.anchor,J=m.focus;I.key===o&&I.type==="text"&&I.offset>N&&I.offset<=M&&(I.key=O,I.offset-=N,m.dirty=!0),J.key===o&&J.type==="text"&&J.offset>N&&J.offset<=M&&(J.key=O,J.offset-=N,m.dirty=!0)}s===o&&ye(O),N=M,T.push(v)}if(f!==null){Wp(this);const C=f.getWritable(),S=this.getIndexWithinParent();y?(C.splice(S,0,T),this.remove()):C.splice(S,1,T),U(m)&&Xo(m,f,S,u-1)}return T}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;At()===o&&ye(r);const c=re();if(U(c)){const f=c.anchor,h=c.focus;f!==null&&f.key===o&&(Nu(f,t,r,e,i),c.dirty=!0),h!==null&&h.key===o&&(Nu(h,t,r,e,i),c.dirty=!0)}const a=e.__text,u=t?a+s:s+a;this.setTextContent(u);const d=this.getWritable();return e.remove(),d}isTextEntity(){return!1}};function pm(n){const t=n.style;return{forChild:nl(t),node:null}}function _m(n){const e=n,t=e.style.fontWeight==="normal";return{forChild:nl(e.style,t?void 0:"bold"),node:null}}const au=new WeakMap;function mm(n){return n.nodeName==="PRE"||n.nodeType===mr&&n.style!==void 0&&n.style.whiteSpace!==void 0&&n.style.whiteSpace.startsWith("pre")}function ym(n){let e,t=n.parentNode;const r=[n];for(;t!==null&&(e=au.get(t))===void 0&&!mm(t);)r.push(t),t=t.parentNode;const o=e===void 0?t:e;for(let s=0;s<r.length;s++)au.set(r[s],o);return o}function Tm(n){const e=n;if(n.parentElement===null)throw Error("Expected parentElement of Text not to be null");let r=e.textContent||"";if(ym(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
+ `||c===`\r
18
+ `?s.push(On()):c===" "?s.push(Jo()):c!==""&&s.push(Ee(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=uu(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=uu(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:Ee(r)}}function uu(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===mr){const s=t.style.display;if(s===""&&!La(t)||s!==""&&!s.startsWith("inline"))return null}let o=t;for(;(o=e?t.firstChild:t.lastChild)!==null;)t=o;if(t.nodeType===Mt)return t;if(t.nodeName==="BR")return null}}const xm={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Rt(n){const e=xm[n.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:nl(n.style,e),node:null}}function Ee(n=""){return br(new bn(n))}function B(n){return n instanceof bn}function nl(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=>(B(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 wn extends bn{static getType(){return"tab"}static clone(e){return new wn(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text}constructor(e){super(" ",e),this.__detail=bo}static importDOM(){return null}static importJSON(e){const t=Jo();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 Jo(){return br(new wn)}function fu(n){return n instanceof wn}class Nm{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(w(t)){const i=t.getDescendantByIndex(o);t=i??t}if(w(r)){const i=r.getDescendantByIndex(s);r=i??r}return t===r?o<s:t.isBefore(r)}getNode(){const e=this.key,t=Se(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,Mn()||(At()===s&&ye(e),o!==null&&(o.setCachedNodes(null),o.dirty=!0))}}function Ge(n,e,t){return new Nm(n,e,t)}function rl(n,e){let t=e.__key,r=n.offset,o="element";if(B(e)){o="text";const s=e.getTextContentSize();r>s&&(r=s)}else if(!w(e)){const s=e.getNextSibling();if(B(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 du(n,e){if(w(e)){const t=e.getLastDescendant();w(t)||B(t)?rl(n,t):rl(n,e)}else rl(n,e)}function Cm(n,e,t,r){const o=n.getNode(),s=o.getChildAtIndex(n.offset),i=Ee(),l=$e(o)?Nt().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 $t(n,e,t,r){n.key=e,n.offset=t,n.type=r}class Go{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!$r(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 Go(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(B(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=Se(o);s!==null&&r.push(s)}return Mn()||(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 U(n){return n instanceof It}class It{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 U(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,u=i.offset;if(w(l)){const f=l.getDescendantByIndex(a);l=f??l}if(w(c)){let f=c.getDescendantByIndex(u);f!==null&&f!==l&&c.getChildAtIndex(u)===f&&(f=f.getPreviousSibling()),c=f??c}let d;return l.is(c)?w(l)&&l.getChildrenSize()>0?d=[]:d=[l]:d=l.getNodesBetween(c),Mn()||(this._cachedNodes=d),d}setTextNodeRange(e,t,r,o){$t(this.anchor,e.__key,t,"text"),$t(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]=ol(this);let a="",u=!0;for(let d=0;d<e.length;d++){const f=e[d];if(w(f)&&!f.isInline())u||(a+=`
19
+ `),f.isEmpty()?u=!1:u=!0;else if(u=!1,B(f)){let h=f.getTextContent();f===t?f===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):f===r&&(h=i?h.slice(0,c):h.slice(0,l)),a+=h}else(le(f)||on(f))&&(f!==r||!this.isCollapsed())&&(a+=f.getTextContent())}return a}applyDOMRange(e){const t=ie(),o=t.getEditorState()._selection,s=yu(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,o);if(s===null)return;const[i,l]=s;$t(this.anchor,i.key,i.offset,i.type),$t(this.focus,l.key,l.offset,l.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new It(Ge(e.key,e.offset,e.type),Ge(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Mi(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=st[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
+ `||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=`
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(),R(r,Br,!1);else if(c===Ct)t.preventDefault(),R(r,dl,void 0);else if(c==null&&t.dataTransfer){const h=t.dataTransfer.getData("text/plain");t.preventDefault(),i.insertRawText(h)}else c!=null&&qf(i,s,c,t.timeStamp,!0)?(t.preventDefault(),R(r,kn,c)):In=c;Jf=t.timeStamp}})}(n,e)]);let ro=0,Vf=null,Jf=0,In=null;const Ss=new WeakMap;let Ql=!1,ec=!1,oo=!1,so=!1,Gf=[0,"",0,"root",0];function qf(n,e,t,r,o){const s=n.anchor,i=n.focus,l=s.getNode(),c=ce(),a=dt(c._window),u=a!==null?a.anchorNode:null,d=s.key,f=c.getElementByKey(d),h=t.length;return d!==i.key||!K(l)||(!o&&(!os||Jf<r+50)||l.isDirty()&&h<2||Ef(t))&&s.offset!==i.offset&&!l.isComposing()||cn(l)||l.isDirty()&&h>1||(o||!os)&&f!==null&&!l.isComposing()&&u!==us(f)||a!==null&&e!==null&&(!e.collapsed||e.startContainer!==a.anchorNode||e.startOffset!==a.anchorOffset)||l.getFormat()!==n.format||l.getStyle()!==n.style||Uy(n,l)}function Xf(n,e){return n!==null&&n.nodeValue!==null&&n.nodeType===Kt&&e!==0&&e!==n.nodeValue.length}function Zf(n,e,t){const{anchorNode:r,anchorOffset:o,focusNode:s,focusOffset:i}=n;Ql&&(Ql=!1,Xf(r,o)&&Xf(s,i))||We(e,()=>{if(!t)return void ft(null);if(!Hr(e,r,s))return;const l=oe();if(j(l)){const c=l.anchor,a=c.getNode();if(l.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(l.dirty=!0);const u=_s(e).event,d=u?u.timeStamp:performance.now(),[f,h,g,p,_]=Gf,y=ze(),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")K(a)||A(141),l.format=a.getFormat(),l.style=a.getStyle();else if(c.type==="element"&&!m){const T=c.getNode();l.style="",T instanceof gn&&T.getChildrenSize()===0?(l.format=T.getTextFormat(),l.style=T.getTextStyle()):l.format=0}}else{const u=c.key,d=l.focus.key,f=l.getNodes(),h=f.length,g=l.isBackward(),p=g?i:o,_=g?o:i,y=g?d:u,m=g?u:d;let T=of,N=!1;for(let C=0;C<h;C++){const S=f[C],E=S.getTextContentSize();if(K(S)&&E!==0&&!(C===0&&S.__key===y&&p===E||C===h-1&&S.__key===m&&_===0)&&(N=!0,T&=S.getFormat(),T===0))break}l.format=N?T:0}}R(e,ns,void 0)})}function Qf(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function tc(n,e){const t=n._compositionKey;if(xe(null),t!==null&&e!=null){if(e===""){const r=ve(t),o=us(n.getElementByKey(t));return void(o!==null&&o.nodeValue!==null&&K(r)&&Il(r,o.nodeValue,null,null,!0))}if(e[e.length-1]===`
25
+ `){const r=oe();if(j(r)){const o=r.focus;return r.anchor.set(o.key,o.offset,o.type),void R(n,rs,null)}}}$l(!0,n,e)}function ed(n){let e=n.__lexicalEventHandles;return e===void 0&&(e=[],n.__lexicalEventHandles=e),e}const Ln=new Map;function td(n){const e=n.target,t=dt(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const r=kl(t.anchorNode);if(r===null)return;ec&&(ec=!1,We(r,()=>{const a=zn(),u=t.anchorNode;if(u===null)return;const d=u.nodeType;d!==Wr&&d!==Kt||ft(Ds(a,t,r,n))}));const o=Rl(r),s=o[o.length-1],i=s._key,l=Ln.get(i),c=l||s;c!==r&&Zf(t,c,!1),Zf(t,r,!0),r!==s?Ln.set(i,r):l&&Ln.delete(i)}function nd(n){n._lexicalHandled=!0}function rd(n){return n._lexicalHandled===!0}function oT(n){const e=n.ownerDocument,t=Ss.get(e);t===void 0&&A(162);const r=t-1;r>=0||A(164),Ss.set(e,r),r===0&&e.removeEventListener("selectionchange",td);const o=Yr(n);as(o)?(function(i){if(i._parentEditor!==null){const l=Rl(i),c=l[l.length-1]._key;Ln.get(c)===i&&Ln.delete(c)}else Ln.delete(i._key)}(o),n.__lexicalEditor=null):o&&A(198);const s=ed(n);for(let i=0;i<s.length;i++)s[i]();n.__lexicalEventHandles=[]}function nc(n,e,t){ke();const r=n.__key,o=n.getParent();if(o===null)return;const s=function(l){const c=oe();if(!j(c)||!D(l))return c;const{anchor:a,focus:u}=c,d=a.getNode(),f=u.getNode();return ps(d,l)&&a.set(l.__key,0,"element"),ps(f,l)&&u.set(l.__key,0,"element"),c}(n);let i=!1;if(j(s)&&e){const l=s.anchor,c=s.focus;l.key===r&&(As(l,n,o,n.getPreviousSibling(),n.getNextSibling()),i=!0),c.key===r&&(As(c,n,o,n.getPreviousSibling(),n.getNextSibling()),i=!0)}else io(s)&&e&&n.isSelected()&&n.selectPrevious();if(j(s)&&e&&!i){const l=n.getIndexWithinParent();an(n),Ms(s,o,l,-1)}else an(n);t||Wt(o)||o.canBeEmpty()||!o.isEmpty()||nc(o,e),e&&Le(o)&&o.isEmpty()&&o.selectEnd()}class Es{static getType(){A(64,this.name)}static clone(e){A(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,yf(this,e)}getType(){return this.__type}isInline(){A(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=ve(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||oe();if(t==null)return!1;const r=t.getNodes().some(o=>o.__key===this.__key);if(K(this))return r;if(j(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const o=this.getParent();if(ae(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:ve(e)}getParentOrThrow(){const e=this.getParent();return e===null&&A(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(Wt(t))return D(e)||e===this&&ae(e)||A(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&A(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:ve(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:ve(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();D(this)&&t.unshift(this),D(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=D(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&&A(68),u=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d===null)break;u!==null||o.has(d.__key)||r.push(d)}while(u===null);s=u}return t||r.reverse(),r}isDirty(){const e=ce()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=ve(this.__key);return e===null&&A(113),e}getWritable(){ke();const e=gt(),t=ce(),r=e._nodeMap,o=this.__key,s=this.getLatest(),i=t._cloneNotNeeded,l=oe();if(l!==null&&l.setCachedNodes(null),i.has(o))return fs(s),s;const c=Ff(s);return i.add(o),fs(c),r.set(o,c),c}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){A(70)}updateDOM(e,t,r){A(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){A(72)}static importJSON(e){A(18,this.name)}static transform(){return null}remove(e){nc(this,!0,e)}replace(e,t){ke();let r=oe();r!==null&&(r=r.clone()),Bl(this,e);const o=this.getLatest(),s=this.__key,i=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;an(l);const u=o.getPreviousSibling(),d=o.getNextSibling(),f=o.__prev,h=o.__next,g=o.__parent;if(nc(o,!1,!0),u===null?c.__first=i:u.getWritable().__next=i,l.__prev=f,d===null?c.__last=i:d.getWritable().__prev=i,l.__next=h,l.__parent=g,c.__size=a,t&&(D(this)&&D(l)||A(139),this.getChildren().forEach(p=>{l.append(p)})),j(r)){ft(r);const p=r.anchor,_=r.focus;p.key===s&&ud(p,l),_.key===s&&ud(_,l)}return zt()===s&&xe(i),l}insertAfter(e,t=!0){ke(),Bl(this,e);const r=this.getWritable(),o=e.getWritable(),s=o.getParent(),i=oe();let l=!1,c=!1;if(s!==null){const h=e.getIndexWithinParent();if(an(o),j(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:a.getWritable().__prev=d,u.__size++,r.__next=d,o.__next=f,o.__prev=r.__key,o.__parent=r.__parent,t&&j(i)){const h=this.getIndexWithinParent();Ms(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){ke(),Bl(this,e);const r=this.getWritable(),o=e.getWritable(),s=o.__key;an(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 u=oe();return t&&j(u)&&Ms(u,this.getParentOrThrow(),a),e}isParentRequired(){return!1}createParentElementNode(){return vt()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){ke();const r=this.getPreviousSibling(),o=this.getParentOrThrow();if(r===null)return o.select(0,0);if(D(r))return r.select();if(!K(r)){const s=r.getIndexWithinParent()+1;return o.select(s,s)}return r.select(e,t)}selectNext(e,t){ke();const r=this.getNextSibling(),o=this.getParentOrThrow();if(r===null)return o.select();if(D(r))return r.select(0,0);if(!K(r)){const s=r.getIndexWithinParent();return o.select(s,s)}return r.select(e,t)}markDirty(){this.getWritable()}}class Fn extends Es{static getType(){return"linebreak"}static clone(e){return new Fn(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&&Wl(r)){const o=r.firstChild;if(o===t||o.nextSibling===t&&vs(o)){const s=r.lastChild;if(s===t||s.previousSibling===t&&vs(s))return!0}}return!1}(e)||function(t){const r=t.parentElement;if(r!==null&&Wl(r)){const o=r.firstChild;if(o===t||o.nextSibling===t&&vs(o))return!1;const s=r.lastChild;if(s===t||s.previousSibling===t&&vs(s))return!0}return!1}(e)?null:{conversion:sT,priority:0}}}static importJSON(e){return Bn()}exportJSON(){return{type:"linebreak",version:1}}}function sT(n){return{node:Bn()}}function Bn(){return Zr(new Fn)}function dn(n){return n instanceof Fn}function vs(n){return n.nodeType===Kt&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}function rc(n,e){return 16&e?"code":e&is?"mark":32&e?"sub":64&e?"sup":null}function oc(n,e){return 1&e?"strong":2&e?"em":"span"}function od(n,e,t,r,o){const s=r.classList;let i=Xr(o,"base");i!==void 0&&s.add(...i),i=Xr(o,"underlineStrikethrough");let l=!1;const c=e&jr&&e&Ur;i!==void 0&&(t&jr&&t&Ur?(l=!0,c||s.add(...i)):c&&s.remove(...i));for(const a in ut){const u=ut[a];if(i=Xr(o,a),i!==void 0)if(t&u){if(l&&(a==="underline"||a==="strikethrough")){e&u&&s.remove(...i);continue}e&u&&(!c||a!=="underline")&&a!=="strikethrough"||s.add(...i)}else e&u&&s.remove(...i)}}function sd(n,e,t){const r=e.firstChild,o=t.isComposing(),s=n+(o?ls:"");if(r==null)e.textContent=s;else{const i=r.nodeValue;if(i!==s)if(o||Bt){const[l,c,a]=function(u,d){const f=u.length,h=d.length;let g=0,p=0;for(;g<f&&g<h&&u[g]===d[g];)g++;for(;p+g<f&&p+g<h&&u[f-p-1]===d[h-p-1];)p++;return[g,f-g-p,d.slice(g,h-p)]}(i,s);c!==0&&r.deleteData(l,c),r.insertData(l,a)}else r.nodeValue=s}}function id(n,e,t,r,o,s){sd(o,n,e);const i=s.theme.text;i!==void 0&&od(0,0,r,n,i)}function Os(n,e){const t=document.createElement(e);return t.appendChild(n),t}class hn extends Es{static getType(){return"text"}static clone(e){return new hn(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 Py[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===zt()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=ut[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Pl(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const r=this.__format,o=rc(0,r),s=oc(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)),id(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=rc(0,s),c=rc(0,i),a=oc(0,s),u=oc(0,i);if((l===null?a:l)!==(c===null?u:c))return!0;if(l===c&&a!==u){const p=t.firstChild;p==null&&A(48);const _=document.createElement(u);return id(_,this,0,i,o,r),t.replaceChild(_,p),!1}let d=t;c!==null&&l!==null&&(d=t.firstChild,d==null&&A(49)),sd(o,d,this);const f=r.theme.text;f!==void 0&&s!==i&&od(0,s,i,d,f);const h=e.__style,g=this.__style;return h!==g&&(t.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:aT,priority:0}),b:()=>({conversion:lT,priority:0}),code:()=>({conversion:jt,priority:0}),em:()=>({conversion:jt,priority:0}),i:()=>({conversion:jt,priority:0}),s:()=>({conversion:jt,priority:0}),span:()=>({conversion:iT,priority:0}),strong:()=>({conversion:jt,priority:0}),sub:()=>({conversion:jt,priority:0}),sup:()=>({conversion:jt,priority:0}),u:()=>({conversion:jt,priority:0})}}static importJSON(e){const t=Oe(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&&ms(t)||A(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=Os(t,"b")),this.hasFormat("italic")&&(t=Os(t,"i")),this.hasFormat("strikethrough")&&(t=Os(t,"s")),this.hasFormat("underline")&&(t=Os(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"?ut[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?My[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=Pl(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=ky[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){ke();let r=e,o=t;const s=oe(),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(!j(s))return md(l,r,l,o,"text","text");{const c=zt();c!==s.anchor.key&&c!==s.focus.key||xe(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=oe();if(o&&j(a)){const d=e+l;a.setTextNodeRange(s,d,s,d)}const u=i.slice(0,c)+r+i.slice(c+t);return s.__text=u,s}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){ke();const t=this.getLatest(),r=t.getTextContent(),o=t.__key,s=zt(),i=new Set(e),l=[],c=r.length;let a="";for(let C=0;C<c;C++)a!==""&&i.has(C)&&(l.push(a),a=""),a+=r[C];a!==""&&l.push(a);const u=l.length;if(u===0)return[];if(l[0]===r)return[t];const d=l[0],f=t.getParent();let h;const g=t.getFormat(),p=t.getStyle(),_=t.__detail;let y=!1;t.isSegmented()?(h=Oe(d),h.__format=g,h.__style=p,h.__detail=_,y=!0):(h=t.getWritable(),h.__text=d);const m=oe(),T=[h];let N=d.length;for(let C=1;C<u;C++){const S=l[C],E=S.length,v=Oe(S).getWritable();v.__format=g,v.__style=p,v.__detail=_;const O=v.__key,M=N+E;if(j(m)){const I=m.anchor,J=m.focus;I.key===o&&I.type==="text"&&I.offset>N&&I.offset<=M&&(I.key=O,I.offset-=N,m.dirty=!0),J.key===o&&J.type==="text"&&J.offset>N&&J.offset<=M&&(J.key=O,J.offset-=N,m.dirty=!0)}s===o&&xe(O),N=M,T.push(v)}if(f!==null){(function(E){const v=E.getPreviousSibling(),O=E.getNextSibling();v!==null&&fs(v),O!==null&&fs(O)})(this);const C=f.getWritable(),S=this.getIndexWithinParent();y?(C.splice(S,0,T),this.remove()):C.splice(S,1,T),j(m)&&Ms(m,f,S,u-1)}return T}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||A(50);const r=this.__key,o=e.__key,s=this.__text,i=s.length;zt()===o&&xe(r);const l=oe();if(j(l)){const d=l.anchor,f=l.focus;d!==null&&d.key===o&&(Td(d,t,r,e,i),l.dirty=!0),f!==null&&f.key===o&&(Td(f,t,r,e,i),l.dirty=!0)}const c=e.__text,a=t?c+s:s+c;this.setTextContent(a);const u=this.getWritable();return e.remove(),u}isTextEntity(){return!1}}function iT(n){return{forChild:sc(n.style),node:null}}function lT(n){const e=n,t=e.style.fontWeight==="normal";return{forChild:sc(e.style,t?void 0:"bold"),node:null}}const ld=new WeakMap;function cT(n){return n.nodeName==="PRE"||n.nodeType===Wr&&n.style!==void 0&&n.style.whiteSpace!==void 0&&n.style.whiteSpace.startsWith("pre")}function aT(n){const e=n;n.parentElement===null&&A(129);let t=e.textContent||"";if(function(r){let o,s=r.parentNode;const i=[r];for(;s!==null&&(o=ld.get(s))===void 0&&!cT(s);)i.push(s),s=s.parentNode;const l=o===void 0?s:o;for(let c=0;c<i.length;c++)ld.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
+ `||l===`\r
28
+ `?o.push(Bn()):l===" "?o.push(bs()):l!==""&&o.push(Oe(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=cd(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=cd(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:Oe(t)}}function cd(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===Wr){const s=t.style.display;if(s===""&&!$f(t)||s!==""&&!s.startsWith("inline"))return null}let o=t;for(;(o=e?t.firstChild:t.lastChild)!==null;)t=o;if(t.nodeType===Kt)return t;if(t.nodeName==="BR")return null}}const uT={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function jt(n){const e=uT[n.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:sc(n.style,e),node:null}}function Oe(n=""){return Zr(new hn(n))}function K(n){return n instanceof hn}function sc(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=>(K(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 Kn extends hn{static getType(){return"tab"}static clone(e){return new Kn(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=bs();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){A(126)}setDetail(e){A(127)}setMode(e){A(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function bs(){return Zr(new Kn)}function ad(n){return n instanceof Kn}class fT{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(D(t)){const i=t.getDescendantByIndex(o);t=i??t}if(D(r)){const i=r.getDescendantByIndex(s);r=i??r}return t===r?o<s:t.isBefore(r)}getNode(){const e=ve(this.key);return e===null&&A(20),e}set(e,t,r){const o=this._selection,s=this.key;this.key=e,this.offset=t,this.type=r,Wn()||(zt()===s&&xe(e),o!==null&&(o.setCachedNodes(null),o.dirty=!0))}}function et(n,e,t){return new fT(n,e,t)}function ic(n,e){let t=e.__key,r=n.offset,o="element";if(K(e)){o="text";const s=e.getTextContentSize();r>s&&(r=s)}else if(!D(e)){const s=e.getNextSibling();if(K(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 ud(n,e){if(D(e)){const t=e.getLastDescendant();D(t)||K(t)?ic(n,t):ic(n,e)}else ic(n,e)}function Ht(n,e,t,r){n.key=e,n.offset=t,n.type=r}class ws{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!io(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 ws(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(K(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=ve(o);s!==null&&r.push(s)}return Wn()||(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 j(n){return n instanceof Yt}class Yt{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!!j(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,u=i.offset;if(D(l)){const f=l.getDescendantByIndex(a);l=f??l}if(D(c)){let f=c.getDescendantByIndex(u);f!==null&&f!==l&&c.getChildAtIndex(u)===f&&(f=f.getPreviousSibling()),c=f??c}let d;return d=l.is(c)?D(l)&&l.getChildrenSize()>0?[]:[l]:l.getNodesBetween(c),Wn()||(this._cachedNodes=d),d}setTextNodeRange(e,t,r,o){Ht(this.anchor,e.__key,t,"text"),Ht(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]=lc(this);let a="",u=!0;for(let d=0;d<e.length;d++){const f=e[d];if(D(f)&&!f.isInline())u||(a+=`
29
+ `),u=!f.isEmpty();else if(u=!1,K(f)){let h=f.getTextContent();f===t?f===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):f===r&&(h=i?h.slice(0,c):h.slice(0,l)),a+=h}else!ae(f)&&!dn(f)||f===r&&this.isCollapsed()||(a+=f.getTextContent())}return a}applyDOMRange(e){const t=ce(),r=t.getEditorState()._selection,o=_d(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,r);if(o===null)return;const[s,i]=o;Ht(this.anchor,s.key,s.offset,s.type),Ht(this.focus,i.key,i.offset,i.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new Yt(et(e.key,e.offset,e.type),et(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=Pl(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=ut[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
+ `||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=`
32
+
33
+ `);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 tx(n){const e=n.getStyle(),t=vh(e);Ws.set(e,t)}function Qn(n,e){const t=Us("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=ZT(r);n.setStyle(o),Ws.set(o,r)}function nx(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)){Qn(n,e);return}const d=c.getTextContent().length,f=i.offset;let h=s.offset;const g=s.isBefore(i);let p=g?h:f,_=g?f:h;const y=g?s.type:i.type,m=g?i.type:s.type,T=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>f?f:h,_=m==="element"?d:h>f?h:f,p===_)return;if(Gn(c)||p===0&&_===d)Qn(c,e),c.select(p,_);else{const N=c.splitText(p,_),C=p===0?N[0]:N[1];Qn(C,e),C.select(0,_-p)}}}else{if(L(c)&&p<c.getTextContentSize()&&c.canHaveFormat()&&(p!==0&&!Gn(c)&&(c=c.splitText(p)[1],p=0,g?s.set(c.getKey(),p,"text"):i.set(c.getKey(),p,"text")),Qn(c,e)),L(a)&&a.canHaveFormat()){const C=a.getTextContent().length;a.__key!==T&&_!==0&&(_=C),_!==C&&!Gn(a)&&([a]=a.splitText(_)),(_!==0||m==="element")&&Qn(a,e)}for(let N=1;N<l;N++){const C=t[N],S=C.getKey();L(C)&&C.canHaveFormat()&&S!==c.getKey()&&S!==a.getKey()&&!C.isToken()&&Qn(C,e)}}}function rx(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();c?c.replace(i,!0):l.append(i);return}const o=n.getNodes(),s=r!==null?fx(r.getNode(),Mh):!1;s&&o.indexOf(s)===-1&&o.push(s);for(let i=0;i<o.length;i++){const l=o[i];if(!Mh(l))continue;if(!W(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 bh(n){return n.getNode().isAttached()}function ox(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 sx(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();d.setFormat(a.getFormatType()),d.setIndent(a.getIndent()),u.forEach(f=>d.append(f)),t&&(d=t.append(d)),a.replace(d);return}let l=null,c=[];for(let a=0;a<i;a++){const u=s[a];Fe(u)?(_c(n,c,c.length,e,t),c=[],l=u):l===null||l!==null&&Bd(u,l)?c.push(u):(_c(n,c,c.length,e,t),c=[u])}_c(n,c,c.length,e,t)}function _c(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))}),ox(_)}}else if(u.has(p.getKey())){if(!W(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 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)&&bh(h.anchor)&&bh(h.focus)?Is(h.clone()):f!==null?f.selectEnd():n.dirty=!0}function ix(n,e){const t=$d(n.focus,e);return Vn(t)&&!t.isIsolated()||W(t)&&!t.isInline()&&!t.canBeEmpty()}function wh(n,e,t,r){n.modify(e?"extend":"move",t,r)}function Dh(n){const e=n.anchor.getNode();return(Jn(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function lx(n,e,t){const r=Dh(n);wh(n,e,t?!r:r,"character")}function cx(n){const e=n.anchor,t=n.focus,s=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();let i=s.getFirstDescendant(),l=s.getLastDescendant(),c="element",a="element",u=0;L(i)?c="text":!W(i)&&i!==null&&(i=i.getParentOrThrow()),L(l)?(a="text",u=l.getTextContentSize()):!W(l)&&l!==null&&(l=l.getParentOrThrow()),i&&l&&(e.set(i.getKey(),0,c),t.set(l.getKey(),u,a))}function ax(n,e,t){const r=n.getStyle(),o=Us(r);return o!==null&&o[e]||t}function ux(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=n.style,d=Us(u);if(d!==null&&e in d)return d[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=ax(d,e,t);if(r===null)r=f;else if(r!==f){r="";break}}}return r===null?t:r}function Mh(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}function fx(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}const dx=Object.freeze(Object.defineProperty({__proto__:null,$addNodeStyle:tx,$getSelectionStyleValueForProperty:ux,$isAtNodeEnd:ex,$isParentElementRTL:Dh,$moveCaretSelection:wh,$moveCharacter:lx,$patchStyleText:nx,$selectAll:cx,$setBlocksType:rx,$shouldOverrideDefaultCharacterSelection:ix,$sliceSelectedTextNodeContent:QT,$trimTextContentFromAnchor:Oh,$wrapNodes:sx,createDOMRange:qT,createRectsFromDOMRange:XT,getStyleObjectFromCSS:Us,trimTextContentFromAnchor:Oh,$cloneWithProperties:Jt},Symbol.toStringTag,{value:"Module"}));function hx(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var mc=hx(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 js=new Map;function Ah(n){let e=n;for(;e!=null;){if(e.nodeType===Node.TEXT_NODE)return e;e=e.firstChild}return null}function kh(n){const e=n.parentNode;if(e==null)throw new Error("Should never happen");return[e,Array.from(e.childNodes).indexOf(n)]}function gx(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=Ah(c)),L(r)&&(a=Ah(a)),e===void 0||r===void 0||c===null||a===null)return null;c.nodeName==="BR"&&([c,u]=kh(c)),a.nodeName==="BR"&&([a,d]=kh(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 px(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,u)=>{const d=a.top-u.top;return Math.abs(d)<=3?a.left-u.left:d});for(let a=0;a<c;a++){const u=i[a],d=l&&l.top<=u.top&&l.top+l.height>u.top&&l.left+l.width>u.left,f=u.width+s===r.width;d||f?(i.splice(a--,1),c--):l=u}return i}function Ph(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 Hs(n){let e=js.get(n);return e===void 0&&(e=Ph(n),js.set(n,e)),e}function _x(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;return f?(_=u>d?d:u,p=u>d?u:d):h?(_=s?d:u,p=void 0):g&&(_=0,p=s?u:d),e.__text=e.__text.slice(_,p),e}}return e}function mx(n){if(n.type==="text")return n.offset===n.getNode().getTextContentSize();const e=n.getNode();return W(e)||mc(177),n.offset===e.getChildrenSize()}function Rh(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=`
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===`
36
+ `||a===`\r
37
+ `?c.insertParagraph():a===" "?c.insertNodes([Rd()]):c.insertText(a)}}}else e.insertRawText(s)}function Nc(n,e,t){n.dispatchCommand(ah,{nodes:e,selection:t})||t.insertNodes(e)}function hC(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType())throw Error(`LexicalNode: Node ${t.name} does not implement .exportJSON().`);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.`)}return e}function pg(n,e,t,r=[]){let o=e!==null?t.isSelected(e):!0;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=hC(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=pg(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 _g(n,e){const t=[],o=_e().getChildren();for(let s=0;s<o.length;s++){const i=o[s];pg(n,e,i,t)}return{namespace:n._config.namespace,nodes:t}}function mg(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}const gC=50;let tr=null;async function pC(n,e,t){if(tr!==null)return!1;if(e!==null)return new Promise((c,a)=>{n.update(()=>{c(yg(n,e,t))})});const r=n.getRootElement(),o=n._window==null?window.document:n._window.document,s=dg(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(),tr!==null&&(window.clearTimeout(tr),tr=null),c(yg(n,d,t))),!0),Vd);tr=window.setTimeout(()=>{u(),tr=null,c(!1)},gC),o.execCommand("copy"),i.remove()})}function yg(n,e,t){if(t===void 0){const o=dg(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=Tg(l)}e.preventDefault();const r=e.clipboardData;return r===null?!1:(xg(r,t),!0)}const _C=[["text/html",hg],["application/x-lexical-editor",gg]];function Tg(n=z()){const e={"text/plain":n?n.getTextContent():""};if(n){const t=Ld();for(const[r,o]of _C){const s=o(t,n);s!==null&&(e[r]=s)}}return e}function xg(n,e){for(const t in e){const r=e[t];r!==void 0&&n.setData(t,r)}}const mC=Object.freeze(Object.defineProperty({__proto__:null,$generateJSONFromSelectedNodes:_g,$generateNodesFromSerializedNodes:mg,$getClipboardDataFromSelection:Tg,$getHtmlContent:hg,$getLexicalContent:gg,$insertDataTransferForPlainText:fC,$insertDataTransferForRichText:dC,$insertGeneratedNodes:Nc,copyToClipboard:pC,setLexicalClipboardDataTransfer:xg},Symbol.toStringTag,{value:"Module"}));function yC(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Zs=yC(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 TC=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Ng=n=>TC?(n||window).getSelection():null;function Cg(n,e=z()){return e==null&&Zs(166),$(e)&&e.isCollapsed()||e.getNodes().length===0?"":ug(n,e)}function Sg(n,e=z()){return e==null&&Zs(166),$(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(vg(n,e))}function xC(n,e){const t=n.getData("text/plain")||n.getData("text/uri-list");t!=null&&e.insertRawText(t)}function NC(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 Cc(t,Og(i.nodes),e)}catch{}const o=n.getData("text/html");if(o)try{const i=new DOMParser().parseFromString(o,"text/html");return Cc(t,fg(t,i),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===`
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"})});
40
+ //# sourceMappingURL=index.umd.js.map