sykpcomposer 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/index.es.js +3131 -2738
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +19 -19
- package/dist/index.umd.js.map +1 -1
- package/dist/src/components/hooks/useModal.d.ts +12 -0
- package/dist/src/components/plugins/PageMargin.d.ts +14 -0
- package/dist/src/components/plugins/PageMarginPlugin/CustomMarginDialog.d.ts +6 -0
- package/dist/src/components/plugins/PageMarginPlugin/index.d.ts +46 -0
- package/dist/src/components/ui/Button.d.ts +17 -0
- package/dist/src/components/ui/Dialog.d.ts +15 -0
- package/dist/src/components/ui/DropDown.d.ts +24 -0
- package/dist/src/components/ui/Modal.d.ts +14 -0
- package/dist/src/components/ui/TextInput.d.ts +19 -0
- package/dist/src/utils/FindParent.d.ts +6 -0
- package/dist/src/utils/getSelectedNode.d.ts +2 -0
- package/dist/src/utils/joinClasses.d.ts +8 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(Ae,F){typeof exports=="object"&&typeof module<"u"?F(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],F):(Ae=typeof globalThis<"u"?globalThis:Ae||self,F(Ae.ViteButton={},Ae.React,Ae.ReactDOM))})(this,function(Ae,F,sn){"use strict";function Us(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 kt=Us(F);var er={exports:{}},it={};/*
|
|
2
2
|
object-assign
|
|
3
3
|
(c) Sindre Sorhus
|
|
4
4
|
@license MIT
|
|
5
|
-
*/var
|
|
5
|
+
*/var tr,vo;function xo(){if(vo)return tr;vo=1;var n=Object.getOwnPropertySymbols,e=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},l=0;l<10;l++)s["_"+String.fromCharCode(l)]=l;var a=Object.getOwnPropertyNames(s).map(function(u){return s[u]});if(a.join("")!=="0123456789")return!1;var c={};return"abcdefghijklmnopqrst".split("").forEach(function(u){c[u]=u}),Object.keys(Object.assign({},c)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return tr=o()?Object.assign:function(i,s){for(var l,a=r(i),c,u=1;u<arguments.length;u++){l=Object(arguments[u]);for(var h in l)e.call(l,h)&&(a[h]=l[h]);if(n){c=n(l);for(var d=0;d<c.length;d++)t.call(l,c[d])&&(a[c[d]]=l[c[d]])}}return a},tr}/** @license React v17.0.2
|
|
6
6
|
* react-jsx-runtime.production.min.js
|
|
7
7
|
*
|
|
8
8
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
9
9
|
*
|
|
10
10
|
* This source code is licensed under the MIT license found in the
|
|
11
11
|
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/var
|
|
12
|
+
*/var bo;function Vs(){if(bo)return it;bo=1,xo();var n=F,e=60103;if(it.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var t=Symbol.for;e=t("react.element"),it.Fragment=t("react.fragment")}var r=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o=Object.prototype.hasOwnProperty,i={key:!0,ref:!0,__self:!0,__source:!0};function s(l,a,c){var u,h={},d=null,f=null;c!==void 0&&(d=""+c),a.key!==void 0&&(d=""+a.key),a.ref!==void 0&&(f=a.ref);for(u in a)o.call(a,u)&&!i.hasOwnProperty(u)&&(h[u]=a[u]);if(l&&l.defaultProps)for(u in a=l.defaultProps,a)h[u]===void 0&&(h[u]=a[u]);return{$$typeof:e,type:l,key:d,ref:f,props:h,_owner:r.current}}return it.jsx=s,it.jsxs=s,it}var nr={};/** @license React v17.0.2
|
|
13
13
|
* react-jsx-runtime.development.js
|
|
14
14
|
*
|
|
15
15
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
16
16
|
*
|
|
17
17
|
* This source code is licensed under the MIT license found in the
|
|
18
18
|
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/var
|
|
20
|
-
`+
|
|
21
|
-
`),ue=
|
|
22
|
-
`),
|
|
23
|
-
`+
|
|
19
|
+
*/var Co;function Js(){return Co||(Co=1,function(n){process.env.NODE_ENV!=="production"&&function(){var e=F,t=xo(),r=60103,o=60106;n.Fragment=60107;var i=60108,s=60114,l=60109,a=60110,c=60112,u=60113,h=60120,d=60115,f=60116,g=60121,_=60122,m=60117,x=60129,v=60131;if(typeof Symbol=="function"&&Symbol.for){var y=Symbol.for;r=y("react.element"),o=y("react.portal"),n.Fragment=y("react.fragment"),i=y("react.strict_mode"),s=y("react.profiler"),l=y("react.provider"),a=y("react.context"),c=y("react.forward_ref"),u=y("react.suspense"),h=y("react.suspense_list"),d=y("react.memo"),f=y("react.lazy"),g=y("react.block"),_=y("react.server.block"),m=y("react.fundamental"),y("react.scope"),y("react.opaque.id"),x=y("react.debug_trace_mode"),y("react.offscreen"),v=y("react.legacy_hidden")}var S=typeof Symbol=="function"&&Symbol.iterator,w="@@iterator";function C(p){if(p===null||typeof p!="object")return null;var k=S&&p[S]||p[w];return typeof k=="function"?k:null}var N=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function T(p){{for(var k=arguments.length,I=new Array(k>1?k-1:0),A=1;A<k;A++)I[A-1]=arguments[A];P("error",p,I)}}function P(p,k,I){{var A=N.ReactDebugCurrentFrame,V=A.getStackAddendum();V!==""&&(k+="%s",I=I.concat([V]));var J=I.map(function($){return""+$});J.unshift("Warning: "+k),Function.prototype.apply.call(console[p],console,J)}}var j=!1;function z(p){return!!(typeof p=="string"||typeof p=="function"||p===n.Fragment||p===s||p===x||p===i||p===u||p===h||p===v||j||typeof p=="object"&&p!==null&&(p.$$typeof===f||p.$$typeof===d||p.$$typeof===l||p.$$typeof===a||p.$$typeof===c||p.$$typeof===m||p.$$typeof===g||p[0]===_))}function ee(p,k,I){var A=k.displayName||k.name||"";return p.displayName||(A!==""?I+"("+A+")":I)}function q(p){return p.displayName||"Context"}function B(p){if(p==null)return null;if(typeof p.tag=="number"&&T("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof p=="function")return p.displayName||p.name||null;if(typeof p=="string")return p;switch(p){case n.Fragment:return"Fragment";case o:return"Portal";case s:return"Profiler";case i:return"StrictMode";case u:return"Suspense";case h:return"SuspenseList"}if(typeof p=="object")switch(p.$$typeof){case a:var k=p;return q(k)+".Consumer";case l:var I=p;return q(I._context)+".Provider";case c:return ee(p,p.render,"ForwardRef");case d:return B(p.type);case g:return B(p._render);case f:{var A=p,V=A._payload,J=A._init;try{return B(J(V))}catch{return null}}}return null}var Y=0,ce,Fe,Je,tn,nn,rn,bt;function Ct(){}Ct.__reactDisabledLog=!0;function wt(){{if(Y===0){ce=console.log,Fe=console.info,Je=console.warn,tn=console.error,nn=console.group,rn=console.groupCollapsed,bt=console.groupEnd;var p={configurable:!0,enumerable:!0,value:Ct,writable:!0};Object.defineProperties(console,{info:p,log:p,warn:p,error:p,group:p,groupCollapsed:p,groupEnd:p})}Y++}}function St(){{if(Y--,Y===0){var p={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:t({},p,{value:ce}),info:t({},p,{value:Fe}),warn:t({},p,{value:Je}),error:t({},p,{value:tn}),group:t({},p,{value:nn}),groupCollapsed:t({},p,{value:rn}),groupEnd:t({},p,{value:bt})})}Y<0&&T("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var pe=N.ReactCurrentDispatcher,rt;function Ne(p,k,I){{if(rt===void 0)try{throw Error()}catch(V){var A=V.stack.trim().match(/\n( *(at )?)/);rt=A&&A[1]||""}return`
|
|
20
|
+
`+rt+p}}var Ye=!1,ot;{var Dc=typeof WeakMap=="function"?WeakMap:Map;ot=new Dc}function Ds(p,k){if(!p||Ye)return"";{var I=ot.get(p);if(I!==void 0)return I}var A;Ye=!0;var V=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var J;J=pe.current,pe.current=null,wt();try{if(k){var $=function(){throw Error()};if(Object.defineProperty($.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct($,[])}catch(Le){A=Le}Reflect.construct(p,[],$)}else{try{$.call()}catch(Le){A=Le}p.call($.prototype)}}else{try{throw Error()}catch(Le){A=Le}p()}}catch(Le){if(Le&&A&&typeof Le.stack=="string"){for(var W=Le.stack.split(`
|
|
21
|
+
`),ue=A.stack.split(`
|
|
22
|
+
`),X=W.length-1,Q=ue.length-1;X>=1&&Q>=0&&W[X]!==ue[Q];)Q--;for(;X>=1&&Q>=0;X--,Q--)if(W[X]!==ue[Q]){if(X!==1||Q!==1)do if(X--,Q--,Q<0||W[X]!==ue[Q]){var Me=`
|
|
23
|
+
`+W[X].replace(" at new "," at ");return typeof p=="function"&&ot.set(p,Me),Me}while(X>=1&&Q>=0);break}}}finally{Ye=!1,pe.current=J,St(),Error.prepareStackTrace=V}var Tt=p?p.displayName||p.name:"",Ks=Tt?Ne(Tt):"";return typeof p=="function"&&ot.set(p,Ks),Ks}function Rs(p,k,I){return Ds(p,!1)}function Rc(p){var k=p.prototype;return!!(k&&k.isReactComponent)}function Qn(p,k,I){if(p==null)return"";if(typeof p=="function")return Ds(p,Rc(p));if(typeof p=="string")return Ne(p);switch(p){case u:return Ne("Suspense");case h:return Ne("SuspenseList")}if(typeof p=="object")switch(p.$$typeof){case c:return Rs(p.render);case d:return Qn(p.type,k,I);case g:return Rs(p._render);case f:{var A=p,V=A._payload,J=A._init;try{return Qn(J(V),k,I)}catch{}}}return""}var Is={},Fs=N.ReactDebugCurrentFrame;function Zn(p){if(p){var k=p._owner,I=Qn(p.type,p._source,k?k.type:null);Fs.setExtraStackFrame(I)}else Fs.setExtraStackFrame(null)}function Ic(p,k,I,A,V){{var J=Function.call.bind(Object.prototype.hasOwnProperty);for(var $ in p)if(J(p,$)){var W=void 0;try{if(typeof p[$]!="function"){var ue=Error((A||"React class")+": "+I+" type `"+$+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof p[$]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ue.name="Invariant Violation",ue}W=p[$](k,$,A,I,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(X){W=X}W&&!(W instanceof Error)&&(Zn(V),T("%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).",A||"React class",I,$,typeof W),Zn(null)),W instanceof Error&&!(W.message in Is)&&(Is[W.message]=!0,Zn(V),T("Failed %s type: %s",I,W.message),Zn(null))}}}var on=N.ReactCurrentOwner,go=Object.prototype.hasOwnProperty,Fc={key:!0,ref:!0,__self:!0,__source:!0},Ms,Ls,po;po={};function Mc(p){if(go.call(p,"ref")){var k=Object.getOwnPropertyDescriptor(p,"ref").get;if(k&&k.isReactWarning)return!1}return p.ref!==void 0}function Lc(p){if(go.call(p,"key")){var k=Object.getOwnPropertyDescriptor(p,"key").get;if(k&&k.isReactWarning)return!1}return p.key!==void 0}function Ac(p,k){if(typeof p.ref=="string"&&on.current&&k&&on.current.stateNode!==k){var I=B(on.current.type);po[I]||(T('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',B(on.current.type),p.ref),po[I]=!0)}}function jc(p,k){{var I=function(){Ms||(Ms=!0,T("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",k))};I.isReactWarning=!0,Object.defineProperty(p,"key",{get:I,configurable:!0})}}function Bc(p,k){{var I=function(){Ls||(Ls=!0,T("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",k))};I.isReactWarning=!0,Object.defineProperty(p,"ref",{get:I,configurable:!0})}}var Wc=function(p,k,I,A,V,J,$){var W={$$typeof:r,type:p,key:k,ref:I,props:$,_owner:J};return W._store={},Object.defineProperty(W._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(W,"_self",{configurable:!1,enumerable:!1,writable:!1,value:A}),Object.defineProperty(W,"_source",{configurable:!1,enumerable:!1,writable:!1,value:V}),Object.freeze&&(Object.freeze(W.props),Object.freeze(W)),W};function zc(p,k,I,A,V){{var J,$={},W=null,ue=null;I!==void 0&&(W=""+I),Lc(k)&&(W=""+k.key),Mc(k)&&(ue=k.ref,Ac(k,V));for(J in k)go.call(k,J)&&!Fc.hasOwnProperty(J)&&($[J]=k[J]);if(p&&p.defaultProps){var X=p.defaultProps;for(J in X)$[J]===void 0&&($[J]=X[J])}if(W||ue){var Q=typeof p=="function"?p.displayName||p.name||"Unknown":p;W&&jc($,Q),ue&&Bc($,Q)}return Wc(p,W,ue,V,A,on.current,$)}}var _o=N.ReactCurrentOwner,As=N.ReactDebugCurrentFrame;function Et(p){if(p){var k=p._owner,I=Qn(p.type,p._source,k?k.type:null);As.setExtraStackFrame(I)}else As.setExtraStackFrame(null)}var mo;mo=!1;function yo(p){return typeof p=="object"&&p!==null&&p.$$typeof===r}function js(){{if(_o.current){var p=B(_o.current.type);if(p)return`
|
|
24
24
|
|
|
25
|
-
Check the render method of \``+p+"`."}return""}}function
|
|
25
|
+
Check the render method of \``+p+"`."}return""}}function $c(p){{if(p!==void 0){var k=p.fileName.replace(/^.*[\\\/]/,""),I=p.lineNumber;return`
|
|
26
26
|
|
|
27
|
-
Check your code at `+k+":"+
|
|
27
|
+
Check your code at `+k+":"+I+"."}return""}}var Bs={};function Kc(p){{var k=js();if(!k){var I=typeof p=="string"?p:p.displayName||p.name;I&&(k=`
|
|
28
28
|
|
|
29
|
-
Check the top-level render call using <`+
|
|
29
|
+
Check the top-level render call using <`+I+">.")}return k}}function Ws(p,k){{if(!p._store||p._store.validated||p.key!=null)return;p._store.validated=!0;var I=Kc(k);if(Bs[I])return;Bs[I]=!0;var A="";p&&p._owner&&p._owner!==_o.current&&(A=" It was passed a child from "+B(p._owner.type)+"."),Et(p),T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',I,A),Et(null)}}function zs(p,k){{if(typeof p!="object")return;if(Array.isArray(p))for(var I=0;I<p.length;I++){var A=p[I];yo(A)&&Ws(A,k)}else if(yo(p))p._store&&(p._store.validated=!0);else if(p){var V=C(p);if(typeof V=="function"&&V!==p.entries)for(var J=V.call(p),$;!($=J.next()).done;)yo($.value)&&Ws($.value,k)}}}function Uc(p){{var k=p.type;if(k==null||typeof k=="string")return;var I;if(typeof k=="function")I=k.propTypes;else if(typeof k=="object"&&(k.$$typeof===c||k.$$typeof===d))I=k.propTypes;else return;if(I){var A=B(k);Ic(I,p.props,"prop",A,p)}else if(k.PropTypes!==void 0&&!mo){mo=!0;var V=B(k);T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",V||"Unknown")}typeof k.getDefaultProps=="function"&&!k.getDefaultProps.isReactClassApproved&&T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Vc(p){{for(var k=Object.keys(p.props),I=0;I<k.length;I++){var A=k[I];if(A!=="children"&&A!=="key"){Et(p),T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",A),Et(null);break}}p.ref!==null&&(Et(p),T("Invalid attribute `ref` supplied to `React.Fragment`."),Et(null))}}function $s(p,k,I,A,V,J){{var $=z(p);if(!$){var W="";(p===void 0||typeof p=="object"&&p!==null&&Object.keys(p).length===0)&&(W+=" 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 ue=$c(V);ue?W+=ue:W+=js();var X;p===null?X="null":Array.isArray(p)?X="array":p!==void 0&&p.$$typeof===r?(X="<"+(B(p.type)||"Unknown")+" />",W=" Did you accidentally export a JSX literal instead of a component?"):X=typeof p,T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",X,W)}var Q=zc(p,k,I,V,J);if(Q==null)return Q;if($){var Me=k.children;if(Me!==void 0)if(A)if(Array.isArray(Me)){for(var Tt=0;Tt<Me.length;Tt++)zs(Me[Tt],p);Object.freeze&&Object.freeze(Me)}else T("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 zs(Me,p)}return p===n.Fragment?Vc(Q):Uc(Q),Q}}function Jc(p,k,I){return $s(p,k,I,!0)}function Yc(p,k,I){return $s(p,k,I,!1)}var qc=Yc,Hc=Jc;n.jsx=qc,n.jsxs=Hc}()}(nr)),nr}process.env.NODE_ENV==="production"?er.exports=Vs():er.exports=Js();var E=er.exports;function Ys(n){return{}}const ln={},qs={},wo={},qe={},st={},an={},lt={},rr={},or={},Nt={},Pt={},ge={},cn={},un={},Hs={},So={},Gs={},Eo={},Xs={},To={},ko={},dn={},Qs={},No={},Po={},Oo={},Zs={},el={},tl={},Do={},Ro={},Ot={},Io={},Fo={},nl={},fn={},ir={},sr={},rl={},ol={},Dt={},Rt={},il={},sl={},ll={},_e=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,al=_e&&"documentMode"in document?document.documentMode:null,me=_e&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),je=_e&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),hn=!(!_e||!("InputEvent"in window)||al)&&"getTargetRanges"in new window.InputEvent("input"),lr=_e&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),gn=_e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,cl=_e&&/Android/.test(navigator.userAgent),Mo=_e&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ul=_e&&cl&&Mo,ar=_e&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Mo,It=1,Be=3,He=0,Lo=1,at=2,dl=0,fl=1,hl=2,pn=4,_n=8,cr=128,gl=112|(3|pn|_n)|cr,ur=1,dr=2,fr=3,hr=4,gr=5,pr=6,mn=lr||gn||ar?" ":"",Pe=`
|
|
30
30
|
|
|
31
|
-
`,ll=Me?" ":hn,Ai="֑-߿יִ-﷽ﹰ-ﻼ",Oi="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",al=new RegExp("^[^"+Oi+"]*["+Ai+"]"),cl=new RegExp("^[^"+Ai+"]*["+Oi+"]"),Pe={bold:1,code:16,highlight:rr,italic:2,strikethrough:dn,subscript:32,superscript:64,underline:fn},ul={directionless:1,unmergeable:2},Di={center:or,end:cr,justify:lr,left:ir,right:sr,start:ar},dl={[or]:"center",[cr]:"end",[lr]:"justify",[ir]:"left",[sr]:"right",[ar]:"start"},fl={normal:0,segmented:2,token:1},hl={[rl]:"normal",[ol]:"segmented",[il]:"token"};function gl(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var A=gl(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 gn(...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 pl=100;let ur=!1,dr=0;function _l(n){dr=n.timeStamp}function fr(n,e,t){return e.__lexicalLineBreak===n||n[`__lexicalKey_${t._key}`]!==void 0}function ml(n,e,t){const r=Se(t._window);let i=null,o=null;r!==null&&r.anchorNode===n&&(i=r.anchorOffset,o=r.focusOffset);const s=n.nodeValue;s!==null&&yr(e,s,i,o,!1)}function yl(n,e,t){if(P(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return e.nodeType===je&&t.isAttached()}function Ri(n,e,t){ur=!0;const r=performance.now()-dr>pl;try{he(n,()=>{const i=L()||function(d){return d.getEditorState().read(()=>{const h=L();return h!==null?h.clone():null})}(n),o=new Map,s=n.getRootElement(),l=n._editorState,a=n._blockCursorElement;let c=!1,u="";for(let d=0;d<e.length;d++){const h=e[d],g=h.type,_=h.target;let m=Ye(_,l);if(!(m===null&&_!==s||U(m))){if(g==="characterData")r&&O(m)&&yl(i,_,m)&&ml(_,m,n);else if(g==="childList"){c=!0;const x=h.addedNodes;for(let T=0;T<x.length;T++){const S=x[T],b=Ki(S),N=S.parentNode;if(N!=null&&S!==a&&b===null&&(S.nodeName!=="BR"||!fr(S,N,n))){if(Me){const w=S.innerText||S.nodeValue;w&&(u+=w)}N.removeChild(S)}}const y=h.removedNodes,v=y.length;if(v>0){let T=0;for(let S=0;S<v;S++){const b=y[S];(b.nodeName==="BR"&&fr(b,_,n)||a===b)&&(_.appendChild(b),T++)}v!==T&&(_===s&&(m=$i(l)),o.set(_,m))}}}}if(o.size>0)for(const[d,h]of o)if(C(h)){const g=h.getChildrenKeys();let _=d.firstChild;for(let m=0;m<g.length;m++){const x=g[m],y=n.getElementByKey(x);y!==null&&(_==null?(d.appendChild(y),_=y):_!==y&&d.replaceChild(y,_),_=_.nextSibling)}}else O(h)&&h.markDirty();const f=t.takeRecords();if(f.length>0){for(let d=0;d<f.length;d++){const h=f[d],g=h.addedNodes,_=h.target;for(let m=0;m<g.length;m++){const x=g[m],y=x.parentNode;y==null||x.nodeName!=="BR"||fr(x,_,n)||y.removeChild(x)}}t.takeRecords()}i!==null&&(c&&(i.dirty=!0,be(i)),Me&&to(n)&&i.insertRawText(u))})}finally{ur=!1}}function Li(n){const e=n._observer;e!==null&&Ri(n,e.takeRecords(),e)}function Ii(n){(function(e){dr===0&&Cn(e).addEventListener("textInput",_l,!0)})(n),n._observer=new MutationObserver((e,t)=>{Ri(n,e,t)})}function Fi(n,e){const t=n.__mode,r=n.__format,i=n.__style,o=e.__mode,s=e.__format,l=e.__style;return!(t!==null&&t!==o||r!==null&&r!==s||i!==null&&i!==l)}function Mi(n,e){const t=n.mergeWithSibling(e),r=Q()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function ji(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&O(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Fi(e,r)){r=Mi(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&O(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Fi(r,t)){r=Mi(r,t);break}break}t.remove()}}else r.remove()}function Wi(n){return Bi(n.anchor),Bi(n.focus),n}function Bi(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,i;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),i=!0):(r=e.getChildAtIndex(t),i=!1),O(r)){n.set(r.__key,i?r.getTextContentSize():0,"text");break}if(!C(r))break;n.set(r.__key,i?r.getChildrenSize():0,"element")}}let vl=1;const xl=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function hr(n){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return U(Ye(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&pn(e)==null)}function Ot(n,e,t){const r=n.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(t)&&e!==null&&!hr(e)&&zi(e)===n}catch{return!1}}function gr(n){return n instanceof Wn}function zi(n){let e=n;for(;e!=null;){const t=pn(e);if(gr(t))return t;e=xn(e)}return null}function pn(n){return n?n.__lexicalEditor:null}function at(n){return n.isToken()||n.isSegmented()}function Cl(n){return n.nodeType===je}function _n(n){let e=n;for(;e!=null;){if(Cl(e))return e;e=e.firstChild}return null}function pr(n,e,t){const r=Pe[e];if(t!==null&&(n&r)==(t&r))return n;let i=n^r;return e==="subscript"?i&=~Pe.superscript:e==="superscript"&&(i&=~Pe.subscript),i}function bl(n,e){if(e!=null)return void(n.__key=e);fe(),Bo();const t=Q(),r=De(),i=""+vl++;r._nodeMap.set(i,n),C(n)?t._dirtyElements.set(i,!0):t._dirtyLeaves.add(i),t._cloneNotNeeded.add(i),t._dirtyType=Pi,n.__key=i}function Qe(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),i=n.getPreviousSibling(),o=n.getNextSibling();if(i===null)if(o!==null){const s=o.getWritable();r.__first=o.__key,s.__prev=null}else r.__first=null;else{const s=i.getWritable();if(o!==null){const l=o.getWritable();l.__prev=s.__key,s.__next=l.__key}else s.__next=null;t.__prev=null}if(o===null)if(i!==null){const s=i.getWritable();r.__last=i.__key,s.__next=null}else r.__last=null;else{const s=o.getWritable();if(i!==null){const l=i.getWritable();l.__next=s.__key,s.__prev=l.__key}else s.__prev=null;t.__next=null}r.__size--,t.__parent=null}}function mn(n){Bo();const e=n.getLatest(),t=e.__parent,r=De(),i=Q(),o=r._nodeMap,s=i._dirtyElements;t!==null&&function(a,c,u){let f=a;for(;f!==null;){if(u.has(f))return;const d=c.get(f);if(d===void 0)break;u.set(f,!1),f=d.__parent}}(t,o,s);const l=e.__key;i._dirtyType=Pi,C(n)?s.set(l,!0):i._dirtyLeaves.add(l)}function re(n){fe();const e=Q(),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 We(){return Qt()?null:Q()._compositionKey}function se(n,e){const t=(e||De())._nodeMap.get(n);return t===void 0?null:t}function Ki(n,e){const t=n[`__lexicalKey_${Q()._key}`];return t!==void 0?se(t,e):null}function Ye(n,e){let t=n;for(;t!=null;){const r=Ki(t,e);if(r!==null)return r;t=xn(t)}return null}function Vi(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function Ui(n){return n.read(()=>Z().getTextContent())}function Z(){return $i(De())}function $i(n){return n._nodeMap.get("root")}function be(n){fe();const e=De();n!==null&&(n.dirty=!0,n.setCachedNodes(null)),e._selection=n}function ct(n){const e=Q(),t=function(r,i){let o=r;for(;o!=null;){const s=o[`__lexicalKey_${i._key}`];if(s!==void 0)return s;o=xn(o)}return null}(n,e);return t===null?n===e.getRootElement()?se("root"):null:se(t)}function Ji(n,e){return e?n.getTextContentSize():0}function qi(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function _r(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Hi(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Qi(n){return n.nodeType===je?n.nodeValue:null}function mr(n,e,t){const r=Se(e._window);if(r===null)return;const i=r.anchorNode;let{anchorOffset:o,focusOffset:s}=r;if(i!==null){let l=Qi(i);const a=Ye(i);if(l!==null&&O(a)){if(l===hn&&t){const c=t.length;l=t,o=c,s=c}l!==null&&yr(a,l,o,s,n)}}}function yr(n,e,t,r,i){let o=n;if(o.isAttached()&&(i||!o.isDirty())){const s=o.isComposing();let l=e;(s||i)&&e[e.length-1]===hn&&(l=e.slice(0,-1));const a=o.getTextContent();if(i||l!==a){if(l===""){if(re(null),tr||un||nr)o.remove();else{const _=Q();setTimeout(()=>{_.update(()=>{o.isAttached()&&o.remove()})},20)}return}const c=o.getParent(),u=Ht(),f=o.getTextContentSize(),d=We(),h=o.getKey();if(o.isToken()||d!==null&&h===d&&!s||P(u)&&(c!==null&&!c.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===n.__key&&u.anchor.offset===0&&!o.canInsertTextBefore()&&!s||u.focus.key===n.__key&&u.focus.offset===f&&!o.canInsertTextAfter()&&!s))return void o.markDirty();const g=L();if(!P(g)||t===null||r===null)return void o.setTextContent(l);if(g.setTextNodeRange(o,t,o,r),o.isSegmented()){const _=ie(o.getTextContent());o.replace(_),o=_}o.setTextContent(l)}}}function Sl(n,e){if(e.isSegmented())return!0;if(!n.isCollapsed())return!1;const t=n.anchor.offset,r=e.getParentOrThrow(),i=e.isToken();return t===0?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||i||function(o){const s=o.getPreviousSibling();return(O(s)||C(s)&&s.isInline())&&!s.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||i)}function Yi(n){return n==="ArrowLeft"}function Zi(n){return n==="ArrowRight"}function Dt(n,e){return me?n:e}function Xi(n){return n==="Enter"}function Rt(n){return n==="Backspace"}function Lt(n){return n==="Delete"}function Gi(n,e,t){return n.toLowerCase()==="a"&&Dt(e,t)}function wl(){const n=Z();be(Wi(n.select(0,n.getChildrenSize())))}function It(n,e){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const t=n.__lexicalClassNameCache,r=t[e];if(r!==void 0)return r;const i=n[e];if(typeof i=="string"){const o=gn(i);return t[e]=o,o}return i}function vr(n,e,t,r,i){if(t.size===0)return;const o=r.__type,s=r.__key,l=e.get(o);l===void 0&&A(33,o);const a=l.klass;let c=n.get(a);c===void 0&&(c=new Map,n.set(a,c));const u=c.get(s),f=u==="destroyed"&&i==="created";(u===void 0||f)&&c.set(s,f?"updated":i)}function eo(n,e,t){const r=n.getParent();let i=t,o=n;return r!==null&&(e&&t===0?(i=o.getIndexWithinParent(),o=r):e||t!==o.getChildrenSize()||(i=o.getIndexWithinParent()+1,o=r)),o.getChildAtIndex(e?i-1:i)}function Ft(n,e){const t=n.offset;if(n.type==="element")return eo(n.getNode(),e,t);{const r=n.getNode();if(e&&t===0||!e&&t===r.getTextContentSize()){const i=e?r.getPreviousSibling():r.getNextSibling();return i===null?eo(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):i}}return null}function to(n){const e=Cn(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function R(n,e,t){return $o(n,e,t)}function yn(n){return!oe(n)&&!n.isLastChild()&&!n.isInline()}function vn(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&A(75,e),t}function xn(n){const e=n.assignedSlot||n.parentElement;return e!==null&&e.nodeType===11?e.host:e}function xr(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Cn(n){const e=n._window;return e===null&&A(78),e}function Tl(n){let e=n.getParentOrThrow();for(;e!==null;){if(ut(e))return e;e=e.getParentOrThrow()}return e}function ut(n){return oe(n)||C(n)&&n.isShadowRoot()}function bn(n){const e=Q(),t=n.constructor.getType(),r=e._nodes.get(t);r===void 0&&A(97);const i=r.replace;if(i!==null){const o=i(n);return o instanceof n.constructor||A(98),o}return n}function Cr(n,e){!oe(n.getParent())||C(e)||U(e)||A(99)}function br(n){return(U(n)||C(n)&&!n.canBeEmpty())&&!n.isInline()}function Sr(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function kl(n,e,t){let r=n._blockCursorElement;if(P(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const i=t.anchor,o=i.getNode(),s=i.offset;let l=!1,a=null;if(s===o.getChildrenSize())br(o.getChildAtIndex(s-1))&&(l=!0);else{const c=o.getChildAtIndex(s);if(br(c)){const u=c.getPreviousSibling();(u===null||br(u))&&(l=!0,a=n.getElementByKey(c.__key))}}if(l){const c=n.getElementByKey(o.__key);return r===null&&(n._blockCursorElement=r=function(u){const f=u.theme,d=document.createElement("div");d.contentEditable="false",d.setAttribute("data-lexical-cursor","true");let h=f.blockCursor;if(h!==void 0){if(typeof h=="string"){const g=gn(h);h=f.blockCursor=g}h!==void 0&&d.classList.add(...h)}return d}(n._config)),e.style.caretColor="transparent",void(a===null?c.appendChild(r):c.insertBefore(r,a))}}r!==null&&Sr(r,n,e)}function Se(n){return _e?(n||window).getSelection():null}function wr(n){return n.nodeType===1}function Tr(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 Sn(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 dt(n){if(oe(n)||U(n)&&!n.isInline())return!0;if(!C(n)||ut(n))return!1;const e=n.getFirstChild(),t=e===null||$t(e)||O(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function kr(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function El(){return Q()}const no=new WeakMap,Nl=new Map;function Pl(n){if(!n._readOnly&&n.isEmpty())return Nl;n._readOnly||A(192);let e=no.get(n);if(!e){e=new Map,no.set(n,e);for(const[t,r]of n._nodeMap){const i=r.__type;let o=e.get(i);o||(o=new Map,e.set(i,o)),o.set(t,r)}}return e}function Er(n){const e=n.constructor.clone(n);return e.afterCloneFrom(n),e}function ro(n,e,t,r,i,o){let s=n.getFirstChild();for(;s!==null;){const l=s.__key;s.__parent===e&&(C(s)&&ro(s,l,t,r,i,o),t.has(l)||o.delete(l),i.push(l)),s=s.getNextSibling()}}let Be,le,Mt,wn,Nr,Pr,Ze,ye,Ar,jt,G="",ae="",we=null,ve="",Ae="",io=!1,Wt=!1,Tn=null;function kn(n,e){const t=Ze.get(n);if(e!==null){const r=Lr(n);r.parentNode===e&&e.removeChild(r)}if(ye.has(n)||le._keyToDOMMap.delete(n),C(t)){const r=Nn(t,Ze);Or(r,0,r.length-1,null)}t!==void 0&&vr(jt,Mt,wn,t,"destroyed")}function Or(n,e,t,r){let i=e;for(;i<=t;++i){const o=n[i];o!==void 0&&kn(o,r)}}function Xe(n,e){n.setProperty("text-align",e)}const Al="40px";function oo(n,e){const t=Be.theme.indent;if(typeof t=="string"){const i=n.classList.contains(t);e>0&&!i?n.classList.add(t):e<1&&i&&n.classList.remove(t)}const r=getComputedStyle(n).getPropertyValue("--lexical-indent-base-value")||Al;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${r})`)}function so(n,e){const t=n.style;e===0?Xe(t,""):e===ir?Xe(t,"left"):e===or?Xe(t,"center"):e===sr?Xe(t,"right"):e===lr?Xe(t,"justify"):e===ar?Xe(t,"start"):e===cr&&Xe(t,"end")}function En(n,e,t){const r=ye.get(n);r===void 0&&A(60);const i=r.createDOM(Be,le);if(function(o,s,l){const a=l._keyToDOMMap;s["__lexicalKey_"+l._key]=o,a.set(o,s)}(n,i,le),O(r)?i.setAttribute("data-lexical-text","true"):U(r)&&i.setAttribute("data-lexical-decorator","true"),C(r)){const o=r.__indent,s=r.__size;if(o!==0&&oo(i,o),s!==0){const a=s-1;(function(c,u,f,d){const h=ae;ae="",Dr(c,f,0,u,d,null),co(f,d),ae=h})(Nn(r,ye),a,r,i)}const l=r.__format;l!==0&&so(i,l),r.isInline()||ao(null,r,i),yn(r)&&(G+=Ne,Ae+=Ne)}else{const o=r.getTextContent();if(U(r)){const s=r.decorate(le,Be);s!==null&&uo(n,s),i.contentEditable="false"}else O(r)&&(r.isDirectionless()||(ae+=o));G+=o,Ae+=o}if(e!==null)if(t!=null)e.insertBefore(i,t);else{const o=e.__lexicalLineBreak;o!=null?e.insertBefore(i,o):e.appendChild(i)}return vr(jt,Mt,wn,r,"created"),i}function Dr(n,e,t,r,i,o){const s=G;G="";let l=t;for(;l<=r;++l){En(n[l],i,o);const a=ye.get(n[l]);a!==null&&O(a)&&(we===null&&(we=a.getFormat()),ve===""&&(ve=a.getStyle()))}yn(e)&&(G+=Ne),i.__lexicalTextContent=G,G=s+G}function lo(n,e){const t=e.get(n);return $t(t)||U(t)&&t.isInline()}function ao(n,e,t){const r=n!==null&&(n.__size===0||lo(n.__last,Ze)),i=e.__size===0||lo(e.__last,ye);if(r){if(!i){const o=t.__lexicalLineBreak;if(o!=null)try{t.removeChild(o)}catch(s){if(typeof s=="object"&&s!=null){const l=`${s.toString()} Parent: ${t.tagName}, child: ${o.tagName}.`;throw new Error(l)}throw s}t.__lexicalLineBreak=null}}else if(i){const o=document.createElement("br");t.__lexicalLineBreak=o,t.appendChild(o)}}function co(n,e){const t=e.__lexicalDirTextContent,r=e.__lexicalDir;if(t!==ae||r!==Tn){const o=ae==="",s=o?Tn:(i=ae,al.test(i)?"rtl":cl.test(i)?"ltr":null);if(s!==r){const l=e.classList,a=Be.theme;let c=r!==null?a[r]:void 0,u=s!==null?a[s]:void 0;if(c!==void 0){if(typeof c=="string"){const f=gn(c);c=a[r]=f}l.remove(...c)}if(s===null||o&&s==="ltr")e.removeAttribute("dir");else{if(u!==void 0){if(typeof u=="string"){const f=gn(u);u=a[s]=f}u!==void 0&&l.add(...u)}e.dir=s}Wt||(n.getWritable().__dir=s)}Tn=s,e.__lexicalDirTextContent=ae,e.__lexicalDir=s}var i}function Ol(n,e,t){const r=ae;var i;ae="",we=null,ve="",function(o,s,l){const a=G,c=o.__size,u=s.__size;if(G="",c===1&&u===1){const f=o.__first,d=s.__first;if(f===d)Bt(f,l);else{const g=Lr(f),_=En(d,null,null);try{l.replaceChild(_,g)}catch(m){if(typeof m=="object"&&m!=null){const x=`${m.toString()} Parent: ${l.tagName}, new child: {tag: ${_.tagName} key: ${d}}, old child: {tag: ${g.tagName}, key: ${f}}.`;throw new Error(x)}throw m}kn(f,null)}const h=ye.get(d);O(h)&&(we===null&&(we=h.getFormat()),ve===""&&(ve=h.getStyle()))}else{const f=Nn(o,Ze),d=Nn(s,ye);if(c===0)u!==0&&Dr(d,s,0,u-1,l,null);else if(u===0){if(c!==0){const h=l.__lexicalLineBreak==null;Or(f,0,c-1,h?null:l),h&&(l.textContent="")}}else(function(h,g,_,m,x,y){const v=m-1,T=x-1;let S,b,N=(j=y,j.firstChild),w=0,E=0;for(var j;w<=v&&E<=T;){const H=g[w],W=_[E];if(H===W)N=Rr(Bt(W,y)),w++,E++;else{S===void 0&&(S=new Set(g)),b===void 0&&(b=new Set(_));const ce=b.has(H),Re=S.has(W);if(ce)if(Re){const $e=vn(le,W);$e===N?N=Rr(Bt(W,y)):(N!=null?y.insertBefore($e,N):y.appendChild($e),Bt(W,y)),w++,E++}else En(W,y,N),E++;else N=Rr(Lr(H)),kn(H,y),w++}const q=ye.get(W);q!==null&&O(q)&&(we===null&&(we=q.getFormat()),ve===""&&(ve=q.getStyle()))}const z=w>v,ee=E>T;if(z&&!ee){const H=_[T+1];Dr(_,h,E,T,y,H===void 0?null:le.getElementByKey(H))}else ee&&!z&&Or(g,w,v,y)})(s,f,d,c,u,l)}yn(s)&&(G+=Ne),l.__lexicalTextContent=G,G=a+G}(n,e,t),co(e,t),Gr(i=e)&&we!=null&&we!==i.__textFormat&&!Wt&&(i.setTextFormat(we),i.setTextStyle(ve)),function(o){Gr(o)&&ve!==""&&ve!==o.__textStyle&&!Wt&&o.setTextStyle(ve)}(e),ae=r}function Nn(n,e){const t=[];let r=n.__first;for(;r!==null;){const i=e.get(r);i===void 0&&A(101),t.push(r),r=i.__next}return t}function Bt(n,e){const t=Ze.get(n);let r=ye.get(n);t!==void 0&&r!==void 0||A(61);const i=io||Pr.has(n)||Nr.has(n),o=vn(le,n);if(t===r&&!i){if(C(t)){const s=o.__lexicalTextContent;s!==void 0&&(G+=s,Ae+=s);const l=o.__lexicalDirTextContent;l!==void 0&&(ae+=l)}else{const s=t.getTextContent();O(t)&&!t.isDirectionless()&&(ae+=s),Ae+=s,G+=s}return o}if(t!==r&&i&&vr(jt,Mt,wn,r,"updated"),r.updateDOM(t,o,Be)){const s=En(n,null,null);return e===null&&A(62),e.replaceChild(s,o),kn(n,null),s}if(C(t)&&C(r)){const s=r.__indent;s!==t.__indent&&oo(o,s);const l=r.__format;l!==t.__format&&so(o,l),i&&(Ol(t,r,o),oe(r)||r.isInline()||ao(t,r,o)),yn(r)&&(G+=Ne,Ae+=Ne)}else{const s=r.getTextContent();if(U(r)){const l=r.decorate(le,Be);l!==null&&uo(n,l)}else O(r)&&!r.isDirectionless()&&(ae+=s);G+=s,Ae+=s}if(!Wt&&oe(r)&&r.__cachedText!==Ae){const s=r.getWritable();s.__cachedText=Ae,r=s}return o}function uo(n,e){let t=le._pendingDecorators;const r=le._decorators;if(t===null){if(r[n]===e)return;t=Vi(le)}t[n]=e}function Rr(n){let e=n.nextSibling;return e!==null&&e===le._blockCursorElement&&(e=e.nextSibling),e}function Dl(n,e,t,r,i,o){G="",Ae="",ae="",io=r===lt,Tn=null,le=t,Be=t._config,Mt=t._nodes,wn=le._listeners.mutation,Nr=i,Pr=o,Ze=n._nodeMap,ye=e._nodeMap,Wt=e._readOnly,Ar=new Map(t._keyToDOMMap);const s=new Map;return jt=s,Bt("root",null),le=void 0,Mt=void 0,Nr=void 0,Pr=void 0,Ze=void 0,ye=void 0,Be=void 0,Ar=void 0,jt=void 0,s}function Lr(n){const e=Ar.get(n);return e===void 0&&A(75,n),e}const Oe=Object.freeze({}),Ir=30,Fr=[["keydown",function(n,e){if(zt=n.timeStamp,fo=n.key,e.isComposing())return;const{key:t,shiftKey:r,ctrlKey:i,metaKey:o,altKey:s}=n;R(e,zs,n)||t!=null&&(function(l,a,c,u){return Zi(l)&&!a&&!u&&!c}(t,i,s,o)?R(e,mi,n):function(l,a,c,u,f){return Zi(l)&&!u&&!c&&(a||f)}(t,i,r,s,o)?R(e,Ks,n):function(l,a,c,u){return Yi(l)&&!a&&!u&&!c}(t,i,s,o)?R(e,yi,n):function(l,a,c,u,f){return Yi(l)&&!u&&!c&&(a||f)}(t,i,r,s,o)?R(e,Vs,n):function(l,a,c){return function(u){return u==="ArrowUp"}(l)&&!a&&!c}(t,i,o)?R(e,vi,n):function(l,a,c){return function(u){return u==="ArrowDown"}(l)&&!a&&!c}(t,i,o)?R(e,xi,n):function(l,a){return Xi(l)&&a}(t,r)?(Kt=!0,R(e,ln,n)):function(l){return l===" "}(t)?R(e,Us,n):function(l,a){return me&&a&&l.toLowerCase()==="o"}(t,i)?(n.preventDefault(),Kt=!0,R(e,ot,!0)):function(l,a){return Xi(l)&&!a}(t,r)?(Kt=!1,R(e,ln,n)):function(l,a,c,u){return me?!a&&!c&&(Rt(l)||l.toLowerCase()==="h"&&u):!(u||a||c)&&Rt(l)}(t,s,o,i)?Rt(t)?R(e,Ci,n):(n.preventDefault(),R(e,qe,!0)):function(l){return l==="Escape"}(t)?R(e,bi,n):function(l,a,c,u,f){return me?!(c||u||f)&&(Lt(l)||l.toLowerCase()==="d"&&a):!(a||u||f)&&Lt(l)}(t,i,r,s,o)?Lt(t)?R(e,Si,n):(n.preventDefault(),R(e,qe,!1)):function(l,a,c){return Rt(l)&&(me?a:c)}(t,s,i)?(n.preventDefault(),R(e,Tt,!0)):function(l,a,c){return Lt(l)&&(me?a:c)}(t,s,i)?(n.preventDefault(),R(e,Tt,!1)):function(l,a){return me&&a&&Rt(l)}(t,o)?(n.preventDefault(),R(e,kt,!0)):function(l,a){return me&&a&&Lt(l)}(t,o)?(n.preventDefault(),R(e,kt,!1)):function(l,a,c,u){return l.toLowerCase()==="b"&&!a&&Dt(c,u)}(t,s,o,i)?(n.preventDefault(),R(e,ge,"bold")):function(l,a,c,u){return l.toLowerCase()==="u"&&!a&&Dt(c,u)}(t,s,o,i)?(n.preventDefault(),R(e,ge,"underline")):function(l,a,c,u){return l.toLowerCase()==="i"&&!a&&Dt(c,u)}(t,s,o,i)?(n.preventDefault(),R(e,ge,"italic")):function(l,a,c,u){return l==="Tab"&&!a&&!c&&!u}(t,s,i,o)?R(e,$s,n):function(l,a,c,u){return l.toLowerCase()==="z"&&!a&&Dt(c,u)}(t,r,o,i)?(n.preventDefault(),R(e,on,void 0)):function(l,a,c,u){return me?l.toLowerCase()==="z"&&c&&a:l.toLowerCase()==="y"&&u||l.toLowerCase()==="z"&&u&&a}(t,r,o,i)?(n.preventDefault(),R(e,sn,void 0)):xe(e._editorState._selection)?function(l,a,c,u){return!a&&l.toLowerCase()==="c"&&(me?c:u)}(t,r,o,i)?(n.preventDefault(),R(e,an,n)):function(l,a,c,u){return!a&&l.toLowerCase()==="x"&&(me?c:u)}(t,r,o,i)?(n.preventDefault(),R(e,Gn,n)):Gi(t,o,i)&&(n.preventDefault(),R(e,er,n)):!Me&&Gi(t,o,i)&&(n.preventDefault(),R(e,er,n)),function(l,a,c,u){return l||a||c||u}(i,r,s,o)&&R(e,Gs,n))}],["pointerdown",function(n,e){const t=n.target,r=n.pointerType;t instanceof Node&&r!=="touch"&&he(e,()=>{U(Ye(t))||(jr=!0)})}],["compositionstart",function(n,e){he(e,()=>{const t=L();if(P(t)&&!e.isComposing()){const r=t.anchor,i=t.anchor.getNode();re(r.key),(n.timeStamp<zt+Ir||r.type==="element"||!t.isCollapsed()||i.getFormat()!==t.format||O(i)&&i.getStyle()!==t.style)&&R(e,st,ll)}})}],["compositionend",function(n,e){Me?Vt=!0:he(e,()=>{Wr(e,n.data)})}],["input",function(n,e){n.stopPropagation(),he(e,()=>{const t=L(),r=n.data,i=yo(n);if(r!=null&&P(t)&&po(t,i,r,n.timeStamp,!1)){Vt&&(Wr(e,r),Vt=!1);const o=t.anchor.getNode(),s=Se(e._window);if(s===null)return;const l=t.isBackward(),a=l?t.anchor.offset:t.focus.offset,c=l?t.focus.offset:t.anchor.offset;cn&&!t.isCollapsed()&&O(o)&&s.anchorNode!==null&&o.getTextContent().slice(0,a)+r+o.getTextContent().slice(a+c)===Qi(s.anchorNode)||R(e,st,r);const u=r.length;Me&&u>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=u),tr||un||nr||!e.isComposing()||(zt=0,re(null))}else mr(!1,e,r!==null?r:void 0),Vt&&(Wr(e,r||void 0),Vt=!1);fe(),Li(Q())}),ft=null}],["click",function(n,e){he(e,()=>{const t=L(),r=Se(e._window),i=Ht();if(r){if(P(t)){const o=t.anchor,s=o.getNode();o.type==="element"&&o.offset===0&&t.isCollapsed()&&!oe(s)&&Z().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&i!==null&&t.is(i)?(r.removeAllRanges(),t.dirty=!0):n.detail===3&&!t.isCollapsed()&&s!==t.focus.getNode()&&(C(s)?s.select(0):s.getParentOrThrow().select(0))}else if(n.pointerType==="touch"){const o=r.anchorNode;if(o!==null){const s=o.nodeType;(s===At||s===je)&&be(qr(i,r,e,n))}}}R(e,_i,n)})}],["cut",Oe],["copy",Oe],["dragstart",Oe],["dragover",Oe],["dragend",Oe],["paste",Oe],["focus",Oe],["blur",Oe],["drop",Oe]];cn&&Fr.push(["beforeinput",(n,e)=>function(t,r){const i=t.inputType,o=yo(t);i==="deleteCompositionText"||Me&&to(r)||i!=="insertCompositionText"&&he(r,()=>{const s=L();if(i==="deleteContentBackward"){if(s===null){const h=Ht();if(!P(h))return;be(h.clone())}if(P(s)){const h=s.anchor.key===s.focus.key;if(l=t.timeStamp,fo==="MediaLast"&&l<zt+Ir&&r.isComposing()&&h){if(re(null),zt=0,setTimeout(()=>{he(r,()=>{re(null)})},Ir),P(s)){const g=s.anchor.getNode();g.markDirty(),s.format=g.getFormat(),O(g)||A(142),s.style=g.getStyle()}}else{re(null),t.preventDefault();const g=s.anchor.getNode().getTextContent(),_=s.anchor.offset===0&&s.focus.offset===g.length;nl&&h&&!_||R(r,qe,!0)}return}}var l;if(!P(s))return;const a=t.data;ft!==null&&mr(!1,r,ft),s.dirty&&ft===null||!s.isCollapsed()||oe(s.anchor.getNode())||o===null||s.applyDOMRange(o),ft=null;const c=s.anchor,u=s.focus,f=c.getNode(),d=u.getNode();if(i!=="insertText"&&i!=="insertTranspose")switch(t.preventDefault(),i){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":R(r,st,t);break;case"insertFromComposition":re(null),R(r,st,t);break;case"insertLineBreak":re(null),R(r,ot,!1);break;case"insertParagraph":re(null),Kt&&!un?(Kt=!1,R(r,ot,!1)):R(r,rn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":R(r,Zn,t);break;case"deleteByComposition":(function(h,g){return h!==g||C(h)||C(g)||!h.isToken()||!g.isToken()})(f,d)&&R(r,Xn,t);break;case"deleteByDrag":case"deleteByCut":R(r,Xn,t);break;case"deleteContent":R(r,qe,!1);break;case"deleteWordBackward":R(r,Tt,!0);break;case"deleteWordForward":R(r,Tt,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":R(r,kt,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":R(r,kt,!1);break;case"formatStrikeThrough":R(r,ge,"strikethrough");break;case"formatBold":R(r,ge,"bold");break;case"formatItalic":R(r,ge,"italic");break;case"formatUnderline":R(r,ge,"underline");break;case"historyUndo":R(r,on,void 0);break;case"historyRedo":R(r,sn,void 0)}else{if(a===`
|
|
32
|
-
`)t.preventDefault(),
|
|
33
|
-
`){const r=L();if(
|
|
34
|
-
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const r=t.parentElement;if(r!==null&&
|
|
31
|
+
`,pl=je?" ":mn,Ao="֑-߿יִ-﷽ﹰ-ﻼ",jo="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",_l=new RegExp("^[^"+jo+"]*["+Ao+"]"),ml=new RegExp("^[^"+Ao+"]*["+jo+"]"),Oe={bold:1,code:16,highlight:cr,italic:2,strikethrough:pn,subscript:32,superscript:64,underline:_n},yl={directionless:1,unmergeable:2},Bo={center:dr,end:pr,justify:hr,left:ur,right:fr,start:gr},vl={[dr]:"center",[pr]:"end",[hr]:"justify",[ur]:"left",[fr]:"right",[gr]:"start"},xl={normal:0,segmented:2,token:1},bl={[dl]:"normal",[hl]:"segmented",[fl]:"token"};function Cl(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var D=Cl(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 yn(...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 wl=100;let _r=!1,mr=0;function Sl(n){mr=n.timeStamp}function yr(n,e,t){return e.__lexicalLineBreak===n||n[`__lexicalKey_${t._key}`]!==void 0}function El(n,e,t){const r=we(t._window);let o=null,i=null;r!==null&&r.anchorNode===n&&(o=r.anchorOffset,i=r.focusOffset);const s=n.nodeValue;s!==null&&Sr(e,s,o,i,!1)}function Tl(n,e,t){if(O(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return e.nodeType===Be&&t.isAttached()}function Wo(n,e,t){_r=!0;const r=performance.now()-mr>wl;try{he(n,()=>{const o=L()||function(d){return d.getEditorState().read(()=>{const f=L();return f!==null?f.clone():null})}(n),i=new Map,s=n.getRootElement(),l=n._editorState,a=n._blockCursorElement;let c=!1,u="";for(let d=0;d<e.length;d++){const f=e[d],g=f.type,_=f.target;let m=Xe(_,l);if(!(m===null&&_!==s||U(m))){if(g==="characterData")r&&R(m)&&Tl(o,_,m)&&El(_,m,n);else if(g==="childList"){c=!0;const x=f.addedNodes;for(let S=0;S<x.length;S++){const w=x[S],C=Ho(w),N=w.parentNode;if(N!=null&&w!==a&&C===null&&(w.nodeName!=="BR"||!yr(w,N,n))){if(je){const T=w.innerText||w.nodeValue;T&&(u+=T)}N.removeChild(w)}}const v=f.removedNodes,y=v.length;if(y>0){let S=0;for(let w=0;w<y;w++){const C=v[w];(C.nodeName==="BR"&&yr(C,_,n)||a===C)&&(_.appendChild(C),S++)}y!==S&&(_===s&&(m=Qo(l)),i.set(_,m))}}}}if(i.size>0)for(const[d,f]of i)if(b(f)){const g=f.getChildrenKeys();let _=d.firstChild;for(let m=0;m<g.length;m++){const x=g[m],v=n.getElementByKey(x);v!==null&&(_==null?(d.appendChild(v),_=v):_!==v&&d.replaceChild(v,_),_=_.nextSibling)}}else R(f)&&f.markDirty();const h=t.takeRecords();if(h.length>0){for(let d=0;d<h.length;d++){const f=h[d],g=f.addedNodes,_=f.target;for(let m=0;m<g.length;m++){const x=g[m],v=x.parentNode;v==null||x.nodeName!=="BR"||yr(x,_,n)||v.removeChild(x)}}t.takeRecords()}o!==null&&(c&&(o.dirty=!0,Ce(o)),je&&ai(n)&&o.insertRawText(u))})}finally{_r=!1}}function zo(n){const e=n._observer;e!==null&&Wo(n,e.takeRecords(),e)}function $o(n){(function(e){mr===0&&En(e).addEventListener("textInput",Sl,!0)})(n),n._observer=new MutationObserver((e,t)=>{Wo(n,e,t)})}function Ko(n,e){const t=n.__mode,r=n.__format,o=n.__style,i=e.__mode,s=e.__format,l=e.__style;return!(t!==null&&t!==i||r!==null&&r!==s||o!==null&&o!==l)}function Uo(n,e){const t=n.mergeWithSibling(e),r=H()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function Vo(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&R(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(Ko(e,r)){r=Uo(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&R(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(Ko(r,t)){r=Uo(r,t);break}break}t.remove()}}else r.remove()}function Jo(n){return Yo(n.anchor),Yo(n.focus),n}function Yo(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),R(r)){n.set(r.__key,o?r.getTextContentSize():0,"text");break}if(!b(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element")}}let kl=1;const Nl=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function vr(n){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return U(Xe(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&vn(e)==null)}function Ft(n,e,t){const r=n.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(t)&&e!==null&&!vr(e)&&qo(e)===n}catch{return!1}}function xr(n){return n instanceof Kn}function qo(n){let e=n;for(;e!=null;){const t=vn(e);if(xr(t))return t;e=Sn(e)}return null}function vn(n){return n?n.__lexicalEditor:null}function ct(n){return n.isToken()||n.isSegmented()}function Pl(n){return n.nodeType===Be}function xn(n){let e=n;for(;e!=null;){if(Pl(e))return e;e=e.firstChild}return null}function br(n,e,t){const r=Oe[e];if(t!==null&&(n&r)==(t&r))return n;let o=n^r;return e==="subscript"?o&=~Oe.superscript:e==="superscript"&&(o&=~Oe.subscript),o}function Ol(n,e){if(e!=null)return void(n.__key=e);fe(),Ji();const t=H(),r=Ie(),o=""+kl++;r._nodeMap.set(o,n),b(n)?t._dirtyElements.set(o,!0):t._dirtyLeaves.add(o),t._cloneNotNeeded.add(o),t._dirtyType=Lo,n.__key=o}function Ge(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),o=n.getPreviousSibling(),i=n.getNextSibling();if(o===null)if(i!==null){const s=i.getWritable();r.__first=i.__key,s.__prev=null}else r.__first=null;else{const s=o.getWritable();if(i!==null){const l=i.getWritable();l.__prev=s.__key,s.__next=l.__key}else s.__next=null;t.__prev=null}if(i===null)if(o!==null){const s=o.getWritable();r.__last=o.__key,s.__next=null}else r.__last=null;else{const s=i.getWritable();if(o!==null){const l=o.getWritable();l.__next=s.__key,s.__prev=l.__key}else s.__prev=null;t.__next=null}r.__size--,t.__parent=null}}function bn(n){Ji();const e=n.getLatest(),t=e.__parent,r=Ie(),o=H(),i=r._nodeMap,s=o._dirtyElements;t!==null&&function(a,c,u){let h=a;for(;h!==null;){if(u.has(h))return;const d=c.get(h);if(d===void 0)break;u.set(h,!1),h=d.__parent}}(t,i,s);const l=e.__key;o._dirtyType=Lo,b(n)?s.set(l,!0):o._dirtyLeaves.add(l)}function re(n){fe();const e=H(),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 We(){return Xt()?null:H()._compositionKey}function se(n,e){const t=(e||Ie())._nodeMap.get(n);return t===void 0?null:t}function Ho(n,e){const t=n[`__lexicalKey_${H()._key}`];return t!==void 0?se(t,e):null}function Xe(n,e){let t=n;for(;t!=null;){const r=Ho(t,e);if(r!==null)return r;t=Sn(t)}return null}function Go(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function Xo(n){return n.read(()=>G().getTextContent())}function G(){return Qo(Ie())}function Qo(n){return n._nodeMap.get("root")}function Ce(n){fe();const e=Ie();n!==null&&(n.dirty=!0,n.setCachedNodes(null)),e._selection=n}function ut(n){const e=H(),t=function(r,o){let i=r;for(;i!=null;){const s=i[`__lexicalKey_${o._key}`];if(s!==void 0)return s;i=Sn(i)}return null}(n,e);return t===null?n===e.getRootElement()?se("root"):null:se(t)}function Zo(n,e){return e?n.getTextContentSize():0}function ei(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function Cr(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function ti(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function ni(n){return n.nodeType===Be?n.nodeValue:null}function wr(n,e,t){const r=we(e._window);if(r===null)return;const o=r.anchorNode;let{anchorOffset:i,focusOffset:s}=r;if(o!==null){let l=ni(o);const a=Xe(o);if(l!==null&&R(a)){if(l===mn&&t){const c=t.length;l=t,i=c,s=c}l!==null&&Sr(a,l,i,s,n)}}}function Sr(n,e,t,r,o){let i=n;if(i.isAttached()&&(o||!i.isDirty())){const s=i.isComposing();let l=e;(s||o)&&e[e.length-1]===mn&&(l=e.slice(0,-1));const a=i.getTextContent();if(o||l!==a){if(l===""){if(re(null),lr||gn||ar)i.remove();else{const _=H();setTimeout(()=>{_.update(()=>{i.isAttached()&&i.remove()})},20)}return}const c=i.getParent(),u=Gt(),h=i.getTextContentSize(),d=We(),f=i.getKey();if(i.isToken()||d!==null&&f===d&&!s||O(u)&&(c!==null&&!c.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===n.__key&&u.anchor.offset===0&&!i.canInsertTextBefore()&&!s||u.focus.key===n.__key&&u.focus.offset===h&&!i.canInsertTextAfter()&&!s))return void i.markDirty();const g=L();if(!O(g)||t===null||r===null)return void i.setTextContent(l);if(g.setTextNodeRange(i,t,i,r),i.isSegmented()){const _=oe(i.getTextContent());i.replace(_),i=_}i.setTextContent(l)}}}function Dl(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(i){const s=i.getPreviousSibling();return(R(s)||b(s)&&s.isInline())&&!s.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||o)}function ri(n){return n==="ArrowLeft"}function oi(n){return n==="ArrowRight"}function Mt(n,e){return me?n:e}function ii(n){return n==="Enter"}function Lt(n){return n==="Backspace"}function At(n){return n==="Delete"}function si(n,e,t){return n.toLowerCase()==="a"&&Mt(e,t)}function Rl(){const n=G();Ce(Jo(n.select(0,n.getChildrenSize())))}function jt(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 i=yn(o);return t[e]=i,i}return o}function Er(n,e,t,r,o){if(t.size===0)return;const i=r.__type,s=r.__key,l=e.get(i);l===void 0&&D(33,i);const a=l.klass;let c=n.get(a);c===void 0&&(c=new Map,n.set(a,c));const u=c.get(s),h=u==="destroyed"&&o==="created";(u===void 0||h)&&c.set(s,h?"updated":o)}function li(n,e,t){const r=n.getParent();let o=t,i=n;return r!==null&&(e&&t===0?(o=i.getIndexWithinParent(),i=r):e||t!==i.getChildrenSize()||(o=i.getIndexWithinParent()+1,i=r)),i.getChildAtIndex(e?o-1:o)}function Bt(n,e){const t=n.offset;if(n.type==="element")return li(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?li(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):o}}return null}function ai(n){const e=En(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function M(n,e,t){return Xi(n,e,t)}function Cn(n){return!ie(n)&&!n.isLastChild()&&!n.isInline()}function wn(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&D(75,e),t}function Sn(n){const e=n.assignedSlot||n.parentElement;return e!==null&&e.nodeType===11?e.host:e}function Tr(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function En(n){const e=n._window;return e===null&&D(78),e}function Il(n){let e=n.getParentOrThrow();for(;e!==null;){if(dt(e))return e;e=e.getParentOrThrow()}return e}function dt(n){return ie(n)||b(n)&&n.isShadowRoot()}function Tn(n){const e=H(),t=n.constructor.getType(),r=e._nodes.get(t);r===void 0&&D(97);const o=r.replace;if(o!==null){const i=o(n);return i instanceof n.constructor||D(98),i}return n}function kr(n,e){!ie(n.getParent())||b(e)||U(e)||D(99)}function Nr(n){return(U(n)||b(n)&&!n.canBeEmpty())&&!n.isInline()}function Pr(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function Fl(n,e,t){let r=n._blockCursorElement;if(O(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const o=t.anchor,i=o.getNode(),s=o.offset;let l=!1,a=null;if(s===i.getChildrenSize())Nr(i.getChildAtIndex(s-1))&&(l=!0);else{const c=i.getChildAtIndex(s);if(Nr(c)){const u=c.getPreviousSibling();(u===null||Nr(u))&&(l=!0,a=n.getElementByKey(c.__key))}}if(l){const c=n.getElementByKey(i.__key);return r===null&&(n._blockCursorElement=r=function(u){const h=u.theme,d=document.createElement("div");d.contentEditable="false",d.setAttribute("data-lexical-cursor","true");let f=h.blockCursor;if(f!==void 0){if(typeof f=="string"){const g=yn(f);f=h.blockCursor=g}f!==void 0&&d.classList.add(...f)}return d}(n._config)),e.style.caretColor="transparent",void(a===null?c.appendChild(r):c.insertBefore(r,a))}}r!==null&&Pr(r,n,e)}function we(n){return _e?(n||window).getSelection():null}function Or(n){return n.nodeType===1}function Dr(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 kn(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 ft(n){if(ie(n)||U(n)&&!n.isInline())return!0;if(!b(n)||dt(n))return!1;const e=n.getFirstChild(),t=e===null||pt(e)||R(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function Rr(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function Ml(){return H()}const ci=new WeakMap,Ll=new Map;function Al(n){if(!n._readOnly&&n.isEmpty())return Ll;n._readOnly||D(192);let e=ci.get(n);if(!e){e=new Map,ci.set(n,e);for(const[t,r]of n._nodeMap){const o=r.__type;let i=e.get(o);i||(i=new Map,e.set(o,i)),i.set(t,r)}}return e}function Ir(n){const e=n.constructor.clone(n);return e.afterCloneFrom(n),e}function ui(n,e,t,r,o,i){let s=n.getFirstChild();for(;s!==null;){const l=s.__key;s.__parent===e&&(b(s)&&ui(s,l,t,r,o,i),t.has(l)||i.delete(l),o.push(l)),s=s.getNextSibling()}}let ze,le,Wt,Nn,Fr,Mr,Qe,ye,Lr,zt,Z="",ae="",Se=null,ve="",De="",di=!1,$t=!1,Pn=null;function On(n,e){const t=Qe.get(n);if(e!==null){const r=Wr(n);r.parentNode===e&&e.removeChild(r)}if(ye.has(n)||le._keyToDOMMap.delete(n),b(t)){const r=Rn(t,Qe);Ar(r,0,r.length-1,null)}t!==void 0&&Er(zt,Wt,Nn,t,"destroyed")}function Ar(n,e,t,r){let o=e;for(;o<=t;++o){const i=n[o];i!==void 0&&On(i,r)}}function Ze(n,e){n.setProperty("text-align",e)}const jl="40px";function fi(n,e){const t=ze.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")||jl;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${r})`)}function hi(n,e){const t=n.style;e===0?Ze(t,""):e===ur?Ze(t,"left"):e===dr?Ze(t,"center"):e===fr?Ze(t,"right"):e===hr?Ze(t,"justify"):e===gr?Ze(t,"start"):e===pr&&Ze(t,"end")}function Dn(n,e,t){const r=ye.get(n);r===void 0&&D(60);const o=r.createDOM(ze,le);if(function(i,s,l){const a=l._keyToDOMMap;s["__lexicalKey_"+l._key]=i,a.set(i,s)}(n,o,le),R(r)?o.setAttribute("data-lexical-text","true"):U(r)&&o.setAttribute("data-lexical-decorator","true"),b(r)){const i=r.__indent,s=r.__size;if(i!==0&&fi(o,i),s!==0){const a=s-1;(function(c,u,h,d){const f=ae;ae="",jr(c,h,0,u,d,null),_i(h,d),ae=f})(Rn(r,ye),a,r,o)}const l=r.__format;l!==0&&hi(o,l),r.isInline()||pi(null,r,o),Cn(r)&&(Z+=Pe,De+=Pe)}else{const i=r.getTextContent();if(U(r)){const s=r.decorate(le,ze);s!==null&&mi(n,s),o.contentEditable="false"}else R(r)&&(r.isDirectionless()||(ae+=i));Z+=i,De+=i}if(e!==null)if(t!=null)e.insertBefore(o,t);else{const i=e.__lexicalLineBreak;i!=null?e.insertBefore(o,i):e.appendChild(o)}return Er(zt,Wt,Nn,r,"created"),o}function jr(n,e,t,r,o,i){const s=Z;Z="";let l=t;for(;l<=r;++l){Dn(n[l],o,i);const a=ye.get(n[l]);a!==null&&R(a)&&(Se===null&&(Se=a.getFormat()),ve===""&&(ve=a.getStyle()))}Cn(e)&&(Z+=Pe),o.__lexicalTextContent=Z,Z=s+Z}function gi(n,e){const t=e.get(n);return pt(t)||U(t)&&t.isInline()}function pi(n,e,t){const r=n!==null&&(n.__size===0||gi(n.__last,Qe)),o=e.__size===0||gi(e.__last,ye);if(r){if(!o){const i=t.__lexicalLineBreak;if(i!=null)try{t.removeChild(i)}catch(s){if(typeof s=="object"&&s!=null){const l=`${s.toString()} Parent: ${t.tagName}, child: ${i.tagName}.`;throw new Error(l)}throw s}t.__lexicalLineBreak=null}}else if(o){const i=document.createElement("br");t.__lexicalLineBreak=i,t.appendChild(i)}}function _i(n,e){const t=e.__lexicalDirTextContent,r=e.__lexicalDir;if(t!==ae||r!==Pn){const i=ae==="",s=i?Pn:(o=ae,_l.test(o)?"rtl":ml.test(o)?"ltr":null);if(s!==r){const l=e.classList,a=ze.theme;let c=r!==null?a[r]:void 0,u=s!==null?a[s]:void 0;if(c!==void 0){if(typeof c=="string"){const h=yn(c);c=a[r]=h}l.remove(...c)}if(s===null||i&&s==="ltr")e.removeAttribute("dir");else{if(u!==void 0){if(typeof u=="string"){const h=yn(u);u=a[s]=h}u!==void 0&&l.add(...u)}e.dir=s}$t||(n.getWritable().__dir=s)}Pn=s,e.__lexicalDirTextContent=ae,e.__lexicalDir=s}var o}function Bl(n,e,t){const r=ae;var o;ae="",Se=null,ve="",function(i,s,l){const a=Z,c=i.__size,u=s.__size;if(Z="",c===1&&u===1){const h=i.__first,d=s.__first;if(h===d)Kt(h,l);else{const g=Wr(h),_=Dn(d,null,null);try{l.replaceChild(_,g)}catch(m){if(typeof m=="object"&&m!=null){const x=`${m.toString()} Parent: ${l.tagName}, new child: {tag: ${_.tagName} key: ${d}}, old child: {tag: ${g.tagName}, key: ${h}}.`;throw new Error(x)}throw m}On(h,null)}const f=ye.get(d);R(f)&&(Se===null&&(Se=f.getFormat()),ve===""&&(ve=f.getStyle()))}else{const h=Rn(i,Qe),d=Rn(s,ye);if(c===0)u!==0&&jr(d,s,0,u-1,l,null);else if(u===0){if(c!==0){const f=l.__lexicalLineBreak==null;Ar(h,0,c-1,f?null:l),f&&(l.textContent="")}}else(function(f,g,_,m,x,v){const y=m-1,S=x-1;let w,C,N=(j=v,j.firstChild),T=0,P=0;for(var j;T<=y&&P<=S;){const q=g[T],B=_[P];if(q===B)N=Br(Kt(B,v)),T++,P++;else{w===void 0&&(w=new Set(g)),C===void 0&&(C=new Set(_));const ce=C.has(q),Fe=w.has(B);if(ce)if(Fe){const Je=wn(le,B);Je===N?N=Br(Kt(B,v)):(N!=null?v.insertBefore(Je,N):v.appendChild(Je),Kt(B,v)),T++,P++}else Dn(B,v,N),P++;else N=Br(Wr(q)),On(q,v),T++}const Y=ye.get(B);Y!==null&&R(Y)&&(Se===null&&(Se=Y.getFormat()),ve===""&&(ve=Y.getStyle()))}const z=T>y,ee=P>S;if(z&&!ee){const q=_[S+1];jr(_,f,P,S,v,q===void 0?null:le.getElementByKey(q))}else ee&&!z&&Ar(g,T,y,v)})(s,h,d,c,u,l)}Cn(s)&&(Z+=Pe),l.__lexicalTextContent=Z,Z=a+Z}(n,e,t),_i(e,t),io(o=e)&&Se!=null&&Se!==o.__textFormat&&!$t&&(o.setTextFormat(Se),o.setTextStyle(ve)),function(i){io(i)&&ve!==""&&ve!==i.__textStyle&&!$t&&i.setTextStyle(ve)}(e),ae=r}function Rn(n,e){const t=[];let r=n.__first;for(;r!==null;){const o=e.get(r);o===void 0&&D(101),t.push(r),r=o.__next}return t}function Kt(n,e){const t=Qe.get(n);let r=ye.get(n);t!==void 0&&r!==void 0||D(61);const o=di||Mr.has(n)||Fr.has(n),i=wn(le,n);if(t===r&&!o){if(b(t)){const s=i.__lexicalTextContent;s!==void 0&&(Z+=s,De+=s);const l=i.__lexicalDirTextContent;l!==void 0&&(ae+=l)}else{const s=t.getTextContent();R(t)&&!t.isDirectionless()&&(ae+=s),De+=s,Z+=s}return i}if(t!==r&&o&&Er(zt,Wt,Nn,r,"updated"),r.updateDOM(t,i,ze)){const s=Dn(n,null,null);return e===null&&D(62),e.replaceChild(s,i),On(n,null),s}if(b(t)&&b(r)){const s=r.__indent;s!==t.__indent&&fi(i,s);const l=r.__format;l!==t.__format&&hi(i,l),o&&(Bl(t,r,i),ie(r)||r.isInline()||pi(t,r,i)),Cn(r)&&(Z+=Pe,De+=Pe)}else{const s=r.getTextContent();if(U(r)){const l=r.decorate(le,ze);l!==null&&mi(n,l)}else R(r)&&!r.isDirectionless()&&(ae+=s);Z+=s,De+=s}if(!$t&&ie(r)&&r.__cachedText!==De){const s=r.getWritable();s.__cachedText=De,r=s}return i}function mi(n,e){let t=le._pendingDecorators;const r=le._decorators;if(t===null){if(r[n]===e)return;t=Go(le)}t[n]=e}function Br(n){let e=n.nextSibling;return e!==null&&e===le._blockCursorElement&&(e=e.nextSibling),e}function Wl(n,e,t,r,o,i){Z="",De="",ae="",di=r===at,Pn=null,le=t,ze=t._config,Wt=t._nodes,Nn=le._listeners.mutation,Fr=o,Mr=i,Qe=n._nodeMap,ye=e._nodeMap,$t=e._readOnly,Lr=new Map(t._keyToDOMMap);const s=new Map;return zt=s,Kt("root",null),le=void 0,Wt=void 0,Fr=void 0,Mr=void 0,Qe=void 0,ye=void 0,ze=void 0,Lr=void 0,zt=void 0,s}function Wr(n){const e=Lr.get(n);return e===void 0&&D(75,n),e}const Re=Object.freeze({}),zr=30,$r=[["keydown",function(n,e){if(Ut=n.timeStamp,yi=n.key,e.isComposing())return;const{key:t,shiftKey:r,ctrlKey:o,metaKey:i,altKey:s}=n;M(e,Hs,n)||t!=null&&(function(l,a,c,u){return oi(l)&&!a&&!u&&!c}(t,o,s,i)?M(e,So,n):function(l,a,c,u,h){return oi(l)&&!u&&!c&&(a||h)}(t,o,r,s,i)?M(e,Gs,n):function(l,a,c,u){return ri(l)&&!a&&!u&&!c}(t,o,s,i)?M(e,Eo,n):function(l,a,c,u,h){return ri(l)&&!u&&!c&&(a||h)}(t,o,r,s,i)?M(e,Xs,n):function(l,a,c){return function(u){return u==="ArrowUp"}(l)&&!a&&!c}(t,o,i)?M(e,To,n):function(l,a,c){return function(u){return u==="ArrowDown"}(l)&&!a&&!c}(t,o,i)?M(e,ko,n):function(l,a){return ii(l)&&a}(t,r)?(Vt=!0,M(e,dn,n)):function(l){return l===" "}(t)?M(e,Qs,n):function(l,a){return me&&a&&l.toLowerCase()==="o"}(t,o)?(n.preventDefault(),Vt=!0,M(e,st,!0)):function(l,a){return ii(l)&&!a}(t,r)?(Vt=!1,M(e,dn,n)):function(l,a,c,u){return me?!a&&!c&&(Lt(l)||l.toLowerCase()==="h"&&u):!(u||a||c)&&Lt(l)}(t,s,i,o)?Lt(t)?M(e,No,n):(n.preventDefault(),M(e,qe,!0)):function(l){return l==="Escape"}(t)?M(e,Po,n):function(l,a,c,u,h){return me?!(c||u||h)&&(At(l)||l.toLowerCase()==="d"&&a):!(a||u||h)&&At(l)}(t,o,r,s,i)?At(t)?M(e,Oo,n):(n.preventDefault(),M(e,qe,!1)):function(l,a,c){return Lt(l)&&(me?a:c)}(t,s,o)?(n.preventDefault(),M(e,Nt,!0)):function(l,a,c){return At(l)&&(me?a:c)}(t,s,o)?(n.preventDefault(),M(e,Nt,!1)):function(l,a){return me&&a&&Lt(l)}(t,i)?(n.preventDefault(),M(e,Pt,!0)):function(l,a){return me&&a&&At(l)}(t,i)?(n.preventDefault(),M(e,Pt,!1)):function(l,a,c,u){return l.toLowerCase()==="b"&&!a&&Mt(c,u)}(t,s,i,o)?(n.preventDefault(),M(e,ge,"bold")):function(l,a,c,u){return l.toLowerCase()==="u"&&!a&&Mt(c,u)}(t,s,i,o)?(n.preventDefault(),M(e,ge,"underline")):function(l,a,c,u){return l.toLowerCase()==="i"&&!a&&Mt(c,u)}(t,s,i,o)?(n.preventDefault(),M(e,ge,"italic")):function(l,a,c,u){return l==="Tab"&&!a&&!c&&!u}(t,s,o,i)?M(e,Zs,n):function(l,a,c,u){return l.toLowerCase()==="z"&&!a&&Mt(c,u)}(t,r,i,o)?(n.preventDefault(),M(e,cn,void 0)):function(l,a,c,u){return me?l.toLowerCase()==="z"&&c&&a:l.toLowerCase()==="y"&&u||l.toLowerCase()==="z"&&u&&a}(t,r,i,o)?(n.preventDefault(),M(e,un,void 0)):xe(e._editorState._selection)?function(l,a,c,u){return!a&&l.toLowerCase()==="c"&&(me?c:u)}(t,r,i,o)?(n.preventDefault(),M(e,fn,n)):function(l,a,c,u){return!a&&l.toLowerCase()==="x"&&(me?c:u)}(t,r,i,o)?(n.preventDefault(),M(e,ir,n)):si(t,i,o)&&(n.preventDefault(),M(e,sr,n)):!je&&si(t,i,o)&&(n.preventDefault(),M(e,sr,n)),function(l,a,c,u){return l||a||c||u}(o,r,s,i)&&M(e,ll,n))}],["pointerdown",function(n,e){const t=n.target,r=n.pointerType;t instanceof Node&&r!=="touch"&&he(e,()=>{U(Xe(t))||(Ur=!0)})}],["compositionstart",function(n,e){he(e,()=>{const t=L();if(O(t)&&!e.isComposing()){const r=t.anchor,o=t.anchor.getNode();re(r.key),(n.timeStamp<Ut+zr||r.type==="element"||!t.isCollapsed()||o.getFormat()!==t.format||R(o)&&o.getStyle()!==t.style)&&M(e,lt,pl)}})}],["compositionend",function(n,e){je?Jt=!0:he(e,()=>{Vr(e,n.data)})}],["input",function(n,e){n.stopPropagation(),he(e,()=>{const t=L(),r=n.data,o=Si(n);if(r!=null&&O(t)&&bi(t,o,r,n.timeStamp,!1)){Jt&&(Vr(e,r),Jt=!1);const i=t.anchor.getNode(),s=we(e._window);if(s===null)return;const l=t.isBackward(),a=l?t.anchor.offset:t.focus.offset,c=l?t.focus.offset:t.anchor.offset;hn&&!t.isCollapsed()&&R(i)&&s.anchorNode!==null&&i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+c)===ni(s.anchorNode)||M(e,lt,r);const u=r.length;je&&u>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=u),lr||gn||ar||!e.isComposing()||(Ut=0,re(null))}else wr(!1,e,r!==null?r:void 0),Jt&&(Vr(e,r||void 0),Jt=!1);fe(),zo(H())}),ht=null}],["click",function(n,e){he(e,()=>{const t=L(),r=we(e._window),o=Gt();if(r){if(O(t)){const i=t.anchor,s=i.getNode();i.type==="element"&&i.offset===0&&t.isCollapsed()&&!ie(s)&&G().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&o!==null&&t.is(o)?(r.removeAllRanges(),t.dirty=!0):n.detail===3&&!t.isCollapsed()&&s!==t.focus.getNode()&&(b(s)?s.select(0):s.getParentOrThrow().select(0))}else if(n.pointerType==="touch"){const i=r.anchorNode;if(i!==null){const s=i.nodeType;(s===It||s===Be)&&Ce(Zr(o,r,e,n))}}}M(e,wo,n)})}],["cut",Re],["copy",Re],["dragstart",Re],["dragover",Re],["dragend",Re],["paste",Re],["focus",Re],["blur",Re],["drop",Re]];hn&&$r.push(["beforeinput",(n,e)=>function(t,r){const o=t.inputType,i=Si(t);o==="deleteCompositionText"||je&&ai(r)||o!=="insertCompositionText"&&he(r,()=>{const s=L();if(o==="deleteContentBackward"){if(s===null){const f=Gt();if(!O(f))return;Ce(f.clone())}if(O(s)){const f=s.anchor.key===s.focus.key;if(l=t.timeStamp,yi==="MediaLast"&&l<Ut+zr&&r.isComposing()&&f){if(re(null),Ut=0,setTimeout(()=>{he(r,()=>{re(null)})},zr),O(s)){const g=s.anchor.getNode();g.markDirty(),s.format=g.getFormat(),R(g)||D(142),s.style=g.getStyle()}}else{re(null),t.preventDefault();const g=s.anchor.getNode().getTextContent(),_=s.anchor.offset===0&&s.focus.offset===g.length;ul&&f&&!_||M(r,qe,!0)}return}}var l;if(!O(s))return;const a=t.data;ht!==null&&wr(!1,r,ht),s.dirty&&ht===null||!s.isCollapsed()||ie(s.anchor.getNode())||i===null||s.applyDOMRange(i),ht=null;const c=s.anchor,u=s.focus,h=c.getNode(),d=u.getNode();if(o!=="insertText"&&o!=="insertTranspose")switch(t.preventDefault(),o){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":M(r,lt,t);break;case"insertFromComposition":re(null),M(r,lt,t);break;case"insertLineBreak":re(null),M(r,st,!1);break;case"insertParagraph":re(null),Vt&&!gn?(Vt=!1,M(r,st,!1)):M(r,an,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":M(r,rr,t);break;case"deleteByComposition":(function(f,g){return f!==g||b(f)||b(g)||!f.isToken()||!g.isToken()})(h,d)&&M(r,or,t);break;case"deleteByDrag":case"deleteByCut":M(r,or,t);break;case"deleteContent":M(r,qe,!1);break;case"deleteWordBackward":M(r,Nt,!0);break;case"deleteWordForward":M(r,Nt,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":M(r,Pt,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":M(r,Pt,!1);break;case"formatStrikeThrough":M(r,ge,"strikethrough");break;case"formatBold":M(r,ge,"bold");break;case"formatItalic":M(r,ge,"italic");break;case"formatUnderline":M(r,ge,"underline");break;case"historyUndo":M(r,cn,void 0);break;case"historyRedo":M(r,un,void 0)}else{if(a===`
|
|
32
|
+
`)t.preventDefault(),M(r,st,!1);else if(a===Pe)t.preventDefault(),M(r,an,void 0);else if(a==null&&t.dataTransfer){const f=t.dataTransfer.getData("text/plain");t.preventDefault(),s.insertRawText(f)}else a!=null&&bi(s,i,a,t.timeStamp,!0)?(t.preventDefault(),M(r,lt,a)):ht=a;vi=t.timeStamp}})}(n,e)]);let Ut=0,yi=null,vi=0,ht=null;const In=new WeakMap;let Kr=!1,Ur=!1,Vt=!1,Jt=!1,xi=[0,"",0,"root",0];function bi(n,e,t,r,o){const i=n.anchor,s=n.focus,l=i.getNode(),a=H(),c=we(a._window),u=c!==null?c.anchorNode:null,h=i.key,d=a.getElementByKey(h),f=t.length;return h!==s.key||!R(l)||(!o&&(!hn||vi<r+50)||l.isDirty()&&f<2||ei(t))&&i.offset!==s.offset&&!l.isComposing()||ct(l)||l.isDirty()&&f>1||(o||!hn)&&d!==null&&!l.isComposing()&&u!==xn(d)||c!==null&&e!==null&&(!e.collapsed||e.startContainer!==c.anchorNode||e.startOffset!==c.anchorOffset)||l.getFormat()!==n.format||l.getStyle()!==n.style||Dl(n,l)}function Ci(n,e){return n!==null&&n.nodeValue!==null&&n.nodeType===Be&&e!==0&&e!==n.nodeValue.length}function wi(n,e,t){const{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=n;Kr&&(Kr=!1,Ci(r,o)&&Ci(i,s))||he(e,()=>{if(!t)return void Ce(null);if(!Ft(e,r,i))return;const l=L();if(O(l)){const a=l.anchor,c=a.getNode();if(l.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(l.dirty=!0);const u=En(e).event,h=u?u.timeStamp:performance.now(),[d,f,g,_,m]=xi,x=G(),v=e.isComposing()===!1&&x.getTextContent()==="";if(h<m+200&&a.offset===g&&a.key===_)l.format=d,l.style=f;else if(a.type==="text")R(c)||D(141),l.format=c.getFormat(),l.style=c.getStyle();else if(a.type==="element"&&!v){const y=a.getNode();l.style="",y instanceof mt&&y.getChildrenSize()===0?(l.format=y.getTextFormat(),l.style=y.getTextStyle()):l.format=0}}else{const u=a.key,h=l.focus.key,d=l.getNodes(),f=d.length,g=l.isBackward(),_=g?s:o,m=g?o:s,x=g?h:u,v=g?u:h;let y=gl,S=!1;for(let w=0;w<f;w++){const C=d[w],N=C.getTextContentSize();if(R(C)&&N!==0&&!(w===0&&C.__key===x&&_===N||w===f-1&&C.__key===v&&m===0)&&(S=!0,y&=C.getFormat(),y===0))break}l.format=S?y:0}}M(e,ln,void 0)})}function Si(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function Vr(n,e){const t=n._compositionKey;if(re(null),t!==null&&e!=null){if(e===""){const r=se(t),o=xn(n.getElementByKey(t));return void(o!==null&&o.nodeValue!==null&&R(r)&&Sr(r,o.nodeValue,null,null,!0))}if(e[e.length-1]===`
|
|
33
|
+
`){const r=L();if(O(r)){const o=r.focus;return r.anchor.set(o.key,o.offset,o.type),void M(n,dn,null)}}}wr(!0,n,e)}function Ei(n){let e=n.__lexicalEventHandles;return e===void 0&&(e=[],n.__lexicalEventHandles=e),e}const gt=new Map;function Ti(n){const e=n.target,t=we(e==null?null:e.nodeType===9?e.defaultView:e.ownerDocument.defaultView);if(t===null)return;const r=qo(t.anchorNode);if(r===null)return;Ur&&(Ur=!1,he(r,()=>{const c=Gt(),u=t.anchorNode;if(u===null)return;const h=u.nodeType;h!==It&&h!==Be||Ce(Zr(c,t,r,n))}));const o=Cr(r),i=o[o.length-1],s=i._key,l=gt.get(s),a=l||i;a!==r&&wi(t,a,!1),wi(t,r,!0),r!==i?gt.set(s,r):l&>.delete(s)}function ki(n){n._lexicalHandled=!0}function Ni(n){return n._lexicalHandled===!0}function zl(n){const e=n.ownerDocument,t=In.get(e);t===void 0&&D(162);const r=t-1;r>=0||D(164),In.set(e,r),r===0&&e.removeEventListener("selectionchange",Ti);const o=vn(n);xr(o)?(function(s){if(s._parentEditor!==null){const l=Cr(s),a=l[l.length-1]._key;gt.get(a)===s&>.delete(a)}else gt.delete(s._key)}(o),n.__lexicalEditor=null):o&&D(198);const i=Ei(n);for(let s=0;s<i.length;s++)i[s]();n.__lexicalEventHandles=[]}function Jr(n,e,t){fe();const r=n.__key,o=n.getParent();if(o===null)return;const i=function(l){const a=L();if(!O(a)||!b(l))return a;const{anchor:c,focus:u}=a,h=c.getNode(),d=u.getNode();return Tr(h,l)&&c.set(l.__key,0,"element"),Tr(d,l)&&u.set(l.__key,0,"element"),a}(n);let s=!1;if(O(i)&&e){const l=i.anchor,a=i.focus;l.key===r&&(Bn(l,n,o,n.getPreviousSibling(),n.getNextSibling()),s=!0),a.key===r&&(Bn(a,n,o,n.getPreviousSibling(),n.getNextSibling()),s=!0)}else xe(i)&&e&&n.isSelected()&&n.selectPrevious();if(O(i)&&e&&!s){const l=n.getIndexWithinParent();Ge(n),jn(i,o,l,-1)}else Ge(n);t||dt(o)||o.canBeEmpty()||!o.isEmpty()||Jr(o,e),e&&ie(o)&&o.isEmpty()&&o.selectEnd()}class Fn{static getType(){D(64,this.name)}static clone(e){D(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,Ol(this,e)}getType(){return this.__type}isInline(){D(137,this.constructor.name)}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||L();if(t==null)return!1;const r=t.getNodes().some(o=>o.__key===this.__key);if(R(this))return r;if(O(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const o=this.getParent();if(U(this)&&this.isInline()&&o){const i=t.isBackward()?t.focus:t.anchor,s=i.getNode();if(i.offset===s.getChildrenSize()&&s.is(o)&&s.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();return e===null&&D(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(dt(t))return b(e)||e===this&&U(e)||D(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&D(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:se(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:se(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();b(this)&&t.unshift(this),b(e)&&r.unshift(e);const o=t.length,i=r.length;if(o===0||i===0||t[o-1]!==r[i-1])return null;const s=new Set(r);for(let l=0;l<o;l++){const a=t[l];if(s.has(a))return a}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,i=this;for(;;){const s=i.getParentOrThrow();if(s===t){r=i.getIndexWithinParent();break}i=s}for(i=e;;){const s=i.getParentOrThrow();if(s===t){o=i.getIndexWithinParent();break}i=s}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 i=this;for(;i!==null;){const s=i.__key;if(o.has(s)||(o.add(s),r.push(i)),i===e)break;const l=b(i)?t?i.getFirstChild():i.getLastChild():null;if(l!==null){i=l;continue}const a=t?i.getNextSibling():i.getPreviousSibling();if(a!==null){i=a;continue}const c=i.getParentOrThrow();if(o.has(c.__key)||r.push(c),c===e)break;let u=null,h=c;do{if(h===null&&D(68),u=t?h.getNextSibling():h.getPreviousSibling(),h=h.getParent(),h===null)break;u!==null||o.has(h.__key)||r.push(h)}while(u===null);i=u}return t||r.reverse(),r}isDirty(){const e=H()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){const e=se(this.__key);return e===null&&D(113),e}getWritable(){fe();const e=Ie(),t=H(),r=e._nodeMap,o=this.__key,i=this.getLatest(),s=t._cloneNotNeeded,l=L();if(l!==null&&l.setCachedNodes(null),s.has(o))return bn(i),i;const a=Ir(i);return s.add(o),bn(a),r.set(o,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){D(70)}updateDOM(e,t,r){D(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){D(72)}static importJSON(e){D(18,this.name)}static transform(){return null}remove(e){Jr(this,!0,e)}replace(e,t){fe();let r=L();r!==null&&(r=r.clone()),kr(this,e);const o=this.getLatest(),i=this.__key,s=e.__key,l=e.getWritable(),a=this.getParentOrThrow().getWritable(),c=a.__size;Ge(l);const u=o.getPreviousSibling(),h=o.getNextSibling(),d=o.__prev,f=o.__next,g=o.__parent;if(Jr(o,!1,!0),u===null?a.__first=s:u.getWritable().__next=s,l.__prev=d,h===null?a.__last=s:h.getWritable().__prev=s,l.__next=f,l.__parent=g,a.__size=c,t&&(b(this)&&b(l)||D(139),this.getChildren().forEach(_=>{l.append(_)})),O(r)){Ce(r);const _=r.anchor,m=r.focus;_.key===i&&Fi(_,l),m.key===i&&Fi(m,l)}return We()===i&&re(s),l}insertAfter(e,t=!0){fe(),kr(this,e);const r=this.getWritable(),o=e.getWritable(),i=o.getParent(),s=L();let l=!1,a=!1;if(i!==null){const f=e.getIndexWithinParent();if(Ge(o),O(s)){const g=i.__key,_=s.anchor,m=s.focus;l=_.type==="element"&&_.key===g&&_.offset===f+1,a=m.type==="element"&&m.key===g&&m.offset===f+1}}const c=this.getNextSibling(),u=this.getParentOrThrow().getWritable(),h=o.__key,d=r.__next;if(c===null?u.__last=h:c.getWritable().__prev=h,u.__size++,r.__next=h,o.__next=d,o.__prev=r.__key,o.__parent=r.__parent,t&&O(s)){const f=this.getIndexWithinParent();jn(s,u,f+1);const g=u.__key;l&&s.anchor.set(g,f+2,"element"),a&&s.focus.set(g,f+2,"element")}return e}insertBefore(e,t=!0){fe(),kr(this,e);const r=this.getWritable(),o=e.getWritable(),i=o.__key;Ge(o);const s=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),a=r.__prev,c=this.getIndexWithinParent();s===null?l.__first=i:s.getWritable().__next=i,l.__size++,r.__prev=i,o.__prev=a,o.__next=r.__key,o.__parent=r.__parent;const u=L();return t&&O(u)&&jn(u,this.getParentOrThrow(),c),e}isParentRequired(){return!1}createParentElementNode(){return Te()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){fe();const r=this.getPreviousSibling(),o=this.getParentOrThrow();if(r===null)return o.select(0,0);if(b(r))return r.select();if(!R(r)){const i=r.getIndexWithinParent()+1;return o.select(i,i)}return r.select(e,t)}selectNext(e,t){fe();const r=this.getNextSibling(),o=this.getParentOrThrow();if(r===null)return o.select();if(b(r))return r.select(0,0);if(!R(r)){const i=r.getIndexWithinParent();return o.select(i,i)}return r.select(e,t)}markDirty(){this.getWritable()}}class Yt extends Fn{static getType(){return"linebreak"}static clone(e){return new Yt(e.__key)}constructor(e){super(e)}getTextContent(){return`
|
|
34
|
+
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:e=>function(t){const r=t.parentElement;if(r!==null&&kn(r)){const o=r.firstChild;if(o===t||o.nextSibling===t&&Mn(o)){const i=r.lastChild;if(i===t||i.previousSibling===t&&Mn(i))return!0}}return!1}(e)||function(t){const r=t.parentElement;if(r!==null&&kn(r)){const o=r.firstChild;if(o===t||o.nextSibling===t&&Mn(o))return!1;const i=r.lastChild;if(i===t||i.previousSibling===t&&Mn(i))return!0}return!1}(e)?null:{conversion:$l,priority:0}}}static importJSON(e){return et()}exportJSON(){return{type:"linebreak",version:1}}}function $l(n){return{node:et()}}function et(){return Tn(new Yt)}function pt(n){return n instanceof Yt}function Mn(n){return n.nodeType===Be&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}function Yr(n,e){return 16&e?"code":e&cr?"mark":32&e?"sub":64&e?"sup":null}function qr(n,e){return 1&e?"strong":2&e?"em":"span"}function Pi(n,e,t,r,o){const i=r.classList;let s=jt(o,"base");s!==void 0&&i.add(...s),s=jt(o,"underlineStrikethrough");let l=!1;const a=e&_n&&e&pn;s!==void 0&&(t&_n&&t&pn?(l=!0,a||i.add(...s)):a&&i.remove(...s));for(const c in Oe){const u=Oe[c];if(s=jt(o,c),s!==void 0)if(t&u){if(l&&(c==="underline"||c==="strikethrough")){e&u&&i.remove(...s);continue}e&u&&(!a||c!=="underline")&&c!=="strikethrough"||i.add(...s)}else e&u&&i.remove(...s)}}function Oi(n,e,t){const r=e.firstChild,o=t.isComposing(),i=n+(o?mn:"");if(r==null)e.textContent=i;else{const s=r.nodeValue;if(s!==i)if(o||je){const[l,a,c]=function(u,h){const d=u.length,f=h.length;let g=0,_=0;for(;g<d&&g<f&&u[g]===h[g];)g++;for(;_+g<d&&_+g<f&&u[d-_-1]===h[f-_-1];)_++;return[g,d-g-_,h.slice(g,f-_)]}(s,i);a!==0&&r.deleteData(l,a),r.insertData(l,c)}else r.nodeValue=i}}function Di(n,e,t,r,o,i){Oi(o,n,e);const s=i.theme.text;s!==void 0&&Pi(0,0,r,n,s)}function Ln(n,e){const t=document.createElement(e);return t.appendChild(n),t}class _t extends Fn{static getType(){return"text"}static clone(e){return new _t(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 bl[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===We()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=Oe[e];return!!(this.getFormat()&t)}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return br(this.getLatest().__format,e,t)}canHaveFormat(){return!0}createDOM(e,t){const r=this.__format,o=Yr(0,r),i=qr(0,r),s=o===null?i:o,l=document.createElement(s);let a=l;this.hasFormat("code")&&l.setAttribute("spellcheck","false"),o!==null&&(a=document.createElement(i),l.appendChild(a)),Di(a,this,0,r,this.__text,e);const c=this.__style;return c!==""&&(l.style.cssText=c),l}updateDOM(e,t,r){const o=this.__text,i=e.__format,s=this.__format,l=Yr(0,i),a=Yr(0,s),c=qr(0,i),u=qr(0,s);if((l===null?c:l)!==(a===null?u:a))return!0;if(l===a&&c!==u){const _=t.firstChild;_==null&&D(48);const m=document.createElement(u);return Di(m,this,0,s,o,r),t.replaceChild(m,_),!1}let h=t;a!==null&&l!==null&&(h=t.firstChild,h==null&&D(49)),Oi(o,h,this);const d=r.theme.text;d!==void 0&&i!==s&&Pi(0,i,s,h,d);const f=e.__style,g=this.__style;return f!==g&&(t.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:Jl,priority:0}),b:()=>({conversion:Ul,priority:0}),code:()=>({conversion:$e,priority:0}),em:()=>({conversion:$e,priority:0}),i:()=>({conversion:$e,priority:0}),s:()=>({conversion:$e,priority:0}),span:()=>({conversion:Kl,priority:0}),strong:()=>({conversion:$e,priority:0}),sub:()=>({conversion:$e,priority:0}),sup:()=>({conversion:$e,priority:0}),u:()=>({conversion:$e,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&&Or(t)||D(132),t.style.whiteSpace="pre-wrap",this.hasFormat("bold")&&(t=Ln(t,"b")),this.hasFormat("italic")&&(t=Ln(t,"i")),this.hasFormat("strikethrough")&&(t=Ln(t,"s")),this.hasFormat("underline")&&(t=Ln(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"?Oe[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?yl[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=br(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=xl[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){fe();let r=e,o=t;const i=L(),s=this.getTextContent(),l=this.__key;if(typeof s=="string"){const a=s.length;r===void 0&&(r=a),o===void 0&&(o=a)}else r=0,o=0;if(!O(i))return zi(l,r,l,o,"text","text");{const a=We();a!==i.anchor.key&&a!==i.focus.key||re(l),i.setTextNodeRange(this,r,this,o)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,r,o){const i=this.getWritable(),s=i.__text,l=r.length;let a=e;a<0&&(a=l+a,a<0&&(a=0));const c=L();if(o&&O(c)){const h=e+l;c.setTextNodeRange(i,h,i,h)}const u=s.slice(0,a)+r+s.slice(a+t);return i.__text=u,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){fe();const t=this.getLatest(),r=t.getTextContent(),o=t.__key,i=We(),s=new Set(e),l=[],a=r.length;let c="";for(let w=0;w<a;w++)c!==""&&s.has(w)&&(l.push(c),c=""),c+=r[w];c!==""&&l.push(c);const u=l.length;if(u===0)return[];if(l[0]===r)return[t];const h=l[0],d=t.getParent();let f;const g=t.getFormat(),_=t.getStyle(),m=t.__detail;let x=!1;t.isSegmented()?(f=oe(h),f.__format=g,f.__style=_,f.__detail=m,x=!0):(f=t.getWritable(),f.__text=h);const v=L(),y=[f];let S=h.length;for(let w=1;w<u;w++){const C=l[w],N=C.length,T=oe(C).getWritable();T.__format=g,T.__style=_,T.__detail=m;const P=T.__key,j=S+N;if(O(v)){const z=v.anchor,ee=v.focus;z.key===o&&z.type==="text"&&z.offset>S&&z.offset<=j&&(z.key=P,z.offset-=S,v.dirty=!0),ee.key===o&&ee.type==="text"&&ee.offset>S&&ee.offset<=j&&(ee.key=P,ee.offset-=S,v.dirty=!0)}i===o&&re(P),S=j,y.push(T)}if(d!==null){(function(N){const T=N.getPreviousSibling(),P=N.getNextSibling();T!==null&&bn(T),P!==null&&bn(P)})(this);const w=d.getWritable(),C=this.getIndexWithinParent();x?(w.splice(C,0,y),this.remove()):w.splice(C,1,y),O(v)&&jn(v,d,C,u-1)}return y}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||D(50);const r=this.__key,o=e.__key,i=this.__text,s=i.length;We()===o&&re(r);const l=L();if(O(l)){const h=l.anchor,d=l.focus;h!==null&&h.key===o&&(Ui(h,t,r,e,s),l.dirty=!0),d!==null&&d.key===o&&(Ui(d,t,r,e,s),l.dirty=!0)}const a=e.__text,c=t?a+i:i+a;this.setTextContent(c);const u=this.getWritable();return e.remove(),u}isTextEntity(){return!1}}function Kl(n){return{forChild:Hr(n.style),node:null}}function Ul(n){const e=n,t=e.style.fontWeight==="normal";return{forChild:Hr(e.style,t?void 0:"bold"),node:null}}const Ri=new WeakMap;function Vl(n){return n.nodeName==="PRE"||n.nodeType===It&&n.style!==void 0&&n.style.whiteSpace!==void 0&&n.style.whiteSpace.startsWith("pre")}function Jl(n){const e=n;n.parentElement===null&&D(129);let t=e.textContent||"";if(function(r){let o,i=r.parentNode;const s=[r];for(;i!==null&&(o=Ri.get(i))===void 0&&!Vl(i);)s.push(i),i=i.parentNode;const l=o===void 0?i:o;for(let a=0;a<s.length;a++)Ri.set(s[a],l);return l}(e)!==null){const r=t.split(/(\r?\n|\t)/),o=[],i=r.length;for(let s=0;s<i;s++){const l=r[s];l===`
|
|
35
35
|
`||l===`\r
|
|
36
|
-
`?
|
|
37
|
-
`),u=!d.isEmpty();else if(u=!1,
|
|
36
|
+
`?o.push(et()):l===" "?o.push(Ht()):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=Ii(r,!1))!==null;){const i=r.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(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=Ii(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 Ii(n,e){let t=n;for(;;){let r;for(;(r=e?t.nextSibling:t.previousSibling)===null;){const i=t.parentElement;if(i===null)return null;t=i}if(t=r,t.nodeType===It){const i=t.style.display;if(i===""&&!Dr(t)||i!==""&&!i.startsWith("inline"))return null}let o=t;for(;(o=e?t.firstChild:t.lastChild)!==null;)t=o;if(t.nodeType===Be)return t;if(t.nodeName==="BR")return null}}const Yl={code:"code",em:"italic",i:"italic",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function $e(n){const e=Yl[n.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Hr(n.style,e),node:null}}function oe(n=""){return Tn(new _t(n))}function R(n){return n instanceof _t}function Hr(n,e){const t=n.fontWeight,r=n.textDecoration.split(" "),o=t==="700"||t==="bold",i=r.includes("line-through"),s=n.fontStyle==="italic",l=r.includes("underline"),a=n.verticalAlign;return c=>(R(c)&&(o&&!c.hasFormat("bold")&&c.toggleFormat("bold"),i&&!c.hasFormat("strikethrough")&&c.toggleFormat("strikethrough"),s&&!c.hasFormat("italic")&&c.toggleFormat("italic"),l&&!c.hasFormat("underline")&&c.toggleFormat("underline"),a!=="sub"||c.hasFormat("subscript")||c.toggleFormat("subscript"),a!=="super"||c.hasFormat("superscript")||c.toggleFormat("superscript"),e&&!c.hasFormat(e)&&c.toggleFormat(e)),c)}class qt extends _t{static getType(){return"tab"}static clone(e){return new qt(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=Ht();return t.setFormat(e.format),t.setStyle(e.style),t}exportJSON(){return{...super.exportJSON(),type:"tab",version:1}}setTextContent(e){D(126)}setDetail(e){D(127)}setMode(e){D(128)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Ht(){return Tn(new qt)}function ql(n){return n instanceof qt}class Hl{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,i=e.offset;if(b(t)){const s=t.getDescendantByIndex(o);t=s??t}if(b(r)){const s=r.getDescendantByIndex(i);r=s??r}return t===r?o<i:t.isBefore(r)}getNode(){const e=se(this.key);return e===null&&D(20),e}set(e,t,r){const o=this._selection,i=this.key;this.key=e,this.offset=t,this.type=r,Xt()||(We()===i&&re(e),o!==null&&(o.setCachedNodes(null),o.dirty=!0))}}function Ee(n,e,t){return new Hl(n,e,t)}function Gr(n,e){let t=e.__key,r=n.offset,o="element";if(R(e)){o="text";const i=e.getTextContentSize();r>i&&(r=i)}else if(!b(e)){const i=e.getNextSibling();if(R(i))t=i.__key,r=0,o="text";else{const s=e.getParent();s&&(t=s.__key,r=e.getIndexWithinParent()+1)}}n.set(t,r,o)}function Fi(n,e){if(b(e)){const t=e.getLastDescendant();b(t)||R(t)?Gr(n,t):Gr(n,e)}else Gr(n,e)}function Ke(n,e,t,r){n.key=e,n.offset=t,n.type=r}class An{constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!xe(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 An(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 i;if(R(o))i=o.select();else{const s=o.getIndexWithinParent()+1;i=o.getParentOrThrow().select(s,s)}i.insertNodes(e);for(let s=0;s<r;s++)t[s].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,r=[];for(const o of t){const i=se(o);i!==null&&r.push(i)}return Xt()||(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 O(n){return n instanceof Ue}class Ue{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!!O(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),i=o?t:r,s=o?r:t;let l=i.getNode(),a=s.getNode();const c=i.offset,u=s.offset;if(b(l)){const d=l.getDescendantByIndex(c);l=d??l}if(b(a)){let d=a.getDescendantByIndex(u);d!==null&&d!==l&&a.getChildAtIndex(u)===d&&(d=d.getPreviousSibling()),a=d??a}let h;return h=l.is(a)?b(l)&&l.getChildrenSize()>0?[]:[l]:l.getNodesBetween(a),Xt()||(this._cachedNodes=h),h}setTextNodeRange(e,t,r,o){Ke(this.anchor,e.__key,t,"text"),Ke(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,i=this.focus,s=o.isBefore(i),[l,a]=Xr(this);let c="",u=!0;for(let h=0;h<e.length;h++){const d=e[h];if(b(d)&&!d.isInline())u||(c+=`
|
|
37
|
+
`),u=!d.isEmpty();else if(u=!1,R(d)){let f=d.getTextContent();d===t?d===r?o.type==="element"&&i.type==="element"&&i.offset!==o.offset||(f=l<a?f.slice(l,a):f.slice(a,l)):f=s?f.slice(l):f.slice(a):d===r&&(f=s?f.slice(0,a):f.slice(0,l)),c+=f}else!U(d)&&!pt(d)||d===r&&this.isCollapsed()||(c+=d.getTextContent())}return c}applyDOMRange(e){const t=H(),r=t.getEditorState()._selection,o=Wi(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,r);if(o===null)return;const[i,s]=o;Ke(this.anchor,i.key,i.offset,i.type),Ke(this.focus,s.key,s.offset,s.type),this._cachedNodes=null}clone(){const e=this.anchor,t=this.focus;return new Ue(Ee(e.key,e.offset,e.type),Ee(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=br(this.format,e,null),this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=Oe[e];return!!(this.format&t)}insertRawText(e){const t=e.split(/(\r?\n|\t)/),r=[],o=t.length;for(let i=0;i<o;i++){const s=t[i];s===`
|
|
38
38
|
`||s===`\r
|
|
39
|
-
`?r.push(Ge()):s===" "?r.push(qt()):r.push(ie(s))}this.insertNodes(r)}insertText(e){const t=this.anchor,r=this.focus,i=this.format,o=this.style;let s=t,l=r;!this.isCollapsed()&&r.isBefore(t)&&(s=r,l=t),s.type==="element"&&function(m,x,y,v){const T=m.getNode(),S=T.getChildAtIndex(m.offset),b=ie(),N=oe(T)?ke().append(b):b;b.setFormat(y),b.setStyle(v),S===null?T.append(N):S.insertBefore(N),m.is(x)&&x.set(b.__key,0,"text"),m.set(b.__key,0,"text")}(s,l,i,o);const a=s.offset;let c=l.offset;const u=this.getNodes(),f=u.length;let d=u[0];O(d)||A(26);const h=d.getTextContent().length,g=d.getParentOrThrow();let _=u[f-1];if(f===1&&l.type==="element"&&(c=h,l.set(s.key,c,"text")),this.isCollapsed()&&a===h&&(d.isSegmented()||d.isToken()||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&d.getNextSibling()===null)){let m=d.getNextSibling();if(O(m)&&m.canInsertTextBefore()&&!at(m)||(m=ie(),m.setFormat(i),m.setStyle(o),g.canInsertTextAfter()?d.insertAfter(m):g.insertAfter(m)),m.select(0,0),d=m,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&a===0&&(d.isSegmented()||d.isToken()||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&d.getPreviousSibling()===null)){let m=d.getPreviousSibling();if(O(m)&&!at(m)||(m=ie(),m.setFormat(i),g.canInsertTextBefore()?d.insertBefore(m):g.insertBefore(m)),m.select(),d=m,e!=="")return void this.insertText(e)}else if(d.isSegmented()&&a!==h){const m=ie(d.getTextContent());m.setFormat(i),d.replace(m),d=m}else if(!this.isCollapsed()&&e!==""){const m=_.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||C(m)&&(!m.canInsertTextBefore()||!m.canInsertTextAfter()))return this.insertText(""),Ro(this.anchor,this.focus,null),void this.insertText(e)}if(f===1){if(d.isToken()){const v=ie(e);return v.select(),void d.replace(v)}const m=d.getFormat(),x=d.getStyle();if(a!==c||m===i&&x===o){if(Bl(d)){const v=ie(e);return v.setFormat(i),v.setStyle(o),v.select(),void d.replace(v)}}else{if(d.getTextContent()!==""){const v=ie(e);if(v.setFormat(i),v.setStyle(o),v.select(),a===0)d.insertBefore(v,!1);else{const[T]=d.splitText(a);T.insertAfter(v,!1)}return void(v.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}d.setFormat(i),d.setStyle(o)}const y=c-a;d=d.spliceText(a,y,e,!0),d.getTextContent()===""?d.remove():this.anchor.type==="text"&&(d.isComposing()?this.anchor.offset-=e.length:(this.format=m,this.style=x))}else{const m=new Set([...d.getParentKeys(),..._.getParentKeys()]),x=C(d)?d:d.getParentOrThrow();let y=C(_)?_:_.getParentOrThrow(),v=_;if(!x.is(y)&&y.isInline())do v=y,y=y.getParentOrThrow();while(y.isInline());if(l.type==="text"&&(c!==0||_.getTextContent()==="")||l.type==="element"&&_.getIndexWithinParent()<c)if(O(_)&&!_.isToken()&&c!==_.getTextContentSize()){if(_.isSegmented()){const w=ie(_.getTextContent());_.replace(w),_=w}oe(l.getNode())||l.type!=="text"||(_=_.spliceText(0,c,"")),m.add(_.__key)}else{const w=_.getParentOrThrow();w.canBeEmpty()||w.getChildrenSize()!==1?_.remove():w.remove()}else m.add(_.__key);const T=y.getChildren(),S=new Set(u),b=x.is(y),N=x.isInline()&&d.getNextSibling()===null?x:d;for(let w=T.length-1;w>=0;w--){const E=T[w];if(E.is(d)||C(E)&&E.isParentOf(d))break;E.isAttached()&&(!S.has(E)||E.is(v)?b||N.insertAfter(E,!1):E.remove())}if(!b){let w=y,E=null;for(;w!==null;){const j=w.getChildren(),z=j.length;(z===0||j[z-1].is(E))&&(m.delete(w.__key),E=w),w=w.getParent()}}if(d.isToken())if(a===h)d.select();else{const w=ie(e);w.select(),d.replace(w)}else d=d.spliceText(a,h-a,e,!0),d.getTextContent()===""?d.remove():d.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let w=1;w<f;w++){const E=u[w],j=E.__key;m.has(j)||E.remove()}}}removeText(){this.insertText("")}formatText(e){if(this.isCollapsed())return this.toggleFormat(e),void re(null);const t=this.getNodes(),r=[];for(const y of t)O(y)&&r.push(y);const i=r.length;if(i===0)return this.toggleFormat(e),void re(null);const o=this.anchor,s=this.focus,l=this.isBackward(),a=l?s:o,c=l?o:s;let u=0,f=r[0],d=a.type==="element"?0:a.offset;if(a.type==="text"&&d===f.getTextContentSize()&&(u=1,f=r[1],d=0),f==null)return;const h=f.getFormatFlags(e,null),g=i-1;let _=r[g];const m=c.type==="text"?c.offset:_.getTextContentSize();if(f.is(_)){if(d===m)return;if(at(f)||d===0&&m===f.getTextContentSize())f.setFormat(h);else{const y=f.splitText(d,m),v=d===0?y[0]:y[1];v.setFormat(h),a.type==="text"&&a.set(v.__key,0,"text"),c.type==="text"&&c.set(v.__key,m-d,"text")}return void(this.format=h)}d===0||at(f)||([,f]=f.splitText(d),d=0),f.setFormat(h);const x=_.getFormatFlags(e,h);m>0&&(m===_.getTextContentSize()||at(_)||([_]=_.splitText(m)),_.setFormat(x));for(let y=u+1;y<g;y++){const v=r[y],T=v.getFormatFlags(e,x);v.setFormat(T)}a.type==="text"&&a.set(f.__key,d,"text"),c.type==="text"&&c.set(_.__key,m,"text"),this.format=h|x}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const h=L();return P(h)||A(134),h.insertNodes(e)}const t=kr((this.isBackward()?this.focus:this.anchor).getNode(),dt),r=e[e.length-1];if("__language"in t&&C(t)){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const h=Hr(this);t.splice(h,0,e),r.selectEnd()}return}if(!e.some(h=>(C(h)||U(h))&&!h.isInline())){C(t)||A(135);const h=Hr(this);return t.splice(h,0,e),void r.selectEnd()}const i=function(h){const g=ke();let _=null;for(let m=0;m<h.length;m++){const x=h[m],y=$t(x);if(y||U(x)&&x.isInline()||C(x)&&x.isInline()||O(x)||x.isParentRequired()){if(_===null&&(_=x.createParentElementNode(),g.append(_),y))continue;_!==null&&_.append(x)}else g.append(x),_=null}return g}(e),o=i.getLastDescendant(),s=i.getChildren(),l=!C(t)||!t.isEmpty()?this.insertParagraph():null,a=s[s.length-1];let c=s[0];var u;C(u=c)&&dt(u)&&!u.isEmpty()&&C(t)&&(!t.isEmpty()||t.canMergeWhenEmpty())&&(C(t)||A(135),t.append(...c.getChildren()),c=s[1]),c&&function(h,g,_){const m=g.getParentOrThrow().getLastChild();let x=g;const y=[g];for(;x!==m;)x.getNextSibling()||A(140),x=x.getNextSibling(),y.push(x);let v=h;for(const T of y)v=v.insertAfter(T)}(t,c);const f=kr(o,dt);l&&C(f)&&(l.canMergeWhenEmpty()||dt(a))&&(f.append(...l.getChildren()),l.remove()),C(t)&&t.isEmpty()&&t.remove(),o.selectEnd();const d=C(t)?t.getLastChild():null;$t(d)&&f!==t&&d.remove()}insertParagraph(){if(this.anchor.key==="root"){const s=ke();return Z().splice(this.anchor.offset,0,[s]),s.select(),s}const e=Hr(this),t=kr(this.anchor.getNode(),dt);C(t)||A(136);const r=t.getChildAtIndex(e),i=r?[r,...r.getNextSiblings()]:[],o=t.insertNewAfter(this,!1);return o?(o.append(...i),o.selectStart(),o):null}insertLineBreak(e){const t=Ge();if(this.insertNodes([t]),e){const r=t.getParentOrThrow(),i=t.getIndexWithinParent();r.select(i,i)}}extract(){const e=this.getNodes(),t=e.length,r=t-1,i=this.anchor,o=this.focus;let s=e[0],l=e[r];const[a,c]=$r(this);if(t===0)return[];if(t===1){if(O(s)&&!this.isCollapsed()){const f=a>c?c:a,d=a>c?a:c,h=s.splitText(f,d),g=f===0?h[0]:h[1];return g!=null?[g]:[]}return[s]}const u=i.isBefore(o);if(O(s)){const f=u?a:c;f===s.getTextContentSize()?e.shift():f!==0&&([,s]=s.splitText(f),e[0]=s)}if(O(l)){const f=l.getTextContent().length,d=u?c:a;d===0?e.pop():d!==f&&([l]=l.splitText(d),e[r]=l)}return e}modify(e,t,r){const i=this.focus,o=this.anchor,s=e==="move",l=Ft(i,t);if(U(l)&&!l.isIsolated()){if(s&&l.isKeyboardSelectable()){const h=Fo();return h.add(l.__key),void be(h)}const d=t?l.getPreviousSibling():l.getNextSibling();if(O(d)){const h=d.__key,g=t?d.getTextContent().length:0;return i.set(h,g,"text"),void(s&&o.set(h,g,"text"))}{const h=l.getParentOrThrow();let g,_;return C(d)?(_=d.__key,g=t?d.getChildrenSize():0):(g=l.getIndexWithinParent(),_=h.__key,t||g++),i.set(_,g,"element"),void(s&&o.set(_,g,"element"))}}const a=Q(),c=Se(a._window);if(!c)return;const u=a._blockCursorElement,f=a._rootElement;if(f===null||u===null||!C(l)||l.isInline()||l.canBeEmpty()||Sr(u,a,f),function(d,h,g,_){d.modify(h,g,_)}(c,e,t?"backward":"forward",r),c.rangeCount>0){const d=c.getRangeAt(0),h=this.anchor.getNode(),g=oe(h)?h:Tl(h);if(this.applyDOMRange(d),this.dirty=!0,!s){const _=this.getNodes(),m=[];let x=!1;for(let y=0;y<_.length;y++){const v=_[y];xr(v,g)?m.push(v):x=!0}if(x&&m.length>0)if(t){const y=m[0];C(y)?y.selectStart():y.getParentOrThrow().selectStart()}else{const y=m[m.length-1];C(y)?y.selectEnd():y.getParentOrThrow().selectEnd()}c.anchorNode===d.startContainer&&c.anchorOffset===d.startOffset||function(y){const v=y.focus,T=y.anchor,S=T.key,b=T.offset,N=T.type;Ke(T,v.key,v.offset,v.type),Ke(v,S,b,N),y._cachedNodes=null}(this)}}}forwardDeletion(e,t,r){if(!r&&(e.type==="element"&&C(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const i=t.getParent(),o=t.getNextSibling()||(i===null?null:i.getNextSibling());if(C(o)&&o.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let i=r.getNode();if(this.forwardDeletion(r,i,e))return;const o=this.focus,s=Ft(o,e);if(U(s)&&!s.isIsolated()){if(s.isKeyboardSelectable()&&C(i)&&i.getChildrenSize()===0){i.remove();const l=Fo();l.add(s.__key),be(l)}else s.remove(),Q().dispatchCommand(nn,void 0);return}if(!e&&C(s)&&C(i)&&i.isEmpty())return i.remove(),void s.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=o.type==="text"?o.getNode():null;if(i=r.type==="text"?r.getNode():null,l!==null&&l.isSegmented()){const a=o.offset,c=l.getTextContentSize();if(l.is(i)||e&&a!==c||!e&&a!==0)return void Ao(l,e,a)}else if(i!==null&&i.isSegmented()){const a=r.offset,c=i.getTextContentSize();if(i.is(l)||e&&a!==0||!e&&a!==c)return void Ao(i,e,a)}(function(a,c){const u=a.anchor,f=a.focus,d=u.getNode(),h=f.getNode();if(d===h&&u.type==="text"&&f.type==="text"){const g=u.offset,_=f.offset,m=g<_,x=m?g:_,y=m?_:g,v=y-1;x!==v&&(qi(d.getTextContent().slice(x,y))||(c?f.offset=v:u.offset=v))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&oe(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 xe(n){return n instanceof Rn}function Po(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function $r(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]:[Po(t),Po(r)]}function Ao(n,e,t){const r=n,i=r.getTextContent().split(/(?=\s)/g),o=i.length;let s=0,l=0;for(let c=0;c<o;c++){const u=c===o-1;if(l=s,s+=i[c].length,e&&s===t||s>t||u){i.splice(c,1),u&&(l=void 0);break}}const a=i.join("").trim();a===""?r.remove():(r.setTextContent(a),r.select(l,l))}function Oo(n,e,t,r){let i,o=e;if(n.nodeType===At){let s=!1;const l=n.childNodes,a=l.length,c=r._blockCursorElement;o===a&&(s=!0,o=a-1);let u=l[o],f=!1;if(u===c)u=l[o+1],f=!0;else if(c!==null){const d=c.parentNode;n===d&&e>Array.prototype.indexOf.call(d.children,c)&&o--}if(i=ct(u),O(i))o=Ji(i,s);else{let d=ct(n);if(d===null)return null;if(C(d)){o=Math.min(d.getChildrenSize(),o);let h=d.getChildAtIndex(o);if(C(h)&&function(g,_,m){const x=g.getParent();return m===null||x===null||!x.canBeEmpty()||x!==m.getNode()}(h,0,t)){const g=s?h.getLastDescendant():h.getFirstDescendant();g===null?d=h:(h=g,d=C(h)?h:h.getParentOrThrow()),o=0}O(h)?(i=h,d=null,o=Ji(h,s)):h!==d&&s&&!f&&o++}else{const h=d.getIndexWithinParent();o=e===0&&U(d)&&ct(n)===d?h:h+1,d=d.getParentOrThrow()}if(C(d))return Te(d.__key,o,"element")}}else i=ct(n);return O(i)?Te(i.__key,o,"text"):null}function Do(n,e,t){const r=n.offset,i=n.getNode();if(r===0){const o=i.getPreviousSibling(),s=i.getParent();if(e){if((t||!e)&&o===null&&C(s)&&s.isInline()){const l=s.getPreviousSibling();O(l)&&(n.key=l.__key,n.offset=l.getTextContent().length)}}else C(o)&&!t&&o.isInline()?(n.key=o.__key,n.offset=o.getChildrenSize(),n.type="element"):O(o)&&(n.key=o.__key,n.offset=o.getTextContent().length)}else if(r===i.getTextContent().length){const o=i.getNextSibling(),s=i.getParent();if(e&&C(o)&&o.isInline())n.key=o.__key,n.offset=0,n.type="element";else if((t||e)&&o===null&&C(s)&&s.isInline()&&!s.canInsertTextAfter()){const l=s.getNextSibling();O(l)&&(n.key=l.__key,n.offset=0)}}}function Ro(n,e,t){if(n.type==="text"&&e.type==="text"){const r=n.isBefore(e),i=n.is(e);Do(n,r,i),Do(e,!r,i),i&&(e.key=n.key,e.offset=n.offset,e.type=n.type);const o=Q();if(o.isComposing()&&o._compositionKey!==n.key&&P(t)){const s=t.anchor,l=t.focus;Ke(n,s.key,s.offset,s.type),Ke(e,l.key,l.offset,l.type)}}}function Lo(n,e,t,r,i,o){if(n===null||t===null||!Ot(i,n,t))return null;const s=Oo(n,e,P(o)?o.anchor:null,i);if(s===null)return null;const l=Oo(t,r,P(o)?o.focus:null,i);if(l===null)return null;if(s.type==="element"&&l.type==="element"){const a=ct(n),c=ct(t);if(U(a)&&U(c))return null}return Ro(s,l,o),[s,l]}function Jr(n){return C(n)&&!n.isInline()}function Io(n,e,t,r,i,o){const s=De(),l=new Ve(Te(n,e,i),Te(t,r,o),0,"");return l.dirty=!0,s._selection=l,l}function Kl(){const n=Te("root",0,"element"),e=Te("root",0,"element");return new Ve(n,e,0,"")}function Fo(){return new Rn(new Set)}function qr(n,e,t,r){const i=t._window;if(i===null)return null;const o=r||i.event,s=o?o.type:void 0,l=s==="selectionchange",a=!ur&&(l||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&o&&o.detail===3||s==="drop"||s===void 0);let c,u,f,d;if(P(n)&&!a)return n.clone();if(e===null)return null;if(c=e.anchorNode,u=e.focusNode,f=e.anchorOffset,d=e.focusOffset,l&&P(n)&&!Ot(t,c,u))return n.clone();const h=Lo(c,f,u,d,t,n);if(h===null)return null;const[g,_]=h;return new Ve(g,_,P(n)?n.format:0,P(n)?n.style:"")}function L(){return De()._selection}function Ht(){return Q()._editorState._selection}function Ln(n,e,t,r=1){const i=n.anchor,o=n.focus,s=i.getNode(),l=o.getNode();if(!e.is(s)&&!e.is(l))return;const a=e.__key;if(n.isCollapsed()){const c=i.offset;if(t<=c&&r>0||t<c&&r<0){const u=Math.max(0,c+r);i.set(a,u,"element"),o.set(a,u,"element"),Mo(n)}}else{const c=n.isBackward(),u=c?o:i,f=u.getNode(),d=c?i:o,h=d.getNode();if(e.is(f)){const g=u.offset;(t<=g&&r>0||t<g&&r<0)&&u.set(a,Math.max(0,g+r),"element")}if(e.is(h)){const g=d.offset;(t<=g&&r>0||t<g&&r<0)&&d.set(a,Math.max(0,g+r),"element")}}Mo(n)}function Mo(n){const e=n.anchor,t=e.offset,r=n.focus,i=r.offset,o=e.getNode(),s=r.getNode();if(n.isCollapsed()){if(!C(o))return;const l=o.getChildrenSize(),a=t>=l,c=a?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(O(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text"),r.set(c.__key,u,"text")}}else{if(C(o)){const l=o.getChildrenSize(),a=t>=l,c=a?o.getChildAtIndex(l-1):o.getChildAtIndex(t);if(O(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text")}}if(C(s)){const l=s.getChildrenSize(),a=i>=l,c=a?s.getChildAtIndex(l-1):s.getChildAtIndex(i);if(O(c)){let u=0;a&&(u=c.getTextContentSize()),r.set(c.__key,u,"text")}}}}function In(n,e,t,r,i){let o=null,s=0,l=null;r!==null?(o=r.__key,O(r)?(s=r.getTextContentSize(),l="text"):C(r)&&(s=r.getChildrenSize(),l="element")):i!==null&&(o=i.__key,O(i)?l="text":C(i)&&(l="element")),o!==null&&l!==null?n.set(o,s,l):(s=e.getIndexWithinParent(),s===-1&&(s=t.getChildrenSize()),n.set(t.__key,s,"element"))}function jo(n,e,t,r,i){n.type==="text"?(n.key=t,e||(n.offset+=i)):n.offset>r.getIndexWithinParent()&&(n.offset-=1)}function Vl(n,e,t,r,i,o,s){const l=r.anchorNode,a=r.focusNode,c=r.anchorOffset,u=r.focusOffset,f=document.activeElement;if(i.has("collaboration")&&f!==o||f!==null&&hr(f))return;if(!P(e))return void(n!==null&&Ot(t,l,a)&&r.removeAllRanges());const d=e.anchor,h=e.focus,g=d.key,_=h.key,m=vn(t,g),x=vn(t,_),y=d.offset,v=h.offset,T=e.format,S=e.style,b=e.isCollapsed();let N=m,w=x,E=!1;if(d.type==="text"){N=_n(m);const q=d.getNode();E=q.getFormat()!==T||q.getStyle()!==S}else P(n)&&n.anchor.type==="text"&&(E=!0);var j,z,ee,H,W;if(h.type==="text"&&(w=_n(x)),N!==null&&w!==null&&(b&&(n===null||E||P(n)&&(n.format!==T||n.style!==S))&&(j=T,z=S,ee=y,H=g,W=performance.now(),go=[j,z,ee,H,W]),c!==y||u!==v||l!==N||a!==w||r.type==="Range"&&b||(f!==null&&o.contains(f)||o.focus({preventScroll:!0}),d.type==="element"))){try{r.setBaseAndExtent(N,y,w,v)}catch{}if(!i.has("skip-scroll-into-view")&&e.isCollapsed()&&o!==null&&o===document.activeElement){const q=e instanceof Ve&&e.anchor.type==="element"?N.childNodes[y]||null:r.rangeCount>0?r.getRangeAt(0):null;if(q!==null){let ce;if(q instanceof Text){const Re=document.createRange();Re.selectNode(q),ce=Re.getBoundingClientRect()}else ce=q.getBoundingClientRect();(function(Re,$e,Xt){const Gt=Xt.ownerDocument,en=Gt.defaultView;if(en===null)return;let{top:vt,bottom:xt}=$e,Ct=0,bt=0,pe=Xt;for(;pe!==null;){const nt=pe===Gt.body;if(nt)Ct=0,bt=Cn(Re).innerHeight;else{const Je=pe.getBoundingClientRect();Ct=Je.top,bt=Je.bottom}let Ee=0;if(vt<Ct?Ee=-(Ct-vt):xt>bt&&(Ee=xt-bt),Ee!==0)if(nt)en.scrollBy(0,Ee);else{const Je=pe.scrollTop;pe.scrollTop+=Ee;const rt=pe.scrollTop-Je;vt-=rt,xt-=rt}if(nt)break;pe=xn(pe)}})(t,ce,o)}}Mr=!0}}function Ul(n){let e=L()||Ht();e===null&&(e=Z().selectEnd()),e.insertNodes(n)}function Hr(n){let e=n;n.isCollapsed()||e.removeText();const t=L();P(t)&&(e=t),P(e)||A(161);const r=e.anchor;let i=r.getNode(),o=r.offset;for(;!dt(i);)[i,o]=$l(i,o);return o}function $l(n,e){const t=n.getParent();if(!t){const i=ke();return Z().append(i),i.select(),[Z(),0]}if(O(n)){const i=n.splitText(e);if(i.length===0)return[t,n.getIndexWithinParent()];const o=e===0?0:1;return[t,i[0].getIndexWithinParent()+o]}if(!C(n)||e===0)return[t,n.getIndexWithinParent()];const r=n.getChildAtIndex(e);if(r){const i=new Ve(Te(n.__key,e,"element"),Te(n.__key,e,"element"),0,""),o=n.insertNewAfter(i);o&&o.append(r,...r.getNextSiblings())}return[t,n.getIndexWithinParent()+1]}let te=null,ne=null,de=!1,Qr=!1,Fn=0;const Wo={characterData:!0,childList:!0,subtree:!0};function Qt(){return de||te!==null&&te._readOnly}function fe(){de&&A(13)}function Bo(){Fn>99&&A(14)}function De(){return te===null&&A(195,zo()),te}function Q(){return ne===null&&A(196,zo()),ne}function zo(){let n=0;const e=new Set,t=Wn.version;if(typeof window<"u")for(const i of document.querySelectorAll("[contenteditable]")){const o=pn(i);if(gr(o))n++;else if(o){let s=String(o.constructor.version||"<0.17.1");s===t&&(s+=" (separately built, likely a bundler configuration issue)"),e.add(s)}}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 Jl(){return ne}function Ko(n,e,t){const r=e.__type,i=function(l,a){const c=l._nodes.get(a);return c===void 0&&A(30,a),c}(n,r);let o=t.get(r);o===void 0&&(o=Array.from(i.transforms),t.set(r,o));const s=o.length;for(let l=0;l<s&&(o[l](e),e.isAttached());l++);}function Vo(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function ql(n){return Yr(n,Q()._nodes)}function Yr(n,e){const t=n.type,r=e.get(t);r===void 0&&A(17,t);const i=r.klass;n.type!==i.getType()&&A(18,i.name);const o=i.importJSON(n),s=n.children;if(C(o)&&Array.isArray(s))for(let l=0;l<s.length;l++){const a=Yr(s[l],e);o.append(a)}return o}function Uo(n,e,t){const r=te,i=de,o=ne;te=e,de=!0,ne=n;try{return t()}finally{te=r,de=i,ne=o}}function Ue(n,e){const t=n._pendingEditorState,r=n._rootElement,i=n._headless||r===null;if(t===null)return;const o=n._editorState,s=o._selection,l=t._selection,a=n._dirtyType!==He,c=te,u=de,f=ne,d=n._updating,h=n._observer;let g=null;if(n._pendingEditorState=null,n._editorState=t,!i&&a&&h!==null){ne=n,te=t,de=!1,n._updating=!0;try{const b=n._dirtyType,N=n._dirtyElements,w=n._dirtyLeaves;h.disconnect(),g=Dl(o,t,n,b,N,w)}catch(b){if(b instanceof Error&&n._onError(b),Qr)throw b;return Yo(n,null,r,t),Ii(n),n._dirtyType=lt,Qr=!0,Ue(n,o),void(Qr=!1)}finally{h.observe(r,Wo),n._updating=d,te=c,de=u,ne=f}}t._readOnly||(t._readOnly=!0);const _=n._dirtyLeaves,m=n._dirtyElements,x=n._normalizedNodes,y=n._updateTags,v=n._deferred;a&&(n._dirtyType=He,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements=new Map,n._normalizedNodes=new Set,n._updateTags=new Set),function(b,N){const w=b._decorators;let E=b._pendingDecorators||w;const j=N._nodeMap;let z;for(z in E)j.has(z)||(E===w&&(E=Vi(b)),delete E[z])}(n,t);const T=i?null:Se(n._window);if(n._editable&&T!==null&&(a||l===null||l.dirty)){ne=n,te=t;try{if(h!==null&&h.disconnect(),a||l===null||l.dirty){const b=n._blockCursorElement;b!==null&&Sr(b,n,r),Vl(s,l,n,T,y,r)}kl(n,r,l),h!==null&&h.observe(r,Wo)}finally{ne=f,te=c}}g!==null&&function(b,N,w,E,j){const z=Array.from(b._listeners.mutation),ee=z.length;for(let H=0;H<ee;H++){const[W,q]=z[H],ce=N.get(q);ce!==void 0&&W(ce,{dirtyLeaves:E,prevEditorState:j,updateTags:w})}}(n,g,y,_,o),P(l)||l===null||s!==null&&s.is(l)||n.dispatchCommand(nn,void 0);const S=n._pendingDecorators;S!==null&&(n._decorators=S,n._pendingDecorators=null,Yt("decorator",n,!0,S)),function(b,N,w){const E=Ui(N),j=Ui(w);E!==j&&Yt("textcontent",b,!0,j)}(n,e||o,t),Yt("update",n,!0,{dirtyElements:m,dirtyLeaves:_,editorState:t,normalizedNodes:x,prevEditorState:e||o,tags:y}),function(b,N){if(b._deferred=[],N.length!==0){const w=b._updating;b._updating=!0;try{for(let E=0;E<N.length;E++)N[E]()}finally{b._updating=w}}}(n,v),function(b){const N=b._updates;if(N.length!==0){const w=N.shift();if(w){const[E,j]=w;qo(b,E,j)}}}(n)}function Yt(n,e,t,...r){const i=e._updating;e._updating=t;try{const o=Array.from(e._listeners[n]);for(let s=0;s<o.length;s++)o[s].apply(null,r)}finally{e._updating=i}}function $o(n,e,t){if(n._updating===!1||ne!==n){let i=!1;return n.update(()=>{i=$o(n,e,t)}),i}const r=_r(n);for(let i=4;i>=0;i--)for(let o=0;o<r.length;o++){const s=r[o]._commands.get(e);if(s!==void 0){const l=s[i];if(l!==void 0){const a=Array.from(l),c=a.length;for(let u=0;u<c;u++)if(a[u](t,n)===!0)return!0}}}return!1}function Jo(n,e){const t=n._updates;let r=e||!1;for(;t.length!==0;){const i=t.shift();if(i){const[o,s]=i;let l,a;if(s!==void 0){if(l=s.onUpdate,a=s.tag,s.skipTransforms&&(r=!0),s.discrete){const c=n._pendingEditorState;c===null&&A(191),c._flushSync=!0}l&&n._deferred.push(l),a&&n._updateTags.add(a)}o()}}return r}function qo(n,e,t){const r=n._updateTags;let i,o,s=!1,l=!1;t!==void 0&&(i=t.onUpdate,o=t.tag,o!=null&&r.add(o),s=t.skipTransforms||!1,l=t.discrete||!1),i&&n._deferred.push(i);const a=n._editorState;let c=n._pendingEditorState,u=!1;(c===null||c._readOnly)&&(c=n._pendingEditorState=new jn(new Map((c||a)._nodeMap)),u=!0),c._flushSync=l;const f=te,d=de,h=ne,g=n._updating;te=c,de=!1,n._updating=!0,ne=n;try{u&&(n._headless?a._selection!==null&&(c._selection=a._selection.clone()):c._selection=function(y){const v=y.getEditorState()._selection,T=Se(y._window);return P(v)||v==null?qr(v,T,y,null):v.clone()}(n));const m=n._compositionKey;e(),s=Jo(n,s),function(y,v){const T=v.getEditorState()._selection,S=y._selection;if(P(S)){const b=S.anchor,N=S.focus;let w;if(b.type==="text"&&(w=b.getNode(),w.selectionTransform(T,S)),N.type==="text"){const E=N.getNode();w!==E&&E.selectionTransform(T,S)}}}(c,n),n._dirtyType!==He&&(s?function(y,v){const T=v._dirtyLeaves,S=y._nodeMap;for(const b of T){const N=S.get(b);O(N)&&N.isAttached()&&N.isSimpleText()&&!N.isUnmergeable()&&ji(N)}}(c,n):function(y,v){const T=v._dirtyLeaves,S=v._dirtyElements,b=y._nodeMap,N=We(),w=new Map;let E=T,j=E.size,z=S,ee=z.size;for(;j>0||ee>0;){if(j>0){v._dirtyLeaves=new Set;for(const H of E){const W=b.get(H);O(W)&&W.isAttached()&&W.isSimpleText()&&!W.isUnmergeable()&&ji(W),W!==void 0&&Vo(W,N)&&Ko(v,W,w),T.add(H)}if(E=v._dirtyLeaves,j=E.size,j>0){Fn++;continue}}v._dirtyLeaves=new Set,v._dirtyElements=new Map;for(const H of z){const W=H[0],q=H[1];if(W!=="root"&&!q)continue;const ce=b.get(W);ce!==void 0&&Vo(ce,N)&&Ko(v,ce,w),S.set(W,q)}E=v._dirtyLeaves,j=E.size,z=v._dirtyElements,ee=z.size,Fn++}v._dirtyLeaves=T,v._dirtyElements=S}(c,n),Jo(n),function(y,v,T,S){const b=y._nodeMap,N=v._nodeMap,w=[];for(const[E]of S){const j=N.get(E);j!==void 0&&(j.isAttached()||(C(j)&&ro(j,E,b,N,w,S),b.has(E)||S.delete(E),w.push(E)))}for(const E of w)N.delete(E);for(const E of T){const j=N.get(E);j===void 0||j.isAttached()||(b.has(E)||T.delete(E),N.delete(E))}}(a,c,n._dirtyLeaves,n._dirtyElements)),m!==n._compositionKey&&(c._flushSync=!0);const x=c._selection;if(P(x)){const y=c._nodeMap,v=x.anchor.key,T=x.focus.key;y.get(v)!==void 0&&y.get(T)!==void 0||A(19)}else xe(x)&&x._nodes.size===0&&(c._selection=null)}catch(m){return m instanceof Error&&n._onError(m),n._pendingEditorState=a,n._dirtyType=lt,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),void Ue(n)}finally{te=f,de=d,ne=h,n._updating=g,Fn=0}n._dirtyType!==He||function(m,x){const y=x.getEditorState()._selection,v=m._selection;if(v!==null){if(v.dirty||!v.is(y))return!0}else if(y!==null)return!0;return!1}(c,n)?c._flushSync?(c._flushSync=!1,Ue(n)):u&&xl(()=>{Ue(n)}):(c._flushSync=!1,u&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function he(n,e,t){n._updating?n._updates.push([e,t]):qo(n,e,t)}class Mn extends An{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 dl[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=Q()._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(O(t)&&e.push(t),C(t)){const r=t.getAllTextNodes();e.push(...r)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;C(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;C(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 o=t[r-1];return C(o)&&o.getLastDescendant()||o||null}const i=t[e];return C(i)&&i.getFirstDescendant()||i||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:se(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&A(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:se(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&A(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let r,i;if(e<t/2){for(r=this.getFirstChild(),i=0;r!==null&&i<=e;){if(i===e)return r;r=r.getNextSibling(),i++}return null}for(r=this.getLastChild(),i=t-1;r!==null&&i>=e;){if(i===e)return r;r=r.getPreviousSibling(),i--}return null}getTextContent(){let e="";const t=this.getChildren(),r=t.length;for(let i=0;i<r;i++){const o=t[i];e+=o.getTextContent(),C(o)&&i!==r-1&&!o.isInline()&&(e+=Ne)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),r=t.length;for(let i=0;i<r;i++){const o=t[i];e+=o.getTextContentSize(),C(o)&&i!==r-1&&!o.isInline()&&(e+=Ne.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=Di[e];return!!(this.getFormat()&t)}return!1}select(e,t){fe();const r=L();let i=e,o=t;const s=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const a=this.getFirstChild();if(O(a)||C(a))return a.select(0,0)}else if(!(e!==void 0&&e!==s||t!==void 0&&t!==s)){const a=this.getLastChild();if(O(a)||C(a))return a.select()}}i===void 0&&(i=s),o===void 0&&(o=s);const l=this.__key;return P(r)?(r.anchor.set(l,i,"element"),r.focus.set(l,o,"element"),r.dirty=!0,r):Io(l,i,l,o,"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!==""?Di[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,r){const i=r.length,o=this.getChildrenSize(),s=this.getWritable(),l=s.__key,a=[],c=[],u=this.getChildAtIndex(e+t);let f=null,d=o-t+i;if(e!==0)if(e===o)f=this.getLastChild();else{const g=this.getChildAtIndex(e);g!==null&&(f=g.getPreviousSibling())}if(t>0){let g=f===null?this.getFirstChild():f.getNextSibling();for(let _=0;_<t;_++){g===null&&A(100);const m=g.getNextSibling(),x=g.__key;Qe(g.getWritable()),c.push(x),g=m}}let h=f;for(let g=0;g<i;g++){const _=r[g];h!==null&&_.is(h)&&(f=h=h.getPreviousSibling());const m=_.getWritable();m.__parent===l&&d--,Qe(m);const x=_.__key;if(h===null)s.__first=x,m.__prev=null;else{const y=h.getWritable();y.__next=x,m.__prev=y.__key}_.__key===l&&A(76),m.__parent=l,a.push(x),h=_}if(e+t===o)h!==null&&(h.getWritable().__next=null,s.__last=h.__key);else if(u!==null){const g=u.getWritable();if(h!==null){const _=h.getWritable();g.__prev=h.__key,_.__next=u.__key}else g.__prev=null}if(s.__size=d,c.length){const g=L();if(P(g)){const _=new Set(c),m=new Set(a),{anchor:x,focus:y}=g;Ho(x,_,m)&&In(x,x.getNode(),this,f,u),Ho(y,_,m)&&In(y,y.getNode(),this,f,u),d!==0||this.canBeEmpty()||ut(this)||this.remove()}}return s}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 C(n){return n instanceof Mn}function Ho(n,e,t){let r=n.getNode();for(;r;){const i=r.__key;if(e.has(i)&&!t.has(i))return!0;r=r.getParent()}return!1}class Hl extends An{constructor(e){super(e)}decorate(e,t){A(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function U(n){return n instanceof Hl}class Zt extends Mn{static getType(){return"root"}static clone(){return new Zt}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){A(51)}getTextContent(){const e=this.__cachedText;return!Qt()&&Q()._dirtyType!==He||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];C(r)||U(r)||A(56)}return super.append(...e)}static importJSON(e){const t=Z();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 oe(n){return n instanceof Zt}function Zr(){return new jn(new Map([["root",new Zt]]))}function Qo(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType()&&A(130,t.name),C(n)){const r=e.children;Array.isArray(r)||A(59,t.name);const i=n.getChildren();for(let o=0;o<i.length;o++){const s=Qo(i[o]);r.push(s)}}return e}class jn{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 Uo(t&&t.editor||null,this,e)}clone(e){const t=new jn(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return Uo(null,this,()=>({root:Qo(Z())}))}}class Xr extends Mn{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class pt extends Mn{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=Pe[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 pt(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),r=It(e.theme,"paragraph");return r!==void 0&&t.classList.add(...r),t}updateDOM(e,t,r){return!1}static importDOM(){return{p:e=>({conversion:Ql,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&wr(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();t.style.textAlign=r;const i=this.getDirection();i&&(t.dir=i);const o=this.getIndent();o>0&&(t.style.textIndent=20*o+"px")}return{element:t}}static importJSON(e){const t=ke();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=ke();r.setTextFormat(e.format),r.setTextStyle(e.style);const i=this.getDirection();return r.setDirection(i),r.setFormat(this.getFormatType()),r.setStyle(this.getTextStyle()),this.insertAfter(r,t),r}collapseAtStart(){const e=this.getChildren();if(e.length===0||O(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 Ql(n){const e=ke();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 ke(){return bn(new pt)}function Gr(n){return n instanceof pt}const V=0,Yl=4;function Yo(n,e,t,r){const i=n._keyToDOMMap;i.clear(),n._editorState=Zr(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=He,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,n._updateTags=new Set,n._updates=[],n._blockCursorElement=null;const o=n._observer;o!==null&&(o.disconnect(),n._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",i.set("root",t))}function Zl(n){const e=n||{},t=Jl(),r=e.theme||{},i=n===void 0?t:e.parentEditor||null,o=e.disableEvents||!1,s=Zr(),l=e.namespace||(i!==null?i._config.namespace:Hi()),a=e.editorState,c=[Zt,gt,Ut,Jt,pt,Xr,...e.nodes||[]],{onError:u,html:f}=e,d=e.editable===void 0||e.editable;let h;if(n===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let _=0;_<c.length;_++){let m=c[_],x=null,y=null;if(typeof m!="function"){const b=m;m=b.replace,x=b.with,y=b.withKlass||null}const v=m.getType(),T=m.transform(),S=new Set;T!==null&&S.add(T),h.set(v,{exportDOM:f&&f.export?f.export.get(m):void 0,klass:m,replace:x,replaceWithKlass:y,transforms:S})}}const g=new Wn(s,i,h,{disableEvents:o,namespace:l,theme:r},u||console.error,function(_,m){const x=new Map,y=new Set,v=T=>{Object.keys(T).forEach(S=>{let b=x.get(S);b===void 0&&(b=[],x.set(S,b)),b.push(T[S])})};return _.forEach(T=>{const S=T.klass.importDOM;if(S==null||y.has(S))return;y.add(S);const b=S.call(T.klass);b!==null&&v(b)}),m&&v(m),x}(h,f?f.import:void 0),d);return a!==void 0&&(g._pendingEditorState=a,g._dirtyType=lt),g}class Wn{constructor(e,t,r,i,o,s,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=i,this._nodes=r,this._decorators={},this._pendingDecorators=null,this._dirtyType=He,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=Hi(),this._onError=o,this._htmlConversions=s,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 i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);const o=i.get(e);o===void 0&&A(36,String(e));const s=o[r];return s.add(t),()=>{s.delete(t),o.every(l=>l.size===0)&&i.delete(e)}}registerMutationListener(e,t,r){const i=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,o=this._listeners.mutation;o.set(t,i);const s=r&&r.skipInitialization;return s===void 0||s||this.initializeMutationListener(t,i),()=>{o.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,i=Pl(r).get(t.getType());if(!i)return;const o=new Map;for(const s of i.keys())o.set(s,"created");o.size>0&&e(o,{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),i=[r],o=r.replaceWithKlass;if(o!=null){const a=this.registerNodeTransformToKlass(o,t);i.push(a)}var s,l;return s=this,l=e.getType(),he(s,()=>{const a=De();if(a.isEmpty())return;if(l==="root")return void Z().markDirty();const c=a._nodeMap;for(const[,u]of c)u.markDirty()},s._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{i.forEach(a=>a.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=It(this._config.theme,"root"),i=this._pendingEditorState||this._editorState;if(this._rootElement=e,Yo(this,t,e,i),t!==null&&(this._config.disableEvents||Rl(t),r!=null&&t.classList.remove(...r)),e!==null){const o=function(l){const a=l.ownerDocument;return a&&a.defaultView||null}(e),s=e.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=o,this._dirtyType=lt,Ii(this),this._updateTags.add("history-merge"),Ue(this),this._config.disableEvents||function(l,a){const c=l.ownerDocument,u=Pn.get(c);(u===void 0||u<1)&&c.addEventListener("selectionchange",xo),Pn.set(c,(u||0)+1),l.__lexicalEditor=a;const f=vo(l);for(let d=0;d<Fr.length;d++){const[h,g]=Fr[d],_=typeof g=="function"?m=>{bo(m)||(Co(m),(a.isEditable()||h==="click")&&g(m,a))}:m=>{if(bo(m))return;Co(m);const x=a.isEditable();switch(h){case"cut":return x&&R(a,Gn,m);case"copy":return R(a,an,m);case"paste":return x&&R(a,Zn,m);case"dragstart":return x&&R(a,ki,m);case"dragover":return x&&R(a,Ei,m);case"dragend":return x&&R(a,Hs,m);case"focus":return x&&R(a,Zs,m);case"blur":return x&&R(a,Xs,m);case"drop":return x&&R(a,Ti,m)}};l.addEventListener(h,_),f.push(()=>{l.removeEventListener(h,_)})}}(e,this),r!=null&&e.classList.add(...r)}else this._editorState=i,this._pendingEditorState=null,this._window=null;Yt("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&A(38),Li(this);const r=this._pendingEditorState,i=this._updateTags,o=t!==void 0?t.tag:null;r===null||r.isEmpty()||(o!=null&&i.add(o),Ue(this)),this._pendingEditorState=e,this._dirtyType=lt,this._dirtyElements.set("root",!1),this._compositionKey=null,o!=null&&i.add(o),Ue(this)}parseEditorState(e,t){return function(r,i,o){const s=Zr(),l=te,a=de,c=ne,u=i._dirtyElements,f=i._dirtyLeaves,d=i._cloneNotNeeded,h=i._dirtyType;i._dirtyElements=new Map,i._dirtyLeaves=new Set,i._cloneNotNeeded=new Set,i._dirtyType=0,te=s,de=!1,ne=i;try{const g=i._nodes;Yr(r.root,g),o&&o(),s._readOnly=!0}catch(g){g instanceof Error&&i._onError(g)}finally{i._dirtyElements=u,i._dirtyLeaves=f,i._cloneNotNeeded=d,i._dirtyType=h,te=l,de=a,ne=c}return s}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return Ue(this),this.getEditorState().read(e,{editor:this})}update(e,t){he(this,e,t)}focus(e,t={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),he(this,()=>{const i=L(),o=Z();i!==null?i.dirty=!0:o.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?o.selectStart():o.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=Se(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Yt("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Wn.version="0.17.1+prod.esm";const Pc="";function Xl(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Gl=Xl(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 Zo=F.createContext(null);function ea(n,e){let t=null;return n!=null&&(t=n[1]),{getTheme:function(){return e??(t!=null?t.getTheme():null)}}}function et(){const n=F.useContext(Zo);return n==null&&Gl(8),n}const Xo=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,ta=Xo?F.useLayoutEffect:F.useEffect,Bn={tag:"history-merge"};function na({initialConfig:n,children:e}){const t=F.useMemo(()=>{const{theme:r,namespace:i,nodes:o,onError:s,editorState:l,html:a}=n,c=ea(null,r),u=Zl({editable:n.editable,html:a,namespace:i,nodes:o,onError:f=>s(f,u),theme:r});return function(f,d){if(d!==null){if(d===void 0)f.update(()=>{const h=Z();if(h.isEmpty()){const g=ke();h.append(g);const _=Xo?document.activeElement:null;(L()!==null||_!==null&&_===f.getRootElement())&&g.select()}},Bn);else if(d!==null)switch(typeof d){case"string":{const h=f.parseEditorState(d);f.setEditorState(h,Bn);break}case"object":f.setEditorState(d,Bn);break;case"function":f.update(()=>{Z().isEmpty()&&d(f)},Bn)}}}(u,l),[u,c]},[]);return ta(()=>{const r=n.editable,[i]=t;i.setEditable(r===void 0||r)},[]),I.jsx(Zo.Provider,{value:t,children:e})}function ra({defaultSelection:n}){const[e]=et();return F.useEffect(()=>{e.focus(()=>{const t=document.activeElement,r=e.getRootElement();r===null||t!==null&&r.contains(t)||r.focus({preventScroll:!0})},{defaultSelection:n})},[n,e]),null}function ia(){return Z().getTextContent()}function oa(n,e=!0){if(n)return!1;let t=ia();return e&&(t=t.trim()),t===""}function sa(n){if(!oa(n,!1))return!1;const e=Z().getChildren(),t=e.length;if(t>1)return!1;for(let r=0;r<t;r++){const i=e[r];if(U(i))return!1;if(C(i)){if(!Gr(i)||i.__indent!==0)return!1;const o=i.getChildren(),s=o.length;for(let l=0;l<s;l++){const a=o[r];if(!O(a))return!1}}}return!0}function Go(n){return()=>sa(n)}function la(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}la(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 aa(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}aa(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 ca=new Map;function ua(n){const e={},t=n.split(";");for(const r of t)if(r!==""){const[i,o]=r.split(/:([^]+)/);i&&o&&(e[i.trim()]=o.trim())}return e}function es(n,e){const t=n.getStartEndPoints();if(e.isSelected(n)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[r,i]=t,o=n.isBackward(),s=r.getNode(),l=i.getNode(),a=e.is(s),c=e.is(l);if(a||c){const[u,f]=$r(n),d=s.is(l),h=e.is(o?l:s),g=e.is(o?s:l);let _,m=0;return d?(m=u>f?f:u,_=u>f?u:f):h?(m=o?f:u,_=void 0):g&&(m=0,_=o?u:f),e.__text=e.__text.slice(m,_),e}}return e}function da(n){const e=n.getStyle(),t=ua(e);ca.set(e,t)}function ts(n,e){const t=Ft(n.focus,e);return U(t)&&!t.isIsolated()||C(t)&&!t.isInline()&&!t.canBeEmpty()}function fa(n,e,t,r){n.modify(e?"extend":"move",t,r)}function ha(n){const e=n.anchor.getNode();return(oe(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function ns(n,e,t){const r=ha(n);fa(n,e,t?!r:r,"character")}function ga(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var pa=ga(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 rs=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,_a=rs&&"documentMode"in document?document.documentMode:null;!(!rs||!("InputEvent"in window)||_a)&&"getTargetRanges"in new window.InputEvent("input");function _t(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}function ma(n){const e=ei(n,t=>C(t)&&!t.isInline());return C(e)||pa(4,n.__key),e}const ei=(n,e)=>{let t=n;for(;t!==Z()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function tt(n,e){return n!==null&&Object.getPrototypeOf(n).constructor.name===e.name}const is=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?F.useLayoutEffect:F.useEffect;function ya({editor:n,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:r,ariaDescribedBy:i,ariaExpanded:o,ariaLabel:s,ariaLabelledBy:l,ariaMultiline:a,ariaOwns:c,ariaRequired:u,autoCapitalize:f,className:d,id:h,role:g="textbox",spellCheck:_=!0,style:m,tabIndex:x,"data-testid":y,...v},T){const[S,b]=F.useState(n.isEditable()),N=F.useCallback(E=>{E&&E.ownerDocument&&E.ownerDocument.defaultView?n.setRootElement(E):n.setRootElement(null)},[n]),w=F.useMemo(()=>function(...E){return j=>{E.forEach(z=>{typeof z=="function"?z(j):z!=null&&(z.current=j)})}}(T,N),[N,T]);return is(()=>(b(n.isEditable()),n.registerEditableListener(E=>{b(E)})),[n]),I.jsx("div",{...v,"aria-activedescendant":S?e:void 0,"aria-autocomplete":S?t:"none","aria-controls":S?r:void 0,"aria-describedby":i,"aria-expanded":S&&g==="combobox"?!!o:void 0,"aria-label":s,"aria-labelledby":l,"aria-multiline":a,"aria-owns":S?c:void 0,"aria-readonly":!S||void 0,"aria-required":u,autoCapitalize:f,className:d,contentEditable:S,"data-testid":y,id:h,ref:w,role:S?g:void 0,spellCheck:_,style:m,tabIndex:x})}const va=F.forwardRef(ya);function os(n){return n.getEditorState().read(Go(n.isComposing()))}const xa=F.forwardRef(Ca);function Ca(n,e){const{placeholder:t,...r}=n,[i]=et();return I.jsxs(I.Fragment,{children:[I.jsx(va,{editor:i,...r,ref:e}),t!=null&&I.jsx(ba,{editor:i,content:t})]})}function ba({content:n,editor:e}){const t=function(s){const[l,a]=F.useState(()=>os(s));return is(()=>{function c(){const u=os(s);a(u)}return c(),_t(s.registerUpdateListener(()=>{c()}),s.registerEditableListener(()=>{c()}))},[s]),l}(e),[r,i]=F.useState(e.isEditable());if(F.useLayoutEffect(()=>(i(e.isEditable()),e.registerEditableListener(s=>{i(s)})),[e]),!t)return null;let o=null;return typeof n=="function"?o=n(r):n!==null&&(o=n),o===null?null:I.jsx("div",{"aria-hidden":!0,children:o})}const zn=0,ti=1,ni=2,Ce=0,Sa=1,ss=2,wa=3,Ta=4;function ka(n,e,t,r,i){if(n===null||t.size===0&&r.size===0&&!i)return Ce;const o=e._selection,s=n._selection;if(i)return Sa;if(!(P(o)&&P(s)&&s.isCollapsed()&&o.isCollapsed()))return Ce;const l=function(x,y,v){const T=x._nodeMap,S=[];for(const b of y){const N=T.get(b);N!==void 0&&S.push(N)}for(const[b,N]of v){if(!N)continue;const w=T.get(b);w===void 0||oe(w)||S.push(w)}return S}(e,t,r);if(l.length===0)return Ce;if(l.length>1){const x=e._nodeMap,y=x.get(o.anchor.key),v=x.get(s.anchor.key);return y&&v&&!n._nodeMap.has(y.__key)&&O(y)&&y.__text.length===1&&o.anchor.offset===1?ss:Ce}const a=l[0],c=n._nodeMap.get(a.__key);if(!O(c)||!O(a)||c.__mode!==a.__mode)return Ce;const u=c.__text,f=a.__text;if(u===f)return Ce;const d=o.anchor,h=s.anchor;if(d.key!==h.key||d.type!=="text")return Ce;const g=d.offset,_=h.offset,m=f.length-u.length;return m===1&&_===g-1?ss:m===-1&&_===g+1?wa:m===-1&&_===g?Ta:Ce}function Ea(n,e){let t=Date.now(),r=Ce;return(i,o,s,l,a,c)=>{const u=Date.now();if(c.has("historic"))return r=Ce,t=u,ni;const f=ka(i,o,l,a,n.isComposing()),d=(()=>{const h=s===null||s.editor===n,g=c.has("history-push");if(!g&&h&&c.has("history-merge"))return zn;if(i===null)return ti;const _=o._selection;return l.size>0||a.size>0?g===!1&&f!==Ce&&f===r&&u<t+e&&h||l.size===1&&function(m,x,y){const v=x._nodeMap.get(m),T=y._nodeMap.get(m),S=x._selection,b=y._selection;return!(P(S)&&P(b)&&S.anchor.type==="element"&&S.focus.type==="element"&&b.anchor.type==="text"&&b.focus.type==="text"||!O(v)||!O(T)||v.__parent!==T.__parent)&&JSON.stringify(x.read(()=>v.exportJSON()))===JSON.stringify(y.read(()=>T.exportJSON()))}(Array.from(l)[0],i,o)?zn:ti:_!==null?zn:ni})();return t=u,r=f,d}}function ls(n){n.undoStack=[],n.redoStack=[],n.current=null}function Na(n,e,t){const r=Ea(n,t);return _t(n.registerCommand(on,()=>(function(o,s){const l=s.redoStack,a=s.undoStack;if(a.length!==0){const c=s.current,u=a.pop();c!==null&&(l.push(c),o.dispatchCommand(Nt,!0)),a.length===0&&o.dispatchCommand(Pt,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:"historic"})}}(n,e),!0),V),n.registerCommand(sn,()=>(function(o,s){const l=s.redoStack,a=s.undoStack;if(l.length!==0){const c=s.current;c!==null&&(a.push(c),o.dispatchCommand(Pt,!0));const u=l.pop();l.length===0&&o.dispatchCommand(Nt,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:"historic"})}}(n,e),!0),V),n.registerCommand(Qs,()=>(ls(e),!1),V),n.registerCommand(Ys,()=>(ls(e),n.dispatchCommand(Nt,!1),n.dispatchCommand(Pt,!1),!0),V),n.registerUpdateListener(({editorState:o,prevEditorState:s,dirtyLeaves:l,dirtyElements:a,tags:c})=>{const u=e.current,f=e.redoStack,d=e.undoStack,h=u===null?null:u.editorState;if(u!==null&&o===h)return;const g=r(s,o,u,l,a,c);if(g===ti)f.length!==0&&(e.redoStack=[],n.dispatchCommand(Nt,!1)),u!==null&&(d.push({...u}),n.dispatchCommand(Pt,!0));else if(g===ni)return;e.current={editor:n,editorState:o}}))}function Pa(){return{current:null,redoStack:[],undoStack:[]}}function Aa({delay:n,externalHistoryState:e}){const[t]=et();return function(r,i,o=1e3){const s=F.useMemo(()=>i||Pa(),[i]);F.useEffect(()=>Na(r,s,o),[o,r,s])}(t,e,n),null}const Oa=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?F.useLayoutEffect:F.useEffect;function Da(n){return{initialValueFn:()=>n.isEditable(),subscribe:e=>n.registerEditableListener(e)}}function Ra(){return function(n){const[e]=et(),t=F.useMemo(()=>n(e),[e,n]),r=F.useRef(t.initialValueFn()),[i,o]=F.useState(r.current);return Oa(()=>{const{initialValueFn:s,subscribe:l}=t,a=s();return r.current!==a&&(r.current=a,o(a)),l(c=>{r.current=c,o(c)})},[t,n]),i}(Da)}function La(n){const e=window.location.origin,t=r=>{if(r.origin!==e)return;const i=n.getRootElement();if(document.activeElement!==i)return;const o=r.data;if(typeof o=="string"){let s;try{s=JSON.parse(o)}catch{return}if(s&&s.protocol==="nuanria_messaging"&&s.type==="request"){const l=s.payload;if(l&&l.functionId==="makeChanges"){const a=l.args;if(a){const[c,u,f,d,h,g]=a;n.update(()=>{const _=L();if(P(_)){const m=_.anchor;let x=m.getNode(),y=0,v=0;if(O(x)&&c>=0&&u>=0&&(y=c,v=c+u,_.setTextNodeRange(x,y,x,v)),y===v&&f===""||(_.insertRawText(f),x=m.getNode()),O(x)){y=d,v=d+h;const T=x.getTextContentSize();y=y>T?T:y,v=v>T?T:v,_.setTextNodeRange(x,y,x,v)}r.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function Ia(n,e){const t=e.body?e.body.childNodes:[];let r=[];const i=[];for(let o=0;o<t.length;o++){const s=t[o];if(!cs.has(s.nodeName)){const l=us(s,n,i,!1);l!==null&&(r=r.concat(l))}}return function(o){for(const s of o)s.getNextSibling()instanceof Xr&&s.insertAfter(Ge());for(const s of o){const l=s.getChildren();for(const a of l)s.insertBefore(a);s.remove()}}(i),r}function Fa(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=Z().getChildren();for(let i=0;i<r.length;i++)as(n,r[i],t,e);return t.innerHTML}function as(n,e,t,r=null){let i=r===null||e.isSelected(r);const o=C(e)&&e.excludeFromCopy("html");let s=e;if(r!==null){let h=Er(e);h=O(h)&&r!==null?es(r,h):h,s=h}const l=C(s)?s.getChildren():[],a=n._nodes.get(s.getType());let c;c=a&&a.exportDOM!==void 0?a.exportDOM(n,s):s.exportDOM(n);const{element:u,after:f}=c;if(!u)return!1;const d=document.createDocumentFragment();for(let h=0;h<l.length;h++){const g=l[h],_=as(n,g,d,r);!i&&C(e)&&_&&e.extractWithChild(g,r,"html")&&(i=!0)}if(i&&!o){if(wr(u)&&u.append(d),t.append(u),f){const h=f.call(s,u);h&&u.replaceWith(h)}}else t.append(d);return i}const cs=new Set(["STYLE","SCRIPT"]);function us(n,e,t,r,i=new Map,o){let s=[];if(cs.has(n.nodeName))return s;let l=null;const a=function(g,_){const{nodeName:m}=g,x=_._htmlConversions.get(m.toLowerCase());let y=null;if(x!==void 0)for(const v of x){const T=v(g);T!==null&&(y===null||(y.priority||0)<(T.priority||0))&&(y=T)}return y!==null?y.conversion:null}(n,e),c=a?a(n):null;let u=null;if(c!==null){u=c.after;const g=c.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,_]of i)if(l=_(l,o),!l)break;l&&s.push(...Array.isArray(g)?g:[l])}c.forChild!=null&&i.set(n.nodeName,c.forChild)}const f=n.childNodes;let d=[];const h=(l==null||!ut(l))&&(l!=null&&Jr(l)||r);for(let g=0;g<f.length;g++)d.push(...us(f[g],e,t,h,new Map(i),l));return u!=null&&(d=u(d)),Sn(n)&&(d=Ma(n,d,h?()=>{const g=new Xr;return t.push(g),g}:ke)),l==null?d.length>0?s=s.concat(d):Sn(n)&&function(g){return g.nextSibling==null||g.previousSibling==null?!1:Tr(g.nextSibling)&&Tr(g.previousSibling)}(n)&&(s=s.concat(Ge())):C(l)&&l.append(...d),s}function Ma(n,e,t){const r=n.style.textAlign,i=[];let o=[];for(let s=0;s<e.length;s++){const l=e[s];if(Jr(l))r&&!l.getFormat()&&l.setFormat(r),i.push(l);else if(o.push(l),s===e.length-1||s<e.length-1&&Jr(e[s+1])){const a=t();a.setFormat(r),a.append(...o),i.push(a),o=[]}}return i}function ja(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Kn=ja(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 Wa=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,ds=n=>Wa?(n||window).getSelection():null;function Ba(n,e=L()){return e==null&&Kn(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?"":Fa(n,e)}function za(n,e=L()){return e==null&&Kn(166),P(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(Ka(n,e))}function fs(n,e,t){const r=n.getData("application/x-lexical-editor");if(r)try{const s=JSON.parse(r);if(s.namespace===t._config.namespace&&Array.isArray(s.nodes))return hs(t,Va(s.nodes),e)}catch{}const i=n.getData("text/html");if(i)try{const s=new DOMParser().parseFromString(i,"text/html");return hs(t,Ia(t,s),e)}catch{}const o=n.getData("text/plain")||n.getData("text/uri-list");if(o!=null)if(P(e)){const s=o.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let l=0;l<s.length;l++){const a=L();if(P(a)){const c=s[l];c===`
|
|
39
|
+
`?r.push(et()):s===" "?r.push(Ht()):r.push(oe(s))}this.insertNodes(r)}insertText(e){const t=this.anchor,r=this.focus,o=this.format,i=this.style;let s=t,l=r;!this.isCollapsed()&&r.isBefore(t)&&(s=r,l=t),s.type==="element"&&function(m,x,v,y){const S=m.getNode(),w=S.getChildAtIndex(m.offset),C=oe(),N=ie(S)?Te().append(C):C;C.setFormat(v),C.setStyle(y),w===null?S.append(N):w.insertBefore(N),m.is(x)&&x.set(C.__key,0,"text"),m.set(C.__key,0,"text")}(s,l,o,i);const a=s.offset;let c=l.offset;const u=this.getNodes(),h=u.length;let d=u[0];R(d)||D(26);const f=d.getTextContent().length,g=d.getParentOrThrow();let _=u[h-1];if(h===1&&l.type==="element"&&(c=f,l.set(s.key,c,"text")),this.isCollapsed()&&a===f&&(d.isSegmented()||d.isToken()||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&d.getNextSibling()===null)){let m=d.getNextSibling();if(R(m)&&m.canInsertTextBefore()&&!ct(m)||(m=oe(),m.setFormat(o),m.setStyle(i),g.canInsertTextAfter()?d.insertAfter(m):g.insertAfter(m)),m.select(0,0),d=m,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&a===0&&(d.isSegmented()||d.isToken()||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&d.getPreviousSibling()===null)){let m=d.getPreviousSibling();if(R(m)&&!ct(m)||(m=oe(),m.setFormat(o),g.canInsertTextBefore()?d.insertBefore(m):g.insertBefore(m)),m.select(),d=m,e!=="")return void this.insertText(e)}else if(d.isSegmented()&&a!==f){const m=oe(d.getTextContent());m.setFormat(o),d.replace(m),d=m}else if(!this.isCollapsed()&&e!==""){const m=_.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||b(m)&&(!m.canInsertTextBefore()||!m.canInsertTextAfter()))return this.insertText(""),Bi(this.anchor,this.focus,null),void this.insertText(e)}if(h===1){if(d.isToken()){const y=oe(e);return y.select(),void d.replace(y)}const m=d.getFormat(),x=d.getStyle();if(a!==c||m===o&&x===i){if(ql(d)){const y=oe(e);return y.setFormat(o),y.setStyle(i),y.select(),void d.replace(y)}}else{if(d.getTextContent()!==""){const y=oe(e);if(y.setFormat(o),y.setStyle(i),y.select(),a===0)d.insertBefore(y,!1);else{const[S]=d.splitText(a);S.insertAfter(y,!1)}return void(y.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}d.setFormat(o),d.setStyle(i)}const v=c-a;d=d.spliceText(a,v,e,!0),d.getTextContent()===""?d.remove():this.anchor.type==="text"&&(d.isComposing()?this.anchor.offset-=e.length:(this.format=m,this.style=x))}else{const m=new Set([...d.getParentKeys(),..._.getParentKeys()]),x=b(d)?d:d.getParentOrThrow();let v=b(_)?_:_.getParentOrThrow(),y=_;if(!x.is(v)&&v.isInline())do y=v,v=v.getParentOrThrow();while(v.isInline());if(l.type==="text"&&(c!==0||_.getTextContent()==="")||l.type==="element"&&_.getIndexWithinParent()<c)if(R(_)&&!_.isToken()&&c!==_.getTextContentSize()){if(_.isSegmented()){const T=oe(_.getTextContent());_.replace(T),_=T}ie(l.getNode())||l.type!=="text"||(_=_.spliceText(0,c,"")),m.add(_.__key)}else{const T=_.getParentOrThrow();T.canBeEmpty()||T.getChildrenSize()!==1?_.remove():T.remove()}else m.add(_.__key);const S=v.getChildren(),w=new Set(u),C=x.is(v),N=x.isInline()&&d.getNextSibling()===null?x:d;for(let T=S.length-1;T>=0;T--){const P=S[T];if(P.is(d)||b(P)&&P.isParentOf(d))break;P.isAttached()&&(!w.has(P)||P.is(y)?C||N.insertAfter(P,!1):P.remove())}if(!C){let T=v,P=null;for(;T!==null;){const j=T.getChildren(),z=j.length;(z===0||j[z-1].is(P))&&(m.delete(T.__key),P=T),T=T.getParent()}}if(d.isToken())if(a===f)d.select();else{const T=oe(e);T.select(),d.replace(T)}else d=d.spliceText(a,f-a,e,!0),d.getTextContent()===""?d.remove():d.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length);for(let T=1;T<h;T++){const P=u[T],j=P.__key;m.has(j)||P.remove()}}}removeText(){this.insertText("")}formatText(e){if(this.isCollapsed())return this.toggleFormat(e),void re(null);const t=this.getNodes(),r=[];for(const v of t)R(v)&&r.push(v);const o=r.length;if(o===0)return this.toggleFormat(e),void re(null);const i=this.anchor,s=this.focus,l=this.isBackward(),a=l?s:i,c=l?i:s;let u=0,h=r[0],d=a.type==="element"?0:a.offset;if(a.type==="text"&&d===h.getTextContentSize()&&(u=1,h=r[1],d=0),h==null)return;const f=h.getFormatFlags(e,null),g=o-1;let _=r[g];const m=c.type==="text"?c.offset:_.getTextContentSize();if(h.is(_)){if(d===m)return;if(ct(h)||d===0&&m===h.getTextContentSize())h.setFormat(f);else{const v=h.splitText(d,m),y=d===0?v[0]:v[1];y.setFormat(f),a.type==="text"&&a.set(y.__key,0,"text"),c.type==="text"&&c.set(y.__key,m-d,"text")}return void(this.format=f)}d===0||ct(h)||([,h]=h.splitText(d),d=0),h.setFormat(f);const x=_.getFormatFlags(e,f);m>0&&(m===_.getTextContentSize()||ct(_)||([_]=_.splitText(m)),_.setFormat(x));for(let v=u+1;v<g;v++){const y=r[v],S=y.getFormatFlags(e,x);y.setFormat(S)}a.type==="text"&&a.set(h.__key,d,"text"),c.type==="text"&&c.set(_.__key,m,"text"),this.format=f|x}insertNodes(e){if(e.length===0)return;if(this.anchor.key==="root"){this.insertParagraph();const f=L();return O(f)||D(134),f.insertNodes(e)}const t=Rr((this.isBackward()?this.focus:this.anchor).getNode(),ft),r=e[e.length-1];if("__language"in t&&b(t)){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const f=eo(this);t.splice(f,0,e),r.selectEnd()}return}if(!e.some(f=>(b(f)||U(f))&&!f.isInline())){b(t)||D(135);const f=eo(this);return t.splice(f,0,e),void r.selectEnd()}const o=function(f){const g=Te();let _=null;for(let m=0;m<f.length;m++){const x=f[m],v=pt(x);if(v||U(x)&&x.isInline()||b(x)&&x.isInline()||R(x)||x.isParentRequired()){if(_===null&&(_=x.createParentElementNode(),g.append(_),v))continue;_!==null&&_.append(x)}else g.append(x),_=null}return g}(e),i=o.getLastDescendant(),s=o.getChildren(),l=!b(t)||!t.isEmpty()?this.insertParagraph():null,a=s[s.length-1];let c=s[0];var u;b(u=c)&&ft(u)&&!u.isEmpty()&&b(t)&&(!t.isEmpty()||t.canMergeWhenEmpty())&&(b(t)||D(135),t.append(...c.getChildren()),c=s[1]),c&&function(f,g,_){const m=g.getParentOrThrow().getLastChild();let x=g;const v=[g];for(;x!==m;)x.getNextSibling()||D(140),x=x.getNextSibling(),v.push(x);let y=f;for(const S of v)y=y.insertAfter(S)}(t,c);const h=Rr(i,ft);l&&b(h)&&(l.canMergeWhenEmpty()||ft(a))&&(h.append(...l.getChildren()),l.remove()),b(t)&&t.isEmpty()&&t.remove(),i.selectEnd();const d=b(t)?t.getLastChild():null;pt(d)&&h!==t&&d.remove()}insertParagraph(){if(this.anchor.key==="root"){const s=Te();return G().splice(this.anchor.offset,0,[s]),s.select(),s}const e=eo(this),t=Rr(this.anchor.getNode(),ft);b(t)||D(136);const r=t.getChildAtIndex(e),o=r?[r,...r.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...o),i.selectStart(),i):null}insertLineBreak(e){const t=et();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,i=this.focus;let s=e[0],l=e[r];const[a,c]=Xr(this);if(t===0)return[];if(t===1){if(R(s)&&!this.isCollapsed()){const h=a>c?c:a,d=a>c?a:c,f=s.splitText(h,d),g=h===0?f[0]:f[1];return g!=null?[g]:[]}return[s]}const u=o.isBefore(i);if(R(s)){const h=u?a:c;h===s.getTextContentSize()?e.shift():h!==0&&([,s]=s.splitText(h),e[0]=s)}if(R(l)){const h=l.getTextContent().length,d=u?c:a;d===0?e.pop():d!==h&&([l]=l.splitText(d),e[r]=l)}return e}modify(e,t,r){const o=this.focus,i=this.anchor,s=e==="move",l=Bt(o,t);if(U(l)&&!l.isIsolated()){if(s&&l.isKeyboardSelectable()){const f=$i();return f.add(l.__key),void Ce(f)}const d=t?l.getPreviousSibling():l.getNextSibling();if(R(d)){const f=d.__key,g=t?d.getTextContent().length:0;return o.set(f,g,"text"),void(s&&i.set(f,g,"text"))}{const f=l.getParentOrThrow();let g,_;return b(d)?(_=d.__key,g=t?d.getChildrenSize():0):(g=l.getIndexWithinParent(),_=f.__key,t||g++),o.set(_,g,"element"),void(s&&i.set(_,g,"element"))}}const a=H(),c=we(a._window);if(!c)return;const u=a._blockCursorElement,h=a._rootElement;if(h===null||u===null||!b(l)||l.isInline()||l.canBeEmpty()||Pr(u,a,h),function(d,f,g,_){d.modify(f,g,_)}(c,e,t?"backward":"forward",r),c.rangeCount>0){const d=c.getRangeAt(0),f=this.anchor.getNode(),g=ie(f)?f:Il(f);if(this.applyDOMRange(d),this.dirty=!0,!s){const _=this.getNodes(),m=[];let x=!1;for(let v=0;v<_.length;v++){const y=_[v];Tr(y,g)?m.push(y):x=!0}if(x&&m.length>0)if(t){const v=m[0];b(v)?v.selectStart():v.getParentOrThrow().selectStart()}else{const v=m[m.length-1];b(v)?v.selectEnd():v.getParentOrThrow().selectEnd()}c.anchorNode===d.startContainer&&c.anchorOffset===d.startOffset||function(v){const y=v.focus,S=v.anchor,w=S.key,C=S.offset,N=S.type;Ke(S,y.key,y.offset,y.type),Ke(y,w,C,N),v._cachedNodes=null}(this)}}}forwardDeletion(e,t,r){if(!r&&(e.type==="element"&&b(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const o=t.getParent(),i=t.getNextSibling()||(o===null?null:o.getNextSibling());if(b(i)&&i.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 i=this.focus,s=Bt(i,e);if(U(s)&&!s.isIsolated()){if(s.isKeyboardSelectable()&&b(o)&&o.getChildrenSize()===0){o.remove();const l=$i();l.add(s.__key),Ce(l)}else s.remove(),H().dispatchCommand(ln,void 0);return}if(!e&&b(s)&&b(o)&&o.isEmpty())return o.remove(),void s.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=i.type==="text"?i.getNode():null;if(o=r.type==="text"?r.getNode():null,l!==null&&l.isSegmented()){const a=i.offset,c=l.getTextContentSize();if(l.is(o)||e&&a!==c||!e&&a!==0)return void Li(l,e,a)}else if(o!==null&&o.isSegmented()){const a=r.offset,c=o.getTextContentSize();if(o.is(l)||e&&a!==0||!e&&a!==c)return void Li(o,e,a)}(function(a,c){const u=a.anchor,h=a.focus,d=u.getNode(),f=h.getNode();if(d===f&&u.type==="text"&&h.type==="text"){const g=u.offset,_=h.offset,m=g<_,x=m?g:_,v=m?_:g,y=v-1;x!==y&&(ei(d.getTextContent().slice(x,v))||(c?h.offset=y:u.offset=y))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&ie(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 xe(n){return n instanceof An}function Mi(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function Xr(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]:[Mi(t),Mi(r)]}function Li(n,e,t){const r=n,o=r.getTextContent().split(/(?=\s)/g),i=o.length;let s=0,l=0;for(let c=0;c<i;c++){const u=c===i-1;if(l=s,s+=o[c].length,e&&s===t||s>t||u){o.splice(c,1),u&&(l=void 0);break}}const a=o.join("").trim();a===""?r.remove():(r.setTextContent(a),r.select(l,l))}function Ai(n,e,t,r){let o,i=e;if(n.nodeType===It){let s=!1;const l=n.childNodes,a=l.length,c=r._blockCursorElement;i===a&&(s=!0,i=a-1);let u=l[i],h=!1;if(u===c)u=l[i+1],h=!0;else if(c!==null){const d=c.parentNode;n===d&&e>Array.prototype.indexOf.call(d.children,c)&&i--}if(o=ut(u),R(o))i=Zo(o,s);else{let d=ut(n);if(d===null)return null;if(b(d)){i=Math.min(d.getChildrenSize(),i);let f=d.getChildAtIndex(i);if(b(f)&&function(g,_,m){const x=g.getParent();return m===null||x===null||!x.canBeEmpty()||x!==m.getNode()}(f,0,t)){const g=s?f.getLastDescendant():f.getFirstDescendant();g===null?d=f:(f=g,d=b(f)?f:f.getParentOrThrow()),i=0}R(f)?(o=f,d=null,i=Zo(f,s)):f!==d&&s&&!h&&i++}else{const f=d.getIndexWithinParent();i=e===0&&U(d)&&ut(n)===d?f:f+1,d=d.getParentOrThrow()}if(b(d))return Ee(d.__key,i,"element")}}else o=ut(n);return R(o)?Ee(o.__key,i,"text"):null}function ji(n,e,t){const r=n.offset,o=n.getNode();if(r===0){const i=o.getPreviousSibling(),s=o.getParent();if(e){if((t||!e)&&i===null&&b(s)&&s.isInline()){const l=s.getPreviousSibling();R(l)&&(n.key=l.__key,n.offset=l.getTextContent().length)}}else b(i)&&!t&&i.isInline()?(n.key=i.__key,n.offset=i.getChildrenSize(),n.type="element"):R(i)&&(n.key=i.__key,n.offset=i.getTextContent().length)}else if(r===o.getTextContent().length){const i=o.getNextSibling(),s=o.getParent();if(e&&b(i)&&i.isInline())n.key=i.__key,n.offset=0,n.type="element";else if((t||e)&&i===null&&b(s)&&s.isInline()&&!s.canInsertTextAfter()){const l=s.getNextSibling();R(l)&&(n.key=l.__key,n.offset=0)}}}function Bi(n,e,t){if(n.type==="text"&&e.type==="text"){const r=n.isBefore(e),o=n.is(e);ji(n,r,o),ji(e,!r,o),o&&(e.key=n.key,e.offset=n.offset,e.type=n.type);const i=H();if(i.isComposing()&&i._compositionKey!==n.key&&O(t)){const s=t.anchor,l=t.focus;Ke(n,s.key,s.offset,s.type),Ke(e,l.key,l.offset,l.type)}}}function Wi(n,e,t,r,o,i){if(n===null||t===null||!Ft(o,n,t))return null;const s=Ai(n,e,O(i)?i.anchor:null,o);if(s===null)return null;const l=Ai(t,r,O(i)?i.focus:null,o);if(l===null)return null;if(s.type==="element"&&l.type==="element"){const a=ut(n),c=ut(t);if(U(a)&&U(c))return null}return Bi(s,l,i),[s,l]}function Qr(n){return b(n)&&!n.isInline()}function zi(n,e,t,r,o,i){const s=Ie(),l=new Ue(Ee(n,e,o),Ee(t,r,i),0,"");return l.dirty=!0,s._selection=l,l}function Gl(){const n=Ee("root",0,"element"),e=Ee("root",0,"element");return new Ue(n,e,0,"")}function $i(){return new An(new Set)}function Zr(n,e,t,r){const o=t._window;if(o===null)return null;const i=r||o.event,s=i?i.type:void 0,l=s==="selectionchange",a=!_r&&(l||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&i&&i.detail===3||s==="drop"||s===void 0);let c,u,h,d;if(O(n)&&!a)return n.clone();if(e===null)return null;if(c=e.anchorNode,u=e.focusNode,h=e.anchorOffset,d=e.focusOffset,l&&O(n)&&!Ft(t,c,u))return n.clone();const f=Wi(c,h,u,d,t,n);if(f===null)return null;const[g,_]=f;return new Ue(g,_,O(n)?n.format:0,O(n)?n.style:"")}function L(){return Ie()._selection}function Gt(){return H()._editorState._selection}function jn(n,e,t,r=1){const o=n.anchor,i=n.focus,s=o.getNode(),l=i.getNode();if(!e.is(s)&&!e.is(l))return;const a=e.__key;if(n.isCollapsed()){const c=o.offset;if(t<=c&&r>0||t<c&&r<0){const u=Math.max(0,c+r);o.set(a,u,"element"),i.set(a,u,"element"),Ki(n)}}else{const c=n.isBackward(),u=c?i:o,h=u.getNode(),d=c?o:i,f=d.getNode();if(e.is(h)){const g=u.offset;(t<=g&&r>0||t<g&&r<0)&&u.set(a,Math.max(0,g+r),"element")}if(e.is(f)){const g=d.offset;(t<=g&&r>0||t<g&&r<0)&&d.set(a,Math.max(0,g+r),"element")}}Ki(n)}function Ki(n){const e=n.anchor,t=e.offset,r=n.focus,o=r.offset,i=e.getNode(),s=r.getNode();if(n.isCollapsed()){if(!b(i))return;const l=i.getChildrenSize(),a=t>=l,c=a?i.getChildAtIndex(l-1):i.getChildAtIndex(t);if(R(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text"),r.set(c.__key,u,"text")}}else{if(b(i)){const l=i.getChildrenSize(),a=t>=l,c=a?i.getChildAtIndex(l-1):i.getChildAtIndex(t);if(R(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text")}}if(b(s)){const l=s.getChildrenSize(),a=o>=l,c=a?s.getChildAtIndex(l-1):s.getChildAtIndex(o);if(R(c)){let u=0;a&&(u=c.getTextContentSize()),r.set(c.__key,u,"text")}}}}function Bn(n,e,t,r,o){let i=null,s=0,l=null;r!==null?(i=r.__key,R(r)?(s=r.getTextContentSize(),l="text"):b(r)&&(s=r.getChildrenSize(),l="element")):o!==null&&(i=o.__key,R(o)?l="text":b(o)&&(l="element")),i!==null&&l!==null?n.set(i,s,l):(s=e.getIndexWithinParent(),s===-1&&(s=t.getChildrenSize()),n.set(t.__key,s,"element"))}function Ui(n,e,t,r,o){n.type==="text"?(n.key=t,e||(n.offset+=o)):n.offset>r.getIndexWithinParent()&&(n.offset-=1)}function Xl(n,e,t,r,o,i,s){const l=r.anchorNode,a=r.focusNode,c=r.anchorOffset,u=r.focusOffset,h=document.activeElement;if(o.has("collaboration")&&h!==i||h!==null&&vr(h))return;if(!O(e))return void(n!==null&&Ft(t,l,a)&&r.removeAllRanges());const d=e.anchor,f=e.focus,g=d.key,_=f.key,m=wn(t,g),x=wn(t,_),v=d.offset,y=f.offset,S=e.format,w=e.style,C=e.isCollapsed();let N=m,T=x,P=!1;if(d.type==="text"){N=xn(m);const Y=d.getNode();P=Y.getFormat()!==S||Y.getStyle()!==w}else O(n)&&n.anchor.type==="text"&&(P=!0);var j,z,ee,q,B;if(f.type==="text"&&(T=xn(x)),N!==null&&T!==null&&(C&&(n===null||P||O(n)&&(n.format!==S||n.style!==w))&&(j=S,z=w,ee=v,q=g,B=performance.now(),xi=[j,z,ee,q,B]),c!==v||u!==y||l!==N||a!==T||r.type==="Range"&&C||(h!==null&&i.contains(h)||i.focus({preventScroll:!0}),d.type==="element"))){try{r.setBaseAndExtent(N,v,T,y)}catch{}if(!o.has("skip-scroll-into-view")&&e.isCollapsed()&&i!==null&&i===document.activeElement){const Y=e instanceof Ue&&e.anchor.type==="element"?N.childNodes[v]||null:r.rangeCount>0?r.getRangeAt(0):null;if(Y!==null){let ce;if(Y instanceof Text){const Fe=document.createRange();Fe.selectNode(Y),ce=Fe.getBoundingClientRect()}else ce=Y.getBoundingClientRect();(function(Fe,Je,tn){const nn=tn.ownerDocument,rn=nn.defaultView;if(rn===null)return;let{top:bt,bottom:Ct}=Je,wt=0,St=0,pe=tn;for(;pe!==null;){const rt=pe===nn.body;if(rt)wt=0,St=En(Fe).innerHeight;else{const Ye=pe.getBoundingClientRect();wt=Ye.top,St=Ye.bottom}let Ne=0;if(bt<wt?Ne=-(wt-bt):Ct>St&&(Ne=Ct-St),Ne!==0)if(rt)rn.scrollBy(0,Ne);else{const Ye=pe.scrollTop;pe.scrollTop+=Ne;const ot=pe.scrollTop-Ye;bt-=ot,Ct-=ot}if(rt)break;pe=Sn(pe)}})(t,ce,i)}}Kr=!0}}function Ql(n){let e=L()||Gt();e===null&&(e=G().selectEnd()),e.insertNodes(n)}function eo(n){let e=n;n.isCollapsed()||e.removeText();const t=L();O(t)&&(e=t),O(e)||D(161);const r=e.anchor;let o=r.getNode(),i=r.offset;for(;!ft(o);)[o,i]=Zl(o,i);return i}function Zl(n,e){const t=n.getParent();if(!t){const o=Te();return G().append(o),o.select(),[G(),0]}if(R(n)){const o=n.splitText(e);if(o.length===0)return[t,n.getIndexWithinParent()];const i=e===0?0:1;return[t,o[0].getIndexWithinParent()+i]}if(!b(n)||e===0)return[t,n.getIndexWithinParent()];const r=n.getChildAtIndex(e);if(r){const o=new Ue(Ee(n.__key,e,"element"),Ee(n.__key,e,"element"),0,""),i=n.insertNewAfter(o);i&&i.append(r,...r.getNextSiblings())}return[t,n.getIndexWithinParent()+1]}let te=null,ne=null,de=!1,to=!1,Wn=0;const Vi={characterData:!0,childList:!0,subtree:!0};function Xt(){return de||te!==null&&te._readOnly}function fe(){de&&D(13)}function Ji(){Wn>99&&D(14)}function Ie(){return te===null&&D(195,Yi()),te}function H(){return ne===null&&D(196,Yi()),ne}function Yi(){let n=0;const e=new Set,t=Kn.version;if(typeof window<"u")for(const o of document.querySelectorAll("[contenteditable]")){const i=vn(o);if(xr(i))n++;else if(i){let s=String(i.constructor.version||"<0.17.1");s===t&&(s+=" (separately built, likely a bundler configuration issue)"),e.add(s)}}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 ea(){return ne}function qi(n,e,t){const r=e.__type,o=function(l,a){const c=l._nodes.get(a);return c===void 0&&D(30,a),c}(n,r);let i=t.get(r);i===void 0&&(i=Array.from(o.transforms),t.set(r,i));const s=i.length;for(let l=0;l<s&&(i[l](e),e.isAttached());l++);}function Hi(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function ta(n){return no(n,H()._nodes)}function no(n,e){const t=n.type,r=e.get(t);r===void 0&&D(17,t);const o=r.klass;n.type!==o.getType()&&D(18,o.name);const i=o.importJSON(n),s=n.children;if(b(i)&&Array.isArray(s))for(let l=0;l<s.length;l++){const a=no(s[l],e);i.append(a)}return i}function Gi(n,e,t){const r=te,o=de,i=ne;te=e,de=!0,ne=n;try{return t()}finally{te=r,de=o,ne=i}}function Ve(n,e){const t=n._pendingEditorState,r=n._rootElement,o=n._headless||r===null;if(t===null)return;const i=n._editorState,s=i._selection,l=t._selection,a=n._dirtyType!==He,c=te,u=de,h=ne,d=n._updating,f=n._observer;let g=null;if(n._pendingEditorState=null,n._editorState=t,!o&&a&&f!==null){ne=n,te=t,de=!1,n._updating=!0;try{const C=n._dirtyType,N=n._dirtyElements,T=n._dirtyLeaves;f.disconnect(),g=Wl(i,t,n,C,N,T)}catch(C){if(C instanceof Error&&n._onError(C),to)throw C;return ns(n,null,r,t),$o(n),n._dirtyType=at,to=!0,Ve(n,i),void(to=!1)}finally{f.observe(r,Vi),n._updating=d,te=c,de=u,ne=h}}t._readOnly||(t._readOnly=!0);const _=n._dirtyLeaves,m=n._dirtyElements,x=n._normalizedNodes,v=n._updateTags,y=n._deferred;a&&(n._dirtyType=He,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements=new Map,n._normalizedNodes=new Set,n._updateTags=new Set),function(C,N){const T=C._decorators;let P=C._pendingDecorators||T;const j=N._nodeMap;let z;for(z in P)j.has(z)||(P===T&&(P=Go(C)),delete P[z])}(n,t);const S=o?null:we(n._window);if(n._editable&&S!==null&&(a||l===null||l.dirty)){ne=n,te=t;try{if(f!==null&&f.disconnect(),a||l===null||l.dirty){const C=n._blockCursorElement;C!==null&&Pr(C,n,r),Xl(s,l,n,S,v,r)}Fl(n,r,l),f!==null&&f.observe(r,Vi)}finally{ne=h,te=c}}g!==null&&function(C,N,T,P,j){const z=Array.from(C._listeners.mutation),ee=z.length;for(let q=0;q<ee;q++){const[B,Y]=z[q],ce=N.get(Y);ce!==void 0&&B(ce,{dirtyLeaves:P,prevEditorState:j,updateTags:T})}}(n,g,v,_,i),O(l)||l===null||s!==null&&s.is(l)||n.dispatchCommand(ln,void 0);const w=n._pendingDecorators;w!==null&&(n._decorators=w,n._pendingDecorators=null,Qt("decorator",n,!0,w)),function(C,N,T){const P=Xo(N),j=Xo(T);P!==j&&Qt("textcontent",C,!0,j)}(n,e||i,t),Qt("update",n,!0,{dirtyElements:m,dirtyLeaves:_,editorState:t,normalizedNodes:x,prevEditorState:e||i,tags:v}),function(C,N){if(C._deferred=[],N.length!==0){const T=C._updating;C._updating=!0;try{for(let P=0;P<N.length;P++)N[P]()}finally{C._updating=T}}}(n,y),function(C){const N=C._updates;if(N.length!==0){const T=N.shift();if(T){const[P,j]=T;Zi(C,P,j)}}}(n)}function Qt(n,e,t,...r){const o=e._updating;e._updating=t;try{const i=Array.from(e._listeners[n]);for(let s=0;s<i.length;s++)i[s].apply(null,r)}finally{e._updating=o}}function Xi(n,e,t){if(n._updating===!1||ne!==n){let o=!1;return n.update(()=>{o=Xi(n,e,t)}),o}const r=Cr(n);for(let o=4;o>=0;o--)for(let i=0;i<r.length;i++){const s=r[i]._commands.get(e);if(s!==void 0){const l=s[o];if(l!==void 0){const a=Array.from(l),c=a.length;for(let u=0;u<c;u++)if(a[u](t,n)===!0)return!0}}}return!1}function Qi(n,e){const t=n._updates;let r=e||!1;for(;t.length!==0;){const o=t.shift();if(o){const[i,s]=o;let l,a;if(s!==void 0){if(l=s.onUpdate,a=s.tag,s.skipTransforms&&(r=!0),s.discrete){const c=n._pendingEditorState;c===null&&D(191),c._flushSync=!0}l&&n._deferred.push(l),a&&n._updateTags.add(a)}i()}}return r}function Zi(n,e,t){const r=n._updateTags;let o,i,s=!1,l=!1;t!==void 0&&(o=t.onUpdate,i=t.tag,i!=null&&r.add(i),s=t.skipTransforms||!1,l=t.discrete||!1),o&&n._deferred.push(o);const a=n._editorState;let c=n._pendingEditorState,u=!1;(c===null||c._readOnly)&&(c=n._pendingEditorState=new $n(new Map((c||a)._nodeMap)),u=!0),c._flushSync=l;const h=te,d=de,f=ne,g=n._updating;te=c,de=!1,n._updating=!0,ne=n;try{u&&(n._headless?a._selection!==null&&(c._selection=a._selection.clone()):c._selection=function(v){const y=v.getEditorState()._selection,S=we(v._window);return O(y)||y==null?Zr(y,S,v,null):y.clone()}(n));const m=n._compositionKey;e(),s=Qi(n,s),function(v,y){const S=y.getEditorState()._selection,w=v._selection;if(O(w)){const C=w.anchor,N=w.focus;let T;if(C.type==="text"&&(T=C.getNode(),T.selectionTransform(S,w)),N.type==="text"){const P=N.getNode();T!==P&&P.selectionTransform(S,w)}}}(c,n),n._dirtyType!==He&&(s?function(v,y){const S=y._dirtyLeaves,w=v._nodeMap;for(const C of S){const N=w.get(C);R(N)&&N.isAttached()&&N.isSimpleText()&&!N.isUnmergeable()&&Vo(N)}}(c,n):function(v,y){const S=y._dirtyLeaves,w=y._dirtyElements,C=v._nodeMap,N=We(),T=new Map;let P=S,j=P.size,z=w,ee=z.size;for(;j>0||ee>0;){if(j>0){y._dirtyLeaves=new Set;for(const q of P){const B=C.get(q);R(B)&&B.isAttached()&&B.isSimpleText()&&!B.isUnmergeable()&&Vo(B),B!==void 0&&Hi(B,N)&&qi(y,B,T),S.add(q)}if(P=y._dirtyLeaves,j=P.size,j>0){Wn++;continue}}y._dirtyLeaves=new Set,y._dirtyElements=new Map;for(const q of z){const B=q[0],Y=q[1];if(B!=="root"&&!Y)continue;const ce=C.get(B);ce!==void 0&&Hi(ce,N)&&qi(y,ce,T),w.set(B,Y)}P=y._dirtyLeaves,j=P.size,z=y._dirtyElements,ee=z.size,Wn++}y._dirtyLeaves=S,y._dirtyElements=w}(c,n),Qi(n),function(v,y,S,w){const C=v._nodeMap,N=y._nodeMap,T=[];for(const[P]of w){const j=N.get(P);j!==void 0&&(j.isAttached()||(b(j)&&ui(j,P,C,N,T,w),C.has(P)||w.delete(P),T.push(P)))}for(const P of T)N.delete(P);for(const P of S){const j=N.get(P);j===void 0||j.isAttached()||(C.has(P)||S.delete(P),N.delete(P))}}(a,c,n._dirtyLeaves,n._dirtyElements)),m!==n._compositionKey&&(c._flushSync=!0);const x=c._selection;if(O(x)){const v=c._nodeMap,y=x.anchor.key,S=x.focus.key;v.get(y)!==void 0&&v.get(S)!==void 0||D(19)}else xe(x)&&x._nodes.size===0&&(c._selection=null)}catch(m){return m instanceof Error&&n._onError(m),n._pendingEditorState=a,n._dirtyType=at,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),void Ve(n)}finally{te=h,de=d,ne=f,n._updating=g,Wn=0}n._dirtyType!==He||function(m,x){const v=x.getEditorState()._selection,y=m._selection;if(y!==null){if(y.dirty||!y.is(v))return!0}else if(v!==null)return!0;return!1}(c,n)?c._flushSync?(c._flushSync=!1,Ve(n)):u&&Nl(()=>{Ve(n)}):(c._flushSync=!1,u&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function he(n,e,t){n._updating?n._updates.push([e,t]):Zi(n,e,t)}class zn extends Fn{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 vl[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=H()._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(R(t)&&e.push(t),b(t)){const r=t.getAllTextNodes();e.push(...r)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;b(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;b(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 i=t[r-1];return b(i)&&i.getLastDescendant()||i||null}const o=t[e];return b(o)&&o.getFirstDescendant()||o||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:se(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&D(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:se(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&D(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 i=t[o];e+=i.getTextContent(),b(i)&&o!==r-1&&!i.isInline()&&(e+=Pe)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),r=t.length;for(let o=0;o<r;o++){const i=t[o];e+=i.getTextContentSize(),b(i)&&o!==r-1&&!i.isInline()&&(e+=Pe.length)}return e}getDirection(){return this.getLatest().__dir}hasFormat(e){if(e!==""){const t=Bo[e];return!!(this.getFormat()&t)}return!1}select(e,t){fe();const r=L();let o=e,i=t;const s=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const a=this.getFirstChild();if(R(a)||b(a))return a.select(0,0)}else if(!(e!==void 0&&e!==s||t!==void 0&&t!==s)){const a=this.getLastChild();if(R(a)||b(a))return a.select()}}o===void 0&&(o=s),i===void 0&&(i=s);const l=this.__key;return O(r)?(r.anchor.set(l,o,"element"),r.focus.set(l,i,"element"),r.dirty=!0,r):zi(l,o,l,i,"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!==""?Bo[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,i=this.getChildrenSize(),s=this.getWritable(),l=s.__key,a=[],c=[],u=this.getChildAtIndex(e+t);let h=null,d=i-t+o;if(e!==0)if(e===i)h=this.getLastChild();else{const g=this.getChildAtIndex(e);g!==null&&(h=g.getPreviousSibling())}if(t>0){let g=h===null?this.getFirstChild():h.getNextSibling();for(let _=0;_<t;_++){g===null&&D(100);const m=g.getNextSibling(),x=g.__key;Ge(g.getWritable()),c.push(x),g=m}}let f=h;for(let g=0;g<o;g++){const _=r[g];f!==null&&_.is(f)&&(h=f=f.getPreviousSibling());const m=_.getWritable();m.__parent===l&&d--,Ge(m);const x=_.__key;if(f===null)s.__first=x,m.__prev=null;else{const v=f.getWritable();v.__next=x,m.__prev=v.__key}_.__key===l&&D(76),m.__parent=l,a.push(x),f=_}if(e+t===i)f!==null&&(f.getWritable().__next=null,s.__last=f.__key);else if(u!==null){const g=u.getWritable();if(f!==null){const _=f.getWritable();g.__prev=f.__key,_.__next=u.__key}else g.__prev=null}if(s.__size=d,c.length){const g=L();if(O(g)){const _=new Set(c),m=new Set(a),{anchor:x,focus:v}=g;es(x,_,m)&&Bn(x,x.getNode(),this,h,u),es(v,_,m)&&Bn(v,v.getNode(),this,h,u),d!==0||this.canBeEmpty()||dt(this)||this.remove()}}return s}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 b(n){return n instanceof zn}function es(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 na extends Fn{constructor(e){super(e)}decorate(e,t){D(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function U(n){return n instanceof na}class Zt extends zn{static getType(){return"root"}static clone(){return new Zt}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){D(51)}getTextContent(){const e=this.__cachedText;return!Xt()&&H()._dirtyType!==He||e===null?super.getTextContent():e}remove(){D(52)}replace(e){D(53)}insertBefore(e){D(54)}insertAfter(e){D(55)}updateDOM(e,t){return!1}append(...e){for(let t=0;t<e.length;t++){const r=e[t];b(r)||U(r)||D(56)}return super.append(...e)}static importJSON(e){const t=G();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 ie(n){return n instanceof Zt}function ro(){return new $n(new Map([["root",new Zt]]))}function ts(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType()&&D(130,t.name),b(n)){const r=e.children;Array.isArray(r)||D(59,t.name);const o=n.getChildren();for(let i=0;i<o.length;i++){const s=ts(o[i]);r.push(s)}}return e}class $n{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 Gi(t&&t.editor||null,this,e)}clone(e){const t=new $n(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return Gi(null,this,()=>({root:ts(G())}))}}class oo extends zn{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class mt extends zn{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=Oe[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 mt(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}createDOM(e){const t=document.createElement("p"),r=jt(e.theme,"paragraph");return r!==void 0&&t.classList.add(...r),t}updateDOM(e,t,r){return!1}static importDOM(){return{p:e=>({conversion:ra,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(t&&Or(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 i=this.getIndent();i>0&&(t.style.textIndent=20*i+"px")}return{element:t}}static importJSON(e){const t=Te();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=Te();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||R(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 ra(n){const e=Te();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 Te(){return Tn(new mt)}function io(n){return n instanceof mt}const K=0,oa=4;function ns(n,e,t,r){const o=n._keyToDOMMap;o.clear(),n._editorState=ro(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=He,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,n._updateTags=new Set,n._updates=[],n._blockCursorElement=null;const i=n._observer;i!==null&&(i.disconnect(),n._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",o.set("root",t))}function ia(n){const e=n||{},t=ea(),r=e.theme||{},o=n===void 0?t:e.parentEditor||null,i=e.disableEvents||!1,s=ro(),l=e.namespace||(o!==null?o._config.namespace:ti()),a=e.editorState,c=[Zt,_t,Yt,qt,mt,oo,...e.nodes||[]],{onError:u,html:h}=e,d=e.editable===void 0||e.editable;let f;if(n===void 0&&t!==null)f=t._nodes;else{f=new Map;for(let _=0;_<c.length;_++){let m=c[_],x=null,v=null;if(typeof m!="function"){const C=m;m=C.replace,x=C.with,v=C.withKlass||null}const y=m.getType(),S=m.transform(),w=new Set;S!==null&&w.add(S),f.set(y,{exportDOM:h&&h.export?h.export.get(m):void 0,klass:m,replace:x,replaceWithKlass:v,transforms:w})}}const g=new Kn(s,o,f,{disableEvents:i,namespace:l,theme:r},u||console.error,function(_,m){const x=new Map,v=new Set,y=S=>{Object.keys(S).forEach(w=>{let C=x.get(w);C===void 0&&(C=[],x.set(w,C)),C.push(S[w])})};return _.forEach(S=>{const w=S.klass.importDOM;if(w==null||v.has(w))return;v.add(w);const C=w.call(S.klass);C!==null&&y(C)}),m&&y(m),x}(f,h?h.import:void 0),d);return a!==void 0&&(g._pendingEditorState=a,g._dirtyType=at),g}class Kn{constructor(e,t,r,o,i,s,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=He,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=ti(),this._onError=i,this._htmlConversions=s,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&&D(35);const o=this._commands;o.has(e)||o.set(e,[new Set,new Set,new Set,new Set,new Set]);const i=o.get(e);i===void 0&&D(36,String(e));const s=i[r];return s.add(t),()=>{s.delete(t),i.every(l=>l.size===0)&&o.delete(e)}}registerMutationListener(e,t,r){const o=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;i.set(t,o);const s=r&&r.skipInitialization;return s===void 0||s||this.initializeMutationListener(t,o),()=>{i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&D(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const r=this._editorState,o=Al(r).get(t.getType());if(!o)return;const i=new Map;for(const s of o.keys())i.set(s,"created");i.size>0&&e(i,{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],i=r.replaceWithKlass;if(i!=null){const a=this.registerNodeTransformToKlass(i,t);o.push(a)}var s,l;return s=this,l=e.getType(),he(s,()=>{const a=Ie();if(a.isEmpty())return;if(l==="root")return void G().markDirty();const c=a._nodeMap;for(const[,u]of c)u.markDirty()},s._pendingEditorState===null?{tag:"history-merge"}:void 0),()=>{o.forEach(a=>a.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return M(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=jt(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=e,ns(this,t,e,o),t!==null&&(this._config.disableEvents||zl(t),r!=null&&t.classList.remove(...r)),e!==null){const i=function(l){const a=l.ownerDocument;return a&&a.defaultView||null}(e),s=e.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=at,$o(this),this._updateTags.add("history-merge"),Ve(this),this._config.disableEvents||function(l,a){const c=l.ownerDocument,u=In.get(c);(u===void 0||u<1)&&c.addEventListener("selectionchange",Ti),In.set(c,(u||0)+1),l.__lexicalEditor=a;const h=Ei(l);for(let d=0;d<$r.length;d++){const[f,g]=$r[d],_=typeof g=="function"?m=>{Ni(m)||(ki(m),(a.isEditable()||f==="click")&&g(m,a))}:m=>{if(Ni(m))return;ki(m);const x=a.isEditable();switch(f){case"cut":return x&&M(a,ir,m);case"copy":return M(a,fn,m);case"paste":return x&&M(a,rr,m);case"dragstart":return x&&M(a,Io,m);case"dragover":return x&&M(a,Fo,m);case"dragend":return x&&M(a,nl,m);case"focus":return x&&M(a,il,m);case"blur":return x&&M(a,sl,m);case"drop":return x&&M(a,Ro,m)}};l.addEventListener(f,_),h.push(()=>{l.removeEventListener(f,_)})}}(e,this),r!=null&&e.classList.add(...r)}else this._editorState=o,this._pendingEditorState=null,this._window=null;Qt("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&D(38),zo(this);const r=this._pendingEditorState,o=this._updateTags,i=t!==void 0?t.tag:null;r===null||r.isEmpty()||(i!=null&&o.add(i),Ve(this)),this._pendingEditorState=e,this._dirtyType=at,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&o.add(i),Ve(this)}parseEditorState(e,t){return function(r,o,i){const s=ro(),l=te,a=de,c=ne,u=o._dirtyElements,h=o._dirtyLeaves,d=o._cloneNotNeeded,f=o._dirtyType;o._dirtyElements=new Map,o._dirtyLeaves=new Set,o._cloneNotNeeded=new Set,o._dirtyType=0,te=s,de=!1,ne=o;try{const g=o._nodes;no(r.root,g),i&&i(),s._readOnly=!0}catch(g){g instanceof Error&&o._onError(g)}finally{o._dirtyElements=u,o._dirtyLeaves=h,o._cloneNotNeeded=d,o._dirtyType=f,te=l,de=a,ne=c}return s}(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return Ve(this),this.getEditorState().read(e,{editor:this})}update(e,t){he(this,e,t)}focus(e,t={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),he(this,()=>{const o=L(),i=G();o!==null?o.dirty=!0:i.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?i.selectStart():i.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=we(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Qt("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Kn.version="0.17.1+prod.esm";const Gc="";function sa(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var la=sa(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 rs=F.createContext(null);function aa(n,e){let t=null;return n!=null&&(t=n[1]),{getTheme:function(){return e??(t!=null?t.getTheme():null)}}}function tt(){const n=F.useContext(rs);return n==null&&la(8),n}const os=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,ca=os?F.useLayoutEffect:F.useEffect,Un={tag:"history-merge"};function ua({initialConfig:n,children:e}){const t=F.useMemo(()=>{const{theme:r,namespace:o,nodes:i,onError:s,editorState:l,html:a}=n,c=aa(null,r),u=ia({editable:n.editable,html:a,namespace:o,nodes:i,onError:h=>s(h,u),theme:r});return function(h,d){if(d!==null){if(d===void 0)h.update(()=>{const f=G();if(f.isEmpty()){const g=Te();f.append(g);const _=os?document.activeElement:null;(L()!==null||_!==null&&_===h.getRootElement())&&g.select()}},Un);else if(d!==null)switch(typeof d){case"string":{const f=h.parseEditorState(d);h.setEditorState(f,Un);break}case"object":h.setEditorState(d,Un);break;case"function":h.update(()=>{G().isEmpty()&&d(h)},Un)}}}(u,l),[u,c]},[]);return ca(()=>{const r=n.editable,[o]=t;o.setEditable(r===void 0||r)},[]),E.jsx(rs.Provider,{value:t,children:e})}function da({defaultSelection:n}){const[e]=tt();return F.useEffect(()=>{e.focus(()=>{const t=document.activeElement,r=e.getRootElement();r===null||t!==null&&r.contains(t)||r.focus({preventScroll:!0})},{defaultSelection:n})},[n,e]),null}function fa(){return G().getTextContent()}function ha(n,e=!0){if(n)return!1;let t=fa();return e&&(t=t.trim()),t===""}function ga(n){if(!ha(n,!1))return!1;const e=G().getChildren(),t=e.length;if(t>1)return!1;for(let r=0;r<t;r++){const o=e[r];if(U(o))return!1;if(b(o)){if(!io(o)||o.__indent!==0)return!1;const i=o.getChildren(),s=i.length;for(let l=0;l<s;l++){const a=i[r];if(!R(a))return!1}}}return!0}function is(n){return()=>ga(n)}function pa(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}pa(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 _a(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ma=_a(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 ya=new Map;function va(n){const e={},t=n.split(";");for(const r of t)if(r!==""){const[o,i]=r.split(/:([^]+)/);o&&i&&(e[o.trim()]=i.trim())}return e}function ss(n,e){const t=n.getStartEndPoints();if(e.isSelected(n)&&!e.isSegmented()&&!e.isToken()&&t!==null){const[r,o]=t,i=n.isBackward(),s=r.getNode(),l=o.getNode(),a=e.is(s),c=e.is(l);if(a||c){const[u,h]=Xr(n),d=s.is(l),f=e.is(i?l:s),g=e.is(i?s:l);let _,m=0;return d?(m=u>h?h:u,_=u>h?u:h):f?(m=i?h:u,_=void 0):g&&(m=0,_=i?u:h),e.__text=e.__text.slice(m,_),e}}return e}function ls(n){if(n.type==="text")return n.offset===n.getNode().getTextContentSize();const e=n.getNode();return b(e)||ma(177),n.offset===e.getChildrenSize()}function xa(n){const e=n.getStyle(),t=va(e);ya.set(e,t)}function as(n,e){const t=Bt(n.focus,e);return U(t)&&!t.isIsolated()||b(t)&&!t.isInline()&&!t.canBeEmpty()}function ba(n,e,t,r){n.modify(e?"extend":"move",t,r)}function Ca(n){const e=n.anchor.getNode();return(ie(e)?e:e.getParentOrThrow()).getDirection()==="rtl"}function cs(n,e,t){const r=Ca(n);ba(n,e,t?!r:r,"character")}function wa(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Sa=wa(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 us=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Ea=us&&"documentMode"in document?document.documentMode:null;!(!us||!("InputEvent"in window)||Ea)&&"getTargetRanges"in new window.InputEvent("input");function yt(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}function Ta(n){const e=so(n,t=>b(t)&&!t.isInline());return b(e)||Sa(4,n.__key),e}const so=(n,e)=>{let t=n;for(;t!==G()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function nt(n,e){return n!==null&&Object.getPrototypeOf(n).constructor.name===e.name}const ds=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?F.useLayoutEffect:F.useEffect;function ka({editor:n,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:r,ariaDescribedBy:o,ariaExpanded:i,ariaLabel:s,ariaLabelledBy:l,ariaMultiline:a,ariaOwns:c,ariaRequired:u,autoCapitalize:h,className:d,id:f,role:g="textbox",spellCheck:_=!0,style:m,tabIndex:x,"data-testid":v,...y},S){const[w,C]=F.useState(n.isEditable()),N=F.useCallback(P=>{P&&P.ownerDocument&&P.ownerDocument.defaultView?n.setRootElement(P):n.setRootElement(null)},[n]),T=F.useMemo(()=>function(...P){return j=>{P.forEach(z=>{typeof z=="function"?z(j):z!=null&&(z.current=j)})}}(S,N),[N,S]);return ds(()=>(C(n.isEditable()),n.registerEditableListener(P=>{C(P)})),[n]),E.jsx("div",{...y,"aria-activedescendant":w?e:void 0,"aria-autocomplete":w?t:"none","aria-controls":w?r:void 0,"aria-describedby":o,"aria-expanded":w&&g==="combobox"?!!i:void 0,"aria-label":s,"aria-labelledby":l,"aria-multiline":a,"aria-owns":w?c:void 0,"aria-readonly":!w||void 0,"aria-required":u,autoCapitalize:h,className:d,contentEditable:w,"data-testid":v,id:f,ref:T,role:w?g:void 0,spellCheck:_,style:m,tabIndex:x})}const Na=F.forwardRef(ka);function fs(n){return n.getEditorState().read(is(n.isComposing()))}const Pa=F.forwardRef(Oa);function Oa(n,e){const{placeholder:t,...r}=n,[o]=tt();return E.jsxs(E.Fragment,{children:[E.jsx(Na,{editor:o,...r,ref:e}),t!=null&&E.jsx(Da,{editor:o,content:t})]})}function Da({content:n,editor:e}){const t=function(s){const[l,a]=F.useState(()=>fs(s));return ds(()=>{function c(){const u=fs(s);a(u)}return c(),yt(s.registerUpdateListener(()=>{c()}),s.registerEditableListener(()=>{c()}))},[s]),l}(e),[r,o]=F.useState(e.isEditable());if(F.useLayoutEffect(()=>(o(e.isEditable()),e.registerEditableListener(s=>{o(s)})),[e]),!t)return null;let i=null;return typeof n=="function"?i=n(r):n!==null&&(i=n),i===null?null:E.jsx("div",{"aria-hidden":!0,children:i})}const Vn=0,lo=1,ao=2,be=0,Ra=1,hs=2,Ia=3,Fa=4;function Ma(n,e,t,r,o){if(n===null||t.size===0&&r.size===0&&!o)return be;const i=e._selection,s=n._selection;if(o)return Ra;if(!(O(i)&&O(s)&&s.isCollapsed()&&i.isCollapsed()))return be;const l=function(x,v,y){const S=x._nodeMap,w=[];for(const C of v){const N=S.get(C);N!==void 0&&w.push(N)}for(const[C,N]of y){if(!N)continue;const T=S.get(C);T===void 0||ie(T)||w.push(T)}return w}(e,t,r);if(l.length===0)return be;if(l.length>1){const x=e._nodeMap,v=x.get(i.anchor.key),y=x.get(s.anchor.key);return v&&y&&!n._nodeMap.has(v.__key)&&R(v)&&v.__text.length===1&&i.anchor.offset===1?hs:be}const a=l[0],c=n._nodeMap.get(a.__key);if(!R(c)||!R(a)||c.__mode!==a.__mode)return be;const u=c.__text,h=a.__text;if(u===h)return be;const d=i.anchor,f=s.anchor;if(d.key!==f.key||d.type!=="text")return be;const g=d.offset,_=f.offset,m=h.length-u.length;return m===1&&_===g-1?hs:m===-1&&_===g+1?Ia:m===-1&&_===g?Fa:be}function La(n,e){let t=Date.now(),r=be;return(o,i,s,l,a,c)=>{const u=Date.now();if(c.has("historic"))return r=be,t=u,ao;const h=Ma(o,i,l,a,n.isComposing()),d=(()=>{const f=s===null||s.editor===n,g=c.has("history-push");if(!g&&f&&c.has("history-merge"))return Vn;if(o===null)return lo;const _=i._selection;return l.size>0||a.size>0?g===!1&&h!==be&&h===r&&u<t+e&&f||l.size===1&&function(m,x,v){const y=x._nodeMap.get(m),S=v._nodeMap.get(m),w=x._selection,C=v._selection;return!(O(w)&&O(C)&&w.anchor.type==="element"&&w.focus.type==="element"&&C.anchor.type==="text"&&C.focus.type==="text"||!R(y)||!R(S)||y.__parent!==S.__parent)&&JSON.stringify(x.read(()=>y.exportJSON()))===JSON.stringify(v.read(()=>S.exportJSON()))}(Array.from(l)[0],o,i)?Vn:lo:_!==null?Vn:ao})();return t=u,r=h,d}}function gs(n){n.undoStack=[],n.redoStack=[],n.current=null}function Aa(n,e,t){const r=La(n,t);return yt(n.registerCommand(cn,()=>(function(i,s){const l=s.redoStack,a=s.undoStack;if(a.length!==0){const c=s.current,u=a.pop();c!==null&&(l.push(c),i.dispatchCommand(Dt,!0)),a.length===0&&i.dispatchCommand(Rt,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:"historic"})}}(n,e),!0),K),n.registerCommand(un,()=>(function(i,s){const l=s.redoStack,a=s.undoStack;if(l.length!==0){const c=s.current;c!==null&&(a.push(c),i.dispatchCommand(Rt,!0));const u=l.pop();l.length===0&&i.dispatchCommand(Dt,!1),s.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:"historic"})}}(n,e),!0),K),n.registerCommand(rl,()=>(gs(e),!1),K),n.registerCommand(ol,()=>(gs(e),n.dispatchCommand(Dt,!1),n.dispatchCommand(Rt,!1),!0),K),n.registerUpdateListener(({editorState:i,prevEditorState:s,dirtyLeaves:l,dirtyElements:a,tags:c})=>{const u=e.current,h=e.redoStack,d=e.undoStack,f=u===null?null:u.editorState;if(u!==null&&i===f)return;const g=r(s,i,u,l,a,c);if(g===lo)h.length!==0&&(e.redoStack=[],n.dispatchCommand(Dt,!1)),u!==null&&(d.push({...u}),n.dispatchCommand(Rt,!0));else if(g===ao)return;e.current={editor:n,editorState:i}}))}function ja(){return{current:null,redoStack:[],undoStack:[]}}function Ba({delay:n,externalHistoryState:e}){const[t]=tt();return function(r,o,i=1e3){const s=F.useMemo(()=>o||ja(),[o]);F.useEffect(()=>Aa(r,s,i),[i,r,s])}(t,e,n),null}const Wa=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?F.useLayoutEffect:F.useEffect;function za(n){return{initialValueFn:()=>n.isEditable(),subscribe:e=>n.registerEditableListener(e)}}function $a(){return function(n){const[e]=tt(),t=F.useMemo(()=>n(e),[e,n]),r=F.useRef(t.initialValueFn()),[o,i]=F.useState(r.current);return Wa(()=>{const{initialValueFn:s,subscribe:l}=t,a=s();return r.current!==a&&(r.current=a,i(a)),l(c=>{r.current=c,i(c)})},[t,n]),o}(za)}function Ka(n){const e=window.location.origin,t=r=>{if(r.origin!==e)return;const o=n.getRootElement();if(document.activeElement!==o)return;const i=r.data;if(typeof i=="string"){let s;try{s=JSON.parse(i)}catch{return}if(s&&s.protocol==="nuanria_messaging"&&s.type==="request"){const l=s.payload;if(l&&l.functionId==="makeChanges"){const a=l.args;if(a){const[c,u,h,d,f,g]=a;n.update(()=>{const _=L();if(O(_)){const m=_.anchor;let x=m.getNode(),v=0,y=0;if(R(x)&&c>=0&&u>=0&&(v=c,y=c+u,_.setTextNodeRange(x,v,x,y)),v===y&&h===""||(_.insertRawText(h),x=m.getNode()),R(x)){v=d,y=d+f;const S=x.getTextContentSize();v=v>S?S:v,y=y>S?S:y,_.setTextNodeRange(x,v,x,y)}r.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function Ua(n,e){const t=e.body?e.body.childNodes:[];let r=[];const o=[];for(let i=0;i<t.length;i++){const s=t[i];if(!_s.has(s.nodeName)){const l=ms(s,n,o,!1);l!==null&&(r=r.concat(l))}}return function(i){for(const s of i)s.getNextSibling()instanceof oo&&s.insertAfter(et());for(const s of i){const l=s.getChildren();for(const a of l)s.insertBefore(a);s.remove()}}(o),r}function Va(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=G().getChildren();for(let o=0;o<r.length;o++)ps(n,r[o],t,e);return t.innerHTML}function ps(n,e,t,r=null){let o=r===null||e.isSelected(r);const i=b(e)&&e.excludeFromCopy("html");let s=e;if(r!==null){let f=Ir(e);f=R(f)&&r!==null?ss(r,f):f,s=f}const l=b(s)?s.getChildren():[],a=n._nodes.get(s.getType());let c;c=a&&a.exportDOM!==void 0?a.exportDOM(n,s):s.exportDOM(n);const{element:u,after:h}=c;if(!u)return!1;const d=document.createDocumentFragment();for(let f=0;f<l.length;f++){const g=l[f],_=ps(n,g,d,r);!o&&b(e)&&_&&e.extractWithChild(g,r,"html")&&(o=!0)}if(o&&!i){if(Or(u)&&u.append(d),t.append(u),h){const f=h.call(s,u);f&&u.replaceWith(f)}}else t.append(d);return o}const _s=new Set(["STYLE","SCRIPT"]);function ms(n,e,t,r,o=new Map,i){let s=[];if(_s.has(n.nodeName))return s;let l=null;const a=function(g,_){const{nodeName:m}=g,x=_._htmlConversions.get(m.toLowerCase());let v=null;if(x!==void 0)for(const y of x){const S=y(g);S!==null&&(v===null||(v.priority||0)<(S.priority||0))&&(v=S)}return v!==null?v.conversion:null}(n,e),c=a?a(n):null;let u=null;if(c!==null){u=c.after;const g=c.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,_]of o)if(l=_(l,i),!l)break;l&&s.push(...Array.isArray(g)?g:[l])}c.forChild!=null&&o.set(n.nodeName,c.forChild)}const h=n.childNodes;let d=[];const f=(l==null||!dt(l))&&(l!=null&&Qr(l)||r);for(let g=0;g<h.length;g++)d.push(...ms(h[g],e,t,f,new Map(o),l));return u!=null&&(d=u(d)),kn(n)&&(d=Ja(n,d,f?()=>{const g=new oo;return t.push(g),g}:Te)),l==null?d.length>0?s=s.concat(d):kn(n)&&function(g){return g.nextSibling==null||g.previousSibling==null?!1:Dr(g.nextSibling)&&Dr(g.previousSibling)}(n)&&(s=s.concat(et())):b(l)&&l.append(...d),s}function Ja(n,e,t){const r=n.style.textAlign,o=[];let i=[];for(let s=0;s<e.length;s++){const l=e[s];if(Qr(l))r&&!l.getFormat()&&l.setFormat(r),o.push(l);else if(i.push(l),s===e.length-1||s<e.length-1&&Qr(e[s+1])){const a=t();a.setFormat(r),a.append(...i),o.push(a),i=[]}}return o}function Ya(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Jn=Ya(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 qa=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,ys=n=>qa?(n||window).getSelection():null;function Ha(n,e=L()){return e==null&&Jn(166),O(e)&&e.isCollapsed()||e.getNodes().length===0?"":Va(n,e)}function Ga(n,e=L()){return e==null&&Jn(166),O(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(Xa(n,e))}function vs(n,e,t){const r=n.getData("application/x-lexical-editor");if(r)try{const s=JSON.parse(r);if(s.namespace===t._config.namespace&&Array.isArray(s.nodes))return xs(t,Qa(s.nodes),e)}catch{}const o=n.getData("text/html");if(o)try{const s=new DOMParser().parseFromString(o,"text/html");return xs(t,Ua(t,s),e)}catch{}const i=n.getData("text/plain")||n.getData("text/uri-list");if(i!=null)if(O(e)){const s=i.split(/(\r?\n|\t)/);s[s.length-1]===""&&s.pop();for(let l=0;l<s.length;l++){const a=L();if(O(a)){const c=s[l];c===`
|
|
40
40
|
`||c===`\r
|
|
41
|
-
`?a.insertParagraph():c===" "?a.insertNodes([qt()]):a.insertText(c)}}}else e.insertRawText(o)}function hs(n,e,t){n.dispatchCommand(Bs,{nodes:e,selection:t})||t.insertNodes(e)}function gs(n,e,t,r=[]){let i=e===null||t.isSelected(e);const o=C(t)&&t.excludeFromCopy("html");let s=t;if(e!==null){let c=Er(t);c=O(c)&&e!==null?es(e,c):c,s=c}const l=C(s)?s.getChildren():[],a=function(c){const u=c.exportJSON(),f=c.constructor;if(u.type!==f.getType()&&Kn(58,f.name),C(c)){const d=u.children;Array.isArray(d)||Kn(59,f.name)}return u}(s);if(O(s)){const c=s.__text;c.length>0?a.text=c:i=!1}for(let c=0;c<l.length;c++){const u=l[c],f=gs(n,e,u,a.children);!i&&C(t)&&f&&t.extractWithChild(u,e,"clone")&&(i=!0)}if(i&&!o)r.push(a);else if(Array.isArray(a.children))for(let c=0;c<a.children.length;c++){const u=a.children[c];r.push(u)}return i}function Ka(n,e){const t=[],r=Z().getChildren();for(let i=0;i<r.length;i++)gs(n,e,r[i],t);return{namespace:n._config.namespace,nodes:t}}function Va(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t],i=ql(r);O(i)&&da(i),e.push(i)}return e}let mt=null;async function ps(n,e,t){if(mt!==null)return!1;if(e!==null)return new Promise((a,c)=>{n.update(()=>{a(_s(n,e,t))})});const r=n.getRootElement(),i=n._window==null?window.document:n._window.document,o=ds(n._window);if(r===null||o===null)return!1;const s=i.createElement("span");s.style.cssText="position: fixed; top: -1000px;",s.append(i.createTextNode("#")),r.append(s);const l=new Range;return l.setStart(s,0),l.setEnd(s,1),o.removeAllRanges(),o.addRange(l),new Promise((a,c)=>{const u=n.registerCommand(an,f=>(tt(f,ClipboardEvent)&&(u(),mt!==null&&(window.clearTimeout(mt),mt=null),a(_s(n,f,t))),!0),Yl);mt=window.setTimeout(()=>{u(),mt=null,a(!1)},50),i.execCommand("copy"),s.remove()})}function _s(n,e,t){if(t===void 0){const i=ds(n._window);if(!i)return!1;const o=i.anchorNode,s=i.focusNode;if(o!==null&&s!==null&&!Ot(n,o,s))return!1;const l=L();if(l===null)return!1;t=$a(l)}e.preventDefault();const r=e.clipboardData;return r!==null&&(Ja(r,t),!0)}const Ua=[["text/html",Ba],["application/x-lexical-editor",za]];function $a(n=L()){const e={"text/plain":n?n.getTextContent():""};if(n){const t=El();for(const[r,i]of Ua){const o=i(t,n);o!==null&&(e[r]=o)}}return e}function Ja(n,e){for(const t in e){const r=e[t];r!==void 0&&n.setData(t,r)}}function ms(n,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(n,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(n,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const yt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,qa=yt&&"documentMode"in document?document.documentMode:null,Ha=!(!yt||!("InputEvent"in window)||qa)&&"getTargetRanges"in new window.InputEvent("input"),Qa=yt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Ya=yt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Za=yt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Xa=yt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Za,ys=Ws();function Vn(n){let e=null;if(tt(n,DragEvent)?e=n.dataTransfer:tt(n,ClipboardEvent)&&(e=n.clipboardData),e===null)return[!1,[],!1];const t=e.types,r=t.includes("Files"),i=t.includes("text/html")||t.includes("text/plain");return[r,Array.from(e.files),i]}function vs(n){const e=L();if(!P(e))return!1;const t=new Set,r=e.getNodes();for(let i=0;i<r.length;i++){const o=r[i],s=o.getKey();if(t.has(s))continue;const l=ei(o,c=>C(c)&&!c.isInline());if(l===null)continue;const a=l.getKey();l.canIndent()&&!t.has(a)&&(t.add(a),n(l))}return t.size>0}function Un(n){const e=Ye(n);return U(e)}function Ga(n){return _t(n.registerCommand(_i,e=>{const t=L();return!!xe(t)&&(t.clear(),!0)},0),n.registerCommand(qe,e=>{const t=L();return!!P(t)&&(t.deleteCharacter(e),!0)},V),n.registerCommand(Tt,e=>{const t=L();return!!P(t)&&(t.deleteWord(e),!0)},V),n.registerCommand(kt,e=>{const t=L();return!!P(t)&&(t.deleteLine(e),!0)},V),n.registerCommand(st,e=>{const t=L();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const r=e.dataTransfer;if(r!=null)fs(r,t,n);else if(P(t)){const i=e.data;return i&&t.insertText(i),!0}}return!0},V),n.registerCommand(Xn,()=>{const e=L();return!!P(e)&&(e.removeText(),!0)},V),n.registerCommand(ge,e=>{const t=L();return!!P(t)&&(t.formatText(e),!0)},V),n.registerCommand(Et,e=>{const t=L();if(!P(t)&&!xe(t))return!1;const r=t.getNodes();for(const i of r){const o=ei(i,s=>C(s)&&!s.isInline());o!==null&&o.setFormat(e)}return!0},V),n.registerCommand(ot,e=>{const t=L();return!!P(t)&&(t.insertLineBreak(e),!0)},V),n.registerCommand(rn,()=>{const e=L();return!!P(e)&&(e.insertParagraph(),!0)},V),n.registerCommand(Js,()=>(Ul([qt()]),!0),V),n.registerCommand(qs,()=>vs(e=>{const t=e.getIndent();e.setIndent(t+1)}),V),n.registerCommand(wi,()=>vs(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),V),n.registerCommand(vi,e=>{const t=L();if(xe(t)&&!Un(e.target)){const r=t.getNodes();if(r.length>0)return r[0].selectPrevious(),!0}else if(P(t)){const r=Ft(t.focus,!0);if(!e.shiftKey&&U(r)&&!r.isIsolated()&&!r.isInline())return r.selectPrevious(),e.preventDefault(),!0}return!1},V),n.registerCommand(xi,e=>{const t=L();if(xe(t)){const r=t.getNodes();if(r.length>0)return r[0].selectNext(0,0),!0}else if(P(t)){if(function(i){const o=i.focus;return o.key==="root"&&o.offset===Z().getChildrenSize()}(t))return e.preventDefault(),!0;const r=Ft(t.focus,!1);if(!e.shiftKey&&U(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),e.preventDefault(),!0}return!1},V),n.registerCommand(yi,e=>{const t=L();if(xe(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectPrevious(),!0}if(!P(t))return!1;if(ts(t,!0)){const r=e.shiftKey;return e.preventDefault(),ns(t,r,!0),!0}return!1},V),n.registerCommand(mi,e=>{const t=L();if(xe(t)&&!Un(e.target)){const i=t.getNodes();if(i.length>0)return e.preventDefault(),i[0].selectNext(0,0),!0}if(!P(t))return!1;const r=e.shiftKey;return!!ts(t,!1)&&(e.preventDefault(),ns(t,r,!1),!0)},V),n.registerCommand(Ci,e=>{if(Un(e.target))return!1;const t=L();if(!P(t))return!1;e.preventDefault();const{anchor:r}=t,i=r.getNode();return t.isCollapsed()&&r.offset===0&&!oe(i)&&ma(i).getIndent()>0?n.dispatchCommand(wi,void 0):n.dispatchCommand(qe,!0)},V),n.registerCommand(Si,e=>{if(Un(e.target))return!1;const t=L();return!!P(t)&&(e.preventDefault(),n.dispatchCommand(qe,!1))},V),n.registerCommand(ln,e=>{const t=L();if(!P(t))return!1;if(e!==null){if((Ya||Qa||Xa)&&Ha)return!1;if(e.preventDefault(),e.shiftKey)return n.dispatchCommand(ot,!1)}return n.dispatchCommand(rn,void 0)},V),n.registerCommand(bi,()=>{const e=L();return!!P(e)&&(n.blur(),!0)},V),n.registerCommand(Ti,e=>{const[,t]=Vn(e);if(t.length>0){const i=ms(e.clientX,e.clientY);if(i!==null){const{offset:o,node:s}=i,l=Ye(s);if(l!==null){const a=Kl();if(O(l))a.anchor.set(l.getKey(),o,"text"),a.focus.set(l.getKey(),o,"text");else{const u=l.getParentOrThrow().getKey(),f=l.getIndexWithinParent()+1;a.anchor.set(u,f,"element"),a.focus.set(u,f,"element")}const c=Wi(a);be(c)}n.dispatchCommand(ys,t)}return e.preventDefault(),!0}const r=L();return!!P(r)},V),n.registerCommand(ki,e=>{const[t]=Vn(e),r=L();return!(t&&!P(r))},V),n.registerCommand(Ei,e=>{const[t]=Vn(e),r=L();if(t&&!P(r))return!1;const i=ms(e.clientX,e.clientY);if(i!==null){const o=Ye(i.node);U(o)&&e.preventDefault()}return!0},V),n.registerCommand(er,()=>(wl(),!0),V),n.registerCommand(an,e=>(ps(n,tt(e,ClipboardEvent)?e:null),!0),V),n.registerCommand(Gn,e=>(async function(t,r){await ps(r,tt(t,ClipboardEvent)?t:null),r.update(()=>{const i=L();P(i)?i.removeText():xe(i)&&i.getNodes().forEach(o=>o.remove())})}(e,n),!0),V),n.registerCommand(Zn,e=>{const[,t,r]=Vn(e);return t.length>0&&!r?(n.dispatchCommand(ys,t),!0):hr(e.target)?!1:L()!==null&&(function(i,o){i.preventDefault(),o.update(()=>{const s=L(),l=tt(i,InputEvent)||tt(i,KeyboardEvent)?null:i.clipboardData;l!=null&&s!==null&&fs(l,s,o)},{tag:"paste"})}(e,n),!0)},V))}const ri=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?F.useLayoutEffect:F.useEffect;function xs(n){return n.getEditorState().read(Go(n.isComposing()))}function ec({contentEditable:n,placeholder:e=null,ErrorBoundary:t}){const[r]=et(),i=function(o,s){const[l,a]=F.useState(()=>o.getDecorators());return ri(()=>o.registerDecoratorListener(c=>{di.flushSync(()=>{a(c)})}),[o]),F.useEffect(()=>{a(o.getDecorators())},[o]),F.useMemo(()=>{const c=[],u=Object.keys(l);for(let f=0;f<u.length;f++){const d=u[f],h=I.jsx(s,{onError:_=>o._onError(_),children:I.jsx(F.Suspense,{fallback:null,children:l[d]})}),g=o.getElementByKey(d);g!==null&&c.push(di.createPortal(h,g,d))}return c},[s,l,o])}(r,t);return function(o){ri(()=>_t(Ga(o),La(o)),[o])}(r),I.jsxs(I.Fragment,{children:[n,I.jsx(tc,{content:e}),i]})}function tc({content:n}){const[e]=et(),t=function(i){const[o,s]=F.useState(()=>xs(i));return ri(()=>{function l(){const a=xs(i);s(a)}return l(),_t(i.registerUpdateListener(()=>{l()}),i.registerEditableListener(()=>{l()}))},[i]),o}(e),r=Ra();return t?typeof n=="function"?n(r):n:null}function ii(n,e){return ii=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},ii(n,e)}var Cs={error:null},nc=function(n){var e,t;function r(){for(var o,s=arguments.length,l=new Array(s),a=0;a<s;a++)l[a]=arguments[a];return(o=n.call.apply(n,[this].concat(l))||this).state=Cs,o.resetErrorBoundary=function(){for(var c,u=arguments.length,f=new Array(u),d=0;d<u;d++)f[d]=arguments[d];o.props.onReset==null||(c=o.props).onReset.apply(c,f),o.reset()},o}t=n,(e=r).prototype=Object.create(t.prototype),e.prototype.constructor=e,ii(e,t),r.getDerivedStateFromError=function(o){return{error:o}};var i=r.prototype;return i.reset=function(){this.setState(Cs)},i.componentDidCatch=function(o,s){var l,a;(l=(a=this.props).onError)==null||l.call(a,o,s)},i.componentDidUpdate=function(o,s){var l,a,c,u,f=this.state.error,d=this.props.resetKeys;f!==null&&s.error!==null&&((c=o.resetKeys)===void 0&&(c=[]),(u=d)===void 0&&(u=[]),c.length!==u.length||c.some(function(h,g){return!Object.is(h,u[g])}))&&((l=(a=this.props).onResetKeysChange)==null||l.call(a,o.resetKeys,d),this.reset())},i.render=function(){var o=this.state.error,s=this.props,l=s.fallbackRender,a=s.FallbackComponent,c=s.fallback;if(o!==null){var u={error:o,resetErrorBoundary:this.resetErrorBoundary};if(qn.isValidElement(c))return c;if(typeof l=="function")return l(u);if(a)return qn.createElement(a,u);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},r}(qn.Component);function rc({children:n,onError:e}){return I.jsx(nc,{fallback:I.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:n})}const ic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS4AAABmCAMAAAE15bxSAAAAyVBMVEUAAAAAAADtHCQAAADtHCQAAADtHCQAAADtHCQAAADtHCQAAADtHCQAAADtHCSNV0YAAADtHCQhISJqUEfVPS0AAADtHCRNQj4AAACiV0LtHCRgTEQAAADtHCQAAADtHCRnT0YAAABeS0TtHCSAVUgAAADtHCSHV0dURkEAAADtHCQCAgLTQC5LQDxaSUMZGRkfHyAAAAAhISJEPDlURkFhTUVtUUd6VEiFVkiQV0WbV0SmVkCyVD2+TzjJSTPUPy3gMCrtHCT////o2L2jAAAAMXRSTlMAEBAgIDAwQEBQUGBgcHB8gICIiIiQkJigoKCosLDAwMjQ0NDY4ODo6/Dw8fLz8/v+gRdbXwAAAAFiS0dEQhDXPfQAAAvcSURBVHja7V1rd6S4ES0ZY0HT7RVJ2ks6WIQ4OMF53t31znqynln+/5/KB/HQCxq6256ds9Q59rhpUbpclUqlksQQXVgw/JRERLHxjfAUo5CIQBi+gVejK3VfJLGKgYhERUSSiIFIYNlTXDdNU0TudQEAra6bxpS2ZgCCiLgEarKh3zYv0Aqrur7r7uuk/SLy6ScAkF7QaUpfVvomABGoJsqNdsZQqv0F/ZpVTG9MgNSPuomIeP91Ro7hQCqDAlN/L5K0aRofkQCAUP1ttfyWiIgkAMmJaNc2YWKoaRq8Npbuhogo0Fp+337x5Gv6HAC4D3OURl+46SlDQETEuQLI+1/Ezb/aEl1BSpCQdp1MC5BiMJZEN57aKgjuMx1VQXt/bpgfWFusJmbWCvWZGECu7wHZFXW2TEQU88B+BMNQQV+HHBqfFNf+0jkcqTTDb5rmUTfQ6N7R/A0AEYw6FmidcD/mlrnrM5umaYquc0R3pielnYO6nPYLtjzSKr8SUX6+cyLBYEohEYWciIgxIsY5D3T3Q1VNRBQOF9i+77ohiEiIvuNKo89z2Rdk3cWEiOTgo6U1MipdBENXbepSuvNWwaCLKUdJIOKarhBdNWjjK01XnQzc6Lo6Lwcot93qIoFBFwxdSdcFK2S2LnPc7nRR2dYbtEP0gKus9Rs1XeGYrt4FtP9qz9gPiZYuCNNXD7q6S0K1NK8yKbWKq7pt7UxK/pvrSJuic5tXc4pz2TvPjMx4xye3I1rcAQRHNPXu3RzqAQBSxG3DcWEo+3PTNE1zp91ylT7aGu+zNpDzyr4bgPAyOnsomub1GR8GjCPh2X0jh3HNHf1CCbRhizseP3bD2lVaOBMEn4Sm8rspUm9pVNlu1BSiwqNp429mMX8qFqXplw9vV1nlHEkgQw7EfbcSQlRoR3QiMXQILQaVsONfohJmVxK6xlLr5QyIQ9nfKW2v2gbu3kC7V6vjGhx8jyvo9YXou7j0a+TDsKyL9M5opTZ/8GnRcRHreOxxUdJh7eZy47jI5Xgcl5qsZ4YWNpBs4iJKVJQ14KJcNVDf8H07DhqlrFEzLcsFaJ/97dhj8z+MjYsoAwxcVIOIykxz1Q5fmVtrpdnXRKg0HxdRDei4CCBR0xSuYW6vK+ZTuFQrJFp/PIqLyGLd/Oi3L94nExLVrVFP85UBqIZIQFrZq0Qm9tSCiJhZSpoxhJK9pVHKXIuZkiG8acuHq8/+CkVLos0K8sej6jNCrlCUmJKK+e56bE6Qw+Yomlhigdh3N+dLsdVctKh6FqSY01ZhpoqbnOFT0zTN43ZWe1xtD08+YK8fP/708qqmPJvTmvofptcrpycIIzYr2hb68Ol8m+xTi793cMGZHOrCeCIMSyk9zxEdzjWGO1NhOdswZTyTzpu0WGyhPj27KTR5fK6nut6M43w6rPO9VVZZZZX3krjURm7OebtO0l/o4xH9qvPt8DdvxdBojLssB3JmVumEr0ASZNr0MROi21hhztukFiENSxXDWmGfEDADPUAIsdc0kkQWJPp83BcY1mp2l/WFuLpae3DBwcWGa/uRmXH7seontlxVMZaucJNHer7EM/+Wes5hKM9sRX5cbHRGP4IL83HlcJbxeZ8OAk3iosW4Ag+uwIuLSsBNCdh5ND8u0bejnarw46phJMBaXFoSTcfV292gat+tFYaTuEJAz0Pxo7hU+ikwcMXakryJi9wtUKpAbCRVzDSmlNJYHojN5YLR9JfUlu8BAPXO9zSy3a1RmrgqtRwqJiwWVk5SRchH+FLG0TWDs33HxkVAZm4SsYF62tHdEqFhncBFsnve47gYkJGVlqOsnMTFnDWnCb9hwp+Ni0IMS9Pqc0L6ZNln94lb+Sxc8fx2VB3KGslA07gGD6NWwolouh0ZbPDHcdlPn+jZvzH/pXUtptKUbAqXAIJukJyNizJMeEZACCmdFZHe9oFkcHtu+a5RasOZOGnOId+61xIbpsfeZeYdSiwFsZTM9Utu+VVWWeW9hc3Nk6usX1oYqariPt1cLkEV7PLKTbCVk1nU67sjGb2Hw/bm9KlgPp2KHNm7ET3Nzzg+LFteYKKalST1NOr2pJR9epS9QNQLlhUy+/anM3LIjyPk8b1ZaS1zITg3hjjORa4nna1NRw/nL3c86txppiRFHMxo6l3lC/DnrAJE2xmZ74c/fFsCQJmLxVv7gtrGlf1HrULdzPUjPkifXz9+ePn5VXWL03pt7ERteFisKbpTS3CvL8/ADx99afllq0Tbp+azg2tk9W9CuvWhf308f82y3+33wcEFoIyX4AFQi/ZhrmctuhT36SYy2iWK0sJwBfc+XF0H4h7qOBd7Y90qc1fur5cvCTXew01eXMelTCbb5La4EKwlwEQwt1scFvvqyJvQOT5InLLZOLp7OGnlsR9ap5Ygy9ksTTi9+1GAxe2RscDBVu5jRheXKNqkaZqmt9ENrbLKKqusssoqq6yyytctXMud7dnUfEnunHBf+PJ90jifoF02Z/uJ59QZkVo31Svi0/lFOzHqnQBo2bg6cXFN7vG1Mbep17DWdoUMUPodLbW5cX6KLqBkR+miHeDUqE51GM3C9ReAhDzhLsa+aAmgdpogA2re15l54HItvTA1QTM2JmfxBF3tcjmfR5cnY+rQRXu45z6osuvgo+9LcehqTdZqqlxfv2OO5cuxl3J4O8jUup/Fj3TIGaMr8xDm0kW5uzk7cyx4EV3kNik7crhzGV2IZ9NVOU83Rleb80iO0EWV7b4SV98iugLX+wTG4a6z6Np5nd8IXRmc7SyjdBGx2nLlPrpYbT5K4OnES+gKa8/wkQNAyS9Al9IPoPImuXS64trz2pEJulrdg+P10UWByUXlIYYDKLudkULwUbrCDINPd8bg0RSsBLBr1Sfi6JnspBpdAgSAUkqpSuQukkm6Wpwlm6CLuO7kMtt6PYGEoLFAospG/QrrI4k6pulAYo6RBe3xHelC2Vl7bJfQpTpwOy756aJk8HE739sF5nXGBNOliIZ3QOxO74y2yYopV38CXe1Rm2ycLhKduwn9lc30XTmmhy1lZZkbG59IF8VvQhexSg2SY3RRptw9q+H1LXNdfVj7w2OnMuuRTqWLO4Z6Ebq68aQe9QsSqIjVvvdXLRoZ9zPenyGcpf0FdOkbZylzXop1Ibr6sWlMTQXk1RgnCwIJVgOoLf8XGp2vdgDPpyvWBvrEM3G5GF2tzx9vNu/00U8XmwpThTud2GtdNPP4N5uu8e7MZHv6VQKoxbGo/hy6iJUTdLHam5zwZiTk5CQocDIBbcqllCWAitORQOKYpYWxSPjZK7G/9jRVImLOaJVVVllllVUuINeRKVdfD3TOEyH2Ukp371gppRDx+a/oudmmxcItvw9FkabbX8FGqYCLvaywVCZSP6OyuXtsLiZPxX26ja7fgyLGRVbifOm3uR6V7QWJGjG/9PaynZhxkVe4tBx/v+VV0byzPBTp9sRzK2EiZL2YhCW2l0w7qqfmi8rjDOoY3431Nin3QsT8xDkcjz3dOJvqhcc9eLqJosjyQmqs3KRpmt4XxcOlrO4+3dxos7y9ZUhSZmLH32TmF2obiJOJhODP9r7ku+1557uuok1qHRpbIL+8vvz4PYDv/v33v/zpW/6+M3+VmR7PrbEa+K96+9hh+0ajWLRN78fJ+/T68eWn52d8/2P78rLRDvsewd7m8M8fJuhql3+q5L3aL/rmj3/92/NzZ/bPP/3v0/II5XDJA47Kt2yGcwqv+N1U3rZ/x1jyFobPuRDSyr+V2Y4T0XWUHopLDLOHNI1OiJBvovSu8Ax0n4M5dPWH/kTCz6FnJ3L/UC/34wf4LkSdZ6ga5PH00zdDFnvGi/aklDITluTq1P7xUNl/Smtyhvom1M19geYUtD3eSKoTTl96h9nl89dzXuR5PW/svJSU++QN38IbbdJD8UZh9dPdzMiAifpMkuQ++QL/R8d5AZ5+TH95CBXs8oUUZZfIFV0+MbdN07uimLTBx6JILxWLhHwnMsuHS9lNzdZU6SqrrLLKKqv8puX/EHWEkP7TC5MAAAAASUVORK5CYII=",oc={code:"editor-code",heading:{h1:"editor-heading-h1",h2:"editor-heading-h2",h3:"editor-heading-h3",h4:"editor-heading-h4",h5:"editor-heading-h5"},image:"editor-image",link:"editor-link",list:{listitem:"editor-listitem",nested:{listitem:"editor-nested-listitem"},ol:"editor-list-ol",ul:"editor-list-ul"},ltr:"ltr",paragraph:"editor-paragraph",placeholder:"editor-placeholder",quote:"editor-quote",rtl:"rtl",text:{bold:"editor-text-bold",code:"editor-text-code",hashtag:"editor-text-hashtag",italic:"editor-text-italic",overflowed:"editor-text-overflowed",strikethrough:"editor-text-strikethrough",underline:"editor-text-underline",underlineStrikethrough:"editor-text-underlineStrikethrough"}},oi=1;function bs(){return I.jsx("div",{className:"divider"})}function sc(){const[n]=et(),e=F.useRef(null),[t,r]=F.useState(!1),[i,o]=F.useState(!1),[s,l]=F.useState(!1),[a,c]=F.useState(!1),[u,f]=F.useState(!1),[d,h]=F.useState(!1),g=F.useCallback(()=>{const _=L();P(_)&&(l(_.hasFormat("bold")),c(_.hasFormat("italic")),f(_.hasFormat("underline")),h(_.hasFormat("strikethrough")))},[]);return F.useEffect(()=>_t(n.registerUpdateListener(({editorState:_})=>{_.read(()=>{g()})}),n.registerCommand(nn,(_,m)=>(g(),!1),oi),n.registerCommand(Pt,_=>(r(_),!1),oi),n.registerCommand(Nt,_=>(o(_),!1),oi)),[n,g]),I.jsxs("div",{className:"toolbar",ref:e,children:[I.jsx("button",{disabled:!t,onClick:()=>{n.dispatchCommand(on,void 0)},className:"toolbar-item spaced","aria-label":"Undo",children:I.jsx("i",{className:"format undo"})}),I.jsx("button",{disabled:!i,onClick:()=>{n.dispatchCommand(sn,void 0)},className:"toolbar-item","aria-label":"Redo",children:I.jsx("i",{className:"format redo"})}),I.jsx(bs,{}),I.jsx("button",{onClick:()=>{n.dispatchCommand(ge,"bold")},className:"toolbar-item spaced "+(s?"active":""),"aria-label":"Format Bold",children:I.jsx("i",{className:"format bold"})}),I.jsx("button",{onClick:()=>{n.dispatchCommand(ge,"italic")},className:"toolbar-item spaced "+(a?"active":""),"aria-label":"Format Italics",children:I.jsx("i",{className:"format italic"})}),I.jsx("button",{onClick:()=>{n.dispatchCommand(ge,"underline")},className:"toolbar-item spaced "+(u?"active":""),"aria-label":"Format Underline",children:I.jsx("i",{className:"format underline"})}),I.jsx("button",{onClick:()=>{n.dispatchCommand(ge,"strikethrough")},className:"toolbar-item spaced "+(d?"active":""),"aria-label":"Format Strikethrough",children:I.jsx("i",{className:"format strikethrough"})}),I.jsx(bs,{}),I.jsx("button",{onClick:()=>{n.dispatchCommand(Et,"left")},className:"toolbar-item spaced","aria-label":"Left Align",children:I.jsx("i",{className:"format left-align"})}),I.jsx("button",{onClick:()=>{n.dispatchCommand(Et,"center")},className:"toolbar-item spaced","aria-label":"Center Align",children:I.jsx("i",{className:"format center-align"})}),I.jsx("button",{onClick:()=>{n.dispatchCommand(Et,"right")},className:"toolbar-item spaced","aria-label":"Right Align",children:I.jsx("i",{className:"format right-align"})}),I.jsx("button",{onClick:()=>{n.dispatchCommand(Et,"justify")},className:"toolbar-item","aria-label":"Justify Align",children:I.jsx("i",{className:"format justify-align"})})," "]})}function lc(){return I.jsx("div",{className:"editor-placeholder",children:"Enter some rich text..."})}const ac={namespace:"React.js Demo",nodes:[],onError(n){throw n},theme:oc};function cc(){return I.jsx(na,{initialConfig:ac,children:I.jsxs("div",{className:"editor-container",children:[I.jsx("img",{className:"SpInverselogo",src:ic,width:200,height:70}),I.jsx(sc,{}),I.jsxs("div",{className:"editor-inner",children:[I.jsx(ec,{contentEditable:I.jsx(xa,{className:"editor-input"}),placeholder:I.jsx(lc,{}),ErrorBoundary:rc}),I.jsx(Aa,{}),I.jsx(ra,{})]})]})})}Fe.Editor=cc,Object.defineProperty(Fe,Symbol.toStringTag,{value:"Module"})});
|
|
41
|
+
`?a.insertParagraph():c===" "?a.insertNodes([Ht()]):a.insertText(c)}}}else e.insertRawText(i)}function xs(n,e,t){n.dispatchCommand(qs,{nodes:e,selection:t})||t.insertNodes(e)}function bs(n,e,t,r=[]){let o=e===null||t.isSelected(e);const i=b(t)&&t.excludeFromCopy("html");let s=t;if(e!==null){let c=Ir(t);c=R(c)&&e!==null?ss(e,c):c,s=c}const l=b(s)?s.getChildren():[],a=function(c){const u=c.exportJSON(),h=c.constructor;if(u.type!==h.getType()&&Jn(58,h.name),b(c)){const d=u.children;Array.isArray(d)||Jn(59,h.name)}return u}(s);if(R(s)){const c=s.__text;c.length>0?a.text=c:o=!1}for(let c=0;c<l.length;c++){const u=l[c],h=bs(n,e,u,a.children);!o&&b(t)&&h&&t.extractWithChild(u,e,"clone")&&(o=!0)}if(o&&!i)r.push(a);else if(Array.isArray(a.children))for(let c=0;c<a.children.length;c++){const u=a.children[c];r.push(u)}return o}function Xa(n,e){const t=[],r=G().getChildren();for(let o=0;o<r.length;o++)bs(n,e,r[o],t);return{namespace:n._config.namespace,nodes:t}}function Qa(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t],o=ta(r);R(o)&&xa(o),e.push(o)}return e}let vt=null;async function Cs(n,e,t){if(vt!==null)return!1;if(e!==null)return new Promise((a,c)=>{n.update(()=>{a(ws(n,e,t))})});const r=n.getRootElement(),o=n._window==null?window.document:n._window.document,i=ys(n._window);if(r===null||i===null)return!1;const s=o.createElement("span");s.style.cssText="position: fixed; top: -1000px;",s.append(o.createTextNode("#")),r.append(s);const l=new Range;return l.setStart(s,0),l.setEnd(s,1),i.removeAllRanges(),i.addRange(l),new Promise((a,c)=>{const u=n.registerCommand(fn,h=>(nt(h,ClipboardEvent)&&(u(),vt!==null&&(window.clearTimeout(vt),vt=null),a(ws(n,h,t))),!0),oa);vt=window.setTimeout(()=>{u(),vt=null,a(!1)},50),o.execCommand("copy"),s.remove()})}function ws(n,e,t){if(t===void 0){const o=ys(n._window);if(!o)return!1;const i=o.anchorNode,s=o.focusNode;if(i!==null&&s!==null&&!Ft(n,i,s))return!1;const l=L();if(l===null)return!1;t=ec(l)}e.preventDefault();const r=e.clipboardData;return r!==null&&(tc(r,t),!0)}const Za=[["text/html",Ha],["application/x-lexical-editor",Ga]];function ec(n=L()){const e={"text/plain":n?n.getTextContent():""};if(n){const t=Ml();for(const[r,o]of Za){const i=o(t,n);i!==null&&(e[r]=i)}}return e}function tc(n,e){for(const t in e){const r=e[t];r!==void 0&&n.setData(t,r)}}function Ss(n,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(n,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(n,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const xt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,nc=xt&&"documentMode"in document?document.documentMode:null,rc=!(!xt||!("InputEvent"in window)||nc)&&"getTargetRanges"in new window.InputEvent("input"),oc=xt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ic=xt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,sc=xt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),lc=xt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!sc,Es=Ys();function Yn(n){let e=null;if(nt(n,DragEvent)?e=n.dataTransfer:nt(n,ClipboardEvent)&&(e=n.clipboardData),e===null)return[!1,[],!1];const t=e.types,r=t.includes("Files"),o=t.includes("text/html")||t.includes("text/plain");return[r,Array.from(e.files),o]}function Ts(n){const e=L();if(!O(e))return!1;const t=new Set,r=e.getNodes();for(let o=0;o<r.length;o++){const i=r[o],s=i.getKey();if(t.has(s))continue;const l=so(i,c=>b(c)&&!c.isInline());if(l===null)continue;const a=l.getKey();l.canIndent()&&!t.has(a)&&(t.add(a),n(l))}return t.size>0}function qn(n){const e=Xe(n);return U(e)}function ac(n){return yt(n.registerCommand(wo,e=>{const t=L();return!!xe(t)&&(t.clear(),!0)},0),n.registerCommand(qe,e=>{const t=L();return!!O(t)&&(t.deleteCharacter(e),!0)},K),n.registerCommand(Nt,e=>{const t=L();return!!O(t)&&(t.deleteWord(e),!0)},K),n.registerCommand(Pt,e=>{const t=L();return!!O(t)&&(t.deleteLine(e),!0)},K),n.registerCommand(lt,e=>{const t=L();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const r=e.dataTransfer;if(r!=null)vs(r,t,n);else if(O(t)){const o=e.data;return o&&t.insertText(o),!0}}return!0},K),n.registerCommand(or,()=>{const e=L();return!!O(e)&&(e.removeText(),!0)},K),n.registerCommand(ge,e=>{const t=L();return!!O(t)&&(t.formatText(e),!0)},K),n.registerCommand(Ot,e=>{const t=L();if(!O(t)&&!xe(t))return!1;const r=t.getNodes();for(const o of r){const i=so(o,s=>b(s)&&!s.isInline());i!==null&&i.setFormat(e)}return!0},K),n.registerCommand(st,e=>{const t=L();return!!O(t)&&(t.insertLineBreak(e),!0)},K),n.registerCommand(an,()=>{const e=L();return!!O(e)&&(e.insertParagraph(),!0)},K),n.registerCommand(el,()=>(Ql([Ht()]),!0),K),n.registerCommand(tl,()=>Ts(e=>{const t=e.getIndent();e.setIndent(t+1)}),K),n.registerCommand(Do,()=>Ts(e=>{const t=e.getIndent();t>0&&e.setIndent(t-1)}),K),n.registerCommand(To,e=>{const t=L();if(xe(t)&&!qn(e.target)){const r=t.getNodes();if(r.length>0)return r[0].selectPrevious(),!0}else if(O(t)){const r=Bt(t.focus,!0);if(!e.shiftKey&&U(r)&&!r.isIsolated()&&!r.isInline())return r.selectPrevious(),e.preventDefault(),!0}return!1},K),n.registerCommand(ko,e=>{const t=L();if(xe(t)){const r=t.getNodes();if(r.length>0)return r[0].selectNext(0,0),!0}else if(O(t)){if(function(o){const i=o.focus;return i.key==="root"&&i.offset===G().getChildrenSize()}(t))return e.preventDefault(),!0;const r=Bt(t.focus,!1);if(!e.shiftKey&&U(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),e.preventDefault(),!0}return!1},K),n.registerCommand(Eo,e=>{const t=L();if(xe(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectPrevious(),!0}if(!O(t))return!1;if(as(t,!0)){const r=e.shiftKey;return e.preventDefault(),cs(t,r,!0),!0}return!1},K),n.registerCommand(So,e=>{const t=L();if(xe(t)&&!qn(e.target)){const o=t.getNodes();if(o.length>0)return e.preventDefault(),o[0].selectNext(0,0),!0}if(!O(t))return!1;const r=e.shiftKey;return!!as(t,!1)&&(e.preventDefault(),cs(t,r,!1),!0)},K),n.registerCommand(No,e=>{if(qn(e.target))return!1;const t=L();if(!O(t))return!1;e.preventDefault();const{anchor:r}=t,o=r.getNode();return t.isCollapsed()&&r.offset===0&&!ie(o)&&Ta(o).getIndent()>0?n.dispatchCommand(Do,void 0):n.dispatchCommand(qe,!0)},K),n.registerCommand(Oo,e=>{if(qn(e.target))return!1;const t=L();return!!O(t)&&(e.preventDefault(),n.dispatchCommand(qe,!1))},K),n.registerCommand(dn,e=>{const t=L();if(!O(t))return!1;if(e!==null){if((ic||oc||lc)&&rc)return!1;if(e.preventDefault(),e.shiftKey)return n.dispatchCommand(st,!1)}return n.dispatchCommand(an,void 0)},K),n.registerCommand(Po,()=>{const e=L();return!!O(e)&&(n.blur(),!0)},K),n.registerCommand(Ro,e=>{const[,t]=Yn(e);if(t.length>0){const o=Ss(e.clientX,e.clientY);if(o!==null){const{offset:i,node:s}=o,l=Xe(s);if(l!==null){const a=Gl();if(R(l))a.anchor.set(l.getKey(),i,"text"),a.focus.set(l.getKey(),i,"text");else{const u=l.getParentOrThrow().getKey(),h=l.getIndexWithinParent()+1;a.anchor.set(u,h,"element"),a.focus.set(u,h,"element")}const c=Jo(a);Ce(c)}n.dispatchCommand(Es,t)}return e.preventDefault(),!0}const r=L();return!!O(r)},K),n.registerCommand(Io,e=>{const[t]=Yn(e),r=L();return!(t&&!O(r))},K),n.registerCommand(Fo,e=>{const[t]=Yn(e),r=L();if(t&&!O(r))return!1;const o=Ss(e.clientX,e.clientY);if(o!==null){const i=Xe(o.node);U(i)&&e.preventDefault()}return!0},K),n.registerCommand(sr,()=>(Rl(),!0),K),n.registerCommand(fn,e=>(Cs(n,nt(e,ClipboardEvent)?e:null),!0),K),n.registerCommand(ir,e=>(async function(t,r){await Cs(r,nt(t,ClipboardEvent)?t:null),r.update(()=>{const o=L();O(o)?o.removeText():xe(o)&&o.getNodes().forEach(i=>i.remove())})}(e,n),!0),K),n.registerCommand(rr,e=>{const[,t,r]=Yn(e);return t.length>0&&!r?(n.dispatchCommand(Es,t),!0):vr(e.target)?!1:L()!==null&&(function(o,i){o.preventDefault(),i.update(()=>{const s=L(),l=nt(o,InputEvent)||nt(o,KeyboardEvent)?null:o.clipboardData;l!=null&&s!==null&&vs(l,s,i)},{tag:"paste"})}(e,n),!0)},K))}const co=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?F.useLayoutEffect:F.useEffect;function ks(n){return n.getEditorState().read(is(n.isComposing()))}function cc({contentEditable:n,placeholder:e=null,ErrorBoundary:t}){const[r]=tt(),o=function(i,s){const[l,a]=F.useState(()=>i.getDecorators());return co(()=>i.registerDecoratorListener(c=>{sn.flushSync(()=>{a(c)})}),[i]),F.useEffect(()=>{a(i.getDecorators())},[i]),F.useMemo(()=>{const c=[],u=Object.keys(l);for(let h=0;h<u.length;h++){const d=u[h],f=E.jsx(s,{onError:_=>i._onError(_),children:E.jsx(F.Suspense,{fallback:null,children:l[d]})}),g=i.getElementByKey(d);g!==null&&c.push(sn.createPortal(f,g,d))}return c},[s,l,i])}(r,t);return function(i){co(()=>yt(ac(i),Ka(i)),[i])}(r),E.jsxs(E.Fragment,{children:[n,E.jsx(uc,{content:e}),o]})}function uc({content:n}){const[e]=tt(),t=function(o){const[i,s]=F.useState(()=>ks(o));return co(()=>{function l(){const a=ks(o);s(a)}return l(),yt(o.registerUpdateListener(()=>{l()}),o.registerEditableListener(()=>{l()}))},[o]),i}(e),r=$a();return t?typeof n=="function"?n(r):n:null}function uo(n,e){return uo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},uo(n,e)}var Ns={error:null},dc=function(n){var e,t;function r(){for(var i,s=arguments.length,l=new Array(s),a=0;a<s;a++)l[a]=arguments[a];return(i=n.call.apply(n,[this].concat(l))||this).state=Ns,i.resetErrorBoundary=function(){for(var c,u=arguments.length,h=new Array(u),d=0;d<u;d++)h[d]=arguments[d];i.props.onReset==null||(c=i.props).onReset.apply(c,h),i.reset()},i}t=n,(e=r).prototype=Object.create(t.prototype),e.prototype.constructor=e,uo(e,t),r.getDerivedStateFromError=function(i){return{error:i}};var o=r.prototype;return o.reset=function(){this.setState(Ns)},o.componentDidCatch=function(i,s){var l,a;(l=(a=this.props).onError)==null||l.call(a,i,s)},o.componentDidUpdate=function(i,s){var l,a,c,u,h=this.state.error,d=this.props.resetKeys;h!==null&&s.error!==null&&((c=i.resetKeys)===void 0&&(c=[]),(u=d)===void 0&&(u=[]),c.length!==u.length||c.some(function(f,g){return!Object.is(f,u[g])}))&&((l=(a=this.props).onResetKeysChange)==null||l.call(a,i.resetKeys,d),this.reset())},o.render=function(){var i=this.state.error,s=this.props,l=s.fallbackRender,a=s.FallbackComponent,c=s.fallback;if(i!==null){var u={error:i,resetErrorBoundary:this.resetErrorBoundary};if(kt.isValidElement(c))return c;if(typeof l=="function")return l(u);if(a)return kt.createElement(a,u);throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop")}return this.props.children},r}(kt.Component);function fc({children:n,onError:e}){return E.jsx(dc,{fallback:E.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:e,children:n})}var ke=(n=>(n.normal="1px",n.narrow="48px",n.moderate="96px 72px",n.wide="96px 192px",n))(ke||{});const hc=F.createContext({margin:{bottom:"",left:"",right:"",top:""},pageMarginValue:"",updateCustomMargin:(n,e)=>{},updatePageMarginValue:n=>{}}),Hn=()=>F.useContext(hc),Xc="";function gc({onClose:n,children:e,title:t,closeOnClickOutside:r}){const o=F.useRef(null);return F.useEffect(()=>{o.current!==null&&o.current.focus()},[]),F.useEffect(()=>{let i=null;const s=c=>{c.key==="Escape"&&n()},l=c=>{const u=c.target;o.current!==null&&!o.current.contains(u)&&r&&n()},a=o.current;return a!==null&&(i=a.parentElement,i!==null&&i.addEventListener("click",l)),window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s),i!==null&&(i==null||i.removeEventListener("click",l))}},[r,n]),E.jsx("div",{className:"Modal__overlay",role:"dialog",children:E.jsxs("div",{className:"Modal__modal",tabIndex:-1,ref:o,children:[E.jsx("h2",{className:"Modal__title",children:t}),E.jsx("button",{className:"Modal__closeButton","aria-label":"Close modal",type:"button",onClick:n,children:"X"}),E.jsx("div",{className:"Modal__content",children:e})]})})}function pc({onClose:n,children:e,title:t,closeOnClickOutside:r=!1}){return sn.createPortal(E.jsx(gc,{onClose:n,title:t,closeOnClickOutside:r,children:e}),document.body)}function _c(){const[n,e]=F.useState(null),t=F.useCallback(()=>{e(null)},[]),r=F.useMemo(()=>{if(n===null)return null;const{title:i,content:s,closeOnClickOutside:l}=n;return E.jsx(pc,{onClose:t,title:i,closeOnClickOutside:l,children:s})},[n,t]),o=F.useCallback((i,s,l=!1)=>{e({closeOnClickOutside:l,content:s(t),title:i})},[t]);return[r,o]}const Ps=kt.createContext(null),Os=4;function en({children:n,className:e,onClick:t,title:r}){const o=F.useRef(null),i=kt.useContext(Ps);if(i===null)throw new Error("DropDownItem must be used within a DropDown");const{registerItem:s}=i;return F.useEffect(()=>{o&&o.current&&s(o)},[o,s]),E.jsx("button",{className:e,onClick:t,ref:o,title:r,type:"button",children:n})}function mc({children:n,dropDownRef:e,onClose:t}){const[r,o]=F.useState(),[i,s]=F.useState(),l=F.useCallback(u=>{o(h=>h?[...h,u]:[u])},[o]),a=u=>{if(!r)return;const h=u.key;["Escape","ArrowUp","ArrowDown","Tab"].includes(h)&&u.preventDefault(),h==="Escape"||h==="Tab"?t():h==="ArrowUp"?s(d=>{if(!d)return r[0];const f=r.indexOf(d)-1;return r[f===-1?r.length-1:f]}):h==="ArrowDown"&&s(d=>d?r[r.indexOf(d)+1]:r[0])},c=F.useMemo(()=>({registerItem:l}),[l]);return F.useEffect(()=>{r&&!i&&s(r[0]),i&&i.current&&i.current.focus()},[r,i]),E.jsx(Ps.Provider,{value:c,children:E.jsx("div",{className:"dropdown",ref:e,onKeyDown:a,children:n})})}function yc({disabled:n=!1,buttonLabel:e,buttonAriaLabel:t,buttonClassName:r,buttonIconClassName:o,children:i,stopCloseOnClickSelf:s}){const l=F.useRef(null),a=F.useRef(null),[c,u]=F.useState(!1),h=()=>{u(!1),a&&a.current&&a.current.focus()};return F.useEffect(()=>{const d=a.current,f=l.current;if(c&&d!==null&&f!==null){const{top:g,left:_}=d.getBoundingClientRect();f.style.top=`${g+d.offsetHeight+Os}px`,f.style.left=`${Math.min(_,window.innerWidth-f.offsetWidth-20)}px`}},[l,a,c]),F.useEffect(()=>{const d=a.current;if(d!==null&&c){const f=g=>{const _=g.target;s&&l.current&&l.current.contains(_)||d.contains(_)||u(!1)};return document.addEventListener("click",f),()=>{document.removeEventListener("click",f)}}},[l,a,c,s]),F.useEffect(()=>{const d=()=>{if(c){const f=a.current,g=l.current;if(f!==null&&g!==null){const{top:_}=f.getBoundingClientRect(),m=_+f.offsetHeight+Os;m!==g.getBoundingClientRect().top&&(g.style.top=`${m}px`)}}};return document.addEventListener("scroll",d),()=>{document.removeEventListener("scroll",d)}},[a,l,c]),E.jsxs(E.Fragment,{children:[E.jsxs("button",{type:"button",disabled:n,"aria-label":t||e,className:r,onClick:()=>u(!c),ref:a,children:[o&&E.jsx("span",{className:o}),e&&E.jsx("span",{className:"text dropdown-button-text",children:e}),E.jsx("i",{className:"chevron-down"})]}),c&&sn.createPortal(E.jsx(mc,{dropDownRef:l,onClose:h,children:i}),document.body)]})}const Qc="";function vc(...n){return n.filter(Boolean).join(" ")}function xc({"data-test-id":n,children:e,className:t,onClick:r,disabled:o,small:i,title:s}){return E.jsx("button",{disabled:o,className:vc("Button__root",o&&"Button__disabled",i&&"Button__small",t),onClick:r,title:s,"aria-label":s,...n&&{"data-test-id":n},children:e})}const Zc="";function bc({"data-test-id":n,children:e}){return E.jsx("div",{className:"DialogActions","data-test-id":n,children:e})}const eu="";function Gn({label:n,value:e,onChange:t,placeholder:r="","data-test-id":o,type:i="text",name:s=""}){return E.jsxs("div",{className:"Input__wrapper",children:[E.jsx("label",{className:"Input__label",children:n}),E.jsx("input",{type:i,className:"Input__input",placeholder:r,value:e,name:s,onChange:l=>{t(l.target.value,l.target.name)},"data-test-id":o})]})}const Cc=({onClose:n})=>{const{margin:e,updatePageMarginValue:t,updateCustomMargin:r}=Hn(),o=()=>{const{top:i,right:s,bottom:l,left:a}=e,c=`${+i*96}px ${+s*96}px ${+l*96}px ${+a*96}px`;t(c),n()};return E.jsxs(E.Fragment,{children:[E.jsx(Gn,{label:"Top",onChange:r,value:e.top,"data-test-id":"custom-margin-top",type:"number",name:"top"}),E.jsx(Gn,{label:"Right",onChange:r,value:e.right,"data-test-id":"table-modal-right",type:"number",name:"right"}),E.jsx(Gn,{label:"Bottom",onChange:r,value:e.bottom,"data-test-id":"table-modal-bottom",type:"number",name:"bottom"}),E.jsx(Gn,{label:"Left",onChange:r,value:e.left,"data-test-id":"table-modal-left",type:"number",name:"left"}),E.jsx(bc,{"data-test-id":"table-model-confirm-insert",children:E.jsx(xc,{onClick:o,children:"Confirm"})})]})},Xn=n=>n?"active dropdown-item-active":"",wc=({isEditable:n})=>{const{pageMarginValue:e,updatePageMarginValue:t}=Hn(),[r,o]=_c();return E.jsxs(E.Fragment,{children:[E.jsxs(yc,{disabled:!n,buttonClassName:"toolbar-item spaced",buttonLabel:"Page Margin",buttonAriaLabel:"Page margin",buttonIconClassName:" plus",children:[E.jsx(en,{onClick:()=>t(ke.normal),className:"item "+Xn(e===ke.normal),children:E.jsx("span",{className:"text",children:"Normal"})}),E.jsx(en,{onClick:()=>t(ke.narrow),className:"item "+Xn(e===ke.narrow),children:E.jsx("span",{className:"text",children:"Narrow"})}),E.jsx(en,{onClick:()=>t(ke.moderate),className:"item "+Xn(e===ke.moderate),children:E.jsx("span",{className:"text",children:"Moderate"})}),E.jsx(en,{onClick:()=>t(ke.wide),className:"item "+Xn(e===ke.wide),children:E.jsx("span",{className:"text",children:"Wide"})}),E.jsx(en,{onClick:()=>{o("Custom Margin",i=>E.jsx(Cc,{onClose:i}))},className:"item ",children:E.jsx("span",{className:"text",children:"Custom"})})]}),r]})},Sc=(n,e)=>{let t=n;for(;t!==G()&&t!=null;){if(e(t))return t;t=t.getParent()}return null};function Ec(n){const e=n.anchor,t=n.focus,r=n.anchor.getNode(),o=n.focus.getNode();return r===o?r:n.isBackward()?ls(t)?r:o:ls(e)?r:o}const fo=1;function ho(){return E.jsx("div",{className:"divider"})}function Tc(){const[n]=tt(),{updatePageMarginValue:e}=Hn(),t=F.useRef(null),[r,o]=F.useState(!1),[i,s]=F.useState(!1),[l,a]=F.useState(!1),[c,u]=F.useState(!1),[h,d]=F.useState(!1),[f,g]=F.useState(!1),[_,m]=F.useState(()=>n.isEditable());function x(y){}const v=F.useCallback(()=>{const y=L();if(O(y)){const S=Ec(y),w=S.getParent();a(y.hasFormat("bold")),u(y.hasFormat("italic")),d(y.hasFormat("underline")),g(y.hasFormat("strikethrough"));let C;pt(w)&&(C=Sc(S,N=>b(N)&&!N.isInline())),b(C)?C.getFormatType():b(S)?S.getFormatType():w!=null&&w.getFormatType(),e(ke)}},[]);return F.useEffect(()=>yt(n.registerUpdateListener(({editorState:y})=>{y.read(()=>{v()})}),n.registerCommand(ln,(y,S)=>(v(),!1),fo),n.registerCommand(Rt,y=>(o(y),!1),fo),n.registerCommand(Dt,y=>(s(y),!1),fo)),[n,v]),E.jsxs("div",{className:"toolbar",ref:t,children:[E.jsx("button",{disabled:!r,onClick:()=>{n.dispatchCommand(cn,void 0)},className:"toolbar-item spaced","aria-label":"Undo",children:E.jsx("i",{className:"format undo"})}),E.jsx("button",{disabled:!i,onClick:()=>{n.dispatchCommand(un,void 0)},className:"toolbar-item","aria-label":"Redo",children:E.jsx("i",{className:"format redo"})}),E.jsx(ho,{}),E.jsx("button",{onClick:()=>{n.dispatchCommand(ge,"bold")},className:"toolbar-item spaced "+(l?"active":""),"aria-label":"Format Bold",children:E.jsx("i",{className:"format bold"})}),E.jsx("button",{onClick:()=>{n.dispatchCommand(ge,"italic")},className:"toolbar-item spaced "+(c?"active":""),"aria-label":"Format Italics",children:E.jsx("i",{className:"format italic"})}),E.jsx("button",{onClick:()=>{n.dispatchCommand(ge,"underline")},className:"toolbar-item spaced "+(h?"active":""),"aria-label":"Format Underline",children:E.jsx("i",{className:"format underline"})}),E.jsx("button",{onClick:()=>{n.dispatchCommand(ge,"strikethrough")},className:"toolbar-item spaced "+(f?"active":""),"aria-label":"Format Strikethrough",children:E.jsx("i",{className:"format strikethrough"})}),E.jsx(ho,{}),E.jsx("button",{onClick:()=>{n.dispatchCommand(Ot,"left")},className:"toolbar-item spaced","aria-label":"Left Align",children:E.jsx("i",{className:"format left-align"})}),E.jsx("button",{onClick:()=>{n.dispatchCommand(Ot,"center")},className:"toolbar-item spaced","aria-label":"Center Align",children:E.jsx("i",{className:"format center-align"})}),E.jsx("button",{onClick:()=>{n.dispatchCommand(Ot,"right")},className:"toolbar-item spaced","aria-label":"Right Align",children:E.jsx("i",{className:"format right-align"})}),E.jsx("button",{onClick:()=>{n.dispatchCommand(Ot,"justify")},className:"toolbar-item","aria-label":"Justify Align",children:E.jsx("i",{className:"format justify-align"})})," ",E.jsx(ho,{}),E.jsx(wc,{isEditable:_})]})}const kc={};function Nc(n){console.error(n)}function Pc(){return E.jsx("div",{className:"divider-horizontal"})}function Oc(){const{pageMarginValue:n}=Hn(),e={namespace:"MyEditor",theme:kc,onError:Nc};function t(){return E.jsx("div",{className:"editor-placeholder",children:"Enter some rich text..."})}return E.jsxs(ua,{initialConfig:e,children:[E.jsx("div",{className:"editor-container",children:E.jsx(Tc,{})}),E.jsxs("div",{className:"editor-container",children:[E.jsx(Pc,{}),E.jsxs("div",{className:"editor-inner",children:[E.jsx(cc,{contentEditable:E.jsx(Pa,{style:{margin:`${n}`},className:"editor-input"}),placeholder:E.jsx(t,{}),ErrorBoundary:fc}),E.jsx(Ba,{}),E.jsx(da,{})]})]})]})}Ae.Editor=Oc,Object.defineProperty(Ae,Symbol.toStringTag,{value:"Module"})});
|
|
42
42
|
//# sourceMappingURL=index.umd.js.map
|