dorkos 0.76.0 → 0.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +6675 -2982
- package/dist/client/assets/{AboutPage-BoqHP_rW.js → AboutPage-WmtNTKyp.js} +1 -1
- package/dist/client/assets/{AppearancePage-B95H8Nxj.js → AppearancePage-D7ZHuThu.js} +1 -1
- package/dist/client/assets/BaseTanStackRouterDevtoolsPanel-B-iktbLX-wUJCR3vL.js +539 -0
- package/dist/client/assets/{BlintzCanvas-CRXCmtua.js → BlintzCanvas-BXKUjnNQ.js} +82 -82
- package/dist/client/assets/{CanvasCsvContent-pdVBTYKX.js → CanvasCsvContent-BLAtnhdQ.js} +1 -1
- package/dist/client/assets/{CanvasFileContent-Cl03ayCc.js → CanvasFileContent-VogEwZeM.js} +2 -2
- package/dist/client/assets/{CanvasModel3dContent-C3g0j2bn.js → CanvasModel3dContent-DCTC7eOc.js} +2 -2
- package/dist/client/assets/{CodeMirrorDiff-BQLLfs4g.js → CodeMirrorDiff-Cpi43Atp.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-BSvvxSHw.js → CodeMirrorEditor-CviERH82.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-aPcsWZg1.js → ConnectionAccessLists-Be1b30nn.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-BvzkayxV.js → ConnectionsPage-BVN7GiuC.js} +1 -1
- package/dist/client/assets/{ConventionPage-Y7bDPPze.js → ConventionPage-Coim_h2z.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CNROBv9F-wx_-3fZ2.js → FloatingTanStackRouterDevtools-CqogiFob-lqp1rgj8.js} +1 -1
- package/dist/client/assets/HandlePage-DnzPN8N_.js +1 -0
- package/dist/client/assets/LexicalField-DPe-aAXb.js +24 -0
- package/dist/client/assets/{ManagesPage--n7TgT9l.js → ManagesPage-BZS2TdZL.js} +1 -1
- package/dist/client/assets/{Model3dViewer-uKAbOmCS.js → Model3dViewer-qs0tZlVU.js} +1 -1
- package/dist/client/assets/NamePage-DyWqRDIe.js +1 -0
- package/dist/client/assets/{NotificationsPage-DB4qTW3T.js → NotificationsPage-gmiItsT0.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-DT20V6CQ.js → PersonalityPopover-Dej6dI7y.js} +1 -1
- package/dist/client/assets/PhotoPage-GtCoB8dK.js +1 -0
- package/dist/client/assets/{RoomsPage-DEEUnf0J.js → RoomsPage-3_HuXajd.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-D2pucfeO.js → RunsOnPopover-DbSoBFaL.js} +1 -1
- package/dist/client/assets/{SessionsPage-DBPX5adt.js → SessionsPage-Dc_lqBom.js} +2 -2
- package/dist/client/assets/{SkillsPage-C9HXskYL.js → SkillsPage-C0qMUkgs.js} +1 -1
- package/dist/client/assets/{TasksPage-Dqf9owXs.js → TasksPage-DvzTPDnw.js} +1 -1
- package/dist/client/assets/{ToolsPage-DaoSMDQU.js → ToolsPage-Cwc96TTa.js} +2 -2
- package/dist/client/assets/{TopologyGraph-DF6kFfjI.js → TopologyGraph-C-BTnRXU.js} +2 -2
- package/dist/client/assets/{agent-browser-BuaZOCOm.js → agent-browser-DT3ABR4l.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-B1wBbLs7.js → highlighted-body-KPVGNVTW-CVFODbIg.js} +1 -1
- package/dist/client/assets/{index--Uyc_XG6.js → index-B3P6TTvD.js} +9 -9
- package/dist/client/assets/{index-C3EW9tRL.js → index-B8oHvyN5.js} +1 -1
- package/dist/client/assets/{index-CN4hFvoG.js → index-BUxNND2H.js} +1 -1
- package/dist/client/assets/{index-DwUKcf_k.js → index-BZaMgVdg.js} +1 -1
- package/dist/client/assets/{index-WVQrRVpj.js → index-BrgOWbRQ.js} +2 -2
- package/dist/client/assets/{index-BMsvIr1C.js → index-BuU7EEtP.js} +1 -1
- package/dist/client/assets/{index-D3g04gH1.js → index-ByCzVYkU.js} +1 -1
- package/dist/client/assets/index-C08DUVQ4.css +1 -0
- package/dist/client/assets/{index-2HT5vouX.js → index-CGqPFWQw.js} +1 -1
- package/dist/client/assets/{index-BHQYCx1L.js → index-CN1plkKF.js} +1 -1
- package/dist/client/assets/{index-BvT0F_8s.js → index-CXWMnEDK.js} +1 -1
- package/dist/client/assets/{index-CpCRZ8P5.js → index-CaZw0EC7.js} +1 -1
- package/dist/client/assets/{index-BNTWz-au.js → index-Cca_q1vW.js} +1 -1
- package/dist/client/assets/{index-CShzpSy7.js → index-CgakJfik.js} +1 -1
- package/dist/client/assets/{index-BIs_UKpi.js → index-ClmokM0M.js} +1 -1
- package/dist/client/assets/{index-BeBR9uSg.js → index-ClnyhFUL.js} +1 -1
- package/dist/client/assets/index-DDXrdlj0.js +1648 -0
- package/dist/client/assets/{index-B_p4CrFG.js → index-DEA1uIWn.js} +1 -1
- package/dist/client/assets/{index-B2Ye-nkG.js → index-DF5k9E7k.js} +1 -1
- package/dist/client/assets/{index-DEAVZK-q.js → index-DGr90Ygi.js} +1 -1
- package/dist/client/assets/{index-CwYrgtmx.js → index-DIkpB_1y.js} +1 -1
- package/dist/client/assets/{index-do5L767D.js → index-DN8DYUEX.js} +1 -1
- package/dist/client/assets/{index-MMjhiA-J.js → index-D_gnDrw3.js} +1 -1
- package/dist/client/assets/{index-IErk5ecA.js → index-DbsvSNI-.js} +1 -1
- package/dist/client/assets/{index-D2XIUtpU.js → index-DgjZhEr3.js} +1 -1
- package/dist/client/assets/{index-BvU5XdA6.js → index-Dh-3NGE9.js} +1 -1
- package/dist/client/assets/{index-VeV-4NUe.js → index-DiFG9bwF.js} +1 -1
- package/dist/client/assets/{index-BImpyKDK.js → index-DiFc1nSZ.js} +1 -1
- package/dist/client/assets/{index-DRYYCdpC.js → index-DjY4p5H5.js} +1 -1
- package/dist/client/assets/{index-DumYh9rX.js → index-Dm6W0lml.js} +1 -1
- package/dist/client/assets/{index-B6jQgG8Q.js → index-J8BMKg6y.js} +1 -1
- package/dist/client/assets/{index-C7Uur-_Y.js → index-PRwgIfzy.js} +3 -3
- package/dist/client/assets/{index-Bxcqjip5.js → index-PrqHZbD1.js} +1 -1
- package/dist/client/assets/{index-DD2mSWO0.js → index-W25uMuZA.js} +1 -1
- package/dist/client/assets/{index-DaFsjYfq.js → index-kzr7_3di.js} +1 -1
- package/dist/client/assets/{index-ByjBP7eT.js → index-lciid4H8.js} +1 -1
- package/dist/client/assets/{index-CA4kPvkQ.js → index-nEQI8fB2.js} +1 -1
- package/dist/client/assets/{room-files-source-BrzosNI0.js → room-files-source-CSKgcbkn.js} +2 -2
- package/dist/client/assets/{soul-file-CMitSV0e.js → soul-file-BHeAw6R9.js} +1 -1
- package/dist/client/assets/{use-mesh-update-MH2NsGx-.js → use-mesh-update-BP_UXq60.js} +1 -1
- package/dist/client/assets/{use-personality-commit-BHO7hV2D.js → use-personality-commit-DyJAMzzb.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/index.js +32600 -31382
- package/dist/server/index.js.map +2 -2
- package/package.json +7 -5
- package/dist/client/assets/BaseTanStackRouterDevtoolsPanel-fP2H3uLR-DivgCeAN.js +0 -539
- package/dist/client/assets/HandlePage-BeHlZs_e.js +0 -1
- package/dist/client/assets/LexicalField-B3z9B3Jc.js +0 -24
- package/dist/client/assets/NamePage-Bh6_6TMn.js +0 -1
- package/dist/client/assets/PhotoPage-B3qZqkg9.js +0 -1
- package/dist/client/assets/index-Cg0bm_ag.js +0 -1636
- package/dist/client/assets/index-D9FWq0Sm.css +0 -1
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var Vd=Object.defineProperty;var qd=(n,e,t)=>e in n?Vd(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var b=(n,e,t)=>qd(n,typeof e!="symbol"?e+"":e,t);import{r as B,j as ct,gl as Gd,gm as Yd,gn as Xd,g9 as Qd,go as Zd}from"./index-Cg0bm_ag.js";function O(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 ja(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 Mt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,th=Mt&&"documentMode"in document?document.documentMode:null,Bn=Mt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ve=Mt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Kn=!(!Mt||!("InputEvent"in window)||th)&&"getTargetRanges"in new window.InputEvent("input"),be=Mt&&!window.MSStream&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&navigator.maxTouchPoints>1),Ha=Mt&&/Android/.test(navigator.userAgent),Ir=Mt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Ha,Ja=Mt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),vo=Mt&&Ha&&Ja,Lr=Mt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Bn&&!Ja,eh=0,nh=1,rh=2,Va=128,oh=1,ih=2,sh=3,lh=4,ch=5,ah=6,yr=Ir||be||Lr?" ":"",Xe=`
|
|
2
|
-
|
|
3
|
-
`,Es=ve?" ":yr,Te={bold:1,capitalize:1024,code:16,highlight:Va,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},uh={directionless:1,unmergeable:2},bo={center:2,end:6,justify:4,left:1,right:3,start:5},fh={[ih]:"center",[ah]:"end",[lh]:"justify",[oh]:"left",[sh]:"right",[ch]:"start"},dh={normal:0,segmented:2,token:1},hh={[eh]:"normal",[rh]:"segmented",[nh]:"token"},qa=Symbol.for("@lexical/ctrlOrOtherKey"),_l="$config";function mi(){return gt()._blockCursorElement}function _i(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-slot")}const gh=Lr||be||Ir;function yl(){const n=it().createElement("img");n.setAttribute("data-lexical-decorator-boundary","true"),n.alt="";for(const[e,t]of[["position","absolute"],["width","0px"],["height","0px"],["border","0px"],["margin","0px"],["padding","0px"]])n.style.setProperty(e,t,"important");return n}function To(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-decorator-boundary")}let Ga=class co{constructor(e,t,r){b(this,"element");b(this,"before");b(this,"after");this.element=e,this.before=t||null,this.after=r||null}withBefore(e){return new co(this.element,e,this.after)}withAfter(e){return new co(this.element,this.before,e)}withElement(e){return this.element===e?this:new co(e,this.before,this.after)}insertChild(e){const t=this.getInsertionAnchor();return t!==null&&t.parentElement!==this.element&&O(357),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&O(358),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&O(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=xl(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=xl(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 xl(n,e){let t=e;for(;t!==null&&t.parentNode!==n;)t=t.parentNode;return t}let Ya=class ao extends Ga{withBefore(e){return new ao(this.element,e,this.after)}withAfter(e){return new ao(this.element,this.before,e)}withElement(e){return this.element===e?this:new ao(e,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()||this.getDecoratorBoundaryAnchor("trailing")}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;_i(t);)e=t,t=t.nextSibling;To(t)&&(e=t,t=t.nextSibling);const r=e?e.nextSibling:this.element.firstChild;return r!==null&&r===mi()?r:e}getDecoratorBoundaryAnchor(e){let t;if(e==="leading"){const r=super.getFirstChildAnchor();for(t=r?r.nextSibling:this.element.firstChild;_i(t);)t=t.nextSibling}else t=this.before?this.before.previousSibling:this.element.lastChild,t!==null&&t===mi()&&(t=t.previousSibling);return To(t)?t:null}setDecoratorBoundaryAnchor(e,t){const r=this.getDecoratorBoundaryAnchor(e);if(t!==(r!==null))if(r!==null)this.element.removeChild(r);else if(e==="leading"){const o=this.getFirstChildAnchor();this.element.insertBefore(yl(),o?o.nextSibling:this.element.firstChild)}else this.element.insertBefore(yl(),this.before)}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){const t=this.element,r=this.after===null?t.firstChild:this.after.nextSibling,o=e==="empty"&&_i(r)?null:e;if(t.__lexicalLastChildKind!==o)if(t.__lexicalLastChildKind=o,o===null)this.removeManagedLineBreak();else{const i=o==="decorator"&&gh;this.insertManagedLineBreak(i)}}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||this.getDecoratorBoundaryAnchor("trailing"),i=it().createElement("br");if(i.setAttribute("data-lexical-managed-linebreak","true"),r.insertBefore(i,o),e){const s=it().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=mi(),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=Sl(t,r);i.push(o);const s=Sl(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 Sl(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&&O(225),t.reverse()}let Xa;try{Xa="0.50.0+prod.esm"}catch{}const Qa=Xa??'"<unknown>+source"';let nr=class{constructor(){b(this,"_front",new Set);b(this,"_back",new Set);b(this,"_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 He=null;function Za(n,e=1e3){return n instanceof Bi?n.clone():n.size<e?new Map(n):new Bi().init(new Map(n),void 0,n.size)}let Bi=class tu{constructor(){b(this,"_mutable",!1);b(this,"_old");b(this,"_nursery");b(this,"_size",0)}clone(){return this._mutable=!1,new tu().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===He?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!==He?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!==He&&r!==void 0||(this._size++,r===He&&o.delete(e)),o.set(e,t),this}delete(e){const t=this.has(e);return t&&(this.getNursery().set(e,He),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!==He&&(i!==void 0&&(r[1]=i),yield r)}if(e)for(const r of e)r[1]===He||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 ko(n,e,t,r,o,i){if(C(n)){let s=n.getFirstChild();for(;s!==null;){const l=s.__key;s.__parent===e&&((C(s)||Ze(s)&&s.__slots!==null)&&ko(s,l,t,r,o,i),t.has(l)||i.delete(l),o.push(l)),s=s.getNextSibling()}}for(const s of Ze(n)&&n.__slots!==null?n.__slots.values():[]){const l=r.get(s);l!==void 0&&un(l)&&l.__slotHost===e&&((C(l)||Ze(l)&&l.__slots!==null)&&ko(l,s,t,r,o,i),t.has(s)||i.delete(s),o.push(s))}}let Ki=!1,ws=0;function ph(n){ws=n.timeStamp}function yi(n,e,t){const r=n.nodeName==="BR",o=e.__lexicalLineBreak;return o&&(n===o||r&&n.previousSibling===o)||r&&Qn(n,t)!==void 0}function mh(n,e,t){const r=Lt(Kt(t)),o=r&&Bt(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&&Gs(e,l,i,s,!1)}function _h(n,e,t){if(w(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return de(e)&&t.isAttached()}function yh(n,e,t){for(let r=n;r&&!Mf(r);r=_n(r)){const o=Qn(r,e);if(o!==void 0){const i=rt(o,t);if(i)return H(i)||!q(r)?void 0:[r,i]}}}function eu(n,e,t){Ki=!0;const r=performance.now()-ws>100;try{Gt(n,()=>{const o=D()||(function(f){return f.read("latest",()=>{const d=D();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,_=yh(g,n,s);if(!_)continue;const[m,p]=_;if(h==="characterData")r&&$(p)&&de(g)&&_h(o,g,p)&&mh(g,p,n);else if(h==="childList"){c=!0;const y=d.addedNodes;for(let v=0;v<y.length;v++){const T=y[v],N=_f(T),k=T.parentNode;if(!(k==null||T===l||N!==null||yi(T,k,n)||To(T)||n._slotsUsed&&q(T)&&T.hasAttribute("data-lexical-slot")||Mf(T))){if(ve){const E=(q(T)?T.innerText:null)||T.nodeValue;E&&(a+=E)}k.removeChild(T)}}const x=d.removedNodes,S=x.length;if(S>0){let v=0;for(let T=0;T<S;T++){const N=x[T];yi(N,g,n)||l===N?(g.appendChild(N),v++):To(N)&&v++}S!==v&&i.set(m,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 _=0;_<h.length;_++){const m=h[_],p=m.parentNode;p==null||m.nodeName!=="BR"||yi(m,g,n)||p.removeChild(m)}}t.takeRecords()}o!==null&&(c&&Ct(o),ve&&bf(n)&&o.insertRawText(a))})}finally{Ki=!1}}function nu(n){const e=n._observer;e!==null&&eu(n,e.takeRecords(),e)}function ru(n){(function(e){ws===0&&Kt(e).addEventListener("textInput",ph,!0)})(n),n._observer=new MutationObserver((e,t)=>{eu(n,e,t)})}const Cl="latest";let xh=class{constructor(e,t){b(this,"key");b(this,"parse");b(this,"unparse");b(this,"isEqual");b(this,"defaultValue");b(this,"resetOnCopyNode");this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||vh).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function qn(n,e){return new xh(n,e)}function xr(n,e,t=Cl){const r=(t===Cl?n.getLatest():n).__state;return r?r.getValue(e):e.defaultValue}function Rr(n,e,t){let r;if(xt(),typeof t=="function"){const i=n.getLatest(),s=xr(i,e);if(r=t(s),e.isEqual(s,r))return i}else r=t;const o=n.getWritable();return iu(o).updateFromKnown(e,r),o}function Sh(n){const e=new Map,t=new Set;for(const{ownNodeConfig:r}of el(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 vl=new Set(["__proto__","constructor","prototype"]);let Ch=class ou{constructor(e,t,r=void 0,o=new Map,i=void 0){b(this,"node");b(this,"knownState");b(this,"unknownState");b(this,"sharedNodeState");b(this,"size");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 bl(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 ou(e,t,(function(i,s,l){let c;if(l)for(const[a,u]of Object.entries(l)){if(vl.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=bl(i)),this.size++),o.set(e,t)}updateFromUnknown(e,t){if(vl.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 iu(n){const e=n.getWritable(),t=e.__state?e.__state.getWritable(e):new Ch(e,su(e));return e.__state=t,t}function su(n){return n.__state?n.__state.sharedNodeState:gf(gt(),n.getType()).sharedNodeState}function bl(n){if(n)for(const e in n)return n}function vh(n){return n}function Tl(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 kl(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 Nl(n,e){const t=n.__state;return t&&t.node===n?t.getWritable(e):t}function El(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&&Tl(d,u,f)||f&&Tl(d,f,u)||u&&kl(d,u,f)||f&&kl(d,f,u))})(c,a))}function wl(n,e){const t=n.mergeWithSibling(e),r=G()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function Ol(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&$(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(El(e,r)){r=wl(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&$(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(El(r,t)){r=wl(r,t);break}break}t.remove()}}else r.remove()}function Os(n){return $l(n.anchor),$l(n.focus),n}function $l(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,o;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),o=!0):(r=e.getChildAtIndex(t),o=!1),$(r)){n.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!C(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}const Sr=Symbol.for("@lexical/CachedTextSize");function Ml(n,e){return Wi.read(()=>{let t=0,r=n;for(let o=0;o<e&&r!==null;o++){const i=te.get(r);if(i===void 0&&O(345,r),C(i)){const s=lt.get(r);if(s!==void 0&&C(s)&&s.__parent!==i.__parent)t+=i.getTextContentSize();else{const l=en.get(r),c=l&&l.__lexicalTextContent;typeof c!="string"&&O(346,i.getType()),t+=c.length}o<e-1&&!i.isInline()&&(t+=2)}else{const s=i[Sr];s===void 0&&O(347,i.getType(),r),t+=s}r=i.__next}return t},{editor:V})}function lu(n){C(n)||n[Sr]===void 0&&(n[Sr]=$(n)?n.__text.length:n.getTextContentSize())}const bh=4;let Cr,V,vr,j="",ht=null,wt=null,Nt=null;function se(){return{firstTextKey:Nt,format:ht,style:wt}}function Jt(n){n.firstTextKey!==null&&(ht=n.format,wt=n.style,Nt=n.firstTextKey)}function zi(n){if(Nt!==null)return;const e=n.__lexicalFirstTextKey;if(e===void 0&&O(348),e===null)return;const t=lt.get(e);$(t)&&(ht=t.getFormat(),wt=t.getStyle(),Nt=e)}let ei,fr,dr,te,Wi,lt,en,Ui,br,nn,ye=!1,No=!1;function Pe(n,e){const t=te.get(n),r=lt.has(n);if(e!==null){const o=qi(n);o.parentNode===e&&e.removeChild(o)}if(!r){if(V._keyToDOMMap.delete(n),C(t)){const o=qo(t,te);ji(o,0,o.length-1,null)}if(t!==void 0){for(const o of Vt(t).values()){const i=Ji(o);Pe(o,null),i!==null&&i.remove()}Ys(br,vr,ei,t,"destroyed")}}}function ji(n,e,t,r){for(let o=e;o<=t;++o){const i=n[o];i!==void 0&&Pe(i,r)}}function Je(n,e){n.setProperty("text-align",e)}const Th="40px";function cu(n,e){const t=Cr.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, ${Th}))`),$r(n,"class"),$r(n,"style")}function au(n,e){const t=n.style;e===0?Je(t,""):e===1?Je(t,"left"):e===2?Je(t,"center"):e===3?Je(t,"right"):e===4?Je(t,"justify"):e===5?Je(t,"start"):e===6&&Je(t,"end"),$r(n,"style")}function Hi(n,e){const t=(function(r){const o=r.__dir;if(o!==null)return o;if(ut(r))return null;const i=r.getParent();return i===null||Z(i)&&i.__dir===null?"auto":null})(e);t!==null?n.dir=t:n.removeAttribute("dir")}function uu(n){const e=it().createElement("div");return e.setAttribute("data-lexical-slot",n),e.style.display="none",e}function fu(n,e,t){e||n.contentEditable==="false"?qg(t,V):t.removeAttribute("contenteditable")}function Al(n,e,t){const r=j,o=se();j="";let i="";const s=H(n);for(const[l,c]of t){const a=uu(l);fu(e,s,a),e.appendChild(a),j="";const u=se();Fe(c,Wt(n,a,V)),Jt(u),du(n,l,e,a),i+=j}return Jt(o),j=r,i}function Vt(n){return Ze(n)&&n.__slots!==null?n.__slots:Pf}function du(n,e,t,r){const o=nn.$getSlotTargetElement(n,e,t,V);o!==null&&(r.parentElement!==o&&o.appendChild(r),r.style.display="")}function Ji(n){const e=en.get(n);return e!==void 0?e.parentElement:null}function Dl(n,e,t){const r=Vt(n),o=Vt(e);for(const[u,f]of r)if(!o.has(u)){const d=Ji(f);Pe(f,null),d!==null&&d.remove()}const i=j,s=se();let l="",c=null;const a=H(e);for(const[u,f]of o){const d=r.get(u);let h=d!==void 0?Ji(d):null;j="";const g=se();if(h===null){h=uu(u);let _=null;for(const m of t.children)if(!m.hasAttribute("data-lexical-slot")){_=m;break}t.insertBefore(h,_),Fe(f,Wt(e,h,V))}else d===f?_e(f,h):(d!==void 0&&Pe(d,h),Fe(f,Wt(e,h,V)));if(Jt(g),fu(t,a,h),du(e,u,t,h),l+=j,h.parentElement===t){const _=c===null?t.firstChild:c.nextSibling;_!==h&&t.insertBefore(h,_),c=h}}return Jt(s),j=i,l}function Fe(n,e){const t=lt.get(n);if(t===void 0&&O(60),e!==null){const o=te.get(n);if(o!==void 0){const i=en.get(n);if(i!==void 0){const s=un(o)?o.__slotHost:null,l=un(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),_e(n,e.element)}}}const r=nn.$createDOM(t,V);if((function(o,i,s){const l=s._keyToDOMMap;yf(i,s,o),l.set(o,i)})(n,r,V),$(t)?r.setAttribute("data-lexical-text","true"):H(t)&&(r.setAttribute("data-lexical-decorator","true"),Vg(r,{captureSelection:!0})),C(t)){const o=t.__indent,i=t.__size;Hi(r,t),o!==0&&cu(r,o);const s=Vt(t),l=s.size>0?Al(t,r,s):"";if(i===0)r.__lexicalTextContent=l,r.__lexicalFirstTextKey=null,j+=l,s.size>0&&(r.__lexicalSlotTextLength=l.length);else{const a=j,u=i-1;if(Vi(qo(t,lt),t,0,u,Wt(t,r,V)),l!==""){const f=r.__lexicalTextContent||"";r.__lexicalTextContent=l+f,j=a+l+f}s.size>0&&(r.__lexicalSlotTextLength=l.length)}const c=t.__format;c!==0&&au(r,c),t.isInline()||(gu(null,t,r),hu(t,r))}else{const o=t.getTextContent();if(H(t)){const i=t.decorate(V,Cr);i!==null&&pu(n,i),r.contentEditable="false";const s=Vt(t);s.size>0&&Al(t,r,s)}j+=o}return e!==null&&e.insertChild(r),nn.$decorateDOM(t,null,r,V),lu(t),Ys(br,vr,ei,t,"created"),r}function Vi(n,e,t,r,o){const i=j,s=se();j="",ht=null,wt=null,Nt=null;let l=t;for(;l<=r;++l){const a=se();Fe(n[l],o);const u=lt.get(n[l]);u!==null&&$(u)?ht===null&&(ht=u.getFormat(),wt=u.getStyle(),Nt=u.__key):C(u)&&l<r&&!u.isInline()&&(j+=Xe),Jt(a)}const c=V._keyToDOMMap.get(e.__key);c===void 0&&O(349,e.__key),c.__lexicalTextContent=j,c.__lexicalFirstTextKey=Nt,j=i+j,Jt(s)}function Pl(n,e){if(!n)return!1;const t=e.get(n);return H(t)&&!t.isInline()}function hu(n,e){const t=Wt(n,e,V);t.setDecoratorBoundaryAnchor("leading",Pl(n.__first,lt)),t.setDecoratorBoundaryAnchor("trailing",Pl(n.__last,lt))}function gu(n,e,t){const r=Wt(e,t,V),o=(function(i,s){if(i){const l=i.__last;if(l){const c=s.get(l);if(c)return Tt(c)?"line-break":H(c)&&c.isInline()?"decorator":null}return"empty"}return null})(e,lt);r.setManagedLineBreak(o)}function kh(n,e,t){var r;ht=null,wt=null,Nt=null,(function(o,i,s){const l=j,c=o.__size,a=i.__size;j="";const u=s.element,f=V._keyToDOMMap.get(i.__key);f===void 0&&O(351,i.__key);const d=a-c;if(!ye&&Math.abs(d)<=1&&c>=bh&&o.__first===i.__first&&(d!==0||!V._cloneNotNeeded.has(o.__key))){const h=f.__lexicalTextContent,g=Ui.get(o.__key);if(!ye&&typeof h=="string"&&g!==void 0){const _=(function(m,p){const y=p.size;if(y===0||y>=m.__size)return null;let x=m.__last,S=null,v=0;for(;x!==null&&v<y;){if(!p.has(x))return null;S=x;const T=lt.get(x);if(T===void 0)return null;x=T.__prev,v++}return v!==y||x!==null&&p.has(x)?null:S})(i,g);if(_!==null){const m=g.size;if(d===0){const p=Ml(_,m);let y=_,x=0;for(;y!==null&&x<m;){const k=lt.get(y);if(k===void 0)break;const E=se();_e(y,u),$(k)&&ht===null&&(ht=k.getFormat(),wt=k.getStyle(),Nt=k.__key),Jt(E),y=k.__next,x++}let S="";for(y=_,x=0;y!==null&&x<m;){const k=lt.get(y);if(k===void 0)break;let E;if(C(k)){const M=V._keyToDOMMap.get(y),A=M&&M.__lexicalTextContent;typeof A!="string"&&O(352,k.getType()),E=A}else E=k.getTextContent();S+=E,x<m-1&&C(k)&&!k.isInline()&&(S+=Xe),y=k.__next,x++}const v=f.__lexicalSlotTextLength||0,T=v>0?h.slice(v):h,N=T.slice(0,T.length-p)+S;return f.__lexicalTextContent=N,j=l+N,void Fl(i,f,g)}if((function(p,y,x,S,v,T,N,k){if(k!==1&&k!==-1||N!==(k===1?2:1))return!1;const M=N-k;let A=p.__last;for(let st=0;st<M-1;st++){if(A===null)return!1;const mt=te.get(A);if(mt===void 0)return!1;A=mt.__prev}if(A===null)return!1;const P=lt.get(T),L=te.get(A);if(P===void 0||L===void 0||P.__prev!==L.__prev)return!1;const K=[];let U=T;for(let st=0;st<N;st++){if(U===null)return!1;K.push(U);const mt=lt.get(U);U=mt?mt.__next:null}const Q=[];U=A;for(let st=0;st<M;st++){if(U===null)return!1;Q.push(U);const mt=te.get(U);U=mt?mt.__next:null}const J=new Set(Q),kt=new Set(K),nt=[];let ft=0,dt=0;for(;ft<M&&dt<N;)if(K[dt]===Q[ft])nt.push({key:K[dt],kind:"reconcile"}),ft++,dt++;else if(kt.has(Q[ft])){if(J.has(K[dt]))return!1;nt.push({key:K[dt],kind:"create",nextIndex:dt}),dt++}else nt.push({key:Q[ft],kind:"destroy"}),ft++;for(;ft<M;)nt.push({key:Q[ft++],kind:"destroy"});for(;dt<N;)nt.push({key:K[dt],kind:"create",nextIndex:dt}),dt++;const he=Ml(A,M);for(const st of nt){const mt=se();if(st.kind==="reconcile")_e(st.key,x.element);else if(st.kind==="destroy")Pe(st.key,x.element);else{let Ht=null;for(let xn=st.nextIndex+1;xn<N;xn++){const er=V._keyToDOMMap.get(K[xn]);if(er!==void 0){Ht=er;break}}Fe(st.key,x.withBefore(Ht??x.before))}if(st.kind!=="destroy"){const Ht=lt.get(st.key);Ht&&$(Ht)&&ht===null&&(ht=Ht.getFormat(),wt=Ht.getStyle(),Nt=Ht.__key)}Jt(mt)}let jt="";for(let st=0;st<N;st++){const mt=lt.get(K[st]);if(mt===void 0)return!1;let Ht;if(C(mt)){const xn=V._keyToDOMMap.get(K[st]),er=xn&&xn.__lexicalTextContent;typeof er!="string"&&O(350,mt.getType()),Ht=er}else Ht=mt.getTextContent();jt+=Ht,st<N-1&&C(mt)&&!mt.isInline()&&(jt+=Xe)}const Ee=S.__lexicalSlotTextLength||0,tr=Ee>0?v.slice(Ee):v;return S.__lexicalTextContent=tr.slice(0,tr.length-he)+jt,!0})(o,0,s,f,h,_,m,d)){const p=f.__lexicalTextContent;return typeof p!="string"&&O(353),j=l+p,void Fl(i,f,g)}}}if(d===0){let _=o.__first,m=0;for(;_!==null;){const p=lt.get(_);if(p===void 0)break;const y=ye||dr.has(_)||fr.has(_),x=se();if(y)_e(_,u);else{let S,v;if(C(p)){v=en.get(_);const T=v&&v.__lexicalTextContent;typeof T!="string"&&O(354,p.getType()),S=T}else S=p.getTextContent();j+=S,v!==void 0&&zi(v)}$(p)?ht===null&&(ht=p.getFormat(),wt=p.getStyle(),Nt=p.__key):C(p)&&m<a-1&&!p.isInline()&&(j+=Xe),Jt(x),_=p.__next,m++}return f.__lexicalTextContent=j,f.__lexicalFirstTextKey=Nt,void(j=l+j)}}if(c===1&&a===1){const h=o.__first,g=i.__first;if(h===g)_e(h,u);else{const m=qi(h),p=Fe(g,null);try{m.parentNode===u?u.replaceChild(p,m):s.insertChild(p)}catch(y){if(typeof y=="object"&&y!=null){const x=`${y.toString()} Parent: ${u.tagName}, new child: {tag: ${p.tagName} key: ${g}}, old child: {tag: ${m.tagName}, key: ${h}}.`;throw new Error(x)}throw y}Pe(h,null)}const _=lt.get(g);$(_)&&ht===null&&(ht=_.getFormat(),wt=_.getStyle(),Nt=_.__key)}else{const h=qo(o,te),g=qo(i,lt);if(h.length!==c&&O(227),g.length!==a&&O(228),c===0)a!==0&&Vi(g,i,0,a-1,s);else if(a===0){if(c!==0){const _=s.after==null&&s.before==null&&Vt(i).size===0&&s.element.__lexicalLineBreak==null;ji(h,0,c-1,_?null:u),_&&(u.textContent="")}}else(function(_,m,p,y,x,S){const v=y-1,T=x-1;let N,k,E=S.getFirstChild(),M=0,A=0;for(;M<=v&&A<=T;){const K=m[M],U=p[A],Q=se();if(K===U)E=xi(_e(U,S.element)),M++,A++;else{if(k===void 0&&(k=Il(p,A)),N===void 0)N=Il(m,M);else if(!N.has(K)){M++,Jt(Q);continue}if(!k.has(K)){E=xi(qi(K)),Pe(K,S.element),M++,N.delete(K),Jt(Q);continue}if(N.has(U)){const kt=Wn(V,U);kt!==E&&S.withBefore(E??S.before).insertChild(kt),E=xi(_e(U,S.element)),M++,A++}else Fe(U,S.withBefore(E??S.before)),A++}const J=lt.get(U);J!==null&&$(J)?ht===null&&(ht=J.getFormat(),wt=J.getStyle(),Nt=J.__key):C(J)&&A<=T&&!J.isInline()&&(j+=Xe),Jt(Q)}const P=M>v,L=A>T;if(P&&!L){const K=p[T+1],U=K===void 0?null:V.getElementByKey(K);Vi(p,_,A,T,S.withBefore(U??S.before))}else L&&!P&&ji(m,M,v,S.element)})(i,h,g,c,a,s)}f.__lexicalTextContent=j,f.__lexicalFirstTextKey=Nt,j=l+j})(n,e,Wt(e,t,V)),Z(e)||(r=e,ht==null||ht===r.__textFormat||No||r.setTextFormat(ht),(function(o){wt==null||wt===o.__textStyle||No||o.setTextStyle(wt)})(e))}function Fl(n,e,t){const r=e.__lexicalFirstTextKey;if(r!=null){const o=n.__key;let i=r;for(;i!==null;){const s=lt.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=lt.get(r);if($(s))return ht=s.getFormat(),void(wt=s.getStyle())}}e.__lexicalFirstTextKey=Nt}function _e(n,e){const t=te.get(n);let r=lt.get(n);t!==void 0&&r!==void 0||O(61);const o=ye||dr.has(n)||fr.has(n),i=Wn(V,n);if(t===r&&!o){let s;if(C(t)){const l=i.__lexicalTextContent;typeof l!="string"&&O(355,t.getType()),s=l,zi(i)}else s=t.getTextContent();return j+=s,i}if(t!==r&&o&&Ys(br,vr,ei,r,"updated"),nn.$updateDOM(r,t,i,V)){const s=Fe(n,null);return e===null&&O(62),e.replaceChild(s,i),Pe(n,null),s}if(C(t)){C(r)||O(334,n);const s=r.__indent;(ye||s!==t.__indent)&&cu(i,s);const l=r.__format;(ye||l!==t.__format)&&au(i,l);const c=o&&(Vt(r).size>0||Vt(t).size>0)?Dl(t,r,i):"";if(o){const a=j;if(kh(t,r,i),r.isInline()||(ut(r)||gu(0,r,i),hu(r,i)),c!==""){const u=i.__lexicalTextContent||"";i.__lexicalTextContent=c+u,j=a+c+u,i.__lexicalSlotTextLength=c.length}else(Vt(r).size>0||Vt(t).size>0)&&(i.__lexicalSlotTextLength=0)}else{const a=i.__lexicalTextContent;typeof a!="string"&&O(356,t.getType()),j+=a,zi(i)}if((ye||r.__dir!==t.__dir||r.__parent!==t.__parent)&&(Hi(i,r),ut(r)&&!ye))for(const a of r.getChildren())C(a)&&Hi(Wn(V,a.getKey()),a)}else{const s=r.getTextContent();if(H(r)){const l=r.decorate(V,Cr);l!==null&&pu(n,l),o&&(Vt(r).size>0||Vt(t).size>0)&&Dl(t,r,i)}j+=s}if(!No&&ut(r)){const s=r.getLatest();if(s.__cachedText!==j){const l=s.getWritable();l.__cachedText=j,r=l}}return nn.$decorateDOM(r,t,i,V),lu(r),i}function pu(n,e){let t=V._pendingDecorators;const r=V._decorators;if(t===null){if(r[n]===e)return;t=xf(V)}t[n]=e}function xi(n){let e=n.nextSibling;return e!==null&&e===V._blockCursorElement&&(e=e.nextSibling),e}function Il(n,e){const t=new Set;for(let r=e;r<n.length;r++)t.add(n[r]);return t}function Nh(n,e,t,r,o,i){j="",ht=null,wt=null,Nt=null,ye=r===2,V=t,Cr=t._config,nn=t._config.dom||zo,vr=t._nodes,ei=V._listeners.mutation,fr=o,dr=i,te=n._nodeMap,Wi=n,lt=e._nodeMap,No=e._readOnly,en=Za(t._keyToDOMMap),Ui=(function(){const l=new Map,c=a=>{for(const u of a){const f=lt.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(fr.keys()),c(dr),l})();const s=new Map;return br=s,_e("root",null),V=void 0,vr=void 0,fr=void 0,dr=void 0,te=void 0,Wi=void 0,lt=void 0,Cr=void 0,en=void 0,Ui=void 0,br=void 0,nn=zo,s}function qi(n){const e=en.get(n);return e===void 0&&O(75,n),e}function F(n){return{type:n}}const mu=F("SELECTION_CHANGE_COMMAND"),Eh=F("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),_u=F("CLICK_COMMAND"),yu=F("BEFORE_INPUT_COMMAND"),xu=F("INPUT_COMMAND"),Su=F("COMPOSITION_START_COMMAND"),Cu=F("COMPOSITION_END_COMMAND"),Qe=F("DELETE_CHARACTER_COMMAND"),On=F("INSERT_LINE_BREAK_COMMAND"),Tr=F("INSERT_PARAGRAPH_COMMAND"),$n=F("CONTROLLED_TEXT_INSERTION_COMMAND"),ni=F("PASTE_COMMAND"),uo=F("REMOVE_TEXT_COMMAND"),kr=F("DELETE_WORD_COMMAND"),Mn=F("DELETE_LINE_COMMAND"),$e=F("FORMAT_TEXT_COMMAND"),wh=F("SET_TEXT_FORMAT_COMMAND"),Eo=F("UNDO_COMMAND"),Nr=F("REDO_COMMAND"),vu=F("KEYDOWN_COMMAND"),bu=F("KEY_ARROW_RIGHT_COMMAND"),Gi=F("MOVE_TO_END"),Tu=F("KEY_ARROW_LEFT_COMMAND"),Yi=F("MOVE_TO_START"),$s=F("KEY_ARROW_UP_COMMAND"),Ms=F("KEY_ARROW_DOWN_COMMAND"),Br=F("KEY_ENTER_COMMAND"),ku=F("KEY_SPACE_COMMAND"),As=F("KEY_BACKSPACE_COMMAND"),Ds=F("KEY_ESCAPE_COMMAND"),Nu=F("KEY_DELETE_COMMAND"),Ps=F("KEY_TAB_COMMAND"),Oh=F("INSERT_TAB_COMMAND"),$h=F("INDENT_CONTENT_COMMAND"),Ll=F("OUTDENT_CONTENT_COMMAND"),Fs=F("DROP_COMMAND"),Mh=F("FORMAT_ELEMENT_COMMAND"),Eu=F("DRAGSTART_COMMAND"),Is=F("DRAGOVER_COMMAND"),Ah=F("DRAGEND_COMMAND"),ri=F("COPY_COMMAND"),Ls=F("CUT_COMMAND"),wu=F("SELECT_ALL_COMMAND"),Dh=F("CLEAR_EDITOR_COMMAND"),Ph=F("CLEAR_HISTORY_COMMAND"),Vr=F("CAN_REDO_COMMAND"),qr=F("CAN_UNDO_COMMAND"),Fh=F("FOCUS_COMMAND"),Ih=F("BLUR_COMMAND"),Lh=F("KEY_MODIFIER_COMMAND"),Ve={[qa]:"metaKey",ctrlKey:!Bn,metaKey:Bn},Rl={[qa]:"altKey",altKey:Bn,ctrlKey:!Bn},Bl=[["altKey",1],["ctrlKey",2],["metaKey",4],["shiftKey",8]];function Si(n,e,t){const r=n.get(e);r?r.push(t):n.set(e,[t])}class Rh{constructor(){b(this,"byKey",new Map);b(this,"byCode",new Map)}add(e){const{key:t,modifiers:r={}}=e;t.length>0||O(399);const o=t.toLowerCase();for(const i of(function(s){let l=[0];for(const[c,a]of Bl){const u=s[c]||!1;u==="any"?l=l.concat(l.map(f=>f|a)):u&&(l=l.map(f=>f|a))}return l})(r))Si(this.byKey,`${i}:${o}`,e),t.length===1&&(/[0-9]/.test(t)?Si(this.byCode,`${i}:Digit${t}`,e):/[a-z]/.test(o)&&Si(this.byCode,`${i}:Key${o.toUpperCase()}`,e));return this}matches(e){const t=e.key;if(!t)return[];const r=(function(s){let l=0;for(const[c,a]of Bl)s[c]&&(l|=a);return l})(e),o=this.byKey.get(`${r}:${t.toLowerCase()}`),i=o?o.slice():[];if(this.byCode.size>0&&!(t.length===1&&t.charCodeAt(0)<=127)){const s=this.byCode.get(`${r}:${e.code}`);s&&i.push(...s)}return i}match(e){return this.matches(e)[0]}}function Bh(n){const e=new Rh;for(const t of n)e.add(t);return e}function Kh(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 zh(n,e,t,r){return n.addEventListener(e,t,r),n.removeEventListener.bind(n,e,t,r)}const ge=Object.freeze({}),Xi=[["keydown",function(n,e){const t=e._inputState;t.lastKeyDownTimeStamp=n.timeStamp,t.lastKeyCode=n.key,n.key!=="Backspace"&&Er(t),!e.isComposing()&&R(e,vu,n)}],["pointerdown",function(n,e){const t=wf(n),r=n.pointerType;Zn(t)&&r!=="touch"&&r!=="pen"&&n.button===0&&Gt(e,()=>{Vo(t,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(n,e){R(e,Su,n)}],["compositionend",function(n,e){const t=e._inputState;ve?t.compositionPhase="ending-firefox":be||!Ir&&!Lr?R(e,Cu,n):(t.compositionPhase="ending-safari",t.compositionEndData=n.data)}],["input",function(n,e){n.stopPropagation();const t=e._inputState;Er(t),Gt(e,()=>{Au(n,e)||e.dispatchCommand(xu,n)},{event:n}),t.unprocessedBeforeInputData=null}],["click",function(n,e){Gt(e,()=>{const t=D(),r=Lt(Kt(e)),o=Gn();if(r){if(w(t)){const i=t.anchor,s=i.getNode();i.type==="element"&&i.offset===0&&t.isCollapsed()&&!ut(s)&&Y().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=Bt(r,e._rootElement).anchorNode;(q(i)||de(i))&&Ct(Po(o,r,e,n))}}if(ve&&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(q(u)){const f=u.getBoundingClientRect();if(s<=(f.top+f.bottom)/2){l=a;break}}}r.setBaseAndExtent(i,l,i,l);const c=Po(o,r,e,n);c!==null?Ct(c):r.removeAllRanges()}}R(e,_u,n)})}],["cut",ge],["copy",ge],["dragstart",ge],["dragover",ge],["dragend",ge],["paste",ge],["focus",ge],["blur",ge],["drop",ge]];Kn&&Xi.push(["beforeinput",(n,e)=>(function(t,r){const o=t.inputType;o==="deleteCompositionText"||ve&&bf(r)||o!=="insertCompositionText"&&Gt(r,()=>{Au(t,r)||R(r,yu,t)},{event:t})})(n,e)]);const Qi=new WeakMap,wo=new WeakMap,Wh=Kh(n=>(n.addEventListener("selectionchange",Jl),()=>n.removeEventListener("selectionchange",Jl)));function Ou(n,e,t,r,o,i){const s=n.anchor,l=n.focus,c=s.getNode(),a=G();let u;if(i!==void 0)u=i;else{const _=Lt(Kt(a));u=_!==null?Bt(_,a._rootElement):null}const f=u!==null?u.anchorNode:null,d=s.key,h=a.getElementByKey(d),g=t.length;return d!==l.key||!$(c)||(!o&&(!Kn||a._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||c.isDirty()&&g<2||Sf(t))&&s.offset!==l.offset&&!c.isComposing()||Yt(c)||c.isDirty()&&g>1||(o||!Kn)&&h!==null&&!c.isComposing()&&f!==Ie(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){if(m.isSegmented())return!0;if(!_.isCollapsed())return!1;const p=_.anchor.offset,y=m.getParentOrThrow(),x=Wo(m);return p===0?!m.canInsertTextBefore()||!y.canInsertTextBefore()&&!m.isComposing()||x||(function(S){const v=S.getPreviousSibling();return($(v)||C(v)&&v.isInline())&&!v.canInsertTextAfter()})(m):p===m.getTextContentSize()&&(!m.canInsertTextAfter()||!y.canInsertTextAfter()&&!m.isComposing()||x)})(n,c)}function Kl(n,e){return de(n)&&n.nodeValue!==null&&e!==0&&e!==n.nodeValue.length}function zl(n,e,t){const{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=Bt(n,e._rootElement),l=e._inputState;if(l.isSelectionChangeFromDOMUpdate){l.isSelectionChangeFromDOMUpdate=!1;const c=l.selectionChangeFromDOMUpdatePoints;if(l.selectionChangeFromDOMUpdatePoints=null,Kl(r,o)&&Kl(i,s)&&!l.postDeleteSelectionToRestore&&(c===null||c.anchorNode===r&&c.anchorOffset===o&&c.focusNode===i&&c.focusOffset===s))return}Gt(e,()=>{if(!t)return void Ct(null);if(!Ur(e,r,i))return;let c=D();if(l.postDeleteSelectionToRestore&&w(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(),Ct(c))}if(l.postDeleteSelectionToRestore=null,w(c)){const a=c.anchor,u=a.getNode();if(c.isCollapsed()){n.type==="Range"&&r===i&&(c.dirty=!0);const f=Kt(e).event,d=f?f.timeStamp:performance.now(),{format:h,style:g,offset:_,key:m,timeStamp:p}=l.collapsedSelectionFormat,y=Y(),x=e.isComposing()===!1&&y.getTextContent()==="";if(d<p+200&&a.offset===_&&a.key===m)fo(c,h,g);else if(a.type==="text")$(u)||O(141),$u(c,u);else if(a.type==="element"&&!x){C(u)||O(259);const S=a.getNode();S.isEmpty()?(function(v,T){const N=T.getTextFormat(),k=T.getTextStyle();fo(v,N,k)})(c,S):fo(c,c.format,"")}}else{const f=a.key,d=c.focus.key,h=c.getNodes(),g=h.length,_=c.isBackward(),m=_?s:o,p=_?o:s,y=_?d:f,x=_?f:d;let S=2047,v=!1;for(let T=0;T<g;T++){const N=h[T],k=N.getTextContentSize();if($(N)&&k!==0&&!(T===0&&N.__key===y&&m===k||T===g-1&&N.__key===x&&p===0)&&(v=!0,S&=N.getFormat(),S===0))break}c.format=v?S:0}}R(e,mu)})}function fo(n,e,t){n.format===e&&n.style===t||(n.format=e,n.style=t,n.dirty=!0)}function $u(n,e){fo(n,e.getFormat(),e.getStyle())}function Mu(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function Wl(n){const{lastKeyCode:e}=G()._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=D();if(!w(r)||!r.isCollapsed())return;const o=r.anchor.getNode();if(!$(o))return;const{offset:i}=r.anchor;if(o.getTextContentSize()===i){const s=o.getNextSibling();if(t===`
|
|
5
|
-
`){if(be)return;if(Tt(s))s.selectEnd();else if(!s){const l=St(o,Do),c=l&&l.getNextSibling();C(c)&&c.selectStart()}}else t===" "?rn(s)&&s.selectEnd():$(s)&&s.getTextContent()[0]===t&&s.select(1,1)}else o.getTextContent()[i]===t&&o.select(i+1,i+1)}function Er(n){n.isInsertTextAfterHandledSelectionCommand=!1,n.handledSelectionCommandTimeoutId!==null&&(clearTimeout(n.handledSelectionCommandTimeoutId),n.handledSelectionCommandTimeoutId=null)}function Ul(n){Er(n),n.isInsertTextAfterHandledSelectionCommand=!0,n.handledSelectionCommandTimeoutId=setTimeout(()=>Er(n),0)}function Au(n,e){const t=wf(n);if(q(t)&&Vo(t,e))return!0;const r=e.getRootElement();if(r===null)return!1;const o=jn(r.ownerDocument);return o!==null&&r.contains(o)&&Vo(o,e)}function Uh(n){const e=n.inputType,t=Mu(n),r=G(),o=r._inputState,i=D();if(e==="insertText"&&n.data&&o.isInsertTextAfterHandledSelectionCommand){if(Er(o),n.preventDefault(),w(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=Gn();if(!w(f))return!0;Ct(f.clone())}if(w(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(vt(null),o.lastKeyDownTimeStamp=0,setTimeout(()=>{Gt(r,()=>{vt(null)})},30),w(i)){const d=i.anchor.getNode();d.markDirty(),$(d)||O(142),$u(i,d)}}else{if(vt(null),be&&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(),_=i.anchor.offset===0&&i.focus.offset===h.length;let m=vo&&f&&!_&&g;if(m&&i.isCollapsed()&&(m=!H(Ag(i.anchor,!0))),!m){R(r,Qe,!0);const p=D();vo&&w(p)&&p.isCollapsed()&&(o.postDeleteSelectionToRestore=p,setTimeout(()=>o.postDeleteSelectionToRestore=null))}}return!0}}if(!w(i))return e!=="historyUndo"&&e!=="historyRedo"||(n.preventDefault(),R(r,e==="historyUndo"?Eo:Nr)),!0;const s=n.data;o.unprocessedBeforeInputData!==null&&qs(!1,r,o.unprocessedBeforeInputData),i.dirty&&o.unprocessedBeforeInputData===null||!i.isCollapsed()||ut(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(),R(r,On,!1);else if(s===Xe)n.preventDefault(),R(r,Tr);else if(s==null&&n.dataTransfer){const f=n.dataTransfer.getData("text/plain");n.preventDefault(),i.insertRawText(f)}else s!=null&&Ou(i,t,s,n.timeStamp,!0)?(n.preventDefault(),R(r,$n,s),Wl(s)):o.unprocessedBeforeInputData=s;return o.lastBeforeInputInsertTextTimeStamp=n.timeStamp,!0}switch(n.preventDefault(),e){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":R(r,$n,n),Wl((n.dataTransfer?n.dataTransfer.getData("text/plain"):null)??n.data);break;case"insertFromComposition":{const f=o.hadOrphanedCompositionEvents;o.hadOrphanedCompositionEvents=!1;const d=r._compositionKey;vt(null),f||R(r,$n,n),ho(d);break}case"insertLineBreak":vt(null),R(r,On,!1);break;case"insertParagraph":vt(null),o.isInsertLineBreak&&!be?(o.isInsertLineBreak=!1,R(r,On,!1)):R(r,Tr);break;case"insertFromPaste":case"insertFromPasteAsQuotation":R(r,ni,n);break;case"deleteByComposition":(function(f,d){return f!==d||C(f)||C(d)||!Wo(f)||!Wo(d)})(a,u)&&R(r,uo,n);break;case"deleteByDrag":an(es),R(r,uo,n);break;case"deleteByCut":R(r,uo,n);break;case"deleteContent":R(r,Qe,!1);break;case"deleteWordBackward":R(r,kr,!0);break;case"deleteWordForward":R(r,kr,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":R(r,Mn,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":R(r,Mn,!1);break;case"formatStrikeThrough":R(r,$e,"strikethrough");break;case"formatBold":R(r,$e,"bold");break;case"formatItalic":R(r,$e,"italic");break;case"formatUnderline":R(r,$e,"underline");break;case"historyUndo":R(r,Eo);break;case"historyRedo":R(r,Nr)}return!0}function jh(n){const e=G(),t=e._inputState,r=D(),o=n.data,i=Mu(n);let s=!1;if(o!=null&&w(r)){const l=Lt(Kt(e)),c=l!==null?Bt(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()&&$(u)&&Yt(u);if(!a&&!f&&Ou(r,i,o,n.timeStamp,!1,c)){if(s=!0,t.compositionPhase==="ending-firefox"){const p=Oo(e,o);if(t.compositionPhase="idle",p)return an(wr),Sc(),!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,_=h?r.focus.offset:r.anchor.offset;Kn&&!r.isCollapsed()&&$(d)&&c.anchorNode!==null&&d.getTextContent().slice(0,g)+o+d.getTextContent().slice(g+_)===vf(c.anchorNode)||R(e,$n,o);const m=o.length;ve&&m>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(r.anchor.offset-=m,r._cachedNodes=null,r._cachedIsBackward=null),vo&&e.isComposing()&&(t.lastKeyDownTimeStamp=0,vt(null))}}return s||(qs(!1,e,o!==null?o:void 0),t.compositionPhase==="ending-firefox"&&(Oo(e,o||void 0),an(wr),t.compositionPhase="idle")),Sc(),!0}function Hh(n){const e=G(),t=e._inputState,r=D();if(w(r)&&!e.isComposing()){t.compositionPhase="composing",t.hadOrphanedCompositionEvents=!1;const o=r.anchor,i=r.anchor.getNode();if(vt(o.key),an(Bu),n.timeStamp<t.lastKeyDownTimeStamp+30||o.type==="element"||!r.isCollapsed()||!vo&&(i.getFormat()!==r.format||$(i)&&i.getStyle()!==r.style)||$(i)&&(Yt(i)||o.offset===0&&!i.canInsertTextBefore()||o.offset===i.getTextContentSize()&&!i.canInsertTextAfter())){R(e,$n,Es);const s=D();w(s)&&vt(s.anchor.key)}}return!0}function Jh(n){const e=G();return e._inputState.compositionPhase="idle",Oo(e,n.data),an(wr),!0}function ho(n){if(n===null)return;const e=rt(n);if(!$(e)||e.getType()==="text"||Yt(e)||!e.isAttached())return;const t=D(),r=w(t)&&t.anchor.key===n?t.anchor.offset:null,o=_t(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 Oo(n,e){const t=n._compositionKey;if(vt(null),t!==null&&e!=null){if(e===""){const o=rt(t),i=n.getElementByKey(t),s=i!==null&&$(o)?Ie(o,i,n):null;if(s!==null&&s.nodeValue!==null&&$(o)){const l=Lt(Kt(n)),c=l&&Bt(l,n._rootElement);let a=null,u=null;c!==null&&c.anchorNode===s&&(a=c.anchorOffset,u=c.focusOffset),Gs(o,s.nodeValue,a,u,!0)}return ho(t),!1}if(e[e.length-1]===`
|
|
7
|
-
`){const o=D();if(w(o)||at(o)){if(w(o)){const i=o.focus;o.anchor.set(i.key,i.offset,i.type)}return R(n,Br,null),ho(t),!1}}const r=rt(t);if(r!==null&&$(r)&&Yt(r)){r.markDirty();const o=D(),i=r.getTextContentSize(),s=w(o)&&o.anchor.key===t?o.anchor.offset:i;return r.select(s,s).insertText(e),!0}}return qs(!0,n,e),ho(t),!1}const Gr={altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:"any"},rr={ctrlKey:!0},jl={metaKey:!0},me={shiftKey:"any"},Hl={...me,altKey:"any"};function Vh(n){const e=G(),t=e._inputState;if(n.key==null)return!0;if(t.compositionPhase==="ending-safari"){const i=(function(s){return s.key==="Backspace"})(n);if(i&&Gt(e,()=>{Oo(e,t.compositionEndData)}),t.compositionPhase="idle",t.compositionEndData="",i)return!0}let r=e._keyDownShortcuts;r===null&&(r=Bh((function(){const i=(a,u,f)=>({key:a,modifiers:u,onMatch:(d,h)=>{R(h,f,d)}}),s=(a,u,f,d)=>({key:a,modifiers:u,onMatch:(h,g)=>{h.preventDefault(),R(g,f,d)}}),l=(a,u)=>({key:"Enter",modifiers:a,onMatch:(f,d)=>{d._inputState.isInsertLineBreak=u,R(d,Br,f)}}),c=(a,u)=>({key:a,modifiers:Ve,onMatch:(f,d)=>{const h=d._editorState._selection;h===null||w(h)||(f.preventDefault(),R(d,u,f))}});return[i("ArrowRight",me,bu),i("ArrowLeft",me,Tu),i("ArrowUp",Hl,$s),i("ArrowDown",Hl,Ms),l({...Gr,shiftKey:!0},!0),l({...Gr,shiftKey:!1},!1),i(" ",Gr,ku),{key:"Backspace",modifiers:me,onMatch:(a,u)=>{R(u,As,a)&&Ul(u._inputState)}},i("Escape",Gr,Ds),i("Delete",{},Nu),s("Backspace",Rl,kr,!0),s("Delete",Rl,kr,!1),s("b",Ve,$e,"bold"),s("u",Ve,$e,"underline"),s("i",Ve,$e,"italic"),i("Tab",me,Ps),s("z",Ve,Eo,void 0),s("z",{...Ve,shiftKey:!0},Nr,void 0),...Bn?[{key:"o",modifiers:rr,onMatch:(a,u)=>{a.preventDefault(),u._inputState.isInsertLineBreak=!0,R(u,On,!0)}},i("ArrowLeft",{metaKey:!0,...me},Yi),i("ArrowRight",{metaKey:!0,...me},Gi),s("h",rr,Qe,!0),s("d",rr,Qe,!1),s("Backspace",jl,Mn,!0),s("Delete",jl,Mn,!1),s("k",rr,Mn,!1)]:[i("Home",me,Yi),i("End",me,Gi),s("y",rr,Nr,void 0)],{key:"a",modifiers:Ve,onMatch:(a,u)=>{a.preventDefault(),R(u,wu,a)&&Ul(u._inputState)}},c("c",ri),c("x",Ls)]})()),e._keyDownShortcuts=r);const o=r.match(n);return o&&o.onMatch(n,e),(function(i){return i.ctrlKey||i.shiftKey||i.altKey||i.metaKey})(n)&&e.dispatchCommand(Lh,n),!0}function Du(n){let e=n.__lexicalEventHandles;return e===void 0&&(e=[],n.__lexicalEventHandles=e),e}const An=new Map;function Jl(n){const e=Ig(n.target);if(e===null)return;const t=Xs(n.target);let r=null,o=null;const i=t!==null?wo.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&&ke(h._rootElement.getRootNode())){d=!0;break}i.hasShadowEditor=d}if(d){let h=null,g=null;for(const _ of f){const m=_._rootElement;if(m===null)continue;const p=Bt(e,m).anchorNode;if(p!==null&&Fn(p)===_){if(ke(m.getRootNode())){r=_,o=p;break}h===null&&(h=_,g=p)}}r===null&&h!==null&&(r=h,o=g)}else{const h=e.anchorNode;h===null||q(h)&&h.shadowRoot!==null||(r=Fn(h),r!==null&&(o=h))}}if(r===null){const f=jn(t);r=f!==null?Fn(f):null}}if(r===null)return;if(r._inputState.isSelectionChangeFromMouseDown){if(i!==void 0)for(const f of i.editors)f._inputState.isSelectionChangeFromMouseDown=!1;Gt(r,()=>{const f=Gn(),d=o??Bt(e,r._rootElement).anchorNode;(q(d)||de(d))&&Ct(Po(f,e,r,n))})}const s=Vs(r),l=s[s.length-1],c=l._key,a=An.get(c),u=a||l;u!==r&&zl(e,u,!1),zl(e,r,!0),r!==l?An.set(c,r):a&&An.delete(c)}function Vl(n){n._lexicalHandled=!0}function ql(n){return n._lexicalHandled===!0}function qh(n){const e=Qi.get(n);if(e===void 0)return;const t=wo.get(e);if(t===void 0)return;Qi.delete(n);const r=Xn(n);jr(r)?((function(i){if(i._parentEditor!==null){const s=Vs(i),l=s[s.length-1]._key;An.get(l)===i&&An.delete(l)}else An.delete(i._key)})(r),t.editors.delete(r),t.hasShadowEditor=void 0,n.__lexicalEditor=null):r&&O(198);const o=Du(n);for(let i=0;i<o.length;i++)o[i]();n.__lexicalEventHandles=[]}function Zi(n,e,t){xt();const r=n.__key,o=n.getParent();if(o===null)return void(Et(n)!==null&&O(367,r,String(Et(n))));const i=(function(l){const c=D();if(!w(c)||!C(l))return c;const{anchor:a,focus:u}=c,f=a.getNode(),d=u.getNode();return Un(f,l)&&a.set(l.__key,0,"element"),Un(d,l)&&u.set(l.__key,0,"element"),c})(n);let s=!1;if(w(i)&&e){const l=i.anchor,c=i.focus;l.key===r&&(Fo(l,n,o,n.getPreviousSibling(),n.getNextSibling()),s=!0),c.key===r&&(Fo(c,n,o,n.getPreviousSibling(),n.getNextSibling()),s=!0)}else at(i)&&e&&n.isSelected()&&n.selectPrevious();if(w(i)&&e&&!s&&Ge(i,o)){const l=n.getIndexWithinParent();Se(n),Ye(i,o,l,-1)}else Se(n);t||Z(o)||o.canBeEmpty()||!o.isEmpty()||Zi(o,e),e&&i&&ut(o)&&o.isEmpty()&&o.selectEnd()}const Pu=Symbol.for("ephemeral");function $o(n){return n[Pu]||!1}const Gl={configurable:!0,enumerable:!1,value:void 0,writable:!0};var Ua;Ua=Sr;class Pt{constructor(e){b(this,"__type");b(this,"__key");b(this,"__parent");b(this,"__prev");b(this,"__next");b(this,"__state");b(this,Ua);this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",Gl),Object.defineProperty(this,Sr,Gl),mf(this,e)}static getType(){const{ownNodeType:e}=tl(this);return e===void 0&&O(64,this.name),e}static clone(e){O(65,this.name)}$config(){return{}}config(e,t){const r=t.extends||Df(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())}getType(){return this.__type}isInline(){O(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=rt(e);if(t===null)break;e=t.__parent!==null?t.__parent:Et(t)}return!1}isSelected(e){const t=e||D();if(t==null)return!1;const r=t.getNodes().some(o=>o.__key===this.__key);if($(this))return r;if(w(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const o=this.getParent();if(H(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:rt(e)}getParentOrThrow(){const e=this.getParent();return e===null&&O(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(Z(t)||Et(e)!==null)return C(e)||e===this&&H(e)||O(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&O(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:rt(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:rt(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=C(this)?this:this.getParent(),r=C(e)?e:e.getParent(),o=t&&r?fs(t,r):null;return o?o.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){const t=fs(this,e);return t!==null&&(t.type==="descendant"||(t.type==="branch"?Rf(t)===-1:(t.type!=="same"&&t.type!=="ancestor"&&O(279),!1)))}isParentOf(e){return Un(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=C(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&&O(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=G()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if($o(this))return this;const e=rt(this.__key);return e===null&&O(113),e}getWritable(){if($o(this))return this;xt();const e=re(),t=G(),r=e._nodeMap,o=this.__key,i=this.getLatest(),s=t._cloneNotNeeded,l=D();if(l!==null&&l.setCachedNodes(null),s.has(o))return Uo(i),i;const c=$f(i);return s.add(o),Uo(c),r.set(o,c),c}getTextContent(){return If(this)}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){O(70)}updateDOM(e,t,r){O(71)}getDOMSlot(e){return new Ga(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){O(18,this.name)}updateFromJSON(e){return(function(t,r){const o=t.getWritable(),i=r.$;let s=i;for(const l of su(o).flatKeys)l in r&&(s!==void 0&&s!==i||(s={...i}),s[l]=r[l]);return(o.__state||s)&&iu(t).updateFromJSON(s),o})(this,e)}static transform(){return null}remove(e){Zi(this,!0,e)}replace(e,t){xt();let r=D();r!==null&&(r=r.clone()),$i(this,e);const o=this.getLatest(),i=this.__key,s=$t(o);s!==null&&O(400,i,o.getType(),s.getKey(),s.getType());const l=e.__key,c=e.getWritable(),a=this.getParentOrThrow().getWritable(),u=a.__size,f=c.getParent(),d=f!==null&&w(r)&&Ge(r,f),h=d?c.getIndexWithinParent():-1;Se(c),d&&f!==null&&w(r)&&Ye(r,f,h,-1);const g=o.getPreviousSibling(),_=o.getNextSibling(),m=o.__prev,p=o.__next,y=o.__parent;Zi(o,!1,!0),g===null?a.__first=l:g.getWritable().__next=l,c.__prev=m,_===null?a.__last=l:_.getWritable().__prev=l,c.__next=p,c.__parent=y,a.__size=f!==null&&f.is(a)?u-1:u;let x=0;if(t&&(C(this)&&C(c)||O(139),x=c.getChildrenSize(),c.splice(x,0,this.getChildren())),w(r)){Ct(r);const S=r.anchor,v=r.focus;S.key===i&&(t&&S.type==="element"?S.set(c.__key,x+S.offset,"element"):Zl(S,c)),v.key===i&&(t&&v.type==="element"?v.set(c.__key,x+v.offset,"element"):Zl(v,c))}return le()===i&&vt(l),c}insertAfter(e,t=!0){xt(),$i(this,e);const r=this.getWritable(),o=e.getWritable();this.getParentOrThrow();const i=o.getParent(),s=D();let l=!1,c=!1,a=-1;if(i!==null&&t&&w(s)&&Ge(s,i)){const g=i.__key,_=s.anchor,m=s.focus;a=e.getIndexWithinParent(),l=_.type==="element"&&_.key===g&&_.offset===a+1,c=m.type==="element"&&m.key===g&&m.offset===a+1}Se(o),a!==-1&&i!==null&&w(s)&&Ye(s,i,a,-1);const u=this.getNextSibling(),f=this.getParentOrThrow().getWritable(),d=o.__key,h=r.__next;if(u===null?f.__last=d:u.getWritable().__prev=d,f.__size++,r.__next=d,o.__next=h,o.__prev=r.__key,o.__parent=r.__parent,t&&w(s)){const g=f.__key;if(l||c||Ge(s,f)){const _=this.getIndexWithinParent();Ye(s,f,_+1),l&&s.anchor.set(g,_+2,"element"),c&&s.focus.set(g,_+2,"element")}}return e}insertBefore(e,t=!0){xt(),$i(this,e);const r=this.getWritable(),o=e.getWritable();this.getParentOrThrow();const i=o.__key,s=D(),l=o.getParent(),c=l!==null&&t&&w(s)&&Ge(s,l),a=c?o.getIndexWithinParent():-1;Se(o),c&&l!==null&&w(s)&&Ye(s,l,a,-1);const u=this.getPreviousSibling(),f=this.getParentOrThrow().getWritable(),d=r.__prev,h=t&&w(s)&&Ge(s,f),g=h?this.getIndexWithinParent():-1;return u===null?f.__first=i:u.getWritable().__next=i,f.__size++,r.__prev=i,o.__prev=d,o.__next=r.__key,o.__parent=r.__parent,h&&w(s)&&Ye(s,f,g),e}isParentRequired(){return!1}createParentElementNode(){return et()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){xt();const r=$t(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(C(o))return o.select();if(!$(o)){const s=o.getIndexWithinParent()+1;return i.select(s,s)}return o.select(e,t)}selectNext(e,t){xt();const r=$t(this);if(r!==null)return r.selectNext(e,t);const o=this.getNextSibling(),i=this.getParentOrThrow();if(o===null)return i.select();if(C(o))return o.select(0,0);if(!$(o)){const s=o.getIndexWithinParent();return i.select(s,s)}return o.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}b(Pt,"importDOM");function Fu(n){return n instanceof Pt}const Mo="historic",Iu="history-push",Dn="history-merge",Lu="paste",ts="cut",Ru="collaboration",Gh="skip-scroll-into-view",Yh="skip-dom-selection",es="skip-selection-focus",Bu="composition-start",wr="composition-end",Xh="!important";function Ao(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 _=t.trim(),m=r.trim();_!==""&&m!==""&&(e[_]=m),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 Qh(n,e,t){const r=t.trimEnd(),o=r.length-10;o>=0&&r.slice(o).toLowerCase()===Xh?n.setProperty(e,r.slice(0,o).trim(),"important"):n.setProperty(e,t,"")}function Pn(n,e,t=""){if(e===t)return;const r=Ao(t),o=Ao(e);for(const i in o)delete r[i],Qh(n,i,o[i]);for(const i in r)n.removeProperty(i)}function Ci(n,e){return 16&e?"code":e&Va?"mark":32&e?"sub":64&e?"sup":null}function vi(n,e){return 1&e?"strong":2&e?"em":"span"}function Ku(n,e,t,r,o){const i=r.classList;let s=In(o,"base");s!==void 0&&i.add(...s),s=In(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 Te){const u=Te[a];if(s=In(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)}$r(r,"class")}function zu(n,e,t){const r=t.isComposing(),o=n+(r?yr:""),i=gt(),s=ui(i).$getDOMSlot(t,e,i),l=s.getFirstChild();if(l===null||l.nodeType!==Node.TEXT_NODE)return void s.insertChild(it().createTextNode(o));const c=l,a=c.nodeValue;if(a!==o)if(r||ve){const[u,f,d]=(function(h,g){const _=h.length,m=g.length;let p=0,y=0;for(;p<_&&p<m&&h[p]===g[p];)p++;for(;y+p<_&&y+p<m&&h[_-y-1]===g[m-y-1];)y++;return[p,_-p-y,g.slice(p,m-y)]})(a,o);f!==0&&c.deleteData(u,f),c.insertData(u,d)}else c.nodeValue=o}function Yl(n,e,t,r,o,i){zu(o,n,e);const s=i.theme.text;s!==void 0&&Ku(0,0,r,n,s)}function Yr(n,e){const t=it().createElement(e);return t.appendChild(n),t}function ns(n){return n!=null&&n.__isInlineFormattable===!0}class ee extends Pt{constructor(t="",r){super(r);b(this,"__text");b(this,"__format");b(this,"__style");b(this,"__mode");b(this,"__detail");this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}get __isInlineFormattable(){return!0}$config(){return this.config("text",{importDOM:{"#text":()=>({conversion:ng,priority:0}),b:()=>({conversion:tg,priority:0}),code:()=>({conversion:pe,priority:0}),em:()=>({conversion:pe,priority:0}),i:()=>({conversion:pe,priority:0}),mark:()=>({conversion:pe,priority:0}),s:()=>({conversion:pe,priority:0}),span:()=>({conversion:Zh,priority:0}),strong:()=>({conversion:pe,priority:0}),sub:()=>({conversion:pe,priority:0}),sup:()=>({conversion:pe,priority:0}),u:()=>({conversion:pe,priority:0})}})}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const t=this.getLatest();return hh[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===le()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(t){const r=Te[t];return(this.getFormat()&r)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(t,r){return ln(this.getLatest().__format,t,r)}canHaveFormat(){return!0}isInline(){return!0}createDOM(t,r){const o=this.__format,i=Ci(0,o),s=vi(0,o),l=i===null?s:i,c=it().createElement(l);let a=c;this.hasFormat("code")&&c.setAttribute("spellcheck","false"),i!==null&&(a=it().createElement(s),c.appendChild(a)),Yl(a,this,0,o,this.__text,t);const u=this.__style;return u!==""&&Pn(c.style,u),c}updateDOM(t,r,o){const i=this.__text,s=t.__format,l=this.__format,c=Ci(0,s),a=Ci(0,l),u=vi(0,s),f=vi(0,l);if((c===null?u:c)!==(a===null?f:a))return!0;if(c===a&&u!==f){const m=r.firstChild;m==null&&O(48);const p=it().createElement(f);return Yl(p,this,0,l,i,o),r.replaceChild(p,m),!1}let d=r;a!==null&&c!==null&&(d=r.firstChild,d==null&&O(49)),zu(i,d,this);const h=o.theme.text;h!==void 0&&s!==l&&Ku(0,s,l,d,h);const g=t.__style,_=this.__style;return g!==_&&(Pn(r.style,_,g),$r(r,"style")),!1}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(t){let{element:r}=super.exportDOM(t);return q(r)||O(132),r.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?r.style.textTransform="lowercase":this.hasFormat("uppercase")?r.style.textTransform="uppercase":this.hasFormat("capitalize")&&(r.style.textTransform="capitalize"),this.hasFormat("bold")&&(r=Yr(r,"b")),this.hasFormat("italic")&&(r=Yr(r,"i")),this.hasFormat("strikethrough")&&(r=Yr(r,"s")),this.hasFormat("underline")&&(r=Yr(r,"u")),{element:r}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,r){}setFormat(t){const r=this.getWritable();return r.__format=typeof t=="string"?Te[t]:t,r}setDetail(t){const r=this.getWritable();return r.__detail=typeof t=="string"?uh[t]:t,r}setStyle(t){const r=this.getWritable();return r.__style=t,r}toggleFormat(t){const r=ln(this.getFormat(),t,null);return this.setFormat(r)}toggleDirectionless(){const t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){const t=this.getWritable();return t.__detail^=2,t}setMode(t){const r=dh[t];if(this.__mode===r)return this;const o=this.getWritable();return o.__mode=r,o}setTextContent(t){if(this.__text===t)return this;const r=this.getWritable();return r.__text=t,r}select(t,r){xt();let o=t,i=r;const s=D(),l=this.getTextContent(),c=this.__key;if(typeof l=="string"){const a=l.length;o===void 0&&(o=a),i===void 0&&(i=a)}else o=0,i=0;if(!w(s))return Xu(c,o,c,i,"text","text");{const a=le();a!==s.anchor.key&&a!==s.focus.key||vt(c),s.setTextNodeRange(this,o,this,i)}return s}selectStart(){return this.select(0,0)}selectEnd(){const t=this.getTextContentSize();return this.select(t,t)}spliceText(t,r,o,i){const s=this.getWritable(),l=s.__text,c=o.length;let a=t;a<0&&(a=c+a,a<0&&(a=0));const u=D();if(i&&w(u)){const d=t+c;u.setTextNodeRange(s,d,s,d)}const f=l.slice(0,a)+o+l.slice(a+r);return s.__text=f,s}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...t){xt();const r=this.getLatest(),o=r.getTextContent();if(o==="")return[];const i=r.__key,s=le(),l=o.length;t.sort((E,M)=>E-M),t.push(l);const c=[],a=t.length;for(let E=0,M=0;E<l&&M<=a;M++){const A=t[M];A>E&&(c.push(o.slice(E,A)),E=A)}const u=c.length;if(u===1)return[r];const f=c[0],d=r.getParent();let h;const g=r.getFormat(),_=r.getStyle(),m=r.__detail;let p=!1,y=null,x=null;const S=D();if(w(S)){const[E,M]=S.isBackward()?[S.focus,S.anchor]:[S.anchor,S.focus];E.type==="text"&&E.key===i&&(y=E),M.type==="text"&&M.key===i&&(x=M)}r.isSegmented()?(h=_t(f),h.__format=g,h.__style=_,h.__detail=m,h.__state=Nl(r,h),p=!0):h=r.setTextContent(f);const v=[h];for(let E=1;E<u;E++){const M=_t(c[E]);M.__format=g,M.__style=_,M.__detail=m,M.__state=Nl(r,M);const A=M.__key;s===i&&vt(A),v.push(M)}const T=y?y.offset:null,N=x?x.offset:null;let k=0;for(const E of v){if(!y&&!x)break;const M=k+E.getTextContentSize();if(y!==null&&T!==null&&T<=M&&T>=k&&(y.set(E.getKey(),T-k,"text"),T<M&&(y=null)),x!==null&&N!==null&&N<=M&&N>=k){x.set(E.getKey(),N-k,"text");break}k=M}if(d!==null){(function(A){const P=A.getPreviousSibling(),L=A.getNextSibling();P!==null&&Uo(P),L!==null&&Uo(L)})(this);const E=d.getWritable(),M=this.getIndexWithinParent();p?(E.splice(M,0,v),this.remove()):E.splice(M,1,v),w(S)&&Ye(S,d,M,u-1)}return v}mergeWithSibling(t){const r=t===this.getPreviousSibling();r||t===this.getNextSibling()||O(50);const o=this.__key,i=t.__key,s=this.__text,l=s.length;le()===i&&vt(o);const c=D();if(w(c)){const d=c.anchor,h=c.focus;d!==null&&d.key===i&&cc(d,r,o,t,l),h!==null&&h.key===i&&cc(h,r,o,t,l)}const a=t.__text,u=r?a+s:s+a;this.setTextContent(u);const f=this.getWritable();return t.remove(),f}isTextEntity(){return!1}}function Zh(n){return{forChild:Rs(n.style),node:null}}function tg(n){const e=n,t=e.style.fontWeight==="normal";return{forChild:Rs(e.style,t?void 0:"bold"),node:null}}const Xl=new WeakMap;function eg(n){if(!q(n))return!1;if(n.nodeName==="PRE")return!0;const e=n.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function ng(n){const e=n;n.parentElement===null&&O(129);let t=e.textContent||"";if((function(r){let o,i=r.parentNode;const s=[r];for(;i!==null&&(o=Xl.get(i))===void 0&&!eg(i);)s.push(i),i=i.parentNode;const l=o===void 0?i:o;for(let c=0;c<s.length;c++)Xl.set(s[c],l);return l})(e)!==null)return{node:Zu(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=Ql(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=Ql(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:_t(t)}}function Ql(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,q(t)){const i=t.style.display;if(i===""&&!us(t)||i!==""&&!i.startsWith("inline"))return null}let o=t;for(;(o=e?t.firstChild:t.lastChild)!==null;)t=o;if(de(t))return t;if(t.nodeName==="BR")return null}}const rg={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function pe(n){const e=rg[n.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Rs(n.style,e),node:null}}function _t(n=""){return oe(new ee(n))}function $(n){return n instanceof ee}function Rs(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,a=n.textTransform;return u=>(($(u)||ns(u))&&(o&&!u.hasFormat("bold")&&u.toggleFormat("bold"),i&&!u.hasFormat("strikethrough")&&u.toggleFormat("strikethrough"),s&&!u.hasFormat("italic")&&u.toggleFormat("italic"),l&&!u.hasFormat("underline")&&u.toggleFormat("underline"),c!=="sub"||u.hasFormat("subscript")||u.toggleFormat("subscript"),c!=="super"||u.hasFormat("superscript")||u.toggleFormat("superscript"),a!=="lowercase"&&a!=="uppercase"&&a!=="capitalize"||u.hasFormat(a)||u.toggleFormat(a),e&&!u.hasFormat(e)&&u.toggleFormat(e)),u)}class oi extends ee{$config(){return this.config("tab",{extends:ee})}constructor(e=void 0){super(" ",e),this.__detail=2}createDOM(e){const t=super.createDOM(e),r=In(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||O(286),this}setDetail(e){return e!==2&&O(127),this}setMode(e){return e!=="normal"&&O(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Kr(){return oe(new oi)}function rn(n){return n instanceof oi}class og{constructor(e,t,r){b(this,"key");b(this,"offset");b(this,"type");b(this,"_selection");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:ze(Ft(zt(this,"next")),Ft(zt(e,"next")))<0}getNode(){const e=rt(this.key);return e===null&&O(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,on()||(le()===s&&vt(e),i!==null&&(i.setCachedNodes(null),w(i)&&(i._cachedIsBackward=null),i.dirty=!0)))}}function fe(n,e,t){return new og(n,e,t)}function bi(n,e){let t=e.__key,r=n.offset,o="element";if($(e)){o="text";const i=e.getTextContentSize();r>i&&(r=i)}else if(!C(e)){const i=e.getNextSibling();if($(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 Zl(n,e){if(C(e)){const t=e.getLastDescendant();C(t)||$(t)?bi(n,t):bi(n,e)}else bi(n,e)}function tc(n,e,t,r){const o=n.getNode(),i=o.getChildAtIndex(n.offset),s=_t();if(s.setFormat(t),s.setStyle(r),Yn(i))i.splice(0,0,[s]);else if(i!==null){const l=Z(o)?et().append(s):s;i.insertBefore(l)}else if(Z(o)){const l=o.getLastChild();C(l)&&!l.isInline()&&l.isEmpty()?l.append(s):o.append(et().append(s))}else o.append(s);n.is(e)&&e.set(s.__key,0,"text"),n.set(s.__key,0,"text")}function ec(n,e,t,r){const o=n.anchor.getNode();$(o)||O(398);const i=n.anchor.offset,s=_t(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 ii{constructor(e){b(this,"_nodes");b(this,"_cachedNodes");b(this,"dirty");this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!at(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 ii(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes().filter(s=>Et(s)===null),r=t.length;if(r===0)return;const o=t[r-1];let i;if($(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=rt(o);i!==null&&r.push(i)}return on()||(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=>Et(t)===null);if((D()||Gn())===this&&e[0]){const t=X(e[0],"next");zn(Zt(t,t))}for(const t of e)t.remove();Wu()}}function Wu(){const n=Y();if(n.isEmpty()){const e=et();n.append(e),e.select()}}function ig(n){const e=(function(t){const r=t.getNode();if(t.offset>0)return t.type==="element"&&C(r)?r.getChildAtIndex(t.offset-1):null;for(let o=r;o!==null&&!Dt(o)&&!Z(o);o=o.getParent()){const i=o.getPreviousSibling();if(i!==null)return i}return null})(n);return Tt(e)&&Tt(e.getPreviousSibling())}function w(n){return n instanceof pn}class pn{constructor(e,t,r,o){b(this,"format");b(this,"style");b(this,"anchor");b(this,"focus");b(this,"_cachedNodes");b(this,"_cachedIsBackward");b(this,"dirty");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!!w(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(Qt(a)){const{origin:u}=a;o.length===0?l.add(u):(c.add(u),o.push(u))}else{const{origin:u}=a;C(u)&&c.has(u)||o.push(u)}if(s&&o.push(s.caret.origin),Be(r.focus)&&C(r.focus.origin)&&r.focus.getNodeAtCaret()===null)for(let a=It(r.focus.origin,"previous");Qt(a)&&l.has(a.origin)&&!a.origin.isEmpty()&&a.origin.is(o[o.length-1]);a=ol(a))l.delete(a.origin),o.pop();for(;o.length>1;){const a=o[o.length-1];if(!C(a)||c.has(a)||a.isEmpty()||l.has(a))break;o.pop()}if(o.length===0&&r.isCollapsed()){const a=Ft(r.anchor),u=Ft(r.anchor.getFlipped()),f=h=>Xt(h)?h.origin:h.getNodeAtCaret(),d=f(a)||f(u)||(r.anchor.getNodeAtCaret()?a.origin:u.origin);o.push(d)}return o})(Wr(Ko(this),"next"));return on()||(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]=rs(this);let a="",u=!0;for(let f=0;f<e.length;f++){const d=e[f];if(C(d)&&!d.isInline()){u||(a+=`
|
|
8
|
-
`);let h="";for(const g of ce(d)){const _=Hn(d,g);_!==null&&(h+=_.getTextContent())}h!==""?(a+=h,u=!1):u=!d.isEmpty()}else if(u=!1,$(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!H(d)&&!Tt(d)||d===r&&this.isCollapsed()||(a+=d.getTextContent())}return a}applyDOMRange(e){const t=G(),r=t.getEditorState()._selection,o=Yu(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),Os(this)}clone(){const e=this.anchor,t=this.focus;return new pn(fe(e.key,e.offset,e.type),fe(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=ln(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=Te[e];return(this.format&t)!==0}insertRawText(e){this.insertNodes(Zu(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($(f)&&(t=f.getFormat(),r=f.getStyle()),this.removeText(),this.format=t,this.style=r,e==="")return;if(le()===null)return this.anchor.type==="element"&&tc(this.anchor,this.focus,t,r),void ec(this,e,t,r)}this.anchor.type==="element"&&tc(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(le()!==null)o.setMode("normal").setFormat(t).setStyle(r);else{const d=_t(o.getTextContent());d.setFormat(t),d.setStyle(r);const h=D()===this;o.replace(d),this.setTextNodeRange(d,i,d,i),h&&D()!==this&&Ct(this)}return void(e!==""&&this.insertText(e))}if(e==="")return;if(i===0){const d=o.getPreviousSibling();if($(d)&&d.canInsertTextAfter()&&!Yt(d))d.select();else{const h=_t();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($(d)&&d.canInsertTextBefore()&&!Yt(d))d.select(0,0);else{const h=_t();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=_t(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 ec(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=D()===this,t=this.anchor.key;_o(this,Sg(Ko(this))),this.isCollapsed()&&(function(r,o){const i=r.anchor;if(i.key===o)return;const s=i.getNode();let l=0,c="";$(s)?(l=s.getFormat(),c=s.getStyle()):C(s)&&(l=s.getTextFormat(),c=s.getTextStyle()),r.format===l&&r.style===c||(r.format=l,r.style=c,r.dirty=!0)})(this,t),e&&D()!==this&&Ct(this)}formatText(e,t=null){ju(this,e,t)}insertNodes(e){if(e.length===0)return;this.isCollapsed()||this.removeText();const t=this.anchor.getNode();if(this.anchor.type==="element"&&C(t)&&t.isShadowRoot()&&Et(t)!==null){let x=t.getFirstChild()??t.append(et()).getFirstChild();if(x!==null&&!C(x)){const S=et();x.insertBefore(S),x=S}if(x!==null){x.selectStart();const S=D();return w(S)||O(369),S.insertNodes(e)}}if(this.anchor.type==="element"&&Z(t)){const x=ki(e),S=x.getLastDescendant();return t.splice(this.anchor.offset,0,x.getChildren()),void(S!==null&&S.selectEnd())}const r=this.isBackward()?this.focus:this.anchor;let o=r.getNode(),i=St(o,Dt);const s=e[e.length-1];if(C(i)&&"__language"in i){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const[,x]=or(this);i.splice(x,0,e),s.selectEnd()}return}if(!e.some(x=>(C(x)||H(x))&&!x.isInline())){C(i)||O(211,o.constructor.name,o.getType());const[x,S]=or(this,!0);return(C(x)?x:i).splice(S,0,e),void s.selectEnd()}if(C(i)&&Et(i)!==null){const[,x]=or(this),S=is(e);i.splice(x,0,S);const v=S[S.length-1];return void(v!==void 0?v.selectEnd():i.select(x,x))}if(i===null){const x=ki(e),S=x.getLastDescendant();let v=zt(this.anchor,"next");for(const T of x.getChildren())v=uf(T,v);return void(S!==null&&S.selectEnd())}if(C(i)&&!i.isParentRequired()&&!Z(i.getParentOrThrow())){const[,x]=or(this),S=is(e);i.splice(x,0,S);const v=S[S.length-1];return void(v!==void 0?v.selectEnd():i.select(x,x))}const l=ki(e),c=l.getLastDescendant(),a=l.getChildren(),u=ig(r),f=!C(i)||!i.isEmpty()?this.insertParagraph():null;f&&!i.isAttached()&&(o=this.anchor.getNode(),i=St(o,Dt));const d=a[a.length-1];let h=a[0];var g;g=h,u||!C(g)||!Dt(g)||g.isEmpty()||!C(i)||i.isEmpty()&&!i.canMergeWhenEmpty()||(C(i)||O(211,o.constructor.name,o.getType()),i.append(...h.getChildren()),h=a[1]),h&&(i===null&&O(212,o.constructor.name,o.getType()),(function(x,S){const v=S.getParentOrThrow().getLastChild();let T=S;const N=[S];for(;T!==v;)T.getNextSibling()||O(140),T=T.getNextSibling(),N.push(T);let k=x;for(const E of N)k=k.insertAfter(E)})(i,h));const _=St(c,Dt),m=c.selectEnd();f&&(C(_)&&(f.canMergeWhenEmpty()||Dt(d))?(_.append(...f.getChildren()),f.remove()):f.isEmpty()&&f.remove()),C(i)&&i.isEmpty()&&i.remove();const p=C(i)?i.getLastChild():null;Tt(p)&&_!==i&&p.remove();const y=Ft(zt(m.anchor,"next"));Re(m.anchor,y),Re(m.focus,y)}insertParagraph(){this.isCollapsed()||this.removeText();const e=this.anchor.getNode();if(this.anchor.type==="element"&&Z(e)){const l=et();return e.splice(this.anchor.offset,0,[l]),l.select(),l}const[,t]=or(this),r=St(this.anchor.getNode(),Dt);if(r!==null&&Et(r)!==null)return null;C(r)||O(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=Le();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]=rs(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($(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($(r)&&(u===r.getTextContentSize()?e.shift():u!==0&&([,r]=r.splitText(u),e[0]=r,c.set(r.getKey(),0,"text"))),$(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(Lo(this,e,t,r))return;const o=e==="move",i=G(),s=Lt(Kt(i));if(!s)return;const l=i._blockCursorElement,c=i._rootElement,a=this.focus.getNode();c===null||l===null||!C(a)||a.isInline()||a.canBeEmpty()||Ho(l,i,c);const u=Wn(i,this.focus.key);let f=u;if(this.focus.type==="text"&&(f=$(a)?Ie(a,u,i):null),this.dirty){const d=Wn(i,this.anchor.key);let h=d;if(this.anchor.type==="text"){const g=this.anchor.getNode();h=$(g)?Ie(g,d,i):null}h&&f&&Io(s,h,this.anchor.offset,f,this.focus.offset)}if(r==="character"&&$(a)&&a.isUnmergeable()&&(t?this.focus.offset===0:this.focus.offset===a.getTextContentSize())){const d=X(a,t?"previous":"next").getNodeAtCaret();if($(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?Ie(d,h,i):null;if(g){const _=t?g.length:0;Io(s,g,_,g,_)}}}}if(Ju(s,e,t?"backward":"forward",r,c),s.rangeCount>0){const d=ai(s,i._rootElement),h=d||s.getRangeAt(0),g=this.anchor.getNode(),_=ut(g)?g:Tf(g);this.applyDOMRange(h),this.dirty=!0,!o&&(Vu(this,t,_),(d?s.direction!=="backward":s.anchorNode===h.startContainer&&s.anchorOffset===h.startOffset)||Hu(this))}r==="lineboundary"&&Lo(this,e,t,r,"decorators")}forwardDeletion(e,t,r){if(!r&&(e.type==="element"&&C(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(C(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)){const c=C(o)?o.getNextSibling():null;if(!(C(o)&&o.isEmpty()&&C(c)&&c.isShadowRoot()))return}const i=zt(r,e?"previous":"next"),s=hi(i);if(s.getTextSlices().every(c=>c===null||c.distance===0)){if(r.type==="element"){const a=i.getNodeAtCaret();if(C(a)&&Mr(a)){const u=a.getParent();a.remove();const f=jo(u,a);return void(f!==null&&f.selectStart())}}let c={type:"initial"};for(const a of s.iterNodeCarets("shadowRoot"))if(Qt(a)){if(!a.origin.isInline()){if(a.origin.isShadowRoot()){if(c.type==="merge-block")break;if(C(s.anchor.origin)&&s.anchor.origin.isEmpty()){const u=Ft(a);_o(this,Zt(u,u)),s.anchor.origin.remove()}return}c.type!=="merge-next-block"&&c.type!=="merge-block"||(c={block:c.block,caret:a,type:"merge-block"})}}else{if(c.type==="merge-block")break;if(Be(a)){if(C(a.origin)){if(a.origin.isInline()){if(!a.origin.isParentOf(s.anchor.origin))break}else c={block:a.origin,type:"merge-next-block"};continue}if(H(a.origin)){if(!a.origin.isIsolated())if(c.type==="merge-next-block"&&(a.origin.isKeyboardSelectable()||!a.origin.isInline())&&C(s.anchor.origin)&&s.anchor.origin.isEmpty()){s.anchor.origin.remove();const u=Ks();u.add(a.origin.getKey()),Ct(u)}else{const u=a.origin,f=u.getParent();u.remove();const d=jo(f,u);d!==null&&d.selectStart()}return}if(Tt(a.origin))return void a.origin.remove();break}}if(c.type==="merge-block"){const{caret:a,block:u}=c;return ce(u).length>0?void 0:a.origin.isEmpty()&&!u.isEmpty()&&a.origin.getParent()===u.getParent()?void a.origin.remove(!0):(_o(this,Zt(!a.origin.isEmpty()&&u.isEmpty()?We(X(u,a.direction)):s.anchor,a)),this.removeText())}for(let a=r.getNode();a!==null;){if(Et(a)!==null)return;if(C(a)&&a.isShadowRoot())break;a=a.getParent()}}const l=this.focus;if(Ti(this,e,"character"),this.isCollapsed()){if(e&&r.offset===0&&rc(this,r.getNode()))return}else{const c=l.type==="text"?l.getNode():null;if(o=r.type==="text"?r.getNode():null,c!==null&&c.isSegmented()){const a=l.offset,u=c.getTextContentSize();if(c.is(o)||e&&a!==u||!e&&a!==0)return void oc(c,e,a)}else if(o!==null&&o.isSegmented()){const a=r.offset,u=o.getTextContentSize();if(o.is(c)||e&&a!==0||!e&&a!==u)return void oc(o,e,a)}(function(a,u){const f=a.anchor,d=a.focus,h=f.getNode(),g=d.getNode();if(h===g&&f.type==="text"&&d.type==="text"){const _=f.offset,m=d.offset,p=_<m,y=p?_:m,x=p?m:_,S=x-1;y!==S&&(function(v){return!(Sf(v)||lg(v))})(h.getTextContent().slice(y,x))&&(u?d.set(d.key,S,d.type):f.set(f.key,S,f.type))}})(this,e)}}if(t||go(this),this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&ut(r.getParent())&&r.getPreviousSibling()===null&&rc(this,r),Wu()}}deleteLine(e){const t=this.isCollapsed(),r=os(this.anchor);if(r!==null&&H($t(r)))return this.isCollapsed()||this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),void this.deleteCharacter(e);this.isCollapsed()&&Ti(this,e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):St(this.anchor.getNode(),Dt)!==St(this.focus.getNode(),Dt)?(this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),this.deleteCharacter(e)):(t||go(this),this.removeText())}deleteWord(e){const t=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor,o=r.getNode();if(this.forwardDeletion(r,o,e))return;Ti(this,e,"word")}this.isCollapsed()?this.deleteCharacter(e):(t||go(this),this.removeText())}isBackward(){const e=this._cachedIsBackward;if(e!==null)return e;const t=this.focus.isBefore(this.anchor);return on()||(this._cachedIsBackward=t),t}getStartEndPoints(){return[this.anchor,this.focus]}}function at(n){return n instanceof ii}function Uu(n,e){if(at(n)){for(const p of n.getNodes())ns(p)&&p.setFormat(e(p.getFormat()));return}if(n.isCollapsed())return n.setFormat(e(n.format)),void vt(null);const t=[];for(const p of n.getNodes())$(p)?t.push(p):C(p)?p.setTextFormat(e(p.getTextFormat())):ns(p)&&p.setFormat(e(p.getFormat()));const r=t.length;if(r===0)return n.setFormat(e(n.format)),void vt(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 p=e(u.getFormat());if(Yt(u)||f===0&&g===u.getTextContentSize())u.setFormat(p);else{const y=u.splitText(f,g),x=f===0?y[0]:y[1];x.setFormat(p),l.type==="text"&&l.set(x.__key,0,"text"),c.type==="text"&&c.set(x.__key,g-f,"text")}return void(n.format=p)}f===0||Yt(u)||([,u]=u.splitText(f),f=0);const _=e(u.getFormat());u.setFormat(_);const m=e(h.getFormat());g>0&&(g===h.getTextContentSize()||Yt(h)||([h]=h.splitText(g)),h.setFormat(m));for(let p=a+1;p<d;p++){const y=t[p];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}function sg(n,e){const t=[];for(const[r,o]of Object.entries(e))typeof o=="boolean"&&t.push([r,o]);t.length!==0&&Uu(n,r=>{for(const[o,i]of t)r=ln(r,o,i?Te[o]:0);return r})}function ju(n,e,t=null){const r=t===null&&w(n)?ln(n.format,e,null):t;Uu(n,o=>ln(o,e,r))}function nc(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function rs(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]:[nc(t),nc(r)]}function rc(n,e){for(let t=e;t;t=t.getParent()){if(C(t)){if(t.collapseAtStart(n))return!0;if(Z(t))break}if(t.getPreviousSibling())break}return!1}function go(n){const e=Y();!e.isEmpty()&&ff(e,n)&&(n.anchor.set(e.getKey(),0,"element"),n.focus.set(e.getKey(),e.getChildrenSize(),"element"))}function Hu(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 Ju(n,e,t,r,o){const i=r==="character"?Bt(n,o):null,s=i&&i.focusNode,l=i?i.focusOffset:0;if(n.modify(e,t,r),i===null||!(function(a,u,f){return a!==null&&a.nodeType===3&&(f==="backward"?u>0:f==="forward"&&u<a.length)})(s,l,t))return;const c=Bt(n,o);c.focusNode===s&&c.focusOffset===l&&n.modify(e,t,r)}function Vu(n,e,t){const r=n.getNodes(),o=r.filter(l=>Un(l,t));if(o.length===0||o.length===r.length)return!1;const i=e?o[0]:o[o.length-1],s=C(i)?i:i.getParentOrThrow();return e?s.selectStart():s.selectEnd(),!0}function Ti(n,e,t){if(Lo(n,"extend",e,t))return;const r=G(),o=Lt(Kt(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||!C(c)||c.isInline()||c.canBeEmpty()||Ho(i,r,s);const a=E=>{const M=E.getNode(),A=r.getElementByKey(E.key);return A!==null&&E.type==="text"&&$(M)?Ie(M,A,r):A},u=l.getNode(),f=a(l);if(f===null)return;const d=l.offset,h=n.isCollapsed(),g=n.focus,_=h?f:a(g);if(_===null)return;const m=g.offset;if(Io(o,_,m,_,m),Ju(o,"move",e?"backward":"forward",t,s),o.rangeCount===0)return;const p=ai(o,s)||o.getRangeAt(0),y=p.startContainer,x=p.startOffset;if(h&&t==="character"&&l.type==="text"&&$(u)&&u.isUnmergeable()&&d===(e?0:u.getTextContentSize())){const E=X(u,e?"previous":"next").getNodeAtCaret();if($(E)){const M=e?E.getTextContentSize()-1:1;return n.focus.set(E.__key,M,"text"),void(n.dirty=!0)}}if(h&&t==="character"&&l.type==="text"){const E=e?0:u.getTextContentSize(),M=y===f?x:d!==E?E:-1;if(M>=0)return void(M!==d&&(n.focus.set(l.key,M,"text"),n.dirty=!0))}const[S,v,T,N]=e?[y,x,f,d]:[f,d,y,x],k=ut(u)?u:Tf(u);n.applyDOMRange({collapsed:!1,endContainer:T,endOffset:N,startContainer:S,startOffset:v}),n.dirty=!0,!Vu(n,e,k)&&e&&Hu(n),t==="lineboundary"&&Lo(n,"extend",e,t,"decorators")}const lg=(()=>{try{const n=new RegExp("\\p{Emoji}","u"),e=n.test.bind(n);if(e("❤️")&&e("#️⃣")&&e("👍"))return e}catch{}return()=>!1})();function oc(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 ic(n,e,t,r){let o,i=e,s=!1;if(q(n)){let l=!1;const c=n.childNodes,a=c.length,u=r._blockCursorElement;i===a&&a>0&&(l=!0,i=a-1),Qn(n,r)!==void 0||Vo(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=En(f),$(o))i=ae(o,l?"next":"previous");else{let h=En(n);if(h===null)return null;if(C(h)){const g=r.getElementByKey(h.getKey());g===null&&O(214),[h,i]=Wt(h,g,r).resolveChildIndex(h,g,n,e),C(h)||O(215),l&&i>=h.getChildrenSize()&&(i=Math.max(0,h.getChildrenSize()-1));let m=h.getChildAtIndex(i);if(C(m)&&(function(p,y,x){const S=p.getParent();return x===null||S===null||!S.canBeEmpty()||S!==x.getNode()})(m,0,t)){const p=l?m.getLastDescendant():m.getFirstDescendant();p===null?h=m:(m=p,h=C(m)?m:m.getParentOrThrow()),i=0}$(m)?(o=m,h=null,i=ae(m,l?"next":"previous")):m!==h&&l&&!d&&(C(h)||O(216),i=Math.min(h.getChildrenSize(),i+1))}else{const g=$t(h),_=g!==null?g:h,m=_.getIndexWithinParent(),p=r.getElementByKey(h.getKey());let y="after";if(p!==null&&En(n)===h){const x=Wt(h,p,r);x.element!==p?y=x.resolveLeafPosition(p,n,e):e===0&&H(h)&&(y="before")}i=y==="before"?m:m+1,h=_.getParentOrThrow()}if(C(h))return[fe(h.__key,i,"element"),s]}}else o=En(n);return $(o)?[fe(o.__key,ae(o,i,"clamp"),"text"),s]:null}function sc(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&&C(s)&&s.isInline()){const l=s.getPreviousSibling();$(l)&&n.set(l.__key,l.getTextContent().length,"text")}}else C(i)&&!t&&i.isInline()?n.set(i.__key,i.getChildrenSize(),"element"):$(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&&C(i)&&i.isInline())n.set(i.__key,0,"element");else if((t||e)&&i===null&&C(s)&&s.isInline()&&!s.canInsertTextAfter()&&s.getTextContentSize()>1){const l=s.getNextSibling();$(l)&&n.set(l.__key,0,"text")}}}function os(n){const e=rt(n.key);return e===null?null:Dr(e)}function qu(n,e,t){const r=os(n),o=os(e);if(r===o||r!==null&&o!==null&&r.is(o))return!1;const i=t(r,o);if(r!==null)return C(r)?e.set(r.getKey(),i?r.getChildrenSize():0,"element"):e.set(r.getKey(),i?r.getTextContentSize():0,"text"),!0;const s=$t(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 Gu(n){const e=qu(n.anchor,n.focus,(t,r)=>(function(o,i,s,l){if(s!==null&&l!==null){const u=$t(s),f=$t(l);if(u!==null&&u.is(f)){for(const d of di(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=$t(s),f=rt(i.key);return u===null||f===null||!(!u.is(f)&&!u.isParentOf(f))||u.isBefore(f)}const c=$t(l),a=rt(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 Yu(n,e,t,r,o,i){if(n===null||t===null||!Ur(o,n,t))return null;const s=ic(n,e,w(i)?i.anchor:null,o);if(s===null)return null;const l=ic(t,r,w(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=En(n),g=En(t);if(H(h)&&H(g))return null}const d=o._slotsUsed&&qu(c,u,()=>(n.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return(function(h,g){if(h.type==="text"&&g.type==="text"){const _=h.isBefore(g),m=h.is(g);sc(h,_,m),sc(g,!_,m),m&&g.set(h.key,h.offset,h.type)}})(c,u),[c,u,a||f||d]}function Do(n){return C(n)&&!n.isInline()}function Xu(n,e,t,r,o,i){const s=re(),l=new pn(fe(n,e,o),fe(t,r,i),0,"");return l.dirty=!0,s._selection=l,l}function Bs(){const n=fe("root",0,"element"),e=fe("root",0,"element");return new pn(n,e,0,"")}function Ks(){return new ii(new Set)}function Po(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=!Ki&&(l||s==="beforeinput"||s==="compositionstart"||s==="compositionend"||s==="click"&&i&&i.detail===3||s==="drop"||s===void 0);let a,u,f,d;if(w(n)&&!c)return n.clone();{if(e===null)return null;const S=Bt(e,t._rootElement);if(a=S.anchorNode,u=S.focusNode,f=S.anchorOffset,d=S.focusOffset,(l||s===void 0)&&w(n)&&!Ur(t,a,u))return n.clone()}const h=Yu(a,f,u,d,t,n);if(h===null)return null;const[g,_,m]=h;let p=0,y="";if(w(n)){const S=n.anchor;if(g.key===S.key)p=n.format,y=n.style;else{const v=g.getNode();$(v)?(p=v.getFormat(),y=v.getStyle()):C(v)&&(p=v.getTextFormat(),y=v.getTextStyle())}}const x=new pn(g,_,p,y);return m&&(x.dirty=!0),x}function D(){return re()._selection}function Gn(){return G()._editorState._selection}function Ge(n,e){const t=e.__key;return n.anchor.key===t||n.focus.key===t}function Ye(n,e,t,r=1){if(!Ge(n,e))return;const o=n.anchor,i=n.focus,s=e.__key;if(n.isCollapsed()){const l=o.offset;if(t<=l&&r>0||t<l&&r<0){const c=Math.max(0,l+r);o.set(s,c,"element"),i.set(s,c,"element"),lc(n)}}else{const l=n.isBackward(),c=l?i:o,a=c.getNode(),u=l?o:i,f=u.getNode();if(e.is(a)){const d=c.offset;(t<=d&&r>0||t<d&&r<0)&&c.set(s,Math.max(0,d+r),"element")}if(e.is(f)){const d=u.offset;(t<=d&&r>0||t<d&&r<0)&&u.set(s,Math.max(0,d+r),"element")}}lc(n)}function lc(n){const e=n.anchor,t=e.offset,r=n.focus,o=r.offset,i=e.getNode(),s=r.getNode();if(n.isCollapsed()){if(!C(i))return;const l=i.getChildrenSize(),c=t>=l,a=c?i.getChildAtIndex(l-1):i.getChildAtIndex(t);if($(a)){let u=0;c&&(u=a.getTextContentSize()),e.set(a.__key,u,"text"),r.set(a.__key,u,"text")}return}if(C(i)){const l=i.getChildrenSize(),c=t>=l,a=c?i.getChildAtIndex(l-1):i.getChildAtIndex(t);if($(a)){let u=0;c&&(u=a.getTextContentSize()),e.set(a.__key,u,"text")}}if(C(s)){const l=s.getChildrenSize(),c=o>=l,a=c?s.getChildAtIndex(l-1):s.getChildAtIndex(o);if($(a)){let u=0;c&&(u=a.getTextContentSize()),r.set(a.__key,u,"text")}}}function Fo(n,e,t,r,o){let i=null,s=0,l=null;r!==null?(i=r.__key,$(r)?(s=r.getTextContentSize(),l="text"):C(r)&&(s=r.getChildrenSize(),l="element")):o!==null&&(i=o.__key,$(o)?l="text":C(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 cc(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 Io(n,e,t,r,o){try{n.setBaseAndExtent(e,t,r,o)}catch{}}function ac(n,e,t){const r=Wn(n,e.getKey());if(C(e)){const o=Wt(e,r,n);return[o.element,t+o.getFirstChildOffset()]}return[r,t]}function cg(n,e,t,r,o,i){const s=i.getRootNode(),l=mn(s)||ke(s)?jn(s):null;if(o.has(Ru)&&l!==i||l!==null&&Js(l,l))return;const c=Bt(r,i);let a;if(!w(e))return void(n!==null&&Ur(t,c.anchorNode,c.focusNode)&&r.removeAllRanges());const u=e.anchor,f=e.focus,d=u.getNode(),h=f.getNode(),[g,_]=ac(t,d,u.offset),[m,p]=ac(t,h,f.offset),y=e.format,x=e.style,S=e.isCollapsed();let v=g,T=m,N=!1;if(u.type==="text"?(v=$(d)?Ie(d,g,t):null,N=d.getFormat()!==y||d.getStyle()!==x):w(n)&&n.anchor.type==="text"&&(N=!0),f.type==="text"&&(T=$(h)?Ie(h,m,t):null),v!==null&&T!==null){if(S&&(n===null||N||w(n)&&(n.format!==y||n.style!==x))&&(function(k,E,M,A,P,L){k._inputState.collapsedSelectionFormat={format:E,key:P,offset:A,style:M,timeStamp:L}})(t,y,x,_,u.key,performance.now()),(r.type!=="Range"||!S)&&c.anchorOffset===_&&c.focusOffset===p&&c.anchorNode===v&&c.focusNode===T){if(l===null||!i.contains(l)){const k=l!==null?Fn(l):null;k!==null&&k!==t||o.has(es)||i.focus({preventScroll:!0})}if(u.type!=="element")return}if(Io(r,v,_,T,p),ve&&e.isCollapsed()&&i!==null&&!o.has(es)){const k=Jo(i);if(k===null||!i.contains(k)){const E=jn(i.ownerDocument),M=E!==null?Fn(E):null;M!==null&&M!==t||i.focus({preventScroll:!0})}}if(!o.has(Gh)&&e.isCollapsed()&&i!==null&&i===Jo(i)){const k=w(e)&&e.anchor.type==="element"?v.childNodes[_]||null:(a===void 0&&(a=Rg(r,i)),a);if(k!==null){let E;if(de(k)){const M=k.ownerDocument.createRange();M.selectNode(k),E=M.getBoundingClientRect()}else E=k.getBoundingClientRect();(function(M,A,P){const L=Xs(P),K=Qs(L);if(L===null||K===null)return;const U=P.getBoundingClientRect();if(A.bottom<U.top)return;let{top:Q,bottom:J}=A,kt=0,nt=0,ft=P;for(;ft!==null;){const dt=ft===L.body;if(dt){const jt=K.visualViewport;if(jt){const mt=jt.offsetTop;kt=mt,nt=mt+jt.height}else kt=0,nt=Kt(M).innerHeight;const Ee=K.getComputedStyle(L.documentElement),tr=parseFloat(Ee.scrollPaddingTop),st=parseFloat(Ee.scrollPaddingBottom);isFinite(tr)&&(kt+=tr),isFinite(st)&&(nt-=st)}else{const jt=ft===P?U:ft.getBoundingClientRect();kt=jt.top,nt=jt.bottom}let he=0;if(Q<kt?he=-(kt-Q):J>nt&&(he=J-nt),he!==0)if(dt)K.scrollBy(0,he);else{const jt=ft.scrollTop;ft.scrollTop+=he;const Ee=ft.scrollTop-jt;Q-=Ee,J-=Ee}if(dt)break;ft=_n(ft)}})(t,E,i)}}(function(k,E,M,A,P){const L=k._inputState;L.isSelectionChangeFromDOMUpdate=!0,L.selectionChangeFromDOMUpdatePoints=E!==void 0&&M!==void 0&&A!==void 0&&P!==void 0?{anchorNode:E,anchorOffset:M,focusNode:A,focusOffset:P}:null})(t,v,_,T,p)}}function ag(n){let e=D()||Gn();e===null&&(e=Y().selectEnd()),e.insertNodes(n)}function Qu(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 Zu(n){const e=[];return Qu(n,{linebreak:()=>e.push(Le()),tab:()=>e.push(Kr()),text:t=>e.push(_t(t))}),e}function is(n){const e=[];for(const t of n)Tt(t)||(!C(t)&&!H(t)||t.isInline()?e.push(t):C(t)&&e.push(...is(t.getChildren())));return e}function or(n,e=!1){let t=n;n.isCollapsed()||t.removeText();const r=D();w(r)&&(t=r),w(t)||O(161);const o=t.anchor;let i=o.getNode(),s=o.offset;for(;!Dt(i)&&Et(i)===null;){const l=i;if([i,s]=ug(i,s,e),l.is(i))break}return[i,s]}function ug(n,e,t=!1){const r=n.getParent();if(!r){const i=et();return Y().append(i),i.select(),[Y(),0]}if($(n)){const i=n.splitText(e);if(i.length===0)return[r,n.getIndexWithinParent()];const s=e===0?0:1;return[r,i[0].getIndexWithinParent()+s]}if(!C(n)||e===0)return[r,n.getIndexWithinParent()];const o=n.getChildAtIndex(e);if(o){const i=new pn(fe(n.__key,e,"element"),fe(n.__key,e,"element"),0,""),s=n.insertNewAfter(i);if(s)s.append(o,...o.getNextSiblings());else if(t)return[n,e]}return[r,n.getIndexWithinParent()+1]}function uc(n){return Tt(n)||Pg(n)||$(n)||n.isParentRequired()}function ki(n){const e=et();let t=null;for(let r=0;r<n.length;r++){const o=n[r];if(uc(o)){if(t===null){t=o.createParentElementNode(),e.append(t);const i=n[r+1];if(Tt(o)&&(i===void 0||!uc(i)))continue}t.append(o)}else e.append(o),t=null}return e}function Lo(n,e,t,r,o="decorators-and-blocks"){if(e==="move"&&r==="character"&&!n.isCollapsed()){const[f,d]=t===n.isBackward()?[n.focus,n.anchor]:[n.anchor,n.focus];return d.set(f.key,f.offset,f.type),!0}const i=zt(n.focus,t?"previous":"next"),s=r==="lineboundary",l=e==="move";let c=i,a=o==="decorators-and-blocks",u=!1;if(!cf(c)){for(const f of c){a=!1;const{origin:d}=f;if(H(d)){if(d.isIsolated()){u=!0;break}if(c=f,s&&d.isInline())continue}break}if(u)return!0;if(a)for(const f of hi(i).iterNodeCarets(e==="extend"?"shadowRoot":"root")){if(Qt(f))f.origin.isInline()||(c=f);else{if(C(f.origin))continue;H(f.origin)&&!f.origin.isInline()&&(c=f)}break}}if(c===i)return!1;if(l&&!s&&H(c.origin)&&c.origin.isKeyboardSelectable()){const f=Ks();return f.add(c.origin.getKey()),Ct(f),!0}return c=Ft(c),l&&Re(n.anchor,c),Re(n.focus,c),a||!s}let bt=null,pt=null,Rt=!1,Ni=!1,po=!1;const Ei=new Set;let mo=0;const fc={characterData:!0,childList:!0,subtree:!0};function on(){return Rt||bt!==null&&bt._readOnly}function xt(){Rt&&O(13)}function tf(){mo>99&&O(14)}function re(){return bt===null&&O(195,ef()),bt}function fg(n){re()!==null&&pt===null&&(pt=n),pt!==n&&ja(378)}function G(){return pt===null&&O(337,ef()),pt}function dg(){G()._dirtyType=2}function ef(){let n=0;const e=new Set,t=sn.version;if(typeof window<"u")for(const o of Nf(document)){const i=Xn(o);if(jr(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 nf(){return pt}function dc(n,e,t){const r=e.__type,o=gf(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 hc(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function rf(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 hg(n){return Ro(n,G()._nodes)}function Ro(n,e){const t=n.type,r=e.get(t);r===void 0&&O(17,t);const o=r.klass;n.type!==o.getType()&&O(18,o.name);const i=o.importJSON(n),s=n.children;if(C(i)&&Array.isArray(s))for(let c=0;c<s.length;c++){const a=Ro(s[c],e);i.append(a)}const l=n.$slots;if(l){Ze(i)||O(379,o.name);for(const c in l)tp(i,c,Ro(l[c],e))}return i}function gc(n,e,t){const r=bt,o=Rt,i=pt;bt=e,Rt=!0,pt=n;try{return t()}finally{bt=r,Rt=o,pt=i}}function Me(n,e){const t=po;po=!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&&pc(r,r._deferred));const c=r._editorState,a=c._selection,u=i._selection,f=r._dirtyType!==0,d=bt,h=Rt,g=pt,_=r._updating,m=r._observer;let p=null;if(r._pendingEditorState=null,r._editorState=i,!l&&f&&m!==null){pt=r,bt=i,Rt=!1,r._updating=!0;try{const k=r._dirtyType,E=r._dirtyElements,M=r._dirtyLeaves;m.disconnect(),p=Nh(c,i,r,k,E,M)}catch(k){if(k instanceof Error&&r._onError(k),Ni)throw k;return df(r,null,s,i),ru(r),r._dirtyType=2,Ni=!0,Me(r,c),void(Ni=!1)}finally{m.observe(s,fc),r._updating=_,bt=d,Rt=h,pt=g}}i._readOnly||(i._readOnly=!0);const y=r._dirtyLeaves,x=r._dirtyElements,S=r._normalizedNodes,v=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(k,E){const M=k._decorators;let A=k._pendingDecorators||M;const P=E._nodeMap;let L;for(L in A)P.has(L)||(A===M&&(A=xf(k)),delete A[L])})(r,i);const T=l?null:Lt(Kt(r));if(r._editable&&T!==null&&(f||u===null||u.dirty||!u.is(a))&&s!==null&&!v.has(Yh)){pt=r,bt=i;try{if(m!==null&&m.disconnect(),f||u===null||u.dirty){const k=r._blockCursorElement;k!==null&&Ho(k,r,s),cg(a,u,r,T,v,s)}(function(k,E,M){let A=k._blockCursorElement;if(w(M)&&M.isCollapsed()&&M.anchor.type==="element"&&E.contains(Jo(E))){const P=M.anchor,L=P.getNode(),K=P.offset;let U=!1,Q=null;if(K===L.getChildrenSize())Mr(L.getChildAtIndex(K-1))&&(U=!0);else{const J=L.getChildAtIndex(K);J!==null&&Mr(J)&&(U=!0,Q=k.getElementByKey(J.__key))}if(U){const J=Wt(L,k.getElementByKey(L.__key),k).element;return A===null&&(k._blockCursorElement=A=(function(kt){const nt=kt.theme,ft=it().createElement("div");ft.contentEditable="false",ft.setAttribute("data-lexical-cursor","true");let dt=nt.blockCursor;if(dt!==void 0){if(typeof dt=="string"){const he=ue(dt);dt=nt.blockCursor=he}dt!==void 0&&ft.classList.add(...dt)}return ft})(k._config)),E.style.caretColor="transparent",void(Q===null?J.appendChild(A):J.insertBefore(A,Q))}}A!==null&&Ho(A,k,E)})(r,s,u)}finally{m!==null&&m.observe(s,fc),pt=g,bt=d}}p!==null&&(function(k,E,M,A,P){const L=Array.from(k._listeners.mutation),K=L.length;for(let U=0;U<K;U++){const[Q,J]=L[U];for(const kt of J){const nt=E.get(kt);nt!==void 0&&Q(nt,{dirtyLeaves:A,prevEditorState:P,updateTags:M})}}})(r,p,v,y,c),w(u)||u===null||a!==null&&a.is(u)||r.dispatchCommand(mu);const N=r._pendingDecorators;N!==null&&(r._decorators=N,r._pendingDecorators=null,hr("decorator",r,!0,N)),(function(k,E,M){const A=xc(E),P=xc(M);A!==P&&hr("textcontent",k,!0,P)})(r,o||c,i),hr("update",r,!0,{dirtyElements:x,dirtyLeaves:y,editorState:i,mutatedNodes:p,normalizedNodes:S,prevEditorState:o||c,tags:v}),!_&&pc(r,r._deferred),(function(k){const E=k._updates;if(E.length===0)return void(k._cascadeCount=0);if((function(A){Ei.has(A)||(Ei.add(A),setTimeout(()=>{Ei.delete(A),A._cascadeCount=0},0))})(k),k._cascadeCount++>99)return k._updates=[],k._cascadeCount=0,void k._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: ${k._config.namespace}`));const M=E.shift();if(M){const[A,P]=M;Or(k,A,P)}})(r)})(n,e)}finally{po=t}}function hr(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),u=typeof a=="function"?a:void 0;i.has(l)?i.set(l,u):u&&u()}}finally{e._updating=o}}function of(n,e,t,r){const o=Vs(n);let i;if(!po)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(Gt(c,()=>{for(const d of u)if(d(t,r))return void(f=!0)}),f)return f}}}return i&&i.update(()=>{of(i,e,t,r)}),!1}function pc(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 mc(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&&O(191),l._flushSync=!0),c&&n._deferred.push(c),rf(n,s.tag)),l==null?Or(n,i,s):i()}}return r}function gg(){const n=re();xt(),n._flushSync=!0}function Or(n,e,t){const r=n._updateTags;let o,i=!1,s=!1;t!==void 0&&(o=t.onUpdate,rf(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=lf(c||l),a=!0),c._flushSync=s;const u=bt,f=Rt,d=pt,h=n._updating;bt=c,Rt=!1,n._updating=!0,pt=n;const g=n._headless||n.getRootElement()===null;Us(null);try{a&&(g?l._selection!==null&&(c._selection=l._selection.clone()):c._selection=(function(y,x){const S=y.getEditorState()._selection,v=Lt(Kt(y));return w(S)||S==null?Po(S,v,y,x):S.clone()})(n,t&&t.event||null));const m=n._compositionKey;e(),i=mc(n,i),(function(y,x){const S=x.getEditorState()._selection,v=y._selection;if(w(v)){const T=v.anchor,N=v.focus;let k;if(T.type==="text"&&(k=T.getNode(),k.selectionTransform(S,v)),N.type==="text"){const E=N.getNode();k!==E&&E.selectionTransform(S,v)}}})(c,n),n._dirtyType!==0&&(i?(function(y,x){const S=x._dirtyLeaves,v=y._nodeMap;for(const T of S){const N=v.get(T);$(N)&&N.isAttached()&&N.isSimpleText()&&!N.isUnmergeable()&&Ol(N)}})(c,n):(function(y,x){const S=x._dirtyLeaves,v=x._dirtyElements,T=y._nodeMap,N=le(),k=new Map;let E=S,M=E.size,A=v,P=A.size;for(;M>0||P>0;){if(M>0){x._dirtyLeaves=new Set;for(const L of E){const K=T.get(L);$(K)&&K.isAttached()&&K.isSimpleText()&&!K.isUnmergeable()&&Ol(K),K!==void 0&&hc(K,N)&&dc(x,K,k),S.add(L)}if(E=x._dirtyLeaves,M=E.size,M>0){mo++;continue}}x._dirtyLeaves=new Set,x._dirtyElements=new Map,A.delete("root")&&A.set("root",!0);for(const L of A){const K=L[0],U=L[1];if(v.set(K,U),!U)continue;const Q=T.get(K);Q!==void 0&&hc(Q,N)&&dc(x,Q,k)}E=x._dirtyLeaves,M=E.size,A=x._dirtyElements,P=A.size,mo++}x._dirtyLeaves=S,x._dirtyElements=v})(c,n),mc(n),(function(y,x,S,v){const T=y._nodeMap,N=x._nodeMap,k=[];for(const[A]of v){const P=N.get(A);P!==void 0&&(P.isAttached()||(C(P)&&ko(P,A,T,N,k,v),T.has(A)||v.delete(A),k.push(A)))}for(const A of S){const P=N.get(A);P===void 0||P.isAttached()||(Ze(P)&&P.__slots!==null&&ko(P,A,T,N,k,S),T.has(A)||S.delete(A),k.push(A))}for(const A of k)N.delete(A);const E=G(),M=E._compositionKey;M===null||N.has(M)||(E._compositionKey=null)})(l,c,n._dirtyLeaves,n._dirtyElements)),m!==n._compositionKey&&(c._flushSync=!0);const p=c._selection;if(w(p)){n._slotsUsed&&Gu(p);const y=c._nodeMap,x=p.anchor.key,S=p.focus.key;y.get(x)!==void 0&&y.get(S)!==void 0||O(19)}else at(p)&&p._nodes.size===0&&(c._selection=null)}catch(m){return m instanceof Error&&n._onError(m),n._pendingEditorState=l,n._dirtyType=2,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),void Me(n)}finally{bt=u,Rt=f,pt=d,n._updating=h,mo=0}n._dirtyType!==0||n._deferred.length>0||(function(m,p){const y=p.getEditorState()._selection,x=m._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,Me(n)):a&&Og(()=>{Me(n)}):(c._flushSync=!1,a&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function Gt(n,e,t){pt===n&&t===void 0?on()?Or(n,e,t):e():Or(n,e,t)}function pg(n){if(Z(n)){let e=null;for(const t of n.getChildren())e=t.isInline()?(e||t.replace(t.createParentElementNode())).append(t):null}}class yt extends Pt{constructor(t){super(t);b(this,"__first");b(this,"__last");b(this,"__size");b(this,"__format");b(this,"__style");b(this,"__indent");b(this,"__dir");b(this,"__textFormat");b(this,"__textStyle");b(this,"__slotHost");b(this,"__slots");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}$config(){return this.config(Symbol.for("ElementNode"),{$transform:pg,extends:Pt})}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size,this.__slotHost=t.__slotHost,this.__slotHost!==null&&this.__parent!==null&&O(384,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=t.__slots),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const t=this.getFormat();return fh[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const t=[];let r=this.getFirstChild();for(;r!==null;)t.push(r),r=r.getNextSibling();return t}getChildrenKeys(){const t=[];let r=this.getFirstChild();for(;r!==null;)t.push(r.__key),r=r.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0&&ce(this).length===0}isDirty(){const t=G()._dirtyElements;return t!==null&&t.has(this.__key)}isLastChild(){const t=this.getLatest(),r=this.getParentOrThrow().getLastChild();return r!==null&&r.is(t)}getAllTextNodes(){const t=[];for(const o of ce(this)){const i=Hn(this,o);if(C(i))for(const s of i.getAllTextNodes())t.push(s)}let r=this.getFirstChild();for(;r!==null;){if($(r)&&t.push(r),C(r))for(const o of r.getAllTextNodes())t.push(o);r=r.getNextSibling()}return t}getFirstDescendant(){let t=this.getFirstChild();for(;C(t);){const r=t.getFirstChild();if(r===null)break;t=r}return t}getLastDescendant(){let t=this.getLastChild();for(;C(t);){const r=t.getLastChild();if(r===null)break;t=r}return t}getDescendantByIndex(t){const r=this.getChildren(),o=r.length;if(t>=o){const s=r[o-1];return C(s)&&s.getLastDescendant()||s||null}const i=r[t];return C(i)&&i.getFirstDescendant()||i||null}getFirstChild(){const t=this.getLatest().__first;return t===null?null:rt(t)}getFirstChildOrThrow(){const t=this.getFirstChild();return t===null&&O(45,this.__key),t}getLastChild(){const t=this.getLatest().__last;return t===null?null:rt(t)}getLastChildOrThrow(){const t=this.getLastChild();return t===null&&O(96,this.__key),t}getChildAtIndex(t){const r=this.getChildrenSize();let o,i;if(t<r/2){for(o=this.getFirstChild(),i=0;o!==null&&i<=t;){if(i===t)return o;o=o.getNextSibling(),i++}return null}for(o=this.getLastChild(),i=r-1;o!==null&&i>=t;){if(i===t)return o;o=o.getPreviousSibling(),i--}return null}getTextContent(){let t=If(this);const r=this.getChildren(),o=r.length;for(let i=0;i<o;i++){const s=r[i];t+=s.getTextContent(),C(s)&&i!==o-1&&!s.isInline()&&(t+=Xe)}return t}getTextContentSize(){let t=(function(i){let s=0;for(const l of ce(i)){const c=Hn(i,l);c!==null&&(s+=c.getTextContentSize())}return s})(this);const r=this.getChildren(),o=r.length;for(let i=0;i<o;i++){const s=r[i];t+=s.getTextContentSize(),C(s)&&i!==o-1&&!s.isInline()&&(t+=2)}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(t!==""){const r=bo[t];return(this.getFormat()&r)!==0}return!1}hasTextFormat(t){const r=Te[t];return(this.getTextFormat()&r)!==0}getFormatFlags(t,r){return ln(this.getLatest().__textFormat,t,r)}getTextStyle(){return this.getLatest().__textStyle}select(t,r){xt();const o=D();let i=t,s=r;const l=this.getChildrenSize();if(!this.canBeEmpty()){if(t===0&&r===0){const a=this.getFirstChild();if($(a)||C(a))return a.select(0,0)}else if(!(t!==void 0&&t!==l||r!==void 0&&r!==l)){const a=this.getLastChild();if($(a)||C(a))return a.select()}}i===void 0&&(i=l),s===void 0&&(s=l);const c=this.__key;return w(o)?(o.anchor.set(c,i,"element"),o.focus.set(c,s,"element"),o.dirty=!0,o):Xu(c,i,c,s,"element","element")}selectStart(){const t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){const t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){const t=this.getWritable();return this.getChildren().forEach(r=>r.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){const r=this.getWritable();return r.__dir=t,r}setFormat(t){return this.getWritable().__format=t!==""&&bo[t]||0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){const r=this.getWritable();return r.__textFormat=t,r}setTextStyle(t){const r=this.getWritable();return r.__textStyle=t,r}setIndent(t){return this.getWritable().__indent=t,this}splice(t,r,o){$o(this)&&O(324,this.__key,this.__type);const i=this.getChildrenSize(),s=this.getWritable();t+r<=i||O(226,String(t),String(r),String(i));for(const g of o);const l=s.__key,c=[],a=[];let u=this.getChildAtIndex(t+r),f=null,d=i-r+o.length;if(t!==0)if(t===i)f=this.getLastChild();else{const g=this.getChildAtIndex(t);g!==null&&(f=g.getPreviousSibling())}if(r>0){let g=f===null?this.getFirstChild():f.getNextSibling();for(let _=0;_<r;_++){g===null&&O(100);const m=g.getNextSibling(),p=g.__key;Se(g.getWritable()),a.push(p),g=m}}let h=f;for(const g of o){h!==null&&g.is(h)&&(f=h=h.getPreviousSibling()),u!==null&&g.is(u)&&(u=u.getNextSibling());const _=g.getWritable();_.__parent===l&&d--,Se(_);const m=g.__key;if(h===null)s.__first=m,_.__prev=null;else{const p=h.getWritable();p.__next=m,_.__prev=p.__key}g.__key===l&&O(76),_.__parent=l,c.push(m),h=g}if(u===null)h!==null&&(h.getWritable().__next=null,s.__last=h.__key);else{const g=u.getWritable();if(h!==null){const _=h.getWritable();g.__prev=h.__key,_.__next=u.__key}else g.__prev=null}if(s.__size=d,a.length){const g=D();if(w(g)){const _=new Set(a),m=new Set(c),{anchor:p,focus:y}=g;_c(p,_,m)&&Fo(p,p.getNode(),this,f,u),_c(y,_,m)&&Fo(y,y.getNode(),this,f,u),d!==0||this.canBeEmpty()||Z(this)||this.remove()}}return s}getDOMSlot(t){return new Ya(t)}exportDOM(t){const{element:r}=super.exportDOM(t);if(q(r)){const o=this.getIndent();o>0&&(r.style.paddingInlineStart=40*o+"px",r.setAttribute("data-lexical-indent",String(o)));const i=this.getDirection();i&&(r.dir=i)}return{element:r}}exportJSON(){const t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},r=this.getTextFormat(),o=this.getTextStyle();return r===0&&o===""||Z(this)||this.getChildren().some($)||(r!==0&&(t.textFormat=r),o!==""&&(t.textStyle=o)),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,r){return null}canIndent(){return!0}collapseAtStart(t){return!1}excludeFromCopy(t){return!1}canReplaceWith(t){return!0}canInsertAfter(t){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(t){return!1}extractWithChild(t,r,o){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(t,r){const o=Wt(this,t,r);let i=o.getFirstChild();for(let s=this.getFirstChild();s;s=s.getNextSibling()){const l=r.getElementByKey(s.getKey());l!==null&&(i==null?(o.insertChild(l),i=l):i!==l&&o.replaceChild(l,i),i=i.nextSibling)}}}function C(n){return n instanceof yt}function _c(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 sf extends Pt{constructor(t){super(t);b(this,"__slotHost");b(this,"__slots");this.__slotHost=null,this.__slots=null}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__slotHost=t.__slotHost,this.__slotHost!==null&&this.__parent!==null&&O(383,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=t.__slots)}decorate(t,r){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function H(n){return n instanceof sf}class si extends yt{constructor(){super("root");b(this,"__cachedText");this.__cachedText=null}$config(){return this.config("root",{extends:yt})}getTopLevelElementOrThrow(){O(51)}getTextContent(){const t=this.__cachedText;return t===null||!on()&&G()._dirtyType!==0?super.getTextContent():t}remove(){O(52)}replace(t){O(53)}insertBefore(t){O(54)}insertAfter(t){O(55)}updateDOM(t,r){return!1}splice(t,r,o){for(const i of o)C(i)||H(i)||O(282);return super.splice(t,r,o)}static importJSON(t){return Y().updateFromJSON(t)}collapseAtStart(){return!0}}function ut(n){return n instanceof si}function lf(n){return new zr(Za(n._nodeMap),null,n._slotsUsed)}function zs(){return new zr(new Map([["root",new si]]),null,!1)}function ss(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType()&&O(130,t.name),C(n)){const o=e.children;Array.isArray(o)||O(59,t.name);const i=n.getChildren();for(let s=0;s<i.length;s++){const l=ss(i[s]);o.push(l)}}const r=ce(n);if(r.length>0){const o={};for(const i of r){const s=Hn(n,i);s===null&&O(366,t.name,i),o[i]=ss(s)}e.$slots=o}return e}function mg(n){return n instanceof zr}class zr{constructor(e,t=null,r=!1){b(this,"_nodeMap");b(this,"_selection");b(this,"_flushSync");b(this,"_readOnly");b(this,"_parsed");b(this,"_slotsUsed");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 gc(t&&t.editor||null,this,e)}clone(e){const t=new zr(this._nodeMap,e===void 0?this._selection:e,this._slotsUsed);return t._readOnly=!0,t._parsed=this._parsed,t}toJSON(){return gc(null,this,()=>({root:ss(Y())}))}}class Ws extends yt{$config(){return this.config("artificial",{extends:yt})}createDOM(e){return it().createElement("div")}}class li extends Pt{$config(){return this.config("linebreak",{importDOM:{br:e=>yg(e)||xg(e)?null:{conversion:_g,priority:0}}})}getTextContent(){return`
|
|
11
|
-
`}createDOM(){return it().createElement("br")}updateDOM(){return!1}isInline(){return!0}}function _g(n){return{node:Le()}}function Le(){return oe(new li)}function Tt(n){return n instanceof li}function yg(n){const e=n.parentElement;if(e!==null&&Ar(e)){const t=e.firstChild;if(t===n||t.nextSibling===n&&Bo(t)){const r=e.lastChild;if(r===n||r.previousSibling===n&&Bo(r))return!0}}return!1}function xg(n){const e=n.parentElement;if(e!==null&&Ar(e)){const t=e.firstChild;if(t===n||t.nextSibling===n&&Bo(t))return!1;const r=e.lastChild;if(r===n||r.previousSibling===n&&Bo(r))return!0}return!1}function Bo(n){return de(n)&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}function zt(n,e){const{type:t,key:r,offset:o}=n,i=Fg(n.key);return t==="text"?($(i)||O(266,i.getType(),r),Ke(i,e,o)):(C(i)||O(267,i.getType(),r),ls(i,n.offset,e))}function Re(n,e){const{origin:t,direction:r}=e,o=r==="next";Xt(e)?n.set(t.getKey(),e.offset,"text"):Be(e)?$(t)?n.set(t.getKey(),ae(t,r),"text"):n.set(t.getParentOrThrow().getKey(),t.getIndexWithinParent()+(o?1:0),"element"):(Qt(e)&&C(t)||O(268),n.set(t.getKey(),o?0:t.getChildrenSize(),"element"))}function zn(n){const e=D(),t=w(e)?e:Bs();return _o(t,n),Ct(t),t}function _o(n,e){Re(n.anchor,e.anchor),Re(n.focus,e.focus)}function Ko(n){const{anchor:e,focus:t}=n,r=zt(e,"next"),o=zt(t,"next"),i=ze(r,o)<=0?"next":"previous";return Zt(ne(r,i),ne(o,i))}function We(n){const{direction:e,origin:t}=n,r=X(t,Ue(e)).getNodeAtCaret();return r?X(r,e):It(t.getParentOrThrow(),e)}function yc(n,e="root"){const t=[n];for(let r=Qt(n)?n.getParentCaret(e):n.getSiblingCaret();r!==null;r=r.getParentCaret(e))t.push(We(r));return t}function wi(n){return!!n&&n.origin.isAttached()}function Sg(n,e="removeEmptySlices"){if(n.isCollapsed())return n;const t="root",r="next";let o=e;const i=Wr(n,r);let s=i.anchor.origin;for(;s!==null&&!Z(s);)s=s.getParent();const l=C(s)?s.getFirstChild():null,c=yc(i.anchor,t),a=yc(i.focus.getFlipped(),t),u=new Set,f=[];for(const p of i.iterNodeCarets(t))if(Qt(p))u.add(p.origin.getKey());else if(Be(p)){const{origin:y}=p;C(y)&&!u.has(y.getKey())||f.push(y)}const d=new Set;for(const p of f){const y=p.getParent();y===null||u.has(y.getKey())||d.add(y),Se(p)}for(const p of d)!p.canBeEmpty()&&!Z(p)&&p.isEmpty()&&p.isAttached()&&p.remove();for(const p of i.getTextSlices()){if(!p)continue;const{origin:y}=p.caret,x=y.getTextContentSize(),S=We(X(y,r)),v=y.getMode();if(Math.abs(p.distance)===x&&o==="removeEmptySlices"||v==="token"&&p.distance!==0)S.remove();else if(p.distance!==0){o="removeEmptySlices";let T=p.removeTextSlice();const N=p.caret.origin;if(v==="segmented"){const k=T.origin,E=_t(k.getTextContent()).setStyle(k.getStyle()).setFormat(k.getFormat());S.replaceOrInsert(E),T=Ke(E,r,T.offset)}N.is(c[0].origin)&&(c[0]=T),N.is(a[0].origin)&&(a[0]=T.getFlipped())}}let h,g;for(const p of c)if(wi(p)){h=Ft(p);break}for(const p of a)if(wi(p)){g=Ft(p);break}const _=(function(p,y,x){if(!p||!y)return null;const S=p.getParentAtCaret(),v=y.getParentAtCaret();if(!S||!v)return null;const T=S.getParents().reverse();T.push(S);const N=v.getParents().reverse();N.push(v);const k=Math.min(T.length,N.length);let E;for(E=0;E<k&&T[E]===N[E];E++);const M=(L,K)=>{let U;for(let Q=E;Q<L.length;Q++){const J=L[Q];if(Z(J))return;!U&&K(J)&&(U=J)}return U},A=M(T,Dt),P=A&&M(N,L=>x.has(L.getKey())&&Dt(L));return P&&ce(P).length>0?null:A&&P?[A,P]:null})(h,g,u);if(_){const[p,y]=_;It(p,"previous").splice(0,y.getChildren());let x=y.getParent();for(y.remove(!0);x&&x.isEmpty();){const S=x;x=x.getParent(),S.remove(!0)}}else if(g){const p=(function(S){if(Qt(S)){const v=S.origin;if(Dt(v))return v}else{const v=S.getParentAtCaret();if(v&&Dt(v))return v}return null})(g),y=p&&p.getParent(),x=p&&p.getParents().findLast(gr);if(p&&y&&!ut(y)&&p.isEmpty()&&u.has(p.getKey())&&ce(p).length===0&&(!x||u.has(x.getKey()))){p.remove(!0);let S=y;for(;S&&!ut(S)&&S.isEmpty();){const v=S.getParent();if(v&&ut(v)&&v.getChildrenSize()<=1)break;const T=S;S=v,T.remove(!0)}}}jo(s,l)===null&&jo(Y(),null);const m=[h,g,...c,...a].find(wi);if(m)return gi(ne(Ft(m),n.direction));O(269,JSON.stringify(c.map(p=>p.origin.__key)))}function Ft(n){const e=(function(o){let i=o;for(;Qt(i);){const s=ol(i);if(!Qt(s))break;i=s}return i})(n.getLatest()),{direction:t}=e;if($(e.origin))return Xt(e)?e:Ke(e.origin,t,t);const r=e.getAdjacentCaret();return Be(r)&&$(r.origin)?Ke(r.origin,t,Ue(t)):e}function cf(n){return Xt(n)&&n.offset!==ae(n.origin,n.direction)}function Wr(n,e){return n.direction===e?n:Zt(ne(n.focus,e),ne(n.anchor,e))}function ls(n,e,t){let r=It(n,"next");for(let o=0;o<e;o++){const i=r.getAdjacentCaret();if(i===null)break;r=i}return ne(r,t)}function Cg(n){const{origin:e,offset:t,direction:r}=n;if(t===ae(e,r))return n.getSiblingCaret();if(t===ae(e,Ue(r)))return We(n.getSiblingCaret());const[o]=e.splitText(t);return $(o)||O(281),ne(X(o,"next"),r)}function vg(n,e){return!0}function af(n,{$copyElementNode:e=Ot,$splitTextPointCaretNext:t=Cg,rootMode:r="shadowRoot",$shouldSplit:o=vg,removeEmptyDestination:i=!1}={}){if(Xt(n))return t(n);const s=n.getParentCaret(r);if(s){const{origin:l}=s;if(Qt(n)){const a=We(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 uf(n,e,t){let r=ne(e,"next");Xt(r)&&(r.offset===0?r=X(r.origin,"previous").getFlipped():r.offset===r.origin.getTextContentSize()&&(r=X(r.origin,"next"))),r.origin.is(n)&&(Be(r)||O(342,n.getKey(),n.getType()),r=We(r)),(n.is(r.getNodeAtCaret())||n.is(r.getFlipped().getNodeAtCaret()))&&n.remove(!0);for(let o=r;o;o=af(o,t))r=o;return Xt(r)&&O(283),r.insert(n.isInline()?et().append(n):n),ne(X(n.getLatest(),"next"),e.direction)}function ff(n,e){const t=Wr(w(e)?Ko(e):e,"next"),r=Dr(t.anchor.origin),o=Dr(n.getLatest());if(r===null?o!==null:!r.is(o))return!1;const i=Ft(It(n,"next")),s=ne(Ft(It(n,"previous")),"next");return ze(t.anchor,i)<=0&&ze(t.focus,s)>=0}class ci extends yt{$config(){return this.config("paragraph",{extends:yt,importDOM:{p:()=>({conversion:bg,priority:0})}})}createDOM(e){const t=it().createElement("p"),r=In(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(q(t)){this.isEmpty()&&t.append(it().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($);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}extractWithChild(e,t,r){if(!w(t)||this.getFormatType()===""&&this.getIndent()===0&&this.getStyle()==="")return!1;if(ff(this,t)){const o=this.getTextContent();return o!==""&&t.getTextContent()===o}return!1}insertNewAfter(e,t){const r=et();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(){if(this.getChildren().every(e=>$(e)&&!/\S/.test(e.getTextContent()))){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function bg(n){const e=et();if(fi(e,n),Zs(n,e),e.getFormatType()===""){const t=n.getAttribute("align");t&&t&&t in bo&&e.setFormat(t)}return Hr(e,n),{node:e}}function et(){return oe(new ci)}function Yn(n){return n instanceof ci}function Tg(n){console.warn(n)}const z=0,kn=1,xe=4,kg=-8;function df(n,e,t,r,o){const i=n._keyToDOMMap;i.clear(),n._editorState=zs(),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,selectionChangeFromDOMUpdatePoints: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),yf(t,n,"root"))}function Ng(n){const e=new Set,t=new Set;for(const{klass:r,ownNodeConfig:o}of el(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 zo={$createDOM:(n,e)=>n.createDOM(e._config,e),$decorateDOM:(n,e,t,r)=>{},$exportDOM:(n,e)=>{const t=Hs(e,n.getType());return t&&t.exportDOM!==void 0?t.exportDOM(e,n):n.exportDOM(e)},$extractWithChild:(n,e,t,r,o)=>C(n)&&n.extractWithChild(e,t,r),$getDOMSlot:(n,e,t)=>n.getDOMSlot(e),$getSlotTargetElement:(n,e,t,r)=>null,$shouldExclude:(n,e,t)=>C(n)&&n.excludeFromCopy("html"),$shouldInclude:(n,e,t)=>!e||n.isSelected(e),$updateDOM:(n,e,t,r)=>n.updateDOM(e,t,r._config)};function hf(n){const e=n||{},t=nf(),r=e.theme||{},o=n===void 0?t:e.parentEditor||null,i=e.disableEvents||!1,s=zs(),l=e.namespace||(o!==null?o._config.namespace:Cf()),c=e.editorState,a=[si,ee,li,oi,ci,Ws,...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 m=0;m<a.length;m++){let p=a[m],y=null,x=null;if(p&&typeof p=="object"){const T=p;p=T.replace,y=T.with,x=T.withKlass||null}if(typeof p!="function"||!p.prototype||!(p===Pt||p.prototype instanceof Pt)){let T="<unknown>";try{T=JSON.parse(Qa)}catch{}O(365,String(m-a.length+(e.nodes?e.nodes.length:0)),typeof p=="function"?`${p.name}${typeof p.getType=="function"?` (type ${String(p.getType())})`:""}`:String(p),String(T))}tl(p);const S=p.getType(),v=Ng(p);g.set(S,{exportDOM:d&&d.export?d.export.get(p):void 0,klass:p,replace:y,replaceWithKlass:x,sharedNodeState:Sh(a[m]),transforms:v})}}const _=new sn(s,o,g,{disableEvents:i,dom:{...zo,...n&&n.dom},namespace:l,theme:r},u||console.error,f||Tg,(function(m,p){const y=new Map,x=new Set,S=v=>{Object.keys(v).forEach(T=>{let N=y.get(T);N===void 0&&(N=[],y.set(T,N)),N.push(v[T])})};return m.forEach(v=>{const T=v.klass.importDOM;if(T==null||x.has(T))return;x.add(T);const N=T.call(v.klass);N!==null&&S(N)}),p&&S(p),y})(g,d?d.import:void 0),h,n);return c!==void 0&&(_._pendingEditorState=c,_._dirtyType=2),(function(m){m.registerCommand(yu,Uh,z),m.registerCommand(xu,jh,z),m.registerCommand(Su,Hh,z),m.registerCommand(Cu,Jh,z),m.registerCommand(vu,Vh,z)})(_),_}function Eg(n,e){const t=n.get(e);n.delete(e),t&&t()}function ir(n,e,t){return n.set(e,t),Eg.bind(null,n,e)}class sn{constructor(e,t,r,o,i,s,l,c,a){b(this,"_headless");b(this,"_parentEditor");b(this,"_rootElement");b(this,"_editorState");b(this,"_pendingEditorState");b(this,"_compositionKey");b(this,"_deferred");b(this,"_keyToDOMMap");b(this,"_updates");b(this,"_updating");b(this,"_cascadeCount");b(this,"_listeners");b(this,"_commands");b(this,"_nodes");b(this,"_decorators");b(this,"_pendingDecorators");b(this,"_config");b(this,"_dirtyType");b(this,"_cloneNotNeeded");b(this,"_dirtyLeaves");b(this,"_dirtyElements");b(this,"_normalizedNodes");b(this,"_updateTags");b(this,"_observer");b(this,"_key");b(this,"_onError");b(this,"_onWarn");b(this,"_htmlConversions");b(this,"_window");b(this,"_editable");b(this,"_blockCursorElement");b(this,"_slotsUsed");b(this,"_keyDownShortcuts");b(this,"_inputState");b(this,"_createEditorArgs");this._createEditorArgs=a,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Bi,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=Cf(),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._keyDownShortcuts=null,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,selectionChangeFromDOMUpdatePoints:null,unprocessedBeforeInputData:null}}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){return ir(this._listeners.update,e)}registerEditableListener(e){return ir(this._listeners.editable,e)}registerDecoratorListener(e){return ir(this._listeners.decorator,e)}registerTextContentListener(e){return ir(this._listeners.textcontent,e)}registerRootListener(e){const t=this._listeners.root;return Ut(ir(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&&O(35);const o=this._commands;o.has(e)||o.set(e,[new nr,new nr,new nr,new nr,new nr]);const i=o.get(e);i===void 0&&O(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&&O(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const r=this._editorState,o=Tc(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=Tc(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=rt(f);d&&d.markDirty()}},s._pendingEditorState===null?{tag:Dn}: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 R(this,e,...t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const r=In(this._config.theme,"root"),o=this._pendingEditorState||this._editorState;if(this._rootElement=e,df(this,t,e,o,{preserveUpdateQueue:!0}),t!==null&&(this._config.disableEvents||qh(t),r!=null&&t.classList.remove(...r)),e!==null){const i=Qs(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,ru(this),this._updateTags.add(Dn),Me(this),this._config.disableEvents||(function(l,c){const a=l.ownerDocument;Qi.set(l,a);let u=wo.get(a);u===void 0&&(u={editors:new Set,hasShadowEditor:void 0},wo.set(a,u)),u.editors.add(c),u.hasShadowEditor=void 0,l.__lexicalEditor=c;const f=Du(l);f.push(Wh.register(a));for(let d=0;d<Xi.length;d++){const[h,g]=Xi[d],_=typeof g=="function"?m=>{ql(m)||(Vl(m),(c.isEditable()||h==="click")&&g(m,c))}:m=>{if(ql(m))return;Vl(m);const p=c.isEditable();switch(h){case"cut":return p&&R(c,Ls,m);case"copy":return R(c,ri,m);case"paste":return p&&R(c,ni,m);case"dragstart":return p&&R(c,Eu,m);case"dragover":return p&&R(c,Is,m);case"dragend":return p&&R(c,Ah,m);case"focus":return p&&R(c,Fh,m);case"blur":return p&&R(c,Ih,m);case"drop":return p&&R(c,Fs,m)}};f.push(zh(l,h,_))}})(e,this),r!=null&&e.classList.add(...r)}else this._window=null,this._updateTags.add(Dn),Me(this);hr("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&O(38);let r=e;r._readOnly&&(r=lf(e),r._selection=e._selection?e._selection.clone():null),nu(this);const o=this._pendingEditorState,i=t!==void 0?t.tag:null;o===null||o.isEmpty()||(i!=null&&this._updateTags.add(i),Me(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,this._slotsUsed=this._slotsUsed||e._slotsUsed,Gt(this,()=>{if(i&&this._updateTags.add(i),e._parsed)for(const[s,l]of r._nodeMap.entries())C(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=zs(),l=bt,c=Rt,a=pt,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,bt=s,Rt=!1,pt=o,Us(null);try{const g=o._nodes;Ro(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,bt=l,Rt=c,pt=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"&&Me(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]):Or(r,o,i)})(this,e,t)}focus(e,t={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),Gt(this,()=>{const o=D(),i=Y();o!==null?o.dirty||Ct(o.clone()):i.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?i.selectStart():i.selectEnd()),an("focus"),Dg(()=>{r.removeAttribute("autocapitalize"),e&&e()})}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=Lt(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,hr("editable",this,!0,e),this._slotsUsed&&this.update(()=>dg()))}toJSON(){return{editorState:this._editorState.toJSON()}}}b(sn,"version");sn.version=Qa;let cs=null;function Us(n){cs=n}const js=Symbol("INTERNAL_SKIP_AFTER_CLONE_FROM");let wg=1;function gf(n,e){const t=Hs(n,e);return t===void 0&&O(30,e),t}function Hs(n,e){return n._nodes.get(e)}const Og=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function Js(n,e){const t=e!==void 0?e:(()=>{const i=n.getRootNode();return mn(i)||ke(i)?jn(i):null})();if(!q(t)||t.hasAttribute("data-lexical-slot"))return!1;const r=cn(t),o=t.nodeName;return Fu(r)&&(o==="INPUT"||o==="TEXTAREA"||t.contentEditable==="true"&&Xn(t)==null)}function Ur(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 Fn(e)===n&&n.read("latest",()=>!Js(e))}function jr(n){return n instanceof sn}function Fn(n){let e=n;for(;e!=null;){const t=Xn(e);if(jr(t))return t;e=_n(e)}return null}function Xn(n){return n?n.__lexicalEditor:null}function Wo(n){return rn(n)||n.isToken()}function Yt(n){return Wo(n)||n.isSegmented()}function de(n){return Zn(n)&&n.nodeType===3}function mn(n){return Zn(n)&&n.nodeType===9}function $g(n){let e=n;for(;e!=null;){if(de(e))return e;e=e.firstChild}return null}function ln(n,e,t){const r=Te[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 pf(n){return $(n)||Tt(n)||H(n)}function mf(n,e){const t=(function(){const s=cs;return cs=null,s})();if((e=e||t&&t.__key)!=null)return void(n.__key=e);xt(),tf();const r=G(),o=re(),i=""+wg++;o._nodeMap.set(i,n),C(n)?r._dirtyElements.set(i,!0):r._dirtyLeaves.add(i),r._cloneNotNeeded.add(i),r._dirtyType===0&&(r._dirtyType=1),n.__key=i}function Se(n){Et(n)!==null&&O(380,n.__key,String(Et(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 Uo(n){tf(),$o(n)&&O(323,n.__key,n.__type);const e=n.getLatest(),t=e.__parent!==null?e.__parent:un(e)?e.__slotHost:null,r=re(),o=G(),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:un(d)?d.__slotHost:null}})(t,i,s);const l=e.__key;o._dirtyType===0&&(o._dirtyType=1),C(n)?s.set(l,!0):o._dirtyLeaves.add(l)}function vt(n){xt();const e=G(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const r=rt(t);r!==null&&r.getWritable()}if(n!==null){const r=rt(n);r!==null&&r.getWritable()}}}function le(){return on()?null:G()._compositionKey}function rt(n,e){const t=(e||re())._nodeMap.get(n);return t===void 0?null:t}function _f(n,e){const t=Qn(n,G());return t!==void 0?rt(t,e):null}function yf(n,e,t){n[`__lexicalKey_${e._key}`]=t}function Qn(n,e){return n[`__lexicalKey_${e._key}`]}function cn(n,e){let t=n;for(;t!=null;){const r=_f(t,e);if(r!==null)return r;t=_n(t)}return null}function xf(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function xc(n){return n.read(()=>Y().getTextContent())}function Y(){return re()._nodeMap.get("root")}function jo(n,e){if(!(Z(n)&&n.isAttached()&&n.isEmpty()&&(ut(n)||e!==null&&Dt(e))))return null;const t=et();return n.append(t),t}function Ct(n){xt();const e=re();n!==null&&(n.dirty=!0,n.setCachedNodes(null),w(n)&&G()._slotsUsed&&Gu(n)),e._selection=n}function Sc(){xt(),nu(G())}function En(n){const e=(function(t,r){let o=t;for(;o!=null;){const i=Qn(o,r);if(i!==void 0)return i;o=_n(o)}return null})(n,G());return e===null?null:rt(e)}function Sf(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function Vs(n){const e=[];for(let t=n;t!==null;t=t._parentEditor)e.push(t);return e}function Cf(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function vf(n){return de(n)?n.nodeValue:null}function qs(n,e,t){const r=Lt(Kt(e));if(r===null)return;const o=Bt(r,e._rootElement),i=o.anchorNode;let{anchorOffset:s,focusOffset:l}=o;if(i!==null){let c=vf(i);const a=cn(i);if(c!==null&&$(a)){if((c===yr||c===Es)&&t){const u=t.length;c=t,s=u,l=u}c!==null&&Gs(a,c,s,l,n)}}}function Gs(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(yr)&&(l=e.slice(0,-yr.length)),o)){const a=Es;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=D();if(l===""){if(vt(null),Ir||be||Lr)i.remove();else{const _=G();Oi(i,"",a),setTimeout(()=>{_.update(()=>{i.isAttached()&&i.getTextContent()===""&&i.remove()})},20)}return}const u=i.getParent(),f=Gn(),d=i.getTextContentSize(),h=le(),g=i.getKey();if(i.isToken()&&!s||h!==null&&g===h&&!s||w(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(!w(a)||t===null||r===null)return void Oi(i,l,a);if(a.setTextNodeRange(i,t,i,r),i.isSegmented()){const _=_t(i.getTextContent());i.replace(_),i=_}Oi(i,l,a)}}}function Oi(n,e,t){if(n.setTextContent(e),w(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=ae(n,s.offset,"clamp"),o=!0)}o&&(t._cachedNodes=null,t._cachedIsBackward=null)}}function Cc(n){let e=n;for(;e!==null;){const t=e.getParent();if(t===null)return null;if(ut(t))return e;e=t}return null}function Xr(n,e){const{anchor:t,focus:r}=n,o=t.key,i=t.offset,s=t.type,l=r.key,c=r.offset,a=r.type;if(Os(n),!ut(e))return n;const u=Cc(t.getNode());return C(u)&&u.isShadowRoot()&&u.is(Cc(r.getNode()))&&(t.set(o,i,s),r.set(l,c,a)),n}function Mg(n){const e=Y();if(w(n)){const t=n.anchor,r=n.focus,o=t.getNode();if(ut(o))return t.set(o.getKey(),0,"element"),r.set(o.getKey(),o.getChildrenSize(),"element"),Xr(n,o),n;const i=o.getTopLevelElementOrThrow(),s=i.getParent();return s===null?(C(i)&&(t.set(i.getKey(),0,"element"),r.set(i.getKey(),i.getChildrenSize(),"element"),Xr(n,i)),n):(t.set(s.getKey(),0,"element"),r.set(s.getKey(),s.getChildrenSize(),"element"),Xr(n,s),n)}{const t=e.select(0,e.getChildrenSize());return Ct(Xr(t,e)),t}}function $r(n,e){n.getAttribute(e)===""&&n.removeAttribute(e)}function In(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=ue(o);return t[e]=i,i}return o}function Ys(n,e,t,r,o){if(t.size===0)return;const i=r.__type,s=r.__key,l=e.get(i);l===void 0&&O(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 vc(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 Ag(n,e){const t=n.offset;if(n.type==="element")return vc(n.getNode(),e,t);{const r=n.getNode();if(t===0||!e){const o=r.getPreviousSibling();return o===null?vc(r.getParentOrThrow(),e,r.getIndexWithinParent()+0):o}}return null}function bf(n){const e=Kt(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function R(n,e,...t){return of(n,e,t[0],n)}function Wn(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&O(75,e),t}function _n(n){const e=n.assignedSlot||n.parentElement;if(e!==null)return e;const t=n.parentNode;return ke(t)?t.host:null}function Xs(n){return mn(n)?n:q(n)?n.ownerDocument:null}function an(n){xt(),G()._updateTags.add(n)}function Dg(n){xt(),G()._deferred.push(n)}function Un(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Qs(n){const e=Xs(n);return e?e.defaultView:null}function Kt(n){const e=n._window;return e===null&&O(78),e}function Pg(n){return C(n)&&n.isInline()||H(n)&&n.isInline()}function Tf(n){let e=n.getLatest();for(;e!==null;){if(Et(e)!==null&&C(e))return e;const t=e.getParentOrThrow();if(Z(t))return t;e=t}return e}function gr(n){return C(n)&&n.isShadowRoot()}function Z(n){return ut(n)||gr(n)}function Ot(n,e=!1){const t=n.constructor.clone(n,js);return mf(t,null),t.afterCloneFrom(n),e||t.resetOnCopyNodeFrom(n),t}function oe(n){const e=G(),t=n.getType(),r=Hs(e,t);r===void 0&&O(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||O(201,i.name,i.getType(),l.name,l.getType(),n.constructor.name,t):s instanceof n.constructor&&l!==n.constructor||O(202,l.name,l.getType(),n.constructor.name,t),s.__key===n.__key&&O(203,n.constructor.name,t,l.name,l.getType()),s}return n}function $i(n,e){!ut(n.getParent())||C(e)||H(e)||O(99)}function Fg(n){const e=rt(n);return e===null&&O(63,n),e}function Mr(n){if(!n||n.isInline())return!1;if(H(n))return!0;if(C(n)){if(n.isShadowRoot()){const e=n.getParent();return!(C(e)&&e.isShadowRoot())}return!n.canBeEmpty()}return!1}function Ho(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function Lt(n){return Mt?(n||window).getSelection():null}function Ig(n){const e=Qs(n);return e?e.getSelection():null}function ke(n){return as(n)&&"host"in n}const Lg=[];function kf(n){const e=n.getRootNode();if(e===n||!ke(e))return Lg;const t=[e];let r=e.host;for(;;){const o=r.getRootNode();if(o===r||!ke(o))break;t.push(o),r=o.host}return t}function*Nf(n){const e=[n];let t;for(;t=e.pop();){yield*t.querySelectorAll('[data-lexical-editor="true"]');const r=(mn(t)?t:t.ownerDocument).createTreeWalker(t,NodeFilter.SHOW_ELEMENT);let o;for(;o=r.nextNode();)o.shadowRoot&&e.push(o.shadowRoot)}}function Ef(n){return n!==null?n.ownerDocument:document}function it(){const n=nf();return Ef(n!==null?n._rootElement:null)}function ai(n,e){if(e===null||typeof n.getComposedRanges!="function")return null;const t=kf(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 Rg(n,e){const t=ai(n,e);if(t!==null){const r=Bg(t);if(r!==null)return r}return n.rangeCount>0?n.getRangeAt(0):null}function Bt(n,e){const t=ai(n,e);return t===null?n:Kg(t,zg(n))}function Bg(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 Kg(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 zg(n){return n.direction}function Jo(n){const e=n.getRootNode();return mn(e)||ke(e)?e.activeElement:null}function jn(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 wf(n){const e=n.target;if(e!==null&&q(e)&&e.shadowRoot!==null&&typeof n.composedPath=="function"){const t=n.composedPath();if(t.length>0)return t[0]}return e}function Of(n){return q(n)&&n.tagName==="A"}function q(n){return Zn(n)&&n.nodeType===1}function Zn(n){return typeof n=="object"&&n!==null&&"nodeType"in n&&typeof n.nodeType=="number"}function as(n){return Zn(n)&&n.nodeType===11}const Wg=/^(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 us(n){return!(!q(n)||!n.style.display.startsWith("inline"))||Wg.test(n.nodeName)}const Ug=/^(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 Ar(n){return(!q(n)||!n.style.display.startsWith("inline"))&&Ug.test(n.nodeName)}function Dt(n){if(H(n)&&!n.isInline())return!0;if(!C(n)||Z(n))return!1;const e=n.getFirstChild(),t=e===null||Tt(e)||$(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function gt(){return G()}function ui(n=gt()){return n._config.dom||zo}function Wt(n,e,t=gt()){const r=ui(t).$getDOMSlot(n,e,t);return C(n)&&(jg(r)||O(344,n.getKey(),n.getType())),r}function jg(n){return n instanceof Ya}function Ie(n,e,t=gt()){return $g(Wt(n,e,t).element)}const bc=new WeakMap,Hg=new Map;function Tc(n){if(!n._readOnly&&n.isEmpty())return Hg;n._readOnly||O(192);let e=bc.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),bc.set(n,e)),e}function $f(n){const e=n.constructor.clone(n,js);return e.afterCloneFrom(n),e}function Jg(n){return(e=$f(n))[Pu]=!0,e;var e}function Zs(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 Hr(n,e){const t=e.getAttribute("dir");return t==="ltr"||t==="rtl"?n.setDirection(t):n}function fi(n,e){const t=e.style.textAlign;return t&&t in bo?n.setFormat(t):n}function Vg(n,e){n.__lexicalUnmanaged=!0,e&&e.captureSelection!==void 0&&(n.__lexicalCapturedSelection=e.captureSelection)}function Mf(n){return n.__lexicalUnmanaged===!0}function qg(n,e=gt()){const t=e.isEditable();n.contentEditable=t?"true":"false",t?n.__lexicalEditor=e:delete n.__lexicalEditor}function Vo(n,e){let t=n;for(;t!=null;){if(t.__lexicalCapturedSelection===!0)return!0;if(q(t)&&t.hasAttribute("data-lexical-slot")||Qn(t,e)!==void 0)return!1;t=_n(t)}return!1}function sr(n,e){return(function(t,r){return Object.prototype.hasOwnProperty.call(t,r)})(n,e)&&n[e]!==Pt[e]}const kc=new WeakMap,Nc=Symbol("lexical.synthesizedGetType");function tl(n){const e=kc.get(n);if(e)return e;const t=n.prototype!=null&&_l in n.prototype?n.prototype[_l]():void 0,r=(function(a){if(!(a===Pt||a.prototype instanceof Pt)){let u="<unknown>",f="<unknown>";try{u=a.getType()}catch{}try{sn.version&&(f=JSON.parse(sn.version))}catch{}O(290,a.name,u,f)}return a===sf||a===yt||a===Pt})(n),o=!r&&sr(n,"getType")?n.getType:void 0,i=o&&!(Nc 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(!sr(n,"getType")){const a=n,u=function(){return this!==a?Pt.getType.call(this):l};u[Nc]=!0,n.getType=u}if(sr(n,"clone")||(n.clone=(a,u)=>{Us(a);const f=new n;return u!==js&&f.afterCloneFrom(a),f}),sr(n,"importJSON")||(n.importJSON=s&&s.$importJSON||(a=>Af(n).updateFromJSON(a))),!sr(n,"importDOM")&&s){const{importDOM:a}=s;a&&(n.importDOM=()=>a)}}const c={klass:n,ownNodeConfig:s,ownNodeType:l};return kc.set(n,c),c}function*el(n){for(let e=n;e&&(e===Pt||Fu(e.prototype));){const t=tl(e);yield t,e=t.ownNodeConfig&&t.ownNodeConfig.extends||Df(e)}}function Af(n){const e=gt();xt();const t=e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(n)),r=new t.klass;return t.replace===null?r:oe(r)}const St=(n,e)=>{let t=n;for(;t!=null&&!ut(t);){if(e(t))return t;t=t.getParent()}return null};function qo(n,e){const t=[];let r=n.__first;for(;r!==null;){const o=e===null?rt(r):e.get(r);o==null&&O(174),t.push(r),r=o.__next}return t}function Df(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 Pf=new Map;function Ze(n){return C(n)||H(n)}function un(n){return C(n)||H(n)}function Et(n){const e=n.getLatest();return un(e)?e.__slotHost:null}function $t(n){const e=Et(n);if(e===null)return null;const t=rt(e);return C(t)||H(t)||O(370),t}function Gg(n){const e=$t(n);if(e===null)return null;const t=n.getLatest().__key;for(const[r,o]of di(e))if(o===t)return r;return null}function Dr(n){let e=n.getLatest();for(;e!==null;){if(Et(e)!==null)return e;e=e.getParent()}return null}function Ff(n){if(n===null)return null;const e=w(n)?n.anchor.getNode():n.getNodes()[0]??null;return e===null?null:Dr(e)}function di(n){const e=n.getLatest();return Ze(e)&&e.__slots!==null?e.__slots:Pf}function ce(n){return Array.from(di(n).keys())}function Hn(n,e){const t=di(n).get(e);return t===void 0?null:rt(t)}const Yg=["__proto__","constructor","prototype"],Ec=Symbol("slotMapOwner");function wc(n){let e=n.__slots;return e!==null&&e[Ec]===n||(e=new Map(e),e[Ec]=n,n.__slots=e),e}const Oc=new WeakMap,Xg=[];function Qg(n){for(const{ownNodeConfig:e}of el(n)){const t=e&&e.slots;if(t)return t}return Xg}function If(n){let e="";for(const t of ce(n)){const r=Hn(n,t);r!==null&&(e+=r.getTextContent())}return e}function $c(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 Zg(n){const e=n.__slots;if(e===null||e.size<2)return;const t=(function(s){let l=Oc.get(s);if(l===void 0){const c=Qg(s),a=new Map;for(const u of c)Yg.includes(u)&&O(371,s.name,u),a.has(u)&&O(372,s.name,u),a.set(u,a.size);l=a,Oc.set(s,l)}return l})(n.constructor);let r=null,o=!0;for(const s of e.keys()){if(r!==null&&$c(r,s,t)>0){o=!1;break}r=s}if(o)return;const i=Array.from(e).sort(([s],[l])=>$c(s,l,t));e.clear();for(const[s,l]of i)e.set(s,l)}function tp(n,e,t){e!=="__proto__"&&e!=="constructor"&&e!=="prototype"||O(373,e);const r=n.getLatest();if(r.__slots!==null&&r.__slots.get(e)===t.getLatest().__key)return r;(!C(t)&&!H(t)||t.isInline())&&O(374,t.__key);const o=n.getWritable(),i=wc(o),s=i.get(e);s!==void 0&&ep(s);const l=t.getWritable(),c=$t(l);if(c!==null){const a=Gg(l);a!==null&&wc(c.getWritable()).delete(a),l.__slotHost=null}return Se(l),l.__slotHost=o.__key,i.set(e,l.__key),Zg(o),G()._slotsUsed=!0,re()._slotsUsed=!0,o}function ep(n){const e=rt(n);if(e===null)return;const t=e.getWritable();un(t)||O(377,n),t.__slotHost=null,t.remove()}const np={next:"previous",previous:"next"};class nl{constructor(e){b(this,"origin");this.origin=e}[Symbol.iterator](){return Lf({hasNext:Be,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return X(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return X(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&&O(263,Array.from(l).join(" "))}else i.insert(c);i=X(c,this.direction)}for(const c of l.values())c.remove();return this}}class Pr extends nl{constructor(){super(...arguments);b(this,"type","child")}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:It(t,this.direction)}getParentCaret(t="root"){return X(rl(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=Ue(this.direction);return X(this.getNodeAtCaret(),t)||It(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof Pr&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const rp={root:ut,shadowRoot:Z};function Ue(n){return np[n]}function rl(n,e="root"){return n===null||rp[e](n)?null:Et(n)===null?n:null}class fn extends nl{constructor(){super(...arguments);b(this,"type","sibling")}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:X(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return C(this.origin)?It(this.origin,this.direction):null}getParentCaret(t="root"){return X(rl(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=Ue(this.direction);return X(this.getNodeAtCaret(),t)||It(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof fn&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof fn||t instanceof dn)&&this.direction===t.direction&&this.origin.is(t.origin)}}class dn extends nl{constructor(t,r){super(t);b(this,"type","text");b(this,"offset");this.offset=r}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:Ke(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return X(rl(this.getParentAtCaret(),t),this.direction)}getFlipped(){return Ke(this.origin,Ue(this.direction),this.offset)}isSamePointCaret(t){return t instanceof dn&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof fn||t instanceof dn)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return X(this.origin,this.direction)}}function Xt(n){return n instanceof dn}function Be(n){return n instanceof fn}function Qt(n){return n instanceof Pr}const op={next:class extends dn{constructor(){super(...arguments);b(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends dn{constructor(){super(...arguments);b(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},ip={next:class extends fn{constructor(){super(...arguments);b(this,"direction","next")}getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends fn{constructor(){super(...arguments);b(this,"direction","previous")}getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},sp={next:class extends Pr{constructor(){super(...arguments);b(this,"direction","next")}getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Pr{constructor(){super(...arguments);b(this,"direction","previous")}getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function X(n,e){return n?new ip[e](n):null}function Ke(n,e,t){return n?new op[e](n,ae(n,t)):null}function ae(n,e,t="error"){const r=n.getTextContentSize();let o=e==="next"?r:e==="previous"?0:e;return(o<0||o>r)&&(t!=="clamp"&&ja(284,String(e),String(r),n.getKey()),o=o<0?0:r),o}function Mc(n,e){return new cp(n,e)}function It(n,e){return C(n)?new sp[e](n):null}function lp(n){return n&&n.getChildCaret()||n}function ol(n){return n&&lp(n.getAdjacentCaret())}class il{constructor(e,t,r){b(this,"type","node-caret-range");b(this,"direction");b(this,"anchor");b(this,"focus");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 il(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=o=>{const i=this[o].getLatest();return Xt(i)?(function(s,l){const{direction:c,origin:a}=s,u=ae(a,l==="focus"?Ue(c):c);return Mc(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[Mc(o,i.offset-o.offset),null]}return[t,r]}iterNodeCarets(e="root"){const t=Xt(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),r=this.focus.getLatest(),o=Xt(r),i=s=>s.isSameNodeCaret(r)?null:ol(s)||s.getParentCaret(e);return Lf({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 cp{constructor(e,t){b(this,"type","slice");b(this,"caret");b(this,"distance");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 Ke(e.setTextContent(i.slice(0,r)+i.slice(o)),t,r)}}function ne(n,e){return n.direction===e?n:n.getFlipped()}function hi(n){return Zt(n,ne(It(Y(),Ue(n.direction)),n.direction))}function gi(n){return Zt(n,n)}function Zt(n,e){return n.direction!==e.direction&&O(265),new il(n,e,n.direction)}function Lf(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 ze(n,e){const t=fs(n.origin,e.origin);switch(t===null&&O(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 Rf(t)}}function Rf(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 Qr(n,e){return e.is(n)}function Ac(n){return C(n)?[n.getLatest(),null]:[n.getParent(),n.getLatest()]}function fs(n,e){if(n.is(e))return{commonAncestor:n,type:"same"};const t=new Map;for(let[r,o]=Ac(n);r;o=r,r=r.getParent())t.set(r,o);for(let[r,o]=Ac(e);r;o=r,r=r.getParent()){const i=t.get(r);if(i!==void 0)return i===null?(Qr(n,r)||O(276),{commonAncestor:r,type:"ancestor"}):o===null?(Qr(e,r)||O(277),{commonAncestor:r,type:"descendant"}):((C(i)||Qr(n,i))&&(C(o)||Qr(e,o))&&r.is(i.getParent())&&r.is(o.getParent())||O(278),{a:i,b:o,commonAncestor:r,type:"branch"})}return null}function ap(n,e){if(!e||n===e)return n;for(const t in e)if(n[t]!==e[t])return{...n,...e};return n}function ue(...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 Ne(n,...e){const t=ue(...e);t.length>0&&n.classList.add(...t)}function sl(n,...e){const t=ue(...e);t.length>0&&n.classList.remove(...t)}function Ut(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}function Bf(n){const e=gt().getElementByKey(n.getKey());if(e===null)return null;const t=e.ownerDocument.defaultView;return t===null?null:t.getComputedStyle(e)}function Kf(n){const e=ut(n)?n:n.getParent();return e&&Bf(e)}function Zr(n){const e=Kf(n);return e!==null&&e.direction==="rtl"}function zf(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]=rs(n),h=l.is(c),g=e.is(s?c:l),_=e.is(s?l:c);let m,p=0;h?(p=f>d?d:f,m=f>d?f:d):g?(p=s?d:f,m=void 0):_&&(p=0,m=s?f:d);const y=e.__text.slice(p,m);y!==e.__text&&(t==="clone"&&(e=Jg(e)),e.__text=y)}}return e}function Wf(n){const e=Uf(n);return e!==null&&e.writingMode==="vertical-rl"}function Uf(n){const e=n.anchor.getNode();return C(e)?Bf(e):Kf(e)}function Dc(n,e){let t=Wf(n)?!e:e;jf(n)&&(t=!t);const r=zt(n.focus,t?"previous":"next");if(cf(r))return!1;if(Xt(r)&&!rn(r.origin)&&r.origin.isUnmergeable()){const o=r.getNodeAtCaret();if($(o)&&!rn(o))return!0}for(const o of hi(r)){if(Qt(o))return!o.origin.isInline();if(!C(o.origin)){if(H(o.origin))return!0;break}}return!1}function up(n,e,t,r){n.modify(e?"extend":"move",t,r)}function jf(n){const e=Uf(n);return e!==null&&e.direction==="rtl"}function Pc(n,e,t){const r=jf(n);let o;o=Wf(n)||r?!t:t,up(n,e,o,"character")}function fp(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 dp(n,e){let t=n;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function hp(n){const e=St(n,t=>C(t)&&!t.isInline());return C(e)||fp(4,n.__key),e}function Ae(n,e){if(n==null)return!1;const t=Object.getPrototypeOf(n);return t!=null&&t.constructor!=null&&t.constructor.name===e.name}function to(n){let e=null;if(Ae(n,DragEvent)?e=n.dataTransfer:Ae(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 Fc(n){const e=D();if(!w(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=St(i,a=>C(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}const gp=Symbol.for("preact-signals");function ll(){if(tn>1)return void tn--;let n,e=!1;for(!(function(){let t=Go;for(Go=void 0;t!==void 0;)t.S.v===t.v&&(t.S.i=t.i),t=t.o})();pr!==void 0;){let t=pr;for(pr=void 0,Yo++;t!==void 0;){const r=t.u;if(t.u=void 0,t.f&=-3,!(8&t.f)&&Hf(t))try{t.c()}catch(o){e||(n=o,e=!0)}t=r}}if(Yo=0,tn--,e)throw n}let tt,pr;function Ic(n){const e=tt;tt=void 0;try{return n()}finally{tt=e}}let Go,tn=0,Yo=0,Lc=0,yo=0;function Rc(n){if(tt===void 0)return;let e=n.n;return e===void 0||e.t!==tt?(e={i:0,S:n,p:tt.s,n:void 0,t:tt,e:void 0,x:void 0,r:e},tt.s!==void 0&&(tt.s.n=e),tt.s=e,n.n=e,32&tt.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=tt.s,e.n=void 0,tt.s.n=e,tt.s=e),e):void 0}function At(n,e){this.v=n,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=e==null?void 0:e.watched,this.Z=e==null?void 0:e.unwatched,this.name=e==null?void 0:e.name}function ds(n,e){return new At(n,e)}function Hf(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 Bc(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 Jf(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 Sn(n,e){At.call(this,void 0),this.x=n,this.s=void 0,this.g=yo-1,this.f=4,this.W=e==null?void 0:e.watched,this.Z=e==null?void 0:e.unwatched,this.name=e==null?void 0:e.name}function Vf(n){const e=n.m;if(n.m=void 0,typeof e=="function"){tn++;const t=tt;tt=void 0;try{e()}catch(r){throw n.f&=-2,n.f|=8,cl(n),r}finally{tt=t,ll()}}}function cl(n){for(let e=n.s;e!==void 0;e=e.n)e.S.U(e);n.x=void 0,n.s=void 0,Vf(n)}function pp(n){if(tt!==this)throw new Error("Out-of-order effect");Jf(this),tt=n,this.f&=-2,8&this.f&&cl(this),ll()}function Nn(n,e){this.x=n,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=e==null?void 0:e.name}function qf(n,e){const t=new Nn(n,e);try{t.c()}catch(o){throw t.d(),o}const r=t.d.bind(t);return r[Symbol.dispose]=r,r}At.prototype.brand=gp,At.prototype.h=function(){return!0},At.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:Ic(()=>{var t;(t=this.W)==null||t.call(this)}))},At.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&&Ic(()=>{var r;(r=this.Z)==null||r.call(this)}))}},At.prototype.subscribe=function(n){return qf(()=>{const e=this.value,t=tt;tt=void 0;try{n(e)}finally{tt=t}},{name:"sub"})},At.prototype.valueOf=function(){return this.value},At.prototype.toString=function(){return this.value+""},At.prototype.toJSON=function(){return this.value},At.prototype.peek=function(){const n=tt;tt=void 0;try{return this.value}finally{tt=n}},Object.defineProperty(At.prototype,"value",{get(){const n=Rc(this);return n!==void 0&&(n.i=this.i),this.v},set(n){if(n!==this.v){if(Yo>100)throw new Error("Cycle detected");(function(e){tn!==0&&Yo===0&&e.l!==Lc&&(e.l=Lc,Go={S:e,v:e.v,i:e.i,o:Go})})(this),this.v=n,this.i++,yo++,tn++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{ll()}}}}),Sn.prototype=new At,Sn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===yo))return!0;if(this.g=yo,this.f|=1,this.i>0&&!Hf(this))return this.f&=-2,!0;const n=tt;try{Bc(this),tt=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 tt=n,Jf(this),this.f&=-2,!0},Sn.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)}At.prototype.S.call(this,n)},Sn.prototype.U=function(n){if(this.t!==void 0&&(At.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)}},Sn.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(Sn.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const n=Rc(this);if(this.h(),n!==void 0&&(n.i=this.i),16&this.f)throw this.v;return this.v}}),Nn.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()}},Nn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Vf(this),Bc(this),tn++;const n=tt;return tt=this,pp.bind(this,n)},Nn.prototype.N=function(){2&this.f||(this.f|=2,this.u=pr,pr=this)},Nn.prototype.d=function(){this.f|=8,1&this.f||cl(this)},Nn.prototype.dispose=function(){this.d()};function mp(n){return(typeof n.nodes=="function"?n.nodes():n.nodes)||[]}function _p(n,e){let t;return ds(n(),{unwatched(){t&&(t(),t=void 0)},watched(){this.value=n(),t=e(this)}})}function ot(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 Gf;try{Gf="0.50.0+prod.esm"}catch{}const yp=Gf??'"<unknown>+source"',xp=new Set(["__proto__","constructor","prototype"]);function Yf(n,e){if(n&&e&&!Array.isArray(e)&&typeof n=="object"&&typeof e=="object"){const t=n,r=e;for(const o in r)!xp.has(o)&&Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=Yf(t[o],r[o]));return n}return e}const al=0,hs=1,Xf=2,Mi=3,eo=4,Cn=5,Ai=6,lr=7;function Di(n){return n.id===al}function Qf(n){return n.id===Xf}function Sp(n){return(function(e){return e.id===hs})(n)||ot(305,String(n.id),String(hs)),Object.assign(n,{id:Xf})}const Cp=new Set;class vp{constructor(e,t){b(this,"builder");b(this,"configs");b(this,"_dependency");b(this,"_peerNameSet");b(this,"extension");b(this,"state");b(this,"_signal");this.builder=e,this.extension=t,this.configs=new Set,this.state={id:al}}mergeConfigs(){let e=this.extension.config||{};const t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):ap;for(const r of this.configs)e=t(e,r);return e}init(e){const t=this.state;Qf(t)||ot(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:Mi,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:eo,initResult:c,registerState:a})})(i,s,o)}build(e){const t=this.state;let r;t.id!==eo&&ot(307,String(t.id),String(Cn)),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:Cn,output:s,registerState:l})})(t,r,o)}register(e,t){this._signal=t;const r=this.state;r.id!==Cn&&ot(308,String(r.id),String(Cn));const o=this.extension.register&&this.extension.register(e,r.config,r.registerState);return this.state=(function(i){return Object.assign(i,{id:Ai})})(r),()=>{const i=this.state;i.id!==lr&&ot(309,String(r.id),String(lr)),this.state=(function(s){return Object.assign(s,{id:Cn})})(i),o&&o()}}afterRegistration(e){const t=this.state;let r;return t.id!==Ai&&ot(310,String(t.id),String(Ai)),this.extension.afterRegistration&&(r=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=(function(o){return Object.assign(o,{id:lr})})(t),r}getSignal(){return this._signal===void 0&&ot(311),this._signal}getInitResult(){this.extension.init===void 0&&ot(312,this.extension.name);const e=this.state;return(function(t){return t.id>=eo})(e)||ot(313,String(e.id),String(eo)),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>=Mi})(e)||ot(314,String(e.id),String(Mi)),{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&&ot(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return t===void 0&&ot(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return(function(t){return t.id>=lr})(e)||ot(316,String(e.id),String(lr)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Cp}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>=Cn})(e)||ot(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}}const Kc={tag:Dn};function bp(){const n=Y();n.isEmpty()&&n.append(et())}const Tp={config:{setOptions:Kc,updateOptions:Kc},init:({$initialEditorState:n=bp})=>({$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(mg(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:[si,ee,li,oi,ci]},zc=Symbol.for("@lexical/extension/LexicalBuilder");function Wc(){}function kp(n){throw n}function no(n){return Array.isArray(n)?n:[n]}const Pi=yp;class Ln{constructor(e){b(this,"roots");b(this,"extensionNameMap");b(this,"outgoingConfigEdges");b(this,"incomingEdges");b(this,"conflicts");b(this,"_sortedExtensionReps");b(this,"PACKAGE_VERSION");this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Pi,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(e){const t=[no(Tp)];for(const r of e)t.push(no(r));return new Ln(t)}static maybeFromEditor(e){const t=e[zc];return t&&(t.PACKAGE_VERSION!==Pi&&ot(292,t.PACKAGE_VERSION,Pi),t instanceof Ln||ot(293)),t}static fromEditor(e){const t=Ln.maybeFromEditor(e);return t===void 0&&ot(294),t}constructEditor(){const{$initialEditorState:e,onError:t,onWarn:r,...o}=this.buildCreateEditorArgs(),i=Object.assign(hf({...o,...t?{onError:s=>{t(s,i)}}:{},...r?{onWarn:s=>{r(s,i)}}:{}}),{[zc]:this});for(const s of this.sortedExtensionReps())s.build(i);return i}buildEditor(){let e=Wc;function t(){try{e()}finally{e=Wc}}const r=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=Ut(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&&ot(295,e.name),t}addEdge(e,t,r){const o=this.outgoingConfigEdges.get(e);if(o){const s=o.get(t);s?s.push(...r):o.set(t,r)}else 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&&ot(296);const t=no(e),[r]=t;typeof r.name!="string"&&ot(297,typeof r.name);let o=this.extensionNameMap.get(r.name);if(o!==void 0&&o.extension!==r&&ot(298,r.name),!o){o=new vp(this,r),this.extensionNameMap.set(r.name,o);const i=this.conflicts.get(r.name);typeof i=="string"&&ot(299,r.name,i);for(const s of r.conflictsWith||[])this.extensionNameMap.has(s)&&ot(299,r.name,s),this.conflicts.set(s,r.name);for(const s of r.dependencies||[]){const l=no(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(Qf(i))return;const s=r.extension.name;var l;Di(i)||ot(300,s,o||"[unknown]"),Di(l=i)||ot(304,String(l.id),String(al)),i=Object.assign(l,{id:hs}),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=Sp(i),r.state=i,e.push(r)};for(const r of this.extensionNameMap.values())Di(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&&ot(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 Ut(...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 mp(f)){if(typeof d!="function"){const h=r.get(d.replace);h&&ot(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&&Yf(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=kp),e}}function Jr(n,e){const t=Ln.maybeFromEditor(n);if(!t)return;const r=t.extensionNameMap.get(e);return r?r.getExtensionDependency():void 0}function Np(n){return Jr(gt(),n)}function Ep(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 Rn;function Zf(n,e){const{key:t}=e;return n&&t in n?n[t]:e.defaultValue}function td(n){return Rn&&Rn.editor===n?Rn:void 0}function wp(n,e){if("cfg"in e){const{cfg:t,updater:r}=e;return[t,r(Zf(n,t))]}return e}function Op(n,e){let t=e;for(const r of n){const[o,i]=wp(t,r),s=o.key;if(t===e&&Zf(t,o)===i)continue;const l=t===e||t===void 0?$p(e):t;l[s]=i,t=l}return t}function $p(n){return Object.create(n||null)}function Mp(n,e){return[n,e]}function Ap(n,e,t,r=gt()){const o=Rn,i=td(r);try{return Rn={...i,editor:r,[n]:e},t()}finally{Rn=o}}function Dp(n,e=()=>{}){return(t,r=gt())=>o=>{const i=td(r),s=i&&i[n],l=Op(t,s||e(r));return l&&l!==s?Ap(n,l,o,r):o()}}function Pp(n,e,t,r){return Object.assign(qn(Symbol(e),{isEqual:r,parse:t}),{[n]:!0})}function Fp(n){if(!mn(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(!Ae(s,CSSStyleRule))continue;let l;try{l=e.querySelectorAll(s.selectorText)}catch{continue}for(const c of Array.from(l)){if(!q(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 ed="@lexical/html/DOM",nd=Symbol.for("@lexical/html/DOMExportContext");function Ip(n,e,t){return Pp(nd,n,e,t)}const Lp=Ip("isExport",Boolean);function Rp(n){const e=Jr(n,ed);return e?e.output.defaults:void 0}function Bp(n){const e=Jr(n,ed);return e?e.output.runtime:void 0}function Kp(n=gt()){const e=Bp(n);return e?e.getSessionConfig():ui(n)}const zp=Dp(nd,Rp),rd=new Set(["STYLE","SCRIPT"]);function Wp(n,e){Fp(e);const t=mn(e)?e.body.childNodes:e.childNodes,r=[],o=[];for(const i of t)if(!rd.has(i.nodeName)){const s=id(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 Ws&&s.insertAfter(Le());for(const s of i){const l=s.getParent();l&&l.splice(s.getIndexWithinParent(),1,s.getChildren())}})(o),r}function Up(n,e=null,t=gt()){return zp([Mp(Lp,!0)],t)(()=>{const r=Y(),o=Kp(t),i=Ff(e),s=n.append.bind(n);for(const l of(C(i)?i:r).getChildren())od(t,l,s,e,o);return n})}function jp(n,e=null){return(typeof document>"u"||typeof window>"u"&&global.window===void 0)&&Ep(338),fg(n),Up(it().createElement("div"),e,n).innerHTML}function od(n,e,t,r=null,o=ui(n)){let i=o.$shouldInclude(e,r,n);const s=o.$shouldExclude(e,r,n);let l=e;r!==null&&$(e)&&(l=zf(r,e,"clone"));const c=o.$exportDOM(l,n),{element:a,after:u,append:f,$getChildNodes:d}=c;if(!a)return!1;const h=it().createDocumentFragment(),g=d?d():C(l)?l.getChildren():[],_=i&&at(r)&&C(e)?null:r,m=h.append.bind(h);let p=null;for(const y of g){const x=od(n,y,m,_,o);x&&(p=y),!i&&x&&o.$extractWithChild(e,y,r,"html",n)&&(i=!0)}if(i&&!s){if((q(a)||as(a))&&(f?f(h):a.append(h),(function(y,x){const S=y.lastChild;if(Tt(x)&&q(y)&&Ar(y)&&S!==null&&S.nodeName==="BR"){const v=it().createElement("br");v.setAttribute("data-lexical-managed-linebreak","true"),y.append(v)}})(a,p)),as(a)){if(u){const y=u.call(l,a);y&&a.replaceChildren(y)}t(a)}else if(t(a),u){const y=u.call(l,a);y&&a.replaceWith(y)}}else t(h);return i}function id(n,e,t,r,o=new Map,i){const s=[];if(rd.has(n.nodeName))return s;let l=null;const c=(function(g,_){const{nodeName:m}=g,p=_._htmlConversions.get(m.toLowerCase());let y=null;if(p!==void 0)for(const x of p){const S=x(g);S!==null&&(y===null||(y.priority||0)<=(S.priority||0))&&(y=S)}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[,_]of o)if(l=_(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||!Z(l))&&(l!=null&&Do(l)||r);for(let g=0;g<f.length;g++)d.push(...id(f[g],e,t,h,new Map(o),l));if(u!=null&&(d=u(d)),Ar(n)&&(d=Hp(n,d,h?()=>{const g=new Ws;return t.push(g),g}:et)),l==null)if(d.length>0)for(const g of d)s.push(g);else Ar(n)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:us(g.nextSibling)&&us(g.previousSibling)})(n)&&s.push(Le());else C(l)&&l.append(...d);return s}function Hp(n,e,t){const r=n.style.textAlign,o=[];let i=[];for(let s=0;s<e.length;s++){const l=e[s];if(Do(l))r&&!l.getFormat()&&l.setFormat(r),o.push(l);else if(i.push(l),s===e.length-1||s<e.length-1&&Do(e[s+1])){const c=t();c.setFormat(r),c.append(...i),o.push(c),i=[]}}return o}function Oe(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 gs(n){let e=1,t=n.getParent();for(;t!=null;){if(W(t)){const r=t.getParent();if(I(r)){e++,t=r.getParent();continue}Oe(40)}return e}return e}function ps(n){const e=n.getParent();I(e)||Oe(40);let t=e,r=e;for(;r!==null;)r=r.getParent(),I(r)&&(t=r);return t}function sd(n){let e=[];const t=n.getChildren().filter(W);for(let r=0;r<t.length;r++){const o=t[r],i=o.getFirstChild();I(i)?e=e.concat(sd(i)):e.push(o)}return e}function qt(n){return W(n)&&I(n.getFirstChild())}function ld(n,e){return e.getValue()}function cd(n,e){return W(n)&&(e.length===0||e.length===1&&n.is(e[0])&&n.getChildrenSize()===0)}function Uc(n,e){return I(n)?Ot(n).setListType(e):Ce(e)}function jc(n){const e=D();if(e!==null){let t=e.getNodes();if(w(e)){const[o]=e.getStartEndPoints(),i=o.getNode(),s=i.getParent();if(Z(i)){const l=i.getFirstChild();if(l)t=l.selectStart().getNodes();else{const c=et();i.append(c),t=c.select().getNodes()}}else if(cd(i,t)){if(Z(s)){const l=Ce(n);i.replace(l);const c=gn();C(i)&&(c.setFormat(i.getFormatType()),c.setIndent(i.getIndent())),l.append(c)}else if(W(i)){const l=i.getParentOrThrow();if($t(l)===null){const c=Uc(l,n);hn(c,l.getChildren()),l.replace(c)}}return}}const r=new Set;for(let o=0;o<t.length;o++){const i=t[o];if(C(i)&&i.isEmpty()&&!W(i)&&$t(i)===null&&!r.has(i.getKey())){Hc(i,n);continue}let s=pf(i)?i.getParent():W(i)&&i.isEmpty()?i:null;for(;s!=null;){const l=s.getKey();if(I(s)){if(!r.has(l)&&$t(s)===null){const c=Uc(s,n);hn(c,s.getChildren()),s.replace(c),r.add(l)}break}{const c=s.getParent();if(Z(c)&&!r.has(l)){r.add(l),Hc(s,n);break}s=c}}}}}function hn(n,e){n.splice(n.getChildrenSize(),0,e)}function Hc(n,e){if(I(n))return n;const t=n.getPreviousSibling(),r=n.getNextSibling(),o=gn();let i;if(hn(o,n.getChildren()),I(t)&&e===t.getListType())t.append(o),I(r)&&e===r.getListType()&&(hn(t,r.getChildren()),r.remove()),i=t;else if(I(r)&&e===r.getListType())r.getFirstChildOrThrow().insertBefore(o),i=r;else{const l=Ce(e);l.append(o),n.replace(l),i=l}o.setFormat(n.getFormatType()),o.setIndent(n.getIndent());const s=D();return w(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 ul(n,e){const t=n.getLastChild(),r=e.getFirstChild();t&&r&&qt(t)&&qt(r)&&t.getFirstChild().getListType()===r.getFirstChild().getListType()&&(ul(t.getFirstChild(),r.getFirstChild()),r.remove());const o=e.getChildren();o.length>0&&n.append(...o),e.remove()}function Jp(){const n=D();if(w(n)){const e=new Set,t=n.getNodes(),r=n.anchor.getNode();if(cd(r,t))e.add(ps(r));else for(let o=0;o<t.length;o++){const i=t[o];if(pf(i)){const s=dp(i,je);s!=null&&e.add(ps(s))}}for(const o of e){if($t(o)!==null)continue;let i=o;const s=sd(o);for(const l of s){const c=et().setTextStyle(n.style).setTextFormat(n.format);c.setFormat(l.getFormatType()).setIndent(l.getIndent()).setDirection(l.getDirection()).setStyle(l.getStyle()),hn(c,l.getChildren()),i.insertAfter(c),i=c,l.__key===n.anchor.key&&Re(n.anchor,Ft(It(c,"next"))),l.__key===n.focus.key&&Re(n.focus,Ft(It(c,"next"))),l.remove()}o.remove()}}}function ad(n){const e=n.getListType()!=="check";let t=n.getStart();for(const r of n.getChildren())W(r)&&(r.getValue()!==t&&r.setValue(t),e&&r.getLatest().__checked!=null&&r.setChecked(void 0),I(r.getFirstChild())||t++)}function Vp(n){const e=new Set;if(qt(n)||e.has(n.getKey()))return;const t=n.getParent(),r=n.getNextSibling(),o=n.getPreviousSibling();if(qt(r)&&qt(o)){const i=o.getFirstChild();if(I(i)){i.append(n);const s=r.getFirstChild();I(s)&&(hn(i,s.getChildren()),r.remove(),e.add(r.getKey()))}}else if(qt(r)){const i=r.getFirstChild();if(I(i)){const s=i.getFirstChild();s!==null&&s.insertBefore(n)}}else if(qt(o)){const i=o.getFirstChild();I(i)&&i.append(n)}else if(I(t)){const i=Ot(n),s=Ot(t);i.append(s),s.append(n),o?o.insertAfter(i):r?r.insertBefore(i):t.append(i)}}function Jc(n){if(qt(n))return;const e=n.getParent(),t=e?e.getParent():void 0;if(I(t?t.getParent():void 0)&&W(t)&&I(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=Ot(n),s=Ot(e);i.append(s),n.getPreviousSiblings().forEach(a=>s.append(a));const l=Ot(n),c=Ot(e);l.append(c),hn(c,n.getNextSiblings()),t.insertBefore(i),t.insertAfter(l),t.replace(n)}}}function qp(n=!1){const e=D();if(!w(e)||!e.isCollapsed())return!1;const t=e.anchor.getNode();let r=null;if(W(t)&&t.getChildrenSize()===0)r=t;else if($(t)){const a=t.getParent();W(a)&&a.getChildren().every(u=>$(u)&&u.getTextContent().trim()==="")&&(r=a)}if(r===null)return!1;const o=ps(r),i=r.getParent();I(i)||Oe(40);const s=i.getParent();let l;if(Z(s))l=et(),o.insertAfter(l);else{if(!W(s))return!1;l=Ot(s),s.insertAfter(l)}l.setTextStyle(e.style).setTextFormat(e.format).select();const c=r.getNextSiblings();if(c.length>0){const a=n?ld(0,r):1,u=Ot(i).setStart(a);if(W(l)){const f=Ot(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||!W(f)&&!I(f))break;u=f}u.remove()})(r),!0}let je=class extends yt{constructor(t=1,r=void 0,o){super(o);b(this,"__value");b(this,"__checked");this.__value=t===void 0?1:t,this.__checked=r}$config(){return this.config("listitem",{$transform:t=>{const r=t.getParent();if(I(r))r.getListType()!=="check"&&t.getChecked()!=null&&t.setChecked(void 0);else if(r){const o=t.createParentElementNode();I(o)||Oe(340);const i=[t];for(const s of["previous","next"]){i.reverse();for(const{origin:l}of X(t,s)){if(!W(l))break;i.push(l)}}t.insertBefore(o),o.splice(0,0,i),Z(r)||(uf(o,We(X(o,"next")),{$shouldSplit:()=>!1,removeEmptyDestination:!0}),r.isEmpty()&&r.isAttached()&&r.remove())}},extends:yt,importDOM:{li:()=>({conversion:Gp,priority:0})}})}afterCloneFrom(t){super.afterCloneFrom(t),this.__value=t.__value,this.__checked=t.__checked}createDOM(t){const r=it().createElement("li");return this.updateListItemDOM(null,r,t),r}updateListItemDOM(t,r,o){(function(l,c){const a=c.getParent();!I(a)||a.getListType()!=="check"||I(c.getFirstChild())?(l.removeAttribute("role"),l.removeAttribute("tabIndex"),l.removeAttribute("aria-checked")):(l.setAttribute("role","checkbox"),l.setAttribute("tabIndex","-1"),l.setAttribute("aria-checked",c.getChecked()?"true":"false"))})(r,this),r.value=this.__value,(function(l,c,a){const u=c.list;if(!u)return;const f=u.listitem,d=u.nested&&u.nested.listitem,h=a.getParent(),g=I(h)&&h.getListType()==="check",_=a.getChecked(),m=a.getChildren().some(x=>I(x)),p=[];u.listitemChecked!==void 0&&p.push(u.listitemChecked),u.listitemUnchecked!==void 0&&p.push(u.listitemUnchecked),d!==void 0&&p.push(...ue(d)),p.length>0&&sl(l,...p);const y=[];if(f!==void 0&&y.push(...ue(f)),g){const x=_?u.listitemChecked:u.listitemUnchecked;x!==void 0&&y.push(x)}d!==void 0&&m&&y.push(...ue(d)),y.length>0&&Ne(l,...y)})(r,o.theme,this);const i=t?t.__style:"",s=this.__style;i!==s&&Pn(r.style,s,i),(function(l,c,a){const u=c.__textStyle,f=a?a.__textStyle:"";if(a!==null&&f===u)return;const d=Ao(u);for(const h in d)l.style.setProperty(`--listitem-marker-${h}`,d[h]);if(f!=="")for(const h in Ao(f))h in d||l.style.removeProperty(`--listitem-marker-${h}`)})(r,this,t)}updateDOM(t,r,o){const i=r;return this.updateListItemDOM(t,i,o),!1}updateFromJSON(t){return super.updateFromJSON(t).setValue(t.value).setChecked(t.checked)}exportDOM(t){const r=this.createDOM(t._config),o=this.getFormatType();o&&(r.style.textAlign=o);const i=this.getDirection();return i&&(r.dir=i),qt(this)?{after(s){if(q(s)){const l=s.previousElementSibling;if(q(l)&&l.nodeName==="LI"){for(;s.firstChild;)l.append(s.firstChild);s.remove()}}return s},element:r}:{element:r}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...t){for(let r=0;r<t.length;r++){const o=t[r];if(C(o)&&this.canMergeWith(o)){const i=o.getChildren();this.append(...i),o.remove()}else super.append(o)}return this}replace(t,r){if(W(t))return super.replace(t);this.setIndent(0);const o=this.getParentOrThrow();if(!I(o))return t;if(o.__first===this.getKey())o.insertBefore(t);else if(o.__last===this.getKey())o.insertAfter(t);else{const l=Ot(o);let c=this.getNextSibling();for(;c;){const a=c;c=c.getNextSibling(),l.append(a)}o.insertAfter(t),t.insertAfter(l)}const i=this.__key;let s=0;if(r&&(C(t)||Oe(139),s=t.getChildrenSize(),t.splice(s,0,this.getChildren())),r&&C(t)){const l=D();if(w(l))for(const c of l.getStartEndPoints())c.key===i&&c.type==="element"&&c.set(t.getKey(),s+c.offset,"element")}return this.remove(),o.getChildrenSize()===0&&o.remove(),t}insertAfter(t,r=!0){const o=this.getParentOrThrow();if(I(o)||Oe(39),W(t))return super.insertAfter(t,r);const i=this.getNextSiblings();if(o.insertAfter(t,r),i.length!==0){const s=Ot(o),l=i[0];s.getListType()==="number"&&W(l)&&s.setStart(ld(0,l)),i.forEach(c=>s.append(c)),t.insertAfter(s,r)}return t}remove(t){const r=this.getPreviousSibling(),o=this.getNextSibling();super.remove(t),r&&o&&qt(r)&&qt(o)&&r.getFirstChild().getListType()===o.getFirstChild().getListType()&&(ul(r.getFirstChild(),o.getFirstChild()),o.remove())}resetOnCopyNodeFrom(t){super.resetOnCopyNodeFrom(t),t.getChecked()&&this.setChecked(!1)}insertNewAfter(t,r=!0){const o=Ot(this);return this.insertAfter(o,r),o}collapseAtStart(t){if(qt(this))return!1;const r=this.getParentOrThrow();if(W(r.getParentOrThrow()))return Jc(this),!0;const o=et().append(...this.getChildren()),i=this.getNextSiblings();if(i.length>0){const s=Ot(r);s.append(...i),r.insertAfter(s)}return r.insertAfter(o),this.remove(),r.getChildrenSize()===0&&r.remove(),o.selectStart(),!0}getValue(){return this.getLatest().__value}setValue(t){const r=this.getWritable();return r.__value=t,r}getChecked(){const t=this.getLatest();let r;const o=this.getParent();return I(o)&&(r=o.getListType()),r==="check"?!!t.__checked:void 0}setChecked(t){const r=this.getWritable();return r.__checked=t,r}toggleChecked(){const t=this.getWritable();return t.setChecked(!t.__checked)}getIndent(){const t=this.getParent();if(t===null||!this.isAttached())return this.getLatest().__indent;let r=t.getParentOrThrow(),o=0;for(;W(r);)r=r.getParentOrThrow().getParentOrThrow(),o++;return o}setIndent(t){typeof t!="number"&&Oe(117),(t=Math.floor(t))>=0||Oe(199);let r=this.getIndent();for(;r!==t;)r<t?(Vp(this),r++):(Jc(this),r--);return this}canInsertAfter(t){return W(t)}canReplaceWith(t){return W(t)}canMergeWith(t){return W(t)||Yn(t)}extractWithChild(t,r){if(!w(r))return!1;const o=r.anchor.getNode(),i=r.focus.getNode();return this.isParentOf(o)&&this.isParentOf(i)&&this.getTextContent().length===r.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return Ce("bullet")}canMergeWhenEmpty(){return!0}};function Gp(n){if(n.classList.contains("task-list-item")){for(const r of n.children)if(r.tagName==="INPUT")return Vc(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 Vc(r.children[0])}const e=n.getAttribute("aria-checked"),t=gn(e==="true"||e!=="false"&&void 0);return fi(t,n),{after:ud.bind(null,t),node:Hr(t,n)}}function Vc(n){if(n.getAttribute("type")!=="checkbox")return{node:null};const e=gn(n.hasAttribute("checked"));return{after:ud.bind(null,e),node:e}}function ud(n,e){const t=e[0];return e.length===1&&Yn(t)&&!n.getFormatType()&&t.getFormatType()?(n.setFormat(t.getFormatType()),t.getChildren()):e}function gn(n){return oe(new je(void 0,n))}function W(n){return n instanceof je}let yn=class extends yt{constructor(t="number",r=1,o){super(o);b(this,"__tag");b(this,"__start");b(this,"__listType");const i=Yp[t]||t;this.__listType=i,this.__tag=i==="number"?"ol":"ul",this.__start=r}$config(){return this.config("list",{$transform:t=>{(function(r){const o=r.getNextSibling();I(o)&&r.getListType()===o.getListType()&&ul(r,o)})(t),ad(t)},extends:yt,importDOM:{ol:()=>({conversion:Gc,priority:0}),ul:()=>({conversion:Gc,priority:0})}})}afterCloneFrom(t){super.afterCloneFrom(t),this.__listType=t.__listType,this.__tag=t.__tag,this.__start=t.__start}getTag(){return this.getLatest().__tag}setListType(t){const r=this.getWritable();return r.__listType=t,r.__tag=t==="number"?"ol":"ul",r}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(t){const r=this.getWritable();return r.__start=t,r}createDOM(t,r){const o=this.__tag,i=it().createElement(o);return this.__start!==1&&i.setAttribute("start",String(this.__start)),i.__lexicalListType=this.__listType,qc(i,t.theme,this),i}updateDOM(t,r,o){return t.__tag!==this.__tag||t.__listType!==this.__listType||(qc(r,o.theme,this),t.__start!==this.__start&&r.setAttribute("start",String(this.__start)),!1)}updateFromJSON(t){return super.updateFromJSON(t).setListType(t.listType).setStart(t.start)}exportDOM(t){const r=this.createDOM(t._config,t);if(q(r)){this.__start!==1&&r.setAttribute("start",String(this.__start)),this.__listType==="check"&&r.setAttribute("__lexicalListType","check");const o=this.getDirection();o&&(r.dir=o)}return{element:r}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(t,r,o){let i=o;for(let s=0;s<o.length;s++){const l=o[s];if(!W(l)){i===o&&(i=[...o]);const c=this.createListItemNode();!C(l)||I(l)||l.isInline()?c.append(l):c.append(...l.getChildren()),i[s]=c}}return super.splice(t,r,i)}extractWithChild(t){return W(t)}createListItemNode(){return gn()}};function qc(n,e,t){const r=[],o=[],i=e.list;if(i!==void 0){const s=i[`${t.__tag}Depth`]||[],l=gs(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(...ue(a));for(let g=0;g<s.length;g++)g!==c&&o.push(...ue(s[g]))}if(f!==void 0){const g=ue(f);l>1?r.push(...g):o.push(...g)}}o.length>0&&sl(n,...o),r.length>0&&Ne(n,...r)}function Gc(n){let e;if((function(t){return q(t)&&t.nodeName.toLowerCase()==="ol"})(n)){const t=n.start;e=Ce("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(q(r)&&r.hasAttribute("aria-checked"))return!0;return!1})(n)?Ce("check"):Ce("bullet");return Hr(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(W(c)){s.push(c);const a=c.getChildren();a.length>1&&a.forEach(u=>{I(u)&&s.push(i().append(u))})}else s.push(i().append(c))}return s})(t,e),node:e}}const Yp={ol:"number",ul:"bullet"};function Ce(n="number",e=1){return oe(new yn(n,e))}function I(n){return n instanceof yn}const Xp=F("UPDATE_LIST_START_COMMAND"),Qp=F("INSERT_UNORDERED_LIST_COMMAND"),Zp=F("INSERT_ORDERED_LIST_COMMAND"),tm=F("REMOVE_LIST_COMMAND");function Yc(n,e){return Ut(n.registerCommand(Zp,()=>(jc("number"),!0),kn),n.registerCommand(Xp,t=>{const{listNodeKey:r,newStart:o}=t,i=rt(r);return!!I(i)&&(i.getListType()==="number"&&(i.setStart(o),ad(i)),!0)},kn),n.registerCommand(Qp,()=>(jc("bullet"),!0),kn),n.registerCommand(tm,()=>(Jp(),!0),kn),n.registerCommand(Tr,()=>qp(!!(e&&e.restoreNumbering)),kn),n.registerCommand(As,t=>{const r=D();if(!w(r)||!r.isCollapsed())return!1;const{anchor:o}=r;if(o.offset!==0)return!1;let i=o.getNode();for(;!W(i);){if(i.getPreviousSibling()!==null)return!1;const s=i.getParent();if(s===null)return!1;i=s}return!(!W(i)||!i.collapseAtStart(r))&&(t.preventDefault(),!0)},kg),n.registerNodeTransform(je,t=>{const r=t.getFirstChild();if(r){if($(r)){const o=r.getStyle(),i=r.getFormat();t.getTextStyle()!==o&&t.setTextStyle(o),t.getTextFormat()!==i&&t.setTextFormat(i)}}else{const o=D();w(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(ee,t=>{const r=t.getParent();if(W(r)&&t.is(r.getFirstChild())){const o=t.getStyle(),i=t.getFormat();o===r.getTextStyle()&&i===r.getTextFormat()||r.setTextStyle(o).setTextFormat(i)}}))}function em(n){const e=t=>{const r=t.getParent();if(I(t.getFirstChild())||!I(r))return;const o=St(t,i=>W(i)&&I(i.getParent())&&W(i.getPreviousSibling()));if(o===null&&t.getIndent()>0)t.setIndent(0);else if(W(o)){const i=o.getPreviousSibling();if(W(i)){const s=(function(c){let a=c,u=a.getFirstChild();for(;I(u);){const f=u.getLastChild();if(!W(f))break;a=f,u=a.getFirstChild()}return a})(i),l=s.getParent();if(I(l)){const c=gs(l);c+1<gs(r)&&t.setIndent(c)}}}};return n.registerNodeTransform(yn,t=>{const r=[t];for(;r.length>0;){const o=r.shift();if(I(o)){for(const i of o.getChildren())if(W(i)){e(i);const s=i.getFirstChild();I(s)&&r.push(s)}}}})}const fd=B.createContext(null);function nm(n,e){return{getTheme:function(){return e??null}}}function ie(){const n=B.useContext(fd);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 rm({hasStrictIndent:n=!1,shouldPreserveNumbering:e=!1}){const[t]=ie();return B.useEffect(()=>{if(!t.hasNodes([yn,je]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[t]),B.useEffect(()=>Ut(Yc(t,{restoreNumbering:e}),n?em(t):()=>{}),[t,n,e]),(function(r){B.useEffect(()=>Yc(r),[r])})(t),null}const om=Mt?B.useLayoutEffect:B.useEffect,ro={tag:Dn};function im({initialConfig:n,children:e}){const t=B.useMemo(()=>{const{theme:r,namespace:o,nodes:i,onError:s,onWarn:l,editorState:c,html:a}=n,u=nm(null,r),f=hf({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=Y();if(g.isEmpty()){const _=et();g.append(_);const m=d.getRootElement(),p=Mt&&m!==null?Jo(m):null;(D()!==null||p!==null&&p===m)&&_.select()}},ro);else if(h!==null)switch(typeof h){case"string":{const g=d.parseEditorState(h);d.setEditorState(g,ro);break}case"object":d.setEditorState(h,ro);break;case"function":d.update(()=>{Y().isEmpty()&&h(d)},ro)}}})(f,c),[f,u]},[]);return om(()=>{const r=n.editable,[o]=t;o.setEditable(r===void 0||r)},[]),ct.jsx(fd.Provider,{value:t,children:e})}function sm(){return Y().getTextContent()}function lm(n,e=!0){if(n)return!1;let t=sm();return e&&(t=t.trim()),t===""}function cm(n){if(!lm(n,!1))return!1;const e=Y().getChildren(),t=e.length;if(t>1)return!1;for(let r=0;r<t;r++){const o=e[r];if(H(o))return!1;if(C(o)){if(!Yn(o)||o.__indent!==0)return!1;const i=o.getChildren(),s=i.length;for(let l=0;l<s;l++){const c=i[l];if(!$(c))return!1}}}return!0}function dd(n){return()=>cm(n)}const ms=Mt?B.useLayoutEffect:B.useEffect;function am({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:_,role:m="textbox",spellCheck:p=!0,style:y,tabIndex:x,"data-testid":S,...v},T){const[N,k]=B.useState(n.isEditable()),E=B.useCallback(A=>{A&&A.ownerDocument&&A.ownerDocument.defaultView?n.setRootElement(A):n.setRootElement(null)},[n]),M=B.useMemo(()=>(function(...A){return P=>{for(const L of A)typeof L=="function"?L(P):L!=null&&(L.current=P)}})(T,E),[E,T]);return ms(()=>(k(n.isEditable()),n.registerEditableListener(A=>{k(A)})),[n]),ct.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&&m==="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":S,id:_,ref:M,role:m,spellCheck:p,style:y,tabIndex:x??(N?void 0:-1),...v})}const um=B.forwardRef(am);function Xc(n){return n.read("latest",dd(n.isComposing()))}const Qc=B.forwardRef(fm);function fm(n,e){const{placeholder:t,...r}=n,[o]=ie();return ct.jsxs(ct.Fragment,{children:[ct.jsx(um,{editor:o,...r,ref:e}),t!=null&&ct.jsx(dm,{editor:o,content:t})]})}function dm({content:n,editor:e}){const t=(function(s){const[l,c]=B.useState(()=>Xc(s));return ms(()=>{function a(){const u=Xc(s);c(u)}return a(),Ut(s.registerUpdateListener(()=>{a()}),s.registerEditableListener(()=>{a()}))},[s]),l})(e),[r,o]=B.useState(e.isEditable());if(ms(()=>(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:ct.jsx("div",{"aria-hidden":!0,children:i})}class hm extends B.Component{constructor(){super(...arguments);b(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,r){this.props.onError(t instanceof Error?t:new Error(String(t),{cause:t}),r)}render(){return this.state.hasError?this.props.fallback:this.props.children}}function gm({children:n,fallback:e,onError:t}){return ct.jsx(hm,{fallback:e===void 0?ct.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}):e,onError:t,children:n})}function pm(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(!(w(i)&&w(s)&&s.isCollapsed()&&i.isCollapsed()))return 0;const l=(function(p,y,x){const S=p._nodeMap,v=[];for(const T of y){const N=S.get(T);N!==void 0&&v.push(N)}for(const[T,N]of x){if(!N)continue;const k=S.get(T);k===void 0||ut(k)||v.push(k)}return v})(e,t,r);if(l.length===0)return 0;if(l.length>1){const p=e._nodeMap,y=p.get(i.anchor.key),x=p.get(s.anchor.key);return y&&x&&!n._nodeMap.has(y.__key)&&$(y)&&y.__text.length===1&&i.anchor.offset===1?2:0}const c=l[0],a=n._nodeMap.get(c.__key);if(!$(a)||!$(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,_=h.offset,m=f.length-u.length;return m===1&&_===g-1?2:m===-1&&_===g+1?3:m===-1&&_===g?4:0}function mm(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(Bu)&&(i=r,s=o,l=c),h.has(Mo))return o=0,r=g,2;h.has(wr)&&l&&(r=i,o=s,c=l);const _=h.has(Lu)||h.has(ts)?0:pm(c,a,f,d,n.isComposing()),m=(()=>{const p=u===null||u.editor===n,y=h.has(Iu);if(!y&&p&&h.has(Dn))return 0;if(_===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 S=typeof e=="number"?e:e.peek();return y===!1&&_!==0&&_===o&&g<r+S&&p||f.size===1&&(function(v,T,N){const k=T._nodeMap.get(v),E=N._nodeMap.get(v),M=T._selection,A=N._selection;return!(w(M)&&w(A)&&M.anchor.type==="element"&&M.focus.type==="element"&&A.anchor.type==="text"&&A.focus.type==="text"||!$(k)||!$(E)||k.__parent!==E.__parent)&&JSON.stringify(T.read(()=>k.exportJSON()))===JSON.stringify(N.read(()=>E.exportJSON()))})(Array.from(f)[0],c,a)?0:1})();return r=g,o=_,m}}function Zc(n,e){if(e!==null&&e.editor===n.editor)return e;const{editor:t}=n,r=t.getEditorState();return r.isEmpty()?null:{editor:t,editorState:r}}function ta(n,e){n.undoStack=[],n.redoStack=[],n.current=null}function _m(n,e,t,r=Date.now,o,i=null){const s=mm(n,t,r);return Ut(n.registerCommand(Eo,()=>((function(l,c,a){const u=c.redoStack,f=c.undoStack;if(f.length!==0){const d=c.current,h=f.pop();if(h){const g=Zc(h,d);g!==null&&(u.push(g),l.dispatchCommand(Vr,!0))}f.length===0&&l.dispatchCommand(qr,!1),c.current=h||null,h&&h.editor.setEditorState(h.editorState,{tag:Mo})}})(n,e),!0),z),n.registerCommand(Nr,()=>((function(l,c,a){const u=c.redoStack,f=c.undoStack;if(u.length!==0){const d=c.current,h=u.pop();if(h){const g=Zc(h,d);g!==null&&(f.push(g),l.dispatchCommand(qr,!0))}u.length===0&&l.dispatchCommand(Vr,!1),c.current=h||null,h&&h.editor.setEditorState(h.editorState,{tag:Mo})}})(n,e),!0),z),n.registerCommand(Dh,()=>(ta(e),!1),z),n.registerCommand(Ph,()=>(ta(e),n.dispatchCommand(Vr,!1),n.dispatchCommand(qr,!1),!0),z),n.registerUpdateListener(({editorState:l,prevEditorState:c,dirtyLeaves:a,dirtyElements:u,tags:f})=>{const d=e.current,h=e.redoStack,g=e.undoStack,_=d===null?null:d.editorState;if(d!==null&&l===_)return;const m=s(c,l,d,a,u,f);if(m===1){h.length!==0&&(e.redoStack=[],n.dispatchCommand(Vr,!1));const p=(function(y,x,S){return S===null?null:S.editor===y?{...S}:x.isEmpty()?null:{editor:y,editorState:x}})(n,c,d);if(p!==null){g.push(p);const y=typeof i=="number"||i===null?i:i.peek();y!==null&&g.length>y&&g.splice(0,g.length-y),n.dispatchCommand(qr,!0)}}else if(m===2)return;e.current={editor:n,editorState:l}}))}function ym(){return{current:null,redoStack:[],undoStack:[]}}function xm({delay:n,externalHistoryState:e}){const[t]=ie();return(function(r,o,i=1e3){const s=B.useMemo(()=>o||ym(),[o]);B.useEffect(()=>_m(r,s,i),[i,r,s])})(t,e,n),null}const Sm=Mt?B.useLayoutEffect:B.useEffect;function Cm(n){return{initialValueFn:()=>n.isEditable(),subscribe:e=>n.registerEditableListener(e)}}function vm(){return(function(n){const[e]=ie(),t=B.useMemo(()=>n(e),[e,n]),[r,o]=B.useState(()=>t.initialValueFn()),i=B.useRef(r);return Sm(()=>{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})(Cm)}const bm={name:"@lexical/react/ReactProvider"},Tm={bold:"bold",italic:"italic",strikeThrough:"strikethrough",subscript:"subscript",superscript:"superscript",underline:"underline"},Xo=Symbol.for("@lexical/dragon/WindowState");function km(n,e,t){const r=(function(o){let i=o[Xo];return i===void 0&&(i={dispose:()=>{},editors:new Map,installs:new Set},o[Xo]=i),i})(n);if(r.installs.size===0){const o=wm.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 Nm.bind(null,n,r,e,t)}function Nm(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[Xo])}function ea(n){return n&&n.ownerDocument.defaultView}function Em(n){const e=_p(()=>ea(n.getRootElement()),t=>n.registerRootListener(r=>{t.value=ea(r)}));return qf(()=>{const t=e.value;if(t)return km(t,Symbol("@lexical/dragon/editorInstall"),n)})}function wm(n){if(n.origin!==this.location.origin)return;const e=(function(r){const o=r[Xo];if(o===void 0)return null;const i=Xn(jn(r.document));return jr(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=D();if(w(d)){const h=d.anchor;let g=h.getNode(),_=0,m=0;if($(g)&&s>=0&&l>=0&&(_=s,m=s+l,d.setTextNodeRange(g,_,g,m)),typeof c!="string"||_===m&&c===""||(d.insertRawText(c),g=h.getNode()),$(g)){const p=g.getTextContentSize();_=Math.min(Math.max(a,0),p),m=a<0||u<0?_:Math.min(a+u,p),d.setTextNodeRange(g,_,g,m)}if(typeof f=="string"&&u>0&&!d.isCollapsed()){const p=Tm[f];p!==void 0&&d.formatText(p)}n.stopImmediatePropagation()}})}}}}}function Qo(n,e,t=null){const r=Ef(t),o=t?kf(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=_n(a)}return!1})(s.offsetNode,t))return{node:s.offsetNode,offset:s.offset}}if(i){const s=t.getRootNode();if(ke(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,_=N=>a<N.left?N.left-a:a>N.right?a-N.right:0,m=d.createTreeWalker(f,NodeFilter.SHOW_TEXT);let p=null,y=1/0,x=1/0;for(let N=m.nextNode();N;N=m.nextNode()){h.selectNodeContents(N);for(const k of h.getClientRects()){const E=g(k),M=_(k);(E<y||E===y&&M<x)&&(y=E,x=M,p=N)}}if(p===null)return null;let S=0,v=1/0,T=1/0;for(let N=0;N<=p.length;N++){h.setStart(p,N),h.collapse(!0);const k=h.getBoundingClientRect(),E=g(k),M=Math.abs(a-k.left);(E<v||E===v&&M<T)&&(v=E,T=M,S=N)}return{node:p,offset:S}})(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 wn(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 na={"application/x-lexical-editor":0,"text/html":10,"text/plain":20,"text/uri-list":30};function Om(n){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:e=>e}).createHTML(n):n}const ra=(n,e)=>{if(!w(e))return e.insertRawText(n),!0;e!==D()&&Ct(e);const t=r=>{const o=D();w(o)&&r(o)};return Qu(n,{linebreak:()=>t(r=>r.insertParagraph()),tab:()=>t(r=>r.insertNodes([Kr()])),text:r=>t(o=>o.insertText(r))}),!0},oa={"application/x-lexical-editor":[(n,e,t)=>{try{const r=gt(),o=JSON.parse(n);if(o&&o.namespace===r._config.namespace&&Array.isArray(o.nodes))return ia(r,Rm(o.nodes),e),!0}catch(r){console.error(r)}return t()}],"text/html":[(n,e,t)=>{try{const r=gt(),o=new DOMParser().parseFromString(Om(n),"text/html");return ia(r,Wp(r,o),e),!0}catch(r){return console.error(r),t()}}],"text/plain":[ra],"text/uri-list":[ra]};function $m(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 Mm(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)&&$m(n.$importMimeType[o],i,t,e))return!0}return!1}const Am={$importMimeType:oa,$insertDataTransfer:(n,e)=>Mm({$importMimeType:oa,priority:na},n,e),priority:na},Dm={name:"@lexical/clipboard/Import"};function hd(n,e=D()){return e==null&&wn(166),w(e)&&e.isCollapsed()||e.getNodes().length===0?"":jp(n,e)}function gd(n,e=D()){return e==null&&wn(166),w(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(Lm(n,e))}function _s(n,e,t){(function(){const r=Np(Dm.name);return r?r.output:Am})().$insertDataTransfer(n,e)}const pd="application/x-lexical-drag";function Pm(n,e){const t={editorKey:e.getKey()};n.setData(pd,JSON.stringify(t))}function Fm(n,e,t){const r=n.dataTransfer;if(r===null)return!1;const o=(function(a){const u=a.getData(pd);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=Qo(a.clientX,a.clientY,u.getRootElement());if(f===null)return null;const d=cn(f.node);if(d===null)return null;if($(d))return Ke(d,"next",f.offset);if(C(d))return ls(d,f.offset,"next");const h=d.getParent();return h===null?null:ls(h,d.getIndexWithinParent()+1,"next")})(n,e);if(i===null)return!1;const s=af(i);if(s===null)return!1;const l=o.editorKey===e.getKey(),c=D();if(l){if(!w(c)||c.isCollapsed())return!1;if((function(a,u){const{anchor:f,focus:d}=Wr(Ko(u),"next");return ze(f,a)<0&&ze(a,d)<0})(i,c))return n.preventDefault(),!0;c.removeText()}if(!s.origin.isAttached())return n.preventDefault(),!0;if(t(r,zn(gi(s)),e),!l){const a=e.getRootElement(),u=a?a.ownerDocument:null,f=u?(function(d,h){for(const g of Nf(h)){const _=Xn(g);if(jr(_)&&_.getKey()===d&&q(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 Im(n,e){return Fm(n,e,_s)}function ia(n,e,t){n.dispatchCommand(Eh,{nodes:e,selection:t})||(t.insertNodes(e),(function(r){if(w(r)&&r.isCollapsed()){const o=r.anchor;let i=null;const s=zt(o,"previous");if(s)if(Xt(s))i=s.origin;else{const l=Zt(s,It(Y(),"next").getFlipped());for(const c of l){if($(c.origin)){i=c.origin;break}if(C(c.origin)&&!c.origin.isInline())break}}if(i&&$(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 ys(n,e,t,r=[]){let o=e===null||t.isSelected(e);const i=C(t)&&t.excludeFromCopy("clone");let s=t;e!==null&&$(s)&&(s=zf(e,s,"clone"));const l=C(s)?s.getChildren():[],c=(function(u){const f=u.exportJSON(),d=u.constructor;if(f.type!==d.getType()&&wn(58,d.name),C(u)){const h=f.children;Array.isArray(h)||wn(59,d.name)}return f})(s);$(s)&&s.getTextContentSize()===0&&(o=!1);const a=o&&at(e)&&C(t)?null:e;for(let u=0;u<l.length;u++){const f=l[u],d=ys(n,a,f,c.children);!o&&C(t)&&d&&t.extractWithChild(f,e,"clone")&&(o=!0)}if(o&&!i){const u=ce(s);if(u.length>0){const f={};for(const d of u){const h=Hn(s,d);h===null&&wn(366,s.constructor.name,d);const g=[];ys(n,null,h,g),g.length===1&&g[0].type===h.getType()||wn(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 Lm(n,e){const t=[],r=Y(),o=Ff(e),i=(C(o)?o:r).getChildren();for(let s=0;s<i.length;s++)ys(n,e,i[s],t);return{namespace:n._config.namespace,nodes:t}}function Rm(n){const e=[];for(const t of n)e.push(hg(t));return e}let vn=null;async function sa(n,e,t){if(vn!==null)return!1;if(e!==null)return new Promise((a,u)=>{n.update(()=>{a(la(n,e,t))})});const r=n.getRootElement(),o=n._window||window,i=o.document,s=Lt(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(ri,d=>(Ae(d,ClipboardEvent)&&(f(),vn!==null&&(o.clearTimeout(vn),vn=null),a(la(n,d,t))),!0),xe);vn=o.setTimeout(()=>{f(),vn=null,a(!1)},50),i.execCommand("copy"),l.remove()})}function la(n,e,t){if(t===void 0){const o=Lt(n._window),i=D();if(!i||i.isCollapsed()||!o)return!1;const s=Bt(o,n.getRootElement()),l=s.anchorNode,c=s.focusNode;if(l!==null&&c!==null&&!Ur(n,l,c))return!1;t=md(i)}e.preventDefault();const r=e.clipboardData;return r!==null&&(_d(r,t),!0)}const Bm=[["text/html",hd],["application/x-lexical-editor",gd]];function md(n=D()){return(function(e,t){const r={"text/plain":""};for(const[o,i]of Object.entries(e))if(i){const s=Wm(i,t);s!==null&&(r[o]=s)}return r})(Km(),n)}function _d(n,e){for(const[t]of Bm)e[t]===void 0&&n.setData(t,"");for(const t in e){const r=e[t];r!==void 0&&n.setData(t,r)}}function Km(n=gt()){const e=Jr(n,Um.name);return e?e.output:zm}const zm={"application/x-lexical-editor":[(n,e)=>n?gd(gt(),n):e()],"text/html":[(n,e)=>n?hd(gt(),n):e()],"text/plain":[(n,e)=>n?n.getTextContent():e()]};function Wm(n,e){const t=r=>n[r]?n[r](e,t.bind(null,r-1)):null;return t(n.length-1)}const Um={name:"@lexical/clipboard/GetClipboardData"},ca=F("DRAG_DROP_PASTE_FILE"),Fi=qn("shadowRoot",{parse:Boolean});let fl=class extends yt{$config(){return this.config("quote",{extends:yt,importDOM:{blockquote:()=>({conversion:jm,priority:0})},stateConfigs:[{flat:!0,stateConfig:Fi}]})}isShadowRoot(){return xr(this,Fi)}setIsShadowRoot(e){return Rr(this,Fi,e)}createDOM(e){const t=it().createElement("blockquote");return Ne(t,e.theme.quote),t}updateDOM(e,t,r){return!1}exportDOM(e){const{element:t}=super.exportDOM(e);if(q(t)){this.isEmpty()&&t.append(it().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 dl().updateFromJSON(e)}insertNewAfter(e,t){const r=et();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(){if(this.isShadowRoot()){for(const t of this.getChildren())this.insertBefore(t);return this.remove(),!0}const e=et();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function dl(n){const e=oe(new fl);return n&&n.shadowRoot?e.setIsShadowRoot(!0):e}function Zo(n){return n instanceof fl}let pi=class extends yt{constructor(t="h1",r){super(r);b(this,"__tag");this.__tag=t}$config(){return this.config("heading",{extends:yt,importDOM:{h1:()=>({conversion:bn,priority:0}),h2:()=>({conversion:bn,priority:0}),h3:()=>({conversion:bn,priority:0}),h4:()=>({conversion:bn,priority:0}),h5:()=>({conversion:bn,priority:0}),h6:()=>({conversion:bn,priority:0}),p:t=>{const r=t.firstChild;return r!==null&&aa(r)?{conversion:()=>({node:null}),priority:3}:null},span:t=>aa(t)?{conversion:()=>({node:ti("h1")}),priority:3}:null}})}afterCloneFrom(t){super.afterCloneFrom(t),this.__tag=t.__tag}getTag(){return this.getLatest().__tag}setTag(t){const r=this.getWritable();return r.__tag=t,r}createDOM(t){const r=this.__tag,o=it().createElement(r),i=t.theme.heading;if(i!==void 0){const s=i[r];Ne(o,s)}return o}updateDOM(t,r,o){return t.__tag!==this.__tag}exportDOM(t){const{element:r}=super.exportDOM(t);if(q(r)){this.isEmpty()&&r.append(it().createElement("br"));const o=this.getFormatType();o&&(r.style.textAlign=o);const i=this.getDirection();i&&(r.dir=i)}return{element:r}}updateFromJSON(t){return super.updateFromJSON(t).setTag(t.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(t,r=!0){const o=t?t.anchor.offset:0,i=this.getLastDescendant(),s=!i||t&&t.anchor.key===i.getKey()&&o===i.getTextContentSize()||!t?et():ti(this.getTag()).setFormat(this.getFormatType()).setStyle(this.getStyle()),l=this.getDirection();if(s.setDirection(l),this.insertAfter(s,r),o===0&&!this.isEmpty()&&t){const c=et();c.select(),this.replace(c,!0)}return s}collapseAtStart(){if(this.isEmpty()){const t=et();this.getChildren().forEach(r=>t.append(r)),this.replace(t)}return!0}extractWithChild(){return!0}};function aa(n){return n.nodeName.toLowerCase()==="span"&&n.style.fontSize==="26pt"}function bn(n){const e=n.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=ti(e),Zs(n,t),fi(t,n),Hr(t,n)),{node:t}}function jm(n){const e=dl();return fi(e,n),Zs(n,e),Hr(e,n),{node:e}}function ti(n="h1"){return oe(new pi(n))}function hl(n){return n instanceof pi}function ua(n){const e=cn(n);return H(e)}function yd(n){const e=n.focus;return e.key==="root"&&e.offset===Y().getChildrenSize()}function xd(n){const e=n.focus;return e.key==="root"&&e.offset===0}function fa(n,e){if(!n.isCollapsed())return!1;const t=e==="next";if(!(t?yd(n):xd(n)))return!1;const r=n.focus.offset;return Mr(Y().getChildAtIndex(t?r-1:r))}function Tn(n,e,t,r){let o=!1,i=null;if(n.isCollapsed()&&n.anchor.type==="text"){const l=n.anchor.getNode();if($(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&&$(i)&&i.hasFormat(a)))continue;s=!0}n.hasFormat(a)&&n.toggleFormat(a)}s&&n.setStyle("")}const Hm={capitalize:{enter:!0,space:!0,tab:!0},lowercase:{enter:!0,space:!0,tab:!0},uppercase:{enter:!0,space:!0,tab:!0}};function oo(n,e){return(function(t,r){if(!t.isCollapsed())return!1;const o=zt(t.focus,r),i=St(o.origin,gr);if(!i)return!1;const s=t.focus.getNode();if(!i.is(s)&&!Un(s,i))return!1;const l=Zt(o,X(i,r));if(l.getTextSlices().some(f=>f&&f.getTextContentSize()>0))return!1;const c=Zt(l.anchor.getSiblingCaret(),l.focus);let a=c.anchor.origin;for(const f of c){if(!Be(f)||!f.origin.is(a.getParent()))return!1;a=f.origin}let u=i;for(const f of hi(X(i,r))){if(!f.origin.is(u.getParent())){if(Mr(f.origin)){const d=X(u,r);return zn(Zt(d,d)),!0}break}if(!gr(f.origin))break;u=f.origin}return!1})(n,e)||(function(t,r){if(!t.isCollapsed()||t.anchor.type!=="element")return!1;const o=zt(t.anchor,r).getNodeAtCaret();return!(!gr(o)||o.isInline()||(zn(gi(Ft(It(o,r)))),0))})(n,e)}function da(n){return H(n)&&!n.isInline()&&!n.isIsolated()&&n.isKeyboardSelectable()}function io(n){const e=Ks();e.add(n),Ct(e)}function ha(n,e){if(!n.isCollapsed())return!1;const t=n.focus,r=t.getNode(),o=e?"previous":"next",i=zt(t,o);if(t.type==="element"&&C(r)&&Z(r)){const p=i.getNodeAtCaret();return!(p===null||!da(p))&&(io(p.__key),!0)}const s=St(C(r)?r:r.getParentOrThrow(),p=>C(p)&&!p.isInline()&&Z(p.getParent()));if(s===null)return!1;const l=X(s,o).getNodeAtCaret();if(l===null||!da(l))return!1;if(s.getTextContentSize()===0)return io(l.__key),!0;const c=gt().getRootElement();if(c===null)return!1;const a=Lt(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,_=a.anchorOffset;if(g===null)return ga(a,u,f,d,h),!1;const m=cn(g);return ga(a,u,f,d,h),m===null?!1:(g===u&&_===f||!m.is(s)&&!Un(m,s))&&(io(l.__key),!0)}function ga(n,e,t,r,o){e!==null&&r!==null&&n.setBaseAndExtent(e,t,r,o)}function pa(n,e){if(!n.isCollapsed())return!1;const t=n.focus.getNode(),r=St(C(t)?t:t.getParentOrThrow(),m=>C(m)&&!m.isInline());if(r===null)return!1;const o=gt(),i=o.getRootElement();if(i===null)return!1;const s=i.ownerDocument.defaultView;if(s===null)return!1;let l=!1;for(const m of r.getChildren())if(C(m)&&m.isInline()){const p=o.getElementByKey(m.getKey());if(p!==null){const y=s.getComputedStyle(p).display;if(y==="inline-grid"||y==="inline-flex"){l=!0;break}}}if(!l)return!1;const c=X(r,e?"previous":"next").getNodeAtCaret();if(c===null||!C(c)){if(e){const m=r.getFirstDescendant();$(m)?m.select(0,0):r.select(0,0)}else{const m=r.getLastDescendant();if($(m)){const p=m.getTextContentSize();m.select(p,p)}else{const p=r.getChildrenSize();r.select(p,p)}}return!0}const a=o.getElementByKey(c.getKey());if(a===null)return!1;const u=Lt(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 m=Qo(d.left,g,i);if(m!==null&&a.contains(m.node)){const p=i.ownerDocument.createRange();return p.setStart(m.node,m.offset),p.collapse(!0),n.applyDOMRange(p),n.dirty=!0,!0}}const _=e?c.getLastDescendant():c.getFirstDescendant();if($(_)){const m=e?_.getTextContentSize():0;_.select(m,m)}else{const m=c.getChildrenSize();c.select(e?m:0,e?m:0)}return!0}function so(n,e){const t=X(n,e),r=t.getAdjacentCaret();r!==null&&C(r.origin)&&!r.origin.isInline()&&r.origin.isShadowRoot()?zn(gi(t)):e==="next"?n.selectNext(0,0):n.selectPrevious()}function lo(n,e){const t=n.getNodes().map(i=>X(i,"next")).sort(ze),r=t[0],o=t[t.length-1];if(!r||!o)return!1;for(let i=0;i<t.length-1;i++)if(!t[i+1].origin.is(t[i].getNodeAtCaret()))return!1;return zn(Wr(Zt(We(r),o),e)),gg(),!0}function ma(n,e,t){t.preventDefault(),t.stopPropagation();const r=n.getNodes();if(r.length===0)return!0;const o=r.map(c=>X(c,"next")).sort(ze),i=(e?o[0]:o[o.length-1]).origin,s=St(i,c=>c!==i&&C(c)&&!c.isInline())??Y(),l=e?0:s.getChildrenSize();return s.select(l,l),!0}function Jm(n,e){return n.length>0&&!e}function Vm(n,e=ds(Hm),t=ds(Jm)){return Ut(n.registerCommand(_u,r=>{const o=D();if(at(o)){const i=r.target;if(q(i))for(const s of o.getNodes()){const l=n.getElementByKey(s.getKey());if(l!==null&&l.contains(i))return!1}return o.clear(),!0}return w(o)&&Tn(o,"click","both",e.peek()),!1},z),n.registerCommand(Qe,r=>{const o=D();return w(o)?(o.deleteCharacter(r),!0):!!at(o)&&(o.deleteNodes(),!0)},z),n.registerCommand(kr,r=>{const o=D();return!!w(o)&&(o.deleteWord(r),!0)},z),n.registerCommand(Mn,r=>{const o=D();return!!w(o)&&(o.deleteLine(r),!0)},z),n.registerCommand($n,r=>{const o=D();if(typeof r=="string")o!==null&&o.insertText(r);else{if(o===null)return!1;const i=r.dataTransfer;if(i!=null)_s(i,o);else if(w(o)){const s=r.data;return s&&o.insertText(s),!0}}return!0},z),n.registerCommand(uo,()=>{const r=D();return!!w(r)&&(r.removeText(),!0)},z),n.registerCommand($e,r=>{const o=D();return!(!w(o)&&!at(o))&&(ju(o,r),!0)},z),n.registerCommand(wh,r=>{const o=D();return!(!w(o)&&!at(o))&&(sg(o,r),!0)},z),n.registerCommand(Mh,r=>{const o=D();if(!w(o)&&!at(o))return!1;const i=o.getNodes();for(const s of i){const l=St(s,c=>C(c)&&!c.isInline());l!==null&&l.setFormat(r)}return!0},z),n.registerCommand(On,r=>{const o=D();return!!w(o)&&(o.insertLineBreak(r),!0)},z),n.registerCommand(Tr,()=>{const r=D();return!!w(r)&&(r.insertParagraph(),!0)},z),n.registerCommand(Oh,()=>{const r=Kr(),o=D();return w(o)&&(r.setFormat(o.format),r.setStyle(o.style)),ag([r]),!0},z),n.registerCommand($h,()=>Fc(r=>{const o=r.getIndent();r.setIndent(o+1)}),z),n.registerCommand(Ll,()=>Fc(r=>{const o=r.getIndent();o>0&&r.setIndent(Math.max(0,o-1))}),z),n.registerCommand($s,r=>{let o=D();if(at(o)){const i=o.getNodes();if(i.length>0){if(!r.shiftKey||!lo(o,"previous"))return r.preventDefault(),so(i[0],"previous"),!0;o=D()}}return w(o)&&(xd(o)||!r.shiftKey&&oo(o,"previous")||!r.shiftKey&&ha(o,!0)||!r.shiftKey&&pa(o,!0))?(r.preventDefault(),!0):!1},z),n.registerCommand(Ms,r=>{let o=D();if(at(o)){const i=o.getNodes();if(i.length>0){if(!r.shiftKey||!lo(o,"next"))return r.preventDefault(),so(i[0],"next"),!0;o=D()}}return w(o)&&(yd(o)||!r.shiftKey&&oo(o,"next")||!r.shiftKey&&ha(o,!1)||!r.shiftKey&&pa(o,!1))?(r.preventDefault(),!0):!1},z),n.registerCommand(Tu,r=>{let o=D();if(at(o)){const s=o.getNodes();if(s.length>0){const l=Zr(s[0])?"next":"previous";if(!r.shiftKey||!lo(o,l))return r.preventDefault(),so(s[0],l),!0;o=D()}}if(!w(o))return!1;const i=Zr(o.anchor.getNode())?"next":"previous";if(fa(o,i)||!r.shiftKey&&oo(o,i))return r.preventDefault(),!0;if(r.shiftKey||Tn(o,"arrow","start",e.peek()),Dc(o,!0)){const s=r.shiftKey;return r.preventDefault(),Pc(o,s,!0),!0}return!1},z),n.registerCommand(bu,r=>{let o=D();if(at(o)){const s=o.getNodes();if(s.length>0){const l=Zr(s[0])?"previous":"next";if(!r.shiftKey||!lo(o,l))return r.preventDefault(),so(s[0],l),!0;o=D()}}if(!w(o))return!1;const i=Zr(o.anchor.getNode())?"previous":"next";if(fa(o,i)||!r.shiftKey&&oo(o,i))return r.preventDefault(),!0;if(r.shiftKey||Tn(o,"arrow","end",e.peek()),Dc(o,!1)){const s=r.shiftKey;return r.preventDefault(),Pc(o,s,!1),!0}return!1},z),n.registerCommand(As,r=>{const o=D();if(!at(o)&&ua(r.target))return!1;if(w(o)){if((function(i){if(!i.isCollapsed())return!1;const{anchor:s}=i;if(s.offset!==0)return!1;const l=s.getNode();if(ut(l))return!1;const c=hp(l);return c.getIndent()>0&&(c.is(l)||l.is(c.getFirstDescendant()))})(o))return r.preventDefault(),n.dispatchCommand(Ll);if(be&&Kn)return!1}else if(!at(o))return!1;return r.preventDefault(),n.dispatchCommand(Qe,!0)},z),n.registerCommand(Nu,r=>{const o=D();return!(!at(o)&&ua(r.target))&&!(!w(o)&&!at(o))&&(r.preventDefault(),n.dispatchCommand(Qe,!1))},z),n.registerCommand(Br,r=>{let o=D();if(at(o)){const i=o.getNodes();i.length===1&&H(i[0])&&!i[0].isInline()&&(o=i[0].selectNext())}if(!w(o))return!1;if(Tn(o,"enter","both",e.peek()),r!==null){if((be||Ir||Lr)&&Kn)return!1;if(r.preventDefault(),r.shiftKey)return n.dispatchCommand(On,!1)}return n.dispatchCommand(Tr)},z),n.registerCommand(Ds,()=>{const r=D();return!!w(r)&&(n.blur(),!0)},z),n.registerCommand(Fs,r=>{const[,o]=to(r);if(o.length>0){const i=r.clientX,s=r.clientY,l=Qo(i,s,n.getRootElement());if(l!==null){const{offset:c,node:a}=l,u=cn(a);if(u!==null){const f=Bs();if($(u))f.anchor.set(u.getKey(),c,"text"),f.focus.set(u.getKey(),c,"text");else{const h=u.getParentOrThrow().getKey(),g=u.getIndexWithinParent()+1;f.anchor.set(h,g,"element"),f.focus.set(h,g,"element")}const d=Os(f);Ct(d)}}return n.dispatchCommand(ca,o),r.preventDefault(),!0}return Im(r,n)},z),n.registerCommand(Eu,r=>{const[o]=to(r),i=D();return!(o&&!w(i))&&(w(i)&&!i.isCollapsed()&&r.dataTransfer!==null&&(_d(r.dataTransfer,md(i)),Pm(r.dataTransfer,n)),!0)},z),n.registerCommand(Is,r=>{const[o]=to(r),i=D();if(o&&!w(i))return!1;const s=r.clientX,l=r.clientY,c=Qo(s,l,n.getRootElement());if(c!==null){const a=cn(c.node);H(a)&&r.preventDefault()}return!0},z),n.registerCommand(wu,()=>{const r=D();return Mg(w(r)&&Dr(r.anchor.getNode())!==null?r:null),!0},z),n.registerCommand(ri,r=>(sa(n,Ae(r,ClipboardEvent)?r:null),!0),z),n.registerCommand(Ls,r=>((async function(o,i){i.update(()=>{const s=D();w(s)&&!s.isCollapsed()&&go(s)},{discrete:!0,tag:ts}),await sa(i,Ae(o,ClipboardEvent)?o:null),i.update(()=>{const s=D();w(s)?s.removeText():at(s)&&s.getNodes().forEach(l=>l.remove())},{tag:ts})})(r,n),!0),z),n.registerCommand(ni,r=>{const[,o,i]=to(r);return t.peek()(o,i)&&n.dispatchCommand(ca,o)?!0:Zn(r.target)&&Js(r.target)?!1:D()!==null&&((function(s,l){s.preventDefault(),l.update(()=>{const c=D(),a=Ae(s,InputEvent)||Ae(s,KeyboardEvent)?null:s.clipboardData;a!=null&&c!==null&&_s(a,c)},{tag:Lu})})(r,n),!0)},z),n.registerCommand(ku,()=>{const r=D();return w(r)&&Tn(r,"space","both",e.peek()),!1},z),n.registerCommand(Ps,()=>{const r=D();return w(r)&&Tn(r,"tab","both",e.peek()),!1},z),n.registerCommand(Gi,r=>{const o=D();if(at(o))return ma(o,!1,r);if(!w(o))return!1;const{anchor:i}=o;if(i.type!=="element"||i.offset!==0)return!1;const s=i.getNode();if(!C(s))return!1;const l=s.getFirstChild();if(!H(l)||!l.isInline())return!1;const c=s.getKey(),a=s.selectEnd();return r.shiftKey&&a.anchor.set(c,0,"element"),r.preventDefault(),r.stopPropagation(),!0},z),n.registerCommand(Yi,r=>{const o=D();if(at(o))return ma(o,!0,r);if(!w(o))return!1;const{anchor:i,focus:s}=o,l=St(s.getNode(),u=>C(u)&&!u.isInline());if(l===null)return!1;const c=l.getFirstChild();if(!H(c)||!c.isInline()||St(i.getNode(),u=>C(u)&&!u.isInline())!==l)return!1;const a=l.getKey();return(s.type!=="element"||s.key!==a||s.offset!==0)&&(o.focus.set(a,0,"element"),r.shiftKey||o.anchor.set(a,0,"element"),r.preventDefault(),r.stopPropagation(),!0)},z))}function qm(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 Gm(n,e){const[t,r]=B.useMemo(()=>[s=>n.registerDecoratorListener(s),()=>n.getDecorators()],[n]),o=B.useSyncExternalStore(t,r,r),i=(function(s){const[l,c]=B.useMemo(()=>[s.registerRootListener.bind(s),s.getRootElement.bind(s)],[s]);return B.useSyncExternalStore(l,c,c)})(n);return B.useMemo(()=>{const s=c=>n._onError(c),l=[];for(const c in o){const a=n.getElementByKey(c);if(a!==null){const u=ct.jsx(e,{onError:s,children:ct.jsx(B.Suspense,{fallback:null,children:o[c]})});l.push(Gd.createPortal(u,a,c))}}return l},[e,o,n,i])}function Ym({editor:n,ErrorBoundary:e}){return Gm(n,e)}function Xm({editor:n,ErrorBoundary:e}){return(function(t){const r=Ln.maybeFromEditor(t);if(r&&r.hasExtensionByName(bm.name)){for(const o of["@lexical/plain-text","@lexical/rich-text"])r.hasExtensionByName(o)&&qm(320,o);return!0}return!1})(n)?null:ct.jsx(Ym,{editor:n,ErrorBoundary:e})}const Sd=Mt?B.useLayoutEffect:B.useEffect;function _a(n){return n.read("latest",dd(n.isComposing()))}function Qm({contentEditable:n,placeholder:e=null,ErrorBoundary:t}){const[r]=ie();return(function(o){Sd(()=>Ut(Vm(o),Em(o)),[o])})(r),ct.jsxs(ct.Fragment,{children:[n,ct.jsx(Zm,{content:e}),ct.jsx(Xm,{editor:r,ErrorBoundary:t})]})}function Zm({content:n}){const[e]=ie(),t=(function(o){const[i,s]=B.useState(()=>_a(o));return Sd(()=>{function l(){const c=_a(o);s(c)}return l(),Ut(o.registerUpdateListener(()=>{l()}),o.registerEditableListener(()=>{l()}))},[o]),i})(e),r=vm();return t?typeof n=="function"?n(r):n:null}function t_(n,e){let t=n;for(let r=X(n,e);r&&(bd(r.origin)||rn(r.origin));r=r.getAdjacentCaret())t=r.origin;return t}function e_(n){return t_(n,"previous")}function Cd(n,e){for(const t of n.childNodes)if(q(t)&&t.tagName===e||Cd(t,e))return!0;return!1}const ar="data-language",cr="data-highlight-language",ur="data-theme";let gl=class extends yt{constructor(t=void 0,r){super(r);b(this,"__language");b(this,"__theme");b(this,"__isSyntaxHighlightSupported");this.__language=t||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}$config(){return this.config("code",{extends:yt,importDOM:{code:t=>t.textContent!=null&&(/\r?\n/.test(t.textContent)||Cd(t,"BR"))?{conversion:ya,priority:1}:null,div:()=>({conversion:n_,priority:1}),pre:()=>({conversion:ya,priority:0}),table:t=>Ii(t)?{conversion:r_,priority:3}:null,td:t=>{const r=t,o=r.closest("table");return r.classList.contains("js-file-line")||o&&Ii(o)?{conversion:xa,priority:3}:null},tr:t=>{const r=t.closest("table");return r&&Ii(r)?{conversion:xa,priority:3}:null}}})}afterCloneFrom(t){super.afterCloneFrom(t),this.__language=t.__language,this.__theme=t.__theme,this.__isSyntaxHighlightSupported=t.__isSyntaxHighlightSupported}createDOM(t){const r=it().createElement("code");Ne(r,t.theme.code),r.setAttribute("spellcheck","false");const o=this.getLanguage();o&&(r.setAttribute(ar,o),this.getIsSyntaxHighlightSupported()&&r.setAttribute(cr,o));const i=this.getTheme();i&&r.setAttribute(ur,i);const s=this.getStyle();return s&&Pn(r.style,s),r}updateDOM(t,r,o){const i=this.__language,s=t.__language;i?i!==s&&r.setAttribute(ar,i):s&&r.removeAttribute(ar);const l=this.__isSyntaxHighlightSupported;t.__isSyntaxHighlightSupported&&s?l&&i?i!==s&&r.setAttribute(cr,i):r.removeAttribute(cr):l&&i&&r.setAttribute(cr,i);const c=this.__theme,a=t.__theme;c?c!==a&&r.setAttribute(ur,c):a&&r.removeAttribute(ur);const u=this.__style,f=t.__style;return u!==f&&Pn(r.style,u,f),!1}exportDOM(t){const r=it().createElement("pre");Ne(r,t._config.theme.code),r.setAttribute("spellcheck","false");const o=this.getLanguage();o&&(r.setAttribute(ar,o),this.getIsSyntaxHighlightSupported()&&r.setAttribute(cr,o));const i=this.getTheme();i&&r.setAttribute(ur,i);const s=this.getStyle();return s&&Pn(r.style,s),{element:r}}updateFromJSON(t){return super.updateFromJSON(t).setLanguage(t.language).setTheme(t.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(t,r=!0){if(!Jr(gt(),"@lexical/code")){const l=o_(t);if(l)return l}const{anchor:o,focus:i}=t,s=(o.isBefore(i)?o:i).getNode();if($(s)){let l=e_(s);const c=[];for(;;)if(rn(l))c.push(Kr()),l=l.getNextSibling();else{if(!bd(l))break;{let _=0;const m=l.getTextContent(),p=l.getTextContentSize();for(;_<p&&m[_]===" ";)_++;if(_!==0&&c.push(i_(" ".repeat(_))),_!==p)break;l=l.getNextSibling()}}const a=s.splitText(o.offset)[0],u=o.offset===0?0:1,f=a.getIndexWithinParent()+u,d=s.getParentOrThrow(),h=[Le(),...c];d.splice(f,0,h);const g=c[c.length-1];g?g.select():o.offset===0?a.selectPrevious():a.getNextSibling().selectNext(0,0)}if(Jn(s)){const{offset:l}=t.anchor;s.splice(l,0,[Le()]),s.select(l+1,l+1)}return null}canIndent(){return!1}collapseAtStart(){const t=et();return this.getChildren().forEach(r=>t.append(r)),this.replace(t),!0}setLanguage(t){const r=this.getWritable();return r.__language=t||void 0,r}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(t){const r=this.getWritable();return r.__isSyntaxHighlightSupported=t,r}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(t){const r=this.getWritable();return r.__theme=t||void 0,r}getTheme(){return this.getLatest().__theme}};function De(n,e){return Af(gl).setLanguage(n).setTheme(e)}function Jn(n){return n instanceof gl}function ya(n){return{node:De(n.getAttribute(ar),n.getAttribute(ur))}}function n_(n){const e=n,t=Sa(e);return t||(function(r){let o=r.parentElement;for(;o!==null;){if(Sa(o))return!0;o=o.parentElement}return!1})(e)?{node:t?De():null}:{node:null}}function r_(){return{node:De()}}function xa(){return{node:null}}function Sa(n){return n.style.fontFamily.match("monospace")!==null}function Ii(n){return n.classList.contains("js-file-line-container")}function o_(n){const{anchor:e}=n;if(n.isCollapsed()&&e.type==="element"){const t=e.getNode();if(Jn(t)){const r=t.getChildrenSize();if(r>=2&&e.offset===r){const o=t.getLastChild();if(Tt(o)&&Tt(o.getPreviousSibling())){const i=et();return t.splice(r-2,2,[]).insertAfter(i,!1),i.select(),i}}}}return null}class vd extends ee{constructor(t="",r,o){super(t,o);b(this,"__highlightType");this.__highlightType=r}$config(){return this.config("code-highlight",{extends:ee})}afterCloneFrom(t){super.afterCloneFrom(t),this.__highlightType=t.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(t){const r=this.getWritable();return r.__highlightType=t||void 0,r}canHaveFormat(){return!1}createDOM(t){const r=super.createDOM(t),o=Li(t.theme,this.__highlightType);return Ne(r,o),r}updateDOM(t,r,o){const i=super.updateDOM(t,r,o),s=Li(o.theme,t.__highlightType),l=Li(o.theme,this.__highlightType);return s!==l&&(s&&sl(r,s),l&&Ne(r,l)),i}updateFromJSON(t){return super.updateFromJSON(t).setHighlightType(t.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(t){return this}isParentRequired(){return!0}createParentElementNode(){return De()}}function Li(n,e){return e&&n&&n.codeHighlight&&n.codeHighlight[e]}function i_(n="",e){return oe(new vd(n,e))}function bd(n){return n instanceof vd}const Ca=new Set(["http:","https:","mailto:","sms:","tel:"]);class Fr extends yt{constructor(t="",r={},o){super(o);b(this,"__url");b(this,"__target");b(this,"__rel");b(this,"__title");const{target:i=null,rel:s=null,title:l=null}=r;this.__url=t,this.__target=i,this.__rel=s,this.__title=l}$config(){return this.config("link",{extends:yt,importDOM:{a:()=>({conversion:s_,priority:1})}})}afterCloneFrom(t){super.afterCloneFrom(t),this.__url=t.__url,this.__rel=t.__rel,this.__target=t.__target,this.__title=t.__title}createDOM(t){const r=it().createElement("a");return this.updateLinkDOM(null,r,t),Ne(r,t.theme.link),r}updateLinkDOM(t,r,o){if(Of(r)){t&&t.__url===this.__url||(r.href=this.sanitizeUrl(this.__url));for(const i of["target","rel","title"]){const s=`__${i}`,l=this[s];t&&t[s]===l||(l?r[i]=l:r.removeAttribute(i))}}}updateDOM(t,r,o){return this.updateLinkDOM(t,r,o),!1}updateFromJSON(t){return super.updateFromJSON(t).setURL(t.url).setRel(t.rel||null).setTarget(t.target||null).setTitle(t.title||null)}sanitizeUrl(t){const r=t;t=ba(t);try{const o=new URL(ba(t));if(!Ca.has(o.protocol))return"about:blank"}catch{const i=r.replace(/[\u0000-\u001F\u007F\s]/g,"").match(/^([a-z][a-z0-9+.-]*):/i);if(i!=null&&!Ca.has(`${i[1].toLowerCase()}:`))return"about:blank"}return t}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(t){const r=this.getWritable();return r.__url=t,r}getTarget(){return this.getLatest().__target}setTarget(t){const r=this.getWritable();return r.__target=t,r}getRel(){return this.getLatest().__rel}setRel(t){const r=this.getWritable();return r.__rel=t,r}getTitle(){return this.getLatest().__title}setTitle(t){const r=this.getWritable();return r.__title=t,r}insertNewAfter(t,r=!0){const o=Ot(this);return this.insertAfter(o,r),o}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(t,r,o){if(!w(r))return!1;const i=r.anchor.getNode(),s=r.focus.getNode();return(this.is(i)||this.isParentOf(i))&&(this.is(s)||this.isParentOf(s))&&r.getTextContent().length>0}isEmailURI(){return this.getURL().startsWith("mailto:")}isWebSiteURI(){const t=this.getURL();return t.startsWith("https://")||t.startsWith("http://")}shouldMergeAdjacentLink(t){return this.getType()===t.getType()&&this.getURL()===t.getURL()&&this.getTarget()===t.getTarget()&&this.getRel()===t.getRel()&&this.getTitle()===t.getTitle()}}function s_(n){let e=null;if(Of(n)){const t=n.textContent;(t!==null&&t!==""||n.children.length>0)&&(e=Td(n.getAttribute("href")||"",{rel:n.getAttribute("rel"),target:n.getAttribute("target"),title:n.getAttribute("title")}))}return{node:e}}function Td(n="",e){return oe(new Fr(n,e))}function va(n){return n instanceof Fr}let l_=class extends Fr{constructor(t="",r={},o){super(t,r,o);b(this,"__isUnlinked");this.__isUnlinked=r.isUnlinked!==void 0&&r.isUnlinked!==null&&r.isUnlinked}afterCloneFrom(t){super.afterCloneFrom(t),this.__isUnlinked=t.__isUnlinked}$config(){return this.config("autolink",{extends:Fr})}shouldMergeAdjacentLink(t){return!1}getIsUnlinked(){return this.getLatest().__isUnlinked}setIsUnlinked(t){const r=this.getWritable();return r.__isUnlinked=t,r}createDOM(t){return this.__isUnlinked?it().createElement("span"):super.createDOM(t)}updateDOM(t,r,o){return super.updateDOM(t,r,o)||t.__isUnlinked!==this.__isUnlinked}updateFromJSON(t){return super.updateFromJSON(t).setIsUnlinked(t.isUnlinked||!1)}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}};function c_(n){return n instanceof l_}const a_=/^\+?[0-9\s()-]{5,}$/;function ba(n){return n.match(/^[a-z][a-z0-9+.-]*:/i)||n.match(/^[/#.]/)?n:n.includes("@")?`mailto:${n}`:a_.test(n)?`tel:${n}`:`https://${n}`}function xs(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 kd(n){const e=xs(n,t=>t.type);return{element:e.element||[],multilineElement:e["multiline-element"]||[],textFormat:e["text-format"]||[],textMatch:e["text-match"]||[]}}const Ta=/[!-/:-@[-`{-~\s]/,ka=/\s/,Ss=/[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~]/,u_=/^\s{0,3}$/;function Nd(n){if(!Yn(n))return!1;const e=n.getFirstChild();return e==null||n.getChildrenSize()===1&&$(e)&&u_.test(e.getTextContent())}function Cs(n){return n.replace(/\\([!-/:-@[-`{-~])/g,"$1").replace(/&#(\d+);/g,(e,t)=>String.fromCodePoint(Number(t)))}const Ed=/^(\s*)(\d{1,})\.\s/,wd=/^(\s*)[-*+]\s/,f_=/^(\s*)(?:[-*+]\s)?\s?(\[(\s|x)?\])\s/i,vs=/^(#{1,6})\s/,Od=/^>\s/,$d=/^([ \t]*`{3,})([\w-]+)?[ \t]?/,bs=/^[ \t]*`{3,}$/,d_=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,h_=/^(?:\|)(.+)(?:\|)\s?$/;function g_(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 Na=/^<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,Ea=/^<\/[a-z_][\w-]*\s*>/i,wa=n=>new RegExp(`(?:${n.source})$`,n.flags),Ts=qn("mdListMarker",{parse:n=>typeof n=="string"&&/^[-*+]$/.test(n)?n:"-",resetOnCopyNode:!0}),Oa=qn("mdCodeFence",{parse:n=>typeof n=="string"&&/^`{3,}$/.test(n)?n:"```",resetOnCopyNode:!0}),Md=qn("mdCodeMeta",{parse:n=>typeof n=="string"?n:"",resetOnCopyNode:!0}),p_=qn("mdHardLineBreak",{parse:n=>typeof n=="string"&&/^(\\| {2,})$/.test(n)?n:"",resetOnCopyNode:!0});function ks(n){if(n.endsWith("\\")){let t=0;for(let r=n.length-1;r>=0&&n[r]==="\\";r--)t++;return t%2==1?[n.slice(0,-1),"\\"]:null}const e=n.match(/^(.*?\S)( {2,})$/);return e?[e[1],e[2]]:null}function m_(n){const e=n.getChildren(),t=e.length-1,r=e[t];if(!$(r))return null;const o=r.getTextContent(),i=ks(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(Tt(s[c]))return!1;if(/\S/.test(s[c].getTextContent()))return!0}return!1})(e,t)?(r.setTextContent(""),o):null}function Ad(n){const e=Le(),t=m_(n);return t!==null&&Rr(e,p_,t),e}function pl(n){return Zo(n)}function $a(n,e){let t=0;for(;t<e&&(n[t]===" "||n[t]===" ");)t++;return n.slice(t)}function __(n,e){const t=n.getLastChild();e&&Jn(t)&&Rr(t,Md,e)}const Dd=n=>(e,t,r,o)=>{const i=n(r);i.append(...t),e.replace(i),o||i.select(0,0)};function Ns(n){let e=0;for(const t of n)e+=t===" "?4-e%4:1;return e}let xo=null,So=!1;function y_(n,e,t,r){for(let o=n.length;o<e;o++)n[o]=4*(o+1);n.length=e,n[e]=(function(o,i){let s=o[0];if(i==="check"){const l=s.slice(o[1].length).match(/^[-*+]\s/);l&&(s=o[1]+l[0])}return Math.min(Ns(s),Ns(o[1])+4)})(t,r)}const Pd=n=>(e,t,r,o)=>{if(hl(e)||!o&&pl(e))return!1;const i=e.getPreviousSibling(),s=e.getNextSibling(),l=gn(n==="check"?/^x$/i.test(r[3]||""):void 0),c=r[0].trim()[0],a=n!=="bullet"&&n!=="check"||c!==Ts.parse(c)?void 0:c,u=xo;let f=i;if(u!==null){if(So)for(;f!==null&&Nd(f);)f=f.getPreviousSibling();I(f)||(u.length=0)}const d=u===null||u.length===0?(function(g){const _=g.match(/\t/g),m=g.match(/ /g);let p=0;return _&&(p+=_.length),m&&(p+=Math.floor(m.length/4)),p})(r[1]):(function(g,_){const m=Ns(_);for(let p=g.length-1;p>=0;p--)if(m>=g[p])return p+1;return 0})(u,r[1]);if(I(s)&&s.getListType()===n){const g=s.getFirstChild();g!==null?g.insertBefore(l):s.append(l),n==="number"&&d===0&&s.setStart(Number(r[2])),e.remove()}else if(I(f)&&(f.getListType()===n||d>0))f.append(l),e.remove();else{const g=Ce(n,n==="number"?Number(r[2]):void 0);g.append(l),e.replace(g)}l.append(...t),o||l.select(0,0),d&&(l.setIndent(d),(function(g,_,m){const p=g.getParent();if(!I(p)||p.getListType()===_)return;const y=p.getParent();if(!W(y))return;const x=Ce(_,_==="number"?Number(m[2]):void 0),S=g.getPreviousSibling()===null;x.append(g);const v=gn();v.append(x),S?y.insertBefore(v):y.insertAfter(v),p.getChildrenSize()===0&&y.remove()})(l,n,r));const h=l.getParent();a&&I(h)&&Rr(h,Ts,a),u!==null&&y_(u,d,r,n)},ml=(n,e,t,r)=>{const o=[],i=n.getChildren();let s=0;for(const l of i)if(W(l)){if(l.getChildrenSize()===1){const h=l.getFirstChild();if(I(h)){const g=ml(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=xr(n,Ts),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(`
|
|
12
|
-
`)},x_=Dd(n=>{const e="h"+n[1].length;return ti(e)}),Fd={dependencies:[pi],export:(n,e)=>{if(!hl(n))return null;const t=Number(n.getTag().slice(1));return"#".repeat(t)+" "+e(n)},regExp:vs,replace:(n,e,t,r)=>!(!r&&pl(n))&&x_(n,e,t,r),triggerOnEnter:!0,type:"element"},S_={dependencies:[fl],export:(n,e)=>{if(!Zo(n))return null;const t=e(n).split(`
|
|
13
|
-
`),r=[];for(const o of t)r.push("> "+o);return r.join(`
|
|
14
|
-
`)},regExp:Od,replace:(n,e,t,r)=>{if(r){const i=n.getPreviousSibling();if(Zo(i))return i.splice(i.getChildrenSize(),0,[Ad(i),...e]),void n.remove()}const o=dl();o.append(...e),n.replace(o),r||o.select(0,0)},triggerOnEnter:!0,type:"element"},Co={dependencies:[gl],export:n=>{if(!Jn(n))return null;const e=n.getTextContent();let t=xr(n,Oa);if(e.indexOf(t)>-1){const i=e.match(/`{3,}/g);if(i){const s=Math.max(...i.map(l=>l.length));t="`".repeat(s+1)}}const r=n.getLanguage()||"",o=r?xr(n,Md):"";return t+r+(o?" "+o:"")+(e?`
|
|
15
|
-
`+e:"")+`
|
|
16
|
-
`+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 d=c.match(a),h=c.slice(0,c.lastIndexOf(d[0])),g=[...r];return g[2]="",Co.replace(e,null,g,d,[h],!0),[!0,t]}const u=new RegExp(`^[ \\t]*\`{${i},}$`);for(let d=t+1;d<n.length;d++){const h=n[d];if(u.test(h)){const g=h.match(u),_=n.slice(t+1,d),m=r[2]?s.slice(r[0].length).trim():"";return _.unshift(m?"":s.slice(r[0].length)),Co.replace(e,null,r,g,_,!0),__(e,m),[!0,d]}}const f=n.slice(t+1);return f.unshift(s.slice(r[0].length)),Co.replace(e,null,r,null,f,!0),[!0,n.length-1]},regExpEnd:{optional:!0,regExp:bs},regExpStart:$d,replace:(n,e,t,r,o,i)=>{let s,l;const c=t[1]?t[1].trim():"```",a=t[2]||void 0,u=t[1]?t[1].length-t[1].trimStart().length:0;if(!e&&o){if(o.length===1)r?(s=De(a),l=$a(o[0],u)):(s=De(a),l=o[0].startsWith(" ")?o[0].slice(1):o[0]);else{for(s=De(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.map(d=>$a(d,u)).join(`
|
|
17
|
-
`)}Rr(s,Oa,c);const f=_t(l);s.append(f),n.append(s)}else if(e){if(!i&&pl(n))return!1;Dd(f=>De(f?f[2]:void 0))(n,e,t,i)}},type:"multiline-element"},Id={dependencies:[yn,je],export:(n,e,t)=>I(n)?ml(n,e,0,t):null,regExp:wd,replace:Pd("bullet"),triggerOnEnter:!0,type:"element"},Ld={dependencies:[yn,je],export:(n,e,t)=>I(n)?ml(n,e,0,t):null,regExp:Ed,replace:Pd("number"),triggerOnEnter:!0,type:"element"},Rd={format:["code"],tag:"`",type:"text-format"},C_={format:["highlight"],tag:"==",type:"text-format"},v_={format:["bold","italic"],tag:"***",type:"text-format"},b_={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},Bd={format:["bold"],tag:"**",type:"text-format"},Kd={format:["bold"],intraword:!1,tag:"__",type:"text-format"},T_={format:["strikethrough"],tag:"~~",type:"text-format"},zd={format:["italic"],tag:"*",type:"text-format"},Wd={format:["italic"],intraword:!1,tag:"_",type:"text-format"};function Ma(n){return n.replace(/&(?=#\d+;|#[Xx][\dA-Fa-f]+;|[A-Za-z][\dA-Za-z]*;)/g,"&")}const k_={dependencies:[Fr],export:(n,e,t)=>{if(!va(n)||c_(n))return null;const r=e(n);let o=n.getTitle();o!=null&&(o=Ma(o).replace(/([\\"])/g,"\\$1"));const i=n.getURL(),s=Ma(i),l=i===""||/\s/.test(i)?`<${s.replace(/([\\<>])/g,"\\$1").replace(/\r/g," ").replace(/\n/g," ")}>`:s.replace(/([\\()])/g,"\\$1").replace(/^</,"\\<");return o?`[${r}](${l} "${o}")`:`[${r}](${l})`},importRegExp:/(?:\[(.+?)\])(?:\(\s*(?:(?:<((?:\\.|[^<>\n\\])*)>|((?!<)(?:\\[^\s]|\\(?=\s)|\((?:\\[^\s]|[^\s()\\]|\((?:\\[^\s]|[^\s()\\]|\((?:\\[^\s]|[^\s()\\])*\))*\))*\)|[^\s()\\])+))(?:\s+(?:"((?:[^"]*\\")*[^"]*)"|'((?:[^']*\\')*[^']*)'|\(((?:\\.|[^()\\])*)\)))?\s*)?\))/,regExp:/(?:\[([^[\]]*(?:\[[^[\]]*\][^[\]]*)*)\])(?:\(\s*(?:(?:<((?:\\.|[^<>\n\\])*)>|((?!<)(?:\\[^\s]|\\(?=\s)|\((?:\\[^\s]|[^\s()\\]|\((?:\\[^\s]|[^\s()\\]|\((?:\\[^\s]|[^\s()\\])*\))*\))*\)|[^\s()\\])+))(?:\s+(?:"((?:[^"]*\\")*[^"]*)"|'((?:[^']*\\')*[^']*)'|\(((?:\\.|[^()\\])*)\)))?\s*)?\))$/,replace:(n,e)=>{if(St(n,va))return;const[,t,r,o,i,s,l]=e,c=Cs(r??o??""),a=i??s??l,u=a!=null?Cs(a):void 0,f=Td(c,{title:u}),d=t.split("[").length-1,h=t.split("]").length-1;let g=t,_="";if(d<h)return;if(d>h){const p=t.split("[");_="["+p[0],g=p.slice(1).join("[")}const m=_t(g);return m.setFormat(n.getFormat()),f.append(m),n.replace(f),_&&f.insertBefore(_t(_)),m},trigger:")",type:"text-match"},N_=[Fd,S_,Id,Ld],E_=[Co],w_=[Rd,v_,b_,Bd,Kd,C_,zd,Wd,T_],O_=[k_],Ud=[...N_,...E_,...w_,...O_];function $_(n,e=!1){const t=n.split(`
|
|
18
|
-
`);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?ks(s):null,u=c!==void 0&&ks(c)!==null;if(d_.test(l))o.push(l);else if(r===0){{const f=l.match($d);if(f){r=f[1].trim().length,o.push(l);continue}}l===""||c===""||!c||vs.test(c)||vs.test(l)||Od.test(l)||Ed.test(l)||wd.test(l)||f_.test(l)||h_.test(l)||g_(l)||u||!e||Na.test(l)||Ea.test(l)||wa(Ea).test(c)||wa(Na).test(c)||bs.test(c)?o.push(!e&&l!==""||a!==null?s:l):o[o.length-1]=c+" "+(a===null?l:s).trimStart()}else{if(bs.test(l)&&l.trim().length>=r){r=0,o.push(l);continue}o.push(s)}}return o.join(`
|
|
19
|
-
`)}function M_(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 S=y-1;S>=0&&d[S]==="\\";S--)x++;return x%2==1},g=[];let _=0;for(;_<d.length;)if(d[_]==="`"){let y=1;for(;_+y<d.length&&d[_+y]==="`";)y++;g.push({index:_,length:y}),_+=y}else _++;const m=[];let p=0;for(;p<g.length;){const y=g[p];if(h(y.index)){p++;continue}let x=-1;for(let T=p+1;T<g.length;T++)if(g[T].length===y.length){x=T;break}if(x===-1){p++;continue}const S=g[x];let v=d.slice(y.index+y.length,S.index);v.length>=2&&v.startsWith(" ")&&v.endsWith(" ")&&/[^ ]/.test(v)&&(v=v.slice(1,-1)),m.push({content:v,endIndex:S.index+S.length,startIndex:y.index}),p=x+1}return m})(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=[],_=new Set(Object.keys(d.transformersByTag).filter(x=>x[0]!=="`").map(x=>x[0])),m=x=>{let S=0;for(let v=x-1;v>=0&&f[v]==="\\";v--)S++;return S%2==1},p=x=>h.some(S=>x>=S.start&&x<S.end);let y=0;for(;y<f.length;){const x=f[y];if(!_.has(x)||m(y)||p(y)){y++;continue}let S=1;for(;y+S<f.length&&f[y+S]===x;)S++;const v=Aa(x,f,y,S,!0),T=Aa(x,f,y,S,!1);(v||T)&&g.push({active:!0,canClose:T,canOpen:v,char:x,index:y,length:S}),y+=S}return g})(t,e,o),l=s.length>0?(function(f,d,h){const g={};let _=0,m=null;for(;_<d.length;){const p=d[_];if(!p.active||!p.canClose||p.length===0){_++;continue}const y=`${p.char}${p.canOpen}${p.length%3}`,x=g[y]??-1;let S=!1;for(let v=_-1;v>x;v--){const T=d[v];if(!T.active||!T.canOpen||T.length===0||T.char!==p.char||(T.canClose||p.canOpen)&&(T.length+p.length)%3==0&&T.length%3!=0&&p.length%3!=0)continue;const N=Math.min(T.length,p.length),k=Object.keys(h.transformersByTag).filter(A=>A[0]===T.char&&A.length<=N).sort((A,P)=>P.length-A.length)[0];if(!k)continue;S=!0;const E=k.length,M={content:f.slice(T.index+T.length,p.index),endIndex:p.index+E,startIndex:T.index+(T.length-E),tag:k};(!m||M.startIndex<m.startIndex||M.startIndex===m.startIndex&&M.endIndex>m.endIndex)&&(m=M);for(let A=v+1;A<_;A++)d[A].active=!1;T.length-=E,p.length-=E,T.active=T.length>0,p.length>0?p.index+=E:(p.active=!1,_++);break}S||(g[y]=_-1,p.canOpen||(p.active=!1),_++)}return m})(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 Aa(n,e,t,r,o){if(!Da(e,t,r,o))return!1;if(n==="*")return!0;if(n==="_"){if(!Da(e,t,r,!o))return!0;const i=o?e[t-1]:e[t+r];return i!==void 0&&Ss.test(i)}return!0}function Da(n,e,t,r){const o=n[e-1],i=n[e+t],[s,l]=r?[i,o]:[o,i];return s!==void 0&&!ka.test(s)&&(!Ss.test(s)||l===void 0||ka.test(l)||Ss.test(l))}function we(n){return $(n)&&!n.hasFormat("code")}function qe(n,e,t){let r=M_(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 _=g.index||0,m=h.getEndIndex?h.getEndIndex(c,g):_+g[0].length;m!==!1&&(a===void 0||u===void 0||_<a&&(m>u||m<=a))&&(a=_,u=m,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,_;if(f[0]===d?h=l:c===0?[h,g]=l.splitText(a):[_,h,g]=l.splitText(c,a),h.setTextContent(f[2]),u)for(const m of u.format)h.hasFormat(m)||h.toggleFormat(m);return{nodeAfter:g,nodeBefore:_,transformedNode:h}})(n,r.startIndex,r.endIndex,r.transformer,r.match);we(s.nodeAfter)&&qe(s.nodeAfter,e,t),we(s.nodeBefore)&&qe(s.nodeBefore,e,t),we(s.transformedNode)&&qe(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;we(s.nodeAfter)&&qe(s.nodeAfter,e,t),we(s.nodeBefore)&&qe(s.nodeBefore,e,t),we(s.transformedNode)&&qe(s.transformedNode,e,t)}const i=Cs(n.getTextContent());n.setTextContent(i)}function A_(n,e,t,r=!1){const o=kd(t),i=(function(a){const u={},f={},d=[];for(const h of a){const{tag:g}=h;u[g]=h;const _=g.replace(/(\*|\^|\+)/g,"\\$1");d.push(_),g.length===1?f[g]=g==="`"?new RegExp("(^|[^\\\\`])(`)((?:\\\\`|[^`])+?)(`)(?!`)"):new RegExp(`(^|[^\\\\${_}])(${_})((\\\\${_})?.*?[^${_}\\s](\\\\${_})?)(${_})(?![\\\\${_}])`):f[g]=new RegExp(`(^|[^\\\\])(${_})((\\\\${_})?.*?[^\\s](\\\\${_})?)(${_})(?!\\\\)`)}return{fullMatchRegExpByTag:f,openTagsRegExp:new RegExp(`(${d.join("|")})`,"g"),transformersByTag:u}})(o.textFormat),s=n.split(`
|
|
20
|
-
`),l=s.length;(function(a,u){const f=xo,d=So;xo=[],So=a;try{return u()}finally{xo=f,So=d}})(!r,()=>{for(let a=0;a<l;a++){const u=s[a],[f,d]=D_(s,a,o.multilineElement,e);f?a=d:P_(u,e,o.element,i,o.textMatch,r)}});const c=e.getChildren();for(const a of c)if(!r&&Nd(a)&&e.getChildrenSize()>1)a.remove();else if(C(a))for(const u of a.getAllTextNodes())F_(u)}function D_(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 _=[];if(g&&e===d)_.push(n[e].slice(a[0].length,-g[0].length));else for(let m=e;m<=d;m++)if(m===e){const p=n[m].slice(a[0].length);_.push(p)}else if(m===d&&g){const p=n[m].slice(0,-g[0].length);_.push(p)}else _.push(n[m]);if(c(r,null,a,g,_,!0)!==!1)return[!0,d];break}}return[!1,e]}function P_(n,e,t,r,o,i){const s=_t(n),l=et();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(qe(s,r,o),l.getParent()!==null&&n.length>0){const c=l.getPreviousSibling();if(!i&&(Yn(c)||Zo(c)||I(c))){let a=c;if(I(c)){const u=c.getLastDescendant();a=u==null?null:St(u,W)}a!=null&&a.getTextContentSize()>0&&(a.splice(a.getChildrenSize(),0,[Ad(a),...l.getChildren()]),l.remove())}}}function F_(n){if(rn(n))return;const e=n.getTextContent();if(!e.includes(" "))return;const t=n.getFormat(),r=n.getStyle(),o=[];let i=0;for(let s=e.indexOf(" ");s!==-1;s=e.indexOf(" ",s+1))s>i&&o.push(_t(e.slice(i,s)).setFormat(t).setStyle(r)),o.push(Kr()),i=s+1;i<e.length&&o.push(_t(e.slice(i)).setFormat(t).setStyle(r)),n.getParentOrThrow().splice(n.getIndexWithinParent(),1,o)}function I_(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 Pa(n,e,t,r,o){const i=n.getParent();if(!Z(i)||n.getFirstChild()!==e)return!1;const s=e.getTextContent();if(!o&&s[t-1]!==" ")return!1;for(const{regExp:l,replace:c}of r){const a=s.match(l),u=o||a&&a[0].endsWith(" ")?t:t-1;if(a&&a[0].length===u){const f=e.getNextSiblings(),[d,h]=e.splitText(t);if(c(n,h?[h,...f]:f,a,!1)!==!1)return d.remove(),!0}}return!1}function Fa(n,e,t,r,o){const i=n.getParent();if(!Z(i)||n.getFirstChild()!==e)return!1;const s=e.getTextContent();if(!o&&s[t-1]!==" ")return!1;for(const{regExpStart:l,replace:c,regExpEnd:a}of r){if(a&&!("optional"in a)||a&&"optional"in a&&!a.optional)continue;const u=s.match(l);if(u){const f=o||u[0].endsWith(" ")?t:t-1;if(u[0].length!==f)continue;const d=e.getNextSiblings(),[h,g]=e.splitText(t);if(c(n,g?[g,...d]:d,u,null,null,!1)!==!1)return h.remove(),!0}}return!1}function L_(n,e){let t=0;const r=n.getTextContent();for(let o=0;o<e;o++)r[o]==="`"&&t++;return t%2!=0}function Ia(n,e,t){const r=t.length;for(let o=e;o>=r;o--){const i=o-r;if(jd(n,i,t,0,r)&&n[i+r]!==" ")return i}return-1}function La(n){const e=n.getNode();let t=0;if($(e))t=n.offset;else if(C(e))for(const r of e.getChildren().slice(0,n.offset))t+=r.getTextContentSize();for(let r=e.getPreviousSibling();r!==null;r=r.getPreviousSibling())t+=r.getTextContentSize();return t}function jd(n,e,t,r,o){for(let i=0;i<o;i++)if(n[e+i]!==t[r+i])return!1;return!0}function R_(n,e=Ud){const t=kd(e),r=t.element.filter(c=>c.triggerOnEnter),o=xs(t.textFormat,({tag:c})=>c[c.length-1]),i=xs(t.textMatch,({trigger:c})=>c),s=new Set([" "]);for(const c of t.textFormat)s.add(c.tag.slice(-1));for(const c of t.textMatch)c.trigger!==void 0&&s.add(c.trigger);for(const c of e){const a=c.type;if(a==="element"||a==="text-match"||a==="multiline-element"){const u=c.dependencies;for(const f of u)n.hasNode(f)||I_(173,f.getType())}}const l=(c,a,u)=>!!Pa(c,a,u,t.element)||!!Fa(c,a,u,t.multilineElement)||!!(function(f,d,h){let g=f.getTextContent();const _=h[g[d-1]];if(_==null)return!1;d<g.length&&(g=g.slice(0,d));for(const m of _){if(!m.replace||!m.regExp)continue;const p=g.match(m.regExp);if(p===null)continue;const y=p.index||0,x=y+p[0].length;let S;return y===0?[S]=f.splitText(x):[,S]=f.splitText(y,x),S.selectNext(0,0),m.replace(S,p),!0}return!1})(a,u,i)||!!(function(f,d,h){const g=f.getTextContent(),_=d-1,m=g[_],p=h[m];if(!p)return!1;for(const y of p){const{tag:x}=y,S=x.length,v=_-S+1;if(S>1&&!jd(g,v,x,0,S)||g[v-1]===" ")continue;const T=g[_+1];if(y.intraword===!1&&T&&!Ta.test(T))continue;const N=f;let k=N,E=Ia(g,v,x),M=k;for(;E<0&&(M=M.getPreviousSibling())&&!Tt(M);)if($(M)){if(M.hasFormat("code"))continue;const nt=M.getTextContent();k=M,E=Ia(nt,nt.length,x)}if(E<0||k===N&&E+S===v)continue;const A=k.getTextContent();if(E>0&&A[E-1]===m)continue;const P=A[E-1];if(y.intraword===!1&&P&&!Ta.test(P)||!y.format.includes("code")&&L_(k,E))continue;const L=N.getTextContent(),K=L.slice(0,v)+L.slice(_+1);N.setTextContent(K);const U=k===N?K:A;k.setTextContent(U.slice(0,E)+U.slice(E+S));const Q=D(),J=Bs();Ct(J);const kt=_-S*(k===N?2:1)+1;J.anchor.set(k.__key,E,"text"),J.focus.set(N.__key,kt,"text");for(const nt of y.format)J.formatText(nt,Te[nt]);J.anchor.set(J.focus.key,J.focus.offset,J.focus.type);for(const nt of y.format)J.hasFormat(nt)&&J.toggleFormat(nt);return w(Q)&&(J.format=Q.format),!0}return!1})(a,u,o);return Ut(n.registerUpdateListener(({tags:c,dirtyLeaves:a,editorState:u,prevEditorState:f})=>{if(c.has(Ru)||c.has(Mo)||n.isComposing())return;const d=c.has(wr),h=u.read(D),g=f.read(D);if(!w(g)||!w(h)||!h.isCollapsed()||h.is(g)&&!d)return;const _=h.anchor.key,m=h.anchor.offset,p=u._nodeMap.get(_);if($(p)&&a.has(_)&&(d||m===1||!(u.read(()=>La(h.anchor))>f.read(()=>La(g.anchor))+1))){if(d){const y=u.read(()=>p.getTextContent())[m-1];if(!s.has(y))return}n.update(()=>{if(!we(p))return;const y=p.getParent();y===null||Jn(y)||l(y,p,h.anchor.offset)&&an(Iu)})}}),n.registerCommand(Br,c=>{if(c!==null&&c.shiftKey)return!1;const a=D();if(!w(a)||!a.isCollapsed())return!1;const u=a.anchor.offset,f=a.anchor.getNode();if(!$(f)||!we(f))return!1;const d=f.getParent();return d===null||Jn(d)?!1:u===f.getTextContent().length&&!(!Fa(d,f,u,t.multilineElement,!0)&&!Pa(d,f,u,r,!0))&&(c!==null&&c.preventDefault(),!0)},kn))}function B_(n,e=Ud,t,r=!1,o=!1){const i=r?n:$_(n,o),s=Y();s.clear(),A_(i,s,e,r),D()!==null&&s.selectStart()}const K_="65%",z_='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="mr-0.5 inline-block size-[0.85em] align-[-0.15em]"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>';class Vn extends ee{constructor(t,r,o=null,i){super(`@${t}`,i);b(this,"__handle");b(this,"__kind");b(this,"__identityColor");this.__handle=t,this.__kind=r,this.__identityColor=o}static getType(){return"composer-mention"}static clone(t){return new Vn(t.__handle,t.__kind,t.__identityColor,t.__key)}static importJSON(t){return new Vn(t.handle,t.kind,t.identityColor).updateFromJSON(t)}exportJSON(){return{...super.exportJSON(),handle:this.__handle,kind:this.__kind,identityColor:this.__identityColor}}isToken(){return!0}createDOM(t){const r=super.createDOM(t),o=this.__kind==="agent";if(r.className=Yd({tone:o?"agent":"neutral",interactive:!1}),r.setAttribute("data-slot","mention-pill"),r.setAttribute("data-kind",this.__kind),r.setAttribute("title",`@${this.__handle}`),o){const i=this.__identityColor??"currentColor";r.style.setProperty("--identity-color",i),r.style.color=`color-mix(in oklch, ${i} ${K_}, hsl(var(--foreground)))`,r.insertAdjacentHTML("afterbegin",z_)}return r}updateDOM(t,r,o){return t.__handle!==this.__handle||t.__kind!==this.__kind||t.__identityColor!==this.__identityColor?!0:super.updateDOM(t,r,o)}}function W_(n){return n instanceof Vn}function U_(n,e,t=null){return new Vn(n,e,t)}const j_=[pi,yn,je,Vn],H_={...Fd,regExp:/^(#{1,3})\s/},Hd=[H_,Id,Ld,Bd,Kd,zd,Wd,Rd];function J_(n){B_(n.replace(/\\/g,"\\\\"),[...Hd])}const Ri=[{bit:1,mark:"**"},{bit:2,mark:"*"},{bit:16,mark:"`"}],V_=`
|
|
21
|
-
|
|
22
|
-
`;function Ra(n,e){if(hl(n))return"#".repeat(Number(n.getTag().slice(1)))+" ";if(W(n)){const t=n.getParent();return I(t)&&t.getListType()==="number"?`${e}. `:"- "}return""}class q_{constructor(){b(this,"out","");b(this,"collected",[])}syntax(e){this.out+=e}text(e,t){const r=this.out.length;this.out+=t,this.collected.push({key:e.getKey(),start:r,end:this.out.length,textOffset:0})}anchor(e){this.collected.push({key:e.getKey(),start:this.out.length,end:this.out.length,textOffset:0})}finish(){return{markdown:this.out,spans:this.collected}}}function Ba(n,e){n.anchor(e);let t=[];const r=o=>{for(;t.length>o;){const i=t.pop();n.syntax(Ri.find(s=>s.bit===i).mark)}};for(const o of e.getChildren()){if(Tt(o)){r(0),n.syntax(`
|
|
23
|
-
`);continue}const i=$(o)?o.getFormat():0,s=Ri.filter(c=>(i&c.bit)!==0).map(c=>c.bit);let l=0;for(;l<t.length&&l<s.length&&t[l]===s[l];)l+=1;r(l);for(const c of s.slice(l))n.syntax(Ri.find(a=>a.bit===c).mark),t.push(c);$(o)?n.text(o,o.getTextContent()):n.syntax(o.getTextContent())}r(0),t=[]}function G_(n,e){if(I(e)){const t=e.getChildren();let r=e.getStart();t.forEach((o,i)=>{i>0&&n.syntax(`
|
|
24
|
-
`),C(o)&&(n.syntax(Ra(o,r)),Ba(n,o)),r+=1});return}if(!C(e)){n.syntax(e.getTextContent());return}n.syntax(Ra(e,1)),Ba(n,e)}function mr(){const n=new q_;return Y().getChildren().forEach((t,r)=>{r>0&&n.syntax(V_),G_(n,t)}),n.finish()}function _r(n){const e=D();if(!w(e)||!e.isCollapsed())return null;const t=e.anchor,r=n.spans.find(i=>i.key===t.key);if(r===void 0)return null;if(t.type==="element")return r.start;const o=t.offset-r.textOffset;return Math.min(Math.max(r.start+o,r.start),r.end)}function Y_(n,e){const t=n.spans.filter(c=>c.end>c.start),r=t.length>0?t:n.spans;if(r.length===0){Y().selectEnd();return}let o=r[0];for(const c of r)c.start<=e&&(o=c);const i=rt(o.key);if(i===null){Y().selectEnd();return}const s=Math.min(Math.max(e-o.start,0),o.end-o.start),l=o.textOffset+s;if($(i)){i.select(l,l);return}if(C(i)){i.selectStart();return}Y().selectEnd()}function X_(n){return{textBeforeCaret(){let e=null;return n.getEditorState().read(()=>{const t=mr(),r=_r(t);e=r===null?null:t.markdown.slice(0,r)}),e},isCaretAtStart(){let e=!0;return n.getEditorState().read(()=>{const t=mr(),r=_r(t);e=r===null?!0:r===0}),e},isCaretAtEnd(){let e=!0;return n.getEditorState().read(()=>{const t=mr(),r=_r(t);e=r===null?!0:r===t.markdown.length}),e},insertLineBreak(){n.update(()=>{const e=D();w(e)&&e.insertLineBreak()},{discrete:!0})},consumeEscapeIntoNewline(){n.update(()=>{const e=D();if(!w(e)||!e.isCollapsed())return;const t=e.anchor,r=t.getNode();if(!$(r)||t.offset===0)return;const o=r.getTextContent(),i=t.offset;if(o[i-1]!=="\\")return;r.setTextContent(o.slice(0,i-1)+o.slice(i)),r.select(i-1,i-1);const s=D();w(s)&&s.insertLineBreak()},{discrete:!0})},clearThroughUndoStack(){n.update(()=>{const e=Y();e.clear(),e.selectEnd()},{discrete:!0})},isComposing(){return n.isComposing()}}}function Ka(n,e){let t=!1;const r={key:n.key,shiftKey:n.shiftKey,altKey:n.altKey,keyCode:n.keyCode,nativeEvent:n,get defaultPrevented(){return t},preventDefault(){t=!0,n.preventDefault()}};return e(r),t}function Q_(){const n=D();if(!w(n))return!1;const e=n.anchor.getNode();return W(e)||e.getParents().some(W)}function Z_(n,{surface:e,isPaletteOpen:t,paletteHasResults:r}){if(e===null||n.isComposing||e.isComposing()||n.altKey||n.shiftKey||t&&r)return!1;const o=e.textBeforeCaret();return o!==null&&Xd(o)%2===1?!1:Q_()}function ty(n){const[e]=ie(),{onKeyDown:t,surface:r,isPaletteOpen:o,paletteHasResults:i}=n;B.useEffect(()=>{const s=l=>l===null?!1:Ka(l,t);return Ut(e.registerCommand(Br,l=>l===null||Z_(l,{surface:r,isPaletteOpen:o,paletteHasResults:i})?!1:Ka(l,t),xe),e.registerCommand(Ds,s,xe),e.registerCommand($s,s,xe),e.registerCommand(Ms,s,xe),e.registerCommand(Ps,s,xe))},[e,t,r,o,i])}const ey=/(^|\s)@([A-Za-z0-9_.-]+)/;function ny(n){const[e]=ie();B.useEffect(()=>{if(n===void 0||n.length===0)return;const t=new Map(n.map(o=>[o.handle,o])),r=e.registerNodeTransform(ee,o=>{if(W_(o)||!$(o)||!o.isSimpleText())return;const i=ey.exec(o.getTextContent());if(i===null)return;const s=t.get(i[2]);if(s===void 0)return;const l=i.index+i[1].length,c=l+i[2].length+1;let a=o;l>0&&(a=a.splitText(l)[1]),a.getTextContentSize()>c-l&&a.splitText(c-l),a.replace(U_(s.handle,s.kind,s.identityColor))});return e.update(()=>{for(const o of Y().getAllTextNodes())o.markDirty()}),r},[e,n])}function Jd(n){return n===null?!1:n.files!==void 0&&n.files.length>0?!0:Array.from(n.items??[]).some(e=>e.kind==="file")}function za(n){return n===null?!1:Jd(n)?!0:Qd(Array.from(n.types??[]))}const ry={B:"bold",STRONG:"bold",I:"italic",EM:"italic",CODE:"code"},oy=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","SVG","MATH"]),iy=new Set(["P","DIV","BR","LI","H1","H2","H3","H4","H5","H6"]);function sy(n){const e=new DOMParser().parseFromString(n,"text/html"),t=[];let r=et();const o=()=>{r.getChildrenSize()>0&&t.push(r),r=et()},i=(s,l)=>{if(s.nodeType===Node.TEXT_NODE){const h=s.textContent??"";if(h.length===0)return;const g=_t(h);for(const _ of l)g.toggleFormat(_);r.append(g);return}if(s.nodeType!==Node.ELEMENT_NODE)return;const c=s,a=c.tagName.toUpperCase();if(oy.has(a))return;const u=ry[a],f=u?new Set([...l,u]):l,d=iy.has(a);d&&o();for(const h of Array.from(c.childNodes))i(h,f);d&&o()};for(const s of Array.from(e.body.childNodes))i(s,new Set);return o(),t}function ly(){const[n]=ie();B.useEffect(()=>Ut(n.registerCommand(ni,e=>{const t=e!==null&&"clipboardData"in e?e.clipboardData??null:null;if(Jd(t))return!0;if(t===null)return!1;const r=e,o=t.getData("text/html");if(!o)return!1;const i=sy(o);if(i.length===0)return!1;const s=D();return w(s)?(r.preventDefault(),s.insertNodes(i),!0):!1},xe),n.registerCommand(Fs,e=>za(e.dataTransfer),xe),n.registerCommand(Is,e=>za(e.dataTransfer),xe)),[n])}const Wa="composer-hydrate";function cy({value:n,onChange:e,onCursorChange:t}){const[r]=ie(),o=B.useRef(null),i=B.useRef(null),s=B.useRef({onChange:e,onCursorChange:t});return B.useEffect(()=>{s.current={onChange:e,onCursorChange:t}},[e,t]),B.useEffect(()=>r.registerUpdateListener(({editorState:c,dirtyElements:a,dirtyLeaves:u,tags:f})=>{if(f.has(Wa))return;const{onChange:d,onCursorChange:h}=s.current;c.read(()=>{const g=a.size===0&&u.size===0,_=i.current;if(g&&_!==null){const y=_r(_);y!==null&&(h==null||h(y));return}const m=mr();i.current=m,o.current=m.markdown,d(m.markdown);const p=_r(m);p!==null&&(h==null||h(p))})}),[r]),B.useEffect(()=>{n!==o.current&&r.update(()=>{J_(n),o.current=n,i.current=null},{tag:Wa})},[r,n]),{focusAt:B.useCallback(c=>{r.update(()=>{Y_(mr(),c)}),r.focus()},[r])}}const ay={paragraph:"m-0",heading:{h1:"text-base font-semibold",h2:"text-sm font-semibold",h3:"text-sm font-medium"},list:{ul:"list-disc pl-5",ol:"list-decimal pl-5",listitem:"ml-0"},text:{bold:"font-semibold",italic:"italic",code:"bg-muted rounded px-1 py-0.5 font-mono text-[0.9em]"}};function uy(n){console.error("[composer] editor error",n)}const fy="block max-h-[200px] min-h-[24px] w-full overflow-y-auto bg-transparent py-0.5 text-sm focus:outline-none",dy=B.forwardRef(function({value:e,onChange:t,onCursorChange:r,onKeyDown:o,onFocus:i,onBlur:s,placeholder:l,placeholderOverlay:c,isPaletteOpen:a,paletteHasResults:u,paletteListboxId:f,activeDescendantId:d,onSurfaceChange:h,mentionSubjects:g},_){const[m]=ie(),p=Zd(),{focusAt:y}=cy({value:e,onChange:t,onCursorChange:r}),x=B.useRef(null),[S,v]=B.useState(null);B.useEffect(()=>{x.current??(x.current=X_(m)),v(x.current),h(x.current)},[m,h]),B.useEffect(()=>R_(m,[...Hd]),[m]),ty({onKeyDown:o,surface:S,isPaletteOpen:a,paletteHasResults:u}),ly(),ny(g),B.useImperativeHandle(_,()=>({focus:()=>m.focus(),focusUnlessTouch:()=>{p||m.focus()},focusAt:y}),[m,p,y]);const T=e.trim().length>0,N=c==null,k={className:fy,role:"combobox","aria-autocomplete":"list","aria-controls":a?f:void 0,"aria-expanded":a??!1,"aria-activedescendant":a?d:void 0,"aria-label":l,"aria-multiline":!0,onFocus:i,onBlur:s};return ct.jsxs("div",{className:"relative min-h-[24px] flex-1",children:[!T&&c,ct.jsx(Qm,{contentEditable:N?ct.jsx(Qc,{...k,"aria-placeholder":l,placeholder:ct.jsx("div",{className:"text-muted-foreground pointer-events-none absolute top-0 left-0 py-0.5 text-sm select-none",children:l})}):ct.jsx(Qc,{...k}),ErrorBoundary:gm}),ct.jsx(xm,{}),ct.jsx(rm,{})]})}),by=B.forwardRef(function(e,t){return ct.jsx(im,{initialConfig:{namespace:"composer",nodes:j_,theme:ay,onError:uy},children:ct.jsx(dy,{...e,ref:t})})});export{by as default};
|