@remit/web-client-dist 0.0.296 → 0.0.298
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/assets/ComposeBody-IY39gbj9.js +29 -0
- package/assets/ConfirmDialog-x_WinEM5.js +1 -0
- package/assets/{ErrorState-CYMKMK-m.js → ErrorState-DgMXA1BY.js} +1 -1
- package/assets/{OnboardingWizard-DiNp39Ly.js → OnboardingWizard-DkiUcFSm.js} +1 -1
- package/assets/{account-form-helpers-C6QgTBuy.js → account-form-helpers-BIwq0CFm.js} +1 -1
- package/assets/{accounts-DrrxLu-A.js → accounts-C5kliEIy.js} +1 -1
- package/assets/{advanced-ClKJ3X6O.js → advanced-aIj-4ZxN.js} +1 -1
- package/assets/{appearance-8lqa5Vua.js → appearance-D3krKHAG.js} +1 -1
- package/assets/{avatar-VNDJ5A43.js → avatar-CX7bOsD1.js} +1 -1
- package/assets/{browser-ponyfill-DvwMi_jg.js → browser-ponyfill-Bge205Bk.js} +1 -1
- package/assets/{circle-check-pM99trgf.js → circle-check-C4qplern.js} +1 -1
- package/assets/{download-C3FtIMt9.js → download-By57JxX8.js} +1 -1
- package/assets/{filters-Dux80wCX.js → filters-CSVp_AW8.js} +1 -1
- package/assets/{flagged-BEsB_wRe.js → flagged-4lYHMqPG.js} +1 -1
- package/assets/{folders-cKlRSWFA.js → folders-BgsIDxnx.js} +1 -1
- package/assets/index-BasS0sR4.js +1 -0
- package/assets/{index-DZC9weAQ.js → index-CGItbOSw.js} +1 -1
- package/assets/{index-Bp4WnjS6.css → index-Cr66tnb-.css} +1 -1
- package/assets/{index-CFFTFBUh.js → index-bW4RCdiF.js} +4 -4
- package/assets/{kbd-YJVHKonD.js → kbd-C5C_2AcW.js} +1 -1
- package/assets/{labels-AWXTmNVS.js → labels-GIRUAoSh.js} +1 -1
- package/assets/mail-BaFZoOZu.js +118 -0
- package/assets/{move-options-D9t3Mojn.js → move-options-DNUvUPeB.js} +1 -1
- package/assets/{onboarding-BZ6X6xkU.js → onboarding-CZQ0DJ5g.js} +1 -1
- package/assets/{pencil-X6z3x2NK.js → pencil-Daerndfj.js} +1 -1
- package/assets/{senders-C1UIALFk.js → senders-BW3o0tcC.js} +1 -1
- package/assets/settings-CewotkR_.js +1 -0
- package/assets/{settings-screen-CR4yq1NM.js → settings-screen-CMhBy_N3.js} +1 -1
- package/assets/{shield-check-BSX7wD7V.js → shield-check-B4SpLWDJ.js} +1 -1
- package/assets/{suggested-vips-2b3eZkLi.js → suggested-vips-DVBki8yW.js} +1 -1
- package/assets/{useDebouncedValue-BD9ZdStj.js → useDebouncedValue-CrW9xaZB.js} +1 -1
- package/assets/{useFilters-DyThnXyZ.js → useFilters-CRbqtIL9.js} +1 -1
- package/assets/{useLabels-CdFZ8p_J.js → useLabels-3wBUjUtC.js} +1 -1
- package/assets/{useSignature-BQhyovyz.js → useSignature-lw54OO-w.js} +1 -1
- package/index.html +2 -2
- package/package.json +1 -1
- package/assets/ComposeBody-DWkdEkqR.js +0 -25
- package/assets/ConfirmDialog-BJo9D9jL.js +0 -1
- package/assets/index-bi7nSm8_.js +0 -1
- package/assets/mail-KIW9IAGs.js +0 -118
- package/assets/settings-B1pbwg2l.js +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{a as No,j as P,B as Dg,d as Rg,r as R,G as Pg,a0 as Yc}from"./index-bW4RCdiF.js";import{s as Jl,U as Ig,c as Xc,a as Lg}from"./mail-BaFZoOZu.js";import{C as Kg}from"./ConfirmDialog-x_WinEM5.js";import"./pencil-Daerndfj.js";import"./avatar-CX7bOsD1.js";import"./kbd-C5C_2AcW.js";import"./shield-check-B4SpLWDJ.js";import"./account-form-helpers-BIwq0CFm.js";import"./useSignature-lw54OO-w.js";import"./useDebouncedValue-CrW9xaZB.js";import"./useFilters-CRbqtIL9.js";import"./ErrorState-DgMXA1BY.js";import"./format-CKZmh-Ru.js";import"./move-options-DNUvUPeB.js";import"./download-By57JxX8.js";import"./useLabels-3wBUjUtC.js";import"./circle-check-C4qplern.js";const zg=No("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);const Bg=No("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);const Wg=No("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);const jg=No("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);const Ug=No("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]),Hg=({mode:n,onToggle:e})=>P.jsx(Dg,{variant:"ghost",size:"md","aria-pressed":n==="plain",title:"Plain text",onClick:e,"data-testid":"compose-mode-toggle",className:Rg("min-h-11 shrink-0",n==="plain"&&"bg-accent-2-soft text-accent-2"),children:"Plain text"});function $(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function vf(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);t.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Ve=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Jg=Ve&&"documentMode"in document?document.documentMode:null,Tt=Ve&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ot=Ve&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),vr=!(!Ve||!("InputEvent"in window)||Jg)&&"getTargetRanges"in new window.InputEvent("input"),mn=Ve&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Tf=Ve&&/Android/.test(navigator.userAgent),ko=Ve&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Tf,Nf=Ve&&/^(?=.*Chrome).*/i.test(navigator.userAgent),gi=Ve&&Tf&&Nf,wo=Ve&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Tt&&!Nf,qg=0,Vg=1,Yg=2,Hs=1,Js=2,qs=4,Vs=8,Xg=16,Cs=32,Ss=64,ql=128,Gg=1,Qg=2,Zg=3,ep=4,tp=5,np=6,co=ko||mn||wo?" ":"",On=`
|
|
2
|
+
|
|
3
|
+
`,Vl=Ot?" ":co,rn={bold:1,capitalize:1024,code:16,highlight:ql,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},rp={directionless:1,unmergeable:2},pi={center:2,end:6,justify:4,left:1,right:3,start:5},op={[Qg]:"center",[np]:"end",[ep]:"justify",[Gg]:"left",[Zg]:"right",[tp]:"start"},ip={normal:0,segmented:2,token:1},sp={[qg]:"normal",[Yg]:"segmented",[Vg]:"token"},Gc="$config";function Qc(){return be()._blockCursorElement}function lp(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-slot")}let kf=class ni{element;before;after;constructor(e,t,r){this.element=e,this.before=t||null,this.after=r||null}withBefore(e){return new ni(this.element,e,this.after)}withAfter(e){return new ni(this.element,this.before,e)}withElement(e){return this.element===e?this:new ni(e,this.before,this.after)}insertChild(e){const t=this.getInsertionAnchor();return t!==null&&t.parentElement!==this.element&&$(357),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&$(358),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&$(359),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;return t===this.getInsertionAnchor()?null:t}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,t,r){if(this.element===e)return t===e&&r===0?"before":"after";const o=Zc(e,this.element);if(o===null)return"after";const i=Array.prototype.indexOf.call(e.childNodes,o);if(i<0)return"after";if(t===e)return r<=i?"before":"after";const s=Zc(e,t);if(s===null)return"after";const l=Array.prototype.indexOf.call(e.childNodes,s);return l>=0&&l<=i?"before":"after"}getInsertionAnchor(){return this.before}};function Zc(n,e){let t=e;for(;t!==null&&t.parentNode!==n;)t=t.parentNode;return t}let wf=class ri extends kf{withBefore(e){return new ri(this.element,e,this.after)}withAfter(e){return new ri(this.element,this.before,e)}withElement(e){return this.element===e?this:new ri(e,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;lp(t);)e=t,t=t.nextSibling;const r=e?e.nextSibling:this.element.firstChild;return r!==null&&r===Qc()?r:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(wo||mn||ko);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,r=e.nodeName==="IMG"?e.nextSibling:null;r&&t.removeChild(r),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,o=this.before,i=ee().createElement("br");if(i.setAttribute("data-lexical-managed-linebreak","true"),r.insertBefore(i,o),e){const s=ee().createElement("img");s.setAttribute("data-lexical-managed-linebreak","true"),s.style.setProperty("display","inline","important"),s.style.setProperty("border","0px","important"),s.style.setProperty("margin","0px","important"),s.alt="",r.insertBefore(s,i),r.__lexicalLineBreak=s}else r.__lexicalLineBreak=i}getFirstChildOffset(){const e=this.getFirstChild(),t=this.getInsertionAnchor();let r=0;for(let o=this.element.firstChild;o!==null&&o!==e&&o!==t;o=o.nextSibling)r++;return r}resolveChildIndex(e,t,r,o){if(r===this.element){const c=this.getFirstChildOffset(),a=Qc(),u=this.element.childNodes,f=Math.min(o,u.length);let d=0;for(let h=c;h<f;h++)u[h]!==a&&d++;return[e,Math.min(d,e.getChildrenSize())]}const i=ea(t,r);i.push(o);const s=ea(t,this.element);let l=e.getIndexWithinParent();for(let c=0;c<s.length;c++){const a=i[c],u=s[c];if(a===void 0||a<u)break;if(a>u){l+=1;break}}return[e.getParentOrThrow(),l]}};function ea(n,e){const t=[];let r=e;for(;r!==n&&r!==null;r=r.parentNode){let o=0;for(let i=r.previousSibling;i!==null;i=i.previousSibling)o++;t.push(o)}return r!==n&&$(225),t.reverse()}let Ef;try{Ef="0.49.0+prod.esm"}catch{}const $f=Ef??'"<unknown>+source"';let Hr=class{_front=new Set;_back=new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){const e=Array.from(this._front).reverse();for(const t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};const Nn=null;function Of(n,e=1e3){return n instanceof Ys?n.clone():n.size<e?new Map(n):new Ys().init(new Map(n),void 0,n.size)}let Ys=class Af{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new Af().init(this._old,this._nursery,this._size)}init(e,t,r){return this._old=e,this._nursery=t,this._size=r,this}get size(){return this._size}has(e){return this.get(e)!==void 0}getWithTombstone(e){const t=this._nursery&&this._nursery.get(e);return t!==void 0?t:this._old&&this._old.get(e)}get(e){const t=this.getWithTombstone(e);return t===Nn?void 0:t}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){const t=new Map(this._old);for(const[r,o]of this._nursery)o!==Nn?t.set(r,o):t.delete(r);this._old=t,this._nursery=void 0}return this._mutable=!1,this}set(e,t){const r=this.getWithTombstone(e);if(r===t)return this;const o=this.getNursery();return r!==Nn&&r!==void 0||(this._size++,r===Nn&&o.delete(e)),o.set(e,t),this}delete(e){const t=this.has(e);return t&&(this.getNursery().set(e,Nn),this._size--),t}getOrInsert(e,t){const r=this.get(e);return r!==void 0?r:(this.set(e,t),t)}getOrInsertComputed(e,t){const r=this.get(e);if(r!==void 0)return r;const o=t(e);return this.set(e,o),o}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const e of this.entries())yield e[0]}*values(){for(const e of this.entries())yield e[1]}*entries(){const e=this._nursery,t=this._old;if(t)for(const r of t){const o=r[0],i=e?e.get(o):void 0;i!==Nn&&(i!==void 0&&(r[1]=i),yield r)}if(e)for(const r of e)r[1]===Nn||t&&t.has(r[0])||(yield r)}forEach(e,t){t!==void 0&&(e=e.bind(t));for(const[r,o]of this.entries())e(o,r,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}};function mi(n,e,t,r,o,i){if(S(n)){let s=n.getFirstChild();for(;s!==null;){const l=s.__key;s.__parent===e&&((S(s)||tn(s)&&s.__slots!==null)&&mi(s,l,t,r,o,i),t.has(l)||i.delete(l),o.push(l)),s=s.getNextSibling()}}for(const s of tn(n)&&n.__slots!==null?n.__slots.values():[]){const l=r.get(s);l!==void 0&&Kn(l)&&l.__slotHost===e&&((S(l)||tn(l)&&l.__slots!==null)&&mi(l,s,t,r,o,i),t.has(s)||i.delete(s),o.push(s))}}let Xs=!1,Yl=0;function cp(n){Yl=n.timeStamp}function bs(n,e,t){const r=n.nodeName==="BR",o=e.__lexicalLineBreak;return o&&(n===o||r&&n.previousSibling===o)||r&&zr(n,t)!==void 0}function ap(n,e,t){const r=De(it(t)),o=r&&rt(r,t._rootElement);let i=null,s=null;o!==null&&o.anchorNode===n&&(i=o.anchorOffset,s=o.focusOffset);const l=n.nodeValue;l!==null&&_c(e,l,i,s,!1)}function up(n,e,t){if(E(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return ot(e)&&t.isAttached()}function fp(n,e,t){for(let r=n;r&&!rh(r);r=Vn(r)){const o=zr(r,e);if(o!==void 0){const i=te(o,t);if(i)return G(i)||!W(r)?void 0:[r,i]}}}function Mf(n,e,t){Xs=!0;const r=performance.now()-Yl>100;try{_t(n,()=>{const o=M()||(function(f){return f.read("latest",()=>{const d=M();return d!==null?d.clone():null})})(n),i=new Map,s=n._editorState,l=n._blockCursorElement;let c=!1,a="";for(let f=0;f<e.length;f++){const d=e[f],h=d.type,g=d.target,m=fp(g,n,s);if(!m)continue;const[p,_]=m;if(h==="characterData")r&&O(_)&&ot(g)&&up(o,g,_)&&ap(g,_,n);else if(h==="childList"){c=!0;const y=d.addedNodes;for(let T=0;T<y.length;T++){const b=y[T],N=Wd(b),v=b.parentNode;if(!(v==null||b===l||N!==null||bs(b,v,n)||n._slotsUsed&&W(b)&&b.hasAttribute("data-lexical-slot")||rh(b))){if(Ot){const w=(W(b)?b.innerText:null)||b.nodeValue;w&&(a+=w)}v.removeChild(b)}}const x=d.removedNodes,C=x.length;if(C>0){let T=0;for(let b=0;b<C;b++){const N=x[b];(bs(N,g,n)||l===N)&&(g.appendChild(N),T++)}C!==T&&i.set(p,_)}}}if(i.size>0)for(const[f,d]of i)d.reconcileObservedMutation(f,n);const u=t.takeRecords();if(u.length>0){for(let f=0;f<u.length;f++){const d=u[f],h=d.addedNodes,g=d.target;for(let m=0;m<h.length;m++){const p=h[m],_=p.parentNode;_==null||p.nodeName!=="BR"||bs(p,g,n)||_.removeChild(p)}}t.takeRecords()}o!==null&&(c&&pe(o),Ot&&Vd(n)&&o.insertRawText(a))})}finally{Xs=!1}}function Ff(n){const e=n._observer;e!==null&&Mf(n,e.takeRecords(),e)}function Df(n){(function(e){Yl===0&&it(e).addEventListener("textInput",cp,!0)})(n),n._observer=new MutationObserver((e,t)=>{Mf(n,e,t)})}const ta="latest";let dp=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||pp).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function Eo(n,e){return new dp(n,e)}function $o(n,e,t=ta){const r=(t===ta?n.getLatest():n).__state;return r?r.getValue(e):e.defaultValue}function hr(n,e,t){let r;if(Re(),typeof t=="function"){const i=n.getLatest(),s=$o(i,e);if(r=t(s),e.isEqual(s,r))return i}else r=t;const o=n.getWritable();return Pf(o).updateFromKnown(e,r),o}function hp(n){const e=new Map,t=new Set;for(const{ownNodeConfig:r}of vc(typeof n=="function"?n:n.replace))if(r&&r.stateConfigs)for(const o of r.stateConfigs){let i;"stateConfig"in o?(i=o.stateConfig,o.flat&&t.add(i.key)):i=o,e.set(i.key,i)}return{flatKeys:t,sharedConfigMap:e}}const na=new Set(["__proto__","constructor","prototype"]);let gp=class Rf{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,r=void 0,o=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=r,this.knownState=o;const{sharedConfigMap:s}=this.sharedNodeState,l=i!==void 0?i:(function(c,a,u){let f=u.size;if(a)for(const d in a){const h=c.get(d);h&&u.has(h)||f++}return f})(s,r,o);this.size=l}getValue(e){const t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let r=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const o=this.unknownState[e.key];o!==void 0&&(r=e.parse(o)),this.updateFromKnown(e,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[r,o]of this.knownState)r.isEqual(o,r.defaultValue)?delete e[r.key]:e[r.key]=r.unparse(o);for(const r of this.sharedNodeState.flatKeys)r in e&&(t[r]=e[r],delete e[r]);return ra(e)&&(t.$=e),t}getWritable(e){if(this.node===e)return this;const{sharedNodeState:t,unknownState:r}=this,o=new Map(this.knownState);return new Rf(e,t,(function(i,s,l){let c;if(l)for(const[a,u]of Object.entries(l)){if(na.has(a))continue;const f=i.get(a);f?s.has(f)||s.set(f,f.parse(u)):(c=c||{},c[a]=u)}return c})(t.sharedConfigMap,o,r),o,this.size)}resetOnCopyNode(){for(const e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){const r=e.key;this.sharedNodeState.sharedConfigMap.set(r,e);const{knownState:o,unknownState:i}=this;o.has(e)||i&&r in i||(i&&(delete i[r],this.unknownState=ra(i)),this.size++),o.set(e,t)}updateFromUnknown(e,t){if(na.has(e))return;const r=this.sharedNodeState.sharedConfigMap.get(e);r?this.updateFromKnown(r,r.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){const{knownState:t}=this;for(const r of t.keys())t.set(r,r.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(const[r,o]of Object.entries(e))this.updateFromUnknown(r,o)}};function Pf(n){const e=n.getWritable(),t=e.__state?e.__state.getWritable(e):new gp(e,If(e));return e.__state=t,t}function If(n){return n.__state?n.__state.sharedNodeState:Kd(be(),n.getType()).sharedNodeState}function ra(n){if(n)for(const e in n)return n}function pp(n){return n}function oa(n,e,t){for(const[r,o]of e.knownState){if(n.has(r.key))continue;n.add(r.key);const i=t?t.getValue(r):r.defaultValue;if(i!==o&&!r.isEqual(i,o))return!0}return!1}function ia(n,e,t){const{unknownState:r}=e,o=t?t.unknownState:void 0;if(r){for(const[i,s]of Object.entries(r))if(!n.has(i)&&(n.add(i),s!==(o?o[i]:void 0)))return!0}return!1}function sa(n,e){const t=n.__state;return t&&t.node===n?t.getWritable(e):t}function la(n,e){const t=n.__mode,r=n.__format,o=n.__style,i=e.__mode,s=e.__format,l=e.__style,c=n.__state,a=e.__state;return(t===null||t===i)&&(r===null||r===s)&&(o===null||o===l)&&(n.__state===null||c===a||(function(u,f){if(u===f)return!0;const d=new Set;return!(u&&oa(d,u,f)||f&&oa(d,f,u)||u&&ia(d,u,f)||f&&ia(d,f,u))})(c,a))}function ca(n,e){const t=n.mergeWithSibling(e),r=fe()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function aa(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&O(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(la(e,r)){r=ca(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&O(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(la(r,t)){r=ca(r,t);break}break}t.remove()}}else r.remove()}function Dt(n){return ua(n.anchor),ua(n.focus),n}function ua(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,o;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),o=!0):(r=e.getChildAtIndex(t),o=!1),O(r)){n.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!S(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}const ao=Symbol.for("@lexical/CachedTextSize");function fa(n,e){return Qs.read(()=>{let t=0,r=n;for(let o=0;o<e&&r!==null;o++){const i=Nt.get(r);if(i===void 0&&$(345,r),S(i)){const s=Te.get(r);if(s!==void 0&&S(s)&&s.__parent!==i.__parent)t+=i.getTextContentSize();else{const l=Dn.get(r),c=l&&l.__lexicalTextContent;typeof c!="string"&&$(346,i.getType()),t+=c.length}o<e-1&&!i.isInline()&&(t+=2)}else{const s=i[ao];s===void 0&&$(347,i.getType(),r),t+=s}r=i.__next}return t},{editor:ce})}function Lf(n){S(n)||n[ao]===void 0&&(n[ao]=O(n)?n.__text.length:n.getTextContentSize())}const mp=4;let uo,ce,fo,Q="",ke=null,Ue=null,Ke=null;function Rt(){return{firstTextKey:Ke,format:ke,style:Ue}}function ht(n){n.firstTextKey!==null&&(ke=n.format,Ue=n.style,Ke=n.firstTextKey)}function Gs(n){if(Ke!==null)return;const e=n.__lexicalFirstTextKey;if(e===void 0&&$(348),e===null)return;const t=Te.get(e);O(t)&&(ke=t.getFormat(),Ue=t.getStyle(),Ke=e)}let Vi,no,ro,Nt,Qs,Te,Dn,Zs,ho,Rn,Qt=!1,_i=!1;function fn(n,e){const t=Nt.get(n),r=Te.has(n);if(e!==null){const o=ol(n);o.parentNode===e&&e.removeChild(o)}if(!r){if(ce._keyToDOMMap.delete(n),S(t)){const o=Pi(t,Nt);el(o,0,o.length-1,null)}if(t!==void 0){for(const o of lt(t).values()){const i=nl(o);fn(o,null),i!==null&&i.remove()}yc(ho,fo,Vi,t,"destroyed")}}}function el(n,e,t,r){for(let o=e;o<=t;++o){const i=n[o];i!==void 0&&fn(i,r)}}function kn(n,e){n.setProperty("text-align",e)}const _p="40px";function Kf(n,e){const t=uo.theme.indent;if(typeof t=="string"){const r=n.classList.contains(t);e>0&&!r?n.classList.add(t):e<1&&r&&n.classList.remove(t)}n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * var(--lexical-indent-base-value, ${_p}))`)}function zf(n,e){const t=n.style;e===0?kn(t,""):e===1?kn(t,"left"):e===2?kn(t,"center"):e===3?kn(t,"right"):e===4?kn(t,"justify"):e===5?kn(t,"start"):e===6&&kn(t,"end")}function tl(n,e){const t=(function(r){const o=r.__dir;if(o!==null)return o;if(Ee(r))return null;const i=r.getParent();return i===null||Se(i)&&i.__dir===null?"auto":null})(e);t!==null?n.dir=t:n.removeAttribute("dir")}function Bf(n){const e=ee().createElement("div");return e.setAttribute("data-lexical-slot",n),e.style.display="none",e}function Wf(n,e,t){e||n.contentEditable==="false"?wm(t,ce):t.removeAttribute("contenteditable")}function da(n,e,t){const r=Q,o=Rt();Q="";let i="";const s=G(n);for(const[l,c]of t){const a=Bf(l);Wf(e,s,a),e.appendChild(a),Q="";const u=Rt();dn(c,St(n,a,ce)),ht(u),jf(n,l,e,a),i+=Q}return ht(o),Q=r,i}function lt(n){return tn(n)&&n.__slots!==null?n.__slots:sh}function jf(n,e,t,r){const o=Rn.$getSlotTargetElement(n,e,t,ce);o!==null&&(r.parentElement!==o&&o.appendChild(r),r.style.display="")}function nl(n){const e=Dn.get(n);return e!==void 0?e.parentElement:null}function ha(n,e,t){const r=lt(n),o=lt(e);for(const[u,f]of r)if(!o.has(u)){const d=nl(f);fn(f,null),d!==null&&d.remove()}const i=Q,s=Rt();let l="",c=null;const a=G(e);for(const[u,f]of o){const d=r.get(u);let h=d!==void 0?nl(d):null;Q="";const g=Rt();if(h===null){h=Bf(u);let m=null;for(const p of t.children)if(!p.hasAttribute("data-lexical-slot")){m=p;break}t.insertBefore(h,m),dn(f,St(e,h,ce))}else d===f?Gt(f,h):(d!==void 0&&fn(d,h),dn(f,St(e,h,ce)));if(ht(g),Wf(t,a,h),jf(e,u,t,h),l+=Q,h.parentElement===t){const m=c===null?t.firstChild:c.nextSibling;m!==h&&t.insertBefore(h,m),c=h}}return ht(s),Q=i,l}function dn(n,e){const t=Te.get(n);if(t===void 0&&$(60),e!==null){const o=Nt.get(n);if(o!==void 0){const i=Dn.get(n);if(i!==void 0){const s=Kn(o)?o.__slotHost:null,l=Kn(t)?t.__slotHost:null,c=o.__parent!==t.__parent||s!==l,a=l!==null&&i.parentElement!==e.element;if(c||a)return e.insertChild(i),Gt(n,e.element)}}}const r=Rn.$createDOM(t,ce);if((function(o,i,s){const l=s._keyToDOMMap;jd(i,s,o),l.set(o,i)})(n,r,ce),O(t)?r.setAttribute("data-lexical-text","true"):G(t)&&(r.setAttribute("data-lexical-decorator","true"),Di(r,{captureSelection:!0})),S(t)){const o=t.__indent,i=t.__size;tl(r,t),o!==0&&Kf(r,o);const s=lt(t),l=s.size>0?da(t,r,s):"";if(i===0)r.__lexicalTextContent=l,r.__lexicalFirstTextKey=null,Q+=l,s.size>0&&(r.__lexicalSlotTextLength=l.length);else{const a=Q,u=i-1;if(rl(Pi(t,Te),t,0,u,St(t,r,ce)),l!==""){const f=r.__lexicalTextContent||"";r.__lexicalTextContent=l+f,Q=a+l+f}s.size>0&&(r.__lexicalSlotTextLength=l.length)}const c=t.__format;c!==0&&zf(r,c),t.isInline()||Uf(null,t,r)}else{const o=t.getTextContent();if(G(t)){const i=t.decorate(ce,uo);i!==null&&Hf(n,i),r.contentEditable="false";const s=lt(t);s.size>0&&da(t,r,s)}Q+=o}return e!==null&&e.insertChild(r),Rn.$decorateDOM(t,null,r,ce),Lf(t),yc(ho,fo,Vi,t,"created"),r}function rl(n,e,t,r,o){const i=Q,s=Rt();Q="",ke=null,Ue=null,Ke=null;let l=t;for(;l<=r;++l){const a=Rt();dn(n[l],o);const u=Te.get(n[l]);u!==null&&O(u)?ke===null&&(ke=u.getFormat(),Ue=u.getStyle(),Ke=u.__key):S(u)&&l<r&&!u.isInline()&&(Q+=On),ht(a)}const c=ce._keyToDOMMap.get(e.__key);c===void 0&&$(349,e.__key),c.__lexicalTextContent=Q,c.__lexicalFirstTextKey=Ke,Q=i+Q,ht(s)}function Uf(n,e,t){const r=St(e,t,ce),o=r.element.__lexicalLastChildKind??null,i=(function(s,l){if(s){const c=s.__last;if(c){const a=l.get(c);if(a)return Le(a)?"line-break":G(a)&&a.isInline()?"decorator":null}return lt(s).size>0?null:"empty"}return null})(e,Te);o!==i&&r.setManagedLineBreak(i)}function yp(n,e,t){var r;ke=null,Ue=null,Ke=null,(function(o,i,s){const l=Q,c=o.__size,a=i.__size;Q="";const u=s.element,f=ce._keyToDOMMap.get(i.__key);f===void 0&&$(351,i.__key);const d=a-c;if(!Qt&&Math.abs(d)<=1&&c>=mp&&o.__first===i.__first&&(d!==0||!ce._cloneNotNeeded.has(o.__key))){const h=f.__lexicalTextContent,g=Zs.get(o.__key);if(!Qt&&typeof h=="string"&&g!==void 0){const m=(function(p,_){const y=_.size;if(y===0||y>=p.__size)return null;let x=p.__last,C=null,T=0;for(;x!==null&&T<y;){if(!_.has(x))return null;C=x;const b=Te.get(x);if(b===void 0)return null;x=b.__prev,T++}return T!==y||x!==null&&_.has(x)?null:C})(i,g);if(m!==null){const p=g.size;if(d===0){const _=fa(m,p);let y=m,x=0;for(;y!==null&&x<p;){const v=Te.get(y);if(v===void 0)break;const w=Rt();Gt(y,u),O(v)&&ke===null&&(ke=v.getFormat(),Ue=v.getStyle(),Ke=v.__key),ht(w),y=v.__next,x++}let C="";for(y=m,x=0;y!==null&&x<p;){const v=Te.get(y);if(v===void 0)break;let w;if(S(v)){const A=ce._keyToDOMMap.get(y),k=A&&A.__lexicalTextContent;typeof k!="string"&&$(352,v.getType()),w=k}else w=v.getTextContent();C+=w,x<p-1&&S(v)&&!v.isInline()&&(C+=On),y=v.__next,x++}const T=f.__lexicalSlotTextLength||0,b=T>0?h.slice(T):h,N=b.slice(0,b.length-_)+C;return f.__lexicalTextContent=N,Q=l+N,void ga(i,f,g)}if((function(_,y,x,C,T,b,N,v){if(v!==1&&v!==-1||N!==(v===1?2:1))return!1;const A=N-v;let k=_.__last;for(let ie=0;ie<A-1;ie++){if(k===null)return!1;const Me=Nt.get(k);if(Me===void 0)return!1;k=Me.__prev}if(k===null)return!1;const F=Te.get(b),L=Nt.get(k);if(F===void 0||L===void 0||F.__prev!==L.__prev)return!1;const B=[];let Y=b;for(let ie=0;ie<N;ie++){if(Y===null)return!1;B.push(Y);const Me=Te.get(Y);Y=Me?Me.__next:null}const oe=[];Y=k;for(let ie=0;ie<A;ie++){if(Y===null)return!1;oe.push(Y);const Me=Nt.get(Y);Y=Me?Me.__next:null}const ae=new Set(oe),le=new Set(B),K=[];let I=0,j=0;for(;I<A&&j<N;)if(B[j]===oe[I])K.push({key:B[j],kind:"reconcile"}),I++,j++;else if(le.has(oe[I])){if(ae.has(B[j]))return!1;K.push({key:B[j],kind:"create",nextIndex:j}),j++}else K.push({key:oe[I],kind:"destroy"}),I++;for(;I<A;)K.push({key:oe[I++],kind:"destroy"});for(;j<N;)K.push({key:B[j],kind:"create",nextIndex:j}),j++;const ue=fa(k,A);for(const ie of K){const Me=Rt();if(ie.kind==="reconcile")Gt(ie.key,x.element);else if(ie.kind==="destroy")fn(ie.key,x.element);else{let ft=null;for(let Qn=ie.nextIndex+1;Qn<N;Qn++){const Ur=ce._keyToDOMMap.get(B[Qn]);if(Ur!==void 0){ft=Ur;break}}dn(ie.key,x.withBefore(ft??x.before))}if(ie.kind!=="destroy"){const ft=Te.get(ie.key);ft&&O(ft)&&ke===null&&(ke=ft.getFormat(),Ue=ft.getStyle(),Ke=ft.__key)}ht(Me)}let re="";for(let ie=0;ie<N;ie++){const Me=Te.get(B[ie]);if(Me===void 0)return!1;let ft;if(S(Me)){const Qn=ce._keyToDOMMap.get(B[ie]),Ur=Qn&&Qn.__lexicalTextContent;typeof Ur!="string"&&$(350,Me.getType()),ft=Ur}else ft=Me.getTextContent();re+=ft,ie<N-1&&S(Me)&&!Me.isInline()&&(re+=On)}const Ae=C.__lexicalSlotTextLength||0,ut=Ae>0?T.slice(Ae):T;return C.__lexicalTextContent=ut.slice(0,ut.length-ue)+re,!0})(o,0,s,f,h,m,p,d)){const _=f.__lexicalTextContent;return typeof _!="string"&&$(353),Q=l+_,void ga(i,f,g)}}}if(d===0){let m=o.__first,p=0;for(;m!==null;){const _=Te.get(m);if(_===void 0)break;const y=Qt||ro.has(m)||no.has(m),x=Rt();if(y)Gt(m,u);else{let C,T;if(S(_)){T=Dn.get(m);const b=T&&T.__lexicalTextContent;typeof b!="string"&&$(354,_.getType()),C=b}else C=_.getTextContent();Q+=C,T!==void 0&&Gs(T)}O(_)?ke===null&&(ke=_.getFormat(),Ue=_.getStyle(),Ke=_.__key):S(_)&&p<a-1&&!_.isInline()&&(Q+=On),ht(x),m=_.__next,p++}return f.__lexicalTextContent=Q,f.__lexicalFirstTextKey=Ke,void(Q=l+Q)}}if(c===1&&a===1){const h=o.__first,g=i.__first;if(h===g)Gt(h,u);else{const p=ol(h),_=dn(g,null);try{p.parentNode===u?u.replaceChild(_,p):s.insertChild(_)}catch(y){if(typeof y=="object"&&y!=null){const x=`${y.toString()} Parent: ${u.tagName}, new child: {tag: ${_.tagName} key: ${g}}, old child: {tag: ${p.tagName}, key: ${h}}.`;throw new Error(x)}throw y}fn(h,null)}const m=Te.get(g);O(m)&&ke===null&&(ke=m.getFormat(),Ue=m.getStyle(),Ke=m.__key)}else{const h=Pi(o,Nt),g=Pi(i,Te);if(h.length!==c&&$(227),g.length!==a&&$(228),c===0)a!==0&&rl(g,i,0,a-1,s);else if(a===0){if(c!==0){const m=s.after==null&&s.before==null&<(i).size===0&&s.element.__lexicalLineBreak==null;el(h,0,c-1,m?null:u),m&&(u.textContent="")}}else(function(m,p,_,y,x,C){const T=y-1,b=x-1;let N,v,w=C.getFirstChild(),A=0,k=0;for(;A<=T&&k<=b;){const B=p[A],Y=_[k],oe=Rt();if(B===Y)w=vs(Gt(Y,C.element)),A++,k++;else{if(v===void 0&&(v=pa(_,k)),N===void 0)N=pa(p,A);else if(!N.has(B)){A++,ht(oe);continue}if(!v.has(B)){w=vs(ol(B)),fn(B,C.element),A++,N.delete(B),ht(oe);continue}if(N.has(Y)){const le=$r(ce,Y);le!==w&&C.withBefore(w??C.before).insertChild(le),w=vs(Gt(Y,C.element)),A++,k++}else dn(Y,C.withBefore(w??C.before)),k++}const ae=Te.get(Y);ae!==null&&O(ae)?ke===null&&(ke=ae.getFormat(),Ue=ae.getStyle(),Ke=ae.__key):S(ae)&&k<=b&&!ae.isInline()&&(Q+=On),ht(oe)}const F=A>T,L=k>b;if(F&&!L){const B=_[b+1],Y=B===void 0?null:ce.getElementByKey(B);rl(_,m,k,b,C.withBefore(Y??C.before))}else L&&!F&&el(p,A,T,C.element)})(i,h,g,c,a,s)}f.__lexicalTextContent=Q,f.__lexicalFirstTextKey=Ke,Q=l+Q})(n,e,St(e,t,ce)),Se(e)||(r=e,ke==null||ke===r.__textFormat||_i||r.setTextFormat(ke),(function(o){Ue==null||Ue===o.__textStyle||_i||o.setTextStyle(Ue)})(e))}function ga(n,e,t){const r=e.__lexicalFirstTextKey;if(r!=null){const o=n.__key;let i=r;for(;i!==null;){const s=Te.get(i);if(s===void 0){i=null;break}if(s.__parent===o)break;i=s.__parent}if(i!==null&&!t.has(i)){const s=Te.get(r);if(O(s))return ke=s.getFormat(),void(Ue=s.getStyle())}}e.__lexicalFirstTextKey=Ke}function Gt(n,e){const t=Nt.get(n);let r=Te.get(n);t!==void 0&&r!==void 0||$(61);const o=Qt||ro.has(n)||no.has(n),i=$r(ce,n);if(t===r&&!o){let s;if(S(t)){const l=i.__lexicalTextContent;typeof l!="string"&&$(355,t.getType()),s=l,Gs(i)}else s=t.getTextContent();return Q+=s,i}if(t!==r&&o&&yc(ho,fo,Vi,r,"updated"),Rn.$updateDOM(r,t,i,ce)){const s=dn(n,null);return e===null&&$(62),e.replaceChild(s,i),fn(n,null),s}if(S(t)){S(r)||$(334,n);const s=r.__indent;(Qt||s!==t.__indent)&&Kf(i,s);const l=r.__format;(Qt||l!==t.__format)&&zf(i,l);const c=o&&(lt(r).size>0||lt(t).size>0)?ha(t,r,i):"";if(o){const a=Q;if(yp(t,r,i),Ee(r)||r.isInline()||Uf(0,r,i),c!==""){const u=i.__lexicalTextContent||"";i.__lexicalTextContent=c+u,Q=a+c+u,i.__lexicalSlotTextLength=c.length}else(lt(r).size>0||lt(t).size>0)&&(i.__lexicalSlotTextLength=0)}else{const a=i.__lexicalTextContent;typeof a!="string"&&$(356,t.getType()),Q+=a,Gs(i)}if((Qt||r.__dir!==t.__dir||r.__parent!==t.__parent)&&(tl(i,r),Ee(r)&&!Qt))for(const a of r.getChildren())S(a)&&tl($r(ce,a.getKey()),a)}else{const s=r.getTextContent();if(G(r)){const l=r.decorate(ce,uo);l!==null&&Hf(n,l),o&&(lt(r).size>0||lt(t).size>0)&&ha(t,r,i)}Q+=s}if(!_i&&Ee(r)){const s=r.getLatest();if(s.__cachedText!==Q){const l=s.getWritable();l.__cachedText=Q,r=l}}return Rn.$decorateDOM(r,t,i,ce),Lf(r),i}function Hf(n,e){let t=ce._pendingDecorators;const r=ce._decorators;if(t===null){if(r[n]===e)return;t=Ud(ce)}t[n]=e}function vs(n){let e=n.nextSibling;return e!==null&&e===ce._blockCursorElement&&(e=e.nextSibling),e}function pa(n,e){const t=new Set;for(let r=e;r<n.length;r++)t.add(n[r]);return t}function xp(n,e,t,r,o,i){Q="",ke=null,Ue=null,Ke=null,Qt=r===2,ce=t,uo=t._config,Rn=t._config.dom||$i,fo=t._nodes,Vi=ce._listeners.mutation,no=o,ro=i,Nt=n._nodeMap,Qs=n,Te=e._nodeMap,_i=e._readOnly,Dn=Of(t._keyToDOMMap),Zs=(function(){const l=new Map,c=a=>{for(const u of a){const f=Te.get(u);if(f===void 0)continue;const d=f.__parent;if(d===null)continue;let h=l.get(d);h===void 0&&(h=new Set,l.set(d,h)),h.add(u)}};return c(no.keys()),c(ro),l})();const s=new Map;return ho=s,Gt("root",null),ce=void 0,fo=void 0,no=void 0,ro=void 0,Nt=void 0,Qs=void 0,Te=void 0,uo=void 0,Dn=void 0,Zs=void 0,ho=void 0,Rn=$i,s}function ol(n){const e=Dn.get(n);return e===void 0&&$(75,n),e}function z(n){return{type:n}}const Pt=z("SELECTION_CHANGE_COMMAND"),Jf=z("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Yi=z("CLICK_COMMAND"),qf=z("BEFORE_INPUT_COMMAND"),Vf=z("INPUT_COMMAND"),Yf=z("COMPOSITION_START_COMMAND"),Xf=z("COMPOSITION_END_COMMAND"),hn=z("DELETE_CHARACTER_COMMAND"),gr=z("INSERT_LINE_BREAK_COMMAND"),Pn=z("INSERT_PARAGRAPH_COMMAND"),Mn=z("CONTROLLED_TEXT_INSERTION_COMMAND"),Lr=z("PASTE_COMMAND"),oi=z("REMOVE_TEXT_COMMAND"),Tr=z("DELETE_WORD_COMMAND"),Nr=z("DELETE_LINE_COMMAND"),kt=z("FORMAT_TEXT_COMMAND"),Cp=z("SET_TEXT_FORMAT_COMMAND"),Xi=z("UNDO_COMMAND"),Gi=z("REDO_COMMAND"),Xl=z("KEYDOWN_COMMAND"),Gl=z("KEY_ARROW_RIGHT_COMMAND"),Gf=z("MOVE_TO_END"),Ql=z("KEY_ARROW_LEFT_COMMAND"),Qf=z("MOVE_TO_START"),Zl=z("KEY_ARROW_UP_COMMAND"),ec=z("KEY_ARROW_DOWN_COMMAND"),yi=z("KEY_ENTER_COMMAND"),Zf=z("KEY_SPACE_COMMAND"),Qi=z("KEY_BACKSPACE_COMMAND"),tc=z("KEY_ESCAPE_COMMAND"),nc=z("KEY_DELETE_COMMAND"),rc=z("KEY_TAB_COMMAND"),Sp=z("INSERT_TAB_COMMAND"),bp=z("INDENT_CONTENT_COMMAND"),ma=z("OUTDENT_CONTENT_COMMAND"),ed=z("DROP_COMMAND"),td=z("FORMAT_ELEMENT_COMMAND"),nd=z("DRAGSTART_COMMAND"),rd=z("DRAGOVER_COMMAND"),vp=z("DRAGEND_COMMAND"),Oo=z("COPY_COMMAND"),Zi=z("CUT_COMMAND"),oc=z("SELECT_ALL_COMMAND"),Tp=z("CLEAR_EDITOR_COMMAND"),Np=z("CLEAR_HISTORY_COMMAND"),Gr=z("CAN_REDO_COMMAND"),Qr=z("CAN_UNDO_COMMAND"),od=z("FOCUS_COMMAND"),kp=z("BLUR_COMMAND"),wp=z("KEY_MODIFIER_COMMAND");function Ep(n){const e=new Map;return{dispose(){for(const t of e.values())t.dispose();e.clear()},register(t,r){let o=e.get(t);o===void 0&&(o={dispose:n(t,r),holders:new Set},e.set(t,o));const i=()=>{const s=e.get(t);s&&s.holders.delete(i)&&s.holders.size===0&&(e.delete(t),s.dispose())};return o.holders.add(i),i}}}function oo(n,e,t,r){return n.addEventListener(e,t,r),n.removeEventListener.bind(n,e,t,r)}const Vt=Object.freeze({}),il=[["keydown",function(n,e){const t=e._inputState;t.lastKeyDownTimeStamp=n.timeStamp,t.lastKeyCode=n.key,n.key!=="Backspace"&&go(t),!e.isComposing()&&D(e,Xl,n)}],["pointerdown",function(n,e){const t=Ln(n),r=n.pointerType;At(t)&&r!=="touch"&&r!=="pen"&&n.button===0&&_t(e,()=>{Ri(t,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(n,e){D(e,Yf,n)}],["compositionend",function(n,e){const t=e._inputState;Ot?t.compositionPhase="ending-firefox":mn||!ko&&!wo?D(e,Xf,n):(t.compositionPhase="ending-safari",t.compositionEndData=n.data)}],["input",function(n,e){n.stopPropagation();const t=e._inputState;go(t),_t(e,()=>{cd(n,e)||e.dispatchCommand(Vf,n)},{event:n}),t.unprocessedBeforeInputData=null}],["click",function(n,e){_t(e,()=>{const t=M(),r=De(it(e)),o=ct();if(r){if(E(t)){const i=t.anchor,s=i.getNode();i.type==="element"&&i.offset===0&&t.isCollapsed()&&!Ee(s)&&me().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&o!==null&&t.is(o)&&(r.removeAllRanges(),t.dirty=!0)}else if(n.pointerType==="touch"||n.pointerType==="pen"){const i=rt(r,e._rootElement).anchorNode;(W(i)||ot(i))&&pe(mo(o,r,e,n))}}if(Ot&&r!==null&&r.rangeCount===0){const i=e._rootElement;if(i!==null&&n.target===i){const s=n.clientY;let l=i.childNodes.length;for(let a=0;a<i.childNodes.length;a++){const u=i.childNodes[a];if(W(u)){const f=u.getBoundingClientRect();if(s<=(f.top+f.bottom)/2){l=a;break}}}r.setBaseAndExtent(i,l,i,l);const c=mo(o,r,e,n);c!==null?pe(c):r.removeAllRanges()}}D(e,Yi,n)})}],["cut",Vt],["copy",Vt],["dragstart",Vt],["dragover",Vt],["dragend",Vt],["paste",Vt],["focus",Vt],["blur",Vt],["drop",Vt]];vr&&il.push(["beforeinput",(n,e)=>(function(t,r){const o=t.inputType;o==="deleteCompositionText"||Ot&&Vd(r)||o!=="insertCompositionText"&&_t(r,()=>{cd(t,r)||D(r,qf,t)},{event:t})})(n,e)]);const sl=new WeakMap,xi=new WeakMap,$p=Ep(n=>(n.addEventListener("selectionchange",Sa),()=>n.removeEventListener("selectionchange",Sa)));function id(n,e,t,r,o,i){const s=n.anchor,l=n.focus,c=s.getNode(),a=fe();let u;if(i!==void 0)u=i;else{const m=De(it(a));u=m!==null?rt(m,a._rootElement):null}const f=u!==null?u.anchorNode:null,d=s.key,h=a.getElementByKey(d),g=t.length;return d!==l.key||!O(c)||(!o&&(!vr||a._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||c.isDirty()&&g<2||Hd(t))&&s.offset!==l.offset&&!c.isComposing()||yt(c)||c.isDirty()&&g>1||(o||!vr)&&h!==null&&!c.isComposing()&&f!==pn(c,h,a)||u!==null&&e!==null&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||!c.isComposing()&&(c.getFormat()!==n.format||c.getStyle()!==n.style)||(function(m,p){if(p.isSegmented())return!0;if(!m.isCollapsed())return!1;const _=m.anchor.offset,y=p.getParentOrThrow(),x=Oi(p);return _===0?!p.canInsertTextBefore()||!y.canInsertTextBefore()&&!p.isComposing()||x||(function(C){const T=C.getPreviousSibling();return(O(T)||S(T)&&T.isInline())&&!T.canInsertTextAfter()})(p):_===p.getTextContentSize()&&(!p.canInsertTextAfter()||!y.canInsertTextAfter()&&!p.isComposing()||x)})(n,c)}function _a(n,e){return ot(n)&&n.nodeValue!==null&&e!==0&&e!==n.nodeValue.length}function ya(n,e,t){const{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=rt(n,e._rootElement),l=e._inputState;l.isSelectionChangeFromDOMUpdate&&(l.isSelectionChangeFromDOMUpdate=!1,_a(r,o)&&_a(i,s)&&!l.postDeleteSelectionToRestore)||_t(e,()=>{if(!t)return void pe(null);if(!Fo(e,r,i))return;let c=M();if(l.postDeleteSelectionToRestore&&E(c)&&c.isCollapsed()){const a=c.anchor,u=l.postDeleteSelectionToRestore.anchor;(a.key===u.key&&a.offset===u.offset+1||a.offset===1&&u.getNode().is(a.getNode().getPreviousSibling()))&&(c=l.postDeleteSelectionToRestore.clone(),pe(c))}if(l.postDeleteSelectionToRestore=null,E(c)){const a=c.anchor,u=a.getNode();if(c.isCollapsed()){n.type==="Range"&&r===i&&(c.dirty=!0);const f=it(e).event,d=f?f.timeStamp:performance.now(),{format:h,style:g,offset:m,key:p,timeStamp:_}=l.collapsedSelectionFormat,y=me(),x=e.isComposing()===!1&&y.getTextContent()==="";if(d<_+200&&a.offset===m&&a.key===p)ii(c,h,g);else if(a.type==="text")O(u)||$(141),sd(c,u);else if(a.type==="element"&&!x){S(u)||$(259);const C=a.getNode();C.isEmpty()?(function(T,b){const N=b.getTextFormat(),v=b.getTextStyle();ii(T,N,v)})(c,C):ii(c,c.format,"")}}else{const f=a.key,d=c.focus.key,h=c.getNodes(),g=h.length,m=c.isBackward(),p=m?s:o,_=m?o:s,y=m?d:f,x=m?f:d;let C=2047,T=!1;for(let b=0;b<g;b++){const N=h[b],v=N.getTextContentSize();if(O(N)&&v!==0&&!(b===0&&N.__key===y&&p===v||b===g-1&&N.__key===x&&_===0)&&(T=!0,C&=N.getFormat(),C===0))break}c.format=T?C:0}}D(e,Pt)})}function ii(n,e,t){n.format===e&&n.style===t||(n.format=e,n.style=t,n.dirty=!0)}function sd(n,e){ii(n,e.getFormat(),e.getStyle())}function ld(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function xa(n){const{lastKeyCode:e}=fe()._inputState;if(n==null||n.length<=1||e==null)return;const t=e.length===1?e:e==="Enter"?`
|
|
4
|
+
`:e==="Tab"?" ":null;if(!t)return;const r=M();if(!E(r)||!r.isCollapsed())return;const o=r.anchor.getNode();if(!O(o))return;const{offset:i}=r.anchor;if(o.getTextContentSize()===i){const s=o.getNextSibling();if(t===`
|
|
5
|
+
`){if(Le(s))s.selectEnd();else if(!s){const l=U(o,wr),c=l&&l.getNextSibling();S(c)&&c.selectStart()}}else t===" "?kr(s)&&s.selectEnd():O(s)&&s.getTextContent()[0]===t&&s.select(1,1)}else o.getTextContent()[i]===t&&o.select(i+1,i+1)}function go(n){n.isInsertTextAfterHandledSelectionCommand=!1,n.handledSelectionCommandTimeoutId!==null&&(clearTimeout(n.handledSelectionCommandTimeoutId),n.handledSelectionCommandTimeoutId=null)}function Ca(n){go(n),n.isInsertTextAfterHandledSelectionCommand=!0,n.handledSelectionCommandTimeoutId=setTimeout(()=>go(n),0)}function cd(n,e){const t=Ln(n);if(W(t)&&Ri(t,e))return!0;const r=e.getRootElement();if(r===null)return!1;const o=Mr(r.ownerDocument);return o!==null&&r.contains(o)&&Ri(o,e)}function Op(n){const e=n.inputType,t=ld(n),r=fe(),o=r._inputState,i=M();if(e==="insertText"&&n.data&&o.isInsertTextAfterHandledSelectionCommand){if(go(o),n.preventDefault(),E(i)&&!i.isCollapsed()){const f=i.isBackward()?i.anchor:i.focus;i.anchor.set(f.key,f.offset,f.type),i.focus.set(f.key,f.offset,f.type)}return!0}if(e==="deleteContentBackward"){if(i===null){const f=ct();if(!E(f))return!0;pe(f.clone())}if(E(i)){const f=i.anchor.key===i.focus.key;if((function(d,h){return d.lastKeyCode==="MediaLast"&&h<d.lastKeyDownTimeStamp+30})(o,n.timeStamp)&&r.isComposing()&&f){if(Pe(null),o.lastKeyDownTimeStamp=0,setTimeout(()=>{_t(r,()=>{Pe(null)})},30),E(i)){const d=i.anchor.getNode();d.markDirty(),O(d)||$(142),sd(i,d)}}else{if(Pe(null),mn&&t!==null&&!t.collapsed&&(i.applyDOMRange(t),!i.isCollapsed()))return n.preventDefault(),i.removeText(),!0;n.preventDefault();const d=i.anchor.getNode(),h=d.getTextContent(),g=d.canInsertTextAfter(),m=i.anchor.offset===0&&i.focus.offset===h.length;let p=gi&&f&&!m&&g;if(p&&i.isCollapsed()&&(p=!G(gm(i.anchor,!0))),!p){D(r,hn,!0);const _=M();gi&&E(_)&&_.isCollapsed()&&(o.postDeleteSelectionToRestore=_,setTimeout(()=>o.postDeleteSelectionToRestore=null))}}return!0}}if(!E(i))return!0;const s=n.data;o.unprocessedBeforeInputData!==null&&mc(!1,r,o.unprocessedBeforeInputData),i.dirty&&o.unprocessedBeforeInputData===null||!i.isCollapsed()||Ee(i.anchor.getNode())||t===null||i.applyDOMRange(t),o.unprocessedBeforeInputData=null;const l=i.anchor,c=i.focus,a=l.getNode(),u=c.getNode();if(e==="insertText"||e==="insertTranspose"){if(s===`
|
|
6
|
+
`)n.preventDefault(),D(r,gr,!1);else if(s===On)n.preventDefault(),D(r,Pn);else if(s==null&&n.dataTransfer){const f=n.dataTransfer.getData("text/plain");n.preventDefault(),i.insertRawText(f)}else s!=null&&id(i,t,s,n.timeStamp,!0)?(n.preventDefault(),D(r,Mn,s),xa(s)):o.unprocessedBeforeInputData=s;return o.lastBeforeInputInsertTextTimeStamp=n.timeStamp,!0}switch(n.preventDefault(),e){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":D(r,Mn,n),xa((n.dataTransfer?n.dataTransfer.getData("text/plain"):null)??n.data);break;case"insertFromComposition":{const f=o.hadOrphanedCompositionEvents;o.hadOrphanedCompositionEvents=!1;const d=r._compositionKey;Pe(null),f||D(r,Mn,n),si(d);break}case"insertLineBreak":Pe(null),D(r,gr,!1);break;case"insertParagraph":Pe(null),o.isInsertLineBreak&&!mn?(o.isInsertLineBreak=!1,D(r,gr,!1)):D(r,Pn);break;case"insertFromPaste":case"insertFromPasteAsQuotation":D(r,Lr,n);break;case"deleteByComposition":(function(f,d){return f!==d||S(f)||S(d)||!Oi(f)||!Oi(d)})(a,u)&&D(r,oi,n);break;case"deleteByDrag":Or(al),D(r,oi,n);break;case"deleteByCut":D(r,oi,n);break;case"deleteContent":D(r,hn,!1);break;case"deleteWordBackward":D(r,Tr,!0);break;case"deleteWordForward":D(r,Tr,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":D(r,Nr,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":D(r,Nr,!1);break;case"formatStrikeThrough":D(r,kt,"strikethrough");break;case"formatBold":D(r,kt,"bold");break;case"formatItalic":D(r,kt,"italic");break;case"formatUnderline":D(r,kt,"underline");break;case"historyUndo":D(r,Xi);break;case"historyRedo":D(r,Gi)}return!0}function Ap(n){const e=fe(),t=e._inputState,r=M(),o=n.data,i=ld(n);let s=!1;if(o!=null&&E(r)){const l=De(it(e)),c=l!==null?rt(l,e._rootElement):null,a=n.inputType==="insertCompositionText"&&t.compositionPhase!=="ending-firefox"&&!e.isComposing();a&&(t.hadOrphanedCompositionEvents=!0);const u=r.anchor.getNode(),f=n.inputType==="insertCompositionText"&&t.compositionPhase!=="ending-firefox"&&e.isComposing()&&O(u)&&yt(u);if(!a&&!f&&id(r,i,o,n.timeStamp,!1,c)){if(s=!0,t.compositionPhase==="ending-firefox"){const _=Ci(e,o);if(t.compositionPhase="idle",_)return Or(bi),Va(),!0}const d=r.anchor.getNode();if(l===null||c===null)return!0;const h=r.isBackward(),g=h?r.anchor.offset:r.focus.offset,m=h?r.focus.offset:r.anchor.offset;vr&&!r.isCollapsed()&&O(d)&&c.anchorNode!==null&&d.getTextContent().slice(0,g)+o+d.getTextContent().slice(g+m)===qd(c.anchorNode)||D(e,Mn,o);const p=o.length;Ot&&p>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(r.anchor.offset-=p,r._cachedNodes=null,r._cachedIsBackward=null),gi&&e.isComposing()&&(t.lastKeyDownTimeStamp=0,Pe(null))}}return s||(mc(!1,e,o!==null?o:void 0),t.compositionPhase==="ending-firefox"&&(Ci(e,o||void 0),Or(bi),t.compositionPhase="idle")),Va(),!0}function Mp(n){const e=fe(),t=e._inputState,r=M();if(E(r)&&!e.isComposing()){t.compositionPhase="composing",t.hadOrphanedCompositionEvents=!1;const o=r.anchor,i=r.anchor.getNode();if(Pe(o.key),Or(gd),n.timeStamp<t.lastKeyDownTimeStamp+30||o.type==="element"||!r.isCollapsed()||!gi&&(i.getFormat()!==r.format||O(i)&&i.getStyle()!==r.style)||O(i)&&(yt(i)||o.offset===0&&!i.canInsertTextBefore()||o.offset===i.getTextContentSize()&&!i.canInsertTextAfter())){D(e,Mn,Vl);const s=M();E(s)&&Pe(s.anchor.key)}}return!0}function Fp(n){const e=fe();return e._inputState.compositionPhase="idle",Ci(e,n.data),Or(bi),!0}function si(n){if(n===null)return;const e=te(n);if(!O(e)||e.getType()==="text"||yt(e)||!e.isAttached())return;const t=M(),r=E(t)&&t.anchor.key===n?t.anchor.offset:null,o=Ne(e.getTextContent());if(o.setFormat(e.getFormat()),o.setStyle(e.getStyle()),e.replace(o),r!==null){const i=Math.min(r,o.getTextContentSize());o.select(i,i)}}function Ci(n,e){const t=n._compositionKey;if(Pe(null),t!==null&&e!=null){if(e===""){const o=te(t),i=n.getElementByKey(t),s=i!==null&&O(o)?pn(o,i,n):null;if(s!==null&&s.nodeValue!==null&&O(o)){const l=De(it(n)),c=l&&rt(l,n._rootElement);let a=null,u=null;c!==null&&c.anchorNode===s&&(a=c.anchorOffset,u=c.focusOffset),_c(o,s.nodeValue,a,u,!0)}return si(t),!1}if(e[e.length-1]===`
|
|
7
|
+
`){const o=M();if(E(o)||de(o)){if(E(o)){const i=o.focus;o.anchor.set(i.key,i.offset,i.type)}return D(n,yi,null),si(t),!1}}const r=te(t);if(r!==null&&O(r)&&yt(r)){r.markDirty();const o=M(),i=r.getTextContentSize(),s=E(o)&&o.anchor.key===t?o.anchor.offset:i;return r.select(s,s).insertText(e),!0}}return mc(!0,n,e),si(t),!1}function Dp(n){const e=fe(),t=e._inputState;if(n.key==null)return!0;if(t.compositionPhase==="ending-safari"){const r=Xa(n);if(r&&_t(e,()=>{Ci(e,t.compositionEndData)}),t.compositionPhase="idle",t.compositionEndData="",r)return!0}if((function(r){return _e(r,"ArrowRight",{shiftKey:"any"})})(n))D(e,Gl,n);else if((function(r){return _e(r,"ArrowRight",{...Xt,shiftKey:"any"})})(n))D(e,Gf,n);else if((function(r){return _e(r,"ArrowLeft",{shiftKey:"any"})})(n))D(e,Ql,n);else if((function(r){return _e(r,"ArrowLeft",{...Xt,shiftKey:"any"})})(n))D(e,Qf,n);else if((function(r){return _e(r,"ArrowUp",{altKey:"any",shiftKey:"any"})})(n))D(e,Zl,n);else if((function(r){return _e(r,"ArrowDown",{altKey:"any",shiftKey:"any"})})(n))D(e,ec,n);else if((function(r){return _e(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(n))t.isInsertLineBreak=!0,D(e,yi,n);else if((function(r){return r.key===" "})(n))D(e,Zf,n);else if((function(r){return Tt&&_e(r,"o",{ctrlKey:!0})})(n))n.preventDefault(),t.isInsertLineBreak=!0,D(e,gr,!0);else if((function(r){return _e(r,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(n))t.isInsertLineBreak=!1,D(e,yi,n);else if((function(r){return _e(r,"Backspace",{shiftKey:"any"})||Tt&&_e(r,"h",{ctrlKey:!0})})(n))Xa(n)?D(e,Qi,n)&&Ca(t):(n.preventDefault(),D(e,hn,!0));else if((function(r){return r.key==="Escape"})(n))D(e,tc,n);else if((function(r){return _e(r,"Delete",{})||Tt&&_e(r,"d",{ctrlKey:!0})})(n))(function(r){return r.key==="Delete"})(n)?D(e,nc,n):(n.preventDefault(),D(e,hn,!1));else if((function(r){return _e(r,"Backspace",Ya)})(n))n.preventDefault(),D(e,Tr,!0);else if((function(r){return _e(r,"Delete",Ya)})(n))n.preventDefault(),D(e,Tr,!1);else if((function(r){return Tt&&_e(r,"Backspace",{metaKey:!0})})(n))n.preventDefault(),D(e,Nr,!0);else if((function(r){return Tt&&(_e(r,"Delete",{metaKey:!0})||_e(r,"k",{ctrlKey:!0}))})(n))n.preventDefault(),D(e,Nr,!1);else if((function(r){return _e(r,"b",Xt)})(n))n.preventDefault(),D(e,kt,"bold");else if((function(r){return _e(r,"u",Xt)})(n))n.preventDefault(),D(e,kt,"underline");else if((function(r){return _e(r,"i",Xt)})(n))n.preventDefault(),D(e,kt,"italic");else if((function(r){return _e(r,"Tab",{shiftKey:"any"})})(n))D(e,rc,n);else if((function(r){return _e(r,"z",Xt)})(n))n.preventDefault(),D(e,Xi);else if((function(r){return Tt?_e(r,"z",{metaKey:!0,shiftKey:!0}):_e(r,"y",{ctrlKey:!0})||_e(r,"z",{ctrlKey:!0,shiftKey:!0})})(n))n.preventDefault(),D(e,Gi);else{const r=e._editorState._selection;(function(o){return _e(o,"a",Xt)})(n)?(n.preventDefault(),D(e,oc,n)&&Ca(t)):r===null||E(r)||((function(o){return _e(o,"c",Xt)})(n)?(n.preventDefault(),D(e,Oo,n)):(function(o){return _e(o,"x",Xt)})(n)&&(n.preventDefault(),D(e,Zi,n)))}return(function(r){return r.ctrlKey||r.shiftKey||r.altKey||r.metaKey})(n)&&e.dispatchCommand(wp,n),!0}function ad(n){let e=n.__lexicalEventHandles;return e===void 0&&(e=[],n.__lexicalEventHandles=e),e}const pr=new Map;function Sa(n){const e=mm(n.target);if(e===null)return;const t=xc(n.target);let r=null,o=null;const i=t!==null?xi.get(t):void 0;if(t!==null){if(i!==void 0){const f=i.editors;let d=i.hasShadowEditor;if(d===void 0){d=!1;for(const h of f)if(h._rootElement!==null&&Ut(h._rootElement.getRootNode())){d=!0;break}i.hasShadowEditor=d}if(d){let h=null,g=null;for(const m of f){const p=m._rootElement;if(p===null)continue;const _=rt(e,p).anchorNode;if(_!==null&&_r(_)===m){if(Ut(p.getRootNode())){r=m,o=_;break}h===null&&(h=m,g=_)}}r===null&&h!==null&&(r=h,o=g)}else{const h=e.anchorNode;h===null||W(h)&&h.shadowRoot!==null||(r=_r(h),r!==null&&(o=h))}}if(r===null){const f=Mr(t);r=f!==null?_r(f):null}}if(r===null)return;if(r._inputState.isSelectionChangeFromMouseDown){if(i!==void 0)for(const f of i.editors)f._inputState.isSelectionChangeFromMouseDown=!1;_t(r,()=>{const f=ct(),d=o??rt(e,r._rootElement).anchorNode;(W(d)||ot(d))&&pe(mo(f,e,r,n))})}const s=pc(r),l=s[s.length-1],c=l._key,a=pr.get(c),u=a||l;u!==r&&ya(e,u,!1),ya(e,r,!0),r!==l?pr.set(c,r):a&&pr.delete(c)}function ba(n){n._lexicalHandled=!0}function va(n){return n._lexicalHandled===!0}function Rp(n){const e=sl.get(n);if(e===void 0)return;const t=xi.get(e);if(t===void 0)return;sl.delete(n);const r=Kr(n);Do(r)?((function(i){if(i._parentEditor!==null){const s=pc(i),l=s[s.length-1]._key;pr.get(l)===i&&pr.delete(l)}else pr.delete(i._key)})(r),t.editors.delete(r),t.hasShadowEditor=void 0,n.__lexicalEditor=null):r&&$(198);const o=ad(n);for(let i=0;i<o.length;i++)o[i]();n.__lexicalEventHandles=[]}function ll(n,e,t){Re();const r=n.__key,o=n.getParent();if(o===null)return void(We(n)!==null&&$(367,r,String(We(n))));const i=(function(l){const c=M();if(!E(c)||!S(l))return c;const{anchor:a,focus:u}=c,f=a.getNode(),d=u.getNode();return Ar(f,l)&&a.set(l.__key,0,"element"),Ar(d,l)&&u.set(l.__key,0,"element"),c})(n);let s=!1;if(E(i)&&e){const l=i.anchor,c=i.focus;l.key===r&&(Ti(l,n,o,n.getPreviousSibling(),n.getNextSibling()),s=!0),c.key===r&&(Ti(c,n,o,n.getPreviousSibling(),n.getNextSibling()),s=!0)}else de(i)&&e&&n.isSelected()&&n.selectPrevious();if(E(i)&&e&&!s){const l=n.getIndexWithinParent();It(n),En(i,o,l,-1)}else It(n);t||Se(o)||o.canBeEmpty()||!o.isEmpty()||ll(o,e),e&&i&&Ee(o)&&o.isEmpty()&&o.selectEnd()}const ud=Symbol.for("ephemeral");function Si(n){return n[ud]||!1}const Ta={configurable:!0,enumerable:!1,value:void 0,writable:!0};let Ze=class{__type;__key;__parent;__prev;__next;__state;[ao];static getType(){const{ownNodeType:e}=bc(this);return e===void 0&&$(64,this.name),e}static clone(e){$(65,this.name)}$config(){return{}}config(e,t){const r=t.extends||ih(this.constructor);return Object.assign(t,{extends:r}),typeof e=="string"&&Object.assign(t,{type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&(this.__state=this.__state.getWritable(this).resetOnCopyNode())}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",Ta),Object.defineProperty(this,ao,Ta),Bd(this,e)}getType(){return this.__type}isInline(){$(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=te(e);if(t===null)break;e=t.__parent!==null?t.__parent:We(t)}return!1}isSelected(e){const t=e||M();if(t==null)return!1;const r=t.getNodes().some(o=>o.__key===this.__key);if(O(this))return r;if(E(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const o=this.getParent();if(G(this)&&this.isInline()&&o){const i=t.isBackward()?t.focus:t.anchor;if(o.is(i.getNode())&&i.offset===o.getChildrenSize()&&this.is(o.getLastChild()))return!1}}return r}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),r=0;for(;t!==null;){if(this.is(t))return r;r++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return e===null?null:te(e)}getParentOrThrow(){const e=this.getParent();return e===null&&$(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(Se(t)||We(e)!==null)return S(e)||e===this&&G(e)||$(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&$(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:te(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(t===null)return e;let r=t.getFirstChild();for(;r!==null&&!r.is(this);)e.push(r),r=r.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return e===null?null:te(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=S(this)?this:this.getParent(),r=S(e)?e:e.getParent(),o=t&&r?yl(t,r):null;return o?o.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){const t=yl(this,e);return t!==null&&(t.type==="descendant"||(t.type==="branch"?uh(t)===-1:(t.type!=="same"&&t.type!=="ancestor"&&$(279),!1)))}isParentOf(e){return Ar(e,this)}getNodesBetween(e){const t=this.isBefore(e),r=[],o=new Set;let i=this;for(;i!==null;){const s=i.__key;if(o.has(s)||(o.add(s),r.push(i)),i===e)break;const l=S(i)?t?i.getFirstChild():i.getLastChild():null;if(l!==null){i=l;continue}const c=t?i.getNextSibling():i.getPreviousSibling();if(c!==null){i=c;continue}const a=i.getParentOrThrow();if(o.has(a.__key)||r.push(a),a===e)break;let u=null,f=a;do{if(f===null&&$(68),u=t?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),f===null)break;u!==null||o.has(f.__key)||r.push(f)}while(u===null);i=u}return t||r.reverse(),r}isDirty(){const e=fe()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(Si(this))return this;const e=te(this.__key);return e===null&&$(113),e}getWritable(){if(Si(this))return this;Re();const e=cn(),t=fe(),r=e._nodeMap,o=this.__key,i=this.getLatest(),s=t._cloneNotNeeded,l=M();if(l!==null&&l.setCachedNodes(null),s.has(o))return Ai(i),i;const c=nh(i);return s.add(o),Ai(c),r.set(o,c),c}getTextContent(){return lh(this)}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){$(70)}updateDOM(e,t,r){$(71)}getDOMSlot(e){return new kf(e)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){const e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){$(18,this.name)}updateFromJSON(e){return(function(t,r){const o=t.getWritable(),i=r.$;let s=i;for(const l of If(o).flatKeys)l in r&&(s!==void 0&&s!==i||(s={...i}),s[l]=r[l]);return(o.__state||s)&&Pf(t).updateFromJSON(s),o})(this,e)}static transform(){return null}remove(e){ll(this,!0,e)}replace(e,t){Re();let r=M();r!==null&&(r=r.clone()),Ms(this,e);const o=this.getLatest(),i=this.__key,s=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size,u=l.getParent(),f=u!==null?l.getIndexWithinParent():-1;It(l),u!==null&&E(r)&&En(r,u,f,-1);const d=o.getPreviousSibling(),h=o.getNextSibling(),g=o.__prev,m=o.__next,p=o.__parent;ll(o,!1,!0),d===null?c.__first=s:d.getWritable().__next=s,l.__prev=g,h===null?c.__last=s:h.getWritable().__prev=s,l.__next=m,l.__parent=p,c.__size=a;let _=0;t&&(S(this)&&S(l)||$(139),_=l.getChildrenSize(),l.splice(_,0,this.getChildren()));const y=xt(this);if(y.length>0){tn(this)&&tn(l)||$(368,this.__key,l.__key);for(const x of y){const C=zn(this,x);C!==null&&(Fm(this,x),ch(l,x,C))}}if(E(r)){pe(r);const x=r.anchor,C=r.focus;x.key===i&&(t&&x.type==="element"?x.set(l.__key,_+x.offset,"element"):Ea(x,l)),C.key===i&&(t&&C.type==="element"?C.set(l.__key,_+C.offset,"element"):Ea(C,l))}return Lt()===i&&Pe(s),l}insertAfter(e,t=!0){Re(),Ms(this,e);const r=this.getWritable(),o=e.getWritable();this.getParentOrThrow();const i=o.getParent(),s=M();let l=!1,c=!1;if(i!==null){const h=e.getIndexWithinParent();if(E(s)){const g=i.__key,m=s.anchor,p=s.focus;l=m.type==="element"&&m.key===g&&m.offset===h+1,c=p.type==="element"&&p.key===g&&p.offset===h+1}It(o),t&&E(s)&&En(s,i,h,-1)}else It(o);const a=this.getNextSibling(),u=this.getParentOrThrow().getWritable(),f=o.__key,d=r.__next;if(a===null?u.__last=f:a.getWritable().__prev=f,u.__size++,r.__next=f,o.__next=d,o.__prev=r.__key,o.__parent=r.__parent,t&&E(s)){const h=this.getIndexWithinParent();En(s,u,h+1);const g=u.__key;l&&s.anchor.set(g,h+2,"element"),c&&s.focus.set(g,h+2,"element")}return e}insertBefore(e,t=!0){Re(),Ms(this,e);const r=this.getWritable(),o=e.getWritable();this.getParentOrThrow();const i=o.__key,s=M(),l=o.getParent(),c=l!==null?o.getIndexWithinParent():-1;It(o),l!==null&&t&&E(s)&&En(s,l,c,-1);const a=this.getPreviousSibling(),u=this.getParentOrThrow().getWritable(),f=r.__prev,d=this.getIndexWithinParent();return a===null?u.__first=i:a.getWritable().__next=i,u.__size++,r.__prev=i,o.__prev=f,o.__next=r.__key,o.__parent=r.__parent,t&&E(s)&&En(s,this.getParentOrThrow(),d),e}isParentRequired(){return!1}createParentElementNode(){return V()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Re();const r=mt(this);if(r!==null)return r.selectPrevious(e,t);const o=this.getPreviousSibling(),i=this.getParentOrThrow();if(o===null)return i.select(0,0);if(S(o))return o.select();if(!O(o)){const s=o.getIndexWithinParent()+1;return i.select(s,s)}return o.select(e,t)}selectNext(e,t){Re();const r=mt(this);if(r!==null)return r.selectNext(e,t);const o=this.getNextSibling(),i=this.getParentOrThrow();if(o===null)return i.select();if(S(o))return o.select(0,0);if(!O(o)){const s=o.getIndexWithinParent();return i.select(s,s)}return o.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}};function fd(n){return n instanceof Ze}const cl="historic",Pp="history-push",mr="history-merge",dd="paste",hd="cut",Ip="collaboration",Lp="skip-scroll-into-view",Kp="skip-dom-selection",al="skip-selection-focus",gd="composition-start",bi="composition-end",zp="!important";function vi(n){const e={};if(!n)return e;let t="",r="",o=null,i=!1,s=!1,l=!1,c=0;const a=n.length;let u=-1;for(let h=0;h<a;h++){const g=n[h];if(i)g==="*"&&n[h+1]==="/"&&(i=!1,h++);else if(s)u===-1&&(u=h),s=!1;else if(o===null)if(g!=="/"||n[h+1]!=="*")if(g!=='"'&&g!=="'")if(g!=="(")if(g!==")")if(l||g!==":"||c!==0){if(g===";"&&c===0){u!==-1&&(l?r+=n.slice(u,h):t+=n.slice(u,h),u=-1);const m=t.trim(),p=r.trim();m!==""&&p!==""&&(e[m]=p),t="",r="",l=!1;continue}u===-1&&(u=h)}else u!==-1&&(t+=n.slice(u,h),u=-1),l=!0;else u===-1&&(u=h),c=Math.max(0,c-1);else u===-1&&(u=h),c++;else u===-1&&(u=h),o=g;else u!==-1&&(l?r+=n.slice(u,h):t+=n.slice(u,h),u=-1),i=!0,h++;else u===-1&&(u=h),g==="\\"?s=!0:g===o&&(o=null)}u!==-1&&(l?r+=n.slice(u,a):t+=n.slice(u,a));const f=t.trim(),d=r.trim();return f!==""&&d!==""&&(e[f]=d),e}function Bp(n,e,t){const r=t.trimEnd(),o=r.length-10;o>=0&&r.slice(o).toLowerCase()===zp?n.setProperty(e,r.slice(0,o).trim(),"important"):n.setProperty(e,t,"")}function gn(n,e,t=""){if(e===t)return;const r=vi(t),o=vi(e);for(const i in o)delete r[i],Bp(n,i,o[i]);for(const i in r)n.removeProperty(i)}function Ts(n,e){return 16&e?"code":e&ql?"mark":32&e?"sub":64&e?"sup":null}function Ns(n,e){return 1&e?"strong":2&e?"em":"span"}function pd(n,e,t,r,o){const i=r.classList;let s=yr(o,"base");s!==void 0&&i.add(...s),s=yr(o,"underlineStrikethrough");let l=!1;const c=8&e&&4&e;s!==void 0&&(8&t&&4&t?(l=!0,c||i.add(...s)):c&&i.remove(...s));for(const a in rn){const u=rn[a];if(s=yr(o,a),s!==void 0)if(t&u){if(l&&(a==="underline"||a==="strikethrough")){e&u&&i.remove(...s);continue}((e&u)===0||c&&a==="underline"||a==="strikethrough")&&i.add(...s)}else e&u&&i.remove(...s)}}function md(n,e,t){const r=t.isComposing(),o=n+(r?co:""),i=be(),s=ls(i).$getDOMSlot(t,e,i),l=s.getFirstChild();if(l===null||l.nodeType!==Node.TEXT_NODE)return void s.insertChild(ee().createTextNode(o));const c=l,a=c.nodeValue;if(a!==o)if(r||Ot){const[u,f,d]=(function(h,g){const m=h.length,p=g.length;let _=0,y=0;for(;_<m&&_<p&&h[_]===g[_];)_++;for(;y+_<m&&y+_<p&&h[m-y-1]===g[p-y-1];)y++;return[_,m-_-y,g.slice(_,p-y)]})(a,o);f!==0&&c.deleteData(u,f),c.insertData(u,d)}else c.nodeValue=o}function Na(n,e,t,r,o,i){md(o,n,e);const s=i.theme.text;s!==void 0&&pd(0,0,r,n,s)}function zo(n,e){const t=ee().createElement(e);return t.appendChild(n),t}function ul(n){return n!=null&&n.__isInlineFormattable===!0}class on extends Ze{__text;__format;__style;__mode;__detail;get __isInlineFormattable(){return!0}$config(){return this.config("text",{importDOM:{"#text":()=>({conversion:Hp,priority:0}),b:()=>({conversion:jp,priority:0}),code:()=>({conversion:Yt,priority:0}),em:()=>({conversion:Yt,priority:0}),i:()=>({conversion:Yt,priority:0}),mark:()=>({conversion:Yt,priority:0}),s:()=>({conversion:Yt,priority:0}),span:()=>({conversion:Wp,priority:0}),strong:()=>({conversion:Yt,priority:0}),sub:()=>({conversion:Yt,priority:0}),sup:()=>({conversion:Yt,priority:0}),u:()=>({conversion:Yt,priority:0})}})}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}constructor(e="",t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return sp[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Lt()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=rn[e];return(this.getFormat()&t)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return In(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){const r=this.__format,o=Ts(0,r),i=Ns(0,r),s=o===null?i:o,l=ee().createElement(s);let c=l;this.hasFormat("code")&&l.setAttribute("spellcheck","false"),o!==null&&(c=ee().createElement(i),l.appendChild(c)),Na(c,this,0,r,this.__text,e);const a=this.__style;return a!==""&&gn(l.style,a),l}updateDOM(e,t,r){const o=this.__text,i=e.__format,s=this.__format,l=Ts(0,i),c=Ts(0,s),a=Ns(0,i),u=Ns(0,s);if((l===null?a:l)!==(c===null?u:c))return!0;if(l===c&&a!==u){const m=t.firstChild;m==null&&$(48);const p=ee().createElement(u);return Na(p,this,0,s,o,r),t.replaceChild(p,m),!1}let f=t;c!==null&&l!==null&&(f=t.firstChild,f==null&&$(49)),md(o,f,this);const d=r.theme.text;d!==void 0&&i!==s&&pd(0,i,s,f,d);const h=e.__style,g=this.__style;return h!==g&&gn(t.style,g,h),!1}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:t}=super.exportDOM(e);return W(t)||$(132),t.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?t.style.textTransform="lowercase":this.hasFormat("uppercase")?t.style.textTransform="uppercase":this.hasFormat("capitalize")&&(t.style.textTransform="capitalize"),this.hasFormat("bold")&&(t=zo(t,"b")),this.hasFormat("italic")&&(t=zo(t,"i")),this.hasFormat("strikethrough")&&(t=zo(t,"s")),this.hasFormat("underline")&&(t=zo(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format=typeof e=="string"?rn[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?rp[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=In(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=ip[e];if(this.__mode===t)return this;const r=this.getWritable();return r.__mode=t,r}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){Re();let r=e,o=t;const i=M(),s=this.getTextContent(),l=this.__key;if(typeof s=="string"){const c=s.length;r===void 0&&(r=c),o===void 0&&(o=c)}else r=0,o=0;if(!E(i))return kd(l,r,l,o,"text","text");{const c=Lt();c!==i.anchor.key&&c!==i.focus.key||Pe(l),i.setTextNodeRange(this,r,this,o)}return i}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,r,o){const i=this.getWritable(),s=i.__text,l=r.length;let c=e;c<0&&(c=l+c,c<0&&(c=0));const a=M();if(o&&E(a)){const f=e+l;a.setTextNodeRange(i,f,i,f)}const u=s.slice(0,c)+r+s.slice(c+t);return i.__text=u,i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Re();const t=this.getLatest(),r=t.getTextContent();if(r==="")return[];const o=t.__key,i=Lt(),s=r.length;e.sort((v,w)=>v-w),e.push(s);const l=[],c=e.length;for(let v=0,w=0;v<s&&w<=c;w++){const A=e[w];A>v&&(l.push(r.slice(v,A)),v=A)}const a=l.length;if(a===1)return[t];const u=l[0],f=t.getParent();let d;const h=t.getFormat(),g=t.getStyle(),m=t.__detail;let p=!1,_=null,y=null;const x=M();if(E(x)){const[v,w]=x.isBackward()?[x.focus,x.anchor]:[x.anchor,x.focus];v.type==="text"&&v.key===o&&(_=v),w.type==="text"&&w.key===o&&(y=w)}t.isSegmented()?(d=Ne(u),d.__format=h,d.__style=g,d.__detail=m,d.__state=sa(t,d),p=!0):d=t.setTextContent(u);const C=[d];for(let v=1;v<a;v++){const w=Ne(l[v]);w.__format=h,w.__style=g,w.__detail=m,w.__state=sa(t,w);const A=w.__key;i===o&&Pe(A),C.push(w)}const T=_?_.offset:null,b=y?y.offset:null;let N=0;for(const v of C){if(!_&&!y)break;const w=N+v.getTextContentSize();if(_!==null&&T!==null&&T<=w&&T>=N&&(_.set(v.getKey(),T-N,"text"),T<w&&(_=null)),y!==null&&b!==null&&b<=w&&b>=N){y.set(v.getKey(),b-N,"text");break}N=w}if(f!==null){(function(A){const k=A.getPreviousSibling(),F=A.getNextSibling();k!==null&&Ai(k),F!==null&&Ai(F)})(this);const v=f.getWritable(),w=this.getIndexWithinParent();p?(v.splice(w,0,C),this.remove()):v.splice(w,1,C),E(x)&&En(x,f,w,a-1)}return C}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||$(50);const r=this.__key,o=e.__key,i=this.__text,s=i.length;Lt()===o&&Pe(r);const l=M();if(E(l)){const f=l.anchor,d=l.focus;f!==null&&f.key===o&&Ia(f,t,r,e,s),d!==null&&d.key===o&&Ia(d,t,r,e,s)}const c=e.__text,a=t?c+i:i+c;this.setTextContent(a);const u=this.getWritable();return e.remove(),u}isTextEntity(){return!1}}function Wp(n){return{forChild:ic(n.style),node:null}}function jp(n){const e=n,t=e.style.fontWeight==="normal";return{forChild:ic(e.style,t?void 0:"bold"),node:null}}const ka=new WeakMap;function Up(n){if(!W(n))return!1;if(n.nodeName==="PRE")return!0;const e=n.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function Hp(n){const e=n;n.parentElement===null&&$(129);let t=e.textContent||"";if((function(r){let o,i=r.parentNode;const s=[r];for(;i!==null&&(o=ka.get(i))===void 0&&!Up(i);)s.push(i),i=i.parentNode;const l=o===void 0?i:o;for(let c=0;c<s.length;c++)ka.set(s[c],l);return l})(e)!==null)return{node:_o(t)};if(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," "),t==="")return{node:null};if(t[0]===" "){let r=e,o=!0;for(;r!==null&&(r=wa(r,!1))!==null;){const i=r.textContent||"";if(i.length>0){/[ \t\n]$/.test(i)&&(t=t.slice(1)),o=!1;break}}o&&(t=t.slice(1))}if(t[t.length-1]===" "){let r=e,o=!0;for(;r!==null&&(r=wa(r,!0))!==null;)if((r.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){o=!1;break}o&&(t=t.slice(0,t.length-1))}return t===""?{node:null}:{node:Ne(t)}}function wa(n,e){let t=n;for(;;){let r;for(;(r=e?t.nextSibling:t.previousSibling)===null;){const i=t.parentElement;if(i===null)return null;t=i}if(t=r,W(t)){const i=t.style.display;if(i===""&&!Fi(t)||i!==""&&!i.startsWith("inline"))return null}let o=t;for(;(o=e?t.firstChild:t.lastChild)!==null;)t=o;if(ot(t))return t;if(t.nodeName==="BR")return null}}const Jp={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Yt(n){const e=Jp[n.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:ic(n.style,e),node:null}}function Ne(n=""){return Ge(new on(n))}function O(n){return n instanceof on}function ic(n,e){const t=n.fontWeight,r=n.textDecoration.split(" "),o=t==="700"||t==="bold",i=r.includes("line-through"),s=n.fontStyle==="italic",l=r.includes("underline"),c=n.verticalAlign;return a=>((O(a)||ul(a))&&(o&&!a.hasFormat("bold")&&a.toggleFormat("bold"),i&&!a.hasFormat("strikethrough")&&a.toggleFormat("strikethrough"),s&&!a.hasFormat("italic")&&a.toggleFormat("italic"),l&&!a.hasFormat("underline")&&a.toggleFormat("underline"),c!=="sub"||a.hasFormat("subscript")||a.toggleFormat("subscript"),c!=="super"||a.hasFormat("superscript")||a.toggleFormat("superscript"),e&&!a.hasFormat(e)&&a.toggleFormat(e)),a)}class es extends on{$config(){return this.config("tab",{extends:on})}constructor(e=void 0){super(" ",e),this.__detail=2}createDOM(e){const t=super.createDOM(e),r=yr(e.theme,"tab");return r!==void 0&&t.classList.add(...r),t}setTextContent(e){return super.setTextContent(" ")}spliceText(e,t,r,o){return r===""&&t===0||r===" "&&t===1||$(286),this}setDetail(e){return e!==2&&$(127),this}setMode(e){return e!=="normal"&&$(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Ao(){return Ge(new es)}function kr(n){return n instanceof es}class qp{key;offset;type;_selection;constructor(e,t,r){this._selection=null,this.key=e,this.offset=t,this.type=r}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:So(je(Je(this,"next")),je(Je(e,"next")))<0}getNode(){const e=te(this.key);return e===null&&$(20),e}set(e,t,r,o){const i=this._selection,s=this.key;o&&this.key===e&&this.offset===t&&this.type===r||(this.key=e,this.offset=t,this.type=r,_n()||(Lt()===s&&Pe(e),i!==null&&(i.setCachedNodes(null),E(i)&&(i._cachedIsBackward=null),i.dirty=!0)))}}function nt(n,e,t){return new qp(n,e,t)}function ks(n,e){let t=e.__key,r=n.offset,o="element";if(O(e)){o="text";const i=e.getTextContentSize();r>i&&(r=i)}else if(!S(e)){const i=e.getNextSibling();if(O(i))t=i.__key,r=0,o="text";else{const s=e.getParent();s&&(t=s.__key,r=e.getIndexWithinParent()+1)}}n.set(t,r,o)}function Ea(n,e){if(S(e)){const t=e.getLastDescendant();S(t)||O(t)?ks(n,t):ks(n,e)}else ks(n,e)}function $a(n,e,t,r){const o=n.getNode(),i=o.getChildAtIndex(n.offset),s=Ne();if(s.setFormat(t),s.setStyle(r),Jt(i))i.splice(0,0,[s]);else if(i!==null){const l=Se(o)?V().append(s):s;i.insertBefore(l)}else if(Se(o)){const l=o.getLastChild();S(l)&&!l.isInline()&&l.isEmpty()?l.append(s):o.append(V().append(s))}else o.append(s);n.is(e)&&e.set(s.__key,0,"text"),n.set(s.__key,0,"text")}function Oa(n,e,t,r){const o=n.anchor.getNode();O(o)||$(398);const i=n.anchor.offset,s=Ne(e);s.setFormat(t),s.setStyle(r);const l=o.getParentOrThrow();if(i===0)l.isInline()&&!o.__prev?l.insertBefore(s):o.insertBefore(s,!1);else if(i===o.getTextContentSize())l.isInline()&&!o.__next?l.insertAfter(s):o.insertAfter(s,!1);else{const[c]=o.splitText(i);c.insertAfter(s,!1)}o.getTextContent()===""&&o.isAttached()&&o.remove(),s.selectEnd(),s.isComposing()&&n.anchor.type==="text"&&n.anchor.set(n.anchor.key,n.anchor.offset-e.length,n.anchor.type)}class ts{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!de(e))return!1;const t=this._nodes,r=e._nodes;return t.size===r.size&&Array.from(t).every(o=>r.has(o))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new ts(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes().filter(s=>We(s)===null),r=t.length;if(r===0)return;const o=t[r-1];let i;if(O(o))i=o.select();else{const s=o.getIndexWithinParent()+1;i=o.getParentOrThrow().select(s,s)}i.insertNodes(e);for(let s=0;s<r;s++)t[s].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,r=[];for(const o of t){const i=te(o);i!==null&&r.push(i)}return _n()||(this._cachedNodes=r),r}getTextContent(){const e=this.getNodes();let t="";for(let r=0;r<e.length;r++)t+=e[r].getTextContent();return t}deleteNodes(){const e=this.getNodes().filter(t=>We(t)===null);if((M()||ct())===this&&e[0]){const t=ne(e[0],"next");Rr(Et(t,t))}for(const t of e)t.remove();_d()}}function _d(){const n=me();if(n.isEmpty()){const e=V();n.append(e),e.select()}}function E(n){return n instanceof qn}class qn{format;style;anchor;focus;_cachedNodes;_cachedIsBackward;dirty;constructor(e,t,r,o){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=r,this.style=o,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!E(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=(function(r){const o=[],[i,s]=r.getTextSlices();i&&o.push(i.caret.origin);const l=new Set,c=new Set;for(const a of r)if(He(a)){const{origin:u}=a;o.length===0?l.add(u):(c.add(u),o.push(u))}else{const{origin:u}=a;S(u)&&c.has(u)||o.push(u)}if(s&&o.push(s.caret.origin),Mt(r.focus)&&S(r.focus.origin)&&r.focus.getNodeAtCaret()===null)for(let a=Fe(r.focus.origin,"previous");He(a)&&l.has(a.origin)&&!a.origin.isEmpty()&&a.origin.is(o[o.length-1]);a=jn(a))l.delete(a.origin),o.pop();for(;o.length>1;){const a=o[o.length-1];if(!S(a)||c.has(a)||a.isEmpty()||l.has(a))break;o.pop()}if(o.length===0&&r.isCollapsed()){const a=je(r.anchor),u=je(r.anchor.getFlipped()),f=h=>Ct(h)?h.origin:h.getNodeAtCaret(),d=f(a)||f(u)||(r.anchor.getNodeAtCaret()?a.origin:u.origin);o.push(d)}return o})(wc(xl(this),"next"));return _n()||(this._cachedNodes=t),t}setTextNodeRange(e,t,r,o){return this.anchor.set(e.__key,t,"text"),this.focus.set(r.__key,o,"text"),this}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const t=e[0],r=e[e.length-1],o=this.anchor,i=this.focus,s=o.isBefore(i),[l,c]=fl(this);let a="",u=!0;for(let f=0;f<e.length;f++){const d=e[f];if(S(d)&&!d.isInline()){u||(a+=`
|
|
8
|
+
`);let h="";for(const g of xt(d)){const m=zn(d,g);m!==null&&(h+=m.getTextContent())}h!==""?(a+=h,u=!1):u=!d.isEmpty()}else if(u=!1,O(d)){let h=d.getTextContent();d===t?d===r?o.type==="element"&&i.type==="element"&&i.offset!==o.offset||(h=l<c?h.slice(l,c):h.slice(c,l)):h=s?h.slice(l):h.slice(c):d===r&&(h=s?h.slice(0,c):h.slice(0,l)),a+=h}else!G(d)&&!Le(d)||d===r&&this.isCollapsed()||(a+=d.getTextContent())}return a}applyDOMRange(e){const t=fe(),r=t.getEditorState()._selection,o=Nd(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,r);if(o===null)return;const[i,s,l]=o;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(s.key,s.offset,s.type,!0),l&&(this.dirty=!0),Dt(this)}clone(){const e=this.anchor,t=this.focus;return new qn(nt(e.key,e.offset,e.type),nt(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=In(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){const t=rn[e];return(this.format&t)!==0}insertRawText(e){this.insertNodes(_o(e))}insertText(e){let t=this.format,r=this.style;if(!this.isCollapsed()){const f=(this.focus.isBefore(this.anchor)?this.focus:this.anchor).getNode();if(O(f)&&(t=f.getFormat(),r=f.getStyle()),this.removeText(),this.format=t,this.style=r,e==="")return;if(Lt()===null)return this.anchor.type==="element"&&$a(this.anchor,this.focus,t,r),void Oa(this,e,t,r)}this.anchor.type==="element"&&$a(this.anchor,this.focus,t,r);const o=this.anchor.getNode();O(o)||$(398);const i=this.anchor.offset,s=o.getParentOrThrow(),l=o.getTextContentSize();if(yt(o)||i===0&&(!o.canInsertTextBefore()||!s.canInsertTextBefore()&&!o.__prev)||i===l&&(!o.canInsertTextAfter()||!s.canInsertTextAfter()&&!o.__next)){if(o.isSegmented()&&i!==0&&i!==l){if(Lt()!==null)o.setMode("normal").setFormat(t).setStyle(r);else{const d=Ne(o.getTextContent());d.setFormat(t),d.setStyle(r),o.replace(d),d.select(i,i)}return void(e!==""&&this.insertText(e))}if(e==="")return;if(i===0){const d=o.getPreviousSibling();if(O(d)&&d.canInsertTextAfter()&&!yt(d))d.select();else{const h=Ne();h.setFormat(t),h.setStyle(r),s.canInsertTextBefore()?o.insertBefore(h):s.insertBefore(h),h.select()}return void this.insertText(e)}if(i===l){const d=o.getNextSibling();if(O(d)&&d.canInsertTextBefore()&&!yt(d))d.select(0,0);else{const h=Ne();h.setFormat(t),h.setStyle(r),s.canInsertTextAfter()?o.insertAfter(h):s.insertAfter(h),h.select(0,0)}return void this.insertText(e)}const f=Ne(e);return f.setFormat(t),f.setStyle(r),o.replace(f),void f.select()}if(e==="")return;const c=s.isInline()&&i===0&&!o.__prev,a=s.isInline()&&i===l&&!o.__next,u=o.getFormat()!==t||o.getStyle()!==r;if(c||a||u){if(o.getTextContent()!==""||c||a)return void Oa(this,e,t,r);o.setFormat(t),o.setStyle(r)}o.spliceText(i,0,e,!0),o.isComposing()&&this.anchor.type==="text"&&this.anchor.set(this.anchor.key,this.anchor.offset-e.length,this.anchor.type)}removeText(){const e=M()===this;ui(this,Bm(xl(this))),e&&M()!==this&&pe(this)}formatText(e,t=null){xd(this,e,t)}insertNodes(e){if(e.length===0)return;this.isCollapsed()||this.removeText();const t=this.anchor.getNode();if(this.anchor.type==="element"&&S(t)&&We(t)!==null){let m=t.isShadowRoot()?t.getFirstChild()??t.append(V()).getFirstChild():t.getFirstChild();if(t.isShadowRoot()&&m!==null&&!S(m)){const p=V();m.insertBefore(p),m=p}if(m!==null){m.selectStart();const p=M();return E(p)||$(369),p.insertNodes(e)}}if(this.anchor.type==="element"&&Se(t)){const m=Es(e),p=m.getLastDescendant();return t.splice(this.anchor.offset,0,m.getChildren()),void(p!==null&&p.selectEnd())}let r=(this.isBackward()?this.focus:this.anchor).getNode(),o=U(r,ze);const i=e[e.length-1];if(S(o)&&"__language"in o){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const m=Jr(this);o.splice(m,0,e),i.selectEnd()}return}if(!e.some(m=>(S(m)||G(m))&&!m.isInline())){S(o)||$(211,r.constructor.name,r.getType());const m=Jr(this);return o.splice(m,0,e),void i.selectEnd()}if(S(o)&&We(o)!==null){const m=Jr(this),p=hl(e);o.splice(m,0,p);const _=p[p.length-1];return void(_!==void 0?_.selectEnd():o.select(m,m))}if(o===null){const m=Es(e),p=m.getLastDescendant();let _=Je(this.anchor,"next");for(const y of m.getChildren())_=ds(y,_);return void(p!==null&&p.selectEnd())}if(S(o)&&!o.isParentRequired()&&!Se(o.getParentOrThrow())){const m=Jr(this),p=hl(e);o.splice(m,0,p);const _=p[p.length-1];return void(_!==void 0?_.selectEnd():o.select(m,m))}const s=Es(e),l=s.getLastDescendant(),c=s.getChildren(),a=!S(o)||!o.isEmpty()?this.insertParagraph():null;a&&!o.isAttached()&&(r=this.anchor.getNode(),o=U(r,ze));const u=c[c.length-1];let f=c[0];var d;S(d=f)&&ze(d)&&!d.isEmpty()&&S(o)&&(!o.isEmpty()||o.canMergeWhenEmpty())&&(S(o)||$(211,r.constructor.name,r.getType()),o.append(...f.getChildren()),f=c[1]),f&&(o===null&&$(212,r.constructor.name,r.getType()),(function(m,p){const _=p.getParentOrThrow().getLastChild();let y=p;const x=[p];for(;y!==_;)y.getNextSibling()||$(140),y=y.getNextSibling(),x.push(y);let C=m;for(const T of x)C=C.insertAfter(T)})(o,f));const h=U(l,ze);a&&S(h)&&(a.canMergeWhenEmpty()||ze(u))&&(h.append(...a.getChildren()),a.remove()),S(o)&&o.isEmpty()&&o.remove(),l.selectEnd();const g=S(o)?o.getLastChild():null;Le(g)&&h!==o&&g.remove()}insertParagraph(){const e=this.anchor.getNode();if(this.anchor.type==="element"&&Se(e)){const l=V();return e.splice(this.anchor.offset,0,[l]),l.select(),l}const t=Jr(this),r=U(this.anchor.getNode(),ze);if(r!==null&&We(r)!==null)return null;S(r)||$(213);const o=r.getChildAtIndex(t),i=o?[o,...o.getNextSiblings()]:[],s=r.insertNewAfter(this,!1);return s?(s.append(...i),s.selectStart(),s):null}insertLineBreak(e){const t=jt();if(this.insertNodes([t]),e){const r=t.getParentOrThrow(),o=t.getIndexWithinParent();r.select(o,o)}}extract(){const e=[...this.getNodes()],t=e.length;let r=e[0],o=e[t-1];const[i,s]=fl(this),l=this.isBackward(),[c,a]=l?[this.focus,this.anchor]:[this.anchor,this.focus],[u,f]=l?[s,i]:[i,s];if(t===0)return[];if(t===1){if(O(r)&&!this.isCollapsed()){const d=r.splitText(u,f),h=u===0?d[0]:d[1];return h?(c.set(h.getKey(),0,"text"),a.set(h.getKey(),h.getTextContentSize(),"text"),[h]):[]}return[r]}if(O(r)&&(u===r.getTextContentSize()?e.shift():u!==0&&([,r]=r.splitText(u),e[0]=r,c.set(r.getKey(),0,"text"))),O(o)){const d=o.getTextContent().length;f===0?e.pop():f!==d&&([o]=o.splitText(f),e[e.length-1]=o,a.set(o.getKey(),o.getTextContentSize(),"text"))}return e}modify(e,t,r){if(ki(this,e,t,r))return;const o=e==="move",i=fe(),s=De(it(i));if(!s)return;const l=i._blockCursorElement,c=i._rootElement,a=this.focus.getNode();c===null||l===null||!S(a)||a.isInline()||a.canBeEmpty()||Mi(l,i,c);const u=$r(i,this.focus.key);let f=u;if(this.focus.type==="text"&&(f=O(a)?pn(a,u,i):null),this.dirty){const d=$r(i,this.anchor.key);let h=d;if(this.anchor.type==="text"){const g=this.anchor.getNode();h=O(g)?pn(g,d,i):null}h&&f&&Ni(s,h,this.anchor.offset,f,this.focus.offset)}if(r==="character"&&O(a)&&a.isUnmergeable()&&(t?this.focus.offset===0:this.focus.offset===a.getTextContentSize())){const d=ne(a,t?"previous":"next").getNodeAtCaret();if(O(d)){if(!o){const h=d.getTextContentSize();return t?this.focus.set(d.__key,h-1,"text"):this.focus.set(d.__key,1,"text"),void(this.dirty=!0)}{const h=i.getElementByKey(d.getKey()),g=h?pn(d,h,i):null;if(g){const m=t?g.length:0;Ni(s,g,m,g,m)}}}}if(Sd(s,e,t?"backward":"forward",r),s.rangeCount>0){const d=ss(s,i._rootElement),h=d||s.getRangeAt(0),g=this.anchor.getNode(),m=Ee(g)?g:Yd(g);this.applyDOMRange(h),this.dirty=!0,!o&&(bd(this,t,m),(d?s.direction!=="backward":s.anchorNode===h.startContainer&&s.anchorOffset===h.startOffset)||Cd(this))}r==="lineboundary"&&ki(this,e,t,r,"decorators")}forwardDeletion(e,t,r){if(!r&&(e.type==="element"&&S(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const o=t.getParent(),i=t.getNextSibling()||(o===null?null:o.getNextSibling());if(S(i)&&i.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let o=r.getNode();if(this.forwardDeletion(r,o,e))return;const i=Dr(Je(r,e?"previous":"next"));if(i.getTextSlices().every(l=>l===null||l.distance===0)){let l={type:"initial"};for(const c of i.iterNodeCarets("shadowRoot"))if(He(c)){if(!c.origin.isInline()){if(c.origin.isShadowRoot()){if(l.type==="merge-block")break;if(S(i.anchor.origin)&&i.anchor.origin.isEmpty()){const a=je(c);ui(this,Et(a,a)),i.anchor.origin.remove()}return}l.type!=="merge-next-block"&&l.type!=="merge-block"||(l={block:l.block,caret:c,type:"merge-block"})}}else{if(l.type==="merge-block")break;if(Mt(c)){if(S(c.origin)){if(c.origin.isInline()){if(!c.origin.isParentOf(i.anchor.origin))break}else l={block:c.origin,type:"merge-next-block"};continue}if(G(c.origin)){if(!c.origin.isIsolated())if(xt(c.origin).length>0){if(S(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();const a=po();a.add(c.origin.getKey()),pe(a)}}else if(l.type==="merge-next-block"&&(c.origin.isKeyboardSelectable()||!c.origin.isInline())&&S(i.anchor.origin)&&i.anchor.origin.isEmpty()){i.anchor.origin.remove();const a=po();a.add(c.origin.getKey()),pe(a)}else c.origin.remove();return}break}}if(l.type==="merge-block"){const{caret:c,block:a}=l;return xt(a).length>0?void 0:c.origin.isEmpty()&&!a.isEmpty()&&c.origin.getParent()===a.getParent()?void c.origin.remove(!0):(ui(this,Et(!c.origin.isEmpty()&&a.isEmpty()?bn(ne(a,c.direction)):i.anchor,c)),this.removeText())}for(let c=r.getNode();c!==null;){if(We(c)!==null)return;if(S(c)&&c.isShadowRoot())break;c=c.getParent()}}const s=this.focus;if(ws(this,e,"character"),this.isCollapsed()){if(e&&r.offset===0&&Ma(this,r.getNode()))return}else{const l=s.type==="text"?s.getNode():null;if(o=r.type==="text"?r.getNode():null,l!==null&&l.isSegmented()){const c=s.offset,a=l.getTextContentSize();if(l.is(o)||e&&c!==a||!e&&c!==0)return void Fa(l,e,c)}else if(o!==null&&o.isSegmented()){const c=r.offset,a=o.getTextContentSize();if(o.is(l)||e&&c!==0||!e&&c!==a)return void Fa(o,e,c)}(function(c,a){const u=c.anchor,f=c.focus,d=u.getNode(),h=f.getNode();if(d===h&&u.type==="text"&&f.type==="text"){const g=u.offset,m=f.offset,p=g<m,_=p?g:m,y=p?m:g,x=y-1;_!==x&&(function(C){return!(Hd(C)||Yp(C))})(d.getTextContent().slice(_,y))&&(a?f.set(f.key,x,f.type):u.set(u.key,x,u.type))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&Ee(r.getParent())&&r.getPreviousSibling()===null&&Ma(this,r),_d()}}deleteLine(e){const t=dl(this.anchor);if(t!==null&&G(mt(t)))return this.isCollapsed()||this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),void this.deleteCharacter(e);this.isCollapsed()&&ws(this,e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):U(this.anchor.getNode(),ze)!==U(this.focus.getNode(),ze)?(this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),this.deleteCharacter(e)):this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,r=t.getNode();if(this.forwardDeletion(t,r,e))return;ws(this,e,"word")}this.isCollapsed()?this.deleteCharacter(e):this.removeText()}isBackward(){const e=this._cachedIsBackward;if(e!==null)return e;const t=this.focus.isBefore(this.anchor);return _n()||(this._cachedIsBackward=t),t}getStartEndPoints(){return[this.anchor,this.focus]}}function de(n){return n instanceof ts}function yd(n,e){if(de(n)){for(const _ of n.getNodes())ul(_)&&_.setFormat(e(_.getFormat()));return}if(n.isCollapsed())return n.setFormat(e(n.format)),void Pe(null);const t=[];for(const _ of n.getNodes())O(_)?t.push(_):S(_)?_.setTextFormat(e(_.getTextFormat())):ul(_)&&_.setFormat(e(_.getFormat()));const r=t.length;if(r===0)return n.setFormat(e(n.format)),void Pe(null);const o=n.anchor,i=n.focus,s=n.isBackward(),l=s?i:o,c=s?o:i;let a=0,u=t[0],f=l.type==="element"?0:l.offset;if(l.type==="text"&&f===u.getTextContentSize()&&(a=1,u=t[1],f=0),u==null)return;const d=r-1;let h=t[d];const g=c.type==="text"?c.offset:h.getTextContentSize();if(u.is(h)){if(f===g)return;const _=e(u.getFormat());if(yt(u)||f===0&&g===u.getTextContentSize())u.setFormat(_);else{const y=u.splitText(f,g),x=f===0?y[0]:y[1];x.setFormat(_),l.type==="text"&&l.set(x.__key,0,"text"),c.type==="text"&&c.set(x.__key,g-f,"text")}return void(n.format=_)}f===0||yt(u)||([,u]=u.splitText(f),f=0);const m=e(u.getFormat());u.setFormat(m);const p=e(h.getFormat());g>0&&(g===h.getTextContentSize()||yt(h)||([h]=h.splitText(g)),h.setFormat(p));for(let _=a+1;_<d;_++){const y=t[_];y.setFormat(e(y.getFormat()))}l.type==="text"&&l.set(u.__key,f,"text"),c.type==="text"&&c.set(h.__key,g,"text"),n.format=m|p}function Vp(n,e){const t=[];for(const[r,o]of Object.entries(e))typeof o=="boolean"&&t.push([r,o]);t.length!==0&&yd(n,r=>{for(const[o,i]of t)r=In(r,o,i?rn[o]:0);return r})}function xd(n,e,t=null){const r=t===null&&E(n)?In(n.format,e,null):t;yd(n,o=>In(o,e,r))}function Aa(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function fl(n){const e=n.getStartEndPoints();if(e===null)return[0,0];const[t,r]=e;return t.type==="element"&&r.type==="element"&&t.key===r.key&&t.offset===r.offset?[0,0]:[Aa(t),Aa(r)]}function Ma(n,e){for(let t=e;t;t=t.getParent()){if(S(t)){if(t.collapseAtStart(n))return!0;if(Se(t))break}if(t.getPreviousSibling())break}return!1}function Cd(n){const e=n.focus,t=n.anchor,r=t.key,o=t.offset,i=t.type;t.set(e.key,e.offset,e.type,!0),e.set(r,o,i,!0)}function Sd(n,e,t,r){n.modify(e,t,r)}function bd(n,e,t){const r=n.getNodes(),o=r.filter(l=>Ar(l,t));if(o.length===0||o.length===r.length)return!1;const i=e?o[0]:o[o.length-1],s=S(i)?i:i.getParentOrThrow();return e?s.selectStart():s.selectEnd(),!0}function ws(n,e,t){if(ki(n,"extend",e,t))return;const r=fe(),o=De(it(r));if(!o||typeof o.modify!="function")return;const i=r._blockCursorElement,s=r._rootElement,l=n.anchor,c=n.focus.getNode();s===null||i===null||!S(c)||c.isInline()||c.canBeEmpty()||Mi(i,r,s);const a=w=>{const A=w.getNode(),k=r.getElementByKey(w.key);return k!==null&&w.type==="text"&&O(A)?pn(A,k,r):k},u=l.getNode(),f=a(l);if(f===null)return;const d=l.offset,h=n.isCollapsed(),g=n.focus,m=h?f:a(g);if(m===null)return;const p=g.offset;if(Ni(o,m,p,m,p),Sd(o,"move",e?"backward":"forward",t),o.rangeCount===0)return;const _=ss(o,s)||o.getRangeAt(0),y=_.startContainer,x=_.startOffset;if(h&&t==="character"&&l.type==="text"&&O(u)&&u.isUnmergeable()&&d===(e?0:u.getTextContentSize())){const w=ne(u,e?"previous":"next").getNodeAtCaret();if(O(w)){const A=e?w.getTextContentSize()-1:1;return n.focus.set(w.__key,A,"text"),void(n.dirty=!0)}}if(h&&t==="character"&&l.type==="text"){const w=e?0:u.getTextContentSize(),A=y===f?x:d!==w?w:-1;if(A>=0)return void(A!==d&&(n.focus.set(l.key,A,"text"),n.dirty=!0))}const[C,T,b,N]=e?[y,x,f,d]:[f,d,y,x],v=Ee(u)?u:Yd(u);n.applyDOMRange({collapsed:!1,endContainer:b,endOffset:N,startContainer:C,startOffset:T}),n.dirty=!0,!bd(n,e,v)&&e&&Cd(n),t==="lineboundary"&&ki(n,"extend",e,t,"decorators")}const Yp=(()=>{try{const n=new RegExp("\\p{Emoji}","u"),e=n.test.bind(n);if(e("❤️")&&e("#️⃣")&&e("👍"))return e}catch{}return()=>!1})();function Fa(n,e,t){const r=n,o=r.getTextContent().split(/(?=\s)/g),i=o.length;let s=0,l=0;for(let a=0;a<i;a++){const u=a===i-1;if(l=s,s+=o[a].length,e&&s===t||s>t||u){o.splice(a,1),u&&(l=void 0);break}}const c=o.join("").trim();c===""?r.remove():(r.setTextContent(c),r.select(l,l))}function Da(n,e,t,r){let o,i=e,s=!1;if(W(n)){let l=!1;const c=n.childNodes,a=c.length,u=r._blockCursorElement;i===a&&a>0&&(l=!0,i=a-1),zr(n,r)!==void 0||Ri(n,r)||(s=!0);let f=c[i],d=!1;if(f===u)f=c[i+1],d=!0;else if(u!==null){const h=u.parentNode;n===h&&e>Array.prototype.indexOf.call(h.children,u)&&i--}if(o=ur(f),O(o))i=Bt(o,l?"next":"previous");else{let h=ur(n);if(h===null)return null;if(S(h)){const g=r.getElementByKey(h.getKey());g===null&&$(214),[h,i]=St(h,g,r).resolveChildIndex(h,g,n,e),S(h)||$(215),l&&i>=h.getChildrenSize()&&(i=Math.max(0,h.getChildrenSize()-1));let p=h.getChildAtIndex(i);if(S(p)&&(function(_,y,x){const C=_.getParent();return x===null||C===null||!C.canBeEmpty()||C!==x.getNode()})(p,0,t)){const _=l?p.getLastDescendant():p.getFirstDescendant();_===null?h=p:(p=_,h=S(p)?p:p.getParentOrThrow()),i=0}O(p)?(o=p,h=null,i=Bt(p,l?"next":"previous")):p!==h&&l&&!d&&(S(h)||$(216),i=Math.min(h.getChildrenSize(),i+1))}else{const g=mt(h),m=g!==null?g:h,p=m.getIndexWithinParent(),_=r.getElementByKey(h.getKey());let y="after";if(_!==null&&ur(n)===h){const x=St(h,_,r);x.element!==_?y=x.resolveLeafPosition(_,n,e):e===0&&G(h)&&(y="before")}i=y==="before"?p:p+1,h=m.getParentOrThrow()}if(S(h))return[nt(h.__key,i,"element"),s]}}else o=ur(n);return O(o)?[nt(o.__key,Bt(o,i,"clamp"),"text"),s]:null}function Ra(n,e,t){const r=n.offset,o=n.getNode();if(r===0){const i=o.getPreviousSibling(),s=o.getParent();if(e){if((t||!e)&&i===null&&S(s)&&s.isInline()){const l=s.getPreviousSibling();O(l)&&n.set(l.__key,l.getTextContent().length,"text")}}else S(i)&&!t&&i.isInline()?n.set(i.__key,i.getChildrenSize(),"element"):O(i)&&!o.isUnmergeable()&&n.set(i.__key,i.getTextContent().length,"text")}else if(r===o.getTextContent().length){const i=o.getNextSibling(),s=o.getParent();if(e&&S(i)&&i.isInline())n.set(i.__key,0,"element");else if((t||e)&&i===null&&S(s)&&s.isInline()&&!s.canInsertTextAfter()&&s.getTextContentSize()>1){const l=s.getNextSibling();O(l)&&n.set(l.__key,0,"text")}}}function dl(n){const e=te(n.key);return e===null?null:cs(e)}function vd(n,e,t){const r=dl(n),o=dl(e);if(r===o||r!==null&&o!==null&&r.is(o))return!1;const i=t(r,o);if(r!==null)return S(r)?e.set(r.getKey(),i?r.getChildrenSize():0,"element"):e.set(r.getKey(),i?r.getTextContentSize():0,"text"),!0;const s=mt(o);if(s===null)return!1;const l=s.getParent();if(l===null)return!1;const c=s.getIndexWithinParent();return e.set(l.getKey(),i?c+1:c,"element"),!0}function Td(n){const e=vd(n.anchor,n.focus,(t,r)=>(function(o,i,s,l){if(s!==null&&l!==null){const u=mt(s),f=mt(l);if(u!==null&&u.is(f)){for(const d of as(u).values()){if(d===s.getKey())return!0;if(d===l.getKey())return!1}return!0}return u===null||f===null||u.isBefore(f)}if(s!==null){const u=mt(s),f=te(i.key);return u===null||f===null||!(!u.is(f)&&!u.isParentOf(f))||u.isBefore(f)}const c=mt(l),a=te(o.key);return c!==null&&a!==null&&!c.is(a)&&!c.isParentOf(a)&&a.isBefore(c)})(n.anchor,n.focus,t,r));return e&&(n.dirty=!0),e}function Nd(n,e,t,r,o,i){if(n===null||t===null||!Fo(o,n,t))return null;const s=Da(n,e,E(i)?i.anchor:null,o);if(s===null)return null;const l=Da(t,r,E(i)?i.focus:null,o);if(l===null)return null;const[c,a]=s,[u,f]=l;if(c.type==="element"&&u.type==="element"){const h=ur(n),g=ur(t);if(G(h)&&G(g))return null}const d=o._slotsUsed&&vd(c,u,()=>(n.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return(function(h,g){if(h.type==="text"&&g.type==="text"){const m=h.isBefore(g),p=h.is(g);Ra(h,m,p),Ra(g,!m,p),p&&g.set(h.key,h.offset,h.type)}})(c,u),[c,u,a||f||d]}function wr(n){return S(n)&&!n.isInline()}function kd(n,e,t,r,o,i){const s=cn(),l=new qn(nt(n,e,o),nt(t,r,i),0,"");return l.dirty=!0,s._selection=l,l}function sc(){const n=nt("root",0,"element"),e=nt("root",0,"element");return new qn(n,e,0,"")}function po(){return new ts(new Set)}function Xp(n,e){return mo(null,n,e,null)}function mo(n,e,t,r){const o=t._window;if(o===null)return null;const i=r||o.event,s=i?i.type:void 0,l=s==="selectionchange",c=!Xs&&(l||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&i&&i.detail===3||s==="drop"||s===void 0);let a,u,f,d;if(E(n)&&!c)return n.clone();{if(e===null)return null;const C=rt(e,t._rootElement);if(a=C.anchorNode,u=C.focusNode,f=C.anchorOffset,d=C.focusOffset,(l||s===void 0)&&E(n)&&!Fo(t,a,u))return n.clone()}const h=Nd(a,f,u,d,t,n);if(h===null)return null;const[g,m,p]=h;let _=0,y="";if(E(n)){const C=n.anchor;if(g.key===C.key)_=n.format,y=n.style;else{const T=g.getNode();O(T)?(_=T.getFormat(),y=T.getStyle()):S(T)&&(_=T.getTextFormat(),y=T.getTextStyle())}}const x=new qn(g,m,_,y);return p&&(x.dirty=!0),x}function M(){return cn()._selection}function ct(){return fe()._editorState._selection}function En(n,e,t,r=1){const o=n.anchor,i=n.focus,s=o.getNode(),l=i.getNode();if(!e.is(s)&&!e.is(l))return;const c=e.__key;if(n.isCollapsed()){const a=o.offset;if(t<=a&&r>0||t<a&&r<0){const u=Math.max(0,a+r);o.set(c,u,"element"),i.set(c,u,"element"),Pa(n)}}else{const a=n.isBackward(),u=a?i:o,f=u.getNode(),d=a?o:i,h=d.getNode();if(e.is(f)){const g=u.offset;(t<=g&&r>0||t<g&&r<0)&&u.set(c,Math.max(0,g+r),"element")}if(e.is(h)){const g=d.offset;(t<=g&&r>0||t<g&&r<0)&&d.set(c,Math.max(0,g+r),"element")}}Pa(n)}function Pa(n){const e=n.anchor,t=e.offset,r=n.focus,o=r.offset,i=e.getNode(),s=r.getNode();if(n.isCollapsed()){if(!S(i))return;const l=i.getChildrenSize(),c=t>=l,a=c?i.getChildAtIndex(l-1):i.getChildAtIndex(t);if(O(a)){let u=0;c&&(u=a.getTextContentSize()),e.set(a.__key,u,"text"),r.set(a.__key,u,"text")}return}if(S(i)){const l=i.getChildrenSize(),c=t>=l,a=c?i.getChildAtIndex(l-1):i.getChildAtIndex(t);if(O(a)){let u=0;c&&(u=a.getTextContentSize()),e.set(a.__key,u,"text")}}if(S(s)){const l=s.getChildrenSize(),c=o>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(o);if(O(a)){let u=0;c&&(u=a.getTextContentSize()),r.set(a.__key,u,"text")}}}function Ti(n,e,t,r,o){let i=null,s=0,l=null;r!==null?(i=r.__key,O(r)?(s=r.getTextContentSize(),l="text"):S(r)&&(s=r.getChildrenSize(),l="element")):o!==null&&(i=o.__key,O(o)?l="text":S(o)&&(l="element")),i!==null&&l!==null?n.set(i,s,l):(s=e.getIndexWithinParent(),s===-1&&(s=t.getChildrenSize()),n.set(t.__key,s,"element"))}function Ia(n,e,t,r,o){n.type==="text"?n.set(t,n.offset+(e?0:o),"text"):n.offset>r.getIndexWithinParent()&&n.set(n.key,n.offset-1,"element")}function Ni(n,e,t,r,o){try{n.setBaseAndExtent(e,t,r,o)}catch{}}function La(n,e,t){const r=$r(n,e.getKey());if(S(e)){const o=St(e,r,n);return[o.element,t+o.getFirstChildOffset()]}return[r,t]}function Gp(n,e,t,r,o,i){const s=i.getRootNode(),l=Cn(s)||Ut(s)?Mr(s):null;if(o.has(Ip)&&l!==i||l!==null&&gc(l,l))return;const c=rt(r,i);let a;if(!E(e))return void(n!==null&&Fo(t,c.anchorNode,c.focusNode)&&r.removeAllRanges());const u=e.anchor,f=e.focus,d=u.getNode(),h=f.getNode(),[g,m]=La(t,d,u.offset),[p,_]=La(t,h,f.offset),y=e.format,x=e.style,C=e.isCollapsed();let T=g,b=p,N=!1;if(u.type==="text"?(T=O(d)?pn(d,g,t):null,N=d.getFormat()!==y||d.getStyle()!==x):E(n)&&n.anchor.type==="text"&&(N=!0),f.type==="text"&&(b=O(h)?pn(h,p,t):null),T!==null&&b!==null){if(C&&(n===null||N||E(n)&&(n.format!==y||n.style!==x))&&(function(v,w,A,k,F,L){v._inputState.collapsedSelectionFormat={format:w,key:F,offset:k,style:A,timeStamp:L}})(t,y,x,m,u.key,performance.now()),(r.type!=="Range"||!C)&&c.anchorOffset===m&&c.focusOffset===_&&c.anchorNode===T&&c.focusNode===b){if(l===null||!i.contains(l)){const v=l!==null?_r(l):null;v!==null&&v!==t||o.has(al)||i.focus({preventScroll:!0})}if(u.type!=="element")return}if(Ni(r,T,m,b,_),Ot&&e.isCollapsed()&&i!==null&&!o.has(al)){const v=xo(i);if(v===null||!i.contains(v)){const w=Mr(i.ownerDocument),A=w!==null?_r(w):null;A!==null&&A!==t||i.focus({preventScroll:!0})}}if(!o.has(Lp)&&e.isCollapsed()&&i!==null&&i===xo(i)){const v=E(e)&&e.anchor.type==="element"?T.childNodes[m]||null:(a===void 0&&(a=eh(r,i)),a);if(v!==null){let w;if(ot(v)){const A=v.ownerDocument.createRange();A.selectNode(v),w=A.getBoundingClientRect()}else w=v.getBoundingClientRect();(function(A,k,F){const L=xc(F),B=Cc(L);if(L===null||B===null)return;const Y=F.getBoundingClientRect();if(k.bottom<Y.top)return;let{top:oe,bottom:ae}=k,le=0,K=0,I=F;for(;I!==null;){const j=I===L.body;if(j){const re=B.visualViewport;if(re){const Me=re.offsetTop;le=Me,K=Me+re.height}else le=0,K=it(A).innerHeight;const Ae=B.getComputedStyle(L.documentElement),ut=parseFloat(Ae.scrollPaddingTop),ie=parseFloat(Ae.scrollPaddingBottom);isFinite(ut)&&(le+=ut),isFinite(ie)&&(K-=ie)}else{const re=I===F?Y:I.getBoundingClientRect();le=re.top,K=re.bottom}let ue=0;if(oe<le?ue=-(le-oe):ae>K&&(ue=ae-K),ue!==0)if(j)B.scrollBy(0,ue);else{const re=I.scrollTop;I.scrollTop+=ue;const Ae=I.scrollTop-re;oe-=Ae,ae-=Ae}if(j)break;I=Vn(I)}})(t,w,i)}}(function(v){v._inputState.isSelectionChangeFromDOMUpdate=!0})(t)}}function ns(n){let e=M()||ct();e===null&&(e=me().selectEnd()),e.insertNodes(n)}function wd(n,e){for(const t of n.split(/(\r?\n|\t)/))t===`
|
|
9
|
+
`||t===`\r
|
|
10
|
+
`?e.linebreak():t===" "?e.tab():t!==""&&e.text(t)}function _o(n){const e=[];return wd(n,{linebreak:()=>e.push(jt()),tab:()=>e.push(Ao()),text:t=>e.push(Ne(t))}),e}function hl(n){const e=[];for(const t of n)Le(t)||(!S(t)&&!G(t)||t.isInline()?e.push(t):S(t)&&e.push(...hl(t.getChildren())));return e}function Jr(n){let e=n;n.isCollapsed()||e.removeText();const t=M();E(t)&&(e=t),E(e)||$(161);const r=e.anchor;let o=r.getNode(),i=r.offset;for(;!ze(o)&&We(o)===null;){const s=o;if([o,i]=Qp(o,i),s.is(o))break}return i}function Qp(n,e){const t=n.getParent();if(!t){const o=V();return me().append(o),o.select(),[me(),0]}if(O(n)){const o=n.splitText(e);if(o.length===0)return[t,n.getIndexWithinParent()];const i=e===0?0:1;return[t,o[0].getIndexWithinParent()+i]}if(!S(n)||e===0)return[t,n.getIndexWithinParent()];const r=n.getChildAtIndex(e);if(r){const o=new qn(nt(n.__key,e,"element"),nt(n.__key,e,"element"),0,""),i=n.insertNewAfter(o);i&&i.append(r,...r.getNextSiblings())}return[t,n.getIndexWithinParent()+1]}function Ka(n){return Le(n)||Sc(n)||O(n)||n.isParentRequired()}function Es(n){const e=V();let t=null;for(let r=0;r<n.length;r++){const o=n[r];if(Ka(o)){if(t===null){t=o.createParentElementNode(),e.append(t);const i=n[r+1];if(Le(o)&&(i===void 0||!Ka(i)))continue}t.append(o)}else e.append(o),t=null}return e}function ki(n,e,t,r,o="decorators-and-blocks"){if(e==="move"&&r==="character"&&!n.isCollapsed()){const[u,f]=t===n.isBackward()?[n.focus,n.anchor]:[n.anchor,n.focus];return f.set(u.key,u.offset,u.type),!0}const i=Je(n.focus,t?"previous":"next"),s=r==="lineboundary",l=e==="move";let c=i,a=o==="decorators-and-blocks";if(!fs(c)){for(const u of c){a=!1;const{origin:f}=u;if(!G(f)||f.isIsolated()||(c=u,!s||!f.isInline()))break}if(a)for(const u of Dr(i).iterNodeCarets(e==="extend"?"shadowRoot":"root")){if(He(u))u.origin.isInline()||(c=u);else{if(S(u.origin))continue;G(u.origin)&&!u.origin.isInline()&&(c=u)}break}}if(c===i)return!1;if(l&&!s&&G(c.origin)&&c.origin.isKeyboardSelectable()){const u=po();return u.add(c.origin.getKey()),pe(u),!0}return c=je(c),l&&wt(n.anchor,c),wt(n.focus,c),a||!s}let Ie=null,$e=null,tt=!1,$s=!1,li=!1;const Os=new Set;let ci=0;const za={characterData:!0,childList:!0,subtree:!0};function _n(){return tt||Ie!==null&&Ie._readOnly}function Re(){tt&&$(13)}function Ed(){ci>99&&$(14)}function cn(){return Ie===null&&$(195,Od()),Ie}function Zp(n){cn()!==null&&$e===null&&($e=n),$e!==n&&vf(378)}function fe(){return $e===null&&$(337,Od()),$e}function $d(){fe()._dirtyType=2}function Od(){let n=0;const e=new Set,t=Er.version;if(typeof window<"u")for(const o of Qd(document)){const i=Kr(o);if(Do(i))n++;else if(i){let s=String(i.constructor.version||"<0.17.1");s===t&&(s+=" (separately built, likely a bundler configuration issue)"),e.add(s)}}let r=` Detected on the page: ${n} compatible editor(s) with version ${t}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function Ad(){return $e}function Ba(n,e,t){const r=e.__type,o=Kd(n,r);let i=t.get(r);i===void 0&&(i=Array.from(o.transforms),t.set(r,i));const s=i.length;for(let l=0;l<s&&(i[l](e),e.isAttached());l++);}function Wa(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function Md(n,e){if(!e)return;const t=n._updateTags;let r=e;Array.isArray(e)||(r=[e]);for(const o of r)t.add(o)}function em(n){return wi(n,fe()._nodes)}function wi(n,e){const t=n.type,r=e.get(t);r===void 0&&$(17,t);const o=r.klass;n.type!==o.getType()&&$(18,o.name);const i=o.importJSON(n),s=n.children;if(S(i)&&Array.isArray(s))for(let c=0;c<s.length;c++){const a=wi(s[c],e);i.append(a)}const l=n.$slots;if(l){tn(i)||$(379,o.name);for(const c in l)ch(i,c,wi(l[c],e))}return i}function ja(n,e,t){const r=Ie,o=tt,i=$e;Ie=e,tt=!0,$e=n;try{return t()}finally{Ie=r,tt=o,$e=i}}function un(n,e){const t=li;li=!0;try{(function(r,o){const i=r._pendingEditorState,s=r._rootElement,l=r._headless||s===null;if(i===null)return void(!r._updating&&r._deferred.length>0&&Ua(r,r._deferred));const c=r._editorState,a=c._selection,u=i._selection,f=r._dirtyType!==0,d=Ie,h=tt,g=$e,m=r._updating,p=r._observer;let _=null;if(r._pendingEditorState=null,r._editorState=i,!l&&f&&p!==null){$e=r,Ie=i,tt=!1,r._updating=!0;try{const v=r._dirtyType,w=r._dirtyElements,A=r._dirtyLeaves;p.disconnect(),_=xp(c,i,r,v,w,A)}catch(v){if(v instanceof Error&&r._onError(v),$s)throw v;return Ld(r,null,s,i),Df(r),r._dirtyType=2,$s=!0,un(r,c),void($s=!1)}finally{p.observe(s,za),r._updating=m,Ie=d,tt=h,$e=g}}i._readOnly||(i._readOnly=!0);const y=r._dirtyLeaves,x=r._dirtyElements,C=r._normalizedNodes,T=r._updateTags;f&&(r._dirtyType=0,r._cloneNotNeeded.clear(),r._dirtyLeaves=new Set,r._dirtyElements=new Map,r._normalizedNodes=new Set),r._updateTags=new Set,(function(v,w){const A=v._decorators;let k=v._pendingDecorators||A;const F=w._nodeMap;let L;for(L in k)F.has(L)||(k===A&&(k=Ud(v)),delete k[L])})(r,i);const b=l?null:De(it(r));if(r._editable&&b!==null&&(f||u===null||u.dirty||!u.is(a))&&s!==null&&!T.has(Kp)){$e=r,Ie=i;try{if(p!==null&&p.disconnect(),f||u===null||u.dirty){const v=r._blockCursorElement;v!==null&&Mi(v,r,s),Gp(a,u,r,b,T,s)}(function(v,w,A){let k=v._blockCursorElement;if(E(A)&&A.isCollapsed()&&A.anchor.type==="element"&&w.contains(xo(w))){const F=A.anchor,L=F.getNode(),B=F.offset;let Y=!1,oe=null;if(B===L.getChildrenSize())ai(L.getChildAtIndex(B-1))&&(Y=!0);else{const ae=L.getChildAtIndex(B);if(ae!==null&&ai(ae)){const le=ae.getPreviousSibling();(le===null||ai(le))&&(Y=!0,oe=v.getElementByKey(ae.__key))}}if(Y){const ae=St(L,v.getElementByKey(L.__key),v).element;return k===null&&(v._blockCursorElement=k=(function(le){const K=le.theme,I=ee().createElement("div");I.contentEditable="false",I.setAttribute("data-lexical-cursor","true");let j=K.blockCursor;if(j!==void 0){if(typeof j=="string"){const ue=nn(j);j=K.blockCursor=ue}j!==void 0&&I.classList.add(...j)}return I})(v._config)),w.style.caretColor="transparent",void(oe===null?ae.appendChild(k):ae.insertBefore(k,oe))}}k!==null&&Mi(k,v,w)})(r,s,u)}finally{p!==null&&p.observe(s,za),$e=g,Ie=d}}_!==null&&(function(v,w,A,k,F){const L=Array.from(v._listeners.mutation),B=L.length;for(let Y=0;Y<B;Y++){const[oe,ae]=L[Y];for(const le of ae){const K=w.get(le);K!==void 0&&oe(K,{dirtyLeaves:k,prevEditorState:F,updateTags:A})}}})(r,_,T,y,c),E(u)||u===null||a!==null&&a.is(u)||r.dispatchCommand(Pt);const N=r._pendingDecorators;N!==null&&(r._decorators=N,r._pendingDecorators=null,io("decorator",r,!0,N)),(function(v,w,A){const k=qa(w),F=qa(A);k!==F&&io("textcontent",v,!0,F)})(r,o||c,i),io("update",r,!0,{dirtyElements:x,dirtyLeaves:y,editorState:i,mutatedNodes:_,normalizedNodes:C,prevEditorState:o||c,tags:T}),!m&&Ua(r,r._deferred),(function(v){const w=v._updates;if(w.length===0)return void(v._cascadeCount=0);if((function(k){Os.has(k)||(Os.add(k),setTimeout(()=>{Os.delete(k),k._cascadeCount=0},0))})(v),v._cascadeCount++>99)return v._updates=[],v._cascadeCount=0,void v._onWarn(new Error(`One or more update listeners are endlessly enqueueing more updates. May have encountered infinite recursion caused by update listeners that trigger additional updates without a stop condition. Editor namespace: ${v._config.namespace}`));const A=w.shift();if(A){const[k,F]=A;yo(v,k,F)}})(r)})(n,e)}finally{li=t}}function io(n,e,t,...r){const o=e._updating;e._updating=t;try{const i=e._listeners[n],s=Array.from(i);for(const[l,c]of s){c&&c();const a=l(...r);i.has(l)?i.set(l,a):a&&a()}}finally{e._updating=o}}function Fd(n,e,t,r){const o=pc(n);let i;if(!li)for(let s=0;s<o.length;s++)o[s]._updating||(o[s]._cascadeCount=0);for(let s=4;s>=0;s--)for(let l=0;l<o.length;l++){const c=o[l];if(l>0&&c._updating){i=c;break}const a=c._commands.get(e);if(a!==void 0){const u=a[s];if(u.size>0){let f=!1;if(_t(c,()=>{for(const d of u)if(d(t,r))return void(f=!0)}),f)return f}}}return i&&i.update(()=>{Fd(i,e,t,r)}),!1}function Ua(n,e){if(n._deferred=[],e.length!==0){const t=n._updating;n._updating=!0;try{for(let r=0;r<e.length;r++)e[r]()}finally{n._updating=t}}}function Ha(n,e){const t=n._updates;let r=e||!1;for(;t.length!==0;){const o=t.shift();if(o){const[i,s]=o,l=n._pendingEditorState;let c;s!==void 0&&(c=s.onUpdate,s.skipTransforms&&(r=!0),s.discrete&&(l===null&&$(191),l._flushSync=!0),c&&n._deferred.push(c),Md(n,s.tag)),l==null?yo(n,i,s):i()}}return r}function yo(n,e,t){const r=n._updateTags;let o,i=!1,s=!1;t!==void 0&&(o=t.onUpdate,Md(n,t.tag),i=t.skipTransforms||!1,s=t.discrete||!1),o&&n._deferred.push(o);const l=n._editorState;let c=n._pendingEditorState,a=!1;(c===null||c._readOnly)&&(c=n._pendingEditorState=Dd(c||l),a=!0),c._flushSync=s;const u=Ie,f=tt,d=$e,h=n._updating;Ie=c,tt=!1,n._updating=!0,$e=n;const g=n._headless||n.getRootElement()===null;fc(null);try{a&&(g?l._selection!==null&&(c._selection=l._selection.clone()):c._selection=(function(y,x){const C=y.getEditorState()._selection,T=De(it(y));return E(C)||C==null?mo(C,T,y,x):C.clone()})(n,t&&t.event||null));const p=n._compositionKey;e(),i=Ha(n,i),(function(y,x){const C=x.getEditorState()._selection,T=y._selection;if(E(T)){const b=T.anchor,N=T.focus;let v;if(b.type==="text"&&(v=b.getNode(),v.selectionTransform(C,T)),N.type==="text"){const w=N.getNode();v!==w&&w.selectionTransform(C,T)}}})(c,n),n._dirtyType!==0&&(i?(function(y,x){const C=x._dirtyLeaves,T=y._nodeMap;for(const b of C){const N=T.get(b);O(N)&&N.isAttached()&&N.isSimpleText()&&!N.isUnmergeable()&&aa(N)}})(c,n):(function(y,x){const C=x._dirtyLeaves,T=x._dirtyElements,b=y._nodeMap,N=Lt(),v=new Map;let w=C,A=w.size,k=T,F=k.size;for(;A>0||F>0;){if(A>0){x._dirtyLeaves=new Set;for(const L of w){const B=b.get(L);O(B)&&B.isAttached()&&B.isSimpleText()&&!B.isUnmergeable()&&aa(B),B!==void 0&&Wa(B,N)&&Ba(x,B,v),C.add(L)}if(w=x._dirtyLeaves,A=w.size,A>0){ci++;continue}}x._dirtyLeaves=new Set,x._dirtyElements=new Map,k.delete("root")&&k.set("root",!0);for(const L of k){const B=L[0],Y=L[1];if(T.set(B,Y),!Y)continue;const oe=b.get(B);oe!==void 0&&Wa(oe,N)&&Ba(x,oe,v)}w=x._dirtyLeaves,A=w.size,k=x._dirtyElements,F=k.size,ci++}x._dirtyLeaves=C,x._dirtyElements=T})(c,n),Ha(n),(function(y,x,C,T){const b=y._nodeMap,N=x._nodeMap,v=[];for(const[k]of T){const F=N.get(k);F!==void 0&&(F.isAttached()||(S(F)&&mi(F,k,b,N,v,T),b.has(k)||T.delete(k),v.push(k)))}for(const k of C){const F=N.get(k);F===void 0||F.isAttached()||(tn(F)&&F.__slots!==null&&mi(F,k,b,N,v,C),b.has(k)||C.delete(k),v.push(k))}for(const k of v)N.delete(k);const w=fe(),A=w._compositionKey;A===null||N.has(A)||(w._compositionKey=null)})(l,c,n._dirtyLeaves,n._dirtyElements)),p!==n._compositionKey&&(c._flushSync=!0);const _=c._selection;if(E(_)){n._slotsUsed&&Td(_);const y=c._nodeMap,x=_.anchor.key,C=_.focus.key;y.get(x)!==void 0&&y.get(C)!==void 0||$(19)}else de(_)&&_._nodes.size===0&&(c._selection=null)}catch(p){return p instanceof Error&&n._onError(p),n._pendingEditorState=l,n._dirtyType=2,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),void un(n)}finally{Ie=u,tt=f,$e=d,n._updating=h,ci=0}n._dirtyType!==0||n._deferred.length>0||(function(p,_){const y=_.getEditorState()._selection,x=p._selection;if(x!==null){if(x.dirty||!x.is(y))return!0}else if(y!==null)return!0;return!1})(c,n)?c._flushSync?(c._flushSync=!1,un(n)):a&&um(()=>{un(n)}):(c._flushSync=!1,a&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function _t(n,e,t){$e===n&&t===void 0?_n()?yo(n,e,t):e():yo(n,e,t)}function tm(n){if(Se(n)){let e=null;for(const t of n.getChildren())e=t.isInline()?(e||t.replace(t.createParentElementNode())).append(t):null}}class ve extends Ze{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;__slotHost;__slots;$config(){return this.config(Symbol.for("ElementNode"),{$transform:tm,extends:Ze})}constructor(e){super(e),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="",this.__slotHost=null,this.__slots=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__slotHost=e.__slotHost,this.__slotHost!==null&&this.__parent!==null&&$(384,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=e.__slots),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 op[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0&&xt(this).length===0}isDirty(){const e=fe()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];for(const r of xt(this)){const o=zn(this,r);S(o)&&e.push(...o.getAllTextNodes())}let t=this.getFirstChild();for(;t!==null;){if(O(t)&&e.push(t),S(t)){const r=t.getAllTextNodes();e.push(...r)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;S(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;S(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),r=t.length;if(e>=r){const i=t[r-1];return S(i)&&i.getLastDescendant()||i||null}const o=t[e];return S(o)&&o.getFirstDescendant()||o||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:te(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&$(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:te(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&$(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let r,o;if(e<t/2){for(r=this.getFirstChild(),o=0;r!==null&&o<=e;){if(o===e)return r;r=r.getNextSibling(),o++}return null}for(r=this.getLastChild(),o=t-1;r!==null&&o>=e;){if(o===e)return r;r=r.getPreviousSibling(),o--}return null}getTextContent(){let e=lh(this);const t=this.getChildren(),r=t.length;for(let o=0;o<r;o++){const i=t[o];e+=i.getTextContent(),S(i)&&o!==r-1&&!i.isInline()&&(e+=On)}return e}getTextContentSize(){let e=(function(o){let i=0;for(const s of xt(o)){const l=zn(o,s);l!==null&&(i+=l.getTextContentSize())}return i})(this);const t=this.getChildren(),r=t.length;for(let o=0;o<r;o++){const i=t[o];e+=i.getTextContentSize(),S(i)&&o!==r-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==""){const t=pi[e];return(this.getFormat()&t)!==0}return!1}hasTextFormat(e){const t=rn[e];return(this.getTextFormat()&t)!==0}getFormatFlags(e,t){return In(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){Re();const r=M();let o=e,i=t;const s=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const c=this.getFirstChild();if(O(c)||S(c))return c.select(0,0)}else if(!(e!==void 0&&e!==s||t!==void 0&&t!==s)){const c=this.getLastChild();if(O(c)||S(c))return c.select()}}o===void 0&&(o=s),i===void 0&&(i=s);const l=this.__key;return E(r)?(r.anchor.set(l,o,"element"),r.focus.set(l,i,"element"),r.dirty=!0,r):kd(l,o,l,i,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(t=>t.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==""&&pi[e]||0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,r){Si(this)&&$(324,this.__key,this.__type);const o=this.getChildrenSize(),i=this.getWritable();e+t<=o||$(226,String(e),String(t),String(o));for(const h of r);const s=i.__key,l=[],c=[],a=this.getChildAtIndex(e+t);let u=null,f=o-t+r.length;if(e!==0)if(e===o)u=this.getLastChild();else{const h=this.getChildAtIndex(e);h!==null&&(u=h.getPreviousSibling())}if(t>0){let h=u===null?this.getFirstChild():u.getNextSibling();for(let g=0;g<t;g++){h===null&&$(100);const m=h.getNextSibling(),p=h.__key;It(h.getWritable()),c.push(p),h=m}}let d=u;for(const h of r){d!==null&&h.is(d)&&(u=d=d.getPreviousSibling());const g=h.getWritable();g.__parent===s&&f--,It(g);const m=h.__key;if(d===null)i.__first=m,g.__prev=null;else{const p=d.getWritable();p.__next=m,g.__prev=p.__key}h.__key===s&&$(76),g.__parent=s,l.push(m),d=h}if(e+t===o)d!==null&&(d.getWritable().__next=null,i.__last=d.__key);else if(a!==null){const h=a.getWritable();if(d!==null){const g=d.getWritable();h.__prev=d.__key,g.__next=a.__key}else h.__prev=null}if(i.__size=f,c.length){const h=M();if(E(h)){const g=new Set(c),m=new Set(l),{anchor:p,focus:_}=h;Ja(p,g,m)&&Ti(p,p.getNode(),this,u,a),Ja(_,g,m)&&Ti(_,_.getNode(),this,u,a),f!==0||this.canBeEmpty()||Se(this)||this.remove()}}return i}getDOMSlot(e){return new wf(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(W(t)){const r=this.getIndent();r>0&&(t.style.paddingInlineStart=40*r+"px",t.setAttribute("data-lexical-indent",String(r)));const o=this.getDirection();o&&(t.dir=o)}return{element:t}}exportJSON(){const e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),r=this.getTextStyle();return t===0&&r===""||Se(this)||this.getChildren().some(O)||(t!==0&&(e.textFormat=t),r!==""&&(e.textStyle=r)),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,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,r){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const r=St(this,e,t);let o=r.getFirstChild();for(let i=this.getFirstChild();i;i=i.getNextSibling()){const s=t.getElementByKey(i.getKey());s!==null&&(o==null?(r.insertChild(s),o=s):o!==s&&r.replaceChild(s,o),o=o.nextSibling)}}}function S(n){return n instanceof ve}function Ja(n,e,t){let r=n.getNode();for(;r;){const o=r.__key;if(e.has(o)&&!t.has(o))return!0;r=r.getParent()}return!1}class lc extends Ze{__slotHost;__slots;constructor(e){super(e),this.__slotHost=null,this.__slots=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__slotHost=e.__slotHost,this.__slotHost!==null&&this.__parent!==null&&$(383,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=e.__slots)}decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function G(n){return n instanceof lc}class rs extends ve{__cachedText;$config(){return this.config("root",{extends:ve})}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){$(51)}getTextContent(){const e=this.__cachedText;return e===null||!_n()&&fe()._dirtyType!==0?super.getTextContent():e}remove(){$(52)}replace(e){$(53)}insertBefore(e){$(54)}insertAfter(e){$(55)}updateDOM(e,t){return!1}splice(e,t,r){for(const o of r)S(o)||G(o)||$(282);return super.splice(e,t,r)}static importJSON(e){return me().updateFromJSON(e)}collapseAtStart(){return!0}}function Ee(n){return n instanceof rs}function Dd(n){return new Mo(Of(n._nodeMap),null,n._slotsUsed)}function cc(){return new Mo(new Map([["root",new rs]]),null,!1)}function gl(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType()&&$(130,t.name),S(n)){const o=e.children;Array.isArray(o)||$(59,t.name);const i=n.getChildren();for(let s=0;s<i.length;s++){const l=gl(i[s]);o.push(l)}}const r=xt(n);if(r.length>0){const o={};for(const i of r){const s=zn(n,i);s===null&&$(366,t.name,i),o[i]=gl(s)}e.$slots=o}return e}function nm(n){return n instanceof Mo}class Mo{_nodeMap;_selection;_flushSync;_readOnly;_parsed;_slotsUsed;constructor(e,t=null,r=!1){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1,this._parsed=!1,this._slotsUsed=r}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return ja(t&&t.editor||null,this,e)}clone(e){const t=new Mo(this._nodeMap,e===void 0?this._selection:e,this._slotsUsed);return t._readOnly=!0,t}toJSON(){return ja(null,this,()=>({root:gl(me())}))}}class ac extends ve{$config(){return this.config("artificial",{extends:ve})}createDOM(e){return ee().createElement("div")}}class os extends Ze{$config(){return this.config("linebreak",{importDOM:{br:e=>Rd(e)||Pd(e)?null:{conversion:rm,priority:0}}})}getTextContent(){return`
|
|
11
|
+
`}createDOM(){return ee().createElement("br")}updateDOM(){return!1}isInline(){return!0}}function rm(n){return{node:jt()}}function jt(){return Ge(new os)}function Le(n){return n instanceof os}function Rd(n){const e=n.parentElement;if(e!==null&&Fr(e)){const t=e.firstChild;if(t===n||t.nextSibling===n&&Ei(t)){const r=e.lastChild;if(r===n||r.previousSibling===n&&Ei(r))return!0}}return!1}function Pd(n){const e=n.parentElement;if(e!==null&&Fr(e)){const t=e.firstChild;if(t===n||t.nextSibling===n&&Ei(t))return!1;const r=e.lastChild;if(r===n||r.previousSibling===n&&Ei(r))return!0}return!1}function Ei(n){return ot(n)&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}class is extends ve{$config(){return this.config("paragraph",{extends:ve,importDOM:{p:()=>({conversion:om,priority:0})}})}createDOM(e){const t=ee().createElement("p"),r=yr(e.theme,"paragraph");return r!==void 0&&t.classList.add(...r),t}updateDOM(e,t,r){return!1}exportDOM(e){const{element:t}=super.exportDOM(e);if(W(t)){this.isEmpty()&&t.append(ee().createElement("br"));const r=this.getFormatType();r&&(t.style.textAlign=r)}return{element:t}}exportJSON(){const e=super.exportJSON();if(e.textFormat===void 0||e.textStyle===void 0){const t=this.getChildren().find(O);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){const r=V();r.setTextFormat(e.format),r.setTextStyle(e.style);const o=this.getDirection();return r.setDirection(o),r.setFormat(this.getFormatType()),r.setStyle(this.getStyle()),this.insertAfter(r,t),r}collapseAtStart(){const e=this.getChildren();if(e.length===0||O(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function om(n){const e=V();if(qt(e,n),Yn(n,e),e.getFormatType()===""){const t=n.getAttribute("align");t&&t&&t in pi&&e.setFormat(t)}return bt(e,n),{node:e}}function V(){return Ge(new is)}function Jt(n){return n instanceof is}function im(n){console.warn(n)}const X=0,gt=1,dt=3,Id=4,sm=-8;function Ld(n,e,t,r,o){const i=n._keyToDOMMap;i.clear(),n._editorState=cc(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=0,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,o&&o.preserveUpdateQueue||(n._updateTags=new Set,n._updates=[],n._cascadeCount=0),n._blockCursorElement=null,n._inputState.handledSelectionCommandTimeoutId!==null&&clearTimeout(n._inputState.handledSelectionCommandTimeoutId),n._inputState={collapsedSelectionFormat:{format:0,key:"root",offset:0,style:"",timeStamp:0},compositionEndData:"",compositionPhase:"idle",hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,unprocessedBeforeInputData:null};const s=n._observer;s!==null&&(s.disconnect(),n._observer=null),e!==null&&(e.textContent="",(function(l,c){const a=`__lexicalKey_${c._key}`;delete l[a]})(e,n)),t!==null&&(t.textContent="",i.set("root",t),jd(t,n,"root"))}function lm(n){const e=new Set,t=new Set;for(const{klass:r,ownNodeConfig:o}of vc(n)){const i=r.transform;if(!t.has(i)){t.add(i);const s=r.transform();s&&e.add(s)}if(o){const s=o.$transform;s&&e.add(s)}}return e}const $i={$createDOM:(n,e)=>n.createDOM(e._config,e),$decorateDOM:(n,e,t,r)=>{},$exportDOM:(n,e)=>{const t=hc(e,n.getType());return t&&t.exportDOM!==void 0?t.exportDOM(e,n):n.exportDOM(e)},$extractWithChild:(n,e,t,r,o)=>S(n)&&n.extractWithChild(e,t,r),$getDOMSlot:(n,e,t)=>n.getDOMSlot(e),$getSlotTargetElement:(n,e,t,r)=>null,$shouldExclude:(n,e,t)=>S(n)&&n.excludeFromCopy("html"),$shouldInclude:(n,e,t)=>!e||n.isSelected(e),$updateDOM:(n,e,t,r)=>n.updateDOM(e,t,r._config)};function uc(n){const e=n||{},t=Ad(),r=e.theme||{},o=n===void 0?t:e.parentEditor||null,i=e.disableEvents||!1,s=cc(),l=e.namespace||(o!==null?o._config.namespace:Jd()),c=e.editorState,a=[rs,on,os,es,is,ac,...e.nodes||[]],{onError:u,onWarn:f,html:d}=e,h=e.editable===void 0||e.editable;let g;if(n===void 0&&t!==null)g=t._nodes;else{g=new Map;for(let p=0;p<a.length;p++){let _=a[p],y=null,x=null;if(_&&typeof _=="object"){const b=_;_=b.replace,y=b.with,x=b.withKlass||null}if(typeof _!="function"||!_.prototype||!(_===Ze||_.prototype instanceof Ze)){let b="<unknown>";try{b=JSON.parse($f)}catch{}$(365,String(p-a.length+(e.nodes?e.nodes.length:0)),typeof _=="function"?`${_.name}${typeof _.getType=="function"?` (type ${String(_.getType())})`:""}`:String(_),String(b))}bc(_);const C=_.getType(),T=lm(_);g.set(C,{exportDOM:d&&d.export?d.export.get(_):void 0,klass:_,replace:y,replaceWithKlass:x,sharedNodeState:hp(a[p]),transforms:T})}}const m=new Er(s,o,g,{disableEvents:i,dom:{...$i,...n&&n.dom},namespace:l,theme:r},u||console.error,f||im,(function(p,_){const y=new Map,x=new Set,C=T=>{Object.keys(T).forEach(b=>{let N=y.get(b);N===void 0&&(N=[],y.set(b,N)),N.push(T[b])})};return p.forEach(T=>{const b=T.klass.importDOM;if(b==null||x.has(b))return;x.add(b);const N=b.call(T.klass);N!==null&&C(N)}),_&&C(_),y})(g,d?d.import:void 0),h,n);return c!==void 0&&(m._pendingEditorState=c,m._dirtyType=2),(function(p){p.registerCommand(qf,Op,X),p.registerCommand(Vf,Ap,X),p.registerCommand(Yf,Mp,X),p.registerCommand(Xf,Fp,X),p.registerCommand(Xl,Dp,X)})(m),m}function cm(n,e){const t=n.get(e);n.delete(e),t&&t()}function qr(n,e,t){return n.set(e,t),cm.bind(null,n,e)}class Er{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_cascadeCount;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_onWarn;_htmlConversions;_window;_editable;_blockCursorElement;_slotsUsed;_inputState;_createEditorArgs;constructor(e,t,r,o,i,s,l,c,a){this._createEditorArgs=a,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Ys,this._updates=[],this._updating=!1,this._cascadeCount=0,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},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=Jd(),this._onError=i,this._onWarn=s,this._htmlConversions=l,this._editable=c,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null,this._slotsUsed=!1,this._inputState={collapsedSelectionFormat:{format:0,key:"root",offset:0,style:"",timeStamp:0},compositionEndData:"",compositionPhase:"idle",hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,unprocessedBeforeInputData:null}}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){return qr(this._listeners.update,e)}registerEditableListener(e){return qr(this._listeners.editable,e)}registerDecoratorListener(e){return qr(this._listeners.decorator,e)}registerTextContentListener(e){return qr(this._listeners.textcontent,e)}registerRootListener(e){const t=this._listeners.root;return qe(qr(t,e,e(this._rootElement,null)||void 0),()=>(function(r,o,i){const s=r.get(o);s&&s(),r.set(o,o(...i)||void 0)})(t,e,[null,this._rootElement]))}registerCommand(e,t,r){r===void 0&&$(35);const o=this._commands;o.has(e)||o.set(e,[new Hr,new Hr,new Hr,new Hr,new Hr]);const i=o.get(e);i===void 0&&$(36,String(e));const s=(function(c){return 7&c})(r),l=i[s];return s!==r?l.addFront(t):l.addBack(t),()=>{l.delete(t),i.every(c=>c.size===0)&&o.delete(e)}}registerMutationListener(e,t,r){const o=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation;let s=i.get(t);s===void 0&&(s=new Set,i.set(t,s)),s.add(o);const l=r&&r.skipInitialization;return l!==void 0&&l||this.initializeMutationListener(t,o),()=>{s.delete(o),s.size===0&&i.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&$(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const r=this._editorState,o=Za(r).get(t.getType());if(!o)return;const i=new Map;for(const s of o.keys())i.set(s,"created");i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:r,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const r=this.getRegisteredNode(e);return r.transforms.add(t),r}registerNodeTransform(e,t){const r=this.registerNodeTransformToKlass(e,t),o=[r],i=r.replaceWithKlass;if(i!=null){const s=this.registerNodeTransformToKlass(i,t);o.push(s)}return(function(s,l){const c=Za(s.getEditorState()),a=[];for(const u of l){const f=c.get(u);f&&a.push(f)}a.length!==0&&s.update(()=>{for(const u of a)for(const f of u.keys()){const d=te(f);d&&d.markDirty()}},s._pendingEditorState===null?{tag:mr}:void 0)})(this,o.map(s=>s.klass.getType())),()=>{o.forEach(s=>s.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,...t){return D(this,e,...t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const r=yr(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=e,Ld(this,t,e,o,{preserveUpdateQueue:!0}),t!==null&&(this._config.disableEvents||Rp(t),r!=null&&t.classList.remove(...r)),e!==null){const i=Cc(e),s=e.style;s.userSelect="text",s.whiteSpace="pre-wrap",s.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=i,this._dirtyType=2,Df(this),this._updateTags.add(mr),un(this),this._config.disableEvents||(function(l,c){const a=l.ownerDocument;sl.set(l,a);let u=xi.get(a);u===void 0&&(u={editors:new Set,hasShadowEditor:void 0},xi.set(a,u)),u.editors.add(c),u.hasShadowEditor=void 0,l.__lexicalEditor=c;const f=ad(l);f.push($p.register(a));for(let d=0;d<il.length;d++){const[h,g]=il[d],m=typeof g=="function"?p=>{va(p)||(ba(p),(c.isEditable()||h==="click")&&g(p,c))}:p=>{if(va(p))return;ba(p);const _=c.isEditable();switch(h){case"cut":return _&&D(c,Zi,p);case"copy":return D(c,Oo,p);case"paste":return _&&D(c,Lr,p);case"dragstart":return _&&D(c,nd,p);case"dragover":return _&&D(c,rd,p);case"dragend":return _&&D(c,vp,p);case"focus":return _&&D(c,od,p);case"blur":return _&&D(c,kp,p);case"drop":return _&&D(c,ed,p)}};f.push(oo(l,h,m))}})(e,this),r!=null&&e.classList.add(...r)}else this._window=null,this._updateTags.add(mr),un(this);io("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&$(38);let r=e;r._readOnly&&(r=Dd(e),r._selection=e._selection?e._selection.clone():null),Ff(this);const o=this._pendingEditorState,i=t!==void 0?t.tag:null;o===null||o.isEmpty()||(i!=null&&this._updateTags.add(i),un(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,this._slotsUsed=this._slotsUsed||e._slotsUsed,_t(this,()=>{if(i&&this._updateTags.add(i),e._parsed)for(const[s,l]of r._nodeMap.entries())S(l)?this._dirtyElements.set(s,!0):this._dirtyLeaves.add(s)},{discrete:!this._updating||void 0})}parseEditorState(e,t){return(function(r,o,i){const s=cc(),l=Ie,c=tt,a=$e,u=o._dirtyElements,f=o._dirtyLeaves,d=o._cloneNotNeeded,h=o._dirtyType;o._dirtyElements=new Map,o._dirtyLeaves=new Set,o._cloneNotNeeded=new Set,o._dirtyType=0,Ie=s,tt=!1,$e=o,fc(null);try{const g=o._nodes;wi(r.root,g),i&&i(),s._readOnly=!0,s._parsed=!0}catch(g){g instanceof Error&&o._onError(g)}finally{o._dirtyElements=u,o._dirtyLeaves=f,o._cloneNotNeeded=d,o._dirtyType=h,Ie=l,tt=c,$e=a}return s})(typeof e=="string"?JSON.parse(e):e,this,t)}read(...e){const[t,r]=e.length===1?["force-commit",e[0]]:e;return t==="force-commit"&&un(this),(t==="pending"?this._pendingEditorState||this._editorState:this.getEditorState()).read(r,{editor:this})}update(e,t){(function(r,o,i){r._updating?r._updates.push([o,i]):yo(r,o,i)})(this,e,t)}focus(e,t={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),_t(this,()=>{const o=M(),i=me();o!==null?o.dirty||pe(o.clone()):i.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),Or("focus"),pm(()=>{r.removeAttribute("autocapitalize"),e&&e()})}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=De(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,io("editable",this,!0,e),this._slotsUsed&&this.update(()=>$d()))}toJSON(){return{editorState:this._editorState.toJSON()}}}Er.version=$f;let pl=null;function fc(n){pl=n}const dc=Symbol("INTERNAL_SKIP_AFTER_CLONE_FROM");let am=1;function Kd(n,e){const t=hc(n,e);return t===void 0&&$(30,e),t}function hc(n,e){return n._nodes.get(e)}const um=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function gc(n,e){const t=e!==void 0?e:(()=>{const i=n.getRootNode();return Cn(i)||Ut(i)?Mr(i):null})();if(!W(t)||t.hasAttribute("data-lexical-slot"))return!1;const r=Xe(t),o=t.nodeName;return fd(r)&&(o==="INPUT"||o==="TEXTAREA"||t.contentEditable==="true"&&Kr(t)==null)}function Fo(n,e,t){const r=n.getRootElement();if(!r)return!1;try{if(!e||!r.contains(e)||!r.contains(t))return!1}catch{return!1}return _r(e)===n&&n.read("latest",()=>!gc(e))}function Do(n){return n instanceof Er}function _r(n){let e=n;for(;e!=null;){const t=Kr(e);if(Do(t))return t;e=Vn(e)}return null}function Kr(n){return n?n.__lexicalEditor:null}function Oi(n){return kr(n)||n.isToken()}function yt(n){return Oi(n)||n.isSegmented()}function ot(n){return At(n)&&n.nodeType===3}function Cn(n){return At(n)&&n.nodeType===9}function fm(n){let e=n;for(;e!=null;){if(ot(e))return e;e=e.firstChild}return null}function In(n,e,t){const r=rn[e];if(t!==null&&(n&r)===(t&r))return n;let o=n^r;return e==="subscript"?o&=-65:e==="superscript"?o&=-33:e==="lowercase"?(o&=-513,o&=-1025):e==="uppercase"?(o&=-257,o&=-1025):e==="capitalize"&&(o&=-257,o&=-513),o}function zd(n){return O(n)||Le(n)||G(n)}function Bd(n,e){const t=(function(){const s=pl;return pl=null,s})();if((e=e||t&&t.__key)!=null)return void(n.__key=e);Re(),Ed();const r=fe(),o=cn(),i=""+am++;o._nodeMap.set(i,n),S(n)?r._dirtyElements.set(i,!0):r._dirtyLeaves.add(i),r._cloneNotNeeded.add(i),r._dirtyType===0&&(r._dirtyType=1),n.__key=i}function It(n){We(n)!==null&&$(380,n.__key,String(We(n)));const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),o=n.getPreviousSibling(),i=n.getNextSibling(),s=i!==null?i.__key:null,l=o!==null?o.__key:null,c=o!==null?o.getWritable():null,a=i!==null?i.getWritable():null;o===null&&(r.__first=s),i===null&&(r.__last=l),c!==null&&(c.__next=s),a!==null&&(a.__prev=l),t.__prev=null,t.__next=null,t.__parent=null,r.__size--}}function Ai(n){Ed(),Si(n)&&$(323,n.__key,n.__type);const e=n.getLatest(),t=e.__parent!==null?e.__parent:Kn(e)?e.__slotHost:null,r=cn(),o=fe(),i=r._nodeMap,s=o._dirtyElements;t!==null&&(function(c,a,u){let f=c;for(;f!==null;){if(u.has(f))return;const d=a.get(f);if(d===void 0)break;u.set(f,!1),f=d.__parent!==null?d.__parent:Kn(d)?d.__slotHost:null}})(t,i,s);const l=e.__key;o._dirtyType===0&&(o._dirtyType=1),S(n)?s.set(l,!0):o._dirtyLeaves.add(l)}function Pe(n){Re();const e=fe(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const r=te(t);r!==null&&r.getWritable()}if(n!==null){const r=te(n);r!==null&&r.getWritable()}}}function Lt(){return _n()?null:fe()._compositionKey}function te(n,e){const t=(e||cn())._nodeMap.get(n);return t===void 0?null:t}function Wd(n,e){const t=zr(n,fe());return t!==void 0?te(t,e):null}function jd(n,e,t){n[`__lexicalKey_${e._key}`]=t}function zr(n,e){return n[`__lexicalKey_${e._key}`]}function Xe(n,e){let t=n;for(;t!=null;){const r=Wd(t,e);if(r!==null)return r;t=Vn(t)}return null}function Ud(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function qa(n){return n.read(()=>me().getTextContent())}function me(){return cn()._nodeMap.get("root")}function pe(n){Re();const e=cn();n!==null&&(n.dirty=!0,n.setCachedNodes(null),E(n)&&fe()._slotsUsed&&Td(n)),e._selection=n}function Va(){Re(),Ff(fe())}function ur(n){const e=(function(t,r){let o=t;for(;o!=null;){const i=zr(o,r);if(i!==void 0)return i;o=Vn(o)}return null})(n,fe());return e===null?null:te(e)}function Hd(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function pc(n){const e=[];for(let t=n;t!==null;t=t._parentEditor)e.push(t);return e}function Jd(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function qd(n){return ot(n)?n.nodeValue:null}function mc(n,e,t){const r=De(it(e));if(r===null)return;const o=rt(r,e._rootElement),i=o.anchorNode;let{anchorOffset:s,focusOffset:l}=o;if(i!==null){let c=qd(i);const a=Xe(i);if(c!==null&&O(a)){if((c===co||c===Vl)&&t){const u=t.length;c=t,s=u,l=u}c!==null&&_c(a,c,s,l,n)}}}function _c(n,e,t,r,o){let i=n;if(i.isAttached()&&(o||!i.isDirty())){const s=i.isComposing();if(i.isToken()&&s)return;let l=e;if((s||o)&&(e.endsWith(co)&&(l=e.slice(0,-co.length)),o)){const a=Vl;let u;for(;(u=l.indexOf(a))!==-1;)l=l.slice(0,u)+l.slice(u+a.length),t!==null&&t>u&&(t=Math.max(u,t-a.length)),r!==null&&r>u&&(r=Math.max(u,r-a.length))}const c=i.getTextContent();if(o||l!==c){const a=M();if(l===""){if(Pe(null),ko||mn||wo)i.remove();else{const m=fe();As(i,"",a),setTimeout(()=>{m.update(()=>{i.isAttached()&&i.getTextContent()===""&&i.remove()})},20)}return}const u=i.getParent(),f=ct(),d=i.getTextContentSize(),h=Lt(),g=i.getKey();if(i.isToken()&&!s||h!==null&&g===h&&!s||E(f)&&(u!==null&&!u.canInsertTextBefore()&&f.anchor.offset===0||f.anchor.key===n.__key&&f.anchor.offset===0&&!i.canInsertTextBefore()&&!s||f.focus.key===n.__key&&f.focus.offset===d&&!i.canInsertTextAfter()&&!s))return void i.markDirty();if(!E(a)||t===null||r===null)return void As(i,l,a);if(a.setTextNodeRange(i,t,i,r),i.isSegmented()){const m=Ne(i.getTextContent());i.replace(m),i=m}As(i,l,a)}}}function As(n,e,t){if(n.setTextContent(e),E(t)){const r=n.getKey();let o=!1;for(const i of["anchor","focus"]){const s=t[i];s.type==="text"&&s.key===r&&(s.offset=Bt(n,s.offset,"clamp"),o=!0)}o&&(t._cachedNodes=null,t._cachedIsBackward=null)}}function Bo(n,e,t){const r=e[t]||!1;return r==="any"||r===n[t]}function dm(n,e){return Bo(n,e,"altKey")&&Bo(n,e,"ctrlKey")&&Bo(n,e,"shiftKey")&&Bo(n,e,"metaKey")}function _e(n,e,t){if(!dm(n,t))return!1;if(n.key.toLowerCase()===e.toLowerCase())return!0;if(e.length>1||n.key.length===1&&n.key.charCodeAt(0)<=127)return!1;if(n.code.startsWith("Digit")&&/^\d$/.test(e))return n.code===`Digit${e}`;const r="Key"+e.toUpperCase();return n.code===r}const Xt={ctrlKey:!Tt,metaKey:Tt},Ya={altKey:Tt,ctrlKey:!Tt};function Xa(n){return n.key==="Backspace"}function hm(n){const e=me();if(E(n)){const t=n.anchor,r=n.focus,o=t.getNode();if(Ee(o))return t.set(o.getKey(),0,"element"),r.set(o.getKey(),o.getChildrenSize(),"element"),Dt(n),n;const i=o.getTopLevelElementOrThrow(),s=i.getParent();if(s===null)return S(i)&&(t.set(i.getKey(),0,"element"),r.set(i.getKey(),i.getChildrenSize(),"element"),Dt(n)),n;const l=s;return t.set(l.getKey(),0,"element"),r.set(l.getKey(),l.getChildrenSize(),"element"),Dt(n),n}{const t=e.select(0,e.getChildrenSize());return pe(Dt(t)),t}}function yr(n,e){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const t=n.__lexicalClassNameCache,r=t[e];if(r!==void 0)return r;const o=n[e];if(typeof o=="string"){const i=nn(o);return t[e]=i,i}return o}function yc(n,e,t,r,o){if(t.size===0)return;const i=r.__type,s=r.__key,l=e.get(i);l===void 0&&$(33,i);const c=l.klass;let a=n.get(c);a===void 0&&(a=new Map,n.set(c,a));const u=a.get(s),f=u==="destroyed"&&o==="created";(u===void 0||f)&&a.set(s,f?"updated":o)}function Ga(n,e,t){const r=n.getParent();let o=t,i=n;return r!==null&&(t===0&&(o=i.getIndexWithinParent(),i=r)),i.getChildAtIndex(o-1)}function gm(n,e){const t=n.offset;if(n.type==="element")return Ga(n.getNode(),e,t);{const r=n.getNode();if(t===0||!e){const o=r.getPreviousSibling();return o===null?Ga(r.getParentOrThrow(),e,r.getIndexWithinParent()+0):o}}return null}function Vd(n){const e=it(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function D(n,e,...t){return Fd(n,e,t[0],n)}function $r(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&$(75,e),t}function Vn(n){const e=n.assignedSlot||n.parentElement;if(e!==null)return e;const t=n.parentNode;return Ut(t)?t.host:null}function xc(n){return Cn(n)?n:W(n)?n.ownerDocument:null}function Or(n){Re(),fe()._updateTags.add(n)}function pm(n){Re(),fe()._deferred.push(n)}function Ar(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Cc(n){const e=xc(n);return e?e.defaultView:null}function it(n){const e=n._window;return e===null&&$(78),e}function Sc(n){return S(n)&&n.isInline()||G(n)&&n.isInline()}function Yd(n){let e=n.getLatest();for(;e!==null;){if(We(e)!==null&&S(e))return e;const t=e.getParentOrThrow();if(Se(t))return t;e=t}return e}function so(n){return S(n)&&n.isShadowRoot()}function Se(n){return Ee(n)||so(n)}function Be(n,e=!1){const t=n.constructor.clone(n,dc);return Bd(t,null),t.afterCloneFrom(n),e||t.resetOnCopyNodeFrom(n),t}function Ge(n){const e=fe(),t=n.getType(),r=hc(e,t);r===void 0&&$(200,n.constructor.name,t);const{replace:o,replaceWithKlass:i}=r;if(o!==null){const s=o(n),l=s.constructor;return i!==null?s instanceof i||$(201,i.name,i.getType(),l.name,l.getType(),n.constructor.name,t):s instanceof n.constructor&&l!==n.constructor||$(202,l.name,l.getType(),n.constructor.name,t),s.__key===n.__key&&$(203,n.constructor.name,t,l.name,l.getType()),s}return n}function Ms(n,e){!Ee(n.getParent())||S(e)||G(e)||$(99)}function Xd(n){const e=te(n);return e===null&&$(63,n),e}function ai(n){if(!n||n.isInline())return!1;if(G(n))return!0;if(S(n)){if(n.isShadowRoot()){const e=n.getParent();return!(S(e)&&e.isShadowRoot())}return!n.canBeEmpty()}return!1}function Mi(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function De(n){return Ve?(n||window).getSelection():null}function mm(n){const e=Cc(n);return e?e.getSelection():null}function Ut(n){return ml(n)&&"host"in n}const _m=[];function Gd(n){const e=n.getRootNode();if(e===n||!Ut(e))return _m;const t=[e];let r=e.host;for(;;){const o=r.getRootNode();if(o===r||!Ut(o))break;t.push(o),r=o.host}return t}function*Qd(n){const e=[n];let t;for(;t=e.pop();){yield*t.querySelectorAll('[data-lexical-editor="true"]');const r=(Cn(t)?t:t.ownerDocument).createTreeWalker(t,NodeFilter.SHOW_ELEMENT);let o;for(;o=r.nextNode();)o.shadowRoot&&e.push(o.shadowRoot)}}function Zd(n){return n!==null?n.ownerDocument:document}function ee(){const n=Ad();return Zd(n!==null?n._rootElement:null)}function ss(n,e){if(e===null||typeof n.getComposedRanges!="function")return null;const t=Gd(e);if(t.length===0)return null;const r=n.getComposedRanges;try{const o=r.call(n,{shadowRoots:t})[0];if(o!==void 0)return o}catch{}try{const o=r.apply(n,t)[0];if(o!==void 0)return o}catch{}return null}function eh(n,e){const t=ss(n,e);if(t!==null){const r=ym(t);if(r!==null)return r}return n.rangeCount>0?n.getRangeAt(0):null}function rt(n,e){const t=ss(n,e);return t===null?n:xm(t,Cm(n))}function ym(n){const e=n.startContainer.ownerDocument;if(e===null)return null;const t=e.createRange();try{return t.setStart(n.startContainer,n.startOffset),t.setEnd(n.endContainer,n.endOffset),t}catch{return null}}function xm(n,e){const{startContainer:t,startOffset:r,endContainer:o,endOffset:i}=n;return e==="backward"?{anchorNode:o,anchorOffset:i,direction:e,focusNode:t,focusOffset:r}:{anchorNode:t,anchorOffset:r,direction:e,focusNode:o,focusOffset:i}}function Cm(n){return n.direction}function xo(n){const e=n.getRootNode();return Cn(e)||Ut(e)?e.activeElement:null}function Mr(n){let e=n.activeElement;for(;e!==null&&e.shadowRoot!==null;){const t=e.shadowRoot.activeElement;if(t===null)break;e=t}return e}function Ln(n){const e=n.target;if(e!==null&&W(e)&&e.shadowRoot!==null&&typeof n.composedPath=="function"){const t=n.composedPath();if(t.length>0)return t[0]}return e}function th(n){return W(n)&&n.tagName==="A"}function Sm(n){return W(n)&&n.tagName==="TR"}function W(n){return At(n)&&n.nodeType===1}function At(n){return typeof n=="object"&&n!==null&&"nodeType"in n&&typeof n.nodeType=="number"}function ml(n){return At(n)&&n.nodeType===11}const bm=/^(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;function Fi(n){return!(!W(n)||!n.style.display.startsWith("inline"))||bm.test(n.nodeName)}const vm=/^(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;function Fr(n){return(!W(n)||!n.style.display.startsWith("inline"))&&vm.test(n.nodeName)}function ze(n){if(G(n)&&!n.isInline())return!0;if(!S(n)||Se(n))return!1;const e=n.getFirstChild(),t=e===null||Le(e)||O(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function be(){return fe()}function ls(n=be()){return n._config.dom||$i}function St(n,e,t=be()){const r=ls(t).$getDOMSlot(n,e,t);return S(n)&&(Tm(r)||$(344,n.getKey(),n.getType())),r}function Tm(n){return n instanceof wf}function pn(n,e,t=be()){return fm(St(n,e,t).element)}const Qa=new WeakMap,Nm=new Map;function Za(n){if(!n._readOnly&&n.isEmpty())return Nm;n._readOnly||$(192);let e=Qa.get(n);return e||(e=(function(t){const r=new Map;for(const[o,i]of t._nodeMap){const s=i.__type;let l=r.get(s);l||(l=new Map,r.set(s,l)),l.set(o,i)}return r})(n),Qa.set(n,e)),e}function nh(n){const e=n.constructor.clone(n,dc);return e.afterCloneFrom(n),e}function km(n){return(e=nh(n))[ud]=!0,e;var e}function Yn(n,e){const t=n.getAttribute("data-lexical-indent");if(t!==null){const i=parseInt(t,10);if(Number.isFinite(i)&&i>=0)return void e.setIndent(i)}const r=parseInt(n.style.paddingInlineStart,10)||0,o=Math.round(r/40);e.setIndent(o)}function bt(n,e){const t=e.getAttribute("dir");return t==="ltr"||t==="rtl"?n.setDirection(t):n}function qt(n,e){const t=e.style.textAlign;return t&&t in pi?n.setFormat(t):n}function Di(n,e){n.__lexicalUnmanaged=!0,e&&e.captureSelection!==void 0&&(n.__lexicalCapturedSelection=e.captureSelection)}function rh(n){return n.__lexicalUnmanaged===!0}function wm(n,e=be()){const t=e.isEditable();n.contentEditable=t?"true":"false",t?n.__lexicalEditor=e:delete n.__lexicalEditor}function Ri(n,e){let t=n;for(;t!=null;){if(t.__lexicalCapturedSelection===!0)return!0;if(W(t)&&t.hasAttribute("data-lexical-slot")||zr(t,e)!==void 0)return!1;t=Vn(t)}return!1}function Vr(n,e){return(function(t,r){return Object.prototype.hasOwnProperty.call(t,r)})(n,e)&&n[e]!==Ze[e]}const eu=new WeakMap,tu=Symbol("lexical.synthesizedGetType");function bc(n){const e=eu.get(n);if(e)return e;const t=n.prototype!=null&&Gc in n.prototype?n.prototype[Gc]():void 0,r=(function(a){if(!(a===Ze||a.prototype instanceof Ze)){let u="<unknown>",f="<unknown>";try{u=a.getType()}catch{}try{Er.version&&(f=JSON.parse(Er.version))}catch{}$(290,a.name,u,f)}return a===lc||a===ve||a===Ze})(n),o=!r&&Vr(n,"getType")?n.getType:void 0,i=o&&!(tu in o)?o.call(n):void 0;let s,l=i;if(t)if(i)s=t[i];else{for(const[a,u]of Object.entries(t))l=a,s=u;if(!s)for(const a of Object.getOwnPropertySymbols(t)){const u=t[a];if(u){s=u;break}}}if(!r&&l){if(!Vr(n,"getType")){const a=n,u=function(){return this!==a?Ze.getType.call(this):l};u[tu]=!0,n.getType=u}if(Vr(n,"clone")||(n.clone=(a,u)=>{fc(a);const f=new n;return u!==dc&&f.afterCloneFrom(a),f}),Vr(n,"importJSON")||(n.importJSON=s&&s.$importJSON||(a=>new n().updateFromJSON(a))),!Vr(n,"importDOM")&&s){const{importDOM:a}=s;a&&(n.importDOM=()=>a)}}const c={klass:n,ownNodeConfig:s,ownNodeType:l};return eu.set(n,c),c}function*vc(n){for(let e=n;e&&(e===Ze||fd(e.prototype));){const t=bc(e);yield t,e=t.ownNodeConfig&&t.ownNodeConfig.extends||ih(e)}}function oh(n){const e=be();return Re(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(n))).klass}const U=(n,e)=>{let t=n;for(;t!=null&&!Ee(t);){if(e(t))return t;t=t.getParent()}return null};function Pi(n,e){const t=[];let r=n.__first;for(;r!==null;){const o=e===null?te(r):e.get(r);o==null&&$(174),t.push(r),r=o.__next}return t}function ih(n){const e=Object.getPrototypeOf(n);if(typeof e=="function"&&e!==Function.prototype)return e;const t=n.prototype&&Object.getPrototypeOf(n.prototype);return t?t.constructor:null}const sh=new Map;function tn(n){return S(n)||G(n)}function Kn(n){return S(n)||G(n)}function We(n){const e=n.getLatest();return Kn(e)?e.__slotHost:null}function mt(n){const e=We(n);if(e===null)return null;const t=te(e);return S(t)||G(t)||$(370),t}function Em(n){const e=mt(n);if(e===null)return null;const t=n.getLatest().__key;for(const[r,o]of as(e))if(o===t)return r;return null}function cs(n){let e=n.getLatest();for(;e!==null;){if(We(e)!==null)return e;e=e.getParent()}return null}function as(n){const e=n.getLatest();return tn(e)&&e.__slots!==null?e.__slots:sh}function xt(n){return Array.from(as(n).keys())}function zn(n,e){const t=as(n).get(e);return t===void 0?null:te(t)}const $m=["__proto__","constructor","prototype"],nu=Symbol("slotMapOwner");function _l(n){let e=n.__slots;return e!==null&&e[nu]===n||(e=new Map(e),e[nu]=n,n.__slots=e),e}const ru=new WeakMap,Om=[];function Am(n){for(const{ownNodeConfig:e}of vc(n)){const t=e&&e.slots;if(t)return t}return Om}function lh(n){let e="";for(const t of xt(n)){const r=zn(n,t);r!==null&&(e+=r.getTextContent())}return e}function ou(n,e,t){const r=t.get(n),o=t.get(e);return r!==void 0?o!==void 0?r-o:-1:o!==void 0?1:n<e?-1:n>e?1:0}function Mm(n){const e=n.__slots;if(e===null||e.size<2)return;const t=(function(s){let l=ru.get(s);if(l===void 0){const c=Am(s),a=new Map;for(const u of c)$m.includes(u)&&$(371,s.name,u),a.has(u)&&$(372,s.name,u),a.set(u,a.size);l=a,ru.set(s,l)}return l})(n.constructor);let r=null,o=!0;for(const s of e.keys()){if(r!==null&&ou(r,s,t)>0){o=!1;break}r=s}if(o)return;const i=Array.from(e).sort(([s],[l])=>ou(s,l,t));e.clear();for(const[s,l]of i)e.set(s,l)}function ch(n,e,t){e!=="__proto__"&&e!=="constructor"&&e!=="prototype"||$(373,e);const r=n.getLatest();if(r.__slots!==null&&r.__slots.get(e)===t.getLatest().__key)return r;(!S(t)&&!G(t)||t.isInline())&&$(374,t.__key);const o=n.getWritable(),i=_l(o),s=i.get(e);s!==void 0&&ah(s);const l=t.getWritable(),c=mt(l);if(c!==null){const a=Em(l);a!==null&&_l(c.getWritable()).delete(a),l.__slotHost=null}return It(l),l.__slotHost=o.__key,i.set(e,l.__key),Mm(o),(function(){const a=be();a._slotsUsed=!0,a._pendingEditorState&&(a._pendingEditorState._slotsUsed=!0)})(),o}function Fm(n,e){const t=n.getWritable();if(t.__slots===null)return t;const r=t.__slots.get(e);return r!==void 0&&(ah(r),_l(t).delete(e)),t}function ah(n){const e=te(n);if(e===null)return;const t=e.getWritable();Kn(t)||$(377,n),t.__slotHost=null,t.remove()}const Dm={next:"previous",previous:"next"};class Tc{origin;constructor(e){this.origin=e}[Symbol.iterator](){return us({hasNext:Mt,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return ne(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return ne(this.origin,this.direction)}remove(){const e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){const r=this.getNodeAtCaret();return e.is(this.origin)||e.is(r)||(r===null?this.insert(e):r.replace(e,t)),this}splice(e,t,r="next"){const o=r===this.direction?t:Array.from(t).reverse();let i=this;const s=this.getParentAtCaret(),l=new Map;for(let c=i.getAdjacentCaret();c!==null&&l.size<e;c=c.getAdjacentCaret()){const a=c.origin.getWritable();l.set(a.getKey(),a)}for(const c of o){if(l.size>0){const a=i.getNodeAtCaret();if(a){if(l.delete(a.getKey()),l.delete(c.getKey()),!(a.is(c)||i.origin.is(c))){const u=c.getParent();u&&u.is(s)&&c.remove(),a.replace(c)}}else a===null&&$(263,Array.from(l).join(" "))}else i.insert(c);i=ne(c,this.direction)}for(const c of l.values())c.remove();return this}}class Co extends Tc{type="child";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Fe(e,this.direction)}getParentCaret(e="root"){return ne(Nc(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Sn(this.direction);return ne(this.getNodeAtCaret(),e)||Fe(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof Co&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const Rm={root:Ee,shadowRoot:Se};function Sn(n){return Dm[n]}function Nc(n,e="root"){return n===null||Rm[e](n)?null:We(n)===null?n:null}class Bn extends Tc{type="sibling";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:ne(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return S(this.origin)?Fe(this.origin,this.direction):null}getParentCaret(e="root"){return ne(Nc(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Sn(this.direction);return ne(this.getNodeAtCaret(),e)||Fe(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof Bn&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof Bn||e instanceof Wn)&&this.direction===e.direction&&this.origin.is(e.origin)}}class Wn extends Tc{type="text";offset;constructor(e,t){super(e),this.offset=t}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:yn(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return ne(Nc(this.getParentAtCaret(),e),this.direction)}getFlipped(){return yn(this.origin,Sn(this.direction),this.offset)}isSamePointCaret(e){return e instanceof Wn&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof Bn||e instanceof Wn)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return ne(this.origin,this.direction)}}function Ct(n){return n instanceof Wn}function Mt(n){return n instanceof Bn}function He(n){return n instanceof Co}const Pm={next:class extends Wn{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(n){return this.origin.insertAfter(n),this}},previous:class extends Wn{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(n){return this.origin.insertBefore(n),this}}},Im={next:class extends Bn{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(n){return this.origin.insertAfter(n),this}},previous:class extends Bn{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(n){return this.origin.insertBefore(n),this}}},Lm={next:class extends Co{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(n){return this.origin.splice(0,0,[n]),this}},previous:class extends Co{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(n){return this.origin.splice(this.origin.getChildrenSize(),0,[n]),this}}};function ne(n,e){return n?new Im[e](n):null}function yn(n,e,t){return n?new Pm[e](n,Bt(n,t)):null}function Bt(n,e,t="error"){const r=n.getTextContentSize();let o=e==="next"?r:e==="previous"?0:e;return(o<0||o>r)&&(t!=="clamp"&&vf(284,String(e),String(r),n.getKey()),o=o<0?0:r),o}function iu(n,e){return new zm(n,e)}function Fe(n,e){return S(n)?new Lm[e](n):null}function Km(n){return n&&n.getChildCaret()||n}function jn(n){return n&&Km(n.getAdjacentCaret())}class kc{type="node-caret-range";direction;anchor;focus;constructor(e,t,r){this.anchor=e,this.focus=t,this.direction=r}getLatest(){const e=this.anchor.getLatest(),t=this.focus.getLatest();return e===this.anchor&&t===this.focus?this:new kc(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=o=>{const i=this[o].getLatest();return Ct(i)?(function(s,l){const{direction:c,origin:a}=s,u=Bt(a,l==="focus"?Sn(c):c);return iu(s,u-s.offset)})(i,o):null},t=e("anchor"),r=e("focus");if(t&&r){const{caret:o}=t,{caret:i}=r;if(o.isSameNodeCaret(i))return[iu(o,i.offset-o.offset),null]}return[t,r]}iterNodeCarets(e="root"){const t=Ct(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),r=this.focus.getLatest(),o=Ct(r),i=s=>s.isSameNodeCaret(r)?null:jn(s)||s.getParentCaret(e);return us({hasNext:s=>s!==null&&!(o&&r.isSameNodeCaret(s)),initial:t.isSameNodeCaret(r)?null:i(t),map:s=>s,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class zm{type="slice";caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){const{distance:e,caret:{offset:t}}=this,r=t+e;return r<t?[r,t]:[t,r]}getTextContent(){const[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:e,direction:t}}=this,[r,o]=this.getSliceIndices(),i=e.getTextContent();return yn(e.setTextContent(i.slice(0,r)+i.slice(o)),t,r)}}function Dr(n){return Et(n,ne(me(),n.direction))}function Ro(n){return Et(n,n)}function Et(n,e){return n.direction!==e.direction&&$(265),new kc(n,e,n.direction)}function us(n){const{initial:e,hasNext:t,step:r,map:o}=n;let i=e;return{[Symbol.iterator](){return this},next(){if(!t(i))return{done:!0,value:void 0};const s={done:!1,value:o(i)};return i=r(i),s}}}function So(n,e){const t=yl(n.origin,e.origin);switch(t===null&&$(275,n.origin.getKey(),e.origin.getKey()),t.type){case"same":{const r=n.type==="text",o=e.type==="text";return r&&o?(function(i,s){return Math.sign(i-s)})(n.offset,e.offset):n.type===e.type?0:r?-1:o?1:n.type==="child"?-1:1}case"ancestor":return n.type==="child"?-1:1;case"descendant":return e.type==="child"?1:-1;case"branch":return uh(t)}}function uh(n){const{a:e,b:t}=n,r=e.__key,o=t.__key;let i=e,s=t;for(;i&&s;i=i.getNextSibling(),s=s.getNextSibling()){if(i.__key===o)return-1;if(s.__key===r)return 1}return i===null?1:-1}function Wo(n,e){return e.is(n)}function su(n){return S(n)?[n.getLatest(),null]:[n.getParent(),n.getLatest()]}function yl(n,e){if(n.is(e))return{commonAncestor:n,type:"same"};const t=new Map;for(let[r,o]=su(n);r;o=r,r=r.getParent())t.set(r,o);for(let[r,o]=su(e);r;o=r,r=r.getParent()){const i=t.get(r);if(i!==void 0)return i===null?(Wo(n,r)||$(276),{commonAncestor:r,type:"ancestor"}):o===null?(Wo(e,r)||$(277),{commonAncestor:r,type:"descendant"}):((S(i)||Wo(n,i))&&(S(o)||Wo(e,o))&&r.is(i.getParent())&&r.is(o.getParent())||$(278),{a:i,b:o,commonAncestor:r,type:"branch"})}return null}function Je(n,e){const{type:t,key:r,offset:o}=n,i=Xd(n.key);return t==="text"?(O(i)||$(266,i.getType(),r),yn(i,e,o)):(S(i)||$(267,i.getType(),r),Cl(i,n.offset,e))}function wt(n,e){const{origin:t,direction:r}=e,o=r==="next";Ct(e)?n.set(t.getKey(),e.offset,"text"):Mt(e)?O(t)?n.set(t.getKey(),Bt(t,r),"text"):n.set(t.getParentOrThrow().getKey(),t.getIndexWithinParent()+(o?1:0),"element"):(He(e)&&S(t)||$(268),n.set(t.getKey(),o?0:t.getChildrenSize(),"element"))}function Rr(n){const e=M(),t=E(e)?e:sc();return ui(t,n),pe(t),t}function ui(n,e){wt(n.anchor,e.anchor),wt(n.focus,e.focus)}function xl(n){const{anchor:e,focus:t}=n,r=Je(e,"next"),o=Je(t,"next"),i=So(r,o)<=0?"next":"previous";return Et(sn(r,i),sn(o,i))}function bn(n){const{direction:e,origin:t}=n,r=ne(t,Sn(e)).getNodeAtCaret();return r?ne(r,e):Fe(t.getParentOrThrow(),e)}function lu(n,e="root"){const t=[n];for(let r=He(n)?n.getParentCaret(e):n.getSiblingCaret();r!==null;r=r.getParentCaret(e))t.push(bn(r));return t}function Fs(n){return!!n&&n.origin.isAttached()}function Bm(n,e="removeEmptySlices"){if(n.isCollapsed())return n;const t="root",r="next";let o=e;const i=wc(n,r),s=lu(i.anchor,t),l=lu(i.focus.getFlipped(),t),c=new Set,a=[];for(const m of i.iterNodeCarets(t))if(He(m))c.add(m.origin.getKey());else if(Mt(m)){const{origin:p}=m;S(p)&&!c.has(p.getKey())||a.push(p)}const u=new Set;for(const m of a){const p=m.getParent();p===null||c.has(p.getKey())||u.add(p),It(m)}for(const m of u)!m.canBeEmpty()&&!Se(m)&&m.isEmpty()&&m.isAttached()&&m.remove();for(const m of i.getTextSlices()){if(!m)continue;const{origin:p}=m.caret,_=p.getTextContentSize(),y=bn(ne(p,r)),x=p.getMode();if(Math.abs(m.distance)===_&&o==="removeEmptySlices"||x==="token"&&m.distance!==0)y.remove();else if(m.distance!==0){o="removeEmptySlices";let C=m.removeTextSlice();const T=m.caret.origin;if(x==="segmented"){const b=C.origin,N=Ne(b.getTextContent()).setStyle(b.getStyle()).setFormat(b.getFormat());y.replaceOrInsert(N),C=yn(N,r,C.offset)}T.is(s[0].origin)&&(s[0]=C),T.is(l[0].origin)&&(l[0]=C.getFlipped())}}let f,d;for(const m of s)if(Fs(m)){f=je(m);break}for(const m of l)if(Fs(m)){d=je(m);break}const h=(function(m,p,_){if(!m||!p)return null;const y=m.getParentAtCaret(),x=p.getParentAtCaret();if(!y||!x)return null;const C=y.getParents().reverse();C.push(y);const T=x.getParents().reverse();T.push(x);const b=Math.min(C.length,T.length);let N;for(N=0;N<b&&C[N]===T[N];N++);const v=(k,F)=>{let L;for(let B=N;B<k.length;B++){const Y=k[B];if(Se(Y))return;!L&&F(Y)&&(L=Y)}return L},w=v(C,ze),A=w&&v(T,k=>_.has(k.getKey())&&ze(k));return A&&xt(A).length>0?null:w&&A?[w,A]:null})(f,d,c);if(h){const[m,p]=h;Fe(m,"previous").splice(0,p.getChildren());let _=p.getParent();for(p.remove(!0);_&&_.isEmpty();){const y=_;_=_.getParent(),y.remove(!0)}}else if(d){const m=(function(y){if(He(y)){const x=y.origin;if(ze(x))return x}else{const x=y.getParentAtCaret();if(x&&ze(x))return x}return null})(d),p=m&&m.getParent(),_=m&&m.getParents().findLast(so);if(m&&p&&!Ee(p)&&m.isEmpty()&&c.has(m.getKey())&&xt(m).length===0&&(!_||c.has(_.getKey()))){m.remove(!0);let y=p;for(;y&&!Ee(y)&&y.isEmpty();){const x=y.getParent();if(x&&Ee(x)&&x.getChildrenSize()<=1)break;const C=y;y=x,C.remove(!0)}}}const g=[f,d,...s,...l].find(Fs);if(g)return Ro(sn(je(g),n.direction));$(269,JSON.stringify(s.map(m=>m.origin.__key)))}function je(n){const e=(function(o){let i=o;for(;He(i);){const s=jn(i);if(!He(s))break;i=s}return i})(n.getLatest()),{direction:t}=e;if(O(e.origin))return Ct(e)?e:yn(e.origin,t,t);const r=e.getAdjacentCaret();return Mt(r)&&O(r.origin)?yn(r.origin,t,Sn(t)):e}function fs(n){return Ct(n)&&n.offset!==Bt(n.origin,n.direction)}function sn(n,e){return n.direction===e?n:n.getFlipped()}function wc(n,e){return n.direction===e?n:Et(sn(n.focus,e),sn(n.anchor,e))}function Cl(n,e,t){let r=Fe(n,"next");for(let o=0;o<e;o++){const i=r.getAdjacentCaret();if(i===null)break;r=i}return sn(r,t)}function fh(n,e="root"){let t=0,r=n,o=jn(r);for(;o===null;){if(t--,o=r.getParentCaret(e),!o)return null;r=o,o=jn(r)}return o&&[o,t]}function Wm(n){const{origin:e,offset:t,direction:r}=n;if(t===Bt(e,r))return n.getSiblingCaret();if(t===Bt(e,Sn(r)))return bn(n.getSiblingCaret());const[o]=e.splitText(t);return O(o)||$(281),sn(ne(o,"next"),r)}function jm(n,e){return!0}function dh(n,{$copyElementNode:e=Be,$splitTextPointCaretNext:t=Wm,rootMode:r="shadowRoot",$shouldSplit:o=jm,removeEmptyDestination:i=!1}={}){if(Ct(n))return t(n);const s=n.getParentCaret(r);if(s){const{origin:l}=s;if(He(n)){const a=bn(s);if(i&&l.isEmpty())return l.remove(),a;if(!l.canBeEmpty()||!o(l,"first"))return a}const c=(function(a){const u=[];for(let f=a.getAdjacentCaret();f;f=f.getAdjacentCaret())u.push(f.origin);return u})(n);(c.length>0||!i&&l.canBeEmpty()&&o(l,"last"))&&s.insert(e(l).splice(0,0,c))}return s}function ds(n,e,t){let r=sn(e,"next");Ct(r)&&(r.offset===0?r=ne(r.origin,"previous").getFlipped():r.offset===r.origin.getTextContentSize()&&(r=ne(r.origin,"next"))),r.origin.is(n)&&(Mt(r)||$(342,n.getKey(),n.getType()),r=bn(r)),(n.is(r.getNodeAtCaret())||n.is(r.getFlipped().getNodeAtCaret()))&&n.remove(!0);for(let o=r;o;o=dh(o,t))r=o;return Ct(r)&&$(283),r.insert(n.isInline()?V().append(n):n),sn(ne(n.getLatest(),"next"),e.direction)}function Ec(n,e){if(!e||n===e)return n;for(const t in e)if(n[t]!==e[t])return{...n,...e};return n}function nn(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[r]of t.matchAll(/\S+/g))e.push(r);return e}function we(n,...e){const t=nn(...e);t.length>0&&n.classList.add(...t)}function Wt(n,...e){const t=nn(...e);t.length>0&&n.classList.remove(...t)}function qe(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}function hh(n){const e=be().getElementByKey(n.getKey());if(e===null)return null;const t=e.ownerDocument.defaultView;return t===null?null:t.getComputedStyle(e)}function gh(n){return hh(Ee(n)?n:n.getParentOrThrow())}function jo(n){const e=gh(n);return e!==null&&e.direction==="rtl"}function ph(n,e,t="self"){const r=n.getStartEndPoints();if(e.isSelected(n)&&!yt(e)&&r!==null){const[o,i]=r,s=n.isBackward(),l=o.getNode(),c=i.getNode(),a=e.is(l),u=e.is(c);if(a||u){const[f,d]=fl(n),h=l.is(c),g=e.is(s?c:l),m=e.is(s?l:c);let p,_=0;h?(_=f>d?d:f,p=f>d?f:d):g?(_=s?d:f,p=void 0):m&&(_=0,p=s?f:d);const y=e.__text.slice(_,p);y!==e.__text&&(t==="clone"&&(e=km(e)),e.__text=y)}}return e}function Um(n,e){const t=n.getFormatType(),r=n.getIndent();t!==e.getFormatType()&&e.setFormat(t),r!==e.getIndent()&&e.setIndent(r)}function Hm(n,e,t){let r=Je(n,t);if(fs(r))return!1;for(;r;r=r.getParentCaret()){const o=r.getParentAtCaret();if(!o||r.getNodeAtCaret())return!1;if(e.is(o))return!0}return!1}function Jm(n,e,t=Um){if(!n)return;const r=n.getStartEndPoints();let o=!1,i=null;const s=new Map;if(r){const[l,c]=r,a=U(l.getNode(),ze);i=U(c.getNode(),ze);const u=n.isBackward()?"previous":"next";o=S(i)&&!i.is(a)&&(function(f,d,h){const g=f.getNode();return(!S(g)||!g.isEmpty())&&Hm(f,d,h)})(c,i,Sn(u)),S(a)&&s.set(a.getKey(),a),S(i)&&!o&&s.set(i.getKey(),i)}for(const l of n.getNodes())if(S(l)&&ze(l)){if(o&&l.is(i))continue;s.set(l.getKey(),l)}else if(!r){const c=U(l,ze);S(c)&&s.set(c.getKey(),c)}for(const l of s.values()){const c=e();t(l,c),l.replace(c,!0)}}function mh(n){const e=_h(n);return e!==null&&e.writingMode==="vertical-rl"}function _h(n){const e=n.anchor.getNode();return S(e)?hh(e):gh(e)}function cu(n,e){let t=mh(n)?!e:e;yh(n)&&(t=!t);const r=Je(n.focus,t?"previous":"next");if(fs(r))return!1;if(Ct(r)&&!kr(r.origin)&&r.origin.isUnmergeable()){const o=r.getNodeAtCaret();if(O(o)&&!kr(o))return!0}for(const o of Dr(r)){if(He(o))return!o.origin.isInline();if(!S(o.origin)){if(G(o.origin))return!0;break}}return!1}function qm(n,e,t,r){n.modify(e?"extend":"move",t,r)}function yh(n){const e=_h(n);return e!==null&&e.direction==="rtl"}function au(n,e,t){const r=yh(n);let o;o=mh(n)||r?!t:t,qm(n,e,o,"character")}function Vm(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Ym(n,e){return Array.from(Xm(n))}function Xm(n,e){return Qm("next",n)}function Gm(n,e){const t=fh(ne(n,e));return t&&t[0]}function Qm(n,e,t){const r=me(),o=e||r,i=S(o)?Fe(o,n):ne(o,n),s=Zm(o),l=Gm(o,n);let c=s;return us({hasNext:a=>a!==null,initial:i,map:a=>({depth:c,node:a.origin}),step:a=>{if(a.isSameNodeCaret(l))return null;He(a)&&c++;const u=fh(a);return!u||u[0].isSameNodeCaret(l)?null:(c+=u[1],u[0])}})}function Zm(n){let e=-1;for(let t=n;t!==null;t=t.getParent()??mt(t))e++;return e}function e_(n,e){let t=n;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function t_(n){const e=U(n,t=>S(t)&&!t.isInline());return S(e)||Vm(4,n.__key),e}function n_(n){const e=M()||ct();let t;if(E(e))t=Je(e.focus,"next");else{if(e!=null){const s=e.getNodes(),l=s[s.length-1];l&&(t=ne(l,"next"))}t=t||Fe(me(),"previous").getFlipped().insert(V())}const r=ds(n,t),o=jn(r),i=He(o)?je(o):r;return Rr(Ro(i)),n.getLatest()}function Kt(n,e){return n!==null&&Object.getPrototypeOf(n).constructor.name===e.name}function Uo(n){let e=null;if(Kt(n,DragEvent)?e=n.dataTransfer:Kt(n,ClipboardEvent)&&(e=n.clipboardData),e===null)return[!1,[],!1];const t=e.types,r=t.includes("Files"),o=t.includes("text/html")||t.includes("text/plain");return[r,Array.from(e.files),o]}function uu(n){const e=M();if(!E(e))return!1;const t=new Set,r=e.getNodes();for(let o=0;o<r.length;o++){const i=r[o],s=i.getKey();if(t.has(s))continue;const l=U(i,a=>S(a)&&!a.isInline());if(l===null)continue;const c=l.getKey();l.canIndent()&&!t.has(c)&&(t.add(c),n(l))}return t.size>0}function r_(n,e){Fe(n,"next").insert(e)}function xh(n,e){return Ch(n,e,null)}function Ch(n,e,t){let r=!1;for(const o of Sh(n))e(o)?t!==null&&t(o):(r=!0,S(o)&&Ch(o,e,t||(i=>o.insertAfter(i))),o.remove());return r}function Ii(n,e){const t=[],r=Array.from(n).reverse();for(let o=r.pop();o!==void 0;o=r.pop())if(e(o))t.push(o);else if(S(o))for(const i of Sh(o))r.push(i);return t}function Sh(n){return o_(Fe(n,"previous"))}function o_(n){return us({hasNext:Mt,initial:n.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}const i_=Symbol.for("preact-signals");function $c(){if(Fn>1)return void Fn--;let n,e=!1;for(!(function(){let t=Li;for(Li=void 0;t!==void 0;)t.S.v===t.v&&(t.S.i=t.i),t=t.o})();lo!==void 0;){let t=lo;for(lo=void 0,Ki++;t!==void 0;){const r=t.u;if(t.u=void 0,t.f&=-3,!(8&t.f)&&bh(t))try{t.c()}catch(o){e||(n=o,e=!0)}t=r}}if(Ki=0,Fn--,e)throw n}let he,lo;function fu(n){const e=he;he=void 0;try{return n()}finally{he=e}}let Li,Fn=0,Ki=0,du=0,fi=0;function hu(n){if(he===void 0)return;let e=n.n;return e===void 0||e.t!==he?(e={i:0,S:n,p:he.s,n:void 0,t:he,e:void 0,x:void 0,r:e},he.s!==void 0&&(he.s.n=e),he.s=e,n.n=e,32&he.f&&n.S(e),e):e.i===-1?(e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=he.s,e.n=void 0,he.s.n=e,he.s=e),e):void 0}function Ye(n,e){this.v=n,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}function Po(n,e){return new Ye(n,e)}function bh(n){for(let e=n.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function gu(n){for(let e=n.s;e!==void 0;e=e.n){const t=e.S.n;if(t!==void 0&&(e.r=t),e.S.n=e,e.i=-1,e.n===void 0){n.s=e;break}}}function vh(n){let e,t=n.s;for(;t!==void 0;){const r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):e=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}n.s=e}function Zn(n,e){Ye.call(this,void 0),this.x=n,this.s=void 0,this.g=fi-1,this.f=4,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}function Th(n){const e=n.m;if(n.m=void 0,typeof e=="function"){Fn++;const t=he;he=void 0;try{e()}catch(r){throw n.f&=-2,n.f|=8,Oc(n),r}finally{he=t,$c()}}}function Oc(n){for(let e=n.s;e!==void 0;e=e.n)e.S.U(e);n.x=void 0,n.s=void 0,Th(n)}function s_(n){if(he!==this)throw new Error("Out-of-order effect");vh(this),he=n,this.f&=-2,8&this.f&&Oc(this),$c()}function cr(n,e){this.x=n,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=e?.name}function Ac(n,e){const t=new cr(n,e);try{t.c()}catch(o){throw t.d(),o}const r=t.d.bind(t);return r[Symbol.dispose]=r,r}function l_(n,e={}){const t={};for(const r in n){const o=e[r],i=Po(o===void 0?n[r]:o);t[r]=i}return t}Ye.prototype.brand=i_,Ye.prototype.h=function(){return!0},Ye.prototype.S=function(n){const e=this.t;e!==n&&n.e===void 0&&(n.x=e,this.t=n,e!==void 0?e.e=n:fu(()=>{var t;(t=this.W)==null||t.call(this)}))},Ye.prototype.U=function(n){if(this.t!==void 0){const e=n.e,t=n.x;e!==void 0&&(e.x=t,n.e=void 0),t!==void 0&&(t.e=e,n.x=void 0),n===this.t&&(this.t=t,t===void 0&&fu(()=>{var r;(r=this.Z)==null||r.call(this)}))}},Ye.prototype.subscribe=function(n){return Ac(()=>{const e=this.value,t=he;he=void 0;try{n(e)}finally{he=t}},{name:"sub"})},Ye.prototype.valueOf=function(){return this.value},Ye.prototype.toString=function(){return this.value+""},Ye.prototype.toJSON=function(){return this.value},Ye.prototype.peek=function(){const n=he;he=void 0;try{return this.value}finally{he=n}},Object.defineProperty(Ye.prototype,"value",{get(){const n=hu(this);return n!==void 0&&(n.i=this.i),this.v},set(n){if(n!==this.v){if(Ki>100)throw new Error("Cycle detected");(function(e){Fn!==0&&Ki===0&&e.l!==du&&(e.l=du,Li={S:e,v:e.v,i:e.i,o:Li})})(this),this.v=n,this.i++,fi++,Fn++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{$c()}}}}),Zn.prototype=new Ye,Zn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===fi))return!0;if(this.g=fi,this.f|=1,this.i>0&&!bh(this))return this.f&=-2,!0;const n=he;try{gu(this),he=this;const e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return he=n,vh(this),this.f&=-2,!0},Zn.prototype.S=function(n){if(this.t===void 0){this.f|=36;for(let e=this.s;e!==void 0;e=e.n)e.S.S(e)}Ye.prototype.S.call(this,n)},Zn.prototype.U=function(n){if(this.t!==void 0&&(Ye.prototype.U.call(this,n),this.t===void 0)){this.f&=-33;for(let e=this.s;e!==void 0;e=e.n)e.S.U(e)}},Zn.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(Zn.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const n=hu(this);if(this.h(),n!==void 0&&(n.i=this.i),16&this.f)throw this.v;return this.v}}),cr.prototype.c=function(){const n=this.S();try{if(8&this.f||this.x===void 0)return;const e=this.x();typeof e=="function"&&(this.m=e)}finally{n()}},cr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Th(this),gu(this),Fn++;const n=he;return he=this,s_.bind(this,n)},cr.prototype.N=function(){2&this.f||(this.f|=2,this.u=lo,lo=this)},cr.prototype.d=function(){this.f|=8,1&this.f||Oc(this)},cr.prototype.dispose=function(){this.d()};function c_(n){return(typeof n.nodes=="function"?n.nodes():n.nodes)||[]}function a_(n,e){let t;return Po(n(),{unwatched(){t&&(t(),t=void 0)},watched(){this.value=n(),t=e(this)}})}function Ce(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let Nh;try{Nh="0.49.0+prod.esm"}catch{}const u_=Nh??'"<unknown>+source"',f_=new Set(["__proto__","constructor","prototype"]);function kh(n,e){if(n&&e&&!Array.isArray(e)&&typeof n=="object"&&typeof e=="object"){const t=n,r=e;for(const o in r)!f_.has(o)&&Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=kh(t[o],r[o]));return n}return e}const Mc=0,Sl=1,wh=2,Ds=3,Ho=4,er=5,Rs=6,Yr=7;function Ps(n){return n.id===Mc}function Eh(n){return n.id===wh}function d_(n){return(function(e){return e.id===Sl})(n)||Ce(305,String(n.id),String(Sl)),Object.assign(n,{id:wh})}const h_=new Set;let g_=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:Mc}}mergeConfigs(){let e=this.extension.config||{};const t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Ec;for(const r of this.configs)e=t(e,r);return e}init(e){const t=this.state;Eh(t)||Ce(306,String(t.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)},i=(function(l,c,a){return Object.assign(l,{config:c,id:Ds,registerState:a})})(t,this.mergeConfigs(),r);let s;this.state=i,this.extension.init&&(s=this.extension.init(e,i.config,r)),this.state=(function(l,c,a){return Object.assign(l,{id:Ho,initResult:c,registerState:a})})(i,s,o)}build(e){const t=this.state;let r;t.id!==Ho&&Ce(307,String(t.id),String(er)),this.extension.build&&(r=this.extension.build(e,t.config,t.registerState));const o={...t.registerState,getOutput:()=>r,getSignal:this.getSignal.bind(this)};this.state=(function(i,s,l){return Object.assign(i,{id:er,output:s,registerState:l})})(t,r,o)}register(e,t){this._signal=t;const r=this.state;r.id!==er&&Ce(308,String(r.id),String(er));const o=this.extension.register&&this.extension.register(e,r.config,r.registerState);return this.state=(function(i){return Object.assign(i,{id:Rs})})(r),()=>{const i=this.state;i.id!==Yr&&Ce(309,String(r.id),String(Yr)),this.state=(function(s){return Object.assign(s,{id:er})})(i),o&&o()}}afterRegistration(e){const t=this.state;let r;return t.id!==Rs&&Ce(310,String(t.id),String(Rs)),this.extension.afterRegistration&&(r=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=(function(o){return Object.assign(o,{id:Yr})})(t),r}getSignal(){return this._signal===void 0&&Ce(311),this._signal}getInitResult(){this.extension.init===void 0&&Ce(312,this.extension.name);const e=this.state;return(function(t){return t.id>=Ho})(e)||Ce(313,String(e.id),String(Ho)),e.initResult}getInitPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){const e=this.state;return(function(t){return t.id>=Ds})(e)||Ce(314,String(e.id),String(Ds)),{config:e.config}}getPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){const t=this.builder.getExtensionRep(e);return t===void 0&&Ce(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return t===void 0&&Ce(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return(function(t){return t.id>=Yr})(e)||Ce(316,String(e.id),String(Yr)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||h_}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([t])=>t)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){const e=this.state;(function(t){return t.id>=er})(e)||Ce(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};const pu={tag:mr};function p_(){const n=me();n.isEmpty()&&n.append(V())}const m_={config:{setOptions:pu,updateOptions:pu},init:({$initialEditorState:n=p_})=>({$initialEditorState:n,initialized:!1}),afterRegistration(n,{updateOptions:e,setOptions:t},r){const o=r.getInitResult();if(!o.initialized){o.initialized=!0;const{$initialEditorState:i}=o;if(nm(i))n.setEditorState(i,t);else if(typeof i=="function")n.update(()=>{i(n)},e);else if(i&&(typeof i=="string"||typeof i=="object")){const s=n.parseEditorState(i);n.setEditorState(s,t)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[rs,on,os,es,is]},mu=Symbol.for("@lexical/extension/LexicalBuilder");function _u(){}function __(n){throw n}function Jo(n){return Array.isArray(n)?n:[n]}const Is=u_;let $h=class di{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Is,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(e){const t=[Jo(m_)];for(const r of e)t.push(Jo(r));return new di(t)}static maybeFromEditor(e){const t=e[mu];return t&&(t.PACKAGE_VERSION!==Is&&Ce(292,t.PACKAGE_VERSION,Is),t instanceof di||Ce(293)),t}static fromEditor(e){const t=di.maybeFromEditor(e);return t===void 0&&Ce(294),t}constructEditor(){const{$initialEditorState:e,onError:t,onWarn:r,...o}=this.buildCreateEditorArgs(),i=Object.assign(uc({...o,...t?{onError:s=>{t(s,i)}}:{},...r?{onWarn:s=>{r(s,i)}}:{}}),{[mu]:this});for(const s of this.sortedExtensionReps())s.build(i);return i}buildEditor(){let e=_u;function t(){try{e()}finally{e=_u}}const r=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=qe(this.registerEditor(r),()=>r.setRootElement(null)),r}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){const t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&Ce(295,e.name),t}addEdge(e,t,r){const o=this.outgoingConfigEdges.get(e);o?o.set(t,r):this.outgoingConfigEdges.set(e,new Map([[t,r]]));const i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&Ce(296);const t=Jo(e),[r]=t;typeof r.name!="string"&&Ce(297,typeof r.name);let o=this.extensionNameMap.get(r.name);if(o!==void 0&&o.extension!==r&&Ce(298,r.name),!o){o=new g_(this,r),this.extensionNameMap.set(r.name,o);const i=this.conflicts.get(r.name);typeof i=="string"&&Ce(299,r.name,i);for(const s of r.conflictsWith||[])this.extensionNameMap.has(s)&&Ce(299,r.name,s),this.conflicts.set(s,r.name);for(const s of r.dependencies||[]){const l=Jo(s);this.addEdge(r.name,l[0].name,l.slice(1)),this.addExtension(l)}for(const[s,l]of r.peerDependencies||[])this.addEdge(r.name,s,l?[l]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const e=[],t=(r,o)=>{let i=r.state;if(Eh(i))return;const s=r.extension.name;var l;Ps(i)||Ce(300,s,o||"[unknown]"),Ps(l=i)||Ce(304,String(l.id),String(Mc)),i=Object.assign(l,{id:Sl}),r.state=i;const c=this.outgoingConfigEdges.get(s);if(c)for(const a of c.keys()){const u=this.extensionNameMap.get(a);u&&t(u,s)}i=d_(i),r.state=i,e.push(r)};for(const r of this.extensionNameMap.values())Ps(r.state)&&t(r);for(const r of e)for(const[o,i]of this.outgoingConfigEdges.get(r.extension.name)||[])if(i.length>0){const s=this.extensionNameMap.get(o);if(s)for(const l of i)s.configs.add(l)}for(const[r,...o]of this.roots)if(o.length>0){const i=this.extensionNameMap.get(r.name);i===void 0&&Ce(301,r.name);for(const s of o)i.configs.add(s)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){const t=this.sortedExtensionReps(),r=new AbortController,o=[()=>r.abort()],i=r.signal;for(const s of t){const l=s.register(e,i);l&&o.push(l)}for(const s of t){const l=s.afterRegistration(e);l&&o.push(l)}return qe(...o)}buildCreateEditorArgs(){const e={},t=new Set,r=new Map,o=new Map,i={},s={},l=this.sortedExtensionReps();for(const u of l){const{extension:f}=u;if(f.onError!==void 0&&(e.onError=f.onError),f.onWarn!==void 0&&(e.onWarn=f.onWarn),f.disableEvents!==void 0&&(e.disableEvents=f.disableEvents),f.parentEditor!==void 0&&(e.parentEditor=f.parentEditor),f.editable!==void 0&&(e.editable=f.editable),f.namespace!==void 0&&(e.namespace=f.namespace),f.$initialEditorState!==void 0&&(e.$initialEditorState=f.$initialEditorState),f.nodes)for(const d of c_(f)){if(typeof d!="function"){const h=r.get(d.replace);h&&Ce(302,f.name,d.replace.name,h.extension.name),r.set(d.replace,u)}t.add(d)}if(f.html){if(f.html.export)for(const[d,h]of f.html.export.entries())o.set(d,h);f.html.import&&Object.assign(i,f.html.import)}f.theme&&kh(s,f.theme)}Object.keys(s).length>0&&(e.theme=s),t.size&&(e.nodes=[...t]);const c=Object.keys(i).length>0,a=o.size>0;(c||a)&&(e.html={},c&&(e.html.import=i),a&&(e.html.export=o));for(const u of l)u.init(e);return e.onError||(e.onError=__),e}};function Br(n,e){const t=$h.maybeFromEditor(n);if(!t)return;const r=t.extensionNameMap.get(e);return r?r.getExtensionDependency():void 0}function y_(n){return Br(be(),n)}let Fc=class extends lc{$config(){return this.config("horizontalrule",{importDOM:{hr:()=>({conversion:x_,priority:0})}})}exportDOM(){return{element:ee().createElement("hr")}}createDOM(e){const t=ee().createElement("hr");return we(t,e.theme.hr),t}getTextContent(){return`
|
|
12
|
+
`}isInline(){return!1}updateDOM(){return!1}};function x_(){return{node:Oh()}}function Oh(){return oh(Fc)}function Wr(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let xr;function Ah(n,e){const{key:t}=e;return n&&t in n?n[t]:e.defaultValue}function Mh(n){return xr&&xr.editor===n?xr:void 0}function C_(n,e){if("cfg"in e){const{cfg:t,updater:r}=e;return[t,r(Ah(n,t))]}return e}function S_(n,e){let t=e;for(const r of n){const[o,i]=C_(t,r),s=o.key;if(t===e&&Ah(t,o)===i)continue;const l=t===e||t===void 0?b_(e):t;l[s]=i,t=l}return t}function b_(n){return Object.create(n||null)}function zi(n,e){return[n,e]}function v_(n,e,t,r=be()){const o=xr,i=Mh(r);try{return xr={...i,editor:r,[n]:e},t()}finally{xr=o}}function T_(n,e=()=>{}){return(t,r=be())=>o=>{const i=Mh(r),s=i&&i[n],l=S_(t,s||e(r));return l&&l!==s?v_(n,l,o,r):o()}}function Fh(n,e,t,r){return Object.assign(Eo(Symbol(e),{isEqual:r,parse:t}),{[n]:!0})}function N_(n){if(!Cn(n))return;const e=n;if(e.querySelector("style")===null)return;const t=new Map;function r(o){let i=t.get(o);if(i===void 0){i=new Set;for(let s=0;s<o.style.length;s++)i.add(o.style[s]);t.set(o,i)}return i}try{for(const o of Array.from(e.styleSheets)){let i;try{i=o.cssRules}catch{continue}for(const s of Array.from(i)){if(!Kt(s,CSSStyleRule))continue;let l;try{l=e.querySelectorAll(s.selectorText)}catch{continue}for(const c of Array.from(l)){if(!W(c))continue;const a=r(c);for(let u=0;u<s.style.length;u++){const f=s.style[u];a.has(f)||c.style.setProperty(f,s.style.getPropertyValue(f),s.style.getPropertyPriority(f))}}}}}catch{}}const Dh="@lexical/html/DOM",Rh=Symbol.for("@lexical/html/DOMExportContext"),k_=Symbol.for("@lexical/html/DOMImportContext");function w_(n,e,t){return Fh(Rh,n,e,t)}const E_=w_("isExport",Boolean);function $_(n){const e=Br(n,Dh);return e?e.output.defaults:void 0}function O_(n){const e=Br(n,Dh);return e?e.output.runtime:void 0}function A_(n=be()){const e=O_(n);return e?e.getSessionConfig():ls(n)}const M_=T_(Rh,$_),hs=Symbol.for("@lexical/html/SelectorImpl");function bo(n,e){const t={kind:"element",predicate:(r=e,r.length===0?W:r.length===1?r[0]:(i,s)=>{for(const l of r)if(!l(i,s))return!1;return!0}),tags:n};var r;const o=i=>bo(n,[...e,i]);return{[hs]:t,attr:(i,s,l)=>o(bl(i,s,l)),classAll:(...i)=>o(Ih(i)),classAny:(...i)=>o((function(s){const l=Ph(s);return l.length===0?()=>!1:c=>{if(!W(c))return!1;const a=c.classList;for(const u of l)if(a.contains(u))return!0;return!1}})(i)),styleAny:(i,s,l)=>o((function(c,a,u){if(typeof a=="string")return f=>W(f)&&f.style.getPropertyValue(c)===a;if(a instanceof RegExp){const f=u&&u.capture,d=a;return(h,g)=>{if(!W(h))return!1;const m=h.style.getPropertyValue(c);if(!m)return!1;const p=m.match(d);return p!==null&&(f!==void 0&&(g[f]=p),!0)}}Wr(362,JSON.stringify(c))})(i,s,l))}}function Ph(n){const e=[];for(const t of n)t&&e.push(t);return e}function Ih(n){const e=Ph(n);return e.length===0?()=>!0:t=>{if(!W(t))return!1;const r=t.classList;for(const o of e)if(!r.contains(o))return!1;return!0}}function bl(n,e,t){if(e===!0)return r=>W(r)&&r.hasAttribute(n);if(typeof e=="string")return r=>W(r)&&r.getAttribute(n)===e;if(e instanceof RegExp){const r=t&&t.capture,o=e;return(i,s)=>{if(!W(i))return!1;const l=i.getAttribute(n);if(l==null)return!1;const c=l.match(o);return c!==null&&(r!==void 0&&(s[r]=c),!0)}}Wr(361,JSON.stringify(n))}const F_={kind:"text",predicate:ot,tags:new Set},D_={[hs]:F_},R_={kind:"comment",predicate:n=>n.nodeType===8,tags:new Set},P_={[hs]:R_},fr={any:()=>bo(new Set,[]),comment:()=>P_,tag(...n){n.length>0||Wr(363);const e=new Set;for(const t of n)e.add(t.toUpperCase());return bo(e,[])},text:()=>D_};function Lh(n,e){return W(n)&&n.nodeName===e.toUpperCase()}const Kh=/[A-Za-z0-9_-]/;class I_{constructor(e,t){this.source=e,this.pos=t}peek(e=0){return this.source[this.pos+e]||""}consume(){return this.source[this.pos++]||""}eof(){return this.pos>=this.source.length}skipWhitespace(){for(;!this.eof()&&/\s/.test(this.peek());)this.pos++}readIdent(){const e=this.pos;for(;!this.eof()&&Kh.test(this.peek());)this.pos++;return this.source.slice(e,this.pos)}readQuoted(){const e=this.consume();this.assert(e==='"'||e==="'","expected quote");const t=this.pos;for(;!this.eof()&&this.peek()!==e;)this.peek()==="\\"?this.pos+=2:this.pos++;this.assert(!this.eof(),"unterminated string");const r=this.source.slice(t,this.pos);return this.pos++,r.replace(/\\(.)/g,"$1")}assert(e,t){e||Wr(364,String(this.pos+1),t,this.source)}}function L_(n){const e=new Set,t=[],r=[];if(n.skipWhitespace(),n.peek()==="*")n.consume();else if(Kh.test(n.peek())){const o=n.readIdent();o&&e.add(o.toUpperCase())}for(;!n.eof();){const o=n.peek();if(o==="."){n.consume();const i=n.readIdent();n.assert(i!=="",'expected class name after "."'),r.push(i)}else if(o==="#"){n.consume();const i=n.readIdent();n.assert(i!=="",'expected id after "#"'),t.push(bl("id",i))}else{if(o!=="[")break;{n.consume(),n.skipWhitespace();const i=n.readIdent();n.assert(i!=="",'expected attribute name after "["'),n.skipWhitespace();let s=!0;if(n.peek()==="="){n.consume(),n.skipWhitespace();const l=n.peek();l==='"'||l==="'"?s=n.readQuoted():(s=n.readIdent(),n.assert(s!=="","expected attribute value")),n.skipWhitespace()}n.assert(n.peek()==="]",'expected "]"'),n.consume(),t.push(bl(i,s))}}}return r.length>0&&t.push(Ih(r)),{predicates:t,tags:e}}function K_(n){const e=new I_(n,0),t=[];for(;;){const o=L_(e);if(t.push(o),e.skipWhitespace(),e.eof())break;e.assert(e.peek()===",",'expected "," (selector lists are the only supported combinator)'),e.consume(),e.skipWhitespace()}if(t.length===1)return bo(t[0].tags,t[0].predicates);const r=new Set;if(t.every(o=>o.tags.size>0))for(const o of t)for(const i of o.tags)r.add(i);return bo(r,[(o,i)=>{for(const s of t){const l=o.nodeName;if(s.tags.size>0&&!s.tags.has(l))continue;let c=!0;for(const a of s.predicates)if(!a(o,i)){c=!1;break}if(c)return!0}return!1}])}function Dc(n,e,t){return Fh(k_,n,e,t)}const vo=Dc("textFormat",()=>0),vl=Dc("textStyle",()=>({}));function z_(n){if(!W(n))return!1;if(n.nodeName==="PRE")return!0;const e=n.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function B_(n){if(ot(n))return!0;if(!W(n))return!1;const e=n.style.display;return e?e.startsWith("inline"):!Fr(n)&&Fi(n)}const W_=Dc("whitespaceConfig",()=>({isInline:B_,preservesWhitespace:z_}));function Rc(n){return wr(n)||G(n)&&!n.isInline()}function zh(n,e){const t=[];let r=[];const o=()=>{r.length!==0&&(t.push(e().splice(0,0,r)),r=[])};for(const i of n)if(Rc(i)){if(o(),S(i)){const s=zh(i.getChildren(),e);i.splice(0,i.getChildrenSize(),s)}t.push(i)}else r.push(i);return o(),t}function Pc(n,e){if(!W(e))return n;const t=e.style.textAlign;if(!Ic(t))return n;for(const r of n)wr(r)&&r.getFormatType()===""&&r.setFormat(t);return n}function j_(n,e,t){n.length===1&&Le(n[0])&&(n=[]);const r=V();if(W(t)){const o=t.style.textAlign;Ic(o)&&r.setFormat(o)}return[r.splice(0,0,n)]}const Bh={$accepts:Rc,$packageRun:j_,name:"BlockSchema"},Xn=fr,U_=new Set(["center","end","justify","left","right","start"]);function Ic(n){return U_.has(n)}const H_={B:{fontWeight:"bold"},EM:{fontStyle:"italic"},I:{fontStyle:"italic"},S:{textDecoration:"line-through"},STRONG:{fontWeight:"bold"},SUB:{verticalAlign:"sub"},SUP:{verticalAlign:"super"},U:{textDecoration:"underline"}},J_={CODE:Xg,MARK:ql},q_=new Set(["font-weight","font-style","text-decoration","vertical-align"]),V_={$import:(n,e)=>{const t=n.get(vo),r=H_[e.nodeName],o=(function(d){return{fontStyle:d.style.fontStyle,fontWeight:d.style.fontWeight,textDecoration:d.style.textDecoration,verticalAlign:d.style.verticalAlign}})(e),i=r?(s=r,{fontStyle:(l=o).fontStyle||s.fontStyle,fontWeight:l.fontWeight||s.fontWeight,textDecoration:l.textDecoration||s.textDecoration,verticalAlign:l.verticalAlign||s.verticalAlign}):o;var s,l;let c=(a=t,u=(function(d){let h=0,g=0;const{fontWeight:m,fontStyle:p,textDecoration:_,verticalAlign:y}=d;if(m==="700"||m==="bold"?h|=Hs:m!=="normal"&&m!=="400"||(g|=Hs),p==="italic"?h|=Js:p==="normal"&&(g|=Js),_){const x=_.split(" ");x.includes("underline")&&(h|=Vs),x.includes("line-through")&&(h|=qs),x.includes("none")&&(g|=Vs|qs)}return y==="sub"?(h|=Cs,g|=Ss):y==="super"?(h|=Ss,g|=Cs):y==="baseline"&&(g|=Cs|Ss),{clear:g,set:h}})(i),a&~u.clear|u.set);var a,u;const f=J_[e.nodeName];return f&&(c|=f),c===t?n.$importChildren(e):n.$importChildren(e,{context:[zi(vo,c)]})},match:Xn.tag("b","strong","em","i","code","mark","s","sub","sup","u","span"),name:"@lexical/html/inline-format"};function yu(n,e,t){let r=n;for(;;){let o=null;for(;(o=e?r.nextSibling:r.previousSibling)===null;){const s=r.parentNode;if(s===null)return null;r=s}if(r=o,!t.isInline(r))return null;let i=r;for(;(i=e?r.firstChild:r.lastChild)!==null;)r=i;if(ot(r))return r;if(r.nodeName==="BR")return null}}function xu(n,e){return e!==0&&O(n)?n.setFormat(e):n}function Cu(n,e){if(O(n)){const t=(function(r){let o="";for(const i in r)q_.has(i)||(o+=`${i}: ${r[i]}; `);return o.trimEnd()})(e);t!==""&&n.setStyle(t)}return n}const Y_={$import:(n,e)=>{const t=n.get(vo),r=n.get(vl),o=n.get(W_);if((function(l,c){let a=l.parentNode;for(;a!==null;){if(c.preservesWhitespace(a))return!0;a=a.parentNode}return!1})(e,o)){const l=_o(e.textContent||"");for(const c of l)xu(c,t),Cu(c,r);return l}const i=(function(l,c){let a=(l.textContent||"").replace(/\r/g,"").replace(/[ \t\n]+/g," ");if(a.length===0)return"";if(a[0]===" "){let u=l,f=!0;for(;u!==null&&(u=yu(u,!1,c))!==null;){const d=u.textContent||"";if(d.length>0){/[ \t\n]$/.test(d)&&(a=a.slice(1)),f=!1;break}}f&&(a=a.slice(1))}if(a.length>0&&a[a.length-1]===" "){let u=l,f=!0;for(;u!==null&&(u=yu(u,!0,c))!==null;)if((u.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){f=!1;break}f&&(a=a.slice(0,-1))}return a})(e,o);if(i==="")return[];const s=Ne(i);return xu(s,t),Cu(s,r),[s]},match:Xn.text(),name:"@lexical/html/#text"},X_={$import:()=>[],match:Xn.tag("script","style"),name:"@lexical/html/script-style-ignore"},G_={$import:(n,e)=>Rd(e)||Pd(e)?[]:[jt()],match:Xn.tag("br"),name:"@lexical/html/br"},Q_={$import:(n,e)=>{const t=V();if(qt(t,e),Yn(e,t),t.getFormatType()===""){const r=e.getAttribute("align");r&&Ic(r)&&t.setFormat(r)}return bt(t,e),[t.splice(0,0,n.$importChildren(e))]},match:Xn.tag("p"),name:"@lexical/html/p"},Z_={$import:(n,e,t)=>be().hasNode(Fc)?[Oh()]:t(),match:Xn.tag("hr"),name:"@lexical/html/hr"};Xn.any();function ey(n,e){const t=[];let r=0,o=0;for(;r<n.length&&o<e.length;)n[r]<=e[o]?t.push(n[r++]):t.push(e[o++]);for(;r<n.length;)t.push(n[r++]);for(;o<e.length;)t.push(e[o++]);return t}function ty(n){const e=[],t=new Map,r=[],o=[],i=[],s=new Set;n.forEach((c,a)=>{const u=(function(d){const h=d[hs];return h===void 0&&Wr(360),h})(c.match),f=c.name||(function(d,h){return d.kind==="text"?`#text@${h}`:d.kind==="comment"?`#comment@${h}`:d.tags.size===0?`*@${h}`:`${Array.from(d.tags).join(",").toLowerCase()}@${h}`})(u,a);if(c.name&&s.add(c.name),e.push({$import:c.$import,name:f,predicate:u.predicate}),u.kind==="text")o.push(a);else if(u.kind==="comment")i.push(a);else if(u.tags.size===0)r.push(a);else for(const d of u.tags){let h=t.get(d);h||(h=[],t.set(d,h)),h.push(a)}});const l=new Map;if(r.length===0)for(const[c,a]of t)l.set(c,a);else for(const[c,a]of t)l.set(c,ey(a,r));return{byTag:l,commentIndices:i,rules:e,textIndices:o,wildcardIndices:r}}function ny(n){const e=[];for(const t of n)if(ry(t))for(const r of t.rules)e.push(r);else e.push(t);return e}function ry(n){return typeof n=="object"&&n!==null&&"__type"in n&&n.__type==="CompiledOverlayRules"}function Wh(n){const e=ny(n);return{__type:"CompiledOverlayRules",dispatch:ty(e),rules:e}}fr.any();const Oe={any:fr.any,comment:fr.comment,css:K_,tag:fr.tag,text:fr.text},jh=new Set(["STYLE","SCRIPT"]);function Uh(n,e){N_(e);const t=Cn(e)?e.body.childNodes:e.childNodes,r=[],o=[];for(const i of t)if(!jh.has(i.nodeName)){const s=Jh(i,n,o,!1);if(s!==null)for(const l of s)r.push(l)}return(function(i){for(const s of i)s.getParent()&&s.getNextSibling()instanceof ac&&s.insertAfter(jt());for(const s of i){const l=s.getParent();l&&l.splice(s.getIndexWithinParent(),1,s.getChildren())}})(o),r}function oy(n,e=null,t=be()){return M_([zi(E_,!0)],t)(()=>{const r=me(),o=A_(t),i=E(e)?cs(e.anchor.getNode()):null,s=n.append.bind(n);for(const l of(S(i)?i:r).getChildren())Hh(t,l,s,e,o);return n})}function Lc(n,e=null){return(typeof document>"u"||typeof window>"u"&&global.window===void 0)&&Wr(338),Zp(n),oy(ee().createElement("div"),e,n).innerHTML}function Hh(n,e,t,r=null,o=ls(n)){let i=o.$shouldInclude(e,r,n);const s=o.$shouldExclude(e,r,n);let l=e;r!==null&&O(e)&&(l=ph(r,e,"clone"));const c=o.$exportDOM(l,n),{element:a,after:u,append:f,$getChildNodes:d}=c;if(!a)return!1;const h=ee().createDocumentFragment(),g=d?d():S(l)?l.getChildren():[],m=i&&de(r)&&S(e)?null:r,p=h.append.bind(h);for(const _ of g){const y=Hh(n,_,p,m,o);!i&&y&&o.$extractWithChild(e,_,r,"html",n)&&(i=!0)}if(i&&!s){if((W(a)||ml(a))&&(f?f(h):a.append(h)),t(a),u){const _=u.call(l,a);_&&(ml(a)?a.replaceChildren(_):a.replaceWith(_))}}else t(h);return i}function Jh(n,e,t,r,o=new Map,i){const s=[];if(jh.has(n.nodeName))return s;let l=null;const c=(function(g,m){const{nodeName:p}=g,_=m._htmlConversions.get(p.toLowerCase());let y=null;if(_!==void 0)for(const x of _){const C=x(g);C!==null&&(y===null||(y.priority||0)<=(C.priority||0))&&(y=C)}return y!==null?y.conversion:null})(n,e),a=c?c(n):null;let u=null;if(a!==null){u=a.after;const g=a.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,m]of o)if(l=m(l,i),!l)break;l&&s.push(...Array.isArray(g)?g:[l])}a.forChild!=null&&o.set(n.nodeName,a.forChild)}const f=n.childNodes;let d=[];const h=(l==null||!Se(l))&&(l!=null&&wr(l)||r);for(let g=0;g<f.length;g++)d.push(...Jh(f[g],e,t,h,new Map(o),l));if(u!=null&&(d=u(d)),Fr(n)&&(d=iy(n,d,h?()=>{const g=new ac;return t.push(g),g}:V)),l==null)if(d.length>0)for(const g of d)s.push(g);else Fr(n)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:Fi(g.nextSibling)&&Fi(g.previousSibling)})(n)&&s.push(jt());else S(l)&&l.append(...d);return s}function iy(n,e,t){const r=n.style.textAlign,o=[];let i=[];for(let s=0;s<e.length;s++){const l=e[s];if(wr(l))r&&!l.getFormat()&&l.setFormat(r),o.push(l);else if(i.push(l),s===e.length-1||s<e.length-1&&wr(e[s+1])){const c=t();c.setFormat(r),c.append(...i),o.push(c),i=[]}}return o}function sy(n,e){let t=n;for(let r=ne(n,e);r&&(Vh(r.origin)||kr(r.origin));r=r.getAdjacentCaret())t=r.origin;return t}function ly(n){return sy(n,"previous")}function qh(n,e){for(const t of n.childNodes)if(W(t)&&t.tagName===e||qh(t,e))return!0;return!1}const Zr="data-language",Xr="data-highlight-language",qo="data-theme";let gs=class extends ve{__language;__theme;__isSyntaxHighlightSupported;$config(){return this.config("code",{extends:ve,importDOM:{code:e=>e.textContent!=null&&(/\r?\n/.test(e.textContent)||qh(e,"BR"))?{conversion:Su,priority:1}:null,div:()=>({conversion:cy,priority:1}),pre:()=>({conversion:Su,priority:0}),table:e=>Ls(e)?{conversion:ay,priority:3}:null,td:e=>{const t=e,r=t.closest("table");return t.classList.contains("js-file-line")||r&&Ls(r)?{conversion:bu,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&Ls(t)?{conversion:bu,priority:3}:null}}})}constructor(e=void 0,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){const t=ee().createElement("code");we(t,e.theme.code),t.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(t.setAttribute(Zr,r),this.getIsSyntaxHighlightSupported()&&t.setAttribute(Xr,r));const o=this.getTheme();o&&t.setAttribute(qo,o);const i=this.getStyle();return i&&gn(t.style,i),t}updateDOM(e,t,r){const o=this.__language,i=e.__language;o?o!==i&&t.setAttribute(Zr,o):i&&t.removeAttribute(Zr);const s=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&i?s&&o?o!==i&&t.setAttribute(Xr,o):t.removeAttribute(Xr):s&&o&&t.setAttribute(Xr,o);const l=this.__theme,c=e.__theme;l?l!==c&&t.setAttribute(qo,l):c&&t.removeAttribute(qo);const a=this.__style,u=e.__style;return a!==u&&gn(t.style,a,u),!1}exportDOM(e){const t=ee().createElement("pre");we(t,e._config.theme.code),t.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(t.setAttribute(Zr,r),this.getIsSyntaxHighlightSupported()&&t.setAttribute(Xr,r));const o=this.getTheme();o&&t.setAttribute(qo,o);const i=this.getStyle();return i&&gn(t.style,i),{element:t}}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,t=!0){if(!Br(be(),"@lexical/code")){const s=uy(e);if(s)return s}const{anchor:r,focus:o}=e,i=(r.isBefore(o)?r:o).getNode();if(O(i)){let s=ly(i);const l=[];for(;;)if(kr(s))l.push(Ao()),s=s.getNextSibling();else{if(!Vh(s))break;{let g=0;const m=s.getTextContent(),p=s.getTextContentSize();for(;g<p&&m[g]===" ";)g++;if(g!==0&&l.push(fy(" ".repeat(g))),g!==p)break;s=s.getNextSibling()}}const c=i.splitText(r.offset)[0],a=r.offset===0?0:1,u=c.getIndexWithinParent()+a,f=i.getParentOrThrow(),d=[jt(),...l];f.splice(u,0,d);const h=l[l.length-1];h?h.select():r.offset===0?c.selectPrevious():c.getNextSibling().selectNext(0,0)}if(Kc(i)){const{offset:s}=e.anchor;i.splice(s,0,[jt()]),i.select(s+1,s+1)}return null}canIndent(){return!1}collapseAtStart(){const e=V();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){const t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){const t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}};function et(n,e){return oh(gs).setLanguage(n).setTheme(e)}function Kc(n){return n instanceof gs}function Su(n){return{node:et(n.getAttribute(Zr))}}function cy(n){const e=n,t=vu(e);return t||(function(r){let o=r.parentElement;for(;o!==null;){if(vu(o))return!0;o=o.parentElement}return!1})(e)?{node:t?et():null}:{node:null}}function ay(){return{node:et()}}function bu(){return{node:null}}function vu(n){return n.style.fontFamily.match("monospace")!==null}function Ls(n){return n.classList.contains("js-file-line-container")}function uy(n){const{anchor:e}=n;if(n.isCollapsed()&&e.type==="element"){const t=e.getNode();if(Kc(t)){const r=t.getChildrenSize();if(r>=2&&e.offset===r){const o=t.getLastChild();if(Le(o)&&Le(o.getPreviousSibling())){const i=V();return t.splice(r-2,2,[]).insertAfter(i,!1),i.select(),i}}}}return null}class zc extends on{__highlightType;constructor(e="",t,r){super(e,r),this.__highlightType=t}$config(){return this.config("code-highlight",{extends:on})}afterCloneFrom(e){super.afterCloneFrom(e),this.__highlightType=e.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){const t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){const t=super.createDOM(e),r=Ks(e.theme,this.__highlightType);return we(t,r),t}updateDOM(e,t,r){const o=super.updateDOM(e,t,r),i=Ks(r.theme,e.__highlightType),s=Ks(r.theme,this.__highlightType);return i!==s&&(i&&Wt(t,i),s&&we(t,s)),o}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return et()}}function Ks(n,e){return e&&n&&n.codeHighlight&&n.codeHighlight[e]}function fy(n="",e){return Ge(new zc(n,e))}function Vh(n){return n instanceof zc}const Yh="data-language";function Xh(n){return n.style.fontFamily.match("monospace")!==null}function Tl(n){let e=n.parentElement;for(;e!==null;){if(Xh(e))return!0;e=e.parentElement}return!1}const dy=Wh([{$import:(n,e)=>n.$importChildren(e),match:Oe.tag("tr","td"),name:"@lexical/code/github-code-table/unwrap"}]),hy={$import:(n,e)=>[et(e.getAttribute(Yh)).splice(0,0,n.$importChildren(e))],match:Oe.tag("pre"),name:"@lexical/code/pre"},gy={$import:(n,e,t)=>{const r=e.textContent||"";return/\r?\n/.test(r)||e.querySelector("br")!==null?[et(e.getAttribute(Yh)).splice(0,0,n.$importChildren(e))]:t()},match:Oe.tag("code"),name:"@lexical/code/code-multiline"};function Vo(n){if(!W(n))return!1;const e=n.style.fontFamily,t=n.style.whiteSpace;return typeof e=="string"&&/monospace/i.test(e)&&typeof t=="string"&&t.startsWith("pre")}function py(n){let e=!1;const t=[];let r="",o=!1;const i=()=>{o&&(t.push(r),r="",o=!1)};for(const s of Array.from(n.childNodes))if(W(s))s.tagName==="DIV"?(i(),t.push(s.textContent||""),e=!0):s.tagName==="BR"?(i(),t.push(""),e=!0):(r+=s.textContent||"",o=!0);else if(ot(s)){const l=s.textContent||"";l.length>0&&(r+=l,o=!0)}return i(),e?t:null}Oe.tag("div"),Oe.tag("div","br");const my={$import:(n,e,t)=>Xh(e)?[et().splice(0,0,n.$importChildren(e))]:Tl(e)?n.$importChildren(e):t(),match:Oe.tag("div"),name:"@lexical/code/div"};Oe.tag("table").classAll("js-file-line-container"),Oe.tag("td").classAll("js-file-line");const Tu=new Set(["http:","https:","mailto:","sms:","tel:"]);let xn=class extends ve{__url;__target;__rel;__title;$config(){return this.config("link",{extends:ve,importDOM:{a:()=>({conversion:yy,priority:1})}})}constructor(e="",t={},r){super(r);const{target:o=null,rel:i=null,title:s=null}=t;this.__url=e,this.__target=o,this.__rel=i,this.__title=s}afterCloneFrom(e){super.afterCloneFrom(e),this.__url=e.__url,this.__rel=e.__rel,this.__target=e.__target,this.__title=e.__title}createDOM(e){const t=ee().createElement("a");return this.updateLinkDOM(null,t,e),we(t,e.theme.link),t}updateLinkDOM(e,t,r){if(th(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(const o of["target","rel","title"]){const i=`__${o}`,s=this[i];e&&e[i]===s||(s?t[o]=s:t.removeAttribute(o))}}}updateDOM(e,t,r){return this.updateLinkDOM(e,t,r),!1}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){const t=e;e=Eu(e);try{const r=new URL(Eu(e));if(!Tu.has(r.protocol))return"about:blank"}catch{const o=t.replace(/[\u0000-\u001F\u007F\s]/g,"").match(/^([a-z][a-z0-9+.-]*):/i);if(o!=null&&!Tu.has(`${o[1].toLowerCase()}:`))return"about:blank"}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 t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){const t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){const t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){const t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){const r=Be(this);return this.insertAfter(r,t),r}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,r){if(!E(t))return!1;const o=t.anchor.getNode(),i=t.focus.getNode();return(this.is(o)||this.isParentOf(o))&&(this.is(i)||this.isParentOf(i))&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}shouldMergeAdjacentLink(e){return this.getType()===e.getType()&&this.__url===e.__url&&this.__target===e.__target&&this.__rel===e.__rel&&this.__title===e.__title}};function Nu(n){const e=Je(n,"next");return[e,e.getFlipped()]}function ku(n,e){for(const t of e)if(t.origin.isAttached()){const r=je(t);return void wt(n,r)}}function _y(n){const e=M();let t=null,r=null;function o(){E(e)&&(ku(e.anchor,t),ku(e.focus,r),Dt(e))}E(e)&&(t=Nu(e.anchor),r=Nu(e.focus));let i=!1;for(const l of Fe(n,"next")){const c=l.origin;if(S(c)&&!c.isInline()){const a=c.getChildren();if(a.length>0){const u=Be(n);u.append(...a),c.append(u),i=!0}ds(c,bn(l),{$shouldSplit:()=>!1})}}function s(l,c,a){const[u,f]=l,d=g=>Mt(g)&&g.origin.is(c);if(!d(u)&&!d(f))return l;const h=je(Fe(a,"next"));return[h,h.getFlipped()]}if(n.isAttached()){const l=n.getPreviousSibling();if(Qe(l)&&l.shouldMergeAdjacentLink(n))return t&&(t=s(t,l,n)),r&&(r=s(r,l,n)),l.append(...n.getChildren()),n.remove(),void o();const c=n.getNextSibling();Qe(c)&&n.shouldMergeAdjacentLink(c)&&(t&&(t=s(t,n,c)),r&&(r=s(r,n,c)),n.append(...c.getChildren()),c.remove(),i=!0)}if(i){if(!n.canBeEmpty()&&n.isEmpty()){const l=n.getParent();n.remove(),l&&l.isEmpty()&&l.remove()}o()}}function yy(n){let e=null;if(th(n)){const t=n.textContent;(t!==null&&t!==""||n.children.length>0)&&(e=To(n.getAttribute("href")||"",{rel:n.getAttribute("rel"),target:n.getAttribute("target"),title:n.getAttribute("title")}))}return{node:e}}function To(n="",e){return Ge(new xn(n,e))}function Qe(n){return n instanceof xn}let Bc=class extends xn{__isUnlinked;constructor(e="",t={},r){super(e,t,r),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}afterCloneFrom(e){super.afterCloneFrom(e),this.__isUnlinked=e.__isUnlinked}$config(){return this.config("autolink",{extends:xn})}shouldMergeAdjacentLink(e){return!1}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?ee().createElement("span"):super.createDOM(e)}updateDOM(e,t,r){return super.updateDOM(e,t,r)||e.__isUnlinked!==this.__isUnlinked}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){const r=xy(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(r,t),r}};function xy(n="",e){return Ge(new Bc(n,e))}function ar(n){return n instanceof Bc}const Nl=z("TOGGLE_LINK_COMMAND");function wu(n,e){if(n.type==="element"){const t=n.getNode();return S(t)||(function(r,...o){const i=new URL("https://lexical.dev/docs/error"),s=new URLSearchParams;s.append("code",r);for(const l of o)s.append("v",l);throw i.search=s.toString(),Error(`Minified Lexical error #${r}; visit ${i.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(252),t.getChildren()[n.offset+e]||null}return null}function zs(n,e={}){let t;if(n&&typeof n=="object"){const{url:u,...f}=n;t=u,e={...f,...e}}else t=n;const{target:r,title:o}=e,i=e.rel===void 0?"noreferrer":e.rel,s=M();if(s===null||!E(s)&&!de(s))return;if(de(s)){const u=s.getNodes();return u.length===0?void 0:void u.forEach(f=>{if(t===null){const d=U(f,h=>!ar(h)&&Qe(h));d&&(d.insertBefore(f),d.getChildren().length===0&&d.remove())}else{const d=U(f,h=>!ar(h)&&Qe(h));if(d)d.setURL(t),r!==void 0&&d.setTarget(r),i!==void 0&&d.setRel(i);else{const h=To(t,{rel:i,target:r});f.insertBefore(h),h.append(f)}}})}if(s.isCollapsed()&&t===null)for(const u of s.getNodes()){const f=U(u,d=>!ar(d)&&Qe(d));return void(f!==null&&(f.getParentOrThrow().splice(f.getIndexWithinParent(),0,f.getChildren()),f.remove()))}const l=s.extract();if(t===null){const u=new Set;return void l.forEach(f=>{const d=U(f,h=>!ar(h)&&Qe(h));if(d!==null){const h=d.getKey();if(u.has(h))return;(function(g,m){const p=new Set(m.filter(v=>g.isParentOf(v)).map(v=>v.getKey())),_=g.getChildren(),y=v=>p.has(v.getKey())||S(v)&&m.some(w=>g.isParentOf(w)&&v.isParentOf(w)),x=_.filter(y);if(x.length===_.length)return _.forEach(v=>g.insertBefore(v)),void g.remove();const C=_.findIndex(y),T=_.findLastIndex(y),b=C===0,N=T===_.length-1;if(b)x.forEach(v=>g.insertBefore(v));else if(N)for(let v=x.length-1;v>=0;v--)g.insertAfter(x[v]);else{for(let w=x.length-1;w>=0;w--)g.insertAfter(x[w]);const v=_.slice(T+1);if(v.length>0){const w=Be(g);x[x.length-1].insertAfter(w),v.forEach(A=>w.append(A))}}})(d,l),u.add(h)}})}const c=new Set,a=u=>{c.has(u.getKey())||(c.add(u.getKey()),u.setURL(t),r!==void 0&&u.setTarget(r),i!==void 0&&u.setRel(i),o!==void 0&&u.setTitle(o))};if(l.length===1){const u=l[0],f=U(u,Qe);if(f!==null)return a(f)}(function(u){const f=M();if(!E(f))return u();const d=Dt(f),h=d.isBackward(),g=wu(d.anchor,h?-1:0),m=wu(d.focus,h?0:-1);if(u(),g||m){const p=M();if(E(p)){const _=p.clone();if(g){const y=g.getParent();y&&_.anchor.set(y.getKey(),g.getIndexWithinParent()+(h?1:0),"element")}if(m){const y=m.getParent();y&&_.focus.set(y.getKey(),m.getIndexWithinParent()+(h?0:1),"element")}pe(Dt(_))}}})(()=>{let u=null;for(const f of l){if(!f.isAttached())continue;const d=U(f,Qe);if(d){a(d);continue}if(S(f)){if(!f.isInline())continue;if(Qe(f)){if(!(ar(f)||u!==null&&u.getParentOrThrow().isParentOf(f))){a(f),u=f;continue}for(const g of f.getChildren())f.insertBefore(g);f.remove();continue}}const h=f.getPreviousSibling();Qe(h)&&h.is(u)?h.append(f):(u=To(t,{rel:i,target:r,title:o}),f.insertAfter(u),u.append(f))}})}const Cy=/^\+?[0-9\s()-]{5,}$/;function Eu(n){return n.match(/^[a-z][a-z0-9+.-]*:/i)||n.match(/^[/#.]/)?n:n.includes("@")?`mailto:${n}`:Cy.test(n)?`tel:${n}`:`https://${n}`}Oe.tag("a");function Sy(n,e){return qe(n.registerNodeTransform(xn,_y),n.registerCommand(Nl,t=>{const r=e.validateUrl.peek(),o=e.attributes.peek();if(t===null)return zs(null),!0;if(typeof t=="string")return!(r!==void 0&&!r(t))&&(zs(t,o),!0);{const{url:i,target:s,rel:l,title:c}=t;return zs(i,{...o,rel:l,target:s,title:c}),!0}},X),Ac(()=>{const t=e.validateUrl.value;if(!t)return;const r=e.attributes.value;return n.registerCommand(Lr,o=>{const i=M();if(!E(i)||i.isCollapsed()||!Kt(o,ClipboardEvent)||o.clipboardData===null)return!1;const s=o.clipboardData.getData("text");return t(s)?!i.getNodes().some(l=>S(l)||O(l)&&!l.isSimpleText())&&(n.dispatchCommand(Nl,{...r,url:s}),o.preventDefault(),!0):!1},gt)}))}function an(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function kl(n){let e=1,t=n.getParent();for(;t!=null;){if(Z(t)){const r=t.getParent();if(q(r)){e++,t=r.getParent();continue}an(40)}return e}return e}function wl(n){const e=n.getParent();q(e)||an(40);let t=e,r=e;for(;r!==null;)r=r.getParent(),q(r)&&(t=r);return t}function Gh(n){let e=[];const t=n.getChildren().filter(Z);for(let r=0;r<t.length;r++){const o=t[r],i=o.getFirstChild();q(i)?e=e.concat(Gh(i)):e.push(o)}return e}function pt(n){return Z(n)&&q(n.getFirstChild())}function Qh(n,e){return Z(n)&&(e.length===0||e.length===1&&n.is(e[0])&&n.getChildrenSize()===0)}function $u(n){const e=M();if(e!==null){let t=e.getNodes();if(E(e)){const[o]=e.getStartEndPoints(),i=o.getNode(),s=i.getParent();if(Se(i)){const l=i.getFirstChild();if(l)t=l.selectStart().getNodes();else{const c=V();i.append(c),t=c.select().getNodes()}}else if(Qh(i,t)){const l=$t(n);if(Se(s)){i.replace(l);const c=Ht();S(i)&&(c.setFormat(i.getFormatType()),c.setIndent(i.getIndent())),l.append(c)}else if(Z(i)){const c=i.getParentOrThrow();Un(l,c.getChildren()),c.replace(l)}return}}const r=new Set;for(let o=0;o<t.length;o++){const i=t[o];if(S(i)&&i.isEmpty()&&!Z(i)&&!r.has(i.getKey())){Ou(i,n);continue}let s=zd(i)?i.getParent():Z(i)&&i.isEmpty()?i:null;for(;s!=null;){const l=s.getKey();if(q(s)){if(!r.has(l)){const c=$t(n);Un(c,s.getChildren()),s.replace(c),r.add(l)}break}{const c=s.getParent();if(Se(c)&&!r.has(l)){r.add(l),Ou(s,n);break}s=c}}}}}function Un(n,e){n.splice(n.getChildrenSize(),0,e)}function Ou(n,e){if(q(n))return n;const t=n.getPreviousSibling(),r=n.getNextSibling(),o=Ht();let i;if(Un(o,n.getChildren()),q(t)&&e===t.getListType())t.append(o),q(r)&&e===r.getListType()&&(Un(t,r.getChildren()),r.remove()),i=t;else if(q(r)&&e===r.getListType())r.getFirstChildOrThrow().insertBefore(o),i=r;else{const l=$t(e);l.append(o),n.replace(l),i=l}o.setFormat(n.getFormatType()),o.setIndent(n.getIndent());const s=M();return E(s)&&(i.getKey()===s.anchor.key&&s.anchor.set(o.getKey(),s.anchor.offset,"element"),i.getKey()===s.focus.key&&s.focus.set(o.getKey(),s.focus.offset,"element")),n.remove(),i}function Wc(n,e){const t=n.getLastChild(),r=e.getFirstChild();t&&r&&pt(t)&&pt(r)&&(Wc(t.getFirstChild(),r.getFirstChild()),r.remove());const o=e.getChildren();o.length>0&&n.append(...o),e.remove()}function by(){const n=M();if(E(n)){const e=new Set,t=n.getNodes(),r=n.anchor.getNode();if(Qh(r,t))e.add(wl(r));else for(let o=0;o<t.length;o++){const i=t[o];if(zd(i)){const s=e_(i,vn);s!=null&&e.add(wl(s))}}for(const o of e){let i=o;const s=Gh(o);for(const l of s){const c=V().setTextStyle(n.style).setTextFormat(n.format);Un(c,l.getChildren()),i.insertAfter(c),i=c,l.__key===n.anchor.key&&wt(n.anchor,je(Fe(c,"next"))),l.__key===n.focus.key&&wt(n.focus,je(Fe(c,"next"))),l.remove()}o.remove()}}}function Zh(n){const e=n.getListType()!=="check";let t=n.getStart();for(const r of n.getChildren())Z(r)&&(r.getValue()!==t&&r.setValue(t),e&&r.getLatest().__checked!=null&&r.setChecked(void 0),q(r.getFirstChild())||t++)}function vy(n){const e=new Set;if(pt(n)||e.has(n.getKey()))return;const t=n.getParent(),r=n.getNextSibling(),o=n.getPreviousSibling();if(pt(r)&&pt(o)){const i=o.getFirstChild();if(q(i)){i.append(n);const s=r.getFirstChild();q(s)&&(Un(i,s.getChildren()),r.remove(),e.add(r.getKey()))}}else if(pt(r)){const i=r.getFirstChild();if(q(i)){const s=i.getFirstChild();s!==null&&s.insertBefore(n)}}else if(pt(o)){const i=o.getFirstChild();q(i)&&i.append(n)}else if(q(t)){const i=Be(n),s=Be(t);i.append(s),s.append(n),o?o.insertAfter(i):r?r.insertBefore(i):t.append(i)}}function Au(n){if(pt(n))return;const e=n.getParent(),t=e?e.getParent():void 0;if(q(t?t.getParent():void 0)&&Z(t)&&q(e)){const r=e?e.getFirstChild():void 0,o=e?e.getLastChild():void 0;if(n.is(r))t.insertBefore(n),e.isEmpty()&&t.remove();else if(n.is(o))t.insertAfter(n),e.isEmpty()&&t.remove();else{const i=Be(n),s=Be(e);i.append(s),n.getPreviousSiblings().forEach(a=>s.append(a));const l=Be(n),c=Be(e);l.append(c),Un(c,n.getNextSiblings()),t.insertBefore(i),t.insertAfter(l),t.replace(n)}}}function Ty(n=!1){const e=M();if(!E(e)||!e.isCollapsed())return!1;const t=e.anchor.getNode();let r=null;if(Z(t)&&t.getChildrenSize()===0)r=t;else if(O(t)){const a=t.getParent();Z(a)&&a.getChildren().every(u=>O(u)&&u.getTextContent().trim()==="")&&(r=a)}if(r===null)return!1;const o=wl(r),i=r.getParent();q(i)||an(40);const s=i.getParent();let l;if(Se(s))l=V(),o.insertAfter(l);else{if(!Z(s))return!1;l=Be(s),s.insertAfter(l)}l.setTextStyle(e.style).setTextFormat(e.format).select();const c=r.getNextSiblings();if(c.length>0){const a=n?(function(f,d){return f.getStart()+d.getIndexWithinParent()})(i,r):1,u=Be(i).setStart(a);if(Z(l)){const f=Be(l);f.append(u),l.insertAfter(f)}else l.insertAfter(u);u.append(...c)}return(function(a){let u=a;for(;u.getNextSibling()==null&&u.getPreviousSibling()==null;){const f=u.getParent();if(f==null||!Z(f)&&!q(f))break;u=f}u.remove()})(r),!0}let vn=class extends ve{__value;__checked;$config(){return this.config("listitem",{$transform:e=>{const t=e.getParent();if(q(t))t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0);else if(t){const r=e.createParentElementNode();q(r)||an(340);const o=[e];for(const i of["previous","next"]){o.reverse();for(const{origin:s}of ne(e,i)){if(!Z(s))break;o.push(s)}}e.insertBefore(r),r.splice(0,0,o),Se(t)||(ds(r,bn(ne(r,"next")),{$shouldSplit:()=>!1,removeEmptyDestination:!0}),t.isEmpty()&&t.isAttached()&&t.remove())}},extends:ve,importDOM:{li:()=>({conversion:Ny,priority:0})}})}constructor(e=1,t=void 0,r){super(r),this.__value=e===void 0?1:e,this.__checked=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){const t=ee().createElement("li");return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,r){(function(s,l){const c=l.getParent();!q(c)||c.getListType()!=="check"||q(l.getFirstChild())?(s.removeAttribute("role"),s.removeAttribute("tabIndex"),s.removeAttribute("aria-checked")):(s.setAttribute("role","checkbox"),s.setAttribute("tabIndex","-1"),s.setAttribute("aria-checked",l.getChecked()?"true":"false"))})(t,this),t.value=this.__value,(function(s,l,c){const a=l.list;if(!a)return;const u=a.listitem,f=a.nested&&a.nested.listitem,d=c.getParent(),h=q(d)&&d.getListType()==="check",g=c.getChecked(),m=c.getChildren().some(y=>q(y)),p=[];a.listitemChecked!==void 0&&p.push(a.listitemChecked),a.listitemUnchecked!==void 0&&p.push(a.listitemUnchecked),f!==void 0&&p.push(...nn(f)),p.length>0&&Wt(s,...p);const _=[];if(u!==void 0&&_.push(...nn(u)),h){const y=g?a.listitemChecked:a.listitemUnchecked;y!==void 0&&_.push(y)}f!==void 0&&m&&_.push(...nn(f)),_.length>0&&we(s,..._)})(t,r.theme,this);const o=e?e.__style:"",i=this.__style;o!==i&&gn(t.style,i,o),(function(s,l,c){const a=l.__textStyle,u=c?c.__textStyle:"";if(c!==null&&u===a)return;const f=vi(a);for(const d in f)s.style.setProperty(`--listitem-marker-${d}`,f[d]);if(u!=="")for(const d in vi(u))d in f||s.style.removeProperty(`--listitem-marker-${d}`)})(t,this,e)}updateDOM(e,t,r){const o=t;return this.updateListItemDOM(e,o,r),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){const t=this.createDOM(e._config),r=this.getFormatType();r&&(t.style.textAlign=r);const o=this.getDirection();return o&&(t.dir=o),pt(this)?{after(i){if(W(i)){const s=i.previousElementSibling;if(W(s)&&s.nodeName==="LI"){for(;i.firstChild;)s.append(i.firstChild);i.remove()}}return i},element:t}:{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let t=0;t<e.length;t++){const r=e[t];if(S(r)&&this.canMergeWith(r)){const o=r.getChildren();this.append(...o),r.remove()}else super.append(r)}return this}replace(e,t){if(Z(e))return super.replace(e);this.setIndent(0);const r=this.getParentOrThrow();if(!q(r))return e;if(r.__first===this.getKey())r.insertBefore(e);else if(r.__last===this.getKey())r.insertAfter(e);else{const s=Be(r);let l=this.getNextSibling();for(;l;){const c=l;l=l.getNextSibling(),s.append(c)}r.insertAfter(e),e.insertAfter(s)}const o=this.__key;let i=0;if(t&&(S(e)||an(139),i=e.getChildrenSize(),e.splice(i,0,this.getChildren())),t&&S(e)){const s=M();if(E(s))for(const l of s.getStartEndPoints())l.key===o&&l.type==="element"&&l.set(e.getKey(),i+l.offset,"element")}return this.remove(),r.getChildrenSize()===0&&r.remove(),e}insertAfter(e,t=!0){const r=this.getParentOrThrow();if(q(r)||an(39),Z(e))return super.insertAfter(e,t);const o=this.getNextSiblings();if(r.insertAfter(e,t),o.length!==0){const i=Be(r);o.forEach(s=>i.append(s)),e.insertAfter(i,t)}return e}remove(e){const t=this.getPreviousSibling(),r=this.getNextSibling();super.remove(e),t&&r&&pt(t)&&pt(r)&&(Wc(t.getFirstChild(),r.getFirstChild()),r.remove())}resetOnCopyNodeFrom(e){super.resetOnCopyNodeFrom(e),e.getChecked()&&this.setChecked(!1)}insertNewAfter(e,t=!0){const r=Be(this);return this.insertAfter(r,t),r}collapseAtStart(e){if(pt(this))return!1;const t=this.getParentOrThrow();if(Z(t.getParentOrThrow()))return Au(this),!0;const r=V().append(...this.getChildren()),o=this.getNextSiblings();if(o.length>0){const i=Be(t);i.append(...o),t.insertAfter(i)}return t.insertAfter(r),this.remove(),t.getChildrenSize()===0&&t.remove(),r.selectStart(),!0}getValue(){return this.getLatest().__value}setValue(e){const t=this.getWritable();return t.__value=e,t}getChecked(){const e=this.getLatest();let t;const r=this.getParent();return q(r)&&(t=r.getListType()),t==="check"?!!e.__checked:void 0}setChecked(e){const t=this.getWritable();return t.__checked=e,t}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 t=e.getParentOrThrow(),r=0;for(;Z(t);)t=t.getParentOrThrow().getParentOrThrow(),r++;return r}setIndent(e){typeof e!="number"&&an(117),(e=Math.floor(e))>=0||an(199);let t=this.getIndent();for(;t!==e;)t<e?(vy(this),t++):(Au(this),t--);return this}canInsertAfter(e){return Z(e)}canReplaceWith(e){return Z(e)}canMergeWith(e){return Z(e)||Jt(e)}extractWithChild(e,t){if(!E(t))return!1;const r=t.anchor.getNode(),o=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(o)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return $t("bullet")}canMergeWhenEmpty(){return!0}};function Ny(n){if(n.classList.contains("task-list-item")){for(const r of n.children)if(r.tagName==="INPUT")return Mu(r)}if(n.classList.contains("joplin-checkbox")){for(const r of n.children)if(r.classList.contains("checkbox-wrapper")&&r.children.length>0&&r.children[0].tagName==="INPUT")return Mu(r.children[0])}const e=n.getAttribute("aria-checked"),t=Ht(e==="true"||e!=="false"&&void 0);return qt(t,n),{after:eg.bind(null,t),node:bt(t,n)}}function Mu(n){if(n.getAttribute("type")!=="checkbox")return{node:null};const e=Ht(n.hasAttribute("checked"));return{after:eg.bind(null,e),node:e}}function eg(n,e){const t=e[0];return e.length===1&&Jt(t)&&!n.getFormatType()&&t.getFormatType()?(n.setFormat(t.getFormatType()),t.getChildren()):e}function Ht(n){return Ge(new vn(void 0,n))}function Z(n){return n instanceof vn}let Gn=class extends ve{__tag;__start;__listType;$config(){return this.config("list",{$transform:e=>{(function(t){const r=t.getNextSibling();q(r)&&t.getListType()===r.getListType()&&Wc(t,r)})(e),Zh(e)},extends:ve,importDOM:{ol:()=>({conversion:Du,priority:0}),ul:()=>({conversion:Du,priority:0})}})}constructor(e="number",t=1,r){super(r);const o=ky[e]||e;this.__listType=o,this.__tag=o==="number"?"ol":"ul",this.__start=t}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 t=this.getWritable();return t.__listType=e,t.__tag=e==="number"?"ol":"ul",t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){const t=this.getWritable();return t.__start=e,t}createDOM(e,t){const r=this.__tag,o=ee().createElement(r);return this.__start!==1&&o.setAttribute("start",String(this.__start)),o.__lexicalListType=this.__listType,Fu(o,e.theme,this),o}updateDOM(e,t,r){return e.__tag!==this.__tag||e.__listType!==this.__listType||(Fu(t,r.theme,this),e.__start!==this.__start&&t.setAttribute("start",String(this.__start)),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){const t=this.createDOM(e._config,e);return W(t)&&(this.__start!==1&&t.setAttribute("start",String(this.__start)),this.__listType==="check"&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,t,r){let o=r;for(let i=0;i<r.length;i++){const s=r[i];Z(s)||(o===r&&(o=[...r]),o[i]=this.createListItemNode().append(!S(s)||q(s)||s.isInline()?s:Ne(s.getTextContent())))}return super.splice(e,t,o)}extractWithChild(e){return Z(e)}createListItemNode(){return Ht()}};function Fu(n,e,t){const r=[],o=[],i=e.list;if(i!==void 0){const s=i[`${t.__tag}Depth`]||[],l=kl(t)-1,c=l%s.length,a=s[c],u=i[t.__tag];let f;const d=i.nested,h=i.checklist;if(d!==void 0&&d.list&&(f=d.list),u!==void 0&&r.push(u),h!==void 0&&t.__listType==="check"&&r.push(h),a!==void 0){r.push(...nn(a));for(let g=0;g<s.length;g++)g!==c&&o.push(t.__tag+g)}if(f!==void 0){const g=nn(f);l>1?r.push(...g):o.push(...g)}}o.length>0&&Wt(n,...o),r.length>0&&we(n,...r)}function Du(n){let e;if((function(t){return W(t)&&t.nodeName.toLowerCase()==="ol"})(n)){const t=n.start;e=$t("number",t)}else e=(function(t){if(t.getAttribute("__lexicallisttype")==="check"||t.classList.contains("contains-task-list")||t.getAttribute("data-is-checklist")==="1")return!0;for(const r of t.childNodes)if(W(r)&&r.hasAttribute("aria-checked"))return!0;return!1})(n)?$t("check"):$t("bullet");return bt(e,n),{after:t=>(function(r,o){const i=o.createListItemNode.bind(o),s=[];for(let l=0;l<r.length;l++){const c=r[l];if(Z(c)){s.push(c);const a=c.getChildren();a.length>1&&a.forEach(u=>{q(u)&&s.push(i().append(u))})}else s.push(i().append(c))}return s})(t,e),node:e}}const ky={ol:"number",ul:"bullet"};function $t(n="number",e=1){return Ge(new Gn(n,e))}function q(n){return n instanceof Gn}function wy(n){const e=[];for(const t of n)if(Z(t)){e.push(t);const r=t.getChildren();if(r.length>1)for(const o of r)q(o)&&e.push(Ht().append(o))}else e.push(Ht().append(t));return e}const Ey={$import:(n,e)=>{let t;var r;return Lh(e,"ol")?t=$t("number",e.start):t=(r=e).matches('[__lexicallisttype="check"], .contains-task-list, [data-is-checklist="1"]')||r.querySelector(":scope > [aria-checked]")!==null?$t("check"):$t("bullet"),bt(t,e),[t.splice(0,0,Pc(wy(n.$importChildren(e)),e))]},match:Oe.tag("ol","ul"),name:"@lexical/list/list"};function tg(n,e){if(e.length!==1)return e;const t=e[0];return Jt(t)&&!n.getFormatType()&&t.getFormatType()?(n.setFormat(t.getFormatType()),t.getChildren()):e}function ng(n){const e=s=>Rc(s)&&!q(s);if(!n.some(e))return n;const t=[];let r=[];const o=()=>{r.length>0&&(t.push(r),r=[])};for(const s of n)e(s)?(o(),t.push(S(s)?s.getChildren():[s])):r.push(s);o();const i=[];for(const s of t)i.length>0&&i.push(jt()),i.push(...s);return i}const $y={$import:(n,e)=>{const t=e.getAttribute("aria-checked"),r=Ht(t==="true"||t!=="false"&&void 0);return qt(r,e),bt(r,e),[r.splice(0,0,ng(tg(r,n.$importChildren(e))))]},match:Oe.tag("li"),name:"@lexical/list/li"};function Ru(n,e,t){const r=Lh(t,"input")?t:t.querySelector('input[type="checkbox"]');if(!r||r.getAttribute("type")!=="checkbox")return[];const o=Ht(r.hasAttribute("checked"));return qt(o,e),bt(o,e),[o.splice(0,0,ng(tg(o,n.$importChildren(e))))]}Oe.tag("li").classAll("task-list-item"),Oe.tag("li").classAll("joplin-checkbox");const Oy=z("UPDATE_LIST_START_COMMAND"),Ay=z("INSERT_UNORDERED_LIST_COMMAND"),My=z("INSERT_ORDERED_LIST_COMMAND"),Fy=z("REMOVE_LIST_COMMAND");function Pu(n,e){return qe(n.registerCommand(My,()=>($u("number"),!0),gt),n.registerCommand(Oy,t=>{const{listNodeKey:r,newStart:o}=t,i=te(r);return!!q(i)&&(i.getListType()==="number"&&(i.setStart(o),Zh(i)),!0)},gt),n.registerCommand(Ay,()=>($u("bullet"),!0),gt),n.registerCommand(Fy,()=>(by(),!0),gt),n.registerCommand(Pn,()=>Ty(!!(e&&e.restoreNumbering)),gt),n.registerCommand(Qi,t=>{const r=M();if(!E(r)||!r.isCollapsed())return!1;const{anchor:o}=r;if(o.offset!==0)return!1;let i=o.getNode();for(;!Z(i);){if(i.getPreviousSibling()!==null)return!1;const s=i.getParent();if(s===null)return!1;i=s}return!(!Z(i)||!i.collapseAtStart(r))&&(t.preventDefault(),!0)},sm),n.registerNodeTransform(vn,t=>{const r=t.getFirstChild();if(r){if(O(r)){const o=r.getStyle(),i=r.getFormat();t.getTextStyle()!==o&&t.setTextStyle(o),t.getTextFormat()!==i&&t.setTextFormat(i)}}else{const o=M();E(o)&&(o.style!==t.getTextStyle()||o.format!==t.getTextFormat())&&o.isCollapsed()&&t.is(o.anchor.getNode())&&t.setTextStyle(o.style).setTextFormat(o.format)}}),n.registerNodeTransform(on,t=>{const r=t.getParent();if(Z(r)&&t.is(r.getFirstChild())){const o=t.getStyle(),i=t.getFormat();o===r.getTextStyle()&&i===r.getTextFormat()||r.setTextStyle(o).setTextFormat(i)}}))}function Dy(n){const e=t=>{const r=t.getParent();if(q(t.getFirstChild())||!q(r))return;const o=U(t,i=>Z(i)&&q(i.getParent())&&Z(i.getPreviousSibling()));if(o===null&&t.getIndent()>0)t.setIndent(0);else if(Z(o)){const i=o.getPreviousSibling();if(Z(i)){const s=(function(c){let a=c,u=a.getFirstChild();for(;q(u);){const f=u.getLastChild();if(!Z(f))break;a=f,u=a.getFirstChild()}return a})(i),l=s.getParent();if(q(l)){const c=kl(l);c+1<kl(r)&&t.setIndent(c)}}}};return n.registerNodeTransform(Gn,t=>{const r=[t];for(;r.length>0;){const o=r.shift();if(q(o)){for(const i of o.getChildren())if(Z(i)){e(i);const s=i.getFirstChild();q(s)&&r.push(s)}}}})}function Bi(n,e,t=null){const r=Zd(t),o=t?Gd(t):[],i=t!==null&&o.length>0;if(i&&typeof r.caretPositionFromPoint=="function"){const s=r.caretPositionFromPoint(n,e,{shadowRoots:o});if(s!==null&&(function(l,c){for(let a=l;a!==null;){if(a===c)return!0;a=Vn(a)}return!1})(s.offsetNode,t))return{node:s.offsetNode,offset:s.offset}}if(i){const s=t.getRootNode();if(Ut(s)){const l=s.elementFromPoint(n,e);if(l!==null&&t.contains(l)){const c=(function(a,u,f,d){const h=d.createRange(),g=N=>u<N.top?N.top-u:u>N.bottom?u-N.bottom:0,m=N=>a<N.left?N.left-a:a>N.right?a-N.right:0,p=d.createTreeWalker(f,NodeFilter.SHOW_TEXT);let _=null,y=1/0,x=1/0;for(let N=p.nextNode();N;N=p.nextNode()){h.selectNodeContents(N);for(const v of h.getClientRects()){const w=g(v),A=m(v);(w<y||w===y&&A<x)&&(y=w,x=A,_=N)}}if(_===null)return null;let C=0,T=1/0,b=1/0;for(let N=0;N<=_.length;N++){h.setStart(_,N),h.collapse(!0);const v=h.getBoundingClientRect(),w=g(v),A=Math.abs(a-v.left);(w<T||w===T&&A<b)&&(T=w,b=A,C=N)}return{node:_,offset:C}})(n,e,l,r);if(c!==null)return c}}}if(typeof r.caretRangeFromPoint=="function"){const s=r.caretRangeFromPoint(n,e);return s===null?null:{node:s.startContainer,offset:s.startOffset}}if(typeof r.caretPositionFromPoint=="function"){const s=r.caretPositionFromPoint(n,e);return s===null?null:{node:s.offsetNode,offset:s.offset}}return null}function dr(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const El={"application/x-lexical-editor":0,"text/html":10,"text/plain":20,"text/uri-list":30};function Ry(n){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:e=>e}).createHTML(n):n}const Iu=(n,e)=>{if(!E(e))return e.insertRawText(n),!0;const t=r=>{const o=M();E(o)&&r(o)};return wd(n,{linebreak:()=>t(r=>r.insertParagraph()),tab:()=>t(r=>r.insertNodes([Ao()])),text:r=>t(o=>o.insertText(r))}),!0},$l={"application/x-lexical-editor":[(n,e,t)=>{try{const r=be(),o=JSON.parse(n);if(o&&o.namespace===r._config.namespace&&Array.isArray(o.nodes))return Lu(r,jy(o.nodes),e),!0}catch(r){console.error(r)}return t()}],"text/html":[(n,e,t)=>{try{const r=be(),o=new DOMParser().parseFromString(Ry(n),"text/html");return Lu(r,Uh(r,o),e),!0}catch(r){return console.error(r),t()}}],"text/plain":[Iu],"text/uri-list":[Iu]};function Py(n,e,t,r){if(!n)return!1;const o=i=>!!n[i]&&n[i](e,t,o.bind(null,i-1),r);return o(n.length-1)}function rg(n,e,t){const r=e.getData("text/plain");for(const o of(function(i){return Object.keys(i.$importMimeType).filter(s=>i.$importMimeType[s]!==void 0).sort((s,l)=>{const c=i.priority[s],a=i.priority[l];return c===void 0&&a===void 0?s<l?-1:s>l?1:0:c===void 0?1:a===void 0?-1:c-a})})(n)){const i=e.getData(o);if(i&&(o!=="text/html"||i!==r)&&Py(n.$importMimeType[o],i,t,e))return!0}return!1}const Iy={$importMimeType:$l,$insertDataTransfer:(n,e)=>rg({$importMimeType:$l,priority:El},n,e),priority:El},Ly={build:(n,e)=>({$importMimeType:e.$importMimeType,$insertDataTransfer:(t,r)=>rg(e,t,r),priority:e.priority}),config:{$importMimeType:$l,priority:El},mergeConfig(n,e){const t=Ec(n,e);if(e.$importMimeType){const r={...n.$importMimeType};for(const[o,i]of Object.entries(e.$importMimeType))if(i){const s=r[o];r[o]=s?[...s,...i]:i}t.$importMimeType=r}return e.priority&&(t.priority={...n.priority,...e.priority}),t},name:"@lexical/clipboard/Import"};function og(n,e=M()){return e==null&&dr(166),E(e)&&e.isCollapsed()||e.getNodes().length===0?"":Lc(n,e)}function ig(n,e=M()){return e==null&&dr(166),E(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(Wy(n,e))}function Ol(n,e,t){(function(){const r=y_(Ly.name);return r?r.output:Iy})().$insertDataTransfer(n,e)}const sg="application/x-lexical-drag";function Ky(n,e){const t={editorKey:e.getKey()};n.setData(sg,JSON.stringify(t))}function zy(n,e,t){const r=n.dataTransfer;if(r===null)return!1;const o=(function(a){const u=a.getData(sg);if(!u)return null;let f;try{f=JSON.parse(u)}catch{return null}return(d=f)!==null&&typeof d=="object"&&"editorKey"in d&&typeof d.editorKey=="string"?f:null;var d})(r);if(o===null)return!1;const i=(function(a,u){const f=Bi(a.clientX,a.clientY,u.getRootElement());if(f===null)return null;const d=Xe(f.node);if(d===null)return null;if(O(d))return yn(d,"next",f.offset);if(S(d))return Cl(d,f.offset,"next");const h=d.getParent();return h===null?null:Cl(h,d.getIndexWithinParent()+1,"next")})(n,e);if(i===null)return!1;const s=dh(i);if(s===null)return!1;const l=o.editorKey===e.getKey(),c=M();if(l){if(!E(c)||c.isCollapsed())return!1;if((function(a,u){const{anchor:f,focus:d}=wc(xl(u),"next");return So(f,a)<0&&So(a,d)<0})(i,c))return n.preventDefault(),!0;c.removeText()}if(!s.origin.isAttached())return n.preventDefault(),!0;if(t(r,Rr(Ro(s)),e),!l){const a=e.getRootElement(),u=a?a.ownerDocument:null,f=u?(function(d,h){for(const g of Qd(h)){const m=Kr(g);if(Do(m)&&m.getKey()===d&&W(g))return g}return null})(o.editorKey,u):null;f!==null&&f.dispatchEvent(new InputEvent("beforeinput",{bubbles:!0,cancelable:!0,inputType:"deleteByDrag"}))}return n.preventDefault(),!0}function By(n,e){return zy(n,e,Ol)}function Lu(n,e,t){n.dispatchCommand(Jf,{nodes:e,selection:t})||(t.insertNodes(e),(function(r){if(E(r)&&r.isCollapsed()){const o=r.anchor;let i=null;const s=Je(o,"previous");if(s)if(Ct(s))i=s.origin;else{const l=Et(s,Fe(me(),"next").getFlipped());for(const c of l){if(O(c.origin)){i=c.origin;break}if(S(c.origin)&&!c.origin.isInline())break}}if(i&&O(i)){const l=i.getFormat(),c=i.getStyle();r.format===l&&r.style===c||(r.format=l,r.style=c,r.dirty=!0)}}})(t))}function Al(n,e,t,r=[]){let o=e===null||t.isSelected(e);const i=S(t)&&t.excludeFromCopy("html");let s=t;e!==null&&O(s)&&(s=ph(e,s,"clone"));const l=S(s)?s.getChildren():[],c=(function(u){const f=u.exportJSON(),d=u.constructor;if(f.type!==d.getType()&&dr(58,d.name),S(u)){const h=f.children;Array.isArray(h)||dr(59,d.name)}return f})(s);O(s)&&s.getTextContentSize()===0&&(o=!1);const a=o&&de(e)&&S(t)?null:e;for(let u=0;u<l.length;u++){const f=l[u],d=Al(n,a,f,c.children);!o&&S(t)&&d&&t.extractWithChild(f,e,"clone")&&(o=!0)}if(o&&!i){const u=xt(s);if(u.length>0){const f={};for(const d of u){const h=zn(s,d);h===null&&dr(366,s.constructor.name,d);const g=[];Al(n,null,h,g),g.length===1&&g[0].type===h.getType()||dr(385,d,s.constructor.name,String(g.length),String(g.length>0?g[0].type:"none")),f[d]=g[0]}c.$slots=f}}if(o&&!i)r.push(c);else if(Array.isArray(c.children))for(let u=0;u<c.children.length;u++){const f=c.children[u];r.push(f)}return o}function Wy(n,e){const t=[],r=me(),o=E(e)?e.anchor.getNode():de(e)?e.getNodes()[0]??null:null,i=o!==null?cs(o):null,s=(S(i)?i:r).getChildren();for(let l=0;l<s.length;l++)Al(n,e,s[l],t);return{namespace:n._config.namespace,nodes:t}}function jy(n){const e=[];for(const t of n)e.push(em(t));return e}let tr=null;async function Ml(n,e,t){if(tr!==null)return!1;if(e!==null)return new Promise((a,u)=>{n.update(()=>{a(Ku(n,e,t))})});const r=n.getRootElement(),o=n._window||window,i=o.document,s=De(o);if(r===null||s===null)return!1;const l=i.createElement("span");l.style.position="fixed",l.style.top="-1000px",l.append(i.createTextNode("#")),r.append(l);const c=i.createRange();return c.setStart(l,0),c.setEnd(l,1),s.removeAllRanges(),s.addRange(c),new Promise((a,u)=>{const f=n.registerCommand(Oo,d=>(Kt(d,ClipboardEvent)&&(f(),tr!==null&&(o.clearTimeout(tr),tr=null),a(Ku(n,d,t))),!0),Id);tr=o.setTimeout(()=>{f(),tr=null,a(!1)},50),i.execCommand("copy"),l.remove()})}function Ku(n,e,t){if(t===void 0){const o=De(n._window),i=M();if(!i||i.isCollapsed()||!o)return!1;const s=rt(o,n.getRootElement()),l=s.anchorNode,c=s.focusNode;if(l!==null&&c!==null&&!Fo(n,l,c))return!1;t=jc(i)}e.preventDefault();const r=e.clipboardData;return r!==null&&(lg(r,t),!0)}const Uy=[["text/html",og],["application/x-lexical-editor",ig]];function jc(n=M()){return(function(e,t){const r={"text/plain":""};for(const[o,i]of Object.entries(e))if(i){const s=Jy(i,t);s!==null&&(r[o]=s)}return r})(Hy(),n)}function lg(n,e){for(const[t]of Uy)e[t]===void 0&&n.setData(t,"");for(const t in e){const r=e[t];r!==void 0&&n.setData(t,r)}}function Hy(n=be()){const e=Br(n,qy.name);return e?e.output:cg}const cg={"application/x-lexical-editor":[(n,e)=>n?ig(be(),n):e()],"text/html":[(n,e)=>n?og(be(),n):e()],"text/plain":[(n,e)=>n?n.getTextContent():e()]};function Jy(n,e){const t=r=>n[r]?n[r](e,t.bind(null,r-1)):null;return t(n.length-1)}const qy={build:(n,e,t)=>e.$exportMimeType,config:{$exportMimeType:cg},mergeConfig(n,e){const t=Ec(n,e);if(e.$exportMimeType){const r={...n.$exportMimeType};for(const[o,i]of Object.entries(e.$exportMimeType))if(i){const s=r[o];r[o]=s?[...s,...i]:i}t.$exportMimeType=r}return t},name:"@lexical/clipboard/GetClipboardData"},Vy={bold:"bold",italic:"italic",strikeThrough:"strikethrough",subscript:"subscript",superscript:"superscript",underline:"underline"},Wi=Symbol.for("@lexical/dragon/WindowState");function Yy(n,e,t){const r=(function(o){let i=o[Wi];return i===void 0&&(i={dispose:()=>{},editors:new Map,installs:new Set},o[Wi]=i),i})(n);if(r.installs.size===0){const o=Qy.bind(n);n.addEventListener("message",o,!0),r.dispose=()=>{n.removeEventListener("message",o,!0)}}if(r.installs.add(e),t){const o=r.editors.get(t)||new Set;o.add(e),r.editors.set(t,o)}return Xy.bind(null,n,r,e,t)}function Xy(n,e,t,r){if(r){const o=e.editors.get(r);o&&o.delete(t)&&o.size===0&&e.editors.delete(r)}e.installs.delete(t)&&e.installs.size===0&&(e.dispose(),delete n[Wi])}function zu(n){return n&&n.ownerDocument.defaultView}function Gy(n){const e=a_(()=>zu(n.getRootElement()),t=>n.registerRootListener(r=>{t.value=zu(r)}));return Ac(()=>{const t=e.value;if(t)return Yy(t,Symbol("@lexical/dragon/editorInstall"),n)})}function Qy(n){if(n.origin!==this.location.origin)return;const e=(function(r){const o=r[Wi];if(o===void 0)return null;const i=Kr(Mr(r.document));return Do(i)&&o.editors.has(i)?i:null})(this);if(e===null)return;const t=n.data;if(typeof t=="string"){let r;try{r=JSON.parse(t)}catch{return}if(r&&r.protocol==="nuanria_messaging"&&r.type==="request"){const o=r.payload;if(o&&o.functionId==="makeChanges"){const i=o.args;if(Array.isArray(i)){const[s,l,c,a,u,f]=i;if(![s,l,a,u].every(Number.isFinite)||typeof c!="string"&&c!==-1)return;e.update(()=>{const d=M();if(E(d)){const h=d.anchor;let g=h.getNode(),m=0,p=0;if(O(g)&&s>=0&&l>=0&&(m=s,p=s+l,d.setTextNodeRange(g,m,g,p)),typeof c!="string"||m===p&&c===""||(d.insertRawText(c),g=h.getNode()),O(g)){const _=g.getTextContentSize();m=Math.min(Math.max(a,0),_),p=a<0||u<0?m:Math.min(a+u,_),d.setTextNodeRange(g,m,g,p)}if(typeof f=="string"&&u>0&&!d.isCollapsed()){const _=Vy[f];_!==void 0&&d.formatText(_)}n.stopImmediatePropagation()}})}}}}}const Zy={$import:(n,e)=>{const t=Pr(e.nodeName.toLowerCase());return Yn(e,t),qt(t,e),bt(t,e),[t.splice(0,0,n.$importChildren(e))]},match:Oe.tag("h1","h2","h3","h4","h5","h6"),name:"@lexical/rich-text/heading"},ex={$import:(n,e)=>{const t=jr();return qt(t,e),Yn(e,t),bt(t,e),[t.splice(0,0,n.$importChildren(e))]},match:Oe.tag("blockquote"),name:"@lexical/rich-text/blockquote"};Oe.tag("blockquote");Oe.tag("p"),Oe.tag("span");const Bu=z("DRAG_DROP_PASTE_FILE"),Bs=Eo("shadowRoot",{parse:Boolean});class ps extends ve{$config(){return this.config("quote",{extends:ve,importDOM:{blockquote:()=>({conversion:tx,priority:0})},stateConfigs:[{flat:!0,stateConfig:Bs}]})}isShadowRoot(){return $o(this,Bs)}setIsShadowRoot(e){return hr(this,Bs,e)}createDOM(e){const t=ee().createElement("blockquote");return we(t,e.theme.quote),t}updateDOM(e,t,r){return!1}exportDOM(e){const{element:t}=super.exportDOM(e);if(W(t)){this.isEmpty()&&t.append(ee().createElement("br"));const r=this.getFormatType();r&&(t.style.textAlign=r);const o=this.getDirection();o&&(t.dir=o)}return{element:t}}exportJSON(){return super.exportJSON()}static importJSON(e){return jr().updateFromJSON(e)}insertNewAfter(e,t){const r=V(),o=this.getDirection();return r.setDirection(o),this.insertAfter(r,t),r}collapseAtStart(){if(this.isShadowRoot()){for(const t of this.getChildren())this.insertBefore(t);return this.remove(),!0}const e=V();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function jr(n){const e=Ge(new ps);return n&&n.shadowRoot?e.setIsShadowRoot(!0):e}function ji(n){return n instanceof ps}let ms=class extends ve{__tag;$config(){return this.config("heading",{extends:ve,importDOM:{h1:()=>({conversion:nr,priority:0}),h2:()=>({conversion:nr,priority:0}),h3:()=>({conversion:nr,priority:0}),h4:()=>({conversion:nr,priority:0}),h5:()=>({conversion:nr,priority:0}),h6:()=>({conversion:nr,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&Wu(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Wu(e)?{conversion:()=>({node:Pr("h1")}),priority:3}:null}})}afterCloneFrom(e){super.afterCloneFrom(e),this.__tag=e.__tag}constructor(e="h1",t){super(t),this.__tag=e}getTag(){return this.getLatest().__tag}setTag(e){const t=this.getWritable();return t.__tag=e,t}createDOM(e){const t=this.__tag,r=ee().createElement(t),o=e.theme.heading;if(o!==void 0){const i=o[t];we(r,i)}return r}updateDOM(e,t,r){return e.__tag!==this.__tag}exportDOM(e){const{element:t}=super.exportDOM(e);if(W(t)){this.isEmpty()&&t.append(ee().createElement("br"));const r=this.getFormatType();r&&(t.style.textAlign=r);const o=this.getDirection();o&&(t.dir=o)}return{element:t}}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){const r=e?e.anchor.offset:0,o=this.getLastDescendant(),i=!o||e&&e.anchor.key===o.getKey()&&r===o.getTextContentSize()||!e?V():Pr(this.getTag()),s=this.getDirection();if(i.setDirection(s),this.insertAfter(i,t),r===0&&!this.isEmpty()&&e){const l=V();l.select(),this.replace(l,!0)}return i}collapseAtStart(){if(this.isEmpty()){const e=V();this.getChildren().forEach(t=>e.append(t)),this.replace(e)}return!0}extractWithChild(){return!0}};function Wu(n){return n.nodeName.toLowerCase()==="span"&&n.style.fontSize==="26pt"}function nr(n){const e=n.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=Pr(e),Yn(n,t),qt(t,n),bt(t,n)),{node:t}}function tx(n){const e=jr();return qt(e,n),Yn(n,e),bt(e,n),{node:e}}function Pr(n="h1"){return Ge(new ms(n))}function ag(n){return n instanceof ms}function ju(n){const e=Xe(n);return G(e)}function rr(n,e,t,r){let o=!1,i=null;if(n.isCollapsed()&&n.anchor.type==="text"){const l=n.anchor.getNode();if(O(l)){i=l;const c=n.anchor.offset,a=c===l.getTextContentSize()&&l.getNextSibling()===null,u=c===0&&l.getPreviousSibling()===null;o=t==="end"&&a||t==="start"&&u||t==="both"&&(a||u)}}let s=!1;for(const[l,c]of Object.entries(r)){if(c==null||!c[e])continue;const a=l;if(c.onlyAtBoundary){if(!(o&&i&&O(i)&&i.hasFormat(a)))continue;s=!0}n.hasFormat(a)&&n.toggleFormat(a)}s&&n.setStyle("")}const nx={capitalize:{enter:!0,space:!0,tab:!0},lowercase:{enter:!0,space:!0,tab:!0},uppercase:{enter:!0,space:!0,tab:!0}};function Yo(n,e){return(function(t,r){if(!t.isCollapsed())return!1;const o=Je(t.focus,r),i=U(o.origin,so);if(!i)return!1;const s=t.focus.getNode();if(!i.is(s)&&!Ar(s,i))return!1;const l=Et(o,ne(i,r));if(l.getTextSlices().some(f=>f&&f.getTextContentSize()>0))return!1;const c=Et(l.anchor.getSiblingCaret(),l.focus);let a=c.anchor.origin;for(const f of c){if(!Mt(f)||!f.origin.is(a.getParent()))return!1;a=f.origin}let u=i;for(const f of Dr(ne(i,r))){if(!f.origin.is(u.getParent())){if(ai(f.origin)){const d=ne(u,r);return Rr(Et(d,d)),!0}break}if(!so(f.origin))break;u=f.origin}return!1})(n,e)||(function(t,r){if(!t.isCollapsed()||t.anchor.type!=="element")return!1;const o=Je(t.anchor,r).getNodeAtCaret();return!(!so(o)||o.isInline()||(Rr(Ro(je(Fe(o,r)))),0))})(n,e)}function Uu(n){return G(n)&&!n.isInline()&&!n.isIsolated()&&n.isKeyboardSelectable()}function Xo(n){const e=po();e.add(n),pe(e)}function Hu(n,e){if(!n.isCollapsed())return!1;const t=n.focus,r=t.getNode(),o=e?"previous":"next",i=Je(t,o);if(t.type==="element"&&S(r)&&Se(r)){const _=i.getNodeAtCaret();return!(_===null||!Uu(_))&&(Xo(_.__key),!0)}const s=U(S(r)?r:r.getParentOrThrow(),_=>S(_)&&!_.isInline()&&Se(_.getParent()));if(s===null)return!1;const l=ne(s,o).getNodeAtCaret();if(l===null||!Uu(l))return!1;if(s.getTextContentSize()===0)return Xo(l.__key),!0;const c=be().getRootElement();if(c===null)return!1;const a=De(c.ownerDocument.defaultView);if(a===null||a.rangeCount===0)return!1;const u=a.anchorNode,f=a.anchorOffset,d=a.focusNode,h=a.focusOffset;a.modify("move",e?"backward":"forward","line");const g=a.anchorNode,m=a.anchorOffset;if(g===null)return Ju(a,u,f,d,h),!1;const p=Xe(g);return Ju(a,u,f,d,h),p===null?!1:(g===u&&m===f||!p.is(s)&&!Ar(p,s))&&(Xo(l.__key),!0)}function Ju(n,e,t,r,o){e!==null&&r!==null&&n.setBaseAndExtent(e,t,r,o)}function qu(n,e){if(!n.isCollapsed())return!1;const t=n.focus.getNode(),r=U(S(t)?t:t.getParentOrThrow(),p=>S(p)&&!p.isInline());if(r===null)return!1;const o=be(),i=o.getRootElement();if(i===null)return!1;const s=i.ownerDocument.defaultView;if(s===null)return!1;let l=!1;for(const p of r.getChildren())if(S(p)&&p.isInline()){const _=o.getElementByKey(p.getKey());if(_!==null){const y=s.getComputedStyle(_).display;if(y==="inline-grid"||y==="inline-flex"){l=!0;break}}}if(!l)return!1;const c=ne(r,e?"previous":"next").getNodeAtCaret();if(c===null||!S(c)){if(e){const p=r.getFirstDescendant();O(p)?p.select(0,0):r.select(0,0)}else{const p=r.getLastDescendant();if(O(p)){const _=p.getTextContentSize();p.select(_,_)}else{const _=r.getChildrenSize();r.select(_,_)}}return!0}const a=o.getElementByKey(c.getKey());if(a===null)return!1;const u=De(s);if(u===null||u.rangeCount===0)return!1;const f=u.getRangeAt(0).cloneRange();f.collapse(!0);const d=f.getBoundingClientRect(),h=a.getBoundingClientRect(),g=h.top+h.height/2;if(d.height>0){const p=Bi(d.left,g,i);if(p!==null&&a.contains(p.node)){const _=i.ownerDocument.createRange();return _.setStart(p.node,p.offset),_.collapse(!0),n.applyDOMRange(_),n.dirty=!0,!0}}const m=e?c.getLastDescendant():c.getFirstDescendant();if(O(m)){const p=e?m.getTextContentSize():0;m.select(p,p)}else{const p=c.getChildrenSize();c.select(e?p:0,e?p:0)}return!0}function Go(n,e){const t=ne(n,e),r=t.getAdjacentCaret();r!==null&&S(r.origin)&&!r.origin.isInline()&&r.origin.isShadowRoot()?Rr(Ro(t)):e==="next"?n.selectNext(0,0):n.selectPrevious()}function Vu(n,e,t){t.preventDefault(),t.stopPropagation();const r=n.getNodes();if(r.length===0)return!0;const o=r.map(c=>ne(c,"next")).sort(So),i=(e?o[0]:o[o.length-1]).origin,s=U(i,c=>c!==i&&S(c)&&!c.isInline())??me(),l=e?0:s.getChildrenSize();return s.select(l,l),!0}function rx(n,e=Po(nx)){return qe(n.registerCommand(Yi,()=>{const t=M();return de(t)?(t.clear(),!0):(E(t)&&rr(t,"click","both",e.peek()),!1)},X),n.registerCommand(hn,t=>{const r=M();return E(r)?(r.deleteCharacter(t),!0):!!de(r)&&(r.deleteNodes(),!0)},X),n.registerCommand(Tr,t=>{const r=M();return!!E(r)&&(r.deleteWord(t),!0)},X),n.registerCommand(Nr,t=>{const r=M();return!!E(r)&&(r.deleteLine(t),!0)},X),n.registerCommand(Mn,t=>{const r=M();if(typeof t=="string")r!==null&&r.insertText(t);else{if(r===null)return!1;const o=t.dataTransfer;if(o!=null)Ol(o,r);else if(E(r)){const i=t.data;return i&&r.insertText(i),!0}}return!0},X),n.registerCommand(oi,()=>{const t=M();return!!E(t)&&(t.removeText(),!0)},X),n.registerCommand(kt,t=>{const r=M();return!(!E(r)&&!de(r))&&(xd(r,t),!0)},X),n.registerCommand(Cp,t=>{const r=M();return!(!E(r)&&!de(r))&&(Vp(r,t),!0)},X),n.registerCommand(td,t=>{const r=M();if(!E(r)&&!de(r))return!1;const o=r.getNodes();for(const i of o){const s=U(i,l=>S(l)&&!l.isInline());s!==null&&s.setFormat(t)}return!0},X),n.registerCommand(gr,t=>{const r=M();return!!E(r)&&(r.insertLineBreak(t),!0)},X),n.registerCommand(Pn,()=>{const t=M();return!!E(t)&&(t.insertParagraph(),!0)},X),n.registerCommand(Sp,()=>{const t=Ao(),r=M();return E(r)&&(t.setFormat(r.format),t.setStyle(r.style)),ns([t]),!0},X),n.registerCommand(bp,()=>uu(t=>{const r=t.getIndent();t.setIndent(r+1)}),X),n.registerCommand(ma,()=>uu(t=>{const r=t.getIndent();r>0&&t.setIndent(Math.max(0,r-1))}),X),n.registerCommand(Zl,t=>{const r=M();if(de(r)){const o=r.getNodes();if(o.length>0)return t.preventDefault(),Go(o[0],"previous"),!0}else if(E(r)&&((function(o){const i=o.focus;return i.key==="root"&&i.offset===0})(r)||!t.shiftKey&&Yo(r,"previous")||!t.shiftKey&&Hu(r,!0)||!t.shiftKey&&qu(r,!0)))return t.preventDefault(),!0;return!1},X),n.registerCommand(ec,t=>{const r=M();if(de(r)){const o=r.getNodes();if(o.length>0)return t.preventDefault(),Go(o[0],"next"),!0}else if(E(r)&&((function(o){const i=o.focus;return i.key==="root"&&i.offset===me().getChildrenSize()})(r)||!t.shiftKey&&Yo(r,"next")||!t.shiftKey&&Hu(r,!1)||!t.shiftKey&&qu(r,!1)))return t.preventDefault(),!0;return!1},X),n.registerCommand(Ql,t=>{const r=M();if(de(r)){const o=r.getNodes();if(o.length>0)return t.preventDefault(),Go(o[0],jo(o[0])?"next":"previous"),!0}if(!E(r))return!1;if(!t.shiftKey&&Yo(r,jo(r.anchor.getNode())?"next":"previous"))return t.preventDefault(),!0;if(t.shiftKey||rr(r,"arrow","start",e.peek()),cu(r,!0)){const o=t.shiftKey;return t.preventDefault(),au(r,o,!0),!0}return!1},X),n.registerCommand(Gl,t=>{const r=M();if(de(r)){const o=r.getNodes();if(o.length>0)return t.preventDefault(),Go(o[0],jo(o[0])?"previous":"next"),!0}if(!E(r))return!1;if(!t.shiftKey&&Yo(r,jo(r.anchor.getNode())?"previous":"next"))return t.preventDefault(),!0;if(t.shiftKey||rr(r,"arrow","end",e.peek()),cu(r,!1)){const o=t.shiftKey;return t.preventDefault(),au(r,o,!1),!0}return!1},X),n.registerCommand(Qi,t=>{const r=M();if(!de(r)&&ju(t.target))return!1;if(E(r)){if((function(o){if(!o.isCollapsed())return!1;const{anchor:i}=o;if(i.offset!==0)return!1;const s=i.getNode();if(Ee(s))return!1;const l=t_(s);return l.getIndent()>0&&(l.is(s)||s.is(l.getFirstDescendant()))})(r))return t.preventDefault(),n.dispatchCommand(ma);if(mn&&vr)return!1}else if(!de(r))return!1;return t.preventDefault(),n.dispatchCommand(hn,!0)},X),n.registerCommand(nc,t=>{const r=M();return!(!de(r)&&ju(t.target))&&!(!E(r)&&!de(r))&&(t.preventDefault(),n.dispatchCommand(hn,!1))},X),n.registerCommand(yi,t=>{let r=M();if(de(r)){const o=r.getNodes();o.length===1&&G(o[0])&&!o[0].isInline()&&(r=o[0].selectNext())}if(!E(r))return!1;if(rr(r,"enter","both",e.peek()),t!==null){if((mn||ko||wo)&&vr)return!1;if(t.preventDefault(),t.shiftKey)return n.dispatchCommand(gr,!1)}return n.dispatchCommand(Pn)},X),n.registerCommand(tc,()=>{const t=M();return!!E(t)&&(n.blur(),!0)},X),n.registerCommand(ed,t=>{const[,r]=Uo(t);if(r.length>0){const o=t.clientX,i=t.clientY,s=Bi(o,i,n.getRootElement());if(s!==null){const{offset:l,node:c}=s,a=Xe(c);if(a!==null){const u=sc();if(O(a))u.anchor.set(a.getKey(),l,"text"),u.focus.set(a.getKey(),l,"text");else{const d=a.getParentOrThrow().getKey(),h=a.getIndexWithinParent()+1;u.anchor.set(d,h,"element"),u.focus.set(d,h,"element")}const f=Dt(u);pe(f)}n.dispatchCommand(Bu,r)}return t.preventDefault(),!0}return By(t,n)},X),n.registerCommand(nd,t=>{const[r]=Uo(t),o=M();return!(r&&!E(o))&&(E(o)&&!o.isCollapsed()&&t.dataTransfer!==null&&(lg(t.dataTransfer,jc(o)),Ky(t.dataTransfer,n)),!0)},X),n.registerCommand(rd,t=>{const[r]=Uo(t),o=M();if(r&&!E(o))return!1;const i=t.clientX,s=t.clientY,l=Bi(i,s,n.getRootElement());if(l!==null){const c=Xe(l.node);G(c)&&t.preventDefault()}return!0},X),n.registerCommand(oc,()=>{const t=M();return hm(E(t)&&cs(t.anchor.getNode())!==null?t:null),!0},X),n.registerCommand(Oo,t=>(Ml(n,Kt(t,ClipboardEvent)?t:null),!0),X),n.registerCommand(Zi,t=>((async function(r,o){await Ml(o,Kt(r,ClipboardEvent)?r:null),o.update(()=>{const i=M();E(i)?i.removeText():de(i)&&i.getNodes().forEach(s=>s.remove())},{tag:hd})})(t,n),!0),X),n.registerCommand(Lr,t=>{const[,r,o]=Uo(t);return r.length>0&&!o?(n.dispatchCommand(Bu,r),!0):At(t.target)&&gc(t.target)?!1:M()!==null&&((function(i,s){i.preventDefault(),s.update(()=>{const l=M(),c=Kt(i,InputEvent)||Kt(i,KeyboardEvent)?null:i.clipboardData;c!=null&&l!==null&&Ol(c,l)},{tag:dd})})(t,n),!0)},X),n.registerCommand(Zf,()=>{const t=M();return E(t)&&rr(t,"space","both",e.peek()),!1},X),n.registerCommand(rc,()=>{const t=M();return E(t)&&rr(t,"tab","both",e.peek()),!1},X),n.registerCommand(Gf,t=>{const r=M();if(de(r))return Vu(r,!1,t);if(!E(r))return!1;const{anchor:o}=r;if(o.type!=="element"||o.offset!==0)return!1;const i=o.getNode();if(!S(i))return!1;const s=i.getFirstChild();if(!G(s)||!s.isInline())return!1;const l=i.getKey(),c=i.selectEnd();return t.shiftKey&&c.anchor.set(l,0,"element"),t.preventDefault(),t.stopPropagation(),!0},X),n.registerCommand(Qf,t=>{const r=M();if(de(r))return Vu(r,!0,t);if(!E(r))return!1;const{anchor:o,focus:i}=r,s=U(i.getNode(),a=>S(a)&&!a.isInline());if(s===null)return!1;const l=s.getFirstChild();if(!G(l)||!l.isInline()||U(o.getNode(),a=>S(a)&&!a.isInline())!==s)return!1;const c=s.getKey();return(i.type!=="element"||i.key!==c||i.offset!==0)&&(r.focus.set(c,0,"element"),t.shiftKey||r.anchor.set(c,0,"element"),t.preventDefault(),t.stopPropagation(),!0)},X))}function ox(n,e){const t={};for(const r of n){const o=e(r);o&&(t[o]?t[o].push(r):t[o]=[r])}return t}function ug(n){const e=ox(n,t=>t.type);return{element:e.element||[],multilineElement:e["multiline-element"]||[],textFormat:e["text-format"]||[],textMatch:e["text-match"]||[]}}const Yu=/\s/,Fl=/[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~]/,ix=/^\s{0,3}$/;function Dl(n){if(!Jt(n))return!1;const e=n.getFirstChild();return e==null||n.getChildrenSize()===1&&O(e)&&ix.test(e.getTextContent())}function Rl(n){return n.replace(/\\([!-/:-@[-`{-~])/g,"$1").replace(/&#(\d+);/g,(e,t)=>String.fromCodePoint(Number(t)))}const fg=/^(\s*)(\d{1,})\.\s/,dg=/^(\s*)[-*+]\s/,sx=/^(\s*)(?:[-*+]\s)?\s?(\[(\s|x)?\])\s/i,Pl=/^(#{1,6})\s/,hg=/^>\s/,gg=/^([ \t]*`{3,})([\w-]+)?[ \t]?/,Il=/^[ \t]*`{3,}$/,lx=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,cx=/^(?:\|)(.+)(?:\|)\s?$/;function pg(n){if(n[0]!=="|")return!1;const{length:e}=n;let t=1,r=0;for(;t<e;){let o=t;for(n[o]===" "&&o++,n[o]===":"&&o++;n[o]==="-";)o++;if(n[o]===":"&&o++,n[o]===" "&&o++,n[o]!=="|")break;r++,t=o+1}return r>0&&(t===e||t===e-1&&/\s/.test(n[t]))}const Xu=/^<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,Gu=/^<\/[a-z_][\w-]*\s*>/i,Qu=n=>new RegExp(`(?:${n.source})$`,n.flags),eo=Eo("mdListMarker",{parse:n=>typeof n=="string"&&/^[-*+]$/.test(n)?n:"-",resetOnCopyNode:!0}),Zu=Eo("mdCodeFence",{parse:n=>typeof n=="string"&&/^`{3,}$/.test(n)?n:"```",resetOnCopyNode:!0}),mg=Eo("mdHardLineBreak",{parse:n=>typeof n=="string"&&/^(\\| {2,})$/.test(n)?n:"",resetOnCopyNode:!0});function Ll(n){if(n.endsWith("\\"))return[n.slice(0,-1),"\\"];const e=n.match(/^(.*?\S)( {2,})$/);return e?[e[1],e[2]]:null}function ax(n){const e=n.getChildren(),t=e.length-1,r=e[t];if(!O(r))return null;const o=r.getTextContent(),i=Ll(o);if(i!==null){const[s,l]=i;return r.setTextContent(s),l}return/^ {2,}$/.test(o)&&(function(s,l){for(let c=l-1;c>=0;c--){if(Le(s[c]))return!1;if(/\S/.test(s[c].getTextContent()))return!0}return!1})(e,t)?(r.setTextContent(""),o):null}function _g(n){const e=jt(),t=ax(n);return t!==null&&hr(e,mg,t),e}const yg=n=>(e,t,r,o)=>{const i=n(r);i.append(...t),e.replace(i),o||i.select(0,0)},xg=n=>(e,t,r,o)=>{if(ag(e))return!1;const i=e.getPreviousSibling(),s=e.getNextSibling(),l=Ht(n==="check"?r[3]==="x":void 0),c=r[0].trim()[0],a=n!=="bullet"&&n!=="check"||c!==eo.parse(c)?void 0:c;if(q(s)&&s.getListType()===n){a&&hr(s,eo,a);const f=s.getFirstChild();f!==null?f.insertBefore(l):s.append(l),n==="number"&&s.setStart(Number(r[2])),e.remove()}else if(q(i)&&i.getListType()===n)a&&hr(i,eo,a),i.append(l),e.remove();else{const f=$t(n,n==="number"?Number(r[2]):void 0);a&&hr(f,eo,a),f.append(l),e.replace(f)}l.append(...t),o||l.select(0,0);const u=(function(f){const d=f.match(/\t/g),h=f.match(/ /g);let g=0;return d&&(g+=d.length),h&&(g+=Math.floor(h.length/4)),g})(r[1]);u&&l.setIndent(u)},Uc=(n,e,t,r)=>{const o=[],i=n.getChildren();let s=0;for(const l of i)if(Z(l)){if(l.getChildrenSize()===1){const h=l.getFirstChild();if(q(h)){const g=Uc(h,e,t+1,r);g&&o.push(g);continue}}if(r&&!l.getChildren().some(h=>h.isSelected(r)))continue;const c=" ".repeat(4*t),a=n.getListType(),u=$o(n,eo),f=a==="number"?`${n.getStart()+s}. `:a==="check"?`${u} [${l.getChecked()?"x":" "}] `:u+" ";let d=e(l);a!=="number"&&(d=d.replace(/^(\s{0,3}\d+)(\.\s)/,"$1\\$2")),o.push(c+f+d),s++}return o.join(`
|
|
13
|
+
`)},ux={dependencies:[ms],export:(n,e)=>{if(!ag(n))return null;const t=Number(n.getTag().slice(1));return"#".repeat(t)+" "+e(n)},regExp:Pl,replace:yg(n=>{const e="h"+n[1].length;return Pr(e)}),triggerOnEnter:!0,type:"element"},fx={dependencies:[ps],export:(n,e)=>{if(!ji(n))return null;const t=e(n).split(`
|
|
14
|
+
`),r=[];for(const o of t)r.push("> "+o);return r.join(`
|
|
15
|
+
`)},regExp:hg,replace:(n,e,t,r)=>{if(r){const i=n.getPreviousSibling();if(ji(i))return i.splice(i.getChildrenSize(),0,[_g(i),...e]),void n.remove()}const o=jr();o.append(...e),n.replace(o),r||o.select(0,0)},triggerOnEnter:!0,type:"element"},hi={dependencies:[gs],export:n=>{if(!Kc(n))return null;const e=n.getTextContent();let t=$o(n,Zu);if(e.indexOf(t)>-1){const r=e.match(/`{3,}/g);if(r){const o=Math.max(...r.map(i=>i.length));t="`".repeat(o+1)}}return t+(n.getLanguage()||"")+(e?`
|
|
16
|
+
`+e:"")+`
|
|
17
|
+
`+t},handleImportAfterStartMatch:({lines:n,rootNode:e,startLineIndex:t,startMatch:r})=>{const o=r[1],i=o.trim().length,s=n[t],l=r.index+o.length,c=s.slice(l),a=new RegExp(`\`{${i},}$`);if(a.test(c)){const h=c.match(a),g=c.slice(0,c.lastIndexOf(h[0])),m=[...r];return m[2]="",hi.replace(e,null,m,h,[g],!0),[!0,t]}const u=new RegExp(`^[ \\t]*\`{${i},}$`);for(let h=t+1;h<n.length;h++){const g=n[h];if(u.test(g)){const m=g.match(u),p=n.slice(t+1,h),_=s.slice(r[0].length);return _.length>0&&p.unshift(_),hi.replace(e,null,r,m,p,!0),[!0,h]}}const f=n.slice(t+1),d=s.slice(r[0].length);return d.length>0&&f.unshift(d),hi.replace(e,null,r,null,f,!0),[!0,n.length-1]},regExpEnd:{optional:!0,regExp:Il},regExpStart:gg,replace:(n,e,t,r,o,i)=>{let s,l;const c=t[1]?t[1].trim():"```",a=t[2]||void 0;if(!e&&o){if(o.length===1)r?(s=et(a),l=o[0]):(s=et(a),l=o[0].startsWith(" ")?o[0].slice(1):o[0]);else{for(s=et(a),o.length>0&&(o[0].trim().length===0?o.shift():o[0].startsWith(" ")&&(o[0]=o[0].slice(1)));o.length>0&&!o[o.length-1].length;)o.pop();l=o.join(`
|
|
18
|
+
`)}hr(s,Zu,c);const u=Ne(l);s.append(u),n.append(s)}else e&&yg(u=>et(u?u[2]:void 0))(n,e,t,i)},type:"multiline-element"},dx={dependencies:[Gn,vn],export:(n,e,t)=>q(n)?Uc(n,e,0,t):null,regExp:dg,replace:xg("bullet"),triggerOnEnter:!0,type:"element"},hx={dependencies:[Gn,vn],export:(n,e,t)=>q(n)?Uc(n,e,0,t):null,regExp:fg,replace:xg("number"),triggerOnEnter:!0,type:"element"},gx={format:["code"],tag:"`",type:"text-format"},px={format:["highlight"],tag:"==",type:"text-format"},mx={format:["bold","italic"],tag:"***",type:"text-format"},_x={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},yx={format:["bold"],tag:"**",type:"text-format"},xx={format:["bold"],intraword:!1,tag:"__",type:"text-format"},Cx={format:["strikethrough"],tag:"~~",type:"text-format"},Sx={format:["italic"],tag:"*",type:"text-format"},bx={format:["italic"],intraword:!1,tag:"_",type:"text-format"},vx={dependencies:[xn],export:(n,e,t)=>{if(!Qe(n)||ar(n))return null;const r=e(n);let o=n.getTitle();return o!=null&&(o=o.replace(/([\\"])/g,"\\$1")),o?`[${r}](${n.getURL()} "${o}")`:`[${r}](${n.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(n,e)=>{if(U(n,Qe))return;const[,t,r,o]=e,i=r!=null?Rl(r):void 0,s=o!=null?Rl(o):void 0,l=To(i,{title:s}),c=t.split("[").length-1,a=t.split("]").length-1;let u=t,f="";if(c<a)return;if(c>a){const h=t.split("[");f="["+h[0],u=h.slice(1).join("[")}const d=Ne(u);return d.setFormat(n.getFormat()),l.append(d),n.replace(l),f&&l.insertBefore(Ne(f)),d},trigger:")",type:"text-match"},Tx=[ux,fx,dx,hx],Nx=[hi],kx=[gx,mx,_x,yx,xx,px,Sx,bx,Cx],wx=[vx],Hc=[...Tx,...Nx,...kx,...wx];function Ex(n,e=!1){const t=n.split(`
|
|
19
|
+
`);let r=0;const o=[];for(let i=0;i<t.length;i++){const s=t[i],l=s.trimEnd(),c=o[o.length-1],a=i<t.length-1?Ll(s):null,u=c!==void 0&&Ll(c)!==null;if(lx.test(l))o.push(l);else if(r===0){{const f=l.match(gg);if(f){r=f[1].trim().length,o.push(l);continue}}l===""||c===""||!c||Pl.test(c)||Pl.test(l)||hg.test(l)||fg.test(l)||dg.test(l)||sx.test(l)||cx.test(l)||pg(l)||u||!e||Xu.test(l)||Gu.test(l)||Qu(Gu).test(c)||Qu(Xu).test(c)||Il.test(c)?o.push(!e&&l!==""||a!==null?s:l):o[o.length-1]=c+" "+(a===null?l:s).trimStart()}else{if(Il.test(l)&&l.trim().length>=r){r=0,o.push(l);continue}o.push(s)}}return o.join(`
|
|
20
|
+
`)}function $x(n,e,t,r,o){for(const i of e){if(!i.export)continue;const s=i.export(n,l=>Ui(l,t,r,void 0,void 0,o));if(s!=null)return s}return S(n)?Ui(n,t,r,void 0,void 0,o):G(n)?n.getTextContent():null}function Ui(n,e,t,r,o,i=!1){const s=[],l=n.getChildren();r||(r=[]),o||(o=[]);e:for(const c of l){for(const a of t){if(!a.export)continue;const u=a.export(c,f=>Ui(f,e,t,r,[...o,...r],i),(f,d)=>ef(f,d,e,r,o,i));if(u!=null){s.push(u);continue e}}Le(c)?s.push(Ox(c)):O(c)?s.push(ef(c,c.getTextContent(),e,r,o,i)):S(c)?s.push(Ui(c,e,t,r,o,i)):G(c)&&s.push(c.getTextContent())}return s.join("")}function Ox(n){return $o(n,mg)+`
|
|
21
|
+
`}function ef(n,e,t,r,o,i=!1){const s=n.hasFormat("code");let l,c,a,u,f=e;if(s||(f=i?f.replace(/([*_`~])/g,"\\$1"):f.replace(/([*_`~\\])/g,"\\$1")),s){const{fence:y,padded:x}=(function(C){const T=C.match(/`+/g),b=T?Math.max(...T.map(N=>N.length)):0;return{fence:"`".repeat(b+1),padded:C.length===0||C.includes("`")||/^\s/.test(C)&&/\s$/.test(C)?` ${C} `:C}})(e);l="",a="",c=y+x+y,u=!1}else{const y=f.match(/^(\s*)(.*?)(\s*)$/s)||["","",f,""];l=y[1],c=y[2],a=y[3],u=c===""}let d="",h="",g="";const m=tf(n,!0),p=tf(n,!1),_=new Set;for(const y of t){const x=y.format[0],C=y.tag;x!=="code"&&nf(n,x)&&!_.has(x)&&(_.add(x),nf(m,x)&&r.find(T=>T.tag===C)||(r.push({format:x,tag:C}),d+=C))}for(let y=0;y<r.length;y++){const x=Kl(n,r[y].format),C=Kl(p,r[y].format);if(x&&C)continue;const T=[...r];for(;T.length>y;){const b=T.pop();o&&b&&o.find(N=>N.tag===b.tag)||(b&&typeof b.tag=="string"&&(x?C||(g+=b.tag):h+=b.tag),r.pop())}break}return u&&!n.hasFormat("code")?h+f:h+l+d+c+g+a}function tf(n,e){const t=e?n.getPreviousSibling():n.getNextSibling();return O(t)?t:null}function Kl(n,e){return O(n)&&n.hasFormat(e)}function nf(n,e){return!!Kl(n,e)&&(e==="code"||!n||!/^\s*$/.test(n.getTextContent()))}function Ax(n,e){const t=n.getTextContent(),r=e.transformersByTag["`"],o=[];let i=null;if(r){const f=(function(d){const h=y=>{let x=0;for(let C=y-1;C>=0&&d[C]==="\\";C--)x++;return x%2==1},g=[];let m=0;for(;m<d.length;)if(d[m]==="`"){let y=1;for(;m+y<d.length&&d[m+y]==="`";)y++;g.push({index:m,length:y}),m+=y}else m++;const p=[];let _=0;for(;_<g.length;){const y=g[_];if(h(y.index)){_++;continue}let x=-1;for(let b=_+1;b<g.length;b++)if(g[b].length===y.length){x=b;break}if(x===-1){_++;continue}const C=g[x];let T=d.slice(y.index+y.length,C.index);T.length>=2&&T.startsWith(" ")&&T.endsWith(" ")&&/[^ ]/.test(T)&&(T=T.slice(1,-1)),p.push({content:T,endIndex:C.index+C.length,startIndex:y.index}),_=x+1}return p})(t);for(const d of f)i||(i={content:d.content,endIndex:d.endIndex,startIndex:d.startIndex,tag:"`"}),o.push({end:d.endIndex,start:d.startIndex})}const s=(function(f,d,h=[]){const g=[],m=new Set(Object.keys(d.transformersByTag).filter(x=>x[0]!=="`").map(x=>x[0])),p=x=>{let C=0;for(let T=x-1;T>=0&&f[T]==="\\";T--)C++;return C%2==1},_=x=>h.some(C=>x>=C.start&&x<C.end);let y=0;for(;y<f.length;){const x=f[y];if(!m.has(x)||p(y)||_(y)){y++;continue}let C=1;for(;y+C<f.length&&f[y+C]===x;)C++;const T=rf(x,f,y,C,!0),b=rf(x,f,y,C,!1);(T||b)&&g.push({active:!0,canClose:b,canOpen:T,char:x,index:y,length:C}),y+=C}return g})(t,e,o),l=s.length>0?(function(f,d,h){const g={};let m=0,p=null;for(;m<d.length;){const _=d[m];if(!_.active||!_.canClose||_.length===0){m++;continue}const y=`${_.char}${_.canOpen}${_.length%3}`,x=g[y]??-1;let C=!1;for(let T=m-1;T>x;T--){const b=d[T];if(!b.active||!b.canOpen||b.length===0||b.char!==_.char||(b.canClose||_.canOpen)&&(b.length+_.length)%3==0&&b.length%3!=0&&_.length%3!=0)continue;const N=Math.min(b.length,_.length),v=Object.keys(h.transformersByTag).filter(k=>k[0]===b.char&&k.length<=N).sort((k,F)=>F.length-k.length)[0];if(!v)continue;C=!0;const w=v.length,A={content:f.slice(b.index+b.length,_.index),endIndex:_.index+w,startIndex:b.index+(b.length-w),tag:v};(!p||A.startIndex<p.startIndex||A.startIndex===p.startIndex&&A.endIndex>p.endIndex)&&(p=A);for(let k=T+1;k<m;k++)d[k].active=!1;b.length-=w,_.length-=w,b.active=b.length>0,_.length>0?_.index+=w:(_.active=!1,m++);break}C||(g[y]=m-1,_.canOpen||(_.active=!1),m++)}return p})(t,s,e):null;let c=null,a=null;if(i&&l?l.startIndex<=i.startIndex&&l.endIndex>=i.endIndex?(c=l,a=e.transformersByTag[l.tag]):(c=i,a=r):i?(c=i,a=r):l&&(c=l,a=e.transformersByTag[l.tag]),!c||!a)return null;const u=[t.slice(c.startIndex,c.endIndex),c.tag,c.content];return u.index=c.startIndex,u.input=t,{endIndex:c.endIndex,isCodeSpan:a===r,match:u,startIndex:c.startIndex,transformer:a}}function rf(n,e,t,r,o){if(!of(e,t,r,o))return!1;if(n==="*")return!0;if(n==="_"){if(!of(e,t,r,!o))return!0;const i=o?e[t-1]:e[t+r];return i!==void 0&&Fl.test(i)}return!0}function of(n,e,t,r){const o=n[e-1],i=n[e+t],[s,l]=r?[i,o]:[o,i];return s!==void 0&&!Yu.test(s)&&(!Fl.test(s)||l===void 0||Yu.test(l)||Fl.test(l))}function or(n){return O(n)&&!n.hasFormat("code")}function wn(n,e,t){let r=Ax(n,e),o=(function(s,l){const c=s;let a,u,f,d;for(const h of l){if(!h.replace||!h.importRegExp)continue;const g=c.getTextContent().match(h.importRegExp);if(!g)continue;const m=g.index||0,p=h.getEndIndex?h.getEndIndex(c,g):m+g[0].length;p!==!1&&(a===void 0||u===void 0||m<a&&(p>u||p<=a))&&(a=m,u=p,f=h,d=g)}return a===void 0||u===void 0||f===void 0||d===void 0?null:{endIndex:u,match:d,startIndex:a,transformer:f}})(n,t);if(r&&o&&(r.isCodeSpan?o.startIndex<=r.startIndex&&o.endIndex>=r.endIndex?r=null:o=null:r.startIndex<=o.startIndex&&r.endIndex>=o.endIndex||o.startIndex>r.endIndex?o=null:r=null),r){const s=(function(l,c,a,u,f){const d=l.getTextContent();let h,g,m;if(f[0]===d?h=l:c===0?[h,g]=l.splitText(a):[m,h,g]=l.splitText(c,a),h.setTextContent(f[2]),u)for(const p of u.format)h.hasFormat(p)||h.toggleFormat(p);return{nodeAfter:g,nodeBefore:m,transformedNode:h}})(n,r.startIndex,r.endIndex,r.transformer,r.match);or(s.nodeAfter)&&wn(s.nodeAfter,e,t),or(s.nodeBefore)&&wn(s.nodeBefore,e,t),or(s.transformedNode)&&wn(s.transformedNode,e,t)}else if(o){const s=(function(l,c,a,u,f){let d,h,g;return c===0?[d,h]=l.splitText(a):[g,d,h]=l.splitText(c,a),u.replace?{nodeAfter:h,nodeBefore:g,transformedNode:u.replace(d,f)||void 0}:null})(n,o.startIndex,o.endIndex,o.transformer,o.match);if(!s)return;or(s.nodeAfter)&&wn(s.nodeAfter,e,t),or(s.nodeBefore)&&wn(s.nodeBefore,e,t),or(s.transformedNode)&&wn(s.transformedNode,e,t)}const i=Rl(n.getTextContent());n.setTextContent(i)}function Mx(n,e,t,r=!1){const o=ug(t),i=(function(a){const u={},f={},d=[];for(const h of a){const{tag:g}=h;u[g]=h;const m=g.replace(/(\*|\^|\+)/g,"\\$1");d.push(m),g.length===1?f[g]=g==="`"?new RegExp("(^|[^\\\\`])(`)((?:\\\\`|[^`])+?)(`)(?!`)"):new RegExp(`(^|[^\\\\${m}])(${m})((\\\\${m})?.*?[^${m}\\s](\\\\${m})?)(${m})(?![\\\\${m}])`):f[g]=new RegExp(`(^|[^\\\\])(${m})((\\\\${m})?.*?[^\\s](\\\\${m})?)(${m})(?!\\\\)`)}return{fullMatchRegExpByTag:f,openTagsRegExp:new RegExp(`(${d.join("|")})`,"g"),transformersByTag:u}})(o.textFormat),s=n.split(`
|
|
22
|
+
`),l=s.length;for(let a=0;a<l;a++){const u=s[a],[f,d]=Fx(s,a,o.multilineElement,e);f?a=d:Dx(u,e,o.element,i,o.textMatch,r)}const c=e.getChildren();for(const a of c)if(!r&&Dl(a)&&e.getChildrenSize()>1)a.remove();else if(S(a))for(const u of a.getAllTextNodes())Rx(u)}function Fx(n,e,t,r){for(const o of t){const{handleImportAfterStartMatch:i,regExpEnd:s,regExpStart:l,replace:c}=o,a=n[e].match(l);if(!a)continue;if(i){const g=i({lines:n,rootNode:r,startLineIndex:e,startMatch:a,transformer:o});if(g===null)continue;if(g)return g}const u=typeof s=="object"&&"regExp"in s?s.regExp:s,f=s&&typeof s=="object"&&"optional"in s?s.optional:!s;let d=e;const h=n.length;for(;d<h;){const g=u?n[d].match(u):null;if(!g&&(!f||f&&d<h-1)){d++;continue}if(g&&e===d&&g.index===a.index){d++;continue}const m=[];if(g&&e===d)m.push(n[e].slice(a[0].length,-g[0].length));else for(let p=e;p<=d;p++)if(p===e){const _=n[p].slice(a[0].length);m.push(_)}else if(p===d&&g){const _=n[p].slice(0,-g[0].length);m.push(_)}else m.push(n[p]);if(c(r,null,a,g,m,!0)!==!1)return[!0,d];break}}return[!1,e]}function Dx(n,e,t,r,o,i){const s=Ne(n),l=V();l.append(s),e.append(l);for(const{regExp:c,replace:a}of t){const u=n.match(c);if(u&&(s.setTextContent(n.slice(u[0].length)),a(l,[s],u,!0)!==!1))break}if(wn(s,r,o),l.getParent()!==null&&n.length>0){const c=l.getPreviousSibling();if(!i&&(Jt(c)||ji(c)||q(c))){let a=c;if(q(c)){const u=c.getLastDescendant();a=u==null?null:U(u,Z)}a!=null&&a.getTextContentSize()>0&&(a.splice(a.getChildrenSize(),0,[_g(a),...l.getChildren()]),l.remove())}}}function Rx(n){const e=new Set,t=n.getTextContent();let r=t.indexOf(" ");for(;r!==-1;)e.add(r),e.add(r+1),r=t.indexOf(" ",r+1);n.splitText(...e).forEach(o=>{o.getTextContent()===" "&&o.replace(Ao())})}function Cg(n,e=Hc,t,r=!1,o=!1){const i=r?n:Ex(n,o),s=t||me();s.clear(),Mx(i,s,e,r),M()!==null&&s.selectStart()}function Jc(n=Hc,e,t=!1){return(function(o,i=!1){const s=ug(o),l=[...s.multilineElement,...s.element],c=!i,a=s.textFormat.filter(u=>u.format.length===1).sort((u,f)=>Number(u.format.includes("code"))-Number(f.format.includes("code")));return u=>{const f=[],d=(u||me()).getChildren();for(let h=0;h<d.length;h++){const g=d[h],m=$x(g,l,a,s.textMatch,i);m!=null&&f.push(c&&h>0&&!Dl(g)&&!Dl(d[h-1])?`
|
|
23
|
+
`.concat(m):m)}return f.join(`
|
|
24
|
+
`)}})(n,t)(e)}const Cr=/^(\d+(?:\.\d+)?)px$/,se={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class Tn extends ve{__colSpan;__rowSpan;__headerState;__width;__backgroundColor;__verticalAlign;$config(){return this.config("tablecell",{extends:ve,importDOM:{td:()=>({conversion:sf,priority:0}),th:()=>({conversion:sf,priority:0})}})}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign,this.__colSpan=e.__colSpan,this.__headerState=e.__headerState,this.__width=e.__width}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)}constructor(e=se.NO_STATUS,t=1,r,o){super(o),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=r,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){const t=ee().createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(t.style.backgroundColor=this.__backgroundColor),zl(this.__verticalAlign)&&(t.style.verticalAlign=this.__verticalAlign),we(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const t=super.exportDOM(e);if(W(t.element)){const r=t.element;r.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),r.style.border="1px solid black",this.__colSpan>1&&(r.colSpan=this.__colSpan),this.__rowSpan>1&&(r.rowSpan=this.__rowSpan),r.style.width=`${this.getWidth()||75}px`,r.style.verticalAlign=this.getVerticalAlign()||"top",r.style.textAlign="start",this.__backgroundColor===null&&this.hasHeader()&&(r.style.backgroundColor="#f2f3f5")}return t}exportJSON(){return{...super.exportJSON(),...zl(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 t=this.getWritable();return t.__colSpan=e,t}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){const t=this.getWritable();return t.__rowSpan=e,t}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e,t=se.BOTH){const r=this.getWritable();return r.__headerState=e&t|r.__headerState&~t,r}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){const t=this.getWritable();return t.__width=e,t}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){const t=this.getWritable();return t.__backgroundColor=e,t}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){const t=this.getWritable();return t.__verticalAlign=e||void 0,t}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==se.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 zl(n){return n==="middle"||n==="bottom"}function sf(n){const e=n,t=n.nodeName.toLowerCase();let r;Cr.test(e.style.width)&&(r=parseFloat(e.style.width));let o=se.NO_STATUS;if(t==="th"){const m=e.getAttribute("scope");if(m==="col")o=se.COLUMN;else if(m==="row")o=se.ROW;else{const p=e.parentElement,_=W(p)&&p.nodeName.toLowerCase()==="tr"&&W(p.parentElement)&&(p.parentElement.nodeName.toLowerCase()==="thead"||p.rowIndex===0),y=e.cellIndex===0;_&&(o|=se.ROW),y&&(o|=se.COLUMN),o===se.NO_STATUS&&(o=se.ROW)}}const i=at(o,e.colSpan,r);i.__rowSpan=e.rowSpan;const s=e.style.backgroundColor;s!==""&&(i.__backgroundColor=s);const l=e.style.verticalAlign;zl(l)&&(i.__verticalAlign=l);const c=e.style,a=(c&&c.textDecoration||"").split(" "),u=c.fontWeight==="700"||c.fontWeight==="bold",f=a.includes("line-through"),d=c.fontStyle==="italic",h=a.includes("underline"),g=c.color;return{after:m=>{const p=[];let _=null;const y=()=>{if(_){const x=_.getFirstChild();Le(x)&&_.getChildrenSize()===1&&x.remove()}};for(const x of m)if(Sc(x)||O(x)||Le(x)){if(O(x)&&(u&&x.toggleFormat("bold"),f&&x.toggleFormat("strikethrough"),d&&x.toggleFormat("italic"),h&&x.toggleFormat("underline"),g)){const C=x.getStyle();C.includes("color:")||x.setStyle(C+`color: ${g};`)}_?_.append(x):(_=V().append(x),p.push(_))}else p.push(x),y(),_=null;return y(),p.length===0&&p.push(V()),p},node:i}}function at(n=se.NO_STATUS,e=1,t){return Ge(new Tn(n,e,t))}function J(n){return n instanceof Tn}const Px=z("INSERT_TABLE_COMMAND");function H(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}class Io extends ve{__height;$config(){return this.config("tablerow",{extends:ve,importDOM:{tr:()=>({conversion:Ix,priority:0})}})}afterCloneFrom(e){super.afterCloneFrom(e),this.__height=e.__height}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e=void 0,t){super(t),this.__height=e}exportJSON(){const e=this.getHeight();return{...super.exportJSON(),...e===void 0?void 0:{height:e}}}createDOM(e){const t=ee().createElement("tr");return this.__height&&(t.style.height=`${this.__height}px`),we(t,e.theme.tableRow),t}extractWithChild(e,t,r){return r==="html"}isShadowRoot(){return!0}setHeight(e){const t=this.getWritable();return t.__height=e,t}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function Ix(n){const e=n;let t;return Cr.test(e.style.height)&&(t=parseFloat(e.style.height)),{after:r=>Ii(r,J),node:Hn(t)}}function Hn(n){return Ge(new Io(n))}function xe(n){return n instanceof Io}function Lx(n,e,t=!0){const r=Lo();for(let o=0;o<n;o++){const i=Hn();for(let s=0;s<e;s++){let l=se.NO_STATUS;typeof t=="object"?(o===0&&t.rows&&(l|=se.ROW),s===0&&t.columns&&(l|=se.COLUMN)):t&&(o===0&&(l|=se.ROW),s===0&&(l|=se.COLUMN));const c=at(l),a=V();a.append(Ne()),c.append(a),i.append(c)}r.append(i)}return r}function Kx(n){const e=U(n,t=>ge(t));if(ge(e))return e;throw new Error("Expected table cell to be inside of table.")}const Bl=(n,e)=>n===se.BOTH||n===e?e:se.NO_STATUS;function zx(n,e=!0){const[,,t]=zt(n),[r,o]=Ft(t,n,n),i=r[0].length,{startRow:s}=o;let l=null;if(e){const c=s+n.__rowSpan-1,a=r[c],u=Hn();for(let d=0;d<i;d++){const{cell:h,startRow:g}=a[d];if(g+h.__rowSpan-1<=c){const m=a[d].cell.__headerState,p=Bl(m,se.COLUMN);u.append(at(p).append(V()))}else h.setRowSpan(h.__rowSpan+1)}const f=t.getChildAtIndex(c);xe(f)||H(256),f.insertAfter(u),l=u}else{const c=s,a=r[c],u=Hn();for(let d=0;d<i;d++){const{cell:h,startRow:g}=a[d];if(g===c){const m=a[d].cell.__headerState,p=Bl(m,se.COLUMN);u.append(at(p).append(V()))}else h.setRowSpan(h.__rowSpan+1)}const f=t.getChildAtIndex(c);xe(f)||H(257),f.insertBefore(u),l=u}return l}function Bx(n,e=!0,t=!0){const[,,r]=zt(n),[o,i]=Ft(r,n,n),s=o.length,{startColumn:l}=i,c=e?l+n.__colSpan-1:l-1,a=r.getFirstChild();xe(a)||H(120);let u=null;function f(g=se.NO_STATUS){const m=at(g).append(V());return u===null&&(u=m),m}let d=a;e:for(let g=0;g<s;g++){if(g!==0){const T=d.getNextSibling();xe(T)||H(121),d=T}const m=o[g],p=m[c<0?0:c].cell.__headerState,_=Bl(p,se.ROW);if(c<0){Sg(d,f(_));continue}const{cell:y,startColumn:x,startRow:C}=m[c];if(x+y.__colSpan-1<=c){let T=y,b=C,N=c;for(;b!==g&&T.__rowSpan>1;){if(N-=y.__colSpan,!(N>=0)){d.append(f(_));continue e}{const{cell:v,startRow:w}=m[N];T=v,b=w}}T.insertAfter(f(_))}else y.setColSpan(y.__colSpan+1)}u!==null&&t&&Wx(u);const h=r.getColWidths();if(h){const g=[...h],m=c<0?0:c,p=g[m];g.splice(m,0,p),r.setColWidths(g)}return u}function Wx(n){const e=n.getFirstDescendant();e==null?n.selectStart():e.getParentOrThrow().selectStart()}function Sg(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function jx(n){if(n.length===0)return null;const e=Kx(n[0]),[t]=en(e,null,null);let r=1/0,o=-1/0,i=1/0,s=-1/0;const l=new Set;for(const h of t)for(const g of h){if(!g||!g.cell)continue;const m=g.cell.getKey();if(!l.has(m)&&n.some(p=>p.is(g.cell))){l.add(m);const p=g.startRow,_=g.startColumn,y=g.cell.__rowSpan||1,x=g.cell.__colSpan||1;r=Math.min(r,p),o=Math.max(o,p+y-1),i=Math.min(i,_),s=Math.max(s,_+x-1)}}if(r===1/0||i===1/0)return null;const c=o-r+1,a=s-i+1,u=t[r][i];if(!u.cell)return null;const f=u.cell;f.setColSpan(a),f.setRowSpan(c);const d=new Set([f.getKey()]);for(let h=r;h<=o;h++)for(let g=i;g<=s;g++){const m=t[h][g];if(!m.cell)continue;const p=m.cell,_=p.getKey();d.has(_)||(d.add(_),Ux(p)||f.append(...p.getChildren()),p.remove())}return f.getChildrenSize()===0&&f.append(V()),f}function Ux(n){if(n.getChildrenSize()!==1)return!1;const e=n.getFirstChildOrThrow();return!(!Jt(e)||!e.isEmpty())}function Hx(n){const[e,t,r]=zt(n),o=e.__colSpan,i=e.__rowSpan;if(o===1&&i===1)return;const[s,l]=Ft(r,e,e),{startColumn:c,startRow:a}=l,u=e.__headerState&se.COLUMN,f=Array.from({length:o},(g,m)=>{let p=u;for(let _=0;p!==0&&_<s.length;_++)p&=s[_][m+c].cell.__headerState;return p}),d=e.__headerState&se.ROW,h=Array.from({length:i},(g,m)=>{let p=d;for(let _=0;p!==0&&_<s[0].length;_++)p&=s[m+a][_].cell.__headerState;return p});if(o>1){for(let g=1;g<o;g++)e.insertAfter(at(f[g]|h[0]).append(V()));e.setColSpan(1)}if(i>1){let g;for(let m=1;m<i;m++){const p=a+m,_=s[p];g=(g||t).getNextSibling(),xe(g)||H(125);let y=null;for(let x=0;x<c;x++){const C=_[x],T=C.cell;C.startRow===p&&(y=T),T.__colSpan>1&&(x+=T.__colSpan-1)}if(y===null)for(let x=o-1;x>=0;x--)Sg(g,at(f[x]|h[m]).append(V()));else for(let x=o-1;x>=0;x--)y.insertAfter(at(f[x]|h[m]).append(V()))}e.setRowSpan(1)}}function Ft(n,e,t){const[r,o,i]=en(n,e,t);return o===null&&H(207),i===null&&H(208),[r,o,i]}function en(n,e,t){const r=[];let o=null,i=null;function s(c){let a=r[c];return a===void 0&&(r[c]=a=[]),a}const l=n.getChildren();for(let c=0;c<l.length;c++){const a=l[c];xe(a)||H(209);const u=s(c);for(let f=a.getFirstChild(),d=0;f!=null;f=f.getNextSibling()){for(J(f)||H(147);u[d]!==void 0;)d++;const h={cell:f,startColumn:d,startRow:c},{__rowSpan:g,__colSpan:m}=f;for(let p=0;p<g&&!(c+p>=l.length);p++){const _=s(c+p);for(let y=0;y<m;y++)_[d+y]=h}e!==null&&o===null&&e.is(f)&&(o=h),t!==null&&i===null&&t.is(f)&&(i=h)}}return[r,o,i]}function zt(n){let e;if(n instanceof Tn)e=n;else if("__type"in n){const o=U(n,J);J(o)||H(148),e=o}else{const o=U(n.getNode(),J);J(o)||H(148),e=o}const t=e.getParent();xe(t)||H(149);const r=t.getParent();return ge(r)||H(210),[e,t,r]}function Hi(n,e,t){let r,o=Math.min(e.startColumn,t.startColumn),i=Math.min(e.startRow,t.startRow),s=Math.max(e.startColumn+e.cell.__colSpan-1,t.startColumn+t.cell.__colSpan-1),l=Math.max(e.startRow+e.cell.__rowSpan-1,t.startRow+t.cell.__rowSpan-1);do{r=!1;for(let c=0;c<n.length;c++)for(let a=0;a<n[0].length;a++){const u=n[c][a];if(!u)continue;const f=u.startColumn+u.cell.__colSpan-1,d=u.startRow+u.cell.__rowSpan-1,h=u.startColumn<=s&&f>=o,g=u.startRow<=l&&d>=i;if(h&&g){const m=Math.min(o,u.startColumn),p=Math.max(s,f),_=Math.min(i,u.startRow),y=Math.max(l,d);m===o&&p===s&&_===i&&y===l||(o=m,s=p,i=_,l=y,r=!0)}}}while(r);return{maxColumn:s,maxRow:l,minColumn:o,minRow:i}}function lf(n){const[e,,t]=zt(n),r=t.getChildren().filter(xe),o=r.length,i=r[0].getChildren().length,s=new Array(o);for(let l=0;l<o;l++)s[l]=new Array(i);for(let l=0;l<o;l++){const c=r[l].getChildren().filter(J);let a=0;for(let u=0;u<c.length;u++){for(;s[l][a];)a++;const f=c[u],d=f.__rowSpan||1,h=f.__colSpan||1;for(let g=0;g<d;g++)for(let m=0;m<h;m++)s[l+g][a+m]=f;if(e===f)return{colSpan:h,columnIndex:a,rowIndex:l,rowSpan:d};a+=h}}return null}function bg(n,e){const t=e.getStartEndPoints(),r=ye(e);if(t===null)return!1;const[o,i]=t,[s,l,c]=zt(o),a=U(i.getNode(),k=>J(k));if(!(J(s)&&J(a)&&xe(l)&&ge(c)))return!1;const[u,f,d]=Ft(c,s,a),[h]=en(n,null,null),g=u.length,m=g>0?u[0].length:0;let p=f.startRow,_=f.startColumn,y=h.length,x=y>0?h[0].length:0;if(r){const k=Hi(u,f,d),F=k.maxRow-k.minRow+1,L=k.maxColumn-k.minColumn+1;p=k.minRow,_=k.minColumn,y=Math.min(y,F),x=Math.min(x,L)}let C=!1;const T=Math.min(g,p+y)-1,b=Math.min(m,_+x)-1,N=new Set;for(let k=p;k<=T;k++)for(let F=_;F<=b;F++){const L=u[k][F];N.has(L.cell.getKey())||L.cell.__rowSpan===1&&L.cell.__colSpan===1||(Hx(L.cell),N.add(L.cell.getKey()),C=!0)}let[v]=en(c.getWritable(),null,null);const w=y-g+p;for(let k=0;k<w;k++)zx(v[g-1][0].cell);const A=x-m+_;for(let k=0;k<A;k++)Bx(v[0][m-1].cell,!0,!1);[v]=en(c.getWritable(),null,null);for(let k=p;k<p+y;k++)for(let F=_;F<_+x;F++){const L=k-p,B=F-_,Y=h[L][B];if(Y.startRow!==L||Y.startColumn!==B)continue;const oe=Y.cell;if(oe.__rowSpan!==1||oe.__colSpan!==1){const I=[],j=Math.min(k+oe.__rowSpan,p+y)-1,ue=Math.min(F+oe.__colSpan,_+x)-1;for(let re=k;re<=j;re++)for(let Ae=F;Ae<=ue;Ae++){const ut=v[re][Ae];I.push(ut.cell)}jx(I),C=!0}const{cell:ae}=v[k][F],le=oe.getBackgroundColor();le!=null&&ae.setBackgroundColor(le);const K=ae.getChildren();oe.getChildren().forEach(I=>{O(I)&&V().append(I),ae.append(I)}),K.forEach(I=>I.remove())}if(r&&C){const[k]=en(c.getWritable(),null,null);k[f.startRow][f.startColumn].cell.selectEnd()}return!0}function Ws(n){const[[e,t,r,o],[i,s,l,c]]=["anchor","focus"].map(a=>{const u=n[a].getNode(),f=U(u,J);J(f)||H(238,a,u.getKey(),u.getType());const d=f.getParent();xe(d)||H(239,a);const h=d.getParent();return ge(h)||H(240,a),[u,f,d,h]});return o.is(c)||H(241),{anchorCell:t,anchorNode:e,anchorRow:r,anchorTable:o,focusCell:s,focusNode:i,focusRow:l,focusTable:c}}class _s{tableKey;anchor;focus;_cachedNodes;dirty;constructor(e,t,r){this.anchor=t,this.focus=r,t._selection=this,r._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){if(this.tableKey==="root"||this.anchor.key==="root"||this.anchor.type!=="element"||this.focus.key==="root"||this.focus.type!=="element")return!1;const e=te(this.tableKey),t=te(this.anchor.key),r=te(this.focus.key);return e!==null&&t!==null&&r!==null}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return ye(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,r){this.dirty=this.dirty||e!==this.tableKey||t!==this.anchor.key||r!==this.focus.key,this.tableKey=e,this.anchor.key=t,this.focus.key=r,this._cachedNodes=null}clone(){return new _s(this.tableKey,nt(this.anchor.key,this.anchor.offset,this.anchor.type),nt(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){if(e==="")return;const t=(e.endsWith(`
|
|
25
|
+
`)?e.slice(0,-1):e).split(`
|
|
26
|
+
`).map(i=>i.split(" ")),r=Lo();for(const i of t){const s=Hn();for(const l of i){const c=at(se.NO_STATUS),a=V();l&&a.append(Ne(l)),c.append(a),s.append(c)}r.append(s)}const{anchorCell:o}=Ws(this);bg(r,o.select(0,o.getChildrenSize()))}insertText(){}hasFormat(e){let t=0;this.getNodes().filter(J).forEach(o=>{const i=o.getFirstChild();Jt(i)&&(t|=i.getTextFormat())});const r=rn[e];return(t&r)!==0}insertNodes(e){const t=this.focus.getNode();S(t)||H(151),Dt(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const{anchorCell:e,focusCell:t}=Ws(this),r=lf(e);r===null&&H(153);const o=lf(t);o===null&&H(155);const i=Math.min(r.columnIndex,o.columnIndex),s=Math.max(r.columnIndex+r.colSpan-1,o.columnIndex+o.colSpan-1),l=Math.min(r.rowIndex,o.rowIndex),c=Math.max(r.rowIndex+r.rowSpan-1,o.rowIndex+o.rowSpan-1);return{fromX:Math.min(i,s),fromY:Math.min(l,c),toX:Math.max(i,s),toY:Math.max(l,c)}}getNodes(){if(!this.isValid())return[];const e=this._cachedNodes;if(e!==null)return e;const{anchorTable:t,anchorCell:r,focusCell:o}=Ws(this),i=o.getParents()[1];if(i!==t){if(t.isParentOf(o)){const p=i.getParent();p==null&&H(159),this.set(this.tableKey,o.getKey(),p.getKey())}else{const p=t.getParent();p==null&&H(158),this.set(this.tableKey,p.getKey(),o.getKey())}return this.getNodes()}const[s,l,c]=Ft(t,r,o),{minColumn:a,maxColumn:u,minRow:f,maxRow:d}=Hi(s,l,c),h=new Map([[t.getKey(),t]]);let g=null;for(let p=f;p<=d;p++)for(let _=a;_<=u;_++){const{cell:y}=s[p][_],x=y.getParent();xe(x)||H(160),x!==g&&(h.set(x.getKey(),x),g=x),h.has(y.getKey())||Jx(y,C=>{h.set(C.getKey(),C)})}const m=Array.from(h.values());return _n()||(this._cachedNodes=m),m}getTextContent(){const e=this.getNodes().filter(r=>J(r));let t="";for(let r=0;r<e.length;r++){const o=e[r],i=o.__parent,s=(e[r+1]||{}).__parent;t+=o.getTextContent()+(s!==i?`
|
|
27
|
+
`:" ")}return t}}function ye(n){return n instanceof _s}function Wl(n,e,t){n.getKey(),e.getKey(),t.getKey();const r=M(),o=ye(r)?r.clone():new _s("root",nt("root",0,"element"),nt("root",0,"element"));return o.set(n.getKey(),e.getKey(),t.getKey()),o}function Jx(n,e){const t=[[n]];for(let r=t.at(-1);r!==void 0&&t.length>0;r=t.at(-1)){const o=r.pop();o===void 0?t.pop():e(o)!==!1&&S(o)&&t.push(o.getChildren())}}function vg(n,e=be()){const t=te(n);ge(t)||H(231,n);const r=ln(t,e.getElementByKey(n));return r===null&&H(232,n),{tableElement:r,tableNode:t}}class qx{observers;nextFocus;shouldCheckSelectionForTable;constructor(){this.observers=new Map,this.nextFocus=null,this.shouldCheckSelectionForTable=null}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){const{nextFocus:e}=this;return e!==null&&(this.nextFocus=null),e}setShouldCheckSelectionForTable(e){this.shouldCheckSelectionForTable=e}getAndClearShouldCheckSelectionForTable(){const{shouldCheckSelectionForTable:e}=this;return e?(this.shouldCheckSelectionForTable=null,e):null}removeObserver(e){const t=this.observers.get(e);return t!==void 0&&(t[0].removeListeners(),this.observers.delete(e),!0)}removeAllObservers(){for(const e of Array.from(this.observers.keys()))this.removeObserver(e)}$getTableNodesAndObservers(){const e=[];for(const[t,[r]]of Array.from(this.observers.entries())){const o=te(t);ge(o)?e.push([o,r]):this.removeObserver(t)}return e}}class Vx{focusX;focusY;listenersToRemove;table;isHighlightingCells;anchorX;anchorY;tableNodeKey;anchorCell;focusCell;anchorCellNodeKey;focusCellNodeKey;editor;tableSelection;hasHijackedSelectionStyles;isSelecting;pointerType;abortController;listenerOptions;constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,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(e=>e()),this.listenersToRemove.clear()}$lookup(){return vg(this.tableNodeKey,this.editor)}trackTable(){const e=new MutationObserver(t=>{this.editor.read("latest",()=>{let r=!1;for(let s=0;s<t.length;s++){const l=t[s].target.nodeName;if(l==="TABLE"||l==="TBODY"||l==="THEAD"||l==="TR"){r=!0;break}}if(!r)return;const{tableNode:o,tableElement:i}=this.$lookup();this.table=br(o,i)})});this.editor.read("latest",()=>{const{tableNode:t,tableElement:r}=this.$lookup();this.table=br(t,r),e.observe(r,{attributes:!0,childList:!0,subtree:!0})})}$clearHighlight(e=!0){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();const{tableNode:r,tableElement:o}=this.$lookup();Qo(t,br(r,o),null),e&&M()!==null&&(pe(null),t.dispatchCommand(Pt))}$enableHighlightStyle(){const e=this.editor,{tableElement:t}=this.$lookup();Wt(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){const{tableElement:e}=this.$lookup();we(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(e!==null){e.tableKey!==this.tableNodeKey&&H(233,e.tableKey,this.tableNodeKey);const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),Qo(t,this.table,this.tableSelection)}else this.$clearHighlight()}updateDOMSelection(){if(this.anchorCell!==null&&this.focusCell!==null){const e=De(this.editor._window);e&&e.rangeCount>0&&e.removeAllRanges()}}$setFocusCellForSelection(e,t=!1){const r=this.editor,{tableNode:o}=this.$lookup(),i=e.x,s=e.y;if(this.focusCell=e,!this.isHighlightingCells&&(t||this.anchorX!==i||this.anchorY!==s||this.tableSelection!=null&&this.anchorCellNodeKey!=null)&&(this.isHighlightingCells=!0,this.$disableHighlightStyle()),this.focusX!==-1&&this.focusY!==-1&&i===this.focusX&&s===this.focusY)return!1;if(this.focusX=i,this.focusY=s,this.isHighlightingCells){const l=Ul(o,e.elem);if(this.tableSelection!=null&&this.anchorCellNodeKey!=null){let c=l;if(c===null&&t&&(c=o.getCellNodeFromCords(i,s,this.table)),c!==null){const a=this.$getAnchorTableCellOrThrow();return this.focusCellNodeKey=c.getKey(),this.tableSelection=Wl(o,a,c),pe(this.tableSelection),r.dispatchCommand(Pt),Qo(r,this.table,this.tableSelection),!0}}}return!1}$getAnchorTableCell(){const e=this.anchorCellNodeKey?te(this.anchorCellNodeKey):null;return J(e)?e:null}$getAnchorTableCellOrThrow(){const e=this.$getAnchorTableCell();return e===null&&H(234),e}$getFocusTableCell(){const e=this.focusCellNodeKey?te(this.focusCellNodeKey):null;return J(e)?e:null}$getFocusTableCellOrThrow(){const e=this.$getFocusTableCell();return e===null&&H(235),e}$setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.focusX=-1,this.focusY=-1,this.focusCell=null,this.focusCellNodeKey=null;const{tableNode:t}=this.$lookup(),r=Ul(t,e.elem);if(r!==null){const o=r.getKey();this.tableSelection!=null?(this.tableSelection=this.tableSelection.clone(),this.tableSelection.set(t.getKey(),o,o)):this.tableSelection=Wl(t,r,r),this.anchorCellNodeKey=o}}$formatCells(e){const t=M();ye(t)||H(236);const r=sc(),o=r.anchor,i=r.focus,s=t.getNodes().filter(J);s.length>0||H(237);const l=s[0].getFirstChild(),c=Jt(l)?l.getFormatFlags(e,null):null;s.forEach(a=>{o.set(a.getKey(),0,"element"),i.set(a.getKey(),a.getChildrenSize(),"element"),r.formatText(e,c)}),pe(t),this.editor.dispatchCommand(Pt)}$clearText(){const{editor:e}=this,t=te(this.tableNodeKey);if(!ge(t))throw new Error("Expected TableNode.");const r=M();ye(r)||H(253);const o=r.getNodes().filter(J),i=t.getFirstChild(),s=t.getLastChild();if(o.length>0&&i!==null&&s!==null&&xe(i)&&xe(s)&&o[0]===i.getFirstChild()&&o[o.length-1]===s.getLastChild()){t.selectPrevious();const l=t.getParent();return t.remove(),void(Ee(l)&&l.isEmpty()&&e.dispatchCommand(Pn))}o.forEach(l=>{if(S(l)){const c=V(),a=Ne();c.append(a),l.append(c),l.getChildren().forEach(u=>{u!==c&&u.remove()})}}),Qo(e,this.table,null),pe(null),e.dispatchCommand(Pt)}}const Sr="__lexicalTableSelection";function Tg(n){const e=Xd(n);return ge(e)||H(386,n),e}const ir=40;function js(n,e,t){const r=o=>Math.max(1,Math.ceil(Math.min(ir,o)/ir*18));return n<=e+ir?-r(e+ir-n):n>=t-ir?r(n-(t-ir)):0}function $n(n){return W(n)&&n.nodeName==="TABLE"}function ln(n,e){if(!e)return e;const t=$n(e)?e:e.querySelector("table");return $n(t)||H(341,n.constructor.name,n.getType(),n.getKey(),e.nodeName),t}function ys(n){return n._window}function xs(n,e){for(let t=e,r=null;t!==null;t=t.getParent()){if(n.is(t))return r;J(t)&&(r=t)}return null}const Yx=[[ec,"down"],[Zl,"up"],[Ql,"backward"],[Gl,"forward"]],Xx=[Tr,Nr,hn],Gx=[Qi,nc];function Qx(n,e){return n.registerRootListener(t=>{if(t===null)return;const r=n._window;if(r!==null)return oo(r,"pointerdown",o=>{const i=Ln(o);if(o.button!==0||!At(i)||!t.contains(i))return;const s=(function(l){const c=Ji(l);if(c===null)return null;let a=c.elem;for(;a!=null;){if(a.nodeName==="TABLE"&&Sr in a&&a[Sr])return{cellElement:c,tableElement:a,tableObserver:a[Sr]};a=a.parentNode}return null})(i);n.update(()=>{if(ye(M())){for(const[u]of e.observers.values())u.$clearHighlight(!1);pe(null),n.dispatchCommand(Pt)}if(!s)return;const{tableObserver:l,tableElement:c,cellElement:a}=s;(function(u,f,d,h,g,m){const p=u._window;if(!p)return;const _=C=>{if(g.isSelecting)return;g.isSelecting=!0,C!==null&&g.anchorCell===null&&u.update(()=>{g.$setAnchorCellForSelection(C)});let T=f.clientX,b=f.clientY,N=null;const v=()=>{g.isSelecting=!1,N!==null&&(p.cancelAnimationFrame(N),N=null),p.removeEventListener("pointerup",ae),p.removeEventListener("pointermove",le)},w=(K,I)=>{const j=h.getRootNode();if(!Cn(j)&&!Ut(j))return null;for(const ue of j.elementsFromPoint(K,I)){const re=af(h,ue);if(re)return re}return null},A=(K,I)=>{g.anchorCell===null&&u.update(()=>{g.$setAnchorCellForSelection(K)}),g.focusCell!==null&&K.elem===g.focusCell.elem||(m.setNextFocus({focusCell:K,override:I,tableKey:g.tableNodeKey}),u.dispatchCommand(Pt))},k=K=>{for(let I=h.parentElement;I;I=I.parentElement)if(K==="x"?I.scrollWidth>I.clientWidth:I.scrollHeight>I.clientHeight){const j=p.getComputedStyle(I),ue=K==="x"?j.overflowX:j.overflowY;if(ue==="auto"||ue==="scroll")return I}return null},F=(K,I,j)=>{let ue,re;if(K===null)ue=0,re=j==="x"?p.innerWidth:p.innerHeight;else{const ie=K.getBoundingClientRect();ue=j==="x"?ie.left:ie.top,re=j==="x"?ie.right:ie.bottom}const Ae=js(I,ue,re);if(Ae===0)return!1;if(K===null){const ie=j==="x"?p.scrollX:p.scrollY;return p.scrollBy(j==="x"?Ae:0,j==="x"?0:Ae),(j==="x"?p.scrollX:p.scrollY)!==ie}if(j==="x"){const ie=K.scrollLeft;return K.scrollLeft+=Ae,K.scrollLeft!==ie}const ut=K.scrollTop;return K.scrollTop+=Ae,K.scrollTop!==ut},L=(K,I)=>{let j=T,ue=b;if(K===null)j=Math.min(Math.max(j,1),p.innerWidth-1);else{const re=K.getBoundingClientRect();j=Math.min(Math.max(j,re.left+1),re.right-1)}if(I===null)ue=Math.min(Math.max(ue,1),p.innerHeight-1);else{const re=I.getBoundingClientRect();ue=Math.min(Math.max(ue,re.top+1),re.bottom-1)}return[j,ue]},B=()=>{const K=k("x");if(K!==null){const re=K.getBoundingClientRect();if(js(T,re.left,re.right)!==0)return!0}const I=k("y"),j=I===null?0:I.getBoundingClientRect().top,ue=I===null?p.innerHeight:I.getBoundingClientRect().bottom;return js(b,j,ue)!==0},Y=()=>{if(N=null,!g.isSelecting)return;const K=k("x"),I=k("y"),j=K!==null&&F(K,T,"x"),ue=F(I,b,"y");if(j||ue){const[re,Ae]=L(K,I),ut=w(re,Ae);ut&&A(ut,!1),N=p.requestAnimationFrame(Y)}},oe=()=>{N===null&&g.pointerType!=="touch"&&B()&&(N=p.requestAnimationFrame(Y))},ae=()=>{v()},le=K=>{if(!(re=>!(1&~re.buttons))(K)&&g.isSelecting)return void v();const I=Ln(K);if(!At(I))return;T=K.clientX,b=K.clientY;let j=null;const ue=!(Ot||h.contains(I));j=ue?af(h,I):w(K.clientX,K.clientY),j&&A(j,ue),oe()};p.addEventListener("pointerup",ae,g.listenerOptions),p.addEventListener("pointermove",le,g.listenerOptions)};g.pointerType=f.pointerType;const y=Tg(g.tableNodeKey),x=ct();if(Ot&&f.shiftKey&&vt(x,y)&&(E(x)||ye(x))){const C=x.anchor.getNode(),T=xs(y,x.anchor.getNode());T?(g.$setAnchorCellForSelection(An(g,T)),g.$setFocusCellForSelection(d),Zt(f)):(y.isBefore(C)?y.selectStart():y.selectEnd()).anchor.set(x.anchor.key,x.anchor.offset,x.anchor.type)}else f.pointerType!=="touch"&&g.$setAnchorCellForSelection(d);_(d)})(n,o,a,c,l,e)})})})}function Zx(n,e,t,r,o){const i=t.getRootElement(),s=ys(t);i!==null&&s!==null||H(246);const l=new Vx(t,n.getKey()),c=ln(n,e);(function(d,h){cf(d)!==null&&H(205),d[Sr]=h})(c,l),l.listenersToRemove.add(()=>(function(d,h){cf(d)===h&&delete d[Sr]})(c,l)),l.listenersToRemove.add(oo(c,"mousedown",d=>{const h=Ln(d);d.detail>=3&&At(h)&&Ji(h)!==null&&d.preventDefault()},l.listenerOptions));for(const[d,h]of Yx)l.listenersToRemove.add(t.registerCommand(d,g=>wg(t,g,h,n,l,o),dt));l.listenersToRemove.add(t.registerCommand(tc,d=>{const h=M();if(ye(h)){const g=xs(n,h.focus.getNode());if(g!==null)return Zt(d),g.selectEnd(),!0}return!1},dt));const a=()=>{const d=M();return!!vt(d,n)&&!!ye(d)&&(l.$clearText(),!0)};for(const d of Xx)l.listenersToRemove.add(t.registerCommand(d,a,dt));const u=d=>{const h=M();if(!ye(h)&&!E(h))return!1;const g=n.isParentOf(h.anchor.getNode());if(g!==n.isParentOf(h.focus.getNode())){const m=g?"anchor":"focus",p=g?"focus":"anchor",{key:_,offset:y,type:x}=h[p];return n[h[m].isBefore(h[p])?"selectPrevious":"selectNext"]()[p].set(_,y,x),!1}return!!vt(h,n)&&!!ye(h)&&(d&&(d.preventDefault(),d.stopPropagation()),l.$clearText(),!0)};for(const d of Gx)l.listenersToRemove.add(t.registerCommand(d,u,dt));l.listenersToRemove.add(t.registerCommand(Zi,d=>{const h=M();if(h){if(!ye(h)&&!E(h))return!1;Ml(t,Kt(d,ClipboardEvent)?d:null,jc(h));const g=u(d);return E(h)?(h.removeText(),!0):g}return!1},dt));const f=i.ownerDocument;return l.listenersToRemove.add(oo(f,"paste",d=>{d.defaultPrevented||t.read("latest",()=>{const h=M();return i.contains(f.activeElement)&&ye(h)&&vt(h,n)})&&(d.preventDefault(),t.dispatchCommand(Lr,d))})),l.listenersToRemove.add(oo(f,"copy",d=>{if(d.defaultPrevented)return;const h=Ln(d);h===i||At(h)&&i.contains(h)||t.read("latest",()=>{const g=M();return i.contains(xo(i))&&ye(g)&&vt(g,n)})&&(d.preventDefault(),t.dispatchCommand(Oo,d))})),l.listenersToRemove.add(t.registerCommand(kt,d=>{const h=M();return!!vt(h,n)&&!!ye(h)&&(l.$formatCells(d),!0)},dt)),l.listenersToRemove.add(t.registerCommand(td,d=>{const h=M();if(!ye(h)||!vt(h,n))return!1;const g=h.anchor.getNode(),m=h.focus.getNode();if(!J(g)||!J(m))return!1;const[p,_,y]=Ft(n,g,m),x=Math.max(_.startRow+_.cell.__rowSpan-1,y.startRow+y.cell.__rowSpan-1),C=Math.max(_.startColumn+_.cell.__colSpan-1,y.startColumn+y.cell.__colSpan-1),T=Math.min(_.startRow,y.startRow),b=Math.min(_.startColumn,y.startColumn);if(T===0&&b===0&&x===p.length-1&&C===p[0].length-1)return n.setFormat(d),!0;const N=new Set;for(let v=T;v<=x;v++)for(let w=b;w<=C;w++){const A=p[v][w].cell;if(N.has(A))continue;N.add(A),A.setFormat(d);const k=A.getChildren();for(let F=0;F<k.length;F++){const L=k[F];S(L)&&!L.isInline()&&L.setFormat(d)}}return!0},dt)),l.listenersToRemove.add(t.registerCommand(Mn,d=>{const h=M();if(!vt(h,n))return!1;if(ye(h))return l.$clearHighlight(),!1;if(E(h)){const g=U(h.anchor.getNode(),m=>J(m));if(!J(g))return!1;if(typeof d=="string"){const m=ff(t,h,n);if(m)return uf(m,n,[Ne(d)]),!0}}return!1},dt)),r&&l.listenersToRemove.add(t.registerCommand(rc,d=>{const h=M();if(!E(h)||!h.isCollapsed()||!vt(h,n))return!1;const g=to(h.anchor.getNode());return!(g===null||!n.is(Ir(g)))&&(Zt(d),(function(m,p){const _=p==="next"?"getNextSibling":"getPreviousSibling",y=p==="next"?"getFirstChild":"getLastChild",x=m[_]();if(S(x))return x.selectEnd();const C=U(m,xe);C===null&&H(247);for(let b=C[_]();xe(b);b=b[_]()){const N=b[y]();if(S(N))return N.selectEnd()}const T=U(C,ge);T===null&&H(248),p==="next"?T.selectNext():T.selectPrevious()})(g,d.shiftKey?"previous":"next"),!0)},dt)),l.listenersToRemove.add(t.registerCommand(od,d=>n.isSelected(),dt)),l.listenersToRemove.add(t.registerCommand(Pn,()=>{const d=M();if(!E(d)||!d.isCollapsed()||!vt(d,n))return!1;const h=ff(t,d,n);return!!h&&(uf(h,n),!0)},dt)),l}function e0(n,e){const t=M(),r=ct(),o=n.getAndClearNextFocus();if(o!==null){const{tableKey:s,focusCell:l}=o,c=n.observers.get(s);c||H(335,s);const[a]=c;if(ye(t)&&t.tableKey===a.tableNodeKey)return(l.x!==a.focusX||l.y!==a.focusY)&&(a.$setFocusCellForSelection(l),!0);if(a.anchorCell!==null&&a.anchorCellNodeKey!==null&&l.elem!==a.anchorCell.elem&&a.tableSelection!==null)return a.$setFocusCellForSelection(l,!0),!0}const i=n.getAndClearShouldCheckSelectionForTable();if(i&&E(r)&&E(t)&&t.isCollapsed()){const s=te(i);if(ge(s)){const l=t.anchor.getNode(),c=s.getFirstChild(),a=to(l);if(a!==null&&xe(c)){const u=c.getFirstChild();if(J(u)&&s.is(U(a,f=>f.is(s)||f.is(u))))return u.selectStart(),!0}}}ye(t)&&(function(s,l){const c=ys(s),a=ct();if(!l.is(a))return;const u=Tg(l.tableKey),f=De(c),d=f&&rt(f,s.getRootElement());if(f&&d&&d.anchorNode&&d.focusNode){const h=Xe(d.focusNode),g=h&&!u.isParentOf(h),m=Xe(d.anchorNode),p=m&&u.isParentOf(m);if(g&&p&&f.rangeCount>0){const _=Xp(f,s);_&&(_.anchor.set(u.getKey(),l.isBackward()?u.getChildrenSize():0,"element"),f.removeAllRanges(),pe(_))}}})(e,t),E(t)&&(function(s,l){const c=ct(),{anchor:a,focus:u}=s,f=a.getNode(),d=u.getNode(),h=to(f),g=to(d),m=h?Ir(h):null,p=g?Ir(g):null,_=s.isBackward(),y=h&&g&&m&&p&&m.is(p),x=p&&(!m||m.isParentOf(p)),C=m&&(!p||p.isParentOf(m));if(x){const T=s.clone(),[b]=Ft(p,g,g),N=b[0][0].cell,v=b[b.length-1].at(-1).cell;T.focus.set(_?N.getKey():v.getKey(),_?0:v.getChildrenSize(),"element"),pe(T)}else if(C){const T=s.clone(),[b]=Ft(m,h,h),N=b[0][0].cell,v=b[b.length-1].at(-1).cell;T.anchor.set(_?v.getKey():N.getKey(),_?v.getChildrenSize():0,"element"),pe(T)}else if(y){const T=l.observers.get(m.getKey());T||H(335,m.getKey());const[b]=T;if(h.is(g)||(b.$setAnchorCellForSelection(An(b,h)),b.$setFocusCellForSelection(An(b,g),!0)),b.pointerType==="touch"&&b.isSelecting&&s.isCollapsed()&&E(c)&&c.isCollapsed()){const N=to(c.anchor.getNode());N&&!N.is(g)&&(b.$setAnchorCellForSelection(An(b,N)),b.$setFocusCellForSelection(An(b,g),!0),b.pointerType=null)}}})(t,n);for(const[s,l]of n.$getTableNodesAndObservers())t0(e,s,l);return!1}function t0(n,e,t){const r=M(),o=ct();r&&!r.is(o)&&(ye(r)||ye(o))&&t.tableSelection&&!t.tableSelection.is(o)&&(ye(r)&&r.tableKey===t.tableNodeKey?t.$updateTableTableSelection(r):!ye(r)&&ye(o)&&o.tableKey===t.tableNodeKey&&t.$updateTableTableSelection(null)),t.hasHijackedSelectionStyles&&!e.isSelected()?(function(i,s){s.$enableHighlightStyle(),jl(s.table,l=>{const c=l.elem;l.highlighted=!1,kg(i,l),c.getAttribute("style")||c.removeAttribute("style")})})(n,t):!t.hasHijackedSelectionStyles&&e.isSelected()&&(function(i,s){s.$disableHighlightStyle(),jl(s.table,l=>{l.highlighted=!0,Ng(i,l)})})(n,t)}function cf(n){return n[Sr]||null}function Ji(n){let e=n;for(;e!=null;){const t=e.nodeName;if(t==="TD"||t==="TH"){const r=e._cell;return r===void 0?null:r}e=e.parentNode}return null}function af(n,e){if(!n.contains(e))return null;let t=null;for(let r=e;r!=null;r=r.parentNode){if(r===n)return t;const o=r.nodeName;o!=="TD"&&o!=="TH"||(t=r._cell||null)}return null}function br(n,e){const t=[],r={columns:0,domRows:t,rows:0};let o=ln(n,e).querySelector("tr"),i=0,s=0;for(t.length=0;o!=null;){const l=o.nodeName;if(l==="TD"||l==="TH"){const u={elem:o,hasBackgroundColor:o.style.backgroundColor!=="",highlighted:!1,x:i,y:s};o._cell=u;let f=t[s];f===void 0&&(f=t[s]=[]),f[i]=u}else{const u=o.firstChild;if(u!=null){o=u;continue}}const c=o.nextSibling;if(c!=null){i++,o=c;continue}const a=o.parentNode;if(a!=null){const u=a.nextSibling;if(u==null)break;s++,i=0,o=u}}return r.columns=i+1,r.rows=s+1,r}function Qo(n,e,t){const r=new Set(t?t.getNodes():[]);jl(e,(o,i)=>{const s=o.elem;r.has(i)?(o.highlighted=!0,Ng(n,o)):(o.highlighted=!1,kg(n,o),s.getAttribute("style")||s.removeAttribute("style"))})}function jl(n,e){const{domRows:t}=n;for(let r=0;r<t.length;r++){const o=t[r];if(o)for(let i=0;i<o.length;i++){const s=o[i];if(!s)continue;const l=Xe(s.elem);l!==null&&e(s,l,{x:i,y:r})}}}const n0=(n,e,t,r,o)=>{const i=o==="forward";switch(o){case"backward":case"forward":return t!==(i?n.table.columns-1:0)?ei(e.getCellNodeFromCordsOrThrow(t+(i?1:-1),r,n.table),i):r!==(i?n.table.rows-1:0)?ei(e.getCellNodeFromCordsOrThrow(i?0:n.table.columns-1,r+(i?1:-1),n.table),i):i?e.selectNext():e.selectPrevious(),!0;case"up":return r!==0?ei(e.getCellNodeFromCordsOrThrow(t,r-1,n.table),!1):e.selectPrevious(),!0;case"down":return r!==n.table.rows-1?ei(e.getCellNodeFromCordsOrThrow(t,r+1,n.table),!0):e.selectNext(),!0;default:return!1}};function Us(n,e){let t,r;if(e.startColumn===n.minColumn)t="minColumn";else{if(e.startColumn+e.cell.__colSpan-1!==n.maxColumn)return null;t="maxColumn"}if(e.startRow===n.minRow)r="minRow";else{if(e.startRow+e.cell.__rowSpan-1!==n.maxRow)return null;r="maxRow"}return[t,r]}function Zo([n,e]){return[n==="minColumn"?"maxColumn":"minColumn",e==="minRow"?"maxRow":"minRow"]}function sr(n,e,[t,r]){const o=e[r],i=n[o];i===void 0&&H(250,r,String(o));const s=e[t],l=i[s];return l===void 0&&H(250,t,String(s)),l}function r0(n,e,t,r,o){const i=Hi(e,t,r),s=(function(b,N){const{minColumn:v,maxColumn:w,minRow:A,maxRow:k}=N;let F=1,L=1,B=1,Y=1;const oe=b[A],ae=b[k];for(let le=v;le<=w;le++)F=Math.max(F,oe[le].cell.__rowSpan),Y=Math.max(Y,ae[le].cell.__rowSpan);for(let le=A;le<=k;le++)L=Math.max(L,b[le][v].cell.__colSpan),B=Math.max(B,b[le][w].cell.__colSpan);return{bottomSpan:Y,leftSpan:L,rightSpan:B,topSpan:F}})(e,i),{topSpan:l,leftSpan:c,bottomSpan:a,rightSpan:u}=s,f=(function(b,N){const v=Us(b,N);return v===null&&H(249,N.cell.getKey()),v})(i,t),[d,h]=Zo(f);let g=i[d],m=i[h];o==="forward"?g+=d==="maxColumn"?1:c:o==="backward"?g-=d==="minColumn"?1:u:o==="down"?m+=h==="maxRow"?1:l:o==="up"&&(m-=h==="minRow"?1:a);const p=e[m];if(p===void 0)return!1;const _=p[g];if(_===void 0)return!1;const[y,x]=(function(b,N,v){const w=Hi(b,N,v),A=Us(w,N);if(A)return[sr(b,w,A),sr(b,w,Zo(A))];const k=Us(w,v);if(k)return[sr(b,w,Zo(k)),sr(b,w,k)];const F=["minColumn","minRow"];return[sr(b,w,F),sr(b,w,Zo(F))]})(e,t,_),C=An(n,y.cell),T=An(n,x.cell);return n.$setAnchorCellForSelection(C),n.$setFocusCellForSelection(T,!0),!0}function vt(n,e){if(E(n)||ye(n)){const t=e.isParentOf(n.anchor.getNode()),r=e.isParentOf(n.focus.getNode());return t&&r}return!1}function ei(n,e){e?n.selectStart():n.selectEnd()}function Ng(n,e){const t=e.elem,r=n._config.theme;J(Xe(t))||H(131),we(t,r.tableCellSelected)}function kg(n,e){const t=e.elem;J(Xe(t))||H(131);const r=n._config.theme;Wt(t,r.tableCellSelected)}function to(n){const e=U(n,J);return J(e)?e:null}function Ir(n){const e=U(n,ge);return ge(e)?e:null}function o0(n,e,t,r,o,i,s){const l=Je(t.focus,o?"previous":"next");if(fs(l))return!1;let c=l;for(const p of Dr(l).iterNodeCarets("shadowRoot")){if(!Mt(p)||!S(p.origin))return!1;c=p}const a=c.getParentAtCaret();if(!J(a))return!1;const u=a,f=(function(p){for(const _ of Dr(p).iterNodeCarets("root")){const{origin:y}=_;if(J(y)){if(He(_))return Fe(y,p.direction)}else if(!xe(y))break}return null})(ne(u,c.direction)),d=U(u,ge);if(!d||!d.is(i))return!1;const h=n.getElementByKey(u.getKey()),g=Ji(h);if(!h||!g)return!1;const m=s0(n,d);if(s.table=m,f)if(r==="extend"){const p=Ji(n.getElementByKey(f.origin.getKey()));if(!p)return!1;s.$setAnchorCellForSelection(g),s.$setFocusCellForSelection(p,!0)}else{const p=je(f);wt(t.anchor,p),wt(t.focus,p)}else if(r==="extend")s.$setAnchorCellForSelection(g),s.$setFocusCellForSelection(g,!0);else{const p=(function(_){const y=jn(_);return He(y)?je(y):_})(ne(d,l.direction));wt(t.anchor,p),wt(t.focus,p)}return Zt(e),!0}function wg(n,e,t,r,o,i){if((t==="up"||t==="down")&&(function(l){const c=l.getRootElement();return c?c.hasAttribute("aria-controls")&&c.getAttribute("aria-controls")==="typeahead-menu":!1})(n))return!1;const s=M();if(!vt(s,r)){if(E(s)){if(t==="backward"){if(s.focus.offset>0)return!1;const l=(function(a){for(let u=a,f=a;f!==null;u=f,f=f.getParent())if(S(f)){if(f!==u&&f.getFirstChild()!==u)return null;if(!f.isInline())return f}return null})(s.focus.getNode());if(!l)return!1;const c=l.getPreviousSibling();return!!ge(c)&&(Zt(e),e.shiftKey?s.focus.set(c.getParentOrThrow().getKey(),c.getIndexWithinParent(),"element"):c.selectEnd(),!0)}if(e.shiftKey&&(t==="up"||t==="down")){const l=s.focus.getNode();if(!s.isCollapsed()&&(t==="up"&&!s.isBackward()||t==="down"&&s.isBackward())){let c=U(l,h=>ge(h));if(J(c)&&(c=U(c,ge)),c!==r||!c)return!1;const a=t==="down"?c.getNextSibling():c.getPreviousSibling();if(!a)return!1;let u=0;t==="up"&&S(a)&&(u=a.getChildrenSize());let f=a;t==="up"&&S(a)&&(f=a.getLastChild()||a,u=O(f)?f.getTextContentSize():0);const d=s.clone();return d.focus.set(f.getKey(),u,O(f)?"text":"element"),pe(d),Zt(e),!0}if(Se(l)){const c=t==="up"?s.getNodes()[s.getNodes().length-1]:s.getNodes()[0];if(c&&xs(r,c)!==null){const a=r.getFirstDescendant(),u=r.getLastDescendant();if(!a||!u)return!1;const[f]=zt(a),[d]=zt(u),h=r.getCordsFromCellNode(f,o.table),g=r.getCordsFromCellNode(d,o.table),m=r.getDOMCellFromCordsOrThrow(h.x,h.y,o.table),p=r.getDOMCellFromCordsOrThrow(g.x,g.y,o.table);return o.$setAnchorCellForSelection(m),o.$setFocusCellForSelection(p,!0),!0}return!1}{let c=U(l,u=>S(u)&&!u.isInline());if(J(c)&&(c=U(c,ge)),!c)return!1;const a=t==="down"?c.getNextSibling():c.getPreviousSibling();if(ge(a)&&o.tableNodeKey===a.getKey()){const u=a.getFirstDescendant(),f=a.getLastDescendant();if(!u||!f)return!1;const[d]=zt(u),[h]=zt(f),g=s.clone();return g.focus.set((t==="up"?d:h).getKey(),t==="up"?0:h.getChildrenSize(),"element"),Zt(e),pe(g),!0}}}}return t==="down"&&qi(n)&&i.setShouldCheckSelectionForTable(r.getKey()),!1}if(E(s)){if(t==="backward"||t==="forward")return o0(n,e,s,e.shiftKey?"extend":"move",t==="backward",r,o);if(s.isCollapsed()){const{anchor:l,focus:c}=s,a=U(l.getNode(),J),u=U(c.getNode(),J);if(!J(a)||!a.is(u))return!1;const f=Ir(a);if(f!==r&&f!=null){const y=ln(f,n.getElementByKey(f.getKey()));if(y!=null)return o.table=br(f,y),wg(n,e,t,f,o,i)}const d=n.getElementByKey(a.__key),h=n.getElementByKey(l.key);if(h==null||d==null)return!1;let g;if(l.type==="element")g=h.getBoundingClientRect();else{const y=De(ys(n));if(y===null||y.rangeCount===0)return!1;const x=eh(y,n.getRootElement());if(x===null)return!1;g=x.getBoundingClientRect()}const m=t==="up"?a.getFirstChild():a.getLastChild();if(m==null)return!1;const p=n.getElementByKey(m.__key);if(p==null)return!1;const _=p.getBoundingClientRect();if(t==="up"?_.top>g.top-g.height:g.bottom+g.height>_.bottom){Zt(e);const y=r.getCordsFromCellNode(a,o.table);if(!e.shiftKey)return n0(o,r,y.x,y.y,t);{const x=r.getDOMCellFromCordsOrThrow(y.x,y.y,o.table);o.$setAnchorCellForSelection(x),o.$setFocusCellForSelection(x,!0)}return!0}}}else if(ye(s)){const{anchor:l,focus:c,tableKey:a}=s;if(a!==r.getKey())return!1;const u=U(l.getNode(),J),f=U(c.getNode(),J),[d]=s.getNodes();ge(d)||H(251);const h=ln(d,n.getElementByKey(d.getKey()));if(!J(u)||!J(f)||!ge(d)||h==null)return!1;o.$updateTableTableSelection(s);const g=br(d,h),m=r.getCordsFromCellNode(u,g),p=r.getDOMCellFromCordsOrThrow(m.x,m.y,g);if(o.$setAnchorCellForSelection(p),Zt(e),e.shiftKey){const[_,y,x]=Ft(r,u,f);return r0(o,_,y,x,t)}return f.selectEnd(),!0}return!1}function Zt(n){n.preventDefault(),n.stopImmediatePropagation(),n.stopPropagation()}function uf(n,e,t){const r=V();n==="first"?e.insertBefore(r):e.insertAfter(r),r.append(...t||[]),r.selectEnd()}function ff(n,e,t){const r=t.getParent();if(!r)return;const o=De(ys(n));if(!o)return;const i=rt(o,n.getRootElement()).anchorNode,s=n.getElementByKey(r.getKey()),l=ln(t,n.getElementByKey(t.getKey()));if(!i||!s||!l||!s.contains(i)||l.contains(i))return;const c=U(e.anchor.getNode(),y=>J(y));if(!c)return;const a=U(c,y=>ge(y));if(!ge(a)||!a.is(t))return;const[u,f]=Ft(t,c,c),d=u[0][0],h=u[u.length-1][u[0].length-1],{startRow:g,startColumn:m}=f,p=g===d.startRow&&m===d.startColumn,_=g===h.startRow&&m===h.startColumn;return p?"first":_?"last":void 0}function An(n,e){const{tableNode:t}=n.$lookup(),r=t.getCordsFromCellNode(e,n.table);return t.getDOMCellFromCordsOrThrow(r.x,r.y,n.table)}function Ul(n,e,t){return xs(n,Xe(e,t))}function df(n){return W(n)&&n.nodeName==="DIV"}function hf(n,e,t){let r=n.querySelector(":scope > colgroup");if(!t)return void(r&&r.remove());r||(r=ee().createElement("colgroup"),Di(r),n.insertBefore(r,n.firstChild));const o=[];for(let i=0;i<e;i++){const s=ee().createElement("col"),l=t[i];l&&(s.style.width=`${l}px`),o.push(s)}r.replaceChildren(...o)}function gf(n,e,t){if(!e.theme.tableAlignment)return;const r=[],o=[];for(const i of["center","right"]){const s=e.theme.tableAlignment[i];s&&(i===t?o:r).push(s)}Wt(n,...r),we(n,...o)}const Hl=new WeakSet;function qi(n=be()){return Hl.has(n)}function pf(n=be()){const e=Br(n,"@lexical/table/Table");return!!e&&e.output.hasStickyScrollbar.peek()&&e.output.hasHorizontalScroll.peek()}function i0(n,e){e?Hl.add(n):Hl.delete(n)}class Jn extends ve{__rowStriping=!1;__frozenColumnCount=0;__frozenRowCount=0;__colWidths=void 0;$config(){return this.config("table",{extends:ve,importDOM:{table:()=>({conversion:l0,priority:1})}})}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){const t=this.getWritable();return t.__colWidths=e,t}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}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,t,r){return r==="html"}getDOMSlot(e){const t=$n(e)?e:e.querySelector("table");return $n(t)||H(229),super.getDOMSlot(e).withElement(t).withAfter(t.querySelector(":scope > colgroup"))}createDOM(e,t){const r=ee().createElement("table");if(this.__style&&gn(r.style,this.__style),this.getColWidths()){const o=ee().createElement("colgroup");r.appendChild(o),Di(o)}if(we(r,e.theme.table),this.updateTableElement(null,r,e),qi(t)){const o=pf(t),i=(function(s,l,c){const a=ee().createElement("div"),u=l.theme.tableScrollableWrapper;return u?we(a,u):a.style.overflowX="auto",c&&(a.style.scrollbarWidth="none"),a.appendChild(s),a})(r,e,o);if(this.updateTableWrapper(null,i,r,e),o){const s=(function(c){const a=ee(),u=a.createElement("div"),f=c.theme.tableStickyScrollbar;f?we(u,f):(u.style.position="sticky",u.style.bottom="0",u.style.overflowX="scroll",u.style.overflowY="hidden"),u.style.display="none",u.setAttribute("aria-hidden","true"),u.tabIndex=-1;const d=a.createElement("div");return d.style.height="1px",d.style.width="0px",u.appendChild(d),u})(e),l=ee().createElement("div");return l.setAttribute("data-lexical-sticky-scrollbar","true"),l.appendChild(i),l.appendChild(s),Di(s),l}return i}return r}updateTableWrapper(e,t,r,o){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&(function(i,s,l,c){c>0?(we(i,l.theme.tableFrozenColumn),s.setAttribute("data-lexical-frozen-column","true")):(Wt(i,l.theme.tableFrozenColumn),s.removeAttribute("data-lexical-frozen-column"))})(t,r,o,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&(function(i,s,l,c){c>0?(we(i,l.theme.tableFrozenRow),s.setAttribute("data-lexical-frozen-row","true")):(Wt(i,l.theme.tableFrozenRow),s.removeAttribute("data-lexical-frozen-row"))})(t,r,o,this.__frozenRowCount)}updateTableElement(e,t,r){this.__style!==(e?e.__style:"")&&gn(t.style,this.__style,e?e.__style:""),this.__rowStriping!==(!!e&&e.__rowStriping)&&(function(s,l,c){c?(we(s,l.theme.tableRowStriping),s.setAttribute("data-lexical-row-striping","true")):(Wt(s,l.theme.tableRowStriping),s.removeAttribute("data-lexical-row-striping"))})(t,r,this.__rowStriping);const o=e?e.getColumnCount():0,i=e?e.__colWidths:void 0;this.getColumnCount()===o&&this.getColWidths()===i||hf(t,this.getColumnCount(),this.getColWidths()),gf(t,r,this.getFormatType())}updateDOM(e,t,r){const o=ln(this,t);if(t===o===qi())return!0;if(df(t)){if(t.hasAttribute("data-lexical-sticky-scrollbar")!==pf())return!0;const i=o.parentElement;df(i)&&this.updateTableWrapper(e,i,o,r)}return this.updateTableElement(e,o,r),!1}scaleDOMColWidths(e,t){const r=this.getColWidths();r&&hf(ln(this,e),this.getColumnCount(),r.map(o=>o*t))}exportDOM(e){const t=super.exportDOM(e),{element:r}=t;return{after:o=>{if(t.after&&(o=t.after(o)),!$n(o)&&W(o)&&(o=o.querySelector("table")),!$n(o))return null;gf(o,e._config,this.getFormatType());const[i]=en(this,null,null),s=new Map;for(const u of i)for(const f of u){const d=f.cell.getKey();s.has(d)||s.set(d,{colSpan:f.cell.getColSpan(),startColumn:f.startColumn})}const l=new Set;for(const u of o.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){const f=u.getAttribute("data-temporary-table-cell-lexical-key");if(f){const d=s.get(f);if(u.removeAttribute("data-temporary-table-cell-lexical-key"),d){s.delete(f);for(let h=0;h<d.colSpan;h++)l.add(h+d.startColumn)}}}const c=o.querySelector(":scope > colgroup");if(c){const u=Array.from(o.querySelectorAll(":scope > colgroup > col")).filter((f,d)=>l.has(d));c.replaceChildren(...u)}const a=o.querySelectorAll(":scope > tr");if(a.length>0){const u=ee().createElement("tbody");for(const f of a)u.appendChild(f);o.append(u)}return o},element:!$n(r)&&W(r)?r.querySelector("table"):r}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:r,domRows:o}=t;for(let i=0;i<r;i++){const s=o[i];if(s!=null)for(let l=0;l<s.length;l++){const c=s[l];if(c==null)continue;const{elem:a}=c,u=Ul(this,a);if(u!==null&&e.is(u))return{x:l,y:i}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,r){const{domRows:o}=r,i=o[t];if(i==null)return null;const s=i[e<i.length?e:i.length-1];return s??null}getDOMCellFromCordsOrThrow(e,t,r){const o=this.getDOMCellFromCords(e,t,r);if(!o)throw new Error("Cell not found at cords.");return o}getCellNodeFromCords(e,t,r){const o=this.getDOMCellFromCords(e,t,r);if(o==null)return null;const i=Xe(o.elem);return J(i)?i:null}getCellNodeFromCordsOrThrow(e,t,r){const o=this.getCellNodeFromCords(e,t,r);if(!o)throw new Error("Node at cords not TableCellNode.");return o}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(e){const t=this.getWritable();return t.__rowStriping=e,t}setFrozenColumns(e){const t=this.getWritable();return t.__frozenColumnCount=e,t}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){const t=this.getWritable();return t.__frozenRowCount=e,t}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){const e=this.getFirstChild();if(!xe(e))return 0;let t=0;return e.getChildren().forEach(r=>{J(r)&&(t+=r.getColSpan())}),t}}function s0(n,e){const t=n.getElementByKey(e.getKey());return t===null&&H(230),br(e,t)}function l0(n){const e=Lo();n.hasAttribute("data-lexical-row-striping")&&e.setRowStriping(!0),n.hasAttribute("data-lexical-frozen-column")&&e.setFrozenColumns(1),n.hasAttribute("data-lexical-frozen-row")&&e.setFrozenRows(1);const t=n.querySelector(":scope > colgroup");if(t){let r=[];for(const o of t.querySelectorAll(":scope > col")){let i=o.style.width||"";if(!Cr.test(i)&&(i=o.getAttribute("width")||"",!/^\d+$/.test(i))){r=void 0;break}r.push(parseFloat(i))}r&&e.setColWidths(r)}return{after:r=>Ii(r,xe),node:e}}function Lo(){return Ge(new Jn)}function ge(n){return n instanceof Jn}function c0(n){xe(n.getParent())?n.isEmpty()&&n.append(V()):n.remove()}function a0(n){ge(n.getParent())?xh(n,J):n.remove()}function u0(n){xh(n,xe);const[e]=en(n,null,null),t=e.reduce((s,l)=>Math.max(s,l.length),0),r=n.getChildren();for(let s=0;s<e.length;++s){const l=r[s];if(!l)continue;xe(l)||H(254,l.constructor.name,l.getType());const c=e[s].reduce((a,u)=>u?1+a:a,0);if(c!==t)for(let a=c;a<t;++a){const u=at();u.append(V()),l.append(u)}}const o=n.getColWidths(),i=n.getColumnCount();if(o&&o.length!==i){let s;if(i<o.length)s=o.slice(0,i);else if(o.length>0){const l=o[o.length-1];s=[...o,...Array(i-o.length).fill(l)]}n.setColWidths(s)}}function f0(n){if(n.detail<3||!At(n.target))return!1;const e=Xe(n.target);if(e===null)return!1;const t=U(e,r=>S(r)&&!r.isInline());return t===null?!1:!!J(t.getParent())&&(t.select(0),!0)}function d0(){const n=M();if(!E(n))return!1;const e=Ir(n.anchor.getNode());if(e===null)return!1;const t=me();if(!t.is(e.getParent())||t.getChildrenSize()!==1)return!1;const[r]=en(e,null,null);if(r.length===0||r[0].length===0)return!1;const o=r[0][0];if(!o||!o.cell)return!1;const i=r[r.length-1],s=i[i.length-1];if(!s||!s.cell)return!1;const l=Wl(e,o.cell,s.cell);return pe(l),!0}function h0(n){return n.registerNodeTransform(Tn,e=>{if(e.getColSpan()>1||e.getRowSpan()>1){const[,,t]=zt(e),[r]=Ft(t,e,e),o=r.length,i=r[0].length;let s=t.getFirstChild();xe(s)||H(175);const l=[];for(let c=0;c<o;c++){c!==0&&(s=s.getNextSibling(),xe(s)||H(175));let a=null;for(let u=0;u<i;u++){const f=r[c][u],d=f.cell;if(f.startRow===c&&f.startColumn===u)a=d,l.push(d);else if(d.getColSpan()>1||d.getRowSpan()>1){J(d)||H(176);const h=at(d.__headerState);a!==null?a.insertAfter(h):r_(s,h)}}}for(const c of l)c.setColSpan(1),c.setRowSpan(1)}})}function g0(n,e=!0){const t=new qx,r=(o,i,s)=>{const l=ln(o,s),c=Zx(o,l,n,e,t);t.observers.set(i,[c,l])};return qe(Qx(n,t),n.registerCommand(Pt,()=>e0(t,n),dt),n.registerMutationListener(Jn,o=>{n.read("latest",()=>{for(const[i,s]of o){const l=t.observers.get(i);if(s==="created"||s==="updated"){const{tableNode:c,tableElement:a}=vg(i);l===void 0?r(c,i,a):a!==l[1]&&(t.removeObserver(i),r(c,i,a))}else s==="destroyed"&&t.removeObserver(i)}})},{skipInitialization:!1}),()=>{t.removeAllObservers()})}function p0(n,e){n.hasNodes([Jn])||H(255);const{hasNestedTables:t=Po(!1)}=e??{};return qe(n.registerCommand(Px,r=>(function({rows:o,columns:i,includeHeaders:s},l){const c=M()||ct();if(!c||!E(c)||!l&&Ir(c.anchor.getNode()))return!1;const a=Lx(Number(o),Number(i),s);n_(a);const u=a.getFirstDescendant();return O(u)&&u.select(),!0})(r,t.peek()),X),n.registerCommand(Jf,(r,o)=>n===o&&(function(i,s){const{nodes:l,selection:c}=i;if(!l.some(f=>ge(f)||Ym(f).some(d=>ge(d.node)))){if(ye(c)){let f="",d=!1;for(const h of l){const g=S(h)&&!h.isInline();f.length>0&&(g||d)&&(f+=`
|
|
28
|
+
`),f+=h.getTextContent(),d=g}return c.insertRawText(f),!0}return!1}const a=ye(c),u=E(c);return u&&U(c.anchor.getNode(),f=>J(f))!==null&&U(c.focus.getNode(),f=>J(f))!==null||a?l.length===1&&ge(l[0])?bg(l[0],c):!(u&&s.peek()&&!(function(f){return!!(ye(f)&&!f.focus.getNode().is(f.anchor.getNode())||E(f)&&J(f.anchor.getNode())&&!f.anchor.getNode().is(f.focus.getNode()))})(c)):!1})(r,t),X),n.registerCommand(oc,d0,gt),n.registerCommand(Yi,f0,X),n.registerNodeTransform(Jn,u0),n.registerNodeTransform(Io,a0),n.registerNodeTransform(Tn,c0))}Oe.tag("table"),Oe.tag("tr"),Oe.tag("td","th");const m0=/^\|(.+)\|\s*$/,_0=n=>Jc(Ko,n).replace(/\n+/g," ").replace(/\|/g,"\\|").trim(),y0=n=>{const e=n.trim().replace(/^\|/,"").replace(/\|$/,""),t=[];let r="";for(let o=0;o<e.length;o++){const i=e[o];if(i==="\\"&&e[o+1]==="|"){r+="|",o++;continue}if(i==="|"){t.push(r),r="";continue}r+=i}return t.push(r),t},x0=n=>{const e=at(se.NO_STATUS);return Cg(n.trim(),Ko,e),e},mf=(n,e)=>{const t=Hn();for(let r=0;r<e;r++)t.append(x0(n[r]??""));return t},C0=n=>{const e=n.getFirstChild();return xe(e)?e.getChildrenSize():0},S0=n=>{const e=n.getFirstChild();if(xe(e))for(const t of e.getChildren())J(t)&&t.setHeaderStyles(se.ROW,se.ROW)},b0={dependencies:[Jn,Io,Tn],export:n=>{if(!ge(n))return null;const e=[];for(const t of n.getChildren()){if(!xe(t))continue;const r=t.getChildren().filter(J);r.length!==0&&(e.push(`| ${r.map(_0).join(" | ")} |`),e.length===1&&e.push(`| ${r.map(()=>"---").join(" | ")} |`))}return e.length===0?null:e.join(`
|
|
29
|
+
`)},regExp:m0,replace:(n,e,t)=>{const r=t[0].trimEnd(),o=n.getPreviousSibling();if(pg(r)){if(ge(o)){S0(o),n.remove();return}const l=e[0];O(l)&&l.setTextContent(r);return}const i=y0(r);if(ge(o)){o.append(mf(i,C0(o))),n.remove();return}const s=Lo();s.append(mf(i,i.length)),n.replace(s)},type:"element"},Ko=[b0,...Hc],Eg=R.createContext(null);function v0(n,e){return{getTheme:function(){return e??null}}}function st(){const n=R.useContext(Eg);return n==null&&(function(e,...t){const r=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const i of t)o.append("v",i);throw r.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(8),n}function _f(n,e){return n.read("latest",()=>{const t=te(e);return t!==null&&t.isSelected()})}function T0(n){const[e]=st(),[t,r]=R.useState(()=>_f(e,n));return R.useEffect(()=>{let o=!0;const i=e.registerUpdateListener(()=>{o&&r(_f(e,n))});return()=>{o=!1,i()}},[e,n]),[t,R.useCallback(o=>{e.update(()=>{let i=M();de(i)||(i=po(),pe(i)),de(i)&&(o?i.add(n):i.delete(n))})},[e,n]),R.useCallback(()=>{e.update(()=>{const o=M();de(o)&&o.clear()})},[e])]}function N0({nodeKey:n}){const[e]=st(),[t,r,o]=T0(n);return R.useEffect(()=>qe(e.registerCommand(Yi,i=>{const s=e.getElementByKey(n);return Ln(i)===s&&(i.shiftKey||o(),r(!t),!0)},gt)),[o,e,t,n,r]),R.useEffect(()=>{const i=e.getElementByKey(n),s=e._config.theme.hrSelected??"selected";i!==null&&(t?we(i,s):Wt(i,s))},[e,t,n]),null}let $g=class extends Fc{$config(){return this.config("horizontalrule",{importDOM:{hr:()=>({conversion:k0,priority:0})}})}decorate(){return P.jsx(N0,{nodeKey:this.__key})}};function k0(){return{node:w0()}}function w0(){return Ge(new $g)}const Og=[ms,ps,Gn,vn,xn,Bc,Jn,Io,Tn,gs,zc,$g],E0={code:"block my-2 rounded bg-surface-sunken p-2 font-mono text-xs whitespace-pre-wrap",heading:{h1:"mt-3 mb-1 text-xl font-semibold",h2:"mt-3 mb-1 text-lg font-semibold",h3:"mt-2 mb-1 text-base font-semibold",h4:"mt-2 mb-1 text-sm font-semibold",h5:"mt-2 mb-1 text-sm font-semibold",h6:"mt-2 mb-1 text-xs font-semibold uppercase tracking-wide"},hr:"my-3 border-t border-line",link:"text-accent underline",list:{listitem:"ml-2",nested:{listitem:"list-none"},ol:"my-1 list-decimal pl-6",ul:"my-1 list-disc pl-6"},paragraph:"my-1",quote:"my-1 border-l-2 border-fg-subtle/30 pl-3 text-fg-muted [&_p]:my-0.5",table:"my-2 w-full table-fixed border-collapse",tableCell:"border border-line px-2 py-1 align-top",tableCellHeader:"bg-surface-sunken font-semibold",text:{bold:"font-semibold",code:"rounded bg-surface-sunken px-1 font-mono text-xs",italic:"italic",strikethrough:"line-through",underline:"underline"}},qc=(n,e)=>{const t=new DOMParser().parseFromString(Jl(e),"text/html");return Uh(n,t)},$0=new Set(["root","paragraph","text","linebreak"]),O0=["bold","italic","strikethrough","underline","code","subscript","superscript","highlight"],A0=()=>{const n=new Set,e=t=>{const r=t.getType();if($0.has(r)||n.add(r),O(t))for(const o of O0)t.hasFormat(o)&&n.add(o);if(S(t))for(const o of t.getChildren())e(o)};return e(me()),[...n].sort()},M0=n=>({html:Jl(Lc(n,null)),text:Jc(Ko),formatting:A0()}),Ag=()=>uc({namespace:"compose-conversion",nodes:[...Og],onError:n=>{throw n}}),F0=n=>{const e=Ag();return e.update(()=>{const t=me();t.clear(),t.select(),ns(qc(e,n))},{discrete:!0}),e.read(()=>Jc(Ko))},D0=n=>{const e=Ag();return e.update(()=>{Cg(n,Ko)},{discrete:!0}),e.read(()=>Jl(Lc(e,null)))},R0="Nothing to paste. The copied content was an image, or had no text in it.",P0=(n,e)=>{const t=n.selectionStart??n.value.length,r=n.selectionEnd??t;return document.execCommand?.bind(document)?.("insertText",!1,e)?null:{value:n.value.slice(0,t)+e+n.value.slice(r),caret:t+e.length}},I0=({value:n,onChange:e,onSubmit:t,autoFocus:r=!1,placeholder:o="Write your message…",ariaLabel:i="Message body",trailing:s})=>{const l=R.useRef(null),c=R.useRef(null),a=R.useRef(!1),[u,f]=R.useState(!1);R.useLayoutEffect(()=>{const g=l.current;if(!g||(g.style.height="auto",g.style.height=`${g.scrollHeight}px`,g.value!==n))return;const m=c.current;m!==null&&(c.current=null,g.setSelectionRange(m,m))},[n]),R.useEffect(()=>{if(!r)return;const g=l.current;if(!g)return;const m=setTimeout(()=>{g.focus();const p=g.value.length;g.setSelectionRange(p,p)},0);return()=>clearTimeout(m)},[r]);const d=g=>{(g.metaKey||g.ctrlKey)&&g.key.toLowerCase()==="v"&&(a.current=g.shiftKey),t&&(!(g.metaKey||g.ctrlKey)||g.key!=="Enter"||(g.preventDefault(),t()))},h=g=>{const m=g.clipboardData;if(!m)return;const p=g.currentTarget;g.preventDefault();const _=a.current;a.current=!1;const y=m.getData("text/plain"),x=_?"":m.getData("text/html"),C=(x?F0(x):"")||y;if(C===""){f(!0);return}f(!1);const T=P0(p,C);T&&(c.current=T.caret,e(T.value))};return P.jsxs("div",{className:"flex shrink-0 grow flex-col",children:[P.jsx("div",{className:"sticky top-0 z-10 border-b border-line bg-canvas",children:P.jsxs("div",{className:"flex items-center gap-2 px-3 py-1",children:[P.jsx("span",{className:"min-w-0 truncate py-2 text-xs text-fg-muted",children:"Plain text · Markdown"}),s&&P.jsx("div",{className:"ml-auto shrink-0",children:s})]})}),u&&P.jsx(Pg,{tone:"info",variant:"soft",onDismiss:()=>f(!1),className:"mx-3 mt-2",children:R0}),P.jsx("textarea",{ref:l,value:n,onChange:g=>e(g.target.value),onKeyDown:d,onPaste:h,"aria-label":i,placeholder:o,"data-testid":"compose-body-plain",wrap:"off",spellCheck:!0,className:"w-full shrink-0 grow resize-none overflow-x-auto whitespace-pre bg-canvas px-3 py-2 font-mono text-base text-fg outline-none placeholder:text-fg-subtle"})]})},L0=Ve?R.useLayoutEffect:R.useEffect,ti={tag:mr};function K0({initialConfig:n,children:e}){const t=R.useMemo(()=>{const{theme:r,namespace:o,nodes:i,onError:s,onWarn:l,editorState:c,html:a}=n,u=v0(null,r),f=uc({editable:n.editable,html:a,namespace:o,nodes:i,onError:d=>s(d,f),...l?{onWarn:d=>l(d,f)}:{},theme:r});return(function(d,h){if(h!==null){if(h===void 0)d.update(()=>{const g=me();if(g.isEmpty()){const m=V();g.append(m);const p=d.getRootElement(),_=Ve&&p!==null?xo(p):null;(M()!==null||_!==null&&_===p)&&m.select()}},ti);else if(h!==null)switch(typeof h){case"string":{const g=d.parseEditorState(h);d.setEditorState(g,ti);break}case"object":d.setEditorState(h,ti);break;case"function":d.update(()=>{me().isEmpty()&&h(d)},ti)}}})(f,c),[f,u]},[]);return L0(()=>{const r=n.editable,[o]=t;o.setEditable(r===void 0||r)},[]),P.jsx(Eg.Provider,{value:t,children:e})}function z0(){return me().getTextContent()}function B0(n,e=!0){if(n)return!1;let t=z0();return e&&(t=t.trim()),t===""}function W0(n){if(!B0(n,!1))return!1;const e=me().getChildren(),t=e.length;if(t>1)return!1;for(let r=0;r<t;r++){const o=e[r];if(G(o))return!1;if(S(o)){if(!Jt(o)||o.__indent!==0)return!1;const i=o.getChildren(),s=i.length;for(let l=0;l<s;l++){const c=i[r];if(!O(c))return!1}}}return!0}function Mg(n){return()=>W0(n)}const Fg=Ve?R.useLayoutEffect:R.useEffect;function j0({editor:n,ariaActiveDescendant:e,ariaAutoComplete:t,ariaControls:r,ariaDescribedBy:o,ariaErrorMessage:i,ariaExpanded:s,ariaInvalid:l,ariaLabel:c,ariaLabelledBy:a,ariaMultiline:u,ariaOwns:f,ariaRequired:d,autoCapitalize:h,className:g,id:m,role:p="textbox",spellCheck:_=!0,style:y,tabIndex:x,"data-testid":C,...T},b){const[N,v]=R.useState(n.isEditable()),w=R.useCallback(k=>{k&&k.ownerDocument&&k.ownerDocument.defaultView?n.setRootElement(k):n.setRootElement(null)},[n]),A=R.useMemo(()=>(function(...k){return F=>{for(const L of k)typeof L=="function"?L(F):L!=null&&(L.current=F)}})(b,w),[w,b]);return Fg(()=>(v(n.isEditable()),n.registerEditableListener(k=>{v(k)})),[n]),P.jsx("div",{"aria-activedescendant":N?e:void 0,"aria-autocomplete":N?t:"none","aria-controls":N?r:void 0,"aria-describedby":o,...i!=null?{"aria-errormessage":i}:{},"aria-expanded":N&&p==="combobox"?!!s:void 0,...l!=null?{"aria-invalid":l}:{},"aria-label":c,"aria-labelledby":a,"aria-multiline":u,"aria-owns":N?f:void 0,"aria-readonly":!N||void 0,"aria-required":d,autoCapitalize:h,className:g,contentEditable:N,"data-testid":C,id:m,ref:A,role:p,spellCheck:_,style:y,tabIndex:x??(N?void 0:-1),...T})}const U0=R.forwardRef(j0);function yf(n){return n.read("latest",Mg(n.isComposing()))}const H0=R.forwardRef(J0);function J0(n,e){const{placeholder:t,...r}=n,[o]=st();return P.jsxs(P.Fragment,{children:[P.jsx(U0,{editor:o,...r,ref:e}),t!=null&&P.jsx(q0,{editor:o,content:t})]})}function q0({content:n,editor:e}){const t=(function(s){const[l,c]=R.useState(()=>yf(s));return Fg(()=>{function a(){const u=yf(s);c(u)}return a(),qe(s.registerUpdateListener(()=>{a()}),s.registerEditableListener(()=>{a()}))},[s]),l})(e),[r,o]=R.useState(e.isEditable());if(R.useLayoutEffect(()=>(o(e.isEditable()),e.registerEditableListener(s=>{o(s)})),[e]),!t)return null;let i=null;return typeof n=="function"?i=n(r):n!==null&&(i=n),i===null?null:P.jsx("div",{"aria-hidden":!0,children:i})}class V0 extends R.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){this.props.onError(e instanceof Error?e:new Error(String(e),{cause:e}),t)}render(){return this.state.hasError?this.props.fallback:this.props.children}}function Y0({children:n,fallback:e,onError:t}){return P.jsx(V0,{fallback:e===void 0?P.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}):e,onError:t,children:n})}function X0(n,e,t,r,o){if(n===null||t.size===0&&r.size===0&&!o)return 0;const i=e._selection,s=n._selection;if(o)return 1;if(!(E(i)&&E(s)&&s.isCollapsed()&&i.isCollapsed()))return 0;const l=(function(_,y,x){const C=_._nodeMap,T=[];for(const b of y){const N=C.get(b);N!==void 0&&T.push(N)}for(const[b,N]of x){if(!N)continue;const v=C.get(b);v===void 0||Ee(v)||T.push(v)}return T})(e,t,r);if(l.length===0)return 0;if(l.length>1){const _=e._nodeMap,y=_.get(i.anchor.key),x=_.get(s.anchor.key);return y&&x&&!n._nodeMap.has(y.__key)&&O(y)&&y.__text.length===1&&i.anchor.offset===1?2:0}const c=l[0],a=n._nodeMap.get(c.__key);if(!O(a)||!O(c)||a.__mode!==c.__mode)return 0;const u=a.__text,f=c.__text;if(u===f)return 0;const d=i.anchor,h=s.anchor;if(d.key!==h.key||d.type!=="text")return 0;const g=d.offset,m=h.offset,p=f.length-u.length;return p===1&&m===g-1?2:p===-1&&m===g+1?3:p===-1&&m===g?4:0}function G0(n,e,t){let r=t(),o=0,i=r,s=0,l=null;return(c,a,u,f,d,h)=>{const g=t();if(h.has(gd)&&(i=r,s=o,l=c),h.has(cl))return o=0,r=g,2;h.has(bi)&&l&&(r=i,o=s,c=l);const m=h.has(dd)||h.has(hd)?0:X0(c,a,f,d,n.isComposing()),p=(()=>{const _=u===null||u.editor===n,y=h.has(Pp);if(!y&&_&&h.has(mr))return 0;if(m===1)return 2;if(c===null)return 1;const x=a._selection;if(!(f.size>0||d.size>0))return x!==null?0:2;const C=typeof e=="number"?e:e.peek();return y===!1&&m!==0&&m===o&&g<r+C&&_||f.size===1&&(function(T,b,N){const v=b._nodeMap.get(T),w=N._nodeMap.get(T),A=b._selection,k=N._selection;return!(E(A)&&E(k)&&A.anchor.type==="element"&&A.focus.type==="element"&&k.anchor.type==="text"&&k.focus.type==="text"||!O(v)||!O(w)||v.__parent!==w.__parent)&&JSON.stringify(b.read(()=>v.exportJSON()))===JSON.stringify(N.read(()=>w.exportJSON()))})(Array.from(f)[0],c,a)?0:1})();return r=g,o=m,p}}function xf(n,e){n.undoStack=[],n.redoStack=[],n.current=null}function Q0(n,e,t,r=Date.now,o,i=null){const s=G0(n,t,r);return qe(n.registerCommand(Xi,()=>((function(l,c,a){const u=c.redoStack,f=c.undoStack;if(f.length!==0){const d=c.current,h=f.pop();d!==null&&(u.push(d),l.dispatchCommand(Gr,!0)),f.length===0&&l.dispatchCommand(Qr,!1),c.current=h||null,h&&h.editor.setEditorState(h.editorState,{tag:cl})}})(n,e),!0),X),n.registerCommand(Gi,()=>((function(l,c,a){const u=c.redoStack,f=c.undoStack;if(u.length!==0){const d=c.current;d!==null&&(f.push(d),l.dispatchCommand(Qr,!0));const h=u.pop();u.length===0&&l.dispatchCommand(Gr,!1),c.current=h||null,h&&h.editor.setEditorState(h.editorState,{tag:cl})}})(n,e),!0),X),n.registerCommand(Tp,()=>(xf(e),!1),X),n.registerCommand(Np,()=>(xf(e),n.dispatchCommand(Gr,!1),n.dispatchCommand(Qr,!1),!0),X),n.registerUpdateListener(({editorState:l,prevEditorState:c,dirtyLeaves:a,dirtyElements:u,tags:f})=>{const d=e.current,h=e.redoStack,g=e.undoStack,m=d===null?null:d.editorState;if(d!==null&&l===m)return;const p=s(c,l,d,a,u,f);if(p===1){if(h.length!==0&&(e.redoStack=[],n.dispatchCommand(Gr,!1)),d!==null){g.push({...d});const _=typeof i=="number"||i===null?i:i.peek();_!==null&&g.length>_&&g.splice(0,g.length-_),n.dispatchCommand(Qr,!0)}}else if(p===2)return;e.current={editor:n,editorState:l}}))}function Z0(){return{current:null,redoStack:[],undoStack:[]}}function eC({delay:n,externalHistoryState:e}){const[t]=st();return(function(r,o,i=1e3){const s=R.useMemo(()=>o||Z0(),[o]);R.useEffect(()=>Q0(r,s,i),[i,r,s])})(t,e,n),null}function tC({validateUrl:n,attributes:e}){const[t]=st();return R.useEffect(()=>{if(!t.hasNodes([xn]))throw new Error("LinkPlugin: LinkNode not registered on editor")}),R.useEffect(()=>Sy(t,l_({attributes:e,validateUrl:n})),[t,n,e]),null}function nC({hasStrictIndent:n=!1,shouldPreserveNumbering:e=!1}){const[t]=st();return R.useEffect(()=>{if(!t.hasNodes([Gn,vn]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[t]),R.useEffect(()=>qe(Pu(t,{restoreNumbering:e}),n?Dy(t):()=>{}),[t,n,e]),(function(r){R.useEffect(()=>Pu(r),[r])})(t),null}const rC=Ve?R.useLayoutEffect:R.useEffect;function oC(n){return{initialValueFn:()=>n.isEditable(),subscribe:e=>n.registerEditableListener(e)}}function iC(){return(function(n){const[e]=st(),t=R.useMemo(()=>n(e),[e,n]),[r,o]=R.useState(()=>t.initialValueFn()),i=R.useRef(r);return rC(()=>{const{initialValueFn:s,subscribe:l}=t,c=s();return i.current!==c&&(i.current=c,o(c)),l(a=>{i.current=a,o(a)})},[t,n]),r})(oC)}const sC={name:"@lexical/react/ReactProvider"};function lC(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of e)r.append("v",o);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Vc=Ve?R.useLayoutEffect:R.useEffect;function cC({editor:n,ErrorBoundary:e}){return(function(t,r){const[o,i]=R.useState(()=>t.getDecorators());return Vc(()=>t.registerDecoratorListener(s=>{Yc.flushSync(()=>{i(s)})}),[t]),R.useEffect(()=>{i(t.getDecorators())},[t]),R.useMemo(()=>{const s=[],l=Object.keys(o);for(let c=0;c<l.length;c++){const a=l[c],u=P.jsx(r,{onError:d=>t._onError(d),children:P.jsx(R.Suspense,{fallback:null,children:o[a]})}),f=t.getElementByKey(a);f!==null&&s.push(Yc.createPortal(u,f,a))}return s},[r,o,t])})(n,e)}function aC({editor:n,ErrorBoundary:e}){return(function(t){const r=$h.maybeFromEditor(t);if(r&&r.hasExtensionByName(sC.name)){for(const o of["@lexical/plain-text","@lexical/rich-text"])r.hasExtensionByName(o)&&lC(320,o);return!0}return!1})(n)?null:P.jsx(cC,{editor:n,ErrorBoundary:e})}function Cf(n){return n.read("latest",Mg(n.isComposing()))}function uC({contentEditable:n,placeholder:e=null,ErrorBoundary:t}){const[r]=st();return(function(o){Vc(()=>qe(rx(o),Gy(o)),[o])})(r),P.jsxs(P.Fragment,{children:[n,P.jsx(fC,{content:e}),P.jsx(aC,{editor:r,ErrorBoundary:t})]})}function fC({content:n}){const[e]=st(),t=(function(o){const[i,s]=R.useState(()=>Cf(o));return Vc(()=>{function l(){const c=Cf(o);s(c)}return l(),qe(o.registerUpdateListener(()=>{l()}),o.registerEditableListener(()=>{l()}))},[o]),i})(e),r=iC();return t?typeof n=="function"?n(r):n:null}function dC({hasCellMerge:n=!0,hasCellBackgroundColor:e=!0,hasTabHandler:t=!0,hasHorizontalScroll:r=!1,hasNestedTables:o=!1}){const[i]=st();R.useEffect(()=>{qi(i)!==r&&(i0(i,r),i.update($d))},[i,r]);const s=(function(l){const[c]=R.useState(()=>Po(l));return c.peek()!==l&&(c.value=l),c})(o);return R.useEffect(()=>p0(i,{hasNestedTables:s}),[i,s]),R.useEffect(()=>g0(i,t),[i,t]),R.useEffect(()=>{if(!n)return h0(i)},[i,n]),R.useEffect(()=>{if(!e)return i.registerNodeTransform(Tn,l=>{l.getBackgroundColor()!==null&&l.setBackgroundColor(null)})},[i,e,n]),null}const lr=({isActive:n,onClick:e,children:t,title:r})=>P.jsx("button",{type:"button",onMouseDown:o=>{o.preventDefault(),e()},title:r,"aria-label":r,"aria-pressed":n,className:`inline-flex min-h-11 min-w-11 shrink-0 items-center justify-center rounded transition-colors ${n?"text-fg bg-accent-2-soft":"text-fg-muted hover:text-fg hover:bg-surface-raised"}`,children:t}),hC={bold:!1,italic:!1,quote:!1,link:null,canUndo:!1,canRedo:!1},gC=({trailing:n})=>{const[e]=st(),[t,r]=R.useState(hC),[o,i]=R.useState(null),s=R.useRef(null),l=R.useCallback(()=>{const u=M();if(!E(u))return;const f=u.anchor.getNode(),d=U(f,Qe),h=U(f,ji);r(g=>({...g,bold:u.hasFormat("bold"),italic:u.hasFormat("italic"),quote:h!==null,link:Qe(d)?d.getURL():null}))},[]);R.useEffect(()=>qe(e.registerUpdateListener(({editorState:u})=>{u.read(l)}),e.registerCommand(Pt,()=>(l(),!1),gt),e.registerCommand(Qr,u=>(r(f=>({...f,canUndo:u})),!1),gt),e.registerCommand(Gr,u=>(r(f=>({...f,canRedo:u})),!1),gt)),[e,l]),R.useEffect(()=>{o!==null&&s.current?.focus()},[o]);const c=()=>{e.update(()=>{const u=M();E(u)&&Jm(u,()=>t.quote?V():jr())})},a=u=>{const f=u.trim();e.dispatchCommand(Nl,f===""?null:f),i(null),e.focus()};return P.jsxs("div",{className:"sticky top-0 z-10 border-b border-line bg-canvas",children:[P.jsxs("div",{className:"flex items-center gap-2 px-3 py-1",children:[P.jsxs("div",{"data-testid":"compose-format-cluster",className:"flex min-w-0 items-center gap-0.5 overflow-x-auto",children:[P.jsx(lr,{isActive:t.bold,onClick:()=>e.dispatchCommand(kt,"bold"),title:"Bold (Ctrl+B)",children:P.jsx(zg,{className:"size-4"})}),P.jsx(lr,{isActive:t.italic,onClick:()=>e.dispatchCommand(kt,"italic"),title:"Italic (Ctrl+I)",children:P.jsx(Bg,{className:"size-4"})}),P.jsx(lr,{isActive:t.link!==null,onClick:()=>i(t.link??"https://"),title:"Link (Ctrl+K)",children:P.jsx(Wg,{className:"size-4"})}),P.jsx(lr,{isActive:t.quote,onClick:c,title:"Blockquote",children:P.jsx(jg,{className:"size-4"})}),P.jsx("div",{className:"mx-1.5 h-4 w-px shrink-0 bg-line"}),P.jsx(lr,{isActive:!1,onClick:()=>e.dispatchCommand(Xi,void 0),title:"Undo (Ctrl+Z)",children:P.jsx(Ig,{className:`size-4 ${t.canUndo?"":"opacity-40"}`})}),P.jsx(lr,{isActive:!1,onClick:()=>e.dispatchCommand(Gi,void 0),title:"Redo (Ctrl+Y)",children:P.jsx(Ug,{className:`size-4 ${t.canRedo?"":"opacity-40"}`})})]}),n&&P.jsx("div",{className:"ml-auto shrink-0",children:n})]}),o!==null&&P.jsxs("div",{className:"flex items-center gap-2 border-t border-line px-3 py-1.5",children:[P.jsx("input",{ref:s,type:"url",value:o,"aria-label":"Link address",placeholder:"https://example.com",className:"min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-subtle",onChange:u=>i(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),a(o)),u.key==="Escape"&&(u.preventDefault(),i(null),e.focus())}}),P.jsx("button",{type:"button",className:"text-xs text-accent hover:underline",onClick:()=>a(o),children:"Apply"}),t.link!==null&&P.jsx("button",{type:"button",className:"text-xs text-fg-muted hover:text-fg",onClick:()=>a(""),children:"Remove"})]})]})},pC=()=>{const[n]=st(),e=R.useRef(!1);return R.useEffect(()=>qe(n.registerCommand(Xl,t=>((t.metaKey||t.ctrlKey)&&t.key.toLowerCase()==="v"&&(e.current=t.shiftKey),!1),gt),n.registerCommand(Lr,t=>{if(!(t instanceof ClipboardEvent))return!1;const r=t.clipboardData;if(!r)return!1;const o=e.current;if(e.current=!1,o){const s=M();return E(s)?(t.preventDefault(),s.insertRawText(r.getData("text/plain")),!0):!1}const i=r.getData("text/html");return i?(t.preventDefault(),ns(qc(n,i)),!0):!1},Id)),[n]),null},mC=({onChange:n})=>{const[e]=st(),t=R.useRef(n);return R.useEffect(()=>{t.current=n},[n]),R.useEffect(()=>{const r=()=>t.current(e.read(()=>M0(e)));return r(),e.registerUpdateListener(({dirtyElements:o,dirtyLeaves:i})=>{o.size===0&&i.size===0||r()})},[e]),null},_C=({enabled:n})=>{const[e]=st();return R.useEffect(()=>{if(!n)return;const t=setTimeout(()=>e.focus(),0);return()=>clearTimeout(t)},[e,n]),null},yC=n=>e=>{const t=qc(e,n);t.length!==0&&(me().select(),ns(t))},xC=({initialHtml:n,onChange:e,onSubmit:t,autoFocus:r=!1,placeholder:o="Write your message…",ariaLabel:i="Message body",trailing:s})=>P.jsxs(K0,{initialConfig:{namespace:"compose",nodes:Og,theme:E0,editorState:n?yC(n):void 0,onError:l=>{throw l}},children:[P.jsxs("div",{className:"flex shrink-0 grow flex-col",children:[P.jsx(gC,{trailing:s}),P.jsx("div",{className:"relative flex shrink-0 grow flex-col",children:P.jsx(uC,{contentEditable:P.jsx(H0,{"aria-label":i,"aria-placeholder":o,"data-testid":"compose-body",className:"min-h-[120px] w-full shrink-0 grow bg-canvas px-3 py-2 text-sm text-fg outline-none",placeholder:P.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 px-3 py-2 text-sm text-fg-subtle",children:o}),onKeyDown:l=>{t&&(!(l.metaKey||l.ctrlKey)||l.key!=="Enter"||(l.preventDefault(),t()))}}),ErrorBoundary:Y0})})]}),P.jsx(eC,{}),P.jsx(nC,{}),P.jsx(tC,{}),P.jsx(dC,{}),P.jsx(pC,{}),P.jsx(_C,{enabled:r}),e&&P.jsx(mC,{onChange:e})]}),CC={toPlain:n=>n.text,toRich:n=>D0(n)},Sf=n=>new DOMParser().parseFromString(n,"text/html").body.textContent??"",bf=n=>({html:"",text:n,formatting:[]}),XC=({mode:n,onModeChange:e,initialHtml:t,initialText:r,onChange:o,onSubmit:i,autoFocus:s=!1,onConversionError:l,conversions:c=CC})=>{const[a,u]=R.useState(t),[f,d]=R.useState(0),[h,g]=R.useState(r),[m,p]=R.useState(!1),[_,y]=R.useState(!1),x=R.useRef({html:t,text:r,formatting:[]}),C=A=>{x.current=A,o(A)},T=A=>{g(A),o(bf(A))},b=()=>{const A=x.current,k=c.toPlain(A),F=Xc("plain",Sf(A.html),k);if(F.outcome==="blocked"){l(F);return}g(k),y(!0),o(bf(k)),e("plain")},N=()=>{const A=c.toRich(h),k=Xc("rich",h,Sf(A));if(k.outcome==="blocked"){l(k);return}u(A),d(F=>F+1),y(!0),e("rich")},v=()=>{if(n==="plain"){N();return}if(Lg("plain",x.current.formatting)){p(!0);return}b()},w=P.jsx(Hg,{mode:n,onToggle:v});return P.jsxs(P.Fragment,{children:[n==="plain"?P.jsx(I0,{value:h,onChange:T,onSubmit:i,autoFocus:_,trailing:w}):P.jsx(xC,{initialHtml:a,onChange:C,onSubmit:i,autoFocus:s||_,trailing:w},f),P.jsx(Kg,{isOpen:m,title:"Switch to plain text?",description:"Formatting becomes Markdown. Bold keeps its asterisks, a table becomes rows of pipes, and that text is what the recipient gets. No formatted version is sent alongside it.",confirmLabel:"Switch to plain text",onConfirm:()=>{p(!1),b()},onCancel:()=>p(!1)})]})};export{XC as ComposeBody,CC as DEFAULT_COMPOSE_CONVERSIONS};
|