@tempots/beatui 0.94.0 → 0.95.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/{ar-8Cko5i-Z.js → ar-B4jDJwHQ.js} +2 -1
- package/dist/{ar-D2DjoXta.cjs → ar-BVXPzVJB.cjs} +1 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +1 -1
- package/dist/{auth-divider-Rt0WDKAe.js → auth-divider-BPwKk8MW.js} +7 -7
- package/dist/{auth-divider-C3E16pml.cjs → auth-divider-BgaQ8ifw.cjs} +1 -1
- package/dist/better-auth/index.cjs.js +1 -1
- package/dist/better-auth/index.es.js +5 -5
- package/dist/{de-Cdf3432J.cjs → de-BdfPZskW.cjs} +1 -1
- package/dist/{de-Bt-d2iKj.js → de-Dd33yWzb.js} +2 -1
- package/dist/{deep-merge-CoLO4id0.js → deep-merge-C8dSqIXI.js} +4 -4
- package/dist/{deep-merge-Blrucd-E.cjs → deep-merge-ChJQbUKq.cjs} +1 -1
- package/dist/{duration-input-DrVonjKK.js → duration-input-DFZwkg6M.js} +4 -4
- package/dist/{duration-input-47x7nbGh.cjs → duration-input-IuFWywO5.cjs} +1 -1
- package/dist/{editor-toolbar-group-DhKJdqER.cjs → editor-toolbar-group-BCBfu8pG.cjs} +1 -1
- package/dist/{editor-toolbar-group-CzdBZ1yr.js → editor-toolbar-group-DiJFgGcI.js} +2 -2
- package/dist/{es-6fFPkKHL.cjs → es-C8TpneCm.cjs} +1 -1
- package/dist/{es-2llfNFX2.js → es-jHMT3_7O.js} +2 -1
- package/dist/{fa-GXyNzAXz.cjs → fa-BXnP4pbN.cjs} +1 -1
- package/dist/{fa-CQVIBjKP.js → fa-eX3_BAZR.js} +2 -1
- package/dist/{fr-CC3smTlW.js → fr-Bj-GjMJm.js} +2 -1
- package/dist/{fr-C6EYTwSH.cjs → fr-HJDhGjI2.cjs} +1 -1
- package/dist/{he-CJUgxvi8.cjs → he-C6nEVZhN.cjs} +1 -1
- package/dist/{he-CZilsN75.js → he-DYgmPPkG.js} +2 -1
- package/dist/{hi-CAZjwGv-.js → hi-CgYLonE9.js} +2 -1
- package/dist/{hi-DqIR4VtX.cjs → hi-DMVSXAJt.cjs} +1 -1
- package/dist/{index-BOC0cVoY.cjs → index-D_zOXmU5.cjs} +2 -2
- package/dist/{index-DJ9YIJcG.js → index-vowHNIPH.js} +5 -5
- package/dist/{index-BFzxpY7y.js → index-yOU4Ceaq.js} +1 -1
- package/dist/{index-B-cwxUsP.cjs → index-zQ3IYJFH.cjs} +1 -1
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +19 -19
- package/dist/{input-container-DiYEl_y8.cjs → input-container-BWYHj0Iq.cjs} +1 -1
- package/dist/{input-container-9r1F3KuX.js → input-container-DMoVdH6E.js} +1 -1
- package/dist/{it-D6RXFIL6.js → it-CO2BPqah.js} +2 -1
- package/dist/{it-BvHsJ7fH.cjs → it-DhfVcjKb.cjs} +1 -1
- package/dist/{ja-D7zsz4Ij.js → ja-BrzwjH8T.js} +3 -2
- package/dist/{ja-B2gP7OHY.cjs → ja-Bt6fGS_Q.cjs} +1 -1
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +10 -10
- package/dist/json-schema-display/index.cjs.js +1 -1
- package/dist/json-schema-display/index.es.js +1 -1
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +5 -5
- package/dist/{ko-taN2Npr4.js → ko-D-lJ4wYQ.js} +4 -3
- package/dist/{ko-BddhddIA.cjs → ko-DfAaBGrz.cjs} +1 -1
- package/dist/lexical/index.cjs.js +30 -30
- package/dist/lexical/index.es.js +4940 -4789
- package/dist/{modal-DUlqGUW7.cjs → modal-CiGmgsOI.cjs} +1 -1
- package/dist/{modal-ZitwUeXx.js → modal-CwZuWiSK.js} +3 -3
- package/dist/{nl-COrtZUnH.cjs → nl-CNWBQjK5.cjs} +1 -1
- package/dist/{nl-CRC6r4Q4.js → nl-ClsworIe.js} +2 -1
- package/dist/{notice-DAVOTnfA.cjs → notice-CPZQuxcA.cjs} +1 -1
- package/dist/{notice-E_p2hg1G.js → notice-D7hYFM5A.js} +4 -4
- package/dist/{oneof-branch-detection-D6Xa8qNR.cjs → oneof-branch-detection-BFxukD63.cjs} +1 -1
- package/dist/{oneof-branch-detection-DCPwyutI.js → oneof-branch-detection-izpPjBCR.js} +1 -1
- package/dist/{pl-BHI4zBgV.cjs → pl-CqHTeu3-.cjs} +1 -1
- package/dist/{pl-C6qNs0Lq.js → pl-WTwLAxnV.js} +2 -1
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/{pt-BGzC9MhU.cjs → pt-BQmsiqbo.cjs} +1 -1
- package/dist/{pt-CcWPLqBh.js → pt-CgkjJnsG.js} +2 -1
- package/dist/{ru-CXeFbIPb.cjs → ru-CG56A2To.cjs} +1 -1
- package/dist/{ru-Dt9-9m0E.js → ru-CtgH7OY9.js} +2 -1
- package/dist/{text-input-BgPx8BbG.js → text-input-BLupB3cU.js} +1 -1
- package/dist/{text-input-DUnhBUd6.cjs → text-input-M6WBhhVj.cjs} +1 -1
- package/dist/{toolbar-DKOh_gbA.js → toolbar-Be1eU0qU.js} +1 -1
- package/dist/{toolbar-Dkc2y1dI.cjs → toolbar-WWv5kcYG.cjs} +1 -1
- package/dist/{tr-CDTWeRY0.js → tr-D1O1vEmr.js} +4 -3
- package/dist/{tr-CdOtQAtA.cjs → tr-DE7_VtKu.cjs} +1 -1
- package/dist/{translations-BdCtLBZt.cjs → translations-DBxIjvWR.cjs} +1 -1
- package/dist/{translations-CiBhB2FV.js → translations-DyCmyLE_.js} +59 -58
- package/dist/translations-OOsMRpX9.cjs +1 -0
- package/dist/{translations-NBY7SubC.js → translations-yu4gNqlP.js} +1 -1
- package/dist/types/beatui-i18n/default.d.ts +1 -0
- package/dist/types/beatui-i18n/locales/en.d.ts +1 -0
- package/dist/types/beatui-i18n/translations.d.ts +1 -0
- package/dist/types/components/lexical/toolbar/toolbar-registry.d.ts +2 -1
- package/dist/types/lexical/index.d.ts +2 -2
- package/dist/types/lexical/plugins/index.d.ts +1 -1
- package/dist/types/lexical/plugins/text.d.ts +5 -0
- package/dist/types/lexical/types.d.ts +126 -5
- package/dist/types/lexical-i18n/default.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/ar.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/de.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/en.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/es.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/fa.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/fr.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/he.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/hi.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/it.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/ja.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/ko.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/nl.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/pl.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/pt.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/ru.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/tr.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/ur.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/vi.d.ts +1 -0
- package/dist/types/lexical-i18n/locales/zh.d.ts +1 -0
- package/dist/{ur-CLrK5FPQ.js → ur-BcuB7IqE.js} +2 -1
- package/dist/{ur-C7itXvnC.cjs → ur-ZJgsSpG2.cjs} +1 -1
- package/dist/{use-form-BQRVnIp9.js → use-form-CfxvyTfd.js} +2 -2
- package/dist/{use-form-DTyNw0kM.cjs → use-form-ClA0ZRco.cjs} +1 -1
- package/dist/{vi-CQrUWB3y.cjs → vi-BOgLRkuK.cjs} +1 -1
- package/dist/{vi-B1_QDUQJ.js → vi-D0rQ3dIx.js} +2 -1
- package/dist/{widget-customization-C-fSx3RB.js → widget-customization-CLZNGavL.js} +5 -5
- package/dist/{widget-customization-xEBfEPhQ.cjs → widget-customization-DtEEo35Y.cjs} +1 -1
- package/dist/{zh-DWswYYTS.cjs → zh-BTZ8OZ4H.cjs} +1 -1
- package/dist/{zh-rDtQ92Pp.js → zh-DoYqiZO1.js} +2 -1
- package/package.json +9 -9
- package/dist/translations-Cy9hoMGV.cjs +0 -1
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Zu=require("../_commonjsHelpers-DKOUU3wS.cjs"),v=require("@tempots/dom"),Ec=require("../link-portal-_tiDFZqh.cjs"),kc=require("../theme-DogY9oT1.cjs"),Nt=require("../menu-De_-sGeb.cjs"),Ve=require("../translations-OOsMRpX9.cjs"),Ia=require("../editor-toolbar-group-BCBfu8pG.cjs"),$h=require("../toolbar-WWv5kcYG.cjs"),M_=require("../input-container-BWYHj0Iq.cjs"),I_={separator:!0};function R(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 Fh(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 Pt=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,$_=Pt&&"documentMode"in document?document.documentMode:null,Ot=Pt&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ln=Pt&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),ao=!(!Pt||!("InputEvent"in window)||$_)&&"getTargetRanges"in new window.InputEvent("input"),_s=Pt&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),oi=Pt&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,F_=Pt&&/Android/.test(navigator.userAgent),Lh=Pt&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Xu=Pt&&F_&&Lh,ys=Pt&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Ot&&!Lh,L_=0,R_=1,D_=2,P_=1,z_=2,B_=4,U_=8,K_=16,W_=32,j_=64,Tc=128,H_=2047,J_=1,G_=2,V_=3,Y_=4,q_=5,Z_=6,Jo=_s||oi||ys?" ":"",Go=`
|
|
2
2
|
|
|
3
|
-
`,q_=On?" ":Bo,$h="֑-߿יִ-﷽ﹰ-ﻼ",Fh="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",Z_=new RegExp("^[^"+Fh+"]*["+$h+"]"),X_=new RegExp("^[^"+$h+"]*["+Fh+"]"),ze={bold:1,capitalize:1024,code:16,highlight:Cc,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Q_={directionless:1,unmergeable:2},Yu={center:2,end:6,justify:4,left:1,right:3,start:5},ey={[H_]:"center",[Y_]:"end",[G_]:"justify",[j_]:"left",[J_]:"right",[V_]:"start"},ty={normal:0,segmented:2,token:1},ny={[$_]:"normal",[R_]:"segmented",[F_]:"token"},ry="$",qu="$config";function Rh(n,e,t,r,i,s){let o=n.getFirstChild();for(;o!==null;){const l=o.__key;o.__parent===e&&(A(o)&&Rh(o,l,t,r,i,s),t.has(l)||s.delete(l),i.push(l)),o=o.getNextSibling()}}let Na=!1,wc=0;function iy(n){wc=n.timeStamp}function Hl(n,e,t){const r=n.nodeName==="BR",i=e.__lexicalLineBreak;return i&&(n===i||r&&n.previousSibling===i)||r&&sl(n,t)!==void 0}function sy(n,e,t){const r=Ct(St(t));let i=null,s=null;r!==null&&r.anchorNode===n&&(i=r.anchorOffset,s=r.focusOffset);const o=n.nodeValue;o!==null&&Vc(e,o,i,s,!1)}function oy(n,e,t){if(N(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return Yt(e)&&t.isAttached()}function ly(n,e,t,r){for(let i=n;i&&!Wg(i);i=ys(i)){const s=sl(i,e);if(s!==void 0){const o=Q(s,t);if(o)return Z(o)||!ne(i)?void 0:[i,o]}else if(i===r)return[r,Og(t)]}}function Dh(n,e,t){Na=!0;const r=performance.now()-wc>100;try{Kt(n,()=>{const i=M()||(function(f){return f.getEditorState().read(()=>{const h=M();return h!==null?h.clone():null})})(n),s=new Map,o=n.getRootElement(),l=n._editorState,a=n._blockCursorElement;let c=!1,u="";for(let f=0;f<e.length;f++){const h=e[f],g=h.type,p=h.target,m=ly(p,n,l,o);if(!m)continue;const[b,_]=m;if(g==="characterData")r&&R(_)&&Yt(p)&&oy(i,p,_)&&sy(p,_,n);else if(g==="childList"){c=!0;const y=h.addedNodes;for(let w=0;w<y.length;w++){const x=y[w],T=Hc(x),v=x.parentNode;if(v!=null&&x!==a&&T===null&&!Hl(x,v,n)){if(On){const O=(ne(x)?x.innerText:null)||x.nodeValue;O&&(u+=O)}v.removeChild(x)}}const C=h.removedNodes,S=C.length;if(S>0){let w=0;for(let x=0;x<S;x++){const T=C[x];(Hl(T,p,n)||a===T)&&(p.appendChild(T),w++)}S!==w&&s.set(b,_)}}}if(s.size>0)for(const[f,h]of s)h.reconcileObservedMutation(f,n);const d=t.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){const h=d[f],g=h.addedNodes,p=h.target;for(let m=0;m<g.length;m++){const b=g[m],_=b.parentNode;_==null||b.nodeName!=="BR"||Hl(b,p,n)||_.removeChild(b)}}t.takeRecords()}i!==null&&(c&&Re(i),On&&Rg(n)&&i.insertRawText(u))})}finally{Na=!1}}function Lh(n){const e=n._observer;e!==null&&Dh(n,e.takeRecords(),e)}function Ph(n){(function(e){wc===0&&St(e).addEventListener("textInput",iy,!0)})(n),n._observer=new MutationObserver((e,t)=>{Dh(n,e,t)})}let ay=class{key;parse;unparse;isEqual;defaultValue;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||dy).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0)}};function vc(n,e){return new ay(n,e)}function ji(n,e,t="latest"){const r=(t==="latest"?n.getLatest():n).__state;return r?r.getValue(e):e.defaultValue}function cy(n,e,t){const r=ji(n,t,"direct"),i=ji(e,t,"direct");return t.isEqual(r,i)?null:[r,i]}function Hs(n,e,t){let r;if(Me(),typeof t=="function"){const s=n.getLatest(),o=ji(s,e);if(r=t(o),e.isEqual(o,r))return s}else r=t;const i=n.getWritable();return Ko(i).updateFromKnown(e,r),i}function zh(n){const e=new Map,t=new Set;for(let r=typeof n=="function"?n:n.replace;r.prototype&&r.prototype.getType!==void 0;r=Object.getPrototypeOf(r)){const{ownNodeConfig:i}=bs(r);if(i&&i.stateConfigs)for(const s of i.stateConfigs){let o;"stateConfig"in s?(o=s.stateConfig,s.flat&&t.add(o.key)):o=s,e.set(o.key,o)}}return{flatKeys:t,sharedConfigMap:e}}let uy=class Bh{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,r=void 0,i=new Map,s=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=r,this.knownState=i;const{sharedConfigMap:o}=this.sharedNodeState,l=s!==void 0?s:(function(a,c,u){let d=u.size;if(c)for(const f in c){const h=a.get(f);h&&u.has(h)||d++}return d})(o,r,i);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 i=this.unknownState[e.key];i!==void 0&&(r=e.parse(i)),this.updateFromKnown(e,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[r,i]of this.knownState)r.isEqual(i,r.defaultValue)?delete e[r.key]:e[r.key]=r.unparse(i);for(const r of this.sharedNodeState.flatKeys)r in e&&(t[r]=e[r],delete e[r]);return Zu(e)&&(t.$=e),t}getWritable(e){if(this.node===e)return this;const{sharedNodeState:t,unknownState:r}=this,i=new Map(this.knownState);return new Bh(e,t,(function(s,o,l){let a;if(l)for(const[c,u]of Object.entries(l)){const d=s.get(c);d?o.has(d)||o.set(d,d.parse(u)):(a=a||{},a[c]=u)}return a})(t.sharedConfigMap,i,r),i,this.size)}updateFromKnown(e,t){const r=e.key;this.sharedNodeState.sharedConfigMap.set(r,e);const{knownState:i,unknownState:s}=this;i.has(e)||s&&r in s||(s&&(delete s[r],this.unknownState=Zu(s)),this.size++),i.set(e,t)}updateFromUnknown(e,t){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,i]of Object.entries(e))this.updateFromUnknown(r,i)}};function Ko(n){const e=n.getWritable(),t=e.__state?e.__state.getWritable(e):new uy(e,Uh(e));return e.__state=t,t}function Uh(n){return n.__state?n.__state.sharedNodeState:Kc(fi(),n.getType()).sharedNodeState}function Zu(n){if(n)for(const e in n)return n}function dy(n){return n}function Xu(n,e,t){for(const[r,i]of e.knownState){if(n.has(r.key))continue;n.add(r.key);const s=t?t.getValue(r):r.defaultValue;if(s!==i&&!r.isEqual(s,i))return!0}return!1}function Qu(n,e,t){const{unknownState:r}=e,i=t?t.unknownState:void 0;if(r){for(const[s,o]of Object.entries(r))if(!n.has(s)&&(n.add(s),o!==(i?i[s]:void 0)))return!0}return!1}function ed(n,e){const t=n.__state;return t&&t.node===n?t.getWritable(e):t}function td(n,e){const t=n.__mode,r=n.__format,i=n.__style,s=e.__mode,o=e.__format,l=e.__style,a=n.__state,c=e.__state;return(t===null||t===s)&&(r===null||r===o)&&(i===null||i===l)&&(n.__state===null||a===c||(function(u,d){if(u===d)return!0;if(u&&d&&u.size!==d.size)return!1;const f=new Set;return!(u&&Xu(f,u,d)||d&&Xu(f,d,u)||u&&Qu(f,u,d)||d&&Qu(f,d,u))})(a,c))}function nd(n,e){const t=n.mergeWithSibling(e),r=se()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function rd(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&R(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(td(e,r)){r=nd(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&R(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(td(r,t)){r=nd(r,t);break}break}t.remove()}}else r.remove()}function Mn(n){return id(n.anchor),id(n.focus),n}function id(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,i;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),i=!0):(r=e.getChildAtIndex(t),i=!1),R(r)){n.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!A(r))break;n.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}let ir,Ve,Hi,Wo,Aa,Oa,sr,Tt,Ma,Ji,ke="",Lt=null,Vn=null,Lr=!1,ro=!1;function io(n,e){const t=sr.get(n);if(e!==null){const r=Ra(n);r.parentNode===e&&e.removeChild(r)}if(Tt.has(n)||Ve._keyToDOMMap.delete(n),A(t)){const r=oo(t,sr);Ia(r,0,r.length-1,null)}t!==void 0&&qc(Ji,Hi,Wo,t,"destroyed")}function Ia(n,e,t,r){for(let i=e;i<=t;++i){const s=n[i];s!==void 0&&io(s,r)}}function Gn(n,e){n.setProperty("text-align",e)}const fy="40px";function Kh(n,e){const t=ir.theme.indent;if(typeof t=="string"){const i=n.classList.contains(t);e>0&&!i?n.classList.add(t):e<1&&i&&n.classList.remove(t)}const r=getComputedStyle(n).getPropertyValue("--lexical-indent-base-value")||fy;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${r})`)}function Wh(n,e){const t=n.style;e===0?Gn(t,""):e===1?Gn(t,"left"):e===2?Gn(t,"center"):e===3?Gn(t,"right"):e===4?Gn(t,"justify"):e===5?Gn(t,"start"):e===6&&Gn(t,"end")}function $a(n,e){const t=(function(r){const i=r.__dir;if(i!==null)return i;if(ye(r))return null;const s=r.getParentOrThrow();return ye(s)&&s.__dir===null?"auto":null})(e);t!==null?n.dir=t:n.removeAttribute("dir")}function so(n,e){const t=Tt.get(n);t===void 0&&D(60);const r=t.createDOM(ir,Ve);if((function(i,s,o){const l=o._keyToDOMMap;(function(a,c,u){const d=`__lexicalKey_${c._key}`;a[d]=u})(s,o,i),l.set(i,s)})(n,r,Ve),R(t)?r.setAttribute("data-lexical-text","true"):Z(t)&&r.setAttribute("data-lexical-decorator","true"),A(t)){const i=t.__indent,s=t.__size;if($a(r,t),i!==0&&Kh(r,i),s!==0){const l=s-1;Fa(oo(t,Tt),t,0,l,t.getDOMSlot(r))}const o=t.__format;o!==0&&Wh(r,o),t.isInline()||jh(null,t,r)}else{const i=t.getTextContent();if(Z(t)){const s=t.decorate(Ve,ir);s!==null&&Hh(n,s),r.contentEditable="false"}ke+=i}return e!==null&&e.insertChild(r),qc(Ji,Hi,Wo,t,"created"),r}function Fa(n,e,t,r,i){const s=ke;ke="";let o=t;for(;o<=r;++o){so(n[o],i);const l=Tt.get(n[o]);l!==null&&R(l)?Lt===null&&(Lt=l.getFormat(),Vn=l.getStyle()):A(l)&&o<r&&!l.isInline()&&(ke+=Uo)}i.element.__lexicalTextContent=ke,ke=s+ke}function sd(n,e){if(n){const t=n.__last;if(t){const r=e.get(t);if(r)return ue(r)?"line-break":Z(r)&&r.isInline()?"decorator":null}return"empty"}return null}function jh(n,e,t){const r=sd(n,sr),i=sd(e,Tt);r!==i&&e.getDOMSlot(t).setManagedLineBreak(i)}function hy(n,e,t){var r;Lt=null,Vn=null,(function(i,s,o){const l=ke,a=i.__size,c=s.__size;ke="";const u=o.element;if(a===1&&c===1){const d=i.__first,f=s.__first;if(d===f)Js(d,u);else{const g=Ra(d),p=so(f,null);try{u.replaceChild(p,g)}catch(m){if(typeof m=="object"&&m!=null){const b=`${m.toString()} Parent: ${u.tagName}, new child: {tag: ${p.tagName} key: ${f}}, old child: {tag: ${g.tagName}, key: ${d}}.`;throw new Error(b)}throw m}io(d,null)}const h=Tt.get(f);R(h)&&Lt===null&&(Lt=h.getFormat(),Vn=h.getStyle())}else{const d=oo(i,sr),f=oo(s,Tt);if(d.length!==a&&D(227),f.length!==c&&D(228),a===0)c!==0&&Fa(f,0,0,c-1,o);else if(c===0){if(a!==0){const h=o.after==null&&o.before==null&&o.element.__lexicalLineBreak==null;Ia(d,0,a-1,h?null:u),h&&(u.textContent="")}}else(function(h,g,p,m,b,_){const y=m-1,C=b-1;let S,w,x=_.getFirstChild(),T=0,v=0;for(;T<=y&&v<=C;){const k=g[T],L=p[v];if(k===L)x=Jl(Js(L,_.element)),T++,v++;else{if(w===void 0&&(w=od(p,v)),S===void 0)S=od(g,T);else if(!S.has(k)){T++;continue}if(!w.has(k)){x=Jl(Ra(k)),io(k,_.element),T++,S.delete(k);continue}if(S.has(L)){const F=ur(Ve,L);F!==x&&_.withBefore(x).insertChild(F),x=Jl(Js(L,_.element)),T++,v++}else so(L,_.withBefore(x)),v++}const K=Tt.get(L);K!==null&&R(K)?Lt===null&&(Lt=K.getFormat(),Vn=K.getStyle()):A(K)&&v<=C&&!K.isInline()&&(ke+=Uo)}const O=T>y,I=v>C;if(O&&!I){const k=p[C+1],L=k===void 0?null:Ve.getElementByKey(k);Fa(p,0,v,C,_.withBefore(L))}else I&&!O&&Ia(g,T,y,_.element)})(0,d,f,a,c,o)}u.__lexicalTextContent=ke,ke=l+ke})(n,e,e.getDOMSlot(t)),r=e,Lt==null||Lt===r.__textFormat||ro||r.setTextFormat(Lt),(function(i){Vn==null||Vn===i.__textStyle||ro||i.setTextStyle(Vn)})(e)}function oo(n,e){const t=[];let r=n.__first;for(;r!==null;){const i=e.get(r);i===void 0&&D(101),t.push(r),r=i.__next}return t}function Js(n,e){const t=sr.get(n);let r=Tt.get(n);t!==void 0&&r!==void 0||D(61);const i=Lr||Oa.has(n)||Aa.has(n),s=ur(Ve,n);if(t===r&&!i){let o;if(A(t)){const l=s.__lexicalTextContent;typeof l=="string"?o=l:(o=t.getTextContent(),s.__lexicalTextContent=o)}else o=t.getTextContent();return ke+=o,s}if(t!==r&&i&&qc(Ji,Hi,Wo,r,"updated"),r.updateDOM(t,s,ir)){const o=so(n,null);return e===null&&D(62),e.replaceChild(o,s),io(n,null),o}if(A(t)){A(r)||D(334,n);const o=r.__indent;(Lr||o!==t.__indent)&&Kh(s,o);const l=r.__format;if((Lr||l!==t.__format)&&Wh(s,l),i)hy(t,r,s),ye(r)||r.isInline()||jh(t,r,s);else{const a=s.__lexicalTextContent;let c;typeof a=="string"?c=a:(c=t.getTextContent(),s.__lexicalTextContent=c),ke+=c}if((Lr||r.__dir!==t.__dir)&&($a(s,r),ye(r)&&!Lr))for(const a of r.getChildren())A(a)&&$a(ur(Ve,a.getKey()),a)}else{const o=r.getTextContent();if(Z(r)){const l=r.decorate(Ve,ir);l!==null&&Hh(n,l)}ke+=o}if(!ro&&ye(r)&&r.__cachedText!==ke){const o=r.getWritable();o.__cachedText=ke,r=o}return s}function Hh(n,e){let t=Ve._pendingDecorators;const r=Ve._decorators;if(t===null){if(r[n]===e)return;t=Ag(Ve)}t[n]=e}function Jl(n){let e=n.nextSibling;return e!==null&&e===Ve._blockCursorElement&&(e=e.nextSibling),e}function od(n,e){const t=new Set;for(let r=e;r<n.length;r++)t.add(n[r]);return t}function gy(n,e,t,r,i,s){ke="",Lr=r===2,Ve=t,ir=t._config,Hi=t._nodes,Wo=Ve._listeners.mutation,Aa=i,Oa=s,sr=n._nodeMap,Tt=e._nodeMap,ro=e._readOnly,Ma=new Map(t._keyToDOMMap);const o=new Map;return Ji=o,Js("root",null),Ve=void 0,Hi=void 0,Aa=void 0,Oa=void 0,sr=void 0,Tt=void 0,ir=void 0,Ma=void 0,Ji=void 0,o}function Ra(n){const e=Ma.get(n);return e===void 0&&D(75,n),e}function U(n){return{type:n}}const ni=U("SELECTION_CHANGE_COMMAND"),Ec=U("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),mr=U("CLICK_COMMAND"),kc=U("BEFORE_INPUT_COMMAND"),Tc=U("INPUT_COMMAND"),Nc=U("COMPOSITION_START_COMMAND"),Ac=U("COMPOSITION_END_COMMAND"),Nt=U("DELETE_CHARACTER_COMMAND"),ln=U("INSERT_LINE_BREAK_COMMAND"),In=U("INSERT_PARAGRAPH_COMMAND"),Tn=U("CONTROLLED_TEXT_INSERTION_COMMAND"),ri=U("PASTE_COMMAND"),Gi=U("REMOVE_TEXT_COMMAND"),or=U("DELETE_WORD_COMMAND"),lr=U("DELETE_LINE_COMMAND"),ve=U("FORMAT_TEXT_COMMAND"),ii=U("UNDO_COMMAND"),si=U("REDO_COMMAND"),Oc=U("KEYDOWN_COMMAND"),jo=U("KEY_ARROW_RIGHT_COMMAND"),lo=U("MOVE_TO_END"),hs=U("KEY_ARROW_LEFT_COMMAND"),Vi=U("MOVE_TO_START"),cn=U("KEY_ARROW_UP_COMMAND"),ar=U("KEY_ARROW_DOWN_COMMAND"),$n=U("KEY_ENTER_COMMAND"),Ho=U("KEY_SPACE_COMMAND"),Jo=U("KEY_BACKSPACE_COMMAND"),oi=U("KEY_ESCAPE_COMMAND"),Go=U("KEY_DELETE_COMMAND"),gs=U("KEY_TAB_COMMAND"),ao=U("INSERT_TAB_COMMAND"),Bt=U("INDENT_CONTENT_COMMAND"),nn=U("OUTDENT_CONTENT_COMMAND"),Vo=U("DROP_COMMAND"),Mc=U("FORMAT_ELEMENT_COMMAND"),Yo=U("DRAGSTART_COMMAND"),Ic=U("DRAGOVER_COMMAND"),Jh=U("DRAGEND_COMMAND"),_r=U("COPY_COMMAND"),li=U("CUT_COMMAND"),Vr=U("SELECT_ALL_COMMAND"),$c=U("CLEAR_EDITOR_COMMAND"),Gh=U("CLEAR_HISTORY_COMMAND"),Ni=U("CAN_REDO_COMMAND"),Ai=U("CAN_UNDO_COMMAND"),Fc=U("FOCUS_COMMAND"),ai=U("BLUR_COMMAND"),Vh=U("KEY_MODIFIER_COMMAND"),qt=Object.freeze({}),Da=[["keydown",function(n,e){Yi=n.timeStamp,Yh=n.key,!e.isComposing()&&z(e,Oc,n)}],["pointerdown",function(n,e){const t=n.target,r=n.pointerType;Wn(t)&&r!=="touch"&&r!=="pen"&&n.button===0&&Kt(e,()=>{kg(t)||(za=!0)})}],["compositionstart",function(n,e){z(e,Nc,n)}],["compositionend",function(n,e){On?Oi=!0:ti||!ds&&!fs?z(e,Ac,n):(Ba=!0,Ua=n.data)}],["input",function(n,e){n.stopPropagation(),Kt(e,()=>{e.dispatchCommand(Tc,n)},{event:n}),Pr=null}],["click",function(n,e){Kt(e,()=>{const t=M(),r=Ct(St(e)),i=_n();if(r){if(N(t)){const s=t.anchor,o=s.getNode();if(s.type==="element"&&s.offset===0&&t.isCollapsed()&&!ye(o)&&de().getChildrenSize()===1&&o.getTopLevelElementOrThrow().isEmpty()&&i!==null&&t.is(i))r.removeAllRanges(),t.dirty=!0;else if(n.detail===3&&!t.isCollapsed()&&o!==t.focus.getNode()){const l=le(o,a=>A(a)&&!a.isInline());A(l)&&l.select(0)}}else if(n.pointerType==="touch"||n.pointerType==="pen"){const s=r.anchorNode;(ne(s)||Yt(s))&&Re(Zo(i,r,e,n))}}z(e,mr,n)})}],["cut",qt],["copy",qt],["dragstart",qt],["dragover",qt],["dragend",qt],["paste",qt],["focus",qt],["blur",qt],["drop",qt]];no&&Da.push(["beforeinput",(n,e)=>(function(t,r){const i=t.inputType;i==="deleteCompositionText"||On&&Rg(r)||i!=="insertCompositionText"&&z(r,kc,t)})(n,e)]);let Yi=0,Yh=null,qh=0,Pr=null;const La=new WeakMap,co=new WeakMap;let Pa=!1,za=!1,Di=!1,Oi=!1,Ba=!1,Ua="",qn=null,Zh=[0,"",0,"root",0];function Xh(n,e,t,r,i){const s=n.anchor,o=n.focus,l=s.getNode(),a=se(),c=Ct(St(a)),u=c!==null?c.anchorNode:null,d=s.key,f=a.getElementByKey(d),h=t.length;return d!==o.key||!R(l)||(!i&&(!no||qh<r+50)||l.isDirty()&&h<2||Mg(t))&&s.offset!==o.offset&&!l.isComposing()||Et(l)||l.isDirty()&&h>1||(i||!no)&&f!==null&&!l.isComposing()&&u!==cr(f)||c!==null&&e!==null&&(!e.collapsed||e.startContainer!==c.anchorNode||e.startOffset!==c.anchorOffset)||l.getFormat()!==n.format||l.getStyle()!==n.style||(function(g,p){if(p.isSegmented())return!0;if(!g.isCollapsed())return!1;const m=g.anchor.offset,b=p.getParentOrThrow(),_=Nn(p);return m===0?!p.canInsertTextBefore()||!b.canInsertTextBefore()&&!p.isComposing()||_||(function(y){const C=y.getPreviousSibling();return(R(C)||A(C)&&C.isInline())&&!C.canInsertTextAfter()})(p):m===p.getTextContentSize()&&(!p.canInsertTextAfter()||!b.canInsertTextAfter()&&!p.isComposing()||_)})(n,l)}function ld(n,e){return Yt(n)&&n.nodeValue!==null&&e!==0&&e!==n.nodeValue.length}function ad(n,e,t){const{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:o}=n;Pa&&(Pa=!1,ld(r,i)&&ld(s,o)&&!qn)||Kt(e,()=>{if(!t)return void Re(null);if(!di(e,r,s))return;let l=M();if(qn&&N(l)&&l.isCollapsed()){const a=l.anchor,c=qn.anchor;(a.key===c.key&&a.offset===c.offset+1||a.offset===1&&c.getNode().is(a.getNode().getPreviousSibling()))&&(l=qn.clone(),Re(l))}if(qn=null,N(l)){const a=l.anchor,c=a.getNode();if(l.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(l.dirty=!0);const u=St(e).event,d=u?u.timeStamp:performance.now(),[f,h,g,p,m]=Zh,b=de(),_=e.isComposing()===!1&&b.getTextContent()==="";if(d<m+200&&a.offset===g&&a.key===p)Gs(l,f,h);else if(a.type==="text")R(c)||D(141),Qh(l,c);else if(a.type==="element"&&!_){A(c)||D(259);const y=a.getNode();y.isEmpty()?(function(C,S){const w=S.getTextFormat(),x=S.getTextStyle();Gs(C,w,x)})(l,y):Gs(l,0,"")}}else{const u=a.key,d=l.focus.key,f=l.getNodes(),h=f.length,g=l.isBackward(),p=g?o:i,m=g?i:o,b=g?d:u,_=g?u:d;let y=2047,C=!1;for(let S=0;S<h;S++){const w=f[S],x=w.getTextContentSize();if(R(w)&&x!==0&&!(S===0&&w.__key===b&&p===x||S===h-1&&w.__key===_&&m===0)&&(C=!0,y&=w.getFormat(),y===0))break}l.format=C?y:0}}z(e,ni,void 0)})}function Gs(n,e,t){n.format===e&&n.style===t||(n.format=e,n.style=t,n.dirty=!0)}function Qh(n,e){Gs(n,e.getFormat(),e.getStyle())}function eg(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function py(n){const e=n.inputType,t=eg(n),r=se(),i=M();if(e==="deleteContentBackward"){if(i===null){const d=_n();if(!N(d))return!0;Re(d.clone())}if(N(i)){const d=i.anchor.key===i.focus.key;if(s=n.timeStamp,Yh==="MediaLast"&&s<Yi+30&&r.isComposing()&&d){if(Ie(null),Yi=0,setTimeout(()=>{Kt(r,()=>{Ie(null)})},30),N(i)){const f=i.anchor.getNode();f.markDirty(),R(f)||D(142),Qh(i,f)}}else{Ie(null),n.preventDefault();const f=i.anchor.getNode(),h=f.getTextContent(),g=f.canInsertTextAfter(),p=i.anchor.offset===0&&i.focus.offset===h.length;let m=Vu&&d&&!p&&g;if(m&&i.isCollapsed()&&(m=!Z(xo(i.anchor,!0))),!m){z(r,Nt,!0);const b=M();Vu&&N(b)&&b.isCollapsed()&&(qn=b,setTimeout(()=>qn=null))}}return!0}}var s;if(!N(i))return!0;const o=n.data;Pr!==null&&Gc(!1,r,Pr),i.dirty&&Pr===null||!i.isCollapsed()||ye(i.anchor.getNode())||t===null||i.applyDOMRange(t),Pr=null;const l=i.anchor,a=i.focus,c=l.getNode(),u=a.getNode();if(e==="insertText"||e==="insertTranspose"){if(o===`
|
|
4
|
-
`)n.preventDefault(),z(r,
|
|
5
|
-
`){const r=M();if(N(r)){const i=r.focus;return r.anchor.set(i.key,i.offset,i.type),void z(n,$n,null)}}}Gc(!0,n,e)}function by(n){const e=se();if(n.key==null)return!0;if(Ba&&$d(n))return Kt(e,()=>{uo(e,Ua)}),Ba=!1,Ua="",!0;if((function(t){return re(t,"ArrowRight",{shiftKey:"any"})})(n))z(e,jo,n);else if((function(t){return re(t,"ArrowRight",Qt)})(n))z(e,lo,n);else if((function(t){return re(t,"ArrowLeft",{shiftKey:"any"})})(n))z(e,hs,n);else if((function(t){return re(t,"ArrowLeft",Qt)})(n))z(e,Vi,n);else if((function(t){return re(t,"ArrowUp",{altKey:"any",shiftKey:"any"})})(n))z(e,cn,n);else if((function(t){return re(t,"ArrowDown",{altKey:"any",shiftKey:"any"})})(n))z(e,ar,n);else if((function(t){return re(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(n))Di=!0,z(e,$n,n);else if((function(t){return t.key===" "})(n))z(e,Ho,n);else if((function(t){return kt&&re(t,"o",{ctrlKey:!0})})(n))n.preventDefault(),Di=!0,z(e,ln,!0);else if((function(t){return re(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(n))Di=!1,z(e,$n,n);else if((function(t){return re(t,"Backspace",{shiftKey:"any"})||kt&&re(t,"h",{ctrlKey:!0})})(n))$d(n)?z(e,Jo,n):(n.preventDefault(),z(e,Nt,!0));else if((function(t){return t.key==="Escape"})(n))z(e,oi,n);else if((function(t){return re(t,"Delete",{})||kt&&re(t,"d",{ctrlKey:!0})})(n))(function(t){return t.key==="Delete"})(n)?z(e,Go,n):(n.preventDefault(),z(e,Nt,!1));else if((function(t){return re(t,"Backspace",Id)})(n))n.preventDefault(),z(e,or,!0);else if((function(t){return re(t,"Delete",Id)})(n))n.preventDefault(),z(e,or,!1);else if((function(t){return kt&&re(t,"Backspace",{metaKey:!0})})(n))n.preventDefault(),z(e,lr,!0);else if((function(t){return kt&&(re(t,"Delete",{metaKey:!0})||re(t,"k",{ctrlKey:!0}))})(n))n.preventDefault(),z(e,lr,!1);else if((function(t){return re(t,"b",Qt)})(n))n.preventDefault(),z(e,ve,"bold");else if((function(t){return re(t,"u",Qt)})(n))n.preventDefault(),z(e,ve,"underline");else if((function(t){return re(t,"i",Qt)})(n))n.preventDefault(),z(e,ve,"italic");else if((function(t){return re(t,"Tab",{shiftKey:"any"})})(n))z(e,gs,n);else if((function(t){return re(t,"z",Qt)})(n))n.preventDefault(),z(e,ii,void 0);else if((function(t){return kt?re(t,"z",{metaKey:!0,shiftKey:!0}):re(t,"y",{ctrlKey:!0})||re(t,"z",{ctrlKey:!0,shiftKey:!0})})(n))n.preventDefault(),z(e,si,void 0);else{const t=e._editorState._selection;t===null||N(t)?Fd(n)&&(n.preventDefault(),z(e,Vr,n)):(function(r){return re(r,"c",Qt)})(n)?(n.preventDefault(),z(e,_r,n)):(function(r){return re(r,"x",Qt)})(n)?(n.preventDefault(),z(e,li,n)):Fd(n)&&(n.preventDefault(),z(e,Vr,n))}return(function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey})(n)&&e.dispatchCommand(Vh,n),!0}function tg(n){let e=n.__lexicalEventHandles;return e===void 0&&(e=[],n.__lexicalEventHandles=e),e}const Kr=new Map;function ng(n){const e=Bg(n.target);if(e===null)return;const t=il(e.anchorNode);if(t===null)return;za&&(za=!1,Kt(t,()=>{const a=_n(),c=e.anchorNode;(ne(c)||Yt(c))&&Re(Zo(a,e,t,n))}));const r=Jc(t),i=r[r.length-1],s=i._key,o=Kr.get(s),l=o||i;l!==t&&ad(e,l,!1),ad(e,t,!0),t!==i?Kr.set(s,t):o&&Kr.delete(s)}function cd(n){n._lexicalHandled=!0}function ud(n){return n._lexicalHandled===!0}function xy(n){const e=La.get(n);if(e===void 0)return;const t=co.get(e);if(t===void 0)return;const r=t-1;r>=0||D(164),La.delete(n),co.set(e,r),r===0&&e.removeEventListener("selectionchange",ng);const i=_s(n);rl(i)?((function(o){if(o._parentEditor!==null){const l=Jc(o),a=l[l.length-1]._key;Kr.get(a)===o&&Kr.delete(a)}else Kr.delete(o._key)})(i),n.__lexicalEditor=null):i&&D(198);const s=tg(n);for(let o=0;o<s.length;o++)s[o]();n.__lexicalEventHandles=[]}function Ka(n,e,t){Me();const r=n.__key,i=n.getParent();if(i===null)return;const s=(function(l){const a=M();if(!N(a)||!A(l))return a;const{anchor:c,focus:u}=a,d=c.getNode(),f=u.getNode();return So(d,l)&&c.set(l.__key,0,"element"),So(f,l)&&u.set(l.__key,0,"element"),a})(n);let o=!1;if(N(s)&&e){const l=s.anchor,a=s.focus;l.key===r&&(_o(l,n,i,n.getPreviousSibling(),n.getNextSibling()),o=!0),a.key===r&&(_o(a,n,i,n.getPreviousSibling(),n.getNextSibling()),o=!0)}else je(s)&&e&&n.isSelected()&&n.selectPrevious();if(N(s)&&e&&!o){const l=n.getIndexWithinParent();Wt(n),mo(s,i,l,-1)}else Wt(n);t||Ue(i)||i.canBeEmpty()||!i.isEmpty()||Ka(i,e),e&&s&&ye(i)&&i.isEmpty()&&i.selectEnd()}function Sy(n){return n}const rg=Symbol.for("ephemeral");function fo(n){return n[rg]||!1}class Ut{__type;__key;__parent;__prev;__next;__state;static getType(){const{ownNodeType:e}=bs(this);return e===void 0&&D(64,this.name),e}static clone(e){D(65,this.name)}$config(){return{}}config(e,t){const r=t.extends||Object.getPrototypeOf(this.constructor);return Object.assign(t,{extends:r,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))}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),Ng(this,e)}getType(){return this.__type}isInline(){D(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=Q(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||M();if(t==null)return!1;const r=t.getNodes().some(i=>i.__key===this.__key);if(R(this))return r;if(N(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const i=this.getParent();if(Z(this)&&this.isInline()&&i){const s=t.isBackward()?t.focus:t.anchor;if(i.is(s.getNode())&&s.offset===i.getChildrenSize()&&this.is(i.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:Q(e)}getParentOrThrow(){const e=this.getParent();return e===null&&D(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(Ue(t))return A(e)||e===this&&Z(e)||D(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&D(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return e===null?null:Q(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:Q(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=A(this)?this:this.getParent(),r=A(e)?e:e.getParent(),i=t&&r?zi(t,r):null;return i?i.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){const t=zi(this,e);return t!==null&&(t.type==="descendant"||(t.type==="branch"?ou(t)===-1:(t.type!=="same"&&t.type!=="ancestor"&&D(279),!1)))}isParentOf(e){const t=zi(this,e);return t!==null&&t.type==="ancestor"}getNodesBetween(e){const t=this.isBefore(e),r=[],i=new Set;let s=this;for(;s!==null;){const o=s.__key;if(i.has(o)||(i.add(o),r.push(s)),s===e)break;const l=A(s)?t?s.getFirstChild():s.getLastChild():null;if(l!==null){s=l;continue}const a=t?s.getNextSibling():s.getPreviousSibling();if(a!==null){s=a;continue}const c=s.getParentOrThrow();if(i.has(c.__key)||r.push(c),c===e)break;let u=null,d=c;do{if(d===null&&D(68),u=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d===null)break;u!==null||i.has(d.__key)||r.push(d)}while(u===null);s=u}return t||r.reverse(),r}isDirty(){const e=se()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(fo(this))return this;const e=Q(this.__key);return e===null&&D(113),e}getWritable(){if(fo(this))return this;Me();const e=yn(),t=se(),r=e._nodeMap,i=this.__key,s=this.getLatest(),o=t._cloneNotNeeded,l=M();if(l!==null&&l.setCachedNodes(null),o.has(i))return bo(s),s;const a=tu(s);return o.add(i),bo(a),r.set(i,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){D(70)}updateDOM(e,t,r){D(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){const e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){D(18,this.name)}updateFromJSON(e){return(function(t,r){const i=t.getWritable(),s=r.$;let o=s;for(const l of Uh(i).flatKeys)l in r&&(o!==void 0&&o!==s||(o={...s}),o[l]=r[l]);return(i.__state||o)&&Ko(t).updateFromJSON(o),i})(this,e)}static transform(){return null}remove(e){Ka(this,!0,e)}replace(e,t){Me();let r=M();r!==null&&(r=r.clone()),Xl(this,e);const i=this.getLatest(),s=this.__key,o=e.__key,l=e.getWritable(),a=this.getParentOrThrow().getWritable(),c=a.__size;Wt(l);const u=i.getPreviousSibling(),d=i.getNextSibling(),f=i.__prev,h=i.__next,g=i.__parent;if(Ka(i,!1,!0),u===null?a.__first=o:u.getWritable().__next=o,l.__prev=f,d===null?a.__last=o:d.getWritable().__prev=o,l.__next=h,l.__parent=g,a.__size=c,t&&(A(this)&&A(l)||D(139),this.getChildren().forEach(p=>{l.append(p)})),N(r)){Re(r);const p=r.anchor,m=r.focus;p.key===s&&gd(p,l),m.key===s&&gd(m,l)}return vn()===s&&Ie(o),l}insertAfter(e,t=!0){Me(),Xl(this,e);const r=this.getWritable(),i=e.getWritable(),s=i.getParent(),o=M();let l=!1,a=!1;if(s!==null){const h=e.getIndexWithinParent();if(Wt(i),N(o)){const g=s.__key,p=o.anchor,m=o.focus;l=p.type==="element"&&p.key===g&&p.offset===h+1,a=m.type==="element"&&m.key===g&&m.offset===h+1}}const c=this.getNextSibling(),u=this.getParentOrThrow().getWritable(),d=i.__key,f=r.__next;if(c===null?u.__last=d:c.getWritable().__prev=d,u.__size++,r.__next=d,i.__next=f,i.__prev=r.__key,i.__parent=r.__parent,t&&N(o)){const h=this.getIndexWithinParent();mo(o,u,h+1);const g=u.__key;l&&o.anchor.set(g,h+2,"element"),a&&o.focus.set(g,h+2,"element")}return e}insertBefore(e,t=!0){Me(),Xl(this,e);const r=this.getWritable(),i=e.getWritable(),s=i.__key;Wt(i);const o=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),a=r.__prev,c=this.getIndexWithinParent();o===null?l.__first=s:o.getWritable().__next=s,l.__size++,r.__prev=s,i.__prev=a,i.__next=r.__key,i.__parent=r.__parent;const u=M();return t&&N(u)&&mo(u,this.getParentOrThrow(),c),e}isParentRequired(){return!1}createParentElementNode(){return J()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Me();const r=this.getPreviousSibling(),i=this.getParentOrThrow();if(r===null)return i.select(0,0);if(A(r))return r.select();if(!R(r)){const s=r.getIndexWithinParent()+1;return i.select(s,s)}return r.select(e,t)}selectNext(e,t){Me();const r=this.getNextSibling(),i=this.getParentOrThrow();if(r===null)return i.select();if(A(r))return r.select(0,0);if(!R(r)){const s=r.getIndexWithinParent();return i.select(s,s)}return r.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}const ho="historic",ig="history-push",Wr="history-merge",Rc="paste",sg="collaboration",Cy="skip-collab",og="skip-scroll-into-view",lg="skip-dom-selection",Wa="skip-selection-focus";class yr extends Ut{static getType(){return"linebreak"}static clone(e){return new yr(e.__key)}constructor(e){super(e)}getTextContent(){return`
|
|
6
|
-
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>(function(t){const r=t.parentElement;if(r!==null&&
|
|
3
|
+
`,X_=Ln?" ":Jo,Rh="֑-߿יִ-﷽ﹰ-ﻼ",Dh="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",Q_=new RegExp("^[^"+Dh+"]*["+Rh+"]"),ey=new RegExp("^[^"+Rh+"]*["+Dh+"]"),Ue={bold:1,capitalize:1024,code:16,highlight:Tc,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},ty={directionless:1,unmergeable:2},Qu={center:2,end:6,justify:4,left:1,right:3,start:5},ny={[G_]:"center",[Z_]:"end",[Y_]:"justify",[J_]:"left",[V_]:"right",[q_]:"start"},ry={normal:0,segmented:2,token:1},iy={[L_]:"normal",[D_]:"segmented",[R_]:"token"},sy="$",ed="$config";function Ph(n,e,t,r,i,s){let o=n.getFirstChild();for(;o!==null;){const l=o.__key;o.__parent===e&&(O(o)&&Ph(o,l,t,r,i,s),t.has(l)||s.delete(l),i.push(l)),o=o.getNextSibling()}}let $a=!1,Nc=0;function oy(n){Nc=n.timeStamp}function Yl(n,e,t){const r=n.nodeName==="BR",i=e.__lexicalLineBreak;return i&&(n===i||r&&n.previousSibling===i)||r&&dl(n,t)!==void 0}function ly(n,e,t){const r=kt(Et(t));let i=null,s=null;r!==null&&r.anchorNode===n&&(i=r.anchorOffset,s=r.focusOffset);const o=n.nodeValue;o!==null&&Qc(e,o,i,s,!1)}function ay(n,e,t){if(N(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return Xt(e)&&t.isAttached()}function cy(n,e,t,r){for(let i=n;i&&!Jg(i);i=vs(i)){const s=dl(i,e);if(s!==void 0){const o=Q(s,t);if(o)return Z(o)||!ne(i)?void 0:[i,o]}else if(i===r)return[r,$g(t)]}}function zh(n,e,t){$a=!0;const r=performance.now()-Nc>100;try{Ht(n,()=>{const i=M()||(function(f){return f.getEditorState().read(()=>{const h=M();return h!==null?h.clone():null})})(n),s=new Map,o=n.getRootElement(),l=n._editorState,a=n._blockCursorElement;let c=!1,u="";for(let f=0;f<e.length;f++){const h=e[f],g=h.type,p=h.target,m=cy(p,n,l,o);if(!m)continue;const[b,_]=m;if(g==="characterData")r&&L(_)&&Xt(p)&&ay(i,p,_)&&ly(p,_,n);else if(g==="childList"){c=!0;const y=h.addedNodes;for(let w=0;w<y.length;w++){const x=y[w],T=qc(x),E=x.parentNode;if(E!=null&&x!==a&&T===null&&!Yl(x,E,n)){if(Ln){const I=(ne(x)?x.innerText:null)||x.nodeValue;I&&(u+=I)}E.removeChild(x)}}const C=h.removedNodes,S=C.length;if(S>0){let w=0;for(let x=0;x<S;x++){const T=C[x];(Yl(T,p,n)||a===T)&&(p.appendChild(T),w++)}S!==w&&s.set(b,_)}}}if(s.size>0)for(const[f,h]of s)h.reconcileObservedMutation(f,n);const d=t.takeRecords();if(d.length>0){for(let f=0;f<d.length;f++){const h=d[f],g=h.addedNodes,p=h.target;for(let m=0;m<g.length;m++){const b=g[m],_=b.parentNode;_==null||b.nodeName!=="BR"||Yl(b,p,n)||_.removeChild(b)}}t.takeRecords()}i!==null&&(c&&De(i),Ln&&Pg(n)&&i.insertRawText(u))})}finally{$a=!1}}function Bh(n){const e=n._observer;e!==null&&zh(n,e.takeRecords(),e)}function Uh(n){(function(e){Nc===0&&Et(e).addEventListener("textInput",oy,!0)})(n),n._observer=new MutationObserver((e,t)=>{zh(n,e,t)})}let uy=class{key;parse;unparse;isEqual;defaultValue;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||hy).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0)}};function Ac(n,e){return new uy(n,e)}function Yi(n,e,t="latest"){const r=(t==="latest"?n.getLatest():n).__state;return r?r.getValue(e):e.defaultValue}function dy(n,e,t){const r=Yi(n,t,"direct"),i=Yi(e,t,"direct");return t.isEqual(r,i)?null:[r,i]}function Zs(n,e,t){let r;if($e(),typeof t=="function"){const s=n.getLatest(),o=Yi(s,e);if(r=t(o),e.isEqual(o,r))return s}else r=t;const i=n.getWritable();return Vo(i).updateFromKnown(e,r),i}function Kh(n){const e=new Map,t=new Set;for(let r=typeof n=="function"?n:n.replace;r.prototype&&r.prototype.getType!==void 0;r=Object.getPrototypeOf(r)){const{ownNodeConfig:i}=Es(r);if(i&&i.stateConfigs)for(const s of i.stateConfigs){let o;"stateConfig"in s?(o=s.stateConfig,s.flat&&t.add(o.key)):o=s,e.set(o.key,o)}}return{flatKeys:t,sharedConfigMap:e}}let fy=class Wh{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,r=void 0,i=new Map,s=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=r,this.knownState=i;const{sharedConfigMap:o}=this.sharedNodeState,l=s!==void 0?s:(function(a,c,u){let d=u.size;if(c)for(const f in c){const h=a.get(f);h&&u.has(h)||d++}return d})(o,r,i);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 i=this.unknownState[e.key];i!==void 0&&(r=e.parse(i)),this.updateFromKnown(e,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[r,i]of this.knownState)r.isEqual(i,r.defaultValue)?delete e[r.key]:e[r.key]=r.unparse(i);for(const r of this.sharedNodeState.flatKeys)r in e&&(t[r]=e[r],delete e[r]);return td(e)&&(t.$=e),t}getWritable(e){if(this.node===e)return this;const{sharedNodeState:t,unknownState:r}=this,i=new Map(this.knownState);return new Wh(e,t,(function(s,o,l){let a;if(l)for(const[c,u]of Object.entries(l)){const d=s.get(c);d?o.has(d)||o.set(d,d.parse(u)):(a=a||{},a[c]=u)}return a})(t.sharedConfigMap,i,r),i,this.size)}updateFromKnown(e,t){const r=e.key;this.sharedNodeState.sharedConfigMap.set(r,e);const{knownState:i,unknownState:s}=this;i.has(e)||s&&r in s||(s&&(delete s[r],this.unknownState=td(s)),this.size++),i.set(e,t)}updateFromUnknown(e,t){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,i]of Object.entries(e))this.updateFromUnknown(r,i)}};function Vo(n){const e=n.getWritable(),t=e.__state?e.__state.getWritable(e):new fy(e,jh(e));return e.__state=t,t}function jh(n){return n.__state?n.__state.sharedNodeState:Gc(_i(),n.getType()).sharedNodeState}function td(n){if(n)for(const e in n)return n}function hy(n){return n}function nd(n,e,t){for(const[r,i]of e.knownState){if(n.has(r.key))continue;n.add(r.key);const s=t?t.getValue(r):r.defaultValue;if(s!==i&&!r.isEqual(s,i))return!0}return!1}function rd(n,e,t){const{unknownState:r}=e,i=t?t.unknownState:void 0;if(r){for(const[s,o]of Object.entries(r))if(!n.has(s)&&(n.add(s),o!==(i?i[s]:void 0)))return!0}return!1}function id(n,e){const t=n.__state;return t&&t.node===n?t.getWritable(e):t}function sd(n,e){const t=n.__mode,r=n.__format,i=n.__style,s=e.__mode,o=e.__format,l=e.__style,a=n.__state,c=e.__state;return(t===null||t===s)&&(r===null||r===o)&&(i===null||i===l)&&(n.__state===null||a===c||(function(u,d){if(u===d)return!0;if(u&&d&&u.size!==d.size)return!1;const f=new Set;return!(u&&nd(f,u,d)||d&&nd(f,d,u)||u&&rd(f,u,d)||d&&rd(f,d,u))})(a,c))}function od(n,e){const t=n.mergeWithSibling(e),r=se()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function ld(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&L(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(sd(e,r)){r=od(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&L(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(sd(r,t)){r=od(r,t);break}break}t.remove()}}else r.remove()}function Rn(n){return ad(n.anchor),ad(n.focus),n}function ad(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,i;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),i=!0):(r=e.getChildAtIndex(t),i=!1),L(r)){n.set(r.__key,i?r.getTextContentSize():0,"text",!0);break}if(!O(r))break;n.set(r.__key,i?r.getChildrenSize():0,"element",!0)}}let cr,Ze,qi,Yo,Fa,La,ur,Mt,Ra,Zi,Ne="",Bt=null,Qn=null,Kr=!1,co=!1;function uo(n,e){const t=ur.get(n);if(e!==null){const r=Ba(n);r.parentNode===e&&e.removeChild(r)}if(Mt.has(n)||Ze._keyToDOMMap.delete(n),O(t)){const r=ho(t,ur);Da(r,0,r.length-1,null)}t!==void 0&&tu(Zi,qi,Yo,t,"destroyed")}function Da(n,e,t,r){for(let i=e;i<=t;++i){const s=n[i];s!==void 0&&uo(s,r)}}function Xn(n,e){n.setProperty("text-align",e)}const gy="40px";function Hh(n,e){const t=cr.theme.indent;if(typeof t=="string"){const i=n.classList.contains(t);e>0&&!i?n.classList.add(t):e<1&&i&&n.classList.remove(t)}const r=getComputedStyle(n).getPropertyValue("--lexical-indent-base-value")||gy;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${r})`)}function Jh(n,e){const t=n.style;e===0?Xn(t,""):e===1?Xn(t,"left"):e===2?Xn(t,"center"):e===3?Xn(t,"right"):e===4?Xn(t,"justify"):e===5?Xn(t,"start"):e===6&&Xn(t,"end")}function Pa(n,e){const t=(function(r){const i=r.__dir;if(i!==null)return i;if(_e(r))return null;const s=r.getParentOrThrow();return _e(s)&&s.__dir===null?"auto":null})(e);t!==null?n.dir=t:n.removeAttribute("dir")}function fo(n,e){const t=Mt.get(n);t===void 0&&R(60);const r=t.createDOM(cr,Ze);if((function(i,s,o){const l=o._keyToDOMMap;(function(a,c,u){const d=`__lexicalKey_${c._key}`;a[d]=u})(s,o,i),l.set(i,s)})(n,r,Ze),L(t)?r.setAttribute("data-lexical-text","true"):Z(t)&&r.setAttribute("data-lexical-decorator","true"),O(t)){const i=t.__indent,s=t.__size;if(Pa(r,t),i!==0&&Hh(r,i),s!==0){const l=s-1;za(ho(t,Mt),t,0,l,t.getDOMSlot(r))}const o=t.__format;o!==0&&Jh(r,o),t.isInline()||Gh(null,t,r)}else{const i=t.getTextContent();if(Z(t)){const s=t.decorate(Ze,cr);s!==null&&Vh(n,s),r.contentEditable="false"}Ne+=i}return e!==null&&e.insertChild(r),tu(Zi,qi,Yo,t,"created"),r}function za(n,e,t,r,i){const s=Ne;Ne="";let o=t;for(;o<=r;++o){fo(n[o],i);const l=Mt.get(n[o]);l!==null&&L(l)?Bt===null&&(Bt=l.getFormat(),Qn=l.getStyle()):O(l)&&o<r&&!l.isInline()&&(Ne+=Go)}i.element.__lexicalTextContent=Ne,Ne=s+Ne}function cd(n,e){if(n){const t=n.__last;if(t){const r=e.get(t);if(r)return ue(r)?"line-break":Z(r)&&r.isInline()?"decorator":null}return"empty"}return null}function Gh(n,e,t){const r=cd(n,ur),i=cd(e,Mt);r!==i&&e.getDOMSlot(t).setManagedLineBreak(i)}function py(n,e,t){var r;Bt=null,Qn=null,(function(i,s,o){const l=Ne,a=i.__size,c=s.__size;Ne="";const u=o.element;if(a===1&&c===1){const d=i.__first,f=s.__first;if(d===f)Xs(d,u);else{const g=Ba(d),p=fo(f,null);try{u.replaceChild(p,g)}catch(m){if(typeof m=="object"&&m!=null){const b=`${m.toString()} Parent: ${u.tagName}, new child: {tag: ${p.tagName} key: ${f}}, old child: {tag: ${g.tagName}, key: ${d}}.`;throw new Error(b)}throw m}uo(d,null)}const h=Mt.get(f);L(h)&&Bt===null&&(Bt=h.getFormat(),Qn=h.getStyle())}else{const d=ho(i,ur),f=ho(s,Mt);if(d.length!==a&&R(227),f.length!==c&&R(228),a===0)c!==0&&za(f,0,0,c-1,o);else if(c===0){if(a!==0){const h=o.after==null&&o.before==null&&o.element.__lexicalLineBreak==null;Da(d,0,a-1,h?null:u),h&&(u.textContent="")}}else(function(h,g,p,m,b,_){const y=m-1,C=b-1;let S,w,x=_.getFirstChild(),T=0,E=0;for(;T<=y&&E<=C;){const k=g[T],D=p[E];if(k===D)x=ql(Xs(D,_.element)),T++,E++;else{if(w===void 0&&(w=ud(p,E)),S===void 0)S=ud(g,T);else if(!S.has(k)){T++;continue}if(!w.has(k)){x=ql(Ba(k)),uo(k,_.element),T++,S.delete(k);continue}if(S.has(D)){const F=pr(Ze,D);F!==x&&_.withBefore(x).insertChild(F),x=ql(Xs(D,_.element)),T++,E++}else fo(D,_.withBefore(x)),E++}const K=Mt.get(D);K!==null&&L(K)?Bt===null&&(Bt=K.getFormat(),Qn=K.getStyle()):O(K)&&E<=C&&!K.isInline()&&(Ne+=Go)}const I=T>y,$=E>C;if(I&&!$){const k=p[C+1],D=k===void 0?null:Ze.getElementByKey(k);za(p,0,E,C,_.withBefore(D))}else $&&!I&&Da(g,T,y,_.element)})(0,d,f,a,c,o)}u.__lexicalTextContent=Ne,Ne=l+Ne})(n,e,e.getDOMSlot(t)),r=e,Bt==null||Bt===r.__textFormat||co||r.setTextFormat(Bt),(function(i){Qn==null||Qn===i.__textStyle||co||i.setTextStyle(Qn)})(e)}function ho(n,e){const t=[];let r=n.__first;for(;r!==null;){const i=e.get(r);i===void 0&&R(101),t.push(r),r=i.__next}return t}function Xs(n,e){const t=ur.get(n);let r=Mt.get(n);t!==void 0&&r!==void 0||R(61);const i=Kr||La.has(n)||Fa.has(n),s=pr(Ze,n);if(t===r&&!i){let o;if(O(t)){const l=s.__lexicalTextContent;typeof l=="string"?o=l:(o=t.getTextContent(),s.__lexicalTextContent=o)}else o=t.getTextContent();return Ne+=o,s}if(t!==r&&i&&tu(Zi,qi,Yo,r,"updated"),r.updateDOM(t,s,cr)){const o=fo(n,null);return e===null&&R(62),e.replaceChild(o,s),uo(n,null),o}if(O(t)){O(r)||R(334,n);const o=r.__indent;(Kr||o!==t.__indent)&&Hh(s,o);const l=r.__format;if((Kr||l!==t.__format)&&Jh(s,l),i)py(t,r,s),_e(r)||r.isInline()||Gh(t,r,s);else{const a=s.__lexicalTextContent;let c;typeof a=="string"?c=a:(c=t.getTextContent(),s.__lexicalTextContent=c),Ne+=c}if((Kr||r.__dir!==t.__dir)&&(Pa(s,r),_e(r)&&!Kr))for(const a of r.getChildren())O(a)&&Pa(pr(Ze,a.getKey()),a)}else{const o=r.getTextContent();if(Z(r)){const l=r.decorate(Ze,cr);l!==null&&Vh(n,l)}Ne+=o}if(!co&&_e(r)&&r.__cachedText!==Ne){const o=r.getWritable();o.__cachedText=Ne,r=o}return s}function Vh(n,e){let t=Ze._pendingDecorators;const r=Ze._decorators;if(t===null){if(r[n]===e)return;t=Ig(Ze)}t[n]=e}function ql(n){let e=n.nextSibling;return e!==null&&e===Ze._blockCursorElement&&(e=e.nextSibling),e}function ud(n,e){const t=new Set;for(let r=e;r<n.length;r++)t.add(n[r]);return t}function my(n,e,t,r,i,s){Ne="",Kr=r===2,Ze=t,cr=t._config,qi=t._nodes,Yo=Ze._listeners.mutation,Fa=i,La=s,ur=n._nodeMap,Mt=e._nodeMap,co=e._readOnly,Ra=new Map(t._keyToDOMMap);const o=new Map;return Zi=o,Xs("root",null),Ze=void 0,qi=void 0,Fa=void 0,La=void 0,ur=void 0,Mt=void 0,cr=void 0,Ra=void 0,Zi=void 0,o}function Ba(n){const e=Ra.get(n);return e===void 0&&R(75,n),e}function U(n){return{type:n}}const li=U("SELECTION_CHANGE_COMMAND"),Oc=U("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Sr=U("CLICK_COMMAND"),Mc=U("BEFORE_INPUT_COMMAND"),Ic=U("INPUT_COMMAND"),$c=U("COMPOSITION_START_COMMAND"),Fc=U("COMPOSITION_END_COMMAND"),It=U("DELETE_CHARACTER_COMMAND"),dn=U("INSERT_LINE_BREAK_COMMAND"),Dn=U("INSERT_PARAGRAPH_COMMAND"),In=U("CONTROLLED_TEXT_INSERTION_COMMAND"),ai=U("PASTE_COMMAND"),Xi=U("REMOVE_TEXT_COMMAND"),dr=U("DELETE_WORD_COMMAND"),fr=U("DELETE_LINE_COMMAND"),we=U("FORMAT_TEXT_COMMAND"),ci=U("UNDO_COMMAND"),ui=U("REDO_COMMAND"),Lc=U("KEYDOWN_COMMAND"),qo=U("KEY_ARROW_RIGHT_COMMAND"),go=U("MOVE_TO_END"),bs=U("KEY_ARROW_LEFT_COMMAND"),Qi=U("MOVE_TO_START"),hn=U("KEY_ARROW_UP_COMMAND"),hr=U("KEY_ARROW_DOWN_COMMAND"),Pn=U("KEY_ENTER_COMMAND"),Zo=U("KEY_SPACE_COMMAND"),Xo=U("KEY_BACKSPACE_COMMAND"),di=U("KEY_ESCAPE_COMMAND"),Qo=U("KEY_DELETE_COMMAND"),xs=U("KEY_TAB_COMMAND"),po=U("INSERT_TAB_COMMAND"),Wt=U("INDENT_CONTENT_COMMAND"),ln=U("OUTDENT_CONTENT_COMMAND"),el=U("DROP_COMMAND"),Rc=U("FORMAT_ELEMENT_COMMAND"),tl=U("DRAGSTART_COMMAND"),Dc=U("DRAGOVER_COMMAND"),Yh=U("DRAGEND_COMMAND"),Cr=U("COPY_COMMAND"),fi=U("CUT_COMMAND"),Qr=U("SELECT_ALL_COMMAND"),Pc=U("CLEAR_EDITOR_COMMAND"),qh=U("CLEAR_HISTORY_COMMAND"),$i=U("CAN_REDO_COMMAND"),Fi=U("CAN_UNDO_COMMAND"),zc=U("FOCUS_COMMAND"),hi=U("BLUR_COMMAND"),Zh=U("KEY_MODIFIER_COMMAND"),en=Object.freeze({}),Ua=[["keydown",function(n,e){es=n.timeStamp,Xh=n.key,!e.isComposing()&&z(e,Lc,n)}],["pointerdown",function(n,e){const t=n.target,r=n.pointerType;Yn(t)&&r!=="touch"&&r!=="pen"&&n.button===0&&Ht(e,()=>{Ag(t)||(ja=!0)})}],["compositionstart",function(n,e){z(e,$c,n)}],["compositionend",function(n,e){Ln?Li=!0:oi||!_s&&!ys?z(e,Fc,n):(Ha=!0,Ja=n.data)}],["input",function(n,e){n.stopPropagation(),Ht(e,()=>{e.dispatchCommand(Ic,n)},{event:n}),Wr=null}],["click",function(n,e){Ht(e,()=>{const t=M(),r=kt(Et(e)),i=Sn();if(r){if(N(t)){const s=t.anchor,o=s.getNode();if(s.type==="element"&&s.offset===0&&t.isCollapsed()&&!_e(o)&&de().getChildrenSize()===1&&o.getTopLevelElementOrThrow().isEmpty()&&i!==null&&t.is(i))r.removeAllRanges(),t.dirty=!0;else if(n.detail===3&&!t.isCollapsed()&&o!==t.focus.getNode()){const l=le(o,a=>O(a)&&!a.isInline());O(l)&&l.select(0)}}else if(n.pointerType==="touch"||n.pointerType==="pen"){const s=r.anchorNode;(ne(s)||Xt(s))&&De(rl(i,r,e,n))}}z(e,Sr,n)})}],["cut",en],["copy",en],["dragstart",en],["dragover",en],["dragend",en],["paste",en],["focus",en],["blur",en],["drop",en]];ao&&Ua.push(["beforeinput",(n,e)=>(function(t,r){const i=t.inputType;i==="deleteCompositionText"||Ln&&Pg(r)||i!=="insertCompositionText"&&z(r,Mc,t)})(n,e)]);let es=0,Xh=null,Qh=0,Wr=null;const Ka=new WeakMap,mo=new WeakMap;let Wa=!1,ja=!1,Ui=!1,Li=!1,Ha=!1,Ja="",tr=null,eg=[0,"",0,"root",0];function tg(n,e,t,r,i){const s=n.anchor,o=n.focus,l=s.getNode(),a=se(),c=kt(Et(a)),u=c!==null?c.anchorNode:null,d=s.key,f=a.getElementByKey(d),h=t.length;return d!==o.key||!L(l)||(!i&&(!ao||Qh<r+50)||l.isDirty()&&h<2||Fg(t))&&s.offset!==o.offset&&!l.isComposing()||At(l)||l.isDirty()&&h>1||(i||!ao)&&f!==null&&!l.isComposing()&&u!==gr(f)||c!==null&&e!==null&&(!e.collapsed||e.startContainer!==c.anchorNode||e.startOffset!==c.anchorOffset)||l.getFormat()!==n.format||l.getStyle()!==n.style||(function(g,p){if(p.isSegmented())return!0;if(!g.isCollapsed())return!1;const m=g.anchor.offset,b=p.getParentOrThrow(),_=$n(p);return m===0?!p.canInsertTextBefore()||!b.canInsertTextBefore()&&!p.isComposing()||_||(function(y){const C=y.getPreviousSibling();return(L(C)||O(C)&&C.isInline())&&!C.canInsertTextAfter()})(p):m===p.getTextContentSize()&&(!p.canInsertTextAfter()||!b.canInsertTextAfter()&&!p.isComposing()||_)})(n,l)}function dd(n,e){return Xt(n)&&n.nodeValue!==null&&e!==0&&e!==n.nodeValue.length}function fd(n,e,t){const{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:o}=n;Wa&&(Wa=!1,dd(r,i)&&dd(s,o)&&!tr)||Ht(e,()=>{if(!t)return void De(null);if(!mi(e,r,s))return;let l=M();if(tr&&N(l)&&l.isCollapsed()){const a=l.anchor,c=tr.anchor;(a.key===c.key&&a.offset===c.offset+1||a.offset===1&&c.getNode().is(a.getNode().getPreviousSibling()))&&(l=tr.clone(),De(l))}if(tr=null,N(l)){const a=l.anchor,c=a.getNode();if(l.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(l.dirty=!0);const u=Et(e).event,d=u?u.timeStamp:performance.now(),[f,h,g,p,m]=eg,b=de(),_=e.isComposing()===!1&&b.getTextContent()==="";if(d<m+200&&a.offset===g&&a.key===p)Qs(l,f,h);else if(a.type==="text")L(c)||R(141),ng(l,c);else if(a.type==="element"&&!_){O(c)||R(259);const y=a.getNode();y.isEmpty()?(function(C,S){const w=S.getTextFormat(),x=S.getTextStyle();Qs(C,w,x)})(l,y):Qs(l,0,"")}}else{const u=a.key,d=l.focus.key,f=l.getNodes(),h=f.length,g=l.isBackward(),p=g?o:i,m=g?i:o,b=g?d:u,_=g?u:d;let y=2047,C=!1;for(let S=0;S<h;S++){const w=f[S],x=w.getTextContentSize();if(L(w)&&x!==0&&!(S===0&&w.__key===b&&p===x||S===h-1&&w.__key===_&&m===0)&&(C=!0,y&=w.getFormat(),y===0))break}l.format=C?y:0}}z(e,li,void 0)})}function Qs(n,e,t){n.format===e&&n.style===t||(n.format=e,n.style=t,n.dirty=!0)}function ng(n,e){Qs(n,e.getFormat(),e.getStyle())}function rg(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function _y(n){const e=n.inputType,t=rg(n),r=se(),i=M();if(e==="deleteContentBackward"){if(i===null){const d=Sn();if(!N(d))return!0;De(d.clone())}if(N(i)){const d=i.anchor.key===i.focus.key;if(s=n.timeStamp,Xh==="MediaLast"&&s<es+30&&r.isComposing()&&d){if(Fe(null),es=0,setTimeout(()=>{Ht(r,()=>{Fe(null)})},30),N(i)){const f=i.anchor.getNode();f.markDirty(),L(f)||R(142),ng(i,f)}}else{Fe(null),n.preventDefault();const f=i.anchor.getNode(),h=f.getTextContent(),g=f.canInsertTextAfter(),p=i.anchor.offset===0&&i.focus.offset===h.length;let m=Xu&&d&&!p&&g;if(m&&i.isCollapsed()&&(m=!Z(ko(i.anchor,!0))),!m){z(r,It,!0);const b=M();Xu&&N(b)&&b.isCollapsed()&&(tr=b,setTimeout(()=>tr=null))}}return!0}}var s;if(!N(i))return!0;const o=n.data;Wr!==null&&Xc(!1,r,Wr),i.dirty&&Wr===null||!i.isCollapsed()||_e(i.anchor.getNode())||t===null||i.applyDOMRange(t),Wr=null;const l=i.anchor,a=i.focus,c=l.getNode(),u=a.getNode();if(e==="insertText"||e==="insertTranspose"){if(o===`
|
|
4
|
+
`)n.preventDefault(),z(r,dn,!1);else if(o===Go)n.preventDefault(),z(r,Dn,void 0);else if(o==null&&n.dataTransfer){const d=n.dataTransfer.getData("text/plain");n.preventDefault(),i.insertRawText(d)}else o!=null&&tg(i,t,o,n.timeStamp,!0)?(n.preventDefault(),z(r,In,o)):Wr=o;return Qh=n.timeStamp,!0}switch(n.preventDefault(),e){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":z(r,In,n);break;case"insertFromComposition":Fe(null),z(r,In,n);break;case"insertLineBreak":Fe(null),z(r,dn,!1);break;case"insertParagraph":Fe(null),Ui&&!oi?(Ui=!1,z(r,dn,!1)):z(r,Dn,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":z(r,ai,n);break;case"deleteByComposition":(function(d,f){return d!==f||O(d)||O(f)||!$n(d)||!$n(f)})(c,u)&&z(r,Xi,n);break;case"deleteByDrag":case"deleteByCut":z(r,Xi,n);break;case"deleteContent":z(r,It,!1);break;case"deleteWordBackward":z(r,dr,!0);break;case"deleteWordForward":z(r,dr,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":z(r,fr,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":z(r,fr,!1);break;case"formatStrikeThrough":z(r,we,"strikethrough");break;case"formatBold":z(r,we,"bold");break;case"formatItalic":z(r,we,"italic");break;case"formatUnderline":z(r,we,"underline");break;case"historyUndo":z(r,ci,void 0);break;case"historyRedo":z(r,ui,void 0)}return!0}function yy(n){if(ne(n.target)&&Ag(n.target))return!0;const e=se(),t=M(),r=n.data,i=rg(n);if(r!=null&&N(t)&&tg(t,i,r,n.timeStamp,!1)){Li&&(_o(e,r),Li=!1);const s=t.anchor.getNode(),o=kt(Et(e));if(o===null)return!0;const l=t.isBackward(),a=l?t.anchor.offset:t.focus.offset,c=l?t.focus.offset:t.anchor.offset;ao&&!t.isCollapsed()&&L(s)&&o.anchorNode!==null&&s.getTextContent().slice(0,a)+r+s.getTextContent().slice(a+c)===Rg(o.anchorNode)||z(e,In,r);const u=r.length;Ln&&u>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=u),_s||oi||ys||!e.isComposing()||(es=0,Fe(null))}else Xc(!1,e,r!==null?r:void 0),Li&&(_o(e,r||void 0),Li=!1);return(function(){$e();const s=se();Bh(s)})(),!0}function by(n){const e=se(),t=M();if(N(t)&&!e.isComposing()){const r=t.anchor,i=t.anchor.getNode();Fe(r.key),(n.timeStamp<es+30||r.type==="element"||!t.isCollapsed()||i.getFormat()!==t.format||L(i)&&i.getStyle()!==t.style)&&z(e,In,X_)}return!0}function xy(n){return _o(se(),n.data),!0}function _o(n,e){const t=n._compositionKey;if(Fe(null),t!==null&&e!=null){if(e===""){const r=Q(t),i=gr(n.getElementByKey(t));return void(i!==null&&i.nodeValue!==null&&L(r)&&Qc(r,i.nodeValue,null,null,!0))}if(e[e.length-1]===`
|
|
5
|
+
`){const r=M();if(N(r)){const i=r.focus;return r.anchor.set(i.key,i.offset,i.type),void z(n,Pn,null)}}}Xc(!0,n,e)}function Sy(n){const e=se();if(n.key==null)return!0;if(Ha&&Dd(n))return Ht(e,()=>{_o(e,Ja)}),Ha=!1,Ja="",!0;if((function(t){return re(t,"ArrowRight",{shiftKey:"any"})})(n))z(e,qo,n);else if((function(t){return re(t,"ArrowRight",rn)})(n))z(e,go,n);else if((function(t){return re(t,"ArrowLeft",{shiftKey:"any"})})(n))z(e,bs,n);else if((function(t){return re(t,"ArrowLeft",rn)})(n))z(e,Qi,n);else if((function(t){return re(t,"ArrowUp",{altKey:"any",shiftKey:"any"})})(n))z(e,hn,n);else if((function(t){return re(t,"ArrowDown",{altKey:"any",shiftKey:"any"})})(n))z(e,hr,n);else if((function(t){return re(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})})(n))Ui=!0,z(e,Pn,n);else if((function(t){return t.key===" "})(n))z(e,Zo,n);else if((function(t){return Ot&&re(t,"o",{ctrlKey:!0})})(n))n.preventDefault(),Ui=!0,z(e,dn,!0);else if((function(t){return re(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})})(n))Ui=!1,z(e,Pn,n);else if((function(t){return re(t,"Backspace",{shiftKey:"any"})||Ot&&re(t,"h",{ctrlKey:!0})})(n))Dd(n)?z(e,Xo,n):(n.preventDefault(),z(e,It,!0));else if((function(t){return t.key==="Escape"})(n))z(e,di,n);else if((function(t){return re(t,"Delete",{})||Ot&&re(t,"d",{ctrlKey:!0})})(n))(function(t){return t.key==="Delete"})(n)?z(e,Qo,n):(n.preventDefault(),z(e,It,!1));else if((function(t){return re(t,"Backspace",Rd)})(n))n.preventDefault(),z(e,dr,!0);else if((function(t){return re(t,"Delete",Rd)})(n))n.preventDefault(),z(e,dr,!1);else if((function(t){return Ot&&re(t,"Backspace",{metaKey:!0})})(n))n.preventDefault(),z(e,fr,!0);else if((function(t){return Ot&&(re(t,"Delete",{metaKey:!0})||re(t,"k",{ctrlKey:!0}))})(n))n.preventDefault(),z(e,fr,!1);else if((function(t){return re(t,"b",rn)})(n))n.preventDefault(),z(e,we,"bold");else if((function(t){return re(t,"u",rn)})(n))n.preventDefault(),z(e,we,"underline");else if((function(t){return re(t,"i",rn)})(n))n.preventDefault(),z(e,we,"italic");else if((function(t){return re(t,"Tab",{shiftKey:"any"})})(n))z(e,xs,n);else if((function(t){return re(t,"z",rn)})(n))n.preventDefault(),z(e,ci,void 0);else if((function(t){return Ot?re(t,"z",{metaKey:!0,shiftKey:!0}):re(t,"y",{ctrlKey:!0})||re(t,"z",{ctrlKey:!0,shiftKey:!0})})(n))n.preventDefault(),z(e,ui,void 0);else{const t=e._editorState._selection;t===null||N(t)?Pd(n)&&(n.preventDefault(),z(e,Qr,n)):(function(r){return re(r,"c",rn)})(n)?(n.preventDefault(),z(e,Cr,n)):(function(r){return re(r,"x",rn)})(n)?(n.preventDefault(),z(e,fi,n)):Pd(n)&&(n.preventDefault(),z(e,Qr,n))}return(function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey})(n)&&e.dispatchCommand(Zh,n),!0}function ig(n){let e=n.__lexicalEventHandles;return e===void 0&&(e=[],n.__lexicalEventHandles=e),e}const Gr=new Map;function sg(n){const e=Wg(n.target);if(e===null)return;const t=ul(e.anchorNode);if(t===null)return;ja&&(ja=!1,Ht(t,()=>{const a=Sn(),c=e.anchorNode;(ne(c)||Xt(c))&&De(rl(a,e,t,n))}));const r=Zc(t),i=r[r.length-1],s=i._key,o=Gr.get(s),l=o||i;l!==t&&fd(e,l,!1),fd(e,t,!0),t!==i?Gr.set(s,t):o&&Gr.delete(s)}function hd(n){n._lexicalHandled=!0}function gd(n){return n._lexicalHandled===!0}function Cy(n){const e=Ka.get(n);if(e===void 0)return;const t=mo.get(e);if(t===void 0)return;const r=t-1;r>=0||R(164),Ka.delete(n),mo.set(e,r),r===0&&e.removeEventListener("selectionchange",sg);const i=ws(n);cl(i)?((function(o){if(o._parentEditor!==null){const l=Zc(o),a=l[l.length-1]._key;Gr.get(a)===o&&Gr.delete(a)}else Gr.delete(o._key)})(i),n.__lexicalEditor=null):i&&R(198);const s=ig(n);for(let o=0;o<s.length;o++)s[o]();n.__lexicalEventHandles=[]}function Ga(n,e,t){$e();const r=n.__key,i=n.getParent();if(i===null)return;const s=(function(l){const a=M();if(!N(a)||!O(l))return a;const{anchor:c,focus:u}=a,d=c.getNode(),f=u.getNode();return To(d,l)&&c.set(l.__key,0,"element"),To(f,l)&&u.set(l.__key,0,"element"),a})(n);let o=!1;if(N(s)&&e){const l=s.anchor,a=s.focus;l.key===r&&(wo(l,n,i,n.getPreviousSibling(),n.getNextSibling()),o=!0),a.key===r&&(wo(a,n,i,n.getPreviousSibling(),n.getNextSibling()),o=!0)}else Ge(s)&&e&&n.isSelected()&&n.selectPrevious();if(N(s)&&e&&!o){const l=n.getIndexWithinParent();Jt(n),Co(s,i,l,-1)}else Jt(n);t||We(i)||i.canBeEmpty()||!i.isEmpty()||Ga(i,e),e&&s&&_e(i)&&i.isEmpty()&&i.selectEnd()}function wy(n){return n}const og=Symbol.for("ephemeral");function yo(n){return n[og]||!1}class jt{__type;__key;__parent;__prev;__next;__state;static getType(){const{ownNodeType:e}=Es(this);return e===void 0&&R(64,this.name),e}static clone(e){R(65,this.name)}$config(){return{}}config(e,t){const r=t.extends||Object.getPrototypeOf(this.constructor);return Object.assign(t,{extends:r,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))}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:!0,enumerable:!1,value:void 0,writable:!0}),Mg(this,e)}getType(){return this.__type}isInline(){R(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e==="root")return!0;const t=Q(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){const t=e||M();if(t==null)return!1;const r=t.getNodes().some(i=>i.__key===this.__key);if(L(this))return r;if(N(t)&&t.anchor.type==="element"&&t.focus.type==="element"){if(t.isCollapsed())return!1;const i=this.getParent();if(Z(this)&&this.isInline()&&i){const s=t.isBackward()?t.focus:t.anchor;if(i.is(s.getNode())&&s.offset===i.getChildrenSize()&&this.is(i.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:Q(e)}getParentOrThrow(){const e=this.getParent();return e===null&&R(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){const t=e.getParent();if(We(t))return O(e)||e===this&&Z(e)||R(194),e;e=t}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return e===null&&R(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:Q(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:Q(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=O(this)?this:this.getParent(),r=O(e)?e:e.getParent(),i=t&&r?ji(t,r):null;return i?i.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){const t=ji(this,e);return t!==null&&(t.type==="descendant"||(t.type==="branch"?du(t)===-1:(t.type!=="same"&&t.type!=="ancestor"&&R(279),!1)))}isParentOf(e){const t=ji(this,e);return t!==null&&t.type==="ancestor"}getNodesBetween(e){const t=this.isBefore(e),r=[],i=new Set;let s=this;for(;s!==null;){const o=s.__key;if(i.has(o)||(i.add(o),r.push(s)),s===e)break;const l=O(s)?t?s.getFirstChild():s.getLastChild():null;if(l!==null){s=l;continue}const a=t?s.getNextSibling():s.getPreviousSibling();if(a!==null){s=a;continue}const c=s.getParentOrThrow();if(i.has(c.__key)||r.push(c),c===e)break;let u=null,d=c;do{if(d===null&&R(68),u=t?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),d===null)break;u!==null||i.has(d.__key)||r.push(d)}while(u===null);s=u}return t||r.reverse(),r}isDirty(){const e=se()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(yo(this))return this;const e=Q(this.__key);return e===null&&R(113),e}getWritable(){if(yo(this))return this;$e();const e=Cn(),t=se(),r=e._nodeMap,i=this.__key,s=this.getLatest(),o=t._cloneNotNeeded,l=M();if(l!==null&&l.setCachedNodes(null),o.has(i))return Eo(s),s;const a=ou(s);return o.add(i),Eo(a),r.set(i,a),a}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){R(70)}updateDOM(e,t,r){R(71)}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){R(18,this.name)}updateFromJSON(e){return(function(t,r){const i=t.getWritable(),s=r.$;let o=s;for(const l of jh(i).flatKeys)l in r&&(o!==void 0&&o!==s||(o={...s}),o[l]=r[l]);return(i.__state||o)&&Vo(t).updateFromJSON(o),i})(this,e)}static transform(){return null}remove(e){Ga(this,!0,e)}replace(e,t){$e();let r=M();r!==null&&(r=r.clone()),na(this,e);const i=this.getLatest(),s=this.__key,o=e.__key,l=e.getWritable(),a=this.getParentOrThrow().getWritable(),c=a.__size;Jt(l);const u=i.getPreviousSibling(),d=i.getNextSibling(),f=i.__prev,h=i.__next,g=i.__parent;if(Ga(i,!1,!0),u===null?a.__first=o:u.getWritable().__next=o,l.__prev=f,d===null?a.__last=o:d.getWritable().__prev=o,l.__next=h,l.__parent=g,a.__size=c,t&&(O(this)&&O(l)||R(139),this.getChildren().forEach(p=>{l.append(p)})),N(r)){De(r);const p=r.anchor,m=r.focus;p.key===s&&yd(p,l),m.key===s&&yd(m,l)}return An()===s&&Fe(o),l}insertAfter(e,t=!0){$e(),na(this,e);const r=this.getWritable(),i=e.getWritable(),s=i.getParent(),o=M();let l=!1,a=!1;if(s!==null){const h=e.getIndexWithinParent();if(Jt(i),N(o)){const g=s.__key,p=o.anchor,m=o.focus;l=p.type==="element"&&p.key===g&&p.offset===h+1,a=m.type==="element"&&m.key===g&&m.offset===h+1}}const c=this.getNextSibling(),u=this.getParentOrThrow().getWritable(),d=i.__key,f=r.__next;if(c===null?u.__last=d:c.getWritable().__prev=d,u.__size++,r.__next=d,i.__next=f,i.__prev=r.__key,i.__parent=r.__parent,t&&N(o)){const h=this.getIndexWithinParent();Co(o,u,h+1);const g=u.__key;l&&o.anchor.set(g,h+2,"element"),a&&o.focus.set(g,h+2,"element")}return e}insertBefore(e,t=!0){$e(),na(this,e);const r=this.getWritable(),i=e.getWritable(),s=i.__key;Jt(i);const o=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),a=r.__prev,c=this.getIndexWithinParent();o===null?l.__first=s:o.getWritable().__next=s,l.__size++,r.__prev=s,i.__prev=a,i.__next=r.__key,i.__parent=r.__parent;const u=M();return t&&N(u)&&Co(u,this.getParentOrThrow(),c),e}isParentRequired(){return!1}createParentElementNode(){return H()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){$e();const r=this.getPreviousSibling(),i=this.getParentOrThrow();if(r===null)return i.select(0,0);if(O(r))return r.select();if(!L(r)){const s=r.getIndexWithinParent()+1;return i.select(s,s)}return r.select(e,t)}selectNext(e,t){$e();const r=this.getNextSibling(),i=this.getParentOrThrow();if(r===null)return i.select();if(O(r))return r.select(0,0);if(!L(r)){const s=r.getIndexWithinParent();return i.select(s,s)}return r.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}const bo="historic",lg="history-push",Vr="history-merge",Bc="paste",ag="collaboration",vy="skip-collab",cg="skip-scroll-into-view",ug="skip-dom-selection",Va="skip-selection-focus";class wr extends jt{static getType(){return"linebreak"}static clone(e){return new wr(e.__key)}constructor(e){super(e)}getTextContent(){return`
|
|
6
|
+
`}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>(function(t){const r=t.parentElement;if(r!==null&&ts(r)){const i=r.firstChild;if(i===t||i.nextSibling===t&&Rs(i)){const s=r.lastChild;if(s===t||s.previousSibling===t&&Rs(s))return!0}}return!1})(e)||(function(t){const r=t.parentElement;if(r!==null&&ts(r)){const i=r.firstChild;if(i===t||i.nextSibling===t&&Rs(i))return!1;const s=r.lastChild;if(s===t||s.previousSibling===t&&Rs(s))return!0}return!1})(e)?null:{conversion:Ey,priority:0}}}static importJSON(e){return ut().updateFromJSON(e)}}function Ey(n){return{node:ut()}}function ut(){return ze(new wr)}function ue(n){return n instanceof wr}function Rs(n){return Xt(n)&&/^( |\t|\r?\n)+$/.test(n.textContent||"")}function Zl(n,e){return 16&e?"code":e&Tc?"mark":32&e?"sub":64&e?"sup":null}function Xl(n,e){return 1&e?"strong":2&e?"em":"span"}function dg(n,e,t,r,i){const s=r.classList;let o=Yr(i,"base");o!==void 0&&s.add(...o),o=Yr(i,"underlineStrikethrough");let l=!1;const a=8&e&&4&e;o!==void 0&&(8&t&&4&t?(l=!0,a||s.add(...o)):a&&s.remove(...o));for(const c in Ue){const u=Ue[c];if(o=Yr(i,c),o!==void 0)if(t&u){if(l&&(c==="underline"||c==="strikethrough")){e&u&&s.remove(...o);continue}((e&u)===0||a&&c==="underline"||c==="strikethrough")&&s.add(...o)}else e&u&&s.remove(...o)}}function fg(n,e,t){const r=e.firstChild,i=t.isComposing(),s=n+(i?Jo:"");if(r==null)e.textContent=s;else{const o=r.nodeValue;if(o!==s)if(i||Ln){const[l,a,c]=(function(u,d){const f=u.length,h=d.length;let g=0,p=0;for(;g<f&&g<h&&u[g]===d[g];)g++;for(;p+g<f&&p+g<h&&u[f-p-1]===d[h-p-1];)p++;return[g,f-g-p,d.slice(g,h-p)]})(o,s);a!==0&&r.deleteData(l,a),r.insertData(l,c)}else r.nodeValue=s}}function pd(n,e,t,r,i,s){fg(i,n,e);const o=s.theme.text;o!==void 0&&dg(0,0,r,n,o)}function Ds(n,e){const t=document.createElement(e);return t.appendChild(n),t}class Qe extends jt{__text;__format;__style;__mode;__detail;static getType(){return"text"}static clone(e){return new Qe(e.__text,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e="",t){super(t),this.__text=e,this.__format=0,this.__style="",this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const e=this.getLatest();return iy[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===An()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){const t=Ue[e];return(this.getFormat()&t)!==0}isSimpleText(){return this.__type==="text"&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return vo(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){const r=this.__format,i=Zl(0,r),s=Xl(0,r),o=i===null?s:i,l=document.createElement(o);let a=l;this.hasFormat("code")&&l.setAttribute("spellcheck","false"),i!==null&&(a=document.createElement(s),l.appendChild(a)),pd(a,this,0,r,this.__text,e);const c=this.__style;return c!==""&&(l.style.cssText=c),l}updateDOM(e,t,r){const i=this.__text,s=e.__format,o=this.__format,l=Zl(0,s),a=Zl(0,o),c=Xl(0,s),u=Xl(0,o);if((l===null?c:l)!==(a===null?u:a))return!0;if(l===a&&c!==u){const p=t.firstChild;p==null&&R(48);const m=document.createElement(u);return pd(m,this,0,o,i,r),t.replaceChild(m,p),!1}let d=t;a!==null&&l!==null&&(d=t.firstChild,d==null&&R(49)),fg(i,d,this);const f=r.theme.text;f!==void 0&&s!==o&&dg(0,s,o,d,f);const h=e.__style,g=this.__style;return h!==g&&(t.style.cssText=g),!1}static importDOM(){return{"#text":()=>({conversion:Ay,priority:0}),b:()=>({conversion:Ty,priority:0}),code:()=>({conversion:tn,priority:0}),em:()=>({conversion:tn,priority:0}),i:()=>({conversion:tn,priority:0}),mark:()=>({conversion:tn,priority:0}),s:()=>({conversion:tn,priority:0}),span:()=>({conversion:ky,priority:0}),strong:()=>({conversion:tn,priority:0}),sub:()=>({conversion:tn,priority:0}),sup:()=>({conversion:tn,priority:0}),u:()=>({conversion:tn,priority:0})}}static importJSON(e){return he().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return ne(t)||R(132),t.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?t.style.textTransform="lowercase":this.hasFormat("uppercase")?t.style.textTransform="uppercase":this.hasFormat("capitalize")&&(t.style.textTransform="capitalize"),this.hasFormat("bold")&&(t=Ds(t,"b")),this.hasFormat("italic")&&(t=Ds(t,"i")),this.hasFormat("strikethrough")&&(t=Ds(t,"s")),this.hasFormat("underline")&&(t=Ds(t,"u")),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format=typeof e=="string"?Ue[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail=typeof e=="string"?ty[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=vo(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=ry[e];if(this.__mode===t)return this;const r=this.getWritable();return r.__mode=t,r}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){$e();let r=e,i=t;const s=M(),o=this.getTextContent(),l=this.__key;if(typeof o=="string"){const a=o.length;r===void 0&&(r=a),i===void 0&&(i=a)}else r=0,i=0;if(!N(s))return pg(l,r,l,i,"text","text");{const a=An();a!==s.anchor.key&&a!==s.focus.key||Fe(l),s.setTextNodeRange(this,r,this,i)}return s}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,r,i){const s=this.getWritable(),o=s.__text,l=r.length;let a=e;a<0&&(a=l+a,a<0&&(a=0));const c=M();if(i&&N(c)){const d=e+l;c.setTextNodeRange(s,d,s,d)}const u=o.slice(0,a)+r+o.slice(a+t);return s.__text=u,s}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){$e();const t=this.getLatest(),r=t.getTextContent();if(r==="")return[];const i=t.__key,s=An(),o=r.length;e.sort((T,E)=>T-E),e.push(o);const l=[],a=e.length;for(let T=0,E=0;T<o&&E<=a;E++){const I=e[E];I>T&&(l.push(r.slice(T,I)),T=I)}const c=l.length;if(c===1)return[t];const u=l[0],d=t.getParent();let f;const h=t.getFormat(),g=t.getStyle(),p=t.__detail;let m=!1,b=null,_=null;const y=M();if(N(y)){const[T,E]=y.isBackward()?[y.focus,y.anchor]:[y.anchor,y.focus];T.type==="text"&&T.key===i&&(b=T),E.type==="text"&&E.key===i&&(_=E)}t.isSegmented()?(f=he(u),f.__format=h,f.__style=g,f.__detail=p,f.__state=id(t,f),m=!0):f=t.setTextContent(u);const C=[f];for(let T=1;T<c;T++){const E=he(l[T]);E.__format=h,E.__style=g,E.__detail=p,E.__state=id(t,E);const I=E.__key;s===i&&Fe(I),C.push(E)}const S=b?b.offset:null,w=_?_.offset:null;let x=0;for(const T of C){if(!b&&!_)break;const E=x+T.getTextContentSize();if(b!==null&&S!==null&&S<=E&&S>=x&&(b.set(T.getKey(),S-x,"text"),S<E&&(b=null)),_!==null&&w!==null&&w<=E&&w>=x){_.set(T.getKey(),w-x,"text");break}x=E}if(d!==null){(function(I){const $=I.getPreviousSibling(),k=I.getNextSibling();$!==null&&Eo($),k!==null&&Eo(k)})(this);const T=d.getWritable(),E=this.getIndexWithinParent();m?(T.splice(E,0,C),this.remove()):T.splice(E,1,C),N(y)&&Co(y,d,E,c-1)}return C}mergeWithSibling(e){const t=e===this.getPreviousSibling();t||e===this.getNextSibling()||R(50);const r=this.__key,i=e.__key,s=this.__text,o=s.length;An()===i&&Fe(r);const l=M();if(N(l)){const d=l.anchor,f=l.focus;d!==null&&d.key===i&&Ed(d,t,r,e,o),f!==null&&f.key===i&&Ed(f,t,r,e,o)}const a=e.__text,c=t?a+s:s+a;this.setTextContent(c);const u=this.getWritable();return e.remove(),u}isTextEntity(){return!1}}function ky(n){return{forChild:Uc(n.style),node:null}}function Ty(n){const e=n,t=e.style.fontWeight==="normal";return{forChild:Uc(e.style,t?void 0:"bold"),node:null}}const md=new WeakMap;function Ny(n){if(!ne(n))return!1;if(n.nodeName==="PRE")return!0;const e=n.style.whiteSpace;return typeof e=="string"&&e.startsWith("pre")}function Ay(n){const e=n;n.parentElement===null&&R(129);let t=e.textContent||"";if((function(r){let i,s=r.parentNode;const o=[r];for(;s!==null&&(i=md.get(s))===void 0&&!Ny(s);)o.push(s),s=s.parentNode;const l=i===void 0?s:i;for(let a=0;a<o.length;a++)md.set(o[a],l);return l})(e)!==null){const r=t.split(/(\r?\n|\t)/),i=[],s=r.length;for(let o=0;o<s;o++){const l=r[o];l===`
|
|
7
7
|
`||l===`\r
|
|
8
|
-
`?i.push(
|
|
9
|
-
`),u=!f.isEmpty();else if(u=!1,
|
|
8
|
+
`?i.push(ut()):l===" "?i.push(Ct()):l!==""&&i.push(he(l))}return{node:i}}if(t=t.replace(/\r/g,"").replace(/[ \t\n]+/g," "),t==="")return{node:null};if(t[0]===" "){let r=e,i=!0;for(;r!==null&&(r=_d(r,!1))!==null;){const s=r.textContent||"";if(s.length>0){/[ \t\n]$/.test(s)&&(t=t.slice(1)),i=!1;break}}i&&(t=t.slice(1))}if(t[t.length-1]===" "){let r=e,i=!0;for(;r!==null&&(r=_d(r,!0))!==null;)if((r.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){i=!1;break}i&&(t=t.slice(0,t.length-1))}return t===""?{node:null}:{node:he(t)}}function _d(n,e){let t=n;for(;;){let r;for(;(r=e?t.nextSibling:t.previousSibling)===null;){const s=t.parentElement;if(s===null)return null;t=s}if(t=r,ne(t)){const s=t.style.display;if(s===""&&!Ao(t)||s!==""&&!s.startsWith("inline"))return null}let i=t;for(;(i=e?t.firstChild:t.lastChild)!==null;)t=i;if(Xt(t))return t;if(t.nodeName==="BR")return null}}const Oy={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function tn(n){const e=Oy[n.nodeName.toLowerCase()];return e===void 0?{node:null}:{forChild:Uc(n.style,e),node:null}}function he(n=""){return ze(new Qe(n))}function L(n){return n instanceof Qe}function Uc(n,e){const t=n.fontWeight,r=n.textDecoration.split(" "),i=t==="700"||t==="bold",s=r.includes("line-through"),o=n.fontStyle==="italic",l=r.includes("underline"),a=n.verticalAlign;return c=>(L(c)&&(i&&!c.hasFormat("bold")&&c.toggleFormat("bold"),s&&!c.hasFormat("strikethrough")&&c.toggleFormat("strikethrough"),o&&!c.hasFormat("italic")&&c.toggleFormat("italic"),l&&!c.hasFormat("underline")&&c.toggleFormat("underline"),a!=="sub"||c.hasFormat("subscript")||c.toggleFormat("subscript"),a!=="super"||c.hasFormat("superscript")||c.toggleFormat("superscript"),e&&!c.hasFormat(e)&&c.toggleFormat(e)),c)}class vr extends Qe{static getType(){return"tab"}static clone(e){return new vr(e.__key)}constructor(e){super(" ",e),this.__detail=2}static importDOM(){return null}createDOM(e){const t=super.createDOM(e),r=Yr(e.theme,"tab");return r!==void 0&&t.classList.add(...r),t}static importJSON(e){return Ct().updateFromJSON(e)}setTextContent(e){return e!==" "&&e!==""&&Fh(126),super.setTextContent(" ")}spliceText(e,t,r,i){return r===""&&t===0||r===" "&&t===1||R(286),this}setDetail(e){return e!==2&&R(127),this}setMode(e){return e!=="normal"&&R(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function Ct(){return ze(new vr)}function Ye(n){return n instanceof vr}class My{key;offset;type;_selection;constructor(e,t,r){this._selection=null,this.key=e,this.offset=t,this.type=r}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:uu(it(Dt(this,"next")),it(Dt(e,"next")))<0}getNode(){const e=Q(this.key);return e===null&&R(20),e}set(e,t,r,i){const s=this._selection,o=this.key;i&&this.key===e&&this.offset===t&&this.type===r||(this.key=e,this.offset=t,this.type=r,kr()||(An()===o&&Fe(e),s!==null&&(s.setCachedNodes(null),s.dirty=!0)))}}function Me(n,e,t){return new My(n,e,t)}function Ql(n,e){let t=e.__key,r=n.offset,i="element";if(L(e)){i="text";const s=e.getTextContentSize();r>s&&(r=s)}else if(!O(e)){const s=e.getNextSibling();if(L(s))t=s.__key,r=0,i="text";else{const o=e.getParent();o&&(t=o.__key,r=e.getIndexWithinParent()+1)}}n.set(t,r,i)}function yd(n,e){if(O(e)){const t=e.getLastDescendant();O(t)||L(t)?Ql(n,t):Ql(n,e)}else Ql(n,e)}class nl{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Ge(e))return!1;const t=this._nodes,r=e._nodes;return t.size===r.size&&Array.from(t).every(i=>r.has(i))}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 nl(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),r=t.length,i=t[r-1];let s;if(L(i))s=i.select();else{const o=i.getIndexWithinParent()+1;s=i.getParentOrThrow().select(o,o)}s.insertNodes(e);for(let o=0;o<r;o++)t[o].remove()}getNodes(){const e=this._cachedNodes;if(e!==null)return e;const t=this._nodes,r=[];for(const i of t){const s=Q(i);s!==null&&r.push(s)}return kr()||(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();if((M()||Sn())===this&&e[0]){const t=be(e[0],"next");ml(qt(t,t))}for(const t of e)t.remove()}}function N(n){return n instanceof Er}class Er{format;style;anchor;focus;_cachedNodes;dirty;constructor(e,t,r,i){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=r,this.style=i,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!N(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 i=[],[s,o]=r.getTextSlices();s&&i.push(s.caret.origin);const l=new Set,a=new Set;for(const c of r)if(gt(c)){const{origin:u}=c;i.length===0?l.add(u):(a.add(u),i.push(u))}else{const{origin:u}=c;O(u)&&a.has(u)||i.push(u)}if(o&&i.push(o.caret.origin),zn(r.focus)&&O(r.focus.origin)&&r.focus.getNodeAtCaret()===null)for(let c=dt(r.focus.origin,"previous");gt(c)&&l.has(c.origin)&&!c.origin.isEmpty()&&c.origin.is(i[i.length-1]);c=yr(c))l.delete(c.origin),i.pop();for(;i.length>1;){const c=i[i.length-1];if(!O(c)||a.has(c)||c.isEmpty()||l.has(c))break;i.pop()}if(i.length===0&&r.isCollapsed()){const c=it(r.anchor),u=it(r.anchor.getFlipped()),d=h=>$t(h)?h.origin:h.getNodeAtCaret(),f=d(c)||d(u)||(r.anchor.getNodeAtCaret()?c.origin:u.origin);i.push(f)}return i})(_l(Oo(this),"next"));return kr()||(this._cachedNodes=t),t}setTextNodeRange(e,t,r,i){this.anchor.set(e.__key,t,"text"),this.focus.set(r.__key,i,"text")}getTextContent(){const e=this.getNodes();if(e.length===0)return"";const t=e[0],r=e[e.length-1],i=this.anchor,s=this.focus,o=i.isBefore(s),[l,a]=xo(this);let c="",u=!0;for(let d=0;d<e.length;d++){const f=e[d];if(O(f)&&!f.isInline())u||(c+=`
|
|
9
|
+
`),u=!f.isEmpty();else if(u=!1,L(f)){let h=f.getTextContent();f===t?f===r?i.type==="element"&&s.type==="element"&&s.offset!==i.offset||(h=l<a?h.slice(l,a):h.slice(a,l)):h=o?h.slice(l):h.slice(a):f===r&&(h=o?h.slice(0,a):h.slice(0,l)),c+=h}else!Z(f)&&!ue(f)||f===r&&this.isCollapsed()||(c+=f.getTextContent())}return c}applyDOMRange(e){const t=se(),r=t.getEditorState()._selection,i=gg(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,r);if(i===null)return;const[s,o]=i;this.anchor.set(s.key,s.offset,s.type,!0),this.focus.set(o.key,o.offset,o.type,!0),Rn(this)}clone(){const e=this.anchor,t=this.focus;return new Er(Me(e.key,e.offset,e.type),Me(t.key,t.offset,t.type),this.format,this.style)}toggleFormat(e){this.format=vo(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=Ue[e];return(this.format&t)!==0}insertRawText(e){const t=e.split(/(\r?\n|\t)/),r=[],i=t.length;for(let s=0;s<i;s++){const o=t[s];o===`
|
|
10
10
|
`||o===`\r
|
|
11
|
-
`?r.push(ot()):o===" "?r.push(yt()):r.push(he(o))}this.insertNodes(r)}insertText(e){const t=this.anchor,r=this.focus,i=this.format,s=this.style;let o=t,l=r;!this.isCollapsed()&&r.isBefore(t)&&(o=r,l=t),o.type==="element"&&(function(m,b,_,y){const C=m.getNode(),S=C.getChildAtIndex(m.offset),w=he();if(w.setFormat(_),w.setStyle(y),wr(S))S.splice(0,0,[w]);else{const x=ye(C)?J().append(w):w;S===null?C.append(x):S.insertBefore(x)}m.is(b)&&b.set(w.__key,0,"text"),m.set(w.__key,0,"text")})(o,l,i,s),l.type==="element"&&Rn(l,et($t(l,"next")));const a=o.offset;let c=l.offset;const u=this.getNodes(),d=u.length;let f=u[0];R(f)||D(26);const h=f.getTextContent().length,g=f.getParentOrThrow();let p=u[d-1];if(d===1&&l.type==="element"&&(c=h,l.set(o.key,c,"text")),this.isCollapsed()&&a===h&&(Et(f)||!f.canInsertTextAfter()||!g.canInsertTextAfter()&&f.getNextSibling()===null)){let m=f.getNextSibling();if(R(m)&&m.canInsertTextBefore()&&!Et(m)||(m=he(),m.setFormat(i),m.setStyle(s),g.canInsertTextAfter()?f.insertAfter(m):g.insertAfter(m)),m.select(0,0),f=m,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&a===0&&(Et(f)||!f.canInsertTextBefore()||!g.canInsertTextBefore()&&f.getPreviousSibling()===null)){let m=f.getPreviousSibling();if(R(m)&&!Et(m)||(m=he(),m.setFormat(i),g.canInsertTextBefore()?f.insertBefore(m):g.insertBefore(m)),m.select(),f=m,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&a!==h){const m=he(f.getTextContent());m.setFormat(i),f.replace(m),f=m}else if(!this.isCollapsed()&&e!==""){const m=p.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||A(m)&&(!m.canInsertTextBefore()||!m.canInsertTextAfter()))return this.insertText(""),ug(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if(Nn(f)){const y=he(e);return y.select(),void f.replace(y)}const m=f.getFormat(),b=f.getStyle();if(a!==c||m===i&&b===s){if(Je(f)){const y=he(e);return y.setFormat(i),y.setStyle(s),y.select(),void f.replace(y)}}else{if(f.getTextContent()!==""){const y=he(e);if(y.setFormat(i),y.setStyle(s),y.select(),a===0)f.insertBefore(y,!1);else{const[C]=f.splitText(a);C.insertAfter(y,!1)}return void(y.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(i),f.setStyle(s)}const _=c-a;f=f.spliceText(a,_,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=m,this.style=b))}else{const m=new Set([...f.getParentKeys(),...p.getParentKeys()]),b=A(f)?f:f.getParentOrThrow();let _=A(p)?p:p.getParentOrThrow(),y=p;if(!b.is(_)&&_.isInline())do y=_,_=_.getParentOrThrow();while(_.isInline());if(l.type==="text"&&(c!==0||p.getTextContent()==="")||l.type==="element"&&p.getIndexWithinParent()<c)if(R(p)&&!Nn(p)&&c!==p.getTextContentSize()){if(p.isSegmented()){const T=he(p.getTextContent());p.replace(T),p=T}ye(l.getNode())||l.type!=="text"||(p=p.spliceText(0,c,"")),m.add(p.__key)}else{const T=p.getParentOrThrow();T.canBeEmpty()||T.getChildrenSize()!==1?p.remove():T.remove()}else m.add(p.__key);const C=_.getChildren(),S=new Set(u),w=b.is(_),x=b.isInline()&&f.getNextSibling()===null?b:f;for(let T=C.length-1;T>=0;T--){const v=C[T];if(v.is(f)||A(v)&&v.isParentOf(f))break;v.isAttached()&&(!S.has(v)||v.is(y)?w||x.insertAfter(v,!1):v.remove())}if(!w){let T=_,v=null;for(;T!==null;){const O=T.getChildren(),I=O.length;(I===0||O[I-1].is(v))&&(m.delete(T.__key),v=T),T=T.getParent()}}if(Nn(f))if(a===h)f.select();else{const T=he(e);T.select(),f.replace(T)}else f=f.spliceText(a,h-a,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=f.getFormat(),this.style=f.getStyle()));for(let T=1;T<d;T++){const v=u[T],O=v.__key;m.has(O)||v.remove()}}}removeText(){const e=M()===this;Bi(this,Gg(vo(this))),e&&M()!==this&&Re(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void Ie(null);const r=this.getNodes(),i=[];for(const C of r)R(C)&&i.push(C);const s=C=>{r.forEach(S=>{if(A(S)){const w=S.getFormatFlags(e,C);S.setTextFormat(w)}})},o=i.length;if(o===0)return this.toggleFormat(e),Ie(null),void s(t);const l=this.anchor,a=this.focus,c=this.isBackward(),u=c?a:l,d=c?l:a;let f=0,h=i[0],g=u.type==="element"?0:u.offset;if(u.type==="text"&&g===h.getTextContentSize()&&(f=1,h=i[1],g=0),h==null)return;const p=h.getFormatFlags(e,t);s(p);const m=o-1;let b=i[m];const _=d.type==="text"?d.offset:b.getTextContentSize();if(h.is(b)){if(g===_)return;if(Et(h)||g===0&&_===h.getTextContentSize())h.setFormat(p);else{const C=h.splitText(g,_),S=g===0?C[0]:C[1];S.setFormat(p),u.type==="text"&&u.set(S.__key,0,"text"),d.type==="text"&&d.set(S.__key,_-g,"text")}return void(this.format=p)}g===0||Et(h)||([,h]=h.splitText(g),g=0),h.setFormat(p);const y=b.getFormatFlags(e,p);_>0&&(_===b.getTextContentSize()||Et(b)||([b]=b.splitText(_)),b.setFormat(y));for(let C=f+1;C<m;C++){const S=i[C],w=S.getFormatFlags(e,y);S.setFormat(w)}u.type==="text"&&u.set(h.__key,g,"text"),d.type==="text"&&d.set(b.__key,_,"text"),this.format=p|y}insertNodes(e){if(e.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();const g=M();return N(g)||D(134),g.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),r=le(t,ct),i=e[e.length-1];if(A(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const g=ql(this);r.splice(g,0,e),i.selectEnd()}return}if(!e.some(g=>(A(g)||Z(g))&&!g.isInline())){A(r)||D(211,t.constructor.name,t.getType());const g=ql(this);return r.splice(g,0,e),void i.selectEnd()}const s=(function(g){const p=J();let m=null;for(let b=0;b<g.length;b++){const _=g[b],y=ue(_);if(y||Z(_)&&_.isInline()||A(_)&&_.isInline()||R(_)||_.isParentRequired()){if(m===null&&(m=_.createParentElementNode(),p.append(m),y))continue;m!==null&&m.append(_)}else p.append(_),m=null}return p})(e),o=s.getLastDescendant(),l=s.getChildren(),a=!A(r)||!r.isEmpty()?this.insertParagraph():null,c=l[l.length-1];let u=l[0];var d;A(d=u)&&ct(d)&&!d.isEmpty()&&A(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(A(r)||D(211,t.constructor.name,t.getType()),r.append(...u.getChildren()),u=l[1]),u&&(r===null&&D(212,t.constructor.name,t.getType()),(function(g,p){const m=p.getParentOrThrow().getLastChild();let b=p;const _=[p];for(;b!==m;)b.getNextSibling()||D(140),b=b.getNextSibling(),_.push(b);let y=g;for(const C of _)y=y.insertAfter(C)})(r,u));const f=le(o,ct);a&&A(f)&&(a.canMergeWhenEmpty()||ct(c))&&(f.append(...a.getChildren()),a.remove()),A(r)&&r.isEmpty()&&r.remove(),o.selectEnd();const h=A(r)?r.getLastChild():null;ue(h)&&f!==r&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const o=J();return de().splice(this.anchor.offset,0,[o]),o.select(),o}const e=ql(this),t=le(this.anchor.getNode(),ct);A(t)||D(213);const r=t.getChildAtIndex(e),i=r?[r,...r.getNextSiblings()]:[],s=t.insertNewAfter(this,!1);return s?(s.append(...i),s.selectStart(),s):null}insertLineBreak(e){const t=ot();if(this.insertNodes([t]),e){const r=t.getParentOrThrow(),i=t.getIndexWithinParent();r.select(i,i)}}extract(){const e=[...this.getNodes()],t=e.length;let r=e[0],i=e[t-1];const[s,o]=go(this),l=this.isBackward(),[a,c]=l?[this.focus,this.anchor]:[this.anchor,this.focus],[u,d]=l?[o,s]:[s,o];if(t===0)return[];if(t===1){if(R(r)&&!this.isCollapsed()){const f=r.splitText(u,d),h=u===0?f[0]:f[1];return h?(a.set(h.getKey(),0,"text"),c.set(h.getKey(),h.getTextContentSize(),"text"),[h]):[]}return[r]}if(R(r)&&(u===r.getTextContentSize()?e.shift():u!==0&&([,r]=r.splitText(u),e[0]=r,a.set(r.getKey(),0,"text"))),R(i)){const f=i.getTextContent().length;d===0?e.pop():d!==f&&([i]=i.splitText(d),e[e.length-1]=i,c.set(i.getKey(),i.getTextContentSize(),"text"))}return e}modify(e,t,r){if(Cd(this,e,t,r))return;const i=e==="move",s=se(),o=Ct(St(s));if(!o)return;const l=s._blockCursorElement,a=s._rootElement,c=this.focus.getNode();if(a===null||l===null||!A(c)||c.isInline()||c.canBeEmpty()||Ha(l,s,a),this.dirty){let u=ur(s,this.anchor.key),d=ur(s,this.focus.key);this.anchor.type==="text"&&(u=cr(u)),this.focus.type==="text"&&(d=cr(d)),u&&d&&hg(o,u,this.anchor.offset,d,this.focus.offset)}if((function(u,d,f,h){u.modify(d,f,h)})(o,e,t?"backward":"forward",r),o.rangeCount>0){const u=o.getRangeAt(0),d=this.anchor.getNode(),f=ye(d)?d:zg(d);if(this.applyDOMRange(u),this.dirty=!0,!i){const h=this.getNodes(),g=[];let p=!1;for(let m=0;m<h.length;m++){const b=h[m];So(b,f)?g.push(b):p=!0}if(p&&g.length>0)if(t){const m=g[0];A(m)?m.selectStart():m.getParentOrThrow().selectStart()}else{const m=g[g.length-1];A(m)?m.selectEnd():m.getParentOrThrow().selectEnd()}o.anchorNode===u.startContainer&&o.anchorOffset===u.startOffset||(function(m){const b=m.focus,_=m.anchor,y=_.key,C=_.offset,S=_.type;_.set(b.key,b.offset,b.type,!0),b.set(y,C,S,!0)})(this)}}r==="lineboundary"&&Cd(this,e,t,r,"decorators")}forwardDeletion(e,t,r){if(!r&&(e.type==="element"&&A(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const i=t.getParent(),s=t.getNextSibling()||(i===null?null:i.getNextSibling());if(A(s)&&s.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let i=r.getNode();if(this.forwardDeletion(r,i,e))return;const s=al($t(r,e?"previous":"next"));if(s.getTextSlices().every(l=>l===null||l.distance===0)){let l={type:"initial"};for(const a of s.iterNodeCarets("shadowRoot"))if(ut(a)){if(!a.origin.isInline()){if(a.origin.isShadowRoot()){if(l.type==="merge-block")break;if(A(s.anchor.origin)&&s.anchor.origin.isEmpty()){const c=et(a);Bi(this,Gt(c,c)),s.anchor.origin.remove()}return}l.type!=="merge-next-block"&&l.type!=="merge-block"||(l={block:l.block,caret:a,type:"merge-block"})}}else{if(l.type==="merge-block")break;if(Fn(a)){if(A(a.origin)){if(a.origin.isInline()){if(!a.origin.isParentOf(s.anchor.origin))break}else l={block:a.origin,type:"merge-next-block"};continue}if(Z(a.origin)){if(!a.origin.isIsolated())if(l.type==="merge-next-block"&&(a.origin.isKeyboardSelectable()||!a.origin.isInline())&&A(s.anchor.origin)&&s.anchor.origin.isEmpty()){s.anchor.origin.remove();const c=Lc();c.add(a.origin.getKey()),Re(c)}else a.origin.remove();return}break}}if(l.type==="merge-block"){const{caret:a,block:c}=l;return Bi(this,Gt(!a.origin.isEmpty()&&c.isEmpty()?hi(xe(c,a.direction)):s.anchor,a)),this.removeText()}}const o=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&r.offset===0&&md(this,r.getNode()))return}else{const l=o.type==="text"?o.getNode():null;if(i=r.type==="text"?r.getNode():null,l!==null&&l.isSegmented()){const a=o.offset,c=l.getTextContentSize();if(l.is(i)||e&&a!==c||!e&&a!==0)return void _d(l,e,a)}else if(i!==null&&i.isSegmented()){const a=r.offset,c=i.getTextContentSize();if(i.is(l)||e&&a!==0||!e&&a!==c)return void _d(i,e,a)}(function(a,c){const u=a.anchor,d=a.focus,f=u.getNode(),h=d.getNode();if(f===h&&u.type==="text"&&d.type==="text"){const g=u.offset,p=d.offset,m=g<p,b=m?g:p,_=m?p:g,y=_-1;b!==y&&(function(C){return!(Mg(C)||Oy(C))})(f.getTextContent().slice(b,_))&&(c?d.set(d.key,y,d.type):u.set(u.key,y,u.type))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&ye(r.getParent())&&r.getPreviousSibling()===null&&md(this,r)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,r=t.getNode();if(this.forwardDeletion(t,r,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function je(n){return n instanceof qo}function pd(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function go(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]:[pd(t),pd(r)]}function md(n,e){for(let t=e;t;t=t.getParent()){if(A(t)){if(t.collapseAtStart(n))return!0;if(Ue(t))break}if(t.getPreviousSibling())break}return!1}const Oy=(()=>{try{const n=new RegExp("\\p{Emoji}","u"),e=n.test.bind(n);if(e("❤️")&&e("#️⃣")&&e("👍"))return e}catch{}return()=>!1})();function _d(n,e,t){const r=n,i=r.getTextContent().split(/(?=\s)/g),s=i.length;let o=0,l=0;for(let c=0;c<s;c++){const u=c===s-1;if(l=o,o+=i[c].length,e&&o===t||o>t||u){i.splice(c,1),u&&(l=void 0);break}}const a=i.join("").trim();a===""?r.remove():(r.setTextContent(a),r.select(l,l))}function yd(n,e,t,r){let i,s=e;if(ne(n)){let o=!1;const l=n.childNodes,a=l.length,c=r._blockCursorElement;s===a&&(o=!0,s=a-1);let u=l[s],d=!1;if(u===c)u=l[s+1],d=!0;else if(c!==null){const f=c.parentNode;n===f&&e>Array.prototype.indexOf.call(f.children,c)&&s--}if(i=Ur(u),R(i))s=Ot(i,o?"next":"previous");else{let f=Ur(n);if(f===null)return null;if(A(f)){const h=r.getElementByKey(f.getKey());h===null&&D(214),[f,s]=f.getDOMSlot(h).resolveChildIndex(f,h,n,e),A(f)||D(215),o&&s>=f.getChildrenSize()&&(s=Math.max(0,f.getChildrenSize()-1));let p=f.getChildAtIndex(s);if(A(p)&&(function(m,b,_){const y=m.getParent();return _===null||y===null||!y.canBeEmpty()||y!==_.getNode()})(p,0,t)){const m=o?p.getLastDescendant():p.getFirstDescendant();m===null?f=p:(p=m,f=A(p)?p:p.getParentOrThrow()),s=0}R(p)?(i=p,f=null,s=Ot(p,o?"next":"previous")):p!==f&&o&&!d&&(A(f)||D(216),s=Math.min(f.getChildrenSize(),s+1))}else{const h=f.getIndexWithinParent();s=e===0&&Z(f)&&Ur(n)===f?h:h+1,f=f.getParentOrThrow()}if(A(f))return Ae(f.__key,s,"element")}}else i=Ur(n);return R(i)?Ae(i.__key,Ot(i,s,"clamp"),"text"):null}function bd(n,e,t){const r=n.offset,i=n.getNode();if(r===0){const s=i.getPreviousSibling(),o=i.getParent();if(e){if((t||!e)&&s===null&&A(o)&&o.isInline()){const l=o.getPreviousSibling();R(l)&&n.set(l.__key,l.getTextContent().length,"text")}}else A(s)&&!t&&s.isInline()?n.set(s.__key,s.getChildrenSize(),"element"):R(s)&&n.set(s.__key,s.getTextContent().length,"text")}else if(r===i.getTextContent().length){const s=i.getNextSibling(),o=i.getParent();if(e&&A(s)&&s.isInline())n.set(s.__key,0,"element");else if((t||e)&&s===null&&A(o)&&o.isInline()&&!o.canInsertTextAfter()){const l=o.getNextSibling();R(l)&&n.set(l.__key,0,"text")}}}function ug(n,e,t){if(n.type==="text"&&e.type==="text"){const r=n.isBefore(e),i=n.is(e);bd(n,r,i),bd(e,!r,i),i&&e.set(n.key,n.offset,n.type);const s=se();if(s.isComposing()&&s._compositionKey!==n.key&&N(t)){const o=t.anchor,l=t.focus;n.set(o.key,o.offset,o.type,!0),e.set(l.key,l.offset,l.type,!0)}}}function dg(n,e,t,r,i,s){if(n===null||t===null||!di(i,n,t))return null;const o=yd(n,e,N(s)?s.anchor:null,i);if(o===null)return null;const l=yd(t,r,N(s)?s.focus:null,i);if(l===null)return null;if(o.type==="element"&&l.type==="element"){const a=Ur(n),c=Ur(t);if(Z(a)&&Z(c))return null}return ug(o,l,s),[o,l]}function po(n){return A(n)&&!n.isInline()}function fg(n,e,t,r,i,s){const o=yn(),l=new xr(Ae(n,e,i),Ae(t,r,s),0,"");return l.dirty=!0,o._selection=l,l}function ci(){const n=Ae("root",0,"element"),e=Ae("root",0,"element");return new xr(n,e,0,"")}function Lc(){return new qo(new Set)}function My(n,e){return Zo(null,n,e,null)}function Zo(n,e,t,r){const i=t._window;if(i===null)return null;const s=r||i.event,o=s?s.type:void 0,l=o==="selectionchange",a=!Na&&(l||o==="beforeinput"||o==="compositionstart"||o==="compositionend"||o==="click"&&s&&s.detail===3||o==="drop"||o===void 0);let c,u,d,f;if(N(n)&&!a)return n.clone();if(e===null)return null;if(c=e.anchorNode,u=e.focusNode,d=e.anchorOffset,f=e.focusOffset,(l||o===void 0)&&N(n)&&!di(t,c,u))return n.clone();const h=dg(c,d,u,f,t,n);if(h===null)return null;const[g,p]=h;return new xr(g,p,N(n)?n.format:0,N(n)?n.style:"")}function M(){return yn()._selection}function _n(){return se()._editorState._selection}function mo(n,e,t,r=1){const i=n.anchor,s=n.focus,o=i.getNode(),l=s.getNode();if(!e.is(o)&&!e.is(l))return;const a=e.__key;if(n.isCollapsed()){const c=i.offset;if(t<=c&&r>0||t<c&&r<0){const u=Math.max(0,c+r);i.set(a,u,"element"),s.set(a,u,"element"),xd(n)}}else{const c=n.isBackward(),u=c?s:i,d=u.getNode(),f=c?i:s,h=f.getNode();if(e.is(d)){const g=u.offset;(t<=g&&r>0||t<g&&r<0)&&u.set(a,Math.max(0,g+r),"element")}if(e.is(h)){const g=f.offset;(t<=g&&r>0||t<g&&r<0)&&f.set(a,Math.max(0,g+r),"element")}}xd(n)}function xd(n){const e=n.anchor,t=e.offset,r=n.focus,i=r.offset,s=e.getNode(),o=r.getNode();if(n.isCollapsed()){if(!A(s))return;const l=s.getChildrenSize(),a=t>=l,c=a?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(R(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text"),r.set(c.__key,u,"text")}return}if(A(s)){const l=s.getChildrenSize(),a=t>=l,c=a?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(R(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text")}}if(A(o)){const l=o.getChildrenSize(),a=i>=l,c=a?o.getChildAtIndex(l-1):o.getChildAtIndex(i);if(R(c)){let u=0;a&&(u=c.getTextContentSize()),r.set(c.__key,u,"text")}}}function _o(n,e,t,r,i){let s=null,o=0,l=null;r!==null?(s=r.__key,R(r)?(o=r.getTextContentSize(),l="text"):A(r)&&(o=r.getChildrenSize(),l="element")):i!==null&&(s=i.__key,R(i)?l="text":A(i)&&(l="element")),s!==null&&l!==null?n.set(s,o,l):(o=e.getIndexWithinParent(),o===-1&&(o=t.getChildrenSize()),n.set(t.__key,o,"element"))}function Sd(n,e,t,r,i){n.type==="text"?n.set(t,n.offset+(e?0:i),"text"):n.offset>r.getIndexWithinParent()&&n.set(n.key,n.offset-1,"element")}function hg(n,e,t,r,i){try{n.setBaseAndExtent(e,t,r,i)}catch{}}function Iy(n,e,t,r,i,s,o){const l=r.anchorNode,a=r.focusNode,c=r.anchorOffset,u=r.focusOffset,d=document.activeElement;if(i.has(sg)&&d!==s||d!==null&&nl(d))return;if(!N(e))return void(n!==null&&di(t,l,a)&&r.removeAllRanges());const f=e.anchor,h=e.focus,g=f.key,p=h.key,m=ur(t,g),b=ur(t,p),_=f.offset,y=h.offset,C=e.format,S=e.style,w=e.isCollapsed();let x=m,T=b,v=!1;if(f.type==="text"){x=cr(m);const F=f.getNode();v=F.getFormat()!==C||F.getStyle()!==S}else N(n)&&n.anchor.type==="text"&&(v=!0);var O,I,k,L,K;if(h.type==="text"&&(T=cr(b)),x!==null&&T!==null&&(w&&(n===null||v||N(n)&&(n.format!==C||n.style!==S))&&(O=C,I=S,k=_,L=g,K=performance.now(),Zh=[O,I,k,L,K]),c!==_||u!==y||l!==x||a!==T||r.type==="Range"&&w||(d!==null&&s.contains(d)||i.has(Wa)||s.focus({preventScroll:!0}),f.type==="element"))){if(hg(r,x,_,T,y),!On||!e.isCollapsed()||s===null||i.has(Wa)||document.activeElement!==null&&s.contains(document.activeElement)||s.focus({preventScroll:!0}),!i.has(og)&&e.isCollapsed()&&s!==null&&s===document.activeElement){const F=N(e)&&e.anchor.type==="element"?x.childNodes[_]||null:r.rangeCount>0?r.getRangeAt(0):null;if(F!==null){let W;if(F instanceof Text){const V=document.createRange();V.selectNode(F),W=V.getBoundingClientRect()}else W=F.getBoundingClientRect();(function(V,G,oe){const We=Zc(oe),wt=Xc(We);if(We===null||wt===null)return;let{top:j,bottom:Ce}=G,fe=0,Ze=0,H=oe;for(;H!==null;){const $=H===We.body;if($)fe=0,Ze=St(V).innerHeight;else{const X=H.getBoundingClientRect();fe=X.top,Ze=X.bottom}let P=0;if(j<fe?P=-(fe-j):Ce>Ze&&(P=Ce-Ze),P!==0)if($)wt.scrollBy(0,P);else{const X=H.scrollTop;H.scrollTop+=P;const pe=H.scrollTop-X;j-=pe,Ce-=pe}if($)break;H=ys(H)}})(t,W,s)}}Pa=!0}}function Xo(n){let e=M()||_n();e===null&&(e=de().selectEnd()),e.insertNodes(n)}function $y(){const n=M();return n===null?"":n.getTextContent()}function ql(n){let e=n;n.isCollapsed()||e.removeText();const t=M();N(t)&&(e=t),N(e)||D(161);const r=e.anchor;let i=r.getNode(),s=r.offset;for(;!ct(i);){const o=i;if([i,s]=Fy(i,s),o.is(i))break}return s}function Fy(n,e){const t=n.getParent();if(!t){const i=J();return de().append(i),i.select(),[de(),0]}if(R(n)){const i=n.splitText(e);if(i.length===0)return[t,n.getIndexWithinParent()];const s=e===0?0:1;return[t,i[0].getIndexWithinParent()+s]}if(!A(n)||e===0)return[t,n.getIndexWithinParent()];const r=n.getChildAtIndex(e);if(r){const i=new xr(Ae(n.__key,e,"element"),Ae(n.__key,e,"element"),0,""),s=n.insertNewAfter(i);s&&s.append(r,...r.getNextSiblings())}return[t,n.getIndexWithinParent()+1]}function Cd(n,e,t,r,i="decorators-and-blocks"){if(e==="move"&&r==="character"&&!n.isCollapsed()){const[u,d]=t===n.isBackward()?[n.focus,n.anchor]:[n.anchor,n.focus];return d.set(u.key,u.offset,u.type),!0}const s=$t(n.focus,t?"previous":"next"),o=r==="lineboundary",l=e==="move";let a=s,c=i==="decorators-and-blocks";if(!lu(a)){for(const u of a){c=!1;const{origin:d}=u;if(!Z(d)||d.isIsolated()||(a=u,!o||!d.isInline()))break}if(c)for(const u of al(s).iterNodeCarets(e==="extend"?"shadowRoot":"root")){if(ut(u))u.origin.isInline()||(a=u);else{if(A(u.origin))continue;Z(u.origin)&&!u.origin.isInline()&&(a=u)}break}}if(a===s)return!1;if(l&&!o&&Z(a.origin)&&a.origin.isKeyboardSelectable()){const u=Lc();return u.add(a.origin.getKey()),Re(u),!0}return a=et(a),l&&Rn(n.anchor,a),Rn(n.focus,a),c||!o}let $e=null,Fe=null,it=!1,Zl=!1,Vs=0;const wd={characterData:!0,childList:!0,subtree:!0};function Sr(){return it||$e!==null&&$e._readOnly}function Me(){it&&D(13)}function gg(){Vs>99&&D(14)}function yn(){return $e===null&&D(195,pg()),$e}function se(){return Fe===null&&D(196,pg()),Fe}function pg(){let n=0;const e=new Set,t=Yr.version;if(typeof window<"u")for(const i of document.querySelectorAll("[contenteditable]")){const s=_s(i);if(rl(s))n++;else if(s){let o=String(s.constructor.version||"<0.17.1");o===t&&(o+=" (separately built, likely a bundler configuration issue)"),e.add(o)}}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 Ry(){return Fe}function vd(n,e,t){const r=e.__type,i=Kc(n,r);let s=t.get(r);s===void 0&&(s=Array.from(i.transforms),t.set(r,s));const o=s.length;for(let l=0;l<o&&(s[l](e),e.isAttached());l++);}function Ed(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function mg(n,e){if(!e)return;const t=n._updateTags;let r=e;Array.isArray(e)||(r=[e]);for(const i of r)t.add(i)}function _g(n){return Pc(n,se()._nodes)}function Pc(n,e){const t=n.type,r=e.get(t);r===void 0&&D(17,t);const i=r.klass;n.type!==i.getType()&&D(18,i.name);const s=i.importJSON(n),o=n.children;if(A(s)&&Array.isArray(o))for(let l=0;l<o.length;l++){const a=Pc(o[l],e);s.append(a)}return s}function kd(n,e,t){const r=$e,i=it,s=Fe;$e=e,it=!0,Fe=n;try{return t()}finally{$e=r,it=i,Fe=s}}function en(n,e){const t=n._pendingEditorState,r=n._rootElement,i=n._headless||r===null;if(t===null)return;const s=n._editorState,o=s._selection,l=t._selection,a=n._dirtyType!==0,c=$e,u=it,d=Fe,f=n._updating,h=n._observer;let g=null;if(n._pendingEditorState=null,n._editorState=t,!i&&a&&h!==null){Fe=n,$e=t,it=!1,n._updating=!0;try{const w=n._dirtyType,x=n._dirtyElements,T=n._dirtyLeaves;h.disconnect(),g=gy(s,t,n,w,x,T)}catch(w){if(w instanceof Error&&n._onError(w),Zl)throw w;return wg(n,null,r,t),Ph(n),n._dirtyType=2,Zl=!0,en(n,s),void(Zl=!1)}finally{h.observe(r,wd),n._updating=f,$e=c,it=u,Fe=d}}t._readOnly||(t._readOnly=!0);const p=n._dirtyLeaves,m=n._dirtyElements,b=n._normalizedNodes,_=n._updateTags,y=n._deferred;a&&(n._dirtyType=0,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements=new Map,n._normalizedNodes=new Set,n._updateTags=new Set),(function(w,x){const T=w._decorators;let v=w._pendingDecorators||T;const O=x._nodeMap;let I;for(I in v)O.has(I)||(v===T&&(v=Ag(w)),delete v[I])})(n,t);const C=i?null:Ct(St(n));if(n._editable&&C!==null&&(a||l===null||l.dirty||!l.is(o))&&r!==null&&!_.has(lg)){Fe=n,$e=t;try{if(h!==null&&h.disconnect(),a||l===null||l.dirty){const w=n._blockCursorElement;w!==null&&Ha(w,n,r),Iy(o,l,n,C,_,r)}(function(w,x,T){let v=w._blockCursorElement;if(N(T)&&T.isCollapsed()&&T.anchor.type==="element"&&x.contains(document.activeElement)){const O=T.anchor,I=O.getNode(),k=O.offset;let L=!1,K=null;if(k===I.getChildrenSize())Ql(I.getChildAtIndex(k-1))&&(L=!0);else{const F=I.getChildAtIndex(k);if(F!==null&&Ql(F)){const W=F.getPreviousSibling();(W===null||Ql(W))&&(L=!0,K=w.getElementByKey(F.__key))}}if(L){const F=w.getElementByKey(I.__key);return v===null&&(w._blockCursorElement=v=(function(W){const V=W.theme,G=document.createElement("div");G.contentEditable="false",G.setAttribute("data-lexical-cursor","true");let oe=V.blockCursor;if(oe!==void 0){if(typeof oe=="string"){const We=dn(oe);oe=V.blockCursor=We}oe!==void 0&&G.classList.add(...oe)}return G})(w._config)),x.style.caretColor="transparent",void(K===null?F.appendChild(v):F.insertBefore(v,K))}}v!==null&&Ha(v,w,x)})(n,r,l)}finally{h!==null&&h.observe(r,wd),Fe=d,$e=c}}g!==null&&(function(w,x,T,v,O){const I=Array.from(w._listeners.mutation),k=I.length;for(let L=0;L<k;L++){const[K,F]=I[L];for(const W of F){const V=x.get(W);V!==void 0&&K(V,{dirtyLeaves:v,prevEditorState:O,updateTags:T})}}})(n,g,_,p,s),N(l)||l===null||o!==null&&o.is(l)||n.dispatchCommand(ni,void 0);const S=n._pendingDecorators;S!==null&&(n._decorators=S,n._pendingDecorators=null,Li("decorator",n,!0,S)),(function(w,x,T){const v=Od(x),O=Od(T);v!==O&&Li("textcontent",w,!0,O)})(n,e||s,t),Li("update",n,!0,{dirtyElements:m,dirtyLeaves:p,editorState:t,mutatedNodes:g,normalizedNodes:b,prevEditorState:e||s,tags:_}),(function(w,x){if(w._deferred=[],x.length!==0){const T=w._updating;w._updating=!0;try{for(let v=0;v<x.length;v++)x[v]()}finally{w._updating=T}}})(n,y),(function(w){const x=w._updates;if(x.length!==0){const T=x.shift();if(T){const[v,O]=T;Qo(w,v,O)}}})(n)}function Li(n,e,t,...r){const i=e._updating;e._updating=t;try{const s=Array.from(e._listeners[n]);for(let o=0;o<s.length;o++)s[o].apply(null,r)}finally{e._updating=i}}function Td(n,e){const t=n._updates;let r=e||!1;for(;t.length!==0;){const i=t.shift();if(i){const[s,o]=i,l=n._pendingEditorState;let a;o!==void 0&&(a=o.onUpdate,o.skipTransforms&&(r=!0),o.discrete&&(l===null&&D(191),l._flushSync=!0),a&&n._deferred.push(a),mg(n,o.tag)),l==null?Qo(n,s,o):s()}}return r}function Qo(n,e,t){const r=n._updateTags;let i,s=!1,o=!1;t!==void 0&&(i=t.onUpdate,mg(n,t.tag),s=t.skipTransforms||!1,o=t.discrete||!1),i&&n._deferred.push(i);const l=n._editorState;let a=n._pendingEditorState,c=!1;(a===null||a._readOnly)&&(a=n._pendingEditorState=yg(a||l),c=!0),a._flushSync=o;const u=$e,d=it,f=Fe,h=n._updating;$e=a,it=!1,n._updating=!0,Fe=n;const g=n._headless||n.getRootElement()===null;Uc(null);try{c&&(g?l._selection!==null&&(a._selection=l._selection.clone()):a._selection=(function(_,y){const C=_.getEditorState()._selection,S=Ct(St(_));return N(C)||C==null?Zo(C,S,_,y):C.clone()})(n,t&&t.event||null));const m=n._compositionKey;e(),s=Td(n,s),(function(_,y){const C=y.getEditorState()._selection,S=_._selection;if(N(S)){const w=S.anchor,x=S.focus;let T;if(w.type==="text"&&(T=w.getNode(),T.selectionTransform(C,S)),x.type==="text"){const v=x.getNode();T!==v&&v.selectionTransform(C,S)}}})(a,n),n._dirtyType!==0&&(s?(function(_,y){const C=y._dirtyLeaves,S=_._nodeMap;for(const w of C){const x=S.get(w);R(x)&&x.isAttached()&&x.isSimpleText()&&!x.isUnmergeable()&&rd(x)}})(a,n):(function(_,y){const C=y._dirtyLeaves,S=y._dirtyElements,w=_._nodeMap,x=vn(),T=new Map;let v=C,O=v.size,I=S,k=I.size;for(;O>0||k>0;){if(O>0){y._dirtyLeaves=new Set;for(const L of v){const K=w.get(L);R(K)&&K.isAttached()&&K.isSimpleText()&&!K.isUnmergeable()&&rd(K),K!==void 0&&Ed(K,x)&&vd(y,K,T),C.add(L)}if(v=y._dirtyLeaves,O=v.size,O>0){Vs++;continue}}y._dirtyLeaves=new Set,y._dirtyElements=new Map,I.delete("root")&&I.set("root",!0);for(const L of I){const K=L[0],F=L[1];if(S.set(K,F),!F)continue;const W=w.get(K);W!==void 0&&Ed(W,x)&&vd(y,W,T)}v=y._dirtyLeaves,O=v.size,I=y._dirtyElements,k=I.size,Vs++}y._dirtyLeaves=C,y._dirtyElements=S})(a,n),Td(n),(function(_,y,C,S){const w=_._nodeMap,x=y._nodeMap,T=[];for(const[v]of S){const O=x.get(v);O!==void 0&&(O.isAttached()||(A(O)&&Rh(O,v,w,x,T,S),w.has(v)||S.delete(v),T.push(v)))}for(const v of T)x.delete(v);for(const v of C){const O=x.get(v);O===void 0||O.isAttached()||(w.has(v)||C.delete(v),x.delete(v))}})(l,a,n._dirtyLeaves,n._dirtyElements)),m!==n._compositionKey&&(a._flushSync=!0);const b=a._selection;if(N(b)){const _=a._nodeMap,y=b.anchor.key,C=b.focus.key;_.get(y)!==void 0&&_.get(C)!==void 0||D(19)}else je(b)&&b._nodes.size===0&&(a._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 en(n)}finally{$e=u,it=d,Fe=f,n._updating=h,Vs=0}n._dirtyType!==0||n._deferred.length>0||(function(m,b){const _=b.getEditorState()._selection,y=m._selection;if(y!==null){if(y.dirty||!y.is(_))return!0}else if(_!==null)return!0;return!1})(a,n)?a._flushSync?(a._flushSync=!1,en(n)):c&&Py(()=>{en(n)}):(a._flushSync=!1,c&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function Kt(n,e,t){Fe===n&&t===void 0?e():Qo(n,e,t)}class Pi{element;before;after;constructor(e,t,r){this.element=e,this.before=t||null,this.after=r||null}withBefore(e){return new Pi(this.element,e,this.after)}withAfter(e){return new Pi(this.element,this.before,e)}withElement(e){return this.element===e?this:new Pi(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&D(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&D(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&D(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(fs||ti||ds);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,r=e.nodeName==="IMG"?e.nextSibling:null;r&&t.removeChild(r),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,i=this.before,s=document.createElement("br");if(r.insertBefore(s,i),e){const o=document.createElement("img");o.setAttribute("data-lexical-linebreak","true"),o.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",o.alt="",r.insertBefore(o,s),r.__lexicalLineBreak=o}else r.__lexicalLineBreak=s}getFirstChildOffset(){let e=0;for(let t=this.after;t!==null;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,r,i){if(r===this.element){const a=this.getFirstChildOffset();return[e,Math.min(a+e.getChildrenSize(),Math.max(a,i))]}const s=Nd(t,r);s.push(i);const o=Nd(t,this.element);let l=e.getIndexWithinParent();for(let a=0;a<o.length;a++){const c=s[a],u=o[a];if(c===void 0||c<u)break;if(c>u){l+=1;break}}return[e.getParentOrThrow(),l]}}function Nd(n,e){const t=[];let r=e;for(;r!==n&&r!==null;r=r.parentNode){let i=0;for(let s=r.previousSibling;s!==null;s=s.previousSibling)i++;t.push(i)}return r!==n&&D(225),t.reverse()}class Se extends Ut{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return ey[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=se()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(R(t)&&e.push(t),A(t)){const r=t.getAllTextNodes();e.push(...r)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;A(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;A(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),r=t.length;if(e>=r){const s=t[r-1];return A(s)&&s.getLastDescendant()||s||null}const i=t[e];return A(i)&&i.getFirstDescendant()||i||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:Q(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&D(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:Q(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&D(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let r,i;if(e<t/2){for(r=this.getFirstChild(),i=0;r!==null&&i<=e;){if(i===e)return r;r=r.getNextSibling(),i++}return null}for(r=this.getLastChild(),i=t-1;r!==null&&i>=e;){if(i===e)return r;r=r.getPreviousSibling(),i--}return null}getTextContent(){let e="";const t=this.getChildren(),r=t.length;for(let i=0;i<r;i++){const s=t[i];e+=s.getTextContent(),A(s)&&i!==r-1&&!s.isInline()&&(e+=Uo)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),r=t.length;for(let i=0;i<r;i++){const s=t[i];e+=s.getTextContentSize(),A(s)&&i!==r-1&&!s.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==""){const t=Yu[e];return(this.getFormat()&t)!==0}return!1}hasTextFormat(e){const t=ze[e];return(this.getTextFormat()&t)!==0}getFormatFlags(e,t){return yo(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){Me();const r=M();let i=e,s=t;const o=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const a=this.getFirstChild();if(R(a)||A(a))return a.select(0,0)}else if(!(e!==void 0&&e!==o||t!==void 0&&t!==o)){const a=this.getLastChild();if(R(a)||A(a))return a.select()}}i===void 0&&(i=o),s===void 0&&(s=o);const l=this.__key;return N(r)?(r.anchor.set(l,i,"element"),r.focus.set(l,s,"element"),r.dirty=!0,r):fg(l,i,l,s,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(t=>t.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==""?Yu[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,r){fo(this)&&D(324,this.__key,this.__type);const i=this.getChildrenSize(),s=this.getWritable();e+t<=i||D(226,String(e),String(t),String(i));const o=s.__key,l=[],a=[],c=this.getChildAtIndex(e+t);let u=null,d=i-t+r.length;if(e!==0)if(e===i)u=this.getLastChild();else{const h=this.getChildAtIndex(e);h!==null&&(u=h.getPreviousSibling())}if(t>0){let h=u===null?this.getFirstChild():u.getNextSibling();for(let g=0;g<t;g++){h===null&&D(100);const p=h.getNextSibling(),m=h.__key;Wt(h.getWritable()),a.push(m),h=p}}let f=u;for(const h of r){f!==null&&h.is(f)&&(u=f=f.getPreviousSibling());const g=h.getWritable();g.__parent===o&&d--,Wt(g);const p=h.__key;if(f===null)s.__first=p,g.__prev=null;else{const m=f.getWritable();m.__next=p,g.__prev=m.__key}h.__key===o&&D(76),g.__parent=o,l.push(p),f=h}if(e+t===i)f!==null&&(f.getWritable().__next=null,s.__last=f.__key);else if(c!==null){const h=c.getWritable();if(f!==null){const g=f.getWritable();h.__prev=f.__key,g.__next=c.__key}else h.__prev=null}if(s.__size=d,a.length){const h=M();if(N(h)){const g=new Set(a),p=new Set(l),{anchor:m,focus:b}=h;Ad(m,g,p)&&_o(m,m.getNode(),this,u,c),Ad(b,g,p)&&_o(b,b.getNode(),this,u,c),d!==0||this.canBeEmpty()||Ue(this)||this.remove()}}return s}getDOMSlot(e){return new Pi(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(ne(t)){const r=this.getIndent();r>0&&(t.style.paddingInlineStart=40*r+"px");const i=this.getDirection();i&&(t.dir=i)}return{element:t}}exportJSON(){const e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),r=this.getTextStyle();return t===0&&r===""||Ue(this)||this.getChildren().some(R)||(t!==0&&(e.textFormat=t),r!==""&&(e.textStyle=r)),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,r){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const r=this.getDOMSlot(e);let i=r.getFirstChild();for(let s=this.getFirstChild();s;s=s.getNextSibling()){const o=t.getElementByKey(s.getKey());o!==null&&(i==null?(r.insertChild(o),i=o):i!==o&&r.replaceChild(o,i),i=i.nextSibling)}}}function A(n){return n instanceof Se}function Ad(n,e,t){let r=n.getNode();for(;r;){const i=r.__key;if(e.has(i)&&!t.has(i))return!0;r=r.getParent()}return!1}class ps extends Ut{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Z(n){return n instanceof ps}class Cr extends Se{__cachedText;static getType(){return"root"}static clone(){return new Cr}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){D(51)}getTextContent(){const e=this.__cachedText;return!Sr()&&se()._dirtyType!==0||e===null?super.getTextContent():e}remove(){D(52)}replace(e){D(53)}insertBefore(e){D(54)}insertAfter(e){D(55)}updateDOM(e,t){return!1}splice(e,t,r){for(const i of r)A(i)||Z(i)||D(282);return super.splice(e,t,r)}static importJSON(e){return de().updateFromJSON(e)}collapseAtStart(){return!0}}function ye(n){return n instanceof Cr}function yg(n){return new ms(new Map(n._nodeMap))}function zc(){return new ms(new Map([["root",new Cr]]))}function bg(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType()&&D(130,t.name),A(n)){const r=e.children;Array.isArray(r)||D(59,t.name);const i=n.getChildren();for(let s=0;s<i.length;s++){const o=bg(i[s]);r.push(o)}}return e}function xg(n){return n instanceof ms}class ms{_nodeMap;_selection;_flushSync;_readOnly;constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return kd(t&&t.editor||null,this,e)}clone(e){const t=new ms(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return kd(null,this,()=>({root:bg(de())}))}}class el extends Se{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Kn extends Se{static getType(){return"paragraph"}static clone(e){return new Kn(e.__key)}createDOM(e){const t=document.createElement("p"),r=jr(e.theme,"paragraph");return r!==void 0&&t.classList.add(...r),t}updateDOM(e,t,r){return!1}static importDOM(){return{p:e=>({conversion:Dy,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(ne(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();r&&(t.style.textAlign=r)}return{element:t}}static importJSON(e){return J().updateFromJSON(e)}exportJSON(){const e=super.exportJSON();if(e.textFormat===void 0||e.textStyle===void 0){const t=this.getChildren().find(R);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){const r=J();r.setTextFormat(e.format),r.setTextStyle(e.style);const i=this.getDirection();return r.setDirection(i),r.setFormat(this.getFormatType()),r.setStyle(this.getStyle()),this.insertAfter(r,t),r}collapseAtStart(){const e=this.getChildren();if(e.length===0||R(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function Dy(n){const e=J();return n.style&&(e.setFormat(n.style.textAlign),ol(n,e)),{node:e}}function J(){return Le(new Kn)}function wr(n){return n instanceof Kn}const B=0,q=1,Sg=2,Cg=3,Bc=4;function wg(n,e,t,r){const i=n._keyToDOMMap;i.clear(),n._editorState=zc(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=0,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,n._updateTags=new Set,n._updates=[],n._blockCursorElement=null;const s=n._observer;s!==null&&(s.disconnect(),n._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",i.set("root",t))}function vg(n){const e=new Set,t=new Set;let r=n;for(;r;){const{ownNodeConfig:i}=bs(r),s=r.transform;if(!t.has(s)){t.add(s);const o=r.transform();o&&e.add(o)}if(i){const o=i.$transform;o&&e.add(o),r=i.extends}else{const o=Object.getPrototypeOf(r);r=o.prototype instanceof Ut&&o!==Ut?o:void 0}}return e}function ui(n){const e=n||{},t=Ry(),r=e.theme||{},i=n===void 0?t:e.parentEditor||null,s=e.disableEvents||!1,o=zc(),l=e.namespace||(i!==null?i._config.namespace:Ig()),a=e.editorState,c=[Cr,qe,yr,br,Kn,el,...e.nodes||[]],{onError:u,html:d}=e,f=e.editable===void 0||e.editable;let h;if(n===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let p=0;p<c.length;p++){let m=c[p],b=null,_=null;if(typeof m!="function"){const S=m;m=S.replace,b=S.with,_=S.withKlass||null}bs(m);const y=m.getType(),C=vg(m);h.set(y,{exportDOM:d&&d.export?d.export.get(m):void 0,klass:m,replace:b,replaceWithKlass:_,sharedNodeState:zh(c[p]),transforms:C})}}const g=new Yr(o,i,h,{disableEvents:s,namespace:l,theme:r},u||console.error,(function(p,m){const b=new Map,_=new Set,y=C=>{Object.keys(C).forEach(S=>{let w=b.get(S);w===void 0&&(w=[],b.set(S,w)),w.push(C[S])})};return p.forEach(C=>{const S=C.klass.importDOM;if(S==null||_.has(S))return;_.add(S);const w=S.call(C.klass);w!==null&&y(w)}),m&&y(m),b})(h,d?d.import:void 0),f,n);return a!==void 0&&(g._pendingEditorState=a,g._dirtyType=2),(function(p){p.registerCommand(kc,py,B),p.registerCommand(Tc,my,B),p.registerCommand(Nc,_y,B),p.registerCommand(Ac,yy,B),p.registerCommand(Oc,by,B)})(g),g}class Yr{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(e,t,r,i,s,o,l,a){this._createEditorArgs=a,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=i,this._nodes=r,this._decorators={},this._pendingDecorators=null,this._dirtyType=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=Ig(),this._onError=s,this._htmlConversions=o,this._editable=l,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,r){r===void 0&&D(35);const i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);const s=i.get(e);s===void 0&&D(36,String(e));const o=s[r];return o.add(t),()=>{o.delete(t),s.every(l=>l.size===0)&&i.delete(e)}}registerMutationListener(e,t,r){const i=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,s=this._listeners.mutation;let o=s.get(t);o===void 0&&(o=new Set,s.set(t,o)),o.add(i);const l=r&&r.skipInitialization;return l!==void 0&&l||this.initializeMutationListener(t,i),()=>{o.delete(i),o.size===0&&s.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&D(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const r=this._editorState,i=Ja(r).get(t.getType());if(!i)return;const s=new Map;for(const o of i.keys())s.set(o,"created");s.size>0&&e(s,{dirtyLeaves:new Set,prevEditorState:r,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const r=this.getRegisteredNode(e);return r.transforms.add(t),r}registerNodeTransform(e,t){const r=this.registerNodeTransformToKlass(e,t),i=[r],s=r.replaceWithKlass;if(s!=null){const o=this.registerNodeTransformToKlass(s,t);i.push(o)}return(function(o,l){const a=Ja(o.getEditorState()),c=[];for(const u of l){const d=a.get(u);d&&c.push(d)}c.length!==0&&o.update(()=>{for(const u of c)for(const d of u.keys()){const f=Q(d);f&&f.markDirty()}},o._pendingEditorState===null?{tag:Wr}:void 0)})(this,i.map(o=>o.klass.getType())),()=>{i.forEach(o=>o.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return z(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=jr(this._config.theme,"root"),i=this._pendingEditorState||this._editorState;if(this._rootElement=e,wg(this,t,e,i),t!==null&&(this._config.disableEvents||xy(t),r!=null&&t.classList.remove(...r)),e!==null){const s=Xc(e),o=e.style;o.userSelect="text",o.whiteSpace="pre-wrap",o.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=s,this._dirtyType=2,Ph(this),this._updateTags.add(Wr),en(this),this._config.disableEvents||(function(l,a){const c=l.ownerDocument;La.set(l,c);const u=co.get(c)??0;u<1&&c.addEventListener("selectionchange",ng),co.set(c,u+1),l.__lexicalEditor=a;const d=tg(l);for(let f=0;f<Da.length;f++){const[h,g]=Da[f],p=typeof g=="function"?m=>{ud(m)||(cd(m),(a.isEditable()||h==="click")&&g(m,a))}:m=>{if(ud(m))return;cd(m);const b=a.isEditable();switch(h){case"cut":return b&&z(a,li,m);case"copy":return z(a,_r,m);case"paste":return b&&z(a,ri,m);case"dragstart":return b&&z(a,Yo,m);case"dragover":return b&&z(a,Ic,m);case"dragend":return b&&z(a,Jh,m);case"focus":return b&&z(a,Fc,m);case"blur":return b&&z(a,ai,m);case"drop":return b&&z(a,Vo,m)}};l.addEventListener(h,p),d.push(()=>{l.removeEventListener(h,p)})}})(e,this),r!=null&&e.classList.add(...r)}else this._window=null,this._updateTags.add(Wr),en(this);Li("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&D(38);let r=e;r._readOnly&&(r=yg(e),r._selection=e._selection?e._selection.clone():null),Lh(this);const i=this._pendingEditorState,s=this._updateTags,o=t!==void 0?t.tag:null;i===null||i.isEmpty()||(o!=null&&s.add(o),en(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,o!=null&&s.add(o),this._updating||en(this)}parseEditorState(e,t){return(function(r,i,s){const o=zc(),l=$e,a=it,c=Fe,u=i._dirtyElements,d=i._dirtyLeaves,f=i._cloneNotNeeded,h=i._dirtyType;i._dirtyElements=new Map,i._dirtyLeaves=new Set,i._cloneNotNeeded=new Set,i._dirtyType=0,$e=o,it=!1,Fe=i,Uc(null);try{const g=i._nodes;Pc(r.root,g),s&&s(),o._readOnly=!0}catch(g){g instanceof Error&&i._onError(g)}finally{i._dirtyElements=u,i._dirtyLeaves=d,i._cloneNotNeeded=f,i._dirtyType=h,$e=l,it=a,Fe=c}return o})(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return en(this),this.getEditorState().read(e,{editor:this})}update(e,t){(function(r,i,s){r._updating?r._updates.push([i,s]):Qo(r,i,s)})(this,e,t)}focus(e,t={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),Kt(this,()=>{const i=M(),s=de();i!==null?i.dirty||Re(i.clone()):s.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?s.selectStart():s.selectEnd()),Dg("focus"),Lg(()=>{r.removeAttribute("autocapitalize"),e&&e()})}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=Ct(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Li("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}Yr.version="0.40.0+prod.esm";let ja=null;function Uc(n){ja=n}let Eg=1;function Ly(){Eg=1}function Kc(n,e){const t=tl(n,e);return t===void 0&&D(30,e),t}function tl(n,e){return n._nodes.get(e)}const Py=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function kg(n){return Z(dt(n))}function nl(n){const e=document.activeElement;if(!ne(e))return!1;const t=e.nodeName;return Z(dt(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&_s(e)==null)}function di(n,e,t){const r=n.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(t)&&e!==null&&!nl(e)&&il(e)===n}catch{return!1}}function rl(n){return n instanceof Yr}function il(n){let e=n;for(;e!=null;){const t=_s(e);if(rl(t))return t;e=ys(e)}return null}function _s(n){return n?n.__lexicalEditor:null}function Tg(n){return Z_.test(n)?"rtl":X_.test(n)?"ltr":null}function Nn(n){return Je(n)||n.isToken()}function Et(n){return Nn(n)||n.isSegmented()}function Yt(n){return Wn(n)&&n.nodeType===3}function Wc(n){return Wn(n)&&n.nodeType===9}function cr(n){let e=n;for(;e!=null;){if(Yt(e))return e;e=e.firstChild}return null}function yo(n,e,t){const r=ze[e];if(t!==null&&(n&r)===(t&r))return n;let i=n^r;return e==="subscript"?i&=~ze.superscript:e==="superscript"?i&=~ze.subscript:e==="lowercase"?(i&=~ze.uppercase,i&=~ze.capitalize):e==="uppercase"?(i&=~ze.lowercase,i&=~ze.capitalize):e==="capitalize"&&(i&=~ze.lowercase,i&=~ze.uppercase),i}function jc(n){return R(n)||ue(n)||Z(n)}function Ng(n,e){const t=(function(){const o=ja;return ja=null,o})();if((e=e||t&&t.__key)!=null)return void(n.__key=e);Me(),gg();const r=se(),i=yn(),s=""+Eg++;i._nodeMap.set(s,n),A(n)?r._dirtyElements.set(s,!0):r._dirtyLeaves.add(s),r._cloneNotNeeded.add(s),r._dirtyType=1,n.__key=s}function Wt(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),i=n.getPreviousSibling(),s=n.getNextSibling(),o=s!==null?s.__key:null,l=i!==null?i.__key:null,a=i!==null?i.getWritable():null,c=s!==null?s.getWritable():null;i===null&&(r.__first=o),s===null&&(r.__last=l),a!==null&&(a.__next=o),c!==null&&(c.__prev=l),t.__prev=null,t.__next=null,t.__parent=null,r.__size--}}function bo(n){gg(),fo(n)&&D(323,n.__key,n.__type);const e=n.getLatest(),t=e.__parent,r=yn(),i=se(),s=r._nodeMap,o=i._dirtyElements;t!==null&&(function(a,c,u){let d=a;for(;d!==null;){if(u.has(d))return;const f=c.get(d);if(f===void 0)break;u.set(d,!1),d=f.__parent}})(t,s,o);const l=e.__key;i._dirtyType=1,A(n)?o.set(l,!0):i._dirtyLeaves.add(l)}function Ie(n){Me();const e=se(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const r=Q(t);r!==null&&r.getWritable()}if(n!==null){const r=Q(n);r!==null&&r.getWritable()}}}function vn(){return Sr()?null:se()._compositionKey}function Q(n,e){const t=(e||yn())._nodeMap.get(n);return t===void 0?null:t}function Hc(n,e){const t=sl(n,se());return t!==void 0?Q(t,e):null}function sl(n,e){return n[`__lexicalKey_${e._key}`]}function dt(n,e){let t=n;for(;t!=null;){const r=Hc(t,e);if(r!==null)return r;t=ys(t)}return null}function Ag(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function Od(n){return n.read(()=>de().getTextContent())}function de(){return Og(yn())}function Og(n){return n._nodeMap.get("root")}function Re(n){Me();const e=yn();n!==null&&(n.dirty=!0,n.setCachedNodes(null)),e._selection=n}function Ur(n){const e=se(),t=(function(r,i){let s=r;for(;s!=null;){const o=sl(s,i);if(o!==void 0)return o;s=ys(s)}return null})(n,e);return t===null?n===e.getRootElement()?Q("root"):null:Q(t)}function Mg(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function Jc(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Ig(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function $g(n){return Yt(n)?n.nodeValue:null}function Gc(n,e,t){const r=Ct(St(e));if(r===null)return;const i=r.anchorNode;let{anchorOffset:s,focusOffset:o}=r;if(i!==null){let l=$g(i);const a=dt(i);if(l!==null&&R(a)){if(l===Bo&&t){const c=t.length;l=t,s=c,o=c}l!==null&&Vc(a,l,s,o,n)}}}function Vc(n,e,t,r,i){let s=n;if(s.isAttached()&&(i||!s.isDirty())){const o=s.isComposing();let l=e;(o||i)&&e[e.length-1]===Bo&&(l=e.slice(0,-1));const a=s.getTextContent();if(i||l!==a){if(l===""){if(Ie(null),ds||ti||fs)s.remove();else{const p=se();setTimeout(()=>{p.update(()=>{s.isAttached()&&s.remove()})},20)}return}const c=s.getParent(),u=_n(),d=s.getTextContentSize(),f=vn(),h=s.getKey();if(s.isToken()||f!==null&&h===f&&!o||N(u)&&(c!==null&&!c.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===n.__key&&u.anchor.offset===0&&!s.canInsertTextBefore()&&!o||u.focus.key===n.__key&&u.focus.offset===d&&!s.canInsertTextAfter()&&!o))return void s.markDirty();const g=M();if(!N(g)||t===null||r===null)return void Md(s,l,g);if(g.setTextNodeRange(s,t,s,r),s.isSegmented()){const p=he(s.getTextContent());s.replace(p),s=p}Md(s,l,g)}}}function Md(n,e,t){if(n.setTextContent(e),N(t)){const r=n.getKey();for(const i of["anchor","focus"]){const s=t[i];s.type==="text"&&s.key===r&&(s.offset=Ot(n,s.offset,"clamp"))}}}function Is(n,e,t){const r=e[t]||!1;return r==="any"||r===n[t]}function Fg(n,e){return Is(n,e,"altKey")&&Is(n,e,"ctrlKey")&&Is(n,e,"shiftKey")&&Is(n,e,"metaKey")}function re(n,e,t){return Fg(n,t)&&n.key.toLowerCase()===e.toLowerCase()}const Qt={ctrlKey:!kt,metaKey:kt},Id={altKey:kt,ctrlKey:!kt};function $d(n){return n.key==="Backspace"}function Fd(n){return re(n,"a",Qt)}function Yc(n){const e=de();if(N(n)){const t=n.anchor,r=n.focus,i=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();return t.set(i.getKey(),0,"element"),r.set(i.getKey(),i.getChildrenSize(),"element"),Mn(n),n}{const t=e.select(0,e.getChildrenSize());return Re(Mn(t)),t}}function jr(n,e){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const t=n.__lexicalClassNameCache,r=t[e];if(r!==void 0)return r;const i=n[e];if(typeof i=="string"){const s=dn(i);return t[e]=s,s}return i}function qc(n,e,t,r,i){if(t.size===0)return;const s=r.__type,o=r.__key,l=e.get(s);l===void 0&&D(33,s);const a=l.klass;let c=n.get(a);c===void 0&&(c=new Map,n.set(a,c));const u=c.get(o),d=u==="destroyed"&&i==="created";(u===void 0||d)&&c.set(o,d?"updated":i)}function zy(n){const e=n.getType(),t=yn();if(t._readOnly){const s=Ja(t).get(e);return s?Array.from(s.values()):[]}const r=t._nodeMap,i=[];for(const[,s]of r)s instanceof n&&s.__type===e&&s.isAttached()&&i.push(s);return i}function Rd(n,e,t){const r=n.getParent();let i=t,s=n;return r!==null&&(e&&t===0?(i=s.getIndexWithinParent(),s=r):e||t!==s.getChildrenSize()||(i=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(e?i-1:i)}function xo(n,e){const t=n.offset;if(n.type==="element")return Rd(n.getNode(),e,t);{const r=n.getNode();if(e&&t===0||!e&&t===r.getTextContentSize()){const i=e?r.getPreviousSibling():r.getNextSibling();return i===null?Rd(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):i}}return null}function Rg(n){const e=St(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function z(n,e,t){return(function(r,i,s){const o=Jc(r);for(let l=4;l>=0;l--)for(let a=0;a<o.length;a++){const c=o[a],u=c._commands.get(i);if(u!==void 0){const d=u[l];if(d!==void 0){const f=Array.from(d),h=f.length;let g=!1;if(Kt(c,()=>{for(let p=0;p<h;p++)if(f[p](s,r))return void(g=!0)}),g)return g}}}return!1})(n,e,t)}function ur(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&D(75,e),t}function ys(n){const e=n.assignedSlot||n.parentElement;return Co(e)?e.host:e}function Zc(n){return Wc(n)?n:ne(n)?n.ownerDocument:null}function By(n){return se()._updateTags.has(n)}function Dg(n){Me(),se()._updateTags.add(n)}function Lg(n){Me(),se()._deferred.push(n)}function So(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Xc(n){const e=Zc(n);return e?e.defaultView:null}function St(n){const e=n._window;return e===null&&D(78),e}function Pg(n){return A(n)&&n.isInline()||Z(n)&&n.isInline()}function zg(n){let e=n.getParentOrThrow();for(;e!==null;){if(Ue(e))return e;e=e.getParentOrThrow()}return e}function Ue(n){return ye(n)||A(n)&&n.isShadowRoot()}function Qc(n){const e=n.constructor.clone(n);return Ng(e,null),e.afterCloneFrom(n),e}function Le(n){const e=se(),t=n.getType(),r=tl(e,t);r===void 0&&D(200,n.constructor.name,t);const{replace:i,replaceWithKlass:s}=r;if(i!==null){const o=i(n),l=o.constructor;return s!==null?o instanceof s||D(201,s.name,s.getType(),l.name,l.getType(),n.constructor.name,t):o instanceof n.constructor&&l!==n.constructor||D(202,l.name,l.getType(),n.constructor.name,t),o.__key===n.__key&&D(203,n.constructor.name,t,l.name,l.getType()),o}return n}function Xl(n,e){!ye(n.getParent())||A(e)||Z(e)||D(99)}function Zn(n){const e=Q(n);return e===null&&D(63,n),e}function Ql(n){return(Z(n)||A(n)&&!n.canBeEmpty())&&!n.isInline()}function Ha(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function Ct(n){return Ft?(n||window).getSelection():null}function Bg(n){const e=Xc(n);return e?e.getSelection():null}function Uy(n,e){let t=n.getChildAtIndex(e);t==null&&(t=n),Ue(n)&&D(102);const r=o=>{const l=o.getParentOrThrow(),a=Ue(l),c=o!==t||a?Qc(o):o;if(a)return A(o)&&A(c)||D(133),o.insertAfter(c),[o,c,c];{const[u,d,f]=r(l),h=o.getNextSiblings();return f.append(c,...h),[u,d,c]}},[i,s]=r(t);return[i,s]}function eu(n){return ne(n)&&n.tagName==="A"}function ne(n){return Wn(n)&&n.nodeType===1}function Wn(n){return typeof n=="object"&&n!==null&&"nodeType"in n&&typeof n.nodeType=="number"}function Co(n){return Wn(n)&&n.nodeType===11}function wo(n){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return n.nodeName.match(e)!==null}function qi(n){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return n.nodeName.match(e)!==null}function ct(n){if(Z(n)&&!n.isInline())return!0;if(!A(n)||Ue(n))return!1;const e=n.getFirstChild(),t=e===null||ue(e)||R(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function fi(){return se()}const Dd=new WeakMap,Ky=new Map;function Ja(n){if(!n._readOnly&&n.isEmpty())return Ky;n._readOnly||D(192);let e=Dd.get(n);return e||(e=(function(t){const r=new Map;for(const[i,s]of t._nodeMap){const o=s.__type;let l=r.get(o);l||(l=new Map,r.set(o,l)),l.set(i,s)}return r})(n),Dd.set(n,e)),e}function tu(n){const e=n.constructor.clone(n);return e.afterCloneFrom(n),e}function Ug(n){return(e=tu(n))[rg]=!0,e;var e}function ol(n,e){const t=parseInt(n.style.paddingInlineStart,10)||0,r=Math.round(t/40);e.setIndent(r)}function Kg(n){n.__lexicalUnmanaged=!0}function Wg(n){return n.__lexicalUnmanaged===!0}function wi(n,e){return(function(t,r){return Object.prototype.hasOwnProperty.call(t,r)})(n,e)&&n[e]!==Ut[e]}function bs(n){const e=qu in n.prototype?n.prototype[qu]():void 0,t=(function(o){if(!(o===Ut||o.prototype instanceof Ut)){let l="<unknown>",a="<unknown>";try{l=o.getType()}catch{}try{Yr.version&&(a=JSON.parse(Yr.version))}catch{}D(290,o.name,l,a)}return o===ps||o===Se||o===Ut})(n),r=!t&&wi(n,"getType")?n.getType():void 0;let i,s=r;if(e)if(r)i=e[r];else for(const[o,l]of Object.entries(e))s=o,i=l;if(!t&&s&&(wi(n,"getType")||(n.getType=()=>s),wi(n,"clone")||(n.clone=o=>(Uc(o),new n)),wi(n,"importJSON")||(n.importJSON=i&&i.$importJSON||(o=>new n().updateFromJSON(o))),!wi(n,"importDOM")&&i)){const{importDOM:o}=i;o&&(n.importDOM=()=>o)}return{ownNodeConfig:i,ownNodeType:s}}function jg(n){const e=fi();return Me(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(n))).klass}const le=(n,e)=>{let t=n;for(;t!=null&&!ye(t);){if(e(t))return t;t=t.getParent()}return null},Wy={next:"previous",previous:"next"};class ll{origin;constructor(e){this.origin=e}[Symbol.iterator](){return cl({hasNext:Fn,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return xe(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return xe(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 i=r===this.direction?t:Array.from(t).reverse();let s=this;const o=this.getParentAtCaret(),l=new Map;for(let a=s.getAdjacentCaret();a!==null&&l.size<e;a=a.getAdjacentCaret()){const c=a.origin.getWritable();l.set(c.getKey(),c)}for(const a of i){if(l.size>0){const c=s.getNodeAtCaret();if(c){if(l.delete(c.getKey()),l.delete(a.getKey()),!(c.is(a)||s.origin.is(a))){const u=a.getParent();u&&u.is(o)&&a.remove(),c.replace(a)}}else c===null&&D(263,Array.from(l).join(" "))}else s.insert(a);s=xe(a,this.direction)}for(const a of l.values())a.remove();return this}}class Zi extends ll{type="child";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:lt(e,this.direction)}getParentCaret(e="root"){return xe(nu(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=jn(this.direction);return xe(this.getNodeAtCaret(),e)||lt(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof Zi&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const jy={root:ye,shadowRoot:Ue};function jn(n){return Wy[n]}function nu(n,e="root"){return jy[e](n)?null:n}class dr extends ll{type="sibling";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:xe(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return A(this.origin)?lt(this.origin,this.direction):null}getParentCaret(e="root"){return xe(nu(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=jn(this.direction);return xe(this.getNodeAtCaret(),e)||lt(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof dr&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof dr||e instanceof fr)&&this.direction===e.direction&&this.origin.is(e.origin)}}class fr extends ll{type="text";offset;constructor(e,t){super(e),this.offset=t}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:un(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return xe(nu(this.getParentAtCaret(),e),this.direction)}getFlipped(){return un(this.origin,jn(this.direction),this.offset)}isSamePointCaret(e){return e instanceof fr&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof dr||e instanceof fr)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return xe(this.origin,this.direction)}}function At(n){return n instanceof fr}function Hy(n){return n instanceof ll}function Fn(n){return n instanceof dr}function ut(n){return n instanceof Zi}const Jy={next:class extends fr{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(n){return this.origin.insertAfter(n),this}},previous:class extends fr{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(n){return this.origin.insertBefore(n),this}}},Gy={next:class extends dr{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(n){return this.origin.insertAfter(n),this}},previous:class extends dr{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(n){return this.origin.insertBefore(n),this}}},Vy={next:class extends Zi{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(n){return this.origin.splice(0,0,[n]),this}},previous:class extends Zi{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(n){return this.origin.splice(this.origin.getChildrenSize(),0,[n]),this}}};function xe(n,e){return n?new Gy[e](n):null}function un(n,e,t){return n?new Jy[e](n,Ot(n,t)):null}function Ot(n,e,t="error"){const r=n.getTextContentSize();let i=e==="next"?r:e==="previous"?0:e;return(i<0||i>r)&&(t!=="clamp"&&Mh(284,String(e),String(r),n.getKey()),i=i<0?0:r),i}function Ga(n,e){return new Jg(n,e)}function lt(n,e){return A(n)?new Vy[e](n):null}function Hg(n){return n&&n.getChildCaret()||n}function hr(n){return n&&Hg(n.getAdjacentCaret())}class ru{type="node-caret-range";direction;anchor;focus;constructor(e,t,r){this.anchor=e,this.focus=t,this.direction=r}getLatest(){const e=this.anchor.getLatest(),t=this.focus.getLatest();return e===this.anchor&&t===this.focus?this:new ru(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=i=>{const s=this[i].getLatest();return At(s)?(function(o,l){const{direction:a,origin:c}=o,u=Ot(c,l==="focus"?jn(a):a);return Ga(o,u-o.offset)})(s,i):null},t=e("anchor"),r=e("focus");if(t&&r){const{caret:i}=t,{caret:s}=r;if(i.isSameNodeCaret(s))return[Ga(i,s.offset-i.offset),null]}return[t,r]}iterNodeCarets(e="root"){const t=At(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),r=this.focus.getLatest(),i=At(r),s=o=>o.isSameNodeCaret(r)?null:hr(o)||o.getParentCaret(e);return cl({hasNext:o=>o!==null&&!(i&&r.isSameNodeCaret(o)),initial:t.isSameNodeCaret(r)?null:s(t),map:o=>o,step:s})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Jg{type="slice";caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){const{distance:e,caret:{offset:t}}=this,r=t+e;return r<t?[r,t]:[t,r]}getTextContent(){const[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:e,direction:t}}=this,[r,i]=this.getSliceIndices(),s=e.getTextContent();return un(e.setTextContent(s.slice(0,r)+s.slice(i)),t,r)}}function Yy(n){return n instanceof Jg}function al(n){return Gt(n,xe(de(),n.direction))}function iu(n){return Gt(n,n)}function Gt(n,e){return n.direction!==e.direction&&D(265),new ru(n,e,n.direction)}function cl(n){const{initial:e,hasNext:t,step:r,map:i}=n;let s=e;return{[Symbol.iterator](){return this},next(){if(!t(s))return{done:!0,value:void 0};const o={done:!1,value:i(s)};return s=r(s),o}}}function su(n,e){const t=zi(n.origin,e.origin);switch(t===null&&D(275,n.origin.getKey(),e.origin.getKey()),t.type){case"same":{const r=n.type==="text",i=e.type==="text";return r&&i?(function(s,o){return Math.sign(s-o)})(n.offset,e.offset):n.type===e.type?0:r?-1:i?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 ou(t)}}function ou(n){const{a:e,b:t}=n,r=e.__key,i=t.__key;let s=e,o=t;for(;s&&o;s=s.getNextSibling(),o=o.getNextSibling()){if(s.__key===i)return-1;if(o.__key===r)return 1}return s===null?1:-1}function $s(n,e){return e.is(n)}function Ld(n){return A(n)?[n.getLatest(),null]:[n.getParent(),n.getLatest()]}function zi(n,e){if(n.is(e))return{commonAncestor:n,type:"same"};const t=new Map;for(let[r,i]=Ld(n);r;i=r,r=r.getParent())t.set(r,i);for(let[r,i]=Ld(e);r;i=r,r=r.getParent()){const s=t.get(r);if(s!==void 0)return s===null?($s(n,r)||D(276),{commonAncestor:r,type:"ancestor"}):i===null?($s(e,r)||D(277),{commonAncestor:r,type:"descendant"}):((A(s)||$s(n,s))&&(A(i)||$s(e,i))&&r.is(s.getParent())&&r.is(i.getParent())||D(278),{a:s,b:i,commonAncestor:r,type:"branch"})}return null}function $t(n,e){const{type:t,key:r,offset:i}=n,s=Zn(n.key);return t==="text"?(R(s)||D(266,s.getType(),r),un(s,e,i)):(A(s)||D(267,s.getType(),r),Vg(s,n.offset,e))}function Rn(n,e){const{origin:t,direction:r}=e,i=r==="next";At(e)?n.set(t.getKey(),e.offset,"text"):Fn(e)?R(t)?n.set(t.getKey(),Ot(t,r),"text"):n.set(t.getParentOrThrow().getKey(),t.getIndexWithinParent()+(i?1:0),"element"):(ut(e)&&A(t)||D(268),n.set(t.getKey(),i?0:t.getChildrenSize(),"element"))}function ul(n){const e=M(),t=N(e)?e:ci();return Bi(t,n),Re(t),t}function Bi(n,e){Rn(n.anchor,e.anchor),Rn(n.focus,e.focus)}function vo(n){const{anchor:e,focus:t}=n,r=$t(e,"next"),i=$t(t,"next"),s=su(r,i)<=0?"next":"previous";return Gt(Vt(r,s),Vt(i,s))}function hi(n){const{direction:e,origin:t}=n,r=xe(t,jn(e)).getNodeAtCaret();return r?xe(r,e):lt(t.getParentOrThrow(),e)}function Pd(n,e="root"){const t=[n];for(let r=ut(n)?n.getParentCaret(e):n.getSiblingCaret();r!==null;r=r.getParentCaret(e))t.push(hi(r));return t}function ea(n){return!!n&&n.origin.isAttached()}function Gg(n,e="removeEmptySlices"){if(n.isCollapsed())return n;const t="root",r="next";let i=e;const s=dl(n,r),o=Pd(s.anchor,t),l=Pd(s.focus.getFlipped(),t),a=new Set,c=[];for(const g of s.iterNodeCarets(t))if(ut(g))a.add(g.origin.getKey());else if(Fn(g)){const{origin:p}=g;A(p)&&!a.has(p.getKey())||c.push(p)}for(const g of c)g.remove();for(const g of s.getTextSlices()){if(!g)continue;const{origin:p}=g.caret,m=p.getTextContentSize(),b=hi(xe(p,r)),_=p.getMode();if(Math.abs(g.distance)===m&&i==="removeEmptySlices"||_==="token"&&g.distance!==0)b.remove();else if(g.distance!==0){i="removeEmptySlices";let y=g.removeTextSlice();const C=g.caret.origin;if(_==="segmented"){const S=y.origin,w=he(S.getTextContent()).setStyle(S.getStyle()).setFormat(S.getFormat());b.replaceOrInsert(w),y=un(w,r,y.offset)}C.is(o[0].origin)&&(o[0]=y),C.is(l[0].origin)&&(l[0]=y.getFlipped())}}let u,d;for(const g of o)if(ea(g)){u=et(g);break}for(const g of l)if(ea(g)){d=et(g);break}const f=(function(g,p,m){if(!g||!p)return null;const b=g.getParentAtCaret(),_=p.getParentAtCaret();if(!b||!_)return null;const y=b.getParents().reverse();y.push(b);const C=_.getParents().reverse();C.push(_);const S=Math.min(y.length,C.length);let w;for(w=0;w<S&&y[w]===C[w];w++);const x=(O,I)=>{let k;for(let L=w;L<O.length;L++){const K=O[L];if(Ue(K))return;!k&&I(K)&&(k=K)}return k},T=x(y,ct),v=T&&x(C,O=>m.has(O.getKey())&&ct(O));return T&&v?[T,v]:null})(u,d,a);if(f){const[g,p]=f;lt(g,"previous").splice(0,p.getChildren()),p.remove()}const h=[u,d,...o,...l].find(ea);if(h)return iu(Vt(et(h),n.direction));D(269,JSON.stringify(o.map(g=>g.origin.__key)))}function et(n){const e=(function(i){let s=i;for(;ut(s);){const o=hr(s);if(!ut(o))break;s=o}return s})(n.getLatest()),{direction:t}=e;if(R(e.origin))return At(e)?e:un(e.origin,t,t);const r=e.getAdjacentCaret();return Fn(r)&&R(r.origin)?un(r.origin,t,jn(t)):e}function lu(n){return At(n)&&n.offset!==Ot(n.origin,n.direction)}function Vt(n,e){return n.direction===e?n:n.getFlipped()}function dl(n,e){return n.direction===e?n:Gt(Vt(n.focus,e),Vt(n.anchor,e))}function Vg(n,e,t){let r=lt(n,"next");for(let i=0;i<e;i++){const s=r.getAdjacentCaret();if(s===null)break;r=s}return Vt(r,t)}function qy(n,e="root"){let t=0,r=n,i=hr(r);for(;i===null;){if(t--,i=r.getParentCaret(e),!i)return null;r=i,i=hr(r)}return i&&[i,t]}function Zy(n){const{origin:e,offset:t,direction:r}=n;if(t===Ot(e,r))return n.getSiblingCaret();if(t===Ot(e,jn(r)))return hi(n.getSiblingCaret());const[i]=e.splitText(t);return R(i)||D(281),Vt(xe(i,"next"),r)}function Xy(n,e){return!0}function Yg(n,{$copyElementNode:e=Qc,$splitTextPointCaretNext:t=Zy,rootMode:r="shadowRoot",$shouldSplit:i=Xy}={}){if(At(n))return t(n);const s=n.getParentCaret(r);if(s){const{origin:o}=s;if(ut(n)&&(!o.canBeEmpty()||!i(o,"first")))return hi(s);const l=(function(a){const c=[];for(let u=a.getAdjacentCaret();u;u=u.getAdjacentCaret())c.push(u.origin);return c})(n);(l.length>0||o.canBeEmpty()&&i(o,"last"))&&s.insert(e(o).splice(0,0,l))}return s}function Qy(n){return n}function qg(...n){return n}function eb(n,e){return[n,e]}function tb(n){return n}function Zg(n,e){if(!e||n===e)return n;for(const t in e)if(n[t]!==e[t])return{...n,...e};return n}function dn(...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 _e(n,...e){const t=dn(...e);t.length>0&&n.classList.add(...t)}function an(n,...e){const t=dn(...e);t.length>0&&n.classList.remove(...t)}function ft(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}const nb=Object.freeze(Object.defineProperty({__proto__:null,$addUpdateTag:Dg,$applyNodeReplacement:Le,$caretFromPoint:$t,$caretRangeFromSelection:vo,$cloneWithProperties:tu,$cloneWithPropertiesEphemeral:Ug,$comparePointCaretNext:su,$copyNode:Qc,$create:jg,$createLineBreakNode:ot,$createNodeSelection:Lc,$createParagraphNode:J,$createPoint:Ae,$createRangeSelection:ci,$createRangeSelectionFromDom:My,$createTabNode:yt,$createTextNode:he,$extendCaretToRange:al,$findMatchingParent:le,$getAdjacentChildCaret:hr,$getAdjacentNode:xo,$getAdjacentSiblingOrParentSiblingCaret:qy,$getCaretInDirection:Vt,$getCaretRange:Gt,$getCaretRangeInDirection:dl,$getCharacterOffsets:go,$getChildCaret:lt,$getChildCaretAtIndex:Vg,$getChildCaretOrSelf:Hg,$getCollapsedCaretRange:iu,$getCommonAncestor:zi,$getCommonAncestorResultBranchOrder:ou,$getEditor:fi,$getNearestNodeFromDOMNode:dt,$getNearestRootOrShadowRoot:zg,$getNodeByKey:Q,$getNodeByKeyOrThrow:Zn,$getNodeFromDOMNode:Hc,$getPreviousSelection:_n,$getRoot:de,$getSelection:M,$getSiblingCaret:xe,$getState:ji,$getStateChange:cy,$getTextContent:$y,$getTextNodeOffset:Ot,$getTextPointCaret:un,$getTextPointCaretSlice:Ga,$getWritableNodeState:Ko,$hasAncestor:So,$hasUpdateTag:By,$insertNodes:Xo,$isBlockElementNode:po,$isChildCaret:ut,$isDecoratorNode:Z,$isEditorState:xg,$isElementNode:A,$isExtendableTextPointCaret:lu,$isInlineElementOrDecoratorNode:Pg,$isLeafNode:jc,$isLineBreakNode:ue,$isNodeCaret:Hy,$isNodeSelection:je,$isParagraphNode:wr,$isRangeSelection:N,$isRootNode:ye,$isRootOrShadowRoot:Ue,$isSiblingCaret:Fn,$isTabNode:Je,$isTextNode:R,$isTextPointCaret:At,$isTextPointCaretSlice:Yy,$isTokenOrSegmented:Et,$isTokenOrTab:Nn,$nodesOfType:zy,$normalizeCaret:et,$normalizeSelection__EXPERIMENTAL:Mn,$onUpdate:Lg,$parseSerializedNode:_g,$removeTextFromCaretRange:Gg,$rewindSiblingCaret:hi,$selectAll:Yc,$setCompositionKey:Ie,$setPointFromCaret:Rn,$setSelection:Re,$setSelectionFromCaretRange:ul,$setState:Hs,$splitAtPointCaretNext:Yg,$splitNode:Uy,$updateRangeSelectionFromCaretRange:Bi,ArtificialNode__DO_NOT_USE:el,BEFORE_INPUT_COMMAND:kc,BLUR_COMMAND:ai,CAN_REDO_COMMAND:Ni,CAN_UNDO_COMMAND:Ai,CLEAR_EDITOR_COMMAND:$c,CLEAR_HISTORY_COMMAND:Gh,CLICK_COMMAND:mr,COLLABORATION_TAG:sg,COMMAND_PRIORITY_CRITICAL:Bc,COMMAND_PRIORITY_EDITOR:B,COMMAND_PRIORITY_HIGH:Cg,COMMAND_PRIORITY_LOW:q,COMMAND_PRIORITY_NORMAL:Sg,COMPOSITION_END_COMMAND:Ac,COMPOSITION_START_COMMAND:Nc,CONTROLLED_TEXT_INSERTION_COMMAND:Tn,COPY_COMMAND:_r,CUT_COMMAND:li,DELETE_CHARACTER_COMMAND:Nt,DELETE_LINE_COMMAND:lr,DELETE_WORD_COMMAND:or,DRAGEND_COMMAND:Jh,DRAGOVER_COMMAND:Ic,DRAGSTART_COMMAND:Yo,DROP_COMMAND:Vo,DecoratorNode:ps,ElementNode:Se,FOCUS_COMMAND:Fc,FORMAT_ELEMENT_COMMAND:Mc,FORMAT_TEXT_COMMAND:ve,HISTORIC_TAG:ho,HISTORY_MERGE_TAG:Wr,HISTORY_PUSH_TAG:ig,INDENT_CONTENT_COMMAND:Bt,INPUT_COMMAND:Tc,INSERT_LINE_BREAK_COMMAND:ln,INSERT_PARAGRAPH_COMMAND:In,INSERT_TAB_COMMAND:ao,INTERNAL_$isBlock:ct,IS_ALL_FORMATTING:W_,IS_BOLD:D_,IS_CODE:B_,IS_HIGHLIGHT:Cc,IS_ITALIC:L_,IS_STRIKETHROUGH:P_,IS_SUBSCRIPT:U_,IS_SUPERSCRIPT:K_,IS_UNDERLINE:z_,KEY_ARROW_DOWN_COMMAND:ar,KEY_ARROW_LEFT_COMMAND:hs,KEY_ARROW_RIGHT_COMMAND:jo,KEY_ARROW_UP_COMMAND:cn,KEY_BACKSPACE_COMMAND:Jo,KEY_DELETE_COMMAND:Go,KEY_DOWN_COMMAND:Oc,KEY_ENTER_COMMAND:$n,KEY_ESCAPE_COMMAND:oi,KEY_MODIFIER_COMMAND:Vh,KEY_SPACE_COMMAND:Ho,KEY_TAB_COMMAND:gs,LineBreakNode:yr,MOVE_TO_END:lo,MOVE_TO_START:Vi,NODE_STATE_KEY:ry,OUTDENT_CONTENT_COMMAND:nn,PASTE_COMMAND:ri,PASTE_TAG:Rc,ParagraphNode:Kn,REDO_COMMAND:si,REMOVE_TEXT_COMMAND:Gi,RootNode:Cr,SELECTION_CHANGE_COMMAND:ni,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:Ec,SELECT_ALL_COMMAND:Vr,SKIP_COLLAB_TAG:Cy,SKIP_DOM_SELECTION_TAG:lg,SKIP_SCROLL_INTO_VIEW_TAG:og,SKIP_SELECTION_FOCUS_TAG:Wa,TEXT_TYPE_TO_FORMAT:ze,TabNode:br,TextNode:qe,UNDO_COMMAND:ii,addClassNamesToElement:_e,buildImportMap:Sy,configExtension:qg,createCommand:U,createEditor:ui,createSharedNodeState:zh,createState:vc,declarePeerDependency:eb,defineExtension:Qy,flipDirection:jn,getDOMOwnerDocument:Zc,getDOMSelection:Ct,getDOMSelectionFromTarget:Bg,getDOMTextNode:cr,getEditorPropertyFromDOMNode:_s,getNearestEditorFromDOMNode:il,getRegisteredNode:tl,getRegisteredNodeOrThrow:Kc,getStaticNodeConfig:bs,getTextDirection:Tg,getTransformSetFromKlass:vg,isBlockDomNode:qi,isCurrentlyReadOnlyMode:Sr,isDOMDocumentNode:Wc,isDOMNode:Wn,isDOMTextNode:Yt,isDOMUnmanaged:Wg,isDocumentFragment:Co,isExactShortcutMatch:re,isHTMLAnchorElement:eu,isHTMLElement:ne,isInlineDomNode:wo,isLexicalEditor:rl,isModifierMatch:Fg,isSelectionCapturedInDecoratorInput:nl,isSelectionWithinEditor:di,makeStepwiseIterator:cl,mergeRegister:ft,normalizeClassNames:dn,removeClassNamesFromElement:an,removeFromParent:Wt,resetRandomKey:Ly,safeCast:tb,setDOMUnmanaged:Kg,setNodeIndentFromDOM:ol,shallowMergeConfig:Zg},Symbol.toStringTag,{value:"Module"}));function rb(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 Eo=new Map;function Xg(n){const e={};if(!n)return e;const t=n.split(";");for(const r of t)if(r!==""){const[i,s]=r.split(/:([^]+)/);i&&s&&(e[i.trim()]=s.trim())}return e}function Xi(n){let e=Eo.get(n);return e===void 0&&(e=Xg(n),Eo.set(n,e)),e}function ib(n){let e="";for(const t in n)t&&(e+=`${t}: ${n[t]};`);return e}function Qg(n){const e=fi().getElementByKey(n.getKey());if(e===null)return null;const t=e.ownerDocument.defaultView;return t===null?null:t.getComputedStyle(e)}function ep(n){return Qg(ye(n)?n:n.getParentOrThrow())}function zd(n){const e=ep(n);return e!==null&&e.direction==="rtl"}function tp(n,e,t="self"){const r=n.getStartEndPoints();if(e.isSelected(n)&&!Et(e)&&r!==null){const[i,s]=r,o=n.isBackward(),l=i.getNode(),a=s.getNode(),c=e.is(l),u=e.is(a);if(c||u){const[d,f]=go(n),h=l.is(a),g=e.is(o?a:l),p=e.is(o?l:a);let m,b=0;h?(b=d>f?f:d,m=d>f?d:f):g?(b=o?f:d,m=void 0):p&&(b=0,m=o?d:f);const _=e.__text.slice(b,m);_!==e.__text&&(t==="clone"&&(e=Ug(e)),e.__text=_)}}return e}function sb(n){const e=n.getStyle(),t=Xg(e);Eo.set(e,t)}function Fs(n,e){(N(n)?n.isCollapsed():R(n)||A(n))||rb(280);const t=Xi(N(n)?n.style:R(n)?n.getStyle():n.getTextStyle()),r=Object.entries(e).reduce((s,[o,l])=>(typeof l=="function"?s[o]=l(t[o],n):l===null?delete s[o]:s[o]=l,s),{...t}),i=ib(r);N(n)||R(n)?n.setStyle(i):n.setTextStyle(i),Eo.set(i,r)}function Rs(n,e){if(N(n)&&n.isCollapsed()){Fs(n,e);const r=n.anchor.getNode();A(r)&&r.isEmpty()&&Fs(r,e)}ob(r=>{Fs(r,e)});const t=n.getNodes();if(t.length>0){const r=new Set;for(const i of t){if(!A(i)||!i.canBeEmpty()||i.getChildrenSize()!==0)continue;const s=i.getKey();r.has(s)||(r.add(s),Fs(i,e))}}}function ob(n){const e=M();if(!e)return;const t=new Map,r=s=>t.get(s.getKey())||[0,s.getTextContentSize()];if(N(e))for(const s of vo(e).getTextSlices())s&&t.set(s.caret.origin.getKey(),s.getSliceIndices());const i=e.getNodes();for(const s of i){if(!R(s)||!s.canHaveFormat())continue;const[o,l]=r(s);l!==o&&(Et(s)||o===0&&l===s.getTextContentSize()?n(s):n(s.splitText(o,l)[o===0?0:1]))}N(e)&&e.anchor.type==="text"&&e.focus.type==="text"&&e.anchor.key===e.focus.key&&lb(e)}function lb(n){if(n.isBackward()){const{anchor:e,focus:t}=n,{key:r,offset:i,type:s}=e;e.set(t.key,t.offset,t.type),t.set(r,i,s)}}function ab(n,e){const t=n.getFormatType(),r=n.getIndent();t!==e.getFormatType()&&e.setFormat(t),r!==e.getIndent()&&e.setIndent(r)}function Qe(n,e,t=ab){if(n===null)return;const r=n.getStartEndPoints(),i=new Map;let s=null;if(r){const[o,l]=r;s=ci(),s.anchor.set(o.key,o.offset,o.type),s.focus.set(l.key,l.offset,l.type);const a=le(o.getNode(),ct),c=le(l.getNode(),ct);A(a)&&i.set(a.getKey(),a),A(c)&&i.set(c.getKey(),c)}for(const o of n.getNodes())if(A(o)&&ct(o))i.set(o.getKey(),o);else if(r===null){const l=le(o,ct);A(l)&&i.set(l.getKey(),l)}for(const[o,l]of i){const a=e();t(l,a),l.replace(a,!0),s&&(o===s.anchor.key&&s.anchor.set(a.getKey(),s.anchor.offset,s.anchor.type),o===s.focus.key&&s.focus.set(a.getKey(),s.focus.offset,s.focus.type))}s&&n.is(M())&&Re(s)}function np(n){const e=rp(n);return e!==null&&e.writingMode==="vertical-rl"}function rp(n){const e=n.anchor.getNode();return A(e)?Qg(e):ep(e)}function ko(n,e){let t=np(n)?!e:e;ip(n)&&(t=!t);const r=$t(n.focus,t?"previous":"next");if(lu(r))return!1;for(const i of al(r)){if(ut(i))return!i.origin.isInline();if(!A(i.origin)){if(Z(i.origin))return!0;break}}return!1}function cb(n,e,t,r){n.modify(e?"extend":"move",t,r)}function ip(n){const e=rp(n);return e!==null&&e.direction==="rtl"}function To(n,e,t){const r=ip(n);let i;i=np(n)||r?!t:t,cb(n,e,i,"character")}function ub(n,e,t){const r=Xi(n.getStyle());return r!==null&&r[e]||t}function Ds(n,e,t=""){let r=null;const i=n.getNodes(),s=n.anchor,o=n.focus,l=n.isBackward(),a=l?o.offset:s.offset,c=l?o.getNode():s.getNode();if(N(n)&&n.isCollapsed()&&n.style!==""){const u=Xi(n.style);if(u!==null&&e in u)return u[e]}for(let u=0;u<i.length;u++){const d=i[u];if((u===0||a!==0||!d.is(c))&&R(d)){const f=ub(d,e,t);if(r===null)r=f;else if(r!==f){r="";break}}}return r===null?t:r}function sp(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 fl=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,db=fl&&"documentMode"in document?document.documentMode:null,fb=fl&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);!(!fl||!("InputEvent"in window)||db)&&"getTargetRanges"in new window.InputEvent("input");const hb=fl,gb=fb;function pb(n){return n?n.getAdjacentCaret():null}function mb(n,e){let t=n;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function _b(n){const e=le(n,t=>A(t)&&!t.isInline());return A(e)||sp(4,n.__key),e}function yb(n){const e=M()||_n();let t;if(N(e))t=$t(e.focus,"next");else{if(e!=null){const o=e.getNodes(),l=o[o.length-1];l&&(t=xe(l,"next"))}t=t||lt(de(),"previous").getFlipped().insert(J())}const r=bb(n,t),i=hr(r),s=ut(i)?et(i):r;return ul(iu(s)),n.getLatest()}function bb(n,e,t){let r=Vt(e,"next");for(let i=r;i;i=Yg(i,t))r=i;return At(r)&&sp(283),r.insert(n.isInline()?J().append(n):n),Vt(xe(n.getLatest(),"next"),e.direction)}function rn(n,e){return n!==null&&Object.getPrototypeOf(n).constructor.name===e.name}let ta=!(gb||!hb)&&void 0;function xb(n,e=!1){let t=1;if((function(){if(ta===void 0){const r=document.createElement("div");r.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(r);const i=r.getBoundingClientRect();r.style.setProperty("zoom","2"),ta=r.getBoundingClientRect().width===i.width,document.body.removeChild(r)}return ta})()||e)for(;n;)t*=Number(window.getComputedStyle(n).getPropertyValue("zoom")),n=n.parentElement;return t}function op(n,e){return lp(n,e,null)}function lp(n,e,t){let r=!1;for(const i of cp(n))e(i)?t!==null&&t(i):(r=!0,A(i)&&lp(i,e,t||(s=>i.insertAfter(s))),i.remove());return r}function ap(n,e){const t=[],r=Array.from(n).reverse();for(let i=r.pop();i!==void 0;i=r.pop())if(e(i))t.push(i);else if(A(i))for(const s of cp(i))r.push(s);return t}function cp(n){return Sb(lt(n,"previous"))}function Sb(n){return cl({hasNext:Fn,initial:n.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}function up(n,e){const t=Wc(e)?e.body.childNodes:e.childNodes;let r=[];const i=[];for(const s of t)if(!hp.has(s.nodeName)){const o=gp(s,n,i,!1);o!==null&&(r=r.concat(o))}return(function(s){for(const o of s)o.getNextSibling()instanceof el&&o.insertAfter(ot());for(const o of s){const l=o.getChildren();for(const a of l)o.insertBefore(a);o.remove()}})(i),r}function dp(n,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),r=de().getChildren();for(let i=0;i<r.length;i++)fp(n,r[i],t,e);return t.innerHTML}function fp(n,e,t,r=null){let i=r===null||e.isSelected(r);const s=A(e)&&e.excludeFromCopy("html");let o=e;r!==null&&R(e)&&(o=tp(r,e,"clone"));const l=A(o)?o.getChildren():[],a=tl(n,o.getType());let c;c=a&&a.exportDOM!==void 0?a.exportDOM(n,o):o.exportDOM(n);const{element:u,after:d}=c;if(!u)return!1;const f=document.createDocumentFragment();for(let h=0;h<l.length;h++){const g=l[h],p=fp(n,g,f,r);!i&&A(e)&&p&&e.extractWithChild(g,r,"html")&&(i=!0)}if(i&&!s){if((ne(u)||Co(u))&&u.append(f),t.append(u),d){const h=d.call(o,u);h&&(Co(u)?u.replaceChildren(h):u.replaceWith(h))}}else t.append(f);return i}const hp=new Set(["STYLE","SCRIPT"]);function gp(n,e,t,r,i=new Map,s){let o=[];if(hp.has(n.nodeName))return o;let l=null;const a=(function(g,p){const{nodeName:m}=g,b=p._htmlConversions.get(m.toLowerCase());let _=null;if(b!==void 0)for(const y of b){const C=y(g);C!==null&&(_===null||(_.priority||0)<=(C.priority||0))&&(_=C)}return _!==null?_.conversion:null})(n,e),c=a?a(n):null;let u=null;if(c!==null){u=c.after;const g=c.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,p]of i)if(l=p(l,s),!l)break;l&&o.push(...Array.isArray(g)?g:[l])}c.forChild!=null&&i.set(n.nodeName,c.forChild)}const d=n.childNodes;let f=[];const h=(l==null||!Ue(l))&&(l!=null&&po(l)||r);for(let g=0;g<d.length;g++)f.push(...gp(d[g],e,t,h,new Map(i),l));return u!=null&&(f=u(f)),qi(n)&&(f=Cb(n,f,h?()=>{const g=new el;return t.push(g),g}:J)),l==null?f.length>0?o=o.concat(f):qi(n)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:wo(g.nextSibling)&&wo(g.previousSibling)})(n)&&(o=o.concat(ot())):A(l)&&l.append(...f),o}function Cb(n,e,t){const r=n.style.textAlign,i=[];let s=[];for(let o=0;o<e.length;o++){const l=e[o];if(po(l))r&&!l.getFormat()&&l.setFormat(r),i.push(l);else if(s.push(l),o===e.length-1||o<e.length-1&&po(e[o+1])){const a=t();a.setFormat(r),a.append(...s),i.push(a),s=[]}}return i}function No(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 pp(n,e=M()){return e==null&&No(166),N(e)&&e.isCollapsed()||e.getNodes().length===0?"":dp(n,e)}function wb(n,e=M()){return e==null&&No(166),N(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(vb(n,e))}function Bd(n,e){const t=n.getData("text/plain")||n.getData("text/uri-list");t!=null&&e.insertRawText(t)}function Ud(n,e,t){const r=n.getData("application/x-lexical-editor");if(r)try{const l=JSON.parse(r);if(l.namespace===t._config.namespace&&Array.isArray(l.nodes))return Kd(t,Eb(l.nodes),e)}catch(l){console.error(l)}const i=n.getData("text/html"),s=n.getData("text/plain");if(i&&s!==i)try{const l=new DOMParser().parseFromString((function(a){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:c=>c}).createHTML(a):a})(i),"text/html");return Kd(t,up(t,l),e)}catch(l){console.error(l)}const o=s||n.getData("text/uri-list");if(o!=null)if(N(e)){const l=o.split(/(\r?\n|\t)/);l[l.length-1]===""&&l.pop();for(let a=0;a<l.length;a++){const c=M();if(N(c)){const u=l[a];u===`
|
|
11
|
+
`?r.push(ut()):o===" "?r.push(Ct()):r.push(he(o))}this.insertNodes(r)}insertText(e){const t=this.anchor,r=this.focus,i=this.format,s=this.style;let o=t,l=r;!this.isCollapsed()&&r.isBefore(t)&&(o=r,l=t),o.type==="element"&&(function(m,b,_,y){const C=m.getNode(),S=C.getChildAtIndex(m.offset),w=he();if(w.setFormat(_),w.setStyle(y),Nr(S))S.splice(0,0,[w]);else{const x=_e(C)?H().append(w):w;S===null?C.append(x):S.insertBefore(x)}m.is(b)&&b.set(w.__key,0,"text"),m.set(w.__key,0,"text")})(o,l,i,s),l.type==="element"&&Bn(l,it(Dt(l,"next")));const a=o.offset;let c=l.offset;const u=this.getNodes(),d=u.length;let f=u[0];L(f)||R(26);const h=f.getTextContent().length,g=f.getParentOrThrow();let p=u[d-1];if(d===1&&l.type==="element"&&(c=h,l.set(o.key,c,"text")),this.isCollapsed()&&a===h&&(At(f)||!f.canInsertTextAfter()||!g.canInsertTextAfter()&&f.getNextSibling()===null)){let m=f.getNextSibling();if(L(m)&&m.canInsertTextBefore()&&!At(m)||(m=he(),m.setFormat(i),m.setStyle(s),g.canInsertTextAfter()?f.insertAfter(m):g.insertAfter(m)),m.select(0,0),f=m,e!=="")return void this.insertText(e)}else if(this.isCollapsed()&&a===0&&(At(f)||!f.canInsertTextBefore()||!g.canInsertTextBefore()&&f.getPreviousSibling()===null)){let m=f.getPreviousSibling();if(L(m)&&!At(m)||(m=he(),m.setFormat(i),g.canInsertTextBefore()?f.insertBefore(m):g.insertBefore(m)),m.select(),f=m,e!=="")return void this.insertText(e)}else if(f.isSegmented()&&a!==h){const m=he(f.getTextContent());m.setFormat(i),f.replace(m),f=m}else if(!this.isCollapsed()&&e!==""){const m=p.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||O(m)&&(!m.canInsertTextBefore()||!m.canInsertTextAfter()))return this.insertText(""),hg(this.anchor,this.focus,null),void this.insertText(e)}if(d===1){if($n(f)){const y=he(e);return y.select(),void f.replace(y)}const m=f.getFormat(),b=f.getStyle();if(a!==c||m===i&&b===s){if(Ye(f)){const y=he(e);return y.setFormat(i),y.setStyle(s),y.select(),void f.replace(y)}}else{if(f.getTextContent()!==""){const y=he(e);if(y.setFormat(i),y.setStyle(s),y.select(),a===0)f.insertBefore(y,!1);else{const[C]=f.splitText(a);C.insertAfter(y,!1)}return void(y.isComposing()&&this.anchor.type==="text"&&(this.anchor.offset-=e.length))}f.setFormat(i),f.setStyle(s)}const _=c-a;f=f.spliceText(a,_,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=m,this.style=b))}else{const m=new Set([...f.getParentKeys(),...p.getParentKeys()]),b=O(f)?f:f.getParentOrThrow();let _=O(p)?p:p.getParentOrThrow(),y=p;if(!b.is(_)&&_.isInline())do y=_,_=_.getParentOrThrow();while(_.isInline());if(l.type==="text"&&(c!==0||p.getTextContent()==="")||l.type==="element"&&p.getIndexWithinParent()<c)if(L(p)&&!$n(p)&&c!==p.getTextContentSize()){if(p.isSegmented()){const T=he(p.getTextContent());p.replace(T),p=T}_e(l.getNode())||l.type!=="text"||(p=p.spliceText(0,c,"")),m.add(p.__key)}else{const T=p.getParentOrThrow();T.canBeEmpty()||T.getChildrenSize()!==1?p.remove():T.remove()}else m.add(p.__key);const C=_.getChildren(),S=new Set(u),w=b.is(_),x=b.isInline()&&f.getNextSibling()===null?b:f;for(let T=C.length-1;T>=0;T--){const E=C[T];if(E.is(f)||O(E)&&E.isParentOf(f))break;E.isAttached()&&(!S.has(E)||E.is(y)?w||x.insertAfter(E,!1):E.remove())}if(!w){let T=_,E=null;for(;T!==null;){const I=T.getChildren(),$=I.length;($===0||I[$-1].is(E))&&(m.delete(T.__key),E=T),T=T.getParent()}}if($n(f))if(a===h)f.select();else{const T=he(e);T.select(),f.replace(T)}else f=f.spliceText(a,h-a,e,!0),f.getTextContent()===""?f.remove():this.anchor.type==="text"&&(f.isComposing()?this.anchor.offset-=e.length:(this.format=f.getFormat(),this.style=f.getStyle()));for(let T=1;T<d;T++){const E=u[T],I=E.__key;m.has(I)||E.remove()}}}removeText(){const e=M()===this;Hi(this,qg(Oo(this))),e&&M()!==this&&De(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void Fe(null);const r=this.getNodes(),i=[];for(const C of r)L(C)&&i.push(C);const s=C=>{r.forEach(S=>{if(O(S)){const w=S.getFormatFlags(e,C);S.setTextFormat(w)}})},o=i.length;if(o===0)return this.toggleFormat(e),Fe(null),void s(t);const l=this.anchor,a=this.focus,c=this.isBackward(),u=c?a:l,d=c?l:a;let f=0,h=i[0],g=u.type==="element"?0:u.offset;if(u.type==="text"&&g===h.getTextContentSize()&&(f=1,h=i[1],g=0),h==null)return;const p=h.getFormatFlags(e,t);s(p);const m=o-1;let b=i[m];const _=d.type==="text"?d.offset:b.getTextContentSize();if(h.is(b)){if(g===_)return;if(At(h)||g===0&&_===h.getTextContentSize())h.setFormat(p);else{const C=h.splitText(g,_),S=g===0?C[0]:C[1];S.setFormat(p),u.type==="text"&&u.set(S.__key,0,"text"),d.type==="text"&&d.set(S.__key,_-g,"text")}return void(this.format=p)}g===0||At(h)||([,h]=h.splitText(g),g=0),h.setFormat(p);const y=b.getFormatFlags(e,p);_>0&&(_===b.getTextContentSize()||At(b)||([b]=b.splitText(_)),b.setFormat(y));for(let C=f+1;C<m;C++){const S=i[C],w=S.getFormatFlags(e,y);S.setFormat(w)}u.type==="text"&&u.set(h.__key,g,"text"),d.type==="text"&&d.set(b.__key,_,"text"),this.format=p|y}insertNodes(e){if(e.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key==="root"){this.insertParagraph();const g=M();return N(g)||R(134),g.insertNodes(e)}const t=(this.isBackward()?this.focus:this.anchor).getNode(),r=le(t,ht),i=e[e.length-1];if(O(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else{const g=ea(this);r.splice(g,0,e),i.selectEnd()}return}if(!e.some(g=>(O(g)||Z(g))&&!g.isInline())){O(r)||R(211,t.constructor.name,t.getType());const g=ea(this);return r.splice(g,0,e),void i.selectEnd()}const s=(function(g){const p=H();let m=null;for(let b=0;b<g.length;b++){const _=g[b],y=ue(_);if(y||Z(_)&&_.isInline()||O(_)&&_.isInline()||L(_)||_.isParentRequired()){if(m===null&&(m=_.createParentElementNode(),p.append(m),y))continue;m!==null&&m.append(_)}else p.append(_),m=null}return p})(e),o=s.getLastDescendant(),l=s.getChildren(),a=!O(r)||!r.isEmpty()?this.insertParagraph():null,c=l[l.length-1];let u=l[0];var d;O(d=u)&&ht(d)&&!d.isEmpty()&&O(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(O(r)||R(211,t.constructor.name,t.getType()),r.append(...u.getChildren()),u=l[1]),u&&(r===null&&R(212,t.constructor.name,t.getType()),(function(g,p){const m=p.getParentOrThrow().getLastChild();let b=p;const _=[p];for(;b!==m;)b.getNextSibling()||R(140),b=b.getNextSibling(),_.push(b);let y=g;for(const C of _)y=y.insertAfter(C)})(r,u));const f=le(o,ht);a&&O(f)&&(a.canMergeWhenEmpty()||ht(c))&&(f.append(...a.getChildren()),a.remove()),O(r)&&r.isEmpty()&&r.remove(),o.selectEnd();const h=O(r)?r.getLastChild():null;ue(h)&&f!==r&&h.remove()}insertParagraph(){if(this.anchor.key==="root"){const o=H();return de().splice(this.anchor.offset,0,[o]),o.select(),o}const e=ea(this),t=le(this.anchor.getNode(),ht);O(t)||R(213);const r=t.getChildAtIndex(e),i=r?[r,...r.getNextSiblings()]:[],s=t.insertNewAfter(this,!1);return s?(s.append(...i),s.selectStart(),s):null}insertLineBreak(e){const t=ut();if(this.insertNodes([t]),e){const r=t.getParentOrThrow(),i=t.getIndexWithinParent();r.select(i,i)}}extract(){const e=[...this.getNodes()],t=e.length;let r=e[0],i=e[t-1];const[s,o]=xo(this),l=this.isBackward(),[a,c]=l?[this.focus,this.anchor]:[this.anchor,this.focus],[u,d]=l?[o,s]:[s,o];if(t===0)return[];if(t===1){if(L(r)&&!this.isCollapsed()){const f=r.splitText(u,d),h=u===0?f[0]:f[1];return h?(a.set(h.getKey(),0,"text"),c.set(h.getKey(),h.getTextContentSize(),"text"),[h]):[]}return[r]}if(L(r)&&(u===r.getTextContentSize()?e.shift():u!==0&&([,r]=r.splitText(u),e[0]=r,a.set(r.getKey(),0,"text"))),L(i)){const f=i.getTextContent().length;d===0?e.pop():d!==f&&([i]=i.splitText(d),e[e.length-1]=i,c.set(i.getKey(),i.getTextContentSize(),"text"))}return e}modify(e,t,r){if(kd(this,e,t,r))return;const i=e==="move",s=se(),o=kt(Et(s));if(!o)return;const l=s._blockCursorElement,a=s._rootElement,c=this.focus.getNode();if(a===null||l===null||!O(c)||c.isInline()||c.canBeEmpty()||qa(l,s,a),this.dirty){let u=pr(s,this.anchor.key),d=pr(s,this.focus.key);this.anchor.type==="text"&&(u=gr(u)),this.focus.type==="text"&&(d=gr(d)),u&&d&&mg(o,u,this.anchor.offset,d,this.focus.offset)}if((function(u,d,f,h){u.modify(d,f,h)})(o,e,t?"backward":"forward",r),o.rangeCount>0){const u=o.getRangeAt(0),d=this.anchor.getNode(),f=_e(d)?d:Kg(d);if(this.applyDOMRange(u),this.dirty=!0,!i){const h=this.getNodes(),g=[];let p=!1;for(let m=0;m<h.length;m++){const b=h[m];To(b,f)?g.push(b):p=!0}if(p&&g.length>0)if(t){const m=g[0];O(m)?m.selectStart():m.getParentOrThrow().selectStart()}else{const m=g[g.length-1];O(m)?m.selectEnd():m.getParentOrThrow().selectEnd()}o.anchorNode===u.startContainer&&o.anchorOffset===u.startOffset||(function(m){const b=m.focus,_=m.anchor,y=_.key,C=_.offset,S=_.type;_.set(b.key,b.offset,b.type,!0),b.set(y,C,S,!0)})(this)}}r==="lineboundary"&&kd(this,e,t,r,"decorators")}forwardDeletion(e,t,r){if(!r&&(e.type==="element"&&O(t)&&e.offset===t.getChildrenSize()||e.type==="text"&&e.offset===t.getTextContentSize())){const i=t.getParent(),s=t.getNextSibling()||(i===null?null:i.getNextSibling());if(O(s)&&s.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const r=this.anchor;let i=r.getNode();if(this.forwardDeletion(r,i,e))return;const s=gl(Dt(r,e?"previous":"next"));if(s.getTextSlices().every(l=>l===null||l.distance===0)){let l={type:"initial"};for(const a of s.iterNodeCarets("shadowRoot"))if(gt(a)){if(!a.origin.isInline()){if(a.origin.isShadowRoot()){if(l.type==="merge-block")break;if(O(s.anchor.origin)&&s.anchor.origin.isEmpty()){const c=it(a);Hi(this,qt(c,c)),s.anchor.origin.remove()}return}l.type!=="merge-next-block"&&l.type!=="merge-block"||(l={block:l.block,caret:a,type:"merge-block"})}}else{if(l.type==="merge-block")break;if(zn(a)){if(O(a.origin)){if(a.origin.isInline()){if(!a.origin.isParentOf(s.anchor.origin))break}else l={block:a.origin,type:"merge-next-block"};continue}if(Z(a.origin)){if(!a.origin.isIsolated())if(l.type==="merge-next-block"&&(a.origin.isKeyboardSelectable()||!a.origin.isInline())&&O(s.anchor.origin)&&s.anchor.origin.isEmpty()){s.anchor.origin.remove();const c=Kc();c.add(a.origin.getKey()),De(c)}else a.origin.remove();return}break}}if(l.type==="merge-block"){const{caret:a,block:c}=l;return Hi(this,qt(!a.origin.isEmpty()&&c.isEmpty()?yi(be(c,a.direction)):s.anchor,a)),this.removeText()}}const o=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&r.offset===0&&xd(this,r.getNode()))return}else{const l=o.type==="text"?o.getNode():null;if(i=r.type==="text"?r.getNode():null,l!==null&&l.isSegmented()){const a=o.offset,c=l.getTextContentSize();if(l.is(i)||e&&a!==c||!e&&a!==0)return void Sd(l,e,a)}else if(i!==null&&i.isSegmented()){const a=r.offset,c=i.getTextContentSize();if(i.is(l)||e&&a!==0||!e&&a!==c)return void Sd(i,e,a)}(function(a,c){const u=a.anchor,d=a.focus,f=u.getNode(),h=d.getNode();if(f===h&&u.type==="text"&&d.type==="text"){const g=u.offset,p=d.offset,m=g<p,b=m?g:p,_=m?p:g,y=_-1;b!==y&&(function(C){return!(Fg(C)||Iy(C))})(f.getTextContent().slice(b,_))&&(c?d.set(d.key,y,d.type):u.set(u.key,y,u.type))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type==="element"&&this.anchor.offset===0){const r=this.anchor.getNode();r.isEmpty()&&_e(r.getParent())&&r.getPreviousSibling()===null&&xd(this,r)}}deleteLine(e){this.isCollapsed()&&this.modify("extend",e,"lineboundary"),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){const t=this.anchor,r=t.getNode();if(this.forwardDeletion(t,r,e))return;this.modify("extend",e,"word")}this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}}function Ge(n){return n instanceof nl}function bd(n){const e=n.offset;if(n.type==="text")return e;const t=n.getNode();return e===t.getChildrenSize()?t.getTextContent().length:0}function xo(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]:[bd(t),bd(r)]}function xd(n,e){for(let t=e;t;t=t.getParent()){if(O(t)){if(t.collapseAtStart(n))return!0;if(We(t))break}if(t.getPreviousSibling())break}return!1}const Iy=(()=>{try{const n=new RegExp("\\p{Emoji}","u"),e=n.test.bind(n);if(e("❤️")&&e("#️⃣")&&e("👍"))return e}catch{}return()=>!1})();function Sd(n,e,t){const r=n,i=r.getTextContent().split(/(?=\s)/g),s=i.length;let o=0,l=0;for(let c=0;c<s;c++){const u=c===s-1;if(l=o,o+=i[c].length,e&&o===t||o>t||u){i.splice(c,1),u&&(l=void 0);break}}const a=i.join("").trim();a===""?r.remove():(r.setTextContent(a),r.select(l,l))}function Cd(n,e,t,r){let i,s=e;if(ne(n)){let o=!1;const l=n.childNodes,a=l.length,c=r._blockCursorElement;s===a&&(o=!0,s=a-1);let u=l[s],d=!1;if(u===c)u=l[s+1],d=!0;else if(c!==null){const f=c.parentNode;n===f&&e>Array.prototype.indexOf.call(f.children,c)&&s--}if(i=Jr(u),L(i))s=Ft(i,o?"next":"previous");else{let f=Jr(n);if(f===null)return null;if(O(f)){const h=r.getElementByKey(f.getKey());h===null&&R(214),[f,s]=f.getDOMSlot(h).resolveChildIndex(f,h,n,e),O(f)||R(215),o&&s>=f.getChildrenSize()&&(s=Math.max(0,f.getChildrenSize()-1));let p=f.getChildAtIndex(s);if(O(p)&&(function(m,b,_){const y=m.getParent();return _===null||y===null||!y.canBeEmpty()||y!==_.getNode()})(p,0,t)){const m=o?p.getLastDescendant():p.getFirstDescendant();m===null?f=p:(p=m,f=O(p)?p:p.getParentOrThrow()),s=0}L(p)?(i=p,f=null,s=Ft(p,o?"next":"previous")):p!==f&&o&&!d&&(O(f)||R(216),s=Math.min(f.getChildrenSize(),s+1))}else{const h=f.getIndexWithinParent();s=e===0&&Z(f)&&Jr(n)===f?h:h+1,f=f.getParentOrThrow()}if(O(f))return Me(f.__key,s,"element")}}else i=Jr(n);return L(i)?Me(i.__key,Ft(i,s,"clamp"),"text"):null}function wd(n,e,t){const r=n.offset,i=n.getNode();if(r===0){const s=i.getPreviousSibling(),o=i.getParent();if(e){if((t||!e)&&s===null&&O(o)&&o.isInline()){const l=o.getPreviousSibling();L(l)&&n.set(l.__key,l.getTextContent().length,"text")}}else O(s)&&!t&&s.isInline()?n.set(s.__key,s.getChildrenSize(),"element"):L(s)&&n.set(s.__key,s.getTextContent().length,"text")}else if(r===i.getTextContent().length){const s=i.getNextSibling(),o=i.getParent();if(e&&O(s)&&s.isInline())n.set(s.__key,0,"element");else if((t||e)&&s===null&&O(o)&&o.isInline()&&!o.canInsertTextAfter()){const l=o.getNextSibling();L(l)&&n.set(l.__key,0,"text")}}}function hg(n,e,t){if(n.type==="text"&&e.type==="text"){const r=n.isBefore(e),i=n.is(e);wd(n,r,i),wd(e,!r,i),i&&e.set(n.key,n.offset,n.type);const s=se();if(s.isComposing()&&s._compositionKey!==n.key&&N(t)){const o=t.anchor,l=t.focus;n.set(o.key,o.offset,o.type,!0),e.set(l.key,l.offset,l.type,!0)}}}function gg(n,e,t,r,i,s){if(n===null||t===null||!mi(i,n,t))return null;const o=Cd(n,e,N(s)?s.anchor:null,i);if(o===null)return null;const l=Cd(t,r,N(s)?s.focus:null,i);if(l===null)return null;if(o.type==="element"&&l.type==="element"){const a=Jr(n),c=Jr(t);if(Z(a)&&Z(c))return null}return hg(o,l,s),[o,l]}function So(n){return O(n)&&!n.isInline()}function pg(n,e,t,r,i,s){const o=Cn(),l=new Er(Me(n,e,i),Me(t,r,s),0,"");return l.dirty=!0,o._selection=l,l}function gi(){const n=Me("root",0,"element"),e=Me("root",0,"element");return new Er(n,e,0,"")}function Kc(){return new nl(new Set)}function $y(n,e){return rl(null,n,e,null)}function rl(n,e,t,r){const i=t._window;if(i===null)return null;const s=r||i.event,o=s?s.type:void 0,l=o==="selectionchange",a=!$a&&(l||o==="beforeinput"||o==="compositionstart"||o==="compositionend"||o==="click"&&s&&s.detail===3||o==="drop"||o===void 0);let c,u,d,f;if(N(n)&&!a)return n.clone();if(e===null)return null;if(c=e.anchorNode,u=e.focusNode,d=e.anchorOffset,f=e.focusOffset,(l||o===void 0)&&N(n)&&!mi(t,c,u))return n.clone();const h=gg(c,d,u,f,t,n);if(h===null)return null;const[g,p]=h;return new Er(g,p,N(n)?n.format:0,N(n)?n.style:"")}function M(){return Cn()._selection}function Sn(){return se()._editorState._selection}function Co(n,e,t,r=1){const i=n.anchor,s=n.focus,o=i.getNode(),l=s.getNode();if(!e.is(o)&&!e.is(l))return;const a=e.__key;if(n.isCollapsed()){const c=i.offset;if(t<=c&&r>0||t<c&&r<0){const u=Math.max(0,c+r);i.set(a,u,"element"),s.set(a,u,"element"),vd(n)}}else{const c=n.isBackward(),u=c?s:i,d=u.getNode(),f=c?i:s,h=f.getNode();if(e.is(d)){const g=u.offset;(t<=g&&r>0||t<g&&r<0)&&u.set(a,Math.max(0,g+r),"element")}if(e.is(h)){const g=f.offset;(t<=g&&r>0||t<g&&r<0)&&f.set(a,Math.max(0,g+r),"element")}}vd(n)}function vd(n){const e=n.anchor,t=e.offset,r=n.focus,i=r.offset,s=e.getNode(),o=r.getNode();if(n.isCollapsed()){if(!O(s))return;const l=s.getChildrenSize(),a=t>=l,c=a?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(L(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text"),r.set(c.__key,u,"text")}return}if(O(s)){const l=s.getChildrenSize(),a=t>=l,c=a?s.getChildAtIndex(l-1):s.getChildAtIndex(t);if(L(c)){let u=0;a&&(u=c.getTextContentSize()),e.set(c.__key,u,"text")}}if(O(o)){const l=o.getChildrenSize(),a=i>=l,c=a?o.getChildAtIndex(l-1):o.getChildAtIndex(i);if(L(c)){let u=0;a&&(u=c.getTextContentSize()),r.set(c.__key,u,"text")}}}function wo(n,e,t,r,i){let s=null,o=0,l=null;r!==null?(s=r.__key,L(r)?(o=r.getTextContentSize(),l="text"):O(r)&&(o=r.getChildrenSize(),l="element")):i!==null&&(s=i.__key,L(i)?l="text":O(i)&&(l="element")),s!==null&&l!==null?n.set(s,o,l):(o=e.getIndexWithinParent(),o===-1&&(o=t.getChildrenSize()),n.set(t.__key,o,"element"))}function Ed(n,e,t,r,i){n.type==="text"?n.set(t,n.offset+(e?0:i),"text"):n.offset>r.getIndexWithinParent()&&n.set(n.key,n.offset-1,"element")}function mg(n,e,t,r,i){try{n.setBaseAndExtent(e,t,r,i)}catch{}}function Fy(n,e,t,r,i,s,o){const l=r.anchorNode,a=r.focusNode,c=r.anchorOffset,u=r.focusOffset,d=document.activeElement;if(i.has(ag)&&d!==s||d!==null&&al(d))return;if(!N(e))return void(n!==null&&mi(t,l,a)&&r.removeAllRanges());const f=e.anchor,h=e.focus,g=f.key,p=h.key,m=pr(t,g),b=pr(t,p),_=f.offset,y=h.offset,C=e.format,S=e.style,w=e.isCollapsed();let x=m,T=b,E=!1;if(f.type==="text"){x=gr(m);const F=f.getNode();E=F.getFormat()!==C||F.getStyle()!==S}else N(n)&&n.anchor.type==="text"&&(E=!0);var I,$,k,D,K;if(h.type==="text"&&(T=gr(b)),x!==null&&T!==null&&(w&&(n===null||E||N(n)&&(n.format!==C||n.style!==S))&&(I=C,$=S,k=_,D=g,K=performance.now(),eg=[I,$,k,D,K]),c!==_||u!==y||l!==x||a!==T||r.type==="Range"&&w||(d!==null&&s.contains(d)||i.has(Va)||s.focus({preventScroll:!0}),f.type==="element"))){if(mg(r,x,_,T,y),!Ln||!e.isCollapsed()||s===null||i.has(Va)||document.activeElement!==null&&s.contains(document.activeElement)||s.focus({preventScroll:!0}),!i.has(cg)&&e.isCollapsed()&&s!==null&&s===document.activeElement){const F=N(e)&&e.anchor.type==="element"?x.childNodes[_]||null:r.rangeCount>0?r.getRangeAt(0):null;if(F!==null){let W;if(F instanceof Text){const G=document.createRange();G.selectNode(F),W=G.getBoundingClientRect()}else W=F.getBoundingClientRect();(function(G,J,oe){const He=nu(oe),Tt=ru(He);if(He===null||Tt===null)return;let{top:j,bottom:Se}=J,fe=0,et=0,Ee=oe;for(;Ee!==null;){const Je=Ee===He.body;if(Je)fe=0,et=Et(G).innerHeight;else{const V=Ee.getBoundingClientRect();fe=V.top,et=V.bottom}let tt=0;if(j<fe?tt=-(fe-j):Se>et&&(tt=Se-et),tt!==0)if(Je)Tt.scrollBy(0,tt);else{const V=Ee.scrollTop;Ee.scrollTop+=tt;const ke=Ee.scrollTop-V;j-=ke,Se-=ke}if(Je)break;Ee=vs(Ee)}})(t,W,s)}}Wa=!0}}function il(n){let e=M()||Sn();e===null&&(e=de().selectEnd()),e.insertNodes(n)}function Ly(){const n=M();return n===null?"":n.getTextContent()}function ea(n){let e=n;n.isCollapsed()||e.removeText();const t=M();N(t)&&(e=t),N(e)||R(161);const r=e.anchor;let i=r.getNode(),s=r.offset;for(;!ht(i);){const o=i;if([i,s]=Ry(i,s),o.is(i))break}return s}function Ry(n,e){const t=n.getParent();if(!t){const i=H();return de().append(i),i.select(),[de(),0]}if(L(n)){const i=n.splitText(e);if(i.length===0)return[t,n.getIndexWithinParent()];const s=e===0?0:1;return[t,i[0].getIndexWithinParent()+s]}if(!O(n)||e===0)return[t,n.getIndexWithinParent()];const r=n.getChildAtIndex(e);if(r){const i=new Er(Me(n.__key,e,"element"),Me(n.__key,e,"element"),0,""),s=n.insertNewAfter(i);s&&s.append(r,...r.getNextSiblings())}return[t,n.getIndexWithinParent()+1]}function kd(n,e,t,r,i="decorators-and-blocks"){if(e==="move"&&r==="character"&&!n.isCollapsed()){const[u,d]=t===n.isBackward()?[n.focus,n.anchor]:[n.anchor,n.focus];return d.set(u.key,u.offset,u.type),!0}const s=Dt(n.focus,t?"previous":"next"),o=r==="lineboundary",l=e==="move";let a=s,c=i==="decorators-and-blocks";if(!fu(a)){for(const u of a){c=!1;const{origin:d}=u;if(!Z(d)||d.isIsolated()||(a=u,!o||!d.isInline()))break}if(c)for(const u of gl(s).iterNodeCarets(e==="extend"?"shadowRoot":"root")){if(gt(u))u.origin.isInline()||(a=u);else{if(O(u.origin))continue;Z(u.origin)&&!u.origin.isInline()&&(a=u)}break}}if(a===s)return!1;if(l&&!o&&Z(a.origin)&&a.origin.isKeyboardSelectable()){const u=Kc();return u.add(a.origin.getKey()),De(u),!0}return a=it(a),l&&Bn(n.anchor,a),Bn(n.focus,a),c||!o}let Le=null,Re=null,at=!1,ta=!1,eo=0;const Td={characterData:!0,childList:!0,subtree:!0};function kr(){return at||Le!==null&&Le._readOnly}function $e(){at&&R(13)}function _g(){eo>99&&R(14)}function Cn(){return Le===null&&R(195,yg()),Le}function se(){return Re===null&&R(196,yg()),Re}function yg(){let n=0;const e=new Set,t=ei.version;if(typeof window<"u")for(const i of document.querySelectorAll("[contenteditable]")){const s=ws(i);if(cl(s))n++;else if(s){let o=String(s.constructor.version||"<0.17.1");o===t&&(o+=" (separately built, likely a bundler configuration issue)"),e.add(o)}}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 Dy(){return Re}function Nd(n,e,t){const r=e.__type,i=Gc(n,r);let s=t.get(r);s===void 0&&(s=Array.from(i.transforms),t.set(r,s));const o=s.length;for(let l=0;l<o&&(s[l](e),e.isAttached());l++);}function Ad(n,e){return n!==void 0&&n.__key!==e&&n.isAttached()}function bg(n,e){if(!e)return;const t=n._updateTags;let r=e;Array.isArray(e)||(r=[e]);for(const i of r)t.add(i)}function xg(n){return Wc(n,se()._nodes)}function Wc(n,e){const t=n.type,r=e.get(t);r===void 0&&R(17,t);const i=r.klass;n.type!==i.getType()&&R(18,i.name);const s=i.importJSON(n),o=n.children;if(O(s)&&Array.isArray(o))for(let l=0;l<o.length;l++){const a=Wc(o[l],e);s.append(a)}return s}function Od(n,e,t){const r=Le,i=at,s=Re;Le=e,at=!0,Re=n;try{return t()}finally{Le=r,at=i,Re=s}}function sn(n,e){const t=n._pendingEditorState,r=n._rootElement,i=n._headless||r===null;if(t===null)return;const s=n._editorState,o=s._selection,l=t._selection,a=n._dirtyType!==0,c=Le,u=at,d=Re,f=n._updating,h=n._observer;let g=null;if(n._pendingEditorState=null,n._editorState=t,!i&&a&&h!==null){Re=n,Le=t,at=!1,n._updating=!0;try{const w=n._dirtyType,x=n._dirtyElements,T=n._dirtyLeaves;h.disconnect(),g=my(s,t,n,w,x,T)}catch(w){if(w instanceof Error&&n._onError(w),ta)throw w;return kg(n,null,r,t),Uh(n),n._dirtyType=2,ta=!0,sn(n,s),void(ta=!1)}finally{h.observe(r,Td),n._updating=f,Le=c,at=u,Re=d}}t._readOnly||(t._readOnly=!0);const p=n._dirtyLeaves,m=n._dirtyElements,b=n._normalizedNodes,_=n._updateTags,y=n._deferred;a&&(n._dirtyType=0,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements=new Map,n._normalizedNodes=new Set,n._updateTags=new Set),(function(w,x){const T=w._decorators;let E=w._pendingDecorators||T;const I=x._nodeMap;let $;for($ in E)I.has($)||(E===T&&(E=Ig(w)),delete E[$])})(n,t);const C=i?null:kt(Et(n));if(n._editable&&C!==null&&(a||l===null||l.dirty||!l.is(o))&&r!==null&&!_.has(ug)){Re=n,Le=t;try{if(h!==null&&h.disconnect(),a||l===null||l.dirty){const w=n._blockCursorElement;w!==null&&qa(w,n,r),Fy(o,l,n,C,_,r)}(function(w,x,T){let E=w._blockCursorElement;if(N(T)&&T.isCollapsed()&&T.anchor.type==="element"&&x.contains(document.activeElement)){const I=T.anchor,$=I.getNode(),k=I.offset;let D=!1,K=null;if(k===$.getChildrenSize())ra($.getChildAtIndex(k-1))&&(D=!0);else{const F=$.getChildAtIndex(k);if(F!==null&&ra(F)){const W=F.getPreviousSibling();(W===null||ra(W))&&(D=!0,K=w.getElementByKey(F.__key))}}if(D){const F=w.getElementByKey($.__key);return E===null&&(w._blockCursorElement=E=(function(W){const G=W.theme,J=document.createElement("div");J.contentEditable="false",J.setAttribute("data-lexical-cursor","true");let oe=G.blockCursor;if(oe!==void 0){if(typeof oe=="string"){const He=pn(oe);oe=G.blockCursor=He}oe!==void 0&&J.classList.add(...oe)}return J})(w._config)),x.style.caretColor="transparent",void(K===null?F.appendChild(E):F.insertBefore(E,K))}}E!==null&&qa(E,w,x)})(n,r,l)}finally{h!==null&&h.observe(r,Td),Re=d,Le=c}}g!==null&&(function(w,x,T,E,I){const $=Array.from(w._listeners.mutation),k=$.length;for(let D=0;D<k;D++){const[K,F]=$[D];for(const W of F){const G=x.get(W);G!==void 0&&K(G,{dirtyLeaves:E,prevEditorState:I,updateTags:T})}}})(n,g,_,p,s),N(l)||l===null||o!==null&&o.is(l)||n.dispatchCommand(li,void 0);const S=n._pendingDecorators;S!==null&&(n._decorators=S,n._pendingDecorators=null,Ki("decorator",n,!0,S)),(function(w,x,T){const E=Fd(x),I=Fd(T);E!==I&&Ki("textcontent",w,!0,I)})(n,e||s,t),Ki("update",n,!0,{dirtyElements:m,dirtyLeaves:p,editorState:t,mutatedNodes:g,normalizedNodes:b,prevEditorState:e||s,tags:_}),(function(w,x){if(w._deferred=[],x.length!==0){const T=w._updating;w._updating=!0;try{for(let E=0;E<x.length;E++)x[E]()}finally{w._updating=T}}})(n,y),(function(w){const x=w._updates;if(x.length!==0){const T=x.shift();if(T){const[E,I]=T;sl(w,E,I)}}})(n)}function Ki(n,e,t,...r){const i=e._updating;e._updating=t;try{const s=Array.from(e._listeners[n]);for(let o=0;o<s.length;o++)s[o].apply(null,r)}finally{e._updating=i}}function Md(n,e){const t=n._updates;let r=e||!1;for(;t.length!==0;){const i=t.shift();if(i){const[s,o]=i,l=n._pendingEditorState;let a;o!==void 0&&(a=o.onUpdate,o.skipTransforms&&(r=!0),o.discrete&&(l===null&&R(191),l._flushSync=!0),a&&n._deferred.push(a),bg(n,o.tag)),l==null?sl(n,s,o):s()}}return r}function sl(n,e,t){const r=n._updateTags;let i,s=!1,o=!1;t!==void 0&&(i=t.onUpdate,bg(n,t.tag),s=t.skipTransforms||!1,o=t.discrete||!1),i&&n._deferred.push(i);const l=n._editorState;let a=n._pendingEditorState,c=!1;(a===null||a._readOnly)&&(a=n._pendingEditorState=Sg(a||l),c=!0),a._flushSync=o;const u=Le,d=at,f=Re,h=n._updating;Le=a,at=!1,n._updating=!0,Re=n;const g=n._headless||n.getRootElement()===null;Jc(null);try{c&&(g?l._selection!==null&&(a._selection=l._selection.clone()):a._selection=(function(_,y){const C=_.getEditorState()._selection,S=kt(Et(_));return N(C)||C==null?rl(C,S,_,y):C.clone()})(n,t&&t.event||null));const m=n._compositionKey;e(),s=Md(n,s),(function(_,y){const C=y.getEditorState()._selection,S=_._selection;if(N(S)){const w=S.anchor,x=S.focus;let T;if(w.type==="text"&&(T=w.getNode(),T.selectionTransform(C,S)),x.type==="text"){const E=x.getNode();T!==E&&E.selectionTransform(C,S)}}})(a,n),n._dirtyType!==0&&(s?(function(_,y){const C=y._dirtyLeaves,S=_._nodeMap;for(const w of C){const x=S.get(w);L(x)&&x.isAttached()&&x.isSimpleText()&&!x.isUnmergeable()&&ld(x)}})(a,n):(function(_,y){const C=y._dirtyLeaves,S=y._dirtyElements,w=_._nodeMap,x=An(),T=new Map;let E=C,I=E.size,$=S,k=$.size;for(;I>0||k>0;){if(I>0){y._dirtyLeaves=new Set;for(const D of E){const K=w.get(D);L(K)&&K.isAttached()&&K.isSimpleText()&&!K.isUnmergeable()&&ld(K),K!==void 0&&Ad(K,x)&&Nd(y,K,T),C.add(D)}if(E=y._dirtyLeaves,I=E.size,I>0){eo++;continue}}y._dirtyLeaves=new Set,y._dirtyElements=new Map,$.delete("root")&&$.set("root",!0);for(const D of $){const K=D[0],F=D[1];if(S.set(K,F),!F)continue;const W=w.get(K);W!==void 0&&Ad(W,x)&&Nd(y,W,T)}E=y._dirtyLeaves,I=E.size,$=y._dirtyElements,k=$.size,eo++}y._dirtyLeaves=C,y._dirtyElements=S})(a,n),Md(n),(function(_,y,C,S){const w=_._nodeMap,x=y._nodeMap,T=[];for(const[E]of S){const I=x.get(E);I!==void 0&&(I.isAttached()||(O(I)&&Ph(I,E,w,x,T,S),w.has(E)||S.delete(E),T.push(E)))}for(const E of T)x.delete(E);for(const E of C){const I=x.get(E);I===void 0||I.isAttached()||(w.has(E)||C.delete(E),x.delete(E))}})(l,a,n._dirtyLeaves,n._dirtyElements)),m!==n._compositionKey&&(a._flushSync=!0);const b=a._selection;if(N(b)){const _=a._nodeMap,y=b.anchor.key,C=b.focus.key;_.get(y)!==void 0&&_.get(C)!==void 0||R(19)}else Ge(b)&&b._nodes.size===0&&(a._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 sn(n)}finally{Le=u,at=d,Re=f,n._updating=h,eo=0}n._dirtyType!==0||n._deferred.length>0||(function(m,b){const _=b.getEditorState()._selection,y=m._selection;if(y!==null){if(y.dirty||!y.is(_))return!0}else if(_!==null)return!0;return!1})(a,n)?a._flushSync?(a._flushSync=!1,sn(n)):c&&By(()=>{sn(n)}):(a._flushSync=!1,c&&(r.clear(),n._deferred=[],n._pendingEditorState=null))}function Ht(n,e,t){Re===n&&t===void 0?e():sl(n,e,t)}class Wi{element;before;after;constructor(e,t,r){this.element=e,this.before=t||null,this.after=r||null}withBefore(e){return new Wi(this.element,e,this.after)}withAfter(e){return new Wi(this.element,this.before,e)}withElement(e){return this.element===e?this:new Wi(e,this.before,this.after)}insertChild(e){const t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&R(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&R(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&R(224),this.element.replaceChild(e,t),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{const t=e==="decorator"&&(ys||oi||_s);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,r=e.nodeName==="IMG"?e.nextSibling:null;r&&t.removeChild(r),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===(t.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,i=this.before,s=document.createElement("br");if(r.insertBefore(s,i),e){const o=document.createElement("img");o.setAttribute("data-lexical-linebreak","true"),o.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",o.alt="",r.insertBefore(o,s),r.__lexicalLineBreak=o}else r.__lexicalLineBreak=s}getFirstChildOffset(){let e=0;for(let t=this.after;t!==null;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,r,i){if(r===this.element){const a=this.getFirstChildOffset();return[e,Math.min(a+e.getChildrenSize(),Math.max(a,i))]}const s=Id(t,r);s.push(i);const o=Id(t,this.element);let l=e.getIndexWithinParent();for(let a=0;a<o.length;a++){const c=s[a],u=o[a];if(c===void 0||c<u)break;if(c>u){l+=1;break}}return[e.getParentOrThrow(),l]}}function Id(n,e){const t=[];let r=e;for(;r!==n&&r!==null;r=r.parentNode){let i=0;for(let s=r.previousSibling;s!==null;s=s.previousSibling)i++;t.push(i)}return r!==n&&R(225),t.reverse()}class xe extends jt{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return ny[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){const e=se()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;t!==null;){if(L(t)&&e.push(t),O(t)){const r=t.getAllTextNodes();e.push(...r)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;O(e);){const t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;O(e);){const t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),r=t.length;if(e>=r){const s=t[r-1];return O(s)&&s.getLastDescendant()||s||null}const i=t[e];return O(i)&&i.getFirstDescendant()||i||null}getFirstChild(){const e=this.getLatest().__first;return e===null?null:Q(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return e===null&&R(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return e===null?null:Q(e)}getLastChildOrThrow(){const e=this.getLastChild();return e===null&&R(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let r,i;if(e<t/2){for(r=this.getFirstChild(),i=0;r!==null&&i<=e;){if(i===e)return r;r=r.getNextSibling(),i++}return null}for(r=this.getLastChild(),i=t-1;r!==null&&i>=e;){if(i===e)return r;r=r.getPreviousSibling(),i--}return null}getTextContent(){let e="";const t=this.getChildren(),r=t.length;for(let i=0;i<r;i++){const s=t[i];e+=s.getTextContent(),O(s)&&i!==r-1&&!s.isInline()&&(e+=Go)}return e}getTextContentSize(){let e=0;const t=this.getChildren(),r=t.length;for(let i=0;i<r;i++){const s=t[i];e+=s.getTextContentSize(),O(s)&&i!==r-1&&!s.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==""){const t=Qu[e];return(this.getFormat()&t)!==0}return!1}hasTextFormat(e){const t=Ue[e];return(this.getTextFormat()&t)!==0}getFormatFlags(e,t){return vo(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){$e();const r=M();let i=e,s=t;const o=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){const a=this.getFirstChild();if(L(a)||O(a))return a.select(0,0)}else if(!(e!==void 0&&e!==o||t!==void 0&&t!==o)){const a=this.getLastChild();if(L(a)||O(a))return a.select()}}i===void 0&&(i=o),s===void 0&&(s=o);const l=this.__key;return N(r)?(r.anchor.set(l,i,"element"),r.focus.set(l,s,"element"),r.dirty=!0,r):pg(l,i,l,s,"element","element")}selectStart(){const e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){const e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){const e=this.getWritable();return this.getChildren().forEach(t=>t.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==""?Qu[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,r){yo(this)&&R(324,this.__key,this.__type);const i=this.getChildrenSize(),s=this.getWritable();e+t<=i||R(226,String(e),String(t),String(i));const o=s.__key,l=[],a=[],c=this.getChildAtIndex(e+t);let u=null,d=i-t+r.length;if(e!==0)if(e===i)u=this.getLastChild();else{const h=this.getChildAtIndex(e);h!==null&&(u=h.getPreviousSibling())}if(t>0){let h=u===null?this.getFirstChild():u.getNextSibling();for(let g=0;g<t;g++){h===null&&R(100);const p=h.getNextSibling(),m=h.__key;Jt(h.getWritable()),a.push(m),h=p}}let f=u;for(const h of r){f!==null&&h.is(f)&&(u=f=f.getPreviousSibling());const g=h.getWritable();g.__parent===o&&d--,Jt(g);const p=h.__key;if(f===null)s.__first=p,g.__prev=null;else{const m=f.getWritable();m.__next=p,g.__prev=m.__key}h.__key===o&&R(76),g.__parent=o,l.push(p),f=h}if(e+t===i)f!==null&&(f.getWritable().__next=null,s.__last=f.__key);else if(c!==null){const h=c.getWritable();if(f!==null){const g=f.getWritable();h.__prev=f.__key,g.__next=c.__key}else h.__prev=null}if(s.__size=d,a.length){const h=M();if(N(h)){const g=new Set(a),p=new Set(l),{anchor:m,focus:b}=h;$d(m,g,p)&&wo(m,m.getNode(),this,u,c),$d(b,g,p)&&wo(b,b.getNode(),this,u,c),d!==0||this.canBeEmpty()||We(this)||this.remove()}}return s}getDOMSlot(e){return new Wi(e)}exportDOM(e){const{element:t}=super.exportDOM(e);if(ne(t)){const r=this.getIndent();r>0&&(t.style.paddingInlineStart=40*r+"px");const i=this.getDirection();i&&(t.dir=i)}return{element:t}}exportJSON(){const e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),r=this.getTextStyle();return t===0&&r===""||We(this)||this.getChildren().some(L)||(t!==0&&(e.textFormat=t),r!==""&&(e.textStyle=r)),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,r){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const r=this.getDOMSlot(e);let i=r.getFirstChild();for(let s=this.getFirstChild();s;s=s.getNextSibling()){const o=t.getElementByKey(s.getKey());o!==null&&(i==null?(r.insertChild(o),i=o):i!==o&&r.replaceChild(o,i),i=i.nextSibling)}}}function O(n){return n instanceof xe}function $d(n,e,t){let r=n.getNode();for(;r;){const i=r.__key;if(e.has(i)&&!t.has(i))return!0;r=r.getParent()}return!1}class Ss extends jt{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Z(n){return n instanceof Ss}class Tr extends xe{__cachedText;static getType(){return"root"}static clone(){return new Tr}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){R(51)}getTextContent(){const e=this.__cachedText;return!kr()&&se()._dirtyType!==0||e===null?super.getTextContent():e}remove(){R(52)}replace(e){R(53)}insertBefore(e){R(54)}insertAfter(e){R(55)}updateDOM(e,t){return!1}splice(e,t,r){for(const i of r)O(i)||Z(i)||R(282);return super.splice(e,t,r)}static importJSON(e){return de().updateFromJSON(e)}collapseAtStart(){return!0}}function _e(n){return n instanceof Tr}function Sg(n){return new Cs(new Map(n._nodeMap))}function jc(){return new Cs(new Map([["root",new Tr]]))}function Cg(n){const e=n.exportJSON(),t=n.constructor;if(e.type!==t.getType()&&R(130,t.name),O(n)){const r=e.children;Array.isArray(r)||R(59,t.name);const i=n.getChildren();for(let s=0;s<i.length;s++){const o=Cg(i[s]);r.push(o)}}return e}function wg(n){return n instanceof Cs}class Cs{_nodeMap;_selection;_flushSync;_readOnly;constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return Od(t&&t.editor||null,this,e)}clone(e){const t=new Cs(this._nodeMap,e===void 0?this._selection:e);return t._readOnly=!0,t}toJSON(){return Od(null,this,()=>({root:Cg(de())}))}}class ol extends xe{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Vn extends xe{static getType(){return"paragraph"}static clone(e){return new Vn(e.__key)}createDOM(e){const t=document.createElement("p"),r=Yr(e.theme,"paragraph");return r!==void 0&&t.classList.add(...r),t}updateDOM(e,t,r){return!1}static importDOM(){return{p:e=>({conversion:Py,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(ne(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();r&&(t.style.textAlign=r)}return{element:t}}static importJSON(e){return H().updateFromJSON(e)}exportJSON(){const e=super.exportJSON();if(e.textFormat===void 0||e.textStyle===void 0){const t=this.getChildren().find(L);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){const r=H();r.setTextFormat(e.format),r.setTextStyle(e.style);const i=this.getDirection();return r.setDirection(i),r.setFormat(this.getFormatType()),r.setStyle(this.getStyle()),this.insertAfter(r,t),r}collapseAtStart(){const e=this.getChildren();if(e.length===0||L(e[0])&&e[0].getTextContent().trim()===""){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}}function Py(n){const e=H();return n.style&&(e.setFormat(n.style.textAlign),fl(n,e)),{node:e}}function H(){return ze(new Vn)}function Nr(n){return n instanceof Vn}const B=0,q=1,vg=2,Eg=3,Hc=4;function kg(n,e,t,r){const i=n._keyToDOMMap;i.clear(),n._editorState=jc(),n._pendingEditorState=r,n._compositionKey=null,n._dirtyType=0,n._cloneNotNeeded.clear(),n._dirtyLeaves=new Set,n._dirtyElements.clear(),n._normalizedNodes=new Set,n._updateTags=new Set,n._updates=[],n._blockCursorElement=null;const s=n._observer;s!==null&&(s.disconnect(),n._observer=null),e!==null&&(e.textContent=""),t!==null&&(t.textContent="",i.set("root",t))}function Tg(n){const e=new Set,t=new Set;let r=n;for(;r;){const{ownNodeConfig:i}=Es(r),s=r.transform;if(!t.has(s)){t.add(s);const o=r.transform();o&&e.add(o)}if(i){const o=i.$transform;o&&e.add(o),r=i.extends}else{const o=Object.getPrototypeOf(r);r=o.prototype instanceof jt&&o!==jt?o:void 0}}return e}function pi(n){const e=n||{},t=Dy(),r=e.theme||{},i=n===void 0?t:e.parentEditor||null,s=e.disableEvents||!1,o=jc(),l=e.namespace||(i!==null?i._config.namespace:Lg()),a=e.editorState,c=[Tr,Qe,wr,vr,Vn,ol,...e.nodes||[]],{onError:u,html:d}=e,f=e.editable===void 0||e.editable;let h;if(n===void 0&&t!==null)h=t._nodes;else{h=new Map;for(let p=0;p<c.length;p++){let m=c[p],b=null,_=null;if(typeof m!="function"){const S=m;m=S.replace,b=S.with,_=S.withKlass||null}Es(m);const y=m.getType(),C=Tg(m);h.set(y,{exportDOM:d&&d.export?d.export.get(m):void 0,klass:m,replace:b,replaceWithKlass:_,sharedNodeState:Kh(c[p]),transforms:C})}}const g=new ei(o,i,h,{disableEvents:s,namespace:l,theme:r},u||console.error,(function(p,m){const b=new Map,_=new Set,y=C=>{Object.keys(C).forEach(S=>{let w=b.get(S);w===void 0&&(w=[],b.set(S,w)),w.push(C[S])})};return p.forEach(C=>{const S=C.klass.importDOM;if(S==null||_.has(S))return;_.add(S);const w=S.call(C.klass);w!==null&&y(w)}),m&&y(m),b})(h,d?d.import:void 0),f,n);return a!==void 0&&(g._pendingEditorState=a,g._dirtyType=2),(function(p){p.registerCommand(Mc,_y,B),p.registerCommand(Ic,yy,B),p.registerCommand($c,by,B),p.registerCommand(Fc,xy,B),p.registerCommand(Lc,Sy,B)})(g),g}class ei{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(e,t,r,i,s,o,l,a){this._createEditorArgs=a,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=i,this._nodes=r,this._decorators={},this._pendingDecorators=null,this._dirtyType=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=Lg(),this._onError=s,this._htmlConversions=o,this._editable=l,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,t,r){r===void 0&&R(35);const i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);const s=i.get(e);s===void 0&&R(36,String(e));const o=s[r];return o.add(t),()=>{o.delete(t),s.every(l=>l.size===0)&&i.delete(e)}}registerMutationListener(e,t,r){const i=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,s=this._listeners.mutation;let o=s.get(t);o===void 0&&(o=new Set,s.set(t,o)),o.add(i);const l=r&&r.skipInitialization;return l!==void 0&&l||this.initializeMutationListener(t,i),()=>{o.delete(i),o.size===0&&s.delete(t)}}getRegisteredNode(e){const t=this._nodes.get(e.getType());return t===void 0&&R(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const r=this._editorState,i=Za(r).get(t.getType());if(!i)return;const s=new Map;for(const o of i.keys())s.set(o,"created");s.size>0&&e(s,{dirtyLeaves:new Set,prevEditorState:r,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const r=this.getRegisteredNode(e);return r.transforms.add(t),r}registerNodeTransform(e,t){const r=this.registerNodeTransformToKlass(e,t),i=[r],s=r.replaceWithKlass;if(s!=null){const o=this.registerNodeTransformToKlass(s,t);i.push(o)}return(function(o,l){const a=Za(o.getEditorState()),c=[];for(const u of l){const d=a.get(u);d&&c.push(d)}c.length!==0&&o.update(()=>{for(const u of c)for(const d of u.keys()){const f=Q(d);f&&f.markDirty()}},o._pendingEditorState===null?{tag:Vr}:void 0)})(this,i.map(o=>o.klass.getType())),()=>{i.forEach(o=>o.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return z(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const r=Yr(this._config.theme,"root"),i=this._pendingEditorState||this._editorState;if(this._rootElement=e,kg(this,t,e,i),t!==null&&(this._config.disableEvents||Cy(t),r!=null&&t.classList.remove(...r)),e!==null){const s=ru(e),o=e.style;o.userSelect="text",o.whiteSpace="pre-wrap",o.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=s,this._dirtyType=2,Uh(this),this._updateTags.add(Vr),sn(this),this._config.disableEvents||(function(l,a){const c=l.ownerDocument;Ka.set(l,c);const u=mo.get(c)??0;u<1&&c.addEventListener("selectionchange",sg),mo.set(c,u+1),l.__lexicalEditor=a;const d=ig(l);for(let f=0;f<Ua.length;f++){const[h,g]=Ua[f],p=typeof g=="function"?m=>{gd(m)||(hd(m),(a.isEditable()||h==="click")&&g(m,a))}:m=>{if(gd(m))return;hd(m);const b=a.isEditable();switch(h){case"cut":return b&&z(a,fi,m);case"copy":return z(a,Cr,m);case"paste":return b&&z(a,ai,m);case"dragstart":return b&&z(a,tl,m);case"dragover":return b&&z(a,Dc,m);case"dragend":return b&&z(a,Yh,m);case"focus":return b&&z(a,zc,m);case"blur":return b&&z(a,hi,m);case"drop":return b&&z(a,el,m)}};l.addEventListener(h,p),d.push(()=>{l.removeEventListener(h,p)})}})(e,this),r!=null&&e.classList.add(...r)}else this._window=null,this._updateTags.add(Vr),sn(this);Ki("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&R(38);let r=e;r._readOnly&&(r=Sg(e),r._selection=e._selection?e._selection.clone():null),Bh(this);const i=this._pendingEditorState,s=this._updateTags,o=t!==void 0?t.tag:null;i===null||i.isEmpty()||(o!=null&&s.add(o),sn(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,o!=null&&s.add(o),this._updating||sn(this)}parseEditorState(e,t){return(function(r,i,s){const o=jc(),l=Le,a=at,c=Re,u=i._dirtyElements,d=i._dirtyLeaves,f=i._cloneNotNeeded,h=i._dirtyType;i._dirtyElements=new Map,i._dirtyLeaves=new Set,i._cloneNotNeeded=new Set,i._dirtyType=0,Le=o,at=!1,Re=i,Jc(null);try{const g=i._nodes;Wc(r.root,g),s&&s(),o._readOnly=!0}catch(g){g instanceof Error&&i._onError(g)}finally{i._dirtyElements=u,i._dirtyLeaves=d,i._cloneNotNeeded=f,i._dirtyType=h,Le=l,at=a,Re=c}return o})(typeof e=="string"?JSON.parse(e):e,this,t)}read(e){return sn(this),this.getEditorState().read(e,{editor:this})}update(e,t){(function(r,i,s){r._updating?r._updates.push([i,s]):sl(r,i,s)})(this,e,t)}focus(e,t={}){const r=this._rootElement;r!==null&&(r.setAttribute("autocapitalize","off"),Ht(this,()=>{const i=M(),s=de();i!==null?i.dirty||De(i.clone()):s.getChildrenSize()!==0&&(t.defaultSelection==="rootStart"?s.selectStart():s.selectEnd()),zg("focus"),Bg(()=>{r.removeAttribute("autocapitalize"),e&&e()})}),this._pendingEditorState===null&&r.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;e!==null&&e.blur();const t=kt(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Ki("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}ei.version="0.40.0+prod.esm";let Ya=null;function Jc(n){Ya=n}let Ng=1;function zy(){Ng=1}function Gc(n,e){const t=ll(n,e);return t===void 0&&R(30,e),t}function ll(n,e){return n._nodes.get(e)}const By=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function Ag(n){return Z(pt(n))}function al(n){const e=document.activeElement;if(!ne(e))return!1;const t=e.nodeName;return Z(pt(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&ws(e)==null)}function mi(n,e,t){const r=n.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(t)&&e!==null&&!al(e)&&ul(e)===n}catch{return!1}}function cl(n){return n instanceof ei}function ul(n){let e=n;for(;e!=null;){const t=ws(e);if(cl(t))return t;e=vs(e)}return null}function ws(n){return n?n.__lexicalEditor:null}function Og(n){return Q_.test(n)?"rtl":ey.test(n)?"ltr":null}function $n(n){return Ye(n)||n.isToken()}function At(n){return $n(n)||n.isSegmented()}function Xt(n){return Yn(n)&&n.nodeType===3}function Vc(n){return Yn(n)&&n.nodeType===9}function gr(n){let e=n;for(;e!=null;){if(Xt(e))return e;e=e.firstChild}return null}function vo(n,e,t){const r=Ue[e];if(t!==null&&(n&r)===(t&r))return n;let i=n^r;return e==="subscript"?i&=~Ue.superscript:e==="superscript"?i&=~Ue.subscript:e==="lowercase"?(i&=~Ue.uppercase,i&=~Ue.capitalize):e==="uppercase"?(i&=~Ue.lowercase,i&=~Ue.capitalize):e==="capitalize"&&(i&=~Ue.lowercase,i&=~Ue.uppercase),i}function Yc(n){return L(n)||ue(n)||Z(n)}function Mg(n,e){const t=(function(){const o=Ya;return Ya=null,o})();if((e=e||t&&t.__key)!=null)return void(n.__key=e);$e(),_g();const r=se(),i=Cn(),s=""+Ng++;i._nodeMap.set(s,n),O(n)?r._dirtyElements.set(s,!0):r._dirtyLeaves.add(s),r._cloneNotNeeded.add(s),r._dirtyType=1,n.__key=s}function Jt(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),i=n.getPreviousSibling(),s=n.getNextSibling(),o=s!==null?s.__key:null,l=i!==null?i.__key:null,a=i!==null?i.getWritable():null,c=s!==null?s.getWritable():null;i===null&&(r.__first=o),s===null&&(r.__last=l),a!==null&&(a.__next=o),c!==null&&(c.__prev=l),t.__prev=null,t.__next=null,t.__parent=null,r.__size--}}function Eo(n){_g(),yo(n)&&R(323,n.__key,n.__type);const e=n.getLatest(),t=e.__parent,r=Cn(),i=se(),s=r._nodeMap,o=i._dirtyElements;t!==null&&(function(a,c,u){let d=a;for(;d!==null;){if(u.has(d))return;const f=c.get(d);if(f===void 0)break;u.set(d,!1),d=f.__parent}})(t,s,o);const l=e.__key;i._dirtyType=1,O(n)?o.set(l,!0):i._dirtyLeaves.add(l)}function Fe(n){$e();const e=se(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const r=Q(t);r!==null&&r.getWritable()}if(n!==null){const r=Q(n);r!==null&&r.getWritable()}}}function An(){return kr()?null:se()._compositionKey}function Q(n,e){const t=(e||Cn())._nodeMap.get(n);return t===void 0?null:t}function qc(n,e){const t=dl(n,se());return t!==void 0?Q(t,e):null}function dl(n,e){return n[`__lexicalKey_${e._key}`]}function pt(n,e){let t=n;for(;t!=null;){const r=qc(t,e);if(r!==null)return r;t=vs(t)}return null}function Ig(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function Fd(n){return n.read(()=>de().getTextContent())}function de(){return $g(Cn())}function $g(n){return n._nodeMap.get("root")}function De(n){$e();const e=Cn();n!==null&&(n.dirty=!0,n.setCachedNodes(null)),e._selection=n}function Jr(n){const e=se(),t=(function(r,i){let s=r;for(;s!=null;){const o=dl(s,i);if(o!==void 0)return o;s=vs(s)}return null})(n,e);return t===null?n===e.getRootElement()?Q("root"):null:Q(t)}function Fg(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function Zc(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Lg(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Rg(n){return Xt(n)?n.nodeValue:null}function Xc(n,e,t){const r=kt(Et(e));if(r===null)return;const i=r.anchorNode;let{anchorOffset:s,focusOffset:o}=r;if(i!==null){let l=Rg(i);const a=pt(i);if(l!==null&&L(a)){if(l===Jo&&t){const c=t.length;l=t,s=c,o=c}l!==null&&Qc(a,l,s,o,n)}}}function Qc(n,e,t,r,i){let s=n;if(s.isAttached()&&(i||!s.isDirty())){const o=s.isComposing();let l=e;(o||i)&&e[e.length-1]===Jo&&(l=e.slice(0,-1));const a=s.getTextContent();if(i||l!==a){if(l===""){if(Fe(null),_s||oi||ys)s.remove();else{const p=se();setTimeout(()=>{p.update(()=>{s.isAttached()&&s.remove()})},20)}return}const c=s.getParent(),u=Sn(),d=s.getTextContentSize(),f=An(),h=s.getKey();if(s.isToken()||f!==null&&h===f&&!o||N(u)&&(c!==null&&!c.canInsertTextBefore()&&u.anchor.offset===0||u.anchor.key===n.__key&&u.anchor.offset===0&&!s.canInsertTextBefore()&&!o||u.focus.key===n.__key&&u.focus.offset===d&&!s.canInsertTextAfter()&&!o))return void s.markDirty();const g=M();if(!N(g)||t===null||r===null)return void Ld(s,l,g);if(g.setTextNodeRange(s,t,s,r),s.isSegmented()){const p=he(s.getTextContent());s.replace(p),s=p}Ld(s,l,g)}}}function Ld(n,e,t){if(n.setTextContent(e),N(t)){const r=n.getKey();for(const i of["anchor","focus"]){const s=t[i];s.type==="text"&&s.key===r&&(s.offset=Ft(n,s.offset,"clamp"))}}}function Ps(n,e,t){const r=e[t]||!1;return r==="any"||r===n[t]}function Dg(n,e){return Ps(n,e,"altKey")&&Ps(n,e,"ctrlKey")&&Ps(n,e,"shiftKey")&&Ps(n,e,"metaKey")}function re(n,e,t){return Dg(n,t)&&n.key.toLowerCase()===e.toLowerCase()}const rn={ctrlKey:!Ot,metaKey:Ot},Rd={altKey:Ot,ctrlKey:!Ot};function Dd(n){return n.key==="Backspace"}function Pd(n){return re(n,"a",rn)}function eu(n){const e=de();if(N(n)){const t=n.anchor,r=n.focus,i=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();return t.set(i.getKey(),0,"element"),r.set(i.getKey(),i.getChildrenSize(),"element"),Rn(n),n}{const t=e.select(0,e.getChildrenSize());return De(Rn(t)),t}}function Yr(n,e){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const t=n.__lexicalClassNameCache,r=t[e];if(r!==void 0)return r;const i=n[e];if(typeof i=="string"){const s=pn(i);return t[e]=s,s}return i}function tu(n,e,t,r,i){if(t.size===0)return;const s=r.__type,o=r.__key,l=e.get(s);l===void 0&&R(33,s);const a=l.klass;let c=n.get(a);c===void 0&&(c=new Map,n.set(a,c));const u=c.get(o),d=u==="destroyed"&&i==="created";(u===void 0||d)&&c.set(o,d?"updated":i)}function Uy(n){const e=n.getType(),t=Cn();if(t._readOnly){const s=Za(t).get(e);return s?Array.from(s.values()):[]}const r=t._nodeMap,i=[];for(const[,s]of r)s instanceof n&&s.__type===e&&s.isAttached()&&i.push(s);return i}function zd(n,e,t){const r=n.getParent();let i=t,s=n;return r!==null&&(e&&t===0?(i=s.getIndexWithinParent(),s=r):e||t!==s.getChildrenSize()||(i=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(e?i-1:i)}function ko(n,e){const t=n.offset;if(n.type==="element")return zd(n.getNode(),e,t);{const r=n.getNode();if(e&&t===0||!e&&t===r.getTextContentSize()){const i=e?r.getPreviousSibling():r.getNextSibling();return i===null?zd(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):i}}return null}function Pg(n){const e=Et(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function z(n,e,t){return(function(r,i,s){const o=Zc(r);for(let l=4;l>=0;l--)for(let a=0;a<o.length;a++){const c=o[a],u=c._commands.get(i);if(u!==void 0){const d=u[l];if(d!==void 0){const f=Array.from(d),h=f.length;let g=!1;if(Ht(c,()=>{for(let p=0;p<h;p++)if(f[p](s,r))return void(g=!0)}),g)return g}}}return!1})(n,e,t)}function pr(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&R(75,e),t}function vs(n){const e=n.assignedSlot||n.parentElement;return No(e)?e.host:e}function nu(n){return Vc(n)?n:ne(n)?n.ownerDocument:null}function Ky(n){return se()._updateTags.has(n)}function zg(n){$e(),se()._updateTags.add(n)}function Bg(n){$e(),se()._deferred.push(n)}function To(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function ru(n){const e=nu(n);return e?e.defaultView:null}function Et(n){const e=n._window;return e===null&&R(78),e}function Ug(n){return O(n)&&n.isInline()||Z(n)&&n.isInline()}function Kg(n){let e=n.getParentOrThrow();for(;e!==null;){if(We(e))return e;e=e.getParentOrThrow()}return e}function We(n){return _e(n)||O(n)&&n.isShadowRoot()}function iu(n){const e=n.constructor.clone(n);return Mg(e,null),e.afterCloneFrom(n),e}function ze(n){const e=se(),t=n.getType(),r=ll(e,t);r===void 0&&R(200,n.constructor.name,t);const{replace:i,replaceWithKlass:s}=r;if(i!==null){const o=i(n),l=o.constructor;return s!==null?o instanceof s||R(201,s.name,s.getType(),l.name,l.getType(),n.constructor.name,t):o instanceof n.constructor&&l!==n.constructor||R(202,l.name,l.getType(),n.constructor.name,t),o.__key===n.__key&&R(203,n.constructor.name,t,l.name,l.getType()),o}return n}function na(n,e){!_e(n.getParent())||O(e)||Z(e)||R(99)}function nr(n){const e=Q(n);return e===null&&R(63,n),e}function ra(n){return(Z(n)||O(n)&&!n.canBeEmpty())&&!n.isInline()}function qa(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function kt(n){return Pt?(n||window).getSelection():null}function Wg(n){const e=ru(n);return e?e.getSelection():null}function Wy(n,e){let t=n.getChildAtIndex(e);t==null&&(t=n),We(n)&&R(102);const r=o=>{const l=o.getParentOrThrow(),a=We(l),c=o!==t||a?iu(o):o;if(a)return O(o)&&O(c)||R(133),o.insertAfter(c),[o,c,c];{const[u,d,f]=r(l),h=o.getNextSiblings();return f.append(c,...h),[u,d,c]}},[i,s]=r(t);return[i,s]}function su(n){return ne(n)&&n.tagName==="A"}function ne(n){return Yn(n)&&n.nodeType===1}function Yn(n){return typeof n=="object"&&n!==null&&"nodeType"in n&&typeof n.nodeType=="number"}function No(n){return Yn(n)&&n.nodeType===11}function Ao(n){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return n.nodeName.match(e)!==null}function ts(n){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return n.nodeName.match(e)!==null}function ht(n){if(Z(n)&&!n.isInline())return!0;if(!O(n)||We(n))return!1;const e=n.getFirstChild(),t=e===null||ue(e)||L(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function _i(){return se()}const Bd=new WeakMap,jy=new Map;function Za(n){if(!n._readOnly&&n.isEmpty())return jy;n._readOnly||R(192);let e=Bd.get(n);return e||(e=(function(t){const r=new Map;for(const[i,s]of t._nodeMap){const o=s.__type;let l=r.get(o);l||(l=new Map,r.set(o,l)),l.set(i,s)}return r})(n),Bd.set(n,e)),e}function ou(n){const e=n.constructor.clone(n);return e.afterCloneFrom(n),e}function jg(n){return(e=ou(n))[og]=!0,e;var e}function fl(n,e){const t=parseInt(n.style.paddingInlineStart,10)||0,r=Math.round(t/40);e.setIndent(r)}function Hg(n){n.__lexicalUnmanaged=!0}function Jg(n){return n.__lexicalUnmanaged===!0}function Ni(n,e){return(function(t,r){return Object.prototype.hasOwnProperty.call(t,r)})(n,e)&&n[e]!==jt[e]}function Es(n){const e=ed in n.prototype?n.prototype[ed]():void 0,t=(function(o){if(!(o===jt||o.prototype instanceof jt)){let l="<unknown>",a="<unknown>";try{l=o.getType()}catch{}try{ei.version&&(a=JSON.parse(ei.version))}catch{}R(290,o.name,l,a)}return o===Ss||o===xe||o===jt})(n),r=!t&&Ni(n,"getType")?n.getType():void 0;let i,s=r;if(e)if(r)i=e[r];else for(const[o,l]of Object.entries(e))s=o,i=l;if(!t&&s&&(Ni(n,"getType")||(n.getType=()=>s),Ni(n,"clone")||(n.clone=o=>(Jc(o),new n)),Ni(n,"importJSON")||(n.importJSON=i&&i.$importJSON||(o=>new n().updateFromJSON(o))),!Ni(n,"importDOM")&&i)){const{importDOM:o}=i;o&&(n.importDOM=()=>o)}return{ownNodeConfig:i,ownNodeType:s}}function Gg(n){const e=_i();return $e(),new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(n))).klass}const le=(n,e)=>{let t=n;for(;t!=null&&!_e(t);){if(e(t))return t;t=t.getParent()}return null},Hy={next:"previous",previous:"next"};class hl{origin;constructor(e){this.origin=e}[Symbol.iterator](){return pl({hasNext:zn,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return be(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return be(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 i=r===this.direction?t:Array.from(t).reverse();let s=this;const o=this.getParentAtCaret(),l=new Map;for(let a=s.getAdjacentCaret();a!==null&&l.size<e;a=a.getAdjacentCaret()){const c=a.origin.getWritable();l.set(c.getKey(),c)}for(const a of i){if(l.size>0){const c=s.getNodeAtCaret();if(c){if(l.delete(c.getKey()),l.delete(a.getKey()),!(c.is(a)||s.origin.is(a))){const u=a.getParent();u&&u.is(o)&&a.remove(),c.replace(a)}}else c===null&&R(263,Array.from(l).join(" "))}else s.insert(a);s=be(a,this.direction)}for(const a of l.values())a.remove();return this}}class ns extends hl{type="child";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:dt(e,this.direction)}getParentCaret(e="root"){return be(lu(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=qn(this.direction);return be(this.getNodeAtCaret(),e)||dt(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof ns&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const Jy={root:_e,shadowRoot:We};function qn(n){return Hy[n]}function lu(n,e="root"){return Jy[e](n)?null:n}class mr extends hl{type="sibling";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:be(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return O(this.origin)?dt(this.origin,this.direction):null}getParentCaret(e="root"){return be(lu(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=qn(this.direction);return be(this.getNodeAtCaret(),e)||dt(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof mr&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof mr||e instanceof _r)&&this.direction===e.direction&&this.origin.is(e.origin)}}class _r extends hl{type="text";offset;constructor(e,t){super(e),this.offset=t}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:gn(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return be(lu(this.getParentAtCaret(),e),this.direction)}getFlipped(){return gn(this.origin,qn(this.direction),this.offset)}isSamePointCaret(e){return e instanceof _r&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof mr||e instanceof _r)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return be(this.origin,this.direction)}}function $t(n){return n instanceof _r}function Gy(n){return n instanceof hl}function zn(n){return n instanceof mr}function gt(n){return n instanceof ns}const Vy={next:class extends _r{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(n){return this.origin.insertAfter(n),this}},previous:class extends _r{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(n){return this.origin.insertBefore(n),this}}},Yy={next:class extends mr{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(n){return this.origin.insertAfter(n),this}},previous:class extends mr{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(n){return this.origin.insertBefore(n),this}}},qy={next:class extends ns{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(n){return this.origin.splice(0,0,[n]),this}},previous:class extends ns{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(n){return this.origin.splice(this.origin.getChildrenSize(),0,[n]),this}}};function be(n,e){return n?new Yy[e](n):null}function gn(n,e,t){return n?new Vy[e](n,Ft(n,t)):null}function Ft(n,e,t="error"){const r=n.getTextContentSize();let i=e==="next"?r:e==="previous"?0:e;return(i<0||i>r)&&(t!=="clamp"&&Fh(284,String(e),String(r),n.getKey()),i=i<0?0:r),i}function Xa(n,e){return new Yg(n,e)}function dt(n,e){return O(n)?new qy[e](n):null}function Vg(n){return n&&n.getChildCaret()||n}function yr(n){return n&&Vg(n.getAdjacentCaret())}class au{type="node-caret-range";direction;anchor;focus;constructor(e,t,r){this.anchor=e,this.focus=t,this.direction=r}getLatest(){const e=this.anchor.getLatest(),t=this.focus.getLatest();return e===this.anchor&&t===this.focus?this:new au(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=i=>{const s=this[i].getLatest();return $t(s)?(function(o,l){const{direction:a,origin:c}=o,u=Ft(c,l==="focus"?qn(a):a);return Xa(o,u-o.offset)})(s,i):null},t=e("anchor"),r=e("focus");if(t&&r){const{caret:i}=t,{caret:s}=r;if(i.isSameNodeCaret(s))return[Xa(i,s.offset-i.offset),null]}return[t,r]}iterNodeCarets(e="root"){const t=$t(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),r=this.focus.getLatest(),i=$t(r),s=o=>o.isSameNodeCaret(r)?null:yr(o)||o.getParentCaret(e);return pl({hasNext:o=>o!==null&&!(i&&r.isSameNodeCaret(o)),initial:t.isSameNodeCaret(r)?null:s(t),map:o=>o,step:s})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Yg{type="slice";caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){const{distance:e,caret:{offset:t}}=this,r=t+e;return r<t?[r,t]:[t,r]}getTextContent(){const[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:e,direction:t}}=this,[r,i]=this.getSliceIndices(),s=e.getTextContent();return gn(e.setTextContent(s.slice(0,r)+s.slice(i)),t,r)}}function Zy(n){return n instanceof Yg}function gl(n){return qt(n,be(de(),n.direction))}function cu(n){return qt(n,n)}function qt(n,e){return n.direction!==e.direction&&R(265),new au(n,e,n.direction)}function pl(n){const{initial:e,hasNext:t,step:r,map:i}=n;let s=e;return{[Symbol.iterator](){return this},next(){if(!t(s))return{done:!0,value:void 0};const o={done:!1,value:i(s)};return s=r(s),o}}}function uu(n,e){const t=ji(n.origin,e.origin);switch(t===null&&R(275,n.origin.getKey(),e.origin.getKey()),t.type){case"same":{const r=n.type==="text",i=e.type==="text";return r&&i?(function(s,o){return Math.sign(s-o)})(n.offset,e.offset):n.type===e.type?0:r?-1:i?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 du(t)}}function du(n){const{a:e,b:t}=n,r=e.__key,i=t.__key;let s=e,o=t;for(;s&&o;s=s.getNextSibling(),o=o.getNextSibling()){if(s.__key===i)return-1;if(o.__key===r)return 1}return s===null?1:-1}function zs(n,e){return e.is(n)}function Ud(n){return O(n)?[n.getLatest(),null]:[n.getParent(),n.getLatest()]}function ji(n,e){if(n.is(e))return{commonAncestor:n,type:"same"};const t=new Map;for(let[r,i]=Ud(n);r;i=r,r=r.getParent())t.set(r,i);for(let[r,i]=Ud(e);r;i=r,r=r.getParent()){const s=t.get(r);if(s!==void 0)return s===null?(zs(n,r)||R(276),{commonAncestor:r,type:"ancestor"}):i===null?(zs(e,r)||R(277),{commonAncestor:r,type:"descendant"}):((O(s)||zs(n,s))&&(O(i)||zs(e,i))&&r.is(s.getParent())&&r.is(i.getParent())||R(278),{a:s,b:i,commonAncestor:r,type:"branch"})}return null}function Dt(n,e){const{type:t,key:r,offset:i}=n,s=nr(n.key);return t==="text"?(L(s)||R(266,s.getType(),r),gn(s,e,i)):(O(s)||R(267,s.getType(),r),Zg(s,n.offset,e))}function Bn(n,e){const{origin:t,direction:r}=e,i=r==="next";$t(e)?n.set(t.getKey(),e.offset,"text"):zn(e)?L(t)?n.set(t.getKey(),Ft(t,r),"text"):n.set(t.getParentOrThrow().getKey(),t.getIndexWithinParent()+(i?1:0),"element"):(gt(e)&&O(t)||R(268),n.set(t.getKey(),i?0:t.getChildrenSize(),"element"))}function ml(n){const e=M(),t=N(e)?e:gi();return Hi(t,n),De(t),t}function Hi(n,e){Bn(n.anchor,e.anchor),Bn(n.focus,e.focus)}function Oo(n){const{anchor:e,focus:t}=n,r=Dt(e,"next"),i=Dt(t,"next"),s=uu(r,i)<=0?"next":"previous";return qt(Zt(r,s),Zt(i,s))}function yi(n){const{direction:e,origin:t}=n,r=be(t,qn(e)).getNodeAtCaret();return r?be(r,e):dt(t.getParentOrThrow(),e)}function Kd(n,e="root"){const t=[n];for(let r=gt(n)?n.getParentCaret(e):n.getSiblingCaret();r!==null;r=r.getParentCaret(e))t.push(yi(r));return t}function ia(n){return!!n&&n.origin.isAttached()}function qg(n,e="removeEmptySlices"){if(n.isCollapsed())return n;const t="root",r="next";let i=e;const s=_l(n,r),o=Kd(s.anchor,t),l=Kd(s.focus.getFlipped(),t),a=new Set,c=[];for(const g of s.iterNodeCarets(t))if(gt(g))a.add(g.origin.getKey());else if(zn(g)){const{origin:p}=g;O(p)&&!a.has(p.getKey())||c.push(p)}for(const g of c)g.remove();for(const g of s.getTextSlices()){if(!g)continue;const{origin:p}=g.caret,m=p.getTextContentSize(),b=yi(be(p,r)),_=p.getMode();if(Math.abs(g.distance)===m&&i==="removeEmptySlices"||_==="token"&&g.distance!==0)b.remove();else if(g.distance!==0){i="removeEmptySlices";let y=g.removeTextSlice();const C=g.caret.origin;if(_==="segmented"){const S=y.origin,w=he(S.getTextContent()).setStyle(S.getStyle()).setFormat(S.getFormat());b.replaceOrInsert(w),y=gn(w,r,y.offset)}C.is(o[0].origin)&&(o[0]=y),C.is(l[0].origin)&&(l[0]=y.getFlipped())}}let u,d;for(const g of o)if(ia(g)){u=it(g);break}for(const g of l)if(ia(g)){d=it(g);break}const f=(function(g,p,m){if(!g||!p)return null;const b=g.getParentAtCaret(),_=p.getParentAtCaret();if(!b||!_)return null;const y=b.getParents().reverse();y.push(b);const C=_.getParents().reverse();C.push(_);const S=Math.min(y.length,C.length);let w;for(w=0;w<S&&y[w]===C[w];w++);const x=(I,$)=>{let k;for(let D=w;D<I.length;D++){const K=I[D];if(We(K))return;!k&&$(K)&&(k=K)}return k},T=x(y,ht),E=T&&x(C,I=>m.has(I.getKey())&&ht(I));return T&&E?[T,E]:null})(u,d,a);if(f){const[g,p]=f;dt(g,"previous").splice(0,p.getChildren()),p.remove()}const h=[u,d,...o,...l].find(ia);if(h)return cu(Zt(it(h),n.direction));R(269,JSON.stringify(o.map(g=>g.origin.__key)))}function it(n){const e=(function(i){let s=i;for(;gt(s);){const o=yr(s);if(!gt(o))break;s=o}return s})(n.getLatest()),{direction:t}=e;if(L(e.origin))return $t(e)?e:gn(e.origin,t,t);const r=e.getAdjacentCaret();return zn(r)&&L(r.origin)?gn(r.origin,t,qn(t)):e}function fu(n){return $t(n)&&n.offset!==Ft(n.origin,n.direction)}function Zt(n,e){return n.direction===e?n:n.getFlipped()}function _l(n,e){return n.direction===e?n:qt(Zt(n.focus,e),Zt(n.anchor,e))}function Zg(n,e,t){let r=dt(n,"next");for(let i=0;i<e;i++){const s=r.getAdjacentCaret();if(s===null)break;r=s}return Zt(r,t)}function Xy(n,e="root"){let t=0,r=n,i=yr(r);for(;i===null;){if(t--,i=r.getParentCaret(e),!i)return null;r=i,i=yr(r)}return i&&[i,t]}function Qy(n){const{origin:e,offset:t,direction:r}=n;if(t===Ft(e,r))return n.getSiblingCaret();if(t===Ft(e,qn(r)))return yi(n.getSiblingCaret());const[i]=e.splitText(t);return L(i)||R(281),Zt(be(i,"next"),r)}function eb(n,e){return!0}function Xg(n,{$copyElementNode:e=iu,$splitTextPointCaretNext:t=Qy,rootMode:r="shadowRoot",$shouldSplit:i=eb}={}){if($t(n))return t(n);const s=n.getParentCaret(r);if(s){const{origin:o}=s;if(gt(n)&&(!o.canBeEmpty()||!i(o,"first")))return yi(s);const l=(function(a){const c=[];for(let u=a.getAdjacentCaret();u;u=u.getAdjacentCaret())c.push(u.origin);return c})(n);(l.length>0||o.canBeEmpty()&&i(o,"last"))&&s.insert(e(o).splice(0,0,l))}return s}function tb(n){return n}function Qg(...n){return n}function nb(n,e){return[n,e]}function rb(n){return n}function ep(n,e){if(!e||n===e)return n;for(const t in e)if(n[t]!==e[t])return{...n,...e};return n}function pn(...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 me(n,...e){const t=pn(...e);t.length>0&&n.classList.add(...t)}function fn(n,...e){const t=pn(...e);t.length>0&&n.classList.remove(...t)}function mt(...n){return()=>{for(let e=n.length-1;e>=0;e--)n[e]();n.length=0}}const ib=Object.freeze(Object.defineProperty({__proto__:null,$addUpdateTag:zg,$applyNodeReplacement:ze,$caretFromPoint:Dt,$caretRangeFromSelection:Oo,$cloneWithProperties:ou,$cloneWithPropertiesEphemeral:jg,$comparePointCaretNext:uu,$copyNode:iu,$create:Gg,$createLineBreakNode:ut,$createNodeSelection:Kc,$createParagraphNode:H,$createPoint:Me,$createRangeSelection:gi,$createRangeSelectionFromDom:$y,$createTabNode:Ct,$createTextNode:he,$extendCaretToRange:gl,$findMatchingParent:le,$getAdjacentChildCaret:yr,$getAdjacentNode:ko,$getAdjacentSiblingOrParentSiblingCaret:Xy,$getCaretInDirection:Zt,$getCaretRange:qt,$getCaretRangeInDirection:_l,$getCharacterOffsets:xo,$getChildCaret:dt,$getChildCaretAtIndex:Zg,$getChildCaretOrSelf:Vg,$getCollapsedCaretRange:cu,$getCommonAncestor:ji,$getCommonAncestorResultBranchOrder:du,$getEditor:_i,$getNearestNodeFromDOMNode:pt,$getNearestRootOrShadowRoot:Kg,$getNodeByKey:Q,$getNodeByKeyOrThrow:nr,$getNodeFromDOMNode:qc,$getPreviousSelection:Sn,$getRoot:de,$getSelection:M,$getSiblingCaret:be,$getState:Yi,$getStateChange:dy,$getTextContent:Ly,$getTextNodeOffset:Ft,$getTextPointCaret:gn,$getTextPointCaretSlice:Xa,$getWritableNodeState:Vo,$hasAncestor:To,$hasUpdateTag:Ky,$insertNodes:il,$isBlockElementNode:So,$isChildCaret:gt,$isDecoratorNode:Z,$isEditorState:wg,$isElementNode:O,$isExtendableTextPointCaret:fu,$isInlineElementOrDecoratorNode:Ug,$isLeafNode:Yc,$isLineBreakNode:ue,$isNodeCaret:Gy,$isNodeSelection:Ge,$isParagraphNode:Nr,$isRangeSelection:N,$isRootNode:_e,$isRootOrShadowRoot:We,$isSiblingCaret:zn,$isTabNode:Ye,$isTextNode:L,$isTextPointCaret:$t,$isTextPointCaretSlice:Zy,$isTokenOrSegmented:At,$isTokenOrTab:$n,$nodesOfType:Uy,$normalizeCaret:it,$normalizeSelection__EXPERIMENTAL:Rn,$onUpdate:Bg,$parseSerializedNode:xg,$removeTextFromCaretRange:qg,$rewindSiblingCaret:yi,$selectAll:eu,$setCompositionKey:Fe,$setPointFromCaret:Bn,$setSelection:De,$setSelectionFromCaretRange:ml,$setState:Zs,$splitAtPointCaretNext:Xg,$splitNode:Wy,$updateRangeSelectionFromCaretRange:Hi,ArtificialNode__DO_NOT_USE:ol,BEFORE_INPUT_COMMAND:Mc,BLUR_COMMAND:hi,CAN_REDO_COMMAND:$i,CAN_UNDO_COMMAND:Fi,CLEAR_EDITOR_COMMAND:Pc,CLEAR_HISTORY_COMMAND:qh,CLICK_COMMAND:Sr,COLLABORATION_TAG:ag,COMMAND_PRIORITY_CRITICAL:Hc,COMMAND_PRIORITY_EDITOR:B,COMMAND_PRIORITY_HIGH:Eg,COMMAND_PRIORITY_LOW:q,COMMAND_PRIORITY_NORMAL:vg,COMPOSITION_END_COMMAND:Fc,COMPOSITION_START_COMMAND:$c,CONTROLLED_TEXT_INSERTION_COMMAND:In,COPY_COMMAND:Cr,CUT_COMMAND:fi,DELETE_CHARACTER_COMMAND:It,DELETE_LINE_COMMAND:fr,DELETE_WORD_COMMAND:dr,DRAGEND_COMMAND:Yh,DRAGOVER_COMMAND:Dc,DRAGSTART_COMMAND:tl,DROP_COMMAND:el,DecoratorNode:Ss,ElementNode:xe,FOCUS_COMMAND:zc,FORMAT_ELEMENT_COMMAND:Rc,FORMAT_TEXT_COMMAND:we,HISTORIC_TAG:bo,HISTORY_MERGE_TAG:Vr,HISTORY_PUSH_TAG:lg,INDENT_CONTENT_COMMAND:Wt,INPUT_COMMAND:Ic,INSERT_LINE_BREAK_COMMAND:dn,INSERT_PARAGRAPH_COMMAND:Dn,INSERT_TAB_COMMAND:po,INTERNAL_$isBlock:ht,IS_ALL_FORMATTING:H_,IS_BOLD:P_,IS_CODE:K_,IS_HIGHLIGHT:Tc,IS_ITALIC:z_,IS_STRIKETHROUGH:B_,IS_SUBSCRIPT:W_,IS_SUPERSCRIPT:j_,IS_UNDERLINE:U_,KEY_ARROW_DOWN_COMMAND:hr,KEY_ARROW_LEFT_COMMAND:bs,KEY_ARROW_RIGHT_COMMAND:qo,KEY_ARROW_UP_COMMAND:hn,KEY_BACKSPACE_COMMAND:Xo,KEY_DELETE_COMMAND:Qo,KEY_DOWN_COMMAND:Lc,KEY_ENTER_COMMAND:Pn,KEY_ESCAPE_COMMAND:di,KEY_MODIFIER_COMMAND:Zh,KEY_SPACE_COMMAND:Zo,KEY_TAB_COMMAND:xs,LineBreakNode:wr,MOVE_TO_END:go,MOVE_TO_START:Qi,NODE_STATE_KEY:sy,OUTDENT_CONTENT_COMMAND:ln,PASTE_COMMAND:ai,PASTE_TAG:Bc,ParagraphNode:Vn,REDO_COMMAND:ui,REMOVE_TEXT_COMMAND:Xi,RootNode:Tr,SELECTION_CHANGE_COMMAND:li,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND:Oc,SELECT_ALL_COMMAND:Qr,SKIP_COLLAB_TAG:vy,SKIP_DOM_SELECTION_TAG:ug,SKIP_SCROLL_INTO_VIEW_TAG:cg,SKIP_SELECTION_FOCUS_TAG:Va,TEXT_TYPE_TO_FORMAT:Ue,TabNode:vr,TextNode:Qe,UNDO_COMMAND:ci,addClassNamesToElement:me,buildImportMap:wy,configExtension:Qg,createCommand:U,createEditor:pi,createSharedNodeState:Kh,createState:Ac,declarePeerDependency:nb,defineExtension:tb,flipDirection:qn,getDOMOwnerDocument:nu,getDOMSelection:kt,getDOMSelectionFromTarget:Wg,getDOMTextNode:gr,getEditorPropertyFromDOMNode:ws,getNearestEditorFromDOMNode:ul,getRegisteredNode:ll,getRegisteredNodeOrThrow:Gc,getStaticNodeConfig:Es,getTextDirection:Og,getTransformSetFromKlass:Tg,isBlockDomNode:ts,isCurrentlyReadOnlyMode:kr,isDOMDocumentNode:Vc,isDOMNode:Yn,isDOMTextNode:Xt,isDOMUnmanaged:Jg,isDocumentFragment:No,isExactShortcutMatch:re,isHTMLAnchorElement:su,isHTMLElement:ne,isInlineDomNode:Ao,isLexicalEditor:cl,isModifierMatch:Dg,isSelectionCapturedInDecoratorInput:al,isSelectionWithinEditor:mi,makeStepwiseIterator:pl,mergeRegister:mt,normalizeClassNames:pn,removeClassNamesFromElement:fn,removeFromParent:Jt,resetRandomKey:zy,safeCast:rb,setDOMUnmanaged:Hg,setNodeIndentFromDOM:fl,shallowMergeConfig:ep},Symbol.toStringTag,{value:"Module"}));function sb(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 Mo=new Map;function tp(n){const e={};if(!n)return e;const t=n.split(";");for(const r of t)if(r!==""){const[i,s]=r.split(/:([^]+)/);i&&s&&(e[i.trim()]=s.trim())}return e}function rs(n){let e=Mo.get(n);return e===void 0&&(e=tp(n),Mo.set(n,e)),e}function ob(n){let e="";for(const t in n)t&&(e+=`${t}: ${n[t]};`);return e}function np(n){const e=_i().getElementByKey(n.getKey());if(e===null)return null;const t=e.ownerDocument.defaultView;return t===null?null:t.getComputedStyle(e)}function rp(n){return np(_e(n)?n:n.getParentOrThrow())}function Wd(n){const e=rp(n);return e!==null&&e.direction==="rtl"}function ip(n,e,t="self"){const r=n.getStartEndPoints();if(e.isSelected(n)&&!At(e)&&r!==null){const[i,s]=r,o=n.isBackward(),l=i.getNode(),a=s.getNode(),c=e.is(l),u=e.is(a);if(c||u){const[d,f]=xo(n),h=l.is(a),g=e.is(o?a:l),p=e.is(o?l:a);let m,b=0;h?(b=d>f?f:d,m=d>f?d:f):g?(b=o?f:d,m=void 0):p&&(b=0,m=o?d:f);const _=e.__text.slice(b,m);_!==e.__text&&(t==="clone"&&(e=jg(e)),e.__text=_)}}return e}function lb(n){const e=n.getStyle(),t=tp(e);Mo.set(e,t)}function Bs(n,e){(N(n)?n.isCollapsed():L(n)||O(n))||sb(280);const t=rs(N(n)?n.style:L(n)?n.getStyle():n.getTextStyle()),r=Object.entries(e).reduce((s,[o,l])=>(typeof l=="function"?s[o]=l(t[o],n):l===null?delete s[o]:s[o]=l,s),{...t}),i=ob(r);N(n)||L(n)?n.setStyle(i):n.setTextStyle(i),Mo.set(i,r)}function Us(n,e){if(N(n)&&n.isCollapsed()){Bs(n,e);const r=n.anchor.getNode();O(r)&&r.isEmpty()&&Bs(r,e)}ab(r=>{Bs(r,e)});const t=n.getNodes();if(t.length>0){const r=new Set;for(const i of t){if(!O(i)||!i.canBeEmpty()||i.getChildrenSize()!==0)continue;const s=i.getKey();r.has(s)||(r.add(s),Bs(i,e))}}}function ab(n){const e=M();if(!e)return;const t=new Map,r=s=>t.get(s.getKey())||[0,s.getTextContentSize()];if(N(e))for(const s of Oo(e).getTextSlices())s&&t.set(s.caret.origin.getKey(),s.getSliceIndices());const i=e.getNodes();for(const s of i){if(!L(s)||!s.canHaveFormat())continue;const[o,l]=r(s);l!==o&&(At(s)||o===0&&l===s.getTextContentSize()?n(s):n(s.splitText(o,l)[o===0?0:1]))}N(e)&&e.anchor.type==="text"&&e.focus.type==="text"&&e.anchor.key===e.focus.key&&cb(e)}function cb(n){if(n.isBackward()){const{anchor:e,focus:t}=n,{key:r,offset:i,type:s}=e;e.set(t.key,t.offset,t.type),t.set(r,i,s)}}function ub(n,e){const t=n.getFormatType(),r=n.getIndent();t!==e.getFormatType()&&e.setFormat(t),r!==e.getIndent()&&e.setIndent(r)}function rt(n,e,t=ub){if(n===null)return;const r=n.getStartEndPoints(),i=new Map;let s=null;if(r){const[o,l]=r;s=gi(),s.anchor.set(o.key,o.offset,o.type),s.focus.set(l.key,l.offset,l.type);const a=le(o.getNode(),ht),c=le(l.getNode(),ht);O(a)&&i.set(a.getKey(),a),O(c)&&i.set(c.getKey(),c)}for(const o of n.getNodes())if(O(o)&&ht(o))i.set(o.getKey(),o);else if(r===null){const l=le(o,ht);O(l)&&i.set(l.getKey(),l)}for(const[o,l]of i){const a=e();t(l,a),l.replace(a,!0),s&&(o===s.anchor.key&&s.anchor.set(a.getKey(),s.anchor.offset,s.anchor.type),o===s.focus.key&&s.focus.set(a.getKey(),s.focus.offset,s.focus.type))}s&&n.is(M())&&De(s)}function sp(n){const e=op(n);return e!==null&&e.writingMode==="vertical-rl"}function op(n){const e=n.anchor.getNode();return O(e)?np(e):rp(e)}function Io(n,e){let t=sp(n)?!e:e;lp(n)&&(t=!t);const r=Dt(n.focus,t?"previous":"next");if(fu(r))return!1;for(const i of gl(r)){if(gt(i))return!i.origin.isInline();if(!O(i.origin)){if(Z(i.origin))return!0;break}}return!1}function db(n,e,t,r){n.modify(e?"extend":"move",t,r)}function lp(n){const e=op(n);return e!==null&&e.direction==="rtl"}function $o(n,e,t){const r=lp(n);let i;i=sp(n)||r?!t:t,db(n,e,i,"character")}function fb(n,e,t){const r=rs(n.getStyle());return r!==null&&r[e]||t}function Ks(n,e,t=""){let r=null;const i=n.getNodes(),s=n.anchor,o=n.focus,l=n.isBackward(),a=l?o.offset:s.offset,c=l?o.getNode():s.getNode();if(N(n)&&n.isCollapsed()&&n.style!==""){const u=rs(n.style);if(u!==null&&e in u)return u[e]}for(let u=0;u<i.length;u++){const d=i[u];if((u===0||a!==0||!d.is(c))&&L(d)){const f=fb(d,e,t);if(r===null)r=f;else if(r!==f){r="";break}}}return r===null?t:r}function ap(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 yl=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,hb=yl&&"documentMode"in document?document.documentMode:null,gb=yl&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);!(!yl||!("InputEvent"in window)||hb)&&"getTargetRanges"in new window.InputEvent("input");const pb=yl,mb=gb;function _b(n){return n?n.getAdjacentCaret():null}function yb(n,e){let t=n;for(;t!=null;){if(t instanceof e)return t;t=t.getParent()}return null}function bb(n){const e=le(n,t=>O(t)&&!t.isInline());return O(e)||ap(4,n.__key),e}function xb(n){const e=M()||Sn();let t;if(N(e))t=Dt(e.focus,"next");else{if(e!=null){const o=e.getNodes(),l=o[o.length-1];l&&(t=be(l,"next"))}t=t||dt(de(),"previous").getFlipped().insert(H())}const r=Sb(n,t),i=yr(r),s=gt(i)?it(i):r;return ml(cu(s)),n.getLatest()}function Sb(n,e,t){let r=Zt(e,"next");for(let i=r;i;i=Xg(i,t))r=i;return $t(r)&&ap(283),r.insert(n.isInline()?H().append(n):n),Zt(be(n.getLatest(),"next"),e.direction)}function an(n,e){return n!==null&&Object.getPrototypeOf(n).constructor.name===e.name}let sa=!(mb||!pb)&&void 0;function Cb(n,e=!1){let t=1;if((function(){if(sa===void 0){const r=document.createElement("div");r.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(r);const i=r.getBoundingClientRect();r.style.setProperty("zoom","2"),sa=r.getBoundingClientRect().width===i.width,document.body.removeChild(r)}return sa})()||e)for(;n;)t*=Number(window.getComputedStyle(n).getPropertyValue("zoom")),n=n.parentElement;return t}function cp(n,e){return up(n,e,null)}function up(n,e,t){let r=!1;for(const i of fp(n))e(i)?t!==null&&t(i):(r=!0,O(i)&&up(i,e,t||(s=>i.insertAfter(s))),i.remove());return r}function dp(n,e){const t=[],r=Array.from(n).reverse();for(let i=r.pop();i!==void 0;i=r.pop())if(e(i))t.push(i);else if(O(i))for(const s of fp(i))r.push(s);return t}function fp(n){return wb(dt(n,"previous"))}function wb(n){return pl({hasNext:zn,initial:n.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}function hp(n,e){const t=Vc(e)?e.body.childNodes:e.childNodes;let r=[];const i=[];for(const s of t)if(!mp.has(s.nodeName)){const o=_p(s,n,i,!1);o!==null&&(r=r.concat(o))}return(function(s){for(const o of s)o.getNextSibling()instanceof ol&&o.insertAfter(ut());for(const o of s){const l=o.getChildren();for(const a of l)o.insertBefore(a);o.remove()}})(i),r}function gp(n,e){if(typeof document>"u"||typeof window>"u"&&global.window===void 0)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),r=de().getChildren();for(let i=0;i<r.length;i++)pp(n,r[i],t,e);return t.innerHTML}function pp(n,e,t,r=null){let i=r===null||e.isSelected(r);const s=O(e)&&e.excludeFromCopy("html");let o=e;r!==null&&L(e)&&(o=ip(r,e,"clone"));const l=O(o)?o.getChildren():[],a=ll(n,o.getType());let c;c=a&&a.exportDOM!==void 0?a.exportDOM(n,o):o.exportDOM(n);const{element:u,after:d}=c;if(!u)return!1;const f=document.createDocumentFragment();for(let h=0;h<l.length;h++){const g=l[h],p=pp(n,g,f,r);!i&&O(e)&&p&&e.extractWithChild(g,r,"html")&&(i=!0)}if(i&&!s){if((ne(u)||No(u))&&u.append(f),t.append(u),d){const h=d.call(o,u);h&&(No(u)?u.replaceChildren(h):u.replaceWith(h))}}else t.append(f);return i}const mp=new Set(["STYLE","SCRIPT"]);function _p(n,e,t,r,i=new Map,s){let o=[];if(mp.has(n.nodeName))return o;let l=null;const a=(function(g,p){const{nodeName:m}=g,b=p._htmlConversions.get(m.toLowerCase());let _=null;if(b!==void 0)for(const y of b){const C=y(g);C!==null&&(_===null||(_.priority||0)<=(C.priority||0))&&(_=C)}return _!==null?_.conversion:null})(n,e),c=a?a(n):null;let u=null;if(c!==null){u=c.after;const g=c.node;if(l=Array.isArray(g)?g[g.length-1]:g,l!==null){for(const[,p]of i)if(l=p(l,s),!l)break;l&&o.push(...Array.isArray(g)?g:[l])}c.forChild!=null&&i.set(n.nodeName,c.forChild)}const d=n.childNodes;let f=[];const h=(l==null||!We(l))&&(l!=null&&So(l)||r);for(let g=0;g<d.length;g++)f.push(..._p(d[g],e,t,h,new Map(i),l));return u!=null&&(f=u(f)),ts(n)&&(f=vb(n,f,h?()=>{const g=new ol;return t.push(g),g}:H)),l==null?f.length>0?o=o.concat(f):ts(n)&&(function(g){return g.nextSibling==null||g.previousSibling==null?!1:Ao(g.nextSibling)&&Ao(g.previousSibling)})(n)&&(o=o.concat(ut())):O(l)&&l.append(...f),o}function vb(n,e,t){const r=n.style.textAlign,i=[];let s=[];for(let o=0;o<e.length;o++){const l=e[o];if(So(l))r&&!l.getFormat()&&l.setFormat(r),i.push(l);else if(s.push(l),o===e.length-1||o<e.length-1&&So(e[o+1])){const a=t();a.setFormat(r),a.append(...s),i.push(a),s=[]}}return i}function Fo(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 yp(n,e=M()){return e==null&&Fo(166),N(e)&&e.isCollapsed()||e.getNodes().length===0?"":gp(n,e)}function Eb(n,e=M()){return e==null&&Fo(166),N(e)&&e.isCollapsed()||e.getNodes().length===0?null:JSON.stringify(kb(n,e))}function jd(n,e){const t=n.getData("text/plain")||n.getData("text/uri-list");t!=null&&e.insertRawText(t)}function Hd(n,e,t){const r=n.getData("application/x-lexical-editor");if(r)try{const l=JSON.parse(r);if(l.namespace===t._config.namespace&&Array.isArray(l.nodes))return Jd(t,Tb(l.nodes),e)}catch(l){console.error(l)}const i=n.getData("text/html"),s=n.getData("text/plain");if(i&&s!==i)try{const l=new DOMParser().parseFromString((function(a){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:c=>c}).createHTML(a):a})(i),"text/html");return Jd(t,hp(t,l),e)}catch(l){console.error(l)}const o=s||n.getData("text/uri-list");if(o!=null)if(N(e)){const l=o.split(/(\r?\n|\t)/);l[l.length-1]===""&&l.pop();for(let a=0;a<l.length;a++){const c=M();if(N(c)){const u=l[a];u===`
|
|
12
12
|
`||u===`\r
|
|
13
|
-
`?c.insertParagraph():u===" "?c.insertNodes([yt()]):c.insertText(u)}}}else e.insertRawText(o)}function Kd(n,e,t){n.dispatchCommand(Ec,{nodes:e,selection:t})||(t.insertNodes(e),(function(r){if(N(r)&&r.isCollapsed()){const i=r.anchor;let s=null;const o=$t(i,"previous");if(o)if(At(o))s=o.origin;else{const l=Gt(o,lt(de(),"next").getFlipped());for(const a of l){if(R(a.origin)){s=a.origin;break}if(A(a.origin)&&!a.origin.isInline())break}}if(s&&R(s)){const l=s.getFormat(),a=s.getStyle();r.format===l&&r.style===a||(r.format=l,r.style=a,r.dirty=!0)}}})(t))}function mp(n,e,t,r=[]){let i=e===null||t.isSelected(e);const s=A(t)&&t.excludeFromCopy("html");let o=t;e!==null&&R(o)&&(o=tp(e,o,"clone"));const l=A(o)?o.getChildren():[],a=(function(c){const u=c.exportJSON(),d=c.constructor;if(u.type!==d.getType()&&No(58,d.name),A(c)){const f=u.children;Array.isArray(f)||No(59,d.name)}return u})(o);R(o)&&o.getTextContentSize()===0&&(i=!1);for(let c=0;c<l.length;c++){const u=l[c],d=mp(n,e,u,a.children);!i&&A(t)&&d&&t.extractWithChild(u,e,"clone")&&(i=!0)}if(i&&!s)r.push(a);else if(Array.isArray(a.children))for(let c=0;c<a.children.length;c++){const u=a.children[c];r.push(u)}return i}function vb(n,e){const t=[],r=de().getChildren();for(let i=0;i<r.length;i++)mp(n,e,r[i],t);return{namespace:n._config.namespace,nodes:t}}function Eb(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t],i=_g(r);R(i)&&sb(i),e.push(i)}return e}let Mr=null;async function Wd(n,e,t){if(Mr!==null)return!1;if(e!==null)return new Promise((c,u)=>{n.update(()=>{c(jd(n,e,t))})});const r=n.getRootElement(),i=n._window||window,s=i.document,o=Ct(i);if(r===null||o===null)return!1;const l=s.createElement("span");l.style.cssText="position: fixed; top: -1000px;",l.append(s.createTextNode("#")),r.append(l);const a=new Range;return a.setStart(l,0),a.setEnd(l,1),o.removeAllRanges(),o.addRange(a),new Promise((c,u)=>{const d=n.registerCommand(_r,f=>(rn(f,ClipboardEvent)&&(d(),Mr!==null&&(i.clearTimeout(Mr),Mr=null),c(jd(n,f,t))),!0),Bc);Mr=i.setTimeout(()=>{d(),Mr=null,c(!1)},50),s.execCommand("copy"),l.remove()})}function jd(n,e,t){if(t===void 0){const i=Ct(n._window),s=M();if(!s||s.isCollapsed()||!i)return!1;const o=i.anchorNode,l=i.focusNode;if(o!==null&&l!==null&&!di(n,o,l))return!1;t=kb(s)}e.preventDefault();const r=e.clipboardData;return r!==null&&(Tb(r,t),!0)}const _p=[["text/html",pp],["application/x-lexical-editor",wb]];function kb(n=M()){const e={"text/plain":n?n.getTextContent():""};if(n){const t=fi();for(const[r,i]of _p){const s=i(t,n);s!==null&&(e[r]=s)}}return e}function Tb(n,e){for(const[t]of _p)e[t]===void 0&&n.setData(t,"");for(const t in e){const r=e[t];r!==void 0&&n.setData(t,r)}}const Nb=Symbol.for("preact-signals");function hl(){if(An>1)return void An--;let n,e=!1;for(;Ui!==void 0;){let t=Ui;for(Ui=void 0,Va++;t!==void 0;){const r=t.o;if(t.o=void 0,t.f&=-3,!(8&t.f)&&bp(t))try{t.c()}catch(i){e||(n=i,e=!0)}t=r}}if(Va=0,An--,e)throw n}function Ab(n){if(An>0)return n();An++;try{return n()}finally{hl()}}let ie,Ui;function Hd(n){const e=ie;ie=void 0;try{return n()}finally{ie=e}}let An=0,Va=0,Ys=0;function Jd(n){if(ie===void 0)return;let e=n.n;return e===void 0||e.t!==ie?(e={i:0,S:n,p:ie.s,n:void 0,t:ie,e:void 0,x:void 0,r:e},ie.s!==void 0&&(ie.s.n=e),ie.s=e,n.n=e,32&ie.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=ie.s,e.n=void 0,ie.s.n=e,ie.s=e),e):void 0}function Xe(n,e){this.v=n,this.i=0,this.n=void 0,this.t=void 0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}function yp(n,e){return new Xe(n,e)}function bp(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 Gd(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 xp(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 Ir(n,e){Xe.call(this,void 0),this.x=n,this.s=void 0,this.g=Ys-1,this.f=4,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}function Sp(n){const e=n.u;if(n.u=void 0,typeof e=="function"){An++;const t=ie;ie=void 0;try{e()}catch(r){throw n.f&=-2,n.f|=8,au(n),r}finally{ie=t,hl()}}}function au(n){for(let e=n.s;e!==void 0;e=e.n)e.S.U(e);n.x=void 0,n.s=void 0,Sp(n)}function Ob(n){if(ie!==this)throw new Error("Out-of-order effect");xp(this),ie=n,this.f&=-2,8&this.f&&au(this),hl()}function zr(n,e){this.x=n,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=e?.name}function cu(n,e){const t=new zr(n,e);try{t.c()}catch(i){throw t.d(),i}const r=t.d.bind(t);return r[Symbol.dispose]=r,r}function Mb(n,e={}){const t={};for(const r in n){const i=e[r],s=yp(i===void 0?n[r]:i);t[r]=s}return t}Xe.prototype.brand=Nb,Xe.prototype.h=function(){return!0},Xe.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:Hd(()=>{var t;(t=this.W)==null||t.call(this)}))},Xe.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&&Hd(()=>{var r;(r=this.Z)==null||r.call(this)}))}},Xe.prototype.subscribe=function(n){return cu(()=>{const e=this.value,t=ie;ie=void 0;try{n(e)}finally{ie=t}},{name:"sub"})},Xe.prototype.valueOf=function(){return this.value},Xe.prototype.toString=function(){return this.value+""},Xe.prototype.toJSON=function(){return this.value},Xe.prototype.peek=function(){const n=ie;ie=void 0;try{return this.value}finally{ie=n}},Object.defineProperty(Xe.prototype,"value",{get(){const n=Jd(this);return n!==void 0&&(n.i=this.i),this.v},set(n){if(n!==this.v){if(Va>100)throw new Error("Cycle detected");this.v=n,this.i++,Ys++,An++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{hl()}}}}),Ir.prototype=new Xe,Ir.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ys))return!0;if(this.g=Ys,this.f|=1,this.i>0&&!bp(this))return this.f&=-2,!0;const n=ie;try{Gd(this),ie=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 ie=n,xp(this),this.f&=-2,!0},Ir.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)}Xe.prototype.S.call(this,n)},Ir.prototype.U=function(n){if(this.t!==void 0&&(Xe.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)}},Ir.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(Ir.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const n=Jd(this);if(this.h(),n!==void 0&&(n.i=this.i),16&this.f)throw this.v;return this.v}}),zr.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.u=e)}finally{n()}},zr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Sp(this),Gd(this),An++;const n=ie;return ie=this,Ob.bind(this,n)},zr.prototype.N=function(){2&this.f||(this.f|=2,this.o=Ui,Ui=this)},zr.prototype.d=function(){this.f|=8,1&this.f||au(this)},zr.prototype.dispose=function(){this.d()};function Ib(n){return(typeof n.nodes=="function"?n.nodes():n.nodes)||[]}function ae(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 Cp(n,e){if(n&&e&&!Array.isArray(e)&&typeof n=="object"&&typeof e=="object"){const t=n,r=e;for(const i in r)t[i]=Cp(t[i],r[i]);return n}return e}const uu=0,Ya=1,wp=2,na=3,Ls=4,$r=5,ra=6,vi=7;function ia(n){return n.id===uu}function vp(n){return n.id===wp}function $b(n){return(function(e){return e.id===Ya})(n)||ae(305,String(n.id),String(Ya)),Object.assign(n,{id:wp})}const Fb=new Set;let Rb=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:uu}}mergeConfigs(){let e=this.extension.config||{};const t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Zg;for(const r of this.configs)e=t(e,r);return e}init(e){const t=this.state;vp(t)||ae(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)},i={...r,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},s=(function(l,a,c){return Object.assign(l,{config:a,id:na,registerState:c})})(t,this.mergeConfigs(),r);let o;this.state=s,this.extension.init&&(o=this.extension.init(e,s.config,r)),this.state=(function(l,a,c){return Object.assign(l,{id:Ls,initResult:a,registerState:c})})(s,o,i)}build(e){const t=this.state;let r;t.id!==Ls&&ae(307,String(t.id),String($r)),this.extension.build&&(r=this.extension.build(e,t.config,t.registerState));const i={...t.registerState,getOutput:()=>r,getSignal:this.getSignal.bind(this)};this.state=(function(s,o,l){return Object.assign(s,{id:$r,output:o,registerState:l})})(t,r,i)}register(e,t){this._signal=t;const r=this.state;r.id!==$r&&ae(308,String(r.id),String($r));const i=this.extension.register&&this.extension.register(e,r.config,r.registerState);return this.state=(function(s){return Object.assign(s,{id:ra})})(r),()=>{const s=this.state;s.id!==vi&&ae(309,String(r.id),String(vi)),this.state=(function(o){return Object.assign(o,{id:$r})})(s),i&&i()}}afterRegistration(e){const t=this.state;let r;return t.id!==ra&&ae(310,String(t.id),String(ra)),this.extension.afterRegistration&&(r=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=(function(i){return Object.assign(i,{id:vi})})(t),r}getSignal(){return this._signal===void 0&&ae(311),this._signal}getInitResult(){this.extension.init===void 0&&ae(312,this.extension.name);const e=this.state;return(function(t){return t.id>=Ls})(e)||ae(313,String(e.id),String(Ls)),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>=na})(e)||ae(314,String(e.id),String(na)),{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&&ae(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return t===void 0&&ae(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return(function(t){return t.id>=vi})(e)||ae(316,String(e.id),String(vi)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Fb}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>=$r})(e)||ae(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};const Vd={tag:Wr};function Db(){const n=de();n.isEmpty()&&n.append(J())}const Lb={config:{setOptions:Vd,updateOptions:Vd},init:({$initialEditorState:n=Db})=>({$initialEditorState:n,initialized:!1}),afterRegistration(n,{updateOptions:e,setOptions:t},r){const i=r.getInitResult();if(!i.initialized){i.initialized=!0;const{$initialEditorState:s}=i;if(xg(s))n.setEditorState(s,t);else if(typeof s=="function")n.update(()=>{s(n)},e);else if(s&&(typeof s=="string"||typeof s=="object")){const o=n.parseEditorState(s);n.setEditorState(o,t)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[Cr,qe,yr,br,Kn]},Yd=Symbol.for("@lexical/extension/LexicalBuilder");function qd(){}function Pb(n){throw n}function Ps(n){return Array.isArray(n)?n:[n]}const sa="0.40.0+prod.esm";let zb=class qs{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=sa,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(e){const t=[Ps(Lb)];for(const r of e)t.push(Ps(r));return new qs(t)}static maybeFromEditor(e){const t=e[Yd];return t&&(t.PACKAGE_VERSION!==sa&&ae(292,t.PACKAGE_VERSION,sa),t instanceof qs||ae(293)),t}static fromEditor(e){const t=qs.maybeFromEditor(e);return t===void 0&&ae(294),t}constructEditor(){const{$initialEditorState:e,onError:t,...r}=this.buildCreateEditorArgs(),i=Object.assign(ui({...r,...t?{onError:s=>{t(s,i)}}:{}}),{[Yd]:this});for(const s of this.sortedExtensionReps())s.build(i);return i}buildEditor(){let e=qd;function t(){try{e()}finally{e=qd}}const r=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=ft(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&&ae(295,e.name),t}addEdge(e,t,r){const i=this.outgoingConfigEdges.get(e);i?i.set(t,r):this.outgoingConfigEdges.set(e,new Map([[t,r]]));const s=this.incomingEdges.get(t);s?s.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&ae(296);const t=Ps(e),[r]=t;typeof r.name!="string"&&ae(297,typeof r.name);let i=this.extensionNameMap.get(r.name);if(i!==void 0&&i.extension!==r&&ae(298,r.name),!i){i=new Rb(this,r),this.extensionNameMap.set(r.name,i);const s=this.conflicts.get(r.name);typeof s=="string"&&ae(299,r.name,s);for(const o of r.conflictsWith||[])this.extensionNameMap.has(o)&&ae(299,r.name,o),this.conflicts.set(o,r.name);for(const o of r.dependencies||[]){const l=Ps(o);this.addEdge(r.name,l[0].name,l.slice(1)),this.addExtension(l)}for(const[o,l]of r.peerDependencies||[])this.addEdge(r.name,o,l?[l]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const e=[],t=(r,i)=>{let s=r.state;if(vp(s))return;const o=r.extension.name;var l;ia(s)||ae(300,o,i||"[unknown]"),ia(l=s)||ae(304,String(l.id),String(uu)),s=Object.assign(l,{id:Ya}),r.state=s;const a=this.outgoingConfigEdges.get(o);if(a)for(const c of a.keys()){const u=this.extensionNameMap.get(c);u&&t(u,o)}s=$b(s),r.state=s,e.push(r)};for(const r of this.extensionNameMap.values())ia(r.state)&&t(r);for(const r of e)for(const[i,s]of this.outgoingConfigEdges.get(r.extension.name)||[])if(s.length>0){const o=this.extensionNameMap.get(i);if(o)for(const l of s)o.configs.add(l)}for(const[r,...i]of this.roots)if(i.length>0){const s=this.extensionNameMap.get(r.name);s===void 0&&ae(301,r.name);for(const o of i)s.configs.add(o)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){const t=this.sortedExtensionReps(),r=new AbortController,i=[()=>r.abort()],s=r.signal;for(const o of t){const l=o.register(e,s);l&&i.push(l)}for(const o of t){const l=o.afterRegistration(e);l&&i.push(l)}return ft(...i)}buildCreateEditorArgs(){const e={},t=new Set,r=new Map,i=new Map,s={},o={},l=this.sortedExtensionReps();for(const u of l){const{extension:d}=u;if(d.onError!==void 0&&(e.onError=d.onError),d.disableEvents!==void 0&&(e.disableEvents=d.disableEvents),d.parentEditor!==void 0&&(e.parentEditor=d.parentEditor),d.editable!==void 0&&(e.editable=d.editable),d.namespace!==void 0&&(e.namespace=d.namespace),d.$initialEditorState!==void 0&&(e.$initialEditorState=d.$initialEditorState),d.nodes)for(const f of Ib(d)){if(typeof f!="function"){const h=r.get(f.replace);h&&ae(302,d.name,f.replace.name,h.extension.name),r.set(f.replace,u)}t.add(f)}if(d.html){if(d.html.export)for(const[f,h]of d.html.export.entries())i.set(f,h);d.html.import&&Object.assign(s,d.html.import)}d.theme&&Cp(o,d.theme)}Object.keys(o).length>0&&(e.theme=o),t.size&&(e.nodes=[...t]);const a=Object.keys(s).length>0,c=i.size>0;(a||c)&&(e.html={},a&&(e.html.import=s),c&&(e.html.export=i));for(const u of l)u.init(e);return e.onError||(e.onError=Pb),e}};function Bb(n,e){const t=zb.fromEditor(n).extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}function Zd(n){const e=window.location.origin,t=r=>{if(r.origin!==e)return;const i=n.getRootElement();if(document.activeElement!==i)return;const s=r.data;if(typeof s=="string"){let o;try{o=JSON.parse(s)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"){const l=o.payload;if(l&&l.functionId==="makeChanges"){const a=l.args;if(a){const[c,u,d,f,h]=a;n.update(()=>{const g=M();if(N(g)){const p=g.anchor;let m=p.getNode(),b=0,_=0;if(R(m)&&c>=0&&u>=0&&(b=c,_=c+u,g.setTextNodeRange(m,b,m,_)),b===_&&d===""||(g.insertRawText(d),m=p.getNode()),R(m)){b=f,_=f+h;const y=m.getTextContentSize();b=b>y?y:b,_=_>y?y:_,g.setTextNodeRange(m,b,m,_)}r.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function Xd(n,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(n,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(n,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const vr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Ub=vr&&"documentMode"in document?document.documentMode:null,Kb=vr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Wb=!(!vr||!("InputEvent"in window)||Ub)&&"getTargetRanges"in new window.InputEvent("input"),jb=vr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Qd=vr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Hb=vr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Jb=vr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Kb&&!Hb,ef=U("DRAG_DROP_PASTE_FILE");let xs=class Ep extends Se{static getType(){return"quote"}static clone(e){return new Ep(e.__key)}createDOM(e){const t=document.createElement("blockquote");return _e(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:Gb,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(ne(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();r&&(t.style.textAlign=r);const i=this.getDirection();i&&(t.dir=i)}return{element:t}}static importJSON(e){return gi().updateFromJSON(e)}insertNewAfter(e,t){const r=J(),i=this.getDirection();return r.setDirection(i),this.insertAfter(r,t),r}collapseAtStart(){const e=J();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function gi(){return Le(new xs)}function qa(n){return n instanceof xs}let Ss=class kp extends Se{__tag;static getType(){return"heading"}static clone(e){return new kp(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}setTag(e){const t=this.getWritable();return this.__tag=e,t}createDOM(e){const t=this.__tag,r=document.createElement(t),i=e.theme.heading;if(i!==void 0){const s=i[t];_e(r,s)}return r}updateDOM(e,t,r){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:Fr,priority:0}),h2:e=>({conversion:Fr,priority:0}),h3:e=>({conversion:Fr,priority:0}),h4:e=>({conversion:Fr,priority:0}),h5:e=>({conversion:Fr,priority:0}),h6:e=>({conversion:Fr,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&tf(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>tf(e)?{conversion:t=>({node:Te("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(ne(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();r&&(t.style.textAlign=r);const i=this.getDirection();i&&(t.dir=i)}return{element:t}}static importJSON(e){return Te(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){const r=e?e.anchor.offset:0,i=this.getLastDescendant(),s=!i||e&&e.anchor.key===i.getKey()&&r===i.getTextContentSize()||!e?J():Te(this.getTag()),o=this.getDirection();if(s.setDirection(o),this.insertAfter(s,t),r===0&&!this.isEmpty()&&e){const l=J();l.select(),this.replace(l,!0)}return s}collapseAtStart(){const e=this.isEmpty()?J():Te(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}};function tf(n){return n.nodeName.toLowerCase()==="span"&&n.style.fontSize==="26pt"}function Fr(n){const e=n.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=Te(e),n.style!==null&&(ol(n,t),t.setFormat(n.style.textAlign))),{node:t}}function Gb(n){const e=gi();return n.style!==null&&(e.setFormat(n.style.textAlign),ol(n,e)),{node:e}}function Te(n="h1"){return Le(new Ss(n))}function Vb(n){return n instanceof Ss}function zs(n){let e=null;if(rn(n,DragEvent)?e=n.dataTransfer:rn(n,ClipboardEvent)&&(e=n.clipboardData),e===null)return[!1,[],!1];const t=e.types,r=t.includes("Files"),i=t.includes("text/html")||t.includes("text/plain");return[r,Array.from(e.files),i]}function nf(n){const e=M();if(!N(e))return!1;const t=new Set,r=e.getNodes();for(let i=0;i<r.length;i++){const s=r[i],o=s.getKey();if(t.has(o))continue;const l=le(s,c=>A(c)&&!c.isInline());if(l===null)continue;const a=l.getKey();l.canIndent()&&!t.has(a)&&(t.add(a),n(l))}return t.size>0}function rf(n){const e=dt(n);return Z(e)}function oa(n){for(const e of["lowercase","uppercase","capitalize"])n.hasFormat(e)&&n.toggleFormat(e)}function Yb(n){return ft(n.registerCommand(mr,e=>{const t=M();return!!je(t)&&(t.clear(),!0)},B),n.registerCommand(Nt,e=>{const t=M();return N(t)?(t.deleteCharacter(e),!0):!!je(t)&&(t.deleteNodes(),!0)},B),n.registerCommand(or,e=>{const t=M();return!!N(t)&&(t.deleteWord(e),!0)},B),n.registerCommand(lr,e=>{const t=M();return!!N(t)&&(t.deleteLine(e),!0)},B),n.registerCommand(Tn,e=>{const t=M();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const r=e.dataTransfer;if(r!=null)Ud(r,t,n);else if(N(t)){const i=e.data;return i&&t.insertText(i),!0}}return!0},B),n.registerCommand(Gi,()=>{const e=M();return!!N(e)&&(e.removeText(),!0)},B),n.registerCommand(ve,e=>{const t=M();return!!N(t)&&(t.formatText(e),!0)},B),n.registerCommand(Mc,e=>{const t=M();if(!N(t)&&!je(t))return!1;const r=t.getNodes();for(const i of r){const s=le(i,o=>A(o)&&!o.isInline());s!==null&&s.setFormat(e)}return!0},B),n.registerCommand(ln,e=>{const t=M();return!!N(t)&&(t.insertLineBreak(e),!0)},B),n.registerCommand(In,()=>{const e=M();return!!N(e)&&(e.insertParagraph(),!0)},B),n.registerCommand(ao,()=>(Xo([yt()]),!0),B),n.registerCommand(Bt,()=>nf(e=>{const t=e.getIndent();e.setIndent(t+1)}),B),n.registerCommand(nn,()=>nf(e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),B),n.registerCommand(cn,e=>{const t=M();if(je(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectPrevious(),!0}else if(N(t)){const r=xo(t.focus,!0);if(!e.shiftKey&&Z(r)&&!r.isIsolated()&&!r.isInline())return r.selectPrevious(),e.preventDefault(),!0}return!1},B),n.registerCommand(ar,e=>{const t=M();if(je(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectNext(0,0),!0}else if(N(t)){if((function(i){const s=i.focus;return s.key==="root"&&s.offset===de().getChildrenSize()})(t))return e.preventDefault(),!0;const r=xo(t.focus,!1);if(!e.shiftKey&&Z(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),e.preventDefault(),!0}return!1},B),n.registerCommand(hs,e=>{const t=M();if(je(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),zd(r[0])?r[0].selectNext(0,0):r[0].selectPrevious(),!0}if(!N(t))return!1;if(ko(t,!0)){const r=e.shiftKey;return e.preventDefault(),To(t,r,!0),!0}return!1},B),n.registerCommand(jo,e=>{const t=M();if(je(t)){const i=t.getNodes();if(i.length>0)return e.preventDefault(),zd(i[0])?i[0].selectPrevious():i[0].selectNext(0,0),!0}if(!N(t))return!1;const r=e.shiftKey;return!!ko(t,!1)&&(e.preventDefault(),To(t,r,!1),!0)},B),n.registerCommand(Jo,e=>{if(rf(e.target))return!1;const t=M();if(N(t)){if((function(r){if(!r.isCollapsed())return!1;const{anchor:i}=r;if(i.offset!==0)return!1;const s=i.getNode();if(ye(s))return!1;const o=_b(s);return o.getIndent()>0&&(o.is(s)||s.is(o.getFirstDescendant()))})(t))return e.preventDefault(),n.dispatchCommand(nn,void 0);if(Qd&&navigator.language==="ko-KR")return!1}else if(!je(t))return!1;return e.preventDefault(),n.dispatchCommand(Nt,!0)},B),n.registerCommand(Go,e=>{if(rf(e.target))return!1;const t=M();return!(!N(t)&&!je(t))&&(e.preventDefault(),n.dispatchCommand(Nt,!1))},B),n.registerCommand($n,e=>{const t=M();if(!N(t))return!1;if(oa(t),e!==null){if((Qd||jb||Jb)&&Wb)return!1;if(e.preventDefault(),e.shiftKey)return n.dispatchCommand(ln,!1)}return n.dispatchCommand(In,void 0)},B),n.registerCommand(oi,()=>{const e=M();return!!N(e)&&(n.blur(),!0)},B),n.registerCommand(Vo,e=>{const[,t]=zs(e);if(t.length>0){const i=Xd(e.clientX,e.clientY);if(i!==null){const{offset:s,node:o}=i,l=dt(o);if(l!==null){const a=ci();if(R(l))a.anchor.set(l.getKey(),s,"text"),a.focus.set(l.getKey(),s,"text");else{const u=l.getParentOrThrow().getKey(),d=l.getIndexWithinParent()+1;a.anchor.set(u,d,"element"),a.focus.set(u,d,"element")}const c=Mn(a);Re(c)}n.dispatchCommand(ef,t)}return e.preventDefault(),!0}const r=M();return!!N(r)},B),n.registerCommand(Yo,e=>{const[t]=zs(e),r=M();return!(t&&!N(r))},B),n.registerCommand(Ic,e=>{const[t]=zs(e),r=M();if(t&&!N(r))return!1;const i=Xd(e.clientX,e.clientY);if(i!==null){const s=dt(i.node);Z(s)&&e.preventDefault()}return!0},B),n.registerCommand(Vr,()=>(Yc(),!0),B),n.registerCommand(_r,e=>(Wd(n,rn(e,ClipboardEvent)?e:null),!0),B),n.registerCommand(li,e=>((async function(t,r){await Wd(r,rn(t,ClipboardEvent)?t:null),r.update(()=>{const i=M();N(i)?i.removeText():je(i)&&i.getNodes().forEach(s=>s.remove())})})(e,n),!0),B),n.registerCommand(ri,e=>{const[,t,r]=zs(e);return t.length>0&&!r?(n.dispatchCommand(ef,t),!0):Wn(e.target)&&nl(e.target)?!1:M()!==null&&((function(i,s){i.preventDefault(),s.update(()=>{const o=M(),l=rn(i,InputEvent)||rn(i,KeyboardEvent)?null:i.clipboardData;l!=null&&o!==null&&Ud(l,o,s)},{tag:Rc})})(e,n),!0)},B),n.registerCommand(Ho,e=>{const t=M();return N(t)&&oa(t),!1},B),n.registerCommand(gs,e=>{const t=M();return N(t)&&oa(t),!1},B))}function En(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 qb(n){let e=1,t=n.getParent();for(;t!=null;){if(ee(t)){const r=t.getParent();if(Y(r)){e++,t=r.getParent();continue}En(40)}return e}return e}function Za(n){let e=n.getParent();Y(e)||En(40);let t=e;for(;t!==null;)t=t.getParent(),Y(t)&&(e=t);return e}function Tp(n){let e=[];const t=n.getChildren().filter(ee);for(let r=0;r<t.length;r++){const i=t[r],s=i.getFirstChild();Y(s)?e=e.concat(Tp(s)):e.push(i)}return e}function zt(n){return ee(n)&&Y(n.getFirstChild())}function sf(n){return ht().append(n)}function Np(n,e){return ee(n)&&(e.length===0||e.length===1&&n.is(e[0])&&n.getChildrenSize()===0)}function Ao(n){const e=M();if(e!==null){let t=e.getNodes();if(N(e)){const i=e.getStartEndPoints();i===null&&En(143);const[s]=i,o=s.getNode(),l=o.getParent();if(Ue(o)){const a=o.getFirstChild();if(a)t=a.selectStart().getNodes();else{const c=J();o.append(c),t=c.select().getNodes()}}else if(Np(o,t)){const a=st(n);if(Ue(l)){o.replace(a);const c=ht();A(o)&&(c.setFormat(o.getFormatType()),c.setIndent(o.getIndent())),a.append(c)}else if(ee(o)){const c=o.getParentOrThrow();gr(a,c.getChildren()),c.replace(a)}return}}const r=new Set;for(let i=0;i<t.length;i++){const s=t[i];if(A(s)&&s.isEmpty()&&!ee(s)&&!r.has(s.getKey())){of(s,n);continue}let o=jc(s)?s.getParent():ee(s)&&s.isEmpty()?s:null;for(;o!=null;){const l=o.getKey();if(Y(o)){if(!r.has(l)){const a=st(n);gr(a,o.getChildren()),o.replace(a),r.add(l)}break}{const a=o.getParent();if(Ue(a)&&!r.has(l)){r.add(l),of(o,n);break}o=a}}}}}function gr(n,e){n.splice(n.getChildrenSize(),0,e)}function of(n,e){if(Y(n))return n;const t=n.getPreviousSibling(),r=n.getNextSibling(),i=ht();let s;if(gr(i,n.getChildren()),Y(t)&&e===t.getListType())t.append(i),Y(r)&&e===r.getListType()&&(gr(t,r.getChildren()),r.remove()),s=t;else if(Y(r)&&e===r.getListType())r.getFirstChildOrThrow().insertBefore(i),s=r;else{const l=st(e);l.append(i),n.replace(l),s=l}i.setFormat(n.getFormatType()),i.setIndent(n.getIndent());const o=M();return N(o)&&(s.getKey()===o.anchor.key&&o.anchor.set(i.getKey(),o.anchor.offset,"element"),s.getKey()===o.focus.key&&o.focus.set(i.getKey(),o.focus.offset,"element")),n.remove(),s}function du(n,e){const t=n.getLastChild(),r=e.getFirstChild();t&&r&&zt(t)&&zt(r)&&(du(t.getFirstChild(),r.getFirstChild()),r.remove());const i=e.getChildren();i.length>0&&n.append(...i),e.remove()}function Ap(){const n=M();if(N(n)){const e=new Set,t=n.getNodes(),r=n.anchor.getNode();if(Np(r,t))e.add(Za(r));else for(let i=0;i<t.length;i++){const s=t[i];if(jc(s)){const o=mb(s,Er);o!=null&&e.add(Za(o))}}for(const i of e){let s=i;const o=Tp(i);for(const l of o){const a=J().setTextStyle(n.style).setTextFormat(n.format);gr(a,l.getChildren()),s.insertAfter(a),s=a,l.__key===n.anchor.key&&Rn(n.anchor,et(lt(a,"next"))),l.__key===n.focus.key&&Rn(n.focus,et(lt(a,"next"))),l.remove()}i.remove()}}}function Op(n){const e=n.getListType()!=="check";let t=n.getStart();for(const r of n.getChildren())ee(r)&&(r.getValue()!==t&&r.setValue(t),e&&r.getLatest().__checked!=null&&r.setChecked(void 0),Y(r.getFirstChild())||t++)}function Zb(n){const e=new Set;if(zt(n)||e.has(n.getKey()))return;const t=n.getParent(),r=n.getNextSibling(),i=n.getPreviousSibling();if(zt(r)&&zt(i)){const s=i.getFirstChild();if(Y(s)){s.append(n);const o=r.getFirstChild();Y(o)&&(gr(s,o.getChildren()),r.remove(),e.add(r.getKey()))}}else if(zt(r)){const s=r.getFirstChild();if(Y(s)){const o=s.getFirstChild();o!==null&&o.insertBefore(n)}}else if(zt(i)){const s=i.getFirstChild();Y(s)&&s.append(n)}else if(Y(t)){const s=ht().setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle()),o=st(t.getListType()).setTextFormat(t.getTextFormat()).setTextStyle(t.getTextStyle());s.append(o),o.append(n),i?i.insertAfter(s):r?r.insertBefore(s):t.append(s)}}function Xb(n){if(zt(n))return;const e=n.getParent(),t=e?e.getParent():void 0;if(Y(t?t.getParent():void 0)&&ee(t)&&Y(e)){const r=e?e.getFirstChild():void 0,i=e?e.getLastChild():void 0;if(n.is(r))t.insertBefore(n),e.isEmpty()&&t.remove();else if(n.is(i))t.insertAfter(n),e.isEmpty()&&t.remove();else{const s=e.getListType(),o=ht(),l=st(s);o.append(l),n.getPreviousSiblings().forEach(u=>l.append(u));const a=ht(),c=st(s);a.append(c),gr(c,n.getNextSiblings()),t.insertBefore(o),t.insertAfter(a),t.replace(n)}}}function Qb(){const n=M();if(!N(n)||!n.isCollapsed())return!1;const e=n.anchor.getNode();let t=null;if(ee(e)&&e.getChildrenSize()===0)t=e;else if(R(e)){const a=e.getParent();ee(a)&&a.getChildren().every(c=>R(c)&&c.getTextContent().trim()==="")&&(t=a)}if(t===null)return!1;const r=Za(t),i=t.getParent();Y(i)||En(40);const s=i.getParent();let o;if(Ue(s))o=J(),r.insertAfter(o);else{if(!ee(s))return!1;o=ht(),s.insertAfter(o)}o.setTextStyle(n.style).setTextFormat(n.format).select();const l=t.getNextSiblings();if(l.length>0){const a=st(i.getListType());if(ee(o)){const c=ht();c.append(a),o.insertAfter(c)}else o.insertAfter(a);a.append(...l)}return(function(a){let c=a;for(;c.getNextSibling()==null&&c.getPreviousSibling()==null;){const u=c.getParent();if(u==null||!ee(u)&&!Y(u))break;c=u}c.remove()})(t),!0}let Er=class extends Se{__value;__checked;$config(){return this.config("listitem",{$transform:e=>{if(e.__checked==null)return;const t=e.getParent();Y(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)},extends:Se,importDOM:{li:()=>({conversion:ex,priority:0})}})}constructor(e=1,t=void 0,r){super(r),this.__value=e===void 0?1:e,this.__checked=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){const t=document.createElement("li");return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,r){(function(o,l,a){const c=l.getParent();!Y(c)||c.getListType()!=="check"||Y(l.getFirstChild())?(o.removeAttribute("role"),o.removeAttribute("tabIndex"),o.removeAttribute("aria-checked")):(o.setAttribute("role","checkbox"),o.setAttribute("tabIndex","-1"),a&&l.__checked===a.__checked||o.setAttribute("aria-checked",l.getChecked()?"true":"false"))})(t,this,e),t.value=this.__value,(function(o,l,a){const c=[],u=[],d=l.list,f=d?d.listitem:void 0;let h;if(d&&d.nested&&(h=d.nested.listitem),f!==void 0&&c.push(...dn(f)),d){const g=a.getParent(),p=Y(g)&&g.getListType()==="check",m=a.getChecked();p&&!m||u.push(d.listitemUnchecked),p&&m||u.push(d.listitemChecked),p&&c.push(m?d.listitemChecked:d.listitemUnchecked)}if(h!==void 0){const g=dn(h);a.getChildren().some(p=>Y(p))?c.push(...g):u.push(...g)}u.length>0&&an(o,...u),c.length>0&&_e(o,...c)})(t,r.theme,this);const i=e?e.__style:"",s=this.__style;i!==s&&(s===""?t.removeAttribute("style"):t.style.cssText=s),(function(o,l,a){const c=Xi(l.__textStyle);for(const u in c)o.style.setProperty(`--listitem-marker-${u}`,c[u]);if(a)for(const u in Xi(a.__textStyle))u in c||o.style.removeProperty(`--listitem-marker-${u}`)})(t,this,e)}updateDOM(e,t,r){const i=t;return this.updateListItemDOM(e,i,r),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){const t=this.createDOM(e._config),r=this.getFormatType();r&&(t.style.textAlign=r);const i=this.getDirection();return i&&(t.dir=i),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let t=0;t<e.length;t++){const r=e[t];if(A(r)&&this.canMergeWith(r)){const i=r.getChildren();this.append(...i),r.remove()}else super.append(r)}return this}replace(e,t){if(ee(e))return super.replace(e);this.setIndent(0);const r=this.getParentOrThrow();if(!Y(r))return e;if(r.__first===this.getKey())r.insertBefore(e);else if(r.__last===this.getKey())r.insertAfter(e);else{const i=st(r.getListType());let s=this.getNextSibling();for(;s;){const o=s;s=s.getNextSibling(),i.append(o)}r.insertAfter(e),e.insertAfter(i)}return t&&(A(e)||En(139),this.getChildren().forEach(i=>{e.append(i)})),this.remove(),r.getChildrenSize()===0&&r.remove(),e}insertAfter(e,t=!0){const r=this.getParentOrThrow();if(Y(r)||En(39),ee(e))return super.insertAfter(e,t);const i=this.getNextSiblings();if(r.insertAfter(e,t),i.length!==0){const s=st(r.getListType());i.forEach(o=>s.append(o)),e.insertAfter(s,t)}return e}remove(e){const t=this.getPreviousSibling(),r=this.getNextSibling();super.remove(e),t&&r&&zt(t)&&zt(r)&&(du(t.getFirstChild(),r.getFirstChild()),r.remove())}insertNewAfter(e,t=!0){const r=ht().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(r,t),r}collapseAtStart(e){const t=J();this.getChildren().forEach(o=>t.append(o));const r=this.getParentOrThrow(),i=r.getParentOrThrow(),s=ee(i);if(r.getChildrenSize()===1)if(s)r.remove(),i.select();else{r.insertBefore(t),r.remove();const o=e.anchor,l=e.focus,a=t.getKey();o.type==="element"&&o.getNode().is(this)&&o.set(a,o.offset,"element"),l.type==="element"&&l.getNode().is(this)&&l.set(a,l.offset,"element")}else r.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){const t=this.getWritable();return t.__value=e,t}getChecked(){const e=this.getLatest();let t;const r=this.getParent();return Y(r)&&(t=r.getListType()),t==="check"?!!e.__checked:void 0}setChecked(e){const t=this.getWritable();return t.__checked=e,t}toggleChecked(){const e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){const e=this.getParent();if(e===null||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),r=0;for(;ee(t);)t=t.getParentOrThrow().getParentOrThrow(),r++;return r}setIndent(e){typeof e!="number"&&En(117),(e=Math.floor(e))>=0||En(199);let t=this.getIndent();for(;t!==e;)t<e?(Zb(this),t++):(Xb(this),t--);return this}canInsertAfter(e){return ee(e)}canReplaceWith(e){return ee(e)}canMergeWith(e){return ee(e)||wr(e)}extractWithChild(e,t){if(!N(t))return!1;const r=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return st("bullet")}canMergeWhenEmpty(){return!0}};function ex(n){if(n.classList.contains("task-list-item")){for(const t of n.children)if(t.tagName==="INPUT")return lf(t)}if(n.classList.contains("joplin-checkbox")){for(const t of n.children)if(t.classList.contains("checkbox-wrapper")&&t.children.length>0&&t.children[0].tagName==="INPUT")return lf(t.children[0])}const e=n.getAttribute("aria-checked");return{node:ht(e==="true"||e!=="false"&&void 0)}}function lf(n){return n.getAttribute("type")!=="checkbox"?{node:null}:{node:ht(n.hasAttribute("checked"))}}function ht(n){return Le(new Er(void 0,n))}function ee(n){return n instanceof Er}let Cs=class extends Se{__tag;__start;__listType;$config(){return this.config("list",{$transform:e=>{(function(t){const r=t.getNextSibling();Y(r)&&t.getListType()===r.getListType()&&du(t,r)})(e),Op(e)},extends:Se,importDOM:{ol:()=>({conversion:cf,priority:0}),ul:()=>({conversion:cf,priority:0})}})}constructor(e="number",t=1,r){super(r);const i=nx[e]||e;this.__listType=i,this.__tag=i==="number"?"ol":"ul",this.__start=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){const t=this.getWritable();return t.__listType=e,t.__tag=e==="number"?"ol":"ul",t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){const t=this.getWritable();return t.__start=e,t}createDOM(e,t){const r=this.__tag,i=document.createElement(r);return this.__start!==1&&i.setAttribute("start",String(this.__start)),i.__lexicalListType=this.__listType,af(i,e.theme,this),i}updateDOM(e,t,r){return e.__tag!==this.__tag||e.__listType!==this.__listType||(af(t,r.theme,this),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){const t=this.createDOM(e._config,e);return ne(t)&&(this.__start!==1&&t.setAttribute("start",String(this.__start)),this.__listType==="check"&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,t,r){let i=r;for(let s=0;s<r.length;s++){const o=r[s];ee(o)||(i===r&&(i=[...r]),i[s]=ht().append(!A(o)||Y(o)||o.isInline()?o:he(o.getTextContent())))}return super.splice(e,t,i)}extractWithChild(e){return ee(e)}};function af(n,e,t){const r=[],i=[],s=e.list;if(s!==void 0){const o=s[`${t.__tag}Depth`]||[],l=qb(t)-1,a=l%o.length,c=o[a],u=s[t.__tag];let d;const f=s.nested,h=s.checklist;if(f!==void 0&&f.list&&(d=f.list),u!==void 0&&r.push(u),h!==void 0&&t.__listType==="check"&&r.push(h),c!==void 0){r.push(...dn(c));for(let g=0;g<o.length;g++)g!==a&&i.push(t.__tag+g)}if(d!==void 0){const g=dn(d);l>1?r.push(...g):i.push(...g)}}i.length>0&&an(n,...i),r.length>0&&_e(n,...r)}function tx(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t];if(ee(r)){e.push(r);const i=r.getChildren();i.length>1&&i.forEach(s=>{Y(s)&&e.push(sf(s))})}else e.push(sf(r))}return e}function cf(n){const e=n.nodeName.toLowerCase();let t=null;return e==="ol"?t=st("number",n.start):e==="ul"&&(t=(function(r){if(r.getAttribute("__lexicallisttype")==="check"||r.classList.contains("contains-task-list")||r.getAttribute("data-is-checklist")==="1")return!0;for(const i of r.childNodes)if(ne(i)&&i.hasAttribute("aria-checked"))return!0;return!1})(n)?st("check"):st("bullet")),{after:tx,node:t}}const nx={ol:"number",ul:"bullet"};function st(n="number",e=1){return Le(new Cs(n,e))}function Y(n){return n instanceof Cs}const gl=U("INSERT_CHECK_LIST_COMMAND");function uf(n){return ft(n.registerCommand(gl,()=>(Ao("check"),!0),q),n.registerCommand(ar,e=>hf(e,n,!1),q),n.registerCommand(cn,e=>hf(e,n,!0),q),n.registerCommand(oi,()=>{if(Xa()!=null){const e=n.getRootElement();return e?.focus(),!0}return!1},q),n.registerCommand(Ho,e=>{const t=Xa();return!(t==null||!n.isEditable())&&(n.update(()=>{const r=dt(t);ee(r)&&(e.preventDefault(),r.toggleChecked())}),!0)},q),n.registerCommand(hs,e=>n.getEditorState().read(()=>{const t=M();if(N(t)&&t.isCollapsed()){const{anchor:r}=t,i=r.type==="element";if(i||r.offset===0){const s=r.getNode(),o=le(s,l=>A(l)&&!l.isInline());if(ee(o)){const l=o.getParent();if(Y(l)&&l.getListType()==="check"&&(i||o.getFirstDescendant()===s)){const a=n.getElementByKey(o.__key);if(a!=null&&document.activeElement!==a)return a.focus(),e.preventDefault(),!0}}}}return!1}),q),n.registerRootListener((e,t)=>{e!==null&&(e.addEventListener("click",df),e.addEventListener("pointerdown",ff)),t!==null&&(t.removeEventListener("click",df),t.removeEventListener("pointerdown",ff))}))}function Mp(n,e){const t=n.target;if(!ne(t))return;const r=t.firstChild;if(ne(r)&&(r.tagName==="UL"||r.tagName==="OL"))return;const i=t.parentNode;if(!i||i.__lexicalListType!=="check")return;const s=t.getBoundingClientRect(),o=xb(t),l=n.clientX/o,a=window.getComputedStyle?window.getComputedStyle(t,"::before"):{width:"0px"},c=parseFloat(a.width),u=n.pointerType==="touch"?32:0;(t.dir==="rtl"?l<s.right+u&&l>s.right-c-u:l>s.left-u&&l<s.left+c+u)&&e()}function df(n){Mp(n,()=>{if(ne(n.target)){const e=n.target,t=il(e);t!=null&&t.isEditable()&&t.update(()=>{const r=dt(e);ee(r)&&(e.focus(),r.toggleChecked())})}})}function ff(n){Mp(n,()=>{n.preventDefault()})}function Xa(){const n=document.activeElement;return ne(n)&&n.tagName==="LI"&&n.parentNode!=null&&n.parentNode.__lexicalListType==="check"?n:null}function hf(n,e,t){const r=Xa();return r!=null&&e.update(()=>{const i=dt(r);if(!ee(i))return;const s=(function(o,l){let a=l?o.getPreviousSibling():o.getNextSibling(),c=o;for(;a==null&&ee(c);)c=c.getParentOrThrow().getParent(),c!=null&&(a=l?c.getPreviousSibling():c.getNextSibling());for(;ee(a);){const u=l?a.getLastChild():a.getFirstChild();if(!Y(u))return a;a=l?u.getLastChild():u.getFirstChild()}return null})(i,t);if(s!=null){s.selectStart();const o=e.getElementByKey(s.__key);o!=null&&(n.preventDefault(),setTimeout(()=>{o.focus()},0))}}),!1}const rx=U("UPDATE_LIST_START_COMMAND"),pi=U("INSERT_UNORDERED_LIST_COMMAND"),mi=U("INSERT_ORDERED_LIST_COMMAND"),fu=U("REMOVE_LIST_COMMAND");function la(n){return ft(n.registerCommand(mi,()=>(Ao("number"),!0),q),n.registerCommand(rx,e=>{const{listNodeKey:t,newStart:r}=e,i=Q(t);return!!Y(i)&&(i.getListType()==="number"&&(i.setStart(r),Op(i)),!0)},q),n.registerCommand(pi,()=>(Ao("bullet"),!0),q),n.registerCommand(fu,()=>(Ap(),!0),q),n.registerCommand(In,()=>Qb(),q),n.registerNodeTransform(Er,e=>{const t=e.getFirstChild();if(t){if(R(t)){const r=t.getStyle(),i=t.getFormat();e.getTextStyle()!==r&&e.setTextStyle(r),e.getTextFormat()!==i&&e.setTextFormat(i)}}else{const r=M();N(r)&&(r.style!==e.getTextStyle()||r.format!==e.getTextFormat())&&r.isCollapsed()&&e.is(r.anchor.getNode())&&e.setTextStyle(r.style).setTextFormat(r.format)}}),n.registerNodeTransform(qe,e=>{const t=e.getParent();if(ee(t)&&e.is(t.getFirstChild())){const r=e.getStyle(),i=e.getFormat();r===t.getTextStyle()&&i===t.getTextFormat()||t.setTextStyle(r).setTextFormat(i)}}))}function aa(n,e){n.update(()=>Ao(e))}function ix(n){n.update(()=>Ap())}const hu=/^(\d+(?:\.\d+)?)px$/,Ne={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class kr extends Se{__colSpan;__rowSpan;__headerState;__width;__backgroundColor;__verticalAlign;static getType(){return"tablecell"}static clone(e){return new kr(e.__headerState,e.__colSpan,e.__width,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign}static importDOM(){return{td:e=>({conversion:gf,priority:0}),th:e=>({conversion:gf,priority:0})}}static importJSON(e){return jt().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}constructor(e=Ne.NO_STATUS,t=1,r,i){super(i),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=r,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){const t=document.createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(t.style.backgroundColor=this.__backgroundColor),Qa(this.__verticalAlign)&&(t.style.verticalAlign=this.__verticalAlign),_e(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const t=super.exportDOM(e);if(ne(t.element)){const r=t.element;r.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),r.style.border="1px solid black",this.__colSpan>1&&(r.colSpan=this.__colSpan),this.__rowSpan>1&&(r.rowSpan=this.__rowSpan),r.style.width=`${this.getWidth()||75}px`,r.style.verticalAlign=this.getVerticalAlign()||"top",r.style.textAlign="start",this.__backgroundColor===null&&this.hasHeader()&&(r.style.backgroundColor="#f2f3f5")}return t}exportJSON(){return{...super.exportJSON(),...Qa(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){const t=this.getWritable();return t.__colSpan=e,t}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){const t=this.getWritable();return t.__rowSpan=e,t}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e,t=Ne.BOTH){const r=this.getWritable();return r.__headerState=e&t|r.__headerState&~t,r}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){const t=this.getWritable();return t.__width=e,t}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){const t=this.getWritable();return t.__backgroundColor=e,t}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){const t=this.getWritable();return t.__verticalAlign=e||void 0,t}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==Ne.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function Qa(n){return n==="middle"||n==="bottom"}function gf(n){const e=n,t=n.nodeName.toLowerCase();let r;hu.test(e.style.width)&&(r=parseFloat(e.style.width));const i=jt(t==="th"?Ne.ROW:Ne.NO_STATUS,e.colSpan,r);i.__rowSpan=e.rowSpan;const s=e.style.backgroundColor;s!==""&&(i.__backgroundColor=s);const o=e.style.verticalAlign;Qa(o)&&(i.__verticalAlign=o);const l=e.style,a=(l&&l.textDecoration||"").split(" "),c=l.fontWeight==="700"||l.fontWeight==="bold",u=a.includes("line-through"),d=l.fontStyle==="italic",f=a.includes("underline");return{after:h=>{const g=[];let p=null;const m=()=>{if(p){const b=p.getFirstChild();ue(b)&&p.getChildrenSize()===1&&b.remove()}};for(const b of h)Pg(b)||R(b)||ue(b)?(R(b)&&(c&&b.toggleFormat("bold"),u&&b.toggleFormat("strikethrough"),d&&b.toggleFormat("italic"),f&&b.toggleFormat("underline")),p?p.append(b):(p=J().append(b),g.push(p))):(g.push(b),m(),p=null);return m(),g.length===0&&g.push(J()),g},node:i}}function jt(n=Ne.NO_STATUS,e=1,t){return Le(new kr(n,e,t))}function me(n){return n instanceof kr}const ws=U("INSERT_TABLE_COMMAND");function te(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}class _i extends Se{__height;static getType(){return"tablerow"}static clone(e){return new _i(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:sx,priority:0})}}static importJSON(e){return Qi().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){const e=this.getHeight();return{...super.exportJSON(),...e===void 0?void 0:{height:e}}}createDOM(e){const t=document.createElement("tr");return this.__height&&(t.style.height=`${this.__height}px`),_e(t,e.theme.tableRow),t}extractWithChild(e,t,r){return r==="html"}isShadowRoot(){return!0}setHeight(e){const t=this.getWritable();return t.__height=e,t}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function sx(n){const e=n;let t;return hu.test(e.style.height)&&(t=parseFloat(e.style.height)),{after:r=>ap(r,me),node:Qi(t)}}function Qi(n){return Le(new _i(n))}function tt(n){return n instanceof _i}const Ip=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,ox=Ip&&"documentMode"in document?document.documentMode:null;function lx(n,e,t=!0){const r=pu();for(let i=0;i<n;i++){const s=Qi();for(let o=0;o<e;o++){let l=Ne.NO_STATUS;typeof t=="object"?(i===0&&t.rows&&(l|=Ne.ROW),o===0&&t.columns&&(l|=Ne.COLUMN)):t&&(i===0&&(l|=Ne.ROW),o===0&&(l|=Ne.COLUMN));const a=jt(l),c=J();c.append(he()),a.append(c),s.append(a)}r.append(s)}return r}function ax(n){const e=le(n,t=>me(t));return me(e)?e:null}function $p(n){const e=le(n,t=>Ht(t));if(Ht(e))return e;throw new Error("Expected table cell to be inside of table.")}Ip&&"InputEvent"in window&&!ox&&new window.InputEvent("input");const ec=(n,e)=>n===Ne.BOTH||n===e?e:Ne.NO_STATUS;function pf(n=!0){const e=M();N(e)||Tr(e)||te(188);const t=e.anchor.getNode(),r=e.focus.getNode(),[i]=gt(t),[s,,o]=gt(r),[,l,a]=bn(o,s,i),{startRow:c}=a,{startRow:u}=l;return n?tc(c+i.__rowSpan>u+s.__rowSpan?i:s,!0):tc(u<c?s:i,!1)}function tc(n,e=!0){const[,,t]=gt(n),[r,i]=bn(t,n,n),s=r[0].length,{startRow:o}=i;let l=null;if(e){const a=o+n.__rowSpan-1,c=r[a],u=Qi();for(let f=0;f<s;f++){const{cell:h,startRow:g}=c[f];if(g+h.__rowSpan-1<=a){const p=c[f].cell.__headerState,m=ec(p,Ne.COLUMN);u.append(jt(m).append(J()))}else h.setRowSpan(h.__rowSpan+1)}const d=t.getChildAtIndex(a);tt(d)||te(256),d.insertAfter(u),l=u}else{const a=o,c=r[a],u=Qi();for(let f=0;f<s;f++){const{cell:h,startRow:g}=c[f];if(g===a){const p=c[f].cell.__headerState,m=ec(p,Ne.COLUMN);u.append(jt(m).append(J()))}else h.setRowSpan(h.__rowSpan+1)}const d=t.getChildAtIndex(a);tt(d)||te(257),d.insertBefore(u),l=u}return l}function mf(n=!0){const e=M();N(e)||Tr(e)||te(188);const t=e.anchor.getNode(),r=e.focus.getNode(),[i]=gt(t),[s,,o]=gt(r),[,l,a]=bn(o,s,i),{startColumn:c}=a,{startColumn:u}=l;return n?nc(c+i.__colSpan>u+s.__colSpan?i:s,!0):nc(u<c?s:i,!1)}function nc(n,e=!0,t=!0){const[,,r]=gt(n),[i,s]=bn(r,n,n),o=i.length,{startColumn:l}=s,a=e?l+n.__colSpan-1:l-1,c=r.getFirstChild();tt(c)||te(120);let u=null;function d(g=Ne.NO_STATUS){const p=jt(g).append(J());return u===null&&(u=p),p}let f=c;e:for(let g=0;g<o;g++){if(g!==0){const S=f.getNextSibling();tt(S)||te(121),f=S}const p=i[g],m=p[a<0?0:a].cell.__headerState,b=ec(m,Ne.ROW);if(a<0){gu(f,d(b));continue}const{cell:_,startColumn:y,startRow:C}=p[a];if(y+_.__colSpan-1<=a){let S=_,w=C,x=a;for(;w!==g&&S.__rowSpan>1;){if(x-=_.__colSpan,!(x>=0)){f.append(d(b));continue e}{const{cell:T,startRow:v}=p[x];S=T,w=v}}S.insertAfter(d(b))}else _.setColSpan(_.__colSpan+1)}u!==null&&t&&es(u);const h=r.getColWidths();if(h){const g=[...h],p=a<0?0:a,m=g[p];g.splice(p,0,m),r.setColWidths(g)}return u}function cx(){const n=M();N(n)||Tr(n)||te(188);const[e,t]=n.isBackward()?[n.focus.getNode(),n.anchor.getNode()]:[n.anchor.getNode(),n.focus.getNode()],[r,,i]=gt(e),[s]=gt(t),[o,l,a]=bn(i,r,s),{startRow:c}=l,{startRow:u}=a,d=u+s.__rowSpan-1;if(o.length===d-c+1)return void i.remove();const f=o[0].length,h=o[d+1],g=i.getChildAtIndex(d+1);for(let p=d;p>=c;p--){for(let b=f-1;b>=0;b--){const{cell:_,startRow:y,startColumn:C}=o[p][b];if(C===b){if(y<c||y+_.__rowSpan-1>d){const S=Math.max(y,c),w=Math.min(_.__rowSpan+y-1,d),x=S<=w?w-S+1:0;_.setRowSpan(_.__rowSpan-x)}if(y>=c&&y+_.__rowSpan-1>d&&p===d){g===null&&te(122);let S=null;for(let w=0;w<b;w++){const x=h[w],T=x.cell;x.startRow===p+1&&(S=T),T.__colSpan>1&&(w+=T.__colSpan-1)}S===null?gu(g,_):S.insertAfter(_)}}}const m=i.getChildAtIndex(p);tt(m)||te(206,String(p)),m.remove()}if(h!==void 0){const{cell:p}=h[0];es(p)}else{const p=o[c-1],{cell:m}=p[0];es(m)}}function ux(){const n=M();N(n)||Tr(n)||te(188);const e=n.anchor.getNode(),t=n.focus.getNode(),[r,,i]=gt(e),[s]=gt(t),[o,l,a]=bn(i,r,s),{startColumn:c}=l,{startRow:u,startColumn:d}=a,f=Math.min(c,d),h=Math.max(c+r.__colSpan-1,d+s.__colSpan-1),g=h-f+1;if(o[0].length===h-f+1)return i.selectPrevious(),void i.remove();const p=o.length;for(let y=0;y<p;y++)for(let C=f;C<=h;C++){const{cell:S,startColumn:w}=o[y][C];if(w<f){if(C===f){const x=f-w;S.setColSpan(S.__colSpan-Math.min(g,S.__colSpan-x))}}else if(w+S.__colSpan-1>h){if(C===h){const x=h-w+1;S.setColSpan(S.__colSpan-x)}}else S.remove()}const m=o[u],b=c>d?m[c+r.__colSpan]:m[d+s.__colSpan];if(b!==void 0){const{cell:y}=b;es(y)}else{const y=d<c?m[d-1]:m[c-1],{cell:C}=y;es(C)}const _=i.getColWidths();if(_){const y=[..._];y.splice(f,g),i.setColWidths(y)}}function es(n){const e=n.getFirstDescendant();e==null?n.selectStart():e.getParentOrThrow().selectStart()}function gu(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function dx(n){if(n.length===0)return null;const e=$p(n[0]),[t]=sn(e,null,null);let r=1/0,i=-1/0,s=1/0,o=-1/0;const l=new Set;for(const h of t)for(const g of h){if(!g||!g.cell)continue;const p=g.cell.getKey();if(!l.has(p)&&n.some(m=>m.is(g.cell))){l.add(p);const m=g.startRow,b=g.startColumn,_=g.cell.__rowSpan||1,y=g.cell.__colSpan||1;r=Math.min(r,m),i=Math.max(i,m+_-1),s=Math.min(s,b),o=Math.max(o,b+y-1)}}if(r===1/0||s===1/0)return null;const a=i-r+1,c=o-s+1,u=t[r][s];if(!u.cell)return null;const d=u.cell;d.setColSpan(c),d.setRowSpan(a);const f=new Set([d.getKey()]);for(let h=r;h<=i;h++)for(let g=s;g<=o;g++){const p=t[h][g];if(!p.cell)continue;const m=p.cell,b=m.getKey();f.has(b)||(f.add(b),fx(m)||d.append(...m.getChildren()),m.remove())}return d.getChildrenSize()===0&&d.append(J()),d}function fx(n){if(n.getChildrenSize()!==1)return!1;const e=n.getFirstChildOrThrow();return!(!wr(e)||!e.isEmpty())}function hx(n){const[e,t,r]=gt(n),i=e.__colSpan,s=e.__rowSpan;if(i===1&&s===1)return;const[o,l]=bn(r,e,e),{startColumn:a,startRow:c}=l,u=e.__headerState&Ne.COLUMN,d=Array.from({length:i},(g,p)=>{let m=u;for(let b=0;m!==0&&b<o.length;b++)m&=o[b][p+a].cell.__headerState;return m}),f=e.__headerState&Ne.ROW,h=Array.from({length:s},(g,p)=>{let m=f;for(let b=0;m!==0&&b<o[0].length;b++)m&=o[p+c][b].cell.__headerState;return m});if(i>1){for(let g=1;g<i;g++)e.insertAfter(jt(d[g]|h[0]).append(J()));e.setColSpan(1)}if(s>1){let g;for(let p=1;p<s;p++){const m=c+p,b=o[m];g=(g||t).getNextSibling(),tt(g)||te(125);let _=null;for(let y=0;y<a;y++){const C=b[y],S=C.cell;C.startRow===m&&(_=S),S.__colSpan>1&&(y+=S.__colSpan-1)}if(_===null)for(let y=i-1;y>=0;y--)gu(g,jt(d[y]|h[p]).append(J()));else for(let y=i-1;y>=0;y--)_.insertAfter(jt(d[y]|h[p]).append(J()))}e.setRowSpan(1)}}function bn(n,e,t){const[r,i,s]=sn(n,e,t);return i===null&&te(207),s===null&&te(208),[r,i,s]}function sn(n,e,t){const r=[];let i=null,s=null;function o(a){let c=r[a];return c===void 0&&(r[a]=c=[]),c}const l=n.getChildren();for(let a=0;a<l.length;a++){const c=l[a];tt(c)||te(209);const u=o(a);for(let d=c.getFirstChild(),f=0;d!=null;d=d.getNextSibling()){for(me(d)||te(147);u[f]!==void 0;)f++;const h={cell:d,startColumn:f,startRow:a},{__rowSpan:g,__colSpan:p}=d;for(let m=0;m<g&&!(a+m>=l.length);m++){const b=o(a+m);for(let _=0;_<p;_++)b[f+_]=h}e!==null&&i===null&&e.is(d)&&(i=h),t!==null&&s===null&&t.is(d)&&(s=h)}}return[r,i,s]}function gt(n){let e;if(n instanceof kr)e=n;else if("__type"in n){const i=le(n,me);me(i)||te(148),e=i}else{const i=le(n.getNode(),me);me(i)||te(148),e=i}const t=e.getParent();tt(t)||te(149);const r=t.getParent();return Ht(r)||te(210),[e,t,r]}function Fp(n,e,t){let r,i=Math.min(e.startColumn,t.startColumn),s=Math.min(e.startRow,t.startRow),o=Math.max(e.startColumn+e.cell.__colSpan-1,t.startColumn+t.cell.__colSpan-1),l=Math.max(e.startRow+e.cell.__rowSpan-1,t.startRow+t.cell.__rowSpan-1);do{r=!1;for(let a=0;a<n.length;a++)for(let c=0;c<n[0].length;c++){const u=n[a][c];if(!u)continue;const d=u.startColumn+u.cell.__colSpan-1,f=u.startRow+u.cell.__rowSpan-1,h=u.startColumn<=o&&d>=i,g=u.startRow<=l&&f>=s;if(h&&g){const p=Math.min(i,u.startColumn),m=Math.max(o,d),b=Math.min(s,u.startRow),_=Math.max(l,f);p===i&&m===o&&b===s&&_===l||(i=p,o=m,s=b,l=_,r=!0)}}}while(r);return{maxColumn:o,maxRow:l,minColumn:i,minRow:s}}function _f(n){const[e,,t]=gt(n),r=t.getChildren(),i=r.length,s=r[0].getChildren().length,o=new Array(i);for(let l=0;l<i;l++)o[l]=new Array(s);for(let l=0;l<i;l++){const a=r[l].getChildren();let c=0;for(let u=0;u<a.length;u++){for(;o[l][c];)c++;const d=a[u],f=d.__rowSpan||1,h=d.__colSpan||1;for(let g=0;g<f;g++)for(let p=0;p<h;p++)o[l+g][c+p]=d;if(e===d)return{colSpan:h,columnIndex:c,rowIndex:l,rowSpan:f};c+=h}}return null}function yf(n){const[[e,t,r,i],[s,o,l,a]]=["anchor","focus"].map(c=>{const u=n[c].getNode(),d=le(u,me);me(d)||te(238,c,u.getKey(),u.getType());const f=d.getParent();tt(f)||te(239,c);const h=f.getParent();return Ht(h)||te(240,c),[u,d,f,h]});return i.is(a)||te(241),{anchorCell:t,anchorNode:e,anchorRow:r,anchorTable:i,focusCell:o,focusNode:s,focusRow:l,focusTable:a}}let Rp=class Dp{tableKey;anchor;focus;_cachedNodes;dirty;constructor(e,t,r){this.anchor=t,this.focus=r,t._selection=this,r._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){if(this.tableKey==="root"||this.anchor.key==="root"||this.anchor.type!=="element"||this.focus.key==="root"||this.focus.type!=="element")return!1;const e=Q(this.tableKey),t=Q(this.anchor.key),r=Q(this.focus.key);return e!==null&&t!==null&&r!==null}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return Tr(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,r){this.dirty=this.dirty||e!==this.tableKey||t!==this.anchor.key||r!==this.focus.key,this.tableKey=e,this.anchor.key=t,this.focus.key=r,this._cachedNodes=null}clone(){return new Dp(this.tableKey,Ae(this.anchor.key,this.anchor.offset,this.anchor.type),Ae(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}hasFormat(e){let t=0;this.getNodes().filter(me).forEach(i=>{const s=i.getFirstChild();wr(s)&&(t|=s.getTextFormat())});const r=ze[e];return(t&r)!==0}insertNodes(e){const t=this.focus.getNode();A(t)||te(151),Mn(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const{anchorCell:e,focusCell:t}=yf(this),r=_f(e);r===null&&te(153);const i=_f(t);i===null&&te(155);const s=Math.min(r.columnIndex,i.columnIndex),o=Math.max(r.columnIndex+r.colSpan-1,i.columnIndex+i.colSpan-1),l=Math.min(r.rowIndex,i.rowIndex),a=Math.max(r.rowIndex+r.rowSpan-1,i.rowIndex+i.rowSpan-1);return{fromX:Math.min(s,o),fromY:Math.min(l,a),toX:Math.max(s,o),toY:Math.max(l,a)}}getNodes(){if(!this.isValid())return[];const e=this._cachedNodes;if(e!==null)return e;const{anchorTable:t,anchorCell:r,focusCell:i}=yf(this),s=i.getParents()[1];if(s!==t){if(t.isParentOf(i)){const m=s.getParent();m==null&&te(159),this.set(this.tableKey,i.getKey(),m.getKey())}else{const m=t.getParent();m==null&&te(158),this.set(this.tableKey,m.getKey(),i.getKey())}return this.getNodes()}const[o,l,a]=bn(t,r,i),{minColumn:c,maxColumn:u,minRow:d,maxRow:f}=Fp(o,l,a),h=new Map([[t.getKey(),t]]);let g=null;for(let m=d;m<=f;m++)for(let b=c;b<=u;b++){const{cell:_}=o[m][b],y=_.getParent();tt(y)||te(160),y!==g&&(h.set(y.getKey(),y),g=y),h.has(_.getKey())||mx(_,C=>{h.set(C.getKey(),C)})}const p=Array.from(h.values());return Sr()||(this._cachedNodes=p),p}getTextContent(){const e=this.getNodes().filter(r=>me(r));let t="";for(let r=0;r<e.length;r++){const i=e[r],s=i.__parent,o=(e[r+1]||{}).__parent;t+=i.getTextContent()+(o!==s?`
|
|
14
|
-
`:" ")}return t}};function Tr(n){return n instanceof Rp}function gx(){const n=Ae("root",0,"element"),e=Ae("root",0,"element");return new Rp("root",n,e)}function px(n,e,t){n.getKey(),e.getKey(),t.getKey();const r=M(),i=Tr(r)?r.clone():gx();return i.set(n.getKey(),e.getKey(),t.getKey()),i}function mx(n,e){const t=[[n]];for(let r=t.at(-1);r!==void 0&&t.length>0;r=t.at(-1)){const i=r.pop();i===void 0?t.pop():e(i)!==!1&&A(i)&&t.push(i.getChildren())}}function Ei(n){return ne(n)&&n.nodeName==="TABLE"}function _x(n,e){for(let t=e,r=null;t!==null;t=t.getParent()){if(n.is(t))return r;me(t)&&(r=t)}return null}function rc(n){const e=le(n,Ht);return Ht(e)?e:null}function yx(n,e,t){return _x(n,dt(e,t))}function bf(n,e,t){if(!e.theme.tableAlignment)return;const r=[],i=[];for(const s of["center","right"]){const o=e.theme.tableAlignment[s];o&&(s===t?i:r).push(o)}an(n,...r),_e(n,...i)}const bx=new WeakSet;function xf(n=fi()){return bx.has(n)}class pr extends Se{__rowStriping;__frozenColumnCount;__frozenRowCount;__colWidths;static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){const t=this.getWritable();return t.__colWidths=e,t}static clone(e){return new pr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:xx,priority:1})}}static importJSON(e){return pu().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0,this.__colWidths=void 0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,t,r){return r==="html"}getDOMSlot(e){const t=Ei(e)?e:e.querySelector("table");return Ei(t)||te(229),super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"))}createDOM(e,t){const r=document.createElement("table");this.__style&&(r.style.cssText=this.__style);const i=document.createElement("colgroup");if(r.appendChild(i),Kg(i),_e(r,e.theme.table),this.updateTableElement(null,r,e),xf(t)){const s=document.createElement("div"),o=e.theme.tableScrollableWrapper;return o?_e(s,o):s.style.cssText="overflow-x: auto;",s.appendChild(r),this.updateTableWrapper(null,s,r,e),s}return r}updateTableWrapper(e,t,r,i){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&(function(s,o,l,a){a>0?(_e(s,l.theme.tableFrozenColumn),o.setAttribute("data-lexical-frozen-column","true")):(an(s,l.theme.tableFrozenColumn),o.removeAttribute("data-lexical-frozen-column"))})(t,r,i,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&(function(s,o,l,a){a>0?(_e(s,l.theme.tableFrozenRow),o.setAttribute("data-lexical-frozen-row","true")):(an(s,l.theme.tableFrozenRow),o.removeAttribute("data-lexical-frozen-row"))})(t,r,i,this.__frozenRowCount)}updateTableElement(e,t,r){this.__style!==(e?e.__style:"")&&(t.style.cssText=this.__style),this.__rowStriping!==(!!e&&e.__rowStriping)&&(function(i,s,o){o?(_e(i,s.theme.tableRowStriping),i.setAttribute("data-lexical-row-striping","true")):(an(i,s.theme.tableRowStriping),i.removeAttribute("data-lexical-row-striping"))})(t,r,this.__rowStriping),(function(i,s,o,l){const a=i.querySelector("colgroup");if(!a)return;const c=[];for(let u=0;u<o;u++){const d=document.createElement("col"),f=l&&l[u];f&&(d.style.width=`${f}px`),c.push(d)}a.replaceChildren(...c)})(t,0,this.getColumnCount(),this.getColWidths()),bf(t,r,this.getFormatType())}updateDOM(e,t,r){const i=this.getDOMSlot(t).element;return t===i===xf()||(ne(s=t)&&s.nodeName==="DIV"&&this.updateTableWrapper(e,t,i,r),this.updateTableElement(e,i,r),!1);var s}exportDOM(e){const t=super.exportDOM(e),{element:r}=t;return{after:i=>{if(t.after&&(i=t.after(i)),!Ei(i)&&ne(i)&&(i=i.querySelector("table")),!Ei(i))return null;bf(i,e._config,this.getFormatType());const[s]=sn(this,null,null),o=new Map;for(const u of s)for(const d of u){const f=d.cell.getKey();o.has(f)||o.set(f,{colSpan:d.cell.getColSpan(),startColumn:d.startColumn})}const l=new Set;for(const u of i.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){const d=u.getAttribute("data-temporary-table-cell-lexical-key");if(d){const f=o.get(d);if(u.removeAttribute("data-temporary-table-cell-lexical-key"),f){o.delete(d);for(let h=0;h<f.colSpan;h++)l.add(h+f.startColumn)}}}const a=i.querySelector(":scope > colgroup");if(a){const u=Array.from(i.querySelectorAll(":scope > colgroup > col")).filter((d,f)=>l.has(f));a.replaceChildren(...u)}const c=i.querySelectorAll(":scope > tr");if(c.length>0){const u=document.createElement("tbody");for(const d of c)u.appendChild(d);i.append(u)}return i},element:!Ei(r)&&ne(r)?r.querySelector("table"):r}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:r,domRows:i}=t;for(let s=0;s<r;s++){const o=i[s];if(o!=null)for(let l=0;l<o.length;l++){const a=o[l];if(a==null)continue;const{elem:c}=a,u=yx(this,c);if(u!==null&&e.is(u))return{x:l,y:s}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,r){const{domRows:i}=r,s=i[t];if(s==null)return null;const o=s[e<s.length?e:s.length-1];return o??null}getDOMCellFromCordsOrThrow(e,t,r){const i=this.getDOMCellFromCords(e,t,r);if(!i)throw new Error("Cell not found at cords.");return i}getCellNodeFromCords(e,t,r){const i=this.getDOMCellFromCords(e,t,r);if(i==null)return null;const s=dt(i.elem);return me(s)?s:null}getCellNodeFromCordsOrThrow(e,t,r){const i=this.getCellNodeFromCords(e,t,r);if(!i)throw new Error("Node at cords not TableCellNode.");return i}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(e){const t=this.getWritable();return t.__rowStriping=e,t}setFrozenColumns(e){const t=this.getWritable();return t.__frozenColumnCount=e,t}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){const t=this.getWritable();return t.__frozenRowCount=e,t}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){const e=this.getFirstChild();if(!e)return 0;let t=0;return e.getChildren().forEach(r=>{me(r)&&(t+=r.getColSpan())}),t}}function xx(n){const e=pu();n.hasAttribute("data-lexical-row-striping")&&e.setRowStriping(!0),n.hasAttribute("data-lexical-frozen-column")&&e.setFrozenColumns(1),n.hasAttribute("data-lexical-frozen-row")&&e.setFrozenRows(1);const t=n.querySelector(":scope > colgroup");if(t){let r=[];for(const i of t.querySelectorAll(":scope > col")){let s=i.style.width||"";if(!hu.test(s)&&(s=i.getAttribute("width")||"",!/^\d+$/.test(s))){r=void 0;break}r.push(parseFloat(s))}r&&e.setColWidths(r)}return{after:r=>ap(r,tt),node:e}}function pu(){return Le(new pr)}function Ht(n){return n instanceof pr}function Sx(n){tt(n.getParent())?n.isEmpty()&&n.append(J()):n.remove()}function Cx(n){Ht(n.getParent())?op(n,me):n.remove()}function wx(n){op(n,tt);const[e]=sn(n,null,null),t=e.reduce((o,l)=>Math.max(o,l.length),0),r=n.getChildren();for(let o=0;o<e.length;++o){const l=r[o];if(!l)continue;tt(l)||te(254,l.constructor.name,l.getType());const a=e[o].reduce((c,u)=>u?1+c:c,0);if(a!==t)for(let c=a;c<t;++c){const u=jt();u.append(J()),l.append(u)}}const i=n.getColWidths(),s=n.getColumnCount();if(i&&i.length!==s){let o;if(s<i.length)o=i.slice(0,s);else if(i.length>0){const l=i[i.length-1];o=[...i,...Array(s-i.length).fill(l)]}n.setColWidths(o)}}function vx(n){if(n.detail<3||!Wn(n.target))return!1;const e=dt(n.target);if(e===null)return!1;const t=le(e,r=>A(r)&&!r.isInline());return t===null?!1:!!me(t.getParent())&&(t.select(0),!0)}function Ex(){const n=M();if(!N(n))return!1;const e=rc(n.anchor.getNode());if(e===null)return!1;const t=de();if(!t.is(e.getParent())||t.getChildrenSize()!==1)return!1;const[r]=sn(e,null,null);if(r.length===0||r[0].length===0)return!1;const i=r[0][0];if(!i||!i.cell)return!1;const s=r[r.length-1],o=s[s.length-1];if(!o||!o.cell)return!1;const l=px(e,i.cell,o.cell);return Re(l),!0}function Sf(n,e){n.hasNodes([pr])||te(255);const{hasNestedTables:t=yp(!1)}=e??{};return ft(n.registerCommand(ws,r=>(function({rows:i,columns:s,includeHeaders:o},l){const a=M()||_n();if(!a||!N(a)||!l&&rc(a.anchor.getNode()))return!1;const c=lx(Number(i),Number(s),o);yb(c);const u=c.getFirstDescendant();return R(u)&&u.select(),!0})(r,t.peek()),B),n.registerCommand(Ec,(r,i)=>{if(n!==i)return!1;if((function(l){const{nodes:a,selection:c}=l,u=c.getStartEndPoints(),d=Tr(c),f=N(c),h=f&&le(c.anchor.getNode(),j=>me(j))!==null&&le(c.focus.getNode(),j=>me(j))!==null||d;if(a.length!==1||!Ht(a[0])||!h||u===null)return!1;const[g,p]=u,[m,b,_]=gt(g),y=le(p.getNode(),j=>me(j));if(!(me(m)&&me(y)&&tt(b)&&Ht(_)))return!1;const C=a[0],[S,w,x]=bn(_,m,y),[T]=sn(C,null,null),v=S.length,O=v>0?S[0].length:0;let I=w.startRow,k=w.startColumn,L=T.length,K=L>0?T[0].length:0;if(d){const j=Fp(S,w,x),Ce=j.maxRow-j.minRow+1,fe=j.maxColumn-j.minColumn+1;I=j.minRow,k=j.minColumn,L=Math.min(L,Ce),K=Math.min(K,fe)}let F=!1;const W=Math.min(v,I+L)-1,V=Math.min(O,k+K)-1,G=new Set;for(let j=I;j<=W;j++)for(let Ce=k;Ce<=V;Ce++){const fe=S[j][Ce];G.has(fe.cell.getKey())||fe.cell.__rowSpan===1&&fe.cell.__colSpan===1||(hx(fe.cell),G.add(fe.cell.getKey()),F=!0)}let[oe]=sn(_.getWritable(),null,null);const We=L-v+I;for(let j=0;j<We;j++)tc(oe[v-1][0].cell);const wt=K-O+k;for(let j=0;j<wt;j++)nc(oe[0][O-1].cell,!0,!1);[oe]=sn(_.getWritable(),null,null);for(let j=I;j<I+L;j++)for(let Ce=k;Ce<k+K;Ce++){const fe=j-I,Ze=Ce-k,H=T[fe][Ze];if(H.startRow!==fe||H.startColumn!==Ze)continue;const $=H.cell;if($.__rowSpan!==1||$.__colSpan!==1){const pe=[],Rt=Math.min(j+$.__rowSpan,I+L)-1,Jn=Math.min(Ce+$.__colSpan,k+K)-1;for(let Sn=j;Sn<=Rt;Sn++)for(let jl=Ce;jl<=Jn;jl++){const N_=oe[Sn][jl];pe.push(N_.cell)}dx(pe),F=!0}const{cell:P}=oe[j][Ce],X=P.getChildren();$.getChildren().forEach(pe=>{R(pe)&&J().append(pe),P.append(pe)}),X.forEach(pe=>pe.remove())}if(d&&F){const[j]=sn(_.getWritable(),null,null);j[w.startRow][w.startColumn].cell.selectEnd()}return!0})(r))return!0;const{selection:s,nodes:o}=r;return t.peek()||n!==i||!N(s)?!1:rc(s.anchor.getNode())!==null&&o.some(Ht)},B),n.registerCommand(Vr,Ex,q),n.registerCommand(mr,vx,B),n.registerNodeTransform(pr,wx),n.registerNodeTransform(_i,Cx),n.registerNodeTransform(kr,Sx))}const kx=new Set(["http:","https:","mailto:","sms:","tel:"]);class Nr extends Se{__url;__target;__rel;__title;static getType(){return"link"}static clone(e){return new Nr(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e="",t={},r){super(r);const{target:i=null,rel:s=null,title:o=null}=t;this.__url=e,this.__target=i,this.__rel=s,this.__title=o}createDOM(e){const t=document.createElement("a");return this.updateLinkDOM(null,t,e),_e(t,e.theme.link),t}updateLinkDOM(e,t,r){if(eu(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(const i of["target","rel","title"]){const s=`__${i}`,o=this[s];e&&e[s]===o||(o?t[i]=o:t.removeAttribute(i))}}}updateDOM(e,t,r){return this.updateLinkDOM(e,t,r),!1}static importDOM(){return{a:e=>({conversion:Tx,priority:1})}}static importJSON(e){return er().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=vf(e);try{const t=new URL(vf(e));if(!kx.has(t.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){const t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){const t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){const t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){const t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){const r=er(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(r,t),r}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,r){if(!N(t))return!1;const i=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(i)&&this.isParentOf(s)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function Tx(n){let e=null;if(eu(n)){const t=n.textContent;(t!==null&&t!==""||n.children.length>0)&&(e=er(n.getAttribute("href")||"",{rel:n.getAttribute("rel"),target:n.getAttribute("target"),title:n.getAttribute("title")}))}return{node:e}}function er(n="",e){return Le(new Nr(n,e))}function Cn(n){return n instanceof Nr}let mu=class Lp extends Nr{__isUnlinked;constructor(e="",t={},r){super(e,t,r),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new Lp(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,r){return super.updateDOM(e,t,r)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return Cf().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){const r=this.getParentOrThrow().insertNewAfter(e,t);if(A(r)){const i=Cf(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return r.append(i),i}return null}};function Cf(n="",e){return Le(new mu(n,e))}function Mi(n){return n instanceof mu}const ic=U("TOGGLE_LINK_COMMAND");function wf(n,e){if(n.type==="element"){const t=n.getNode();return A(t)||(function(r,...i){const s=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",r);for(const l of i)o.append("v",l);throw s.search=o.toString(),Error(`Minified Lexical error #${r}; visit ${s.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(252),t.getChildren()[n.offset+e]||null}return null}function Nx(n,e={}){let t;if(n&&typeof n=="object"){const{url:u,...d}=n;t=u,e={...d,...e}}else t=n;const{target:r,title:i}=e,s=e.rel===void 0?"noreferrer":e.rel,o=M();if(o===null||!N(o)&&!je(o))return;if(je(o)){const u=o.getNodes();return u.length===0?void 0:void u.forEach(d=>{if(t===null){const f=le(d,h=>!Mi(h)&&Cn(h));f&&(f.insertBefore(d),f.getChildren().length===0&&f.remove())}else{const f=le(d,h=>!Mi(h)&&Cn(h));if(f)f.setURL(t),r!==void 0&&f.setTarget(r),s!==void 0&&f.setRel(s);else{const h=er(t,{rel:s,target:r});d.insertBefore(h),h.append(d)}}})}const l=o.extract();if(t===null){const u=new Set;return void l.forEach(d=>{const f=le(d,h=>!Mi(h)&&Cn(h));if(f!==null){const h=f.getKey();if(u.has(h))return;(function(g,p){const m=new Set(p.filter(T=>g.isParentOf(T)).map(T=>T.getKey())),b=g.getChildren(),_=T=>m.has(T.getKey())||A(T)&&p.some(v=>g.isParentOf(v)&&T.isParentOf(v)),y=b.filter(_);if(y.length===b.length)return b.forEach(T=>g.insertBefore(T)),void g.remove();const C=b.findIndex(_),S=b.findLastIndex(_),w=C===0,x=S===b.length-1;if(w)y.forEach(T=>g.insertBefore(T));else if(x)for(let T=y.length-1;T>=0;T--)g.insertAfter(y[T]);else{for(let v=y.length-1;v>=0;v--)g.insertAfter(y[v]);const T=b.slice(S+1);if(T.length>0){const v=er(g.getURL(),{rel:g.getRel(),target:g.getTarget(),title:g.getTitle()});y[y.length-1].insertAfter(v),T.forEach(O=>v.append(O))}}})(f,l),u.add(h)}})}const a=new Set,c=u=>{a.has(u.getKey())||(a.add(u.getKey()),u.setURL(t),r!==void 0&&u.setTarget(r),s!==void 0&&u.setRel(s),i!==void 0&&u.setTitle(i))};if(l.length===1){const u=l[0],d=le(u,Cn);if(d!==null)return c(d)}(function(u){const d=M();if(!N(d))return u();const f=Mn(d),h=f.isBackward(),g=wf(f.anchor,h?-1:0),p=wf(f.focus,h?0:-1);if(u(),g||p){const m=M();if(N(m)){const b=m.clone();if(g){const _=g.getParent();_&&b.anchor.set(_.getKey(),g.getIndexWithinParent()+(h?1:0),"element")}if(p){const _=p.getParent();_&&b.focus.set(_.getKey(),p.getIndexWithinParent()+(h?0:1),"element")}Re(Mn(b))}}})(()=>{let u=null;for(const d of l){if(!d.isAttached())continue;const f=le(d,Cn);if(f){c(f);continue}if(A(d)){if(!d.isInline())continue;if(Cn(d)){if(!(Mi(d)||u!==null&&u.getParentOrThrow().isParentOf(d))){c(d),u=d;continue}for(const g of d.getChildren())d.insertBefore(g);d.remove();continue}}const h=d.getPreviousSibling();Cn(h)&&h.is(u)?h.append(d):(u=er(t,{rel:s,target:r,title:i}),d.insertAfter(u),u.append(d))}})}const Ax=/^\+?[0-9\s()-]{5,}$/;function vf(n){return n.match(/^[a-z][a-z0-9+.-]*:/i)||n.match(/^[/#.]/)?n:n.includes("@")?`mailto:${n}`:Ax.test(n)?`tel:${n}`:`https://${n}`}const ca=Nx;var ua={exports:{}},Ef;function Ox(){return Ef||(Ef=1,(function(n){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var t=(function(r){var i=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,s=0,o={},l={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function _(y){return y instanceof a?new a(y.type,_(y.content),y.alias):Array.isArray(y)?y.map(_):y.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(_){return Object.prototype.toString.call(_).slice(8,-1)},objId:function(_){return _.__id||Object.defineProperty(_,"__id",{value:++s}),_.__id},clone:function _(y,C){C=C||{};var S,w;switch(l.util.type(y)){case"Object":if(w=l.util.objId(y),C[w])return C[w];S={},C[w]=S;for(var x in y)y.hasOwnProperty(x)&&(S[x]=_(y[x],C));return S;case"Array":return w=l.util.objId(y),C[w]?C[w]:(S=[],C[w]=S,y.forEach(function(T,v){S[v]=_(T,C)}),S);default:return y}},getLanguage:function(_){for(;_;){var y=i.exec(_.className);if(y)return y[1].toLowerCase();_=_.parentElement}return"none"},setLanguage:function(_,y){_.className=_.className.replace(RegExp(i,"gi"),""),_.classList.add("language-"+y)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(S){var _=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(S.stack)||[])[1];if(_){var y=document.getElementsByTagName("script");for(var C in y)if(y[C].src==_)return y[C]}return null}},isActive:function(_,y,C){for(var S="no-"+y;_;){var w=_.classList;if(w.contains(y))return!0;if(w.contains(S))return!1;_=_.parentElement}return!!C}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(_,y){var C=l.util.clone(l.languages[_]);for(var S in y)C[S]=y[S];return C},insertBefore:function(_,y,C,S){S=S||l.languages;var w=S[_],x={};for(var T in w)if(w.hasOwnProperty(T)){if(T==y)for(var v in C)C.hasOwnProperty(v)&&(x[v]=C[v]);C.hasOwnProperty(T)||(x[T]=w[T])}var O=S[_];return S[_]=x,l.languages.DFS(l.languages,function(I,k){k===O&&I!=_&&(this[I]=x)}),x},DFS:function _(y,C,S,w){w=w||{};var x=l.util.objId;for(var T in y)if(y.hasOwnProperty(T)){C.call(y,T,y[T],S||T);var v=y[T],O=l.util.type(v);O==="Object"&&!w[x(v)]?(w[x(v)]=!0,_(v,C,null,w)):O==="Array"&&!w[x(v)]&&(w[x(v)]=!0,_(v,C,T,w))}}},plugins:{},highlightAll:function(_,y){l.highlightAllUnder(document,_,y)},highlightAllUnder:function(_,y,C){var S={callback:C,container:_,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",S),S.elements=Array.prototype.slice.apply(S.container.querySelectorAll(S.selector)),l.hooks.run("before-all-elements-highlight",S);for(var w=0,x;x=S.elements[w++];)l.highlightElement(x,y===!0,S.callback)},highlightElement:function(_,y,C){var S=l.util.getLanguage(_),w=l.languages[S];l.util.setLanguage(_,S);var x=_.parentElement;x&&x.nodeName.toLowerCase()==="pre"&&l.util.setLanguage(x,S);var T=_.textContent,v={element:_,language:S,grammar:w,code:T};function O(k){v.highlightedCode=k,l.hooks.run("before-insert",v),v.element.innerHTML=v.highlightedCode,l.hooks.run("after-highlight",v),l.hooks.run("complete",v),C&&C.call(v.element)}if(l.hooks.run("before-sanity-check",v),x=v.element.parentElement,x&&x.nodeName.toLowerCase()==="pre"&&!x.hasAttribute("tabindex")&&x.setAttribute("tabindex","0"),!v.code){l.hooks.run("complete",v),C&&C.call(v.element);return}if(l.hooks.run("before-highlight",v),!v.grammar){O(l.util.encode(v.code));return}if(y&&r.Worker){var I=new Worker(l.filename);I.onmessage=function(k){O(k.data)},I.postMessage(JSON.stringify({language:v.language,code:v.code,immediateClose:!0}))}else O(l.highlight(v.code,v.grammar,v.language))},highlight:function(_,y,C){var S={code:_,grammar:y,language:C};if(l.hooks.run("before-tokenize",S),!S.grammar)throw new Error('The language "'+S.language+'" has no grammar.');return S.tokens=l.tokenize(S.code,S.grammar),l.hooks.run("after-tokenize",S),a.stringify(l.util.encode(S.tokens),S.language)},tokenize:function(_,y){var C=y.rest;if(C){for(var S in C)y[S]=C[S];delete y.rest}var w=new d;return f(w,w.head,_),u(_,w,y,w.head,0),g(w)},hooks:{all:{},add:function(_,y){var C=l.hooks.all;C[_]=C[_]||[],C[_].push(y)},run:function(_,y){var C=l.hooks.all[_];if(!(!C||!C.length))for(var S=0,w;w=C[S++];)w(y)}},Token:a};r.Prism=l;function a(_,y,C,S){this.type=_,this.content=y,this.alias=C,this.length=(S||"").length|0}a.stringify=function _(y,C){if(typeof y=="string")return y;if(Array.isArray(y)){var S="";return y.forEach(function(O){S+=_(O,C)}),S}var w={type:y.type,content:_(y.content,C),tag:"span",classes:["token",y.type],attributes:{},language:C},x=y.alias;x&&(Array.isArray(x)?Array.prototype.push.apply(w.classes,x):w.classes.push(x)),l.hooks.run("wrap",w);var T="";for(var v in w.attributes)T+=" "+v+'="'+(w.attributes[v]||"").replace(/"/g,""")+'"';return"<"+w.tag+' class="'+w.classes.join(" ")+'"'+T+">"+w.content+"</"+w.tag+">"};function c(_,y,C,S){_.lastIndex=y;var w=_.exec(C);if(w&&S&&w[1]){var x=w[1].length;w.index+=x,w[0]=w[0].slice(x)}return w}function u(_,y,C,S,w,x){for(var T in C)if(!(!C.hasOwnProperty(T)||!C[T])){var v=C[T];v=Array.isArray(v)?v:[v];for(var O=0;O<v.length;++O){if(x&&x.cause==T+","+O)return;var I=v[O],k=I.inside,L=!!I.lookbehind,K=!!I.greedy,F=I.alias;if(K&&!I.pattern.global){var W=I.pattern.toString().match(/[imsuy]*$/)[0];I.pattern=RegExp(I.pattern.source,W+"g")}for(var V=I.pattern||I,G=S.next,oe=w;G!==y.tail&&!(x&&oe>=x.reach);oe+=G.value.length,G=G.next){var We=G.value;if(y.length>_.length)return;if(!(We instanceof a)){var wt=1,j;if(K){if(j=c(V,oe,_,L),!j||j.index>=_.length)break;var H=j.index,Ce=j.index+j[0].length,fe=oe;for(fe+=G.value.length;H>=fe;)G=G.next,fe+=G.value.length;if(fe-=G.value.length,oe=fe,G.value instanceof a)continue;for(var Ze=G;Ze!==y.tail&&(fe<Ce||typeof Ze.value=="string");Ze=Ze.next)wt++,fe+=Ze.value.length;wt--,We=_.slice(oe,fe),j.index-=oe}else if(j=c(V,0,We,L),!j)continue;var H=j.index,$=j[0],P=We.slice(0,H),X=We.slice(H+$.length),pe=oe+We.length;x&&pe>x.reach&&(x.reach=pe);var Rt=G.prev;P&&(Rt=f(y,Rt,P),oe+=P.length),h(y,Rt,wt);var Jn=new a(T,k?l.tokenize($,k):$,F,$);if(G=f(y,Rt,Jn),X&&f(y,G,X),wt>1){var Sn={cause:T+","+O,reach:pe};u(_,y,C,G.prev,oe,Sn),x&&Sn.reach>x.reach&&(x.reach=Sn.reach)}}}}}}function d(){var _={value:null,prev:null,next:null},y={value:null,prev:_,next:null};_.next=y,this.head=_,this.tail=y,this.length=0}function f(_,y,C){var S=y.next,w={value:C,prev:y,next:S};return y.next=w,S.prev=w,_.length++,w}function h(_,y,C){for(var S=y.next,w=0;w<C&&S!==_.tail;w++)S=S.next;y.next=S,S.prev=y,_.length-=w}function g(_){for(var y=[],C=_.head.next;C!==_.tail;)y.push(C.value),C=C.next;return y}if(!r.document)return r.addEventListener&&(l.disableWorkerMessageHandler||r.addEventListener("message",function(_){var y=JSON.parse(_.data),C=y.language,S=y.code,w=y.immediateClose;r.postMessage(l.highlight(S,l.languages[C],C)),w&&r.close()},!1)),l;var p=l.util.currentScript();p&&(l.filename=p.src,p.hasAttribute("data-manual")&&(l.manual=!0));function m(){l.manual||l.highlightAll()}if(!l.manual){var b=document.readyState;b==="loading"||b==="interactive"&&p&&p.defer?document.addEventListener("DOMContentLoaded",m):window.requestAnimationFrame?window.requestAnimationFrame(m):window.setTimeout(m,16)}return l})(e);n.exports&&(n.exports=t),typeof Gu.commonjsGlobal<"u"&&(Gu.commonjsGlobal.Prism=t),t.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},t.languages.markup.tag.inside["attr-value"].inside.entity=t.languages.markup.entity,t.languages.markup.doctype.inside["internal-subset"].inside=t.languages.markup,t.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.replace(/&/,"&"))}),Object.defineProperty(t.languages.markup.tag,"addInlined",{value:function(i,s){var o={};o["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:t.languages[s]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var l={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};l["language-"+s]={pattern:/[\s\S]+/,inside:t.languages[s]};var a={};a[i]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:l},t.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(t.languages.markup.tag,"addAttribute",{value:function(r,i){t.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[i,"language-"+i],inside:t.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),t.languages.html=t.languages.markup,t.languages.mathml=t.languages.markup,t.languages.svg=t.languages.markup,t.languages.xml=t.languages.extend("markup",{}),t.languages.ssml=t.languages.xml,t.languages.atom=t.languages.xml,t.languages.rss=t.languages.xml,(function(r){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var s=r.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(t),t.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},t.languages.javascript=t.languages.extend("clike",{"class-name":[t.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),t.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,t.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:t.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:t.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:t.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:t.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:t.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),t.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:t.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),t.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),t.languages.markup&&(t.languages.markup.tag.addInlined("script","javascript"),t.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),t.languages.js=t.languages.javascript,(function(){if(typeof t>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var r="Loading…",i=function(p,m){return"✖ Error "+p+" while fetching file: "+m},s="✖ Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",a="loading",c="loaded",u="failed",d="pre[data-src]:not(["+l+'="'+c+'"]):not(['+l+'="'+a+'"])';function f(p,m,b){var _=new XMLHttpRequest;_.open("GET",p,!0),_.onreadystatechange=function(){_.readyState==4&&(_.status<400&&_.responseText?m(_.responseText):_.status>=400?b(i(_.status,_.statusText)):b(s))},_.send(null)}function h(p){var m=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(p||"");if(m){var b=Number(m[1]),_=m[2],y=m[3];return _?y?[b,Number(y)]:[b,void 0]:[b,b]}}t.hooks.add("before-highlightall",function(p){p.selector+=", "+d}),t.hooks.add("before-sanity-check",function(p){var m=p.element;if(m.matches(d)){p.code="",m.setAttribute(l,a);var b=m.appendChild(document.createElement("CODE"));b.textContent=r;var _=m.getAttribute("data-src"),y=p.language;if(y==="none"){var C=(/\.(\w+)$/.exec(_)||[,"none"])[1];y=o[C]||C}t.util.setLanguage(b,y),t.util.setLanguage(m,y);var S=t.plugins.autoloader;S&&S.loadLanguages(y),f(_,function(w){m.setAttribute(l,c);var x=h(m.getAttribute("data-range"));if(x){var T=w.split(/\r\n?|\n/g),v=x[0],O=x[1]==null?T.length:x[1];v<0&&(v+=T.length),v=Math.max(0,Math.min(v-1,T.length)),O<0&&(O+=T.length),O=Math.max(0,Math.min(O,T.length)),w=T.slice(v,O).join(`
|
|
15
|
-
`),m.hasAttribute("data-start")||m.setAttribute("data-start",String(v+1))}b.textContent=w,t.highlightElement(b)},function(w){m.setAttribute(l,u),b.textContent=w})}}),t.plugins.fileHighlight={highlight:function(m){for(var b=(m||document).querySelectorAll(d),_=0,y;y=b[_++];)t.highlightElement(y)}};var g=!1;t.fileHighlight=function(){g||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),g=!0),t.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(ua)),ua.exports}Ox();Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity;Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup;Prism.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.replace(/&/,"&"))});Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var r={};r["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[t]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};i["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var s={};s[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:i},Prism.languages.insertBefore("markup","cdata",s)}});Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(n,e){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:Prism.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});Prism.languages.html=Prism.languages.markup;Prism.languages.mathml=Prism.languages.markup;Prism.languages.svg=Prism.languages.markup;Prism.languages.xml=Prism.languages.extend("markup",{});Prism.languages.ssml=Prism.languages.xml;Prism.languages.atom=Prism.languages.xml;Prism.languages.rss=Prism.languages.xml;(function(n){var e=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function t(u){return u=u.replace(/<inner>/g,function(){return e}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+u+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return r}),s=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;n.languages.markdown=n.languages.extend("markup",{}),n.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:n.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+s+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+s+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:n.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+s+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:n.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:t(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:t(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:t(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:t(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(u){["url","bold","italic","strike","code-snippet"].forEach(function(d){u!==d&&(n.languages.markdown[u].inside.content.inside[d]=n.languages.markdown[d])})}),n.hooks.add("after-tokenize",function(u){if(u.language!=="markdown"&&u.language!=="md")return;function d(f){if(!(!f||typeof f=="string"))for(var h=0,g=f.length;h<g;h++){var p=f[h];if(p.type!=="code"){d(p.content);continue}var m=p.content[1],b=p.content[3];if(m&&b&&m.type==="code-language"&&b.type==="code-block"&&typeof m.content=="string"){var _=m.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");_=(/[a-z][\w-]*/i.exec(_)||[""])[0].toLowerCase();var y="language-"+_;b.alias?typeof b.alias=="string"?b.alias=[b.alias,y]:b.alias.push(y):b.alias=[y]}}}d(u.tokens)}),n.hooks.add("wrap",function(u){if(u.type==="code-block"){for(var d="",f=0,h=u.classes.length;f<h;f++){var g=u.classes[f],p=/language-(.+)/.exec(g);if(p){d=p[1];break}}var m=n.languages[d];if(m)u.content=n.highlight(c(u.content),m,d);else if(d&&d!=="none"&&n.plugins.autoloader){var b="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);u.attributes.id=b,n.plugins.autoloader.loadLanguages(d,function(){var _=document.getElementById(b);_&&(_.innerHTML=n.highlight(_.textContent,n.languages[d],d))})}}});var o=RegExp(n.languages.markup.tag.pattern.source,"gi"),l={amp:"&",lt:"<",gt:">",quot:'"'},a=String.fromCodePoint||String.fromCharCode;function c(u){var d=u.replace(o,"");return d=d.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(f,h){if(h=h.toLowerCase(),h[0]==="#"){var g;return h[1]==="x"?g=parseInt(h.slice(2),16):g=Number(h.slice(1)),a(g)}else{var p=l[h];return p||f}}),d}n.languages.md=n.languages.markdown})(Prism);Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/});Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}});Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}});Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/});delete Prism.languages.c.boolean;(function(n){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var t=n.languages.markup;t&&(t.tag.addInlined("style","css"),t.tag.addAttribute("style","css"))})(Prism);Prism.languages.objectivec=Prism.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/});delete Prism.languages.objectivec["class-name"];Prism.languages.objc=Prism.languages.objectivec;Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};(function(n){var e=n.languages.powershell={comment:[{pattern:/(^|[^`])<#[\s\S]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(?:`[\s\S]|[^`"])*"/,greedy:!0,inside:null},{pattern:/'(?:[^']|'')*'/,greedy:!0}],namespace:/\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,boolean:/\$(?:false|true)\b/i,variable:/\$\w+\b/,function:[/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/};e.string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:e},boolean:e.boolean,variable:e.variable}})(Prism);var kf={},Tf;function Mx(){return Tf||(Tf=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),kf}Mx();var Nf={},Af;function Ix(){return Af||(Af=1,(function(n){for(var e=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,t=0;t<2;t++)e=e.replace(/<self>/g,function(){return e});e=e.replace(/<self>/g,function(){return/[^\s\S]/.source}),n.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+e),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},n.languages.rust["closure-params"].inside.rest=n.languages.rust,n.languages.rust.attribute.inside.string=n.languages.rust.string})(Prism)),Nf}Ix();Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/};Prism.languages.swift["string-literal"].forEach(function(n){n.inside.interpolation.inside=Prism.languages.swift});var Of={},Mf;function $x(){return Mf||(Mf=1,(function(n){n.languages.typescript=n.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),n.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete n.languages.typescript.parameter,delete n.languages.typescript["literal-property"];var e=n.languages.extend("typescript",{});delete e["class-name"],n.languages.typescript["class-name"].inside=e,n.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e}}}}),n.languages.ts=n.languages.typescript})(Prism)),Of}$x();var If={},$f;function Fx(){return $f||($f=1,(function(n){var e=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,t=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+t+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};n.languages.java=n.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+t+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+t+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:e,function:[n.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),n.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),n.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+t+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+t+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism)),If}Fx();var Ff={},Rf;function Rx(){return Rf||(Rf=1,(function(n){var e=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,t=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return e.source});n.languages.cpp=n.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:e,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),n.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return t})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),n.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n.languages.cpp}}}}),n.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),n.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:n.languages.extend("cpp",{})}}),n.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},n.languages.cpp["base-clause"])})(Prism)),Ff}Rx();function pl(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 Dx="javascript";function Pp(n,e){for(const t of n.childNodes){if(ne(t)&&t.tagName===e)return!0;Pp(t,e)}return!1}const Ii="data-language",ki="data-highlight-language",Bs="data-theme";let tr=class zp extends Se{__language;__theme;__isSyntaxHighlightSupported;static getType(){return"code"}static clone(e){return new zp(e.__language,e.__key)}constructor(e,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){const t=document.createElement("code");_e(t,e.theme.code),t.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(t.setAttribute(Ii,r),this.getIsSyntaxHighlightSupported()&&t.setAttribute(ki,r));const i=this.getTheme();i&&t.setAttribute(Bs,i);const s=this.getStyle();return s&&t.setAttribute("style",s),t}updateDOM(e,t,r){const i=this.__language,s=e.__language;i?i!==s&&t.setAttribute(Ii,i):s&&t.removeAttribute(Ii);const o=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&s?o&&i?i!==s&&t.setAttribute(ki,i):t.removeAttribute(ki):o&&i&&t.setAttribute(ki,i);const l=this.__theme,a=e.__theme;l?l!==a&&t.setAttribute(Bs,l):a&&t.removeAttribute(Bs);const c=this.__style,u=e.__style;return c?c!==u&&t.setAttribute("style",c):u&&t.removeAttribute("style"),!1}exportDOM(e){const t=document.createElement("pre");_e(t,e._config.theme.code),t.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(t.setAttribute(Ii,r),this.getIsSyntaxHighlightSupported()&&t.setAttribute(ki,r));const i=this.getTheme();i&&t.setAttribute(Bs,i);const s=this.getStyle();return s&&t.setAttribute("style",s),{element:t}}static importDOM(){return{code:e=>e.textContent!=null&&(/\r?\n/.test(e.textContent)||Pp(e,"BR"))?{conversion:Df,priority:1}:null,div:()=>({conversion:Lx,priority:1}),pre:()=>({conversion:Df,priority:0}),table:e=>da(e)?{conversion:Px,priority:3}:null,td:e=>{const t=e,r=t.closest("table");return t.classList.contains("js-file-line")||r&&da(r)?{conversion:Lf,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&da(t)?{conversion:Lf,priority:3}:null}}}static importJSON(e){return _t().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,t=!0){const r=this.getChildren(),i=r.length;if(i>=2&&r[i-1].getTextContent()===`
|
|
13
|
+
`?c.insertParagraph():u===" "?c.insertNodes([Ct()]):c.insertText(u)}}}else e.insertRawText(o)}function Jd(n,e,t){n.dispatchCommand(Oc,{nodes:e,selection:t})||(t.insertNodes(e),(function(r){if(N(r)&&r.isCollapsed()){const i=r.anchor;let s=null;const o=Dt(i,"previous");if(o)if($t(o))s=o.origin;else{const l=qt(o,dt(de(),"next").getFlipped());for(const a of l){if(L(a.origin)){s=a.origin;break}if(O(a.origin)&&!a.origin.isInline())break}}if(s&&L(s)){const l=s.getFormat(),a=s.getStyle();r.format===l&&r.style===a||(r.format=l,r.style=a,r.dirty=!0)}}})(t))}function bp(n,e,t,r=[]){let i=e===null||t.isSelected(e);const s=O(t)&&t.excludeFromCopy("html");let o=t;e!==null&&L(o)&&(o=ip(e,o,"clone"));const l=O(o)?o.getChildren():[],a=(function(c){const u=c.exportJSON(),d=c.constructor;if(u.type!==d.getType()&&Fo(58,d.name),O(c)){const f=u.children;Array.isArray(f)||Fo(59,d.name)}return u})(o);L(o)&&o.getTextContentSize()===0&&(i=!1);for(let c=0;c<l.length;c++){const u=l[c],d=bp(n,e,u,a.children);!i&&O(t)&&d&&t.extractWithChild(u,e,"clone")&&(i=!0)}if(i&&!s)r.push(a);else if(Array.isArray(a.children))for(let c=0;c<a.children.length;c++){const u=a.children[c];r.push(u)}return i}function kb(n,e){const t=[],r=de().getChildren();for(let i=0;i<r.length;i++)bp(n,e,r[i],t);return{namespace:n._config.namespace,nodes:t}}function Tb(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t],i=xg(r);L(i)&&lb(i),e.push(i)}return e}let Rr=null;async function Gd(n,e,t){if(Rr!==null)return!1;if(e!==null)return new Promise((c,u)=>{n.update(()=>{c(Vd(n,e,t))})});const r=n.getRootElement(),i=n._window||window,s=i.document,o=kt(i);if(r===null||o===null)return!1;const l=s.createElement("span");l.style.cssText="position: fixed; top: -1000px;",l.append(s.createTextNode("#")),r.append(l);const a=new Range;return a.setStart(l,0),a.setEnd(l,1),o.removeAllRanges(),o.addRange(a),new Promise((c,u)=>{const d=n.registerCommand(Cr,f=>(an(f,ClipboardEvent)&&(d(),Rr!==null&&(i.clearTimeout(Rr),Rr=null),c(Vd(n,f,t))),!0),Hc);Rr=i.setTimeout(()=>{d(),Rr=null,c(!1)},50),s.execCommand("copy"),l.remove()})}function Vd(n,e,t){if(t===void 0){const i=kt(n._window),s=M();if(!s||s.isCollapsed()||!i)return!1;const o=i.anchorNode,l=i.focusNode;if(o!==null&&l!==null&&!mi(n,o,l))return!1;t=Nb(s)}e.preventDefault();const r=e.clipboardData;return r!==null&&(Ab(r,t),!0)}const xp=[["text/html",yp],["application/x-lexical-editor",Eb]];function Nb(n=M()){const e={"text/plain":n?n.getTextContent():""};if(n){const t=_i();for(const[r,i]of xp){const s=i(t,n);s!==null&&(e[r]=s)}}return e}function Ab(n,e){for(const[t]of xp)e[t]===void 0&&n.setData(t,"");for(const t in e){const r=e[t];r!==void 0&&n.setData(t,r)}}const Ob=Symbol.for("preact-signals");function bl(){if(Fn>1)return void Fn--;let n,e=!1;for(;Ji!==void 0;){let t=Ji;for(Ji=void 0,Qa++;t!==void 0;){const r=t.o;if(t.o=void 0,t.f&=-3,!(8&t.f)&&Cp(t))try{t.c()}catch(i){e||(n=i,e=!0)}t=r}}if(Qa=0,Fn--,e)throw n}function Mb(n){if(Fn>0)return n();Fn++;try{return n()}finally{bl()}}let ie,Ji;function Yd(n){const e=ie;ie=void 0;try{return n()}finally{ie=e}}let Fn=0,Qa=0,to=0;function qd(n){if(ie===void 0)return;let e=n.n;return e===void 0||e.t!==ie?(e={i:0,S:n,p:ie.s,n:void 0,t:ie,e:void 0,x:void 0,r:e},ie.s!==void 0&&(ie.s.n=e),ie.s=e,n.n=e,32&ie.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=ie.s,e.n=void 0,ie.s.n=e,ie.s=e),e):void 0}function nt(n,e){this.v=n,this.i=0,this.n=void 0,this.t=void 0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}function Sp(n,e){return new nt(n,e)}function Cp(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 Zd(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 wp(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 Dr(n,e){nt.call(this,void 0),this.x=n,this.s=void 0,this.g=to-1,this.f=4,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}function vp(n){const e=n.u;if(n.u=void 0,typeof e=="function"){Fn++;const t=ie;ie=void 0;try{e()}catch(r){throw n.f&=-2,n.f|=8,hu(n),r}finally{ie=t,bl()}}}function hu(n){for(let e=n.s;e!==void 0;e=e.n)e.S.U(e);n.x=void 0,n.s=void 0,vp(n)}function Ib(n){if(ie!==this)throw new Error("Out-of-order effect");wp(this),ie=n,this.f&=-2,8&this.f&&hu(this),bl()}function jr(n,e){this.x=n,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=e?.name}function gu(n,e){const t=new jr(n,e);try{t.c()}catch(i){throw t.d(),i}const r=t.d.bind(t);return r[Symbol.dispose]=r,r}function $b(n,e={}){const t={};for(const r in n){const i=e[r],s=Sp(i===void 0?n[r]:i);t[r]=s}return t}nt.prototype.brand=Ob,nt.prototype.h=function(){return!0},nt.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:Yd(()=>{var t;(t=this.W)==null||t.call(this)}))},nt.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&&Yd(()=>{var r;(r=this.Z)==null||r.call(this)}))}},nt.prototype.subscribe=function(n){return gu(()=>{const e=this.value,t=ie;ie=void 0;try{n(e)}finally{ie=t}},{name:"sub"})},nt.prototype.valueOf=function(){return this.value},nt.prototype.toString=function(){return this.value+""},nt.prototype.toJSON=function(){return this.value},nt.prototype.peek=function(){const n=ie;ie=void 0;try{return this.value}finally{ie=n}},Object.defineProperty(nt.prototype,"value",{get(){const n=qd(this);return n!==void 0&&(n.i=this.i),this.v},set(n){if(n!==this.v){if(Qa>100)throw new Error("Cycle detected");this.v=n,this.i++,to++,Fn++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{bl()}}}}),Dr.prototype=new nt,Dr.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===to))return!0;if(this.g=to,this.f|=1,this.i>0&&!Cp(this))return this.f&=-2,!0;const n=ie;try{Zd(this),ie=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 ie=n,wp(this),this.f&=-2,!0},Dr.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)}nt.prototype.S.call(this,n)},Dr.prototype.U=function(n){if(this.t!==void 0&&(nt.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)}},Dr.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(Dr.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const n=qd(this);if(this.h(),n!==void 0&&(n.i=this.i),16&this.f)throw this.v;return this.v}}),jr.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.u=e)}finally{n()}},jr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,vp(this),Zd(this),Fn++;const n=ie;return ie=this,Ib.bind(this,n)},jr.prototype.N=function(){2&this.f||(this.f|=2,this.o=Ji,Ji=this)},jr.prototype.d=function(){this.f|=8,1&this.f||hu(this)},jr.prototype.dispose=function(){this.d()};function Fb(n){return(typeof n.nodes=="function"?n.nodes():n.nodes)||[]}function ae(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 Ep(n,e){if(n&&e&&!Array.isArray(e)&&typeof n=="object"&&typeof e=="object"){const t=n,r=e;for(const i in r)t[i]=Ep(t[i],r[i]);return n}return e}const pu=0,ec=1,kp=2,oa=3,Ws=4,Pr=5,la=6,Ai=7;function aa(n){return n.id===pu}function Tp(n){return n.id===kp}function Lb(n){return(function(e){return e.id===ec})(n)||ae(305,String(n.id),String(ec)),Object.assign(n,{id:kp})}const Rb=new Set;let Db=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:pu}}mergeConfigs(){let e=this.extension.config||{};const t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):ep;for(const r of this.configs)e=t(e,r);return e}init(e){const t=this.state;Tp(t)||ae(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)},i={...r,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},s=(function(l,a,c){return Object.assign(l,{config:a,id:oa,registerState:c})})(t,this.mergeConfigs(),r);let o;this.state=s,this.extension.init&&(o=this.extension.init(e,s.config,r)),this.state=(function(l,a,c){return Object.assign(l,{id:Ws,initResult:a,registerState:c})})(s,o,i)}build(e){const t=this.state;let r;t.id!==Ws&&ae(307,String(t.id),String(Pr)),this.extension.build&&(r=this.extension.build(e,t.config,t.registerState));const i={...t.registerState,getOutput:()=>r,getSignal:this.getSignal.bind(this)};this.state=(function(s,o,l){return Object.assign(s,{id:Pr,output:o,registerState:l})})(t,r,i)}register(e,t){this._signal=t;const r=this.state;r.id!==Pr&&ae(308,String(r.id),String(Pr));const i=this.extension.register&&this.extension.register(e,r.config,r.registerState);return this.state=(function(s){return Object.assign(s,{id:la})})(r),()=>{const s=this.state;s.id!==Ai&&ae(309,String(r.id),String(Ai)),this.state=(function(o){return Object.assign(o,{id:Pr})})(s),i&&i()}}afterRegistration(e){const t=this.state;let r;return t.id!==la&&ae(310,String(t.id),String(la)),this.extension.afterRegistration&&(r=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=(function(i){return Object.assign(i,{id:Ai})})(t),r}getSignal(){return this._signal===void 0&&ae(311),this._signal}getInitResult(){this.extension.init===void 0&&ae(312,this.extension.name);const e=this.state;return(function(t){return t.id>=Ws})(e)||ae(313,String(e.id),String(Ws)),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>=oa})(e)||ae(314,String(e.id),String(oa)),{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&&ae(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return t===void 0&&ae(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return(function(t){return t.id>=Ai})(e)||ae(316,String(e.id),String(Ai)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Rb}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>=Pr})(e)||ae(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};const Xd={tag:Vr};function Pb(){const n=de();n.isEmpty()&&n.append(H())}const zb={config:{setOptions:Xd,updateOptions:Xd},init:({$initialEditorState:n=Pb})=>({$initialEditorState:n,initialized:!1}),afterRegistration(n,{updateOptions:e,setOptions:t},r){const i=r.getInitResult();if(!i.initialized){i.initialized=!0;const{$initialEditorState:s}=i;if(wg(s))n.setEditorState(s,t);else if(typeof s=="function")n.update(()=>{s(n)},e);else if(s&&(typeof s=="string"||typeof s=="object")){const o=n.parseEditorState(s);n.setEditorState(o,t)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[Tr,Qe,wr,vr,Vn]},Qd=Symbol.for("@lexical/extension/LexicalBuilder");function ef(){}function Bb(n){throw n}function js(n){return Array.isArray(n)?n:[n]}const ca="0.40.0+prod.esm";let Ub=class no{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=ca,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(e){const t=[js(zb)];for(const r of e)t.push(js(r));return new no(t)}static maybeFromEditor(e){const t=e[Qd];return t&&(t.PACKAGE_VERSION!==ca&&ae(292,t.PACKAGE_VERSION,ca),t instanceof no||ae(293)),t}static fromEditor(e){const t=no.maybeFromEditor(e);return t===void 0&&ae(294),t}constructEditor(){const{$initialEditorState:e,onError:t,...r}=this.buildCreateEditorArgs(),i=Object.assign(pi({...r,...t?{onError:s=>{t(s,i)}}:{}}),{[Qd]:this});for(const s of this.sortedExtensionReps())s.build(i);return i}buildEditor(){let e=ef;function t(){try{e()}finally{e=ef}}const r=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=mt(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&&ae(295,e.name),t}addEdge(e,t,r){const i=this.outgoingConfigEdges.get(e);i?i.set(t,r):this.outgoingConfigEdges.set(e,new Map([[t,r]]));const s=this.incomingEdges.get(t);s?s.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&ae(296);const t=js(e),[r]=t;typeof r.name!="string"&&ae(297,typeof r.name);let i=this.extensionNameMap.get(r.name);if(i!==void 0&&i.extension!==r&&ae(298,r.name),!i){i=new Db(this,r),this.extensionNameMap.set(r.name,i);const s=this.conflicts.get(r.name);typeof s=="string"&&ae(299,r.name,s);for(const o of r.conflictsWith||[])this.extensionNameMap.has(o)&&ae(299,r.name,o),this.conflicts.set(o,r.name);for(const o of r.dependencies||[]){const l=js(o);this.addEdge(r.name,l[0].name,l.slice(1)),this.addExtension(l)}for(const[o,l]of r.peerDependencies||[])this.addEdge(r.name,o,l?[l]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const e=[],t=(r,i)=>{let s=r.state;if(Tp(s))return;const o=r.extension.name;var l;aa(s)||ae(300,o,i||"[unknown]"),aa(l=s)||ae(304,String(l.id),String(pu)),s=Object.assign(l,{id:ec}),r.state=s;const a=this.outgoingConfigEdges.get(o);if(a)for(const c of a.keys()){const u=this.extensionNameMap.get(c);u&&t(u,o)}s=Lb(s),r.state=s,e.push(r)};for(const r of this.extensionNameMap.values())aa(r.state)&&t(r);for(const r of e)for(const[i,s]of this.outgoingConfigEdges.get(r.extension.name)||[])if(s.length>0){const o=this.extensionNameMap.get(i);if(o)for(const l of s)o.configs.add(l)}for(const[r,...i]of this.roots)if(i.length>0){const s=this.extensionNameMap.get(r.name);s===void 0&&ae(301,r.name);for(const o of i)s.configs.add(o)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){const t=this.sortedExtensionReps(),r=new AbortController,i=[()=>r.abort()],s=r.signal;for(const o of t){const l=o.register(e,s);l&&i.push(l)}for(const o of t){const l=o.afterRegistration(e);l&&i.push(l)}return mt(...i)}buildCreateEditorArgs(){const e={},t=new Set,r=new Map,i=new Map,s={},o={},l=this.sortedExtensionReps();for(const u of l){const{extension:d}=u;if(d.onError!==void 0&&(e.onError=d.onError),d.disableEvents!==void 0&&(e.disableEvents=d.disableEvents),d.parentEditor!==void 0&&(e.parentEditor=d.parentEditor),d.editable!==void 0&&(e.editable=d.editable),d.namespace!==void 0&&(e.namespace=d.namespace),d.$initialEditorState!==void 0&&(e.$initialEditorState=d.$initialEditorState),d.nodes)for(const f of Fb(d)){if(typeof f!="function"){const h=r.get(f.replace);h&&ae(302,d.name,f.replace.name,h.extension.name),r.set(f.replace,u)}t.add(f)}if(d.html){if(d.html.export)for(const[f,h]of d.html.export.entries())i.set(f,h);d.html.import&&Object.assign(s,d.html.import)}d.theme&&Ep(o,d.theme)}Object.keys(o).length>0&&(e.theme=o),t.size&&(e.nodes=[...t]);const a=Object.keys(s).length>0,c=i.size>0;(a||c)&&(e.html={},a&&(e.html.import=s),c&&(e.html.export=i));for(const u of l)u.init(e);return e.onError||(e.onError=Bb),e}};function Kb(n,e){const t=Ub.fromEditor(n).extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}function tf(n){const e=window.location.origin,t=r=>{if(r.origin!==e)return;const i=n.getRootElement();if(document.activeElement!==i)return;const s=r.data;if(typeof s=="string"){let o;try{o=JSON.parse(s)}catch{return}if(o&&o.protocol==="nuanria_messaging"&&o.type==="request"){const l=o.payload;if(l&&l.functionId==="makeChanges"){const a=l.args;if(a){const[c,u,d,f,h]=a;n.update(()=>{const g=M();if(N(g)){const p=g.anchor;let m=p.getNode(),b=0,_=0;if(L(m)&&c>=0&&u>=0&&(b=c,_=c+u,g.setTextNodeRange(m,b,m,_)),b===_&&d===""||(g.insertRawText(d),m=p.getNode()),L(m)){b=f,_=f+h;const y=m.getTextContentSize();b=b>y?y:b,_=_>y?y:_,g.setTextNodeRange(m,b,m,_)}r.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",t,!0),()=>{window.removeEventListener("message",t,!0)}}function nf(n,e){if(document.caretRangeFromPoint!==void 0){const t=document.caretRangeFromPoint(n,e);return t===null?null:{node:t.startContainer,offset:t.startOffset}}if(document.caretPositionFromPoint!=="undefined"){const t=document.caretPositionFromPoint(n,e);return t===null?null:{node:t.offsetNode,offset:t.offset}}return null}const Ar=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,Wb=Ar&&"documentMode"in document?document.documentMode:null,jb=Ar&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Hb=!(!Ar||!("InputEvent"in window)||Wb)&&"getTargetRanges"in new window.InputEvent("input"),Jb=Ar&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),rf=Ar&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Gb=Ar&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Vb=Ar&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&jb&&!Gb,sf=U("DRAG_DROP_PASTE_FILE");let ks=class Np extends xe{static getType(){return"quote"}static clone(e){return new Np(e.__key)}createDOM(e){const t=document.createElement("blockquote");return me(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:Yb,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(ne(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();r&&(t.style.textAlign=r);const i=this.getDirection();i&&(t.dir=i)}return{element:t}}static importJSON(e){return bi().updateFromJSON(e)}insertNewAfter(e,t){const r=H(),i=this.getDirection();return r.setDirection(i),this.insertAfter(r,t),r}collapseAtStart(){const e=H();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function bi(){return ze(new ks)}function tc(n){return n instanceof ks}let Ts=class Ap extends xe{__tag;static getType(){return"heading"}static clone(e){return new Ap(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}setTag(e){const t=this.getWritable();return this.__tag=e,t}createDOM(e){const t=this.__tag,r=document.createElement(t),i=e.theme.heading;if(i!==void 0){const s=i[t];me(r,s)}return r}updateDOM(e,t,r){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:zr,priority:0}),h2:e=>({conversion:zr,priority:0}),h3:e=>({conversion:zr,priority:0}),h4:e=>({conversion:zr,priority:0}),h5:e=>({conversion:zr,priority:0}),h6:e=>({conversion:zr,priority:0}),p:e=>{const t=e.firstChild;return t!==null&&of(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>of(e)?{conversion:t=>({node:Ae("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(ne(t)){this.isEmpty()&&t.append(document.createElement("br"));const r=this.getFormatType();r&&(t.style.textAlign=r);const i=this.getDirection();i&&(t.dir=i)}return{element:t}}static importJSON(e){return Ae(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){const r=e?e.anchor.offset:0,i=this.getLastDescendant(),s=!i||e&&e.anchor.key===i.getKey()&&r===i.getTextContentSize()||!e?H():Ae(this.getTag()),o=this.getDirection();if(s.setDirection(o),this.insertAfter(s,t),r===0&&!this.isEmpty()&&e){const l=H();l.select(),this.replace(l,!0)}return s}collapseAtStart(){const e=this.isEmpty()?H():Ae(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}};function of(n){return n.nodeName.toLowerCase()==="span"&&n.style.fontSize==="26pt"}function zr(n){const e=n.nodeName.toLowerCase();let t=null;return e!=="h1"&&e!=="h2"&&e!=="h3"&&e!=="h4"&&e!=="h5"&&e!=="h6"||(t=Ae(e),n.style!==null&&(fl(n,t),t.setFormat(n.style.textAlign))),{node:t}}function Yb(n){const e=bi();return n.style!==null&&(e.setFormat(n.style.textAlign),fl(n,e)),{node:e}}function Ae(n="h1"){return ze(new Ts(n))}function qb(n){return n instanceof Ts}function Hs(n){let e=null;if(an(n,DragEvent)?e=n.dataTransfer:an(n,ClipboardEvent)&&(e=n.clipboardData),e===null)return[!1,[],!1];const t=e.types,r=t.includes("Files"),i=t.includes("text/html")||t.includes("text/plain");return[r,Array.from(e.files),i]}function lf(n){const e=M();if(!N(e))return!1;const t=new Set,r=e.getNodes();for(let i=0;i<r.length;i++){const s=r[i],o=s.getKey();if(t.has(o))continue;const l=le(s,c=>O(c)&&!c.isInline());if(l===null)continue;const a=l.getKey();l.canIndent()&&!t.has(a)&&(t.add(a),n(l))}return t.size>0}function af(n){const e=pt(n);return Z(e)}function ua(n){for(const e of["lowercase","uppercase","capitalize"])n.hasFormat(e)&&n.toggleFormat(e)}function Zb(n){return mt(n.registerCommand(Sr,e=>{const t=M();return!!Ge(t)&&(t.clear(),!0)},B),n.registerCommand(It,e=>{const t=M();return N(t)?(t.deleteCharacter(e),!0):!!Ge(t)&&(t.deleteNodes(),!0)},B),n.registerCommand(dr,e=>{const t=M();return!!N(t)&&(t.deleteWord(e),!0)},B),n.registerCommand(fr,e=>{const t=M();return!!N(t)&&(t.deleteLine(e),!0)},B),n.registerCommand(In,e=>{const t=M();if(typeof e=="string")t!==null&&t.insertText(e);else{if(t===null)return!1;const r=e.dataTransfer;if(r!=null)Hd(r,t,n);else if(N(t)){const i=e.data;return i&&t.insertText(i),!0}}return!0},B),n.registerCommand(Xi,()=>{const e=M();return!!N(e)&&(e.removeText(),!0)},B),n.registerCommand(we,e=>{const t=M();return!!N(t)&&(t.formatText(e),!0)},B),n.registerCommand(Rc,e=>{const t=M();if(!N(t)&&!Ge(t))return!1;const r=t.getNodes();for(const i of r){const s=le(i,o=>O(o)&&!o.isInline());s!==null&&s.setFormat(e)}return!0},B),n.registerCommand(dn,e=>{const t=M();return!!N(t)&&(t.insertLineBreak(e),!0)},B),n.registerCommand(Dn,()=>{const e=M();return!!N(e)&&(e.insertParagraph(),!0)},B),n.registerCommand(po,()=>(il([Ct()]),!0),B),n.registerCommand(Wt,()=>lf(e=>{const t=e.getIndent();e.setIndent(t+1)}),B),n.registerCommand(ln,()=>lf(e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),B),n.registerCommand(hn,e=>{const t=M();if(Ge(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectPrevious(),!0}else if(N(t)){const r=ko(t.focus,!0);if(!e.shiftKey&&Z(r)&&!r.isIsolated()&&!r.isInline())return r.selectPrevious(),e.preventDefault(),!0}return!1},B),n.registerCommand(hr,e=>{const t=M();if(Ge(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),r[0].selectNext(0,0),!0}else if(N(t)){if((function(i){const s=i.focus;return s.key==="root"&&s.offset===de().getChildrenSize()})(t))return e.preventDefault(),!0;const r=ko(t.focus,!1);if(!e.shiftKey&&Z(r)&&!r.isIsolated()&&!r.isInline())return r.selectNext(),e.preventDefault(),!0}return!1},B),n.registerCommand(bs,e=>{const t=M();if(Ge(t)){const r=t.getNodes();if(r.length>0)return e.preventDefault(),Wd(r[0])?r[0].selectNext(0,0):r[0].selectPrevious(),!0}if(!N(t))return!1;if(Io(t,!0)){const r=e.shiftKey;return e.preventDefault(),$o(t,r,!0),!0}return!1},B),n.registerCommand(qo,e=>{const t=M();if(Ge(t)){const i=t.getNodes();if(i.length>0)return e.preventDefault(),Wd(i[0])?i[0].selectPrevious():i[0].selectNext(0,0),!0}if(!N(t))return!1;const r=e.shiftKey;return!!Io(t,!1)&&(e.preventDefault(),$o(t,r,!1),!0)},B),n.registerCommand(Xo,e=>{if(af(e.target))return!1;const t=M();if(N(t)){if((function(r){if(!r.isCollapsed())return!1;const{anchor:i}=r;if(i.offset!==0)return!1;const s=i.getNode();if(_e(s))return!1;const o=bb(s);return o.getIndent()>0&&(o.is(s)||s.is(o.getFirstDescendant()))})(t))return e.preventDefault(),n.dispatchCommand(ln,void 0);if(rf&&navigator.language==="ko-KR")return!1}else if(!Ge(t))return!1;return e.preventDefault(),n.dispatchCommand(It,!0)},B),n.registerCommand(Qo,e=>{if(af(e.target))return!1;const t=M();return!(!N(t)&&!Ge(t))&&(e.preventDefault(),n.dispatchCommand(It,!1))},B),n.registerCommand(Pn,e=>{const t=M();if(!N(t))return!1;if(ua(t),e!==null){if((rf||Jb||Vb)&&Hb)return!1;if(e.preventDefault(),e.shiftKey)return n.dispatchCommand(dn,!1)}return n.dispatchCommand(Dn,void 0)},B),n.registerCommand(di,()=>{const e=M();return!!N(e)&&(n.blur(),!0)},B),n.registerCommand(el,e=>{const[,t]=Hs(e);if(t.length>0){const i=nf(e.clientX,e.clientY);if(i!==null){const{offset:s,node:o}=i,l=pt(o);if(l!==null){const a=gi();if(L(l))a.anchor.set(l.getKey(),s,"text"),a.focus.set(l.getKey(),s,"text");else{const u=l.getParentOrThrow().getKey(),d=l.getIndexWithinParent()+1;a.anchor.set(u,d,"element"),a.focus.set(u,d,"element")}const c=Rn(a);De(c)}n.dispatchCommand(sf,t)}return e.preventDefault(),!0}const r=M();return!!N(r)},B),n.registerCommand(tl,e=>{const[t]=Hs(e),r=M();return!(t&&!N(r))},B),n.registerCommand(Dc,e=>{const[t]=Hs(e),r=M();if(t&&!N(r))return!1;const i=nf(e.clientX,e.clientY);if(i!==null){const s=pt(i.node);Z(s)&&e.preventDefault()}return!0},B),n.registerCommand(Qr,()=>(eu(),!0),B),n.registerCommand(Cr,e=>(Gd(n,an(e,ClipboardEvent)?e:null),!0),B),n.registerCommand(fi,e=>((async function(t,r){await Gd(r,an(t,ClipboardEvent)?t:null),r.update(()=>{const i=M();N(i)?i.removeText():Ge(i)&&i.getNodes().forEach(s=>s.remove())})})(e,n),!0),B),n.registerCommand(ai,e=>{const[,t,r]=Hs(e);return t.length>0&&!r?(n.dispatchCommand(sf,t),!0):Yn(e.target)&&al(e.target)?!1:M()!==null&&((function(i,s){i.preventDefault(),s.update(()=>{const o=M(),l=an(i,InputEvent)||an(i,KeyboardEvent)?null:i.clipboardData;l!=null&&o!==null&&Hd(l,o,s)},{tag:Bc})})(e,n),!0)},B),n.registerCommand(Zo,e=>{const t=M();return N(t)&&ua(t),!1},B),n.registerCommand(xs,e=>{const t=M();return N(t)&&ua(t),!1},B))}function On(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 Xb(n){let e=1,t=n.getParent();for(;t!=null;){if(ee(t)){const r=t.getParent();if(Y(r)){e++,t=r.getParent();continue}On(40)}return e}return e}function nc(n){let e=n.getParent();Y(e)||On(40);let t=e;for(;t!==null;)t=t.getParent(),Y(t)&&(e=t);return e}function Op(n){let e=[];const t=n.getChildren().filter(ee);for(let r=0;r<t.length;r++){const i=t[r],s=i.getFirstChild();Y(s)?e=e.concat(Op(s)):e.push(i)}return e}function Kt(n){return ee(n)&&Y(n.getFirstChild())}function cf(n){return _t().append(n)}function Mp(n,e){return ee(n)&&(e.length===0||e.length===1&&n.is(e[0])&&n.getChildrenSize()===0)}function Lo(n){const e=M();if(e!==null){let t=e.getNodes();if(N(e)){const i=e.getStartEndPoints();i===null&&On(143);const[s]=i,o=s.getNode(),l=o.getParent();if(We(o)){const a=o.getFirstChild();if(a)t=a.selectStart().getNodes();else{const c=H();o.append(c),t=c.select().getNodes()}}else if(Mp(o,t)){const a=ct(n);if(We(l)){o.replace(a);const c=_t();O(o)&&(c.setFormat(o.getFormatType()),c.setIndent(o.getIndent())),a.append(c)}else if(ee(o)){const c=o.getParentOrThrow();br(a,c.getChildren()),c.replace(a)}return}}const r=new Set;for(let i=0;i<t.length;i++){const s=t[i];if(O(s)&&s.isEmpty()&&!ee(s)&&!r.has(s.getKey())){uf(s,n);continue}let o=Yc(s)?s.getParent():ee(s)&&s.isEmpty()?s:null;for(;o!=null;){const l=o.getKey();if(Y(o)){if(!r.has(l)){const a=ct(n);br(a,o.getChildren()),o.replace(a),r.add(l)}break}{const a=o.getParent();if(We(a)&&!r.has(l)){r.add(l),uf(o,n);break}o=a}}}}}function br(n,e){n.splice(n.getChildrenSize(),0,e)}function uf(n,e){if(Y(n))return n;const t=n.getPreviousSibling(),r=n.getNextSibling(),i=_t();let s;if(br(i,n.getChildren()),Y(t)&&e===t.getListType())t.append(i),Y(r)&&e===r.getListType()&&(br(t,r.getChildren()),r.remove()),s=t;else if(Y(r)&&e===r.getListType())r.getFirstChildOrThrow().insertBefore(i),s=r;else{const l=ct(e);l.append(i),n.replace(l),s=l}i.setFormat(n.getFormatType()),i.setIndent(n.getIndent());const o=M();return N(o)&&(s.getKey()===o.anchor.key&&o.anchor.set(i.getKey(),o.anchor.offset,"element"),s.getKey()===o.focus.key&&o.focus.set(i.getKey(),o.focus.offset,"element")),n.remove(),s}function mu(n,e){const t=n.getLastChild(),r=e.getFirstChild();t&&r&&Kt(t)&&Kt(r)&&(mu(t.getFirstChild(),r.getFirstChild()),r.remove());const i=e.getChildren();i.length>0&&n.append(...i),e.remove()}function Ip(){const n=M();if(N(n)){const e=new Set,t=n.getNodes(),r=n.anchor.getNode();if(Mp(r,t))e.add(nc(r));else for(let i=0;i<t.length;i++){const s=t[i];if(Yc(s)){const o=yb(s,Or);o!=null&&e.add(nc(o))}}for(const i of e){let s=i;const o=Op(i);for(const l of o){const a=H().setTextStyle(n.style).setTextFormat(n.format);br(a,l.getChildren()),s.insertAfter(a),s=a,l.__key===n.anchor.key&&Bn(n.anchor,it(dt(a,"next"))),l.__key===n.focus.key&&Bn(n.focus,it(dt(a,"next"))),l.remove()}i.remove()}}}function $p(n){const e=n.getListType()!=="check";let t=n.getStart();for(const r of n.getChildren())ee(r)&&(r.getValue()!==t&&r.setValue(t),e&&r.getLatest().__checked!=null&&r.setChecked(void 0),Y(r.getFirstChild())||t++)}function Qb(n){const e=new Set;if(Kt(n)||e.has(n.getKey()))return;const t=n.getParent(),r=n.getNextSibling(),i=n.getPreviousSibling();if(Kt(r)&&Kt(i)){const s=i.getFirstChild();if(Y(s)){s.append(n);const o=r.getFirstChild();Y(o)&&(br(s,o.getChildren()),r.remove(),e.add(r.getKey()))}}else if(Kt(r)){const s=r.getFirstChild();if(Y(s)){const o=s.getFirstChild();o!==null&&o.insertBefore(n)}}else if(Kt(i)){const s=i.getFirstChild();Y(s)&&s.append(n)}else if(Y(t)){const s=_t().setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle()),o=ct(t.getListType()).setTextFormat(t.getTextFormat()).setTextStyle(t.getTextStyle());s.append(o),o.append(n),i?i.insertAfter(s):r?r.insertBefore(s):t.append(s)}}function ex(n){if(Kt(n))return;const e=n.getParent(),t=e?e.getParent():void 0;if(Y(t?t.getParent():void 0)&&ee(t)&&Y(e)){const r=e?e.getFirstChild():void 0,i=e?e.getLastChild():void 0;if(n.is(r))t.insertBefore(n),e.isEmpty()&&t.remove();else if(n.is(i))t.insertAfter(n),e.isEmpty()&&t.remove();else{const s=e.getListType(),o=_t(),l=ct(s);o.append(l),n.getPreviousSiblings().forEach(u=>l.append(u));const a=_t(),c=ct(s);a.append(c),br(c,n.getNextSiblings()),t.insertBefore(o),t.insertAfter(a),t.replace(n)}}}function tx(){const n=M();if(!N(n)||!n.isCollapsed())return!1;const e=n.anchor.getNode();let t=null;if(ee(e)&&e.getChildrenSize()===0)t=e;else if(L(e)){const a=e.getParent();ee(a)&&a.getChildren().every(c=>L(c)&&c.getTextContent().trim()==="")&&(t=a)}if(t===null)return!1;const r=nc(t),i=t.getParent();Y(i)||On(40);const s=i.getParent();let o;if(We(s))o=H(),r.insertAfter(o);else{if(!ee(s))return!1;o=_t(),s.insertAfter(o)}o.setTextStyle(n.style).setTextFormat(n.format).select();const l=t.getNextSiblings();if(l.length>0){const a=ct(i.getListType());if(ee(o)){const c=_t();c.append(a),o.insertAfter(c)}else o.insertAfter(a);a.append(...l)}return(function(a){let c=a;for(;c.getNextSibling()==null&&c.getPreviousSibling()==null;){const u=c.getParent();if(u==null||!ee(u)&&!Y(u))break;c=u}c.remove()})(t),!0}let Or=class extends xe{__value;__checked;$config(){return this.config("listitem",{$transform:e=>{if(e.__checked==null)return;const t=e.getParent();Y(t)&&t.getListType()!=="check"&&e.getChecked()!=null&&e.setChecked(void 0)},extends:xe,importDOM:{li:()=>({conversion:nx,priority:0})}})}constructor(e=1,t=void 0,r){super(r),this.__value=e===void 0?1:e,this.__checked=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){const t=document.createElement("li");return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,r){(function(o,l,a){const c=l.getParent();!Y(c)||c.getListType()!=="check"||Y(l.getFirstChild())?(o.removeAttribute("role"),o.removeAttribute("tabIndex"),o.removeAttribute("aria-checked")):(o.setAttribute("role","checkbox"),o.setAttribute("tabIndex","-1"),a&&l.__checked===a.__checked||o.setAttribute("aria-checked",l.getChecked()?"true":"false"))})(t,this,e),t.value=this.__value,(function(o,l,a){const c=[],u=[],d=l.list,f=d?d.listitem:void 0;let h;if(d&&d.nested&&(h=d.nested.listitem),f!==void 0&&c.push(...pn(f)),d){const g=a.getParent(),p=Y(g)&&g.getListType()==="check",m=a.getChecked();p&&!m||u.push(d.listitemUnchecked),p&&m||u.push(d.listitemChecked),p&&c.push(m?d.listitemChecked:d.listitemUnchecked)}if(h!==void 0){const g=pn(h);a.getChildren().some(p=>Y(p))?c.push(...g):u.push(...g)}u.length>0&&fn(o,...u),c.length>0&&me(o,...c)})(t,r.theme,this);const i=e?e.__style:"",s=this.__style;i!==s&&(s===""?t.removeAttribute("style"):t.style.cssText=s),(function(o,l,a){const c=rs(l.__textStyle);for(const u in c)o.style.setProperty(`--listitem-marker-${u}`,c[u]);if(a)for(const u in rs(a.__textStyle))u in c||o.style.removeProperty(`--listitem-marker-${u}`)})(t,this,e)}updateDOM(e,t,r){const i=t;return this.updateListItemDOM(e,i,r),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){const t=this.createDOM(e._config),r=this.getFormatType();r&&(t.style.textAlign=r);const i=this.getDirection();return i&&(t.dir=i),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let t=0;t<e.length;t++){const r=e[t];if(O(r)&&this.canMergeWith(r)){const i=r.getChildren();this.append(...i),r.remove()}else super.append(r)}return this}replace(e,t){if(ee(e))return super.replace(e);this.setIndent(0);const r=this.getParentOrThrow();if(!Y(r))return e;if(r.__first===this.getKey())r.insertBefore(e);else if(r.__last===this.getKey())r.insertAfter(e);else{const i=ct(r.getListType());let s=this.getNextSibling();for(;s;){const o=s;s=s.getNextSibling(),i.append(o)}r.insertAfter(e),e.insertAfter(i)}return t&&(O(e)||On(139),this.getChildren().forEach(i=>{e.append(i)})),this.remove(),r.getChildrenSize()===0&&r.remove(),e}insertAfter(e,t=!0){const r=this.getParentOrThrow();if(Y(r)||On(39),ee(e))return super.insertAfter(e,t);const i=this.getNextSiblings();if(r.insertAfter(e,t),i.length!==0){const s=ct(r.getListType());i.forEach(o=>s.append(o)),e.insertAfter(s,t)}return e}remove(e){const t=this.getPreviousSibling(),r=this.getNextSibling();super.remove(e),t&&r&&Kt(t)&&Kt(r)&&(mu(t.getFirstChild(),r.getFirstChild()),r.remove())}insertNewAfter(e,t=!0){const r=_t().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(r,t),r}collapseAtStart(e){const t=H();this.getChildren().forEach(o=>t.append(o));const r=this.getParentOrThrow(),i=r.getParentOrThrow(),s=ee(i);if(r.getChildrenSize()===1)if(s)r.remove(),i.select();else{r.insertBefore(t),r.remove();const o=e.anchor,l=e.focus,a=t.getKey();o.type==="element"&&o.getNode().is(this)&&o.set(a,o.offset,"element"),l.type==="element"&&l.getNode().is(this)&&l.set(a,l.offset,"element")}else r.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){const t=this.getWritable();return t.__value=e,t}getChecked(){const e=this.getLatest();let t;const r=this.getParent();return Y(r)&&(t=r.getListType()),t==="check"?!!e.__checked:void 0}setChecked(e){const t=this.getWritable();return t.__checked=e,t}toggleChecked(){const e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){const e=this.getParent();if(e===null||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),r=0;for(;ee(t);)t=t.getParentOrThrow().getParentOrThrow(),r++;return r}setIndent(e){typeof e!="number"&&On(117),(e=Math.floor(e))>=0||On(199);let t=this.getIndent();for(;t!==e;)t<e?(Qb(this),t++):(ex(this),t--);return this}canInsertAfter(e){return ee(e)}canReplaceWith(e){return ee(e)}canMergeWith(e){return ee(e)||Nr(e)}extractWithChild(e,t){if(!N(t))return!1;const r=t.anchor.getNode(),i=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&this.getTextContent().length===t.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return ct("bullet")}canMergeWhenEmpty(){return!0}};function nx(n){if(n.classList.contains("task-list-item")){for(const t of n.children)if(t.tagName==="INPUT")return df(t)}if(n.classList.contains("joplin-checkbox")){for(const t of n.children)if(t.classList.contains("checkbox-wrapper")&&t.children.length>0&&t.children[0].tagName==="INPUT")return df(t.children[0])}const e=n.getAttribute("aria-checked");return{node:_t(e==="true"||e!=="false"&&void 0)}}function df(n){return n.getAttribute("type")!=="checkbox"?{node:null}:{node:_t(n.hasAttribute("checked"))}}function _t(n){return ze(new Or(void 0,n))}function ee(n){return n instanceof Or}let Ns=class extends xe{__tag;__start;__listType;$config(){return this.config("list",{$transform:e=>{(function(t){const r=t.getNextSibling();Y(r)&&t.getListType()===r.getListType()&&mu(t,r)})(e),$p(e)},extends:xe,importDOM:{ol:()=>({conversion:hf,priority:0}),ul:()=>({conversion:hf,priority:0})}})}constructor(e="number",t=1,r){super(r);const i=ix[e]||e;this.__listType=i,this.__tag=i==="number"?"ol":"ul",this.__start=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){const t=this.getWritable();return t.__listType=e,t.__tag=e==="number"?"ol":"ul",t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){const t=this.getWritable();return t.__start=e,t}createDOM(e,t){const r=this.__tag,i=document.createElement(r);return this.__start!==1&&i.setAttribute("start",String(this.__start)),i.__lexicalListType=this.__listType,ff(i,e.theme,this),i}updateDOM(e,t,r){return e.__tag!==this.__tag||e.__listType!==this.__listType||(ff(t,r.theme,this),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){const t=this.createDOM(e._config,e);return ne(t)&&(this.__start!==1&&t.setAttribute("start",String(this.__start)),this.__listType==="check"&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,t,r){let i=r;for(let s=0;s<r.length;s++){const o=r[s];ee(o)||(i===r&&(i=[...r]),i[s]=_t().append(!O(o)||Y(o)||o.isInline()?o:he(o.getTextContent())))}return super.splice(e,t,i)}extractWithChild(e){return ee(e)}};function ff(n,e,t){const r=[],i=[],s=e.list;if(s!==void 0){const o=s[`${t.__tag}Depth`]||[],l=Xb(t)-1,a=l%o.length,c=o[a],u=s[t.__tag];let d;const f=s.nested,h=s.checklist;if(f!==void 0&&f.list&&(d=f.list),u!==void 0&&r.push(u),h!==void 0&&t.__listType==="check"&&r.push(h),c!==void 0){r.push(...pn(c));for(let g=0;g<o.length;g++)g!==a&&i.push(t.__tag+g)}if(d!==void 0){const g=pn(d);l>1?r.push(...g):i.push(...g)}}i.length>0&&fn(n,...i),r.length>0&&me(n,...r)}function rx(n){const e=[];for(let t=0;t<n.length;t++){const r=n[t];if(ee(r)){e.push(r);const i=r.getChildren();i.length>1&&i.forEach(s=>{Y(s)&&e.push(cf(s))})}else e.push(cf(r))}return e}function hf(n){const e=n.nodeName.toLowerCase();let t=null;return e==="ol"?t=ct("number",n.start):e==="ul"&&(t=(function(r){if(r.getAttribute("__lexicallisttype")==="check"||r.classList.contains("contains-task-list")||r.getAttribute("data-is-checklist")==="1")return!0;for(const i of r.childNodes)if(ne(i)&&i.hasAttribute("aria-checked"))return!0;return!1})(n)?ct("check"):ct("bullet")),{after:rx,node:t}}const ix={ol:"number",ul:"bullet"};function ct(n="number",e=1){return ze(new Ns(n,e))}function Y(n){return n instanceof Ns}const xl=U("INSERT_CHECK_LIST_COMMAND");function gf(n){return mt(n.registerCommand(xl,()=>(Lo("check"),!0),q),n.registerCommand(hr,e=>_f(e,n,!1),q),n.registerCommand(hn,e=>_f(e,n,!0),q),n.registerCommand(di,()=>{if(rc()!=null){const e=n.getRootElement();return e?.focus(),!0}return!1},q),n.registerCommand(Zo,e=>{const t=rc();return!(t==null||!n.isEditable())&&(n.update(()=>{const r=pt(t);ee(r)&&(e.preventDefault(),r.toggleChecked())}),!0)},q),n.registerCommand(bs,e=>n.getEditorState().read(()=>{const t=M();if(N(t)&&t.isCollapsed()){const{anchor:r}=t,i=r.type==="element";if(i||r.offset===0){const s=r.getNode(),o=le(s,l=>O(l)&&!l.isInline());if(ee(o)){const l=o.getParent();if(Y(l)&&l.getListType()==="check"&&(i||o.getFirstDescendant()===s)){const a=n.getElementByKey(o.__key);if(a!=null&&document.activeElement!==a)return a.focus(),e.preventDefault(),!0}}}}return!1}),q),n.registerRootListener((e,t)=>{e!==null&&(e.addEventListener("click",pf),e.addEventListener("pointerdown",mf)),t!==null&&(t.removeEventListener("click",pf),t.removeEventListener("pointerdown",mf))}))}function Fp(n,e){const t=n.target;if(!ne(t))return;const r=t.firstChild;if(ne(r)&&(r.tagName==="UL"||r.tagName==="OL"))return;const i=t.parentNode;if(!i||i.__lexicalListType!=="check")return;const s=t.getBoundingClientRect(),o=Cb(t),l=n.clientX/o,a=window.getComputedStyle?window.getComputedStyle(t,"::before"):{width:"0px"},c=parseFloat(a.width),u=n.pointerType==="touch"?32:0;(t.dir==="rtl"?l<s.right+u&&l>s.right-c-u:l>s.left-u&&l<s.left+c+u)&&e()}function pf(n){Fp(n,()=>{if(ne(n.target)){const e=n.target,t=ul(e);t!=null&&t.isEditable()&&t.update(()=>{const r=pt(e);ee(r)&&(e.focus(),r.toggleChecked())})}})}function mf(n){Fp(n,()=>{n.preventDefault()})}function rc(){const n=document.activeElement;return ne(n)&&n.tagName==="LI"&&n.parentNode!=null&&n.parentNode.__lexicalListType==="check"?n:null}function _f(n,e,t){const r=rc();return r!=null&&e.update(()=>{const i=pt(r);if(!ee(i))return;const s=(function(o,l){let a=l?o.getPreviousSibling():o.getNextSibling(),c=o;for(;a==null&&ee(c);)c=c.getParentOrThrow().getParent(),c!=null&&(a=l?c.getPreviousSibling():c.getNextSibling());for(;ee(a);){const u=l?a.getLastChild():a.getFirstChild();if(!Y(u))return a;a=l?u.getLastChild():u.getFirstChild()}return null})(i,t);if(s!=null){s.selectStart();const o=e.getElementByKey(s.__key);o!=null&&(n.preventDefault(),setTimeout(()=>{o.focus()},0))}}),!1}const sx=U("UPDATE_LIST_START_COMMAND"),xi=U("INSERT_UNORDERED_LIST_COMMAND"),Si=U("INSERT_ORDERED_LIST_COMMAND"),_u=U("REMOVE_LIST_COMMAND");function da(n){return mt(n.registerCommand(Si,()=>(Lo("number"),!0),q),n.registerCommand(sx,e=>{const{listNodeKey:t,newStart:r}=e,i=Q(t);return!!Y(i)&&(i.getListType()==="number"&&(i.setStart(r),$p(i)),!0)},q),n.registerCommand(xi,()=>(Lo("bullet"),!0),q),n.registerCommand(_u,()=>(Ip(),!0),q),n.registerCommand(Dn,()=>tx(),q),n.registerNodeTransform(Or,e=>{const t=e.getFirstChild();if(t){if(L(t)){const r=t.getStyle(),i=t.getFormat();e.getTextStyle()!==r&&e.setTextStyle(r),e.getTextFormat()!==i&&e.setTextFormat(i)}}else{const r=M();N(r)&&(r.style!==e.getTextStyle()||r.format!==e.getTextFormat())&&r.isCollapsed()&&e.is(r.anchor.getNode())&&e.setTextStyle(r.style).setTextFormat(r.format)}}),n.registerNodeTransform(Qe,e=>{const t=e.getParent();if(ee(t)&&e.is(t.getFirstChild())){const r=e.getStyle(),i=e.getFormat();r===t.getTextStyle()&&i===t.getTextFormat()||t.setTextStyle(r).setTextFormat(i)}}))}function fa(n,e){n.update(()=>Lo(e))}function ox(n){n.update(()=>Ip())}const yu=/^(\d+(?:\.\d+)?)px$/,Oe={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class Mr extends xe{__colSpan;__rowSpan;__headerState;__width;__backgroundColor;__verticalAlign;static getType(){return"tablecell"}static clone(e){return new Mr(e.__headerState,e.__colSpan,e.__width,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign}static importDOM(){return{td:e=>({conversion:yf,priority:0}),th:e=>({conversion:yf,priority:0})}}static importJSON(e){return Gt().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}constructor(e=Oe.NO_STATUS,t=1,r,i){super(i),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=r,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){const t=document.createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),this.__backgroundColor!==null&&(t.style.backgroundColor=this.__backgroundColor),ic(this.__verticalAlign)&&(t.style.verticalAlign=this.__verticalAlign),me(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const t=super.exportDOM(e);if(ne(t.element)){const r=t.element;r.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),r.style.border="1px solid black",this.__colSpan>1&&(r.colSpan=this.__colSpan),this.__rowSpan>1&&(r.rowSpan=this.__rowSpan),r.style.width=`${this.getWidth()||75}px`,r.style.verticalAlign=this.getVerticalAlign()||"top",r.style.textAlign="start",this.__backgroundColor===null&&this.hasHeader()&&(r.style.backgroundColor="#f2f3f5")}return t}exportJSON(){return{...super.exportJSON(),...ic(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){const t=this.getWritable();return t.__colSpan=e,t}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){const t=this.getWritable();return t.__rowSpan=e,t}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e,t=Oe.BOTH){const r=this.getWritable();return r.__headerState=e&t|r.__headerState&~t,r}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){const t=this.getWritable();return t.__width=e,t}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){const t=this.getWritable();return t.__backgroundColor=e,t}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){const t=this.getWritable();return t.__verticalAlign=e||void 0,t}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==Oe.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function ic(n){return n==="middle"||n==="bottom"}function yf(n){const e=n,t=n.nodeName.toLowerCase();let r;yu.test(e.style.width)&&(r=parseFloat(e.style.width));const i=Gt(t==="th"?Oe.ROW:Oe.NO_STATUS,e.colSpan,r);i.__rowSpan=e.rowSpan;const s=e.style.backgroundColor;s!==""&&(i.__backgroundColor=s);const o=e.style.verticalAlign;ic(o)&&(i.__verticalAlign=o);const l=e.style,a=(l&&l.textDecoration||"").split(" "),c=l.fontWeight==="700"||l.fontWeight==="bold",u=a.includes("line-through"),d=l.fontStyle==="italic",f=a.includes("underline");return{after:h=>{const g=[];let p=null;const m=()=>{if(p){const b=p.getFirstChild();ue(b)&&p.getChildrenSize()===1&&b.remove()}};for(const b of h)Ug(b)||L(b)||ue(b)?(L(b)&&(c&&b.toggleFormat("bold"),u&&b.toggleFormat("strikethrough"),d&&b.toggleFormat("italic"),f&&b.toggleFormat("underline")),p?p.append(b):(p=H().append(b),g.push(p))):(g.push(b),m(),p=null);return m(),g.length===0&&g.push(H()),g},node:i}}function Gt(n=Oe.NO_STATUS,e=1,t){return ze(new Mr(n,e,t))}function pe(n){return n instanceof Mr}const As=U("INSERT_TABLE_COMMAND");function te(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}class Ci extends xe{__height;static getType(){return"tablerow"}static clone(e){return new Ci(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:lx,priority:0})}}static importJSON(e){return is().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){const e=this.getHeight();return{...super.exportJSON(),...e===void 0?void 0:{height:e}}}createDOM(e){const t=document.createElement("tr");return this.__height&&(t.style.height=`${this.__height}px`),me(t,e.theme.tableRow),t}extractWithChild(e,t,r){return r==="html"}isShadowRoot(){return!0}setHeight(e){const t=this.getWritable();return t.__height=e,t}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function lx(n){const e=n;let t;return yu.test(e.style.height)&&(t=parseFloat(e.style.height)),{after:r=>dp(r,pe),node:is(t)}}function is(n){return ze(new Ci(n))}function st(n){return n instanceof Ci}const Lp=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,ax=Lp&&"documentMode"in document?document.documentMode:null;function cx(n,e,t=!0){const r=xu();for(let i=0;i<n;i++){const s=is();for(let o=0;o<e;o++){let l=Oe.NO_STATUS;typeof t=="object"?(i===0&&t.rows&&(l|=Oe.ROW),o===0&&t.columns&&(l|=Oe.COLUMN)):t&&(i===0&&(l|=Oe.ROW),o===0&&(l|=Oe.COLUMN));const a=Gt(l),c=H();c.append(he()),a.append(c),s.append(a)}r.append(s)}return r}function ux(n){const e=le(n,t=>pe(t));return pe(e)?e:null}function Rp(n){const e=le(n,t=>Vt(t));if(Vt(e))return e;throw new Error("Expected table cell to be inside of table.")}Lp&&"InputEvent"in window&&!ax&&new window.InputEvent("input");const sc=(n,e)=>n===Oe.BOTH||n===e?e:Oe.NO_STATUS;function bf(n=!0){const e=M();N(e)||Ir(e)||te(188);const t=e.anchor.getNode(),r=e.focus.getNode(),[i]=yt(t),[s,,o]=yt(r),[,l,a]=wn(o,s,i),{startRow:c}=a,{startRow:u}=l;return n?oc(c+i.__rowSpan>u+s.__rowSpan?i:s,!0):oc(u<c?s:i,!1)}function oc(n,e=!0){const[,,t]=yt(n),[r,i]=wn(t,n,n),s=r[0].length,{startRow:o}=i;let l=null;if(e){const a=o+n.__rowSpan-1,c=r[a],u=is();for(let f=0;f<s;f++){const{cell:h,startRow:g}=c[f];if(g+h.__rowSpan-1<=a){const p=c[f].cell.__headerState,m=sc(p,Oe.COLUMN);u.append(Gt(m).append(H()))}else h.setRowSpan(h.__rowSpan+1)}const d=t.getChildAtIndex(a);st(d)||te(256),d.insertAfter(u),l=u}else{const a=o,c=r[a],u=is();for(let f=0;f<s;f++){const{cell:h,startRow:g}=c[f];if(g===a){const p=c[f].cell.__headerState,m=sc(p,Oe.COLUMN);u.append(Gt(m).append(H()))}else h.setRowSpan(h.__rowSpan+1)}const d=t.getChildAtIndex(a);st(d)||te(257),d.insertBefore(u),l=u}return l}function xf(n=!0){const e=M();N(e)||Ir(e)||te(188);const t=e.anchor.getNode(),r=e.focus.getNode(),[i]=yt(t),[s,,o]=yt(r),[,l,a]=wn(o,s,i),{startColumn:c}=a,{startColumn:u}=l;return n?lc(c+i.__colSpan>u+s.__colSpan?i:s,!0):lc(u<c?s:i,!1)}function lc(n,e=!0,t=!0){const[,,r]=yt(n),[i,s]=wn(r,n,n),o=i.length,{startColumn:l}=s,a=e?l+n.__colSpan-1:l-1,c=r.getFirstChild();st(c)||te(120);let u=null;function d(g=Oe.NO_STATUS){const p=Gt(g).append(H());return u===null&&(u=p),p}let f=c;e:for(let g=0;g<o;g++){if(g!==0){const S=f.getNextSibling();st(S)||te(121),f=S}const p=i[g],m=p[a<0?0:a].cell.__headerState,b=sc(m,Oe.ROW);if(a<0){bu(f,d(b));continue}const{cell:_,startColumn:y,startRow:C}=p[a];if(y+_.__colSpan-1<=a){let S=_,w=C,x=a;for(;w!==g&&S.__rowSpan>1;){if(x-=_.__colSpan,!(x>=0)){f.append(d(b));continue e}{const{cell:T,startRow:E}=p[x];S=T,w=E}}S.insertAfter(d(b))}else _.setColSpan(_.__colSpan+1)}u!==null&&t&&ss(u);const h=r.getColWidths();if(h){const g=[...h],p=a<0?0:a,m=g[p];g.splice(p,0,m),r.setColWidths(g)}return u}function dx(){const n=M();N(n)||Ir(n)||te(188);const[e,t]=n.isBackward()?[n.focus.getNode(),n.anchor.getNode()]:[n.anchor.getNode(),n.focus.getNode()],[r,,i]=yt(e),[s]=yt(t),[o,l,a]=wn(i,r,s),{startRow:c}=l,{startRow:u}=a,d=u+s.__rowSpan-1;if(o.length===d-c+1)return void i.remove();const f=o[0].length,h=o[d+1],g=i.getChildAtIndex(d+1);for(let p=d;p>=c;p--){for(let b=f-1;b>=0;b--){const{cell:_,startRow:y,startColumn:C}=o[p][b];if(C===b){if(y<c||y+_.__rowSpan-1>d){const S=Math.max(y,c),w=Math.min(_.__rowSpan+y-1,d),x=S<=w?w-S+1:0;_.setRowSpan(_.__rowSpan-x)}if(y>=c&&y+_.__rowSpan-1>d&&p===d){g===null&&te(122);let S=null;for(let w=0;w<b;w++){const x=h[w],T=x.cell;x.startRow===p+1&&(S=T),T.__colSpan>1&&(w+=T.__colSpan-1)}S===null?bu(g,_):S.insertAfter(_)}}}const m=i.getChildAtIndex(p);st(m)||te(206,String(p)),m.remove()}if(h!==void 0){const{cell:p}=h[0];ss(p)}else{const p=o[c-1],{cell:m}=p[0];ss(m)}}function fx(){const n=M();N(n)||Ir(n)||te(188);const e=n.anchor.getNode(),t=n.focus.getNode(),[r,,i]=yt(e),[s]=yt(t),[o,l,a]=wn(i,r,s),{startColumn:c}=l,{startRow:u,startColumn:d}=a,f=Math.min(c,d),h=Math.max(c+r.__colSpan-1,d+s.__colSpan-1),g=h-f+1;if(o[0].length===h-f+1)return i.selectPrevious(),void i.remove();const p=o.length;for(let y=0;y<p;y++)for(let C=f;C<=h;C++){const{cell:S,startColumn:w}=o[y][C];if(w<f){if(C===f){const x=f-w;S.setColSpan(S.__colSpan-Math.min(g,S.__colSpan-x))}}else if(w+S.__colSpan-1>h){if(C===h){const x=h-w+1;S.setColSpan(S.__colSpan-x)}}else S.remove()}const m=o[u],b=c>d?m[c+r.__colSpan]:m[d+s.__colSpan];if(b!==void 0){const{cell:y}=b;ss(y)}else{const y=d<c?m[d-1]:m[c-1],{cell:C}=y;ss(C)}const _=i.getColWidths();if(_){const y=[..._];y.splice(f,g),i.setColWidths(y)}}function ss(n){const e=n.getFirstDescendant();e==null?n.selectStart():e.getParentOrThrow().selectStart()}function bu(n,e){const t=n.getFirstChild();t!==null?t.insertBefore(e):n.append(e)}function hx(n){if(n.length===0)return null;const e=Rp(n[0]),[t]=cn(e,null,null);let r=1/0,i=-1/0,s=1/0,o=-1/0;const l=new Set;for(const h of t)for(const g of h){if(!g||!g.cell)continue;const p=g.cell.getKey();if(!l.has(p)&&n.some(m=>m.is(g.cell))){l.add(p);const m=g.startRow,b=g.startColumn,_=g.cell.__rowSpan||1,y=g.cell.__colSpan||1;r=Math.min(r,m),i=Math.max(i,m+_-1),s=Math.min(s,b),o=Math.max(o,b+y-1)}}if(r===1/0||s===1/0)return null;const a=i-r+1,c=o-s+1,u=t[r][s];if(!u.cell)return null;const d=u.cell;d.setColSpan(c),d.setRowSpan(a);const f=new Set([d.getKey()]);for(let h=r;h<=i;h++)for(let g=s;g<=o;g++){const p=t[h][g];if(!p.cell)continue;const m=p.cell,b=m.getKey();f.has(b)||(f.add(b),gx(m)||d.append(...m.getChildren()),m.remove())}return d.getChildrenSize()===0&&d.append(H()),d}function gx(n){if(n.getChildrenSize()!==1)return!1;const e=n.getFirstChildOrThrow();return!(!Nr(e)||!e.isEmpty())}function px(n){const[e,t,r]=yt(n),i=e.__colSpan,s=e.__rowSpan;if(i===1&&s===1)return;const[o,l]=wn(r,e,e),{startColumn:a,startRow:c}=l,u=e.__headerState&Oe.COLUMN,d=Array.from({length:i},(g,p)=>{let m=u;for(let b=0;m!==0&&b<o.length;b++)m&=o[b][p+a].cell.__headerState;return m}),f=e.__headerState&Oe.ROW,h=Array.from({length:s},(g,p)=>{let m=f;for(let b=0;m!==0&&b<o[0].length;b++)m&=o[p+c][b].cell.__headerState;return m});if(i>1){for(let g=1;g<i;g++)e.insertAfter(Gt(d[g]|h[0]).append(H()));e.setColSpan(1)}if(s>1){let g;for(let p=1;p<s;p++){const m=c+p,b=o[m];g=(g||t).getNextSibling(),st(g)||te(125);let _=null;for(let y=0;y<a;y++){const C=b[y],S=C.cell;C.startRow===m&&(_=S),S.__colSpan>1&&(y+=S.__colSpan-1)}if(_===null)for(let y=i-1;y>=0;y--)bu(g,Gt(d[y]|h[p]).append(H()));else for(let y=i-1;y>=0;y--)_.insertAfter(Gt(d[y]|h[p]).append(H()))}e.setRowSpan(1)}}function wn(n,e,t){const[r,i,s]=cn(n,e,t);return i===null&&te(207),s===null&&te(208),[r,i,s]}function cn(n,e,t){const r=[];let i=null,s=null;function o(a){let c=r[a];return c===void 0&&(r[a]=c=[]),c}const l=n.getChildren();for(let a=0;a<l.length;a++){const c=l[a];st(c)||te(209);const u=o(a);for(let d=c.getFirstChild(),f=0;d!=null;d=d.getNextSibling()){for(pe(d)||te(147);u[f]!==void 0;)f++;const h={cell:d,startColumn:f,startRow:a},{__rowSpan:g,__colSpan:p}=d;for(let m=0;m<g&&!(a+m>=l.length);m++){const b=o(a+m);for(let _=0;_<p;_++)b[f+_]=h}e!==null&&i===null&&e.is(d)&&(i=h),t!==null&&s===null&&t.is(d)&&(s=h)}}return[r,i,s]}function yt(n){let e;if(n instanceof Mr)e=n;else if("__type"in n){const i=le(n,pe);pe(i)||te(148),e=i}else{const i=le(n.getNode(),pe);pe(i)||te(148),e=i}const t=e.getParent();st(t)||te(149);const r=t.getParent();return Vt(r)||te(210),[e,t,r]}function Dp(n,e,t){let r,i=Math.min(e.startColumn,t.startColumn),s=Math.min(e.startRow,t.startRow),o=Math.max(e.startColumn+e.cell.__colSpan-1,t.startColumn+t.cell.__colSpan-1),l=Math.max(e.startRow+e.cell.__rowSpan-1,t.startRow+t.cell.__rowSpan-1);do{r=!1;for(let a=0;a<n.length;a++)for(let c=0;c<n[0].length;c++){const u=n[a][c];if(!u)continue;const d=u.startColumn+u.cell.__colSpan-1,f=u.startRow+u.cell.__rowSpan-1,h=u.startColumn<=o&&d>=i,g=u.startRow<=l&&f>=s;if(h&&g){const p=Math.min(i,u.startColumn),m=Math.max(o,d),b=Math.min(s,u.startRow),_=Math.max(l,f);p===i&&m===o&&b===s&&_===l||(i=p,o=m,s=b,l=_,r=!0)}}}while(r);return{maxColumn:o,maxRow:l,minColumn:i,minRow:s}}function Sf(n){const[e,,t]=yt(n),r=t.getChildren(),i=r.length,s=r[0].getChildren().length,o=new Array(i);for(let l=0;l<i;l++)o[l]=new Array(s);for(let l=0;l<i;l++){const a=r[l].getChildren();let c=0;for(let u=0;u<a.length;u++){for(;o[l][c];)c++;const d=a[u],f=d.__rowSpan||1,h=d.__colSpan||1;for(let g=0;g<f;g++)for(let p=0;p<h;p++)o[l+g][c+p]=d;if(e===d)return{colSpan:h,columnIndex:c,rowIndex:l,rowSpan:f};c+=h}}return null}function Cf(n){const[[e,t,r,i],[s,o,l,a]]=["anchor","focus"].map(c=>{const u=n[c].getNode(),d=le(u,pe);pe(d)||te(238,c,u.getKey(),u.getType());const f=d.getParent();st(f)||te(239,c);const h=f.getParent();return Vt(h)||te(240,c),[u,d,f,h]});return i.is(a)||te(241),{anchorCell:t,anchorNode:e,anchorRow:r,anchorTable:i,focusCell:o,focusNode:s,focusRow:l,focusTable:a}}let Pp=class zp{tableKey;anchor;focus;_cachedNodes;dirty;constructor(e,t,r){this.anchor=t,this.focus=r,t._selection=this,r._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){if(this.tableKey==="root"||this.anchor.key==="root"||this.anchor.type!=="element"||this.focus.key==="root"||this.focus.type!=="element")return!1;const e=Q(this.tableKey),t=Q(this.anchor.key),r=Q(this.focus.key);return e!==null&&t!==null&&r!==null}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return Ir(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,r){this.dirty=this.dirty||e!==this.tableKey||t!==this.anchor.key||r!==this.focus.key,this.tableKey=e,this.anchor.key=t,this.focus.key=r,this._cachedNodes=null}clone(){return new zp(this.tableKey,Me(this.anchor.key,this.anchor.offset,this.anchor.type),Me(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}hasFormat(e){let t=0;this.getNodes().filter(pe).forEach(i=>{const s=i.getFirstChild();Nr(s)&&(t|=s.getTextFormat())});const r=Ue[e];return(t&r)!==0}insertNodes(e){const t=this.focus.getNode();O(t)||te(151),Rn(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const{anchorCell:e,focusCell:t}=Cf(this),r=Sf(e);r===null&&te(153);const i=Sf(t);i===null&&te(155);const s=Math.min(r.columnIndex,i.columnIndex),o=Math.max(r.columnIndex+r.colSpan-1,i.columnIndex+i.colSpan-1),l=Math.min(r.rowIndex,i.rowIndex),a=Math.max(r.rowIndex+r.rowSpan-1,i.rowIndex+i.rowSpan-1);return{fromX:Math.min(s,o),fromY:Math.min(l,a),toX:Math.max(s,o),toY:Math.max(l,a)}}getNodes(){if(!this.isValid())return[];const e=this._cachedNodes;if(e!==null)return e;const{anchorTable:t,anchorCell:r,focusCell:i}=Cf(this),s=i.getParents()[1];if(s!==t){if(t.isParentOf(i)){const m=s.getParent();m==null&&te(159),this.set(this.tableKey,i.getKey(),m.getKey())}else{const m=t.getParent();m==null&&te(158),this.set(this.tableKey,m.getKey(),i.getKey())}return this.getNodes()}const[o,l,a]=wn(t,r,i),{minColumn:c,maxColumn:u,minRow:d,maxRow:f}=Dp(o,l,a),h=new Map([[t.getKey(),t]]);let g=null;for(let m=d;m<=f;m++)for(let b=c;b<=u;b++){const{cell:_}=o[m][b],y=_.getParent();st(y)||te(160),y!==g&&(h.set(y.getKey(),y),g=y),h.has(_.getKey())||yx(_,C=>{h.set(C.getKey(),C)})}const p=Array.from(h.values());return kr()||(this._cachedNodes=p),p}getTextContent(){const e=this.getNodes().filter(r=>pe(r));let t="";for(let r=0;r<e.length;r++){const i=e[r],s=i.__parent,o=(e[r+1]||{}).__parent;t+=i.getTextContent()+(o!==s?`
|
|
14
|
+
`:" ")}return t}};function Ir(n){return n instanceof Pp}function mx(){const n=Me("root",0,"element"),e=Me("root",0,"element");return new Pp("root",n,e)}function _x(n,e,t){n.getKey(),e.getKey(),t.getKey();const r=M(),i=Ir(r)?r.clone():mx();return i.set(n.getKey(),e.getKey(),t.getKey()),i}function yx(n,e){const t=[[n]];for(let r=t.at(-1);r!==void 0&&t.length>0;r=t.at(-1)){const i=r.pop();i===void 0?t.pop():e(i)!==!1&&O(i)&&t.push(i.getChildren())}}function Oi(n){return ne(n)&&n.nodeName==="TABLE"}function bx(n,e){for(let t=e,r=null;t!==null;t=t.getParent()){if(n.is(t))return r;pe(t)&&(r=t)}return null}function ac(n){const e=le(n,Vt);return Vt(e)?e:null}function xx(n,e,t){return bx(n,pt(e,t))}function wf(n,e,t){if(!e.theme.tableAlignment)return;const r=[],i=[];for(const s of["center","right"]){const o=e.theme.tableAlignment[s];o&&(s===t?i:r).push(o)}fn(n,...r),me(n,...i)}const Sx=new WeakSet;function vf(n=_i()){return Sx.has(n)}class xr extends xe{__rowStriping;__frozenColumnCount;__frozenRowCount;__colWidths;static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){const t=this.getWritable();return t.__colWidths=e,t}static clone(e){return new xr(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:Cx,priority:1})}}static importJSON(e){return xu().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0,this.__colWidths=void 0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,t,r){return r==="html"}getDOMSlot(e){const t=Oi(e)?e:e.querySelector("table");return Oi(t)||te(229),super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"))}createDOM(e,t){const r=document.createElement("table");this.__style&&(r.style.cssText=this.__style);const i=document.createElement("colgroup");if(r.appendChild(i),Hg(i),me(r,e.theme.table),this.updateTableElement(null,r,e),vf(t)){const s=document.createElement("div"),o=e.theme.tableScrollableWrapper;return o?me(s,o):s.style.cssText="overflow-x: auto;",s.appendChild(r),this.updateTableWrapper(null,s,r,e),s}return r}updateTableWrapper(e,t,r,i){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&(function(s,o,l,a){a>0?(me(s,l.theme.tableFrozenColumn),o.setAttribute("data-lexical-frozen-column","true")):(fn(s,l.theme.tableFrozenColumn),o.removeAttribute("data-lexical-frozen-column"))})(t,r,i,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&(function(s,o,l,a){a>0?(me(s,l.theme.tableFrozenRow),o.setAttribute("data-lexical-frozen-row","true")):(fn(s,l.theme.tableFrozenRow),o.removeAttribute("data-lexical-frozen-row"))})(t,r,i,this.__frozenRowCount)}updateTableElement(e,t,r){this.__style!==(e?e.__style:"")&&(t.style.cssText=this.__style),this.__rowStriping!==(!!e&&e.__rowStriping)&&(function(i,s,o){o?(me(i,s.theme.tableRowStriping),i.setAttribute("data-lexical-row-striping","true")):(fn(i,s.theme.tableRowStriping),i.removeAttribute("data-lexical-row-striping"))})(t,r,this.__rowStriping),(function(i,s,o,l){const a=i.querySelector("colgroup");if(!a)return;const c=[];for(let u=0;u<o;u++){const d=document.createElement("col"),f=l&&l[u];f&&(d.style.width=`${f}px`),c.push(d)}a.replaceChildren(...c)})(t,0,this.getColumnCount(),this.getColWidths()),wf(t,r,this.getFormatType())}updateDOM(e,t,r){const i=this.getDOMSlot(t).element;return t===i===vf()||(ne(s=t)&&s.nodeName==="DIV"&&this.updateTableWrapper(e,t,i,r),this.updateTableElement(e,i,r),!1);var s}exportDOM(e){const t=super.exportDOM(e),{element:r}=t;return{after:i=>{if(t.after&&(i=t.after(i)),!Oi(i)&&ne(i)&&(i=i.querySelector("table")),!Oi(i))return null;wf(i,e._config,this.getFormatType());const[s]=cn(this,null,null),o=new Map;for(const u of s)for(const d of u){const f=d.cell.getKey();o.has(f)||o.set(f,{colSpan:d.cell.getColSpan(),startColumn:d.startColumn})}const l=new Set;for(const u of i.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){const d=u.getAttribute("data-temporary-table-cell-lexical-key");if(d){const f=o.get(d);if(u.removeAttribute("data-temporary-table-cell-lexical-key"),f){o.delete(d);for(let h=0;h<f.colSpan;h++)l.add(h+f.startColumn)}}}const a=i.querySelector(":scope > colgroup");if(a){const u=Array.from(i.querySelectorAll(":scope > colgroup > col")).filter((d,f)=>l.has(f));a.replaceChildren(...u)}const c=i.querySelectorAll(":scope > tr");if(c.length>0){const u=document.createElement("tbody");for(const d of c)u.appendChild(d);i.append(u)}return i},element:!Oi(r)&&ne(r)?r.querySelector("table"):r}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:r,domRows:i}=t;for(let s=0;s<r;s++){const o=i[s];if(o!=null)for(let l=0;l<o.length;l++){const a=o[l];if(a==null)continue;const{elem:c}=a,u=xx(this,c);if(u!==null&&e.is(u))return{x:l,y:s}}}throw new Error("Cell not found in table.")}getDOMCellFromCords(e,t,r){const{domRows:i}=r,s=i[t];if(s==null)return null;const o=s[e<s.length?e:s.length-1];return o??null}getDOMCellFromCordsOrThrow(e,t,r){const i=this.getDOMCellFromCords(e,t,r);if(!i)throw new Error("Cell not found at cords.");return i}getCellNodeFromCords(e,t,r){const i=this.getDOMCellFromCords(e,t,r);if(i==null)return null;const s=pt(i.elem);return pe(s)?s:null}getCellNodeFromCordsOrThrow(e,t,r){const i=this.getCellNodeFromCords(e,t,r);if(!i)throw new Error("Node at cords not TableCellNode.");return i}getRowStriping(){return!!this.getLatest().__rowStriping}setRowStriping(e){const t=this.getWritable();return t.__rowStriping=e,t}setFrozenColumns(e){const t=this.getWritable();return t.__frozenColumnCount=e,t}getFrozenColumns(){return this.getLatest().__frozenColumnCount}setFrozenRows(e){const t=this.getWritable();return t.__frozenRowCount=e,t}getFrozenRows(){return this.getLatest().__frozenRowCount}canSelectBefore(){return!0}canIndent(){return!1}getColumnCount(){const e=this.getFirstChild();if(!e)return 0;let t=0;return e.getChildren().forEach(r=>{pe(r)&&(t+=r.getColSpan())}),t}}function Cx(n){const e=xu();n.hasAttribute("data-lexical-row-striping")&&e.setRowStriping(!0),n.hasAttribute("data-lexical-frozen-column")&&e.setFrozenColumns(1),n.hasAttribute("data-lexical-frozen-row")&&e.setFrozenRows(1);const t=n.querySelector(":scope > colgroup");if(t){let r=[];for(const i of t.querySelectorAll(":scope > col")){let s=i.style.width||"";if(!yu.test(s)&&(s=i.getAttribute("width")||"",!/^\d+$/.test(s))){r=void 0;break}r.push(parseFloat(s))}r&&e.setColWidths(r)}return{after:r=>dp(r,st),node:e}}function xu(){return ze(new xr)}function Vt(n){return n instanceof xr}function wx(n){st(n.getParent())?n.isEmpty()&&n.append(H()):n.remove()}function vx(n){Vt(n.getParent())?cp(n,pe):n.remove()}function Ex(n){cp(n,st);const[e]=cn(n,null,null),t=e.reduce((o,l)=>Math.max(o,l.length),0),r=n.getChildren();for(let o=0;o<e.length;++o){const l=r[o];if(!l)continue;st(l)||te(254,l.constructor.name,l.getType());const a=e[o].reduce((c,u)=>u?1+c:c,0);if(a!==t)for(let c=a;c<t;++c){const u=Gt();u.append(H()),l.append(u)}}const i=n.getColWidths(),s=n.getColumnCount();if(i&&i.length!==s){let o;if(s<i.length)o=i.slice(0,s);else if(i.length>0){const l=i[i.length-1];o=[...i,...Array(s-i.length).fill(l)]}n.setColWidths(o)}}function kx(n){if(n.detail<3||!Yn(n.target))return!1;const e=pt(n.target);if(e===null)return!1;const t=le(e,r=>O(r)&&!r.isInline());return t===null?!1:!!pe(t.getParent())&&(t.select(0),!0)}function Tx(){const n=M();if(!N(n))return!1;const e=ac(n.anchor.getNode());if(e===null)return!1;const t=de();if(!t.is(e.getParent())||t.getChildrenSize()!==1)return!1;const[r]=cn(e,null,null);if(r.length===0||r[0].length===0)return!1;const i=r[0][0];if(!i||!i.cell)return!1;const s=r[r.length-1],o=s[s.length-1];if(!o||!o.cell)return!1;const l=_x(e,i.cell,o.cell);return De(l),!0}function Ef(n,e){n.hasNodes([xr])||te(255);const{hasNestedTables:t=Sp(!1)}=e??{};return mt(n.registerCommand(As,r=>(function({rows:i,columns:s,includeHeaders:o},l){const a=M()||Sn();if(!a||!N(a)||!l&&ac(a.anchor.getNode()))return!1;const c=cx(Number(i),Number(s),o);xb(c);const u=c.getFirstDescendant();return L(u)&&u.select(),!0})(r,t.peek()),B),n.registerCommand(Oc,(r,i)=>{if(n!==i)return!1;if((function(l){const{nodes:a,selection:c}=l,u=c.getStartEndPoints(),d=Ir(c),f=N(c),h=f&&le(c.anchor.getNode(),j=>pe(j))!==null&&le(c.focus.getNode(),j=>pe(j))!==null||d;if(a.length!==1||!Vt(a[0])||!h||u===null)return!1;const[g,p]=u,[m,b,_]=yt(g),y=le(p.getNode(),j=>pe(j));if(!(pe(m)&&pe(y)&&st(b)&&Vt(_)))return!1;const C=a[0],[S,w,x]=wn(_,m,y),[T]=cn(C,null,null),E=S.length,I=E>0?S[0].length:0;let $=w.startRow,k=w.startColumn,D=T.length,K=D>0?T[0].length:0;if(d){const j=Dp(S,w,x),Se=j.maxRow-j.minRow+1,fe=j.maxColumn-j.minColumn+1;$=j.minRow,k=j.minColumn,D=Math.min(D,Se),K=Math.min(K,fe)}let F=!1;const W=Math.min(E,$+D)-1,G=Math.min(I,k+K)-1,J=new Set;for(let j=$;j<=W;j++)for(let Se=k;Se<=G;Se++){const fe=S[j][Se];J.has(fe.cell.getKey())||fe.cell.__rowSpan===1&&fe.cell.__colSpan===1||(px(fe.cell),J.add(fe.cell.getKey()),F=!0)}let[oe]=cn(_.getWritable(),null,null);const He=D-E+$;for(let j=0;j<He;j++)oc(oe[E-1][0].cell);const Tt=K-I+k;for(let j=0;j<Tt;j++)lc(oe[0][I-1].cell,!0,!1);[oe]=cn(_.getWritable(),null,null);for(let j=$;j<$+D;j++)for(let Se=k;Se<k+K;Se++){const fe=j-$,et=Se-k,Ee=T[fe][et];if(Ee.startRow!==fe||Ee.startColumn!==et)continue;const Je=Ee.cell;if(Je.__rowSpan!==1||Je.__colSpan!==1){const ke=[],Qt=Math.min(j+Je.__rowSpan,$+D)-1,A=Math.min(Se+Je.__colSpan,k+K)-1;for(let P=j;P<=Qt;P++)for(let X=Se;X<=A;X++){const Te=oe[P][X];ke.push(Te.cell)}hx(ke),F=!0}const{cell:tt}=oe[j][Se],V=tt.getChildren();Je.getChildren().forEach(ke=>{L(ke)&&H().append(ke),tt.append(ke)}),V.forEach(ke=>ke.remove())}if(d&&F){const[j]=cn(_.getWritable(),null,null);j[w.startRow][w.startColumn].cell.selectEnd()}return!0})(r))return!0;const{selection:s,nodes:o}=r;return t.peek()||n!==i||!N(s)?!1:ac(s.anchor.getNode())!==null&&o.some(Vt)},B),n.registerCommand(Qr,Tx,q),n.registerCommand(Sr,kx,B),n.registerNodeTransform(xr,Ex),n.registerNodeTransform(Ci,vx),n.registerNodeTransform(Mr,wx))}const Nx=new Set(["http:","https:","mailto:","sms:","tel:"]);class $r extends xe{__url;__target;__rel;__title;static getType(){return"link"}static clone(e){return new $r(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e="",t={},r){super(r);const{target:i=null,rel:s=null,title:o=null}=t;this.__url=e,this.__target=i,this.__rel=s,this.__title=o}createDOM(e){const t=document.createElement("a");return this.updateLinkDOM(null,t,e),me(t,e.theme.link),t}updateLinkDOM(e,t,r){if(su(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(const i of["target","rel","title"]){const s=`__${i}`,o=this[s];e&&e[s]===o||(o?t[i]=o:t.removeAttribute(i))}}}updateDOM(e,t,r){return this.updateLinkDOM(e,t,r),!1}static importDOM(){return{a:e=>({conversion:Ax,priority:1})}}static importJSON(e){return sr().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=Nf(e);try{const t=new URL(Nf(e));if(!Nx.has(t.protocol))return"about:blank"}catch{return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){const t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){const t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){const t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){const t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){const r=sr(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(r,t),r}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,r){if(!N(t))return!1;const i=t.anchor.getNode(),s=t.focus.getNode();return this.isParentOf(i)&&this.isParentOf(s)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function Ax(n){let e=null;if(su(n)){const t=n.textContent;(t!==null&&t!==""||n.children.length>0)&&(e=sr(n.getAttribute("href")||"",{rel:n.getAttribute("rel"),target:n.getAttribute("target"),title:n.getAttribute("title")}))}return{node:e}}function sr(n="",e){return ze(new $r(n,e))}function Tn(n){return n instanceof $r}let Su=class Bp extends $r{__isUnlinked;constructor(e="",t={},r){super(e,t,r),this.__isUnlinked=t.isUnlinked!==void 0&&t.isUnlinked!==null&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new Bp(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,r){return super.updateDOM(e,t,r)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return kf().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){const r=this.getParentOrThrow().insertNewAfter(e,t);if(O(r)){const i=kf(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return r.append(i),i}return null}};function kf(n="",e){return ze(new Su(n,e))}function Ri(n){return n instanceof Su}const cc=U("TOGGLE_LINK_COMMAND");function Tf(n,e){if(n.type==="element"){const t=n.getNode();return O(t)||(function(r,...i){const s=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",r);for(const l of i)o.append("v",l);throw s.search=o.toString(),Error(`Minified Lexical error #${r}; visit ${s.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)})(252),t.getChildren()[n.offset+e]||null}return null}function Ox(n,e={}){let t;if(n&&typeof n=="object"){const{url:u,...d}=n;t=u,e={...d,...e}}else t=n;const{target:r,title:i}=e,s=e.rel===void 0?"noreferrer":e.rel,o=M();if(o===null||!N(o)&&!Ge(o))return;if(Ge(o)){const u=o.getNodes();return u.length===0?void 0:void u.forEach(d=>{if(t===null){const f=le(d,h=>!Ri(h)&&Tn(h));f&&(f.insertBefore(d),f.getChildren().length===0&&f.remove())}else{const f=le(d,h=>!Ri(h)&&Tn(h));if(f)f.setURL(t),r!==void 0&&f.setTarget(r),s!==void 0&&f.setRel(s);else{const h=sr(t,{rel:s,target:r});d.insertBefore(h),h.append(d)}}})}const l=o.extract();if(t===null){const u=new Set;return void l.forEach(d=>{const f=le(d,h=>!Ri(h)&&Tn(h));if(f!==null){const h=f.getKey();if(u.has(h))return;(function(g,p){const m=new Set(p.filter(T=>g.isParentOf(T)).map(T=>T.getKey())),b=g.getChildren(),_=T=>m.has(T.getKey())||O(T)&&p.some(E=>g.isParentOf(E)&&T.isParentOf(E)),y=b.filter(_);if(y.length===b.length)return b.forEach(T=>g.insertBefore(T)),void g.remove();const C=b.findIndex(_),S=b.findLastIndex(_),w=C===0,x=S===b.length-1;if(w)y.forEach(T=>g.insertBefore(T));else if(x)for(let T=y.length-1;T>=0;T--)g.insertAfter(y[T]);else{for(let E=y.length-1;E>=0;E--)g.insertAfter(y[E]);const T=b.slice(S+1);if(T.length>0){const E=sr(g.getURL(),{rel:g.getRel(),target:g.getTarget(),title:g.getTitle()});y[y.length-1].insertAfter(E),T.forEach(I=>E.append(I))}}})(f,l),u.add(h)}})}const a=new Set,c=u=>{a.has(u.getKey())||(a.add(u.getKey()),u.setURL(t),r!==void 0&&u.setTarget(r),s!==void 0&&u.setRel(s),i!==void 0&&u.setTitle(i))};if(l.length===1){const u=l[0],d=le(u,Tn);if(d!==null)return c(d)}(function(u){const d=M();if(!N(d))return u();const f=Rn(d),h=f.isBackward(),g=Tf(f.anchor,h?-1:0),p=Tf(f.focus,h?0:-1);if(u(),g||p){const m=M();if(N(m)){const b=m.clone();if(g){const _=g.getParent();_&&b.anchor.set(_.getKey(),g.getIndexWithinParent()+(h?1:0),"element")}if(p){const _=p.getParent();_&&b.focus.set(_.getKey(),p.getIndexWithinParent()+(h?0:1),"element")}De(Rn(b))}}})(()=>{let u=null;for(const d of l){if(!d.isAttached())continue;const f=le(d,Tn);if(f){c(f);continue}if(O(d)){if(!d.isInline())continue;if(Tn(d)){if(!(Ri(d)||u!==null&&u.getParentOrThrow().isParentOf(d))){c(d),u=d;continue}for(const g of d.getChildren())d.insertBefore(g);d.remove();continue}}const h=d.getPreviousSibling();Tn(h)&&h.is(u)?h.append(d):(u=sr(t,{rel:s,target:r,title:i}),d.insertAfter(u),u.append(d))}})}const Mx=/^\+?[0-9\s()-]{5,}$/;function Nf(n){return n.match(/^[a-z][a-z0-9+.-]*:/i)||n.match(/^[/#.]/)?n:n.includes("@")?`mailto:${n}`:Mx.test(n)?`tel:${n}`:`https://${n}`}const ha=Ox;var ga={exports:{}},Af;function Ix(){return Af||(Af=1,(function(n){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var t=(function(r){var i=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,s=0,o={},l={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function _(y){return y instanceof a?new a(y.type,_(y.content),y.alias):Array.isArray(y)?y.map(_):y.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(_){return Object.prototype.toString.call(_).slice(8,-1)},objId:function(_){return _.__id||Object.defineProperty(_,"__id",{value:++s}),_.__id},clone:function _(y,C){C=C||{};var S,w;switch(l.util.type(y)){case"Object":if(w=l.util.objId(y),C[w])return C[w];S={},C[w]=S;for(var x in y)y.hasOwnProperty(x)&&(S[x]=_(y[x],C));return S;case"Array":return w=l.util.objId(y),C[w]?C[w]:(S=[],C[w]=S,y.forEach(function(T,E){S[E]=_(T,C)}),S);default:return y}},getLanguage:function(_){for(;_;){var y=i.exec(_.className);if(y)return y[1].toLowerCase();_=_.parentElement}return"none"},setLanguage:function(_,y){_.className=_.className.replace(RegExp(i,"gi"),""),_.classList.add("language-"+y)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(S){var _=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(S.stack)||[])[1];if(_){var y=document.getElementsByTagName("script");for(var C in y)if(y[C].src==_)return y[C]}return null}},isActive:function(_,y,C){for(var S="no-"+y;_;){var w=_.classList;if(w.contains(y))return!0;if(w.contains(S))return!1;_=_.parentElement}return!!C}},languages:{plain:o,plaintext:o,text:o,txt:o,extend:function(_,y){var C=l.util.clone(l.languages[_]);for(var S in y)C[S]=y[S];return C},insertBefore:function(_,y,C,S){S=S||l.languages;var w=S[_],x={};for(var T in w)if(w.hasOwnProperty(T)){if(T==y)for(var E in C)C.hasOwnProperty(E)&&(x[E]=C[E]);C.hasOwnProperty(T)||(x[T]=w[T])}var I=S[_];return S[_]=x,l.languages.DFS(l.languages,function($,k){k===I&&$!=_&&(this[$]=x)}),x},DFS:function _(y,C,S,w){w=w||{};var x=l.util.objId;for(var T in y)if(y.hasOwnProperty(T)){C.call(y,T,y[T],S||T);var E=y[T],I=l.util.type(E);I==="Object"&&!w[x(E)]?(w[x(E)]=!0,_(E,C,null,w)):I==="Array"&&!w[x(E)]&&(w[x(E)]=!0,_(E,C,T,w))}}},plugins:{},highlightAll:function(_,y){l.highlightAllUnder(document,_,y)},highlightAllUnder:function(_,y,C){var S={callback:C,container:_,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",S),S.elements=Array.prototype.slice.apply(S.container.querySelectorAll(S.selector)),l.hooks.run("before-all-elements-highlight",S);for(var w=0,x;x=S.elements[w++];)l.highlightElement(x,y===!0,S.callback)},highlightElement:function(_,y,C){var S=l.util.getLanguage(_),w=l.languages[S];l.util.setLanguage(_,S);var x=_.parentElement;x&&x.nodeName.toLowerCase()==="pre"&&l.util.setLanguage(x,S);var T=_.textContent,E={element:_,language:S,grammar:w,code:T};function I(k){E.highlightedCode=k,l.hooks.run("before-insert",E),E.element.innerHTML=E.highlightedCode,l.hooks.run("after-highlight",E),l.hooks.run("complete",E),C&&C.call(E.element)}if(l.hooks.run("before-sanity-check",E),x=E.element.parentElement,x&&x.nodeName.toLowerCase()==="pre"&&!x.hasAttribute("tabindex")&&x.setAttribute("tabindex","0"),!E.code){l.hooks.run("complete",E),C&&C.call(E.element);return}if(l.hooks.run("before-highlight",E),!E.grammar){I(l.util.encode(E.code));return}if(y&&r.Worker){var $=new Worker(l.filename);$.onmessage=function(k){I(k.data)},$.postMessage(JSON.stringify({language:E.language,code:E.code,immediateClose:!0}))}else I(l.highlight(E.code,E.grammar,E.language))},highlight:function(_,y,C){var S={code:_,grammar:y,language:C};if(l.hooks.run("before-tokenize",S),!S.grammar)throw new Error('The language "'+S.language+'" has no grammar.');return S.tokens=l.tokenize(S.code,S.grammar),l.hooks.run("after-tokenize",S),a.stringify(l.util.encode(S.tokens),S.language)},tokenize:function(_,y){var C=y.rest;if(C){for(var S in C)y[S]=C[S];delete y.rest}var w=new d;return f(w,w.head,_),u(_,w,y,w.head,0),g(w)},hooks:{all:{},add:function(_,y){var C=l.hooks.all;C[_]=C[_]||[],C[_].push(y)},run:function(_,y){var C=l.hooks.all[_];if(!(!C||!C.length))for(var S=0,w;w=C[S++];)w(y)}},Token:a};r.Prism=l;function a(_,y,C,S){this.type=_,this.content=y,this.alias=C,this.length=(S||"").length|0}a.stringify=function _(y,C){if(typeof y=="string")return y;if(Array.isArray(y)){var S="";return y.forEach(function(I){S+=_(I,C)}),S}var w={type:y.type,content:_(y.content,C),tag:"span",classes:["token",y.type],attributes:{},language:C},x=y.alias;x&&(Array.isArray(x)?Array.prototype.push.apply(w.classes,x):w.classes.push(x)),l.hooks.run("wrap",w);var T="";for(var E in w.attributes)T+=" "+E+'="'+(w.attributes[E]||"").replace(/"/g,""")+'"';return"<"+w.tag+' class="'+w.classes.join(" ")+'"'+T+">"+w.content+"</"+w.tag+">"};function c(_,y,C,S){_.lastIndex=y;var w=_.exec(C);if(w&&S&&w[1]){var x=w[1].length;w.index+=x,w[0]=w[0].slice(x)}return w}function u(_,y,C,S,w,x){for(var T in C)if(!(!C.hasOwnProperty(T)||!C[T])){var E=C[T];E=Array.isArray(E)?E:[E];for(var I=0;I<E.length;++I){if(x&&x.cause==T+","+I)return;var $=E[I],k=$.inside,D=!!$.lookbehind,K=!!$.greedy,F=$.alias;if(K&&!$.pattern.global){var W=$.pattern.toString().match(/[imsuy]*$/)[0];$.pattern=RegExp($.pattern.source,W+"g")}for(var G=$.pattern||$,J=S.next,oe=w;J!==y.tail&&!(x&&oe>=x.reach);oe+=J.value.length,J=J.next){var He=J.value;if(y.length>_.length)return;if(!(He instanceof a)){var Tt=1,j;if(K){if(j=c(G,oe,_,D),!j||j.index>=_.length)break;var Ee=j.index,Se=j.index+j[0].length,fe=oe;for(fe+=J.value.length;Ee>=fe;)J=J.next,fe+=J.value.length;if(fe-=J.value.length,oe=fe,J.value instanceof a)continue;for(var et=J;et!==y.tail&&(fe<Se||typeof et.value=="string");et=et.next)Tt++,fe+=et.value.length;Tt--,He=_.slice(oe,fe),j.index-=oe}else if(j=c(G,0,He,D),!j)continue;var Ee=j.index,Je=j[0],tt=He.slice(0,Ee),V=He.slice(Ee+Je.length),ke=oe+He.length;x&&ke>x.reach&&(x.reach=ke);var Qt=J.prev;tt&&(Qt=f(y,Qt,tt),oe+=tt.length),h(y,Qt,Tt);var A=new a(T,k?l.tokenize(Je,k):Je,F,Je);if(J=f(y,Qt,A),V&&f(y,J,V),Tt>1){var P={cause:T+","+I,reach:ke};u(_,y,C,J.prev,oe,P),x&&P.reach>x.reach&&(x.reach=P.reach)}}}}}}function d(){var _={value:null,prev:null,next:null},y={value:null,prev:_,next:null};_.next=y,this.head=_,this.tail=y,this.length=0}function f(_,y,C){var S=y.next,w={value:C,prev:y,next:S};return y.next=w,S.prev=w,_.length++,w}function h(_,y,C){for(var S=y.next,w=0;w<C&&S!==_.tail;w++)S=S.next;y.next=S,S.prev=y,_.length-=w}function g(_){for(var y=[],C=_.head.next;C!==_.tail;)y.push(C.value),C=C.next;return y}if(!r.document)return r.addEventListener&&(l.disableWorkerMessageHandler||r.addEventListener("message",function(_){var y=JSON.parse(_.data),C=y.language,S=y.code,w=y.immediateClose;r.postMessage(l.highlight(S,l.languages[C],C)),w&&r.close()},!1)),l;var p=l.util.currentScript();p&&(l.filename=p.src,p.hasAttribute("data-manual")&&(l.manual=!0));function m(){l.manual||l.highlightAll()}if(!l.manual){var b=document.readyState;b==="loading"||b==="interactive"&&p&&p.defer?document.addEventListener("DOMContentLoaded",m):window.requestAnimationFrame?window.requestAnimationFrame(m):window.setTimeout(m,16)}return l})(e);n.exports&&(n.exports=t),typeof Zu.commonjsGlobal<"u"&&(Zu.commonjsGlobal.Prism=t),t.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},t.languages.markup.tag.inside["attr-value"].inside.entity=t.languages.markup.entity,t.languages.markup.doctype.inside["internal-subset"].inside=t.languages.markup,t.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.replace(/&/,"&"))}),Object.defineProperty(t.languages.markup.tag,"addInlined",{value:function(i,s){var o={};o["language-"+s]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:t.languages[s]},o.cdata=/^<!\[CDATA\[|\]\]>$/i;var l={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:o}};l["language-"+s]={pattern:/[\s\S]+/,inside:t.languages[s]};var a={};a[i]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return i}),"i"),lookbehind:!0,greedy:!0,inside:l},t.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(t.languages.markup.tag,"addAttribute",{value:function(r,i){t.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[i,"language-"+i],inside:t.languages[i]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),t.languages.html=t.languages.markup,t.languages.mathml=t.languages.markup,t.languages.svg=t.languages.markup,t.languages.xml=t.languages.extend("markup",{}),t.languages.ssml=t.languages.xml,t.languages.atom=t.languages.xml,t.languages.rss=t.languages.xml,(function(r){var i=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+i.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+i.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+i.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+i.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:i,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var s=r.languages.markup;s&&(s.tag.addInlined("style","css"),s.tag.addAttribute("style","css"))})(t),t.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},t.languages.javascript=t.languages.extend("clike",{"class-name":[t.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),t.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,t.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:t.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:t.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:t.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:t.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:t.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),t.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:t.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),t.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),t.languages.markup&&(t.languages.markup.tag.addInlined("script","javascript"),t.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),t.languages.js=t.languages.javascript,(function(){if(typeof t>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var r="Loading…",i=function(p,m){return"✖ Error "+p+" while fetching file: "+m},s="✖ Error: File does not exist or is empty",o={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",a="loading",c="loaded",u="failed",d="pre[data-src]:not(["+l+'="'+c+'"]):not(['+l+'="'+a+'"])';function f(p,m,b){var _=new XMLHttpRequest;_.open("GET",p,!0),_.onreadystatechange=function(){_.readyState==4&&(_.status<400&&_.responseText?m(_.responseText):_.status>=400?b(i(_.status,_.statusText)):b(s))},_.send(null)}function h(p){var m=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(p||"");if(m){var b=Number(m[1]),_=m[2],y=m[3];return _?y?[b,Number(y)]:[b,void 0]:[b,b]}}t.hooks.add("before-highlightall",function(p){p.selector+=", "+d}),t.hooks.add("before-sanity-check",function(p){var m=p.element;if(m.matches(d)){p.code="",m.setAttribute(l,a);var b=m.appendChild(document.createElement("CODE"));b.textContent=r;var _=m.getAttribute("data-src"),y=p.language;if(y==="none"){var C=(/\.(\w+)$/.exec(_)||[,"none"])[1];y=o[C]||C}t.util.setLanguage(b,y),t.util.setLanguage(m,y);var S=t.plugins.autoloader;S&&S.loadLanguages(y),f(_,function(w){m.setAttribute(l,c);var x=h(m.getAttribute("data-range"));if(x){var T=w.split(/\r\n?|\n/g),E=x[0],I=x[1]==null?T.length:x[1];E<0&&(E+=T.length),E=Math.max(0,Math.min(E-1,T.length)),I<0&&(I+=T.length),I=Math.max(0,Math.min(I,T.length)),w=T.slice(E,I).join(`
|
|
15
|
+
`),m.hasAttribute("data-start")||m.setAttribute("data-start",String(E+1))}b.textContent=w,t.highlightElement(b)},function(w){m.setAttribute(l,u),b.textContent=w})}}),t.plugins.fileHighlight={highlight:function(m){for(var b=(m||document).querySelectorAll(d),_=0,y;y=b[_++];)t.highlightElement(y)}};var g=!1;t.fileHighlight=function(){g||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),g=!0),t.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(ga)),ga.exports}Ix();Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;Prism.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]};Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity;Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup;Prism.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.replace(/&/,"&"))});Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var r={};r["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[t]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};i["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var s={};s[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:i},Prism.languages.insertBefore("markup","cdata",s)}});Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(n,e){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:Prism.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}});Prism.languages.html=Prism.languages.markup;Prism.languages.mathml=Prism.languages.markup;Prism.languages.svg=Prism.languages.markup;Prism.languages.xml=Prism.languages.extend("markup",{});Prism.languages.ssml=Prism.languages.xml;Prism.languages.atom=Prism.languages.xml;Prism.languages.rss=Prism.languages.xml;(function(n){var e=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function t(u){return u=u.replace(/<inner>/g,function(){return e}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+u+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,i=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return r}),s=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;n.languages.markdown=n.languages.extend("markup",{}),n.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:n.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+i+s+"(?:"+i+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+i+s+")(?:"+i+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:n.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+i+")"+s+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+i+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:n.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:t(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:t(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:t(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:t(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(u){["url","bold","italic","strike","code-snippet"].forEach(function(d){u!==d&&(n.languages.markdown[u].inside.content.inside[d]=n.languages.markdown[d])})}),n.hooks.add("after-tokenize",function(u){if(u.language!=="markdown"&&u.language!=="md")return;function d(f){if(!(!f||typeof f=="string"))for(var h=0,g=f.length;h<g;h++){var p=f[h];if(p.type!=="code"){d(p.content);continue}var m=p.content[1],b=p.content[3];if(m&&b&&m.type==="code-language"&&b.type==="code-block"&&typeof m.content=="string"){var _=m.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");_=(/[a-z][\w-]*/i.exec(_)||[""])[0].toLowerCase();var y="language-"+_;b.alias?typeof b.alias=="string"?b.alias=[b.alias,y]:b.alias.push(y):b.alias=[y]}}}d(u.tokens)}),n.hooks.add("wrap",function(u){if(u.type==="code-block"){for(var d="",f=0,h=u.classes.length;f<h;f++){var g=u.classes[f],p=/language-(.+)/.exec(g);if(p){d=p[1];break}}var m=n.languages[d];if(m)u.content=n.highlight(c(u.content),m,d);else if(d&&d!=="none"&&n.plugins.autoloader){var b="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);u.attributes.id=b,n.plugins.autoloader.loadLanguages(d,function(){var _=document.getElementById(b);_&&(_.innerHTML=n.highlight(_.textContent,n.languages[d],d))})}}});var o=RegExp(n.languages.markup.tag.pattern.source,"gi"),l={amp:"&",lt:"<",gt:">",quot:'"'},a=String.fromCodePoint||String.fromCharCode;function c(u){var d=u.replace(o,"");return d=d.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(f,h){if(h=h.toLowerCase(),h[0]==="#"){var g;return h[1]==="x"?g=parseInt(h.slice(2),16):g=Number(h.slice(1)),a(g)}else{var p=l[h];return p||f}}),d}n.languages.md=n.languages.markdown})(Prism);Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/});Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}});Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}});Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/});delete Prism.languages.c.boolean;(function(n){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var t=n.languages.markup;t&&(t.tag.addInlined("style","css"),t.tag.addAttribute("style","css"))})(Prism);Prism.languages.objectivec=Prism.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/});delete Prism.languages.objectivec["class-name"];Prism.languages.objc=Prism.languages.objectivec;Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};(function(n){var e=n.languages.powershell={comment:[{pattern:/(^|[^`])<#[\s\S]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(?:`[\s\S]|[^`"])*"/,greedy:!0,inside:null},{pattern:/'(?:[^']|'')*'/,greedy:!0}],namespace:/\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,boolean:/\$(?:false|true)\b/i,variable:/\$\w+\b/,function:[/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/};e.string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:e},boolean:e.boolean,variable:e.variable}})(Prism);var Of={},Mf;function $x(){return Mf||(Mf=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),Of}$x();var If={},$f;function Fx(){return $f||($f=1,(function(n){for(var e=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,t=0;t<2;t++)e=e.replace(/<self>/g,function(){return e});e=e.replace(/<self>/g,function(){return/[^\s\S]/.source}),n.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+e),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},n.languages.rust["closure-params"].inside.rest=n.languages.rust,n.languages.rust.attribute.inside.string=n.languages.rust.string})(Prism)),If}Fx();Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/};Prism.languages.swift["string-literal"].forEach(function(n){n.inside.interpolation.inside=Prism.languages.swift});var Ff={},Lf;function Lx(){return Lf||(Lf=1,(function(n){n.languages.typescript=n.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),n.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete n.languages.typescript.parameter,delete n.languages.typescript["literal-property"];var e=n.languages.extend("typescript",{});delete e["class-name"],n.languages.typescript["class-name"].inside=e,n.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e}}}}),n.languages.ts=n.languages.typescript})(Prism)),Ff}Lx();var Rf={},Df;function Rx(){return Df||(Df=1,(function(n){var e=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,t=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+t+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};n.languages.java=n.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+t+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+t+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:e,function:[n.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),n.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),n.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+t+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+t+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism)),Rf}Rx();var Pf={},zf;function Dx(){return zf||(zf=1,(function(n){var e=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,t=/\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g,function(){return e.source});n.languages.cpp=n.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:e,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),n.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g,function(){return t})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),n.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n.languages.cpp}}}}),n.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),n.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:n.languages.extend("cpp",{})}}),n.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},n.languages.cpp["base-clause"])})(Prism)),Pf}Dx();function Sl(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 Px="javascript";function Up(n,e){for(const t of n.childNodes){if(ne(t)&&t.tagName===e)return!0;Up(t,e)}return!1}const Di="data-language",Mi="data-highlight-language",Js="data-theme";let or=class Kp extends xe{__language;__theme;__isSyntaxHighlightSupported;static getType(){return"code"}static clone(e){return new Kp(e.__language,e.__key)}constructor(e,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){const t=document.createElement("code");me(t,e.theme.code),t.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(t.setAttribute(Di,r),this.getIsSyntaxHighlightSupported()&&t.setAttribute(Mi,r));const i=this.getTheme();i&&t.setAttribute(Js,i);const s=this.getStyle();return s&&t.setAttribute("style",s),t}updateDOM(e,t,r){const i=this.__language,s=e.__language;i?i!==s&&t.setAttribute(Di,i):s&&t.removeAttribute(Di);const o=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&s?o&&i?i!==s&&t.setAttribute(Mi,i):t.removeAttribute(Mi):o&&i&&t.setAttribute(Mi,i);const l=this.__theme,a=e.__theme;l?l!==a&&t.setAttribute(Js,l):a&&t.removeAttribute(Js);const c=this.__style,u=e.__style;return c?c!==u&&t.setAttribute("style",c):u&&t.removeAttribute("style"),!1}exportDOM(e){const t=document.createElement("pre");me(t,e._config.theme.code),t.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(t.setAttribute(Di,r),this.getIsSyntaxHighlightSupported()&&t.setAttribute(Mi,r));const i=this.getTheme();i&&t.setAttribute(Js,i);const s=this.getStyle();return s&&t.setAttribute("style",s),{element:t}}static importDOM(){return{code:e=>e.textContent!=null&&(/\r?\n/.test(e.textContent)||Up(e,"BR"))?{conversion:Bf,priority:1}:null,div:()=>({conversion:zx,priority:1}),pre:()=>({conversion:Bf,priority:0}),table:e=>pa(e)?{conversion:Bx,priority:3}:null,td:e=>{const t=e,r=t.closest("table");return t.classList.contains("js-file-line")||r&&pa(r)?{conversion:Uf,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&pa(t)?{conversion:Uf,priority:3}:null}}}static importJSON(e){return St().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,t=!0){const r=this.getChildren(),i=r.length;if(i>=2&&r[i-1].getTextContent()===`
|
|
16
16
|
`&&r[i-2].getTextContent()===`
|
|
17
|
-
`&&e.isCollapsed()&&e.anchor.key===this.__key&&e.anchor.offset===i){r[i-1].remove(),r[i-2].remove();const a=
|
|
17
|
+
`&&e.isCollapsed()&&e.anchor.key===this.__key&&e.anchor.offset===i){r[i-1].remove(),r[i-2].remove();const a=H();return this.insertAfter(a,t),a}const{anchor:s,focus:o}=e,l=(s.isBefore(o)?s:o).getNode();if(L(l)){let a=lr(l);const c=[];for(;;)if(Ye(a))c.push(Ct()),a=a.getNextSibling();else{if(!Ce(a))break;{let m=0;const b=a.getTextContent(),_=a.getTextContentSize();for(;m<_&&b[m]===" ";)m++;if(m!==0&&c.push(Cu(" ".repeat(m))),m!==_)break;a=a.getNextSibling()}}const u=l.splitText(s.offset)[0],d=s.offset===0?0:1,f=u.getIndexWithinParent()+d,h=l.getParentOrThrow(),g=[ut(),...c];h.splice(f,0,g);const p=c[c.length-1];p?p.select():s.offset===0?u.selectPrevious():u.getNextSibling().selectNext(0,0)}if(Lt(l)){const{offset:a}=e.anchor;l.splice(a,0,[ut()]),l.select(a+1,a+1)}return null}canIndent(){return!1}collapseAtStart(){const e=H();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){const t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){const t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}};function St(n,e){return Gg(or).setLanguage(n).setTheme(e)}function Lt(n){return n instanceof or}function Bf(n){return{node:St(n.getAttribute(Di))}}function zx(n){const e=n,t=Kf(e);return t||(function(r){let i=r.parentElement;for(;i!==null;){if(Kf(i))return!0;i=i.parentElement}return!1})(e)?{node:t?St():null}:{node:null}}function Bx(){return{node:St()}}function Uf(){return{node:null}}function Kf(n){return n.style.fontFamily.match("monospace")!==null}function pa(n){return n.classList.contains("js-file-line-container")}let os=class Wp extends Qe{__highlightType;constructor(e="",t,r){super(e,r),this.__highlightType=t}static getType(){return"code-highlight"}static clone(e){return new Wp(e.__text,e.__highlightType||void 0,e.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){const t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){const t=super.createDOM(e),r=ma(e.theme,this.__highlightType);return me(t,r),t}updateDOM(e,t,r){const i=super.updateDOM(e,t,r),s=ma(r.theme,e.__highlightType),o=ma(r.theme,this.__highlightType);return s!==o&&(s&&fn(t,s),o&&me(t,o)),i}static importJSON(e){return Cu().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return St()}};function ma(n,e){return e&&n&&n.codeHighlight&&n.codeHighlight[e]}function Cu(n="",e){return ze(new os(n,e))}function Ce(n){return n instanceof os}function jp(n,e){let t=n;for(let r=be(n,e);r&&(Ce(r.origin)||Ye(r.origin));r=_b(r))t=r.origin;return t}function lr(n){return jp(n,"previous")}function qr(n){return jp(n,"next")}function Ux(n){const e=lr(n),t=qr(n);let r=e;for(;r!==null;){if(Ce(r)){const s=Og(r.getTextContent());if(s!==null)return s}if(r===t)break;r=r.getNextSibling()}const i=e.getParent();if(O(i)){const s=i.getDirection();if(s==="ltr"||s==="rtl")return s}return null}function Kx(n,e){let t=null,r=null,i=n,s=e,o=n.getTextContent();for(;;){if(s===0){if(i=i.getPreviousSibling(),i===null)break;if(Ce(i)||Ye(i)||ue(i)||Sl(167),ue(i)){t={node:i,offset:1};break}s=Math.max(0,i.getTextContentSize()-1),o=i.getTextContent()}else s--;const a=o[s];Ce(i)&&a!==" "&&(r={node:i,offset:s})}if(r!==null)return r;let l=null;if(e<n.getTextContentSize())Ce(n)&&(l=n.getTextContent()[e]);else{const a=n.getNextSibling();Ce(a)&&(l=a.getTextContent()[0])}if(l!==null&&l!==" ")return t;{const a=(function(c,u){let d=c,f=u,h=c.getTextContent(),g=c.getTextContentSize();for(;;){if(!Ce(d)||f===g){if(d=d.getNextSibling(),d===null||ue(d))return null;Ce(d)&&(f=0,h=d.getTextContent(),g=d.getTextContentSize())}if(Ce(d)){if(h[f]!==" ")return{node:d,offset:f};f++}}})(n,e);return a!==null?a:t}}function Wx(n){const e=qr(n);return ue(e)&&Sl(168),e}(function(n){n.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var e={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(e).forEach(function(t){var r=e[t],i=[];/^\w+$/.test(t)||i.push(/\w+/.exec(t)[0]),t==="diff"&&i.push("bold"),n.languages.diff[t]={pattern:RegExp("^(?:["+r+`].*(?:\r
|
|
18
18
|
?|
|
|
19
|
-
|(?![\\s\\S])))+`,"m"),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(t)[0]}}}}),Object.defineProperty(n.languages.diff,"PREFIXES",{value:e})})(Prism);const
|
|
19
|
+
|(?![\\s\\S])))+`,"m"),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(t)[0]}}}}),Object.defineProperty(n.languages.diff,"PREFIXES",{value:e})})(Prism);const Ut=globalThis.Prism||window.Prism;function uc(n){return typeof n=="string"?n:Array.isArray(n)?n.map(uc).join(""):uc(n.content)}function jx(n,e){const t=/^diff-([\w-]+)/i.exec(e),r=n.getTextContent();let i=Ut.tokenize(r,Ut.languages[t?"diff":e]);return t&&(i=(function(s,o){const l=o,a=Ut.languages[l],c={tokens:s},u=Ut.languages.diff.PREFIXES;for(const d of c.tokens){if(typeof d=="string"||!(d.type in u)||!Array.isArray(d.content))continue;const f=d.type;let h=0;const g=()=>(h++,new Ut.Token("prefix",u[f],f.replace(/^(\w+).*/,"$1"))),p=d.content.filter(S=>typeof S=="string"||S.type!=="prefix"),m=d.content.length-p.length,b=Ut.tokenize(uc(p),a);b.unshift(g());const _=/\r\n|\n/g,y=S=>{const w=[];_.lastIndex=0;let x,T=0;for(;h<m&&(x=_.exec(S));){const E=x.index+x[0].length;w.push(S.slice(T,E)),T=E,w.push(g())}if(w.length!==0)return T<S.length&&w.push(S.slice(T)),w},C=S=>{for(let w=0;w<S.length&&h<m;w++){const x=S[w];if(typeof x=="string"){const T=y(x);T&&(S.splice(w,1,...T),w+=T.length-1)}else if(typeof x.content=="string"){const T=y(x.content);T&&(x.content=T)}else Array.isArray(x.content)?C(x.content):C([x.content])}};C(b),h<m&&b.push(g()),d.content=b}return c.tokens})(i,t[1])),dc(i)}function dc(n,e){const t=[];for(const r of n)if(typeof r=="string"){const i=r.split(/(\n|\t)/),s=i.length;for(let o=0;o<s;o++){const l=i[o];l===`
|
|
20
20
|
`||l===`\r
|
|
21
|
-
`?t.push(
|
|
22
|
-
`+ ++o);t.setAttribute("data-gutter",s)}const
|
|
23
|
-
`){const i=
|
|
24
|
-
`}isInline(){return!1}decorate(){return null}}function
|
|
25
|
-
`):
|
|
26
|
-
`),l=o.length,a=s||de();a.clear();for(let u=0;u<l;u++){const d=o[u],[f,h]=
|
|
27
|
-
`)},
|
|
21
|
+
`?t.push(ut()):l===" "?t.push(Ct()):l.length>0&&t.push(Cu(l,e))}}else{const{content:i,alias:s}=r;typeof i=="string"?t.push(...dc([i],r.type==="prefix"&&typeof s=="string"?s:r.type)):Array.isArray(i)&&t.push(...dc(i,r.type==="unchanged"?void 0:r.type))}return t}const Hx={$tokenize(n,e){return jx(n,e||this.defaultLanguage)},defaultLanguage:Px,tokenize(n,e){return Ut.tokenize(n,Ut.languages[e||""]||Ut.languages[this.defaultLanguage])}};function Wf(n,e,t){const r=n.getParent();Lt(r)?Hp(r,e,t):Ce(n)&&n.replace(he(n.__text))}function Jx(n,e){const t=e.getElementByKey(n.getKey());if(t===null)return;const r=n.getChildren(),i=r.length;if(i===t.__cachedChildrenLength)return;t.__cachedChildrenLength=i;let s="1",o=1;for(let l=0;l<i;l++)ue(r[l])&&(s+=`
|
|
22
|
+
`+ ++o);t.setAttribute("data-gutter",s)}const _a=new Set;function Hp(n,e,t){const r=n.getKey(),i=e.getKey()+"/"+r;n.getLanguage()===void 0&&n.setLanguage(t.defaultLanguage);const s=n.getLanguage()||t.defaultLanguage;if(!(function(o){const l=(function(c){const u=/^diff-([\w-]+)/i.exec(c);return u?u[1]:null})(o),a=l||o;try{return!!a&&Ut.languages.hasOwnProperty(a)}catch{return!1}})(s))return n.getIsSyntaxHighlightSupported()&&n.setIsSyntaxHighlightSupported(!1),void(async function(){})();n.getIsSyntaxHighlightSupported()||n.setIsSyntaxHighlightSupported(!0),_a.has(i)||(_a.add(i),e.update(()=>{(function(o,l){const a=Q(o);if(!Lt(a)||!a.isAttached())return;const c=M();if(!N(c))return void l();const u=c.anchor,d=u.offset,f=u.type==="element"&&ue(a.getChildAtIndex(u.offset-1));let h=0;if(!f){const g=u.getNode();h=d+g.getPreviousSiblings().reduce((p,m)=>p+m.getTextContentSize(),0)}if(l()){if(f)return void u.getNode().select(d,d);a.getChildren().some(g=>{const p=L(g);if(p||ue(g)){const m=g.getTextContentSize();if(p&&m>=h)return g.select(h,h),!0;h-=m}return!1})}})(r,()=>{const o=Q(r);if(!Lt(o)||!o.isAttached())return!1;const l=o.getLanguage()||t.defaultLanguage,a=t.$tokenize(o,l),c=(function(h,g){let p=0;for(;p<h.length&&jf(h[p],g[p]);)p++;const m=h.length,b=g.length,_=Math.min(m,b)-p;let y=0;for(;y<_;)if(y++,!jf(h[m-y],g[b-y])){y--;break}const C=p,S=m-y,w=g.slice(p,b-y);return{from:C,nodesForReplacement:w,to:S}})(o.getChildren(),a),{from:u,to:d,nodesForReplacement:f}=c;return!(u===d&&!f.length)&&(n.splice(u,d-u,f),!0)})},{onUpdate:()=>{_a.delete(i)},skipTransforms:!0}))}function jf(n,e){return Ce(n)&&Ce(e)&&n.__text===e.__text&&n.__highlightType===e.__highlightType||Ye(n)&&Ye(e)||ue(n)&&ue(e)}function ir(n){if(!N(n))return!1;const e=n.anchor.getNode(),t=Lt(e)?e:e.getParent(),r=n.focus.getNode(),i=Lt(r)?r:r.getParent();return Lt(t)&&t.is(i)}function Jp(n){const e=n.getNodes(),t=[];if(e.length===1&&Lt(e[0]))return t;let r=[];for(let i=0;i<e.length;i++){const s=e[i];Ce(s)||Ye(s)||ue(s)||Sl(169),ue(s)?r.length>0&&(t.push(r),r=[]):r.push(s)}if(r.length>0){const i=n.isBackward()?n.anchor:n.focus,s=Me(r[0].getKey(),0,"text");i.is(s)||t.push(r)}return t}function Hf(n){const e=M();if(!N(e)||!ir(e))return!1;const t=Jp(e),r=t.length;if(r===0&&e.isCollapsed())return n===Wt&&e.insertNodes([Ct()]),!0;if(r===0&&n===Wt&&e.getTextContent()===`
|
|
23
|
+
`){const i=Ct(),s=ut(),o=e.isBackward()?"previous":"next";return e.insertNodes([i,s]),ml(_l(qt(gn(i,"next",0),it(be(s,"next"))),o)),!0}for(let i=0;i<r;i++){const s=t[i];if(s.length>0){let o=s[0];if(i===0&&(o=lr(o)),n===Wt){const l=Ct();if(o.insertBefore(l),i===0){const a=e.isBackward()?"focus":"anchor",c=Me(o.getKey(),0,"text");e[a].is(c)&&e[a].set(l.getKey(),0,"text")}}else Ye(o)&&o.remove()}}return!0}function Jf(n,e){const t=M();if(!N(t))return!1;const{anchor:r,focus:i}=t,s=r.offset,o=i.offset,l=r.getNode(),a=i.getNode(),c=n===hn;if(!ir(t)||!Ce(l)&&!Ye(l)||!Ce(a)&&!Ye(a))return!1;if(!e.altKey){if(t.isCollapsed()){const b=l.getParentOrThrow();if(c&&s===0&&l.getPreviousSibling()===null){if(b.getPreviousSibling()===null)return b.selectPrevious(),e.preventDefault(),!0}else if(!c&&s===l.getTextContentSize()&&l.getNextSibling()===null&&b.getNextSibling()===null)return b.selectNext(),e.preventDefault(),!0}return!1}let u,d;if(l.isBefore(a)?(u=lr(l),d=qr(a)):(u=lr(a),d=qr(l)),u==null||d==null)return!1;const f=u.getNodesBetween(d);for(let b=0;b<f.length;b++){const _=f[b];if(!Ce(_)&&!Ye(_)&&!ue(_))return!1}e.preventDefault(),e.stopPropagation();const h=c?u.getPreviousSibling():d.getNextSibling();if(!ue(h))return!0;const g=c?h.getPreviousSibling():h.getNextSibling();if(g==null)return!0;const p=Ce(g)||Ye(g)||ue(g)?c?lr(g):qr(g):null;let m=p??g;return h.remove(),f.forEach(b=>b.remove()),n===hn?(f.forEach(b=>m.insertBefore(b)),m.insertBefore(h)):(m.insertAfter(h),m=h,f.forEach(b=>{m.insertAfter(b),m=b})),t.setTextNodeRange(l,s,a,o),!0}function Gf(n,e){const t=M();if(!N(t))return!1;const{anchor:r,focus:i}=t,s=r.getNode(),o=i.getNode(),l=n===Qi;if(!ir(t)||!Ce(s)&&!Ye(s)||!Ce(o)&&!Ye(o))return!1;const a=o;if(Ux(a)==="rtl"?!l:l){const c=Kx(a,i.offset);if(c!==null){const{node:u,offset:d}=c;ue(u)?u.selectNext(0,0):t.setTextNodeRange(u,d,u,d)}else a.getParentOrThrow().selectStart()}else Wx(a).select();return e.preventDefault(),e.stopPropagation(),!0}function Ro(n,e){if(!n.hasNodes([or,os]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");e==null&&(e=Hx);const t=[];return n._headless!==!0&&t.push(n.registerMutationListener(or,r=>{n.getEditorState().read(()=>{for(const[i,s]of r)if(s!=="destroyed"){const o=Q(i);o!==null&&Jx(o,n)}})},{skipInitialization:!1})),t.push(n.registerNodeTransform(or,r=>Hp(r,n,e)),n.registerNodeTransform(Qe,r=>Wf(r,n,e)),n.registerNodeTransform(os,r=>Wf(r,n,e)),n.registerCommand(xs,r=>{const i=(function(s){const o=M();if(!N(o)||!ir(o))return null;const l=s?ln:Wt,a=s?ln:po,c=o.anchor,u=o.focus;if(c.is(u))return a;const d=Jp(o);if(d.length!==1)return l;const f=d[0];let h,g;f.length===0&&Sl(285),o.isBackward()?(h=u,g=c):(h=c,g=u);const p=lr(f[0]),m=qr(f[0]),b=Me(p.getKey(),0,"text"),_=Me(m.getKey(),m.getTextContentSize(),"text");return h.isBefore(b)||_.isBefore(g)?l:b.isBefore(h)||g.isBefore(_)?a:l})(r.shiftKey);return i!==null&&(r.preventDefault(),n.dispatchCommand(i,void 0),!0)},q),n.registerCommand(po,()=>!!ir(M())&&(il([Ct()]),!0),q),n.registerCommand(Wt,r=>Hf(Wt),q),n.registerCommand(ln,r=>Hf(ln),q),n.registerCommand(hn,r=>{const i=M();if(!N(i))return!1;const{anchor:s}=i,o=s.getNode();return!!ir(i)&&(i.isCollapsed()&&s.offset===0&&o.getPreviousSibling()===null&&Lt(o.getParentOrThrow())?(r.preventDefault(),!0):Jf(hn,r))},q),n.registerCommand(hr,r=>{const i=M();if(!N(i))return!1;const{anchor:s}=i,o=s.getNode();return!!ir(i)&&(i.isCollapsed()&&s.offset===o.getTextContentSize()&&o.getNextSibling()===null&&Lt(o.getParentOrThrow())?(r.preventDefault(),!0):Jf(hr,r))},q),n.registerCommand(Qi,r=>Gf(Qi,r),q),n.registerCommand(go,r=>Gf(go,r),q)),mt(...t)}function Gx(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 Vx(n,e,t,r){const i=o=>o instanceof t,s=o=>{const l=he(o.getTextContent());l.setFormat(o.getFormat()),o.replace(l)};return[n.registerNodeTransform(Qe,o=>{if(!o.isSimpleText())return;let l,a=o.getPreviousSibling(),c=o.getTextContent(),u=o;if(L(a)){const f=a.getTextContent(),h=e(f+c);if(i(a)){if(h===null||(g=>g.getLatest().__mode)(a)!==0)return void s(a);{const g=h.end-f.length;if(g>0){const p=f+c.slice(0,g);if(a.select(),a.setTextContent(p),g===c.length)o.remove();else{const m=c.slice(g);o.setTextContent(m)}return}}}else if(h===null||h.start<f.length)return}let d=0;for(;;){l=e(c);let f,h=l===null?"":c.slice(l.end);if(c=h,h===""){const p=u.getNextSibling();if(L(p)){h=u.getTextContent()+p.getTextContent();const m=e(h);if(m===null)return void(i(p)?s(p):p.markDirty());if(m.start!==0)return}}if(l===null)return;if(l.start===0&&L(a)&&a.isTextEntity()){d+=l.end;continue}l.start===0?[f,u]=u.splitText(l.end):[,f,u]=u.splitText(l.start+d,l.end+d),f===void 0&&Gx(165,"nodeToReplace");const g=r(f);if(g.setFormat(f.getFormat()),f.replace(g),u==null)return;d=0,a=g}}),n.registerNodeTransform(t,o=>{const l=o.getTextContent(),a=e(l);if(a===null||a.start!==0)return void s(o);if(l.length>a.end)return void o.splitText(a.end);const c=o.getPreviousSibling();L(c)&&c.isTextEntity()&&(s(c),s(o));const u=o.getNextSibling();L(u)&&u.isTextEntity()&&(s(u),i(o)&&s(o))})]}let Cl=class Gp extends Qe{static getType(){return"hashtag"}static clone(e){return new Gp(e.__text,e.__key)}createDOM(e){const t=super.createDOM(e);return me(t,e.theme.hashtag),t}static importJSON(e){return Yx().updateFromJSON(e)}canInsertTextBefore(){return!1}isTextEntity(){return!0}};function Yx(n=""){return ze(new Cl(n))}const Vp=[];let wu=class Yp extends xe{__ids;static getType(){return"mark"}static clone(e){return new Yp(e.__ids,e.__key)}static importDOM(){return null}static importJSON(e){return fc().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIDs(e.ids)}exportJSON(){return{...super.exportJSON(),ids:this.getIDs()}}constructor(e=Vp,t){super(t),this.__ids=e}createDOM(e){const t=document.createElement("mark");return me(t,e.theme.mark),this.__ids.length>1&&me(t,e.theme.markOverlap),t}updateDOM(e,t,r){const i=e.__ids,s=this.__ids,o=i.length,l=s.length,a=r.theme.markOverlap;return o!==l&&(o===1?l===2&&me(t,a):l===1&&fn(t,a)),!1}hasID(e){return this.getIDs().includes(e)}getIDs(){return Array.from(this.getLatest().__ids)}setIDs(e){const t=this.getWritable();return t.__ids=e,t}addID(e){const t=this.getWritable();return t.__ids.includes(e)?t:t.setIDs([...t.__ids,e])}deleteID(e){const t=this.getWritable(),r=t.__ids.indexOf(e);if(r===-1)return t;const i=Array.from(t.__ids);return i.splice(r,1),t.setIDs(i)}insertNewAfter(e,t=!0){const r=fc(this.__ids);return this.insertAfter(r,t),r}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,r){if(!N(t)||r==="html")return!1;const i=t.anchor,s=t.focus,o=i.getNode(),l=s.getNode(),a=t.isBackward()?i.offset-s.offset:s.offset-i.offset;return this.isParentOf(o)&&this.isParentOf(l)&&this.getTextContent().length===a}excludeFromCopy(e){return e!=="clone"}};function fc(n=Vp){return ze(new wu(n))}function ls(n){return n instanceof wu}function qx(n){const e=n.getChildren();let t=null;for(let r=0;r<e.length;r++){const i=e[r];t===null?n.insertBefore(i):t.insertAfter(i),t=i}n.remove()}function Zx(n,e,t,r){const i=gi(),[s,o]=n.isBackward()?[n.focus,n.anchor]:[n.anchor,n.focus];let l,a;i.anchor.set(s.key,s.offset,s.type),i.focus.set(o.key,o.offset,o.type);const c=i.extract();for(const u of c){if(O(a)&&a.isParentOf(u))continue;let d=null;if(L(u))d=u;else{if(ls(u))continue;(O(u)||Z(u))&&u.isInline()&&(d=u)}if(d!==null){if(d&&d.is(l))continue;const f=d.getParent();f!=null&&f.is(l)||(a=void 0),l=f,a===void 0&&(a=fc([t]),d.insertBefore(a)),a.append(d)}else l=void 0,a=void 0}O(a)&&(e?a.selectStart():a.selectEnd())}function Xx(n,e){let t=n;for(;t!==null;){if(ls(t))return t.getIDs();if(L(t)&&e===t.getTextContentSize()){const r=t.getNextSibling();if(ls(r))return r.getIDs()}t=t.getParent()}return null}class Qx extends xe{$config(){return this.config("overflow",{$transform(e){e.isEmpty()&&e.remove()},extends:xe})}createDOM(e){const t=document.createElement("span"),r=e.theme.characterLimit;return typeof r=="string"&&(t.className=r),t}updateDOM(e,t){return!1}insertNewAfter(e,t=!0){return this.getParentOrThrow().insertNewAfter(e,t)}excludeFromCopy(){return!0}}class Fr extends Ss{static getType(){return"horizontal-rule"}static clone(e){return new Fr(e.__key)}static importJSON(e){return Os()}static importDOM(){return{hr:()=>({conversion:eS,priority:0})}}exportJSON(){return{...super.exportJSON(),type:"horizontal-rule",version:1}}exportDOM(){return{element:document.createElement("hr")}}createDOM(){return document.createElement("hr")}updateDOM(){return!1}getTextContent(){return`
|
|
24
|
+
`}isInline(){return!1}decorate(){return null}}function eS(){return{node:Os()}}function Os(){return ze(new Fr)}function qp(n){return n instanceof Fr}function wl(n){const e=[Ts,ks,Ns,Or,$r,or,os,Fr];return n.table&&e.push(xr,Mr,Ci),n.autoLink&&e.push(Su),n.hashtag&&e.push(Cl),n.mark&&e.push(wu),n.overflow&&e.push(Qx),[...new Set(e)]}function vl(n){switch(n){case"bare":return{richText:!0,history:!0,clipboard:!0};case"docked":return{richText:!0,history:!0,clipboard:!0,list:!0,link:!0,autoLink:!0,code:!0,table:!0};case"contextual":return{richText:!0,history:!0,clipboard:!0,list:!0,link:!0,autoLink:!0,code:!0,table:!0}}}const Lr=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,tS=Lr&&"documentMode"in document?document.documentMode:null,nS=Lr&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),rS=!(!Lr||!("InputEvent"in window)||tS)&&"getTargetRanges"in new window.InputEvent("input"),iS=Lr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Vf=Lr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,sS=Lr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),oS=Lr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&nS&&!sS;function Yf(n,e){e.update(()=>{if(n!==null){const t=an(n,KeyboardEvent)?null:n.clipboardData,r=M();if(r!==null&&!r.isCollapsed()&&t!=null){n.preventDefault();const i=yp(e);i!==null&&t.setData("text/html",i),t.setData("text/plain",r.getTextContent())}}})}function lS(n){return mt(n.registerCommand(It,e=>{const t=M();return!!N(t)&&(t.deleteCharacter(e),!0)},B),n.registerCommand(dr,e=>{const t=M();return!!N(t)&&(t.deleteWord(e),!0)},B),n.registerCommand(fr,e=>{const t=M();return!!N(t)&&(t.deleteLine(e),!0)},B),n.registerCommand(In,e=>{const t=M();if(!N(t))return!1;if(typeof e=="string")t.insertText(e);else{const r=e.dataTransfer;if(r!=null)jd(r,t);else{const i=e.data;i&&t.insertText(i)}}return!0},B),n.registerCommand(Xi,()=>{const e=M();return!!N(e)&&(e.removeText(),!0)},B),n.registerCommand(dn,e=>{const t=M();return!!N(t)&&(t.insertLineBreak(e),!0)},B),n.registerCommand(Dn,()=>{const e=M();return!!N(e)&&(e.insertLineBreak(),!0)},B),n.registerCommand(bs,e=>{const t=M();if(!N(t))return!1;const r=e,i=r.shiftKey;return!!Io(t,!0)&&(r.preventDefault(),$o(t,i,!0),!0)},B),n.registerCommand(qo,e=>{const t=M();if(!N(t))return!1;const r=e,i=r.shiftKey;return!!Io(t,!1)&&(r.preventDefault(),$o(t,i,!1),!0)},B),n.registerCommand(Xo,e=>{const t=M();return!!N(t)&&(!Vf||navigator.language!=="ko-KR")&&(e.preventDefault(),n.dispatchCommand(It,!0))},B),n.registerCommand(Qo,e=>{const t=M();return!!N(t)&&(e.preventDefault(),n.dispatchCommand(It,!1))},B),n.registerCommand(Pn,e=>{const t=M();if(!N(t))return!1;if(e!==null){if((Vf||iS||oS)&&rS)return!1;e.preventDefault()}return n.dispatchCommand(dn,!1)},B),n.registerCommand(Qr,()=>(eu(),!0),B),n.registerCommand(Cr,e=>{const t=M();return!!N(t)&&(Yf(e,n),!0)},B),n.registerCommand(fi,e=>{const t=M();return!!N(t)&&((function(r,i){Yf(r,i),i.update(()=>{const s=M();N(s)&&s.removeText()})})(e,n),!0)},B),n.registerCommand(ai,e=>{const t=M();return!!N(t)&&((function(r,i){r.preventDefault(),i.update(()=>{const s=M(),o=an(r,ClipboardEvent)?r.clipboardData:null;o!=null&&N(s)&&jd(o,s)},{tag:Bc})})(e,n),!0)},B),n.registerCommand(el,e=>{const t=M();return!!N(t)&&(e.preventDefault(),!0)},B),n.registerCommand(tl,e=>{const t=M();return!!N(t)&&(e.preventDefault(),!0)},B))}function aS(n,e,t,r,i){if(n===null||t.size===0&&r.size===0&&!i)return 0;const s=e._selection,o=n._selection;if(i)return 1;if(!(N(s)&&N(o)&&o.isCollapsed()&&s.isCollapsed()))return 0;const l=(function(b,_,y){const C=b._nodeMap,S=[];for(const w of _){const x=C.get(w);x!==void 0&&S.push(x)}for(const[w,x]of y){if(!x)continue;const T=C.get(w);T===void 0||_e(T)||S.push(T)}return S})(e,t,r);if(l.length===0)return 0;if(l.length>1){const b=e._nodeMap,_=b.get(s.anchor.key),y=b.get(o.anchor.key);return _&&y&&!n._nodeMap.has(_.__key)&&L(_)&&_.__text.length===1&&s.anchor.offset===1?2:0}const a=l[0],c=n._nodeMap.get(a.__key);if(!L(c)||!L(a)||c.__mode!==a.__mode)return 0;const u=c.__text,d=a.__text;if(u===d)return 0;const f=s.anchor,h=o.anchor;if(f.key!==h.key||f.type!=="text")return 0;const g=f.offset,p=h.offset,m=d.length-u.length;return m===1&&p===g-1?2:m===-1&&p===g+1?3:m===-1&&p===g?4:0}function cS(n,e){let t=Date.now(),r=0;return(i,s,o,l,a,c)=>{const u=Date.now();if(c.has(bo))return r=0,t=u,2;const d=aS(i,s,l,a,n.isComposing()),f=(()=>{const h=o===null||o.editor===n,g=c.has(lg);if(!g&&h&&c.has(Vr))return 0;if(i===null)return 1;const p=s._selection;if(!(l.size>0||a.size>0))return p!==null?0:2;const m=typeof e=="number"?e:e.peek();return g===!1&&d!==0&&d===r&&u<t+m&&h||l.size===1&&(function(b,_,y){const C=_._nodeMap.get(b),S=y._nodeMap.get(b),w=_._selection,x=y._selection;return!(N(w)&&N(x)&&w.anchor.type==="element"&&w.focus.type==="element"&&x.anchor.type==="text"&&x.focus.type==="text"||!L(C)||!L(S)||C.__parent!==S.__parent)&&JSON.stringify(_.read(()=>C.exportJSON()))===JSON.stringify(y.read(()=>S.exportJSON()))})(Array.from(l)[0],i,s)?0:1})();return t=u,r=d,f}}function qf(n){n.undoStack=[],n.redoStack=[],n.current=null}function Zp(n,e,t){const r=cS(n,t);return mt(n.registerCommand(ci,()=>((function(s,o){const l=o.redoStack,a=o.undoStack;if(a.length!==0){const c=o.current,u=a.pop();c!==null&&(l.push(c),s.dispatchCommand($i,!0)),a.length===0&&s.dispatchCommand(Fi,!1),o.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:bo})}})(n,e),!0),B),n.registerCommand(ui,()=>((function(s,o){const l=o.redoStack,a=o.undoStack;if(l.length!==0){const c=o.current;c!==null&&(a.push(c),s.dispatchCommand(Fi,!0));const u=l.pop();l.length===0&&s.dispatchCommand($i,!1),o.current=u||null,u&&u.editor.setEditorState(u.editorState,{tag:bo})}})(n,e),!0),B),n.registerCommand(Pc,()=>(qf(e),!1),B),n.registerCommand(qh,()=>(qf(e),n.dispatchCommand($i,!1),n.dispatchCommand(Fi,!1),!0),B),n.registerUpdateListener(({editorState:s,prevEditorState:o,dirtyLeaves:l,dirtyElements:a,tags:c})=>{const u=e.current,d=e.redoStack,f=e.undoStack,h=u===null?null:u.editorState;if(u!==null&&s===h)return;const g=r(o,s,u,l,a,c);if(g===1)d.length!==0&&(e.redoStack=[],n.dispatchCommand($i,!1)),u!==null&&(f.push({...u}),n.dispatchCommand(Fi,!0));else if(g===2)return;e.current={editor:n,editorState:s}}))}function Xp(){return{current:null,redoStack:[],undoStack:[]}}const ya={build:(n,{delay:e,createInitialHistoryState:t,disabled:r})=>$b({delay:e,disabled:r,historyState:t(n)}),config:{createInitialHistoryState:Xp,delay:300,disabled:typeof window>"u"},name:"@lexical/history/History",register:(n,e,t)=>{const r=t.getOutput();return gu(()=>r.disabled.value?void 0:Zp(n,r.historyState.value,r.delay))}};Qg(ya,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:!0});function uS(n,e){const t={};for(const r of n){const i=e(r);i&&(t[i]?t[i].push(r):t[i]=[r])}return t}function Qp(n){const e=uS(n,t=>t.type);return{element:e.element||[],multilineElement:e["multiline-element"]||[],textFormat:e["text-format"]||[],textMatch:e["text-match"]||[]}}const Zf=/[ \t\n\r\f]/,hc=/[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~]/,dS=/^\s{0,3}$/;function gc(n){if(!Nr(n))return!1;const e=n.getFirstChild();return e==null||n.getChildrenSize()===1&&L(e)&&dS.test(e.getTextContent())}function fS(n,e,t,r){for(const i of e){if(!i.export)continue;const s=i.export(n,o=>Do(o,t,r));if(s!=null)return s}return O(n)?Do(n,t,r):Z(n)?n.getTextContent():null}function Do(n,e,t,r,i){const s=[],o=n.getChildren();r||(r=[]),i||(i=[]);e:for(const l of o){for(const a of t){if(!a.export)continue;const c=a.export(l,u=>Do(u,e,t,r,[...i,...r]),(u,d)=>Xf(u,d,e,r,i));if(c!=null){s.push(c);continue e}}ue(l)?s.push(`
|
|
25
|
+
`):L(l)?s.push(Xf(l,l.getTextContent(),e,r,i)):O(l)?s.push(Do(l,e,t,r,i)):Z(l)&&s.push(l.getTextContent())}return s.join("")}function Xf(n,e,t,r,i){let s=n.getFormat()===0?e:(function(f){return f.replace(/^\s+|\s+$/g,h=>[...h].map(g=>"&#"+g.codePointAt(0)+";").join(""))})(e);n.hasFormat("code")||(s=s.replace(/([*_`~\\])/g,"\\$1"));let o="",l="",a="";const c=Qf(n,!0),u=Qf(n,!1),d=new Set;for(const f of t){const h=f.format[0],g=f.tag;Gs(n,h)&&!d.has(h)&&(d.add(h),Gs(c,h)&&r.find(p=>p.tag===g)||(r.push({format:h,tag:g}),o+=g))}for(let f=0;f<r.length;f++){const h=Gs(n,r[f].format),g=Gs(u,r[f].format);if(h&&g)continue;const p=[...r];for(;p.length>f;){const m=p.pop();i&&m&&i.find(b=>b.tag===m.tag)||(m&&typeof m.tag=="string"&&(h?g||(a+=m.tag):l+=m.tag),r.pop())}break}return s=o+s+a,l+s}function Qf(n,e){const t=e?n.getPreviousSibling():n.getNextSibling();return L(t)?t:null}function Gs(n,e){return L(n)&&n.hasFormat(e)}function hS(n,e){const t=n.getTextContent(),r=e.fullMatchRegExpByTag["`"],i=e.transformersByTag["`"],s=[];let o=null;if(r&&i){const f=new RegExp(r.source,"g"),h=Array.from(t.matchAll(f));for(const g of h){const p=g.index,m=p+g[0].length;o||(o={content:g[2],endIndex:m,startIndex:p,tag:"`"}),s.push({end:m,start:p})}}const l=(function(f,h,g=[]){const p=[],m=new Set(Object.keys(h.transformersByTag).filter(C=>C[0]!=="`").map(C=>C[0])),b=C=>{let S=0;for(let w=C-1;w>=0&&f[w]==="\\";w--)S++;return S%2==1},_=C=>g.some(S=>C>=S.start&&C<S.end);let y=0;for(;y<f.length;){const C=f[y];if(!m.has(C)||b(y)||_(y)){y++;continue}let S=1;for(;y+S<f.length&&f[y+S]===C;)S++;const w=eh(C,f,y,S,!0),x=eh(C,f,y,S,!1);(w||x)&&p.push({active:!0,canClose:x,canOpen:w,char:C,index:y,length:S,originalLength:S}),y+=S}return p})(t,e,s),a=l.length>0?(function(f,h,g){const p={};let m=0,b=null;for(;m<h.length;){const _=h[m];if(!_.active||!_.canClose||_.length===0){m++;continue}const y=`${_.char}${_.canOpen}`,C=p[y]??-1;let S=!1;for(let w=m-1;w>C;w--){const x=h[w];if(!x.active||!x.canOpen||x.length===0||x.char!==_.char||(x.canClose||_.canOpen)&&(x.originalLength+_.originalLength)%3==0&&x.originalLength%3!=0&&_.originalLength%3!=0)continue;const T=Math.min(x.length,_.length),E=Object.keys(g.transformersByTag).filter(k=>k[0]===x.char&&k.length<=T).sort((k,D)=>D.length-k.length)[0];if(!E)continue;S=!0;const I=E.length,$={content:f.slice(x.index+x.length,_.index),endIndex:_.index+I,startIndex:x.index+(x.length-I),tag:E};(!b||$.startIndex<b.startIndex||$.startIndex===b.startIndex&&$.endIndex>b.endIndex)&&(b=$);for(let k=w+1;k<m;k++)h[k].active=!1;x.length-=I,_.length-=I,x.active=x.length>0,_.length>0?_.index+=I:(_.active=!1,m++);break}S||(p[y]=m-1,_.canOpen||(_.active=!1),m++)}return b})(t,l,e):null;let c=null,u=null;if(o&&a?a.startIndex<=o.startIndex&&a.endIndex>=o.endIndex?(c=a,u=e.transformersByTag[a.tag]):(c=o,u=i):o?(c=o,u=i):a&&(c=a,u=e.transformersByTag[a.tag]),!c||!u)return null;const d=[t.slice(c.startIndex,c.endIndex),c.tag,c.content];return d.index=c.startIndex,d.input=t,{endIndex:c.endIndex,match:d,startIndex:c.startIndex,transformer:u}}function eh(n,e,t,r,i){if(!th(e,t,r,i))return!1;if(n==="*")return!0;if(n==="_"){if(!th(e,t,r,!i))return!0;const s=i?e[t-1]:e[t+r];return s!==void 0&&hc.test(s)}return!0}function th(n,e,t,r){const i=n[e-1],s=n[e+t],[o,l]=r?[s,i]:[i,s];return o!==void 0&&!Zf.test(o)&&(!hc.test(o)||l===void 0||Zf.test(l)||hc.test(l))}function Br(n){return L(n)&&!n.hasFormat("code")}function er(n,e,t){let r=hS(n,e),i=(function(o,l){const a=o;let c,u,d,f;for(const h of l){if(!h.replace||!h.importRegExp)continue;const g=a.getTextContent().match(h.importRegExp);if(!g)continue;const p=g.index||0,m=h.getEndIndex?h.getEndIndex(a,g):p+g[0].length;m!==!1&&(c===void 0||u===void 0||p<c&&(m>u||m<=c))&&(c=p,u=m,d=h,f=g)}return c===void 0||u===void 0||d===void 0||f===void 0?null:{endIndex:u,match:f,startIndex:c,transformer:d}})(n,t);if(r&&i&&(r.startIndex<=i.startIndex&&r.endIndex>=i.endIndex||i.startIndex>r.endIndex?i=null:r=null),r){const o=(function(l,a,c,u,d){const f=l.getTextContent();let h,g,p;if(d[0]===f?h=l:a===0?[h,g]=l.splitText(c):[p,h,g]=l.splitText(a,c),h.setTextContent(d[2]),u)for(const m of u.format)h.hasFormat(m)||h.toggleFormat(m);return{nodeAfter:g,nodeBefore:p,transformedNode:h}})(n,r.startIndex,r.endIndex,r.transformer,r.match);Br(o.nodeAfter)&&er(o.nodeAfter,e,t),Br(o.nodeBefore)&&er(o.nodeBefore,e,t),Br(o.transformedNode)&&er(o.transformedNode,e,t)}else if(i){const o=(function(l,a,c,u,d){let f,h,g;return a===0?[f,h]=l.splitText(c):[g,f,h]=l.splitText(a,c),u.replace?{nodeAfter:h,nodeBefore:g,transformedNode:u.replace(f,d)||void 0}:null})(n,i.startIndex,i.endIndex,i.transformer,i.match);if(!o)return;Br(o.nodeAfter)&&er(o.nodeAfter,e,t),Br(o.nodeBefore)&&er(o.nodeBefore,e,t),Br(o.transformedNode)&&er(o.transformedNode,e,t)}const s=n.getTextContent().replace(/\\([*_`~\\])/g,"$1").replace(/&#(\d+);/g,(o,l)=>String.fromCodePoint(l));n.setTextContent(s)}function gS(n,e=!1){const t=Qp(n),r=(function(i){const s={},o={},l=[],a="(?<![\\\\])";for(const c of i){const{tag:u}=c;s[u]=c;const d=u.replace(/(\*|\^|\+)/g,"\\$1");l.push(d),u.length===1?o[u]=u==="`"?new RegExp("(?<![\\\\`])(`)((?:\\\\`|[^`])+?)(`)(?!`)"):new RegExp(`(?<![\\\\${d}])(${d})((\\\\${d})?.*?[^${d}\\s](\\\\${d})?)((?<!\\\\)|(?<=\\\\\\\\))(${d})(?![\\\\${d}])`):o[u]=new RegExp(`(?<!\\\\)(${d})((\\\\${d})?.*?[^\\s](\\\\${d})?)((?<!\\\\)|(?<=\\\\\\\\))(${d})(?!\\\\)`)}return{fullMatchRegExpByTag:o,openTagsRegExp:new RegExp(`${a}(${l.join("|")})`,"g"),transformersByTag:s}})(t.textFormat);return(i,s)=>{const o=i.split(`
|
|
26
|
+
`),l=o.length,a=s||de();a.clear();for(let u=0;u<l;u++){const d=o[u],[f,h]=pS(o,u,t.multilineElement,a);f?u=h:mS(d,a,t.element,r,t.textMatch,e)}const c=a.getChildren();for(const u of c)!e&&gc(u)&&a.getChildrenSize()>1&&u.remove();M()!==null&&a.selectStart()}}function pS(n,e,t,r){for(const i of t){const{handleImportAfterStartMatch:s,regExpEnd:o,regExpStart:l,replace:a}=i,c=n[e].match(l);if(!c)continue;if(s){const g=s({lines:n,rootNode:r,startLineIndex:e,startMatch:c,transformer:i});if(g===null)continue;if(g)return g}const u=typeof o=="object"&&"regExp"in o?o.regExp:o,d=o&&typeof o=="object"&&"optional"in o?o.optional:!o;let f=e;const h=n.length;for(;f<h;){const g=u?n[f].match(u):null;if(!g&&(!d||d&&f<h-1)){f++;continue}if(g&&e===f&&g.index===c.index){f++;continue}const p=[];if(g&&e===f)p.push(n[e].slice(c[0].length,-g[0].length));else for(let m=e;m<=f;m++)if(m===e){const b=n[m].slice(c[0].length);p.push(b)}else if(m===f&&g){const b=n[m].slice(0,-g[0].length);p.push(b)}else p.push(n[m]);if(a(r,null,c,g,p,!0)!==!1)return[!0,f];break}}return[!1,e]}function mS(n,e,t,r,i,s){const o=he(n),l=H();l.append(o),e.append(l);for(const{regExp:a,replace:c}of t){const u=n.match(a);if(u&&(o.setTextContent(n.slice(u[0].length)),c(l,[o],u,!0)!==!1))break}if(er(o,r,i),l.isAttached()&&n.length>0){const a=l.getPreviousSibling();if(!s&&(Nr(a)||tc(a)||Y(a))){let c=a;if(Y(a)){const u=a.getLastDescendant();c=u==null?null:le(u,ee)}c!=null&&c.getTextContentSize()>0&&(c.splice(c.getChildrenSize(),0,[ut(),...l.getChildren()]),l.remove())}}}const em=/^(\s*)(\d{1,})\.\s/,tm=/^(\s*)[-*+]\s/,_S=/^(\s*)(?:[-*+]\s)?\s?(\[(\s|x)?\])\s/i,pc=/^(#{1,6})\s/,nm=/^>\s/,rm=/^[ \t]*```([\w-]+)?/,mc=/[ \t]*```$/,yS=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,bS=/^(?:\|)(.+)(?:\|)\s?$/,xS=/^(\| ?:?-*:? ?)+\|\s?$/,nh=/^<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,rh=/^<\/[a-z_][\w-]*\s*>/i,ih=n=>new RegExp(`(?:${n.source})$`,n.flags),Pi=Ac("mdListMarker",{parse:n=>typeof n=="string"&&/^[-*+]$/.test(n)?n:"-"}),im=n=>(e,t,r,i)=>{const s=n(r);s.append(...t),e.replace(s),i||s.select(0,0)},sm=n=>(e,t,r,i)=>{const s=e.getPreviousSibling(),o=e.getNextSibling(),l=_t(n==="check"?r[3]==="x":void 0),a=r[0].trim()[0],c=n!=="bullet"&&n!=="check"||a!==Pi.parse(a)?void 0:a;if(Y(o)&&o.getListType()===n){c&&Zs(o,Pi,c);const d=o.getFirstChild();d!==null?d.insertBefore(l):o.append(l),e.remove()}else if(Y(s)&&s.getListType()===n)c&&Zs(s,Pi,c),s.append(l),e.remove();else{const d=ct(n,n==="number"?Number(r[2]):void 0);c&&Zs(d,Pi,c),d.append(l),e.replace(d)}l.append(...t),i||l.select(0,0);const u=(function(d){const f=d.match(/\t/g),h=d.match(/ /g);let g=0;return f&&(g+=f.length),h&&(g+=Math.floor(h.length/4)),g})(r[1]);u&&l.setIndent(u)},vu=(n,e,t)=>{const r=[],i=n.getChildren();let s=0;for(const o of i)if(ee(o)){if(o.getChildrenSize()===1){const d=o.getFirstChild();if(Y(d)){r.push(vu(d,e,t+1));continue}}const l=" ".repeat(4*t),a=n.getListType(),c=Yi(n,Pi),u=a==="number"?`${n.getStart()+s}. `:a==="check"?`${c} [${o.getChecked()?"x":" "}] `:c+" ";r.push(l+u+e(o)),s++}return r.join(`
|
|
27
|
+
`)},SS={dependencies:[Ts],export:(n,e)=>{if(!qb(n))return null;const t=Number(n.getTag().slice(1));return"#".repeat(t)+" "+e(n)},regExp:pc,replace:im(n=>{const e="h"+n[1].length;return Ae(e)}),type:"element"},CS={dependencies:[ks],export:(n,e)=>{if(!tc(n))return null;const t=e(n).split(`
|
|
28
28
|
`),r=[];for(const i of t)r.push("> "+i);return r.join(`
|
|
29
|
-
`)},regExp:
|
|
30
|
-
`+e:"")+"\n```"},regExpEnd:{optional:!0,regExp:
|
|
31
|
-
`)}const a=he(l);o.append(a),n.append(o)}else e&&
|
|
32
|
-
`);let c=!1;const u=[];for(let d=0;d<a.length;d++){const f=a[d].trimEnd(),h=u[u.length-1];
|
|
33
|
-
`)})(n,i);return
|
|
29
|
+
`)},regExp:nm,replace:(n,e,t,r)=>{if(r){const s=n.getPreviousSibling();if(tc(s))return s.splice(s.getChildrenSize(),0,[ut(),...e]),void n.remove()}const i=bi();i.append(...e),n.replace(i),r||i.select(0,0)},type:"element"},wS={dependencies:[or],export:n=>{if(!Lt(n))return null;const e=n.getTextContent();return"```"+(n.getLanguage()||"")+(e?`
|
|
30
|
+
`+e:"")+"\n```"},regExpEnd:{optional:!0,regExp:mc},regExpStart:rm,replace:(n,e,t,r,i,s)=>{let o,l;if(!e&&i){if(i.length===1)r?(o=St(),l=t[1]+i[0]):(o=St(t[1]),l=i[0].startsWith(" ")?i[0].slice(1):i[0]);else{if(o=St(t[1]),i[0].trim().length===0)for(;i.length>0&&!i[0].length;)i.shift();else i[0]=i[0].startsWith(" ")?i[0].slice(1):i[0];for(;i.length>0&&!i[i.length-1].length;)i.pop();l=i.join(`
|
|
31
|
+
`)}const a=he(l);o.append(a),n.append(o)}else e&&im(a=>St(a?a[1]:void 0))(n,e,t,s)},type:"multiline-element"},vS={dependencies:[Ns,Or],export:(n,e)=>Y(n)?vu(n,e,0):null,regExp:tm,replace:sm("bullet"),type:"element"},ES={dependencies:[Ns,Or],export:(n,e)=>Y(n)?vu(n,e,0):null,regExp:em,replace:sm("number"),type:"element"},kS={format:["code"],tag:"`",type:"text-format"},TS={format:["highlight"],tag:"==",type:"text-format"},NS={format:["bold","italic"],tag:"***",type:"text-format"},AS={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},OS={format:["bold"],tag:"**",type:"text-format"},MS={format:["bold"],intraword:!1,tag:"__",type:"text-format"},IS={format:["strikethrough"],tag:"~~",type:"text-format"},$S={format:["italic"],tag:"*",type:"text-format"},FS={format:["italic"],intraword:!1,tag:"_",type:"text-format"},LS={dependencies:[$r],export:(n,e,t)=>{if(!Tn(n)||Ri(n))return null;const r=n.getTitle(),i=e(n);return r?`[${i}](${n.getURL()} "${r}")`:`[${i}](${n.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(n,e)=>{const[,t,r,i]=e,s=sr(r,{title:i}),o=t.split("[").length-1,l=t.split("]").length-1;let a=t,c="";if(o<l)return;if(o>l){const d=t.split("[");c="["+d[0],a=d.slice(1).join("[")}const u=he(a);return u.setFormat(n.getFormat()),s.append(u),n.replace(s),c&&s.insertBefore(he(c)),u},trigger:")",type:"text-match"},RS=[SS,CS,vS,ES],DS=[wS],PS=[kS,NS,AS,OS,MS,TS,$S,FS,IS],zS=[LS],Eu=[...RS,...DS,...PS,...zS];function BS(n,e=Eu,t,r=!1,i=!1){const s=r?n:(function(o,l=!1){const a=o.split(`
|
|
32
|
+
`);let c=!1;const u=[];for(let d=0;d<a.length;d++){const f=a[d].trimEnd(),h=u[u.length-1];yS.test(f)?u.push(f):rm.test(f)||mc.test(f)?(c=!c,u.push(f)):c||f===""||h===""||!h||pc.test(h)||pc.test(f)||nm.test(f)||em.test(f)||tm.test(f)||_S.test(f)||bS.test(f)||xS.test(f)||!l||nh.test(f)||rh.test(f)||ih(rh).test(h)||ih(nh).test(h)||mc.test(h)?u.push(f):u[u.length-1]=h+" "+f.trimStart()}return u.join(`
|
|
33
|
+
`)})(n,i);return gS(e,r)(s,t)}function US(n=Eu,e,t=!1){return(function(i,s=!1){const o=Qp(i),l=[...o.multilineElement,...o.element],a=!s,c=o.textFormat.filter(u=>u.format.length===1).sort((u,d)=>Number(u.format.includes("code"))-Number(d.format.includes("code")));return u=>{const d=[],f=(u||de()).getChildren();for(let h=0;h<f.length;h++){const g=f[h],p=fS(g,l,c,o.textMatch);p!=null&&d.push(a&&h>0&&!gc(g)&&!gc(f[h-1])?`
|
|
34
34
|
`.concat(p):p)}return d.join(`
|
|
35
|
-
`)}})(n,t)(e)}function rm(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}class im{_offsetMap;_firstNode;_blockOffsetSize;constructor(e,t,r=1){this._offsetMap=e,this._firstNode=t,this._blockOffsetSize=r}createSelectionFromOffsets(e,t,r){const i=this._firstNode;if(i===null)return null;let s=e,o=t,l=Fi(i,s,this._blockOffsetSize),a=Fi(i,o,this._blockOffsetSize);if(r!==void 0&&(s=th(s,l,r,this,this._blockOffsetSize),l=Fi(i,s,this._blockOffsetSize),o=th(o,a,r,this,this._blockOffsetSize),a=Fi(i,o,this._blockOffsetSize)),l===null||a===null)return null;let c=l.key,u=a.key;const d=Q(c),f=Q(u);if(d===null||f===null)return null;let h=0,g=0,p="element",m="element";if(l.type==="text"){h=s-l.start,p="text";const _=d.getNextSibling();s!==o&&h===d.getTextContentSize()&&R(_)&&(h=0,c=_.__key)}else l.type==="inline"&&(c=d.getParentOrThrow().getKey(),h=o>l.start?l.end:l.start);a.type==="text"?(g=o-a.start,m="text"):a.type==="inline"&&(u=f.getParentOrThrow().getKey(),g=o>a.start?a.end:a.start);const b=ci();return b===null?null:(b.anchor.set(c,h,p),b.focus.set(u,g,m),b)}getOffsetsFromSelection(e){const t=e.anchor,r=e.focus,i=this._offsetMap,s=t.offset,o=r.offset;let l=-1,a=-1;if(t.type==="text"){const c=i.get(t.key);c!==void 0&&(l=c.start+s)}else{const c=t.getNode().getDescendantByIndex(s);if(c!==null){const u=i.get(c.getKey());u!==void 0&&(l=c.getIndexWithinParent()!==s?u.end:u.start)}}if(r.type==="text"){const c=i.get(r.key);c!==void 0&&(a=c.start+r.offset)}else{const c=r.getNode().getDescendantByIndex(o);if(c!==null){const u=i.get(c.getKey());u!==void 0&&(a=c.getIndexWithinParent()!==o?u.end:u.start)}}return[l,a]}}function th(n,e,t,r,i){const s=t._offsetMap,o=r._offsetMap,l=new Set;let a=n,c=e;for(;c!==null;){const d=c.key,f=s.get(d),h=c.end-c.start;if(l.add(d),f===void 0)a+=h;else{const m=f.end-f.start;m!==h&&(a+=h-m)}const g=c.prev;if(g!==null){c=g;continue}let p=c.parent;for(;p!==null;){let m=p.prev;if(m!==null){const b=m.key,_=s.get(b),y=m.end-m.start;if(l.add(b),_===void 0)a+=y;else{const C=_.end-_.start;C!==y&&(a+=y-C)}m=m.prev}p=p.parent}break}const u=t._firstNode;if(u!==null){c=Fi(u,n,i);let d=!1;for(;c!==null;){if(!l.has(c.key)){d=!0;break}c=c.parent}if(!d)for(;c!==null;){const f=c.key;if(!l.has(f)){const h=o.get(f),g=c.end-c.start;if(h===void 0)a-=g;else{const p=h.end-h.start;g!==p&&(a+=p-g)}}c=c.prev}}return a}function Fi(n,e,t){let r=n;for(;r!==null;){if(e<r.end+(r.type!=="element"||t===0?1:0)){const s=r.child;if(s!==null){r=s;continue}return r}const i=r.next;if(i===null)break;r=i}return null}function nh(n,e,t,r,i,s){return{child:n,end:r,key:i,next:null,parent:s,prev:null,start:t,type:e}}function BS(n,e,t,r,i,s){const o=r.get(e);o===void 0&&rm(3);const l=n.offset;if(A(o)){const d=rr(o,r),f=d.length===0,h=f?null:sm(n,d,null,r,i,s);n.prevIsBlock&&!f||(n.prevIsBlock=!0,n.offset+=s);const g=nh(h,"element",l,l,e,t);h!==null&&(h.parent=g);const p=n.offset;return g.end=p,i.set(e,g),g}n.prevIsBlock=!1;const a=R(o),c=a?o.__text.length:1,u=nh(null,a?"text":"inline",l,n.offset+=c,e,t);return i.set(e,u),u}function sm(n,e,t,r,i,s){let o=null,l=null;const a=e.length;for(let c=0;c<a;c++){const u=BS(n,e[c],t,r,i,s);l===null?o=u:(u.prev=l,l.next=u),l=u}return o}function rr(n,e){const t=[];let r=n.__first;for(;r!==null;){const i=e===null?Q(r):e.get(r);i==null&&rm(174),t.push(r),r=i.__next}return t}const US=rr;function KS(n,e=1,t){const r=(t||n._pendingEditorState||n._editorState)._nodeMap,i=r.get("root"),s=new Map,o=sm({offset:0,prevIsBlock:!1},rr(i,r),null,r,s,e);return new im(s,o,e)}const WS=Object.freeze(Object.defineProperty({__proto__:null,$createChildrenArray:rr,$createOffsetView:KS,OffsetView:im,createChildrenArray:US},Symbol.toStringTag,{value:"Module"})),Jt=()=>new Map,fc=n=>{const e=Jt();return n.forEach((t,r)=>{e.set(r,t)}),e},yi=(n,e,t)=>{let r=n.get(e);return r===void 0&&n.set(e,r=t()),r},jS=(n,e)=>{const t=[];for(const[r,i]of n)t.push(e(i,r));return t},HS=(n,e)=>{for(const[t,r]of n)if(e(r,t))return!0;return!1},qr=()=>new Set,pa=n=>n[n.length-1],Zr=Array.from,Su=(n,e)=>{for(let t=0;t<n.length;t++)if(!e(n[t],t,n))return!1;return!0},om=(n,e)=>{for(let t=0;t<n.length;t++)if(e(n[t],t,n))return!0;return!1},JS=(n,e)=>{const t=new Array(n);for(let r=0;r<n;r++)t[r]=e(r,t);return t},bl=Array.isArray;class GS{constructor(){this._observers=Jt()}on(e,t){return yi(this._observers,e,qr).add(t),t}once(e,t){const r=(...i)=>{this.off(e,r),t(...i)};this.on(e,r)}off(e,t){const r=this._observers.get(e);r!==void 0&&(r.delete(t),r.size===0&&this._observers.delete(e))}emit(e,t){return Zr((this._observers.get(e)||Jt()).values()).forEach(r=>r(...t))}destroy(){this._observers=Jt()}}const fn=Math.floor,Zs=Math.abs,lm=(n,e)=>n<e?n:e,bi=(n,e)=>n>e?n:e,VS=n=>n!==0?n<0:1/n<0,rh=1,ih=2,ma=4,_a=8,YS=32,am=64,Io=128,qS=31,sh=63,Ki=127,ZS=2147483647,oh=Number.MAX_SAFE_INTEGER,lh=Number.MIN_SAFE_INTEGER,XS=Number.isInteger||(n=>typeof n=="number"&&isFinite(n)&&fn(n)===n),QS=String.fromCharCode,eC=n=>n.toLowerCase(),tC=/^\s*/g,nC=n=>n.replace(tC,""),rC=/([A-Z])/g,ah=(n,e)=>nC(n.replace(rC,t=>`${e}${eC(t)}`)),iC=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;i<t;i++)r[i]=e.codePointAt(i);return r},rs=typeof TextEncoder<"u"?new TextEncoder:null,sC=n=>rs.encode(n),oC=rs?sC:iC;let ya=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});ya&&ya.decode(new Uint8Array).length===1&&(ya=null);const lC=(n,e)=>JS(e,()=>n).join("");class Es{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Cu=()=>new Es,aC=n=>{let e=n.cpos;for(let t=0;t<n.bufs.length;t++)e+=n.bufs[t].length;return e},on=n=>{const e=new Uint8Array(aC(n));let t=0;for(let r=0;r<n.bufs.length;r++){const i=n.bufs[r];e.set(i,t),t+=i.length}return e.set(new Uint8Array(n.cbuf.buffer,0,n.cpos),t),e},cC=(n,e)=>{const t=n.cbuf.length;t-n.cpos<e&&(n.bufs.push(new Uint8Array(n.cbuf.buffer,0,n.cpos)),n.cbuf=new Uint8Array(bi(t,e)*2),n.cpos=0)},Oe=(n,e)=>{const t=n.cbuf.length;n.cpos===t&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(t*2),n.cpos=0),n.cbuf[n.cpos++]=e},hc=Oe,ce=(n,e)=>{for(;e>Ki;)Oe(n,Io|Ki&e),e=fn(e/128);Oe(n,Ki&e)},wu=(n,e)=>{const t=VS(e);for(t&&(e=-e),Oe(n,(e>sh?Io:0)|(t?am:0)|sh&e),e=fn(e/64);e>0;)Oe(n,(e>Ki?Io:0)|Ki&e),e=fn(e/128)},gc=new Uint8Array(3e4),uC=gc.length/3,dC=(n,e)=>{if(e.length<uC){const t=rs.encodeInto(e,gc).written||0;ce(n,t);for(let r=0;r<t;r++)Oe(n,gc[r])}else at(n,oC(e))},fC=(n,e)=>{const t=unescape(encodeURIComponent(e)),r=t.length;ce(n,r);for(let i=0;i<r;i++)Oe(n,t.codePointAt(i))},Jr=rs&&rs.encodeInto?dC:fC,vu=(n,e)=>{const t=n.cbuf.length,r=n.cpos,i=lm(t-r,e.length),s=e.length-i;n.cbuf.set(e.subarray(0,i),r),n.cpos+=i,s>0&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(bi(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},at=(n,e)=>{ce(n,e.byteLength),vu(n,e)},Eu=(n,e)=>{cC(n,e);const t=new DataView(n.cbuf.buffer,n.cpos,e);return n.cpos+=e,t},hC=(n,e)=>Eu(n,4).setFloat32(0,e,!1),gC=(n,e)=>Eu(n,8).setFloat64(0,e,!1),pC=(n,e)=>Eu(n,8).setBigInt64(0,e,!1),ch=new DataView(new ArrayBuffer(4)),mC=n=>(ch.setFloat32(0,n),ch.getFloat32(0)===n),is=(n,e)=>{switch(typeof e){case"string":Oe(n,119),Jr(n,e);break;case"number":XS(e)&&Zs(e)<=ZS?(Oe(n,125),wu(n,e)):mC(e)?(Oe(n,124),hC(n,e)):(Oe(n,123),gC(n,e));break;case"bigint":Oe(n,122),pC(n,e);break;case"object":if(e===null)Oe(n,126);else if(bl(e)){Oe(n,117),ce(n,e.length);for(let t=0;t<e.length;t++)is(n,e[t])}else if(e instanceof Uint8Array)Oe(n,116),at(n,e);else{Oe(n,118);const t=Object.keys(e);ce(n,t.length);for(let r=0;r<t.length;r++){const i=t[r];Jr(n,i),is(n,e[i])}}break;case"boolean":Oe(n,e?120:121);break;default:Oe(n,127)}};class uh extends Es{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&ce(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const dh=n=>{n.count>0&&(wu(n.encoder,n.count===1?n.s:-n.s),n.count>1&&ce(n.encoder,n.count-2))};class Xs{constructor(){this.encoder=new Es,this.s=0,this.count=0}write(e){this.s===e?this.count++:(dh(this),this.count=1,this.s=e)}toUint8Array(){return dh(this),on(this.encoder)}}const fh=n=>{if(n.count>0){const e=n.diff*2+(n.count===1?0:1);wu(n.encoder,e),n.count>1&&ce(n.encoder,n.count-2)}};class ba{constructor(){this.encoder=new Es,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(fh(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return fh(this),on(this.encoder)}}class _C{constructor(){this.sarr=[],this.s="",this.lensE=new Xs}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new Es;return this.sarr.push(this.s),this.s="",Jr(e,this.sarr.join("")),vu(e,this.lensE.toUint8Array()),on(e)}}const Dn=n=>new Error(n),It=()=>{throw Dn("Method unimplemented")},hn=()=>{throw Dn("Unexpected case")},yC=crypto.getRandomValues.bind(crypto),cm=()=>yC(new Uint32Array(1))[0],bC="10000000-1000-4000-8000"+-1e11,xC=()=>bC.replace(/[018]/g,n=>(n^cm()&15>>n/4).toString(16)),hh=n=>new Promise(n);Promise.all.bind(Promise);const gh=n=>n===void 0?null:n;class SC{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let um=new SC,CC=!0;try{typeof localStorage<"u"&&localStorage&&(um=localStorage,CC=!1)}catch{}const wC=um,ss=Symbol("Equality"),dm=(n,e)=>n===e||!!n?.[ss]?.(e)||!1,vC=n=>typeof n=="object",EC=Object.assign,kC=Object.keys,TC=(n,e)=>{for(const t in n)e(n[t],t)},$o=n=>kC(n).length,NC=n=>{for(const e in n)return!1;return!0},ks=(n,e)=>{for(const t in n)if(!e(n[t],t))return!1;return!0},ku=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),AC=(n,e)=>n===e||$o(n)===$o(e)&&ks(n,(t,r)=>(t!==void 0||ku(e,r))&&dm(e[r],t)),OC=Object.freeze,fm=n=>{for(const e in n){const t=n[e];(typeof t=="object"||typeof t=="function")&&fm(n[e])}return OC(n)},Tu=(n,e,t=0)=>{try{for(;t<n.length;t++)n[t](...e)}finally{t<n.length&&Tu(n,e,t+1)}},Qs=(n,e)=>{if(n===e)return!0;if(n==null||e==null||n.constructor!==e.constructor&&(n.constructor||Object)!==(e.constructor||Object))return!1;if(n[ss]!=null)return n[ss](e);switch(n.constructor){case ArrayBuffer:n=new Uint8Array(n),e=new Uint8Array(e);case Uint8Array:{if(n.byteLength!==e.byteLength)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;break}case Set:{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;break}case Map:{if(n.size!==e.size)return!1;for(const t of n.keys())if(!e.has(t)||!Qs(n.get(t),e.get(t)))return!1;break}case void 0:case Object:if($o(n)!==$o(e))return!1;for(const t in n)if(!ku(n,t)||!Qs(n[t],e[t]))return!1;break;case Array:if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(!Qs(n[t],e[t]))return!1;break;default:return!1}return!0},MC=(n,e)=>e.includes(n),os=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";let Dt;const IC=()=>{if(Dt===void 0)if(os){Dt=Jt();const n=process.argv;let e=null;for(let t=0;t<n.length;t++){const r=n[t];r[0]==="-"?(e!==null&&Dt.set(e,""),e=r):e!==null&&(Dt.set(e,r),e=null)}e!==null&&Dt.set(e,"")}else typeof location=="object"?(Dt=Jt(),(location.search||"?").slice(1).split("&").forEach(n=>{if(n.length!==0){const[e,t]=n.split("=");Dt.set(`--${ah(e,"-")}`,t),Dt.set(`-${ah(e,"-")}`,t)}})):Dt=Jt();return Dt},pc=n=>IC().has(n),Fo=n=>gh(os?process.env[n.toUpperCase().replaceAll("-","_")]:wC.getItem(n)),hm=n=>pc("--"+n)||Fo(n)!==null,$C=hm("production"),FC=os&&MC(process.env.FORCE_COLOR,["true","1","2"]),RC=FC||!pc("--no-colors")&&!hm("no-color")&&(!os||process.stdout.isTTY)&&(!os||pc("--color")||Fo("COLORTERM")!==null||(Fo("TERM")||"").includes("color"));class DC{constructor(e,t){this.left=e,this.right=t}}const Xt=(n,e)=>new DC(n,e),ph=n=>n.next()>=.5,xa=(n,e,t)=>fn(n.next()*(t+1-e)+e),gm=(n,e,t)=>fn(n.next()*(t+1-e)+e),Nu=(n,e,t)=>gm(n,e,t),LC=n=>QS(Nu(n,97,122)),PC=(n,e=0,t=20)=>{const r=Nu(n,e,t);let i="";for(let s=0;s<r;s++)i+=LC(n);return i},Sa=(n,e)=>e[Nu(n,0,e.length-1)],zC=Symbol("0schema");class BC{constructor(){this._rerrs=[]}extend(e,t,r,i=null){this._rerrs.push({path:e,expected:t,has:r,message:i})}toString(){const e=[];for(let t=this._rerrs.length-1;t>0;t--){const r=this._rerrs[t];e.push(lC(" ",(this._rerrs.length-t)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
|
|
36
|
-
`)}}const
|
|
37
|
-
${t.toString()}`)};class uw{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:ls(e),h:t}),this}else(e){return this.if(Do,e)}done(){return(e,t)=>{for(let r=0;r<this.patterns.length;r++){const i=this.patterns[r];if(i.if.check(e))return i.h(e,t)}throw Dn("Unhandled pattern")}}}const dw=n=>new uw(n),Am=dw(Do).if(km,(n,e)=>xa(e,lh,oh)).if(Tm,(n,e)=>PC(e)).if(lw,(n,e)=>ph(e)).if(ow,(n,e)=>BigInt(xa(e,lh,oh))).if(Ro,(n,e)=>Dr(e,Sa(e,n.shape))).if(GC,(n,e)=>{const t={};for(const r in n.shape){let i=n.shape[r];if(jC.check(i)){if(ph(e))continue;i=i.shape}t[r]=Am(i,e)}return t}).if(ZC,(n,e)=>{const t=[],r=gm(e,0,42);for(let i=0;i<r;i++)t.push(Dr(e,n.shape));return t}).if(pm,(n,e)=>Sa(e,n.shape)).if(aw,(n,e)=>null).if(nw,(n,e)=>{const t=Dr(e,n.res);return()=>t}).if(sw,(n,e)=>Dr(e,Sa(e,[Gr,Xr,vl,Nm,Iu,wl,Cm(Gr),bm(xi("a","b","c"),Gr)]))).if(YC,(n,e)=>{const t={},r=xa(e,0,3);for(let i=0;i<r;i++){const s=Dr(e,n.shape.keys),o=Dr(e,n.shape.values);t[s]=o}return t}).done(),Dr=(n,e)=>Am(ls(e),n),El=typeof document<"u"?document:{};Pe(n=>n.nodeType===mw);typeof DOMParser<"u"&&new DOMParser;Pe(n=>n.nodeType===hw);Pe(n=>n.nodeType===gw);const fw=n=>jS(n,(e,t)=>`${t}:${e};`).join(""),hw=El.ELEMENT_NODE,gw=El.TEXT_NODE,pw=El.DOCUMENT_NODE,mw=El.DOCUMENT_FRAGMENT_NODE;Pe(n=>n.nodeType===pw);const xn=Symbol,Om=xn(),Mm=xn(),_w=xn(),yw=xn(),bw=xn(),Im=xn(),xw=xn(),$u=xn(),Sw=xn(),Cw=n=>{n.length===1&&n[0]?.constructor===Function&&(n=n[0]());const e=[],t=[];let r=0;for(;r<n.length;r++){const i=n[r];if(i===void 0)break;if(i.constructor===String||i.constructor===Number)e.push(i);else if(i.constructor===Object)break}for(r>0&&t.push(e.join(""));r<n.length;r++){const i=n[r];i instanceof Symbol||t.push(i)}return t},ww={[Om]:Xt("font-weight","bold"),[Mm]:Xt("font-weight","normal"),[_w]:Xt("color","blue"),[bw]:Xt("color","green"),[yw]:Xt("color","grey"),[Im]:Xt("color","red"),[xw]:Xt("color","purple"),[$u]:Xt("color","orange"),[Sw]:Xt("color","black")},vw=n=>{n.length===1&&n[0]?.constructor===Function&&(n=n[0]());const e=[],t=[],r=Jt();let i=[],s=0;for(;s<n.length;s++){const o=n[s],l=ww[o];if(l!==void 0)r.set(l.left,l.right);else{if(o===void 0)break;if(o.constructor===String||o.constructor===Number){const a=fw(r);s>0||a.length>0?(e.push("%c"+o),t.push(a)):e.push(o)}else break}}for(s>0&&(i=t,i.unshift(e.join("")));s<n.length;s++){const o=n[s];o instanceof Symbol||i.push(o)}return i},$m=RC?vw:Cw,Ew=(...n)=>{console.log(...$m(n)),Fm.forEach(e=>e.print(n))},kw=(...n)=>{console.warn(...$m(n)),n.unshift($u),Fm.forEach(e=>e.print(n))},Fm=qr(),Rm=n=>({[Symbol.iterator](){return this},next:n}),Tw=(n,e)=>Rm(()=>{let t;do t=n.next();while(!t.done&&!e(t.value));return t}),Ca=(n,e)=>Rm(()=>{const{done:t,value:r}=n.next();return{done:t,value:t?void 0:e(r)}});class Nw{constructor(e,t){this.clock=e,this.len=t}}class Aw{constructor(){this.clients=new Map}}const Dm=(n,e,t)=>e.clients.forEach((r,i)=>{const s=n.doc.store.clients.get(i);if(s!=null){const o=s[s.length-1],l=o.id.clock+o.length;for(let a=0,c=r[a];a<r.length&&c.clock<l;c=r[++a])Wm(n,s,c.clock,c.len,t)}}),Ow=(n,e)=>{let t=0,r=n.length-1;for(;t<=r;){const i=fn((t+r)/2),s=n[i],o=s.clock;if(o<=e){if(e<o+s.len)return i;t=i+1}else r=i-1}return null},Lm=(n,e)=>{const t=n.clients.get(e.client);return t!==void 0&&Ow(t,e.clock)!==null},Pm=n=>{n.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let t,r;for(t=1,r=1;t<e.length;t++){const i=e[r-1],s=e[t];i.clock+i.len>=s.clock?i.len=bi(i.len,s.clock+s.len-i.clock):(r<t&&(e[r]=s),r++)}e.length=r})},zm=(n,e,t,r)=>{yi(n.clients,e,()=>[]).push(new Nw(t,r))},Mw=(n,e)=>{ce(n.restEncoder,e.clients.size),Zr(e.clients.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{n.resetDsCurVal(),ce(n.restEncoder,t);const i=r.length;ce(n.restEncoder,i);for(let s=0;s<i;s++){const o=r[s];n.writeDsClock(o.clock),n.writeDsLen(o.len)}})},Bm=cm;class Ln extends GS{constructor({guid:e=xC(),collectionid:t=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:l=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=Bm(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new Uw,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=l,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=hh(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const a=()=>hh(c=>{const u=d=>{(d===void 0||d===!0)&&(this.off("sync",u),c())};this.on("sync",u)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=a()}load(){const e=this._item;e!==null&&!this.shouldLoad&&ge(e.parent.doc,t=>{t.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Zr(this.subdocs).map(e=>e.guid))}transact(e,t=null){return ge(this,e,t)}get(e,t=Ke){const r=yi(this.share,e,()=>{const s=new t;return s._integrate(this,null),s}),i=r.constructor;if(t!==Ke&&i!==t)if(i===Ke){const s=new t;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,Wi)}getText(e=""){return this.get(e,us)}getMap(e=""){return this.get(e,pt)}getXmlElement(e=""){return this.get(e,pn)}getXmlFragment(e=""){return this.get(e,Qr)}toJSON(){const e={};return this.share.forEach((t,r)=>{e[r]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,Zr(this.subdocs).forEach(t=>t.destroy());const e=this._item;if(e!==null){this._item=null;const t=e.content;t.doc=new Ln({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=e,ge(e.parent.doc,r=>{const i=t.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class Iw{constructor(){this.restEncoder=Cu()}toUint8Array(){return on(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){ce(this.restEncoder,e)}writeDsLen(e){ce(this.restEncoder,e)}}class $w extends Iw{writeLeftID(e){ce(this.restEncoder,e.client),ce(this.restEncoder,e.clock)}writeRightID(e){ce(this.restEncoder,e.client),ce(this.restEncoder,e.clock)}writeClient(e){ce(this.restEncoder,e)}writeInfo(e){hc(this.restEncoder,e)}writeString(e){Jr(this.restEncoder,e)}writeParentInfo(e){ce(this.restEncoder,e?1:0)}writeTypeRef(e){ce(this.restEncoder,e)}writeLen(e){ce(this.restEncoder,e)}writeAny(e){is(this.restEncoder,e)}writeBuf(e){at(this.restEncoder,e)}writeJSON(e){Jr(this.restEncoder,JSON.stringify(e))}writeKey(e){Jr(this.restEncoder,e)}}class Fw{constructor(){this.restEncoder=Cu(),this.dsCurrVal=0}toUint8Array(){return on(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,ce(this.restEncoder,t)}writeDsLen(e){e===0&&hn(),ce(this.restEncoder,e-1),this.dsCurrVal+=e}}class Rw extends Fw{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new ba,this.clientEncoder=new Xs,this.leftClockEncoder=new ba,this.rightClockEncoder=new ba,this.infoEncoder=new uh(hc),this.stringEncoder=new _C,this.parentInfoEncoder=new uh(hc),this.typeRefEncoder=new Xs,this.lenEncoder=new Xs}toUint8Array(){const e=Cu();return ce(e,0),at(e,this.keyClockEncoder.toUint8Array()),at(e,this.clientEncoder.toUint8Array()),at(e,this.leftClockEncoder.toUint8Array()),at(e,this.rightClockEncoder.toUint8Array()),at(e,on(this.infoEncoder)),at(e,this.stringEncoder.toUint8Array()),at(e,on(this.parentInfoEncoder)),at(e,this.typeRefEncoder.toUint8Array()),at(e,this.lenEncoder.toUint8Array()),vu(e,on(this.restEncoder)),on(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){is(this.restEncoder,e)}writeBuf(e){at(this.restEncoder,e)}writeJSON(e){is(this.restEncoder,e)}writeKey(e){const t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}}const Dw=(n,e,t,r)=>{r=bi(r,e[0].id.clock);const i=gn(e,r);ce(n.restEncoder,e.length-i),n.writeClient(t),ce(n.restEncoder,r);const s=e[i];s.write(n,r-s.id.clock);for(let o=i+1;o<e.length;o++)e[o].write(n,0)},Lw=(n,e,t)=>{const r=new Map;t.forEach((i,s)=>{rt(e,s)>i&&r.set(s,i)}),Fu(e).forEach((i,s)=>{t.has(s)||r.set(s,0)}),ce(n.restEncoder,r.size),Zr(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{Dw(n,e.clients.get(i),i,s)})},Pw=(n,e)=>Lw(n,e.doc.store,e.beforeState);class zw{constructor(){this.l=[]}}const _h=()=>new zw,yh=(n,e)=>n.l.push(e),bh=(n,e)=>{const t=n.l,r=t.length;n.l=t.filter(i=>e!==i),r===n.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},Um=(n,e,t)=>Tu(n.l,[e,t]);class eo{constructor(e,t){this.client=e,this.clock=t}}const Ks=(n,e)=>n===e||n!==null&&e!==null&&n.client===e.client&&n.clock===e.clock,be=(n,e)=>new eo(n,e),Bw=n=>{for(const[e,t]of n.doc.share.entries())if(t===n)return e;throw hn()},Br=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&(e.sv.get(n.id.client)||0)>n.id.clock&&!Lm(e.ds,n.id),_c=(n,e)=>{const t=yi(n.meta,_c,qr),r=n.doc.store;t.has(e)||(e.sv.forEach((i,s)=>{i<rt(r,s)&&Pn(n,be(s,i))}),Dm(n,e.ds,i=>{}),t.add(e))};class Uw{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const Fu=n=>{const e=new Map;return n.clients.forEach((t,r)=>{const i=t[t.length-1];e.set(r,i.id.clock+i.length)}),e},rt=(n,e)=>{const t=n.clients.get(e);if(t===void 0)return 0;const r=t[t.length-1];return r.id.clock+r.length},Km=(n,e)=>{let t=n.clients.get(e.id.client);if(t===void 0)t=[],n.clients.set(e.id.client,t);else{const r=t[t.length-1];if(r.id.clock+r.length!==e.id.clock)throw hn()}t.push(e)},gn=(n,e)=>{let t=0,r=n.length-1,i=n[r],s=i.id.clock;if(s===e)return r;let o=fn(e/(s+i.length-1)*r);for(;t<=r;){if(i=n[o],s=i.id.clock,s<=e){if(e<s+i.length)return o;t=o+1}else r=o-1;o=fn((t+r)/2)}throw hn()},Kw=(n,e)=>{const t=n.clients.get(e.client);return t[gn(t,e.clock)]},wa=Kw,yc=(n,e,t)=>{const r=gn(e,t),i=e[r];return i.id.clock<t&&i instanceof Ge?(e.splice(r+1,0,l_(n,i,t-i.id.clock)),r+1):r},Pn=(n,e)=>{const t=n.doc.store.clients.get(e.client);return t[yc(n,t,e.clock)]},xh=(n,e,t)=>{const r=e.clients.get(t.client),i=gn(r,t.clock),s=r[i];return t.clock!==s.id.clock+s.length-1&&s.constructor!==wn&&r.splice(i+1,0,l_(n,s,t.clock-s.id.clock+1)),s},Ww=(n,e,t)=>{const r=n.clients.get(e.id.client);r[gn(r,e.id.clock)]=t},Wm=(n,e,t,r,i)=>{if(r===0)return;const s=t+r;let o=yc(n,e,t),l;do l=e[o++],s<l.id.clock+l.length&&yc(n,e,s),i(l);while(o<e.length&&e[o].id.clock<s)};class jw{constructor(e,t,r){this.doc=e,this.deleteSet=new Aw,this.beforeState=Fu(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const Sh=(n,e)=>e.deleteSet.clients.size===0&&!HS(e.afterState,(t,r)=>e.beforeState.get(r)!==t)?!1:(Pm(e.deleteSet),Pw(n,e),Mw(n,e.deleteSet),!0),Ch=(n,e,t)=>{const r=e._item;(r===null||r.id.clock<(n.beforeState.get(r.id.client)||0)&&!r.deleted)&&yi(n.changed,e,qr).add(t)},to=(n,e)=>{let t=n[e],r=n[e-1],i=e;for(;i>0;t=r,r=n[--i-1]){if(r.deleted===t.deleted&&r.constructor===t.constructor&&r.mergeWith(t)){t instanceof Ge&&t.parentSub!==null&&t.parent._map.get(t.parentSub)===t&&t.parent._map.set(t.parentSub,r);continue}break}const s=e-i;return s&&n.splice(e+1-s,s),s},Hw=(n,e,t)=>{for(const[r,i]of n.clients.entries()){const s=e.clients.get(r);for(let o=i.length-1;o>=0;o--){const l=i[o],a=l.clock+l.len;for(let c=gn(s,l.clock),u=s[c];c<s.length&&u.id.clock<a;u=s[++c]){const d=s[c];if(l.clock+l.len<=d.id.clock)break;d instanceof Ge&&d.deleted&&!d.keep&&t(d)&&d.gc(e,!1)}}}},Jw=(n,e)=>{n.clients.forEach((t,r)=>{const i=e.clients.get(r);for(let s=t.length-1;s>=0;s--){const o=t[s],l=lm(i.length-1,1+gn(i,o.clock+o.len-1));for(let a=l,c=i[a];a>0&&c.id.clock>=o.clock;c=i[a])a-=1+to(i,a)}})},jm=(n,e)=>{if(e<n.length){const t=n[e],r=t.doc,i=r.store,s=t.deleteSet,o=t._mergeStructs;try{Pm(s),t.afterState=Fu(t.doc.store),r.emit("beforeObserverCalls",[t,r]);const l=[];t.changed.forEach((a,c)=>l.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(t,a)})),l.push(()=>{t.changedParentTypes.forEach((a,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(a=a.filter(u=>u.target._item===null||!u.target._item.deleted),a.forEach(u=>{u.currentTarget=c,u._path=null}),a.sort((u,d)=>u.path.length-d.path.length),l.push(()=>{Um(c._dEH,a,t)}))}),l.push(()=>r.emit("afterTransaction",[t,r])),l.push(()=>{t._needFormattingCleanup&&iv(t)})}),Tu(l,[])}finally{r.gc&&Hw(s,i,r.gcFilter),Jw(s,i),t.afterState.forEach((u,d)=>{const f=t.beforeState.get(d)||0;if(f!==u){const h=i.clients.get(d),g=bi(gn(h,f),1);for(let p=h.length-1;p>=g;)p-=1+to(h,p)}});for(let u=o.length-1;u>=0;u--){const{client:d,clock:f}=o[u].id,h=i.clients.get(d),g=gn(h,f);g+1<h.length&&to(h,g+1)>1||g>0&&to(h,g)}if(!t.local&&t.afterState.get(r.clientID)!==t.beforeState.get(r.clientID)&&(Ew($u,Om,"[yjs] ",Mm,Im,"Changed the client-id because another client seems to be using it."),r.clientID=Bm()),r.emit("afterTransactionCleanup",[t,r]),r._observers.has("update")){const u=new $w;Sh(u,t)&&r.emit("update",[u.toUint8Array(),t.origin,r,t])}if(r._observers.has("updateV2")){const u=new Rw;Sh(u,t)&&r.emit("updateV2",[u.toUint8Array(),t.origin,r,t])}const{subdocsAdded:l,subdocsLoaded:a,subdocsRemoved:c}=t;(l.size>0||c.size>0||a.size>0)&&(l.forEach(u=>{u.clientID=r.clientID,u.collectionid==null&&(u.collectionid=r.collectionid),r.subdocs.add(u)}),c.forEach(u=>r.subdocs.delete(u)),r.emit("subdocs",[{loaded:a,added:l,removed:c},r,t]),c.forEach(u=>u.destroy())),n.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,n])):jm(n,e+1)}}},ge=(n,e,t=null,r=!0)=>{const i=n._transactionCleanups;let s=!1,o=null;n._transaction===null&&(s=!0,n._transaction=new jw(n,t,r),i.push(n._transaction),i.length===1&&n.emit("beforeAllTransactions",[n]),n.emit("beforeTransaction",[n._transaction,n]));try{o=e(n._transaction)}finally{if(s){const l=n._transaction===i[0];n._transaction=null,l&&jm(i,0)}}return o},wh="You must not compute changes after the event-handler fired.";class kl{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=Gw(this.currentTarget,this.target))}deletes(e){return Lm(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Dn(wh);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(i=>{if(i!==null){const s=t._map.get(i);let o,l;if(this.adds(s)){let a=s.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(s))if(a!==null&&this.deletes(a))o="delete",l=pa(a.content.getContent());else return;else a!==null&&this.deletes(a)?(o="update",l=pa(a.content.getContent())):(o="add",l=void 0)}else if(this.deletes(s))o="delete",l=pa(s.content.getContent());else return;e.set(i,{action:o,oldValue:l})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Dn(wh);const t=this.target,r=qr(),i=qr(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(t).has(null)){let l=null;const a=()=>{l&&s.push(l)};for(let c=t._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((l===null||l.delete===void 0)&&(a(),l={delete:0}),l.delete+=c.length,i.add(c)):this.adds(c)?((l===null||l.insert===void 0)&&(a(),l={insert:[]}),l.insert=l.insert.concat(c.content.getContent()),r.add(c)):((l===null||l.retain===void 0)&&(a(),l={retain:0}),l.retain+=c.length);l!==null&&l.retain===void 0&&a()}this._changes=e}return e}}const Gw=(n,e)=>{const t=[];for(;e._item!==null&&e!==n;){if(e._item.parentSub!==null)t.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;t.unshift(r)}e=e._item.parent}return t},Ye=()=>{kw("Invalid access: Add Yjs type to a document before reading data.")},Hm=80;let Ru=0;class Vw{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=Ru++}}const Yw=n=>{n.timestamp=Ru++},Jm=(n,e,t)=>{n.p.marker=!1,n.p=e,e.marker=!0,n.index=t,n.timestamp=Ru++},qw=(n,e,t)=>{if(n.length>=Hm){const r=n.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return Jm(r,e,t),r}else{const r=new Vw(e,t);return n.push(r),r}},Tl=(n,e)=>{if(n._start===null||e===0||n._searchMarker===null)return null;const t=n._searchMarker.length===0?null:n._searchMarker.reduce((s,o)=>Zs(e-s.index)<Zs(e-o.index)?s:o);let r=n._start,i=0;for(t!==null&&(r=t.p,i=t.index,Yw(t));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return t!==null&&Zs(t.index-i)<r.parent.length/Hm?(Jm(t,r,i),t):qw(n._searchMarker,r,i)},as=(n,e,t)=>{for(let r=n.length-1;r>=0;r--){const i=n[r];if(t>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){n.splice(r,1);continue}i.p=s,s.marker=!0}(e<i.index||t>0&&e===i.index)&&(i.index=bi(e,i.index+t))}},Nl=(n,e,t)=>{const r=n,i=e.changedParentTypes;for(;yi(i,n,()=>[]).push(t),n._item!==null;)n=n._item.parent;Um(r._eH,t,e)};class Ke{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=_h(),this._dEH=_h(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw It()}clone(){throw It()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){yh(this._eH,e)}observeDeep(e){yh(this._dEH,e)}unobserve(e){bh(this._eH,e)}unobserveDeep(e){bh(this._dEH,e)}toJSON(){}}const Gm=(n,e,t)=>{n.doc??Ye(),e<0&&(e=n._length+e),t<0&&(t=n._length+t);let r=t-e;const i=[];let s=n._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const o=s.content.getContent();if(o.length<=e)e-=o.length;else{for(let l=e;l<o.length&&r>0;l++)i.push(o[l]),r--;e=0}}s=s.right}return i},Vm=n=>{n.doc??Ye();const e=[];let t=n._start;for(;t!==null;){if(t.countable&&!t.deleted){const r=t.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}t=t.right}return e},cs=(n,e)=>{let t=0,r=n._start;for(n.doc??Ye();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)e(i[s],t++,n)}r=r.right}},Ym=(n,e)=>{const t=[];return cs(n,(r,i)=>{t.push(e(r,i,n))}),t},Zw=n=>{let e=n._start,t=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(t===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};t=e.content.getContent(),r=0,e=e.right}const i=t[r++];return t.length<=r&&(t=null),{done:!1,value:i}}}},qm=(n,e)=>{n.doc??Ye();const t=Tl(n,e);let r=n._start;for(t!==null&&(r=t.p,e-=t.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},Lo=(n,e,t,r)=>{let i=t;const s=n.doc,o=s.clientID,l=s.store,a=t===null?e._start:t.right;let c=[];const u=()=>{c.length>0&&(i=new Ge(be(o,rt(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new ei(c)),i.integrate(n,0),c=[])};r.forEach(d=>{if(d===null)c.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(d);break;default:switch(u(),d.constructor){case Uint8Array:case ArrayBuffer:i=new Ge(be(o,rt(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Al(new Uint8Array(d))),i.integrate(n,0);break;case Ln:i=new Ge(be(o,rt(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Ol(d)),i.integrate(n,0);break;default:if(d instanceof Ke)i=new Ge(be(o,rt(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Hn(d)),i.integrate(n,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},Zm=()=>Dn("Length exceeded!"),Xm=(n,e,t,r)=>{if(t>e._length)throw Zm();if(t===0)return e._searchMarker&&as(e._searchMarker,t,r.length),Lo(n,e,null,r);const i=t,s=Tl(e,t);let o=e._start;for(s!==null&&(o=s.p,t-=s.index,t===0&&(o=o.prev,t+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(t<=o.length){t<o.length&&Pn(n,be(o.id.client,o.id.clock+t));break}t-=o.length}return e._searchMarker&&as(e._searchMarker,i,r.length),Lo(n,e,o,r)},Xw=(n,e,t)=>{let i=(e._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return Lo(n,e,i,t)},Qm=(n,e,t,r)=>{if(r===0)return;const i=t,s=r,o=Tl(e,t);let l=e._start;for(o!==null&&(l=o.p,t-=o.index);l!==null&&t>0;l=l.right)!l.deleted&&l.countable&&(t<l.length&&Pn(n,be(l.id.client,l.id.clock+t)),t-=l.length);for(;r>0&&l!==null;)l.deleted||(r<l.length&&Pn(n,be(l.id.client,l.id.clock+r)),l.delete(n),r-=l.length),l=l.right;if(r>0)throw Zm();e._searchMarker&&as(e._searchMarker,i,-s+r)},Po=(n,e,t)=>{const r=e._map.get(t);r!==void 0&&r.delete(n)},Du=(n,e,t,r)=>{const i=e._map.get(t)||null,s=n.doc,o=s.clientID;let l;if(r==null)l=new ei([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:l=new ei([r]);break;case Uint8Array:l=new Al(r);break;case Ln:l=new Ol(r);break;default:if(r instanceof Ke)l=new Hn(r);else throw new Error("Unexpected content type")}new Ge(be(o,rt(s.store,o)),i,i&&i.lastId,null,null,e,t,l).integrate(n,0)},Lu=(n,e)=>{n.doc??Ye();const t=n._map.get(e);return t!==void 0&&!t.deleted?t.content.getContent()[t.length-1]:void 0},e_=n=>{const e={};return n.doc??Ye(),n._map.forEach((t,r)=>{t.deleted||(e[r]=t.content.getContent()[t.length-1])}),e},t_=(n,e)=>{n.doc??Ye();const t=n._map.get(e);return t!==void 0&&!t.deleted},Qw=(n,e)=>{const t={};return n._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&Br(s,e)&&(t[i]=s.content.getContent()[s.length-1])}),t},Ws=n=>(n.doc??Ye(),Tw(n._map.entries(),e=>!e[1].deleted));class ev extends kl{}class Wi extends Ke{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const t=new Wi;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Wi}clone(){const e=new Wi;return e.insert(0,this.toArray().map(t=>t instanceof Ke?t.clone():t)),e}get length(){return this.doc??Ye(),this._length}_callObserver(e,t){super._callObserver(e,t),Nl(this,e,new ev(this,e))}insert(e,t){this.doc!==null?ge(this.doc,r=>{Xm(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}push(e){this.doc!==null?ge(this.doc,t=>{Xw(t,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc!==null?ge(this.doc,r=>{Qm(r,this,e,t)}):this._prelimContent.splice(e,t)}get(e){return qm(this,e)}toArray(){return Vm(this)}slice(e=0,t=this.length){return Gm(this,e,t)}toJSON(){return this.map(e=>e instanceof Ke?e.toJSON():e)}map(e){return Ym(this,e)}forEach(e){cs(this,e)}[Symbol.iterator](){return Zw(this)}_write(e){e.writeTypeRef(uv)}}class tv extends kl{constructor(e,t,r){super(e,t),this.keysChanged=r}}class pt extends Ke{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new pt}clone(){const e=new pt;return this.forEach((t,r)=>{e.set(r,t instanceof Ke?t.clone():t)}),e}_callObserver(e,t){Nl(this,e,new tv(this,e,t))}toJSON(){this.doc??Ye();const e={};return this._map.forEach((t,r)=>{if(!t.deleted){const i=t.content.getContent()[t.length-1];e[r]=i instanceof Ke?i.toJSON():i}}),e}get size(){return[...Ws(this)].length}keys(){return Ca(Ws(this),e=>e[0])}values(){return Ca(Ws(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Ca(Ws(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Ye(),this._map.forEach((t,r)=>{t.deleted||e(t.content.getContent()[t.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?ge(this.doc,t=>{Po(t,this,e)}):this._prelimContent.delete(e)}set(e,t){return this.doc!==null?ge(this.doc,r=>{Du(r,this,e,t)}):this._prelimContent.set(e,t),t}get(e){return Lu(this,e)}has(e){return t_(this,e)}clear(){this.doc!==null?ge(this.doc,e=>{this.forEach(function(t,r,i){Po(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(dv)}}const kn=(n,e)=>n===e||typeof n=="object"&&typeof e=="object"&&n&&e&&AC(n,e);class bc{constructor(e,t,r,i){this.left=e,this.right=t,this.index=r,this.currentAttributes=i}forward(){this.right===null&&hn(),this.right.content.constructor===De?this.right.deleted||Si(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}const vh=(n,e,t)=>{for(;e.right!==null&&t>0;)e.right.content.constructor===De?e.right.deleted||Si(e.currentAttributes,e.right.content):e.right.deleted||(t<e.right.length&&Pn(n,be(e.right.id.client,e.right.id.clock+t)),e.index+=e.right.length,t-=e.right.length),e.left=e.right,e.right=e.right.right;return e},js=(n,e,t,r)=>{const i=new Map,s=r?Tl(e,t):null;if(s){const o=new bc(s.p.left,s.p,s.index,i);return vh(n,o,t-s.index)}else{const o=new bc(null,e._start,0,i);return vh(n,o,t)}},n_=(n,e,t,r)=>{for(;t.right!==null&&(t.right.deleted===!0||t.right.content.constructor===De&&kn(r.get(t.right.content.key),t.right.content.value));)t.right.deleted||r.delete(t.right.content.key),t.forward();const i=n.doc,s=i.clientID;r.forEach((o,l)=>{const a=t.left,c=t.right,u=new Ge(be(s,rt(i.store,s)),a,a&&a.lastId,c,c&&c.id,e,null,new De(l,o));u.integrate(n,0),t.right=u,t.forward()})},Si=(n,e)=>{const{key:t,value:r}=e;r===null?n.delete(t):n.set(t,r)},r_=(n,e)=>{for(;n.right!==null;){if(!(n.right.deleted||n.right.content.constructor===De&&kn(e[n.right.content.key]??null,n.right.content.value)))break;n.forward()}},i_=(n,e,t,r)=>{const i=n.doc,s=i.clientID,o=new Map;for(const l in r){const a=r[l],c=t.currentAttributes.get(l)??null;if(!kn(c,a)){o.set(l,c);const{left:u,right:d}=t;t.right=new Ge(be(s,rt(i.store,s)),u,u&&u.lastId,d,d&&d.id,e,null,new De(l,a)),t.right.integrate(n,0),t.forward()}}return o},va=(n,e,t,r,i)=>{t.currentAttributes.forEach((f,h)=>{i[h]===void 0&&(i[h]=null)});const s=n.doc,o=s.clientID;r_(t,i);const l=i_(n,e,t,i),a=r.constructor===String?new mn(r):r instanceof Ke?new Hn(r):new Ci(r);let{left:c,right:u,index:d}=t;e._searchMarker&&as(e._searchMarker,t.index,a.getLength()),u=new Ge(be(o,rt(s.store,o)),c,c&&c.lastId,u,u&&u.id,e,null,a),u.integrate(n,0),t.right=u,t.index=d,t.forward(),n_(n,e,t,l)},Eh=(n,e,t,r,i)=>{const s=n.doc,o=s.clientID;r_(t,i);const l=i_(n,e,t,i);e:for(;t.right!==null&&(r>0||l.size>0&&(t.right.deleted||t.right.content.constructor===De));){if(!t.right.deleted)switch(t.right.content.constructor){case De:{const{key:a,value:c}=t.right.content,u=i[a];if(u!==void 0){if(kn(u,c))l.delete(a);else{if(r===0)break e;l.set(a,c)}t.right.delete(n)}else t.currentAttributes.set(a,c);break}default:r<t.right.length&&Pn(n,be(t.right.id.client,t.right.id.clock+r)),r-=t.right.length;break}t.forward()}if(r>0){let a="";for(;r>0;r--)a+=`
|
|
38
|
-
`;t.right=new
|
|
39
|
-
`?o.insert.slice(0,-1):o.insert;(typeof l!="string"||l.length>0)&&va(r,this,i,l,o.attributes||{})}else o.retain!==void 0?Eh(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&kh(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,t,r){this.doc??Ye();const i=[],s=new Map,o=this.doc;let l="",a=this._start;function c(){if(l.length>0){const d={};let f=!1;s.forEach((g,p)=>{f=!0,d[p]=g});const h={insert:l};f&&(h.attributes=d),i.push(h),l=""}}const u=()=>{for(;a!==null;){if(Br(a,e)||t!==void 0&&Br(a,t))switch(a.content.constructor){case mn:{const d=s.get("ychange");e!==void 0&&!Br(a,e)?(d===void 0||d.user!==a.id.client||d.type!=="removed")&&(c(),s.set("ychange",r?r("removed",a.id):{type:"removed"})):t!==void 0&&!Br(a,t)?(d===void 0||d.user!==a.id.client||d.type!=="added")&&(c(),s.set("ychange",r?r("added",a.id):{type:"added"})):d!==void 0&&(c(),s.delete("ychange")),l+=a.content.str;break}case Hn:case Ci:{c();const d={insert:a.content.getContent()[0]};if(s.size>0){const f={};d.attributes=f,s.forEach((h,g)=>{f[g]=h})}i.push(d);break}case De:Br(a,e)&&(c(),Si(s,a.content));break}a=a.right}c()};return e||t?ge(o,d=>{e&&_c(d,e),t&&_c(d,t),u()},"cleanup"):u(),i}insert(e,t,r){if(t.length<=0)return;const i=this.doc;i!==null?ge(i,s=>{const o=js(s,this,e,!r);r||(r={},o.currentAttributes.forEach((l,a)=>{r[a]=l})),va(s,this,o,t,r)}):this._pending.push(()=>this.insert(e,t,r))}insertEmbed(e,t,r){const i=this.doc;i!==null?ge(i,s=>{const o=js(s,this,e,!r);va(s,this,o,t,r||{})}):this._pending.push(()=>this.insertEmbed(e,t,r||{}))}delete(e,t){if(t===0)return;const r=this.doc;r!==null?ge(r,i=>{kh(i,js(i,this,e,!0),t)}):this._pending.push(()=>this.delete(e,t))}format(e,t,r){if(t===0)return;const i=this.doc;i!==null?ge(i,s=>{const o=js(s,this,e,!1);o.right!==null&&Eh(s,this,o,t,r)}):this._pending.push(()=>this.format(e,t,r))}removeAttribute(e){this.doc!==null?ge(this.doc,t=>{Po(t,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){this.doc!==null?ge(this.doc,r=>{Du(r,this,e,t)}):this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return Lu(this,e)}getAttributes(){return e_(this)}_write(e){e.writeTypeRef(fv)}}class Ea{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Ye()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===pn||t.constructor===Qr)&&t._start!==null)e=t._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class Qr extends Ke{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Qr}clone(){const e=new Qr;return e.insert(0,this.toArray().map(t=>t instanceof Ke?t.clone():t)),e}get length(){return this.doc??Ye(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new Ea(this,e)}querySelector(e){e=e.toUpperCase();const r=new Ea(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),Zr(new Ea(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){Nl(this,e,new ov(this,t,e))}toString(){return Ym(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,t={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),cs(this,s=>{i.insertBefore(s.toDOM(e,t,r),null)}),i}insert(e,t){this.doc!==null?ge(this.doc,r=>{Xm(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(this.doc!==null)ge(this.doc,r=>{const i=e&&e instanceof Ke?e._item:e;Lo(r,this,i,t)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw Dn("Reference item not found");r.splice(i,0,...t)}}delete(e,t=1){this.doc!==null?ge(this.doc,r=>{Qm(r,this,e,t)}):this._prelimContent.splice(e,t)}toArray(){return Vm(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return qm(this,e)}slice(e=0,t=this.length){return Gm(this,e,t)}forEach(e){cs(this,e)}_write(e){e.writeTypeRef(gv)}}class pn extends Qr{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new pn(this.nodeName)}clone(){const e=new pn(this.nodeName),t=this.getAttributes();return TC(t,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof Ke?r.clone():r)),e}toString(){const e=this.getAttributes(),t=[],r=[];for(const l in e)r.push(l);r.sort();const i=r.length;for(let l=0;l<i;l++){const a=r[l];t.push(a+'="'+e[a]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=t.length>0?" "+t.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?ge(this.doc,t=>{Po(t,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,t){this.doc!==null?ge(this.doc,r=>{Du(r,this,e,t)}):this._prelimAttrs.set(e,t)}getAttribute(e){return Lu(this,e)}hasAttribute(e){return t_(this,e)}getAttributes(e){return e?Qw(this,e):e_(this)}toDOM(e=document,t={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const l=s[o];typeof l=="string"&&i.setAttribute(o,l)}return cs(this,o=>{i.appendChild(o.toDOM(e,t,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(hv),e.writeKey(this.nodeName)}}class ov extends kl{constructor(e,t,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class zn extends us{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new zn}clone(){const e=new zn;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const t=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,l)=>o.key<l.key?-1:1),t.push({nodeName:i,attrs:s})}t.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<t.length;i++){const s=t[i];r+=`<${s.nodeName}`;for(let o=0;o<s.attrs.length;o++){const l=s.attrs[o];r+=` ${l.key}="${l.value}"`}r+=">"}r+=e.insert;for(let i=t.length-1;i>=0;i--)r+=`</${t[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(pv)}}class o_{constructor(e,t){this.id=e,this.length=t}get deleted(){throw It()}mergeWith(e){return!1}write(e,t,r){throw It()}integrate(e,t){throw It()}}const lv=0;class wn extends o_{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),Km(e.doc.store,this)}write(e,t){e.writeInfo(lv),e.writeLen(this.length-t)}getMissing(e,t){return null}}class Al{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Al(this.content)}splice(e){throw It()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}class zo{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new zo(this.len)}splice(e){const t=new zo(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){zm(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}}const av=(n,e)=>new Ln({guid:n,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Ol{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Ol(av(this.doc.guid,this.opts))}splice(e){throw It()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}class Ci{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Ci(this.embed)}splice(e){throw It()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}class De{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new De(this.key,this.value)}splice(e){throw It()}mergeWith(e){return!1}integrate(e,t){const r=t.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const cv=Fo("node_env")==="development";class ei{constructor(e){this.arr=e,cv&&fm(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new ei(this.arr)}splice(e){const t=new ei(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const r=this.arr.length;e.writeLen(r-t);for(let i=t;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}class mn{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new mn(this.str)}splice(e){const t=new mn(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}}const uv=0,dv=1,fv=2,hv=3,gv=4,pv=6;class Hn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Hn(this.type._copy())}splice(e){throw It()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}}const l_=(n,e,t)=>{const{client:r,clock:i}=e.id,s=new Ge(be(r,i+t),e,be(r,i+t-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(t));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=be(e.redone.client,e.redone.clock+t)),e.right=s,s.right!==null&&(s.right.left=s),n._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=t,s};class Ge extends o_{constructor(e,t,r,i,s,o,l,a){super(e,a.getLength()),this.origin=r,this.left=t,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=l,this.redone=null,this.content=a,this.info=this.content.isCountable()?ih:0}set marker(e){(this.info&_a)>0!==e&&(this.info^=_a)}get marker(){return(this.info&_a)>0}get keep(){return(this.info&rh)>0}set keep(e){this.keep!==e&&(this.info^=rh)}get countable(){return(this.info&ih)>0}get deleted(){return(this.info&ma)>0}set deleted(e){this.deleted!==e&&(this.info^=ma)}markDeleted(){this.info|=ma}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=rt(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=rt(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===eo&&this.id.client!==this.parent.client&&this.parent.clock>=rt(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=xh(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Pn(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===wn||this.right&&this.right.constructor===wn)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Ge?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===Ge&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===eo){const r=wa(t,this.parent);r.constructor===wn?this.parent=null:this.parent=r.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=xh(e,e.doc.store,be(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),Ks(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(Ks(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(wa(e.doc.store,i.origin)))s.has(wa(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Km(e.doc.store,this),this.content.integrate(e,this),Ch(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new wn(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:be(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Ks(e.origin,this.lastId)&&this.right===e&&Ks(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const t=this.parent._searchMarker;return t&&t.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),zm(e.deleteSet,this.id.client,this.id.clock,this.length),Ch(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw hn();this.content.gc(e),t?Ww(e,this,new wn(this.id,this.length)):this.content=new zo(this.length)}write(e,t){const r=t>0?be(this.id.client,this.id.clock+t-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&qS|(r===null?0:Io)|(i===null?0:am)|(s===null?0:YS);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const l=this.parent;if(l._item!==void 0){const a=l._item;if(a===null){const c=Bw(l);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(a.id)}else l.constructor===String?(e.writeParentInfo(!0),e.writeString(l)):l.constructor===eo?(e.writeParentInfo(!1),e.writeLeftID(l)):hn();s!==null&&e.writeString(s)}this.content.write(e,t)}}const a_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},c_="__ $YJS$ __";a_[c_]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");a_[c_]=!0;function Be(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 mv(n,e,t){const r=n.length,i=e.length;let s=0,o=0;for(;s<r&&s<i&&n[s]===e[s]&&s<t;)s++;for(;o+s<r&&o+s<i&&n[r-o-1]===e[i-o-1];)o++;for(;o+s<r&&o+s<i&&n[s]===e[s];)s++;return{index:s,insert:e.slice(s,i-o),remove:r-s-o}}class Xn{_xmlElem;_key;_parent;_type;constructor(e,t,r){this._key="",this._xmlElem=e,this._parent=t,this._type=r}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return Z(t)?t:null}getNode(){const e=Q(this._key);return Z(e)?e:null}getSharedType(){return this._xmlElem}getType(){return this._type}getKey(){return this._key}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}syncPropertiesFromLexical(e,t,r){const i=this.getPrevNode(r);Bu(e,this._xmlElem,i,t)}syncPropertiesFromYjs(e,t){const r=this.getNode();r===null&&Be(83),zu(e,this._xmlElem,r,t)}destroy(e){const t=e.collabNodeMap;t.get(this._key)===this&&t.delete(this._key)}}function u_(n,e,t){const r=new Xn(n,e,t);return n._collabNode=r,r}class Ri{_map;_key;_parent;_type;constructor(e,t){this._key="",this._map=e,this._parent=t,this._type="linebreak"}getNode(){const e=Q(this._key);return ue(e)?e:null}getKey(){return this._key}getSharedType(){return this._map}getType(){return this._type}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}destroy(e){const t=e.collabNodeMap;t.get(this._key)===this&&t.delete(this._key)}}function d_(n,e){const t=new Ri(n,e);return n._collabNode=t,t}class mt{_map;_key;_parent;_text;_type;_normalized;constructor(e,t,r,i){this._key="",this._map=e,this._parent=r,this._text=t,this._type=i,this._normalized=!1}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return R(t)?t:null}getNode(){const e=Q(this._key);return R(e)?e:null}getSharedType(){return this._map}getType(){return this._type}getKey(){return this._key}getSize(){return this._text.length+(this._normalized?0:1)}getOffset(){return this._parent.getChildOffset(this)}spliceText(e,t,r){const i=this._parent._xmlText,s=this.getOffset()+1+e;t!==0&&i.delete(s,t),r!==""&&i.insert(s,r)}syncPropertiesAndTextFromLexical(e,t,r){const i=this.getPrevNode(r),s=t.__text;if(Bu(e,this._map,i,t),i!==null){const o=i.__text;o!==s&&((function(l,a,c,u){const d=M();let f=u.length;if(N(d)&&d.isCollapsed()){const g=d.anchor;g.key===a&&(f=g.offset)}const h=mv(c,u,f);l.spliceText(h.index,h.remove,h.insert)})(this,t.__key,o,s),this._text=s)}}syncPropertiesAndTextFromYjs(e,t){const r=this.getNode();r===null&&Be(84),zu(e,this._map,r,t);const i=this._text;r.__text!==i&&r.setTextContent(i)}destroy(e){const t=e.collabNodeMap;t.get(this._key)===this&&t.delete(this._key)}}function f_(n,e,t,r){const i=new mt(n,e,t,r);return n._collabNode=i,i}class tn{_key;_children;_xmlText;_type;_parent;constructor(e,t,r){this._key="",this._children=[],this._xmlText=e,this._type=r,this._parent=t}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return A(t)?t:null}getNode(){const e=Q(this._key);return A(e)?e:null}getSharedType(){return this._xmlText}getType(){return this._type}getKey(){return this._key}isEmpty(){return this._children.length===0}getSize(){return 1}getOffset(){const e=this._parent;return e===null&&Be(90),e.getChildOffset(this)}syncPropertiesFromYjs(e,t){const r=this.getNode();r===null&&Be(91),zu(e,this._xmlText,r,t)}applyChildrenYjsDelta(e,t){const r=this._children;let i=0,s=null;for(let o=0;o<t.length;o++){const l=t[o],a=l.insert,c=l.delete;if(l.retain!=null)i+=l.retain;else if(typeof c=="number"){let u=c;for(;u>0;){const{node:d,nodeIndex:f,offset:h,length:g}=ka(this,i,!1);if(d instanceof tn||d instanceof Ri||d instanceof Xn)r.splice(f,1),u-=1;else{if(!(d instanceof mt))break;{const p=Math.min(u,g),m=f!==0?r[f-1]:null,b=d.getSize();if(h===0&&g===b){r.splice(f,1);const _=Ti(d._text,h,p-1,"");_.length>0&&(m instanceof mt?m._text+=_:this._xmlText.delete(h,_.length))}else d._text=Ti(d._text,h,p,"");u-=p}}}}else{if(a==null)throw new Error("Unexpected delta format");if(typeof a=="string"){const{node:u,offset:d}=ka(this,i,!0);u instanceof mt?u._text=Ti(u._text,d,0,a):this._xmlText.delete(d,a.length),i+=a.length}else{const u=a,{node:d,nodeIndex:f,length:h}=ka(this,i,!1),g=g_(e,u,this);if(d instanceof mt&&h>0&&h<d._text.length){const p=d._text,m=p.length-h;d._text=Ti(p,m,h,""),r.splice(f+1,0,g),s=Ti(p,0,m,"")}else r.splice(f,0,g);s!==null&&g instanceof mt&&(g._text=s+g._text,s=null),i+=1}}}}syncChildrenFromYjs(e){const t=this.getNode();t===null&&Be(92);const r=t.__key,i=rr(t,null),s=i.length,o=this._children,l=o.length,a=e.collabNodeMap,c=new Set;let u,d,f=0,h=null;l!==s&&(d=t.getWritable());for(let g=0;g<l;g++){const p=i[f],m=o[g],b=m.getNode(),_=m._key;if(b!==null&&p===_){const y=R(b);if(c.add(p),y)if(m._key=p,m instanceof tn){const C=m._xmlText;m.syncPropertiesFromYjs(e,null),m.applyChildrenYjsDelta(e,C.toDelta()),m.syncChildrenFromYjs(e)}else m instanceof mt?m.syncPropertiesAndTextFromYjs(e,null):m instanceof Xn?m.syncPropertiesFromYjs(e,null):m instanceof Ri||Be(93);h=b,f++}else{if(u===void 0){u=new Set;for(let S=0;S<l;S++){const w=o[S]._key;w!==""&&u.add(w)}}if(b!==null&&p!==void 0&&!u.has(p)){const S=Zn(p);Wt(S),g--,f++;continue}d=t.getWritable();const y=kv(e,m,r),C=y.__key;if(a.set(C,m),h===null){const S=d.getFirstChild();if(d.__first=C,S!==null){const w=S.getWritable();w.__prev=C,y.__next=w.__key}}else{const S=h.getWritable(),w=h.getNextSibling();if(S.__next=C,y.__prev=h.__key,w!==null){const x=w.getWritable();x.__prev=C,y.__next=x.__key}}g===l-1&&(d.__last=C),d.__size++,h=y}}for(let g=0;g<s;g++){const p=i[g];if(!c.has(p)){const m=Zn(p),b=e.collabNodeMap.get(p);b!==void 0&&b.destroy(e),Wt(m)}}}syncPropertiesFromLexical(e,t,r){Bu(e,this._xmlText,this.getPrevNode(r),t)}_syncChildFromLexical(e,t,r,i,s,o){const l=this._children[t],a=Zn(r);l instanceof tn&&A(a)?(l.syncPropertiesFromLexical(e,a,i),l.syncChildrenFromLexical(e,a,i,s,o)):l instanceof mt&&R(a)?l.syncPropertiesAndTextFromLexical(e,a,i):l instanceof Xn&&Z(a)&&l.syncPropertiesFromLexical(e,a,i)}syncChildrenFromLexical(e,t,r,i,s){const o=this.getPrevNode(r),l=o===null?[]:rr(o,r),a=rr(t,null),c=l.length-1,u=a.length-1,d=e.collabNodeMap;let f,h,g=0,p=0;for(;g<=c&&p<=u;){const _=l[g],y=a[p];if(_===y)this._syncChildFromLexical(e,p,y,r,i,s),g++,p++;else{f===void 0&&(f=new Set(l)),h===void 0&&(h=new Set(a));const C=h.has(_),S=f.has(y);if(C){const w=Th(e,Zn(y),this);d.set(y,w),S?(this.splice(e,p,1,w),g++,p++):(this.splice(e,p,0,w),p++)}else this.splice(e,p,1),g++}}const m=g>c,b=p>u;if(m&&!b)for(;p<=u;++p){const _=a[p],y=Th(e,Zn(_),this);this.append(y),d.set(_,y)}else if(b&&!m)for(let _=this._children.length-1;_>=p;_--)this.splice(e,_,1)}append(e){const t=this._xmlText,r=this._children,i=r[r.length-1],s=i!==void 0?i.getOffset()+i.getSize():0;if(e instanceof tn)t.insertEmbed(s,e._xmlText);else if(e instanceof mt){const o=e._map;o.parent===null&&t.insertEmbed(s,o),t.insert(s+1,e._text)}else e instanceof Ri?t.insertEmbed(s,e._map):e instanceof Xn&&t.insertEmbed(s,e._xmlElem);this._children.push(e)}splice(e,t,r,i){const s=this._children,o=s[t];if(o===void 0)return i===void 0&&Be(94),void this.append(i);const l=o.getOffset();l===-1&&Be(95);const a=this._xmlText;if(r!==0&&a.delete(l,o.getSize()),i instanceof tn)a.insertEmbed(l,i._xmlText);else if(i instanceof mt){const c=i._map;c.parent===null&&a.insertEmbed(l,c),a.insert(l+1,i._text)}else i instanceof Ri?a.insertEmbed(l,i._map):i instanceof Xn&&a.insertEmbed(l,i._xmlElem);if(r!==0){const c=s.slice(t,t+r);for(let u=0;u<c.length;u++)c[u].destroy(e)}i!==void 0?s.splice(t,r,i):s.splice(t,r)}getChildOffset(e){let t=0;const r=this._children;for(let i=0;i<r.length;i++){const s=r[i];if(s===e)return t;t+=s.getSize()}return-1}destroy(e){const t=e.collabNodeMap,r=this._children;for(let i=0;i<r.length;i++)r[i].destroy(e);t.get(this._key)===this&&t.delete(this._key)}}function Pu(n,e,t){const r=new tn(n,e,t);return n._collabNode=r,r}function _v(n,e,t,r,i){t==null&&Be(81);const s={clientID:t.clientID,cursors:new Map,cursorsContainer:null,doc:t,docMap:r,editor:n,excludedProperties:i||new Map,id:e,nodeProperties:new Map};return(function(o){const{editor:l,nodeProperties:a}=o;l.update(()=>{l._nodes.forEach(c=>{const u=new c.klass,d={};for(const[f,h]of Object.entries(u))h_(f,u,o)||(d[f]=h);a.set(u.__type,Object.freeze(d))})})})(s),s}function yv(n,e,t,r,i,s){r==null&&Be(81);const o=Pu(r.get("root",zn),null,"root");return o._key="root",{..._v(n,t,r,i,s),collabNodeMap:new Map,root:o}}function bv(n){return Object.hasOwn(n,"collabNodeMap")}const xv=new Set(["__key","__parent","__next","__prev","__state"]),Sv=new Set(["__first","__last","__size"]),Cv=new Set(["__cachedText"]),wv=new Set(["__text"]);function h_(n,e,t){if(xv.has(n)||typeof e[n]=="function")return!0;if(R(e)){if(wv.has(n))return!0}else if(A(e)&&(Sv.has(n)||ye(e)&&Cv.has(n)))return!0;const r=e.constructor,i=t.excludedProperties.get(r);return i!=null&&i.has(n)}function vv(n,e){const t=n.__type,{nodeProperties:r}=e,i=r.get(t);return i===void 0&&Be(330,t),i}function Th(n,e,t){const r=e.__type;let i;if(A(e))i=Pu(new zn,t,r),i.syncPropertiesFromLexical(n,e,null),i.syncChildrenFromLexical(n,e,null,null,null);else if(R(e))i=f_(new pt,e.__text,t,r),i.syncPropertiesAndTextFromLexical(n,e,null);else if(ue(e)){const s=new pt;s.set("__type","linebreak"),i=d_(s,t)}else Z(e)?(i=u_(new pn,t,r),i.syncPropertiesFromLexical(n,e,null)):Be(86);return i._key=e.__key,i}function Ev(n){const e=Ml(n,"__type");return typeof e!="string"&&e!==void 0&&Be(87),e}function g_(n,e,t){const r=e._collabNode;if(r===void 0){const i=n.editor._nodes,s=Ev(e);typeof s!="string"&&Be(87),i.get(s)===void 0&&Be(88,s);const o=e.parent,l=t===void 0&&o!==null?g_(n,o):t||null;if(l instanceof tn||Be(89),e instanceof zn)return Pu(e,l,s);if(e instanceof pt)return s==="linebreak"?d_(e,l):f_(e,"",l,s);if(e instanceof pn)return u_(e,l,s)}return r}function kv(n,e,t){const r=e.getType(),i=n.editor._nodes.get(r);i===void 0&&Be(88,r);const s=new i.klass;if(s.__parent=t,e._key=s.__key,e instanceof tn){const o=e._xmlText;e.syncPropertiesFromYjs(n,null),e.applyChildrenYjsDelta(n,o.toDelta()),e.syncChildrenFromYjs(n)}else e instanceof mt?e.syncPropertiesAndTextFromYjs(n,null):e instanceof Xn&&e.syncPropertiesFromYjs(n,null);return n.collabNodeMap.set(s.__key,e),s}function zu(n,e,t,r){const i=r===null?e instanceof pt?Array.from(e.keys()):e instanceof zn||e instanceof pn?Object.keys(e.getAttributes()):Object.keys(e):Array.from(r);let s;for(let o=0;o<i.length;o++){const l=i[o];if(h_(l,t,n)){l==="__state"&&bv(n)&&(s||(s=t.getWritable()),Tv(e,s));continue}const a=t[l];let c=Ml(e,l);if(a!==c){if(c instanceof Ln){const u=n.docMap;a instanceof Ln&&u.delete(a.guid);const d=ui(),f=c.guid;d._key=f,u.set(f,c),c=d}s===void 0&&(s=t.getWritable()),s[l]=c}}}function Ml(n,e){return n instanceof pt?n.get(e):n instanceof zn||n instanceof pn?n.getAttribute(e):n[e]}function Nh(n,e,t){n instanceof pt?n.set(e,t):n.setAttribute(e,t)}function Tv(n,e){const t=Ml(n,"__state");t instanceof pt&&Ko(e).updateFromJSON(t.toJSON())}function Bu(n,e,t,r){const i=Object.keys(vv(r,n)),s=n.editor.constructor;(function(o,l,a,c){const u=c.__state,d=Ml(l,"__state");if(!u)return;const[f,h]=u.getInternalState(),g=a&&a.__state,p=d instanceof pt?d:new pt;if(g===u)return;const[m,b]=g&&p.doc?g.getInternalState():[void 0,new Map];if(f)for(const[_,y]of Object.entries(f))m&&y!==m[_]&&p.set(_,y);for(const[_,y]of h)b.get(_)!==y&&p.set(_.key,_.unparse(y));d||Nh(l,"__state",p)})(0,e,t,r);for(let o=0;o<i.length;o++){const l=i[o],a=t===null?void 0:t[l];let c=r[l];if(a!==c){if(c instanceof s){const u=n.docMap;let d;if(a instanceof s){const g=a._key;d=u.get(g),u.delete(g)}const f=d||new Ln,h=f.guid;c._key=h,u.set(h,f),c=f,n.editor.update(()=>{r.markDirty()})}Nh(e,l,c)}}}function Ti(n,e,t,r){return n.slice(0,e)+r+n.slice(e+t)}function ka(n,e,t){let r=0,i=0;const s=n._children,o=s.length;for(;i<o;i++){const l=s[i],a=r;if(r+=l.getSize(),(t?r>=e:r>e)&&l instanceof mt){let c=e-a-1;return c<0&&(c=0),{length:r-e,node:l,nodeIndex:i,offset:c}}if(r>e)return{length:0,node:l,nodeIndex:i,offset:a};if(i===o-1)return{length:0,node:null,nodeIndex:i+1,offset:a+1}}return{length:0,node:null,nodeIndex:0,offset:0}}vc("ychange",{isEqual:(n,e)=>n===e,parse:n=>n??null});async function p_(){return nb}async function Il(n){return Yb(n)}async function $l(n){return sS(n)}async function Fl(n,e){const t=Yp(),r=e?.delay??300;return Vp(n,t,r)}async function Rl(n){return()=>{}}async function Dl(n){return typeof la=="function"?typeof uf=="function"?ft(la(n),uf(n)):la(n):ft(n.registerCommand(mi,()=>(aa(n,"number"),!0),q),n.registerCommand(pi,()=>(aa(n,"bullet"),!0),q),n.registerCommand(gl,()=>(aa(n,"check"),!0),q),n.registerCommand(fu,()=>(ix(n),!0),q))}async function Ll(n){return n.registerCommand(ic,e=>(e===null||typeof e=="string"?ca(e):ca(e.url,e),!0),q)}async function Nv(n,e,t){const r=e?.trigger||"/";let i=!1,s=null,o=0;const l=()=>n.getEditorState().read(()=>{const p=M();if(!N(p)||!p.isCollapsed())return!1;const m=p.anchor,b=m.getNode();if(!R(b))return!1;const _=b.getTextContent(),y=m.offset;if(y===0||_[y-1]!==r)return!1;if(y===1)return!0;const S=_[y-2];return!!/\s/.test(S)}),a=()=>s?n.getEditorState().read(()=>{if(!s)return"";const p=s.getTextContent(),m=p.indexOf(r,o);if(m===-1)return"";const b=M();if(!N(b))return"";const _=b.anchor;if(_.getNode().getKey()!==s.getKey())return"";const C=_.offset;return C<=m?"":p.slice(m+1,C)}):"",c=()=>{n.getEditorState().read(()=>{const p=M();if(N(p)){const m=p.anchor,b=m.getNode();if(R(b)){s=b,o=m.offset-1,i=!0;const _={isActive:!0,filterText:"",anchorNode:s,anchorOffset:o};t?.onTrigger?.(_,d),t?.onUpdate?.(_,d)}}})},u=()=>{i&&(i=!1,s=null,o=0,t?.onDismiss?.())},d=()=>{s&&n.update(()=>{if(!s)return;const p=s.getTextContent(),m=p.indexOf(r,o);if(m===-1)return;const b=M();if(!N(b))return;const _=b.anchor;if(_.getNode().getKey()!==s.getKey())return;const C=_.offset,S=p.slice(0,m),w=p.slice(C);s.setTextContent(S+w);const x=M();N(x)&&(x.anchor.set(s.getKey(),m,"text"),x.focus.set(s.getKey(),m,"text"))})},f=()=>{if(!i)return;const m={isActive:!0,filterText:a(),anchorNode:s,anchorOffset:o};t?.onUpdate?.(m,d)},h=n.registerMutationListener(qe,p=>{if(!i&&l()){c();return}i&&(s&&!p.has(s.getKey())?f():u())}),g=ft(n.registerUpdateListener(({editorState:p})=>{p.read(()=>{if(!i)return;const m=M();if(!N(m)){u();return}const b=m.anchor,_=b.getNode();if(!s||_.getKey()!==s.getKey()){u();return}const C=s.getTextContent().indexOf(r,o);if(C===-1||b.offset<=C){u();return}})}),n.registerCommand(ar,p=>i?(p.preventDefault(),!0):!1,q),n.registerCommand(cn,p=>i?(p.preventDefault(),!0):!1,q),n.registerCommand($n,p=>i?(p?.preventDefault(),!0):!1,q),n.registerCommand(oi,p=>i?(p?.preventDefault(),u(),!0):!1,q));return()=>{u(),h(),g()}}function Av(n,e,t){t(),e.handler(n),n.focus()}const Ov=U("TOGGLE_SLASH_COMMAND_PALETTE"),Ts=U("INSERT_HORIZONTAL_RULE_COMMAND"),Mv=U("INSERT_IMAGE_COMMAND");function Pl(n){return n.registerCommand(Ts,()=>{const e=M();if(!N(e))return!1;if(e.focus.getNode()!==null){const r=vs();e.insertNodes([r]);const i=J();r.insertAfter(i),i.selectStart()}return!0},q)}const m_={dependencies:[Ar],export:n=>Gp(n)?"---":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(n,e,t,r)=>{const i=vs();if(r)n.replace(i);else{n.replace(i);const s=J();i.insertAfter(s),s.selectStart()}},type:"element"},Uu=[...xu,m_];async function bt(n){let e="";return n.getEditorState().read(()=>{e=zS(Uu)}),e}async function Bn(n,e){n.update(()=>{PS(e,Uu)})}async function __(){return Uu}const Ku=Object.freeze(Object.defineProperty({__proto__:null,exportToMarkdown:bt,getMarkdownTransformers:__,importFromMarkdown:Bn},Symbol.toStringTag,{value:"Module"}));async function xt(n){let e="";return n.getEditorState().read(()=>{e=dp(n)}),e}async function Un(n,e){n.update(()=>{const r=new DOMParser().parseFromString(e,"text/html"),i=up(n,r);de().clear(),Xo(i)})}const Wu=Object.freeze(Object.defineProperty({__proto__:null,exportToHtml:xt,importFromHtml:Un},Symbol.toStringTag,{value:"Module"}));async function Iv(n,e,t){let r,i,s;switch(e){case"markdown":r=await bt(n),i="text/markdown",s="md";break;case"html":r=await xt(n),i="text/html",s="html";break;case"json":r=JSON.stringify(n.getEditorState().toJSON(),null,2),i="application/json",s="json";break}const o=new Blob([r],{type:i}),l=URL.createObjectURL(o),a=document.createElement("a");a.href=l,a.download=t??`document.${s}`,a.click(),URL.revokeObjectURL(l)}async function $v(n,e,t){const r=await new Promise((s,o)=>{const l=new FileReader;l.onload=()=>s(l.result),l.onerror=()=>o(l.error),l.readAsText(e)});switch(t??Fv(e.name)){case"markdown":{const{importFromMarkdown:s}=await Promise.resolve().then(()=>Ku);await s(n,r);break}case"html":{const{importFromHtml:s}=await Promise.resolve().then(()=>Wu);await s(n,r);break}case"json":{const s=n.parseEditorState(r);n.setEditorState(s);break}}}function Fv(n){return n.endsWith(".md")||n.endsWith(".markdown")?"markdown":n.endsWith(".html")||n.endsWith(".htm")?"html":"json"}async function zl(n,e){return typeof Sf=="function"?Sf(n):()=>{}}async function Rv(n,e=3,t=3){n.dispatchCommand(ws,{rows:String(e),columns:String(t),includeHeaders:!0})}async function Dv(n,e){return typeof Oo=="function"?Oo(n):()=>{}}async function Lv(n,e){return typeof Oo=="function"?Oo(n):()=>{}}const Pv=/#[\w\u0590-\u05ff]+/;function zv(n){return new ml(n)}async function Bv(n,e){const t=[],r=Jx(n,i=>{const s=Pv.exec(i);return s?{start:s.index,end:s.index+s[0].length}:null},ml,zv);if(Array.isArray(r)?t.push(...r):typeof r=="function"&&t.push(r),e?.onHashtagClick){const i=n.registerCommand(mr,s=>{const o=s.target;if(o.classList.contains("bc-lexical-hashtag")){const l=o.textContent;if(l)return e.onHashtagClick(l.replace("#","")),!0}return!1},q);t.push(i)}return()=>{t.forEach(i=>i())}}const Uv=/((https?:\/\/(www\.)?|www\.)[^\s<>]+)/g,Kv=/([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/g,Wv=[{pattern:Uv,urlTransformer:n=>n.startsWith("http")?n:`https://${n}`},{pattern:Kv,urlTransformer:n=>`mailto:${n}`}];async function jv(n,e){const t=e?.matchers??Wv;return n.registerMutationListener(qe,r=>{n.update(()=>{for(const[i,s]of r){if(s!=="created"&&s!=="updated")continue;const o=Q(i);if(!o||!R(o))continue;const l=o.getTextContent();for(const a of t){const c=new RegExp(a.pattern.source,a.pattern.flags);let u;for(;(u=c.exec(l))!==null;)a.urlTransformer(u[0])}}})})}async function Hv(n,e){const t=[];return e?.onMarkClick&&t.push(n.registerCommand(mr,r=>{const i=r.target;if(i.classList.contains("bc-lexical-mark")){const s=i.dataset.markId;if(s)return e.onMarkClick(s,{id:s,type:i.dataset.markType||"annotation",data:{}}),!0}return!1},q)),()=>t.forEach(r=>r())}async function Jv(n,e,t){n.update(()=>{const r=M();N(r)&&Yx(r,r.isBackward(),e)})}async function Gv(n,e){n.update(()=>{const r=de().getAllTextNodes().filter(i=>{const s=i.getParent();return ns(s)?qx(i,0)?.includes(e)??!1:!1});for(const i of r){const s=i.getParent();ns(s)&&Vx(s)}})}async function Vv(n,e){const{maxLength:t,onOverflow:r}=e;return n.registerUpdateListener(({editorState:i})=>{i.read(()=>{const l=de().getTextContent().length,a=l>t;r&&r(a,l)})})}async function Bl(n){return typeof Zd=="function"?Zd(n):()=>{}}async function Ul(n,e){const t=e.docMap??new Map,r=e.id??"lexical",i=e.doc.getText(r),s=yv(n,e.provider,i,e.doc,t),o=n.registerUpdateListener(()=>{});return()=>{o(),s&&typeof s.destroy=="function"&&s.destroy()}}function Yv(n){let e={hasSelection:!1,selectedText:"",anchorOffset:0,focusOffset:0};return n.getEditorState().read(()=>{const t=M();N(t)&&(e={hasSelection:!t.isCollapsed(),selectedText:t.getTextContent(),anchorOffset:t.anchor.offset,focusOffset:t.focus.offset})}),e}function ju(n){let e="";return n.getEditorState().read(()=>{e=de().getTextContent()}),e}function qv(n){return ju(n).length}function Zv(n){const e=ju(n).trim();return e?e.split(/\s+/).length:0}async function Xv(){return WS}function Hu(n,e,t){const r=new Map;if(n)for(const i of n.split(";")){const s=i.trim();if(!s)continue;const o=s.indexOf(":");if(o===-1)continue;const l=s.slice(0,o).trim(),a=s.slice(o+1).trim();r.set(l,a)}return t?r.set(e,t):r.delete(e),r.size===0?"":Array.from(r.entries()).map(([i,s])=>`${i}: ${s}`).join("; ")}function Kl(n,e){if(!n)return"";const t=new RegExp(`(?:^|;)\\s*${e.replace(/-/g,"\\-")}:\\s*([^;]+)`),r=n.match(t);return r?r[1].trim():""}function Qv(n,e){const t=n.getElementByKey(e);t&&n.getEditorState().read(()=>{const r=Q(e);if(!A(r)||ye(r))return;const i=r.getStyle(),s=Kl(i,"background-color");t.style.backgroundColor=s||""})}function Ju(n){const e=n.registerUpdateListener(({dirtyElements:t})=>{if(t.size!==0)for(const[r]of t)Qv(n,r)});return n.getEditorState().read(()=>{const t=de();for(const r of t.getChildren())if(A(r)){const i=r.getStyle();if(i){const s=n.getElementByKey(r.getKey());if(s){const o=Kl(i,"background-color");o&&(s.style.backgroundColor=o)}}}}),e}function Ta(n,e){const t=e.exportDOM(n);if(t.element&&ne(t.element)&&A(e)){const r=e.getStyle(),i=Kl(r,"background-color");i&&(t.element.style.backgroundColor=i)}return t}function Wl(){const n=new Map;return n.set(Kn,Ta),n.set(Ss,Ta),n.set(xs,Ta),n}function e0(){const n=e=>()=>({conversion:t=>{const r=e(t);return r&&A(r)&&(t.style?.textAlign&&r.setFormat(t.style.textAlign),t.style?.backgroundColor&&r.setStyle(Hu("","background-color",t.style.backgroundColor))),{node:r}},priority:1});return{p:n(()=>J()),h1:n(()=>Te("h1")),h2:n(()=>Te("h2")),h3:n(()=>Te("h3")),h4:n(()=>Te("h4")),h5:n(()=>Te("h5")),h6:n(()=>Te("h6"))}}const y_=["color","font-size","font-family","background-color"],t0=new Set(["font-weight","font-style","text-decoration","text-decoration-line","vertical-align"]),n0={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},r0=["span","b","em","i","strong","u","s","sub","sup","code","mark"];function i0(n,e,t){if(!R(e))return;const r=n.fontWeight,i=n.textDecoration.split(" ");(r==="700"||r==="bold")&&!e.hasFormat("bold")&&e.toggleFormat("bold"),n.fontStyle==="italic"&&!e.hasFormat("italic")&&e.toggleFormat("italic"),i.includes("line-through")&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),i.includes("underline")&&!e.hasFormat("underline")&&e.toggleFormat("underline"),n.verticalAlign==="sub"&&!e.hasFormat("subscript")&&e.toggleFormat("subscript"),n.verticalAlign==="super"&&!e.hasFormat("superscript")&&e.toggleFormat("superscript"),t&&!e.hasFormat(t)&&e.toggleFormat(t)}function b_(n=y_){const e={};for(const t of r0)e[t]=r=>{const i=r.style,s=n0[t],o=t==="b"?i.fontWeight!=="normal"?"bold":void 0:s;return{conversion:()=>({node:null,forChild:l=>{if(!R(l))return l;i0(i,l,o);let a=l.getStyle();for(const c of n){if(t0.has(c))continue;const u=i.getPropertyValue(c);u&&(a=Hu(a,c,u))}return a&&l.setStyle(a),l}}),priority:1}};return e}function Ns(n){return{...e0(),...b_(n)}}async function As(n={}){const{nodes:e=[],plugins:t=[],onError:r}=n,s=(await p_()).createEditor({namespace:"BeatUIHeadless",nodes:e,onError:o=>{r?r(o,s):console.error("[BeatUI Headless]",o)},editable:!1,html:{export:Wl(),import:Ns()}});if(t.length>0)for(const o of t)o.register(s);return s}async function s0(n){const e=await As(),{importFromMarkdown:t}=await Promise.resolve().then(()=>Ku);return await t(e,n),e.getEditorState().toJSON()}async function o0(n){const e=await As(),{exportToMarkdown:t}=await Promise.resolve().then(()=>Ku),r=e.parseEditorState(JSON.stringify(n));return e.setEditorState(r),await t(e)}async function l0(n){const e=await As(),{importFromHtml:t}=await Promise.resolve().then(()=>Wu);return await t(e,n),e.getEditorState().toJSON()}async function a0(n){const e=await As(),{exportToHtml:t}=await Promise.resolve().then(()=>Wu),r=e.parseEditorState(JSON.stringify(n));return e.setEditorState(r),await t(e)}const x_=n=>{const{value:e,format:t,plugins:r,readOnly:i,placeholder:s,class:o,namespace:l="BeatUILexical",heightMode:a="auto",autoFocus:c=!1,onError:u,onInput:d,onChange:f,onBlur:h,onReady:g}=n;return E.Use(Sc.Theme,({appearance:p})=>E.html.div(E.Task(()=>Promise.resolve().then(()=>require("../styles-url-CkPTI32j.cjs")),({default:m})=>xc.LinkPortal({id:"beatui-lexical-css",href:m})),E.attr.class("bc-lexical-editor-container"),a==="fixed"?E.attr.class("bc-lexical-editor-container--fixed"):null,E.attr.class(o),E.html.div(E.attr.class("bc-lexical-editor"),E.attr.class(`bc-lexical-editor--${a}`),E.attr.contenteditable(i!=null?E.Value.map(i,m=>!m):!0),i!=null?E.attr.class(E.Value.map(i,m=>m?"bc-lexical-editor--readonly":"")):null,E.WithElement(m=>{let b=null;const _=[];return(async()=>{try{const C=r??yl("bare"),S=_l(C),w=E.Value.get(t??"markdown"),x=ui({namespace:l,nodes:S,theme:{heading:{h1:"bc-lexical-h1",h2:"bc-lexical-h2",h3:"bc-lexical-h3",h4:"bc-lexical-h4",h5:"bc-lexical-h5",h6:"bc-lexical-h6"},text:{bold:"bc-lexical-bold",italic:"bc-lexical-italic",underline:"bc-lexical-underline",strikethrough:"bc-lexical-strikethrough",code:"bc-lexical-code"},list:{ul:"bc-lexical-ul",ol:"bc-lexical-ol",listitem:"bc-lexical-li",listitemChecked:"bc-lexical-li-checked",listitemUnchecked:"bc-lexical-li-unchecked"},link:"bc-lexical-link",quote:"bc-lexical-blockquote",code:"bc-lexical-code-block",codeHighlight:{},hashtag:"bc-lexical-hashtag",table:"bc-lexical-table",tableCell:"bc-lexical-table-cell",tableCellHeader:"bc-lexical-table-cell-header",tableRow:"bc-lexical-table-row",mark:"bc-lexical-mark",paragraph:"bc-lexical-paragraph"},onError:O=>{u?u(O,x):console.error("[BeatUI Lexical]",O)},editable:i?!E.Value.get(i):!0,html:{export:Wl(),import:Ns()}});b=x,x.setRootElement(m);const T=[];if(C.richText?T.push(Il(x)):C.plainText&&T.push($l(x)),C.history){const O=typeof C.history=="object"?C.history:void 0;T.push(Fl(x,O))}if(C.clipboard&&T.push(Rl(x)),C.list&&T.push(Dl(x)),C.link&&T.push(Ll(x)),C.yjs&&T.push(Ul(x,C.yjs)),C.dragon&&T.push(Bl(x)),C.table&&T.push(zl(x)),(await Promise.all(T)).forEach(O=>{O&&_.push(O)}),_.push(Pl(x)),_.push(Ju(x)),e!=null){const O=E.Value.get(e);if(O!=null&&(O!==""||w==="json"&&typeof O=="object")){if(w==="markdown"&&typeof O=="string")await Bn(x,O);else if(w==="html"&&typeof O=="string")await Un(x,O);else if(w==="json"&&typeof O=="object")try{const k=JSON.stringify(O),L=x.parseEditorState(k);x.setEditorState(L)}catch(k){console.error("[BeatUI] Failed to parse JSON editor state:",k),u&&u(k instanceof Error?k:new Error(String(k)),x)}}}if(_.push(x.registerUpdateListener(({editorState:O,dirtyElements:I,dirtyLeaves:k})=>{I.size===0&&k.size===0||d&&O.read(async()=>{if(w==="markdown"){const L=await bt(x);d(L,x)}else if(w==="html"){const L=await xt(x);d(L,x)}else w==="json"&&d(O.toJSON(),x)})})),e!=null&&_.push(E.Value.on(e,async O=>{if(O!=null){if(w==="markdown"&&typeof O=="string"){const I=await bt(x);O!==I&&await Bn(x,O)}else if(w==="html"&&typeof O=="string"){const I=await xt(x);O!==I&&await Un(x,O)}else if(w==="json"&&typeof O=="object"){const I=JSON.stringify(x.getEditorState().toJSON()),k=JSON.stringify(O);if(I!==k){const L=x.parseEditorState(k);x.setEditorState(L)}}}})),i!=null&&_.push(E.Value.on(i,O=>{x.setEditable(!O)})),_.push(x.registerCommand(ai,()=>(h&&h(x),f&&x.getEditorState().read(async()=>{if(w==="markdown"){const O=await bt(x);f(O,x)}else if(w==="html"){const O=await xt(x);f(O,x)}else w==="json"&&f(x.getEditorState().toJSON(),x)}),!1),q)),_.push(p.on(O=>{const I=x.getRootElement();I&&(I.dataset.theme=O)})),c)x.focus();else{const O=x.getRootElement();O&&O===document.activeElement&&O.blur()}g&&g(x)}catch(C){console.error("[BeatUI] Failed to initialize Lexical editor:",C);const S=m;S.textContent="Failed to load Lexical editor."}})(),E.OnDispose(()=>{try{_.forEach(C=>C())}catch{}try{b?.setRootElement(null)}catch{}})}))))};function S_(n,e,t){const r=(h,g)=>e.map(()=>{const p=n.value;return p?p.getEditorState().read(()=>{const m=M();return N(m)?h(m):g}):g}),i=h=>{const g=h.anchor.getNode();return g.getKey()==="root"?g:g.getTopLevelElementOrThrow()};return{withSelection:r,getAnchorElement:i,textFormatActive:h=>r(g=>g.hasFormat(h),!1),blockTypeActive:h=>r(g=>i(g).getType()===h,!1),listTypeActive:h=>r(g=>{const p=i(g).getParent();return Y(p)&&p.getListType()===h},!1),headingActive:h=>e.map(()=>{const g=n.value;return g?g.getEditorState().read(()=>{const p=M();if(N(p)){const m=i(p);if(m.getType()==="heading")return g.getElementByKey(m.getKey())?.tagName===`H${h}`}return!1}):!1}),linkActive:()=>r(h=>{const g=h.anchor.getNode();return g.getParent()?.getType()==="link"||g.getType()==="link"},!1),dispatch:(h,g)=>()=>{const p=n.value;p&&(p.dispatchCommand(h,g),p.focus())},toggleBlock:(h,g)=>()=>{const p=n.value;p&&(p.update(()=>{const m=M();if(N(m)){const b=i(m);Qe(m,()=>b.getType()===h?J():g())}}),p.focus())},toggleLink:()=>{const h=n.value;h&&(h.getEditorState().read(()=>{const g=M();if(N(g)){const p=g.anchor.getNode();if(p.getParent()?.getType()==="link"||p.getType()==="link")h.dispatchCommand(ic,null);else{const _=prompt(t?.enterUrlMessage?.()??"Enter URL:");_&&h.dispatchCommand(ic,_)}}}),h.focus())}}}function C_(n,e){return t=>r=>Ah.EditorToolbarButton({...r,display:t,disabled:n,size:e})}const c0={font:["font-family","font-size"],color:["font-color","highlight-color","background-color"],"text-formatting":["bold","italic","underline","strikethrough","code"],"clear-formatting":["clear-formatting"],headings:["paragraph","heading-1","heading-2","heading-3","heading-4","heading-5","heading-6"],lists:["bullet-list","ordered-list","check-list"],indent:["indent","outdent"],blocks:["blockquote","code-block","horizontal-rule"],tables:["insert-table"],links:["link"],history:["undo","redo"],clipboard:["cut","copy","paste"]},u0=["font","color","text-formatting","clear-formatting","headings","lists","indent","blocks","tables","links","history","clipboard"];function d0(){return u0.map(n=>({group:n}))}function f0(n){if(n.layout)return n.layout;const{visibleGroups:e,hiddenGroups:t}=n,r=d0();return!e&&!t?r:r.filter(i=>{if("separator"in i)return!0;const s=i.group;return!(t?.includes(s)||e&&!e.includes(s))})}const h0=[{value:"Arial",label:"Arial"},{value:"Courier New",label:"Courier New"},{value:"Georgia",label:"Georgia"},{value:"Times New Roman",label:"Times New Roman"},{value:"Trebuchet MS",label:"Trebuchet MS"},{value:"Verdana",label:"Verdana"}],g0=[{value:"10px",label:"10"},{value:"12px",label:"12"},{value:"14px",label:"14"},{value:"16px",label:"16"},{value:"18px",label:"18"},{value:"20px",label:"20"},{value:"24px",label:"24"},{value:"30px",label:"30"},{value:"36px",label:"36"}];function w_({editor:n,stateUpdate:e,toolbar:t={},readOnly:r=E.signal(!1),size:i="sm"}){const{maxHeadingLevel:s=3}=t,o=f0(t);return E.Use(He.BeatUII18n,l=>E.Ensure(n,a=>{const c=a,u=l.$.lexical,{getAnchorElement:d,textFormatActive:f,blockTypeActive:h,listTypeActive:g,headingActive:p,linkActive:m,dispatch:b,toggleBlock:_,toggleLink:y}=S_(c,e,{enterUrlMessage:()=>l.value.lexical.enterUrl}),S=C_(r,i)(E.signal(!0)),w=()=>{const $=c.value;$&&($.update(()=>{const P=M();N(P)&&Qe(P,()=>J())}),$.focus())},x=$=>{const P=c.value;P&&(P.update(()=>{const X=M();if(N(X)){const pe=d(X),Rt=`h${$}`,Jn=P.getElementByKey(pe.getKey());pe.getType()==="heading"&&Jn?.tagName===`H${$}`?Qe(X,()=>J()):Qe(X,()=>Te(Rt))}}),P.focus())},T=()=>{const $=c.value;if(!$)return;const P=$.getRootElement();P&&(P.focus(),document.execCommand("copy"))},v=()=>{const $=c.value;if(!$)return;const P=$.getRootElement();P&&(P.focus(),document.execCommand("cut"))},O=()=>{const $=c.value;$&&navigator.clipboard.readText().then(P=>{$.update(()=>{const X=M();N(X)&&X.insertText(P)}),$.focus()}).catch(()=>{})},I=()=>{const $=c.value;$&&($.update(()=>{const P=M();if(N(P))for(const X of P.getNodes())R(X)&&(X.setFormat(0),X.setStyle(""))}),$.focus())},k=()=>{const $=c.value;$&&($.dispatchCommand(ws,{rows:"3",columns:"3",includeHeaders:!0}),$.focus())},L={value:"",label:l.value.lexical.defaultOption},K=[L,...t.fontFamilies??h0],F=[L,...t.fontSizes??g0],W=e.map(()=>{const $=c.value;return $?$.getEditorState().read(()=>{const P=M();return N(P)?Ds(P,"font-family",""):""}):""}),V=e.map(()=>{const $=c.value;return $?$.getEditorState().read(()=>{const P=M();return N(P)?Ds(P,"font-size",""):""}):""}),G=$=>{const P=c.value;P&&(P.update(()=>{const X=M();N(X)&&Rs(X,{"font-family":$||null})}),P.focus())},oe=$=>{const P=c.value;P&&(P.update(()=>{const X=M();N(X)&&Rs(X,{"font-size":$||null})}),P.focus())},We=e.map(()=>{const $=c.value;return $?$.getEditorState().read(()=>{const P=M();return N(P)&&Ds(P,"color","")||"#000000"}):"#000000"}),wt=e.map(()=>{const $=c.value;return $?$.getEditorState().read(()=>{const P=M();return N(P)&&Ds(P,"background-color","")||"#ffffff"}):"#ffffff"}),j=e.map(()=>{const $=c.value;return $?$.getEditorState().read(()=>{const P=M();if(N(P)){const pe=d(P).getStyle();return Kl(pe,"background-color")||"#ffffff"}return"#ffffff"}):"#ffffff"}),Ce=$=>{const P=c.value;P&&(P.update(()=>{const X=M();N(X)&&Rs(X,{color:$})}),P.focus())},fe=$=>{const P=c.value;P&&(P.update(()=>{const X=M();N(X)&&Rs(X,{"background-color":$})}),P.focus())},Ze=$=>{const P=c.value;P&&(P.update(()=>{const X=M();if(N(X)){const pe=d(X),Rt=pe.getStyle(),Jn=Hu(Rt,"background-color",$);pe.setStyle(Jn)}}),P.focus())},H=new Map;H.set("bold",()=>S({active:f("bold"),onClick:b(ve,"bold"),label:u.map($=>$.bold),icon:"mdi:format-bold"})),H.set("italic",()=>S({active:f("italic"),onClick:b(ve,"italic"),label:u.map($=>$.italic),icon:"mdi:format-italic"})),H.set("underline",()=>S({active:f("underline"),onClick:b(ve,"underline"),label:u.map($=>$.underline),icon:"mdi:format-underline"})),H.set("strikethrough",()=>S({active:f("strikethrough"),onClick:b(ve,"strikethrough"),label:u.map($=>$.strikethrough),icon:"mdi:format-strikethrough"})),H.set("code",()=>S({active:f("code"),onClick:b(ve,"code"),label:u.map($=>$.code),icon:"mdi:code-tags"})),H.set("clear-formatting",()=>S({active:E.signal(!1),onClick:I,label:u.map($=>$.clearFormatting),icon:"mdi:format-clear"})),H.set("paragraph",()=>S({active:h("paragraph"),onClick:w,label:u.map($=>$.normal),icon:"mdi:format-paragraph"}));for(let $=1;$<=s;$++)H.set(`heading-${$}`,()=>S({active:p($),onClick:()=>x($),label:u.map(P=>P.heading($)),icon:`mdi:format-header-${$}`}));return H.set("bullet-list",()=>S({active:g("bullet"),onClick:b(pi,void 0),label:u.map($=>$.bulletList),icon:"mdi:format-list-bulleted"})),H.set("ordered-list",()=>S({active:g("number"),onClick:b(mi,void 0),label:u.map($=>$.orderedList),icon:"mdi:format-list-numbered"})),H.set("check-list",()=>S({active:g("check"),onClick:b(gl,void 0),label:u.map($=>$.checkList),icon:"mdi:format-list-checks"})),H.set("indent",()=>S({active:E.signal(!1),onClick:b(Bt,void 0),label:u.map($=>$.indent),icon:"mdi:format-indent-increase"})),H.set("outdent",()=>S({active:E.signal(!1),onClick:b(nn,void 0),label:u.map($=>$.outdent),icon:"mdi:format-indent-decrease"})),H.set("blockquote",()=>S({active:h("quote"),onClick:_("quote",gi),label:u.map($=>$.blockquote),icon:"mdi:format-quote-close"})),H.set("code-block",()=>S({active:h("code"),onClick:_("code",_t),label:u.map($=>$.codeBlock),icon:"mdi:code-braces"})),H.set("horizontal-rule",()=>S({active:E.signal(!1),onClick:b(Ts,void 0),label:u.map($=>$.horizontalRule),icon:"mdi:minus"})),H.set("insert-table",()=>S({active:E.signal(!1),onClick:k,label:u.map($=>$.insertTable),icon:"mdi:table-plus"})),H.set("link",()=>S({active:m(),onClick:y,label:u.map($=>$.link),icon:"mdi:link"})),H.set("undo",()=>S({active:E.signal(!1),onClick:b(ii,void 0),label:u.map($=>$.undo),icon:"mdi:undo"})),H.set("redo",()=>S({active:E.signal(!1),onClick:b(si,void 0),label:u.map($=>$.redo),icon:"mdi:redo"})),H.set("cut",()=>S({active:E.signal(!1),onClick:v,label:u.map($=>$.cut),icon:"mdi:content-cut"})),H.set("copy",()=>S({active:E.signal(!1),onClick:T,label:u.map($=>$.copy),icon:"mdi:content-copy"})),H.set("paste",()=>S({active:E.signal(!1),onClick:O,label:u.map($=>$.paste),icon:"mdi:content-paste"})),H.set("font-family",()=>E.html.select(E.attr.class("bc-lexical-toolbar-select"),E.attr.title(u.map($=>$.fontFamily)),E.attr.disabled(r),E.on.change($=>G($.target.value)),...K.map($=>E.html.option(E.attr.value($.value),E.attr.selected(W.map(P=>P===$.value)),$.label)))),H.set("font-size",()=>E.html.select(E.attr.class("bc-lexical-toolbar-select"),E.attr.title(u.map($=>$.fontSize)),E.attr.disabled(r),E.on.change($=>oe($.target.value)),...F.map($=>E.html.option(E.attr.value($.value),E.attr.selected(V.map(P=>P===$.value)),$.label)))),H.set("font-color",()=>E.html.label(E.attr.class("bc-lexical-toolbar-color"),E.attr.title(u.map($=>$.fontColor)),E.html.input(E.attr.type("color"),E.attr.value(We),E.attr.disabled(r),E.on.input($=>Ce($.target.value))),E.html.span(E.attr.class("bc-lexical-toolbar-color-icon"),"A"))),H.set("highlight-color",()=>E.html.label(E.attr.class("bc-lexical-toolbar-color"),E.attr.title(u.map($=>$.highlightColor)),E.html.input(E.attr.type("color"),E.attr.value(wt),E.attr.disabled(r),E.on.input($=>fe($.target.value))),E.html.span(E.attr.class("bc-lexical-toolbar-color-icon bc-lexical-toolbar-color-icon--highlight"),"A"))),H.set("background-color",()=>E.html.label(E.attr.class("bc-lexical-toolbar-color"),E.attr.title(u.map($=>$.backgroundColor)),E.html.input(E.attr.type("color"),E.attr.value(j),E.attr.disabled(r),E.on.input($=>Ze($.target.value))),E.html.span(E.attr.class("bc-lexical-toolbar-color-icon bc-lexical-toolbar-color-icon--bg"),"■"))),Oh.Toolbar(E.attr.class("bc-lexical-toolbar"),...p0(o,H,s))}))}function p0(n,e,t){const r=[];for(const i of n){if("separator"in i){r.push(Oh.ToolbarDivider());continue}let s=i.items??c0[i.group]??[];i.group==="headings"&&!i.items&&(s=s.filter(a=>a.startsWith("heading-")?parseInt(a.split("-")[1],10)<=t:!0));const o=[];for(const a of s){const c=e.get(a);c&&o.push(c())}if(o.length===0)continue;const l=o.map(()=>E.signal(!0));r.push(Ah.EditorToolbarGroup({display:l},...o))}return r}function v_({editor:n,stateUpdate:e,readOnly:t=E.signal(!1)}){const r=E.prop(!1),i=E.prop(0),s=E.prop(0);let o=null,l=null;const a=E.prop(!1),c=C=>{let S=null;return C.getEditorState().read(()=>{const w=M();if(!N(w))return;let x=w.anchor.getNode();for(;x;){if(me(x)){S=x;break}if(x=x.getParent(),!x||x.getKey()==="root")break}}),S},u=(C,S)=>{const w=C.getBoundingClientRect(),x=S.closest(".bc-lexical-editor-container"),T=x?x.getBoundingClientRect():S.getBoundingClientRect();return i.value=w.top-T.top+2,s.value=T.right-w.right+2,!0},d=()=>{const C=n.value;if(!C){r.value=!1;return}const S=c(C);if(!S){a.value||(r.value=!1);return}const w=C.getElementByKey(S.getKey()),x=C.getRootElement();w&&x?(u(w,x),r.value=!0):r.value=!1};e.onChange(d);const f=C=>()=>{const S=n.value;S&&(S.update(C),l?.(),S.focus())},h=f(()=>pf(!1)),g=f(()=>pf(!0)),p=f(()=>mf(!1)),m=f(()=>mf(!0)),b=f(()=>cx()),_=f(()=>ux()),y=f(()=>{const C=M();if(!N(C))return;const S=C.anchor.getNode(),w=ax(S);if(!w)return;$p(w).remove()});return E.Use(He.BeatUII18n,C=>E.Ensure(n,S=>{const w=S,x=C.$.lexical,T=k=>{const L=w.value;if(!L||t.value)return;const K=L.getRootElement();if(!K)return;const W=k.target.closest("td, th");W&&K.contains(W)&&(k.preventDefault(),u(W,K)&&(r.value=!0),requestAnimationFrame(()=>{o?.()}))},v=w.value?.getRootElement(),I=v?.closest(".bc-lexical-editor-container")??v??document;return I.addEventListener("contextmenu",T),[E.OnDispose(()=>{I.removeEventListener("contextmenu",T)}),E.When(r,()=>E.html.div(E.attr.class("bc-table-cell-marker"),E.style.position("absolute"),E.style.top(i.map(k=>`${k}px`)),E.style.right(s.map(k=>`${k}px`)),E.style.zIndex("10"),E.WithElement(k=>{k.addEventListener("mousedown",L=>{L.preventDefault()})}),E.html.button(E.attr.class("bc-table-cell-marker__button"),E.attr.type("button"),E.attr.title(x.map(k=>k.tableActions)),E.attr.disabled(t),He.Icon({icon:"lucide:chevron-down",size:"xs"}),E.WithElement(k=>{const L=new MutationObserver(()=>{const K=k.getAttribute("aria-expanded")==="true";a.value=K});return L.observe(k,{attributes:!0,attributeFilter:["aria-expanded"]}),E.OnDispose(()=>L.disconnect())}),vt.Menu({items:()=>[vt.MenuItem({key:"insert-row-above",content:x.map(k=>k.insertRowAbove),startContent:He.Icon({icon:"lucide:arrow-up",size:"sm"}),onClick:h,disabled:t}),vt.MenuItem({key:"insert-row-below",content:x.map(k=>k.insertRowBelow),startContent:He.Icon({icon:"lucide:arrow-down",size:"sm"}),onClick:g,disabled:t}),vt.MenuItem({key:"insert-column-left",content:x.map(k=>k.insertColumnLeft),startContent:He.Icon({icon:"lucide:arrow-left",size:"sm"}),onClick:p,disabled:t}),vt.MenuItem({key:"insert-column-right",content:x.map(k=>k.insertColumnRight),startContent:He.Icon({icon:"lucide:arrow-right",size:"sm"}),onClick:m,disabled:t}),vt.MenuSeparator(),vt.MenuItem({key:"delete-row",content:x.map(k=>k.deleteRow),startContent:He.Icon({icon:"lucide:trash-2",size:"sm"}),onClick:b,disabled:t}),vt.MenuItem({key:"delete-column",content:x.map(k=>k.deleteColumn),startContent:He.Icon({icon:"lucide:trash-2",size:"sm"}),onClick:_,disabled:t}),vt.MenuItem({key:"delete-table",content:x.map(k=>k.deleteTable),startContent:He.Icon({icon:"lucide:trash-2",size:"sm"}),onClick:y,disabled:t})],placement:"bottom-end",showOn:(k,L)=>(o=k,l=L,E.on.click(()=>{a.value?L():(k(),a.value=!0)})),showDelay:0,hideDelay:0,mainAxisOffset:4,onClose:()=>{const k=w.value;k&&k.focus()},ariaLabel:x.map(k=>k.tableActions)}))))]}))}const m0=n=>{const{value:e,format:t,plugins:r,readOnly:i,placeholder:s,class:o,namespace:l="BeatUILexical",heightMode:a="fixed",toolbar:c,autoFocus:u=!1,onError:d,onInput:f,onChange:h,onBlur:g,onReady:p}=n,m=E.prop(null),b=E.prop(0),_=C=>typeof C=="object"&&C!==null&&"map"in C&&typeof C.map=="function",y=i!=null?_(i)?i:E.prop(E.Value.get(i)):E.prop(!1);return E.Use(Sc.Theme,({appearance:C})=>E.html.div(E.Task(()=>Promise.resolve().then(()=>require("../styles-url-CkPTI32j.cjs")),({default:S})=>xc.LinkPortal({id:"beatui-lexical-css",href:S})),E.attr.class("bc-lexical-editor-container"),a==="fixed"?E.attr.class("bc-lexical-editor-container--fixed"):null,E.attr.class(o),E.When(y.map(S=>!S),()=>w_({editor:m,stateUpdate:b,toolbar:c,readOnly:y,size:"sm"})),v_({editor:m,stateUpdate:b,readOnly:y}),E.html.div(E.attr.class("bc-lexical-editor"),E.attr.class(`bc-lexical-editor--${a}`),E.attr.contenteditable(i!=null?E.Value.map(i,S=>!S):!0),i!=null?E.attr.class(E.Value.map(i,S=>S?"bc-lexical-editor--readonly":"")):null,E.WithElement(S=>{let w=null;const x=[];return(async()=>{try{const v=r??yl("docked"),O=_l(v),I=E.Value.get(t??"markdown"),k=ui({namespace:l,nodes:O,theme:{heading:{h1:"bc-lexical-h1",h2:"bc-lexical-h2",h3:"bc-lexical-h3",h4:"bc-lexical-h4",h5:"bc-lexical-h5",h6:"bc-lexical-h6"},text:{bold:"bc-lexical-bold",italic:"bc-lexical-italic",underline:"bc-lexical-underline",strikethrough:"bc-lexical-strikethrough",code:"bc-lexical-code"},list:{ul:"bc-lexical-ul",ol:"bc-lexical-ol",listitem:"bc-lexical-li",listitemChecked:"bc-lexical-li-checked",listitemUnchecked:"bc-lexical-li-unchecked"},link:"bc-lexical-link",quote:"bc-lexical-blockquote",code:"bc-lexical-code-block",codeHighlight:{},hashtag:"bc-lexical-hashtag",table:"bc-lexical-table",tableCell:"bc-lexical-table-cell",tableCellHeader:"bc-lexical-table-cell-header",tableRow:"bc-lexical-table-row",mark:"bc-lexical-mark",paragraph:"bc-lexical-paragraph"},onError:F=>{d?d(F,k):console.error("[BeatUI Lexical]",F)},editable:i?!E.Value.get(i):!0,html:{export:Wl(),import:Ns()}});w=k,m.set(k),k.setRootElement(S);const L=[];if(v.richText?L.push(Il(k)):v.plainText&&L.push($l(k)),v.history){const F=typeof v.history=="object"?v.history:void 0;L.push(Fl(k,F))}if(v.clipboard&&L.push(Rl(k)),v.list&&L.push(Dl(k)),v.link&&L.push(Ll(k)),v.yjs&&L.push(Ul(k,v.yjs)),v.dragon&&L.push(Bl(k)),v.table&&L.push(zl(k)),(await Promise.all(L)).forEach(F=>{F&&x.push(F)}),x.push(Pl(k)),x.push(Ju(k)),x.push(k.registerCommand(ni,()=>(b.set(b.value+1),!1),q)),x.push(k.registerUpdateListener(({editorState:F,dirtyElements:W,dirtyLeaves:V})=>{(W.size>0||V.size>0)&&b.set(b.value+1),f&&(W.size>0||V.size>0)&&F.read(async()=>{if(I==="markdown"){const G=await bt(k);f(G,k)}else if(I==="html"){const G=await xt(k);f(G,k)}else I==="json"&&f(F.toJSON(),k)})})),e!=null){const F=E.Value.get(e);if(F!=null&&(F!==""||I==="json"&&typeof F=="object")){if(I==="markdown"&&typeof F=="string")await Bn(k,F);else if(I==="html"&&typeof F=="string")await Un(k,F);else if(I==="json"&&typeof F=="object")try{const V=JSON.stringify(F),G=k.parseEditorState(V);k.setEditorState(G)}catch(V){console.error("[BeatUI] Failed to parse JSON editor state:",V),d&&d(V instanceof Error?V:new Error(String(V)),k)}}}if(e!=null&&x.push(E.Value.on(e,async F=>{if(F!=null){if(I==="markdown"&&typeof F=="string"){const W=await bt(k);F!==W&&await Bn(k,F)}else if(I==="html"&&typeof F=="string"){const W=await xt(k);F!==W&&await Un(k,F)}else if(I==="json"&&typeof F=="object"){const W=JSON.stringify(k.getEditorState().toJSON()),V=JSON.stringify(F);if(W!==V){const G=k.parseEditorState(V);k.setEditorState(G)}}}})),i!=null&&x.push(E.Value.on(i,F=>{k.setEditable(!F)})),x.push(k.registerCommand(ai,()=>(g&&g(k),h&&k.getEditorState().read(async()=>{if(I==="markdown"){const F=await bt(k);h(F,k)}else if(I==="html"){const F=await xt(k);h(F,k)}else I==="json"&&h(k.getEditorState().toJSON(),k)}),!1),q)),x.push(C.on(F=>{const W=k.getRootElement();W&&(W.dataset.theme=F)})),u)k.focus();else{const F=k.getRootElement();F&&F===document.activeElement&&F.blur()}p&&p(k)}catch(v){console.error("[BeatUI] Failed to initialize Lexical editor:",v);const O=S;O.textContent="Failed to load Lexical editor."}})(),E.OnDispose(()=>{try{x.forEach(v=>v())}catch{}try{w?.setRootElement(null)}catch{}m.set(null)})}))))};function E_({editor:n,stateUpdate:e,groups:t=["text-formatting"],readOnly:r=E.signal(!1),size:i="sm"}){const s=E.prop(!1),o=E.prop(0),l=E.prop(0);return E.Use(He.BeatUII18n,a=>E.Ensure(n,c=>{const u=c,d=a.$.lexical,f=x=>t.includes(x),{textFormatActive:h,linkActive:g,dispatch:p,toggleLink:m}=S_(u,e,{enterUrlMessage:()=>a.value.lexical.enterUrl}),_=C_(r,i)(E.signal(!0)),y=()=>{const x=u.value;if(!x){s.value=!1;return}const T=x.getRootElement();if(!T){s.value=!1;return}const v=window.getSelection();if(!v||v.rangeCount===0||v.isCollapsed){s.value=!1;return}const O=v.anchorNode;if(O&&!T.contains(O)){s.value=!1;return}const k=v.getRangeAt(0).getBoundingClientRect();if(k.width===0&&k.height===0){s.value=!1;return}const L=40,K=8;let F=k.top-L-K;const W=k.left+k.width/2;F<0&&(F=k.bottom+K),o.value=F,l.value=W,s.value=!0},C=e.onChange(y),S=()=>{y()};document.addEventListener("selectionchange",S);const w=E.html.div(E.attr.class("bc-floating-toolbar"),E.style.position("fixed"),E.style.top(o.map(x=>`${x}px`)),E.style.left(l.map(x=>`${x}px`)),E.style.transform("translateX(-50%)"),E.WithElement(x=>{const T=O=>{if(O.key==="Escape"&&s.value){s.value=!1;const I=u.value;I&&I.focus()}},v=O=>{if(s.value&&!x.contains(O.target)){const I=u.value;if(I){const k=I.getRootElement();if(k&&k.contains(O.target))return}s.value=!1}};return document.addEventListener("keydown",T),document.addEventListener("mousedown",v),E.OnDispose(()=>{C(),document.removeEventListener("keydown",T),document.removeEventListener("mousedown",v),document.removeEventListener("selectionchange",S)})}),...f("text-formatting")?[_({active:h("bold"),onClick:p(ve,"bold"),label:d.map(x=>x.bold),icon:"mdi:format-bold"}),_({active:h("italic"),onClick:p(ve,"italic"),label:d.map(x=>x.italic),icon:"mdi:format-italic"}),_({active:h("underline"),onClick:p(ve,"underline"),label:d.map(x=>x.underline),icon:"mdi:format-underline"}),_({active:h("strikethrough"),onClick:p(ve,"strikethrough"),label:d.map(x=>x.strikethrough),icon:"mdi:format-strikethrough"}),_({active:h("code"),onClick:p(ve,"code"),label:d.map(x=>x.code),icon:"mdi:code-tags"})]:[],...f("links")?[_({active:g(),onClick:m,label:d.map(x=>x.link),icon:"mdi:link"})]:[],...f("clipboard")?[_({active:E.signal(!1),onClick:()=>{const x=u.value;if(!x)return;const T=x.getRootElement();T&&(T.focus(),document.execCommand("cut"))},label:d.map(x=>x.cut),icon:"mdi:content-cut"}),_({active:E.signal(!1),onClick:()=>{const x=u.value;if(!x)return;const T=x.getRootElement();T&&(T.focus(),document.execCommand("copy"))},label:d.map(x=>x.copy),icon:"mdi:content-copy"}),_({active:E.signal(!1),onClick:()=>{const x=u.value;x&&navigator.clipboard.readText().then(T=>{x.update(()=>{const v=M();N(v)&&v.insertText(T)}),x.focus()}).catch(()=>{})},label:d.map(x=>x.paste),icon:"mdi:content-paste"})]:[]);return E.When(s,()=>w)}))}const _0=[{id:"heading1",label:"Heading 1",description:"Large section heading",icon:"mdi:format-header-1",keywords:["h1","heading","title"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=M();N(e)&&Qe(e,()=>Te("h1"))})}},{id:"heading2",label:"Heading 2",description:"Medium section heading",icon:"mdi:format-header-2",keywords:["h2","heading"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=M();N(e)&&Qe(e,()=>Te("h2"))})}},{id:"heading3",label:"Heading 3",description:"Small section heading",icon:"mdi:format-header-3",keywords:["h3","heading"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=M();N(e)&&Qe(e,()=>Te("h3"))})}},{id:"bullet-list",label:"Bullet List",description:"Create a bulleted list",icon:"mdi:format-list-bulleted",keywords:["ul","unordered","bullets"],category:"Lists",handler:n=>{n.dispatchCommand(pi,void 0)}},{id:"ordered-list",label:"Ordered List",description:"Create a numbered list",icon:"mdi:format-list-numbered",keywords:["ol","numbered","1","2","3"],category:"Lists",handler:n=>{n.dispatchCommand(mi,void 0)}},{id:"quote",label:"Quote",description:"Insert a blockquote",icon:"mdi:format-quote-close",keywords:["blockquote","citation"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=M();N(e)&&Qe(e,()=>gi())})}},{id:"code-block",label:"Code Block",description:"Insert a code block",icon:"mdi:code-braces",keywords:["code","pre","programming"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=M();N(e)&&Qe(e,()=>_t())})}},{id:"divider",label:"Divider",description:"Insert a horizontal rule",icon:"mdi:minus",keywords:["hr","horizontal","line","separator"],category:"Basic blocks",handler:n=>{n.dispatchCommand(Ts,void 0)}},{id:"table",label:"Table",description:"Insert a table",icon:"mdi:table",keywords:["table","grid","cells","rows","columns"],category:"Advanced",handler:n=>{n.dispatchCommand(ws,{rows:"3",columns:"3",includeHeaders:!0})}}];function y0({commands:n,isVisible:e,filterText:t,position:r,onSelect:i,onDismiss:s}){const o=E.prop(0),l=t.map(f=>{const h=f.toLowerCase().trim();return h?n.filter(g=>[g.label.toLowerCase(),g.description?.toLowerCase()||"",...g.keywords?.map(m=>m.toLowerCase())||[]].join(" ").includes(h)):n});l.onChange(()=>{o.value=0});const a=f=>{const h=l.value;if(f>=0&&f<h.length){const g=h[f];i(g)}},c=f=>{if(!e.value)return;const g=l.value.length-1;switch(f.key){case"ArrowDown":f.preventDefault(),o.value=Math.min(o.value+1,g);break;case"ArrowUp":f.preventDefault(),o.value=Math.max(o.value-1,0);break;case"Enter":f.preventDefault(),a(o.value);break;case"Escape":f.preventDefault(),s();break}},u=(f,h)=>{const g=o.map(m=>m===h),p=`slash-cmd-${f.id}`;return E.html.div(E.attr.class("bc-slash-command-palette__item"),E.attr.id(p),E.attr.role("option"),E.aria.selected(g),E.WithElement(m=>{const b=()=>{o.value=h},_=()=>{a(h)};return m.addEventListener("mouseenter",b),m.addEventListener("click",_),E.OnDispose(()=>{m.removeEventListener("mouseenter",b),m.removeEventListener("click",_)})}),typeof f.icon=="string"?E.html.div(E.attr.class("bc-slash-command-palette__icon"),He.Icon({icon:f.icon,size:"sm"})):f.icon,E.html.div(E.attr.class("bc-slash-command-palette__content"),E.html.div(E.attr.class("bc-slash-command-palette__label"),f.label),f.description?E.html.div(E.attr.class("bc-slash-command-palette__description"),f.description):void 0),f.category?E.html.div(E.attr.class("bc-slash-command-palette__category"),f.category):void 0)},d=E.Use(He.BeatUII18n,f=>E.html.div(E.attr.class("bc-slash-command-palette"),E.attr.role("listbox"),E.aria.label(f.$.lexical.map(h=>h.slashCommands)),E.style.position("absolute"),E.style.top(r.map(h=>`${h.top}px`)),E.style.left(r.map(h=>`${h.left}px`)),E.WithElement(()=>(document.addEventListener("keydown",c),E.OnDispose(()=>{document.removeEventListener("keydown",c)}))),E.When(l.map(h=>h.length===0),()=>E.html.div(E.attr.class("bc-slash-command-palette__empty"),f.$.lexical.map(h=>h.noCommandsFound))),E.ForEach(l,(h,g)=>{const p=h.value;return u(p,g.index)})));return E.When(e,()=>d)}const k_=[{id:"paragraph",label:"Paragraph",icon:"mdi:format-paragraph",handler:n=>{n.update(()=>{const e=M();N(e)&&Qe(e,()=>J())})}},{id:"heading1",label:"Heading 1",icon:"mdi:format-header-1",handler:n=>{n.update(()=>{const e=M();N(e)&&Qe(e,()=>Te("h1"))})}},{id:"heading2",label:"Heading 2",icon:"mdi:format-header-2",handler:n=>{n.update(()=>{const e=M();N(e)&&Qe(e,()=>Te("h2"))})}},{id:"heading3",label:"Heading 3",icon:"mdi:format-header-3",handler:n=>{n.update(()=>{const e=M();N(e)&&Qe(e,()=>Te("h3"))})}},{id:"bullet-list",label:"Bullet List",icon:"mdi:format-list-bulleted",handler:n=>{n.dispatchCommand(pi,void 0)}},{id:"ordered-list",label:"Ordered List",icon:"mdi:format-list-numbered",handler:n=>{n.dispatchCommand(mi,void 0)}},{id:"quote",label:"Quote",icon:"mdi:format-quote-close",handler:n=>{n.update(()=>{const e=M();N(e)&&Qe(e,()=>gi())})}},{id:"code-block",label:"Code Block",icon:"mdi:code-braces",handler:n=>{n.update(()=>{const e=M();N(e)&&Qe(e,()=>_t())})}},{id:"divider",label:"Divider",icon:"mdi:minus",handler:n=>{n.dispatchCommand(Ts,void 0)}},{id:"table",label:"Table",icon:"mdi:table",handler:n=>{n.dispatchCommand(ws,{rows:"3",columns:"3",includeHeaders:!0})}}];function T_({editor:n,stateUpdate:e,readOnly:t=E.signal(!1),commands:r=k_}){const i=E.prop(!1),s=E.prop(!1),o=E.prop(0),l=E.prop(0);return E.Use(He.BeatUII18n,a=>E.Ensure(n,c=>{const u=c;let d=null,f=!1,h=null,g=null;const p=24,m=4,b=200,_=I=>{if(I===d&&i.value)return;d=I;const k=I.getBoundingClientRect();o.value=k.top,l.value=k.left-p-m,i.value=!0},y=()=>{h!=null&&(clearTimeout(h),h=null)},C=()=>{s.value||(y(),h=setTimeout(()=>{h=null,s.value||(i.value=!1,d=null)},b))},S=()=>{const I=u.value;if(!I)return;const k=I.getRootElement();k&&(T(k),I.getEditorState().read(()=>{const L=M();if(N(L))try{const F=L.anchor.getNode().getTopLevelElementOrThrow(),W=I.getElementByKey(F.getKey());W&&_(W)}catch{}}))},w=I=>{if(s.value)return;const k=u.value;if(!k)return;const L=k.getRootElement();if(L)for(const K of Array.from(L.children)){const F=K.getBoundingClientRect();if(I.clientY>=F.top&&I.clientY<=F.bottom){y(),_(K);return}}},x=()=>{C()},T=I=>{f||(f=!0,I.addEventListener("mousemove",w),I.addEventListener("mouseleave",x))},v=e.onChange(S);return[E.OnDispose(()=>{v(),y();const I=u.value;if(I){const k=I.getRootElement();k&&f&&(k.removeEventListener("mousemove",w),k.removeEventListener("mouseleave",x))}}),E.When(i,()=>E.html.div(E.attr.class("bc-block-handle"),E.style.position("fixed"),E.style.top(o.map(I=>`${I}px`)),E.style.left(l.map(I=>`${I}px`)),E.on.mouseenter(y),E.on.mouseleave(()=>C()),E.WithElement(I=>{I.addEventListener("mousedown",k=>{k.preventDefault()})}),E.html.button(E.attr.class("bc-block-handle__button"),E.attr.type("button"),E.attr.title(a.$.lexical.map(I=>I.changeBlockType)),E.attr.disabled(t),He.Icon({icon:"mdi:drag-horizontal-variant",size:"sm"}),E.WithElement(I=>{const k=new MutationObserver(()=>{const L=I.getAttribute("aria-expanded")==="true";s.value=L});return k.observe(I,{attributes:!0,attributeFilter:["aria-expanded"]}),E.OnDispose(()=>k.disconnect())}),vt.Menu({items:()=>r.map(I=>vt.MenuItem({key:I.id,content:I.label,startContent:He.Icon({icon:I.icon,size:"sm"}),onClick:()=>{const k=u.value;k&&(I.handler(k),g?.(),k.focus())}})),placement:"bottom-start",showOn:(I,k)=>(g=k,E.on.click(()=>{s.value?k():(I(),s.value=!0)})),showDelay:0,hideDelay:0,mainAxisOffset:4,onClose:()=>{const I=u.value;I&&I.focus()},ariaLabel:a.value.lexical.blockTypes}))))]}))}const b0=n=>{const{value:e,format:t,plugins:r,readOnly:i,placeholder:s,class:o,namespace:l="BeatUILexical",heightMode:a="auto",floatingToolbarGroups:c,autoFocus:u=!1,onError:d,onInput:f,onChange:h,onBlur:g,onReady:p}=n,m=E.prop(null),b=E.prop(0),_=C=>typeof C=="object"&&C!==null&&"map"in C&&typeof C.map=="function",y=i!=null?_(i)?i:E.prop(E.Value.get(i)):E.prop(!1);return E.Use(Sc.Theme,({appearance:C})=>E.html.div(E.Task(()=>Promise.resolve().then(()=>require("../styles-url-CkPTI32j.cjs")),({default:S})=>xc.LinkPortal({id:"beatui-lexical-css",href:S})),E.attr.class("bc-lexical-editor-container"),a==="fixed"?E.attr.class("bc-lexical-editor-container--fixed"):null,E.attr.class(o),E_({editor:m,stateUpdate:b,groups:c??["text-formatting","links"],readOnly:y}),T_({editor:m,stateUpdate:b,readOnly:y}),v_({editor:m,stateUpdate:b,readOnly:y}),E.html.div(E.attr.class("bc-lexical-editor"),E.attr.class(`bc-lexical-editor--${a}`),E.attr.contenteditable(i!=null?E.Value.map(i,S=>!S):!0),i!=null?E.attr.class(E.Value.map(i,S=>S?"bc-lexical-editor--readonly":"")):null,E.WithElement(S=>{let w=null;const x=[];return(async()=>{try{const v=r??yl("contextual"),O=_l(v),I=E.Value.get(t??"markdown"),k=ui({namespace:l,nodes:O,theme:{heading:{h1:"bc-lexical-h1",h2:"bc-lexical-h2",h3:"bc-lexical-h3",h4:"bc-lexical-h4",h5:"bc-lexical-h5",h6:"bc-lexical-h6"},text:{bold:"bc-lexical-bold",italic:"bc-lexical-italic",underline:"bc-lexical-underline",strikethrough:"bc-lexical-strikethrough",code:"bc-lexical-code"},list:{ul:"bc-lexical-ul",ol:"bc-lexical-ol",listitem:"bc-lexical-li",listitemChecked:"bc-lexical-li-checked",listitemUnchecked:"bc-lexical-li-unchecked"},link:"bc-lexical-link",quote:"bc-lexical-blockquote",code:"bc-lexical-code-block",codeHighlight:{},hashtag:"bc-lexical-hashtag",table:"bc-lexical-table",tableCell:"bc-lexical-table-cell",tableCellHeader:"bc-lexical-table-cell-header",tableRow:"bc-lexical-table-row",mark:"bc-lexical-mark",paragraph:"bc-lexical-paragraph"},onError:F=>{d?d(F,k):console.error("[BeatUI Lexical]",F)},editable:i?!E.Value.get(i):!0,html:{export:Wl(),import:Ns()}});w=k,m.set(k),k.setRootElement(S);const L=[];if(v.richText?L.push(Il(k)):v.plainText&&L.push($l(k)),v.history){const F=typeof v.history=="object"?v.history:void 0;L.push(Fl(k,F))}if(v.clipboard&&L.push(Rl(k)),v.list&&L.push(Dl(k)),v.link&&L.push(Ll(k)),v.yjs&&L.push(Ul(k,v.yjs)),v.dragon&&L.push(Bl(k)),v.table&&L.push(zl(k)),(await Promise.all(L)).forEach(F=>{F&&x.push(F)}),x.push(Pl(k)),x.push(Ju(k)),x.push(k.registerCommand(ni,()=>(b.set(b.value+1),!1),q)),x.push(k.registerUpdateListener(({editorState:F,dirtyElements:W,dirtyLeaves:V})=>{(W.size>0||V.size>0)&&b.set(b.value+1),f&&(W.size>0||V.size>0)&&F.read(async()=>{if(I==="markdown"){const G=await bt(k);f(G,k)}else if(I==="html"){const G=await xt(k);f(G,k)}else I==="json"&&f(F.toJSON(),k)})})),e!=null){const F=E.Value.get(e);if(F!=null&&(F!==""||I==="json"&&typeof F=="object")){if(I==="markdown"&&typeof F=="string")await Bn(k,F);else if(I==="html"&&typeof F=="string")await Un(k,F);else if(I==="json"&&typeof F=="object")try{const V=JSON.stringify(F),G=k.parseEditorState(V);k.setEditorState(G)}catch(V){console.error("[BeatUI] Failed to parse JSON editor state:",V),d&&d(V instanceof Error?V:new Error(String(V)),k)}}}if(e!=null&&x.push(E.Value.on(e,async F=>{if(F!=null){if(I==="markdown"&&typeof F=="string"){const W=await bt(k);F!==W&&await Bn(k,F)}else if(I==="html"&&typeof F=="string"){const W=await xt(k);F!==W&&await Un(k,F)}else if(I==="json"&&typeof F=="object"){const W=JSON.stringify(k.getEditorState().toJSON()),V=JSON.stringify(F);if(W!==V){const G=k.parseEditorState(V);k.setEditorState(G)}}}})),i!=null&&x.push(E.Value.on(i,F=>{k.setEditable(!F)})),x.push(k.registerCommand(ai,()=>(g&&g(k),h&&k.getEditorState().read(async()=>{if(I==="markdown"){const F=await bt(k);h(F,k)}else if(I==="html"){const F=await xt(k);h(F,k)}else I==="json"&&h(k.getEditorState().toJSON(),k)}),!1),q)),x.push(C.on(F=>{const W=k.getRootElement();W&&(W.dataset.theme=F)})),u)k.focus();else{const F=k.getRootElement();F&&F===document.activeElement&&F.blur()}p&&p(k)}catch(v){console.error("[BeatUI] Failed to initialize Lexical editor:",v);const O=S;O.textContent="Failed to load Lexical editor."}})(),E.OnDispose(()=>{try{x.forEach(v=>v())}catch{}try{w?.setRootElement(null)}catch{}m.set(null)})}))))},x0=n=>{const{value:e,before:t,after:r,onChange:i,onInput:s,onBlur:o,disabled:l,hasError:a,name:c,placeholder:u,id:d,required:f,tabIndex:h,size:g,class:p,namespace:m,format:b,plugins:_,readOnly:y,onError:C,onReady:S,marks:w,autoFocus:x}=n,T=l!=null&&y!=null?E.computedOf(l,y)((v,O)=>(v??!1)||(O??!1)):l??y;return A_.InputContainer({disabled:l,hasError:a,size:g,baseContainer:!0,growInput:!0,focusableSelector:"[contenteditable]",before:t,after:r,input:E.html.div(E.attr.class("bc-lexical-editor-input"),E.attr.name(c),E.attr.id(d),f!=null?E.aria.required(f):null,h!=null?E.attr.tabindex(h):null,a!=null?E.attr.class(E.Value.map(a,v=>v?"bc-lexical-editor-input--error":"")):null,x_({value:e,format:b??"markdown",plugins:_,readOnly:T,placeholder:u,namespace:m,class:p,autoFocus:x,onError:C,onReady:S,onInput:s?(v,O)=>{s(v)}:void 0,onChange:i?(v,O)=>{i(v)}:void 0,onBlur:o?v=>{o()}:void 0}))})};exports.$createHorizontalRuleNode=vs;exports.$isHorizontalRuleNode=Gp;exports.BLUR_COMMAND=ai;exports.BareEditor=x_;exports.BlockHandle=T_;exports.CLEAR_EDITOR_COMMAND=$c;exports.CLICK_COMMAND=mr;exports.COMMAND_PRIORITY_CRITICAL=Bc;exports.COMMAND_PRIORITY_EDITOR=B;exports.COMMAND_PRIORITY_HIGH=Cg;exports.COMMAND_PRIORITY_LOW=q;exports.COMMAND_PRIORITY_NORMAL=Sg;exports.COPY_COMMAND=_r;exports.CUT_COMMAND=li;exports.ContextualEditor=b0;exports.DEFAULT_BLOCK_COMMANDS=k_;exports.DEFAULT_INLINE_STYLE_PROPERTIES=y_;exports.DEFAULT_SLASH_COMMANDS=_0;exports.DecoratorNode=ps;exports.DockedEditor=m0;exports.ElementNode=Se;exports.FOCUS_COMMAND=Fc;exports.FORMAT_ELEMENT_COMMAND=Mc;exports.FORMAT_TEXT_COMMAND=ve;exports.FloatingToolbar=E_;exports.HR_TRANSFORMER=m_;exports.HorizontalRuleNode=Ar;exports.INDENT_CONTENT_COMMAND=Bt;exports.INSERT_CHECK_LIST_COMMAND=gl;exports.INSERT_HORIZONTAL_RULE_COMMAND=Ts;exports.INSERT_IMAGE_COMMAND=Mv;exports.INSERT_ORDERED_LIST_COMMAND=mi;exports.INSERT_PARAGRAPH_COMMAND=In;exports.INSERT_UNORDERED_LIST_COMMAND=pi;exports.KEY_ENTER_COMMAND=$n;exports.KEY_ESCAPE_COMMAND=oi;exports.KEY_TAB_COMMAND=gs;exports.LexicalEditorInput=x0;exports.LexicalToolbar=w_;exports.OUTDENT_CONTENT_COMMAND=nn;exports.PASTE_COMMAND=ri;exports.REDO_COMMAND=si;exports.REMOVE_LIST_COMMAND=fu;exports.SELECTION_CHANGE_COMMAND=ni;exports.SlashCommandPalette=y0;exports.TOGGLE_SLASH_COMMAND_PALETTE=Ov;exports.TOOLBAR_SEPARATOR=O_;exports.TextNode=qe;exports.UNDO_COMMAND=ii;exports.applyMark=Jv;exports.buildInlineStyleImportMap=b_;exports.buildStyleImportMap=Ns;exports.createCommand=U;exports.createDefaultPluginConfig=yl;exports.createHeadlessEditor=As;exports.executeSlashCommand=Av;exports.exportEditorToFile=Iv;exports.exportToHtml=xt;exports.exportToMarkdown=bt;exports.getCharacterCount=qv;exports.getMarkdownTransformers=__;exports.getNodesForPlugins=_l;exports.getSelectionInfo=Yv;exports.getTextContent=ju;exports.getWordCount=Zv;exports.htmlToLexicalJson=l0;exports.importFileToEditor=$v;exports.importFromHtml=Un;exports.importFromMarkdown=Bn;exports.insertTable=Rv;exports.lexicalJsonToHtml=a0;exports.lexicalJsonToMarkdown=o0;exports.loadLexicalCore=p_;exports.loadOffsetUtils=Xv;exports.markdownToLexicalJson=s0;exports.registerAutoLinkPlugin=jv;exports.registerClipboardPlugin=Rl;exports.registerCodePlugin=Dv;exports.registerCodeShikiPlugin=Lv;exports.registerDragonPlugin=Bl;exports.registerHashtagPlugin=Bv;exports.registerHistoryPlugin=Fl;exports.registerHorizontalRulePlugin=Pl;exports.registerLinkPlugin=Ll;exports.registerListPlugin=Dl;exports.registerMarkPlugin=Hv;exports.registerOverflowPlugin=Vv;exports.registerPlainTextPlugin=$l;exports.registerRichTextPlugin=Il;exports.registerSlashCommandsPlugin=Nv;exports.registerTablePlugin=zl;exports.registerYjsPlugin=Ul;exports.removeMark=Gv;
|
|
35
|
+
`)}})(n,t)(e)}function om(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);throw t.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}class lm{_offsetMap;_firstNode;_blockOffsetSize;constructor(e,t,r=1){this._offsetMap=e,this._firstNode=t,this._blockOffsetSize=r}createSelectionFromOffsets(e,t,r){const i=this._firstNode;if(i===null)return null;let s=e,o=t,l=zi(i,s,this._blockOffsetSize),a=zi(i,o,this._blockOffsetSize);if(r!==void 0&&(s=sh(s,l,r,this,this._blockOffsetSize),l=zi(i,s,this._blockOffsetSize),o=sh(o,a,r,this,this._blockOffsetSize),a=zi(i,o,this._blockOffsetSize)),l===null||a===null)return null;let c=l.key,u=a.key;const d=Q(c),f=Q(u);if(d===null||f===null)return null;let h=0,g=0,p="element",m="element";if(l.type==="text"){h=s-l.start,p="text";const _=d.getNextSibling();s!==o&&h===d.getTextContentSize()&&L(_)&&(h=0,c=_.__key)}else l.type==="inline"&&(c=d.getParentOrThrow().getKey(),h=o>l.start?l.end:l.start);a.type==="text"?(g=o-a.start,m="text"):a.type==="inline"&&(u=f.getParentOrThrow().getKey(),g=o>a.start?a.end:a.start);const b=gi();return b===null?null:(b.anchor.set(c,h,p),b.focus.set(u,g,m),b)}getOffsetsFromSelection(e){const t=e.anchor,r=e.focus,i=this._offsetMap,s=t.offset,o=r.offset;let l=-1,a=-1;if(t.type==="text"){const c=i.get(t.key);c!==void 0&&(l=c.start+s)}else{const c=t.getNode().getDescendantByIndex(s);if(c!==null){const u=i.get(c.getKey());u!==void 0&&(l=c.getIndexWithinParent()!==s?u.end:u.start)}}if(r.type==="text"){const c=i.get(r.key);c!==void 0&&(a=c.start+r.offset)}else{const c=r.getNode().getDescendantByIndex(o);if(c!==null){const u=i.get(c.getKey());u!==void 0&&(a=c.getIndexWithinParent()!==o?u.end:u.start)}}return[l,a]}}function sh(n,e,t,r,i){const s=t._offsetMap,o=r._offsetMap,l=new Set;let a=n,c=e;for(;c!==null;){const d=c.key,f=s.get(d),h=c.end-c.start;if(l.add(d),f===void 0)a+=h;else{const m=f.end-f.start;m!==h&&(a+=h-m)}const g=c.prev;if(g!==null){c=g;continue}let p=c.parent;for(;p!==null;){let m=p.prev;if(m!==null){const b=m.key,_=s.get(b),y=m.end-m.start;if(l.add(b),_===void 0)a+=y;else{const C=_.end-_.start;C!==y&&(a+=y-C)}m=m.prev}p=p.parent}break}const u=t._firstNode;if(u!==null){c=zi(u,n,i);let d=!1;for(;c!==null;){if(!l.has(c.key)){d=!0;break}c=c.parent}if(!d)for(;c!==null;){const f=c.key;if(!l.has(f)){const h=o.get(f),g=c.end-c.start;if(h===void 0)a-=g;else{const p=h.end-h.start;g!==p&&(a+=p-g)}}c=c.prev}}return a}function zi(n,e,t){let r=n;for(;r!==null;){if(e<r.end+(r.type!=="element"||t===0?1:0)){const s=r.child;if(s!==null){r=s;continue}return r}const i=r.next;if(i===null)break;r=i}return null}function oh(n,e,t,r,i,s){return{child:n,end:r,key:i,next:null,parent:s,prev:null,start:t,type:e}}function KS(n,e,t,r,i,s){const o=r.get(e);o===void 0&&om(3);const l=n.offset;if(O(o)){const d=ar(o,r),f=d.length===0,h=f?null:am(n,d,null,r,i,s);n.prevIsBlock&&!f||(n.prevIsBlock=!0,n.offset+=s);const g=oh(h,"element",l,l,e,t);h!==null&&(h.parent=g);const p=n.offset;return g.end=p,i.set(e,g),g}n.prevIsBlock=!1;const a=L(o),c=a?o.__text.length:1,u=oh(null,a?"text":"inline",l,n.offset+=c,e,t);return i.set(e,u),u}function am(n,e,t,r,i,s){let o=null,l=null;const a=e.length;for(let c=0;c<a;c++){const u=KS(n,e[c],t,r,i,s);l===null?o=u:(u.prev=l,l.next=u),l=u}return o}function ar(n,e){const t=[];let r=n.__first;for(;r!==null;){const i=e===null?Q(r):e.get(r);i==null&&om(174),t.push(r),r=i.__next}return t}const WS=ar;function jS(n,e=1,t){const r=(t||n._pendingEditorState||n._editorState)._nodeMap,i=r.get("root"),s=new Map,o=am({offset:0,prevIsBlock:!1},ar(i,r),null,r,s,e);return new lm(s,o,e)}const HS=Object.freeze(Object.defineProperty({__proto__:null,$createChildrenArray:ar,$createOffsetView:jS,OffsetView:lm,createChildrenArray:WS},Symbol.toStringTag,{value:"Module"})),Yt=()=>new Map,_c=n=>{const e=Yt();return n.forEach((t,r)=>{e.set(r,t)}),e},wi=(n,e,t)=>{let r=n.get(e);return r===void 0&&n.set(e,r=t()),r},JS=(n,e)=>{const t=[];for(const[r,i]of n)t.push(e(i,r));return t},GS=(n,e)=>{for(const[t,r]of n)if(e(r,t))return!0;return!1},ti=()=>new Set,ba=n=>n[n.length-1],ni=Array.from,ku=(n,e)=>{for(let t=0;t<n.length;t++)if(!e(n[t],t,n))return!1;return!0},cm=(n,e)=>{for(let t=0;t<n.length;t++)if(e(n[t],t,n))return!0;return!1},VS=(n,e)=>{const t=new Array(n);for(let r=0;r<n;r++)t[r]=e(r,t);return t},El=Array.isArray;class YS{constructor(){this._observers=Yt()}on(e,t){return wi(this._observers,e,ti).add(t),t}once(e,t){const r=(...i)=>{this.off(e,r),t(...i)};this.on(e,r)}off(e,t){const r=this._observers.get(e);r!==void 0&&(r.delete(t),r.size===0&&this._observers.delete(e))}emit(e,t){return ni((this._observers.get(e)||Yt()).values()).forEach(r=>r(...t))}destroy(){this._observers=Yt()}}const mn=Math.floor,ro=Math.abs,um=(n,e)=>n<e?n:e,vi=(n,e)=>n>e?n:e,qS=n=>n!==0?n<0:1/n<0,lh=1,ah=2,xa=4,Sa=8,ZS=32,dm=64,Po=128,XS=31,ch=63,Gi=127,QS=2147483647,uh=Number.MAX_SAFE_INTEGER,dh=Number.MIN_SAFE_INTEGER,eC=Number.isInteger||(n=>typeof n=="number"&&isFinite(n)&&mn(n)===n),tC=String.fromCharCode,nC=n=>n.toLowerCase(),rC=/^\s*/g,iC=n=>n.replace(rC,""),sC=/([A-Z])/g,fh=(n,e)=>iC(n.replace(sC,t=>`${e}${nC(t)}`)),oC=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,r=new Uint8Array(t);for(let i=0;i<t;i++)r[i]=e.codePointAt(i);return r},as=typeof TextEncoder<"u"?new TextEncoder:null,lC=n=>as.encode(n),aC=as?lC:oC;let Ca=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Ca&&Ca.decode(new Uint8Array).length===1&&(Ca=null);const cC=(n,e)=>VS(e,()=>n).join("");class Ms{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Tu=()=>new Ms,uC=n=>{let e=n.cpos;for(let t=0;t<n.bufs.length;t++)e+=n.bufs[t].length;return e},un=n=>{const e=new Uint8Array(uC(n));let t=0;for(let r=0;r<n.bufs.length;r++){const i=n.bufs[r];e.set(i,t),t+=i.length}return e.set(new Uint8Array(n.cbuf.buffer,0,n.cpos),t),e},dC=(n,e)=>{const t=n.cbuf.length;t-n.cpos<e&&(n.bufs.push(new Uint8Array(n.cbuf.buffer,0,n.cpos)),n.cbuf=new Uint8Array(vi(t,e)*2),n.cpos=0)},Ie=(n,e)=>{const t=n.cbuf.length;n.cpos===t&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(t*2),n.cpos=0),n.cbuf[n.cpos++]=e},yc=Ie,ce=(n,e)=>{for(;e>Gi;)Ie(n,Po|Gi&e),e=mn(e/128);Ie(n,Gi&e)},Nu=(n,e)=>{const t=qS(e);for(t&&(e=-e),Ie(n,(e>ch?Po:0)|(t?dm:0)|ch&e),e=mn(e/64);e>0;)Ie(n,(e>Gi?Po:0)|Gi&e),e=mn(e/128)},bc=new Uint8Array(3e4),fC=bc.length/3,hC=(n,e)=>{if(e.length<fC){const t=as.encodeInto(e,bc).written||0;ce(n,t);for(let r=0;r<t;r++)Ie(n,bc[r])}else ft(n,aC(e))},gC=(n,e)=>{const t=unescape(encodeURIComponent(e)),r=t.length;ce(n,r);for(let i=0;i<r;i++)Ie(n,t.codePointAt(i))},Zr=as&&as.encodeInto?hC:gC,Au=(n,e)=>{const t=n.cbuf.length,r=n.cpos,i=um(t-r,e.length),s=e.length-i;n.cbuf.set(e.subarray(0,i),r),n.cpos+=i,s>0&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(vi(t*2,s)),n.cbuf.set(e.subarray(i)),n.cpos=s)},ft=(n,e)=>{ce(n,e.byteLength),Au(n,e)},Ou=(n,e)=>{dC(n,e);const t=new DataView(n.cbuf.buffer,n.cpos,e);return n.cpos+=e,t},pC=(n,e)=>Ou(n,4).setFloat32(0,e,!1),mC=(n,e)=>Ou(n,8).setFloat64(0,e,!1),_C=(n,e)=>Ou(n,8).setBigInt64(0,e,!1),hh=new DataView(new ArrayBuffer(4)),yC=n=>(hh.setFloat32(0,n),hh.getFloat32(0)===n),cs=(n,e)=>{switch(typeof e){case"string":Ie(n,119),Zr(n,e);break;case"number":eC(e)&&ro(e)<=QS?(Ie(n,125),Nu(n,e)):yC(e)?(Ie(n,124),pC(n,e)):(Ie(n,123),mC(n,e));break;case"bigint":Ie(n,122),_C(n,e);break;case"object":if(e===null)Ie(n,126);else if(El(e)){Ie(n,117),ce(n,e.length);for(let t=0;t<e.length;t++)cs(n,e[t])}else if(e instanceof Uint8Array)Ie(n,116),ft(n,e);else{Ie(n,118);const t=Object.keys(e);ce(n,t.length);for(let r=0;r<t.length;r++){const i=t[r];Zr(n,i),cs(n,e[i])}}break;case"boolean":Ie(n,e?120:121);break;default:Ie(n,127)}};class gh extends Ms{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&ce(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const ph=n=>{n.count>0&&(Nu(n.encoder,n.count===1?n.s:-n.s),n.count>1&&ce(n.encoder,n.count-2))};class io{constructor(){this.encoder=new Ms,this.s=0,this.count=0}write(e){this.s===e?this.count++:(ph(this),this.count=1,this.s=e)}toUint8Array(){return ph(this),un(this.encoder)}}const mh=n=>{if(n.count>0){const e=n.diff*2+(n.count===1?0:1);Nu(n.encoder,e),n.count>1&&ce(n.encoder,n.count-2)}};class wa{constructor(){this.encoder=new Ms,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(mh(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return mh(this),un(this.encoder)}}class bC{constructor(){this.sarr=[],this.s="",this.lensE=new io}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new Ms;return this.sarr.push(this.s),this.s="",Zr(e,this.sarr.join("")),Au(e,this.lensE.toUint8Array()),un(e)}}const Un=n=>new Error(n),Rt=()=>{throw Un("Method unimplemented")},_n=()=>{throw Un("Unexpected case")},xC=crypto.getRandomValues.bind(crypto),fm=()=>xC(new Uint32Array(1))[0],SC="10000000-1000-4000-8000"+-1e11,CC=()=>SC.replace(/[018]/g,n=>(n^fm()&15>>n/4).toString(16)),_h=n=>new Promise(n);Promise.all.bind(Promise);const yh=n=>n===void 0?null:n;class wC{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let hm=new wC,vC=!0;try{typeof localStorage<"u"&&localStorage&&(hm=localStorage,vC=!1)}catch{}const EC=hm,us=Symbol("Equality"),gm=(n,e)=>n===e||!!n?.[us]?.(e)||!1,kC=n=>typeof n=="object",TC=Object.assign,NC=Object.keys,AC=(n,e)=>{for(const t in n)e(n[t],t)},zo=n=>NC(n).length,OC=n=>{for(const e in n)return!1;return!0},Is=(n,e)=>{for(const t in n)if(!e(n[t],t))return!1;return!0},Mu=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),MC=(n,e)=>n===e||zo(n)===zo(e)&&Is(n,(t,r)=>(t!==void 0||Mu(e,r))&&gm(e[r],t)),IC=Object.freeze,pm=n=>{for(const e in n){const t=n[e];(typeof t=="object"||typeof t=="function")&&pm(n[e])}return IC(n)},Iu=(n,e,t=0)=>{try{for(;t<n.length;t++)n[t](...e)}finally{t<n.length&&Iu(n,e,t+1)}},so=(n,e)=>{if(n===e)return!0;if(n==null||e==null||n.constructor!==e.constructor&&(n.constructor||Object)!==(e.constructor||Object))return!1;if(n[us]!=null)return n[us](e);switch(n.constructor){case ArrayBuffer:n=new Uint8Array(n),e=new Uint8Array(e);case Uint8Array:{if(n.byteLength!==e.byteLength)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;break}case Set:{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;break}case Map:{if(n.size!==e.size)return!1;for(const t of n.keys())if(!e.has(t)||!so(n.get(t),e.get(t)))return!1;break}case void 0:case Object:if(zo(n)!==zo(e))return!1;for(const t in n)if(!Mu(n,t)||!so(n[t],e[t]))return!1;break;case Array:if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(!so(n[t],e[t]))return!1;break;default:return!1}return!0},$C=(n,e)=>e.includes(n),ds=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";let zt;const FC=()=>{if(zt===void 0)if(ds){zt=Yt();const n=process.argv;let e=null;for(let t=0;t<n.length;t++){const r=n[t];r[0]==="-"?(e!==null&&zt.set(e,""),e=r):e!==null&&(zt.set(e,r),e=null)}e!==null&&zt.set(e,"")}else typeof location=="object"?(zt=Yt(),(location.search||"?").slice(1).split("&").forEach(n=>{if(n.length!==0){const[e,t]=n.split("=");zt.set(`--${fh(e,"-")}`,t),zt.set(`-${fh(e,"-")}`,t)}})):zt=Yt();return zt},xc=n=>FC().has(n),Bo=n=>yh(ds?process.env[n.toUpperCase().replaceAll("-","_")]:EC.getItem(n)),mm=n=>xc("--"+n)||Bo(n)!==null,LC=mm("production"),RC=ds&&$C(process.env.FORCE_COLOR,["true","1","2"]),DC=RC||!xc("--no-colors")&&!mm("no-color")&&(!ds||process.stdout.isTTY)&&(!ds||xc("--color")||Bo("COLORTERM")!==null||(Bo("TERM")||"").includes("color"));class PC{constructor(e,t){this.left=e,this.right=t}}const nn=(n,e)=>new PC(n,e),bh=n=>n.next()>=.5,va=(n,e,t)=>mn(n.next()*(t+1-e)+e),_m=(n,e,t)=>mn(n.next()*(t+1-e)+e),$u=(n,e,t)=>_m(n,e,t),zC=n=>tC($u(n,97,122)),BC=(n,e=0,t=20)=>{const r=$u(n,e,t);let i="";for(let s=0;s<r;s++)i+=zC(n);return i},Ea=(n,e)=>e[$u(n,0,e.length-1)],UC=Symbol("0schema");class KC{constructor(){this._rerrs=[]}extend(e,t,r,i=null){this._rerrs.push({path:e,expected:t,has:r,message:i})}toString(){const e=[];for(let t=this._rerrs.length-1;t>0;t--){const r=this._rerrs[t];e.push(cC(" ",(this._rerrs.length-t)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
|
|
36
|
+
`)}}const Sc=(n,e)=>n===e?!0:n==null||e==null||n.constructor!==e.constructor?!1:n[us]?gm(n,e):El(n)?ku(n,t=>cm(e,r=>Sc(t,r))):kC(n)?Is(n,(t,r)=>Sc(t,e[r])):!1;class ot{static _dilutes=!1;extends(e){let[t,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,t]=[t,r]),Sc(t,r)}equals(e){return this.constructor===e.constructor&&so(this.shape,e.shape)}[UC](){return!0}[us](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){Rt()}get nullable(){return Ei(this,Ol)}get optional(){return new xm(this)}cast(e){return xh(e,this),e}expect(e){return xh(e,this),e}}class Fu extends ot{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){const r=e?.constructor===this.shape&&(this._c==null||this._c(e));return!r&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),r}}const ve=(n,e=null)=>new Fu(n,e);ve(Fu);class Lu extends ot{constructor(e){super(),this.shape=e}check(e,t){const r=this.shape(e);return!r&&t?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),r}}const Be=n=>new Lu(n);ve(Lu);class kl extends ot{constructor(e){super(),this.shape=e}check(e,t){const r=this.shape.some(i=>i===e);return!r&&t?.extend(null,this.shape.join(" | "),e.toString()),r}}const Tl=(...n)=>new kl(n),ym=ve(kl),WC=RegExp.escape||(n=>n.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),bm=n=>{if(ri.check(n))return[WC(n)];if(ym.check(n))return n.shape.map(e=>e+"");if(Am.check(n))return["[+-]?\\d+.?\\d*"];if(Om.check(n))return[".*"];if(Uo.check(n))return n.shape.map(bm).flat(1);_n()};class jC extends ot{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(bm).map(t=>`(${t.join("|")})`).join("")+"$")}check(e,t){const r=this._r.exec(e)!=null;return!r&&t?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),r}}ve(jC);const HC=Symbol("optional");class xm extends ot{constructor(e){super(),this.shape=e}check(e,t){const r=e===void 0||this.shape.check(e);return!r&&t?.extend(null,"undefined (optional)","()"),r}get[HC](){return!0}}const JC=ve(xm);class GC extends ot{check(e,t){return t?.extend(null,"never",typeof e),!1}}ve(GC);class Nl extends ot{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new Nl(this.shape,!0)}check(e,t){return e==null?(t?.extend(null,"object","null"),!1):Is(this.shape,(r,i)=>{const s=this._isPartial&&!Mu(e,i)||r.check(e[i],t);return!s&&t?.extend(i.toString(),r.toString(),typeof e[i],"Object property does not match"),s})}}const VC=n=>new Nl(n),YC=ve(Nl),qC=Be(n=>n!=null&&(n.constructor===Object||n.constructor==null));class Sm extends ot{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&Is(e,(r,i)=>{const s=this.shape.keys.check(i,t);return!s&&t?.extend(i+"","Record",typeof e,s?"Key doesn't match schema":"Value doesn't match value"),s&&this.shape.values.check(r,t)})}}const Cm=(n,e)=>new Sm(n,e),ZC=ve(Sm);class wm extends ot{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&Is(this.shape,(r,i)=>{const s=r.check(e[i],t);return!s&&t?.extend(i.toString(),"Tuple",typeof r),s})}}const XC=(...n)=>new wm(n);ve(wm);class vm extends ot{constructor(e){super(),this.shape=e.length===1?e[0]:new Ru(e)}check(e,t){const r=El(e)&&ku(e,i=>this.shape.check(i));return!r&&t?.extend(null,"Array",""),r}}const Em=(...n)=>new vm(n),QC=ve(vm),ew=Be(n=>El(n));class km extends ot{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){const r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&t?.extend(null,this.shape.name,e?.constructor.name),r}}const tw=(n,e=null)=>new km(n,e);ve(km);const nw=tw(ot);class rw extends ot{constructor(e){super(),this.len=e.length-1,this.args=XC(...e.slice(-1)),this.res=e[this.len]}check(e,t){const r=e.constructor===Function&&e.length<=this.len;return!r&&t?.extend(null,"function",typeof e),r}}const iw=ve(rw),sw=Be(n=>typeof n=="function");class ow extends ot{constructor(e){super(),this.shape=e}check(e,t){const r=ku(this.shape,i=>i.check(e,t));return!r&&t?.extend(null,"Intersectinon",typeof e),r}}ve(ow,n=>n.shape.length>0);class Ru extends ot{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){const r=cm(this.shape,i=>i.check(e,t));return t?.extend(null,"Union",typeof e),r}}const Ei=(...n)=>n.findIndex(e=>Uo.check(e))>=0?Ei(...n.map(e=>fs(e)).map(e=>Uo.check(e)?e.shape:[e]).flat(1)):n.length===1?n[0]:new Ru(n),Uo=ve(Ru),Tm=()=>!0,Ko=Be(Tm),lw=ve(Lu,n=>n.shape===Tm),Du=Be(n=>typeof n=="bigint"),aw=Be(n=>n===Du),Nm=Be(n=>typeof n=="symbol");Be(n=>n===Nm);const Xr=Be(n=>typeof n=="number"),Am=Be(n=>n===Xr),ri=Be(n=>typeof n=="string"),Om=Be(n=>n===ri),Al=Be(n=>typeof n=="boolean"),cw=Be(n=>n===Al),Mm=Tl(void 0);ve(kl,n=>n.shape.length===1&&n.shape[0]===void 0);Tl(void 0);const Ol=Tl(null),uw=ve(kl,n=>n.shape.length===1&&n.shape[0]===null);ve(Uint8Array);ve(Fu,n=>n.shape===Uint8Array);const dw=Ei(Xr,ri,Ol,Mm,Du,Al,Nm);(()=>{const n=Em(Ko),e=Cm(ri,Ko),t=Ei(Xr,ri,Ol,Al,n,e);return n.shape=t,e.shape.values=t,t})();const fs=n=>{if(nw.check(n))return n;if(qC.check(n)){const e={};for(const t in n)e[t]=fs(n[t]);return VC(e)}else{if(ew.check(n))return Ei(...n.map(fs));if(dw.check(n))return Tl(n);if(sw.check(n))return ve(n)}_n()},xh=LC?()=>{}:(n,e)=>{const t=new KC;if(!e.check(n,t))throw Un(`Expected value to be of type ${e.constructor.name}.
|
|
37
|
+
${t.toString()}`)};class fw{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:fs(e),h:t}),this}else(e){return this.if(Ko,e)}done(){return(e,t)=>{for(let r=0;r<this.patterns.length;r++){const i=this.patterns[r];if(i.if.check(e))return i.h(e,t)}throw Un("Unhandled pattern")}}}const hw=n=>new fw(n),Im=hw(Ko).if(Am,(n,e)=>va(e,dh,uh)).if(Om,(n,e)=>BC(e)).if(cw,(n,e)=>bh(e)).if(aw,(n,e)=>BigInt(va(e,dh,uh))).if(Uo,(n,e)=>Ur(e,Ea(e,n.shape))).if(YC,(n,e)=>{const t={};for(const r in n.shape){let i=n.shape[r];if(JC.check(i)){if(bh(e))continue;i=i.shape}t[r]=Im(i,e)}return t}).if(QC,(n,e)=>{const t=[],r=_m(e,0,42);for(let i=0;i<r;i++)t.push(Ur(e,n.shape));return t}).if(ym,(n,e)=>Ea(e,n.shape)).if(uw,(n,e)=>null).if(iw,(n,e)=>{const t=Ur(e,n.res);return()=>t}).if(lw,(n,e)=>Ur(e,Ea(e,[Xr,ri,Ol,Mm,Du,Al,Em(Xr),Cm(Ei("a","b","c"),Xr)]))).if(ZC,(n,e)=>{const t={},r=va(e,0,3);for(let i=0;i<r;i++){const s=Ur(e,n.shape.keys),o=Ur(e,n.shape.values);t[s]=o}return t}).done(),Ur=(n,e)=>Im(fs(e),n),Ml=typeof document<"u"?document:{};Be(n=>n.nodeType===yw);typeof DOMParser<"u"&&new DOMParser;Be(n=>n.nodeType===pw);Be(n=>n.nodeType===mw);const gw=n=>JS(n,(e,t)=>`${t}:${e};`).join(""),pw=Ml.ELEMENT_NODE,mw=Ml.TEXT_NODE,_w=Ml.DOCUMENT_NODE,yw=Ml.DOCUMENT_FRAGMENT_NODE;Be(n=>n.nodeType===_w);const vn=Symbol,$m=vn(),Fm=vn(),bw=vn(),xw=vn(),Sw=vn(),Lm=vn(),Cw=vn(),Pu=vn(),ww=vn(),vw=n=>{n.length===1&&n[0]?.constructor===Function&&(n=n[0]());const e=[],t=[];let r=0;for(;r<n.length;r++){const i=n[r];if(i===void 0)break;if(i.constructor===String||i.constructor===Number)e.push(i);else if(i.constructor===Object)break}for(r>0&&t.push(e.join(""));r<n.length;r++){const i=n[r];i instanceof Symbol||t.push(i)}return t},Ew={[$m]:nn("font-weight","bold"),[Fm]:nn("font-weight","normal"),[bw]:nn("color","blue"),[Sw]:nn("color","green"),[xw]:nn("color","grey"),[Lm]:nn("color","red"),[Cw]:nn("color","purple"),[Pu]:nn("color","orange"),[ww]:nn("color","black")},kw=n=>{n.length===1&&n[0]?.constructor===Function&&(n=n[0]());const e=[],t=[],r=Yt();let i=[],s=0;for(;s<n.length;s++){const o=n[s],l=Ew[o];if(l!==void 0)r.set(l.left,l.right);else{if(o===void 0)break;if(o.constructor===String||o.constructor===Number){const a=gw(r);s>0||a.length>0?(e.push("%c"+o),t.push(a)):e.push(o)}else break}}for(s>0&&(i=t,i.unshift(e.join("")));s<n.length;s++){const o=n[s];o instanceof Symbol||i.push(o)}return i},Rm=DC?kw:vw,Tw=(...n)=>{console.log(...Rm(n)),Dm.forEach(e=>e.print(n))},Nw=(...n)=>{console.warn(...Rm(n)),n.unshift(Pu),Dm.forEach(e=>e.print(n))},Dm=ti(),Pm=n=>({[Symbol.iterator](){return this},next:n}),Aw=(n,e)=>Pm(()=>{let t;do t=n.next();while(!t.done&&!e(t.value));return t}),ka=(n,e)=>Pm(()=>{const{done:t,value:r}=n.next();return{done:t,value:t?void 0:e(r)}});class Ow{constructor(e,t){this.clock=e,this.len=t}}class Mw{constructor(){this.clients=new Map}}const zm=(n,e,t)=>e.clients.forEach((r,i)=>{const s=n.doc.store.clients.get(i);if(s!=null){const o=s[s.length-1],l=o.id.clock+o.length;for(let a=0,c=r[a];a<r.length&&c.clock<l;c=r[++a])Jm(n,s,c.clock,c.len,t)}}),Iw=(n,e)=>{let t=0,r=n.length-1;for(;t<=r;){const i=mn((t+r)/2),s=n[i],o=s.clock;if(o<=e){if(e<o+s.len)return i;t=i+1}else r=i-1}return null},Bm=(n,e)=>{const t=n.clients.get(e.client);return t!==void 0&&Iw(t,e.clock)!==null},Um=n=>{n.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let t,r;for(t=1,r=1;t<e.length;t++){const i=e[r-1],s=e[t];i.clock+i.len>=s.clock?i.len=vi(i.len,s.clock+s.len-i.clock):(r<t&&(e[r]=s),r++)}e.length=r})},Km=(n,e,t,r)=>{wi(n.clients,e,()=>[]).push(new Ow(t,r))},$w=(n,e)=>{ce(n.restEncoder,e.clients.size),ni(e.clients.entries()).sort((t,r)=>r[0]-t[0]).forEach(([t,r])=>{n.resetDsCurVal(),ce(n.restEncoder,t);const i=r.length;ce(n.restEncoder,i);for(let s=0;s<i;s++){const o=r[s];n.writeDsClock(o.clock),n.writeDsLen(o.len)}})},Wm=fm;class Kn extends YS{constructor({guid:e=CC(),collectionid:t=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:l=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=Wm(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new Ww,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=l,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=_h(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const a=()=>_h(c=>{const u=d=>{(d===void 0||d===!0)&&(this.off("sync",u),c())};this.on("sync",u)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=a()}load(){const e=this._item;e!==null&&!this.shouldLoad&&ge(e.parent.doc,t=>{t.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(ni(this.subdocs).map(e=>e.guid))}transact(e,t=null){return ge(this,e,t)}get(e,t=je){const r=wi(this.share,e,()=>{const s=new t;return s._integrate(this,null),s}),i=r.constructor;if(t!==je&&i!==t)if(i===je){const s=new t;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,Vi)}getText(e=""){return this.get(e,ps)}getMap(e=""){return this.get(e,bt)}getXmlElement(e=""){return this.get(e,bn)}getXmlFragment(e=""){return this.get(e,ii)}toJSON(){const e={};return this.share.forEach((t,r)=>{e[r]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,ni(this.subdocs).forEach(t=>t.destroy());const e=this._item;if(e!==null){this._item=null;const t=e.content;t.doc=new Kn({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=e,ge(e.parent.doc,r=>{const i=t.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class Fw{constructor(){this.restEncoder=Tu()}toUint8Array(){return un(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){ce(this.restEncoder,e)}writeDsLen(e){ce(this.restEncoder,e)}}class Lw extends Fw{writeLeftID(e){ce(this.restEncoder,e.client),ce(this.restEncoder,e.clock)}writeRightID(e){ce(this.restEncoder,e.client),ce(this.restEncoder,e.clock)}writeClient(e){ce(this.restEncoder,e)}writeInfo(e){yc(this.restEncoder,e)}writeString(e){Zr(this.restEncoder,e)}writeParentInfo(e){ce(this.restEncoder,e?1:0)}writeTypeRef(e){ce(this.restEncoder,e)}writeLen(e){ce(this.restEncoder,e)}writeAny(e){cs(this.restEncoder,e)}writeBuf(e){ft(this.restEncoder,e)}writeJSON(e){Zr(this.restEncoder,JSON.stringify(e))}writeKey(e){Zr(this.restEncoder,e)}}class Rw{constructor(){this.restEncoder=Tu(),this.dsCurrVal=0}toUint8Array(){return un(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,ce(this.restEncoder,t)}writeDsLen(e){e===0&&_n(),ce(this.restEncoder,e-1),this.dsCurrVal+=e}}class Dw extends Rw{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new wa,this.clientEncoder=new io,this.leftClockEncoder=new wa,this.rightClockEncoder=new wa,this.infoEncoder=new gh(yc),this.stringEncoder=new bC,this.parentInfoEncoder=new gh(yc),this.typeRefEncoder=new io,this.lenEncoder=new io}toUint8Array(){const e=Tu();return ce(e,0),ft(e,this.keyClockEncoder.toUint8Array()),ft(e,this.clientEncoder.toUint8Array()),ft(e,this.leftClockEncoder.toUint8Array()),ft(e,this.rightClockEncoder.toUint8Array()),ft(e,un(this.infoEncoder)),ft(e,this.stringEncoder.toUint8Array()),ft(e,un(this.parentInfoEncoder)),ft(e,this.typeRefEncoder.toUint8Array()),ft(e,this.lenEncoder.toUint8Array()),Au(e,un(this.restEncoder)),un(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){cs(this.restEncoder,e)}writeBuf(e){ft(this.restEncoder,e)}writeJSON(e){cs(this.restEncoder,e)}writeKey(e){const t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}}const Pw=(n,e,t,r)=>{r=vi(r,e[0].id.clock);const i=yn(e,r);ce(n.restEncoder,e.length-i),n.writeClient(t),ce(n.restEncoder,r);const s=e[i];s.write(n,r-s.id.clock);for(let o=i+1;o<e.length;o++)e[o].write(n,0)},zw=(n,e,t)=>{const r=new Map;t.forEach((i,s)=>{lt(e,s)>i&&r.set(s,i)}),zu(e).forEach((i,s)=>{t.has(s)||r.set(s,0)}),ce(n.restEncoder,r.size),ni(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{Pw(n,e.clients.get(i),i,s)})},Bw=(n,e)=>zw(n,e.doc.store,e.beforeState);class Uw{constructor(){this.l=[]}}const Sh=()=>new Uw,Ch=(n,e)=>n.l.push(e),wh=(n,e)=>{const t=n.l,r=t.length;n.l=t.filter(i=>e!==i),r===n.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},jm=(n,e,t)=>Iu(n.l,[e,t]);class oo{constructor(e,t){this.client=e,this.clock=t}}const Vs=(n,e)=>n===e||n!==null&&e!==null&&n.client===e.client&&n.clock===e.clock,ye=(n,e)=>new oo(n,e),Kw=n=>{for(const[e,t]of n.doc.share.entries())if(t===n)return e;throw _n()},Hr=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&(e.sv.get(n.id.client)||0)>n.id.clock&&!Bm(e.ds,n.id),Cc=(n,e)=>{const t=wi(n.meta,Cc,ti),r=n.doc.store;t.has(e)||(e.sv.forEach((i,s)=>{i<lt(r,s)&&Wn(n,ye(s,i))}),zm(n,e.ds,i=>{}),t.add(e))};class Ww{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const zu=n=>{const e=new Map;return n.clients.forEach((t,r)=>{const i=t[t.length-1];e.set(r,i.id.clock+i.length)}),e},lt=(n,e)=>{const t=n.clients.get(e);if(t===void 0)return 0;const r=t[t.length-1];return r.id.clock+r.length},Hm=(n,e)=>{let t=n.clients.get(e.id.client);if(t===void 0)t=[],n.clients.set(e.id.client,t);else{const r=t[t.length-1];if(r.id.clock+r.length!==e.id.clock)throw _n()}t.push(e)},yn=(n,e)=>{let t=0,r=n.length-1,i=n[r],s=i.id.clock;if(s===e)return r;let o=mn(e/(s+i.length-1)*r);for(;t<=r;){if(i=n[o],s=i.id.clock,s<=e){if(e<s+i.length)return o;t=o+1}else r=o-1;o=mn((t+r)/2)}throw _n()},jw=(n,e)=>{const t=n.clients.get(e.client);return t[yn(t,e.clock)]},Ta=jw,wc=(n,e,t)=>{const r=yn(e,t),i=e[r];return i.id.clock<t&&i instanceof qe?(e.splice(r+1,0,u_(n,i,t-i.id.clock)),r+1):r},Wn=(n,e)=>{const t=n.doc.store.clients.get(e.client);return t[wc(n,t,e.clock)]},vh=(n,e,t)=>{const r=e.clients.get(t.client),i=yn(r,t.clock),s=r[i];return t.clock!==s.id.clock+s.length-1&&s.constructor!==Nn&&r.splice(i+1,0,u_(n,s,t.clock-s.id.clock+1)),s},Hw=(n,e,t)=>{const r=n.clients.get(e.id.client);r[yn(r,e.id.clock)]=t},Jm=(n,e,t,r,i)=>{if(r===0)return;const s=t+r;let o=wc(n,e,t),l;do l=e[o++],s<l.id.clock+l.length&&wc(n,e,s),i(l);while(o<e.length&&e[o].id.clock<s)};class Jw{constructor(e,t,r){this.doc=e,this.deleteSet=new Mw,this.beforeState=zu(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const Eh=(n,e)=>e.deleteSet.clients.size===0&&!GS(e.afterState,(t,r)=>e.beforeState.get(r)!==t)?!1:(Um(e.deleteSet),Bw(n,e),$w(n,e.deleteSet),!0),kh=(n,e,t)=>{const r=e._item;(r===null||r.id.clock<(n.beforeState.get(r.id.client)||0)&&!r.deleted)&&wi(n.changed,e,ti).add(t)},lo=(n,e)=>{let t=n[e],r=n[e-1],i=e;for(;i>0;t=r,r=n[--i-1]){if(r.deleted===t.deleted&&r.constructor===t.constructor&&r.mergeWith(t)){t instanceof qe&&t.parentSub!==null&&t.parent._map.get(t.parentSub)===t&&t.parent._map.set(t.parentSub,r);continue}break}const s=e-i;return s&&n.splice(e+1-s,s),s},Gw=(n,e,t)=>{for(const[r,i]of n.clients.entries()){const s=e.clients.get(r);for(let o=i.length-1;o>=0;o--){const l=i[o],a=l.clock+l.len;for(let c=yn(s,l.clock),u=s[c];c<s.length&&u.id.clock<a;u=s[++c]){const d=s[c];if(l.clock+l.len<=d.id.clock)break;d instanceof qe&&d.deleted&&!d.keep&&t(d)&&d.gc(e,!1)}}}},Vw=(n,e)=>{n.clients.forEach((t,r)=>{const i=e.clients.get(r);for(let s=t.length-1;s>=0;s--){const o=t[s],l=um(i.length-1,1+yn(i,o.clock+o.len-1));for(let a=l,c=i[a];a>0&&c.id.clock>=o.clock;c=i[a])a-=1+lo(i,a)}})},Gm=(n,e)=>{if(e<n.length){const t=n[e],r=t.doc,i=r.store,s=t.deleteSet,o=t._mergeStructs;try{Um(s),t.afterState=zu(t.doc.store),r.emit("beforeObserverCalls",[t,r]);const l=[];t.changed.forEach((a,c)=>l.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(t,a)})),l.push(()=>{t.changedParentTypes.forEach((a,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(a=a.filter(u=>u.target._item===null||!u.target._item.deleted),a.forEach(u=>{u.currentTarget=c,u._path=null}),a.sort((u,d)=>u.path.length-d.path.length),l.push(()=>{jm(c._dEH,a,t)}))}),l.push(()=>r.emit("afterTransaction",[t,r])),l.push(()=>{t._needFormattingCleanup&&ov(t)})}),Iu(l,[])}finally{r.gc&&Gw(s,i,r.gcFilter),Vw(s,i),t.afterState.forEach((u,d)=>{const f=t.beforeState.get(d)||0;if(f!==u){const h=i.clients.get(d),g=vi(yn(h,f),1);for(let p=h.length-1;p>=g;)p-=1+lo(h,p)}});for(let u=o.length-1;u>=0;u--){const{client:d,clock:f}=o[u].id,h=i.clients.get(d),g=yn(h,f);g+1<h.length&&lo(h,g+1)>1||g>0&&lo(h,g)}if(!t.local&&t.afterState.get(r.clientID)!==t.beforeState.get(r.clientID)&&(Tw(Pu,$m,"[yjs] ",Fm,Lm,"Changed the client-id because another client seems to be using it."),r.clientID=Wm()),r.emit("afterTransactionCleanup",[t,r]),r._observers.has("update")){const u=new Lw;Eh(u,t)&&r.emit("update",[u.toUint8Array(),t.origin,r,t])}if(r._observers.has("updateV2")){const u=new Dw;Eh(u,t)&&r.emit("updateV2",[u.toUint8Array(),t.origin,r,t])}const{subdocsAdded:l,subdocsLoaded:a,subdocsRemoved:c}=t;(l.size>0||c.size>0||a.size>0)&&(l.forEach(u=>{u.clientID=r.clientID,u.collectionid==null&&(u.collectionid=r.collectionid),r.subdocs.add(u)}),c.forEach(u=>r.subdocs.delete(u)),r.emit("subdocs",[{loaded:a,added:l,removed:c},r,t]),c.forEach(u=>u.destroy())),n.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,n])):Gm(n,e+1)}}},ge=(n,e,t=null,r=!0)=>{const i=n._transactionCleanups;let s=!1,o=null;n._transaction===null&&(s=!0,n._transaction=new Jw(n,t,r),i.push(n._transaction),i.length===1&&n.emit("beforeAllTransactions",[n]),n.emit("beforeTransaction",[n._transaction,n]));try{o=e(n._transaction)}finally{if(s){const l=n._transaction===i[0];n._transaction=null,l&&Gm(i,0)}}return o},Th="You must not compute changes after the event-handler fired.";class Il{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=Yw(this.currentTarget,this.target))}deletes(e){return Bm(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Un(Th);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(i=>{if(i!==null){const s=t._map.get(i);let o,l;if(this.adds(s)){let a=s.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(s))if(a!==null&&this.deletes(a))o="delete",l=ba(a.content.getContent());else return;else a!==null&&this.deletes(a)?(o="update",l=ba(a.content.getContent())):(o="add",l=void 0)}else if(this.deletes(s))o="delete",l=ba(s.content.getContent());else return;e.set(i,{action:o,oldValue:l})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Un(Th);const t=this.target,r=ti(),i=ti(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(t).has(null)){let l=null;const a=()=>{l&&s.push(l)};for(let c=t._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((l===null||l.delete===void 0)&&(a(),l={delete:0}),l.delete+=c.length,i.add(c)):this.adds(c)?((l===null||l.insert===void 0)&&(a(),l={insert:[]}),l.insert=l.insert.concat(c.content.getContent()),r.add(c)):((l===null||l.retain===void 0)&&(a(),l={retain:0}),l.retain+=c.length);l!==null&&l.retain===void 0&&a()}this._changes=e}return e}}const Yw=(n,e)=>{const t=[];for(;e._item!==null&&e!==n;){if(e._item.parentSub!==null)t.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;t.unshift(r)}e=e._item.parent}return t},Xe=()=>{Nw("Invalid access: Add Yjs type to a document before reading data.")},Vm=80;let Bu=0;class qw{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=Bu++}}const Zw=n=>{n.timestamp=Bu++},Ym=(n,e,t)=>{n.p.marker=!1,n.p=e,e.marker=!0,n.index=t,n.timestamp=Bu++},Xw=(n,e,t)=>{if(n.length>=Vm){const r=n.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return Ym(r,e,t),r}else{const r=new qw(e,t);return n.push(r),r}},$l=(n,e)=>{if(n._start===null||e===0||n._searchMarker===null)return null;const t=n._searchMarker.length===0?null:n._searchMarker.reduce((s,o)=>ro(e-s.index)<ro(e-o.index)?s:o);let r=n._start,i=0;for(t!==null&&(r=t.p,i=t.index,Zw(t));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return t!==null&&ro(t.index-i)<r.parent.length/Vm?(Ym(t,r,i),t):Xw(n._searchMarker,r,i)},hs=(n,e,t)=>{for(let r=n.length-1;r>=0;r--){const i=n[r];if(t>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){n.splice(r,1);continue}i.p=s,s.marker=!0}(e<i.index||t>0&&e===i.index)&&(i.index=vi(e,i.index+t))}},Fl=(n,e,t)=>{const r=n,i=e.changedParentTypes;for(;wi(i,n,()=>[]).push(t),n._item!==null;)n=n._item.parent;jm(r._eH,t,e)};class je{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Sh(),this._dEH=Sh(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw Rt()}clone(){throw Rt()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){Ch(this._eH,e)}observeDeep(e){Ch(this._dEH,e)}unobserve(e){wh(this._eH,e)}unobserveDeep(e){wh(this._dEH,e)}toJSON(){}}const qm=(n,e,t)=>{n.doc??Xe(),e<0&&(e=n._length+e),t<0&&(t=n._length+t);let r=t-e;const i=[];let s=n._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const o=s.content.getContent();if(o.length<=e)e-=o.length;else{for(let l=e;l<o.length&&r>0;l++)i.push(o[l]),r--;e=0}}s=s.right}return i},Zm=n=>{n.doc??Xe();const e=[];let t=n._start;for(;t!==null;){if(t.countable&&!t.deleted){const r=t.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}t=t.right}return e},gs=(n,e)=>{let t=0,r=n._start;for(n.doc??Xe();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)e(i[s],t++,n)}r=r.right}},Xm=(n,e)=>{const t=[];return gs(n,(r,i)=>{t.push(e(r,i,n))}),t},Qw=n=>{let e=n._start,t=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(t===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};t=e.content.getContent(),r=0,e=e.right}const i=t[r++];return t.length<=r&&(t=null),{done:!1,value:i}}}},Qm=(n,e)=>{n.doc??Xe();const t=$l(n,e);let r=n._start;for(t!==null&&(r=t.p,e-=t.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},Wo=(n,e,t,r)=>{let i=t;const s=n.doc,o=s.clientID,l=s.store,a=t===null?e._start:t.right;let c=[];const u=()=>{c.length>0&&(i=new qe(ye(o,lt(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new si(c)),i.integrate(n,0),c=[])};r.forEach(d=>{if(d===null)c.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(d);break;default:switch(u(),d.constructor){case Uint8Array:case ArrayBuffer:i=new qe(ye(o,lt(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Ll(new Uint8Array(d))),i.integrate(n,0);break;case Kn:i=new qe(ye(o,lt(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Rl(d)),i.integrate(n,0);break;default:if(d instanceof je)i=new qe(ye(o,lt(l,o)),i,i&&i.lastId,a,a&&a.id,e,null,new Zn(d)),i.integrate(n,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},e_=()=>Un("Length exceeded!"),t_=(n,e,t,r)=>{if(t>e._length)throw e_();if(t===0)return e._searchMarker&&hs(e._searchMarker,t,r.length),Wo(n,e,null,r);const i=t,s=$l(e,t);let o=e._start;for(s!==null&&(o=s.p,t-=s.index,t===0&&(o=o.prev,t+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(t<=o.length){t<o.length&&Wn(n,ye(o.id.client,o.id.clock+t));break}t-=o.length}return e._searchMarker&&hs(e._searchMarker,i,r.length),Wo(n,e,o,r)},ev=(n,e,t)=>{let i=(e._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return Wo(n,e,i,t)},n_=(n,e,t,r)=>{if(r===0)return;const i=t,s=r,o=$l(e,t);let l=e._start;for(o!==null&&(l=o.p,t-=o.index);l!==null&&t>0;l=l.right)!l.deleted&&l.countable&&(t<l.length&&Wn(n,ye(l.id.client,l.id.clock+t)),t-=l.length);for(;r>0&&l!==null;)l.deleted||(r<l.length&&Wn(n,ye(l.id.client,l.id.clock+r)),l.delete(n),r-=l.length),l=l.right;if(r>0)throw e_();e._searchMarker&&hs(e._searchMarker,i,-s+r)},jo=(n,e,t)=>{const r=e._map.get(t);r!==void 0&&r.delete(n)},Uu=(n,e,t,r)=>{const i=e._map.get(t)||null,s=n.doc,o=s.clientID;let l;if(r==null)l=new si([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:l=new si([r]);break;case Uint8Array:l=new Ll(r);break;case Kn:l=new Rl(r);break;default:if(r instanceof je)l=new Zn(r);else throw new Error("Unexpected content type")}new qe(ye(o,lt(s.store,o)),i,i&&i.lastId,null,null,e,t,l).integrate(n,0)},Ku=(n,e)=>{n.doc??Xe();const t=n._map.get(e);return t!==void 0&&!t.deleted?t.content.getContent()[t.length-1]:void 0},r_=n=>{const e={};return n.doc??Xe(),n._map.forEach((t,r)=>{t.deleted||(e[r]=t.content.getContent()[t.length-1])}),e},i_=(n,e)=>{n.doc??Xe();const t=n._map.get(e);return t!==void 0&&!t.deleted},tv=(n,e)=>{const t={};return n._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&Hr(s,e)&&(t[i]=s.content.getContent()[s.length-1])}),t},Ys=n=>(n.doc??Xe(),Aw(n._map.entries(),e=>!e[1].deleted));class nv extends Il{}class Vi extends je{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const t=new Vi;return t.push(e),t}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Vi}clone(){const e=new Vi;return e.insert(0,this.toArray().map(t=>t instanceof je?t.clone():t)),e}get length(){return this.doc??Xe(),this._length}_callObserver(e,t){super._callObserver(e,t),Fl(this,e,new nv(this,e))}insert(e,t){this.doc!==null?ge(this.doc,r=>{t_(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}push(e){this.doc!==null?ge(this.doc,t=>{ev(t,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc!==null?ge(this.doc,r=>{n_(r,this,e,t)}):this._prelimContent.splice(e,t)}get(e){return Qm(this,e)}toArray(){return Zm(this)}slice(e=0,t=this.length){return qm(this,e,t)}toJSON(){return this.map(e=>e instanceof je?e.toJSON():e)}map(e){return Xm(this,e)}forEach(e){gs(this,e)}[Symbol.iterator](){return Qw(this)}_write(e){e.writeTypeRef(fv)}}class rv extends Il{constructor(e,t,r){super(e,t),this.keysChanged=r}}class bt extends je{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,t){super._integrate(e,t),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new bt}clone(){const e=new bt;return this.forEach((t,r)=>{e.set(r,t instanceof je?t.clone():t)}),e}_callObserver(e,t){Fl(this,e,new rv(this,e,t))}toJSON(){this.doc??Xe();const e={};return this._map.forEach((t,r)=>{if(!t.deleted){const i=t.content.getContent()[t.length-1];e[r]=i instanceof je?i.toJSON():i}}),e}get size(){return[...Ys(this)].length}keys(){return ka(Ys(this),e=>e[0])}values(){return ka(Ys(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return ka(Ys(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Xe(),this._map.forEach((t,r)=>{t.deleted||e(t.content.getContent()[t.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?ge(this.doc,t=>{jo(t,this,e)}):this._prelimContent.delete(e)}set(e,t){return this.doc!==null?ge(this.doc,r=>{Uu(r,this,e,t)}):this._prelimContent.set(e,t),t}get(e){return Ku(this,e)}has(e){return i_(this,e)}clear(){this.doc!==null?ge(this.doc,e=>{this.forEach(function(t,r,i){jo(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(hv)}}const Mn=(n,e)=>n===e||typeof n=="object"&&typeof e=="object"&&n&&e&&MC(n,e);class vc{constructor(e,t,r,i){this.left=e,this.right=t,this.index=r,this.currentAttributes=i}forward(){this.right===null&&_n(),this.right.content.constructor===Pe?this.right.deleted||ki(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}const Nh=(n,e,t)=>{for(;e.right!==null&&t>0;)e.right.content.constructor===Pe?e.right.deleted||ki(e.currentAttributes,e.right.content):e.right.deleted||(t<e.right.length&&Wn(n,ye(e.right.id.client,e.right.id.clock+t)),e.index+=e.right.length,t-=e.right.length),e.left=e.right,e.right=e.right.right;return e},qs=(n,e,t,r)=>{const i=new Map,s=r?$l(e,t):null;if(s){const o=new vc(s.p.left,s.p,s.index,i);return Nh(n,o,t-s.index)}else{const o=new vc(null,e._start,0,i);return Nh(n,o,t)}},s_=(n,e,t,r)=>{for(;t.right!==null&&(t.right.deleted===!0||t.right.content.constructor===Pe&&Mn(r.get(t.right.content.key),t.right.content.value));)t.right.deleted||r.delete(t.right.content.key),t.forward();const i=n.doc,s=i.clientID;r.forEach((o,l)=>{const a=t.left,c=t.right,u=new qe(ye(s,lt(i.store,s)),a,a&&a.lastId,c,c&&c.id,e,null,new Pe(l,o));u.integrate(n,0),t.right=u,t.forward()})},ki=(n,e)=>{const{key:t,value:r}=e;r===null?n.delete(t):n.set(t,r)},o_=(n,e)=>{for(;n.right!==null;){if(!(n.right.deleted||n.right.content.constructor===Pe&&Mn(e[n.right.content.key]??null,n.right.content.value)))break;n.forward()}},l_=(n,e,t,r)=>{const i=n.doc,s=i.clientID,o=new Map;for(const l in r){const a=r[l],c=t.currentAttributes.get(l)??null;if(!Mn(c,a)){o.set(l,c);const{left:u,right:d}=t;t.right=new qe(ye(s,lt(i.store,s)),u,u&&u.lastId,d,d&&d.id,e,null,new Pe(l,a)),t.right.integrate(n,0),t.forward()}}return o},Na=(n,e,t,r,i)=>{t.currentAttributes.forEach((f,h)=>{i[h]===void 0&&(i[h]=null)});const s=n.doc,o=s.clientID;o_(t,i);const l=l_(n,e,t,i),a=r.constructor===String?new xn(r):r instanceof je?new Zn(r):new Ti(r);let{left:c,right:u,index:d}=t;e._searchMarker&&hs(e._searchMarker,t.index,a.getLength()),u=new qe(ye(o,lt(s.store,o)),c,c&&c.lastId,u,u&&u.id,e,null,a),u.integrate(n,0),t.right=u,t.index=d,t.forward(),s_(n,e,t,l)},Ah=(n,e,t,r,i)=>{const s=n.doc,o=s.clientID;o_(t,i);const l=l_(n,e,t,i);e:for(;t.right!==null&&(r>0||l.size>0&&(t.right.deleted||t.right.content.constructor===Pe));){if(!t.right.deleted)switch(t.right.content.constructor){case Pe:{const{key:a,value:c}=t.right.content,u=i[a];if(u!==void 0){if(Mn(u,c))l.delete(a);else{if(r===0)break e;l.set(a,c)}t.right.delete(n)}else t.currentAttributes.set(a,c);break}default:r<t.right.length&&Wn(n,ye(t.right.id.client,t.right.id.clock+r)),r-=t.right.length;break}t.forward()}if(r>0){let a="";for(;r>0;r--)a+=`
|
|
38
|
+
`;t.right=new qe(ye(o,lt(s.store,o)),t.left,t.left&&t.left.lastId,t.right,t.right&&t.right.id,e,null,new xn(a)),t.right.integrate(n,0),t.forward()}s_(n,e,t,l)},a_=(n,e,t,r,i)=>{let s=e;const o=Yt();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===Pe){const c=s.content;o.set(c.key,c)}s=s.right}let l=0,a=!1;for(;e!==s;){if(t===e&&(a=!0),!e.deleted){const c=e.content;if(c.constructor===Pe){const{key:u,value:d}=c,f=r.get(u)??null;(o.get(u)!==c||f===d)&&(e.delete(n),l++,!a&&(i.get(u)??null)===d&&f!==d&&(f===null?i.delete(u):i.set(u,f))),!a&&!e.deleted&&ki(i,c)}}e=e.right}return l},iv=(n,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const t=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===Pe){const r=e.content.key;t.has(r)?e.delete(n):t.add(r)}e=e.left}},sv=n=>{let e=0;return ge(n.doc,t=>{let r=n._start,i=n._start,s=Yt();const o=_c(s);for(;i;)i.deleted===!1&&(i.content.constructor===Pe?ki(o,i.content):(e+=a_(t,r,i,s,o),s=_c(o),r=i)),i=i.right}),e},ov=n=>{const e=new Set,t=n.doc;for(const[r,i]of n.afterState.entries()){const s=n.beforeState.get(r)||0;i!==s&&Jm(n,t.store.clients.get(r),s,i,o=>{!o.deleted&&o.content.constructor===Pe&&o.constructor!==Nn&&e.add(o.parent)})}ge(t,r=>{zm(n,n.deleteSet,i=>{if(i instanceof Nn||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===Pe?e.add(s):iv(r,i)});for(const i of e)sv(i)})},Oh=(n,e,t)=>{const r=t,i=_c(e.currentAttributes),s=e.right;for(;t>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case Zn:case Ti:case xn:t<e.right.length&&Wn(n,ye(e.right.id.client,e.right.id.clock+t)),t-=e.right.length,e.right.delete(n);break}e.forward()}s&&a_(n,s,e.right,i,e.currentAttributes);const o=(e.left||e.right).parent;return o._searchMarker&&hs(o._searchMarker,e.index,-r+t),e};class lv extends Il{constructor(e,t,r){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,t=[];ge(e,r=>{const i=new Map,s=new Map;let o=this.target._start,l=null;const a={};let c="",u=0,d=0;const f=()=>{if(l!==null){let h=null;switch(l){case"delete":d>0&&(h={delete:d}),d=0;break;case"insert":(typeof c=="object"||c.length>0)&&(h={insert:c},i.size>0&&(h.attributes={},i.forEach((g,p)=>{g!==null&&(h.attributes[p]=g)}))),c="";break;case"retain":u>0&&(h={retain:u},OC(a)||(h.attributes=TC({},a))),u=0;break}h&&t.push(h),l=null}};for(;o!==null;){switch(o.content.constructor){case Zn:case Ti:this.adds(o)?this.deletes(o)||(f(),l="insert",c=o.content.getContent()[0],f()):this.deletes(o)?(l!=="delete"&&(f(),l="delete"),d+=1):o.deleted||(l!=="retain"&&(f(),l="retain"),u+=1);break;case xn:this.adds(o)?this.deletes(o)||(l!=="insert"&&(f(),l="insert"),c+=o.content.str):this.deletes(o)?(l!=="delete"&&(f(),l="delete"),d+=o.length):o.deleted||(l!=="retain"&&(f(),l="retain"),u+=o.length);break;case Pe:{const{key:h,value:g}=o.content;if(this.adds(o)){if(!this.deletes(o)){const p=i.get(h)??null;Mn(p,g)?g!==null&&o.delete(r):(l==="retain"&&f(),Mn(g,s.get(h)??null)?delete a[h]:a[h]=g)}}else if(this.deletes(o)){s.set(h,g);const p=i.get(h)??null;Mn(p,g)||(l==="retain"&&f(),a[h]=p)}else if(!o.deleted){s.set(h,g);const p=a[h];p!==void 0&&(Mn(p,g)?p!==null&&o.delete(r):(l==="retain"&&f(),g===null?delete a[h]:a[h]=g))}o.deleted||(l==="insert"&&f(),ki(i,o.content));break}}o=o.right}for(f();t.length>0;){const h=t[t.length-1];if(h.retain!==void 0&&h.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}}class ps extends je{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Xe(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new ps}clone(){const e=new ps;return e.applyDelta(this.toDelta()),e}_callObserver(e,t){super._callObserver(e,t);const r=new lv(this,e,t);Fl(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Xe();let e="",t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===xn&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc!==null?ge(this.doc,r=>{const i=new vc(null,this._start,0,new Map);for(let s=0;s<e.length;s++){const o=e[s];if(o.insert!==void 0){const l=!t&&typeof o.insert=="string"&&s===e.length-1&&i.right===null&&o.insert.slice(-1)===`
|
|
39
|
+
`?o.insert.slice(0,-1):o.insert;(typeof l!="string"||l.length>0)&&Na(r,this,i,l,o.attributes||{})}else o.retain!==void 0?Ah(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&Oh(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,t,r){this.doc??Xe();const i=[],s=new Map,o=this.doc;let l="",a=this._start;function c(){if(l.length>0){const d={};let f=!1;s.forEach((g,p)=>{f=!0,d[p]=g});const h={insert:l};f&&(h.attributes=d),i.push(h),l=""}}const u=()=>{for(;a!==null;){if(Hr(a,e)||t!==void 0&&Hr(a,t))switch(a.content.constructor){case xn:{const d=s.get("ychange");e!==void 0&&!Hr(a,e)?(d===void 0||d.user!==a.id.client||d.type!=="removed")&&(c(),s.set("ychange",r?r("removed",a.id):{type:"removed"})):t!==void 0&&!Hr(a,t)?(d===void 0||d.user!==a.id.client||d.type!=="added")&&(c(),s.set("ychange",r?r("added",a.id):{type:"added"})):d!==void 0&&(c(),s.delete("ychange")),l+=a.content.str;break}case Zn:case Ti:{c();const d={insert:a.content.getContent()[0]};if(s.size>0){const f={};d.attributes=f,s.forEach((h,g)=>{f[g]=h})}i.push(d);break}case Pe:Hr(a,e)&&(c(),ki(s,a.content));break}a=a.right}c()};return e||t?ge(o,d=>{e&&Cc(d,e),t&&Cc(d,t),u()},"cleanup"):u(),i}insert(e,t,r){if(t.length<=0)return;const i=this.doc;i!==null?ge(i,s=>{const o=qs(s,this,e,!r);r||(r={},o.currentAttributes.forEach((l,a)=>{r[a]=l})),Na(s,this,o,t,r)}):this._pending.push(()=>this.insert(e,t,r))}insertEmbed(e,t,r){const i=this.doc;i!==null?ge(i,s=>{const o=qs(s,this,e,!r);Na(s,this,o,t,r||{})}):this._pending.push(()=>this.insertEmbed(e,t,r||{}))}delete(e,t){if(t===0)return;const r=this.doc;r!==null?ge(r,i=>{Oh(i,qs(i,this,e,!0),t)}):this._pending.push(()=>this.delete(e,t))}format(e,t,r){if(t===0)return;const i=this.doc;i!==null?ge(i,s=>{const o=qs(s,this,e,!1);o.right!==null&&Ah(s,this,o,t,r)}):this._pending.push(()=>this.format(e,t,r))}removeAttribute(e){this.doc!==null?ge(this.doc,t=>{jo(t,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,t){this.doc!==null?ge(this.doc,r=>{Uu(r,this,e,t)}):this._pending.push(()=>this.setAttribute(e,t))}getAttribute(e){return Ku(this,e)}getAttributes(){return r_(this)}_write(e){e.writeTypeRef(gv)}}class Aa{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Xe()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===bn||t.constructor===ii)&&t._start!==null)e=t._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class ii extends je{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new ii}clone(){const e=new ii;return e.insert(0,this.toArray().map(t=>t instanceof je?t.clone():t)),e}get length(){return this.doc??Xe(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new Aa(this,e)}querySelector(e){e=e.toUpperCase();const r=new Aa(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),ni(new Aa(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){Fl(this,e,new av(this,t,e))}toString(){return Xm(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,t={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),gs(this,s=>{i.insertBefore(s.toDOM(e,t,r),null)}),i}insert(e,t){this.doc!==null?ge(this.doc,r=>{t_(r,this,e,t)}):this._prelimContent.splice(e,0,...t)}insertAfter(e,t){if(this.doc!==null)ge(this.doc,r=>{const i=e&&e instanceof je?e._item:e;Wo(r,this,i,t)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw Un("Reference item not found");r.splice(i,0,...t)}}delete(e,t=1){this.doc!==null?ge(this.doc,r=>{n_(r,this,e,t)}):this._prelimContent.splice(e,t)}toArray(){return Zm(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Qm(this,e)}slice(e=0,t=this.length){return qm(this,e,t)}forEach(e){gs(this,e)}_write(e){e.writeTypeRef(mv)}}class bn extends ii{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new bn(this.nodeName)}clone(){const e=new bn(this.nodeName),t=this.getAttributes();return AC(t,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof je?r.clone():r)),e}toString(){const e=this.getAttributes(),t=[],r=[];for(const l in e)r.push(l);r.sort();const i=r.length;for(let l=0;l<i;l++){const a=r[l];t.push(a+'="'+e[a]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=t.length>0?" "+t.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?ge(this.doc,t=>{jo(t,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,t){this.doc!==null?ge(this.doc,r=>{Uu(r,this,e,t)}):this._prelimAttrs.set(e,t)}getAttribute(e){return Ku(this,e)}hasAttribute(e){return i_(this,e)}getAttributes(e){return e?tv(this,e):r_(this)}toDOM(e=document,t={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const l=s[o];typeof l=="string"&&i.setAttribute(o,l)}return gs(this,o=>{i.appendChild(o.toDOM(e,t,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(pv),e.writeKey(this.nodeName)}}class av extends Il{constructor(e,t,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class jn extends ps{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new jn}clone(){const e=new jn;return e.applyDelta(this.toDelta()),e}toDOM(e=document,t,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const t=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,l)=>o.key<l.key?-1:1),t.push({nodeName:i,attrs:s})}t.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<t.length;i++){const s=t[i];r+=`<${s.nodeName}`;for(let o=0;o<s.attrs.length;o++){const l=s.attrs[o];r+=` ${l.key}="${l.value}"`}r+=">"}r+=e.insert;for(let i=t.length-1;i>=0;i--)r+=`</${t[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(_v)}}class c_{constructor(e,t){this.id=e,this.length=t}get deleted(){throw Rt()}mergeWith(e){return!1}write(e,t,r){throw Rt()}integrate(e,t){throw Rt()}}const cv=0;class Nn extends c_{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),Hm(e.doc.store,this)}write(e,t){e.writeInfo(cv),e.writeLen(this.length-t)}getMissing(e,t){return null}}class Ll{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Ll(this.content)}splice(e){throw Rt()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}}class Ho{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Ho(this.len)}splice(e){const t=new Ho(this.len-e);return this.len=e,t}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){Km(e.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(e){}gc(e){}write(e,t){e.writeLen(this.len-t)}getRef(){return 1}}const uv=(n,e)=>new Kn({guid:n,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Rl{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const t={};this.opts=t,e.gc||(t.gc=!1),e.autoLoad&&(t.autoLoad=!0),e.meta!==null&&(t.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new Rl(uv(this.doc.guid,this.opts))}splice(e){throw Rt()}mergeWith(e){return!1}integrate(e,t){this.doc._item=t,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,t){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}class Ti{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Ti(this.embed)}splice(e){throw Rt()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}}class Pe{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new Pe(this.key,this.value)}splice(e){throw Rt()}mergeWith(e){return!1}integrate(e,t){const r=t.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const dv=Bo("node_env")==="development";class si{constructor(e){this.arr=e,dv&&pm(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new si(this.arr)}splice(e){const t=new si(this.arr.slice(e));return this.arr=this.arr.slice(0,e),t}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){const r=this.arr.length;e.writeLen(r-t);for(let i=t;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}class xn{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new xn(this.str)}splice(e){const t=new xn(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(e){return this.str+=e.str,!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}}const fv=0,hv=1,gv=2,pv=3,mv=4,_v=6;class Zn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Zn(this.type._copy())}splice(e){throw Rt()}mergeWith(e){return!1}integrate(e,t){this.type._integrate(e.doc,t)}delete(e){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.delete(e),t=t.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let t=this.type._start;for(;t!==null;)t.gc(e,!0),t=t.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}}const u_=(n,e,t)=>{const{client:r,clock:i}=e.id,s=new qe(ye(r,i+t),e,ye(r,i+t-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(t));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=ye(e.redone.client,e.redone.clock+t)),e.right=s,s.right!==null&&(s.right.left=s),n._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=t,s};class qe extends c_{constructor(e,t,r,i,s,o,l,a){super(e,a.getLength()),this.origin=r,this.left=t,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=l,this.redone=null,this.content=a,this.info=this.content.isCountable()?ah:0}set marker(e){(this.info&Sa)>0!==e&&(this.info^=Sa)}get marker(){return(this.info&Sa)>0}get keep(){return(this.info&lh)>0}set keep(e){this.keep!==e&&(this.info^=lh)}get countable(){return(this.info&ah)>0}get deleted(){return(this.info&xa)>0}set deleted(e){this.deleted!==e&&(this.info^=xa)}markDeleted(){this.info|=xa}getMissing(e,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=lt(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=lt(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===oo&&this.id.client!==this.parent.client&&this.parent.clock>=lt(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=vh(e,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Wn(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Nn||this.right&&this.right.constructor===Nn)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===qe?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===qe&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===oo){const r=Ta(t,this.parent);r.constructor===Nn?this.parent=null:this.parent=r.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=vh(e,e.doc.store,ye(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),Vs(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(Vs(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(Ta(e.doc.store,i.origin)))s.has(Ta(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Hm(e.doc.store,this),this.content.integrate(e,this),kh(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Nn(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:ye(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Vs(e.origin,this.lastId)&&this.right===e&&Vs(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const t=this.parent._searchMarker;return t&&t.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),Km(e.deleteSet,this.id.client,this.id.clock,this.length),kh(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw _n();this.content.gc(e),t?Hw(e,this,new Nn(this.id,this.length)):this.content=new Ho(this.length)}write(e,t){const r=t>0?ye(this.id.client,this.id.clock+t-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&XS|(r===null?0:Po)|(i===null?0:dm)|(s===null?0:ZS);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const l=this.parent;if(l._item!==void 0){const a=l._item;if(a===null){const c=Kw(l);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(a.id)}else l.constructor===String?(e.writeParentInfo(!0),e.writeString(l)):l.constructor===oo?(e.writeParentInfo(!1),e.writeLeftID(l)):_n();s!==null&&e.writeString(s)}this.content.write(e,t)}}const d_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},f_="__ $YJS$ __";d_[f_]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");d_[f_]=!0;function Ke(n,...e){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const i of e)r.append("v",i);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 yv(n,e,t){const r=n.length,i=e.length;let s=0,o=0;for(;s<r&&s<i&&n[s]===e[s]&&s<t;)s++;for(;o+s<r&&o+s<i&&n[r-o-1]===e[i-o-1];)o++;for(;o+s<r&&o+s<i&&n[s]===e[s];)s++;return{index:s,insert:e.slice(s,i-o),remove:r-s-o}}class rr{_xmlElem;_key;_parent;_type;constructor(e,t,r){this._key="",this._xmlElem=e,this._parent=t,this._type=r}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return Z(t)?t:null}getNode(){const e=Q(this._key);return Z(e)?e:null}getSharedType(){return this._xmlElem}getType(){return this._type}getKey(){return this._key}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}syncPropertiesFromLexical(e,t,r){const i=this.getPrevNode(r);Hu(e,this._xmlElem,i,t)}syncPropertiesFromYjs(e,t){const r=this.getNode();r===null&&Ke(83),ju(e,this._xmlElem,r,t)}destroy(e){const t=e.collabNodeMap;t.get(this._key)===this&&t.delete(this._key)}}function h_(n,e,t){const r=new rr(n,e,t);return n._collabNode=r,r}class Bi{_map;_key;_parent;_type;constructor(e,t){this._key="",this._map=e,this._parent=t,this._type="linebreak"}getNode(){const e=Q(this._key);return ue(e)?e:null}getKey(){return this._key}getSharedType(){return this._map}getType(){return this._type}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}destroy(e){const t=e.collabNodeMap;t.get(this._key)===this&&t.delete(this._key)}}function g_(n,e){const t=new Bi(n,e);return n._collabNode=t,t}class xt{_map;_key;_parent;_text;_type;_normalized;constructor(e,t,r,i){this._key="",this._map=e,this._parent=r,this._text=t,this._type=i,this._normalized=!1}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return L(t)?t:null}getNode(){const e=Q(this._key);return L(e)?e:null}getSharedType(){return this._map}getType(){return this._type}getKey(){return this._key}getSize(){return this._text.length+(this._normalized?0:1)}getOffset(){return this._parent.getChildOffset(this)}spliceText(e,t,r){const i=this._parent._xmlText,s=this.getOffset()+1+e;t!==0&&i.delete(s,t),r!==""&&i.insert(s,r)}syncPropertiesAndTextFromLexical(e,t,r){const i=this.getPrevNode(r),s=t.__text;if(Hu(e,this._map,i,t),i!==null){const o=i.__text;o!==s&&((function(l,a,c,u){const d=M();let f=u.length;if(N(d)&&d.isCollapsed()){const g=d.anchor;g.key===a&&(f=g.offset)}const h=yv(c,u,f);l.spliceText(h.index,h.remove,h.insert)})(this,t.__key,o,s),this._text=s)}}syncPropertiesAndTextFromYjs(e,t){const r=this.getNode();r===null&&Ke(84),ju(e,this._map,r,t);const i=this._text;r.__text!==i&&r.setTextContent(i)}destroy(e){const t=e.collabNodeMap;t.get(this._key)===this&&t.delete(this._key)}}function p_(n,e,t,r){const i=new xt(n,e,t,r);return n._collabNode=i,i}class on{_key;_children;_xmlText;_type;_parent;constructor(e,t,r){this._key="",this._children=[],this._xmlText=e,this._type=r,this._parent=t}getPrevNode(e){if(e===null)return null;const t=e.get(this._key);return O(t)?t:null}getNode(){const e=Q(this._key);return O(e)?e:null}getSharedType(){return this._xmlText}getType(){return this._type}getKey(){return this._key}isEmpty(){return this._children.length===0}getSize(){return 1}getOffset(){const e=this._parent;return e===null&&Ke(90),e.getChildOffset(this)}syncPropertiesFromYjs(e,t){const r=this.getNode();r===null&&Ke(91),ju(e,this._xmlText,r,t)}applyChildrenYjsDelta(e,t){const r=this._children;let i=0,s=null;for(let o=0;o<t.length;o++){const l=t[o],a=l.insert,c=l.delete;if(l.retain!=null)i+=l.retain;else if(typeof c=="number"){let u=c;for(;u>0;){const{node:d,nodeIndex:f,offset:h,length:g}=Oa(this,i,!1);if(d instanceof on||d instanceof Bi||d instanceof rr)r.splice(f,1),u-=1;else{if(!(d instanceof xt))break;{const p=Math.min(u,g),m=f!==0?r[f-1]:null,b=d.getSize();if(h===0&&g===b){r.splice(f,1);const _=Ii(d._text,h,p-1,"");_.length>0&&(m instanceof xt?m._text+=_:this._xmlText.delete(h,_.length))}else d._text=Ii(d._text,h,p,"");u-=p}}}}else{if(a==null)throw new Error("Unexpected delta format");if(typeof a=="string"){const{node:u,offset:d}=Oa(this,i,!0);u instanceof xt?u._text=Ii(u._text,d,0,a):this._xmlText.delete(d,a.length),i+=a.length}else{const u=a,{node:d,nodeIndex:f,length:h}=Oa(this,i,!1),g=__(e,u,this);if(d instanceof xt&&h>0&&h<d._text.length){const p=d._text,m=p.length-h;d._text=Ii(p,m,h,""),r.splice(f+1,0,g),s=Ii(p,0,m,"")}else r.splice(f,0,g);s!==null&&g instanceof xt&&(g._text=s+g._text,s=null),i+=1}}}}syncChildrenFromYjs(e){const t=this.getNode();t===null&&Ke(92);const r=t.__key,i=ar(t,null),s=i.length,o=this._children,l=o.length,a=e.collabNodeMap,c=new Set;let u,d,f=0,h=null;l!==s&&(d=t.getWritable());for(let g=0;g<l;g++){const p=i[f],m=o[g],b=m.getNode(),_=m._key;if(b!==null&&p===_){const y=L(b);if(c.add(p),y)if(m._key=p,m instanceof on){const C=m._xmlText;m.syncPropertiesFromYjs(e,null),m.applyChildrenYjsDelta(e,C.toDelta()),m.syncChildrenFromYjs(e)}else m instanceof xt?m.syncPropertiesAndTextFromYjs(e,null):m instanceof rr?m.syncPropertiesFromYjs(e,null):m instanceof Bi||Ke(93);h=b,f++}else{if(u===void 0){u=new Set;for(let S=0;S<l;S++){const w=o[S]._key;w!==""&&u.add(w)}}if(b!==null&&p!==void 0&&!u.has(p)){const S=nr(p);Jt(S),g--,f++;continue}d=t.getWritable();const y=Nv(e,m,r),C=y.__key;if(a.set(C,m),h===null){const S=d.getFirstChild();if(d.__first=C,S!==null){const w=S.getWritable();w.__prev=C,y.__next=w.__key}}else{const S=h.getWritable(),w=h.getNextSibling();if(S.__next=C,y.__prev=h.__key,w!==null){const x=w.getWritable();x.__prev=C,y.__next=x.__key}}g===l-1&&(d.__last=C),d.__size++,h=y}}for(let g=0;g<s;g++){const p=i[g];if(!c.has(p)){const m=nr(p),b=e.collabNodeMap.get(p);b!==void 0&&b.destroy(e),Jt(m)}}}syncPropertiesFromLexical(e,t,r){Hu(e,this._xmlText,this.getPrevNode(r),t)}_syncChildFromLexical(e,t,r,i,s,o){const l=this._children[t],a=nr(r);l instanceof on&&O(a)?(l.syncPropertiesFromLexical(e,a,i),l.syncChildrenFromLexical(e,a,i,s,o)):l instanceof xt&&L(a)?l.syncPropertiesAndTextFromLexical(e,a,i):l instanceof rr&&Z(a)&&l.syncPropertiesFromLexical(e,a,i)}syncChildrenFromLexical(e,t,r,i,s){const o=this.getPrevNode(r),l=o===null?[]:ar(o,r),a=ar(t,null),c=l.length-1,u=a.length-1,d=e.collabNodeMap;let f,h,g=0,p=0;for(;g<=c&&p<=u;){const _=l[g],y=a[p];if(_===y)this._syncChildFromLexical(e,p,y,r,i,s),g++,p++;else{f===void 0&&(f=new Set(l)),h===void 0&&(h=new Set(a));const C=h.has(_),S=f.has(y);if(C){const w=Mh(e,nr(y),this);d.set(y,w),S?(this.splice(e,p,1,w),g++,p++):(this.splice(e,p,0,w),p++)}else this.splice(e,p,1),g++}}const m=g>c,b=p>u;if(m&&!b)for(;p<=u;++p){const _=a[p],y=Mh(e,nr(_),this);this.append(y),d.set(_,y)}else if(b&&!m)for(let _=this._children.length-1;_>=p;_--)this.splice(e,_,1)}append(e){const t=this._xmlText,r=this._children,i=r[r.length-1],s=i!==void 0?i.getOffset()+i.getSize():0;if(e instanceof on)t.insertEmbed(s,e._xmlText);else if(e instanceof xt){const o=e._map;o.parent===null&&t.insertEmbed(s,o),t.insert(s+1,e._text)}else e instanceof Bi?t.insertEmbed(s,e._map):e instanceof rr&&t.insertEmbed(s,e._xmlElem);this._children.push(e)}splice(e,t,r,i){const s=this._children,o=s[t];if(o===void 0)return i===void 0&&Ke(94),void this.append(i);const l=o.getOffset();l===-1&&Ke(95);const a=this._xmlText;if(r!==0&&a.delete(l,o.getSize()),i instanceof on)a.insertEmbed(l,i._xmlText);else if(i instanceof xt){const c=i._map;c.parent===null&&a.insertEmbed(l,c),a.insert(l+1,i._text)}else i instanceof Bi?a.insertEmbed(l,i._map):i instanceof rr&&a.insertEmbed(l,i._xmlElem);if(r!==0){const c=s.slice(t,t+r);for(let u=0;u<c.length;u++)c[u].destroy(e)}i!==void 0?s.splice(t,r,i):s.splice(t,r)}getChildOffset(e){let t=0;const r=this._children;for(let i=0;i<r.length;i++){const s=r[i];if(s===e)return t;t+=s.getSize()}return-1}destroy(e){const t=e.collabNodeMap,r=this._children;for(let i=0;i<r.length;i++)r[i].destroy(e);t.get(this._key)===this&&t.delete(this._key)}}function Wu(n,e,t){const r=new on(n,e,t);return n._collabNode=r,r}function bv(n,e,t,r,i){t==null&&Ke(81);const s={clientID:t.clientID,cursors:new Map,cursorsContainer:null,doc:t,docMap:r,editor:n,excludedProperties:i||new Map,id:e,nodeProperties:new Map};return(function(o){const{editor:l,nodeProperties:a}=o;l.update(()=>{l._nodes.forEach(c=>{const u=new c.klass,d={};for(const[f,h]of Object.entries(u))m_(f,u,o)||(d[f]=h);a.set(u.__type,Object.freeze(d))})})})(s),s}function xv(n,e,t,r,i,s){r==null&&Ke(81);const o=Wu(r.get("root",jn),null,"root");return o._key="root",{...bv(n,t,r,i,s),collabNodeMap:new Map,root:o}}function Sv(n){return Object.hasOwn(n,"collabNodeMap")}const Cv=new Set(["__key","__parent","__next","__prev","__state"]),wv=new Set(["__first","__last","__size"]),vv=new Set(["__cachedText"]),Ev=new Set(["__text"]);function m_(n,e,t){if(Cv.has(n)||typeof e[n]=="function")return!0;if(L(e)){if(Ev.has(n))return!0}else if(O(e)&&(wv.has(n)||_e(e)&&vv.has(n)))return!0;const r=e.constructor,i=t.excludedProperties.get(r);return i!=null&&i.has(n)}function kv(n,e){const t=n.__type,{nodeProperties:r}=e,i=r.get(t);return i===void 0&&Ke(330,t),i}function Mh(n,e,t){const r=e.__type;let i;if(O(e))i=Wu(new jn,t,r),i.syncPropertiesFromLexical(n,e,null),i.syncChildrenFromLexical(n,e,null,null,null);else if(L(e))i=p_(new bt,e.__text,t,r),i.syncPropertiesAndTextFromLexical(n,e,null);else if(ue(e)){const s=new bt;s.set("__type","linebreak"),i=g_(s,t)}else Z(e)?(i=h_(new bn,t,r),i.syncPropertiesFromLexical(n,e,null)):Ke(86);return i._key=e.__key,i}function Tv(n){const e=Dl(n,"__type");return typeof e!="string"&&e!==void 0&&Ke(87),e}function __(n,e,t){const r=e._collabNode;if(r===void 0){const i=n.editor._nodes,s=Tv(e);typeof s!="string"&&Ke(87),i.get(s)===void 0&&Ke(88,s);const o=e.parent,l=t===void 0&&o!==null?__(n,o):t||null;if(l instanceof on||Ke(89),e instanceof jn)return Wu(e,l,s);if(e instanceof bt)return s==="linebreak"?g_(e,l):p_(e,"",l,s);if(e instanceof bn)return h_(e,l,s)}return r}function Nv(n,e,t){const r=e.getType(),i=n.editor._nodes.get(r);i===void 0&&Ke(88,r);const s=new i.klass;if(s.__parent=t,e._key=s.__key,e instanceof on){const o=e._xmlText;e.syncPropertiesFromYjs(n,null),e.applyChildrenYjsDelta(n,o.toDelta()),e.syncChildrenFromYjs(n)}else e instanceof xt?e.syncPropertiesAndTextFromYjs(n,null):e instanceof rr&&e.syncPropertiesFromYjs(n,null);return n.collabNodeMap.set(s.__key,e),s}function ju(n,e,t,r){const i=r===null?e instanceof bt?Array.from(e.keys()):e instanceof jn||e instanceof bn?Object.keys(e.getAttributes()):Object.keys(e):Array.from(r);let s;for(let o=0;o<i.length;o++){const l=i[o];if(m_(l,t,n)){l==="__state"&&Sv(n)&&(s||(s=t.getWritable()),Av(e,s));continue}const a=t[l];let c=Dl(e,l);if(a!==c){if(c instanceof Kn){const u=n.docMap;a instanceof Kn&&u.delete(a.guid);const d=pi(),f=c.guid;d._key=f,u.set(f,c),c=d}s===void 0&&(s=t.getWritable()),s[l]=c}}}function Dl(n,e){return n instanceof bt?n.get(e):n instanceof jn||n instanceof bn?n.getAttribute(e):n[e]}function Ih(n,e,t){n instanceof bt?n.set(e,t):n.setAttribute(e,t)}function Av(n,e){const t=Dl(n,"__state");t instanceof bt&&Vo(e).updateFromJSON(t.toJSON())}function Hu(n,e,t,r){const i=Object.keys(kv(r,n)),s=n.editor.constructor;(function(o,l,a,c){const u=c.__state,d=Dl(l,"__state");if(!u)return;const[f,h]=u.getInternalState(),g=a&&a.__state,p=d instanceof bt?d:new bt;if(g===u)return;const[m,b]=g&&p.doc?g.getInternalState():[void 0,new Map];if(f)for(const[_,y]of Object.entries(f))m&&y!==m[_]&&p.set(_,y);for(const[_,y]of h)b.get(_)!==y&&p.set(_.key,_.unparse(y));d||Ih(l,"__state",p)})(0,e,t,r);for(let o=0;o<i.length;o++){const l=i[o],a=t===null?void 0:t[l];let c=r[l];if(a!==c){if(c instanceof s){const u=n.docMap;let d;if(a instanceof s){const g=a._key;d=u.get(g),u.delete(g)}const f=d||new Kn,h=f.guid;c._key=h,u.set(h,f),c=f,n.editor.update(()=>{r.markDirty()})}Ih(e,l,c)}}}function Ii(n,e,t,r){return n.slice(0,e)+r+n.slice(e+t)}function Oa(n,e,t){let r=0,i=0;const s=n._children,o=s.length;for(;i<o;i++){const l=s[i],a=r;if(r+=l.getSize(),(t?r>=e:r>e)&&l instanceof xt){let c=e-a-1;return c<0&&(c=0),{length:r-e,node:l,nodeIndex:i,offset:c}}if(r>e)return{length:0,node:l,nodeIndex:i,offset:a};if(i===o-1)return{length:0,node:null,nodeIndex:i+1,offset:a+1}}return{length:0,node:null,nodeIndex:0,offset:0}}Ac("ychange",{isEqual:(n,e)=>n===e,parse:n=>n??null});async function y_(){return ib}async function Pl(n){return Zb(n)}async function zl(n){return lS(n)}async function Bl(n,e){const t=Xp(),r=e?.delay??300;return Zp(n,t,r)}async function Ul(n){return()=>{}}async function Kl(n){return typeof da=="function"?typeof gf=="function"?mt(da(n),gf(n)):da(n):mt(n.registerCommand(Si,()=>(fa(n,"number"),!0),q),n.registerCommand(xi,()=>(fa(n,"bullet"),!0),q),n.registerCommand(xl,()=>(fa(n,"check"),!0),q),n.registerCommand(_u,()=>(ox(n),!0),q))}async function Wl(n){return n.registerCommand(cc,e=>(e===null||typeof e=="string"?ha(e):ha(e.url,e),!0),q)}async function Ov(n,e,t){const r=e?.trigger||"/";let i=!1,s=null,o=0;const l=()=>n.getEditorState().read(()=>{const p=M();if(!N(p)||!p.isCollapsed())return!1;const m=p.anchor,b=m.getNode();if(!L(b))return!1;const _=b.getTextContent(),y=m.offset;if(y===0||_[y-1]!==r)return!1;if(y===1)return!0;const S=_[y-2];return!!/\s/.test(S)}),a=()=>s?n.getEditorState().read(()=>{if(!s)return"";const p=s.getTextContent(),m=p.indexOf(r,o);if(m===-1)return"";const b=M();if(!N(b))return"";const _=b.anchor;if(_.getNode().getKey()!==s.getKey())return"";const C=_.offset;return C<=m?"":p.slice(m+1,C)}):"",c=()=>{n.getEditorState().read(()=>{const p=M();if(N(p)){const m=p.anchor,b=m.getNode();if(L(b)){s=b,o=m.offset-1,i=!0;const _={isActive:!0,filterText:"",anchorNode:s,anchorOffset:o};t?.onTrigger?.(_,d),t?.onUpdate?.(_,d)}}})},u=()=>{i&&(i=!1,s=null,o=0,t?.onDismiss?.())},d=()=>{s&&n.update(()=>{if(!s)return;const p=s.getTextContent(),m=p.indexOf(r,o);if(m===-1)return;const b=M();if(!N(b))return;const _=b.anchor;if(_.getNode().getKey()!==s.getKey())return;const C=_.offset,S=p.slice(0,m),w=p.slice(C);s.setTextContent(S+w);const x=M();N(x)&&(x.anchor.set(s.getKey(),m,"text"),x.focus.set(s.getKey(),m,"text"))})},f=()=>{if(!i)return;const m={isActive:!0,filterText:a(),anchorNode:s,anchorOffset:o};t?.onUpdate?.(m,d)},h=n.registerMutationListener(Qe,p=>{if(!i&&l()){c();return}i&&(s&&!p.has(s.getKey())?f():u())}),g=mt(n.registerUpdateListener(({editorState:p})=>{p.read(()=>{if(!i)return;const m=M();if(!N(m)){u();return}const b=m.anchor,_=b.getNode();if(!s||_.getKey()!==s.getKey()){u();return}const C=s.getTextContent().indexOf(r,o);if(C===-1||b.offset<=C){u();return}})}),n.registerCommand(hr,p=>i?(p.preventDefault(),!0):!1,q),n.registerCommand(hn,p=>i?(p.preventDefault(),!0):!1,q),n.registerCommand(Pn,p=>i?(p?.preventDefault(),!0):!1,q),n.registerCommand(di,p=>i?(p?.preventDefault(),u(),!0):!1,q));return()=>{u(),h(),g()}}function Mv(n,e,t){t(),e.handler(n),n.focus()}const Iv=U("TOGGLE_SLASH_COMMAND_PALETTE"),$s=U("INSERT_HORIZONTAL_RULE_COMMAND"),$v=U("INSERT_IMAGE_COMMAND");function jl(n){return n.registerCommand($s,()=>{const e=M();if(!N(e))return!1;if(e.focus.getNode()!==null){const r=Os();e.insertNodes([r]);const i=H();r.insertAfter(i),i.selectStart()}return!0},q)}const b_={dependencies:[Fr],export:n=>qp(n)?"---":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(n,e,t,r)=>{const i=Os();if(r)n.replace(i);else{n.replace(i);const s=H();i.insertAfter(s),s.selectStart()}},type:"element"},Ju=[...Eu,b_];async function wt(n){let e="";return n.getEditorState().read(()=>{e=US(Ju)}),e}async function Hn(n,e){n.update(()=>{BS(e,Ju)})}async function x_(){return Ju}const Gu=Object.freeze(Object.defineProperty({__proto__:null,exportToMarkdown:wt,getMarkdownTransformers:x_,importFromMarkdown:Hn},Symbol.toStringTag,{value:"Module"}));async function vt(n){let e="";return n.getEditorState().read(()=>{e=gp(n)}),e}async function Jn(n,e){n.update(()=>{const r=new DOMParser().parseFromString(e,"text/html"),i=hp(n,r);de().clear(),il(i)})}const Vu=Object.freeze(Object.defineProperty({__proto__:null,exportToHtml:vt,importFromHtml:Jn},Symbol.toStringTag,{value:"Module"}));async function Fv(n,e,t){let r,i,s;switch(e){case"markdown":r=await wt(n),i="text/markdown",s="md";break;case"html":r=await vt(n),i="text/html",s="html";break;case"json":r=JSON.stringify(n.getEditorState().toJSON(),null,2),i="application/json",s="json";break}const o=new Blob([r],{type:i}),l=URL.createObjectURL(o),a=document.createElement("a");a.href=l,a.download=t??`document.${s}`,a.click(),URL.revokeObjectURL(l)}async function Lv(n,e,t){const r=await new Promise((s,o)=>{const l=new FileReader;l.onload=()=>s(l.result),l.onerror=()=>o(l.error),l.readAsText(e)});switch(t??Rv(e.name)){case"markdown":{const{importFromMarkdown:s}=await Promise.resolve().then(()=>Gu);await s(n,r);break}case"html":{const{importFromHtml:s}=await Promise.resolve().then(()=>Vu);await s(n,r);break}case"json":{const s=n.parseEditorState(r);n.setEditorState(s);break}}}function Rv(n){return n.endsWith(".md")||n.endsWith(".markdown")?"markdown":n.endsWith(".html")||n.endsWith(".htm")?"html":"json"}async function Hl(n,e){return typeof Ef=="function"?Ef(n):()=>{}}async function Dv(n,e=3,t=3){n.dispatchCommand(As,{rows:String(e),columns:String(t),includeHeaders:!0})}async function Pv(n,e){return typeof Ro=="function"?Ro(n):()=>{}}async function zv(n,e){return typeof Ro=="function"?Ro(n):()=>{}}const Bv=/#[\w\u0590-\u05ff]+/;function Uv(n){return new Cl(n)}async function Kv(n,e){const t=[],r=Vx(n,i=>{const s=Bv.exec(i);return s?{start:s.index,end:s.index+s[0].length}:null},Cl,Uv);if(Array.isArray(r)?t.push(...r):typeof r=="function"&&t.push(r),e?.onHashtagClick){const i=n.registerCommand(Sr,s=>{const o=s.target;if(o.classList.contains("bc-lexical-hashtag")){const l=o.textContent;if(l)return e.onHashtagClick(l.replace("#","")),!0}return!1},q);t.push(i)}return()=>{t.forEach(i=>i())}}const Wv=/((https?:\/\/(www\.)?|www\.)[^\s<>]+)/g,jv=/([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/g,Hv=[{pattern:Wv,urlTransformer:n=>n.startsWith("http")?n:`https://${n}`},{pattern:jv,urlTransformer:n=>`mailto:${n}`}];async function Jv(n,e){const t=e?.matchers??Hv;return n.registerMutationListener(Qe,r=>{n.update(()=>{for(const[i,s]of r){if(s!=="created"&&s!=="updated")continue;const o=Q(i);if(!o||!L(o))continue;const l=o.getTextContent();for(const a of t){const c=new RegExp(a.pattern.source,a.pattern.flags);let u;for(;(u=c.exec(l))!==null;)a.urlTransformer(u[0])}}})})}async function Gv(n,e){const t=[];return e?.onMarkClick&&t.push(n.registerCommand(Sr,r=>{const i=r.target;if(i.classList.contains("bc-lexical-mark")){const s=i.dataset.markId;if(s)return e.onMarkClick(s,{id:s,type:i.dataset.markType||"annotation",data:{}}),!0}return!1},q)),()=>t.forEach(r=>r())}async function Vv(n,e,t){n.update(()=>{const r=M();N(r)&&Zx(r,r.isBackward(),e)})}async function Yv(n,e){n.update(()=>{const r=de().getAllTextNodes().filter(i=>{const s=i.getParent();return ls(s)?Xx(i,0)?.includes(e)??!1:!1});for(const i of r){const s=i.getParent();ls(s)&&qx(s)}})}async function qv(n,e){const{maxLength:t,onOverflow:r}=e;return n.registerUpdateListener(({editorState:i})=>{i.read(()=>{const l=de().getTextContent().length,a=l>t;r&&r(a,l)})})}async function Jl(n){return typeof tf=="function"?tf(n):()=>{}}async function Gl(n,e){const t=e.docMap??new Map,r=e.id??"lexical",i=e.doc.getText(r),s=xv(n,e.provider,i,e.doc,t),o=n.registerUpdateListener(()=>{});return()=>{o(),s&&typeof s.destroy=="function"&&s.destroy()}}function Zv(n){let e={hasSelection:!1,selectedText:"",anchorOffset:0,focusOffset:0};return n.getEditorState().read(()=>{const t=M();N(t)&&(e={hasSelection:!t.isCollapsed(),selectedText:t.getTextContent(),anchorOffset:t.anchor.offset,focusOffset:t.focus.offset})}),e}function Yu(n){let e="";return n.getEditorState().read(()=>{e=de().getTextContent()}),e}function Xv(n){return Yu(n).length}function Qv(n){const e=Yu(n).trim();return e?e.split(/\s+/).length:0}function e0(n,e){n.update(()=>{const t=M();N(t)&&t.insertText(e)}),n.focus()}async function t0(){return HS}function ms(n,e,t){const r=new Map;if(n)for(const i of n.split(";")){const s=i.trim();if(!s)continue;const o=s.indexOf(":");if(o===-1)continue;const l=s.slice(0,o).trim(),a=s.slice(o+1).trim();r.set(l,a)}return t?r.set(e,t):r.delete(e),r.size===0?"":Array.from(r.entries()).map(([i,s])=>`${i}: ${s}`).join("; ")}function Gn(n,e){if(!n)return"";const t=new RegExp(`(?:^|;)\\s*${e.replace(/-/g,"\\-")}:\\s*([^;]+)`),r=n.match(t);return r?r[1].trim():""}function n0(n,e){const t=n.getElementByKey(e);t&&n.getEditorState().read(()=>{const r=Q(e);if(!O(r)||_e(r))return;const i=r.getStyle(),s=Gn(i,"background-color");t.style.backgroundColor=s||"";const o=Gn(i,"line-height");t.style.lineHeight=o||""})}function qu(n){const e=n.registerUpdateListener(({dirtyElements:t})=>{if(t.size!==0)for(const[r]of t)n0(n,r)});return n.getEditorState().read(()=>{const t=de();for(const r of t.getChildren())if(O(r)){const i=r.getStyle();if(i){const s=n.getElementByKey(r.getKey());if(s){const o=Gn(i,"background-color");o&&(s.style.backgroundColor=o);const l=Gn(i,"line-height");l&&(s.style.lineHeight=l)}}}}),e}function Ma(n,e){const t=e.exportDOM(n);if(t.element&&ne(t.element)&&O(e)){const r=e.getStyle(),i=Gn(r,"background-color");i&&(t.element.style.backgroundColor=i);const s=Gn(r,"line-height");s&&(t.element.style.lineHeight=s)}return t}function Vl(){const n=new Map;return n.set(Vn,Ma),n.set(Ts,Ma),n.set(ks,Ma),n}function r0(){const n=e=>()=>({conversion:t=>{const r=e(t);if(r&&O(r)){t.style?.textAlign&&r.setFormat(t.style.textAlign);let i="";t.style?.backgroundColor&&(i=ms(i,"background-color",t.style.backgroundColor)),t.style?.lineHeight&&(i=ms(i,"line-height",t.style.lineHeight)),i&&r.setStyle(i)}return{node:r}},priority:1});return{p:n(()=>H()),h1:n(()=>Ae("h1")),h2:n(()=>Ae("h2")),h3:n(()=>Ae("h3")),h4:n(()=>Ae("h4")),h5:n(()=>Ae("h5")),h6:n(()=>Ae("h6"))}}const S_=["color","font-size","font-family","background-color","line-height"],i0=new Set(["font-weight","font-style","text-decoration","text-decoration-line","vertical-align"]),s0={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},o0=["span","b","em","i","strong","u","s","sub","sup","code","mark"];function l0(n,e,t){if(!L(e))return;const r=n.fontWeight,i=n.textDecoration.split(" ");(r==="700"||r==="bold")&&!e.hasFormat("bold")&&e.toggleFormat("bold"),n.fontStyle==="italic"&&!e.hasFormat("italic")&&e.toggleFormat("italic"),i.includes("line-through")&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),i.includes("underline")&&!e.hasFormat("underline")&&e.toggleFormat("underline"),n.verticalAlign==="sub"&&!e.hasFormat("subscript")&&e.toggleFormat("subscript"),n.verticalAlign==="super"&&!e.hasFormat("superscript")&&e.toggleFormat("superscript"),t&&!e.hasFormat(t)&&e.toggleFormat(t)}function C_(n=S_){const e={};for(const t of o0)e[t]=r=>{const i=r.style,s=s0[t],o=t==="b"?i.fontWeight!=="normal"?"bold":void 0:s;return{conversion:()=>({node:null,forChild:l=>{if(!L(l))return l;l0(i,l,o);let a=l.getStyle();for(const c of n){if(i0.has(c))continue;const u=i.getPropertyValue(c);u&&(a=ms(a,c,u))}return a&&l.setStyle(a),l}}),priority:1}};return e}function Fs(n){return{...r0(),...C_(n)}}async function Ls(n={}){const{nodes:e=[],plugins:t=[],onError:r}=n,s=(await y_()).createEditor({namespace:"BeatUIHeadless",nodes:e,onError:o=>{r?r(o,s):console.error("[BeatUI Headless]",o)},editable:!1,html:{export:Vl(),import:Fs()}});if(t.length>0)for(const o of t)o.register(s);return s}async function a0(n){const e=await Ls(),{importFromMarkdown:t}=await Promise.resolve().then(()=>Gu);return await t(e,n),e.getEditorState().toJSON()}async function c0(n){const e=await Ls(),{exportToMarkdown:t}=await Promise.resolve().then(()=>Gu),r=e.parseEditorState(JSON.stringify(n));return e.setEditorState(r),await t(e)}async function u0(n){const e=await Ls(),{importFromHtml:t}=await Promise.resolve().then(()=>Vu);return await t(e,n),e.getEditorState().toJSON()}async function d0(n){const e=await Ls(),{exportToHtml:t}=await Promise.resolve().then(()=>Vu),r=e.parseEditorState(JSON.stringify(n));return e.setEditorState(r),await t(e)}const w_=n=>{const{value:e,format:t,plugins:r,readOnly:i,placeholder:s,class:o,namespace:l="BeatUILexical",heightMode:a="auto",autoFocus:c=!1,onError:u,onInput:d,onChange:f,onBlur:h,onReady:g}=n;return v.Use(kc.Theme,({appearance:p})=>v.html.div(v.Task(()=>Promise.resolve().then(()=>require("../styles-url-CkPTI32j.cjs")),({default:m})=>Ec.LinkPortal({id:"beatui-lexical-css",href:m})),v.attr.class("bc-lexical-editor-container"),a==="fixed"?v.attr.class("bc-lexical-editor-container--fixed"):null,v.attr.class(o),v.html.div(v.attr.class("bc-lexical-editor"),v.attr.class(`bc-lexical-editor--${a}`),v.attr.contenteditable(i!=null?v.Value.map(i,m=>!m):!0),i!=null?v.attr.class(v.Value.map(i,m=>m?"bc-lexical-editor--readonly":"")):null,v.WithElement(m=>{let b=null;const _=[];return(async()=>{try{const C=r??vl("bare"),S=wl(C),w=v.Value.get(t??"markdown"),x=pi({namespace:l,nodes:S,theme:{heading:{h1:"bc-lexical-h1",h2:"bc-lexical-h2",h3:"bc-lexical-h3",h4:"bc-lexical-h4",h5:"bc-lexical-h5",h6:"bc-lexical-h6"},text:{bold:"bc-lexical-bold",italic:"bc-lexical-italic",underline:"bc-lexical-underline",strikethrough:"bc-lexical-strikethrough",code:"bc-lexical-code"},list:{ul:"bc-lexical-ul",ol:"bc-lexical-ol",listitem:"bc-lexical-li",listitemChecked:"bc-lexical-li-checked",listitemUnchecked:"bc-lexical-li-unchecked"},link:"bc-lexical-link",quote:"bc-lexical-blockquote",code:"bc-lexical-code-block",codeHighlight:{},hashtag:"bc-lexical-hashtag",table:"bc-lexical-table",tableCell:"bc-lexical-table-cell",tableCellHeader:"bc-lexical-table-cell-header",tableRow:"bc-lexical-table-row",mark:"bc-lexical-mark",paragraph:"bc-lexical-paragraph"},onError:I=>{u?u(I,x):console.error("[BeatUI Lexical]",I)},editable:i?!v.Value.get(i):!0,html:{export:Vl(),import:Fs()}});b=x,x.setRootElement(m);const T=[];if(C.richText?T.push(Pl(x)):C.plainText&&T.push(zl(x)),C.history){const I=typeof C.history=="object"?C.history:void 0;T.push(Bl(x,I))}if(C.clipboard&&T.push(Ul(x)),C.list&&T.push(Kl(x)),C.link&&T.push(Wl(x)),C.yjs&&T.push(Gl(x,C.yjs)),C.dragon&&T.push(Jl(x)),C.table&&T.push(Hl(x)),(await Promise.all(T)).forEach(I=>{I&&_.push(I)}),_.push(jl(x)),_.push(qu(x)),e!=null){const I=v.Value.get(e);if(I!=null&&(I!==""||w==="json"&&typeof I=="object")){if(w==="markdown"&&typeof I=="string")await Hn(x,I);else if(w==="html"&&typeof I=="string")await Jn(x,I);else if(w==="json"&&typeof I=="object")try{const k=JSON.stringify(I),D=x.parseEditorState(k);x.setEditorState(D)}catch(k){console.error("[BeatUI] Failed to parse JSON editor state:",k),u&&u(k instanceof Error?k:new Error(String(k)),x)}}}if(_.push(x.registerUpdateListener(({editorState:I,dirtyElements:$,dirtyLeaves:k})=>{$.size===0&&k.size===0||d&&I.read(async()=>{if(w==="markdown"){const D=await wt(x);d(D,x)}else if(w==="html"){const D=await vt(x);d(D,x)}else w==="json"&&d(I.toJSON(),x)})})),e!=null&&_.push(v.Value.on(e,async I=>{if(I!=null){if(w==="markdown"&&typeof I=="string"){const $=await wt(x);I!==$&&await Hn(x,I)}else if(w==="html"&&typeof I=="string"){const $=await vt(x);I!==$&&await Jn(x,I)}else if(w==="json"&&typeof I=="object"){const $=JSON.stringify(x.getEditorState().toJSON()),k=JSON.stringify(I);if($!==k){const D=x.parseEditorState(k);x.setEditorState(D)}}}})),i!=null&&_.push(v.Value.on(i,I=>{x.setEditable(!I)})),_.push(x.registerCommand(hi,()=>(h&&h(x),f&&x.getEditorState().read(async()=>{if(w==="markdown"){const I=await wt(x);f(I,x)}else if(w==="html"){const I=await vt(x);f(I,x)}else w==="json"&&f(x.getEditorState().toJSON(),x)}),!1),q)),_.push(p.on(I=>{const $=x.getRootElement();$&&($.dataset.theme=I)})),c)x.focus();else{const I=x.getRootElement();I&&I===document.activeElement&&I.blur()}g&&g(x)}catch(C){console.error("[BeatUI] Failed to initialize Lexical editor:",C);const S=m;S.textContent="Failed to load Lexical editor."}})(),v.OnDispose(()=>{try{_.forEach(C=>C())}catch{}try{b?.setRootElement(null)}catch{}})}))))};function v_(n,e,t){const r=(h,g)=>e.map(()=>{const p=n.value;return p?p.getEditorState().read(()=>{const m=M();return N(m)?h(m):g}):g}),i=h=>{const g=h.anchor.getNode();return g.getKey()==="root"?g:g.getTopLevelElementOrThrow()};return{withSelection:r,getAnchorElement:i,textFormatActive:h=>r(g=>g.hasFormat(h),!1),blockTypeActive:h=>r(g=>i(g).getType()===h,!1),listTypeActive:h=>r(g=>{const p=i(g).getParent();return Y(p)&&p.getListType()===h},!1),headingActive:h=>e.map(()=>{const g=n.value;return g?g.getEditorState().read(()=>{const p=M();if(N(p)){const m=i(p);if(m.getType()==="heading")return g.getElementByKey(m.getKey())?.tagName===`H${h}`}return!1}):!1}),linkActive:()=>r(h=>{const g=h.anchor.getNode();return g.getParent()?.getType()==="link"||g.getType()==="link"},!1),dispatch:(h,g)=>()=>{const p=n.value;p&&(p.dispatchCommand(h,g),p.focus())},toggleBlock:(h,g)=>()=>{const p=n.value;p&&(p.update(()=>{const m=M();if(N(m)){const b=i(m);rt(m,()=>b.getType()===h?H():g())}}),p.focus())},toggleLink:()=>{const h=n.value;h&&(h.getEditorState().read(()=>{const g=M();if(N(g)){const p=g.anchor.getNode();if(p.getParent()?.getType()==="link"||p.getType()==="link")h.dispatchCommand(cc,null);else{const _=prompt(t?.enterUrlMessage?.()??"Enter URL:");_&&h.dispatchCommand(cc,_)}}}),h.focus())}}}function E_(n,e){return t=>r=>Ia.EditorToolbarButton({...r,display:t,disabled:n,size:e})}const f0={font:["font-family","font-size","line-height"],color:["font-color","highlight-color","background-color"],"text-formatting":["bold","italic","underline","strikethrough","code"],"clear-formatting":["clear-formatting"],headings:["paragraph","heading-1","heading-2","heading-3","heading-4","heading-5","heading-6"],lists:["bullet-list","ordered-list","check-list"],indent:["indent","outdent"],blocks:["blockquote","code-block","horizontal-rule"],tables:["insert-table"],links:["link"],history:["undo","redo"],clipboard:["cut","copy","paste"]},h0=["font","color","text-formatting","clear-formatting","headings","lists","indent","blocks","tables","links","history","clipboard"];function g0(){return h0.map(n=>({group:n}))}function p0(n){if(n.layout)return n.layout;const{visibleGroups:e,hiddenGroups:t,customGroups:r}=n;let i=g0();if((e||t)&&(i=i.filter(s=>{if("separator"in s||"customGroup"in s)return!0;const o=s.group;return!(t?.includes(o)||e&&!e.includes(o))})),r&&r.length>0)for(const s of r)i.push({customGroup:s.id});return i}const m0=[{value:"Arial",label:"Arial"},{value:"Courier New",label:"Courier New"},{value:"Georgia",label:"Georgia"},{value:"Times New Roman",label:"Times New Roman"},{value:"Trebuchet MS",label:"Trebuchet MS"},{value:"Verdana",label:"Verdana"}],_0=[{value:"10px",label:"10"},{value:"12px",label:"12"},{value:"14px",label:"14"},{value:"16px",label:"16"},{value:"18px",label:"18"},{value:"20px",label:"20"},{value:"24px",label:"24"},{value:"30px",label:"30"},{value:"36px",label:"36"}],y0=[{value:"1",label:"1"},{value:"1.15",label:"1.15"},{value:"1.5",label:"1.5"},{value:"2",label:"2"},{value:"2.5",label:"2.5"},{value:"3",label:"3"}];function k_({editor:n,stateUpdate:e,toolbar:t={},readOnly:r=v.signal(!1),size:i="sm"}){const{maxHeadingLevel:s=3}=t,o=p0(t);return v.Use(Ve.BeatUII18n,l=>v.Ensure(n,a=>{const c=a,u=l.$.lexical,{getAnchorElement:d,textFormatActive:f,blockTypeActive:h,listTypeActive:g,headingActive:p,linkActive:m,dispatch:b,toggleBlock:_,toggleLink:y}=v_(c,e,{enterUrlMessage:()=>l.value.lexical.enterUrl}),S=E_(r,i)(v.signal(!0)),w=()=>{const A=c.value;A&&(A.update(()=>{const P=M();N(P)&&rt(P,()=>H())}),A.focus())},x=A=>{const P=c.value;P&&(P.update(()=>{const X=M();if(N(X)){const Te=d(X),En=`h${A}`,kn=P.getElementByKey(Te.getKey());Te.getType()==="heading"&&kn?.tagName===`H${A}`?rt(X,()=>H()):rt(X,()=>Ae(En))}}),P.focus())},T=()=>{const A=c.value;if(!A)return;const P=A.getRootElement();P&&(P.focus(),document.execCommand("copy"))},E=()=>{const A=c.value;if(!A)return;const P=A.getRootElement();P&&(P.focus(),document.execCommand("cut"))},I=()=>{const A=c.value;A&&navigator.clipboard.readText().then(P=>{A.update(()=>{const X=M();N(X)&&X.insertText(P)}),A.focus()}).catch(()=>{})},$=()=>{const A=c.value;A&&(A.update(()=>{const P=M();if(N(P))for(const X of P.getNodes())L(X)&&(X.setFormat(0),X.setStyle(""))}),A.focus())},k=()=>{const A=c.value;A&&(A.dispatchCommand(As,{rows:"3",columns:"3",includeHeaders:!0}),A.focus())},D={value:"",label:l.value.lexical.defaultOption},K=[D,...t.fontFamilies??m0],F=[D,...t.fontSizes??_0],W=[D,...t.lineHeights??y0],G=e.map(()=>{const A=c.value;return A?A.getEditorState().read(()=>{const P=M();return N(P)?Ks(P,"font-family",""):""}):""}),J=e.map(()=>{const A=c.value;return A?A.getEditorState().read(()=>{const P=M();return N(P)?Ks(P,"font-size",""):""}):""}),oe=A=>{const P=c.value;P&&(P.update(()=>{const X=M();N(X)&&Us(X,{"font-family":A||null})}),P.focus())},He=A=>{const P=c.value;P&&(P.update(()=>{const X=M();N(X)&&Us(X,{"font-size":A||null})}),P.focus())},Tt=e.map(()=>{const A=c.value;return A?A.getEditorState().read(()=>{const P=M();return N(P)&&Ks(P,"color","")||"#000000"}):"#000000"}),j=e.map(()=>{const A=c.value;return A?A.getEditorState().read(()=>{const P=M();return N(P)&&Ks(P,"background-color","")||"#ffffff"}):"#ffffff"}),Se=e.map(()=>{const A=c.value;return A?A.getEditorState().read(()=>{const P=M();if(N(P)){const Te=d(P).getStyle();return Gn(Te,"background-color")||"#ffffff"}return"#ffffff"}):"#ffffff"}),fe=e.map(()=>{const A=c.value;return A?A.getEditorState().read(()=>{const P=M();if(N(P)){const Te=d(P).getStyle();return Gn(Te,"line-height")||""}return""}):""}),et=A=>{const P=c.value;P&&(P.update(()=>{const X=M();N(X)&&Us(X,{color:A})}),P.focus())},Ee=A=>{const P=c.value;P&&(P.update(()=>{const X=M();N(X)&&Us(X,{"background-color":A})}),P.focus())},Je=A=>{const P=c.value;P&&(P.update(()=>{const X=M();if(N(X)){const Te=d(X),En=Te.getStyle(),kn=ms(En,"background-color",A);Te.setStyle(kn)}}),P.focus())},tt=A=>{const P=c.value;P&&(P.update(()=>{const X=M();if(N(X)){const Te=d(X),En=Te.getStyle(),kn=ms(En,"line-height",A);Te.setStyle(kn)}}),P.focus())},V=new Map;V.set("bold",()=>S({active:f("bold"),onClick:b(we,"bold"),label:u.map(A=>A.bold),icon:"mdi:format-bold"})),V.set("italic",()=>S({active:f("italic"),onClick:b(we,"italic"),label:u.map(A=>A.italic),icon:"mdi:format-italic"})),V.set("underline",()=>S({active:f("underline"),onClick:b(we,"underline"),label:u.map(A=>A.underline),icon:"mdi:format-underline"})),V.set("strikethrough",()=>S({active:f("strikethrough"),onClick:b(we,"strikethrough"),label:u.map(A=>A.strikethrough),icon:"mdi:format-strikethrough"})),V.set("code",()=>S({active:f("code"),onClick:b(we,"code"),label:u.map(A=>A.code),icon:"mdi:code-tags"})),V.set("clear-formatting",()=>S({active:v.signal(!1),onClick:$,label:u.map(A=>A.clearFormatting),icon:"mdi:format-clear"})),V.set("paragraph",()=>S({active:h("paragraph"),onClick:w,label:u.map(A=>A.normal),icon:"mdi:format-paragraph"}));for(let A=1;A<=s;A++)V.set(`heading-${A}`,()=>S({active:p(A),onClick:()=>x(A),label:u.map(P=>P.heading(A)),icon:`mdi:format-header-${A}`}));V.set("bullet-list",()=>S({active:g("bullet"),onClick:b(xi,void 0),label:u.map(A=>A.bulletList),icon:"mdi:format-list-bulleted"})),V.set("ordered-list",()=>S({active:g("number"),onClick:b(Si,void 0),label:u.map(A=>A.orderedList),icon:"mdi:format-list-numbered"})),V.set("check-list",()=>S({active:g("check"),onClick:b(xl,void 0),label:u.map(A=>A.checkList),icon:"mdi:format-list-checks"})),V.set("indent",()=>S({active:v.signal(!1),onClick:b(Wt,void 0),label:u.map(A=>A.indent),icon:"mdi:format-indent-increase"})),V.set("outdent",()=>S({active:v.signal(!1),onClick:b(ln,void 0),label:u.map(A=>A.outdent),icon:"mdi:format-indent-decrease"})),V.set("blockquote",()=>S({active:h("quote"),onClick:_("quote",bi),label:u.map(A=>A.blockquote),icon:"mdi:format-quote-close"})),V.set("code-block",()=>S({active:h("code"),onClick:_("code",St),label:u.map(A=>A.codeBlock),icon:"mdi:code-braces"})),V.set("horizontal-rule",()=>S({active:v.signal(!1),onClick:b($s,void 0),label:u.map(A=>A.horizontalRule),icon:"mdi:minus"})),V.set("insert-table",()=>S({active:v.signal(!1),onClick:k,label:u.map(A=>A.insertTable),icon:"mdi:table-plus"})),V.set("link",()=>S({active:m(),onClick:y,label:u.map(A=>A.link),icon:"mdi:link"})),V.set("undo",()=>S({active:v.signal(!1),onClick:b(ci,void 0),label:u.map(A=>A.undo),icon:"mdi:undo"})),V.set("redo",()=>S({active:v.signal(!1),onClick:b(ui,void 0),label:u.map(A=>A.redo),icon:"mdi:redo"})),V.set("cut",()=>S({active:v.signal(!1),onClick:E,label:u.map(A=>A.cut),icon:"mdi:content-cut"})),V.set("copy",()=>S({active:v.signal(!1),onClick:T,label:u.map(A=>A.copy),icon:"mdi:content-copy"})),V.set("paste",()=>S({active:v.signal(!1),onClick:I,label:u.map(A=>A.paste),icon:"mdi:content-paste"})),V.set("font-family",()=>v.html.select(v.attr.class("bc-lexical-toolbar-select"),v.attr.title(u.map(A=>A.fontFamily)),v.attr.disabled(r),v.on.change(A=>oe(A.target.value)),...K.map(A=>v.html.option(v.attr.value(A.value),v.attr.selected(G.map(P=>P===A.value)),A.label)))),V.set("font-size",()=>v.html.select(v.attr.class("bc-lexical-toolbar-select"),v.attr.title(u.map(A=>A.fontSize)),v.attr.disabled(r),v.on.change(A=>He(A.target.value)),...F.map(A=>v.html.option(v.attr.value(A.value),v.attr.selected(J.map(P=>P===A.value)),A.label)))),V.set("line-height",()=>v.html.select(v.attr.class("bc-lexical-toolbar-select"),v.attr.title(u.map(A=>A.lineHeight)),v.attr.disabled(r),v.on.change(A=>tt(A.target.value)),...W.map(A=>v.html.option(v.attr.value(A.value),v.attr.selected(fe.map(P=>P===A.value)),A.label)))),V.set("font-color",()=>v.html.label(v.attr.class("bc-lexical-toolbar-color"),v.attr.title(u.map(A=>A.fontColor)),v.html.input(v.attr.type("color"),v.attr.value(Tt),v.attr.disabled(r),v.on.input(A=>et(A.target.value))),v.html.span(v.attr.class("bc-lexical-toolbar-color-icon"),"A"))),V.set("highlight-color",()=>v.html.label(v.attr.class("bc-lexical-toolbar-color"),v.attr.title(u.map(A=>A.highlightColor)),v.html.input(v.attr.type("color"),v.attr.value(j),v.attr.disabled(r),v.on.input(A=>Ee(A.target.value))),v.html.span(v.attr.class("bc-lexical-toolbar-color-icon bc-lexical-toolbar-color-icon--highlight"),"A"))),V.set("background-color",()=>v.html.label(v.attr.class("bc-lexical-toolbar-color"),v.attr.title(u.map(A=>A.backgroundColor)),v.html.input(v.attr.type("color"),v.attr.value(Se),v.attr.disabled(r),v.on.input(A=>Je(A.target.value))),v.html.span(v.attr.class("bc-lexical-toolbar-color-icon bc-lexical-toolbar-color-icon--bg"),"■")));const ke={editor:c,stateUpdate:e,readOnly:r,size:i,button:A=>S({active:A.active??v.signal(!1),onClick:A.onClick,label:A.label,icon:A.icon})},Qt=A=>{if(A.type==="button"){const P=A;V.set(A.id,()=>S({active:P.active?.(ke)??v.signal(!1),onClick:()=>P.onClick(c.value),label:P.label,icon:P.icon}))}else if(A.type==="select"){const P=A,X=P.resetOnSelect!==!1;V.set(A.id,()=>v.html.select(v.attr.class("bc-lexical-toolbar-select"),v.attr.title(P.label),v.attr.disabled(r),v.on.change(Te=>{const En=Te.target,kn=En.value;kn!==""&&(P.onSelect(kn,c.value),X&&(En.value=""))}),v.html.option(v.attr.value(""),v.attr.disabled(X),v.attr.selected(!0),P.label),...P.options.map(Te=>v.html.option(v.attr.value(Te.value),Te.label))))}else if(A.type==="custom"){const P=A;V.set(A.id,()=>P.render(ke))}};if(t.customItems)for(const A of t.customItems)Qt(A);if(t.customGroups)for(const A of t.customGroups)for(const P of A.items)Qt(P);return $h.Toolbar(v.attr.class("bc-lexical-toolbar"),...b0(o,V,s,t.customGroups))}))}function b0(n,e,t,r){const i=new Map;if(r)for(const o of r)i.set(o.id,o);const s=[];for(const o of n){if("separator"in o){s.push($h.ToolbarDivider());continue}if("customGroup"in o){const u=i.get(o.customGroup);if(!u)continue;const d=[];for(const h of u.items){const g=e.get(h.id);g&&d.push(g())}if(d.length===0)continue;const f=d.map(()=>v.signal(!0));s.push(Ia.EditorToolbarGroup({display:f},...d));continue}let l=o.items??f0[o.group]??[];o.group==="headings"&&!o.items&&(l=l.filter(u=>u.startsWith("heading-")?parseInt(u.split("-")[1],10)<=t:!0));const a=[];for(const u of l){const d=e.get(u);d&&a.push(d())}if(a.length===0)continue;const c=a.map(()=>v.signal(!0));s.push(Ia.EditorToolbarGroup({display:c},...a))}return s}function T_({editor:n,stateUpdate:e,readOnly:t=v.signal(!1)}){const r=v.prop(!1),i=v.prop(0),s=v.prop(0);let o=null,l=null;const a=v.prop(!1),c=C=>{let S=null;return C.getEditorState().read(()=>{const w=M();if(!N(w))return;let x=w.anchor.getNode();for(;x;){if(pe(x)){S=x;break}if(x=x.getParent(),!x||x.getKey()==="root")break}}),S},u=(C,S)=>{const w=C.getBoundingClientRect(),x=S.closest(".bc-lexical-editor-container"),T=x?x.getBoundingClientRect():S.getBoundingClientRect();return i.value=w.top-T.top+2,s.value=T.right-w.right+2,!0},d=()=>{const C=n.value;if(!C){r.value=!1;return}const S=c(C);if(!S){a.value||(r.value=!1);return}const w=C.getElementByKey(S.getKey()),x=C.getRootElement();w&&x?(u(w,x),r.value=!0):r.value=!1};e.onChange(d);const f=C=>()=>{const S=n.value;S&&(S.update(C),l?.(),S.focus())},h=f(()=>bf(!1)),g=f(()=>bf(!0)),p=f(()=>xf(!1)),m=f(()=>xf(!0)),b=f(()=>dx()),_=f(()=>fx()),y=f(()=>{const C=M();if(!N(C))return;const S=C.anchor.getNode(),w=ux(S);if(!w)return;Rp(w).remove()});return v.Use(Ve.BeatUII18n,C=>v.Ensure(n,S=>{const w=S,x=C.$.lexical,T=k=>{const D=w.value;if(!D||t.value)return;const K=D.getRootElement();if(!K)return;const W=k.target.closest("td, th");W&&K.contains(W)&&(k.preventDefault(),u(W,K)&&(r.value=!0),requestAnimationFrame(()=>{o?.()}))},E=w.value?.getRootElement(),$=E?.closest(".bc-lexical-editor-container")??E??document;return $.addEventListener("contextmenu",T),[v.OnDispose(()=>{$.removeEventListener("contextmenu",T)}),v.When(r,()=>v.html.div(v.attr.class("bc-table-cell-marker"),v.style.position("absolute"),v.style.top(i.map(k=>`${k}px`)),v.style.right(s.map(k=>`${k}px`)),v.style.zIndex("10"),v.WithElement(k=>{k.addEventListener("mousedown",D=>{D.preventDefault()})}),v.html.button(v.attr.class("bc-table-cell-marker__button"),v.attr.type("button"),v.attr.title(x.map(k=>k.tableActions)),v.attr.disabled(t),Ve.Icon({icon:"lucide:chevron-down",size:"xs"}),v.WithElement(k=>{const D=new MutationObserver(()=>{const K=k.getAttribute("aria-expanded")==="true";a.value=K});return D.observe(k,{attributes:!0,attributeFilter:["aria-expanded"]}),v.OnDispose(()=>D.disconnect())}),Nt.Menu({items:()=>[Nt.MenuItem({key:"insert-row-above",content:x.map(k=>k.insertRowAbove),startContent:Ve.Icon({icon:"lucide:arrow-up",size:"sm"}),onClick:h,disabled:t}),Nt.MenuItem({key:"insert-row-below",content:x.map(k=>k.insertRowBelow),startContent:Ve.Icon({icon:"lucide:arrow-down",size:"sm"}),onClick:g,disabled:t}),Nt.MenuItem({key:"insert-column-left",content:x.map(k=>k.insertColumnLeft),startContent:Ve.Icon({icon:"lucide:arrow-left",size:"sm"}),onClick:p,disabled:t}),Nt.MenuItem({key:"insert-column-right",content:x.map(k=>k.insertColumnRight),startContent:Ve.Icon({icon:"lucide:arrow-right",size:"sm"}),onClick:m,disabled:t}),Nt.MenuSeparator(),Nt.MenuItem({key:"delete-row",content:x.map(k=>k.deleteRow),startContent:Ve.Icon({icon:"lucide:trash-2",size:"sm"}),onClick:b,disabled:t}),Nt.MenuItem({key:"delete-column",content:x.map(k=>k.deleteColumn),startContent:Ve.Icon({icon:"lucide:trash-2",size:"sm"}),onClick:_,disabled:t}),Nt.MenuItem({key:"delete-table",content:x.map(k=>k.deleteTable),startContent:Ve.Icon({icon:"lucide:trash-2",size:"sm"}),onClick:y,disabled:t})],placement:"bottom-end",showOn:(k,D)=>(o=k,l=D,v.on.click(()=>{a.value?D():(k(),a.value=!0)})),showDelay:0,hideDelay:0,mainAxisOffset:4,onClose:()=>{const k=w.value;k&&k.focus()},ariaLabel:x.map(k=>k.tableActions)}))))]}))}const x0=n=>{const{value:e,format:t,plugins:r,readOnly:i,placeholder:s,class:o,namespace:l="BeatUILexical",heightMode:a="fixed",toolbar:c,autoFocus:u=!1,onError:d,onInput:f,onChange:h,onBlur:g,onReady:p}=n,m=v.prop(null),b=v.prop(0),_=C=>typeof C=="object"&&C!==null&&"map"in C&&typeof C.map=="function",y=i!=null?_(i)?i:v.prop(v.Value.get(i)):v.prop(!1);return v.Use(kc.Theme,({appearance:C})=>v.html.div(v.Task(()=>Promise.resolve().then(()=>require("../styles-url-CkPTI32j.cjs")),({default:S})=>Ec.LinkPortal({id:"beatui-lexical-css",href:S})),v.attr.class("bc-lexical-editor-container"),a==="fixed"?v.attr.class("bc-lexical-editor-container--fixed"):null,v.attr.class(o),v.When(y.map(S=>!S),()=>k_({editor:m,stateUpdate:b,toolbar:c,readOnly:y,size:"sm"})),T_({editor:m,stateUpdate:b,readOnly:y}),v.html.div(v.attr.class("bc-lexical-editor"),v.attr.class(`bc-lexical-editor--${a}`),v.attr.contenteditable(i!=null?v.Value.map(i,S=>!S):!0),i!=null?v.attr.class(v.Value.map(i,S=>S?"bc-lexical-editor--readonly":"")):null,v.WithElement(S=>{let w=null;const x=[];return(async()=>{try{const E=r??vl("docked"),I=wl(E),$=v.Value.get(t??"markdown"),k=pi({namespace:l,nodes:I,theme:{heading:{h1:"bc-lexical-h1",h2:"bc-lexical-h2",h3:"bc-lexical-h3",h4:"bc-lexical-h4",h5:"bc-lexical-h5",h6:"bc-lexical-h6"},text:{bold:"bc-lexical-bold",italic:"bc-lexical-italic",underline:"bc-lexical-underline",strikethrough:"bc-lexical-strikethrough",code:"bc-lexical-code"},list:{ul:"bc-lexical-ul",ol:"bc-lexical-ol",listitem:"bc-lexical-li",listitemChecked:"bc-lexical-li-checked",listitemUnchecked:"bc-lexical-li-unchecked"},link:"bc-lexical-link",quote:"bc-lexical-blockquote",code:"bc-lexical-code-block",codeHighlight:{},hashtag:"bc-lexical-hashtag",table:"bc-lexical-table",tableCell:"bc-lexical-table-cell",tableCellHeader:"bc-lexical-table-cell-header",tableRow:"bc-lexical-table-row",mark:"bc-lexical-mark",paragraph:"bc-lexical-paragraph"},onError:F=>{d?d(F,k):console.error("[BeatUI Lexical]",F)},editable:i?!v.Value.get(i):!0,html:{export:Vl(),import:Fs()}});w=k,m.set(k),k.setRootElement(S);const D=[];if(E.richText?D.push(Pl(k)):E.plainText&&D.push(zl(k)),E.history){const F=typeof E.history=="object"?E.history:void 0;D.push(Bl(k,F))}if(E.clipboard&&D.push(Ul(k)),E.list&&D.push(Kl(k)),E.link&&D.push(Wl(k)),E.yjs&&D.push(Gl(k,E.yjs)),E.dragon&&D.push(Jl(k)),E.table&&D.push(Hl(k)),(await Promise.all(D)).forEach(F=>{F&&x.push(F)}),x.push(jl(k)),x.push(qu(k)),x.push(k.registerCommand(li,()=>(b.set(b.value+1),!1),q)),x.push(k.registerUpdateListener(({editorState:F,dirtyElements:W,dirtyLeaves:G})=>{(W.size>0||G.size>0)&&b.set(b.value+1),f&&(W.size>0||G.size>0)&&F.read(async()=>{if($==="markdown"){const J=await wt(k);f(J,k)}else if($==="html"){const J=await vt(k);f(J,k)}else $==="json"&&f(F.toJSON(),k)})})),e!=null){const F=v.Value.get(e);if(F!=null&&(F!==""||$==="json"&&typeof F=="object")){if($==="markdown"&&typeof F=="string")await Hn(k,F);else if($==="html"&&typeof F=="string")await Jn(k,F);else if($==="json"&&typeof F=="object")try{const G=JSON.stringify(F),J=k.parseEditorState(G);k.setEditorState(J)}catch(G){console.error("[BeatUI] Failed to parse JSON editor state:",G),d&&d(G instanceof Error?G:new Error(String(G)),k)}}}if(e!=null&&x.push(v.Value.on(e,async F=>{if(F!=null){if($==="markdown"&&typeof F=="string"){const W=await wt(k);F!==W&&await Hn(k,F)}else if($==="html"&&typeof F=="string"){const W=await vt(k);F!==W&&await Jn(k,F)}else if($==="json"&&typeof F=="object"){const W=JSON.stringify(k.getEditorState().toJSON()),G=JSON.stringify(F);if(W!==G){const J=k.parseEditorState(G);k.setEditorState(J)}}}})),i!=null&&x.push(v.Value.on(i,F=>{k.setEditable(!F)})),x.push(k.registerCommand(hi,()=>(g&&g(k),h&&k.getEditorState().read(async()=>{if($==="markdown"){const F=await wt(k);h(F,k)}else if($==="html"){const F=await vt(k);h(F,k)}else $==="json"&&h(k.getEditorState().toJSON(),k)}),!1),q)),x.push(C.on(F=>{const W=k.getRootElement();W&&(W.dataset.theme=F)})),u)k.focus();else{const F=k.getRootElement();F&&F===document.activeElement&&F.blur()}p&&p(k)}catch(E){console.error("[BeatUI] Failed to initialize Lexical editor:",E);const I=S;I.textContent="Failed to load Lexical editor."}})(),v.OnDispose(()=>{try{x.forEach(E=>E())}catch{}try{w?.setRootElement(null)}catch{}m.set(null)})}))))};function N_({editor:n,stateUpdate:e,groups:t=["text-formatting"],readOnly:r=v.signal(!1),size:i="sm"}){const s=v.prop(!1),o=v.prop(0),l=v.prop(0);return v.Use(Ve.BeatUII18n,a=>v.Ensure(n,c=>{const u=c,d=a.$.lexical,f=x=>t.includes(x),{textFormatActive:h,linkActive:g,dispatch:p,toggleLink:m}=v_(u,e,{enterUrlMessage:()=>a.value.lexical.enterUrl}),_=E_(r,i)(v.signal(!0)),y=()=>{const x=u.value;if(!x){s.value=!1;return}const T=x.getRootElement();if(!T){s.value=!1;return}const E=window.getSelection();if(!E||E.rangeCount===0||E.isCollapsed){s.value=!1;return}const I=E.anchorNode;if(I&&!T.contains(I)){s.value=!1;return}const k=E.getRangeAt(0).getBoundingClientRect();if(k.width===0&&k.height===0){s.value=!1;return}const D=40,K=8;let F=k.top-D-K;const W=k.left+k.width/2;F<0&&(F=k.bottom+K),o.value=F,l.value=W,s.value=!0},C=e.onChange(y),S=()=>{y()};document.addEventListener("selectionchange",S);const w=v.html.div(v.attr.class("bc-floating-toolbar"),v.style.position("fixed"),v.style.top(o.map(x=>`${x}px`)),v.style.left(l.map(x=>`${x}px`)),v.style.transform("translateX(-50%)"),v.WithElement(x=>{const T=I=>{if(I.key==="Escape"&&s.value){s.value=!1;const $=u.value;$&&$.focus()}},E=I=>{if(s.value&&!x.contains(I.target)){const $=u.value;if($){const k=$.getRootElement();if(k&&k.contains(I.target))return}s.value=!1}};return document.addEventListener("keydown",T),document.addEventListener("mousedown",E),v.OnDispose(()=>{C(),document.removeEventListener("keydown",T),document.removeEventListener("mousedown",E),document.removeEventListener("selectionchange",S)})}),...f("text-formatting")?[_({active:h("bold"),onClick:p(we,"bold"),label:d.map(x=>x.bold),icon:"mdi:format-bold"}),_({active:h("italic"),onClick:p(we,"italic"),label:d.map(x=>x.italic),icon:"mdi:format-italic"}),_({active:h("underline"),onClick:p(we,"underline"),label:d.map(x=>x.underline),icon:"mdi:format-underline"}),_({active:h("strikethrough"),onClick:p(we,"strikethrough"),label:d.map(x=>x.strikethrough),icon:"mdi:format-strikethrough"}),_({active:h("code"),onClick:p(we,"code"),label:d.map(x=>x.code),icon:"mdi:code-tags"})]:[],...f("links")?[_({active:g(),onClick:m,label:d.map(x=>x.link),icon:"mdi:link"})]:[],...f("clipboard")?[_({active:v.signal(!1),onClick:()=>{const x=u.value;if(!x)return;const T=x.getRootElement();T&&(T.focus(),document.execCommand("cut"))},label:d.map(x=>x.cut),icon:"mdi:content-cut"}),_({active:v.signal(!1),onClick:()=>{const x=u.value;if(!x)return;const T=x.getRootElement();T&&(T.focus(),document.execCommand("copy"))},label:d.map(x=>x.copy),icon:"mdi:content-copy"}),_({active:v.signal(!1),onClick:()=>{const x=u.value;x&&navigator.clipboard.readText().then(T=>{x.update(()=>{const E=M();N(E)&&E.insertText(T)}),x.focus()}).catch(()=>{})},label:d.map(x=>x.paste),icon:"mdi:content-paste"})]:[]);return v.When(s,()=>w)}))}const S0=[{id:"heading1",label:"Heading 1",description:"Large section heading",icon:"mdi:format-header-1",keywords:["h1","heading","title"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=M();N(e)&&rt(e,()=>Ae("h1"))})}},{id:"heading2",label:"Heading 2",description:"Medium section heading",icon:"mdi:format-header-2",keywords:["h2","heading"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=M();N(e)&&rt(e,()=>Ae("h2"))})}},{id:"heading3",label:"Heading 3",description:"Small section heading",icon:"mdi:format-header-3",keywords:["h3","heading"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=M();N(e)&&rt(e,()=>Ae("h3"))})}},{id:"bullet-list",label:"Bullet List",description:"Create a bulleted list",icon:"mdi:format-list-bulleted",keywords:["ul","unordered","bullets"],category:"Lists",handler:n=>{n.dispatchCommand(xi,void 0)}},{id:"ordered-list",label:"Ordered List",description:"Create a numbered list",icon:"mdi:format-list-numbered",keywords:["ol","numbered","1","2","3"],category:"Lists",handler:n=>{n.dispatchCommand(Si,void 0)}},{id:"quote",label:"Quote",description:"Insert a blockquote",icon:"mdi:format-quote-close",keywords:["blockquote","citation"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=M();N(e)&&rt(e,()=>bi())})}},{id:"code-block",label:"Code Block",description:"Insert a code block",icon:"mdi:code-braces",keywords:["code","pre","programming"],category:"Basic blocks",handler:n=>{n.update(()=>{const e=M();N(e)&&rt(e,()=>St())})}},{id:"divider",label:"Divider",description:"Insert a horizontal rule",icon:"mdi:minus",keywords:["hr","horizontal","line","separator"],category:"Basic blocks",handler:n=>{n.dispatchCommand($s,void 0)}},{id:"table",label:"Table",description:"Insert a table",icon:"mdi:table",keywords:["table","grid","cells","rows","columns"],category:"Advanced",handler:n=>{n.dispatchCommand(As,{rows:"3",columns:"3",includeHeaders:!0})}}];function C0({commands:n,isVisible:e,filterText:t,position:r,onSelect:i,onDismiss:s}){const o=v.prop(0),l=t.map(f=>{const h=f.toLowerCase().trim();return h?n.filter(g=>[g.label.toLowerCase(),g.description?.toLowerCase()||"",...g.keywords?.map(m=>m.toLowerCase())||[]].join(" ").includes(h)):n});l.onChange(()=>{o.value=0});const a=f=>{const h=l.value;if(f>=0&&f<h.length){const g=h[f];i(g)}},c=f=>{if(!e.value)return;const g=l.value.length-1;switch(f.key){case"ArrowDown":f.preventDefault(),o.value=Math.min(o.value+1,g);break;case"ArrowUp":f.preventDefault(),o.value=Math.max(o.value-1,0);break;case"Enter":f.preventDefault(),a(o.value);break;case"Escape":f.preventDefault(),s();break}},u=(f,h)=>{const g=o.map(m=>m===h),p=`slash-cmd-${f.id}`;return v.html.div(v.attr.class("bc-slash-command-palette__item"),v.attr.id(p),v.attr.role("option"),v.aria.selected(g),v.WithElement(m=>{const b=()=>{o.value=h},_=()=>{a(h)};return m.addEventListener("mouseenter",b),m.addEventListener("click",_),v.OnDispose(()=>{m.removeEventListener("mouseenter",b),m.removeEventListener("click",_)})}),typeof f.icon=="string"?v.html.div(v.attr.class("bc-slash-command-palette__icon"),Ve.Icon({icon:f.icon,size:"sm"})):f.icon,v.html.div(v.attr.class("bc-slash-command-palette__content"),v.html.div(v.attr.class("bc-slash-command-palette__label"),f.label),f.description?v.html.div(v.attr.class("bc-slash-command-palette__description"),f.description):void 0),f.category?v.html.div(v.attr.class("bc-slash-command-palette__category"),f.category):void 0)},d=v.Use(Ve.BeatUII18n,f=>v.html.div(v.attr.class("bc-slash-command-palette"),v.attr.role("listbox"),v.aria.label(f.$.lexical.map(h=>h.slashCommands)),v.style.position("absolute"),v.style.top(r.map(h=>`${h.top}px`)),v.style.left(r.map(h=>`${h.left}px`)),v.WithElement(()=>(document.addEventListener("keydown",c),v.OnDispose(()=>{document.removeEventListener("keydown",c)}))),v.When(l.map(h=>h.length===0),()=>v.html.div(v.attr.class("bc-slash-command-palette__empty"),f.$.lexical.map(h=>h.noCommandsFound))),v.ForEach(l,(h,g)=>{const p=h.value;return u(p,g.index)})));return v.When(e,()=>d)}const A_=[{id:"paragraph",label:"Paragraph",icon:"mdi:format-paragraph",handler:n=>{n.update(()=>{const e=M();N(e)&&rt(e,()=>H())})}},{id:"heading1",label:"Heading 1",icon:"mdi:format-header-1",handler:n=>{n.update(()=>{const e=M();N(e)&&rt(e,()=>Ae("h1"))})}},{id:"heading2",label:"Heading 2",icon:"mdi:format-header-2",handler:n=>{n.update(()=>{const e=M();N(e)&&rt(e,()=>Ae("h2"))})}},{id:"heading3",label:"Heading 3",icon:"mdi:format-header-3",handler:n=>{n.update(()=>{const e=M();N(e)&&rt(e,()=>Ae("h3"))})}},{id:"bullet-list",label:"Bullet List",icon:"mdi:format-list-bulleted",handler:n=>{n.dispatchCommand(xi,void 0)}},{id:"ordered-list",label:"Ordered List",icon:"mdi:format-list-numbered",handler:n=>{n.dispatchCommand(Si,void 0)}},{id:"quote",label:"Quote",icon:"mdi:format-quote-close",handler:n=>{n.update(()=>{const e=M();N(e)&&rt(e,()=>bi())})}},{id:"code-block",label:"Code Block",icon:"mdi:code-braces",handler:n=>{n.update(()=>{const e=M();N(e)&&rt(e,()=>St())})}},{id:"divider",label:"Divider",icon:"mdi:minus",handler:n=>{n.dispatchCommand($s,void 0)}},{id:"table",label:"Table",icon:"mdi:table",handler:n=>{n.dispatchCommand(As,{rows:"3",columns:"3",includeHeaders:!0})}}];function O_({editor:n,stateUpdate:e,readOnly:t=v.signal(!1),commands:r=A_}){const i=v.prop(!1),s=v.prop(!1),o=v.prop(0),l=v.prop(0);return v.Use(Ve.BeatUII18n,a=>v.Ensure(n,c=>{const u=c;let d=null,f=!1,h=null,g=null;const p=24,m=4,b=200,_=$=>{if($===d&&i.value)return;d=$;const k=$.getBoundingClientRect();o.value=k.top,l.value=k.left-p-m,i.value=!0},y=()=>{h!=null&&(clearTimeout(h),h=null)},C=()=>{s.value||(y(),h=setTimeout(()=>{h=null,s.value||(i.value=!1,d=null)},b))},S=()=>{const $=u.value;if(!$)return;const k=$.getRootElement();k&&(T(k),$.getEditorState().read(()=>{const D=M();if(N(D))try{const F=D.anchor.getNode().getTopLevelElementOrThrow(),W=$.getElementByKey(F.getKey());W&&_(W)}catch{}}))},w=$=>{if(s.value)return;const k=u.value;if(!k)return;const D=k.getRootElement();if(D)for(const K of Array.from(D.children)){const F=K.getBoundingClientRect();if($.clientY>=F.top&&$.clientY<=F.bottom){y(),_(K);return}}},x=()=>{C()},T=$=>{f||(f=!0,$.addEventListener("mousemove",w),$.addEventListener("mouseleave",x))},E=e.onChange(S);return[v.OnDispose(()=>{E(),y();const $=u.value;if($){const k=$.getRootElement();k&&f&&(k.removeEventListener("mousemove",w),k.removeEventListener("mouseleave",x))}}),v.When(i,()=>v.html.div(v.attr.class("bc-block-handle"),v.style.position("fixed"),v.style.top(o.map($=>`${$}px`)),v.style.left(l.map($=>`${$}px`)),v.on.mouseenter(y),v.on.mouseleave(()=>C()),v.WithElement($=>{$.addEventListener("mousedown",k=>{k.preventDefault()})}),v.html.button(v.attr.class("bc-block-handle__button"),v.attr.type("button"),v.attr.title(a.$.lexical.map($=>$.changeBlockType)),v.attr.disabled(t),Ve.Icon({icon:"mdi:drag-horizontal-variant",size:"sm"}),v.WithElement($=>{const k=new MutationObserver(()=>{const D=$.getAttribute("aria-expanded")==="true";s.value=D});return k.observe($,{attributes:!0,attributeFilter:["aria-expanded"]}),v.OnDispose(()=>k.disconnect())}),Nt.Menu({items:()=>r.map($=>Nt.MenuItem({key:$.id,content:$.label,startContent:Ve.Icon({icon:$.icon,size:"sm"}),onClick:()=>{const k=u.value;k&&($.handler(k),g?.(),k.focus())}})),placement:"bottom-start",showOn:($,k)=>(g=k,v.on.click(()=>{s.value?k():($(),s.value=!0)})),showDelay:0,hideDelay:0,mainAxisOffset:4,onClose:()=>{const $=u.value;$&&$.focus()},ariaLabel:a.value.lexical.blockTypes}))))]}))}const w0=n=>{const{value:e,format:t,plugins:r,readOnly:i,placeholder:s,class:o,namespace:l="BeatUILexical",heightMode:a="auto",floatingToolbarGroups:c,autoFocus:u=!1,onError:d,onInput:f,onChange:h,onBlur:g,onReady:p}=n,m=v.prop(null),b=v.prop(0),_=C=>typeof C=="object"&&C!==null&&"map"in C&&typeof C.map=="function",y=i!=null?_(i)?i:v.prop(v.Value.get(i)):v.prop(!1);return v.Use(kc.Theme,({appearance:C})=>v.html.div(v.Task(()=>Promise.resolve().then(()=>require("../styles-url-CkPTI32j.cjs")),({default:S})=>Ec.LinkPortal({id:"beatui-lexical-css",href:S})),v.attr.class("bc-lexical-editor-container"),a==="fixed"?v.attr.class("bc-lexical-editor-container--fixed"):null,v.attr.class(o),N_({editor:m,stateUpdate:b,groups:c??["text-formatting","links"],readOnly:y}),O_({editor:m,stateUpdate:b,readOnly:y}),T_({editor:m,stateUpdate:b,readOnly:y}),v.html.div(v.attr.class("bc-lexical-editor"),v.attr.class(`bc-lexical-editor--${a}`),v.attr.contenteditable(i!=null?v.Value.map(i,S=>!S):!0),i!=null?v.attr.class(v.Value.map(i,S=>S?"bc-lexical-editor--readonly":"")):null,v.WithElement(S=>{let w=null;const x=[];return(async()=>{try{const E=r??vl("contextual"),I=wl(E),$=v.Value.get(t??"markdown"),k=pi({namespace:l,nodes:I,theme:{heading:{h1:"bc-lexical-h1",h2:"bc-lexical-h2",h3:"bc-lexical-h3",h4:"bc-lexical-h4",h5:"bc-lexical-h5",h6:"bc-lexical-h6"},text:{bold:"bc-lexical-bold",italic:"bc-lexical-italic",underline:"bc-lexical-underline",strikethrough:"bc-lexical-strikethrough",code:"bc-lexical-code"},list:{ul:"bc-lexical-ul",ol:"bc-lexical-ol",listitem:"bc-lexical-li",listitemChecked:"bc-lexical-li-checked",listitemUnchecked:"bc-lexical-li-unchecked"},link:"bc-lexical-link",quote:"bc-lexical-blockquote",code:"bc-lexical-code-block",codeHighlight:{},hashtag:"bc-lexical-hashtag",table:"bc-lexical-table",tableCell:"bc-lexical-table-cell",tableCellHeader:"bc-lexical-table-cell-header",tableRow:"bc-lexical-table-row",mark:"bc-lexical-mark",paragraph:"bc-lexical-paragraph"},onError:F=>{d?d(F,k):console.error("[BeatUI Lexical]",F)},editable:i?!v.Value.get(i):!0,html:{export:Vl(),import:Fs()}});w=k,m.set(k),k.setRootElement(S);const D=[];if(E.richText?D.push(Pl(k)):E.plainText&&D.push(zl(k)),E.history){const F=typeof E.history=="object"?E.history:void 0;D.push(Bl(k,F))}if(E.clipboard&&D.push(Ul(k)),E.list&&D.push(Kl(k)),E.link&&D.push(Wl(k)),E.yjs&&D.push(Gl(k,E.yjs)),E.dragon&&D.push(Jl(k)),E.table&&D.push(Hl(k)),(await Promise.all(D)).forEach(F=>{F&&x.push(F)}),x.push(jl(k)),x.push(qu(k)),x.push(k.registerCommand(li,()=>(b.set(b.value+1),!1),q)),x.push(k.registerUpdateListener(({editorState:F,dirtyElements:W,dirtyLeaves:G})=>{(W.size>0||G.size>0)&&b.set(b.value+1),f&&(W.size>0||G.size>0)&&F.read(async()=>{if($==="markdown"){const J=await wt(k);f(J,k)}else if($==="html"){const J=await vt(k);f(J,k)}else $==="json"&&f(F.toJSON(),k)})})),e!=null){const F=v.Value.get(e);if(F!=null&&(F!==""||$==="json"&&typeof F=="object")){if($==="markdown"&&typeof F=="string")await Hn(k,F);else if($==="html"&&typeof F=="string")await Jn(k,F);else if($==="json"&&typeof F=="object")try{const G=JSON.stringify(F),J=k.parseEditorState(G);k.setEditorState(J)}catch(G){console.error("[BeatUI] Failed to parse JSON editor state:",G),d&&d(G instanceof Error?G:new Error(String(G)),k)}}}if(e!=null&&x.push(v.Value.on(e,async F=>{if(F!=null){if($==="markdown"&&typeof F=="string"){const W=await wt(k);F!==W&&await Hn(k,F)}else if($==="html"&&typeof F=="string"){const W=await vt(k);F!==W&&await Jn(k,F)}else if($==="json"&&typeof F=="object"){const W=JSON.stringify(k.getEditorState().toJSON()),G=JSON.stringify(F);if(W!==G){const J=k.parseEditorState(G);k.setEditorState(J)}}}})),i!=null&&x.push(v.Value.on(i,F=>{k.setEditable(!F)})),x.push(k.registerCommand(hi,()=>(g&&g(k),h&&k.getEditorState().read(async()=>{if($==="markdown"){const F=await wt(k);h(F,k)}else if($==="html"){const F=await vt(k);h(F,k)}else $==="json"&&h(k.getEditorState().toJSON(),k)}),!1),q)),x.push(C.on(F=>{const W=k.getRootElement();W&&(W.dataset.theme=F)})),u)k.focus();else{const F=k.getRootElement();F&&F===document.activeElement&&F.blur()}p&&p(k)}catch(E){console.error("[BeatUI] Failed to initialize Lexical editor:",E);const I=S;I.textContent="Failed to load Lexical editor."}})(),v.OnDispose(()=>{try{x.forEach(E=>E())}catch{}try{w?.setRootElement(null)}catch{}m.set(null)})}))))},v0=n=>{const{value:e,before:t,after:r,onChange:i,onInput:s,onBlur:o,disabled:l,hasError:a,name:c,placeholder:u,id:d,required:f,tabIndex:h,size:g,class:p,namespace:m,format:b,plugins:_,readOnly:y,onError:C,onReady:S,marks:w,autoFocus:x}=n,T=l!=null&&y!=null?v.computedOf(l,y)((E,I)=>(E??!1)||(I??!1)):l??y;return M_.InputContainer({disabled:l,hasError:a,size:g,baseContainer:!0,growInput:!0,focusableSelector:"[contenteditable]",before:t,after:r,input:v.html.div(v.attr.class("bc-lexical-editor-input"),v.attr.name(c),v.attr.id(d),f!=null?v.aria.required(f):null,h!=null?v.attr.tabindex(h):null,a!=null?v.attr.class(v.Value.map(a,E=>E?"bc-lexical-editor-input--error":"")):null,w_({value:e,format:b??"markdown",plugins:_,readOnly:T,placeholder:u,namespace:m,class:p,autoFocus:x,onError:C,onReady:S,onInput:s?(E,I)=>{s(E)}:void 0,onChange:i?(E,I)=>{i(E)}:void 0,onBlur:o?E=>{o()}:void 0}))})};exports.$createHorizontalRuleNode=Os;exports.$isHorizontalRuleNode=qp;exports.BLUR_COMMAND=hi;exports.BareEditor=w_;exports.BlockHandle=O_;exports.CLEAR_EDITOR_COMMAND=Pc;exports.CLICK_COMMAND=Sr;exports.COMMAND_PRIORITY_CRITICAL=Hc;exports.COMMAND_PRIORITY_EDITOR=B;exports.COMMAND_PRIORITY_HIGH=Eg;exports.COMMAND_PRIORITY_LOW=q;exports.COMMAND_PRIORITY_NORMAL=vg;exports.COPY_COMMAND=Cr;exports.CUT_COMMAND=fi;exports.ContextualEditor=w0;exports.DEFAULT_BLOCK_COMMANDS=A_;exports.DEFAULT_INLINE_STYLE_PROPERTIES=S_;exports.DEFAULT_SLASH_COMMANDS=S0;exports.DecoratorNode=Ss;exports.DockedEditor=x0;exports.ElementNode=xe;exports.FOCUS_COMMAND=zc;exports.FORMAT_ELEMENT_COMMAND=Rc;exports.FORMAT_TEXT_COMMAND=we;exports.FloatingToolbar=N_;exports.HR_TRANSFORMER=b_;exports.HorizontalRuleNode=Fr;exports.INDENT_CONTENT_COMMAND=Wt;exports.INSERT_CHECK_LIST_COMMAND=xl;exports.INSERT_HORIZONTAL_RULE_COMMAND=$s;exports.INSERT_IMAGE_COMMAND=$v;exports.INSERT_ORDERED_LIST_COMMAND=Si;exports.INSERT_PARAGRAPH_COMMAND=Dn;exports.INSERT_UNORDERED_LIST_COMMAND=xi;exports.KEY_ENTER_COMMAND=Pn;exports.KEY_ESCAPE_COMMAND=di;exports.KEY_TAB_COMMAND=xs;exports.LexicalEditorInput=v0;exports.LexicalToolbar=k_;exports.OUTDENT_CONTENT_COMMAND=ln;exports.PASTE_COMMAND=ai;exports.REDO_COMMAND=ui;exports.REMOVE_LIST_COMMAND=_u;exports.SELECTION_CHANGE_COMMAND=li;exports.SlashCommandPalette=C0;exports.TOGGLE_SLASH_COMMAND_PALETTE=Iv;exports.TOOLBAR_SEPARATOR=I_;exports.TextNode=Qe;exports.UNDO_COMMAND=ci;exports.applyMark=Vv;exports.buildInlineStyleImportMap=C_;exports.buildStyleImportMap=Fs;exports.createCommand=U;exports.createDefaultPluginConfig=vl;exports.createHeadlessEditor=Ls;exports.executeSlashCommand=Mv;exports.exportEditorToFile=Fv;exports.exportToHtml=vt;exports.exportToMarkdown=wt;exports.getCharacterCount=Xv;exports.getMarkdownTransformers=x_;exports.getNodesForPlugins=wl;exports.getSelectionInfo=Zv;exports.getTextContent=Yu;exports.getWordCount=Qv;exports.htmlToLexicalJson=u0;exports.importFileToEditor=Lv;exports.importFromHtml=Jn;exports.importFromMarkdown=Hn;exports.insertTable=Dv;exports.insertTextAtCursor=e0;exports.lexicalJsonToHtml=d0;exports.lexicalJsonToMarkdown=c0;exports.loadLexicalCore=y_;exports.loadOffsetUtils=t0;exports.markdownToLexicalJson=a0;exports.registerAutoLinkPlugin=Jv;exports.registerClipboardPlugin=Ul;exports.registerCodePlugin=Pv;exports.registerCodeShikiPlugin=zv;exports.registerDragonPlugin=Jl;exports.registerHashtagPlugin=Kv;exports.registerHistoryPlugin=Bl;exports.registerHorizontalRulePlugin=jl;exports.registerLinkPlugin=Wl;exports.registerListPlugin=Kl;exports.registerMarkPlugin=Gv;exports.registerOverflowPlugin=qv;exports.registerPlainTextPlugin=zl;exports.registerRichTextPlugin=Pl;exports.registerSlashCommandsPlugin=Ov;exports.registerTablePlugin=Hl;exports.registerYjsPlugin=Gl;exports.removeMark=Yv;
|