@inkeep/open-knowledge 0.53.0-beta.0 → 0.53.0-beta.1
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-DvXLWBwm.mjs → acp-harness-probe-s3CqzCCO.mjs} +2 -2
- package/dist/cli.mjs +6 -6
- package/dist/config-schema.json +12 -3
- package/dist/config.project-local.schema.json +1 -1
- package/dist/config.project.schema.json +11 -2
- package/dist/constants-LXoEgYJe.mjs +2 -0
- package/dist/{fs-traced-DV9uD41t.mjs → fs-traced-CBFyXjv8.mjs} +2 -2
- package/dist/fs-traced-CChInc-O.mjs +1 -0
- package/dist/{git-handle-VuHcNtS4.mjs → git-handle-CjkVOyU7.mjs} +2 -2
- package/dist/git-handle-OIwLbjAT.mjs +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +91 -91
- package/dist/{init-ja0T-etx.mjs → init-BSKAqmkk.mjs} +3 -3
- package/dist/init-D6zgpP-Z.mjs +1 -0
- package/dist/{launch-json-removal-DaMY_ELf.mjs → launch-json-removal-DS4Iihpf.mjs} +2 -2
- package/dist/{loader-CZJtDyW1.mjs → loader-BTTXRFLw.mjs} +2 -2
- package/dist/loader-CVvRSwYS.mjs +1 -0
- package/dist/md-manager-C2pyfP1M.mjs +2 -0
- package/dist/{open-browser-BfbWvPXH.mjs → open-browser-RpCPdtF_.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/preview-CCsYKQw8.mjs +1 -0
- package/dist/{preview-DZFeEN5M.mjs → preview-DwoADdoO.mjs} +2 -2
- package/dist/public/assets/{ActivityModeContent-BMqdsZEQ.js → ActivityModeContent-BVNDha83.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-D_ubtipg.js → AgentDiffPane-tc3vpwY_.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-B7pwGsKU.js → AgentThreadClientBinder-CSCbo226.js} +1 -1
- package/dist/public/assets/{ChangedOutsideBadge-4TgQdQOf.js → ChangedOutsideBadge-DrITuwxs.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-CjgqNZXo.js → CodeMirrorPropInput-CCoKlaSP.js} +1 -1
- package/dist/public/assets/{DocumentContext-tOm4SkOp.js → DocumentContext-BrnqRC7f.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-CFFhQhHA.js → EditorModeToggle-tYJlAm15.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-BiThAkoH.js → EnableSyncConfirmDialog-BpR4lOGV.js} +1 -1
- package/dist/public/assets/FeedbackForm-B26S-tMj.js +1 -0
- package/dist/public/assets/{GraphPanel-CsRKre3D.js → GraphPanel-BBDNp1Lu.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-DcZoBHf-.js → ImportSkillDialog-BHURtwXV.js} +1 -1
- package/dist/public/assets/{LintConfigEditor--yFdaWpg.js → LintConfigEditor-B1_9NfyV.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-BxCiEKqW.js +1 -0
- package/dist/public/assets/{ManagedArtifactProperties-CIVfnd15.js → ManagedArtifactProperties-XetEd70v.js} +1 -1
- package/dist/public/assets/{McpConsentDialogBody-DEhSeOSg.js → McpConsentDialogBody-BMcFiOpb.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-civq6mkL.js → MermaidDocEditor-2uKE8dRs.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-DO7eotFd.js → ReportBugDialogBody-CokSHlbL.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-NxaI-Jdd.js → SchemaConfigEditor-m3x_uxwj.js} +1 -1
- package/dist/public/assets/{SessionsHost-PjSsebux.js → SessionsHost-BwjsJ4kM.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-BNYz-D4X.js → SettingsDialogBody-NnXMegDb.js} +1 -1
- package/dist/public/assets/{ShareBranchSwitchDialog-B7Bl6qR0.js → ShareBranchSwitchDialog-DGpxR8rv.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-BmMkjWTr.js → ShareReceiveDialog-DmLaRlCo.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-R20sy2ia.js → ShareReceiveMissDialog-eWc73H2u.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-B2U7UdOB.js → SkillEditBanner-Bcj_SsXK.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-B3wOLT3t.js → SkillOriginInline-D59WrmB9.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-B_RJpm5V.js → SkillToolbarControls-CF4GI3N4.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-56-P71vE.js → SlidesToolbarControls-pic8RAQO.js} +1 -1
- package/dist/public/assets/{SourceEditor-BW7yuIvG.js → SourceEditor-D4_TDrJh.js} +1 -1
- package/dist/public/assets/{TerminalPanel-Clr6j-jo.js → TerminalPanel-XbiaeXBm.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-DRbYHuvS.js → TerminalWindowApp-ptqnI_mm.js} +1 -1
- package/dist/public/assets/{TextDocEditor-Bwwrrcn5.js → TextDocEditor-BjbQZtTc.js} +1 -1
- package/dist/public/assets/{ThreadView-BA7gxPI6.js → ThreadView-CdeJaSQw.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-CTJnk9me.js → TimelineDiffPane-BbiOEtH2.js} +1 -1
- package/dist/public/assets/{agent-diff-store-BvxTke2d.js → agent-diff-store-BDOTYRUw.js} +1 -1
- package/dist/public/assets/{auth-state-cache-DrAhOPTB.js → auth-state-cache-BvGXSOYb.js} +1 -1
- package/dist/public/assets/client-version-vFgto74n.js +1 -0
- package/dist/public/assets/{comment-chips-W2ozPSpm.js → comment-chips-DBaYF7lS.js} +1 -1
- package/dist/public/assets/{config-provider-DamFbxl8.js → config-provider-C5Tk3I1Q.js} +1 -1
- package/dist/public/assets/{dist-ILlrHFKs.js → dist-C27Q9mDy.js} +82 -82
- package/dist/public/assets/{doc-paths-DAh95jxf.js → doc-paths-BVBn68AJ.js} +1 -1
- package/dist/public/assets/{documents-events-CCW6R-r2.js → documents-events-BsVKB80J.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-Bf1ZqkPA.js → file-tree-adapter-BnVxsS3Y.js} +1 -1
- package/dist/public/assets/{file-tree-utils-CgJ4lrP9.js → file-tree-utils-Bo6aWobj.js} +1 -1
- package/dist/public/assets/{folder-config-api-CKV5STj1.js → folder-config-api-BKVZKM0Y.js} +1 -1
- package/dist/public/assets/{follow-file-D0HdtSlc.js → follow-file-DqzQHgKU.js} +1 -1
- package/dist/public/assets/i18n-DdNV3ihn.js +1 -0
- package/dist/public/assets/{index-qtxLhYJO.js → index-MDvvCb3N.js} +7 -7
- package/dist/public/assets/{lint-config-client-xawAT1mQ.js → lint-config-client-kEetoezQ.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-B3UPVPG_.js → markdownlint-rule-browser-Chpu90_w.js} +1 -1
- package/dist/public/assets/{navigation-targets-C1boWExT.js → navigation-targets-BZG2mu1V.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-G7xdjHph.js → open-managed-artifact-tab-b7h2CbkR.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-CpVItLnx.js → pending-receive-nav-store-Clqxh2Fp.js} +1 -1
- package/dist/public/assets/{prop-types-BIrEWnOv.js → prop-types-CxA_rPl_.js} +1 -1
- package/dist/public/assets/{receive-store-BrOspwat.js → receive-store-DjapXAoN.js} +1 -1
- package/dist/public/assets/{selection-context-nm7zlSXJ.js → selection-context-C32Stxol.js} +1 -1
- package/dist/public/assets/{skill-actions-e3PRoOA3.js → skill-actions-5PfZ_o96.js} +1 -1
- package/dist/public/assets/{skill-scope-8PP6d5Gw.js → skill-scope-D6RlM0oa.js} +1 -1
- package/dist/public/assets/{skills-api-DQ0PK-8O.js → skills-api-Cdab4eC0.js} +1 -1
- package/dist/public/assets/{src-BKQkpwCc.js → src-Bfy3jrQ_.js} +1 -1
- package/dist/public/assets/{tag-pill-input-BHj2SAnj.js → tag-pill-input-Bcisv-E4.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-DpIU3fe6.js → target-navigation-intent-AcMTl0tC.js} +1 -1
- package/dist/public/assets/{telemetry-impl-Byic_ID0.js → telemetry-impl-CQnpJy_e.js} +1 -1
- package/dist/public/assets/{telemetry-startup-D_ttbNLC.js → telemetry-startup-D9BKJrQj.js} +1 -1
- package/dist/public/assets/{terminal-cli-display-CgJpdKCI.js → terminal-cli-display-Co0kpfr2.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-DQ0KtteM.js → terminal-launch-events-BYyc92EH.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-CE1yzjKD.js → terminal-telemetry-C-cKlmwu.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-B6UhFT8T.js → typing-burst-detector-B5Vy4mIn.js} +1 -1
- package/dist/public/assets/{uninstall-BE8yLKij.js → uninstall-GQMfCPpu.js} +1 -1
- package/dist/public/assets/{use-activity-panel-CF6Guvjl.js → use-activity-panel-jeOH8Waq.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-BatIDUX7.js → use-apply-config-color-theme-BApSgC_I.js} +1 -1
- package/dist/public/assets/{use-collab-url-7XE2_0_k.js → use-collab-url-bZfgDsoc.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-DS89T4Os.js → use-live-xterm-theme-BplIi05T.js} +1 -1
- package/dist/public/assets/{use-open-skill-CtzMj-sg.js → use-open-skill-DXlvLAoL.js} +1 -1
- package/dist/public/assets/{use-popular-skills-BY0ulPzk.js → use-popular-skills-CfUTYkxE.js} +1 -1
- package/dist/public/assets/{use-settings-route-DN0TWdfX.js → use-settings-route-Di4sAvRi.js} +1 -1
- package/dist/public/assets/{use-skill-origin-COh1_mOK.js → use-skill-origin-B_Rm_rN6.js} +1 -1
- package/dist/public/assets/{use-skills-C_HuRxth.js → use-skills-D1P4d0d_.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-CIQB6jgW.js → use-terminal-enabled-D26F4OF8.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-CDFU16yg.js → use-timeline-entry-diff-DjaTQJZU.js} +1 -1
- package/dist/public/assets/{use-workspace-CNCW4CS8.js → use-workspace-CyUAn3C0.js} +1 -1
- package/dist/public/index.html +44 -44
- package/dist/public/uninstall.html +3 -3
- package/dist/{repair-launch-json-D0g7JIQF.mjs → repair-launch-json-6ZgSt8VQ.mjs} +2 -2
- package/dist/{repair-mcp-configs-hbX7fywV.mjs → repair-mcp-configs-BX-Egvbf.mjs} +2 -2
- package/dist/repair-skills-BVA056EW.mjs +1 -0
- package/dist/{repair-skills-BVCJQr-D.mjs → repair-skills-CnWUwwGE.mjs} +2 -2
- package/dist/schemas/v0/config.project-local.schema.json +1 -1
- package/dist/schemas/v0/config.project.schema.json +11 -2
- package/dist/{server-lock-CeKMy65H.mjs → server-lock-B8gC6O_D.mjs} +2 -2
- package/dist/server-lock-BgDwOXHz.mjs +1 -0
- package/dist/{skill-teardown-CybJJo-5.mjs → skill-teardown-Bz8I6Qtp.mjs} +2 -2
- package/dist/{sleep-A0G7hOuG.mjs → sleep-C7muMiHm.mjs} +2 -2
- package/dist/{src-DNgZpbWL.mjs → src-1_fSbfZs.mjs} +2 -2
- package/dist/{src-3gxGmFyn.mjs → src-B6lC36UX.mjs} +1 -1
- package/dist/{src-Dj6UxpKM.mjs → src-BqZfalMj.mjs} +21 -21
- package/dist/src-C5VWLO7S.mjs +1 -0
- package/dist/{src--OhnhRml.mjs → src-CPA_Jv5y.mjs} +10 -10
- package/dist/start-BBU8Sqd0.mjs +1 -0
- package/dist/start-CTIu5W77.mjs +12 -0
- package/dist/{ui-DXs7IMUP.mjs → ui-CaE3cWnk.mjs} +3 -3
- package/dist/{write-project-skill-B4M4CzQe.mjs → write-project-skill-lYT2q0EM.mjs} +2 -2
- package/package.json +5 -5
- package/dist/constants-GVvlP0F1.mjs +0 -2
- package/dist/fs-traced-DtlsFK7O.mjs +0 -1
- package/dist/git-handle-CEoe8TIl.mjs +0 -1
- package/dist/init-CXnCnSQu.mjs +0 -1
- package/dist/loader-zzsiCoMM.mjs +0 -1
- package/dist/md-manager-45eVlaBq.mjs +0 -2
- package/dist/preview-BqJFFDSI.mjs +0 -1
- package/dist/public/assets/FeedbackForm-tTwFtkKO.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-Bb9ghWb1.js +0 -1
- package/dist/public/assets/client-version-DFQNNQh_.js +0 -1
- package/dist/public/assets/i18n-CUKvPzxt.js +0 -1
- package/dist/repair-skills-BmAntgZP.mjs +0 -1
- package/dist/server-lock-CDm0H6LS.mjs +0 -1
- package/dist/src-BqNFscyh.mjs +0 -1
- package/dist/start-DYelgMjm.mjs +0 -1
- package/dist/start-xJV4Y-0A.mjs +0 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./markdownit-C1Squg6O.js","./chunk-CYidjpOJ.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e,i as t,n,o as r,r as i,t as a}from"./chunk-CYidjpOJ.js";import{t as o}from"./preload-helper-Chd9yIcd.js";import{n as s,t as c}from"./trace-api-18gcBe0u.js";import{A as l,B as u,C as d,D as f,E as p,F as m,G as h,H as g,I as _,J as v,K as y,L as b,M as x,N as S,O as C,P as w,S as ee,T,V as E,W as te,Y as ne,_ as re,a as ie,b as ae,c as oe,d as se,et as ce,f as le,g as D,h as ue,i as de,it as fe,j as O,k,l as pe,m as me,n as he,o as ge,p as _e,q as ve,rt as ye,s as be,t as xe,u as A,v as Se,w as Ce,x as we,y as Te}from"./lib-Bgq5iQnh.js";import{n as Ee,t as De}from"./w3c-keyname-Bw5giFqP.js";import{i as Oe,n as ke,r as Ae}from"./html-void-elements-C35FEqss.js";import{n as je,r as Me,t as Ne}from"./lib-C0Wr4O8I.js";import{n as Pe,t as Fe}from"./markdownit-C1Squg6O.js";var Ie;function j(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var Le=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Re=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ie=globalThis).__zod_globalConfig??(Ie.__zod_globalConfig={});var ze=globalThis.__zod_globalConfig;function Be(e){return e&&Object.assign(ze,e),ze}function Ve(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function He(e,t){return typeof t==`bigint`?t.toString():t}function Ue(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function We(e){return e==null}function Ge(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ke(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var qe=Symbol(`evaluating`);function Je(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==qe)return r===void 0&&(r=qe,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ye(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Xe(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Ze(e){return JSON.stringify(e)}function Qe(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var $e=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function et(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var tt=Ue(()=>{if(ze.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function nt(e){if(et(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(et(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function rt(e){return nt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var eee=new Set([`string`,`number`,`symbol`]);function it(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function at(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function M(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ot(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var st={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ct(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return at(e,Xe(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ye(this,`shape`,e),e},checks:[]}))}function lt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return at(e,Xe(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ye(this,`shape`,r),r},checks:[]}))}function ut(e,t){if(!nt(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return at(e,Xe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ye(this,`shape`,n),n}}))}function dt(e,t){if(!nt(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return at(e,Xe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ye(this,`shape`,n),n}}))}function ft(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return at(e,Xe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ye(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function pt(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return at(t,Xe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ye(this,`shape`,i),i},checks:[]}))}function mt(e,t,n){return at(t,Xe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Ye(this,`shape`,i),i}}))}function ht(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function gt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function _t(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function vt(e){return typeof e==`string`?e:e?.message}function yt(e,t,n){let r=e.message?e.message:vt(e.inst?._zod.def?.error?.(e))??vt(t?.error?.(e))??vt(n.customError?.(e))??vt(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function bt(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function xt(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var St=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,He,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Ct=j(`$ZodError`,St),wt=j(`$ZodError`,St,{Parent:Error});function Tt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Et(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var Dt=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Le;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>yt(e,a,Be())));throw $e(t,i?.callee),t}return o.value},Ot=Dt(wt),kt=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>yt(e,a,Be())));throw $e(t,i?.callee),t}return o.value},At=kt(wt),jt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Le;return a.issues.length?{success:!1,error:new(e??Ct)(a.issues.map(e=>yt(e,i,Be())))}:{success:!0,data:a.value}},Mt=jt(wt),Nt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>yt(e,i,Be())))}:{success:!0,data:a.value}},tee=Nt(wt),nee=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Dt(e)(t,n,i)},ree=e=>(t,n,r)=>Dt(e)(t,n,r),iee=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return kt(e)(t,n,i)},aee=e=>async(t,n,r)=>kt(e)(t,n,r),oee=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return jt(e)(t,n,i)},see=e=>(t,n,r)=>jt(e)(t,n,r),cee=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Nt(e)(t,n,i)},lee=e=>async(t,n,r)=>Nt(e)(t,n,r),uee=/^[cC][0-9a-z]{6,}$/,dee=/^[0-9a-z]+$/,fee=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pee=/^[0-9a-vA-V]{20}$/,mee=/^[A-Za-z0-9]{27}$/,hee=/^[a-zA-Z0-9_-]{21}$/,gee=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_ee=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Pt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ft=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,It=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Lt(){return new RegExp(It,`u`)}var Rt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,zt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Bt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Vt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ht=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ut=/^[A-Za-z0-9_-]*$/,Wt=/^https?$/,Gt=/^\+[1-9]\d{6,14}$/,Kt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,qt=RegExp(`^${Kt}$`);function Jt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Yt(e){return RegExp(`^${Jt(e)}$`)}function Xt(e){let t=Jt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Kt}T(?:${r})$`)}var Zt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Qt=/^-?\d+$/,$t=/^-?\d+(?:\.\d+)?$/,en=/^(?:true|false)$/i,tn=/^null$/i,nn=/^[^A-Z]*$/,rn=/^[^a-z]*$/,an=j(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),on={number:`number`,bigint:`bigint`,object:`date`},sn=j(`$ZodCheckLessThan`,(e,t)=>{an.init(e,t);let n=on[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cn=j(`$ZodCheckGreaterThan`,(e,t)=>{an.init(e,t);let n=on[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ln=j(`$ZodCheckMultipleOf`,(e,t)=>{an.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Ke(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),un=j(`$ZodCheckNumberFormat`,(e,t)=>{an.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=st[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Qt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),dn=j(`$ZodCheckMaxLength`,(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!We(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=bt(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),fn=j(`$ZodCheckMinLength`,(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!We(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=bt(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pn=j(`$ZodCheckLengthEquals`,(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!We(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=bt(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),mn=j(`$ZodCheckStringFormat`,(e,t)=>{var n,r;an.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),hn=j(`$ZodCheckRegex`,(e,t)=>{mn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),gn=j(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=nn,mn.init(e,t)}),_n=j(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=rn,mn.init(e,t)}),vn=j(`$ZodCheckIncludes`,(e,t)=>{an.init(e,t);let n=it(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),yn=j(`$ZodCheckStartsWith`,(e,t)=>{an.init(e,t);let n=RegExp(`^${it(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),bn=j(`$ZodCheckEndsWith`,(e,t)=>{an.init(e,t);let n=RegExp(`.*${it(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),xn=j(`$ZodCheckOverwrite`,(e,t)=>{an.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Sn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
2
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"./chunk-CYidjpOJ.js";import{t as o}from"./preload-helper-Chd9yIcd.js";import{n as s,t as c}from"./trace-api-18gcBe0u.js";import{A as l,B as u,C as d,D as f,E as p,F as m,G as h,H as g,I as _,J as v,K as y,L as b,M as x,N as S,O as C,P as w,S as ee,T,V as E,W as te,Y as ne,_ as re,a as ie,b as ae,c as oe,d as se,et as ce,f as le,g as D,h as ue,i as de,it as fe,j as O,k,l as pe,m as me,n as he,o as ge,p as _e,q as ve,rt as ye,s as be,t as xe,u as A,v as Se,w as Ce,x as we,y as Te}from"./lib-Bgq5iQnh.js";import{n as Ee,t as De}from"./w3c-keyname-Bw5giFqP.js";import{i as Oe,n as ke,r as Ae}from"./html-void-elements-C35FEqss.js";import{n as je,r as Me,t as Ne}from"./lib-C0Wr4O8I.js";import{n as Pe,t as Fe}from"./markdownit-C1Squg6O.js";var Ie;function j(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var Le=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Re=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ie=globalThis).__zod_globalConfig??(Ie.__zod_globalConfig={});var ze=globalThis.__zod_globalConfig;function Be(e){return e&&Object.assign(ze,e),ze}function Ve(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function He(e,t){return typeof t==`bigint`?t.toString():t}function Ue(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function We(e){return e==null}function Ge(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ke(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var qe=Symbol(`evaluating`);function Je(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==qe)return r===void 0&&(r=qe,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ye(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Xe(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Ze(e){return JSON.stringify(e)}function Qe(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var $e=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function et(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var tt=Ue(()=>{if(ze.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function nt(e){if(et(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(et(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function rt(e){return nt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var eee=new Set([`string`,`number`,`symbol`]);function it(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function at(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function M(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ot(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var st={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ct(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return at(e,Xe(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ye(this,`shape`,e),e},checks:[]}))}function lt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return at(e,Xe(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ye(this,`shape`,r),r},checks:[]}))}function ut(e,t){if(!nt(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return at(e,Xe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ye(this,`shape`,n),n}}))}function dt(e,t){if(!nt(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return at(e,Xe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ye(this,`shape`,n),n}}))}function ft(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return at(e,Xe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ye(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function pt(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return at(t,Xe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ye(this,`shape`,i),i},checks:[]}))}function mt(e,t,n){return at(t,Xe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Ye(this,`shape`,i),i}}))}function ht(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function gt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function _t(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function vt(e){return typeof e==`string`?e:e?.message}function yt(e,t,n){let r=e.message?e.message:vt(e.inst?._zod.def?.error?.(e))??vt(t?.error?.(e))??vt(n.customError?.(e))??vt(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function bt(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function xt(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var St=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,He,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Ct=j(`$ZodError`,St),wt=j(`$ZodError`,St,{Parent:Error});function Tt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Et(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var Dt=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Le;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>yt(e,a,Be())));throw $e(t,i?.callee),t}return o.value},Ot=Dt(wt),kt=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>yt(e,a,Be())));throw $e(t,i?.callee),t}return o.value},At=kt(wt),jt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Le;return a.issues.length?{success:!1,error:new(e??Ct)(a.issues.map(e=>yt(e,i,Be())))}:{success:!0,data:a.value}},Mt=jt(wt),Nt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>yt(e,i,Be())))}:{success:!0,data:a.value}},Pt=Nt(wt),tee=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Dt(e)(t,n,i)},nee=e=>(t,n,r)=>Dt(e)(t,n,r),ree=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return kt(e)(t,n,i)},iee=e=>async(t,n,r)=>kt(e)(t,n,r),aee=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return jt(e)(t,n,i)},oee=e=>(t,n,r)=>jt(e)(t,n,r),see=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Nt(e)(t,n,i)},cee=e=>async(t,n,r)=>Nt(e)(t,n,r),lee=/^[cC][0-9a-z]{6,}$/,uee=/^[0-9a-z]+$/,dee=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,fee=/^[0-9a-vA-V]{20}$/,pee=/^[A-Za-z0-9]{27}$/,mee=/^[a-zA-Z0-9_-]{21}$/,hee=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,gee=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ft=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,It=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Lt=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Rt(){return new RegExp(Lt,`u`)}var zt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Bt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Vt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ht=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ut=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Wt=/^[A-Za-z0-9_-]*$/,Gt=/^https?$/,Kt=/^\+[1-9]\d{6,14}$/,qt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Jt=RegExp(`^${qt}$`);function Yt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Xt(e){return RegExp(`^${Yt(e)}$`)}function Zt(e){let t=Yt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${qt}T(?:${r})$`)}var Qt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},$t=/^-?\d+$/,en=/^-?\d+(?:\.\d+)?$/,tn=/^(?:true|false)$/i,nn=/^null$/i,rn=/^[^A-Z]*$/,an=/^[^a-z]*$/,on=j(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),sn={number:`number`,bigint:`bigint`,object:`date`},cn=j(`$ZodCheckLessThan`,(e,t)=>{on.init(e,t);let n=sn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ln=j(`$ZodCheckGreaterThan`,(e,t)=>{on.init(e,t);let n=sn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),un=j(`$ZodCheckMultipleOf`,(e,t)=>{on.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Ke(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),dn=j(`$ZodCheckNumberFormat`,(e,t)=>{on.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=st[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=$t)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),fn=j(`$ZodCheckMaxLength`,(e,t)=>{var n;on.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!We(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=bt(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pn=j(`$ZodCheckMinLength`,(e,t)=>{var n;on.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!We(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=bt(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mn=j(`$ZodCheckLengthEquals`,(e,t)=>{var n;on.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!We(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=bt(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),hn=j(`$ZodCheckStringFormat`,(e,t)=>{var n,r;on.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),gn=j(`$ZodCheckRegex`,(e,t)=>{hn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_n=j(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=rn,hn.init(e,t)}),vn=j(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=an,hn.init(e,t)}),yn=j(`$ZodCheckIncludes`,(e,t)=>{on.init(e,t);let n=it(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),bn=j(`$ZodCheckStartsWith`,(e,t)=>{on.init(e,t);let n=RegExp(`^${it(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),xn=j(`$ZodCheckEndsWith`,(e,t)=>{on.init(e,t);let n=RegExp(`.*${it(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Sn=j(`$ZodCheckOverwrite`,(e,t)=>{on.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Cn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
3
3
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
4
|
-
`))}},
|
|
4
|
+
`))}},wn={major:4,minor:4,patch:3},Tn=j(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wn;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=ht(e),i;for(let a of t){if(a._zod.def.when){if(gt(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Le;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=ht(e,t))});else{if(e.issues.length===t)continue;r||=ht(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(ht(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Le;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Le;return o.then(e=>t(e,r,a))}return t(o,r,a)}}Je(e,`~standard`,()=>({validate:t=>{try{let n=Mt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Pt(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),En=j(`$ZodString`,(e,t)=>{Tn.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Qt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Dn=j(`$ZodStringFormat`,(e,t)=>{hn.init(e,t),En.init(e,t)}),On=j(`$ZodGUID`,(e,t)=>{t.pattern??=gee,Dn.init(e,t)}),kn=j(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ft(e)}else t.pattern??=Ft();Dn.init(e,t)}),An=j(`$ZodEmail`,(e,t)=>{t.pattern??=It,Dn.init(e,t)}),jn=j(`$ZodURL`,(e,t)=>{Dn.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Gt.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Mn=j(`$ZodEmoji`,(e,t)=>{t.pattern??=Rt(),Dn.init(e,t)}),Nn=j(`$ZodNanoID`,(e,t)=>{t.pattern??=mee,Dn.init(e,t)}),Pn=j(`$ZodCUID`,(e,t)=>{t.pattern??=lee,Dn.init(e,t)}),Fn=j(`$ZodCUID2`,(e,t)=>{t.pattern??=uee,Dn.init(e,t)}),In=j(`$ZodULID`,(e,t)=>{t.pattern??=dee,Dn.init(e,t)}),Ln=j(`$ZodXID`,(e,t)=>{t.pattern??=fee,Dn.init(e,t)}),Rn=j(`$ZodKSUID`,(e,t)=>{t.pattern??=pee,Dn.init(e,t)}),zn=j(`$ZodISODateTime`,(e,t)=>{t.pattern??=Zt(t),Dn.init(e,t)}),Bn=j(`$ZodISODate`,(e,t)=>{t.pattern??=Jt,Dn.init(e,t)}),Vn=j(`$ZodISOTime`,(e,t)=>{t.pattern??=Xt(t),Dn.init(e,t)}),Hn=j(`$ZodISODuration`,(e,t)=>{t.pattern??=hee,Dn.init(e,t)}),Un=j(`$ZodIPv4`,(e,t)=>{t.pattern??=zt,Dn.init(e,t),e._zod.bag.format=`ipv4`}),Wn=j(`$ZodIPv6`,(e,t)=>{t.pattern??=Bt,Dn.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Gn=j(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Vt,Dn.init(e,t)}),Kn=j(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ht,Dn.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function qn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Jn=j(`$ZodBase64`,(e,t)=>{t.pattern??=Ut,Dn.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{qn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Yn(e){if(!Wt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return qn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Xn=j(`$ZodBase64URL`,(e,t)=>{t.pattern??=Wt,Dn.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Yn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Zn=j(`$ZodE164`,(e,t)=>{t.pattern??=Kt,Dn.init(e,t)});function Qn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var $n=j(`$ZodJWT`,(e,t)=>{Dn.init(e,t),e._zod.check=n=>{Qn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),er=j(`$ZodNumber`,(e,t)=>{Tn.init(e,t),e._zod.pattern=e._zod.bag.pattern??en,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),tr=j(`$ZodNumberFormat`,(e,t)=>{dn.init(e,t),er.init(e,t)}),nr=j(`$ZodBoolean`,(e,t)=>{Tn.init(e,t),e._zod.pattern=tn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),rr=j(`$ZodNull`,(e,t)=>{Tn.init(e,t),e._zod.pattern=nn,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),ir=j(`$ZodUnknown`,(e,t)=>{Tn.init(e,t),e._zod.parse=e=>e}),ar=j(`$ZodNever`,(e,t)=>{Tn.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function or(e,t,n){e.issues.length&&t.issues.push(..._t(n,e.issues)),t.value[n]=e.value}var sr=j(`$ZodArray`,(e,t)=>{Tn.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>or(t,n,e))):or(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function cr(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(..._t(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function lr(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=ot(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ur(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>cr(e,n,i,t,u,d))):cr(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var dr=j(`$ZodObject`,(e,t)=>{if(Tn.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=Ue(()=>lr(t));Je(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=et,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>cr(n,t,e,s,r,i))):cr(a,t,e,s,r,i)}return i?ur(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),fr=j(`$ZodObjectJIT`,(e,t)=>{dr.init(e,t);let n=e._zod.parse,r=Ue(()=>lr(t)),i=e=>{let t=new Cn([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Ze(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Ze(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
5
5
|
if (${n}.issues.length) {
|
|
6
6
|
if (${o} in input) {
|
|
7
7
|
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
@@ -60,57 +60,57 @@ import{a as e,i as t,n,o as r,r as i,t as a}from"./chunk-CYidjpOJ.js";import{t a
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=et,s=!ze.jitless,c=s&&tt.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?lr([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function dr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ht(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>yt(e,r,Be())))}),t)}var fr=j(`$ZodUnion`,(e,t)=>{wn.init(e,t),Je(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Je(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Je(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Je(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Ge(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>dr(t,r,e,i)):dr(o,r,e,i)}}),yee=j(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,fr.init(e,t);let n=e._zod.parse;Je(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Ue(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!et(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),bee=j(`$ZodIntersection`,(e,t)=>{wn.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>mr(e,t,n)):mr(e,i,a)}});function pr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(nt(e)&&nt(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=pr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=pr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function mr(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),ht(e))return e;let o=pr(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var xee=j(`$ZodRecord`,(e,t)=>{wn.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!nt(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>yt(e,r,Be())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(..._t(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(..._t(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&$t.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>yt(e,r,Be())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(..._t(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(..._t(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),See=j(`$ZodEnum`,(e,t)=>{wn.init(e,t);let n=Ve(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>eee.has(typeof e)).map(e=>typeof e==`string`?it(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Cee=j(`$ZodLiteral`,(e,t)=>{if(wn.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?it(e):e?it(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),wee=j(`$ZodTransform`,(e,t)=>{wn.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Re(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Le;return n.value=i,n.fallback=!0,n}});function hr(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var gr=j(`$ZodOptional`,(e,t)=>{wn.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Je(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Je(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ge(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>hr(e,r)):hr(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Tee=j(`$ZodExactOptional`,(e,t)=>{gr.init(e,t),Je(e._zod,`values`,()=>t.innerType._zod.values),Je(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Eee=j(`$ZodNullable`,(e,t)=>{wn.init(e,t),Je(e._zod,`optin`,()=>t.innerType._zod.optin),Je(e._zod,`optout`,()=>t.innerType._zod.optout),Je(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ge(e.source)}|null)$`):void 0}),Je(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Dee=j(`$ZodDefault`,(e,t)=>{wn.init(e,t),e._zod.optin=`optional`,Je(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>_r(e,t)):_r(r,t)}});function _r(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Oee=j(`$ZodPrefault`,(e,t)=>{wn.init(e,t),e._zod.optin=`optional`,Je(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),kee=j(`$ZodNonOptional`,(e,t)=>{wn.init(e,t),Je(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>vr(t,e)):vr(i,e)}});function vr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Aee=j(`$ZodCatch`,(e,t)=>{wn.init(e,t),e._zod.optin=`optional`,Je(e._zod,`optout`,()=>t.innerType._zod.optout),Je(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>yt(e,n,Be()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>yt(e,n,Be()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),yr=j(`$ZodPipe`,(e,t)=>{wn.init(e,t),Je(e._zod,`values`,()=>t.in._zod.values),Je(e._zod,`optin`,()=>t.in._zod.optin),Je(e._zod,`optout`,()=>t.out._zod.optout),Je(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>br(e,t.in,n)):br(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>br(e,t.out,n)):br(r,t.out,n)}});function br(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var jee=j(`$ZodPreprocess`,(e,t)=>{yr.init(e,t)}),Mee=j(`$ZodReadonly`,(e,t)=>{wn.init(e,t),Je(e._zod,`propValues`,()=>t.innerType._zod.propValues),Je(e._zod,`values`,()=>t.innerType._zod.values),Je(e._zod,`optin`,()=>t.innerType?._zod?.optin),Je(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(xr):xr(r)}});function xr(e){return e.value=Object.freeze(e.value),e}var Nee=j(`$ZodLazy`,(e,t)=>{wn.init(e,t),Je(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),Je(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),Je(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),Je(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),Je(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Pee=j(`$ZodCustom`,(e,t)=>{an.init(e,t),wn.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Sr(t,n,r,e));Sr(i,n,r,e)}});function Sr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(xt(e))}}var Cr,Fee=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function wr(){return new Fee}(Cr=globalThis).__zod_globalRegistry??(Cr.__zod_globalRegistry=wr());var Tr=globalThis.__zod_globalRegistry;function Iee(e,t){return new e({type:`string`,...M(t)})}function Er(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...M(t)})}function Dr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...M(t)})}function Lee(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...M(t)})}function Ree(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...M(t)})}function zee(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...M(t)})}function Bee(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...M(t)})}function Or(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...M(t)})}function Vee(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...M(t)})}function Hee(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...M(t)})}function kr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...M(t)})}function Ar(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...M(t)})}function jr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...M(t)})}function Mr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...M(t)})}function Nr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...M(t)})}function Pr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...M(t)})}function Fr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...M(t)})}function Ir(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...M(t)})}function Lr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...M(t)})}function Rr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...M(t)})}function zr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...M(t)})}function Br(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...M(t)})}function Vr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...M(t)})}function Hr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...M(t)})}function Ur(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...M(t)})}function Wr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...M(t)})}function Gr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...M(t)})}function Kr(e,t){return new e({type:`number`,checks:[],...M(t)})}function qr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...M(t)})}function Jr(e,t){return new e({type:`boolean`,...M(t)})}function Yr(e,t){return new e({type:`null`,...M(t)})}function Xr(e){return new e({type:`unknown`})}function Zr(e,t){return new e({type:`never`,...M(t)})}function Qr(e,t){return new sn({check:`less_than`,...M(t),value:e,inclusive:!1})}function $r(e,t){return new sn({check:`less_than`,...M(t),value:e,inclusive:!0})}function ei(e,t){return new cn({check:`greater_than`,...M(t),value:e,inclusive:!1})}function ti(e,t){return new cn({check:`greater_than`,...M(t),value:e,inclusive:!0})}function ni(e,t){return new ln({check:`multiple_of`,...M(t),value:e})}function ri(e,t){return new dn({check:`max_length`,...M(t),maximum:e})}function ii(e,t){return new fn({check:`min_length`,...M(t),minimum:e})}function ai(e,t){return new pn({check:`length_equals`,...M(t),length:e})}function oi(e,t){return new hn({check:`string_format`,format:`regex`,...M(t),pattern:e})}function si(e){return new gn({check:`string_format`,format:`lowercase`,...M(e)})}function ci(e){return new _n({check:`string_format`,format:`uppercase`,...M(e)})}function li(e,t){return new vn({check:`string_format`,format:`includes`,...M(t),includes:e})}function ui(e,t){return new yn({check:`string_format`,format:`starts_with`,...M(t),prefix:e})}function di(e,t){return new bn({check:`string_format`,format:`ends_with`,...M(t),suffix:e})}function fi(e){return new xn({check:`overwrite`,tx:e})}function pi(e){return fi(t=>t.normalize(e))}function mi(){return fi(e=>e.trim())}function hi(){return fi(e=>e.toLowerCase())}function gi(){return fi(e=>e.toUpperCase())}function _i(){return fi(e=>Qe(e))}function vi(e,t,n){return new e({type:`array`,element:t,...M(n)})}function yi(e,t,n){let r=M(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function bi(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...M(n)})}function xi(e,t){let n=Si(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(xt(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(xt(r))}},e(t.value,t)),t);return n}function Si(e,t){let n=new an({check:`custom`,...M(t)});return n._zod.check=e,n}function Ci(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Tr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function wi(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,wi(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Di(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ti(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
63
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=et,s=!ze.jitless,c=s&&tt.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?ur([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function pr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ht(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>yt(e,r,Be())))}),t)}var mr=j(`$ZodUnion`,(e,t)=>{Tn.init(e,t),Je(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Je(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Je(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Je(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Ge(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>pr(t,r,e,i)):pr(o,r,e,i)}}),_ee=j(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,mr.init(e,t);let n=e._zod.parse;Je(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Ue(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!et(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),vee=j(`$ZodIntersection`,(e,t)=>{Tn.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>gr(e,t,n)):gr(e,i,a)}});function hr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(nt(e)&&nt(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=hr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=hr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function gr(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),ht(e))return e;let o=hr(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var yee=j(`$ZodRecord`,(e,t)=>{Tn.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!nt(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>yt(e,r,Be())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(..._t(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(..._t(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&en.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>yt(e,r,Be())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(..._t(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(..._t(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),bee=j(`$ZodEnum`,(e,t)=>{Tn.init(e,t);let n=Ve(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>eee.has(typeof e)).map(e=>typeof e==`string`?it(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),xee=j(`$ZodLiteral`,(e,t)=>{if(Tn.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?it(e):e?it(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),See=j(`$ZodTransform`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Re(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Le;return n.value=i,n.fallback=!0,n}});function _r(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var vr=j(`$ZodOptional`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Je(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Je(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ge(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>_r(e,r)):_r(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Cee=j(`$ZodExactOptional`,(e,t)=>{vr.init(e,t),Je(e._zod,`values`,()=>t.innerType._zod.values),Je(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),wee=j(`$ZodNullable`,(e,t)=>{Tn.init(e,t),Je(e._zod,`optin`,()=>t.innerType._zod.optin),Je(e._zod,`optout`,()=>t.innerType._zod.optout),Je(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ge(e.source)}|null)$`):void 0}),Je(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Tee=j(`$ZodDefault`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,Je(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>yr(e,t)):yr(r,t)}});function yr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Eee=j(`$ZodPrefault`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,Je(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Dee=j(`$ZodNonOptional`,(e,t)=>{Tn.init(e,t),Je(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>br(t,e)):br(i,e)}});function br(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Oee=j(`$ZodCatch`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,Je(e._zod,`optout`,()=>t.innerType._zod.optout),Je(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>yt(e,n,Be()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>yt(e,n,Be()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),xr=j(`$ZodPipe`,(e,t)=>{Tn.init(e,t),Je(e._zod,`values`,()=>t.in._zod.values),Je(e._zod,`optin`,()=>t.in._zod.optin),Je(e._zod,`optout`,()=>t.out._zod.optout),Je(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Sr(e,t.in,n)):Sr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Sr(e,t.out,n)):Sr(r,t.out,n)}});function Sr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var kee=j(`$ZodPreprocess`,(e,t)=>{xr.init(e,t)}),Aee=j(`$ZodReadonly`,(e,t)=>{Tn.init(e,t),Je(e._zod,`propValues`,()=>t.innerType._zod.propValues),Je(e._zod,`values`,()=>t.innerType._zod.values),Je(e._zod,`optin`,()=>t.innerType?._zod?.optin),Je(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Cr):Cr(r)}});function Cr(e){return e.value=Object.freeze(e.value),e}var jee=j(`$ZodLazy`,(e,t)=>{Tn.init(e,t),Je(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),Je(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),Je(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),Je(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),Je(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Mee=j(`$ZodCustom`,(e,t)=>{on.init(e,t),Tn.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>wr(t,n,r,e));wr(i,n,r,e)}});function wr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(xt(e))}}var Tr,Nee=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Er(){return new Nee}(Tr=globalThis).__zod_globalRegistry??(Tr.__zod_globalRegistry=Er());var Dr=globalThis.__zod_globalRegistry;function Pee(e,t){return new e({type:`string`,...M(t)})}function Or(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...M(t)})}function kr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...M(t)})}function Fee(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...M(t)})}function Iee(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...M(t)})}function Lee(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...M(t)})}function Ree(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...M(t)})}function Ar(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...M(t)})}function zee(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...M(t)})}function Bee(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...M(t)})}function Vee(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...M(t)})}function Hee(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...M(t)})}function jr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...M(t)})}function Mr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...M(t)})}function Nr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...M(t)})}function Pr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...M(t)})}function Fr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...M(t)})}function Ir(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...M(t)})}function Lr(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...M(t)})}function Rr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...M(t)})}function zr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...M(t)})}function Br(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...M(t)})}function Vr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...M(t)})}function Hr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...M(t)})}function Ur(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...M(t)})}function Wr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...M(t)})}function Gr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...M(t)})}function Kr(e,t){return new e({type:`number`,checks:[],...M(t)})}function qr(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...M(t)})}function Jr(e,t){return new e({type:`boolean`,...M(t)})}function Yr(e,t){return new e({type:`null`,...M(t)})}function Xr(e){return new e({type:`unknown`})}function Zr(e,t){return new e({type:`never`,...M(t)})}function Qr(e,t){return new cn({check:`less_than`,...M(t),value:e,inclusive:!1})}function $r(e,t){return new cn({check:`less_than`,...M(t),value:e,inclusive:!0})}function ei(e,t){return new ln({check:`greater_than`,...M(t),value:e,inclusive:!1})}function ti(e,t){return new ln({check:`greater_than`,...M(t),value:e,inclusive:!0})}function ni(e,t){return new un({check:`multiple_of`,...M(t),value:e})}function ri(e,t){return new fn({check:`max_length`,...M(t),maximum:e})}function ii(e,t){return new pn({check:`min_length`,...M(t),minimum:e})}function ai(e,t){return new mn({check:`length_equals`,...M(t),length:e})}function oi(e,t){return new gn({check:`string_format`,format:`regex`,...M(t),pattern:e})}function si(e){return new _n({check:`string_format`,format:`lowercase`,...M(e)})}function ci(e){return new vn({check:`string_format`,format:`uppercase`,...M(e)})}function li(e,t){return new yn({check:`string_format`,format:`includes`,...M(t),includes:e})}function ui(e,t){return new bn({check:`string_format`,format:`starts_with`,...M(t),prefix:e})}function di(e,t){return new xn({check:`string_format`,format:`ends_with`,...M(t),suffix:e})}function fi(e){return new Sn({check:`overwrite`,tx:e})}function pi(e){return fi(t=>t.normalize(e))}function mi(){return fi(e=>e.trim())}function hi(){return fi(e=>e.toLowerCase())}function gi(){return fi(e=>e.toUpperCase())}function _i(){return fi(e=>Qe(e))}function vi(e,t,n){return new e({type:`array`,element:t,...M(n)})}function yi(e,t,n){let r=M(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function bi(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...M(n)})}function xi(e,t){let n=Si(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(xt(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(xt(r))}},e(t.value,t)),t);return n}function Si(e,t){let n=new on({check:`custom`,...M(t)});return n._zod.check=e,n}function Ci(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Dr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function wi(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,wi(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Di(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ti(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
64
64
|
|
|
65
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Ei(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:ki(t,`input`,e.processors),output:ki(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Di(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Di(r.element,n);if(r.type===`set`)return Di(r.valueType,n);if(r.type===`lazy`)return Di(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Di(r.innerType,n);if(r.type===`intersection`)return Di(r.left,n)||Di(r.right,n);if(r.type===`record`||r.type===`map`)return Di(r.keyType,n)||Di(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Di(r.in,n)||Di(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Di(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Di(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Di(e,n))return!0;return!!(r.rest&&Di(r.rest,n))}return!1}var Oi=(e,t={})=>n=>{let r=Ci({...n,processors:t});return wi(e,r),Ti(r,e),Ei(r,e)},ki=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ci({...i??{},target:a,io:t,processors:n});return wi(e,o),Ti(o,e),Ei(o,e)},Ai={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ji=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ai[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Mi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Ni=(e,t,n,r)=>{n.type=`boolean`},Pi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Fi=(e,t,n,r)=>{n.not={}},Ii=(e,t,n,r)=>{let i=e._zod.def,a=Ve(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Li=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Ri=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},zi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Bi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=wi(a.element,t,{...r,path:[...r.path,`items`]})},Vi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=wi(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=wi(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Hi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>wi(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ui=(e,t,n,r)=>{let i=e._zod.def,a=wi(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=wi(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Wi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=wi(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=wi(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=wi(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Gi=(e,t,n,r)=>{let i=e._zod.def,a=wi(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ki=(e,t,n,r)=>{let i=e._zod.def;wi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},qi=(e,t,n,r)=>{let i=e._zod.def;wi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ji=(e,t,n,r)=>{let i=e._zod.def;wi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Yi=(e,t,n,r)=>{let i=e._zod.def;wi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Xi=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;wi(o,t,r);let s=t.seen.get(e);s.ref=o},Zi=(e,t,n,r)=>{let i=e._zod.def;wi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Qi=(e,t,n,r)=>{let i=e._zod.def;wi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},$i=(e,t,n,r)=>{let i=e._zod.innerType;wi(i,t,r);let a=t.seen.get(e);a.ref=i},ea=j(`ZodISODateTime`,(e,t)=>{Rn.init(e,t),Ea.init(e,t)});function ta(e){return Hr(ea,e)}var na=j(`ZodISODate`,(e,t)=>{zn.init(e,t),Ea.init(e,t)});function ra(e){return Ur(na,e)}var ia=j(`ZodISOTime`,(e,t)=>{Bn.init(e,t),Ea.init(e,t)});function aa(e){return Wr(ia,e)}var oa=j(`ZodISODuration`,(e,t)=>{Vn.init(e,t),Ea.init(e,t)});function sa(e){return Gr(oa,e)}var ca=j(`ZodError`,(e,t)=>{Ct.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Et(e,t)},flatten:{value:t=>Tt(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,He,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,He,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),la=Dt(ca),ua=kt(ca),da=jt(ca),fa=Nt(ca),pa=nee(ca),ma=ree(ca),ha=iee(ca),ga=aee(ca),_a=oee(ca),va=see(ca),ya=cee(ca),ba=lee(ca),xa=new WeakMap;function Sa(e,t,n){let r=Object.getPrototypeOf(e),i=xa.get(r);if(i||(i=new Set,xa.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var Ca=j(`ZodType`,(e,t)=>(wn.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ki(e,`input`),output:ki(e,`output`)}}),e.toJSONSchema=Oi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>la(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>da(e,t,n),e.parseAsync=async(t,n)=>ua(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>fa(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>pa(e,t,n),e.decode=(t,n)=>ma(e,t,n),e.encodeAsync=async(t,n)=>ha(e,t,n),e.decodeAsync=async(t,n)=>ga(e,t,n),e.safeEncode=(t,n)=>_a(e,t,n),e.safeDecode=(t,n)=>va(e,t,n),e.safeEncodeAsync=async(t,n)=>ya(e,t,n),e.safeDecodeAsync=async(t,n)=>ba(e,t,n),Sa(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Xe(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return at(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ho(e,t))},superRefine(e,t){return this.check(Uo(e,t))},overwrite(e){return this.check(fi(e))},optional(){return bo(this)},exactOptional(){return So(this)},nullable(){return wo(this)},nullish(){return bo(wo(this))},nonoptional(e){return Ao(this,e)},array(){return I(this)},or(e){return so([this,e])},and(e){return fo(this,e)},transform(e){return Po(this,vo(e))},default(e){return Eo(this,e)},prefault(e){return Oo(this,e)},catch(e){return Mo(this,e)},pipe(e){return Po(this,e)},readonly(){return Lo(this)},describe(e){let t=this.clone();return Tr.add(t,{description:e}),t},meta(...e){if(e.length===0)return Tr.get(this);let t=this.clone();return Tr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return Tr.get(e)?.description},configurable:!0}),e)),wa=j(`_ZodString`,(e,t)=>{Tn.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Sa(e,`_ZodString`,{regex(...e){return this.check(oi(...e))},includes(...e){return this.check(li(...e))},startsWith(...e){return this.check(ui(...e))},endsWith(...e){return this.check(di(...e))},min(...e){return this.check(ii(...e))},max(...e){return this.check(ri(...e))},length(...e){return this.check(ai(...e))},nonempty(...e){return this.check(ii(1,...e))},lowercase(e){return this.check(si(e))},uppercase(e){return this.check(ci(e))},trim(){return this.check(mi())},normalize(...e){return this.check(pi(...e))},toLowerCase(){return this.check(hi())},toUpperCase(){return this.check(gi())},slugify(){return this.check(_i())}})}),Ta=j(`ZodString`,(e,t)=>{Tn.init(e,t),wa.init(e,t),e.email=t=>e.check(Er(Da,t)),e.url=t=>e.check(Or(ja,t)),e.jwt=t=>e.check(Vr(qa,t)),e.emoji=t=>e.check(Vee(Na,t)),e.guid=t=>e.check(Dr(ka,t)),e.uuid=t=>e.check(Lee(Aa,t)),e.uuidv4=t=>e.check(Ree(Aa,t)),e.uuidv6=t=>e.check(zee(Aa,t)),e.uuidv7=t=>e.check(Bee(Aa,t)),e.nanoid=t=>e.check(Hee(Pa,t)),e.guid=t=>e.check(Dr(ka,t)),e.cuid=t=>e.check(kr(Fa,t)),e.cuid2=t=>e.check(Ar(Ia,t)),e.ulid=t=>e.check(jr(La,t)),e.base64=t=>e.check(Rr(Wa,t)),e.base64url=t=>e.check(zr(Ga,t)),e.xid=t=>e.check(Mr(Ra,t)),e.ksuid=t=>e.check(Nr(za,t)),e.ipv4=t=>e.check(Pr(Ba,t)),e.ipv6=t=>e.check(Fr(Va,t)),e.cidrv4=t=>e.check(Ir(Ha,t)),e.cidrv6=t=>e.check(Lr(Ua,t)),e.e164=t=>e.check(Br(Ka,t)),e.datetime=t=>e.check(ta(t)),e.date=t=>e.check(ra(t)),e.time=t=>e.check(aa(t)),e.duration=t=>e.check(sa(t))});function N(e){return Iee(Ta,e)}var Ea=j(`ZodStringFormat`,(e,t)=>{En.init(e,t),wa.init(e,t)}),Da=j(`ZodEmail`,(e,t)=>{kn.init(e,t),Ea.init(e,t)});function Oa(e){return Er(Da,e)}var ka=j(`ZodGUID`,(e,t)=>{Dn.init(e,t),Ea.init(e,t)}),Aa=j(`ZodUUID`,(e,t)=>{On.init(e,t),Ea.init(e,t)}),ja=j(`ZodURL`,(e,t)=>{An.init(e,t),Ea.init(e,t)});function Ma(e){return Or(ja,e)}var Na=j(`ZodEmoji`,(e,t)=>{jn.init(e,t),Ea.init(e,t)}),Pa=j(`ZodNanoID`,(e,t)=>{Mn.init(e,t),Ea.init(e,t)}),Fa=j(`ZodCUID`,(e,t)=>{Nn.init(e,t),Ea.init(e,t)}),Ia=j(`ZodCUID2`,(e,t)=>{Pn.init(e,t),Ea.init(e,t)}),La=j(`ZodULID`,(e,t)=>{Fn.init(e,t),Ea.init(e,t)}),Ra=j(`ZodXID`,(e,t)=>{In.init(e,t),Ea.init(e,t)}),za=j(`ZodKSUID`,(e,t)=>{Ln.init(e,t),Ea.init(e,t)}),Ba=j(`ZodIPv4`,(e,t)=>{Hn.init(e,t),Ea.init(e,t)}),Va=j(`ZodIPv6`,(e,t)=>{Un.init(e,t),Ea.init(e,t)}),Ha=j(`ZodCIDRv4`,(e,t)=>{Wn.init(e,t),Ea.init(e,t)}),Ua=j(`ZodCIDRv6`,(e,t)=>{Gn.init(e,t),Ea.init(e,t)}),Wa=j(`ZodBase64`,(e,t)=>{qn.init(e,t),Ea.init(e,t)}),Ga=j(`ZodBase64URL`,(e,t)=>{Yn.init(e,t),Ea.init(e,t)}),Ka=j(`ZodE164`,(e,t)=>{Xn.init(e,t),Ea.init(e,t)}),qa=j(`ZodJWT`,(e,t)=>{Qn.init(e,t),Ea.init(e,t)}),Ja=j(`ZodNumber`,(e,t)=>{$n.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),Sa(e,`ZodNumber`,{gt(e,t){return this.check(ei(e,t))},gte(e,t){return this.check(ti(e,t))},min(e,t){return this.check(ti(e,t))},lt(e,t){return this.check(Qr(e,t))},lte(e,t){return this.check($r(e,t))},max(e,t){return this.check($r(e,t))},int(e){return this.check(Xa(e))},safe(e){return this.check(Xa(e))},positive(e){return this.check(ei(0,e))},nonnegative(e){return this.check(ti(0,e))},negative(e){return this.check(Qr(0,e))},nonpositive(e){return this.check($r(0,e))},multipleOf(e,t){return this.check(ni(e,t))},step(e,t){return this.check(ni(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function P(e){return Kr(Ja,e)}var Ya=j(`ZodNumberFormat`,(e,t)=>{er.init(e,t),Ja.init(e,t)});function Xa(e){return qr(Ya,e)}var Za=j(`ZodBoolean`,(e,t)=>{tr.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r)});function F(e){return Jr(Za,e)}var Qa=j(`ZodNull`,(e,t)=>{nr.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r)});function $a(e){return Yr(Qa,e)}var eo=j(`ZodUnknown`,(e,t)=>{rr.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function to(){return Xr(eo)}var no=j(`ZodNever`,(e,t)=>{ir.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r)});function ro(e){return Zr(no,e)}var io=j(`ZodArray`,(e,t)=>{or.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(e,t,n,r),e.element=t.element,Sa(e,`ZodArray`,{min(e,t){return this.check(ii(e,t))},nonempty(e){return this.check(ii(1,e))},max(e,t){return this.check(ri(e,t))},length(e,t){return this.check(ai(e,t))},unwrap(){return this.element}})});function I(e,t){return vi(io,e,t)}var ao=j(`ZodObject`,(e,t)=>{vee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r),Je(e,`shape`,()=>t.shape),Sa(e,`ZodObject`,{keyof(){return z(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:to()})},loose(){return this.clone({...this._zod.def,catchall:to()})},strict(){return this.clone({...this._zod.def,catchall:ro()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ut(this,e)},safeExtend(e){return dt(this,e)},merge(e){return ft(this,e)},pick(e){return ct(this,e)},omit(e){return lt(this,e)},partial(...e){return pt(yo,this,e[0])},required(...e){return mt(ko,this,e[0])}})});function L(e,t){return new ao({type:`object`,shape:e??{},...M(t)})}function R(e,t){return new ao({type:`object`,shape:e,catchall:to(),...M(t)})}var oo=j(`ZodUnion`,(e,t)=>{fr.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(e,t,n,r),e.options=t.options});function so(e,t){return new oo({type:`union`,options:e,...M(t)})}var co=j(`ZodDiscriminatedUnion`,(e,t)=>{oo.init(e,t),yee.init(e,t)});function lo(e,t,n){return new co({type:`union`,options:t,discriminator:e,...M(n)})}var uo=j(`ZodIntersection`,(e,t)=>{bee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ui(e,t,n,r)});function fo(e,t){return new uo({type:`intersection`,left:e,right:t})}var po=j(`ZodRecord`,(e,t)=>{xee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wi(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function mo(e,t,n){return!t||!t._zod?new po({type:`record`,keyType:N(),valueType:e,...M(t)}):new po({type:`record`,keyType:e,valueType:t,...M(n)})}var ho=j(`ZodEnum`,(e,t)=>{See.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new ho({...t,checks:[],...M(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ho({...t,checks:[],...M(r),entries:i})}});function z(e,t){return new ho({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...M(t)})}var go=j(`ZodLiteral`,(e,t)=>{Cee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Li(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function B(e,t){return new go({type:`literal`,values:Array.isArray(e)?e:[e],...M(t)})}var _o=j(`ZodTransform`,(e,t)=>{wee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Re(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(xt(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(xt(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function vo(e){return new _o({type:`transform`,transform:e})}var yo=j(`ZodOptional`,(e,t)=>{gr.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bo(e){return new yo({type:`optional`,innerType:e})}var xo=j(`ZodExactOptional`,(e,t)=>{Tee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function So(e){return new xo({type:`optional`,innerType:e})}var Co=j(`ZodNullable`,(e,t)=>{Eee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wo(e){return new Co({type:`nullable`,innerType:e})}var To=j(`ZodDefault`,(e,t)=>{Dee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Eo(e,t){return new To({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():rt(t)}})}var Do=j(`ZodPrefault`,(e,t)=>{Oee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ji(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oo(e,t){return new Do({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():rt(t)}})}var ko=j(`ZodNonOptional`,(e,t)=>{kee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ki(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ao(e,t){return new ko({type:`nonoptional`,innerType:e,...M(t)})}var jo=j(`ZodCatch`,(e,t)=>{Aee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Mo(e,t){return new jo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var No=j(`ZodPipe`,(e,t)=>{yr.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xi(e,t,n,r),e.in=t.in,e.out=t.out});function Po(e,t){return new No({type:`pipe`,in:e,out:t})}var Fo=j(`ZodPreprocess`,(e,t)=>{No.init(e,t),jee.init(e,t)}),Io=j(`ZodReadonly`,(e,t)=>{Mee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lo(e){return new Io({type:`readonly`,innerType:e})}var Ro=j(`ZodLazy`,(e,t)=>{Nee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$i(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function zo(e){return new Ro({type:`lazy`,getter:e})}var Bo=j(`ZodCustom`,(e,t)=>{Pee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ri(e,t,n,r)});function Vo(e,t){return yi(Bo,e??(()=>!0),t)}function Ho(e,t={}){return bi(Bo,e,t)}function Uo(e,t){return xi(e,t)}function Wo(e,t={}){let n=new Bo({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...M(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}function Go(e,t){return new Fo({type:`pipe`,in:vo(e),out:t})}var Ko=Symbol.for(`yaml.alias`),qo=Symbol.for(`yaml.document`),Jo=Symbol.for(`yaml.map`),Yo=Symbol.for(`yaml.pair`),Xo=Symbol.for(`yaml.scalar`),Zo=Symbol.for(`yaml.seq`),Qo=Symbol.for(`yaml.node.type`),$o=e=>!!e&&typeof e==`object`&&e[Qo]===Ko,es=e=>!!e&&typeof e==`object`&&e[Qo]===qo,ts=e=>!!e&&typeof e==`object`&&e[Qo]===Jo,ns=e=>!!e&&typeof e==`object`&&e[Qo]===Yo,rs=e=>!!e&&typeof e==`object`&&e[Qo]===Xo,is=e=>!!e&&typeof e==`object`&&e[Qo]===Zo;function as(e){if(e&&typeof e==`object`)switch(e[Qo]){case Jo:case Zo:return!0}return!1}function ss(e){if(e&&typeof e==`object`)switch(e[Qo]){case Ko:case Jo:case Xo:case Zo:return!0}return!1}var cs=e=>(rs(e)||as(e))&&!!e.anchor,ls=Symbol(`break visit`),us=Symbol(`skip children`),ds=Symbol(`remove node`);function fs(e,t){let n=gs(t);es(e)?ps(null,e.contents,n,Object.freeze([e]))===ds&&(e.contents=null):ps(null,e,n,Object.freeze([]))}fs.BREAK=ls,fs.SKIP=us,fs.REMOVE=ds;function ps(e,t,n,r){let i=_s(e,t,n,r);if(ss(i)||ns(i))return vs(e,r,i),ps(e,i,n,r);if(typeof i!=`symbol`){if(as(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=ps(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===ls)return ls;else i===ds&&(t.items.splice(e,1),--e)}}else if(ns(t)){r=Object.freeze(r.concat(t));let e=ps(`key`,t.key,n,r);if(e===ls)return ls;e===ds&&(t.key=null);let i=ps(`value`,t.value,n,r);if(i===ls)return ls;i===ds&&(t.value=null)}}return i}async function ms(e,t){let n=gs(t);es(e)?await hs(null,e.contents,n,Object.freeze([e]))===ds&&(e.contents=null):await hs(null,e,n,Object.freeze([]))}ms.BREAK=ls,ms.SKIP=us,ms.REMOVE=ds;async function hs(e,t,n,r){let i=await _s(e,t,n,r);if(ss(i)||ns(i))return vs(e,r,i),hs(e,i,n,r);if(typeof i!=`symbol`){if(as(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await hs(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===ls)return ls;else i===ds&&(t.items.splice(e,1),--e)}}else if(ns(t)){r=Object.freeze(r.concat(t));let e=await hs(`key`,t.key,n,r);if(e===ls)return ls;e===ds&&(t.key=null);let i=await hs(`value`,t.value,n,r);if(i===ls)return ls;i===ds&&(t.value=null)}}return i}function gs(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function _s(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(ts(t))return n.Map?.(e,t,r);if(is(t))return n.Seq?.(e,t,r);if(ns(t))return n.Pair?.(e,t,r);if(rs(t))return n.Scalar?.(e,t,r);if($o(t))return n.Alias?.(e,t,r)}function vs(e,t,n){let r=t[t.length-1];if(as(r))r.items[e]=n;else if(ns(r))e===`key`?r.key=n:r.value=n;else if(es(r))r.contents=n;else{let e=$o(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var ys={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},Uee=e=>e.replace(/[!,[\]{}]/g,e=>ys[e]),bs=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Uee(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&ss(e.contents)){let t={};fs(e.contents,(e,n)=>{ss(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
|
|
66
|
-
`)}};
|
|
67
|
-
`)?
|
|
65
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Ei(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:ki(t,`input`,e.processors),output:ki(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Di(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Di(r.element,n);if(r.type===`set`)return Di(r.valueType,n);if(r.type===`lazy`)return Di(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Di(r.innerType,n);if(r.type===`intersection`)return Di(r.left,n)||Di(r.right,n);if(r.type===`record`||r.type===`map`)return Di(r.keyType,n)||Di(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Di(r.in,n)||Di(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Di(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Di(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Di(e,n))return!0;return!!(r.rest&&Di(r.rest,n))}return!1}var Oi=(e,t={})=>n=>{let r=Ci({...n,processors:t});return wi(e,r),Ti(r,e),Ei(r,e)},ki=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ci({...i??{},target:a,io:t,processors:n});return wi(e,o),Ti(o,e),Ei(o,e)},Ai={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ji=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ai[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Mi=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Ni=(e,t,n,r)=>{n.type=`boolean`},Pi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Fi=(e,t,n,r)=>{n.not={}},Ii=(e,t,n,r)=>{let i=e._zod.def,a=Ve(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Li=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Ri=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},zi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Bi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=wi(a.element,t,{...r,path:[...r.path,`items`]})},Vi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=wi(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=wi(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Hi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>wi(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ui=(e,t,n,r)=>{let i=e._zod.def,a=wi(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=wi(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Wi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=wi(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=wi(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=wi(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Gi=(e,t,n,r)=>{let i=e._zod.def,a=wi(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ki=(e,t,n,r)=>{let i=e._zod.def;wi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},qi=(e,t,n,r)=>{let i=e._zod.def;wi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ji=(e,t,n,r)=>{let i=e._zod.def;wi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Yi=(e,t,n,r)=>{let i=e._zod.def;wi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Xi=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;wi(o,t,r);let s=t.seen.get(e);s.ref=o},Zi=(e,t,n,r)=>{let i=e._zod.def;wi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Qi=(e,t,n,r)=>{let i=e._zod.def;wi(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},$i=(e,t,n,r)=>{let i=e._zod.innerType;wi(i,t,r);let a=t.seen.get(e);a.ref=i},ea=j(`ZodISODateTime`,(e,t)=>{zn.init(e,t),Ea.init(e,t)});function ta(e){return Hr(ea,e)}var na=j(`ZodISODate`,(e,t)=>{Bn.init(e,t),Ea.init(e,t)});function ra(e){return Ur(na,e)}var ia=j(`ZodISOTime`,(e,t)=>{Vn.init(e,t),Ea.init(e,t)});function aa(e){return Wr(ia,e)}var oa=j(`ZodISODuration`,(e,t)=>{Hn.init(e,t),Ea.init(e,t)});function sa(e){return Gr(oa,e)}var ca=j(`ZodError`,(e,t)=>{Ct.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Et(e,t)},flatten:{value:t=>Tt(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,He,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,He,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),la=Dt(ca),ua=kt(ca),da=jt(ca),fa=Nt(ca),pa=tee(ca),ma=nee(ca),ha=ree(ca),ga=iee(ca),_a=aee(ca),va=oee(ca),ya=see(ca),ba=cee(ca),xa=new WeakMap;function Sa(e,t,n){let r=Object.getPrototypeOf(e),i=xa.get(r);if(i||(i=new Set,xa.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var Ca=j(`ZodType`,(e,t)=>(Tn.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ki(e,`input`),output:ki(e,`output`)}}),e.toJSONSchema=Oi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>la(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>da(e,t,n),e.parseAsync=async(t,n)=>ua(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>fa(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>pa(e,t,n),e.decode=(t,n)=>ma(e,t,n),e.encodeAsync=async(t,n)=>ha(e,t,n),e.decodeAsync=async(t,n)=>ga(e,t,n),e.safeEncode=(t,n)=>_a(e,t,n),e.safeDecode=(t,n)=>va(e,t,n),e.safeEncodeAsync=async(t,n)=>ya(e,t,n),e.safeDecodeAsync=async(t,n)=>ba(e,t,n),Sa(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Xe(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return at(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ho(e,t))},superRefine(e,t){return this.check(Uo(e,t))},overwrite(e){return this.check(fi(e))},optional(){return bo(this)},exactOptional(){return So(this)},nullable(){return wo(this)},nullish(){return bo(wo(this))},nonoptional(e){return Ao(this,e)},array(){return I(this)},or(e){return so([this,e])},and(e){return fo(this,e)},transform(e){return Po(this,vo(e))},default(e){return Eo(this,e)},prefault(e){return Oo(this,e)},catch(e){return Mo(this,e)},pipe(e){return Po(this,e)},readonly(){return Lo(this)},describe(e){let t=this.clone();return Dr.add(t,{description:e}),t},meta(...e){if(e.length===0)return Dr.get(this);let t=this.clone();return Dr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return Dr.get(e)?.description},configurable:!0}),e)),wa=j(`_ZodString`,(e,t)=>{En.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ji(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Sa(e,`_ZodString`,{regex(...e){return this.check(oi(...e))},includes(...e){return this.check(li(...e))},startsWith(...e){return this.check(ui(...e))},endsWith(...e){return this.check(di(...e))},min(...e){return this.check(ii(...e))},max(...e){return this.check(ri(...e))},length(...e){return this.check(ai(...e))},nonempty(...e){return this.check(ii(1,...e))},lowercase(e){return this.check(si(e))},uppercase(e){return this.check(ci(e))},trim(){return this.check(mi())},normalize(...e){return this.check(pi(...e))},toLowerCase(){return this.check(hi())},toUpperCase(){return this.check(gi())},slugify(){return this.check(_i())}})}),Ta=j(`ZodString`,(e,t)=>{En.init(e,t),wa.init(e,t),e.email=t=>e.check(Or(Da,t)),e.url=t=>e.check(Ar(ja,t)),e.jwt=t=>e.check(Vr(qa,t)),e.emoji=t=>e.check(zee(Na,t)),e.guid=t=>e.check(kr(ka,t)),e.uuid=t=>e.check(Fee(Aa,t)),e.uuidv4=t=>e.check(Iee(Aa,t)),e.uuidv6=t=>e.check(Lee(Aa,t)),e.uuidv7=t=>e.check(Ree(Aa,t)),e.nanoid=t=>e.check(Bee(Pa,t)),e.guid=t=>e.check(kr(ka,t)),e.cuid=t=>e.check(Vee(Fa,t)),e.cuid2=t=>e.check(Hee(Ia,t)),e.ulid=t=>e.check(jr(La,t)),e.base64=t=>e.check(Rr(Wa,t)),e.base64url=t=>e.check(zr(Ga,t)),e.xid=t=>e.check(Mr(Ra,t)),e.ksuid=t=>e.check(Nr(za,t)),e.ipv4=t=>e.check(Pr(Ba,t)),e.ipv6=t=>e.check(Fr(Va,t)),e.cidrv4=t=>e.check(Ir(Ha,t)),e.cidrv6=t=>e.check(Lr(Ua,t)),e.e164=t=>e.check(Br(Ka,t)),e.datetime=t=>e.check(ta(t)),e.date=t=>e.check(ra(t)),e.time=t=>e.check(aa(t)),e.duration=t=>e.check(sa(t))});function N(e){return Pee(Ta,e)}var Ea=j(`ZodStringFormat`,(e,t)=>{Dn.init(e,t),wa.init(e,t)}),Da=j(`ZodEmail`,(e,t)=>{An.init(e,t),Ea.init(e,t)});function Oa(e){return Or(Da,e)}var ka=j(`ZodGUID`,(e,t)=>{On.init(e,t),Ea.init(e,t)}),Aa=j(`ZodUUID`,(e,t)=>{kn.init(e,t),Ea.init(e,t)}),ja=j(`ZodURL`,(e,t)=>{jn.init(e,t),Ea.init(e,t)});function Ma(e){return Ar(ja,e)}var Na=j(`ZodEmoji`,(e,t)=>{Mn.init(e,t),Ea.init(e,t)}),Pa=j(`ZodNanoID`,(e,t)=>{Nn.init(e,t),Ea.init(e,t)}),Fa=j(`ZodCUID`,(e,t)=>{Pn.init(e,t),Ea.init(e,t)}),Ia=j(`ZodCUID2`,(e,t)=>{Fn.init(e,t),Ea.init(e,t)}),La=j(`ZodULID`,(e,t)=>{In.init(e,t),Ea.init(e,t)}),Ra=j(`ZodXID`,(e,t)=>{Ln.init(e,t),Ea.init(e,t)}),za=j(`ZodKSUID`,(e,t)=>{Rn.init(e,t),Ea.init(e,t)}),Ba=j(`ZodIPv4`,(e,t)=>{Un.init(e,t),Ea.init(e,t)}),Va=j(`ZodIPv6`,(e,t)=>{Wn.init(e,t),Ea.init(e,t)}),Ha=j(`ZodCIDRv4`,(e,t)=>{Gn.init(e,t),Ea.init(e,t)}),Ua=j(`ZodCIDRv6`,(e,t)=>{Kn.init(e,t),Ea.init(e,t)}),Wa=j(`ZodBase64`,(e,t)=>{Jn.init(e,t),Ea.init(e,t)}),Ga=j(`ZodBase64URL`,(e,t)=>{Xn.init(e,t),Ea.init(e,t)}),Ka=j(`ZodE164`,(e,t)=>{Zn.init(e,t),Ea.init(e,t)}),qa=j(`ZodJWT`,(e,t)=>{$n.init(e,t),Ea.init(e,t)}),Ja=j(`ZodNumber`,(e,t)=>{er.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mi(e,t,n,r),Sa(e,`ZodNumber`,{gt(e,t){return this.check(ei(e,t))},gte(e,t){return this.check(ti(e,t))},min(e,t){return this.check(ti(e,t))},lt(e,t){return this.check(Qr(e,t))},lte(e,t){return this.check($r(e,t))},max(e,t){return this.check($r(e,t))},int(e){return this.check(Xa(e))},safe(e){return this.check(Xa(e))},positive(e){return this.check(ei(0,e))},nonnegative(e){return this.check(ti(0,e))},negative(e){return this.check(Qr(0,e))},nonpositive(e){return this.check($r(0,e))},multipleOf(e,t){return this.check(ni(e,t))},step(e,t){return this.check(ni(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function P(e){return Kr(Ja,e)}var Ya=j(`ZodNumberFormat`,(e,t)=>{tr.init(e,t),Ja.init(e,t)});function Xa(e){return qr(Ya,e)}var Za=j(`ZodBoolean`,(e,t)=>{nr.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ni(e,t,n,r)});function F(e){return Jr(Za,e)}var Qa=j(`ZodNull`,(e,t)=>{rr.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pi(e,t,n,r)});function $a(e){return Yr(Qa,e)}var eo=j(`ZodUnknown`,(e,t)=>{ir.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function to(){return Xr(eo)}var no=j(`ZodNever`,(e,t)=>{ar.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fi(e,t,n,r)});function ro(e){return Zr(no,e)}var io=j(`ZodArray`,(e,t)=>{sr.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bi(e,t,n,r),e.element=t.element,Sa(e,`ZodArray`,{min(e,t){return this.check(ii(e,t))},nonempty(e){return this.check(ii(1,e))},max(e,t){return this.check(ri(e,t))},length(e,t){return this.check(ai(e,t))},unwrap(){return this.element}})});function I(e,t){return vi(io,e,t)}var ao=j(`ZodObject`,(e,t)=>{fr.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vi(e,t,n,r),Je(e,`shape`,()=>t.shape),Sa(e,`ZodObject`,{keyof(){return z(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:to()})},loose(){return this.clone({...this._zod.def,catchall:to()})},strict(){return this.clone({...this._zod.def,catchall:ro()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ut(this,e)},safeExtend(e){return dt(this,e)},merge(e){return ft(this,e)},pick(e){return ct(this,e)},omit(e){return lt(this,e)},partial(...e){return pt(yo,this,e[0])},required(...e){return mt(ko,this,e[0])}})});function L(e,t){return new ao({type:`object`,shape:e??{},...M(t)})}function R(e,t){return new ao({type:`object`,shape:e,catchall:to(),...M(t)})}var oo=j(`ZodUnion`,(e,t)=>{mr.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hi(e,t,n,r),e.options=t.options});function so(e,t){return new oo({type:`union`,options:e,...M(t)})}var co=j(`ZodDiscriminatedUnion`,(e,t)=>{oo.init(e,t),_ee.init(e,t)});function lo(e,t,n){return new co({type:`union`,options:t,discriminator:e,...M(n)})}var uo=j(`ZodIntersection`,(e,t)=>{vee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ui(e,t,n,r)});function fo(e,t){return new uo({type:`intersection`,left:e,right:t})}var po=j(`ZodRecord`,(e,t)=>{yee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wi(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function mo(e,t,n){return!t||!t._zod?new po({type:`record`,keyType:N(),valueType:e,...M(t)}):new po({type:`record`,keyType:e,valueType:t,...M(n)})}var ho=j(`ZodEnum`,(e,t)=>{bee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ii(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new ho({...t,checks:[],...M(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ho({...t,checks:[],...M(r),entries:i})}});function z(e,t){return new ho({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...M(t)})}var go=j(`ZodLiteral`,(e,t)=>{xee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Li(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function B(e,t){return new go({type:`literal`,values:Array.isArray(e)?e:[e],...M(t)})}var _o=j(`ZodTransform`,(e,t)=>{See.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zi(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Re(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(xt(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(xt(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function vo(e){return new _o({type:`transform`,transform:e})}var yo=j(`ZodOptional`,(e,t)=>{vr.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bo(e){return new yo({type:`optional`,innerType:e})}var xo=j(`ZodExactOptional`,(e,t)=>{Cee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function So(e){return new xo({type:`optional`,innerType:e})}var Co=j(`ZodNullable`,(e,t)=>{wee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wo(e){return new Co({type:`nullable`,innerType:e})}var To=j(`ZodDefault`,(e,t)=>{Tee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Eo(e,t){return new To({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():rt(t)}})}var Do=j(`ZodPrefault`,(e,t)=>{Eee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ji(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Oo(e,t){return new Do({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():rt(t)}})}var ko=j(`ZodNonOptional`,(e,t)=>{Dee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ki(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ao(e,t){return new ko({type:`nonoptional`,innerType:e,...M(t)})}var jo=j(`ZodCatch`,(e,t)=>{Oee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Mo(e,t){return new jo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var No=j(`ZodPipe`,(e,t)=>{xr.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xi(e,t,n,r),e.in=t.in,e.out=t.out});function Po(e,t){return new No({type:`pipe`,in:e,out:t})}var Fo=j(`ZodPreprocess`,(e,t)=>{No.init(e,t),kee.init(e,t)}),Io=j(`ZodReadonly`,(e,t)=>{Aee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lo(e){return new Io({type:`readonly`,innerType:e})}var Ro=j(`ZodLazy`,(e,t)=>{jee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$i(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function zo(e){return new Ro({type:`lazy`,getter:e})}var Bo=j(`ZodCustom`,(e,t)=>{Mee.init(e,t),Ca.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ri(e,t,n,r)});function Vo(e,t){return yi(Bo,e??(()=>!0),t)}function Ho(e,t={}){return bi(Bo,e,t)}function Uo(e,t){return xi(e,t)}function Wo(e,t={}){let n=new Bo({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...M(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}function Go(e,t){return new Fo({type:`pipe`,in:vo(e),out:t})}var Ko=Symbol.for(`yaml.alias`),qo=Symbol.for(`yaml.document`),Jo=Symbol.for(`yaml.map`),Yo=Symbol.for(`yaml.pair`),Xo=Symbol.for(`yaml.scalar`),Zo=Symbol.for(`yaml.seq`),Qo=Symbol.for(`yaml.node.type`),$o=e=>!!e&&typeof e==`object`&&e[Qo]===Ko,es=e=>!!e&&typeof e==`object`&&e[Qo]===qo,ts=e=>!!e&&typeof e==`object`&&e[Qo]===Jo,ns=e=>!!e&&typeof e==`object`&&e[Qo]===Yo,rs=e=>!!e&&typeof e==`object`&&e[Qo]===Xo,is=e=>!!e&&typeof e==`object`&&e[Qo]===Zo;function as(e){if(e&&typeof e==`object`)switch(e[Qo]){case Jo:case Zo:return!0}return!1}function ss(e){if(e&&typeof e==`object`)switch(e[Qo]){case Ko:case Jo:case Xo:case Zo:return!0}return!1}var cs=e=>(rs(e)||as(e))&&!!e.anchor,ls=Symbol(`break visit`),us=Symbol(`skip children`),ds=Symbol(`remove node`);function fs(e,t){let n=gs(t);es(e)?ps(null,e.contents,n,Object.freeze([e]))===ds&&(e.contents=null):ps(null,e,n,Object.freeze([]))}fs.BREAK=ls,fs.SKIP=us,fs.REMOVE=ds;function ps(e,t,n,r){let i=_s(e,t,n,r);if(ss(i)||ns(i))return vs(e,r,i),ps(e,i,n,r);if(typeof i!=`symbol`){if(as(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=ps(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===ls)return ls;else i===ds&&(t.items.splice(e,1),--e)}}else if(ns(t)){r=Object.freeze(r.concat(t));let e=ps(`key`,t.key,n,r);if(e===ls)return ls;e===ds&&(t.key=null);let i=ps(`value`,t.value,n,r);if(i===ls)return ls;i===ds&&(t.value=null)}}return i}async function ms(e,t){let n=gs(t);es(e)?await hs(null,e.contents,n,Object.freeze([e]))===ds&&(e.contents=null):await hs(null,e,n,Object.freeze([]))}ms.BREAK=ls,ms.SKIP=us,ms.REMOVE=ds;async function hs(e,t,n,r){let i=await _s(e,t,n,r);if(ss(i)||ns(i))return vs(e,r,i),hs(e,i,n,r);if(typeof i!=`symbol`){if(as(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await hs(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===ls)return ls;else i===ds&&(t.items.splice(e,1),--e)}}else if(ns(t)){r=Object.freeze(r.concat(t));let e=await hs(`key`,t.key,n,r);if(e===ls)return ls;e===ds&&(t.key=null);let i=await hs(`value`,t.value,n,r);if(i===ls)return ls;i===ds&&(t.value=null)}}return i}function gs(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function _s(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(ts(t))return n.Map?.(e,t,r);if(is(t))return n.Seq?.(e,t,r);if(ns(t))return n.Pair?.(e,t,r);if(rs(t))return n.Scalar?.(e,t,r);if($o(t))return n.Alias?.(e,t,r)}function vs(e,t,n){let r=t[t.length-1];if(as(r))r.items[e]=n;else if(ns(r))e===`key`?r.key=n:r.value=n;else if(es(r))r.contents=n;else{let e=$o(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var ys={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},bs=e=>e.replace(/[!,[\]{}]/g,e=>ys[e]),xs=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+bs(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&ss(e.contents)){let t={};fs(e.contents,(e,n)=>{ss(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
|
|
66
|
+
`)}};xs.defaultYaml={explicit:!1,version:`1.2`},xs.defaultTags={"!!":`tag:yaml.org,2002:`};function Ss(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function Cs(e){let t=new Set;return fs(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function ws(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function Uee(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=Cs(e);let a=ws(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(rs(t.node)||as(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function Ts(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=Ts(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=Ts(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=Ts(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=Ts(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function Es(e,t,n){if(Array.isArray(e))return e.map((e,t)=>Es(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!cs(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Ds=class{constructor(e){Object.defineProperty(this,Qo,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!es(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=Es(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Ts(i,{"":o},``,o):o}},Os=class extends Ds{constructor(e){super(Ko),this.source=e,Object.defineProperty(this,`tag`,{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],fs(e,{Node:(e,t)=>{($o(t)||cs(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(Es(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=ks(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Ss(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function ks(e,t,n){if($o(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(as(t)){let r=0;for(let i of t.items){let t=ks(e,i,n);t>r&&(r=t)}return r}else if(ns(t)){let r=ks(e,t.key,n),i=ks(e,t.value,n);return Math.max(r,i)}return 1}var As=e=>!e||typeof e!=`function`&&typeof e!=`object`,V=class extends Ds{constructor(e){super(Xo),this.value=e}toJSON(e,t){return t?.keep?this.value:Es(this.value,e,t)}toString(){return String(this.value)}};V.BLOCK_FOLDED=`BLOCK_FOLDED`,V.BLOCK_LITERAL=`BLOCK_LITERAL`,V.PLAIN=`PLAIN`,V.QUOTE_DOUBLE=`QUOTE_DOUBLE`,V.QUOTE_SINGLE=`QUOTE_SINGLE`;var Wee=`tag:yaml.org,2002:`;function Gee(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function js(e,t,n){if(es(e)&&(e=e.contents),ss(e))return e;if(ns(e)){let t=n.schema[Jo].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??=i(e),new Os(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=Wee+t.slice(2));let l=Gee(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new V(e);return c&&(c.node=t),t}l=e instanceof Map?o[Jo]:Symbol.iterator in Object(e)?o[Zo]:o[Jo]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new V(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Ms(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return js(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var Ns=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Ps=class extends Ds{constructor(e,t){super(e),Object.defineProperty(this,`schema`,{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>ss(t)||ns(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Ns(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(as(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Ms(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(as(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&rs(i)?i.value:i:as(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!ns(t))return!1;let n=t.value;return n==null||e&&rs(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return as(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(as(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Ms(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Kee=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function Fs(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Is=(e,t,n)=>e.endsWith(`
|
|
67
|
+
`)?Fs(n,t):n.includes(`
|
|
68
68
|
`)?`
|
|
69
|
-
`+
|
|
70
|
-
`)n===`block`&&(h=
|
|
69
|
+
`+Fs(n,t):(e.endsWith(` `)?``:` `)+n,Ls=`flow`,qee=`block`,Jee=`quoted`;function Rs(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=zs(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
|
|
70
|
+
`)n===`block`&&(h=zs(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
|
|
71
71
|
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
|
|
72
|
-
`&&t!==` `&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function
|
|
73
|
-
`);r=t,i=t+1,a=e[i]}return r}var
|
|
74
|
-
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function
|
|
72
|
+
`&&t!==` `&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function zs(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
|
|
73
|
+
`);r=t,i=t+1,a=e[i]}return r}var Bs=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Vs=e=>/^(%|---|\.\.\.)/m.test(e);function Yee(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
|
|
74
|
+
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function Hs(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Vs(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
|
|
75
75
|
|
|
76
76
|
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
|
|
77
|
-
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:
|
|
78
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return
|
|
77
|
+
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:Rs(o,a,Jee,Bs(t,!1))}function Us(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
78
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return Hs(e,t);let n=t.indent||(Vs(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:Rs(r,n,Ls,Bs(t,!1))}function Ws(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=Hs;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?Us:i&&!t?Hs:n?Us:Hs}return r(e,t)}var Gs;try{Gs=RegExp(`(^|(?<!
|
|
79
79
|
))
|
|
80
80
|
+(?!
|
|
81
|
-
|$)`,`g`)}catch{
|
|
81
|
+
|$)`,`g`)}catch{Gs=/\n+(?!\n|$)/g}function Ks({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return Ws(n,r);let l=r.indent||(r.forceBlockIndent||Vs(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===V.BLOCK_FOLDED?!1:t===V.BLOCK_LITERAL?!0:!Yee(n,c,l.length);if(!n)return u?`|
|
|
82
82
|
`:`>
|
|
83
83
|
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
|
|
84
84
|
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
|
|
85
85
|
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
86
|
-
`&&(p=p.slice(0,-1)),p.replace(
|
|
86
|
+
`&&(p=p.slice(0,-1)),p.replace(Gs,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
|
|
87
87
|
`)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
|
|
88
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=
|
|
89
|
-
`)||u&&/[[\]{},]/.test(a))return
|
|
90
|
-
`)?
|
|
91
|
-
`))return
|
|
92
|
-
`:``,v){let e=l(v);S+=`\n${
|
|
88
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=Bs(r,!0);o!==`folded`&&t!==V.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=Rs(`${v}${e}${p}`,l,qee,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function Xee(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
|
|
89
|
+
`)||u&&/[[\]{},]/.test(a))return Ws(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
|
90
|
+
`)?Ws(a,t):Ks(e,t,n,r);if(!s&&!u&&i!==V.PLAIN&&a.includes(`
|
|
91
|
+
`))return Ks(e,t,n,r);if(Vs(a)){if(c===``)return t.forceBlockIndent=!0,Ks(e,t,n,r);if(s&&c===l)return Ws(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return Ws(a,t)}return s?d:Rs(d,c,Ls,Bs(t,!1))}function qs(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==V.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=V.QUOTE_DOUBLE);let c=e=>{switch(e){case V.BLOCK_FOLDED:case V.BLOCK_LITERAL:return i||a?Ws(o.value,t):Ks(o,t,n,r);case V.QUOTE_DOUBLE:return Hs(o.value,t);case V.QUOTE_SINGLE:return Us(o.value,t);case V.PLAIN:return Xee(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function Js(e,t){let n=Object.assign({blockQuote:!0,commentString:Kee,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Zee(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(rs(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Qee(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(rs(e)||as(e))&&e.anchor;a&&Ss(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Ys(e,t,n,r){if(ns(e))return e.toString(t,n,r);if($o(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=ss(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Zee(t.doc.schema.tags,a);let o=Qee(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):rs(a)?qs(a,t,n,r):a.toString(t,n,r);return o?rs(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function $ee({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=ss(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(as(e)||!ss(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||as(e)||(rs(e)?e.type===V.BLOCK_FOLDED||e.type===V.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Ys(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=Is(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Is(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=Is(g,n.indent,l(f))));let _,v,y;ss(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&rs(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&is(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=Ys(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
|
|
92
|
+
`:``,v){let e=l(v);S+=`\n${Fs(e,n.indent)}`}x===``&&!n.inFlow?S===`
|
|
93
93
|
`&&y&&(S=`
|
|
94
94
|
|
|
95
95
|
`):S+=`\n${n.indent}`}else if(!p&&as(t)){let e=x[0],r=x.indexOf(`
|
|
96
96
|
`),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else (x===``||x[0]===`
|
|
97
|
-
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=
|
|
97
|
+
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=Is(g,n.indent,l(y)):h&&i&&i(),g}function Xs(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Zs=`<<`,Qs={identify:e=>e===Zs||typeof e==`symbol`&&e.description===Zs,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new V(Symbol(Zs)),{addToJSMap:$s}),stringify:()=>Zs},ete=(e,t)=>(Qs.identify(t)||rs(t)&&(!t.type||t.type===V.PLAIN)&&Qs.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Qs.tag&&e.default);function $s(e,t,n){let r=tc(e,n);if(is(r))for(let n of r.items)ec(e,t,n);else if(Array.isArray(r))for(let n of r)ec(e,t,n);else ec(e,t,r)}function ec(e,t,n){let r=tc(e,n);if(!ts(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function tc(e,t){return e&&$o(t)?t.resolve(e.doc,e):t}function nc(e,t,{key:n,value:r}){if(ss(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(ete(e,n))$s(e,t,r);else{let i=Es(n,``,e);if(t instanceof Map)t.set(i,Es(r,i,e));else if(t instanceof Set)t.add(i);else{let a=tte(n,i,e),o=Es(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function tte(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(ss(e)&&n?.doc){let t=Js(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Xs(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function rc(e,t,n){return new ic(js(e,void 0,n),js(t,void 0,n))}var ic=class e{constructor(e,t=null){Object.defineProperty(this,Qo,{value:Yo}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return ss(n)&&(n=n.clone(t)),ss(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return nc(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?$ee(this,e,t,n):JSON.stringify(this)}};function ac(e,t,n){return(t.inFlow??e.flow?rte:nte)(e,t,n)}function nte({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(ss(i))!d&&i.spaceBefore&&f.push(``),oc(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(ns(i)){let e=ss(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),oc(n,f,e.commentBefore,d))}d=!1;let s=Ys(i,u,()=>o=null,()=>d=!0);o&&(s+=Is(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
|
|
98
98
|
`}}return e?(p+=`
|
|
99
|
-
`+
|
|
100
|
-
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=
|
|
101
|
-
`;return`${e}\n${i}${p}`}else return`${f}${o}${d.join(` `)}${o}${p}`}function
|
|
102
|
-
`:` `)}return
|
|
103
|
-
`)?(n.push(`...`),n.push(
|
|
99
|
+
`+Fs(l(e),c),s&&s()):d&&o&&o(),p}function rte({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(ss(i))i.spaceBefore&&d.push(``),oc(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(ns(i)){let e=ss(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),oc(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=ss(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Ys(i,c,()=>a=null);l||=d.length>u||o.includes(`
|
|
100
|
+
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=Is(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
|
|
101
|
+
`;return`${e}\n${i}${p}`}else return`${f}${o}${d.join(` `)}${o}${p}`}function oc({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=Fs(t(r),e);n.push(i.trimStart())}}function sc(e,t){let n=rs(t)?t.value:t;for(let r of e)if(ns(r)&&(r.key===t||r.key===n||rs(r.key)&&r.key.value===n))return r}var cc=class extends Ps{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Jo,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(rc(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=ns(e)?e:!e||typeof e!=`object`||!(`key`in e)?new ic(e,e?.value):new ic(e.key,e.value);let r=sc(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);rs(r.value)&&As(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=sc(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=sc(this.items,e)?.value;return(!t&&rs(n)?n.value:n)??void 0}has(e){return!!sc(this.items,e)}set(e,t){this.add(new ic(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)nc(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!ns(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),ac(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},lc={collection:`map`,default:!0,nodeClass:cc,tag:`tag:yaml.org,2002:map`,resolve(e,t){return ts(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>cc.from(e,t,n)},uc=class extends Ps{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Zo,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=dc(e);return typeof t==`number`?this.items.splice(t,1).length>0:!1}get(e,t){let n=dc(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&rs(r)?r.value:r}has(e){let t=dc(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=dc(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];rs(r)&&As(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(Es(e,String(r++),t));return n}toString(e,t,n){return e?ac(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(js(a,void 0,n))}}return i}};function dc(e){let t=rs(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var fc={collection:`seq`,default:!0,nodeClass:uc,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return is(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>uc.from(e,t,n)},pc={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),qs(e,t,n,r)}},mc={identify:e=>e==null,createNode:()=>new V(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new V(null),stringify:({source:e},t)=>typeof e==`string`&&mc.test.test(e)?e:t.options.nullStr},hc={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new V(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&hc.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function gc({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-- >0;)a+=`0`}return a}var _c={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:gc},vc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():gc(e)}},yc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new V(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:gc},bc=e=>typeof e==`bigint`||Number.isInteger(e),xc=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function Sc(e,t,n){let{value:r}=e;return bc(r)&&r>=0?n+r.toString(t):gc(e)}var Cc={identify:e=>bc(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>xc(e,2,8,n),stringify:e=>Sc(e,8,`0o`)},wc={identify:bc,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>xc(e,0,10,n),stringify:gc},Tc={identify:e=>bc(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>xc(e,2,16,n),stringify:e=>Sc(e,16,`0x`)},Ec=[lc,fc,pc,mc,hc,Cc,wc,Tc,_c,vc,yc];function Dc(e){return typeof e==`bigint`||Number.isInteger(e)}var Oc=({value:e})=>JSON.stringify(e),kc=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Oc},{identify:e=>e==null,createNode:()=>new V(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Oc},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Oc},{identify:Dc,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Dc(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Oc}],Ac=[lc,fc].concat(kc,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),jc={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}else return t(`This environment does not support reading binary tags; either Buffer or atob is required`),e},stringify({comment:e,type:t,value:n},r,i,a){if(!n)return``;let o=n,s;if(typeof btoa==`function`){let e=``;for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);s=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t??=V.BLOCK_LITERAL,t!==V.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(s.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=s.substr(r,e);s=i.join(t===V.BLOCK_LITERAL?`
|
|
102
|
+
`:` `)}return qs({comment:e,type:t,value:s},r,i,a)}};function Mc(e,t){if(is(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!ns(r)){if(ts(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new ic(new V(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=ns(r)?r:new ic(r)}}else t(`Expected a sequence for this tag`);return e}function Nc(e,t,n){let{replacer:r}=n,i=new uc(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e))if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`);else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(rc(o,s,n))}return i}var Pc={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Mc,createNode:Nc},Fc=class e extends uc{constructor(){super(),this.add=cc.prototype.add.bind(this),this.delete=cc.prototype.delete.bind(this),this.get=cc.prototype.get.bind(this),this.has=cc.prototype.has.bind(this),this.set=cc.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(ns(e)?(r=Es(e.key,``,t),i=Es(e.value,r,t)):r=Es(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Nc(e,t,n),i=new this;return i.items=r.items,i}};Fc.tag=`tag:yaml.org,2002:omap`;var Ic={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Fc,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Mc(e,t),r=[];for(let{key:e}of n.items)rs(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Fc,n)},createNode:(e,t,n)=>Fc.from(e,t,n)};function Lc({value:e,source:t},n){return t&&(e?Rc:zc).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Rc={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new V(!0),stringify:Lc},zc={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new V(!1),stringify:Lc},Bc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:gc},Vc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():gc(e)}},Hc={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new V(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:gc},Uc=e=>typeof e==`bigint`||Number.isInteger(e);function Wc(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function Gc(e,t,n){let{value:r}=e;if(Uc(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return gc(e)}var Kc={identify:Uc,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Wc(e,2,2,n),stringify:e=>Gc(e,2,`0b`)},qc={identify:Uc,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Wc(e,1,8,n),stringify:e=>Gc(e,8,`0`)},Jc={identify:Uc,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Wc(e,0,10,n),stringify:gc},Yc={identify:Uc,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Wc(e,2,16,n),stringify:e=>Gc(e,16,`0x`)},Xc=class e extends cc{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=ns(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new ic(e.key,null):new ic(e,null),sc(this.items,t.key)||this.items.push(t)}get(e,t){let n=sc(this.items,e);return!t&&ns(n)?rs(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=sc(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new ic(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(rc(e,null,n));return i}};Xc.tag=`tag:yaml.org,2002:set`;var Zc={collection:`map`,identify:e=>e instanceof Set,nodeClass:Xc,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>Xc.from(e,t,n),resolve(e,t){if(ts(e)){if(e.hasAllNullValues(!0))return Object.assign(new Xc,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function Qc(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function $c(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return gc(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var el={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Qc(e,n),stringify:$c},tl={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Qc(e,!1),stringify:$c},nl={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(nl.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=Qc(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},rl=[lc,fc,pc,mc,Rc,zc,Kc,qc,Jc,Yc,Bc,Vc,Hc,jc,Qs,Ic,Pc,Zc,el,tl,nl],il=new Map([[`core`,Ec],[`failsafe`,[lc,fc,pc]],[`json`,Ac],[`yaml11`,rl],[`yaml-1.1`,rl]]),al={binary:jc,bool:hc,float:yc,floatExp:vc,floatNaN:_c,floatTime:tl,int:wc,intHex:Tc,intOct:Cc,intTime:el,map:lc,merge:Qs,null:mc,omap:Ic,pairs:Pc,seq:fc,set:Zc,timestamp:nl},ol={"tag:yaml.org,2002:binary":jc,"tag:yaml.org,2002:merge":Qs,"tag:yaml.org,2002:omap":Ic,"tag:yaml.org,2002:pairs":Pc,"tag:yaml.org,2002:set":Zc,"tag:yaml.org,2002:timestamp":nl};function sl(e,t,n){let r=il.get(t);if(r&&!e)return n&&!r.includes(Qs)?r.concat(Qs):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{let e=Array.from(il.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(Qs)),i.reduce((e,t)=>{let n=typeof t==`string`?al[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(al).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var cl=(e,t)=>e.key<t.key?-1:+(e.key>t.key),ll=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?sl(e,`compat`):e?sl(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?ol:{},this.tags=sl(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,Jo,{value:lc}),Object.defineProperty(this,Xo,{value:pc}),Object.defineProperty(this,Zo,{value:fc}),this.sortMapEntries=typeof a==`function`?a:a===!0?cl:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function ul(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=Js(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(Fs(t,``))}let o=!1,s=null;if(e.contents){if(ss(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(Fs(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=Ys(e.contents,i,()=>s=null,t);s&&(c+=Is(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Ys(e.contents,i));if(e.directives?.docEnd)if(e.comment){let t=a(e.comment);t.includes(`
|
|
103
|
+
`)?(n.push(`...`),n.push(Fs(t,``))):n.push(`... ${t}`)}else n.push(`...`);else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(Fs(a(t),``)))}return n.join(`
|
|
104
104
|
`)+`
|
|
105
|
-
`}var
|
|
106
|
-
`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function
|
|
107
|
-
`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(
|
|
108
|
-
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||
|
|
109
|
-
`+_.comment:g.comment=_.comment);let e=new
|
|
110
|
-
`+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&
|
|
111
|
-
`+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],
|
|
112
|
-
`+_.comment:g.comment=_.comment);let y=new
|
|
113
|
-
`+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function
|
|
105
|
+
`}var dl=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Qo,{value:qo});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new xs({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[Qo]:{value:qo}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=ss(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){fl(this.contents)&&this.contents.add(e)}addIn(e,t){fl(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=Cs(this);e.anchor=!t||n.has(t)?ws(t||`a`,n):t}return new Os(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=Uee(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=js(e,l,p);return o&&as(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new ic(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return fl(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ns(e)?this.contents==null?!1:(this.contents=null,!0):fl(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return as(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Ns(e)?!t&&rs(this.contents)?this.contents.value:this.contents:as(this.contents)?this.contents.getIn(e,t):void 0}has(e){return as(this.contents)?this.contents.has(e):!1}hasIn(e){return Ns(e)?this.contents!==void 0:as(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Ms(this.schema,[e],t):fl(this.contents)&&this.contents.set(e,t)}setIn(e,t){Ns(e)?this.contents=t:this.contents==null?this.contents=Ms(this.schema,Array.from(e),t):fl(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new xs({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new xs({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new ll(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=Es(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?Ts(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return ul(this,e)}};function fl(e){if(as(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var pl=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},ml=class extends pl{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},hl=class extends pl{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},gl=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
|
|
106
|
+
`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function _l(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}function vl(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
|
|
107
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(vl(t.key)||vl(t.value))return!0}return!1;default:return!0}}function yl(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&vl(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function bl(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||rs(e)&&rs(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var xl=`All mapping items must start at the same column`;function Sl({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new(a?.nodeClass??cc)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=_l(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,xl)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
|
|
108
|
+
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||vl(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,xl);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&yl(r.indent,u,i),n.atKey=!1,bl(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=_l(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&yl(r.indent,f,i),s=c.range[2];let l=new ic(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
|
|
109
|
+
`+_.comment:g.comment=_.comment);let e=new ic(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function Cl({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new(a?.nodeClass??uc)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=_l(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&yl(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function wl(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var Tl=`Block collections are not allowed within flow collections`,El=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function Dl({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new(a?.nodeClass??(o?cc:uc))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=_l(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
|
|
110
|
+
`+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&vl(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];ns(t)&&(t=t.value??t.key),t.comment?t.comment+=`
|
|
111
|
+
`+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],El(m)&&i(r.range,`BLOCK_IN_FLOW`,Tl)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);El(f)&&i(g.range,`BLOCK_IN_FLOW`,Tl),n.atKey=!1;let _=_l(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?El(m)&&i(v.range,`BLOCK_IN_FLOW`,Tl):_.comment&&(g.comment?g.comment+=`
|
|
112
|
+
`+_.comment:g.comment=_.comment);let y=new ic(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;bl(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new cc(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=wl(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
|
|
113
|
+
`+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function Ol(e,t,n,r,i,a){let o=n.type===`block-map`?Sl(e,t,n,r,a):n.type===`block-seq`?Cl(e,t,n,r,a):Dl(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function kl(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===cc.tagName&&s===`map`||o===uc.tagName&&s===`seq`)return Ol(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),Ol(e,t,n,i,o)}let l=Ol(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=ss(u)?u:new V(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function Al(e,t,n){let r=t.offset,i=jl(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?V.BLOCK_FOLDED:V.BLOCK_LITERAL,o=t.source?Ml(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
|
|
114
114
|
`.repeat(Math.max(1,o.length-1)):``,n=r+i.length;return t.source&&(n+=t.source.length),{value:e,type:a,comment:i.comment,range:[r,n,n]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let t=0;t<s;++t){let[r,a]=o[t];if(a===``||a===`\r`)i.indent===0&&r.length>c&&(c=r.length);else{r.length<c&&n(l+r.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),i.indent===0&&(c=r.length),u=t,c===0&&!e.atRoot&&n(l,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}l+=r.length+a.length+1}for(let e=o.length-1;e>=s;--e)o[e][0].length>c&&(s=e+1);let d=``,f=``,p=!1;for(let e=0;e<u;++e)d+=o[e][0].slice(c)+`
|
|
115
115
|
`;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===V.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
|
|
116
116
|
`):t.length>c||r[0]===` `?(f===` `?f=`
|
|
@@ -125,74 +125,74 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
125
125
|
`+o[e][0].slice(c);d[d.length-1]!==`
|
|
126
126
|
`&&(d+=`
|
|
127
127
|
`);break;default:d+=`
|
|
128
|
-
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function
|
|
128
|
+
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function jl({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function Ml(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function Nl(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=V.PLAIN,c=Pl(a,l);break;case`single-quoted-scalar`:s=V.QUOTE_SINGLE,c=Fl(a,l);break;case`double-quoted-scalar`:s=V.QUOTE_DOUBLE,c=Ll(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=wl(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function Pl(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`;break}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),Il(e)}function Fl(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),Il(e.slice(1,-1)).replace(/''/g,`'`)}function Il(e){let t,n;try{t=RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
129
129
|
`,`sy`),n=RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
130
130
|
`,`sy`)}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let i=r[1],a=` `,o=t.lastIndex;for(n.lastIndex=o;r=n.exec(e);)r[1]===``?a===`
|
|
131
131
|
`?i+=a:a=`
|
|
132
|
-
`:(i+=a+r[1],a=` `),o=n.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(e),i+a+(r?.[1]??``)}function
|
|
132
|
+
`:(i+=a+r[1],a=` `),o=n.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(e),i+a+(r?.[1]??``)}function Ll(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(!(i===`\r`&&e[r+1]===`
|
|
133
133
|
`))if(i===`
|
|
134
|
-
`){let{fold:t,offset:i}=
|
|
134
|
+
`){let{fold:t,offset:i}=Rl(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=zl[i];if(a)n+=a;else if(i===`
|
|
135
135
|
`)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
|
|
136
|
-
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=
|
|
136
|
+
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=Bl(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
|
|
137
137
|
`&&!(a===`\r`&&e[r+2]===`
|
|
138
|
-
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function
|
|
138
|
+
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function Rl(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
|
|
139
139
|
`||r===`\r`)&&!(r===`\r`&&e[t+2]!==`
|
|
140
140
|
`);)r===`
|
|
141
141
|
`&&(n+=`
|
|
142
|
-
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var
|
|
143
|
-
`,r:`\r`,t:` `,v:`\v`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function
|
|
142
|
+
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var zl={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
|
|
143
|
+
`,r:`\r`,t:` `,v:`\v`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Bl(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function Vl(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?Al(e,t,r):Nl(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[Xo]:c?Hl(e.schema,i,c,n,r):t.type===`scalar`?Ul(e,i,t,r):e.schema[Xo];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=rs(a)?a:new V(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new V(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function Hl(e,t,n,r,i){if(n===`!`)return e[Xo];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n)if(t.default&&t.test)a.push(t);else return t;for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[Xo])}function Ul({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[Xo];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Xo];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function Wl(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var Gl={composeNode:Kl,composeEmptyNode:ql};function Kl(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=Jl(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=Vl(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=kl(Gl,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=ql(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!rs(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function ql(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=Vl(e,{type:`scalar`,offset:Wl(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function Jl({options:e},{offset:t,source:n,end:r},i){let a=new Os(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=wl(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function Yl(e,t,{offset:n,start:r,value:i,end:a},o){let s=new dl(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=_l(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?Kl(c,i,l,o):ql(c,l.end,r,null,l,o);let u=s.contents.range[2],d=wl(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Xl(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function Zl(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
|
|
144
144
|
|
|
145
145
|
`:`
|
|
146
|
-
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var
|
|
146
|
+
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var Ql=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Xl(e);r?this.warnings.push(new hl(i,t,n)):this.errors.push(new ml(i,t,n))},this.directives=new xs({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Zl(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(as(i)&&!i.flow&&i.items.length>0){let e=i.items[0];ns(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Zl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=Xl(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=Yl(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new ml(Xl(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new ml(Xl(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=wl(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new ml(Xl(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new dl(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},$l=Symbol(`break visit`),eu=Symbol(`skip children`),tu=Symbol(`remove item`);function nu(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),ru(Object.freeze([]),e,t)}nu.BREAK=$l,nu.SKIP=eu,nu.REMOVE=tu,nu.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},nu.parentCollection=(e,t)=>{let n=nu.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function ru(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=ru(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===$l)return $l;else r===tu&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function iu(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
|
|
147
147
|
`:case`\r
|
|
148
|
-
`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function
|
|
149
|
-
`:case`\r`:case` `:return!0;default:return!1}}var
|
|
150
|
-
\r `),
|
|
148
|
+
`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function au(e){switch(e){case void 0:case` `:case`
|
|
149
|
+
`:case`\r`:case` `:return!0;default:return!1}}var ou=new Set(`0123456789ABCDEFabcdef`),su=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),cu=new Set(`,[]{}`),lu=new Set(` ,[]{}
|
|
150
|
+
\r `),uu=e=>!e||lu.has(e),du=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
|
|
151
151
|
`?!0:t===`\r`?this.buffer[e+1]===`
|
|
152
152
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===` `;)t=this.buffer[++n+e];if(t===`\r`){let t=this.buffer[n+e+1];if(t===`
|
|
153
153
|
`||!t&&!this.atEnd)return e+n+1}return t===`
|
|
154
|
-
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&
|
|
155
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}else n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&
|
|
154
|
+
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&au(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
155
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}else n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&au(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!au(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&au(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(uu),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&au(r[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(r[0]===`]`||r[0]===`}`)))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(uu),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||au(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
|
|
156
156
|
`,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
|
|
157
|
-
`,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>
|
|
157
|
+
`,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>au(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
|
|
158
158
|
`:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
|
|
159
159
|
`)break}default:break loop}if(!n&&!this.atEnd)return this.setNext(`block-scalar`);if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
|
|
160
160
|
`,t)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(`block-scalar`);e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===` `;)n=this.buffer[++r];if(n===` `){for(;n===` `||n===` `||n===`\r`||n===`
|
|
161
161
|
`;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let n=e-1,r=this.buffer[n];r===`\r`&&(r=this.buffer[--n]);let i=n;for(;r===` `;)r=this.buffer[--n];if(r===`
|
|
162
|
-
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(!0);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(
|
|
162
|
+
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(!0);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(au(r)||e&&cu.has(r))break;t=n}else if(au(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
|
|
163
163
|
`?(n+=1,r=`
|
|
164
|
-
`,i=this.buffer[n+1]):t=n),i===`#`||e&&
|
|
165
|
-
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&
|
|
164
|
+
`,i=this.buffer[n+1]):t=n),i===`#`||e&&cu.has(i))break;if(r===`
|
|
165
|
+
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&cu.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(uu),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(au(n)||t&&cu.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!au(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(su.has(t))t=this.buffer[++e];else if(t===`%`&&ou.has(this.buffer[e+1])&&ou.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
166
166
|
`?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
|
|
167
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},
|
|
167
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},fu=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function pu(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function mu(e){for(let t=0;t<e.length;++t)switch(e[t].type){case`space`:case`comment`:case`newline`:break;default:return t}return-1}function hu(e){switch(e?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function gu(e){switch(e.type){case`document`:return e.start;case`block-map`:{let t=e.items[e.items.length-1];return t.sep??t.start}case`block-seq`:return e.items[e.items.length-1].start;default:return[]}}function _u(e){if(e.length===0)return[];let t=e.length;loop:for(;--t>=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function vu(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function yu(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!pu(t.start,`explicit-key-ind`)&&!pu(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,hu(t.value)?t.value.end?vu(t.value.end,t.sep):t.value.end=t.sep:vu(t.start,t.sep),delete t.sep)}var bu=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new du,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=iu(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(t===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=t,yield*this.step(),t){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&yu(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&mu(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.indent<t.indent))&&(e.type===`document`?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case`directive-line`:yield{type:`directive`,offset:this.offset,source:this.source};return;case`byte-order-mark`:case`space`:case`comment`:case`newline`:yield this.sourceToken;return;case`doc-mode`:case`doc-start`:{let e={type:`document`,offset:this.offset,start:[]};this.type===`doc-start`&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case`doc-start`:mu(e.start)===-1?e.start.push(this.sourceToken):(yield*this.pop(),yield*this.step());return;case`anchor`:case`tag`:case`space`:case`comment`:case`newline`:e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type===`map-value-ind`){let t=_u(gu(this.peek(2))),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case`space`:case`comment`:case`newline`:e.props.push(this.sourceToken);return;case`scalar`:if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf(`
|
|
168
168
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
169
|
-
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){
|
|
169
|
+
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){vu(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey)if(!t.sep)if(pu(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=_u(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(pu(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(hu(t.key)&&!pu(t.sep,`newline`)){let e=_u(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):pu(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!pu(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){vu(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||pu(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=_u(gu(t));yu(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
|
|
170
170
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
171
|
-
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=gu(hu(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=gu(hu(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function bu(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new du||null,prettyErrors:t}}function xu(e,t={}){let{lineCounter:n,prettyErrors:r}=bu(t),i=new yu(n?.addNewLine),a=new Zl(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new pl(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(hl(e,n)),o.warnings.forEach(hl(e,n))),o}function Su(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=xu(e,n);if(!i)return null;if(i.warnings.forEach(e=>Ys(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}var Cu=[`off`,`follow`,`full`],wu=[`follow`,`full`],Tu=`pull`,Eu=[`off`,`follow`,`full`,Tu],Du=[`follow`,`full`,Tu];function Ou(e){return e===Tu?`follow`:ku(e)?e:null}function ku(e){return typeof e==`string`&&Cu.includes(e)}function Au(e){return typeof e==`string`&&wu.includes(e)}function ju(e){let t=e?.resumeMode;return t===Tu?`follow`:Au(t)?t:null}function Mu(e){return Lu(e)===`off`&&ju(e)!==null}function Nu(e){let t=Lu(e);return t===`follow`||t===`full`||Mu(e)}function Pu(e){let t=Lu(e);return Au(t)?t:ju(e)??`full`}function Fu(e){return e===!0?`full`:e===!1?`off`:null}function Iu(e){return e===!0?`full`:e===!1?`off`:Ou(e)}function Lu(e){let t=Ou(e?.mode);return t===null?Fu(e?.enabled):t}var Ru={sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,feature:`gherkin`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`},zu=new Set(Object.keys(Ru));function Bu(e){return Ru[e.toLowerCase().replace(/^\./,``)]??null}var Vu=new Set([`md`,`mdx`,`mmd`,`mermaid`]),Hu=new Set([...zu,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!Vu.has(e))),Uu={html:`html`,htm:`html`,svg:`xml`,vue:`html`,svelte:`html`,astro:`html`,lock:`yaml`};function Wu(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:Hu.has(t.slice(n+1).toLowerCase())}var Gu=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],Ku=[`video/mp4`,`video/webm`,`video/ogg`],qu=[`audio/mpeg`,`audio/wav`,`audio/ogg`],Ju=[`application/pdf`],Yu=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Xu=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),Zu=new Set([`pdf`]),Qu=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),$u=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),ed=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),td=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),nd=`wikiembed`,rd=`toast`,id=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),ad=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],od=[`mp4`,`webm`,`mov`,`m4v`],sd=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],cd=[`pdf`],ld=[`json`,`toml`,`lock`];function ud(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}ud(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,ad,Yu),ud(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,od,Xu),ud(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,sd,Qu),ud(`SIDEBAR_PDF_ASSET_EXTENSIONS`,cd,Zu),ud(`FILE_ATTACHMENT_EXTENSIONS`,[...$u],id),ud(`WIKI_EMBED_EXTENSIONS`,[...id],ed);var dd=new Set(ad),fd=new Set(od),pd=new Set(sd),md=new Set(cd),hd=new Set(ld);ud(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...ad,...od,...sd,...cd,...ld])],td);var gd=new Set([`base`,`canvas`]),_d=new Set([`mmd`,`mermaid`]);function vd(e){let t=e.lastIndexOf(`.`);return t<0?!1:_d.has(e.slice(t+1).toLowerCase())}new Set([...ed,...gd,..._d]);function yd(e){let t=e.toLowerCase().replace(/^\./,``);return dd.has(t)?`image`:fd.has(t)?`video`:pd.has(t)?`audio`:md.has(t)?`pdf`:hd.has(t)||gd.has(t)?`text`:_d.has(t)?`mermaid`:zu.has(t)?`text`:null}var bd=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`],xd=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`fr`,`bn`,`pt-BR`,`id`],Sd=new Set([`ar`,`ur`]),Cd=bd.filter(e=>!Sd.has(e)),wd=[`off`,`warning`,`error`],Td=`warning`,Ed=[`error`,`warning`],Dd=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],Od={base00:`default background`,base01:`alt background — cards, popovers, sidebar`,base02:`selection background, borders`,base03:`comments, invisibles`,base04:`secondary text`,base05:`default foreground`,base06:`light foreground`,base07:`lightest foreground`,base08:`red — variables, tags, diff deleted`,base09:`orange — numbers, constants`,base0A:`yellow — classes, search highlight`,base0B:`green — strings, diff inserted`,base0C:`cyan — support, escapes, quotes`,base0D:`blue — functions, headings, accent`,base0E:`magenta — keywords, storage`,base0F:`deprecated markers, embedded tags`},kd=/^#[0-9a-fA-F]{6}$/,Ad=/\P{White_Space}/u;function jd(e){return Ad.test(e)}function Md(e){return typeof e==`string`&&kd.test(e)}function Nd(e){let t=e.palette;return{background:t.base00,foreground:t.base05,card:t.base01,"card-foreground":t.base05,popover:t.base01,"popover-foreground":t.base05,primary:t.base0D,"primary-foreground":t.base00,secondary:t.base01,"secondary-foreground":t.base05,muted:t.base01,"muted-foreground":t.base04,accent:t.base02,"accent-foreground":t.base05,destructive:t.base08,border:t.base02,input:t.base02,ring:t.base0D,"selection-soft":t.base02,"chart-1":t.base0D,"chart-2":t.base0B,"chart-3":t.base0A,"chart-4":t.base0E,"chart-5":t.base08,sidebar:t.base01,"sidebar-foreground":t.base05,"sidebar-primary":t.base0D,"sidebar-primary-foreground":t.base00,"sidebar-accent":t.base02,"sidebar-accent-foreground":t.base0D,"sidebar-hover":t.base02,"sidebar-border":t.base02,"sidebar-ring":t.base0D,"syntax-keyword":t.base0E,"syntax-tag":t.base08,"syntax-attr":t.base0D,"syntax-string":t.base0B,"syntax-number":t.base09,"syntax-atom":t.base0C,"syntax-comment":t.base03,"syntax-func":t.base0D,"syntax-var":t.base08,"syntax-type":t.base0A,"syntax-operator":t.base05,"syntax-meta":t.base0F,"syntax-bg":t.base01,"link-color":t.base0D,"broken-link-color":t.base08,"lint-warning-color":t.base0A,"lint-error-color":t.base08,"diff-added":t.base0B,"diff-removed":t.base08,"callout-note-color":t.base0D,"callout-info-color":t.base0D,"callout-todo-color":t.base0D,"callout-abstract-color":t.base0C,"callout-tip-color":t.base0B,"callout-success-color":t.base0B,"callout-important-color":t.base0E,"callout-example-color":t.base0E,"callout-question-color":t.base0E,"callout-warning-color":t.base0A,"callout-caution-color":t.base09,"callout-danger-color":t.base09,"callout-failure-color":t.base08,"callout-bug-color":t.base08,"callout-quote-color":t.base03,...Id(t)}}var Pd={black:`base00`,red:`base08`,green:`base0B`,yellow:`base0A`,blue:`base0D`,magenta:`base0E`,cyan:`base0C`,white:`base05`,brightBlack:`base03`,brightRed:`base08`,brightGreen:`base0B`,brightYellow:`base0A`,brightBlue:`base0D`,brightMagenta:`base0E`,brightCyan:`base0C`,brightWhite:`base07`},Fd=Object.keys(Pd);function Id(e){let t={};for(let n of Fd)t[`ansi-${Ld(n)}`]=e[Pd[n]];return t}function Ld(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function Rd(e){return JSON.stringify(e).replace(/[\u007f-\u009f\u2028\u2029\ufffe\uffff]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}function zd(e){return`${[`system: "base16"`,`name: ${Rd(e.name)}`,...e.author?[`author: ${Rd(e.author)}`]:[],`variant: ${Rd(e.variant)}`,`palette:`,...Dd.map(t=>` ${t}: ${Rd(e.palette[t])}`)].join(`
|
|
172
|
-
`)}\n`}function
|
|
173
|
-
`)}\n}`}var _f=Symbol.for(`@inkeep/open-knowledge/field-registry`),vf=globalThis;vf[_f]===void 0&&(vf[_f]=wr());var H=vf[_f];function yf(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=bf(t)?H.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function bf(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}function xf(){return Object.fromEntries(Dd.map(e=>[e,N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${Od[e]}, as a #rrggbb hex string.`}).optional()]))}function Sf(){return ef.filter(e=>e!==`default`&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}var Cf=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),wf=52428800,Tf=26214400,Ef=12582912,Df=`https://api.openai.com/v1`,Of=`text-embedding-3-small`,kf=Object.freeze([`127.0.0.1`]),Af=/^[1-9]\d*(s|m|h)$/,jf=/^https?:\/\//;function Mf(e){let t;try{t=new URL(e)}catch{return!1}let n=t.hostname.toLowerCase();return n===`localhost`||n===`127.0.0.1`||n===`[::1]`}function Nf(e){let t;try{t=new URL(e)}catch{return`invalid-url`}return t.protocol===`https:`||t.protocol===`http:`&&Mf(e)?null:`insecure-scheme`}function Pf(e){let t=e.trim();return t===``?`./`:t}function Ff(e){let t=Pf(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}var If=R({content:R({dir:N().register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore. Read at server start; changing it requires a restart.`}).default(`.`),attachmentFolderPath:N().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(Ff,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:R({theme:z([`light`,`dark`,`system`]).register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),language:z([`system`,...bd]).register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Interface language. 'system' follows the operating system. A personal preference (user scope) — not shared with the project, and never applied to document content.`}).optional(),colorThemeLight:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Sf()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(tf,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeDark:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Sf()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(tf,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorTheme:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A short theme id (lowercase letters, digits, and hyphens; max 32 characters); an id no palette matches falls back to 'default'. A personal preference (user scope) — not shared with the project.`}).regex(tf,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeEnabled:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:R({name:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:z([`dark`,`light`]).register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...xf()}).optional(),preview:R({autoOpen:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:R({showHiddenFiles:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1)}).optional()}).default({preview:{autoOpen:!0}}),editor:R({wordWrap:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Reuse one tab when clicking through the Files and Skills sidebars, the way an editor preview tab works. Turn off to open every click in its own tab. Pinned tabs keep their own tab either way. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0,previewTabs:!0}),agents:R({autoApproveOkTools:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."}).default(!0)}).default({autoApproveOkTools:!0}),autoSync:R({mode:z(Eu).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`How this machine syncs this project with its git remote: 'off' (no sync), 'follow' (one-directional — pull remote changes, never push your own; 'pull' is accepted as a legacy alias), or 'full' (bidirectional pull and push). null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared. Supersedes the legacy autoSync.enabled boolean.`}).nullable().default(null),enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Legacy per-machine sync toggle, superseded by autoSync.mode. Read only when mode is absent (true = full, false = off). null = not chosen yet. Per-machine (project-local) — not shared.`}).nullable().default(null),resumeMode:z(Du).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`When sync is paused (autoSync.mode 'off') after having been enabled, the active mode to resume into ('follow' | 'full'). Per-machine UI memory; ignored while a mode is active. Not shared.`}).optional(),default:so([F(),z(Eu)]).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Committed project default for a machine's sync mode on first open: 'off' | 'follow' | 'full', or the legacy boolean (true = full, false = off). null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.mode choice overrides it.`}).nullable().default(null)}).default({mode:null,enabled:null,default:null}),terminal:R({enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null)}).default({enabled:null}),slides:R({enabled:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Whether the Slides plugin appears in Settings → Plugins. When on, a document whose frontmatter has `slides: true` offers an action that opens the deck in a dedicated window (desktop only, requires a resolvable slidev). A personal preference (user scope). Default off."}).default(!1)}).default({enabled:!1}),telemetry:R({localSink:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:R({maxBytes:P().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(wf)}).default({maxBytes:wf}),logs:R({maxBytes:P().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(Tf)}).default({maxBytes:Tf}),attributeDenylist:I(N()).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...Cf])}).default({enabled:!0,spans:{maxBytes:wf},logs:{maxBytes:Tf},attributeDenylist:[...Cf]}),skillInstallReports:R({enabled:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Report skill installs to skills.sh so a published skill shows an accurate install count. Sends the skill name, its source repo, and which agent tools it was installed for — never file contents, and never for a private or local source. One report per skill per machine. Default on; the DO_NOT_TRACK and DISABLE_TELEMETRY environment variables also turn it off.`}).default(!0)}).default({enabled:!0})}).default({localSink:{enabled:!0,spans:{maxBytes:wf},logs:{maxBytes:Tf},attributeDenylist:[...Cf]},skillInstallReports:{enabled:!0}}),lossCapture:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Record bridge loss-class events (content-free) under .ok/local/loss-capture/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),maxBytes:P().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(Ef)}).default({enabled:!0,maxBytes:Ef}),bridge:R({backgroundThrottle:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Keep the desktop window's timers running at full rate while it holds unsynced work, so backgrounding the app never starves sync or recovery; when the window is idle the OS-default background throttling is restored (battery). Honored by the desktop app. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),deferGuard:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Defer a drain-shaped Observer B re-derive when the WYSIWYG fragment holds an un-propagated keystroke Y.Text lacks, so the keystroke survives instead of being stomped. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),lossDetector:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Detect content the bridge silently dropped at its reconciliation boundary (an Observer-A apply arm or a paired agent-undo derive) and write a recovery checkpoint plus a content-free loss event. Detection only — never blocks a write. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),fixedPoint:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Bound the Y.Text→WYSIWYG re-derive loop with a drain-count backstop: a run of re-derive drains that never reaches a raw-byte fixed point freezes the re-derive loop and writes a recovery checkpoint plus a content-free loss event, instead of churning unbounded. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),preDrain:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Before an agent write or undo rebuilds the WYSIWYG fragment, flush an un-propagated keystroke that provably does not overlap the operation into Y.Text so the keystroke survives instead of needing recovery; overlapping or unmodellable cases fall back to the checkpoint floor. Scope: appending writes and single-frame undos — a write that replaces the whole body (replace / edit) overwrites the keystroke either way, so those always take the checkpoint floor. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),flushOnHide:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`On tab hide/unload, force-send each doc's unsynced work to the server and commit its local cache, and re-sync on return to foreground, so a backgrounded tab never strands edits that IndexedDB alone would lose on recycle. Honored client-side. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0})}).default({backgroundThrottle:{enabled:!0},deferGuard:{enabled:!0},lossDetector:{enabled:!0},fixedPoint:{enabled:!0},preDrain:{enabled:!0},flushOnHide:{enabled:!0}}),search:R({semantic:R({enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:N().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override to point at a self-hosted server (Ollama / vLLM / LM Studio) or another provider. The API key is NOT stored here — set it with `ok embeddings set-key` (`~/.ok/secrets.yml`); it is sent to whichever endpoint this names."}).default(Df),model:N().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(Of),dimensions:P().int().positive().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit (recommended) to detect the model's native size from its first response — that is what lets a non-OpenAI model work without knowing its size up front. Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality; a server that ignores the request param then fails loudly instead of silently. Changing it re-embeds the corpus.`}).optional(),similarityFloor:P().min(0).max(1).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional()}).default({enabled:!1,baseUrl:Df,model:Of})}).default({semantic:{enabled:!1,baseUrl:Df,model:Of}}),contentRules:R({markdownlint:L({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:L({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:I(L({appliesTo:so([N(),I(N())]).optional(),file:N(),enabled:F().optional()})).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Frontmatter schema mappings: which docs (appliesTo globs) validate against which JSON Schema file (project-root-relative path).`}).default([])}).default({enabled:!1,schemas:[]})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]}}),validation:R({links:z(wd).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(Td),fileTreeIndicators:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0)}).default({links:Td,fileTreeIndicators:!0}),linkPreviews:R({enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata — outbound egress, one request per previewed link. Default ON; set to false to turn external previews off. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!0)}).default({enabled:!0}),remote:R({url:N().register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:"Superseded by server.publicUrl — read only while server.publicUrl is absent. Public URL your tunnel gives you, e.g. https://myproject.ngrok.app. Used only with `ok start --remote` (config alone never enables remote access); its host is admitted through the Host-header allowlist. There is no server-side auth, so restrict access at the tunnel (ngrok OAuth, Cloudflare Access, Tailscale ACLs)."}).optional(),port:P().int().min(1).max(65535).register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Superseded by server.port — read only while server.port is absent. TCP port the server binds when remote access is enabled (default 24550). Fixed so the tunnel's port mapping survives restarts. Set it only on a conflict. An explicit --port still wins; the PORT env var is ignored in remote mode.`}).optional()}).default({}),server:R({port:P().int().min(1).max(65535).register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`TCP port the server listens on. Unset by default: a local start picks a free port dynamically, and deployment platforms inject the PORT environment variable instead. Supersedes remote.port (still read while this key is absent). Read at server start; changing it requires a restart.`}).optional(),bind:I(N().min(1)).min(1).register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Addresses the server binds, e.g. [127.0.0.1] or [0.0.0.0]. Default loopback-only ([127.0.0.1]): nothing off this machine can connect. A non-loopback bind additionally requires the server.allowExternal consent interlock. Lists replace, never merge. Read at server start; changing it requires a restart.`}).default([...kf]),publicUrl:Ma({protocol:/^https?$/}).regex(jf).register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Canonical external origin the server is reached at, e.g. https://kb.example.com — drives issued URLs and CORS. Unset by default: a loopback server derives http://localhost:<port>. Setting it declares external exposure, which additionally requires the server.allowExternal consent interlock. Supersedes remote.url (still read while this key is absent). Read at server start; changing it requires a restart.`}).optional(),allowExternal:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Exposure consent interlock. Once the unified server boot lands, a non-loopback server.bind or a server.publicUrl without allowExternal: true will be refused at boot with a one-line fix. Default off. Per-machine (project-local) — consent never travels via git, clone, or share; containers consent via the environment instead.`}).default(!1),openBrowser:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Open the UI in a browser when the server starts. Default derived: true when every bind address is loopback (a laptop start pops the UI), false otherwise (a container or exposed bind is headless and must never try). Acts once at start. Per-machine (project-local) — not shared.`}).optional(),idleShutdown:so([B(`off`),N().regex(Af)]).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m' when every bind address is loopback, 'off' otherwise (an exposed or containerized server stays up). Reloadable — a valid change applies without a restart. Per-machine (project-local) — not shared.`}).optional()}).default({bind:[...kf],allowExternal:!1})}),Lf=`open-knowledge-config`;function Rf(e,t,n){let r=c.getTracer(Lf),i=t?{attributes:t}:{};return r.startActiveSpan(e,i,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:s.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function zf(e,t){let n=c.getActiveSpan();n&&n.addEvent(e,t)}function Bf(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function Vf(e,t){let n=e;for(let e of t){n=Bf(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function Hf(e,t){let n=Vf(e,t);if(n!==void 0)return yf(n)}function Uf(e,t){return e===`either`?!0:e===t}function Wf(e,t){let n=null;function r(e,i){if(n!==null||e===void 0)return;if(typeof e==`object`&&e&&!Array.isArray(e)){for(let[t,a]of Object.entries(e))if(r(a,[...i,t]),n!==null)return;return}let a=Hf(If,i);a?.scope!==void 0&&(Uf(a.scope,t)||(n={code:`SCOPE_VIOLATION`,path:i,expectedScope:a.scope,actualScope:t}))}for(let[t,i]of Object.entries(e))if(r(i,[t]),n!==null)break;return n}function Gf(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&(as(e.getIn(r,!0))||e.deleteIn(r))}}function Kf(e,t){let n=[];function r(t,i){if(t!==void 0){if(t===null){e.deleteIn(i),n.push(i.join(`.`));return}if(Array.isArray(t)){Gf(e,i),e.setIn(i,t),n.push(i.join(`.`));return}if(typeof t==`object`){for(let[e,n]of Object.entries(t))r(n,[...i,e]);return}Gf(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function qf(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}var Jf=L({file:N(),line:P().int().min(1),column:P().int().min(1),snippet:N().optional()}),Yf=L({path:I(so([N(),P()])),message:N(),issueCode:N(),params:mo(N(),to()).optional(),source:Jf.optional()}),Xf=z([`user`,`project`,`project-local`,`either`]),Zf=z([`user`,`project`,`project-local`]),Qf=L({code:B(`YAML_PARSE`),detail:N()}),$f=L({code:B(`UNREADABLE`),detail:N()}),ep=L({code:B(`SCHEMA_INVALID`),issues:I(Yf)}),tp=L({code:B(`REMOVED_KEY`),path:I(N()),redirect:N(),source:Jf.optional()}),np=lo(`code`,[Qf,ep,$f,L({code:B(`SCOPE_VIOLATION`),path:I(N()),expectedScope:Xf,actualScope:Zf}),L({code:B(`NOT_AGENT_SETTABLE`),path:I(N())}),L({code:B(`MIXED_SCOPE`),paths:I(L({path:I(N()),scope:Zf}))}),tp,L({code:B(`WRITE_ERROR`),detail:N()}),L({code:B(`OKIGNORE_INVALID`),detail:N(),lineNumber:P().int().min(1).optional()}),L({code:B(`UNKNOWN`),message:N().optional()})]);lo(`code`,[tp,Qf,ep,$f]),L({diagnostics:I(lo(`code`,[L({code:B(`REMOVED_KEY`),scope:Zf,file:N(),path:I(N()),redirect:N()}),L({code:B(`YAML_PARSE`),scope:Zf,file:N()}),L({code:B(`SCHEMA_INVALID`),scope:Zf,file:N()}),L({code:B(`UNREADABLE`),scope:Zf,file:N()})]))});var rp=new Set(np.options.map(e=>e.shape.code.value)),ip=so([np,R({code:N(),message:N().optional()})]);function ap(e){return rp.has(e.code)}function op(e){switch(e){case`user`:return`~/.ok/global.yml`;case`project`:return`.ok/config.yml`;case`project-local`:return`.ok/local/config.yml`;case`either`:return`.ok/config.yml or ~/.ok/global.yml`}}function sp(e){switch(e){case`user`:return`personal to you, across all projects`;case`project`:return`shared with your team via git`;case`project-local`:return`this machine only, not shared`;case`either`:return`user or project`}}function cp(e){if(!ap(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`UNREADABLE`:return`Could not read the file: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
|
|
171
|
+
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=_u(gu(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=_u(gu(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function xu(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new fu||null,prettyErrors:t}}function Su(e,t={}){let{lineCounter:n,prettyErrors:r}=xu(t),i=new bu(n?.addNewLine),a=new Ql(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new ml(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(gl(e,n)),o.warnings.forEach(gl(e,n))),o}function Cu(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=Su(e,n);if(!i)return null;if(i.warnings.forEach(e=>Xs(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}var wu=[`off`,`follow`,`full`],Tu=[`follow`,`full`],Eu=`pull`,Du=[`off`,`follow`,`full`,Eu],Ou=[`follow`,`full`,Eu];function ku(e){return e===Eu?`follow`:Au(e)?e:null}function Au(e){return typeof e==`string`&&wu.includes(e)}function ju(e){return typeof e==`string`&&Tu.includes(e)}function Mu(e){let t=e?.resumeMode;return t===Eu?`follow`:ju(t)?t:null}function Nu(e){return Ru(e)===`off`&&Mu(e)!==null}function Pu(e){let t=Ru(e);return t===`follow`||t===`full`||Nu(e)}function Fu(e){let t=Ru(e);return ju(t)?t:Mu(e)??`full`}function Iu(e){return e===!0?`full`:e===!1?`off`:null}function Lu(e){return e===!0?`full`:e===!1?`off`:ku(e)}function Ru(e){let t=ku(e?.mode);return t===null?Iu(e?.enabled):t}var zu={sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,feature:`gherkin`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`},Bu=new Set(Object.keys(zu));function Vu(e){return zu[e.toLowerCase().replace(/^\./,``)]??null}var Hu=new Set([`md`,`mdx`,`mmd`,`mermaid`]),Uu=new Set([...Bu,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!Hu.has(e))),Wu={html:`html`,htm:`html`,svg:`xml`,vue:`html`,svelte:`html`,astro:`html`,lock:`yaml`};function Gu(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:Uu.has(t.slice(n+1).toLowerCase())}var Ku=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],qu=[`video/mp4`,`video/webm`,`video/ogg`],Ju=[`audio/mpeg`,`audio/wav`,`audio/ogg`],Yu=[`application/pdf`],Xu=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Zu=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),Qu=new Set([`pdf`]),$u=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),ed=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),td=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),nd=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),rd=`wikiembed`,id=`toast`,ad=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),od=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],sd=[`mp4`,`webm`,`mov`,`m4v`],cd=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],ld=[`pdf`],ud=[`json`,`toml`,`lock`];function dd(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}dd(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,od,Xu),dd(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,sd,Zu),dd(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,cd,$u),dd(`SIDEBAR_PDF_ASSET_EXTENSIONS`,ld,Qu),dd(`FILE_ATTACHMENT_EXTENSIONS`,[...ed],ad),dd(`WIKI_EMBED_EXTENSIONS`,[...ad],td);var fd=new Set(od),pd=new Set(sd),md=new Set(cd),hd=new Set(ld),gd=new Set(ud);dd(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...od,...sd,...cd,...ld,...ud])],nd);var _d=new Set([`base`,`canvas`]),vd=new Set([`mmd`,`mermaid`]);function yd(e){let t=e.lastIndexOf(`.`);return t<0?!1:vd.has(e.slice(t+1).toLowerCase())}new Set([...td,..._d,...vd]);function bd(e){let t=e.toLowerCase().replace(/^\./,``);return fd.has(t)?`image`:pd.has(t)?`video`:md.has(t)?`audio`:hd.has(t)?`pdf`:gd.has(t)||_d.has(t)?`text`:vd.has(t)?`mermaid`:Bu.has(t)?`text`:null}var xd=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`],Sd=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`fr`,`bn`,`pt-BR`,`id`],Cd=new Set([`ar`,`ur`]),wd=xd.filter(e=>!Cd.has(e)),Td=[`off`,`warning`,`error`],Ed=`warning`,Dd=[`error`,`warning`],Od=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],kd={base00:`default background`,base01:`alt background — cards, popovers, sidebar`,base02:`selection background, borders`,base03:`comments, invisibles`,base04:`secondary text`,base05:`default foreground`,base06:`light foreground`,base07:`lightest foreground`,base08:`red — variables, tags, diff deleted`,base09:`orange — numbers, constants`,base0A:`yellow — classes, search highlight`,base0B:`green — strings, diff inserted`,base0C:`cyan — support, escapes, quotes`,base0D:`blue — functions, headings, accent`,base0E:`magenta — keywords, storage`,base0F:`deprecated markers, embedded tags`},Ad=/^#[0-9a-fA-F]{6}$/,jd=/\P{White_Space}/u;function Md(e){return jd.test(e)}function Nd(e){return typeof e==`string`&&Ad.test(e)}function Pd(e){let t=e.palette;return{background:t.base00,foreground:t.base05,card:t.base01,"card-foreground":t.base05,popover:t.base01,"popover-foreground":t.base05,primary:t.base0D,"primary-foreground":t.base00,secondary:t.base01,"secondary-foreground":t.base05,muted:t.base01,"muted-foreground":t.base04,accent:t.base02,"accent-foreground":t.base05,destructive:t.base08,border:t.base02,input:t.base02,ring:t.base0D,"selection-soft":t.base02,"chart-1":t.base0D,"chart-2":t.base0B,"chart-3":t.base0A,"chart-4":t.base0E,"chart-5":t.base08,sidebar:t.base01,"sidebar-foreground":t.base05,"sidebar-primary":t.base0D,"sidebar-primary-foreground":t.base00,"sidebar-accent":t.base02,"sidebar-accent-foreground":t.base0D,"sidebar-hover":t.base02,"sidebar-border":t.base02,"sidebar-ring":t.base0D,"syntax-keyword":t.base0E,"syntax-tag":t.base08,"syntax-attr":t.base0D,"syntax-string":t.base0B,"syntax-number":t.base09,"syntax-atom":t.base0C,"syntax-comment":t.base03,"syntax-func":t.base0D,"syntax-var":t.base08,"syntax-type":t.base0A,"syntax-operator":t.base05,"syntax-meta":t.base0F,"syntax-bg":t.base01,"link-color":t.base0D,"broken-link-color":t.base08,"lint-warning-color":t.base0A,"lint-error-color":t.base08,"diff-added":t.base0B,"diff-removed":t.base08,"callout-note-color":t.base0D,"callout-info-color":t.base0D,"callout-todo-color":t.base0D,"callout-abstract-color":t.base0C,"callout-tip-color":t.base0B,"callout-success-color":t.base0B,"callout-important-color":t.base0E,"callout-example-color":t.base0E,"callout-question-color":t.base0E,"callout-warning-color":t.base0A,"callout-caution-color":t.base09,"callout-danger-color":t.base09,"callout-failure-color":t.base08,"callout-bug-color":t.base08,"callout-quote-color":t.base03,...Ld(t)}}var Fd={black:`base00`,red:`base08`,green:`base0B`,yellow:`base0A`,blue:`base0D`,magenta:`base0E`,cyan:`base0C`,white:`base05`,brightBlack:`base03`,brightRed:`base08`,brightGreen:`base0B`,brightYellow:`base0A`,brightBlue:`base0D`,brightMagenta:`base0E`,brightCyan:`base0C`,brightWhite:`base07`},Id=Object.keys(Fd);function Ld(e){let t={};for(let n of Id)t[`ansi-${Rd(n)}`]=e[Fd[n]];return t}function Rd(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function zd(e){return JSON.stringify(e).replace(/[\u007f-\u009f\u2028\u2029\ufffe\uffff]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}function Bd(e){return`${[`system: "base16"`,`name: ${zd(e.name)}`,...e.author?[`author: ${zd(e.author)}`]:[],`variant: ${zd(e.variant)}`,`palette:`,...Od.map(t=>` ${t}: ${zd(e.palette[t])}`)].join(`
|
|
172
|
+
`)}\n`}function Vd(e){let t;try{t=Cu(e,{schema:`failsafe`})}catch(e){let t=e?.linePos;return{ok:!1,error:{kind:`unparseable`,line:typeof t?.[0]?.line==`number`?t[0].line:void 0}}}if(!t||typeof t!=`object`||Array.isArray(t))return{ok:!1,error:{kind:`not-a-scheme`}};let n=t,r=n.palette,i=r&&typeof r==`object`&&!Array.isArray(r)?r:n,a={},o=[],s=[];for(let e of Od){let t=i[e]??i[e.toLowerCase()];if(t==null){o.push(e);continue}let n=Hd(t);if(!n){s.push(e);continue}a[e]=n}return o.length?{ok:!1,error:{kind:`missing-slots`,slots:o}}:s.length?{ok:!1,error:{kind:`bad-hex`,slots:s}}:typeof n.name==`string`&&!Md(n.name)||typeof n.author==`string`&&!Md(n.author)?{ok:!1,error:{kind:`not-a-scheme`}}:{ok:!0,scheme:{name:typeof n.name==`string`?n.name:`Imported`,author:typeof n.author==`string`?n.author:void 0,variant:n.variant===`light`||n.variant===`dark`?n.variant:Gd(a),palette:a}}}function Hd(e){if(typeof e!=`string`)return null;let t=e.trim();return t.startsWith(`#`)||(t=`#${t}`),/^#[0-9a-fA-F]{3}$/.test(t)&&(t=`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`),Ad.test(t)?t.toLowerCase():null}function Ud(e,t,n){let r=Nd(e)?e:`#000000`,i=Nd(t)?t:`#000000`,a=Math.min(1,Math.max(0,n)),o=`#`;for(let e=0;e<3;e++){let t=Number.parseInt(r.slice(1+e*2,3+e*2),16),n=Number.parseInt(i.slice(1+e*2,3+e*2),16);o+=Math.round(t+(n-t)*a).toString(16).padStart(2,`0`)}return o}function Wd(e){let t=Nd(e)?e:`#000000`,n=e=>{let n=Number.parseInt(t.slice(1+e*2,3+e*2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*n(0)+.7152*n(1)+.0722*n(2)}function Gd(e){return Wd(e.base00)<Wd(e.base05)?`dark`:`light`}var Kd={name:`Dracula`,author:`clach04 (https://github.com/clach04)`,variant:`dark`,palette:{base00:`#282a36`,base01:`#21222c`,base02:`#44475a`,base03:`#6272a4`,base04:`#9ea8c7`,base05:`#f8f8f2`,base06:`#f8f8f2`,base07:`#ffffff`,base08:`#ff5555`,base09:`#ffb86c`,base0A:`#f1fa8c`,base0B:`#50fa7b`,base0C:`#8be9fd`,base0D:`#bd93f9`,base0E:`#ff79c6`,base0F:`#993333`}},qd={name:`Catppuccin Frappé`,author:`https://github.com/catppuccin/catppuccin`,variant:`dark`,palette:{base00:`#303446`,base01:`#292c3c`,base02:`#414559`,base03:`#51576d`,base04:`#626880`,base05:`#c6d0f5`,base06:`#f2d5cf`,base07:`#babbf1`,base08:`#e78284`,base09:`#ef9f76`,base0A:`#e5c890`,base0B:`#a6d189`,base0C:`#81c8be`,base0D:`#8caaee`,base0E:`#ca9ee6`,base0F:`#eebebe`}},Jd={name:`Catppuccin Latte`,author:`https://github.com/catppuccin/catppuccin`,variant:`light`,palette:{base00:`#eff1f5`,base01:`#e6e9ef`,base02:`#ccd0da`,base03:`#bcc0cc`,base04:`#acb0be`,base05:`#4c4f69`,base06:`#dc8a78`,base07:`#7287fd`,base08:`#d20f39`,base09:`#fe640b`,base0A:`#df8e1d`,base0B:`#40a02b`,base0C:`#179299`,base0D:`#1e66f5`,base0E:`#8839ef`,base0F:`#dd7878`}},Yd={name:`Monokai`,author:`Wimer Hazenberg (http://www.monokai.nl)`,variant:`dark`,palette:{base00:`#272822`,base01:`#383830`,base02:`#49483e`,base03:`#75715e`,base04:`#a59f85`,base05:`#f8f8f2`,base06:`#f5f4f1`,base07:`#f9f8f5`,base08:`#f92672`,base09:`#fd971f`,base0A:`#f4bf75`,base0B:`#a6e22e`,base0C:`#a1efe4`,base0D:`#66d9ef`,base0E:`#ae81ff`,base0F:`#cc6633`}},Xd={name:`Gruvbox dark, medium`,author:`Dawid Kurek, morhetz (https://github.com/morhetz/gruvbox)`,variant:`dark`,palette:{base00:`#282828`,base01:`#3c3836`,base02:`#504945`,base03:`#665c54`,base04:`#bdae93`,base05:`#d5c4a1`,base06:`#ebdbb2`,base07:`#fbf1c7`,base08:`#fb4934`,base09:`#fe8019`,base0A:`#fabd2f`,base0B:`#b8bb26`,base0C:`#8ec07c`,base0D:`#83a598`,base0E:`#d3869b`,base0F:`#d65d0e`}},Zd={name:`Solarized Dark`,author:`Ethan Schoonover (modified by aramisgithub)`,variant:`dark`,palette:{base00:`#002b36`,base01:`#073642`,base02:`#586e75`,base03:`#657b83`,base04:`#839496`,base05:`#93a1a1`,base06:`#eee8d5`,base07:`#fdf6e3`,base08:`#dc322f`,base09:`#cb4b16`,base0A:`#b58900`,base0B:`#859900`,base0C:`#2aa198`,base0D:`#268bd2`,base0E:`#6c71c4`,base0F:`#d33682`}};function Qd(e,t,n){return{id:e,label:t,kind:n.variant,scheme:n,toTokens:()=>Pd(n)}}function $d(e,t){return{id:e,label:t,kind:`system`}}var ef=[$d(`default`,`Default`),Qd(`dracula`,`Dracula`,Kd),Qd(`catppuccin-frappe`,`Catppuccin Frappé`,qd),Qd(`catppuccin-latte`,`Catppuccin Latte`,Jd),Qd(`monokai`,`Monokai`,Yd),Qd(`gruvbox`,`Gruvbox`,Xd),Qd(`solarized`,`Solarized`,Zd),$d(`custom`,`Custom`)],tf=ef.map(e=>e.id),nf=/^[a-z0-9-]{1,32}$/,rf=`saved-`,af=26,of=/\p{M}+/gu,sf=/['\u2019\u02bc]+/gu,cf=/[^a-z0-9]+/g;function lf(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,`0`)}function uf(e){let t=e.trim();if(t.length===0)return{ok:!1,code:`empty`};let n=t.normalize(`NFKD`).replace(of,``).toLowerCase().replace(sf,``).replace(cf,`-`).replace(/^-+|-+$/g,``),r=lf(t),i=n.length===0?`theme-${r}`:n.length<=af?n:`${n.slice(0,af-r.length-1).replace(/-+$/g,``)}-${r}`,a=df(i);if(!a.ok)throw Error(`Saved theme name derivation produced an invalid id`);return{ok:!0,name:t,stem:i,id:a.id}}function df(e){if(e.length===0)return{ok:!1,code:`empty`};let t=rf+e;return nf.test(t)?{ok:!0,id:t}:{ok:!1,code:/^[a-z0-9-]+$/.test(t)?`too-long`:`invalid-chars`}}function ff(e){if(!nf.test(e)||!e.startsWith(`saved-`))return{ok:!1};let t=e.slice(6);return t.length===0?{ok:!1}:{ok:!0,stem:t}}var pf=new Map(ef.map(e=>[e.id,e]));function mf(e){return e&&pf.get(e)||ef[0]}function hf(e,t=ef){let n=new Set(t.map(e=>e.id)),r=e?.colorTheme,i=r&&n.has(r)?r:ef[0].id,a=e=>e===void 0?i:n.has(e)?e:ef[0].id;return{light:a(e?.colorThemeLight),dark:a(e?.colorThemeDark)}}function gf(e,t){return e===`light`||e===`dark`?e:t?`dark`:`light`}function _f(e,t,n){return`${e} {\n color-scheme: ${t};\n${Object.entries(n).map(([e,t])=>` --${e}: ${t};`).join(`
|
|
173
|
+
`)}\n}`}var vf=Symbol.for(`@inkeep/open-knowledge/field-registry`),yf=globalThis;yf[vf]===void 0&&(yf[vf]=Er());var H=yf[vf];function bf(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=xf(t)?H.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function xf(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}function Sf(){return Object.fromEntries(Od.map(e=>[e,N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${kd[e]}, as a #rrggbb hex string.`}).optional()]))}function Cf(){return tf.filter(e=>e!==`default`&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}var wf=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),Tf=52428800,Ef=26214400,Df=12582912,Of=`https://api.openai.com/v1`,kf=`text-embedding-3-small`,Af=Object.freeze([`127.0.0.1`]),jf=/^[1-9]\d*(s|m|h)$/,Mf=/^https?:\/\//;function Nf(e){let t;try{t=new URL(e)}catch{return!1}let n=t.hostname.toLowerCase();return n===`localhost`||n===`127.0.0.1`||n===`[::1]`}function Pf(e){let t;try{t=new URL(e)}catch{return`invalid-url`}return t.protocol===`https:`||t.protocol===`http:`&&Nf(e)?null:`insecure-scheme`}function Ff(e){let t=e.trim();return t===``?`./`:t}function If(e){let t=Ff(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}var Lf=R({content:R({dir:N().register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore. Read at server start; changing it requires a restart.`}).default(`.`),attachmentFolderPath:N().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(If,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:R({theme:z([`light`,`dark`,`system`]).register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),language:z([`system`,...xd]).register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Interface language. 'system' follows the operating system. A personal preference (user scope) — not shared with the project, and never applied to document content.`}).optional(),colorThemeLight:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Cf()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(nf,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeDark:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Cf()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(nf,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorTheme:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A short theme id (lowercase letters, digits, and hyphens; max 32 characters); an id no palette matches falls back to 'default'. A personal preference (user scope) — not shared with the project.`}).regex(nf,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeEnabled:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:R({name:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:N().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:z([`dark`,`light`]).register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...Sf()}).optional(),preview:R({autoOpen:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:R({showHiddenFiles:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1)}).optional()}).default({preview:{autoOpen:!0}}),editor:R({wordWrap:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Reuse one tab when clicking through the Files and Skills sidebars, the way an editor preview tab works. Turn off to open every click in its own tab. Pinned tabs keep their own tab either way. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0,previewTabs:!0}),agents:R({autoApproveOkTools:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."}).default(!0)}).default({autoApproveOkTools:!0}),autoSync:R({mode:z(Du).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`How this machine syncs this project with its git remote: 'off' (no sync), 'follow' (one-directional — pull remote changes, never push your own; 'pull' is accepted as a legacy alias), or 'full' (bidirectional pull and push). null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared. Supersedes the legacy autoSync.enabled boolean.`}).nullable().default(null),enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Legacy per-machine sync toggle, superseded by autoSync.mode. Read only when mode is absent (true = full, false = off). null = not chosen yet. Per-machine (project-local) — not shared.`}).nullable().default(null),resumeMode:z(Ou).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`When sync is paused (autoSync.mode 'off') after having been enabled, the active mode to resume into ('follow' | 'full'). Per-machine UI memory; ignored while a mode is active. Not shared.`}).optional(),default:so([F(),z(Du)]).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Committed project default for a machine's sync mode on first open: 'off' | 'follow' | 'full', or the legacy boolean (true = full, false = off). null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.mode choice overrides it.`}).nullable().default(null)}).default({mode:null,enabled:null,default:null}),terminal:R({enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null)}).default({enabled:null}),slides:R({enabled:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Whether the Slides plugin appears in Settings → Plugins. When on, a document whose frontmatter has `slides: true` offers an action that opens the deck in a dedicated window (desktop only, requires a resolvable slidev). A personal preference (user scope). Default off."}).default(!1)}).default({enabled:!1}),telemetry:R({localSink:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:R({maxBytes:P().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(Tf)}).default({maxBytes:Tf}),logs:R({maxBytes:P().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(Ef)}).default({maxBytes:Ef}),attributeDenylist:I(N()).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...wf])}).default({enabled:!0,spans:{maxBytes:Tf},logs:{maxBytes:Ef},attributeDenylist:[...wf]}),skillInstallReports:R({enabled:F().register(H,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Report skill installs to skills.sh so a published skill shows an accurate install count. Sends the skill name, its source repo, and which agent tools it was installed for — never file contents, and never for a private or local source. One report per skill per machine. Default on; the DO_NOT_TRACK and DISABLE_TELEMETRY environment variables also turn it off.`}).default(!0)}).default({enabled:!0})}).default({localSink:{enabled:!0,spans:{maxBytes:Tf},logs:{maxBytes:Ef},attributeDenylist:[...wf]},skillInstallReports:{enabled:!0}}),lossCapture:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Record bridge loss-class events (content-free) under .ok/local/loss-capture/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),maxBytes:P().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(Df)}).default({enabled:!0,maxBytes:Df}),bridge:R({backgroundThrottle:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Keep the desktop window's timers running at full rate while it holds unsynced work, so backgrounding the app never starves sync or recovery; when the window is idle the OS-default background throttling is restored (battery). Honored by the desktop app. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),deferGuard:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Defer a drain-shaped Observer B re-derive when the WYSIWYG fragment holds an un-propagated keystroke Y.Text lacks, so the keystroke survives instead of being stomped. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),lossDetector:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Detect content the bridge silently dropped at its reconciliation boundary (an Observer-A apply arm or a paired agent-undo derive) and write a recovery checkpoint plus a content-free loss event. Detection only — never blocks a write. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),fixedPoint:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Bound the Y.Text→WYSIWYG re-derive loop with a drain-count backstop: a run of re-derive drains that never reaches a raw-byte fixed point freezes the re-derive loop and writes a recovery checkpoint plus a content-free loss event, instead of churning unbounded. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),preDrain:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Before an agent write or undo rebuilds the WYSIWYG fragment, flush an un-propagated keystroke that provably does not overlap the operation into Y.Text so the keystroke survives instead of needing recovery; overlapping or unmodellable cases fall back to the checkpoint floor. Scope: appending writes and single-frame undos — a write that replaces the whole body (replace / edit) overwrites the keystroke either way, so those always take the checkpoint floor. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),flushOnHide:R({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`On tab hide/unload, force-send each doc's unsynced work to the server and commit its local cache, and re-sync on return to foreground, so a backgrounded tab never strands edits that IndexedDB alone would lose on recycle. Honored client-side. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0})}).default({backgroundThrottle:{enabled:!0},deferGuard:{enabled:!0},lossDetector:{enabled:!0},fixedPoint:{enabled:!0},preDrain:{enabled:!0},flushOnHide:{enabled:!0}}),search:R({semantic:R({enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:N().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override to point at a self-hosted server (Ollama / vLLM / LM Studio) or another provider. The API key is NOT stored here — set it with `ok embeddings set-key` (`~/.ok/secrets.yml`); it is sent to whichever endpoint this names."}).default(Of),model:N().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(kf),dimensions:P().int().positive().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit (recommended) to detect the model's native size from its first response — that is what lets a non-OpenAI model work without knowing its size up front. Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality; a server that ignores the request param then fails loudly instead of silently. Changing it re-embeds the corpus.`}).optional(),similarityFloor:P().min(0).max(1).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional()}).default({enabled:!1,baseUrl:Of,model:kf})}).default({semantic:{enabled:!1,baseUrl:Of,model:kf}}),contentRules:R({markdownlint:L({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:L({enabled:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:I(L({appliesTo:so([N(),I(N())]).optional(),file:N(),enabled:F().optional()})).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Frontmatter schema mappings: which docs (appliesTo globs) validate against which JSON Schema file (project-root-relative path).`}).default([])}).default({enabled:!1,schemas:[]})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]}}),validation:R({links:z(Td).register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(Ed),fileTreeIndicators:F().register(H,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0)}).default({links:Ed,fileTreeIndicators:!0}),linkPreviews:R({enabled:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata — outbound egress, one request per previewed link. Default ON; set to false to turn external previews off. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!0)}).default({enabled:!0}),remote:R({url:N().register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:"Superseded by server.externalUrl — read only while server.externalUrl (and its deprecated server.publicUrl spelling) is absent. Public URL your tunnel gives you, e.g. https://myproject.ngrok.app. Used only with `ok start --remote` (config alone never enables remote access); its host is admitted through the Host-header allowlist. There is no server-side auth, so restrict access at the tunnel (ngrok OAuth, Cloudflare Access, Tailscale ACLs)."}).optional(),port:P().int().min(1).max(65535).register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Superseded by server.port — read only while server.port is absent. TCP port the server binds when remote access is enabled (default 24550). Fixed so the tunnel's port mapping survives restarts. Set it only on a conflict. An explicit --port still wins; the PORT env var is ignored in remote mode.`}).optional()}).default({}),server:R({port:P().int().min(1).max(65535).register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`TCP port the server listens on. Unset by default: a local start picks a free port dynamically, and deployment platforms inject the PORT environment variable instead. Supersedes remote.port (still read while this key is absent). Read at server start; changing it requires a restart.`}).optional(),bind:I(N().min(1)).min(1).register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Addresses the server binds, e.g. [127.0.0.1] or [0.0.0.0]. Default loopback-only ([127.0.0.1]): nothing off this machine can connect. A non-loopback bind additionally requires the server.allowExternal consent interlock. Lists replace, never merge. Read at server start; changing it requires a restart.`}).default([...Af]),externalUrl:Ma({protocol:/^https?$/}).regex(Mf).register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Canonical external origin the server is reached at, e.g. https://kb.example.com — drives issued URLs and CORS. Unset by default: a loopback server derives http://localhost:<port>. Setting it declares external exposure, which additionally requires the server.allowExternal consent interlock. Supersedes server.publicUrl (its former name) and remote.url — both still read while this key is absent. Read at server start; changing it requires a restart.`}).optional(),publicUrl:Ma({protocol:/^https?$/}).regex(Mf).register(H,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Deprecated alias of server.externalUrl (the former name of that key) — read only while server.externalUrl is absent, with identical semantics. Use server.externalUrl instead; if this config is committed and shared, keep both keys until every collaborator has upgraded (older versions read only server.publicUrl).`}).optional(),allowExternal:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Exposure consent interlock. Once the unified server boot lands, a non-loopback server.bind or a server.externalUrl without allowExternal: true will be refused at boot with a one-line fix. Default off. Per-machine (project-local) — consent never travels via git, clone, or share; containers consent via the environment instead.`}).default(!1),openBrowser:F().register(H,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Open the UI in a browser when the server starts. Default derived: true when every bind address is loopback (a laptop start pops the UI), false otherwise (a container or exposed bind is headless and must never try). Acts once at start. Per-machine (project-local) — not shared.`}).optional(),idleShutdown:so([B(`off`),N().regex(jf)]).register(H,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m' when every bind address is loopback, 'off' otherwise (an exposed or containerized server stays up). Reloadable — a valid change applies without a restart. Per-machine (project-local) — not shared.`}).optional()}).default({bind:[...Af],allowExternal:!1})}),Rf=`open-knowledge-config`;function zf(e,t,n){let r=c.getTracer(Rf),i=t?{attributes:t}:{};return r.startActiveSpan(e,i,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:s.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function Bf(e,t){let n=c.getActiveSpan();n&&n.addEvent(e,t)}function Vf(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function Hf(e,t){let n=e;for(let e of t){n=Vf(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function Uf(e,t){let n=Hf(e,t);if(n!==void 0)return bf(n)}function Wf(e,t){return e===`either`?!0:e===t}function Gf(e,t){let n=null;function r(e,i){if(n!==null||e===void 0)return;if(typeof e==`object`&&e&&!Array.isArray(e)){for(let[t,a]of Object.entries(e))if(r(a,[...i,t]),n!==null)return;return}let a=Uf(Lf,i);a?.scope!==void 0&&(Wf(a.scope,t)||(n={code:`SCOPE_VIOLATION`,path:i,expectedScope:a.scope,actualScope:t}))}for(let[t,i]of Object.entries(e))if(r(i,[t]),n!==null)break;return n}function Kf(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&(as(e.getIn(r,!0))||e.deleteIn(r))}}function qf(e,t){let n=[];function r(t,i){if(t!==void 0){if(t===null){e.deleteIn(i),n.push(i.join(`.`));return}if(Array.isArray(t)){Kf(e,i),e.setIn(i,t),n.push(i.join(`.`));return}if(typeof t==`object`){for(let[e,n]of Object.entries(t))r(n,[...i,e]);return}Kf(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function Jf(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}var Yf=L({file:N(),line:P().int().min(1),column:P().int().min(1),snippet:N().optional()}),Xf=L({path:I(so([N(),P()])),message:N(),issueCode:N(),params:mo(N(),to()).optional(),source:Yf.optional()}),Zf=z([`user`,`project`,`project-local`,`either`]),Qf=z([`user`,`project`,`project-local`]),$f=L({code:B(`YAML_PARSE`),detail:N()}),ep=L({code:B(`UNREADABLE`),detail:N()}),tp=L({code:B(`SCHEMA_INVALID`),issues:I(Xf)}),np=L({code:B(`REMOVED_KEY`),path:I(N()),redirect:N(),source:Yf.optional()}),rp=lo(`code`,[$f,tp,ep,L({code:B(`SCOPE_VIOLATION`),path:I(N()),expectedScope:Zf,actualScope:Qf}),L({code:B(`NOT_AGENT_SETTABLE`),path:I(N())}),L({code:B(`MIXED_SCOPE`),paths:I(L({path:I(N()),scope:Qf}))}),np,L({code:B(`WRITE_ERROR`),detail:N()}),L({code:B(`OKIGNORE_INVALID`),detail:N(),lineNumber:P().int().min(1).optional()}),L({code:B(`UNKNOWN`),message:N().optional()})]);lo(`code`,[np,$f,tp,ep]),L({diagnostics:I(lo(`code`,[L({code:B(`REMOVED_KEY`),scope:Qf,file:N(),path:I(N()),redirect:N()}),L({code:B(`YAML_PARSE`),scope:Qf,file:N()}),L({code:B(`SCHEMA_INVALID`),scope:Qf,file:N()}),L({code:B(`UNREADABLE`),scope:Qf,file:N()})]))});var ip=new Set(rp.options.map(e=>e.shape.code.value)),ap=so([rp,R({code:N(),message:N().optional()})]);function op(e){return ip.has(e.code)}function sp(e){switch(e){case`user`:return`~/.ok/global.yml`;case`project`:return`.ok/config.yml`;case`project-local`:return`.ok/local/config.yml`;case`either`:return`.ok/config.yml or ~/.ok/global.yml`}}function cp(e){switch(e){case`user`:return`personal to you, across all projects`;case`project`:return`shared with your team via git`;case`project-local`:return`this machine only, not shared`;case`either`:return`user or project`}}function lp(e){if(!op(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`UNREADABLE`:return`Could not read the file: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
|
|
174
174
|
`))n.push(` ${e}`)}else n.push(` ${r}: ${t.message}`)}}return n.join(`
|
|
175
|
-
`)}case`SCOPE_VIOLATION`:return[`Setting ${e.path.join(`.`)} belongs in your ${e.expectedScope} config`,`(${
|
|
175
|
+
`)}case`SCOPE_VIOLATION`:return[`Setting ${e.path.join(`.`)} belongs in your ${e.expectedScope} config`,`(${sp(e.expectedScope)} — ${cp(e.expectedScope)}),`,`but it was set in the ${e.actualScope} config (${sp(e.actualScope)}).`,`Move it to ${sp(e.expectedScope)}.`].join(` `);case`NOT_AGENT_SETTABLE`:return[`Setting ${e.path.join(`.`)} is human-only and can't be changed by an agent.`,`Change it in the Settings pane, or edit the config.yml by hand.`].join(` `);case`MIXED_SCOPE`:return[`This change touches settings that live in different config files. Apply them one file at a time:`,e.paths.map(({path:e,scope:t})=>` ${e.join(`.`)} → ${sp(t)} (${t})`).join(`
|
|
176
176
|
`)].join(`
|
|
177
177
|
`);case`REMOVED_KEY`:{let t=e.path.join(`.`),n=[`${e.source?`Removed key at ${e.source.file}:${e.source.line}:${e.source.column}`:`Removed key in configuration`}: ${t}`,e.redirect];if(e.source?.snippet&&e.source.snippet.length>0)for(let t of e.source.snippet.split(`
|
|
178
178
|
`))n.push(` ${t}`);return n.join(`
|
|
179
|
-
`)}case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`OKIGNORE_INVALID`:return e.lineNumber===void 0?`.okignore: ${e.detail}`:`.okignore line ${e.lineNumber}: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}var
|
|
179
|
+
`)}case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`OKIGNORE_INVALID`:return e.lineNumber===void 0?`.okignore: ${e.detail}`:`.okignore line ${e.lineNumber}: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}var up="Run `ok config migrate` to strip the obsolete key automatically, or remove it by hand.";[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,up].join(` `),[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,up].join(` `),[`folders is no longer a top-level config field.`,"A folder's own frontmatter (open-shape, like a doc's) lives in nested `<folder>/.ok/frontmatter.yml`; new-doc starting properties come from templates in `<folder>/.ok/templates/`.","Edit via the folder overview in the editor sidebar, or `edit({ folder: { path, frontmatter } })` via the MCP.",up].join(` `),[`appearance.editorModeDefault was removed and is never read — new docs always open in WYSIWYG; toggle mode via the editor mode button.`,up].join(` `),[`streaming uploads have no user-facing cap; the value is hardcoded in @inkeep/open-knowledge-core.`,up].join(` `),[`Use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID environment variable instead.`,up].join(` `),[`Use server.bind in .ok/config.yml instead — a list of bind addresses, e.g. [127.0.0.1]; a non-loopback bind additionally requires server.allowExternal.`,`The --host CLI flag and HOST environment variable also remain available.`,up].join(` `),[`This behavior was removed; the value is hardcoded.`,up].join(` `),[`To disable MCP auto-start, set OK_MCP_AUTOSTART=0.`,up].join(` `),[`This value is hardcoded in @inkeep/open-knowledge-core.`,up].join(` `),[`This value is hardcoded in @inkeep/open-knowledge-core.`,up].join(` `),[`The search result cap is hardcoded in @inkeep/open-knowledge-core; this config key was removed.`,up].join(` `),["preview URLs now resolve only to the running server — start one with `ok start`.",up].join(` `),[`preview.scriptSrc has been removed.`,`The code-block preview iframe now runs a fixed open network policy (it is no longer configurable).`,up].join(` `),[`appearance.sidebar.showAllFiles has been removed.`,`The sidebar lists every file on disk by default; dot-prefixed entries are gated by appearance.sidebar.showHiddenFiles, and appearance.sidebar.showOnlyMarkdownFiles scopes the tree down to markdown documents as a per-machine view preference.`,up].join(` `);function dp(e){try{let t=Intl.getCanonicalLocales(e)[0];return t===void 0?null:t}catch{return null}}function fp(e){let t=[];for(let n of e){let e=dp(n);e!==null&&t.push(e)}return t}function pp(e){try{let t=Intl.getCanonicalLocales(e)[0];if(t===void 0)return null;let n=new Intl.Locale(t).maximize();return!n.language||!n.script?null:`${n.language}-${n.script}`}catch{return null}}var mp=`__system__`,hp=`__config__/project`,gp=`__user__/config.yml`,_p=`__local__/project`,vp=`__config__/okignore`;Object.freeze([hp,_p,gp,vp]);var yp=`__skill__/`,bp=`__extskill__/`,xp=[`project`,`global`];function Sp(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)||e.startsWith(`__extskill__/`)}function Cp(e){return`${bp}${e}`}function wp(e,t){return`${bp}${e}/${Dp(t)}`}function Tp(e){return e.startsWith(bp)}function Ep(e){if(!e.startsWith(`__extskill__/`))return null;let t=e.slice(13),n=t.indexOf(`/`),r=n<0?t:t.slice(0,n),i=n<0?null:t.slice(n+1);return/^[a-z0-9-]+$/.test(r)?{name:r,rel:i&&i.length>0?i:null}:null}function Dp(e){return e.replace(/\.mdx?$/i,``)}var Op=`.ok/skills`;function kp(e){return`${Op}/${e}/SKILL`}var Ap=[`references`,`scripts`];function jp(e,t){let n=e.trim();if(!n.startsWith(`/`))return null;let r=n.slice(1);if(r===``||r.includes(`/`))return null;let i=/^(\.[A-Za-z0-9_-]+\/skills)\/[^/]+\/(?:SKILL|references\/.+)$/.exec(t);return i?`${i[1]}/${r}/SKILL`:/^__skill__\/(global)\/[^/]+(?:\/references\/.+)?$/.exec(t)?Lp(`global`,r):null}function Mp(e,t){let n=/^(\.[A-Za-z0-9_-]+\/skills\/[^/]+)\/(?:SKILL|references\/.+)$/.exec(t)??/^(__skill__\/global\/[^/]+)(?:\/references\/.+)?$/.exec(t)??/^(__extskill__\/[^/]+)(?:\/.+)?$/.exec(t);if(!n)return null;let r=n[1],i=Dp(e.trim()).split(`/`).filter(e=>e!==``&&e!==`.`),[a]=i;return!a||!Ap.includes(a)||i.includes(`..`)||i.length<2?null:`${r}/${i.join(`/`)}`}var Np=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(SKILL|references\/.+)$/;function Pp(e){let t=Np.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===`SKILL`?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}var Fp=/^__skill__\/global\/([^/]+)(?:\/(references\/.+))?$/;function Ip(e){let t=Fp.exec(e);if(!t)return null;let n=t[1],r=t[2];return r===void 0?{name:n,kind:`skill`,rel:null}:{name:n,kind:`reference`,rel:r.slice(11)}}function Lp(e,t){return e===`project`?kp(t):`${yp}${e}/${t}`}function Rp(e,t,n){let r=Dp(n);return e===`project`?`${Op}/${t}/${r}`:`${yp}${e}/${t}/${r}`}function zp(e){if(e===``)return``;try{return e.split(`/`).map(e=>decodeURIComponent(e)).join(`/`)}catch{return e}}function Bp(e){if(e.startsWith(`__skill__/`)){let t=e.slice(10),n=t.indexOf(`/`);if(n<0)return null;let r=t.slice(0,n);if(r!==`global`&&r!==`project`)return null;let i=t.slice(n+1);if(!i)return null;let a=zp(i),o=a.indexOf(`/`),s=o<0?a:a.slice(0,o);return s?{kind:`skill`,scope:r,name:s,rel:o<0?null:a.slice(o+1)}:null}return null}var Vp=/^(?:(.+)\/)?\.ok\/templates\/([^/]+?)(?:\.md)?$/;function Hp(e,t){let n=e.replace(/^\/+|\/+$/g,``);return n?`${n}/.ok/templates/${t}`:`.ok/templates/${t}`}function Up(e){let t=Vp.exec(e);return t?{folder:(t[1]??``).replace(/^\/+|\/+$/g,``),name:t[2]}:null}function Wp(e){if(!e.startsWith(`__template__/`))return null;let t=e.slice(13);if(!t)return null;let n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return r?{folder:zp(n<0?``:t.slice(0,n)),name:zp(r)}:null}var Gp=[`claude`,`claude-desktop`,`cursor`,`codex`,`copilot`,`opencode`,`openclaw`,`pi`,`antigravity`,`lm-studio`,`hermes`],Kp={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`,copilot:`GitHub Copilot`,opencode:`OpenCode`,openclaw:`OpenClaw`,pi:`Pi`,antigravity:`Antigravity`,"lm-studio":`LM Studio`,hermes:`Hermes`},qp={claude:`.claude/skills`,"claude-desktop":null,cursor:`.cursor/skills`,codex:`.codex/skills`,copilot:`.github/skills`,opencode:`.opencode/skills`,openclaw:null,pi:`.pi/skills`,antigravity:null,"lm-studio":null,hermes:null},Jp={claude:`.claude/skills`,"claude-desktop":null,cursor:`.cursor/skills`,codex:`.codex/skills`,copilot:`.copilot/skills`,opencode:`.opencode/skills`,openclaw:null,pi:`.pi/agent/skills`,antigravity:`.gemini/skills`,"lm-studio":null,hermes:null},Yp=Gp.filter(e=>qp[e]!==null),Xp=`open-knowledge`;Gp.flatMap(e=>{let t=qp[e];return t===null?[]:[`${t}/${Xp}/`]}),Yp.filter(e=>e!==`pi`&&e!==`copilot`).map(e=>({hostDir:(qp[e]??``).split(`/`)[0],editorId:e}));var Zp={claude:`claude-code`,"claude-desktop":`claude-code`,cursor:`cursor`,codex:`codex`,copilot:`github-copilot-cli`,opencode:`opencode`,openclaw:`openclaw`,pi:`pi`,antigravity:`antigravity`,"lm-studio":`lm-studio`,hermes:`hermes`},Qp=`.agents/skills`,$p=`open-knowledge-pack-`,em=`inkeep/open-knowledge-skills`,tm=/(^|[\s([])\/([a-z0-9][a-z0-9-]{1,63})(?=$|[\s.,;:!?)\]])/g,nm=new Set([`tmp`,`usr`,`etc`,`var`,`dev`,`opt`,`bin`,`api`,`home`,`root`]);function rm(e){return!nm.has(e)}var im=/^---[ \t]*\r?\n([\s\S]*?\r?\n)?---[ \t]*(\r?\n|$)/,am=/^---[ \t]*$/;function om(e){let t=e.match(im);return t?{frontmatter:t[0],body:e.slice(t[0].length)}:{frontmatter:``,body:e}}function sm(e,t){return e?t===``||/\r?\n$/.test(e)?e+t:e+(e.includes(`\r
|
|
180
180
|
`)?`\r
|
|
181
181
|
`:`
|
|
182
|
-
`)+t:t}function
|
|
183
|
-
`)?e.slice(0,-1):e}\n---\n`}var Em=R({name:N(),description:N(),files:R({skillMd:N(),scripts:I(N()),references:I(N())})}),Dm=R({pluginProvider:N().optional(),plugin:N().optional(),marketplace:N().optional(),version:N().optional(),gitCommitSha:N().optional(),scope:N().optional(),projectPath:N().optional()}),Om=R({commands:F(),hooks:F(),mcp:F()}),km=R({...Em.shape,sourceHarness:N(),sourceHarnesses:I(N()),home:N(),provenance:Dm,inert:Om,outsideProject:F().optional()}),Am=R({schema:B(1),name:N(),version:N(),description:N().optional(),author:R({name:N()}).optional(),skills:I(N()),hostCompatibility:I(N()).optional(),capabilities:R({scripts:N(),network:N(),inert:I(N())}).optional(),provenance:R({source:N(),ref:N(),contentHash:N()}).optional()});L({skills:I(km),packs:I(Am)}).loose(),L({results:I(L({id:N().min(1),name:N().min(1),source:N().min(1),description:N(),installs:P().int().nonnegative().nullable(),publisher:N().nullable()}).loose()),backend:z([`skills.sh`,`github-fallback`]),degraded:F()}).loose(),L({title:N(),description:N(),image:N().nullable(),skillsUrl:N().nullable(),sourceKind:z([`github`,`site`]),sourceUrl:N()}).loose(),L({skills:I(L({name:N(),description:N().nullable()}).loose())}).loose(),L({kind:z([`local`,`import`,`none`]),scope:z(bp).optional(),name:N().optional(),dir:N().optional(),source:N().optional(),ref:N().optional(),via:z([`source`,`publisher`]).optional()}).loose();var jm=L({relPath:N(),content:N().nullable()}).loose(),Mm=L({provider:N(),plugin:N(),version:N().optional(),marketplace:N().optional(),repositoryUrl:N().optional()}).loose(),Nm=L({provider:N(),plugin:N(),version:N().optional(),description:N().optional(),repositoryUrl:N().optional(),bundledSkills:I(N()),capabilities:L({commands:F(),hooks:F(),mcp:F(),agents:F()}),setupSupported:F()}).loose();L({name:N(),description:N().nullable(),skillMd:N(),files:I(jm),plugin:Mm.optional(),pluginBundle:Nm.optional()}).loose();var Pm=new Set([`project`,`local`]);function Fm(e){return e!==void 0&&Pm.has(e)?`project`:`global`}var Im=/^([\w.-]+)\/([\w.-]+)$/,Lm=/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function Rm(e){let t=Im.exec(e);if(t){let[,e,n]=t;if(e&&n)return{kind:`github`,owner:e,repo:n}}return Lm.test(e)?{kind:`site`,hostname:e}:null}function zm(e,t){let n=Rm(e),r=t.trim();if(!n||!r)return null;let i=encodeURIComponent(r);if(n.kind===`github`){let e=encodeURIComponent(n.owner),t=encodeURIComponent(n.repo);return{sourceKind:`github`,skillsUrl:`https://www.skills.sh/${e}/${t}/${i}`,sourceUrl:`https://github.com/${e}/${t}`}}return{sourceKind:`site`,skillsUrl:`https://www.skills.sh/site/${encodeURIComponent(n.hostname)}/${i}`,sourceUrl:`https://${n.hostname}`}}var Bm={"bridge-merge-loss":{visibility:`surfaced`,gcBucket:`bridge-merge-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"producer-guard-loss":{visibility:`surfaced`,gcBucket:`producer-guard-loss`,bundleExposure:`metadata`,chainAnchor:!1},"observer-a-duplication":{visibility:`surfaced`,gcBucket:`observer-a-duplication`,bundleExposure:`metadata`,chainAnchor:!1},"external-change-rescue":{visibility:`surfaced`,gcBucket:`external-change-rescue`,bundleExposure:`metadata`,chainAnchor:!1},"defer-exhaustion-loss":{visibility:`surfaced`,gcBucket:`defer-exhaustion-loss`,bundleExposure:`metadata`,chainAnchor:!1},"observer-a-apply-loss":{visibility:`surfaced`,gcBucket:`observer-a-apply-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"bridge-derive-loss":{visibility:`surfaced`,gcBucket:`bridge-derive-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"bridge-backstop-trip":{visibility:`surfaced`,gcBucket:`bridge-backstop-trip`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-reconcile-loss":{visibility:`surfaced`,gcBucket:`persistence-reconcile-loss`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-duplication-reset":{visibility:`surfaced`,gcBucket:`persistence-duplication-reset`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-divergence-realign":{visibility:`surfaced`,gcBucket:`persistence-divergence-realign`,bundleExposure:`metadata`,chainAnchor:!1},"managed-artifact-reconcile":{visibility:`surfaced`,gcBucket:`managed-artifact-reconcile`,bundleExposure:`metadata`,chainAnchor:!1},"auto-consolidation":{visibility:`hidden`,gcBucket:`auto-consolidation`,bundleExposure:`none`,chainAnchor:!0}};function Vm(e){return e==null?!0:Bm[e].visibility===`surfaced`}function Hm(e){this.content=e}Hm.prototype={constructor:Hm,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new Hm(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new Hm(n)},addToStart:function(e,t){return new Hm([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Hm(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new Hm(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Hm.from(e),e.size?new Hm(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Hm.from(e),e.size?new Hm(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Hm.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},Hm.from=function(e){if(e instanceof Hm)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Hm(t)};function Um(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=Um(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Wm(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=Wm(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var U=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Um(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Wm(this,e,t,n)}findIndex(e){if(e==0)return Km(0,e);if(e==this.size)return Km(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Km(t+1,i):Km(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};U.empty=new U([],0);var Gm={index:0,offset:0};function Km(e,t){return Gm.index=e,Gm.offset=t,Gm}function qm(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!qm(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!qm(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var Jm=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&qm(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Jm.none=[];var Ym=class extends Error{},W=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Zm(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Xm(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(U.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};W.empty=new W(U.empty,0,0);function Xm(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Xm(a.content,t-i-1,n-i-1)))}function Zm(e,t,n,r){let{index:i,offset:a}=e.findIndex(t),o=e.maybeChild(i);if(a==t||o.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=Zm(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function Qm(e,t,n){if(n.openStart>e.depth)throw new Ym(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Ym(`Inconsistent open depths`);return $m(e,t,n,0)}function $m(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=$m(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return ih(a,oh(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return ih(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=sh(n,e);return ih(a,ah(e,i,o,t,r))}}function eh(e,t){if(!t.type.compatibleContent(e.type))throw new Ym(`Cannot join `+t.type.name+` onto `+e.type.name)}function th(e,t,n){let r=e.node(n);return eh(r,t.node(n)),r}function nh(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function rh(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(nh(e.nodeAfter,r),a++));for(let e=a;e<o;e++)nh(i.child(e),r);t&&t.depth==n&&t.textOffset&&nh(t.nodeBefore,r)}function ih(e,t){return e.type.checkContent(t),e.copy(t)}function ah(e,t,n,r,i){let a=e.depth>i&&th(e,t,i+1),o=r.depth>i&&th(n,r,i+1),s=[];return rh(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(eh(a,o),nh(ih(a,ah(e,t,n,r,i+1)),s)):(a&&nh(ih(a,oh(e,t,i+1)),s),rh(t,n,i,s),o&&nh(ih(o,oh(n,r,i+1)),s)),rh(r,null,i,s),new U(s)}function oh(e,t,n){let r=[];return rh(null,e,n,r),e.depth>n&&nh(ih(th(e,t,n+1),oh(e,t,n+1)),r),rh(t,null,n,r),new U(r)}function sh(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(U.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var ch=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Jm.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new fh(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=dh.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else dh.set(t,r=new lh);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%uh,i}},lh=class{constructor(){this.elts=[],this.i=0}},uh=12,dh=new WeakMap,fh=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},ph=Object.create(null),mh=class e{constructor(e,t,n,r=Jm.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||U.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&qm(this.attrs,t||e.defaultAttrs||ph)&&Jm.sameSet(this.marks,n||Jm.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return W.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new W(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return Qm(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return ch.resolveCached(this,e)}resolveNoCache(e){return ch.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),gh(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=U.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Jm.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Jm.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=U.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};mh.prototype.text=void 0;var hh=class e extends mh{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):gh(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function gh(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var _h=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new vh(t,n);if(r.next==null)return e.empty;let i=yh(r);r.next&&r.err(`Unexpected trailing text`);let a=kh(Eh(i));return Ah(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return U.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
184
|
-
`)}};_h.empty=new _h(!0);var vh=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function yh(e){let t=[];do t.push(bh(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function bh(e){let t=[];do t.push(xh(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function xh(e){let t=Th(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Ch(e,t);else break;return t}function Sh(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Ch(e,t){let n=Sh(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Sh(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function wh(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function Th(e){if(e.eat(`(`)){let t=yh(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=wh(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Eh(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function Dh(e,t){return t-e}function Oh(e,t){let n=[];return r(t),n.sort(Dh);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function kh(e){let t=Object.create(null);return n(Oh(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Oh(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new _h(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Dh);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Ah(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function jh(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function Mh(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Nh(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function Ph(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Lh(e,r,t[r]);return n}var Fh=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=Ph(e,n.attrs),this.defaultAttrs=jh(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==_h.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Mh(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new mh(this,this.computeAttrs(e),U.from(t),Jm.setFrom(n))}createChecked(e=null,t,n){return t=U.from(t),this.checkContent(t),new mh(this,this.computeAttrs(e),t,Jm.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=U.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(U.empty,!0);return i?new mh(this,e,t.append(i),Jm.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Nh(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:Jm.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function Ih(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var Lh=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Ih(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Rh=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Ph(e,r.attrs),this.excluded=null;let i=jh(this.attrs);this.instance=i?new Jm(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Jm(this,Mh(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Nh(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},zh=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=Hm.from(e.nodes),t.marks=Hm.from(e.marks||{}),this.nodes=Fh.compile(this.spec.nodes,this),this.marks=Rh.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=_h.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?Bh(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:Bh(this,n.split(` `))}this.nodeFromJSON=e=>mh.fromJSON(this,e),this.markFromJSON=e=>Jm.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Fh))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new hh(n,n.defaultAttrs,e,Jm.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function Bh(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function ate(e){return e.tag!=null}function ote(e){return e.style!=null}var Vh=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(ate(e))this.tags.push(e);else if(ote(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new Yh(this,t,!1);return n.addAll(e,Jm.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Yh(this,t,!0);return n.addAll(e,Jm.none,t.from,t.to),W.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(lte(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Xh(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Xh(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},Hh={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ste={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Uh={ol:!0,ul:!0},Wh=1,Gh=2,Kh=4;function qh(e,t,n){return t==null?e&&e.whitespace==`pre`?Wh|Gh:n&~Kh:(t?Wh:0)|(t===`full`?Gh:0)}var Jh=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=Jm.none,this.match=i||(a&Kh?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(U.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Wh)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=U.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(U.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Hh.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Yh=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=qh(null,t.preserveWhitespace,0)|(n?Kh:0);i=r?new Jh(r.type,r.attrs,Jm.none,!0,t.topMatch||r.type.contentMatch,a):n?new Jh(null,null,Jm.none,!0,null,a):new Jh(e.schema.topNodeType,null,Jm.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Gh?`full`:this.localPreserveWS||(r.options&Wh)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
185
|
-
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;
|
|
186
|
-
`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=Jm.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Zh(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=qh(e,i,a.options);a.options&Kh&&a.content.length==0&&(o|=Kh);let s=Jm.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):Zh(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new Jh(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=Wh);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function cte(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Uh.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function lte(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Xh(e){let t={};for(let n in e)t[n]=e[n];return t}function Zh(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var Qh=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=eg(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=ng(eg(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&ng(eg(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return ng(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=$h(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return $h(e.marks)}};function $h(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function eg(e){return e.document||window.document}var tg=new WeakMap;function ute(e){let t=tg.get(e);return t===void 0&&tg.set(e,t=dte(e)),t}function dte(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function ng(e,t,n,r){if(typeof t==`string`)return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=ute(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else{let{dom:t,contentDOM:i}=ng(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var rg=65535,ig=2**16;function fte(e,t){return e+t*ig}function ag(e){return e&rg}function pte(e){return(e-(e&rg))/ig}var og=1,sg=2,cg=4,lg=8,ug=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&lg)>0}get deletedBefore(){return(this.delInfo&(og|cg))>0}get deletedAfter(){return(this.delInfo&(sg|cg))>0}get deletedAcross(){return(this.delInfo&cg)>0}},dg=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=ag(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+pte(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:fte(o/3,e-s),f=e==s?sg:e==u?og:cg;return(t<0?e!=s:e!=u)&&(f|=lg),new ug(a,f,d)}r+=l-c}return n?e+r:new ug(e+r,0,null)}touches(e,t){let n=0,r=ag(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};dg.empty=new dg([]);var fg=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new ug(e,r,null)}},pg=Object.create(null),mg=class{getMap(){return dg.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=pg[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in pg)throw RangeError(`Duplicate use of step JSON ID `+e);return pg[e]=t,t.prototype.jsonID=e,t}},hg=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Ym)return e.fail(t.message);throw t}}};function gg(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(gg(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return U.fromArray(r)}var _g=class e extends mg{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new W(gg(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return hg.fromReplace(e,this.from,this.to,i)}invert(){return new vg(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};mg.jsonID(`addMark`,_g);var vg=class e extends mg{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new W(gg(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return hg.fromReplace(e,this.from,this.to,n)}invert(){return new _g(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};mg.jsonID(`removeMark`,vg);var yg=class e extends mg{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return hg.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return hg.fromReplace(e,this.pos,this.pos+1,new W(U.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new bg(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};mg.jsonID(`addNodeMark`,yg);var bg=class e extends mg{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return hg.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return hg.fromReplace(e,this.pos,this.pos+1,new W(U.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new yg(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};mg.jsonID(`removeNodeMark`,bg);var xg=class e extends mg{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Cg(e,this.from,this.to)?hg.fail(`Structure replace would overwrite content`):hg.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new dg([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?W.empty:new W(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?W.empty:new W(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,W.fromJSON(t,n.slice),!!n.structure)}};xg.MAP_BIAS=1,mg.jsonID(`replace`,xg);var Sg=class e extends mg{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(Cg(e,this.from,this.gapFrom)||Cg(e,this.gapTo,this.to)))return hg.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return hg.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?hg.fromReplace(e,this.from,this.to,n):hg.fail(`Content does not fit in gap`)}getMap(){return new dg([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,W.fromJSON(t,n.slice),n.insert,!!n.structure)}};mg.jsonID(`replaceAround`,Sg);function Cg(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function mte(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new vg(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new _g(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function hte(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof Rh){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new vg(t.from,t.to,t.style)))}function wg(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new xg(s,l,W.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new vg(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new W(U.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new xg(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(U.empty,!0);e.replace(s,s,new W(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function gte(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Tg(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!gte(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function _te(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=U.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=U.from(r.node(e).copy(u)),d++):c--;let f=U.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=U.from(i.node(e).copy(f)),p++):l++;e.step(new Sg(c,l,o,s,new W(u.append(f),d,p),u.size-d,!0))}function Eg(e,t,n=null,r=e){let i=vte(e,t),a=i&&yte(r,t);return a?i.map(Dg).concat({type:t,attrs:n}).concat(a.map(Dg)):null}function Dg(e){return{type:e,attrs:null}}function vte(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function yte(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function bte(e,t,n){let r=U.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=U.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new Sg(i,a,i,a,new W(r,0,0),n.length,!0))}function xte(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&Ste(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&kg(e,t,n,a),wg(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new Sg(c,l,c+1,l-1,new W(U.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&Og(e,t,n,a),!1}})}function Og(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function kg(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
|
|
187
|
-
`))}})}function Ste(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Cte(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new Sg(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new W(U.from(o),0,0),1,!0))}function Ag(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function wte(e,t,n=1,r){let i=e.doc.resolve(t),a=U.empty,o=U.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=U.from(i.node(e).copy(a));let t=r&&r[s];o=U.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new xg(t,t,new W(a.append(o),n,n),!0))}function jg(e,t){let n=e.resolve(t),r=n.index();return Mg(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Tte(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function Mg(e,t){return!!(e&&t&&!e.isLeaf&&Tte(e,t))}function Ng(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,a,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&Mg(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function Ete(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);kg(e,r.node(),r.before(),s)}o.inlineContent&&wg(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new xg(l,c.map(t+n,-1),W.empty,!0)),r===!0){let t=e.doc.resolve(l);Og(e,t.node(),t.before(),e.steps.length)}return e}function Dte(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function Pg(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function Fg(e,t,n=t,r=W.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return Ig(i,a,r)?new xg(t,n,r):new Ote(i,a,r).fit()}function Ig(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var Ote=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=U.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=U.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new W(i,a,o);return e>-1?new Sg(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new xg(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=zg(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(U.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=zg(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new W(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=zg(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new W(Lg(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new W(Lg(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=n?n.content:a.content,s=a.openStart-e,c=0,l=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));u=u.matchFragment(r)}let f=o.size+e-(a.content.size-a.openEnd);for(;c<o.childCount;){let e=o.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||s==0||e.content.size)&&(u=t,l.push(Bg(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=Rg(this.placed,t,U.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?e==0?W.empty:new W(Lg(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new W(Lg(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Vg(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Vg(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=Vg(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Rg(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Rg(this.placed,this.depth,U.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(U.empty,!0);e.childCount&&(this.placed=Rg(this.placed,this.frontier.length,e))}};function Lg(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Lg(e.firstChild.content,t-1,n)))}function Rg(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Rg(e.lastChild.content,t-1,n)))}function zg(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Bg(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Bg(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(U.empty,!0)))),e.copy(r)}function Vg(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!kte(n,a.content,o)?s:null}function kte(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function Ate(e){return e.spec.defining||e.spec.definingForContent}function jte(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(Ig(i,a,r))return e.step(new xg(t,n,r));let o=Wg(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=Ate(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],u=!0;l<0&&(u=!1,l=-l);let f=i.node(l-1),p=i.index(l-1);if(f.canReplaceWith(p,p,d.type,d.marks))return e.replace(i.before(l),u?a.after(l):n,new W(Hg(r.content,0,r.openStart,s),s,r.openEnd))}}let d=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function Hg(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(Hg(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(U.empty,!0))}return e}function Mte(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=Dte(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new W(U.from(r),0,0))}function Ug(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=Wg(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function Wg(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var Gg=class e extends mg{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return hg.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return hg.fromReplace(e,this.pos,this.pos+1,new W(U.from(r),0,+!t.isLeaf))}getMap(){return dg.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};mg.jsonID(`attr`,Gg);var Kg=class e extends mg{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return hg.ok(n)}getMap(){return dg.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};mg.jsonID(`docAttr`,Kg);var qg=class extends Error{};qg=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},qg.prototype=Object.create(Error.prototype),qg.prototype.constructor=qg,qg.prototype.name=`TransformError`;var Jg=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new fg}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new qg(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=W.empty){let r=Fg(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new W(U.from(n),0,0))}delete(e,t){return this.replace(e,t,W.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return jte(this,e,t,n),this}replaceRangeWith(e,t,n){return Mte(this,e,t,n),this}deleteRange(e,t){return Ug(this,e,t),this}lift(e,t){return _te(this,e,t),this}join(e,t=1){return Ete(this,e,t),this}wrap(e,t){return bte(this,e,t),this}setBlockType(e,t=e,n,r=null){return xte(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return Cte(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Gg(e,t,n)),this}setDocAttribute(e,t){return this.step(new Kg(e,t)),this}addNodeMark(e,t){return this.step(new yg(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof Jm)t.isInSet(n.marks)&&this.step(new bg(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new bg(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return wte(this,e,t,n),this}addMark(e,t,n){return mte(this,e,t,n),this}removeMark(e,t,n){return hte(this,e,t,n),this}clearIncompatible(e,t,n){return wg(this,e,t,n),this}},Yg=Object.create(null),G=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Xg(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=W.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?W.empty:t),o==0&&i_(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),i_(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new K(e):r_(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?r_(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):r_(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new t_(e.node(0))}static atStart(e){return r_(e,e,0,0,1)||new t_(e)}static atEnd(e){return r_(e,e,e.content.size,e.childCount,-1)||new t_(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=Yg[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Yg)throw RangeError(`Duplicate use of selection JSON ID `+e);return Yg[e]=t,t.prototype.jsonID=e,t}getBookmark(){return K.between(this.$anchor,this.$head).getBookmark()}};G.prototype.visible=!0;var Xg=class{constructor(e,t){this.$from=e,this.$to=t}},Zg=!1;function Qg(e){!Zg&&!e.parent.inlineContent&&(Zg=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var K=class e extends G{constructor(e,t=e){Qg(e),Qg(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return G.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=W.empty){if(super.replace(e,t),t==W.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new $g(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=G.findFrom(n,r,!0)||G.findFrom(n,-r,!0);if(e)n=e.$head;else return G.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(G.findFrom(t,-r,!0)||G.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};G.jsonID(`text`,K);var $g=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return K.between(e.resolve(this.anchor),e.resolve(this.head))}},q=class e extends G{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?G.near(a):new e(a)}content(){return new W(U.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new e_(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};q.prototype.visible=!1,G.jsonID(`node`,q);var e_=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new $g(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&q.isSelectable(n)?new q(t):G.near(t)}},t_=class e extends G{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=W.empty){if(t==W.empty){e.delete(0,e.doc.content.size);let t=G.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return n_}};G.jsonID(`all`,t_);var n_={map(){return this},resolve(e){return new t_(e)}};function r_(e,t,n,r,i,a=!1){if(t.inlineContent)return K.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=r_(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&q.isSelectable(r))return q.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function i_(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof xg||i instanceof Sg))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(G.near(e.doc.resolve(o),n))}var a_=1,o_=2,s_=4,c_=class extends Jg{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|a_)&~o_,this.storedMarks=null,this}get selectionSet(){return(this.updated&a_)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=o_,this}ensureMarks(e){return Jm.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&o_)>0}addStep(e,t){super.addStep(e,t),this.updated&=~o_,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Jm.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(G.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}getMeta(e){return this.meta[typeof e==`string`?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=s_,this}get scrolledIntoView(){return(this.updated&s_)>0}};function l_(e,t){return!t||!e?e:e.bind(t)}var u_=class{constructor(e,t,n){this.name=e,this.init=l_(t.init,n),this.apply=l_(t.apply,n)}},d_=[new u_(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new u_(`selection`,{init(e,t){return e.selection||G.atStart(t.doc)},apply(e){return e.selection}}),new u_(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new u_(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],f_=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=d_.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new u_(e.key,e.spec.state,e))})}},p_=class e{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new c_(this)}static create(t){let n=new f_(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new f_(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new f_(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=mh.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=G.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function m_(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=m_(i,t,{})),n[r]=i}return n}var h_=class{constructor(e){this.spec=e,this.props={},e.props&&m_(e.props,this,this.props),this.key=e.key?e.key.key:__(`plugin`)}getState(e){return e[this.key]}},g_=Object.create(null);function __(e){return e in g_?e+`$`+ ++g_[e]:(g_[e]=0,e+`$`)}var v_=class{constructor(e=`key`){this.key=__(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},y_=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function b_(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var x_=(e,t,n)=>{let r=b_(e,n);if(!r)return!1;let i=D_(r);if(!i){let n=r.blockRange(),i=n&&Tg(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(G_(e,i,t,-1))return!0;if(r.parent.content.size==0&&(T_(a,`end`)||q.isSelectable(a)))for(let n=r.depth;;n--){let o=Fg(e.doc,r.before(n),r.after(n),W.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(T_(a,`end`)?G.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):q.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},S_=(e,t,n)=>{let r=b_(e,n);if(!r)return!1;let i=D_(r);return i?w_(e,i,t):!1},C_=(e,t,n)=>{let r=O_(e,n);if(!r)return!1;let i=j_(r);return i?w_(e,i,t):!1};function w_(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=Fg(e.doc,i,o,W.empty);if(!s||s.from!=i||s instanceof xg&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(K.create(t.doc,i)),n(t.scrollIntoView())}return!0}function T_(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var E_=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=D_(r)}let o=a&&a.nodeBefore;return!o||!q.isSelectable(o)?!1:(t&&t(e.tr.setSelection(q.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function D_(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function O_(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var k_=(e,t,n)=>{let r=O_(e,n);if(!r)return!1;let i=j_(r);if(!i)return!1;let a=i.nodeAfter;if(G_(e,i,t,1))return!0;if(r.parent.content.size==0&&(T_(a,`start`)||q.isSelectable(a))){let n=Fg(e.doc,r.before(),r.after(),W.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(T_(a,`start`)?G.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):q.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},A_=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=j_(r)}let o=a&&a.nodeAfter;return!o||!q.isSelectable(o)?!1:(t&&t(e.tr.setSelection(q.create(e.doc,a.pos)).scrollIntoView()),!0)};function j_(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var M_=(e,t)=>{let n=e.selection,r=n instanceof q,i;if(r){if(n.node.isTextblock||!jg(e.doc,n.from))return!1;i=n.from}else if(i=Ng(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(q.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},N_=(e,t)=>{let n=e.selection,r;if(n instanceof q){if(n.node.isTextblock||!jg(e.doc,n.to))return!1;r=n.to}else if(r=Ng(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},P_=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&Tg(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},F_=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
188
|
-
`).scrollIntoView()),!0)};function I_(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var L_=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=I_(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(G.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},R_=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof t_||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=I_(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(K.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},z_=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Ag(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Tg(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function B_(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof q&&t.selection.node.isBlock)return!r.parentOffset||!Ag(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,s,c=!1,l=!1;for(let t=r.depth;;t--)if(r.node(t).isBlock){c=r.end(t)==r.pos+(r.depth-t),l=r.start(t)==r.pos-(r.depth-t),s=I_(r.node(t-1).contentMatchAt(r.indexAfter(t-1)));let n=e&&e(i.parent,c,r);a.unshift(n||(c&&s?{type:s}:null)),o=t;break}else{if(t==1)return!1;a.unshift(null)}let u=t.tr;(t.selection instanceof K||t.selection instanceof t_)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Ag(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,Ag(u.doc,d,a.length,a)),!f)return!1;if(u.split(d,a.length,a),!c&&l&&r.node(o).type!=s){let e=u.mapping.map(r.before(o)),t=u.doc.resolve(e);s&&r.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&u.setNodeMarkup(u.mapping.map(r.before(o)),s)}return n&&n(u.scrollIntoView()),!0}}var V_=B_(),H_=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),t&&t(e.tr.setSelection(q.create(e.doc,i))),!0)},U_=(e,t)=>(t&&t(e.tr.setSelection(new t_(e.doc))),!0);function W_(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||jg(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function G_(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&W_(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=U.empty;for(let e=o.length-1;e>=0;e--)s=U.from(o[e].create(null,s));s=U.from(i.copy(s));let c=e.tr.step(new Sg(t.pos-1,r,t.pos,r,new W(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&jg(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:G.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&Tg(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&T_(a,`start`,!0)&&T_(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=U.empty;for(let e=o.length-1;e>=0;e--)r=U.from(o[e].copy(r));n(e.tr.step(new Sg(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new W(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function K_(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(K.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var q_=K_(-1),J_=K_(1);function Y_(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&Eg(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function X_(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function Z_(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var Q_=Z_(y_,x_,E_),$_=Z_(y_,k_,A_),ev={Enter:Z_(F_,R_,z_,V_),"Mod-Enter":L_,Backspace:Q_,"Mod-Backspace":Q_,"Shift-Backspace":Q_,Delete:$_,"Mod-Delete":$_,"Mod-a":U_},tv={"Ctrl-h":ev.Backspace,"Alt-Backspace":ev[`Mod-Backspace`],"Ctrl-d":ev.Delete,"Ctrl-Alt-Backspace":ev[`Mod-Delete`],"Alt-Delete":ev[`Mod-Delete`],"Alt-d":ev[`Mod-Delete`],"Ctrl-a":q_,"Ctrl-e":J_};for(let e in ev)tv[e]=ev[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function nv(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return rv(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function rv(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new fh(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new fh(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=Eg(a,n,r,t);return s?(e&&iv(e,t,s,i,n),!0):!1}function iv(e,t,n,r,i){let a=U.empty;for(let e=n.length-1;e>=0;e--)a=U.from(n[e].type.create(n[e].attrs,a));e.step(new Sg(t.start-(r?2:0),t.end,t.start,t.end,new W(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&Ag(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function av(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?ov(t,n,e,a):sv(t,n,a):!0:!1}}function ov(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new Sg(a-1,o,a,o,new W(U.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new fh(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=Tg(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return jg(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function sv(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?U.empty:U.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new Sg(d-+!!s,f+ +!!c,d+1,f-1,new W((s?U.empty:U.from(i.copy(U.empty))).append(c?U.empty:U.from(i.copy(U.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function cv(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=U.from(r?e.create():null),o=new W(U.from(e.create(null,U.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new Sg(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var lv=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},uv=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},dv=null,fv=function(e,t,n){let r=dv||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},pv=function(){dv=null},mv=function(e,t,n,r){return n&&(gv(e,t,n,r,-1)||gv(e,t,n,r,1))},hv=/^(img|br|input|textarea|hr)$/i;function gv(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:_v(e))){let n=e.parentNode;if(!n||n.nodeType!=1||xv(e)||hv.test(e.nodeName)||e.contentEditable==`false`)return!1;t=lv(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?_v(e):0}else return!1}}function _v(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function vv(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=_v(e)}else if(e.parentNode&&!xv(e))t=lv(e),e=e.parentNode;else return null}}function yv(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!xv(e))t=lv(e)+1,e=e.parentNode;else return null}}function bv(e,t,n){for(let r=t==0,i=t==_v(e);r||i;){if(e==n)return!0;let t=lv(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==_v(e)}}function xv(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Sv=function(e){return e.focusNode&&mv(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Cv(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function wv(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Tv(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(_v(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(_v(r.startContainer),r.startOffset)}}}var Ev=typeof navigator<`u`?navigator:null,Dv=typeof document<`u`?document:null,Ov=Ev&&Ev.userAgent||``,kv=/Edge\/(\d+)/.exec(Ov),Av=/MSIE \d/.exec(Ov),jv=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ov),Mv=!!(Av||jv||kv),Nv=Av?document.documentMode:jv?+jv[1]:kv?+kv[1]:0,Pv=!Mv&&/gecko\/(\d+)/i.test(Ov);Pv&&+(/Firefox\/(\d+)/.exec(Ov)||[0,0])[1];var Fv=!Mv&&/Chrome\/(\d+)/.exec(Ov),Iv=!!Fv,Lv=Fv?+Fv[1]:0,Rv=!Mv&&!!Ev&&/Apple Computer/.test(Ev.vendor),zv=Rv&&(/Mobile\/\w+/.test(Ov)||!!Ev&&Ev.maxTouchPoints>2),Bv=zv||(Ev?/Mac/.test(Ev.platform):!1),Vv=Ev?/Win/.test(Ev.platform):!1,Hv=/Android \d/.test(Ov),Uv=!!Dv&&`webkitFontSmoothing`in Dv.documentElement.style,Wv=Uv?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Gv(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Kv(e,t){return typeof e==`number`?e:e[t]}function qv(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Jv(e,t,n){let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=uv(o);continue}let e=o,n=e==a.body,s=n?Gv(a):qv(e),c=0,l=0;if(t.top<s.top+Kv(r,`top`)?l=-(s.top-t.top+Kv(i,`top`)):t.bottom>s.bottom-Kv(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+Kv(i,`top`)-s.top:t.bottom-s.bottom+Kv(i,`bottom`)),t.left<s.left+Kv(r,`left`)?c=-(s.left-t.left+Kv(i,`left`)):t.right>s.right-Kv(r,`right`)&&(c=t.right-s.right+Kv(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:uv(o)}}function Yv(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:Xv(e.dom)}}function Xv(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=uv(r));return t}function Zv({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;Qv(n,r==0?0:r-t)}function Qv(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var $v=null;function ey(e){if(e.setActive)return e.setActive();if($v)return e.focus($v);let t=Xv(e);e.focus($v==null?{get preventScroll(){return $v={preventScroll:!0},!0}}:void 0),$v||($v=!1,Qv(t,0))}function ty(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(u.nodeType==1)e=u.getClientRects();else if(u.nodeType==3)e=fv(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?ny(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:ty(n,i)}function ny(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=uy(r,1);if(n.top!=n.bottom&&ry(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function ry(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function iy(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function ay(e,t,n){let{node:r,offset:i}=ty(t,n),a=-1;if(r.nodeType==1&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function oy(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function sy(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(n.nodeType==1){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(ry(t,i))return sy(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function cy(e,t){let n=e.dom.ownerDocument,r,i=0,a=Tv(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){let n=e.dom.getBoundingClientRect();if(!ry(t,n)||(o=sy(e.dom,t,n),!o))return null}if(Rv)for(let e=o;r&&e;e=uv(e))e.draggable&&(r=void 0);if(o=iy(o,t),r){if(Pv&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;Uv&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=oy(e,r,i,t))}s??=ay(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function ly(e){return e.top<e.bottom||e.left<e.right}function uy(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(ly(e))return e}return Array.prototype.find.call(n,ly)||e.getBoundingClientRect()}var dy=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function fy(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=Uv||Pv;if(r.nodeType==3)if(o&&(dy.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=uy(fv(r,i,i),n);if(Pv&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=uy(fv(r,i-1,i-1),-1);if(t.top==e.top){let n=uy(fv(r,i,i+1),-1);if(n.top!=e.top)return py(n,n.left<t.left)}}return e}else{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,py(uy(fv(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==_v(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return my(e.getBoundingClientRect(),!1)}if(a==null&&i<_v(r)){let e=r.childNodes[i];if(e.nodeType==1)return my(e.getBoundingClientRect(),!0)}return my(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==_v(r))){let e=r.childNodes[i-1],t=e.nodeType==3?fv(e,_v(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return py(uy(t,1),!1)}if(a==null&&i<_v(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?fv(e,0,+!o):e.nodeType==1?e:null:null;if(t)return py(uy(t,-1),!0)}return py(uy(r.nodeType==3?fv(r):r,-n),n>=0)}function py(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function my(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function hy(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function gy(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return hy(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=fy(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=fv(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var _y=/[\u0590-\u08ac]/;function vy(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!_y.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:hy(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var yy=null,by=null,xy=!1;function Sy(e,t,n){return yy==t&&by==n?xy:(yy=t,by=n,xy=n==`up`||n==`down`?gy(e,t,n):vy(e,t,n))}var Cy=0,wy=1,Ty=2,Ey=3,Dy=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Cy,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>lv(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e||i instanceof Py){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Oy&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?lv(e.dom)+1:0}}else{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,!(!e||e.dom.parentNode==this.contentDOM);n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?lv(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=lv(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=lv(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((Pv||Rv)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
|
|
189
|
-
`),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:lv(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(Pv&&l.focusNode&&l.focusNode!=s.node&&l.focusNode.nodeType==1){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&Rv)&&mv(o.node,o.offset,l.anchorNode,l.anchorOffset)&&mv(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&Pv)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?Ty:wy,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Ey:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Ty:Ey}n=a}this.dirty=Ty}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Ty:wy;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},Oy=class extends Dy{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.contentEditable=`false`,a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Cy&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},ky=class extends Dy{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},Ay=class e extends Dy{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=Qh.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ey||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ey&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Cy){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=Cy}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=Zy(a,n,o,r)),t>0&&(a=Zy(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},jy=class e extends Dy{constructor(e,t,n,r,i,a,o,s,c){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=Qh.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Hy(u,r,n),l?c=new Fy(t,n,r,i,u,d||null,f,l,a,o+1):n.isText?new Ny(t,n,r,i,u,f,a):new e(t,n,r,i,u,d||null,f,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(e.preserveWhitespace=`full`),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>U.empty)}return e}matchesNode(e,t,n){return this.dirty==Cy&&e.eq(this.node)&&Uy(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new Gy(this,a&&a.node,e);Jy(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?Jm.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e,l);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==Ty)&&(a&&this.protectLocalComposition(e,a),Iy(this.contentDOM,this.children,e),zv&&Yy(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof K)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=Xy(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&=void 0}let a=new ky(this,i,t,r);e.input.compositionNodes.push(a),this.children=Zy(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==Ey||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Cy}updateOuterDeco(e){if(Uy(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=By(this.dom,this.nodeDOM,zy(this.outerDeco,this.node,t),zy(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function My(e,t,n,r,i){Hy(r,t,e);let a=new jy(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var Ny=class e extends jy{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i,null,a,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==Ey||this.dirty!=Cy&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Cy||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Cy,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Ey)}get domAtom(){return!1}isText(e){return this.node.text==e}},Py=class extends Dy{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Cy&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},Fy=class extends jy{constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,c,l),this.spec=s}update(e,t,n,r){if(this.dirty==Ey)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function Iy(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=Wy(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof Ay){let t=r?r.previousSibling:e.lastChild;Iy(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=Wy(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var Ly=function(e){e&&(this.nodeName=e)};Ly.prototype=Object.create(null);var Ry=[new Ly];function zy(e,t,n){if(e.length==0)return Ry;let r=n?Ry[0]:new Ly,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new Ly(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new Ly(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function By(e,t,n,r){if(n==Ry&&r==Ry)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=Ry[0],i=t)}Vy(i,o||Ry[0],a)}return i}function Vy(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function Hy(e,t,n){return By(e,e,Ry,zy(t,n,e.nodeType!=1))}function Uy(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function Wy(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var Gy=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Ky(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=Cy,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=Ay.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==Ey&&a.dom==a.contentDOM&&(a.dirty=Ty),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof jy){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=Ey&&Uy(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Ty,u.updateChildren(r,a+1),u.dirty=Cy),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Uy(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=jy.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=jy.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new Oy(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Ay;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Ny)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Rv||Iv)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new Py(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function Ky(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof Ay)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function qy(e,t){return e.type.side-t.type.side}function Jy(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u)if(d){d.sort(qy);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function Yy(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function Xy(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function Zy(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function Qy(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(Sv(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&q.isSelectable(e)&&i.parent&&!(e.isInline&&bv(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new q(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=lb(e,u,s,n)}return l}function $y(e){return e.editable?e.hasFocus():db(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function eb(e,t=!1){let n=e.state.selection;if(sb(e,n),$y(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Iv){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&mv(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)ob(e);else{let{anchor:r,head:i}=n,a,o;tb&&!(n instanceof K)&&(n.$from.parent.inlineContent||(a=nb(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=nb(e,n.to))),e.docView.setSelection(r,i,e,t),tb&&(a&&ib(a),o&&ib(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&ab(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var tb=Rv||Iv&&Lv<63;function nb(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(Rv&&i&&i.contentEditable==`false`)return rb(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return rb(i);if(a)return rb(a)}}function rb(e){return e.contentEditable=`true`,Rv&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function ib(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function ab(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!$y(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function ob(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,lv(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&Mv&&Nv<=11&&(n.disabled=!0,n.disabled=!1)}function sb(e,t){if(t instanceof q){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(cb(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else cb(e)}function cb(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function lb(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||K.between(t,n,r)}function ub(e){return e.editable&&!e.hasFocus()?!1:db(e)}function db(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function fb(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return mv(t.node,t.offset,n.anchorNode,n.anchorOffset)}function pb(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&G.findFrom(a,t)}function mb(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function hb(e,t,n){let r=e.state.selection;if(r instanceof K){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return mb(e,new K(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=pb(e.state,t);return n&&n instanceof q?mb(e,n):!1}else if(!(Bv&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?q.isSelectable(i)?mb(e,new q(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):Uv?mb(e,new K(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof q&&r.node.isInline)return mb(e,new K(t>0?r.$to:r.$from));else{let n=pb(e.state,t);return n?mb(e,n):!1}}function gb(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function _b(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function vb(e,t){return t<0?yb(e):bb(e)}function yb(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(Pv&&n.nodeType==1&&r<gb(n)&&_b(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(_b(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(xb(n))break;else{let t=n.previousSibling;for(;t&&_b(t,-1);)i=n.parentNode,a=lv(t),t=t.previousSibling;if(t)n=t,r=gb(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?wb(e,n,r):i&&wb(e,i,a)}function bb(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=gb(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(_b(e,1))a=n,o=++r;else break}else if(xb(n))break;else{let t=n.nextSibling;for(;t&&_b(t,1);)a=t.parentNode,o=lv(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=gb(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&wb(e,a,o)}function xb(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Sb(e,t){for(;e&&t==e.childNodes.length&&!xv(e);)t=lv(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=0}}function Cb(e,t){for(;e&&!t&&!xv(e);)t=lv(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function wb(e,t,n){if(t.nodeType!=3){let e,r;(r=Sb(t,n))?(t=r,n=0):(e=Cb(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Sv(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&eb(e)},50)}function Tb(e,t){let n=e.state.doc.resolve(t);if(!(Iv||Vv)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function Eb(e,t,n){let r=e.state.selection;if(r instanceof K&&!r.empty||n.indexOf(`s`)>-1||Bv&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=pb(e.state,t);if(n&&n instanceof q)return mb(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof t_?G.near(n,t):G.findFrom(n,t);return o?mb(e,o):!1}return!1}function Db(e,t){if(!(e.state.selection instanceof K))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function Ob(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function kb(e){if(!Rv||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;Ob(e,n,`true`),setTimeout(()=>Ob(e,n,`false`),20)}return!1}function Ab(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function jb(e,t){let n=t.keyCode,r=Ab(t);if(n==8||Bv&&n==72&&r==`c`)return Db(e,-1)||vb(e,-1);if(n==46&&!t.shiftKey||Bv&&n==68&&r==`c`)return Db(e,1)||vb(e,1);if(n==13||n==27)return!0;if(n==37||Bv&&n==66&&r==`c`){let t=n==37?Tb(e,e.state.selection.from)==`ltr`?-1:1:-1;return hb(e,t,r)||vb(e,t)}else if(n==39||Bv&&n==70&&r==`c`){let t=n==39?Tb(e,e.state.selection.from)==`ltr`?1:-1:1;return hb(e,t,r)||vb(e,t)}else if(n==38||Bv&&n==80&&r==`c`)return Eb(e,-1,r)||vb(e,-1);else if(n==40||Bv&&n==78&&r==`c`)return kb(e)||Eb(e,1,r)||vb(e,1);else if(r==(Bv?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function Mb(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||Qh.fromSchema(e.state.schema),s=Ub(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=Vb[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
|
|
182
|
+
`)+t:t}function cm(e){if(e===``)return``;let t=e.match(im);return t?(t[1]??``).replace(/\r?\n$/,``):e}var lm=`frontmatter`,um=[`text`,`number`,`boolean`,`date`,`list`,`object`];z(um);var dm=so([N(),P(),F()]),fm=zo(()=>so([dm.transform(e=>String(e)),mo(N(),pm),I(fm)])),pm=zo(()=>so([N(),P(),F(),I(fm),mo(N(),pm)])),mm=/^\d{4}-\d{2}-\d{2}$/;function hm(e){return typeof e==`string`&&mm.test(e)}function gm(e){return Array.isArray(e)?`list`:typeof e==`object`&&e?`object`:typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:hm(e)?`date`:`text`}function _m(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(_m(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:_m(r);return t}return e}var vm=Go(_m,mo(N(),pm)),ym=mo(N(),so([pm,$a()]));function bm(e){return!!(e===null||typeof e==`string`&&e===``||Array.isArray(e)&&e.length===0)}function xm(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!xm(e[n],t[n]))return!1;return!0}if(e!==null&&t!==null&&typeof e==`object`&&typeof t==`object`&&!Array.isArray(e)&&!Array.isArray(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.hasOwn(t,r)||!xm(e[r],t[r]))return!1;return!0}return!1}var Sm={defaultKeyType:`PLAIN`,defaultStringType:`PLAIN`,lineWidth:0};function Cm(e){if(e.trim()===``)return{doc:new dl({}),map:{}};let t;try{t=Su(e)}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new dl({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=vm.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function wm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Tm(e,t,n){if(Array.isArray(n)){let r=e.createNode(n),i=is(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}if(wm(n)){let r=e.createNode(n),i=ts(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}return n}function Em(e){return e===``?``:`---\n${e.endsWith(`
|
|
183
|
+
`)?e.slice(0,-1):e}\n---\n`}var Dm=R({name:N(),description:N(),files:R({skillMd:N(),scripts:I(N()),references:I(N())})}),Om=R({pluginProvider:N().optional(),plugin:N().optional(),marketplace:N().optional(),version:N().optional(),gitCommitSha:N().optional(),scope:N().optional(),projectPath:N().optional()}),km=R({commands:F(),hooks:F(),mcp:F()}),Am=R({...Dm.shape,sourceHarness:N(),sourceHarnesses:I(N()),home:N(),provenance:Om,inert:km,outsideProject:F().optional()}),jm=R({schema:B(1),name:N(),version:N(),description:N().optional(),author:R({name:N()}).optional(),skills:I(N()),hostCompatibility:I(N()).optional(),capabilities:R({scripts:N(),network:N(),inert:I(N())}).optional(),provenance:R({source:N(),ref:N(),contentHash:N()}).optional()});L({skills:I(Am),packs:I(jm)}).loose(),L({results:I(L({id:N().min(1),name:N().min(1),source:N().min(1),description:N(),installs:P().int().nonnegative().nullable(),publisher:N().nullable()}).loose()),backend:z([`skills.sh`,`github-fallback`]),degraded:F()}).loose(),L({title:N(),description:N(),image:N().nullable(),skillsUrl:N().nullable(),sourceKind:z([`github`,`site`]),sourceUrl:N()}).loose(),L({skills:I(L({name:N(),description:N().nullable()}).loose())}).loose(),L({kind:z([`local`,`import`,`none`]),scope:z(xp).optional(),name:N().optional(),dir:N().optional(),source:N().optional(),ref:N().optional(),via:z([`source`,`publisher`]).optional()}).loose();var Mm=L({relPath:N(),content:N().nullable()}).loose(),Nm=L({provider:N(),plugin:N(),version:N().optional(),marketplace:N().optional(),repositoryUrl:N().optional()}).loose(),Pm=L({provider:N(),plugin:N(),version:N().optional(),description:N().optional(),repositoryUrl:N().optional(),bundledSkills:I(N()),capabilities:L({commands:F(),hooks:F(),mcp:F(),agents:F()}),setupSupported:F()}).loose();L({name:N(),description:N().nullable(),skillMd:N(),files:I(Mm),plugin:Nm.optional(),pluginBundle:Pm.optional()}).loose();var Fm=new Set([`project`,`local`]);function Im(e){return e!==void 0&&Fm.has(e)?`project`:`global`}var Lm=/^([\w.-]+)\/([\w.-]+)$/,Rm=/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function zm(e){let t=Lm.exec(e);if(t){let[,e,n]=t;if(e&&n)return{kind:`github`,owner:e,repo:n}}return Rm.test(e)?{kind:`site`,hostname:e}:null}function Bm(e,t){let n=zm(e),r=t.trim();if(!n||!r)return null;let i=encodeURIComponent(r);if(n.kind===`github`){let e=encodeURIComponent(n.owner),t=encodeURIComponent(n.repo);return{sourceKind:`github`,skillsUrl:`https://www.skills.sh/${e}/${t}/${i}`,sourceUrl:`https://github.com/${e}/${t}`}}return{sourceKind:`site`,skillsUrl:`https://www.skills.sh/site/${encodeURIComponent(n.hostname)}/${i}`,sourceUrl:`https://${n.hostname}`}}var Vm={"bridge-merge-loss":{visibility:`surfaced`,gcBucket:`bridge-merge-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"producer-guard-loss":{visibility:`surfaced`,gcBucket:`producer-guard-loss`,bundleExposure:`metadata`,chainAnchor:!1},"observer-a-duplication":{visibility:`surfaced`,gcBucket:`observer-a-duplication`,bundleExposure:`metadata`,chainAnchor:!1},"external-change-rescue":{visibility:`surfaced`,gcBucket:`external-change-rescue`,bundleExposure:`metadata`,chainAnchor:!1},"defer-exhaustion-loss":{visibility:`surfaced`,gcBucket:`defer-exhaustion-loss`,bundleExposure:`metadata`,chainAnchor:!1},"observer-a-apply-loss":{visibility:`surfaced`,gcBucket:`observer-a-apply-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"bridge-derive-loss":{visibility:`surfaced`,gcBucket:`bridge-derive-loss`,bundleExposure:`subject-only`,chainAnchor:!1},"bridge-backstop-trip":{visibility:`surfaced`,gcBucket:`bridge-backstop-trip`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-reconcile-loss":{visibility:`surfaced`,gcBucket:`persistence-reconcile-loss`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-duplication-reset":{visibility:`surfaced`,gcBucket:`persistence-duplication-reset`,bundleExposure:`metadata`,chainAnchor:!1},"persistence-divergence-realign":{visibility:`surfaced`,gcBucket:`persistence-divergence-realign`,bundleExposure:`metadata`,chainAnchor:!1},"managed-artifact-reconcile":{visibility:`surfaced`,gcBucket:`managed-artifact-reconcile`,bundleExposure:`metadata`,chainAnchor:!1},"auto-consolidation":{visibility:`hidden`,gcBucket:`auto-consolidation`,bundleExposure:`none`,chainAnchor:!0}};function Hm(e){return e==null?!0:Vm[e].visibility===`surfaced`}function Um(e){this.content=e}Um.prototype={constructor:Um,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new Um(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new Um(n)},addToStart:function(e,t){return new Um([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Um(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new Um(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Um.from(e),e.size?new Um(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Um.from(e),e.size?new Um(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Um.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},Um.from=function(e){if(e instanceof Um)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Um(t)};function Wm(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=Wm(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Gm(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=Gm(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var U=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return Wm(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Gm(this,e,t,n)}findIndex(e){if(e==0)return qm(0,e);if(e==this.size)return qm(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?qm(t+1,i):qm(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return new e(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};U.empty=new U([],0);var Km={index:0,offset:0};function qm(e,t){return Km.index=e,Km.offset=t,Km}function Jm(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Jm(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Jm(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var Ym=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Jm(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};Ym.none=[];var Xm=class extends Error{},W=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=Qm(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Zm(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(U.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};W.empty=new W(U.empty,0,0);function Zm(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Zm(a.content,t-i-1,n-i-1)))}function Qm(e,t,n,r){let{index:i,offset:a}=e.findIndex(t),o=e.maybeChild(i);if(a==t||o.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let s=Qm(o.content,t-a-1,n,o);return s&&e.replaceChild(i,o.copy(s))}function $m(e,t,n){if(n.openStart>e.depth)throw new Xm(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Xm(`Inconsistent open depths`);return eh(e,t,n,0)}function eh(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=eh(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return ah(a,sh(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return ah(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=ch(n,e);return ah(a,oh(e,i,o,t,r))}}function th(e,t){if(!t.type.compatibleContent(e.type))throw new Xm(`Cannot join `+t.type.name+` onto `+e.type.name)}function nh(e,t,n){let r=e.node(n);return th(r,t.node(n)),r}function rh(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function ih(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(rh(e.nodeAfter,r),a++));for(let e=a;e<o;e++)rh(i.child(e),r);t&&t.depth==n&&t.textOffset&&rh(t.nodeBefore,r)}function ah(e,t){return e.type.checkContent(t),e.copy(t)}function oh(e,t,n,r,i){let a=e.depth>i&&nh(e,t,i+1),o=r.depth>i&&nh(n,r,i+1),s=[];return ih(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(th(a,o),rh(ah(a,oh(e,t,n,r,i+1)),s)):(a&&rh(ah(a,sh(e,t,i+1)),s),ih(t,n,i,s),o&&rh(ah(o,sh(n,r,i+1)),s)),ih(r,null,i,s),new U(s)}function sh(e,t,n){let r=[];return ih(null,e,n,r),e.depth>n&&rh(ah(nh(e,t,n+1),sh(e,t,n+1)),r),ih(t,null,n,r),new U(r)}function ch(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(U.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var lh=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Ym.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new ph(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=fh.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else fh.set(t,r=new uh);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%dh,i}},uh=class{constructor(){this.elts=[],this.i=0}},dh=12,fh=new WeakMap,ph=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},mh=Object.create(null),hh=class e{constructor(e,t,n,r=Ym.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||U.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Jm(this.attrs,t||e.defaultAttrs||mh)&&Ym.sameSet(this.marks,n||Ym.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return W.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new W(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return $m(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return lh.resolveCached(this,e)}resolveNoCache(e){return lh.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),_h(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=U.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ym.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Ym.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=U.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};hh.prototype.text=void 0;var gh=class e extends hh{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):_h(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function _h(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var vh=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new yh(t,n);if(r.next==null)return e.empty;let i=bh(r);r.next&&r.err(`Unexpected trailing text`);let a=Ah(Dh(i));return jh(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return U.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
184
|
+
`)}};vh.empty=new vh(!0);var yh=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function bh(e){let t=[];do t.push(xh(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function xh(e){let t=[];do t.push(Sh(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Sh(e){let t=Eh(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=wh(e,t);else break;return t}function Ch(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function wh(e,t){let n=Ch(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:Ch(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Th(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function Eh(e){if(e.eat(`(`)){let t=bh(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Th(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Dh(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function Oh(e,t){return t-e}function kh(e,t){let n=[];return r(t),n.sort(Oh);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Ah(e){let t=Object.create(null);return n(kh(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);kh(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new vh(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Oh);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function jh(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Mh(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function Nh(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Ph(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function Fh(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Rh(e,r,t[r]);return n}var Ih=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=Fh(e,n.attrs),this.defaultAttrs=Mh(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==vh.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Nh(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new hh(this,this.computeAttrs(e),U.from(t),Ym.setFrom(n))}createChecked(e=null,t,n){return t=U.from(t),this.checkContent(t),new hh(this,this.computeAttrs(e),t,Ym.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=U.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(U.empty,!0);return i?new hh(this,e,t.append(i),Ym.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ph(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:Ym.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function Lh(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var Rh=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Lh(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},zh=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Fh(e,r.attrs),this.excluded=null;let i=Mh(this.attrs);this.instance=i?new Ym(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ym(this,Nh(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Ph(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Bh=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=Um.from(e.nodes),t.marks=Um.from(e.marks||{}),this.nodes=Ih.compile(this.spec.nodes,this),this.marks=zh.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=vh.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?Vh(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:Vh(this,n.split(` `))}this.nodeFromJSON=e=>hh.fromJSON(this,e),this.markFromJSON=e=>Ym.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Ih))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new gh(n,n.defaultAttrs,e,Ym.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function Vh(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function ite(e){return e.tag!=null}function ate(e){return e.style!=null}var Hh=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(ite(e))this.tags.push(e);else if(ate(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new Xh(this,t,!1);return n.addAll(e,Ym.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Xh(this,t,!0);return n.addAll(e,Ym.none,t.from,t.to),W.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(cte(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Zh(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Zh(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},Uh={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ote={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Wh={ol:!0,ul:!0},Gh=1,Kh=2,qh=4;function Jh(e,t,n){return t==null?e&&e.whitespace==`pre`?Gh|Kh:n&~qh:(t?Gh:0)|(t===`full`?Kh:0)}var Yh=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=Ym.none,this.match=i||(a&qh?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(U.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Gh)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=U.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(U.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Uh.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Xh=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=Jh(null,t.preserveWhitespace,0)|(n?qh:0);i=r?new Yh(r.type,r.attrs,Ym.none,!0,t.topMatch||r.type.contentMatch,a):n?new Yh(null,null,Ym.none,!0,null,a):new Yh(e.schema.topNodeType,null,Ym.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Kh?`full`:this.localPreserveWS||(r.options&Gh)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
185
|
+
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Wh.hasOwnProperty(a)&&this.parser.normalizeLists&&ste(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:ote.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(Uh.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
186
|
+
`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=Ym.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Qh(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=Jh(e,i,a.options);a.options&qh&&a.content.length==0&&(o|=qh);let s=Ym.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):Qh(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new Yh(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=Gh);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function ste(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Wh.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function cte(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Zh(e){let t={};for(let n in e)t[n]=e[n];return t}function Qh(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var $h=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=tg(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=rg(tg(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&rg(tg(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return rg(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=eg(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return eg(e.marks)}};function eg(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function tg(e){return e.document||window.document}var ng=new WeakMap;function lte(e){let t=ng.get(e);return t===void 0&&ng.set(e,t=ute(e)),t}function ute(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function rg(e,t,n,r){if(typeof t==`string`)return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=lte(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else{let{dom:t,contentDOM:i}=rg(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var ig=65535,ag=2**16;function dte(e,t){return e+t*ag}function og(e){return e&ig}function fte(e){return(e-(e&ig))/ag}var sg=1,cg=2,lg=4,ug=8,dg=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&ug)>0}get deletedBefore(){return(this.delInfo&(sg|lg))>0}get deletedAfter(){return(this.delInfo&(cg|lg))>0}get deletedAcross(){return(this.delInfo&lg)>0}},fg=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=og(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+fte(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:dte(o/3,e-s),f=e==s?cg:e==u?sg:lg;return(t<0?e!=s:e!=u)&&(f|=ug),new dg(a,f,d)}r+=l-c}return n?e+r:new dg(e+r,0,null)}touches(e,t){let n=0,r=og(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};fg.empty=new fg([]);var pg=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new dg(e,r,null)}},mg=Object.create(null),hg=class{getMap(){return fg.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=mg[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in mg)throw RangeError(`Duplicate use of step JSON ID `+e);return mg[e]=t,t.prototype.jsonID=e,t}},gg=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof Xm)return e.fail(t.message);throw t}}};function _g(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(_g(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return U.fromArray(r)}var vg=class e extends hg{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new W(_g(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return gg.fromReplace(e,this.from,this.to,i)}invert(){return new yg(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};hg.jsonID(`addMark`,vg);var yg=class e extends hg{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new W(_g(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return gg.fromReplace(e,this.from,this.to,n)}invert(){return new vg(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};hg.jsonID(`removeMark`,yg);var bg=class e extends hg{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return gg.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return gg.fromReplace(e,this.pos,this.pos+1,new W(U.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new xg(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};hg.jsonID(`addNodeMark`,bg);var xg=class e extends hg{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return gg.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return gg.fromReplace(e,this.pos,this.pos+1,new W(U.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new bg(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};hg.jsonID(`removeNodeMark`,xg);var Sg=class e extends hg{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&wg(e,this.from,this.to)?gg.fail(`Structure replace would overwrite content`):gg.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new fg([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?W.empty:new W(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?W.empty:new W(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:`replace`,from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,W.fromJSON(t,n.slice),!!n.structure)}};Sg.MAP_BIAS=1,hg.jsonID(`replace`,Sg);var Cg=class e extends hg{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(wg(e,this.from,this.gapFrom)||wg(e,this.gapTo,this.to)))return gg.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return gg.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?gg.fromReplace(e,this.from,this.to,n):gg.fail(`Content does not fit in gap`)}getMap(){return new fg([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:`replaceAround`,from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,W.fromJSON(t,n.slice),n.insert,!!n.structure)}};hg.jsonID(`replaceAround`,Cg);function wg(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function pte(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new yg(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new vg(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function mte(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof zh){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new yg(t.from,t.to,t.style)))}function Tg(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new Sg(s,l,W.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new yg(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new W(U.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new Sg(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(U.empty,!0);e.replace(s,s,new W(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function hte(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Eg(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!hte(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function gte(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=U.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=U.from(r.node(e).copy(u)),d++):c--;let f=U.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=U.from(i.node(e).copy(f)),p++):l++;e.step(new Cg(c,l,o,s,new W(u.append(f),d,p),u.size-d,!0))}function Dg(e,t,n=null,r=e){let i=_te(e,t),a=i&&vte(r,t);return a?i.map(Og).concat({type:t,attrs:n}).concat(a.map(Og)):null}function Og(e){return{type:e,attrs:null}}function _te(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function vte(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function yte(e,t,n){let r=U.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=U.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new Cg(i,a,i,a,new W(r,0,0),n.length,!0))}function bte(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&xte(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&Ag(e,t,n,a),Tg(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new Cg(c,l,c+1,l-1,new W(U.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&kg(e,t,n,a),!1}})}function kg(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function Ag(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
|
|
187
|
+
`))}})}function xte(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function Ste(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new Cg(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new W(U.from(o),0,0),1,!0))}function jg(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function Cte(e,t,n=1,r){let i=e.doc.resolve(t),a=U.empty,o=U.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=U.from(i.node(e).copy(a));let t=r&&r[s];o=U.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new Sg(t,t,new W(a.append(o),n,n),!0))}function Mg(e,t){let n=e.resolve(t),r=n.index();return Ng(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function wte(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function Ng(e,t){return!!(e&&t&&!e.isLeaf&&wte(e,t))}function Pg(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,a,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&Ng(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function Tte(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);Ag(e,r.node(),r.before(),s)}o.inlineContent&&Tg(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new Sg(l,c.map(t+n,-1),W.empty,!0)),r===!0){let t=e.doc.resolve(l);kg(e,t.node(),t.before(),e.steps.length)}return e}function Ete(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function Fg(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function Ig(e,t,n=t,r=W.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return Lg(i,a,r)?new Sg(t,n,r):new Dte(i,a,r).fit()}function Lg(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var Dte=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=U.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=U.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new W(i,a,o);return e>-1?new Cg(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new Sg(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Bg(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(U.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Bg(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new W(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Bg(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new W(Rg(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new W(Rg(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=n?n.content:a.content,s=a.openStart-e,c=0,l=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));u=u.matchFragment(r)}let f=o.size+e-(a.content.size-a.openEnd);for(;c<o.childCount;){let e=o.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||s==0||e.content.size)&&(u=t,l.push(Vg(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=zg(this.placed,t,U.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?e==0?W.empty:new W(Rg(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new W(Rg(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Hg(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Hg(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=Hg(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=zg(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=zg(this.placed,this.depth,U.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(U.empty,!0);e.childCount&&(this.placed=zg(this.placed,this.frontier.length,e))}};function Rg(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Rg(e.firstChild.content,t-1,n)))}function zg(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(zg(e.lastChild.content,t-1,n)))}function Bg(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Vg(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Vg(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(U.empty,!0)))),e.copy(r)}function Hg(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!Ote(n,a.content,o)?s:null}function Ote(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function kte(e){return e.spec.defining||e.spec.definingForContent}function Ate(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(Lg(i,a,r))return e.step(new Sg(t,n,r));let o=Wg(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=kte(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],u=!0;l<0&&(u=!1,l=-l);let f=i.node(l-1),p=i.index(l-1);if(f.canReplaceWith(p,p,d.type,d.marks))return e.replace(i.before(l),u?a.after(l):n,new W(Ug(r.content,0,r.openStart,s),s,r.openEnd))}}let d=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function Ug(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(Ug(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(U.empty,!0))}return e}function jte(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=Ete(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new W(U.from(r),0,0))}function Mte(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=Wg(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function Wg(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var Gg=class e extends hg{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return gg.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return gg.fromReplace(e,this.pos,this.pos+1,new W(U.from(r),0,+!t.isLeaf))}getMap(){return fg.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};hg.jsonID(`attr`,Gg);var Kg=class e extends hg{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return gg.ok(n)}getMap(){return fg.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};hg.jsonID(`docAttr`,Kg);var qg=class extends Error{};qg=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},qg.prototype=Object.create(Error.prototype),qg.prototype.constructor=qg,qg.prototype.name=`TransformError`;var Jg=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new pg}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new qg(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=W.empty){let r=Ig(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new W(U.from(n),0,0))}delete(e,t){return this.replace(e,t,W.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return Ate(this,e,t,n),this}replaceRangeWith(e,t,n){return jte(this,e,t,n),this}deleteRange(e,t){return Mte(this,e,t),this}lift(e,t){return gte(this,e,t),this}join(e,t=1){return Tte(this,e,t),this}wrap(e,t){return yte(this,e,t),this}setBlockType(e,t=e,n,r=null){return bte(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return Ste(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Gg(e,t,n)),this}setDocAttribute(e,t){return this.step(new Kg(e,t)),this}addNodeMark(e,t){return this.step(new bg(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof Ym)t.isInSet(n.marks)&&this.step(new xg(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new xg(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return Cte(this,e,t,n),this}addMark(e,t,n){return pte(this,e,t,n),this}removeMark(e,t,n){return mte(this,e,t,n),this}clearIncompatible(e,t,n){return Tg(this,e,t,n),this}},Yg=Object.create(null),G=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Xg(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=W.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?W.empty:t),o==0&&i_(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),i_(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new K(e):r_(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?r_(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):r_(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new t_(e.node(0))}static atStart(e){return r_(e,e,0,0,1)||new t_(e)}static atEnd(e){return r_(e,e,e.content.size,e.childCount,-1)||new t_(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=Yg[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Yg)throw RangeError(`Duplicate use of selection JSON ID `+e);return Yg[e]=t,t.prototype.jsonID=e,t}getBookmark(){return K.between(this.$anchor,this.$head).getBookmark()}};G.prototype.visible=!0;var Xg=class{constructor(e,t){this.$from=e,this.$to=t}},Zg=!1;function Qg(e){!Zg&&!e.parent.inlineContent&&(Zg=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var K=class e extends G{constructor(e,t=e){Qg(e),Qg(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return G.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=W.empty){if(super.replace(e,t),t==W.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new $g(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=G.findFrom(n,r,!0)||G.findFrom(n,-r,!0);if(e)n=e.$head;else return G.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(G.findFrom(t,-r,!0)||G.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};G.jsonID(`text`,K);var $g=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return K.between(e.resolve(this.anchor),e.resolve(this.head))}},q=class e extends G{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?G.near(a):new e(a)}content(){return new W(U.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new e_(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};q.prototype.visible=!1,G.jsonID(`node`,q);var e_=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new $g(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&q.isSelectable(n)?new q(t):G.near(t)}},t_=class e extends G{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=W.empty){if(t==W.empty){e.delete(0,e.doc.content.size);let t=G.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return n_}};G.jsonID(`all`,t_);var n_={map(){return this},resolve(e){return new t_(e)}};function r_(e,t,n,r,i,a=!1){if(t.inlineContent)return K.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=r_(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&q.isSelectable(r))return q.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function i_(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Sg||i instanceof Cg))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(G.near(e.doc.resolve(o),n))}var a_=1,o_=2,s_=4,c_=class extends Jg{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|a_)&~o_,this.storedMarks=null,this}get selectionSet(){return(this.updated&a_)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=o_,this}ensureMarks(e){return Ym.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&o_)>0}addStep(e,t){super.addStep(e,t),this.updated&=~o_,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Ym.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(G.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,this}getMeta(e){return this.meta[typeof e==`string`?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=s_,this}get scrolledIntoView(){return(this.updated&s_)>0}};function l_(e,t){return!t||!e?e:e.bind(t)}var u_=class{constructor(e,t,n){this.name=e,this.init=l_(t.init,n),this.apply=l_(t.apply,n)}},d_=[new u_(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new u_(`selection`,{init(e,t){return e.selection||G.atStart(t.doc)},apply(e){return e.selection}}),new u_(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new u_(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],f_=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=d_.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new u_(e.key,e.spec.state,e))})}},p_=class e{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new c_(this)}static create(t){let n=new f_(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new f_(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new f_(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=hh.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=G.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function m_(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=m_(i,t,{})),n[r]=i}return n}var h_=class{constructor(e){this.spec=e,this.props={},e.props&&m_(e.props,this,this.props),this.key=e.key?e.key.key:__(`plugin`)}getState(e){return e[this.key]}},g_=Object.create(null);function __(e){return e in g_?e+`$`+ ++g_[e]:(g_[e]=0,e+`$`)}var v_=class{constructor(e=`key`){this.key=__(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},y_=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function b_(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var x_=(e,t,n)=>{let r=b_(e,n);if(!r)return!1;let i=D_(r);if(!i){let n=r.blockRange(),i=n&&Eg(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(G_(e,i,t,-1))return!0;if(r.parent.content.size==0&&(T_(a,`end`)||q.isSelectable(a)))for(let n=r.depth;;n--){let o=Ig(e.doc,r.before(n),r.after(n),W.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(T_(a,`end`)?G.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):q.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},S_=(e,t,n)=>{let r=b_(e,n);if(!r)return!1;let i=D_(r);return i?w_(e,i,t):!1},C_=(e,t,n)=>{let r=O_(e,n);if(!r)return!1;let i=j_(r);return i?w_(e,i,t):!1};function w_(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=Ig(e.doc,i,o,W.empty);if(!s||s.from!=i||s instanceof Sg&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(K.create(t.doc,i)),n(t.scrollIntoView())}return!0}function T_(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var E_=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=D_(r)}let o=a&&a.nodeBefore;return!o||!q.isSelectable(o)?!1:(t&&t(e.tr.setSelection(q.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function D_(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function O_(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var k_=(e,t,n)=>{let r=O_(e,n);if(!r)return!1;let i=j_(r);if(!i)return!1;let a=i.nodeAfter;if(G_(e,i,t,1))return!0;if(r.parent.content.size==0&&(T_(a,`start`)||q.isSelectable(a))){let n=Ig(e.doc,r.before(),r.after(),W.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(T_(a,`start`)?G.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):q.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},A_=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=j_(r)}let o=a&&a.nodeAfter;return!o||!q.isSelectable(o)?!1:(t&&t(e.tr.setSelection(q.create(e.doc,a.pos)).scrollIntoView()),!0)};function j_(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var M_=(e,t)=>{let n=e.selection,r=n instanceof q,i;if(r){if(n.node.isTextblock||!Mg(e.doc,n.from))return!1;i=n.from}else if(i=Pg(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(q.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},N_=(e,t)=>{let n=e.selection,r;if(n instanceof q){if(n.node.isTextblock||!Mg(e.doc,n.to))return!1;r=n.to}else if(r=Pg(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},P_=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&Eg(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},F_=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
188
|
+
`).scrollIntoView()),!0)};function I_(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var L_=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=I_(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(G.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},R_=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof t_||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=I_(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(K.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},z_=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(jg(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Eg(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function B_(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof q&&t.selection.node.isBlock)return!r.parentOffset||!jg(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,s,c=!1,l=!1;for(let t=r.depth;;t--)if(r.node(t).isBlock){c=r.end(t)==r.pos+(r.depth-t),l=r.start(t)==r.pos-(r.depth-t),s=I_(r.node(t-1).contentMatchAt(r.indexAfter(t-1)));let n=e&&e(i.parent,c,r);a.unshift(n||(c&&s?{type:s}:null)),o=t;break}else{if(t==1)return!1;a.unshift(null)}let u=t.tr;(t.selection instanceof K||t.selection instanceof t_)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=jg(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,jg(u.doc,d,a.length,a)),!f)return!1;if(u.split(d,a.length,a),!c&&l&&r.node(o).type!=s){let e=u.mapping.map(r.before(o)),t=u.doc.resolve(e);s&&r.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&u.setNodeMarkup(u.mapping.map(r.before(o)),s)}return n&&n(u.scrollIntoView()),!0}}var V_=B_(),H_=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),t&&t(e.tr.setSelection(q.create(e.doc,i))),!0)},U_=(e,t)=>(t&&t(e.tr.setSelection(new t_(e.doc))),!0);function W_(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||Mg(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function G_(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&W_(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=U.empty;for(let e=o.length-1;e>=0;e--)s=U.from(o[e].create(null,s));s=U.from(i.copy(s));let c=e.tr.step(new Cg(t.pos-1,r,t.pos,r,new W(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&Mg(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:G.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&Eg(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&T_(a,`start`,!0)&&T_(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=U.empty;for(let e=o.length-1;e>=0;e--)r=U.from(o[e].copy(r));n(e.tr.step(new Cg(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new W(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function K_(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(K.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var q_=K_(-1),J_=K_(1);function Y_(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&Dg(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function X_(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function Z_(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var Q_=Z_(y_,x_,E_),$_=Z_(y_,k_,A_),ev={Enter:Z_(F_,R_,z_,V_),"Mod-Enter":L_,Backspace:Q_,"Mod-Backspace":Q_,"Shift-Backspace":Q_,Delete:$_,"Mod-Delete":$_,"Mod-a":U_},tv={"Ctrl-h":ev.Backspace,"Alt-Backspace":ev[`Mod-Backspace`],"Ctrl-d":ev.Delete,"Ctrl-Alt-Backspace":ev[`Mod-Delete`],"Alt-Delete":ev[`Mod-Delete`],"Alt-d":ev[`Mod-Delete`],"Ctrl-a":q_,"Ctrl-e":J_};for(let e in ev)tv[e]=ev[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function nv(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return rv(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function rv(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new ph(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new ph(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=Dg(a,n,r,t);return s?(e&&iv(e,t,s,i,n),!0):!1}function iv(e,t,n,r,i){let a=U.empty;for(let e=n.length-1;e>=0;e--)a=U.from(n[e].type.create(n[e].attrs,a));e.step(new Cg(t.start-(r?2:0),t.end,t.start,t.end,new W(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&jg(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function av(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?ov(t,n,e,a):sv(t,n,a):!0:!1}}function ov(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new Cg(a-1,o,a,o,new W(U.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ph(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=Eg(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return Mg(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function sv(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?U.empty:U.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new Cg(d-+!!s,f+ +!!c,d+1,f-1,new W((s?U.empty:U.from(i.copy(U.empty))).append(c?U.empty:U.from(i.copy(U.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function cv(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=U.from(r?e.create():null),o=new W(U.from(e.create(null,U.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new Cg(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var lv=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},uv=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},dv=null,fv=function(e,t,n){let r=dv||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},pv=function(){dv=null},mv=function(e,t,n,r){return n&&(gv(e,t,n,r,-1)||gv(e,t,n,r,1))},hv=/^(img|br|input|textarea|hr)$/i;function gv(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:_v(e))){let n=e.parentNode;if(!n||n.nodeType!=1||xv(e)||hv.test(e.nodeName)||e.contentEditable==`false`)return!1;t=lv(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?_v(e):0}else return!1}}function _v(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function vv(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=_v(e)}else if(e.parentNode&&!xv(e))t=lv(e),e=e.parentNode;else return null}}function yv(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!xv(e))t=lv(e)+1,e=e.parentNode;else return null}}function bv(e,t,n){for(let r=t==0,i=t==_v(e);r||i;){if(e==n)return!0;let t=lv(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==_v(e)}}function xv(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Sv=function(e){return e.focusNode&&mv(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Cv(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function wv(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Tv(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(_v(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(_v(r.startContainer),r.startOffset)}}}var Ev=typeof navigator<`u`?navigator:null,Dv=typeof document<`u`?document:null,Ov=Ev&&Ev.userAgent||``,kv=/Edge\/(\d+)/.exec(Ov),Av=/MSIE \d/.exec(Ov),jv=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ov),Mv=!!(Av||jv||kv),Nv=Av?document.documentMode:jv?+jv[1]:kv?+kv[1]:0,Pv=!Mv&&/gecko\/(\d+)/i.test(Ov);Pv&&+(/Firefox\/(\d+)/.exec(Ov)||[0,0])[1];var Fv=!Mv&&/Chrome\/(\d+)/.exec(Ov),Iv=!!Fv,Lv=Fv?+Fv[1]:0,Rv=!Mv&&!!Ev&&/Apple Computer/.test(Ev.vendor),zv=Rv&&(/Mobile\/\w+/.test(Ov)||!!Ev&&Ev.maxTouchPoints>2),Bv=zv||(Ev?/Mac/.test(Ev.platform):!1),Vv=Ev?/Win/.test(Ev.platform):!1,Hv=/Android \d/.test(Ov),Uv=!!Dv&&`webkitFontSmoothing`in Dv.documentElement.style,Wv=Uv?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Gv(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Kv(e,t){return typeof e==`number`?e:e[t]}function qv(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Jv(e,t,n){let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=uv(o);continue}let e=o,n=e==a.body,s=n?Gv(a):qv(e),c=0,l=0;if(t.top<s.top+Kv(r,`top`)?l=-(s.top-t.top+Kv(i,`top`)):t.bottom>s.bottom-Kv(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+Kv(i,`top`)-s.top:t.bottom-s.bottom+Kv(i,`bottom`)),t.left<s.left+Kv(r,`left`)?c=-(s.left-t.left+Kv(i,`left`)):t.right>s.right-Kv(r,`right`)&&(c=t.right-s.right+Kv(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:uv(o)}}function Yv(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:Xv(e.dom)}}function Xv(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=uv(r));return t}function Zv({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;Qv(n,r==0?0:r-t)}function Qv(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var $v=null;function ey(e){if(e.setActive)return e.setActive();if($v)return e.focus($v);let t=Xv(e);e.focus($v==null?{get preventScroll(){return $v={preventScroll:!0},!0}}:void 0),$v||($v=!1,Qv(t,0))}function ty(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(u.nodeType==1)e=u.getClientRects();else if(u.nodeType==3)e=fv(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?ny(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:ty(n,i)}function ny(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=uy(r,1);if(n.top!=n.bottom&&ry(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function ry(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function iy(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function ay(e,t,n){let{node:r,offset:i}=ty(t,n),a=-1;if(r.nodeType==1&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function oy(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function sy(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(n.nodeType==1){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(ry(t,i))return sy(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function cy(e,t){let n=e.dom.ownerDocument,r,i=0,a=Tv(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){let n=e.dom.getBoundingClientRect();if(!ry(t,n)||(o=sy(e.dom,t,n),!o))return null}if(Rv)for(let e=o;r&&e;e=uv(e))e.draggable&&(r=void 0);if(o=iy(o,t),r){if(Pv&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;Uv&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=oy(e,r,i,t))}s??=ay(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function ly(e){return e.top<e.bottom||e.left<e.right}function uy(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(ly(e))return e}return Array.prototype.find.call(n,ly)||e.getBoundingClientRect()}var dy=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function fy(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=Uv||Pv;if(r.nodeType==3)if(o&&(dy.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=uy(fv(r,i,i),n);if(Pv&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=uy(fv(r,i-1,i-1),-1);if(t.top==e.top){let n=uy(fv(r,i,i+1),-1);if(n.top!=e.top)return py(n,n.left<t.left)}}return e}else{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,py(uy(fv(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==_v(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return my(e.getBoundingClientRect(),!1)}if(a==null&&i<_v(r)){let e=r.childNodes[i];if(e.nodeType==1)return my(e.getBoundingClientRect(),!0)}return my(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==_v(r))){let e=r.childNodes[i-1],t=e.nodeType==3?fv(e,_v(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return py(uy(t,1),!1)}if(a==null&&i<_v(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?fv(e,0,+!o):e.nodeType==1?e:null:null;if(t)return py(uy(t,-1),!0)}return py(uy(r.nodeType==3?fv(r):r,-n),n>=0)}function py(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function my(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function hy(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function gy(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return hy(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=fy(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=fv(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var _y=/[\u0590-\u08ac]/;function vy(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!_y.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:hy(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var yy=null,by=null,xy=!1;function Sy(e,t,n){return yy==t&&by==n?xy:(yy=t,by=n,xy=n==`up`||n==`down`?gy(e,t,n):vy(e,t,n))}var Cy=0,wy=1,Ty=2,Ey=3,Dy=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Cy,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>lv(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e||i instanceof Py){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof Oy&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?lv(e.dom)+1:0}}else{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,!(!e||e.dom.parentNode==this.contentDOM);n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?lv(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=lv(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=lv(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((Pv||Rv)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
|
|
189
|
+
`),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:lv(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(Pv&&l.focusNode&&l.focusNode!=s.node&&l.focusNode.nodeType==1){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&Rv)&&mv(o.node,o.offset,l.anchorNode,l.anchorOffset)&&mv(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&Pv)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?Ty:wy,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Ey:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Ty:Ey}n=a}this.dirty=Ty}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Ty:wy;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},Oy=class extends Dy{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.contentEditable=`false`,a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Cy&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},ky=class extends Dy{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},Ay=class e extends Dy{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=$h.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ey||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ey&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Cy){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=Cy}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=Zy(a,n,o,r)),t>0&&(a=Zy(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},jy=class e extends Dy{constructor(e,t,n,r,i,a,o,s,c){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=$h.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Hy(u,r,n),l?c=new Fy(t,n,r,i,u,d||null,f,l,a,o+1):n.isText?new Ny(t,n,r,i,u,f,a):new e(t,n,r,i,u,d||null,f,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(e.preserveWhitespace=`full`),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>U.empty)}return e}matchesNode(e,t,n){return this.dirty==Cy&&e.eq(this.node)&&Uy(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new Gy(this,a&&a.node,e);Jy(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?Ym.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e,l);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==Ty)&&(a&&this.protectLocalComposition(e,a),Iy(this.contentDOM,this.children,e),zv&&Yy(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof K)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=Xy(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&=void 0}let a=new ky(this,i,t,r);e.input.compositionNodes.push(a),this.children=Zy(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==Ey||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Cy}updateOuterDeco(e){if(Uy(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=By(this.dom,this.nodeDOM,zy(this.outerDeco,this.node,t),zy(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function My(e,t,n,r,i){Hy(r,t,e);let a=new jy(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var Ny=class e extends jy{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i,null,a,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==Ey||this.dirty!=Cy&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Cy||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Cy,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Ey)}get domAtom(){return!1}isText(e){return this.node.text==e}},Py=class extends Dy{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Cy&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},Fy=class extends jy{constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,c,l),this.spec=s}update(e,t,n,r){if(this.dirty==Ey)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function Iy(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=Wy(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof Ay){let t=r?r.previousSibling:e.lastChild;Iy(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=Wy(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var Ly=function(e){e&&(this.nodeName=e)};Ly.prototype=Object.create(null);var Ry=[new Ly];function zy(e,t,n){if(e.length==0)return Ry;let r=n?Ry[0]:new Ly,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new Ly(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new Ly(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function By(e,t,n,r){if(n==Ry&&r==Ry)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=Ry[0],i=t)}Vy(i,o||Ry[0],a)}return i}function Vy(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function Hy(e,t,n){return By(e,e,Ry,zy(t,n,e.nodeType!=1))}function Uy(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function Wy(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var Gy=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Ky(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=Cy,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=Ay.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==Ey&&a.dom==a.contentDOM&&(a.dirty=Ty),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof jy){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=Ey&&Uy(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Ty,u.updateChildren(r,a+1),u.dirty=Cy),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Uy(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=jy.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=jy.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new Oy(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Ay;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Ny)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Rv||Iv)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new Py(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function Ky(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof Ay)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function qy(e,t){return e.type.side-t.type.side}function Jy(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u)if(d){d.sort(qy);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function Yy(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function Xy(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function Zy(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function Qy(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(Sv(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&q.isSelectable(e)&&i.parent&&!(e.isInline&&bv(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new q(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=lb(e,u,s,n)}return l}function $y(e){return e.editable?e.hasFocus():db(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function eb(e,t=!1){let n=e.state.selection;if(sb(e,n),$y(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Iv){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&mv(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)ob(e);else{let{anchor:r,head:i}=n,a,o;tb&&!(n instanceof K)&&(n.$from.parent.inlineContent||(a=nb(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=nb(e,n.to))),e.docView.setSelection(r,i,e,t),tb&&(a&&ib(a),o&&ib(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&ab(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var tb=Rv||Iv&&Lv<63;function nb(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(Rv&&i&&i.contentEditable==`false`)return rb(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return rb(i);if(a)return rb(a)}}function rb(e){return e.contentEditable=`true`,Rv&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function ib(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function ab(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!$y(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function ob(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,lv(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&Mv&&Nv<=11&&(n.disabled=!0,n.disabled=!1)}function sb(e,t){if(t instanceof q){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(cb(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else cb(e)}function cb(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function lb(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||K.between(t,n,r)}function ub(e){return e.editable&&!e.hasFocus()?!1:db(e)}function db(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function fb(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return mv(t.node,t.offset,n.anchorNode,n.anchorOffset)}function pb(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&G.findFrom(a,t)}function mb(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function hb(e,t,n){let r=e.state.selection;if(r instanceof K){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return mb(e,new K(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=pb(e.state,t);return n&&n instanceof q?mb(e,n):!1}else if(!(Bv&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?q.isSelectable(i)?mb(e,new q(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):Uv?mb(e,new K(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof q&&r.node.isInline)return mb(e,new K(t>0?r.$to:r.$from));else{let n=pb(e.state,t);return n?mb(e,n):!1}}function gb(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function _b(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function vb(e,t){return t<0?yb(e):bb(e)}function yb(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(Pv&&n.nodeType==1&&r<gb(n)&&_b(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(_b(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(xb(n))break;else{let t=n.previousSibling;for(;t&&_b(t,-1);)i=n.parentNode,a=lv(t),t=t.previousSibling;if(t)n=t,r=gb(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?wb(e,n,r):i&&wb(e,i,a)}function bb(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=gb(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(_b(e,1))a=n,o=++r;else break}else if(xb(n))break;else{let t=n.nextSibling;for(;t&&_b(t,1);)a=t.parentNode,o=lv(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=gb(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&wb(e,a,o)}function xb(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Sb(e,t){for(;e&&t==e.childNodes.length&&!xv(e);)t=lv(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=0}}function Cb(e,t){for(;e&&!t&&!xv(e);)t=lv(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function wb(e,t,n){if(t.nodeType!=3){let e,r;(r=Sb(t,n))?(t=r,n=0):(e=Cb(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Sv(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&eb(e)},50)}function Tb(e,t){let n=e.state.doc.resolve(t);if(!(Iv||Vv)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function Eb(e,t,n){let r=e.state.selection;if(r instanceof K&&!r.empty||n.indexOf(`s`)>-1||Bv&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=pb(e.state,t);if(n&&n instanceof q)return mb(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof t_?G.near(n,t):G.findFrom(n,t);return o?mb(e,o):!1}return!1}function Db(e,t){if(!(e.state.selection instanceof K))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function Ob(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function kb(e){if(!Rv||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;Ob(e,n,`true`),setTimeout(()=>Ob(e,n,`false`),20)}return!1}function Ab(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function jb(e,t){let n=t.keyCode,r=Ab(t);if(n==8||Bv&&n==72&&r==`c`)return Db(e,-1)||vb(e,-1);if(n==46&&!t.shiftKey||Bv&&n==68&&r==`c`)return Db(e,1)||vb(e,1);if(n==13||n==27)return!0;if(n==37||Bv&&n==66&&r==`c`){let t=n==37?Tb(e,e.state.selection.from)==`ltr`?-1:1:-1;return hb(e,t,r)||vb(e,t)}else if(n==39||Bv&&n==70&&r==`c`){let t=n==39?Tb(e,e.state.selection.from)==`ltr`?1:-1:1;return hb(e,t,r)||vb(e,t)}else if(n==38||Bv&&n==80&&r==`c`)return Eb(e,-1,r)||vb(e,-1);else if(n==40||Bv&&n==78&&r==`c`)return kb(e)||Eb(e,1,r)||vb(e,1);else if(r==(Bv?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function Mb(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||$h.fromSchema(e.state.schema),s=Ub(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=Vb[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
|
|
190
190
|
|
|
191
191
|
`),slice:t}}function Nb(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new W(U.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
192
|
-
`))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=Qh.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=Kb(n),Uv&&qb(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||Vh.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!Pb.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=Jb(Bb(s,+u[1],+u[2]),u[4]);else if(s=W.maxOpen(Fb(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=Bb(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var Pb=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Fb(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&Lb(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=Rb(a[a.length-1],i.length));let n=Ib(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return U.from(a)}return e}function Ib(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,U.from(e));return e}function Lb(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=Lb(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(U.from(Ib(n,e,i+1))))}}function Rb(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,Rb(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(U.empty,!0);return e.copy(n.append(r))}function zb(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=zb(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(U.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function Bb(e,t,n){return t<e.openStart&&(e=new W(zb(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new W(zb(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var Vb={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]},Hb=null;function Ub(){return Hb||=document.implementation.createHTMLDocument(`title`)}var Wb=null;function Gb(e){let t=window.trustedTypes;return t?(Wb||=t.defaultPolicy||t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),Wb.createHTML(e)):e}function Kb(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=Ub().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&Vb[r[1].toLowerCase()])&&(e=i.map(e=>`<`+e+`>`).join(``)+e+i.map(e=>`</`+e+`>`).reverse().join(``)),n.innerHTML=Gb(e),i)for(let e=0;e<i.length;e++)n=n.querySelector(i[e])||n;return n}function qb(e){let t=e.querySelectorAll(Iv?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function Jb(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=U.from(t.create(r[e+1],i)),a++,o++}return new W(i,a,o)}var Yb={},Xb={},Zb={touchstart:!0,touchmove:!0},Qb=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``,button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function $b(e){for(let t in Yb){let n=Yb[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{ix(e,t)&&!rx(e,t)&&(e.editable||!(t.type in Xb))&&n(e,t)},Zb[t]?{passive:!0}:void 0)}Rv&&e.dom.addEventListener(`input`,()=>null),nx(e)}function ex(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function tx(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function nx(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>rx(e,t))})}function rx(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function ix(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function ax(e,t){!rx(e,t)&&Yb[t.type]&&(e.editable||!(t.type in Xb))&&Yb[t.type](e,t)}Xb.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!yx(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Hv&&Iv&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),zv&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,Cv(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||jb(e,n)?n.preventDefault():ex(e,`key`)},Xb.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},Xb.keypress=(e,t)=>{let n=t;if(yx(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Bv&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof K)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function ox(e){return{left:e.clientX,top:e.clientY}}function sx(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function cx(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function lx(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function ux(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&q.isSelectable(r)?(lx(e,new q(n),`pointer`),!0):!1}function dx(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof q&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(q.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(lx(e,q.create(e.state.doc,i),`pointer`),!0)}function fx(e,t,n,r,i){return cx(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?dx(e,n):ux(e,n))}function px(e,t,n,r){return cx(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function mx(e,t,n,r){return cx(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||hx(e,n,r)}function hx(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(lx(e,K.create(r,0,r.content.size),`pointer`),!0):!1;let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),a=i.before(t);if(n.inlineContent)lx(e,K.create(r,a+1,a+1+n.content.size),`pointer`);else if(q.isSelectable(n))lx(e,q.create(r,a),`pointer`);else continue;return!0}}function gx(e){return Ex(e)}var _x=Bv?`metaKey`:`ctrlKey`;Yb.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=gx(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&sx(n,e.input.lastClick)&&!n[_x]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button};let o=e.posAtCoords(ox(n));o&&(a==`singleClick`?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new vx(e,o,n,!!r)):(a==`doubleClick`?px:mx)(e,o.pos,o.inside,n)?n.preventDefault():ex(e,`pointer`))};var vx=class{constructor(e,t,n,r){this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[_x],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.nodeDOM.nodeType==1?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof q&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Pv&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this)),ex(e,`pointer`)}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>eb(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(ox(e))),this.updateAllowDefault(e),this.allowDefault||!t?ex(this.view,`pointer`):fx(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Rv&&this.mightDrag&&!this.mightDrag.node.isAtom||Iv&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(lx(this.view,G.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):ex(this.view,`pointer`)}move(e){this.updateAllowDefault(e),ex(this.view,`pointer`),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};Yb.touchstart=e=>{e.input.lastTouch=Date.now(),gx(e),ex(e,`pointer`)},Yb.touchmove=e=>{e.input.lastTouch=Date.now(),ex(e,`pointer`)},Yb.contextmenu=e=>gx(e);function yx(e,t){return e.composing?!0:Rv&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var bx=Hv?5e3:-1;Xb.compositionstart=Xb.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof K&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||Iv&&Vv&&xx(e)))e.markCursor=e.state.storedMarks||n.marks(),Ex(e,!0),e.markCursor=null;else if(Ex(e,!t.selection.empty),Pv&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}Sx(e,bx)};function xx(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable==`false`}Xb.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,Sx(e,20))};function Sx(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Ex(e),t))}function Cx(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Tx());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function wx(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=vv(t.focusNode,t.focusOffset),r=yv(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function Tx(){let e=document.createEvent(`Event`);return e.initEvent(`event`,!0,!0),e.timeStamp}function Ex(e,t=!1){if(!(Hv&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Cx(e),t||e.docView&&e.docView.dirty){let n=Qy(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function Dx(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var Ox=Mv&&Nv<15||zv&&Wv<604;Yb.copy=Xb.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=Ox?null:n.clipboardData,{dom:o,text:s}=Mb(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):Dx(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function kx(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function Ax(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?jx(e,r.value,null,i,t):jx(e,r.textContent,r.innerHTML,i,t)},50)}function jx(e,t,n,r,i){let a=Nb(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||W.empty)))return!0;if(!a)return!1;let o=kx(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function Mx(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}Xb.paste=(e,t)=>{let n=t;if(e.composing&&!Hv)return;let r=Ox?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&jx(e,Mx(r),r.getData(`text/html`),i,n)?n.preventDefault():Ax(e,n)};var Nx=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},Px=Bv?`altKey`:`ctrlKey`;function Fx(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[Px]:!n}Yb.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(ox(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof q?i.to-1:i.to))){if(r&&r.mightDrag)o=q.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=q.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=Mb(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!Iv||Lv>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Ox?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,Ox||n.dataTransfer.setData(`text/plain`,c),e.dragging=new Nx(l,Fx(e,n),o)},Yb.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},Xb.dragover=Xb.dragenter=(e,t)=>t.preventDefault(),Xb.drop=(e,t)=>{try{Ix(e,t,e.dragging)}finally{e.dragging=null}};function Ix(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(ox(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=Nb(e,Mx(t.dataTransfer),Ox?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&Fx(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||W.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?Pg(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&q.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new q(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(lb(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}Yb.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&eb(e)},20))},Yb.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},Yb.beforeinput=(e,t)=>{if(Iv&&Hv&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,Cv(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in Xb)Yb[e]=Xb[e];function Lx(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var Rx=class e{constructor(e,t){this.toDOM=e,this.spec=t||Ux,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new Vx(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Lx(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},zx=class e{constructor(e,t){this.attrs=e,this.spec=t||Ux}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new Vx(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&Lx(this.attrs,t.attrs)&&Lx(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},Bx=class e{constructor(e,t){this.attrs=e,this.spec=t||Ux}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new Vx(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&Lx(this.attrs,t.attrs)&&Lx(this.spec,t.spec)}destroy(){}},Vx=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new Rx(n,r))}static inline(t,n,r,i){return new e(t,n,new zx(r,i))}static node(t,n,r,i){return new e(t,n,new Bx(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof zx}get widget(){return this.type instanceof Rx}},Hx=[],Ux={},Wx=class e{constructor(e,t){this.local=e.length?e:Hx,this.children=t.length?t:Hx}static create(e,t){return t.length?Qx(t,e,0,Ux):Gx}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==Gx||e.maps.length==0?this:this.mapInner(e,t,0,0,n||Ux)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?qx(this.children,o||[],t,n,r,i,a):o?new e(o.sort($x),Hx):Gx}add(t,n){return n.length?this==Gx?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=Xx(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,Qx(s,e,o+1,Ux)),a+=3}});let o=Jx(a?Zx(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort($x):this.local,i||this.children)}remove(e){return e.length==0||this==Gx?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==Gx?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):Gx}forChild(t,n){if(this==Gx)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof zx){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort($x),Hx);return r?new Kx([t,r]):t}return r||Gx}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return eS(this.localsInner(e))}localsInner(e){if(this==Gx)return Hx;if(e.inlineContent||!this.local.some(zx.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof zx||t.push(this.local[e]);return t}forEachSet(e){e(this)}};Wx.empty=new Wx([],[]),Wx.removeOverlap=eS;var Gx=Wx.empty,Kx=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,Ux));return e.from(r)}forChild(t,n){if(n.isLeaf)return Wx.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=Gx&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}return t?eS(n?t:t.sort($x)):Hx}static from(t){switch(t.length){case 0:return Gx;case 1:return t[0];default:return new e(t.every(e=>e instanceof Wx)?t:t.reduce((e,t)=>e.concat(t instanceof Wx?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function qx(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==Gx?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=Qx(Yx(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new Wx(t.sort($x),s)}function Jx(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new Vx(i.from+t,i.to+t,i.type))}return n}function Yx(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function Xx(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function Zx(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function Qx(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=Xx(e,t,o+n);if(s){a=!0;let e=Qx(s,t,n+o+1,r);e!=Gx&&i.push(o,o+t.nodeSize,e)}});let o=Jx(a?Zx(e):e,-n).sort($x);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new Wx(o,i):Gx}function $x(e,t){return e.from-t.from||e.to-t.to}function eS(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),tS(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),tS(t,i,r.copy(a.from,r.to)));break}}}return t}function tS(e,t,n){for(;t<e.length&&$x(n,e[t])>0;)t++;e.splice(t,0,n)}function nS(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=Gx&&t.push(r)}),e.cursorWrapper&&t.push(Wx.create(e.state.doc,[e.cursorWrapper.deco])),Kx.from(t)}var rS={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},iS=Mv&&Nv<=11,aS=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},oS=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new aS,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);Mv&&Nv<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():Rv&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),iS&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,rS)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(ub(this.view)){if(this.suppressingSelectionUpdates)return eb(this.view);if(Mv&&Nv<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&mv(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=uv(n))t.add(n);for(let r=e.anchorNode;r;r=uv(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&ub(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(Pv&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||fS(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Sv(n)&&(c=Qy(e))&&c.eq(G.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,eb(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),lS(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,pS(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||eb(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),r.nodeType==3&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(Mv&&Nv<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?lv(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?lv(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}},sS=new WeakMap,cS=!1;function lS(e){if(!sS.has(e)&&(sS.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Pv,cS)return;console.warn(`ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.`),cS=!0}}function uS(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return mv(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function dS(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return uS(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?uS(e,n):null}function fS(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function pS(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||e.nodeType!=1||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function mS(e,t,n){let{node:r,fromOffset:i,toOffset:a,from:o,to:s}=e.docView.parseRange(t,n),c=e.domSelectionRange(),l,u=c.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(l=[{node:u,offset:c.anchorOffset}],Sv(c)||l.push({node:c.focusNode,offset:c.focusOffset})),Iv&&e.input.lastKeyCode===8)for(let e=a;e>i;e--){let t=r.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){a=e;break}if(!n||n.size)break}let d=e.state.doc,f=e.someProp(`domParser`)||Vh.fromSchema(e.state.schema),p=d.resolve(o),m=null,h=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace==`pre`?`full`:!0,findPositions:l,ruleFromNode:hS,context:p});if(l&&l[0].pos!=null){let e=l[0].pos,t=l[1]&&l[1].pos;t??=e,m={anchor:e+o,head:t+o}}return{doc:h,sel:m,from:o,to:s}}function hS(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(Rv&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(e.parentNode.lastChild==e||Rv&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName==`IMG`&&e.getAttribute(`mark-placeholder`))return{ignore:!0};return null}var gS=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function _S(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=Qy(e,t);if(n&&!e.state.selection.eq(n)){if(Iv&&Hv&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,Cv(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=mS(e,t,n),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=SS(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(zv&&e.input.lastIOSEnter>Date.now()-225||Hv)&&i.some(e=>e.nodeType==1&&!gS.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,Cv(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof K&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=vS(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof K&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),Mv&&Nv<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((zv&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.pos<l.doc.content.size&&(!h.sameParent(g)||!h.parent.inlineContent)&&h.pos<g.pos&&!/\S/.test(l.doc.textBetween(h.pos,g.pos,``,``)))&&e.someProp(`handleKeyDown`,t=>t(e,Cv(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&bS(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,Cv(8,`Backspace`)))){Hv&&Iv&&e.domObserver.suppressSelectionUpdates();return}Iv&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),Hv&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,Cv(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=vS(e,n.doc,l.sel);t&&!(Iv&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||Mv&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){Mv&&Nv<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>eb(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=yS(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function vS(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:lb(e,t.resolve(n.anchor),t.resolve(n.head))}function yS(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(U.from(l).eq(e))return{mark:s,type:o}}function bS(e,t,n,r,i){if(n-t<=i.pos-r.pos||xS(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(xS(a,!0,!0));return!o.parent.isTextblock||o.pos>n||xS(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function xS(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function SS(e,t,n,r,i){let a=e.findDiffStart(t,n);if(a==null)return null;let{a:o,b:s}=e.findDiffEnd(t,n+e.size,n+t.size);if(i==`end`){let e=Math.max(0,a-Math.min(o,s));r-=o+e-a}if(o<a&&e.size<t.size){let e=r<=a&&r>=o?a-r:0;a-=e,a&&a<t.size&&CS(t.textBetween(a-1,a+1))&&(a+=e?1:-1),s=a+(s-o),o=a}else if(s<a){let t=r<=a&&r>=s?a-r:0;a-=t,a&&a<e.size&&CS(e.textBetween(a-1,a+1))&&(a+=t?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}function CS(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var wS=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Qb,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(jS),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=DS(this),ES(this),this.nodeViews=kS(this),this.docView=My(this.state.doc,TS(this),nS(this),this.dom,this),this.domObserver=new oS(this,(e,t,n,r)=>_S(this,e,t,n,r)),this.domObserver.start(),$b(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&nx(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(jS),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(Cx(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=kS(this);AS(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&nx(this),this.editable=DS(this),ES(this);let o=nS(this),s=TS(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&Yv(this);if(i){this.domObserver.stop();let t=l&&(Mv||Iv)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&OS(n.selection,e.selection);if(l){let n=Iv?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=wx(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=My(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&fb(this))?eb(this,t):(sb(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&Zv(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof q){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Jv(this,t.getBoundingClientRect(),e)}else Jv(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new Nx(e.slice,e.move,r<0?void 0:q.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(Mv){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&ey(this.dom),eb(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return cy(this,e)}coordsAtPos(e,t=1){return fy(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return Sy(this,t||this.state,e)}pasteHTML(e,t){return jx(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return jx(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return Mb(this,e)}destroy(){this.docView&&(tx(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],nS(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,pv())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return ax(this,e)}domSelectionRange(){let e=this.domSelection();return e?Rv&&this.root.nodeType===11&&wv(this.dom.ownerDocument)==this.dom&&dS(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};wS.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function TS(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[Vx.node(0,e.state.doc.content.size,t)]}function ES(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:Vx.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function DS(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function OS(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function kS(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function AS(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function jS(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}var MS=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),NS=typeof navigator<`u`&&/Win/.test(navigator.platform);function PS(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e++){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))MS?o=!0:i=!0;else throw Error(`Unrecognized modifier name: `+n)}return r&&(n=`Alt-`+n),i&&(n=`Ctrl-`+n),o&&(n=`Meta-`+n),a&&(n=`Shift-`+n),n}function FS(e){let t=Object.create(null);for(let n in e)t[PS(n)]=e[n];return t}function IS(e,t,n=!0){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n&&t.shiftKey&&(e=`Shift-`+e),e}function LS(e){return new h_({props:{handleKeyDown:RS(e)}})}function RS(e){let t=FS(e);return function(e,n){let r=Ee(n),i,a=t[IS(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[IS(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(NS&&n.ctrlKey&&n.altKey)&&(i=De[n.keyCode])&&i!=r){let r=t[IS(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var zS=Object.defineProperty,BS=(e,t)=>{for(var n in t)zS(e,n,{get:t[n],enumerable:!0})};function VS(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var HS=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:VS({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},US={};BS(US,{blur:()=>WS,clearContent:()=>GS,clearNodes:()=>KS,command:()=>qS,createParagraphNear:()=>JS,cut:()=>YS,deleteCurrentNode:()=>XS,deleteNode:()=>QS,deleteRange:()=>$S,deleteSelection:()=>eC,enter:()=>tC,exitCode:()=>nC,extendMarkRange:()=>lC,first:()=>uC,focus:()=>_C,forEach:()=>vC,insertContent:()=>yC,insertContentAt:()=>TC,joinBackward:()=>OC,joinDown:()=>DC,joinForward:()=>kC,joinItemBackward:()=>AC,joinItemForward:()=>jC,joinTextblockBackward:()=>MC,joinTextblockForward:()=>NC,joinUp:()=>EC,keyboardShortcut:()=>IC,lift:()=>RC,liftEmptyBlock:()=>zC,liftListItem:()=>BC,newlineInCode:()=>VC,resetAttributes:()=>WC,scrollIntoView:()=>GC,selectAll:()=>KC,selectNodeBackward:()=>qC,selectNodeForward:()=>JC,selectParentNode:()=>YC,selectTextblockEnd:()=>XC,selectTextblockStart:()=>ZC,setContent:()=>$C,setMark:()=>$w,setMeta:()=>eT,setNode:()=>tT,setNodeSelection:()=>nT,setTextDirection:()=>rT,setTextSelection:()=>iT,sinkListItem:()=>aT,splitBlock:()=>sT,splitListItem:()=>cT,toggleList:()=>fT,toggleMark:()=>pT,toggleNode:()=>mT,toggleWrap:()=>hT,undoInputRule:()=>gT,unsetAllMarks:()=>_T,unsetMark:()=>vT,unsetTextDirection:()=>yT,updateAttributes:()=>bT,wrapIn:()=>xT,wrapInList:()=>ST});var WS=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),GS=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),KS=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=Tg(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},qS=e=>t=>e(t),JS=()=>({state:e,dispatch:t})=>R_(e,t),YS=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new K(r.doc.resolve(Math.max(o-1,0)))),!0},XS=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function ZS(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var QS=e=>({tr:t,state:n,dispatch:r})=>{let i=ZS(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},$S=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},eC=()=>({state:e,dispatch:t})=>y_(e,t),tC=()=>({commands:e})=>e.keyboardShortcut(`Enter`),nC=()=>({state:e,dispatch:t})=>L_(e,t);function rC(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function iC(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:rC(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function aC(e,t,n={}){return e.find(e=>e.type===t&&iC(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function oC(e,t,n={}){return!!aC(e,t,n)}function sC(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!aC([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&oC([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&oC([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function cC(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var lC=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=cC(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=sC(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=K.create(o,e.from,e.to);n.setSelection(t)}}return!0},uC=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function dC(e){return e instanceof K}function fC(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function pC(e,t=null){if(!t)return null;let n=G.atStart(e),r=G.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?K.create(e,fC(0,i,a),fC(e.content.size,i,a)):K.create(e,fC(t,i,a),fC(t,i,a))}function mC(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function hC(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function gC(){return typeof navigator<`u`?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var _C=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(hC()||mC())&&r.dom.focus(),gC()&&!hC()&&!mC()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!dC(n.state.selection))return o(),!0;let s=pC(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},vC=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),yC=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),bC=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&bC(r)}return e};function xC(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return bC(n)}function SC(e,t,n){if(e instanceof mh||e instanceof U)return e;n={slice:!0,parseOptions:{},...n};let r=typeof e==`object`&&!!e,i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return U.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),SC(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new zh({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?Vh.fromSchema(a).parseSlice(xC(e),n.parseOptions):Vh.fromSchema(a).parse(xC(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=Vh.fromSchema(t);return n.slice?r.parseSlice(xC(e),n.parseOptions).content:r.parse(xC(e),n.parseOptions)}return SC(``,t,n)}function CC(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof xg||i instanceof Sg))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(G.near(e.doc.resolve(o),n))}var wC=e=>!(`type`in e),TC=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{SC(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=SC(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0;if((wC(i)?i:[i]).forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let f;if(u){if(Array.isArray(t))f=t.map(e=>e.text||``).join(``);else if(t instanceof U){let e=``;t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f=typeof t==`object`&&t&&t.text?t.text:t;r.insertText(f,c,l)}else{f=i;let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,a=t.isText||t.isTextblock,o=t.content.size>0;n&&a&&o&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&CC(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:f}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:f})}return!0},EC=()=>({state:e,dispatch:t})=>M_(e,t),DC=()=>({state:e,dispatch:t})=>N_(e,t),OC=()=>({state:e,dispatch:t})=>x_(e,t),kC=()=>({state:e,dispatch:t})=>k_(e,t),AC=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Ng(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},jC=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Ng(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},MC=()=>({state:e,dispatch:t})=>S_(e,t),NC=()=>({state:e,dispatch:t})=>C_(e,t);function PC(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function FC(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))hC()||PC()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var IC=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=FC(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function LC(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?ZS(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>o?o.name===e.node.type.name:!0).filter(e=>iC(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var RC=(e,t={})=>({state:n,dispatch:r})=>LC(n,ZS(e,n.schema),t)?P_(n,r):!1,zC=()=>({state:e,dispatch:t})=>z_(e,t),BC=e=>({state:t,dispatch:n})=>av(ZS(e,t.schema))(t,n),VC=()=>({state:e,dispatch:t})=>F_(e,t);function HC(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function UC(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var WC=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=HC(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=ZS(e,r.schema)),s===`mark`&&(o=cC(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,UC(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(UC(a.attrs,t))))})})}),c},GC=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),KC=()=>({tr:e,dispatch:t})=>{if(t){let t=new t_(e.doc);e.setSelection(t)}return!0},qC=()=>({state:e,dispatch:t})=>E_(e,t),JC=()=>({state:e,dispatch:t})=>A_(e,t),YC=()=>({state:e,dispatch:t})=>H_(e,t),XC=()=>({state:e,dispatch:t})=>J_(e,t),ZC=()=>({state:e,dispatch:t})=>q_(e,t);function QC(e,t,n={},r={}){return SC(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var $C=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=QC(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});return o&&a.replaceWith(0,c.content.size,s).setMeta(`preventUpdate`,!n),!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function ew(e,t){let n=cC(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function tw(e,t){let n=new Jg(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function nw(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function rw(e,t){let n=[];return e.descendants((e,r)=>{t(e)&&n.push({node:e,pos:r})}),n}function iw(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function aw(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function ow(e){return t=>aw(t.$from,e)}function J(e,t,n){return e.config[t]===void 0&&e.parent?J(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?J(e.parent,t,n):null}):e.config[t]}function sw(e){return e.map(e=>{let t=J(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...sw(t())]:e}).flat(10)}function cw(e,t){let n=Qh.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function lw(e){return typeof e==`function`}function uw(e,t=void 0,...n){return lw(e)?t?e.bind(t)(...n):e(...n):e}function dw(e={}){return Object.keys(e).length===0&&e.constructor===Object}function fw(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function pw(e){let t=[],{nodeExtensions:n,markExtensions:r}=fw(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=J(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=J(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function mw(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i){r=!r,n+=o;continue}if(o===`"`&&!r){i=!i,n+=o;continue}if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}return n&&t.push(n),t}function hw(e){let t=[],n=mw(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function gw(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...hw(n[e]),...hw(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function _w(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>gw(e,t),{})}function vw(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function yw(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):vw(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function bw(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&dw(t)?!1:t!=null))}function xw(e){let t={};return!e?.attribute?.isRequired&&`default`in(e?.attribute||{})&&(t.default=e.attribute.default),e?.attribute?.validate!==void 0&&(t.validate=e.attribute.validate),[e.name,t]}function Sw(e,t){let n=pw(e),{nodeExtensions:r,markExtensions:i}=fw(e);return new zh({topNode:r.find(e=>J(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=bw({...e.reduce((e,t)=>{let n=J(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:uw(J(r,`content`,a)),marks:uw(J(r,`marks`,a)),group:uw(J(r,`group`,a)),inline:uw(J(r,`inline`,a)),atom:uw(J(r,`atom`,a)),selectable:uw(J(r,`selectable`,a)),draggable:uw(J(r,`draggable`,a)),code:uw(J(r,`code`,a)),whitespace:uw(J(r,`whitespace`,a)),linebreakReplacement:uw(J(r,`linebreakReplacement`,a)),defining:uw(J(r,`defining`,a)),isolating:uw(J(r,`isolating`,a)),attrs:Object.fromEntries(i.map(xw))}),s=uw(J(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>yw(e,i)));let c=J(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:_w(e,i)}));let l=J(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=bw({...e.reduce((e,t)=>{let n=J(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:uw(J(r,`inclusive`,a)),excludes:uw(J(r,`excludes`,a)),group:uw(J(r,`group`,a)),spanning:uw(J(r,`spanning`,a)),code:uw(J(r,`code`,a)),attrs:Object.fromEntries(i.map(xw))}),s=uw(J(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>yw(e,i)));let c=J(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:_w(e,i)})),[r.name,o]}))})}function Cw(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function ww(e){return e.sort((e,t)=>{let n=J(e,`priority`)||100,r=J(t,`priority`)||100;return n>r?-1:+(n<r)})}function Tw(e){let t=ww(sw(e)),n=Cw(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function Ew(e,t){return Sw(Tw(e),t)}function Dw(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
|
|
192
|
+
`))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=$h.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=Kb(n),Uv&&qb(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||Hh.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!Pb.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=Jb(Bb(s,+u[1],+u[2]),u[4]);else if(s=W.maxOpen(Fb(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=Bb(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var Pb=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Fb(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&Lb(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=Rb(a[a.length-1],i.length));let n=Ib(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return U.from(a)}return e}function Ib(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,U.from(e));return e}function Lb(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=Lb(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(U.from(Ib(n,e,i+1))))}}function Rb(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,Rb(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(U.empty,!0);return e.copy(n.append(r))}function zb(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=zb(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(U.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function Bb(e,t,n){return t<e.openStart&&(e=new W(zb(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new W(zb(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var Vb={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]},Hb=null;function Ub(){return Hb||=document.implementation.createHTMLDocument(`title`)}var Wb=null;function Gb(e){let t=window.trustedTypes;return t?(Wb||=t.defaultPolicy||t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),Wb.createHTML(e)):e}function Kb(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=Ub().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&Vb[r[1].toLowerCase()])&&(e=i.map(e=>`<`+e+`>`).join(``)+e+i.map(e=>`</`+e+`>`).reverse().join(``)),n.innerHTML=Gb(e),i)for(let e=0;e<i.length;e++)n=n.querySelector(i[e])||n;return n}function qb(e){let t=e.querySelectorAll(Iv?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function Jb(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=U.from(t.create(r[e+1],i)),a++,o++}return new W(i,a,o)}var Yb={},Xb={},Zb={touchstart:!0,touchmove:!0},Qb=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``,button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function $b(e){for(let t in Yb){let n=Yb[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{ix(e,t)&&!rx(e,t)&&(e.editable||!(t.type in Xb))&&n(e,t)},Zb[t]?{passive:!0}:void 0)}Rv&&e.dom.addEventListener(`input`,()=>null),nx(e)}function ex(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function tx(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function nx(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>rx(e,t))})}function rx(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function ix(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function ax(e,t){!rx(e,t)&&Yb[t.type]&&(e.editable||!(t.type in Xb))&&Yb[t.type](e,t)}Xb.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!yx(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Hv&&Iv&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),zv&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,Cv(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||jb(e,n)?n.preventDefault():ex(e,`key`)},Xb.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},Xb.keypress=(e,t)=>{let n=t;if(yx(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Bv&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof K)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function ox(e){return{left:e.clientX,top:e.clientY}}function sx(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function cx(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function lx(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function ux(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&q.isSelectable(r)?(lx(e,new q(n),`pointer`),!0):!1}function dx(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof q&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(q.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(lx(e,q.create(e.state.doc,i),`pointer`),!0)}function fx(e,t,n,r,i){return cx(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?dx(e,n):ux(e,n))}function px(e,t,n,r){return cx(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function mx(e,t,n,r){return cx(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||hx(e,n,r)}function hx(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(lx(e,K.create(r,0,r.content.size),`pointer`),!0):!1;let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),a=i.before(t);if(n.inlineContent)lx(e,K.create(r,a+1,a+1+n.content.size),`pointer`);else if(q.isSelectable(n))lx(e,q.create(r,a),`pointer`);else continue;return!0}}function gx(e){return Ex(e)}var _x=Bv?`metaKey`:`ctrlKey`;Yb.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=gx(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&sx(n,e.input.lastClick)&&!n[_x]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button};let o=e.posAtCoords(ox(n));o&&(a==`singleClick`?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new vx(e,o,n,!!r)):(a==`doubleClick`?px:mx)(e,o.pos,o.inside,n)?n.preventDefault():ex(e,`pointer`))};var vx=class{constructor(e,t,n,r){this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[_x],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.nodeDOM.nodeType==1?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof q&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Pv&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this)),ex(e,`pointer`)}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>eb(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(ox(e))),this.updateAllowDefault(e),this.allowDefault||!t?ex(this.view,`pointer`):fx(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Rv&&this.mightDrag&&!this.mightDrag.node.isAtom||Iv&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(lx(this.view,G.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):ex(this.view,`pointer`)}move(e){this.updateAllowDefault(e),ex(this.view,`pointer`),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};Yb.touchstart=e=>{e.input.lastTouch=Date.now(),gx(e),ex(e,`pointer`)},Yb.touchmove=e=>{e.input.lastTouch=Date.now(),ex(e,`pointer`)},Yb.contextmenu=e=>gx(e);function yx(e,t){return e.composing?!0:Rv&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var bx=Hv?5e3:-1;Xb.compositionstart=Xb.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof K&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||Iv&&Vv&&xx(e)))e.markCursor=e.state.storedMarks||n.marks(),Ex(e,!0),e.markCursor=null;else if(Ex(e,!t.selection.empty),Pv&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}Sx(e,bx)};function xx(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable==`false`}Xb.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,Sx(e,20))};function Sx(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Ex(e),t))}function Cx(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Tx());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function wx(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=vv(t.focusNode,t.focusOffset),r=yv(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function Tx(){let e=document.createEvent(`Event`);return e.initEvent(`event`,!0,!0),e.timeStamp}function Ex(e,t=!1){if(!(Hv&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Cx(e),t||e.docView&&e.docView.dirty){let n=Qy(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function Dx(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var Ox=Mv&&Nv<15||zv&&Wv<604;Yb.copy=Xb.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=Ox?null:n.clipboardData,{dom:o,text:s}=Mb(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):Dx(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function kx(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function Ax(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?jx(e,r.value,null,i,t):jx(e,r.textContent,r.innerHTML,i,t)},50)}function jx(e,t,n,r,i){let a=Nb(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||W.empty)))return!0;if(!a)return!1;let o=kx(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function Mx(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}Xb.paste=(e,t)=>{let n=t;if(e.composing&&!Hv)return;let r=Ox?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&jx(e,Mx(r),r.getData(`text/html`),i,n)?n.preventDefault():Ax(e,n)};var Nx=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},Px=Bv?`altKey`:`ctrlKey`;function Fx(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[Px]:!n}Yb.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(ox(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof q?i.to-1:i.to))){if(r&&r.mightDrag)o=q.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=q.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=Mb(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!Iv||Lv>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Ox?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,Ox||n.dataTransfer.setData(`text/plain`,c),e.dragging=new Nx(l,Fx(e,n),o)},Yb.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},Xb.dragover=Xb.dragenter=(e,t)=>t.preventDefault(),Xb.drop=(e,t)=>{try{Ix(e,t,e.dragging)}finally{e.dragging=null}};function Ix(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(ox(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=Nb(e,Mx(t.dataTransfer),Ox?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&Fx(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||W.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?Fg(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&q.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new q(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(lb(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}Yb.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&eb(e)},20))},Yb.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},Yb.beforeinput=(e,t)=>{if(Iv&&Hv&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,Cv(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in Xb)Yb[e]=Xb[e];function Lx(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var Rx=class e{constructor(e,t){this.toDOM=e,this.spec=t||Ux,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new Vx(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Lx(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},zx=class e{constructor(e,t){this.attrs=e,this.spec=t||Ux}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new Vx(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&Lx(this.attrs,t.attrs)&&Lx(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},Bx=class e{constructor(e,t){this.attrs=e,this.spec=t||Ux}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new Vx(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&Lx(this.attrs,t.attrs)&&Lx(this.spec,t.spec)}destroy(){}},Vx=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new Rx(n,r))}static inline(t,n,r,i){return new e(t,n,new zx(r,i))}static node(t,n,r,i){return new e(t,n,new Bx(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof zx}get widget(){return this.type instanceof Rx}},Hx=[],Ux={},Wx=class e{constructor(e,t){this.local=e.length?e:Hx,this.children=t.length?t:Hx}static create(e,t){return t.length?Qx(t,e,0,Ux):Gx}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==Gx||e.maps.length==0?this:this.mapInner(e,t,0,0,n||Ux)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?qx(this.children,o||[],t,n,r,i,a):o?new e(o.sort($x),Hx):Gx}add(t,n){return n.length?this==Gx?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=Xx(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,Qx(s,e,o+1,Ux)),a+=3}});let o=Jx(a?Zx(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort($x):this.local,i||this.children)}remove(e){return e.length==0||this==Gx?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==Gx?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):Gx}forChild(t,n){if(this==Gx)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof zx){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort($x),Hx);return r?new Kx([t,r]):t}return r||Gx}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return eS(this.localsInner(e))}localsInner(e){if(this==Gx)return Hx;if(e.inlineContent||!this.local.some(zx.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof zx||t.push(this.local[e]);return t}forEachSet(e){e(this)}};Wx.empty=new Wx([],[]),Wx.removeOverlap=eS;var Gx=Wx.empty,Kx=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,Ux));return e.from(r)}forChild(t,n){if(n.isLeaf)return Wx.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=Gx&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}return t?eS(n?t:t.sort($x)):Hx}static from(t){switch(t.length){case 0:return Gx;case 1:return t[0];default:return new e(t.every(e=>e instanceof Wx)?t:t.reduce((e,t)=>e.concat(t instanceof Wx?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function qx(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==Gx?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=Qx(Yx(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new Wx(t.sort($x),s)}function Jx(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new Vx(i.from+t,i.to+t,i.type))}return n}function Yx(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function Xx(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function Zx(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function Qx(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=Xx(e,t,o+n);if(s){a=!0;let e=Qx(s,t,n+o+1,r);e!=Gx&&i.push(o,o+t.nodeSize,e)}});let o=Jx(a?Zx(e):e,-n).sort($x);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new Wx(o,i):Gx}function $x(e,t){return e.from-t.from||e.to-t.to}function eS(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),tS(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),tS(t,i,r.copy(a.from,r.to)));break}}}return t}function tS(e,t,n){for(;t<e.length&&$x(n,e[t])>0;)t++;e.splice(t,0,n)}function nS(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=Gx&&t.push(r)}),e.cursorWrapper&&t.push(Wx.create(e.state.doc,[e.cursorWrapper.deco])),Kx.from(t)}var rS={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},iS=Mv&&Nv<=11,aS=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},oS=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new aS,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);Mv&&Nv<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():Rv&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),iS&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,rS)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(ub(this.view)){if(this.suppressingSelectionUpdates)return eb(this.view);if(Mv&&Nv<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&mv(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=uv(n))t.add(n);for(let r=e.anchorNode;r;r=uv(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&ub(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(Pv&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||fS(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Sv(n)&&(c=Qy(e))&&c.eq(G.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,eb(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),lS(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,pS(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||eb(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),r.nodeType==3&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(Mv&&Nv<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?lv(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?lv(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}},sS=new WeakMap,cS=!1;function lS(e){if(!sS.has(e)&&(sS.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Pv,cS)return;console.warn(`ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.`),cS=!0}}function uS(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return mv(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function dS(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return uS(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?uS(e,n):null}function fS(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function pS(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||e.nodeType!=1||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function mS(e,t,n){let{node:r,fromOffset:i,toOffset:a,from:o,to:s}=e.docView.parseRange(t,n),c=e.domSelectionRange(),l,u=c.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(l=[{node:u,offset:c.anchorOffset}],Sv(c)||l.push({node:c.focusNode,offset:c.focusOffset})),Iv&&e.input.lastKeyCode===8)for(let e=a;e>i;e--){let t=r.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){a=e;break}if(!n||n.size)break}let d=e.state.doc,f=e.someProp(`domParser`)||Hh.fromSchema(e.state.schema),p=d.resolve(o),m=null,h=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace==`pre`?`full`:!0,findPositions:l,ruleFromNode:hS,context:p});if(l&&l[0].pos!=null){let e=l[0].pos,t=l[1]&&l[1].pos;t??=e,m={anchor:e+o,head:t+o}}return{doc:h,sel:m,from:o,to:s}}function hS(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(Rv&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(e.parentNode.lastChild==e||Rv&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName==`IMG`&&e.getAttribute(`mark-placeholder`))return{ignore:!0};return null}var gS=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function _S(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=Qy(e,t);if(n&&!e.state.selection.eq(n)){if(Iv&&Hv&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,Cv(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=mS(e,t,n),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=SS(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(zv&&e.input.lastIOSEnter>Date.now()-225||Hv)&&i.some(e=>e.nodeType==1&&!gS.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,Cv(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof K&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=vS(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof K&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),Mv&&Nv<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((zv&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.pos<l.doc.content.size&&(!h.sameParent(g)||!h.parent.inlineContent)&&h.pos<g.pos&&!/\S/.test(l.doc.textBetween(h.pos,g.pos,``,``)))&&e.someProp(`handleKeyDown`,t=>t(e,Cv(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&bS(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,Cv(8,`Backspace`)))){Hv&&Iv&&e.domObserver.suppressSelectionUpdates();return}Iv&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),Hv&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,Cv(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=vS(e,n.doc,l.sel);t&&!(Iv&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||Mv&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){Mv&&Nv<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>eb(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=yS(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function vS(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:lb(e,t.resolve(n.anchor),t.resolve(n.head))}function yS(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(U.from(l).eq(e))return{mark:s,type:o}}function bS(e,t,n,r,i){if(n-t<=i.pos-r.pos||xS(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(xS(a,!0,!0));return!o.parent.isTextblock||o.pos>n||xS(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function xS(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function SS(e,t,n,r,i){let a=e.findDiffStart(t,n);if(a==null)return null;let{a:o,b:s}=e.findDiffEnd(t,n+e.size,n+t.size);if(i==`end`){let e=Math.max(0,a-Math.min(o,s));r-=o+e-a}if(o<a&&e.size<t.size){let e=r<=a&&r>=o?a-r:0;a-=e,a&&a<t.size&&CS(t.textBetween(a-1,a+1))&&(a+=e?1:-1),s=a+(s-o),o=a}else if(s<a){let t=r<=a&&r>=s?a-r:0;a-=t,a&&a<e.size&&CS(e.textBetween(a-1,a+1))&&(a+=t?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}function CS(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var wS=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Qb,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(jS),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=DS(this),ES(this),this.nodeViews=kS(this),this.docView=My(this.state.doc,TS(this),nS(this),this.dom,this),this.domObserver=new oS(this,(e,t,n,r)=>_S(this,e,t,n,r)),this.domObserver.start(),$b(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&nx(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(jS),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(Cx(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=kS(this);AS(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&nx(this),this.editable=DS(this),ES(this);let o=nS(this),s=TS(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&Yv(this);if(i){this.domObserver.stop();let t=l&&(Mv||Iv)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&OS(n.selection,e.selection);if(l){let n=Iv?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=wx(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=My(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&fb(this))?eb(this,t):(sb(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&Zv(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof q){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Jv(this,t.getBoundingClientRect(),e)}else Jv(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new Nx(e.slice,e.move,r<0?void 0:q.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(Mv){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&ey(this.dom),eb(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return cy(this,e)}coordsAtPos(e,t=1){return fy(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return Sy(this,t||this.state,e)}pasteHTML(e,t){return jx(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return jx(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return Mb(this,e)}destroy(){this.docView&&(tx(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],nS(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,pv())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return ax(this,e)}domSelectionRange(){let e=this.domSelection();return e?Rv&&this.root.nodeType===11&&wv(this.dom.ownerDocument)==this.dom&&dS(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};wS.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function TS(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[Vx.node(0,e.state.doc.content.size,t)]}function ES(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:Vx.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function DS(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function OS(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function kS(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function AS(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function jS(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}var MS=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),NS=typeof navigator<`u`&&/Win/.test(navigator.platform);function PS(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e++){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))MS?o=!0:i=!0;else throw Error(`Unrecognized modifier name: `+n)}return r&&(n=`Alt-`+n),i&&(n=`Ctrl-`+n),o&&(n=`Meta-`+n),a&&(n=`Shift-`+n),n}function FS(e){let t=Object.create(null);for(let n in e)t[PS(n)]=e[n];return t}function IS(e,t,n=!0){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n&&t.shiftKey&&(e=`Shift-`+e),e}function LS(e){return new h_({props:{handleKeyDown:RS(e)}})}function RS(e){let t=FS(e);return function(e,n){let r=Ee(n),i,a=t[IS(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[IS(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(NS&&n.ctrlKey&&n.altKey)&&(i=De[n.keyCode])&&i!=r){let r=t[IS(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var zS=Object.defineProperty,BS=(e,t)=>{for(var n in t)zS(e,n,{get:t[n],enumerable:!0})};function VS(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var HS=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:VS({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},US={};BS(US,{blur:()=>WS,clearContent:()=>GS,clearNodes:()=>KS,command:()=>qS,createParagraphNear:()=>JS,cut:()=>YS,deleteCurrentNode:()=>XS,deleteNode:()=>QS,deleteRange:()=>$S,deleteSelection:()=>eC,enter:()=>tC,exitCode:()=>nC,extendMarkRange:()=>lC,first:()=>uC,focus:()=>_C,forEach:()=>vC,insertContent:()=>yC,insertContentAt:()=>TC,joinBackward:()=>OC,joinDown:()=>DC,joinForward:()=>kC,joinItemBackward:()=>AC,joinItemForward:()=>jC,joinTextblockBackward:()=>MC,joinTextblockForward:()=>NC,joinUp:()=>EC,keyboardShortcut:()=>IC,lift:()=>RC,liftEmptyBlock:()=>zC,liftListItem:()=>BC,newlineInCode:()=>VC,resetAttributes:()=>WC,scrollIntoView:()=>GC,selectAll:()=>KC,selectNodeBackward:()=>qC,selectNodeForward:()=>JC,selectParentNode:()=>YC,selectTextblockEnd:()=>XC,selectTextblockStart:()=>ZC,setContent:()=>$C,setMark:()=>$w,setMeta:()=>eT,setNode:()=>tT,setNodeSelection:()=>nT,setTextDirection:()=>rT,setTextSelection:()=>iT,sinkListItem:()=>aT,splitBlock:()=>sT,splitListItem:()=>cT,toggleList:()=>fT,toggleMark:()=>pT,toggleNode:()=>mT,toggleWrap:()=>hT,undoInputRule:()=>gT,unsetAllMarks:()=>_T,unsetMark:()=>vT,unsetTextDirection:()=>yT,updateAttributes:()=>bT,wrapIn:()=>xT,wrapInList:()=>ST});var WS=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),GS=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),KS=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=Eg(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},qS=e=>t=>e(t),JS=()=>({state:e,dispatch:t})=>R_(e,t),YS=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new K(r.doc.resolve(Math.max(o-1,0)))),!0},XS=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function ZS(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var QS=e=>({tr:t,state:n,dispatch:r})=>{let i=ZS(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},$S=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},eC=()=>({state:e,dispatch:t})=>y_(e,t),tC=()=>({commands:e})=>e.keyboardShortcut(`Enter`),nC=()=>({state:e,dispatch:t})=>L_(e,t);function rC(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function iC(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:rC(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function aC(e,t,n={}){return e.find(e=>e.type===t&&iC(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function oC(e,t,n={}){return!!aC(e,t,n)}function sC(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!aC([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&oC([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&oC([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function cC(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var lC=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=cC(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=sC(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=K.create(o,e.from,e.to);n.setSelection(t)}}return!0},uC=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function dC(e){return e instanceof K}function fC(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function pC(e,t=null){if(!t)return null;let n=G.atStart(e),r=G.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?K.create(e,fC(0,i,a),fC(e.content.size,i,a)):K.create(e,fC(t,i,a),fC(t,i,a))}function mC(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function hC(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function gC(){return typeof navigator<`u`?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var _C=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(hC()||mC())&&r.dom.focus(),gC()&&!hC()&&!mC()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!dC(n.state.selection))return o(),!0;let s=pC(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},vC=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),yC=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),bC=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&bC(r)}return e};function xC(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return bC(n)}function SC(e,t,n){if(e instanceof hh||e instanceof U)return e;n={slice:!0,parseOptions:{},...n};let r=typeof e==`object`&&!!e,i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return U.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),SC(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new Bh({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?Hh.fromSchema(a).parseSlice(xC(e),n.parseOptions):Hh.fromSchema(a).parse(xC(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=Hh.fromSchema(t);return n.slice?r.parseSlice(xC(e),n.parseOptions).content:r.parse(xC(e),n.parseOptions)}return SC(``,t,n)}function CC(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Sg||i instanceof Cg))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(G.near(e.doc.resolve(o),n))}var wC=e=>!(`type`in e),TC=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{SC(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=SC(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0;if((wC(i)?i:[i]).forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let f;if(u){if(Array.isArray(t))f=t.map(e=>e.text||``).join(``);else if(t instanceof U){let e=``;t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f=typeof t==`object`&&t&&t.text?t.text:t;r.insertText(f,c,l)}else{f=i;let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,a=t.isText||t.isTextblock,o=t.content.size>0;n&&a&&o&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&CC(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:f}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:f})}return!0},EC=()=>({state:e,dispatch:t})=>M_(e,t),DC=()=>({state:e,dispatch:t})=>N_(e,t),OC=()=>({state:e,dispatch:t})=>x_(e,t),kC=()=>({state:e,dispatch:t})=>k_(e,t),AC=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Pg(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},jC=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Pg(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},MC=()=>({state:e,dispatch:t})=>S_(e,t),NC=()=>({state:e,dispatch:t})=>C_(e,t);function PC(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function FC(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))hC()||PC()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var IC=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=FC(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function LC(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?ZS(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>o?o.name===e.node.type.name:!0).filter(e=>iC(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var RC=(e,t={})=>({state:n,dispatch:r})=>LC(n,ZS(e,n.schema),t)?P_(n,r):!1,zC=()=>({state:e,dispatch:t})=>z_(e,t),BC=e=>({state:t,dispatch:n})=>av(ZS(e,t.schema))(t,n),VC=()=>({state:e,dispatch:t})=>F_(e,t);function HC(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function UC(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var WC=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=HC(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=ZS(e,r.schema)),s===`mark`&&(o=cC(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,UC(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(UC(a.attrs,t))))})})}),c},GC=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),KC=()=>({tr:e,dispatch:t})=>{if(t){let t=new t_(e.doc);e.setSelection(t)}return!0},qC=()=>({state:e,dispatch:t})=>E_(e,t),JC=()=>({state:e,dispatch:t})=>A_(e,t),YC=()=>({state:e,dispatch:t})=>H_(e,t),XC=()=>({state:e,dispatch:t})=>J_(e,t),ZC=()=>({state:e,dispatch:t})=>q_(e,t);function QC(e,t,n={},r={}){return SC(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var $C=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=QC(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});return o&&a.replaceWith(0,c.content.size,s).setMeta(`preventUpdate`,!n),!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function ew(e,t){let n=cC(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function tw(e,t){let n=new Jg(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function nw(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function rw(e,t){let n=[];return e.descendants((e,r)=>{t(e)&&n.push({node:e,pos:r})}),n}function iw(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function aw(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function ow(e){return t=>aw(t.$from,e)}function J(e,t,n){return e.config[t]===void 0&&e.parent?J(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?J(e.parent,t,n):null}):e.config[t]}function sw(e){return e.map(e=>{let t=J(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...sw(t())]:e}).flat(10)}function cw(e,t){let n=$h.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function lw(e){return typeof e==`function`}function uw(e,t=void 0,...n){return lw(e)?t?e.bind(t)(...n):e(...n):e}function dw(e={}){return Object.keys(e).length===0&&e.constructor===Object}function fw(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function pw(e){let t=[],{nodeExtensions:n,markExtensions:r}=fw(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=J(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=J(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function mw(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i){r=!r,n+=o;continue}if(o===`"`&&!r){i=!i,n+=o;continue}if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}return n&&t.push(n),t}function hw(e){let t=[],n=mw(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function gw(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...hw(n[e]),...hw(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function _w(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>gw(e,t),{})}function vw(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function yw(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):vw(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function bw(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&dw(t)?!1:t!=null))}function xw(e){let t={};return!e?.attribute?.isRequired&&`default`in(e?.attribute||{})&&(t.default=e.attribute.default),e?.attribute?.validate!==void 0&&(t.validate=e.attribute.validate),[e.name,t]}function Sw(e,t){let n=pw(e),{nodeExtensions:r,markExtensions:i}=fw(e);return new Bh({topNode:r.find(e=>J(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=bw({...e.reduce((e,t)=>{let n=J(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:uw(J(r,`content`,a)),marks:uw(J(r,`marks`,a)),group:uw(J(r,`group`,a)),inline:uw(J(r,`inline`,a)),atom:uw(J(r,`atom`,a)),selectable:uw(J(r,`selectable`,a)),draggable:uw(J(r,`draggable`,a)),code:uw(J(r,`code`,a)),whitespace:uw(J(r,`whitespace`,a)),linebreakReplacement:uw(J(r,`linebreakReplacement`,a)),defining:uw(J(r,`defining`,a)),isolating:uw(J(r,`isolating`,a)),attrs:Object.fromEntries(i.map(xw))}),s=uw(J(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>yw(e,i)));let c=J(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:_w(e,i)}));let l=J(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=bw({...e.reduce((e,t)=>{let n=J(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:uw(J(r,`inclusive`,a)),excludes:uw(J(r,`excludes`,a)),group:uw(J(r,`group`,a)),spanning:uw(J(r,`spanning`,a)),code:uw(J(r,`code`,a)),attrs:Object.fromEntries(i.map(xw))}),s=uw(J(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>yw(e,i)));let c=J(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:_w(e,i)})),[r.name,o]}))})}function Cw(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function ww(e){return e.sort((e,t)=>{let n=J(e,`priority`)||100,r=J(t,`priority`)||100;return n>r?-1:+(n<r)})}function Tw(e){let t=ww(sw(e)),n=Cw(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function Ew(e,t){return Sw(Tw(e),t)}function Dw(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
|
|
193
193
|
|
|
194
|
-
`,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;e.isText&&(s+=(e?.text)?.slice(Math.max(r,n)-n,i-n))}),s}function Ow(e,t){return Dw(e,{from:0,to:e.content.size},t)}function kw(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Aw(e,t){let n=ZS(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function jw(e,t){let n=HC(typeof t==`string`?t:t.name,e.schema);return n===`node`?Aw(e,t):n===`mark`?ew(e,t):{}}function Mw(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function Nw(e){let t=Mw(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function Pw(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),Nw(r)}function Fw(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=sC(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||e?.nodeSize===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var Iw=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]};function Lw(e,t){return t.nodes[e]||t.marks[e]||null}function Rw(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var zw=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function Bw(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?cC(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>iC(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>a?a.name===e.mark.type.name:!0).filter(e=>iC(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>a?e.mark.type!==a&&e.mark.type.excludes(a):!0).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function Vw(e,t,n={}){if(!t)return LC(e,null,n)||Bw(e,null,n);let r=HC(t,e.schema);return r===`node`?LC(e,t,n):r===`mark`?Bw(e,t,n):!1}var Hw=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=ow(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Uw=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function Ww(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function Gw(e,t){let{nodeExtensions:n}=fw(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=uw(J(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function Kw(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(Kw(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function qw(e){return e instanceof q}var Jw=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function Yw(e,t){let n=t.mapping.mapResult(e.position);return{position:new Jw(n.pos),mapResult:n}}function Xw(e){return new Jw(e)}function Zw(e,t,n){let r=e.state.doc.content.size,i=fC(t,0,r),a=fC(n,0,r),o=e.coordsAtPos(i),s=e.coordsAtPos(a,-1),c=Math.min(o.top,s.top),l=Math.max(o.bottom,s.bottom),u=Math.min(o.left,s.left),d=Math.max(o.right,s.right),f={top:c,bottom:l,left:u,right:d,width:d-u,height:l-c,x:u,y:c};return{...f,toJSON:()=>f}}function Qw(e,t,n){let{selection:r}=t,i=null;if(dC(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var $w=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=cC(e,r.schema);if(i)if(o){let e=ew(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})});return Qw(r,n,c)},eT=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),tT=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=ZS(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>X_(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>X_(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},nT=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=fC(e,0,n.content.size),i=q.create(n,r);t.setSelection(i)}return!0},rT=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},iT=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=K.atStart(n).from,o=K.atEnd(n).to,s=fC(r,a,o),c=fC(i,a,o),l=K.create(n,s,c);t.setSelection(l)}return!0},aT=e=>({state:t,dispatch:n})=>cv(ZS(e,t.schema))(t,n);function oT(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var sT=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=Rw(l,s.node().type.name,s.node().attrs);if(a instanceof q&&a.node.isBlock)return!s.parentOffset||!Ag(o,s.pos)?!1:(r&&(e&&oT(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:nw(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=Ag(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&Ag(t.doc,t.mapping.map(s.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(a instanceof K&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f)){let e=t.mapping.map(s.before()),n=t.doc.resolve(e);s.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(s.before()),f)}e&&oT(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},cT=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=ZS(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=U.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=U.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...Rw(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(U.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new W(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(K.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...Rw(d,u.type.name,u.attrs),...t},m={...Rw(d,s.node().type.name,s.node().attrs),...t};n.delete(s.pos,c.pos);let h=f?[{type:o,attrs:p},{type:f,attrs:m}]:[{type:o,attrs:p}];if(!Ag(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,h).scrollIntoView(),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0},lT=(e,t)=>{let n=ow(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&jg(e.doc,n.pos)&&e.join(n.pos),!0},uT=(e,t)=>{let n=ow(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&jg(e.doc,r)&&e.join(r),!0};function dT(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=n.nodeSize-1;return K.create(t,1,r)}var fT=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=ZS(e,o.schema),m=ZS(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=ow(e=>Gw(e.type.name,d))(h),S=h.from===0&&h.to===o.doc.content.size,C=o.doc.content.content,w=C.length===1?C[0]:null,ee=S&&w&&Gw(w.type.name,d)?{node:w,pos:0,depth:0}:null,T=x??ee,E=!!x&&y.depth>=1&&y.depth-x.depth<=1,te=!!ee;if((E||te)&&T){if(T.node.type===p)return S&&te?c().command(({tr:e,dispatch:t})=>{let n=dT(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(Gw(T.node.type.name,d)&&p.validContent(T.node.content))return c().command(()=>(a.setNodeMarkup(T.pos,p),!0)).command(()=>lT(a,p)).command(()=>uT(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>lT(a,p)).command(()=>uT(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>lT(a,p)).command(()=>uT(a,p)).run()},pT=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=cC(e,r.schema);return Bw(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},mT=(e,t,n={})=>({state:r,commands:i})=>{let a=ZS(e,r.schema),o=ZS(t,r.schema),s=LC(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},hT=(e,t={})=>({state:n,commands:r})=>{let i=ZS(e,n.schema);return LC(n,i,t)?r.lift(i):r.wrapIn(i,t)},gT=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},_T=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;return r||t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},vT=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=cC(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=sC(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},yT=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},bT=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=HC(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=ZS(e,r.schema)),s===`mark`&&(o=cC(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},xT=(e,t={})=>({state:n,dispatch:r})=>Y_(ZS(e,n.schema),t)(n,r),ST=(e,t={})=>({state:n,dispatch:r})=>nv(ZS(e,n.schema),t)(n,r),CT=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}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},wT=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},TT=(e,t)=>{if(rC(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r};function ET(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o}=e,{view:s}=t;if(s.composing)return!1;let c=s.state.doc.resolve(n);if(c.parent.type.spec.code||(c.nodeBefore||c.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let l=!1,u=zw(c)+i;return a.forEach(e=>{if(l)return;let a=TT(u,e.find);if(!a)return;let c=s.state.tr,d=VS({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new HS({editor:t,state:d});e.handler({state:d,range:f,match:a,commands:p,chain:m,can:h})===null||!c.steps.length||(e.undoable&&c.setMeta(o,{transform:c,from:n,to:r,text:i}),s.dispatch(c),l=!0)}),l}function DT(e){let{editor:t,rules:n}=e,r=new h_({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:cw(U.from(e),a.schema);let{from:i}=s;ET({editor:t,from:i,to:i+e.length,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return ET({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&ET({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?ET({editor:t,from:a.pos,to:a.pos,text:`
|
|
195
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function OT(e){return Object.prototype.toString.call(e).slice(8,-1)}function kT(e){return OT(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}function AT(e,t){let n={...e};return kT(e)&&kT(t)&&Object.keys(t).forEach(r=>{kT(t[r])&&kT(e[r])?n[r]=AT(e[r],t[r]):n[r]=t[r]}),n}var jT=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...uw(J(this,`addOptions`,{name:this.name}))||{}}}get storage(){return{...uw(J(this,`addStorage`,{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>AT(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},MT=class e extends jT{constructor(){super(...arguments),this.type=`mark`}static create(t={}){return new e(typeof t==`function`?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function NT(e){return typeof e==`number`}var PT=class{constructor(e){this.find=e.find,this.handler=e.handler}},FT=(e,t,n)=>{if(rC(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function IT(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new HS({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(e.type?.spec?.code||!(e.isText||e.isTextblock||e.isInline))return;let f=e.content?.size??e.nodeSize??0,p=Math.max(r,t),m=Math.min(i,t+f);p>=m||FT(e.isText?e.text||``:e.textBetween(p-t,m-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=p+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var LT=null,RT=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function zT(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr;if(!(!IT({editor:t,state:VS({state:e,transaction:c}),from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new h_({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(LT=t)},i=()=>{LT&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=LT;e?.isEditable&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:cw(U.from(t),r.schema);let{from:n}=d,i=n+t.length,a=RT(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(!(!NT(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var BT=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Tw(e),this.schema=Sw(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=J(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Lw(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return ww([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Lw(t.name,this.schema)},r=[],i=J(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&J(t,`exitable`,n)&&(a.ArrowRight=()=>MT.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=LS(a);r.push(o);let s=J(t,`addInputRules`,n);if(Ww(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=DT({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=J(t,`addPasteRules`,n);if(Ww(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=zT({editor:e,rules:t});r.push(...n)}}let l=J(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r})}get attributes(){return pw(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=fw(this.extensions);return Object.fromEntries(t.filter(e=>!!J(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=J(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:ZS(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:_w(r,n)})]:[]}))}dispatchTransaction(e){let{editor:t}=this;return ww([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Lw(n.name,this.schema)},i=J(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return ww([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Lw(n.name,this.schema)},i=J(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=fw(this.extensions);return Object.fromEntries(t.filter(e=>!!J(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=J(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:cC(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=_w(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{wE(i,e,t)}})}]:[]}))}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Lw(e.name,this.schema)};e.type===`mark`&&(uw(J(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name);let n=J(e,`onBeforeCreate`,t),r=J(e,`onCreate`,t),i=J(e,`onUpdate`,t),a=J(e,`onSelectionUpdate`,t),o=J(e,`onTransaction`,t),s=J(e,`onFocus`,t),c=J(e,`onBlur`,t),l=J(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}};BT.resolve=Tw,BT.sort=ww,BT.flatten=sw,BS({},{ClipboardTextSerializer:()=>HT,Commands:()=>UT,Delete:()=>WT,Drop:()=>GT,Editable:()=>KT,FocusEvents:()=>JT,Keymap:()=>YT,Paste:()=>XT,Tabindex:()=>ZT,TextDirection:()=>QT,focusEventsPluginKey:()=>qT});var VT=class e extends jT{constructor(){super(...arguments),this.type=`extension`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},HT=VT.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new h_({key:new v_(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:a}=i,o=Math.min(...a.map(e=>e.$from.pos)),s=Math.max(...a.map(e=>e.$to.pos)),c=kw(n);return Dw(r,{from:o,to:s},{...this.options.blockSeparator===void 0?{}:{blockSeparator:this.options.blockSeparator},textSerializers:c})}}})]}}),UT=VT.create({name:`commands`,addCommands(){return{...US}}}),WT=VT.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){let n=()=>{var n;if(((n=this.editor.options.coreExtensionOptions?.delete)?.filterTransaction)?.call(n,e)??e.getMeta(`y-sync$`))return;let r=tw(e.before,[e,...t]);Pw(r).forEach(t=>{r.mapping.mapResult(t.oldRange.from).deletedAfter&&r.mapping.mapResult(t.oldRange.to).deletedBefore&&r.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,i)=>{let a=i+n.nodeSize-2,o=t.oldRange.from<=i&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:i,to:a,newFrom:r.mapping.map(i),newTo:r.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:r})})});let i=r.mapping;r.steps.forEach((t,n)=>{if(t instanceof vg){let a=i.slice(n).map(t.from,-1),o=i.slice(n).map(t.to),s=i.invert().map(a,-1),c=i.invert().map(o),l=a>0?r.doc.nodeAt(a-1)?.marks.some(e=>e.eq(t.mark)):!1,u=r.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:a,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:r})}})};this.editor.options.coreExtensionOptions?.delete?.async??!0?setTimeout(n,0):n()}}),GT=VT.create({name:`drop`,addProseMirrorPlugins(){return[new h_({key:new v_(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),KT=VT.create({name:`editable`,addProseMirrorPlugins(){return[new h_({key:new v_(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),qT=new v_(`focusEvents`),JT=VT.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new h_({key:qT,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),YT=VT.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:G.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return hC()||PC()?i:r},addProseMirrorPlugins(){return[new h_({key:new v_(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=G.atStart(t.doc).from,l=G.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!Kw(n.doc))return;let u=n.tr,d=VS({state:n,transaction:u}),{commands:f}=new HS({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),XT=VT.create({name:`paste`,addProseMirrorPlugins(){return[new h_({key:new v_(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),ZT=VT.create({name:`tabindex`,addProseMirrorPlugins(){return[new h_({key:new v_(`tabindex`),props:{attributes:()=>this.editor.isEditable?{tabindex:`0`}:{}}})]}}),QT=VT.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=fw(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new h_({key:new v_(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),$T=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},eE=`.ProseMirror {
|
|
194
|
+
`,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;e.isText&&(s+=(e?.text)?.slice(Math.max(r,n)-n,i-n))}),s}function Ow(e,t){return Dw(e,{from:0,to:e.content.size},t)}function kw(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Aw(e,t){let n=ZS(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function jw(e,t){let n=HC(typeof t==`string`?t:t.name,e.schema);return n===`node`?Aw(e,t):n===`mark`?ew(e,t):{}}function Mw(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function Nw(e){let t=Mw(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function Pw(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),Nw(r)}function Fw(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=sC(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||e?.nodeSize===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var Iw=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]};function Lw(e,t){return t.nodes[e]||t.marks[e]||null}function Rw(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var zw=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function Bw(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?cC(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>iC(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>a?a.name===e.mark.type.name:!0).filter(e=>iC(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>a?e.mark.type!==a&&e.mark.type.excludes(a):!0).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function Vw(e,t,n={}){if(!t)return LC(e,null,n)||Bw(e,null,n);let r=HC(t,e.schema);return r===`node`?LC(e,t,n):r===`mark`?Bw(e,t,n):!1}var Hw=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=ow(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Uw=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function Ww(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function Gw(e,t){let{nodeExtensions:n}=fw(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=uw(J(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function Kw(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(Kw(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function qw(e){return e instanceof q}var Jw=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function Yw(e,t){let n=t.mapping.mapResult(e.position);return{position:new Jw(n.pos),mapResult:n}}function Xw(e){return new Jw(e)}function Zw(e,t,n){let r=e.state.doc.content.size,i=fC(t,0,r),a=fC(n,0,r),o=e.coordsAtPos(i),s=e.coordsAtPos(a,-1),c=Math.min(o.top,s.top),l=Math.max(o.bottom,s.bottom),u=Math.min(o.left,s.left),d=Math.max(o.right,s.right),f={top:c,bottom:l,left:u,right:d,width:d-u,height:l-c,x:u,y:c};return{...f,toJSON:()=>f}}function Qw(e,t,n){let{selection:r}=t,i=null;if(dC(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var $w=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=cC(e,r.schema);if(i)if(o){let e=ew(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})});return Qw(r,n,c)},eT=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),tT=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=ZS(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>X_(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>X_(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},nT=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=fC(e,0,n.content.size),i=q.create(n,r);t.setSelection(i)}return!0},rT=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},iT=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=K.atStart(n).from,o=K.atEnd(n).to,s=fC(r,a,o),c=fC(i,a,o),l=K.create(n,s,c);t.setSelection(l)}return!0},aT=e=>({state:t,dispatch:n})=>cv(ZS(e,t.schema))(t,n);function oT(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var sT=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=Rw(l,s.node().type.name,s.node().attrs);if(a instanceof q&&a.node.isBlock)return!s.parentOffset||!jg(o,s.pos)?!1:(r&&(e&&oT(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:nw(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=jg(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&jg(t.doc,t.mapping.map(s.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(a instanceof K&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f)){let e=t.mapping.map(s.before()),n=t.doc.resolve(e);s.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(s.before()),f)}e&&oT(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},cT=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=ZS(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=U.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=U.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...Rw(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(U.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new W(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(K.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...Rw(d,u.type.name,u.attrs),...t},m={...Rw(d,s.node().type.name,s.node().attrs),...t};n.delete(s.pos,c.pos);let h=f?[{type:o,attrs:p},{type:f,attrs:m}]:[{type:o,attrs:p}];if(!jg(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,h).scrollIntoView(),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0},lT=(e,t)=>{let n=ow(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&Mg(e.doc,n.pos)&&e.join(n.pos),!0},uT=(e,t)=>{let n=ow(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&Mg(e.doc,r)&&e.join(r),!0};function dT(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=n.nodeSize-1;return K.create(t,1,r)}var fT=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=ZS(e,o.schema),m=ZS(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=ow(e=>Gw(e.type.name,d))(h),S=h.from===0&&h.to===o.doc.content.size,C=o.doc.content.content,w=C.length===1?C[0]:null,ee=S&&w&&Gw(w.type.name,d)?{node:w,pos:0,depth:0}:null,T=x??ee,E=!!x&&y.depth>=1&&y.depth-x.depth<=1,te=!!ee;if((E||te)&&T){if(T.node.type===p)return S&&te?c().command(({tr:e,dispatch:t})=>{let n=dT(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(Gw(T.node.type.name,d)&&p.validContent(T.node.content))return c().command(()=>(a.setNodeMarkup(T.pos,p),!0)).command(()=>lT(a,p)).command(()=>uT(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>lT(a,p)).command(()=>uT(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>lT(a,p)).command(()=>uT(a,p)).run()},pT=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=cC(e,r.schema);return Bw(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},mT=(e,t,n={})=>({state:r,commands:i})=>{let a=ZS(e,r.schema),o=ZS(t,r.schema),s=LC(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},hT=(e,t={})=>({state:n,commands:r})=>{let i=ZS(e,n.schema);return LC(n,i,t)?r.lift(i):r.wrapIn(i,t)},gT=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},_T=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;return r||t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},vT=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=cC(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=sC(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},yT=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},bT=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=HC(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=ZS(e,r.schema)),s===`mark`&&(o=cC(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},xT=(e,t={})=>({state:n,dispatch:r})=>Y_(ZS(e,n.schema),t)(n,r),ST=(e,t={})=>({state:n,dispatch:r})=>nv(ZS(e,n.schema),t)(n,r),CT=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}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},wT=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},TT=(e,t)=>{if(rC(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r};function ET(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o}=e,{view:s}=t;if(s.composing)return!1;let c=s.state.doc.resolve(n);if(c.parent.type.spec.code||(c.nodeBefore||c.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let l=!1,u=zw(c)+i;return a.forEach(e=>{if(l)return;let a=TT(u,e.find);if(!a)return;let c=s.state.tr,d=VS({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new HS({editor:t,state:d});e.handler({state:d,range:f,match:a,commands:p,chain:m,can:h})===null||!c.steps.length||(e.undoable&&c.setMeta(o,{transform:c,from:n,to:r,text:i}),s.dispatch(c),l=!0)}),l}function DT(e){let{editor:t,rules:n}=e,r=new h_({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:cw(U.from(e),a.schema);let{from:i}=s;ET({editor:t,from:i,to:i+e.length,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return ET({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&ET({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?ET({editor:t,from:a.pos,to:a.pos,text:`
|
|
195
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function OT(e){return Object.prototype.toString.call(e).slice(8,-1)}function kT(e){return OT(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}function AT(e,t){let n={...e};return kT(e)&&kT(t)&&Object.keys(t).forEach(r=>{kT(t[r])&&kT(e[r])?n[r]=AT(e[r],t[r]):n[r]=t[r]}),n}var jT=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...uw(J(this,`addOptions`,{name:this.name}))||{}}}get storage(){return{...uw(J(this,`addStorage`,{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>AT(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},MT=class e extends jT{constructor(){super(...arguments),this.type=`mark`}static create(t={}){return new e(typeof t==`function`?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function NT(e){return typeof e==`number`}var PT=class{constructor(e){this.find=e.find,this.handler=e.handler}},FT=(e,t,n)=>{if(rC(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function IT(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new HS({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(e.type?.spec?.code||!(e.isText||e.isTextblock||e.isInline))return;let f=e.content?.size??e.nodeSize??0,p=Math.max(r,t),m=Math.min(i,t+f);p>=m||FT(e.isText?e.text||``:e.textBetween(p-t,m-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=p+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var LT=null,RT=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function zT(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr;if(!(!IT({editor:t,state:VS({state:e,transaction:c}),from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new h_({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(LT=t)},i=()=>{LT&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=LT;e?.isEditable&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:cw(U.from(t),r.schema);let{from:n}=d,i=n+t.length,a=RT(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(!(!NT(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var BT=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Tw(e),this.schema=Sw(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=J(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Lw(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return ww([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Lw(t.name,this.schema)},r=[],i=J(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&J(t,`exitable`,n)&&(a.ArrowRight=()=>MT.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=LS(a);r.push(o);let s=J(t,`addInputRules`,n);if(Ww(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=DT({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=J(t,`addPasteRules`,n);if(Ww(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=zT({editor:e,rules:t});r.push(...n)}}let l=J(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r})}get attributes(){return pw(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=fw(this.extensions);return Object.fromEntries(t.filter(e=>!!J(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=J(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:ZS(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:_w(r,n)})]:[]}))}dispatchTransaction(e){let{editor:t}=this;return ww([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Lw(n.name,this.schema)},i=J(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return ww([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Lw(n.name,this.schema)},i=J(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=fw(this.extensions);return Object.fromEntries(t.filter(e=>!!J(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=J(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:cC(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=_w(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{wE(i,e,t)}})}]:[]}))}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Lw(e.name,this.schema)};e.type===`mark`&&(uw(J(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name);let n=J(e,`onBeforeCreate`,t),r=J(e,`onCreate`,t),i=J(e,`onUpdate`,t),a=J(e,`onSelectionUpdate`,t),o=J(e,`onTransaction`,t),s=J(e,`onFocus`,t),c=J(e,`onBlur`,t),l=J(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}};BT.resolve=Tw,BT.sort=ww,BT.flatten=sw,BS({},{ClipboardTextSerializer:()=>HT,Commands:()=>UT,Delete:()=>WT,Drop:()=>GT,Editable:()=>KT,FocusEvents:()=>JT,Keymap:()=>YT,Paste:()=>XT,Tabindex:()=>ZT,TextDirection:()=>QT,focusEventsPluginKey:()=>qT});var VT=class e extends jT{constructor(){super(...arguments),this.type=`extension`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},HT=VT.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new h_({key:new v_(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:a}=i,o=Math.min(...a.map(e=>e.$from.pos)),s=Math.max(...a.map(e=>e.$to.pos)),c=kw(n);return Dw(r,{from:o,to:s},{...this.options.blockSeparator===void 0?{}:{blockSeparator:this.options.blockSeparator},textSerializers:c})}}})]}}),UT=VT.create({name:`commands`,addCommands(){return{...US}}}),WT=VT.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){let n=()=>{var n;if(((n=this.editor.options.coreExtensionOptions?.delete)?.filterTransaction)?.call(n,e)??e.getMeta(`y-sync$`))return;let r=tw(e.before,[e,...t]);Pw(r).forEach(t=>{r.mapping.mapResult(t.oldRange.from).deletedAfter&&r.mapping.mapResult(t.oldRange.to).deletedBefore&&r.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,i)=>{let a=i+n.nodeSize-2,o=t.oldRange.from<=i&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:i,to:a,newFrom:r.mapping.map(i),newTo:r.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:r})})});let i=r.mapping;r.steps.forEach((t,n)=>{if(t instanceof yg){let a=i.slice(n).map(t.from,-1),o=i.slice(n).map(t.to),s=i.invert().map(a,-1),c=i.invert().map(o),l=a>0?r.doc.nodeAt(a-1)?.marks.some(e=>e.eq(t.mark)):!1,u=r.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:a,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:r})}})};this.editor.options.coreExtensionOptions?.delete?.async??!0?setTimeout(n,0):n()}}),GT=VT.create({name:`drop`,addProseMirrorPlugins(){return[new h_({key:new v_(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),KT=VT.create({name:`editable`,addProseMirrorPlugins(){return[new h_({key:new v_(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),qT=new v_(`focusEvents`),JT=VT.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new h_({key:qT,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),YT=VT.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:G.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return hC()||PC()?i:r},addProseMirrorPlugins(){return[new h_({key:new v_(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=G.atStart(t.doc).from,l=G.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!Kw(n.doc))return;let u=n.tr,d=VS({state:n,transaction:u}),{commands:f}=new HS({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),XT=VT.create({name:`paste`,addProseMirrorPlugins(){return[new h_({key:new v_(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),ZT=VT.create({name:`tabindex`,addProseMirrorPlugins(){return[new h_({key:new v_(`tabindex`),props:{attributes:()=>this.editor.isEditable?{tabindex:`0`}:{}}})]}}),QT=VT.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=fw(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new h_({key:new v_(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),$T=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},eE=`.ProseMirror {
|
|
196
196
|
position: relative;
|
|
197
197
|
}
|
|
198
198
|
|
|
@@ -264,7 +264,7 @@ img.ProseMirror-separator {
|
|
|
264
264
|
display: block;
|
|
265
265
|
}`;function tE(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}var nE=class extends CT{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Yw,createMappablePosition:Xw},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc(),n=pC(t,this.options.autofocus);this.editorState=p_.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=tE(eE,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=lw(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){this.extensionManager=new BT([...this.options.enableCoreExtensions?[KT,HT.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),UT,JT,YT,ZT,GT,XT,WT,QT.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions==`object`?this.options.enableCoreExtensions[e.name]!==!1:!0):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type)),this)}createCommandManager(){this.commandManager=new HS({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=QC(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(t.message))throw t;this.emit(`contentError`,{editor:this,error:t,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),e=QC(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new wS(e,{...t,attributes:{role:`textbox`,...t?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return jw(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return Vw(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return cw(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
|
|
266
266
|
|
|
267
|
-
`,textSerializers:n={}}=e||{};return Ow(this.state.doc,{blockSeparator:t,textSerializers:{...kw(this.schema),...n}})}get isEmpty(){return Kw(this.state.doc)}destroy(){this.emit(`destroy`),this.unmount(),this.removeAllListeners()}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){return new $T(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}};function rE(e){return new wT({find:e.find,handler:({state:t,range:n,match:r})=>{let i=uw(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(Fw(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function iE(e){return new wT({find:e.find,handler:({state:t,range:n,match:r})=>{let i=uw(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function aE(e){return new wT({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=uw(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function oE(e){return new wT({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=uw(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&Eg(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&jg(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var sE=e=>`touches`in e,cE=class{constructor(e){this.directions=[`bottom-left`,`bottom-right`,`top-left`,`top-right`],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:``,wrapper:``,handle:``,resizing:``},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp)},this.handleKeyDown=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,e.options?.min&&(this.minSize={...this.minSize,...e.options.min}),e.options?.max&&(this.maxSize=e.options.max),e?.options?.directions&&(this.directions=e.options.directions),e.options?.preserveAspectRatio&&(this.preserveAspectRatio=e.options.preserveAspectRatio),e.options?.className&&(this.classNames={container:e.options.className.container||``,wrapper:e.options.className.wrapper||``,handle:e.options.className.handle||``,resizing:e.options.className.resizing||``}),e.options?.createCustomHandle&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on(`update`,this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){return this.contentElement??null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type?(this.node=e,this.onUpdate?this.onUpdate(e,t,n):!0):!1}destroy(){this.isResizing&&(this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off(`update`,this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement(`div`);return e.dataset.resizeContainer=``,e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?`inline-flex`:`flex`,this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement(`div`);return e.style.position=`relative`,e.style.display=`block`,e.dataset.resizeWrapper=``,this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement(`div`);return t.dataset.resizeHandle=e,t.style.position=`absolute`,this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes(`top`),r=t.includes(`bottom`),i=t.includes(`left`),a=t.includes(`right`);n&&(e.style.top=`0`),r&&(e.style.bottom=`0`),i&&(e.style.left=`0`),a&&(e.style.right=`0`),(t===`top`||t===`bottom`)&&(e.style.left=`0`,e.style.right=`0`),(t===`left`||t===`right`)&&(e.style.top=`0`,e.style.bottom=`0`)}attachHandles(){this.directions.forEach(e=>{let t;t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e),t instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener(`mousedown`,t=>this.handleResizeStart(t,e)),t.addEventListener(`touchstart`,t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,sE(e)?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState=`true`,this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener(`mousemove`,this.handleMouseMove),document.addEventListener(`touchmove`,this.handleTouchMove),document.addEventListener(`mouseup`,this.handleMouseUp),document.addEventListener(`keydown`,this.handleKeyDown),document.addEventListener(`keyup`,this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),a=this.applyConstraints(r,i,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,a=e.includes(`right`),o=e.includes(`left`),s=e.includes(`bottom`),c=e.includes(`top`);return a?r=this.startWidth+t:o&&(r=this.startWidth-t),s?i=this.startHeight+n:c&&(i=this.startHeight-n),(e===`right`||e===`left`)&&(r=this.startWidth+(a?t:-t)),(e===`top`||e===`bottom`)&&(i=this.startHeight+(s?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){if(!n){let n=Math.max(this.minSize.width,e),r=Math.max(this.minSize.height,t);return this.maxSize?.width&&(n=Math.min(this.maxSize.width,n)),this.maxSize?.height&&(r=Math.min(this.maxSize.height,r)),{width:n,height:r}}let r=e,i=t;return r<this.minSize.width&&(r=this.minSize.width,i=r/this.aspectRatio),i<this.minSize.height&&(i=this.minSize.height,r=i*this.aspectRatio),this.maxSize?.width&&r>this.maxSize.width&&(r=this.maxSize.width,i=r/this.aspectRatio),this.maxSize?.height&&i>this.maxSize.height&&(i=this.maxSize.height,r=i*this.aspectRatio),{width:r,height:i}}applyAspectRatio(e,t,n){return n===`left`||n===`right`?{width:e,height:e/this.aspectRatio}:n===`top`||n===`bottom`?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}};function lE(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof q){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function uE(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)}function dE(){return typeof navigator<`u`?/Firefox/.test(navigator.userAgent):!1}BS({},{createAtomBlockMarkdownSpec:()=>mE,createBlockMarkdownSpec:()=>hE,createInlineMarkdownSpec:()=>vE,parseAttributes:()=>fE,parseIndentedBlocks:()=>yE,renderNestedMarkdownContent:()=>bE,serializeAttributes:()=>pE});function fE(e){if(!e?.trim())return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(` `));let a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{let i=n[parseInt(r.match(/__QUOTED_(\d+)__/)?.[1]||`0`,10)];i&&(t[e]=i.slice(1,-1))});let o=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,``).replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,``).replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,``).trim();return o&&o.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function pE(e){if(!e||Object.keys(e).length===0)return``;let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{e===`class`||e===`id`||(n===!0?t.push(e):n!==!1&&n!=null&&t.push(`${e}="${String(n)}"`))}),t.join(` `)}function mE(e){let{nodeName:t,name:n,parseAttributes:r=fE,serializeAttributes:i=pE,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,c=n||t,l=e=>{if(!s)return e;let t={};return s.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let r={...a,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${c}(?:\\s|$)`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,i){let a=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),s=e.match(a);if(!s)return;let l=r(s[1]||``);if(!o.find(e=>!(e in l)))return{type:t,raw:s[0],attributes:l}}},renderMarkdown:e=>{let t=i(l(e.attrs||{}));return`:::${c}${t?` {${t}}`:``} :::`}}}function hE(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=fE,serializeAttributes:a=pE,defaultAttributes:o={},content:s=`block`,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i=typeof t==`string`?[{type:`text`,text:t}]:t}else i=s===`block`?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let a={...o,...e.attributes};return n.createNode(t,a,i)},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${l}`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),o=e.match(a);if(!o)return;let[c,u=``]=o,d=i(u),f=1,p=c.length,m=``,h=/^:::([\w-]*)(\s.*)?/gm,g=e.slice(p);for(h.lastIndex=0;;){let n=h.exec(g);if(n===null)break;let i=n.index,a=n[1];if(!n[2]?.endsWith(`:::`)){if(a)f+=1;else if(--f,f===0){let a=g.slice(0,i);m=a.trim();let o=e.slice(0,p+i+n[0].length),c=[];if(m)if(s===`block`)for(c=r.blockTokens(a),c.forEach(e=>{e.text&&(!e.tokens||e.tokens.length===0)&&(e.tokens=r.inlineTokens(e.text))});c.length>0;){let e=c[c.length-1];if(e.type===`paragraph`&&(!e.text||e.text.trim()===``))c.pop();else break}else c=r.inlineTokens(m);return{type:t,raw:o,attributes:d,content:m,tokens:c}}}}}},renderMarkdown:(e,t)=>{let n=a(u(e.attrs||{}));return`:::${l}${n?` {${n}}`:``}
|
|
267
|
+
`,textSerializers:n={}}=e||{};return Ow(this.state.doc,{blockSeparator:t,textSerializers:{...kw(this.schema),...n}})}get isEmpty(){return Kw(this.state.doc)}destroy(){this.emit(`destroy`),this.unmount(),this.removeAllListeners()}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){return new $T(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}};function rE(e){return new wT({find:e.find,handler:({state:t,range:n,match:r})=>{let i=uw(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(Fw(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function iE(e){return new wT({find:e.find,handler:({state:t,range:n,match:r})=>{let i=uw(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function aE(e){return new wT({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=uw(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function oE(e){return new wT({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=uw(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&Dg(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&Mg(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var sE=e=>`touches`in e,cE=class{constructor(e){this.directions=[`bottom-left`,`bottom-right`,`top-left`,`top-right`],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:``,wrapper:``,handle:``,resizing:``},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp)},this.handleKeyDown=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,e.options?.min&&(this.minSize={...this.minSize,...e.options.min}),e.options?.max&&(this.maxSize=e.options.max),e?.options?.directions&&(this.directions=e.options.directions),e.options?.preserveAspectRatio&&(this.preserveAspectRatio=e.options.preserveAspectRatio),e.options?.className&&(this.classNames={container:e.options.className.container||``,wrapper:e.options.className.wrapper||``,handle:e.options.className.handle||``,resizing:e.options.className.resizing||``}),e.options?.createCustomHandle&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on(`update`,this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){return this.contentElement??null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type?(this.node=e,this.onUpdate?this.onUpdate(e,t,n):!0):!1}destroy(){this.isResizing&&(this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off(`update`,this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement(`div`);return e.dataset.resizeContainer=``,e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?`inline-flex`:`flex`,this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement(`div`);return e.style.position=`relative`,e.style.display=`block`,e.dataset.resizeWrapper=``,this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement(`div`);return t.dataset.resizeHandle=e,t.style.position=`absolute`,this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes(`top`),r=t.includes(`bottom`),i=t.includes(`left`),a=t.includes(`right`);n&&(e.style.top=`0`),r&&(e.style.bottom=`0`),i&&(e.style.left=`0`),a&&(e.style.right=`0`),(t===`top`||t===`bottom`)&&(e.style.left=`0`,e.style.right=`0`),(t===`left`||t===`right`)&&(e.style.top=`0`,e.style.bottom=`0`)}attachHandles(){this.directions.forEach(e=>{let t;t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e),t instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener(`mousedown`,t=>this.handleResizeStart(t,e)),t.addEventListener(`touchstart`,t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,sE(e)?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState=`true`,this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener(`mousemove`,this.handleMouseMove),document.addEventListener(`touchmove`,this.handleTouchMove),document.addEventListener(`mouseup`,this.handleMouseUp),document.addEventListener(`keydown`,this.handleKeyDown),document.addEventListener(`keyup`,this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),a=this.applyConstraints(r,i,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,a=e.includes(`right`),o=e.includes(`left`),s=e.includes(`bottom`),c=e.includes(`top`);return a?r=this.startWidth+t:o&&(r=this.startWidth-t),s?i=this.startHeight+n:c&&(i=this.startHeight-n),(e===`right`||e===`left`)&&(r=this.startWidth+(a?t:-t)),(e===`top`||e===`bottom`)&&(i=this.startHeight+(s?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){if(!n){let n=Math.max(this.minSize.width,e),r=Math.max(this.minSize.height,t);return this.maxSize?.width&&(n=Math.min(this.maxSize.width,n)),this.maxSize?.height&&(r=Math.min(this.maxSize.height,r)),{width:n,height:r}}let r=e,i=t;return r<this.minSize.width&&(r=this.minSize.width,i=r/this.aspectRatio),i<this.minSize.height&&(i=this.minSize.height,r=i*this.aspectRatio),this.maxSize?.width&&r>this.maxSize.width&&(r=this.maxSize.width,i=r/this.aspectRatio),this.maxSize?.height&&i>this.maxSize.height&&(i=this.maxSize.height,r=i*this.aspectRatio),{width:r,height:i}}applyAspectRatio(e,t,n){return n===`left`||n===`right`?{width:e,height:e/this.aspectRatio}:n===`top`||n===`bottom`?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}};function lE(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof q){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function uE(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)}function dE(){return typeof navigator<`u`?/Firefox/.test(navigator.userAgent):!1}BS({},{createAtomBlockMarkdownSpec:()=>mE,createBlockMarkdownSpec:()=>hE,createInlineMarkdownSpec:()=>vE,parseAttributes:()=>fE,parseIndentedBlocks:()=>yE,renderNestedMarkdownContent:()=>bE,serializeAttributes:()=>pE});function fE(e){if(!e?.trim())return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(` `));let a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{let i=n[parseInt(r.match(/__QUOTED_(\d+)__/)?.[1]||`0`,10)];i&&(t[e]=i.slice(1,-1))});let o=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,``).replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,``).replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,``).trim();return o&&o.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function pE(e){if(!e||Object.keys(e).length===0)return``;let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{e===`class`||e===`id`||(n===!0?t.push(e):n!==!1&&n!=null&&t.push(`${e}="${String(n)}"`))}),t.join(` `)}function mE(e){let{nodeName:t,name:n,parseAttributes:r=fE,serializeAttributes:i=pE,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,c=n||t,l=e=>{if(!s)return e;let t={};return s.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let r={...a,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${c}(?:\\s|$)`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,i){let a=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),s=e.match(a);if(!s)return;let l=r(s[1]||``);if(!o.find(e=>!(e in l)))return{type:t,raw:s[0],attributes:l}}},renderMarkdown:e=>{let t=i(l(e.attrs||{}));return`:::${c}${t?` {${t}}`:``} :::`}}}function hE(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=fE,serializeAttributes:a=pE,defaultAttributes:o={},content:s=`block`,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i=typeof t==`string`?[{type:`text`,text:t}]:t}else i=s===`block`?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let a={...o,...e.attributes};return n.createNode(t,a,i)},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${l}`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),o=e.match(a);if(!o)return;let[c,u=``]=o,d=i(u),f=1,p=c.length,m=``,h=/^:::([\w-]*)(\s.*)?/gm,g=e.slice(p);for(h.lastIndex=0;;){let n=h.exec(g);if(n===null)break;let i=n.index,a=n[1];if(!n[2]?.endsWith(`:::`)){if(a)f+=1;else if(--f,f===0){let a=g.slice(0,i);m=a.trim();let o=e.slice(0,p+i+n[0].length),c=[];if(m)if(s===`block`)for(c=r.blockTokens(a),c.forEach(e=>{e.text&&(!e.tokens||e.tokens.length===0)&&(e.tokens=r.inlineTokens(e.text))});c.length>0;){let e=c[c.length-1];if(e.type===`paragraph`&&(!e.text||e.text.trim()===``))c.pop();else break}else c=r.inlineTokens(m);return{type:t,raw:o,attributes:d,content:m,tokens:c}}}}}},renderMarkdown:(e,t)=>{let n=a(u(e.attrs||{}));return`:::${l}${n?` {${n}}`:``}
|
|
268
268
|
|
|
269
269
|
${t.renderChildren(e.content||[],`
|
|
270
270
|
|
|
@@ -325,7 +325,7 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
|
|
|
325
325
|
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/)?.index;return t===void 0?-1:t},tokenize:(e,t,n)=>{let r=e.split(`
|
|
326
326
|
`),[i,a]=ire(r);if(i.length===0)return;let o=kA(i,0,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,items:o,raw:r.slice(0,a).join(`
|
|
327
327
|
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ore,this.editor.getAttributes(AA)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=oE({find:jA,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=oE({find:jA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(AA)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),sre=/^\s*(\[([( |x])?\])\s$/,cre=TE.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,gw(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>bE(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=_w(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[oE({find:sre,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),lre=TE.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,gw(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
328
|
-
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=yE(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=yE(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});VT.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(gA.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(_A.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(DA.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(MA.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(cre.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(lre.configure(this.options.taskList)),e}});var NA=` `,PA=`\xA0`,ure=TE.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,gw(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===NA||n[0].text===NA||n[0].raw===PA||n[0].text===PA)&&r.length===1&&r[0].type===`text`&&(r[0].text===NA||r[0].text===PA)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?NA:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),dre=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,fre=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,FA=MT.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,gw(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[rE({find:dre,type:this.type})]},addPasteRules(){return[DE({find:fre,type:this.type})]}}),pre=FA,mre=TE.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),IA=MT.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,gw(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),hre=IA;function gre(e={}){return new h_({view(t){return new _re(t,e)}})}var _re=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=Pg(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},LA=class e extends G{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):G.near(r)}content(){return W.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new vre(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!yre(e)||!bre(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!q.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};LA.prototype.visible=!1,LA.findFrom=LA.findGapCursorFrom,G.jsonID(`gapcursor`,LA);var vre=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return LA.valid(t)?new LA(t):G.near(t)}};function RA(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function yre(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||RA(e.type))return!0;if(e.inlineContent)return!1}}return!0}function bre(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||RA(e.type))return!0;if(e.inlineContent)return!1}}return!0}function xre(){return new h_({props:{decorations:Tre,createSelectionBetween(e,t,n){return t.pos==n.pos&&LA.valid(n)?new LA(n):null},handleClick:Cre,handleKeyDown:Sre,handleDOMEvents:{beforeinput:wre}}})}var Sre=RS({ArrowLeft:zA(`horiz`,-1),ArrowRight:zA(`horiz`,1),ArrowUp:zA(`vert`,-1),ArrowDown:zA(`vert`,1)});function zA(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof K){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=LA.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new LA(c))),!0):!1}}function Cre(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!LA.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&q.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new LA(r))),!0)}function wre(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof LA))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=U.empty;for(let e=r.length-1;e>=0;e--)i=U.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new W(i,0,0));return a.setSelection(K.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function Tre(e){if(!(e.selection instanceof LA))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,Wx.create(e.doc,[Vx.widget(e.selection.head,t,{key:`gapcursor`})])}var BA=200,VA=function(){};VA.prototype.append=function(e){return e.length?(e=VA.from(e),!this.length&&e||e.length<BA&&this.leafAppend(e)||this.length<BA&&e.leafPrepend(this)||this.appendInner(e)):this},VA.prototype.prepend=function(e){return e.length?VA.from(e).append(this):this},VA.prototype.appendInner=function(e){return new Ere(this,e)},VA.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?VA.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},VA.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},VA.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},VA.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},VA.from=function(e){return e instanceof VA?e:e&&e.length?new HA(e):VA.empty};var HA=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=BA)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=BA)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(VA);VA.empty=new HA([]);var Ere=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(VA),Dre=500,UA=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new WA(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new WA(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new WA(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>KA&&(s=Ore(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new fg;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new WA(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new WA(i,o,l))}else r.push(new WA(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new WA(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>Dre&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new WA(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(VA.from(i.reverse()),a)}};UA.empty=new UA(VA.empty,0);function Ore(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var WA=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},GA=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},KA=20;function qA(e,t,n,r){let i=n.getMeta(tj),a;if(i)return i.historyState;n.getMeta(nj)&&(e=new GA(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(tj))return o.getMeta(tj).redo?new GA(e.done.addTransform(n,void 0,r,ej(t)),e.undone,YA(n.mapping.maps),e.prevTime,e.prevComposition):new GA(e.done,e.undone.addTransform(n,void 0,r,ej(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!JA(n,e.prevRanges)),s=o?XA(e.prevRanges,n.mapping):YA(n.mapping.maps);return new GA(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,ej(t)),UA.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new GA(e.done.rebased(n,a),e.undone.rebased(n,a),XA(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new GA(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),XA(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function JA(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function YA(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function XA(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function ZA(e,t,n){let r=ej(t),i=tj.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new GA(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(tj,{redo:n,historyState:c})}var QA=!1,$A=null;function ej(e){let t=e.plugins;if($A!=t){QA=!1,$A=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){QA=!0;break}}return QA}var tj=new v_(`history`),nj=new v_(`closeHistory`);function rj(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new h_({key:tj,state:{init(){return new GA(UA.empty,UA.empty,null,0,-1)},apply(t,n,r){return qA(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?aj:n==`historyRedo`?oj:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function ij(e,t){return(n,r)=>{let i=tj.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=ZA(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var aj=ij(!1,!0),oj=ij(!0,!0);VT.create({name:`characterCount`,addOptions(){return{limit:null,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new h_({key:new v_(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit;if(i==null||i===0){e=!0;return}let a=this.storage.characters({node:r.doc});if(a>i){let t=a-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var sj=VT.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[gre(this.options)]}});VT.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new h_({key:new v_(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return Wx.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(Vx.node(t,t+e.nodeSize,{class:this.options.className}))}),Wx.create(e,a)}}})]}});var cj=VT.create({name:`gapCursor`,addProseMirrorPlugins(){return[xre()]},extendNodeSchema(e){return{allowGapCursor:uw(J(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),lj=`placeholder`;function uj(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}var dj=VT.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:lj,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${uj(this.options.dataAttribute)}`:`data-${lj}`;return[new h_({key:new v_(`placeholder`),props:{decorations:({doc:t,selection:n})=>{let r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;let o=this.editor.isEmpty;return t.descendants((t,n)=>{let r=i>=n&&i<=n+t.nodeSize,s=!t.isLeaf&&Kw(t);if(!t.type.isTextblock)return this.options.includeChildren;if((r||!this.options.showOnlyCurrent)&&s){let i=[this.options.emptyNodeClass];o&&i.push(this.options.emptyEditorClass);let s=Vx.node(n,n+t.nodeSize,{class:i.join(` `),[e]:typeof this.options.placeholder==`function`?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});a.push(s)}return this.options.includeChildren}),Wx.create(t,a)}}})]}});VT.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new h_({key:new v_(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||qw(n.selection)||e.view.dragging?null:Wx.create(n.doc,[Vx.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function fj({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var pj=VT.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new v_(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new h_({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!fj({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!fj({node:r,types:n})}}})]}}),mj=VT.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>aj(e,t),redo:()=>({state:e,dispatch:t})=>oj(e,t)}},addProseMirrorPlugins(){return[rj(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),hj=VT.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(RE.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(dA.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(gA.configure(this.options.bulletList)),this.options.code!==!1&&e.push(fA.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(jE.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(Zne.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(sj.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(cj.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(KE.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(JE.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(mj.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(pA.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(WE.configure(this.options.italic)),this.options.listItem!==!1&&e.push(_A.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(DA.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(fk.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(MA.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(ure.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(FA.configure(this.options.strike)),this.options.text!==!1&&e.push(mre.configure(this.options.text)),this.options.underline!==!1&&e.push(IA.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(pj.configure(this.options?.trailingNode)),e}}),gj={abandonedHeadElementChild:{reason:`Unexpected metadata element after head`,description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:`Unexpected abruptly closed empty comment`,description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:`Unexpected abruptly closed public identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:`Unexpected abruptly closed system identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:`Unexpected non-digit at start of numeric character reference`,description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:`Unexpected CDATA section in HTML`,description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:`Unexpected too big numeric character reference`,description:`Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)`},closingOfElementWithOpenChildElements:{reason:`Unexpected closing tag with open child elements`,description:`Unexpectedly closing tag. Expected other tags to be closed first`,url:!1},controlCharacterInInputStream:{reason:`Unexpected control character`,description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:`Unexpected control character reference`,description:`Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace`},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:`Unexpected duplicate attribute`,description:`Unexpectedly double attribute. Expected attributes to occur only once`},endTagWithAttributes:{reason:`Unexpected attribute on closing tag`,description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:`Unexpected slash at end of closing tag`,description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:`Unexpected unopened end tag`,description:`Unexpected end tag. Expected no end tag or another end tag`,url:!1},eofBeforeTagName:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected tag name instead`},eofInCdata:{reason:`Unexpected end of file in CDATA`,description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:`Unexpected end of file in comment`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:`Unexpected end of file in doctype`,description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:`Unexpected end of file in element that can only contain text`,description:`Unexpected end of file. Expected text or a closing tag`,url:!1},eofInScriptHtmlCommentLikeText:{reason:`Unexpected end of file in comment inside script`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:`Unexpected end of file in tag`,description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:`Incorrectly closed comment`,description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:`Incorrectly opened comment`,description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:`Invalid sequence after doctype name`,description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:`Invalid first character in tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:`Misplaced doctype`,description:`Unexpected doctype. Expected doctype before head`,url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:`Missing attribute value`,description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:`Missing doctype before other content`,description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:`Missing doctype name`,description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:`Missing public identifier in doctype`,description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:`Missing system identifier in doctype`,description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:`Missing name in end tag`,description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:`Missing quote before public identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:`Missing quote before system identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:`Missing semicolon after character reference`,description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:`Missing whitespace after public identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:`Missing whitespace after system identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:`Missing whitespace before doctype name`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:`Missing whitespace between attributes`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:`Missing whitespace between public and system identifiers in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:`Unexpected nested comment`,description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:`Unexpected non-conforming doctype declaration`,description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:`Unexpected trailing slash on start tag of non-void element`,description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:`Unexpected noncharacter code point referenced by character reference`,description:`Unexpected code point. Do not use noncharacters in HTML`},noncharacterInInputStream:{reason:`Unexpected noncharacter character`,description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:`Unexpected NULL character referenced by character reference`,description:`Unexpected code point. Do not use NULL characters in HTML`},openElementsLeftAfterEof:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected closing tag instead`,url:!1},surrogateCharacterReference:{reason:`Unexpected surrogate character referenced by character reference`,description:`Unexpected code point. Do not use lone surrogate characters in HTML`},surrogateInInputStream:{reason:`Unexpected surrogate character`,description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:`Invalid character after system identifier in doctype`,description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:`Unexpected character in attribute name`,description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:`Unexpected character in unquoted attribute value`,description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:`Unexpected equals sign before attribute name`,description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:`Unexpected NULL character`,description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:`Unexpected question mark instead of tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:`Unexpected slash in tag`,description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:`Unexpected unknown named character reference`,description:`Unexpected character reference. Expected known named character references`}},_j=`https://html.spec.whatwg.org/multipage/parsing.html#parse-error-`,vj=/-[a-z]/g,yj=/%c(?:([-+])(\d+))?/g,bj=/%x/g,xj={2:!0,1:!1,0:null},Sj={};function Cj(e,t){let n=t||Sj,r=n.onerror,i=e instanceof ve?e:new ve(e),a=n.fragment?ne:v,o=String(i);return ce(a(o,{sourceCodeLocationInfo:!0,onParseError:n.onerror?s:null,scriptingEnabled:!1}),{file:i,space:n.space,verbose:n.verbose});function s(e){let t=e.code,a=wj(t),s=n[a]??!0,c=typeof s==`number`?s:+!!s;if(c){let n=gj[a],o=new ye(l(n.reason),{place:{start:{line:e.startLine,column:e.startCol,offset:e.startOffset},end:{line:e.endLine,column:e.endCol,offset:e.endOffset}},ruleId:t,source:`hast-util-from-html`});i.path&&(o.file=i.path,o.name=i.path+`:`+o.name),o.fatal=xj[c],o.note=l(n.description),o.url=n.url===!1?void 0:_j+t,r(o)}function l(t){return t.replace(yj,n).replace(bj,r);function n(t,n,r){let i=(r?Number.parseInt(r,10):0)*(n===`-`?-1:1);return Ej(o.charAt(e.startOffset+i))}function r(){return Dj(o.charCodeAt(e.startOffset))}}}}function wj(e){return e.replace(vj,Tj)}function Tj(e){return e.charAt(1).toUpperCase()}function Ej(e){return e==="`"?"` ` `":e}function Dj(e){return`0x`+e.toString(16).toUpperCase()}function Oj(e){let t=this,{emitParseErrors:n,...r}={...t.data(`settings`),...e};t.parser=i;function i(e,t){return Cj(e,{...r,onerror:n?function(e){t.path&&(e.name=t.path+`:`+e.name,e.file=t.path),t.messages.push(e)}:void 0})}}var kj=(function(e,t,n,r,i){let a=Aj(t);if(n!=null&&(typeof n!=`number`||n<0||n===1/0))throw Error("Expected positive finite `index`");if(r!=null&&(!r.type||!r.children))throw Error("Expected valid `parent`");if(n==null!=(r==null))throw Error("Expected both `index` and `parent`");return Fj(e)?a.call(i,e,n,r):!1}),Aj=(function(e){if(e==null)return Pj;if(typeof e==`string`)return Mj(e);if(typeof e==`object`)return jj(e);if(typeof e==`function`)return Nj(e);throw Error("Expected function, string, or array as `test`")});function jj(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Aj(e[n]);return Nj(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Mj(e){return Nj(t);function t(t){return t.tagName===e}}function Nj(e){return t;function t(t,n,r){return!!(Fj(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Pj(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`element`&&`tagName`in e&&typeof e.tagName==`string`)}function Fj(e){return typeof e==`object`&&!!e&&`type`in e&&`tagName`in e}var Ij=Aj(function(e){return e.tagName===`audio`||e.tagName===`canvas`||e.tagName===`embed`||e.tagName===`iframe`||e.tagName===`img`||e.tagName===`math`||e.tagName===`object`||e.tagName===`picture`||e.tagName===`svg`||e.tagName===`video`}),Lj=`address.article.aside.blockquote.body.br.caption.center.col.colgroup.dd.dialog.dir.div.dl.dt.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.legend.li.li.listing.main.menu.nav.ol.optgroup.option.p.plaintext.pre.section.summary.table.tbody.td.td.tfoot.th.th.thead.tr.ul.wbr.xmp`.split(`.`),Rj=[`button`,`input`,`select`,`textarea`],zj=[`area`,`base`,`basefont`,`dialog`,`datalist`,`head`,`link`,`meta`,`noembed`,`noframes`,`param`,`rp`,`script`,`source`,`style`,`template`,`track`,`title`],Bj={},Vj=te([`comment`,`doctype`]);function Hj(e,t){Uj(e,{collapse:eM((t||Bj).newlines?Qj:$j),whitespace:`normal`})}function Uj(e,t){if(`children`in e){let n={...t};return(e.type===`root`||Yj(e))&&(n.before=!0,n.after=!0),n.whitespace=tM(e,t),Gj(e,n)}if(e.type===`text`){if(t.whitespace===`normal`)return Wj(e,t);t.whitespace===`nowrap`&&(e.value=t.collapse(e.value))}return{ignore:Vj(e),stripAtStart:!1,remove:!1}}function Wj(e,t){let n=t.collapse(e.value),r={ignore:!1,stripAtStart:!1,remove:!1},i=0,a=n.length;return t.before&&Zj(n.charAt(0))&&i++,i!==a&&Zj(n.charAt(a-1))&&(t.after?a--:r.stripAtStart=!0),i===a?r.remove=!0:e.value=n.slice(i,a),r}function Gj(e,t){let n=t.before,r=t.after,i=e.children,a=i.length,o=-1;for(;++o<a;){let e=Uj(i[o],{...t,after:Kj(i,o,r),before:n});e.remove?(i.splice(o,1),o--,a--):e.ignore||(n=e.stripAtStart),Jj(i[o])&&(n=!1)}return{ignore:!1,stripAtStart:!!(n||r),remove:!1}}function Kj(e,t,n){for(;++t<e.length;){let n=e[t],r=qj(n);if(r===void 0&&`children`in n&&!Xj(n)&&(r=Kj(n.children,-1)),typeof r==`boolean`)return r}return n}function qj(e){if(e.type===`element`){if(Jj(e))return!1;if(Yj(e))return!0}else if(e.type===`text`){if(!Oe(e))return!1}else if(!Vj(e))return!1}function Jj(e){return Ij(e)||kj(e,Rj)}function Yj(e){return kj(e,Lj)}function Xj(e){return!!(e.type===`element`&&e.properties.hidden)||Vj(e)||kj(e,zj)}function Zj(e){return e===` `||e===`
|
|
328
|
+
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=yE(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=yE(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});VT.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(gA.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(_A.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(DA.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(MA.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(cre.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(lre.configure(this.options.taskList)),e}});var NA=` `,PA=`\xA0`,ure=TE.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,gw(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===NA||n[0].text===NA||n[0].raw===PA||n[0].text===PA)&&r.length===1&&r[0].type===`text`&&(r[0].text===NA||r[0].text===PA)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?NA:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),dre=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,fre=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,FA=MT.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,gw(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[rE({find:dre,type:this.type})]},addPasteRules(){return[DE({find:fre,type:this.type})]}}),pre=FA,mre=TE.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),IA=MT.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,gw(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),hre=IA;function gre(e={}){return new h_({view(t){return new _re(t,e)}})}var _re=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=Fg(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},LA=class e extends G{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):G.near(r)}content(){return W.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new vre(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!yre(e)||!bre(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!q.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};LA.prototype.visible=!1,LA.findFrom=LA.findGapCursorFrom,G.jsonID(`gapcursor`,LA);var vre=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return LA.valid(t)?new LA(t):G.near(t)}};function RA(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function yre(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||RA(e.type))return!0;if(e.inlineContent)return!1}}return!0}function bre(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||RA(e.type))return!0;if(e.inlineContent)return!1}}return!0}function xre(){return new h_({props:{decorations:Tre,createSelectionBetween(e,t,n){return t.pos==n.pos&&LA.valid(n)?new LA(n):null},handleClick:Cre,handleKeyDown:Sre,handleDOMEvents:{beforeinput:wre}}})}var Sre=RS({ArrowLeft:zA(`horiz`,-1),ArrowRight:zA(`horiz`,1),ArrowUp:zA(`vert`,-1),ArrowDown:zA(`vert`,1)});function zA(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof K){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=LA.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new LA(c))),!0):!1}}function Cre(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!LA.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&q.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new LA(r))),!0)}function wre(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof LA))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=U.empty;for(let e=r.length-1;e>=0;e--)i=U.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new W(i,0,0));return a.setSelection(K.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function Tre(e){if(!(e.selection instanceof LA))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,Wx.create(e.doc,[Vx.widget(e.selection.head,t,{key:`gapcursor`})])}var BA=200,VA=function(){};VA.prototype.append=function(e){return e.length?(e=VA.from(e),!this.length&&e||e.length<BA&&this.leafAppend(e)||this.length<BA&&e.leafPrepend(this)||this.appendInner(e)):this},VA.prototype.prepend=function(e){return e.length?VA.from(e).append(this):this},VA.prototype.appendInner=function(e){return new Ere(this,e)},VA.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?VA.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},VA.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},VA.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},VA.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},VA.from=function(e){return e instanceof VA?e:e&&e.length?new HA(e):VA.empty};var HA=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=BA)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=BA)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(VA);VA.empty=new HA([]);var Ere=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(VA),Dre=500,UA=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new WA(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new WA(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new WA(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>KA&&(s=Ore(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new pg;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new WA(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new WA(i,o,l))}else r.push(new WA(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new WA(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>Dre&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new WA(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(VA.from(i.reverse()),a)}};UA.empty=new UA(VA.empty,0);function Ore(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var WA=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},GA=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},KA=20;function qA(e,t,n,r){let i=n.getMeta(tj),a;if(i)return i.historyState;n.getMeta(nj)&&(e=new GA(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(tj))return o.getMeta(tj).redo?new GA(e.done.addTransform(n,void 0,r,ej(t)),e.undone,YA(n.mapping.maps),e.prevTime,e.prevComposition):new GA(e.done,e.undone.addTransform(n,void 0,r,ej(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!JA(n,e.prevRanges)),s=o?XA(e.prevRanges,n.mapping):YA(n.mapping.maps);return new GA(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,ej(t)),UA.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new GA(e.done.rebased(n,a),e.undone.rebased(n,a),XA(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new GA(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),XA(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function JA(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function YA(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function XA(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function ZA(e,t,n){let r=ej(t),i=tj.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new GA(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(tj,{redo:n,historyState:c})}var QA=!1,$A=null;function ej(e){let t=e.plugins;if($A!=t){QA=!1,$A=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){QA=!0;break}}return QA}var tj=new v_(`history`),nj=new v_(`closeHistory`);function rj(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new h_({key:tj,state:{init(){return new GA(UA.empty,UA.empty,null,0,-1)},apply(t,n,r){return qA(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?aj:n==`historyRedo`?oj:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function ij(e,t){return(n,r)=>{let i=tj.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=ZA(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var aj=ij(!1,!0),oj=ij(!0,!0);VT.create({name:`characterCount`,addOptions(){return{limit:null,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new h_({key:new v_(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit;if(i==null||i===0){e=!0;return}let a=this.storage.characters({node:r.doc});if(a>i){let t=a-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var sj=VT.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[gre(this.options)]}});VT.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new h_({key:new v_(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return Wx.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(Vx.node(t,t+e.nodeSize,{class:this.options.className}))}),Wx.create(e,a)}}})]}});var cj=VT.create({name:`gapCursor`,addProseMirrorPlugins(){return[xre()]},extendNodeSchema(e){return{allowGapCursor:uw(J(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),lj=`placeholder`;function uj(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}var dj=VT.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:lj,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${uj(this.options.dataAttribute)}`:`data-${lj}`;return[new h_({key:new v_(`placeholder`),props:{decorations:({doc:t,selection:n})=>{let r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,a=[];if(!r)return null;let o=this.editor.isEmpty;return t.descendants((t,n)=>{let r=i>=n&&i<=n+t.nodeSize,s=!t.isLeaf&&Kw(t);if(!t.type.isTextblock)return this.options.includeChildren;if((r||!this.options.showOnlyCurrent)&&s){let i=[this.options.emptyNodeClass];o&&i.push(this.options.emptyEditorClass);let s=Vx.node(n,n+t.nodeSize,{class:i.join(` `),[e]:typeof this.options.placeholder==`function`?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});a.push(s)}return this.options.includeChildren}),Wx.create(t,a)}}})]}});VT.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new h_({key:new v_(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||qw(n.selection)||e.view.dragging?null:Wx.create(n.doc,[Vx.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function fj({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var pj=VT.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new v_(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new h_({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!fj({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!fj({node:r,types:n})}}})]}}),mj=VT.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>aj(e,t),redo:()=>({state:e,dispatch:t})=>oj(e,t)}},addProseMirrorPlugins(){return[rj(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),hj=VT.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(RE.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(dA.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(gA.configure(this.options.bulletList)),this.options.code!==!1&&e.push(fA.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(jE.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(Zne.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(sj.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(cj.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(KE.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(JE.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(mj.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(pA.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(WE.configure(this.options.italic)),this.options.listItem!==!1&&e.push(_A.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(DA.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(fk.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(MA.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(ure.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(FA.configure(this.options.strike)),this.options.text!==!1&&e.push(mre.configure(this.options.text)),this.options.underline!==!1&&e.push(IA.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(pj.configure(this.options?.trailingNode)),e}}),gj={abandonedHeadElementChild:{reason:`Unexpected metadata element after head`,description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:`Unexpected abruptly closed empty comment`,description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:`Unexpected abruptly closed public identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:`Unexpected abruptly closed system identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:`Unexpected non-digit at start of numeric character reference`,description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:`Unexpected CDATA section in HTML`,description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:`Unexpected too big numeric character reference`,description:`Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)`},closingOfElementWithOpenChildElements:{reason:`Unexpected closing tag with open child elements`,description:`Unexpectedly closing tag. Expected other tags to be closed first`,url:!1},controlCharacterInInputStream:{reason:`Unexpected control character`,description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:`Unexpected control character reference`,description:`Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace`},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:`Unexpected duplicate attribute`,description:`Unexpectedly double attribute. Expected attributes to occur only once`},endTagWithAttributes:{reason:`Unexpected attribute on closing tag`,description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:`Unexpected slash at end of closing tag`,description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:`Unexpected unopened end tag`,description:`Unexpected end tag. Expected no end tag or another end tag`,url:!1},eofBeforeTagName:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected tag name instead`},eofInCdata:{reason:`Unexpected end of file in CDATA`,description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:`Unexpected end of file in comment`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:`Unexpected end of file in doctype`,description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:`Unexpected end of file in element that can only contain text`,description:`Unexpected end of file. Expected text or a closing tag`,url:!1},eofInScriptHtmlCommentLikeText:{reason:`Unexpected end of file in comment inside script`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:`Unexpected end of file in tag`,description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:`Incorrectly closed comment`,description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:`Incorrectly opened comment`,description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:`Invalid sequence after doctype name`,description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:`Invalid first character in tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:`Misplaced doctype`,description:`Unexpected doctype. Expected doctype before head`,url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:`Missing attribute value`,description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:`Missing doctype before other content`,description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:`Missing doctype name`,description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:`Missing public identifier in doctype`,description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:`Missing system identifier in doctype`,description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:`Missing name in end tag`,description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:`Missing quote before public identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:`Missing quote before system identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:`Missing semicolon after character reference`,description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:`Missing whitespace after public identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:`Missing whitespace after system identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:`Missing whitespace before doctype name`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:`Missing whitespace between attributes`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:`Missing whitespace between public and system identifiers in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:`Unexpected nested comment`,description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:`Unexpected non-conforming doctype declaration`,description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:`Unexpected trailing slash on start tag of non-void element`,description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:`Unexpected noncharacter code point referenced by character reference`,description:`Unexpected code point. Do not use noncharacters in HTML`},noncharacterInInputStream:{reason:`Unexpected noncharacter character`,description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:`Unexpected NULL character referenced by character reference`,description:`Unexpected code point. Do not use NULL characters in HTML`},openElementsLeftAfterEof:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected closing tag instead`,url:!1},surrogateCharacterReference:{reason:`Unexpected surrogate character referenced by character reference`,description:`Unexpected code point. Do not use lone surrogate characters in HTML`},surrogateInInputStream:{reason:`Unexpected surrogate character`,description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:`Invalid character after system identifier in doctype`,description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:`Unexpected character in attribute name`,description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:`Unexpected character in unquoted attribute value`,description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:`Unexpected equals sign before attribute name`,description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:`Unexpected NULL character`,description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:`Unexpected question mark instead of tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:`Unexpected slash in tag`,description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:`Unexpected unknown named character reference`,description:`Unexpected character reference. Expected known named character references`}},_j=`https://html.spec.whatwg.org/multipage/parsing.html#parse-error-`,vj=/-[a-z]/g,yj=/%c(?:([-+])(\d+))?/g,bj=/%x/g,xj={2:!0,1:!1,0:null},Sj={};function Cj(e,t){let n=t||Sj,r=n.onerror,i=e instanceof ve?e:new ve(e),a=n.fragment?ne:v,o=String(i);return ce(a(o,{sourceCodeLocationInfo:!0,onParseError:n.onerror?s:null,scriptingEnabled:!1}),{file:i,space:n.space,verbose:n.verbose});function s(e){let t=e.code,a=wj(t),s=n[a]??!0,c=typeof s==`number`?s:+!!s;if(c){let n=gj[a],o=new ye(l(n.reason),{place:{start:{line:e.startLine,column:e.startCol,offset:e.startOffset},end:{line:e.endLine,column:e.endCol,offset:e.endOffset}},ruleId:t,source:`hast-util-from-html`});i.path&&(o.file=i.path,o.name=i.path+`:`+o.name),o.fatal=xj[c],o.note=l(n.description),o.url=n.url===!1?void 0:_j+t,r(o)}function l(t){return t.replace(yj,n).replace(bj,r);function n(t,n,r){let i=(r?Number.parseInt(r,10):0)*(n===`-`?-1:1);return Ej(o.charAt(e.startOffset+i))}function r(){return Dj(o.charCodeAt(e.startOffset))}}}}function wj(e){return e.replace(vj,Tj)}function Tj(e){return e.charAt(1).toUpperCase()}function Ej(e){return e==="`"?"` ` `":e}function Dj(e){return`0x`+e.toString(16).toUpperCase()}function Oj(e){let t=this,{emitParseErrors:n,...r}={...t.data(`settings`),...e};t.parser=i;function i(e,t){return Cj(e,{...r,onerror:n?function(e){t.path&&(e.name=t.path+`:`+e.name,e.file=t.path),t.messages.push(e)}:void 0})}}var kj=(function(e,t,n,r,i){let a=Aj(t);if(n!=null&&(typeof n!=`number`||n<0||n===1/0))throw Error("Expected positive finite `index`");if(r!=null&&(!r.type||!r.children))throw Error("Expected valid `parent`");if(n==null!=(r==null))throw Error("Expected both `index` and `parent`");return Fj(e)?a.call(i,e,n,r):!1}),Aj=(function(e){if(e==null)return Pj;if(typeof e==`string`)return Mj(e);if(typeof e==`object`)return jj(e);if(typeof e==`function`)return Nj(e);throw Error("Expected function, string, or array as `test`")});function jj(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Aj(e[n]);return Nj(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Mj(e){return Nj(t);function t(t){return t.tagName===e}}function Nj(e){return t;function t(t,n,r){return!!(Fj(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Pj(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`element`&&`tagName`in e&&typeof e.tagName==`string`)}function Fj(e){return typeof e==`object`&&!!e&&`type`in e&&`tagName`in e}var Ij=Aj(function(e){return e.tagName===`audio`||e.tagName===`canvas`||e.tagName===`embed`||e.tagName===`iframe`||e.tagName===`img`||e.tagName===`math`||e.tagName===`object`||e.tagName===`picture`||e.tagName===`svg`||e.tagName===`video`}),Lj=`address.article.aside.blockquote.body.br.caption.center.col.colgroup.dd.dialog.dir.div.dl.dt.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.legend.li.li.listing.main.menu.nav.ol.optgroup.option.p.plaintext.pre.section.summary.table.tbody.td.td.tfoot.th.th.thead.tr.ul.wbr.xmp`.split(`.`),Rj=[`button`,`input`,`select`,`textarea`],zj=[`area`,`base`,`basefont`,`dialog`,`datalist`,`head`,`link`,`meta`,`noembed`,`noframes`,`param`,`rp`,`script`,`source`,`style`,`template`,`track`,`title`],Bj={},Vj=te([`comment`,`doctype`]);function Hj(e,t){Uj(e,{collapse:eM((t||Bj).newlines?Qj:$j),whitespace:`normal`})}function Uj(e,t){if(`children`in e){let n={...t};return(e.type===`root`||Yj(e))&&(n.before=!0,n.after=!0),n.whitespace=tM(e,t),Gj(e,n)}if(e.type===`text`){if(t.whitespace===`normal`)return Wj(e,t);t.whitespace===`nowrap`&&(e.value=t.collapse(e.value))}return{ignore:Vj(e),stripAtStart:!1,remove:!1}}function Wj(e,t){let n=t.collapse(e.value),r={ignore:!1,stripAtStart:!1,remove:!1},i=0,a=n.length;return t.before&&Zj(n.charAt(0))&&i++,i!==a&&Zj(n.charAt(a-1))&&(t.after?a--:r.stripAtStart=!0),i===a?r.remove=!0:e.value=n.slice(i,a),r}function Gj(e,t){let n=t.before,r=t.after,i=e.children,a=i.length,o=-1;for(;++o<a;){let e=Uj(i[o],{...t,after:Kj(i,o,r),before:n});e.remove?(i.splice(o,1),o--,a--):e.ignore||(n=e.stripAtStart),Jj(i[o])&&(n=!1)}return{ignore:!1,stripAtStart:!!(n||r),remove:!1}}function Kj(e,t,n){for(;++t<e.length;){let n=e[t],r=qj(n);if(r===void 0&&`children`in n&&!Xj(n)&&(r=Kj(n.children,-1)),typeof r==`boolean`)return r}return n}function qj(e){if(e.type===`element`){if(Jj(e))return!1;if(Yj(e))return!0}else if(e.type===`text`){if(!Oe(e))return!1}else if(!Vj(e))return!1}function Jj(e){return Ij(e)||kj(e,Rj)}function Yj(e){return kj(e,Lj)}function Xj(e){return!!(e.type===`element`&&e.properties.hidden)||Vj(e)||kj(e,zj)}function Zj(e){return e===` `||e===`
|
|
329
329
|
`}function Qj(e){let t=/\r?\n|\r/.exec(e);return t?t[0]:` `}function $j(){return` `}function eM(e){return t;function t(t){return String(t).replace(/[\t\n\v\f\r ]+/g,e)}}function tM(e,t){if(`tagName`in e&&e.properties)switch(e.tagName){case`listing`:case`plaintext`:case`script`:case`style`:case`xmp`:return`pre`;case`nobr`:return`nowrap`;case`pre`:return e.properties.wrap?`pre-wrap`:`pre`;case`td`:case`th`:return e.properties.noWrap?`nowrap`:t.whitespace;case`textarea`:return`pre-wrap`;default:}return t.whitespace}function nM(e){return function(t){Hj(t,e)}}function rM(e,t){let n=t.properties||{},r=e.all(t),i={type:`link`,url:e.resolve(String(n.href||``)||null),title:n.title?String(n.title):null,children:r};return e.patch(t,i),i}function iM(e,t){e.baseFound||=(e.frozenBaseUrl=String(t.properties&&t.properties.href||``)||void 0,!0)}function aM(e,t){let n={type:`blockquote`,children:e.toFlow(e.all(t))};return e.patch(t,n),n}function oM(e,t){let n={type:`break`};return e.patch(t,n),n}var sM=(function(e,t,n){let r=te(n);if(!e||!e.type||!e.children)throw Error(`Expected parent node`);if(typeof t==`number`){if(t<0||t===1/0)throw Error(`Expected positive finite number as index`)}else if(t=e.children.indexOf(t),t<0)throw Error(`Expected child node or index`);for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),cM=/\n/g,lM=/[\t ]+/g,uM=Aj(`br`),dM=Aj(wM),fM=Aj(`p`),pM=Aj(`tr`),mM=Aj([`datalist`,`head`,`noembed`,`noframes`,`noscript`,`rp`,`script`,`style`,`template`,`title`,CM,TM]),hM=Aj(`address.article.aside.blockquote.body.caption.center.dd.dialog.dir.dl.dt.div.figure.figcaption.footer.form,.h1.h2.h3.h4.h5.h6.header.hgroup.hr.html.legend.li.listing.main.menu.nav.ol.p.plaintext.pre.section.ul.xmp`.split(`.`));function gM(e,t){let n=t||{},r=`children`in e?e.children:[],i=hM(e),a=SM(e,{whitespace:n.whitespace||`normal`,breakBefore:!1,breakAfter:!1}),o=[];(e.type===`text`||e.type===`comment`)&&o.push(...yM(e,{whitespace:a,breakBefore:!0,breakAfter:!0}));let s=-1;for(;++s<r.length;)o.push(..._M(r[s],e,{whitespace:a,breakBefore:s?void 0:i,breakAfter:s<r.length-1?uM(r[s+1]):i}));let c=[],l;for(s=-1;++s<o.length;){let e=o[s];typeof e==`number`?l!==void 0&&e>l&&(l=e):e&&(l!==void 0&&l>-1&&c.push(`
|
|
330
330
|
`.repeat(l)||` `),l=-1,c.push(e))}return c.join(``)}function _M(e,t,n){return e.type===`element`?vM(e,t,n):e.type===`text`?n.whitespace===`normal`?yM(e,n):bM(e):[]}function vM(e,t,n){let r=SM(e,n),i=e.children||[],a=-1,o=[];if(mM(e))return o;let s,c;for(uM(e)||pM(e)&&sM(t,e,pM)?c=`
|
|
331
331
|
`:fM(e)?(s=2,c=2):hM(e)&&(s=1,c=1);++a<i.length;)o=o.concat(_M(i[a],e,{whitespace:r,breakBefore:a?void 0:s,breakAfter:a<i.length-1?uM(i[a+1]):c}));return dM(e)&&sM(t,e,dM)&&o.push(` `),s&&o.unshift(s),c&&o.push(c),o}function yM(e,t){let n=String(e.value),r=[],i=[],a=0;for(;a<=n.length;){cM.lastIndex=a;let e=cM.exec(n),i=e&&`index`in e?e.index:n.length;r.push(xM(n.slice(a,i).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,``),a===0?t.breakBefore:!0,i===n.length?t.breakAfter:!0)),a=i+1}let o=-1,s;for(;++o<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(i.push(r[o]),s=void 0):r[o]?(typeof s==`number`&&i.push(s),i.push(r[o]),s=0):(o===0||o===r.length-1)&&i.push(0);return i}function bM(e){return[String(e.value)]}function xM(e,t,n){let r=[],i=0,a;for(;i<e.length;){lM.lastIndex=i;let n=lM.exec(e);a=n?n.index:e.length,!i&&!a&&n&&!t&&r.push(``),i!==a&&r.push(e.slice(i,a)),i=n?a+n[0].length:a}return i!==a&&!n&&r.push(``),r.join(` `)}function SM(e,t){if(e.type===`element`){let n=e.properties||{};switch(e.tagName){case`listing`:case`plaintext`:case`xmp`:return`pre`;case`nobr`:return`nowrap`;case`pre`:return n.wrap?`pre-wrap`:`pre`;case`td`:case`th`:return n.noWrap?`nowrap`:t.whitespace;case`textarea`:return`pre-wrap`;default:}}return t.whitespace}function CM(e){return!!(e.properties||{}).hidden}function wM(e){return e.tagName===`td`||e.tagName===`th`}function TM(e){return e.tagName===`dialog`&&!(e.properties||{}).open}function EM(e){let t=String(e),n=t.length;for(;n>0;){let e=t.codePointAt(n-1);if(e!==void 0&&(e===10||e===13))n--;else break}return t.slice(0,n)}var DM=`language-`;function OM(e,t){let n=t.children,r=-1,i,a;if(t.tagName===`pre`)for(;++r<n.length;){let e=n[r];if(e.type===`element`&&e.tagName===`code`&&e.properties&&e.properties.className&&Array.isArray(e.properties.className)){i=e.properties.className;break}}if(i){for(r=-1;++r<i.length;)if(String(i[r]).slice(0,9)===DM){a=String(i[r]).slice(9);break}}let o={type:`code`,lang:a||null,meta:null,value:EM(gM(t))};return e.patch(t,o),o}function kM(e,t){let n={type:`html`,value:`<!--`+t.value+`-->`};return e.patch(t,n),n}function AM(e,t){let n={type:`delete`,children:e.all(t)};return e.patch(t,n),n}function jM(e){let t=-1;if(e.length>1){for(;++t<e.length;)if(e[t].spread)return!0}return!1}function MM(e,t){let n=[],r=[],i=-1;for(;++i<t.children.length;){let e=t.children[i];e.type===`element`&&e.tagName===`div`?n.push(...e.children):n.push(e)}let a={definitions:[],titles:[]};for(i=-1;++i<n.length;){let e=n[i];if(e.type===`element`&&e.tagName===`dt`){let t=n[i-1];t&&t.type===`element`&&t.tagName===`dd`&&(r.push(a),a={definitions:[],titles:[]}),a.titles.push(e)}else a.definitions.push(e)}r.push(a),i=-1;let o=[];for(;++i<r.length;){let t=[...NM(e,r[i].titles),...NM(e,r[i].definitions)];t.length>0&&o.push({type:`listItem`,spread:t.length>1,checked:null,children:t})}if(o.length>0){let n={type:`list`,ordered:!1,start:null,spread:jM(o),children:o};return e.patch(t,n),n}}function NM(e,t){let n=e.all({type:`root`,children:t}),r=e.toSpecificContent(n,PM);return r.length===0?[]:r.length===1?r[0].children:[{type:`list`,ordered:!1,start:null,spread:jM(r),children:r}]}function PM(){return{type:`listItem`,spread:!1,checked:null,children:[]}}function FM(e,t){let n={type:`emphasis`,children:e.all(t)};return e.patch(t,n),n}function IM(e){let t=0,n=e.length;for(;t<n&&e[t].type===`break`;)t++;for(;n>t&&e[n-1].type===`break`;)n--;return t===0&&n===e.length?e:e.slice(t,n)}function LM(e,t){let n={type:`heading`,depth:Number(t.tagName.charAt(1))||1,children:IM(e.all(t))};return e.patch(t,n),n}function RM(e,t){let n={type:`thematicBreak`};return e.patch(t,n),n}function zM(e,t){let n=t.properties||{},r=String(n.src||``),i=String(n.title||``);if(r&&i){let n={type:`link`,title:null,url:e.resolve(r),children:[{type:`text`,value:i}]};return e.patch(t,n),n}}function BM(e,t){let n=t.properties||{},r={type:`image`,url:e.resolve(String(n.src||``)||null),title:n.title?String(n.title):null,alt:n.alt?String(n.alt):``};return e.patch(t,r),r}function VM(e,t){let n={type:`inlineCode`,value:gM(t)};return e.patch(t,n),n}function HM(e,t){let n=[],r=[],i=t||e.properties||{},a=UM(e),o=Math.min(Number.parseInt(String(i.size),10),0)||(i.multiple?4:1),s=-1;for(;++s<a.length;){let e=a[s];e&&e.properties&&e.properties.selected&&n.push(e)}let c=n.length>0?n:a,l=Math.min(c.length,o);for(s=-1;++s<l;){let e=c[s],t=e.properties||{},n=gM(e),i=n||String(t.label||``),a=String(t.value||``)||n;r.push([a,i===a?void 0:i])}return r}function UM(e){let t=[],n=-1;for(;++n<e.children.length;){let r=e.children[n];`children`in r&&Array.isArray(r.children)&&t.push(...UM(r)),r.type===`element`&&r.tagName===`option`&&(!r.properties||!r.properties.disabled)&&t.push(r)}return t}var WM=`[x]`,GM=`[ ]`;function KM(e,t){let n=t.properties||{},r=String(n.value||n.placeholder||``);if(n.disabled||n.type===`hidden`||n.type===`file`)return;if(n.type===`checkbox`||n.type===`radio`){let r={type:`text`,value:n.checked?e.options.checked||WM:e.options.unchecked||GM};return e.patch(t,r),r}if(n.type===`image`){let i=n.alt||r;if(i){let r={type:`image`,url:e.resolve(String(n.src||``)||null),title:String(n.title||``)||null,alt:String(i)};return e.patch(t,r),r}return}let i=[];if(r)i=[[r,void 0]];else if(n.type!==`button`&&n.type!==`file`&&n.type!==`password`&&n.type!==`reset`&&n.type!==`submit`&&n.list){let t=String(n.list),r=e.elementById.get(t);r&&r.tagName===`datalist`&&(i=HM(r,n))}if(i.length===0)return;if(n.type===`password`&&(i[0]=[`•`.repeat(i[0][0].length),void 0]),n.type===`email`||n.type===`url`){let t=[],r=-1;for(;++r<i.length;){let a=e.resolve(i[r][0]),o={type:`link`,title:null,url:n.type===`email`?`mailto:`+a:a,children:[{type:`text`,value:i[r][1]||a}]};t.push(o),r!==i.length-1&&t.push({type:`text`,value:`, `})}return t}let a=[],o=-1;for(;++o<i.length;)a.push(i[o][1]?i[o][1]+` (`+i[o][0]+`)`:i[o][0]);let s={type:`text`,value:a.join(`, `)};return e.patch(t,s),s}var qM={}.hasOwnProperty;function JM(e,t){let n=e.type===`element`&&qM.call(e.properties,t)&&e.properties[t];return n!=null&&n!==!1}var YM=new Set([`pingback`,`prefetch`,`stylesheet`]);function XM(e){if(e.type!==`element`||e.tagName!==`link`)return!1;if(e.properties.itemProp)return!0;let t=e.properties.rel,n=-1;if(!Array.isArray(t)||t.length===0)return!1;for(;++n<t.length;)if(!YM.has(String(t[n])))return!1;return!0}var ZM=Aj(`a.abbr.area.b.bdi.bdo.br.button.cite.code.data.datalist.del.dfn.em.i.input.ins.kbd.keygen.label.map.mark.meter.noscript.output.progress.q.ruby.s.samp.script.select.small.span.strong.sub.sup.template.textarea.time.u.var.wbr`.split(`.`)),QM=Aj(`meta`);function $M(e){return!!(e.type===`text`||ZM(e)||Ij(e)||XM(e)||QM(e)&&JM(e,`itemProp`))}function eN(e,t){let{rest:n,checkbox:r}=nN(t),i=r?!!r.properties.checked:null,a={type:`listItem`,spread:tN(n),checked:i,children:e.toFlow(e.all(n))};return e.patch(t,a),a}function tN(e){let t=-1,n=!1;for(;++t<e.children.length;){let r=e.children[t];if(r.type===`element`){if($M(r))continue;if(r.tagName===`p`||n||tN(r))return!0;n=!0}}return!1}function nN(e){let t=e.children[0];if(t&&t.type===`element`&&t.tagName===`input`&&t.properties&&(t.properties.type===`checkbox`||t.properties.type===`radio`))return{checkbox:t,rest:{...e,children:e.children.slice(1)}};if(t&&t.type===`element`&&t.tagName===`p`){let{checkbox:n,rest:r}=nN(t);if(n)return{checkbox:n,rest:{...e,children:[r,...e.children.slice(1)]}}}return{checkbox:void 0,rest:e}}function rN(e,t){let n=t.tagName===`ol`,r=e.toSpecificContent(e.all(t),iN),i=null;n&&(i=t.properties&&t.properties.start?Number.parseInt(String(t.properties.start),10):1);let a={type:`list`,ordered:n,start:i,spread:jM(r),children:r};return e.patch(t,a),a}function iN(){return{type:`listItem`,spread:!1,checked:null,children:[]}}function aN(e){let t=-1;for(;++t<e.length;){let n=e[t];if(!uN(n)||`children`in n&&aN(n.children))return!0}return!1}function oN(e){return cN(e,t,function(e){return e});function t(e){return e.every(function(e){return e.type===`text`?Oe(e.value):!1})?[]:[{type:`paragraph`,children:IM(e)}]}}function sN(e){return cN(e.children,t,n);function t(t){let n=dN(e);return n.children=t,[n]}function n(t){if(`children`in t&&`children`in e){let n=dN(e),r=dN(t);return n.children=t.children,r.children.push(n),r}return{...t}}}function cN(e,t,n){let r=lN(e),i=[],a=[],o=-1;for(;++o<r.length;){let e=r[o];uN(e)?a.push(e):(a.length>0&&(i.push(...t(a)),a=[]),i.push(n(e)))}return a.length>0&&(i.push(...t(a)),a=[]),i}function lN(e){let t=[],n=-1;for(;++n<e.length;){let r=e[n];(r.type===`delete`||r.type===`link`)&&aN(r.children)?t.push(...sN(r)):t.push(r)}return t}function uN(e){let t=e.data&&e.data.hName;return t?$M({type:`element`,tagName:t,properties:{},children:[]}):_(e)}function dN(e){return y({...e,children:[]})}function fN(e,t){let n=t.properties||{},r=t.tagName===`video`?String(n.poster||``):``,i=String(n.src||``),a=-1,o=!1,s=e.all(t);if(E({type:`root`,children:s},function(e){if(e.type===`link`)return o=!0,!1}),o||aN(s))return s;for(;!i&&++a<t.children.length;){let e=t.children[a];e.type===`element`&&e.tagName===`source`&&e.properties&&(i=String(e.properties.src||``))}if(r){let n={type:`image`,title:null,url:e.resolve(r),alt:b(s)};e.patch(t,n),s=[n]}let c=s,l={type:`link`,title:n.title?String(n.title):null,url:e.resolve(i),children:c};return e.patch(t,l),l}function pN(e,t){let n=IM(e.all(t));if(n.length>0){let r={type:`paragraph`,children:n};return e.patch(t,r),r}}var mN=[`"`];function hN(e,t){let n=e.options.quotes||mN;e.qNesting++;let r=e.all(t);e.qNesting--;let i=n[e.qNesting%n.length],a=r[0],o=r[r.length-1],s=i.charAt(0),c=i.length>1?i.charAt(1):i;return a&&a.type===`text`?a.value=s+a.value:r.unshift({type:`text`,value:s}),o&&o.type===`text`?o.value+=c:r.push({type:`text`,value:c}),r}function gN(e,t){let n=e.all(t);(e.options.document||aN(n))&&(n=oN(n));let r={type:`root`,children:n};return e.patch(t,r),r}function _N(e,t){let n=HM(t),r=-1,i=[];for(;++r<n.length;){let e=n[r];i.push(e[1]?e[1]+` (`+e[0]+`)`:e[0])}if(i.length>0){let n={type:`text`,value:i.join(`, `)};return e.patch(t,n),n}}function vN(e,t){let n={type:`strong`,children:e.all(t)};return e.patch(t,n),n}function yN(e,t){let n={type:`tableCell`,children:e.all(t)};if(e.patch(t,n),t.properties){let e=t.properties.rowSpan,r=t.properties.colSpan;if(e||r){let t=n.data||={};e&&(t.hastUtilToMdastTemporaryRowSpan=e),r&&(t.hastUtilToMdastTemporaryColSpan=r)}}return n}function bN(e,t){let n={type:`tableRow`,children:e.toSpecificContent(e.all(t),xN)};return e.patch(t,n),n}function xN(){return{type:`tableCell`,children:[]}}function SN(e,t){if(e.inTable){let n={type:`text`,value:gM(t)};return e.patch(t,n),n}e.inTable=!0;let{align:n,headless:r}=CN(t),i=e.toSpecificContent(e.all(t),TN);r&&i.unshift(TN());let a=-1;for(;++a<i.length;){let t=i[a];t.children=e.toSpecificContent(t.children,wN)}let o=1;for(a=-1;++a<i.length;){let e=i[a].children,t=-1;for(;++t<e.length;){let n=e[t];if(n.data){let e=n.data,r=Number.parseInt(String(e.hastUtilToMdastTemporaryColSpan),10)||1,o=Number.parseInt(String(e.hastUtilToMdastTemporaryRowSpan),10)||1;if(r>1||o>1){let e=a-1;for(;++e<a+o;){let n=t-1;for(;++n<t+r&&i[e];){let r=[];(e!==a||n!==t)&&r.push({type:`tableCell`,children:[]}),i[e].children.splice(n,0,...r)}}}`hastUtilToMdastTemporaryColSpan`in n.data&&delete n.data.hastUtilToMdastTemporaryColSpan,`hastUtilToMdastTemporaryRowSpan`in n.data&&delete n.data.hastUtilToMdastTemporaryRowSpan,Object.keys(n.data).length===0&&delete n.data}}e.length>o&&(o=e.length)}for(a=-1;++a<i.length;){let e=i[a].children,t=e.length-1;for(;++t<o;)e.push({type:`tableCell`,children:[]})}let s=n.length-1;for(;++s<o;)n.push(null);e.inTable=!1;let c={type:`table`,align:n,children:i};return e.patch(t,c),c}function CN(e){let t={align:[null],headless:!0},n=0,r=0;return E(e,function(i){if(i.type===`element`){if(i.tagName===`table`&&e!==i)return g;if((i.tagName===`th`||i.tagName===`td`)&&i.properties){if(!t.align[r]){let e=String(i.properties.align||``)||null;(e===`center`||e===`left`||e===`right`||e===null)&&(t.align[r]=e)}t.headless&&n<2&&i.tagName===`th`&&(t.headless=!1),r++}else i.tagName===`thead`?t.headless=!1:i.tagName===`tr`&&(n++,r=0)}}),t}function wN(){return{type:`tableCell`,children:[]}}function TN(){return{type:`tableRow`,children:[]}}function EN(e,t){let n={type:`text`,value:t.value};return e.patch(t,n),n}function DN(e,t){let n={type:`text`,value:gM(t)};return e.patch(t,n),n}function ON(e,t){let n={type:`text`,value:``};return e.patch(t,n),n}var kN={comment:kM,doctype:NN,root:gN,text:EN},AN={applet:NN,area:NN,basefont:NN,bgsound:NN,caption:NN,col:NN,colgroup:NN,command:NN,content:NN,datalist:NN,dialog:NN,element:NN,embed:NN,frame:NN,frameset:NN,isindex:NN,keygen:NN,link:NN,math:NN,menu:NN,menuitem:NN,meta:NN,nextid:NN,noembed:NN,noframes:NN,optgroup:NN,option:NN,param:NN,script:NN,shadow:NN,source:NN,spacer:NN,style:NN,svg:NN,template:NN,title:NN,track:NN,abbr:jN,acronym:jN,bdi:jN,bdo:jN,big:jN,blink:jN,button:jN,canvas:jN,cite:jN,data:jN,details:jN,dfn:jN,font:jN,ins:jN,label:jN,map:jN,marquee:jN,meter:jN,nobr:jN,noscript:jN,object:jN,output:jN,progress:jN,rb:jN,rbc:jN,rp:jN,rt:jN,rtc:jN,ruby:jN,slot:jN,small:jN,span:jN,sup:jN,sub:jN,tbody:jN,tfoot:jN,thead:jN,time:jN,address:MN,article:MN,aside:MN,body:MN,center:MN,div:MN,fieldset:MN,figcaption:MN,figure:MN,form:MN,footer:MN,header:MN,hgroup:MN,html:MN,legend:MN,main:MN,multicol:MN,nav:MN,picture:MN,section:MN,a:rM,audio:fN,b:vN,base:iM,blockquote:aM,br:oM,code:VM,dir:rN,dl:MM,dt:eN,dd:eN,del:AM,em:FM,h1:LM,h2:LM,h3:LM,h4:LM,h5:LM,h6:LM,hr:RM,i:FM,iframe:zM,img:BM,image:BM,input:KM,kbd:VM,li:eN,listing:OM,mark:FM,ol:rN,p:pN,plaintext:OM,pre:OM,q:hN,s:AM,samp:VM,select:_N,strike:AM,strong:vN,summary:pN,table:SN,td:yN,textarea:DN,th:yN,tr:bN,tt:VM,u:FM,ul:rN,var:VM,video:fN,wbr:ON,xmp:OM};function jN(e,t){return e.all(t)}function MN(e,t){return e.toFlow(e.all(t))}function NN(){}var PN={}.hasOwnProperty;function FN(e){return{all:IN,baseFound:!1,elementById:new Map,frozenBaseUrl:void 0,handlers:{...AN,...e.handlers},inTable:!1,nodeHandlers:{...kN,...e.nodeHandlers},one:LN,options:e,patch:RN,qNesting:0,resolve:zN,toFlow:BN,toSpecificContent:VN}}function IN(e){let t=e.children||[],n=[],r=-1;for(;++r<t.length;){let i=t[r],a=this.one(i,e);Array.isArray(a)?n.push(...a):a&&n.push(a)}return n}function LN(e,t){if(e.type===`element`){if(e.properties&&e.properties.dataMdast===`ignore`)return;if(PN.call(this.handlers,e.tagName))return this.handlers[e.tagName](this,e,t)||void 0}else if(PN.call(this.nodeHandlers,e.type))return this.nodeHandlers[e.type](this,e,t)||void 0;if(`value`in e&&typeof e.value==`string`){let t={type:`text`,value:e.value};return this.patch(e,t),t}if(`children`in e)return this.all(e)}function RN(e,t){e.position&&(t.position=u(e))}function zN(e){let t=this.frozenBaseUrl;return e==null?``:t?String(new URL(e,t)):e}function BN(e){return oN(e)}function VN(e,t){let n=t(),r=[],i=[],a=-1;for(;++a<e.length;){let t=e[a];if(o(t))i.length>0&&(t.children.unshift(...i),i=[]),r.push(t);else{let e=t;i.push(e)}}if(i.length>0){let e=r[r.length-1];e||(e=t(),r.push(e)),e.children.push(...i),i=[]}return r;function o(e){return e.type===n.type}}var HN={};function UN(e,t){let n=y(e),r=t||HN,i=nM({newlines:r.newlines===!0}),a=FN(r),o;i(n),E(n,function(e){if(e&&e.type===`element`&&e.properties){let t=String(e.properties.id||``)||void 0;t&&!a.elementById.has(t)&&a.elementById.set(t,e)}});let s=a.one(n,void 0);return o=s?Array.isArray(s)?{type:`root`,children:s}:s:{type:`root`,children:[]},E(o,function(e,t,n){if(e.type===`text`&&t!==void 0&&n){let r=n.children[t-1];if(r&&r.type===e.type)return r.value+=e.value,n.children.splice(t,1),r.position&&e.position&&(r.position.end=e.position.end),t-1;if(e.value=e.value.replace(/[\t ]*(\r?\n|\r)[\t ]*/,`$1`),n&&(n.type===`heading`||n.type===`paragraph`||n.type===`root`)&&(t||(e.value=e.value.replace(/^[\t ]+/,``)),t===n.children.length-1&&(e.value=e.value.replace(/[\t ]+$/,``))),!e.value)return n.children.splice(t,1),t}}),o}var WN={document:!0};function GN(e,t){return e&&`run`in e?async function(n,r){let i=UN(n,{...WN,...t});await e.run(i,r)}:function(t){return UN(t,{...WN,...e})}}var KN={}.hasOwnProperty;function qN(e,t){let n=-1,r;if(t.extensions)for(;++n<t.extensions.length;)qN(e,t.extensions[n]);for(r in t)if(KN.call(t,r))switch(r){case`extensions`:break;case`unsafe`:JN(e[r],t[r]);break;case`join`:JN(e[r],t[r]);break;case`handlers`:YN(e[r],t[r]);break;default:e.options[r]=t[r]}return e}function JN(e,t){t&&e.push(...t)}function YN(e,t){t&&Object.assign(e,t)}var XN=[ZN];function ZN(e,t,n,r){if(t.type===`code`&&f(t,r)&&(e.type===`list`||e.type===t.type&&f(e,r)))return!1;if(`spread`in n&&typeof n.spread==`boolean`)return e.type===`paragraph`&&(e.type===t.type||t.type===`definition`||t.type===`heading`&&Ce(t,r))?void 0:+!!n.spread}var QN=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`],$N=[{character:` `,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,before:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`]},{character:`\r`,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`,`codeFencedMetaGraveAccent`,`codeFencedMetaTilde`,`destinationLiteral`,`headingAtx`]},{character:`
|
|
@@ -402,7 +402,7 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
402
402
|
`,{inlineOnly:i=!1}={}){let a=``,o=!0;return e.nodesBetween(t,n,(e,s)=>{let c=e.isText?(e.text??``).slice(Math.max(t,s)-s,n-s):i&&e.isBlock?``:EY(e);return e.isBlock&&(e.isTextblock||c.length>0)&&r&&(o?o=!1:a+=r),a+=c,!0},0),a}var OY=new Set([`*`,`_`,"`",`~`,`\\`,`$`]),kY=/^={2,}/,AY=/^<(?:[A-Za-z][A-Za-z0-9+.-]*:[^<>\s]*|[^\s<>@]+@[^\s<>]+)>/,jY=512;function MY(e,t){return AY.test(e.slice(t,t+jY))}function NY(e,t){let n=e.lastIndexOf(`<`,t);return n<0||t-n>jY?!1:AY.exec(e.slice(n,t+1))?.[0].length===t+1-n}var PY=/^<\/?[A-Za-z][A-Za-z0-9-]*(?:\s[^>]*?)?\/?>/,FY=512,IY=/^!(?=\[)/,LY=/^\[\^/,RY=/^\]\[[^\]]*\]/,zY=/^\[\[[^\][|]*\|/,BY=/^#[^\][|]*(?=\]\])/,VY=512,HY=/^\]\([^)]*\)/,UY=512,WY=/^(?:#{1,6}[ \t]+|>[ \t]?|(?:[-*+]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?)/,GY=32,KY=`|`,qY=/^(?:`{3,}[^`\n]*|~{3,}[^\n]*)$/,JY=/^(?:(?:[-*_][ \t]*){3,}|=+[ \t]*|[|\-: \t]*-[|\-: \t]*)$/,YY=1024;function XY(e,t){let n=e.indexOf(`
|
|
403
403
|
`,t),r=n===-1?e.length:n;if(r>t&&e[r-1]===`\r`&&--r,r-t>YY)return 0;let i=e.slice(t,r);return i.length===0||!qY.test(i)&&!JY.test(i)?0:i.length}function ZY(e){return e===` `||e===` `||e===`
|
|
404
404
|
`||e===`\r`||e===`\f`||e===`\v`}function QY(e,t){for(let n=t-1;n>=0;--n){let t=e[n];if(t===`
|
|
405
|
-
`)return!0;if(t!==` `&&t!==` `)return!1}return!0}function $Y(e,t){let n=e[t];if(n===void 0)return 0;if(QY(e,t)){let n=XY(e,t);if(n>0)return n}if(n===KY)return 1;if(n===`<`){let n=PY.exec(e.slice(t,t+FY))?.[0].length;return n===void 0?+!!MY(e,t):n}if(n===`>`&&NY(e,t))return 1;if(n===`=`){let n=kY.exec(e.slice(t,t+3))?.[0].length;if(n!==void 0)return n}if(n===`!`)return+!!IY.test(e.slice(t,t+2));if(OY.has(n))return 1;if(n===`[`){let n=e.slice(t,t+VY),r=zY.exec(n)?.[0].length;return r===void 0?LY.test(n)?2:1:r}if(n===`#`){let n=BY.exec(e.slice(t,t+VY))?.[0].length;if(n!==void 0)return n}if(n===`]`){if(e[t+1]===`]`)return 2;let n=e.slice(t,t+Math.max(UY,VY)),r=HY.exec(n)?.[0].length;if(r!==void 0)return r;let i=RY.exec(n)?.[0].length;return i===void 0?1:i}return QY(e,t)?WY.exec(e.slice(t,t+GY))?.[0].length??0:0}function eX(e,t,{syntaxIn:n}){let r=[];if(t.length===0)return r;let i=n===`haystack`;for(let n=0;n<e.length;n+=1){let a=e[n];if(a===void 0||ZY(a)||i&&a!==t[0]&&$Y(e,n)>0)continue;let o=n,s=0;for(;o<e.length&&s<t.length;){let n=e[o],r=t[s];if(n===r){o+=1,s+=1;continue}if(ZY(r)){s+=1;continue}if(ZY(n)){o+=1;continue}let a=i?$Y(e,o):$Y(t,s);if(a>0){i?o+=a:s+=a;continue}break}s===t.length&&r.push({start:n,end:o})}return r}var tX=8,nX=64;function rX(e,t,n,r){let i=``,a=Math.max(0,t),o=Math.min(e.length,n);for(;a<o;){let t=e[a];if(ZY(t)){a+=1;continue}if(r){let t=$Y(e,a);if(t>0){a+=t;continue}}i+=t,a+=1}return i}function iX(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[e.length-1-r]===t[t.length-1-r];)r+=1;return r}function aX(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r+=1;return r}function oX(e,t,n,{syntaxIn:r}){let i=n.prefix??``,a=n.suffix??``,o=r===`haystack`,s=0;if(i.length>0){let n=i.length*tX+nX;s+=iX(rX(i,0,i.length,!1),rX(e,t.start-n,t.start,o))}if(a.length>0){let n=a.length*tX+nX;s+=aX(rX(a,0,a.length,!1),rX(e,t.end,t.end+n,o))}return s}function sX(e){return Math.max(e*4,e+64)}var cX=`source`;function lX(e){return{ok:!1,error:e}}function uX(e){return{ok:!0,...e}}function dX(){return
|
|
405
|
+
`)return!0;if(t!==` `&&t!==` `)return!1}return!0}function $Y(e,t){let n=e[t];if(n===void 0)return 0;if(QY(e,t)){let n=XY(e,t);if(n>0)return n}if(n===KY)return 1;if(n===`<`){let n=PY.exec(e.slice(t,t+FY))?.[0].length;return n===void 0?+!!MY(e,t):n}if(n===`>`&&NY(e,t))return 1;if(n===`=`){let n=kY.exec(e.slice(t,t+3))?.[0].length;if(n!==void 0)return n}if(n===`!`)return+!!IY.test(e.slice(t,t+2));if(OY.has(n))return 1;if(n===`[`){let n=e.slice(t,t+VY),r=zY.exec(n)?.[0].length;return r===void 0?LY.test(n)?2:1:r}if(n===`#`){let n=BY.exec(e.slice(t,t+VY))?.[0].length;if(n!==void 0)return n}if(n===`]`){if(e[t+1]===`]`)return 2;let n=e.slice(t,t+Math.max(UY,VY)),r=HY.exec(n)?.[0].length;if(r!==void 0)return r;let i=RY.exec(n)?.[0].length;return i===void 0?1:i}return QY(e,t)?WY.exec(e.slice(t,t+GY))?.[0].length??0:0}function eX(e,t,{syntaxIn:n}){let r=[];if(t.length===0)return r;let i=n===`haystack`;for(let n=0;n<e.length;n+=1){let a=e[n];if(a===void 0||ZY(a)||i&&a!==t[0]&&$Y(e,n)>0)continue;let o=n,s=0;for(;o<e.length&&s<t.length;){let n=e[o],r=t[s];if(n===r){o+=1,s+=1;continue}if(ZY(r)){s+=1;continue}if(ZY(n)){o+=1;continue}let a=i?$Y(e,o):$Y(t,s);if(a>0){i?o+=a:s+=a;continue}break}s===t.length&&r.push({start:n,end:o})}return r}var tX=8,nX=64;function rX(e,t,n,r){let i=``,a=Math.max(0,t),o=Math.min(e.length,n);for(;a<o;){let t=e[a];if(ZY(t)){a+=1;continue}if(r){let t=$Y(e,a);if(t>0){a+=t;continue}}i+=t,a+=1}return i}function iX(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[e.length-1-r]===t[t.length-1-r];)r+=1;return r}function aX(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r+=1;return r}function oX(e,t,n,{syntaxIn:r}){let i=n.prefix??``,a=n.suffix??``,o=r===`haystack`,s=0;if(i.length>0){let n=i.length*tX+nX;s+=iX(rX(i,0,i.length,!1),rX(e,t.start-n,t.start,o))}if(a.length>0){let n=a.length*tX+nX;s+=aX(rX(a,0,a.length,!1),rX(e,t.end,t.end+n,o))}return s}function sX(e){return Math.max(e*4,e+64)}var cX=`source`;function lX(e){return{ok:!1,error:e}}function uX(e){return{ok:!0,...e}}function dX(){return Lf.parse({})}function fX(e,t){let n=e.toString();if(n.length===0)return dX();let r=Su(n);if(r.errors.length>0)return console.warn(`[bindConfigDoc:${t}] Y.Text contains invalid YAML; returning schema defaults. Errors: ${r.errors.map(e=>e.message).join(`; `)}`),dX();let i=r.toJSON()??{},a=Lf.safeParse(i);return a.success?a.data:(console.warn(`[bindConfigDoc:${t}] Y.Text content fails schema validation; returning schema defaults. First issue: ${a.error.issues[0]?.message??`(unknown)`}`),dX())}function pX(e,t,n={}){return zf(`config.bind`,{"config.scope":t,"config.transport":`ytext`},()=>mX(e,t,n))}function mX(e,t,n){let{ytextKey:r=cX}=n,i=e.document,a=i.getText(r),o=new Set,s=new Set,c=!1,l=!1;function u(){if(c)return;let e=fX(a,t);for(let n of o)try{n(e)}catch(e){console.warn(`[bindConfigDoc:${t}] listener threw:`,e)}}function d(){if(c||(u(),l))return;l=!0;let e=[...s];s.clear();for(let n of e)try{n()}catch(e){console.warn(`[bindConfigDoc:${t}] synced listener threw:`,e)}}a.observe(u),e.on(`synced`,d);function f(e){if(c)return lX({code:`WRITE_ERROR`,detail:`ConfigBinding (${t}) has been disposed`});let n=Gf(e,t);if(n!==null)return lX(n);let r=Su(a.toString()),o=r.contents!==null&&!ts(r.contents);if(r.errors.length>0||o){Bf(`config.corrupt-ytext-reset`,{"config.scope":t,"config.parse.errorCount":r.errors.length,"config.parse.topLevelNonMap":o});let e=r.errors.length>0?r.errors.map(e=>e.message).join(`; `):`top-level YAML is not a mapping`;console.warn(`[bindConfigDoc:${t}] dropping corrupt Y.Text and re-applying patch onto empty doc. Reason: ${e}`),r=Su(``)}r.contents===null&&(r.contents=r.createNode({}));let s=qf(r,e),l=r.toJSON()??{},u=zf(`config.validate`,{"config.scope":t,"config.validation.layer":`L1`},e=>{let t=Lf.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)Bf(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!u.success)return lX({code:`SCHEMA_INVALID`,issues:u.error.issues.map(Jf)});let d=r.toString();return i.transact(()=>{a.length>0&&a.delete(0,a.length),a.insert(0,d)}),uX({effective:u.data,appliedPaths:s})}return{current(){return fX(a,t)},patch(e){return zf(`config.patch`,{"config.scope":t,"config.transport":`ytext`},t=>{let n=f(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})},subscribe(e){return o.add(e),()=>{o.delete(e)}},hasSynced(){return l},subscribeSynced(e){if(c)return()=>{};if(l){let n=!1;return queueMicrotask(()=>{if(!(n||c))try{e()}catch(e){console.warn(`[bindConfigDoc:${t}] synced listener threw:`,e)}}),()=>{n=!0}}return s.add(e),()=>{s.delete(e)}},dispose(){c||(c=!0,a.unobserve(u),e.off(`synced`,d),o.clear(),s.clear())}}}var hX=`source`,gX=800;function _X(e){return{ok:!1,error:e}}function vX(e){return{ok:!0,...e}}function yX(e,t={}){let{ytextKey:n=hX,acceptanceDelayMs:r=gX}=t,i=e.document,a=i.getText(n),o=new Set,s=new Set,c=new Set,l=!1,u=`idle`,d=null;function f(){d!==null&&(clearTimeout(d),d=null)}function p(e){if(!l&&u!==e){u=e;for(let t of c)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] status listener threw:`,e)}}}function m(){if(l)return;let e=a.toString();for(let t of o)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] text listener threw:`,e)}}function h(e){if(!l)for(let t of s)try{t(e)}catch(e){console.warn(`[bindOkignoreDoc] rejection listener threw:`,e)}}return a.observe(m),e.on(`synced`,m),{current(){return a.toString()},patch(e){return l?_X({code:`WRITE_ERROR`,detail:`OkignoreBinding has been disposed`}):(i.transact(()=>{a.length>0&&a.delete(0,a.length),e.length>0&&a.insert(0,e)}),f(),p(`pending`),d=setTimeout(()=>{d=null,!l&&u===`pending`&&p(`accepted`)},r),vX({text:e}))},subscribe(e){return o.add(e),()=>{o.delete(e)}},subscribeRejection(e){return s.add(e),()=>{s.delete(e)}},subscribeStatus(e){return c.add(e),()=>{c.delete(e)}},status(){return u},notifyRejection(e){l||(f(),p(`rejected`),h({error:e,text:a.toString()}))},dispose(){l||(l=!0,f(),a.unobserve(m),e.off(`synced`,m),o.clear(),s.clear(),c.clear())}}}function bX(e,t,n){return xX([e,t,n],[])}function xX(e,t){if(t.length>0){let n=Uf(Lf,t);if(n?.scope===`user`)return e[0];if(n?.scope===`project`)return e[1]??e[0];if(n?.scope===`project-local`)return e[2]??e[0]}let n=SX(e);if(n===void 0)return;if(n===null)return null;if(Array.isArray(n)||typeof n!=`object`)return n;let r=e.map(e=>CX(e)?e:void 0),i=new Set;for(let e of r)if(e!==void 0)for(let t of Object.keys(e))i.add(t);let a={};for(let e of i)a[e]=xX(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function SX(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function CX(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var wX=`(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)`;RegExp(`^127\\.${wX}\\.${wX}\\.${wX}$`);var TX=2e3;function EX(e){let t=Date.now();for(let[n,r]of e.entries()){let i=r;i.timestamp&&t-i.timestamp>3e4&&e.delete(n)}}function DX(e,t){for(let[,n]of e.entries()){let e=n;if(e.timestamp&&e.timestamp>t)return!0}return!1}var OX=`#fafafa`,kX=`#171717`,AX=[`invalid-args`,`nested-project`,`target-not-empty`,`mkdir-failed`,`git-init-failed`,`init-failed`,`discovery-failed`],jX=[`.mdx`,`.md`],MX=`epoch`,NX=512*1024;function PX(e,t=NX){return typeof e==`number`&&Number.isFinite(e)&&e>t}var FX=10*1024*1024,IX={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/};function LX(){if(typeof navigator>`u`)return null;let e=navigator.userAgent;for(let[t,n]of Object.entries(IX))if(n.test(e))return t;return null}var RX=[`incoming`,`outgoing`,`both`];function zX(e){return RX.includes(e)}var BX=`open-knowledge`,VX=[`exec`,`search`,`history`,`links`,`skills`,`config`,`palette`,`preview_url`,`share_link`,`lint`,`audit`,`write`,`edit`,`delete`,`move`,`install`,`import`,`checkpoint`,`restore_version`,`conflicts`,`resolve_conflict`],HX=`https://github.com/inkeep/open-knowledge`,UX=[{id:`chart`,title:`Chart`,description:`A bar chart whose series colors track the OK chart palette.`,html:`<div style="font-family:system-ui,sans-serif;padding:20px;color:var(--foreground)">
|
|
406
406
|
<h3 style="margin:0 0 14px;font-size:15px;font-weight:600">Revenue by region</h3>
|
|
407
407
|
<div id="bars" style="display:flex;align-items:flex-end;gap:14px;height:170px"></div>
|
|
408
408
|
<script>
|
|
@@ -464,9 +464,9 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
464
464
|
out.textContent = '$' + Number(amt.value).toLocaleString();
|
|
465
465
|
});
|
|
466
466
|
<\/script>
|
|
467
|
-
</div>`}],WX=[{name:`--chart-1`,light:`oklch(0.62 0.19 259)`,dark:`oklch(0.72 0.14 259)`},{name:`--chart-2`,light:`oklch(0.58 0.14 145)`,dark:`oklch(0.73 0.13 145)`},{name:`--chart-3`,light:`oklch(0.62 0.15 70)`,dark:`oklch(0.77 0.14 70)`},{name:`--chart-4`,light:`oklch(0.55 0.18 290)`,dark:`oklch(0.72 0.16 290)`},{name:`--chart-5`,light:`oklch(0.58 0.21 25)`,dark:`oklch(0.72 0.2 25)`},{name:`--primary`,light:`oklch(0.6321 0.1983 259.59)`,dark:`#69a3ff`},{name:`--primary-foreground`,light:`oklch(0.985 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--background`,light:`oklch(1 0 0)`,dark:`oklch(0.145 0 0)`},{name:`--card`,light:`oklch(1 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--card-foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--muted-foreground`,light:`oklch(0.556 0 0)`,dark:`oklch(0.708 0 0)`},{name:`--border`,light:`oklch(0.922 0 0)`,dark:`oklch(1 0 0 / 10%)`},{name:`--destructive`,light:`oklch(0.577 0.245 27.325)`,dark:`oklch(0.704 0.191 22.216)`},{name:`--radius`,light:`0.625rem`,dark:`0.625rem`}],GX=Object.freeze([{value:`workflow-fit`,label:`It didn't fit into my workflow`},{value:`missing-feature`,label:`It was missing a feature I needed`},{value:`hard-to-start`,label:`It was too hard to set up or get started`},{value:`unreliable`,label:`Bugs, crashes, or it felt unreliable`},{value:`switched-tool`,label:`I'm switching to another tool`},{value:`one-off`,label:`It was a trial or one-off project`},{value:`other`,label:`Something else`}]),KX=1e4;new Set(GX.map(e=>e.value));var qX=ME.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`},sourceClosingFenceLength:{default:null,rendered:!1},sourceUnclosedFence:{default:!1,rendered:!1},sourceFenceIndent:{default:null,rendered:!1},sourceInfoPadding:{default:null,rendered:!1},sourceIndents:{default:null,rendered:!1}}}}),JX=GE.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[rE({find:BE,type:this.type,getAttributes:{sourceDelimiter:`*`}}),rE({find:HE,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),YX=zE.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[rE({find:PE,type:this.type,getAttributes:{sourceDelimiter:`**`}}),rE({find:IE,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),XX=MT.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),ZX=TE.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":n,id:`fn-${n}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${n}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}});function QX({node:e}){return``.repeat(e.nodeSize-e.content.size)}function $X(e){let t=0;for(let n of e){let e=Number.parseInt(n,10);!Number.isNaN(e)&&e>t&&(t=e)}return String(t+1)}function eZ(e){let t=[];return e.descendants(e=>(e.type.name===`footnoteDefinition`&&t.push(String(e.attrs.identifier??``)),!0)),t}function tZ(e){let t=null;return e.forEach((e,n)=>{e.type.name===`footnoteDefinition`&&(t=n+e.nodeSize)}),t??e.content.size}var nZ=TE.create({name:`footnoteReference`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,renderText:QX,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){return[{tag:`sup[data-footnote-ref]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}}}]},renderHTML({node:e}){let t=String(e.attrs.identifier??``);return[`sup`,{id:`fnref-${t}`,"data-footnote-ref":``,"data-footnote-id":t,class:`footnote-ref`},[`a`,{href:`#fn-${t}`,class:`footnote-ref-link`},`[${t}]`]]},addCommands(){return{insertFootnoteReference:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e}})}}}),rZ=qE.extend({marks:`_`,priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`},sourceRaw:{default:null}}}}),iZ=YE.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1},sourceLeadingIndent:{default:null,rendered:!1},sourceInteriorSpacing:{default:null,rendered:!1}}}}),aZ=TE.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}}),oZ=TE.create({name:`imageReference`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:QX,addAttributes(){return{alt:{default:``},label:{default:``},identifier:{default:``},referenceType:{default:`shortcut`}}},parseHTML(){return[{tag:`img[data-image-reference]`}]},renderHTML({node:e}){let{alt:t,label:n,referenceType:r}=e.attrs;return[`img`,{"data-image-reference":``,"data-reference-type":r,"data-label":n,alt:t||n}]}});function sZ(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}var cZ=ZE.extend({marks:`_`,priority:60,renderText:QX,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=gw(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=sZ(t.src)),[`img`,t]}}),lZ=TE.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),uZ=TE.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,renderText:QX,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`span[data-jsx-inline]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-jsx-inline":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]}}),dZ=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],fZ=dZ.map(e=>`${e}:`).join(`|`),pZ=RegExp(`^(?:${fZ}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function mZ(e){let t=e.trim();return t===``?!0:pZ.test(t)}function hZ(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}var gZ=new Set(dZ.map(e=>`${e}:`)),_Z=`https://placeholder.invalid`;function vZ(e){try{let t=new URL(e,_Z);return gZ.has(t.protocol.toLowerCase())}catch{return!1}}var yZ=Nte.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:vZ,validate:vZ,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1},sourceUrlForm:{default:null,rendered:!1},sourceTitleMarker:{default:null,rendered:!1}}}}),bZ=TE.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`]}});function xZ(e){return e.type.name===`list`&&!e.attrs.ordered}function SZ(e){return e.type.name===`list`&&!!e.attrs.ordered}function CZ(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function wZ(e,t,n,r,i,a,o){let s=ow(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?av(r)(e,t):!1}if(s){if(!t)return!0;let{tr:n}=e;return n.setNodeMarkup(s.pos,void 0,{...s.node.attrs,...a}),o!==void 0&&s.node.forEach((e,t)=>{if(e.type.name===`listItem`){let r=s.pos+1+t;n.setNodeMarkup(r,void 0,{...e.attrs,...o})}}),t(n),!0}return nv(n,a)(e,void 0)?t?nv(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}var TZ=TE.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.ordered?`ol`:`ul`,r={};return e.attrs.ordered&&e.attrs.start!==1&&(r.start=e.attrs.start),[n,gw(t,r),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:wZ(e,t,n,r,e=>xZ(e)&&!CZ(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:wZ(e,t,n,r,e=>SZ(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:wZ(e,t,n,r,e=>xZ(e)&&CZ(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[oE({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]}),joinPredicate:(e,t)=>t.attrs.ordered===!1}),oE({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]}),joinPredicate:(e,t)=>t.attrs.ordered===!0}),new wT({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:n})=>{let r=e.schema.nodes.list;if(!r)return null;let i=n[1]!==` `,a=e.tr.delete(t.from,t.to),o=a.doc.resolve(t.from).blockRange();if(!o)return null;let s=Eg(o,r,{ordered:!1});if(!s)return null;a.wrap(o,s);let c=a.doc.resolve(a.mapping.map(t.from));for(let e=c.depth;e>0;e--){let t=c.node(e);if(t.type.name===`listItem`){a.setNodeMarkup(c.before(e),void 0,{...t.attrs,checked:i});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),EZ=TE.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1},sourceMarkerSpacing:{default:null,rendered:!1},sourceOrdinal:{default:null,rendered:!1},sourceCheckboxChar:{default:null,rendered:!1},sourceContinuationIndent:{default:null,rendered:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,gw(t),0]:[`li`,gw(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:n,HTMLAttributes:r})=>{let i=document.createElement(`li`);Object.entries(gw(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`),c=()=>{o&&(o.disabled=!n.isEditable)};return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,c(),n.on(`update`,c),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,o.disabled=!n.isEditable,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)},destroy(){n.off(`update`,c)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),DZ=TZ,OZ=EZ,kZ=TE.create({name:`mathInline`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:QX,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`},sourceDelimiter:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),AZ=TE.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){let e=e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``};return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e},{tag:`pre[data-raw-mdx-fallback]`,getAttrs:e}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let n=document.createElement(`pre`);return n.classList.add(`raw-mdx-fallback-content`),n.setAttribute(`contenteditable`,`false`),t.appendChild(n),{dom:t,contentDOM:n,ignoreMutation:()=>!0}}}}),jZ=qne.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),MZ=Xne.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),NZ=TE.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),PZ=MT.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),FZ=VT.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}});function IZ(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return t;return null}function LZ(e){let t=!1;return e.descendants(e=>t?!1:(e.type.name===`list`&&(t=!0),!t)),t}function RZ(e){let{selection:t}=e;return t instanceof K?t.$cursor:null}function zZ(e){let t=RZ(e);if(!t||t.parentOffset!==0)return!1;let n=IZ(t);if(n===null||t.depth!==n+1||t.index(n)!==0)return!1;let r=t.index(n-1);return r===0?!1:LZ(t.node(n-1).child(r-1))}function BZ(e,t){for(let n=t-1;n>=0;n--){let t=e.node(n),r=e.index(n);if(r<t.childCount-1){let e=t.child(r+1),i=n+1;for(;e.type.name===`list`&&e.firstChild;)e=e.firstChild,i+=1;return e.type.name===`listItem`?i:null}}return null}function VZ(e){let t=RZ(e);if(!t||t.parentOffset!==t.parent.content.size)return!1;let n=IZ(t);if(n===null)return!1;for(let e=t.depth;e>n;e--)if(t.index(e-1)!==t.node(e-1).childCount-1)return!1;let r=BZ(t,n);return r!==null&&r<n}var HZ=VT.create({name:`listBoundaryMerge`,addKeyboardShortcuts(){let e=()=>{let{editor:e}=this;if(!zZ(e.state))return!1;if(e.commands.undoInputRule())return!0;let{state:t,view:n}=e;return S_(t,n.dispatch,n)},t=()=>{let{editor:e}=this;if(!VZ(e.state))return!1;let{state:t,view:n}=e;return C_(t,n.dispatch,n)};return{Backspace:e,"Mod-Backspace":e,Delete:t,"Mod-Delete":t}}}),UZ=VT.create({name:`plainTextClipboard`,priority:1e3,addProseMirrorPlugins(){return[new h_({key:new v_(`okPlainTextClipboard`),props:{clipboardTextSerializer:e=>e.content.textBetween(0,e.content.size,`
|
|
467
|
+
</div>`}],WX=[{name:`--chart-1`,light:`oklch(0.62 0.19 259)`,dark:`oklch(0.72 0.14 259)`},{name:`--chart-2`,light:`oklch(0.58 0.14 145)`,dark:`oklch(0.73 0.13 145)`},{name:`--chart-3`,light:`oklch(0.62 0.15 70)`,dark:`oklch(0.77 0.14 70)`},{name:`--chart-4`,light:`oklch(0.55 0.18 290)`,dark:`oklch(0.72 0.16 290)`},{name:`--chart-5`,light:`oklch(0.58 0.21 25)`,dark:`oklch(0.72 0.2 25)`},{name:`--primary`,light:`oklch(0.6321 0.1983 259.59)`,dark:`#69a3ff`},{name:`--primary-foreground`,light:`oklch(0.985 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--background`,light:`oklch(1 0 0)`,dark:`oklch(0.145 0 0)`},{name:`--card`,light:`oklch(1 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--card-foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--muted-foreground`,light:`oklch(0.556 0 0)`,dark:`oklch(0.708 0 0)`},{name:`--border`,light:`oklch(0.922 0 0)`,dark:`oklch(1 0 0 / 10%)`},{name:`--destructive`,light:`oklch(0.577 0.245 27.325)`,dark:`oklch(0.704 0.191 22.216)`},{name:`--radius`,light:`0.625rem`,dark:`0.625rem`}],GX=Object.freeze([{value:`workflow-fit`,label:`It didn't fit into my workflow`},{value:`missing-feature`,label:`It was missing a feature I needed`},{value:`hard-to-start`,label:`It was too hard to set up or get started`},{value:`unreliable`,label:`Bugs, crashes, or it felt unreliable`},{value:`switched-tool`,label:`I'm switching to another tool`},{value:`one-off`,label:`It was a trial or one-off project`},{value:`other`,label:`Something else`}]),KX=1e4;new Set(GX.map(e=>e.value));var qX=ME.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`},sourceClosingFenceLength:{default:null,rendered:!1},sourceUnclosedFence:{default:!1,rendered:!1},sourceFenceIndent:{default:null,rendered:!1},sourceInfoPadding:{default:null,rendered:!1},sourceIndents:{default:null,rendered:!1}}}}),JX=GE.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[rE({find:BE,type:this.type,getAttributes:{sourceDelimiter:`*`}}),rE({find:HE,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),YX=zE.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[rE({find:PE,type:this.type,getAttributes:{sourceDelimiter:`**`}}),rE({find:IE,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),XX=MT.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),ZX=TE.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":n,id:`fn-${n}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${n}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}});function QX({node:e}){return``.repeat(e.nodeSize-e.content.size)}function $X(e){let t=0;for(let n of e){let e=Number.parseInt(n,10);!Number.isNaN(e)&&e>t&&(t=e)}return String(t+1)}function eZ(e){let t=[];return e.descendants(e=>(e.type.name===`footnoteDefinition`&&t.push(String(e.attrs.identifier??``)),!0)),t}function tZ(e){let t=null;return e.forEach((e,n)=>{e.type.name===`footnoteDefinition`&&(t=n+e.nodeSize)}),t??e.content.size}var nZ=TE.create({name:`footnoteReference`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,renderText:QX,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){return[{tag:`sup[data-footnote-ref]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}}}]},renderHTML({node:e}){let t=String(e.attrs.identifier??``);return[`sup`,{id:`fnref-${t}`,"data-footnote-ref":``,"data-footnote-id":t,class:`footnote-ref`},[`a`,{href:`#fn-${t}`,class:`footnote-ref-link`},`[${t}]`]]},addCommands(){return{insertFootnoteReference:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e}})}}}),rZ=qE.extend({marks:`_`,priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`},sourceRaw:{default:null}}}}),iZ=YE.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1},sourceLeadingIndent:{default:null,rendered:!1},sourceInteriorSpacing:{default:null,rendered:!1}}}}),aZ=TE.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}}),oZ=TE.create({name:`imageReference`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:QX,addAttributes(){return{alt:{default:``},label:{default:``},identifier:{default:``},referenceType:{default:`shortcut`}}},parseHTML(){return[{tag:`img[data-image-reference]`}]},renderHTML({node:e}){let{alt:t,label:n,referenceType:r}=e.attrs;return[`img`,{"data-image-reference":``,"data-reference-type":r,"data-label":n,alt:t||n}]}});function sZ(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}var cZ=ZE.extend({marks:`_`,priority:60,renderText:QX,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=gw(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=sZ(t.src)),[`img`,t]}}),lZ=TE.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),uZ=TE.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,renderText:QX,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`span[data-jsx-inline]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-jsx-inline":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]}}),dZ=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],fZ=dZ.map(e=>`${e}:`).join(`|`),pZ=RegExp(`^(?:${fZ}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function mZ(e){let t=e.trim();return t===``?!0:pZ.test(t)}function hZ(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}var gZ=new Set(dZ.map(e=>`${e}:`)),_Z=`https://placeholder.invalid`;function vZ(e){try{let t=new URL(e,_Z);return gZ.has(t.protocol.toLowerCase())}catch{return!1}}var yZ=Nte.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:vZ,validate:vZ,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1},sourceUrlForm:{default:null,rendered:!1},sourceTitleMarker:{default:null,rendered:!1}}}}),bZ=TE.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`]}});function xZ(e){return e.type.name===`list`&&!e.attrs.ordered}function SZ(e){return e.type.name===`list`&&!!e.attrs.ordered}function CZ(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function wZ(e,t,n,r,i,a,o){let s=ow(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?av(r)(e,t):!1}if(s){if(!t)return!0;let{tr:n}=e;return n.setNodeMarkup(s.pos,void 0,{...s.node.attrs,...a}),o!==void 0&&s.node.forEach((e,t)=>{if(e.type.name===`listItem`){let r=s.pos+1+t;n.setNodeMarkup(r,void 0,{...e.attrs,...o})}}),t(n),!0}return nv(n,a)(e,void 0)?t?nv(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}var TZ=TE.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.ordered?`ol`:`ul`,r={};return e.attrs.ordered&&e.attrs.start!==1&&(r.start=e.attrs.start),[n,gw(t,r),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:wZ(e,t,n,r,e=>xZ(e)&&!CZ(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:wZ(e,t,n,r,e=>SZ(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:wZ(e,t,n,r,e=>xZ(e)&&CZ(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[oE({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]}),joinPredicate:(e,t)=>t.attrs.ordered===!1}),oE({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]}),joinPredicate:(e,t)=>t.attrs.ordered===!0}),new wT({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:n})=>{let r=e.schema.nodes.list;if(!r)return null;let i=n[1]!==` `,a=e.tr.delete(t.from,t.to),o=a.doc.resolve(t.from).blockRange();if(!o)return null;let s=Dg(o,r,{ordered:!1});if(!s)return null;a.wrap(o,s);let c=a.doc.resolve(a.mapping.map(t.from));for(let e=c.depth;e>0;e--){let t=c.node(e);if(t.type.name===`listItem`){a.setNodeMarkup(c.before(e),void 0,{...t.attrs,checked:i});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),EZ=TE.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1},sourceMarkerSpacing:{default:null,rendered:!1},sourceOrdinal:{default:null,rendered:!1},sourceCheckboxChar:{default:null,rendered:!1},sourceContinuationIndent:{default:null,rendered:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,gw(t),0]:[`li`,gw(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:n,HTMLAttributes:r})=>{let i=document.createElement(`li`);Object.entries(gw(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`),c=()=>{o&&(o.disabled=!n.isEditable)};return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,c(),n.on(`update`,c),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,o.disabled=!n.isEditable,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)},destroy(){n.off(`update`,c)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),DZ=TZ,OZ=EZ,kZ=TE.create({name:`mathInline`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:QX,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`},sourceDelimiter:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),AZ=TE.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){let e=e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``};return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e},{tag:`pre[data-raw-mdx-fallback]`,getAttrs:e}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let n=document.createElement(`pre`);return n.classList.add(`raw-mdx-fallback-content`),n.setAttribute(`contenteditable`,`false`),t.appendChild(n),{dom:t,contentDOM:n,ignoreMutation:()=>!0}}}}),jZ=qne.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),MZ=Xne.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),NZ=TE.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),PZ=MT.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),FZ=VT.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}});function IZ(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return t;return null}function LZ(e){let t=!1;return e.descendants(e=>t?!1:(e.type.name===`list`&&(t=!0),!t)),t}function RZ(e){let{selection:t}=e;return t instanceof K?t.$cursor:null}function zZ(e){let t=RZ(e);if(!t||t.parentOffset!==0)return!1;let n=IZ(t);if(n===null||t.depth!==n+1||t.index(n)!==0)return!1;let r=t.index(n-1);return r===0?!1:LZ(t.node(n-1).child(r-1))}function BZ(e,t){for(let n=t-1;n>=0;n--){let t=e.node(n),r=e.index(n);if(r<t.childCount-1){let e=t.child(r+1),i=n+1;for(;e.type.name===`list`&&e.firstChild;)e=e.firstChild,i+=1;return e.type.name===`listItem`?i:null}}return null}function VZ(e){let t=RZ(e);if(!t||t.parentOffset!==t.parent.content.size)return!1;let n=IZ(t);if(n===null)return!1;for(let e=t.depth;e>n;e--)if(t.index(e-1)!==t.node(e-1).childCount-1)return!1;let r=BZ(t,n);return r!==null&&r<n}var HZ=VT.create({name:`listBoundaryMerge`,addKeyboardShortcuts(){let e=()=>{let{editor:e}=this;if(!zZ(e.state))return!1;if(e.commands.undoInputRule())return!0;let{state:t,view:n}=e;return S_(t,n.dispatch,n)},t=()=>{let{editor:e}=this;if(!VZ(e.state))return!1;let{state:t,view:n}=e;return C_(t,n.dispatch,n)};return{Backspace:e,"Mod-Backspace":e,Delete:t,"Mod-Delete":t}}}),UZ=VT.create({name:`plainTextClipboard`,priority:1e3,addProseMirrorPlugins(){return[new h_({key:new v_(`okPlainTextClipboard`),props:{clipboardTextSerializer:e=>e.content.textBetween(0,e.content.size,`
|
|
468
468
|
|
|
469
|
-
`)}})]}}),WZ=new Map([[32,` `],[9,` `],[160,`\xA0`]]);function GZ(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function KZ(e){let t=GZ(e);return t!==null&&WZ.has(t)}function qZ(e){let t=GZ(e);return t===null?null:WZ.get(t)??null}var JZ=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function YZ(e){JZ.lastIndex=0;let t=e.match(JZ);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=qZ(e);if(t===null)return null;n+=t}return n}var XZ=MT.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function ZZ(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r||QZ(n)===r?!0:YZ(e)===t}function QZ(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}var $Z=pre.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),eQ=uA.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),tQ=rA.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),nQ=iA.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),rQ=TE.create({name:`tag`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:QX,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),iQ=/^(?:---|—-|___\s|\*\*\*\s)$/;function aQ(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}var oQ=Qne.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[iE({find:iQ,type:this.type,getAttributes:e=>({sourceRaw:aQ(e)})})]}}),sQ=hre.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceForm:{default:`u`,rendered:!1}}}}),cQ=/^\[\[([^[\]|#]+?)(?:#([^\]|]+?))?(?:\|([^\]]+?))?\]\]/;function lQ(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function uQ(e){let t=e.match(cQ);if(!t)return null;let n=t[1]?.trim()??``;return n?{type:`wikilink`,raw:t[0],target:n,anchor:lQ(t[2]),alias:lQ(t[3])}:null}function dQ(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var fQ=TE.create({name:`wikiLink`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:QX,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:lQ(e.getAttribute(`data-alias`)),anchor:lQ(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:lQ(e.getAttribute(`data-alias`)),anchor:lQ(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=lQ(e.attrs.alias),i=lQ(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},dQ({target:n,alias:r,anchor:i})]}});function pQ(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function mQ(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var hQ=TE.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:QX,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:lQ(e.getAttribute(`data-alias`)),anchor:lQ(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=lQ(e.attrs.alias),i=lQ(e.attrs.anchor),a=lQ(e.attrs.resolvedSrc),o=pQ(n);if(Yu.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},mQ({target:n,alias:r,anchor:i})]}}),gQ=[lZ,AZ,uZ,kZ,fQ,hQ,rQ,DZ,OZ,JX,YX,$Z,sQ,MZ,qX,jZ,iZ,oQ,yZ,aZ,bZ,rZ,XX,FZ,XZ,UZ,hj.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:{listTypes:[{itemName:`listItem`,wrapperNames:[`list`]}]},italic:!1,bold:!1,strike:!1,underline:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),HZ,eQ.configure({resizable:!0}),aA,nQ,tQ,cZ.configure({inline:!0}),oZ,Ite,PZ,NZ,nZ,ZX];function _Q(e){let t=e.indexOf(`/`);return t===-1?e:e.slice(t+1)}function vQ(e,t){let n=encodeURIComponent(t.projectDir);if(t.prompt===``)return`claude://${e.mode}/new?folder=${n}`;let r=encodeURIComponent(t.prompt);return`claude://${e.mode}/new?q=${r}&folder=${n}`}function yQ(e){let t=encodeURIComponent(e.projectDir);return e.prompt===``?`codex://new?path=${t}`:`codex://new?prompt=${encodeURIComponent(e.prompt)}&path=${t}`}function bQ(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?e:e.substring(t+1)}function xQ(e){let t=encodeURIComponent(bQ(e.projectDir));return e.prompt===``?`cursor://anysphere.cursor-deeplink/prompt?workspace=${t}&mode=agent`:`cursor://anysphere.cursor-deeplink/prompt?text=${encodeURIComponent(encodeURIComponent(e.prompt))}&workspace=${t}&mode=agent`}function SQ(e){return`'${e.replace(/'/g,`'\\''`)}'`}var CQ=[`mcp__${BX}`,`Bash(ok open:*)`],wQ=[`delete`,`move`,`share_link`,`install`,`import`].map(e=>`mcp__${BX}__${e}`),TQ=`-c ${SQ(`mcp_servers.${BX}.default_tools_approval_mode="approve"`)}`;function EQ(e){let t={};return e.mcpPreApprove===!0&&(t.enabledMcpjsonServers=[BX]),e.autoApproveOkTools===!0&&(t.permissions={allow:[...CQ],ask:[...wQ]}),t.enabledMcpjsonServers===void 0&&t.permissions===void 0?``:`--settings ${SQ(JSON.stringify(t))}`}var DQ=`\x1B`,OQ=`${DQ}[200~`,kQ=`${DQ}[201~`,AQ={claude:{bin:`claude`,displayName:`Claude`,docsUrl:`https://docs.claude.com/en/docs/claude-code`,handoffTarget:`claude-code`},codex:{bin:`codex`,displayName:`Codex`,docsUrl:`https://developers.openai.com/codex/cli`,handoffTarget:`codex`,autoApproveArg:TQ},copilot:{bin:`copilot`,displayName:`GitHub Copilot`,docsUrl:`https://docs.github.com/en/copilot/how-tos/copilot-cli/cli-getting-started`,handoffTarget:`copilot`,promptFlag:`--interactive`},cursor:{bin:`cursor-agent`,displayName:`Cursor`,docsUrl:`https://cursor.com/docs/cli/overview`,handoffTarget:`cursor`},opencode:{bin:`opencode`,displayName:`OpenCode`,docsUrl:`https://opencode.ai/docs`,handoffTarget:`opencode`,promptFlag:`--prompt`},pi:{bin:`pi`,displayName:`Pi`,docsUrl:`https://pi.dev`,handoffTarget:`pi`},antigravity:{bin:`agy`,displayName:`Antigravity`,docsUrl:`https://antigravity.google/docs/cli-getting-started`,handoffTarget:`antigravity`,promptFlag:`--prompt-interactive`},openclaw:{bin:`openclaw`,subcommand:`chat`,displayName:`OpenClaw`,docsUrl:`https://docs.openclaw.ai/cli/tui`,handoffTarget:`openclaw`,promptFlag:`--message`},hermes:{bin:`hermes`,subcommand:`chat`,displayName:`Hermes`,docsUrl:`https://hermes-agent.nousresearch.com/docs/user-guide/cli`,handoffTarget:`hermes`,startupInjection:{submit:`\r`,readyMarker:`\x1B[?2004h`,settleMs:300,capMs:4e3}}},jQ=[`claude`,`codex`,`opencode`,`cursor`,`copilot`,`pi`,`antigravity`,`openclaw`,`hermes`];function MQ(e,t,n={}){let r=AQ[e],i=e===`claude`?EQ(n):n.autoApproveOkTools===!0&&r.autoApproveArg?r.autoApproveArg:``,a=i?`${i} `:``,o=r.subcommand?`${r.subcommand} `:``;if(r.startupInjection!=null||t==null||t.length===0)return`${r.bin} ${o}${a}`.trimEnd();let s=r.promptFlag?`${r.promptFlag} `:``;return`${r.bin} ${o}${a}${s}${SQ(t)}`}function NQ(e){return AQ[e].startupInjection}function PQ(e,t){let n=NQ(e);return n==null||t==null||t.length===0?null:`${OQ}${t.replaceAll(DQ,``)}${kQ}${n.submit}`}var FQ=RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`),IQ=RegExp("[ \\u00a0\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`);function LQ(e){return e.replace(FQ,`_`)}function RQ(e){return e.replace(IQ,`_`)}var zQ="This is an OpenKnowledge project: load the `open-knowledge` skill and use the OpenKnowledge MCP tools for all markdown — don't probe for `.ok/` or use native file tools on `.md` / `.mdx`.";function BQ(e){return`${zQ} ${e}`}var VQ=`You're running in the terminal of the OpenKnowledge desktop app.`,HQ=`You're an agent working inside OpenKnowledge, with its MCP tools available to you.`;function UQ(e){return`${HQ} ${zQ} ${e===null?`Then stop.`:`Read \`${LQ(e)}\` via the OpenKnowledge MCP server, then stop.`}`}function WQ(e){return`${VQ} ${zQ} ${e===null?`Then stop.`:`Read \`${LQ(e)}\` via the OpenKnowledge MCP server, then stop.`}`}function GQ(e,t,n,r=`url`){let i=`Let's work on \`${LQ(e)}\` using OpenKnowledge.`;return m$(t?`${i} Open the OK editor in web view.`:i,n,r)}function KQ(e,t,n){let r=`Use your open-knowledge-write-skill skill to author the ${t} Open Knowledge skill \`${LQ(e)}\`. Edit it with the Open Knowledge tools.`;return n?`${r} Open the OK editor in web view.`:r}function qQ(e,t,n,r=`url`){let i=`Let's work on the \`${LQ(e)}\` folder using OpenKnowledge.`;return m$(t?`${i} Open the OK editor in web view.`:i,n,r)}function JQ(e,t,n=`url`){let r=`Let's work on this project using OpenKnowledge.`;return m$(e?`${r} Open the OK editor in web view.`:r,t,n)}function YQ(e,t,n,r,i=`url`){let a=t?`Open the OK editor in web view.`:``,o=e=>a===``?e:e.includes(`
|
|
469
|
+
`)}})]}}),WZ=new Map([[32,` `],[9,` `],[160,`\xA0`]]);function GZ(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function KZ(e){let t=GZ(e);return t!==null&&WZ.has(t)}function qZ(e){let t=GZ(e);return t===null?null:WZ.get(t)??null}var JZ=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function YZ(e){JZ.lastIndex=0;let t=e.match(JZ);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=qZ(e);if(t===null)return null;n+=t}return n}var XZ=MT.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function ZZ(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r||QZ(n)===r?!0:YZ(e)===t}function QZ(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}var $Z=pre.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),eQ=uA.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),tQ=rA.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),nQ=iA.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),rQ=TE.create({name:`tag`,marks:`_`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,renderText:QX,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),iQ=/^(?:---|—-|___\s|\*\*\*\s)$/;function aQ(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}var oQ=Qne.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[iE({find:iQ,type:this.type,getAttributes:e=>({sourceRaw:aQ(e)})})]}}),sQ=hre.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceForm:{default:`u`,rendered:!1}}}}),cQ=/^\[\[([^[\]|#]+?)(?:#([^\]|]+?))?(?:\|([^\]]+?))?\]\]/;function lQ(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function uQ(e){let t=e.match(cQ);if(!t)return null;let n=t[1]?.trim()??``;return n?{type:`wikilink`,raw:t[0],target:n,anchor:lQ(t[2]),alias:lQ(t[3])}:null}function dQ(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var fQ=TE.create({name:`wikiLink`,marks:`_`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:QX,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:lQ(e.getAttribute(`data-alias`)),anchor:lQ(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:lQ(e.getAttribute(`data-alias`)),anchor:lQ(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=lQ(e.attrs.alias),i=lQ(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},dQ({target:n,alias:r,anchor:i})]}});function pQ(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function mQ(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var hQ=TE.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,renderText:QX,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:lQ(e.getAttribute(`data-alias`)),anchor:lQ(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=lQ(e.attrs.alias),i=lQ(e.attrs.anchor),a=lQ(e.attrs.resolvedSrc),o=pQ(n);if(Xu.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},mQ({target:n,alias:r,anchor:i})]}}),gQ=[lZ,AZ,uZ,kZ,fQ,hQ,rQ,DZ,OZ,JX,YX,$Z,sQ,MZ,qX,jZ,iZ,oQ,yZ,aZ,bZ,rZ,XX,FZ,XZ,UZ,hj.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:{listTypes:[{itemName:`listItem`,wrapperNames:[`list`]}]},italic:!1,bold:!1,strike:!1,underline:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),HZ,eQ.configure({resizable:!0}),aA,nQ,tQ,cZ.configure({inline:!0}),oZ,Ite,PZ,NZ,nZ,ZX];function _Q(e){let t=e.indexOf(`/`);return t===-1?e:e.slice(t+1)}function vQ(e,t){let n=encodeURIComponent(t.projectDir);if(t.prompt===``)return`claude://${e.mode}/new?folder=${n}`;let r=encodeURIComponent(t.prompt);return`claude://${e.mode}/new?q=${r}&folder=${n}`}function yQ(e){let t=encodeURIComponent(e.projectDir);return e.prompt===``?`codex://new?path=${t}`:`codex://new?prompt=${encodeURIComponent(e.prompt)}&path=${t}`}function bQ(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?e:e.substring(t+1)}function xQ(e){let t=encodeURIComponent(bQ(e.projectDir));return e.prompt===``?`cursor://anysphere.cursor-deeplink/prompt?workspace=${t}&mode=agent`:`cursor://anysphere.cursor-deeplink/prompt?text=${encodeURIComponent(encodeURIComponent(e.prompt))}&workspace=${t}&mode=agent`}function SQ(e){return`'${e.replace(/'/g,`'\\''`)}'`}var CQ=[`mcp__${BX}`,`Bash(ok open:*)`],wQ=[`delete`,`move`,`share_link`,`install`,`import`].map(e=>`mcp__${BX}__${e}`),TQ=`-c ${SQ(`mcp_servers.${BX}.default_tools_approval_mode="approve"`)}`;function EQ(e){let t={};return e.mcpPreApprove===!0&&(t.enabledMcpjsonServers=[BX]),e.autoApproveOkTools===!0&&(t.permissions={allow:[...CQ],ask:[...wQ]}),t.enabledMcpjsonServers===void 0&&t.permissions===void 0?``:`--settings ${SQ(JSON.stringify(t))}`}var DQ=`\x1B`,OQ=`${DQ}[200~`,kQ=`${DQ}[201~`,AQ={claude:{bin:`claude`,displayName:`Claude`,docsUrl:`https://docs.claude.com/en/docs/claude-code`,handoffTarget:`claude-code`},codex:{bin:`codex`,displayName:`Codex`,docsUrl:`https://developers.openai.com/codex/cli`,handoffTarget:`codex`,autoApproveArg:TQ},copilot:{bin:`copilot`,displayName:`GitHub Copilot`,docsUrl:`https://docs.github.com/en/copilot/how-tos/copilot-cli/cli-getting-started`,handoffTarget:`copilot`,promptFlag:`--interactive`},cursor:{bin:`cursor-agent`,displayName:`Cursor`,docsUrl:`https://cursor.com/docs/cli/overview`,handoffTarget:`cursor`},opencode:{bin:`opencode`,displayName:`OpenCode`,docsUrl:`https://opencode.ai/docs`,handoffTarget:`opencode`,promptFlag:`--prompt`},pi:{bin:`pi`,displayName:`Pi`,docsUrl:`https://pi.dev`,handoffTarget:`pi`},antigravity:{bin:`agy`,displayName:`Antigravity`,docsUrl:`https://antigravity.google/docs/cli-getting-started`,handoffTarget:`antigravity`,promptFlag:`--prompt-interactive`},openclaw:{bin:`openclaw`,subcommand:`chat`,displayName:`OpenClaw`,docsUrl:`https://docs.openclaw.ai/cli/tui`,handoffTarget:`openclaw`,promptFlag:`--message`},hermes:{bin:`hermes`,subcommand:`chat`,displayName:`Hermes`,docsUrl:`https://hermes-agent.nousresearch.com/docs/user-guide/cli`,handoffTarget:`hermes`,startupInjection:{submit:`\r`,readyMarker:`\x1B[?2004h`,settleMs:300,capMs:4e3}}},jQ=[`claude`,`codex`,`opencode`,`cursor`,`copilot`,`pi`,`antigravity`,`openclaw`,`hermes`];function MQ(e,t,n={}){let r=AQ[e],i=e===`claude`?EQ(n):n.autoApproveOkTools===!0&&r.autoApproveArg?r.autoApproveArg:``,a=i?`${i} `:``,o=r.subcommand?`${r.subcommand} `:``;if(r.startupInjection!=null||t==null||t.length===0)return`${r.bin} ${o}${a}`.trimEnd();let s=r.promptFlag?`${r.promptFlag} `:``;return`${r.bin} ${o}${a}${s}${SQ(t)}`}function NQ(e){return AQ[e].startupInjection}function PQ(e,t){let n=NQ(e);return n==null||t==null||t.length===0?null:`${OQ}${t.replaceAll(DQ,``)}${kQ}${n.submit}`}var FQ=RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`),IQ=RegExp("[ \\u00a0\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`);function LQ(e){return e.replace(FQ,`_`)}function RQ(e){return e.replace(IQ,`_`)}var zQ="This is an OpenKnowledge project: load the `open-knowledge` skill and use the OpenKnowledge MCP tools for all markdown — don't probe for `.ok/` or use native file tools on `.md` / `.mdx`.";function BQ(e){return`${zQ} ${e}`}var VQ=`You're running in the terminal of the OpenKnowledge desktop app.`,HQ=`You're an agent working inside OpenKnowledge, with its MCP tools available to you.`;function UQ(e){return`${HQ} ${zQ} ${e===null?`Then stop.`:`Read \`${LQ(e)}\` via the OpenKnowledge MCP server, then stop.`}`}function WQ(e){return`${VQ} ${zQ} ${e===null?`Then stop.`:`Read \`${LQ(e)}\` via the OpenKnowledge MCP server, then stop.`}`}function GQ(e,t,n,r=`url`){let i=`Let's work on \`${LQ(e)}\` using OpenKnowledge.`;return m$(t?`${i} Open the OK editor in web view.`:i,n,r)}function KQ(e,t,n){let r=`Use your open-knowledge-write-skill skill to author the ${t} Open Knowledge skill \`${LQ(e)}\`. Edit it with the Open Knowledge tools.`;return n?`${r} Open the OK editor in web view.`:r}function qQ(e,t,n,r=`url`){let i=`Let's work on the \`${LQ(e)}\` folder using OpenKnowledge.`;return m$(t?`${i} Open the OK editor in web view.`:i,n,r)}function JQ(e,t,n=`url`){let r=`Let's work on this project using OpenKnowledge.`;return m$(e?`${r} Open the OK editor in web view.`:r,t,n)}function YQ(e,t,n,r,i=`url`){let a=t?`Open the OK editor in web view.`:``,o=e=>a===``?e:e.includes(`
|
|
470
470
|
`)?[e,``,a].join(`
|
|
471
471
|
`):`${e} ${a}`,s=e=>e.split(`
|
|
472
472
|
`).map(e=>`> ${e}`).join(`
|
|
@@ -492,16 +492,16 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
492
492
|
`)}function T$(e,t,n){return`The selected passage is ${e===t?`line ${e}`:`lines ${e}-${t}`} of @${n}. Read it from @${n} via the OpenKnowledge MCP server before editing.`}function E$(e){let t=e.map(e=>RQ(e)).filter(e=>e!==``);return t.length===0?``:[`Also reference:`,``,...t.map(e=>`@${e}`)].join(`
|
|
493
493
|
`)}function D$(e){return e.scope===`doc`?`Let's work on @${RQ(e.docRelativePath)} using OpenKnowledge.`:e.scope===`folder`?`Let's work on the @${RQ(e.folderRelativePath)} folder using OpenKnowledge.`:`Let's work on this project using OpenKnowledge.`}function O$(e,t,n,r,i){let a=t.trim();if(!(a!==``||n!==``||r!==``))return i===``?e:`${e} ${i}`;let o=[e];return a!==``&&o.push(S$(a)),n!==``&&o.push(n),r!==``&&o.push(r),i!==``&&o.push(i),o.join(`
|
|
494
494
|
|
|
495
|
-
`)}function k$(e,t,n,r,i,a,o){if(e.kind===`lines`)return T$(e.startLine,e.endLine,n);if(e.kind===`anchor`)return w$(e.markdown,n);let s=C$(e.markdown);return e$(O$(t,``,s,r,i),a,o)<=t$(o,XQ)?s:w$(e.markdown,n)}function A$(e,t,n,r){let{target:i}=e,a=e.transport??`url`,o=RQ(e.docRelativePath),s=`Let's work on @${o} using OpenKnowledge.`,c=k$(t,s,o,n,r,i,a);return O$(s,_$(e.instruction,i,e=>O$(s,e,c,n,r),a),c,n,r)}function
|
|
495
|
+
`)}function k$(e,t,n,r,i,a,o){if(e.kind===`lines`)return T$(e.startLine,e.endLine,n);if(e.kind===`anchor`)return w$(e.markdown,n);let s=C$(e.markdown);return e$(O$(t,``,s,r,i),a,o)<=t$(o,XQ)?s:w$(e.markdown,n)}function A$(e,t,n,r){let{target:i}=e,a=e.transport??`url`,o=RQ(e.docRelativePath),s=`Let's work on @${o} using OpenKnowledge.`,c=k$(t,s,o,n,r,i,a);return O$(s,_$(e.instruction,i,e=>O$(s,e,c,n,r),a),c,n,r)}function j$(e){let{target:t}=e,n=e.autoOpen?x$:``,r=E$(e.mentions);if(e.scope===`doc`&&e.selection!==void 0)return A$(e,e.selection,r,n);let i=D$(e);return O$(i,_$(e.instruction,t,e=>O$(i,e,``,r,n),e.transport??`url`),``,r,n)}function kre(e){let t=RQ(e.relativePath),n=e.ruleAlias===void 0?`${e.source}/${e.code}`:`${e.source}/${e.code} (${e.ruleAlias})`,r=[`Fix this lint problem in @${t} using OpenKnowledge.`,``,`Problem: ${n} at line ${e.line}, column ${e.column}:`,``,S$(e.message.trim())],i=e.lineText??``;if(i.trim()!==``){let t=o$(i);r.push(``,`Line ${e.line} reads:`,``,t,i,t)}return r.push(``,`Edit @${t} via the OpenKnowledge MCP server, then re-lint it to confirm the problem is resolved.`),r.join(`
|
|
496
496
|
`)}function M$(e){if(e===null)return[`Fix every problem across this project's documents using OpenKnowledge.`,``,"Run the `audit` tool for the current list of lint violations and broken links, then work file by file — the `lint` tool with `fix: true` clears one document's mechanically-fixable problems at a time — and re-audit until it reports no problems."].join(`
|
|
497
497
|
`);let t=RQ(e);return[`Fix every problem in @${t} using OpenKnowledge.`,``,`Run the \`audit\` tool scoped to it for the current list of lint violations and broken links, then fix each one — the \`lint\` tool with \`fix: true\` clears the mechanically-fixable ones — and re-audit @${t} until it reports no problems.`].join(`
|
|
498
|
-
`)}function N$(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}var P$=new Set([`opencode.json`]),F$=/^\.[A-Za-z0-9_-]+\/skills\/[^/]+\/.+$/;function I$(e){return F$.test(e)}function L$(e){return I$(e)?!1:e.split(`/`).some(e=>e.startsWith(`.`))?!0:P$.has(e.slice(e.lastIndexOf(`/`)+1))}function R$(e,t){let n=N$(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}var z$=N().superRefine(R$).optional(),B$=N().superRefine(R$),V$={agentId:N().optional(),agentName:N().optional(),colorSeed:N().optional(),clientName:N().optional(),clientVersion:N().optional(),label:N().optional()},H$=N().optional(),U$=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;lo(`kind`,[L({kind:B(`doc`),docPath:N().min(1)}).loose(),L({kind:B(`folder`),folderPath:N()}).loose()]);var W$=z([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),G$=z([`current`,`stale`,`absent`,`empty`]),K$=lo(`ok`,[L({ok:B(!0),shareUrl:N().min(1),sharedUrl:N().min(1),branch:N().min(1),freshness:G$.optional().catch(void 0)}).loose(),L({ok:B(!1),error:W$,branch:N().min(1).optional()}).loose()]),q$=z([`user`,`org`]),J$=L({login:N().min(1),kind:q$,avatarUrl:N().optional()}).loose(),Y$=z([`auth-required`,`network`]),X$=lo(`ok`,[L({ok:B(!0),owners:I(J$)}).loose(),L({ok:B(!1),error:Y$}).loose()]),Z$=lo(`ok`,[L({ok:B(!0),available:F()}).loose(),L({ok:B(!1),error:Y$}).loose()]),Q$=z([`public`,`private`]);L({owner:N().min(1),name:N().min(1),visibility:Q$,description:N().optional()}).loose();var $$=z([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),e1=lo(`ok`,[L({ok:B(!0),ownerLogin:N().min(1),repoName:N().min(1),cloneUrl:N().min(1),defaultBranch:N().min(1)}).loose(),L({ok:B(!1),error:$$}).loose()]);function t1(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}var n1=e=>e.refine(t1,`invalid branch name`),r1={shareTargetExists:F(),dirtyConflicts:L({conflicts:F(),files:I(N().min(1))}).loose(),branchIsLocal:F(),shareTargetOnOriginBranch:F().optional()};lo(`detached`,[L({detached:B(!1),currentBranch:N().min(1).nullable(),currentHeadSha:$a(),...r1}).loose(),L({detached:B(!0),currentBranch:$a(),currentHeadSha:N().min(1),...r1}).loose()]),L({branch:n1(N().min(1)),principalId:N().optional(),fastForward:F().optional()}).loose();var i1=z([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]);lo(`ok`,[L({ok:B(!0)}).loose(),L({ok:B(!1),reason:i1,files:I(N().min(1)).optional(),otherWorktreePath:N().min(1).optional()}).loose()]),z([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]),L({branch:n1(N().min(1)),path:N(),kind:z([`doc`,`folder`])}).loose(),lo(`verdict`,[L({verdict:B(`on-origin`)}).loose(),L({verdict:B(`renamed`),renamedTo:N().min(1)}).loose(),L({verdict:B(`deleted`)}).loose(),L({verdict:B(`never-on-branch`)}).loose(),L({verdict:B(`changed-locally`)}).loose(),L({verdict:B(`unknown`)}).loose()]).catch({verdict:`unknown`});var a1=L({startedAt:N().min(1),httpListenMs:P().nonnegative().optional(),seedWalkMs:P().nonnegative().optional(),indexesMs:P().nonnegative().optional(),readyMs:P().nonnegative().optional(),fileCount:P().nonnegative().optional()}),o1=L({serverInstanceId:N().min(1),currentBranch:N().min(1).optional(),currentDiskAckSVs:mo(N().min(1),N().min(1)).optional(),boot:a1.optional()}).loose(),s1=L({id:N().min(1),display_name:N().min(1),display_email:N(),source:z([`git-config`,`synthesized`]),created_at:N().min(1)}).loose();L({collabUrl:N().nullable(),previewUrl:N().nullable(),port:P(),singleFile:F().default(!1)}).loose();var c1=z(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:derived-index-unavailable.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:no-conflict-tracked.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed.urn:ok:error:registry-unreachable.urn:ok:error:config-not-writable.urn:ok:error:audit-superseded.urn:ok:error:theme-name-taken.urn:ok:error:theme-name-invalid`.split(`.`)),l1=L({type:c1,title:N().min(1),status:P().int().min(400).max(599),instance:N().regex(U$,`instance must be urn:uuid:<uuid>`).optional(),detail:N().optional()}).loose();L({parentDocName:N().min(1),placement:z([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:N().min(1).optional(),agentName:N().min(1).optional()}).loose();var u1=L({src:N().min(1),path:N().min(1).optional(),deduped:F().optional()}).loose();L({url:N().min(1),dir:N().min(1),branch:N().min(1).refine(t1,`invalid branch name`).optional()}).loose(),L({type:B(`error`),problem:l1}).loose();function d1(e){let t=e??(typeof navigator>`u`?void 0:navigator);return t===void 0?[]:t.languages!==void 0&&t.languages.length>0?
|
|
498
|
+
`)}function N$(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}var P$=new Set([`opencode.json`]),F$=/^\.[A-Za-z0-9_-]+\/skills\/[^/]+\/.+$/;function I$(e){return F$.test(e)}function L$(e){return I$(e)?!1:e.split(`/`).some(e=>e.startsWith(`.`))?!0:P$.has(e.slice(e.lastIndexOf(`/`)+1))}function R$(e,t){let n=N$(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}var z$=N().superRefine(R$).optional(),B$=N().superRefine(R$),V$={agentId:N().optional(),agentName:N().optional(),colorSeed:N().optional(),clientName:N().optional(),clientVersion:N().optional(),label:N().optional()},H$=N().optional(),U$=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;lo(`kind`,[L({kind:B(`doc`),docPath:N().min(1)}).loose(),L({kind:B(`folder`),folderPath:N()}).loose()]);var W$=z([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),G$=z([`current`,`stale`,`absent`,`empty`]),K$=lo(`ok`,[L({ok:B(!0),shareUrl:N().min(1),sharedUrl:N().min(1),branch:N().min(1),freshness:G$.optional().catch(void 0)}).loose(),L({ok:B(!1),error:W$,branch:N().min(1).optional()}).loose()]),q$=z([`user`,`org`]),J$=L({login:N().min(1),kind:q$,avatarUrl:N().optional()}).loose(),Y$=z([`auth-required`,`network`]),X$=lo(`ok`,[L({ok:B(!0),owners:I(J$)}).loose(),L({ok:B(!1),error:Y$}).loose()]),Z$=lo(`ok`,[L({ok:B(!0),available:F()}).loose(),L({ok:B(!1),error:Y$}).loose()]),Q$=z([`public`,`private`]);L({owner:N().min(1),name:N().min(1),visibility:Q$,description:N().optional()}).loose();var $$=z([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),e1=lo(`ok`,[L({ok:B(!0),ownerLogin:N().min(1),repoName:N().min(1),cloneUrl:N().min(1),defaultBranch:N().min(1)}).loose(),L({ok:B(!1),error:$$}).loose()]);function t1(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}var n1=e=>e.refine(t1,`invalid branch name`),r1={shareTargetExists:F(),dirtyConflicts:L({conflicts:F(),files:I(N().min(1))}).loose(),branchIsLocal:F(),shareTargetOnOriginBranch:F().optional()};lo(`detached`,[L({detached:B(!1),currentBranch:N().min(1).nullable(),currentHeadSha:$a(),...r1}).loose(),L({detached:B(!0),currentBranch:$a(),currentHeadSha:N().min(1),...r1}).loose()]),L({branch:n1(N().min(1)),principalId:N().optional(),fastForward:F().optional()}).loose();var i1=z([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`,`ff-diverged`]);lo(`ok`,[L({ok:B(!0)}).loose(),L({ok:B(!1),reason:i1,files:I(N().min(1)).optional(),otherWorktreePath:N().min(1).optional()}).loose()]),z([`on-origin`,`renamed`,`deleted`,`never-on-branch`,`changed-locally`,`unknown`]),L({branch:n1(N().min(1)),path:N(),kind:z([`doc`,`folder`])}).loose(),lo(`verdict`,[L({verdict:B(`on-origin`)}).loose(),L({verdict:B(`renamed`),renamedTo:N().min(1)}).loose(),L({verdict:B(`deleted`)}).loose(),L({verdict:B(`never-on-branch`)}).loose(),L({verdict:B(`changed-locally`)}).loose(),L({verdict:B(`unknown`)}).loose()]).catch({verdict:`unknown`});var a1=L({startedAt:N().min(1),httpListenMs:P().nonnegative().optional(),seedWalkMs:P().nonnegative().optional(),indexesMs:P().nonnegative().optional(),readyMs:P().nonnegative().optional(),fileCount:P().nonnegative().optional()}),o1=L({serverInstanceId:N().min(1),currentBranch:N().min(1).optional(),currentDiskAckSVs:mo(N().min(1),N().min(1)).optional(),boot:a1.optional()}).loose(),s1=L({id:N().min(1),display_name:N().min(1),display_email:N(),source:z([`git-config`,`synthesized`]),created_at:N().min(1)}).loose();L({collabUrl:N().nullable(),previewUrl:N().nullable(),port:P(),singleFile:F().default(!1)}).loose();var c1=z(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:derived-index-unavailable.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:no-conflict-tracked.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed.urn:ok:error:registry-unreachable.urn:ok:error:config-not-writable.urn:ok:error:audit-superseded.urn:ok:error:theme-name-taken.urn:ok:error:theme-name-invalid`.split(`.`)),l1=L({type:c1,title:N().min(1),status:P().int().min(400).max(599),instance:N().regex(U$,`instance must be urn:uuid:<uuid>`).optional(),detail:N().optional()}).loose();L({parentDocName:N().min(1),placement:z([`configured-attachments`,`parent-dir`]).default(`configured-attachments`),agentId:N().min(1).optional(),agentName:N().min(1).optional()}).loose();var u1=L({src:N().min(1),path:N().min(1).optional(),deduped:F().optional()}).loose();L({url:N().min(1),dir:N().min(1),branch:N().min(1).refine(t1,`invalid branch name`).optional()}).loose(),L({type:B(`error`),problem:l1}).loose();function d1(e){let t=e??(typeof navigator>`u`?void 0:navigator);return t===void 0?[]:t.languages!==void 0&&t.languages.length>0?fp(t.languages):t.language===void 0?[]:fp([t.language])}var f1={en:`ltr`,"zh-Hans":`ltr`,"zh-Hant":`ltr`,hi:`ltr`,es:`ltr`,ar:`rtl`,fr:`ltr`,bn:`ltr`,"pt-BR":`ltr`,id:`ltr`,ur:`rtl`};function p1(e){let t=new Intl.Locale(e).getTextInfo?.().direction;return t===`rtl`||t===`ltr`?t:f1[e]}function m1(e,t){let n=t.map(e=>[pp(e),e]);for(let t of e){let e=pp(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function h1(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=m1([t],i);if(e!==void 0)return{locale:e,source:`override`}}if(n!==void 0&&n!==`system`&&i.includes(n))return{locale:n,source:`explicit`};let o=m1(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}function g1(e){return e.includes("`")?`~`:"`"}function _1(e,t,n=3){let r=RegExp(`^ {0,3}(\\${e}+)[ \\t]*$`),i=Math.max(3,n);for(let e of t.split(`
|
|
499
499
|
`)){let t=r.exec(e);t&&t[1].length>=i&&(i=t[1].length+1)}return i}function v1(e){return e>=2?e:0}function y1(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,n=t.replace(/^\n+/,``);return n.replace(/\n+$/,``).length===0?{leading:0,trailing:0}:{leading:v1(t.length-n.length),trailing:v1(n.length-n.replace(/\n+$/,``).length-1)}}function b1(e,t){let n={line:e,column:1,offset:t};return{type:`paragraph`,children:[],position:{start:n,end:{...n}}}}function x1(e,t){let n=e.children,r=n.length===0||t.leading===void 0?0:v1(t.leading.length),i=n.length===0||t.trailing===void 0?0:v1(t.trailing.length-1);if(r===0&&i===0)return t;let a=n[n.length-1]?.position?.end,o=[],s=[];if(r>0)for(let e=0;e<r;e++)o.push(b1(1+e,e));if(i>0&&typeof a?.offset==`number`&&typeof a.line==`number`)for(let e=0;e<i;e++)s.push(b1(a.line+1+e,a.offset+1+e));if(o.length===0&&s.length===0||(e.children=[...o,...n,...s],o.length>0&&delete t.leading,s.length>0&&delete t.trailing,t.bom!==void 0||t.leading!==void 0||t.trailing!==void 0))return t;e.data!==void 0&&delete e.data.sourceDocBoundary}var S1=/notionvc:/i,C1=()=>e=>{w1(e)&&(T1(e),E1(e))};function w1(e){if(!(`children`in e)||!Array.isArray(e.children))return!1;for(let t of e.children){if(t.type===`comment`){let e=String(t.value??``);if(S1.test(e))return!0}if(t.type===`element`&&w1(t))return!0}return!1}function T1(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&T1(t);let t=[];for(let n of e.children){if(n.type!==`text`){t.push(n);continue}let e=String(n.value??``);if(!e.includes(`
|
|
500
500
|
`)){t.push(n);continue}let r=e.split(`
|
|
501
501
|
`);for(let e=0;e<r.length;e++)r[e]&&t.push({type:`text`,value:r[e]??``}),e<r.length-1&&t.push({type:`element`,tagName:`br`,properties:{},children:[]})}e.children=t}function E1(e){if(!(!(`children`in e)||!Array.isArray(e.children))){e.children=e.children.filter(e=>e.type===`comment`?!S1.test(String(e.value??``)):!0);for(let t of e.children)t.type===`element`&&E1(t)}}var D1=new Set([`Apple-tab-span`,`Apple-converted-space`,`Apple-style-span`]),O1=()=>e=>{k1(e)};function k1(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&k1(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return A1(t)?[]:j1(t)?t.children:[t]})}}function A1(e){if(e.tagName!==`meta`)return!1;let t=e.properties?.name,n=e.properties?.content;return t===`Generator`&&typeof n==`string`&&/Cocoa/i.test(n)}function j1(e){if(e.tagName!==`span`)return!1;let t=e.properties?.className;return Array.isArray(t)?t.length>0&&t.every(e=>D1.has(String(e))):!1}var M1=`docs-internal-guid-`;function N1(e,t){let n=e.children[t];!n||n.type!==`element`||e.children.splice(t,1,...n.children)}var P1=()=>e=>{F1(e)};function F1(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&F1(t);let t=0;for(;t<e.children.length;){let n=e.children[t];if(!n||n.type!==`element`){t++;continue}let r=n;if(I1(r)||L1(r)){N1(e,t);continue}t++}}function I1(e){if(e.tagName!==`b`)return!1;let t=e.properties?.id;return typeof t==`string`&&t.startsWith(M1)}function L1(e){if(e.tagName!==`div`||e.properties?.dir!==`ltr`)return!1;let t=e.children.filter(e=>e.type===`element`);return t.length===1?t[0]?.tagName===`table`:!1}var R1=new Set([`commit-link`,`user-mention`,`team-mention`,`issue-link`]),z1=()=>e=>{B1(e)};function B1(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&B1(t);for(let t of e.children)t.type===`element`&&V1(t)}}function V1(e){if(!e.properties)return;for(let t of Object.keys(e.properties))t.startsWith(`dataHovercard`)&&delete e.properties[t];let t=e.properties.className;if(Array.isArray(t)){let n=t.filter(e=>!R1.has(String(e)));n.length===0?delete e.properties.className:e.properties.className=n}}var H1=/^gmail_/,U1=()=>e=>{W1(e)};function W1(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&W1(t);let t=0;for(;t<e.children.length;){let n=e.children[t];if(n.type!==`element`){t++;continue}let r=n;if(r.tagName===`div`&&G1(r,`gmail_quote`)&&(r.tagName=`blockquote`),K1(r),q1(r)){e.children.splice(t,1,...r.children);continue}t++}}function G1(e,t){let n=e.properties?.className;return Array.isArray(n)?n.some(e=>String(e)===t):!1}function K1(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!H1.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}function q1(e){if(e.tagName!==`div`||e.properties?.dir!==`ltr`)return!1;let t=e.properties?.className;return t!=null&&!(Array.isArray(t)&&t.length===0)?!1:e.children.filter(e=>e.type===`element`).length<=1}var J1=()=>e=>{Y1(e)};function Y1(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&Y1(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return t.tagName===`google-sheets-html-origin`?t.children:t.tagName===`style`?[]:(X1(t),[t])})}}function X1(e){if(e.properties)for(let t of Object.keys(e.properties))t.startsWith(`dataSheets`)&&delete e.properties[t]}var Z1=[`o:`,`w:`,`m:`,`v:`,`u1:`],Q1=/^Mso[A-Z]/,$1=/^\s*\[if\s+[^\]]*\]/,e0=()=>e=>{t0(e)};function t0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&t0(t);e.children=e.children.flatMap(e=>{if(e.type===`comment`){let t=String(e.value??``);return $1.test(t)?[]:[e]}if(e.type!==`element`)return[e];let t=e;return n0(t)?[]:(r0(t),[t])})}}function n0(e){return Z1.some(t=>e.tagName.startsWith(t))}function r0(e){let t=e.properties;if(!t)return;let n=t.className;if(Array.isArray(n)){let e=n.filter(e=>typeof e==`string`&&!Q1.test(e));e.length===0?delete t.className:t.className=e}else typeof n==`string`&&Q1.test(n)&&delete t.className;let r=t.style;typeof r==`string`&&/mso-/i.test(r)&&delete t.style;for(let e of Object.keys(t))if(e.startsWith(`xmlns:`)){let n=e.slice(6);Z1.some(e=>e===`${n}:`)&&delete t[e]}}var i0=/^c-(message_kit__|message__|compose|timestamp)/,a0=()=>e=>{o0(e)};function o0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&o0(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return s0(t)?[]:(c0(t),[t])})}}function s0(e){let t=e.properties?.className;return Array.isArray(t)?t.some(e=>String(e)===`c-timestamp`||String(e).startsWith(`c-timestamp`)):!1}function c0(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!i0.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}var l0=()=>e=>{u0(e)};function u0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&u0(t);for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`element`)continue;let r=n;d0(r)&&(e.children[t]=p0(r))}}}function d0(e){if(e.tagName!==`div`)return!1;let t=e.children.filter(e=>e.type===`element`&&e.tagName===`div`);return t.length<2?!1:t.some(e=>f0(e))}function f0(e){for(let t of e.children){if(t.type!==`element`)continue;let e=t,n=e.properties?.style;if(typeof n==`string`&&/color\s*:/i.test(n)||f0(e))return!0}return!1}function p0(e){return{type:`element`,tagName:`pre`,properties:{},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:e.children.filter(e=>e.type===`element`&&e.tagName===`div`).map(e=>m0(e)).join(`
|
|
502
502
|
`)}]}]}}function m0(e){let t=``;for(let n of e.children)n.type===`text`?t+=n.value??``:n.type===`element`&&(t+=m0(n));return t}var h0=new Set([`break`,`delete`,`emphasis`,`footnoteReference`,`html`,`image`,`imageReference`,`inlineCode`,`link`,`linkReference`,`strong`,`text`]);function g0(e){let t=e.children;Array.isArray(t)&&t.forEach((e,n)=>{if(e.type===`break`){t[n]={type:`html`,value:`<br />`};return}g0(e)})}function _0(e){let t=e.children;if(Array.isArray(t))for(let e of t)(e.type===`inlineCode`||e.type===`html`)&&(e.value.includes(`
|
|
503
503
|
`)&&(e.value=e.value.replace(/[ \t]*\n[ \t]*/g,` `)),e.type===`html`&&e.value.includes(`|`)&&(e.value=e.value.replace(/\|/g,`\\|`))),_0(e)}function v0(e){E(e,`tableCell`,e=>{e.children.some(e=>!h0.has(e.type))&&(e.children=y0(e.children)),g0(e),_0(e)})}function y0(e){let t=[],n=0,r=()=>{t.length>0&&(n+=1)},i=e=>{for(;n>0;)t.push({type:`break`}),--n;t.push(e)},a=e=>{e.split(`
|
|
504
|
-
`).forEach((e,t)=>{t>0&&r(),e.length>0&&i({type:`text`,value:e})})},o=e=>{let t=e.ordered===!0,n=typeof e.start==`number`?e.start:1,a=e.data,o=typeof a?.bulletMarker==`string`?a.bulletMarker:`-`,c=typeof a?.listMarkerDelimiter==`string`?a.listMarkerDelimiter:`.`;e.children.forEach((e,a)=>{a>0&&r(),i({type:`text`,value:t?`${n+a}${c} `:`${o} `}),e.children.forEach((e,t)=>{t>0&&r(),s(e)})})},s=e=>{switch(e.type){case`paragraph`:case`heading`:e.children.forEach(i);return;case`list`:o(e);return;case`code`:case`html`:a(e.value);return;case`thematicBreak`:i({type:`text`,value:e.data?.sourceRaw??`---`});return;default:{let t=e;if(Array.isArray(t.children)&&t.children.length>0){t.children.forEach((e,t)=>{t>0&&r(),s(e)});return}let n=e;if(typeof n.value==`string`){a(n.value);return}console.warn(JSON.stringify({event:`table-cell-flatten-dropped-block`,nodeType:e.type}))}}};return e.forEach((e,t)=>{t>0&&r(),s(e)}),t}var b0=class extends Error{htmlBytes;maxBytes;constructor(e,t){super(`HTML payload (${e} bytes) exceeds htmlToMdast ceiling (${t} bytes); falling through to plain text`),this.name=`HtmlPayloadTooLargeError`,this.htmlBytes=e,this.maxBytes=t}},x0=[P1,e0,O1,U1,C1,l0,J1,a0,z1];function S0(e){E(e,e=>{e.type===`strong`?(e.data??={},e.data.sourceDelimiter=`**`):e.type===`emphasis`?(e.data??={},e.data.sourceDelimiter=`*`):e.type===`inlineCode`?(e.data??={},e.data.sourceFenceChar="`",e.data.sourceFenceLength=1):e.type===`code`&&(e.data??={},e.data.sourceFenceChar="`",e.data.sourceFenceLength=3)})}function C0(e){E(e,`list`,e=>{for(let t of e.children){let e=t.children.filter(e=>e.type!==`list`).length;t.spread=t.spread===!0&&e>1}e.spread=e.children.some(e=>e.spread===!0)})}var w0={u:E0(`u`),ins:E0(`ins`)},T0=`okUnderlineForm`;function E0(e){return(t,n)=>{let r={type:`emphasis`,children:t.all(n),data:{[T0]:e}};return t.patch(n,r),r}}function D0(e){let t=e=>{if(!Array.isArray(e.children))return;for(let n of e.children)t(n);let n=[];for(let t of e.children){let e=t.data?.[T0],r=t.children;if((e===`u`||e===`ins`)&&Array.isArray(r)){n.push({type:`html`,value:`<${e}>`}),n.push(...r),n.push({type:`html`,value:`</${e}>`});continue}n.push(t)}e.children=n};t(e)}function O0(e,t){let n=t?.maxBytes??5242880;if(e.length>n)throw new b0(e.length,n);let r=A().use(Oj,{fragment:!0});for(let e of x0)r.use(e);for(let e of t?.additionalCleanupPlugins??[])r.use(e);r.use(GN,{handlers:w0});let i=r.parse(e),a=r.runSync(i);return C0(a),D0(a),S0(a),a}function k0(e){return v0(e),String(A().use(se).use(vP,{bullet:`-`,rule:`-`,fences:!0}).stringify(e))}function A0(e,t){let n=0;for(let r=0;r<t.length&&n<e.length;r++)e[n]===t[r]&&n++;return n===e.length}var j0=new Set([`sourceRaw`,`sourceDirty`,`position`]),M0=new Set([`jsxComponent`,`table`,`tableRow`,`tableCell`,`tableHeader`,`list`,`listItem`,`blockquote`,`codeBlock`,`heading`]),N0={type:`__br__`},P0=/^<br\s*\/?>$/i;function F0(e){let t=B0(e,F0);return(t.type===`tableCell`||t.type===`tableHeader`)&&t.content?{...t,content:I0(t.content)}:t}function I0(e){let t=[];for(let n of e){let e=L0(n);e.length!==0&&(t.length>0&&t.push(N0),t.push(...e))}return t}function L0(e){return e.text!==void 0||e.type===`hardBreak`||e.type===`jsxInline`?[e]:!e.content||e.content.length===0?[]:e.content.some(e=>e.text===void 0&&e.type!==`hardBreak`&&e.type!==`jsxInline`&&!!e.content)?I0(e.content):e.content}function R0(e){return e.type===`hardBreak`||e.type===N0.type||e.text!==void 0&&P0.test(e.text.trim())?N0:B0(e,R0)}var z0=[{label:`table-cell-block-flatten`,severity:`pm-model-caused`,rationale:`GFM table cells have no block spelling; a block placed in a cell is flattened to inline on serialize, so a cell-with-blocks and a cell-with-inline describe the same persisted document.`,proofPointer:`markdown/table-cell-flatten.ts flattenCellBlocks (table-cell-flatten-dropped-block event)`,canonicalize:F0},{label:`void-hardbreak-br`,severity:`serializer-caused`,rationale:`A void hardBreak inside a table cell or heading serializes to a literal <br /> that a fresh parse keeps as text; the node form and the literal form are the same break.`,proofPointer:`markdown/void-br-promoter.ts + markdown/to-markdown-handlers.ts break handler`,canonicalize:R0}];function B0(e,t){return e.content?{...e,content:e.content.map(t)}:e}function V0(e,t){let n={};e.type!==void 0&&(n.type=e.type),e.text!==void 0&&(n.text=e.text);let r=H0(e.attrs,t);return r&&(n.attrs=r),e.marks&&e.marks.length>0&&(n.marks=[...e.marks].map(e=>({type:e.type,attrs:H0(e.attrs,t)})).sort((e,t)=>W0(e).localeCompare(W0(t)))),e.content&&e.content.length>0&&(n.content=e.content.map(e=>V0(e,t))),n}function H0(e,t){if(!e)return null;let n={};for(let r of Object.keys(e).sort()){if(j0.has(r)||t?.(r))continue;let i=e[r];i!=null&&(n[r]=t?U0(i,t):i)}return Object.keys(n).length>0?n:null}function U0(e,t){if(Array.isArray(e))return e.map(e=>U0(e,t));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))t(r)||(n[r]=U0(i,t));return n}return e}function W0(e){return JSON.stringify(e,(e,t)=>{if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let n of Object.keys(t).sort())e[n]=t[n];return e}return t})}function G0(e){let t=``,n=e=>{if(e.text!==void 0&&(t+=e.text),e.content)for(let t of e.content)n(t)};return n(e),t.replace(/\s+/g,``)}function K0(e){let t=[],n=e=>{if(e.type&&M0.has(e.type)){let n=e.type===`jsxComponent`?String(e.attrs?.componentName??``):``;t.push(n?`${e.type}:${n}`:e.type)}if(e.content)for(let t of e.content)n(t)};return n(e),t.sort()}function q0(e){let t=e,n=[];for(let e of z0){let r=W0(t),i=e.canonicalize(t);W0(i)!==r&&n.push(e.label),t=i}return{normalized:t,fired:n}}function J0(e,t,n={}){let r=q0(e),i=q0(t),a=[...new Set([...r.fired,...i.fired])];if(!A0(G0(r.normalized),G0(i.normalized)))return{equivalent:!1,level:`L1`,reason:`content-loss`,appliedDegrades:a,detail:`authored text did not survive the round-trip`};let o=K0(r.normalized),s=K0(i.normalized);if(W0(o)!==W0(s))return{equivalent:!1,level:`L1`,reason:`structural-shatter`,appliedDegrades:a,detail:`container multiset diverged: [${o.join(`, `)}] vs [${s.join(`, `)}]`};let c=V0(r.normalized,n.ignoreAttrs),l=V0(i.normalized,n.ignoreAttrs);return W0(c)===W0(l)?{equivalent:!0,level:a.length>0?`L2`:`L1`,appliedDegrades:a}:{equivalent:!1,level:`L2`,reason:`structural-divergence`,appliedDegrades:a,detail:Y0(c,l)}}function Y0(e,t,n=`doc`){let r=e,i=t;if(!r||!i)return`${n}: node presence differs`;if(r.type!==i.type)return`${n}: type ${String(r.type)} vs ${String(i.type)}`;let a=r.content??[],o=i.content??[];if(a.length!==o.length)return`${n}(${String(r.type)}): child count ${a.length} vs ${o.length}`;for(let e=0;e<a.length;e++)if(W0(a[e])!==W0(o[e]))return Y0(a[e],o[e],`${n}>${String(r.type)}[${e}]`);return`${n}(${String(r.type)}): attrs or marks differ`}function X0(e,t,n){return!J0(e,t,{ignoreAttrs:n}).equivalent}var Z0=new Set([`src`,`href`,`size`]),Q0=new Set([`WikiEmbedImage`,`WikiEmbedVideo`,`WikiEmbedAudio`,`WikiEmbedFile`]);function $0(e){if(Array.isArray(e))return e.map(e=>$0(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))Z0.has(n)||(t[n]=$0(r));return t}return e}function e2(e){return e.type===`jsxComponent`&&typeof e.attrs?.componentName==`string`&&Q0.has(e.attrs.componentName)?$0(e):e.content?{...e,content:e.content.map(e2)}:e}function t2(e){if(Array.isArray(e))return e.map(e=>t2(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))n!==`position`&&(t[n]=t2(r));return t}return e}function n2(e){if(e.type===`jsxComponent`)return e;if(e.content)for(let t of e.content){let e=n2(t);if(e)return e}}function r2(e){let t=e.cacheLimit??2048,n=new Map,r=r=>{let i=n.get(r);if(i!==void 0)return i;let a=n2(e.parse(r)),o=a?e2(t2(a)):null;if(n.size>=t){let e=n.keys().next().value;e!==void 0&&n.delete(e)}return n.set(r,o),o};return{isDiverged(e){if(e.type!==`jsxComponent`||!e.attrs||e.attrs.kind===`expression`)return!1;let t=e.attrs.sourceRaw;if(typeof t!=`string`||t.length===0)return!1;let n=r(t);return n?X0(n,e2(t2(e))):!1}}}function i2(e,t){let n=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],r=e.attrs.props??{},i=new Map,a=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&i.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&a.add(e.name);for(let[e,t]of Object.entries(r)){let r=n.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(i.has(e)&&Object.is(i.get(e),t)){r>=0&&n.splice(r,1);continue}if(a.has(e)&&t===``){r>=0&&n.splice(r,1);continue}if(r>=0){let e=n[r];if(e.type===`mdxJsxAttribute`&&e.value!=null&&typeof e.value==`object`&&e.value.type===`mdxJsxAttributeValueExpression`&&a2(e.value.value,t))continue}let o=o2(e,t);r>=0?n[r]=o:n.push(o)}return n}function a2(e,t){try{return JSON.stringify(JSON.parse(e))===JSON.stringify(t)}catch{return!1}}function o2(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let n;try{n=JSON.stringify(t)}catch{n=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:n}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function s2(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:i2(t,r),children:n.all(t),data:{}}}function c2(e,t,n){let r=t.attrs.props?.children;return{type:`mdxJsxTextElement`,name:e,attributes:i2(t,n),children:typeof r==`string`&&r!==``?[{type:`text`,value:r}]:[],data:{}}}var l2=/^[A-Za-z0-9]{20,}$/,u2=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function d2(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function f2(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let n=t[1]??``;return l2.test(n)?n:null}function p2(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!d2(t.hostname))return null;let n=f2(t);if(!n)return null;let r=t.searchParams.get(`t`);return{id:n,startRaw:r&&r.length>0&&u2.test(r)?r:null}}function m2(e){return p2(e)!==null}function h2(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function g2(e){if(typeof e!=`string`||e.length===0)return!1;let t;try{t=new URL(e)}catch{return!1}return t.protocol!==`http:`&&t.protocol!==`https:`?!1:h2(t.hostname)}var _2=/^[A-Za-z0-9_-]{11}$/;function v2(e){let t=e.toLowerCase();return t===`youtube.com`||t===`www.youtube.com`||t===`m.youtube.com`||t===`music.youtube.com`||t===`youtu.be`||t===`youtube-nocookie.com`||t===`www.youtube-nocookie.com`}function y2(e){if(e.length===0)return null;if(/^[0-9]+$/.test(e)){let t=Number.parseInt(e,10);return t>0?t:null}let t=e.match(/^(?:([0-9]+)h)?(?:([0-9]+)m)?(?:([0-9]+)s?)?$/);if(!t)return null;let n=t[1]?Number.parseInt(t[1],10):0,r=t[2]?Number.parseInt(t[2],10):0,i=t[3]?Number.parseInt(t[3],10):0,a=n*3600+r*60+i;return a>0?a:null}function b2(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return _2.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return _2.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function x2(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!v2(t.hostname))return null;let n=b2(t);if(!n)return null;let r=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:n,startSeconds:r.length>0?y2(r):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}var S2=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)",iconPicker:!0},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)",colorPicker:!0},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`,hideWhen:e=>e.collapsible!==!0},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],C2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:Gu,autoFocus:!0},{name:`alt`,type:`string`,required:!0,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],w2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Embedded page URL (must start with http:// or https://)`,autoFocus:!0},{name:`title`,type:`string`,required:!1,description:`Iframe title (accessible label for screen readers)`},{name:`width`,type:`string`,required:!1,advanced:!0,description:`Embed width as a CSS length (e.g. "100%", "640px")`,cssLengthInput:!0},{name:`height`,type:`string`,required:!1,advanced:!0,description:`Embed height as a CSS length (e.g. "26rem", "480px")`,cssLengthInput:!0},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],T2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:Ku,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`,hideWhen:e=>typeof e.src==`string`&&(g2(e.src)||m2(e.src))},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`,accept:Gu,hideWhen:e=>typeof e.src==`string`&&(g2(e.src)||m2(e.src))},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`,hideWhen:e=>typeof e.src==`string`&&m2(e.src)},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`,hideWhen:e=>typeof e.src==`string`&&(g2(e.src)||m2(e.src))},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`,hideWhen:e=>typeof e.src==`string`&&(x2(e.src)!==null||g2(e.src)||m2(e.src))},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],E2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:qu,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],D2=[{name:`title`,type:`string`,required:!0,description:`Heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the block renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)",iconPicker:!0},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],O2=[S2[0],S2[1],S2[4],S2[5],S2[6]],k2=[C2[0],C2[1],C2[7]],A2=[D2[0],D2[1],D2[4],D2[5]],j2=[{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`,`justify`],required:!1,defaultValue:`center`,description:"Block alignment from the `<div align>` attribute."},{name:`tag`,type:`string`,required:!1,defaultValue:`div`,hidden:!0,description:`Source wrapper tag (div or center).`},{name:`sourceAttrs`,type:`string`,required:!1,defaultValue:``,hidden:!0,description:`Raw opener-tag attribute bytes preserved for round-trip.`}],M2=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],N2=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],P2=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],F2=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],I2=[{name:`label`,type:`string`,required:!0,autoFocus:!0,defaultValue:`Tab`,description:`Tab strip label — shown in the clickable pill at the top`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#tab-npm`)"}],L2=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],R2=[L2[0]],z2=[L2[0]],B2=[{name:`chart`,type:`string`,required:!0,hidden:!0,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],V2=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],H2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],U2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:Ju,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}],W2=[{name:`src`,type:`string`,required:!0,description:"Path of the source doc, extension-less (e.g. `api-spec`).",autoFocus:!0},{name:`anchor`,type:`string`,required:!0,description:"Id of the `<MirrorSource>` block within the source doc."}],G2=[{name:`id`,type:`string`,required:!0,description:"Stable id agents and authors use to reference this block from `<Mirror>` elsewhere.",autoFocus:!0},{name:`children`,type:`reactnode`,required:!0,description:`Block content this MirrorSource owns — paragraphs, callouts, code, nested JSX, anything.`}];function K2(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function q2(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function J2(e){let t=e.attrs.props,n=t?.target??``,r=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,i=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,a=r??(i?`${n}#${i}`:n);return{type:`wikiLinkEmbed`,value:a,data:{target:n,anchor:i,alias:r},children:[{type:`text`,value:a}]}}var Y2=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:S2,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>s2(`Callout`,e,t,S2)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:C2,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>s2(`img`,e,t,C2)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:T2,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>s2(`video`,e,t,T2)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:E2,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>s2(`audio`,e,t,E2)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:U2,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>s2(`Pdf`,e,t,U2)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:H2,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>s2(`File`,e,t,H2)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:w2,icon:`AppWindow`,category:`media`,displayName:`Embed`,description:'Inline web embed (iframe) — drop a URL, get a resizable preview pane. For YouTube / Vimeo / Loom prefer `<video src="…">` (player props, click-facade); `<Embed>` auto-rewrites watch URLs as a fallback.',searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>s2(`Embed`,e,t,w2)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:D2,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],exampleBody:`Body content revealed when the accordion is expanded.`,serialize:(e,t)=>s2(`Accordion`,e,t,D2)},{name:`Toggle`,surface:`canonical`,hasChildren:!0,props:D2,icon:`ChevronRight`,category:`content`,displayName:`Toggle`,description:"Standalone expand/collapse block (Notion-style). Same render + props as `<Accordion>` — pick whichever vocabulary matches the vault.",searchTerms:[`toggle`,`collapsible`,`expand`,`details`,`disclosure`,`fold`],exampleBody:`Body content revealed when the toggle is expanded.`,serialize:(e,t)=>s2(`Toggle`,e,t,D2)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:F2,icon:`LayoutPanelTop`,category:`content`,displayName:`Tabs`,description:"Horizontal tab strip + active panel below. Each `<Tab>` child is one panel; clickable pills at the top switch the active one. Active selection is ephemeral (resets on reload).",searchTerms:[`tabs`,`tabbed`,`panels`,`tabgroup`,`switcher`],exampleBody:`<Tab label="One">Body of the first tab panel.</Tab>
|
|
504
|
+
`).forEach((e,t)=>{t>0&&r(),e.length>0&&i({type:`text`,value:e})})},o=e=>{let t=e.ordered===!0,n=typeof e.start==`number`?e.start:1,a=e.data,o=typeof a?.bulletMarker==`string`?a.bulletMarker:`-`,c=typeof a?.listMarkerDelimiter==`string`?a.listMarkerDelimiter:`.`;e.children.forEach((e,a)=>{a>0&&r(),i({type:`text`,value:t?`${n+a}${c} `:`${o} `}),e.children.forEach((e,t)=>{t>0&&r(),s(e)})})},s=e=>{switch(e.type){case`paragraph`:case`heading`:e.children.forEach(i);return;case`list`:o(e);return;case`code`:case`html`:a(e.value);return;case`thematicBreak`:i({type:`text`,value:e.data?.sourceRaw??`---`});return;default:{let t=e;if(Array.isArray(t.children)&&t.children.length>0){t.children.forEach((e,t)=>{t>0&&r(),s(e)});return}let n=e;if(typeof n.value==`string`){a(n.value);return}console.warn(JSON.stringify({event:`table-cell-flatten-dropped-block`,nodeType:e.type}))}}};return e.forEach((e,t)=>{t>0&&r(),s(e)}),t}var b0=class extends Error{htmlBytes;maxBytes;constructor(e,t){super(`HTML payload (${e} bytes) exceeds htmlToMdast ceiling (${t} bytes); falling through to plain text`),this.name=`HtmlPayloadTooLargeError`,this.htmlBytes=e,this.maxBytes=t}},x0=[P1,e0,O1,U1,C1,l0,J1,a0,z1];function S0(e){E(e,e=>{e.type===`strong`?(e.data??={},e.data.sourceDelimiter=`**`):e.type===`emphasis`?(e.data??={},e.data.sourceDelimiter=`*`):e.type===`inlineCode`?(e.data??={},e.data.sourceFenceChar="`",e.data.sourceFenceLength=1):e.type===`code`&&(e.data??={},e.data.sourceFenceChar="`",e.data.sourceFenceLength=3)})}function C0(e){E(e,`list`,e=>{for(let t of e.children){let e=t.children.filter(e=>e.type!==`list`).length;t.spread=t.spread===!0&&e>1}e.spread=e.children.some(e=>e.spread===!0)})}var w0={u:E0(`u`),ins:E0(`ins`)},T0=`okUnderlineForm`;function E0(e){return(t,n)=>{let r={type:`emphasis`,children:t.all(n),data:{[T0]:e}};return t.patch(n,r),r}}function D0(e){let t=e=>{if(!Array.isArray(e.children))return;for(let n of e.children)t(n);let n=[];for(let t of e.children){let e=t.data?.[T0],r=t.children;if((e===`u`||e===`ins`)&&Array.isArray(r)){n.push({type:`html`,value:`<${e}>`}),n.push(...r),n.push({type:`html`,value:`</${e}>`});continue}n.push(t)}e.children=n};t(e)}function O0(e,t){let n=t?.maxBytes??5242880;if(e.length>n)throw new b0(e.length,n);let r=A().use(Oj,{fragment:!0});for(let e of x0)r.use(e);for(let e of t?.additionalCleanupPlugins??[])r.use(e);r.use(GN,{handlers:w0});let i=r.parse(e),a=r.runSync(i);return C0(a),D0(a),S0(a),a}function k0(e){return v0(e),String(A().use(se).use(vP,{bullet:`-`,rule:`-`,fences:!0}).stringify(e))}function A0(e,t){let n=0;for(let r=0;r<t.length&&n<e.length;r++)e[n]===t[r]&&n++;return n===e.length}var j0=new Set([`sourceRaw`,`sourceDirty`,`position`]),M0=new Set([`jsxComponent`,`table`,`tableRow`,`tableCell`,`tableHeader`,`list`,`listItem`,`blockquote`,`codeBlock`,`heading`]),N0={type:`__br__`},P0=/^<br\s*\/?>$/i;function F0(e){let t=B0(e,F0);return(t.type===`tableCell`||t.type===`tableHeader`)&&t.content?{...t,content:I0(t.content)}:t}function I0(e){let t=[];for(let n of e){let e=L0(n);e.length!==0&&(t.length>0&&t.push(N0),t.push(...e))}return t}function L0(e){return e.text!==void 0||e.type===`hardBreak`||e.type===`jsxInline`?[e]:!e.content||e.content.length===0?[]:e.content.some(e=>e.text===void 0&&e.type!==`hardBreak`&&e.type!==`jsxInline`&&!!e.content)?I0(e.content):e.content}function R0(e){return e.type===`hardBreak`||e.type===N0.type||e.text!==void 0&&P0.test(e.text.trim())?N0:B0(e,R0)}var z0=[{label:`table-cell-block-flatten`,severity:`pm-model-caused`,rationale:`GFM table cells have no block spelling; a block placed in a cell is flattened to inline on serialize, so a cell-with-blocks and a cell-with-inline describe the same persisted document.`,proofPointer:`markdown/table-cell-flatten.ts flattenCellBlocks (table-cell-flatten-dropped-block event)`,canonicalize:F0},{label:`void-hardbreak-br`,severity:`serializer-caused`,rationale:`A void hardBreak inside a table cell or heading serializes to a literal <br /> that a fresh parse keeps as text; the node form and the literal form are the same break.`,proofPointer:`markdown/void-br-promoter.ts + markdown/to-markdown-handlers.ts break handler`,canonicalize:R0}];function B0(e,t){return e.content?{...e,content:e.content.map(t)}:e}function V0(e,t){let n={};e.type!==void 0&&(n.type=e.type),e.text!==void 0&&(n.text=e.text);let r=H0(e.attrs,t);return r&&(n.attrs=r),e.marks&&e.marks.length>0&&(n.marks=[...e.marks].map(e=>({type:e.type,attrs:H0(e.attrs,t)})).sort((e,t)=>W0(e).localeCompare(W0(t)))),e.content&&e.content.length>0&&(n.content=e.content.map(e=>V0(e,t))),n}function H0(e,t){if(!e)return null;let n={};for(let r of Object.keys(e).sort()){if(j0.has(r)||t?.(r))continue;let i=e[r];i!=null&&(n[r]=t?U0(i,t):i)}return Object.keys(n).length>0?n:null}function U0(e,t){if(Array.isArray(e))return e.map(e=>U0(e,t));if(e&&typeof e==`object`){let n={};for(let[r,i]of Object.entries(e))t(r)||(n[r]=U0(i,t));return n}return e}function W0(e){return JSON.stringify(e,(e,t)=>{if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let n of Object.keys(t).sort())e[n]=t[n];return e}return t})}function G0(e){let t=``,n=e=>{if(e.text!==void 0&&(t+=e.text),e.content)for(let t of e.content)n(t)};return n(e),t.replace(/\s+/g,``)}function K0(e){let t=[],n=e=>{if(e.type&&M0.has(e.type)){let n=e.type===`jsxComponent`?String(e.attrs?.componentName??``):``;t.push(n?`${e.type}:${n}`:e.type)}if(e.content)for(let t of e.content)n(t)};return n(e),t.sort()}function q0(e){let t=e,n=[];for(let e of z0){let r=W0(t),i=e.canonicalize(t);W0(i)!==r&&n.push(e.label),t=i}return{normalized:t,fired:n}}function J0(e,t,n={}){let r=q0(e),i=q0(t),a=[...new Set([...r.fired,...i.fired])];if(!A0(G0(r.normalized),G0(i.normalized)))return{equivalent:!1,level:`L1`,reason:`content-loss`,appliedDegrades:a,detail:`authored text did not survive the round-trip`};let o=K0(r.normalized),s=K0(i.normalized);if(W0(o)!==W0(s))return{equivalent:!1,level:`L1`,reason:`structural-shatter`,appliedDegrades:a,detail:`container multiset diverged: [${o.join(`, `)}] vs [${s.join(`, `)}]`};let c=V0(r.normalized,n.ignoreAttrs),l=V0(i.normalized,n.ignoreAttrs);return W0(c)===W0(l)?{equivalent:!0,level:a.length>0?`L2`:`L1`,appliedDegrades:a}:{equivalent:!1,level:`L2`,reason:`structural-divergence`,appliedDegrades:a,detail:Y0(c,l)}}function Y0(e,t,n=`doc`){let r=e,i=t;if(!r||!i)return`${n}: node presence differs`;if(r.type!==i.type)return`${n}: type ${String(r.type)} vs ${String(i.type)}`;let a=r.content??[],o=i.content??[];if(a.length!==o.length)return`${n}(${String(r.type)}): child count ${a.length} vs ${o.length}`;for(let e=0;e<a.length;e++)if(W0(a[e])!==W0(o[e]))return Y0(a[e],o[e],`${n}>${String(r.type)}[${e}]`);return`${n}(${String(r.type)}): attrs or marks differ`}function X0(e,t,n){return!J0(e,t,{ignoreAttrs:n}).equivalent}var Z0=new Set([`src`,`href`,`size`]),Q0=new Set([`WikiEmbedImage`,`WikiEmbedVideo`,`WikiEmbedAudio`,`WikiEmbedFile`]);function $0(e){if(Array.isArray(e))return e.map(e=>$0(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))Z0.has(n)||(t[n]=$0(r));return t}return e}function e2(e){return e.type===`jsxComponent`&&typeof e.attrs?.componentName==`string`&&Q0.has(e.attrs.componentName)?$0(e):e.content?{...e,content:e.content.map(e2)}:e}function t2(e){if(Array.isArray(e))return e.map(e=>t2(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))n!==`position`&&(t[n]=t2(r));return t}return e}function n2(e){if(e.type===`jsxComponent`)return e;if(e.content)for(let t of e.content){let e=n2(t);if(e)return e}}function r2(e){let t=e.cacheLimit??2048,n=new Map,r=r=>{let i=n.get(r);if(i!==void 0)return i;let a=n2(e.parse(r)),o=a?e2(t2(a)):null;if(n.size>=t){let e=n.keys().next().value;e!==void 0&&n.delete(e)}return n.set(r,o),o};return{isDiverged(e){if(e.type!==`jsxComponent`||!e.attrs||e.attrs.kind===`expression`)return!1;let t=e.attrs.sourceRaw;if(typeof t!=`string`||t.length===0)return!1;let n=r(t);return n?X0(n,e2(t2(e))):!1}}}function i2(e,t){let n=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],r=e.attrs.props??{},i=new Map,a=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&i.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&a.add(e.name);for(let[e,t]of Object.entries(r)){let r=n.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(i.has(e)&&Object.is(i.get(e),t)){r>=0&&n.splice(r,1);continue}if(a.has(e)&&t===``){r>=0&&n.splice(r,1);continue}if(r>=0){let e=n[r];if(e.type===`mdxJsxAttribute`&&e.value!=null&&typeof e.value==`object`&&e.value.type===`mdxJsxAttributeValueExpression`&&a2(e.value.value,t))continue}let o=o2(e,t);r>=0?n[r]=o:n.push(o)}return n}function a2(e,t){try{return JSON.stringify(JSON.parse(e))===JSON.stringify(t)}catch{return!1}}function o2(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let n;try{n=JSON.stringify(t)}catch{n=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:n}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function s2(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:i2(t,r),children:n.all(t),data:{}}}function c2(e,t,n){let r=t.attrs.props?.children;return{type:`mdxJsxTextElement`,name:e,attributes:i2(t,n),children:typeof r==`string`&&r!==``?[{type:`text`,value:r}]:[],data:{}}}var l2=/^[A-Za-z0-9]{20,}$/,u2=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function d2(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function f2(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let n=t[1]??``;return l2.test(n)?n:null}function p2(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!d2(t.hostname))return null;let n=f2(t);if(!n)return null;let r=t.searchParams.get(`t`);return{id:n,startRaw:r&&r.length>0&&u2.test(r)?r:null}}function m2(e){return p2(e)!==null}function h2(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function g2(e){if(typeof e!=`string`||e.length===0)return!1;let t;try{t=new URL(e)}catch{return!1}return t.protocol!==`http:`&&t.protocol!==`https:`?!1:h2(t.hostname)}var _2=/^[A-Za-z0-9_-]{11}$/;function v2(e){let t=e.toLowerCase();return t===`youtube.com`||t===`www.youtube.com`||t===`m.youtube.com`||t===`music.youtube.com`||t===`youtu.be`||t===`youtube-nocookie.com`||t===`www.youtube-nocookie.com`}function y2(e){if(e.length===0)return null;if(/^[0-9]+$/.test(e)){let t=Number.parseInt(e,10);return t>0?t:null}let t=e.match(/^(?:([0-9]+)h)?(?:([0-9]+)m)?(?:([0-9]+)s?)?$/);if(!t)return null;let n=t[1]?Number.parseInt(t[1],10):0,r=t[2]?Number.parseInt(t[2],10):0,i=t[3]?Number.parseInt(t[3],10):0,a=n*3600+r*60+i;return a>0?a:null}function b2(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return _2.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return _2.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function x2(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!v2(t.hostname))return null;let n=b2(t);if(!n)return null;let r=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:n,startSeconds:r.length>0?y2(r):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}var S2=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)",iconPicker:!0},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)",colorPicker:!0},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`,hideWhen:e=>e.collapsible!==!0},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],C2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:Ku,autoFocus:!0},{name:`alt`,type:`string`,required:!0,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],w2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Embedded page URL (must start with http:// or https://)`,autoFocus:!0},{name:`title`,type:`string`,required:!1,description:`Iframe title (accessible label for screen readers)`},{name:`width`,type:`string`,required:!1,advanced:!0,description:`Embed width as a CSS length (e.g. "100%", "640px")`,cssLengthInput:!0},{name:`height`,type:`string`,required:!1,advanced:!0,description:`Embed height as a CSS length (e.g. "26rem", "480px")`,cssLengthInput:!0},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],T2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:qu,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`,hideWhen:e=>typeof e.src==`string`&&(g2(e.src)||m2(e.src))},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`,accept:Ku,hideWhen:e=>typeof e.src==`string`&&(g2(e.src)||m2(e.src))},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`,hideWhen:e=>typeof e.src==`string`&&m2(e.src)},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`,hideWhen:e=>typeof e.src==`string`&&(g2(e.src)||m2(e.src))},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`,hideWhen:e=>typeof e.src==`string`&&(x2(e.src)!==null||g2(e.src)||m2(e.src))},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],E2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:Ju,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],D2=[{name:`title`,type:`string`,required:!0,description:`Heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the block renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)",iconPicker:!0},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],O2=[S2[0],S2[1],S2[4],S2[5],S2[6]],k2=[C2[0],C2[1],C2[7]],A2=[D2[0],D2[1],D2[4],D2[5]],j2=[{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`,`justify`],required:!1,defaultValue:`center`,description:"Block alignment from the `<div align>` attribute."},{name:`tag`,type:`string`,required:!1,defaultValue:`div`,hidden:!0,description:`Source wrapper tag (div or center).`},{name:`sourceAttrs`,type:`string`,required:!1,defaultValue:``,hidden:!0,description:`Raw opener-tag attribute bytes preserved for round-trip.`}],M2=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],N2=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],P2=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],F2=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],I2=[{name:`label`,type:`string`,required:!0,autoFocus:!0,defaultValue:`Tab`,description:`Tab strip label — shown in the clickable pill at the top`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#tab-npm`)"}],L2=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],R2=[L2[0]],z2=[L2[0]],B2=[{name:`chart`,type:`string`,required:!0,hidden:!0,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],V2=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],H2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],U2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:Yu,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}],W2=[{name:`src`,type:`string`,required:!0,description:"Path of the source doc, extension-less (e.g. `api-spec`).",autoFocus:!0},{name:`anchor`,type:`string`,required:!0,description:"Id of the `<MirrorSource>` block within the source doc."}],G2=[{name:`id`,type:`string`,required:!0,description:"Stable id agents and authors use to reference this block from `<Mirror>` elsewhere.",autoFocus:!0},{name:`children`,type:`reactnode`,required:!0,description:`Block content this MirrorSource owns — paragraphs, callouts, code, nested JSX, anything.`}];function K2(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function q2(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function J2(e){let t=e.attrs.props,n=t?.target??``,r=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,i=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,a=r??(i?`${n}#${i}`:n);return{type:`wikiLinkEmbed`,value:a,data:{target:n,anchor:i,alias:r},children:[{type:`text`,value:a}]}}var Y2=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:S2,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>s2(`Callout`,e,t,S2)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:C2,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>s2(`img`,e,t,C2)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:T2,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>s2(`video`,e,t,T2)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:E2,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>s2(`audio`,e,t,E2)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:U2,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>s2(`Pdf`,e,t,U2)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:H2,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>s2(`File`,e,t,H2)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:w2,icon:`AppWindow`,category:`media`,displayName:`Embed`,description:'Inline web embed (iframe) — drop a URL, get a resizable preview pane. For YouTube / Vimeo / Loom prefer `<video src="…">` (player props, click-facade); `<Embed>` auto-rewrites watch URLs as a fallback.',searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>s2(`Embed`,e,t,w2)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:D2,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],exampleBody:`Body content revealed when the accordion is expanded.`,serialize:(e,t)=>s2(`Accordion`,e,t,D2)},{name:`Toggle`,surface:`canonical`,hasChildren:!0,props:D2,icon:`ChevronRight`,category:`content`,displayName:`Toggle`,description:"Standalone expand/collapse block (Notion-style). Same render + props as `<Accordion>` — pick whichever vocabulary matches the vault.",searchTerms:[`toggle`,`collapsible`,`expand`,`details`,`disclosure`,`fold`],exampleBody:`Body content revealed when the toggle is expanded.`,serialize:(e,t)=>s2(`Toggle`,e,t,D2)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:F2,icon:`LayoutPanelTop`,category:`content`,displayName:`Tabs`,description:"Horizontal tab strip + active panel below. Each `<Tab>` child is one panel; clickable pills at the top switch the active one. Active selection is ephemeral (resets on reload).",searchTerms:[`tabs`,`tabbed`,`panels`,`tabgroup`,`switcher`],exampleBody:`<Tab label="One">Body of the first tab panel.</Tab>
|
|
505
505
|
<Tab label="Two">Body of the second tab panel.</Tab>`,serialize:(e,t)=>s2(`Tabs`,e,t,F2)},{name:`Tab`,surface:`canonical`,hasChildren:!0,props:I2,icon:`PanelTop`,category:`content`,displayName:`Tab`,description:"A single tab panel inside a `<Tabs>` container — carries the strip label and the block-content body.",searchTerms:[`tab`,`panel`],exampleBody:"Panel content — must be nested inside a `<Tabs>` parent.",serialize:(e,t)=>s2(`Tab`,e,t,I2)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:L2,icon:`Sigma`,category:`content`,displayName:`Math`,description:`Block math equation rendered with KaTeX from a LaTeX source string`,searchTerms:[`math`,`latex`,`equation`,`formula`,`katex`,`tex`],serialize:(e,t)=>s2(`Math`,e,t,L2)},{name:`MermaidFence`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:B2,icon:`Workflow`,category:`content`,displayName:`Mermaid`,placeholder:{label:`Add a Mermaid diagram`},description:"Diagram rendered from Mermaid source (flowchart, sequence, class, state, ER, gantt, pie). Authored exclusively as ` ```mermaid ` fenced code.",searchTerms:[`mermaid`,`diagram`,`flowchart`,`graph`,`sequence`,`sequencediagram`,`class`,`state`,`er`,`erdiagram`,`gantt`,`pie`,`chart`],serialize:e=>({type:`code`,lang:`mermaid`,meta:null,value:e.attrs.props?.chart??``})},{name:`Mirror`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:W2,icon:`CopyPlus`,category:`content`,displayName:`Mirror`,description:"Render a read-only copy of a `<MirrorSource>` block from another doc. Use to keep the same content in sync across multiple docs without copy-paste — edits land at the source, every Mirror reflects the change.",searchTerms:[`mirror`,`sync`,`synced`,`transclude`,`embed`,`reference`,`shared block`],serialize:(e,t)=>s2(`Mirror`,e,t,W2)},{name:`MirrorSource`,surface:`canonical`,hasChildren:!0,props:G2,icon:`GitBranch`,category:`content`,displayName:`Mirror Source`,description:'Mark a block as the source of truth for content that appears in multiple docs. Wrap any block content; `<Mirror src="…" anchor="<id>">` references render this verbatim read-only at every call-site. Edit here, propagate everywhere.',searchTerms:[`mirror source`,`sync source`,`source block`,`master block`,`shared`],exampleBody:"Authoritative content lives inside this block — edits here propagate to every `<Mirror>` that references this id.",serialize:(e,t)=>s2(`MirrorSource`,e,t,G2)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:O2,icon:`MessageSquareWarning`,category:`content`,displayName:`GFM Callout`,description:"GFM blockquote alert (`> [!NOTE]`) — read-only compat. Preserves `> [!NOTE]` syntax on round-trip; insert a fresh Callout block for the full prop surface.",rendersAs:`Callout`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),i=n?.type??`note`;return{type:`blockquote`,children:[{type:`html`,value:`[!${(r.has(i.toLowerCase())?i:`note`).toUpperCase()}]${n?.collapsible?n.defaultOpen===!1?`-`:`+`:``}${n?.title?` ${n.title}`:``}`},...t.all(e).filter(e=>{if(e.type!==`paragraph`)return!0;let t=e;return Array.isArray(t.children)&&t.children.length>0})]}}},{name:`CommonMarkImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:k2,icon:`Image`,category:`media`,displayName:`CommonMark Image`,description:'CommonMark image (``) — read-only compat. Preserves `` syntax on round-trip; insert a fresh Image block for the full HTML-native attribute surface (srcset, sizes, decoding, etc.).',rendersAs:`img`,translateProps:e=>e,serialize:e=>{let t=e.attrs.props;return{type:`paragraph`,children:[{type:`image`,url:t?.sourceUrl??t?.src??``,alt:t?.alt??``,title:t?.title??null}]}}},{name:`WikiEmbedImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:M2,icon:`ZoomIn`,category:`media`,displayName:`Wiki Embed Image`,description:"Obsidian-style `![[file.png]]` wiki-embed — read-only compat. Edit the alt-text via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`img`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,alt:t??n}},serialize:J2},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:N2,icon:`Film`,category:`media`,displayName:`Wiki Embed Video`,description:"Obsidian-style `![[clip.mp4]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`video`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:J2},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:P2,icon:`Volume2`,category:`media`,displayName:`Wiki Embed Audio`,description:"Obsidian-style `![[song.mp3]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`audio`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:J2},{name:`WikiEmbedFile`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:V2,icon:`Paperclip`,category:`media`,displayName:`Wiki Embed File`,description:"Obsidian-style `![[file.zip]]` wiki-embed — read-only compat for arbitrary downloadable attachments. Renders through the `File` canonical (inline row with file-up icon + bold name + optional dim size). Edit the display name via the alias slot.",rendersAs:`File`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.size==`string`&&e.size.length>0?e.size:null;return{src:e.src,name:t??void 0,size:n??void 0}},serialize:J2},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:A2,icon:`ChevronRight`,category:`content`,displayName:`HTML5 Details`,description:"HTML5 `<details><summary>` collapsible — read-only compat. Preserves `<details>` syntax on round-trip; insert a fresh Accordion block for icon / description / group-name props.",rendersAs:`Accordion`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=n?.defaultOpen?` open`:``,i=n?.name?` name="${K2(n.name)}"`:``,a=n?.id?` id="${K2(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${q2(o)}</summary>`:``;return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<details${r}${i}${a}>\n${s}`,closer:`</details>`}}}}},{name:`HtmlAlignBlock`,surface:`canonical`,hasChildren:!0,props:j2,icon:`AlignCenter`,category:`content`,displayName:`Align block`,description:"GitHub-style `<div align>` wrapper. Children render as normal blocks with the alignment applied; the `<div align>` syntax is preserved on round-trip.",searchTerms:[`align`,`center`,`centered`,`div`],serialize:(e,t)=>{let n=e.attrs.props,r=n?.tag===`center`?`center`:`div`,i=typeof n?.align==`string`&&n.align?n.align:null,a=typeof n?.sourceAttrs==`string`?n.sourceAttrs:``,o=/(\balign\s*=\s*)(?:"[^"]*"|'[^']*'|[^\s"'<>]+)/i;return i!==null&&(r===`div`||i!==`center`)?a=o.test(a)?a.replace(o,`$1"${K2(i)}"`):`${a} align="${K2(i)}"`:(i===null||r===`center`&&i===`center`)&&(a=a.replace(RegExp(`\\s*${o.source}`,`i`),``)),{type:`mdxJsxFlowElement`,name:`HtmlAlignBlock`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<${r}${a}>`,closer:`</${r}>`}}}}},{name:`DollarMath`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:R2,icon:`Sigma`,category:`content`,displayName:`Dollar Math`,description:"Block math via `$$…$$` syntax — read-only compat. Preserves `$$…$$` form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`math`,value:e.attrs.props?.formula??``})},{name:`MathFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:z2,icon:`Sigma`,category:`content`,displayName:`Math Fence`,description:"Block math via ` ```math ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`math`,meta:null,value:e.attrs.props?.formula??``})}],X2={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>s2(e.attrs.componentName||`*`,e,t)};function Z2(){let e=new Map;e.set(`*`,X2);for(let t of Y2)e.set(t.name,t);return{get(t){return e.get(t)},getOrWildcard(t){return e.get(t)??e.get(`*`)},set(t,n){e.set(t,n)},has(t){return e.has(t)},entries(){return e.entries()}}}var Q2={parseFallback:{blockLevel:0,wholeDoc:0,wholeDocBudget:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{},jsxPopoverCloseRestoreFailed:{},jsxKeyboardDeleteFailed:{},blockGripClickSelectFailed:{},jsxArrowNodeSelectFailed:{}};function $2(){Q2.parseFallback.blockLevel++}function e4(){Q2.parseFallback.wholeDoc++}function t4(){Q2.parseFallback.wholeDocBudget++}function n4(e){Q2.jsxRenderFailure[e]=(Q2.jsxRenderFailure[e]??0)+1}function r4(e){Q2.jsxAutoConvertFailed[e]=(Q2.jsxAutoConvertFailed[e]??0)+1}function i4(e){Q2.jsxAutoConvertSucceeded[e]=(Q2.jsxAutoConvertSucceeded[e]??0)+1}function a4(e){Q2.jsxPropDropped[e]=(Q2.jsxPropDropped[e]??0)+1}function o4(e){Q2.jsxMoveFailed[e]=(Q2.jsxMoveFailed[e]??0)+1}function s4(e){Q2.jsxStuckCopyFailed[e]=(Q2.jsxStuckCopyFailed[e]??0)+1}function c4(e){Q2.jsxStuckDeleteFailed[e]=(Q2.jsxStuckDeleteFailed[e]??0)+1}function l4(e){Q2.jsxPopoverCloseRestoreFailed[e]=(Q2.jsxPopoverCloseRestoreFailed[e]??0)+1}function u4(e){Q2.jsxKeyboardDeleteFailed[e]=(Q2.jsxKeyboardDeleteFailed[e]??0)+1}function d4(e){Q2.blockGripClickSelectFailed[e]=(Q2.blockGripClickSelectFailed[e]??0)+1}function f4(e){Q2.jsxArrowNodeSelectFailed[e]=(Q2.jsxArrowNodeSelectFailed[e]??0)+1}var p4=/^(`{3,}|~{3,})/gm;function m4(e){let t=[],n=null;for(let r of e.matchAll(p4)){let e=r[1],i=r.index;n?e[0]===n.marker[0]&&e.length>=n.marker.length&&(t.push([n.offset,i+r[0].length]),n=null):n={marker:e,offset:i}}return n&&t.push([n.offset,e.length]),t}function h4(e,t){return t.some(([t,n])=>e>=t&&e<n)}var g4=/`+/g;function _4(e){let t=[];g4.lastIndex=0;for(let n of e.matchAll(g4))t.push({offset:n.index,length:n[0].length});let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let i=e+1;i<t.length;i++){let a=t[i];if(a.length===r.length){n.push([r.offset,a.offset+a.length]),e=i;break}}}return n}var v4=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function y4(e){let t=m4(e),n=[];for(let r of e.matchAll(v4))h4(r.index,t)||n.push(r[0].trimEnd());return n.length>0?`${n.join(`
|
|
506
506
|
`)}\n\n`:``}var b4=500,x4=1e3;function S4(e,t){let n={startMs:typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),calls:0};return E4(e,t.parse,0,n)}function C4(e){return e.calls>=x4?!0:(typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now())-e.startMs>=b4}var w4=500;function T4(e){return e instanceof Error?{name:e.name,message:e.message.slice(0,w4),stack:e.stack?.split(`
|
|
507
507
|
`).slice(0,4).join(`
|
|
@@ -565,12 +565,12 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
|
|
|
565
565
|
`;return l.join(f)},table(e,t,n,r){let i=n.enter(`table`),a=[],o=[],s=e.children??[];for(let e of s){let t=e.children??[],i=[],s=[];for(let e of t){let t=n.enter(`tableCell`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,{...r,before:` `,after:` `});a(),t(),i.push(o);let c=e.data?.sourcePadding;s.push(c&&typeof c.left==`number`&&typeof c.right==`number`?{left:c.left,right:c.right}:null)}a.push(i),o.push(s)}i();let c=e.align??[],l=e.data?.sourceDashCounts,u=a[0]?.length??0,d=a.slice(1).reduce((e,t)=>Math.max(e,t.length),0),f=Math.max(u,d,c.length);if(f===0)return console.warn(JSON.stringify({event:`table-serialize-dropped-empty`,rows:s.length})),``;let p=[];for(let e=0;e<f;e++){let t=c[e],n=``,r=``;t===`center`?(n=`:`,r=`:`):t===`left`?n=`:`:t===`right`&&(r=`:`);let i=l?.[e],a=typeof i==`number`&&i>=1?i:1;p.push(n+`-`.repeat(a)+r)}let m=(e,t)=>{let n=[];for(let r=0;r<f;r++){let i=e[r]??``,a=t[r]??{left:1,right:1};n.push(` `.repeat(a.left)+i+` `.repeat(a.right))}let r=v&&!v.leading?``:`|`,i=v&&!v.trailing?``:`|`;return`${r}${n.join(`|`)}${i}`},h=e.data?.sourceAlignmentPadding,g=Array.from({length:f},(e,t)=>{let n=h?.[t];return n&&typeof n.left==`number`&&typeof n.right==`number`?n:null}),_=e.data?.sourceOuterPipes,v=_&&f>=2&&a.every(e=>{let t=(e[0]??``).trim(),n=(e[f-1]??``).trim();return(_.leading||t.length>0)&&(_.trailing||n.length>0&&!n.endsWith(`\\`))})?_:null;if(a.length===0)return m(p,g);let y=[];y.push(m(a[0],o[0]??[])),y.push(m(p,g));for(let e=1;e<a.length;e++)y.push(m(a[e],o[e]??[]));return y.join(`
|
|
566
566
|
`)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=c5(i.attributes??[]);return!i.children||i.children.length===0?s?c?`<${s} ${c} />`:`<${s} />`:``:Iie({...i,attributes:(i.attributes??[]).map(zie)},t,n,r)},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=_5(n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),r,`==`),o+=i.move(`==`),a(),o},underline(e,t,n,r){let i=e.data?.sourceForm===`ins`?`<ins>`:`<u>`,a=e.data?.sourceForm===`ins`?`</ins>`:`</u>`,o=n.createTracker(r),s=n.enter(`underline`),c=o.move(i);return c+=n.containerPhrasing(e,{before:c,after:a,...o.current()}),c+=o.move(a),s(),c},comment(e,t,n,r){let i=e.data?.sourceForm,a=i===`html`?`<!-- `:`%%`,o=i===`html`?` -->`:`%%`,s=n.createTracker(r),c=n.enter(`comment`),l=s.move(a);return l+=n.containerPhrasing(e,{before:l,after:o,...s.current()}),l+=s.move(o),c(),l},commentBlock(e,t,n,r){let i=n.createTracker(r),a=n.enter(`commentBlock`),o=e.children??[],s=e.data?.sourceForm,c=e.data?.sourceLayout,l=o.length===1&&o[0]?.type===`paragraph`;if(s===`html`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`<!-- `,after:` -->`,...i.current()});return a(),`<!-- ${t} -->`}if(c===`inline`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`%% `,after:` %%`,...i.current()});return a(),`%% ${t} %%`}let u=n.containerFlow(e,i.current());return a(),`%%\n\n${u}\n\n%%`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;if(typeof t==`string`)return t;let n=e.name??``,r=c5(e.attributes??[]),i=(e.children??[]).map(e=>e&&typeof e==`object`&&`value`in e?String(e.value??``):``).join(``);return i?r?`<${n} ${r}>${i}</${n}>`:`<${n}>${i}</${n}>`:r?`<${n} ${r} />`:`<${n}/>`},rawMdxFallback(e){return e.value??``},blockquote(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.containerFlow(e,a.current());i();let s=e.data?.sourceMarkerSpacings,c=0;return n.indentLines(o,(e,t,n)=>{if(n)return`>`;let r=c++,i=s?.[r];return i===`lazy`&&r>0&&!Lie.test(e)?e:i===`none`||i===0?`>${e}`:typeof i==`number`&&i>=2&&!e.startsWith(` `)?`>${` `.repeat(i)}${e}`:`> ${e}`})}};function c5(e){let t=[];for(let n of e){if(n.type===`mdxJsxExpressionAttribute`){t.push(`{${n.value}}`);continue}let e=n.name;if(n.value===null||n.value===void 0){t.push(e);continue}if(typeof n.value==`string`){n.value.includes(`"`)?t.push(`${e}={${l5(n.value)}}`):t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function l5(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function zie(e){return e.type===`mdxJsxAttribute`&&typeof e.value==`string`&&e.value.includes(`"`)?{type:`mdxJsxAttribute`,name:e.name,value:{type:`mdxJsxAttributeValueExpression`,value:l5(e.value)}}:e}function u5(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function d5(e){if(!e)return``;let t=0,n=!0;for(let r of e)r===`(`?t++:r===`)`&&(t--,t<0&&(n=!1));return t!==0&&(n=!1),n?e:e.replace(/[\\()]/g,`\\$&`)}function Bie(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>Vie(t)?e:`\\${e}`)}function Vie(e){if(e.charCodeAt(0)!==35)return!1;let t=e[1]===`x`||e[1]===`X`?Number.parseInt(e.slice(2),16):Number.parseInt(e.slice(1),10);return t===9||t===10||t===11||t===12||t===13||t===32||t===160}var f5=``,Hie=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function Uie(e){return e.replace(Hie,e=>KZ(e)?f5+e.slice(1):e)}function Wie(e){return/[\r\n][\t ]*$/.test(e)}function p5(e,t,n){let{matched:r}=l3(t,{escapeAware:!1});if(r.length===0)return m5(e,t,n);let i=``,a=0,o=r=>{r>a&&(i+=m5(e,t.slice(a,r),{...n,before:n.before+i,after:t.slice(r,r+1)||n.after})),a=r};for(let e of r)o(e.start),!Wie(n.before+i)&&(i+=t.slice(e.start,e.end),a=e.end);return o(t.length),i}function m5(e,t,n){let r=e.unsafe;e.unsafe=r.filter(e=>!(e.character===`&`&&e.after===`[#A-Za-z]`||e.character===`<`||e.character===`[`||e.character===`(`||e.character===`!`&&e.after===`\\[`&&e.inConstruct===`phrasing`||e.character===`@`&&e.before===`[+\\-.\\w]`||e.character===`{`&&Array.isArray(e.inConstruct)&&e.inConstruct.includes(`phrasing`)||e.character==="`"||(e.character===`*`||e.character===`_`||e.character===`~`)&&e.inConstruct===`phrasing`||e.character===`=`&&e.atBreak===!0||e.character===` `&&e.inConstruct===`phrasing`&&e.after===`[\\r\\n]`||e.character===` `&&e.inConstruct===`phrasing`&&e.after===`[\\r\\n]`)),e.unsafe=e.unsafe.map(e=>{if(e.character!==`)`||e.atBreak!==!0||e.before!==`\\d+`||e.after!==void 0)return e;let t={...e,after:`(?:[ \r
|
|
567
567
|
]|$)`};return delete t._compiled,t});let i;try{i=e.safe(Uie(t),n)}finally{e.unsafe=r}return i=i.replaceAll(f5,`\\&`),Bie(Jie(i,n))}var h5=1,Gie=2;function g5(e){if(Number.isNaN(e))return`ws`;let t=T(e);return t===h5?`ws`:t===Gie?`punct`:`other`}function Kie(e,t,n){let r=g5(t),i=g5(n),a=i!==`ws`&&(i===`other`||r!==`other`),o=r!==`ws`&&(r===`other`||i!==`other`);return e===`_`?a&&(!o||r===`punct`)||o&&(!a||i===`punct`):a||o}function qie(e,t,n){let r=t;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;if(r<e.length)return e[r]===`
|
|
568
|
-
`||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function Jie(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&qie(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=Kie(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function _5(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);v5(i.charCodeAt(i.length-1),s,r)&&(o=y5(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return v5(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+y5(c)),o}function v5(e,t,n){return!(T(t)!==h5||n===`_`&&T(e)===void 0)}function y5(e){return`&#x${e.toString(16).toUpperCase()};`}function Yie(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!Zie(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function Xie(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=_5(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function Zie(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}function b5(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var Qie=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=Ew(e.extensions),this.handlers=rae(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?r2({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=iae(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=wie({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=Tie({toMarkdownHandlers:Rie})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return Die(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?Oie(e,this.parseProcessor):{type:`root`,children:[]}}parseToEditorMdast(e){return e.trim()?kie(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?S4(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e,t){let n;try{n=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}let r=this.freshnessHolder.checker;t?.skipFreshnessDerive&&(this.freshnessHolder.checker=void 0);try{return Aie(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}},x5=Z2();function S5(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else i?.type===`boolean`?r[e]=t.value===`true`:r[e]=t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function $ie(e){let t=!1;return e.descendants(e=>t?!1:e.type.name===`jsxInline`?(e.attrs.sourceDirty&&(t=!0),!1):e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function eae(e,t){return e.attrs.sourceDirty||$ie(e)?!0:t?t.isDiverged(e.toJSON()):!1}function tae(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0?!0:t.every(e=>e.type===`text`&&e.value===``)}function C5(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function w5(e,t){if(e.length===0)return C5({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return C5({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[w5(n.children,t)]}}return C5({type:`inlineCode`,value:T5(e)},t)}function T5(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=T5(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}var nae=Yu;function rae(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=OP(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=OP(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=s5(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i)return r.sourceLiteral?e.text(n,[r.sourceLiteral.create({sourceRaw:i})]):e.text(n);let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n);let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&YZ(t.raw)!==null&&KZ(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length);if(i)if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=YZ(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i));u=t.offset+t.length}}if(u<n.length){let t=n.slice(u);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=kP(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=kP(r.highlight)),r.underline&&(i.underline=kP(r.underline,e=>({sourceForm:e.data?.sourceForm===`ins`?`ins`:`u`}))),r.comment&&(i.comment=kP(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=OP(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=kP(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=kP(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=OP(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceUnclosedFence:t.data?.sourceUnclosedFence??!1,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`,sourceRaw:e.data?.sourceRaw??null})),n.list&&(i.list=OP(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=OP(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.data?.resolvedUrl??``,title:n.data?.resolvedTitle??null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=x5.getOrWildcard(o),c=S5(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=s5(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}let i=t.name??``,o=i?x5.get(i):void 0;if(o&&n.jsxInline){let e=S5(t.attributes,o.props),a=r(t.data)??``,s=(t.children??[]).map(e=>e&&typeof e==`object`&&`value`in e?String(e.value??``):``).join(``);return s&&(e.children=s),n.jsxInline.createAndFill({componentName:i,attributes:t.attributes,sourceRaw:a,sourceDirty:!1,props:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=pQ(o),{resolveEmbed:u,sourcePath:d}=t.current,f=u&&d?u(o,d)??null:null,p=f?`/${f}`:o,m=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(m&&nae.has(l)&&n.jsxComponent&&x5.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,alt:s??o,target:o,anchor:c,alias:s}});if(m&&Xu.has(l)&&n.jsxComponent&&x5.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&Qu.has(l)&&n.jsxComponent&&x5.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&$u.has(l)&&n.jsxComponent&&x5.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:b5(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=OP(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function iae(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=PP(`paragraph`)),i.blockquote&&(n.blockquote=PP(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),i.heading&&(n.heading=PP(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),i.codeBlock&&(n.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceUnclosedFence:e.attrs.sourceUnclosedFence===!0?!0:void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),i.thematicBreak&&(n.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),i.hardBreak&&(n.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle,...typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0?{sourceRaw:e.attrs.sourceRaw}:{}}})),i.list&&(n.list=PP(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),i.listItem&&(n.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&tae(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),i.table&&(n.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),i.tableRow&&(n.tableRow=PP(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:y0(t)},r=e.attrs.sourcePadding;return typeof r==`object`&&r&&typeof r.left==`number`&&typeof r.right==`number`&&(n.data={sourcePadding:r}),n};if(i.tableCell&&(n.tableCell=(e,t,n)=>o(e,n.all(e))),i.tableHeader&&(n.tableHeader=(e,t,n)=>o(e,n.all(e))),i.image&&(n.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),i.imageReference&&(n.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),i.htmlBlock&&(n.htmlBlock=e=>({type:`html`,value:e.attrs.content})),i.linkDefinition??i.linkRefDef){let e=i.linkDefinition?`linkDefinition`:`linkRefDef`;n[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(i.jsxComponent&&(n.jsxComponent=(e,n,r)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let i=e.attrs.componentName||null,a=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!eae(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:x5.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:x5,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),i.rawMdxFallback&&(n.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),i.jsxInline&&(n.jsxInline=e=>{let t=e.attrs.componentName||``;if(t&&e.attrs.sourceDirty)return c2(t,e,x5.get(t)?.props);let n=e.attrs.attributes,r=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:t||null,attributes:Array.isArray(n)?n:[],children:[],data:{sourceRaw:String(r)}}}),i.mathInline&&(n.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),i.wikiLink&&(n.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),i.tag&&(n.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),i.wikiLinkEmbed&&(n.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),a.emphasis&&(r.emphasis=FP(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=FP(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return w5(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0?!0:void 0})}),a.strike??a.delete){let e=a.strike?`strike`:`delete`;r[e]=FP(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=FP(`mark`)),a.underline&&(r.underline=FP(`underline`,e=>({data:{sourceForm:e.attrs.sourceForm===`ins`?`ins`:`u`}}))),a.comment&&(r.comment=FP(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=PP(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),i.footnoteReference&&(n.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),i.footnoteDefinition&&(n.footnoteDefinition=PP(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),a.link&&(r.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=i||(r?`${t}#${r}`:t),o=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return o!==a&&o.trim().length>0&&!o.includes(`]]`)&&(i=o,a=o),{type:`wikiLinkEmbed`,value:a,data:{target:t,anchor:r,alias:i},children:[{type:`text`,value:a}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),a.escapeMark&&(r.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),a.sourceLiteral&&(r.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return ZZ(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:n,markHandlers:r}}var E5={default:!0,MD013:!1};function D5(e){return e??E5}function O5(e){let t=e.replace(/\\/g,`/`);for(;t.startsWith(`./`);)t=t.slice(2);let n=t.toLowerCase();for(let e of jX)if(n.endsWith(e))return t.slice(0,-e.length);return t}function k5(e){let t=(e===void 0?[]:Array.isArray(e)?e:[e]).map(e=>e.trim()).filter(e=>e.length>0),n=[],r=[],i=[],a=[],o=0;for(let e of t){let t=e.startsWith(`!`),s=t?e.slice(1):e;if(t||(o+=1),s.length===0){n.push({pattern:e,detail:`empty pattern`});continue}try{let e=(0,CV.default)(s,{dot:!0,strictBrackets:!0});(t?a:i).push(e)}catch(t){n.push({pattern:e,detail:t instanceof Error?t.message:String(t)});continue}if(s.endsWith(`/`))r.push({pattern:e,reason:`trailing-slash`});else if(s.startsWith(`/`))r.push({pattern:e,reason:`leading-slash`});else{let t=s.toLowerCase();jX.some(e=>t.endsWith(e))&&r.push({pattern:e,reason:`doc-extension`})}}let s=o===0;return{invalidPatterns:n,suspiciousPatterns:r,matches(e){if(e===void 0||e===``)return!1;let t=O5(e);return t===``||!(s||i.some(e=>e(t)))?!1:!a.some(e=>e(t))}}}function aae(e,t){if(t.length===0)return[];let n=(e===void 0?[]:Array.isArray(e)?e:[e]).map(e=>e.trim()).filter(e=>e.length>0),r=t.map(O5).filter(e=>e!==``),i=[];for(let e of n){let t=e.startsWith(`!`)?e.slice(1):e;if(t.length===0)continue;let n;try{n=(0,CV.default)(t,{dot:!0,strictBrackets:!0})}catch{continue}r.some(e=>n(e))||i.push(e)}return i}var A5=/[*?[\]{}()+@!|]/;function oae(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);if(n===-1||e.indexOf(`{`,t+1)!==-1||e.indexOf(`}`,n+1)!==-1)return null;let r=e.slice(t+1,n).split(`,`);return r.length<2||r.some(e=>e.trim()===``||A5.test(e))?null:r.map(r=>e.slice(0,t)+r+e.slice(n+1))}function j5(e){if(e.endsWith(`/`)||e.startsWith(`/`))return{kind:`matches-nothing`,pattern:e};try{(0,CV.default)(e,{dot:!0,strictBrackets:!0})}catch{return{kind:`invalid`,pattern:e}}if(e===`**`||e===`**/*`)return{kind:`everything`};{let t=e.match(/^\*\*\/(.+)\/\*\*$/)?.[1];if(t!==void 0&&!A5.test(t))return{kind:`folder-anywhere`,folder:t};let n=e.match(/^(.+)\/\*\*\/(.+)\/\*\*$/),r=n?.[1],i=n?.[2];if(r!==void 0&&i!==void 0&&!A5.test(r)&&!A5.test(i))return{kind:`folder-recursive-nested`,root:r,folder:i}}for(let t of[`/**/*`,`/**`])if(e.endsWith(t)){let n=e.slice(0,-t.length);if(n.length>0&&!A5.test(n))return{kind:`folder-recursive`,folder:n}}if(e.endsWith(`/*`)){let t=e.slice(0,-2);if(t.length>0&&!A5.test(t))return{kind:`folder-direct`,folder:t}}if(e.startsWith(`**/`)){let t=e.slice(3);if(t.length>0&&!t.includes(`/`)&&!A5.test(t))return{kind:`name-anywhere`,name:t}}return A5.test(e)?{kind:`pattern`,pattern:e}:{kind:`exact`,target:e}}function sae(e){let t=j5(e);if(t.kind!==`pattern`)return[t];let n=oae(e);if(n!==null){let e=n.map(j5);if(e.every(e=>e.kind!==`pattern`))return e}return[t]}function cae(e){let t=(e===void 0?[]:Array.isArray(e)?e:[e]).map(e=>e.trim()).filter(e=>e.length>0),n=[],r=[];for(let e of t){let t=e.startsWith(`!`),i=t?e.slice(1):e;i.length!==0&&(t?r:n).push(...sae(i))}return{includes:n,excludes:r}}function M5(e,t){let n=new Set,r=[];for(let i of e){if(i.enabled===!1||!i.schema||!k5(i.appliesTo).matches(t))continue;let e=i.key??i.file;n.has(e)||(n.add(e),r.push({file:i.file,schema:i.schema}))}return r}var N5={"draft-06":`http://json-schema.org/draft-06/schema#`,"draft-07":`http://json-schema.org/draft-07/schema#`,"2019-09":`https://json-schema.org/draft/2019-09/schema`,"2020-12":`https://json-schema.org/draft/2020-12/schema`},lae=Object.keys(N5),uae=`draft-07`,dae=new Map(lae.map(e=>[P5(N5[e]),e]));function P5(e){return e.replace(/^https?:\/\//,``).replace(/#$/,``)}function fae(e){let t=e.$schema;return t===void 0?uae:typeof t==`string`?dae.get(P5(t))??null:null}var F5=new Map;function pae(e){throw Error(`Unhandled FrontmatterSchemaDialect: ${JSON.stringify(e)}`)}function mae(e){let t=F5.get(e);if(t)return t;let n={allErrors:!0,strict:!1},r;switch(e){case`2020-12`:r=new xV.default(n);break;case`2019-09`:r=new bV.default(n);break;case`draft-06`:case`draft-07`:r=new yV.default(n);break;default:return pae(e)}return(0,SV.default)(r),F5.set(e,r),r}function hae(e){let{$schema:t,...n}=e;return n}function gae(e,t){let n=mae(e),r=t.$id;return typeof r==`string`&&r!==``&&n.removeSchema(r),n.compile(hae(t))}var I5=new Map,_ae=256;function vae(e){let t=JSON.stringify(e),n=I5.get(t);if(n!==void 0)return n;let r=null,i=fae(e);if(i!==null)try{r=gae(i,e)}catch{r=null}return I5.size>=_ae&&I5.clear(),I5.set(t,r),r}function yae(e){let t=new Map;if(!rm.test(e))return{data:{},keyLines:t};let{frontmatter:n}=am(e),r=sm(n);if(r.trim()===``)return{data:{},keyLines:t};let i=xu(r,{uniqueKeys:!1});if(i.errors.length>0)return{data:{},keyLines:t};let a=i.toJS();if(typeof a!=`object`||!a||Array.isArray(a))return{data:{},keyLines:t};if(ts(i.contents))for(let e of i.contents.items){let n=e.key;if(!rs(n)||typeof n.value!=`string`||!n.range)continue;let i=0,a=Math.min(n.range[0],r.length);for(let e=0;e<a;e++)r.charCodeAt(e)===10&&i++;t.has(n.value)||t.set(n.value,i+1)}return{data:a,keyLines:t}}function bae(e){if(e===void 0)return``;let t;if(typeof e==`string`)t=`"${e}"`;else try{t=JSON.stringify(e)??String(e)}catch{t=String(e)}return t.length>60&&(t=`${t.slice(0,57)}…`),` (got ${t})`}function xae(e){if(!e.startsWith(`/`))return null;let t=e.slice(1).split(`/`)[0]??``;return t===``?null:t.replace(/~1/g,`/`).replace(/~0/g,`~`)}function Sae(e){return e.split(`/`).slice(1).map(e=>e.replace(/~1/g,`/`).replace(/~0/g,`~`)).join(`.`)}function Cae(e,t){if(t.length===0)return[];let{data:n,keyLines:r}=yae(e),i=e.split(`
|
|
568
|
+
`||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function Jie(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&qie(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=Kie(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function _5(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=t.before??``,a=t.after??``,o=e,s=o.charCodeAt(0);v5(i.charCodeAt(i.length-1),s,r)&&(o=y5(s)+o.slice(1));let c=o.charCodeAt(o.length-1);return v5(a.charCodeAt(0),c,r)&&(o=o.slice(0,-1)+y5(c)),o}function v5(e,t,n){return!(T(t)!==h5||n===`_`&&T(e)===void 0)}function y5(e){return`&#x${e.toString(16).toUpperCase()};`}function Yie(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!Zie(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function Xie(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=_5(n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),r,i),s+=a.move(i),o(),s}function Zie(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}function b5(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var Qie=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};freshnessHolder={checker:void 0};constructor(e){this.schema=Ew(e.extensions),this.handlers=rae(this.schema,this.parseCtx),this.freshnessHolder.checker=e.deriveStructuralFreshness?r2({parse:e=>this.parseWithFallback(e)}):void 0;let{nodeHandlers:t,markHandlers:n}=iae(this.schema,this.freshnessHolder);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=wie({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=Tie({toMarkdownHandlers:Rie})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return Die(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?Oie(e,this.parseProcessor):{type:`root`,children:[]}}parseToEditorMdast(e){return e.trim()?kie(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?S4(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e,t){let n;try{n=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}let r=this.freshnessHolder.checker;t?.skipFreshnessDerive&&(this.freshnessHolder.checker=void 0);try{return Aie(n,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}finally{this.freshnessHolder.checker=r}}},x5=Z2();function S5(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else i?.type===`boolean`?r[e]=t.value===`true`:r[e]=t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function $ie(e){let t=!1;return e.descendants(e=>t?!1:e.type.name===`jsxInline`?(e.attrs.sourceDirty&&(t=!0),!1):e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function eae(e,t){return e.attrs.sourceDirty||$ie(e)?!0:t?t.isDiverged(e.toJSON()):!1}function tae(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0?!0:t.every(e=>e.type===`text`&&e.value===``)}function C5(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function w5(e,t){if(e.length===0)return C5({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return C5({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[w5(n.children,t)]}}return C5({type:`inlineCode`,value:T5(e)},t)}function T5(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=T5(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}var nae=Xu;function rae(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=OP(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=OP(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=s5(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i)return r.sourceLiteral?e.text(n,[r.sourceLiteral.create({sourceRaw:i})]):e.text(n);let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n);let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&YZ(t.raw)!==null&&KZ(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length);if(i)if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=YZ(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i));u=t.offset+t.length}}if(u<n.length){let t=n.slice(u);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=kP(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=kP(r.highlight)),r.underline&&(i.underline=kP(r.underline,e=>({sourceForm:e.data?.sourceForm===`ins`?`ins`:`u`}))),r.comment&&(i.comment=kP(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=OP(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=kP(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=kP(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=OP(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??null}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceUnclosedFence:t.data?.sourceUnclosedFence??!1,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`,sourceRaw:e.data?.sourceRaw??null})),n.list&&(i.list=OP(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=OP(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.data?.resolvedUrl??``,title:n.data?.resolvedTitle??null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=x5.getOrWildcard(o),c=S5(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=s5(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}let i=t.name??``,o=i?x5.get(i):void 0;if(o&&n.jsxInline){let e=S5(t.attributes,o.props),a=r(t.data)??``,s=(t.children??[]).map(e=>e&&typeof e==`object`&&`value`in e?String(e.value??``):``).join(``);return s&&(e.children=s),n.jsxInline.createAndFill({componentName:i,attributes:t.attributes,sourceRaw:a,sourceDirty:!1,props:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=pQ(o),{resolveEmbed:u,sourcePath:d}=t.current,f=u&&d?u(o,d)??null:null,p=f?`/${f}`:o,m=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(m&&nae.has(l)&&n.jsxComponent&&x5.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,alt:s??o,target:o,anchor:c,alias:s}});if(m&&Zu.has(l)&&n.jsxComponent&&x5.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&$u.has(l)&&n.jsxComponent&&x5.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&ed.has(l)&&n.jsxComponent&&x5.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:b5(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=OP(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function iae(e,t){let n={},r={},i=e.nodes,a=e.marks;i.paragraph&&(n.paragraph=PP(`paragraph`)),i.blockquote&&(n.blockquote=PP(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),i.heading&&(n.heading=PP(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??void 0}}))),i.codeBlock&&(n.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceUnclosedFence:e.attrs.sourceUnclosedFence===!0?!0:void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),i.thematicBreak&&(n.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),i.hardBreak&&(n.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle,...typeof e.attrs.sourceRaw==`string`&&e.attrs.sourceRaw.length>0?{sourceRaw:e.attrs.sourceRaw}:{}}})),i.list&&(n.list=PP(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),i.listItem&&(n.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&tae(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},children:i}}),i.table&&(n.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c={};Array.isArray(s)&&s.length>0&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),i.tableRow&&(n.tableRow=PP(`tableRow`));let o=(e,t)=>{let n={type:`tableCell`,children:y0(t)},r=e.attrs.sourcePadding;return typeof r==`object`&&r&&typeof r.left==`number`&&typeof r.right==`number`&&(n.data={sourcePadding:r}),n};if(i.tableCell&&(n.tableCell=(e,t,n)=>o(e,n.all(e))),i.tableHeader&&(n.tableHeader=(e,t,n)=>o(e,n.all(e))),i.image&&(n.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),i.imageReference&&(n.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),i.htmlBlock&&(n.htmlBlock=e=>({type:`html`,value:e.attrs.content})),i.linkDefinition??i.linkRefDef){let e=i.linkDefinition?`linkDefinition`:`linkRefDef`;n[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(i.jsxComponent&&(n.jsxComponent=(e,n,r)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let i=e.attrs.componentName||null,a=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!eae(e,t.checker)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:i,attributes:a,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:x5.getOrWildcard(i??`*`).serialize(e,{all:e=>r.all(e),registry:x5,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),i.rawMdxFallback&&(n.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),i.jsxInline&&(n.jsxInline=e=>{let t=e.attrs.componentName||``;if(t&&e.attrs.sourceDirty)return c2(t,e,x5.get(t)?.props);let n=e.attrs.attributes,r=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:t||null,attributes:Array.isArray(n)?n:[],children:[],data:{sourceRaw:String(r)}}}),i.mathInline&&(n.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),i.wikiLink&&(n.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},children:[{type:`text`,value:i}]}}),i.tag&&(n.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),i.wikiLinkEmbed&&(n.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),a.emphasis&&(r.emphasis=FP(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.strong&&(r.strong=FP(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),a.code&&(r.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return w5(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0?!0:void 0})}),a.strike??a.delete){let e=a.strike?`strike`:`delete`;r[e]=FP(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return a.highlight&&(r.highlight=FP(`mark`)),a.underline&&(r.underline=FP(`underline`,e=>({data:{sourceForm:e.attrs.sourceForm===`ins`?`ins`:`u`}}))),a.comment&&(r.comment=FP(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),i.commentBlock&&(n.commentBlock=PP(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),i.footnoteReference&&(n.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),i.footnoteDefinition&&(n.footnoteDefinition=PP(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),a.link&&(r.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=i||(r?`${t}#${r}`:t),o=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return o!==a&&o.trim().length>0&&!o.includes(`]]`)&&(i=o,a=o),{type:`wikiLinkEmbed`,value:a,data:{target:t,anchor:r,alias:i},children:[{type:`text`,value:a}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),a.escapeMark&&(r.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data??={},t.data.escapedChars??=[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),a.sourceLiteral&&(r.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return ZZ(t,e.value)&&(e.data??={},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:n,markHandlers:r}}var E5={default:!0,MD013:!1};function D5(e){return e??E5}function O5(e){let t=e.replace(/\\/g,`/`);for(;t.startsWith(`./`);)t=t.slice(2);let n=t.toLowerCase();for(let e of jX)if(n.endsWith(e))return t.slice(0,-e.length);return t}function k5(e){let t=(e===void 0?[]:Array.isArray(e)?e:[e]).map(e=>e.trim()).filter(e=>e.length>0),n=[],r=[],i=[],a=[],o=0;for(let e of t){let t=e.startsWith(`!`),s=t?e.slice(1):e;if(t||(o+=1),s.length===0){n.push({pattern:e,detail:`empty pattern`});continue}try{let e=(0,CV.default)(s,{dot:!0,strictBrackets:!0});(t?a:i).push(e)}catch(t){n.push({pattern:e,detail:t instanceof Error?t.message:String(t)});continue}if(s.endsWith(`/`))r.push({pattern:e,reason:`trailing-slash`});else if(s.startsWith(`/`))r.push({pattern:e,reason:`leading-slash`});else{let t=s.toLowerCase();jX.some(e=>t.endsWith(e))&&r.push({pattern:e,reason:`doc-extension`})}}let s=o===0;return{invalidPatterns:n,suspiciousPatterns:r,matches(e){if(e===void 0||e===``)return!1;let t=O5(e);return t===``||!(s||i.some(e=>e(t)))?!1:!a.some(e=>e(t))}}}function aae(e,t){if(t.length===0)return[];let n=(e===void 0?[]:Array.isArray(e)?e:[e]).map(e=>e.trim()).filter(e=>e.length>0),r=t.map(O5).filter(e=>e!==``),i=[];for(let e of n){let t=e.startsWith(`!`)?e.slice(1):e;if(t.length===0)continue;let n;try{n=(0,CV.default)(t,{dot:!0,strictBrackets:!0})}catch{continue}r.some(e=>n(e))||i.push(e)}return i}var A5=/[*?[\]{}()+@!|]/;function oae(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);if(n===-1||e.indexOf(`{`,t+1)!==-1||e.indexOf(`}`,n+1)!==-1)return null;let r=e.slice(t+1,n).split(`,`);return r.length<2||r.some(e=>e.trim()===``||A5.test(e))?null:r.map(r=>e.slice(0,t)+r+e.slice(n+1))}function j5(e){if(e.endsWith(`/`)||e.startsWith(`/`))return{kind:`matches-nothing`,pattern:e};try{(0,CV.default)(e,{dot:!0,strictBrackets:!0})}catch{return{kind:`invalid`,pattern:e}}if(e===`**`||e===`**/*`)return{kind:`everything`};{let t=e.match(/^\*\*\/(.+)\/\*\*$/)?.[1];if(t!==void 0&&!A5.test(t))return{kind:`folder-anywhere`,folder:t};let n=e.match(/^(.+)\/\*\*\/(.+)\/\*\*$/),r=n?.[1],i=n?.[2];if(r!==void 0&&i!==void 0&&!A5.test(r)&&!A5.test(i))return{kind:`folder-recursive-nested`,root:r,folder:i}}for(let t of[`/**/*`,`/**`])if(e.endsWith(t)){let n=e.slice(0,-t.length);if(n.length>0&&!A5.test(n))return{kind:`folder-recursive`,folder:n}}if(e.endsWith(`/*`)){let t=e.slice(0,-2);if(t.length>0&&!A5.test(t))return{kind:`folder-direct`,folder:t}}if(e.startsWith(`**/`)){let t=e.slice(3);if(t.length>0&&!t.includes(`/`)&&!A5.test(t))return{kind:`name-anywhere`,name:t}}return A5.test(e)?{kind:`pattern`,pattern:e}:{kind:`exact`,target:e}}function sae(e){let t=j5(e);if(t.kind!==`pattern`)return[t];let n=oae(e);if(n!==null){let e=n.map(j5);if(e.every(e=>e.kind!==`pattern`))return e}return[t]}function cae(e){let t=(e===void 0?[]:Array.isArray(e)?e:[e]).map(e=>e.trim()).filter(e=>e.length>0),n=[],r=[];for(let e of t){let t=e.startsWith(`!`),i=t?e.slice(1):e;i.length!==0&&(t?r:n).push(...sae(i))}return{includes:n,excludes:r}}function M5(e,t){let n=new Set,r=[];for(let i of e){if(i.enabled===!1||!i.schema||!k5(i.appliesTo).matches(t))continue;let e=i.key??i.file;n.has(e)||(n.add(e),r.push({file:i.file,schema:i.schema}))}return r}var N5={"draft-06":`http://json-schema.org/draft-06/schema#`,"draft-07":`http://json-schema.org/draft-07/schema#`,"2019-09":`https://json-schema.org/draft/2019-09/schema`,"2020-12":`https://json-schema.org/draft/2020-12/schema`},lae=Object.keys(N5),uae=`draft-07`,dae=new Map(lae.map(e=>[P5(N5[e]),e]));function P5(e){return e.replace(/^https?:\/\//,``).replace(/#$/,``)}function fae(e){let t=e.$schema;return t===void 0?uae:typeof t==`string`?dae.get(P5(t))??null:null}var F5=new Map;function pae(e){throw Error(`Unhandled FrontmatterSchemaDialect: ${JSON.stringify(e)}`)}function mae(e){let t=F5.get(e);if(t)return t;let n={allErrors:!0,strict:!1},r;switch(e){case`2020-12`:r=new xV.default(n);break;case`2019-09`:r=new bV.default(n);break;case`draft-06`:case`draft-07`:r=new yV.default(n);break;default:return pae(e)}return(0,SV.default)(r),F5.set(e,r),r}function hae(e){let{$schema:t,...n}=e;return n}function gae(e,t){let n=mae(e),r=t.$id;return typeof r==`string`&&r!==``&&n.removeSchema(r),n.compile(hae(t))}var I5=new Map,_ae=256;function vae(e){let t=JSON.stringify(e),n=I5.get(t);if(n!==void 0)return n;let r=null,i=fae(e);if(i!==null)try{r=gae(i,e)}catch{r=null}return I5.size>=_ae&&I5.clear(),I5.set(t,r),r}function yae(e){let t=new Map;if(!im.test(e))return{data:{},keyLines:t};let{frontmatter:n}=om(e),r=cm(n);if(r.trim()===``)return{data:{},keyLines:t};let i=Su(r,{uniqueKeys:!1});if(i.errors.length>0)return{data:{},keyLines:t};let a=i.toJS();if(typeof a!=`object`||!a||Array.isArray(a))return{data:{},keyLines:t};if(ts(i.contents))for(let e of i.contents.items){let n=e.key;if(!rs(n)||typeof n.value!=`string`||!n.range)continue;let i=0,a=Math.min(n.range[0],r.length);for(let e=0;e<a;e++)r.charCodeAt(e)===10&&i++;t.has(n.value)||t.set(n.value,i+1)}return{data:a,keyLines:t}}function bae(e){if(e===void 0)return``;let t;if(typeof e==`string`)t=`"${e}"`;else try{t=JSON.stringify(e)??String(e)}catch{t=String(e)}return t.length>60&&(t=`${t.slice(0,57)}…`),` (got ${t})`}function xae(e){if(!e.startsWith(`/`))return null;let t=e.slice(1).split(`/`)[0]??``;return t===``?null:t.replace(/~1/g,`/`).replace(/~0/g,`~`)}function Sae(e){return e.split(`/`).slice(1).map(e=>e.replace(/~1/g,`/`).replace(/~0/g,`~`)).join(`.`)}function Cae(e,t){if(t.length===0)return[];let{data:n,keyLines:r}=yae(e),i=e.split(`
|
|
569
569
|
`),a=e=>({start:{line:e,character:0},end:{line:e,character:i[e]?.length??0}}),o=[];for(let{schema:e}of t){let t=vae(e);if(t&&!t(n))for(let e of t.errors??[]){let t=e.keyword,i=0,s,c=`invalid`,l;if(t===`required`&&e.instancePath===``){let t=String(e.params.missingProperty??``);s=`Frontmatter property "${t}" is required`,c=`missing`,t!==``&&(l=t)}else if(e.instancePath===``)s=`Frontmatter ${e.message??`violates "${t}"`}`;else{let a=xae(e.instancePath);a!==null&&(i=r.get(a)??0);let o=Sae(e.instancePath);if(t===`enum`){let t=e.params.allowedValues??[],r=a!==null&&o===a?n[a]:void 0;s=`Frontmatter property "${o}" must be one of: ${t.map(String).join(`, `)}${bae(r)}`}else s=`Frontmatter property "${o}" ${e.message??`violates "${t}"`}`}o.push({range:a(i),severity:`warning`,source:`frontmatter`,code:t,message:s,frontmatterScope:c,...l===void 0?{}:{frontmatterProperty:l}})}}return o}var L5=`doc`;function wae(e,t){return gG(e,pG({strings:{[L5]:e},config:t})[L5]??[])}function Tae(e,t){let n=pG({strings:{[L5]:e},config:t})[L5]??[],r=e.split(`
|
|
570
|
-
`),i=Eae(t);return n.map(e=>Oae(e,r,Dae(e,i)))}function Eae(e){let t=new Map;return Object.entries(e).forEach(([e,n],r)=>{let i=e.toUpperCase();if(i===`DEFAULT`)return;let a=null;if(n===`error`||n===`warning`)a=n;else if(typeof n==`object`&&n&&!Array.isArray(n)){let e=n.severity;(e===`error`||e===`warning`)&&(a=e)}a!==null&&t.set(i,{entryIndex:r,severity:a})}),t}function Dae(e,t){let n;for(let r of e.ruleNames){let e=t.get(r.toUpperCase());e!==void 0&&(n===void 0||e.entryIndex>n.entryIndex)&&(n=e)}return n?.severity??`warning`}function Oae(e,t,n){let[r,i]=e.errorRange??[1,null],a=e.lineNumber-1,o=(r??1)-1,s=t[a]?.length??0,c=i==null?s:Math.min(o+i,s),l=e.fixInfo?[kae(e.fixInfo,e.lineNumber,t)]:void 0;return{range:{start:{line:a,character:o},end:{line:a,character:Math.max(c,o)}},severity:n,source:`markdownlint`,code:e.ruleNames[0]??`MD000`,message:e.errorDetail?`${e.ruleDescription}: ${e.errorDetail}`:e.ruleDescription,...l?{fixes:l}:{}}}function kae(e,t,n){let r=e.lineNumber??t,i=r-1;if(e.deleteCount===-1){if(r<n.length)return{range:{start:{line:i,character:0},end:{line:i+1,character:0}},newText:``};if(i>0){let e=n[i-1]?.length??0;return{range:{start:{line:i-1,character:e},end:{line:i,character:n[i]?.length??0}},newText:``}}return{range:{start:{line:0,character:0},end:{line:0,character:n[0]?.length??0}},newText:``}}let a=(e.editColumn??1)-1;return{range:{start:{line:i,character:a},end:{line:i,character:a+Math.max(0,e.deleteCount??0)}},newText:e.insertText??``}}var Aae=so([F(),z(Ed),mo(N(),to())]),jae={id:`markdownlint`,sliceSchema:L({enabled:F(),rules:mo(N(),Aae)}),defaultSlice:{enabled:!1,rules:E5},async lint(e,t){return Tae(e,D5(t.rules))},fix(e,t){return wae(e,D5(t.rules))}},Mae=L({appliesTo:so([N(),I(N())]).optional(),file:N(),enabled:F().optional(),key:N().optional(),schema:mo(N(),to()).optional()}),R5=[jae,{id:`frontmatter`,sliceSchema:L({enabled:F(),schemas:I(Mae)}),defaultSlice:{enabled:!1,schemas:[]},async lint(e,t,n){return Cae(e,M5(t.schemas,n.docName))}}],Nae={enabled:!0,plugins:Object.fromEntries(R5.map(e=>[e.id,e.defaultSlice]))},Pae=new Set([`.markdownlint.json`,`.markdownlint.jsonc`]);function Fae(e){return Pae.has(e)}L({docName:z$,summary:H$,content:N().optional(),...V$}).loose(),L({docName:z$,summary:H$,markdown:N(),position:z([`append`,`prepend`,`replace`]).optional(),extension:z(jX).optional(),...V$}).loose(),L({docName:z$,summary:H$,find:N().min(1),replace:N(),offset:P().int().nonnegative().optional(),...V$}).loose(),L({docName:z$,connectionId:N().min(1),scope:z([`last`,`session`,`file`,`count`]).optional(),count:P().int().positive().optional(),...V$}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]});var z5=L({value:N(),truncatedFrom:P().int().nonnegative().optional(),hint:N().optional()}).loose(),Iae=lo(`kind`,[L({kind:B(`inline`),content:N()}),L({kind:B(`truncated`),byteLength:P().int().nonnegative(),hint:N()})]),B5=L({kind:B(`content-divergence`),intendedBytes:P().int().nonnegative(),actualBytes:P().int().nonnegative(),byteDelta:P().int(),divergenceType:N().optional(),currentState:Iae.optional(),hint:N().optional()}).loose(),Lae=L({type:B(`orphan`),parentCandidates:I(N()),message:N()}).loose(),V5=L({kind:B(`disk-edit-reconciled`),intendedBytes:P().int().nonnegative(),actualBytes:P().int().nonnegative(),byteDelta:P().int(),mergeOutcome:N().optional(),hint:N().optional()}).loose(),H5=lo(`kind`,[B5,V5]),Rae=L({kind:B(`mermaid-parse-error`),fenceIndex:P().int().positive(),fenceFirstLine:N(),message:N(),line:P().int().positive().optional()}).loose(),U5=L({href:N(),targetKind:N(),role:N(),sourceForm:N(),resolvedTarget:N().nullable(),reason:N(),resolutionMethod:N(),fallbackTarget:N().nullable().optional(),definition:L({line:P().int().nonnegative(),label:N()}).loose().optional()}).loose(),W5=I(lo(`kind`,[B5,V5,Rae,L({kind:B(`lint-violation`),source:N(),code:N(),message:N(),severity:z([`error`,`warning`,`info`,`hint`]),line:P().int().positive(),column:P().int().positive(),linkTarget:N().optional(),localTarget:U5.optional()}).loose()])).min(1),G5=I(L({href:N(),resolvedTo:N().nullable(),reason:z([`no-such-doc`,`no-such-file`,`unresolvable`]),localTarget:U5.optional()}).loose());L({timestamp:N().min(1),summary:z5.optional(),warning:H5.optional(),warnings:W5.optional()}).loose(),L({timestamp:N().min(1),subscriberCount:P().int().nonnegative(),systemSubscriberCount:P().int().nonnegative(),hints:I(Lae).optional(),summary:z5.optional(),warning:H5.optional(),warnings:W5.optional(),brokenLinks:G5}).loose(),L({timestamp:N().min(1),subscriberCount:P().int().nonnegative(),systemSubscriberCount:P().int().nonnegative(),summary:z5.optional(),warning:H5.optional(),warnings:W5.optional(),brokenLinks:G5}).loose(),L({docName:N().min(1),scope:z([`last`,`session`,`count`]),undone:F()}).loose(),L({docs:I(L({docName:B$,markdown:N(),position:z([`append`,`prepend`,`replace`]).optional(),extension:z(jX).optional(),summary:H$}).loose()).min(1).max(100),...V$}).loose();var zae=L({type:c1,title:N(),detail:N().optional()}).loose(),Bae=lo(`status`,[L({status:B(`written`),docName:N().min(1),summary:z5.optional(),warnings:W5.optional(),brokenLinks:G5}).loose(),L({status:B(`error`),docName:N().min(1),error:zae}).loose()]);L({timestamp:N().min(1),results:I(Bae),written:P().int().nonnegative(),failed:P().int().nonnegative()}).loose(),L({docName:z$,patch:mo(N(),so([fm,$a()])),types:mo(N(),z(lm)).optional(),summary:H$,...V$}).loose(),L({timestamp:N().min(1),subscriberCount:P().int().nonnegative(),systemSubscriberCount:P().int().nonnegative(),appliedKeys:I(N()),summary:z5.optional(),warning:H5.optional(),warnings:W5.optional(),brokenLinks:G5}).loose();function Vae(e){return{enabled:e.enabled??!0,plugins:{markdownlint:{...e.markdownlint,rules:e.markdownlint.rules??E5},frontmatter:{enabled:e.frontmatter?.enabled??!1,schemas:e.frontmatter?.schemas??[]}}}}var Hae=Object.fromEntries(R5.map(e=>[e.id,e.sliceSchema])),Uae=L({effective:L({enabled:F(),plugins:L(Hae)}),configFile:N().nullable().optional(),configProblems:I(N()).optional()}),Wae=so([F(),mo(N(),to())]);L({ruleId:N().min(1).max(64).regex(/^[A-Za-z][A-Za-z0-9_-]*$/),value:so([Wae,$a()])}),L({file:N().min(1).max(512),delete:B(!0).optional(),field:N().min(1).max(256).optional(),parentPath:I(so([N().min(1).max(256),L({items:B(!0)}).strict()])).max(8).optional(),removeField:B(!0).optional(),renameTo:N().min(1).max(256).optional(),constraint:L({type:z([`string`,`number`,`boolean`,`array`,`object`]).nullable().optional(),enum:I(so([N(),P(),F()])).nullable().optional(),itemsEnum:I(so([N(),P(),F()])).nullable().optional(),itemsType:z([`string`,`number`,`boolean`,`object`]).nullable().optional(),pattern:N().nullable().optional(),format:N().nullable().optional(),description:N().max(2048).nullable().optional(),required:F().optional()}).optional()}).refine(e=>e.delete===void 0||e.field===void 0&&e.constraint===void 0&&e.removeField===void 0&&e.renameTo===void 0,{message:`delete cannot be combined with a field edit`}).refine(e=>[e.constraint,e.removeField,e.renameTo].filter(e=>e!==void 0).length<=1,{message:`constraint, removeField, and renameTo are mutually exclusive`}).refine(e=>e.removeField===void 0&&e.renameTo===void 0||e.field!==void 0,{message:`removeField and renameTo require field`}).refine(e=>e.parentPath===void 0||e.field!==void 0,{message:`parentPath requires field`}).refine(e=>e.field===void 0?e.constraint===void 0:e.constraint!==void 0||e.removeField!==void 0||e.renameTo!==void 0,{message:`field requires constraint, removeField, or renameTo`});var Gae=L({schemas:I(N()),truncated:F()}).strict(),K5=L({line:P(),character:P()}),q5=L({start:K5,end:K5}),J5=L({range:q5,severity:z([`error`,`warning`,`info`,`hint`]),source:N(),code:N(),message:N(),fixes:I(L({range:q5,newText:N()})).optional(),frontmatterScope:z([`missing`,`invalid`]).optional(),frontmatterProperty:N().optional()});L({files:I(L({file:N(),diagnostics:I(J5),warnings:I(N()).optional()})),fileCount:P(),errorCount:P(),warningCount:P(),warnings:I(N())});var Kae=J5.extend({linkTarget:N().optional(),localTarget:U5.optional()}),qae=L({files:I(L({file:N(),diagnostics:I(Kae)})),fileCount:P(),errorCount:P(),warningCount:P(),warnings:I(N())}),Y5=L({errorCount:P().int().nonnegative(),warningCount:P().int().nonnegative()}),Jae=L({files:I(L({file:N(),lint:Y5,links:Y5})),fileCount:P().int().nonnegative(),errorCount:P().int().nonnegative(),warningCount:P().int().nonnegative(),warnings:I(N())});L({docName:z$,summary:H$,...V$}).loose();var Yae=L({file:N(),fixedCount:P(),diagnostics:I(J5),errorCount:P(),warningCount:P(),warning:N().optional()});function Xae(e){let t=e.trim().replace(/^\.\//,``);if(!t.startsWith(`.ok/schemas/`))return!1;let n=t.slice(12);return n.length>0&&!n.includes(`/`)&&!n.includes(`\\`)&&n!==`.`&&n!==`..`}function Zae(e){let t=e.trim().toLowerCase().split(`/`).pop()??``;return t.endsWith(`.schema.json`)&&t.length>12?!0:Xae(e)&&t.endsWith(`.json`)}var X5=[{id:`MD001`,alias:`heading-increment`,aliases:[`heading-increment`],name:`Heading levels should only increment by one level at a time`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md001.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`}]},{id:`MD003`,alias:`heading-style`,aliases:[`heading-style`],name:`Heading style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md003.md`,tags:[`headings`],options:[{key:`style`,type:`enum`,description:`Heading style`,enum:[`consistent`,`atx`,`atx_closed`,`setext`,`setext_with_atx`,`setext_with_atx_closed`],default:`consistent`}]},{id:`MD004`,alias:`ul-style`,aliases:[`ul-style`],name:`Unordered list style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md004.md`,tags:[`bullet`,`ul`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`consistent`,`asterisk`,`plus`,`dash`,`sublist`],default:`consistent`}]},{id:`MD005`,alias:`list-indent`,aliases:[`list-indent`],name:`Inconsistent indentation for list items at the same level`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md005.md`,tags:[`bullet`,`ul`,`indentation`],options:[]},{id:`MD007`,alias:`ul-indent`,aliases:[`ul-indent`],name:`Unordered list indentation`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md007.md`,tags:[`bullet`,`ul`,`indentation`],options:[{key:`indent`,type:`integer`,description:`Spaces for indent`,default:2,minimum:1},{key:`start_indented`,type:`boolean`,description:`Whether to indent the first level of the list`,default:!1},{key:`start_indent`,type:`integer`,description:`Spaces for first level indent (when start_indented is set)`,default:2,minimum:1}]},{id:`MD009`,alias:`no-trailing-spaces`,aliases:[`no-trailing-spaces`],name:`Trailing spaces`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md009.md`,tags:[`whitespace`],options:[{key:`br_spaces`,type:`integer`,description:`Spaces for line break`,default:2,minimum:0},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!1},{key:`list_item_empty_lines`,type:`boolean`,description:`Allow spaces for empty lines in list items`,default:!1},{key:`strict`,type:`boolean`,description:`Include unnecessary breaks`,default:!1}]},{id:`MD010`,alias:`no-hard-tabs`,aliases:[`no-hard-tabs`],name:`Hard tabs`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md010.md`,tags:[`whitespace`,`hard_tab`],options:[{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`ignore_code_languages`,type:`string-array`,description:`Fenced code languages to ignore`,default:[]},{key:`spaces_per_tab`,type:`integer`,description:`Number of spaces for each hard tab`,default:1,minimum:0}]},{id:`MD011`,alias:`no-reversed-links`,aliases:[`no-reversed-links`],name:`Reversed link syntax`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md011.md`,tags:[`links`],options:[]},{id:`MD012`,alias:`no-multiple-blanks`,aliases:[`no-multiple-blanks`],name:`Multiple consecutive blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md012.md`,tags:[`whitespace`,`blank_lines`],options:[{key:`maximum`,type:`integer`,description:`Consecutive blank lines`,default:1,minimum:1}]},{id:`MD013`,alias:`line-length`,aliases:[`line-length`],name:`Line length`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md013.md`,tags:[`line_length`],options:[{key:`line_length`,type:`integer`,description:`Number of characters`,default:80,minimum:1},{key:`heading_line_length`,type:`integer`,description:`Number of characters for headings`,default:80,minimum:1},{key:`code_block_line_length`,type:`integer`,description:`Number of characters for code blocks`,default:80,minimum:1},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`tables`,type:`boolean`,description:`Include tables`,default:!0},{key:`headings`,type:`boolean`,description:`Include headings`,default:!0},{key:`strict`,type:`boolean`,description:`Strict length checking`,default:!1},{key:`stern`,type:`boolean`,description:`Stern length checking`,default:!1}]},{id:`MD014`,alias:`commands-show-output`,aliases:[`commands-show-output`],name:`Dollar signs used before commands without showing output`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md014.md`,tags:[`code`],options:[]},{id:`MD018`,alias:`no-missing-space-atx`,aliases:[`no-missing-space-atx`],name:`No space after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md018.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD019`,alias:`no-multiple-space-atx`,aliases:[`no-multiple-space-atx`],name:`Multiple spaces after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md019.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD020`,alias:`no-missing-space-closed-atx`,aliases:[`no-missing-space-closed-atx`],name:`No space inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md020.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD021`,alias:`no-multiple-space-closed-atx`,aliases:[`no-multiple-space-closed-atx`],name:`Multiple spaces inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md021.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD022`,alias:`blanks-around-headings`,aliases:[`blanks-around-headings`],name:`Headings should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md022.md`,tags:[`headings`,`blank_lines`],options:[{key:`include_front_matter`,type:`boolean`,description:`Include front matter content`,default:!1},{key:`lines_above`,type:`unsupported`,description:`Blank lines above heading`,default:1},{key:`lines_below`,type:`unsupported`,description:`Blank lines below heading`,default:1}]},{id:`MD023`,alias:`heading-start-left`,aliases:[`heading-start-left`],name:`Headings must start at the beginning of the line`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md023.md`,tags:[`headings`,`spaces`],options:[]},{id:`MD024`,alias:`no-duplicate-heading`,aliases:[`no-duplicate-heading`],name:`Multiple headings with the same content`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md024.md`,tags:[`headings`],options:[{key:`siblings_only`,type:`boolean`,description:`Only check sibling headings`,default:!1}]},{id:`MD025`,alias:`single-title`,aliases:[`single-title`,`single-h1`],name:`Multiple top-level headings in the same document`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md025.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD026`,alias:`no-trailing-punctuation`,aliases:[`no-trailing-punctuation`],name:`Trailing punctuation in heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md026.md`,tags:[`headings`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!。,;:!`}]},{id:`MD027`,alias:`no-multiple-space-blockquote`,aliases:[`no-multiple-space-blockquote`],name:`Multiple spaces after blockquote symbol`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md027.md`,tags:[`indentation`,`whitespace`,`blockquote`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD028`,alias:`no-blanks-blockquote`,aliases:[`no-blanks-blockquote`],name:`Blank line inside blockquote`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md028.md`,tags:[`whitespace`,`blockquote`],options:[]},{id:`MD029`,alias:`ol-prefix`,aliases:[`ol-prefix`],name:`Ordered list item prefix`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md029.md`,tags:[`ol`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`one`,`ordered`,`one_or_ordered`,`zero`],default:`one_or_ordered`}]},{id:`MD030`,alias:`list-marker-space`,aliases:[`list-marker-space`],name:`Spaces after list markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md030.md`,tags:[`ul`,`whitespace`,`ol`],options:[{key:`ul_single`,type:`integer`,description:`Spaces for single-line unordered list items`,default:1,minimum:1},{key:`ol_single`,type:`integer`,description:`Spaces for single-line ordered list items`,default:1,minimum:1},{key:`ul_multi`,type:`integer`,description:`Spaces for multi-line unordered list items`,default:1,minimum:1},{key:`ol_multi`,type:`integer`,description:`Spaces for multi-line ordered list items`,default:1,minimum:1}]},{id:`MD031`,alias:`blanks-around-fences`,aliases:[`blanks-around-fences`],name:`Fenced code blocks should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md031.md`,tags:[`blank_lines`,`code`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD032`,alias:`blanks-around-lists`,aliases:[`blanks-around-lists`],name:`Lists should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md032.md`,tags:[`bullet`,`ul`,`blank_lines`,`ol`],options:[]},{id:`MD033`,alias:`no-inline-html`,aliases:[`no-inline-html`],name:`Inline HTML`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md033.md`,tags:[`html`],options:[{key:`allowed_elements`,type:`string-array`,description:`Allowed elements`,default:[]},{key:`table_allowed_elements`,type:`string-array`,description:`Allowed elements in tables`,default:[]}]},{id:`MD034`,alias:`no-bare-urls`,aliases:[`no-bare-urls`],name:`Bare URL used`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md034.md`,tags:[`links`,`url`],options:[]},{id:`MD035`,alias:`hr-style`,aliases:[`hr-style`],name:`Horizontal rule style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md035.md`,tags:[`hr`],options:[{key:`style`,type:`string`,description:`Horizontal rule style`,default:`consistent`}]},{id:`MD036`,alias:`no-emphasis-as-heading`,aliases:[`no-emphasis-as-heading`],name:`Emphasis used instead of a heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md036.md`,tags:[`headings`,`emphasis`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!?。,;:!?`}]},{id:`MD037`,alias:`no-space-in-emphasis`,aliases:[`no-space-in-emphasis`],name:`Spaces inside emphasis markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md037.md`,tags:[`whitespace`,`emphasis`],options:[]},{id:`MD038`,alias:`no-space-in-code`,aliases:[`no-space-in-code`],name:`Spaces inside code span elements`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md038.md`,tags:[`whitespace`,`code`],options:[]},{id:`MD039`,alias:`no-space-in-links`,aliases:[`no-space-in-links`],name:`Spaces inside link text`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md039.md`,tags:[`whitespace`,`links`],options:[]},{id:`MD040`,alias:`fenced-code-language`,aliases:[`fenced-code-language`],name:`Fenced code blocks should have a language specified`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md040.md`,tags:[`code`,`language`],options:[{key:`allowed_languages`,type:`string-array`,description:`List of languages`,default:[]},{key:`language_only`,type:`boolean`,description:`Require language only`,default:!1}]},{id:`MD041`,alias:`first-line-heading`,aliases:[`first-line-heading`,`first-line-h1`],name:`First line in a file should be a top-level heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md041.md`,tags:[`headings`],options:[{key:`allow_preamble`,type:`boolean`,description:`Allow content before first heading`,default:!1},{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD042`,alias:`no-empty-links`,aliases:[`no-empty-links`],name:`No empty links`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md042.md`,tags:[`links`],options:[]},{id:`MD043`,alias:`required-headings`,aliases:[`required-headings`],name:`Required heading structure`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md043.md`,tags:[`headings`],options:[{key:`headings`,type:`string-array`,description:`List of headings`,default:[]},{key:`match_case`,type:`boolean`,description:`Match case of headings`,default:!1}]},{id:`MD044`,alias:`proper-names`,aliases:[`proper-names`],name:`Proper names should have the correct capitalization`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md044.md`,tags:[`spelling`],options:[{key:`names`,type:`string-array`,description:`List of proper names`,default:[]},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`html_elements`,type:`boolean`,description:`Include HTML elements`,default:!0}]},{id:`MD045`,alias:`no-alt-text`,aliases:[`no-alt-text`],name:`Images should have alternate text (alt text)`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md045.md`,tags:[`accessibility`,`images`],options:[]},{id:`MD046`,alias:`code-block-style`,aliases:[`code-block-style`],name:`Code block style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md046.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Block style`,enum:[`consistent`,`fenced`,`indented`],default:`consistent`}]},{id:`MD047`,alias:`single-trailing-newline`,aliases:[`single-trailing-newline`],name:`Files should end with a single newline character`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md047.md`,tags:[`blank_lines`],options:[]},{id:`MD048`,alias:`code-fence-style`,aliases:[`code-fence-style`],name:`Code fence style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md048.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Code fence style`,enum:[`consistent`,`backtick`,`tilde`],default:`consistent`}]},{id:`MD049`,alias:`emphasis-style`,aliases:[`emphasis-style`],name:`Emphasis style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md049.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Emphasis style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD050`,alias:`strong-style`,aliases:[`strong-style`],name:`Strong style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md050.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Strong style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD051`,alias:`link-fragments`,aliases:[`link-fragments`],name:`Link fragments should be valid`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md051.md`,tags:[`links`],options:[{key:`ignore_case`,type:`boolean`,description:`Ignore case of fragments`,default:!1},{key:`ignored_pattern`,type:`string`,description:`Pattern for ignoring additional fragments`,default:``}]},{id:`MD052`,alias:`reference-links-images`,aliases:[`reference-links-images`],name:`Reference links and images should use a label that is defined`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md052.md`,tags:[`links`,`images`],options:[{key:`ignored_labels`,type:`string-array`,description:`Ignored link labels`,default:[`x`]},{key:`shortcut_syntax`,type:`boolean`,description:`Include shortcut syntax`,default:!1}]},{id:`MD053`,alias:`link-image-reference-definitions`,aliases:[`link-image-reference-definitions`],name:`Link and image reference definitions should be needed`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md053.md`,tags:[`links`,`images`],options:[{key:`ignored_definitions`,type:`string-array`,description:`Ignored definitions`,default:[`//`]}]},{id:`MD054`,alias:`link-image-style`,aliases:[`link-image-style`],name:`Link and image style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md054.md`,tags:[`links`,`images`],options:[{key:`autolink`,type:`boolean`,description:`Allow autolinks`,default:!0},{key:`inline`,type:`boolean`,description:`Allow inline links and images`,default:!0},{key:`full`,type:`boolean`,description:`Allow full reference links and images`,default:!0},{key:`collapsed`,type:`boolean`,description:`Allow collapsed reference links and images`,default:!0},{key:`shortcut`,type:`boolean`,description:`Allow shortcut reference links and images`,default:!0},{key:`url_inline`,type:`boolean`,description:`Allow URLs as inline links`,default:!0}]},{id:`MD055`,alias:`table-pipe-style`,aliases:[`table-pipe-style`],name:`Table pipe style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table pipe style`,enum:[`consistent`,`leading_only`,`trailing_only`,`leading_and_trailing`,`no_leading_or_trailing`],default:`consistent`}]},{id:`MD056`,alias:`table-column-count`,aliases:[`table-column-count`],name:`Table column count`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md056.md`,tags:[`table`],options:[]},{id:`MD058`,alias:`blanks-around-tables`,aliases:[`blanks-around-tables`],name:`Tables should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md058.md`,tags:[`table`],options:[]},{id:`MD059`,alias:`descriptive-link-text`,aliases:[`descriptive-link-text`],name:`Link text should be descriptive`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md059.md`,tags:[`links`,`accessibility`],options:[{key:`prohibited_texts`,type:`string-array`,description:`Prohibited link texts`,default:[`click here`,`here`,`link`,`more`]}]},{id:`MD060`,alias:`table-column-style`,aliases:[`table-column-style`],name:`Table column style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md060.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table column style`,enum:[`any`,`aligned`,`compact`,`tight`],default:`any`},{key:`aligned_delimiter`,type:`boolean`,description:`Aligned delimiter columns`,default:!1}]}],Qae=(()=>{let e=new Map;for(let t of X5){e.set(t.id.toUpperCase(),t.id);for(let n of t.aliases)e.set(n.toUpperCase(),t.id)}return e})();function Z5(e){return Qae.get(e.toUpperCase())??null}function $ae(e,t){let n=Z5(t);if(n===null)return;let r;for(let[t,i]of Object.entries(e))Z5(t)===n&&(r={key:t,value:i});return r}var eoe=[`Headings`,`Lists`,`Whitespace`,`Code`,`Links & images`,`Style`],toe=[[`headings`,`Headings`],[`bullet`,`Lists`],[`ul`,`Lists`],[`ol`,`Lists`],[`links`,`Links & images`],[`images`,`Links & images`],[`accessibility`,`Links & images`],[`code`,`Code`],[`language`,`Code`],[`emphasis`,`Style`],[`html`,`Style`],[`line_length`,`Whitespace`],[`whitespace`,`Whitespace`],[`hard_tab`,`Whitespace`],[`blank_lines`,`Whitespace`],[`indentation`,`Whitespace`]];function noe(e){for(let[t,n]of toe)if(e.tags.includes(t))return n;return`Style`}function roe(e){let t={lint:{errorCount:0,warningCount:0},links:{errorCount:0,warningCount:0}};for(let n of e){let e=n.source===`links`?t.links:t.lint;n.severity===`error`?e.errorCount+=1:e.warningCount+=1}return t}async function ioe(e,t,n){if(!t.enabled)return[];let r=[];for(let i of R5){let a=t.plugins[i.id];a.enabled&&r.push(...await i.lint(e,a,{docName:n}))}return r}var aoe=/\p{M}+/gu,ooe=/[^\p{L}\p{N}]+/gu,soe=/^-+|-+$/g;function Q5(e){return e.trim().normalize(`NFKD`).replace(aoe,``).toLowerCase().replace(ooe,`-`).replace(soe,``)}function coe(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function $5(e,t){let n=Q5(e);return n?coe(n,t):``}function e7(e,t){let n=Q5(e);return t?`#${n}-${Q5(t)}`:`#${n}`}var t7=new Set([`img`,`video`,`audio`,`mark`,`u`,`ins`]),loe=new Map(Y2.flatMap(e=>e.surface===`compat`&&t7.has(e.rendersAs)?[[e.name,e]]:[]));function n7(e){let t={};for(let n of e.attributes){if(n.type!==`mdxJsxAttribute`)return null;let e=n.name.toLowerCase();if(!(e.length>=3&&e.startsWith(`on`)))if(n.value===null)t[n.name]=!0;else if(typeof n.value==`string`)t[n.name]=n.value;else return null}return t}function r7(e){let t=e.name;if(!t||!t7.has(t))return null;let n=n7(e);return n===null?null:{type:`element`,tagName:t,properties:n,children:[]}}function i7(e){let t=e.name;if(!t)return null;let n=loe.get(t);if(!n)return null;let r=n7(e);if(r===null)return null;let i=n.translateProps(r),a={};for(let[e,t]of Object.entries(i))(typeof t==`string`||typeof t==`boolean`)&&(a[e]=t);return{type:`element`,tagName:n.rendersAs,properties:a,children:[]}}var uoe=(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-link`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:e7(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},doe=(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-embed`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:e7(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},foe=(e,t)=>{let n=t,r=r7(n);if(r)return n.children.length>0&&(r.children=e.all(n)),e.patch(t,r),e.applyData(t,r);let i=i7(n);if(i){e.patch(t,i);let n=e.applyData(t,i);return n.tagName===`img`?{type:`element`,tagName:`p`,properties:{},children:[n]}:n}let a={type:`element`,tagName:`pre`,properties:{className:[`mdx-component`]},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]}]};return e.patch(t,a),e.applyData(t,a)},poe=(e,t)=>{let n=t,r=r7(n);if(r)return n.children.length>0&&(r.children=e.all(n)),e.patch(t,r),e.applyData(t,r);let i=i7(n);if(i)return e.patch(t,i),e.applyData(t,i);let a={type:`element`,tagName:`span`,properties:{className:[`mdx-inline`],dataJsxInline:``},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]};return e.patch(t,a),e.applyData(t,a)},moe=(e,t)=>{let n=t,r=n.data.reason||`unknown`,i=n.value||``,a=r.replace(/--/g,`—`),o={type:`comment`,value:` Parse error: ${a} `},s={type:`element`,tagName:`pre`,properties:{className:[`mdx-fallback`],dataRawMdxFallback:``,dataReason:a},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:i}]}]};return e.patch(t,s),[o,e.applyData(t,s)]},hoe=(e,t)=>{let n={type:`element`,tagName:`mark`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},goe=(e,t)=>{let n=t,r={type:`element`,tagName:n.data?.sourceForm===`ins`?`ins`:`u`,properties:{},children:e.all(n)};return e.patch(t,r),e.applyData(t,r)};function a7(e){if(typeof e!=`object`||!e)return``;let t=e;return typeof t.value==`string`?t.value:Array.isArray(t.children)?t.children.map(a7).join(``):``}var o7={wikiLink:uoe,wikiLinkEmbed:doe,mdxJsxFlowElement:foe,mdxJsxTextElement:poe,rawMdxFallback:moe,mark:hoe,underline:goe,tag:(e,t)=>{let n=t.value,r={type:`element`,tagName:`a`,properties:{className:[`tag`],dataTag:n,href:`#tag/${n}`},children:[{type:`text`,value:`#${n}`}]};return e.patch(t,r),e.applyData(t,r)},comment:(e,t)=>{let n={type:`comment`,value:a7(t).replace(/--/g,`—`)};return e.patch(t,n),e.applyData(t,n)},commentBlock:(e,t)=>{let n={type:`comment`,value:a7(t).replace(/--/g,`—`)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:(e,t)=>{let n=t.identifier,r={type:`element`,tagName:`sup`,properties:{id:`fnref-${n}`,dataFootnoteRef:``,dataFootnoteId:n,className:[`footnote-ref`]},children:[{type:`element`,tagName:`a`,properties:{href:`#fn-${n}`,className:[`footnote-ref-link`]},children:[{type:`text`,value:`[${n}]`}]}]};return e.patch(t,r),e.applyData(t,r)},footnoteDefinition:(e,t)=>{let n=t.identifier,r={type:`element`,tagName:`aside`,properties:{id:`fn-${n}`,dataFootnoteDef:``,dataFootnoteId:n,className:[`footnote-def`]},children:[{type:`element`,tagName:`div`,properties:{className:[`footnote-body`]},children:e.all(t)},{type:`element`,tagName:`a`,properties:{href:`#fnref-${n}`,className:[`footnote-backref`],ariaLabel:`Back to reference`},children:[{type:`text`,value:`↩`}]}]};return e.patch(t,r),e.applyData(t,r)}},_oe=/url\s*\(\s*['"]?\s*(?:javascript|vbscript|data)\s*:/i,voe=/\bexpression\s*\(/i,yoe=1e4;function boe(e){return!(e.length>yoe||_oe.test(e)||voe.test(e))}function s7(e){for(let t of e.split(`,`)){let e=t.trim();if(e!==``&&!mZ(e.split(/\s+/)[0]??``))return!1}return!0}var xoe={a:[`href`,`title`],img:[`src`,`alt`,`title`],video:[`src`,`title`],audio:[`src`,`title`],code:[`className`]},Soe=new Set([`href`,`src`]),Coe=re(`<>`),c7=()=>e=>{E(e,`element`,e=>{let t=xoe[e.tagName.toLowerCase()],n=e.properties;if(!(!t||!n))for(let e of t){let t=n[e];if(Array.isArray(t)){let r=t.map(e=>typeof e==`string`?x3(e):e);r.some((e,n)=>e!==t[n])&&(n[e]=r);continue}if(typeof t!=`string`)continue;let r;if(Soe.has(e))if(t===`<>`||t===Coe)r=``;else{let e=x3(t);r=e===t?t:re(e)}else r=x3(t);r!==t&&(n[e]=r)}})},l7=()=>e=>{E(e,`element`,e=>{let t=e.tagName.toLowerCase(),n=e.properties;if(!n)return;if(t===`a`||t===`area`||t===`link`||t===`base`){let e=n.href;typeof e==`string`&&!mZ(e)&&delete n.href}if(t===`img`||t===`iframe`||t===`script`||t===`embed`||t===`source`||t===`audio`||t===`video`||t===`track`){let e=n.src;typeof e==`string`&&!mZ(e)&&delete n.src}if(t===`form`){let e=n.action;typeof e==`string`&&!mZ(e)&&delete n.action}if(t===`img`||t===`source`){let e=n.srcSet;typeof e==`string`&&!s7(e)&&delete n.srcSet;let t=n.srcset;typeof t==`string`&&!s7(t)&&delete n.srcset}if(t===`video`){let e=n.poster;typeof e==`string`&&!mZ(e)&&delete n.poster}let r=n.style;typeof r==`string`&&!boe(r)&&delete n.style})};function woe(e){let t=A().use(xe,{handlers:o7}).use(c7).use(l7).use(_G),n=t.runSync(e);return String(t.stringify(n))}function Toe(e){let t=/\r?\n|\r/g,n=[],r=0,i=t.exec(e);for(;i!==null;)n.push(u7(e.slice(r,i.index),r>0,!0),i[0]),r=i.index+i[0].length,i=t.exec(e);return n.push(u7(e.slice(r),r>0,!1)),n.join(``)}function u7(e,t,n){let r=0,i=e.length,a=e=>e===9||e===32;for(;t&&r<i&&a(e.charCodeAt(r));)r++;for(;n&&i>r&&a(e.charCodeAt(i-1));)i--;return i>r?e.slice(r,i):``}var d7=/\r?\n|\r/,Eoe=(e,t)=>{let n=Toe(String(t.value));if(!d7.test(n)){let r={type:`text`,value:n};return e.patch(t,r),e.applyData(t,r)}let r=n.split(d7),i=[];for(let e=0;e<r.length;e++)e>0&&i.push({type:`element`,tagName:`br`,properties:{},children:[]}),r[e].length>0&&i.push({type:`text`,value:r[e]});return i};function Doe(e){let t=A().use(ie).use(nF,[`yaml`]).use(F8).use(se).use(t5).use(m3).use(U8).use(k3).use(xe,{handlers:{...o7,text:Eoe}}).use(c7).use(l7).use(_G);return String(t.processSync(f3(O3(e))))}kI(),JF(),YF(),L({entries:I(L({level:z([`info`,`warn`,`error`]),message:N().max(hY),event:N().optional(),fields:mo(N(),to()).optional(),ts:P().optional(),sourceId:N().optional(),lineNumber:P().optional()}).loose()).max(100),droppedSinceLastFlush:P().int().min(0).optional()}).loose(),L({accepted:P().int().min(0)}).loose();var Ooe=L({exact:N().min(1),prefix:N(),suffix:N(),start:P().int().nonnegative(),end:P().int().nonnegative()}),koe=I(so([N(),P().int().nonnegative()])),Aoe=lo(`kind`,[L({kind:B(`body`)}),L({kind:B(`property`),key:N().min(1),path:koe.default([])})]).default({kind:`body`}),joe=z([`anchored`,`orphaned`,`resolved`]),f7=L({threadId:N().min(1),docName:N().min(1),target:Aoe,anchor:Ooe.nullable(),state:joe,queued:F(),latestComment:N(),createdBy:N().min(1),createdAt:P()}),p7=L({docName:N(),instruction:N(),property:N().nullable(),passage:L({exact:N(),prefix:N(),suffix:N()}).nullable(),anchorLost:F(),passageRepeats:F()}).loose(),m7=L({threadId:N(),ok:B(!0)}),h7=L({threadId:N(),ok:B(!1),error:B(`not-found`)});L({threads:I(f7)}).loose();var Moe=L({meta:f7,orphaned:F()}).loose(),Noe=L({threadId:N()}).loose();L({meta:f7,payload:p7}).loose();var Poe=L({results:I(so([m7.extend({meta:f7,payload:p7}),h7]))}).loose(),Foe=L({results:I(so([m7.extend({meta:f7}),h7]))}).loose(),Ioe=L({status:N().min(1),reason:N()}).loose(),Loe=L({docName:N().min(1),content:N(),lifecycle:Ioe.nullable()}).loose(),g7=L({kind:z([`document`,`asset`,`folder`,`file`]).default(`document`),docName:N().min(1).optional(),docExt:N().min(1).default(`.md`),size:P().int().nonnegative(),modified:N().min(1),isSymlink:F().default(!1),canonicalDocName:N().nullable().default(null),targetPath:N().nullable().default(null),path:N().min(1).optional(),assetExt:N().min(1).optional(),mediaKind:z([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`]).nullable().optional(),referencedBy:I(N().min(1)).optional(),hasChildren:F().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`}),Roe=L({documents:I(g7),truncated:F().optional()}).loose(),zoe=L({source:N().min(1),anchor:N().nullable(),title:N(),snippet:N().nullable()}).loose(),Boe=L({docName:N().min(1),backlinks:I(zoe)}).loose(),Voe=L({counts:mo(N().min(1),P().int().nonnegative())}).loose();L({counts:mo(N().min(1),P().int().nonnegative())}).loose();var Hoe=lo(`kind`,[L({kind:B(`doc`),docName:N().min(1),anchor:N().nullable(),title:N(),snippet:N().nullable()}).loose(),L({kind:B(`external`),url:N().min(1),title:N(),snippet:N().nullable()}).loose()]),Uoe=L({role:N().min(1),sourceForm:N().min(1),targetKind:N().min(1),href:N(),resolvedTarget:N().nullable(),status:N().min(1),reason:N().nullable(),resolutionMethod:N().min(1),fallbackTarget:N().nullable().default(null),range:L({start:P().int().nonnegative(),end:P().int().nonnegative()}),line:P().int().nonnegative(),column:P().int().nonnegative(),definition:L({label:N(),line:P().int().nonnegative()}).nullable().default(null)}).loose(),Woe=L({docName:N().min(1),forwardLinks:I(Hoe),localTargets:I(Uoe).optional()}).loose(),Goe=lo(`kind`,[L({id:N().min(1),kind:B(`doc`),docName:N().min(1),anchor:N().nullable(),label:N(),cluster:N().nullable(),category:N().nullable(),tags:I(N()).nullable()}).loose(),L({id:N().min(1),kind:B(`external`),url:N().min(1),label:N()}).loose()]),Koe=L({source:N().min(1),target:N().min(1)}).loose(),qoe=L({nodes:I(Goe),links:I(Koe)}).loose(),Joe=L({ts:P().int().min(0),url:N(),method:N(),ua:N().optional(),origin:N().optional(),referer:N().optional(),host:N().optional(),remote:N().optional(),secChUa:N().optional(),secChUaMobile:N().optional(),secChUaPlatform:N().optional(),secFetchSite:N().optional(),secFetchDest:N().optional(),secFetchMode:N().optional(),secFetchUser:N().optional()}).loose(),Yoe=L({app:so([B(`cursor`),B(`codex`),B(`claude`),$a()]),signals_fired:I(N())}).loose();L({entries:I(Joe),count:P().int().min(0),detection:Yoe}).loose(),L({writers:I(L({id:N().min(1),name:N().optional(),email:N().optional()}).loose()).optional(),summary:H$,...V$}).loose(),L({checkpointRef:N().min(1)}).loose();var Xoe=L({v:P().int().optional(),id:N().min(1),name:N().min(1),colorSeed:N().optional(),docs:I(N()),summaries:I(N()).optional()}).loose();L({entries:I(L({sha:N().min(1),timestamp:N().min(1),author:N(),authorEmail:N(),type:z([`checkpoint`,`wip`,`upstream`,`park`]),message:N(),contributors:I(Xoe),checkpoint:to().nullable(),parentSha:N().nullable().optional()}).loose()),total:P().int().nonnegative().optional(),truncated:F().optional(),hasMore:F().optional()}).loose(),L({sha:N().regex(/^[0-9a-f]{40}$/i),content:N(),timestamp:N(),author:N()}).loose();var Zoe=L({contentDir:N().min(1),pathSeparator:z([`/`,`\\`]),symlinkResolved:F()}).loose();I(lo(`source`,[L({docName:N().min(1),timestamp:N().min(1),size:P().int().nonnegative(),source:B(`flat`)}).loose(),L({docName:N().min(1),timestamp:N().min(1),source:B(`timeline`),sha:N().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."});var Qoe=L({domain:N().min(1),title:N().optional(),description:N().optional(),siteName:N().optional(),faviconDataUri:N().optional()}).loose();L({url:N()}).loose();var $oe=lo(`ok`,[L({ok:B(!0),metadata:Qoe}).loose(),L({ok:B(!1),reason:N()}).loose()]),ese=L({orphans:I(L({docName:N().min(1),title:N()}).loose())}).loose(),tse=L({hubs:I(L({docName:N().min(1),title:N(),count:P().int().nonnegative()}).loose())}).loose(),nse=L({source:N().min(1),title:N(),snippet:N().nullable()}).loose();L({deadLinks:I(L({target:N().min(1),sources:I(nse)}).loose())}).loose(),L({target:L({docName:N().min(1),title:N(),aliases:I(N())}).loose(),mentions:I(L({source:N().min(1),excerpt:N(),offset:P().int().nonnegative()}).loose()),truncated:F()}).loose(),L({projectPath:N().min(1)}).loose();var rse=z([`not-a-git-worktree`,`init-failed`]);lo(`ok`,[L({ok:B(!0),projectPath:N().min(1)}).loose(),L({ok:B(!1),reason:rse,message:N().min(1)}).loose()]),L({host:N().min(1).optional()}).loose(),L({host:N().min(1).optional(),token:N().min(1)}).loose(),L({host:N(),login:N()}).loose(),L({key:N().min(1)}).loose(),L({keyPresent:F()}).loose();var ise=z([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]),ase=lo(`ok`,[L({ok:B(!0),endpoint:N().min(1),model:N().min(1),dimensions:P().int().positive()}).loose(),L({ok:B(!1),endpoint:N().min(1),model:N().min(1),reason:ise,status:P().int().optional()}).loose()]);L({name:N().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:N().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),L({authenticated:F()}).loose(),L({channel:z([`login`,`gh-login`]).default(`login`)}).loose(),L({}).loose();var ose=L({stackIndex:P().int().min(0),ts:P().int().min(0),additions:P().int().min(0),deletions:P().int().min(0)}).loose(),sse=L({docName:N().min(1),additionsTotal:P().int().min(0),deletionsTotal:P().int().min(0),lastTs:P().int().min(0),bursts:I(ose)}).loose(),cse=L({displayName:N().min(1),color:N().min(1),icon:N().optional(),connectionId:N().min(1)}).loose(),lse=L({sessionAlive:F(),agent:cse.nullable(),files:I(sse)}).loose(),use=L({diff:N(),before:N(),after:N(),generatedAt:P().int().min(0)}).loose();L({}).loose(),L({}).loose(),L({}).loose(),L({}).loose(),L({}).loose(),L({}).loose();var dse=L({displayName:N().min(1),icon:N(),color:N().min(1),currentDoc:N().nullable(),mode:z([`idle`,`writing`]),ts:P().int().min(0)}).loose();L({presence:mo(N().min(1),dse)}).loose();var fse=L({sessionId:N().min(1),agentType:N().min(1),ts:P().int().min(0),insertedChars:P().int().min(0),deletedChars:P().int().min(0)}).loose();L({effects:I(L({"doc.name":N().min(1),entries:I(fse)}).loose())}).loose(),L({decisions:I(L({ts:P().int().min(0),decision:N().min(1),kind:N().min(1),"doc.name":N().min(1),pathRole:N().min(1)}).loose())}).loose(),mo(N().min(1),F()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`}),L({path:N().min(1,`path must be non-empty`)}).loose(),L({}).loose();var pse=L({fromDocName:N().min(1),toDocName:N().min(1)}).loose(),mse=L({fromPath:N().min(1),toPath:N().min(1)}).loose();L({}).loose(),L({path:N().min(1),...V$,summary:H$}).loose();var hse=L({docName:N().min(1)}).loose();L({path:N().min(1),...V$,summary:H$}).loose();var gse=L({path:N().min(1)}).loose();L({kind:z([`file`,`folder`]),path:N().min(1),...V$,summary:H$}).loose();var _se=L({kind:z([`file`,`folder`]),path:N().min(1),duplicatedDocNames:I(N().min(1))}).loose(),vse=L({pages:I(L({docName:N().min(1),title:N(),docExt:N().min(1),size:P().int().nonnegative(),modified:N().min(1),icon:N().min(1).max(2048).optional()}).loose())}).loose(),yse=L({level:P().int().min(1).max(6),text:N(),slug:N()}).loose(),bse=L({docName:N().min(1),headings:I(yse)}).loose(),xse=L({docName:N().min(1),rewrites:P().int().nonnegative()}).loose();L({kind:z([`file`,`folder`,`asset`]),fromPath:N().min(1),toPath:N().min(1),...V$,summary:H$}).loose();var Sse=L({renamed:I(pse),renamedAssets:I(mse),rewrittenDocs:I(xse).optional(),summary:z5.optional()}).loose();L({kind:z([`file`,`folder`,`asset`]),path:N().min(1),...V$}).loose();var Cse=L({deletedDocNames:I(N().min(1))}).loose();L({kind:z([`file`,`folder`,`asset`]),path:N().min(1),...V$,summary:H$}).loose();var wse=L({deletedDocNames:I(N().min(1))}).loose();L({docName:N().min(1),commitSha:N().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:H$,...V$}).loose(),L({restoredFrom:N().min(1),timestamp:N().min(1),summary:z5.optional(),warning:B5.optional(),warnings:W5.optional()}).loose();var Tse=/^#[0-9a-fA-F]{6}$/,Ese=L(Object.fromEntries(Dd.map(e=>[e,N().regex(Tse,`must be a #rrggbb hex color`)]))),_7=N().min(1).refine(jd,{message:`must contain a non-whitespace character`}),v7=L({name:_7,author:_7.optional(),variant:z([`dark`,`light`]),palette:Ese}).loose(),Dse=L({name:N().min(1),scheme:v7,stem:N().min(1).optional(),extension:z([`.yaml`,`.yml`]).optional()}).loose(),Ose=L({id:N().min(1),filename:N().min(1)}).loose(),kse=L({id:N().min(1),scheme:v7}).loose(),Ase=L({id:N().min(1),filename:N().min(1)}).loose(),jse=lo(`existed`,[L({existed:B(!1)}).loose(),L({existed:B(!0),filename:N().min(1),scheme:v7}).loose()]),Mse=L({themes:I(lo(`ok`,[L({ok:B(!0),id:N().min(1),filename:N().min(1),scheme:v7}),L({ok:B(!1),filename:N().min(1),id:N().min(1).optional(),code:N().min(1),conflictingFilenames:I(N().min(1)).min(2).optional()})])),truncated:F()}).loose(),Nse=z([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),Pse=L({label:N().min(1),webUrl:Ma().nullable()}).loose(),Fse=lo(`checkStatus`,[L({checkStatus:B(`allowed`)}).loose(),L({checkStatus:B(`denied`),deniedReason:z([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`])}).loose(),L({checkStatus:B(`unknown`),unknownError:z([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),y7=z([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),Ise=z(Cu),Lse=z([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]);L({state:Nse,lastSyncUtc:N().nullable(),lastFetchUtc:N().nullable(),lastPushedSha:N().nullable(),ahead:P().int().min(0),behind:P().int().min(0),consecutiveFailures:P().int().min(0),conflictCount:P().int().min(0),hasRemote:F(),syncEnabled:F(),identityUnresolved:F(),remote:Pse.nullable().optional(),pushError:N().optional(),pushErrorCode:y7.optional(),pullError:N().optional(),pullErrorCode:y7.optional(),pausedReason:N().optional(),pushPermission:Fse.optional(),syncMode:Ise.optional(),lastPullUtc:N().nullable().optional(),lastPullOutcome:Lse.nullable().optional()}).loose(),L({op:z([`sync`,`push`,`pull`]).optional()}).loose(),L({op:z([`sync`,`push`,`pull`])}).loose(),L({conflicts:I(L({file:N().min(1),detectedAt:N().min(1),oursSha:N().optional(),theirsSha:N().optional(),baseSha:N().optional()}).loose())}).loose(),L({file:N().min(1),strategy:z([`mine`,`theirs`,`content`,`delete`]),content:N().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),L({}).loose(),L({file:N().min(1),base:N(),ours:N(),theirs:N(),kind:z([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:N().nullable()}).loose(),L({plan:Vo(e=>e!==void 0,{message:`plan is required`})}).loose(),L({plan:Vo(e=>e!==void 0,{message:`plan is required`})}).loose(),L({result:Vo(e=>e!==void 0,{message:`result is required`})}).loose();var Rse=L({path:N().min(1),summary:N().min(1)}).loose(),zse=L({files:P().int().nonnegative(),folders:P().int().nonnegative()}).loose();L({packs:I(L({id:N().min(1),name:N().min(1),description:N().min(1),defaultSubfolder:N().optional(),folders:I(Rse),entryCounts:zse}).loose())}).loose(),L({noOpen:F().optional(),out:N().min(1).optional()}).loose();var Bse=L({reason:z([`unsupported-platform`,`spawn-error`]),message:N()}).loose();lo(`status`,[L({status:B(`installed`),outputPath:N(),size:P().int().nonnegative(),sha256:N(),skillVersion:N()}).loose(),L({status:B(`built`),outputPath:N(),size:P().int().nonnegative(),sha256:N(),skillVersion:N(),handoffError:Bse.optional()}).loose(),L({status:B(`failed`),buildError:N()}).loose(),L({status:B(`skip-current`),skillVersion:N(),recordedAt:N().optional()}).loose()]);var b7=z(Jp);function Vse(e){return e===`agents`||Jp.includes(e)}L({tags:I(L({name:N().min(1),count:P().int().nonnegative(),isLeaf:F()}).loose())}).loose();var Hse=L({docName:N().min(1),title:N(),matchingTags:I(N().min(1)),snippet:N().nullable()}).loose();L({name:N().min(1),docs:I(Hse)}).loose(),L({folder:to(),frontmatter_local:mo(N(),to()).nullable()}).loose(),L({path:N(),frontmatter:mo(N(),to()).optional()}).loose(),L({applied:to()}).loose();var x7=mo(N(),to()).meta({description:`Free-form frontmatter map embedded in template payloads.`});L({template:L({name:N().min(1),folder:N(),scope:z([`local`,`inherited`]),path:N().min(1),frontmatter:x7,body:N()}).strict()}).strict();var Use=L({templates:I(L({name:N().min(1),title:N().optional(),description:N().optional(),path:N().min(1),source_folder:N()}).strict()),truncated:F()}).strict();L({folder:N(),name:N(),body:N().optional(),frontmatter:x7.optional(),...V$,summary:H$}).strict(),L({path:N().min(1),created:F(),warnings:I(N())}).strict(),L({sourcePath:N().min(1),targetFolder:N(),name:N().optional(),title:N().optional(),deleteSource:F().optional(),...V$,summary:H$}).strict(),L({path:N().min(1),created:F(),warnings:I(N())}).strict(),L({existed:F(),path:N().min(1)}).strict(),L({fromFolder:N(),fromName:N(),toFolder:N(),toName:N(),body:N().optional(),frontmatter:x7.optional(),...V$,summary:H$}).strict(),L({from:N().min(1),to:N().min(1),committed:F()}).strict();var S7=z(bp),Wse=/^[a-z0-9-]+$/,Gse=/^[A-Za-z0-9_-]+$/,C7=L({name:N(),description:N()}).strict();L({skill:L({name:N().min(1),scope:S7,path:N().min(1),frontmatter:C7,body:N(),files:I(L({path:N().min(1),text:N().nullable()})).optional(),managed:F().optional()}).strict()}).strict();var Kse=L({source:N().min(1),publisher:N().optional(),skill:N().optional(),marketplaceUrl:N().optional(),importedAt:N().min(1),autoUpdate:F().optional()}).strict(),qse=L({name:N().min(1),description:N().optional(),scope:S7,path:N().min(1),canonicalPath:N().min(1).optional(),absolutePath:N().min(1).optional(),installed:F(),hosts:I(N()),driftPaths:I(N()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:mo(N(),N()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:I(N()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:I(N()).optional(),installableEditors:I(N()).optional(),linkMode:F().optional(),customPlacements:I(L({path:N(),mode:z([`copy`,`link`])}).strict()).optional(),managed:F().optional(),origin:Kse.optional(),modified:F().optional(),revertable:F().optional(),ignored:F().optional()}).strict();L({name:N().min(1),scope:S7,apply:F().optional()}).strict(),L({line:N().min(1),gitignorePath:N().min(1),applied:F(),alreadyTracked:F().optional()}).strict();var Jse=L({skills:I(qse),truncated:F()}).strict();L({scope:S7.default(`project`),name:N().meta({description:`Managed skill name to create or update.`}),body:N().optional(),frontmatter:C7,...V$,summary:H$}).strict(),L({path:N().min(1),created:F(),warnings:I(N())}).strict(),L({scope:S7.default(`project`),name:N(),dryRun:F().optional(),setAutoUpdate:F().optional(),...V$,summary:H$}).strict(),L({name:N().min(1),updated:F(),source:N().min(1),localBody:N().optional(),upstreamBody:N().optional(),gitTracked:F().optional(),warnings:I(N())}).strict(),L({scope:S7.default(`project`),name:N(),...V$,summary:H$}).strict(),L({name:N().min(1),baselineRef:N().min(1),restoredFiles:I(N()),warnings:I(N())}).strict(),L({existed:F(),path:N().min(1)}).strict(),L({scope:S7.default(`project`),fromName:N(),toName:N(),body:N().optional(),frontmatter:C7.optional(),...V$,summary:H$}).strict(),L({from:N().min(1),to:N().min(1),committed:F()}).strict(),L({name:N(),fromScope:S7,toScope:S7,...V$,summary:H$}).strict(),L({scope:S7,path:N().optional()}).strict(),L({scope:S7,name:N(),toName:N(),...V$,summary:H$}).strict(),L({name:N().min(1)}).strict(),L({name:N(),home:N().min(1)}).strict(),L({docName:N().min(1)}).strict();var w7=z([`reference`,`script`,`file`]);L({scope:S7.default(`project`),name:N(),path:N().min(1),content:N(),...V$,summary:H$}).strict(),L({path:N().min(1),created:F(),kind:w7,content:F()}).strict(),L({scope:S7.default(`project`),name:N(),from:N().min(1),to:N().min(1),...V$,summary:H$}).strict(),L({from:N().min(1),to:N().min(1),fromDocName:N().optional(),toDocName:N().optional()}).strict(),L({path:N().min(1),kind:w7,text:N()}).strict(),L({path:N().min(1),existed:F(),kind:w7}).strict();var T7=so([b7,B(`agents`)]),E7=N().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),D7=so([T7,E7]);L({scope:S7.default(`project`),name:N(),targets:I(T7).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:I(D7).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:I(D7).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:z([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:D7.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:F().optional(),setSource:N().min(1).optional(),place:L({dir:N().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:z([`copy`,`link`])}).strict().optional(),convert:L({target:D7.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:z([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:L({path:N().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...V$,summary:H$,fork:L({editor:N().min(1),action:z([`align`,`make-source`,`rename`]),toName:N().optional()}).strict().optional()}).strict().refine(e=>!(e.targets!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>!(e.source!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"}),L({name:N().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:I(N()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:F().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:I(N()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:I(z([`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`])).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:N().optional(),sourceMovedTo:N().optional()}).strict(),L({scope:S7.default(`project`),name:N().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),L({name:N().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:F().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict();var Yse=L({targets:I(b7),configured:F(),folders:I(L({scope:S7,host:N(),root:N(),state:z([`own`,`linked`,`linked-parent`,`absent`]),target:N().optional(),drift:B(!0).optional(),expected:N().optional()}).strict()).optional()}).strict();L({folderAction:lo(`action`,[L({action:B(`link`),scope:S7,root:N().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:N().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}).strict(),L({action:B(`unlink`),scope:S7,root:N().min(1).meta({description:`The linked folder to materialize back.`}),exclude:I(N().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),L({action:B(`add-root`),scope:S7,root:E7.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict()])}).strict(),L({targets:I(b7),reprojected:I(L({name:N(),hosts:I(N())}).strict()),bundleHosts:I(N()),removedFrom:I(N()),folder:L({moved:I(N()),dropped:I(N()),linked:I(N())}).strict().optional()}).strict(),L({scope:S7.default(`project`),name:N(),version:N().regex(/^[0-9a-f]{40}$/i),...V$,summary:H$}).strict(),L({name:N().min(1),version:N(),restoredFiles:I(N()),warnings:I(N())}).strict(),L({query:N().optional(),intent:z([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:z([`navigation`,`relevance`]).optional(),scopes:I(z([`page`,`folder`,`content`,`file`])).optional(),scope:N().optional(),limit:P().int().nonnegative().optional(),semantic:F().optional(),source:z([`omnibar`,`mcp`,`http`]).optional()}).loose();var Xse=L({kind:z([`page`,`folder`,`content`,`file`]),path:N().min(1),title:N(),score:P(),signals:mo(N(),to()),snippet:N().optional()}).loose(),Zse=L({capable:F(),applied:F(),coverage:L({embedded:P().int().nonnegative(),total:P().int().nonnegative()})}).loose();L({enabled:F(),keyPresent:F(),keyNotRequired:F(),keySource:z([`project`,`file`,`env`]).nullable(),keyHint:N().nullable(),ready:F(),capable:F(),embedded:P().int().nonnegative(),total:P().int().nonnegative()}).loose(),L({query:N(),intent:z([`autocomplete`,`full_text`,`omnibar`]),results:I(Xse),elapsedMs:P().nonnegative(),semantic:Zse.optional(),truncated:F().optional(),ready:F().optional()}).loose();var Qse=L({version:N().min(1),recordedAt:N().min(1)}).loose();L({currentVersion:N().min(1),targets:mo(N(),Qse.nullable())}).loose(),L({scope:S7.default(`project`),source:N().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:N().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:F().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),marketplace:F().optional().meta({description:"The source came from a skills.sh listing the user chose (the Explore tab), so the install is reported to skills.sh and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...V$,summary:H$}).strict(),L({scope:S7.default(`project`),source:N().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:I(N().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:F().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),marketplace:F().optional().meta({description:"The source came from a skills.sh listing the user chose (a marketplace plugin bundle), so the import is reported to skills.sh as one batched install event and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...V$,summary:H$}).strict(),L({results:I(L({requested:N(),status:z([`imported`,`already-imported`,`not-found`,`failed`]),name:N().optional(),collisionRenamedFrom:N().optional(),warnings:I(N()),error:N().optional()}).loose()),imported:P(),alreadyImported:P(),failed:P()}).loose();var $se=L({source:N(),ref:N().optional(),contentHash:N(),publisher:N().optional()}).loose();L({name:N().min(1).meta({description:`Managed skill name created or matched.`}),path:N().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:F().meta({description:`True when this request created new source files.`}),alreadyImported:F().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:N().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:$se,warnings:I(N()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`})}).loose();var ece=`server-info`,tce=`branch-switched`,nce=`disk-ack`,rce=`config-validation-rejected`,ice=`config-ignore-nested-error`,O7=z([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`,`local-targets`]),ace=L({v:B(1),ch:B(ece),seq:P(),serverInstanceId:N().min(1),currentBranch:N().min(1).optional()}).loose(),oce=L({v:B(1),ch:B(tce),seq:P(),branch:N().min(1)}).loose(),sce=L({v:B(1),ch:O7,seq:P()}).loose(),cce=L({v:B(1),ch:B(nce),seq:P(),docName:N().min(1),sv:N().min(1)}).loose(),lce=L({v:B(1),ch:B(rce),seq:P(),docName:N().min(1),error:ip}).loose(),uce=L({v:B(1),ch:B(ice),seq:P(),path:N().min(1),error:N().min(1)}).loose();function dce(e){let t;try{t=new URL(e)}catch{return null}let n=t.pathname.match(/^\/video\/(\d+)/);if(n)return n[1]??null;let r=t.pathname.match(/^\/(\d+)/);return r?r[1]??null:null}function fce(e){if(typeof e!=`string`||e.length===0)return e;let t=x2(e);if(t){let e=t.noCookie?`www.youtube-nocookie.com`:`www.youtube.com`,n=t.startSeconds===null?``:`?start=${t.startSeconds}`;return`https://${e}/embed/${t.id}${n}`}if(g2(e)){let t=dce(e);return t?`https://player.vimeo.com/video/${t}`:e}let n=p2(e);if(n){let e=n.startRaw===null?``:`?t=${n.startRaw}`;return`https://www.loom.com/embed/${n.id}${e}`}return e}var pce=`https://api.github.com/repos/inkeep/open-knowledge`;async function mce(e){let{signal:t,...n}=e??{},r=t?AbortSignal.any([AbortSignal.timeout(5e3),t]):AbortSignal.timeout(5e3);try{let e=await fetch(pce,{headers:{accept:`application/vnd.github+json`,"user-agent":`openknowledge.ai`},...n,signal:r});if(!e.ok)return console.warn(`[github-stars] GitHub API responded ${e.status}`),null;let t=await e.json();return typeof t.stargazers_count==`number`?t.stargazers_count:null}catch(e){return console.warn(`[github-stars] fetch failed: ${e instanceof Error?e.message:String(e)}`),null}}function hce(e){if(!e)return{height:null,viewerFragment:``};let t=e.split(`&`).filter(e=>e.length>0),n=null,r=[];for(let e of t){let t=e.indexOf(`=`);if(t===-1){r.push(e);continue}let i=e.slice(0,t),a=e.slice(t+1);if(i===`height`){let e=Number.parseInt(a,10);!Number.isNaN(e)&&e>0&&(n=e);continue}r.push(e)}return{height:n,viewerFragment:r.join(`&`)}}new iY.default;var gce=L({path:I(so([N(),P()])),message:N(),issueCode:N()});lo(`code`,[L({code:B(`SCHEMA_INVALID`),issues:I(gce)}),L({code:B(`WRITE_ERROR`),detail:N()})]);function _ce(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}function vce(e){if(e.code!==`SCHEMA_INVALID`)return{};let t={};for(let n of e.issues){let e=n.path[0];typeof e==`string`&&(t[e]=t[e]?`${t[e]}; ${n.message}`:n.message)}return t}var k7=/^---[ \t]*\r?\n---[ \t]*(\r?\n|$)/,yce=/^---([ \t]*)(?=\r?\n|$)/,A7=e=>e.includes(`\r
|
|
570
|
+
`),i=Eae(t);return n.map(e=>Oae(e,r,Dae(e,i)))}function Eae(e){let t=new Map;return Object.entries(e).forEach(([e,n],r)=>{let i=e.toUpperCase();if(i===`DEFAULT`)return;let a=null;if(n===`error`||n===`warning`)a=n;else if(typeof n==`object`&&n&&!Array.isArray(n)){let e=n.severity;(e===`error`||e===`warning`)&&(a=e)}a!==null&&t.set(i,{entryIndex:r,severity:a})}),t}function Dae(e,t){let n;for(let r of e.ruleNames){let e=t.get(r.toUpperCase());e!==void 0&&(n===void 0||e.entryIndex>n.entryIndex)&&(n=e)}return n?.severity??`warning`}function Oae(e,t,n){let[r,i]=e.errorRange??[1,null],a=e.lineNumber-1,o=(r??1)-1,s=t[a]?.length??0,c=i==null?s:Math.min(o+i,s),l=e.fixInfo?[kae(e.fixInfo,e.lineNumber,t)]:void 0;return{range:{start:{line:a,character:o},end:{line:a,character:Math.max(c,o)}},severity:n,source:`markdownlint`,code:e.ruleNames[0]??`MD000`,message:e.errorDetail?`${e.ruleDescription}: ${e.errorDetail}`:e.ruleDescription,...l?{fixes:l}:{}}}function kae(e,t,n){let r=e.lineNumber??t,i=r-1;if(e.deleteCount===-1){if(r<n.length)return{range:{start:{line:i,character:0},end:{line:i+1,character:0}},newText:``};if(i>0){let e=n[i-1]?.length??0;return{range:{start:{line:i-1,character:e},end:{line:i,character:n[i]?.length??0}},newText:``}}return{range:{start:{line:0,character:0},end:{line:0,character:n[0]?.length??0}},newText:``}}let a=(e.editColumn??1)-1;return{range:{start:{line:i,character:a},end:{line:i,character:a+Math.max(0,e.deleteCount??0)}},newText:e.insertText??``}}var Aae=so([F(),z(Dd),mo(N(),to())]),jae={id:`markdownlint`,sliceSchema:L({enabled:F(),rules:mo(N(),Aae)}),defaultSlice:{enabled:!1,rules:E5},async lint(e,t){return Tae(e,D5(t.rules))},fix(e,t){return wae(e,D5(t.rules))}},Mae=L({appliesTo:so([N(),I(N())]).optional(),file:N(),enabled:F().optional(),key:N().optional(),schema:mo(N(),to()).optional()}),R5=[jae,{id:`frontmatter`,sliceSchema:L({enabled:F(),schemas:I(Mae)}),defaultSlice:{enabled:!1,schemas:[]},async lint(e,t,n){return Cae(e,M5(t.schemas,n.docName))}}],Nae={enabled:!0,plugins:Object.fromEntries(R5.map(e=>[e.id,e.defaultSlice]))},Pae=new Set([`.markdownlint.json`,`.markdownlint.jsonc`]);function Fae(e){return Pae.has(e)}L({docName:z$,summary:H$,content:N().optional(),...V$}).loose(),L({docName:z$,summary:H$,markdown:N(),position:z([`append`,`prepend`,`replace`]).optional(),extension:z(jX).optional(),...V$}).loose(),L({docName:z$,summary:H$,find:N().min(1),replace:N(),offset:P().int().nonnegative().optional(),...V$}).loose(),L({docName:z$,connectionId:N().min(1),scope:z([`last`,`session`,`file`,`count`]).optional(),count:P().int().positive().optional(),...V$}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]});var z5=L({value:N(),truncatedFrom:P().int().nonnegative().optional(),hint:N().optional()}).loose(),Iae=lo(`kind`,[L({kind:B(`inline`),content:N()}),L({kind:B(`truncated`),byteLength:P().int().nonnegative(),hint:N()})]),B5=L({kind:B(`content-divergence`),intendedBytes:P().int().nonnegative(),actualBytes:P().int().nonnegative(),byteDelta:P().int(),divergenceType:N().optional(),currentState:Iae.optional(),hint:N().optional()}).loose(),Lae=L({type:B(`orphan`),parentCandidates:I(N()),message:N()}).loose(),V5=L({kind:B(`disk-edit-reconciled`),intendedBytes:P().int().nonnegative(),actualBytes:P().int().nonnegative(),byteDelta:P().int(),mergeOutcome:N().optional(),hint:N().optional()}).loose(),H5=lo(`kind`,[B5,V5]),Rae=L({kind:B(`mermaid-parse-error`),fenceIndex:P().int().positive(),fenceFirstLine:N(),message:N(),line:P().int().positive().optional()}).loose(),U5=L({href:N(),targetKind:N(),role:N(),sourceForm:N(),resolvedTarget:N().nullable(),reason:N(),resolutionMethod:N(),fallbackTarget:N().nullable().optional(),definition:L({line:P().int().nonnegative(),label:N()}).loose().optional()}).loose(),W5=I(lo(`kind`,[B5,V5,Rae,L({kind:B(`lint-violation`),source:N(),code:N(),message:N(),severity:z([`error`,`warning`,`info`,`hint`]),line:P().int().positive(),column:P().int().positive(),linkTarget:N().optional(),localTarget:U5.optional()}).loose()])).min(1),G5=I(L({href:N(),resolvedTo:N().nullable(),reason:z([`no-such-doc`,`no-such-file`,`unresolvable`]),localTarget:U5.optional()}).loose());L({timestamp:N().min(1),summary:z5.optional(),warning:H5.optional(),warnings:W5.optional()}).loose(),L({timestamp:N().min(1),subscriberCount:P().int().nonnegative(),systemSubscriberCount:P().int().nonnegative(),hints:I(Lae).optional(),summary:z5.optional(),warning:H5.optional(),warnings:W5.optional(),brokenLinks:G5}).loose(),L({timestamp:N().min(1),subscriberCount:P().int().nonnegative(),systemSubscriberCount:P().int().nonnegative(),summary:z5.optional(),warning:H5.optional(),warnings:W5.optional(),brokenLinks:G5}).loose(),L({docName:N().min(1),scope:z([`last`,`session`,`count`]),undone:F()}).loose(),L({docs:I(L({docName:B$,markdown:N(),position:z([`append`,`prepend`,`replace`]).optional(),extension:z(jX).optional(),summary:H$}).loose()).min(1).max(100),...V$}).loose();var zae=L({type:c1,title:N(),detail:N().optional()}).loose(),Bae=lo(`status`,[L({status:B(`written`),docName:N().min(1),summary:z5.optional(),warnings:W5.optional(),brokenLinks:G5}).loose(),L({status:B(`error`),docName:N().min(1),error:zae}).loose()]);L({timestamp:N().min(1),results:I(Bae),written:P().int().nonnegative(),failed:P().int().nonnegative()}).loose(),L({docName:z$,patch:mo(N(),so([pm,$a()])),types:mo(N(),z(um)).optional(),summary:H$,...V$}).loose(),L({timestamp:N().min(1),subscriberCount:P().int().nonnegative(),systemSubscriberCount:P().int().nonnegative(),appliedKeys:I(N()),summary:z5.optional(),warning:H5.optional(),warnings:W5.optional(),brokenLinks:G5}).loose();function Vae(e){return{enabled:e.enabled??!0,plugins:{markdownlint:{...e.markdownlint,rules:e.markdownlint.rules??E5},frontmatter:{enabled:e.frontmatter?.enabled??!1,schemas:e.frontmatter?.schemas??[]}}}}var Hae=Object.fromEntries(R5.map(e=>[e.id,e.sliceSchema])),Uae=L({effective:L({enabled:F(),plugins:L(Hae)}),configFile:N().nullable().optional(),configProblems:I(N()).optional()}),Wae=so([F(),mo(N(),to())]);L({ruleId:N().min(1).max(64).regex(/^[A-Za-z][A-Za-z0-9_-]*$/),value:so([Wae,$a()])}),L({file:N().min(1).max(512),delete:B(!0).optional(),field:N().min(1).max(256).optional(),parentPath:I(so([N().min(1).max(256),L({items:B(!0)}).strict()])).max(8).optional(),removeField:B(!0).optional(),renameTo:N().min(1).max(256).optional(),constraint:L({type:z([`string`,`number`,`boolean`,`array`,`object`]).nullable().optional(),enum:I(so([N(),P(),F()])).nullable().optional(),itemsEnum:I(so([N(),P(),F()])).nullable().optional(),itemsType:z([`string`,`number`,`boolean`,`object`]).nullable().optional(),pattern:N().nullable().optional(),format:N().nullable().optional(),description:N().max(2048).nullable().optional(),required:F().optional()}).optional()}).refine(e=>e.delete===void 0||e.field===void 0&&e.constraint===void 0&&e.removeField===void 0&&e.renameTo===void 0,{message:`delete cannot be combined with a field edit`}).refine(e=>[e.constraint,e.removeField,e.renameTo].filter(e=>e!==void 0).length<=1,{message:`constraint, removeField, and renameTo are mutually exclusive`}).refine(e=>e.removeField===void 0&&e.renameTo===void 0||e.field!==void 0,{message:`removeField and renameTo require field`}).refine(e=>e.parentPath===void 0||e.field!==void 0,{message:`parentPath requires field`}).refine(e=>e.field===void 0?e.constraint===void 0:e.constraint!==void 0||e.removeField!==void 0||e.renameTo!==void 0,{message:`field requires constraint, removeField, or renameTo`});var Gae=L({schemas:I(N()),truncated:F()}).strict(),K5=L({line:P(),character:P()}),q5=L({start:K5,end:K5}),J5=L({range:q5,severity:z([`error`,`warning`,`info`,`hint`]),source:N(),code:N(),message:N(),fixes:I(L({range:q5,newText:N()})).optional(),frontmatterScope:z([`missing`,`invalid`]).optional(),frontmatterProperty:N().optional()});L({files:I(L({file:N(),diagnostics:I(J5),warnings:I(N()).optional()})),fileCount:P(),errorCount:P(),warningCount:P(),warnings:I(N())});var Kae=J5.extend({linkTarget:N().optional(),localTarget:U5.optional()}),qae=L({files:I(L({file:N(),diagnostics:I(Kae)})),fileCount:P(),errorCount:P(),warningCount:P(),warnings:I(N())}),Y5=L({errorCount:P().int().nonnegative(),warningCount:P().int().nonnegative()}),Jae=L({files:I(L({file:N(),lint:Y5,links:Y5})),fileCount:P().int().nonnegative(),errorCount:P().int().nonnegative(),warningCount:P().int().nonnegative(),warnings:I(N())});L({docName:z$,summary:H$,...V$}).loose();var Yae=L({file:N(),fixedCount:P(),diagnostics:I(J5),errorCount:P(),warningCount:P(),warning:N().optional()});function Xae(e){let t=e.trim().replace(/^\.\//,``);if(!t.startsWith(`.ok/schemas/`))return!1;let n=t.slice(12);return n.length>0&&!n.includes(`/`)&&!n.includes(`\\`)&&n!==`.`&&n!==`..`}function Zae(e){let t=e.trim().toLowerCase().split(`/`).pop()??``;return t.endsWith(`.schema.json`)&&t.length>12?!0:Xae(e)&&t.endsWith(`.json`)}var X5=[{id:`MD001`,alias:`heading-increment`,aliases:[`heading-increment`],name:`Heading levels should only increment by one level at a time`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md001.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`}]},{id:`MD003`,alias:`heading-style`,aliases:[`heading-style`],name:`Heading style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md003.md`,tags:[`headings`],options:[{key:`style`,type:`enum`,description:`Heading style`,enum:[`consistent`,`atx`,`atx_closed`,`setext`,`setext_with_atx`,`setext_with_atx_closed`],default:`consistent`}]},{id:`MD004`,alias:`ul-style`,aliases:[`ul-style`],name:`Unordered list style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md004.md`,tags:[`bullet`,`ul`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`consistent`,`asterisk`,`plus`,`dash`,`sublist`],default:`consistent`}]},{id:`MD005`,alias:`list-indent`,aliases:[`list-indent`],name:`Inconsistent indentation for list items at the same level`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md005.md`,tags:[`bullet`,`ul`,`indentation`],options:[]},{id:`MD007`,alias:`ul-indent`,aliases:[`ul-indent`],name:`Unordered list indentation`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md007.md`,tags:[`bullet`,`ul`,`indentation`],options:[{key:`indent`,type:`integer`,description:`Spaces for indent`,default:2,minimum:1},{key:`start_indented`,type:`boolean`,description:`Whether to indent the first level of the list`,default:!1},{key:`start_indent`,type:`integer`,description:`Spaces for first level indent (when start_indented is set)`,default:2,minimum:1}]},{id:`MD009`,alias:`no-trailing-spaces`,aliases:[`no-trailing-spaces`],name:`Trailing spaces`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md009.md`,tags:[`whitespace`],options:[{key:`br_spaces`,type:`integer`,description:`Spaces for line break`,default:2,minimum:0},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!1},{key:`list_item_empty_lines`,type:`boolean`,description:`Allow spaces for empty lines in list items`,default:!1},{key:`strict`,type:`boolean`,description:`Include unnecessary breaks`,default:!1}]},{id:`MD010`,alias:`no-hard-tabs`,aliases:[`no-hard-tabs`],name:`Hard tabs`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md010.md`,tags:[`whitespace`,`hard_tab`],options:[{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`ignore_code_languages`,type:`string-array`,description:`Fenced code languages to ignore`,default:[]},{key:`spaces_per_tab`,type:`integer`,description:`Number of spaces for each hard tab`,default:1,minimum:0}]},{id:`MD011`,alias:`no-reversed-links`,aliases:[`no-reversed-links`],name:`Reversed link syntax`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md011.md`,tags:[`links`],options:[]},{id:`MD012`,alias:`no-multiple-blanks`,aliases:[`no-multiple-blanks`],name:`Multiple consecutive blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md012.md`,tags:[`whitespace`,`blank_lines`],options:[{key:`maximum`,type:`integer`,description:`Consecutive blank lines`,default:1,minimum:1}]},{id:`MD013`,alias:`line-length`,aliases:[`line-length`],name:`Line length`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md013.md`,tags:[`line_length`],options:[{key:`line_length`,type:`integer`,description:`Number of characters`,default:80,minimum:1},{key:`heading_line_length`,type:`integer`,description:`Number of characters for headings`,default:80,minimum:1},{key:`code_block_line_length`,type:`integer`,description:`Number of characters for code blocks`,default:80,minimum:1},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`tables`,type:`boolean`,description:`Include tables`,default:!0},{key:`headings`,type:`boolean`,description:`Include headings`,default:!0},{key:`strict`,type:`boolean`,description:`Strict length checking`,default:!1},{key:`stern`,type:`boolean`,description:`Stern length checking`,default:!1}]},{id:`MD014`,alias:`commands-show-output`,aliases:[`commands-show-output`],name:`Dollar signs used before commands without showing output`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md014.md`,tags:[`code`],options:[]},{id:`MD018`,alias:`no-missing-space-atx`,aliases:[`no-missing-space-atx`],name:`No space after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md018.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD019`,alias:`no-multiple-space-atx`,aliases:[`no-multiple-space-atx`],name:`Multiple spaces after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md019.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD020`,alias:`no-missing-space-closed-atx`,aliases:[`no-missing-space-closed-atx`],name:`No space inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md020.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD021`,alias:`no-multiple-space-closed-atx`,aliases:[`no-multiple-space-closed-atx`],name:`Multiple spaces inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md021.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD022`,alias:`blanks-around-headings`,aliases:[`blanks-around-headings`],name:`Headings should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md022.md`,tags:[`headings`,`blank_lines`],options:[{key:`include_front_matter`,type:`boolean`,description:`Include front matter content`,default:!1},{key:`lines_above`,type:`unsupported`,description:`Blank lines above heading`,default:1},{key:`lines_below`,type:`unsupported`,description:`Blank lines below heading`,default:1}]},{id:`MD023`,alias:`heading-start-left`,aliases:[`heading-start-left`],name:`Headings must start at the beginning of the line`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md023.md`,tags:[`headings`,`spaces`],options:[]},{id:`MD024`,alias:`no-duplicate-heading`,aliases:[`no-duplicate-heading`],name:`Multiple headings with the same content`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md024.md`,tags:[`headings`],options:[{key:`siblings_only`,type:`boolean`,description:`Only check sibling headings`,default:!1}]},{id:`MD025`,alias:`single-title`,aliases:[`single-title`,`single-h1`],name:`Multiple top-level headings in the same document`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md025.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD026`,alias:`no-trailing-punctuation`,aliases:[`no-trailing-punctuation`],name:`Trailing punctuation in heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md026.md`,tags:[`headings`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!。,;:!`}]},{id:`MD027`,alias:`no-multiple-space-blockquote`,aliases:[`no-multiple-space-blockquote`],name:`Multiple spaces after blockquote symbol`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md027.md`,tags:[`indentation`,`whitespace`,`blockquote`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD028`,alias:`no-blanks-blockquote`,aliases:[`no-blanks-blockquote`],name:`Blank line inside blockquote`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md028.md`,tags:[`whitespace`,`blockquote`],options:[]},{id:`MD029`,alias:`ol-prefix`,aliases:[`ol-prefix`],name:`Ordered list item prefix`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md029.md`,tags:[`ol`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`one`,`ordered`,`one_or_ordered`,`zero`],default:`one_or_ordered`}]},{id:`MD030`,alias:`list-marker-space`,aliases:[`list-marker-space`],name:`Spaces after list markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md030.md`,tags:[`ul`,`whitespace`,`ol`],options:[{key:`ul_single`,type:`integer`,description:`Spaces for single-line unordered list items`,default:1,minimum:1},{key:`ol_single`,type:`integer`,description:`Spaces for single-line ordered list items`,default:1,minimum:1},{key:`ul_multi`,type:`integer`,description:`Spaces for multi-line unordered list items`,default:1,minimum:1},{key:`ol_multi`,type:`integer`,description:`Spaces for multi-line ordered list items`,default:1,minimum:1}]},{id:`MD031`,alias:`blanks-around-fences`,aliases:[`blanks-around-fences`],name:`Fenced code blocks should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md031.md`,tags:[`blank_lines`,`code`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD032`,alias:`blanks-around-lists`,aliases:[`blanks-around-lists`],name:`Lists should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md032.md`,tags:[`bullet`,`ul`,`blank_lines`,`ol`],options:[]},{id:`MD033`,alias:`no-inline-html`,aliases:[`no-inline-html`],name:`Inline HTML`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md033.md`,tags:[`html`],options:[{key:`allowed_elements`,type:`string-array`,description:`Allowed elements`,default:[]},{key:`table_allowed_elements`,type:`string-array`,description:`Allowed elements in tables`,default:[]}]},{id:`MD034`,alias:`no-bare-urls`,aliases:[`no-bare-urls`],name:`Bare URL used`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md034.md`,tags:[`links`,`url`],options:[]},{id:`MD035`,alias:`hr-style`,aliases:[`hr-style`],name:`Horizontal rule style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md035.md`,tags:[`hr`],options:[{key:`style`,type:`string`,description:`Horizontal rule style`,default:`consistent`}]},{id:`MD036`,alias:`no-emphasis-as-heading`,aliases:[`no-emphasis-as-heading`],name:`Emphasis used instead of a heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md036.md`,tags:[`headings`,`emphasis`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!?。,;:!?`}]},{id:`MD037`,alias:`no-space-in-emphasis`,aliases:[`no-space-in-emphasis`],name:`Spaces inside emphasis markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md037.md`,tags:[`whitespace`,`emphasis`],options:[]},{id:`MD038`,alias:`no-space-in-code`,aliases:[`no-space-in-code`],name:`Spaces inside code span elements`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md038.md`,tags:[`whitespace`,`code`],options:[]},{id:`MD039`,alias:`no-space-in-links`,aliases:[`no-space-in-links`],name:`Spaces inside link text`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md039.md`,tags:[`whitespace`,`links`],options:[]},{id:`MD040`,alias:`fenced-code-language`,aliases:[`fenced-code-language`],name:`Fenced code blocks should have a language specified`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md040.md`,tags:[`code`,`language`],options:[{key:`allowed_languages`,type:`string-array`,description:`List of languages`,default:[]},{key:`language_only`,type:`boolean`,description:`Require language only`,default:!1}]},{id:`MD041`,alias:`first-line-heading`,aliases:[`first-line-heading`,`first-line-h1`],name:`First line in a file should be a top-level heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md041.md`,tags:[`headings`],options:[{key:`allow_preamble`,type:`boolean`,description:`Allow content before first heading`,default:!1},{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD042`,alias:`no-empty-links`,aliases:[`no-empty-links`],name:`No empty links`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md042.md`,tags:[`links`],options:[]},{id:`MD043`,alias:`required-headings`,aliases:[`required-headings`],name:`Required heading structure`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md043.md`,tags:[`headings`],options:[{key:`headings`,type:`string-array`,description:`List of headings`,default:[]},{key:`match_case`,type:`boolean`,description:`Match case of headings`,default:!1}]},{id:`MD044`,alias:`proper-names`,aliases:[`proper-names`],name:`Proper names should have the correct capitalization`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md044.md`,tags:[`spelling`],options:[{key:`names`,type:`string-array`,description:`List of proper names`,default:[]},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`html_elements`,type:`boolean`,description:`Include HTML elements`,default:!0}]},{id:`MD045`,alias:`no-alt-text`,aliases:[`no-alt-text`],name:`Images should have alternate text (alt text)`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md045.md`,tags:[`accessibility`,`images`],options:[]},{id:`MD046`,alias:`code-block-style`,aliases:[`code-block-style`],name:`Code block style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md046.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Block style`,enum:[`consistent`,`fenced`,`indented`],default:`consistent`}]},{id:`MD047`,alias:`single-trailing-newline`,aliases:[`single-trailing-newline`],name:`Files should end with a single newline character`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md047.md`,tags:[`blank_lines`],options:[]},{id:`MD048`,alias:`code-fence-style`,aliases:[`code-fence-style`],name:`Code fence style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md048.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Code fence style`,enum:[`consistent`,`backtick`,`tilde`],default:`consistent`}]},{id:`MD049`,alias:`emphasis-style`,aliases:[`emphasis-style`],name:`Emphasis style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md049.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Emphasis style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD050`,alias:`strong-style`,aliases:[`strong-style`],name:`Strong style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md050.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Strong style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD051`,alias:`link-fragments`,aliases:[`link-fragments`],name:`Link fragments should be valid`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md051.md`,tags:[`links`],options:[{key:`ignore_case`,type:`boolean`,description:`Ignore case of fragments`,default:!1},{key:`ignored_pattern`,type:`string`,description:`Pattern for ignoring additional fragments`,default:``}]},{id:`MD052`,alias:`reference-links-images`,aliases:[`reference-links-images`],name:`Reference links and images should use a label that is defined`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md052.md`,tags:[`links`,`images`],options:[{key:`ignored_labels`,type:`string-array`,description:`Ignored link labels`,default:[`x`]},{key:`shortcut_syntax`,type:`boolean`,description:`Include shortcut syntax`,default:!1}]},{id:`MD053`,alias:`link-image-reference-definitions`,aliases:[`link-image-reference-definitions`],name:`Link and image reference definitions should be needed`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md053.md`,tags:[`links`,`images`],options:[{key:`ignored_definitions`,type:`string-array`,description:`Ignored definitions`,default:[`//`]}]},{id:`MD054`,alias:`link-image-style`,aliases:[`link-image-style`],name:`Link and image style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md054.md`,tags:[`links`,`images`],options:[{key:`autolink`,type:`boolean`,description:`Allow autolinks`,default:!0},{key:`inline`,type:`boolean`,description:`Allow inline links and images`,default:!0},{key:`full`,type:`boolean`,description:`Allow full reference links and images`,default:!0},{key:`collapsed`,type:`boolean`,description:`Allow collapsed reference links and images`,default:!0},{key:`shortcut`,type:`boolean`,description:`Allow shortcut reference links and images`,default:!0},{key:`url_inline`,type:`boolean`,description:`Allow URLs as inline links`,default:!0}]},{id:`MD055`,alias:`table-pipe-style`,aliases:[`table-pipe-style`],name:`Table pipe style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table pipe style`,enum:[`consistent`,`leading_only`,`trailing_only`,`leading_and_trailing`,`no_leading_or_trailing`],default:`consistent`}]},{id:`MD056`,alias:`table-column-count`,aliases:[`table-column-count`],name:`Table column count`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md056.md`,tags:[`table`],options:[]},{id:`MD058`,alias:`blanks-around-tables`,aliases:[`blanks-around-tables`],name:`Tables should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md058.md`,tags:[`table`],options:[]},{id:`MD059`,alias:`descriptive-link-text`,aliases:[`descriptive-link-text`],name:`Link text should be descriptive`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md059.md`,tags:[`links`,`accessibility`],options:[{key:`prohibited_texts`,type:`string-array`,description:`Prohibited link texts`,default:[`click here`,`here`,`link`,`more`]}]},{id:`MD060`,alias:`table-column-style`,aliases:[`table-column-style`],name:`Table column style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md060.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table column style`,enum:[`any`,`aligned`,`compact`,`tight`],default:`any`},{key:`aligned_delimiter`,type:`boolean`,description:`Aligned delimiter columns`,default:!1}]}],Qae=(()=>{let e=new Map;for(let t of X5){e.set(t.id.toUpperCase(),t.id);for(let n of t.aliases)e.set(n.toUpperCase(),t.id)}return e})();function Z5(e){return Qae.get(e.toUpperCase())??null}function $ae(e,t){let n=Z5(t);if(n===null)return;let r;for(let[t,i]of Object.entries(e))Z5(t)===n&&(r={key:t,value:i});return r}var eoe=[`Headings`,`Lists`,`Whitespace`,`Code`,`Links & images`,`Style`],toe=[[`headings`,`Headings`],[`bullet`,`Lists`],[`ul`,`Lists`],[`ol`,`Lists`],[`links`,`Links & images`],[`images`,`Links & images`],[`accessibility`,`Links & images`],[`code`,`Code`],[`language`,`Code`],[`emphasis`,`Style`],[`html`,`Style`],[`line_length`,`Whitespace`],[`whitespace`,`Whitespace`],[`hard_tab`,`Whitespace`],[`blank_lines`,`Whitespace`],[`indentation`,`Whitespace`]];function noe(e){for(let[t,n]of toe)if(e.tags.includes(t))return n;return`Style`}function roe(e){let t={lint:{errorCount:0,warningCount:0},links:{errorCount:0,warningCount:0}};for(let n of e){let e=n.source===`links`?t.links:t.lint;n.severity===`error`?e.errorCount+=1:e.warningCount+=1}return t}async function ioe(e,t,n){if(!t.enabled)return[];let r=[];for(let i of R5){let a=t.plugins[i.id];a.enabled&&r.push(...await i.lint(e,a,{docName:n}))}return r}var aoe=/\p{M}+/gu,ooe=/[^\p{L}\p{N}]+/gu,soe=/^-+|-+$/g;function Q5(e){return e.trim().normalize(`NFKD`).replace(aoe,``).toLowerCase().replace(ooe,`-`).replace(soe,``)}function coe(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function $5(e,t){let n=Q5(e);return n?coe(n,t):``}function e7(e,t){let n=Q5(e);return t?`#${n}-${Q5(t)}`:`#${n}`}var t7=new Set([`img`,`video`,`audio`,`mark`,`u`,`ins`]),loe=new Map(Y2.flatMap(e=>e.surface===`compat`&&t7.has(e.rendersAs)?[[e.name,e]]:[]));function n7(e){let t={};for(let n of e.attributes){if(n.type!==`mdxJsxAttribute`)return null;let e=n.name.toLowerCase();if(!(e.length>=3&&e.startsWith(`on`)))if(n.value===null)t[n.name]=!0;else if(typeof n.value==`string`)t[n.name]=n.value;else return null}return t}function r7(e){let t=e.name;if(!t||!t7.has(t))return null;let n=n7(e);return n===null?null:{type:`element`,tagName:t,properties:n,children:[]}}function i7(e){let t=e.name;if(!t)return null;let n=loe.get(t);if(!n)return null;let r=n7(e);if(r===null)return null;let i=n.translateProps(r),a={};for(let[e,t]of Object.entries(i))(typeof t==`string`||typeof t==`boolean`)&&(a[e]=t);return{type:`element`,tagName:n.rendersAs,properties:a,children:[]}}var uoe=(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-link`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:e7(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},doe=(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-embed`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:e7(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},foe=(e,t)=>{let n=t,r=r7(n);if(r)return n.children.length>0&&(r.children=e.all(n)),e.patch(t,r),e.applyData(t,r);let i=i7(n);if(i){e.patch(t,i);let n=e.applyData(t,i);return n.tagName===`img`?{type:`element`,tagName:`p`,properties:{},children:[n]}:n}let a={type:`element`,tagName:`pre`,properties:{className:[`mdx-component`]},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]}]};return e.patch(t,a),e.applyData(t,a)},poe=(e,t)=>{let n=t,r=r7(n);if(r)return n.children.length>0&&(r.children=e.all(n)),e.patch(t,r),e.applyData(t,r);let i=i7(n);if(i)return e.patch(t,i),e.applyData(t,i);let a={type:`element`,tagName:`span`,properties:{className:[`mdx-inline`],dataJsxInline:``},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]};return e.patch(t,a),e.applyData(t,a)},moe=(e,t)=>{let n=t,r=n.data.reason||`unknown`,i=n.value||``,a=r.replace(/--/g,`—`),o={type:`comment`,value:` Parse error: ${a} `},s={type:`element`,tagName:`pre`,properties:{className:[`mdx-fallback`],dataRawMdxFallback:``,dataReason:a},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:i}]}]};return e.patch(t,s),[o,e.applyData(t,s)]},hoe=(e,t)=>{let n={type:`element`,tagName:`mark`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},goe=(e,t)=>{let n=t,r={type:`element`,tagName:n.data?.sourceForm===`ins`?`ins`:`u`,properties:{},children:e.all(n)};return e.patch(t,r),e.applyData(t,r)};function a7(e){if(typeof e!=`object`||!e)return``;let t=e;return typeof t.value==`string`?t.value:Array.isArray(t.children)?t.children.map(a7).join(``):``}var o7={wikiLink:uoe,wikiLinkEmbed:doe,mdxJsxFlowElement:foe,mdxJsxTextElement:poe,rawMdxFallback:moe,mark:hoe,underline:goe,tag:(e,t)=>{let n=t.value,r={type:`element`,tagName:`a`,properties:{className:[`tag`],dataTag:n,href:`#tag/${n}`},children:[{type:`text`,value:`#${n}`}]};return e.patch(t,r),e.applyData(t,r)},comment:(e,t)=>{let n={type:`comment`,value:a7(t).replace(/--/g,`—`)};return e.patch(t,n),e.applyData(t,n)},commentBlock:(e,t)=>{let n={type:`comment`,value:a7(t).replace(/--/g,`—`)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:(e,t)=>{let n=t.identifier,r={type:`element`,tagName:`sup`,properties:{id:`fnref-${n}`,dataFootnoteRef:``,dataFootnoteId:n,className:[`footnote-ref`]},children:[{type:`element`,tagName:`a`,properties:{href:`#fn-${n}`,className:[`footnote-ref-link`]},children:[{type:`text`,value:`[${n}]`}]}]};return e.patch(t,r),e.applyData(t,r)},footnoteDefinition:(e,t)=>{let n=t.identifier,r={type:`element`,tagName:`aside`,properties:{id:`fn-${n}`,dataFootnoteDef:``,dataFootnoteId:n,className:[`footnote-def`]},children:[{type:`element`,tagName:`div`,properties:{className:[`footnote-body`]},children:e.all(t)},{type:`element`,tagName:`a`,properties:{href:`#fnref-${n}`,className:[`footnote-backref`],ariaLabel:`Back to reference`},children:[{type:`text`,value:`↩`}]}]};return e.patch(t,r),e.applyData(t,r)}},_oe=/url\s*\(\s*['"]?\s*(?:javascript|vbscript|data)\s*:/i,voe=/\bexpression\s*\(/i,yoe=1e4;function boe(e){return!(e.length>yoe||_oe.test(e)||voe.test(e))}function s7(e){for(let t of e.split(`,`)){let e=t.trim();if(e!==``&&!mZ(e.split(/\s+/)[0]??``))return!1}return!0}var xoe={a:[`href`,`title`],img:[`src`,`alt`,`title`],video:[`src`,`title`],audio:[`src`,`title`],code:[`className`]},Soe=new Set([`href`,`src`]),Coe=re(`<>`),c7=()=>e=>{E(e,`element`,e=>{let t=xoe[e.tagName.toLowerCase()],n=e.properties;if(!(!t||!n))for(let e of t){let t=n[e];if(Array.isArray(t)){let r=t.map(e=>typeof e==`string`?x3(e):e);r.some((e,n)=>e!==t[n])&&(n[e]=r);continue}if(typeof t!=`string`)continue;let r;if(Soe.has(e))if(t===`<>`||t===Coe)r=``;else{let e=x3(t);r=e===t?t:re(e)}else r=x3(t);r!==t&&(n[e]=r)}})},l7=()=>e=>{E(e,`element`,e=>{let t=e.tagName.toLowerCase(),n=e.properties;if(!n)return;if(t===`a`||t===`area`||t===`link`||t===`base`){let e=n.href;typeof e==`string`&&!mZ(e)&&delete n.href}if(t===`img`||t===`iframe`||t===`script`||t===`embed`||t===`source`||t===`audio`||t===`video`||t===`track`){let e=n.src;typeof e==`string`&&!mZ(e)&&delete n.src}if(t===`form`){let e=n.action;typeof e==`string`&&!mZ(e)&&delete n.action}if(t===`img`||t===`source`){let e=n.srcSet;typeof e==`string`&&!s7(e)&&delete n.srcSet;let t=n.srcset;typeof t==`string`&&!s7(t)&&delete n.srcset}if(t===`video`){let e=n.poster;typeof e==`string`&&!mZ(e)&&delete n.poster}let r=n.style;typeof r==`string`&&!boe(r)&&delete n.style})};function woe(e){let t=A().use(xe,{handlers:o7}).use(c7).use(l7).use(_G),n=t.runSync(e);return String(t.stringify(n))}function Toe(e){let t=/\r?\n|\r/g,n=[],r=0,i=t.exec(e);for(;i!==null;)n.push(u7(e.slice(r,i.index),r>0,!0),i[0]),r=i.index+i[0].length,i=t.exec(e);return n.push(u7(e.slice(r),r>0,!1)),n.join(``)}function u7(e,t,n){let r=0,i=e.length,a=e=>e===9||e===32;for(;t&&r<i&&a(e.charCodeAt(r));)r++;for(;n&&i>r&&a(e.charCodeAt(i-1));)i--;return i>r?e.slice(r,i):``}var d7=/\r?\n|\r/,Eoe=(e,t)=>{let n=Toe(String(t.value));if(!d7.test(n)){let r={type:`text`,value:n};return e.patch(t,r),e.applyData(t,r)}let r=n.split(d7),i=[];for(let e=0;e<r.length;e++)e>0&&i.push({type:`element`,tagName:`br`,properties:{},children:[]}),r[e].length>0&&i.push({type:`text`,value:r[e]});return i};function Doe(e){let t=A().use(ie).use(nF,[`yaml`]).use(F8).use(se).use(t5).use(m3).use(U8).use(k3).use(xe,{handlers:{...o7,text:Eoe}}).use(c7).use(l7).use(_G);return String(t.processSync(f3(O3(e))))}kI(),JF(),YF(),L({entries:I(L({level:z([`info`,`warn`,`error`]),message:N().max(hY),event:N().optional(),fields:mo(N(),to()).optional(),ts:P().optional(),sourceId:N().optional(),lineNumber:P().optional()}).loose()).max(100),droppedSinceLastFlush:P().int().min(0).optional()}).loose(),L({accepted:P().int().min(0)}).loose();var Ooe=L({exact:N().min(1),prefix:N(),suffix:N(),start:P().int().nonnegative(),end:P().int().nonnegative()}),koe=I(so([N(),P().int().nonnegative()])),Aoe=lo(`kind`,[L({kind:B(`body`)}),L({kind:B(`property`),key:N().min(1),path:koe.default([])})]).default({kind:`body`}),joe=z([`anchored`,`orphaned`,`resolved`]),f7=L({threadId:N().min(1),docName:N().min(1),target:Aoe,anchor:Ooe.nullable(),state:joe,queued:F(),latestComment:N(),createdBy:N().min(1),createdAt:P()}),p7=L({docName:N(),instruction:N(),property:N().nullable(),passage:L({exact:N(),prefix:N(),suffix:N()}).nullable(),anchorLost:F(),passageRepeats:F()}).loose(),m7=L({threadId:N(),ok:B(!0)}),h7=L({threadId:N(),ok:B(!1),error:B(`not-found`)});L({threads:I(f7)}).loose();var Moe=L({meta:f7,orphaned:F()}).loose(),Noe=L({threadId:N()}).loose();L({meta:f7,payload:p7}).loose();var Poe=L({results:I(so([m7.extend({meta:f7,payload:p7}),h7]))}).loose(),Foe=L({results:I(so([m7.extend({meta:f7}),h7]))}).loose(),Ioe=L({status:N().min(1),reason:N()}).loose(),Loe=L({docName:N().min(1),content:N(),lifecycle:Ioe.nullable()}).loose(),g7=L({kind:z([`document`,`asset`,`folder`,`file`]).default(`document`),docName:N().min(1).optional(),docExt:N().min(1).default(`.md`),size:P().int().nonnegative(),modified:N().min(1),isSymlink:F().default(!1),canonicalDocName:N().nullable().default(null),targetPath:N().nullable().default(null),path:N().min(1).optional(),assetExt:N().min(1).optional(),mediaKind:z([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`]).nullable().optional(),referencedBy:I(N().min(1)).optional(),hasChildren:F().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`}),Roe=L({documents:I(g7),truncated:F().optional()}).loose(),zoe=L({source:N().min(1),anchor:N().nullable(),title:N(),snippet:N().nullable()}).loose(),Boe=L({docName:N().min(1),backlinks:I(zoe)}).loose(),Voe=L({counts:mo(N().min(1),P().int().nonnegative())}).loose();L({counts:mo(N().min(1),P().int().nonnegative())}).loose();var Hoe=lo(`kind`,[L({kind:B(`doc`),docName:N().min(1),anchor:N().nullable(),title:N(),snippet:N().nullable()}).loose(),L({kind:B(`external`),url:N().min(1),title:N(),snippet:N().nullable()}).loose()]),Uoe=L({role:N().min(1),sourceForm:N().min(1),targetKind:N().min(1),href:N(),resolvedTarget:N().nullable(),status:N().min(1),reason:N().nullable(),resolutionMethod:N().min(1),fallbackTarget:N().nullable().default(null),range:L({start:P().int().nonnegative(),end:P().int().nonnegative()}),line:P().int().nonnegative(),column:P().int().nonnegative(),definition:L({label:N(),line:P().int().nonnegative()}).nullable().default(null)}).loose(),Woe=L({docName:N().min(1),forwardLinks:I(Hoe),localTargets:I(Uoe).optional()}).loose(),Goe=lo(`kind`,[L({id:N().min(1),kind:B(`doc`),docName:N().min(1),anchor:N().nullable(),label:N(),cluster:N().nullable(),category:N().nullable(),tags:I(N()).nullable()}).loose(),L({id:N().min(1),kind:B(`external`),url:N().min(1),label:N()}).loose()]),Koe=L({source:N().min(1),target:N().min(1)}).loose(),qoe=L({nodes:I(Goe),links:I(Koe)}).loose(),Joe=L({ts:P().int().min(0),url:N(),method:N(),ua:N().optional(),origin:N().optional(),referer:N().optional(),host:N().optional(),remote:N().optional(),secChUa:N().optional(),secChUaMobile:N().optional(),secChUaPlatform:N().optional(),secFetchSite:N().optional(),secFetchDest:N().optional(),secFetchMode:N().optional(),secFetchUser:N().optional()}).loose(),Yoe=L({app:so([B(`cursor`),B(`codex`),B(`claude`),$a()]),signals_fired:I(N())}).loose();L({entries:I(Joe),count:P().int().min(0),detection:Yoe}).loose(),L({writers:I(L({id:N().min(1),name:N().optional(),email:N().optional()}).loose()).optional(),summary:H$,...V$}).loose(),L({checkpointRef:N().min(1)}).loose();var Xoe=L({v:P().int().optional(),id:N().min(1),name:N().min(1),colorSeed:N().optional(),docs:I(N()),summaries:I(N()).optional()}).loose();L({entries:I(L({sha:N().min(1),timestamp:N().min(1),author:N(),authorEmail:N(),type:z([`checkpoint`,`wip`,`upstream`,`park`]),message:N(),contributors:I(Xoe),checkpoint:to().nullable(),parentSha:N().nullable().optional()}).loose()),total:P().int().nonnegative().optional(),truncated:F().optional(),hasMore:F().optional()}).loose(),L({sha:N().regex(/^[0-9a-f]{40}$/i),content:N(),timestamp:N(),author:N()}).loose();var Zoe=L({contentDir:N().min(1),pathSeparator:z([`/`,`\\`]),symlinkResolved:F()}).loose();I(lo(`source`,[L({docName:N().min(1),timestamp:N().min(1),size:P().int().nonnegative(),source:B(`flat`)}).loose(),L({docName:N().min(1),timestamp:N().min(1),source:B(`timeline`),sha:N().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."});var Qoe=L({domain:N().min(1),title:N().optional(),description:N().optional(),siteName:N().optional(),faviconDataUri:N().optional()}).loose();L({url:N()}).loose();var $oe=lo(`ok`,[L({ok:B(!0),metadata:Qoe}).loose(),L({ok:B(!1),reason:N()}).loose()]),ese=L({orphans:I(L({docName:N().min(1),title:N()}).loose())}).loose(),tse=L({hubs:I(L({docName:N().min(1),title:N(),count:P().int().nonnegative()}).loose())}).loose(),nse=L({source:N().min(1),title:N(),snippet:N().nullable()}).loose();L({deadLinks:I(L({target:N().min(1),sources:I(nse)}).loose())}).loose(),L({target:L({docName:N().min(1),title:N(),aliases:I(N())}).loose(),mentions:I(L({source:N().min(1),excerpt:N(),offset:P().int().nonnegative()}).loose()),truncated:F()}).loose(),L({projectPath:N().min(1)}).loose();var rse=z([`not-a-git-worktree`,`init-failed`]);lo(`ok`,[L({ok:B(!0),projectPath:N().min(1)}).loose(),L({ok:B(!1),reason:rse,message:N().min(1)}).loose()]),L({host:N().min(1).optional()}).loose(),L({host:N().min(1).optional(),token:N().min(1)}).loose(),L({host:N(),login:N()}).loose(),L({key:N().min(1)}).loose(),L({keyPresent:F()}).loose();var ise=z([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]),ase=lo(`ok`,[L({ok:B(!0),endpoint:N().min(1),model:N().min(1),dimensions:P().int().positive()}).loose(),L({ok:B(!1),endpoint:N().min(1),model:N().min(1),reason:ise,status:P().int().optional()}).loose()]);L({name:N().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:N().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),L({authenticated:F()}).loose(),L({channel:z([`login`,`gh-login`]).default(`login`)}).loose(),L({}).loose();var ose=L({stackIndex:P().int().min(0),ts:P().int().min(0),additions:P().int().min(0),deletions:P().int().min(0)}).loose(),sse=L({docName:N().min(1),additionsTotal:P().int().min(0),deletionsTotal:P().int().min(0),lastTs:P().int().min(0),bursts:I(ose)}).loose(),cse=L({displayName:N().min(1),color:N().min(1),icon:N().optional(),connectionId:N().min(1)}).loose(),lse=L({sessionAlive:F(),agent:cse.nullable(),files:I(sse)}).loose(),use=L({diff:N(),before:N(),after:N(),generatedAt:P().int().min(0)}).loose();L({}).loose(),L({}).loose(),L({}).loose(),L({}).loose(),L({}).loose(),L({}).loose();var dse=L({displayName:N().min(1),icon:N(),color:N().min(1),currentDoc:N().nullable(),mode:z([`idle`,`writing`]),ts:P().int().min(0)}).loose();L({presence:mo(N().min(1),dse)}).loose();var fse=L({sessionId:N().min(1),agentType:N().min(1),ts:P().int().min(0),insertedChars:P().int().min(0),deletedChars:P().int().min(0)}).loose();L({effects:I(L({"doc.name":N().min(1),entries:I(fse)}).loose())}).loose(),L({decisions:I(L({ts:P().int().min(0),decision:N().min(1),kind:N().min(1),"doc.name":N().min(1),pathRole:N().min(1)}).loose())}).loose(),mo(N().min(1),F()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`}),L({path:N().min(1,`path must be non-empty`)}).loose(),L({}).loose();var pse=L({fromDocName:N().min(1),toDocName:N().min(1)}).loose(),mse=L({fromPath:N().min(1),toPath:N().min(1)}).loose();L({}).loose(),L({path:N().min(1),...V$,summary:H$}).loose();var hse=L({docName:N().min(1)}).loose();L({path:N().min(1),...V$,summary:H$}).loose();var gse=L({path:N().min(1)}).loose();L({kind:z([`file`,`folder`]),path:N().min(1),...V$,summary:H$}).loose();var _se=L({kind:z([`file`,`folder`]),path:N().min(1),duplicatedDocNames:I(N().min(1))}).loose(),vse=L({pages:I(L({docName:N().min(1),title:N(),docExt:N().min(1),size:P().int().nonnegative(),modified:N().min(1),icon:N().min(1).max(2048).optional()}).loose())}).loose(),yse=L({level:P().int().min(1).max(6),text:N(),slug:N()}).loose(),bse=L({docName:N().min(1),headings:I(yse)}).loose(),xse=L({docName:N().min(1),rewrites:P().int().nonnegative()}).loose();L({kind:z([`file`,`folder`,`asset`]),fromPath:N().min(1),toPath:N().min(1),...V$,summary:H$}).loose();var Sse=L({renamed:I(pse),renamedAssets:I(mse),rewrittenDocs:I(xse).optional(),summary:z5.optional()}).loose();L({kind:z([`file`,`folder`,`asset`]),path:N().min(1),...V$}).loose();var Cse=L({deletedDocNames:I(N().min(1))}).loose();L({kind:z([`file`,`folder`,`asset`]),path:N().min(1),...V$,summary:H$}).loose();var wse=L({deletedDocNames:I(N().min(1))}).loose();L({docName:N().min(1),commitSha:N().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:H$,...V$}).loose(),L({restoredFrom:N().min(1),timestamp:N().min(1),summary:z5.optional(),warning:B5.optional(),warnings:W5.optional()}).loose();var Tse=/^#[0-9a-fA-F]{6}$/,Ese=L(Object.fromEntries(Od.map(e=>[e,N().regex(Tse,`must be a #rrggbb hex color`)]))),_7=N().min(1).refine(Md,{message:`must contain a non-whitespace character`}),v7=L({name:_7,author:_7.optional(),variant:z([`dark`,`light`]),palette:Ese}).loose(),Dse=L({name:N().min(1),scheme:v7,stem:N().min(1).optional(),extension:z([`.yaml`,`.yml`]).optional()}).loose(),Ose=L({id:N().min(1),filename:N().min(1)}).loose(),kse=L({id:N().min(1),scheme:v7}).loose(),Ase=L({id:N().min(1),filename:N().min(1)}).loose(),jse=lo(`existed`,[L({existed:B(!1)}).loose(),L({existed:B(!0),filename:N().min(1),scheme:v7}).loose()]),Mse=L({themes:I(lo(`ok`,[L({ok:B(!0),id:N().min(1),filename:N().min(1),scheme:v7}),L({ok:B(!1),filename:N().min(1),id:N().min(1).optional(),code:N().min(1),conflictingFilenames:I(N().min(1)).min(2).optional()})])),truncated:F()}).loose(),Nse=z([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),Pse=L({label:N().min(1),webUrl:Ma().nullable()}).loose(),Fse=lo(`checkStatus`,[L({checkStatus:B(`allowed`)}).loose(),L({checkStatus:B(`denied`),deniedReason:z([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`])}).loose(),L({checkStatus:B(`unknown`),unknownError:z([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),y7=z([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),Ise=z(wu),Lse=z([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]);L({state:Nse,lastSyncUtc:N().nullable(),lastFetchUtc:N().nullable(),lastPushedSha:N().nullable(),ahead:P().int().min(0),behind:P().int().min(0),consecutiveFailures:P().int().min(0),conflictCount:P().int().min(0),hasRemote:F(),syncEnabled:F(),identityUnresolved:F(),remote:Pse.nullable().optional(),pushError:N().optional(),pushErrorCode:y7.optional(),pullError:N().optional(),pullErrorCode:y7.optional(),pausedReason:N().optional(),pushPermission:Fse.optional(),syncMode:Ise.optional(),lastPullUtc:N().nullable().optional(),lastPullOutcome:Lse.nullable().optional()}).loose(),L({op:z([`sync`,`push`,`pull`]).optional()}).loose(),L({op:z([`sync`,`push`,`pull`])}).loose(),L({conflicts:I(L({file:N().min(1),detectedAt:N().min(1),oursSha:N().optional(),theirsSha:N().optional(),baseSha:N().optional()}).loose())}).loose(),L({file:N().min(1),strategy:z([`mine`,`theirs`,`content`,`delete`]),content:N().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),L({}).loose(),L({file:N().min(1),base:N(),ours:N(),theirs:N(),kind:z([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:N().nullable()}).loose(),L({plan:Vo(e=>e!==void 0,{message:`plan is required`})}).loose(),L({plan:Vo(e=>e!==void 0,{message:`plan is required`})}).loose(),L({result:Vo(e=>e!==void 0,{message:`result is required`})}).loose();var Rse=L({path:N().min(1),summary:N().min(1)}).loose(),zse=L({files:P().int().nonnegative(),folders:P().int().nonnegative()}).loose();L({packs:I(L({id:N().min(1),name:N().min(1),description:N().min(1),defaultSubfolder:N().optional(),folders:I(Rse),entryCounts:zse}).loose())}).loose(),L({noOpen:F().optional(),out:N().min(1).optional()}).loose();var Bse=L({reason:z([`unsupported-platform`,`spawn-error`]),message:N()}).loose();lo(`status`,[L({status:B(`installed`),outputPath:N(),size:P().int().nonnegative(),sha256:N(),skillVersion:N()}).loose(),L({status:B(`built`),outputPath:N(),size:P().int().nonnegative(),sha256:N(),skillVersion:N(),handoffError:Bse.optional()}).loose(),L({status:B(`failed`),buildError:N()}).loose(),L({status:B(`skip-current`),skillVersion:N(),recordedAt:N().optional()}).loose()]);var b7=z(Yp);function Vse(e){return e===`agents`||Yp.includes(e)}L({tags:I(L({name:N().min(1),count:P().int().nonnegative(),isLeaf:F()}).loose())}).loose();var Hse=L({docName:N().min(1),title:N(),matchingTags:I(N().min(1)),snippet:N().nullable()}).loose();L({name:N().min(1),docs:I(Hse)}).loose(),L({folder:to(),frontmatter_local:mo(N(),to()).nullable()}).loose(),L({path:N(),frontmatter:mo(N(),to()).optional()}).loose(),L({applied:to()}).loose();var x7=mo(N(),to()).meta({description:`Free-form frontmatter map embedded in template payloads.`});L({template:L({name:N().min(1),folder:N(),scope:z([`local`,`inherited`]),path:N().min(1),frontmatter:x7,body:N()}).strict()}).strict();var Use=L({templates:I(L({name:N().min(1),title:N().optional(),description:N().optional(),path:N().min(1),source_folder:N()}).strict()),truncated:F()}).strict();L({folder:N(),name:N(),body:N().optional(),frontmatter:x7.optional(),...V$,summary:H$}).strict(),L({path:N().min(1),created:F(),warnings:I(N())}).strict(),L({sourcePath:N().min(1),targetFolder:N(),name:N().optional(),title:N().optional(),deleteSource:F().optional(),...V$,summary:H$}).strict(),L({path:N().min(1),created:F(),warnings:I(N())}).strict(),L({existed:F(),path:N().min(1)}).strict(),L({fromFolder:N(),fromName:N(),toFolder:N(),toName:N(),body:N().optional(),frontmatter:x7.optional(),...V$,summary:H$}).strict(),L({from:N().min(1),to:N().min(1),committed:F()}).strict();var S7=z(xp),Wse=/^[a-z0-9-]+$/,Gse=/^[A-Za-z0-9_-]+$/,C7=L({name:N(),description:N()}).strict();L({skill:L({name:N().min(1),scope:S7,path:N().min(1),frontmatter:C7,body:N(),files:I(L({path:N().min(1),text:N().nullable()})).optional(),managed:F().optional()}).strict()}).strict();var Kse=L({source:N().min(1),publisher:N().optional(),skill:N().optional(),marketplaceUrl:N().optional(),importedAt:N().min(1),autoUpdate:F().optional()}).strict(),qse=L({name:N().min(1),description:N().optional(),scope:S7,path:N().min(1),canonicalPath:N().min(1).optional(),absolutePath:N().min(1).optional(),installed:F(),hosts:I(N()),driftPaths:I(N()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:mo(N(),N()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:I(N()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:I(N()).optional(),installableEditors:I(N()).optional(),linkMode:F().optional(),customPlacements:I(L({path:N(),mode:z([`copy`,`link`])}).strict()).optional(),managed:F().optional(),origin:Kse.optional(),modified:F().optional(),revertable:F().optional(),ignored:F().optional()}).strict();L({name:N().min(1),scope:S7,apply:F().optional()}).strict(),L({line:N().min(1),gitignorePath:N().min(1),applied:F(),alreadyTracked:F().optional()}).strict();var Jse=L({skills:I(qse),truncated:F()}).strict();L({scope:S7.default(`project`),name:N().meta({description:`Managed skill name to create or update.`}),body:N().optional(),frontmatter:C7,...V$,summary:H$}).strict(),L({path:N().min(1),created:F(),warnings:I(N())}).strict(),L({scope:S7.default(`project`),name:N(),dryRun:F().optional(),setAutoUpdate:F().optional(),...V$,summary:H$}).strict(),L({name:N().min(1),updated:F(),source:N().min(1),localBody:N().optional(),upstreamBody:N().optional(),gitTracked:F().optional(),warnings:I(N())}).strict(),L({scope:S7.default(`project`),name:N(),...V$,summary:H$}).strict(),L({name:N().min(1),baselineRef:N().min(1),restoredFiles:I(N()),warnings:I(N())}).strict(),L({existed:F(),path:N().min(1)}).strict(),L({scope:S7.default(`project`),fromName:N(),toName:N(),body:N().optional(),frontmatter:C7.optional(),...V$,summary:H$}).strict(),L({from:N().min(1),to:N().min(1),committed:F()}).strict(),L({name:N(),fromScope:S7,toScope:S7,...V$,summary:H$}).strict(),L({scope:S7,path:N().optional()}).strict(),L({scope:S7,name:N(),toName:N(),...V$,summary:H$}).strict(),L({name:N().min(1)}).strict(),L({name:N(),home:N().min(1)}).strict(),L({docName:N().min(1)}).strict();var w7=z([`reference`,`script`,`file`]);L({scope:S7.default(`project`),name:N(),path:N().min(1),content:N(),...V$,summary:H$}).strict(),L({path:N().min(1),created:F(),kind:w7,content:F()}).strict(),L({scope:S7.default(`project`),name:N(),from:N().min(1),to:N().min(1),...V$,summary:H$}).strict(),L({from:N().min(1),to:N().min(1),fromDocName:N().optional(),toDocName:N().optional()}).strict(),L({path:N().min(1),kind:w7,text:N()}).strict(),L({path:N().min(1),existed:F(),kind:w7}).strict();var T7=so([b7,B(`agents`)]),E7=N().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),D7=so([T7,E7]);L({scope:S7.default(`project`),name:N(),targets:I(T7).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:I(D7).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:I(D7).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:z([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:D7.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:F().optional(),setSource:N().min(1).optional(),place:L({dir:N().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:z([`copy`,`link`])}).strict().optional(),convert:L({target:D7.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:z([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:L({path:N().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...V$,summary:H$,fork:L({editor:N().min(1),action:z([`align`,`make-source`,`rename`]),toName:N().optional()}).strict().optional()}).strict().refine(e=>!(e.targets!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>!(e.source!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"}),L({name:N().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:I(N()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:F().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:I(N()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:I(z([`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`])).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:N().optional(),sourceMovedTo:N().optional()}).strict(),L({scope:S7.default(`project`),name:N().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),L({name:N().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:F().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict();var Yse=L({targets:I(b7),configured:F(),folders:I(L({scope:S7,host:N(),root:N(),state:z([`own`,`linked`,`linked-parent`,`absent`]),target:N().optional(),drift:B(!0).optional(),expected:N().optional()}).strict()).optional()}).strict();L({folderAction:lo(`action`,[L({action:B(`link`),scope:S7,root:N().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:N().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}).strict(),L({action:B(`unlink`),scope:S7,root:N().min(1).meta({description:`The linked folder to materialize back.`}),exclude:I(N().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),L({action:B(`add-root`),scope:S7,root:E7.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict()])}).strict(),L({targets:I(b7),reprojected:I(L({name:N(),hosts:I(N())}).strict()),bundleHosts:I(N()),removedFrom:I(N()),folder:L({moved:I(N()),dropped:I(N()),linked:I(N())}).strict().optional()}).strict(),L({scope:S7.default(`project`),name:N(),version:N().regex(/^[0-9a-f]{40}$/i),...V$,summary:H$}).strict(),L({name:N().min(1),version:N(),restoredFiles:I(N()),warnings:I(N())}).strict(),L({query:N().optional(),intent:z([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:z([`navigation`,`relevance`]).optional(),scopes:I(z([`page`,`folder`,`content`,`file`])).optional(),scope:N().optional(),limit:P().int().nonnegative().optional(),semantic:F().optional(),source:z([`omnibar`,`mcp`,`http`]).optional()}).loose();var Xse=L({kind:z([`page`,`folder`,`content`,`file`]),path:N().min(1),title:N(),score:P(),signals:mo(N(),to()),snippet:N().optional()}).loose(),Zse=L({capable:F(),applied:F(),coverage:L({embedded:P().int().nonnegative(),total:P().int().nonnegative()})}).loose();L({enabled:F(),keyPresent:F(),keyNotRequired:F(),keySource:z([`project`,`file`,`env`]).nullable(),keyHint:N().nullable(),ready:F(),capable:F(),embedded:P().int().nonnegative(),total:P().int().nonnegative()}).loose(),L({query:N(),intent:z([`autocomplete`,`full_text`,`omnibar`]),results:I(Xse),elapsedMs:P().nonnegative(),semantic:Zse.optional(),truncated:F().optional(),ready:F().optional()}).loose();var Qse=L({version:N().min(1),recordedAt:N().min(1)}).loose();L({currentVersion:N().min(1),targets:mo(N(),Qse.nullable())}).loose(),L({scope:S7.default(`project`),source:N().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:N().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:F().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),marketplace:F().optional().meta({description:"The source came from a skills.sh listing the user chose (the Explore tab), so the install is reported to skills.sh and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...V$,summary:H$}).strict(),L({scope:S7.default(`project`),source:N().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:I(N().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:F().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),marketplace:F().optional().meta({description:"The source came from a skills.sh listing the user chose (a marketplace plugin bundle), so the import is reported to skills.sh as one batched install event and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...V$,summary:H$}).strict(),L({results:I(L({requested:N(),status:z([`imported`,`already-imported`,`not-found`,`failed`]),name:N().optional(),collisionRenamedFrom:N().optional(),warnings:I(N()),error:N().optional()}).loose()),imported:P(),alreadyImported:P(),failed:P()}).loose();var $se=L({source:N(),ref:N().optional(),contentHash:N(),publisher:N().optional()}).loose();L({name:N().min(1).meta({description:`Managed skill name created or matched.`}),path:N().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:F().meta({description:`True when this request created new source files.`}),alreadyImported:F().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:N().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:$se,warnings:I(N()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`})}).loose();var ece=`server-info`,tce=`branch-switched`,nce=`disk-ack`,rce=`config-validation-rejected`,ice=`config-ignore-nested-error`,O7=z([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`,`local-targets`]),ace=L({v:B(1),ch:B(ece),seq:P(),serverInstanceId:N().min(1),currentBranch:N().min(1).optional()}).loose(),oce=L({v:B(1),ch:B(tce),seq:P(),branch:N().min(1)}).loose(),sce=L({v:B(1),ch:O7,seq:P()}).loose(),cce=L({v:B(1),ch:B(nce),seq:P(),docName:N().min(1),sv:N().min(1)}).loose(),lce=L({v:B(1),ch:B(rce),seq:P(),docName:N().min(1),error:ap}).loose(),uce=L({v:B(1),ch:B(ice),seq:P(),path:N().min(1),error:N().min(1)}).loose();function dce(e){let t;try{t=new URL(e)}catch{return null}let n=t.pathname.match(/^\/video\/(\d+)/);if(n)return n[1]??null;let r=t.pathname.match(/^\/(\d+)/);return r?r[1]??null:null}function fce(e){if(typeof e!=`string`||e.length===0)return e;let t=x2(e);if(t){let e=t.noCookie?`www.youtube-nocookie.com`:`www.youtube.com`,n=t.startSeconds===null?``:`?start=${t.startSeconds}`;return`https://${e}/embed/${t.id}${n}`}if(g2(e)){let t=dce(e);return t?`https://player.vimeo.com/video/${t}`:e}let n=p2(e);if(n){let e=n.startRaw===null?``:`?t=${n.startRaw}`;return`https://www.loom.com/embed/${n.id}${e}`}return e}var pce=`https://api.github.com/repos/inkeep/open-knowledge`;async function mce(e){let{signal:t,...n}=e??{},r=t?AbortSignal.any([AbortSignal.timeout(5e3),t]):AbortSignal.timeout(5e3);try{let e=await fetch(pce,{headers:{accept:`application/vnd.github+json`,"user-agent":`openknowledge.ai`},...n,signal:r});if(!e.ok)return console.warn(`[github-stars] GitHub API responded ${e.status}`),null;let t=await e.json();return typeof t.stargazers_count==`number`?t.stargazers_count:null}catch(e){return console.warn(`[github-stars] fetch failed: ${e instanceof Error?e.message:String(e)}`),null}}function hce(e){if(!e)return{height:null,viewerFragment:``};let t=e.split(`&`).filter(e=>e.length>0),n=null,r=[];for(let e of t){let t=e.indexOf(`=`);if(t===-1){r.push(e);continue}let i=e.slice(0,t),a=e.slice(t+1);if(i===`height`){let e=Number.parseInt(a,10);!Number.isNaN(e)&&e>0&&(n=e);continue}r.push(e)}return{height:n,viewerFragment:r.join(`&`)}}new iY.default;var gce=L({path:I(so([N(),P()])),message:N(),issueCode:N()});lo(`code`,[L({code:B(`SCHEMA_INVALID`),issues:I(gce)}),L({code:B(`WRITE_ERROR`),detail:N()})]);function _ce(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}function vce(e){if(e.code!==`SCHEMA_INVALID`)return{};let t={};for(let n of e.issues){let e=n.path[0];typeof e==`string`&&(t[e]=t[e]?`${t[e]}; ${n.message}`:n.message)}return t}var k7=/^---[ \t]*\r?\n---[ \t]*(\r?\n|$)/,yce=/^---([ \t]*)(?=\r?\n|$)/,A7=e=>e.includes(`\r
|
|
571
571
|
`)?`\r
|
|
572
572
|
`:`
|
|
573
|
-
`,bce=e=>e.replace(yce,`***$1`),j7=e=>`---${e}${e}---${e}`;function M7(e,t){let n=om(e,t);return{md:n,frontmatter:n.slice(0,n.length-t.length)}}function N7(e,t){let{md:n,frontmatter:r}=M7(e,t),i=am(n);return i.frontmatter===r&&i.body===t}function P7(e,t,n,r){let{md:i,frontmatter:a}=M7(t,n);return{md:i,frontmatter:a,body:n,adjusted:r===`none`&&a!==e?`frontmatter`:r}}function xce(e,t){if(N7(e,t))return P7(e,e,t,`none`);let n=bce(t);if(n!==t&&N7(e,n))return P7(e,e,n,`body`);if(k7.test(e)){let n=j7(A7(e));if(N7(n,t))return P7(e,n,t,`frontmatter`)}return P7(e,e,t,`unresolved`)}function Sce(e,t){if(N7(e,t))return P7(e,e,t,`none`);let n=j7(A7(e||t));return(e===``||k7.test(e))&&N7(n,t)?P7(e,n,t,`frontmatter`):P7(e,e,t,`unresolved`)}var F7=65536;function I7(e){let t=e.match(rm);return t?{fenced:t[0],body:e.slice(t[0].length)}:{fenced:``,body:e}}function Cce(e){if(e.trim()===``)return{doc:new ul({}),map:{}};let t;try{t=xu(e,{uniqueKeys:!1})}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new ul({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=_m.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function L7(e){return e===``?{doc:new ul({}),map:{}}:Cce(sm(e))}function R7(e){let{fenced:t}=I7(e),{map:n,parseError:r}=L7(t);return{map:n??{},parseError:r}}function z7(e){let{fenced:t}=I7(e);if(t===``)return[];let{doc:n,map:r}=L7(t);return r===null?[]:U7(n)}function B7(e){return typeof e==`object`&&!!e&&`key`in e}function V7(e){let t=e.key;return typeof t==`string`?t:t&&typeof t==`object`&&`value`in t&&typeof t.value==`string`?t.value:null}function H7(e,t){let n=e.key;if(typeof n==`string`){e.key=t;return}if(n&&typeof n==`object`){n.value=t;return}e.key=t}function U7(e){let t=e.contents;if(!t||!(`items`in t)||!Array.isArray(t.items))return[];let n=[];for(let e of t.items){if(!B7(e))continue;let t=V7(e);t!==null&&n.push(t)}return n}function W7(e){if(e.contents==null||!(`items`in e.contents)){let t=e.createNode({});return e.contents=t,t}return e.contents}function wce(e){let t=e.contents;return!t||!(`items`in t)||(t.items?.length??0)===0?``:Tm(e.toString(xm))}function Tce(e){let t=new TextEncoder().encode(e).byteLength;return t>65536?{kind:`region_too_large`,bytes:t,limit:F7}:null}function G7(e){let t=wce(e),n=Tce(t);return n?{ok:!1,error:n}:{ok:!0,nextFenced:t}}function Ece(e,t){if(Object.hasOwn(t,`frontmatter`))return{ok:!1,error:{kind:`reserved_key`,key:cm}};let{doc:n,map:r}=L7(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{W7(n);for(let[e,r]of Object.entries(t)){if(r===null){n.delete(e);continue}let t=fm.safeParse(r);if(!t.success)return{ok:!1,error:{kind:`invalid_value`,key:e,reason:t.error.issues[0]?.message??`invalid value`}};n.set(e,wm(n,n.get(e,!0),t.data))}return G7(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Dce(e,t,n,r={}){if(t===`frontmatter`||n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:cm}};let{doc:i,map:a}=L7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};if(t===n)return{ok:!0,nextFenced:e};let o=i.contents;if(!o||!(`items`in o)||!Array.isArray(o.items))return{ok:!1,error:{kind:`unknown_key`,key:t}};let s=o.items.find(e=>B7(e)&&V7(e)===t);if(!s)return{ok:!1,error:{kind:`unknown_key`,key:t}};if(!r.allowDuplicate&&o.items.some(e=>B7(e)&&e!==s&&V7(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return H7(s,n),G7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function K7(e,t){let{doc:n,map:r}=L7(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let i=n.contents;if(!i||!(`items`in i)||!Array.isArray(i.items))return{ok:!0,nextFenced:e};let a=U7(n);if(a.length!==t.length||!q7(a,t))return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};try{let e=i.items.filter(B7),r=[];for(let n of t){let i=e.findIndex(e=>V7(e)===n);if(i===-1)return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};let[o]=e.splice(i,1);o&&r.push(o)}return i.items=r,G7(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function q7(e,t){let n=new Map;for(let t of e)n.set(t,(n.get(t)??0)+1);for(let e of t){let t=(n.get(e)??0)-1;if(t<0)return!1;n.set(e,t)}for(let e of n.values())if(e!==0)return!1;return!0}function J7(e){if(e.length===0)return{kind:`invalid_path`,path:[...e],reason:`path must have at least one segment`};for(let t=0;t<e.length;t++){let n=e[t];if(typeof n!=`string`&&typeof n!=`number`)return{kind:`invalid_path`,path:[...e],reason:`path segment at index ${t} must be string or number`};if(typeof n==`number`&&(!Number.isInteger(n)||n<0))return{kind:`invalid_path`,path:[...e],reason:`numeric path segment at index ${t} must be a non-negative integer`}}return e[0]===`frontmatter`?{kind:`reserved_key`,key:cm}:null}function Oce(e,t,n){let r=J7(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=L7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=fm.safeParse(n);if(!o.success)return{ok:!1,error:{kind:`invalid_value`,key:String(t[t.length-1]),reason:o.error.issues[0]?.message??`invalid value`}};try{return W7(i),i.setIn(t,wm(i,i.getIn(t,!0),o.data)),G7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function kce(e,t){let n=J7(t);if(n)return{ok:!1,error:n};let{doc:r,map:i}=L7(e);if(i===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{return r.getIn(t,!0)===void 0?{ok:!0,nextFenced:e}:(r.deleteIn(t),G7(r))}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Ace(e,t){if(t.length===0){let t=e.contents;return ts(t)?t:null}let n=e.getIn(t,!0);return ts(n)?n:null}function jce(e,t,n,r={}){let i=J7(t);if(i)return{ok:!1,error:i};let a=t[t.length-1];if(typeof a!=`string`)return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot rename: last path segment must be a string (map key)`}};if(t.length===1&&n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:cm}};let{doc:o,map:s}=L7(e);if(s===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};if(a===n)return{ok:!0,nextFenced:e};let c=Ace(o,t.slice(0,-1));if(!c)return{ok:!1,error:{kind:`unknown_key`,key:a}};let l=c.items.find(e=>B7(e)&&V7(e)===a);if(!l)return{ok:!1,error:{kind:`unknown_key`,key:a}};if(!r.allowDuplicate&&c.items.some(e=>B7(e)&&e!==l&&V7(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return H7(l,n),G7(o)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Mce(e,t,n){if(t.length===0)return K7(e,n);let r=J7(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=L7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!ts(o))return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot reorder: target is not a map`}};let s=[];for(let e of o.items){if(!B7(e))continue;let t=V7(e);t!==null&&s.push(t)}if(s.length!==n.length||!q7(s,n))return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};try{let e=o.items.filter(B7),t=[];for(let r of n){let i=e.findIndex(e=>V7(e)===r);if(i===-1)return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};let[a]=e.splice(i,1);a&&t.push(a)}return o.items=t,G7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Nce(e,t,n){let r=J7(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=L7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!is(o))return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot reorder: target is not a sequence`}};let s=o,c=s.items.length,l=Array.from({length:c},(e,t)=>t),u=[...n];if(!Pce(u,c))return{ok:!1,error:{kind:`reorder_mismatch`,expected:l.map(String),got:u.map(String)}};try{let e=s.items.slice();return s.items=u.map(t=>e[t]),G7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Pce(e,t){if(e.length!==t)return!1;let n=Array(t).fill(!1);for(let r of e){if(!Number.isInteger(r)||r<0||r>=t||n[r])return!1;n[r]=!0}return!0}var Fce=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});function Y7(e){return{ok:!1,error:e}}function Ice(e){return{ok:!0,...e}}function Lce(e){return{ok:!0,...e}}function Rce(e){return{ok:!0,...e}}function X7(e){return{ok:!0,...e}}function Z7(e){switch(e.kind){case`unknown_key`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`unknown key '${e.key}'`,issueCode:`unknown_key`}]};case`duplicate_target`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`key '${e.key}' already exists`,issueCode:`duplicate_target`}]};case`invalid_value`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:e.reason,issueCode:`invalid_value`}]};case`reserved_key`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`'${e.key}' is a reserved frontmatter key`,issueCode:`reserved_key`}]};case`reorder_mismatch`:return{code:`WRITE_ERROR`,detail:`reorder list does not match current keys (state changed mid-drag)`};case`region_too_large`:return{code:`SCHEMA_INVALID`,issues:[{path:[],message:`Frontmatter region exceeds ${F7}-byte limit (would be ${e.bytes})`,issueCode:`region_too_large`}]};case`parse_failed`:return{code:`WRITE_ERROR`,detail:`Frontmatter YAML is malformed; fix in source mode to commit (${e.reason})`};case`invalid_path`:return{code:`SCHEMA_INVALID`,issues:[{path:[...e.path],message:e.reason,issueCode:`invalid_path`}]}}}function zce(e,t){if(e.parseError!==t.parseError||e.keys.length!==t.keys.length)return!1;for(let n=0;n<e.keys.length;n++)if(e.keys[n]!==t.keys[n])return!1;for(let n of e.keys)if(!bm(e.map[n],t.map[n]))return!1;return!0}var Bce=5;function Q7(e){let t=e.toString();return{snapshot:Vce(t),raw:t}}function Vce(e){let{map:t,parseError:n}=R7(e);return{map:t,keys:z7(e),parseError:n}}function $7(e){return e.startsWith(`---`)}function Hce(e){let t=e.document,n=t.getText(`source`),r=new Set,i=Q7(n),a=i.snapshot,o=I7(i.raw).fenced,s=$7(i.raw),c=!1;function l(e=!1){if(c)return;let t,i;try{let e=Q7(n);t=e.snapshot,i=e.raw}catch(e){console.warn(`[bindFrontmatterDoc] readSnapshotFromYText threw:`,e);return}if(!e&&zce(a,t)){s=$7(i);return}a=t,o=I7(i).fenced,s=$7(i);for(let e of r)try{e(t)}catch(e){console.warn(`[bindFrontmatterDoc] listener threw:`,e)}}let u=e=>{c||Uce(e,o.length,s)&&l()};n.observe(u),e.on(`synced`,d);function d(){l(!0)}function f(e){let r;return t.transact(()=>{let t=n.toString(),{fenced:i}=I7(t);if(r=e(i),!r.ok||r.nextFenced===i)return;let a=Sce(r.nextFenced,t.slice(i.length)).frontmatter;n.delete(0,i.length),a!==``&&n.insert(0,a)},Fce),r??{ok:!1,error:{kind:`parse_failed`,reason:`commit transact produced no result`}}}function p(e){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});if(Object.hasOwn(e,`frontmatter`))return Y7({code:`SCHEMA_INVALID`,issues:[{path:[cm],message:`'${cm}' is a reserved frontmatter key`,issueCode:`reserved_key`}]});let t=vm.safeParse(e);if(!t.success)return Y7({code:`SCHEMA_INVALID`,issues:t.error.issues.map(_ce)});let n=t.data,r=Object.keys(n),i=f(e=>Ece(e,n));return i.ok?Ice({appliedKeys:r}):Y7(Z7(i.error))}function m(e,t,n={}){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>Dce(r,e,t,n));return r.ok?Lce({oldKey:e,newKey:t}):Y7(Z7(r.error))}function h(e){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>K7(t,e));return t.ok?Rce({orderedKeys:[...e]}):Y7(Z7(t.error))}function g(e,t){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>Oce(n,e,t));return n.ok?X7({path:[...e]}):Y7(Z7(n.error))}function _(e){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>kce(t,e));return t.ok?X7({path:[...e]}):Y7(Z7(t.error))}function v(e,t,n={}){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>jce(r,e,t,n));return r.ok?X7({path:[...e]}):Y7(Z7(r.error))}function y(e,t){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>Mce(n,e,t));return n.ok?X7({path:[...e]}):Y7(Z7(n.error))}function b(e,t){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>Nce(n,e,t));return n.ok?X7({path:[...e]}):Y7(Z7(n.error))}return{current(){return Q7(n).snapshot},patch(e){return p(e)},rename(e,t,n){return m(e,t,n)},reorder(e){return h(e)},patchPath(e,t){return g(e,t)},deletePath(e){return _(e)},renamePath(e,t,n){return v(e,t,n)},reorderPath(e,t){return y(e,t)},reorderSeqPath(e,t){return b(e,t)},subscribe(e){return r.add(e),()=>{r.delete(e)}},dispose(){c||(c=!0,n.unobserve(u),e.off(`synced`,d),r.clear())}}}function Uce(e,t,n){if(t===0&&n)return!0;let r=t>0?t:Bce,i=0;for(let t of e.delta){if(typeof t.retain==`number`){i+=t.retain;continue}if(typeof t.insert==`string`){if(i<r)return!0;i+=t.insert.length;continue}if(t.insert!==void 0){if(i<r)return!0;i+=1;continue}if(typeof t.delete==`number`&&i<r)return!0}return!1}function Wce(e,t){if(e===``)return{slot:``,body:t};let n=t.match(/^\r?\n/);return n?{slot:n[0],body:t.slice(n[0].length)}:{slot:``,body:t}}function e9(e){let{frontmatter:t,body:n}=am(e);if(t===``)return y1(e);let r=Wce(t,n).body;return/^\n*$/.test(r)?y1(e):y1(r)}var Gce=new iY.default;Gce.Match_Threshold=.5;var Kce=/\\([!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~])/g,t9=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/,n9=/^[ \t]+([-+*]|\d+[.)]|[a-zA-Z][.)])\s/,qce=/^\d+([.)])(?=\s)/,Jce=`1`,Yce=/\*\*\s*(`[^`]+`)\s*\*\*/g,Xce=/^(`{3,}|~{3,})/;function Zce(e){let t=new Set,n=null;for(let r=0;r<e.length;r++){let i=e[r].trimEnd(),a=Xce.exec(i);if(a){let e=a[1][0];if(n===null){n=e;continue}if(n===e){n=null;continue}}if(n!==null||r===0||!t9.test(i))continue;let o=e[r-1].trimEnd();if(!(!o.startsWith(`|`)||t9.test(o))){t.add(r-1),t.add(r);for(let n=r+1;n<e.length&&e[n].trimEnd().startsWith(`|`);n++)t.add(n)}}return t}function r9(e){return e.slice(0,-1).trimEnd()}var i9=/^(?:#{1,6}[ \t]|>|(?:[-+*]|\d{1,9}[.)])[ \t]|`{3,}|~{3,}|=+[ \t]*$|-+[ \t]*$|(?:\*[ \t]*){3,}$|(?:_[ \t]*){3,}$)/;function a9(e){let t=new Set,n=null;for(let r=0;r<e.length;r++){let i=e[r]??``,a=/^(`{3,}|~{3,})/.exec(i.trimStart());if(a?.[1]){let e=a[1][0];if(n===null){n=e;continue}if(n===e){n=null;continue}}n!==null&&t.add(r)}return t}var Qce=/^<\/?[A-Z][A-Za-z0-9.]*(?:\s[^>]*)?>$/,$ce=/^<[A-Z][A-Za-z0-9.]*(?:\s[^>]*)?>$/,ele=/^<\/[A-Z][A-Za-z0-9.]*\s*>$/,tle=/<\/?[A-Z]/;function nle(e){let t=!1;for(let n=0;n<e.length;n++)if(tle.test(e[n]??``)){t=!0;break}if(!t)return e;let n=a9(e),r=[],i=[],a=0;for(let t=0;t<e.length;t++){let o=e[t]??``,s=o.trim();if(n.has(t)){r.push(!1),i.push(a);continue}let c=a>=1||!/^[ \t]/.test(o);r.push(c&&Qce.test(s));let l=c&&ele.test(s),u=c&&!l&&$ce.test(s)&&!s.endsWith(`/>`);l?(a=Math.max(0,a-1),i.push(a)):(i.push(a),u&&(a+=1))}let o=Array(e.length);for(let t=0,n=-1;t<e.length;t++)o[t]=n,(e[t]??``).trim()!==``&&(n=t);let s=Array(e.length);for(let t=e.length-1,n=e.length;t>=0;t--)s[t]=n,(e[t]??``).trim()!==``&&(n=t);let c=new Set;for(let t=0;t<e.length;t++){if((e[t]??``).trim()!==``||n.has(t)||(i[t]??0)<1)continue;let a=o[t]??-1,l=s[t]??e.length;(a>=0&&r[a]===!0||l<e.length&&r[l]===!0)&&c.add(t)}let l=[];for(let t=0;t<e.length;t++){if(c.has(t))continue;let n=e[t]??``;l.push(r[t]===!0&&(i[t]??0)>=1?n.replace(/^[ \t]+/,``):n)}return l}function rle(e){let t=nle(e.replace(/^/,``).replace(/\r/g,``).replace(Kce,`$1`).replace(Yce,`$1`).replace(/^\n+/,``).replace(/^[*-]{3,}(?=\n|$)/,`---`).replace(/(\n)([#>+-]|\d+[.)]|`{3,}|~{3,})/g,`
|
|
573
|
+
`,bce=e=>e.replace(yce,`***$1`),j7=e=>`---${e}${e}---${e}`;function M7(e,t){let n=sm(e,t);return{md:n,frontmatter:n.slice(0,n.length-t.length)}}function N7(e,t){let{md:n,frontmatter:r}=M7(e,t),i=om(n);return i.frontmatter===r&&i.body===t}function P7(e,t,n,r){let{md:i,frontmatter:a}=M7(t,n);return{md:i,frontmatter:a,body:n,adjusted:r===`none`&&a!==e?`frontmatter`:r}}function xce(e,t){if(N7(e,t))return P7(e,e,t,`none`);let n=bce(t);if(n!==t&&N7(e,n))return P7(e,e,n,`body`);if(k7.test(e)){let n=j7(A7(e));if(N7(n,t))return P7(e,n,t,`frontmatter`)}return P7(e,e,t,`unresolved`)}function Sce(e,t){if(N7(e,t))return P7(e,e,t,`none`);let n=j7(A7(e||t));return(e===``||k7.test(e))&&N7(n,t)?P7(e,n,t,`frontmatter`):P7(e,e,t,`unresolved`)}var F7=65536;function I7(e){let t=e.match(im);return t?{fenced:t[0],body:e.slice(t[0].length)}:{fenced:``,body:e}}function Cce(e){if(e.trim()===``)return{doc:new dl({}),map:{}};let t;try{t=Su(e,{uniqueKeys:!1})}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new dl({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=vm.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function L7(e){return e===``?{doc:new dl({}),map:{}}:Cce(cm(e))}function R7(e){let{fenced:t}=I7(e),{map:n,parseError:r}=L7(t);return{map:n??{},parseError:r}}function z7(e){let{fenced:t}=I7(e);if(t===``)return[];let{doc:n,map:r}=L7(t);return r===null?[]:U7(n)}function B7(e){return typeof e==`object`&&!!e&&`key`in e}function V7(e){let t=e.key;return typeof t==`string`?t:t&&typeof t==`object`&&`value`in t&&typeof t.value==`string`?t.value:null}function H7(e,t){let n=e.key;if(typeof n==`string`){e.key=t;return}if(n&&typeof n==`object`){n.value=t;return}e.key=t}function U7(e){let t=e.contents;if(!t||!(`items`in t)||!Array.isArray(t.items))return[];let n=[];for(let e of t.items){if(!B7(e))continue;let t=V7(e);t!==null&&n.push(t)}return n}function W7(e){if(e.contents==null||!(`items`in e.contents)){let t=e.createNode({});return e.contents=t,t}return e.contents}function wce(e){let t=e.contents;return!t||!(`items`in t)||(t.items?.length??0)===0?``:Em(e.toString(Sm))}function Tce(e){let t=new TextEncoder().encode(e).byteLength;return t>65536?{kind:`region_too_large`,bytes:t,limit:F7}:null}function G7(e){let t=wce(e),n=Tce(t);return n?{ok:!1,error:n}:{ok:!0,nextFenced:t}}function Ece(e,t){if(Object.hasOwn(t,`frontmatter`))return{ok:!1,error:{kind:`reserved_key`,key:lm}};let{doc:n,map:r}=L7(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{W7(n);for(let[e,r]of Object.entries(t)){if(r===null){n.delete(e);continue}let t=pm.safeParse(r);if(!t.success)return{ok:!1,error:{kind:`invalid_value`,key:e,reason:t.error.issues[0]?.message??`invalid value`}};n.set(e,Tm(n,n.get(e,!0),t.data))}return G7(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Dce(e,t,n,r={}){if(t===`frontmatter`||n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:lm}};let{doc:i,map:a}=L7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};if(t===n)return{ok:!0,nextFenced:e};let o=i.contents;if(!o||!(`items`in o)||!Array.isArray(o.items))return{ok:!1,error:{kind:`unknown_key`,key:t}};let s=o.items.find(e=>B7(e)&&V7(e)===t);if(!s)return{ok:!1,error:{kind:`unknown_key`,key:t}};if(!r.allowDuplicate&&o.items.some(e=>B7(e)&&e!==s&&V7(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return H7(s,n),G7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function K7(e,t){let{doc:n,map:r}=L7(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let i=n.contents;if(!i||!(`items`in i)||!Array.isArray(i.items))return{ok:!0,nextFenced:e};let a=U7(n);if(a.length!==t.length||!q7(a,t))return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};try{let e=i.items.filter(B7),r=[];for(let n of t){let i=e.findIndex(e=>V7(e)===n);if(i===-1)return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};let[o]=e.splice(i,1);o&&r.push(o)}return i.items=r,G7(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function q7(e,t){let n=new Map;for(let t of e)n.set(t,(n.get(t)??0)+1);for(let e of t){let t=(n.get(e)??0)-1;if(t<0)return!1;n.set(e,t)}for(let e of n.values())if(e!==0)return!1;return!0}function J7(e){if(e.length===0)return{kind:`invalid_path`,path:[...e],reason:`path must have at least one segment`};for(let t=0;t<e.length;t++){let n=e[t];if(typeof n!=`string`&&typeof n!=`number`)return{kind:`invalid_path`,path:[...e],reason:`path segment at index ${t} must be string or number`};if(typeof n==`number`&&(!Number.isInteger(n)||n<0))return{kind:`invalid_path`,path:[...e],reason:`numeric path segment at index ${t} must be a non-negative integer`}}return e[0]===`frontmatter`?{kind:`reserved_key`,key:lm}:null}function Oce(e,t,n){let r=J7(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=L7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=pm.safeParse(n);if(!o.success)return{ok:!1,error:{kind:`invalid_value`,key:String(t[t.length-1]),reason:o.error.issues[0]?.message??`invalid value`}};try{return W7(i),i.setIn(t,Tm(i,i.getIn(t,!0),o.data)),G7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function kce(e,t){let n=J7(t);if(n)return{ok:!1,error:n};let{doc:r,map:i}=L7(e);if(i===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{return r.getIn(t,!0)===void 0?{ok:!0,nextFenced:e}:(r.deleteIn(t),G7(r))}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Ace(e,t){if(t.length===0){let t=e.contents;return ts(t)?t:null}let n=e.getIn(t,!0);return ts(n)?n:null}function jce(e,t,n,r={}){let i=J7(t);if(i)return{ok:!1,error:i};let a=t[t.length-1];if(typeof a!=`string`)return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot rename: last path segment must be a string (map key)`}};if(t.length===1&&n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:lm}};let{doc:o,map:s}=L7(e);if(s===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};if(a===n)return{ok:!0,nextFenced:e};let c=Ace(o,t.slice(0,-1));if(!c)return{ok:!1,error:{kind:`unknown_key`,key:a}};let l=c.items.find(e=>B7(e)&&V7(e)===a);if(!l)return{ok:!1,error:{kind:`unknown_key`,key:a}};if(!r.allowDuplicate&&c.items.some(e=>B7(e)&&e!==l&&V7(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return H7(l,n),G7(o)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Mce(e,t,n){if(t.length===0)return K7(e,n);let r=J7(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=L7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!ts(o))return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot reorder: target is not a map`}};let s=[];for(let e of o.items){if(!B7(e))continue;let t=V7(e);t!==null&&s.push(t)}if(s.length!==n.length||!q7(s,n))return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};try{let e=o.items.filter(B7),t=[];for(let r of n){let i=e.findIndex(e=>V7(e)===r);if(i===-1)return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};let[a]=e.splice(i,1);a&&t.push(a)}return o.items=t,G7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Nce(e,t,n){let r=J7(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=L7(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!is(o))return{ok:!1,error:{kind:`invalid_path`,path:[...t],reason:`cannot reorder: target is not a sequence`}};let s=o,c=s.items.length,l=Array.from({length:c},(e,t)=>t),u=[...n];if(!Pce(u,c))return{ok:!1,error:{kind:`reorder_mismatch`,expected:l.map(String),got:u.map(String)}};try{let e=s.items.slice();return s.items=u.map(t=>e[t]),G7(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function Pce(e,t){if(e.length!==t)return!1;let n=Array(t).fill(!1);for(let r of e){if(!Number.isInteger(r)||r<0||r>=t||n[r])return!1;n[r]=!0}return!0}var Fce=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});function Y7(e){return{ok:!1,error:e}}function Ice(e){return{ok:!0,...e}}function Lce(e){return{ok:!0,...e}}function Rce(e){return{ok:!0,...e}}function X7(e){return{ok:!0,...e}}function Z7(e){switch(e.kind){case`unknown_key`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`unknown key '${e.key}'`,issueCode:`unknown_key`}]};case`duplicate_target`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`key '${e.key}' already exists`,issueCode:`duplicate_target`}]};case`invalid_value`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:e.reason,issueCode:`invalid_value`}]};case`reserved_key`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`'${e.key}' is a reserved frontmatter key`,issueCode:`reserved_key`}]};case`reorder_mismatch`:return{code:`WRITE_ERROR`,detail:`reorder list does not match current keys (state changed mid-drag)`};case`region_too_large`:return{code:`SCHEMA_INVALID`,issues:[{path:[],message:`Frontmatter region exceeds ${F7}-byte limit (would be ${e.bytes})`,issueCode:`region_too_large`}]};case`parse_failed`:return{code:`WRITE_ERROR`,detail:`Frontmatter YAML is malformed; fix in source mode to commit (${e.reason})`};case`invalid_path`:return{code:`SCHEMA_INVALID`,issues:[{path:[...e.path],message:e.reason,issueCode:`invalid_path`}]}}}function zce(e,t){if(e.parseError!==t.parseError||e.keys.length!==t.keys.length)return!1;for(let n=0;n<e.keys.length;n++)if(e.keys[n]!==t.keys[n])return!1;for(let n of e.keys)if(!xm(e.map[n],t.map[n]))return!1;return!0}var Bce=5;function Q7(e){let t=e.toString();return{snapshot:Vce(t),raw:t}}function Vce(e){let{map:t,parseError:n}=R7(e);return{map:t,keys:z7(e),parseError:n}}function $7(e){return e.startsWith(`---`)}function Hce(e){let t=e.document,n=t.getText(`source`),r=new Set,i=Q7(n),a=i.snapshot,o=I7(i.raw).fenced,s=$7(i.raw),c=!1;function l(e=!1){if(c)return;let t,i;try{let e=Q7(n);t=e.snapshot,i=e.raw}catch(e){console.warn(`[bindFrontmatterDoc] readSnapshotFromYText threw:`,e);return}if(!e&&zce(a,t)){s=$7(i);return}a=t,o=I7(i).fenced,s=$7(i);for(let e of r)try{e(t)}catch(e){console.warn(`[bindFrontmatterDoc] listener threw:`,e)}}let u=e=>{c||Uce(e,o.length,s)&&l()};n.observe(u),e.on(`synced`,d);function d(){l(!0)}function f(e){let r;return t.transact(()=>{let t=n.toString(),{fenced:i}=I7(t);if(r=e(i),!r.ok||r.nextFenced===i)return;let a=Sce(r.nextFenced,t.slice(i.length)).frontmatter;n.delete(0,i.length),a!==``&&n.insert(0,a)},Fce),r??{ok:!1,error:{kind:`parse_failed`,reason:`commit transact produced no result`}}}function p(e){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});if(Object.hasOwn(e,`frontmatter`))return Y7({code:`SCHEMA_INVALID`,issues:[{path:[lm],message:`'${lm}' is a reserved frontmatter key`,issueCode:`reserved_key`}]});let t=ym.safeParse(e);if(!t.success)return Y7({code:`SCHEMA_INVALID`,issues:t.error.issues.map(_ce)});let n=t.data,r=Object.keys(n),i=f(e=>Ece(e,n));return i.ok?Ice({appliedKeys:r}):Y7(Z7(i.error))}function m(e,t,n={}){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>Dce(r,e,t,n));return r.ok?Lce({oldKey:e,newKey:t}):Y7(Z7(r.error))}function h(e){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>K7(t,e));return t.ok?Rce({orderedKeys:[...e]}):Y7(Z7(t.error))}function g(e,t){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>Oce(n,e,t));return n.ok?X7({path:[...e]}):Y7(Z7(n.error))}function _(e){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>kce(t,e));return t.ok?X7({path:[...e]}):Y7(Z7(t.error))}function v(e,t,n={}){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>jce(r,e,t,n));return r.ok?X7({path:[...e]}):Y7(Z7(r.error))}function y(e,t){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>Mce(n,e,t));return n.ok?X7({path:[...e]}):Y7(Z7(n.error))}function b(e,t){if(c)return Y7({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>Nce(n,e,t));return n.ok?X7({path:[...e]}):Y7(Z7(n.error))}return{current(){return Q7(n).snapshot},patch(e){return p(e)},rename(e,t,n){return m(e,t,n)},reorder(e){return h(e)},patchPath(e,t){return g(e,t)},deletePath(e){return _(e)},renamePath(e,t,n){return v(e,t,n)},reorderPath(e,t){return y(e,t)},reorderSeqPath(e,t){return b(e,t)},subscribe(e){return r.add(e),()=>{r.delete(e)}},dispose(){c||(c=!0,n.unobserve(u),e.off(`synced`,d),r.clear())}}}function Uce(e,t,n){if(t===0&&n)return!0;let r=t>0?t:Bce,i=0;for(let t of e.delta){if(typeof t.retain==`number`){i+=t.retain;continue}if(typeof t.insert==`string`){if(i<r)return!0;i+=t.insert.length;continue}if(t.insert!==void 0){if(i<r)return!0;i+=1;continue}if(typeof t.delete==`number`&&i<r)return!0}return!1}function Wce(e,t){if(e===``)return{slot:``,body:t};let n=t.match(/^\r?\n/);return n?{slot:n[0],body:t.slice(n[0].length)}:{slot:``,body:t}}function e9(e){let{frontmatter:t,body:n}=om(e);if(t===``)return y1(e);let r=Wce(t,n).body;return/^\n*$/.test(r)?y1(e):y1(r)}var Gce=new iY.default;Gce.Match_Threshold=.5;var Kce=/\\([!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~])/g,t9=/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/,n9=/^[ \t]+([-+*]|\d+[.)]|[a-zA-Z][.)])\s/,qce=/^\d+([.)])(?=\s)/,Jce=`1`,Yce=/\*\*\s*(`[^`]+`)\s*\*\*/g,Xce=/^(`{3,}|~{3,})/;function Zce(e){let t=new Set,n=null;for(let r=0;r<e.length;r++){let i=e[r].trimEnd(),a=Xce.exec(i);if(a){let e=a[1][0];if(n===null){n=e;continue}if(n===e){n=null;continue}}if(n!==null||r===0||!t9.test(i))continue;let o=e[r-1].trimEnd();if(!(!o.startsWith(`|`)||t9.test(o))){t.add(r-1),t.add(r);for(let n=r+1;n<e.length&&e[n].trimEnd().startsWith(`|`);n++)t.add(n)}}return t}function r9(e){return e.slice(0,-1).trimEnd()}var i9=/^(?:#{1,6}[ \t]|>|(?:[-+*]|\d{1,9}[.)])[ \t]|`{3,}|~{3,}|=+[ \t]*$|-+[ \t]*$|(?:\*[ \t]*){3,}$|(?:_[ \t]*){3,}$)/;function a9(e){let t=new Set,n=null;for(let r=0;r<e.length;r++){let i=e[r]??``,a=/^(`{3,}|~{3,})/.exec(i.trimStart());if(a?.[1]){let e=a[1][0];if(n===null){n=e;continue}if(n===e){n=null;continue}}n!==null&&t.add(r)}return t}var Qce=/^<\/?[A-Z][A-Za-z0-9.]*(?:\s[^>]*)?>$/,$ce=/^<[A-Z][A-Za-z0-9.]*(?:\s[^>]*)?>$/,ele=/^<\/[A-Z][A-Za-z0-9.]*\s*>$/,tle=/<\/?[A-Z]/;function nle(e){let t=!1;for(let n=0;n<e.length;n++)if(tle.test(e[n]??``)){t=!0;break}if(!t)return e;let n=a9(e),r=[],i=[],a=0;for(let t=0;t<e.length;t++){let o=e[t]??``,s=o.trim();if(n.has(t)){r.push(!1),i.push(a);continue}let c=a>=1||!/^[ \t]/.test(o);r.push(c&&Qce.test(s));let l=c&&ele.test(s),u=c&&!l&&$ce.test(s)&&!s.endsWith(`/>`);l?(a=Math.max(0,a-1),i.push(a)):(i.push(a),u&&(a+=1))}let o=Array(e.length);for(let t=0,n=-1;t<e.length;t++)o[t]=n,(e[t]??``).trim()!==``&&(n=t);let s=Array(e.length);for(let t=e.length-1,n=e.length;t>=0;t--)s[t]=n,(e[t]??``).trim()!==``&&(n=t);let c=new Set;for(let t=0;t<e.length;t++){if((e[t]??``).trim()!==``||n.has(t)||(i[t]??0)<1)continue;let a=o[t]??-1,l=s[t]??e.length;(a>=0&&r[a]===!0||l<e.length&&r[l]===!0)&&c.add(t)}let l=[];for(let t=0;t<e.length;t++){if(c.has(t))continue;let n=e[t]??``;l.push(r[t]===!0&&(i[t]??0)>=1?n.replace(/^[ \t]+/,``):n)}return l}function rle(e){let t=nle(e.replace(/^/,``).replace(/\r/g,``).replace(Kce,`$1`).replace(Yce,`$1`).replace(/^\n+/,``).replace(/^[*-]{3,}(?=\n|$)/,`---`).replace(/(\n)([#>+-]|\d+[.)]|`{3,}|~{3,})/g,`
|
|
574
574
|
|
|
575
575
|
$2`).replace(/^([#>+-].*|\d+[.)].*|`{3,}.*|~{3,}.*|<\/[A-Z][A-Za-z0-9]*>[ \t]*)\n([^\n])/gm,`$1
|
|
576
576
|
|
|
@@ -578,4 +578,4 @@ $2`).split(`
|
|
|
578
578
|
`)),n=Zce(t),r=a9(t);return t.map((e,i)=>{let a=e.trimEnd();if(i>0&&!r.has(i)&&/^[ \t]+\S/.test(a)&&(t[i-1]??``).trim()!==``&&!n9.test(a)&&!i9.test(a.trimStart())){let e=(t[i-1]??``).trimStart();if(!i9.test(e)&&!e.startsWith(`|`))return a.replace(/^[ \t]+/,``)}if(t9.test(a)){let e=a.replace(/\s+/g,``);return n.has(i)&&e.length>1&&e.startsWith(`|`)&&e.endsWith(`|`)?r9(e):e}let o=n9.test(a)?a.replace(/^[ \t]+/,``):a;return n.has(i)&&o.length>1&&o.startsWith(`|`)&&o.endsWith(`|`)&&(o=r9(o)),o.replace(qce,`${Jce}$1`)}).join(`
|
|
579
579
|
`).replace(/\n{3,}/g,`
|
|
580
580
|
|
|
581
|
-
`).replace(/\n+$/,``)}function o9(e){return[...e.replace(/^\n+/,``).replace(/\n+$/,``).matchAll(/\n{2,}/g)].map(e=>e[0].length)}function ile(e,t){let n=e9(e),r=e9(t);if(r.leading>n.leading||r.trailing>n.trailing)return!0;let i=o9(am(e).body),a=o9(am(t).body);return i.length===a.length?a.some((e,t)=>e>(i[t]??0)):!1}var s9=/^[a-zA-Z0-9][\w/-]*$/;function ale(e){if(typeof e!=`string`)return!1;let t=e.startsWith(`#`)?e.slice(1):e;return s9.test(t)}var ole=`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`;function sle(e){return e.startsWith(`#`)?e.slice(1):e}function cle(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function lle(e){if(!e||e.trim()===``)return[];let{map:t}=Sm(e);if(!t)return[];let n=cle(t.tags),r=[];for(let e of n){let t=sle(e);s9.test(t)&&r.push(t)}return r}var ule=z(bp),dle=R({hosts:I(N()),scope:ule,scripts:F(),installedAt:ta(),projection:z([`symlink`,`copy`]).optional(),contentHash:N().optional()});R({schema:B(1),skills:mo(N(),dle).default({})});var fle=100,ple=500,mle=450,hle={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},c9=new WeakMap;function gle(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function l9(e){return e.trim().toLowerCase()}var _le=/\.(?:md|mdx)$/;function vle(e,t){if(t!==`page`)return e;let n=e.replace(_le,``);return n.length>0?n:e}function u9(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function yle(e){let t=u9(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}var d9=/[^\P{L}a-zàèéìòóù]|[^\P{Nd}0-9]|\p{Nl}/iu,f9=(()=>{let e=globalThis.Intl.Segmenter;return e?new e(`en`,{granularity:`word`}):null})();function ble(){let e=eJ({language:`english`}),t=e.tokenize.bind(e);return e.tokenize=(e,n,r,i)=>{let a=t(e,n,r,i);if(!f9||typeof e!=`string`||!d9.test(e))return a;let o=new Set(a);for(let{segment:t,isWordLike:n}of f9.segment(e)){if(!n||!d9.test(t))continue;let e=t.toLowerCase();o.has(e)||(o.add(e),a.push(e))}return a},e}function p9(e){let t=mJ({schema:hle,components:{tokenizer:ble()}});return e.length>0&&TJ(t,e),t}function xle(e){let t={documents:e};return c9.set(t,p9(e)),t}function Sle(e){let t=c9.get(e);if(t)return t;let n=p9(e.documents);return c9.set(e,n),n}function Cle(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function m9(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function wle(e,t){let n=l9(t);if(!n)return 0;let r=vle(n,e.kind),i=l9(e.title),a=l9(e.name),o=l9(e.path),s=o.split(`/`);return i===r||a===r?700:o===r?650:i.startsWith(r)||a.startsWith(r)?600:s.some(e=>e.startsWith(r))?550:i.includes(r)||a.includes(r)?500:o.includes(r)?450:-1}var Tle=.5;function h9(e,t){let n=wle(e,t);return n<=0?n:L$(e.path)?n*Tle:n}var Ele=60;function Dle(e){return e===`file`?-Ele:0}var Ole=1e3,g9=50,kle=1,Ale=1,jle=.001;function Mle(e,t,n,r,i){let a=i>0?t/i:0,o=g9>0?n/g9:0,s=r===`file`?-jle:0,c=kle*a+Ale*o+s;return e*Ole+c}function _9(e,t,n,r){return e+t*20+n+Dle(r)}function v9(e,t,n,r,i,a){return e===`relevance`?_9(t,n,r,i):Mle(t,n,r,i,a)}function Nle(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function y9(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function Ple(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function Fle(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function Ile(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}var Lle=/[-ក- -〿-ゟ゠-ヿ㐀-䶿一-鿿\uf900--\u1100-\u11ff\u3130-\u318f\ua960-\ua97f\uac00-\ud7ff]/;function Rle(e,t){let n=l9(t);return n.length<4||Lle.test(n)?0:+(e===`full_text`)}function zle(e){let{lexical:t,fullText:n}=e.signals;return t>=ple?`lexical`:t===mle&&n<=0?`pathOnly`:`body`}function Ble(e){let t=[],n=[],r=[];for(let i of e){let e=zle(i);e===`lexical`?t.length<fle&&t.push(i):e===`body`?n.length<6&&n.push(i):r.length<4&&r.push(i)}return[...t,...n,...r]}function b9(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=Ble(e),i=[],a=0,o=0;for(let e of r){if(e.document.kind===`folder`){if(a>=3)continue;a+=1}else if(e.document.kind===`file`){if(o>=3)continue;o+=1}if(i.push(e),i.length>=n)break}return i}function Vle(e,t,n={}){let r=n.intent??`omnibar`,i=Nle(r,n.ranking),a=gle(n.limit),o=new Set(n.scopes??Cle(r)),s=e.documents.filter(e=>m9(e,o)),c=l9(t);if(!c)return s.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,a).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let l=tY(Sle(e),{term:c,properties:Fle(r),boost:Ile(r),tolerance:Rle(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>m9(e.document,o)).map(e=>[e.document.id,e.score])),d=Ple(s),f=new Map;for(let e of s)h9(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)m9(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=y9(f.values(),u);return b9([...f.values()].map(t=>{let n=Math.max(0,h9(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:v9(i,n,r,a,t.kind,e),signals:{lexical:n,fullText:r,recency:a}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score),i,a)}return b9(Hle({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function x9(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function Hle(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,ranking:o,semantic:s}=e,c=s.rrfK??60,l=s.candidateLimit??64,u=s.similarityFloor??0,d=s.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=y9(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,h9(e,a)),n=r.get(e.id)??0,s=i.get(e.id)??0,c=d.get(e.id),l=c!==void 0&&c>=u;return{document:e,score:t>0?v9(o,t,n,s,e.kind,m):_9(t,n,s,e.kind),signals:l?{lexical:t,fullText:n,recency:s,vector:c}:{lexical:t,fullText:n,recency:s},lexical:t,fullText:n,recency:s,cosine:c}}),g=x9(h.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=x9(h.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),v=e=>{let t=0,n=g.get(e);n!==void 0&&(t+=1/(c+n));let r=_.get(e);return r!==void 0&&(t+=1/(c+r)),t};return h.sort((e,t)=>{let n=+(e.lexical>0),r=+(t.lexical>0);if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=v(e.document.id),a=v(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n}))}function Ule(e){return`https://${e.host}/${e.owner}/${e.repo}.git`}function Wle(e,t){return!e||e.length===0?`true`:t.detached?`detached`:t.currentBranch===null||t.currentBranch===e?`true`:`false`}var S9=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),C9=globalThis;C9[S9]===void 0&&(C9[S9]=wr());var w9=C9[S9],T9=R({version:N().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(w9,{description:`Recorded skill version for this target.`}),recordedAt:ta().register(w9,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:z([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(w9,{description:`Install-source surface that recorded this entry.`}).optional()}),Gle=R({enabled:F().register(w9,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:ta().register(w9,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});R({schema:B(1).register(w9,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:R({"claude-cowork":T9.optional(),"cli-hosts":T9.optional()}).register(w9,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:mo(N(),Gle).register(w9,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:I(N()).register(w9,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});var E9=`bottom`,D9=e=>e*8+4,O9=D9(92),k9=D9(40);function Kle(e){return e===`right`||e===`bottom`?e:E9}function qle(e){return typeof e!=`number`||!Number.isFinite(e)?O9:Math.max(k9,Math.round(e))}var Jle=new Set([`(connected)`,`(agent thread)`]);function Yle(e){return e!=null&&Jle.has(e)}var A9=class extends Error{chunksCompleted;totalChunks;bytesWritten;bytesRemaining;cause;constructor(e,t){let n=e instanceof Error?e.message:typeof e==`string`?e:`unknown error`;super(`chunked insert failed after ${t.chunksCompleted}/${t.totalChunks} chunks (${t.bytesWritten} bytes written, ${t.bytesRemaining} bytes lost): ${n}`),this.name=`ChunkedInsertError`,this.chunksCompleted=t.chunksCompleted,this.totalChunks=t.totalChunks,this.bytesWritten=t.bytesWritten,this.bytesRemaining=t.bytesRemaining,this.cause=e}};async function Xle(e,t,n,r,i={}){let a=i.thresholdBytes??512e3,o=i.chunkSizeBytes??51200,s=i.origin,c=i.yieldFn??Zle,l=i.resolveOffset??(e=>e);if(r.length<=a){e.transact(()=>{t.insert(n,r)},s);return}let u=Math.ceil(r.length/o),d=0,f=n,p=0,m=0;for(;d<r.length;){let n=Math.min(d+o,r.length),i=r.slice(d,n);try{let n=l(f);e.transact(()=>{t.insert(n,i)},s)}catch(e){throw new A9(e,{chunksCompleted:p,totalChunks:u,bytesWritten:m,bytesRemaining:r.length-d})}p++,m+=i.length,f+=i.length,d=n,d<r.length&&await c()}}function Zle(){return new Promise(e=>{let t=globalThis;t.document?.hidden!==!0&&typeof t.requestAnimationFrame==`function`?t.requestAnimationFrame(()=>e()):setTimeout(()=>e(),0)})}var Qle=/^(#{1,6})\s+(.+)$/;function $le(e,t){let n=(e.endsWith(`\r`)?e.slice(0,-1):e).match(Qle);if(!n)return null;let r=n[2].trim(),i=$5(r,t);return i?{level:n[1].length,text:r,slug:i}:null}var eue=Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));function j9(){let e=globalThis.crypto;if(e&&typeof e.randomUUID==`function`)return e.randomUUID();let t=new Uint8Array(16);if(e&&typeof e.getRandomValues==`function`)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=eue;return`${n[t[0]]}${n[t[1]]}${n[t[2]]}${n[t[3]]}-${n[t[4]]}${n[t[5]]}-${n[t[6]]}${n[t[7]]}-${n[t[8]]}${n[t[9]]}-${n[t[10]]}${n[t[11]]}${n[t[12]]}${n[t[13]]}${n[t[14]]}${n[t[15]]}`}var tue=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],nue={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`},rue={cursor:`#FFFFFF`,windsurf:`#FFFFFF`},M9=[`#f0ece3`,`#fff5e1`,`#f9e1db`,`#f5def7`,`#ece2fb`,`#dce8fa`,`#DBF3FB`];function iue(e,t=tue){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}function aue(e){let t=e.trim();if(!t)return`?`;let n=t.split(/[-\s]+/).filter(Boolean);if(!n.length)return`?`;if(n.length>=2)return n.slice(0,2).map(e=>e[0]??``).join(``).toUpperCase();let r=n[0],i=[r[0]];for(let e=1;e<r.length&&i.length<2;e++){let t=r[e-1],n=r[e];t===t.toLowerCase()&&n===n.toUpperCase()&&n!==n.toLowerCase()&&i.push(n)}return i.length>=2?i.join(``).toUpperCase():r.slice(0,2).toUpperCase()}function oue(e){let t=e.trim();if(!t)return e;if(t.includes(` `)||!/[-_]/.test(t))return t;let n=t.split(/[-_]+/).filter(Boolean);return n.length?n.map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `):t}var N9={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`,"claude-acp":`claude`,"codex-acp":`openai`,"github-copilot-cli":`github`};function sue(e){return e?N9[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}function cue(e){let t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2;if(i===a)return[0,0,o*100];let s=i-a,c=o>.5?s/(2-i-a):s/(i+a),l;return l=i===t?((n-r)/s+(n<r?6:0))/6:i===n?((r-t)/s+2)/6:((t-n)/s+4)/6,[l*360,c*100,o*100]}function lue(e,t,n){let r=t/100,i=n/100,a=r*Math.min(i,1-i),o=t=>{let n=(t+e/30)%12,r=i-a*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*r).toString(16).padStart(2,`0`)};return`#${o(0)}${o(8)}${o(4)}`}function uue(e){let[t]=cue(e);return lue(t,45,32)}var due=[`Curious`,`Brave`,`Clever`,`Swift`,`Gentle`,`Bright`,`Wise`,`Bold`,`Calm`,`Keen`],fue=[`Bird`,`Cat`,`Dog`,`Fish`,`Mouse`,`Rabbit`,`Shrimp`,`Snail`,`Squirrel`,`Turtle`],P9=`ok-user-name-v3`,F9=`ok-user-color-v3`;function I9(e){return e[Math.floor(Math.random()*e.length)]}function pue(){return`${I9(due)} ${I9(fue)}`}function mue(){return I9(M9)}function L9(e){try{return localStorage.getItem(e)}catch{return null}}function R9(e,t){try{localStorage.setItem(e,t)}catch{}}function hue(){let e=new URLSearchParams(window.location.search).get(`coeditor`)||`standalone`,t=j9(),n=L9(P9),r=L9(F9);return n||(n=pue(),R9(P9,n)),r||(r=mue(),R9(F9,r)),{name:n,color:r,coeditor:e,tabId:t}}function gue(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}function _ue(e){throw Error(`Unhandled ClassifiedLinkTarget variant: ${JSON.stringify(e)}`)}var z9=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function B9(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function V9(e){return e.split(`/`).filter(Boolean)}function H9(e){let t=e.trim();return z9.test(t)||t.startsWith(`//`)}function vue(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(H9(n))return{kind:`external`,url:n};let r=n.indexOf(`#`),i=r<0?n:n.slice(0,r),a=jp(i,t);if(a)return{kind:`doc`,docName:a,anchor:r<0?null:n.slice(r+1)};let o=Ap(i,t);if(o)return{kind:`doc`,docName:o,anchor:r<0?null:n.slice(r+1)};let s=gue(n,t);if(s)return{kind:`doc`,docName:s.docName,anchor:s.anchor};let c=B9(n);return c&&c!==`md`&&c!==`mdx`?{kind:`asset`,url:n,ext:c}:null}function yue(e,t){let n=e.trim();if(!n)return null;if(H9(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=B9(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function bue(e,t){let n=e.trim();if(!n||z9.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function xue(e,t,n=null,r=`.md`){let i=V9(e);i.pop();let a=V9(t),o=0;for(;o<i.length&&o<a.length&&i[o]===a[o];)o+=1;let s=i.slice(o).map(()=>`..`),c=a.slice(o),l=[...s,...c].join(`/`);return l||=a.at(-1)??t,!l.startsWith(`./`)&&!l.startsWith(`../`)&&(l=`./${l}`),`${l}${r}${n?`#${n}`:``}`}function Sue(e){return e.replace(/[/\\:*?"<>|\0]/g,`-`).replace(/\s+/g,` `).replace(/-+/g,`-`).trim().replace(/^[-.\s]+|[-.\s]+$/g,``)}function U9(e){return`pagesBySlug`in e}function W9(e){return U9(e)?e.pages:e}function G9(e,t){return U9(e)?e.assetPaths??new Set:t??new Set}function K9(e,t){return U9(e)?e.filePaths??new Set:t??new Set}function q9(e,t){return e<t?-1:+(e>t)}function Cue(e,t){let n=new Map;for(let r of e){let e=t(r);e&&!n.has(e)&&n.set(e,r)}return n}function wue(e,t){let n=new Map,r=[...e].sort(q9);for(let e of r){let r=e.lastIndexOf(`/`),i=t(r===-1?e:e.slice(r+1));i&&!n.has(i)&&n.set(i,e)}return n}function J9(e,t){let n=Q5(e);if(n){if(U9(t))return t.pagesBySlug.get(n);for(let e of t)if(Q5(e)===n)return e}}function Y9(e,t){if(e.includes(`/`))return;let n=Q5(e);if(!n)return;if(U9(t))return t.pagesByBasename?.get(n);let r;for(let e of t){let t=e.lastIndexOf(`/`);Q5(t===-1?e:e.slice(t+1))===n&&(r===void 0||q9(e,r)<0)&&(r=e)}return r}function X9(e){let t=e.trim();if(!t)return[];let n=Q5(t);return n.length>0&&n!==t?[n]:[]}function Z9(e,t){let n=e.trim();if(!n)return;let r=W9(t);if(r.has(n))return n;let i=J9(n,t);if(i)return i;for(let e of X9(n))if(r.has(e))return e;return Q9(n,r)||Y9(n,t)}function Q9(e,t){let n=`${e}/index`;if(t.has(n))return n;let r=e.lastIndexOf(`/`),i=r===-1?e:e.slice(r+1),a=i?`${e}/${i}`:null;if(a&&t.has(a))return a}function Tue(e){let t=((e.trim().split(`#`)[0]??``).trim().split(`?`)[0]??``).trim();return t.startsWith(`/`)?t.slice(1):t}function $9(e,t,n){let r=Tue(e);if(!r)return null;let i=r.toLowerCase(),a=n?[t,n]:[t];for(let e of a){if(e.has(r))return r;for(let t of e)if(t.toLowerCase()===i)return t}if(r.includes(`/`))return null;let o=[];for(let e of a)for(let t of e){let e=t.lastIndexOf(`/`);(e===-1?t:t.slice(e+1)).toLowerCase()===i&&o.push(t)}return o.length===0?null:o.sort(q9)[0]??null}function Eue(e,t,n,r){let i=e.trim();if(!i)return!1;if($9(i,G9(t,n),K9(t,r)))return!0;let a=W9(t);return a.has(i)||X9(i).some(e=>a.has(e))||J9(i,t)!==void 0||Q9(i,a)?!0:Y9(i,t)!==void 0}function Due(e,t,n){let r=yue(e,t);return r===null||r.kind!==`asset`||$9(r.url,G9(n),K9(n))!==null||Z9(e,n)===void 0?r:{kind:`doc`,docName:e.trim(),anchor:t?.trim()||null}}export{Uae as $,bp as $a,TE as $i,EX as $n,lf as $o,s5 as $r,u1 as $t,O7 as A,K as Aa,cae as Ai,b$ as An,ed as Ao,PX as Ar,L as As,Dse as At,M9 as B,W as Ba,rj as Bi,UQ as Bn,Td as Bo,Eue as Br,e1 as Bt,gse as C,wS as Ca,Vle as Ci,lY as Cn,Ip as Co,o4 as Cr,pf as Cs,eoe as Ct,NX as D,v_ as Da,SQ as Di,EY as Dn,Vp as Do,s4 as Dr,F as Ds,pZ as Dt,E9 as E,h_ as Ea,gQ as Ei,iue as En,Ep as Eo,n4 as Er,I as Es,dZ as Et,TX as F,xg as Fa,_1 as Fi,qQ as Fn,If as Fo,Fae as Fr,Mse as Ft,cZ as G,mp as Ga,Ak as Gi,E8 as Gn,bd as Go,ioe as Gr,AQ as Gt,tse as H,Zp as Ha,aj as Hi,aue as Hn,$u as Ho,Vse as Hr,Yse as Ht,ole as I,Jg as Ia,e7 as Ii,j$ as In,rd as Io,zX as Ir,o1 as It,MX as J,Gp as Ja,Qte as Ji,yle as Jn,id as Jo,woe as Jr,rQ as Jt,lZ as K,gp as Ka,jk as Ki,Z2 as Kn,$d as Ko,p1 as Kr,jQ as Kt,s9 as L,Qh as La,BQ as Li,v$ as Ln,Df as Lo,Yle as Lr,K$ as Lt,Roe as M,fg as Ma,Vae as Mi,JQ as Mn,Cd as Mo,Zae as Mr,Ot as Ms,v7 as Mt,Loe as N,vg as Na,Q5 as Ni,GQ as Nn,Dd as No,L$ as Nr,At as Ns,kse as Nt,Cse as O,G as Oa,NQ as Oi,DY as On,sm as Oo,c4 as Or,Oa as Os,Wse as Ot,_se as P,Sg as Pa,yY as Pi,M$ as Pn,Od as Po,m2 as Pr,Ct as Ps,Ase as Pt,$oe as Q,im as Qa,Jw as Qi,bY as Qn,Bu as Qo,rle as Qr,GX as Qt,Woe as R,U as Ra,u9 as Ri,KQ as Rn,Of as Ro,I$ as Rr,Z$ as Rt,Foe as S,Wx as Sa,mY as Si,vue as Sn,Lp as So,u4 as Sr,hf as Ss,hY as St,Nae as T,q as Ta,g1 as Ti,eZ as Tn,am as To,a4 as Tr,Wo as Ts,Sse as Tt,w8 as U,Wp as Ua,Ek as Ui,oX as Un,Yu as Uo,ale as Ur,Jse as Ut,b0 as V,Vm as Va,oj as Vi,xce as Vn,Uu as Vo,mZ as Vr,b7 as Vt,oZ as W,_p as Wa,hk as Wi,roe as Wn,xd as Wo,g2 as Wr,Gse as Wt,yZ as X,Xp as Xa,VT as Xi,LX as Xn,zd as Xo,bX as Xr,wse as Xt,R5 as Y,Kp as Ya,nE as Yi,uue as Yn,Nd as Yo,k0 as Yr,Use as Yt,qoe as Z,qp as Za,wT as Zi,noe as Zn,Nf as Zo,$X as Zr,KX as Zt,xY as _,Zw as _a,Z9 as _i,xue as _n,Up as _o,sue as _r,Ud as _s,Poe as _t,dY as a,iw as aa,hce as ai,ile as an,pp as ao,tZ as ar,Wu as as,kZ as at,qX as b,LS as ba,Sue as bi,Xle as bn,Hp as bo,r4 as br,Vf as bs,Moe as bt,oce as c,_w as ca,x2 as ci,pX as cn,Sp as co,b5 as cr,Au as cs,HX as ct,sce as d,kw as da,z7 as di,vQ as dn,wp as do,$5 as dr,yd as ds,ese as dt,EE as ea,lQ as ei,Jae as en,$p as eo,pQ as er,Pu as es,Yae as et,cce as f,Yw as fa,R7 as fi,MQ as fn,ym as fo,hue as fr,Hd as fs,O9 as ft,sY as g,gw as ga,Due as gi,Cue as gn,Fp as go,O0 as gr,df as gs,vse as gt,OX as h,dC as ha,$9 as hi,wue as hn,Tp as ho,DX as hr,Bd as hs,bse as ht,use as i,rw as ia,p2 as ii,Zoe as in,em as io,eX as ir,Md as is,Qie as it,g7 as j,_g as ja,sZ as ji,YQ as jn,Qu as jo,H9 as jr,N as js,Ose as jt,Noe as k,Xg as ka,_Q as ki,k5 as kn,Gu as ko,vZ as kr,B as ks,jse as kt,uce as l,Ew as la,j9 as li,Hce as ln,bm as lo,oue as lr,ku as ls,VX as lt,kX as m,PC as ma,h1 as mi,xQ as mn,nm as mo,dQ as mr,Pf as ms,WX as mt,rue as n,tw as na,Kle as ni,fQ as nn,cm as no,lle as nr,Nu as ns,X5 as nt,Voe as o,Pw as oa,vY as oi,kre as on,Fm as oo,$ae as or,ap as os,VQ as ot,ace as p,dE as pa,bue as pi,yQ as pn,xp as po,X9 as pr,Iu as ps,UX as pt,uZ as q,hp as qa,vk as qi,xle as qn,Xu as qo,Doe as qr,FX as qt,lse as r,uE as ra,qle as ri,hQ as rn,Yp as ro,vce as rr,cp as rs,k9 as rt,Boe as s,Fw as sa,uQ as si,_ue as sn,Cp as so,aae as sr,vd as ss,HQ as st,nue as t,CE as ta,u8 as ti,qae as tn,Qp as to,B9 as tr,yf as ts,ase as tt,lce as u,Ow as ua,d1 as ui,yX as un,hm as uo,mce as ur,Mu as us,RX as ut,AX as v,SE as va,sX as vi,PQ as vn,zp as vo,d4 as vr,gf as vs,s1 as vt,hse as w,t_ as wa,M5 as wi,uY as wn,zm as wo,l4 as wr,z as ws,AZ as wt,f7 as x,Vx as xa,$le as xi,Wle as xn,Op as xo,i4 as xr,Lu as xs,gY as xt,A9 as y,aE as ya,fce as yi,Ule as yn,Np as yo,f4 as yr,mf as ys,l1 as yt,Gae as z,fh as za,dj as zi,WQ as zn,nd as zo,hZ as zr,X$ as zt};
|
|
581
|
+
`).replace(/\n+$/,``)}function o9(e){return[...e.replace(/^\n+/,``).replace(/\n+$/,``).matchAll(/\n{2,}/g)].map(e=>e[0].length)}function ile(e,t){let n=e9(e),r=e9(t);if(r.leading>n.leading||r.trailing>n.trailing)return!0;let i=o9(om(e).body),a=o9(om(t).body);return i.length===a.length?a.some((e,t)=>e>(i[t]??0)):!1}var s9=/^[a-zA-Z0-9][\w/-]*$/;function ale(e){if(typeof e!=`string`)return!1;let t=e.startsWith(`#`)?e.slice(1):e;return s9.test(t)}var ole=`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`;function sle(e){return e.startsWith(`#`)?e.slice(1):e}function cle(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function lle(e){if(!e||e.trim()===``)return[];let{map:t}=Cm(e);if(!t)return[];let n=cle(t.tags),r=[];for(let e of n){let t=sle(e);s9.test(t)&&r.push(t)}return r}var ule=z(xp),dle=R({hosts:I(N()),scope:ule,scripts:F(),installedAt:ta(),projection:z([`symlink`,`copy`]).optional(),contentHash:N().optional()});R({schema:B(1),skills:mo(N(),dle).default({})});var fle=100,ple=500,mle=450,hle={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},c9=new WeakMap;function gle(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function l9(e){return e.trim().toLowerCase()}var _le=/\.(?:md|mdx)$/;function vle(e,t){if(t!==`page`)return e;let n=e.replace(_le,``);return n.length>0?n:e}function u9(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function yle(e){let t=u9(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}var d9=/[^\P{L}a-zàèéìòóù]|[^\P{Nd}0-9]|\p{Nl}/iu,f9=(()=>{let e=globalThis.Intl.Segmenter;return e?new e(`en`,{granularity:`word`}):null})();function ble(){let e=eJ({language:`english`}),t=e.tokenize.bind(e);return e.tokenize=(e,n,r,i)=>{let a=t(e,n,r,i);if(!f9||typeof e!=`string`||!d9.test(e))return a;let o=new Set(a);for(let{segment:t,isWordLike:n}of f9.segment(e)){if(!n||!d9.test(t))continue;let e=t.toLowerCase();o.has(e)||(o.add(e),a.push(e))}return a},e}function p9(e){let t=mJ({schema:hle,components:{tokenizer:ble()}});return e.length>0&&TJ(t,e),t}function xle(e){let t={documents:e};return c9.set(t,p9(e)),t}function Sle(e){let t=c9.get(e);if(t)return t;let n=p9(e.documents);return c9.set(e,n),n}function Cle(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function m9(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function wle(e,t){let n=l9(t);if(!n)return 0;let r=vle(n,e.kind),i=l9(e.title),a=l9(e.name),o=l9(e.path),s=o.split(`/`);return i===r||a===r?700:o===r?650:i.startsWith(r)||a.startsWith(r)?600:s.some(e=>e.startsWith(r))?550:i.includes(r)||a.includes(r)?500:o.includes(r)?450:-1}var Tle=.5;function h9(e,t){let n=wle(e,t);return n<=0?n:L$(e.path)?n*Tle:n}var Ele=60;function Dle(e){return e===`file`?-Ele:0}var Ole=1e3,g9=50,kle=1,Ale=1,jle=.001;function Mle(e,t,n,r,i){let a=i>0?t/i:0,o=g9>0?n/g9:0,s=r===`file`?-jle:0,c=kle*a+Ale*o+s;return e*Ole+c}function _9(e,t,n,r){return e+t*20+n+Dle(r)}function v9(e,t,n,r,i,a){return e===`relevance`?_9(t,n,r,i):Mle(t,n,r,i,a)}function Nle(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function y9(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function Ple(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function Fle(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function Ile(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}var Lle=/[-ក- -〿-ゟ゠-ヿ㐀-䶿一-鿿\uf900--\u1100-\u11ff\u3130-\u318f\ua960-\ua97f\uac00-\ud7ff]/;function Rle(e,t){let n=l9(t);return n.length<4||Lle.test(n)?0:+(e===`full_text`)}function zle(e){let{lexical:t,fullText:n}=e.signals;return t>=ple?`lexical`:t===mle&&n<=0?`pathOnly`:`body`}function Ble(e){let t=[],n=[],r=[];for(let i of e){let e=zle(i);e===`lexical`?t.length<fle&&t.push(i):e===`body`?n.length<6&&n.push(i):r.length<4&&r.push(i)}return[...t,...n,...r]}function b9(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=Ble(e),i=[],a=0,o=0;for(let e of r){if(e.document.kind===`folder`){if(a>=3)continue;a+=1}else if(e.document.kind===`file`){if(o>=3)continue;o+=1}if(i.push(e),i.length>=n)break}return i}function Vle(e,t,n={}){let r=n.intent??`omnibar`,i=Nle(r,n.ranking),a=gle(n.limit),o=new Set(n.scopes??Cle(r)),s=e.documents.filter(e=>m9(e,o)),c=l9(t);if(!c)return s.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,a).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let l=tY(Sle(e),{term:c,properties:Fle(r),boost:Ile(r),tolerance:Rle(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>m9(e.document,o)).map(e=>[e.document.id,e.score])),d=Ple(s),f=new Map;for(let e of s)h9(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)m9(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=y9(f.values(),u);return b9([...f.values()].map(t=>{let n=Math.max(0,h9(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:v9(i,n,r,a,t.kind,e),signals:{lexical:n,fullText:r,recency:a}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score),i,a)}return b9(Hle({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function x9(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function Hle(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,ranking:o,semantic:s}=e,c=s.rrfK??60,l=s.candidateLimit??64,u=s.similarityFloor??0,d=s.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=y9(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,h9(e,a)),n=r.get(e.id)??0,s=i.get(e.id)??0,c=d.get(e.id),l=c!==void 0&&c>=u;return{document:e,score:t>0?v9(o,t,n,s,e.kind,m):_9(t,n,s,e.kind),signals:l?{lexical:t,fullText:n,recency:s,vector:c}:{lexical:t,fullText:n,recency:s},lexical:t,fullText:n,recency:s,cosine:c}}),g=x9(h.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=x9(h.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),v=e=>{let t=0,n=g.get(e);n!==void 0&&(t+=1/(c+n));let r=_.get(e);return r!==void 0&&(t+=1/(c+r)),t};return h.sort((e,t)=>{let n=+(e.lexical>0),r=+(t.lexical>0);if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=v(e.document.id),a=v(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n}))}function Ule(e){return`https://${e.host}/${e.owner}/${e.repo}.git`}function Wle(e,t){return!e||e.length===0?`true`:t.detached?`detached`:t.currentBranch===null||t.currentBranch===e?`true`:`false`}var S9=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),C9=globalThis;C9[S9]===void 0&&(C9[S9]=Er());var w9=C9[S9],T9=R({version:N().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(w9,{description:`Recorded skill version for this target.`}),recordedAt:ta().register(w9,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:z([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(w9,{description:`Install-source surface that recorded this entry.`}).optional()}),Gle=R({enabled:F().register(w9,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:ta().register(w9,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});R({schema:B(1).register(w9,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:R({"claude-cowork":T9.optional(),"cli-hosts":T9.optional()}).register(w9,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:mo(N(),Gle).register(w9,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:I(N()).register(w9,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});var E9=`bottom`,D9=e=>e*8+4,O9=D9(92),k9=D9(40);function Kle(e){return e===`right`||e===`bottom`?e:E9}function qle(e){return typeof e!=`number`||!Number.isFinite(e)?O9:Math.max(k9,Math.round(e))}var Jle=new Set([`(connected)`,`(agent thread)`]);function Yle(e){return e!=null&&Jle.has(e)}var A9=class extends Error{chunksCompleted;totalChunks;bytesWritten;bytesRemaining;cause;constructor(e,t){let n=e instanceof Error?e.message:typeof e==`string`?e:`unknown error`;super(`chunked insert failed after ${t.chunksCompleted}/${t.totalChunks} chunks (${t.bytesWritten} bytes written, ${t.bytesRemaining} bytes lost): ${n}`),this.name=`ChunkedInsertError`,this.chunksCompleted=t.chunksCompleted,this.totalChunks=t.totalChunks,this.bytesWritten=t.bytesWritten,this.bytesRemaining=t.bytesRemaining,this.cause=e}};async function Xle(e,t,n,r,i={}){let a=i.thresholdBytes??512e3,o=i.chunkSizeBytes??51200,s=i.origin,c=i.yieldFn??Zle,l=i.resolveOffset??(e=>e);if(r.length<=a){e.transact(()=>{t.insert(n,r)},s);return}let u=Math.ceil(r.length/o),d=0,f=n,p=0,m=0;for(;d<r.length;){let n=Math.min(d+o,r.length),i=r.slice(d,n);try{let n=l(f);e.transact(()=>{t.insert(n,i)},s)}catch(e){throw new A9(e,{chunksCompleted:p,totalChunks:u,bytesWritten:m,bytesRemaining:r.length-d})}p++,m+=i.length,f+=i.length,d=n,d<r.length&&await c()}}function Zle(){return new Promise(e=>{let t=globalThis;t.document?.hidden!==!0&&typeof t.requestAnimationFrame==`function`?t.requestAnimationFrame(()=>e()):setTimeout(()=>e(),0)})}var Qle=/^(#{1,6})\s+(.+)$/;function $le(e,t){let n=(e.endsWith(`\r`)?e.slice(0,-1):e).match(Qle);if(!n)return null;let r=n[2].trim(),i=$5(r,t);return i?{level:n[1].length,text:r,slug:i}:null}var eue=Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));function j9(){let e=globalThis.crypto;if(e&&typeof e.randomUUID==`function`)return e.randomUUID();let t=new Uint8Array(16);if(e&&typeof e.getRandomValues==`function`)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=eue;return`${n[t[0]]}${n[t[1]]}${n[t[2]]}${n[t[3]]}-${n[t[4]]}${n[t[5]]}-${n[t[6]]}${n[t[7]]}-${n[t[8]]}${n[t[9]]}-${n[t[10]]}${n[t[11]]}${n[t[12]]}${n[t[13]]}${n[t[14]]}${n[t[15]]}`}var tue=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],nue={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`},rue={cursor:`#FFFFFF`,windsurf:`#FFFFFF`},M9=[`#f0ece3`,`#fff5e1`,`#f9e1db`,`#f5def7`,`#ece2fb`,`#dce8fa`,`#DBF3FB`];function iue(e,t=tue){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}function aue(e){let t=e.trim();if(!t)return`?`;let n=t.split(/[-\s]+/).filter(Boolean);if(!n.length)return`?`;if(n.length>=2)return n.slice(0,2).map(e=>e[0]??``).join(``).toUpperCase();let r=n[0],i=[r[0]];for(let e=1;e<r.length&&i.length<2;e++){let t=r[e-1],n=r[e];t===t.toLowerCase()&&n===n.toUpperCase()&&n!==n.toLowerCase()&&i.push(n)}return i.length>=2?i.join(``).toUpperCase():r.slice(0,2).toUpperCase()}function oue(e){let t=e.trim();if(!t)return e;if(t.includes(` `)||!/[-_]/.test(t))return t;let n=t.split(/[-_]+/).filter(Boolean);return n.length?n.map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `):t}var N9={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`,"claude-acp":`claude`,"codex-acp":`openai`,"github-copilot-cli":`github`};function sue(e){return e?N9[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}function cue(e){let t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2;if(i===a)return[0,0,o*100];let s=i-a,c=o>.5?s/(2-i-a):s/(i+a),l;return l=i===t?((n-r)/s+(n<r?6:0))/6:i===n?((r-t)/s+2)/6:((t-n)/s+4)/6,[l*360,c*100,o*100]}function lue(e,t,n){let r=t/100,i=n/100,a=r*Math.min(i,1-i),o=t=>{let n=(t+e/30)%12,r=i-a*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*r).toString(16).padStart(2,`0`)};return`#${o(0)}${o(8)}${o(4)}`}function uue(e){let[t]=cue(e);return lue(t,45,32)}var due=[`Curious`,`Brave`,`Clever`,`Swift`,`Gentle`,`Bright`,`Wise`,`Bold`,`Calm`,`Keen`],fue=[`Bird`,`Cat`,`Dog`,`Fish`,`Mouse`,`Rabbit`,`Shrimp`,`Snail`,`Squirrel`,`Turtle`],P9=`ok-user-name-v3`,F9=`ok-user-color-v3`;function I9(e){return e[Math.floor(Math.random()*e.length)]}function pue(){return`${I9(due)} ${I9(fue)}`}function mue(){return I9(M9)}function L9(e){try{return localStorage.getItem(e)}catch{return null}}function R9(e,t){try{localStorage.setItem(e,t)}catch{}}function hue(){let e=new URLSearchParams(window.location.search).get(`coeditor`)||`standalone`,t=j9(),n=L9(P9),r=L9(F9);return n||(n=pue(),R9(P9,n)),r||(r=mue(),R9(F9,r)),{name:n,color:r,coeditor:e,tabId:t}}function gue(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}function _ue(e){throw Error(`Unhandled ClassifiedLinkTarget variant: ${JSON.stringify(e)}`)}var z9=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function B9(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function V9(e){return e.split(`/`).filter(Boolean)}function H9(e){let t=e.trim();return z9.test(t)||t.startsWith(`//`)}function vue(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(H9(n))return{kind:`external`,url:n};let r=n.indexOf(`#`),i=r<0?n:n.slice(0,r),a=Mp(i,t);if(a)return{kind:`doc`,docName:a,anchor:r<0?null:n.slice(r+1)};let o=jp(i,t);if(o)return{kind:`doc`,docName:o,anchor:r<0?null:n.slice(r+1)};let s=gue(n,t);if(s)return{kind:`doc`,docName:s.docName,anchor:s.anchor};let c=B9(n);return c&&c!==`md`&&c!==`mdx`?{kind:`asset`,url:n,ext:c}:null}function yue(e,t){let n=e.trim();if(!n)return null;if(H9(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=B9(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function bue(e,t){let n=e.trim();if(!n||z9.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function xue(e,t,n=null,r=`.md`){let i=V9(e);i.pop();let a=V9(t),o=0;for(;o<i.length&&o<a.length&&i[o]===a[o];)o+=1;let s=i.slice(o).map(()=>`..`),c=a.slice(o),l=[...s,...c].join(`/`);return l||=a.at(-1)??t,!l.startsWith(`./`)&&!l.startsWith(`../`)&&(l=`./${l}`),`${l}${r}${n?`#${n}`:``}`}function Sue(e){return e.replace(/[/\\:*?"<>|\0]/g,`-`).replace(/\s+/g,` `).replace(/-+/g,`-`).trim().replace(/^[-.\s]+|[-.\s]+$/g,``)}function U9(e){return`pagesBySlug`in e}function W9(e){return U9(e)?e.pages:e}function G9(e,t){return U9(e)?e.assetPaths??new Set:t??new Set}function K9(e,t){return U9(e)?e.filePaths??new Set:t??new Set}function q9(e,t){return e<t?-1:+(e>t)}function Cue(e,t){let n=new Map;for(let r of e){let e=t(r);e&&!n.has(e)&&n.set(e,r)}return n}function wue(e,t){let n=new Map,r=[...e].sort(q9);for(let e of r){let r=e.lastIndexOf(`/`),i=t(r===-1?e:e.slice(r+1));i&&!n.has(i)&&n.set(i,e)}return n}function J9(e,t){let n=Q5(e);if(n){if(U9(t))return t.pagesBySlug.get(n);for(let e of t)if(Q5(e)===n)return e}}function Y9(e,t){if(e.includes(`/`))return;let n=Q5(e);if(!n)return;if(U9(t))return t.pagesByBasename?.get(n);let r;for(let e of t){let t=e.lastIndexOf(`/`);Q5(t===-1?e:e.slice(t+1))===n&&(r===void 0||q9(e,r)<0)&&(r=e)}return r}function X9(e){let t=e.trim();if(!t)return[];let n=Q5(t);return n.length>0&&n!==t?[n]:[]}function Z9(e,t){let n=e.trim();if(!n)return;let r=W9(t);if(r.has(n))return n;let i=J9(n,t);if(i)return i;for(let e of X9(n))if(r.has(e))return e;return Q9(n,r)||Y9(n,t)}function Q9(e,t){let n=`${e}/index`;if(t.has(n))return n;let r=e.lastIndexOf(`/`),i=r===-1?e:e.slice(r+1),a=i?`${e}/${i}`:null;if(a&&t.has(a))return a}function Tue(e){let t=((e.trim().split(`#`)[0]??``).trim().split(`?`)[0]??``).trim();return t.startsWith(`/`)?t.slice(1):t}function $9(e,t,n){let r=Tue(e);if(!r)return null;let i=r.toLowerCase(),a=n?[t,n]:[t];for(let e of a){if(e.has(r))return r;for(let t of e)if(t.toLowerCase()===i)return t}if(r.includes(`/`))return null;let o=[];for(let e of a)for(let t of e){let e=t.lastIndexOf(`/`);(e===-1?t:t.slice(e+1)).toLowerCase()===i&&o.push(t)}return o.length===0?null:o.sort(q9)[0]??null}function Eue(e,t,n,r){let i=e.trim();if(!i)return!1;if($9(i,G9(t,n),K9(t,r)))return!0;let a=W9(t);return a.has(i)||X9(i).some(e=>a.has(e))||J9(i,t)!==void 0||Q9(i,a)?!0:Y9(i,t)!==void 0}function Due(e,t,n){let r=yue(e,t);return r===null||r.kind!==`asset`||$9(r.url,G9(n),K9(n))!==null||Z9(e,n)===void 0?r:{kind:`doc`,docName:e.trim(),anchor:t?.trim()||null}}export{Uae as $,xp as $a,TE as $i,EX as $n,uf as $o,s5 as $r,u1 as $t,O7 as A,K as Aa,cae as Ai,b$ as An,td as Ao,PX as Ar,L as As,Dse as At,M9 as B,W as Ba,rj as Bi,UQ as Bn,Ed as Bo,Eue as Br,e1 as Bt,gse as C,wS as Ca,Vle as Ci,lY as Cn,Lp as Co,o4 as Cr,mf as Cs,eoe as Ct,NX as D,v_ as Da,SQ as Di,EY as Dn,Hp as Do,s4 as Dr,F as Ds,pZ as Dt,E9 as E,h_ as Ea,gQ as Ei,iue as En,Dp as Eo,n4 as Er,I as Es,dZ as Et,TX as F,Sg as Fa,_1 as Fi,qQ as Fn,Lf as Fo,Fae as Fr,Mse as Ft,cZ as G,hp as Ga,Ak as Gi,E8 as Gn,xd as Go,ioe as Gr,AQ as Gt,tse as H,Qp as Ha,aj as Hi,aue as Hn,ed as Ho,Vse as Hr,Yse as Ht,ole as I,Jg as Ia,e7 as Ii,kre as In,id as Io,zX as Ir,o1 as It,MX as J,Kp as Ja,Qte as Ji,yle as Jn,ad as Jo,woe as Jr,rQ as Jt,lZ as K,_p as Ka,jk as Ki,Z2 as Kn,ef as Ko,p1 as Kr,jQ as Kt,s9 as L,$h as La,BQ as Li,v$ as Ln,Of as Lo,Yle as Lr,K$ as Lt,Roe as M,pg as Ma,Vae as Mi,JQ as Mn,wd as Mo,Zae as Mr,Ot as Ms,v7 as Mt,Loe as N,yg as Na,Q5 as Ni,GQ as Nn,Od as No,L$ as Nr,At as Ns,kse as Nt,Cse as O,G as Oa,NQ as Oi,DY as On,cm as Oo,c4 as Or,Oa as Os,Wse as Ot,_se as P,Cg as Pa,yY as Pi,M$ as Pn,kd as Po,m2 as Pr,Ct as Ps,Ase as Pt,$oe as Q,am as Qa,Jw as Qi,bY as Qn,Vu as Qo,rle as Qr,GX as Qt,Woe as R,U as Ra,u9 as Ri,KQ as Rn,kf as Ro,I$ as Rr,Z$ as Rt,Foe as S,Wx as Sa,mY as Si,vue as Sn,Rp as So,u4 as Sr,gf as Ss,hY as St,Nae as T,q as Ta,g1 as Ti,eZ as Tn,om as To,a4 as Tr,Wo as Ts,Sse as Tt,w8 as U,Gp as Ua,Ek as Ui,oX as Un,Xu as Uo,ale as Ur,Jse as Ut,b0 as V,Hm as Va,oj as Vi,xce as Vn,Wu as Vo,mZ as Vr,b7 as Vt,oZ as W,vp as Wa,hk as Wi,roe as Wn,Sd as Wo,g2 as Wr,Gse as Wt,yZ as X,Zp as Xa,VT as Xi,LX as Xn,Bd as Xo,bX as Xr,wse as Xt,R5 as Y,qp as Ya,nE as Yi,uue as Yn,Pd as Yo,k0 as Yr,Use as Yt,qoe as Z,Jp as Za,wT as Zi,noe as Zn,Pf as Zo,$X as Zr,KX as Zt,xY as _,Zw as _a,Z9 as _i,xue as _n,Wp as _o,sue as _r,Wd as _s,Poe as _t,dY as a,iw as aa,hce as ai,ile as an,mp as ao,tZ as ar,Gu as as,kZ as at,qX as b,LS as ba,Sue as bi,Xle as bn,Up as bo,r4 as br,Hf as bs,Moe as bt,oce as c,_w as ca,x2 as ci,pX as cn,Cp as co,b5 as cr,ju as cs,HX as ct,sce as d,kw as da,z7 as di,vQ as dn,Tp as do,$5 as dr,bd as ds,ese as dt,EE as ea,lQ as ei,Jae as en,em as eo,pQ as er,Fu as es,Yae as et,cce as f,Yw as fa,R7 as fi,MQ as fn,bm as fo,hue as fr,Ud as fs,O9 as ft,sY as g,gw as ga,Due as gi,Cue as gn,Ip as go,O0 as gr,ff as gs,vse as gt,OX as h,dC as ha,$9 as hi,wue as hn,Ep as ho,DX as hr,Vd as hs,bse as ht,use as i,rw as ia,p2 as ii,Zoe as in,tm as io,eX as ir,Nd as is,Qie as it,g7 as j,vg as ja,sZ as ji,YQ as jn,$u as jo,H9 as jr,N as js,Ose as jt,Noe as k,Xg as ka,_Q as ki,k5 as kn,Ku as ko,vZ as kr,B as ks,jse as kt,uce as l,Ew as la,j9 as li,Hce as ln,xm as lo,oue as lr,Au as ls,VX as lt,kX as m,PC as ma,h1 as mi,xQ as mn,rm as mo,dQ as mr,Ff as ms,WX as mt,rue as n,tw as na,Kle as ni,fQ as nn,lm as no,lle as nr,Pu as ns,X5 as nt,Voe as o,Pw as oa,vY as oi,j$ as on,Im as oo,$ae as or,op as os,VQ as ot,ace as p,dE as pa,bue as pi,yQ as pn,Sp as po,X9 as pr,Lu as ps,UX as pt,uZ as q,gp as qa,vk as qi,xle as qn,Zu as qo,Doe as qr,FX as qt,lse as r,uE as ra,qle as ri,hQ as rn,Xp as ro,vce as rr,lp as rs,k9 as rt,Boe as s,Fw as sa,uQ as si,_ue as sn,wp as so,aae as sr,yd as ss,HQ as st,nue as t,CE as ta,u8 as ti,qae as tn,$p as to,B9 as tr,bf as ts,ase as tt,lce as u,Ow as ua,d1 as ui,yX as un,gm as uo,mce as ur,Nu as us,RX as ut,AX as v,SE as va,sX as vi,PQ as vn,Bp as vo,d4 as vr,_f as vs,s1 as vt,hse as w,t_ as wa,M5 as wi,uY as wn,Bm as wo,l4 as wr,z as ws,AZ as wt,f7 as x,Vx as xa,$le as xi,Wle as xn,kp as xo,i4 as xr,Ru as xs,gY as xt,A9 as y,aE as ya,fce as yi,Ule as yn,Pp as yo,f4 as yr,hf as ys,l1 as yt,Gae as z,ph as za,dj as zi,WQ as zn,rd as zo,hZ as zr,X$ as zt};
|