@inkeep/open-knowledge 0.19.1-beta.0 → 0.19.1-beta.10

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.
Files changed (69) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +10 -10
  2. package/dist/assets/skills/packs/codebase-wiki/SKILL.md +1 -1
  3. package/dist/assets/skills/packs/entity-vault/SKILL.md +1 -1
  4. package/dist/assets/skills/packs/knowledge-base/SKILL.md +1 -1
  5. package/dist/assets/skills/packs/okf/SKILL.md +3 -3
  6. package/dist/assets/skills/packs/plain-notes/SKILL.md +1 -1
  7. package/dist/assets/skills/packs/software-lifecycle/SKILL.md +1 -1
  8. package/dist/assets/skills/packs/worldbuilding/SKILL.md +1 -1
  9. package/dist/assets/skills/packs/writing-pipeline/SKILL.md +1 -1
  10. package/dist/assets/skills/project/SKILL.md +13 -13
  11. package/dist/cli.mjs +14 -14
  12. package/dist/config-schema.json +1 -1
  13. package/dist/config.project.schema.json +1 -1
  14. package/dist/constants-Bhw3dVi1.mjs +2 -0
  15. package/dist/{dist-CKbTJ2SP.mjs → dist-CSYT3uRJ.mjs} +1 -1
  16. package/dist/{dist-DijTLjBt.mjs → dist-dm_DI4lI.mjs} +24 -24
  17. package/dist/{gh-detect-Cvw39ew1.mjs → gh-detect-Drsi8mbA.mjs} +2 -2
  18. package/dist/index.d.mts +2 -2
  19. package/dist/index.mjs +1 -1
  20. package/dist/init-BtJhGC1W.mjs +1 -0
  21. package/dist/{init-BsxfRS80.mjs → init-ChNWqX_K.mjs} +11 -11
  22. package/dist/{loader-BW4HWUZz.mjs → loader-B5gVF_x1.mjs} +2 -2
  23. package/dist/loader-Cb_y6hK2.mjs +1 -0
  24. package/dist/{preview-BnW3wj59.mjs → preview-C5P0CL_f.mjs} +2 -2
  25. package/dist/preview-CUHcO0zX.mjs +1 -0
  26. package/dist/public/assets/{ActivityModeContent-jZ6HnQxU.js → ActivityModeContent-Dy1_JO4s.js} +1 -1
  27. package/dist/public/assets/{ConsentDialogBody-DOf6_QiW.js → ConsentDialogBody-CPn5k8Yj.js} +1 -1
  28. package/dist/public/assets/{DocumentContext-DVhriDCf.js → DocumentContext-DppavGIB.js} +1 -1
  29. package/dist/public/assets/GraphPanel-B7tXBL9C.js +46 -0
  30. package/dist/public/assets/{McpConsentDialogBody-stteh15-.js → McpConsentDialogBody-_slAuRpY.js} +1 -1
  31. package/dist/public/assets/SettingsDialogBody-DgfCMlWX.js +7 -0
  32. package/dist/public/assets/{SourceEditor-DW3ZzZL8.js → SourceEditor-CvVog_I5.js} +1 -1
  33. package/dist/public/assets/{TerminalPanel-BQT_RT2t.js → TerminalPanel-gtDefA9J.js} +3 -3
  34. package/dist/public/assets/{config-validation-events-DSgrywOU.js → config-validation-events-De91seTf.js} +7 -7
  35. package/dist/public/assets/{dist-52GaUc7C.js → dist-DzbxRXt5.js} +13 -13
  36. package/dist/public/assets/{index-Ddc1Tv7f.js → index-DkmfFrL2.js} +95 -95
  37. package/dist/public/assets/index-DlZTOWgT.css +1 -0
  38. package/dist/public/assets/{keyboard-shortcuts-NT911PBK.js → keyboard-shortcuts-CrOPSj32.js} +1 -1
  39. package/dist/public/assets/{prop-types-DFOayjLw.js → prop-types-C0kDsvPx.js} +1 -1
  40. package/dist/public/assets/{target-navigation-intent-Ck2yPxGj.js → target-navigation-intent-BW8U2Njg.js} +1 -1
  41. package/dist/public/assets/toggle-group-DsgJIlng.js +1 -0
  42. package/dist/public/assets/{typing-burst-detector-CpE9cH17.js → typing-burst-detector-Wg72tb4K.js} +1 -1
  43. package/dist/public/index.html +11 -11
  44. package/dist/{repair-launch-json-C1BEgqKz.mjs → repair-launch-json-CARK9RAA.mjs} +2 -2
  45. package/dist/{repair-mcp-configs-Bs1HhvwH.mjs → repair-mcp-configs-D1ZLT9sG.mjs} +2 -2
  46. package/dist/repair-skills-B57xTnpU.mjs +1 -0
  47. package/dist/repair-skills-CsRymFFj.mjs +3 -0
  48. package/dist/schemas/v0/config.project.schema.json +1 -1
  49. package/dist/server-lock-8Lv6A-Xa-BTQcAAhW.mjs +1 -0
  50. package/dist/{server-lock-BpjJj3OD-DwwMezJh.mjs → server-lock-CN2YHwpP-Cvbk69Pj.mjs} +5 -5
  51. package/dist/{src-CK8w6qU6.mjs → src-BjJgR5K9.mjs} +3 -3
  52. package/dist/start-DZeLNeUa.mjs +3 -0
  53. package/dist/start-DvrS6uIC.mjs +1 -0
  54. package/dist/write-project-skill-C3yO9LBO.mjs +12 -0
  55. package/package.json +1 -1
  56. package/dist/constants-BNoR2_Qg.mjs +0 -2
  57. package/dist/init-DIT1ZqWz.mjs +0 -1
  58. package/dist/loader-dvZHcwcQ.mjs +0 -1
  59. package/dist/preview-Blsaqire.mjs +0 -1
  60. package/dist/public/assets/GraphPanel-Bqt3XRIg.js +0 -46
  61. package/dist/public/assets/SettingsDialogBody-CcxV23r0.js +0 -7
  62. package/dist/public/assets/index-6vGfMBbB.css +0 -1
  63. package/dist/public/assets/toggle-group-oSLn0Q3B.js +0 -1
  64. package/dist/repair-skills-Fvio4Y5j.mjs +0 -3
  65. package/dist/repair-skills-RiEpYpER.mjs +0 -1
  66. package/dist/server-lock-CyhBidkz-CtwSwoJc.mjs +0 -1
  67. package/dist/start-CYhN6fGd.mjs +0 -3
  68. package/dist/start-jTgkie2f.mjs +0 -1
  69. package/dist/write-project-skill-X3m0-n6F.mjs +0 -12
@@ -142,7 +142,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
142
142
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
143
143
  `,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)){ql(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(Hl(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=Kl(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(Hl(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(Wl(t.key)&&!Hl(t.sep,`newline`)){let e=Kl(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]}):Hl(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&&!Hl(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)){ql(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||Hl(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=Kl(Gl(t));Jl(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(`
144
144
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
145
- `,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=Kl(Gl(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=Kl(Gl(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 Xl(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Vl||null,prettyErrors:t}}function Zl(e,t={}){let{lineCounter:n,prettyErrors:r}=Xl(t),i=new Yl(n?.addNewLine),a=new Dl(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 Wc(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(Gc(e,n)),o.warnings.forEach(Gc(e,n))),o}var Ql=Symbol.for(`@inkeep/open-knowledge/field-registry`),$l=globalThis;$l[Ql]===void 0&&($l[Ql]=ur());var eu=$l[Ql];function tu(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=nu(t)?eu.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function nu(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}var ru=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),iu=52428800,au=26214400,ou=`https://api.openai.com/v1`,su=`text-embedding-3-small`,cu=Pa({content:Pa({dir:E().register(eu,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Folder Open Knowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore.`}).default(`.`)}).default({dir:`.`}),appearance:Pa({theme:j([`light`,`dark`,`system`]).register(eu,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),preview:Pa({autoOpen:O().register(eu,{scope:`user`,agentSettable:!1,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:Pa({showHiddenFiles:O().register(eu,{scope:`project-local`,agentSettable:!1,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)}).optional()}).default({preview:{autoOpen:!0}}),editor:Pa({wordWrap:O().register(eu,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0}),autoSync:Pa({enabled:O().register(eu,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Whether this machine auto-pulls and auto-pushes git commits for this project. null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared.`}).nullable().default(null),default:O().register(eu,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Committed project default for a machine's autoSync.enabled on first open: true = auto-sync on, false = off, null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.enabled choice overrides it.`}).nullable().default(null)}).default({enabled:null,default:null}),terminal:Pa({enabled:O().register(eu,{scope:`project-local`,agentSettable:!1,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}),telemetry:Pa({localSink:Pa({enabled:O().register(eu,{scope:`project`,agentSettable:!1,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:Pa({maxBytes:D().register(eu,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(iu)}).default({maxBytes:iu}),logs:Pa({maxBytes:D().register(eu,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(au)}).default({maxBytes:au}),attributeDenylist:k(E()).register(eu,{scope:`project`,agentSettable:!1,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([...ru])}).default({enabled:!0,spans:{maxBytes:iu},logs:{maxBytes:au},attributeDenylist:[...ru]})}).default({localSink:{enabled:!0,spans:{maxBytes:iu},logs:{maxBytes:au},attributeDenylist:[...ru]}}),search:Pa({semantic:Pa({enabled:O().register(eu,{scope:`project-local`,agentSettable:!1,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:E().register(eu,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override for Azure / self-hosted / other providers. The API key is NOT stored here — set it with `ok embeddings set-key` (OS keyring)."}).default(ou),model:E().register(eu,{scope:`project-local`,agentSettable:!1,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(su),dimensions:D().int().positive().register(eu,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit to use the model's native size (1536 for text-embedding-3-small). Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality. Changing it re-embeds the corpus.`}).optional(),similarityFloor:D().min(0).max(1).register(eu,{scope:`project-local`,agentSettable:!1,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:ou,model:su})}).default({semantic:{enabled:!1,baseUrl:ou,model:su}})}),lu=`open-knowledge-config`;function uu(e,t,n){let r=a.getTracer(lu),o=t?{attributes:t}:{};return r.startActiveSpan(e,o,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:i.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function du(e,t){let n=a.getActiveSpan();n&&n.addEvent(e,t)}function fu(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 pu(e,t){let n=e;for(let e of t){n=fu(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function mu(e,t){let n=pu(e,t);if(n!==void 0)return tu(n)}function hu(e,t){return e===`either`?!0:e===t}function gu(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=mu(cu,i);a?.scope!==void 0&&(hu(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 _u(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&(jo(e.getIn(r,!0))||e.deleteIn(r))}}function vu(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)){_u(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}_u(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function yu(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}var bu=A({file:E(),line:D().int().min(1),column:D().int().min(1),snippet:E().optional()}),xu=A({path:k(Ia([E(),D()])),message:E(),issueCode:E(),params:Ha(E(),ka()).optional(),source:bu.optional()}),Su=j([`user`,`project`,`project-local`,`either`]),Cu=j([`user`,`project`,`project-local`]),wu=Ra(`code`,[A({code:M(`YAML_PARSE`),detail:E()}),A({code:M(`SCHEMA_INVALID`),issues:k(xu)}),A({code:M(`SCOPE_VIOLATION`),path:k(E()),expectedScope:Su,actualScope:Cu}),A({code:M(`NOT_AGENT_SETTABLE`),path:k(E())}),A({code:M(`MIXED_SCOPE`),paths:k(A({path:k(E()),scope:Cu}))}),A({code:M(`REMOVED_KEY`),path:k(E()),redirect:E(),source:bu.optional()}),A({code:M(`WRITE_ERROR`),detail:E()}),A({code:M(`OKIGNORE_INVALID`),detail:E(),lineNumber:D().int().min(1).optional()}),A({code:M(`UNKNOWN`),message:E().optional()})]),Tu=new Set(wu.options.map(e=>e.shape.code.value)),Eu=Ia([wu,Pa({code:E(),message:E().optional()})]);function Du(e){return Tu.has(e.code)}function Ou(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 ku(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 Au(e){if(!Du(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${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(`
145
+ `,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=Kl(Gl(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=Kl(Gl(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 Xl(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Vl||null,prettyErrors:t}}function Zl(e,t={}){let{lineCounter:n,prettyErrors:r}=Xl(t),i=new Yl(n?.addNewLine),a=new Dl(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 Wc(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(Gc(e,n)),o.warnings.forEach(Gc(e,n))),o}var Ql=Symbol.for(`@inkeep/open-knowledge/field-registry`),$l=globalThis;$l[Ql]===void 0&&($l[Ql]=ur());var eu=$l[Ql];function tu(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=nu(t)?eu.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function nu(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}var ru=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),iu=52428800,au=26214400,ou=`https://api.openai.com/v1`,su=`text-embedding-3-small`,cu=Pa({content:Pa({dir:E().register(eu,{scope:`project`,agentSettable:!1,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.`}).default(`.`)}).default({dir:`.`}),appearance:Pa({theme:j([`light`,`dark`,`system`]).register(eu,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),preview:Pa({autoOpen:O().register(eu,{scope:`user`,agentSettable:!1,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:Pa({showHiddenFiles:O().register(eu,{scope:`project-local`,agentSettable:!1,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)}).optional()}).default({preview:{autoOpen:!0}}),editor:Pa({wordWrap:O().register(eu,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0}),autoSync:Pa({enabled:O().register(eu,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Whether this machine auto-pulls and auto-pushes git commits for this project. null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared.`}).nullable().default(null),default:O().register(eu,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Committed project default for a machine's autoSync.enabled on first open: true = auto-sync on, false = off, null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.enabled choice overrides it.`}).nullable().default(null)}).default({enabled:null,default:null}),terminal:Pa({enabled:O().register(eu,{scope:`project-local`,agentSettable:!1,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}),telemetry:Pa({localSink:Pa({enabled:O().register(eu,{scope:`project`,agentSettable:!1,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:Pa({maxBytes:D().register(eu,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(iu)}).default({maxBytes:iu}),logs:Pa({maxBytes:D().register(eu,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(au)}).default({maxBytes:au}),attributeDenylist:k(E()).register(eu,{scope:`project`,agentSettable:!1,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([...ru])}).default({enabled:!0,spans:{maxBytes:iu},logs:{maxBytes:au},attributeDenylist:[...ru]})}).default({localSink:{enabled:!0,spans:{maxBytes:iu},logs:{maxBytes:au},attributeDenylist:[...ru]}}),search:Pa({semantic:Pa({enabled:O().register(eu,{scope:`project-local`,agentSettable:!1,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:E().register(eu,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override for Azure / self-hosted / other providers. The API key is NOT stored here — set it with `ok embeddings set-key` (OS keyring)."}).default(ou),model:E().register(eu,{scope:`project-local`,agentSettable:!1,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(su),dimensions:D().int().positive().register(eu,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit to use the model's native size (1536 for text-embedding-3-small). Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality. Changing it re-embeds the corpus.`}).optional(),similarityFloor:D().min(0).max(1).register(eu,{scope:`project-local`,agentSettable:!1,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:ou,model:su})}).default({semantic:{enabled:!1,baseUrl:ou,model:su}})}),lu=`open-knowledge-config`;function uu(e,t,n){let r=a.getTracer(lu),o=t?{attributes:t}:{};return r.startActiveSpan(e,o,e=>{try{return n(e)}catch(t){throw e.recordException(t),e.setStatus({code:i.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}function du(e,t){let n=a.getActiveSpan();n&&n.addEvent(e,t)}function fu(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 pu(e,t){let n=e;for(let e of t){n=fu(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function mu(e,t){let n=pu(e,t);if(n!==void 0)return tu(n)}function hu(e,t){return e===`either`?!0:e===t}function gu(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=mu(cu,i);a?.scope!==void 0&&(hu(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 _u(e,t){for(let n=1;n<t.length;n++){let r=t.slice(0,n);e.hasIn(r)&&(jo(e.getIn(r,!0))||e.deleteIn(r))}}function vu(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)){_u(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}_u(e,i),e.setIn(i,t),n.push(i.join(`.`))}}for(let[e,n]of Object.entries(t))r(n,[e]);return n}function yu(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}var bu=A({file:E(),line:D().int().min(1),column:D().int().min(1),snippet:E().optional()}),xu=A({path:k(Ia([E(),D()])),message:E(),issueCode:E(),params:Ha(E(),ka()).optional(),source:bu.optional()}),Su=j([`user`,`project`,`project-local`,`either`]),Cu=j([`user`,`project`,`project-local`]),wu=Ra(`code`,[A({code:M(`YAML_PARSE`),detail:E()}),A({code:M(`SCHEMA_INVALID`),issues:k(xu)}),A({code:M(`SCOPE_VIOLATION`),path:k(E()),expectedScope:Su,actualScope:Cu}),A({code:M(`NOT_AGENT_SETTABLE`),path:k(E())}),A({code:M(`MIXED_SCOPE`),paths:k(A({path:k(E()),scope:Cu}))}),A({code:M(`REMOVED_KEY`),path:k(E()),redirect:E(),source:bu.optional()}),A({code:M(`WRITE_ERROR`),detail:E()}),A({code:M(`OKIGNORE_INVALID`),detail:E(),lineNumber:D().int().min(1).optional()}),A({code:M(`UNKNOWN`),message:E().optional()})]),Tu=new Set(wu.options.map(e=>e.shape.code.value)),Eu=Ia([wu,Pa({code:E(),message:E().optional()})]);function Du(e){return Tu.has(e.code)}function Ou(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 ku(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 Au(e){if(!Du(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${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(`
146
146
  `))n.push(` ${e}`)}else n.push(` ${r}: ${t.message}`)}}return n.join(`
