@layers-app/editor 0.5.8-optimization → 0.5.10-optimization
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 +0 -19
- package/dist/ExcalidrawComponent-D7Z_2awF.cjs +1 -0
- package/dist/ExcalidrawComponent-Re4zFgLg.js +283 -0
- package/dist/InlineImageComponent-DHgCaPNk.cjs +1 -0
- package/dist/InlineImageComponent-kXhZcmF6.js +265 -0
- package/dist/collaboration-C7xVk0Zj.cjs +4 -0
- package/dist/collaboration-Cn7KizEJ.js +5997 -0
- package/dist/excalidraw-C-6bid_P.js +16497 -0
- package/dist/excalidraw-DpwKTNBz.cjs +574 -0
- package/dist/index-B4yOqKUQ.cjs +1 -0
- package/dist/index-BZu8Qnrg.cjs +1 -0
- package/dist/index-CFA9Drk2.cjs +16 -0
- package/dist/index-CX5msaMB.js +296 -0
- package/dist/index-CbQX0N2c.js +136 -0
- package/dist/index-DEC5JR_F.js +60 -0
- package/dist/index-Dan3tqoj.cjs +1 -0
- package/dist/index-WCOc4LNL.js +16600 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +12 -13
- package/dist/lexical-2rxs76dr.cjs +41 -0
- package/dist/lexical-C60GkwxR.js +13122 -0
- package/dist/lexical-code-DKIWiZdJ.js +604 -0
- package/dist/lexical-code-VafvPacU.cjs +9 -0
- package/dist/lexical-collab-1tX9tFVC.js +1025 -0
- package/dist/lexical-collab-Nk2LVpJv.cjs +1 -0
- package/dist/lexical-file-C52Mze5k.cjs +1 -0
- package/dist/lexical-file-DjHP4vVw.js +43 -0
- package/dist/lexical-markdown-BSl_ahWw.cjs +12 -0
- package/dist/lexical-markdown-DcEwQQba.js +488 -0
- package/dist/lodash-3PEMjFQT.cjs +1 -0
- package/dist/lodash-jftOdrxX.js +711 -0
- package/dist/stats.html +4949 -0
- package/dist/vendor-BrXDSyZX.js +136433 -0
- package/dist/vendor-Bt6Lma3y.cjs +2469 -0
- package/package.json +42 -74
- package/dist/layers.8yssqxrI.js +0 -6774
- package/dist/layers.B8z-e4Vg.js +0 -7
- package/dist/layers.BQLznd92.js +0 -4
- package/dist/layers.BVRvG1mv.js +0 -3
- package/dist/layers.BjCQNcdJ.js +0 -341
- package/dist/layers.BnVn2uMi.js +0 -7723
- package/dist/layers.CLcioDq5.js +0 -2511
- package/dist/layers.CTSBFg3j.js +0 -1
- package/dist/layers.CoCZDINv.js +0 -864
- package/dist/layers.D0ZtUpST.js +0 -2
- package/dist/layers.D2zjLyjP.js +0 -6
- package/dist/layers.DNCgFYS7.js +0 -27
- package/dist/layers.Dt_Jdn4Y.js +0 -2227
- package/dist/layers.DwX5sVtx.js +0 -1
- package/dist/layers.QjAkD17S.js +0 -3677
- package/dist/layers.pre7B8K-.js +0 -530
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";var hf=Object.defineProperty;var gf=(n,t,e)=>t in n?hf(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var b=(n,t,e)=>gf(n,typeof t!="symbol"?t+"":t,e);const L=require("react"),X=require("react/jsx-runtime"),pf=require("lodash-es"),_f=require("./vendor-Bt6Lma3y.cjs"),Tl=require("react-dom"),Mc=require("./lexical-markdown-BSl_ahWw.cjs");function mf(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:()=>n[e]})}}return t.default=n,Object.freeze(t)}const yf=mf(L);function A(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Lc(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);e.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const st=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Cf=st&&"documentMode"in document?document.documentMode:null,nt=st&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),sn=st&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),mo=!(!st||!("InputEvent"in window)||Cf)&&"getTargetRanges"in new window.InputEvent("input"),xr=st&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Wn=st&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Sf=st&&/Android/.test(navigator.userAgent),Ac=st&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Nl=st&&Sf&&Ac,br=st&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&nt&&!Ac;function $c(...n){const t=[];for(const e of n)if(e&&typeof e=="string")for(const[r]of e.matchAll(/\S+/g))t.push(r);return t}const xf=0,bf=1,wf=2,Rc=128,vf=1,Tf=2,Nf=3,Ef=4,kf=5,Of=6,Po=xr||Wn||br?" ":"",Jt=`
|
|
2
|
+
|
|
3
|
+
`,Mf=sn?" ":Po,Dc="֑-߿יִ-﷽ﹰ-ﻼ",Fc="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",Lf=new RegExp("^[^"+Fc+"]*["+Dc+"]"),Af=new RegExp("^[^"+Dc+"]*["+Fc+"]"),Lt={bold:1,capitalize:1024,code:16,highlight:Rc,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},$f={directionless:1,unmergeable:2},El={center:2,end:6,justify:4,left:1,right:3,start:5},Rf={[Tf]:"center",[Of]:"end",[Ef]:"justify",[vf]:"left",[Nf]:"right",[kf]:"start"},Df={normal:0,segmented:2,token:1},Ff={[xf]:"normal",[wf]:"segmented",[bf]:"token"},kl="$config";function Pc(n,t,e,r,o,s){let i=n.getFirstChild();for(;i!==null;){const l=i.__key;i.__parent===t&&(N(i)&&Pc(i,l,e,r,o,s),e.has(l)||s.delete(l),o.push(l)),i=i.getNextSibling()}}let As=!1,yi=0;function Pf(n){yi=n.timeStamp}function cs(n,t,e){const r=n.nodeName==="BR",o=t.__lexicalLineBreak;return o&&(n===o||r&&n.previousSibling===o)||r&&es(n,e)!==void 0}function If(n,t,e){const r=et(Qe(e));let o=null,s=null;r!==null&&r.anchorNode===n&&(o=r.anchorOffset,s=r.focusOffset);const i=n.nodeValue;i!==null&&Pi(t,i,o,s,!1)}function Kf(n,t,e){if(O(n)){const r=n.anchor.getNode();if(r.is(e)&&n.format!==r.getFormat())return!1}return Pt(t)&&e.isAttached()}function Bf(n,t,e,r){for(let o=n;o&&!Oh(o);o=zr(o)){const s=es(o,t);if(s!==void 0){const i=Y(s,e);if(i)return q(i)||!se(o)?void 0:[o,i]}else if(o===r)return[r,$u(e)]}}function Ic(n,t,e){As=!0;const r=performance.now()-yi>100;try{Je(n,()=>{const o=M()||(function(d){return d.getEditorState().read(()=>{const g=M();return g!==null?g.clone():null})})(n),s=new Map,i=n.getRootElement(),l=n._editorState,a=n._blockCursorElement;let c=!1,u="";for(let d=0;d<t.length;d++){const g=t[d],h=g.type,p=g.target,_=Bf(p,n,l,i);if(!_)continue;const[y,m]=_;if(h==="characterData")r&&$(m)&&Pt(p)&&Kf(o,p,m)&&If(p,m,n);else if(h==="childList"){c=!0;const C=g.addedNodes;for(let x=0;x<C.length;x++){const v=C[x],E=Lu(v),T=v.parentNode;if(T!=null&&v!==a&&E===null&&!cs(v,T,n)){if(sn){const k=(se(v)?v.innerText:null)||v.nodeValue;k&&(u+=k)}T.removeChild(v)}}const S=g.removedNodes,w=S.length;if(w>0){let x=0;for(let v=0;v<w;v++){const E=S[v];(cs(E,p,n)||a===E)&&(p.appendChild(E),x++)}w!==x&&s.set(y,m)}}}if(s.size>0)for(const[d,g]of s)g.reconcileObservedMutation(d,n);const f=e.takeRecords();if(f.length>0){for(let d=0;d<f.length;d++){const g=f[d],h=g.addedNodes,p=g.target;for(let _=0;_<h.length;_++){const y=h[_],m=y.parentNode;m==null||y.nodeName!=="BR"||cs(y,p,n)||m.removeChild(y)}}e.takeRecords()}o!==null&&(c&&ne(o),sn&&Iu(n)&&o.insertRawText(u))})}finally{As=!1}}function Kc(n){const t=n._observer;t!==null&&Ic(n,t.takeRecords(),t)}function Bc(n){(function(t){yi===0&&Qe(t).addEventListener("textInput",Pf,!0)})(n),n._observer=new MutationObserver((t,e)=>{Ic(n,t,e)})}let Wf=class{constructor(t,e){b(this,"key");b(this,"parse");b(this,"unparse");b(this,"isEqual");b(this,"defaultValue");this.key=t,this.parse=e.parse.bind(e),this.unparse=(e.unparse||jf).bind(e),this.isEqual=(e.isEqual||Object.is).bind(e),this.defaultValue=this.parse(void 0)}};function zf(n,t){return new Wf(n,t)}function Wc(n,t,e="latest"){const r=(e==="latest"?n.getLatest():n).__state;return r?r.getValue(t):t.defaultValue}function Uf(n,t,e){let r;if(ve(),typeof e=="function"){const s=n.getLatest(),i=Wc(s,t);if(r=e(i),t.isEqual(i,r))return s}else r=e;const o=n.getWritable();return Ci(o).updateFromKnown(t,r),o}function $s(n){const t=new Map,e=new Set;for(let r=typeof n=="function"?n:n.replace;r.prototype&&r.prototype.getType!==void 0;r=Object.getPrototypeOf(r)){const{ownNodeConfig:o}=ns(r);if(o&&o.stateConfigs)for(const s of o.stateConfigs){let i;"stateConfig"in s?(i=s.stateConfig,s.flat&&e.add(i.key)):i=s,t.set(i.key,i)}}return{flatKeys:e,sharedConfigMap:t}}let Hf=class zc{constructor(t,e,r=void 0,o=new Map,s=void 0){b(this,"node");b(this,"knownState");b(this,"unknownState");b(this,"sharedNodeState");b(this,"size");this.node=t,this.sharedNodeState=e,this.unknownState=r,this.knownState=o;const{sharedConfigMap:i}=this.sharedNodeState,l=s!==void 0?s:(function(a,c,u){let f=u.size;if(c)for(const d in c){const g=a.get(d);g&&u.has(g)||f++}return f})(i,r,o);this.size=l}getValue(t){const e=this.knownState.get(t);if(e!==void 0)return e;this.sharedNodeState.sharedConfigMap.set(t.key,t);let r=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){const o=this.unknownState[t.key];o!==void 0&&(r=t.parse(o)),this.updateFromKnown(t,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const t={...this.unknownState},e={};for(const[r,o]of this.knownState)r.isEqual(o,r.defaultValue)?delete t[r.key]:t[r.key]=r.unparse(o);for(const r of this.sharedNodeState.flatKeys)r in t&&(e[r]=t[r],delete t[r]);return Ol(t)&&(e.$=t),e}getWritable(t){if(this.node===t)return this;const{sharedNodeState:e,unknownState:r}=this,o=new Map(this.knownState);return new zc(t,e,(function(s,i,l){let a;if(l)for(const[c,u]of Object.entries(l)){const f=s.get(c);f?i.has(f)||i.set(f,f.parse(u)):(a=a||{},a[c]=u)}return a})(e.sharedConfigMap,o,r),o,this.size)}updateFromKnown(t,e){const r=t.key;this.sharedNodeState.sharedConfigMap.set(r,t);const{knownState:o,unknownState:s}=this;o.has(t)||s&&r in s||(s&&(delete s[r],this.unknownState=Ol(s)),this.size++),o.set(t,e)}updateFromUnknown(t,e){const r=this.sharedNodeState.sharedConfigMap.get(t);r?this.updateFromKnown(r,r.parse(e)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=e)}updateFromJSON(t){const{knownState:e}=this;for(const r of e.keys())e.set(r,r.defaultValue);if(this.size=e.size,this.unknownState=void 0,t)for(const[r,o]of Object.entries(t))this.updateFromUnknown(r,o)}};function Ci(n){const t=n.getWritable(),e=t.__state?t.__state.getWritable(t):new Hf(t,Uc(t));return t.__state=e,e}function Uc(n){return n.__state?n.__state.sharedNodeState:Eu(wn(),n.getType()).sharedNodeState}function Ol(n){if(n)for(const t in n)return n}function jf(n){return n}function Ml(n,t,e){for(const[r,o]of t.knownState){if(n.has(r.key))continue;n.add(r.key);const s=e?e.getValue(r):r.defaultValue;if(s!==o&&!r.isEqual(s,o))return!0}return!1}function Ll(n,t,e){const{unknownState:r}=t,o=e?e.unknownState:void 0;if(r){for(const[s,i]of Object.entries(r))if(!n.has(s)&&(n.add(s),i!==(o?o[s]:void 0)))return!0}return!1}function Al(n,t){const e=n.__state;return e&&e.node===n?e.getWritable(t):e}function $l(n,t){const e=n.__mode,r=n.__format,o=n.__style,s=t.__mode,i=t.__format,l=t.__style,a=n.__state,c=t.__state;return(e===null||e===s)&&(r===null||r===i)&&(o===null||o===l)&&(n.__state===null||a===c||(function(u,f){if(u===f)return!0;if(u&&f&&u.size!==f.size)return!1;const d=new Set;return!(u&&Ml(d,u,f)||f&&Ml(d,f,u)||u&&Ll(d,u,f)||f&&Ll(d,f,u))})(a,c))}function Rl(n,t){const e=n.mergeWithSibling(t),r=ue()._normalizedNodes;return r.add(n.__key),r.add(t.__key),e}function Dl(n){let t,e,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&$(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if($l(t,r)){r=Rl(t,r);break}break}t.remove()}for(;(e=r.getNextSibling())!==null&&$(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if($l(r,e)){r=Rl(r,e);break}break}e.remove()}}else r.remove()}function Vt(n){return Fl(n.anchor),Fl(n.focus),n}function Fl(n){for(;n.type==="element";){const t=n.getNode(),e=n.offset;let r,o;if(e===t.getChildrenSize()?(r=t.getChildAtIndex(e-1),o=!0):(r=t.getChildAtIndex(e),o=!1),$(r)){n.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!N(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}let ln,Oe,wr,Io,Rs,Ds,an,rt,Fs,vr,Se="",at=null,ct="",Nt="",Ln=!1,yo=!1;function Co(n,t){const e=an.get(n);if(t!==null){const r=Bs(n);r.parentNode===t&&t.removeChild(r)}if(rt.has(n)||Oe._keyToDOMMap.delete(n),N(e)){const r=xo(e,an);Ps(r,0,r.length-1,null)}e!==void 0&&Ii(vr,wr,Io,e,"destroyed")}function Ps(n,t,e,r){let o=t;for(;o<=e;++o){const s=n[o];s!==void 0&&Co(s,r)}}function Zt(n,t){n.setProperty("text-align",t)}const Jf="40px";function Hc(n,t){const e=ln.theme.indent;if(typeof e=="string"){const o=n.classList.contains(e);t>0&&!o?n.classList.add(e):t<1&&o&&n.classList.remove(e)}const r=getComputedStyle(n).getPropertyValue("--lexical-indent-base-value")||Jf;n.style.setProperty("padding-inline-start",t===0?"":`calc(${t} * ${r})`)}function jc(n,t){const e=n.style;t===0?Zt(e,""):t===1?Zt(e,"left"):t===2?Zt(e,"center"):t===3?Zt(e,"right"):t===4?Zt(e,"justify"):t===5?Zt(e,"start"):t===6&&Zt(e,"end")}function Is(n,t){const e=(function(r){const o=r.__dir;if(o!==null)return o;if(pe(r))return null;const s=r.getParentOrThrow();return pe(s)&&s.__dir===null?"auto":null})(t);e!==null?n.dir=e:n.removeAttribute("dir")}function So(n,t){const e=rt.get(n);e===void 0&&A(60);const r=e.createDOM(ln,Oe);if((function(o,s,i){const l=i._keyToDOMMap;(function(a,c,u){const f=`__lexicalKey_${c._key}`;a[f]=u})(s,i,o),l.set(o,s)})(n,r,Oe),$(e)?r.setAttribute("data-lexical-text","true"):q(e)&&r.setAttribute("data-lexical-decorator","true"),N(e)){const o=e.__indent,s=e.__size;if(Is(r,e),o!==0&&Hc(r,o),s!==0){const l=s-1;Ks(xo(e,rt),e,0,l,e.getDOMSlot(r))}const i=e.__format;i!==0&&jc(r,i),e.isInline()||Jc(null,e,r),ts(e)&&(Se+=Jt,Nt+=Jt)}else{const o=e.getTextContent();if(q(e)){const s=e.decorate(Oe,ln);s!==null&&Vc(n,s),r.contentEditable="false"}Se+=o,Nt+=o}return t!==null&&t.insertChild(r),Ii(vr,wr,Io,e,"created"),r}function Ks(n,t,e,r,o){const s=Se;Se="";let i=e;for(;i<=r;++i){So(n[i],o);const l=rt.get(n[i]);l!==null&&$(l)&&(at===null&&(at=l.getFormat()),ct===""&&(ct=l.getStyle()))}ts(t)&&(Se+=Jt),o.element.__lexicalTextContent=Se,Se=s+Se}function Pl(n,t){if(n){const e=n.__last;if(e){const r=t.get(e);if(r)return _t(r)?"line-break":q(r)&&r.isInline()?"decorator":null}return"empty"}return null}function Jc(n,t,e){const r=Pl(n,an),o=Pl(t,rt);r!==o&&t.getDOMSlot(e).setManagedLineBreak(o)}function Vf(n,t,e){var r;at=null,ct="",(function(o,s,i){const l=Se,a=o.__size,c=s.__size;Se="";const u=i.element;if(a===1&&c===1){const f=o.__first,d=s.__first;if(f===d)lr(f,u);else{const h=Bs(f),p=So(d,null);try{u.replaceChild(p,h)}catch(_){if(typeof _=="object"&&_!=null){const y=`${_.toString()} Parent: ${u.tagName}, new child: {tag: ${p.tagName} key: ${d}}, old child: {tag: ${h.tagName}, key: ${f}}.`;throw new Error(y)}throw _}Co(f,null)}const g=rt.get(d);$(g)&&(at===null&&(at=g.getFormat()),ct===""&&(ct=g.getStyle()))}else{const f=xo(o,an),d=xo(s,rt);if(f.length!==a&&A(227),d.length!==c&&A(228),a===0)c!==0&&Ks(d,s,0,c-1,i);else if(c===0){if(a!==0){const g=i.after==null&&i.before==null&&i.element.__lexicalLineBreak==null;Ps(f,0,a-1,g?null:u),g&&(u.textContent="")}}else(function(g,h,p,_,y,m){const C=_-1,S=y-1;let w,x,v=m.getFirstChild(),E=0,T=0;for(;E<=C&&T<=S;){const P=h[E],R=p[T];if(P===R)v=us(lr(R,m.element)),E++,T++;else{w===void 0&&(w=new Set(h)),x===void 0&&(x=new Set(p));const U=x.has(P),H=w.has(R);if(U)if(H){const G=fn(Oe,R);G===v?v=us(lr(R,m.element)):(m.withBefore(v).insertChild(G),lr(R,m.element)),E++,T++}else So(R,m.withBefore(v)),T++;else v=us(Bs(P)),Co(P,m.element),E++}const I=rt.get(R);I!==null&&$(I)&&(at===null&&(at=I.getFormat()),ct===""&&(ct=I.getStyle()))}const k=E>C,D=T>S;if(k&&!D){const P=p[S+1],R=P===void 0?null:Oe.getElementByKey(P);Ks(p,g,T,S,m.withBefore(R))}else D&&!k&&Ps(h,E,C,m.element)})(s,f,d,a,c,i)}ts(s)&&(Se+=Jt),u.__lexicalTextContent=Se,Se=l+Se})(n,t,t.getDOMSlot(e)),r=t,at==null||at===r.__textFormat||yo||r.setTextFormat(at),(function(o){ct===""||ct===o.__textStyle||yo||o.setTextStyle(ct)})(t)}function xo(n,t){const e=[];let r=n.__first;for(;r!==null;){const o=t.get(r);o===void 0&&A(101),e.push(r),r=o.__next}return e}function lr(n,t){const e=an.get(n);let r=rt.get(n);e!==void 0&&r!==void 0||A(61);const o=Ln||Ds.has(n)||Rs.has(n),s=fn(Oe,n);if(e===r&&!o){if(N(e)){const i=s.__lexicalTextContent;i!==void 0&&(Se+=i,Nt+=i)}else{const i=e.getTextContent();Nt+=i,Se+=i}return s}if(e!==r&&o&&Ii(vr,wr,Io,r,"updated"),r.updateDOM(e,s,ln)){const i=So(n,null);return t===null&&A(62),t.replaceChild(i,s),Co(n,null),i}if(N(e)&&N(r)){const i=r.__indent;(Ln||i!==e.__indent)&&Hc(s,i);const l=r.__format;if((Ln||l!==e.__format)&&jc(s,l),o&&(Vf(e,r,s),pe(r)||r.isInline()||Jc(e,r,s)),ts(r)&&(Se+=Jt,Nt+=Jt),(Ln||r.__dir!==e.__dir)&&(Is(s,r),pe(r)&&!Ln))for(const a of r.getChildren())N(a)&&Is(fn(Oe,a.getKey()),a)}else{const i=r.getTextContent();if(q(r)){const l=r.decorate(Oe,ln);l!==null&&Vc(n,l)}Se+=i,Nt+=i}if(!yo&&pe(r)&&r.__cachedText!==Nt){const i=r.getWritable();i.__cachedText=Nt,r=i}return s}function Vc(n,t){let e=Oe._pendingDecorators;const r=Oe._decorators;if(e===null){if(r[n]===t)return;e=Au(Oe)}e[n]=t}function us(n){let t=n.nextSibling;return t!==null&&t===Oe._blockCursorElement&&(t=t.nextSibling),t}function qf(n,t,e,r,o,s){Se="",Nt="",Ln=r===2,Oe=e,ln=e._config,wr=e._nodes,Io=Oe._listeners.mutation,Rs=o,Ds=s,an=n._nodeMap,rt=t._nodeMap,yo=t._readOnly,Fs=new Map(e._keyToDOMMap);const i=new Map;return vr=i,lr("root",null),Oe=void 0,wr=void 0,Rs=void 0,Ds=void 0,an=void 0,rt=void 0,ln=void 0,Fs=void 0,vr=void 0,i}function Bs(n){const t=Fs.get(n);return t===void 0&&A(75,n),t}function K(n){return{type:n}}const Bt=K("SELECTION_CHANGE_COMMAND"),qc=K("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Ar=K("CLICK_COMMAND"),Mt=K("DELETE_CHARACTER_COMMAND"),tn=K("INSERT_LINE_BREAK_COMMAND"),cn=K("INSERT_PARAGRAPH_COMMAND"),zt=K("CONTROLLED_TEXT_INSERTION_COMMAND"),$r=K("PASTE_COMMAND"),Ws=K("REMOVE_TEXT_COMMAND"),zn=K("DELETE_WORD_COMMAND"),un=K("DELETE_LINE_COMMAND"),pt=K("FORMAT_TEXT_COMMAND"),Ko=K("UNDO_COMMAND"),Bo=K("REDO_COMMAND"),Yc=K("KEYDOWN_COMMAND"),Wo=K("KEY_ARROW_RIGHT_COMMAND"),Xc=K("MOVE_TO_END"),zo=K("KEY_ARROW_LEFT_COMMAND"),Gc=K("MOVE_TO_START"),Rr=K("KEY_ARROW_UP_COMMAND"),Dr=K("KEY_ARROW_DOWN_COMMAND"),Un=K("KEY_ENTER_COMMAND"),Si=K("KEY_SPACE_COMMAND"),Uo=K("KEY_BACKSPACE_COMMAND"),Ho=K("KEY_ESCAPE_COMMAND"),jo=K("KEY_DELETE_COMMAND"),Fr=K("KEY_TAB_COMMAND"),Zc=K("INSERT_TAB_COMMAND"),Qc=K("INDENT_CONTENT_COMMAND"),zs=K("OUTDENT_CONTENT_COMMAND"),xi=K("DROP_COMMAND"),Jo=K("FORMAT_ELEMENT_COMMAND"),bi=K("DRAGSTART_COMMAND"),wi=K("DRAGOVER_COMMAND"),Yf=K("DRAGEND_COMMAND"),Pr=K("COPY_COMMAND"),Ir=K("CUT_COMMAND"),Us=K("SELECT_ALL_COMMAND"),vi=K("CLEAR_EDITOR_COMMAND"),eu=K("CLEAR_HISTORY_COMMAND"),ar=K("CAN_REDO_COMMAND"),cr=K("CAN_UNDO_COMMAND"),Ti=K("FOCUS_COMMAND"),tu=K("BLUR_COMMAND"),nu=K("KEY_MODIFIER_COMMAND"),wt=Object.freeze({}),Hs=[["keydown",function(n,t){if(gr=n.timeStamp,ru=n.key,!t.isComposing()&&!F(t,Yc,n)&&n.key!=null){if(ds&&da(n))return Je(t,()=>{eo(t,fs)}),ds=!1,void(fs="");if((function(e){return te(e,"ArrowRight",{shiftKey:"any"})})(n))F(t,Wo,n);else if((function(e){return te(e,"ArrowRight",Tt)})(n))F(t,Xc,n);else if((function(e){return te(e,"ArrowLeft",{shiftKey:"any"})})(n))F(t,zo,n);else if((function(e){return te(e,"ArrowLeft",Tt)})(n))F(t,Gc,n);else if((function(e){return te(e,"ArrowUp",{altKey:"any",shiftKey:"any"})})(n))F(t,Rr,n);else if((function(e){return te(e,"ArrowDown",{altKey:"any",shiftKey:"any"})})(n))F(t,Dr,n);else if((function(e){return te(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(n))pr=!0,F(t,Un,n);else if((function(e){return e.key===" "})(n))F(t,Si,n);else if((function(e){return nt&&te(e,"o",{ctrlKey:!0})})(n))n.preventDefault(),pr=!0,F(t,tn,!0);else if((function(e){return te(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(n))pr=!1,F(t,Un,n);else if((function(e){return te(e,"Backspace",{shiftKey:"any"})||nt&&te(e,"h",{ctrlKey:!0})})(n))da(n)?F(t,Uo,n):(n.preventDefault(),F(t,Mt,!0));else if((function(e){return e.key==="Escape"})(n))F(t,Ho,n);else if((function(e){return te(e,"Delete",{})||nt&&te(e,"d",{ctrlKey:!0})})(n))(function(e){return e.key==="Delete"})(n)?F(t,jo,n):(n.preventDefault(),F(t,Mt,!1));else if((function(e){return te(e,"Backspace",ua)})(n))n.preventDefault(),F(t,zn,!0);else if((function(e){return te(e,"Delete",ua)})(n))n.preventDefault(),F(t,zn,!1);else if((function(e){return nt&&te(e,"Backspace",{metaKey:!0})})(n))n.preventDefault(),F(t,un,!0);else if((function(e){return nt&&(te(e,"Delete",{metaKey:!0})||te(e,"k",{ctrlKey:!0}))})(n))n.preventDefault(),F(t,un,!1);else if((function(e){return te(e,"b",Tt)})(n))n.preventDefault(),F(t,pt,"bold");else if((function(e){return te(e,"u",Tt)})(n))n.preventDefault(),F(t,pt,"underline");else if((function(e){return te(e,"i",Tt)})(n))n.preventDefault(),F(t,pt,"italic");else if((function(e){return te(e,"Tab",{shiftKey:"any"})})(n))F(t,Fr,n);else if((function(e){return te(e,"z",Tt)})(n))n.preventDefault(),F(t,Ko,void 0);else if((function(e){return nt?te(e,"z",{metaKey:!0,shiftKey:!0}):te(e,"y",{ctrlKey:!0})||te(e,"z",{ctrlKey:!0,shiftKey:!0})})(n))n.preventDefault(),F(t,Bo,void 0);else{const e=t._editorState._selection;e===null||O(e)?fa(n)&&(n.preventDefault(),F(t,Us,n)):(function(r){return te(r,"c",Tt)})(n)?(n.preventDefault(),F(t,Pr,n)):(function(r){return te(r,"x",Tt)})(n)?(n.preventDefault(),F(t,Ir,n)):fa(n)&&(n.preventDefault(),F(t,Us,n))}(function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey})(n)&&F(t,nu,n)}}],["pointerdown",function(n,t){const e=n.target,r=n.pointerType;bn(e)&&r!=="touch"&&r!=="pen"&&n.button===0&&Je(t,()=>{la(e)||(Vs=!0)})}],["compositionstart",function(n,t){Je(t,()=>{const e=M();if(O(e)&&!t.isComposing()){const r=e.anchor,o=e.anchor.getNode();Ee(r.key),(n.timeStamp<gr+30||r.type==="element"||!e.isCollapsed()||o.getFormat()!==e.format||$(o)&&o.getStyle()!==e.style)&&F(t,zt,Mf)}})}],["compositionend",function(n,t){sn?rr=!0:Wn||!xr&&!br?Je(t,()=>{eo(t,n.data)}):(ds=!0,fs=n.data)}],["input",function(n,t){n.stopPropagation(),Je(t,()=>{if(se(n.target)&&la(n.target))return;const e=M(),r=n.data,o=au(n);if(r!=null&&O(e)&&iu(e,o,r,n.timeStamp,!1)){rr&&(eo(t,r),rr=!1);const s=e.anchor.getNode(),i=et(Qe(t));if(i===null)return;const l=e.isBackward(),a=l?e.anchor.offset:e.focus.offset,c=l?e.focus.offset:e.anchor.offset;mo&&!e.isCollapsed()&&$(s)&&i.anchorNode!==null&&s.getTextContent().slice(0,a)+r+s.getTextContent().slice(a+c)===Fu(i.anchorNode)||F(t,zt,r);const u=r.length;sn&&u>1&&n.inputType==="insertCompositionText"&&!t.isComposing()&&(e.anchor.offset-=u),xr||Wn||br||!t.isComposing()||(gr=0,Ee(null))}else Fi(!1,t,r!==null?r:void 0),rr&&(eo(t,r||void 0),rr=!1);(function(){ve();const s=ue();Kc(s)})()},{event:n}),An=null}],["click",function(n,t){Je(t,()=>{const e=M(),r=et(Qe(t)),o=Dt();if(r){if(O(e)){const s=e.anchor,i=s.getNode();if(s.type==="element"&&s.offset===0&&e.isCollapsed()&&!pe(i)&&Q().getChildrenSize()===1&&i.getTopLevelElementOrThrow().isEmpty()&&o!==null&&e.is(o))r.removeAllRanges(),e.dirty=!0;else if(n.detail===3&&!e.isCollapsed()&&i!==e.focus.getNode()){const l=z(i,a=>N(a)&&!a.isInline());N(l)&&l.select(0)}}else if(n.pointerType==="touch"||n.pointerType==="pen"){const s=r.anchorNode;(se(s)||Pt(s))&&ne(Yo(o,r,t,n))}}F(t,Ar,n)})}],["cut",wt],["copy",wt],["dragstart",wt],["dragover",wt],["dragend",wt],["paste",wt],["focus",wt],["blur",wt],["drop",wt]];mo&&Hs.push(["beforeinput",(n,t)=>(function(e,r){const o=e.inputType,s=au(e);o==="deleteCompositionText"||sn&&Iu(r)||o!=="insertCompositionText"&&Je(r,()=>{const i=M();if(o==="deleteContentBackward"){if(i===null){const g=Dt();if(!O(g))return;ne(g.clone())}if(O(i)){const g=i.anchor.key===i.focus.key;if(l=e.timeStamp,ru==="MediaLast"&&l<gr+30&&r.isComposing()&&g){if(Ee(null),gr=0,setTimeout(()=>{Je(r,()=>{Ee(null)})},30),O(i)){const h=i.anchor.getNode();h.markDirty(),$(h)||A(142),lu(i,h)}}else{Ee(null),e.preventDefault();const h=i.anchor.getNode(),p=h.getTextContent(),_=h.canInsertTextAfter(),y=i.anchor.offset===0&&i.focus.offset===p.length;let m=Nl&&g&&!y&&_;if(m&&i.isCollapsed()&&(m=!q(Qs(i.anchor,!0))),!m){F(r,Mt,!0);const C=M();Nl&&O(C)&&C.isCollapsed()&&(en=C,setTimeout(()=>en=null))}}return}}var l;if(!O(i))return;const a=e.data;An!==null&&Fi(!1,r,An),i.dirty&&An===null||!i.isCollapsed()||pe(i.anchor.getNode())||s===null||i.applyDOMRange(s),An=null;const c=i.anchor,u=i.focus,f=c.getNode(),d=u.getNode();if(o!=="insertText"&&o!=="insertTranspose")switch(e.preventDefault(),o){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":F(r,zt,e);break;case"insertFromComposition":Ee(null),F(r,zt,e);break;case"insertLineBreak":Ee(null),F(r,tn,!1);break;case"insertParagraph":Ee(null),pr&&!Wn?(pr=!1,F(r,tn,!1)):F(r,cn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":F(r,$r,e);break;case"deleteByComposition":(function(g,h){return g!==h||N(g)||N(h)||!nn(g)||!nn(h)})(f,d)&&F(r,Ws,e);break;case"deleteByDrag":case"deleteByCut":F(r,Ws,e);break;case"deleteContent":F(r,Mt,!1);break;case"deleteWordBackward":F(r,zn,!0);break;case"deleteWordForward":F(r,zn,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":F(r,un,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":F(r,un,!1);break;case"formatStrikeThrough":F(r,pt,"strikethrough");break;case"formatBold":F(r,pt,"bold");break;case"formatItalic":F(r,pt,"italic");break;case"formatUnderline":F(r,pt,"underline");break;case"historyUndo":F(r,Ko,void 0);break;case"historyRedo":F(r,Bo,void 0)}else{if(a===`
|
|
4
|
+
`)e.preventDefault(),F(r,tn,!1);else if(a===Jt)e.preventDefault(),F(r,cn,void 0);else if(a==null&&e.dataTransfer){const g=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(g)}else a!=null&&iu(i,s,a,e.timeStamp,!0)?(e.preventDefault(),F(r,zt,a)):An=a;ou=e.timeStamp}})})(n,t)]);let gr=0,ru=null,ou=0,An=null;const js=new WeakMap,bo=new WeakMap;let Js=!1,Vs=!1,pr=!1,rr=!1,ds=!1,fs="",en=null,su=[0,"",0,"root",0];function iu(n,t,e,r,o){const s=n.anchor,i=n.focus,l=s.getNode(),a=ue(),c=et(Qe(a)),u=c!==null?c.anchorNode:null,f=s.key,d=a.getElementByKey(f),g=e.length;return f!==i.key||!$(l)||(!o&&(!mo||ou<r+50)||l.isDirty()&&g<2||Ru(e))&&s.offset!==i.offset&&!l.isComposing()||ut(l)||l.isDirty()&&g>1||(o||!mo)&&d!==null&&!l.isComposing()&&u!==Hn(d)||c!==null&&t!==null&&(!t.collapsed||t.startContainer!==c.anchorNode||t.startOffset!==c.anchorOffset)||l.getFormat()!==n.format||l.getStyle()!==n.style||(function(h,p){if(p.isSegmented())return!0;if(!h.isCollapsed())return!1;const _=h.anchor.offset,y=p.getParentOrThrow(),m=nn(p);return _===0?!p.canInsertTextBefore()||!y.canInsertTextBefore()&&!p.isComposing()||m||(function(C){const S=C.getPreviousSibling();return($(S)||N(S)&&S.isInline())&&!S.canInsertTextAfter()})(p):_===p.getTextContentSize()&&(!p.canInsertTextAfter()||!y.canInsertTextAfter()&&!p.isComposing()||m)})(n,l)}function Il(n,t){return Pt(n)&&n.nodeValue!==null&&t!==0&&t!==n.nodeValue.length}function Kl(n,t,e){const{anchorNode:r,anchorOffset:o,focusNode:s,focusOffset:i}=n;Js&&(Js=!1,Il(r,o)&&Il(s,i)&&!en)||Je(t,()=>{if(!e)return void ne(null);if(!Wr(t,r,s))return;let l=M();if(en&&O(l)&&l.isCollapsed()){const a=l.anchor,c=en.anchor;(a.key===c.key&&a.offset===c.offset+1||a.offset===1&&c.getNode().is(a.getNode().getPreviousSibling()))&&(l=en.clone(),ne(l))}if(en=null,O(l)){const a=l.anchor,c=a.getNode();if(l.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(l.dirty=!0);const u=Qe(t).event,f=u?u.timeStamp:performance.now(),[d,g,h,p,_]=su,y=Q(),m=t.isComposing()===!1&&y.getTextContent()==="";if(f<_+200&&a.offset===h&&a.key===p)fo(l,d,g);else if(a.type==="text")$(c)||A(141),lu(l,c);else if(a.type==="element"&&!m){N(c)||A(259);const C=a.getNode();C.isEmpty()?(function(S,w){const x=w.getTextFormat(),v=w.getTextStyle();fo(S,x,v)})(l,C):fo(l,0,"")}}else{const u=a.key,f=l.focus.key,d=l.getNodes(),g=d.length,h=l.isBackward(),p=h?i:o,_=h?o:i,y=h?f:u,m=h?u:f;let C=2047,S=!1;for(let w=0;w<g;w++){const x=d[w],v=x.getTextContentSize();if($(x)&&v!==0&&!(w===0&&x.__key===y&&p===v||w===g-1&&x.__key===m&&_===0)&&(S=!0,C&=x.getFormat(),C===0))break}l.format=S?C:0}}F(t,Bt,void 0)})}function fo(n,t,e){n.format===t&&n.style===e||(n.format=t,n.style=e,n.dirty=!0)}function lu(n,t){fo(n,t.getFormat(),t.getStyle())}function au(n){if(!n.getTargetRanges)return null;const t=n.getTargetRanges();return t.length===0?null:t[0]}function eo(n,t){const e=n._compositionKey;if(Ee(null),e!==null&&t!=null){if(t===""){const r=Y(e),o=Hn(n.getElementByKey(e));return void(o!==null&&o.nodeValue!==null&&$(r)&&Pi(r,o.nodeValue,null,null,!0))}if(t[t.length-1]===`
|
|
5
|
+
`){const r=M();if(O(r)){const o=r.focus;return r.anchor.set(o.key,o.offset,o.type),void F(n,Un,null)}}}Fi(!0,n,t)}function cu(n){let t=n.__lexicalEventHandles;return t===void 0&&(t=[],n.__lexicalEventHandles=t),t}const In=new Map;function uu(n){const t=Nh(n.target);if(t===null)return;const e=Zo(t.anchorNode);if(e===null)return;Vs&&(Vs=!1,Je(e,()=>{const a=Dt(),c=t.anchorNode;(se(c)||Pt(c))&&ne(Yo(a,t,e,n))}));const r=Di(e),o=r[r.length-1],s=o._key,i=In.get(s),l=i||o;l!==e&&Kl(t,l,!1),Kl(t,e,!0),e!==o?In.set(s,e):i&&In.delete(s)}function Bl(n){n._lexicalHandled=!0}function Wl(n){return n._lexicalHandled===!0}function Xf(n){const t=js.get(n);if(t===void 0)return;const e=bo.get(t);if(e===void 0)return;const r=e-1;r>=0||A(164),js.delete(n),bo.set(t,r),r===0&&t.removeEventListener("selectionchange",uu);const o=Qo(n);Ri(o)?((function(i){if(i._parentEditor!==null){const l=Di(i),a=l[l.length-1]._key;In.get(a)===i&&In.delete(a)}else In.delete(i._key)})(o),n.__lexicalEditor=null):o&&A(198);const s=cu(n);for(let i=0;i<s.length;i++)s[i]();n.__lexicalEventHandles=[]}function qs(n,t,e){ve();const r=n.__key,o=n.getParent();if(o===null)return;const s=(function(l){const a=M();if(!O(a)||!N(l))return a;const{anchor:c,focus:u}=a,f=c.getNode(),d=u.getNode();return ei(f,l)&&c.set(l.__key,0,"element"),ei(d,l)&&u.set(l.__key,0,"element"),a})(n);let i=!1;if(O(s)&&t){const l=s.anchor,a=s.focus;l.key===r&&(No(l,n,o,n.getPreviousSibling(),n.getNextSibling()),i=!0),a.key===r&&(No(a,n,o,n.getPreviousSibling(),n.getNextSibling()),i=!0)}else he(s)&&t&&n.isSelected()&&n.selectPrevious();if(O(s)&&t&&!i){const l=n.getIndexWithinParent();Ht(n),To(s,o,l,-1)}else Ht(n);e||We(o)||o.canBeEmpty()||!o.isEmpty()||qs(o,t),t&&s&&pe(o)&&o.isEmpty()&&o.selectEnd()}const du=Symbol.for("ephemeral");function wo(n){return n[du]||!1}class ot{constructor(t){b(this,"__type");b(this,"__key");b(this,"__parent");b(this,"__prev");b(this,"__next");b(this,"__state");this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),Mu(this,t)}static getType(){const{ownNodeType:t}=ns(this);return t===void 0&&A(64,this.name),t}static clone(t){A(65,this.name)}$config(){return{}}config(t,e){const r=e.extends||Object.getPrototypeOf(this.constructor);return Object.assign(e,{extends:r,type:t}),{[t]:e}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this))}getType(){return this.__type}isInline(){A(137,this.constructor.name)}isAttached(){let t=this.__key;for(;t!==null;){if(t==="root")return!0;const e=Y(t);if(e===null)break;t=e.__parent}return!1}isSelected(t){const e=t||M();if(e==null)return!1;const r=e.getNodes().some(o=>o.__key===this.__key);if($(this))return r;if(O(e)&&e.anchor.type==="element"&&e.focus.type==="element"){if(e.isCollapsed())return!1;const o=this.getParent();if(q(this)&&this.isInline()&&o){const s=e.isBackward()?e.focus:e.anchor;if(o.is(s.getNode())&&s.offset===o.getChildrenSize()&&this.is(o.getLastChild()))return!1}}return r}getKey(){return this.__key}getIndexWithinParent(){const t=this.getParent();if(t===null)return-1;let e=t.getFirstChild(),r=0;for(;e!==null;){if(this.is(e))return r;r++,e=e.getNextSibling()}return-1}getParent(){const t=this.getLatest().__parent;return t===null?null:Y(t)}getParentOrThrow(){const t=this.getParent();return t===null&&A(66,this.__key),t}getTopLevelElement(){let t=this;for(;t!==null;){const e=t.getParent();if(We(e))return N(t)||t===this&&q(t)||A(194),t;t=e}return null}getTopLevelElementOrThrow(){const t=this.getTopLevelElement();return t===null&&A(67,this.__key),t}getParents(){const t=[];let e=this.getParent();for(;e!==null;)t.push(e),e=e.getParent();return t}getParentKeys(){const t=[];let e=this.getParent();for(;e!==null;)t.push(e.__key),e=e.getParent();return t}getPreviousSibling(){const t=this.getLatest().__prev;return t===null?null:Y(t)}getPreviousSiblings(){const t=[],e=this.getParent();if(e===null)return t;let r=e.getFirstChild();for(;r!==null&&!r.is(this);)t.push(r),r=r.getNextSibling();return t}getNextSibling(){const t=this.getLatest().__next;return t===null?null:Y(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;e!==null;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=N(this)?this:this.getParent(),r=N(t)?t:t.getParent(),o=e&&r?go(e,r):null;return o?o.commonAncestor:null}is(t){return t!=null&&this.__key===t.__key}isBefore(t){const e=go(this,t);return e!==null&&(e.type==="descendant"||(e.type==="branch"?qu(e)===-1:(e.type!=="same"&&e.type!=="ancestor"&&A(279),!1)))}isParentOf(t){const e=go(this,t);return e!==null&&e.type==="ancestor"}getNodesBetween(t){const e=this.isBefore(t),r=[],o=new Set;let s=this;for(;s!==null;){const i=s.__key;if(o.has(i)||(o.add(i),r.push(s)),s===t)break;const l=N(s)?e?s.getFirstChild():s.getLastChild():null;if(l!==null){s=l;continue}const a=e?s.getNextSibling():s.getPreviousSibling();if(a!==null){s=a;continue}const c=s.getParentOrThrow();if(o.has(c.__key)||r.push(c),c===t)break;let u=null,f=c;do{if(f===null&&A(68),u=e?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f===null)break;u!==null||o.has(f.__key)||r.push(f)}while(u===null);s=u}return e||r.reverse(),r}isDirty(){const t=ue()._dirtyLeaves;return t!==null&&t.has(this.__key)}getLatest(){if(wo(this))return this;const t=Y(this.__key);return t===null&&A(113),t}getWritable(){if(wo(this))return this;ve();const t=Ft(),e=ue(),r=t._nodeMap,o=this.__key,s=this.getLatest(),i=e._cloneNotNeeded,l=M();if(l!==null&&l.setCachedNodes(null),i.has(o))return ko(s),s;const a=Wi(s);return i.add(o),ko(a),r.set(o,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(t,e){A(70)}updateDOM(t,e,r){A(71)}exportDOM(t){return{element:this.createDOM(t._config,t)}}exportJSON(){const t=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...t}}static importJSON(t){A(18,this.name)}updateFromJSON(t){return(function(e,r){const o=e.getWritable(),s=r.$;let i=s;for(const l of Uc(o).flatKeys)l in r&&(i!==void 0&&i!==s||(i={...s}),i[l]=r[l]);return(o.__state||i)&&Ci(e).updateFromJSON(i),o})(this,t)}static transform(){return null}remove(t){qs(this,!0,t)}replace(t,e){ve();let r=M();r!==null&&(r=r.clone()),ys(this,t);const o=this.getLatest(),s=this.__key,i=t.__key,l=t.getWritable(),a=this.getParentOrThrow().getWritable(),c=a.__size;Ht(l);const u=o.getPreviousSibling(),f=o.getNextSibling(),d=o.__prev,g=o.__next,h=o.__parent;if(qs(o,!1,!0),u===null?a.__first=i:u.getWritable().__next=i,l.__prev=d,f===null?a.__last=i:f.getWritable().__prev=i,l.__next=g,l.__parent=h,a.__size=c,e&&(N(this)&&N(l)||A(139),this.getChildren().forEach(p=>{l.append(p)})),O(r)){ne(r);const p=r.anchor,_=r.focus;p.key===s&&jl(p,l),_.key===s&&jl(_,l)}return Wt()===s&&Ee(i),l}insertAfter(t,e=!0){ve(),ys(this,t);const r=this.getWritable(),o=t.getWritable(),s=o.getParent(),i=M();let l=!1,a=!1;if(s!==null){const g=t.getIndexWithinParent();if(Ht(o),O(i)){const h=s.__key,p=i.anchor,_=i.focus;l=p.type==="element"&&p.key===h&&p.offset===g+1,a=_.type==="element"&&_.key===h&&_.offset===g+1}}const c=this.getNextSibling(),u=this.getParentOrThrow().getWritable(),f=o.__key,d=r.__next;if(c===null?u.__last=f:c.getWritable().__prev=f,u.__size++,r.__next=f,o.__next=d,o.__prev=r.__key,o.__parent=r.__parent,e&&O(i)){const g=this.getIndexWithinParent();To(i,u,g+1);const h=u.__key;l&&i.anchor.set(h,g+2,"element"),a&&i.focus.set(h,g+2,"element")}return t}insertBefore(t,e=!0){ve(),ys(this,t);const r=this.getWritable(),o=t.getWritable(),s=o.__key;Ht(o);const i=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),a=r.__prev,c=this.getIndexWithinParent();i===null?l.__first=s:i.getWritable().__next=s,l.__size++,r.__prev=s,o.__prev=a,o.__next=r.__key,o.__parent=r.__parent;const u=M();return e&&O(u)&&To(u,this.getParentOrThrow(),c),t}isParentRequired(){return!1}createParentElementNode(){return j()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){ve();const r=this.getPreviousSibling(),o=this.getParentOrThrow();if(r===null)return o.select(0,0);if(N(r))return r.select();if(!$(r)){const s=r.getIndexWithinParent()+1;return o.select(s,s)}return r.select(t,e)}selectNext(t,e){ve();const r=this.getNextSibling(),o=this.getParentOrThrow();if(r===null)return o.select();if(N(r))return r.select(0,0);if(!$(r)){const s=r.getIndexWithinParent();return o.select(s,s)}return r.select(t,e)}markDirty(){this.getWritable()}reconcileObservedMutation(t,e){this.markDirty()}}b(ot,"importDOM");const vo="historic",Gf="history-push",Ut="history-merge",Zf="paste",fu="collaboration",Qf="skip-collab",hu="skip-scroll-into-view",eh="skip-dom-selection",th="skip-selection-focus";class qn extends ot{static getType(){return"linebreak"}static clone(t){return new qn(t.__key)}constructor(t){super(t)}getTextContent(){return`
|
|
6
|
+
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:t=>(function(e){const r=e.parentElement;if(r!==null&&Oo(r)){const o=r.firstChild;if(o===e||o.nextSibling===e&&to(o)){const s=r.lastChild;if(s===e||s.previousSibling===e&&to(s))return!0}}return!1})(t)||(function(e){const r=e.parentElement;if(r!==null&&Oo(r)){const o=r.firstChild;if(o===e||o.nextSibling===e&&to(o))return!1;const s=r.lastChild;if(s===e||s.previousSibling===e&&to(s))return!0}return!1})(t)?null:{conversion:nh,priority:0}}}static importJSON(t){return qt().updateFromJSON(t)}}function nh(n){return{node:qt()}}function qt(){return de(new qn)}function _t(n){return n instanceof qn}function to(n){return Pt(n)&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}function hs(n,t){return 16&t?"code":t&Rc?"mark":32&t?"sub":64&t?"sup":null}function gs(n,t){return 1&t?"strong":2&t?"em":"span"}function gu(n,t,e,r,o){const s=r.classList;let i=Kn(o,"base");i!==void 0&&s.add(...i),i=Kn(o,"underlineStrikethrough");let l=!1;const a=8&t&&4&t;i!==void 0&&(8&e&&4&e?(l=!0,a||s.add(...i)):a&&s.remove(...i));for(const c in Lt){const u=Lt[c];if(i=Kn(o,c),i!==void 0)if(e&u){if(l&&(c==="underline"||c==="strikethrough")){t&u&&s.remove(...i);continue}((t&u)===0||a&&c==="underline"||c==="strikethrough")&&s.add(...i)}else t&u&&s.remove(...i)}}function pu(n,t,e){const r=t.firstChild,o=e.isComposing(),s=n+(o?Po:"");if(r==null)t.textContent=s;else{const i=r.nodeValue;if(i!==s)if(o||sn){const[l,a,c]=(function(u,f){const d=u.length,g=f.length;let h=0,p=0;for(;h<d&&h<g&&u[h]===f[h];)h++;for(;p+h<d&&p+h<g&&u[d-p-1]===f[g-p-1];)p++;return[h,d-h-p,f.slice(h,g-p)]})(i,s);a!==0&&r.deleteData(l,a),r.insertData(l,c)}else r.nodeValue=s}}function zl(n,t,e,r,o,s){pu(o,n,t);const i=s.theme.text;i!==void 0&&gu(0,0,r,n,i)}function no(n,t){const e=document.createElement(t);return e.appendChild(n),e}class Ke extends ot{constructor(e="",r){super(r);b(this,"__text");b(this,"__format");b(this,"__style");b(this,"__mode");b(this,"__detail");this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}static getType(){return"text"}static clone(e){return new Ke(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return Ff[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Wt()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const r=Lt[e];return(this.getFormat()&r)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,r){return Eo(this.getLatest().__format,e,r)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,r){const o=this.__format,s=hs(0,o),i=gs(0,o),l=s===null?i:s,a=document.createElement(l);let c=a;this.hasFormat("code")&&a.setAttribute("spellcheck","false"),s!==null&&(c=document.createElement(i),a.appendChild(c)),zl(c,this,0,o,this.__text,e);const u=this.__style;return u!==""&&(a.style.cssText=u),a}updateDOM(e,r,o){const s=this.__text,i=e.__format,l=this.__format,a=hs(0,i),c=hs(0,l),u=gs(0,i),f=gs(0,l);if((a===null?u:a)!==(c===null?f:c))return!0;if(a===c&&u!==f){const _=r.firstChild;_==null&&A(48);const y=document.createElement(f);return zl(y,this,0,l,s,o),r.replaceChild(y,_),!1}let d=r;c!==null&&a!==null&&(d=r.firstChild,d==null&&A(49)),pu(s,d,this);const g=o.theme.text;g!==void 0&&i!==l&&gu(0,i,l,d,g);const h=e.__style,p=this.__style;return h!==p&&(r.style.cssText=p),!1}static importDOM(){return{"#text":()=>({conversion:ih,priority:0}),b:()=>({conversion:oh,priority:0}),code:()=>({conversion:vt,priority:0}),em:()=>({conversion:vt,priority:0}),i:()=>({conversion:vt,priority:0}),mark:()=>({conversion:vt,priority:0}),s:()=>({conversion:vt,priority:0}),span:()=>({conversion:rh,priority:0}),strong:()=>({conversion:vt,priority:0}),sub:()=>({conversion:vt,priority:0}),sup:()=>({conversion:vt,priority:0}),u:()=>({conversion:vt,priority:0})}}static importJSON(e){return fe().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:r}=super.exportDOM(e);return se(r)||A(132),r.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?r.style.textTransform="lowercase":this.hasFormat("uppercase")?r.style.textTransform="uppercase":this.hasFormat("capitalize")&&(r.style.textTransform="capitalize"),this.hasFormat("bold")&&(r=no(r,"b")),this.hasFormat("italic")&&(r=no(r,"i")),this.hasFormat("strikethrough")&&(r=no(r,"s")),this.hasFormat("underline")&&(r=no(r,"u")),{element:r}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,r){}setFormat(e){const r=this.getWritable();return r.__format=typeof e=="string"?Lt[e]:e,r}setDetail(e){const r=this.getWritable();return r.__detail=typeof e=="string"?$f[e]:e,r}setStyle(e){const r=this.getWritable();return r.__style=e,r}toggleFormat(e){const r=Eo(this.getFormat(),e,null);return this.setFormat(r)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const r=Df[e];if(this.__mode===r)return this;const o=this.getWritable();return o.__mode=r,o}setTextContent(e){if(this.__text===e)return this;const r=this.getWritable();return r.__text=e,r}select(e,r){ve();let o=e,s=r;const i=M(),l=this.getTextContent(),a=this.__key;if(typeof l=="string"){const c=l.length;o===void 0&&(o=c),s===void 0&&(s=c)}else o=0,s=0;if(!O(i))return yu(a,o,a,s,"text","text");{const c=Wt();c!==i.anchor.key&&c!==i.focus.key||Ee(a),i.setTextNodeRange(this,o,this,s)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,r,o,s){const i=this.getWritable(),l=i.__text,a=o.length;let c=e;c<0&&(c=a+c,c<0&&(c=0));const u=M();if(s&&O(u)){const d=e+a;u.setTextNodeRange(i,d,i,d)}const f=l.slice(0,c)+o+l.slice(c+r);return i.__text=f,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){ve();const r=this.getLatest(),o=r.getTextContent();if(o==="")return[];const s=r.__key,i=Wt(),l=o.length;e.sort((T,k)=>T-k),e.push(l);const a=[],c=e.length;for(let T=0,k=0;T<l&&k<=c;k++){const D=e[k];D>T&&(a.push(o.slice(T,D)),T=D)}const u=a.length;if(u===1)return[r];const f=a[0],d=r.getParent();let g;const h=r.getFormat(),p=r.getStyle(),_=r.__detail;let y=!1,m=null,C=null;const S=M();if(O(S)){const[T,k]=S.isBackward()?[S.focus,S.anchor]:[S.anchor,S.focus];T.type==="text"&&T.key===s&&(m=T),k.type==="text"&&k.key===s&&(C=k)}r.isSegmented()?(g=fe(f),g.__format=h,g.__style=p,g.__detail=_,g.__state=Al(r,g),y=!0):g=r.setTextContent(f);const w=[g];for(let T=1;T<u;T++){const k=fe(a[T]);k.__format=h,k.__style=p,k.__detail=_,k.__state=Al(r,k);const D=k.__key;i===s&&Ee(D),w.push(k)}const x=m?m.offset:null,v=C?C.offset:null;let E=0;for(const T of w){if(!m&&!C)break;const k=E+T.getTextContentSize();if(m!==null&&x!==null&&x<=k&&x>=E&&(m.set(T.getKey(),x-E,"text"),x<k&&(m=null)),C!==null&&v!==null&&v<=k&&v>=E){C.set(T.getKey(),v-E,"text");break}E=k}if(d!==null){(function(D){const P=D.getPreviousSibling(),R=D.getNextSibling();P!==null&&ko(P),R!==null&&ko(R)})(this);const T=d.getWritable(),k=this.getIndexWithinParent();y?(T.splice(k,0,w),this.remove()):T.splice(k,1,w),O(S)&&To(S,d,k,u-1)}return w}mergeWithSibling(e){const r=e===this.getPreviousSibling();r||e===this.getNextSibling()||A(50);const o=this.__key,s=e.__key,i=this.__text,l=i.length;Wt()===s&&Ee(o);const a=M();if(O(a)){const d=a.anchor,g=a.focus;d!==null&&d.key===s&&Zl(d,r,o,e,l),g!==null&&g.key===s&&Zl(g,r,o,e,l)}const c=e.__text,u=r?c+i:i+c;this.setTextContent(u);const f=this.getWritable();return e.remove(),f}isTextEntity(){return!1}}function rh(n){return{forChild:Ni(n.style),node:null}}function oh(n){const t=n,e=t.style.fontWeight==="normal";return{forChild:Ni(t.style,e?void 0:"bold"),node:null}}const Ul=new WeakMap;function sh(n){if(!se(n))return!1;if(n.nodeName==="PRE")return!0;const t=n.style.whiteSpace;return typeof t=="string"&&t.startsWith("pre")}function ih(n){const t=n;n.parentElement===null&&A(129);let e=t.textContent||"";if((function(r){let o,s=r.parentNode;const i=[r];for(;s!==null&&(o=Ul.get(s))===void 0&&!sh(s);)i.push(s),s=s.parentNode;const l=o===void 0?s:o;for(let a=0;a<i.length;a++)Ul.set(i[a],l);return l})(t)!==null){const r=e.split(/(\r?\n|\t)/),o=[],s=r.length;for(let i=0;i<s;i++){const l=r[i];l===`
|
|
7
|
+
`||l===`\r
|
|
8
|
+
`?o.push(qt()):l===" "?o.push(Xn()):l!==""&&o.push(fe(l))}return{node:o}}if(e=e.replace(/\r/g,"").replace(/[ \t\n]+/g," "),e==="")return{node:null};if(e[0]===" "){let r=t,o=!0;for(;r!==null&&(r=Hl(r,!1))!==null;){const s=r.textContent||"";if(s.length>0){/[ \t\n]$/.test(s)&&(e=e.slice(1)),o=!1;break}}o&&(e=e.slice(1))}if(e[e.length-1]===" "){let r=t,o=!0;for(;r!==null&&(r=Hl(r,!0))!==null;)if((r.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){o=!1;break}o&&(e=e.slice(0,e.length-1))}return e===""?{node:null}:{node:fe(e)}}function Hl(n,t){let e=n;for(;;){let r;for(;(r=t?e.nextSibling:e.previousSibling)===null;){const s=e.parentElement;if(s===null)return null;e=s}if(e=r,se(e)){const s=e.style.display;if(s===""&&!ri(e)||s!==""&&!s.startsWith("inline"))return null}let o=e;for(;(o=t?e.firstChild:e.lastChild)!==null;)e=o;if(Pt(e))return e;if(e.nodeName==="BR")return null}}const lh={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function vt(n){const t=lh[n.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Ni(n.style,t),node:null}}function fe(n=""){return de(new Ke(n))}function $(n){return n instanceof Ke}function Ni(n,t){const e=n.fontWeight,r=n.textDecoration.split(" "),o=e==="700"||e==="bold",s=r.includes("line-through"),i=n.fontStyle==="italic",l=r.includes("underline"),a=n.verticalAlign;return c=>($(c)&&(o&&!c.hasFormat("bold")&&c.toggleFormat("bold"),s&&!c.hasFormat("strikethrough")&&c.toggleFormat("strikethrough"),i&&!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"),t&&!c.hasFormat(t)&&c.toggleFormat(t)),c)}class Yn extends Ke{static getType(){return"tab"}static clone(t){return new Yn(t.__key)}constructor(t){super(" ",t),this.__detail=2}static importDOM(){return null}createDOM(t){const e=super.createDOM(t),r=Kn(t.theme,"tab");return r!==void 0&&e.classList.add(...r),e}static importJSON(t){return Xn().updateFromJSON(t)}setTextContent(t){return t!==" "&&t!==""&&Lc(126),super.setTextContent(" ")}spliceText(t,e,r,o){return r===""&&e===0||r===" "&&e===1||A(286),this}setDetail(t){return t!==2&&A(127),this}setMode(t){return t!=="normal"&&A(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Xn(){return de(new Yn)}function Ei(n){return n instanceof Yn}class ah{constructor(t,e,r){b(this,"key");b(this,"offset");b(this,"type");b(this,"_selection");this._selection=null,this.key=t,this.offset=e,this.type=r}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){return this.key===t.key?this.offset<t.offset:Vu(Xe(xt(this,"next")),Xe(xt(t,"next")))<0}getNode(){const t=Y(this.key);return t===null&&A(20),t}set(t,e,r,o){const s=this._selection,i=this.key;o&&this.key===t&&this.offset===e&&this.type===r||(this.key=t,this.offset=e,this.type=r,Cn()||(Wt()===i&&Ee(t),s!==null&&(s.setCachedNodes(null),s.dirty=!0)))}}function De(n,t,e){return new ah(n,t,e)}function ps(n,t){let e=t.__key,r=n.offset,o="element";if($(t)){o="text";const s=t.getTextContentSize();r>s&&(r=s)}else if(!N(t)){const s=t.getNextSibling();if($(s))e=s.__key,r=0,o="text";else{const i=t.getParent();i&&(e=i.__key,r=t.getIndexWithinParent()+1)}}n.set(e,r,o)}function jl(n,t){if(N(t)){const e=t.getLastDescendant();N(e)||$(e)?ps(n,e):ps(n,t)}else ps(n,t)}class Vo{constructor(t){b(this,"_nodes");b(this,"_cachedNodes");b(this,"dirty");this._cachedNodes=null,this._nodes=t,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){if(!he(t))return!1;const e=this._nodes,r=t._nodes;return e.size===r.size&&Array.from(e).every(o=>r.has(o))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(t){this.dirty=!0,this._nodes.add(t),this._cachedNodes=null}delete(t){this.dirty=!0,this._nodes.delete(t),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(t){return this._nodes.has(t)}clone(){return new Vo(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){const e=this.getNodes(),r=e.length,o=e[r-1];let s;if($(o))s=o.select();else{const i=o.getIndexWithinParent()+1;s=o.getParentOrThrow().select(i,i)}s.insertNodes(t);for(let i=0;i<r;i++)e[i].remove()}getNodes(){const t=this._cachedNodes;if(t!==null)return t;const e=this._nodes,r=[];for(const o of e){const s=Y(o);s!==null&&r.push(s)}return Cn()||(this._cachedNodes=r),r}getTextContent(){const t=this.getNodes();let e="";for(let r=0;r<t.length;r++)e+=t[r].getTextContent();return e}deleteNodes(){const t=this.getNodes();if((M()||Dt())===this&&t[0]){const e=me(t[0],"next");qi(At(e,e))}for(const e of t)e.remove()}}function O(n){return n instanceof yn}class yn{constructor(t,e,r,o){b(this,"format");b(this,"style");b(this,"anchor");b(this,"focus");b(this,"_cachedNodes");b(this,"dirty");this.anchor=t,this.focus=e,t._selection=this,e._selection=this,this._cachedNodes=null,this.format=r,this.style=o,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return!!O(t)&&this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const t=this._cachedNodes;if(t!==null)return t;const e=(function(r){const o=[],[s,i]=r.getTextSlices();s&&o.push(s.caret.origin);const l=new Set,a=new Set;for(const c of r)if(Ge(c)){const{origin:u}=c;o.length===0?l.add(u):(a.add(u),o.push(u))}else{const{origin:u}=c;N(u)&&a.has(u)||o.push(u)}if(i&&o.push(i.caret.origin),pn(r.focus)&&N(r.focus.origin)&&r.focus.getNodeAtCaret()===null)for(let c=tt(r.focus.origin,"previous");Ge(c)&&l.has(c.origin)&&!c.origin.isEmpty()&&c.origin.is(o[o.length-1]);c=jn(c))l.delete(c.origin),o.pop();for(;o.length>1;){const c=o[o.length-1];if(!N(c)||a.has(c)||c.isEmpty()||l.has(c))break;o.pop()}if(o.length===0&&r.isCollapsed()){const c=Xe(r.anchor),u=Xe(r.anchor.getFlipped()),f=g=>mt(g)?g.origin:g.getNodeAtCaret(),d=f(c)||f(u)||(r.anchor.getNodeAtCaret()?c.origin:u.origin);o.push(d)}return o})(Yi(si(this),"next"));return Cn()||(this._cachedNodes=e),e}setTextNodeRange(t,e,r,o){this.anchor.set(t.__key,e,"text"),this.focus.set(r.__key,o,"text")}getTextContent(){const t=this.getNodes();if(t.length===0)return"";const e=t[0],r=t[t.length-1],o=this.anchor,s=this.focus,i=o.isBefore(s),[l,a]=Ys(this);let c="",u=!0;for(let f=0;f<t.length;f++){const d=t[f];if(N(d)&&!d.isInline())u||(c+=`
|
|
9
|
+
`),u=!d.isEmpty();else if(u=!1,$(d)){let g=d.getTextContent();d===e?d===r?o.type==="element"&&s.type==="element"&&s.offset!==o.offset||(g=l<a?g.slice(l,a):g.slice(a,l)):g=i?g.slice(l):g.slice(a):d===r&&(g=i?g.slice(0,a):g.slice(0,l)),c+=g}else!q(d)&&!_t(d)||d===r&&this.isCollapsed()||(c+=d.getTextContent())}return c}applyDOMRange(t){const e=ue(),r=e.getEditorState()._selection,o=mu(t.startContainer,t.startOffset,t.endContainer,t.endOffset,e,r);if(o===null)return;const[s,i]=o;this.anchor.set(s.key,s.offset,s.type,!0),this.focus.set(i.key,i.offset,i.type,!0),Vt(this)}clone(){const t=this.anchor,e=this.focus;return new yn(De(t.key,t.offset,t.type),De(e.key,e.offset,e.type),this.format,this.style)}toggleFormat(t){this.format=Eo(this.format,t,null),this.dirty=!0}setFormat(t){this.format=t,this.dirty=!0}setStyle(t){this.style=t,this.dirty=!0}hasFormat(t){const e=Lt[t];return(this.format&e)!==0}insertRawText(t){const e=t.split(/(\r?\n|\t)/),r=[],o=e.length;for(let s=0;s<o;s++){const i=e[s];i===`
|
|
10
|
+
`||i===`\r
|
|
11
|
+
`?r.push(qt()):i===" "?r.push(Xn()):r.push(fe(i))}this.insertNodes(r)}insertText(t){const e=this.anchor,r=this.focus,o=this.format,s=this.style;let i=e,l=r;!this.isCollapsed()&&r.isBefore(e)&&(i=r,l=e),i.type==="element"&&(function(_,y,m,C){const S=_.getNode(),w=S.getChildAtIndex(_.offset),x=fe();if(x.setFormat(m),x.setStyle(C),bt(w))w.splice(0,0,[x]);else{const v=pe(S)?j().append(x):x;w===null?S.append(v):w.insertBefore(v)}_.is(y)&&y.set(x.__key,0,"text"),_.set(x.__key,0,"text")})(i,l,o,s),l.type==="element"&&Nr(l,Xe(xt(l,"next")));const a=i.offset;let c=l.offset;const u=this.getNodes(),f=u.length;let d=u[0];$(d)||A(26);const g=d.getTextContent().length,h=d.getParentOrThrow();let p=u[f-1];if(f===1&&l.type==="element"&&(c=g,l.set(i.key,c,"text")),this.isCollapsed()&&a===g&&(ut(d)||!d.canInsertTextAfter()||!h.canInsertTextAfter()&&d.getNextSibling()===null)){let _=d.getNextSibling();if($(_)&&_.canInsertTextBefore()&&!ut(_)||(_=fe(),_.setFormat(o),_.setStyle(s),h.canInsertTextAfter()?d.insertAfter(_):h.insertAfter(_)),_.select(0,0),d=_,t!=="")return void this.insertText(t)}else if(this.isCollapsed()&&a===0&&(ut(d)||!d.canInsertTextBefore()||!h.canInsertTextBefore()&&d.getPreviousSibling()===null)){let _=d.getPreviousSibling();if($(_)&&!ut(_)||(_=fe(),_.setFormat(o),h.canInsertTextBefore()?d.insertBefore(_):h.insertBefore(_)),_.select(),d=_,t!=="")return void this.insertText(t)}else if(d.isSegmented()&&a!==g){const _=fe(d.getTextContent());_.setFormat(o),d.replace(_),d=_}else if(!this.isCollapsed()&&t!==""){const _=p.getParent();if(!h.canInsertTextBefore()||!h.canInsertTextAfter()||N(_)&&(!_.canInsertTextBefore()||!_.canInsertTextAfter()))return this.insertText(""),_u(this.anchor,this.focus,null),void this.insertText(t)}if(f===1){if(nn(d)){const C=fe(t);return C.select(),void d.replace(C)}const _=d.getFormat(),y=d.getStyle();if(a!==c||_===o&&y===s){if(Ei(d)){const C=fe(t);return C.setFormat(o),C.setStyle(s),C.select(),void d.replace(C)}}else{if(d.getTextContent()!==""){const C=fe(t);if(C.setFormat(o),C.setStyle(s),C.select(),a===0)d.insertBefore(C,!1);else{const[S]=d.splitText(a);S.insertAfter(C,!1)}return void(C.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length))}d.setFormat(o),d.setStyle(s)}const m=c-a;d=d.spliceText(a,m,t,!0),d.getTextContent()===""?d.remove():this.anchor.type==="text"&&(d.isComposing()?this.anchor.offset-=t.length:(this.format=_,this.style=y))}else{const _=new Set([...d.getParentKeys(),...p.getParentKeys()]),y=N(d)?d:d.getParentOrThrow();let m=N(p)?p:p.getParentOrThrow(),C=p;if(!y.is(m)&&m.isInline())do C=m,m=m.getParentOrThrow();while(m.isInline());if(l.type==="text"&&(c!==0||p.getTextContent()==="")||l.type==="element"&&p.getIndexWithinParent()<c)if($(p)&&!nn(p)&&c!==p.getTextContentSize()){if(p.isSegmented()){const E=fe(p.getTextContent());p.replace(E),p=E}pe(l.getNode())||l.type!=="text"||(p=p.spliceText(0,c,"")),_.add(p.__key)}else{const E=p.getParentOrThrow();E.canBeEmpty()||E.getChildrenSize()!==1?p.remove():E.remove()}else _.add(p.__key);const S=m.getChildren(),w=new Set(u),x=y.is(m),v=y.isInline()&&d.getNextSibling()===null?y:d;for(let E=S.length-1;E>=0;E--){const T=S[E];if(T.is(d)||N(T)&&T.isParentOf(d))break;T.isAttached()&&(!w.has(T)||T.is(C)?x||v.insertAfter(T,!1):T.remove())}if(!x){let E=m,T=null;for(;E!==null;){const k=E.getChildren(),D=k.length;(D===0||k[D-1].is(T))&&(_.delete(E.__key),T=E),E=E.getParent()}}if(nn(d))if(a===g)d.select();else{const E=fe(t);E.select(),d.replace(E)}else d=d.spliceText(a,g-a,t,!0),d.getTextContent()===""?d.remove():d.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=t.length);for(let E=1;E<f;E++){const T=u[E],k=T.__key;_.has(k)||T.remove()}}}removeText(){const t=M()===this;po(this,Fh(si(this))),t&&M()!==this&&ne(this)}formatText(t,e=null){if(this.isCollapsed())return this.toggleFormat(t),void Ee(null);const r=this.getNodes(),o=[];for(const S of r)$(S)&&o.push(S);const s=S=>{r.forEach(w=>{if(N(w)){const x=w.getFormatFlags(t,S);w.setTextFormat(x)}})},i=o.length;if(i===0)return this.toggleFormat(t),Ee(null),void s(e);const l=this.anchor,a=this.focus,c=this.isBackward(),u=c?a:l,f=c?l:a;let d=0,g=o[0],h=u.type==="element"?0:u.offset;if(u.type==="text"&&h===g.getTextContentSize()&&(d=1,g=o[1],h=0),g==null)return;const p=g.getFormatFlags(t,e);s(p);const _=i-1;let y=o[_];const m=f.type==="text"?f.offset:y.getTextContentSize();if(g.is(y)){if(h===m)return;if(ut(g)||h===0&&m===g.getTextContentSize())g.setFormat(p);else{const S=g.splitText(h,m),w=h===0?S[0]:S[1];w.setFormat(p),u.type==="text"&&u.set(w.__key,0,"text"),f.type==="text"&&f.set(w.__key,m-h,"text")}return void(this.format=p)}h===0||ut(g)||([,g]=g.splitText(h),h=0),g.setFormat(p);const C=y.getFormatFlags(t,p);m>0&&(m===y.getTextContentSize()||ut(y)||([y]=y.splitText(m)),y.setFormat(C));for(let S=d+1;S<_;S++){const w=o[S],x=w.getFormatFlags(t,C);w.setFormat(x)}u.type==="text"&&u.set(g.__key,h,"text"),f.type==="text"&&f.set(y.__key,m,"text"),this.format=p|C}insertNodes(t){if(t.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();const h=M();return O(h)||A(134),h.insertNodes(t)}const e=(this.isBackward()?this.focus:this.anchor).getNode(),r=z(e,qe),o=t[t.length-1];if(N(r)&&"__language"in r){if("__language"in t[0])this.insertText(t[0].getTextContent());else{const h=_s(this);r.splice(h,0,t),o.selectEnd()}return}if(!t.some(h=>(N(h)||q(h))&&!h.isInline())){N(r)||A(211,e.constructor.name,e.getType());const h=_s(this);return r.splice(h,0,t),void o.selectEnd()}const s=(function(h){const p=j();let _=null;for(let y=0;y<h.length;y++){const m=h[y],C=_t(m);if(C||q(m)&&m.isInline()||N(m)&&m.isInline()||$(m)||m.isParentRequired()){if(_===null&&(_=m.createParentElementNode(),p.append(_),C))continue;_!==null&&_.append(m)}else p.append(m),_=null}return p})(t),i=s.getLastDescendant(),l=s.getChildren(),a=!N(r)||!r.isEmpty()?this.insertParagraph():null,c=l[l.length-1];let u=l[0];var f;N(f=u)&&qe(f)&&!f.isEmpty()&&N(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(N(r)||A(211,e.constructor.name,e.getType()),r.append(...u.getChildren()),u=l[1]),u&&(r===null&&A(212,e.constructor.name,e.getType()),(function(h,p){const _=p.getParentOrThrow().getLastChild();let y=p;const m=[p];for(;y!==_;)y.getNextSibling()||A(140),y=y.getNextSibling(),m.push(y);let C=h;for(const S of m)C=C.insertAfter(S)})(r,u));const d=z(i,qe);a&&N(d)&&(a.canMergeWhenEmpty()||qe(c))&&(d.append(...a.getChildren()),a.remove()),N(r)&&r.isEmpty()&&r.remove(),i.selectEnd();const g=N(r)?r.getLastChild():null;_t(g)&&d!==r&&g.remove()}insertParagraph(){if(this.anchor.key==="root"){const i=j();return Q().splice(this.anchor.offset,0,[i]),i.select(),i}const t=_s(this),e=z(this.anchor.getNode(),qe);N(e)||A(213);const r=e.getChildAtIndex(t),o=r?[r,...r.getNextSiblings()]:[],s=e.insertNewAfter(this,!1);return s?(s.append(...o),s.selectStart(),s):null}insertLineBreak(t){const e=qt();if(this.insertNodes([e]),t){const r=e.getParentOrThrow(),o=e.getIndexWithinParent();r.select(o,o)}}extract(){const t=[...this.getNodes()],e=t.length;let r=t[0],o=t[e-1];const[s,i]=Ys(this),l=this.isBackward(),[a,c]=l?[this.focus,this.anchor]:[this.anchor,this.focus],[u,f]=l?[i,s]:[s,i];if(e===0)return[];if(e===1){if($(r)&&!this.isCollapsed()){const d=r.splitText(u,f),g=u===0?d[0]:d[1];return g?(a.set(g.getKey(),0,"text"),c.set(g.getKey(),g.getTextContentSize(),"text"),[g]):[]}return[r]}if($(r)&&(u===r.getTextContentSize()?t.shift():u!==0&&([,r]=r.splitText(u),t[0]=r,a.set(r.getKey(),0,"text"))),$(o)){const d=o.getTextContent().length;f===0?t.pop():f!==d&&([o]=o.splitText(f),t[t.length-1]=o,c.set(o.getKey(),o.getTextContentSize(),"text"))}return t}modify(t,e,r){if(Ql(this,t,e,r))return;const o=t==="move",s=ue(),i=et(Qe(s));if(!i)return;const l=s._blockCursorElement,a=s._rootElement,c=this.focus.getNode();if(a===null||l===null||!N(c)||c.isInline()||c.canBeEmpty()||ti(l,s,a),this.dirty){let u=fn(s,this.anchor.key),f=fn(s,this.focus.key);this.anchor.type==="text"&&(u=Hn(u)),this.focus.type==="text"&&(f=Hn(f)),u&&f&&Cu(i,u,this.anchor.offset,f,this.focus.offset)}if((function(u,f,d,g){u.modify(f,d,g)})(i,t,e?"backward":"forward",r),i.rangeCount>0){const u=i.getRangeAt(0),f=this.anchor.getNode(),d=pe(f)?f:Th(f);if(this.applyDOMRange(u),this.dirty=!0,!o){const g=this.getNodes(),h=[];let p=!1;for(let _=0;_<g.length;_++){const y=g[_];ei(y,d)?h.push(y):p=!0}if(p&&h.length>0)if(e){const _=h[0];N(_)?_.selectStart():_.getParentOrThrow().selectStart()}else{const _=h[h.length-1];N(_)?_.selectEnd():_.getParentOrThrow().selectEnd()}i.anchorNode===u.startContainer&&i.anchorOffset===u.startOffset||(function(_){const y=_.focus,m=_.anchor,C=m.key,S=m.offset,w=m.type;m.set(y.key,y.offset,y.type,!0),y.set(C,S,w,!0)})(this)}}r==="lineboundary"&&Ql(this,t,e,r,"decorators")}forwardDeletion(t,e,r){if(!r&&(t.type==="element"&&N(e)&&t.offset===e.getChildrenSize()||t.type==="text"&&t.offset===e.getTextContentSize())){const o=e.getParent(),s=e.getNextSibling()||(o===null?null:o.getNextSibling());if(N(s)&&s.isShadowRoot())return!0}return!1}deleteCharacter(t){const e=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let o=r.getNode();if(this.forwardDeletion(r,o,t))return;const s=Ji(xt(r,t?"previous":"next"));if(s.getTextSlices().every(l=>l===null||l.distance===0)){let l={type:"initial"};for(const a of s.iterNodeCarets("shadowRoot"))if(Ge(a)){if(!a.origin.isInline()){if(a.origin.isShadowRoot()){if(l.type==="merge-block")break;if(N(s.anchor.origin)&&s.anchor.origin.isEmpty()){const c=Xe(a);po(this,At(c,c)),s.anchor.origin.remove()}return}l.type!=="merge-next-block"&&l.type!=="merge-block"||(l={block:l.block,caret:a,type:"merge-block"})}}else{if(l.type==="merge-block")break;if(pn(a)){if(N(a.origin)){if(a.origin.isInline()){if(!a.origin.isParentOf(s.anchor.origin))break}else l={block:a.origin,type:"merge-next-block"};continue}if(q(a.origin)){if(!a.origin.isIsolated())if(l.type==="merge-next-block"&&(a.origin.isKeyboardSelectable()||!a.origin.isInline())&&N(s.anchor.origin)&&s.anchor.origin.isEmpty()){s.anchor.origin.remove();const c=qo();c.add(a.origin.getKey()),ne(c)}else a.origin.remove();return}break}}if(l.type==="merge-block"){const{caret:a,block:c}=l;return po(this,At(!a.origin.isEmpty()&&c.isEmpty()?Ur(me(c,a.direction)):s.anchor,a)),this.removeText()}}const i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&r.offset===0&&Vl(this,r.getNode()))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)||t&&a!==c||!t&&a!==0)return void ql(l,t,a)}else if(o!==null&&o.isSegmented()){const a=r.offset,c=o.getTextContentSize();if(o.is(l)||t&&a!==0||!t&&a!==c)return void ql(o,t,a)}(function(a,c){const u=a.anchor,f=a.focus,d=u.getNode(),g=f.getNode();if(d===g&&u.type==="text"&&f.type==="text"){const h=u.offset,p=f.offset,_=h<p,y=_?h:p,m=_?p:h,C=m-1;y!==C&&(function(S){return!(Ru(S)||ch(S))})(d.getTextContent().slice(y,m))&&(c?f.set(f.key,C,f.type):u.set(u.key,C,u.type))}})(this,t)}}if(this.removeText(),t&&!e&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&pe(r.getParent())&&r.getPreviousSibling()===null&&Vl(this,r)}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText()}deleteWord(t){if(this.isCollapsed()){const e=this.anchor,r=e.getNode();if(this.forwardDeletion(e,r,t))return;this.modify("extend",t,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function he(n){return n instanceof Vo}function Jl(n){const t=n.offset;if(n.type==="text")return t;const e=n.getNode();return t===e.getChildrenSize()?e.getTextContent().length:0}function Ys(n){const t=n.getStartEndPoints();if(t===null)return[0,0];const[e,r]=t;return e.type==="element"&&r.type==="element"&&e.key===r.key&&e.offset===r.offset?[0,0]:[Jl(e),Jl(r)]}function Vl(n,t){for(let e=t;e;e=e.getParent()){if(N(e)){if(e.collapseAtStart(n))return!0;if(We(e))break}if(e.getPreviousSibling())break}return!1}const ch=(()=>{try{const n=new RegExp("\\p{Emoji}","u"),t=n.test.bind(n);if(t("❤️")&&t("#️⃣")&&t("👍"))return t}catch{}return()=>!1})();function ql(n,t,e){const r=n,o=r.getTextContent().split(/(?=\s)/g),s=o.length;let i=0,l=0;for(let c=0;c<s;c++){const u=c===s-1;if(l=i,i+=o[c].length,t&&i===e||i>e||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 Yl(n,t,e,r){let o,s=t;if(se(n)){let i=!1;const l=n.childNodes,a=l.length,c=r._blockCursorElement;s===a&&(i=!0,s=a-1);let u=l[s],f=!1;if(u===c)u=l[s+1],f=!0;else if(c!==null){const d=c.parentNode;n===d&&t>Array.prototype.indexOf.call(d.children,c)&&s--}if(o=Dn(u),$(o))s=yt(o,i?"next":"previous");else{let d=Dn(n);if(d===null)return null;if(N(d)){const g=r.getElementByKey(d.getKey());g===null&&A(214),[d,s]=d.getDOMSlot(g).resolveChildIndex(d,g,n,t),N(d)||A(215),i&&s>=d.getChildrenSize()&&(s=Math.max(0,d.getChildrenSize()-1));let p=d.getChildAtIndex(s);if(N(p)&&(function(_,y,m){const C=_.getParent();return m===null||C===null||!C.canBeEmpty()||C!==m.getNode()})(p,0,e)){const _=i?p.getLastDescendant():p.getFirstDescendant();_===null?d=p:(p=_,d=N(p)?p:p.getParentOrThrow()),s=0}$(p)?(o=p,d=null,s=yt(p,i?"next":"previous")):p!==d&&i&&!f&&(N(d)||A(216),s=Math.min(d.getChildrenSize(),s+1))}else{const g=d.getIndexWithinParent();s=t===0&&q(d)&&Dn(n)===d?g:g+1,d=d.getParentOrThrow()}if(N(d))return De(d.__key,s,"element")}}else o=Dn(n);return $(o)?De(o.__key,yt(o,s,"clamp"),"text"):null}function Xl(n,t,e){const r=n.offset,o=n.getNode();if(r===0){const s=o.getPreviousSibling(),i=o.getParent();if(t){if((e||!t)&&s===null&&N(i)&&i.isInline()){const l=i.getPreviousSibling();$(l)&&n.set(l.__key,l.getTextContent().length,"text")}}else N(s)&&!e&&s.isInline()?n.set(s.__key,s.getChildrenSize(),"element"):$(s)&&n.set(s.__key,s.getTextContent().length,"text")}else if(r===o.getTextContent().length){const s=o.getNextSibling(),i=o.getParent();if(t&&N(s)&&s.isInline())n.set(s.__key,0,"element");else if((e||t)&&s===null&&N(i)&&i.isInline()&&!i.canInsertTextAfter()){const l=i.getNextSibling();$(l)&&n.set(l.__key,0,"text")}}}function _u(n,t,e){if(n.type==="text"&&t.type==="text"){const r=n.isBefore(t),o=n.is(t);Xl(n,r,o),Xl(t,!r,o),o&&t.set(n.key,n.offset,n.type);const s=ue();if(s.isComposing()&&s._compositionKey!==n.key&&O(e)){const i=e.anchor,l=e.focus;n.set(i.key,i.offset,i.type,!0),t.set(l.key,l.offset,l.type,!0)}}}function mu(n,t,e,r,o,s){if(n===null||e===null||!Wr(o,n,e))return null;const i=Yl(n,t,O(s)?s.anchor:null,o);if(i===null)return null;const l=Yl(e,r,O(s)?s.focus:null,o);if(l===null)return null;if(i.type==="element"&&l.type==="element"){const a=Dn(n),c=Dn(e);if(q(a)&&q(c))return null}return _u(i,l,s),[i,l]}function Xs(n){return N(n)&&!n.isInline()}function yu(n,t,e,r,o,s){const i=Ft(),l=new yn(De(n,t,o),De(e,r,s),0,"");return l.dirty=!0,i._selection=l,l}function Gn(){const n=De("root",0,"element"),t=De("root",0,"element");return new yn(n,t,0,"")}function qo(){return new Vo(new Set)}function uh(n,t){return Yo(null,n,t,null)}function Yo(n,t,e,r){const o=e._window;if(o===null)return null;const s=r||o.event,i=s?s.type:void 0,l=i==="selectionchange",a=!As&&(l||i==="beforeinput"||i==="compositionstart"||i==="compositionend"||i==="click"&&s&&s.detail===3||i==="drop"||i===void 0);let c,u,f,d;if(O(n)&&!a)return n.clone();if(t===null)return null;if(c=t.anchorNode,u=t.focusNode,f=t.anchorOffset,d=t.focusOffset,(l||i===void 0)&&O(n)&&!Wr(e,c,u))return n.clone();const g=mu(c,f,u,d,e,n);if(g===null)return null;const[h,p]=g;return new yn(h,p,O(n)?n.format:0,O(n)?n.style:"")}function M(){return Ft()._selection}function Dt(){return ue()._editorState._selection}function To(n,t,e,r=1){const o=n.anchor,s=n.focus,i=o.getNode(),l=s.getNode();if(!t.is(i)&&!t.is(l))return;const a=t.__key;if(n.isCollapsed()){const c=o.offset;if(e<=c&&r>0||e<c&&r<0){const u=Math.max(0,c+r);o.set(a,u,"element"),s.set(a,u,"element"),Gl(n)}}else{const c=n.isBackward(),u=c?s:o,f=u.getNode(),d=c?o:s,g=d.getNode();if(t.is(f)){const h=u.offset;(e<=h&&r>0||e<h&&r<0)&&u.set(a,Math.max(0,h+r),"element")}if(t.is(g)){const h=d.offset;(e<=h&&r>0||e<h&&r<0)&&d.set(a,Math.max(0,h+r),"element")}}Gl(n)}function Gl(n){const t=n.anchor,e=t.offset,r=n.focus,o=r.offset,s=t.getNode(),i=r.getNode();if(n.isCollapsed()){if(!N(s))return;const l=s.getChildrenSize(),a=e>=l,c=a?s.getChildAtIndex(l-1):s.getChildAtIndex(e);if($(c)){let u=0;a&&(u=c.getTextContentSize()),t.set(c.__key,u,"text"),r.set(c.__key,u,"text")}return}if(N(s)){const l=s.getChildrenSize(),a=e>=l,c=a?s.getChildAtIndex(l-1):s.getChildAtIndex(e);if($(c)){let u=0;a&&(u=c.getTextContentSize()),t.set(c.__key,u,"text")}}if(N(i)){const l=i.getChildrenSize(),a=o>=l,c=a?i.getChildAtIndex(l-1):i.getChildAtIndex(o);if($(c)){let u=0;a&&(u=c.getTextContentSize()),r.set(c.__key,u,"text")}}}function No(n,t,e,r,o){let s=null,i=0,l=null;r!==null?(s=r.__key,$(r)?(i=r.getTextContentSize(),l="text"):N(r)&&(i=r.getChildrenSize(),l="element")):o!==null&&(s=o.__key,$(o)?l="text":N(o)&&(l="element")),s!==null&&l!==null?n.set(s,i,l):(i=t.getIndexWithinParent(),i===-1&&(i=e.getChildrenSize()),n.set(e.__key,i,"element"))}function Zl(n,t,e,r,o){n.type==="text"?n.set(e,n.offset+(t?0:o),"text"):n.offset>r.getIndexWithinParent()&&n.set(n.key,n.offset-1,"element")}function Cu(n,t,e,r,o){try{n.setBaseAndExtent(t,e,r,o)}catch{}}function dh(n,t,e,r,o,s,i){const l=r.anchorNode,a=r.focusNode,c=r.anchorOffset,u=r.focusOffset,f=document.activeElement;if(o.has(fu)&&f!==s||f!==null&&$i(f))return;if(!O(t))return void(n!==null&&Wr(e,l,a)&&r.removeAllRanges());const d=t.anchor,g=t.focus,h=d.key,p=g.key,_=fn(e,h),y=fn(e,p),m=d.offset,C=g.offset,S=t.format,w=t.style,x=t.isCollapsed();let v=_,E=y,T=!1;if(d.type==="text"){v=Hn(_);const U=d.getNode();T=U.getFormat()!==S||U.getStyle()!==w}else O(n)&&n.anchor.type==="text"&&(T=!0);var k,D,P,R,I;if(g.type==="text"&&(E=Hn(y)),v!==null&&E!==null&&(x&&(n===null||T||O(n)&&(n.format!==S||n.style!==w))&&(k=S,D=w,P=m,R=h,I=performance.now(),su=[k,D,P,R,I]),c!==m||u!==C||l!==v||a!==E||r.type==="Range"&&x||(f!==null&&s.contains(f)||o.has(th)||s.focus({preventScroll:!0}),d.type==="element"))){if(Cu(r,v,m,E,C),!o.has(hu)&&t.isCollapsed()&&s!==null&&s===document.activeElement){const U=O(t)&&t.anchor.type==="element"?v.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(U!==null){let H;if(U instanceof Text){const G=document.createRange();G.selectNode(U),H=G.getBoundingClientRect()}else H=U.getBoundingClientRect();(function(G,re,ee){const He=Ku(ee),be=Ki(He);if(He===null||be===null)return;let{top:we,bottom:Le}=re,It=0,it=0,je=ee;for(;je!==null;){const Nn=je===He.body;if(Nn)It=0,it=Qe(G).innerHeight;else{const lt=je.getBoundingClientRect();It=lt.top,it=lt.bottom}let Xt=0;if(we<It?Xt=-(It-we):Le>it&&(Xt=Le-it),Xt!==0)if(Nn)be.scrollBy(0,Xt);else{const lt=je.scrollTop;je.scrollTop+=Xt;const Gt=je.scrollTop-lt;we-=Gt,Le-=Gt}if(Nn)break;je=zr(je)}})(e,H,s)}}Js=!0}}function Su(n){let t=M()||Dt();t===null&&(t=Q().selectEnd()),t.insertNodes(n)}function _s(n){let t=n;n.isCollapsed()||t.removeText();const e=M();O(e)&&(t=e),O(t)||A(161);const r=t.anchor;let o=r.getNode(),s=r.offset;for(;!qe(o);){const i=o;if([o,s]=fh(o,s),i.is(o))break}return s}function fh(n,t){const e=n.getParent();if(!e){const o=j();return Q().append(o),o.select(),[Q(),0]}if($(n)){const o=n.splitText(t);if(o.length===0)return[e,n.getIndexWithinParent()];const s=t===0?0:1;return[e,o[0].getIndexWithinParent()+s]}if(!N(n)||t===0)return[e,n.getIndexWithinParent()];const r=n.getChildAtIndex(t);if(r){const o=new yn(De(n.__key,t,"element"),De(n.__key,t,"element"),0,""),s=n.insertNewAfter(o);s&&s.append(r,...r.getNextSiblings())}return[e,n.getIndexWithinParent()+1]}function Ql(n,t,e,r,o="decorators-and-blocks"){if(t==="move"&&r==="character"&&!n.isCollapsed()){const[u,f]=e===n.isBackward()?[n.focus,n.anchor]:[n.anchor,n.focus];return f.set(u.key,u.offset,u.type),!0}const s=xt(n.focus,e?"previous":"next"),i=r==="lineboundary",l=t==="move";let a=s,c=o==="decorators-and-blocks";if(!Yu(a)){for(const u of a){c=!1;const{origin:f}=u;if(!q(f)||f.isIsolated()||(a=u,!i||!f.isInline()))break}if(c)for(const u of Ji(s).iterNodeCarets(t==="extend"?"shadowRoot":"root")){if(Ge(u))u.origin.isInline()||(a=u);else{if(N(u.origin))continue;q(u.origin)&&!u.origin.isInline()&&(a=u)}break}}if(a===s)return!1;if(l&&!i&&q(a.origin)&&a.origin.isKeyboardSelectable()){const u=qo();return u.add(a.origin.getKey()),ne(u),!0}return a=Xe(a),l&&Nr(n.anchor,a),Nr(n.focus,a),c||!i}let Te=null,Ne=null,Be=!1,ms=!1,ho=0;const ea={characterData:!0,childList:!0,subtree:!0};function Cn(){return Be||Te!==null&&Te._readOnly}function ve(){Be&&A(13)}function xu(){ho>99&&A(14)}function Ft(){return Te===null&&A(195,bu()),Te}function ue(){return Ne===null&&A(196,bu()),Ne}function bu(){let n=0;const t=new Set,e=dn.version;if(typeof window<"u")for(const o of document.querySelectorAll("[contenteditable]")){const s=Qo(o);if(Ri(s))n++;else if(s){let i=String(s.constructor.version||"<0.17.1");i===e&&(i+=" (separately built, likely a bundler configuration issue)"),t.add(i)}}let r=` Detected on the page: ${n} compatible editor(s) with version ${e}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),r}function hh(){return Ne}function ta(n,t,e){const r=t.__type,o=Eu(n,r);let s=e.get(r);s===void 0&&(s=Array.from(o.transforms),e.set(r,s));const i=s.length;for(let l=0;l<i&&(s[l](t),t.isAttached());l++);}function na(n,t){return n!==void 0&&n.__key!==t&&n.isAttached()}function wu(n,t){if(!t)return;const e=n._updateTags;let r=t;Array.isArray(t)||(r=[t]);for(const o of r)e.add(o)}function gh(n){return ki(n,ue()._nodes)}function ki(n,t){const e=n.type,r=t.get(e);r===void 0&&A(17,e);const o=r.klass;n.type!==o.getType()&&A(18,o.name);const s=o.importJSON(n),i=n.children;if(N(s)&&Array.isArray(i))for(let l=0;l<i.length;l++){const a=ki(i[l],t);s.append(a)}return s}function ra(n,t,e){const r=Te,o=Be,s=Ne;Te=t,Be=!0,Ne=n;try{return e()}finally{Te=r,Be=o,Ne=s}}function Et(n,t){const e=n._pendingEditorState,r=n._rootElement,o=n._headless||r===null;if(e===null)return;const s=n._editorState,i=s._selection,l=e._selection,a=n._dirtyType!==0,c=Te,u=Be,f=Ne,d=n._updating,g=n._observer;let h=null;if(n._pendingEditorState=null,n._editorState=e,!o&&a&&g!==null){Ne=n,Te=e,Be=!1,n._updating=!0;try{const x=n._dirtyType,v=n._dirtyElements,E=n._dirtyLeaves;g.disconnect(),h=qf(s,e,n,x,v,E)}catch(x){if(x instanceof Error&&n._onError(x),ms)throw x;return Nu(n,null,r,e),Bc(n),n._dirtyType=2,ms=!0,Et(n,s),void(ms=!1)}finally{g.observe(r,ea),n._updating=d,Te=c,Be=u,Ne=f}}e._readOnly||(e._readOnly=!0);const p=n._dirtyLeaves,_=n._dirtyElements,y=n._normalizedNodes,m=n._updateTags,C=n._deferred;a&&(n._dirtyType=0,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements=new Map,n._normalizedNodes=new Set,n._updateTags=new Set),(function(x,v){const E=x._decorators;let T=x._pendingDecorators||E;const k=v._nodeMap;let D;for(D in T)k.has(D)||(T===E&&(T=Au(x)),delete T[D])})(n,e);const S=o?null:et(Qe(n));if(n._editable&&S!==null&&(a||l===null||l.dirty||!l.is(i))&&r!==null&&!m.has(eh)){Ne=n,Te=e;try{if(g!==null&&g.disconnect(),a||l===null||l.dirty){const x=n._blockCursorElement;x!==null&&ti(x,n,r),dh(i,l,n,S,m,r)}(function(x,v,E){let T=x._blockCursorElement;if(O(E)&&E.isCollapsed()&&E.anchor.type==="element"&&v.contains(document.activeElement)){const k=E.anchor,D=k.getNode(),P=k.offset;let R=!1,I=null;if(P===D.getChildrenSize())Cs(D.getChildAtIndex(P-1))&&(R=!0);else{const U=D.getChildAtIndex(P);if(U!==null&&Cs(U)){const H=U.getPreviousSibling();(H===null||Cs(H))&&(R=!0,I=x.getElementByKey(U.__key))}}if(R){const U=x.getElementByKey(D.__key);return T===null&&(x._blockCursorElement=T=(function(H){const G=H.theme,re=document.createElement("div");re.contentEditable="false",re.setAttribute("data-lexical-cursor","true");let ee=G.blockCursor;if(ee!==void 0){if(typeof ee=="string"){const He=$c(ee);ee=G.blockCursor=He}ee!==void 0&&re.classList.add(...ee)}return re})(x._config)),v.style.caretColor="transparent",void(I===null?U.appendChild(T):U.insertBefore(T,I))}}T!==null&&ti(T,x,v)})(n,r,l)}finally{g!==null&&g.observe(r,ea),Ne=f,Te=c}}h!==null&&(function(x,v,E,T,k){const D=Array.from(x._listeners.mutation),P=D.length;for(let R=0;R<P;R++){const[I,U]=D[R];for(const H of U){const G=v.get(H);G!==void 0&&I(G,{dirtyLeaves:T,prevEditorState:k,updateTags:E})}}})(n,h,m,p,s),O(l)||l===null||i!==null&&i.is(l)||n.dispatchCommand(Bt,void 0);const w=n._pendingDecorators;w!==null&&(n._decorators=w,n._pendingDecorators=null,_r("decorator",n,!0,w)),(function(x,v,E){const T=aa(v),k=aa(E);T!==k&&_r("textcontent",x,!0,k)})(n,t||s,e),_r("update",n,!0,{dirtyElements:_,dirtyLeaves:p,editorState:e,mutatedNodes:h,normalizedNodes:y,prevEditorState:t||s,tags:m}),(function(x,v){if(x._deferred=[],v.length!==0){const E=x._updating;x._updating=!0;try{for(let T=0;T<v.length;T++)v[T]()}finally{x._updating=E}}})(n,C),(function(x){const v=x._updates;if(v.length!==0){const E=v.shift();if(E){const[T,k]=E;Xo(x,T,k)}}})(n)}function _r(n,t,e,...r){const o=t._updating;t._updating=e;try{const s=Array.from(t._listeners[n]);for(let i=0;i<s.length;i++)s[i].apply(null,r)}finally{t._updating=o}}function oa(n,t){const e=n._updates;let r=t||!1;for(;e.length!==0;){const o=e.shift();if(o){const[s,i]=o,l=n._pendingEditorState;let a;i!==void 0&&(a=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete&&(l===null&&A(191),l._flushSync=!0),a&&n._deferred.push(a),wu(n,i.tag)),l==null?Xo(n,s,i):s()}}return r}function Xo(n,t,e){const r=n._updateTags;let o,s=!1,i=!1;e!==void 0&&(o=e.onUpdate,wu(n,e.tag),s=e.skipTransforms||!1,i=e.discrete||!1),o&&n._deferred.push(o);const l=n._editorState;let a=n._pendingEditorState,c=!1;(a===null||a._readOnly)&&(a=n._pendingEditorState=vu(a||l),c=!0),a._flushSync=i;const u=Te,f=Be,d=Ne,g=n._updating;Te=a,Be=!1,n._updating=!0,Ne=n;const h=n._headless||n.getRootElement()===null;Ai(null);try{c&&(h?l._selection!==null&&(a._selection=l._selection.clone()):a._selection=(function(m,C){const S=m.getEditorState()._selection,w=et(Qe(m));return O(S)||S==null?Yo(S,w,m,C):S.clone()})(n,e&&e.event||null));const _=n._compositionKey;t(),s=oa(n,s),(function(m,C){const S=C.getEditorState()._selection,w=m._selection;if(O(w)){const x=w.anchor,v=w.focus;let E;if(x.type==="text"&&(E=x.getNode(),E.selectionTransform(S,w)),v.type==="text"){const T=v.getNode();E!==T&&T.selectionTransform(S,w)}}})(a,n),n._dirtyType!==0&&(s?(function(m,C){const S=C._dirtyLeaves,w=m._nodeMap;for(const x of S){const v=w.get(x);$(v)&&v.isAttached()&&v.isSimpleText()&&!v.isUnmergeable()&&Dl(v)}})(a,n):(function(m,C){const S=C._dirtyLeaves,w=C._dirtyElements,x=m._nodeMap,v=Wt(),E=new Map;let T=S,k=T.size,D=w,P=D.size;for(;k>0||P>0;){if(k>0){C._dirtyLeaves=new Set;for(const R of T){const I=x.get(R);$(I)&&I.isAttached()&&I.isSimpleText()&&!I.isUnmergeable()&&Dl(I),I!==void 0&&na(I,v)&&ta(C,I,E),S.add(R)}if(T=C._dirtyLeaves,k=T.size,k>0){ho++;continue}}C._dirtyLeaves=new Set,C._dirtyElements=new Map,D.delete("root")&&D.set("root",!0);for(const R of D){const I=R[0],U=R[1];if(w.set(I,U),!U)continue;const H=x.get(I);H!==void 0&&na(H,v)&&ta(C,H,E)}T=C._dirtyLeaves,k=T.size,D=C._dirtyElements,P=D.size,ho++}C._dirtyLeaves=S,C._dirtyElements=w})(a,n),oa(n),(function(m,C,S,w){const x=m._nodeMap,v=C._nodeMap,E=[];for(const[T]of w){const k=v.get(T);k!==void 0&&(k.isAttached()||(N(k)&&Pc(k,T,x,v,E,w),x.has(T)||w.delete(T),E.push(T)))}for(const T of E)v.delete(T);for(const T of S){const k=v.get(T);k===void 0||k.isAttached()||(x.has(T)||S.delete(T),v.delete(T))}})(l,a,n._dirtyLeaves,n._dirtyElements)),_!==n._compositionKey&&(a._flushSync=!0);const y=a._selection;if(O(y)){const m=a._nodeMap,C=y.anchor.key,S=y.focus.key;m.get(C)!==void 0&&m.get(S)!==void 0||A(19)}else he(y)&&y._nodes.size===0&&(a._selection=null)}catch(_){return _ instanceof Error&&n._onError(_),n._pendingEditorState=l,n._dirtyType=2,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),void Et(n)}finally{Te=u,Be=f,Ne=d,n._updating=g,ho=0}n._dirtyType!==0||n._deferred.length>0||(function(_,y){const m=y.getEditorState()._selection,C=_._selection;if(C!==null){if(C.dirty||!C.is(m))return!0}else if(m!==null)return!0;return!1})(a,n)?a._flushSync?(a._flushSync=!1,Et(n)):c&&Ch(()=>{Et(n)}):(a._flushSync=!1,c&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function Je(n,t,e){Ne===n&&e===void 0?t():Xo(n,t,e)}class mr{constructor(t,e,r){b(this,"element");b(this,"before");b(this,"after");this.element=t,this.before=e||null,this.after=r||null}withBefore(t){return new mr(this.element,t,this.after)}withAfter(t){return new mr(this.element,this.before,t)}withElement(t){return this.element===t?this:new mr(t,this.before,this.after)}insertChild(t){const e=this.before||this.getManagedLineBreak();return e!==null&&e.parentElement!==this.element&&A(222),this.element.insertBefore(t,e),this}removeChild(t){return t.parentElement!==this.element&&A(223),this.element.removeChild(t),this}replaceChild(t,e){return e.parentElement!==this.element&&A(224),this.element.replaceChild(t,e),this}getFirstChild(){const t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(t===null)this.removeManagedLineBreak();else{const e=t==="decorator"&&(br||Wn||xr);this.insertManagedLineBreak(e)}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,r=t.nodeName==="IMG"?t.nextSibling:null;r&&e.removeChild(r),e.removeChild(t),e.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===(e.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,o=this.before,s=document.createElement("br");if(r.insertBefore(s,o),t){const i=document.createElement("img");i.setAttribute("data-lexical-linebreak","true"),i.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",i.alt="",r.insertBefore(i,s),r.__lexicalLineBreak=i}else r.__lexicalLineBreak=s}getFirstChildOffset(){let t=0;for(let e=this.after;e!==null;e=e.previousSibling)t++;return t}resolveChildIndex(t,e,r,o){if(r===this.element){const a=this.getFirstChildOffset();return[t,Math.min(a+t.getChildrenSize(),Math.max(a,o))]}const s=sa(e,r);s.push(o);const i=sa(e,this.element);let l=t.getIndexWithinParent();for(let a=0;a<i.length;a++){const c=s[a],u=i[a];if(c===void 0||c<u)break;if(c>u){l+=1;break}}return[t.getParentOrThrow(),l]}}function sa(n,t){const e=[];let r=t;for(;r!==n&&r!==null;r=r.parentNode){let o=0;for(let s=r.previousSibling;s!==null;s=s.previousSibling)o++;e.push(o)}return r!==n&&A(225),e.reverse()}class ae extends ot{constructor(e){super(e);b(this,"__first");b(this,"__last");b(this,"__size");b(this,"__format");b(this,"__style");b(this,"__indent");b(this,"__dir");b(this,"__textFormat");b(this,"__textStyle");this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(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,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return Rf[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let r=this.getFirstChild();for(;r!==null;)e.push(r),r=r.getNextSibling();return e}getChildrenKeys(){const e=[];let r=this.getFirstChild();for(;r!==null;)e.push(r.__key),r=r.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=ue()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),r=this.getParentOrThrow().getLastChild();return r!==null&&r.is(e)}getAllTextNodes(){const e=[];let r=this.getFirstChild();for(;r!==null;){if($(r)&&e.push(r),N(r)){const o=r.getAllTextNodes();e.push(...o)}r=r.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;N(e);){const r=e.getFirstChild();if(r===null)break;e=r}return e}getLastDescendant(){let e=this.getLastChild();for(;N(e);){const r=e.getLastChild();if(r===null)break;e=r}return e}getDescendantByIndex(e){const r=this.getChildren(),o=r.length;if(e>=o){const i=r[o-1];return N(i)&&i.getLastDescendant()||i||null}const s=r[e];return N(s)&&s.getFirstDescendant()||s||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:Y(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&A(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:Y(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&A(96,this.__key),e}getChildAtIndex(e){const r=this.getChildrenSize();let o,s;if(e<r/2){for(o=this.getFirstChild(),s=0;o!==null&&s<=e;){if(s===e)return o;o=o.getNextSibling(),s++}return null}for(o=this.getLastChild(),s=r-1;o!==null&&s>=e;){if(s===e)return o;o=o.getPreviousSibling(),s--}return null}getTextContent(){let e="";const r=this.getChildren(),o=r.length;for(let s=0;s<o;s++){const i=r[s];e+=i.getTextContent(),N(i)&&s!==o-1&&!i.isInline()&&(e+=Jt)}return e}getTextContentSize(){let e=0;const r=this.getChildren(),o=r.length;for(let s=0;s<o;s++){const i=r[s];e+=i.getTextContentSize(),N(i)&&s!==o-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==""){const r=El[e];return(this.getFormat()&r)!==0}return!1}hasTextFormat(e){const r=Lt[e];return(this.getTextFormat()&r)!==0}getFormatFlags(e,r){return Eo(this.getLatest().__textFormat,e,r)}getTextStyle(){return this.getLatest().__textStyle}select(e,r){ve();const o=M();let s=e,i=r;const l=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&r===0){const c=this.getFirstChild();if($(c)||N(c))return c.select(0,0)}else if(!(e!==void 0&&e!==l||r!==void 0&&r!==l)){const c=this.getLastChild();if($(c)||N(c))return c.select()}}s===void 0&&(s=l),i===void 0&&(i=l);const a=this.__key;return O(o)?(o.anchor.set(a,s,"element"),o.focus.set(a,i,"element"),o.dirty=!0,o):yu(a,s,a,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(r=>r.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const r=this.getWritable();return r.__dir=e,r}setFormat(e){return this.getWritable().__format=e!==""?El[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){const r=this.getWritable();return r.__textFormat=e,r}setTextStyle(e){const r=this.getWritable();return r.__textStyle=e,r}setIndent(e){return this.getWritable().__indent=e,this}splice(e,r,o){wo(this)&&A(324,this.__key,this.__type);const s=this.getChildrenSize(),i=this.getWritable();e+r<=s||A(226,String(e),String(r),String(s));const l=i.__key,a=[],c=[],u=this.getChildAtIndex(e+r);let f=null,d=s-r+o.length;if(e!==0)if(e===s)f=this.getLastChild();else{const h=this.getChildAtIndex(e);h!==null&&(f=h.getPreviousSibling())}if(r>0){let h=f===null?this.getFirstChild():f.getNextSibling();for(let p=0;p<r;p++){h===null&&A(100);const _=h.getNextSibling(),y=h.__key;Ht(h.getWritable()),c.push(y),h=_}}let g=f;for(const h of o){g!==null&&h.is(g)&&(f=g=g.getPreviousSibling());const p=h.getWritable();p.__parent===l&&d--,Ht(p);const _=h.__key;if(g===null)i.__first=_,p.__prev=null;else{const y=g.getWritable();y.__next=_,p.__prev=y.__key}h.__key===l&&A(76),p.__parent=l,a.push(_),g=h}if(e+r===s)g!==null&&(g.getWritable().__next=null,i.__last=g.__key);else if(u!==null){const h=u.getWritable();if(g!==null){const p=g.getWritable();h.__prev=g.__key,p.__next=u.__key}else h.__prev=null}if(i.__size=d,c.length){const h=M();if(O(h)){const p=new Set(c),_=new Set(a),{anchor:y,focus:m}=h;ia(y,p,_)&&No(y,y.getNode(),this,f,u),ia(m,p,_)&&No(m,m.getNode(),this,f,u),d!==0||this.canBeEmpty()||We(this)||this.remove()}}return i}getDOMSlot(e){return new mr(e)}exportDOM(e){const{element:r}=super.exportDOM(e);if(se(r)){const o=this.getIndent();o>0&&(r.style.paddingInlineStart=40*o+"px");const s=this.getDirection();s&&(r.dir=s)}return{element:r}}exportJSON(){const e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},r=this.getTextFormat(),o=this.getTextStyle();return r!==0&&(e.textFormat=r),o!==""&&(e.textStyle=o),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,r){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,r,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,r){const o=this.getDOMSlot(e);let s=o.getFirstChild();for(let i=this.getFirstChild();i;i=i.getNextSibling()){const l=r.getElementByKey(i.getKey());l!==null&&(s==null?(o.insertChild(l),s=l):s!==l&&o.replaceChild(l,s),s=s.nextSibling)}}}function N(n){return n instanceof ae}function ia(n,t,e){let r=n.getNode();for(;r;){const o=r.__key;if(t.has(o)&&!e.has(o))return!0;r=r.getParent()}return!1}class Kr extends ot{decorate(t,e){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function q(n){return n instanceof Kr}class Sn extends ae{constructor(){super("root");b(this,"__cachedText");this.__cachedText=null}static getType(){return"root"}static clone(){return new Sn}getTopLevelElementOrThrow(){A(51)}getTextContent(){const e=this.__cachedText;return!Cn()&&ue()._dirtyType!==0||e===null?super.getTextContent():e}remove(){A(52)}replace(e){A(53)}insertBefore(e){A(54)}insertAfter(e){A(55)}updateDOM(e,r){return!1}splice(e,r,o){for(const s of o)N(s)||q(s)||A(282);return super.splice(e,r,o)}static importJSON(e){return Q().updateFromJSON(e)}collapseAtStart(){return!0}}function pe(n){return n instanceof Sn}function vu(n){return new Br(new Map(n._nodeMap))}function Oi(){return new Br(new Map([["root",new Sn]]))}function Tu(n){const t=n.exportJSON(),e=n.constructor;if(t.type!==e.getType()&&A(130,e.name),N(n)){const r=t.children;Array.isArray(r)||A(59,e.name);const o=n.getChildren();for(let s=0;s<o.length;s++){const i=Tu(o[s]);r.push(i)}}return t}function ph(n){return n instanceof Br}class Br{constructor(t,e){b(this,"_nodeMap");b(this,"_selection");b(this,"_flushSync");b(this,"_readOnly");this._nodeMap=t,this._selection=e||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(t,e){return ra(e&&e.editor||null,this,t)}clone(t){const e=new Br(this._nodeMap,t===void 0?this._selection:t);return e._readOnly=!0,e}toJSON(){return ra(null,this,()=>({root:Tu(Q())}))}}class Mi extends ae{static getType(){return"artificial"}createDOM(t){return document.createElement("div")}}class xn extends ae{static getType(){return"paragraph"}static clone(t){return new xn(t.__key)}createDOM(t){const e=document.createElement("p"),r=Kn(t.theme,"paragraph");return r!==void 0&&e.classList.add(...r),e}updateDOM(t,e,r){return!1}static importDOM(){return{p:t=>({conversion:_h,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(se(e)){this.isEmpty()&&e.append(document.createElement("br"));const r=this.getFormatType();r&&(e.style.textAlign=r)}return{element:e}}static importJSON(t){return j().updateFromJSON(t)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(t,e){const r=j();r.setTextFormat(t.format),r.setTextStyle(t.style);const o=this.getDirection();return r.setDirection(o),r.setFormat(this.getFormatType()),r.setStyle(this.getStyle()),this.insertAfter(r,e),r}collapseAtStart(){const t=this.getChildren();if(t.length===0||$(t[0])&&t[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 _h(n){const t=j();return n.style&&(t.setFormat(n.style.textAlign),zi(n,t)),{node:t}}function j(){return de(new xn)}function bt(n){return n instanceof xn}const J=0,Ye=1,mh=2,$n=3,Fe=4;function Nu(n,t,e,r){const o=n._keyToDOMMap;o.clear(),n._editorState=Oi(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=0,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,n._updateTags=new Set,n._updates=[],n._blockCursorElement=null;const s=n._observer;s!==null&&(s.disconnect(),n._observer=null),t!==null&&(t.textContent=""),e!==null&&(e.textContent="",o.set("root",e))}function Gs(n){const t=new Set,e=new Set;let r=n;for(;r;){const{ownNodeConfig:o}=ns(r),s=r.transform;if(!e.has(s)){e.add(s);const i=r.transform();i&&t.add(i)}if(o){const i=o.$transform;i&&t.add(i),r=o.extends}else{const i=Object.getPrototypeOf(r);r=i.prototype instanceof ot&&i!==ot?i:void 0}}return t}function Li(n){const t=n||{},e=hh(),r=t.theme||{},o=n===void 0?e:t.parentEditor||null,s=t.disableEvents||!1,i=Oi(),l=t.namespace||(o!==null?o._config.namespace:Du()),a=t.editorState,c=[Sn,Ke,qn,Yn,xn,Mi,...t.nodes||[]],{onError:u,html:f}=t,d=t.editable===void 0||t.editable;let g;if(n===void 0&&e!==null)g=e._nodes;else{g=new Map;for(let p=0;p<c.length;p++){let _=c[p],y=null,m=null;if(typeof _!="function"){const w=_;_=w.replace,y=w.with,m=w.withKlass||null}ns(_);const C=_.getType(),S=Gs(_);g.set(C,{exportDOM:f&&f.export?f.export.get(_):void 0,klass:_,replace:y,replaceWithKlass:m,sharedNodeState:$s(c[p]),transforms:S})}}const h=new dn(i,o,g,{disableEvents:s,namespace:l,theme:r},u||console.error,(function(p,_){const y=new Map,m=new Set,C=S=>{Object.keys(S).forEach(w=>{let x=y.get(w);x===void 0&&(x=[],y.set(w,x)),x.push(S[w])})};return p.forEach(S=>{const w=S.klass.importDOM;if(w==null||m.has(w))return;m.add(w);const x=w.call(S.klass);x!==null&&C(x)}),_&&C(_),y})(g,f?f.import:void 0),d,n);return a!==void 0&&(h._pendingEditorState=a,h._dirtyType=2),h}class dn{constructor(t,e,r,o,s,i,l,a){b(this,"_headless");b(this,"_parentEditor");b(this,"_rootElement");b(this,"_editorState");b(this,"_pendingEditorState");b(this,"_compositionKey");b(this,"_deferred");b(this,"_keyToDOMMap");b(this,"_updates");b(this,"_updating");b(this,"_listeners");b(this,"_commands");b(this,"_nodes");b(this,"_decorators");b(this,"_pendingDecorators");b(this,"_config");b(this,"_dirtyType");b(this,"_cloneNotNeeded");b(this,"_dirtyLeaves");b(this,"_dirtyElements");b(this,"_normalizedNodes");b(this,"_updateTags");b(this,"_observer");b(this,"_key");b(this,"_onError");b(this,"_htmlConversions");b(this,"_window");b(this,"_editable");b(this,"_blockCursorElement");b(this,"_createEditorArgs");this._createEditorArgs=a,this._parentEditor=e,this._rootElement=null,this._editorState=t,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=0,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=Du(),this._onError=s,this._htmlConversions=i,this._editable=l,this._headless=e!==null&&e._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(t){const e=this._listeners.update;return e.add(t),()=>{e.delete(t)}}registerEditableListener(t){const e=this._listeners.editable;return e.add(t),()=>{e.delete(t)}}registerDecoratorListener(t){const e=this._listeners.decorator;return e.add(t),()=>{e.delete(t)}}registerTextContentListener(t){const e=this._listeners.textcontent;return e.add(t),()=>{e.delete(t)}}registerRootListener(t){const e=this._listeners.root;return t(this._rootElement,null),e.add(t),()=>{t(null,this._rootElement),e.delete(t)}}registerCommand(t,e,r){r===void 0&&A(35);const o=this._commands;o.has(t)||o.set(t,[new Set,new Set,new Set,new Set,new Set]);const s=o.get(t);s===void 0&&A(36,String(t));const i=s[r];return i.add(e),()=>{i.delete(e),s.every(l=>l.size===0)&&o.delete(t)}}registerMutationListener(t,e,r){const o=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,s=this._listeners.mutation;let i=s.get(e);i===void 0&&(i=new Set,s.set(e,i)),i.add(o);const l=r&&r.skipInitialization;return l!==void 0&&l||this.initializeMutationListener(e,o),()=>{i.delete(o),i.size===0&&s.delete(e)}}getRegisteredNode(t){const e=this._nodes.get(t.getType());return e===void 0&&A(37,t.name),e}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,e){const r=this._editorState,o=oi(r).get(e.getType());if(!o)return;const s=new Map;for(const i of o.keys())s.set(i,"created");s.size>0&&t(s,{dirtyLeaves:new Set,prevEditorState:r,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(t,e){const r=this.getRegisteredNode(t);return r.transforms.add(e),r}registerNodeTransform(t,e){const r=this.registerNodeTransformToKlass(t,e),o=[r],s=r.replaceWithKlass;if(s!=null){const i=this.registerNodeTransformToKlass(s,e);o.push(i)}return(function(i,l){const a=oi(i.getEditorState()),c=[];for(const u of l){const f=a.get(u);f&&c.push(f)}c.length!==0&&i.update(()=>{for(const u of c)for(const f of u.keys()){const d=Y(f);d&&d.markDirty()}},i._pendingEditorState===null?{tag:Ut}:void 0)})(this,o.map(i=>i.klass.getType())),()=>{o.forEach(i=>i.transforms.delete(e))}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,e){return F(this,t,e)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){const e=this._rootElement;if(t!==e){const r=Kn(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=t,Nu(this,e,t,o),e!==null&&(this._config.disableEvents||Xf(e),r!=null&&e.classList.remove(...r)),t!==null){const s=Ki(t),i=t.style;i.userSelect="text",i.whiteSpace="pre-wrap",i.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=s,this._dirtyType=2,Bc(this),this._updateTags.add(Ut),Et(this),this._config.disableEvents||(function(l,a){const c=l.ownerDocument;js.set(l,c);const u=bo.get(c)??0;u<1&&c.addEventListener("selectionchange",uu),bo.set(c,u+1),l.__lexicalEditor=a;const f=cu(l);for(let d=0;d<Hs.length;d++){const[g,h]=Hs[d],p=typeof h=="function"?_=>{Wl(_)||(Bl(_),(a.isEditable()||g==="click")&&h(_,a))}:_=>{if(Wl(_))return;Bl(_);const y=a.isEditable();switch(g){case"cut":return y&&F(a,Ir,_);case"copy":return F(a,Pr,_);case"paste":return y&&F(a,$r,_);case"dragstart":return y&&F(a,bi,_);case"dragover":return y&&F(a,wi,_);case"dragend":return y&&F(a,Yf,_);case"focus":return y&&F(a,Ti,_);case"blur":return y&&F(a,tu,_);case"drop":return y&&F(a,xi,_)}};l.addEventListener(g,p),f.push(()=>{l.removeEventListener(g,p)})}})(t,this),r!=null&&t.classList.add(...r)}else this._window=null,this._updateTags.add(Ut),Et(this);_r("root",this,!1,t,e)}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(t,e){t.isEmpty()&&A(38);let r=t;r._readOnly&&(r=vu(t),r._selection=t._selection?t._selection.clone():null),Kc(this);const o=this._pendingEditorState,s=this._updateTags,i=e!==void 0?e.tag:null;o===null||o.isEmpty()||(i!=null&&s.add(i),Et(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,i!=null&&s.add(i),this._updating||Et(this)}parseEditorState(t,e){return(function(r,o,s){const i=Oi(),l=Te,a=Be,c=Ne,u=o._dirtyElements,f=o._dirtyLeaves,d=o._cloneNotNeeded,g=o._dirtyType;o._dirtyElements=new Map,o._dirtyLeaves=new Set,o._cloneNotNeeded=new Set,o._dirtyType=0,Te=i,Be=!1,Ne=o,Ai(null);try{const h=o._nodes;ki(r.root,h),s&&s(),i._readOnly=!0}catch(h){h instanceof Error&&o._onError(h)}finally{o._dirtyElements=u,o._dirtyLeaves=f,o._cloneNotNeeded=d,o._dirtyType=g,Te=l,Be=a,Ne=c}return i})(typeof t=="string"?JSON.parse(t):t,this,e)}read(t){return Et(this),this.getEditorState().read(t,{editor:this})}update(t,e){(function(r,o,s){r._updating?r._updates.push([o,s]):Xo(r,o,s)})(this,t,e)}focus(t,e={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),Je(this,()=>{const o=M(),s=Q();o!==null?o.dirty||ne(o.clone()):s.getChildrenSize()!==0&&(e.defaultSelection==="rootStart"?s.selectStart():s.selectEnd()),Bu("focus"),wh(()=>{r.removeAttribute("autocapitalize"),t&&t()})}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const t=this._rootElement;t!==null&&t.blur();const e=et(this._window);e!==null&&e.removeAllRanges()}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,_r("editable",this,!0,t))}toJSON(){return{editorState:this._editorState.toJSON()}}}b(dn,"version");dn.version="0.38.2+prod.esm";let Zs=null;function Ai(n){Zs=n}let yh=1;function Eu(n,t){const e=Go(n,t);return e===void 0&&A(30,t),e}function Go(n,t){return n._nodes.get(t)}const Ch=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function la(n){return q(ye(n))}function $i(n){const t=document.activeElement;if(!se(t))return!1;const e=t.nodeName;return q(ye(n))&&(e==="INPUT"||e==="TEXTAREA"||t.contentEditable==="true"&&Qo(t)==null)}function Wr(n,t,e){const r=n.getRootElement();try{return r!==null&&r.contains(t)&&r.contains(e)&&t!==null&&!$i(t)&&Zo(t)===n}catch{return!1}}function Ri(n){return n instanceof dn}function Zo(n){let t=n;for(;t!=null;){const e=Qo(t);if(Ri(e))return e;t=zr(t)}return null}function Qo(n){return n?n.__lexicalEditor:null}function Sh(n){return Lf.test(n)?"rtl":Af.test(n)?"ltr":null}function nn(n){return Ei(n)||n.isToken()}function ut(n){return nn(n)||n.isSegmented()}function Pt(n){return bn(n)&&n.nodeType===3}function ku(n){return bn(n)&&n.nodeType===9}function Hn(n){let t=n;for(;t!=null;){if(Pt(t))return t;t=t.firstChild}return null}function Eo(n,t,e){const r=Lt[t];if(e!==null&&(n&r)===(e&r))return n;let o=n^r;return t==="subscript"?o&=-65:t==="superscript"?o&=-33:t==="lowercase"?(o&=-513,o&=-1025):t==="uppercase"?(o&=-257,o&=-1025):t==="capitalize"&&(o&=-257,o&=-513),o}function Ou(n){return $(n)||_t(n)||q(n)}function Mu(n,t){const e=(function(){const i=Zs;return Zs=null,i})();if((t=t||e&&e.__key)!=null)return void(n.__key=t);ve(),xu();const r=ue(),o=Ft(),s=""+yh++;o._nodeMap.set(s,n),N(n)?r._dirtyElements.set(s,!0):r._dirtyLeaves.add(s),r._cloneNotNeeded.add(s),r._dirtyType=1,n.__key=s}function Ht(n){const t=n.getParent();if(t!==null){const e=n.getWritable(),r=t.getWritable(),o=n.getPreviousSibling(),s=n.getNextSibling(),i=s!==null?s.__key:null,l=o!==null?o.__key:null,a=o!==null?o.getWritable():null,c=s!==null?s.getWritable():null;o===null&&(r.__first=i),s===null&&(r.__last=l),a!==null&&(a.__next=i),c!==null&&(c.__prev=l),e.__prev=null,e.__next=null,e.__parent=null,r.__size--}}function ko(n){xu(),wo(n)&&A(323,n.__key,n.__type);const t=n.getLatest(),e=t.__parent,r=Ft(),o=ue(),s=r._nodeMap,i=o._dirtyElements;e!==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}})(e,s,i);const l=t.__key;o._dirtyType=1,N(n)?i.set(l,!0):o._dirtyLeaves.add(l)}function Ee(n){ve();const t=ue(),e=t._compositionKey;if(n!==e){if(t._compositionKey=n,e!==null){const r=Y(e);r!==null&&r.getWritable()}if(n!==null){const r=Y(n);r!==null&&r.getWritable()}}}function Wt(){return Cn()?null:ue()._compositionKey}function Y(n,t){const e=(t||Ft())._nodeMap.get(n);return e===void 0?null:e}function Lu(n,t){const e=es(n,ue());return e!==void 0?Y(e,t):null}function es(n,t){return n[`__lexicalKey_${t._key}`]}function ye(n,t){let e=n;for(;e!=null;){const r=Lu(e,t);if(r!==null)return r;e=zr(e)}return null}function Au(n){const t=n._decorators,e=Object.assign({},t);return n._pendingDecorators=e,e}function aa(n){return n.read(()=>Q().getTextContent())}function Q(){return $u(Ft())}function $u(n){return n._nodeMap.get("root")}function ne(n){ve();const t=Ft();n!==null&&(n.dirty=!0,n.setCachedNodes(null)),t._selection=n}function Dn(n){const t=ue(),e=(function(r,o){let s=r;for(;s!=null;){const i=es(s,o);if(i!==void 0)return i;s=zr(s)}return null})(n,t);return e===null?n===t.getRootElement()?Y("root"):null:Y(e)}function Ru(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function Di(n){const t=[];let e=n;for(;e!==null;)t.push(e),e=e._parentEditor;return t}function Du(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Fu(n){return Pt(n)?n.nodeValue:null}function Fi(n,t,e){const r=et(Qe(t));if(r===null)return;const o=r.anchorNode;let{anchorOffset:s,focusOffset:i}=r;if(o!==null){let l=Fu(o);const a=ye(o);if(l!==null&&$(a)){if(l===Po&&e){const c=e.length;l=e,s=c,i=c}l!==null&&Pi(a,l,s,i,n)}}}function Pi(n,t,e,r,o){let s=n;if(s.isAttached()&&(o||!s.isDirty())){const i=s.isComposing();let l=t;(i||o)&&t[t.length-1]===Po&&(l=t.slice(0,-1));const a=s.getTextContent();if(o||l!==a){if(l===""){if(Ee(null),xr||Wn||br)s.remove();else{const p=ue();setTimeout(()=>{p.update(()=>{s.isAttached()&&s.remove()})},20)}return}const c=s.getParent(),u=Dt(),f=s.getTextContentSize(),d=Wt(),g=s.getKey();if(s.isToken()||d!==null&&g===d&&!i||O(u)&&(c!==null&&!c.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===n.__key&&u.anchor.offset===0&&!s.canInsertTextBefore()&&!i||u.focus.key===n.__key&&u.focus.offset===f&&!s.canInsertTextAfter()&&!i))return void s.markDirty();const h=M();if(!O(h)||e===null||r===null)return void ca(s,l,h);if(h.setTextNodeRange(s,e,s,r),s.isSegmented()){const p=fe(s.getTextContent());s.replace(p),s=p}ca(s,l,h)}}}function ca(n,t,e){if(n.setTextContent(t),O(e)){const r=n.getKey();for(const o of["anchor","focus"]){const s=e[o];s.type==="text"&&s.key===r&&(s.offset=yt(n,s.offset,"clamp"))}}}function ro(n,t,e){const r=t[e]||!1;return r==="any"||r===n[e]}function xh(n,t){return ro(n,t,"altKey")&&ro(n,t,"ctrlKey")&&ro(n,t,"shiftKey")&&ro(n,t,"metaKey")}function te(n,t,e){return xh(n,e)&&n.key.toLowerCase()===t.toLowerCase()}const Tt={ctrlKey:!nt,metaKey:nt},ua={altKey:nt,ctrlKey:!nt};function da(n){return n.key==="Backspace"}function fa(n){return te(n,"a",Tt)}function Pu(n){const t=Q();if(O(n)){const e=n.anchor,r=n.focus,o=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();return e.set(o.getKey(),0,"element"),r.set(o.getKey(),o.getChildrenSize(),"element"),Vt(n),n}{const e=t.select(0,t.getChildrenSize());return ne(Vt(e)),e}}function Kn(n,t){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const e=n.__lexicalClassNameCache,r=e[t];if(r!==void 0)return r;const o=n[t];if(typeof o=="string"){const s=$c(o);return e[t]=s,s}return o}function Ii(n,t,e,r,o){if(e.size===0)return;const s=r.__type,i=r.__key,l=t.get(s);l===void 0&&A(33,s);const a=l.klass;let c=n.get(a);c===void 0&&(c=new Map,n.set(a,c));const u=c.get(i),f=u==="destroyed"&&o==="created";(u===void 0||f)&&c.set(i,f?"updated":o)}function bh(n){const t=n.getType(),e=Ft();if(e._readOnly){const s=oi(e).get(t);return s?Array.from(s.values()):[]}const r=e._nodeMap,o=[];for(const[,s]of r)s instanceof n&&s.__type===t&&s.isAttached()&&o.push(s);return o}function ha(n,t,e){const r=n.getParent();let o=e,s=n;return r!==null&&(t&&e===0?(o=s.getIndexWithinParent(),s=r):t||e!==s.getChildrenSize()||(o=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(t?o-1:o)}function Qs(n,t){const e=n.offset;if(n.type==="element")return ha(n.getNode(),t,e);{const r=n.getNode();if(t&&e===0||!t&&e===r.getTextContentSize()){const o=t?r.getPreviousSibling():r.getNextSibling();return o===null?ha(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):o}}return null}function Iu(n){const t=Qe(n).event,e=t&&t.inputType;return e==="insertFromPaste"||e==="insertFromPasteAsQuotation"}function F(n,t,e){return(function(r,o,s){const i=Di(r);for(let l=4;l>=0;l--)for(let a=0;a<i.length;a++){const c=i[a],u=c._commands.get(o);if(u!==void 0){const f=u[l];if(f!==void 0){const d=Array.from(f),g=d.length;let h=!1;if(Je(c,()=>{for(let p=0;p<g;p++)if(d[p](s,r))return void(h=!0)}),h)return h}}}return!1})(n,t,e)}function ts(n){return!pe(n)&&!n.isLastChild()&&!n.isInline()}function fn(n,t){const e=n._keyToDOMMap.get(t);return e===void 0&&A(75,t),e}function zr(n){const t=n.assignedSlot||n.parentElement;return ni(t)?t.host:t}function Ku(n){return ku(n)?n:se(n)?n.ownerDocument:null}function Bu(n){ve(),ue()._updateTags.add(n)}function wh(n){ve(),ue()._deferred.push(n)}function ei(n,t){let e=n.getParent();for(;e!==null;){if(e.is(t))return!0;e=e.getParent()}return!1}function Ki(n){const t=Ku(n);return t?t.defaultView:null}function Qe(n){const t=n._window;return t===null&&A(78),t}function vh(n){return N(n)&&n.isInline()||q(n)&&n.isInline()}function Th(n){let t=n.getParentOrThrow();for(;t!==null;){if(We(t))return t;t=t.getParentOrThrow()}return t}function We(n){return pe(n)||N(n)&&n.isShadowRoot()}function Wu(n){const t=n.constructor.clone(n);return Mu(t,null),t.afterCloneFrom(n),t}function de(n){const t=ue(),e=n.getType(),r=Go(t,e);r===void 0&&A(200,n.constructor.name,e);const{replace:o,replaceWithKlass:s}=r;if(o!==null){const i=o(n),l=i.constructor;return s!==null?i instanceof s||A(201,s.name,s.getType(),l.name,l.getType(),n.constructor.name,e):i instanceof n.constructor&&l!==n.constructor||A(202,l.name,l.getType(),n.constructor.name,e),i.__key===n.__key&&A(203,n.constructor.name,e,l.name,l.getType()),i}return n}function ys(n,t){!pe(n.getParent())||N(t)||q(t)||A(99)}function zu(n){const t=Y(n);return t===null&&A(63,n),t}function Cs(n){return(q(n)||N(n)&&!n.canBeEmpty())&&!n.isInline()}function ti(n,t,e){e.style.removeProperty("caret-color"),t._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function et(n){return st?(n||window).getSelection():null}function Nh(n){const t=Ki(n);return t?t.getSelection():null}function Bi(n){return se(n)&&n.tagName==="A"}function se(n){return bn(n)&&n.nodeType===1}function bn(n){return typeof n=="object"&&n!==null&&"nodeType"in n&&typeof n.nodeType=="number"}function ni(n){return bn(n)&&n.nodeType===11}function ri(n){const t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return n.nodeName.match(t)!==null}function Oo(n){const t=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(t)!==null}function qe(n){if(q(n)&&!n.isInline())return!0;if(!N(n)||We(n))return!1;const t=n.getFirstChild(),e=t===null||_t(t)||$(t)||t.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&e}function wn(){return ue()}const ga=new WeakMap,Eh=new Map;function oi(n){if(!n._readOnly&&n.isEmpty())return Eh;n._readOnly||A(192);let t=ga.get(n);return t||(t=(function(e){const r=new Map;for(const[o,s]of e._nodeMap){const i=s.__type;let l=r.get(i);l||(l=new Map,r.set(i,l)),l.set(o,s)}return r})(n),ga.set(n,t)),t}function Wi(n){const t=n.constructor.clone(n);return t.afterCloneFrom(n),t}function kh(n){return(t=Wi(n))[du]=!0,t;var t}function zi(n,t){const e=parseInt(n.style.paddingInlineStart,10)||0,r=Math.round(e/40);t.setIndent(r)}function Uu(n){n.__lexicalUnmanaged=!0}function Oh(n){return n.__lexicalUnmanaged===!0}function or(n,t){return(function(e,r){return Object.prototype.hasOwnProperty.call(e,r)})(n,t)&&n[t]!==ot[t]}function ns(n){const t=kl in n.prototype?n.prototype[kl]():void 0,e=(function(i){if(!(i===ot||i.prototype instanceof ot)){let l="<unknown>",a="<unknown>";try{l=i.getType()}catch{}try{dn.version&&(a=JSON.parse(dn.version))}catch{}A(290,i.name,l,a)}return i===Kr||i===ae||i===ot})(n),r=!e&&or(n,"getType")?n.getType():void 0;let o,s=r;if(t)if(r)o=t[r];else for(const[i,l]of Object.entries(t))s=i,o=l;if(!e&&s&&(or(n,"getType")||(n.getType=()=>s),or(n,"clone")||(n.clone=i=>(Ai(i),new n)),or(n,"importJSON")||(n.importJSON=o&&o.$importJSON||(i=>new n().updateFromJSON(i))),!or(n,"importDOM")&&o)){const{importDOM:i}=o;i&&(n.importDOM=()=>i)}return{ownNodeConfig:o,ownNodeType:s}}function Hu(n){const t=wn();return ve(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(n))).klass}const z=(n,t)=>{let e=n;for(;e!=null&&!pe(e);){if(t(e))return e;e=e.getParent()}return null},Mh={next:"previous",previous:"next"};class Ui{constructor(t){b(this,"origin");this.origin=t}[Symbol.iterator](){return Vi({hasNext:pn,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return me(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return me(this.origin,this.direction)}remove(){const t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,e){const r=this.getNodeAtCaret();return t.is(this.origin)||t.is(r)||(r===null?this.insert(t):r.replace(t,e)),this}splice(t,e,r="next"){const o=r===this.direction?e:Array.from(e).reverse();let s=this;const i=this.getParentAtCaret(),l=new Map;for(let a=s.getAdjacentCaret();a!==null&&l.size<t;a=a.getAdjacentCaret()){const c=a.origin.getWritable();l.set(c.getKey(),c)}for(const a of o){if(l.size>0){const c=s.getNodeAtCaret();if(c){if(l.delete(c.getKey()),l.delete(a.getKey()),!(c.is(a)||s.origin.is(a))){const u=a.getParent();u&&u.is(i)&&a.remove(),c.replace(a)}}else c===null&&A(263,Array.from(l).join(" "))}else s.insert(a);s=me(a,this.direction)}for(const a of l.values())a.remove();return this}}class Tr extends Ui{constructor(){super(...arguments);b(this,"type","child")}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:tt(e,this.direction)}getParentCaret(e="root"){return me(Hi(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=vn(this.direction);return me(this.getNodeAtCaret(),e)||tt(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof Tr&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const Lh={root:pe,shadowRoot:We};function vn(n){return Mh[n]}function Hi(n,t="root"){return Lh[t](n)?null:n}class hn extends Ui{constructor(){super(...arguments);b(this,"type","sibling")}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:me(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return N(this.origin)?tt(this.origin,this.direction):null}getParentCaret(e="root"){return me(Hi(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=vn(this.direction);return me(this.getNodeAtCaret(),e)||tt(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof hn&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof hn||e instanceof gn)&&this.direction===e.direction&&this.origin.is(e.origin)}}class gn extends Ui{constructor(e,r){super(e);b(this,"type","text");b(this,"offset");this.offset=r}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Yt(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return me(Hi(this.getParentAtCaret(),e),this.direction)}getFlipped(){return Yt(this.origin,vn(this.direction),this.offset)}isSamePointCaret(e){return e instanceof gn&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof hn||e instanceof gn)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return me(this.origin,this.direction)}}function mt(n){return n instanceof gn}function pn(n){return n instanceof hn}function Ge(n){return n instanceof Tr}const Ah={next:class extends gn{constructor(){super(...arguments);b(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends gn{constructor(){super(...arguments);b(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},$h={next:class extends hn{constructor(){super(...arguments);b(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends hn{constructor(){super(...arguments);b(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},Rh={next:class extends Tr{constructor(){super(...arguments);b(this,"direction","next")}getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends Tr{constructor(){super(...arguments);b(this,"direction","previous")}getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function me(n,t){return n?new $h[t](n):null}function Yt(n,t,e){return n?new Ah[t](n,yt(n,e)):null}function yt(n,t,e="error"){const r=n.getTextContentSize();let o=t==="next"?r:t==="previous"?0:t;return(o<0||o>r)&&(e!=="clamp"&&Lc(284,String(t),String(r),n.getKey()),o=o<0?0:r),o}function pa(n,t){return new Dh(n,t)}function tt(n,t){return N(n)?new Rh[t](n):null}function ju(n){return n&&n.getChildCaret()||n}function jn(n){return n&&ju(n.getAdjacentCaret())}class ji{constructor(t,e,r){b(this,"type","node-caret-range");b(this,"direction");b(this,"anchor");b(this,"focus");this.anchor=t,this.focus=e,this.direction=r}getLatest(){const t=this.anchor.getLatest(),e=this.focus.getLatest();return t===this.anchor&&e===this.focus?this:new ji(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=o=>{const s=this[o].getLatest();return mt(s)?(function(i,l){const{direction:a,origin:c}=i,u=yt(c,l==="focus"?vn(a):a);return pa(i,u-i.offset)})(s,o):null},e=t("anchor"),r=t("focus");if(e&&r){const{caret:o}=e,{caret:s}=r;if(o.isSameNodeCaret(s))return[pa(o,s.offset-o.offset),null]}return[e,r]}iterNodeCarets(t="root"){const e=mt(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),r=this.focus.getLatest(),o=mt(r),s=i=>i.isSameNodeCaret(r)?null:jn(i)||i.getParentCaret(t);return Vi({hasNext:i=>i!==null&&!(o&&r.isSameNodeCaret(i)),initial:e.isSameNodeCaret(r)?null:s(e),map:i=>i,step:s})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Dh{constructor(t,e){b(this,"type","slice");b(this,"caret");b(this,"distance");this.caret=t,this.distance=e}getSliceIndices(){const{distance:t,caret:{offset:e}}=this,r=e+t;return r<e?[r,e]:[e,r]}getTextContent(){const[t,e]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,e)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:t,direction:e}}=this,[r,o]=this.getSliceIndices(),s=t.getTextContent();return Yt(t.setTextContent(s.slice(0,r)+s.slice(o)),e,r)}}function Ji(n){return At(n,me(Q(),n.direction))}function Ju(n){return At(n,n)}function At(n,t){return n.direction!==t.direction&&A(265),new ji(n,t,n.direction)}function Vi(n){const{initial:t,hasNext:e,step:r,map:o}=n;let s=t;return{[Symbol.iterator](){return this},next(){if(!e(s))return{done:!0,value:void 0};const i={done:!1,value:o(s)};return s=r(s),i}}}function Vu(n,t){const e=go(n.origin,t.origin);switch(e===null&&A(275,n.origin.getKey(),t.origin.getKey()),e.type){case"same":{const r=n.type==="text",o=t.type==="text";return r&&o?(function(s,i){return Math.sign(s-i)})(n.offset,t.offset):n.type===t.type?0:r?-1:o?1:n.type==="child"?-1:1}case"ancestor":return n.type==="child"?-1:1;case"descendant":return t.type==="child"?1:-1;case"branch":return qu(e)}}function qu(n){const{a:t,b:e}=n,r=t.__key,o=e.__key;let s=t,i=e;for(;s&&i;s=s.getNextSibling(),i=i.getNextSibling()){if(s.__key===o)return-1;if(i.__key===r)return 1}return s===null?1:-1}function oo(n,t){return t.is(n)}function _a(n){return N(n)?[n.getLatest(),null]:[n.getParent(),n.getLatest()]}function go(n,t){if(n.is(t))return{commonAncestor:n,type:"same"};const e=new Map;for(let[r,o]=_a(n);r;o=r,r=r.getParent())e.set(r,o);for(let[r,o]=_a(t);r;o=r,r=r.getParent()){const s=e.get(r);if(s!==void 0)return s===null?(oo(n,r)||A(276),{commonAncestor:r,type:"ancestor"}):o===null?(oo(t,r)||A(277),{commonAncestor:r,type:"descendant"}):((N(s)||oo(n,s))&&(N(o)||oo(t,o))&&r.is(s.getParent())&&r.is(o.getParent())||A(278),{a:s,b:o,commonAncestor:r,type:"branch"})}return null}function xt(n,t){const{type:e,key:r,offset:o}=n,s=zu(n.key);return e==="text"?($(s)||A(266,s.getType(),r),Yt(s,t,o)):(N(s)||A(267,s.getType(),r),Ph(s,n.offset,t))}function Nr(n,t){const{origin:e,direction:r}=t,o=r==="next";mt(t)?n.set(e.getKey(),t.offset,"text"):pn(t)?$(e)?n.set(e.getKey(),yt(e,r),"text"):n.set(e.getParentOrThrow().getKey(),e.getIndexWithinParent()+(o?1:0),"element"):(Ge(t)&&N(e)||A(268),n.set(e.getKey(),o?0:e.getChildrenSize(),"element"))}function qi(n){const t=M(),e=O(t)?t:Gn();return po(e,n),ne(e),e}function po(n,t){Nr(n.anchor,t.anchor),Nr(n.focus,t.focus)}function si(n){const{anchor:t,focus:e}=n,r=xt(t,"next"),o=xt(e,"next"),s=Vu(r,o)<=0?"next":"previous";return At($t(r,s),$t(o,s))}function Ur(n){const{direction:t,origin:e}=n,r=me(e,vn(t)).getNodeAtCaret();return r?me(r,t):tt(e.getParentOrThrow(),t)}function ma(n,t="root"){const e=[n];for(let r=Ge(n)?n.getParentCaret(t):n.getSiblingCaret();r!==null;r=r.getParentCaret(t))e.push(Ur(r));return e}function Ss(n){return!!n&&n.origin.isAttached()}function Fh(n,t="removeEmptySlices"){if(n.isCollapsed())return n;const e="root",r="next";let o=t;const s=Yi(n,r),i=ma(s.anchor,e),l=ma(s.focus.getFlipped(),e),a=new Set,c=[];for(const h of s.iterNodeCarets(e))if(Ge(h))a.add(h.origin.getKey());else if(pn(h)){const{origin:p}=h;N(p)&&!a.has(p.getKey())||c.push(p)}for(const h of c)h.remove();for(const h of s.getTextSlices()){if(!h)continue;const{origin:p}=h.caret,_=p.getTextContentSize(),y=Ur(me(p,r)),m=p.getMode();if(Math.abs(h.distance)===_&&o==="removeEmptySlices"||m==="token"&&h.distance!==0)y.remove();else if(h.distance!==0){o="removeEmptySlices";let C=h.removeTextSlice();const S=h.caret.origin;if(m==="segmented"){const w=C.origin,x=fe(w.getTextContent()).setStyle(w.getStyle()).setFormat(w.getFormat());y.replaceOrInsert(x),C=Yt(x,r,C.offset)}S.is(i[0].origin)&&(i[0]=C),S.is(l[0].origin)&&(l[0]=C.getFlipped())}}let u,f;for(const h of i)if(Ss(h)){u=Xe(h);break}for(const h of l)if(Ss(h)){f=Xe(h);break}const d=(function(h,p,_){if(!h||!p)return null;const y=h.getParentAtCaret(),m=p.getParentAtCaret();if(!y||!m)return null;const C=y.getParents().reverse();C.push(y);const S=m.getParents().reverse();S.push(m);const w=Math.min(C.length,S.length);let x;for(x=0;x<w&&C[x]===S[x];x++);const v=(k,D)=>{let P;for(let R=x;R<k.length;R++){const I=k[R];if(We(I))return;!P&&D(I)&&(P=I)}return P},E=v(C,qe),T=E&&v(S,k=>_.has(k.getKey())&&qe(k));return E&&T?[E,T]:null})(u,f,a);if(d){const[h,p]=d;tt(h,"previous").splice(0,p.getChildren()),p.remove()}const g=[u,f,...i,...l].find(Ss);if(g)return Ju($t(Xe(g),n.direction));A(269,JSON.stringify(i.map(h=>h.origin.__key)))}function Xe(n){const t=(function(o){let s=o;for(;Ge(s);){const i=jn(s);if(!Ge(i))break;s=i}return s})(n.getLatest()),{direction:e}=t;if($(t.origin))return mt(t)?t:Yt(t.origin,e,e);const r=t.getAdjacentCaret();return pn(r)&&$(r.origin)?Yt(r.origin,e,vn(e)):t}function Yu(n){return mt(n)&&n.offset!==yt(n.origin,n.direction)}function $t(n,t){return n.direction===t?n:n.getFlipped()}function Yi(n,t){return n.direction===t?n:At($t(n.focus,t),$t(n.anchor,t))}function Ph(n,t,e){let r=tt(n,"next");for(let o=0;o<t;o++){const s=r.getAdjacentCaret();if(s===null)break;r=s}return $t(r,e)}function Ih(n,t="root"){let e=0,r=n,o=jn(r);for(;o===null;){if(e--,o=r.getParentCaret(t),!o)return null;r=o,o=jn(r)}return o&&[o,e]}function Kh(n){const{origin:t,offset:e,direction:r}=n;if(e===yt(t,r))return n.getSiblingCaret();if(e===yt(t,vn(r)))return Ur(n.getSiblingCaret());const[o]=t.splitText(e);return $(o)||A(281),$t(me(o,"next"),r)}function Bh(n,t){return!0}function Wh(n,{$copyElementNode:t=Wu,$splitTextPointCaretNext:e=Kh,rootMode:r="shadowRoot",$shouldSplit:o=Bh}={}){if(mt(n))return e(n);const s=n.getParentCaret(r);if(s){const{origin:i}=s;if(Ge(n)&&(!i.canBeEmpty()||!o(i,"first")))return Ur(s);const l=(function(a){const c=[];for(let u=a.getAdjacentCaret();u;u=u.getAdjacentCaret())c.push(u.origin);return c})(n);(l.length>0||i.canBeEmpty()&&o(i,"last"))&&s.insert(t(i).splice(0,0,l))}return s}function zh(...n){return n}function Uh(n,t){if(!t||n===t)return n;for(const e in t)if(n[e]!==t[e])return{...n,...t};return n}function Xu(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Mo=new Map;function ya(n){let t=n;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function Ca(n){const t=n.parentNode;if(t==null)throw new Error("Should never happen");return[t,Array.from(t.childNodes).indexOf(n)]}function Hh(n,t,e,r,o){const s=t.getKey(),i=r.getKey(),l=document.createRange();let a=n.getElementByKey(s),c=n.getElementByKey(i),u=e,f=o;if($(t)&&(a=ya(a)),$(r)&&(c=ya(c)),t===void 0||r===void 0||a===null||c===null)return null;a.nodeName==="BR"&&([a,u]=Ca(a)),c.nodeName==="BR"&&([c,f]=Ca(c));const d=a.firstChild;a===c&&d!=null&&d.nodeName==="BR"&&u===0&&f===0&&(f=1);try{l.setStart(a,u),l.setEnd(c,f)}catch{return null}return!l.collapsed||u===f&&s===i||(l.setStart(c,f),l.setEnd(a,u)),l}function jh(n,t){const e=n.getRootElement();if(e===null)return[];const r=e.getBoundingClientRect(),o=getComputedStyle(e),s=parseFloat(o.paddingLeft)+parseFloat(o.paddingRight),i=Array.from(t.getClientRects());let l,a=i.length;i.sort((c,u)=>{const f=c.top-u.top;return Math.abs(f)<=3?c.left-u.left:f});for(let c=0;c<a;c++){const u=i[c],f=l&&l.top<=u.top&&l.top+l.height>u.top&&l.left+l.width>u.left,d=u.width+s===r.width;f||d?(i.splice(c--,1),a--):l=u}return i}function Gu(n){const t={};if(!n)return t;const e=n.split(";");for(const r of e)if(r!==""){const[o,s]=r.split(/:([^]+)/);o&&s&&(t[o.trim()]=s.trim())}return t}function Er(n){let t=Mo.get(n);return t===void 0&&(t=Gu(n),Mo.set(n,t)),t}function Jh(n){let t="";for(const e in n)e&&(t+=`${e}: ${n[e]};`);return t}function Zu(n){const t=wn().getElementByKey(n.getKey());if(t===null)return null;const e=t.ownerDocument.defaultView;return e===null?null:e.getComputedStyle(t)}function Qu(n){return Zu(pe(n)?n:n.getParentOrThrow())}function Sa(n){const t=Qu(n);return t!==null&&t.direction==="rtl"}function ed(n,t,e="self"){const r=n.getStartEndPoints();if(t.isSelected(n)&&!ut(t)&&r!==null){const[o,s]=r,i=n.isBackward(),l=o.getNode(),a=s.getNode(),c=t.is(l),u=t.is(a);if(c||u){const[f,d]=Ys(n),g=l.is(a),h=t.is(i?a:l),p=t.is(i?l:a);let _,y=0;g?(y=f>d?d:f,_=f>d?f:d):h?(y=i?d:f,_=void 0):p&&(y=0,_=i?f:d);const m=t.__text.slice(y,_);m!==t.__text&&(e==="clone"&&(t=kh(t)),t.__text=m)}}return t}function Vh(n){if(n.type==="text")return n.offset===n.getNode().getTextContentSize();const t=n.getNode();return N(t)||Xu(177),n.offset===t.getChildrenSize()}function qh(n,t,e){let r=t.getNode(),o=e;if(N(r)){const s=r.getDescendantByIndex(t.offset);s!==null&&(r=s)}for(;o>0&&r!==null;){if(N(r)){const c=r.getLastDescendant();c!==null&&(r=c)}let s=r.getPreviousSibling(),i=0;if(s===null){let c=r.getParentOrThrow(),u=c.getPreviousSibling();for(;u===null;){if(c=c.getParent(),c===null){s=null;break}u=c.getPreviousSibling()}c!==null&&(i=c.isInline()?0:2,s=u)}let l=r.getTextContent();l===""&&N(r)&&!r.isInline()&&(l=`
|
|
12
|
+
|
|
13
|
+
`);const a=l.length;if(!$(r)||o>=a){const c=r.getParent();r.remove(),c==null||c.getChildrenSize()!==0||pe(c)||c.remove(),o-=a+i,r=s}else{const c=r.getKey(),u=n.getEditorState().read(()=>{const g=Y(c);return $(g)&&g.isSimpleText()?g.getTextContent():null}),f=a-o,d=l.slice(0,f);if(u!==null&&u!==l){const g=Dt();let h=r;if(r.isSimpleText())r.setTextContent(u);else{const p=fe(u);r.replace(p),h=p}if(O(g)&&g.isCollapsed()){const p=g.anchor.offset;h.select(p,p)}}else if(r.isSimpleText()){const g=t.key===c;let h=t.offset;h<o&&(h=a);const p=g?h-o:0,_=g?h:f;if(g&&p===0){const[y]=r.splitText(p,_);y.remove()}else{const[,y]=r.splitText(p,_);y.remove()}}else{const g=fe(d);r.replace(g)}o=0}}}function Yh(n){const t=n.getStyle(),e=Gu(t);Mo.set(t,e)}function xs(n,t){(O(n)?n.isCollapsed():$(n)||N(n))||Xu(280);const e=Er(O(n)?n.style:$(n)?n.getStyle():n.getTextStyle()),r=Object.entries(t).reduce((s,[i,l])=>(typeof l=="function"?s[i]=l(e[i],n):l===null?delete s[i]:s[i]=l,s),{...e}),o=Jh(r);O(n)||$(n)?n.setStyle(o):n.setTextStyle(o),Mo.set(o,r)}function Xh(n,t){if(O(n)&&n.isCollapsed()){xs(n,t);const e=n.anchor.getNode();N(e)&&e.isEmpty()&&xs(e,t)}Gh(e=>{xs(e,t)})}function Gh(n){const t=M();if(!t)return;const e=new Map,r=s=>e.get(s.getKey())||[0,s.getTextContentSize()];if(O(t))for(const s of si(t).getTextSlices())s&&e.set(s.caret.origin.getKey(),s.getSliceIndices());const o=t.getNodes();for(const s of o){if(!$(s)||!s.canHaveFormat())continue;const[i,l]=r(s);l!==i&&(ut(s)||i===0&&l===s.getTextContentSize()?n(s):n(s.splitText(i,l)[i===0?0:1]))}O(t)&&t.anchor.type==="text"&&t.focus.type==="text"&&t.anchor.key===t.focus.key&&Zh(t)}function Zh(n){if(n.isBackward()){const{anchor:t,focus:e}=n,{key:r,offset:o,type:s}=t;t.set(e.key,e.offset,e.type),e.set(r,o,s)}}function Qh(n,t){const e=n.getFormatType(),r=n.getIndent();e!==t.getFormatType()&&t.setFormat(e),r!==t.getIndent()&&t.setIndent(r)}function eg(n,t,e=Qh){if(n===null)return;const r=n.getStartEndPoints(),o=new Map;let s=null;if(r){const[i,l]=r;s=Gn(),s.anchor.set(i.key,i.offset,i.type),s.focus.set(l.key,l.offset,l.type);const a=z(i.getNode(),qe),c=z(l.getNode(),qe);N(a)&&o.set(a.getKey(),a),N(c)&&o.set(c.getKey(),c)}for(const i of n.getNodes())if(N(i)&&qe(i))o.set(i.getKey(),i);else if(r===null){const l=z(i,qe);N(l)&&o.set(l.getKey(),l)}for(const[i,l]of o){const a=t();e(l,a),l.replace(a,!0),s&&(i===s.anchor.key&&s.anchor.set(a.getKey(),s.anchor.offset,s.anchor.type),i===s.focus.key&&s.focus.set(a.getKey(),s.focus.offset,s.focus.type))}s&&n.is(M())&&ne(s)}function td(n){const t=nd(n);return t!==null&&t.writingMode==="vertical-rl"}function nd(n){const t=n.anchor.getNode();return N(t)?Zu(t):Qu(t)}function xa(n,t){let e=td(n)?!t:t;rd(n)&&(e=!e);const r=xt(n.focus,e?"previous":"next");if(Yu(r))return!1;for(const o of Ji(r)){if(Ge(o))return!o.origin.isInline();if(!N(o.origin)){if(q(o.origin))return!0;break}}return!1}function tg(n,t,e,r){n.modify(t?"extend":"move",e,r)}function rd(n){const t=nd(n);return t!==null&&t.direction==="rtl"}function ba(n,t,e){const r=rd(n);let o;o=td(n)||r?!e:e,tg(n,t,o,"character")}function ng(n,t,e){const r=Er(n.getStyle());return r!==null&&r[t]||e}function rg(n,t,e=""){let r=null;const o=n.getNodes(),s=n.anchor,i=n.focus,l=n.isBackward(),a=l?i.offset:s.offset,c=l?i.getNode():s.getNode();if(O(n)&&n.isCollapsed()&&n.style!==""){const u=Er(n.style);if(u!==null&&t in u)return u[t]}for(let u=0;u<o.length;u++){const f=o[u];if((u===0||a!==0||!f.is(c))&&$(f)){const d=ng(f,t,e);if(r===null)r=d;else if(r!==d){r="";break}}}return r===null?e:r}const og=qh;function od(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} 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,sg=rs&&"documentMode"in document?document.documentMode:null,ig=rs&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);!(!rs||!("InputEvent"in window)||sg)&&"getTargetRanges"in new window.InputEvent("input");function sd(...n){const t=[];for(const e of n)if(e&&typeof e=="string")for(const[r]of e.matchAll(/\S+/g))t.push(r);return t}function Me(...n){return()=>{for(let t=n.length-1;t>=0;t--)n[t]();n.length=0}}const lg=rs,ag=ig;function oe(n,...t){const e=sd(...t);e.length>0&&n.classList.add(...e)}function Ve(n,...t){const e=sd(...t);e.length>0&&n.classList.remove(...e)}function cg(n){return n?n.getAdjacentCaret():null}function wa(n){const t=ju(me(n,"previous")),e=Ih(t,"root");return e&&e[0].origin}function id(n,t){let e=n;for(;e!=null;){if(e instanceof t)return e;e=e.getParent()}return null}function Xi(n){const t=z(n,e=>N(e)&&!e.isInline());return N(t)||od(4,n.__key),t}function ug(n,t,e,r){const o=s=>s instanceof t;return n.registerNodeTransform(t,s=>{const i=(l=>{const a=l.getChildren();for(let f=0;f<a.length;f++){const d=a[f];if(o(d))return null}let c=l,u=l;for(;c!==null;)if(u=c,c=c.getParent(),o(c))return{child:u,parent:c};return null})(s);if(i!==null){const{child:l,parent:a}=i;if(l.is(s)){r(a,s);const c=l.getNextSiblings(),u=c.length;if(a.insertAfter(l),u!==0){const f=e(a);l.insertAfter(f);for(let d=0;d<u;d++)f.append(c[d])}a.canBeEmpty()||a.getChildrenSize()!==0||a.remove()}}})}function dg(n,t){const e=new Map,r=n._pendingEditorState;for(const[s,i]of t._nodeMap)e.set(s,Wi(i));r&&(r._nodeMap=e),n._dirtyType=2;const o=t._selection;ne(o===null?null:o.clone())}function ld(n){const t=M()||Dt();let e;if(O(t))e=xt(t.focus,"next");else{if(t!=null){const i=t.getNodes(),l=i[i.length-1];l&&(e=me(l,"next"))}e=e||tt(Q(),"previous").getFlipped().insert(j())}const r=fg(n,e),o=jn(r),s=Ge(o)?Xe(o):r;return qi(Ju(s)),n.getLatest()}function fg(n,t,e){let r=$t(t,"next");for(let o=r;o;o=Wh(o,e))r=o;return mt(r)&&od(283),r.insert(n.isInline()?j().append(n):n),$t(me(n.getLatest(),"next"),t.direction)}function Ot(n,t){return n!==null&&Object.getPrototypeOf(n).constructor.name===t.name}function hg(n,t){tt(n,"next").insert(t)}let bs=!(ag||!lg)&&void 0;function gg(n){let t=1;if((function(){if(bs===void 0){const e=document.createElement("div");e.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(e);const r=e.getBoundingClientRect();e.style.setProperty("zoom","2"),bs=e.getBoundingClientRect().width===r.width,document.body.removeChild(e)}return bs})())for(;n;)t*=Number(window.getComputedStyle(n).getPropertyValue("zoom")),n=n.parentElement;return t}function ad(n,t){const e=[],r=Array.from(n).reverse();for(let o=r.pop();o!==void 0;o=r.pop())if(t(o))e.push(o);else if(N(o))for(const s of pg(o))r.push(s);return e}function pg(n){return _g(tt(n,"previous"))}function _g(n){return Vi({hasNext:pn,initial:n.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function cd(n,t){const e=ku(t)?t.body.childNodes:t.childNodes;let r=[];const o=[];for(const s of e)if(!dd.has(s.nodeName)){const i=fd(s,n,o,!1);i!==null&&(r=r.concat(i))}return(function(s){for(const i of s)i.getNextSibling()instanceof Mi&&i.insertAfter(qt());for(const i of s){const l=i.getChildren();for(const a of l)i.insertBefore(a);i.remove()}})(o),r}function Gi(n,t){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 e=document.createElement("div"),r=Q().getChildren();for(let o=0;o<r.length;o++)ud(n,r[o],e,t);return e.innerHTML}function ud(n,t,e,r=null){let o=r===null||t.isSelected(r);const s=N(t)&&t.excludeFromCopy("html");let i=t;r!==null&&$(t)&&(i=ed(r,t,"clone"));const l=N(i)?i.getChildren():[],a=Go(n,i.getType());let c;c=a&&a.exportDOM!==void 0?a.exportDOM(n,i):i.exportDOM(n);const{element:u,after:f}=c;if(!u)return!1;const d=document.createDocumentFragment();for(let g=0;g<l.length;g++){const h=l[g],p=ud(n,h,d,r);!o&&N(t)&&p&&t.extractWithChild(h,r,"html")&&(o=!0)}if(o&&!s){if((se(u)||ni(u))&&u.append(d),e.append(u),f){const g=f.call(i,u);g&&(ni(u)?u.replaceChildren(g):u.replaceWith(g))}}else e.append(d);return o}const dd=new Set(["STYLE","SCRIPT"]);function fd(n,t,e,r,o=new Map,s){let i=[];if(dd.has(n.nodeName))return i;let l=null;const a=(function(h,p){const{nodeName:_}=h,y=p._htmlConversions.get(_.toLowerCase());let m=null;if(y!==void 0)for(const C of y){const S=C(h);S!==null&&(m===null||(m.priority||0)<=(S.priority||0))&&(m=S)}return m!==null?m.conversion:null})(n,t),c=a?a(n):null;let u=null;if(c!==null){u=c.after;const h=c.node;if(l=Array.isArray(h)?h[h.length-1]:h,l!==null){for(const[,p]of o)if(l=p(l,s),!l)break;l&&i.push(...Array.isArray(h)?h:[l])}c.forChild!=null&&o.set(n.nodeName,c.forChild)}const f=n.childNodes;let d=[];const g=(l==null||!We(l))&&(l!=null&&Xs(l)||r);for(let h=0;h<f.length;h++)d.push(...fd(f[h],t,e,g,new Map(o),l));return u!=null&&(d=u(d)),Oo(n)&&(d=mg(n,d,g?()=>{const h=new Mi;return e.push(h),h}:j)),l==null?d.length>0?i=i.concat(d):Oo(n)&&(function(h){return h.nextSibling==null||h.previousSibling==null?!1:ri(h.nextSibling)&&ri(h.previousSibling)})(n)&&(i=i.concat(qt())):N(l)&&l.append(...d),i}function mg(n,t,e){const r=n.style.textAlign,o=[];let s=[];for(let i=0;i<t.length;i++){const l=t[i];if(Xs(l))r&&!l.getFormat()&&l.setFormat(r),o.push(l);else if(s.push(l),i===t.length-1||i<t.length-1&&Xs(t[i+1])){const a=e();a.setFormat(r),a.append(...s),o.push(a),s=[]}}return o}const va=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],Ta=va[Math.floor(Math.random()*va.length)],hd=L.createContext(null);function yg(){return{color:Ta[1],isCollabActive:!1,name:Ta[0],yjsDocMap:new Map}}const Cg=yg();function Sg(n,t){let e=L.useContext(hd);return e==null&&(function(r,...o){const s=new URL("https://lexical.dev/docs/error"),i=new URLSearchParams;i.append("code",r);for(const l of o)i.append("v",l);s.search=i.toString(),console.warn(`Minified Lexical warning #${r}; visit ${s.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(319),e=e??Cg,n!=null&&(e.name=n),t!=null&&(e.color=t),e}const Lo=L.createContext(null);function gd(n,t){let e=null;return n!=null&&(e=n[1]),{getTheme:function(){return t??(e!=null?e.getTheme():null)}}}function Ce(){const n=L.useContext(Lo);return n==null&&(function(t,...e){const r=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const s of e)o.append("v",s);throw r.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),n}function xg(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function bg(n,t){const e=[];let r=n.__first;for(;r!==null;){const o=t===null?Y(r):t.get(r);o==null&&xg(174),e.push(r),r=o.__next}return e}const pd=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,wg=pd?L.useLayoutEffect:L.useEffect,so={tag:Ut};function vg({initialConfig:n,children:t}){const e=L.useMemo(()=>{const{theme:r,namespace:o,nodes:s,onError:i,editorState:l,html:a}=n,c=gd(null,r),u=Li({editable:n.editable,html:a,namespace:o,nodes:s,onError:f=>i(f,u),theme:r});return(function(f,d){if(d!==null){if(d===void 0)f.update(()=>{const g=Q();if(g.isEmpty()){const h=j();g.append(h);const p=pd?document.activeElement:null;(M()!==null||p!==null&&p===f.getRootElement())&&h.select()}},so);else if(d!==null)switch(typeof d){case"string":{const g=f.parseEditorState(d);f.setEditorState(g,so);break}case"object":f.setEditorState(d,so);break;case"function":f.update(()=>{Q().isEmpty()&&d(f)},so)}}})(u,l),[u,c]},[]);return wg(()=>{const r=n.editable,[o]=e;o.setEditable(r===void 0||r)},[]),X.jsx(Lo.Provider,{value:e,children:t})}const Tg=Symbol.for("preact-signals");function os(){if(jt>1)return void jt--;let n,t=!1;for(;yr!==void 0;){let e=yr;for(yr=void 0,ii++;e!==void 0;){const r=e.o;if(e.o=void 0,e.f&=-3,!(8&e.f)&&_d(e))try{e.c()}catch(o){t||(n=o,t=!0)}e=r}}if(ii=0,jt--,t)throw n}function Ng(n){if(jt>0)return n();jt++;try{return n()}finally{os()}}let Z,yr;function Na(n){const t=Z;Z=void 0;try{return n()}finally{Z=t}}let jt=0,ii=0,_o=0;function Ea(n){if(Z===void 0)return;let t=n.n;return t===void 0||t.t!==Z?(t={i:0,S:n,p:Z.s,n:void 0,t:Z,e:void 0,x:void 0,r:t},Z.s!==void 0&&(Z.s.n=t),Z.s=t,n.n=t,32&Z.f&&n.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Z.s,t.n=void 0,Z.s.n=t,Z.s=t),t):void 0}function Ae(n,t){this.v=n,this.i=0,this.n=void 0,this.t=void 0,this.W=t==null?void 0:t.watched,this.Z=t==null?void 0:t.unwatched,this.name=t==null?void 0:t.name}function Eg(n,t){return new Ae(n,t)}function _d(n){for(let t=n.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function ka(n){for(let t=n.s;t!==void 0;t=t.n){const e=t.S.n;if(e!==void 0&&(t.r=e),t.S.n=t,t.i=-1,t.n===void 0){n.s=t;break}}}function md(n){let t,e=n.s;for(;e!==void 0;){const r=e.p;e.i===-1?(e.S.U(e),r!==void 0&&(r.n=e.n),e.n!==void 0&&(e.n.p=r)):t=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=r}n.s=t}function En(n,t){Ae.call(this,void 0),this.x=n,this.s=void 0,this.g=_o-1,this.f=4,this.W=t==null?void 0:t.watched,this.Z=t==null?void 0:t.unwatched,this.name=t==null?void 0:t.name}function yd(n){const t=n.u;if(n.u=void 0,typeof t=="function"){jt++;const e=Z;Z=void 0;try{t()}catch(r){throw n.f&=-2,n.f|=8,Zi(n),r}finally{Z=e,os()}}}function Zi(n){for(let t=n.s;t!==void 0;t=t.n)t.S.U(t);n.x=void 0,n.s=void 0,yd(n)}function kg(n){if(Z!==this)throw new Error("Out-of-order effect");md(this),Z=n,this.f&=-2,8&this.f&&Zi(this),os()}function Rn(n,t){this.x=n,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t==null?void 0:t.name}function kr(n,t){const e=new Rn(n,t);try{e.c()}catch(o){throw e.d(),o}const r=e.d.bind(e);return r[Symbol.dispose]=r,r}function Qi(n,t={}){const e={};for(const r in n){const o=t[r],s=Eg(o===void 0?n[r]:o);e[r]=s}return e}Ae.prototype.brand=Tg,Ae.prototype.h=function(){return!0},Ae.prototype.S=function(n){const t=this.t;t!==n&&n.e===void 0&&(n.x=t,this.t=n,t!==void 0?t.e=n:Na(()=>{var e;(e=this.W)==null||e.call(this)}))},Ae.prototype.U=function(n){if(this.t!==void 0){const t=n.e,e=n.x;t!==void 0&&(t.x=e,n.e=void 0),e!==void 0&&(e.e=t,n.x=void 0),n===this.t&&(this.t=e,e===void 0&&Na(()=>{var r;(r=this.Z)==null||r.call(this)}))}},Ae.prototype.subscribe=function(n){return kr(()=>{const t=this.value,e=Z;Z=void 0;try{n(t)}finally{Z=e}},{name:"sub"})},Ae.prototype.valueOf=function(){return this.value},Ae.prototype.toString=function(){return this.value+""},Ae.prototype.toJSON=function(){return this.value},Ae.prototype.peek=function(){const n=Z;Z=void 0;try{return this.value}finally{Z=n}},Object.defineProperty(Ae.prototype,"value",{get(){const n=Ea(this);return n!==void 0&&(n.i=this.i),this.v},set(n){if(n!==this.v){if(ii>100)throw new Error("Cycle detected");this.v=n,this.i++,_o++,jt++;try{for(let t=this.t;t!==void 0;t=t.x)t.t.N()}finally{os()}}}}),En.prototype=new Ae,En.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===_o))return!0;if(this.g=_o,this.f|=1,this.i>0&&!_d(this))return this.f&=-2,!0;const n=Z;try{ka(this),Z=this;const t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return Z=n,md(this),this.f&=-2,!0},En.prototype.S=function(n){if(this.t===void 0){this.f|=36;for(let t=this.s;t!==void 0;t=t.n)t.S.S(t)}Ae.prototype.S.call(this,n)},En.prototype.U=function(n){if(this.t!==void 0&&(Ae.prototype.U.call(this,n),this.t===void 0)){this.f&=-33;for(let t=this.s;t!==void 0;t=t.n)t.S.U(t)}},En.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let n=this.t;n!==void 0;n=n.x)n.t.N()}},Object.defineProperty(En.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const n=Ea(this);if(this.h(),n!==void 0&&(n.i=this.i),16&this.f)throw this.v;return this.v}}),Rn.prototype.c=function(){const n=this.S();try{if(8&this.f||this.x===void 0)return;const t=this.x();typeof t=="function"&&(this.u=t)}finally{n()}},Rn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,yd(this),ka(this),jt++;const n=Z;return Z=this,kg.bind(this,n)},Rn.prototype.N=function(){2&this.f||(this.f|=2,this.o=yr,yr=this)},Rn.prototype.d=function(){this.f|=8,1&this.f||Zi(this)},Rn.prototype.dispose=function(){this.d()};function Og(){const n=Q(),t=M(),e=j();n.clear(),n.append(e),t!==null&&e.select(),O(t)&&(t.format=0)}function Mg(n,t=Og){return n.registerCommand(vi,e=>(n.update(t),!0),J)}function Lg(n){return(typeof n.nodes=="function"?n.nodes():n.nodes)||[]}function ie(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Cd(n,t){if(n&&t&&!Array.isArray(t)&&typeof n=="object"&&typeof t=="object"){const e=n,r=t;for(const o in r)e[o]=Cd(e[o],r[o]);return n}return t}const el=0,li=1,Sd=2,ws=3,io=4,kn=5,vs=6,sr=7;function Ts(n){return n.id===el}function xd(n){return n.id===Sd}function Ag(n){return(function(t){return t.id===li})(n)||ie(305,String(n.id),String(li)),Object.assign(n,{id:Sd})}const $g=new Set;class Rg{constructor(t,e){b(this,"builder");b(this,"configs");b(this,"_dependency");b(this,"_peerNameSet");b(this,"extension");b(this,"state");b(this,"_signal");this.builder=t,this.extension=e,this.configs=new Set,this.state={id:el}}mergeConfigs(){let t=this.extension.config||{};const e=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Uh;for(const r of this.configs)t=e(t,r);return t}init(t){const e=this.state;xd(e)||ie(306,String(e.id));const r={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},o={...r,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},s=(function(l,a,c){return Object.assign(l,{config:a,id:ws,registerState:c})})(e,this.mergeConfigs(),r);let i;this.state=s,this.extension.init&&(i=this.extension.init(t,s.config,r)),this.state=(function(l,a,c){return Object.assign(l,{id:io,initResult:a,registerState:c})})(s,i,o)}build(t){const e=this.state;let r;e.id!==io&&ie(307,String(e.id),String(kn)),this.extension.build&&(r=this.extension.build(t,e.config,e.registerState));const o={...e.registerState,getOutput:()=>r,getSignal:this.getSignal.bind(this)};this.state=(function(s,i,l){return Object.assign(s,{id:kn,output:i,registerState:l})})(e,r,o)}register(t,e){this._signal=e;const r=this.state;r.id!==kn&&ie(308,String(r.id),String(kn));const o=this.extension.register&&this.extension.register(t,r.config,r.registerState);return this.state=(function(s){return Object.assign(s,{id:vs})})(r),()=>{const s=this.state;s.id!==sr&&ie(309,String(r.id),String(sr)),this.state=(function(i){return Object.assign(i,{id:kn})})(s),o&&o()}}afterRegistration(t){const e=this.state;let r;return e.id!==vs&&ie(310,String(e.id),String(vs)),this.extension.afterRegistration&&(r=this.extension.afterRegistration(t,e.config,e.registerState)),this.state=(function(o){return Object.assign(o,{id:sr})})(e),r}getSignal(){return this._signal===void 0&&ie(311),this._signal}getInitResult(){this.extension.init===void 0&&ie(312,this.extension.name);const t=this.state;return(function(e){return e.id>=io})(t)||ie(313,String(t.id),String(io)),t.initResult}getInitPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionInitDependency():void 0}getExtensionInitDependency(){const t=this.state;return(function(e){return e.id>=ws})(t)||ie(314,String(t.id),String(ws)),{config:t.config}}getPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionDependency():void 0}getInitDependency(t){const e=this.builder.getExtensionRep(t);return e===void 0&&ie(315,this.extension.name,t.name),e.getExtensionInitDependency()}getDependency(t){const e=this.builder.getExtensionRep(t);return e===void 0&&ie(315,this.extension.name,t.name),e.getExtensionDependency()}getState(){const t=this.state;return(function(e){return e.id>=sr})(t)||ie(316,String(t.id),String(sr)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||$g}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){const t=this.state;(function(e){return e.id>=kn})(t)||ie(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}}const Oa={tag:Ut};function Dg(){const n=Q();n.isEmpty()&&n.append(j())}const Fg={config:{setOptions:Oa,updateOptions:Oa},init:({$initialEditorState:n=Dg})=>({$initialEditorState:n,initialized:!1}),afterRegistration(n,{updateOptions:t,setOptions:e},r){const o=r.getInitResult();if(!o.initialized){o.initialized=!0;const{$initialEditorState:s}=o;if(ph(s))n.setEditorState(s,e);else if(typeof s=="function")n.update(()=>{s(n)},t);else if(s&&(typeof s=="string"||typeof s=="object")){const i=n.parseEditorState(s);n.setEditorState(i,e)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[Sn,Ke,qn,Yn,xn]},Ma=Symbol.for("@lexical/extension/LexicalBuilder");function La(){}function Pg(n){throw n}function lo(n){return Array.isArray(n)?n:[n]}const Ns="0.38.2+prod.esm";class Bn{constructor(t){b(this,"roots");b(this,"extensionNameMap");b(this,"outgoingConfigEdges");b(this,"incomingEdges");b(this,"conflicts");b(this,"_sortedExtensionReps");b(this,"PACKAGE_VERSION");this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Ns,this.roots=t;for(const e of t)this.addExtension(e)}static fromExtensions(t){const e=[lo(Fg)];for(const r of t)e.push(lo(r));return new Bn(e)}static maybeFromEditor(t){const e=t[Ma];return e&&(e.PACKAGE_VERSION!==Ns&&ie(292,e.PACKAGE_VERSION,Ns),e instanceof Bn||ie(293)),e}static fromEditor(t){const e=Bn.maybeFromEditor(t);return e===void 0&&ie(294),e}constructEditor(){const{$initialEditorState:t,onError:e,...r}=this.buildCreateEditorArgs(),o=Object.assign(Li({...r,...e?{onError:s=>{e(s,o)}}:{}}),{[Ma]:this});for(const s of this.sortedExtensionReps())s.build(o);return o}buildEditor(){let t=La;function e(){try{t()}finally{t=La}}const r=Object.assign(this.constructEditor(),{dispose:e,[Symbol.dispose]:e});return t=Me(this.registerEditor(r),()=>r.setRootElement(null)),r}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){const e=this.extensionNameMap.get(t.name);if(e)return e.extension!==t&&ie(295,t.name),e}addEdge(t,e,r){const o=this.outgoingConfigEdges.get(t);o?o.set(e,r):this.outgoingConfigEdges.set(t,new Map([[e,r]]));const s=this.incomingEdges.get(e);s?s.add(t):this.incomingEdges.set(e,new Set([t]))}addExtension(t){this._sortedExtensionReps!==void 0&&ie(296);const e=lo(t),[r]=e;typeof r.name!="string"&&ie(297,typeof r.name);let o=this.extensionNameMap.get(r.name);if(o!==void 0&&o.extension!==r&&ie(298,r.name),!o){o=new Rg(this,r),this.extensionNameMap.set(r.name,o);const s=this.conflicts.get(r.name);typeof s=="string"&&ie(299,r.name,s);for(const i of r.conflictsWith||[])this.extensionNameMap.has(i)&&ie(299,r.name,i),this.conflicts.set(i,r.name);for(const i of r.dependencies||[]){const l=lo(i);this.addEdge(r.name,l[0].name,l.slice(1)),this.addExtension(l)}for(const[i,l]of r.peerDependencies||[])this.addEdge(r.name,i,l?[l]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const t=[],e=(r,o)=>{let s=r.state;if(xd(s))return;const i=r.extension.name;var l;Ts(s)||ie(300,i,o||"[unknown]"),Ts(l=s)||ie(304,String(l.id),String(el)),s=Object.assign(l,{id:li}),r.state=s;const a=this.outgoingConfigEdges.get(i);if(a)for(const c of a.keys()){const u=this.extensionNameMap.get(c);u&&e(u,i)}s=Ag(s),r.state=s,t.push(r)};for(const r of this.extensionNameMap.values())Ts(r.state)&&e(r);for(const r of t)for(const[o,s]of this.outgoingConfigEdges.get(r.extension.name)||[])if(s.length>0){const i=this.extensionNameMap.get(o);if(i)for(const l of s)i.configs.add(l)}for(const[r,...o]of this.roots)if(o.length>0){const s=this.extensionNameMap.get(r.name);s===void 0&&ie(301,r.name);for(const i of o)s.configs.add(i)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){const e=this.sortedExtensionReps(),r=new AbortController,o=[()=>r.abort()],s=r.signal;for(const i of e){const l=i.register(t,s);l&&o.push(l)}for(const i of e){const l=i.afterRegistration(t);l&&o.push(l)}return Me(...o)}buildCreateEditorArgs(){const t={},e=new Set,r=new Map,o=new Map,s={},i={},l=this.sortedExtensionReps();for(const u of l){const{extension:f}=u;if(f.onError!==void 0&&(t.onError=f.onError),f.disableEvents!==void 0&&(t.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(t.parentEditor=f.parentEditor),f.editable!==void 0&&(t.editable=f.editable),f.namespace!==void 0&&(t.namespace=f.namespace),f.$initialEditorState!==void 0&&(t.$initialEditorState=f.$initialEditorState),f.nodes)for(const d of Lg(f)){if(typeof d!="function"){const g=r.get(d.replace);g&&ie(302,f.name,d.replace.name,g.extension.name),r.set(d.replace,u)}e.add(d)}if(f.html){if(f.html.export)for(const[d,g]of f.html.export.entries())o.set(d,g);f.html.import&&Object.assign(s,f.html.import)}f.theme&&Cd(i,f.theme)}Object.keys(i).length>0&&(t.theme=i),e.size&&(t.nodes=[...e]);const a=Object.keys(s).length>0,c=o.size>0;(a||c)&&(t.html={},a&&(t.html.import=s),c&&(t.html.export=o));for(const u of l)u.init(t);return t.onError||(t.onError=Pg),t}}function Ig(n,t){const e=Bn.fromEditor(n).extensionNameMap.get(t);return e?e.getExtensionDependency():void 0}const bd=K("INSERT_HORIZONTAL_RULE_COMMAND");class Hr extends Kr{static getType(){return"horizontalrule"}static clone(t){return new Hr(t.__key)}static importJSON(t){return wd().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:Kg,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){const e=document.createElement("hr");return oe(e,t.theme.hr),e}getTextContent(){return`
|
|
14
|
+
`}isInline(){return!1}updateDOM(){return!1}}function Kg(){return{node:wd()}}function wd(){return Hu(Hr)}function vd(n){return n instanceof Hr}function Bg(n,t,e,r,o){if(n===null||e.size===0&&r.size===0&&!o)return 0;const s=t._selection,i=n._selection;if(o)return 1;if(!(O(s)&&O(i)&&i.isCollapsed()&&s.isCollapsed()))return 0;const l=(function(y,m,C){const S=y._nodeMap,w=[];for(const x of m){const v=S.get(x);v!==void 0&&w.push(v)}for(const[x,v]of C){if(!v)continue;const E=S.get(x);E===void 0||pe(E)||w.push(E)}return w})(t,e,r);if(l.length===0)return 0;if(l.length>1){const y=t._nodeMap,m=y.get(s.anchor.key),C=y.get(i.anchor.key);return m&&C&&!n._nodeMap.has(m.__key)&&$(m)&&m.__text.length===1&&s.anchor.offset===1?2:0}const a=l[0],c=n._nodeMap.get(a.__key);if(!$(c)||!$(a)||c.__mode!==a.__mode)return 0;const u=c.__text,f=a.__text;if(u===f)return 0;const d=s.anchor,g=i.anchor;if(d.key!==g.key||d.type!=="text")return 0;const h=d.offset,p=g.offset,_=f.length-u.length;return _===1&&p===h-1?2:_===-1&&p===h+1?3:_===-1&&p===h?4:0}function Wg(n,t){let e=Date.now(),r=0;return(o,s,i,l,a,c)=>{const u=Date.now();if(c.has(vo))return r=0,e=u,2;const f=Bg(o,s,l,a,n.isComposing()),d=(()=>{const g=i===null||i.editor===n,h=c.has(Gf);if(!h&&g&&c.has(Ut))return 0;if(o===null)return 1;const p=s._selection;if(!(l.size>0||a.size>0))return p!==null?0:2;const _=typeof t=="number"?t:t.peek();return h===!1&&f!==0&&f===r&&u<e+_&&g||l.size===1&&(function(y,m,C){const S=m._nodeMap.get(y),w=C._nodeMap.get(y),x=m._selection,v=C._selection;return!(O(x)&&O(v)&&x.anchor.type==="element"&&x.focus.type==="element"&&v.anchor.type==="text"&&v.focus.type==="text"||!$(S)||!$(w)||S.__parent!==w.__parent)&&JSON.stringify(m.read(()=>S.exportJSON()))===JSON.stringify(C.read(()=>w.exportJSON()))})(Array.from(l)[0],o,s)?0:1})();return e=u,r=f,d}}function Aa(n){n.undoStack=[],n.redoStack=[],n.current=null}function Td(n,t,e){const r=Wg(n,e);return Me(n.registerCommand(Ko,()=>((function(s,i){const l=i.redoStack,a=i.undoStack;if(a.length!==0){const c=i.current,u=a.pop();c!==null&&(l.push(c),s.dispatchCommand(ar,!0)),a.length===0&&s.dispatchCommand(cr,!1),i.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:vo})}})(n,t),!0),J),n.registerCommand(Bo,()=>((function(s,i){const l=i.redoStack,a=i.undoStack;if(l.length!==0){const c=i.current;c!==null&&(a.push(c),s.dispatchCommand(cr,!0));const u=l.pop();l.length===0&&s.dispatchCommand(ar,!1),i.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:vo})}})(n,t),!0),J),n.registerCommand(vi,()=>(Aa(t),!1),J),n.registerCommand(eu,()=>(Aa(t),n.dispatchCommand(ar,!1),n.dispatchCommand(cr,!1),!0),J),n.registerUpdateListener(({editorState:s,prevEditorState:i,dirtyLeaves:l,dirtyElements:a,tags:c})=>{const u=t.current,f=t.redoStack,d=t.undoStack,g=u===null?null:u.editorState;if(u!==null&&s===g)return;const h=r(i,s,u,l,a,c);if(h===1)f.length!==0&&(t.redoStack=[],n.dispatchCommand(ar,!1)),u!==null&&(d.push({...u}),n.dispatchCommand(cr,!0));else if(h===2)return;t.current={editor:n,editorState:s}}))}function tl(){return{current:null,redoStack:[],undoStack:[]}}const Es={build:(n,{delay:t,createInitialHistoryState:e,disabled:r})=>Qi({delay:t,disabled:r,historyState:e(n)}),config:{createInitialHistoryState:tl,delay:300,disabled:typeof window>"u"},name:"@lexical/history/History",register:(n,t,e)=>{const r=e.getOutput();return kr(()=>r.disabled.value?void 0:Td(n,r.historyState.value,r.delay))}};zh(Es,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0});function zg({delay:n,externalHistoryState:t}){const[e]=Ce();return(function(r,o,s=1e3){const i=L.useMemo(()=>o||tl(),[o]);L.useEffect(()=>Td(r,i,s),[s,r,i])})(e,t,n),null}let Nd=class extends Kr{constructor(e,r){super(r);b(this,"__format");this.__format=e||""}exportJSON(){return{...super.exportJSON(),format:this.__format||""}}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format||"")}canIndent(){return!1}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(e){const r=this.getWritable();return r.__format=e,r}isInline(){return!1}};function ai(n){return n instanceof Nd}function $a(n,t){return n.getEditorState().read(()=>{const e=Y(t);return e!==null&&e.isSelected()})}function nl(n){const[t]=Ce(),[e,r]=L.useState(()=>$a(t,n));return L.useEffect(()=>{let o=!0;const s=t.registerUpdateListener(()=>{o&&r($a(t,n))});return()=>{o=!1,s()}},[t,n]),[e,L.useCallback(o=>{t.update(()=>{let s=M();he(s)||(s=qo(),ne(s)),he(s)&&(o?s.add(n):s.delete(n))})},[t,n]),L.useCallback(()=>{t.update(()=>{const o=M();he(o)&&o.clear()})},[t])]}function Ug({children:n,format:t,nodeKey:e,className:r}){const[o]=Ce(),[s,i,l]=nl(e),a=L.useRef(null);return L.useEffect(()=>Me(o.registerCommand(Jo,c=>{if(s){const u=M();if(he(u)){const f=Y(e);ai(f)&&f.setFormat(c)}else if(O(u)){const f=u.getNodes();for(const d of f)ai(d)?d.setFormat(c):Xi(d).setFormat(c)}return!0}return!1},Ye),o.registerCommand(Ar,c=>c.target===a.current&&(c.preventDefault(),c.shiftKey||l(),i(!s),!0),Ye)),[l,o,s,e,i]),X.jsx("div",{className:[r.base,s?r.focus:null].filter(Boolean).join(" "),ref:a,style:{textAlign:t||void 0},children:n})}function Hg(){return Q().getTextContent()}function jg(n,t=!0){if(n)return!1;let e=Hg();return t&&(e=e.trim()),e===""}function Jg(n){if(!jg(n,!1))return!1;const t=Q().getChildren(),e=t.length;if(e>1)return!1;for(let r=0;r<e;r++){const o=t[r];if(q(o))return!1;if(N(o)){if(!bt(o)||o.__indent!==0)return!1;const s=o.getChildren(),i=s.length;for(let l=0;l<i;l++){const a=s[r];if(!$(a))return!1}}}return!0}function Ed(n){return()=>Jg(n)}function Vg(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function qg(n,t,e,r){const o=i=>i instanceof e,s=i=>{const l=fe(i.getTextContent());l.setFormat(i.getFormat()),i.replace(l)};return[n.registerNodeTransform(Ke,i=>{if(!i.isSimpleText())return;let l,a=i.getPreviousSibling(),c=i.getTextContent(),u=i;if($(a)){const d=a.getTextContent(),g=t(d+c);if(o(a)){if(g===null||(h=>h.getLatest().__mode)(a)!==0)return void s(a);{const h=g.end-d.length;if(h>0){const p=d+c.slice(0,h);if(a.select(),a.setTextContent(p),h===c.length)i.remove();else{const _=c.slice(h);i.setTextContent(_)}return}}}else if(g===null||g.start<d.length)return}let f=0;for(;;){l=t(c);let d,g=l===null?"":c.slice(l.end);if(c=g,g===""){const p=u.getNextSibling();if($(p)){g=u.getTextContent()+p.getTextContent();const _=t(g);if(_===null)return void(o(p)?s(p):p.markDirty());if(_.start!==0)return}}if(l===null)return;if(l.start===0&&$(a)&&a.isTextEntity()){f+=l.end;continue}l.start===0?[d,u]=u.splitText(l.end):[,d,u]=u.splitText(l.start+f,l.end+f),d===void 0&&Vg(165,"nodeToReplace");const h=r(d);if(h.setFormat(d.getFormat()),d.replace(h),u==null)return;f=0,a=h}}),n.registerNodeTransform(e,i=>{const l=i.getTextContent(),a=t(l);if(a===null||a.start!==0)return void s(i);if(l.length>a.end)return void i.splitText(a.end);const c=i.getPreviousSibling();$(c)&&c.isTextEntity()&&(s(c),s(i));const u=i.getNextSibling();$(u)&&u.isTextEntity()&&(s(u),o(i)&&s(i))})]}let ss=class kd extends Ke{static getType(){return"hashtag"}static clone(t){return new kd(t.__text,t.__key)}createDOM(t){const e=super.createDOM(t);return oe(e,t.theme.hashtag),e}static importJSON(t){return Od().updateFromJSON(t)}canInsertTextBefore(){return!1}isTextEntity(){return!0}};function Od(n=""){return de(new ss(n))}const Yg=new RegExp((function(){const{alpha:n,alphanumeric:t,hashChars:e}=(function(){const o=String.fromCharCode,s="A-Za-zªµºÀ-ÖØ-öø-Ɂɐ-ˁˆ-ˑˠ-ˤˮͺΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϵϷ-ҁҊ-ӎӐ-ӹԀ-ԏԱ-Ֆՙա-ևא-תװ-ײء-غـ-يٮ-ٯٱ-ۓەۥ-ۦۮ-ۯۺ-ۼۿܐܒ-ܯݍ-ݭހ-ޥޱऄ-हऽॐक़-ॡॽঅ-ঌএ-ঐও-নপ-রলশ-হঽৎড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલ-ળવ-હઽૐૠ-ૡଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହଽଡ଼-ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡඅ-ඖක-නඳ-රලව-ෆก-ะา-ำเ-ๆກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ະາ-ຳຽເ-ໄໆໜ-ໝༀཀ-ཇཉ-ཪྈ-ྋက-အဣ-ဧဩ-ဪၐ-ၕႠ-Ⴥა-ჺჼᄀ-ᅙᅟ-ᆢᆨ-ᇹሀ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙶᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦩᧁ-ᧇᨀ-ᨖᴀ-ᶿḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₔℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℱℳ-ℹℼ-ℿⅅ-ⅉⰀ-Ⱞⰰ-ⱞⲀ-ⳤⴀ-ⴥⴰ-ⵥⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〆〱-〵〻-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄬㄱ-ㆎㆠ-ㆷㇰ-ㇿ㐀-䶵一-龻ꀀ-ꒌꠀ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢ가-힣豈-鶴侮-頻並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵÀ-ÖØ-öø-ÿĀ-ɏɓ-ɔɖ-ɗəɛɣɨɯɲʉʋʻ̀-ͯḀ-ỿЀ-ӿԀ-ԧⷠ-ⷿꙀ-֑ꚟ-ֿׁ-ׂׄ-ׇׅא-תװ-״-ﬨשׁ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﭏؐ-ؚؠ-ٟٮ-ۓە-ۜ۞-۪ۨ-ۯۺ-ۼۿݐ-ݿࢠࢢ-ࢬࣤ-ࣾﭐ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼ-ก-ฺเ-๎ᄀ-ᇿ-ㆅꥠ-가-ힰ-ᄀ-ᅵァ-ヺー-ヾヲ-゚0-9A-Za-zぁ-ゖ゙-ゞ㐀-䶿一-鿿"+o(173824)+"-"+o(177983)+o(177984)+"-"+o(178207)+o(194560)+"-"+o(195103)+"〃々〻";return{alpha:s,alphanumeric:s+"̀-ͯ҃-֑҆-ֹֻ-ֽֿׁ-ׂׄ-ׇׅؐ-ًؕ-ٰٞۖ-ۜ۟-ۤۧ-۪ۨ-ܑۭܰ-݊ަ-ްँ-ः़ा-्॑-॔ॢ-ॣঁ-ঃ়া-ৄে-ৈো-্ৗৢ-ৣਁ-ਃ਼ਾ-ੂੇ-ੈੋ-੍ੰ-ੱઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣଁ-ଃ଼ା-ୃେ-ୈୋ-୍ୖ-ୗஂா-ூெ-ைொ-்ௗఁ-ఃా-ౄె-ైొ-్ౕ-ౖಂ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕ-ೖം-ഃാ-ൃെ-ൈൊ-്ൗං-ඃ්ා-ුූෘ-ෟෲ-ෳัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-༹༙༵༷༾-༿ཱ-྄྆-྇ྐ-ྗྙ-ྼ࿆ာ-ဲံ-္ၖ-ၙ፟ᜒ-᜔ᜲ-᜴ᝒ-ᝓᝲ-ᝳា-៓៝᠋-᠍ᢩᤠ-ᤫᤰ-᤻ᦰ-ᧀᧈ-ᧉᨗ-ᨛ᷀-᷃⃐-⃥⃜⃡-⃫〪-゙〯-゚ꠂ꠆ꠋꠣ-ꠧﬞ︀-️︠-︣0-9٠-٩۰-۹०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉០-៩᠐-᠙᥆-᥏᧐-᧙0-9_",hashChars:"#\\uFF03"}})(),r="["+t+"]";return"("+("^|$|[^&/"+t+"]")+")("+("["+e+"]")+")("+r+"*"+("["+n+"]")+r+"*)"})(),"i"),Xg={getHashtagMatch:function(n){const t=Yg.exec(n);if(t===null)return null;const e=t[3].length+1,r=t.index+t[1].length;return{end:r+e,start:r}}};function Gg(n,t=Xg){return Me(...qg(n,t.getHashtagMatch,ss,e=>Od(e.getTextContent())))}const Zg=new Set(["http:","https:","mailto:","sms:","tel:"]);let jr=class Md extends ae{constructor(e="",r={},o){super(o);b(this,"__url");b(this,"__target");b(this,"__rel");b(this,"__title");const{target:s=null,rel:i=null,title:l=null}=r;this.__url=e,this.__target=s,this.__rel=i,this.__title=l}static getType(){return"link"}static clone(e){return new Md(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}createDOM(e){const r=document.createElement("a");return this.updateLinkDOM(null,r,e),oe(r,e.theme.link),r}updateLinkDOM(e,r,o){if(Bi(r)){e&&e.__url===this.__url||(r.href=this.sanitizeUrl(this.__url));for(const s of["target","rel","title"]){const i=`__${s}`,l=this[i];e&&e[i]===l||(l?r[s]=l:r.removeAttribute(s))}}}updateDOM(e,r,o){return this.updateLinkDOM(e,r,o),!1}static importDOM(){return{a:e=>({conversion:Qg,priority:1})}}static importJSON(e){return rn().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=Fa(e);try{const r=new URL(Fa(e));if(!Zg.has(r.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){const r=this.getWritable();return r.__url=e,r}getTarget(){return this.getLatest().__target}setTarget(e){const r=this.getWritable();return r.__target=e,r}getRel(){return this.getLatest().__rel}setRel(e){const r=this.getWritable();return r.__rel=e,r}getTitle(){return this.getLatest().__title}setTitle(e){const r=this.getWritable();return r.__title=e,r}insertNewAfter(e,r=!0){const o=rn(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(o,r),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,r,o){if(!O(r))return!1;const s=r.anchor.getNode(),i=r.focus.getNode();return this.isParentOf(s)&&this.isParentOf(i)&&r.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}};function Qg(n){let t=null;if(Bi(n)){const e=n.textContent;(e!==null&&e!==""||n.children.length>0)&&(t=rn(n.getAttribute("href")||"",{rel:n.getAttribute("rel"),target:n.getAttribute("target"),title:n.getAttribute("title")}))}return{node:t}}function rn(n="",t){return de(new jr(n,t))}function dt(n){return n instanceof jr}let rl=class Ld extends jr{constructor(e="",r={},o){super(e,r,o);b(this,"__isUnlinked");this.__isUnlinked=r.isUnlinked!==void 0&&r.isUnlinked!==null&&r.isUnlinked}static getType(){return"autolink"}static clone(e){return new Ld(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const r=this.getWritable();return r.__isUnlinked=e,r}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,r,o){return super.updateDOM(e,r,o)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return Ra().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,r=!0){const o=this.getParentOrThrow().insertNewAfter(e,r);if(N(o)){const s=Ra(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return o.append(s),s}return null}};function Ra(n="",t){return de(new rl(n,t))}function ur(n){return n instanceof rl}const ci=K("TOGGLE_LINK_COMMAND");function Da(n,t){if(n.type==="element"){const e=n.getNode();return N(e)||(function(r,...o){const s=new URL("https://lexical.dev/docs/error"),i=new URLSearchParams;i.append("code",r);for(const l of o)i.append("v",l);throw s.search=i.toString(),Error(`Minified Lexical error #${r}; visit ${s.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(252),e.getChildren()[n.offset+t]||null}return null}function ks(n,t={}){let e;if(n&&typeof n=="object"){const{url:u,...f}=n;e=u,t={...f,...t}}else e=n;const{target:r,title:o}=t,s=t.rel===void 0?"noreferrer":t.rel,i=M();if(i===null||!O(i)&&!he(i))return;if(he(i)){const u=i.getNodes();return u.length===0?void 0:void u.forEach(f=>{if(e===null){const d=z(f,g=>!ur(g)&&dt(g));d&&(d.insertBefore(f),d.getChildren().length===0&&d.remove())}else{const d=z(f,g=>!ur(g)&&dt(g));if(d)d.setURL(e),r!==void 0&&d.setTarget(r),s!==void 0&&d.setRel(s);else{const g=rn(e,{rel:s,target:r});f.insertBefore(g),g.append(f)}}})}const l=i.extract();if(e===null){const u=new Set;return void l.forEach(f=>{const d=f.getParent();if(dt(d)&&!ur(d)){const g=d.getKey();if(u.has(g))return;(function(h,p){const _=new Set(p.filter(v=>h.isParentOf(v)).map(v=>v.getKey())),y=h.getChildren(),m=y.filter(v=>_.has(v.getKey()));if(m.length===y.length)return y.forEach(v=>h.insertBefore(v)),void h.remove();const C=y.findIndex(v=>_.has(v.getKey())),S=y.findLastIndex(v=>_.has(v.getKey())),w=C===0,x=S===y.length-1;if(w)m.forEach(v=>h.insertBefore(v));else if(x)for(let v=m.length-1;v>=0;v--)h.insertAfter(m[v]);else{for(let E=m.length-1;E>=0;E--)h.insertAfter(m[E]);const v=y.slice(S+1);if(v.length>0){const E=rn(h.getURL(),{rel:h.getRel(),target:h.getTarget(),title:h.getTitle()});m[m.length-1].insertAfter(E),v.forEach(T=>E.append(T))}}})(d,l),u.add(g)}})}const a=new Set,c=u=>{a.has(u.getKey())||(a.add(u.getKey()),u.setURL(e),r!==void 0&&u.setTarget(r),s!==void 0&&u.setRel(s),o!==void 0&&u.setTitle(o))};if(l.length===1){const u=l[0],f=z(u,dt);if(f!==null)return c(f)}(function(u){const f=M();if(!O(f))return u();const d=Vt(f),g=d.isBackward(),h=Da(d.anchor,g?-1:0),p=Da(d.focus,g?0:-1);if(u(),h||p){const _=M();if(O(_)){const y=_.clone();if(h){const m=h.getParent();m&&y.anchor.set(m.getKey(),h.getIndexWithinParent()+(g?1:0),"element")}if(p){const m=p.getParent();m&&y.focus.set(m.getKey(),p.getIndexWithinParent()+(g?0:1),"element")}ne(Vt(y))}}})(()=>{let u=null;for(const f of l){if(!f.isAttached())continue;const d=z(f,dt);if(d){c(d);continue}if(N(f)){if(!f.isInline())continue;if(dt(f)){if(!(ur(f)||u!==null&&u.getParentOrThrow().isParentOf(f))){c(f),u=f;continue}for(const h of f.getChildren())f.insertBefore(h);f.remove();continue}}const g=f.getPreviousSibling();dt(g)&&g.is(u)?g.append(f):(u=rn(e,{rel:s,target:r,title:o}),f.insertAfter(u),u.append(f))}})}const ep=/^\+?[0-9\s()-]{5,}$/;function Fa(n){return n.match(/^[a-z][a-z0-9+.-]*:/i)||n.match(/^[/#.]/)?n:n.includes("@")?`mailto:${n}`:ep.test(n)?`tel:${n}`:`https://${n}`}function tp(n,t){return Me(kr(()=>n.registerCommand(ci,e=>{const r=t.validateUrl.peek(),o=t.attributes.peek();if(e===null)return ks(null),!0;if(typeof e=="string")return!(r!==void 0&&!r(e))&&(ks(e,o),!0);{const{url:s,target:i,rel:l,title:a}=e;return ks(s,{...o,rel:l,target:i,title:a}),!0}},Ye)),kr(()=>{const e=t.validateUrl.value;if(!e)return;const r=t.attributes.value;return n.registerCommand($r,o=>{const s=M();if(!O(s)||s.isCollapsed()||!Ot(o,ClipboardEvent)||o.clipboardData===null)return!1;const i=o.clipboardData.getData("text");return!!e(i)&&!s.getNodes().some(l=>N(l))&&(n.dispatchCommand(ci,{...r,url:i}),o.preventDefault(),!0)},Ye)}))}function np(n,t,e={}){const r=s=>{const i=s.target;if(!bn(i))return;const l=Zo(i);if(l===null)return;let a=null,c=null;if(l.update(()=>{const d=ye(i);if(d!==null){const g=z(d,N);if(!t.disabled.peek())if(dt(g))a=g.sanitizeUrl(g.getURL()),c=g.getTarget();else{const h=(function(p,_){let y=p;for(;y!=null;){if(_(y))return y;y=y.parentNode}return null})(i,Bi);h!==null&&(a=h.href,c=h.target)}}}),a===null||a==="")return;const u=n.getEditorState().read(M);if(O(u)&&!u.isCollapsed())return void s.preventDefault();const f=s.type==="auxclick"&&s.button===1;window.open(a,t.newTab.peek()||f||s.metaKey||s.ctrlKey||c==="_blank"?"_blank":"_self"),s.preventDefault()},o=s=>{s.button===1&&r(s)};return n.registerRootListener((s,i)=>{i!==null&&(i.removeEventListener("click",r),i.removeEventListener("mouseup",o)),s!==null&&(s.addEventListener("click",r,e),s.addEventListener("mouseup",o,e))})}const Ad=[];let ol=class $d extends ae{constructor(e=Ad,r){super(r);b(this,"__ids");this.__ids=e}static getType(){return"mark"}static clone(e){return new $d(e.__ids,e.__key)}static importDOM(){return null}static importJSON(e){return ui().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIDs(e.ids)}exportJSON(){return{...super.exportJSON(),ids:this.getIDs()}}createDOM(e){const r=document.createElement("mark");return oe(r,e.theme.mark),this.__ids.length>1&&oe(r,e.theme.markOverlap),r}updateDOM(e,r,o){const s=e.__ids,i=this.__ids,l=s.length,a=i.length,c=o.theme.markOverlap;return l!==a&&(l===1?a===2&&oe(r,c):a===1&&Ve(r,c)),!1}hasID(e){return this.getIDs().includes(e)}getIDs(){return Array.from(this.getLatest().__ids)}setIDs(e){const r=this.getWritable();return r.__ids=e,r}addID(e){const r=this.getWritable();return r.__ids.includes(e)?r:r.setIDs([...r.__ids,e])}deleteID(e){const r=this.getWritable(),o=r.__ids.indexOf(e);if(o===-1)return r;const s=Array.from(r.__ids);return s.splice(o,1),r.setIDs(s)}insertNewAfter(e,r=!0){const o=ui(this.__ids);return this.insertAfter(o,r),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,r,o){if(!O(r)||o==="html")return!1;const s=r.anchor,i=r.focus,l=s.getNode(),a=i.getNode(),c=r.isBackward()?s.offset-i.offset:i.offset-s.offset;return this.isParentOf(l)&&this.isParentOf(a)&&this.getTextContent().length===c}excludeFromCopy(e){return e!=="clone"}};function ui(n=Ad){return de(new ol(n))}function Ao(n){return n instanceof ol}function rp(n){const t=n.getChildren();let e=null;for(let r=0;r<t.length;r++){const o=t[r];e===null?n.insertBefore(o):e.insertAfter(o),e=o}n.remove()}function op(n,t,e,r){const o=Gn(),[s,i]=n.isBackward()?[n.focus,n.anchor]:[n.anchor,n.focus];let l,a;o.anchor.set(s.key,s.offset,s.type),o.focus.set(i.key,i.offset,i.type);const c=o.extract();for(const u of c){if(N(a)&&a.isParentOf(u))continue;let f=null;if($(u))f=u;else{if(Ao(u))continue;(N(u)||q(u))&&u.isInline()&&(f=u)}if(f!==null){if(f&&f.is(l))continue;const d=f.getParent();d!=null&&d.is(l)||(a=void 0),l=d,a===void 0&&(a=(r||ui)([e]),f.insertBefore(a)),a.append(f)}else l=void 0,a=void 0}N(a)&&(t?a.selectStart():a.selectEnd())}function sp(n,t){let e=n;for(;e!==null;){if(Ao(e))return e.getIDs();if($(e)&&t===e.getTextContentSize()){const r=e.getNextSibling();if(Ao(r))return r.getIDs()}e=e.getParent()}return null}let ip=class extends ae{$config(){return this.config("overflow",{$transform(t){t.isEmpty()&&t.remove()},extends:ae})}createDOM(t){const e=document.createElement("span"),r=t.theme.characterLimit;return typeof r=="string"&&(e.className=r),e}updateDOM(t,e){return!1}insertNewAfter(t,e=!0){return this.getParentOrThrow().insertNewAfter(t,e)}excludeFromCopy(){return!0}};function lp({nodeKey:n}){const[t]=Ce(),[e,r,o]=nl(n);return L.useEffect(()=>Me(t.registerCommand(Ar,s=>{const i=t.getElementByKey(n);return s.target===i&&(s.shiftKey||o(),r(!e),!0)},Ye)),[o,t,e,n,r]),L.useEffect(()=>{const s=t.getElementByKey(n),i=t._config.theme.hrSelected??"selected";s!==null&&(e?oe(s,i):Ve(s,i))},[t,e,n]),null}let sl=class Rd extends Hr{static getType(){return"horizontalrule"}static clone(t){return new Rd(t.__key)}static importJSON(t){return Jr().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:ap,priority:0})}}decorate(){return X.jsx(lp,{nodeKey:this.__key})}};function ap(){return{node:Jr()}}function Jr(){return de(new sl)}function $o(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function cp(n,t=M()){return t==null&&$o(166),O(t)&&t.isCollapsed()||t.getNodes().length===0?"":Gi(n,t)}function up(n,t=M()){return t==null&&$o(166),O(t)&&t.isCollapsed()||t.getNodes().length===0?null:JSON.stringify(dp(n,t))}function Pa(n,t,e){const r=n.getData("application/x-lexical-editor");if(r)try{const l=JSON.parse(r);if(l.namespace===e._config.namespace&&Array.isArray(l.nodes))return Ia(e,fp(l.nodes),t)}catch(l){console.error(l)}const o=n.getData("text/html"),s=n.getData("text/plain");if(o&&s!==o)try{const l=new DOMParser().parseFromString((function(a){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:c=>c}).createHTML(a):a})(o),"text/html");return Ia(e,cd(e,l),t)}catch(l){console.error(l)}const i=s||n.getData("text/uri-list");if(i!=null)if(O(t)){const l=i.split(/(\r?\n|\t)/);l[l.length-1]===""&&l.pop();for(let a=0;a<l.length;a++){const c=M();if(O(c)){const u=l[a];u===`
|
|
15
|
+
`||u===`\r
|
|
16
|
+
`?c.insertParagraph():u===" "?c.insertNodes([Xn()]):c.insertText(u)}}}else t.insertRawText(i)}function Ia(n,t,e){n.dispatchCommand(qc,{nodes:t,selection:e})||(e.insertNodes(t),(function(r){if(O(r)&&r.isCollapsed()){const o=r.anchor;let s=null;const i=xt(o,"previous");if(i)if(mt(i))s=i.origin;else{const l=At(i,tt(Q(),"next").getFlipped());for(const a of l){if($(a.origin)){s=a.origin;break}if(N(a.origin)&&!a.origin.isInline())break}}if(s&&$(s)){const l=s.getFormat(),a=s.getStyle();r.format===l&&r.style===a||(r.format=l,r.style=a,r.dirty=!0)}}})(e))}function Dd(n,t,e,r=[]){let o=t===null||e.isSelected(t);const s=N(e)&&e.excludeFromCopy("html");let i=e;t!==null&&$(i)&&(i=ed(t,i,"clone"));const l=N(i)?i.getChildren():[],a=(function(c){const u=c.exportJSON(),f=c.constructor;if(u.type!==f.getType()&&$o(58,f.name),N(c)){const d=u.children;Array.isArray(d)||$o(59,f.name)}return u})(i);$(i)&&i.getTextContentSize()===0&&(o=!1);for(let c=0;c<l.length;c++){const u=l[c],f=Dd(n,t,u,a.children);!o&&N(e)&&f&&e.extractWithChild(u,t,"clone")&&(o=!0)}if(o&&!s)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 dp(n,t){const e=[],r=Q().getChildren();for(let o=0;o<r.length;o++)Dd(n,t,r[o],e);return{namespace:n._config.namespace,nodes:e}}function fp(n){const t=[];for(let e=0;e<n.length;e++){const r=n[e],o=gh(r);$(o)&&Yh(o),t.push(o)}return t}let On=null;async function di(n,t,e){if(On!==null)return!1;if(t!==null)return new Promise((c,u)=>{n.update(()=>{c(Ka(n,t,e))})});const r=n.getRootElement(),o=n._window||window,s=o.document,i=et(o);if(r===null||i===null)return!1;const l=s.createElement("span");l.style.cssText="position: fixed; top: -1000px;",l.append(s.createTextNode("#")),r.append(l);const a=new Range;return a.setStart(l,0),a.setEnd(l,1),i.removeAllRanges(),i.addRange(a),new Promise((c,u)=>{const f=n.registerCommand(Pr,d=>(Ot(d,ClipboardEvent)&&(f(),On!==null&&(o.clearTimeout(On),On=null),c(Ka(n,d,e))),!0),Fe);On=o.setTimeout(()=>{f(),On=null,c(!1)},50),s.execCommand("copy"),l.remove()})}function Ka(n,t,e){if(e===void 0){const o=et(n._window),s=M();if(!s||s.isCollapsed()||!o)return!1;const i=o.anchorNode,l=o.focusNode;if(i!==null&&l!==null&&!Wr(n,i,l))return!1;e=il(s)}t.preventDefault();const r=t.clipboardData;return r!==null&&(hp(r,e),!0)}const Fd=[["text/html",cp],["application/x-lexical-editor",up]];function il(n=M()){const t={"text/plain":n?n.getTextContent():""};if(n){const e=wn();for(const[r,o]of Fd){const s=o(e,n);s!==null&&(t[r]=s)}}return t}function hp(n,t){for(const[e]of Fd)t[e]===void 0&&n.setData(e,"");for(const e in t){const r=t[e];r!==void 0&&n.setData(e,r)}}function gp(n){const t=window.location.origin,e=r=>{if(r.origin!==t)return;const o=n.getRootElement();if(document.activeElement!==o)return;const s=r.data;if(typeof s=="string"){let i;try{i=JSON.parse(s)}catch{return}if(i&&i.protocol==="nuanria_messaging"&&i.type==="request"){const l=i.payload;if(l&&l.functionId==="makeChanges"){const a=l.args;if(a){const[c,u,f,d,g]=a;n.update(()=>{const h=M();if(O(h)){const p=h.anchor;let _=p.getNode(),y=0,m=0;if($(_)&&c>=0&&u>=0&&(y=c,m=c+u,h.setTextNodeRange(_,y,_,m)),y===m&&f===""||(h.insertRawText(f),_=p.getNode()),$(_)){y=d,m=d+g;const C=_.getTextContentSize();y=y>C?C:y,m=m>C?C:m,h.setTextNodeRange(_,y,_,m)}r.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",e,!0),()=>{window.removeEventListener("message",e,!0)}}function Ba(n,t){if(document.caretRangeFromPoint!==void 0){const e=document.caretRangeFromPoint(n,t);return e===null?null:{node:e.startContainer,offset:e.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const e=document.caretPositionFromPoint(n,t);return e===null?null:{node:e.offsetNode,offset:e.offset}}return null}const Tn=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,pp=Tn&&"documentMode"in document?document.documentMode:null,_p=Tn&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),mp=!(!Tn||!("InputEvent"in window)||pp)&&"getTargetRanges"in new window.InputEvent("input"),yp=Tn&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Wa=Tn&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Cp=Tn&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Sp=Tn&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&_p&&!Cp,za=K("DRAG_DROP_PASTE_FILE");class Vr extends ae{static getType(){return"quote"}static clone(t){return new Vr(t.__key)}createDOM(t){const e=document.createElement("blockquote");return oe(e,t.theme.quote),e}updateDOM(t,e){return!1}static importDOM(){return{blockquote:t=>({conversion:bp,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(se(e)){this.isEmpty()&&e.append(document.createElement("br"));const r=this.getFormatType();r&&(e.style.textAlign=r);const o=this.getDirection();o&&(e.dir=o)}return{element:e}}static importJSON(t){return ll().updateFromJSON(t)}insertNewAfter(t,e){const r=j(),o=this.getDirection();return r.setDirection(o),this.insertAfter(r,e),r}collapseAtStart(){const t=j();return this.getChildren().forEach(e=>t.append(e)),this.replace(t),!0}canMergeWhenEmpty(){return!0}}function ll(){return de(new Vr)}function xp(n){return n instanceof Vr}class Zn extends ae{constructor(e,r){super(r);b(this,"__tag");this.__tag=e}static getType(){return"heading"}static clone(e){return new Zn(e.__tag,e.__key)}getTag(){return this.__tag}setTag(e){const r=this.getWritable();return this.__tag=e,r}createDOM(e){const r=this.__tag,o=document.createElement(r),s=e.theme.heading;if(s!==void 0){const i=s[r];oe(o,i)}return o}updateDOM(e,r,o){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:Mn,priority:0}),h2:e=>({conversion:Mn,priority:0}),h3:e=>({conversion:Mn,priority:0}),h4:e=>({conversion:Mn,priority:0}),h5:e=>({conversion:Mn,priority:0}),h6:e=>({conversion:Mn,priority:0}),p:e=>{const r=e.firstChild;return r!==null&&Ua(r)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Ua(e)?{conversion:r=>({node:Fn("h1")}),priority:3}:null}}exportDOM(e){const{element:r}=super.exportDOM(e);if(se(r)){this.isEmpty()&&r.append(document.createElement("br"));const o=this.getFormatType();o&&(r.style.textAlign=o);const s=this.getDirection();s&&(r.dir=s)}return{element:r}}static importJSON(e){return Fn(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,r=!0){const o=e?e.anchor.offset:0,s=this.getLastDescendant(),i=!s||e&&e.anchor.key===s.getKey()&&o===s.getTextContentSize()||!e?j():Fn(this.getTag()),l=this.getDirection();if(i.setDirection(l),this.insertAfter(i,r),o===0&&!this.isEmpty()&&e){const a=j();a.select(),this.replace(a,!0)}return i}collapseAtStart(){const e=this.isEmpty()?j():Fn(this.getTag());return this.getChildren().forEach(r=>e.append(r)),this.replace(e),!0}extractWithChild(){return!0}}function Ua(n){return n.nodeName.toLowerCase()==="span"&&n.style.fontSize==="26pt"}function Mn(n){const t=n.nodeName.toLowerCase();let e=null;return t!=="h1"&&t!=="h2"&&t!=="h3"&&t!=="h4"&&t!=="h5"&&t!=="h6"||(e=Fn(t),n.style!==null&&(zi(n,e),e.setFormat(n.style.textAlign))),{node:e}}function bp(n){const t=ll();return n.style!==null&&(t.setFormat(n.style.textAlign),zi(n,t)),{node:t}}function Fn(n="h1"){return de(new Zn(n))}function Cr(n){return n instanceof Zn}function dr(n){let t=null;if(Ot(n,DragEvent)?t=n.dataTransfer:Ot(n,ClipboardEvent)&&(t=n.clipboardData),t===null)return[!1,[],!1];const e=t.types,r=e.includes("Files"),o=e.includes("text/html")||e.includes("text/plain");return[r,Array.from(t.files),o]}function Ha(n){const t=M();if(!O(t))return!1;const e=new Set,r=t.getNodes();for(let o=0;o<r.length;o++){const s=r[o],i=s.getKey();if(e.has(i))continue;const l=z(s,c=>N(c)&&!c.isInline());if(l===null)continue;const a=l.getKey();l.canIndent()&&!e.has(a)&&(e.add(a),n(l))}return e.size>0}function ja(n){const t=ye(n);return q(t)}function Os(n){for(const t of["lowercase","uppercase","capitalize"])n.hasFormat(t)&&n.toggleFormat(t)}function wp(n){return Me(n.registerCommand(Ar,t=>{const e=M();return!!he(e)&&(e.clear(),!0)},J),n.registerCommand(Mt,t=>{const e=M();return O(e)?(e.deleteCharacter(t),!0):!!he(e)&&(e.deleteNodes(),!0)},J),n.registerCommand(zn,t=>{const e=M();return!!O(e)&&(e.deleteWord(t),!0)},J),n.registerCommand(un,t=>{const e=M();return!!O(e)&&(e.deleteLine(t),!0)},J),n.registerCommand(zt,t=>{const e=M();if(typeof t=="string")e!==null&&e.insertText(t);else{if(e===null)return!1;const r=t.dataTransfer;if(r!=null)Pa(r,e,n);else if(O(e)){const o=t.data;return o&&e.insertText(o),!0}}return!0},J),n.registerCommand(Ws,()=>{const t=M();return!!O(t)&&(t.removeText(),!0)},J),n.registerCommand(pt,t=>{const e=M();return!!O(e)&&(e.formatText(t),!0)},J),n.registerCommand(Jo,t=>{const e=M();if(!O(e)&&!he(e))return!1;const r=e.getNodes();for(const o of r){const s=z(o,i=>N(i)&&!i.isInline());s!==null&&s.setFormat(t)}return!0},J),n.registerCommand(tn,t=>{const e=M();return!!O(e)&&(e.insertLineBreak(t),!0)},J),n.registerCommand(cn,()=>{const t=M();return!!O(t)&&(t.insertParagraph(),!0)},J),n.registerCommand(Zc,()=>(Su([Xn()]),!0),J),n.registerCommand(Qc,()=>Ha(t=>{const e=t.getIndent();t.setIndent(e+1)}),J),n.registerCommand(zs,()=>Ha(t=>{const e=t.getIndent();e>0&&t.setIndent(Math.max(0,e-1))}),J),n.registerCommand(Rr,t=>{const e=M();if(he(e)){const r=e.getNodes();if(r.length>0)return t.preventDefault(),r[0].selectPrevious(),!0}else if(O(e)){const r=Qs(e.focus,!0);if(!t.shiftKey&&q(r)&&!r.isIsolated()&&!r.isInline())return r.selectPrevious(),t.preventDefault(),!0}return!1},J),n.registerCommand(Dr,t=>{const e=M();if(he(e)){const r=e.getNodes();if(r.length>0)return t.preventDefault(),r[0].selectNext(0,0),!0}else if(O(e)){if((function(o){const s=o.focus;return s.key==="root"&&s.offset===Q().getChildrenSize()})(e))return t.preventDefault(),!0;const r=Qs(e.focus,!1);if(!t.shiftKey&&q(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),t.preventDefault(),!0}return!1},J),n.registerCommand(zo,t=>{const e=M();if(he(e)){const r=e.getNodes();if(r.length>0)return t.preventDefault(),Sa(r[0])?r[0].selectNext(0,0):r[0].selectPrevious(),!0}if(!O(e))return!1;if(xa(e,!0)){const r=t.shiftKey;return t.preventDefault(),ba(e,r,!0),!0}return!1},J),n.registerCommand(Wo,t=>{const e=M();if(he(e)){const o=e.getNodes();if(o.length>0)return t.preventDefault(),Sa(o[0])?o[0].selectPrevious():o[0].selectNext(0,0),!0}if(!O(e))return!1;const r=t.shiftKey;return!!xa(e,!1)&&(t.preventDefault(),ba(e,r,!1),!0)},J),n.registerCommand(Uo,t=>{if(ja(t.target))return!1;const e=M();if(O(e)){if((function(r){if(!r.isCollapsed())return!1;const{anchor:o}=r;if(o.offset!==0)return!1;const s=o.getNode();if(pe(s))return!1;const i=Xi(s);return i.getIndent()>0&&(i.is(s)||s.is(i.getFirstDescendant()))})(e))return t.preventDefault(),n.dispatchCommand(zs,void 0);if(Wa&&navigator.language==="ko-KR")return!1}else if(!he(e))return!1;return t.preventDefault(),n.dispatchCommand(Mt,!0)},J),n.registerCommand(jo,t=>{if(ja(t.target))return!1;const e=M();return!(!O(e)&&!he(e))&&(t.preventDefault(),n.dispatchCommand(Mt,!1))},J),n.registerCommand(Un,t=>{const e=M();if(!O(e))return!1;if(Os(e),t!==null){if((Wa||yp||Sp)&&mp)return!1;if(t.preventDefault(),t.shiftKey)return n.dispatchCommand(tn,!1)}return n.dispatchCommand(cn,void 0)},J),n.registerCommand(Ho,()=>{const t=M();return!!O(t)&&(n.blur(),!0)},J),n.registerCommand(xi,t=>{const[,e]=dr(t);if(e.length>0){const o=Ba(t.clientX,t.clientY);if(o!==null){const{offset:s,node:i}=o,l=ye(i);if(l!==null){const a=Gn();if($(l))a.anchor.set(l.getKey(),s,"text"),a.focus.set(l.getKey(),s,"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=Vt(a);ne(c)}n.dispatchCommand(za,e)}return t.preventDefault(),!0}const r=M();return!!O(r)},J),n.registerCommand(bi,t=>{const[e]=dr(t),r=M();return!(e&&!O(r))},J),n.registerCommand(wi,t=>{const[e]=dr(t),r=M();if(e&&!O(r))return!1;const o=Ba(t.clientX,t.clientY);if(o!==null){const s=ye(o.node);q(s)&&t.preventDefault()}return!0},J),n.registerCommand(Us,()=>(Pu(),!0),J),n.registerCommand(Pr,t=>(di(n,Ot(t,ClipboardEvent)?t:null),!0),J),n.registerCommand(Ir,t=>((async function(e,r){await di(r,Ot(e,ClipboardEvent)?e:null),r.update(()=>{const o=M();O(o)?o.removeText():he(o)&&o.getNodes().forEach(s=>s.remove())})})(t,n),!0),J),n.registerCommand($r,t=>{const[,e,r]=dr(t);return e.length>0&&!r?(n.dispatchCommand(za,e),!0):bn(t.target)&&$i(t.target)?!1:M()!==null&&((function(o,s){o.preventDefault(),s.update(()=>{const i=M(),l=Ot(o,InputEvent)||Ot(o,KeyboardEvent)?null:o.clipboardData;l!=null&&i!==null&&Pa(l,i,s)},{tag:Zf})})(t,n),!0)},J),n.registerCommand(Si,t=>{const e=M();return O(e)&&Os(e),!1},J),n.registerCommand(Fr,t=>{const e=M();return O(e)&&Os(e),!1},J))}function B(n,t,...e){if(!n)throw new Error("Internal Lexical error: invariant() is meant to be replaced at compile time. There is no runtime version. Error: "+t)}function Ro(...n){const t=[];for(const e of n)if(e&&typeof e=="string")for(const[r]of e.matchAll(/\S+/g))t.push(r);return t}const Jn={blockCursor:"dsd__theme__blockCursor",characterLimit:"dsd__theme__characterLimit",code:"dsd__theme__code",codeCollapsed:"dsd__theme__code_сollapsed",codeHighlight:{atrule:"dsd__theme__tokenAttr",attr:"dsd__theme__tokenAttr",boolean:"dsd__theme__tokenProperty",builtin:"dsd__theme__tokenSelector",cdata:"dsd__theme__tokenComment",char:"dsd__theme__tokenSelector",class:"dsd__theme__tokenFunction","class-name":"dsd__theme__tokenFunction",comment:"dsd__theme__tokenComment",constant:"dsd__theme__tokenProperty",deleted:"dsd__theme__tokenProperty",doctype:"dsd__theme__tokenComment",entity:"dsd__theme__tokenOperator",function:"dsd__theme__tokenFunction",important:"dsd__theme__tokenVariable",inserted:"dsd__theme__tokenSelector",keyword:"dsd__theme__tokenAttr",namespace:"dsd__theme__tokenVariable",number:"dsd__theme__tokenProperty",operator:"dsd__theme__tokenOperator",prolog:"dsd__theme__tokenComment",property:"dsd__theme__tokenProperty",punctuation:"dsd__theme__tokenPunctuation",regex:"dsd__theme__tokenVariable",selector:"dsd__theme__tokenSelector",string:"dsd__theme__tokenSelector",symbol:"dsd__theme__tokenProperty",tag:"dsd__theme__tokenProperty",url:"dsd__theme__tokenOperator",variable:"dsd__theme__tokenVariable"},embedBlock:{base:"dsd__theme__embedBlock",focus:"dsd__theme__embedBlockFocus"},hashtag:"dsd__theme__hashtag",heading:{h1:"dsd__theme__h1",h2:"dsd__theme__h2",h3:"dsd__theme__h3",h4:"dsd__theme__h4",h5:"dsd__theme__h5",h6:"dsd__theme__h6"},excalidraw:"editor-excalidraw",image:"editor-image",indent:"dsd__theme__indent",inlineImage:"inline-editor-image",layoutContainer:"dsd__theme__layoutContainer",layoutItem:"dsd__theme__layoutItem",layoutDivider:"dsd__theme__layoutDivider",calloutIcon:"dsd__theme__callout-icon",callout:"dsd__theme__callout-container",calloutWrapper:"dsd__theme__callout-wrapper",calloutContainer:"dsd__theme__callout-main-container",link:"dsd__theme__link",list:{checklist:"dsd__theme__checklist",listitem:"dsd__theme__listItem",listitemChecked:"dsd__theme__listItemChecked",listitemUnchecked:"dsd__theme__listItemUnchecked",nested:{listitem:"dsd__theme__nestedListItem"},olDepth:["dsd__theme__ol1","dsd__theme__ol2","dsd__theme__ol3","dsd__theme__ol4","dsd__theme__ol5"],ul:"dsd__theme__ul"},listitemIndeterminate:"dsd__theme__listIndeterminate",mark:"dsd__theme__mark",markOverlap:"dsd__theme__markOverlap",paragraph:"dsd__theme__paragraph",quote:"dsd__theme__quote",rtl:"dsd__theme__rtl",table:"dsd__theme__table",tableAddColumns:"dsd__theme__tableAddColumns",tableAddRows:"dsd__theme__tableAddRows",tableCell:"dsd__theme__tableCell",tableCellActionButton:"dsd__theme__tableCellActionButton",tableCellActionButtonContainer:"dsd__theme__tableCellActionButtonContainer",tableCellEditing:"dsd__theme__tableCellEditing",tableCellHeader:"dsd__theme__tableCellHeader",tableCellPrimarySelected:"dsd__theme__tableCellPrimarySelected",tableCellResizer:"dsd__theme__tableCellResizer",tableCellSelected:"dsd__theme__tableCellSelected",tableCellSortedIndicator:"dsd__theme__tableCellSortedIndicator",tableResizeRuler:"dsd__theme__tableCellResizeRuler",tableSelected:"dsd__theme__tableSelected",tableSelection:"dsd__theme__tableSelection",tableScrollableWrapper:"dsd__theme__table-scrollable-wrapper",text:{bold:"dsd__theme__textBold",code:"dsd__theme__textCode",italic:"dsd__theme__textItalic",strikethrough:"dsd__theme__textStrikethrough",subscript:"dsd__theme__textSubscript",superscript:"dsd__theme__textSuperscript",underline:"dsd__theme__textUnderline",underlineStrikethrough:"dsd__theme__textUnderlineStrikethrough"}},vp=n=>{const t={...Jn,text:{...Jn.text}};return n==="comment"&&t.text&&(delete t.text.strikethrough,delete t.text.underlineStrikethrough),t};function Pd(n){let t=1,e=n.getParent();for(;e!=null;){if(ce(e)){const r=e.getParent();if(V(r)){t++,e=r.getParent();continue}B(!1,"A ListItemNode must have a ListNode for a parent.")}return t}return t}function fi(n){let t=n.getParent();V(t)||B(!1,"A ListItemNode must have a ListNode for a parent.");let e=t;for(;e!==null;)e=e.getParent(),V(e)&&(t=e);return t}function Id(n){let t=[];const e=n.getChildren().filter(ce);for(let r=0;r<e.length;r++){const o=e[r],s=o.getFirstChild();V(s)?t=t.concat(Id(s)):t.push(o)}return t}function ht(n){return ce(n)&&V(n.getFirstChild())}function Tp(n){let t=n;for(;t.getNextSibling()==null&&t.getPreviousSibling()==null;){const e=t.getParent();if(e==null||!(ce(t)||V(t)))break;t=e}t.remove()}function Ja(n){return ze().append(n)}function Kd(n,t){return ce(n)&&(t.length===0||t.length===1&&n.is(t[0])&&n.getChildrenSize()===0)}function hi(n,t){n.update(()=>{const e=M();if(e!==null){const r=e.getNodes();if(O(e)){const s=e.getStartEndPoints();B(s!==null,"insertList: anchor should be defined");const[i]=s,l=i.getNode(),a=l.getParent();if(Kd(l,r)){const c=Re(t);if(We(a)){l.replace(c);const u=ze();N(l)&&(u.setFormat(l.getFormatType()),u.setIndent(l.getIndent())),c.append(u)}else if(ce(l)){const u=l.getParentOrThrow();_n(c,u.getChildren()),u.replace(c)}return}}const o=new Set;for(let s=0;s<r.length;s++){const i=r[s];if(N(i)&&i.isEmpty()&&!ce(i)&&!o.has(i.getKey())){Va(i,t);continue}if(Ou(i)){let l=i.getParent();for(;l!=null;){const a=l.getKey();if(V(l)){if(!o.has(a)){const c=Re(t);_n(c,l.getChildren()),l.replace(c),o.add(a)}break}else{const c=l.getParent();if(We(c)&&!o.has(a)){o.add(a),Va(l,t);break}l=c}}}}}})}function _n(n,t){n.splice(n.getChildrenSize(),0,t)}function Va(n,t){if(V(n))return n;const e=n.getPreviousSibling(),r=n.getNextSibling(),o=ze();if(o.setFormat(n.getFormatType()),o.setIndent(n.getIndent()),_n(o,n.getChildren()),V(e)&&t===e.getListType())return e.append(o),n.remove(),V(r)&&t===r.getListType()&&(_n(e,r.getChildren()),r.remove()),e;if(V(r)&&t===r.getListType())return r.getFirstChildOrThrow().insertBefore(o),n.remove(),r;{const s=Re(t);return s.append(o),n.replace(s),s}}function al(n,t){const e=n.getLastChild(),r=t.getFirstChild();e&&r&&ht(e)&&ht(r)&&(al(e.getFirstChild(),r.getFirstChild()),r.remove());const o=t.getChildren();o.length>0&&n.append(...o),t.remove()}function Np(n){n.update(()=>{const t=M();if(O(t)){const e=new Set,r=t.getNodes(),o=t.anchor.getNode();if(Kd(o,r))e.add(fi(o));else for(let s=0;s<r.length;s++){const i=r[s];if(Ou(i)){const l=id(i,Qn);l!=null&&e.add(fi(l))}}for(const s of e){let i=s;const l=Id(s);for(const a of l){const c=j();_n(c,a.getChildren()),i.insertAfter(c),i=c,a.__key===t.anchor.key&&t.anchor.set(c.getKey(),0,"element"),a.__key===t.focus.key&&t.focus.set(c.getKey(),0,"element"),a.remove()}s.remove()}}})}function Ep(n){const t=n.getListType()!=="check";let e=n.getStart();for(const r of n.getChildren())ce(r)&&(r.getValue()!==e&&r.setValue(e),t&&r.getLatest().__checked!=null&&r.setChecked(void 0),V(r.getFirstChild())||e++)}function kp(n){const t=n.getNextSibling();V(t)&&n.getListType()===t.getListType()&&al(n,t)}function Op(n){const t=new Set;if(ht(n)||t.has(n.getKey()))return;const e=n.getParent(),r=n.getNextSibling(),o=n.getPreviousSibling();if(ht(r)&&ht(o)){const s=o.getFirstChild();if(V(s)){s.append(n);const i=r.getFirstChild();if(V(i)){const l=i.getChildren();_n(s,l),r.remove(),t.add(r.getKey())}}}else if(ht(r)){const s=r.getFirstChild();if(V(s)){const i=s.getFirstChild();i!==null&&i.insertBefore(n)}}else if(ht(o)){const s=o.getFirstChild();V(s)&&s.append(n)}else if(V(e)){const s=ze(),i=Re(e.getListType());s.append(i),i.append(n),o?o.insertAfter(s):r?r.insertBefore(s):e.append(s)}}function Mp(n){if(ht(n))return;const t=n.getParent(),e=t?t.getParent():void 0,r=e?e.getParent():void 0;if(V(r)&&ce(e)&&V(t)){const o=t?t.getFirstChild():void 0,s=t?t.getLastChild():void 0;if(n.is(o))e.insertBefore(n),t.isEmpty()&&e.remove();else if(n.is(s))e.insertAfter(n),t.isEmpty()&&e.remove();else{const i=t.getListType(),l=ze(),a=Re(i);l.append(a),n.getPreviousSiblings().forEach(f=>a.append(f));const c=ze(),u=Re(i);c.append(u),_n(u,n.getNextSiblings()),e.insertBefore(l),e.insertAfter(c),e.replace(n)}}}function Lp(){const n=M();if(!O(n)||!n.isCollapsed())return!1;const t=n.anchor.getNode();if(!ce(t)||t.getChildrenSize()!==0)return!1;const e=fi(t),r=t.getParent();B(V(r),"A ListItemNode must have a ListNode for a parent.");const o=r.getParent();let s;if(We(o))s=j(),e.insertAfter(s);else if(ce(o))s=ze(),o.insertAfter(s);else return!1;s.select();const i=t.getNextSiblings();if(i.length>0){const l=Re(r.getListType());if(bt(s))s.insertAfter(l);else{const a=ze();a.append(l),s.insertAfter(a)}i.forEach(a=>{a.remove(),l.append(a)})}return Tp(t),!0}class Qn extends ae{constructor(e,r,o,s,i){super(i);b(this,"__value");b(this,"__checked");b(this,"__opened");b(this,"__isIndeterminate");this.__value=e===void 0?1:e,this.__checked=r,this.__opened=o,this.__isIndeterminate=s}static getType(){return"listitem"}static clone(e){return new Qn(e.__value,e.__checked,e.__opened,e.__isIndeterminate,e.__key)}createDOM(e){const r=document.createElement("li"),o=this.getParent();return V(o)&&o.getListType()==="check"&&Ya(r,this,null),r.value=this.__value,qa(r,e.theme,this),r}updateDOM(e,r,o){const s=this.getParent();return V(s)&&s.getListType()==="check"&&Ya(r,this,e),r.value=this.__value,qa(r,o.theme,this),!1}static transform(){return e=>{if(B(ce(e),"node is not a ListItemNode"),e.__checked==null)return;const r=e.getParent();V(r)&&r.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)}}static importDOM(){return{li:()=>({conversion:Ap,priority:0})}}static importJSON(e){const r=ze(e.checked,e.opened,e.isIndeterminate);return r.setValue(e.value),r.setFormat(e.format),r.setDirection(e.direction),r}exportDOM(e){const r=this.createDOM(e._config);return r.style.textAlign=this.getFormatType(),{element:r}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),opened:this.getOpened(),isIndeterminate:this.__isIndeterminate,version:1}}append(...e){for(let r=0;r<e.length;r++){const o=e[r];if(N(o)&&this.canMergeWith(o)){const s=o.getChildren();this.append(...s),o.remove()}else super.append(o)}return this}replace(e,r){if(ce(e))return super.replace(e);this.setIndent(0);const o=this.getParentOrThrow();if(!V(o))return e;if(o.__first===this.getKey())o.insertBefore(e);else if(o.__last===this.getKey())o.insertAfter(e);else{const s=Re(o.getListType());let i=this.getNextSibling();for(;i;){const l=i;i=i.getNextSibling(),s.append(l)}o.insertAfter(e),e.insertAfter(s)}return r&&(B(N(e),"includeChildren should only be true for ElementNodes"),this.getChildren().forEach(s=>{e.append(s)})),this.remove(),o.getChildrenSize()===0&&o.remove(),e}insertAfter(e,r=!0){const o=this.getParentOrThrow();if(V(o)||B(!1,"insertAfter: list node is not parent of list item node"),ce(e))return super.insertAfter(e,r);const s=this.getNextSiblings();if(o.insertAfter(e,r),s.length!==0){const i=Re(o.getListType());s.forEach(l=>i.append(l)),e.insertAfter(i,r)}return e}remove(e){const r=this.getPreviousSibling(),o=this.getNextSibling();super.remove(e),r&&o&&ht(r)&&ht(o)&&(al(r.getFirstChild(),o.getFirstChild()),o.remove())}insertNewAfter(e,r=!0){const o=ze(this.__checked==null?void 0:!1);return this.insertAfter(o,r),o}collapseAtStart(e){const r=j();this.getChildren().forEach(a=>r.append(a));const s=this.getParentOrThrow(),i=s.getParentOrThrow(),l=ce(i);if(s.getChildrenSize()===1)if(l)s.remove(),i.select();else{s.insertBefore(r),s.remove();const a=e.anchor,c=e.focus,u=r.getKey();a.type==="element"&&a.getNode().is(this)&&a.set(u,a.offset,"element"),c.type==="element"&&c.getNode().is(this)&&c.set(u,c.offset,"element")}else s.insertBefore(r),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){const r=this.getWritable();r.__value=e}getChecked(){const e=this.getLatest();let r;const o=this.getParent();return V(o)&&(r=o.getListType()),r==="check"?!!e.__checked:void 0}getOpened(){const e=this.getLatest();let r;const o=this.getParent();return V(o)&&(r=o.getListType()),r==="check"?!!e.__opened:void 0}setChecked(e){const r=this.getWritable();r.__checked=e}setOpened(e){const r=this.getWritable();r.__opened=e}setIndeterminate(e){const r=this.getWritable();r.__isIndeterminate=e}toggleChecked(){this.setChecked(!this.__checked)}toggleOpen(){const e=!(this.__opened===!0||this.__opened===void 0);this.setOpened(e)}getIndent(){const e=this.getParent();if(e===null)return this.getLatest().__indent;let r=e.getParentOrThrow(),o=0;for(;ce(r);)r=r.getParentOrThrow().getParentOrThrow(),o++;return o}setIndent(e){B(typeof e=="number","Invalid indent value."),e=Math.floor(e),B(e>=0,"Indent value must be non-negative.");let r=this.getIndent();for(;r!==e;)r<e?(Op(this),r++):(Mp(this),r--);return this}canInsertAfter(e){return ce(e)}canReplaceWith(e){return ce(e)}canMergeWith(e){return bt(e)||ce(e)}extractWithChild(e,r){if(!O(r))return!1;const o=r.anchor.getNode(),s=r.focus.getNode();return this.isParentOf(o)&&this.isParentOf(s)&&this.getTextContent().length===r.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return Re("bullet")}canMergeWhenEmpty(){return!0}}function qa(n,t,e){let r=[],o=[];const s=t.list,i=s?s.listitem:void 0;let l;if(s&&s.nested&&(l=s.nested.listitem),i!==void 0&&r.push(...Ro(i)),s){const a=e.getParent(),c=V(a)&&a.getListType()==="check",u=e.getChecked();(!c||u)&&o.push(s.listitemUnchecked),(!c||!u)&&o.push(s.listitemChecked),c&&r.push(u?s.listitemChecked:s.listitemUnchecked)}if(l!==void 0){const a=Ro(l);e.getChildren().some(c=>V(c))?r.push(...a):o.push(...a)}e.__isIndeterminate?r=[...r,Jn.listitemIndeterminate]:o=[...o,Jn.listitemIndeterminate],o.length>0&&Ve(n,...o),r.length>0&&oe(n,...r)}function Ya(n,t,e,r){V(t.getFirstChild())?(n.removeAttribute("role"),n.removeAttribute("tabIndex"),n.removeAttribute("aria-checked")):(n.setAttribute("role","checkbox"),n.setAttribute("tabIndex","-1"),(!e||t.__checked!==e.__checked)&&n.setAttribute("aria-checked",t.getChecked()?"true":"false"),t.__opened===!1?n.setAttribute("data-list","closed"):n.setAttribute("data-list","opened"))}function Ap(n){if(n.classList.contains("task-list-item")){for(const l of n.children)if(l.tagName==="INPUT")return $p(l)}const e=n.getAttribute("aria-checked"),r=n.getAttribute("data-list"),o=e==="true"?!0:e==="false"?!1:void 0,s=!r||r==="opened",i=n.className.includes(Jn.listitemIndeterminate);return{node:ze(o,s,i)}}function $p(n){if(!(n.getAttribute("type")==="checkbox"))return{node:null};const e=n.hasAttribute("checked");return{node:ze(e,!1,!0)}}function ze(n,t,e){return de(new Qn(void 0,n,t,e))}function ce(n){return n instanceof Qn}class qr extends Ke{constructor(t,e){super(t,e)}static getType(){return"extended-text"}static clone(t){return new qr(t.__text,t.__key)}static importDOM(){const t=Ke.importDOM(),e=document.body.getAttribute("mode")?{code:()=>({conversion:Kt(t==null?void 0:t.span),priority:1}),s:()=>({conversion:Kt(t==null?void 0:t.span),priority:1})}:{code:()=>({conversion:Kt(t==null?void 0:t.code),priority:1})};return{...t,...e,em:()=>({conversion:Kt(t==null?void 0:t.em),priority:1}),span:()=>({conversion:Kt(t==null?void 0:t.span),priority:1}),strong:()=>({conversion:Kt(t==null?void 0:t.strong),priority:1}),sub:()=>({conversion:Kt(t==null?void 0:t.sub),priority:1}),sup:()=>({conversion:Kt(t==null?void 0:t.sup),priority:1})}}static importJSON(t){return Ke.importJSON(t)}isSimpleText(){return(this.__type==="text"||this.__type==="extended-text")&&this.__mode===0}exportDOM(t){let{element:e}=super.exportDOM(t);return e instanceof HTMLElement&&e.setAttribute("lexical-element","true"),{element:e}}exportJSON(){return{...super.exportJSON(),type:"extended-text",version:1}}}function Vn(n=""){return de(new qr(n))}function Or(n){return n instanceof qr}function Kt(n){return t=>{const e=n==null?void 0:n(t);if(!e)return null;const r=e.conversion(t);if(!r)return r;const o=t.getAttribute("lexical-element")&&!document.body.getAttribute("mode"),s=o?t.style.backgroundColor:"",i=o?t.style.color:"",l=t.style.textDecoration;return{...r,forChild:(a,c)=>{const f=((r==null?void 0:r.forChild)??(d=>d))(a,c);if(Or(f)){const d=[s?`background-color: ${s}`:null,i?`color: ${i}`:null,l?`text-decoration: ${l}`:null].filter(g=>g!=null).join("; ");if(d.length)return f.setStyle(d)}return f}}}}class Yr extends ae{constructor(e,r,o){super(o);b(this,"__tag");b(this,"__start");b(this,"__listType");const s=Za[e]||e;this.__listType=s,this.__tag=s==="number"?"ol":"ul",this.__start=r}static getType(){return"list"}static clone(e){const r=e.__listType||Za[e.__tag];return new Yr(r,e.__start,e.__key)}getTag(){return this.__tag}setListType(e){const r=this.getWritable();r.__listType=e,r.__tag=e==="number"?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(e,r){const o=this.__tag,s=document.createElement(o);return this.__start!==1&&s.setAttribute("start",String(this.__start)),s.__lexicalListType=this.__listType,Xa(s,e.theme,this),s}updateDOM(e,r,o){return e.__tag!==this.__tag?!0:(Xa(r,o.theme,this),!1)}static transform(){return e=>{B(V(e),"node is not a ListNode"),kp(e),Ep(e)}}static importDOM(){return{ol:()=>({conversion:Ga,priority:0}),ul:()=>({conversion:Ga,priority:0})}}static importJSON(e){const r=Re(e.listType,e.start);return r.setFormat(e.format),r.setIndent(e.indent),r.setDirection(e.direction),r}exportDOM(e){const{element:r}=super.exportDOM(e);return r&&se(r)&&(this.__start!==1&&r.setAttribute("start",String(this.__start)),this.__listType==="check"&&r.setAttribute("__lexicalListType","check")),{element:r}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...e){for(let r=0;r<e.length;r++){const o=e[r];if(ce(o))super.append(o);else{const s=ze();if(V(o))s.append(o);else if(N(o)){const i=Vn(o.getTextContent());s.append(i)}else s.append(o);super.append(s)}}return this}extractWithChild(e){return ce(e)}}function Xa(n,t,e){const r=[],o=[],s=t.list;if(s!==void 0){const i=s[`${e.__tag}Depth`]||[],l=Pd(e)-1,a=l%i.length,c=i[a],u=s[e.__tag];let f;const d=s.nested,g=s.checklist;if(d!==void 0&&d.list&&(f=d.list),u!==void 0&&r.push(u),g!==void 0&&e.__listType==="check"&&r.push(g),c!==void 0){r.push(...Ro(c));for(let h=0;h<i.length;h++)h!==a&&o.push(e.__tag+h)}if(f!==void 0){const h=Ro(f);l>1?r.push(...h):o.push(...h)}}o.length>0&&Ve(n,...o),r.length>0&&oe(n,...r)}function Rp(n){const t=[];for(let e=0;e<n.length;e++){const r=n[e];if(ce(r)){t.push(r);const o=r.getChildren();o.length>1&&o.forEach(s=>{V(s)&&t.push(Ja(s))})}else t.push(Ja(r))}return t}function Dp(n){if(n.getAttribute("__lexicallisttype")==="check"||n.classList.contains("contains-task-list"))return!0;for(const t of n.childNodes)if(se(t)&&t.hasAttribute("aria-checked"))return!0;return!1}function Ga(n){const t=n.nodeName.toLowerCase();let e=null;if(t==="ol"){const r=n.start;e=Re("number",r)}else t==="ul"&&(Dp(n)?e=Re("check"):e=Re("bullet"));return{after:Rp,node:e}}const Za={ol:"number",ul:"bullet"};function Re(n,t=1){return de(new Yr(n,t))}function V(n){return n instanceof Yr}const Bd=K("INSERT_UNORDERED_LIST_COMMAND"),Wd=K("INSERT_ORDERED_LIST_COMMAND"),Fp=K("INSERT_CHECK_LIST_COMMAND"),Pp=K("REMOVE_LIST_COMMAND");function Ip(n){return Me(n.registerCommand(Wd,()=>(hi(n,"number"),!0),Ye),n.registerCommand(Bd,()=>(hi(n,"bullet"),!0),Ye),n.registerCommand(Pp,()=>(Np(n),!0),Ye),n.registerCommand(cn,()=>!!Lp(),Ye))}const Do=/^(\d+(?:\.\d+)?)px$/,ke={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class er extends ae{constructor(e=ke.NO_STATUS,r=1,o,s){super(s);b(this,"__colSpan");b(this,"__rowSpan");b(this,"__headerState");b(this,"__width");b(this,"__backgroundColor");this.__colSpan=r,this.__rowSpan=1,this.__headerState=e,this.__width=o,this.__backgroundColor=null}static getType(){return"tablecell"}static clone(e){return new er(e.__headerState,e.__colSpan,e.__width,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor}static importDOM(){return{td:e=>({conversion:Qa,priority:0}),th:e=>({conversion:Qa,priority:0})}}static importJSON(e){const r=e.colSpan||1,o=e.rowSpan||1;return Ct(e.headerState,r,e.width||void 0).setRowSpan(o).setBackgroundColor(e.backgroundColor||null)}createDOM(e){const r=document.createElement(this.getTag());return this.__width&&(r.style.maxWidth=`${this.__width}px`,r.style.minWidth=`${this.__width}px`),this.__colSpan>1&&(r.colSpan=this.__colSpan),this.__rowSpan>1&&(r.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(r.style.backgroundColor=this.__backgroundColor),oe(r,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),r}exportDOM(e){const{element:r}=super.exportDOM(e);if(r){const o=r;this.__colSpan>1&&(o.colSpan=this.__colSpan),this.__rowSpan>1&&(o.rowSpan=this.__rowSpan),this.getWidth()&&(o.style.maxWidth=`${this.getWidth()}px`,o.style.minWidth=`${this.getWidth()}px`),o.style.verticalAlign="top",o.style.textAlign="start";const s=this.getBackgroundColor();s!==null?o.style.backgroundColor=s:this.hasHeader()&&(o.style.backgroundColor="#f2f3f5")}return{element:r}}exportJSON(){return{...super.exportJSON(),backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,type:"tablecell",width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){const r=this.getWritable();return r.__colSpan=e,r}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){const r=this.getWritable();return r.__rowSpan=e,r}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e,r=ke.BOTH){const o=this.getWritable();return o.__headerState=e&r|o.__headerState&~r,o}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){const r=this.getWritable();return r.__width=e,r}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){const r=this.getWritable();return r.__backgroundColor=e,r}toggleHeaderStyle(e){const r=this.getWritable();return(r.__headerState&e)===e?r.__headerState-=e:r.__headerState+=e,r}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==ke.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function Qa(n){const t=n,e=n.nodeName.toLowerCase();let r;(Do.test(t.style.minWidth)||Do.test(t.style.maxWidth))&&(r=parseFloat(t.style.minWidth));const o=Ct(e==="th"?ke.ROW:ke.NO_STATUS,t.colSpan,r);o.__rowSpan=t.rowSpan;const s=t.style.backgroundColor;s!==""&&(o.__backgroundColor=s);const i=t.style,l=(i&&i.textDecoration||"").split(" "),a=i.fontWeight==="700"||i.fontWeight==="bold",c=l.includes("line-through"),u=i.fontStyle==="italic",f=l.includes("underline");return{after:d=>(d.length===0&&d.push(j()),d),forChild:(d,g)=>{if(W(g)&&!N(d)){const h=j();return _t(d)&&d.getTextContent()===`
|
|
17
|
+
`?null:(Or(d)&&(a&&d.toggleFormat("bold"),c&&d.toggleFormat("strikethrough"),u&&d.toggleFormat("italic"),f&&d.toggleFormat("underline")),h.append(d),h)}return d},node:o}}function Ct(n,t=1,e){return de(new er(n,t,e))}function W(n){return n instanceof er}const Kp=K("INSERT_TABLE_COMMAND");function zd(n,t){if(t.add(n.getKey()),N(n))for(const e of n.getChildren())zd(e,t)}const is=[".ContentEditable__root > *:not(ol):not(ul):not(.dsd__theme__table-scrollable-wrapper):not(.editor-image:not(:has(button))):not(div.video-container):not(div.editor-iframe)",".dsd__theme__table-scrollable-wrapper > table",".editor-image > div.resizable-container > div.resizable-container__inner",".video-container > div.resizable-container > div.resizable-container__inner",".editor-iframe > div.resizable-container > div.resizable-container__inner"],Ud=[...is,"ul.dsd__theme__ul > li:not(.dsd__theme__nestedListItem)","ol.dsd__theme__ol1 > li:not(.dsd__theme__nestedListItem)","ol.dsd__theme__ol2 > li:not(.dsd__theme__nestedListItem)","ol.dsd__theme__ol3 > li:not(.dsd__theme__nestedListItem)","ol.dsd__theme__ol4 > li:not(.dsd__theme__nestedListItem)","ol.dsd__theme__ol5 > li:not(.dsd__theme__nestedListItem)"],Bp=[...is,"ul.dsd__theme__ul:not(.dsd__theme__nestedListItem ul) > li:not(.dsd__theme__nestedListItem)","ul.dsd__theme__ul:not(.dsd__theme__nestedListItem ul) > li.dsd__theme__nestedListItem","ol.dsd__theme__ol1:not(.dsd__theme__nestedListItem ol) > li:not(.dsd__theme__nestedListItem)","ol.dsd__theme__ol1:not(.dsd__theme__nestedListItem ol) > li.dsd__theme__nestedListItem"],Wp=[...is,"ul.dsd__theme__ul:not(.dsd__theme__nestedListItem ul) > li:not(.dsd__theme__nestedListItem)","ul.dsd__theme__ul:not(.dsd__theme__nestedListItem ul) > li.dsd__theme__nestedListItem"],zp=[...is,"ol.dsd__theme__ol1:not(.dsd__theme__nestedListItem ol) > li:not(.dsd__theme__nestedListItem)","ol.dsd__theme__ol1:not(.dsd__theme__nestedListItem ol) > li.dsd__theme__nestedListItem"],Up=n=>{const t=document.querySelectorAll(".selected-block");if(t.length===0)return;setTimeout(()=>{n.update(()=>{const r=qo();t.forEach(o=>{const s=ye(o);s&&zd(s,r)}),ne(r)})},100);const e=r=>{const o=!!document.querySelector(".mantine-Menu-dropdown");if(r.button===2||o){r.preventDefault();return}const s=r.target;s.closest(".draggable-block-menu")||s.closest(".mantine-Menu-dropdown")||(t.forEach(i=>{ls(i)}),document.body.removeEventListener("mousedown",e))};setTimeout(()=>{document.body.addEventListener("mousedown",e)}),n.update(()=>{const r=document.querySelector(".ContentEditable__root");r==null||r.focus({preventScroll:!0})})},Hp={container:document.body,getScrollPosition:()=>[document.documentElement.scrollLeft,document.documentElement.scrollTop],throttleTime:30,threshold:0},ec=(n,t,e)=>function r(o){if(o instanceof KeyboardEvent&&o.key!=="Backspace"&&o.key!=="Delete"&&o.key!=="Escape")return!1;const s=o.target;s.closest(".draggable-block-menu")||s.closest(".toolbar")||s.closest(".mantine-Menu-dropdown")||(n==null||n.classList.remove(t),e.update(()=>{s.closest(".ContentEditable__root")||ne(null),o instanceof KeyboardEvent&&t==="selected-all-document"&&o.key!=="Escape"&&e.update(()=>{var l;(l=Q().getFirstChild())==null||l.selectStart()}),o instanceof KeyboardEvent&&t==="selected-all-document"&&o.key==="Escape"&&e.blur()}),setTimeout(()=>{document.body.removeEventListener("mousedown",r),document.removeEventListener("keydown",r)}))},Hd=(n,t)=>{var e,r;if(t&&t.block){const{block:o,isCreateEventListener:s}=t,i="selected-block";if(o.classList.add(i),o.classList.remove("selected-block-hidden"),s){const l=ec(o,i,n);document.body.addEventListener("mousedown",l),document.addEventListener("keydown",l)}}else{const o="selected-all-document",s=ec(n._rootElement,o,n);document.body.addEventListener("mousedown",s),document.addEventListener("keydown",s),(e=n._rootElement)==null||e.classList.add(o),(r=n._rootElement)==null||r.classList.remove("selected-block-hidden")}},ls=n=>{n.classList.remove("selected-block"),n.classList.add("selected-block-hidden")},jp=n=>{n.querySelectorAll(".selected-block").forEach(e=>{ls(e)})},Jp=(n,t,e,r,o)=>{var s;if(((s=n.selected[0])==null?void 0:s.tagName)==="LI"){let i=n.added[0];if(!n.added.length&&n.beforeSelected.length>=2){const f=n.beforeSelected[0],d=n.beforeSelected[1],g=f.getBoundingClientRect().top;d.getBoundingClientRect().top<g?i=Jd(n.selected[0]):i=n.selected[0]}let a=(i==null?void 0:i.classList.contains("dsd__theme__nestedListItem"))&&n.added.length===0?1:0,c=i,u=null;for(;c;){const f=c.tagName.toUpperCase();if(f==="UL"||f==="OL")u||(u=f.toLowerCase()),a++;else if(f!=="LI")break;c=c.parentElement}if(a!==0&&e.depth!==a){if(!u)return;r({depth:a,targets:Vp(a,u)}),setTimeout(()=>{o==null||o.findSelectableTargets(),o==null||o.setSelectedTargets(n.selected)})}}else!e.depth&&n.added.length&&(r({depth:999,targets:Bp}),setTimeout(()=>{o==null||o.findSelectableTargets(),o==null||o.setSelectedTargets(n.selected)}));n.added.forEach(i=>{Hd(t,{block:i,isCreateEventListener:!1})}),n.removed.forEach(i=>{ls(i)})},jd=()=>{const n=document.querySelector("div.ContentEditable__root"),t=(n==null?void 0:n.querySelector(".selected-block"))!==null,e=n==null?void 0:n.classList.contains("selected-all-document");return{hasSelectedBlock:t,selectedAllDocument:e}},tc=(n,t,e,r)=>{if(n==="ol"){const o=Array.from({length:t},(a,c)=>`ol.dsd__theme__ol${c+1}`).join(" ");let s="";t===1&&(s=":not(.dsd__theme__nestedListItem ol)");const i=`${o}${s} >`;return e?`${i} li.dsd__theme__nestedListItem`:`${i} li:not(.dsd__theme__nestedListItem)`}else{const o=" ul".repeat(t-1).trim(),s=" ul".repeat(t).trim(),l=`ul.dsd__theme__ul${o?` ${o}`:""}:not(.dsd__theme__nestedListItem ${s}) >`;let a=`${l} li:not(.dsd__theme__nestedListItem)`;return e?`${l} li.dsd__theme__nestedListItem`:a}};function Vp(n,t){if(n<1)throw new Error("Depth must be >= 1");const e=[];if(e.push(tc(t,n,!1)),e.push(tc(t,n,!0)),t==="ol"){if(n>1)for(let r=1;r<n;r++)e.push(`ol.dsd__theme__ol${r} > li:not(.dsd__theme__nestedListItem)`);return[...Wp,...e]}else if(t==="ul"){if(n>1)for(let r=1;r<n;r++)e.push(`ul.dsd__theme__ul${" ul".repeat(r-1)}:not(.dsd__theme__nestedListItem ${"ul ".repeat(r).trim()}) > li:not(.dsd__theme__nestedListItem):not(:has(ul))`);return[...zp,...e]}return[...Ud,...e]}function Jd(n){const t=n.querySelector("ul, ol");let e=t==null?void 0:t.lastElementChild;for(;e&&e.tagName!=="LI";)e=e.previousElementSibling;return e!=null&&e.classList.contains("dsd__theme__nestedListItem")?Jd(e)??e:e}const Vd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function kt(n){n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()}class Xr extends ae{constructor(e,r){super(r);b(this,"__height");this.__height=e}static getType(){return"tablerow"}static clone(e){return new Xr(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:qp,priority:0})}}static importJSON(e){return Mr(e.height)}exportJSON(){return{...super.exportJSON(),...this.getHeight()&&{height:this.getHeight()},type:"tablerow",version:1}}createDOM(e){const r=document.createElement("tr");return this.__height&&(r.style.height=`${this.__height}px`),oe(r,e.theme.tableRow),r}isShadowRoot(){return!0}setHeight(e){const r=this.getWritable();return r.__height=e,this.__height}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function qp(n){const t=n;let e;return Do.test(t.style.height)&&(e=parseFloat(t.style.height)),{node:Mr(e)}}function Mr(n){return de(new Xr(n))}function Ue(n){return n instanceof Xr}function Yp(n,t,e=!0){const r=hl();for(let o=0;o<n;o++){const s=Mr();for(let i=0;i<t;i++){let l=ke.NO_STATUS;typeof e=="object"?(o===0&&e.rows&&(l|=ke.ROW),i===0&&e.columns&&(l|=ke.COLUMN)):e&&(o===0&&(l|=ke.ROW),i===0&&(l|=ke.COLUMN));const a=Ct(l),c=j();c.append(Vn()),a.append(c),s.append(a)}r.append(s)}return r}function qd(n){const t=z(n,e=>Ue(e));if(Ue(t))return t;throw new Error("Expected table cell to be inside of table row.")}function Yd(n){const t=z(n,e=>_e(e));if(_e(t))return t;throw new Error("Expected table cell to be inside of table.")}function Xp(n){const t=qd(n);return Yd(t).getChildren().findIndex(r=>r.is(t))}function Gp(n){return qd(n).getChildren().findIndex(e=>e.is(n))}const Zp=(n,t)=>n===ke.BOTH||n===t?t:ke.NO_STATUS;function Qp(n=!0){const t=M();B(O(t)||le(t),"Expected a RangeSelection or TableSelection");const e=t.focus.getNode(),[r,,o]=Pe(e),[s,i]=Ze(o,r,r),l=s[0].length,{startRow:a}=i;let c=null;if(n){const u=a+r.__rowSpan-1,f=s[u],d=Mr();for(let h=0;h<l;h++){const{cell:p,startRow:_}=f[h];if(_+p.__rowSpan-1<=u){const m=f[h].cell.__headerState;d.append(Ct(m).append(j()))}else p.setRowSpan(p.__rowSpan+1)}const g=o.getChildAtIndex(u);B(Ue(g),"focusEndRow is not a TableRowNode"),g.insertAfter(d),c=d}else{const u=s[a],f=Mr();for(let g=0;g<l;g++){const{cell:h,startRow:p}=u[g];if(p===a){const y=u[g].cell.__headerState;f.append(Ct(y).append(j()))}else h.setRowSpan(h.__rowSpan+1)}const d=o.getChildAtIndex(a);B(Ue(d),"focusEndRow is not a TableRowNode"),d.insertBefore(f),c=f}return c}function e_(n=!0){const t=M();B(O(t)||le(t),"Expected a RangeSelection or TableSelection");const e=t.anchor.getNode(),r=t.focus.getNode(),[o]=Pe(e),[s,,i]=Pe(r),[l,a,c]=Ze(i,s,o),u=l.length,f=n?Math.max(a.startColumn,c.startColumn):Math.min(a.startColumn,c.startColumn),d=n?f+s.__colSpan-1:f-1,g=i.getFirstChild();B(Ue(g),"Expected firstTable child to be a row");let h=null;function p(m=ke.NO_STATUS){const C=Ct(m).append(j());return h===null&&(h=C),C}let _=g;e:for(let m=0;m<u;m++){if(m!==0){const T=_.getNextSibling();B(Ue(T),"Expected row nextSibling to be a row"),_=T}const C=l[m],S=C[d<0?0:d].cell.__headerState,w=Zp(S,ke.ROW);if(d<0){cl(_,p(w));continue}const{cell:x,startColumn:v,startRow:E}=C[d];if(v+x.__colSpan-1<=d){let T=x,k=E,D=d;for(;k!==m&&T.__rowSpan>1;)if(D-=x.__colSpan,D>=0){const{cell:R,startRow:I}=C[D];T=R,k=I}else{_.append(p(w));continue e}const P=m?0:w;T.insertAfter(p(P))}else x.setColSpan(x.__colSpan+1)}h!==null&&Lr(h);const y=i.getColWidths();if(y){const m=[...y],C=d<0?0:d,S=m[C];m.splice(C,0,S),i.setColWidths(m)}return h}function t_(){const n=M();B(O(n)||le(n),"Expected a RangeSelection or TableSelection");const[t,e]=n.isBackward()?[n.focus.getNode(),n.anchor.getNode()]:[n.anchor.getNode(),n.focus.getNode()],[r,,o]=Pe(t),[s]=Pe(e),[i,l,a]=Ze(o,r,s),{startRow:c}=l,{startRow:u}=a,f=u+s.__rowSpan-1;if(i.length===f-c+1){o.remove();return}const d=i[0].length,g=i[f+1],h=o.getChildAtIndex(f+1);for(let p=f;p>=c;p--){for(let y=d-1;y>=0;y--){const{cell:m,startRow:C,startColumn:S}=i[p][y];if(S===y&&(p===c&&C<c&&m.setRowSpan(m.__rowSpan-(C-c)),C>=c&&C+m.__rowSpan-1>f))if(m.setRowSpan(m.__rowSpan-(f-C+1)),B(h!==null,"Expected nextRowNode not to be null"),y===0)cl(h,m);else{const{cell:w}=g[y-1];w.insertAfter(m)}}const _=o.getChildAtIndex(p);B(Ue(_),"Expected TableNode childAtIndex(%s) to be RowNode",String(p)),_.remove()}if(g!==void 0){const{cell:p}=g[0];Lr(p)}else{const p=i[c-1],{cell:_}=p[0];Lr(_)}}function n_(){const n=M();B(O(n)||le(n),"Expected a RangeSelection or TableSelection");const t=n.anchor.getNode(),e=n.focus.getNode(),[r,,o]=Pe(t),[s]=Pe(e),[i,l,a]=Ze(o,r,s),{startColumn:c}=l,{startRow:u,startColumn:f}=a,d=Math.min(c,f),g=Math.max(c+r.__colSpan-1,f+s.__colSpan-1),h=g-d+1;if(i[0].length===g-d+1){o.selectPrevious(),o.remove();return}const _=i.length;for(let S=0;S<_;S++)for(let w=d;w<=g;w++){const{cell:x,startColumn:v}=i[S][w];if(v<d){if(w===d){const E=d-v;x.setColSpan(x.__colSpan-Math.min(h,x.__colSpan-E))}}else if(v+x.__colSpan-1>g){if(w===g){const E=g-v+1;x.setColSpan(x.__colSpan-E)}}else x.remove()}const y=i[u],m=c>f?y[c+r.__colSpan]:y[f+s.__colSpan];if(m!==void 0){const{cell:S}=m;Lr(S)}else{const S=f<c?y[f-1]:y[c-1],{cell:w}=S;Lr(w)}const C=o.getColWidths();if(C){const S=[...C];S.splice(d,h),o.setColWidths(S)}}function Lr(n){const t=n.getFirstDescendant();t==null?n.selectStart():t.getParentOrThrow().selectStart()}function cl(n,t){const e=n.getFirstChild();e!==null?e.insertBefore(t):n.append(t)}function r_(){const n=M();B(O(n)||le(n),"Expected a RangeSelection or TableSelection");const t=n.anchor.getNode(),[e,r,o]=Pe(t),s=e.__colSpan,i=e.__rowSpan;if(s===1&&i===1)return;const[l,a]=Ze(o,e,e),{startColumn:c,startRow:u}=a,f=e.__headerState&ke.COLUMN,d=Array.from({length:s},(p,_)=>{let y=f;for(let m=0;y!==0&&m<l.length;m++)y&=l[m][_+c].cell.__headerState;return y}),g=e.__headerState&ke.ROW,h=Array.from({length:i},(p,_)=>{let y=g;for(let m=0;y!==0&&m<l[0].length;m++)y&=l[_+u][m].cell.__headerState;return y});if(s>1){for(let p=1;p<s;p++)e.insertAfter(Ct(d[p]|h[0]).append(j()));e.setColSpan(1)}if(i>1){let p;for(let _=1;_<i;_++){const y=u+_,m=l[y];p=(p||r).getNextSibling(),B(Ue(p),"Expected row next sibling to be a row");let C=null;for(let S=0;S<c;S++){const w=m[S],x=w.cell;w.startRow===y&&(C=x),x.__colSpan>1&&(S+=x.__colSpan-1)}if(C===null)for(let S=s-1;S>=0;S--)cl(p,Ct(d[S]|h[_]).append(j()));else for(let S=s-1;S>=0;S--)C.insertAfter(Ct(d[S]|h[_]).append(j()))}e.setRowSpan(1)}}function Ze(n,t,e){const[r,o,s]=Xd(n,t,e);return B(o!==null,"Anchor not found in Table"),B(s!==null,"Focus not found in Table"),[r,o,s]}function Xd(n,t,e){const r=[];let o=null,s=null;function i(a){let c=r[a];return c===void 0&&(r[a]=c=[]),c}const l=n.getChildren();for(let a=0;a<l.length;a++){const c=l[a];B(Ue(c),"Expected TableNode children to be TableRowNode");for(let u=c.getFirstChild(),f=0;u!=null;u=u.getNextSibling()){B(W(u),"Expected TableRowNode children to be TableCellNode");const d=i(a);for(;d[f]!==void 0;)f++;const g={cell:u,startColumn:f,startRow:a},{__rowSpan:h,__colSpan:p}=u;for(let _=0;_<h&&!(a+_>=l.length);_++){const y=i(a+_);for(let m=0;m<p;m++)y[f+m]=g}t!==null&&o===null&&t.is(u)&&(o=g),e!==null&&s===null&&e.is(u)&&(s=g)}}return[r,o,s]}function Pe(n){let t;if(n instanceof er)t=n;else if("__type"in n){const o=z(n,W);B(W(o),"Expected to find a parent TableCellNode"),t=o}else{const o=z(n.getNode(),W);B(W(o),"Expected to find a parent TableCellNode"),t=o}const e=t.getParent();B(Ue(e),"Expected TableCellNode to have a parent TableRowNode");const r=e.getParent();return B(_e(r),"Expected TableRowNode to have a parent TableNode"),[t,e,r]}function nc(n){const[t,,e]=Pe(n),r=e.getChildren(),o=r.length,s=r[0].getChildren().length,i=new Array(o);for(let l=0;l<o;l++)i[l]=new Array(s);for(let l=0;l<o;l++){const c=r[l].getChildren();let u=0;for(let f=0;f<c.length;f++){for(;i[l][u];)u++;const d=c[f],g=d.__rowSpan||1,h=d.__colSpan||1;for(let p=0;p<g;p++)for(let _=0;_<h;_++)i[l+p][u+_]=d;if(t===d)return{colSpan:h,columnIndex:u,rowIndex:l,rowSpan:g};u+=h}}return null}class as{constructor(t,e,r){b(this,"tableKey");b(this,"anchor");b(this,"focus");b(this,"_cachedNodes");b(this,"dirty");this.anchor=e,this.focus=r,e._selection=this,r._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=t}getStartEndPoints(){return[this.anchor,this.focus]}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return le(t)?this.tableKey===t.tableKey&&this.anchor.is(t.anchor)&&this.focus.is(t.focus):!1}set(t,e,r){this.dirty=!0,this.tableKey=t,this.anchor.key=e,this.focus.key=r,this._cachedNodes=null}clone(){return new as(this.tableKey,this.anchor,this.focus)}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(t){}insertText(){}hasFormat(t){let e=0;this.getNodes().filter(W).forEach(s=>{const i=s.getFirstChild();bt(i)&&(e|=i.getTextFormat())});const o=Lt[t];return(e&o)!==0}insertNodes(t){const e=this.focus.getNode();B(N(e),"Expected TableSelection focus to be an ElementNode"),Vt(e.select(0,e.getChildrenSize())).insertNodes(t)}getShape(){const t=Y(this.anchor.key);B(W(t),"Expected TableSelection anchor to be (or a child of) TableCellNode");const e=nc(t);B(e!==null,"getCellRect: expected to find AnchorNode");const r=Y(this.focus.key);B(W(r),"Expected TableSelection focus to be (or a child of) TableCellNode");const o=nc(r);B(o!==null,"getCellRect: expected to find focusCellNode");const s=Math.min(e.columnIndex,o.columnIndex),i=Math.max(e.columnIndex+e.colSpan-1,o.columnIndex+o.colSpan-1),l=Math.min(e.rowIndex,o.rowIndex),a=Math.max(e.rowIndex+e.rowSpan-1,o.rowIndex+o.rowSpan-1);return{fromX:Math.min(s,i),fromY:Math.min(l,a),toX:Math.max(s,i),toY:Math.max(l,a)}}getNodes(){const t=this._cachedNodes;if(t!==null)return t;const e=this.anchor.getNode(),r=this.focus.getNode(),o=z(e,W),s=z(r,W);B(W(o),"Expected TableSelection anchor to be (or a child of) TableCellNode"),B(W(s),"Expected TableSelection focus to be (or a child of) TableCellNode");const i=o.getParent();B(Ue(i),"Expected anchorCell to have a parent TableRowNode");const l=i.getParent();B(_e(l),"Expected tableNode to have a parent TableNode");const a=s.getParents()[1];if(a!==l){if(l.isParentOf(s)){const E=a.getParent();B(E!=null,"Expected focusCellParent to have a parent"),this.set(this.tableKey,s.getKey(),E.getKey())}else{const E=l.getParent();B(E!=null,"Expected gridParent to have a parent"),this.set(this.tableKey,E.getKey(),s.getKey())}return this.getNodes()}const[c,u,f]=Ze(l,o,s);let d=Math.min(u.startColumn,f.startColumn),g=Math.min(u.startRow,f.startRow),h=Math.max(u.startColumn+u.cell.__colSpan-1,f.startColumn+f.cell.__colSpan-1),p=Math.max(u.startRow+u.cell.__rowSpan-1,f.startRow+f.cell.__rowSpan-1),_=d,y=g,m=d,C=g;function S(E){const{cell:T,startColumn:k,startRow:D}=E;d=Math.min(d,k),g=Math.min(g,D),h=Math.max(h,k+T.__colSpan-1),p=Math.max(p,D+T.__rowSpan-1)}for(;d<_||g<y||h>m||p>C;){if(d<_){const E=C-y,T=_-1;for(let k=0;k<=E;k++)S(c[y+k][T]);_=T}if(g<y){const E=m-_,T=y-1;for(let k=0;k<=E;k++)S(c[T][_+k]);y=T}if(h>m){const E=C-y,T=m+1;for(let k=0;k<=E;k++)S(c[y+k][T]);m=T}if(p>C){const E=m-_,T=C+1;for(let k=0;k<=E;k++)S(c[T][_+k]);C=T}}const w=new Map([[l.getKey(),l]]);let x=null;for(let E=g;E<=p;E++)for(let T=d;T<=h;T++){const{cell:k}=c[E][T],D=k.getParent();B(Ue(D),"Expected TableCellNode parent to be a TableRowNode"),D!==x&&w.set(D.getKey(),D),w.set(k.getKey(),k);for(const P of o_(k))w.set(P.getKey(),P);x=D}const v=Array.from(w.values());return Cn()||(this._cachedNodes=v),v}getTextContent(){const t=this.getNodes().filter(r=>W(r));let e="";for(let r=0;r<t.length;r++){const o=t[r],s=o.__parent,i=(t[r+1]||{}).__parent;e+=o.getTextContent()+(i!==s?`
|
|
18
|
+
`:" ")}return e}}function le(n){return n instanceof as}function rc(){const n=De("root",0,"element"),t=De("root",0,"element");return new as("root",n,t)}function o_(n){const t=[],e=[n];for(;e.length>0;){const r=e.pop();B(r!==void 0,"Stack.length > 0; can't be undefined"),N(r)&&e.unshift(...r.getChildren()),r!==n&&t.push(r)}return t}function Gd(n,t=wn()){const e=Y(n);B(_e(e),"TableObserver: Expected tableNodeKey %s to be a TableNode",n);const r=mn(e,t.getElementByKey(n));return B(r!==null,"TableObserver: Expected to find TableElement in DOM for key %s",n),{tableElement:r,tableNode:e}}class s_{constructor(t,e){b(this,"focusX");b(this,"focusY");b(this,"listenersToRemove");b(this,"table");b(this,"isHighlightingCells");b(this,"anchorX");b(this,"anchorY");b(this,"tableNodeKey");b(this,"anchorCell");b(this,"focusCell");b(this,"anchorCellNodeKey");b(this,"focusCellNodeKey");b(this,"editor");b(this,"tableSelection");b(this,"hasHijackedSelectionStyles");b(this,"isSelecting");b(this,"shouldCheckSelection");b(this,"abortController");b(this,"listenerOptions");this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=e,this.editor=t,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.shouldCheckSelection=!1,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort("removeListeners"),Array.from(this.listenersToRemove).forEach(t=>t()),this.listenersToRemove.clear()}$lookup(){return Gd(this.tableNodeKey,this.editor)}trackTable(){const t=new MutationObserver(e=>{this.editor.getEditorState().read(()=>{let r=!1;for(let o=0;o<e.length;o++){const l=e[o].target.nodeName;if(l==="TABLE"||l==="TBODY"||l==="THEAD"||l==="TR"){r=!0;break}}if(r)try{const{tableNode:o,tableElement:s}=this.$lookup();this.table=Sr(o,s)}catch{}},{editor:this.editor})});this.editor.getEditorState().read(()=>{const{tableNode:e,tableElement:r}=this.$lookup();this.table=Sr(e,r),t.observe(r,{attributes:!0,childList:!0,subtree:!0})},{editor:this.editor})}clearHighlight(){const t=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.enableHighlightStyle(),t.update(()=>{const{tableNode:e,tableElement:r}=this.$lookup(),o=Sr(e,r);ao(t,o,null),ne(null),t.dispatchCommand(Bt,void 0)})}enableHighlightStyle(){const t=this.editor;t.getEditorState().read(()=>{const{tableElement:e}=this.$lookup();Ve(e,t._config.theme.tableSelection),e.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1},{editor:t})}disableHighlightStyle(){const t=this.editor;t.getEditorState().read(()=>{const{tableElement:e}=this.$lookup();oe(e,t._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0},{editor:t})}updateTableTableSelection(t){if(t!==null&&t.tableKey===this.tableNodeKey){const e=this.editor;this.tableSelection=t,this.isHighlightingCells=!0,this.disableHighlightStyle(),ao(e,this.table,this.tableSelection)}else t==null?this.clearHighlight():(this.tableNodeKey=t.tableKey,this.updateTableTableSelection(t))}setShouldCheckSelection(){this.shouldCheckSelection=!0}getAndClearShouldCheckSelection(){return this.shouldCheckSelection?(this.shouldCheckSelection=!1,!0):!1}setFocusCellForSelection(t,e=!1){const r=this.editor;r.update(()=>{const{tableNode:o}=this.$lookup(),s=t.x,i=t.y;if(this.focusCell=t,this.anchorCell!==null){const l=Zd(r._window);l&&l.setBaseAndExtent(this.anchorCell.elem,0,this.focusCell.elem,0)}if(!this.isHighlightingCells&&(this.anchorX!==s||this.anchorY!==i||e))this.isHighlightingCells=!0,this.disableHighlightStyle();else if(s===this.focusX&&i===this.focusY)return;if(this.focusX=s,this.focusY=i,this.isHighlightingCells){const l=ye(t.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null&&W(l)&&o.is(Pn(l))){const a=l.getKey();this.tableSelection=this.tableSelection.clone()||rc(),this.focusCellNodeKey=a,this.tableSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),ne(this.tableSelection),r.dispatchCommand(Bt,void 0),ao(r,this.table,this.tableSelection)}}})}setAnchorCellForSelection(t){this.isHighlightingCells=!1,this.anchorCell=t,this.anchorX=t.x,this.anchorY=t.y,this.editor.update(()=>{const e=ye(t.elem);if(W(e)){const r=e.getKey();this.tableSelection=this.tableSelection!=null?this.tableSelection.clone():rc(),this.anchorCellNodeKey=r}})}formatCells(t){this.editor.update(()=>{const e=M();le(e)||B(!1,"Expected grid selection");const r=Gn(),o=r.anchor,s=r.focus,i=e.getNodes().filter(W),l=i[0].getFirstChild(),a=bt(l)?l.getFormatFlags(t,null):null;i.forEach(c=>{o.set(c.getKey(),0,"element"),s.set(c.getKey(),c.getChildrenSize(),"element"),r.formatText(t,a)}),ne(e),this.editor.dispatchCommand(Bt,void 0)})}clearText(){const t=this.editor;t.update(()=>{const e=Y(this.tableNodeKey);if(!_e(e))throw new Error("Expected TableNode.");const r=M();le(r)||B(!1,"Expected grid selection");const o=r.getNodes().filter(W);if(o.length===this.table.columns*this.table.rows){e.selectPrevious(),e.remove(),Q().selectStart();return}o.forEach(s=>{if(N(s)){const i=j(),l=Vn();i.append(l),s.append(i),s.getChildren().forEach(a=>{a!==i&&a.remove()})}}),ao(t,this.table,null),ne(null),t.dispatchCommand(Bt,void 0)})}}const ul="__lexicalTableSelection",Zd=n=>Vd?(n||window).getSelection():null,i_=n=>(n.buttons&1)===1;function mn(n,t){if(!t)return t;const e=t.nodeName==="TABLE"?t:n.getDOMSlot(t).element;return B(e.nodeName==="TABLE","getTableElement: Expecting table in as DOM node for TableNode, not %s",t.nodeName),e}function l_(n,t,e,r){const o=e.getRootElement();if(o===null)throw new Error("No root element.");const s=new s_(e,n.getKey()),i=e._window||window,l=mn(n,t);c_(l,s),s.listenersToRemove.add(()=>a_(l,s));const a=()=>{const h=()=>{s.isSelecting=!1,i.removeEventListener("mouseup",h),i.removeEventListener("mousemove",p)},p=pf.debounce(_=>{setTimeout(()=>{if(!i_(_)&&s.isSelecting){s.isSelecting=!1,i.removeEventListener("mouseup",h),i.removeEventListener("mousemove",p);return}const y=gi(_.target);y!==null&&(s.anchorX!==y.x||s.anchorY!==y.y)&&(_.preventDefault(),s.setFocusCellForSelection(y))},0)},20);return{onMouseMove:p,onMouseUp:h}},c=h=>{setTimeout(()=>{if(h.button!==0||!i)return;const p=gi(h.target);p!==null&&(kt(h),s.setAnchorCellForSelection(p));const{onMouseUp:_,onMouseMove:y}=a();s.isSelecting=!0,i.addEventListener("mouseup",_,s.listenerOptions),i.addEventListener("mousemove",y,s.listenerOptions)},0)};l.addEventListener("mousedown",c,s.listenerOptions);const u=h=>{h.button===0&&e.update(()=>{const p=M(),_=h.target;le(p)&&p.tableKey===s.tableNodeKey&&o.contains(_)&&s.clearHighlight()})};i.addEventListener("mousedown",u,s.listenerOptions),s.listenersToRemove.add(e.registerCommand(Dr,h=>fr(e,h,"down",n,s),$n)),s.listenersToRemove.add(e.registerCommand(Rr,h=>fr(e,h,"up",n,s),$n)),s.listenersToRemove.add(e.registerCommand(zo,h=>fr(e,h,"backward",n,s),$n)),s.listenersToRemove.add(e.registerCommand(Wo,h=>fr(e,h,"forward",n,s),$n));const f=h=>()=>{const p=M();if(!Qt(p,n))return!1;if(le(p))return s.clearText(),!0;if(O(p)){const _=z(p.anchor.getNode(),E=>W(E));if(!W(_))return!1;const y=p.anchor.getNode(),m=p.focus.getNode(),C=n.isParentOf(y),S=n.isParentOf(m);if(C&&!S||S&&!C)return s.clearText(),!0;const x=z(p.anchor.getNode(),E=>N(E)),v=x&&z(x,E=>N(E)&&W(E.getParent()));if(!N(v)||!N(x))return!1;if(h===un&&v.getPreviousSibling()===null)return!0}return!1};[zn,un,Mt].forEach(h=>{s.listenersToRemove.add(e.registerCommand(h,f(h),Fe))});const d=h=>{const p=M();if(!(le(p)||O(p)))return!1;const _=n.isParentOf(p.anchor.getNode()),y=n.isParentOf(p.focus.getNode());if(_!==y){const m=_?"anchor":"focus",C=_?"focus":"anchor",{key:S,offset:w,type:x}=p[C];return n[p[m].isBefore(p[C])?"selectPrevious":"selectNext"]()[C].set(S,w,x),!1}return le(p)?(h&&(h.preventDefault(),h.stopPropagation()),s.clearText(),!0):!1};s.listenersToRemove.add(e.registerCommand(Uo,d,Fe)),s.listenersToRemove.add(e.registerCommand(jo,d,Fe)),s.listenersToRemove.add(e.registerCommand(Ir,h=>{const p=M();if(p){if(!(le(p)||O(p)))return!1;di(e,Ot(h,ClipboardEvent)?h:null,il(p));const _=d(h);return O(p)?(p.removeText(),!0):_}return!1},Fe)),s.listenersToRemove.add(e.registerCommand(pt,h=>{const p=M();if(!Qt(p,n))return!1;if(le(p))return s.formatCells(h),!0;if(O(p)){const _=z(p.anchor.getNode(),y=>W(y));if(!W(_))return!1}return!1},Fe)),s.listenersToRemove.add(e.registerCommand(Jo,h=>{const p=M();if(!le(p)||!Qt(p,n))return!1;const _=p.anchor.getNode(),y=p.focus.getNode();if(!W(_)||!W(y))return!1;const[m,C,S]=Ze(n,_,y),w=Math.max(C.startRow,S.startRow),x=Math.max(C.startColumn,S.startColumn),v=Math.min(C.startRow,S.startRow),E=Math.min(C.startColumn,S.startColumn);for(let T=v;T<=w;T++)for(let k=E;k<=x;k++){const D=m[T][k].cell;D.setFormat(h);const P=D.getChildren();for(let R=0;R<P.length;R++){const I=P[R];N(I)&&!I.isInline()&&I.setFormat(h)}}return!0},Fe)),s.listenersToRemove.add(e.registerCommand(zt,h=>{const p=M(),_=p==null?void 0:p.getNodes(),y=W(_[1]),m=Q(),C=e._keyToDOMMap.size-1===(p==null?void 0:p.getNodes().length);if(y&&e.update(()=>{const S=j(),w=Vn(h);S.append(w),_.forEach(x=>{if(!_e(x))return;const v=x.getPreviousSibling(),E=x.getNextSibling();v?v.insertAfter(S,!0):E&&E.insertBefore(S).selectEnd(),x.remove()}),C&&(m.clear(),p.insertText(h))}),!Qt(p,n))return!1;if(le(p))return s.clearHighlight(),!1;if(O(p)){const S=z(p.anchor.getNode(),w=>W(w));if(!W(S))return!1;if(typeof h=="string"){const w=ic(e,p,n);if(w)return sc(w,n,[Vn(h)]),!0}}return!1},Fe)),r&&s.listenersToRemove.add(e.registerCommand(Fr,h=>{const p=M();if(!O(p)||!p.isCollapsed()||!Qt(p,n))return!1;const _=uo(p.anchor.getNode());if(_===null)return!1;kt(h);const y=n.getCordsFromCellNode(_,s.table);return Qd(s,n,y.x,y.y,h.shiftKey?"backward":"forward"),!0},Fe)),s.listenersToRemove.add(e.registerCommand(Ti,h=>n.isSelected(),$n));function g(h){const p=n.getCordsFromCellNode(h,s.table);return n.getDOMCellFromCordsOrThrow(p.x,p.y,s.table)}return s.listenersToRemove.add(e.registerCommand(qc,h=>{const{nodes:p,selection:_}=h,y=_.focus.getNode().getParent();return W(y)?(p[0].getFirstChildOrThrow().getChildrenSize(),!0):!1},Fe)),s.listenersToRemove.add(e.registerCommand(Bt,()=>{const h=M(),p=Dt();if(s.getAndClearShouldCheckSelection()&&O(p)&&O(h)&&h.isCollapsed()){const m=h.anchor.getNode(),C=n.getFirstChild(),S=uo(m);if(S!==null&&Ue(C)){const w=C.getFirstChild();if(W(w)&&!z(S,x=>x.is(w)))return w.selectStart(),!0}}const{hasSelectedBlock:_,selectedAllDocument:y}=jd();if(O(h)){const{anchor:m,focus:C}=h,S=m.getNode(),w=C.getNode(),x=uo(S),v=uo(w),E=!!(x&&n.is(Pn(x))),T=!!(v&&n.is(Pn(v))),k=E!==T,D=E&&T,P=h.isBackward();if(k){const R=h.clone();if(T){const[I]=Ze(n,v,v),U=I[0][0].cell,H=I[I.length-1].at(-1).cell;R.focus.set(P?U.getKey():H.getKey(),P?U.getChildrenSize():H.getChildrenSize(),"element")}else if(E){const[I]=Ze(n,x,x),U=I[0][0].cell,H=I[I.length-1].at(-1).cell;R.anchor.set(P?H.getKey():U.getKey(),P?H.getChildrenSize():0,"element")}ne(R),!_&&!y&&oc(e,s)}else D&&(x.is(v)||(s.setAnchorCellForSelection(g(x)),s.setFocusCellForSelection(g(v),!0),s.isSelecting||setTimeout(()=>{const{onMouseUp:R,onMouseMove:I}=a();s.isSelecting=!0,i.addEventListener("mouseup",R),i.addEventListener("mousemove",I)},0)))}else if(h&&le(h)&&h.is(p)&&h.tableKey===n.getKey()){const m=Zd(e._window);if(m&&m.anchorNode&&m.focusNode){const C=ye(m.focusNode),S=C&&!n.is(Pn(C)),w=ye(m.anchorNode),x=w&&n.is(Pn(w));if(S&&x&&m.rangeCount>0){const v=uh(m,e);v&&(v.anchor.set(n.getKey(),h.isBackward()?n.getChildrenSize():0,"element"),m.removeAllRanges(),ne(v))}}}return h&&!h.is(p)&&(le(h)||le(p))&&s.tableSelection&&!s.tableSelection.is(p)?(le(h)&&h.tableKey===s.tableNodeKey?s.updateTableTableSelection(h):!le(h)&&le(p)&&p.tableKey===s.tableNodeKey&&s.updateTableTableSelection(null),!1):(s.hasHijackedSelectionStyles&&!n.isSelected()?u_(e,s):!s.hasHijackedSelectionStyles&&n.isSelected()&&!_&&!y&&oc(e,s),!1)},Fe)),s.listenersToRemove.add(e.registerCommand(cn,()=>{const h=M();if(!O(h)||!h.isCollapsed()||!Qt(h,n))return!1;const p=ic(e,h,n);return p?(sc(p,n),!0):!1},Fe)),s}function a_(n,t){dl(n)===t&&delete n[ul]}function c_(n,t){B(dl(n)===null,"tableElement already has an attached TableObserver"),n[ul]=t}function dl(n){return n[ul]||null}function gi(n){let t=n;for(;t!=null;){const e=t.nodeName;if(e==="TD"||e==="TH"){const r=t._cell;return r===void 0?null:r}t=t.parentNode}return null}function Sr(n,t){const e=mn(n,t),r=[],o={columns:0,domRows:r,rows:0};let s=e.querySelector("tr"),i=0,l=0;for(r.length=0;s!=null;){const a=s.nodeName;if(a==="TD"||a==="TH"){const f=s,d={elem:f,hasBackgroundColor:f.style.backgroundColor!=="",highlighted:!1,x:i,y:l};s._cell=d;let g=r[l];g===void 0&&(g=r[l]=[]),g[i]=d}else{const f=s.firstChild;if(f!=null){s=f;continue}}const c=s.nextSibling;if(c!=null){i++,s=c;continue}const u=s.parentNode;if(u!=null){const f=u.nextSibling;if(f==null)break;l++,i=0,s=f}}return o.columns=i+1,o.rows=l+1,o}function ao(n,t,e){const r=new Set(e?e.getNodes():[]);fl(t,(o,s)=>{const i=o.elem;r.has(s)?(o.highlighted=!0,ef(n,o)):(o.highlighted=!1,tf(n,o),i.getAttribute("style")||i.removeAttribute("style"))})}function fl(n,t){const{domRows:e}=n;for(let r=0;r<e.length;r++){const o=e[r];if(o)for(let s=0;s<o.length;s++){const i=o[s];if(!i)continue;const l=ye(i.elem);l!==null&&t(i,l,{x:s,y:r})}}}function oc(n,t){t.disableHighlightStyle(),fl(t.table,e=>{e.highlighted=!0,ef(n,e)})}function u_(n,t){t.enableHighlightStyle(),fl(t.table,e=>{const r=e.elem;e.highlighted=!1,tf(n,e),r.getAttribute("style")||r.removeAttribute("style")})}const Qd=(n,t,e,r,o)=>{const s=o==="forward";switch(o){case"backward":case"forward":return e!==(s?n.table.columns-1:0)?co(t.getCellNodeFromCordsOrThrow(e+(s?1:-1),r,n.table),s):r!==(s?n.table.rows-1:0)?co(t.getCellNodeFromCordsOrThrow(s?0:n.table.columns-1,r+(s?1:-1),n.table),s):s?t.selectNext():t.selectPrevious(),!0;case"up":return r!==0?co(t.getCellNodeFromCordsOrThrow(e,r-1,n.table),!1):t.selectPrevious(),!0;case"down":return r!==n.table.rows-1?co(t.getCellNodeFromCordsOrThrow(e,r+1,n.table),!0):t.selectNext(),!0;default:return!1}},d_=(n,t,e,r,o)=>{const s=o==="forward";switch(o){case"backward":case"forward":return e!==(s?n.table.columns-1:0)&&n.setFocusCellForSelection(t.getDOMCellFromCordsOrThrow(e+(s?1:-1),r,n.table)),!0;case"up":return r!==0?(n.setFocusCellForSelection(t.getDOMCellFromCordsOrThrow(e,r-1,n.table)),!0):!1;case"down":return r!==n.table.rows-1?(n.setFocusCellForSelection(t.getDOMCellFromCordsOrThrow(e,r+1,n.table)),!0):!1;default:return!1}};function Qt(n,t){if(O(n)||le(n)){const e=t.isParentOf(n.anchor.getNode()),r=t.isParentOf(n.focus.getNode());return e&&r}return!1}function co(n,t){t?n.selectStart():n.selectEnd()}const Ms="172,206,247";function ef(n,t){const e=t.elem,r=ye(e);B(W(r),"Expected to find LexicalNode from Table Cell DOMNode"),r.getBackgroundColor()===null?e.style.setProperty("background-color",`rgb(${Ms})`):e.style.setProperty("background-image",`linear-gradient(to right, rgba(${Ms},0.85), rgba(${Ms},0.85))`),e.style.setProperty("caret-color","transparent")}function tf(n,t){const e=t.elem,r=ye(e);B(W(r),"Expected to find LexicalNode from Table Cell DOMNode"),r.getBackgroundColor()===null&&e.style.removeProperty("background-color"),e.style.removeProperty("background-image"),e.style.removeProperty("caret-color")}function uo(n){const t=z(n,W);return W(t)?t:null}function Pn(n){const t=z(n,_e);return _e(t)?t:null}function fr(n,t,e,r,o){if((e==="up"||e==="down")&&f_(n))return!1;const s=M();if(!Qt(s,r)){if(O(s)){if(s.isCollapsed()&&e==="backward"){const i=s.anchor.type,l=s.anchor.offset;if(i!=="element"&&!(i==="text"&&l===0))return!1;const a=s.anchor.getNode();if(!a)return!1;const c=z(a,f=>N(f)&&!f.isInline());if(!c)return!1;const u=c.getPreviousSibling();return!u||!_e(u)?!1:(kt(t),u.selectEnd(),!0)}else if(t.shiftKey&&(e==="up"||e==="down")){const i=s.focus.getNode();if(!s.isCollapsed()&&(e==="up"&&!s.isBackward()||e==="down"&&s.isBackward())){let a=z(i,g=>_e(g));if(W(a)&&(a=z(a,_e)),a!==r||!a)return!1;const c=e==="down"?a.getNextSibling():a.getPreviousSibling();if(!c)return!1;let u=0;e==="up"&&N(c)&&(u=c.getChildrenSize());let f=c;if(e==="up"&&N(c)){const g=c.getLastChild();f=g||c,u=Or(f)?f.getTextContentSize():0}const d=s.clone();return d.focus.set(f.getKey(),u,Or(f)?"text":"element"),ne(d),kt(t),!0}else if(We(i)){const a=e==="up"?s.getNodes()[s.getNodes().length-1]:s.getNodes()[0];if(a){const c=z(a,W);if(c&&r.isParentOf(c)){const u=r.getFirstDescendant(),f=r.getLastDescendant();if(!u||!f)return!1;const[d]=Pe(u),[g]=Pe(f),h=r.getCordsFromCellNode(d,o.table),p=r.getCordsFromCellNode(g,o.table),_=r.getDOMCellFromCordsOrThrow(h.x,h.y,o.table),y=r.getDOMCellFromCordsOrThrow(p.x,p.y,o.table);return o.setAnchorCellForSelection(_),o.setFocusCellForSelection(y,!0),!0}}return!1}else{let a=z(i,u=>N(u)&&!u.isInline());if(W(a)&&(a=z(a,_e)),!a)return!1;const c=e==="down"?a.getNextSibling():a.getPreviousSibling();if(_e(c)&&o.tableNodeKey===c.getKey()){const u=c.getFirstDescendant(),f=c.getLastDescendant();if(!u||!f)return!1;const[d]=Pe(u),[g]=Pe(f),h=s.clone();return h.focus.set((e==="up"?d:g).getKey(),e==="up"?0:g.getChildrenSize(),"element"),kt(t),ne(h),!0}}}}return e==="down"&&nf(n)&&o.setShouldCheckSelection(),!1}if(O(s)&&s.isCollapsed()){const{anchor:i,focus:l}=s,a=z(i.getNode(),W),c=z(l.getNode(),W);if(!W(a)||!a.is(c))return!1;const u=Pn(a);if(u!==r&&u!=null){const m=mn(u,n.getElementByKey(u.getKey()));if(m!=null)return o.table=Sr(u,m),fr(n,t,e,u,o)}if(e==="backward"||e==="forward"){const m=i.type,C=i.offset,S=i.getNode();if(!S)return!1;const w=s.getNodes();return w.length===1&&q(w[0])?!1:h_(m,C,S,e)?__(t,S,r,e):!1}const f=n.getElementByKey(a.__key),d=n.getElementByKey(i.key);if(d==null||f==null)return!1;let g;if(i.type==="element")g=d.getBoundingClientRect();else{const m=window.getSelection();if(m===null||m.rangeCount===0)return!1;g=m.getRangeAt(0).getBoundingClientRect()}const h=e==="up"?a.getFirstChild():a.getLastChild();if(h==null)return!1;const p=n.getElementByKey(h.__key);if(p==null)return!1;const _=p.getBoundingClientRect();if(e==="up"?_.top>g.top-g.height:g.bottom+g.height>_.bottom){kt(t);const m=r.getCordsFromCellNode(a,o.table);if(t.shiftKey){const C=r.getDOMCellFromCordsOrThrow(m.x,m.y,o.table);o.setAnchorCellForSelection(C),o.setFocusCellForSelection(C,!0)}else return Qd(o,r,m.x,m.y,e);return!0}}else if(le(s)){const{anchor:i,focus:l}=s,a=z(i.getNode(),W),c=z(l.getNode(),W),[u]=s.getNodes();B(_e(u),"$handleArrowKey: TableSelection.getNodes()[0] expected to be TableNode");const f=mn(u,n.getElementByKey(u.getKey()));if(!W(a)||!W(c)||!_e(u)||f==null)return!1;o.updateTableTableSelection(s);const d=Sr(u,f),g=r.getCordsFromCellNode(a,d),h=r.getDOMCellFromCordsOrThrow(g.x,g.y,d);if(o.setAnchorCellForSelection(h),kt(t),t.shiftKey){const p=r.getCordsFromCellNode(c,d);return d_(o,u,p.x,p.y,e)}else c.selectEnd();return!0}return!1}function f_(n){const t=n.getRootElement();return t?t.hasAttribute("aria-controls")&&t.getAttribute("aria-controls")==="typeahead-menu":!1}function h_(n,t,e,r){return g_(n,e,r)||p_(n,t,e,r)}function g_(n,t,e){return n==="element"&&(e==="backward"?t.getPreviousSibling()===null:t.getNextSibling()===null)}function p_(n,t,e,r){const o=z(e,i=>N(i)&&!i.isInline());if(!o)return!1;const s=r==="backward"?t===0:t===e.getTextContentSize();return n==="text"&&s&&(r==="backward"?o.getPreviousSibling()===null:o.getNextSibling()===null)}function __(n,t,e,r){const o=z(t,W);if(!W(o))return!1;const[s,i]=Ze(e,o,o);if(!m_(s,i,r))return!1;const l=y_(t,r,e);return!l||_e(l)?!1:(kt(n),r==="backward"?l.selectEnd():l.selectStart(),!0)}function m_(n,t,e){const r=n[0][0],o=n[n.length-1][n[0].length-1],{startColumn:s,startRow:i}=t;return e==="backward"?s===r.startColumn&&i===r.startRow:s===o.startColumn&&i===o.startRow}function y_(n,t,e){const r=z(n,s=>N(s)&&!s.isInline());if(!r)return;const o=t==="backward"?r.getPreviousSibling():r.getNextSibling();return o&&_e(o)?o:t==="backward"?e.getPreviousSibling():e.getNextSibling()}function sc(n,t,e){const r=j();n==="first"?t.insertBefore(r):t.insertAfter(r),r.append(...e||[]),r.selectEnd()}function ic(n,t,e){const r=e.getParent();if(!r)return;const o=window.getSelection();if(!o)return;const s=o.anchorNode,i=n.getElementByKey(r.getKey()),l=mn(e,n.getElementByKey(e.getKey()));if(!s||!i||!l||!i.contains(s)||l.contains(s))return;const a=z(t.anchor.getNode(),m=>W(m));if(!a)return;const c=z(a,m=>_e(m));if(!_e(c)||!c.is(e))return;const[u,f]=Ze(e,a,a),d=u[0][0],g=u[u.length-1][u[0].length-1],{startRow:h,startColumn:p}=f,_=h===d.startRow&&p===d.startColumn,y=h===g.startRow&&p===g.startColumn;return _?"first":y?"last":void 0}function lc(n,t,e,r){const o=n.querySelector("colgroup");if(!o)return;const s=[];for(let i=0;i<e;i++){const l=document.createElement("col"),a=r&&r[i];a&&(l.style.width=`${a}px`),s.push(l)}o.replaceChildren(...s)}function ac(n,t,e){e?(oe(n,t.theme.tableRowStriping),n.setAttribute("data-lexical-row-striping","true")):(Ve(n,t.theme.tableRowStriping),n.removeAttribute("data-lexical-row-striping"))}const pi=new WeakSet;function nf(n=wn()){return pi.has(n)}function C_(n,t){t?(n._config.theme.tableScrollableWrapper||console.warn("TableNode: hasHorizontalScroll is active but theme.tableScrollableWrapper is not defined."),pi.add(n)):pi.delete(n)}class Gr extends ae{constructor(e){super(e);b(this,"__rowStriping");b(this,"__colWidths");this.__rowStriping=!1}static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){const r=this.getWritable();return r.__colWidths=e,r}static clone(e){return new Gr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping}static importDOM(){return{table:e=>({conversion:S_,priority:1})}}static importJSON(e){const r=hl();return r.__rowStriping=e.rowStriping||!1,r.__colWidths=e.colWidths,r}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),rowStriping:this.__rowStriping?this.__rowStriping:void 0,type:"table",version:1}}getDOMSlot(e){const r=e.nodeName!=="TABLE"&&e.querySelector("table")||e;return B(r.nodeName==="TABLE","TableNode.getDOMSlot: createDOM() did not return a table"),super.getDOMSlot(r).withAfter(r.querySelector("colgroup"))}createDOM(e,r){const o=document.createElement("table"),s=document.createElement("colgroup");if(o.appendChild(s),lc(o,e,this.getColumnCount(),this.getColWidths()),Uu(s),oe(o,e.theme.table),this.__rowStriping&&ac(o,e,!0),nf(r)){const i=document.createElement("div"),l=e.theme.tableScrollableWrapper;return l?oe(i,l):i.style.cssText="overflow-x: auto;",i.appendChild(o),i}return o}updateDOM(e,r,o){const i=this.getDOMSlot(r).element;return e.__rowStriping!==this.__rowStriping&&ac(r,o,this.__rowStriping),lc(i,o,this.getColumnCount(),this.getColWidths()),e!==this}exportDOM(e){return{...super.exportDOM(e),after:r=>{if(!r||!se(r))return null;const o=r.firstChild;if(!(o instanceof HTMLTableElement))return null;const s=r.querySelectorAll(":scope > tr");if(s.length>0){const i=document.createElement("tbody");i.append(...s),o.append(i),r.append(o)}return r}}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,r){const{rows:o,domRows:s}=r;for(let i=0;i<o;i++){const l=s[i];if(l==null)continue;const a=l.findIndex(c=>{if(!c)return;const{elem:u}=c;return ye(u)===e});if(a!==-1)return{x:a,y:i}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,r,o){const{domRows:s}=o,i=s[r];if(i==null)return null;const l=e<i.length?e:i.length-1,a=i[l];return a??null}getDOMCellFromCordsOrThrow(e,r,o){const s=this.getDOMCellFromCords(e,r,o);if(!s)throw new Error("Cell not found at cords.");return s}getCellNodeFromCords(e,r,o){const s=this.getDOMCellFromCords(e,r,o);if(s==null)return null;const i=ye(s.elem);return W(i)?i:null}getCellNodeFromCordsOrThrow(e,r,o){const s=this.getCellNodeFromCords(e,r,o);if(!s)throw new Error("Node at cords not TableCellNode.");return s}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(e){this.getWritable().__rowStriping=e}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){const e=this.getFirstChild();if(!e)return 0;let r=0;return e.getChildren().forEach(o=>{W(o)&&(r+=o.getColSpan())}),r}}function S_(n){const t=hl();n.hasAttribute("data-lexical-row-striping")&&t.setRowStriping(!0);const e=n.querySelector(":scope > colgroup");if(e){let r=[];for(const o of e.querySelectorAll(":scope > col")){const s=o.style.width;if(!s||!Do.test(s)){r=void 0;break}r.push(parseFloat(s))}r&&t.setColWidths(r)}return{node:t}}function hl(){return de(new Gr)}function _e(n){return n instanceof Gr}const x_=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?L.useLayoutEffect:L.useEffect;function b_({onClear:n}){const[t]=Ce();return x_(()=>Mg(t,n),[t,n]),null}function w_({newTab:n=!0,disabled:t=!1}){const[e]=Ce();return L.useEffect(()=>np(e,Qi({disabled:t,newTab:n})),[e,n,t]),null}function v_({children:n,onError:t}){return X.jsx(_f.ErrorBoundary,{fallback:X.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:n})}function T_(){const[n]=Ce();return L.useEffect(()=>{if(!n.hasNodes([ss]))throw new Error("HashtagPlugin: HashtagNode not registered on editor");return Gg(n)},[n]),null}function N_(){const[n]=Ce();return L.useEffect(()=>n.registerCommand(bd,t=>{const e=M();if(!O(e))return!1;if(e.focus.getNode()!==null){const r=Jr();ld(r)}return!0},J),[n]),null}const E_=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?L.useLayoutEffect:L.useEffect;function k_({ignoreHistoryMergeTagChange:n=!0,ignoreSelectionChange:t=!1,onChange:e}){const[r]=Ce();return E_(()=>{if(e)return r.registerUpdateListener(({editorState:o,dirtyElements:s,dirtyLeaves:i,prevEditorState:l,tags:a})=>{t&&s.size===0&&i.size===0||n&&a.has(Ut)||l.isEmpty()||e(o,r,a)})},[r,n,t,e]),null}const O_=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?L.useLayoutEffect:L.useEffect;function M_(n){return{initialValueFn:()=>n.isEditable(),subscribe:t=>n.registerEditableListener(t)}}function rf(){return(function(n){const[t]=Ce(),e=L.useMemo(()=>n(t),[t,n]),[r,o]=L.useState(()=>e.initialValueFn()),s=L.useRef(r);return O_(()=>{const{initialValueFn:i,subscribe:l}=e,a=i();return s.current!==a&&(s.current=a,o(a)),l(c=>{s.current=c,o(c)})},[e,n]),r})(M_)}const L_={name:"@lexical/react/ReactProvider"};function A_(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const gl=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?L.useLayoutEffect:L.useEffect;function $_({editor:n,ErrorBoundary:t}){return(function(e,r){const[o,s]=L.useState(()=>e.getDecorators());return gl(()=>e.registerDecoratorListener(i=>{Tl.flushSync(()=>{s(i)})}),[e]),L.useEffect(()=>{s(e.getDecorators())},[e]),L.useMemo(()=>{const i=[],l=Object.keys(o);for(let a=0;a<l.length;a++){const c=l[a],u=X.jsx(r,{onError:d=>e._onError(d),children:X.jsx(L.Suspense,{fallback:null,children:o[c]})}),f=e.getElementByKey(c);f!==null&&i.push(Tl.createPortal(u,f,c))}return i},[r,o,e])})(n,t)}function R_({editor:n,ErrorBoundary:t}){return(function(e){const r=Bn.maybeFromEditor(e);if(r&&r.hasExtensionByName(L_.name)){for(const o of["@lexical/plain-text","@lexical/rich-text"])r.hasExtensionByName(o)&&A_(320,o);return!0}return!1})(n)?null:X.jsx($_,{editor:n,ErrorBoundary:t})}function cc(n){return n.getEditorState().read(Ed(n.isComposing()))}function D_({contentEditable:n,placeholder:t=null,ErrorBoundary:e}){const[r]=Ce();return(function(o){gl(()=>Me(wp(o),gp(o)),[o])})(r),X.jsxs(X.Fragment,{children:[n,X.jsx(F_,{content:t}),X.jsx(R_,{editor:r,ErrorBoundary:e})]})}function F_({content:n}){const[t]=Ce(),e=(function(o){const[s,i]=L.useState(()=>cc(o));return gl(()=>{function l(){const a=cc(o);i(a)}return l(),Me(o.registerUpdateListener(()=>{l()}),o.registerEditableListener(()=>{l()}))},[o]),s})(t),r=rf();return e?typeof n=="function"?n(r):n:null}function hr(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function P_(n){let t=1,e=n.getParent();for(;e!=null;){if($e(e)){const r=e.getParent();if(ge(r)){t++,e=r.getParent();continue}hr(40)}return t}return t}function gt(n){return $e(n)&&ge(n.getFirstChild())}function uc(n){return Rt().append(n)}function of(n,t){n.splice(n.getChildrenSize(),0,t)}function pl(n,t){const e=n.getLastChild(),r=t.getFirstChild();e&&r&>(e)&>(r)&&(pl(e.getFirstChild(),r.getFirstChild()),r.remove());const o=t.getChildren();o.length>0&&n.append(...o),t.remove()}function I_(n){const t=n.getListType()!=="check";let e=n.getStart();for(const r of n.getChildren())$e(r)&&(r.getValue()!==e&&r.setValue(e),t&&r.getLatest().__checked!=null&&r.setChecked(void 0),ge(r.getFirstChild())||e++)}function K_(n){const t=new Set;if(gt(n)||t.has(n.getKey()))return;const e=n.getParent(),r=n.getNextSibling(),o=n.getPreviousSibling();if(gt(r)&>(o)){const s=o.getFirstChild();if(ge(s)){s.append(n);const i=r.getFirstChild();ge(i)&&(of(s,i.getChildren()),r.remove(),t.add(r.getKey()))}}else if(gt(r)){const s=r.getFirstChild();if(ge(s)){const i=s.getFirstChild();i!==null&&i.insertBefore(n)}}else if(gt(o)){const s=o.getFirstChild();ge(s)&&s.append(n)}else if(ge(e)){const s=Rt().setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle()),i=St(e.getListType()).setTextFormat(e.getTextFormat()).setTextStyle(e.getTextStyle());s.append(i),i.append(n),o?o.insertAfter(s):r?r.insertBefore(s):e.append(s)}}function B_(n){if(gt(n))return;const t=n.getParent(),e=t?t.getParent():void 0;if(ge(e?e.getParent():void 0)&&$e(e)&&ge(t)){const r=t?t.getFirstChild():void 0,o=t?t.getLastChild():void 0;if(n.is(r))e.insertBefore(n),t.isEmpty()&&e.remove();else if(n.is(o))e.insertAfter(n),t.isEmpty()&&e.remove();else{const s=t.getListType(),i=Rt(),l=St(s);i.append(l),n.getPreviousSiblings().forEach(u=>l.append(u));const a=Rt(),c=St(s);a.append(c),of(c,n.getNextSiblings()),e.insertBefore(i),e.insertAfter(a),e.replace(n)}}}function Fo(...n){const t=[];for(const e of n)if(e&&typeof e=="string")for(const[r]of e.matchAll(/\S+/g))t.push(r);return t}class _l extends ae{constructor(e=1,r=void 0,o){super(o);b(this,"__value");b(this,"__checked");this.__value=e===void 0?1:e,this.__checked=r}$config(){return this.config("listitem",{$transform:e=>{if(e.__checked==null)return;const r=e.getParent();ge(r)&&r.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)},extends:ae,importDOM:{li:()=>({conversion:W_,priority:0})}})}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){const r=document.createElement("li");return this.updateListItemDOM(null,r,e),r}updateListItemDOM(e,r,o){(function(l,a,c){const u=a.getParent();!ge(u)||u.getListType()!=="check"||ge(a.getFirstChild())?(l.removeAttribute("role"),l.removeAttribute("tabIndex"),l.removeAttribute("aria-checked")):(l.setAttribute("role","checkbox"),l.setAttribute("tabIndex","-1"),c&&a.__checked===c.__checked||l.setAttribute("aria-checked",a.getChecked()?"true":"false"))})(r,this,e),r.value=this.__value,(function(l,a,c){const u=[],f=[],d=a.list,g=d?d.listitem:void 0;let h;if(d&&d.nested&&(h=d.nested.listitem),g!==void 0&&u.push(...Fo(g)),d){const p=c.getParent(),_=ge(p)&&p.getListType()==="check",y=c.getChecked();_&&!y||f.push(d.listitemUnchecked),_&&y||f.push(d.listitemChecked),_&&u.push(y?d.listitemChecked:d.listitemUnchecked)}if(h!==void 0){const p=Fo(h);c.getChildren().some(_=>ge(_))?u.push(...p):f.push(...p)}f.length>0&&Ve(l,...f),u.length>0&&oe(l,...u)})(r,o.theme,this);const s=e?e.__style:"",i=this.__style;s!==i&&(i===""?r.removeAttribute("style"):r.style.cssText=i),(function(l,a,c){const u=Er(a.__textStyle);for(const f in u)l.style.setProperty(`--listitem-marker-${f}`,u[f]);if(c)for(const f in Er(c.__textStyle))f in u||l.style.removeProperty(`--listitem-marker-${f}`)})(r,this,e)}updateDOM(e,r,o){const s=r;return this.updateListItemDOM(e,s,o),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){const r=this.createDOM(e._config),o=this.getFormatType();o&&(r.style.textAlign=o);const s=this.getDirection();return s&&(r.dir=s),{element:r}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let r=0;r<e.length;r++){const o=e[r];if(N(o)&&this.canMergeWith(o)){const s=o.getChildren();this.append(...s),o.remove()}else super.append(o)}return this}replace(e,r){if($e(e))return super.replace(e);this.setIndent(0);const o=this.getParentOrThrow();if(!ge(o))return e;if(o.__first===this.getKey())o.insertBefore(e);else if(o.__last===this.getKey())o.insertAfter(e);else{const s=St(o.getListType());let i=this.getNextSibling();for(;i;){const l=i;i=i.getNextSibling(),s.append(l)}o.insertAfter(e),e.insertAfter(s)}return r&&(N(e)||hr(139),this.getChildren().forEach(s=>{e.append(s)})),this.remove(),o.getChildrenSize()===0&&o.remove(),e}insertAfter(e,r=!0){const o=this.getParentOrThrow();if(ge(o)||hr(39),$e(e))return super.insertAfter(e,r);const s=this.getNextSiblings();if(o.insertAfter(e,r),s.length!==0){const i=St(o.getListType());s.forEach(l=>i.append(l)),e.insertAfter(i,r)}return e}remove(e){const r=this.getPreviousSibling(),o=this.getNextSibling();super.remove(e),r&&o&>(r)&>(o)&&(pl(r.getFirstChild(),o.getFirstChild()),o.remove())}insertNewAfter(e,r=!0){const o=Rt().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(o,r),o}collapseAtStart(e){const r=j();this.getChildren().forEach(l=>r.append(l));const o=this.getParentOrThrow(),s=o.getParentOrThrow(),i=$e(s);if(o.getChildrenSize()===1)if(i)o.remove(),s.select();else{o.insertBefore(r),o.remove();const l=e.anchor,a=e.focus,c=r.getKey();l.type==="element"&&l.getNode().is(this)&&l.set(c,l.offset,"element"),a.type==="element"&&a.getNode().is(this)&&a.set(c,a.offset,"element")}else o.insertBefore(r),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){const r=this.getWritable();return r.__value=e,r}getChecked(){const e=this.getLatest();let r;const o=this.getParent();return ge(o)&&(r=o.getListType()),r==="check"?!!e.__checked:void 0}setChecked(e){const r=this.getWritable();return r.__checked=e,r}toggleChecked(){const e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){const e=this.getParent();if(e===null||!this.isAttached())return this.getLatest().__indent;let r=e.getParentOrThrow(),o=0;for(;$e(r);)r=r.getParentOrThrow().getParentOrThrow(),o++;return o}setIndent(e){typeof e!="number"&&hr(117),(e=Math.floor(e))>=0||hr(199);let r=this.getIndent();for(;r!==e;)r<e?(K_(this),r++):(B_(this),r--);return this}canInsertAfter(e){return $e(e)}canReplaceWith(e){return $e(e)}canMergeWith(e){return $e(e)||bt(e)}extractWithChild(e,r){if(!O(r))return!1;const o=r.anchor.getNode(),s=r.focus.getNode();return this.isParentOf(o)&&this.isParentOf(s)&&this.getTextContent().length===r.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return St("bullet")}canMergeWhenEmpty(){return!0}}function W_(n){if(n.classList.contains("task-list-item")){for(const e of n.children)if(e.tagName==="INPUT")return dc(e)}if(n.classList.contains("joplin-checkbox")){for(const e of n.children)if(e.classList.contains("checkbox-wrapper")&&e.children.length>0&&e.children[0].tagName==="INPUT")return dc(e.children[0])}const t=n.getAttribute("aria-checked");return{node:Rt(t==="true"||t!=="false"&&void 0)}}function dc(n){return n.getAttribute("type")!=="checkbox"?{node:null}:{node:Rt(n.hasAttribute("checked"))}}function Rt(n){return de(new _l(void 0,n))}function $e(n){return n instanceof _l}class ml extends ae{constructor(e="number",r=1,o){super(o);b(this,"__tag");b(this,"__start");b(this,"__listType");const s=U_[e]||e;this.__listType=s,this.__tag=s==="number"?"ol":"ul",this.__start=r}$config(){return this.config("list",{$transform:e=>{(function(r){const o=r.getNextSibling();ge(o)&&r.getListType()===o.getListType()&&pl(r,o)})(e),I_(e)},extends:ae,importDOM:{ol:()=>({conversion:hc,priority:0}),ul:()=>({conversion:hc,priority:0})}})}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){const r=this.getWritable();return r.__listType=e,r.__tag=e==="number"?"ol":"ul",r}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){const r=this.getWritable();return r.__start=e,r}createDOM(e,r){const o=this.__tag,s=document.createElement(o);return this.__start!==1&&s.setAttribute("start",String(this.__start)),s.__lexicalListType=this.__listType,fc(s,e.theme,this),s}updateDOM(e,r,o){return e.__tag!==this.__tag||e.__listType!==this.__listType||(fc(r,o.theme,this),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){const r=this.createDOM(e._config,e);return se(r)&&(this.__start!==1&&r.setAttribute("start",String(this.__start)),this.__listType==="check"&&r.setAttribute("__lexicalListType","check")),{element:r}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,r,o){let s=o;for(let i=0;i<o.length;i++){const l=o[i];$e(l)||(s===o&&(s=[...o]),s[i]=Rt().append(!N(l)||ge(l)||l.isInline()?l:fe(l.getTextContent())))}return super.splice(e,r,s)}extractWithChild(e){return $e(e)}}function fc(n,t,e){const r=[],o=[],s=t.list;if(s!==void 0){const i=s[`${e.__tag}Depth`]||[],l=P_(e)-1,a=l%i.length,c=i[a],u=s[e.__tag];let f;const d=s.nested,g=s.checklist;if(d!==void 0&&d.list&&(f=d.list),u!==void 0&&r.push(u),g!==void 0&&e.__listType==="check"&&r.push(g),c!==void 0){r.push(...Fo(c));for(let h=0;h<i.length;h++)h!==a&&o.push(e.__tag+h)}if(f!==void 0){const h=Fo(f);l>1?r.push(...h):o.push(...h)}}o.length>0&&Ve(n,...o),r.length>0&&oe(n,...r)}function z_(n){const t=[];for(let e=0;e<n.length;e++){const r=n[e];if($e(r)){t.push(r);const o=r.getChildren();o.length>1&&o.forEach(s=>{ge(s)&&t.push(uc(s))})}else t.push(uc(r))}return t}function hc(n){const t=n.nodeName.toLowerCase();let e=null;return t==="ol"?e=St("number",n.start):t==="ul"&&(e=(function(r){if(r.getAttribute("__lexicallisttype")==="check"||r.classList.contains("contains-task-list")||r.getAttribute("data-is-checklist")==="1")return!0;for(const o of r.childNodes)if(se(o)&&o.hasAttribute("aria-checked"))return!0;return!1})(n)?St("check"):St("bullet")),{after:z_,node:e}}const U_={ol:"number",ul:"bullet"};function St(n="number",t=1){return de(new ml(n,t))}function ge(n){return n instanceof ml}const yl=/^(\d+(?:\.\d+)?)px$/,on={BOTH:3,NO_STATUS:0,ROW:1};class tr extends ae{constructor(e=on.NO_STATUS,r=1,o,s){super(s);b(this,"__colSpan");b(this,"__rowSpan");b(this,"__headerState");b(this,"__width");b(this,"__backgroundColor");b(this,"__verticalAlign");this.__colSpan=r,this.__rowSpan=1,this.__headerState=e,this.__width=o,this.__backgroundColor=null,this.__verticalAlign=void 0}static getType(){return"tablecell"}static clone(e){return new tr(e.__headerState,e.__colSpan,e.__width,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign}static importDOM(){return{td:e=>({conversion:gc,priority:0}),th:e=>({conversion:gc,priority:0})}}static importJSON(e){return Cl().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}createDOM(e){const r=document.createElement(this.getTag());return this.__width&&(r.style.width=`${this.__width}px`),this.__colSpan>1&&(r.colSpan=this.__colSpan),this.__rowSpan>1&&(r.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(r.style.backgroundColor=this.__backgroundColor),_i(this.__verticalAlign)&&(r.style.verticalAlign=this.__verticalAlign),oe(r,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),r}exportDOM(e){const r=super.exportDOM(e);if(se(r.element)){const o=r.element;o.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),o.style.border="1px solid black",this.__colSpan>1&&(o.colSpan=this.__colSpan),this.__rowSpan>1&&(o.rowSpan=this.__rowSpan),o.style.width=`${this.getWidth()||75}px`,o.style.verticalAlign=this.getVerticalAlign()||"top",o.style.textAlign="start",this.__backgroundColor===null&&this.hasHeader()&&(o.style.backgroundColor="#f2f3f5")}return r}exportJSON(){return{...super.exportJSON(),..._i(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){const r=this.getWritable();return r.__colSpan=e,r}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){const r=this.getWritable();return r.__rowSpan=e,r}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e,r=on.BOTH){const o=this.getWritable();return o.__headerState=e&r|o.__headerState&~r,o}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){const r=this.getWritable();return r.__width=e,r}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){const r=this.getWritable();return r.__backgroundColor=e,r}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){const r=this.getWritable();return r.__verticalAlign=e||void 0,r}toggleHeaderStyle(e){const r=this.getWritable();return(r.__headerState&e)===e?r.__headerState-=e:r.__headerState+=e,r}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==on.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function _i(n){return n==="middle"||n==="bottom"}function gc(n){const t=n,e=n.nodeName.toLowerCase();let r;yl.test(t.style.width)&&(r=parseFloat(t.style.width));const o=Cl(e==="th"?on.ROW:on.NO_STATUS,t.colSpan,r);o.__rowSpan=t.rowSpan;const s=t.style.backgroundColor;s!==""&&(o.__backgroundColor=s);const i=t.style.verticalAlign;_i(i)&&(o.__verticalAlign=i);const l=t.style,a=(l&&l.textDecoration||"").split(" "),c=l.fontWeight==="700"||l.fontWeight==="bold",u=a.includes("line-through"),f=l.fontStyle==="italic",d=a.includes("underline");return{after:g=>{const h=[];let p=null;const _=()=>{if(p){const y=p.getFirstChild();_t(y)&&p.getChildrenSize()===1&&y.remove()}};for(const y of g)vh(y)||$(y)||_t(y)?($(y)&&(c&&y.toggleFormat("bold"),u&&y.toggleFormat("strikethrough"),f&&y.toggleFormat("italic"),d&&y.toggleFormat("underline")),p?p.append(y):(p=j().append(y),h.push(p))):(h.push(y),_(),p=null);return _(),h.length===0&&h.push(j()),h},node:o}}function Cl(n=on.NO_STATUS,t=1,e){return de(new tr(n,t,e))}function Ie(n){return n instanceof tr}function xe(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}class Zr extends ae{constructor(e,r){super(r);b(this,"__height");this.__height=e}static getType(){return"tablerow"}static clone(e){return new Zr(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:H_,priority:0})}}static importJSON(e){return Sl().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}exportJSON(){const e=this.getHeight();return{...super.exportJSON(),...e===void 0?void 0:{height:e}}}createDOM(e){const r=document.createElement("tr");return this.__height&&(r.style.height=`${this.__height}px`),oe(r,e.theme.tableRow),r}extractWithChild(e,r,o){return o==="html"}isShadowRoot(){return!0}setHeight(e){const r=this.getWritable();return r.__height=e,r}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function H_(n){const t=n;let e;return yl.test(t.style.height)&&(e=parseFloat(t.style.height)),{after:r=>ad(r,Ie),node:Sl(e)}}function Sl(n){return de(new Zr(n))}function nr(n){return n instanceof Zr}const sf=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,j_=sf&&"documentMode"in document?document.documentMode:null;sf&&"InputEvent"in window&&!j_&&new window.InputEvent("input");function J_(n,t,e){const[r,o,s]=lf(n,t,e);return o===null&&xe(207),s===null&&xe(208),[r,o,s]}function lf(n,t,e){const r=[];let o=null,s=null;function i(a){let c=r[a];return c===void 0&&(r[a]=c=[]),c}const l=n.getChildren();for(let a=0;a<l.length;a++){const c=l[a];nr(c)||xe(209);const u=i(a);for(let f=c.getFirstChild(),d=0;f!=null;f=f.getNextSibling()){for(Ie(f)||xe(147);u[d]!==void 0;)d++;const g={cell:f,startColumn:d,startRow:a},{__rowSpan:h,__colSpan:p}=f;for(let _=0;_<h&&!(a+_>=l.length);_++){const y=i(a+_);for(let m=0;m<p;m++)y[d+m]=g}t!==null&&o===null&&t.is(f)&&(o=g),e!==null&&s===null&&e.is(f)&&(s=g)}}return[r,o,s]}function V_(n){let t;if(n instanceof tr)t=n;else if("__type"in n){const o=z(n,Ie);Ie(o)||xe(148),t=o}else{const o=z(n.getNode(),Ie);Ie(o)||xe(148),t=o}const e=t.getParent();nr(e)||xe(149);const r=e.getParent();return wl(r)||xe(210),[t,e,r]}function q_(n,t,e){let r,o=Math.min(t.startColumn,e.startColumn),s=Math.min(t.startRow,e.startRow),i=Math.max(t.startColumn+t.cell.__colSpan-1,e.startColumn+e.cell.__colSpan-1),l=Math.max(t.startRow+t.cell.__rowSpan-1,e.startRow+e.cell.__rowSpan-1);do{r=!1;for(let a=0;a<n.length;a++)for(let c=0;c<n[0].length;c++){const u=n[a][c];if(!u)continue;const f=u.startColumn+u.cell.__colSpan-1,d=u.startRow+u.cell.__rowSpan-1,g=u.startColumn<=i&&f>=o,h=u.startRow<=l&&d>=s;if(g&&h){const p=Math.min(o,u.startColumn),_=Math.max(i,f),y=Math.min(s,u.startRow),m=Math.max(l,d);p===o&&_===i&&y===s&&m===l||(o=p,i=_,s=y,l=m,r=!0)}}}while(r);return{maxColumn:i,maxRow:l,minColumn:o,minRow:s}}function pc(n){const[t,,e]=V_(n),r=e.getChildren(),o=r.length,s=r[0].getChildren().length,i=new Array(o);for(let l=0;l<o;l++)i[l]=new Array(s);for(let l=0;l<o;l++){const a=r[l].getChildren();let c=0;for(let u=0;u<a.length;u++){for(;i[l][c];)c++;const f=a[u],d=f.__rowSpan||1,g=f.__colSpan||1;for(let h=0;h<d;h++)for(let p=0;p<g;p++)i[l+h][c+p]=f;if(t===f)return{colSpan:g,columnIndex:c,rowIndex:l,rowSpan:d};c+=g}}return null}function _c(n){const[[t,e,r,o],[s,i,l,a]]=["anchor","focus"].map(c=>{const u=n[c].getNode(),f=z(u,Ie);Ie(f)||xe(238,c,u.getKey(),u.getType());const d=f.getParent();nr(d)||xe(239,c);const g=d.getParent();return wl(g)||xe(240,c),[u,f,d,g]});return o.is(a)||xe(241),{anchorCell:e,anchorNode:t,anchorRow:r,anchorTable:o,focusCell:i,focusNode:s,focusRow:l,focusTable:a}}class xl{constructor(t,e,r){b(this,"tableKey");b(this,"anchor");b(this,"focus");b(this,"_cachedNodes");b(this,"dirty");this.anchor=e,this.focus=r,e._selection=this,r._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=t}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){if(this.tableKey==="root"||this.anchor.key==="root"||this.anchor.type!=="element"||this.focus.key==="root"||this.focus.type!=="element")return!1;const t=Y(this.tableKey),e=Y(this.anchor.key),r=Y(this.focus.key);return t!==null&&e!==null&&r!==null}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t}is(t){return af(t)&&this.tableKey===t.tableKey&&this.anchor.is(t.anchor)&&this.focus.is(t.focus)}set(t,e,r){this.dirty=this.dirty||t!==this.tableKey||e!==this.anchor.key||r!==this.focus.key,this.tableKey=t,this.anchor.key=e,this.focus.key=r,this._cachedNodes=null}clone(){return new xl(this.tableKey,De(this.anchor.key,this.anchor.offset,this.anchor.type),De(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(t){}insertText(){}hasFormat(t){let e=0;this.getNodes().filter(Ie).forEach(o=>{const s=o.getFirstChild();bt(s)&&(e|=s.getTextFormat())});const r=Lt[t];return(e&r)!==0}insertNodes(t){const e=this.focus.getNode();N(e)||xe(151),Vt(e.select(0,e.getChildrenSize())).insertNodes(t)}getShape(){const{anchorCell:t,focusCell:e}=_c(this),r=pc(t);r===null&&xe(153);const o=pc(e);o===null&&xe(155);const s=Math.min(r.columnIndex,o.columnIndex),i=Math.max(r.columnIndex+r.colSpan-1,o.columnIndex+o.colSpan-1),l=Math.min(r.rowIndex,o.rowIndex),a=Math.max(r.rowIndex+r.rowSpan-1,o.rowIndex+o.rowSpan-1);return{fromX:Math.min(s,i),fromY:Math.min(l,a),toX:Math.max(s,i),toY:Math.max(l,a)}}getNodes(){if(!this.isValid())return[];const t=this._cachedNodes;if(t!==null)return t;const{anchorTable:e,anchorCell:r,focusCell:o}=_c(this),s=o.getParents()[1];if(s!==e){if(e.isParentOf(o)){const _=s.getParent();_==null&&xe(159),this.set(this.tableKey,o.getKey(),_.getKey())}else{const _=e.getParent();_==null&&xe(158),this.set(this.tableKey,_.getKey(),o.getKey())}return this.getNodes()}const[i,l,a]=J_(e,r,o),{minColumn:c,maxColumn:u,minRow:f,maxRow:d}=q_(i,l,a),g=new Map([[e.getKey(),e]]);let h=null;for(let _=f;_<=d;_++)for(let y=c;y<=u;y++){const{cell:m}=i[_][y],C=m.getParent();nr(C)||xe(160),C!==h&&(g.set(C.getKey(),C),h=C),g.has(m.getKey())||Y_(m,S=>{g.set(S.getKey(),S)})}const p=Array.from(g.values());return Cn()||(this._cachedNodes=p),p}getTextContent(){const t=this.getNodes().filter(r=>Ie(r));let e="";for(let r=0;r<t.length;r++){const o=t[r],s=o.__parent,i=(t[r+1]||{}).__parent;e+=o.getTextContent()+(i!==s?`
|
|
19
|
+
`:" ")}return e}}function af(n){return n instanceof xl}function Y_(n,t){const e=[[n]];for(let r=e.at(-1);r!==void 0&&e.length>0;r=e.at(-1)){const o=r.pop();o===void 0?e.pop():t(o)!==!1&&N(o)&&e.push(o.getChildren())}}function ir(n){return se(n)&&n.nodeName==="TABLE"}function X_(n,t){for(let e=t,r=null;e!==null;e=e.getParent()){if(n.is(e))return r;Ie(e)&&(r=e)}return null}function G_(n,t,e){return X_(n,ye(t,e))}function mc(n,t,e){if(!t.theme.tableAlignment)return;const r=[],o=[];for(const s of["center","right"]){const i=t.theme.tableAlignment[s];i&&(s===e?o:r).push(i)}Ve(n,...r),oe(n,...o)}const Z_=new WeakSet;function yc(n=wn()){return Z_.has(n)}class Qr extends ae{constructor(e){super(e);b(this,"__rowStriping");b(this,"__frozenColumnCount");b(this,"__frozenRowCount");b(this,"__colWidths");this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0,this.__colWidths=void 0}static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){const r=this.getWritable();return r.__colWidths=e,r}static clone(e){return new Qr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:Q_,priority:1})}}static importJSON(e){return bl().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,r,o){return o==="html"}getDOMSlot(e){const r=ir(e)?e:e.querySelector("table");return ir(r)||xe(229),super.getDOMSlot(e).withElement(r).withAfter(r.querySelector("colgroup"))}createDOM(e,r){const o=document.createElement("table");this.__style&&(o.style.cssText=this.__style);const s=document.createElement("colgroup");if(o.appendChild(s),Uu(s),oe(o,e.theme.table),this.updateTableElement(null,o,e),yc(r)){const i=document.createElement("div"),l=e.theme.tableScrollableWrapper;return l?oe(i,l):i.style.cssText="overflow-x: auto;",i.appendChild(o),this.updateTableWrapper(null,i,o,e),i}return o}updateTableWrapper(e,r,o,s){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&(function(i,l,a,c){c>0?(oe(i,a.theme.tableFrozenColumn),l.setAttribute("data-lexical-frozen-column","true")):(Ve(i,a.theme.tableFrozenColumn),l.removeAttribute("data-lexical-frozen-column"))})(r,o,s,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&(function(i,l,a,c){c>0?(oe(i,a.theme.tableFrozenRow),l.setAttribute("data-lexical-frozen-row","true")):(Ve(i,a.theme.tableFrozenRow),l.removeAttribute("data-lexical-frozen-row"))})(r,o,s,this.__frozenRowCount)}updateTableElement(e,r,o){this.__style!==(e?e.__style:"")&&(r.style.cssText=this.__style),this.__rowStriping!==(!!e&&e.__rowStriping)&&(function(s,i,l){l?(oe(s,i.theme.tableRowStriping),s.setAttribute("data-lexical-row-striping","true")):(Ve(s,i.theme.tableRowStriping),s.removeAttribute("data-lexical-row-striping"))})(r,o,this.__rowStriping),(function(s,i,l,a){const c=s.querySelector("colgroup");if(!c)return;const u=[];for(let f=0;f<l;f++){const d=document.createElement("col"),g=a&&a[f];g&&(d.style.width=`${g}px`),u.push(d)}c.replaceChildren(...u)})(r,0,this.getColumnCount(),this.getColWidths()),mc(r,o,this.getFormatType())}updateDOM(e,r,o){const s=this.getDOMSlot(r).element;return r===s===yc()||(se(i=r)&&i.nodeName==="DIV"&&this.updateTableWrapper(e,r,s,o),this.updateTableElement(e,s,o),!1);var i}exportDOM(e){const r=super.exportDOM(e),{element:o}=r;return{after:s=>{if(r.after&&(s=r.after(s)),!ir(s)&&se(s)&&(s=s.querySelector("table")),!ir(s))return null;mc(s,e._config,this.getFormatType());const[i]=lf(this,null,null),l=new Map;for(const f of i)for(const d of f){const g=d.cell.getKey();l.has(g)||l.set(g,{colSpan:d.cell.getColSpan(),startColumn:d.startColumn})}const a=new Set;for(const f of s.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){const d=f.getAttribute("data-temporary-table-cell-lexical-key");if(d){const g=l.get(d);if(f.removeAttribute("data-temporary-table-cell-lexical-key"),g){l.delete(d);for(let h=0;h<g.colSpan;h++)a.add(h+g.startColumn)}}}const c=s.querySelector(":scope > colgroup");if(c){const f=Array.from(s.querySelectorAll(":scope > colgroup > col")).filter((d,g)=>a.has(g));c.replaceChildren(...f)}const u=s.querySelectorAll(":scope > tr");if(u.length>0){const f=document.createElement("tbody");for(const d of u)f.appendChild(d);s.append(f)}return s},element:!ir(o)&&se(o)?o.querySelector("table"):o}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,r){const{rows:o,domRows:s}=r;for(let i=0;i<o;i++){const l=s[i];if(l!=null)for(let a=0;a<l.length;a++){const c=l[a];if(c==null)continue;const{elem:u}=c,f=G_(this,u);if(f!==null&&e.is(f))return{x:a,y:i}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,r,o){const{domRows:s}=o,i=s[r];if(i==null)return null;const l=i[e<i.length?e:i.length-1];return l??null}getDOMCellFromCordsOrThrow(e,r,o){const s=this.getDOMCellFromCords(e,r,o);if(!s)throw new Error("Cell not found at cords.");return s}getCellNodeFromCords(e,r,o){const s=this.getDOMCellFromCords(e,r,o);if(s==null)return null;const i=ye(s.elem);return Ie(i)?i:null}getCellNodeFromCordsOrThrow(e,r,o){const s=this.getCellNodeFromCords(e,r,o);if(!s)throw new Error("Node at cords not TableCellNode.");return s}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(e){const r=this.getWritable();return r.__rowStriping=e,r}setFrozenColumns(e){const r=this.getWritable();return r.__frozenColumnCount=e,r}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){const r=this.getWritable();return r.__frozenRowCount=e,r}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){const e=this.getFirstChild();if(!e)return 0;let r=0;return e.getChildren().forEach(o=>{Ie(o)&&(r+=o.getColSpan())}),r}}function Q_(n){const t=bl();n.hasAttribute("data-lexical-row-striping")&&t.setRowStriping(!0),n.hasAttribute("data-lexical-frozen-column")&&t.setFrozenColumns(1),n.hasAttribute("data-lexical-frozen-row")&&t.setFrozenRows(1);const e=n.querySelector(":scope > colgroup");if(e){let r=[];for(const o of e.querySelectorAll(":scope > col")){let s=o.style.width||"";if(!yl.test(s)&&(s=o.getAttribute("width")||"",!/^\d+$/.test(s))){r=void 0;break}r.push(parseFloat(s))}r&&t.setColWidths(r)}return{after:r=>ad(r,nr),node:t}}function bl(){return de(new Qr)}function wl(n){return n instanceof Qr}const Cc="startTransition",mi=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,em=mi?L.useLayoutEffect:L.useEffect;class tm{constructor(t){b(this,"key");b(this,"ref");this.key=t,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(t){this.ref={current:t}}}const Sc=n=>{const t=document.getElementById("typeahead-menu");if(!t)return;const e=t.getBoundingClientRect();e.top+e.height>window.innerHeight&&t.scrollIntoView({block:"center"}),e.top<0&&t.scrollIntoView({block:"center"}),n.scrollIntoView({block:"nearest"})};function xc(n,t){const e=n.getBoundingClientRect(),r=t.getBoundingClientRect();return e.top>=r.top-6&&e.top<=r.bottom+6}function nm(n,t,e,r){const[o]=Ce();L.useEffect(()=>{if(t!=null&&n!=null){const s=o.getRootElement(),i=s!=null?(function(f){let d=getComputedStyle(f);const g=d.position==="absolute",h=/(auto|scroll)/;if(d.position==="fixed")return document.body;for(let p=f;p=p.parentElement;)if(d=getComputedStyle(p),(!g||d.position!=="static")&&h.test(d.overflow+d.overflowY+d.overflowX))return p;return document.body})(s):document.body;let l=!1,a=xc(t,i);const c=function(){l||(window.requestAnimationFrame(function(){e(),l=!1}),l=!0);const f=xc(t,i);f!==a&&(a=f,r!=null&&r(f))},u=new ResizeObserver(e);return window.addEventListener("resize",e),document.addEventListener("scroll",c,{capture:!0,passive:!0}),u.observe(t),()=>{u.unobserve(t),window.removeEventListener("resize",e),document.removeEventListener("scroll",c,!0)}}},[t,o,r,e,n])}const bc=K("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function rm({close:n,editor:t,anchorElementRef:e,resolution:r,options:o,menuRenderFn:s,onSelectOption:i,shouldSplitNodeWithQuery:l=!1,commandPriority:a=Ye,preselectFirstItem:c=!0}){const[u,f]=L.useState(null),d=u!==null?Math.min(o.length-1,u):null,g=r.match&&r.match.matchingString;L.useEffect(()=>{c&&f(0)},[g,c]);const h=L.useCallback(_=>{t.update(()=>{const y=r.match!=null&&l?(function(m){const C=M();if(!O(C)||!C.isCollapsed())return null;const S=C.anchor;if(S.type!=="text")return null;const w=S.getNode();if(!w.isSimpleText())return null;const x=S.offset,v=w.getTextContent().slice(0,x),E=m.replaceableString.length,T=x-(function(D,P,R){let I=R;for(let U=I;U<=P.length;U++)D.slice(-U)===P.substring(0,U)&&(I=U);return I})(v,m.matchingString,E);if(T<0)return null;let k;return T===0?[k]=w.splitText(x):[,k]=w.splitText(T,x),k})(r.match):null;i(_,y,n,r.match?r.match.matchingString:"")})},[t,l,r.match,i,n]),p=L.useCallback(_=>{const y=t.getRootElement();y!==null&&(y.setAttribute("aria-activedescendant","typeahead-item-"+_),f(_))},[t]);return L.useEffect(()=>()=>{const _=t.getRootElement();_!==null&&_.removeAttribute("aria-activedescendant")},[t]),em(()=>{o===null?f(null):d===null&&c&&p(0)},[o,d,p,c]),L.useEffect(()=>Me(t.registerCommand(bc,({option:_})=>!(!_.ref||_.ref.current==null)&&(Sc(_.ref.current),!0),a)),[t,p,a]),L.useEffect(()=>Me(t.registerCommand(Dr,_=>{const y=_;if(o!==null&&o.length){const m=d===null?0:d!==o.length-1?d+1:0;p(m);const C=o[m];if(!C)return p(-1),y.preventDefault(),y.stopImmediatePropagation(),!0;C.ref&&C.ref.current&&t.dispatchCommand(bc,{index:m,option:C}),y.preventDefault(),y.stopImmediatePropagation()}return!0},a),t.registerCommand(Rr,_=>{const y=_;if(o!==null&&o.length){const m=d===null?o.length-1:d!==0?d-1:o.length-1;p(m);const C=o[m];if(!C)return p(-1),y.preventDefault(),y.stopImmediatePropagation(),!0;C.ref&&C.ref.current&&Sc(C.ref.current),y.preventDefault(),y.stopImmediatePropagation()}return!0},a),t.registerCommand(Ho,_=>{const y=_;return y.preventDefault(),y.stopImmediatePropagation(),n(),!0},a),t.registerCommand(Fr,_=>{const y=_;return o!==null&&d!==null&&o[d]!=null&&(y.preventDefault(),y.stopImmediatePropagation(),h(o[d]),!0)},a),t.registerCommand(Un,_=>o!==null&&d!==null&&o[d]!=null&&(_!==null&&(_.preventDefault(),_.stopImmediatePropagation()),h(o[d]),!0),a)),[h,n,t,o,d,p,a]),s(e,L.useMemo(()=>({options:o,selectOptionAndCleanUp:h,selectedIndex:d,setHighlightedIndex:f}),[h,d,o]),r.match?r.match.matchingString:"")}function wc(n,t){t!=null&&(n.className=t),n.setAttribute("aria-label","Typeahead menu"),n.setAttribute("role","listbox"),n.style.display="block",n.style.position="absolute"}const om=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function sm(n,{minLength:t=1,maxLength:e=75,punctuation:r=om,allowWhitespace:o=!1}){return L.useCallback(s=>{const i=new RegExp("(^|\\s|\\()(["+n+"]((?:"+("[^"+n+r+(o?"":"\\s")+"]")+"){0,"+e+"}))$").exec(s);if(i!==null){const l=i[1],a=i[3];if(a.length>=t)return{leadOffset:i.index+l.length,matchingString:a,replaceableString:i[2]}}return null},[o,n,r,e,t])}function im({options:n,onQueryChange:t,onSelectOption:e,onOpen:r,onClose:o,menuRenderFn:s,triggerFn:i,anchorClassName:l,commandPriority:a=Ye,parent:c,preselectFirstItem:u=!0,ignoreEntityBoundary:f=!1}){const[d]=Ce(),[g,h]=L.useState(null),p=(function(m,C,S,w=mi?document.body:void 0,x=!0){const[v]=Ce(),E=mi?document.createElement("div"):null,T=L.useRef(E),k=L.useCallback(()=>{if(T.current===null||w===void 0)return;T.current.style.top=T.current.style.bottom;const P=v.getRootElement(),R=T.current,I=R.firstChild;if(P!==null&&m!==null){const{left:U,top:H,width:G,height:re}=m.getRect(),ee=T.current.offsetHeight;if(R.style.top=`${H+ee+3+(x?window.pageYOffset:0)}px`,R.style.left=`${U+window.pageXOffset}px`,R.style.height=`${re}px`,R.style.width=`${G}px`,I!==null){I.style.top=`${H}`;const He=I.getBoundingClientRect(),be=He.height,we=He.width,Le=P.getBoundingClientRect();U+we>Le.right&&(R.style.left=`${Le.right-we+window.pageXOffset}px`),(H+be>window.innerHeight||H+be>Le.bottom)&&H-Le.top>be+re&&(R.style.top=`${H-be-re+(x?window.pageYOffset:0)}px`)}R.isConnected||(wc(R,S),w.append(R)),R.setAttribute("id","typeahead-menu"),P.setAttribute("aria-controls","typeahead-menu")}},[v,m,x,S,w]);L.useEffect(()=>{const P=v.getRootElement();return m!==null&&k(),()=>{P!==null&&P.removeAttribute("aria-controls");const R=T.current;R!==null&&R.isConnected&&(R.remove(),R.removeAttribute("id"))}},[v,k,m]);const D=L.useCallback(P=>{m!==null&&(P||C(null))},[m,C]);return nm(m,T.current,k,D),E!=null&&E===T.current&&(wc(E,S),w!=null&&w.append(E)),T})(g,h,l,c),_=L.useCallback(()=>{h(null),o!=null&&g!==null&&o()},[o,g]),y=L.useCallback(m=>{h(m),r!=null&&g===null&&r(m)},[r,g]);return L.useEffect(()=>{const m=d.registerUpdateListener(()=>{d.getEditorState().read(()=>{if(!d.isEditable())return void _();const C=d._window||window,S=C.document.createRange(),w=M(),x=(function(T){let k=null;return T.getEditorState().read(()=>{const D=M();O(D)&&(k=(function(P){const R=P.anchor;if(R.type!=="text")return null;const I=R.getNode();if(!I.isSimpleText())return null;const U=R.offset;return I.getTextContent().slice(0,U)})(D))}),k})(d);if(!O(w)||!w.isCollapsed()||x===null||S===null)return void _();const v=i(x,d);if(t(v?v.matchingString:null),v!==null&&(f||!(function(T,k){return k===0&&T.getEditorState().read(()=>{const D=M();if(O(D)){const P=D.anchor.getNode().getPreviousSibling();return $(P)&&P.isTextEntity()}return!1})})(d,v.leadOffset))&&(function(k,D,P){const R=et(P);if(R===null||!R.isCollapsed)return!1;const I=R.anchorNode,U=k,H=R.anchorOffset;if(I==null||H==null)return!1;try{D.setStart(I,U),D.setEnd(I,H)}catch{return!1}return!0})(v.leadOffset,S,C)!==null)return E=()=>y({getRect:()=>S.getBoundingClientRect(),match:v}),void(Cc in L?L[Cc](E):E());var E;_()})});return()=>{m()}},[d,i,t,g,_,y,f]),L.useEffect(()=>d.registerEditableListener(m=>{m||_()}),[d,_]),g===null||d===null||p.current===null?null:X.jsx(rm,{close:_,resolution:g,editor:d,anchorElementRef:p,options:n,menuRenderFn:s,shouldSplitNodeWithQuery:!0,onSelectOption:e,commandPriority:a,preselectFirstItem:u})}const lm=K("INSERT_EMBED_COMMAND");function am({validateUrl:n,attributes:t}){const[e]=Ce();return L.useEffect(()=>{if(!e.hasNodes([jr]))throw new Error("LinkPlugin: LinkNode not registered on editor")}),L.useEffect(()=>tp(e,Qi({attributes:t,validateUrl:n})),[e,n,t]),null}const cm=[{dependencies:[sl],export:n=>vd(n)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(n,t,e,r)=>{const o=Jr();r||n.getNextSibling()!=null?n.replace(o):n.insertBefore(o),o.selectNext()},type:"element"},...Mc.TRANSFORMERS];function um({transformers:n=cm}){const[t]=Ce();return L.useEffect(()=>Mc.registerMarkdownShortcuts(t,n),[t,n]),null}function vl(n){return[n.getKey(),n.getTextContent(),n.getTag()]}function dm(n,t,e){if(t===null)return e;const r=vl(t);let o=[];if(n===null){if(e.length>0&&e[0][0]===t.__key)return e;o=[r,...e]}else for(let s=0;s<e.length;s++){const i=e[s][0];if(o.push(e[s]),i===n.getKey()&&i!==t.getKey()){if(s+1<e.length&&e[s+1][0]===t.__key)return e;o.push(r)}}return o}function fm(n,t){const e=[];for(const r of t)r[0]!==n&&e.push(r);return e}function hm(n,t){const e=[];for(const r of t)r[0]===n.getKey()?e.push(vl(n)):e.push(r);return e}function vc(n,t,e){const r=[],o=vl(t);n||r.push(o);for(const s of e)s[0]!==t.getKey()&&(r.push(s),n&&s[0]===n.getKey()&&r.push(o));return r}function Ls(n){let t=wa(n);for(;t!==null&&!Cr(t);)t=wa(t);return t}function gm({children:n}){const[t,e]=L.useState([]),[r]=Ce();return L.useEffect(()=>{let o=[];r.getEditorState().read(()=>{const a=c=>{for(const u of c.getChildren())Cr(u)?o.push([u.getKey(),u.getTextContent(),u.getTag()]):N(u)&&a(u)};a(Q()),e(o)});const s=r.registerUpdateListener(({editorState:a,dirtyElements:c})=>{a.read(()=>{const u=f=>{for(const d of f.getChildren())if(Cr(d)){const g=Ls(d);o=vc(g,d,o),e(o)}else N(d)&&u(d)};Q().getChildren().forEach(f=>{N(f)&&c.get(f.__key)&&u(f)})})}),i=r.registerMutationListener(Zn,a=>{r.getEditorState().read(()=>{for(const[c,u]of a)if(u==="created"){const f=Y(c);if(f!==null){const d=Ls(f);o=dm(d,f,o)}}else if(u==="destroyed")o=fm(c,o);else if(u==="updated"){const f=Y(c);if(f!==null){const d=Ls(f);o=vc(d,f,o)}}e(o)})},{skipInitialization:!0}),l=r.registerMutationListener(Ke,a=>{r.getEditorState().read(()=>{for(const[c,u]of a)if(u==="updated"){const f=Y(c);if(f!==null){const d=f.getParentOrThrow();Cr(d)&&(o=hm(d,o),e(o))}}})},{skipInitialization:!0});return()=>{i(),l(),s()}},[r]),n(t,r)}const cf=Object.freeze({" ":"\\t","\n":"\\n"}),Tc=new RegExp(Object.keys(cf).join("|"),"g"),ft=Object.freeze({ancestorHasNextSibling:"|",ancestorIsLastChild:" ",hasNextSibling:"├",isLastChild:"└",selectedChar:"^",selectedLine:">"}),pm=[n=>n.hasFormat("bold")&&"Bold",n=>n.hasFormat("code")&&"Code",n=>n.hasFormat("italic")&&"Italic",n=>n.hasFormat("strikethrough")&&"Strikethrough",n=>n.hasFormat("subscript")&&"Subscript",n=>n.hasFormat("superscript")&&"Superscript",n=>n.hasFormat("underline")&&"Underline",n=>n.hasFormat("highlight")&&"Highlight"],_m=[n=>n.hasTextFormat("bold")&&"Bold",n=>n.hasTextFormat("code")&&"Code",n=>n.hasTextFormat("italic")&&"Italic",n=>n.hasTextFormat("strikethrough")&&"Strikethrough",n=>n.hasTextFormat("subscript")&&"Subscript",n=>n.hasTextFormat("superscript")&&"Superscript",n=>n.hasTextFormat("underline")&&"Underline",n=>n.hasTextFormat("highlight")&&"Highlight"],mm=[n=>n.isDirectionless()&&"Directionless",n=>n.isUnmergeable()&&"Unmergeable"],ym=[n=>n.isToken()&&"Token",n=>n.isSegmented()&&"Segmented"];function Cm(n,t,e,r,o=!1){const s=n.getEditorState(),i=n._config,l=n._compositionKey,a=n._editable;if(e){let d="";return s.read(()=>{d=(function(g){const h=document.createElement("div");return h.innerHTML=g.trim(),df(h,0).innerHTML})(Gi(n))}),d}let c=` root
|
|
20
|
+
`;const u=s.read(()=>{const d=M();return uf(Q(),(g,h)=>{const p=`(${g.getKey()})`,_=g.getType()||"",y=g.isSelected();c+=`${y?ft.selectedLine:" "} ${h.join(" ")} ${p} ${_} ${(function(m,C,S=!1){const w=C?C(m,S):void 0;if(w!==void 0&&w.length>0)return w;if($(m)){const x=m.getTextContent(),v=x.length===0?"(empty)":`"${Nc(x,S)}"`,E=(function(T){return[Ec(T),Sm(T),xm(T),kc(T)].filter(Boolean).join(", ")})(m);return[v,E.length!==0?`{ ${E} }`:null].filter(Boolean).join(" ").trim()}if(dt(m)){const x=m.getURL(),v=x.length===0?"(empty)":`"${Nc(x,S)}"`,E=(function(T){return[bm(T),wm(T),vm(T),kc(T)].filter(Boolean).join(", ")})(m);return[v,E.length!==0?`{ ${E} }`:null].filter(Boolean).join(" ").trim()}if(Ao(m))return`ids: [ ${m.getIDs().join(", ")} ]`;if(bt(m)){const x=(function(E){let T=_m.map(k=>k(E)).filter(Boolean).join(", ").toLocaleLowerCase();return T!==""&&(T="format: "+T),T})(m);let v=x!==""?`{ ${x} }`:"";return v+=m.__style?`(${m.__style})`:"",v}return""})(g,r,o)}
|
|
21
|
+
`,c+=(function({indent:m,isSelected:C,node:S,nodeKeyDisplay:w,selection:x,typeDisplay:v}){if(!$(S)||!O(x)||!C||N(S))return"";const E=x.anchor,T=x.focus;if(S.getTextContent()===""||E.getNode()===x.focus.getNode()&&E.offset===T.offset)return"";const[k,D]=(function(re,ee){const He=ee.getStartEndPoints();if(he(ee)||He===null)return[-1,-1];const[be,we]=He,Le=re.getTextContent(),It=Le.length;let it=-1,je=-1;if(be.type==="text"&&we.type==="text"){const lt=be.getNode(),Gt=we.getNode();lt===Gt&&re===lt&&be.offset!==we.offset?[it,je]=be.offset<we.offset?[be.offset,we.offset]:[we.offset,be.offset]:[it,je]=re===lt?lt.isBefore(Gt)?[be.offset,It]:[0,be.offset]:re===Gt?Gt.isBefore(lt)?[we.offset,It]:[0,we.offset]:[0,It]}const Nn=(Le.slice(0,it).match(Tc)||[]).length,Xt=(Le.slice(it,je).match(Tc)||[]).length;return[it+Nn,je+Nn+Xt]})(S,x);if(k===D)return"";const P=m[m.length-1]===ft.hasNextSibling?ft.ancestorHasNextSibling:ft.ancestorIsLastChild,R=[...m.slice(0,m.length-1),P],I=Array(k+1).fill(" "),U=Array(D-k).fill(ft.selectedChar),H=v.length+2,G=Array(w.length+H).fill(" ");return[ft.selectedLine,R.join(" "),[...G,...I,...U].join("")].join(" ")+`
|
|
22
|
+
`})({indent:h,isSelected:y,node:g,nodeKeyDisplay:p,selection:d,typeDisplay:_})}),d===null?": null":O(d)?(function(g){let h="";const p=Ec(g);h+=`: range ${p!==""?`{ ${p} }`:""} ${g.style!==""?`{ style: ${g.style} } `:""}`;const _=g.anchor,y=g.focus,m=_.offset,C=y.offset;return h+=`
|
|
23
|
+
├ anchor { key: ${_.key}, offset: ${m===null?"null":m}, type: ${_.type} }`,h+=`
|
|
24
|
+
└ focus { key: ${y.key}, offset: ${C===null?"null":C}, type: ${y.type} }`,h})(d):af(d)?(function(g){return`: table
|
|
25
|
+
└ { table: ${g.tableKey}, anchorCell: ${g.anchor.key}, focusCell: ${g.focus.key} }`})(d):(function(g){return he(g)?`: node
|
|
26
|
+
└ [${Array.from(g._nodes).join(", ")}]`:""})(d)});if(c+=`
|
|
27
|
+
selection`+u,c+=`
|
|
28
|
+
|
|
29
|
+
commands:`,t.length)for(const{index:d,type:g,payload:h}of t)c+=`
|
|
30
|
+
└ ${d}. { type: ${g}, payload: ${h instanceof Event?h.constructor.name:h} }`;else c+=`
|
|
31
|
+
└ None dispatched.`;const{version:f}=n.constructor;return c+=`
|
|
32
|
+
|
|
33
|
+
editor${f?` (v${f})`:""}:`,c+=`
|
|
34
|
+
└ namespace ${i.namespace}`,l!==null&&(c+=`
|
|
35
|
+
└ compositionKey ${l}`),c+=`
|
|
36
|
+
└ editable ${String(a)}`,c}function uf(n,t,e=[]){const r=n.getChildren(),o=r.length;r.forEach((s,i)=>{t(s,e.concat(i===o-1?ft.isLastChild:ft.hasNextSibling)),N(s)&&uf(s,t,e.concat(i===o-1?ft.ancestorIsLastChild:ft.ancestorHasNextSibling))})}function Nc(n,t=!1){const e=Object.entries(cf).reduce((r,[o,s])=>r.replace(new RegExp(o,"g"),String(s)),n);return t?e.replace(/[^\s]/g,"*"):e}function Sm(n){let t=mm.map(e=>e(n)).filter(Boolean).join(", ").toLocaleLowerCase();return t!==""&&(t="detail: "+t),t}function xm(n){let t=ym.map(e=>e(n)).filter(Boolean).join(", ").toLocaleLowerCase();return t!==""&&(t="mode: "+t),t}function Ec(n){let t=pm.map(e=>e(n)).filter(Boolean).join(", ").toLocaleLowerCase();return t!==""&&(t="format: "+t),t}function bm(n){let t=n.getTarget();return t!=null&&(t="target: "+t),t}function wm(n){let t=n.getRel();return t!=null&&(t="rel: "+t),t}function vm(n){let t=n.getTitle();return t!=null&&(t="title: "+t),t}function kc(n){if(!n.__state)return!1;const t=[];for(const[r,o]of n.__state.knownState.entries()){if(r.isEqual(o,r.defaultValue))continue;const s=JSON.stringify(r.unparse(o));t.push(`[${r.key}: ${s}]`)}let e=t.join(",");return e!==""&&(e="state: "+e),e}function df(n,t){const e=new Array(1+t++).join(" "),r=new Array(t-1).join(" ");let o;for(let s=0;s<n.children.length;s++)o=document.createTextNode(`
|
|
37
|
+
`+e),n.insertBefore(o,n.children[s]),df(n.children[s],t),n.lastElementChild===n.children[s]&&(o=document.createTextNode(`
|
|
38
|
+
`+r),n.appendChild(o));return n}const Tm=L.forwardRef(function({treeTypeButtonClassName:n,timeTravelButtonClassName:t,timeTravelPanelSliderClassName:e,timeTravelPanelButtonClassName:r,viewClassName:o,timeTravelPanelClassName:s,editorState:i,setEditorState:l,setEditorReadOnly:a,generateContent:c,commandsLog:u=[]},f){const[d,g]=L.useState([]),[h,p]=L.useState(""),[_,y]=L.useState(!1),[m,C]=L.useState(!1),S=L.useRef(0),w=L.useRef(null),[x,v]=L.useState(!1),[E,T]=L.useState(!1),[k,D]=L.useState(!1),P=L.useRef(null),R=L.useRef([]),I=L.useRef(0),U=L.useCallback(G=>{const re=++I.current;c(G).then(ee=>{re===I.current&&p(ee)}).catch(ee=>{re===I.current&&p(`Error rendering tree: ${ee.message}
|
|
39
|
+
|
|
40
|
+
Stack:
|
|
41
|
+
${ee.stack}`)})},[c]);L.useEffect(()=>{if(!(!k&&i._nodeMap.size>1e3&&(T(!0),!k))&&(P.current!==i||R.current!==u)){const G=P.current!==i;P.current=i,R.current=u,U(m),!_&&G&&g(re=>[...re,[Date.now(),i]])}},[i,U,m,k,_,u]);const H=d.length;return L.useEffect(()=>{if(x){let G;const re=()=>{const ee=S.current;if(ee===H-1)return void v(!1);const He=d[ee][0],be=d[ee+1][0];G=setTimeout(()=>{S.current++;const we=S.current,Le=w.current;Le!==null&&(Le.value=String(we)),l(d[we][1]),re()},be-He)};return re(),()=>{clearTimeout(G)}}},[d,x,H,l]),X.jsxs("div",{className:o,children:[!k&&E?X.jsxs("div",{style:{padding:20},children:[X.jsx("span",{style:{marginRight:20},children:"Detected large EditorState, this can impact debugging performance."}),X.jsx("button",{onClick:()=>{D(!0)},style:{background:"transparent",border:"1px solid white",color:"white",cursor:"pointer",padding:5},children:"Show full tree"})]}):null,k?null:X.jsx("button",{onClick:()=>(U(!m),void C(!m)),className:n,type:"button",children:m?"Tree":"Export DOM"}),!_&&(k||!E)&&H>2&&X.jsx("button",{onClick:()=>{a(!0),S.current=H-1,y(!0)},className:t,type:"button",children:"Time Travel"}),(k||!E)&&X.jsx("pre",{ref:f,children:h}),_&&(k||!E)&&X.jsxs("div",{className:s,children:[X.jsx("button",{className:r,onClick:()=>{S.current===H-1&&(S.current=1),v(!x)},type:"button",children:x?"Pause":"Play"}),X.jsx("input",{className:e,ref:w,onChange:G=>{const re=Number(G.target.value),ee=d[re];ee&&(S.current=re,l(ee[1]))},type:"range",min:"1",max:H-1}),X.jsx("button",{className:r,onClick:()=>{a(!1);const G=d.length-1,re=d[G];l(re[1]);const ee=w.current;ee!==null&&(ee.value=String(G)),y(!1),v(!1)},type:"button",children:"Exit"})]})]})});function Nm(n,t){const e=new Set;let r=0;for(const[o]of n._commands)e.add(n.registerCommand(o,s=>(t(i=>{r+=1;const l=[...i];return l.push({index:r,payload:s,type:o.type?o.type:"UNKNOWN"}),l.length>10&&l.shift(),l}),!1),Fe));return()=>e.forEach(o=>o())}function Em(n){const[t,e]=L.useState([]);return L.useEffect(()=>Nm(n,e),[n]),L.useMemo(()=>t,[t])}function km({treeTypeButtonClassName:n,timeTravelButtonClassName:t,timeTravelPanelSliderClassName:e,timeTravelPanelButtonClassName:r,timeTravelPanelClassName:o,viewClassName:s,editor:i,customPrintNode:l}){const a=yf.createRef(),[c,u]=L.useState(i.getEditorState()),f=Em(i);return L.useEffect(()=>Me(i.registerUpdateListener(({editorState:d})=>{u(d)}),i.registerEditableListener(()=>{u(i.getEditorState())})),[i]),L.useEffect(()=>{const d=a.current;if(d!==null)return d.__lexicalEditor=i,()=>{d.__lexicalEditor=null}},[i,a]),X.jsx(Tm,{treeTypeButtonClassName:n,timeTravelButtonClassName:t,timeTravelPanelSliderClassName:e,timeTravelPanelButtonClassName:r,viewClassName:s,timeTravelPanelClassName:o,setEditorReadOnly:d=>{const g=i.getRootElement();g!=null&&(g.contentEditable=d?"false":"true")},editorState:c,setEditorState:d=>i.setEditorState(d),generateContent:async function(d){return Cm(i,f,d,l)},ref:a,commandsLog:f})}const ff=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0?L.useLayoutEffect:L.useEffect;function Om({editor:n,ariaActiveDescendant:t,ariaAutoComplete:e,ariaControls:r,ariaDescribedBy:o,ariaErrorMessage:s,ariaExpanded:i,ariaInvalid:l,ariaLabel:a,ariaLabelledBy:c,ariaMultiline:u,ariaOwns:f,ariaRequired:d,autoCapitalize:g,className:h,id:p,role:_="textbox",spellCheck:y=!0,style:m,tabIndex:C,"data-testid":S,...w},x){const[v,E]=L.useState(n.isEditable()),T=L.useCallback(D=>{D&&D.ownerDocument&&D.ownerDocument.defaultView?n.setRootElement(D):n.setRootElement(null)},[n]),k=L.useMemo(()=>(function(...D){return P=>{for(const R of D)typeof R=="function"?R(P):R!=null&&(R.current=P)}})(x,T),[T,x]);return ff(()=>(E(n.isEditable()),n.registerEditableListener(D=>{E(D)})),[n]),X.jsx("div",{"aria-activedescendant":v?t:void 0,"aria-autocomplete":v?e:"none","aria-controls":v?r:void 0,"aria-describedby":o,...s!=null?{"aria-errormessage":s}:{},"aria-expanded":v&&_==="combobox"?!!i:void 0,...l!=null?{"aria-invalid":l}:{},"aria-label":a,"aria-labelledby":c,"aria-multiline":u,"aria-owns":v?f:void 0,"aria-readonly":!v||void 0,"aria-required":d,autoCapitalize:g,className:h,contentEditable:v,"data-testid":S,id:p,ref:k,role:_,spellCheck:y,style:m,tabIndex:C,...w})}const Mm=L.forwardRef(Om);function Oc(n){return n.getEditorState().read(Ed(n.isComposing()))}const Lm=L.forwardRef(Am);function Am(n,t){const{placeholder:e,...r}=n,[o]=Ce();return X.jsxs(X.Fragment,{children:[X.jsx(Mm,{editor:o,...r,ref:t}),e!=null&&X.jsx($m,{editor:o,content:e})]})}function $m({content:n,editor:t}){const e=(function(i){const[l,a]=L.useState(()=>Oc(i));return ff(()=>{function c(){const u=Oc(i);a(u)}return c(),Me(i.registerUpdateListener(()=>{c()}),i.registerEditableListener(()=>{c()}))},[i]),l})(t),[r,o]=L.useState(t.isEditable());if(L.useLayoutEffect(()=>(o(t.isEditable()),t.registerEditableListener(i=>{o(i)})),[t]),!e)return null;let s=null;return typeof n=="function"?s=n(r):n!==null&&(s=n),s===null?null:X.jsx("div",{"aria-hidden":!0,children:s})}function Rm({initialEditor:n,children:t,initialNodes:e,initialTheme:r,skipCollabChecks:o,skipEditableListener:s}){const i=L.useRef(!1),l=L.useContext(Lo);l==null&&(function(p,..._){const y=new URL("https://lexical.dev/docs/error"),m=new URLSearchParams;m.append("code",p);for(const C of _)m.append("v",C);throw y.search=m.toString(),Error(`Minified Lexical error #${p}; visit ${y.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(9);const[a,{getTheme:c}]=l,u=L.useMemo(()=>{const p=r||c()||void 0,_=gd(l,p);p!==void 0&&(n._config.theme=p),n._parentEditor=n._parentEditor||a;const y=n._createEditorArgs,m=y&&y.namespace;if(e){m||(n._config.namespace=a._config.namespace);for(let C of e){let S=null,w=null;if(typeof C!="function"){const v=C;C=v.replace,S=v.with,w=v.withKlass||null}const x=Go(n,C.getType());n._nodes.set(C.getType(),{exportDOM:x?x.exportDOM:void 0,klass:C,replace:S,replaceWithKlass:w,sharedNodeState:$s(C),transforms:Gs(C)})}}else if(y&&y.nodes)m||(n._config.namespace=a._config.namespace);else{const C=n._nodes=new Map(a._nodes);m||(n._config.namespace=a._config.namespace);for(const[S,w]of C)n._nodes.set(S,{exportDOM:w.exportDOM,klass:w.klass,replace:w.replace,replaceWithKlass:w.replaceWithKlass,sharedNodeState:$s(w.klass),transforms:Gs(w.klass)})}return[n,_]},[]),f=L.useContext(hd),{isCollabActive:d,yjsDocMap:g}=f??{},h=o||i.current||g&&g.has(n.getKey());return L.useEffect(()=>{h&&(i.current=!0)},[h]),L.useEffect(()=>{if(!s){const p=_=>n.setEditable(_);return p(a.isEditable()),a.registerEditableListener(p)}},[n,a,s]),X.jsx(Lo.Provider,{value:u,children:!d||h?t:null})}exports.$=im;exports.$computeTableMap=Ze;exports.$computeTableMapSkipCellCheck=Xd;exports.$createExtendedTextNode=Vn;exports.$createListItemNode=ze;exports.$createListNode=Re;exports.$createTableCellNode=Ct;exports.$createTableNodeWithDimensions=Yp;exports.$deleteTableColumn__EXPERIMENTAL=n_;exports.$deleteTableRow__EXPERIMENTAL=t_;exports.$e=ar;exports.$e$1=nr;exports.$getListDepth=Pd;exports.$getNodeTriplet=Pe;exports.$getSelectedHTMLElements=Hd;exports.$getTableAndElementByKey=Gd;exports.$getTableColumnIndexFromTableCellNode=Gp;exports.$getTableNodeFromLexicalNodeOrThrow=Yd;exports.$getTableRowIndexFromTableCellNode=Xp;exports.$i=Li;exports.$insertTableColumn__EXPERIMENTAL=e_;exports.$insertTableRow__EXPERIMENTAL=Qp;exports.$isExtendedTextNode=Or;exports.$isListItemNode=ce;exports.$isListNode=V;exports.$isTableCellNode=W;exports.$isTableNode=_e;exports.$isTableRowNode=Ue;exports.$isTableSelection=le;exports.$removeSelectedHTMLElement=ls;exports.$removeSelectedHTMLElements=jp;exports.$unmergeCell=r_;exports.A=rl;exports.Ae=Zc;exports.Al=Yi;exports.An=vo;exports.Ar=Gn;exports.At=ld;exports.B=jh;exports.Be=Ir;exports.Bi=$n;exports.CAN_USE_DOM=Vd;exports.Ce=Xc;exports.Ci=ae;exports.Cs=se;exports.D=rn;exports.D$1=sm;exports.DEFAULT_TARGETS=Ud;exports.De=zs;exports.Di=xn;exports.Dn=Ut;exports.E=ur;exports.Ee=Zr;exports.Ee$1=Ho;exports.El=Xe;exports.Et=Vr;exports.Et$1=ug;exports.ExtendedTextNode=qr;exports.Fe=Cl;exports.Fe$1=xi;exports.I=Hh;exports.INSERT_CHECK_LIST_COMMAND=Fp;exports.INSERT_ORDERED_LIST_COMMAND=Wd;exports.INSERT_TABLE_COMMAND=Kp;exports.INSERT_UNORDERED_LIST_COMMAND=Bd;exports.Ie=bi;exports.Ii=bt;exports.In=Qf;exports.It=Cr;exports.Je=vi;exports.Jn=qt;exports.Jt=bd;exports.Ke=wi;exports.Ki=J;exports.Kn=hu;exports.Ks=Hu;exports.L=D_;exports.Le=Jo;exports.Li=j;exports.ListItemNode=Qn;exports.ListNode=Yr;exports.Ln=fu;exports.Lr=M;exports.Me=Fr;exports.Me$1=Sl;exports.Mt=dr;exports.Ne=Un;exports.Ni=Sn;exports.No=Q;exports.Nt=hg;exports.Oe=jo;exports.Oe$1=Ie;exports.Ot=xp;exports.P=ci;exports.Pe=Qc;exports.Pt=Zn;exports.R=tm;exports.Re=Pr;exports.Ri=mh;exports.Rt=gg;exports.S=lm;exports.Se=zo;exports.Si=N;exports.Sl=qi;exports.St=Fn;exports.St$1=dg;exports.TableCellHeaderStates=ke;exports.TableCellNode=er;exports.TableNode=Gr;exports.TableRowNode=Xr;exports.Te=Dr;exports.Ti=q;exports.U=Me;exports.U$1=Xh;exports.Ue=cr;exports.Ve=Ti;exports.Vo=bh;exports.W=eg;exports.Wi=Fe;exports.Xn=Ke;exports.Xt=vd;exports.Ye=tu;exports._=il;exports._$1=rp;exports._$2=Vh;exports._e=pt;exports._o=Ht;exports._t=ll;exports.a=bg;exports.a$1=um;exports.a$2=rf;exports.a$3=zg;exports.a$4=T_;exports.ae=cn;exports.applyTableHandlers=l_;exports.as=We;exports.b=Sg;exports.be=Si;exports.bi=pe;exports.ce=tn;exports.ct=Uf;exports.dl=At;exports.dt=ge;exports.e=ai;exports.el=Yt;exports.f=Jr;exports.f$1=ol;exports.f$2=vg;exports.fe=$r;exports.fr=Ei;exports.fs=de;exports.ft=cg;exports.ft$1=Ci;exports.g=sp;exports.g$1=Gi;exports.getDOMCellFromTarget=gi;exports.getSelectionState=jd;exports.getTableElement=mn;exports.getTableObserverFromTableElement=dl;exports.getTheme=vp;exports.gn=bl;exports.hn=Qr;exports.hr=De;exports.hs=zu;exports.ht=St;exports.ie=Bt;exports.insertList=hi;exports.invariant=B;exports.je=eu;exports.jn=_t;exports.jo=Pu;exports.jr=Su;exports.ke=Rr;exports.ki=Kr;exports.l=am;exports.le=Mt;exports.le$1=rg;exports.lr=$;exports.lt=oe;exports.lt$1=ml;exports.m=op;exports.m$1=gm;exports.m$2=cd;exports.m$3=Rm;exports.me=Yc;exports.mn=wl;exports.n=km;exports.n$1=v_;exports.n$2=k_;exports.n$3=N_;exports.n$4=ip;exports.ns=Bu;exports.nt=_l;exports.o=Ce;exports.onSelect=Jp;exports.onSelectEnd=Up;exports.oo=Sh;exports.ot=zf;exports.ot$1=$e;exports.p=Ug;exports.p$1=sl;exports.pe=Ko;exports.qe=nu;exports.r=Nd;exports.r$1=b_;exports.re=K;exports.re$1=og;exports.registerList=Ip;exports.ro=Zo;exports.s=ss;exports.scrollOptions=Hp;exports.se=Ar;exports.setScrollableTablesActive=C_;exports.sr=fe;exports.st=Rt;exports.st$1=Wc;exports.stopEvent=kt;exports.t=w_;exports.theme=Jn;exports.tl=me;exports.u=nl;exports.ue=zt;exports.ur=Xn;exports.us=Wu;exports.ut=Ve;exports.ve=Gc;exports.ve$1=on;exports.vo=ye;exports.w=dt;exports.w$1=tl;exports.we=Uo;exports.wo=ne;exports.wt=id;exports.x=Lm;exports.xe=tr;exports.xe$1=Wo;exports.xo=Y;exports.xr=he;exports.xt=Xi;exports.y=jr;exports.ye=Bo;exports.yr=O;exports.zi=Ye;exports.zs=z;
|