@inkeep/open-knowledge 0.52.0-beta.1 → 0.52.0-beta.2
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/{acp-harness-probe-BLNHcsbH.mjs → acp-harness-probe-8Sj9j5_f.mjs} +2 -2
- package/dist/cli.mjs +53 -53
- package/dist/constants-B_VMjNrS.mjs +2 -0
- package/dist/{git-handle-KAEFG2Xp.mjs → git-handle--xISIJuo.mjs} +2 -2
- package/dist/git-handle-Dt3gdxML.mjs +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +192 -190
- package/dist/{init-BqJCkV4f.mjs → init-DyUOE5zl.mjs} +5 -5
- package/dist/init-gTl1f87x.mjs +1 -0
- package/dist/{launch-json-removal--W9fR9KD.mjs → launch-json-removal-D4uxGOEd.mjs} +2 -2
- package/dist/loader-0WRtkHJU.mjs +1 -0
- package/dist/{loader-RzWdg3ak.mjs → loader-DGh4bdW9.mjs} +2 -2
- package/dist/md-manager-RNjkssEV.mjs +2 -0
- package/dist/{open-browser-CQP79XeJ.mjs → open-browser-CV5L0bD3.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-CdhLvXYY.mjs → preview-BbSnbtj5.mjs} +2 -2
- package/dist/preview-D9IFuChZ.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-inbZ6Imy.js → ActivityModeContent-82sBOezj.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-D79ADgrY.js → AgentDiffPane-CoeEE99v.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-BFNjsn1A.js → AgentThreadClientBinder-DoXKRY3h.js} +1 -1
- package/dist/public/assets/{ChangedOutsideBadge-B70WiFvp.js → ChangedOutsideBadge-D047_w8_.js} +1 -1
- package/dist/public/assets/CodeMirrorPropInput-AfI-A739.js +3 -0
- package/dist/public/assets/DiffView-C-imhjB8.js +3 -0
- package/dist/public/assets/DocumentContext-RfseIiCK.js +38 -0
- package/dist/public/assets/{EditorModeToggle-Dn28eLKD.js → EditorModeToggle-BFLOwOkQ.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-DHSjSooL.js → EnableSyncConfirmDialog-DrKJd8P_.js} +1 -1
- package/dist/public/assets/FeedbackForm-CpyB0Ay7.js +1 -0
- package/dist/public/assets/{GraphPanel-D3eqDrvs.js → GraphPanel-CIsyWZZL.js} +2 -2
- package/dist/public/assets/{ImportSkillDialog-CIwaj3Ws.js → ImportSkillDialog-R8BKwyCS.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-B8H3gshD.js → LintConfigEditor-CMXHDFZF.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-BfpBSbt8.js +2 -0
- package/dist/public/assets/ManagedArtifactProperties-CaU-7RSA.js +1 -0
- package/dist/public/assets/{McpConsentDialogBody-CmWQQsvA.js → McpConsentDialogBody-D6qWh37S.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-CJTLkZwc.js → MermaidDocEditor-DbdolXNy.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-AcYxCdAP.js → ReportBugDialogBody-0zuUulQL.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-DkNcAkEt.js → SchemaConfigEditor-rEKhSqJM.js} +1 -1
- package/dist/public/assets/{SessionsHost-BGHy03KJ.js → SessionsHost-CGV_FZVZ.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-BWvLQrNH.js → SettingsDialogBody-DPjbScQ8.js} +4 -4
- package/dist/public/assets/{ShareBranchSwitchDialog-ClrT-3XL.js → ShareBranchSwitchDialog-BHZw8v-i.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-CGp7LdmP.js → ShareReceiveDialog-CA7GkSOU.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-Cg4-FLXt.js → ShareReceiveMissDialog-BVb9iCe7.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-DAXtbz8B.js → SkillEditBanner-Dc5M38zl.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-CSKIzMpb.js → SkillOriginInline-B-wdZ-wi.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-SVwkGBOq.js → SkillToolbarControls-B1VGCLbB.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-bvIjkbin.js → SlidesToolbarControls-DpEF1_8n.js} +1 -1
- package/dist/public/assets/SourceEditor-BXsOQKW8.js +1 -0
- package/dist/public/assets/{TerminalPanel-CCfioVTh.js → TerminalPanel-D4k0ePYg.js} +3 -3
- package/dist/public/assets/{TerminalWindowApp-CNkz8ED8.js → TerminalWindowApp-C1Ej4Kb1.js} +1 -1
- package/dist/public/assets/{TextDocEditor-Cetftapm.js → TextDocEditor-DxhziylX.js} +1 -1
- package/dist/public/assets/{ThreadView-BKPSGviS.js → ThreadView-DlpPbPgC.js} +4 -4
- package/dist/public/assets/{TimelineDiffPane-Dgh-wIDe.js → TimelineDiffPane-35Fhuse-.js} +1 -1
- package/dist/public/assets/{agent-diff-store-CKnzpnHj.js → agent-diff-store-BTtYfAZI.js} +1 -1
- package/dist/public/assets/auth-state-cache-j2uCE1rv.js +11 -0
- package/dist/public/assets/client-version-UVydSM1_.js +1 -0
- package/dist/public/assets/cm-theme-DZT10ikr.js +1 -0
- package/dist/public/assets/{comment-chips-WeFvqsHB.js → comment-chips-CspvZbMA.js} +1 -1
- package/dist/public/assets/config-provider-DAD08DXO.js +5 -0
- package/dist/public/assets/dist-BRmJz2fY.js +1 -0
- package/dist/public/assets/dist-BVpMlVG3.js +1 -0
- package/dist/public/assets/{dist-DPG-4B8V.js → dist-BgBcg3TP.js} +1 -1
- package/dist/public/assets/{dist-DwFjOxj-.js → dist-BiwzWInZ.js} +1 -1
- package/dist/public/assets/{dist-DoYGOGZp.js → dist-CKFXiBrL.js} +182 -180
- package/dist/public/assets/dist-CkFATl39.js +1 -0
- package/dist/public/assets/{dist-BSAh-TK7.js → dist-DAqA-GDU.js} +1 -1
- package/dist/public/assets/{dist-DU3mip8Z.js → dist-DM6osNK2.js} +1 -1
- package/dist/public/assets/dist-DQyQPRvE.js +1 -0
- package/dist/public/assets/dist-DfLFtHzK.js +23 -0
- package/dist/public/assets/dist-DsH7eETa.js +9 -0
- package/dist/public/assets/dist-dO0W-CVt.js +6 -0
- package/dist/public/assets/dist-ofeGnIBD.js +1 -0
- package/dist/public/assets/dist-z-y_5Bgj.js +2 -0
- package/dist/public/assets/{doc-paths-SFSlIMRQ.js → doc-paths-aGtYCY4p.js} +1 -1
- package/dist/public/assets/documents-events-BNjnUfCu.js +1 -0
- package/dist/public/assets/{file-tree-adapter-oSszPvAJ.js → file-tree-adapter-BnKrzDCF.js} +1 -1
- package/dist/public/assets/{file-tree-utils-BG5IgULP.js → file-tree-utils-CPfKs0_W.js} +1 -1
- package/dist/public/assets/{folder-config-api-7-6Lsx3w.js → folder-config-api-C00aXHgv.js} +1 -1
- package/dist/public/assets/follow-file-ClUkwvTW.js +4 -0
- package/dist/public/assets/globals-tIUZlcbW.css +1 -0
- package/dist/public/assets/i18n-DnAdj3V4.js +1 -0
- package/dist/public/assets/index-DkaSwI0X.js +2095 -0
- package/dist/public/assets/lint-config-client-CwpzRrsJ.js +1 -0
- package/dist/public/assets/{markdownlint-rule-browser-CljNGtQ4.js → markdownlint-rule-browser-DDivenan.js} +1 -1
- package/dist/public/assets/messages-BFSFw083.js +1 -0
- package/dist/public/assets/messages-But-gxxm.js +1 -0
- package/dist/public/assets/messages-C2dy97-C.js +1 -0
- package/dist/public/assets/messages-C6mfKAsF.js +1 -0
- package/dist/public/assets/messages-CT0uUq60.js +1 -0
- package/dist/public/assets/messages-CoCHeX4T.js +1 -0
- package/dist/public/assets/messages-D2Xjng5y.js +1 -0
- package/dist/public/assets/messages-DGIb-W2n.js +1 -0
- package/dist/public/assets/messages-DZjmC-3B.js +1 -0
- package/dist/public/assets/messages-DmRUKkYi.js +1 -0
- package/dist/public/assets/messages-Vp_S0vgN.js +1 -0
- package/dist/public/assets/navigation-targets-BN-b0SwY.js +1 -0
- package/dist/public/assets/{open-managed-artifact-tab-ChY4GdUc.js → open-managed-artifact-tab-Dxiu79gQ.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-BHhLK9ql.js → pending-receive-nav-store-DTGiCG3P.js} +1 -1
- package/dist/public/assets/{prop-types-BuByQU-C.js → prop-types-RgJQCViX.js} +1 -1
- package/dist/public/assets/{receive-store-BJRLpWDq.js → receive-store-C7RBAUmu.js} +1 -1
- package/dist/public/assets/{selection-context-Upvq3X7n.js → selection-context-D_1ahjGj.js} +1 -1
- package/dist/public/assets/{skill-actions-B0GhZcr8.js → skill-actions-BKW-L6YY.js} +2 -2
- package/dist/public/assets/{skill-scope-ByxyMqpD.js → skill-scope-D3fqbCKZ.js} +1 -1
- package/dist/public/assets/{skills-api-CD1FoT1f.js → skills-api-BAB9Nk_K.js} +1 -1
- package/dist/public/assets/{src-DGx6DijB.js → src-Dfy4grTv.js} +2 -2
- package/dist/public/assets/{tag-pill-input-D9TPdQQY.js → tag-pill-input-vgqgNkXB.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-Dn77egCV.js → target-navigation-intent-DEiFgbdU.js} +1 -1
- package/dist/public/assets/{telemetry-impl-Dv6H2_tV.js → telemetry-impl-Bvv5kEhb.js} +1 -1
- package/dist/public/assets/{telemetry-startup-BUcdYLE3.js → telemetry-startup-C8JOSRcr.js} +1 -1
- package/dist/public/assets/{terminal-cli-display-ceeLXdxI.js → terminal-cli-display-Du0YYwUl.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-un6YHfuE.js → terminal-launch-events-C5JkD3Qb.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-DATv4VP7.js → terminal-telemetry-Cj_uo6eX.js} +1 -1
- package/dist/public/assets/{text-viewer-languages-4qbY4VOt.js → text-viewer-languages-oVDGEYYY.js} +2 -2
- package/dist/public/assets/typing-burst-detector-vxYjrFWQ.js +8 -0
- package/dist/public/assets/{uninstall-97GnPmGj.js → uninstall-C6wmbgyN.js} +1 -1
- package/dist/public/assets/{use-activity-panel-DR6Q_srT.js → use-activity-panel-DtCqiYlm.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-Cwl6JTaa.js → use-apply-config-color-theme-DkVlJHc4.js} +1 -1
- package/dist/public/assets/{use-collab-url-B6fAlmsp.js → use-collab-url-CpJYowg_.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-XZ_rkAuD.js → use-live-xterm-theme-DfHZqsch.js} +1 -1
- package/dist/public/assets/{use-open-skill-CwUZqxzo.js → use-open-skill-DdTYxJp4.js} +1 -1
- package/dist/public/assets/{use-popular-skills-BI3UKF6g.js → use-popular-skills-C9TB91tU.js} +1 -1
- package/dist/public/assets/{use-settings-route-D49weK6e.js → use-settings-route-D_8EQ_KO.js} +1 -1
- package/dist/public/assets/{use-skill-origin-CbV3B2nV.js → use-skill-origin-BjB7AiHp.js} +1 -1
- package/dist/public/assets/{use-skills-DWcQk94I.js → use-skills-DMV2hvXx.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-DOk0YJeH.js → use-terminal-enabled-D2pvXg6e.js} +1 -1
- package/dist/public/assets/use-timeline-entry-diff-Do0ZBwge.js +6 -0
- package/dist/public/assets/{use-workspace-DTMCKV7B.js → use-workspace-e-krFmvC.js} +1 -1
- package/dist/public/index.html +63 -63
- package/dist/public/uninstall.html +6 -6
- package/dist/{repair-launch-json-Bpj7gqui.mjs → repair-launch-json-D5bvpzmg.mjs} +2 -2
- package/dist/{repair-mcp-configs-DualdM8z.mjs → repair-mcp-configs-CElx4zud.mjs} +2 -2
- package/dist/{repair-skills-CBiPGgau.mjs → repair-skills-pGap1_gF.mjs} +2 -2
- package/dist/repair-skills-uGkRmBYx.mjs +1 -0
- package/dist/{server-lock-BV0Ktccm.mjs → server-lock-CyyeFKIF.mjs} +2 -2
- package/dist/server-lock-DwSyFoTt.mjs +1 -0
- package/dist/{skill-teardown-RIfU9RXJ.mjs → skill-teardown-DxeHIPsr.mjs} +2 -2
- package/dist/{src-DMpGVIiQ.mjs → src-B8SfUeFe.mjs} +67 -65
- package/dist/src-BA5_eUW_.mjs +1 -0
- package/dist/{src-Dbh7VwyK.mjs → src-D3IYzczj.mjs} +4 -4
- package/dist/src-DZEg-Zy7.mjs +2038 -0
- package/dist/{src-DStuuia4.mjs → src-Qlsty_8B.mjs} +1 -1
- package/dist/{start-DUSEK52t.mjs → start-BRLdH4Kk.mjs} +5 -5
- package/dist/start-Drc0EilO.mjs +1 -0
- package/dist/{ui-CjlnXaCK.mjs → ui-BQkXNsD0.mjs} +3 -3
- package/dist/ui-BkhU6wt_.mjs +1 -0
- package/dist/{write-project-skill-KUk3TJzG.mjs → write-project-skill-DHATTSra.mjs} +3 -3
- package/package.json +4 -4
- package/dist/constants-C3FyKvvJ.mjs +0 -2
- package/dist/git-handle-Bw80Zwhs.mjs +0 -1
- package/dist/init-DNXlL4dK.mjs +0 -1
- package/dist/loader-D1DiArIn.mjs +0 -1
- package/dist/md-manager-DiVPjAYl.mjs +0 -2
- package/dist/preview-D_HBDud3.mjs +0 -1
- package/dist/public/assets/CodeMirrorPropInput-Dk5Y6lfV.js +0 -3
- package/dist/public/assets/DiffView-BkhkquRc.js +0 -3
- package/dist/public/assets/DocumentContext-0PqIw4Mp.js +0 -38
- package/dist/public/assets/FeedbackForm-BhNBNOJ7.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CnEs-Git.js +0 -2
- package/dist/public/assets/ManagedArtifactProperties-diaPr-SS.js +0 -1
- package/dist/public/assets/SourceEditor-lnGI0Y3Z.js +0 -1
- package/dist/public/assets/auth-state-cache-jQDyjv8z.js +0 -11
- package/dist/public/assets/client-version-Bqbynb6h.js +0 -1
- package/dist/public/assets/cm-theme-NiQt8zc0.js +0 -1
- package/dist/public/assets/config-provider-CvgB96vD.js +0 -5
- package/dist/public/assets/dist-BUDkMEzD.js +0 -1
- package/dist/public/assets/dist-C6lhy_gK.js +0 -1
- package/dist/public/assets/dist-CADCdgrq.js +0 -23
- package/dist/public/assets/dist-CrYLos7c.js +0 -2
- package/dist/public/assets/dist-DbcFk_pj.js +0 -1
- package/dist/public/assets/dist-DpjZjxsY.js +0 -6
- package/dist/public/assets/dist-Ds8NLlxa.js +0 -9
- package/dist/public/assets/dist-RxK2lKIj.js +0 -1
- package/dist/public/assets/dist-lGeJn8Qx.js +0 -1
- package/dist/public/assets/documents-events-a5eIuqSk.js +0 -1
- package/dist/public/assets/follow-file-DtlRQ8jG.js +0 -4
- package/dist/public/assets/globals-DXwGOGPM.css +0 -1
- package/dist/public/assets/i18n-BAXNC2k8.js +0 -1
- package/dist/public/assets/index-Ca_TfGWK.js +0 -2095
- package/dist/public/assets/lint-config-client-DPKnQGxT.js +0 -1
- package/dist/public/assets/messages-B6vvv7H-.js +0 -1
- package/dist/public/assets/messages-Bf16a61t.js +0 -1
- package/dist/public/assets/messages-BlMkdPL-.js +0 -1
- package/dist/public/assets/messages-BrwWcQ1q.js +0 -1
- package/dist/public/assets/messages-Bsokz5p_.js +0 -1
- package/dist/public/assets/messages-CWnVB_17.js +0 -1
- package/dist/public/assets/messages-CgqvsJOb.js +0 -1
- package/dist/public/assets/messages-D3GzXczV.js +0 -1
- package/dist/public/assets/messages-DAiMiSQb.js +0 -1
- package/dist/public/assets/messages-DKla4fHa.js +0 -1
- package/dist/public/assets/messages-DhVrLKqA.js +0 -1
- package/dist/public/assets/navigation-targets-CmqNPgrG.js +0 -1
- package/dist/public/assets/typing-burst-detector-seDaKpRf.js +0 -8
- package/dist/public/assets/use-timeline-entry-diff--GTw5ypu.js +0 -6
- package/dist/repair-skills-D8TKPOmv.mjs +0 -1
- package/dist/server-lock-B4Z9_lXn.mjs +0 -1
- package/dist/src-1dq1rjVn.mjs +0 -1
- package/dist/src-CLSt7s4C.mjs +0 -2033
- package/dist/start-CbvGD0bY.mjs +0 -1
- package/dist/ui-DQkCLucF.mjs +0 -1
- /package/dist/public/assets/{globals-Ctlj0TIx.js → globals-CLY_4Hw9.js} +0 -0
- /package/dist/public/assets/{lint-plugin-meta-CKntN3M1.js → lint-plugin-meta-FPoTE-0t.js} +0 -0
- /package/dist/public/assets/{skeleton-D4wPMdlV.js → skeleton-BOVIbSHk.js} +0 -0
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./messages-CgqvsJOb.js","./chunk-CYidjpOJ.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{At as o,Br as s,Fa as c,Fo as l,Ia as u,Mt as d,Na as f,Nt as p,Ot as m,Pa as ee,Po as h,Pt as te,Ro as ne,Wr as re,as as ie,cs as ae,ds as oe,jt as se,kt as ce,ln as le,ri as ue,si as g,sn as de,vt as fe,xo as pe}from"./dist-DoYGOGZp.js";import{t as me}from"./dist-DUfEoSbR.js";import{n as he}from"./dist-B6jB2qbD2.js";import{a as ge,c as _e,m as ve,p as ye,r as be}from"./use-apply-config-color-theme-Cwl6JTaa.js";import"./i18n-BAXNC2k8.js";import{r as xe}from"./client-version-Bqbynb6h.js";var Se=a(),_=e(r(),1),Ce=null,we=new Set;function Te(){return Ce}function Ee(e){let t=e!==null&&e.length>0?e:null;if(t!==Ce){Ce=t;for(let e of we)try{e()}catch(e){console.warn(`[server-instance-store] subscriber threw:`,e)}}}function De(e){return we.add(e),()=>{we.delete(e)}}function Oe(){return(0,_.useSyncExternalStore)(De,Te,Te)}var v=()=>new Map,ke=e=>{let t=v();return e.forEach((e,n)=>{t.set(n,e)}),t},y=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},Ae=(e,t)=>{let n=[];for(let[r,i]of e)n.push(t(i,r));return n},je=(e,t)=>{for(let[n,r]of e)if(t(r,n))return!0;return!1},b=()=>new Set,Me=e=>e[e.length-1],Ne=(e,t)=>{for(let n=0;n<t.length;n++)e.push(t[n])},x=Array.from,Pe=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},Fe=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},Ie=(e,t)=>{let n=Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},Le=Array.isArray,Re=class{constructor(){this._observers=v()}on(e,t){return y(this._observers,e,b).add(t),t}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return x((this._observers.get(e)||v()).values()).forEach(e=>e(...t))}destroy(){this._observers=v()}},ze=class{constructor(){this._observers=v()}on(e,t){y(this._observers,e,b).add(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return x((this._observers.get(e)||v()).values()).forEach(e=>e(...t))}destroy(){this._observers=v()}},S=Math.floor,Be=Math.abs,Ve=(e,t)=>e<t?e:t,C=(e,t)=>e>t?e:t;Number.isNaN;var He=e=>e===0?1/e<0:e<0,Ue=1<<17,We=1<<18,Ge=1<<19,Ke=1<<20,qe=1<<21,Je=1<<22,Ye=1<<23,Xe=1<<24,Ze=1<<25,Qe=1<<26,$e=1<<27,et=1<<28,tt=1<<29;Ue-1,We-1,Ge-1,Ke-1,qe-1,Je-1,Ye-1,Xe-1,Ze-1,Qe-1,$e-1,et-1,tt-1;var nt=2**53-1,rt=-(2**53-1),it=Number.isInteger||(e=>typeof e==`number`&&isFinite(e)&&S(e)===e);Number.isNaN,Number.parseInt;var at=String.fromCharCode;String.fromCodePoint,at(65535);var ot=e=>e.toLowerCase(),st=/^\s*/g,ct=e=>e.replace(st,``),lt=/([A-Z])/g,ut=(e,t)=>ct(e.replace(lt,e=>`${t}${ot(e)}`)),dt=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},ft=typeof TextEncoder<`u`?new TextEncoder:null,pt=ft?e=>ft.encode(e):dt,mt=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});mt&&mt.decode(new Uint8Array).length===1&&(mt=null);var ht=(e,t)=>Ie(t,()=>e).join(``),gt=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},_t=()=>new gt,vt=e=>{let t=_t();return e(t),w(t)},yt=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},w=e=>{let t=new Uint8Array(yt(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},bt=(e,t)=>{let n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(C(n,t)*2),e.cpos=0)},T=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},xt=T,E=(e,t)=>{for(;t>127;)T(e,128|127&t),t=S(t/128);T(e,127&t)},St=(e,t)=>{let n=He(t);for(n&&(t=-t),T(e,(t>63?128:0)|(n?64:0)|63&t),t=S(t/64);t>0;)T(e,(t>127?128:0)|127&t),t=S(t/128)},Ct=new Uint8Array(3e4),wt=Ct.length/3,Tt=ft&&ft.encodeInto?(e,t)=>{if(t.length<wt){let n=ft.encodeInto(t,Ct).written||0;E(e,n);for(let t=0;t<n;t++)T(e,Ct[t])}else D(e,pt(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;E(e,r);for(let t=0;t<r;t++)T(e,n.codePointAt(t))},Et=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=Ve(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(C(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},D=(e,t)=>{E(e,t.byteLength),Et(e,t)},Dt=(e,t)=>{bt(e,t);let n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},Ot=(e,t)=>Dt(e,4).setFloat32(0,t,!1),kt=(e,t)=>Dt(e,8).setFloat64(0,t,!1),At=(e,t)=>Dt(e,8).setBigInt64(0,t,!1),jt=new DataView(new ArrayBuffer(4)),Mt=e=>(jt.setFloat32(0,e),jt.getFloat32(0)===e),Nt=(e,t)=>{switch(typeof t){case`string`:T(e,119),Tt(e,t);break;case`number`:it(t)&&Be(t)<=2147483647?(T(e,125),St(e,t)):Mt(t)?(T(e,124),Ot(e,t)):(T(e,123),kt(e,t));break;case`bigint`:T(e,122),At(e,t);break;case`object`:if(t===null)T(e,126);else if(Le(t)){T(e,117),E(e,t.length);for(let n=0;n<t.length;n++)Nt(e,t[n])}else if(t instanceof Uint8Array)T(e,116),D(e,t);else{T(e,118);let n=Object.keys(t);E(e,n.length);for(let r=0;r<n.length;r++){let i=n[r];Tt(e,i),Nt(e,t[i])}}break;case`boolean`:T(e,t?120:121);break;default:T(e,127)}},Pt=class extends gt{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&E(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},Ft=e=>{e.count>0&&(St(e.encoder,e.count===1?e.s:-e.s),e.count>1&&E(e.encoder,e.count-2))},It=class{constructor(){this.encoder=new gt,this.s=0,this.count=0}write(e){this.s===e?this.count++:(Ft(this),this.count=1,this.s=e)}toUint8Array(){return Ft(this),w(this.encoder)}},Lt=e=>{if(e.count>0){let t=e.diff*2+(e.count===1?0:1);St(e.encoder,t),e.count>1&&E(e.encoder,e.count-2)}},Rt=class{constructor(){this.encoder=new gt,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Lt(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Lt(this),w(this.encoder)}},zt=class{constructor(){this.sarr=[],this.s=``,this.lensE=new It}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=``),this.lensE.write(e.length)}toUint8Array(){let e=new gt;return this.sarr.push(this.s),this.s=``,Tt(e,this.sarr.join(``)),Et(e,this.lensE.toUint8Array()),w(e)}},O=e=>Error(e),k=()=>{throw O(`Method unimplemented`)},A=()=>{throw O(`Unexpected case`)},Bt=O(`Unexpected end of array`),Vt=O(`Integer out of Range`),Ht=class{constructor(e){this.arr=e,this.pos=0}},Ut=e=>new Ht(e),Wt=e=>e.pos!==e.arr.length,Gt=(e,t)=>{let n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},j=e=>Gt(e,M(e)),Kt=e=>e.arr[e.pos++],M=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&127)*n,n*=128,r<128)return t;if(t>nt)throw Vt}throw Bt},qt=e=>{let t=e.arr[e.pos++],n=t&63,r=64,i=(t&64)>0?-1:1;if(!(t&128))return i*n;let a=e.arr.length;for(;e.pos<a;){if(t=e.arr[e.pos++],n+=(t&127)*r,r*=128,t<128)return i*n;if(n>nt)throw Vt}throw Bt},Jt=mt?e=>mt.decode(j(e)):e=>{let t=M(e);if(t===0)return``;{let n=String.fromCodePoint(Kt(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(Kt(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},Yt=(e,t)=>{let n=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,t);return e.pos+=t,n},Xt=[e=>void 0,e=>null,qt,e=>Yt(e,4).getFloat32(0,!1),e=>Yt(e,8).getFloat64(0,!1),e=>Yt(e,8).getBigInt64(0,!1),e=>!1,e=>!0,Jt,e=>{let t=M(e),n={};for(let r=0;r<t;r++){let t=Jt(e);n[t]=Zt(e)}return n},e=>{let t=M(e),n=[];for(let r=0;r<t;r++)n.push(Zt(e));return n},j],Zt=e=>Xt[127-Kt(e)](e),Qt=class extends Ht{constructor(e,t){super(e),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),Wt(this)?this.count=M(this)+1:this.count=-1),this.count--,this.s}},$t=class extends Ht{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=qt(this);let e=He(this.s);this.count=1,e&&(this.s=-this.s,this.count=M(this)+2)}return this.count--,this.s}},en=class extends Ht{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let e=qt(this),t=e&1;this.diff=S(e/2),this.count=1,t&&(this.count=M(this)+2)}return this.s+=this.diff,this.count--,this.s}},tn=class{constructor(e){this.decoder=new $t(e),this.str=Jt(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),t=this.str.slice(this.spos,e);return this.spos=e,t}};crypto.subtle;var nn=crypto.getRandomValues.bind(crypto),rn=Math.random,an=()=>nn(new Uint32Array(1))[0],on=e=>e[S(rn()*e.length)],sn=`10000000-1000-4000-8000-100000000000`,cn=()=>sn.replace(/[018]/g,e=>(e^an()&15>>e/4).toString(16)),ln=Date.now,un=e=>new Promise(e);Promise.all.bind(Promise);var dn=e=>e===void 0?null:e,fn=new class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}};try{typeof localStorage<`u`&&localStorage&&(fn=localStorage)}catch{}var pn=fn,mn=Symbol(`Equality`),hn=(e,t)=>e===t||!!e?.[mn]?.(t)||!1,gn=e=>typeof e==`object`,_n=Object.assign,vn=Object.keys,yn=(e,t)=>{for(let n in e)t(e[n],n)},bn=e=>vn(e).length,xn=e=>{for(let t in e)return!1;return!0},Sn=(e,t)=>{for(let n in e)if(!t(e[n],n))return!1;return!0},Cn=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),wn=(e,t)=>e===t||bn(e)===bn(t)&&Sn(e,(e,n)=>(e!==void 0||Cn(t,n))&&hn(t[n],e)),Tn=Object.freeze,En=e=>{for(let t in e){let n=e[t];(typeof n==`object`||typeof n==`function`)&&En(e[t])}return Tn(e)},Dn=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&Dn(e,t,n+1)}},On=e=>e,kn=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[mn]!=null)return e[mn](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!kn(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(bn(e)!==bn(t))return!1;for(let n in e)if(!Cn(e,n)||!kn(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!kn(e[n],t[n]))return!1;break;default:return!1}return!0},An=(e,t)=>t.includes(e),jn=typeof process<`u`&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`,Mn=typeof window<`u`&&typeof document<`u`&&!jn;typeof navigator<`u`&&/Mac/.test(navigator.platform);var N,Nn=[],Pn=()=>{if(N===void 0)if(jn){N=v();let e=process.argv,t=null;for(let n=0;n<e.length;n++){let r=e[n];r[0]===`-`?(t!==null&&N.set(t,``),t=r):t===null?Nn.push(r):(N.set(t,r),t=null)}t!==null&&N.set(t,``)}else typeof location==`object`?(N=v(),(location.search||`?`).slice(1).split(`&`).forEach(e=>{if(e.length!==0){let[t,n]=e.split(`=`);N.set(`--${ut(t,`-`)}`,n),N.set(`-${ut(t,`-`)}`,n)}})):N=v();return N},Fn=e=>Pn().has(e),In=e=>dn(jn?{}[e.toUpperCase().replaceAll(`-`,`_`)]:pn.getItem(e)),Ln=e=>Fn(`--`+e)||In(e)!==null,Rn=Ln(`production`),zn=jn&&An({}.FORCE_COLOR,[`true`,`1`,`2`])||!Fn(`--no-colors`)&&!Ln(`no-color`)&&(!jn||process.stdout.isTTY)&&(!jn||Fn(`--color`)||In(`COLORTERM`)!==null||(In(`TERM`)||``).includes(`color`)),Bn=e=>new Uint8Array(e),Vn=Mn?e=>{let t=``;for(let n=0;n<e.byteLength;n++)t+=at(e[n]);return btoa(t)}:e=>Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString(`base64`),Hn=e=>{let t=Bn(e.byteLength);return t.set(e),t},Un=e=>vt(t=>Nt(t,e)),Wn=class{constructor(e,t){this.left=e,this.right=t}},P=(e,t)=>new Wn(e,t),Gn=(e,t)=>e.forEach(e=>t(e.left,e.right)),Kn=e=>e.next()>=.5,qn=(e,t,n)=>S(e.next()*(n+1-t)+t),Jn=(e,t,n)=>S(e.next()*(n+1-t)+t),Yn=(e,t,n)=>Jn(e,t,n),Xn=e=>at(Yn(e,97,122)),Zn=(e,t=0,n=20)=>{let r=Yn(e,t,n),i=``;for(let t=0;t<r;t++)i+=Xn(e);return i},Qn=(e,t)=>t[Yn(e,0,t.length-1)],$n=Symbol(`0schema`),er=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){let e=[];for(let t=this._rerrs.length-1;t>0;t--){let n=this._rerrs[t];e.push(ht(` `,(this._rerrs.length-t)*2)+`${n.path==null?``:`[${n.path}] `}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
3
|
-
`)}},tr=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[mn]?hn(e,t):Le(e)?Pe(e,e=>Fe(t,t=>tr(e,t))):gn(e)?Sn(e,(e,n)=>tr(e,t[n])):!1,F=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),tr(t,n)}equals(e){return this.constructor===e.constructor&&kn(this.shape,e.shape)}[$n](){return!0}[mn](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){k()}get nullable(){return Mr(this,qr)}get optional(){return new ur(this)}cast(e){return Zr(e,this),e}expect(e){return Zr(e,this),e}},nr=class extends F{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){let n=e?.constructor===this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor===this.shape?`Check failed`:`Constructor match failed`),n}},I=(e,t=null)=>new nr(e,t);I(nr);var rr=class extends F{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape(e);return!n&&t?.extend(null,`custom prop`,e?.constructor.name,`failed to check custom prop`),n}},L=e=>new rr(e);I(rr);var ir=class extends F{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape.some(t=>t===e);return!n&&t?.extend(null,this.shape.join(` | `),e.toString()),n}},ar=(...e)=>new ir(e),or=I(ir),sr=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,e=>`\\`+e)),cr=e=>{if(Hr.check(e))return[sr(e)];if(or.check(e))return e.shape.map(e=>e+``);if(Vr.check(e))return[`[+-]?\\d+.?\\d*`];if(Ur.check(e))return[`.*`];if(Nr.check(e))return e.shape.map(cr).flat(1);A()};I(class extends F{constructor(e){super(),this.shape=e,this._r=RegExp(`^`+e.map(cr).map(e=>`(${e.join(`|`)})`).join(``)+`$`)}check(e,t){let n=this._r.exec(e)!=null;return!n&&t?.extend(null,this._r.toString(),e.toString(),`String doesn't match string template.`),n}});var lr=Symbol(`optional`),ur=class extends F{constructor(e){super(),this.shape=e}check(e,t){let n=e===void 0||this.shape.check(e);return!n&&t?.extend(null,`undefined (optional)`,`()`),n}get[lr](){return!0}},dr=I(ur),fr=class extends F{check(e,t){return t?.extend(null,`never`,typeof e),!1}};new fr,I(fr);var pr=class e extends F{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new e(this.shape,!0)}check(e,t){return e==null?(t?.extend(null,`object`,`null`),!1):Sn(this.shape,(n,r)=>{let i=this._isPartial&&!Cn(e,r)||n.check(e[r],t);return!i&&t?.extend(r.toString(),n.toString(),typeof e[r],`Object property does not match`),i})}},mr=e=>new pr(e),hr=I(pr),gr=L(e=>e!=null&&(e.constructor===Object||e.constructor==null)),_r=class extends F{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&Sn(e,(n,r)=>{let i=this.shape.keys.check(r,t);return!i&&t?.extend(r+``,`Record`,typeof e,i?`Key doesn't match schema`:`Value doesn't match value`),i&&this.shape.values.check(n,t)})}},vr=(e,t)=>new _r(e,t),yr=I(_r),br=class extends F{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&Sn(this.shape,(n,r)=>{let i=n.check(e[r],t);return!i&&t?.extend(r.toString(),`Tuple`,typeof n),i})}},xr=(...e)=>new br(e);I(br);var Sr=class extends F{constructor(e){super(),this.shape=e.length===1?e[0]:new jr(e)}check(e,t){let n=Le(e)&&Pe(e,e=>this.shape.check(e));return!n&&t?.extend(null,`Array`,``),n}},Cr=(...e)=>new Sr(e),wr=I(Sr),Tr=L(e=>Le(e)),Er=class extends F{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let n=e instanceof this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name),n}},Dr=(e,t=null)=>new Er(e,t);I(Er);var Or=Dr(F),kr=I(class extends F{constructor(e){super(),this.len=e.length-1,this.args=xr(...e.slice(-1)),this.res=e[this.len]}check(e,t){let n=e.constructor===Function&&e.length<=this.len;return!n&&t?.extend(null,`function`,typeof e),n}}),Ar=L(e=>typeof e==`function`);I(class extends F{constructor(e){super(),this.shape=e}check(e,t){let n=Pe(this.shape,n=>n.check(e,t));return!n&&t?.extend(null,`Intersectinon`,typeof e),n}},e=>e.shape.length>0);var jr=class extends F{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){let n=Fe(this.shape,n=>n.check(e,t));return t?.extend(null,`Union`,typeof e),n}},Mr=(...e)=>e.findIndex(e=>Nr.check(e))>=0?Mr(...e.map(e=>Xr(e)).map(e=>Nr.check(e)?e.shape:[e]).flat(1)):e.length===1?e[0]:new jr(e),Nr=I(jr),Pr=()=>!0,Fr=L(Pr),Ir=I(rr,e=>e.shape===Pr),Lr=L(e=>typeof e==`bigint`),Rr=L(e=>e===Lr),zr=L(e=>typeof e==`symbol`);L(e=>e===zr);var Br=L(e=>typeof e==`number`),Vr=L(e=>e===Br),Hr=L(e=>typeof e==`string`),Ur=L(e=>e===Hr),Wr=L(e=>typeof e==`boolean`),Gr=L(e=>e===Wr),Kr=ar(void 0);I(ir,e=>e.shape.length===1&&e.shape[0]===void 0),ar(void 0);var qr=ar(null),Jr=I(ir,e=>e.shape.length===1&&e.shape[0]===null);I(Uint8Array),I(nr,e=>e.shape===Uint8Array);var Yr=Mr(Br,Hr,qr,Kr,Lr,Wr,zr);(()=>{let e=Cr(Fr),t=vr(Hr,Fr),n=Mr(Br,Hr,qr,Wr,e,t);return e.shape=n,t.shape.values=n,n})();var Xr=e=>{if(Or.check(e))return e;if(gr.check(e)){let t={};for(let n in e)t[n]=Xr(e[n]);return mr(t)}else if(Tr.check(e))return Mr(...e.map(Xr));else if(Yr.check(e))return ar(e);else if(Ar.check(e))return I(e);A()},Zr=Rn?()=>{}:(e,t)=>{let n=new er;if(!t.check(e,n))throw O(`Expected value to be of type ${t.constructor.name}.\n${n.toString()}`)},Qr=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Xr(e),h:t}),this}else(e){return this.if(Fr,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){let r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw O(`Unhandled pattern`)}}},$r=(e=>new Qr(e))(Fr).if(Vr,(e,t)=>qn(t,rt,nt)).if(Ur,(e,t)=>Zn(t)).if(Gr,(e,t)=>Kn(t)).if(Rr,(e,t)=>BigInt(qn(t,rt,nt))).if(Nr,(e,t)=>ei(t,Qn(t,e.shape))).if(hr,(e,t)=>{let n={};for(let r in e.shape){let i=e.shape[r];if(dr.check(i)){if(Kn(t))continue;i=i.shape}n[r]=$r(i,t)}return n}).if(wr,(e,t)=>{let n=[],r=Jn(t,0,42);for(let i=0;i<r;i++)n.push(ei(t,e.shape));return n}).if(or,(e,t)=>Qn(t,e.shape)).if(Jr,(e,t)=>null).if(kr,(e,t)=>{let n=ei(t,e.res);return()=>n}).if(Ir,(e,t)=>ei(t,Qn(t,[Br,Hr,qr,Kr,Lr,Wr,Cr(Br),vr(Mr(`a`,`b`,`c`),Br)]))).if(yr,(e,t)=>{let n={},r=qn(t,0,3);for(let i=0;i<r;i++){let r=ei(t,e.shape.keys);n[r]=ei(t,e.shape.values)}return n}).done(),ei=(e,t)=>$r(Xr(t),e),R=typeof document<`u`?document:{},ti=e=>R.createElement(e),ni=()=>R.createDocumentFragment();L(e=>e.nodeType===mi);var ri=e=>R.createTextNode(e);typeof DOMParser<`u`&&new DOMParser;var ii=(e,t)=>(Gn(t,(t,n)=>{n===!1?e.removeAttribute(t):n===!0?e.setAttribute(t,``):e.setAttribute(t,n)}),e),ai=e=>{let t=ni();for(let n=0;n<e.length;n++)ui(t,e[n]);return t},oi=(e,t)=>(ui(e,ai(t)),e),si=(e,t=[],n=[])=>oi(ii(ti(e),t),n);L(e=>e.nodeType===di);var ci=ri;L(e=>e.nodeType===fi);var li=e=>Ae(e,(e,t)=>`${t}:${e};`).join(``),ui=(e,t)=>e.appendChild(t),di=R.ELEMENT_NODE,fi=R.TEXT_NODE;R.CDATA_SECTION_NODE,R.COMMENT_NODE;var pi=R.DOCUMENT_NODE;R.DOCUMENT_TYPE_NODE;var mi=R.DOCUMENT_FRAGMENT_NODE;L(e=>e.nodeType===pi);var hi=(e=>class{constructor(e){this._=e}destroy(){e(this._)}})(clearTimeout),gi=(e,t)=>new hi(setTimeout(t,e)),_i=Symbol,vi=_i(),yi=_i(),bi=_i(),xi=_i(),Si=_i(),Ci=_i(),wi=_i(),Ti=_i(),Ei=_i(),Di=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=0;for(;r<e.length;r++){let n=e[r];if(n===void 0)break;if(n.constructor===String||n.constructor===Number)t.push(n);else if(n.constructor===Object)break}for(r>0&&n.push(t.join(``));r<e.length;r++){let t=e[r];t instanceof Symbol||n.push(t)}return n};ln();var Oi={[vi]:P(`font-weight`,`bold`),[yi]:P(`font-weight`,`normal`),[bi]:P(`color`,`blue`),[Si]:P(`color`,`green`),[xi]:P(`color`,`grey`),[Ci]:P(`color`,`red`),[wi]:P(`color`,`purple`),[Ti]:P(`color`,`orange`),[Ei]:P(`color`,`black`)},ki=zn?e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());let t=[],n=[],r=v(),i=[],a=0;for(;a<e.length;a++){let i=e[a],o=Oi[i];if(o!==void 0)r.set(o.left,o.right);else{if(i===void 0)break;if(i.constructor===String||i.constructor===Number){let e=li(r);a>0||e.length>0?(t.push(`%c`+i),n.push(e)):t.push(i)}else break}}for(a>0&&(i=n,i.unshift(t.join(``)));a<e.length;a++){let t=e[a];t instanceof Symbol||i.push(t)}return i}:Di,Ai=(...e)=>{console.log(...ki(e)),Mi.forEach(t=>t.print(e))},ji=(...e)=>{console.warn(...ki(e)),e.unshift(Ti),Mi.forEach(t=>t.print(e))},Mi=b(),Ni=e=>({[Symbol.iterator](){return this},next:e}),Pi=(e,t)=>Ni(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),Fi=(e,t)=>Ni(()=>{let{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),Ii=class{constructor(e,t){this.clock=e,this.len=t}},Li=class{constructor(){this.clients=new Map}},Ri=(e,t,n)=>t.clients.forEach((t,r)=>{let i=e.doc.store.clients.get(r);if(i!=null){let r=i[i.length-1],a=r.id.clock+r.length;for(let r=0,o=t[r];r<t.length&&o.clock<a;o=t[++r])$a(e,i,o.clock,o.len,n)}}),zi=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){let i=S((n+r)/2),a=e[i],o=a.clock;if(o<=t){if(t<o+a.len)return i;n=i+1}else r=i-1}return null},Bi=(e,t)=>{let n=e.clients.get(t.client);return n!==void 0&&zi(n,t.clock)!==null},Vi=e=>{e.clients.forEach(e=>{e.sort((e,t)=>e.clock-t.clock);let t,n;for(t=1,n=1;t<e.length;t++){let r=e[n-1],i=e[t];r.clock+r.len>=i.clock?e[n-1]=new Ii(r.clock,C(r.len,i.clock+i.len-r.clock)):(n<t&&(e[n]=i),n++)}e.length=n})},Hi=e=>{let t=new Li;for(let n=0;n<e.length;n++)e[n].clients.forEach((r,i)=>{if(!t.clients.has(i)){let a=r.slice();for(let t=n+1;t<e.length;t++)Ne(a,e[t].clients.get(i)||[]);t.clients.set(i,a)}});return Vi(t),t},Ui=(e,t,n,r)=>{y(e.clients,t,()=>[]).push(new Ii(n,r))},Wi=()=>new Li,Gi=e=>{let t=Wi();return e.clients.forEach((e,n)=>{let r=[];for(let t=0;t<e.length;t++){let n=e[t];if(n.deleted){let i=n.id.clock,a=n.length;if(t+1<e.length)for(let n=e[t+1];t+1<e.length&&n.deleted;n=e[++t+1])a+=n.length;r.push(new Ii(i,a))}}r.length>0&&t.clients.set(n,r)}),t},Ki=(e,t)=>{E(e.restEncoder,t.clients.size),x(t.clients.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{e.resetDsCurVal(),E(e.restEncoder,t);let r=n.length;E(e.restEncoder,r);for(let t=0;t<r;t++){let r=n[t];e.writeDsClock(r.clock),e.writeDsLen(r.len)}})},qi=e=>{let t=new Li,n=M(e.restDecoder);for(let r=0;r<n;r++){e.resetDsCurVal();let n=M(e.restDecoder),r=M(e.restDecoder);if(r>0){let i=y(t.clients,n,()=>[]);for(let t=0;t<r;t++)i.push(new Ii(e.readDsClock(),e.readDsLen()))}}return t},Ji=(e,t,n)=>{let r=new Li,i=M(e.restDecoder);for(let a=0;a<i;a++){e.resetDsCurVal();let i=M(e.restDecoder),a=M(e.restDecoder),o=n.clients.get(i)||[],s=B(n,i);for(let n=0;n<a;n++){let n=e.readDsClock(),a=n+e.readDsLen();if(n<s){s<a&&Ui(r,i,s,a-s);let e=V(o,n),c=o[e];for(!c.deleted&&c.id.clock<n&&(o.splice(e+1,0,fc(t,c,n-c.id.clock)),e++);e<o.length&&(c=o[e++],c.id.clock<a);)c.deleted||(a<c.id.clock+c.length&&o.splice(e,0,fc(t,c,a-c.id.clock)),c.delete(t))}else Ui(r,i,n,a-n)}}if(r.clients.size>0){let e=new ia;return E(e.restEncoder,0),Ki(e,r),e.toUint8Array()}return null},Yi=an,Xi=class e extends Re{constructor({guid:e=cn(),collectionid:t=null,gc:n=!0,gcFilter:r=()=>!0,meta:i=null,autoLoad:a=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=r,this.clientID=Yi(),this.guid=e,this.collectionid=t,this.share=new Map,this.store=new Ka,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=a,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=un(e=>{this.on(`load`,()=>{this.isLoaded=!0,e(this)})});let s=()=>un(e=>{let t=n=>{(n===void 0||n===!0)&&(this.off(`sync`,t),e())};this.on(`sync`,t)});this.on(`sync`,e=>{e===!1&&this.isSynced&&(this.whenSynced=s()),this.isSynced=e===void 0||e===!0,this.isSynced&&!this.isLoaded&&this.emit(`load`,[this])}),this.whenSynced=s()}load(){let e=this._item;e!==null&&!this.shouldLoad&&U(e.parent.doc,e=>{e.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(x(this.subdocs).map(e=>e.guid))}transact(e,t=null){return U(this,e,t)}get(e,t=G){let n=y(this.share,e,()=>{let e=new t;return e._integrate(this,null),e}),r=n.constructor;if(t!==G&&r!==t)if(r===G){let r=new t;r._map=n._map,n._map.forEach(e=>{for(;e!==null;e=e.left)e.parent=r}),r._start=n._start;for(let e=r._start;e!==null;e=e.right)e.parent=r;return r._length=n._length,this.share.set(e,r),r._integrate(this,null),r}else throw Error(`Type with the name ${e} has already been defined with a different constructor`);return n}getArray(e=``){return this.get(e,ns)}getText(e=``){return this.get(e,Cs)}getMap(e=``){return this.get(e,as)}getXmlElement(e=``){return this.get(e,Os)}getXmlFragment(e=``){return this.get(e,Es)}toJSON(){let e={};return this.share.forEach((t,n)=>{e[n]=t.toJSON()}),e}destroy(){this.isDestroyed=!0,x(this.subdocs).forEach(e=>e.destroy());let t=this._item;if(t!==null){this._item=null;let n=t.content;n.doc=new e({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,U(t.parent.doc,e=>{let r=n.doc;t.deleted||e.subdocsAdded.add(r),e.subdocsRemoved.add(this)},null,!0)}this.emit(`destroyed`,[!0]),this.emit(`destroy`,[this]),super.destroy()}},Zi=class{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return M(this.restDecoder)}readDsLen(){return M(this.restDecoder)}},Qi=class extends Zi{readLeftID(){return z(M(this.restDecoder),M(this.restDecoder))}readRightID(){return z(M(this.restDecoder),M(this.restDecoder))}readClient(){return M(this.restDecoder)}readInfo(){return Kt(this.restDecoder)}readString(){return Jt(this.restDecoder)}readParentInfo(){return M(this.restDecoder)===1}readTypeRef(){return M(this.restDecoder)}readLen(){return M(this.restDecoder)}readAny(){return Zt(this.restDecoder)}readBuf(){return Hn(j(this.restDecoder))}readJSON(){return JSON.parse(Jt(this.restDecoder))}readKey(){return Jt(this.restDecoder)}},$i=class{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=M(this.restDecoder),this.dsCurrVal}readDsLen(){let e=M(this.restDecoder)+1;return this.dsCurrVal+=e,e}},ea=class extends $i{constructor(e){super(e),this.keys=[],M(e),this.keyClockDecoder=new en(j(e)),this.clientDecoder=new $t(j(e)),this.leftClockDecoder=new en(j(e)),this.rightClockDecoder=new en(j(e)),this.infoDecoder=new Qt(j(e),Kt),this.stringDecoder=new tn(j(e)),this.parentInfoDecoder=new Qt(j(e),Kt),this.typeRefDecoder=new $t(j(e)),this.lenDecoder=new $t(j(e))}readLeftID(){return new Da(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Da(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Zt(this.restDecoder)}readBuf(){return j(this.restDecoder)}readJSON(){return Zt(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{let e=this.stringDecoder.read();return this.keys.push(e),e}}},ta=class{constructor(){this.restEncoder=_t()}toUint8Array(){return w(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){E(this.restEncoder,e)}writeDsLen(e){E(this.restEncoder,e)}},na=class extends ta{writeLeftID(e){E(this.restEncoder,e.client),E(this.restEncoder,e.clock)}writeRightID(e){E(this.restEncoder,e.client),E(this.restEncoder,e.clock)}writeClient(e){E(this.restEncoder,e)}writeInfo(e){xt(this.restEncoder,e)}writeString(e){Tt(this.restEncoder,e)}writeParentInfo(e){E(this.restEncoder,+!!e)}writeTypeRef(e){E(this.restEncoder,e)}writeLen(e){E(this.restEncoder,e)}writeAny(e){Nt(this.restEncoder,e)}writeBuf(e){D(this.restEncoder,e)}writeJSON(e){Tt(this.restEncoder,JSON.stringify(e))}writeKey(e){Tt(this.restEncoder,e)}},ra=class{constructor(){this.restEncoder=_t(),this.dsCurrVal=0}toUint8Array(){return w(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let t=e-this.dsCurrVal;this.dsCurrVal=e,E(this.restEncoder,t)}writeDsLen(e){e===0&&A(),E(this.restEncoder,e-1),this.dsCurrVal+=e}},ia=class extends ra{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Rt,this.clientEncoder=new It,this.leftClockEncoder=new Rt,this.rightClockEncoder=new Rt,this.infoEncoder=new Pt(xt),this.stringEncoder=new zt,this.parentInfoEncoder=new Pt(xt),this.typeRefEncoder=new It,this.lenEncoder=new It}toUint8Array(){let e=_t();return E(e,0),D(e,this.keyClockEncoder.toUint8Array()),D(e,this.clientEncoder.toUint8Array()),D(e,this.leftClockEncoder.toUint8Array()),D(e,this.rightClockEncoder.toUint8Array()),D(e,w(this.infoEncoder)),D(e,this.stringEncoder.toUint8Array()),D(e,w(this.parentInfoEncoder)),D(e,this.typeRefEncoder.toUint8Array()),D(e,this.lenEncoder.toUint8Array()),Et(e,w(this.restEncoder)),w(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)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Nt(this.restEncoder,e)}writeBuf(e){D(this.restEncoder,e)}writeJSON(e){Nt(this.restEncoder,e)}writeKey(e){let t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}},aa=(e,t,n,r)=>{r=C(r,t[0].id.clock);let i=V(t,r);E(e.restEncoder,t.length-i),e.writeClient(n),E(e.restEncoder,r);let a=t[i];a.write(e,r-a.id.clock);for(let n=i+1;n<t.length;n++)t[n].write(e,0)},oa=(e,t,n)=>{let r=new Map;n.forEach((e,n)=>{B(t,n)>e&&r.set(n,e)}),qa(t).forEach((e,t)=>{n.has(t)||r.set(t,0)}),E(e.restEncoder,r.size),x(r.entries()).sort((e,t)=>t[0]-e[0]).forEach(([n,r])=>{aa(e,t.clients.get(n),n,r)})},sa=(e,t)=>{let n=v(),r=M(e.restDecoder);for(let i=0;i<r;i++){let r=M(e.restDecoder),i=Array(r),a=e.readClient(),o=M(e.restDecoder);n.set(a,{i:0,refs:i});for(let n=0;n<r;n++){let r=e.readInfo();switch(31&r){case 0:{let t=e.readLen();i[n]=new K(z(a,o),t),o+=t;break}case 10:{let t=M(e.restDecoder);i[n]=new Y(z(a,o),t),o+=t;break}default:{let s=(r&192)==0,c=new J(z(a,o),null,(r&128)==128?e.readLeftID():null,null,(r&64)==64?e.readRightID():null,s?e.readParentInfo()?t.get(e.readString()):e.readLeftID():null,s&&(r&32)==32?e.readString():null,hc(e,r));i[n]=c,o+=c.length}}}}return n},ca=(e,t,n)=>{let r=[],i=x(n.keys()).sort((e,t)=>e-t);if(i.length===0)return null;let a=()=>{if(i.length===0)return null;let e=n.get(i[i.length-1]);for(;e.refs.length===e.i;)if(i.pop(),i.length>0)e=n.get(i[i.length-1]);else return null;return e},o=a();if(o===null)return null;let s=new Ka,c=new Map,l=(e,t)=>{let n=c.get(e);(n==null||n>t)&&c.set(e,t)},u=o.refs[o.i++],d=new Map,f=()=>{for(let e of r){let t=e.id.client,r=n.get(t);r?(r.i--,s.clients.set(t,r.refs.slice(r.i)),n.delete(t),r.i=0,r.refs=[]):s.clients.set(t,[e]),i=i.filter(e=>e!==t)}r.length=0};for(;;){if(u.constructor!==Y){let i=y(d,u.id.client,()=>B(t,u.id.client))-u.id.clock;if(i<0)r.push(u),l(u.id.client,u.id.clock-1),f();else{let a=u.getMissing(e,t);if(a!==null){r.push(u);let e=n.get(a)||{refs:[],i:0};if(e.refs.length===e.i)l(a,B(t,a)),f();else{u=e.refs[e.i++];continue}}else (i===0||i<u.length)&&(u.integrate(e,i),d.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(o!==null&&o.i<o.refs.length)u=o.refs[o.i++];else{if(o=a(),o===null)break;u=o.refs[o.i++]}}if(s.clients.size>0){let e=new ia;return oa(e,s,new Map),E(e.restEncoder,0),{missing:c,update:e.toUint8Array()}}return null},la=(e,t)=>oa(e,t.doc.store,t.beforeState),ua=(e,t,n,r=new ea(e))=>U(t,e=>{e.local=!1;let t=!1,n=e.doc,i=n.store,a=ca(e,i,sa(r,n)),o=i.pendingStructs;if(o){for(let[e,n]of o.missing)if(n<B(i,e)){t=!0;break}if(a){for(let[e,t]of a.missing){let n=o.missing.get(e);(n==null||n>t)&&o.missing.set(e,t)}o.update=_o([o.update,a.update])}}else i.pendingStructs=a;let s=Ji(r,e,i);if(i.pendingDs){let t=new ea(Ut(i.pendingDs));M(t.restDecoder);let n=Ji(t,e,i);s&&n?i.pendingDs=_o([s,n]):i.pendingDs=s||n}else i.pendingDs=s;if(t){let t=i.pendingStructs.update;i.pendingStructs=null,da(e.doc,t)}},n,!1),da=(e,t,n,r=ea)=>{let i=Ut(t);ua(i,e,n,new r(i))},fa=(e,t,n)=>da(e,t,n,Qi),pa=(e,t,n=new Map)=>{oa(e,t.store,n),Ki(e,Gi(t.store))},ma=(e,t=new Uint8Array([0]),n=new ia)=>{pa(n,e,_a(t));let r=[n.toUint8Array()];if(e.store.pendingDs&&r.push(e.store.pendingDs),e.store.pendingStructs&&r.push(vo(e.store.pendingStructs.update,t)),r.length>1){if(n.constructor===na)return ho(r.map((e,t)=>t===0?e:Co(e)));if(n.constructor===ia)return _o(r)}return r[0]},ha=(e,t)=>ma(e,t,new na),ga=e=>{let t=new Map,n=M(e.restDecoder);for(let r=0;r<n;r++){let n=M(e.restDecoder),r=M(e.restDecoder);t.set(n,r)}return t},_a=e=>ga(new Zi(Ut(e))),va=(e,t)=>(E(e.restEncoder,t.size),x(t.entries()).sort((e,t)=>t[0]-e[0]).forEach(([t,n])=>{E(e.restEncoder,t),E(e.restEncoder,n)}),e),ya=(e,t)=>va(e,qa(t.store)),ba=(e,t=new ra)=>(e instanceof Map?va(t,e):ya(t,e),t.toUint8Array()),xa=e=>ba(e,new ta),Sa=class{constructor(){this.l=[]}},Ca=()=>new Sa,wa=(e,t)=>e.l.push(t),Ta=(e,t)=>{let n=e.l,r=n.length;e.l=n.filter(e=>t!==e),r===e.l.length&&console.error(`[yjs] Tried to remove event handler that doesn't exist.`)},Ea=(e,t,n)=>Dn(e.l,[t,n]),Da=class{constructor(e,t){this.client=e,this.clock=t}},Oa=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,z=(e,t)=>new Da(e,t),ka=e=>{for(let[t,n]of e.doc.share.entries())if(n===e)return t;throw A()},Aa=(e,t)=>{for(;t!==null;){if(t.parent===e)return!0;t=t.parent._item}return!1},ja=class{constructor(e,t,n,r=0){this.type=e,this.tname=t,this.item=n,this.assoc=r}},Ma=e=>{let t={};return e.type&&(t.type=e.type),e.tname&&(t.tname=e.tname),e.item&&(t.item=e.item),e.assoc!=null&&(t.assoc=e.assoc),t},Na=e=>new ja(e.type==null?null:z(e.type.client,e.type.clock),e.tname??null,e.item==null?null:z(e.item.client,e.item.clock),e.assoc==null?0:e.assoc),Pa=class{constructor(e,t,n=0){this.type=e,this.index=t,this.assoc=n}},Fa=(e,t,n=0)=>new Pa(e,t,n),Ia=(e,t,n)=>{let r=null,i=null;return e._item===null?i=ka(e):r=z(e._item.id.client,e._item.id.clock),new ja(r,i,t,n)},La=(e,t,n=0)=>{let r=e._start;if(n<0){if(t===0)return Ia(e,null,n);t--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>t)return Ia(e,z(r.id.client,r.id.clock+t),n);t-=r.length}if(r.right===null&&n<0)return Ia(e,r.lastId,n);r=r.right}return Ia(e,null,n)},Ra=(e,t)=>{let n=Ya(e,t);return{item:n,diff:t.clock-n.id.clock}},za=(e,t,n=!0)=>{let r=t.store,i=e.item,a=e.type,o=e.tname,s=e.assoc,c=null,l=0;if(i!==null){if(B(r,i.client)<=i.clock)return null;let e=n?uc(r,i):Ra(r,i),t=e.item;if(!(t instanceof J))return null;if(c=t.parent,c._item===null||!c._item.deleted){l=t.deleted||!t.countable?0:e.diff+(s>=0?0:1);let n=t.left;for(;n!==null;)!n.deleted&&n.countable&&(l+=n.length),n=n.left}}else{if(o!==null)c=t.get(o);else if(a!==null){if(B(r,a.client)<=a.clock)return null;let{item:e}=n?uc(r,a):{item:Ya(r,a)};if(e instanceof J&&e.content instanceof cc)c=e.content.type;else return null}else throw A();l=s>=0?c._length:0}return Fa(c,l,e.assoc)},Ba=(e,t)=>e===t||e!==null&&t!==null&&e.tname===t.tname&&Oa(e.item,t.item)&&Oa(e.type,t.type)&&e.assoc===t.assoc,Va=class{constructor(e,t){this.ds=e,this.sv=t}},Ha=(e,t)=>new Va(e,t);Ha(Wi(),new Map);var Ua=e=>Ha(Gi(e.store),qa(e.store)),Wa=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!Bi(t.ds,e.id),Ga=(e,t)=>{let n=y(e.meta,Ga,b),r=e.doc.store;n.has(t)||(t.sv.forEach((t,n)=>{t<B(r,n)&&H(e,z(n,t))}),Ri(e,t.ds,e=>{}),n.add(t))},Ka=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},qa=e=>{let t=new Map;return e.clients.forEach((e,n)=>{let r=e[e.length-1];t.set(n,r.id.clock+r.length)}),t},B=(e,t)=>{let n=e.clients.get(t);if(n===void 0)return 0;let r=n[n.length-1];return r.id.clock+r.length},Ja=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{let e=n[n.length-1];if(e.id.clock+e.length!==t.id.clock)throw A()}n.push(t)},V=(e,t)=>{let n=0,r=e.length-1,i=e[r],a=i.id.clock;if(a===t)return r;let o=S(t/(a+i.length-1)*r);for(;n<=r;){if(i=e[o],a=i.id.clock,a<=t){if(t<a+i.length)return o;n=o+1}else r=o-1;o=S((n+r)/2)}throw A()},Ya=(e,t)=>{let n=e.clients.get(t.client);return n[V(n,t.clock)]},Xa=(e,t,n)=>{let r=V(t,n),i=t[r];return i.id.clock<n&&i instanceof J?(t.splice(r+1,0,fc(e,i,n-i.id.clock)),r+1):r},H=(e,t)=>{let n=e.doc.store.clients.get(t.client);return n[Xa(e,n,t.clock)]},Za=(e,t,n)=>{let r=t.clients.get(n.client),i=V(r,n.clock),a=r[i];return n.clock!==a.id.clock+a.length-1&&a.constructor!==K&&r.splice(i+1,0,fc(e,a,n.clock-a.id.clock+1)),a},Qa=(e,t,n)=>{let r=e.clients.get(t.id.client);r[V(r,t.id.clock)]=n},$a=(e,t,n,r,i)=>{if(r===0)return;let a=n+r,o=Xa(e,t,n),s;do s=t[o++],a<s.id.clock+s.length&&Xa(e,t,a),i(s);while(o<t.length&&t[o].id.clock<a)},eo=class{constructor(e,t,n){this.doc=e,this.deleteSet=new Li,this.beforeState=qa(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=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}},to=(e,t)=>t.deleteSet.clients.size===0&&!je(t.afterState,(e,n)=>t.beforeState.get(n)!==e)?!1:(Vi(t.deleteSet),la(e,t),Ki(e,t.deleteSet),!0),no=(e,t,n)=>{let r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&y(e.changed,t,b).add(n)},ro=(e,t)=>{let n=e[t],r=e[t-1],i=t;for(;i>0;n=r,r=e[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof J&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}let a=t-i;return a&&e.splice(t+1-a,a),a},io=(e,t,n)=>{for(let[r,i]of e.clients.entries()){let e=t.clients.get(r);for(let r=i.length-1;r>=0;r--){let a=i[r],o=a.clock+a.len;for(let r=V(e,a.clock),i=e[r];r<e.length&&i.id.clock<o;i=e[++r]){let i=e[r];if(a.clock+a.len<=i.id.clock)break;i instanceof J&&i.deleted&&!i.keep&&n(i)&&i.gc(t,!1)}}}},ao=(e,t)=>{e.clients.forEach((e,n)=>{let r=t.clients.get(n);for(let t=e.length-1;t>=0;t--){let n=e[t],i=Ve(r.length-1,1+V(r,n.clock+n.len-1));for(let e=i,t=r[e];e>0&&t.id.clock>=n.clock;t=r[e])e-=1+ro(r,e)}})},oo=(e,t)=>{if(t<e.length){let n=e[t],r=n.doc,i=r.store,a=n.deleteSet,o=n._mergeStructs;try{Vi(a),n.afterState=qa(n.doc.store),r.emit(`beforeObserverCalls`,[n,r]);let e=[];n.changed.forEach((t,r)=>e.push(()=>{(r._item===null||!r._item.deleted)&&r._callObserver(n,t)})),e.push(()=>{n.changedParentTypes.forEach((t,r)=>{r._dEH.l.length>0&&(r._item===null||!r._item.deleted)&&(t=t.filter(e=>e.target._item===null||!e.target._item.deleted),t.forEach(e=>{e.currentTarget=r,e._path=null}),t.sort((e,t)=>e.path.length-t.path.length),e.push(()=>{Ea(r._dEH,t,n)}))}),e.push(()=>r.emit(`afterTransaction`,[n,r])),e.push(()=>{n._needFormattingCleanup&&bs(n)})}),Dn(e,[])}finally{r.gc&&io(a,i,r.gcFilter),ao(a,i),n.afterState.forEach((e,t)=>{let r=n.beforeState.get(t)||0;if(r!==e){let e=i.clients.get(t),n=C(V(e,r),1);for(let t=e.length-1;t>=n;)t-=1+ro(e,t)}});for(let e=o.length-1;e>=0;e--){let{client:t,clock:n}=o[e].id,r=i.clients.get(t),a=V(r,n);a+1<r.length&&ro(r,a+1)>1||a>0&&ro(r,a)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(Ai(Ti,vi,`[yjs] `,yi,Ci,`Changed the client-id because another client seems to be using it.`),r.clientID=Yi()),r.emit(`afterTransactionCleanup`,[n,r]),r._observers.has(`update`)){let e=new na;to(e,n)&&r.emit(`update`,[e.toUint8Array(),n.origin,r,n])}if(r._observers.has(`updateV2`)){let e=new ia;to(e,n)&&r.emit(`updateV2`,[e.toUint8Array(),n.origin,r,n])}let{subdocsAdded:s,subdocsLoaded:c,subdocsRemoved:l}=n;(s.size>0||l.size>0||c.size>0)&&(s.forEach(e=>{e.clientID=r.clientID,e.collectionid??=r.collectionid,r.subdocs.add(e)}),l.forEach(e=>r.subdocs.delete(e)),r.emit(`subdocs`,[{loaded:c,added:s,removed:l},r,n]),l.forEach(e=>e.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit(`afterAllTransactions`,[r,e])):oo(e,t+1)}}},U=(e,t,n=null,r=!0)=>{let i=e._transactionCleanups,a=!1,o=null;e._transaction===null&&(a=!0,e._transaction=new eo(e,n,r),i.push(e._transaction),i.length===1&&e.emit(`beforeAllTransactions`,[e]),e.emit(`beforeTransaction`,[e._transaction,e]));try{o=t(e._transaction)}finally{if(a){let t=e._transaction===i[0];e._transaction=null,t&&oo(i,0)}}return o},so=class{constructor(e,t){this.insertions=t,this.deletions=e,this.meta=new Map}},co=(e,t,n)=>{Ri(e,n.deletions,n=>{n instanceof J&&t.scope.some(t=>t===e.doc||Aa(t,n))&&dc(n,!1)})},lo=(e,t,n)=>{let r=null,i=e.doc,a=e.scope;U(i,n=>{for(;t.length>0&&e.currStackItem===null;){let r=i.store,o=t.pop(),s=new Set,c=[],l=!1;Ri(n,o.insertions,e=>{if(e instanceof J){if(e.redone!==null){let{item:t,diff:i}=uc(r,e.id);i>0&&(t=H(n,z(t.id.client,t.id.clock+i))),e=t}!e.deleted&&a.some(t=>t===n.doc||Aa(t,e))&&c.push(e)}}),Ri(n,o.deletions,e=>{e instanceof J&&a.some(t=>t===n.doc||Aa(t,e))&&!Bi(o.insertions,e.id)&&s.add(e)}),s.forEach(t=>{l=mc(n,t,s,o.insertions,e.ignoreRemoteMapChanges,e)!==null||l});for(let t=c.length-1;t>=0;t--){let r=c[t];e.deleteFilter(r)&&(r.delete(n),l=!0)}e.currStackItem=l?o:null}n.changed.forEach((e,t)=>{e.has(null)&&t._searchMarker&&(t._searchMarker.length=0)}),r=n},e);let o=e.currStackItem;if(o!=null){let t=r.changedParentTypes;e.emit(`stack-item-popped`,[{stackItem:o,type:n,changedParentTypes:t,origin:e},e]),e.currStackItem=null}return o},uo=class extends Re{constructor(e,{captureTimeout:t=500,captureTransaction:n=e=>!0,deleteFilter:r=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:a=!1,doc:o=Le(e)?e[0].doc:e instanceof Xi?e:e.doc}={}){super(),this.scope=[],this.doc=o,this.addToScope(e),this.deleteFilter=r,i.add(this),this.trackedOrigins=i,this.captureTransaction=n,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=a,this.captureTimeout=t,this.afterTransactionHandler=e=>{if(!this.captureTransaction(e)||!this.scope.some(t=>e.changedParentTypes.has(t)||t===this.doc)||!this.trackedOrigins.has(e.origin)&&(!e.origin||!this.trackedOrigins.has(e.origin.constructor)))return;let t=this.undoing,n=this.redoing,r=t?this.redoStack:this.undoStack;t?this.stopCapturing():n||this.clear(!1,!0);let i=new Li;e.afterState.forEach((t,n)=>{let r=e.beforeState.get(n)||0,a=t-r;a>0&&Ui(i,n,r,a)});let a=ln(),o=!1;if(this.lastChange>0&&a-this.lastChange<this.captureTimeout&&r.length>0&&!t&&!n){let t=r[r.length-1];t.deletions=Hi([t.deletions,e.deleteSet]),t.insertions=Hi([t.insertions,i])}else r.push(new so(e.deleteSet,i)),o=!0;!t&&!n&&(this.lastChange=a),Ri(e,e.deleteSet,t=>{t instanceof J&&this.scope.some(n=>n===e.doc||Aa(n,t))&&dc(t,!0)});let s=[{stackItem:r[r.length-1],origin:e.origin,type:t?`redo`:`undo`,changedParentTypes:e.changedParentTypes},this];o?this.emit(`stack-item-added`,s):this.emit(`stack-item-updated`,s)},this.doc.on(`afterTransaction`,this.afterTransactionHandler),this.doc.on(`destroy`,()=>{this.destroy()})}addToScope(e){let t=new Set(this.scope);e=Le(e)?e:[e],e.forEach(e=>{t.has(e)||(t.add(e),(e instanceof G?e.doc!==this.doc:e!==this.doc)&&ji(`[yjs#509] Not same Y.Doc`),this.scope.push(e))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,t=!0){(e&&this.canUndo()||t&&this.canRedo())&&this.doc.transact(n=>{e&&(this.undoStack.forEach(e=>co(n,this,e)),this.undoStack=[]),t&&(this.redoStack.forEach(e=>co(n,this,e)),this.redoStack=[]),this.emit(`stack-cleared`,[{undoStackCleared:e,redoStackCleared:t}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=lo(this,this.undoStack,`undo`)}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=lo(this,this.redoStack,`redo`)}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off(`afterTransaction`,this.afterTransactionHandler),super.destroy()}};function*fo(e){let t=M(e.restDecoder);for(let n=0;n<t;n++){let t=M(e.restDecoder),n=e.readClient(),r=M(e.restDecoder);for(let i=0;i<t;i++){let t=e.readInfo();if(t===10){let t=M(e.restDecoder);yield new Y(z(n,r),t),r+=t}else if(31&t){let i=(t&192)==0,a=new J(z(n,r),null,(t&128)==128?e.readLeftID():null,null,(t&64)==64?e.readRightID():null,i?e.readParentInfo()?e.readString():e.readLeftID():null,i&&(t&32)==32?e.readString():null,hc(e,t));yield a,r+=a.length}else{let t=e.readLen();yield new K(z(n,r),t),r+=t}}}}var po=class{constructor(e,t){this.gen=fo(e),this.curr=null,this.done=!1,this.filterSkips=t,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===Y);return this.curr}},mo=class{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}},ho=e=>_o(e,Qi,na),go=(e,t)=>{if(e.constructor===K){let{client:n,clock:r}=e.id;return new K(z(n,r+t),e.length-t)}else if(e.constructor===Y){let{client:n,clock:r}=e.id;return new Y(z(n,r+t),e.length-t)}else{let n=e,{client:r,clock:i}=n.id;return new J(z(r,i+t),null,z(r,i+t-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(t))}},_o=(e,t=ea,n=ia)=>{if(e.length===1)return e[0];let r=e.map(e=>new t(Ut(e))),i=r.map(e=>new po(e,!0)),a=null,o=new n,s=new mo(o);for(;i=i.filter(e=>e.curr!==null),i.sort((e,t)=>{if(e.curr.id.client===t.curr.id.client){let n=e.curr.id.clock-t.curr.id.clock;return n===0?e.curr.constructor===t.curr.constructor?0:e.curr.constructor===Y?1:-1:n}else return t.curr.id.client-e.curr.id.client}),i.length!==0;){let e=i[0],t=e.curr.id.client;if(a!==null){let n=e.curr,r=!1;for(;n!==null&&n.id.clock+n.length<=a.struct.id.clock+a.struct.length&&n.id.client>=a.struct.id.client;)n=e.next(),r=!0;if(n===null||n.id.client!==t||r&&n.id.clock>a.struct.id.clock+a.struct.length)continue;if(t!==a.struct.id.client)bo(s,a.struct,a.offset),a={struct:n,offset:0},e.next();else if(a.struct.id.clock+a.struct.length<n.id.clock)if(a.struct.constructor===Y)a.struct.length=n.id.clock+n.length-a.struct.id.clock;else{bo(s,a.struct,a.offset);let e=n.id.clock-a.struct.id.clock-a.struct.length;a={struct:new Y(z(t,a.struct.id.clock+a.struct.length),e),offset:0}}else{let t=a.struct.id.clock+a.struct.length-n.id.clock;t>0&&(a.struct.constructor===Y?a.struct.length-=t:n=go(n,t)),a.struct.mergeWith(n)||(bo(s,a.struct,a.offset),a={struct:n,offset:0},e.next())}}else a={struct:e.curr,offset:0},e.next();for(let n=e.curr;n!==null&&n.id.client===t&&n.id.clock===a.struct.id.clock+a.struct.length&&n.constructor!==Y;n=e.next())bo(s,a.struct,a.offset),a={struct:n,offset:0}}return a!==null&&(bo(s,a.struct,a.offset),a=null),xo(s),Ki(o,Hi(r.map(e=>qi(e)))),o.toUint8Array()},vo=(e,t,n=ea,r=ia)=>{let i=_a(t),a=new r,o=new mo(a),s=new n(Ut(e)),c=new po(s,!1);for(;c.curr;){let e=c.curr,t=e.id.client,n=i.get(t)||0;if(c.curr.constructor===Y){c.next();continue}if(e.id.clock+e.length>n)for(bo(o,e,C(n-e.id.clock,0)),c.next();c.curr&&c.curr.id.client===t;)bo(o,c.curr,0),c.next();else for(;c.curr&&c.curr.id.client===t&&c.curr.id.clock+c.curr.length<=n;)c.next()}return xo(o),Ki(a,qi(s)),a.toUint8Array()},yo=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:w(e.encoder.restEncoder)}),e.encoder.restEncoder=_t(),e.written=0)},bo=(e,t,n)=>{e.written>0&&e.currClient!==t.id.client&&yo(e),e.written===0&&(e.currClient=t.id.client,e.encoder.writeClient(t.id.client),E(e.encoder.restEncoder,t.id.clock+n)),t.write(e.encoder,n),e.written++},xo=e=>{yo(e);let t=e.encoder.restEncoder;E(t,e.clientStructs.length);for(let n=0;n<e.clientStructs.length;n++){let r=e.clientStructs[n];E(t,r.written),Et(t,r.restEncoder)}},So=(e,t,n,r)=>{let i=new n(Ut(e)),a=new po(i,!1),o=new r,s=new mo(o);for(let e=a.curr;e!==null;e=a.next())bo(s,t(e),0);return xo(s),Ki(o,qi(i)),o.toUint8Array()},Co=e=>So(e,On,ea,na),wo=`You must not compute changes after the event-handler fired.`,To=class{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||=Eo(this.currentTarget,this.target)}deletes(e){return Bi(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw O(wo);let e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(n!==null){let r=t._map.get(n),i,a;if(this.adds(r)){let e=r.left;for(;e!==null&&this.adds(e);)e=e.left;if(this.deletes(r))if(e!==null&&this.deletes(e))i=`delete`,a=Me(e.content.getContent());else return;else e!==null&&this.deletes(e)?(i=`update`,a=Me(e.content.getContent())):(i=`add`,a=void 0)}else if(this.deletes(r))i=`delete`,a=Me(r.content.getContent());else return;e.set(n,{action:i,oldValue:a})}}),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 O(wo);let t=this.target,n=b(),r=b(),i=[];if(e={added:n,deleted:r,delta:i,keys:this.keys},this.transaction.changed.get(t).has(null)){let e=null,a=()=>{e&&i.push(e)};for(let i=t._start;i!==null;i=i.right)i.deleted?this.deletes(i)&&!this.adds(i)&&((e===null||e.delete===void 0)&&(a(),e={delete:0}),e.delete+=i.length,r.add(i)):this.adds(i)?((e===null||e.insert===void 0)&&(a(),e={insert:[]}),e.insert=e.insert.concat(i.content.getContent()),n.add(i)):((e===null||e.retain===void 0)&&(a(),e={retain:0}),e.retain+=i.length);e!==null&&e.retain===void 0&&a()}this._changes=e}return e}},Eo=(e,t)=>{let n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let e=0,r=t._item.parent._start;for(;r!==t._item&&r!==null;)!r.deleted&&r.countable&&(e+=r.length),r=r.right;n.unshift(e)}t=t._item.parent}return n},W=()=>{ji(`Invalid access: Add Yjs type to a document before reading data.`)},Do=80,Oo=0,ko=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=Oo++}},Ao=e=>{e.timestamp=Oo++},jo=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=Oo++},Mo=(e,t,n)=>{if(e.length>=Do){let r=e.reduce((e,t)=>e.timestamp<t.timestamp?e:t);return jo(r,t,n),r}else{let r=new ko(t,n);return e.push(r),r}},No=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;let n=e._searchMarker.length===0?null:e._searchMarker.reduce((e,n)=>Be(t-e.index)<Be(t-n.index)?e:n),r=e._start,i=0;for(n!==null&&(r=n.p,i=n.index,Ao(n));r.right!==null&&i<t;){if(!r.deleted&&r.countable){if(t<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>t;)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 n!==null&&Be(n.index-i)<r.parent.length/Do?(jo(n,r,i),n):Mo(e._searchMarker,r,i)},Po=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){let i=e[r];if(n>0){let t=i.p;for(t.marker=!1;t&&(t.deleted||!t.countable);)t=t.left,t&&!t.deleted&&t.countable&&(i.index-=t.length);if(t===null||t.marker===!0){e.splice(r,1);continue}i.p=t,t.marker=!0}(t<i.index||n>0&&t===i.index)&&(i.index=C(t,i.index+n))}},Fo=(e,t,n)=>{let r=e,i=t.changedParentTypes;for(;y(i,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;Ea(r._eH,n,t)},G=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Ca(),this._dEH=Ca(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw k()}clone(){throw k()}_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){wa(this._eH,e)}observeDeep(e){wa(this._dEH,e)}unobserve(e){Ta(this._eH,e)}unobserveDeep(e){Ta(this._dEH,e)}toJSON(){}},Io=(e,t,n)=>{e.doc??W(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t,i=[],a=e._start;for(;a!==null&&r>0;){if(a.countable&&!a.deleted){let e=a.content.getContent();if(e.length<=t)t-=e.length;else{for(let n=t;n<e.length&&r>0;n++)i.push(e[n]),r--;t=0}}a=a.right}return i},Lo=e=>{e.doc??W();let t=[],n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){let e=n.content.getContent();for(let n=0;n<e.length;n++)t.push(e[n])}n=n.right}return t},Ro=(e,t)=>{let n=[],r=e._start;for(;r!==null;){if(r.countable&&Wa(r,t)){let e=r.content.getContent();for(let t=0;t<e.length;t++)n.push(e[t])}r=r.right}return n},zo=(e,t)=>{let n=0,r=e._start;for(e.doc??W();r!==null;){if(r.countable&&!r.deleted){let i=r.content.getContent();for(let r=0;r<i.length;r++)t(i[r],n++,e)}r=r.right}},Bo=(e,t)=>{let n=[];return zo(e,(r,i)=>{n.push(t(r,i,e))}),n},Vo=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}let e=n[r++];return n.length<=r&&(n=null),{done:!1,value:e}}}},Ho=(e,t)=>{e.doc??W();let n=No(e,t),r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},Uo=(e,t,n,r)=>{let i=n,a=e.doc,o=a.clientID,s=a.store,c=n===null?t._start:n.right,l=[],u=()=>{l.length>0&&(i=new J(z(o,B(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new Xs(l)),i.integrate(e,0),l=[])};r.forEach(n=>{if(n===null)l.push(n);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(n);break;default:switch(u(),n.constructor){case Uint8Array:case ArrayBuffer:i=new J(z(o,B(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new Ls(new Uint8Array(n))),i.integrate(e,0);break;case Xi:i=new J(z(o,B(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new Hs(n)),i.integrate(e,0);break;default:if(n instanceof G)i=new J(z(o,B(s,o)),i,i&&i.lastId,c,c&&c.id,t,null,new cc(n)),i.integrate(e,0);else throw Error(`Unexpected content type in insert operation`)}}}),u()},Wo=()=>O(`Length exceeded!`),Go=(e,t,n,r)=>{if(n>t._length)throw Wo();if(n===0)return t._searchMarker&&Po(t._searchMarker,n,r.length),Uo(e,t,null,r);let i=n,a=No(t,n),o=t._start;for(a!==null&&(o=a.p,n-=a.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&H(e,z(o.id.client,o.id.clock+n));break}n-=o.length}return t._searchMarker&&Po(t._searchMarker,i,r.length),Uo(e,t,o,r)},Ko=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((e,t)=>t.index>e.index?t:e,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return Uo(e,t,r,n)},qo=(e,t,n,r)=>{if(r===0)return;let i=n,a=r,o=No(t,n),s=t._start;for(o!==null&&(s=o.p,n-=o.index);s!==null&&n>0;s=s.right)!s.deleted&&s.countable&&(n<s.length&&H(e,z(s.id.client,s.id.clock+n)),n-=s.length);for(;r>0&&s!==null;)s.deleted||(r<s.length&&H(e,z(s.id.client,s.id.clock+r)),s.delete(e),r-=s.length),s=s.right;if(r>0)throw Wo();t._searchMarker&&Po(t._searchMarker,i,-a+r)},Jo=(e,t,n)=>{let r=t._map.get(n);r!==void 0&&r.delete(e)},Yo=(e,t,n,r)=>{let i=t._map.get(n)||null,a=e.doc,o=a.clientID,s;if(r==null)s=new Xs([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:s=new Xs([r]);break;case Uint8Array:s=new Ls(r);break;case Xi:s=new Hs(r);break;default:if(r instanceof G)s=new cc(r);else throw Error(`Unexpected content type`)}new J(z(o,B(a.store,o)),i,i&&i.lastId,null,null,t,n,s).integrate(e,0)},Xo=(e,t)=>{e.doc??W();let n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},Zo=e=>{let t={};return e.doc??W(),e._map.forEach((e,n)=>{e.deleted||(t[n]=e.content.getContent()[e.length-1])}),t},Qo=(e,t)=>{e.doc??W();let n=e._map.get(t);return n!==void 0&&!n.deleted},$o=(e,t)=>{let n={};return e._map.forEach((e,r)=>{let i=e;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&Wa(i,t)&&(n[r]=i.content.getContent()[i.length-1])}),n},es=e=>(e.doc??W(),Pi(e._map.entries(),e=>!e[1].deleted)),ts=class extends To{},ns=class e extends G{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){let n=new e;return n.push(t),n}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof G?e.clone():e)),t}get length(){return this.doc??W(),this._length}_callObserver(e,t){super._callObserver(e,t),Fo(this,e,new ts(this,e))}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):U(this.doc,n=>{Go(n,this,e,t)})}push(e){this.doc===null?this._prelimContent.push(...e):U(this.doc,t=>{Ko(t,this,e)})}unshift(e){this.insert(0,e)}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):U(this.doc,n=>{qo(n,this,e,t)})}get(e){return Ho(this,e)}toArray(){return Lo(this)}slice(e=0,t=this.length){return Io(this,e,t)}toJSON(){return this.map(e=>e instanceof G?e.toJSON():e)}map(e){return Bo(this,e)}forEach(e){zo(this,e)}[Symbol.iterator](){return Vo(this)}_write(e){e.writeTypeRef(tc)}},rs=e=>new ns,is=class extends To{constructor(e,t,n){super(e,t),this.keysChanged=n}},as=class e extends G{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((e,t)=>{this.set(t,e)}),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return this.forEach((e,n)=>{t.set(n,e instanceof G?e.clone():e)}),t}_callObserver(e,t){Fo(this,e,new is(this,e,t))}toJSON(){this.doc??W();let e={};return this._map.forEach((t,n)=>{if(!t.deleted){let r=t.content.getContent()[t.length-1];e[n]=r instanceof G?r.toJSON():r}}),e}get size(){return[...es(this)].length}keys(){return Fi(es(this),e=>e[0])}values(){return Fi(es(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Fi(es(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??W(),this._map.forEach((t,n)=>{t.deleted||e(t.content.getContent()[t.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc===null?this._prelimContent.delete(e):U(this.doc,t=>{Jo(t,this,e)})}set(e,t){return this.doc===null?this._prelimContent.set(e,t):U(this.doc,n=>{Yo(n,this,e,t)}),t}get(e){return Xo(this,e)}has(e){return Qo(this,e)}clear(){this.doc===null?this._prelimContent.clear():U(this.doc,e=>{this.forEach(function(t,n,r){Jo(e,r,n)})})}_write(e){e.writeTypeRef(nc)}},os=e=>new as,ss=(e,t)=>e===t||typeof e==`object`&&typeof t==`object`&&e&&t&&wn(e,t),cs=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){switch(this.right===null&&A(),this.right.content.constructor){case q:this.right.deleted||fs(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}},ls=(e,t,n)=>{for(;t.right!==null&&n>0;){switch(t.right.content.constructor){case q:t.right.deleted||fs(t.currentAttributes,t.right.content);break;default:t.right.deleted||(n<t.right.length&&H(e,z(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length);break}t.left=t.right,t.right=t.right.right}return t},us=(e,t,n,r)=>{let i=new Map,a=r?No(t,n):null;return a?ls(e,new cs(a.p.left,a.p,a.index,i),n-a.index):ls(e,new cs(null,t._start,0,i),n)},ds=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===q&&ss(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();let i=e.doc,a=i.clientID;r.forEach((r,o)=>{let s=n.left,c=n.right,l=new J(z(a,B(i.store,a)),s,s&&s.lastId,c,c&&c.id,t,null,new q(o,r));l.integrate(e,0),n.right=l,n.forward()})},fs=(e,t)=>{let{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},ps=(e,t)=>{for(;e.right!==null&&(e.right.deleted||e.right.content.constructor===q&&ss(t[e.right.content.key]??null,e.right.content.value));)e.forward()},ms=(e,t,n,r)=>{let i=e.doc,a=i.clientID,o=new Map;for(let s in r){let c=r[s],l=n.currentAttributes.get(s)??null;if(!ss(l,c)){o.set(s,l);let{left:r,right:u}=n;n.right=new J(z(a,B(i.store,a)),r,r&&r.lastId,u,u&&u.id,t,null,new q(s,c)),n.right.integrate(e,0),n.forward()}}return o},hs=(e,t,n,r,i)=>{n.currentAttributes.forEach((e,t)=>{i[t]===void 0&&(i[t]=null)});let a=e.doc,o=a.clientID;ps(n,i);let s=ms(e,t,n,i),c=r.constructor===String?new Qs(r):r instanceof G?new cc(r):new Ws(r),{left:l,right:u,index:d}=n;t._searchMarker&&Po(t._searchMarker,n.index,c.getLength()),u=new J(z(o,B(a.store,o)),l,l&&l.lastId,u,u&&u.id,t,null,c),u.integrate(e,0),n.right=u,n.index=d,n.forward(),ds(e,t,n,s)},gs=(e,t,n,r,i)=>{let a=e.doc,o=a.clientID;ps(n,i);let s=ms(e,t,n,i);iterationLoop:for(;n.right!==null&&(r>0||s.size>0&&(n.right.deleted||n.right.content.constructor===q));){if(!n.right.deleted)switch(n.right.content.constructor){case q:{let{key:t,value:a}=n.right.content,o=i[t];if(o!==void 0){if(ss(o,a))s.delete(t);else{if(r===0)break iterationLoop;s.set(t,a)}n.right.delete(e)}else n.currentAttributes.set(t,a);break}default:r<n.right.length&&H(e,z(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let i=``;for(;r>0;r--)i+=`
|
|
4
|
-
`;n.right=new J(z(o,B(a.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new Qs(i)),n.right.integrate(e,0),n.forward()}ds(e,t,n,s)},_s=(e,t,n,r,i)=>{let a=t,o=v();for(;a&&(!a.countable||a.deleted);){if(!a.deleted&&a.content.constructor===q){let e=a.content;o.set(e.key,e)}a=a.right}let s=0,c=!1;for(;t!==a;){if(n===t&&(c=!0),!t.deleted){let n=t.content;switch(n.constructor){case q:{let{key:a,value:l}=n,u=r.get(a)??null;(o.get(a)!==n||u===l)&&(t.delete(e),s++,!c&&(i.get(a)??null)===l&&u!==l&&(u===null?i.delete(a):i.set(a,u))),!c&&!t.deleted&&fs(i,n);break}}}t=t.right}return s},vs=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;let n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===q){let r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},ys=e=>{let t=0;return U(e.doc,n=>{let r=e._start,i=e._start,a=v(),o=ke(a);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case q:fs(o,i.content);break;default:t+=_s(n,r,i,a,o),a=ke(o),r=i;break}i=i.right}}),t},bs=e=>{let t=new Set,n=e.doc;for(let[r,i]of e.afterState.entries()){let a=e.beforeState.get(r)||0;i!==a&&$a(e,n.store.clients.get(r),a,i,e=>{!e.deleted&&e.content.constructor===q&&e.constructor!==K&&t.add(e.parent)})}U(n,n=>{Ri(e,e.deleteSet,e=>{if(e instanceof K||!e.parent._hasFormatting||t.has(e.parent))return;let r=e.parent;e.content.constructor===q?t.add(r):vs(n,e)});for(let e of t)ys(e)})},xs=(e,t,n)=>{let r=n,i=ke(t.currentAttributes),a=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case cc:case Ws:case Qs:n<t.right.length&&H(e,z(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}a&&_s(e,a,t.right,i,t.currentAttributes);let o=(t.left||t.right).parent;return o._searchMarker&&Po(o._searchMarker,t.index,-r+n),t},Ss=class extends To{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(e=>{e===null?this.childListChanged=!0:this.keysChanged.add(e)})}get changes(){return this._changes===null&&(this._changes={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set}),this._changes}get delta(){if(this._delta===null){let e=this.target.doc,t=[];U(e,e=>{let n=new Map,r=new Map,i=this.target._start,a=null,o={},s=``,c=0,l=0,u=()=>{if(a!==null){let e=null;switch(a){case`delete`:l>0&&(e={delete:l}),l=0;break;case`insert`:(typeof s==`object`||s.length>0)&&(e={insert:s},n.size>0&&(e.attributes={},n.forEach((t,n)=>{t!==null&&(e.attributes[n]=t)}))),s=``;break;case`retain`:c>0&&(e={retain:c},xn(o)||(e.attributes=_n({},o))),c=0;break}e&&t.push(e),a=null}};for(;i!==null;){switch(i.content.constructor){case cc:case Ws:this.adds(i)?this.deletes(i)||(u(),a=`insert`,s=i.content.getContent()[0],u()):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=1):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=1);break;case Qs:this.adds(i)?this.deletes(i)||(a!==`insert`&&(u(),a=`insert`),s+=i.content.str):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=i.length):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=i.length);break;case q:{let{key:t,value:s}=i.content;if(this.adds(i))this.deletes(i)||(ss(n.get(t)??null,s)?s!==null&&i.delete(e):(a===`retain`&&u(),ss(s,r.get(t)??null)?delete o[t]:o[t]=s));else if(this.deletes(i)){r.set(t,s);let e=n.get(t)??null;ss(e,s)||(a===`retain`&&u(),o[t]=e)}else if(!i.deleted){r.set(t,s);let n=o[t];n!==void 0&&(ss(n,s)?n!==null&&i.delete(e):(a===`retain`&&u(),s===null?delete o[t]:o[t]=s))}i.deleted||(a===`insert`&&u(),fs(n,i.content));break}}i=i.right}for(u();t.length>0;){let e=t[t.length-1];if(e.retain!==void 0&&e.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},Cs=class e extends G{constructor(e){super(),this._pending=e===void 0?[]:[()=>this.insert(0,e)],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??W(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(e=>e())}catch(e){console.error(e)}this._pending=null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}_callObserver(e,t){super._callObserver(e,t);let n=new Ss(this,e,t);Fo(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??W();let e=``,t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===Qs&&(e+=t.content.str),t=t.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc===null?this._pending.push(()=>this.applyDelta(e)):U(this.doc,n=>{let r=new cs(null,this._start,0,new Map);for(let i=0;i<e.length;i++){let a=e[i];if(a.insert!==void 0){let o=!t&&typeof a.insert==`string`&&i===e.length-1&&r.right===null&&a.insert.slice(-1)===`
|
|
5
|
-
`?a.insert.slice(0,-1):a.insert;(typeof o!=`string`||o.length>0)&&hs(n,this,r,o,a.attributes||{})}else a.retain===void 0?a.delete!==void 0&&xs(n,r,a.delete):gs(n,this,r,a.retain,a.attributes||{})}})}toDelta(e,t,n){this.doc??W();let r=[],i=new Map,a=this.doc,o=``,s=this._start;function c(){if(o.length>0){let e={},t=!1;i.forEach((n,r)=>{t=!0,e[r]=n});let n={insert:o};t&&(n.attributes=e),r.push(n),o=``}}let l=()=>{for(;s!==null;){if(Wa(s,e)||t!==void 0&&Wa(s,t))switch(s.content.constructor){case Qs:{let r=i.get(`ychange`);e!==void 0&&!Wa(s,e)?(r===void 0||r.user!==s.id.client||r.type!==`removed`)&&(c(),i.set(`ychange`,n?n(`removed`,s.id):{type:`removed`})):t!==void 0&&!Wa(s,t)?(r===void 0||r.user!==s.id.client||r.type!==`added`)&&(c(),i.set(`ychange`,n?n(`added`,s.id):{type:`added`})):r!==void 0&&(c(),i.delete(`ychange`)),o+=s.content.str;break}case cc:case Ws:{c();let e={insert:s.content.getContent()[0]};if(i.size>0){let t={};e.attributes=t,i.forEach((e,n)=>{t[n]=e})}r.push(e);break}case q:Wa(s,e)&&(c(),fs(i,s.content));break}s=s.right}c()};return e||t?U(a,n=>{e&&Ga(n,e),t&&Ga(n,t),l()},`cleanup`):l(),r}insert(e,t,n){if(t.length<=0)return;let r=this.doc;r===null?this._pending.push(()=>this.insert(e,t,n)):U(r,r=>{let i=us(r,this,e,!n);n||(n={},i.currentAttributes.forEach((e,t)=>{n[t]=e})),hs(r,this,i,t,n)})}insertEmbed(e,t,n){let r=this.doc;r===null?this._pending.push(()=>this.insertEmbed(e,t,n||{})):U(r,r=>{let i=us(r,this,e,!n);hs(r,this,i,t,n||{})})}delete(e,t){if(t===0)return;let n=this.doc;n===null?this._pending.push(()=>this.delete(e,t)):U(n,n=>{xs(n,us(n,this,e,!0),t)})}format(e,t,n){if(t===0)return;let r=this.doc;r===null?this._pending.push(()=>this.format(e,t,n)):U(r,r=>{let i=us(r,this,e,!1);i.right!==null&&gs(r,this,i,t,n)})}removeAttribute(e){this.doc===null?this._pending.push(()=>this.removeAttribute(e)):U(this.doc,t=>{Jo(t,this,e)})}setAttribute(e,t){this.doc===null?this._pending.push(()=>this.setAttribute(e,t)):U(this.doc,n=>{Yo(n,this,e,t)})}getAttribute(e){return Xo(this,e)}getAttributes(){return Zo(this)}_write(e){e.writeTypeRef(rc)}},ws=e=>new Cs,Ts=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??W()}[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===Os||t.constructor===Es)&&t._start!==null)e=t._start;else for(;e!==null;){let t=e.next;if(t!==null){e=t;break}else e=e.parent===this._root?null: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})}},Es=class e extends G{constructor(){super(),this._prelimContent=[]}get firstChild(){let 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 e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof G?e.clone():e)),t}get length(){return this.doc??W(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new Ts(this,e)}querySelector(e){e=e.toUpperCase();let t=new Ts(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e).next();return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),x(new Ts(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e))}_callObserver(e,t){Fo(this,e,new As(this,t,e))}toString(){return Bo(this,e=>e.toString()).join(``)}toJSON(){return this.toString()}toDOM(e=document,t={},n){let r=e.createDocumentFragment();return n!==void 0&&n._createAssociation(r,this),zo(this,i=>{r.insertBefore(i.toDOM(e,t,n),null)}),r}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):U(this.doc,n=>{Go(n,this,e,t)})}insertAfter(e,t){if(this.doc!==null)U(this.doc,n=>{let r=e&&e instanceof G?e._item:e;Uo(n,this,r,t)});else{let n=this._prelimContent,r=e===null?0:n.findIndex(t=>t===e)+1;if(r===0&&e!==null)throw O(`Reference item not found`);n.splice(r,0,...t)}}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):U(this.doc,n=>{qo(n,this,e,t)})}toArray(){return Lo(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Ho(this,e)}slice(e=0,t=this.length){return Io(this,e,t)}forEach(e){zo(this,e)}_write(e){e.writeTypeRef(ac)}},Ds=e=>new Es,Os=class e extends Es{constructor(e=`UNDEFINED`){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((e,t)=>{this.setAttribute(t,e)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName);return yn(this.getAttributes(),(e,n)=>{t.setAttribute(n,e)}),t.insert(0,this.toArray().map(e=>e instanceof G?e.clone():e)),t}toString(){let e=this.getAttributes(),t=[],n=[];for(let t in e)n.push(t);n.sort();let r=n.length;for(let i=0;i<r;i++){let r=n[i];t.push(r+`="`+e[r]+`"`)}let i=this.nodeName.toLocaleLowerCase();return`<${i}${t.length>0?` `+t.join(` `):``}>${super.toString()}</${i}>`}removeAttribute(e){this.doc===null?this._prelimAttrs.delete(e):U(this.doc,t=>{Jo(t,this,e)})}setAttribute(e,t){this.doc===null?this._prelimAttrs.set(e,t):U(this.doc,n=>{Yo(n,this,e,t)})}getAttribute(e){return Xo(this,e)}hasAttribute(e){return Qo(this,e)}getAttributes(e){return e?$o(this,e):Zo(this)}toDOM(e=document,t={},n){let r=e.createElement(this.nodeName),i=this.getAttributes();for(let e in i){let t=i[e];typeof t==`string`&&r.setAttribute(e,t)}return zo(this,i=>{r.appendChild(i.toDOM(e,t,n))}),n!==void 0&&n._createAssociation(r,this),r}_write(e){e.writeTypeRef(ic),e.writeKey(this.nodeName)}},ks=e=>new Os(e.readKey()),As=class extends To{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(e=>{e===null?this.childListChanged=!0:this.attributesChanged.add(e)})}},js=class e extends as{constructor(e){super(),this.hookName=e}_copy(){return new e(this.hookName)}clone(){let t=new e(this.hookName);return this.forEach((e,n)=>{t.set(n,e)}),t}toDOM(e=document,t={},n){let r=t[this.hookName],i;return i=r===void 0?document.createElement(this.hookName):r.createDom(this),i.setAttribute(`data-yjs-hook`,this.hookName),n!==void 0&&n._createAssociation(i,this),i}_write(e){e.writeTypeRef(oc),e.writeKey(this.hookName)}},Ms=e=>new js(e.readKey()),Ns=class e extends Cs{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}toDOM(e=document,t,n){let r=e.createTextNode(this.toString());return n!==void 0&&n._createAssociation(r,this),r}toString(){return this.toDelta().map(e=>{let t=[];for(let n in e.attributes){let r=[];for(let t in e.attributes[n])r.push({key:t,value:e.attributes[n][t]});r.sort((e,t)=>e.key<t.key?-1:1),t.push({nodeName:n,attrs:r})}t.sort((e,t)=>e.nodeName<t.nodeName?-1:1);let n=``;for(let e=0;e<t.length;e++){let r=t[e];n+=`<${r.nodeName}`;for(let e=0;e<r.attrs.length;e++){let t=r.attrs[e];n+=` ${t.key}="${t.value}"`}n+=`>`}n+=e.insert;for(let e=t.length-1;e>=0;e--)n+=`</${t[e].nodeName}>`;return n}).join(``)}toJSON(){return this.toString()}_write(e){e.writeTypeRef(sc)}},Ps=e=>new Ns,Fs=class{constructor(e,t){this.id=e,this.length=t}get deleted(){throw k()}mergeWith(e){return!1}write(e,t,n){throw k()}integrate(e,t){throw k()}},Is=0,K=class extends Fs{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor?(this.length+=e.length,!0):!1}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),Ja(e.doc.store,this)}write(e,t){e.writeInfo(Is),e.writeLen(this.length-t)}getMissing(e,t){return null}},Ls=class e{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new e(this.content)}splice(e){throw k()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeBuf(this.content)}getRef(){return 3}},Rs=e=>new Ls(e.readBuf()),zs=class e{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.len)}splice(t){let n=new e(this.len-t);return this.len=t,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,t){Ui(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}},Bs=e=>new zs(e.readLen()),Vs=(e,t)=>new Xi({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),Hs=class e{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;let 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 e(Vs(this.doc.guid,this.opts))}splice(e){throw k()}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}},Us=e=>new Hs(Vs(e.readString(),e.readAny())),Ws=class e{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new e(this.embed)}splice(e){throw k()}mergeWith(e){return!1}integrate(e,t){}delete(e){}gc(e){}write(e,t){e.writeJSON(this.embed)}getRef(){return 5}},Gs=e=>new Ws(e.readJSON()),q=class e{constructor(e,t){this.key=e,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new e(this.key,this.value)}splice(e){throw k()}mergeWith(e){return!1}integrate(e,t){let n=t.parent;n._searchMarker=null,n._hasFormatting=!0}delete(e){}gc(e){}write(e,t){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}},Ks=e=>new q(e.readKey(),e.readJSON()),qs=class e{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeString(t===void 0?`undefined`:JSON.stringify(t))}}getRef(){return 2}},Js=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++){let t=e.readString();t===`undefined`?n.push(void 0):n.push(JSON.parse(t))}return new qs(n)},Ys=In(`node_env`)===`development`,Xs=class e{constructor(e){this.arr=e,Ys&&En(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new e(this.arr)}splice(t){let n=new e(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,t){}delete(e){}gc(e){}write(e,t){let n=this.arr.length;e.writeLen(n-t);for(let r=t;r<n;r++){let t=this.arr[r];e.writeAny(t)}}getRef(){return 8}},Zs=e=>{let t=e.readLen(),n=[];for(let r=0;r<t;r++)n.push(e.readAny());return new Xs(n)},Qs=class e{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split(``)}isCountable(){return!0}copy(){return new e(this.str)}splice(t){let n=new e(this.str.slice(t));this.str=this.str.slice(0,t);let r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+`�`,n.str=`�`+n.str.slice(1)),n}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}},$s=e=>new Qs(e.readString()),ec=[rs,os,ws,ks,Ds,Ms,Ps],tc=0,nc=1,rc=2,ic=3,ac=4,oc=5,sc=6,cc=class e{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new e(this.type._copy())}splice(e){throw k()}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(t=>{t.deleted?t.id.clock<(e.beforeState.get(t.id.client)||0)&&e._mergeStructs.push(t):t.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(t=>{for(;t!==null;)t.gc(e,!0),t=t.left}),this.type._map=new Map}write(e,t){this.type._write(e)}getRef(){return 7}},lc=e=>new cc(ec[e.readTypeRef()](e)),uc=(e,t)=>{let n=t,r=0,i;do r>0&&(n=z(n.client,n.clock+r)),i=Ya(e,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof J);return{item:i,diff:r}},dc=(e,t)=>{for(;e!==null&&e.keep!==t;)e.keep=t,e=e.parent._item},fc=(e,t,n)=>{let{client:r,clock:i}=t.id,a=new J(z(r,i+n),t,z(r,i+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&a.markDeleted(),t.keep&&(a.keep=!0),t.redone!==null&&(a.redone=z(t.redone.client,t.redone.clock+n)),t.right=a,a.right!==null&&(a.right.left=a),e._mergeStructs.push(a),a.parentSub!==null&&a.right===null&&a.parent._map.set(a.parentSub,a),t.length=n,a},pc=(e,t)=>Fe(e,e=>Bi(e.deletions,t)),mc=(e,t,n,r,i,a)=>{let o=e.doc,s=o.store,c=o.clientID,l=t.redone;if(l!==null)return H(e,l);let u=t.parent._item,d=null,f;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||mc(e,u,n,r,i,a)===null))return null;for(;u.redone!==null;)u=H(e,u.redone)}let p=u===null?t.parent:u.content.type;if(t.parentSub===null){for(d=t.left,f=t;d!==null;){let t=d;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:H(e,t.redone);if(t!==null&&t.parent._item===u){d=t;break}d=d.left}for(;f!==null;){let t=f;for(;t!==null&&t.parent._item!==u;)t=t.redone===null?null:H(e,t.redone);if(t!==null&&t.parent._item===u){f=t;break}f=f.right}}else{if(f=null,t.right&&!i){for(d=t;d!==null&&d.right!==null&&(d.right.redone||Bi(r,d.right.id)||pc(a.undoStack,d.right.id)||pc(a.redoStack,d.right.id));)for(d=d.right;d.redone;)d=H(e,d.redone);if(d&&d.right!==null)return null}else d=p._map.get(t.parentSub)||null;d!==null&&d.parent._item!==u&&(d=p._map.get(t.parentSub)||null)}let m=z(c,B(s,c)),ee=new J(m,d,d&&d.lastId,f,f&&f.id,p,t.parentSub,t.content.copy());return t.redone=m,dc(ee,!0),ee.integrate(e,0),ee},J=class e extends Fs{constructor(e,t,n,r,i,a,o,s){super(e,s.getLength()),this.origin=n,this.left=t,this.right=r,this.rightOrigin=i,this.parent=a,this.parentSub=o,this.redone=null,this.content=s,this.info=this.content.isCountable()?2:0}set marker(e){(this.info&8)>0!==e&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(e){this.keep!==e&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(e){this.deleted!==e&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=B(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=B(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Da&&this.id.client!==this.parent.client&&this.parent.clock>=B(n,this.parent.client))return this.parent.client;if(this.origin&&=(this.left=Za(t,n,this.origin),this.left.lastId),this.rightOrigin&&=(this.right=H(t,this.rightOrigin),this.right.id),this.left&&this.left.constructor===K||this.right&&this.right.constructor===K)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===e?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===e&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Da){let e=Ya(n,this.parent);e.constructor===K?this.parent=null:this.parent=e.content.type}return null}integrate(e,t){if(t>0&&(this.id.clock+=t,this.left=Za(e,e.doc.store,z(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 t=this.left,n;if(t!==null)n=t.right;else if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start;let r=new Set,i=new Set;for(;n!==null&&n!==this.right;){if(i.add(n),r.add(n),Oa(this.origin,n.origin)){if(n.id.client<this.id.client)t=n,r.clear();else if(Oa(this.rightOrigin,n.rightOrigin))break}else if(n.origin!==null&&i.has(Ya(e.doc.store,n.origin)))r.has(Ya(e.doc.store,n.origin))||(t=n,r.clear());else break;n=n.right}this.left=t}if(this.left!==null)this.right=this.left.right,this.left.right=this;else{let e;if(this.parentSub!==null)for(e=this.parent._map.get(this.parentSub)||null;e!==null&&e.left!==null;)e=e.left;else e=this.parent._start,this.parent._start=this;this.right=e}this.right===null?this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)):this.right.left=this,this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),Ja(e.doc.store,this),this.content.integrate(e,this),no(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new K(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:z(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Oa(e.origin,this.lastId)&&this.right===e&&Oa(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)){let t=this.parent._searchMarker;return t&&t.forEach(t=>{t.p===e&&(t.p=this,!this.deleted&&this.countable&&(t.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){let t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),Ui(e.deleteSet,this.id.client,this.id.clock,this.length),no(e,t,this.parentSub),this.content.delete(e)}}gc(e,t){if(!this.deleted)throw A();this.content.gc(e),t?Qa(e,this,new K(this.id,this.length)):this.content=new zs(this.length)}write(e,t){let n=t>0?z(this.id.client,this.id.clock+t-1):this.origin,r=this.rightOrigin,i=this.parentSub,a=this.content.getRef()&31|(n===null?0:128)|(r===null?0:64)|(i===null?0:32);if(e.writeInfo(a),n!==null&&e.writeLeftID(n),r!==null&&e.writeRightID(r),n===null&&r===null){let t=this.parent;if(t._item!==void 0){let n=t._item;if(n===null){let n=ka(t);e.writeParentInfo(!0),e.writeString(n)}else e.writeParentInfo(!1),e.writeLeftID(n.id)}else t.constructor===String?(e.writeParentInfo(!0),e.writeString(t)):t.constructor===Da?(e.writeParentInfo(!1),e.writeLeftID(t)):A();i!==null&&e.writeString(i)}this.content.write(e,t)}},hc=(e,t)=>gc[t&31](e),gc=[()=>{A()},Bs,Js,Rs,$s,Gs,Ks,lc,Zs,Us,()=>{A()}],_c=10,Y=class extends Fs{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor===e.constructor?(this.length+=e.length,!0):!1}integrate(e,t){A()}write(e,t){e.writeInfo(_c),E(e.restEncoder,this.length-t)}getMissing(e,t){return null}},vc=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:{},yc=`__ $YJS$ __`;vc[yc]===!0&&console.error(`Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438`),vc[yc]=!0;var bc=function(e){return e[e.Token=0]=`Token`,e[e.PermissionDenied=1]=`PermissionDenied`,e[e.Authenticated=2]=`Authenticated`,e}({}),xc=(e,t)=>{E(e,bc.Token),Tt(e,t)},Sc=(e,t,n,r)=>{switch(M(e)){case bc.Token:t();break;case bc.PermissionDenied:n(Jt(e));break;case bc.Authenticated:r(Jt(e));break;default:}},Cc=e=>Array.from(e.entries()).map(([e,t])=>({clientId:e,...t})),wc=`\0`;function Tc(e,t){return e+wc+t}function Ec(e){let t=e.indexOf(wc);return t===-1?{documentName:e,sessionId:null}:{documentName:e.substring(0,t),sessionId:e.substring(t+1)}}var Dc=function(e){return e[e.Connecting=0]=`Connecting`,e[e.Open=1]=`Open`,e[e.Closing=2]=`Closing`,e[e.Closed=3]=`Closed`,e}({});function Oc(e){return e||={},{delay:e.delay===void 0?200:e.delay,initialDelay:e.initialDelay===void 0?0:e.initialDelay,minDelay:e.minDelay===void 0?0:e.minDelay,maxDelay:e.maxDelay===void 0?0:e.maxDelay,factor:e.factor===void 0?0:e.factor,maxAttempts:e.maxAttempts===void 0?3:e.maxAttempts,timeout:e.timeout===void 0?0:e.timeout,jitter:e.jitter===!0,initialJitter:e.initialJitter===!0,handleError:e.handleError===void 0?null:e.handleError,handleTimeout:e.handleTimeout===void 0?null:e.handleTimeout,beforeAttempt:e.beforeAttempt===void 0?null:e.beforeAttempt,calculateDelay:e.calculateDelay===void 0?null:e.calculateDelay}}async function kc(e){return new Promise(t=>setTimeout(t,e))}function Ac(e,t){let n=t.delay;if(n===0)return 0;if(t.factor&&(n*=t.factor**(e.attemptNum-1),t.maxDelay!==0&&(n=Math.min(n,t.maxDelay))),t.jitter){let e=Math.ceil(t.minDelay);n=Math.floor(Math.random()*(Math.floor(n)-e+1))+e}return Math.round(n)}async function jc(e,t){let n=Oc(t);for(let e of[`delay`,`initialDelay`,`minDelay`,`maxDelay`,`maxAttempts`,`timeout`]){let t=n[e];if(!Number.isInteger(t)||t<0)throw Error(`Value for ${e} must be an integer greater than or equal to 0`)}if(n.factor.constructor!==Number||n.factor<0)throw Error(`Value for factor must be a number greater than or equal to 0`);if(n.delay<n.minDelay)throw Error(`delay cannot be less than minDelay (delay: ${n.delay}, minDelay: ${n.minDelay}`);let r={attemptNum:0,attemptsRemaining:n.maxAttempts?n.maxAttempts:-1,aborted:!1,abort(){r.aborted=!0}},i=n.calculateDelay||Ac;async function a(){if(n.beforeAttempt&&n.beforeAttempt(r,n),r.aborted){let e=Error(`Attempt aborted`);throw e.code=`ATTEMPT_ABORTED`,e}let t=async e=>{if(n.handleError&&await n.handleError(e,r,n),r.aborted||r.attemptsRemaining===0)throw e;r.attemptNum++;let t=i(r,n);return t&&await kc(t),a()};return r.attemptsRemaining>0&&r.attemptsRemaining--,n.timeout?new Promise((i,a)=>{let o=setTimeout(()=>{if(n.handleTimeout)try{i(n.handleTimeout(r,n))}catch(e){a(e)}else{let e=Error(`Retry timeout (attemptNum: ${r.attemptNum}, timeout: ${n.timeout})`);e.code=`ATTEMPT_TIMEOUT`,a(e)}},n.timeout);e(r,n).then(e=>{clearTimeout(o),i(e)}).catch(e=>{clearTimeout(o),t(e).then(i).catch(a)})}):e(r,n).catch(t)}let o=n.calculateDelay?n.calculateDelay(r,n):n.initialDelay;if(o&&await kc(o),r.attemptNum<1&&n.initialJitter){let e=i(r,n);e&&await kc(e)}return a()}var Mc=Math.floor,Nc=(e,t)=>e<t?e:t,Pc=(e,t)=>e>t?e:t;Number.isNaN;var Fc=64,Ic=128,Lc=1<<17,Rc=1<<18,zc=1<<19,Bc=1<<20,Vc=1<<21,Hc=1<<22,Uc=1<<23,Wc=1<<24,Gc=1<<25,Kc=1<<26,qc=1<<27,Jc=1<<28,Yc=1<<29,Xc=1<<30,Zc=63,Qc=127;Lc-1,Rc-1,zc-1,Bc-1,Vc-1,Hc-1,Uc-1,Wc-1,Gc-1,Kc-1,qc-1,Jc-1,Yc-1,Xc-1;var $c=2**53-1;Number.isInteger,Number.isNaN,Number.parseInt;var el=()=>new Set,tl=Array.from;Array.isArray;var nl=String.fromCharCode;String.fromCodePoint,nl(65535);var rl=e=>{let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.codePointAt(e);return r},il=typeof TextEncoder<`u`?new TextEncoder:null,al=il?e=>il.encode(e):rl,ol=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});ol&&ol.decode(new Uint8Array).length===1&&(ol=null);var sl=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},cl=()=>new sl,ll=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},ul=e=>{let t=new Uint8Array(ll(e)),n=0;for(let r=0;r<e.bufs.length;r++){let i=e.bufs[r];t.set(i,n),n+=i.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},dl=(e,t)=>{let n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},X=(e,t)=>{for(;t>Qc;)dl(e,Ic|Qc&t),t=Mc(t/128);dl(e,Qc&t)},fl=new Uint8Array(3e4),pl=fl.length/3,Z=il&&il.encodeInto?(e,t)=>{if(t.length<pl){let n=il.encodeInto(t,fl).written||0;X(e,n);for(let t=0;t<n;t++)dl(e,fl[t])}else hl(e,al(t))}:(e,t)=>{let n=unescape(encodeURIComponent(t)),r=n.length;X(e,r);for(let t=0;t<r;t++)dl(e,n.codePointAt(t))},ml=(e,t)=>{let n=e.cbuf.length,r=e.cpos,i=Nc(n-r,t.length),a=t.length-i;e.cbuf.set(t.subarray(0,i),r),e.cpos+=i,a>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Pc(n*2,a)),e.cbuf.set(t.subarray(i)),e.cpos=a)},hl=(e,t)=>{X(e,t.byteLength),ml(e,t)},gl=e=>Error(e),_l=gl(`Unexpected end of array`),vl=gl(`Integer out of Range`),yl=class{constructor(e){this.arr=e,this.pos=0}},bl=e=>new yl(e),xl=(e,t)=>{let n=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,t);return e.pos+=t,n},Sl=e=>xl(e,wl(e)),Cl=e=>e.arr[e.pos++],wl=e=>{let t=0,n=1,r=e.arr.length;for(;e.pos<r;){let r=e.arr[e.pos++];if(t+=(r&Qc)*n,n*=128,r<Ic)return t;if(t>$c)throw vl}throw _l},Tl=e=>{let t=e.arr[e.pos++],n=t&Zc,r=64,i=(t&Fc)>0?-1:1;if((t&Ic)===0)return i*n;let a=e.arr.length;for(;e.pos<a;){if(t=e.arr[e.pos++],n+=(t&Qc)*r,r*=128,t<Ic)return i*n;if(n>$c)throw vl}throw _l},El=ol?e=>ol.decode(Sl(e)):e=>{let t=wl(e);if(t===0)return``;{let n=String.fromCodePoint(Cl(e));if(--t<100)for(;t--;)n+=String.fromCodePoint(Cl(e));else for(;t>0;){let r=t<1e4?t:1e4,i=e.arr.subarray(e.pos,e.pos+r);e.pos+=r,n+=String.fromCodePoint.apply(null,i),t-=r}return decodeURIComponent(escape(n))}},Dl=e=>{let t=e.pos,n=El(e);return e.pos=t,n},Ol=Date.now,kl=()=>new Map,Al=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},jl=class{constructor(){this._observers=kl()}on(e,t){Al(this._observers,e,el).add(t)}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){let n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return tl((this._observers.get(e)||kl()).values()).forEach(e=>e(...t))}destroy(){this._observers=kl()}},Ml=Symbol(`Equality`),Nl=Object.keys,Pl=e=>Nl(e).length,Fl=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Il=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[Ml]!=null)return e[Ml](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(let n of e.keys())if(!t.has(n)||!Il(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Pl(e)!==Pl(t))return!1;for(let n in e)if(!Fl(e,n)||!Il(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Il(e[n],t[n]))return!1;break;default:return!1}return!0},Ll=3e4,Rl=class extends jl{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let e=Ol();this.getLocalState()!==null&&Ll/2<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());let t=[];this.meta.forEach((n,r)=>{r!==this.clientID&&Ll<=e-n.lastUpdated&&this.states.has(r)&&t.push(r)}),t.length>0&&zl(this,t,`timeout`)},Mc(Ll/10)),e.on(`destroy`,()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit(`destroy`,[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){let t=this.clientID,n=this.meta.get(t),r=n===void 0?0:n.clock+1,i=this.states.get(t);e===null?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:r,lastUpdated:Ol()});let a=[],o=[],s=[],c=[];e===null?c.push(t):i==null?e!=null&&a.push(t):(o.push(t),Il(i,e)||s.push(t)),(a.length>0||s.length>0||c.length>0)&&this.emit(`change`,[{added:a,updated:s,removed:c},`local`]),this.emit(`update`,[{added:a,updated:o,removed:c},`local`])}setLocalStateField(e,t){let n=this.getLocalState();n!==null&&this.setLocalState({...n,[e]:t})}getStates(){return this.states}},zl=(e,t,n)=>{let r=[];for(let n=0;n<t.length;n++){let i=t[n];if(e.states.has(i)){if(e.states.delete(i),i===e.clientID){let t=e.meta.get(i);e.meta.set(i,{clock:t.clock+1,lastUpdated:Ol()})}r.push(i)}}r.length>0&&(e.emit(`change`,[{added:[],updated:[],removed:r},n]),e.emit(`update`,[{added:[],updated:[],removed:r},n]))},Bl=(e,t,n=e.states)=>{let r=t.length,i=cl();X(i,r);for(let a=0;a<r;a++){let r=t[a],o=n.get(r)||null,s=e.meta.get(r).clock;X(i,r),X(i,s),Z(i,JSON.stringify(o))}return ul(i)},Vl=(e,t,n)=>{let r=bl(t),i=Ol(),a=[],o=[],s=[],c=[],l=wl(r);for(let t=0;t<l;t++){let t=wl(r),n=wl(r),l=JSON.parse(El(r)),u=e.meta.get(t),d=e.states.get(t),f=u===void 0?0:u.clock;(f<n||f===n&&l===null&&e.states.has(t))&&(l===null?t===e.clientID&&e.getLocalState()!=null?n++:e.states.delete(t):e.states.set(t,l),e.meta.set(t,{clock:n,lastUpdated:i}),u===void 0&&l!==null?a.push(t):u!==void 0&&l===null?c.push(t):l!==null&&(Il(l,d)||s.push(t),o.push(t)))}(a.length>0||s.length>0||c.length>0)&&e.emit(`change`,[{added:a,updated:s,removed:c},n]),(a.length>0||o.length>0||c.length>0)&&e.emit(`update`,[{added:a,updated:o,removed:c},n])},Hl=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}},Ul=class{constructor(e){this.data=e,this.encoder=cl(),this.decoder=bl(new Uint8Array(this.data))}peekVarString(){return Dl(this.decoder)}readVarUint(){return wl(this.decoder)}readVarString(){return El(this.decoder)}readVarUint8Array(){return Sl(this.decoder)}writeVarUint(e){return X(this.encoder,e)}writeVarString(e){return Z(this.encoder,e)}writeVarUint8Array(e){return hl(this.encoder,e)}length(){return ll(this.encoder)}},Q=function(e){return e[e.Sync=0]=`Sync`,e[e.Awareness=1]=`Awareness`,e[e.Auth=2]=`Auth`,e[e.QueryAwareness=3]=`QueryAwareness`,e[e.Stateless=5]=`Stateless`,e[e.CLOSE=7]=`CLOSE`,e[e.SyncStatus=8]=`SyncStatus`,e[e.Ping=9]=`Ping`,e[e.Pong=10]=`Pong`,e}({}),$=function(e){return e.Connecting=`connecting`,e.Connected=`connected`,e.Disconnected=`disconnected`,e}({}),Wl=class{constructor(){this.encoder=cl()}get(e){return e.encoder}toUint8Array(){return ul(this.encoder)}},Gl=class extends Wl{constructor(...e){super(...e),this.type=Q.CLOSE,this.description=`Ask the server to close the connection`}get(e){return Z(this.encoder,e.documentName),X(this.encoder,this.type),this.encoder}},Kl=class e extends Hl{static{this.DEDUPLICATABLE_TYPES=new Set([Q.Awareness,Q.QueryAwareness])}constructor(e){super(),this.messageQueue=[],this.configuration={url:``,autoConnect:!0,preserveTrailingSlash:!1,document:void 0,WebSocketPolyfill:void 0,messageReconnectTimeout:3e4,delay:1e3,initialDelay:0,factor:2,maxAttempts:0,minDelay:1e3,maxDelay:3e4,jitter:!0,timeout:0,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,handleTimeout:null,providerMap:new Map},this.webSocket=null,this.webSocketHandlers={},this.shouldConnect=!0,this.status=$.Disconnected,this.lastMessageReceived=0,this.identifier=0,this.intervals={connectionChecker:null},this.connectionAttempt=null,this.receivedOnOpenPayload=void 0,this.closeTries=0,this.setConfiguration(e),this.configuration.WebSocketPolyfill=e.WebSocketPolyfill?e.WebSocketPolyfill:WebSocket,this.on(`open`,this.configuration.onOpen),this.on(`open`,this.onOpen.bind(this)),this.on(`connect`,this.configuration.onConnect),this.on(`message`,this.configuration.onMessage),this.on(`outgoingMessage`,this.configuration.onOutgoingMessage),this.on(`status`,this.configuration.onStatus),this.on(`disconnect`,this.configuration.onDisconnect),this.on(`close`,this.configuration.onClose),this.on(`destroy`,this.configuration.onDestroy),this.on(`awarenessUpdate`,this.configuration.onAwarenessUpdate),this.on(`awarenessChange`,this.configuration.onAwarenessChange),this.on(`close`,this.onClose.bind(this)),this.on(`message`,this.onMessage.bind(this)),this.intervals.connectionChecker=setInterval(this.checkConnection.bind(this),this.configuration.messageReconnectTimeout/10),this.shouldConnect&&this.connect()}async onOpen(e){this.status=$.Connected,this.emit(`status`,{status:$.Connected}),this.cancelWebsocketRetry=void 0,this.receivedOnOpenPayload=e}attach(e){let t=e.effectiveName,n=this.configuration.providerMap.get(t);if(n&&n!==e&&n.isAuthenticated)throw Error(`Cannot attach two providers with the same effective name "${t}". Use sessionAwareness: true to multiplex providers with the same document name.`);this.configuration.providerMap.set(t,e),this.status===$.Disconnected&&this.shouldConnect&&this.connect(),this.receivedOnOpenPayload&&this.status===$.Connected&&e.onOpen(this.receivedOnOpenPayload)}detach(e){let t=e.effectiveName;this.configuration.providerMap.has(t)&&(e.send(Gl,{documentName:t}),this.configuration.providerMap.delete(t))}setConfiguration(e={}){this.configuration={...this.configuration,...e},this.configuration.autoConnect||(this.shouldConnect=!1)}async connect(){if(this.status===$.Connected)return;this.cancelWebsocketRetry&&=(this.cancelWebsocketRetry(),void 0),this.receivedOnOpenPayload=void 0,this.shouldConnect=!0;let{retryPromise:e,cancelFunc:t}=(()=>{let e=!1;return{retryPromise:jc(this.createWebSocketConnection.bind(this),{delay:this.configuration.delay,initialDelay:this.configuration.initialDelay,factor:this.configuration.factor,maxAttempts:this.configuration.maxAttempts,minDelay:this.configuration.minDelay,maxDelay:this.configuration.maxDelay,jitter:this.configuration.jitter,timeout:this.configuration.timeout,handleTimeout:this.configuration.handleTimeout,beforeAttempt:t=>{(!this.shouldConnect||e)&&t.abort()}}).catch(e=>{if(e&&e.code!==`ATTEMPT_ABORTED`)throw e}),cancelFunc:()=>{e=!0}}})();return this.cancelWebsocketRetry=t,e}attachWebSocketListeners(e,t){let{identifier:n}=e,r=e=>this.emit(`message`,e),i=e=>this.emit(`close`,{event:e}),a=e=>this.emit(`open`,e),o=e=>{t(e)};this.webSocketHandlers[n]={message:r,close:i,open:a,error:o};let s=this.webSocketHandlers[e.identifier];Object.keys(s).forEach(t=>{e.addEventListener(t,s[t])})}cleanupWebSocket(){if(!this.webSocket)return;let{identifier:e}=this.webSocket,t=this.webSocketHandlers[e];Object.keys(t).forEach(n=>{this.webSocket?.removeEventListener(n,t[n]),delete this.webSocketHandlers[e]}),this.webSocket.close(),this.webSocket=null}createWebSocketConnection(){return new Promise((e,t)=>{this.webSocket&&(this.messageQueue=[],this.cleanupWebSocket()),this.lastMessageReceived=0,this.identifier+=1;let n=new this.configuration.WebSocketPolyfill(this.url);n.binaryType=`arraybuffer`,n.identifier=this.identifier,this.attachWebSocketListeners(n,t),this.webSocket=n,this.status=$.Connecting,this.emit(`status`,{status:$.Connecting}),this.connectionAttempt={resolve:e,reject:t}})}onMessage(e){this.resolveConnectionAttempt(),this.lastMessageReceived=Ol();let t=new Uint8Array(e.data);if(t.length===1&&t[0]===Q.Ping){this.sendPong();return}let n=new Ul(t).peekVarString();this.configuration.providerMap.get(n)?.onMessage(e)}sendPong(){let e=cl();X(e,Q.Pong),this.send(ul(e))}resolveConnectionAttempt(){this.connectionAttempt&&(this.connectionAttempt.resolve(),this.connectionAttempt=null,this.status=$.Connected,this.emit(`status`,{status:$.Connected}),this.emit(`connect`),this.messageQueue.forEach(e=>this.send(e)),this.messageQueue=[])}stopConnectionAttempt(){this.connectionAttempt=null}rejectConnectionAttempt(){this.connectionAttempt?.reject(),this.connectionAttempt=null}checkConnection(){this.status===$.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=Ol()-this.lastMessageReceived||(this.closeTries+=1,this.closeTries>2?(this.onClose({event:{code:4408,reason:`forced`}}),this.closeTries=0):(this.webSocket?.close(),this.messageQueue=[])))}get serverUrl(){if(this.configuration.preserveTrailingSlash)return this.configuration.url;let e=this.configuration.url;for(;e[e.length-1]===`/`;)e=e.slice(0,e.length-1);return e}get url(){return this.serverUrl}disconnect(){if(this.shouldConnect=!1,this.webSocket!==null)try{this.webSocket.close(),this.messageQueue=[]}catch(e){console.error(e)}}parseQueuedMessage(e){try{let t=bl(e);return{documentName:El(t),messageType:wl(t)}}catch{return null}}addToQueue(t){if(t instanceof Uint8Array){let n=this.parseQueuedMessage(t);n&&e.DEDUPLICATABLE_TYPES.has(n.messageType)&&(this.messageQueue=this.messageQueue.filter(e=>{if(!(e instanceof Uint8Array))return!0;let t=this.parseQueuedMessage(e);return t?!(t.documentName===n.documentName&&t.messageType===n.messageType):!0}))}this.messageQueue.push(t)}send(e){this.webSocket?.readyState===Dc.Open?this.webSocket.send(e):this.addToQueue(e)}onClose({event:e}){this.closeTries=0,this.cleanupWebSocket(),this.connectionAttempt&&this.rejectConnectionAttempt(),this.status=$.Disconnected,this.emit(`status`,{status:$.Disconnected}),this.emit(`disconnect`,{event:e}),!this.cancelWebsocketRetry&&this.shouldConnect&&setTimeout(()=>{this.connect()},this.configuration.delay)}destroy(){this.emit(`destroy`),clearInterval(this.intervals.connectionChecker),this.stopConnectionAttempt(),this.disconnect(),this.removeAllListeners(),this.cleanupWebSocket()}},ql=0,Jl=1,Yl=2,Xl=(e,t)=>{X(e,ql),hl(e,xa(t))},Zl=(e,t,n)=>{X(e,Jl),hl(e,ha(t,n))},Ql=(e,t,n)=>Zl(t,n,Sl(e)),$l=(e,t,n,r)=>{try{fa(t,Sl(e),n)}catch(e){r?.(e),console.error(`Caught error while handling a Yjs update`,e)}},eu=(e,t)=>{X(e,Yl),hl(e,t)},tu=$l,nu=(e,t,n,r,i)=>{let a=wl(e);switch(a){case ql:Ql(e,t,n);break;case Jl:$l(e,n,r,i);break;case Yl:tu(e,n,r,i);break;default:throw Error(`Unknown message type`)}return a},ru=class{constructor(e){this.message=e}apply(e,t){let{message:n}=this,r=n.readVarUint(),i=n.length();switch(r){case Q.Sync:this.applySyncMessage(e,t);break;case Q.Awareness:this.applyAwarenessMessage(e);break;case Q.Auth:this.applyAuthMessage(e);break;case Q.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case Q.Stateless:e.receiveStateless(El(n.decoder));break;case Q.SyncStatus:this.applySyncStatusMessage(e,Tl(n.decoder)===1);break;case Q.CLOSE:let i={code:1e3,reason:El(n.decoder)};e.onClose(),e.configuration.onClose({event:i}),e.forwardClose({event:i});break;default:console.error(`Can’t apply message of unknown type: ${r}`)}n.length()>i+1&&e.send(Wl,{encoder:n.encoder})}applySyncMessage(e,t){let{message:n}=this;n.writeVarUint(Q.Sync);let r=nu(n.decoder,n.encoder,e.document,e);t&&r===Jl&&(e.synced=!0)}applySyncStatusMessage(e,t){t&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;let{message:t}=this;Vl(e.awareness,t.readVarUint8Array(),e)}applyAuthMessage(e){let{message:t}=this;Sc(t.decoder,e.sendToken.bind(e),e.permissionDeniedHandler.bind(e),e.authenticatedHandler.bind(e))}applyQueryAwarenessMessage(e){if(!e.awareness)return;let{message:t}=this;t.writeVarUint(Q.Awareness),t.writeVarUint8Array(Bl(e.awareness,Array.from(e.awareness.getStates().keys())))}},iu=class{constructor(e,t={}){this.message=new e,this.encoder=this.message.get(t)}create(){return ul(this.encoder)}send(e){e?.send(this.create())}},au=`4.0.0-rc.1`,ou=class extends Wl{constructor(...e){super(...e),this.type=Q.Auth,this.description=`Authentication`}get(e){if(e.token===void 0)throw Error("The authentication message requires `token` as an argument.");return Z(this.encoder,e.documentName),X(this.encoder,this.type),xc(this.encoder,e.token),Z(this.encoder,au),this.encoder}},su=class extends Wl{constructor(...e){super(...e),this.type=Q.Awareness,this.description=`Awareness states update`}get(e){if(e.awareness===void 0)throw Error(`The awareness message requires awareness as an argument`);if(e.clients===void 0)throw Error(`The awareness message requires clients as an argument`);Z(this.encoder,e.documentName),X(this.encoder,this.type);let t;return t=e.states===void 0?Bl(e.awareness,e.clients):Bl(e.awareness,e.clients,e.states),hl(this.encoder,t),this.encoder}},cu=class extends Wl{constructor(...e){super(...e),this.type=Q.Stateless,this.description=`A stateless message`}get(e){return Z(this.encoder,e.documentName),X(this.encoder,this.type),Z(this.encoder,e.payload??``),this.encoder}},lu=class extends Wl{constructor(...e){super(...e),this.type=Q.Sync,this.description=`First sync step`}get(e){if(e.document===void 0)throw Error(`The sync step one message requires document as an argument`);return Z(this.encoder,e.documentName),X(this.encoder,this.type),Xl(this.encoder,e.document),this.encoder}},uu=class extends Wl{constructor(...e){super(...e),this.type=Q.Sync,this.description=`A document update`}get(e){return Z(this.encoder,e.documentName),X(this.encoder,this.type),eu(this.encoder,e.update),this.encoder}},du=class extends Error{constructor(...e){super(...e),this.code=1001}},fu=class extends Hl{get effectiveName(){return this.configuration.sessionAwareness?Tc(this.configuration.name,this.sessionId):this.configuration.name}constructor(e){super(),this.configuration={name:``,document:void 0,awareness:void 0,token:null,sessionAwareness:!0,forceSyncInterval:!1,onAuthenticated:()=>null,onAuthenticationFailed:()=>null,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onSynced:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,onStateless:()=>null,onUnsyncedChanges:()=>null},this.isSynced=!1,this.unsyncedChanges=0,this.isAuthenticated=!1,this.authorizedScope=void 0,this.manageSocket=!1,this._isAttached=!1,this.sessionId=Math.random().toString(36).slice(2),this.intervals={forceSync:null},this.boundDocumentUpdateHandler=this.documentUpdateHandler.bind(this),this.boundAwarenessUpdateHandler=this.awarenessUpdateHandler.bind(this),this.boundPageHide=this.pageHide.bind(this),this.boundOnOpen=this.onOpen.bind(this),this.boundOnClose=this.onClose.bind(this),this.forwardConnect=()=>this.emit(`connect`),this.forwardStatus=e=>this.emit(`status`,e),this.forwardClose=e=>this.emit(`close`,e),this.forwardDisconnect=e=>this.emit(`disconnect`,e),this.forwardDestroy=()=>this.emit(`destroy`),this.setConfiguration(e),this.configuration.document=e.document?e.document:new Xi,this.configuration.awareness=e.awareness===void 0?new Rl(this.document):e.awareness,this.on(`open`,this.configuration.onOpen),this.on(`message`,this.configuration.onMessage),this.on(`outgoingMessage`,this.configuration.onOutgoingMessage),this.on(`synced`,this.configuration.onSynced),this.on(`destroy`,this.configuration.onDestroy),this.on(`awarenessUpdate`,this.configuration.onAwarenessUpdate),this.on(`awarenessChange`,this.configuration.onAwarenessChange),this.on(`stateless`,this.configuration.onStateless),this.on(`unsyncedChanges`,this.configuration.onUnsyncedChanges),this.on(`authenticated`,this.configuration.onAuthenticated),this.on(`authenticationFailed`,this.configuration.onAuthenticationFailed),this.awareness?.on(`update`,()=>{this.emit(`awarenessUpdate`,{states:Cc(this.awareness.getStates())})}),this.awareness?.on(`change`,()=>{this.emit(`awarenessChange`,{states:Cc(this.awareness.getStates())})}),this.document.on(`update`,this.boundDocumentUpdateHandler),this.awareness?.on(`update`,this.boundAwarenessUpdateHandler),this.registerEventListeners(),this.configuration.forceSyncInterval&&typeof this.configuration.forceSyncInterval==`number`&&(this.intervals.forceSync=setInterval(this.forceSync.bind(this),this.configuration.forceSyncInterval)),this.manageSocket&&this.attach()}setConfiguration(e={}){e.websocketProvider||(this.manageSocket=!0,this.configuration.websocketProvider=new Kl(e)),this.configuration={...this.configuration,...e}}get document(){return this.configuration.document}get isAttached(){return this._isAttached}get awareness(){return this.configuration.awareness}get hasUnsyncedChanges(){return this.unsyncedChanges>0}resetUnsyncedChanges(){this.unsyncedChanges=1,this.emit(`unsyncedChanges`,{number:this.unsyncedChanges})}incrementUnsyncedChanges(){this.unsyncedChanges+=1,this.emit(`unsyncedChanges`,{number:this.unsyncedChanges})}decrementUnsyncedChanges(){this.unsyncedChanges>0&&--this.unsyncedChanges,this.unsyncedChanges===0&&(this.synced=!0),this.emit(`unsyncedChanges`,{number:this.unsyncedChanges})}forceSync(){this.resetUnsyncedChanges(),this.send(lu,{document:this.document,documentName:this.effectiveName})}pageHide(){this.awareness&&zl(this.awareness,[this.document.clientID],`page hide`)}registerEventListeners(){typeof window>`u`||!(`addEventListener`in window)||window.addEventListener(`pagehide`,this.boundPageHide)}sendStateless(e){this.send(cu,{documentName:this.effectiveName,payload:e})}async sendToken(){let e;try{e=await this.getToken()}catch(e){this.permissionDeniedHandler(`Failed to get token during sendToken(): ${e}`);return}this.send(ou,{token:e??``,documentName:this.effectiveName})}documentUpdateHandler(e,t){t!==this&&(this.incrementUnsyncedChanges(),this.send(uu,{update:e,documentName:this.effectiveName}))}awarenessUpdateHandler({added:e,updated:t,removed:n},r){let i=e.concat(t).concat(n);this.send(su,{awareness:this.awareness,clients:i,documentName:this.effectiveName})}get synced(){return this.isSynced}set synced(e){this.isSynced!==e&&(this.isSynced=e,e&&this.emit(`synced`,{state:e}))}receiveStateless(e){this.emit(`stateless`,{payload:e})}async connect(){if(this.manageSocket)return this.configuration.websocketProvider.connect();console.warn(`HocuspocusProvider::connect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.`)}disconnect(){if(this.manageSocket)return this.configuration.websocketProvider.disconnect();console.warn(`HocuspocusProvider::disconnect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.`)}async onOpen(e){this.isAuthenticated=!1,this.emit(`open`,{event:e}),await this.sendToken(),this.startSync()}async getToken(){return typeof this.configuration.token==`function`?await this.configuration.token():this.configuration.token}startSync(){this.resetUnsyncedChanges(),this.send(lu,{document:this.document,documentName:this.effectiveName}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(su,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.effectiveName})}send(e,t){if(!this._isAttached)return;let n=new iu(e,t);this.emit(`outgoingMessage`,{message:n.message}),n.send(this.configuration.websocketProvider)}onMessage(e){let t=new Ul(e.data),{documentName:n}=Ec(t.readVarString());t.writeVarString(this.effectiveName),this.emit(`message`,{event:e,message:new Ul(e.data)}),new ru(t).apply(this,!0)}onClose(){this.isAuthenticated=!1,this.synced=!1,this.awareness&&zl(this.awareness,Array.from(this.awareness.getStates().keys()).filter(e=>e!==this.document.clientID),this)}destroy(){this.emit(`destroy`),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),this.awareness&&(zl(this.awareness,[this.document.clientID],`provider destroy`),this.awareness.off(`update`,this.boundAwarenessUpdateHandler),this.awareness.destroy()),this.document.off(`update`,this.boundDocumentUpdateHandler),this.removeAllListeners(),this.detach(),this.manageSocket&&this.configuration.websocketProvider.destroy(),!(typeof window>`u`||!(`removeEventListener`in window))&&window.removeEventListener(`pagehide`,this.boundPageHide)}detach(){this.configuration.websocketProvider.off(`connect`,this.configuration.onConnect),this.configuration.websocketProvider.off(`connect`,this.forwardConnect),this.configuration.websocketProvider.off(`status`,this.forwardStatus),this.configuration.websocketProvider.off(`status`,this.configuration.onStatus),this.configuration.websocketProvider.off(`open`,this.boundOnOpen),this.configuration.websocketProvider.off(`close`,this.boundOnClose),this.configuration.websocketProvider.off(`close`,this.configuration.onClose),this.configuration.websocketProvider.off(`close`,this.forwardClose),this.configuration.websocketProvider.off(`disconnect`,this.configuration.onDisconnect),this.configuration.websocketProvider.off(`disconnect`,this.forwardDisconnect),this.configuration.websocketProvider.off(`destroy`,this.configuration.onDestroy),this.configuration.websocketProvider.off(`destroy`,this.forwardDestroy),this.configuration.websocketProvider.detach(this),this._isAttached=!1}attach(){this._isAttached||=(this.configuration.websocketProvider.on(`connect`,this.configuration.onConnect),this.configuration.websocketProvider.on(`connect`,this.forwardConnect),this.configuration.websocketProvider.on(`status`,this.configuration.onStatus),this.configuration.websocketProvider.on(`status`,this.forwardStatus),this.configuration.websocketProvider.on(`open`,this.boundOnOpen),this.configuration.websocketProvider.on(`close`,this.boundOnClose),this.configuration.websocketProvider.on(`close`,this.configuration.onClose),this.configuration.websocketProvider.on(`close`,this.forwardClose),this.configuration.websocketProvider.on(`disconnect`,this.configuration.onDisconnect),this.configuration.websocketProvider.on(`disconnect`,this.forwardDisconnect),this.configuration.websocketProvider.on(`destroy`,this.configuration.onDestroy),this.configuration.websocketProvider.on(`destroy`,this.forwardDestroy),this.configuration.websocketProvider.attach(this),!0)}permissionDeniedHandler(e){this.emit(`authenticationFailed`,{reason:e}),this.isAuthenticated=!1}authenticatedHandler(e){this.isAuthenticated=!0,this.authorizedScope=e,this.emit(`authenticated`,{scope:e})}setAwarenessField(e,t){if(!this.awareness)throw new du(`Cannot set awareness field "${e}" to ${JSON.stringify(t)}. You have disabled Awareness for this provider by explicitly passing awareness: null in the provider configuration.`);this.awareness.setLocalStateField(e,t)}};function pu(e,t,n=null,r=null){let i={...xe()};return e!==null&&(i.principalId=e.principalId,i.tabSessionId=e.tabSessionId),t!==null&&t.length>0&&(i.expectedServerInstanceId=t),n!==null&&n.length>0&&(i.expectedBranch=n),r!==null&&r.length>0&&(i.expectedDocLineageEpoch=r),JSON.stringify(i)}function mu(e,t,n){let r=(0,Se.c)(5),i,a;r[0]!==e||r[1]!==t||r[2]!==n?(i=()=>{!e||!n||typeof e.setLanguagePreference==`function`&&e.setLanguagePreference(t??`system`).catch(e=>{console.warn(JSON.stringify({event:`language-preference-push-failed`,preference:t??`system`,error:e instanceof Error?e.message:String(e)}))})},a=[e,t,n],r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a):(i=r[3],a=r[4]),(0,_.useEffect)(i,a)}function hu(e){let t=/^rgba?\(([^)]*)\)$/i.exec(e.trim())?.[1];if(t===void 0)return null;let n=t.split(/[\s,/]+/).filter(Boolean);if(n.length<3)return null;let r=`#`;for(let e=0;e<3;e++){let t=Math.round(Number(n[e]));if(!Number.isFinite(t)||t<0||t>255)return null;r+=t.toString(16).padStart(2,`0`)}return r}function gu(e){if(typeof document>`u`)return null;let t=document.createElement(`canvas`).getContext(`2d`);if(!t)return null;t.fillStyle=`#000000`,t.fillStyle=e;let n=t.fillStyle;return t.fillStyle=`#ffffff`,t.fillStyle=e,t.fillStyle===n&&typeof n==`string`&&/^#[0-9a-f]{6}$/i.test(n)?n.toLowerCase():null}function _u(e){return gu(e)??hu(e)}function vu(e){let t=document.createElement(`span`);t.style.display=`none`,t.style.backgroundColor=`var(${e})`,document.body.appendChild(t);try{let e=getComputedStyle(t).backgroundColor;return!e||e===`rgba(0, 0, 0, 0)`||e.includes(`var(`)?null:_u(e)}finally{t.remove()}}function yu(){if(!(typeof document>`u`))try{let e=vu(`--sidebar`),t=vu(`--sidebar-foreground`);return!e||!t?void 0:{bg:e,symbol:t}}catch{return}}function bu(e,t,n){let r=(0,Se.c)(10),i;r[0]!==e||r[1]!==t?(i=()=>{if(t!==`light`&&t!==`dark`&&t!==`system`||!e)return;let n=!1;return e.setThemeSource(t).catch(e=>{console.warn(JSON.stringify({event:`theme-source-set-failed`,themeValue:t,error:e instanceof Error?e.message:String(e)}))}).finally(()=>{if(n)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`).matches;e.signalThemeApplied({reducedTransparency:t,chrome:yu()})}),()=>{n=!0}},r[0]=e,r[1]=t,r[2]=i):i=r[2];let a;r[3]!==e||r[4]!==n||r[5]!==t?(a=[e,t,n],r[3]=e,r[4]=n,r[5]=t,r[6]=a):a=r[6],(0,_.useEffect)(i,a);let o,s;r[7]===e?(o=r[8],s=r[9]):(o=()=>{if(!e)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`),n=t=>{e.signalThemeApplied({reducedTransparency:t.matches,chrome:yu()})};return t.addEventListener(`change`,n),()=>{t.removeEventListener(`change`,n)}},s=[e],r[7]=e,r[8]=o,r[9]=s),(0,_.useEffect)(o,s)}function xu(e){return{authoritative:e,themes:l,warnings:[],truncated:!1}}function Su(e){let{scheme:t}=e;return{id:e.id,label:t.name,kind:t.variant,scheme:t,toTokens:()=>ne(t)}}function Cu(e,t){return{id:e,label:t.name,kind:t.variant,scheme:t,toTokens:()=>ne(t)}}function wu(e,t,n={}){console.warn(JSON.stringify({event:`ok-saved-theme-request-failed`,action:e,result:t,...n.status===void 0?{}:{status:n.status},...n.error===void 0?{}:{errorName:n.error instanceof Error?n.error.name:`UnknownError`}}))}async function Tu(e={}){let t=e.request??globalThis.fetch;try{let n=await t(`/api/saved-themes`,{signal:e.signal});if(!n.ok)return wu(`list`,`http-error`,{status:n.status}),xu(!1);let r=te.safeParse(await n.json());if(!r.success)return console.warn(`[themes] saved-themes response failed schema validation`,r.error.issues),xu(!1);let i=[],a=[];for(let e of r.data.themes)e.ok?i.push(Su(e)):a.push({filename:e.filename,id:e.id,code:e.code,...e.conflictingFilenames?{conflictingFilenames:e.conflictingFilenames}:{}});return{authoritative:!0,themes:i.length===0?l:[...l,...i],warnings:a,truncated:r.data.truncated}}catch(t){return e.signal?.aborted||wu(`list`,`request-error`,{error:t}),xu(!1)}}function Eu(e){switch(e.detail){case`empty`:case`too-long`:case`invalid-chars`:return e.detail;default:return}}async function Du(e,t={}){let n=ce.safeParse(e);if(!n.success)return{ok:!1,reason:`unexpected`};let r=t.request??globalThis.fetch;try{let e=await r(`/api/saved-theme`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n.data)}),t=await e.json().catch(()=>null);if(e.ok){let e=o.safeParse(t);return e.success?{ok:!0,...e.data}:{ok:!1,reason:`unexpected`}}let i=fe.safeParse(t);if(!i.success)return{ok:!1,reason:`unexpected`};if(i.data.type===`urn:ok:error:theme-name-taken`)return{ok:!1,reason:`name-taken`};if(i.data.type===`urn:ok:error:theme-name-invalid`){let e=Eu(i.data);return e?{ok:!1,reason:`name-invalid`,detail:e}:{ok:!1,reason:`name-invalid`}}return{ok:!1,reason:`unexpected`}}catch(e){return wu(`save`,`request-error`,{error:e}),{ok:!1,reason:`unexpected`}}}async function Ou(e,t={}){let n=d.safeParse(e);if(!n.success)return{ok:!1,reason:`unexpected`};let r=t.request??globalThis.fetch;try{let e=await r(`/api/saved-theme`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(n.data)}),t=await e.json().catch(()=>null);if(e.ok){let e=p.safeParse(t);return e.success?{ok:!0,...e.data}:{ok:!1,reason:`unexpected`}}let i=fe.safeParse(t);return i.success&&i.data.type===`urn:ok:error:not-found`?{ok:!1,reason:`not-found`}:{ok:!1,reason:`unexpected`}}catch(e){return wu(`update`,`request-error`,{error:e}),{ok:!1,reason:`unexpected`}}}async function ku(e,t={}){if(!ie(e).ok)return{ok:!1,reason:`unexpected`};let n=t.request??globalThis.fetch;try{let t=await n(`/api/saved-theme?${new URLSearchParams({id:e})}`,{method:`DELETE`}),r=await t.json().catch(()=>null);if(!t.ok)return{ok:!1,reason:`unexpected`};let i=m.safeParse(r);if(!i.success)return{ok:!1,reason:`unexpected`};if(!i.data.existed)return{ok:!0,existed:!1};let a=se.safeParse(i.data.scheme);return a.success?{ok:!0,existed:!0,filename:i.data.filename,scheme:a.data}:{ok:!1,reason:`unexpected`}}catch(e){return wu(`delete`,`request-error`,{error:e}),{ok:!1,reason:`unexpected`}}}var Au=(0,_.createContext)(null);function ju(e){let t=(0,Se.c)(20),{children:n}=e,r=Oe(),[i,a]=(0,_.useState)(Pu),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(`custom`),[f,p]=(0,_.useState)(!1),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={},t[0]=m):m=t[0];let ee=(0,_.useRef)(m),h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h={},t[1]=h):h=t[1];let[te,ne]=(0,_.useState)(h),re=(0,_.useRef)(0),ie;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(ie=()=>{let e=0,t=null,n=!1,r=null,i,o=[250,1e3,4e3],c=()=>{i!==void 0&&clearTimeout(i),i=void 0},u=()=>{if(t)return n=!0,t;let i=e,o=(async()=>{let t;do{n=!1;let o=re.current,u=new AbortController;r=u;let{authoritative:d,...f}=await Tu({signal:u.signal});if(i!==e)return!1;t=d,d?(c(),o===re.current&&a(f),s(!0),l(!1)):l(!0)}while(n);return t})().finally(()=>{t===o&&(t=null)});return t=o,o};return{refresh:u,startAutomaticRetry:()=>{e+=1;let a=e;r?.abort(),r=null,t=null,n=!1,c();let s=async t=>{let n=await u();a!==e||n||t>=o.length||(i=setTimeout(()=>void s(t+1),o[t]))};return s(0),()=>{a===e&&(e+=1,r?.abort(),r=null,t=null,n=!1,c())}}}},t[2]=ie):ie=t[2];let[ae]=(0,_.useState)(ie),oe=ae.refresh,se;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>{let e=new Map,t=(t,n)=>{let r=(e.get(t)??Promise.resolve()).then(n,n),i=r.then(Nu,Mu);return e.set(t,i),i.finally(()=>{e.get(t)===i&&e.delete(t)}),r},n=(e,t,n)=>{re.current+=1;let r=Cu(e,t);a(t=>({...t,themes:t.themes.some(t=>t.id===e)?t.themes.map(t=>t.id===e?r:t):[...t.themes,r],warnings:t.warnings.filter(t=>t.id!==e&&(n===void 0||t.filename!==n))}))};return{updateTheme:e=>t(e.id,async()=>{let t=await Ou(e);return t.ok&&n(e.id,e.scheme,t.filename),t}),deleteTheme:e=>t(e,async()=>{let t=await ku(e);if(t.ok){let t={...ee.current,[e]:(ee.current[e]??0)+1};ee.current=t,ne(t),re.current+=1,a(t=>({...t,themes:t.themes.filter(t=>t.id!==e),warnings:t.warnings.filter(t=>t.id!==e)}))}return t}),restoreTheme:e=>t(e.id,async()=>{let t=await Du({name:e.name,stem:e.stem,scheme:e.scheme,extension:e.extension});return t.ok&&n(t.id,e.scheme,t.filename),t})}},t[3]=se):se=t[3];let[ce]=(0,_.useState)(se),le;t[4]===ae?le=t[5]:(le=()=>ae.startAutomaticRetry(),t[4]=ae,t[5]=le);let ue;t[6]!==ae||t[7]!==r?(ue=[ae,r],t[6]=ae,t[7]=r,t[8]=ue):ue=t[8],(0,_.useEffect)(le,ue);let g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(e){if(e===null){p(!1);return}d(e),p(!0)},t[9]=g):g=t[9];let de=g,fe;return t[10]!==n||t[11]!==i||t[12]!==u||t[13]!==c||t[14]!==o||t[15]!==ce||t[16]!==oe||t[17]!==f||t[18]!==te?(fe=(0,_.createElement)(Au,{value:{...i,loaded:o,loadError:c,refresh:oe,...ce,editingThemeId:u,themeIncarnations:te,themeEditorOpen:f,selectThemeToEdit:de}},n),t[10]=n,t[11]=i,t[12]=u,t[13]=c,t[14]=o,t[15]=ce,t[16]=oe,t[17]=f,t[18]=te,t[19]=fe):fe=t[19],fe}function Mu(){}function Nu(){}function Pu(){return xu(!1)}function Fu(){let e=(0,_.use)(Au);if(!e)throw Error(`useSavedThemes must be used within <SavedThemesProvider />`);return e}var Iu={en:()=>t(()=>import(`./messages-CgqvsJOb.js`).then(e=>e.n),__vite__mapDeps([0,1]),import.meta.url),"zh-Hans":()=>t(()=>import(`./messages-DAiMiSQb.js`),[],import.meta.url),"zh-Hant":()=>t(()=>import(`./messages-DKla4fHa.js`),[],import.meta.url),hi:()=>t(()=>import(`./messages-Bf16a61t.js`),[],import.meta.url),es:()=>t(()=>import(`./messages-BrwWcQ1q.js`),[],import.meta.url),ar:()=>t(()=>import(`./messages-Bsokz5p_.js`),[],import.meta.url),fr:()=>t(()=>import(`./messages-BlMkdPL-.js`),[],import.meta.url),bn:()=>t(()=>import(`./messages-D3GzXczV.js`),[],import.meta.url),"pt-BR":()=>t(()=>import(`./messages-B6vvv7H-.js`),[],import.meta.url),id:()=>t(()=>import(`./messages-DhVrLKqA.js`),[],import.meta.url),ur:()=>t(()=>import(`./messages-CWnVB_17.js`),[],import.meta.url)},Lu=new Set([`en`]),Ru=`en`;async function zu(e){if(Ru=e,!Lu.has(e)){let{default:t}=await Iu[e]();me.load(e,t.messages),Lu.add(e)}Ru===e&&me.activate(e)}function Bu(){return!1}async function Vu(){}var Hu=`ok-locale-load-failed`;function Uu(){window.location.reload()}function Wu({locale:e,reload:t=Uu}){let n=new Intl.DisplayNames([me.locale],{type:`language`}).of(e)??e;he.error(me._({id:`loE6tM`,values:{language:n}}),{id:Hu,description:me._({id:`GtPGNJ`}),duration:1/0,action:{label:me._({id:`HpK_8d`}),onClick:t}})}function Gu(){he.dismiss(Hu)}var Ku=`ok-language-v1`;function qu({preference:e,locale:t}){if(typeof document>`u`)return;let n=s(t),r=document.documentElement;r.lang=t,r.dir=n;try{localStorage.setItem(Ku,JSON.stringify({pref:e,locale:t,dir:n}))}catch{}}function Ju(e){return e===`system`?`system`:h.includes(e)?e:void 0}function Yu(){if(!(typeof localStorage>`u`))try{let e=localStorage.getItem(Ku);return e===null?void 0:Ju(JSON.parse(e).pref)}catch{return}}function Xu(e){let t=(0,Se.c)(4),{preference:n,userConfigSynced:r}=e,i,a;t[0]!==n||t[1]!==r?(i=()=>{if(Bu()){Vu().catch(Zu);return}if(!r)return;let{locale:e}=g({override:void 0,storedPreference:n,preferenceList:ue(),supportedLocales:h,autoDetectableLocales:pe}),t=!1;return zu(e).then(()=>{t||(Gu(),qu({preference:n??`system`,locale:e}))}).catch(n=>{console.warn(JSON.stringify({event:`ok-locale-activate-failed`,locale:e,error:String(n)})),!t&&Wu({locale:e})}),()=>{t=!0}},a=[n,r],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,_.useEffect)(i,a)}function Zu(e){console.warn(JSON.stringify({event:`ok-pseudo-locale-activate-failed`,error:String(e)}))}function Qu(e){let t=(0,Se.c)(5),{setTheme:n}=i(),r;t[0]!==n||t[1]!==e?(r=()=>{(e===`light`||e===`dark`||e===`system`)&&n(e)},t[0]=n,t[1]=e,t[2]=r):r=t[2];let a;t[3]===e?a=t[4]:(a=[e],t[3]=e,t[4]=a),(0,_.useEffect)(r,a)}var $u=n();function ed(e,t,n,r){console.warn(JSON.stringify({event:`ok-${e}-${n}`,docName:t,code:r?.code,reason:r?.reason??void 0}))}function td(e,t,n,r){let i=new Xi,a=new fu({url:e,name:t,document:i,token:pu(null,r,null),onDisconnect:({event:e})=>ed(`config-provider`,t,`disconnect`,e),onClose:({event:e})=>ed(`config-provider`,t,`close`,e)}),o=de(a,n);return{binding:o,config:o.current(),cleanup:()=>{o.dispose(),a.destroy(),i.destroy()}}}function nd(e,t){let n=new Xi,r=new fu({url:e,name:f,document:n,token:pu(null,t,null),onDisconnect:({event:e})=>ed(`okignore-provider`,f,`disconnect`,e),onClose:({event:e})=>ed(`okignore-provider`,f,`close`,e)}),i=le(r);return{binding:i,provider:r,cleanup:()=>{i.dispose(),r.destroy(),n.destroy()}}}function rd(e){let t=(0,Se.c)(24),{collabUrl:n,children:r}=e,{themes:a,loaded:o,loadError:s}=Fu(),l=Oe(),{systemTheme:d}=i(),f=d===`dark`,[p,m]=(0,_.useState)(null),[h,te]=(0,_.useState)(null),[ne,ie]=(0,_.useState)(null),[se,ce]=(0,_.useState)(null),le,ue;t[0]!==n||t[1]!==l?(le=()=>{if(n===null)return;let e=td(n,u,`user`,l),t=td(n,ee,`project`,l),r=td(n,c,`project-local`,l),i=nd(n,l);m({binding:e.binding,config:e.config,synced:e.binding.hasSynced()}),te({binding:t.binding,config:t.config,synced:t.binding.hasSynced()}),ie({binding:r.binding,config:r.config,synced:r.binding.hasSynced()}),ce({binding:i.binding,synced:!1});let a=e.binding.subscribe(t=>{m(n=>n?.binding===e.binding?{...n,config:t}:n)}),o=e.binding.subscribeSynced(()=>{m(t=>t?.binding===e.binding?{...t,config:e.binding.current(),synced:!0}:t)}),s=t.binding.subscribe(e=>{te(n=>n?.binding===t.binding?{...n,config:e}:n)}),d=t.binding.subscribeSynced(()=>{te(e=>e?.binding===t.binding?{...e,config:t.binding.current(),synced:!0}:e)}),f=r.binding.subscribe(e=>{ie(t=>t?.binding===r.binding?{...t,config:e}:t)}),p=r.binding.subscribeSynced(()=>{ie(e=>e?.binding===r.binding?{...e,config:r.binding.current(),synced:!0}:e)}),h=()=>{ce(e=>e?.binding===i.binding?{...e,synced:!0}:e)};return i.provider.on(`synced`,h),()=>{a(),o(),s(),d(),f(),p(),i.provider.off(`synced`,h);for(let n of[e,t,r,i])try{n.cleanup()}catch(e){console.warn(JSON.stringify({event:`ok-config-provider-cleanup-error`,error:String(e)}))}m(t=>t?.binding===e.binding?null:t),te(e=>e?.binding===t.binding?null:e),ie(e=>e?.binding===r.binding?null:e),ce(e=>e?.binding===i.binding?null:e)}},ue=[n,l],t[0]=n,t[1]=l,t[2]=le,t[3]=ue):(le=t[2],ue=t[3]),(0,_.useEffect)(le,ue);let g=p&&h?re(p.config,h.config,ne?.config):null,de=g?.appearance?.theme,fe=g?.appearance?.customTheme,pe=g?.appearance?.colorThemeEnabled!==!1,me=n===null||p?.synced===!0&&h?.synced===!0&&ne?.synced===!0,he=[g?.appearance?.colorThemeLight,g?.appearance?.colorThemeDark,g?.appearance?.colorTheme],xe=pe&&he.some(id),Ce=me&&(!xe||o),we=me&&(!xe||o||s),Te=ae(g?.appearance,a),Ee=oe(de,f),De=pe?Te[Ee]:`default`,v=De===`custom`?_e(ye(fe)):ge(De,a)??de;Qu(Ce?v:void 0),be({selection:Te,modePreference:de,slotMode:Ee,customSeed:fe,themes:a,enabled:pe,ready:Ce}),Xu({preference:g?.appearance?.language,userConfigSynced:p?.synced??!1}),mu(typeof window<`u`?window.okDesktop:void 0,g?.appearance?.language,p?.synced??!1);let ke=De.startsWith(`saved-`)?a.find(e=>e.id===De)?.scheme:void 0,y=De===`custom`?JSON.stringify(fe??null):ke?JSON.stringify(ke):``,Ae;t[4]!==we||t[5]!==Ce||t[6]!==v?(Ae=we&&!Ce&&typeof document<`u`?document.documentElement.classList.contains(`dark`)?`dark`:`light`:v??`system`,t[4]=we,t[5]=Ce,t[6]=v,t[7]=Ae):Ae=t[7];let je=Ae;bu(we&&typeof window<`u`?window.okDesktop:void 0,we?je:void 0,`${De}:${y}`);let b=p?.binding??null,Me=p?.synced??!1,Ne=h?.binding??null,x=ne?.binding??null,Pe=se?.binding??null,Fe=se?.synced??!1,Ie=p?.config??null,Le=h?.config??null,Re=h?.synced??!1,ze=ne?.config??null,S=ne?.synced??!1,Be;t[8]!==g||t[9]!==Ie||t[10]!==Le||t[11]!==Re||t[12]!==ze||t[13]!==S||t[14]!==b||t[15]!==Me||t[16]!==Ne||t[17]!==x||t[18]!==Pe||t[19]!==Fe?(Be={userBinding:b,userSynced:Me,projectBinding:Ne,projectLocalBinding:x,okignoreBinding:Pe,okignoreSynced:Fe,userConfig:Ie,projectConfig:Le,projectSynced:Re,projectLocalConfig:ze,projectLocalSynced:S,merged:g},t[8]=g,t[9]=Ie,t[10]=Le,t[11]=Re,t[12]=ze,t[13]=S,t[14]=b,t[15]=Me,t[16]=Ne,t[17]=x,t[18]=Pe,t[19]=Fe,t[20]=Be):Be=t[20];let Ve=Be,C;return t[21]!==r||t[22]!==Ve?(C=(0,$u.jsx)(ve,{value:Ve,children:r}),t[21]=r,t[22]=Ve,t[23]=C):C=t[23],C}function id(e){return typeof e==`string`&&e.startsWith(`saved-`)}function ad(e){let t=(0,Se.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$u.jsx)(ju,{children:(0,$u.jsx)(rd,{...e})}),t[0]=e,t[1]=n),n}export{O as $,ha as A,Ro as B,za as C,La as D,Na as E,Aa as F,P as G,R as H,Ri as I,Mn as J,Un as K,Ma as L,V as M,ka as N,Ha as O,Bi as P,on as Q,Ua as R,Ba as S,z as T,si as U,gi as V,ci as W,vn as X,Sn as Y,un as Z,Cs as _,Fu as a,ze as at,fa as b,fu as c,y as ct,cc as d,k as et,Xi as f,uo as g,Va as h,Xu as i,Ve as it,xa as j,_a as k,q as l,Ee as lt,ja as m,Ju as n,tt as nt,bu as o,b as ot,J as p,Vn as q,Yu as r,C as rt,pu as s,v as st,ad as t,A as tt,Qs as u,Os as v,Wi as w,da as x,Ns as y,U as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,At as t,Bt as n,Dt as r,Ft as i,It as a,J as o,Lt as s,Mt as c,O as l,P as u,Pt as d,Q as f,Rt as p,St as m,Tt as h,Vt as g,Wt as _,X as v,Y as y,at as b,dt as x,jt as S,kt as ee,pt as C,yt as te,zt as w}from"./dist-BSAh-TK7.js";var T=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=u(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(O(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function E(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function ne(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=E(t)+E(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function re(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:ne(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function ie(e,t){return n=>{for(let t=u(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}var ae=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function D(e){return e.selection.main.from}function O(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var k=m.define();function oe(e,t,n,i){let{main:a}=e.selection,o=n-a.from,s=i-a.from;return{...e.changeByRange(c=>{if(c!=a&&n!=i&&e.sliceDoc(c.from+o,c.from+s)!=e.sliceDoc(n,i))return{range:c};let l=e.toText(t);return{changes:{from:c.from+o,to:i==a.from?c.to:c.from+s,insert:l},range:r.cursor(c.from+o+l.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var se=new WeakMap;function ce(e){if(!Array.isArray(e))return e;let t=se.get(e);return t||se.set(e,t=re(e)),t}var A=i.define(),j=i.define(),le=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let r=w(e,t),i=n(r);this.chars.push(r);let a=e.slice(t,t+i),o=a.toUpperCase();this.folded.push(w(o==a?a.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:r,any:i,precise:a,byWord:o}=this;if(t.length==1){let i=w(e,0),a=n(i),o=a==e.length?0:-100;if(i!=t[0])if(i==r[0])o+=-200;else return null;return this.ret(o,[0,a])}let s=e.indexOf(this.pattern);if(s==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let c=t.length,l=0;if(s<0){for(let a=0,o=Math.min(e.length,200);a<o&&l<c;){let o=w(e,a);(o==t[l]||o==r[l])&&(i[l++]=a),a+=n(o)}if(l<c)return null}let u=0,d=0,f=!1,p=0,m=-1,h=-1,g=/[a-z]/.test(e),v=!0;for(let i=0,l=Math.min(e.length,200),y=0;i<l&&d<c;){let l=w(e,i);s<0&&(u<c&&l==t[u]&&(a[u++]=i),p<c&&(l==t[p]||l==r[p]?(p==0&&(m=i),h=i+1,p++):p=0));let b,x=l<255?l>=48&&l<=57||l>=97&&l<=122?2:+(l>=65&&l<=90):(b=_(l))==b.toLowerCase()?b==b.toUpperCase()?0:2:1;(!i||x==1&&g||y==0&&x!=0)&&(t[d]==l||r[d]==l&&(f=!0)?o[d++]=i:o.length&&(v=!1)),y=x,i+=n(l)}return d==c&&o[0]==0&&v?this.result(-100+(f?-200:0),o,e):p==c&&m==0?this.ret(-200-e.length+(h==e.length?0:-100),[0,h]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):p==c?this.ret(-900-e.length,[m,h]):d==c?this.result(-100+(f?-200:0)+-700+(v?0:-1100),o,e):t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,r){let i=[],a=0;for(let e of t){let t=e+(this.astral?n(w(r,e)):1);a&&i[a-1]==e?i[a-1]=t:(i[a++]=e,i[a++]=t)}return this.ret(e-r.length,i)}},ue=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},M=ee.define({combine(e){return g(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:fe,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>de(e(n),t(n)),optionClass:(e,t)=>n=>de(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function de(e,t){return e?t?e+` `+t:e:t}function fe(e,t,n,r,i,a){let o=e.textDirection==y.RTL,s=o,c=!1,l=`top`,u,d,f=t.left-i.left,p=i.right-t.right,m=r.right-r.left,h=r.bottom-r.top;if(s&&f<Math.min(m,p)?s=!1:!s&&p<Math.min(m,f)&&(s=!0),m<=(s?f:p))u=Math.max(i.top,Math.min(n.top,i.bottom-h))-t.top,d=Math.min(400,s?f:p);else{c=!0,d=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=h||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let g=(t.bottom-t.top)/a.offsetHeight,_=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/g}px; max-width: ${d/_}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var N=i.define();function pe(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function P(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}var me=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass=``;let r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(M);this.optionContent=pe(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=P(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:N.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(M).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:j.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener(`scroll`,()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;(!n.open||n.open.options!=r)&&(this.range=P(r.length,i,e.state.facet(M).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=P(t.options.length,t.selected,this.view.state.facet(M).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>C(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&ge(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(M).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0))if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function he(e,t){return n=>new me(n,e,t)}function ge(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function F(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function _e(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(M);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new ae(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new ue(n):new le(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new ae(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):F(e.completion)>F(c)&&(s[s.length-1]=e),c=e.completion}return s}var ve=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,I(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=_e(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(M).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,I(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:Ee,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},ye=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(Ce,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(M),i=(r.override||n.languageDataAt(`autocomplete`,D(n)).map(ce)).map(e=>(this.active.find(t=>t.source==e)||new R(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(z));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!be(i,this.active)||o?a=ve.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new R(e.source,0):e));for(let e of t.effects)e.is(N)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?xe:Se}};function be(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var xe={"aria-autocomplete":`list`},Se={};function I(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var Ce=[];function L(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(k);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var R=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=L(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(A))i=new e(i.source,1,n.value);else if(n.is(j))i=new e(i.source,0);else if(n.is(z))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(D(e.state))}},we=class e extends R{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=D(t.state);if(o>a||!r||n&2&&(D(t.startState)==this.from||o<this.limit))return new R(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return Te(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new T(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??D(t.state)):new R(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new e(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new R(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function Te(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):O(e,!0).test(i)}var z=i.define({map(e,t){return e.map(e=>e.map(t))}}),B=a.define({create(){return ye.start()},update(e,t){return e.update(t)},provide:e=>[te.from(e,e=>e.tooltip),v.contentAttributes.from(e,e=>e.attrs)]});function V(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(B).active.find(e=>e.source==t.source);return r instanceof we?(typeof n==`string`?e.dispatch({...oe(e.state,n,r.from,r.to),annotations:k.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}var Ee=he(B,V);function H(e,t=`option`){return n=>{let r=n.state.field(B,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(M).interactionDelay)return!1;let i=1,a;t==`page`&&(a=b(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector(`li`).offsetHeight)-1));let{length:o}=r.open.options,s=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:o-1;return s<0?s=t==`page`?0:o-1:s>=o&&(s=t==`page`?o-1:0),n.dispatch({effects:N.of(s)}),!0}}var De=e=>{let t=e.state.field(B,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(M).interactionDelay?!1:V(e,t.open.options[t.open.selected])},U=e=>e.state.field(B,!1)?(e.dispatch({effects:A.of(!0)}),!0):!1,Oe=e=>{let t=e.state.field(B,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:j.of(null)}),!0)},ke=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},Ae=50,je=1e3,Me=f.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(B).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(B),n=e.state.facet(M);if(!e.selectionSet&&!e.docChanged&&e.startState.field(B)==t)return;let r=e.transactions.some(e=>{let t=L(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>Ae&&Date.now()-n.time>je){for(let e of n.context.abortListeners)try{e()}catch(e){C(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(A)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(B);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(M).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new T(t,D(t),e.explicit,this.view),r=new ke(e,n);this.running.push(r),Promise.resolve(e.source(n)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:j.of(null)}),C(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(M).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(M),n=this.view.state.field(B);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=D(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new we(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending)if(i.done==null){let n=new R(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:z.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(B,!1);if(t&&t.tooltip&&this.view.state.facet(M).closeOnBlur){let n=t.open&&b(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:j.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:A.of(!1)}),20),this.composing=0}}}),Ne=typeof navigator==`object`&&/Win/.test(navigator.platform),Pe=S.highest(v.domEventHandlers({keydown(e,t){let n=t.state.field(B,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Ne&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&V(t,r),!1}})),W=v.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`,cursor:`pointer`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),Fe=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},Ie=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(n){let r=n.mapPos(this.from,-1,t.TrackDel),i=n.mapPos(this.to,1,t.TrackDel);return r==null||i==null?null:new e(this.field,r,i)}},Le=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(l);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new Ie(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new Fe(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},Re=o.widget({widget:new class extends e{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),ze=o.mark({class:`cm-snippetField`}),G=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=o.set(e.map(e=>(e.from==e.to?Re:ze).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},K=i.define({map(e,t){return e&&e.map(t)}}),Be=i.define(),q=a.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(K))return n.value;if(n.is(Be)&&e)return new G(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>v.decorations.from(e,e=>e?e.deco:o.none)});function J(e,t){return r.create(e.filter(e=>e.field==t).map(e=>r.range(e.from,e.to)))}function Ve(e){let t=Le.parse(e);return(e,n,r,a)=>{let{text:o,ranges:c}=t.instantiate(e.state,r),{main:l}=e.state.selection,u={changes:{from:r,to:a==l.from?l.to:a,insert:s.of(o)},scrollIntoView:!0,annotations:n?[k.of(n),p.userEvent.of(`input.complete`)]:void 0};if(c.length&&(u.selection=J(c,0)),c.some(e=>e.field>0)){let t=new G(c,0),n=u.effects=[K.of(t)];e.state.field(q,!1)===void 0&&n.push(i.appendConfig.of([q,Ge,qe,W]))}e.dispatch(e.state.update(u))}}function He(e){return({state:t,dispatch:n})=>{let r=t.field(q,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:J(r.ranges,i),effects:K.of(a?null:new G(r.ranges,i)),scrollIntoView:!0})),!0}}var Ue=[{key:`Tab`,run:He(1),shift:He(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(q,!1)?(t(e.update({effects:K.of(null)})),!0):!1}],We=ee.define({combine(e){return e.length?e[0]:Ue}}),Ge=S.highest(x.compute([We],e=>e.facet(We)));function Ke(e,t){return{...t,apply:Ve(e)}}var qe=v.domEventHandlers({mousedown(e,t){let n=t.state.field(q,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:J(n.ranges,i.field),effects:K.of(n.ranges.some(e=>e.field>i.field)?new G(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),Y={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},X=i.define({map(e,n){return n.mapPos(e,-1,t.TrackAfter)??void 0}}),Z=new class extends d{};Z.startSide=1,Z.endSide=-1;var Je=a.define({create(){return c.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(X)&&(e=e.update({add:[Z.range(n.value,n.value+1)]}));return e}});function Ye(){return[et,Je]}var Xe=`()[]{}<>«»»«[]{}`;function Ze(e){for(let t=0;t<16;t+=2)if(Xe.charCodeAt(t)==e)return Xe.charAt(t+1);return _(e<128?e:e+1)}function Qe(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||Y}var $e=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),et=v.inputHandler.of((e,t,r,i)=>{if(($e?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let a=e.state.selection.main;if(i.length>2||i.length==2&&n(w(i,0))==1||t!=a.from||r!=a.to)return!1;let o=nt(e.state,i);return o?(e.dispatch(o),!0):!1}),tt=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Qe(e,e.selection.main.head).brackets||Y.brackets,i=null,a=e.changeByRange(t=>{if(t.empty){let i=rt(e.doc,t.head);for(let a of n)if(a==i&&$(e.doc,t.head)==Ze(w(a,0)))return{changes:{from:t.head-a.length,to:t.head+a.length},range:r.cursor(t.head-a.length)}}return{range:i=t}});return i||t(e.update(a,{scrollIntoView:!0,userEvent:`delete.backward`})),!i}}];function nt(e,t){let n=Qe(e,e.selection.main.head),r=n.brackets||Y.brackets;for(let i of r){let a=Ze(w(i,0));if(t==i)return a==i?ot(e,i,r.indexOf(i+i+i)>-1,n):it(e,i,a,n.before||Y.before);if(t==a&&Q(e,e.selection.main.from))return at(e,i,a)}return null}function Q(e,t){let n=!1;return e.field(Je).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function $(e,t){let r=e.sliceString(t,t+2);return r.slice(0,n(w(r,0)))}function rt(e,t){let r=e.sliceString(t-2,t);return n(w(r,0))==r.length?r:r.slice(1)}function it(e,t,n,i){let a=null,o=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:X.of(o.to+t.length),range:r.range(o.anchor+t.length,o.head+t.length)};let s=$(e.doc,o.head);return!s||/\s/.test(s)||i.indexOf(s)>-1?{changes:{insert:t+n,from:o.head},effects:X.of(o.head+t.length),range:r.cursor(o.head+t.length)}:{range:a=o}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function at(e,t,n){let i=null,a=e.changeByRange(t=>t.empty&&$(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:r.cursor(t.head+n.length)}:i={range:t});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function ot(e,t,n,i){let a=i.stringPrefixes||Y.stringPrefixes,o=null,s=e.changeByRange(i=>{if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:t,from:i.to}],effects:X.of(i.to+t.length),range:r.range(i.anchor+t.length,i.head+t.length)};let s=i.head,c=$(e.doc,s),l;if(c==t){if(st(e,s))return{changes:{insert:t+t,from:s},effects:X.of(s+t.length),range:r.cursor(s+t.length)};if(Q(e,s)){let i=n&&e.sliceDoc(s,s+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:s,to:s+i.length,insert:i},range:r.cursor(s+i.length)}}}else if(n&&e.sliceDoc(s-2*t.length,s)==t+t&&(l=lt(e,s-2*t.length,a))>-1&&st(e,l))return{changes:{insert:t+t+t+t,from:s},effects:X.of(s+t.length),range:r.cursor(s+t.length)};else if(e.charCategorizer(s)(c)!=h.Word&<(e,s,a)>-1&&!ct(e,s,t,a))return{changes:{insert:t+t,from:s},effects:X.of(s+t.length),range:r.cursor(s+t.length)};return{range:o=i}});return o?null:e.update(s,{scrollIntoView:!0,userEvent:`input.type`})}function st(e,t){let n=u(e).resolveInner(t+1);return n.parent&&n.from==t}function ct(e,t,n,r){let i=u(e).resolveInner(t,-1),a=r.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+a)),s=o.indexOf(n);if(!s||s>-1&&r.indexOf(o.slice(0,s))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+s;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function lt(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=h.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=h.Word)return n}return-1}function ut(e={}){return[Pe,B,M.of(e),Me,ft,W]}var dt=[{key:`Ctrl-Space`,run:U},{mac:"Alt-`",run:U},{mac:`Alt-i`,run:U},{key:`Escape`,run:Oe},{key:`ArrowDown`,run:H(!0)},{key:`ArrowUp`,run:H(!1)},{key:`PageDown`,run:H(!0,`page`)},{key:`PageUp`,run:H(!1,`page`)},{key:`Enter`,run:De}],ft=S.highest(x.computeN([M],e=>e.facet(M).defaultKeymap?[dt]:[]));export{re as a,Ke as c,tt as i,ut as n,dt as o,Ye as r,ie as s,T as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CYidjpOJ.js";import{Dt as t,L as n,P as r,R as i,T as a,X as o,b as s,o as c,q as l,r as ee,u as te}from"./dist-BSAh-TK7.js";import{n as u,r as ne,t as re}from"./dist-DPG-4B8V.js";import{n as d,t as ie}from"./dist-DwFjOxj-.js";import{a as ae,i as oe,n as se,o as ce,r as f}from"./dist-CADCdgrq.js";var le=55,ue=1,de=56,fe=2,pe=57,me=3,p=4,he=5,m=6,ge=7,h=8,g=9,_=10,_e=11,ve=12,ye=13,v=58,be=14,xe=15,y=59,b=21,Se=23,x=24,Ce=25,S=27,C=28,we=29,Te=32,Ee=35,De=37,Oe=38,ke=0,Ae=1,je={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},Me={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},w={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function Ne(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}var T=null,E=null,D=0;function O(e,t){let n=e.pos+t;if(D==n&&E==e)return T;let r=e.peek(t),i=``;for(;Ne(r);)i+=String.fromCharCode(r),r=e.peek(++t);return E=e,D=n,T=i?i.toLowerCase():r==Pe||r==Fe?void 0:null}var k=60,A=62,j=47,Pe=63,Fe=33,Ie=45;function M(e,t){this.name=e,this.parent=t}var Le=[m,_,ge,h,g],Re=new re({start:null,shift(e,t,n,r){return Le.indexOf(t)>-1?new M(O(r,1)||``,e):e},reduce(e,t){return t==b&&e?e.parent:e},reuse(e,t,n,r){let i=t.type.id;return i==m||i==De?new M(O(r,1)||``,e):e},strict:!1}),ze=new u((e,t)=>{if(e.next!=k){e.next<0&&t.context&&e.acceptToken(v);return}e.advance();let n=e.next==j;n&&e.advance();let r=O(e,0);if(r===void 0)return;if(!r)return e.acceptToken(n?xe:be);let i=t.context?t.context.name:null;if(n){if(r==i)return e.acceptToken(_e);if(i&&Me[i])return e.acceptToken(v,-2);if(t.dialectEnabled(ke))return e.acceptToken(ve);for(let e=t.context;e;e=e.parent)if(e.name==r)return;e.acceptToken(ye)}else{if(r==`script`)return e.acceptToken(ge);if(r==`style`)return e.acceptToken(h);if(r==`textarea`)return e.acceptToken(g);if(je.hasOwnProperty(r))return e.acceptToken(_);i&&w[i]&&w[i][r]?e.acceptToken(v,-1):e.acceptToken(m)}},{contextual:!0}),Be=new u(e=>{for(let t=0,n=0;;n++){if(e.next<0){n&&e.acceptToken(y);break}if(e.next==Ie)t++;else if(e.next==A&&t>=2){n>=3&&e.acceptToken(y,-2);break}else t=0;e.advance()}});function Ve(e){for(;e;e=e.parent)if(e.name==`svg`||e.name==`math`)return!0;return!1}var He=new u((e,t)=>{if(e.next==j&&e.peek(1)==A){let n=t.dialectEnabled(Ae)||Ve(t.context);e.acceptToken(n?he:p,2)}else e.next==A&&e.acceptToken(p,1)});function N(e,t,n){let r=2+e.length;return new u(i=>{for(let a=0,o=0,s=0;;s++){if(i.next<0){s&&i.acceptToken(t);break}if(a==0&&i.next==k||a==1&&i.next==j||a>=2&&a<r&&i.next==e.charCodeAt(a-2))a++,o++;else if(a==r&&i.next==A){s>o?i.acceptToken(t,-o):i.acceptToken(n,-(o-2));break}else if((i.next==10||i.next==13)&&s){i.acceptToken(t,1);break}else a=o=0;i.advance()}})}var Ue=N(`script`,le,ue),We=N(`style`,de,fe),Ge=N(`textarea`,pe,me),Ke=n({"Text RawText IncompleteTag IncompleteCloseTag":i.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":i.angleBracket,TagName:i.tagName,"MismatchedCloseTag/TagName":[i.tagName,i.invalid],AttributeName:i.attributeName,"AttributeValue UnquotedAttributeValue":i.attributeValue,Is:i.definitionOperator,"EntityReference CharacterReference":i.character,Comment:i.blockComment,ProcessingInst:i.processingInstruction,DoctypeDecl:i.documentMeta}),qe=ne.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO)fQ&rO1G/ZOOOa-E7]-E7]O)qQ#tO'#CzOOO`1G.w1G.wOOOb-E7^-E7^O)vQ#tO'#C}OOOd-E7_-E7_O){Q#tO'#DQOOO`-E7`-E7`O*QQ#|O,59nOOOp-E7a-E7aOOO`1G/[1G/[OOO`1G/^1G/^OOO`1G/_1G/_O*VQ,UO,59`OOQW-E7Y-E7YOOOa7+$d7+$dOOO`7+$u7+$uOOOb7+$m7+$mOOOd7+$p7+$pOOO`7+$s7+$sO*bQ#|O,59fO*gQ#|O,59iO*lQ#|O,59lOOO`1G/Y1G/YO*qO7[O'#CwO+SOMhO'#CwOOQW1G.z1G.zOOO`1G/Q1G/QOOO`1G/T1G/TOOO`1G/W1G/WOOOO'#D]'#D]O+eO7[O,59cOOQW,59c,59cOOOO'#D^'#D^O+vOMhO,59cOOOO-E7Z-E7ZOOQW1G.}1G.}OOOO-E7[-E7[",stateData:`,c~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~`,goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:`⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl`,maxTerm:68,context:Re,nodeProps:[[`closedBy`,-10,1,2,3,7,8,9,10,11,12,13,`EndTag`,6,`EndTag SelfClosingEndTag`,-4,22,31,34,37,`CloseTag`],[`openedBy`,4,`StartTag StartCloseTag`,5,`StartTag`,-4,30,33,36,38,`OpenTag`],[`group`,-10,14,15,18,19,20,21,40,41,42,43,`Entity`,17,`Entity TextContent`,-3,29,32,35,`TextContent Entity`],[`isolate`,-11,22,30,31,33,34,36,37,38,39,42,43,`ltr`,-3,27,28,40,``]],propSources:[Ke],skippedNodes:[0],repeatNodeCount:9,tokenData:"!<p!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs3_sv-_vw3}wxHYx}-_}!OH{!O!P-_!P!Q$q!Q![-_![!]Mz!]!^-_!^!_!$S!_!`!;x!`!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4U-_4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!Z$|caPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr$qrs&}sv$qvw+Pwx(tx!^$q!^!_*V!_!a&X!a#S$q#S#T&X#T;'S$q;'S;=`+z<%lO$q!R&bXaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&Xq'UVaP!dpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}P'pTaPOv'kw!^'k!_;'S'k;'S;=`(P<%lO'kP(SP;=`<%l'kp([S!dpOv(Vx;'S(V;'S;=`(h<%lO(Vp(kP;=`<%l(Vq(qP;=`<%l&}a({WaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t`)jT!b`Or)esv)ew;'S)e;'S;=`)y<%lO)e`)|P;=`<%l)ea*SP;=`<%l(t!Q*^V!b`!dpOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!Q*vP;=`<%l*V!R*|P;=`<%l&XW+UYlWOX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+PW+wP;=`<%l+P!Z+}P;=`<%l$q!a,]`aP!b`!dp!_^OX&XXY,QYZ,QZ]&X]^,Q^p&Xpq,Qqr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!_-ljiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q[/ebiSlWOX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+PS0rXiSqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0mS1bP;=`<%l0m[1hP;=`<%l/^!V1vciSaP!b`!dpOq&Xqr1krs&}sv1kvw0mwx(tx!P1k!P!Q&X!Q!^1k!^!_*V!_!a&X!a#s1k#s$f&X$f;'S1k;'S;=`3R<%l?Ah1k?Ah?BY&X?BY?Mn1k?MnO&X!V3UP;=`<%l1k!_3[P;=`<%l-_!Z3hV!ahaP!dpOv&}wx'kx!^&}!^!_(V!_;'S&};'S;=`(n<%lO&}!_4WiiSlWd!ROX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst>]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!V<QciSOp7Sqr;{rs7Sst0mtw;{wx7Sx!P;{!P!Q7S!Q!];{!]!^=]!^!a7S!a#s;{#s$f7S$f;'S;{;'S;=`>P<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TalWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOc!R!RAwP;=`<%lAY!ZBRYlWc!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbiSlWc!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbiSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXiSc!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!cxaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYliSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_kiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_XaP!b`!dp!fQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZiSgQaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!b`!dpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!b`!dp!ePOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!b`!dpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!b`!dpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!b`!dpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!b`!dpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!b`!dpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!b`!dpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!b`!dpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!dpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO|PP!-nP;=`<%l!-Sq!-xS!dp|POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!b`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!b`|POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!b`!dp|POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!b`!dpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!b`!dpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!b`!dpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!b`!dpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!b`!dpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!b`!dpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!<TXjSaP!b`!dpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[Ue,We,Ge,He,ze,Be,0,1,2,3,4,5],topRules:{Document:[0,16]},dialects:{noMatch:0,selfClosing:515},tokenPrec:517});function P(e,t){let n=Object.create(null);for(let r of e.getChildren(x)){let e=r.getChild(Ce),i=r.getChild(S)||r.getChild(C);e&&(n[t.read(e.from,e.to)]=i?i.type.id==S?t.read(i.from+1,i.to-1):t.read(i.from,i.to):``)}return n}function F(e,t){let n=e.getChild(Se);return n?t.read(n.from,n.to):` `}function I(e,t,n){let r;for(let i of n)if(!i.attrs||i.attrs(r||=P(e.node.parent.firstChild,t)))return{parser:i.parser,bracketed:!0};return null}function Je(e=[],t=[]){let n=[],r=[],i=[],a=[];for(let t of e)(t.tag==`script`?n:t.tag==`style`?r:t.tag==`textarea`?i:a).push(t);let o=t.length?Object.create(null):null;for(let e of t)(o[e.name]||(o[e.name]=[])).push(e);return l((e,t)=>{let s=e.type.id;if(s==we)return I(e,t,n);if(s==Te)return I(e,t,r);if(s==Ee)return I(e,t,i);if(s==b&&a.length){let n=e.node,r=n.firstChild,i=r&&F(r,t),o;if(i){for(let e of a)if(e.tag==i&&(!e.attrs||e.attrs(o||=P(r,t)))){let t=n.lastChild,i=t.type.id==Oe?t.from:n.to;if(i>r.to)return{parser:e.parser,overlay:[{from:r.to,to:i}]}}}}if(o&&s==x){let n=e.node,r;if(r=n.firstChild){let e=o[t.read(r.from,r.to)];if(e)for(let r of e){if(r.tagName&&r.tagName!=F(n.parent,t))continue;let e=n.lastChild;if(e.type.id==S){let t=e.from+1,n=e.lastChild,i=e.to-(n&&n.isError?0:1);if(i>t)return{parser:r.parser,overlay:[{from:t,to:i}],bracketed:!0}}else if(e.type.id==C)return{parser:r.parser,overlay:[{from:e.from,to:e.to}]}}}}return null})}var Ye=e({autoCloseTags:()=>lt,html:()=>st,htmlCompletionSource:()=>tt,htmlCompletionSourceWith:()=>nt,htmlLanguage:()=>$}),L=[`_blank`,`_self`,`_top`,`_parent`],R=[`ascii`,`utf-8`,`utf-16`,`latin1`,`latin1`],z=[`get`,`post`,`put`,`delete`],B=[`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`],V=[`true`,`false`],H={},Xe={a:{attrs:{href:null,ping:null,type:null,media:null,target:L,hreflang:null}},abbr:H,address:H,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:[`default`,`rect`,`circle`,`poly`]}},article:H,aside:H,audio:{attrs:{src:null,mediagroup:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`none`,`metadata`,`auto`],autoplay:[`autoplay`],loop:[`loop`],controls:[`controls`]}},b:H,base:{attrs:{href:null,target:L}},bdi:H,bdo:H,blockquote:{attrs:{cite:null}},body:H,br:H,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:[`autofocus`],disabled:[`autofocus`],formenctype:B,formmethod:z,formnovalidate:[`novalidate`],formtarget:L,type:[`submit`,`reset`,`button`]}},canvas:{attrs:{width:null,height:null}},caption:H,center:H,cite:H,code:H,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:[`command`,`checkbox`,`radio`],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:[`disabled`],checked:[`checked`]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:[`disabled`],multiple:[`multiple`]}},datalist:{attrs:{data:null}},dd:H,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:[`open`]}},dfn:H,div:H,dl:H,dt:H,em:H,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:[`disabled`],form:null,name:null}},figcaption:H,figure:H,footer:H,form:{attrs:{action:null,name:null,"accept-charset":R,autocomplete:[`on`,`off`],enctype:B,method:z,novalidate:[`novalidate`],target:L}},h1:H,h2:H,h3:H,h4:H,h5:H,h6:H,head:{children:[`title`,`base`,`link`,`style`,`meta`,`script`,`noscript`,`command`]},header:H,hgroup:H,hr:H,html:{attrs:{manifest:null}},i:H,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:[`allow-top-navigation`,`allow-same-origin`,`allow-forms`,`allow-scripts`],seamless:[`seamless`]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:[`audio/*`,`video/*`,`image/*`],autocomplete:[`on`,`off`],autofocus:[`autofocus`],checked:[`checked`],disabled:[`disabled`],formenctype:B,formmethod:z,formnovalidate:[`novalidate`],formtarget:L,multiple:[`multiple`],readonly:[`readonly`],required:[`required`],type:[`hidden`,`text`,`search`,`tel`,`url`,`email`,`password`,`datetime`,`date`,`month`,`week`,`time`,`datetime-local`,`number`,`range`,`color`,`checkbox`,`radio`,`file`,`submit`,`image`,`reset`,`button`]}},ins:{attrs:{cite:null,datetime:null}},kbd:H,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:[`autofocus`],disabled:[`disabled`],keytype:[`RSA`]}},label:{attrs:{for:null,form:null}},legend:H,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:[`all`,`16x16`,`16x16 32x32`,`16x16 32x32 64x64`]}},map:{attrs:{name:null}},mark:H,menu:{attrs:{label:null,type:[`list`,`context`,`toolbar`]}},meta:{attrs:{content:null,charset:R,name:[`viewport`,`application-name`,`author`,`description`,`generator`,`keywords`],"http-equiv":[`content-language`,`content-type`,`default-style`,`refresh`]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:H,noscript:H,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:[`typemustmatch`]}},ol:{attrs:{reversed:[`reversed`],start:null,type:[`1`,`a`,`A`,`i`,`I`]},children:[`li`,`script`,`template`,`ul`,`ol`]},optgroup:{attrs:{disabled:[`disabled`],label:null}},option:{attrs:{disabled:[`disabled`],label:null,selected:[`selected`],value:null}},output:{attrs:{for:null,form:null,name:null}},p:H,param:{attrs:{name:null,value:null}},pre:H,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:H,rt:H,ruby:H,samp:H,script:{attrs:{type:[`text/javascript`],src:null,async:[`async`],defer:[`defer`],charset:R}},section:H,select:{attrs:{form:null,name:null,size:null,autofocus:[`autofocus`],disabled:[`disabled`],multiple:[`multiple`]}},slot:{attrs:{name:null}},small:H,source:{attrs:{src:null,type:null,media:null}},span:H,strong:H,style:{attrs:{type:[`text/css`],media:null,scoped:null}},sub:H,summary:H,sup:H,table:H,tbody:H,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:H,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:[`autofocus`],disabled:[`disabled`],readonly:[`readonly`],required:[`required`],wrap:[`soft`,`hard`]}},tfoot:H,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:[`row`,`col`,`rowgroup`,`colgroup`]}},thead:H,time:{attrs:{datetime:null}},title:H,tr:H,track:{attrs:{src:null,label:null,default:null,kind:[`subtitles`,`captions`,`descriptions`,`chapters`,`metadata`],srclang:null}},ul:{children:[`li`,`script`,`template`,`ul`,`ol`]},var:H,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`auto`,`metadata`,`none`],autoplay:[`autoplay`],mediagroup:[`movie`],muted:[`muted`],controls:[`controls`]}},wbr:H},U={accesskey:null,class:null,contenteditable:V,contextmenu:null,dir:[`ltr`,`rtl`,`auto`],draggable:[`true`,`false`,`auto`],dropzone:[`copy`,`move`,`link`,`string:`,`file:`],hidden:[`hidden`],id:null,inert:[`inert`],itemid:null,itemprop:null,itemref:null,itemscope:[`itemscope`],itemtype:null,lang:[`ar`,`bn`,`de`,`en-GB`,`en-US`,`es`,`fr`,`hi`,`id`,`ja`,`pa`,`pt`,`ru`,`tr`,`zh`],spellcheck:V,autocorrect:V,autocapitalize:V,style:null,tabindex:null,title:null,translate:[`yes`,`no`],rel:[`stylesheet`,`alternate`,`author`,`bookmark`,`help`,`license`,`next`,`nofollow`,`noreferrer`,`prefetch`,`prev`,`search`,`tag`],role:`alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer`.split(` `),"aria-activedescendant":null,"aria-atomic":V,"aria-autocomplete":[`inline`,`list`,`both`,`none`],"aria-busy":V,"aria-checked":[`true`,`false`,`mixed`,`undefined`],"aria-controls":null,"aria-describedby":null,"aria-disabled":V,"aria-dropeffect":null,"aria-expanded":[`true`,`false`,`undefined`],"aria-flowto":null,"aria-grabbed":[`true`,`false`,`undefined`],"aria-haspopup":V,"aria-hidden":V,"aria-invalid":[`true`,`false`,`grammar`,`spelling`],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":[`off`,`polite`,`assertive`],"aria-multiline":V,"aria-multiselectable":V,"aria-owns":null,"aria-posinset":null,"aria-pressed":[`true`,`false`,`mixed`,`undefined`],"aria-readonly":V,"aria-relevant":null,"aria-required":V,"aria-selected":[`true`,`false`,`undefined`],"aria-setsize":null,"aria-sort":[`ascending`,`descending`,`none`,`other`],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},W=`beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload`.split(` `).map(e=>`on`+e);for(let e of W)U[e]=null;var G=class{constructor(e,t){this.tags={...Xe,...e},this.globalAttrs={...U,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};G.default=new G;function K(e,t,n=e.length){if(!t)return``;let r=t.firstChild,i=r&&r.getChild(`TagName`);return i?e.sliceString(i.from,Math.min(i.to,n)):``}function q(e,t=!1){for(;e;e=e.parent)if(e.name==`Element`)if(t)t=!1;else return e;return null}function J(e,t,n){return n.tags[K(e,q(t))]?.children||n.allTags}function Y(e,t){let n=[];for(let r=q(t);r&&!r.type.isTop;r=q(r.parent)){let i=K(e,r);if(i&&r.lastChild.name==`CloseTag`)break;i&&n.indexOf(i)<0&&(t.name==`EndTag`||t.from>=r.firstChild.to)&&n.push(i)}return n}var X=/^[:\-\.\w\u00b7-\uffff]*$/;function Z(e,t,n,r,i){let a=/\s*>/.test(e.sliceDoc(i,i+5))?``:`>`,o=q(n,n.name==`StartTag`||n.name==`TagName`);return{from:r,to:i,options:J(e.doc,o,t).map(e=>({label:e,type:`type`})).concat(Y(e.doc,n).map((e,t)=>({label:`/`+e,apply:`/`+e+a,type:`type`,boost:99-t}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function Q(e,t,n,r){let i=/\s*>/.test(e.sliceDoc(r,r+5))?``:`>`;return{from:n,to:r,options:Y(e.doc,t).map((e,t)=>({label:e,apply:e+i,type:`type`,boost:99-t})),validFor:X}}function Ze(e,t,n,r){let i=[],a=0;for(let r of J(e.doc,n,t))i.push({label:`<`+r,type:`type`});for(let t of Y(e.doc,n))i.push({label:`</`+t+`>`,type:`type`,boost:99-a++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Qe(e,t,n,r,i){let a=q(n),o=a?t.tags[K(e.doc,a)]:null,s=o&&o.attrs?Object.keys(o.attrs):[];return{from:r,to:i,options:(o&&o.globalAttrs===!1?s:s.length?s.concat(t.globalAttrNames):t.globalAttrNames).map(e=>({label:e,type:`property`})),validFor:X}}function $e(e,t,n,r,i){let a=n.parent?.getChild(`AttributeName`),o=[],s;if(a){let c=e.sliceDoc(a.from,a.to),l=t.globalAttrs[c];if(!l){let r=q(n),i=r?t.tags[K(e.doc,r)]:null;l=i?.attrs&&i.attrs[c]}if(l){let t=e.sliceDoc(r,i).toLowerCase(),n=`"`,a=`"`;/^['"]/.test(t)?(s=t[0]==`"`?/^[^"]*$/:/^[^']*$/,n=``,a=e.sliceDoc(i,i+1)==t[0]?``:t[0],t=t.slice(1),r++):s=/^[^\s<>='"]*$/;for(let e of l)o.push({label:e,apply:n+e+a,type:`constant`})}}return{from:r,to:i,options:o,validFor:s}}function et(e,t){let{state:n,pos:i}=t,a=r(n).resolveInner(i,-1),o=a.resolve(i);for(let e=i,t;o==a&&(t=a.childBefore(e));){let n=t.lastChild;if(!n||!n.type.isError||n.from<n.to)break;o=a=t,e=n.from}return a.name==`TagName`?a.parent&&/CloseTag$/.test(a.parent.name)?Q(n,a,a.from,i):Z(n,e,a,a.from,i):a.name==`StartTag`||a.name==`IncompleteTag`?Z(n,e,a,i,i):a.name==`StartCloseTag`||a.name==`IncompleteCloseTag`?Q(n,a,i,i):a.name==`OpenTag`||a.name==`SelfClosingTag`||a.name==`AttributeName`?Qe(n,e,a,a.name==`AttributeName`?a.from:i,i):a.name==`Is`||a.name==`AttributeValue`||a.name==`UnquotedAttributeValue`?$e(n,e,a,a.name==`Is`?i:a.from,i):t.explicit&&(o.name==`Element`||o.name==`Text`||o.name==`Document`)?Ze(n,e,a,i):null}function tt(e){return et(G.default,e)}function nt(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new G(t,n):G.default;return e=>et(r,e)}var rt=f.parser.configure({top:`SingleExpression`}),it=[{tag:`script`,attrs:e=>e.type==`text/typescript`||e.lang==`ts`,parser:ce.parser},{tag:`script`,attrs:e=>e.type==`text/babel`||e.type==`text/jsx`,parser:oe.parser},{tag:`script`,attrs:e=>e.type==`text/typescript-jsx`,parser:ae.parser},{tag:`script`,attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:rt},{tag:`script`,attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:f.parser},{tag:`style`,attrs(e){return(!e.lang||e.lang==`css`)&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:d.parser}],at=[{name:`style`,parser:d.parser.configure({top:`Styles`})}].concat(W.map(e=>({name:e,parser:f.parser}))),ot=ee.define({name:`html`,parser:qe.configure({props:[a.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,n;for(let n=e.node;;){let e=n.lastChild;if(!e||e.name!=`Element`||e.to!=n.to)break;t=n=e}return t&&!((n=t.lastChild)&&(n.name==`CloseTag`||n.name==`SelfClosingTag`))?e.lineIndent(t.from)+e.unit:null}}),s.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!=`OpenTag`?null:{from:t.to,to:n.name==`CloseTag`?n.from:e.to}}}),te.add({"OpenTag CloseTag":e=>e.getChild(`TagName`)})]}),languageData:{commentTokens:{block:{open:`<!--`,close:`-->`}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:`-_`}}),$=ot.configure({wrap:Je(it,at)});function st(e={}){let t=``,n;return e.matchClosingTags===!1&&(t=`noMatch`),e.selfClosingTags===!0&&(t=(t?t+` `:``)+`selfClosing`),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=Je((e.nestedLanguages||[]).concat(it),(e.nestedAttributes||[]).concat(at))),new c(n?ot.configure({wrap:n,dialect:t}):t?$.configure({dialect:t}):$,[$.data.of({autocomplete:nt(e)}),e.autoCloseTags===!1?[]:lt,se().support,ie().support])}var ct=new Set(`area base br col command embed frame hr img input keygen link meta param source track wbr menuitem`.split(` `)),lt=o.inputHandler.of((e,n,i,a,o)=>{if(e.composing||e.state.readOnly||n!=i||a!=`>`&&a!=`/`||!$.isActiveAt(e.state,n,-1))return!1;let s=o(),{state:c}=s,l=c.changeByRange(e=>{let n=c.doc.sliceString(e.from-1,e.to)==a,{head:i}=e,o=r(c).resolveInner(i,-1),s;if(n&&a==`>`&&o.name==`EndTag`){let t=o.parent;if(t.parent?.lastChild?.name!=`CloseTag`&&(s=K(c.doc,t.parent,i))&&!ct.has(s))return{range:e,changes:{from:i,to:i+ +(c.doc.sliceString(i,i+1)===`>`),insert:`</${s}>`}}}else if(n&&a==`/`&&o.name==`IncompleteCloseTag`){let e=o.parent;if(o.from==i-2&&e.lastChild?.name!=`CloseTag`&&(s=K(c.doc,e,i))&&!ct.has(s)){let e=i+ +(c.doc.sliceString(i,i+1)===`>`),n=`${s}>`;return{range:t.cursor(i+n.length,-1),changes:{from:i,to:e,insert:n}}}}return{range:e}});return l.changes.empty?!1:(e.dispatch([s,c.update(l,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)});export{st as n,tt as r,Ye as t};
|