147
147
  `)}case`SCOPE_VIOLATION`:return[`Setting ${e.path.join(`.`)} belongs in your ${e.expectedScope} config`,`(${Ou(e.expectedScope)} — ${ku(e.expectedScope)}),`,`but it was set in the ${e.actualScope} config (${Ou(e.actualScope)}).`,`Move it to ${Ou(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(`.`)} → ${Ou(t)} (${t})`).join(`
148
148
  `)].join(`
@@ -381,7 +381,7 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
381
381
  Please provide a chat model before proceeding with creating an answer session.
382
382
  Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#plugin-secure-proxy
383
383
  `,ANSWER_SESSION_LAST_MESSAGE_IS_NOT_ASSISTANT:`The last message in the session is not an assistant message. Cannot regenerate non-assistant messages.`,PLUGIN_COMPONENT_CONFLICT:`The component "%s" is already defined. The plugin "%s" is trying to redefine it.`};function $(e,...t){let n=Error(iY(EY[e]??`Unsupported Orama Error code: ${e}`,...t));return n.code=e,`captureStackTrace`in Error.prototype&&Error.captureStackTrace(n),n}function DY(e){return{raw:Number(e),formatted:cY(e)}}function OY(e){if(e.id){if(typeof e.id!=`string`)throw $(`DOCUMENT_ID_MUST_BE_STRING`,typeof e.id);return e.id}return uY()}function kY(e,t){for(let[n,r]of Object.entries(t)){let t=e[n];if(t!==void 0&&!(r===`geopoint`&&typeof t==`object`&&typeof t.lon==`number`&&typeof t.lat==`number`)&&!(r===`enum`&&(typeof t==`string`||typeof t==`number`))){if(r===`enum[]`&&Array.isArray(t)){let e=t.length;for(let r=0;r<e;r++)if(typeof t[r]!=`string`&&typeof t[r]!=`number`)return n+`.`+r;continue}if(NY(r)){let e=IY(r);if(!Array.isArray(t)||t.length!==e)throw $(`INVALID_INPUT_VECTOR`,n,e,t.length);continue}if(PY(r)){if(!Array.isArray(t))return n;let e=FY(r),i=t.length;for(let r=0;r<i;r++)if(typeof t[r]!==e)return n+`.`+r;continue}if(typeof r==`object`){if(!t||typeof t!=`object`)return n;let e=kY(t,r);if(e)return n+`.`+e;continue}if(typeof t!==r)return n}}}var AY={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},jY={"string[]":`string`,"number[]":`number`,"boolean[]":`boolean`,"enum[]":`enum`};function MY(e){return e===`geopoint`}function NY(e){return typeof e==`string`&&/^vector\[\d+\]$/.test(e)}function PY(e){return typeof e==`string`&&AY[e]}function FY(e){return jY[e]}function IY(e){let t=Number(e.slice(7,-1));switch(!0){case isNaN(t):throw $(`INVALID_VECTOR_VALUE`,e);case t<=0:throw $(`INVALID_VECTOR_SIZE`,e);default:return t}}function LY(){return{idToInternalId:new Map,internalIdToId:[],save:RY,load:zY}}function RY(e){return{internalIdToId:e.internalIdToId}}function zY(e,t){let{internalIdToId:n}=t;e.internalDocumentIDStore.idToInternalId.clear(),e.internalDocumentIDStore.internalIdToId=[];let r=n.length;for(let t=0;t<r;t++){let r=n[t];e.internalDocumentIDStore.idToInternalId.set(r,t+1),e.internalDocumentIDStore.internalIdToId.push(r)}}function BY(e,t){if(typeof t==`string`){let n=e.idToInternalId.get(t);if(n)return n;let r=e.idToInternalId.size+1;return e.idToInternalId.set(t,r),e.internalIdToId.push(t),r}return t>e.internalIdToId.length?BY(e,t.toString()):t}function VY(e,t){if(e.internalIdToId.length<t)throw Error(`Invalid internalId ${t}`);return e.internalIdToId[t-1]}function HY(e,t){return{sharedInternalDocumentStore:t,docs:{},count:0}}function UY(e,t){let n=BY(e.sharedInternalDocumentStore,t);return e.docs[n]}function WY(e,t){let n=t.length,r=Array.from({length:n});for(let i=0;i<n;i++){let n=BY(e.sharedInternalDocumentStore,t[i]);r[i]=e.docs[n]}return r}function GY(e){return e.docs}function KY(e,t,n,r){return e.docs[n]===void 0?(e.docs[n]=r,e.count++,!0):!1}function qY(e,t){let n=BY(e.sharedInternalDocumentStore,t);return e.docs[n]===void 0?!1:(delete e.docs[n],e.count--,!0)}function JY(e){return e.count}function YY(e,t){let n=t;return{docs:n.docs,count:n.count,sharedInternalDocumentStore:e}}function XY(e){return{docs:e.docs,count:e.count}}function ZY(){return{create:HY,get:UY,getMultiple:WY,getAll:GY,store:KY,remove:qY,count:JY,load:YY,save:XY}}var QY=[`beforeInsert`,`afterInsert`,`beforeRemove`,`afterRemove`,`beforeUpdate`,`afterUpdate`,`beforeUpsert`,`afterUpsert`,`beforeSearch`,`afterSearch`,`beforeInsertMultiple`,`afterInsertMultiple`,`beforeRemoveMultiple`,`afterRemoveMultiple`,`beforeUpdateMultiple`,`afterUpdateMultiple`,`beforeUpsertMultiple`,`afterUpsertMultiple`,`beforeLoad`,`afterLoad`,`afterCreate`];function $Y(e,t){let n=[],r=e.plugins?.length;if(!r)return n;for(let i=0;i<r;i++)try{let r=e.plugins[i];typeof r[t]==`function`&&n.push(r[t])}catch(e){throw console.error(`Caught error in getAllPluginsByHook:`,e),$(`PLUGIN_CRASHED`)}return n}var eX=[`tokenizer`,`index`,`documentsStore`,`sorter`,`pinning`],tX=[`validateSchema`,`getDocumentIndexId`,`getDocumentProperties`,`formatElapsedTime`];function nX(e,t,n,r){if(e.some(yY))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function rX(e,t,n){if(e.some(yY))return(async()=>{for(let r of e)await r(t,n)})();for(let r of e)r(t,n)}function iX(e,t,n,r,i){if(e.some(yY))return(async()=>{for(let a of e)await a(t,n,r,i)})();for(let a of e)a(t,n,r,i)}function aX(e,t,n,r){if(e.some(yY))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function oX(e,t){if(e.some(yY))return(async()=>{for(let n of e)await n(t)})();for(let n of e)n(t)}var sX=class e{k;v;l=null;r=null;h=1;constructor(e,t){this.k=e,this.v=new Set(t)}updateHeight(){this.h=Math.max(e.getHeight(this.l),e.getHeight(this.r))+1}static getHeight(e){return e?e.h:0}getBalanceFactor(){return e.getHeight(this.l)-e.getHeight(this.r)}rotateLeft(){let e=this.r;return this.r=e.l,e.l=this,this.updateHeight(),e.updateHeight(),e}rotateRight(){let e=this.l;return this.l=e.r,e.r=this,this.updateHeight(),e.updateHeight(),e}toJSON(){return{k:this.k,v:Array.from(this.v),l:this.l?this.l.toJSON():null,r:this.r?this.r.toJSON():null,h:this.h}}static fromJSON(t){let n=new e(t.k,t.v);return n.l=t.l?e.fromJSON(t.l):null,n.r=t.r?e.fromJSON(t.r):null,n.h=t.h,n}},cX=class e{root=null;insertCount=0;constructor(e,t){e!==void 0&&t!==void 0&&(this.root=new sX(e,t))}insert(e,t,n=1e3){this.root=this.insertNode(this.root,e,t,n)}insertMultiple(e,t,n=1e3){for(let r of t)this.insert(e,r,n)}rebalance(){this.root&&=this.rebalanceNode(this.root)}toJSON(){return{root:this.root?this.root.toJSON():null,insertCount:this.insertCount}}static fromJSON(t){let n=new e;return n.root=t.root?sX.fromJSON(t.root):null,n.insertCount=t.insertCount||0,n}insertNode(e,t,n,r){if(e===null)return new sX(t,[n]);let i=[],a=e,o=null;for(;a!==null;)if(i.push({parent:o,node:a}),t<a.k)if(a.l===null){a.l=new sX(t,[n]),i.push({parent:a,node:a.l});break}else o=a,a=a.l;else if(t>a.k)if(a.r===null){a.r=new sX(t,[n]),i.push({parent:a,node:a.r});break}else o=a,a=a.r;else return a.v.add(n),e;let s=!1;this.insertCount++%r===0&&(s=!0);for(let t=i.length-1;t>=0;t--){let{parent:n,node:r}=i[t];if(r.updateHeight(),s){let t=this.rebalanceNode(r);n?n.l===r?n.l=t:n.r===r&&(n.r=t):e=t}}return e}rebalanceNode(e){let t=e.getBalanceFactor();if(t>1){if(e.l&&e.l.getBalanceFactor()>=0)return e.rotateRight();if(e.l)return e.l=e.l.rotateLeft(),e.rotateRight()}if(t<-1){if(e.r&&e.r.getBalanceFactor()<=0)return e.rotateLeft();if(e.r)return e.r=e.r.rotateRight(),e.rotateLeft()}return e}find(e){let t=this.findNodeByKey(e);return t?t.v:null}contains(e){return this.find(e)!==null}getSize(){let e=0,t=[],n=this.root;for(;n||t.length>0;){for(;n;)t.push(n),n=n.l;n=t.pop(),e++,n=n.r}return e}isBalanced(){if(!this.root)return!0;let e=[this.root];for(;e.length>0;){let t=e.pop(),n=t.getBalanceFactor();if(Math.abs(n)>1)return!1;t.l&&e.push(t.l),t.r&&e.push(t.r)}return!0}remove(e){this.root=this.removeNode(this.root,e)}removeDocument(e,t){let n=this.findNodeByKey(e);n&&(n.v.size===1?this.root=this.removeNode(this.root,e):n.v=new Set([...n.v.values()].filter(e=>e!==t)))}findNodeByKey(e){let t=this.root;for(;t;)if(e<t.k)t=t.l;else if(e>t.k)t=t.r;else return t;return null}removeNode(e,t){if(e===null)return null;let n=[],r=e;for(;r!==null&&r.k!==t;)n.push(r),r=t<r.k?r.l:r.r;if(r===null)return e;if(r.l===null||r.r===null){let t=r.l?r.l:r.r;if(n.length===0)e=t;else{let e=n[n.length-1];e.l===r?e.l=t:e.r=t}}else{let e=r,t=r.r;for(;t.l!==null;)e=t,t=t.l;r.k=t.k,r.v=t.v,e.l===t?e.l=t.r:e.r=t.r,r=e}n.push(r);for(let t=n.length-1;t>=0;t--){let r=n[t];r.updateHeight();let i=this.rebalanceNode(r);if(t>0){let e=n[t-1];e.l===r?e.l=i:e.r===r&&(e.r=i)}else e=i}return e}rangeSearch(e,t){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.l;if(i=r.pop(),i.k>=e&&i.k<=t)for(let e of i.v)n.add(e);if(i.k>t)break;i=i.r}return n}greaterThan(e,t=!1){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.r;if(i=r.pop(),t&&i.k>=e||!t&&i.k>e)for(let e of i.v)n.add(e);else if(i.k<=e)break;i=i.l}return n}lessThan(e,t=!1){let n=new Set,r=[],i=this.root;for(;i||r.length>0;){for(;i;)r.push(i),i=i.l;if(i=r.pop(),t&&i.k<=e||!t&&i.k<e)for(let e of i.v)n.add(e);else if(i.k>e)break;i=i.r}return n}},lX=class e{numberToDocumentId;constructor(){this.numberToDocumentId=new Map}insert(e,t){this.numberToDocumentId.has(e)?this.numberToDocumentId.get(e).add(t):this.numberToDocumentId.set(e,new Set([t]))}find(e){let t=this.numberToDocumentId.get(e);return t?Array.from(t):null}remove(e){this.numberToDocumentId.delete(e)}removeDocument(e,t){let n=this.numberToDocumentId.get(t);n&&(n.delete(e),n.size===0&&this.numberToDocumentId.delete(t))}contains(e){return this.numberToDocumentId.has(e)}getSize(){let e=0;for(let t of this.numberToDocumentId.values())e+=t.size;return e}filter(e){let t=Object.keys(e);if(t.length!==1)throw Error(`Invalid operation`);let n=t[0];switch(n){case`eq`:{let t=e[n],r=this.numberToDocumentId.get(t);return r?Array.from(r):[]}case`in`:{let t=e[n],r=new Set;for(let e of t){let t=this.numberToDocumentId.get(e);if(t)for(let e of t)r.add(e)}return Array.from(r)}case`nin`:{let t=new Set(e[n]),r=new Set;for(let[e,n]of this.numberToDocumentId.entries())if(!t.has(e))for(let e of n)r.add(e);return Array.from(r)}default:throw Error(`Invalid operation`)}}filterArr(e){let t=Object.keys(e);if(t.length!==1)throw Error(`Invalid operation`);let n=t[0];switch(n){case`containsAll`:{let t=e[n].map(e=>this.numberToDocumentId.get(e)??new Set);if(t.length===0)return[];let r=t.reduce((e,t)=>new Set([...e].filter(e=>t.has(e))));return Array.from(r)}case`containsAny`:{let t=e[n].map(e=>this.numberToDocumentId.get(e)??new Set);if(t.length===0)return[];let r=t.reduce((e,t)=>new Set([...e,...t]));return Array.from(r)}default:throw Error(`Invalid operation`)}}static fromJSON(t){if(!t.numberToDocumentId)throw Error(`Invalid Flat Tree JSON`);let n=new e;for(let[e,r]of t.numberToDocumentId)n.numberToDocumentId.set(e,new Set(r));return n}toJSON(){return{numberToDocumentId:Array.from(this.numberToDocumentId.entries()).map(([e,t])=>[e,Array.from(t)])}}};function uX(e,t,n){if(n<0)return-1;if(e===t)return 0;let r=e.length,i=t.length;if(r===0)return i<=n?i:-1;if(i===0)return r<=n?r:-1;let a=Math.abs(r-i);if(e.startsWith(t))return a<=n?a:-1;if(t.startsWith(e))return 0;if(a>n)return-1;let o=[];for(let e=0;e<=r;e++){o[e]=[e];for(let t=1;t<=i;t++)o[e][t]=e===0?t:0}for(let a=1;a<=r;a++){let r=1/0;for(let n=1;n<=i;n++)e[a-1]===t[n-1]?o[a][n]=o[a-1][n-1]:o[a][n]=Math.min(o[a-1][n]+1,o[a][n-1]+1,o[a-1][n-1]+1),r=Math.min(r,o[a][n]);if(r>n)return-1}return o[r][i]<=n?o[r][i]:-1}function dX(e,t,n){let r=uX(e,t,n);return{distance:r,isBounded:r>=0}}var fX=class e{k;s;c=new Map;d=new Set;e;w=``;constructor(e,t,n){this.k=e,this.s=t,this.e=n}updateParent(e){this.w=e.w+this.s}addDocument(e){this.d.add(e)}removeDocument(e){return this.d.delete(e)}findAllWords(e,t,n,r){let i=[this];for(;i.length>0;){let a=i.pop();if(a.e){let{w:i,d:o}=a;if(n&&i!==t)continue;if(dY(e,i)!==null)if(r)if(Math.abs(t.length-i.length)<=r&&dX(t,i,r).isBounded)e[i]=[];else continue;else e[i]=[];if(dY(e,i)!=null&&o.size>0){let t=e[i];for(let e of o)t.includes(e)||t.push(e)}}a.c.size>0&&i.push(...a.c.values())}return e}insert(t,n){let r=this,i=0,a=t.length;for(;i<a;){let o=t[i],s=r.c.get(o);if(s){let o=s.s,c=o.length,l=0;for(;l<c&&i+l<a&&o[l]===t[i+l];)l++;if(l===c){if(r=s,i+=l,i===a){s.e||=!0,s.addDocument(n);return}continue}let u=o.slice(0,l),d=o.slice(l),f=t.slice(i+l),p=new e(u[0],u,!1);if(r.c.set(u[0],p),p.updateParent(r),s.s=d,s.k=d[0],p.c.set(d[0],s),s.updateParent(p),f){let t=new e(f[0],f,!0);t.addDocument(n),p.c.set(f[0],t),t.updateParent(p)}else p.e=!0,p.addDocument(n);return}else{let a=new e(o,t.slice(i),!0);a.addDocument(n),r.c.set(o,a),a.updateParent(r);return}}r.e||=!0,r.addDocument(n)}_findLevenshtein(e,t,n,r,i){let a=[{node:this,index:t,tolerance:n}];for(;a.length>0;){let{node:t,index:n,tolerance:o}=a.pop();if(t.w.startsWith(e)){t.findAllWords(i,e,!1,0);continue}if(o<0)continue;if(t.e){let{w:n,d:a}=t;if(n&&(dX(e,n,r).isBounded&&(i[n]=[]),dY(i,n)!==void 0&&a.size>0)){let e=new Set(i[n]);for(let t of a)e.add(t);i[n]=Array.from(e)}}if(n>=e.length)continue;let s=e[n];if(t.c.has(s)){let e=t.c.get(s);a.push({node:e,index:n+1,tolerance:o})}a.push({node:t,index:n+1,tolerance:o-1});for(let[e,r]of t.c)a.push({node:r,index:n,tolerance:o-1}),e!==s&&a.push({node:r,index:n+1,tolerance:o-1})}}find(e){let{term:t,exact:n,tolerance:r}=e;if(r&&!n){let e={};return this._findLevenshtein(t,0,r,r,e),e}else{let e=this,i=0,a=t.length;for(;i<a;){let o=t[i],s=e.c.get(o);if(s){let o=s.s,c=o.length,l=0;for(;l<c&&i+l<a&&o[l]===t[i+l];)l++;if(l===c)e=s,i+=l;else if(i+l===a)if(l===a-i){if(n)return{};{let e={};return s.findAllWords(e,t,n,r),e}}else return{};else return{}}else return{}}let o={};return e.findAllWords(o,t,n,r),o}}contains(e){let t=this,n=0,r=e.length;for(;n<r;){let i=e[n],a=t.c.get(i);if(a){let i=a.s,o=i.length,s=0;for(;s<o&&n+s<r&&i[s]===e[n+s];)s++;if(s<o)return!1;n+=o,t=a}else return!1}return!0}removeWord(e){if(!e)return!1;let t=this,n=e.length,r=[];for(let i=0;i<n;i++){let n=e[i];if(t.c.has(n)){let e=t.c.get(n);r.push({parent:t,character:n}),i+=e.s.length-1,t=e}else return!1}for(t.d.clear(),t.e=!1;r.length>0&&t.c.size===0&&!t.e&&t.d.size===0;){let{parent:e,character:n}=r.pop();e.c.delete(n),t=e}return!0}removeDocumentByWord(e,t,n=!0){if(!e)return!0;let r=this,i=e.length;for(let a=0;a<i;a++){let i=e[a];if(r.c.has(i)){let o=r.c.get(i);a+=o.s.length-1,r=o,n&&r.w!==e||r.removeDocument(t)}else return!1}return!0}static getCommonPrefix(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e.charCodeAt(r)===t.charCodeAt(r);)r++;return e.slice(0,r)}toJSON(){return{w:this.w,s:this.s,e:this.e,k:this.k,d:Array.from(this.d),c:Array.from(this.c?.entries())?.map(([e,t])=>[e,t.toJSON()])}}static fromJSON(t){let n=new e(t.k,t.s,t.e);return n.w=t.w,n.d=new Set(t.d),n.c=new Map(t?.c?.map(([t,n])=>[t,e.fromJSON(n)])||[]),n}},pX=class e extends fX{constructor(){super(``,``,!1)}static fromJSON(t){let n=new e;return n.w=t.w,n.s=t.s,n.e=t.e,n.k=t.k,n.d=new Set(t.d),n.c=new Map(t?.c?.map(([e,t])=>[e,fX.fromJSON(t)])||[]),n}toJSON(){return super.toJSON()}},mX=2,hX=6371e3,gX=class e{point;docIDs;left;right;parent;constructor(e,t){this.point=e,this.docIDs=new Set(t),this.left=null,this.right=null,this.parent=null}toJSON(){return{point:this.point,docIDs:Array.from(this.docIDs),left:this.left?this.left.toJSON():null,right:this.right?this.right.toJSON():null}}static fromJSON(t,n=null){let r=new e(t.point,t.docIDs);return r.parent=n,t.left&&(r.left=e.fromJSON(t.left,r)),t.right&&(r.right=e.fromJSON(t.right,r)),r}},_X=class e{root;nodeMap;constructor(){this.root=null,this.nodeMap=new Map}getPointKey(e){return`${e.lon},${e.lat}`}insert(e,t){let n=this.getPointKey(e),r=this.nodeMap.get(n);if(r){t.forEach(e=>r.docIDs.add(e));return}let i=new gX(e,t);if(this.nodeMap.set(n,i),this.root==null){this.root=i;return}let a=this.root,o=0;for(;;){if(o%mX===0)if(e.lon<a.point.lon){if(a.left==null){a.left=i,i.parent=a;return}a=a.left}else{if(a.right==null){a.right=i,i.parent=a;return}a=a.right}else if(e.lat<a.point.lat){if(a.left==null){a.left=i,i.parent=a;return}a=a.left}else{if(a.right==null){a.right=i,i.parent=a;return}a=a.right}o++}}contains(e){let t=this.getPointKey(e);return this.nodeMap.has(t)}getDocIDsByCoordinates(e){let t=this.getPointKey(e),n=this.nodeMap.get(t);return n?Array.from(n.docIDs):null}removeDocByID(e,t){let n=this.getPointKey(e),r=this.nodeMap.get(n);r&&(r.docIDs.delete(t),r.docIDs.size===0&&(this.nodeMap.delete(n),this.deleteNode(r)))}deleteNode(e){let t=e.parent,n=e.left?e.left:e.right;n&&(n.parent=t),t?t.left===e?t.left=n:t.right===e&&(t.right=n):(this.root=n,this.root&&(this.root.parent=null))}searchByRadius(t,n,r=!0,i=`asc`,a=!1){let o=a?e.vincentyDistance:e.haversineDistance,s=[{node:this.root,depth:0}],c=[];for(;s.length>0;){let{node:e,depth:i}=s.pop();if(e==null)continue;let a=o(t,e.point);(r?a<=n:a>n)&&c.push({point:e.point,docIDs:Array.from(e.docIDs)}),e.left!=null&&s.push({node:e.left,depth:i+1}),e.right!=null&&s.push({node:e.right,depth:i+1})}return i&&c.sort((e,n)=>{let r=o(t,e.point),a=o(t,n.point);return i.toLowerCase()===`asc`?r-a:a-r}),c}searchByPolygon(t,n=!0,r=null,i=!1){let a=[{node:this.root,depth:0}],o=[];for(;a.length>0;){let{node:r,depth:i}=a.pop();if(r==null)continue;r.left!=null&&a.push({node:r.left,depth:i+1}),r.right!=null&&a.push({node:r.right,depth:i+1});let s=e.isPointInPolygon(t,r.point);(s&&n||!s&&!n)&&o.push({point:r.point,docIDs:Array.from(r.docIDs)})}let s=e.calculatePolygonCentroid(t);if(r){let t=i?e.vincentyDistance:e.haversineDistance;o.sort((e,n)=>{let i=t(s,e.point),a=t(s,n.point);return r.toLowerCase()===`asc`?i-a:a-i})}return o}toJSON(){return{root:this.root?this.root.toJSON():null}}static fromJSON(t){let n=new e;return t.root&&(n.root=gX.fromJSON(t.root),n.buildNodeMap(n.root)),n}buildNodeMap(e){if(e==null)return;let t=this.getPointKey(e.point);this.nodeMap.set(t,e),e.left&&this.buildNodeMap(e.left),e.right&&this.buildNodeMap(e.right)}static calculatePolygonCentroid(e){let t=0,n=0,r=0,i=e.length;for(let a=0,o=i-1;a<i;o=a++){let i=e[a].lon,s=e[a].lat,c=e[o].lon,l=e[o].lat,u=i*l-c*s;t+=u,n+=(i+c)*u,r+=(s+l)*u}t/=2;let a=6*t;return n/=a,r/=a,{lon:n,lat:r}}static isPointInPolygon(e,t){let n=!1,r=t.lon,i=t.lat,a=e.length;for(let t=0,o=a-1;t<a;o=t++){let a=e[t].lon,s=e[t].lat,c=e[o].lon,l=e[o].lat;s>i!=l>i&&r<(c-a)*(i-s)/(l-s)+a&&(n=!n)}return n}static haversineDistance(e,t){let n=Math.PI/180,r=e.lat*n,i=t.lat*n,a=(t.lat-e.lat)*n,o=(t.lon-e.lon)*n,s=Math.sin(a/2)*Math.sin(a/2)+Math.cos(r)*Math.cos(i)*Math.sin(o/2)*Math.sin(o/2);return hX*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}static vincentyDistance(e,t){let n=6378137,r=1/298.257223563,i=(1-r)*n,a=Math.PI/180,o=e.lat*a,s=t.lat*a,c=(t.lon-e.lon)*a,l=Math.atan((1-r)*Math.tan(o)),u=Math.atan((1-r)*Math.tan(s)),d=Math.sin(l),f=Math.cos(l),p=Math.sin(u),m=Math.cos(u),h=c,g,_=1e3,v,y,b,x,S,C;do{let e=Math.sin(h),t=Math.cos(h);if(v=Math.sqrt(m*e*(m*e)+(f*p-d*m*t)*(f*p-d*m*t)),v===0)return 0;y=d*p+f*m*t,b=Math.atan2(v,y),x=f*m*e/v,S=1-x*x,C=y-2*d*p/S,isNaN(C)&&(C=0);let n=r/16*S*(4+r*(4-3*S));g=h,h=c+(1-n)*r*x*(b+n*v*(C+n*y*(-1+2*C*C)))}while(Math.abs(h-g)>1e-12&&--_>0);if(_===0)return NaN;let ee=S*(n*n-i*i)/(i*i),te=1+ee/16384*(4096+ee*(-768+ee*(320-175*ee))),w=ee/1024*(256+ee*(-128+ee*(74-47*ee))),ne=w*v*(C+w/4*(y*(-1+2*C*C)-w/6*C*(-3+4*v*v)*(-3+4*C*C)));return i*te*(b-ne)}},vX=class e{true;false;constructor(){this.true=new Set,this.false=new Set}insert(e,t){t?this.true.add(e):this.false.add(e)}delete(e,t){t?this.true.delete(e):this.false.delete(e)}getSize(){return this.true.size+this.false.size}toJSON(){return{true:Array.from(this.true),false:Array.from(this.false)}}static fromJSON(t){let n=new e;return n.true=new Set(t.true),n.false=new Set(t.false),n}};function yX(e,t,n,r,i,{k:a,b:o,d:s}){return Math.log(1+(n-t+.5)/(t+.5))*(s+e*(a+1))/(e+a*(1-o+o*r/i))}var bX=class e{size;vectors=new Map;constructor(e){this.size=e}add(e,t){t instanceof Float32Array||(t=new Float32Array(t));let n=xX(t,this.size);this.vectors.set(e,[n,t])}remove(e){this.vectors.delete(e)}find(e,t,n){return e instanceof Float32Array||(e=new Float32Array(e)),SX(e,n,this.vectors,this.size,t)}toJSON(){let e=[];for(let[t,[n,r]]of this.vectors)e.push([t,[n,Array.from(r)]]);return{size:this.size,vectors:e}}static fromJSON(t){let n=t,r=new e(n.size);for(let[e,[t,i]]of n.vectors)r.vectors.set(e,[t,new Float32Array(i)]);return r}};function xX(e,t){let n=0;for(let r=0;r<t;r++)n+=e[r]*e[r];return Math.sqrt(n)}function SX(e,t,n,r,i){let a=xX(e,r),o=[],s=t||n.keys();for(let t of s){let s=n.get(t);if(!s)continue;let c=s[0],l=s[1],u=0;for(let t=0;t<r;t++)u+=e[t]*l[t];let d=u/(a*c);d>=i&&o.push([t,d])}return o}function CX(e,t,n,r,i){let a=BY(e.sharedInternalDocumentStore,n);e.avgFieldLength[t]=((e.avgFieldLength[t]??0)*(i-1)+r.length)/i,e.fieldLengths[t][a]=r.length,e.frequencies[t][a]={}}function wX(e,t,n,r,i){let a=0;for(let e of r)e===i&&a++;let o=BY(e.sharedInternalDocumentStore,n),s=a/r.length;e.frequencies[t][o][i]=s,i in e.tokenOccurrences[t]||(e.tokenOccurrences[t][i]=0),e.tokenOccurrences[t][i]=(e.tokenOccurrences[t][i]??0)+1}function TX(e,t,n,r){let i=BY(e.sharedInternalDocumentStore,n);r>1?e.avgFieldLength[t]=(e.avgFieldLength[t]*r-e.fieldLengths[t][i])/(r-1):e.avgFieldLength[t]=void 0,e.fieldLengths[t][i]=void 0,e.frequencies[t][i]=void 0}function EX(e,t,n){e.tokenOccurrences[t][n]--}function DX(e,t,n,r,i=``){r||={sharedInternalDocumentStore:t,indexes:{},vectorIndexes:{},searchableProperties:[],searchablePropertiesWithTypes:{},frequencies:{},tokenOccurrences:{},avgFieldLength:{},fieldLengths:{}};for(let[a,o]of Object.entries(n)){let n=`${i}${i?`.`:``}${a}`;if(typeof o==`object`&&!Array.isArray(o)){DX(e,t,o,r,n);continue}if(NY(o))r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o,r.vectorIndexes[n]={type:`Vector`,node:new bX(IY(o)),isArray:!1};else{let e=/\[/.test(o);switch(o){case`boolean`:case`boolean[]`:r.indexes[n]={type:`Bool`,node:new vX,isArray:e};break;case`number`:case`number[]`:r.indexes[n]={type:`AVL`,node:new cX(0,[]),isArray:e};break;case`string`:case`string[]`:r.indexes[n]={type:`Radix`,node:new pX,isArray:e},r.avgFieldLength[n]=0,r.frequencies[n]={},r.tokenOccurrences[n]={},r.fieldLengths[n]={};break;case`enum`:case`enum[]`:r.indexes[n]={type:`Flat`,node:new lX,isArray:e};break;case`geopoint`:r.indexes[n]={type:`BKD`,node:new _X,isArray:e};break;default:throw $(`INVALID_SCHEMA_TYPE`,Array.isArray(o)?`array`:o,n)}r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o}}return r}function OX(e,t,n,r,i,a,o,s){return c=>{let{type:l,node:u}=t.indexes[n];switch(l){case`Bool`:u[c?`true`:`false`].add(r);break;case`AVL`:{let e=s?.avlRebalanceThreshold??1;u.insert(c,r,e);break}case`Radix`:{let s=a.tokenize(c,i,n,!1);e.insertDocumentScoreParameters(t,n,r,s,o);for(let i of s)e.insertTokenScoreParameters(t,n,r,s,i),u.insert(i,r);break}case`Flat`:u.insert(c,r);break;case`BKD`:u.insert(c,[r]);break}}}function kX(e,t,n,r,i,a,o,s,c,l,u){if(NY(o))return AX(t,n,a,r,i);let d=OX(e,t,n,i,s,c,l,u);if(!PY(o))return d(a);let f=a,p=f.length;for(let e=0;e<p;e++)d(f[e])}function AX(e,t,n,r,i){e.vectorIndexes[t].node.add(i,n)}function jX(e,t,n,r,i,a,o,s,c,l){if(NY(o))return t.vectorIndexes[n].node.remove(i),!0;let{type:u,node:d}=t.indexes[n];switch(u){case`AVL`:return d.removeDocument(a,i),!0;case`Bool`:return d[a?`true`:`false`].delete(i),!0;case`Radix`:{let o=c.tokenize(a,s,n);e.removeDocumentScoreParameters(t,n,r,l);for(let r of o)e.removeTokenScoreParameters(t,n,r),d.removeDocumentByWord(r,i);return!0}case`Flat`:return d.removeDocument(i,a),!0;case`BKD`:return d.removeDocByID(a,i),!1}}function MX(e,t,n,r,i,a,o,s,c,l){if(!PY(o))return jX(e,t,n,r,i,a,o,s,c,l);let u=FY(o),d=a,f=d.length;for(let a=0;a<f;a++)jX(e,t,n,r,i,d[a],u,s,c,l);return!0}function NX(e,t,n,r,i,a,o,s,c,l){let u=Array.from(r),d=e.avgFieldLength[t],f=e.fieldLengths[t],p=e.tokenOccurrences[t],m=e.frequencies[t],h=typeof p[n]==`number`?p[n]??0:0,g=u.length;for(let e=0;e<g;e++){let r=u[e];if(c&&!c.has(r))continue;l.has(r)||l.set(r,new Map);let p=l.get(r);p.set(t,(p.get(t)||0)+1);let g=yX(m?.[r]?.[n]??0,h,i,f[r],d,a);o.has(r)?o.set(r,o.get(r)+g*s):o.set(r,g*s)}}function PX(e,t,n,r,i,a,o,s,c,l,u,d=0){let f=n.tokenize(t,r),p=f.length||1,m=new Map,h=new Map,g=new Map;for(let n of i){if(!(n in e.indexes))continue;let r=e.indexes[n],{type:i}=r;if(i!==`Radix`)throw $(`WRONG_SEARCH_PROPERTY_TYPE`,n);let d=s[n]??1;if(d<=0)throw $(`INVALID_BOOST_VALUE`,d);f.length===0&&!t&&f.push(``);let p=f.length;for(let t=0;t<p;t++){let i=f[t],s=r.node.find({term:i,exact:a,tolerance:o}),p=Object.keys(s);p.length>0&&h.set(i,!0);let _=p.length;for(let t=0;t<_;t++){let r=p[t],i=s[r];NX(e,n,r,i,l,c,g,d,u,m)}}}let _=Array.from(g.entries()).map(([e,t])=>[e,t]).sort((e,t)=>t[1]-e[1]);if(_.length===0)return[];if(d===1)return _;if(d===0){if(p===1)return _;for(let e of f)if(!h.get(e))return[];return _.filter(([e])=>{let t=m.get(e);return t?Array.from(t.values()).some(e=>e===p):!1})}let v=_.filter(([e])=>{let t=m.get(e);return t?Array.from(t.values()).some(e=>e===p):!1});if(v.length>0){let e=_.filter(([e])=>!v.some(([t])=>t===e)),t=Math.ceil(e.length*d);return[...v,...e.slice(0,t)]}return _}function FX(e,t,n,r){if(`and`in n&&n.and&&Array.isArray(n.and)){let i=n.and;return i.length===0?new Set:xY(...i.map(n=>FX(e,t,n,r)))}if(`or`in n&&n.or&&Array.isArray(n.or)){let i=n.or;return i.length===0?new Set:i.map(n=>FX(e,t,n,r)).reduce((e,t)=>CY(e,t),new Set)}if(`not`in n&&n.not){let i=n.not,a=new Set,o=e.sharedInternalDocumentStore;for(let e=1;e<=o.internalIdToId.length;e++)a.add(e);return wY(a,FX(e,t,i,r))}let i=Object.keys(n),a=i.reduce((e,t)=>({[t]:new Set,...e}),{});for(let o of i){let i=n[o];if(e.indexes[o]===void 0)throw $(`UNKNOWN_FILTER_PROPERTY`,o);let{node:s,type:c,isArray:l}=e.indexes[o];if(c===`Bool`){let e=s,t=i?e.true:e.false;a[o]=CY(a[o],t);continue}if(c===`BKD`){let e;if(`radius`in i)e=`radius`;else if(`polygon`in i)e=`polygon`;else throw Error(`Invalid operation ${i}`);if(e===`radius`){let{value:t,coordinates:n,unit:r=`m`,inside:c=!0,highPrecision:l=!1}=i[e],u=_Y(t,r),d=s.searchByRadius(n,u,c,void 0,l);a[o]=VX(a[o],d)}else{let{coordinates:t,inside:n=!0,highPrecision:r=!1}=i[e],c=s.searchByPolygon(t,n,void 0,r);a[o]=VX(a[o],c)}continue}if(c===`Radix`&&(typeof i==`string`||Array.isArray(i))){for(let e of[i].flat()){let n=t.tokenize(e,r,o);for(let e of n){let t=s.find({term:e,exact:!0});a[o]=GX(a[o],t)}}continue}let u=Object.keys(i);if(u.length>1)throw $(`INVALID_FILTER_OPERATION`,u.length);if(c===`Flat`){let e=new Set(l?s.filterArr(i):s.filter(i));a[o]=CY(a[o],e);continue}if(c===`AVL`){let e=u[0],t=i[e],n;switch(e){case`gt`:n=s.greaterThan(t,!1);break;case`gte`:n=s.greaterThan(t,!0);break;case`lt`:n=s.lessThan(t,!1);break;case`lte`:n=s.lessThan(t,!0);break;case`eq`:n=s.find(t)??new Set;break;case`between`:{let[e,r]=t;n=s.rangeSearch(e,r);break}default:throw $(`INVALID_FILTER_OPERATION`,e)}a[o]=CY(a[o],n)}}return xY(...Object.values(a))}function IX(e){return e.searchableProperties}function LX(e){return e.searchablePropertiesWithTypes}function RX(e,t){let{indexes:n,vectorIndexes:r,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}=t,u={},d={};for(let e of Object.keys(n)){let{node:t,type:r,isArray:i}=n[e];switch(r){case`Radix`:u[e]={type:`Radix`,node:pX.fromJSON(t),isArray:i};break;case`Flat`:u[e]={type:`Flat`,node:lX.fromJSON(t),isArray:i};break;case`AVL`:u[e]={type:`AVL`,node:cX.fromJSON(t),isArray:i};break;case`BKD`:u[e]={type:`BKD`,node:_X.fromJSON(t),isArray:i};break;case`Bool`:u[e]={type:`Bool`,node:vX.fromJSON(t),isArray:i};break;default:u[e]=n[e]}}for(let e of Object.keys(r))d[e]={type:`Vector`,isArray:!1,node:bX.fromJSON(r[e])};return{sharedInternalDocumentStore:e,indexes:u,vectorIndexes:d,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}}function zX(e){let{indexes:t,vectorIndexes:n,searchableProperties:r,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:o,avgFieldLength:s,fieldLengths:c}=e,l={};for(let e of Object.keys(n))l[e]=n[e].node.toJSON();let u={};for(let e of Object.keys(t)){let{type:n,node:r,isArray:i}=t[e];n===`Flat`||n===`Radix`||n===`AVL`||n===`BKD`||n===`Bool`?u[e]={type:n,node:r.toJSON(),isArray:i}:(u[e]=t[e],u[e].node=u[e].node.toJSON())}return{indexes:u,vectorIndexes:l,searchableProperties:r,searchablePropertiesWithTypes:i,frequencies:a,tokenOccurrences:o,avgFieldLength:s,fieldLengths:c}}function BX(){return{create:DX,insert:kX,remove:MX,insertDocumentScoreParameters:CX,insertTokenScoreParameters:wX,removeDocumentScoreParameters:TX,removeTokenScoreParameters:EX,calculateResultScores:NX,search:PX,searchByWhereClause:FX,getSearchableProperties:IX,getSearchablePropertiesWithTypes:LX,load:RX,save:zX}}function VX(e,t){e||=new Set;let n=t.length;for(let r=0;r<n;r++){let n=t[r].docIDs,i=n.length;for(let t=0;t<i;t++)e.add(n[t])}return e}function HX(e,t,n=!1){let r=n?_X.vincentyDistance:_X.haversineDistance,i=[],a=[];for(let{point:n}of e)a.push(r(t,n));let o=Math.max(...a),s=0;for(let{docIDs:t}of e){let e=o-a[s]+1;for(let n of t)i.push([n,e]);s++}return i.sort((e,t)=>t[1]-e[1]),i}function UX(e,t){let n=Object.keys(e);if(n.length!==1)return{isGeoOnly:!1};let r=n[0],i=e[r];if(t.indexes[r]===void 0)return{isGeoOnly:!1};let{type:a}=t.indexes[r];return a===`BKD`&&i&&(`radius`in i||`polygon`in i)?{isGeoOnly:!0,geoProperty:r,geoOperation:i}:{isGeoOnly:!1}}function WX(e,t){let n=e,r=UX(t,n);if(!r.isGeoOnly||!r.geoProperty||!r.geoOperation)return null;let{node:i}=n.indexes[r.geoProperty],a=r.geoOperation,o=i,s;if(`radius`in a){let{value:e,coordinates:t,unit:n=`m`,inside:r=!0,highPrecision:i=!1}=a.radius,c=t,l=_Y(e,n);return s=o.searchByRadius(c,l,r,`asc`,i),HX(s,c,i)}else if(`polygon`in a){let{coordinates:e,inside:t=!0,highPrecision:n=!1}=a.polygon;s=o.searchByPolygon(e,t,`asc`,n);let r=_X.calculatePolygonCentroid(e);return HX(s,r,n)}return null}function GX(e,t){e||=new Set;let n=Object.keys(t),r=n.length;for(let i=0;i<r;i++){let r=t[n[i]],a=r.length;for(let t=0;t<a;t++)e.add(r[t])}return e}function KX(e,t,n,r,i){let a={language:e.tokenizer.language,sharedInternalDocumentStore:t,enabled:!0,isSorted:!0,sortableProperties:[],sortablePropertiesWithTypes:{},sorts:{}};for(let[o,s]of Object.entries(n)){let n=`${i}${i?`.`:``}${o}`;if(!r.includes(n)){if(typeof s==`object`&&!Array.isArray(s)){let i=KX(e,t,s,r,n);rY(a.sortableProperties,i.sortableProperties),a.sorts={...a.sorts,...i.sorts},a.sortablePropertiesWithTypes={...a.sortablePropertiesWithTypes,...i.sortablePropertiesWithTypes};continue}if(!NY(s))switch(s){case`boolean`:case`number`:case`string`:a.sortableProperties.push(n),a.sortablePropertiesWithTypes[n]=s,a.sorts[n]={docs:new Map,orderedDocsToRemove:new Map,orderedDocs:[],type:s};break;case`geopoint`:case`enum`:continue;case`enum[]`:case`boolean[]`:case`number[]`:case`string[]`:continue;default:throw $(`INVALID_SORT_SCHEMA_TYPE`,Array.isArray(s)?`array`:s,n)}}}return a}function qX(e,t,n,r){return r?.enabled===!1?{disabled:!0}:KX(e,t,n,(r||{}).unsortableProperties||[],``)}function JX(e,t,n,r){if(!e.enabled)return;e.isSorted=!1;let i=BY(e.sharedInternalDocumentStore,n),a=e.sorts[t];a.orderedDocsToRemove.has(i)&&tZ(e,t),a.docs.set(i,a.orderedDocs.length),a.orderedDocs.push([i,r])}function YX(e){if(e.isSorted||!e.enabled)return;let t=Object.keys(e.sorts);for(let n of t)$X(e,n);e.isSorted=!0}function XX(e,t,n){return t[1].localeCompare(n[1],XJ(e))}function ZX(e,t){return e[1]-t[1]}function QX(e,t){return t[1]?-1:1}function $X(e,t){let n=e.sorts[t],r;switch(n.type){case`string`:r=XX.bind(null,e.language);break;case`number`:r=ZX.bind(null);break;case`boolean`:r=QX.bind(null);break}n.orderedDocs.sort(r);let i=n.orderedDocs.length;for(let e=0;e<i;e++){let t=n.orderedDocs[e][0];n.docs.set(t,e)}}function eZ(e){let t=Object.keys(e.sorts);for(let n of t)tZ(e,n)}function tZ(e,t){let n=e.sorts[t];n.orderedDocsToRemove.size&&(n.orderedDocs=n.orderedDocs.filter(e=>!n.orderedDocsToRemove.has(e[0])),n.orderedDocsToRemove.clear())}function nZ(e,t,n){if(!e.enabled)return;let r=e.sorts[t],i=BY(e.sharedInternalDocumentStore,n);r.docs.get(i)&&(r.docs.delete(i),r.orderedDocsToRemove.set(i,!0))}function rZ(e,t,n){if(!e.enabled)throw $(`SORT_DISABLED`);let r=n.property,i=n.order===`DESC`,a=e.sorts[r];if(!a)throw $(`UNABLE_TO_SORT_ON_UNKNOWN_FIELD`,r,e.sortableProperties.join(`, `));return tZ(e,r),YX(e),t.sort((t,n)=>{let r=a.docs.get(BY(e.sharedInternalDocumentStore,t[0])),o=a.docs.get(BY(e.sharedInternalDocumentStore,n[0])),s=r!==void 0,c=o!==void 0;return!s&&!c?0:s?c?i?o-r:r-o:-1:1}),t}function iZ(e){return e.enabled?e.sortableProperties:[]}function aZ(e){return e.enabled?e.sortablePropertiesWithTypes:{}}function oZ(e,t){let n=t;if(!n.enabled)return{enabled:!1};let r=Object.keys(n.sorts).reduce((e,t)=>{let{docs:r,orderedDocs:i,type:a}=n.sorts[t];return e[t]={docs:new Map(Object.entries(r).map(([e,t])=>[+e,t])),orderedDocsToRemove:new Map,orderedDocs:i,type:a},e},{});return{sharedInternalDocumentStore:e,language:n.language,sortableProperties:n.sortableProperties,sortablePropertiesWithTypes:n.sortablePropertiesWithTypes,sorts:r,enabled:!0,isSorted:n.isSorted}}function sZ(e){if(!e.enabled)return{enabled:!1};eZ(e),YX(e);let t=Object.keys(e.sorts).reduce((t,n)=>{let{docs:r,orderedDocs:i,type:a}=e.sorts[n];return t[n]={docs:Object.fromEntries(r.entries()),orderedDocs:i,type:a},t},{});return{language:e.language,sortableProperties:e.sortableProperties,sortablePropertiesWithTypes:e.sortablePropertiesWithTypes,sorts:t,enabled:e.enabled,isSorted:e.isSorted}}function cZ(){return{create:qX,insert:JX,remove:nZ,save:sZ,load:oZ,sortBy:rZ,getSortableProperties:iZ,getSortablePropertiesWithTypes:aZ}}var lZ=192,Ite=383,uZ=[65,65,65,65,65,65,65,67,69,69,69,69,73,73,73,73,69,78,79,79,79,79,79,null,79,85,85,85,85,89,80,115,97,97,97,97,97,97,97,99,101,101,101,101,105,105,105,105,101,110,111,111,111,111,111,null,111,117,117,117,117,121,112,121,65,97,65,97,65,97,67,99,67,99,67,99,67,99,68,100,68,100,69,101,69,101,69,101,69,101,69,101,71,103,71,103,71,103,71,103,72,104,72,104,73,105,73,105,73,105,73,105,73,105,73,105,74,106,75,107,107,76,108,76,108,76,108,76,108,76,108,78,110,78,110,78,110,110,78,110,79,111,79,111,79,111,79,111,82,114,82,114,82,114,83,115,83,115,83,115,83,115,84,116,84,116,84,116,85,117,85,117,85,117,85,117,85,117,85,117,87,119,89,121,89,90,122,90,122,90,122,115];function dZ(e){return e<lZ||e>Ite?e:uZ[e-lZ]||e}function fZ(e){let t=[];for(let n=0;n<e.length;n++)t[n]=dZ(e.charCodeAt(n));return String.fromCharCode(...t)}var pZ={ational:`ate`,tional:`tion`,enci:`ence`,anci:`ance`,izer:`ize`,bli:`ble`,alli:`al`,entli:`ent`,eli:`e`,ousli:`ous`,ization:`ize`,ation:`ate`,ator:`ate`,alism:`al`,iveness:`ive`,fulness:`ful`,ousness:`ous`,aliti:`al`,iviti:`ive`,biliti:`ble`,logi:`log`},mZ={icate:`ic`,ative:``,alize:`al`,iciti:`ic`,ical:`ic`,ful:``,ness:``},hZ=`[^aeiou]`,gZ=`[aeiouy]`,_Z=hZ+`[^aeiouy]*`;gZ+``;var vZ=`^(`+_Z+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,yZ=`^(`+_Z+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$`,bZ=`^(`+_Z+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,xZ=`^(`+_Z+`)?[aeiouy]`;function SZ(e){let t,n,r,i,a,o;if(e.length<3)return e;let s=e.substring(0,1);if(s==`y`&&(e=s.toUpperCase()+e.substring(1)),r=/^(.+?)(ss|i)es$/,i=/^(.+?)([^s])s$/,r.test(e)?e=e.replace(r,`$1$2`):i.test(e)&&(e=e.replace(i,`$1$2`)),r=/^(.+?)eed$/,i=/^(.+?)(ed|ing)$/,r.test(e)){let t=r.exec(e);r=new RegExp(vZ),r.test(t[1])&&(r=/.$/,e=e.replace(r,``))}else i.test(e)&&(t=i.exec(e)[1],i=new RegExp(xZ),i.test(t)&&(e=t,i=/(at|bl|iz)$/,a=RegExp(`([^aeiouylsz])\\1$`),o=RegExp(`^`+_Z+gZ+`[^aeiouwxy]$`),i.test(e)?e+=`e`:a.test(e)?(r=/.$/,e=e.replace(r,``)):o.test(e)&&(e+=`e`)));if(r=/^(.+?)y$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(xZ),t&&r.test(t)&&(e=t+`i`)),r=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,r.test(e)){let i=r.exec(e);t=i?.[1],n=i?.[2],r=new RegExp(vZ),t&&r.test(t)&&(e=t+pZ[n])}if(r=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,r.test(e)){let i=r.exec(e);t=i?.[1],n=i?.[2],r=new RegExp(vZ),t&&r.test(t)&&(e=t+mZ[n])}if(r=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,i=/^(.+?)(s|t)(ion)$/,r.test(e))t=r.exec(e)?.[1],r=new RegExp(bZ),t&&r.test(t)&&(e=t);else if(i.test(e)){let n=i.exec(e);t=n?.[1]??``+n?.[2]??``,i=new RegExp(bZ),i.test(t)&&(e=t)}return r=/^(.+?)e$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(bZ),i=new RegExp(yZ),a=RegExp(`^`+_Z+gZ+`[^aeiouwxy]$`),t&&(r.test(t)||i.test(t)&&!a.test(t))&&(e=t)),r=/ll$/,i=new RegExp(bZ),r.test(e)&&i.test(e)&&(r=/.$/,e=e.replace(r,``)),s==`y`&&(e=s.toLowerCase()+e.substring(1)),e}function CZ(e,t,n=!0){let r=`${this.language}:${e}:${t}`;return n&&this.normalizationCache.has(r)?this.normalizationCache.get(r):this.stopWords?.includes(t)?(n&&this.normalizationCache.set(r,``),``):(this.stemmer&&!this.stemmerSkipProperties.has(e)&&(t=this.stemmer(t)),t=fZ(t),n&&this.normalizationCache.set(r,t),t)}function wZ(e){for(;e[e.length-1]===``;)e.pop();for(;e[0]===``;)e.shift();return e}function TZ(e,t,n,r=!0){if(t&&t!==this.language)throw $(`LANGUAGE_NOT_SUPPORTED`,t);if(typeof e!=`string`)return[e];let i=this.normalizeToken.bind(this,n??``),a;if(n&&this.tokenizeSkipProperties.has(n))a=[i(e,r)];else{let t=JJ[this.language];a=e.toLowerCase().split(t).map(e=>i(e,r)).filter(Boolean)}let o=wZ(a);return this.allowDuplicates?o:Array.from(new Set(o))}function EZ(e={}){if(!e.language)e.language=`english`;else if(!YJ.includes(e.language))throw $(`LANGUAGE_NOT_SUPPORTED`,e.language);let t;if(e.stemming||e.stemmer&&!(`stemming`in e))if(e.stemmer){if(typeof e.stemmer!=`function`)throw $(`INVALID_STEMMER_FUNCTION_TYPE`);t=e.stemmer}else if(e.language===`english`)t=SZ;else throw $(`MISSING_STEMMER`,e.language);let n;if(e.stopWords!==!1){if(n=[],Array.isArray(e.stopWords))n=e.stopWords;else if(typeof e.stopWords==`function`)n=e.stopWords(n);else if(e.stopWords)throw $(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);if(!Array.isArray(n))throw $(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);for(let e of n)if(typeof e!=`string`)throw $(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`)}let r={tokenize:TZ,language:e.language,stemmer:t,stemmerSkipProperties:new Set(e.stemmerSkipProperties?[e.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(e.tokenizeSkipProperties?[e.tokenizeSkipProperties].flat():[]),stopWords:n,allowDuplicates:!!e.allowDuplicates,normalizeToken:CZ,normalizationCache:new Map};return r.tokenize=TZ.bind(r),r.normalizeToken=CZ,r}function DZ(e){return{sharedInternalDocumentStore:e,rules:new Map}}function OZ(e,t){if(e.rules.has(t.id))throw Error(`PINNING_RULE_ALREADY_EXISTS: A pinning rule with id "${t.id}" already exists. Use updateRule to modify it.`);e.rules.set(t.id,t)}function kZ(e,t){if(!e.rules.has(t.id))throw Error(`PINNING_RULE_NOT_FOUND: Cannot update pinning rule with id "${t.id}" because it does not exist. Use addRule to create it.`);e.rules.set(t.id,t)}function AZ(e,t){return e.rules.delete(t)}function jZ(e,t){return e.rules.get(t)}function MZ(e){return Array.from(e.rules.values())}function NZ(e,t){let n=e.toLowerCase().trim(),r=t.pattern.toLowerCase().trim();switch(t.anchoring){case`is`:return n===r;case`starts_with`:return n.startsWith(r);case`contains`:return n.includes(r);default:return!1}}function PZ(e,t){return e?t.conditions.every(t=>NZ(e,t)):!1}function FZ(e,t){if(!t)return[];let n=[];for(let r of e.rules.values())PZ(t,r)&&n.push(r);return n}function IZ(e,t){return{sharedInternalDocumentStore:e,rules:new Map(t?.rules??[])}}function LZ(e){return{rules:Array.from(e.rules.entries())}}function RZ(){return{create:DZ,addRule:OZ,updateRule:kZ,removeRule:AZ,getRule:jZ,getAllRules:MZ,getMatchingRules:FZ,load:IZ,save:LZ}}function zZ(e){let t={formatElapsedTime:DY,getDocumentIndexId:OY,getDocumentProperties:mY,validateSchema:kY};for(let n of tX){let r=n;if(e[r]){if(typeof e[r]!=`function`)throw $(`COMPONENT_MUST_BE_FUNCTION`,r)}else e[r]=t[r]}for(let t of Object.keys(e))if(!eX.includes(t)&&!tX.includes(t))throw $(`UNSUPPORTED_COMPONENT`,t)}function BZ({schema:e,sort:t,language:n,components:r,id:i,plugins:a}){r||={};for(let t of a??[]){if(!(`getComponents`in t)||typeof t.getComponents!=`function`)continue;let n=t.getComponents(e),i=Object.keys(n);for(let e of i)if(r[e])throw $(`PLUGIN_COMPONENT_CONFLICT`,e,t.name);r={...r,...n}}i||=uY();let o=r.tokenizer,s=r.index,c=r.documentsStore,l=r.sorter,u=r.pinning;if(o=o?o.tokenize?o:EZ(o):EZ({language:n??`english`}),r.tokenizer&&n)throw $(`NO_LANGUAGE_WITH_CUSTOM_TOKENIZER`);let d=LY();s||=BX(),l||=cZ(),c||=ZY(),u||=RZ(),zZ(r);let{getDocumentProperties:f,getDocumentIndexId:p,validateSchema:m,formatElapsedTime:h}=r,g={data:{},caches:{},schema:e,tokenizer:o,index:s,sorter:l,documentsStore:c,pinning:u,internalDocumentIDStore:d,getDocumentProperties:f,getDocumentIndexId:p,validateSchema:m,beforeInsert:[],afterInsert:[],beforeRemove:[],afterRemove:[],beforeUpdate:[],afterUpdate:[],beforeUpsert:[],afterUpsert:[],beforeSearch:[],afterSearch:[],beforeInsertMultiple:[],afterInsertMultiple:[],beforeRemoveMultiple:[],afterRemoveMultiple:[],beforeUpdateMultiple:[],afterUpdateMultiple:[],beforeUpsertMultiple:[],afterUpsertMultiple:[],afterCreate:[],formatElapsedTime:h,id:i,plugins:a,version:VZ()};g.data={index:g.index.create(g,d,e),docs:g.documentsStore.create(g,d),sorting:g.sorter.create(g,d,e,t),pinning:g.pinning.create(d)};for(let e of QY)g[e]=(g[e]??[]).concat($Y(g,e));let _=g.afterCreate;return _&&oX(_,g),g}function VZ(){return`{{VERSION}}`}function HZ(e){return e.documentsStore.count(e.data.docs)}function UZ(e,t,n,r,i){let a=e.validateSchema(t,e.schema);if(a)throw $(`SCHEMA_VALIDATION_FAILURE`,a);return yY(e.beforeInsert)||yY(e.afterInsert)||yY(e.index.beforeInsert)||yY(e.index.insert)||yY(e.index.afterInsert)?KZ(e,t,n,r,i):qZ(e,t,n,r,i)}var WZ=new Set([`enum`,`enum[]`]),GZ=new Set([`string`,`number`]);async function KZ(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw $(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=BY(e.internalDocumentIDStore,s);if(r||await nX(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw $(`DOCUMENT_ALREADY_EXISTS`,s);let l=e.documentsStore.count(o),u=e.index.getSearchableProperties(a),d=e.index.getSearchablePropertiesWithTypes(a),f=e.getDocumentProperties(t,u);for(let[e,t]of Object.entries(f)){if(t===void 0)continue;let n=typeof t,r=d[e];JZ(n,r,e,t)}return await YZ(e,s,u,f,l,n,t,i),r||await nX(e.afterInsert,e,s,t),s}function qZ(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw $(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=BY(e.internalDocumentIDStore,s);if(r||nX(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw $(`DOCUMENT_ALREADY_EXISTS`,s);let l=e.documentsStore.count(o),u=e.index.getSearchableProperties(a),d=e.index.getSearchablePropertiesWithTypes(a),f=e.getDocumentProperties(t,u);for(let[e,t]of Object.entries(f)){if(t===void 0)continue;let n=typeof t,r=d[e];JZ(n,r,e,t)}return XZ(e,s,u,f,l,n,t,i),r||nX(e.afterInsert,e,s,t),s}function JZ(e,t,n,r){if(!(MY(t)&&typeof r==`object`&&typeof r.lon==`number`&&typeof r.lat==`number`)&&!(NY(t)&&Array.isArray(r))&&!(PY(t)&&Array.isArray(r))&&!(WZ.has(t)&&GZ.has(e))&&e!==t)throw $(`INVALID_DOCUMENT_PROPERTY`,n,t,e)}async function YZ(e,t,n,r,i,a,o,s){for(let o of n){let n=r[o];if(n===void 0)continue;let c=e.index.getSearchablePropertiesWithTypes(e.data.index)[o];await e.index.beforeInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i);let l=e.internalDocumentIDStore.idToInternalId.get(t);await e.index.insert(e.index,e.data.index,o,t,l,n,c,a,e.tokenizer,i,s),await e.index.afterInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i)}let c=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(o,c);for(let n of c){let r=l[n];if(r===void 0)continue;let i=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[n];e.sorter.insert(e.data.sorting,n,t,r,i,a)}}function XZ(e,t,n,r,i,a,o,s){for(let o of n){let n=r[o];if(n===void 0)continue;let c=e.index.getSearchablePropertiesWithTypes(e.data.index)[o],l=BY(e.internalDocumentIDStore,t);e.index.beforeInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i),e.index.insert(e.index,e.data.index,o,t,l,n,c,a,e.tokenizer,i,s),e.index.afterInsert?.(e.data.index,o,t,n,c,a,e.tokenizer,i)}let c=e.sorter.getSortableProperties(e.data.sorting),l=e.getDocumentProperties(o,c);for(let n of c){let r=l[n];if(r===void 0)continue;let i=e.sorter.getSortablePropertiesWithTypes(e.data.sorting)[n];e.sorter.insert(e.data.sorting,n,t,r,i,a)}}function ZZ(e,t,n,r,i,a){return yY(e.afterInsertMultiple)||yY(e.beforeInsertMultiple)||yY(e.index.beforeInsert)||yY(e.index.insert)||yY(e.index.afterInsert)?QZ(e,t,n,r,i,a):$Z(e,t,n,r,i,a)}async function QZ(e,t,n=1e3,r,i,a=0){let o=[],s=async a=>{let s=Math.min(a+n,t.length),c=t.slice(a,s);for(let t of c){let n=await UZ(e,t,r,i,{avlRebalanceThreshold:c.length});o.push(n)}return s};return await(async()=>{let e=0;for(;e<t.length;){let t=Date.now();if(e=await s(e),a>0){let e=a-(Date.now()-t);e>0&&TY(e)}}})(),i||await rX(e.afterInsertMultiple,e,t),o}function $Z(e,t,n=1e3,r,i,a=0){let o=[],s=0;function c(){let a=t.slice(s*n,(s+1)*n);if(a.length===0)return!1;for(let t of a){let n=UZ(e,t,r,i,{avlRebalanceThreshold:a.length});o.push(n)}return s++,!0}function l(){let e=Date.now();for(;c();)if(a>0){let t=Date.now()-e;if(t>=a){let e=a-t%a;e>0&&TY(e)}}}return l(),i||rX(e.afterInsertMultiple,e,t),o}function eQ(e,t){return e[1]-t[1]}function tQ(e,t){return t[1]-e[1]}function nQ(e=`desc`){return e.toLowerCase()===`asc`?eQ:tQ}function rQ(e,t,n){let r={},i=t.map(([e])=>e),a=e.documentsStore.getMultiple(e.data.docs,i),o=Object.keys(n),s=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e of o){let t;if(s[e]===`number`){let{ranges:r}=n[e],i=r.length,a=Array.from({length:i});for(let e=0;e<i;e++){let t=r[e];a[e]=[`${t.from}-${t.to}`,0]}t=Object.fromEntries(a)}r[e]={count:0,values:t??{}}}let c=a.length;for(let e=0;e<c;e++){let t=a[e];for(let e of o){let i=e.includes(`.`)?hY(t,e):t[e],a=s[e],o=r[e].values;switch(a){case`number`:{let t=n[e].ranges;iQ(t,o)(i);break}case`number[]`:{let t=new Set,r=n[e].ranges,a=iQ(r,o,t);for(let e of i)a(e);break}case`boolean`:case`enum`:case`string`:aQ(o,a)(i);break;case`boolean[]`:case`enum[]`:case`string[]`:{let e=aQ(o,a===`boolean[]`?`boolean`:`string`,new Set);for(let t of i)e(t);break}default:throw $(`FACET_NOT_SUPPORTED`,a)}}}for(let e of o){let t=r[e];if(t.count=Object.keys(t.values).length,s[e]===`string`){let r=n[e],i=nQ(r.sort);t.values=Object.fromEntries(Object.entries(t.values).sort(i).slice(r.offset??0,r.limit??10))}}return r}function iQ(e,t,n){return r=>{for(let i of e){let e=`${i.from}-${i.to}`;n?.has(e)||r>=i.from&&r<=i.to&&(t[e]===void 0?t[e]=1:(t[e]++,n?.add(e)))}}}function aQ(e,t,n){let r=t===`boolean`?`false`:``;return t=>{let i=t?.toString()??r;n?.has(i)||(e[i]=(e[i]??0)+1,n?.add(i))}}var oQ={reducer:(e,t,n,r)=>(t[r]=n,t),getInitialValue:e=>Array.from({length:e})},sQ=[`string`,`number`,`boolean`];function cQ(e,t,n){let r=n.properties,i=r.length,a=e.index.getSearchablePropertiesWithTypes(e.data.index);for(let e=0;e<i;e++){let t=r[e];if(a[t]===void 0)throw $(`UNKNOWN_GROUP_BY_PROPERTY`,t);if(!sQ.includes(a[t]))throw $(`INVALID_GROUP_BY_PROPERTY`,t,sQ.join(`, `),a[t])}let o=t.map(([t])=>VY(e.internalDocumentIDStore,t)),s=e.documentsStore.getMultiple(e.data.docs,o),c=s.length,l=n.maxResult||2**53-1,u=[],d={};for(let e=0;e<i;e++){let t=r[e],n={property:t,perValue:{}},i=new Set;for(let e=0;e<c;e++){let r=s[e],a=hY(r,t);if(a===void 0)continue;let o=typeof a==`boolean`?``+a:a,c=n.perValue[o]??{indexes:[],count:0};c.count>=l||(c.indexes.push(e),c.count++,n.perValue[o]=c,i.add(a))}u.push(Array.from(i)),d[t]=n}let f=lQ(u),p=f.length,m=[];for(let e=0;e<p;e++){let t=f[e],n=t.length,i={values:[],indexes:[]},a=[];for(let e=0;e<n;e++){let n=t[e],o=r[e];a.push(d[o].perValue[typeof n==`boolean`?``+n:n].indexes),i.values.push(n)}i.indexes=pY(a).sort((e,t)=>e-t),i.indexes.length!==0&&m.push(i)}let h=m.length,g=Array.from({length:h});for(let e=0;e<h;e++){let r=m[e],i=n.reduce||oQ,a=r.indexes.map(e=>({id:o[e],score:t[e][1],document:s[e]})),c=i.reducer.bind(null,r.values),l=i.getInitialValue(r.indexes.length),u=a.reduce(c,l);g[e]={values:r.values,result:u}}return g}function lQ(e,t=0){if(t+1===e.length)return e[t].map(e=>[e]);let n=e[t],r=lQ(e,t+1),i=[];for(let e of n)for(let t of r){let n=[e];rY(n,t),i.push(n)}return i}function uQ(e,t,n,r){let i=FZ(t,r);if(i.length===0)return n;let a=i.flatMap(e=>e.consequence.promote);a.sort((e,t)=>e.position-t.position);let o=new Set,s=new Map,c=new Set;for(let t of a){let n=BY(e.internalDocumentIDStore,t.doc_id);if(n!==void 0){if(s.has(n)){let e=s.get(n);t.position<e&&s.set(n,t.position);continue}c.has(t.position)||(o.add(n),s.set(n,t.position),c.add(t.position))}}if(s.size===0)return n;let l=n.filter(([e])=>!o.has(e)),u=[];for(let[t,r]of s.entries())n.find(([e])=>e===t)?u.push([t,1e6-r]):e.documentsStore.get(e.data.docs,t)&&u.push([t,0]);u.sort((e,t)=>(s.get(e[0])??1/0)-(s.get(t[0])??1/0));let d=[],f=new Map;for(let e of u){let t=s.get(e[0]);f.set(t,e)}let p=0,m=0;for(;m<l.length+u.length;)if(f.has(m))d.push(f.get(m)),m++;else if(p<l.length)d.push(l[p]),p++,m++;else break;for(let[e,t]of f.entries())e>=d.length&&d.push(t);return d}function dQ(e,t,n){let{term:r,properties:i}=t,a=e.data.index,o=e.caches.propertiesToSearch;if(!o){let t=e.index.getSearchablePropertiesWithTypes(a);o=e.index.getSearchableProperties(a),o=o.filter(e=>t[e].startsWith(`string`)),e.caches.propertiesToSearch=o}if(i&&i!==`*`){for(let e of i)if(!o.includes(e))throw $(`UNKNOWN_INDEX`,e,o.join(`, `));o=o.filter(e=>i.includes(e))}let s=Object.keys(t.where??{}).length>0,c;s&&(c=e.index.searchByWhereClause(a,e.tokenizer,t.where,n));let l,u=t.threshold!==void 0&&t.threshold!==null?t.threshold:1;if(r||i){let i=HZ(e);if(l=e.index.search(a,r||``,e.tokenizer,n,o,t.exact||!1,t.tolerance||0,t.boost||{},gQ(t.relevance),i,c,u),t.exact&&r){let t=r.trim().split(/\s+/);l=l.filter(([n])=>{let r=e.documentsStore.get(e.data.docs,n);if(!r)return!1;for(let e of o){let n=pQ(r,e);if(typeof n==`string`&&t.every(e=>RegExp(`\\b${fQ(e)}\\b`).test(n)))return!0}return!1})}}else l=s?WX(a,t.where)||(c?Array.from(c):[]).map(e=>[+e,0]):Object.keys(e.documentsStore.getAll(e.data.docs)).map(e=>[+e,0]);return l}function fQ(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function pQ(e,t){let n=t.split(`.`),r=e;for(let e of n)if(r&&typeof r==`object`&&e in r)r=r[e];else return;return r}function mQ(e,t,n){let r=lY();function i(){let i=Object.keys(e.data.index.vectorIndexes),a=t.facets&&Object.keys(t.facets).length>0,{limit:o=10,offset:s=0,distinctOn:c,includeVectors:l=!1}=t,u=t.preflight===!0,d=dQ(e,t,n);if(t.sortBy)if(typeof t.sortBy==`function`){let n=d.map(([e])=>e),r=e.documentsStore.getMultiple(e.data.docs,n).map((e,t)=>[d[t][0],d[t][1],e]);r.sort(t.sortBy),d=r.map(([e,t])=>[e,t])}else d=e.sorter.sortBy(e.data.sorting,d,t.sortBy).map(([t,n])=>[BY(e.internalDocumentIDStore,t),n]);else d=d.sort(fY);d=uQ(e,e.data.pinning,d,t.term);let f;u||(f=c?OQ(e,d,s,o,c):kQ(e,d,s,o));let p={elapsed:{formatted:``,raw:0},hits:[],count:d.length};return f!==void 0&&(p.hits=f.filter(Boolean),l||vY(p,i)),a&&(p.facets=rQ(e,d,t.facets)),t.groupBy&&(p.groups=cQ(e,d,t.groupBy)),p.elapsed=e.formatElapsedTime(lY()-r),p}async function a(){e.beforeSearch&&await aX(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await iX(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}var hQ={k:1.2,b:.75,d:.5};function gQ(e){let t=e??{};return t.k=t.k??hQ.k,t.b=t.b??hQ.b,t.d=t.d??hQ.d,t}function _Q(e,t,n){let r=t.vector;if(r&&(!(`value`in r)||!(`property`in r)))throw $(`INVALID_VECTOR_INPUT`,Object.keys(r).join(`, `));let i=e.data.index.vectorIndexes[r.property];if(!i)throw $(`UNKNOWN_VECTOR_PROPERTY`,r.property);let a=i.node.size;if(r?.value.length!==a)throw r?.property===void 0||r?.value.length===void 0?$(`INVALID_INPUT_VECTOR`,`undefined`,a,`undefined`):$(`INVALID_INPUT_VECTOR`,r.property,a,r.value.length);let o=e.data.index,s;return Object.keys(t.where??{}).length>0&&(s=e.index.searchByWhereClause(o,e.tokenizer,t.where,n)),i.node.find(r.value,t.similarity??.8,s)}function vQ(e,t,n=`english`){let r=lY();function i(){let i=_Q(e,t,n).sort(fY);i=uQ(e,e.data.pinning,i,void 0);let a=[];t.facets&&Object.keys(t.facets).length>0&&(a=rQ(e,i,t.facets));let o=t.vector.property,s=t.includeVectors??!1,c=t.limit??10,l=t.offset??0,u=Array.from({length:c});for(let t=0;t<c;t++){let n=i[t+l];if(!n)break;let r=e.data.docs.docs[n[0]];r&&(s||(r[o]=null),u[t]={id:VY(e.internalDocumentIDStore,n[0]),score:n[1],document:r})}let d=[];t.groupBy&&(d=cQ(e,i,t.groupBy));let f=lY()-r;return{count:i.length,hits:u.filter(Boolean),elapsed:{raw:Number(f),formatted:cY(f)},...a?{facets:a}:{},...d?{groups:d}:{}}}async function a(){e.beforeSearch&&await aX(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await iX(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function yQ(e,t,n){let r=SQ(dQ(e,t,n)),i=_Q(e,t,n),a=t.hybridWeights;return TQ(r,i,t.term??``,a)}function bQ(e,t,n){let r=lY();function i(){let i=yQ(e,t,n);i=uQ(e,e.data.pinning,i,t.term);let a;t.facets&&Object.keys(t.facets).length>0&&(a=rQ(e,i,t.facets));let o;t.groupBy&&(o=cQ(e,i,t.groupBy));let s=t.offset??0,c=t.limit??10,l=kQ(e,i,s,c).filter(Boolean),u=lY(),d={count:i.length,elapsed:{raw:Number(u-r),formatted:cY(u-r)},hits:l,...a?{facets:a}:{},...o?{groups:o}:{}};return(t.includeVectors??!1)||vY(d,Object.keys(e.data.index.vectorIndexes)),d}async function a(){e.beforeSearch&&await aX(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await iX(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function xQ(e){return e[1]}function SQ(e){let t=Math.max.apply(Math,e.map(xQ));return e.map(([e,n])=>[e,n/t])}function CQ(e,t){return e/t}function wQ(e,t){return(n,r)=>n*e+r*t}function TQ(e,t,n,r){let i=Math.max.apply(Math,e.map(xQ)),a=Math.max.apply(Math,t.map(xQ)),{text:o,vector:s}=r&&r.text&&r.vector?r:EQ(n),c=new Map,l=e.length,u=wQ(o,s);for(let t=0;t<l;t++){let[n,r]=e[t],a=u(CQ(r,i),0);c.set(n,a)}let d=t.length;for(let e=0;e<d;e++){let[n,r]=t[e],i=CQ(r,a),o=c.get(n)??0;c.set(n,o+u(0,i))}return[...c].sort((e,t)=>t[1]-e[1])}function EQ(e){return{text:.5,vector:.5}}function DQ(e,t,n){let r=t.mode??`fulltext`;if(r===`fulltext`)return mQ(e,t,n);if(r===`vector`)return vQ(e,t);if(r===`hybrid`)return bQ(e,t);throw $(`INVALID_SEARCH_MODE`,r)}function OQ(e,t,n,r,i){let a=e.data.docs,o=new Map,s=[],c=new Set,l=t.length,u=0;for(let d=0;d<l;d++){let l=t[d];if(l===void 0)continue;let[f,p]=l;if(c.has(f))continue;let m=e.documentsStore.get(a,f),h=hY(m,i);if(!(h===void 0||o.has(h))&&(o.set(h,!0),u++,!(u<=n)&&(s.push({id:VY(e.internalDocumentIDStore,f),score:p,document:m}),c.add(f),u>=n+r)))break}return s}function kQ(e,t,n,r){let i=e.data.docs,a=Array.from({length:r}),o=new Set;for(let s=n;s<r+n;s++){let n=t[s];if(n===void 0)break;let[r,c]=n;if(!o.has(r)){let t=e.documentsStore.get(i,r);a[s]={id:VY(e.internalDocumentIDStore,r),score:c,document:t},o.add(r)}}return a}new Jv.default;var AQ=new Jv.default;AQ.Diff_Timeout=.25;var jQ=A({path:k(Ia([E(),D()])),message:E(),issueCode:E()});Ra(`code`,[A({code:M(`SCHEMA_INVALID`),issues:k(jQ)}),A({code:M(`WRITE_ERROR`),detail:E()})]);function MQ(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}function NQ(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 PQ=`frontmatter`,FQ=[`text`,`number`,`boolean`,`date`,`list`,`object`];j(FQ);var IQ=Ia([E(),D(),O()]),LQ=po(()=>Ia([IQ.transform(e=>String(e)),Ha(E(),RQ),k(LQ)])),RQ=po(()=>Ia([E(),D(),O(),k(LQ),Ha(E(),RQ)])),zQ=/^\d{4}-\d{2}-\d{2}$/;function BQ(e){return typeof e==`string`&&zQ.test(e)}function VQ(e){return Array.isArray(e)?`list`:typeof e==`object`&&e?`object`:typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:BQ(e)?`date`:`text`}var HQ=Ha(E(),RQ),UQ=Ha(E(),Ia([RQ,Da()]));function WQ(e){return!!(e===null||typeof e==`string`&&e===``||Array.isArray(e)&&e.length===0)}function GQ(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(!GQ(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)||!GQ(e[r],t[r]))return!1;return!0}return!1}var KQ=/^---[ \t]*\r?\n([\s\S]*?\r?\n)?---[ \t]*(\r?\n|$)/,qQ=/^---[ \t]*$/;function JQ(e){let t=e.match(KQ);return t?{frontmatter:t[0],body:e.slice(t[0].length)}:{frontmatter:``,body:e}}function YQ(e){if(e===``)return``;let t=e.match(KQ);return t?(t[1]??``).replace(/\r?\n$/,``):e}var XQ={defaultKeyType:`PLAIN`,defaultStringType:`PLAIN`,lineWidth:0};function ZQ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function QQ(e,t,n){if(Array.isArray(n)){let r=e.createNode(n),i=Ao(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}if(ZQ(n)){let r=e.createNode(n),i=Do(t)?t.flow:void 0;return i!==void 0&&(r.flow=i),r}return n}function $Q(e){return e===``?``:`---\n${e.endsWith(`
384
- `)?e.slice(0,-1):e}\n---\n`}var e$=65536;function t$(e){let t=e.match(KQ);return t?{fenced:t[0],body:e.slice(t[0].length)}:{fenced:``,body:e}}function n$(e){if(e.trim()===``)return{doc:new Vc({}),map:{}};let t;try{t=Zl(e,{uniqueKeys:!1})}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new Vc({}),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=HQ.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 r$(e){return e===``?{doc:new Vc({}),map:{}}:n$(YQ(e))}function i$(e){let{fenced:t}=t$(e),{map:n,parseError:r}=r$(t);return{map:n??{},parseError:r}}function a$(e){let{fenced:t}=t$(e);if(t===``)return[];let{doc:n,map:r}=r$(t);return r===null?[]:l$(n)}function o$(e){return typeof e==`object`&&!!e&&`key`in e}function s$(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 c$(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 l$(e){let t=e.contents;if(!t||!(`items`in t)||!Array.isArray(t.items))return[];let n=[];for(let e of t.items){if(!o$(e))continue;let t=s$(e);t!==null&&n.push(t)}return n}function u$(e){if(e.contents==null||!(`items`in e.contents)){let t=e.createNode({});return e.contents=t,t}return e.contents}function d$(e){let t=e.contents;return!t||!(`items`in t)||(t.items?.length??0)===0?``:$Q(e.toString(XQ))}function f$(e){let t=new TextEncoder().encode(e).byteLength;return t>65536?{kind:`region_too_large`,bytes:t,limit:e$}:null}function p$(e){let t=d$(e),n=f$(t);return n?{ok:!1,error:n}:{ok:!0,nextFenced:t}}function m$(e,t){if(Object.hasOwn(t,`frontmatter`))return{ok:!1,error:{kind:`reserved_key`,key:PQ}};let{doc:n,map:r}=r$(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{u$(n);for(let[e,r]of Object.entries(t)){if(r===null){n.delete(e);continue}let t=RQ.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,QQ(n,n.get(e,!0),t.data))}return p$(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function h$(e,t,n,r={}){if(t===`frontmatter`||n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:PQ}};let{doc:i,map:a}=r$(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=>o$(e)&&s$(e)===t);if(!s)return{ok:!1,error:{kind:`unknown_key`,key:t}};if(!r.allowDuplicate&&o.items.some(e=>o$(e)&&e!==s&&s$(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return c$(s,n),p$(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function g$(e,t){let{doc:n,map:r}=r$(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=l$(n);if(a.length!==t.length||!_$(a,t))return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};try{let e=i.items.filter(o$),r=[];for(let n of t){let i=e.findIndex(e=>s$(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,p$(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function _$(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 v$(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:PQ}:null}function y$(e,t,n){let r=v$(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=r$(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=RQ.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 u$(i),i.setIn(t,QQ(i,i.getIn(t,!0),o.data)),p$(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function b$(e,t){let n=v$(t);if(n)return{ok:!1,error:n};let{doc:r,map:i}=r$(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),p$(r))}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function x$(e,t){if(t.length===0){let t=e.contents;return Do(t)?t:null}let n=e.getIn(t,!0);return Do(n)?n:null}function S$(e,t,n,r={}){let i=v$(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:PQ}};let{doc:o,map:s}=r$(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=x$(o,t.slice(0,-1));if(!c)return{ok:!1,error:{kind:`unknown_key`,key:a}};let l=c.items.find(e=>o$(e)&&s$(e)===a);if(!l)return{ok:!1,error:{kind:`unknown_key`,key:a}};if(!r.allowDuplicate&&c.items.some(e=>o$(e)&&e!==l&&s$(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return c$(l,n),p$(o)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function C$(e,t,n){if(t.length===0)return g$(e,n);let r=v$(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=r$(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!Do(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(!o$(e))continue;let t=s$(e);t!==null&&s.push(t)}if(s.length!==n.length||!_$(s,n))return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};try{let e=o.items.filter(o$),t=[];for(let r of n){let i=e.findIndex(e=>s$(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,p$(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function w$(e,t,n){let r=v$(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=r$(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!Ao(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(!T$(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]),p$(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function T$(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 E$=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});function D$(e){return{ok:!1,error:e}}function O$(e){return{ok:!0,...e}}function k$(e){return{ok:!0,...e}}function A$(e){return{ok:!0,...e}}function j$(e){return{ok:!0,...e}}function M$(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 ${e$}-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 N$(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(!GQ(e.map[n],t.map[n]))return!1;return!0}var P$=5;function F$(e){let t=e.toString();return{snapshot:I$(t),raw:t}}function I$(e){let{map:t,parseError:n}=i$(e);return{map:t,keys:a$(e),parseError:n}}function L$(e){return e.startsWith(`---`)}function R$(e){let t=e.document,n=t.getText(`source`),r=new Set,i=F$(n),a=i.snapshot,o=t$(i.raw).fenced,s=L$(i.raw),c=!1;function l(e=!1){if(c)return;let t,i;try{let e=F$(n);t=e.snapshot,i=e.raw}catch(e){console.warn(`[bindFrontmatterDoc] readSnapshotFromYText threw:`,e);return}if(!e&&N$(a,t)){s=L$(i);return}a=t,o=t$(i).fenced,s=L$(i);for(let e of r)try{e(t)}catch(e){console.warn(`[bindFrontmatterDoc] listener threw:`,e)}}let u=e=>{c||z$(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{fenced:t}=t$(n.toString());r=e(t),r.ok&&r.nextFenced!==t&&(n.delete(0,t.length),r.nextFenced!==``&&n.insert(0,r.nextFenced))},E$),r??{ok:!1,error:{kind:`parse_failed`,reason:`commit transact produced no result`}}}function p(e){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});if(Object.hasOwn(e,`frontmatter`))return D$({code:`SCHEMA_INVALID`,issues:[{path:[PQ],message:`'${PQ}' is a reserved frontmatter key`,issueCode:`reserved_key`}]});let t=UQ.safeParse(e);if(!t.success)return D$({code:`SCHEMA_INVALID`,issues:t.error.issues.map(MQ)});let n=t.data,r=Object.keys(n),i=f(e=>m$(e,n));return i.ok?O$({appliedKeys:r}):D$(M$(i.error))}function m(e,t,n={}){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>h$(r,e,t,n));return r.ok?k$({oldKey:e,newKey:t}):D$(M$(r.error))}function h(e){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>g$(t,e));return t.ok?A$({orderedKeys:[...e]}):D$(M$(t.error))}function g(e,t){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>y$(n,e,t));return n.ok?j$({path:[...e]}):D$(M$(n.error))}function _(e){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>b$(t,e));return t.ok?j$({path:[...e]}):D$(M$(t.error))}function v(e,t,n={}){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>S$(r,e,t,n));return r.ok?j$({path:[...e]}):D$(M$(r.error))}function y(e,t){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>C$(n,e,t));return n.ok?j$({path:[...e]}):D$(M$(n.error))}function b(e,t){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>w$(n,e,t));return n.ok?j$({path:[...e]}):D$(M$(n.error))}return{current(){return F$(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 z$(e,t,n){if(t===0&&n)return!0;let r=t>0?t:P$,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}var B$=new Jv.default;B$.Match_Threshold=.5;var V$=`0.0.0-unknown`,H$={protocol:`x-ok-client-protocol`,runtime:`x-ok-client-runtime`,kind:`x-ok-client-kind`};function U$({kind:e,runtimeVersion:t}){return{[H$.protocol]:`1`,[H$.runtime]:t,[H$.kind]:e}}function W$({kind:e,runtimeVersion:t}){return{clientProtocolVersion:1,clientRuntimeVersion:t,clientKind:e}}var G$=`source`;function K$(e){return{ok:!1,error:e}}function q$(e){return{ok:!0,...e}}function J$(){return cu.parse({})}function Y$(e,t){let n=e.toString();if(n.length===0)return J$();let r=Zl(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(`; `)}`),J$();let i=r.toJSON()??{},a=cu.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)`}`),J$())}function X$(e,t,n={}){return uu(`config.bind`,{"config.scope":t,"config.transport":`ytext`},()=>Z$(e,t,n))}function Z$(e,t,n){let{ytextKey:r=G$}=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=Y$(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 K$({code:`WRITE_ERROR`,detail:`ConfigBinding (${t}) has been disposed`});let n=gu(e,t);if(n!==null)return K$(n);let r=Zl(a.toString()),o=r.contents!==null&&!Do(r.contents);if(r.errors.length>0||o){du(`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=Zl(``)}r.contents===null&&(r.contents=r.createNode({}));let s=vu(r,e),l=r.toJSON()??{},u=uu(`config.validate`,{"config.scope":t,"config.validation.layer":`L1`},e=>{let t=cu.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)du(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!u.success)return K$({code:`SCHEMA_INVALID`,issues:u.error.issues.map(yu)});let d=r.toString();return i.transact(()=>{a.length>0&&a.delete(0,a.length),a.insert(0,d)}),q$({effective:u.data,appliedPaths:s})}return{current(){return Y$(a,t)},patch(e){return uu(`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 Q$=`source`,$$=800;function e1(e){return{ok:!1,error:e}}function t1(e){return{ok:!0,...e}}function n1(e,t={}){let{ytextKey:n=Q$,acceptanceDelayMs:r=$$}=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?e1({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),t1({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 r1(e,t,n){return i1([e,t,n],[])}function i1(e,t){if(t.length>0){let n=mu(cu,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[1]??e[0]}let n=a1(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=>o1(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]=i1(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function a1(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function o1(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var s1=2e3;function c1(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 l1(e,t){for(let[,n]of e.entries()){let e=n;if(e.timestamp&&e.timestamp>t)return!0}return!1}var u1=`__system__`,d1=`__config__/project`,f1=`__user__/config.yml`,p1=`__local__/project`,m1=`__config__/okignore`;Object.freeze([d1,p1,f1,m1]);var h1={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`,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`},g1=new Set(Object.keys(h1));function _1(e){return h1[e.toLowerCase().replace(/^\./,``)]??null}var v1=[`invalid-args`,`nested-project`,`target-not-empty`,`mkdir-failed`,`git-init-failed`,`init-failed`,`discovery-failed`],y1=[`.mdx`,`.md`],b1=`epoch`,x1=512*1024;function S1(e,t=x1){return typeof e==`number`&&Number.isFinite(e)&&e>t}var C1=[`claude`,`claude-desktop`,`cursor`,`codex`],w1={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`},T1={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/};function E1(){if(typeof navigator>`u`)return null;let e=navigator.userAgent;for(let[t,n]of Object.entries(T1))if(n.test(e))return t;return null}var D1=[`incoming`,`outgoing`,`both`];function O1(e){return D1.includes(e)}var k1=`open-knowledge`,A1=[{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)">
384
+ `)?e.slice(0,-1):e}\n---\n`}var e$=65536;function t$(e){let t=e.match(KQ);return t?{fenced:t[0],body:e.slice(t[0].length)}:{fenced:``,body:e}}function n$(e){if(e.trim()===``)return{doc:new Vc({}),map:{}};let t;try{t=Zl(e,{uniqueKeys:!1})}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new Vc({}),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=HQ.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 r$(e){return e===``?{doc:new Vc({}),map:{}}:n$(YQ(e))}function i$(e){let{fenced:t}=t$(e),{map:n,parseError:r}=r$(t);return{map:n??{},parseError:r}}function a$(e){let{fenced:t}=t$(e);if(t===``)return[];let{doc:n,map:r}=r$(t);return r===null?[]:l$(n)}function o$(e){return typeof e==`object`&&!!e&&`key`in e}function s$(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 c$(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 l$(e){let t=e.contents;if(!t||!(`items`in t)||!Array.isArray(t.items))return[];let n=[];for(let e of t.items){if(!o$(e))continue;let t=s$(e);t!==null&&n.push(t)}return n}function u$(e){if(e.contents==null||!(`items`in e.contents)){let t=e.createNode({});return e.contents=t,t}return e.contents}function d$(e){let t=e.contents;return!t||!(`items`in t)||(t.items?.length??0)===0?``:$Q(e.toString(XQ))}function f$(e){let t=new TextEncoder().encode(e).byteLength;return t>65536?{kind:`region_too_large`,bytes:t,limit:e$}:null}function p$(e){let t=d$(e),n=f$(t);return n?{ok:!1,error:n}:{ok:!0,nextFenced:t}}function m$(e,t){if(Object.hasOwn(t,`frontmatter`))return{ok:!1,error:{kind:`reserved_key`,key:PQ}};let{doc:n,map:r}=r$(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{u$(n);for(let[e,r]of Object.entries(t)){if(r===null){n.delete(e);continue}let t=RQ.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,QQ(n,n.get(e,!0),t.data))}return p$(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function h$(e,t,n,r={}){if(t===`frontmatter`||n===`frontmatter`)return{ok:!1,error:{kind:`reserved_key`,key:PQ}};let{doc:i,map:a}=r$(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=>o$(e)&&s$(e)===t);if(!s)return{ok:!1,error:{kind:`unknown_key`,key:t}};if(!r.allowDuplicate&&o.items.some(e=>o$(e)&&e!==s&&s$(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return c$(s,n),p$(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function g$(e,t){let{doc:n,map:r}=r$(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=l$(n);if(a.length!==t.length||!_$(a,t))return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};try{let e=i.items.filter(o$),r=[];for(let n of t){let i=e.findIndex(e=>s$(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,p$(n)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function _$(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 v$(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:PQ}:null}function y$(e,t,n){let r=v$(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=r$(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=RQ.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 u$(i),i.setIn(t,QQ(i,i.getIn(t,!0),o.data)),p$(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function b$(e,t){let n=v$(t);if(n)return{ok:!1,error:n};let{doc:r,map:i}=r$(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),p$(r))}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function x$(e,t){if(t.length===0){let t=e.contents;return Do(t)?t:null}let n=e.getIn(t,!0);return Do(n)?n:null}function S$(e,t,n,r={}){let i=v$(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:PQ}};let{doc:o,map:s}=r$(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=x$(o,t.slice(0,-1));if(!c)return{ok:!1,error:{kind:`unknown_key`,key:a}};let l=c.items.find(e=>o$(e)&&s$(e)===a);if(!l)return{ok:!1,error:{kind:`unknown_key`,key:a}};if(!r.allowDuplicate&&c.items.some(e=>o$(e)&&e!==l&&s$(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{return c$(l,n),p$(o)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function C$(e,t,n){if(t.length===0)return g$(e,n);let r=v$(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=r$(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!Do(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(!o$(e))continue;let t=s$(e);t!==null&&s.push(t)}if(s.length!==n.length||!_$(s,n))return{ok:!1,error:{kind:`reorder_mismatch`,expected:s,got:[...n]}};try{let e=o.items.filter(o$),t=[];for(let r of n){let i=e.findIndex(e=>s$(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,p$(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function w$(e,t,n){let r=v$(t);if(r)return{ok:!1,error:r};let{doc:i,map:a}=r$(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let o=i.getIn(t,!0);if(!Ao(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(!T$(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]),p$(i)}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function T$(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 E$=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});function D$(e){return{ok:!1,error:e}}function O$(e){return{ok:!0,...e}}function k$(e){return{ok:!0,...e}}function A$(e){return{ok:!0,...e}}function j$(e){return{ok:!0,...e}}function M$(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 ${e$}-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 N$(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(!GQ(e.map[n],t.map[n]))return!1;return!0}var P$=5;function F$(e){let t=e.toString();return{snapshot:I$(t),raw:t}}function I$(e){let{map:t,parseError:n}=i$(e);return{map:t,keys:a$(e),parseError:n}}function L$(e){return e.startsWith(`---`)}function R$(e){let t=e.document,n=t.getText(`source`),r=new Set,i=F$(n),a=i.snapshot,o=t$(i.raw).fenced,s=L$(i.raw),c=!1;function l(e=!1){if(c)return;let t,i;try{let e=F$(n);t=e.snapshot,i=e.raw}catch(e){console.warn(`[bindFrontmatterDoc] readSnapshotFromYText threw:`,e);return}if(!e&&N$(a,t)){s=L$(i);return}a=t,o=t$(i).fenced,s=L$(i);for(let e of r)try{e(t)}catch(e){console.warn(`[bindFrontmatterDoc] listener threw:`,e)}}let u=e=>{c||z$(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{fenced:t}=t$(n.toString());r=e(t),r.ok&&r.nextFenced!==t&&(n.delete(0,t.length),r.nextFenced!==``&&n.insert(0,r.nextFenced))},E$),r??{ok:!1,error:{kind:`parse_failed`,reason:`commit transact produced no result`}}}function p(e){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});if(Object.hasOwn(e,`frontmatter`))return D$({code:`SCHEMA_INVALID`,issues:[{path:[PQ],message:`'${PQ}' is a reserved frontmatter key`,issueCode:`reserved_key`}]});let t=UQ.safeParse(e);if(!t.success)return D$({code:`SCHEMA_INVALID`,issues:t.error.issues.map(MQ)});let n=t.data,r=Object.keys(n),i=f(e=>m$(e,n));return i.ok?O$({appliedKeys:r}):D$(M$(i.error))}function m(e,t,n={}){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>h$(r,e,t,n));return r.ok?k$({oldKey:e,newKey:t}):D$(M$(r.error))}function h(e){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>g$(t,e));return t.ok?A$({orderedKeys:[...e]}):D$(M$(t.error))}function g(e,t){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>y$(n,e,t));return n.ok?j$({path:[...e]}):D$(M$(n.error))}function _(e){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=f(t=>b$(t,e));return t.ok?j$({path:[...e]}):D$(M$(t.error))}function v(e,t,n={}){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=f(r=>S$(r,e,t,n));return r.ok?j$({path:[...e]}):D$(M$(r.error))}function y(e,t){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>C$(n,e,t));return n.ok?j$({path:[...e]}):D$(M$(n.error))}function b(e,t){if(c)return D$({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let n=f(n=>w$(n,e,t));return n.ok?j$({path:[...e]}):D$(M$(n.error))}return{current(){return F$(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 z$(e,t,n){if(t===0&&n)return!0;let r=t>0?t:P$,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}var B$=new Jv.default;B$.Match_Threshold=.5;var V$=`0.0.0-unknown`,H$={protocol:`x-ok-client-protocol`,runtime:`x-ok-client-runtime`,kind:`x-ok-client-kind`};function U$({kind:e,runtimeVersion:t}){return{[H$.protocol]:`1`,[H$.runtime]:t,[H$.kind]:e}}function W$({kind:e,runtimeVersion:t}){return{clientProtocolVersion:1,clientRuntimeVersion:t,clientKind:e}}var G$=`source`;function K$(e){return{ok:!1,error:e}}function q$(e){return{ok:!0,...e}}function J$(){return cu.parse({})}function Y$(e,t){let n=e.toString();if(n.length===0)return J$();let r=Zl(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(`; `)}`),J$();let i=r.toJSON()??{},a=cu.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)`}`),J$())}function X$(e,t,n={}){return uu(`config.bind`,{"config.scope":t,"config.transport":`ytext`},()=>Z$(e,t,n))}function Z$(e,t,n){let{ytextKey:r=G$}=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=Y$(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 K$({code:`WRITE_ERROR`,detail:`ConfigBinding (${t}) has been disposed`});let n=gu(e,t);if(n!==null)return K$(n);let r=Zl(a.toString()),o=r.contents!==null&&!Do(r.contents);if(r.errors.length>0||o){du(`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=Zl(``)}r.contents===null&&(r.contents=r.createNode({}));let s=vu(r,e),l=r.toJSON()??{},u=uu(`config.validate`,{"config.scope":t,"config.validation.layer":`L1`},e=>{let t=cu.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)du(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!u.success)return K$({code:`SCHEMA_INVALID`,issues:u.error.issues.map(yu)});let d=r.toString();return i.transact(()=>{a.length>0&&a.delete(0,a.length),a.insert(0,d)}),q$({effective:u.data,appliedPaths:s})}return{current(){return Y$(a,t)},patch(e){return uu(`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 Q$=`source`,$$=800;function e1(e){return{ok:!1,error:e}}function t1(e){return{ok:!0,...e}}function n1(e,t={}){let{ytextKey:n=Q$,acceptanceDelayMs:r=$$}=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?e1({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),t1({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 r1(e,t,n){return i1([e,t,n],[])}function i1(e,t){if(t.length>0){let n=mu(cu,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[1]??e[0]}let n=a1(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=>o1(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]=i1(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function a1(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function o1(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var s1=2e3;function c1(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 l1(e,t){for(let[,n]of e.entries()){let e=n;if(e.timestamp&&e.timestamp>t)return!0}return!1}var u1=`__system__`,d1=`__config__/project`,f1=`__user__/config.yml`,p1=`__local__/project`,m1=`__config__/okignore`;Object.freeze([d1,p1,f1,m1]);var h1={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`,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`},g1=new Set(Object.keys(h1));function _1(e){return h1[e.toLowerCase().replace(/^\./,``)]??null}var v1=[`invalid-args`,`nested-project`,`target-not-empty`,`mkdir-failed`,`git-init-failed`,`init-failed`,`discovery-failed`],y1=[`.mdx`,`.md`],b1=`epoch`,x1=512*1024;function S1(e,t=x1){return typeof e==`number`&&Number.isFinite(e)&&e>t}var C1=[`claude`,`claude-desktop`,`cursor`,`codex`,`opencode`],w1={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`,opencode:`OpenCode`},T1={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/};function E1(){if(typeof navigator>`u`)return null;let e=navigator.userAgent;for(let[t,n]of Object.entries(T1))if(n.test(e))return t;return null}var D1=[`incoming`,`outgoing`,`both`];function O1(e){return D1.includes(e)}var k1=`open-knowledge`,A1=[{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)">
385
385
  <h3 style="margin:0 0 14px;font-size:15px;font-weight:600">Revenue by region</h3>
386
386
  <div id="bars" style="display:flex;align-items:flex-end;gap:14px;height:170px"></div>
387
387
  <script>
@@ -443,29 +443,29 @@ Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#pl
443
443
  out.textContent = '$' + Number(amt.value).toLocaleString();
444
444
  });
445
445
  <\/script>
446
- </div>`}],j1=[{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`}],M1=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],N1=[`video/mp4`,`video/webm`,`video/ogg`],P1=[`audio/mpeg`,`audio/wav`,`audio/ogg`],F1=[`application/pdf`],I1=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),L1=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),R1=new Set([`pdf`]),z1=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),B1=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(`.`)),V1=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(`.`)),H1=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(`.`)),U1=`wikiembed`,W1=`toast`,G1=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(`.`)),K1=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],q1=[`mp4`,`webm`,`mov`,`m4v`],J1=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],Y1=[`pdf`],X1=[`json`,`toml`,`lock`];function Z1(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}Z1(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,K1,I1),Z1(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,q1,L1),Z1(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,J1,z1),Z1(`SIDEBAR_PDF_ASSET_EXTENSIONS`,Y1,R1),Z1(`FILE_ATTACHMENT_EXTENSIONS`,[...B1],G1),Z1(`WIKI_EMBED_EXTENSIONS`,[...G1],V1);var Q1=new Set(K1),$1=new Set(q1),e0=new Set(J1),t0=new Set(Y1),n0=new Set(X1);Z1(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...K1,...q1,...J1,...Y1,...X1])],H1);var r0=new Set([`base`,`canvas`]);new Set([...V1,...r0]);function i0(e){let t=e.toLowerCase().replace(/^\./,``);return Q1.has(t)?`image`:$1.has(t)?`video`:e0.has(t)?`audio`:t0.has(t)?`pdf`:n0.has(t)||r0.has(t)||g1.has(t)?`text`:null}var a0=HS.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`},sourceClosingFenceLength:{default:null,rendered:!1},sourceFenceIndent:{default:null,rendered:!1},sourceInfoPadding:{default:null,rendered:!1},sourceIndents:{default:null,rendered:!1}}}}),o0=tC.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[pS({find:XS,type:this.type,getAttributes:{sourceDelimiter:`*`}}),pS({find:QS,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),s0=YS.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[pS({find:WS,type:this.type,getAttributes:{sourceDelimiter:`**`}}),pS({find:KS,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),c0=Hx.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),l0=FS.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 u0(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 d0(e){let t=[];return e.descendants(e=>(e.type.name===`footnoteDefinition`&&t.push(String(e.attrs.identifier??``)),!0)),t}function f0(e){let t=null;return e.forEach((e,n)=>{e.type.name===`footnoteDefinition`&&(t=n+e.nodeSize)}),t??e.content.size}var p0=FS.create({name:`footnoteReference`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,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}})}}}),m0=rC.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),h0=aC.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}}}}),g0=FS.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]}});function _0(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 v0=sC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=Eb(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=_0(t.src)),[`img`,t]}}),y0=FS.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}})}}}),b0=FS.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,addAttributes(){return{}},parseHTML(){return[{tag:`span[data-jsx-inline]`}]},renderHTML(){return[`span`,{"data-jsx-inline":``},0]}}),x0=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],S0=x0.map(e=>`${e}:`).join(`|`),C0=RegExp(`^(?:${S0}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function w0(e){let t=e.trim();return t===``?!0:C0.test(t)}function T0(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 E0=new Set(x0.map(e=>`${e}:`)),D0=`https://placeholder.invalid`;function O0(e){try{let t=new URL(e,D0);return E0.has(t.protocol.toLowerCase())}catch{return!1}}var k0=CT.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:O0,validate:O0,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}}}}),A0=FS.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 j0(e){return e.type.name===`list`&&!e.attrs.ordered}function M0(e){return e.type.name===`list`&&!!e.attrs.ordered}function N0(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function P0(e,t,n,r,i,a,o){let s=gb(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?Am(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 Dm(n,a)(e,void 0)?t?Dm(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 F0=FS.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,Eb(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:P0(e,t,n,r,e=>j0(e)&&!N0(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:P0(e,t,n,r,e=>M0(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:P0(e,t,n,r,e=>j0(e)&&N0(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[gS({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]})}),gS({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]})}),new Px({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=If(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()}}}),I0=FS.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`,Eb(t),0]:[`li`,Eb(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(Eb(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`);return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,n.isEditable||(o.disabled=!0),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,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)}}}},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}}}}),L0=F0,R0=I0,z0=FS.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,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}})}}}),B0=FS.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}}}}),V0=ID.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),H0=BD.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),U0=FS.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`,style:`display: none;`,...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)}}}),W0=Hx.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`,style:`display: none;`,...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)}}}),G0=Zx.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}}),K0=FS.create({name:`imageReference`,group:`inline`,inline:!0,atom:!0,priority:60,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}]}}),q0=new Map([[32,` `],[9,` `]]);function J0(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 Y0(e){let t=J0(e);return t!==null&&q0.has(t)}function X0(e){let t=J0(e);return t===null?null:q0.get(t)??null}var Z0=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function Q0(e){Z0.lastIndex=0;let t=e.match(Z0);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=X0(e);if(t===null)return null;n+=t}return n}var $0=Hx.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 e2(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||t2(n)===r?!0:Q0(n)===r}function t2(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}var n2=EO.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),r2=ND.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),i2=vD.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),a2=yD.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),o2=FS.create({name:`tag`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,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()}}}),s2=/^(?:---|—-|___\s|\*\*\*\s)$/;function c2(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}var l2=UD.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[mS({find:s2,type:this.type,getAttributes:e=>({sourceRaw:c2(e)})})]}}),u2=/^\[\[([^[\]|#]+?)(?:#([^\]|]+?))?(?:\|([^\]]+?))?\]\]/;function d2(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function f2(e){let t=e.match(u2);if(!t)return null;let n=t[1]?.trim()??``;return n?{type:`wikilink`,raw:t[0],target:n,anchor:d2(t[2]),alias:d2(t[3])}:null}function p2(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var m2=FS.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,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:d2(e.getAttribute(`data-alias`)),anchor:d2(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:d2(e.getAttribute(`data-alias`)),anchor:d2(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=d2(e.attrs.alias),i=d2(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`},p2({target:n,alias:r,anchor:i})]}});function h2(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function g2(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var _2=FS.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,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:d2(e.getAttribute(`data-alias`)),anchor:d2(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=d2(e.attrs.alias),i=d2(e.attrs.anchor),a=d2(e.attrs.resolvedSrc),o=h2(n);if(I1.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`},g2({target:n,alias:r,anchor:i})]}}),v2=[y0,B0,b0,z0,m2,_2,o2,L0,R0,o0,s0,n2,H0,a0,V0,h0,l2,k0,g0,A0,m0,c0,G0,$0,gte.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,italic:!1,bold:!1,strike:!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}}),r2.configure({resizable:!0}),bD,a2,i2,v0.configure({inline:!0}),K0,ET,W0,U0,p0,l0],y2=/^[a-zA-Z0-9][\w/-]*$/;function b2(e){if(typeof e!=`string`)return!1;let t=e.startsWith(`#`)?e.slice(1):e;return y2.test(t)}var x2=`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`;function S2(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 C2(e){let t=encodeURIComponent(e.projectDir);return e.prompt===``?`codex://new?path=${t}`:`codex://new?prompt=${encodeURIComponent(e.prompt)}&path=${t}`}function w2(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?e:e.substring(t+1)}function T2(e){let t=encodeURIComponent(w2(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`}var E2=RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`),D2=RegExp("[ \\u00a0\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`);function O2(e){return e.replace(E2,`_`)}function k2(e){return e.replace(D2,`_`)}var A2="This is an Open Knowledge project: load the `open-knowledge` skill and use the Open Knowledge MCP tools for all markdown — don't probe for `.ok/` or use native file tools on `.md` / `.mdx`.";function j2(e){return`${A2} ${e}`}var M2=`You're running in the terminal of the Open Knowledge desktop app.`;function N2(e){return`${M2} ${A2} ${e===null?`Then stop.`:`Read \`${O2(e)}\` via the Open Knowledge MCP server, then stop.`}`}function P2(e,t,n){let r=`Let's work on \`${O2(e)}\` using Open Knowledge.`;return Q2(t?`${r} Open the OK editor in web view.`:r,n)}function F2(e,t,n){let r=`Let's work on the \`${O2(e)}\` folder using Open Knowledge.`;return Q2(t?`${r} Open the OK editor in web view.`:r,n)}function I2(e,t){let n=`Let's work on this project using Open Knowledge.`;return Q2(e?`${n} Open the OK editor in web view.`:n,t)}function L2(e,t,n,r){let i=t?` Open the OK editor in web view.`:``,a=e=>e.split(`
446
+ </div>`}],j1=[{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`}],M1=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],N1=[`video/mp4`,`video/webm`,`video/ogg`],P1=[`audio/mpeg`,`audio/wav`,`audio/ogg`],F1=[`application/pdf`],I1=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),L1=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),R1=new Set([`pdf`]),z1=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),B1=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(`.`)),V1=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(`.`)),H1=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(`.`)),U1=`wikiembed`,W1=`toast`,G1=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(`.`)),K1=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],q1=[`mp4`,`webm`,`mov`,`m4v`],J1=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],Y1=[`pdf`],X1=[`json`,`toml`,`lock`];function Z1(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}Z1(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,K1,I1),Z1(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,q1,L1),Z1(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,J1,z1),Z1(`SIDEBAR_PDF_ASSET_EXTENSIONS`,Y1,R1),Z1(`FILE_ATTACHMENT_EXTENSIONS`,[...B1],G1),Z1(`WIKI_EMBED_EXTENSIONS`,[...G1],V1);var Q1=new Set(K1),$1=new Set(q1),e0=new Set(J1),t0=new Set(Y1),n0=new Set(X1);Z1(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...K1,...q1,...J1,...Y1,...X1])],H1);var r0=new Set([`base`,`canvas`]);new Set([...V1,...r0]);function i0(e){let t=e.toLowerCase().replace(/^\./,``);return Q1.has(t)?`image`:$1.has(t)?`video`:e0.has(t)?`audio`:t0.has(t)?`pdf`:n0.has(t)||r0.has(t)||g1.has(t)?`text`:null}var a0=HS.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`},sourceClosingFenceLength:{default:null,rendered:!1},sourceFenceIndent:{default:null,rendered:!1},sourceInfoPadding:{default:null,rendered:!1},sourceIndents:{default:null,rendered:!1}}}}),o0=tC.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[pS({find:XS,type:this.type,getAttributes:{sourceDelimiter:`*`}}),pS({find:QS,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),s0=YS.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[pS({find:WS,type:this.type,getAttributes:{sourceDelimiter:`**`}}),pS({find:KS,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),c0=Hx.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),l0=FS.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 u0(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 d0(e){let t=[];return e.descendants(e=>(e.type.name===`footnoteDefinition`&&t.push(String(e.attrs.identifier??``)),!0)),t}function f0(e){let t=null;return e.forEach((e,n)=>{e.type.name===`footnoteDefinition`&&(t=n+e.nodeSize)}),t??e.content.size}var p0=FS.create({name:`footnoteReference`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,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}})}}}),m0=rC.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),h0=aC.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}}}}),g0=FS.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]}});function _0(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 v0=sC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=Eb(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=_0(t.src)),[`img`,t]}}),y0=FS.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}})}}}),b0=FS.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,addAttributes(){return{}},parseHTML(){return[{tag:`span[data-jsx-inline]`}]},renderHTML(){return[`span`,{"data-jsx-inline":``},0]}}),x0=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],S0=x0.map(e=>`${e}:`).join(`|`),C0=RegExp(`^(?:${S0}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function w0(e){let t=e.trim();return t===``?!0:C0.test(t)}function T0(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 E0=new Set(x0.map(e=>`${e}:`)),D0=`https://placeholder.invalid`;function O0(e){try{let t=new URL(e,D0);return E0.has(t.protocol.toLowerCase())}catch{return!1}}var k0=CT.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:O0,validate:O0,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}}}}),A0=FS.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 j0(e){return e.type.name===`list`&&!e.attrs.ordered}function M0(e){return e.type.name===`list`&&!!e.attrs.ordered}function N0(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function P0(e,t,n,r,i,a,o){let s=gb(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?Am(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 Dm(n,a)(e,void 0)?t?Dm(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 F0=FS.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,Eb(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:P0(e,t,n,r,e=>j0(e)&&!N0(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:P0(e,t,n,r,e=>M0(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:P0(e,t,n,r,e=>j0(e)&&N0(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[gS({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]}),joinPredicate:(e,t)=>t.attrs.ordered===!1}),gS({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 Px({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=If(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()}}}),I0=FS.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`,Eb(t),0]:[`li`,Eb(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(Eb(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}}}}),L0=F0,R0=I0,z0=FS.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,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}})}}}),B0=FS.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}}}}),V0=ID.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),H0=BD.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),U0=FS.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`,style:`display: none;`,...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)}}}),W0=Hx.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`,style:`display: none;`,...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)}}}),G0=Zx.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}}),K0=FS.create({name:`imageReference`,group:`inline`,inline:!0,atom:!0,priority:60,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}]}}),q0=new Map([[32,` `],[9,` `]]);function J0(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 Y0(e){let t=J0(e);return t!==null&&q0.has(t)}function X0(e){let t=J0(e);return t===null?null:q0.get(t)??null}var Z0=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function Q0(e){Z0.lastIndex=0;let t=e.match(Z0);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=X0(e);if(t===null)return null;n+=t}return n}var $0=Hx.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 e2(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||t2(n)===r?!0:Q0(n)===r}function t2(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}var n2=EO.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),r2=ND.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),i2=vD.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),a2=yD.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),o2=FS.create({name:`tag`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,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()}}}),s2=/^(?:---|—-|___\s|\*\*\*\s)$/;function c2(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}var l2=UD.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[mS({find:s2,type:this.type,getAttributes:e=>({sourceRaw:c2(e)})})]}}),u2=/^\[\[([^[\]|#]+?)(?:#([^\]|]+?))?(?:\|([^\]]+?))?\]\]/;function d2(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function f2(e){let t=e.match(u2);if(!t)return null;let n=t[1]?.trim()??``;return n?{type:`wikilink`,raw:t[0],target:n,anchor:d2(t[2]),alias:d2(t[3])}:null}function p2(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var m2=FS.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,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:d2(e.getAttribute(`data-alias`)),anchor:d2(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:d2(e.getAttribute(`data-alias`)),anchor:d2(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=d2(e.attrs.alias),i=d2(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`},p2({target:n,alias:r,anchor:i})]}});function h2(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function g2(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var _2=FS.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,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:d2(e.getAttribute(`data-alias`)),anchor:d2(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=d2(e.attrs.alias),i=d2(e.attrs.anchor),a=d2(e.attrs.resolvedSrc),o=h2(n);if(I1.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`},g2({target:n,alias:r,anchor:i})]}}),v2=[y0,B0,b0,z0,m2,_2,o2,L0,R0,o0,s0,n2,H0,a0,V0,h0,l2,k0,g0,A0,m0,c0,G0,$0,gte.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:{listTypes:[{itemName:`listItem`,wrapperNames:[`list`]}]},italic:!1,bold:!1,strike:!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}}),r2.configure({resizable:!0}),bD,a2,i2,v0.configure({inline:!0}),K0,ET,W0,U0,p0,l0],y2=/^[a-zA-Z0-9][\w/-]*$/;function b2(e){if(typeof e!=`string`)return!1;let t=e.startsWith(`#`)?e.slice(1):e;return y2.test(t)}var x2=`Tags must start with a letter or digit and contain only letters, digits, underscores, dashes, and slashes.`;function S2(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 C2(e){let t=encodeURIComponent(e.projectDir);return e.prompt===``?`codex://new?path=${t}`:`codex://new?prompt=${encodeURIComponent(e.prompt)}&path=${t}`}function w2(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?e:e.substring(t+1)}function T2(e){let t=encodeURIComponent(w2(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`}var E2=RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`),D2=RegExp("[ \\u00a0\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2069\\ufeff`]+",`g`);function O2(e){return e.replace(E2,`_`)}function k2(e){return e.replace(D2,`_`)}var A2="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 j2(e){return`${A2} ${e}`}var M2=`You're running in the terminal of the OpenKnowledge desktop app.`;function N2(e){return`${M2} ${A2} ${e===null?`Then stop.`:`Read \`${O2(e)}\` via the OpenKnowledge MCP server, then stop.`}`}function P2(e,t,n){let r=`Let's work on \`${O2(e)}\` using OpenKnowledge.`;return Q2(t?`${r} Open the OK editor in web view.`:r,n)}function F2(e,t,n){let r=`Let's work on the \`${O2(e)}\` folder using OpenKnowledge.`;return Q2(t?`${r} Open the OK editor in web view.`:r,n)}function I2(e,t){let n=`Let's work on this project using OpenKnowledge.`;return Q2(e?`${n} Open the OK editor in web view.`:n,t)}function L2(e,t,n,r){let i=t?` Open the OK editor in web view.`:``,a=e=>e.split(`
447
447
  `).map(e=>`> ${e}`).join(`
448
- `),o=u4(r),s=e=>{let t=e.trim();if(n===`existing-repo`){let e=t===``?`Let's work on this project using Open Knowledge.`:[`Here's what I'd like to do in this Open Knowledge project:`,``,a(t)].join(`
448
+ `),o=u4(r),s=e=>{let t=e.trim();if(n===`existing-repo`){let e=t===``?`Let's work on this project using OpenKnowledge.`:[`Here's what I'd like to do in this OpenKnowledge project:`,``,a(t)].join(`
449
449
  `);return`${o===``?e:[e,``,o].join(`
450
- `)}${i}`}let r=`Scaffold the folders, templates, and AI-readable rules to match, using Open Knowledge.`;return`${t===``?o===``?`Let's set up a new Open Knowledge project. ${r}`:[`Let's set up a new Open Knowledge project. ${r}`,``,o].join(`
451
- `):[`I'm setting up a new Open Knowledge project. Here's what I want to create:`,``,a(t),...o===``?[]:[``,o],``,r].join(`
450
+ `)}${i}`}let r=`Scaffold the folders, templates, and AI-readable rules to match, using OpenKnowledge.`;return`${t===``?o===``?`Let's set up a new OpenKnowledge project. ${r}`:[`Let's set up a new OpenKnowledge project. ${r}`,``,o].join(`
451
+ `):[`I'm setting up a new OpenKnowledge project. Here's what I want to create:`,``,a(t),...o===``?[]:[``,o],``,r].join(`
452
452
  `)}${i}`};return s(X2(s,e.trim(),`cursor`,z2))}var R2=3072,z2=R2-K2(`${A2} `,`cursor`),B2=160,V2=3,H2=` …`;function U2(e){let t=0,n=0;for(let r of e)r==="`"?(n+=1,n>t&&(t=n)):n=0;return t}function W2(e){return"`".repeat(Math.max(U2(e)+1,V2))}function G2(e){let t=e.trimStart(),n=t.indexOf(`
453
- `),r=n===-1?t:t.slice(0,n);return Array.from(r).slice(0,B2).join(``).trimEnd()}function K2(e,t){let n=encodeURIComponent(e);return t===`cursor`?encodeURIComponent(n).length:n.length}function q2(e){return`Let's work on the selected passage in @${e} using Open Knowledge.`}function J2(e){let t=e.trim();return t===``?[]:[`Instruction:`,``,t.split(`
453
+ `),r=n===-1?t:t.slice(0,n);return Array.from(r).slice(0,B2).join(``).trimEnd()}function K2(e,t){let n=encodeURIComponent(e);return t===`cursor`?encodeURIComponent(n).length:n.length}function q2(e){return`Let's work on the selected passage in @${e} using OpenKnowledge.`}function J2(e){let t=e.trim();return t===``?[]:[`Instruction:`,``,t.split(`
454
454
  `).map(e=>`> ${e}`).join(`
455
455
  `),``]}function Y2(e,t){let n=J2(t);return n.length===0?e:[e,``,...n].join(`
456
456
  `).trimEnd()}function X2(e,t,n,r=R2){let i=t=>K2(e(t),n)<=r;if(i(t))return t;let a=Array.from(t),o=0,s=a.length;for(;o<s;){let e=Math.ceil((o+s)/2);i(a.slice(0,e).join(``).trimEnd()+H2)?o=e:s=e-1}let c=a.slice(0,o).join(``).trimEnd();return c===``?``:c+H2}function Z2(e,t){return X2(t=>Y2(e,t),t,`cursor`,z2)}function Q2(e,t){return Y2(e,Z2(e,t??``))}function $2(e,t,n){let r=W2(n);return[q2(e),``,...J2(t),`Here is the passage:`,``,r,n,r].join(`
457
- `)}function e4(e,t,n){let r=G2(n),i=W2(r);return[q2(e),``,...J2(t),`The passage begins:`,``,i,r,i,``,`Read the full passage from @${e} via the Open Knowledge MCP server before editing.`].join(`
458
- `)}function t4(e,t,n){return X2(n,e,t)}function n4(e){let t=k2(e.relativePath),n=$2(t,e.instruction,e.selectionMarkdown);return K2(n,e.target)<=R2?n:e4(t,t4(e.instruction,e.target,n=>e4(t,n,e.selectionMarkdown)),e.selectionMarkdown)}function r4(e,t,n){let r=`Let's work on @${e} using Open Knowledge.`,i=n?`Open the OK editor in web view.`:``,a=t.trim();if(a===``)return i===``?r:`${r} ${i}`;let o=[r,``,a.split(`
457
+ `)}function e4(e,t,n){let r=G2(n),i=W2(r);return[q2(e),``,...J2(t),`The passage begins:`,``,i,r,i,``,`Read the full passage from @${e} via the OpenKnowledge MCP server before editing.`].join(`
458
+ `)}function t4(e,t,n){return X2(n,e,t)}function n4(e){let t=k2(e.relativePath),n=$2(t,e.instruction,e.selectionMarkdown);return K2(n,e.target)<=R2?n:e4(t,t4(e.instruction,e.target,n=>e4(t,n,e.selectionMarkdown)),e.selectionMarkdown)}function r4(e,t,n){let r=`Let's work on @${e} using OpenKnowledge.`,i=n?`Open the OK editor in web view.`:``,a=t.trim();if(a===``)return i===``?r:`${r} ${i}`;let o=[r,``,a.split(`
459
459
  `).map(e=>`> ${e}`).join(`
460
460
  `)];return i!==``&&o.push(``,i),o.join(`
461
461
  `)}function i4(e,t,n,r){let i=k2(e);return r4(i,t4(t,r,e=>r4(i,e,n)),n)}var a4=`Open the OK editor in web view.`;function o4(e){return e.split(`
462
462
  `).map(e=>`> ${e}`).join(`
463
463
  `)}function s4(e){let t=W2(e);return[`Here is the passage:`,``,t,e,t].join(`
464
- `)}function c4(e,t){let n=G2(e),r=W2(n);return[`The passage begins:`,``,r,n,r,``,`Read the full passage from @${t} via the Open Knowledge MCP server before editing.`].join(`
465
- `)}function l4(e,t,n){return`The selected passage is ${e===t?`line ${e}`:`lines ${e}-${t}`} of @${n}. Read it from @${n} via the Open Knowledge MCP server before editing.`}function u4(e){let t=e.map(e=>k2(e)).filter(e=>e!==``);return t.length===0?``:[`Also reference:`,``,...t.map(e=>`@${e}`)].join(`
466
- `)}function d4(e){return e.scope===`doc`?`Let's work on @${k2(e.docRelativePath)} using Open Knowledge.`:e.scope===`folder`?`Let's work on the @${k2(e.folderRelativePath)} folder using Open Knowledge.`:`Let's work on this project using Open Knowledge.`}function f4(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(o4(a)),n!==``&&o.push(n),r!==``&&o.push(r),i!==``&&o.push(i),o.join(`
464
+ `)}function c4(e,t){let n=G2(e),r=W2(n);return[`The passage begins:`,``,r,n,r,``,`Read the full passage from @${t} via the OpenKnowledge MCP server before editing.`].join(`
465
+ `)}function l4(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 u4(e){let t=e.map(e=>k2(e)).filter(e=>e!==``);return t.length===0?``:[`Also reference:`,``,...t.map(e=>`@${e}`)].join(`
466
+ `)}function d4(e){return e.scope===`doc`?`Let's work on @${k2(e.docRelativePath)} using OpenKnowledge.`:e.scope===`folder`?`Let's work on the @${k2(e.folderRelativePath)} folder using OpenKnowledge.`:`Let's work on this project using OpenKnowledge.`}function f4(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(o4(a)),n!==``&&o.push(n),r!==``&&o.push(r),i!==``&&o.push(i),o.join(`
467
467
 
468
- `)}function p4(e,t,n,r,i,a){if(e.kind===`lines`)return l4(e.startLine,e.endLine,n);if(e.kind===`anchor`)return c4(e.markdown,n);let o=s4(e.markdown);return K2(f4(t,``,o,r,i),a)<=R2?o:c4(e.markdown,n)}function m4(e,t,n,r){let{target:i}=e,a=k2(e.docRelativePath),o=`Let's work on @${a} using Open Knowledge.`,s=p4(t,o,a,n,r,i);return f4(o,t4(e.instruction,i,e=>f4(o,e,s,n,r)),s,n,r)}function h4(e){let{target:t}=e,n=e.autoOpen?a4:``,r=u4(e.mentions);if(e.scope===`doc`&&e.selection!==void 0)return m4(e,e.selection,r,n);let i=d4(e);return f4(i,t4(e.instruction,t,e=>f4(i,e,``,r,n)),``,r,n)}function g4(e){return`'${e.replace(/'/g,`'\\''`)}'`}var _4={claude:{bin:`claude`,displayName:`Claude`,docsUrl:`https://docs.claude.com/en/docs/claude-code`,handoffTarget:`claude-code`,mcpPreApproveArg:`--settings ${g4(JSON.stringify({enabledMcpjsonServers:[k1]}))}`},codex:{bin:`codex`,displayName:`Codex`,docsUrl:`https://developers.openai.com/codex/cli`,handoffTarget:`codex`},cursor:{bin:`cursor-agent`,displayName:`Cursor`,docsUrl:`https://cursor.com/docs/cli/overview`,handoffTarget:`cursor`}},v4=[`claude`,`codex`,`cursor`];function y4(e,t,n={}){let r=_4[e],i=n.mcpPreApprove===!0&&r.mcpPreApproveArg?`${r.mcpPreApproveArg} `:``;return`${r.bin} ${i}${g4(t)}\r`}function b4(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}}function x4(e){return e.split(`/`).some(e=>e.startsWith(`.`))}function S4(e,t){let n=b4(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}var C4=E().superRefine(S4).optional(),w4={agentId:E().optional(),agentName:E().optional(),colorSeed:E().optional(),clientName:E().optional(),clientVersion:E().optional(),label:E().optional()},T4=E().optional(),E4=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;Ra(`kind`,[A({kind:M(`doc`),docPath:E().min(1)}).loose(),A({kind:M(`folder`),folderPath:E()}).loose()]);var D4=j([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),O4=Ra(`ok`,[A({ok:M(!0),shareUrl:E().min(1),sharedUrl:E().min(1),branch:E().min(1)}).loose(),A({ok:M(!1),error:D4,branch:E().min(1).optional()}).loose()]),k4=j([`user`,`org`]),A4=A({login:E().min(1),kind:k4,avatarUrl:E().optional()}).loose(),j4=j([`auth-required`,`network`]),M4=Ra(`ok`,[A({ok:M(!0),owners:k(A4)}).loose(),A({ok:M(!1),error:j4}).loose()]),N4=Ra(`ok`,[A({ok:M(!0),available:O()}).loose(),A({ok:M(!1),error:j4}).loose()]),P4=j([`public`,`private`]);A({owner:E().min(1),name:E().min(1),visibility:P4,description:E().optional()}).loose();var F4=j([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),I4=Ra(`ok`,[A({ok:M(!0),ownerLogin:E().min(1),repoName:E().min(1),cloneUrl:E().min(1),defaultBranch:E().min(1)}).loose(),A({ok:M(!1),error:F4}).loose()]);function L4(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}var R4=e=>e.refine(L4,`invalid branch name`),z4={shareTargetExists:O(),dirtyConflicts:A({conflicts:O(),files:k(E().min(1))}).loose(),branchIsLocal:O()};Ra(`detached`,[A({detached:M(!1),currentBranch:E().min(1).nullable(),currentHeadSha:Da(),...z4}).loose(),A({detached:M(!0),currentBranch:Da(),currentHeadSha:E().min(1),...z4}).loose()]),A({branch:R4(E().min(1)),principalId:E().optional()}).loose();var B4=j([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`]);Ra(`ok`,[A({ok:M(!0)}).loose(),A({ok:M(!1),reason:B4,files:k(E().min(1)).optional(),otherWorktreePath:E().min(1).optional()}).loose()]);var V4=A({serverInstanceId:E().min(1),currentBranch:E().min(1).optional(),currentDiskAckSVs:Ha(E().min(1),E().min(1)).optional()}).loose(),H4=A({id:E().min(1),display_name:E().min(1),display_email:E(),source:j([`git-config`,`synthesized`]),created_at:E().min(1)}).loose();A({collabUrl:E().nullable(),previewUrl:E().nullable(),port:D(),paneTarget:E().nullable(),singleFile:O().default(!1)}).loose();var U4=A({type:j(`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: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`.split(`.`)),title:E().min(1),status:D().int().min(400).max(599),instance:E().regex(E4,`instance must be urn:uuid:<uuid>`).optional(),detail:E().optional()}).loose();A({parentDocName:E().min(1),agentId:E().min(1).optional(),agentName:E().min(1).optional()}).loose();var W4=A({src:E().min(1),path:E().min(1).optional(),deduped:O().optional()}).loose();A({url:E().min(1),dir:E().min(1),branch:E().min(1).refine(L4,`invalid branch name`).optional()}).loose(),A({type:M(`error`),problem:U4}).loose();var G4=8192,K4=32768,q4=`…[truncated]`;function J4(e){let t=e.trim();if(t.length===0||t[0]!==`{`)return null;let n;try{n=JSON.parse(t)}catch{return null}if(typeof n!=`object`||!n||Array.isArray(n))return null;let r=n;return{event:typeof r.event==`string`?r.event:void 0,fields:r}}function Y4(e){return e.length<=8192?e:`${e.slice(0,G4-12)}${q4}`}var X4=/notionvc:/i,Z4=()=>e=>{Q4(e)&&($4(e),e3(e))};function Q4(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(X4.test(e))return!0}if(t.type===`element`&&Q4(t))return!0}return!1}function $4(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&$4(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(`
468
+ `)}function p4(e,t,n,r,i,a){if(e.kind===`lines`)return l4(e.startLine,e.endLine,n);if(e.kind===`anchor`)return c4(e.markdown,n);let o=s4(e.markdown);return K2(f4(t,``,o,r,i),a)<=R2?o:c4(e.markdown,n)}function m4(e,t,n,r){let{target:i}=e,a=k2(e.docRelativePath),o=`Let's work on @${a} using OpenKnowledge.`,s=p4(t,o,a,n,r,i);return f4(o,t4(e.instruction,i,e=>f4(o,e,s,n,r)),s,n,r)}function h4(e){let{target:t}=e,n=e.autoOpen?a4:``,r=u4(e.mentions);if(e.scope===`doc`&&e.selection!==void 0)return m4(e,e.selection,r,n);let i=d4(e);return f4(i,t4(e.instruction,t,e=>f4(i,e,``,r,n)),``,r,n)}function g4(e){return`'${e.replace(/'/g,`'\\''`)}'`}var _4={claude:{bin:`claude`,displayName:`Claude`,docsUrl:`https://docs.claude.com/en/docs/claude-code`,handoffTarget:`claude-code`,mcpPreApproveArg:`--settings ${g4(JSON.stringify({enabledMcpjsonServers:[k1]}))}`},codex:{bin:`codex`,displayName:`Codex`,docsUrl:`https://developers.openai.com/codex/cli`,handoffTarget:`codex`},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`}},v4=[`claude`,`codex`,`cursor`,`opencode`];function y4(e,t,n={}){let r=_4[e],i=n.mcpPreApprove===!0&&r.mcpPreApproveArg?`${r.mcpPreApproveArg} `:``,a=r.promptFlag?`${r.promptFlag} `:``;return`${r.bin} ${i}${a}${g4(t)}\r`}function b4(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}}function x4(e){return e.split(`/`).some(e=>e.startsWith(`.`))}function S4(e,t){let n=b4(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}var C4=E().superRefine(S4).optional(),w4={agentId:E().optional(),agentName:E().optional(),colorSeed:E().optional(),clientName:E().optional(),clientVersion:E().optional(),label:E().optional()},T4=E().optional(),E4=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;Ra(`kind`,[A({kind:M(`doc`),docPath:E().min(1)}).loose(),A({kind:M(`folder`),folderPath:E()}).loose()]);var D4=j([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),O4=Ra(`ok`,[A({ok:M(!0),shareUrl:E().min(1),sharedUrl:E().min(1),branch:E().min(1)}).loose(),A({ok:M(!1),error:D4,branch:E().min(1).optional()}).loose()]),k4=j([`user`,`org`]),A4=A({login:E().min(1),kind:k4,avatarUrl:E().optional()}).loose(),j4=j([`auth-required`,`network`]),M4=Ra(`ok`,[A({ok:M(!0),owners:k(A4)}).loose(),A({ok:M(!1),error:j4}).loose()]),N4=Ra(`ok`,[A({ok:M(!0),available:O()}).loose(),A({ok:M(!1),error:j4}).loose()]),P4=j([`public`,`private`]);A({owner:E().min(1),name:E().min(1),visibility:P4,description:E().optional()}).loose();var F4=j([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),I4=Ra(`ok`,[A({ok:M(!0),ownerLogin:E().min(1),repoName:E().min(1),cloneUrl:E().min(1),defaultBranch:E().min(1)}).loose(),A({ok:M(!1),error:F4}).loose()]);function L4(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}var R4=e=>e.refine(L4,`invalid branch name`),z4={shareTargetExists:O(),dirtyConflicts:A({conflicts:O(),files:k(E().min(1))}).loose(),branchIsLocal:O()};Ra(`detached`,[A({detached:M(!1),currentBranch:E().min(1).nullable(),currentHeadSha:Da(),...z4}).loose(),A({detached:M(!0),currentBranch:Da(),currentHeadSha:E().min(1),...z4}).loose()]),A({branch:R4(E().min(1)),principalId:E().optional()}).loose();var B4=j([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`]);Ra(`ok`,[A({ok:M(!0)}).loose(),A({ok:M(!1),reason:B4,files:k(E().min(1)).optional(),otherWorktreePath:E().min(1).optional()}).loose()]);var V4=A({serverInstanceId:E().min(1),currentBranch:E().min(1).optional(),currentDiskAckSVs:Ha(E().min(1),E().min(1)).optional()}).loose(),H4=A({id:E().min(1),display_name:E().min(1),display_email:E(),source:j([`git-config`,`synthesized`]),created_at:E().min(1)}).loose();A({collabUrl:E().nullable(),previewUrl:E().nullable(),port:D(),paneTarget:E().nullable(),singleFile:O().default(!1)}).loose();var U4=A({type:j(`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: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`.split(`.`)),title:E().min(1),status:D().int().min(400).max(599),instance:E().regex(E4,`instance must be urn:uuid:<uuid>`).optional(),detail:E().optional()}).loose();A({parentDocName:E().min(1),agentId:E().min(1).optional(),agentName:E().min(1).optional()}).loose();var W4=A({src:E().min(1),path:E().min(1).optional(),deduped:O().optional()}).loose();A({url:E().min(1),dir:E().min(1),branch:E().min(1).refine(L4,`invalid branch name`).optional()}).loose(),A({type:M(`error`),problem:U4}).loose();var G4=8192,K4=32768,q4=`…[truncated]`;function J4(e){let t=e.trim();if(t.length===0||t[0]!==`{`)return null;let n;try{n=JSON.parse(t)}catch{return null}if(typeof n!=`object`||!n||Array.isArray(n))return null;let r=n;return{event:typeof r.event==`string`?r.event:void 0,fields:r}}function Y4(e){return e.length<=8192?e:`${e.slice(0,G4-12)}${q4}`}var X4=/notionvc:/i,Z4=()=>e=>{Q4(e)&&($4(e),e3(e))};function Q4(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(X4.test(e))return!0}if(t.type===`element`&&Q4(t))return!0}return!1}function $4(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&$4(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(`
469
469
  `)){t.push(n);continue}let r=e.split(`
470
470
  `);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 e3(e){if(!(!(`children`in e)||!Array.isArray(e.children))){e.children=e.children.filter(e=>e.type===`comment`?!X4.test(String(e.value??``)):!0);for(let t of e.children)t.type===`element`&&e3(t)}}var t3=new Set([`Apple-tab-span`,`Apple-converted-space`,`Apple-style-span`]),n3=()=>e=>{r3(e)};function r3(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&r3(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return i3(t)?[]:a3(t)?t.children:[t]})}}function i3(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 a3(e){if(e.tagName!==`span`)return!1;let t=e.properties?.className;return Array.isArray(t)?t.length>0&&t.every(e=>t3.has(String(e))):!1}var o3=`docs-internal-guid-`;function s3(e,t){let n=e.children[t];!n||n.type!==`element`||e.children.splice(t,1,...n.children)}var c3=()=>e=>{l3(e)};function l3(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&l3(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(u3(r)||d3(r)){s3(e,t);continue}t++}}function u3(e){if(e.tagName!==`b`)return!1;let t=e.properties?.id;return typeof t==`string`&&t.startsWith(o3)}function d3(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 f3=new Set([`commit-link`,`user-mention`,`team-mention`,`issue-link`]),p3=()=>e=>{m3(e)};function m3(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&m3(t);for(let t of e.children)t.type===`element`&&h3(t)}}function h3(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=>!f3.has(String(e)));n.length===0?delete e.properties.className:e.properties.className=n}}var g3=/^gmail_/,_3=()=>e=>{v3(e)};function v3(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&v3(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`&&y3(r,`gmail_quote`)&&(r.tagName=`blockquote`),b3(r),x3(r)){e.children.splice(t,1,...r.children);continue}t++}}function y3(e,t){let n=e.properties?.className;return Array.isArray(n)?n.some(e=>String(e)===t):!1}function b3(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!g3.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}function x3(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 S3=()=>e=>{C3(e)};function C3(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&C3(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`?[]:(w3(t),[t])})}}function w3(e){if(e.properties)for(let t of Object.keys(e.properties))t.startsWith(`dataSheets`)&&delete e.properties[t]}var T3=[`o:`,`w:`,`m:`,`v:`,`u1:`],E3=/^Mso[A-Z]/,D3=/^\s*\[if\s+[^\]]*\]/,O3=()=>e=>{k3(e)};function k3(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&k3(t);e.children=e.children.flatMap(e=>{if(e.type===`comment`){let t=String(e.value??``);return D3.test(t)?[]:[e]}if(e.type!==`element`)return[e];let t=e;return A3(t)?[]:(j3(t),[t])})}}function A3(e){return T3.some(t=>e.tagName.startsWith(t))}function j3(e){let t=e.properties;if(!t)return;let n=t.className;if(Array.isArray(n)){let e=n.filter(e=>typeof e==`string`&&!E3.test(e));e.length===0?delete t.className:t.className=e}else typeof n==`string`&&E3.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);T3.some(e=>e===`${n}:`)&&delete t[e]}}var M3=/^c-(message_kit__|message__|compose|timestamp)/,N3=()=>e=>{P3(e)};function P3(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&P3(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return F3(t)?[]:(I3(t),[t])})}}function F3(e){let t=e.properties?.className;return Array.isArray(t)?t.some(e=>String(e)===`c-timestamp`||String(e).startsWith(`c-timestamp`)):!1}function I3(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!M3.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}var L3=()=>e=>{R3(e)};function R3(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&R3(t);for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`element`)continue;let r=n;z3(r)&&(e.children[t]=V3(r))}}}function z3(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=>B3(e))}function B3(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)||B3(e))return!0}return!1}function V3(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=>H3(e)).join(`
471
471
  `)}]}]}}function H3(e){let t=``;for(let n of e.children)n.type===`text`?t+=n.value??``:n.type===`element`&&(t+=H3(n));return t}var U3=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}},W3=[c3,O3,n3,_3,Z4,L3,S3,N3,p3];function G3(e){jF(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 K3(e,t){let n=t?.maxBytes??5242880;if(e.length>n)throw new U3(e.length,n);let r=SU().use(kP,{fragment:!0});for(let e of W3)r.use(e);for(let e of t?.additionalCleanupPlugins??[])r.use(e);r.use(AL);let i=r.parse(e),a=r.runSync(i);return G3(a),a}function q3(e){return String(SU().use(pU).use(mU).stringify(e))}function J3(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`&&Y3(e.value.value,t))continue}let o=X3(e,t);r>=0?n[r]=o:n.push(o)}return n}function Y3(e,t){try{return JSON.stringify(JSON.parse(e))===JSON.stringify(t)}catch{return!1}}function X3(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 Z3(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:J3(t,r),children:n.all(t),data:{}}}var Q3=/^[A-Za-z0-9]{20,}$/,$3=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function e6(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function t6(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let n=t[1]??``;return Q3.test(n)?n:null}function n6(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:`||!e6(t.hostname))return null;let n=t6(t);if(!n)return null;let r=t.searchParams.get(`t`);return{id:n,startRaw:r&&r.length>0&&$3.test(r)?r:null}}function r6(e){return n6(e)!==null}function i6(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function a6(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:i6(t.hostname)}var o6=/^[A-Za-z0-9_-]{11}$/;function s6(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 c6(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 l6(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return o6.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return o6.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function u6(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:`||!s6(t.hostname))return null;let n=l6(t);if(!n)return null;let r=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:n,startSeconds:r.length>0?c6(r):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}var d6=[{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`}],f6=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:M1,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}],p6=[{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}],m6=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:N1,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`&&(a6(e.src)||r6(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:M1,hideWhen:e=>typeof e.src==`string`&&(a6(e.src)||r6(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`&&r6(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`&&(a6(e.src)||r6(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`&&(u6(e.src)!==null||a6(e.src)||r6(e.src))},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],h6=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:P1,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`}],g6=[{name:`title`,type:`string`,required:!0,description:`Accordion heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the accordion 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`}],_6=[d6[0],d6[1],d6[4],d6[5],d6[6]],v6=[f6[0],f6[1],f6[7]],y6=[g6[0],g6[1],g6[4],g6[5]],b6=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],x6=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],S6=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],C6=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],w6=[{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`)"}],T6=[{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."}],E6=[T6[0]],D6=[T6[0]],O6=[{name:`chart`,type:`string`,required:!0,hidden:!0,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],k6=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],A6=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],j6=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:F1,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`)"}],M6=[{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."}],N6=[{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 P6(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function F6(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function I6(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 L6=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:d6,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)=>Z3(`Callout`,e,t,d6)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:f6,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)=>Z3(`img`,e,t,f6)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:m6,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)=>Z3(`video`,e,t,m6)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:h6,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)=>Z3(`audio`,e,t,h6)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:j6,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)=>Z3(`Pdf`,e,t,j6)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:A6,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)=>Z3(`File`,e,t,A6)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:p6,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)=>Z3(`Embed`,e,t,p6)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:g6,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:[`toggle`,`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],exampleBody:`Body content revealed when the accordion is expanded.`,serialize:(e,t)=>Z3(`Accordion`,e,t,g6)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:C6,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>