@inkeep/open-knowledge 0.48.1 → 0.48.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-harness-probe-B4V6KJkv.mjs → acp-harness-probe-dGS3CfhR.mjs} +2 -2
- package/dist/cli.mjs +6 -6
- package/dist/constants-ByRd9AfD.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/init-BG5OnRTs.mjs +1 -0
- package/dist/{init-BTuBIiJr.mjs → init-BRRzr201.mjs} +3 -3
- package/dist/{launch-json-removal-BuFfgFK6.mjs → launch-json-removal-DmEAv6Sr.mjs} +2 -2
- package/dist/loader-B0fVATtC.mjs +1 -0
- package/dist/{loader-Faz8vqCB.mjs → loader-DuZCwxq5.mjs} +2 -2
- package/dist/preview-MSrIrOjR.mjs +1 -0
- package/dist/{preview-BIeu4g0O.mjs → preview-rbXV3HQ4.mjs} +2 -2
- package/dist/public/assets/{ActivityModeContent-C3ip7dNC.js → ActivityModeContent-Ls6Ii2AR.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-Wi29jCni.js → AgentDiffPane-CRYL--uE.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-FT8wNbjk.js → AgentThreadClientBinder-DkJCXESC.js} +1 -1
- package/dist/public/assets/{ChangedOutsideBadge-C0FXh0Oi.js → ChangedOutsideBadge-C7ib2CLj.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-BQoCzCdy.js → CodeMirrorPropInput-TJBj2ROv.js} +1 -1
- package/dist/public/assets/{DocumentContext-CP7yqH5z.js → DocumentContext-x5CUxxhI.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-NV902SqC.js → EditorModeToggle-Bzur2AVh.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-B3txwN8d.js → EnableSyncConfirmDialog-Znrf_6pT.js} +1 -1
- package/dist/public/assets/FeedbackForm-DMTgXOQ0.js +1 -0
- package/dist/public/assets/{GraphPanel-z_BpNtFU.js → GraphPanel-WI6aG2BT.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-JqA7a0sU.js → ImportSkillDialog-DbA_I30Z.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-SRropTDk.js → LintConfigEditor-DtuTsRPs.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-B0bIS4IP.js → ManagedArtifactProperties-673wYJvM.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-CrJ02738.js +1 -0
- package/dist/public/assets/{McpConsentDialogBody-BiF_k0VW.js → McpConsentDialogBody-BP8KTHru.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-DkkZ1470.js → MermaidDocEditor-CnjxdTzJ.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-CtlgCQX3.js → ReportBugDialogBody-DcEMoxKz.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-DOmoubBM.js → SchemaConfigEditor-DzyMGxmc.js} +1 -1
- package/dist/public/assets/{SessionsHost-CFGRv_pY.js → SessionsHost-31LO23Wl.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-D_1DunuR.js → SettingsDialogBody-DzlQ13IX.js} +1 -1
- package/dist/public/assets/{ShareBranchSwitchDialog-DYf_N6bq.js → ShareBranchSwitchDialog-DSnG7Vwo.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-ayJ6qYFK.js → ShareReceiveDialog-hp8-_wD0.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-OcYPcuBz.js → ShareReceiveMissDialog-Cw4ZtAVB.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-DBJEqMg4.js → SkillEditBanner-CWVFuS5L.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-FJ-Hk1Uz.js → SkillOriginInline-C5BvTKcL.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-DvoPtfHF.js → SkillToolbarControls-B137QbKv.js} +1 -1
- package/dist/public/assets/{SourceEditor-BgyZO1t7.js → SourceEditor-7UYreAPX.js} +1 -1
- package/dist/public/assets/{TerminalPanel-DN4Eag17.js → TerminalPanel-Bb4mBhjy.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-CPjZ5xvY.js → TerminalWindowApp-CVRgfXzw.js} +1 -1
- package/dist/public/assets/{TextDocEditor-gUC9Hdas.js → TextDocEditor-DRxNsWPL.js} +1 -1
- package/dist/public/assets/{ThreadView-CPLWVyZk.js → ThreadView-lR-GvL11.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-CH9Paxeb.js → TimelineDiffPane-eky-61qS.js} +1 -1
- package/dist/public/assets/{agent-diff-store-c2pI-IqS.js → agent-diff-store-k2Na1UuM.js} +1 -1
- package/dist/public/assets/{agent-visibility-p6xMSDdk.js → agent-visibility-BdUDvgZz.js} +1 -1
- package/dist/public/assets/{auth-state-cache-khzbb5gf.js → auth-state-cache-DGUqbXC_.js} +1 -1
- package/dist/public/assets/{client-version-1hLDBtWZ.js → client-version-BK_KR7U_.js} +1 -1
- package/dist/public/assets/{comment-chips-GFaq2hJN.js → comment-chips-BPKPgIfD.js} +1 -1
- package/dist/public/assets/{config-context-JFJadbOg.js → config-context-BQkCAyV-.js} +1 -1
- package/dist/public/assets/{config-provider-GgI7K6tF.js → config-provider-BxPJaWVp.js} +1 -1
- package/dist/public/assets/{dist-D0lKV18u2.js → dist-B1W6XlK32.js} +1 -1
- package/dist/public/assets/{doc-paths-BuYvs-Sl.js → doc-paths-BPPZUgg6.js} +1 -1
- package/dist/public/assets/{documents-events-CZXYlWJs.js → documents-events-yek6VMZz.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-VPm5Cnie.js → file-tree-adapter-3ja1qlJs.js} +1 -1
- package/dist/public/assets/{file-tree-utils-DEJGOhLm.js → file-tree-utils-Bl84nllO.js} +1 -1
- package/dist/public/assets/{folder-config-api-CkzVN79U.js → folder-config-api-DsCcuh72.js} +1 -1
- package/dist/public/assets/{follow-file-Dlt39wWC.js → follow-file-DFcAxjow.js} +1 -1
- package/dist/public/assets/{globals-CiUwipyS.js → globals-DTeKgG7r.js} +1 -1
- package/dist/public/assets/{index-C8WPpAGW.js → index-DoaRsdsH.js} +108 -108
- package/dist/public/assets/{lint-config-client-CKLyoxWn.js → lint-config-client-CbBNbz5z.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-BJyF5XvC.js → markdownlint-rule-browser-bRkNLTrS.js} +1 -1
- package/dist/public/assets/{navigation-targets-kcw1-114.js → navigation-targets-BekPm3G2.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-CRB-rvl-.js → open-managed-artifact-tab-BIfn2FfR.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-yAE2j52e.js → pending-receive-nav-store-B9cFPfgA.js} +1 -1
- package/dist/public/assets/{prop-types-C-VFVfev.js → prop-types-Bhux6LAG.js} +1 -1
- package/dist/public/assets/{receive-store-C3RyDFMU.js → receive-store-B49FgHLW.js} +1 -1
- package/dist/public/assets/{selection-context-BN5sWQOX.js → selection-context-De7RWVbr.js} +1 -1
- package/dist/public/assets/{skill-actions-gJbOdqsR.js → skill-actions-BPyEVJTE.js} +1 -1
- package/dist/public/assets/{skill-scope-DwDLnOOD.js → skill-scope-VJV5Rx86.js} +1 -1
- package/dist/public/assets/{skills-api-BBaU5yMj.js → skills-api-BMRKwBUl.js} +1 -1
- package/dist/public/assets/{src-BFaead-K.js → src-Ch8D3fT_.js} +1 -1
- package/dist/public/assets/{tag-pill-input-T8jCzKA4.js → tag-pill-input-DtKTv6kf.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-ur7EfH9N.js → target-navigation-intent-NvDqDHJ2.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-CIEJD8Ca.js → terminal-launch-events-cjIUscHc.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-D3CzWhx2.js → terminal-telemetry-BoiP_PBP.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-BHTVn_xV.js → typing-burst-detector-VZnl_iVo.js} +1 -1
- package/dist/public/assets/{uninstall-D82wPzEe.js → uninstall-Da1ho4P8.js} +1 -1
- package/dist/public/assets/{use-activity-panel-jx8Sg0rQ.js → use-activity-panel-BcGb7XOc.js} +1 -1
- package/dist/public/assets/{use-collab-url-oYOwLAYB.js → use-collab-url-BKsQe4b1.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-DEdN-vX3.js → use-live-xterm-theme-CpBGZzBF.js} +1 -1
- package/dist/public/assets/{use-open-skill-BH3vfRE3.js → use-open-skill-BFI8qRZm.js} +1 -1
- package/dist/public/assets/use-settings-route-B15KAQLp.js +1 -0
- package/dist/public/assets/{use-skill-directory-DTKROB4o.js → use-skill-directory-B5pZTEfG.js} +1 -1
- package/dist/public/assets/{use-skill-origin-LsbeWa_R.js → use-skill-origin-CNiZj4lD.js} +1 -1
- package/dist/public/assets/{use-skills-CtCsB6PZ.js → use-skills-nDAfVSei.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-BArDTeSK.js → use-terminal-enabled-DoIFtYZ1.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-CdswgYxP.js → use-timeline-entry-diff-Cqn9J0oR.js} +1 -1
- package/dist/public/assets/{use-workspace-3mjuTrTC.js → use-workspace-DVmty0IU.js} +1 -1
- package/dist/public/index.html +44 -44
- package/dist/public/uninstall.html +3 -3
- package/dist/{repair-launch-json-t6-ItmBL.mjs → repair-launch-json-y0Ye6Viu.mjs} +2 -2
- package/dist/{repair-mcp-configs-rKNBA3_W.mjs → repair-mcp-configs-BpFSKCVX.mjs} +2 -2
- package/dist/{src-DBW4c9sO.mjs → src-COaJTUgj.mjs} +2 -2
- package/dist/{start-BqVtFjo1.mjs → start-BnzFfXFP.mjs} +2 -2
- package/dist/start-Cm8K9jls.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-BtTFdIEz.mjs +0 -2
- package/dist/init-PWlU6Inh.mjs +0 -1
- package/dist/loader-LMzEjgFg.mjs +0 -1
- package/dist/preview-CepegBxs.mjs +0 -1
- package/dist/public/assets/FeedbackForm-BXkT1oYo.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-d28y4KXb.js +0 -1
- package/dist/public/assets/use-settings-route-B1Atzr9C.js +0 -1
- package/dist/start-RqncH3ch.mjs +0 -1
|
@@ -406,7 +406,7 @@ Please provide a chat model before proceeding with creating an answer session.
|
|
|
406
406
|
Read more at https://docs.orama.com/docs/orama-js/plugins/plugin-secure-proxy#plugin-secure-proxy
|
|
407
407
|
`,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 xq(e,...t){let n=Error(QK(bq[e]??`Unsupported Orama Error code: ${e}`,...t));return n.code=e,`captureStackTrace`in Error.prototype&&Error.captureStackTrace(n),n}function Sq(e){return{raw:Number(e),formatted:nq(e)}}function Cq(e){if(e.id){if(typeof e.id!=`string`)throw xq(`DOCUMENT_ID_MUST_BE_STRING`,typeof e.id);return e.id}return iq()}function wq(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(Oq(r)){let e=jq(r);if(!Array.isArray(t)||t.length!==e)throw xq(`INVALID_INPUT_VECTOR`,n,e,t.length);continue}if(kq(r)){if(!Array.isArray(t))return n;let e=Aq(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=wq(t,r);if(e)return n+`.`+e;continue}if(typeof t!==r)return n}}}var Tq={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},Eq={"string[]":`string`,"number[]":`number`,"boolean[]":`boolean`,"enum[]":`enum`};function Dq(e){return e===`geopoint`}function Oq(e){return typeof e==`string`&&/^vector\[\d+\]$/.test(e)}function kq(e){return typeof e==`string`&&Tq[e]}function Aq(e){return Eq[e]}function jq(e){let t=Number(e.slice(7,-1));switch(!0){case isNaN(t):throw xq(`INVALID_VECTOR_VALUE`,e);case t<=0:throw xq(`INVALID_VECTOR_SIZE`,e);default:return t}}function Mq(){return{idToInternalId:new Map,internalIdToId:[],save:Nq,load:Pq}}function Nq(e){return{internalIdToId:e.internalIdToId}}function Pq(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 Fq(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?Fq(e,t.toString()):t}function Iq(e,t){if(e.internalIdToId.length<t)throw Error(`Invalid internalId ${t}`);return e.internalIdToId[t-1]}function Lq(e,t){return{sharedInternalDocumentStore:t,docs:{},count:0}}function Rq(e,t){let n=Fq(e.sharedInternalDocumentStore,t);return e.docs[n]}function zq(e,t){let n=t.length,r=Array.from({length:n});for(let i=0;i<n;i++){let n=Fq(e.sharedInternalDocumentStore,t[i]);r[i]=e.docs[n]}return r}function Bq(e){return e.docs}function Vq(e,t,n,r){return e.docs[n]===void 0?(e.docs[n]=r,e.count++,!0):!1}function Hq(e,t){let n=Fq(e.sharedInternalDocumentStore,t);return e.docs[n]===void 0?!1:(delete e.docs[n],e.count--,!0)}function Uq(e){return e.count}function Wq(e,t){let n=t;return{docs:n.docs,count:n.count,sharedInternalDocumentStore:e}}function Gq(e){return{docs:e.docs,count:e.count}}function Kq(){return{create:Lq,get:Rq,getMultiple:zq,getAll:Bq,store:Vq,remove:Hq,count:Uq,load:Wq,save:Gq}}var qq=[`beforeInsert`,`afterInsert`,`beforeRemove`,`afterRemove`,`beforeUpdate`,`afterUpdate`,`beforeUpsert`,`afterUpsert`,`beforeSearch`,`afterSearch`,`beforeInsertMultiple`,`afterInsertMultiple`,`beforeRemoveMultiple`,`afterRemoveMultiple`,`beforeUpdateMultiple`,`afterUpdateMultiple`,`beforeUpsertMultiple`,`afterUpsertMultiple`,`beforeLoad`,`afterLoad`,`afterCreate`];function Jq(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),xq(`PLUGIN_CRASHED`)}return n}var Yq=[`tokenizer`,`index`,`documentsStore`,`sorter`,`pinning`],Xq=[`validateSchema`,`getDocumentIndexId`,`getDocumentProperties`,`formatElapsedTime`];function Zq(e,t,n,r){if(e.some(pq))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function Qq(e,t,n){if(e.some(pq))return(async()=>{for(let r of e)await r(t,n)})();for(let r of e)r(t,n)}function $q(e,t,n,r,i){if(e.some(pq))return(async()=>{for(let a of e)await a(t,n,r,i)})();for(let a of e)a(t,n,r,i)}function eJ(e,t,n,r){if(e.some(pq))return(async()=>{for(let i of e)await i(t,n,r)})();for(let i of e)i(t,n,r)}function tJ(e,t){if(e.some(pq))return(async()=>{for(let n of e)await n(t)})();for(let n of e)n(t)}var nJ=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}},rJ=class e{root=null;insertCount=0;constructor(e,t){e!==void 0&&t!==void 0&&(this.root=new nJ(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?nJ.fromJSON(t.root):null,n.insertCount=t.insertCount||0,n}insertNode(e,t,n,r){if(e===null)return new nJ(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 nJ(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 nJ(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}},iJ=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 aJ(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 oJ(e,t,n){let r=aJ(e,t,n);return{distance:r,isBounded:r>=0}}var sJ=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(aq(e,i)!==null)if(r)if(Math.abs(t.length-i.length)<=r&&oJ(t,i,r).isBounded)e[i]=[];else continue;else e[i]=[];if(aq(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&&(oJ(e,n,r).isBounded&&(i[n]=[]),aq(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}},cJ=class e extends sJ{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,sJ.fromJSON(t)])||[]),n}toJSON(){return super.toJSON()}},lJ=2,uJ=6371e3,dJ=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}},fJ=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 dJ(e,t);if(this.nodeMap.set(n,i),this.root==null){this.root=i;return}let a=this.root,o=0;for(;;){if(o%lJ===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=dJ.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 uJ*(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 w=S*(n*n-i*i)/(i*i),T=1+w/16384*(4096+w*(-768+w*(320-175*w))),E=w/1024*(256+w*(-128+w*(74-47*w))),ee=E*v*(C+E/4*(y*(-1+2*C*C)-E/6*C*(-3+4*v*v)*(-3+4*C*C)));return i*T*(b-ee)}},pJ=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 mJ(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 hJ=class e{size;vectors=new Map;constructor(e){this.size=e}add(e,t){t instanceof Float32Array||(t=new Float32Array(t));let n=gJ(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)),_J(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 gJ(e,t){let n=0;for(let r=0;r<t;r++)n+=e[r]*e[r];return Math.sqrt(n)}function _J(e,t,n,r,i){let a=gJ(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 vJ(e,t,n,r,i){let a=Fq(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 yJ(e,t,n,r,i){let a=0;for(let e of r)e===i&&a++;let o=Fq(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 bJ(e,t,n,r){let i=Fq(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 xJ(e,t,n){e.tokenOccurrences[t][n]--}function SJ(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)){SJ(e,t,o,r,n);continue}if(Oq(o))r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o,r.vectorIndexes[n]={type:`Vector`,node:new hJ(jq(o)),isArray:!1};else{let e=/\[/.test(o);switch(o){case`boolean`:case`boolean[]`:r.indexes[n]={type:`Bool`,node:new pJ,isArray:e};break;case`number`:case`number[]`:r.indexes[n]={type:`AVL`,node:new rJ(0,[]),isArray:e};break;case`string`:case`string[]`:r.indexes[n]={type:`Radix`,node:new cJ,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 iJ,isArray:e};break;case`geopoint`:r.indexes[n]={type:`BKD`,node:new fJ,isArray:e};break;default:throw xq(`INVALID_SCHEMA_TYPE`,Array.isArray(o)?`array`:o,n)}r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=o}}return r}function CJ(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 wJ(e,t,n,r,i,a,o,s,c,l,u){if(Oq(o))return TJ(t,n,a,r,i);let d=CJ(e,t,n,i,s,c,l,u);if(!kq(o))return d(a);let f=a,p=f.length;for(let e=0;e<p;e++)d(f[e])}function TJ(e,t,n,r,i){e.vectorIndexes[t].node.add(i,n)}function EJ(e,t,n,r,i,a,o,s,c,l){if(Oq(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 DJ(e,t,n,r,i,a,o,s,c,l){if(!kq(o))return EJ(e,t,n,r,i,a,o,s,c,l);let u=Aq(o),d=a,f=d.length;for(let a=0;a<f;a++)EJ(e,t,n,r,i,d[a],u,s,c,l);return!0}function OJ(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=mJ(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 kJ(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 xq(`WRONG_SEARCH_PROPERTY_TYPE`,n);let d=s[n]??1;if(d<=0)throw xq(`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];OJ(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 AJ(e,t,n,r){if(`and`in n&&n.and&&Array.isArray(n.and)){let i=n.and;return i.length===0?new Set:hq(...i.map(n=>AJ(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=>AJ(e,t,n,r)).reduce((e,t)=>_q(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 vq(a,AJ(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 xq(`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]=_q(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=dq(t,r),d=s.searchByRadius(n,u,c,void 0,l);a[o]=IJ(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]=IJ(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]=BJ(a[o],t)}}continue}let u=Object.keys(i);if(u.length>1)throw xq(`INVALID_FILTER_OPERATION`,u.length);if(c===`Flat`){let e=new Set(l?s.filterArr(i):s.filter(i));a[o]=_q(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 xq(`INVALID_FILTER_OPERATION`,e)}a[o]=_q(a[o],n)}}return hq(...Object.values(a))}function jJ(e){return e.searchableProperties}function MJ(e){return e.searchablePropertiesWithTypes}function NJ(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:cJ.fromJSON(t),isArray:i};break;case`Flat`:u[e]={type:`Flat`,node:iJ.fromJSON(t),isArray:i};break;case`AVL`:u[e]={type:`AVL`,node:rJ.fromJSON(t),isArray:i};break;case`BKD`:u[e]={type:`BKD`,node:fJ.fromJSON(t),isArray:i};break;case`Bool`:u[e]={type:`Bool`,node:pJ.fromJSON(t),isArray:i};break;default:u[e]=n[e]}}for(let e of Object.keys(r))d[e]={type:`Vector`,isArray:!1,node:hJ.fromJSON(r[e])};return{sharedInternalDocumentStore:e,indexes:u,vectorIndexes:d,searchableProperties:i,searchablePropertiesWithTypes:a,frequencies:o,tokenOccurrences:s,avgFieldLength:c,fieldLengths:l}}function PJ(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 FJ(){return{create:SJ,insert:wJ,remove:DJ,insertDocumentScoreParameters:vJ,insertTokenScoreParameters:yJ,removeDocumentScoreParameters:bJ,removeTokenScoreParameters:xJ,calculateResultScores:OJ,search:kJ,searchByWhereClause:AJ,getSearchableProperties:jJ,getSearchablePropertiesWithTypes:MJ,load:NJ,save:PJ}}function IJ(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 LJ(e,t,n=!1){let r=n?fJ.vincentyDistance:fJ.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 RJ(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 zJ(e,t){let n=e,r=RJ(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=dq(e,n);return s=o.searchByRadius(c,l,r,`asc`,i),LJ(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=fJ.calculatePolygonCentroid(e);return LJ(s,r,n)}return null}function BJ(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 VJ(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=VJ(e,t,s,r,n);ZK(a.sortableProperties,i.sortableProperties),a.sorts={...a.sorts,...i.sorts},a.sortablePropertiesWithTypes={...a.sortablePropertiesWithTypes,...i.sortablePropertiesWithTypes};continue}if(!Oq(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 xq(`INVALID_SORT_SCHEMA_TYPE`,Array.isArray(s)?`array`:s,n)}}}return a}function HJ(e,t,n,r){return r?.enabled===!1?{disabled:!0}:VJ(e,t,n,(r||{}).unsortableProperties||[],``)}function UJ(e,t,n,r){if(!e.enabled)return;e.isSorted=!1;let i=Fq(e.sharedInternalDocumentStore,n),a=e.sorts[t];a.orderedDocsToRemove.has(i)&&XJ(e,t),a.docs.set(i,a.orderedDocs.length),a.orderedDocs.push([i,r])}function WJ(e){if(e.isSorted||!e.enabled)return;let t=Object.keys(e.sorts);for(let n of t)JJ(e,n);e.isSorted=!0}function GJ(e,t,n){return t[1].localeCompare(n[1],WK(e))}function KJ(e,t){return e[1]-t[1]}function qJ(e,t){return t[1]?-1:1}function JJ(e,t){let n=e.sorts[t],r;switch(n.type){case`string`:r=GJ.bind(null,e.language);break;case`number`:r=KJ.bind(null);break;case`boolean`:r=qJ.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 YJ(e){let t=Object.keys(e.sorts);for(let n of t)XJ(e,n)}function XJ(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 ZJ(e,t,n){if(!e.enabled)return;let r=e.sorts[t],i=Fq(e.sharedInternalDocumentStore,n);r.docs.get(i)&&(r.docs.delete(i),r.orderedDocsToRemove.set(i,!0))}function QJ(e,t,n){if(!e.enabled)throw xq(`SORT_DISABLED`);let r=n.property,i=n.order===`DESC`,a=e.sorts[r];if(!a)throw xq(`UNABLE_TO_SORT_ON_UNKNOWN_FIELD`,r,e.sortableProperties.join(`, `));return XJ(e,r),WJ(e),t.sort((t,n)=>{let r=a.docs.get(Fq(e.sharedInternalDocumentStore,t[0])),o=a.docs.get(Fq(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 $J(e){return e.enabled?e.sortableProperties:[]}function eY(e){return e.enabled?e.sortablePropertiesWithTypes:{}}function tY(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 nY(e){if(!e.enabled)return{enabled:!1};YJ(e),WJ(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 rY(){return{create:HJ,insert:UJ,remove:ZJ,save:nY,load:tY,sortBy:QJ,getSortableProperties:$J,getSortablePropertiesWithTypes:eY}}var iY=192,aY=383,oY=[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 sY(e){return e<iY||e>aY?e:oY[e-iY]||e}function cY(e){let t=[];for(let n=0;n<e.length;n++)t[n]=sY(e.charCodeAt(n));return String.fromCharCode(...t)}var lY={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`},uY={icate:`ic`,ative:``,alize:`al`,iciti:`ic`,ical:`ic`,ful:``,ness:``},dY=`[^aeiou]`,fY=`[aeiouy]`,pY=dY+`[^aeiouy]*`;fY+``;var mY=`^(`+pY+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,hY=`^(`+pY+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$`,gY=`^(`+pY+`)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*`,_Y=`^(`+pY+`)?[aeiouy]`;function vY(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(mY),r.test(t[1])&&(r=/.$/,e=e.replace(r,``))}else i.test(e)&&(t=i.exec(e)[1],i=new RegExp(_Y),i.test(t)&&(e=t,i=/(at|bl|iz)$/,a=RegExp(`([^aeiouylsz])\\1$`),o=RegExp(`^`+pY+fY+`[^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(_Y),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(mY),t&&r.test(t)&&(e=t+lY[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(mY),t&&r.test(t)&&(e=t+uY[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(gY),t&&r.test(t)&&(e=t);else if(i.test(e)){let n=i.exec(e);t=n?.[1]??``+n?.[2]??``,i=new RegExp(gY),i.test(t)&&(e=t)}return r=/^(.+?)e$/,r.test(e)&&(t=r.exec(e)?.[1],r=new RegExp(gY),i=new RegExp(hY),a=RegExp(`^`+pY+fY+`[^aeiouwxy]$`),t&&(r.test(t)||i.test(t)&&!a.test(t))&&(e=t)),r=/ll$/,i=new RegExp(gY),r.test(e)&&i.test(e)&&(r=/.$/,e=e.replace(r,``)),s==`y`&&(e=s.toLowerCase()+e.substring(1)),e}function yY(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=cY(t),n&&this.normalizationCache.set(r,t),t)}function bY(e){for(;e[e.length-1]===``;)e.pop();for(;e[0]===``;)e.shift();return e}function xY(e,t,n,r=!0){if(t&&t!==this.language)throw xq(`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=HK[this.language];a=e.toLowerCase().split(t).map(e=>i(e,r)).filter(Boolean)}let o=bY(a);return this.allowDuplicates?o:Array.from(new Set(o))}function SY(e={}){if(!e.language)e.language=`english`;else if(!UK.includes(e.language))throw xq(`LANGUAGE_NOT_SUPPORTED`,e.language);let t;if(e.stemming||e.stemmer&&!(`stemming`in e))if(e.stemmer){if(typeof e.stemmer!=`function`)throw xq(`INVALID_STEMMER_FUNCTION_TYPE`);t=e.stemmer}else if(e.language===`english`)t=vY;else throw xq(`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 xq(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);if(!Array.isArray(n))throw xq(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`);for(let e of n)if(typeof e!=`string`)throw xq(`CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY`)}let r={tokenize:xY,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:yY,normalizationCache:new Map};return r.tokenize=xY.bind(r),r.normalizeToken=yY,r}function CY(e){return{sharedInternalDocumentStore:e,rules:new Map}}function wY(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 TY(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 EY(e,t){return e.rules.delete(t)}function DY(e,t){return e.rules.get(t)}function OY(e){return Array.from(e.rules.values())}function kY(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 AY(e,t){return e?t.conditions.every(t=>kY(e,t)):!1}function jY(e,t){if(!t)return[];let n=[];for(let r of e.rules.values())AY(t,r)&&n.push(r);return n}function MY(e,t){return{sharedInternalDocumentStore:e,rules:new Map(t?.rules??[])}}function NY(e){return{rules:Array.from(e.rules.entries())}}function PY(){return{create:CY,addRule:wY,updateRule:TY,removeRule:EY,getRule:DY,getAllRules:OY,getMatchingRules:jY,load:MY,save:NY}}function FY(e){let t={formatElapsedTime:Sq,getDocumentIndexId:Cq,getDocumentProperties:cq,validateSchema:wq};for(let n of Xq){let r=n;if(e[r]){if(typeof e[r]!=`function`)throw xq(`COMPONENT_MUST_BE_FUNCTION`,r)}else e[r]=t[r]}for(let t of Object.keys(e))if(!Yq.includes(t)&&!Xq.includes(t))throw xq(`UNSUPPORTED_COMPONENT`,t)}function IY({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 xq(`PLUGIN_COMPONENT_CONFLICT`,e,t.name);r={...r,...n}}i||=iq();let o=r.tokenizer,s=r.index,c=r.documentsStore,l=r.sorter,u=r.pinning;if(o=o?o.tokenize?o:SY(o):SY({language:n??`english`}),r.tokenizer&&n)throw xq(`NO_LANGUAGE_WITH_CUSTOM_TOKENIZER`);let d=Mq();s||=FJ(),l||=rY(),c||=Kq(),u||=PY(),FY(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:LY()};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 qq)g[e]=(g[e]??[]).concat(Jq(g,e));let _=g.afterCreate;return _&&tJ(_,g),g}function LY(){return`{{VERSION}}`}function RY(e){return e.documentsStore.count(e.data.docs)}function zY(e,t,n,r,i){let a=e.validateSchema(t,e.schema);if(a)throw xq(`SCHEMA_VALIDATION_FAILURE`,a);return pq(e.beforeInsert)||pq(e.afterInsert)||pq(e.index.beforeInsert)||pq(e.index.insert)||pq(e.index.afterInsert)?HY(e,t,n,r,i):UY(e,t,n,r,i)}var BY=new Set([`enum`,`enum[]`]),VY=new Set([`string`,`number`]);async function HY(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw xq(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=Fq(e.internalDocumentIDStore,s);if(r||await Zq(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw xq(`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];WY(n,r,e,t)}return await GY(e,s,u,f,l,n,t,i),r||await Zq(e.afterInsert,e,s,t),s}function UY(e,t,n,r,i){let{index:a,docs:o}=e.data,s=e.getDocumentIndexId(t);if(typeof s!=`string`)throw xq(`DOCUMENT_ID_MUST_BE_STRING`,typeof s);let c=Fq(e.internalDocumentIDStore,s);if(r||Zq(e.beforeInsert,e,s,t),!e.documentsStore.store(o,s,c,t))throw xq(`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];WY(n,r,e,t)}return KY(e,s,u,f,l,n,t,i),r||Zq(e.afterInsert,e,s,t),s}function WY(e,t,n,r){if(!(Dq(t)&&typeof r==`object`&&typeof r.lon==`number`&&typeof r.lat==`number`)&&!(Oq(t)&&Array.isArray(r))&&!(kq(t)&&Array.isArray(r))&&!(BY.has(t)&&VY.has(e))&&e!==t)throw xq(`INVALID_DOCUMENT_PROPERTY`,n,t,e)}async function GY(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 KY(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=Fq(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 qY(e,t,n,r,i,a){return pq(e.afterInsertMultiple)||pq(e.beforeInsertMultiple)||pq(e.index.beforeInsert)||pq(e.index.insert)||pq(e.index.afterInsert)?JY(e,t,n,r,i,a):YY(e,t,n,r,i,a)}async function JY(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 zY(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&&yq(e)}}})(),i||await Qq(e.afterInsertMultiple,e,t),o}function YY(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=zY(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&&yq(e)}}}return l(),i||Qq(e.afterInsertMultiple,e,t),o}function XY(e,t){return e[1]-t[1]}function ZY(e,t){return t[1]-e[1]}function QY(e=`desc`){return e.toLowerCase()===`asc`?XY:ZY}function $Y(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(`.`)?lq(t,e):t[e],a=s[e],o=r[e].values;switch(a){case`number`:{let t=n[e].ranges;eX(t,o)(i);break}case`number[]`:{let t=new Set,r=n[e].ranges,a=eX(r,o,t);for(let e of i)a(e);break}case`boolean`:case`enum`:case`string`:tX(o,a)(i);break;case`boolean[]`:case`enum[]`:case`string[]`:{let e=tX(o,a===`boolean[]`?`boolean`:`string`,new Set);for(let t of i)e(t);break}default:throw xq(`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=QY(r.sort);t.values=Object.fromEntries(Object.entries(t.values).sort(i).slice(r.offset??0,r.limit??10))}}return r}function eX(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 tX(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 nX={reducer:(e,t,n,r)=>(t[r]=n,t),getInitialValue:e=>Array.from({length:e})},rX=[`string`,`number`,`boolean`];function iX(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 xq(`UNKNOWN_GROUP_BY_PROPERTY`,t);if(!rX.includes(a[t]))throw xq(`INVALID_GROUP_BY_PROPERTY`,t,rX.join(`, `),a[t])}let o=t.map(([t])=>Iq(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=lq(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=aX(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=sq(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||nX,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 aX(e,t=0){if(t+1===e.length)return e[t].map(e=>[e]);let n=e[t],r=aX(e,t+1),i=[];for(let e of n)for(let t of r){let n=[e];ZK(n,t),i.push(n)}return i}function oX(e,t,n,r){let i=jY(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=Fq(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 sX(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 xq(`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=RY(e);if(l=e.index.search(a,r||``,e.tokenizer,n,o,t.exact||!1,t.tolerance||0,t.boost||{},fX(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=lX(r,e);if(typeof n==`string`&&t.every(e=>RegExp(`\\b${cX(e)}\\b`).test(n)))return!0}return!1})}}else l=s?zJ(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 cX(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function lX(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 uX(e,t,n){let r=rq();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=sX(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])=>[Fq(e.internalDocumentIDStore,t),n]);else d=d.sort(oq);d=oX(e,e.data.pinning,d,t.term);let f;u||(f=c?wX(e,d,s,o,c):TX(e,d,s,o));let p={elapsed:{formatted:``,raw:0},hits:[],count:d.length};return f!==void 0&&(p.hits=f.filter(Boolean),l||fq(p,i)),a&&(p.facets=$Y(e,d,t.facets)),t.groupBy&&(p.groups=iX(e,d,t.groupBy)),p.elapsed=e.formatElapsedTime(rq()-r),p}async function a(){e.beforeSearch&&await eJ(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await $q(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}var dX={k:1.2,b:.75,d:.5};function fX(e){let t=e??{};return t.k=t.k??dX.k,t.b=t.b??dX.b,t.d=t.d??dX.d,t}function pX(e,t,n){let r=t.vector;if(r&&(!(`value`in r)||!(`property`in r)))throw xq(`INVALID_VECTOR_INPUT`,Object.keys(r).join(`, `));let i=e.data.index.vectorIndexes[r.property];if(!i)throw xq(`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?xq(`INVALID_INPUT_VECTOR`,`undefined`,a,`undefined`):xq(`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 mX(e,t,n=`english`){let r=rq();function i(){let i=pX(e,t,n).sort(oq);i=oX(e,e.data.pinning,i,void 0);let a=[];t.facets&&Object.keys(t.facets).length>0&&(a=$Y(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:Iq(e.internalDocumentIDStore,n[0]),score:n[1],document:r})}let d=[];t.groupBy&&(d=iX(e,i,t.groupBy));let f=rq()-r;return{count:i.length,hits:u.filter(Boolean),elapsed:{raw:Number(f),formatted:nq(f)},...a?{facets:a}:{},...d?{groups:d}:{}}}async function a(){e.beforeSearch&&await eJ(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await $q(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function hX(e,t,n){let r=vX(sX(e,t,n)),i=pX(e,t,n),a=t.hybridWeights;return xX(r,i,t.term??``,a)}function gX(e,t,n){let r=rq();function i(){let i=hX(e,t,n);i=oX(e,e.data.pinning,i,t.term);let a;t.facets&&Object.keys(t.facets).length>0&&(a=$Y(e,i,t.facets));let o;t.groupBy&&(o=iX(e,i,t.groupBy));let s=t.offset??0,c=t.limit??10,l=TX(e,i,s,c).filter(Boolean),u=rq(),d={count:i.length,elapsed:{raw:Number(u-r),formatted:nq(u-r)},hits:l,...a?{facets:a}:{},...o?{groups:o}:{}};return(t.includeVectors??!1)||fq(d,Object.keys(e.data.index.vectorIndexes)),d}async function a(){e.beforeSearch&&await eJ(e.beforeSearch,e,t,n);let r=i();return e.afterSearch&&await $q(e.afterSearch,e,t,n,r),r}return e.beforeSearch?.length||e.afterSearch?.length?a():i()}function _X(e){return e[1]}function vX(e){let t=Math.max.apply(Math,e.map(_X));return e.map(([e,n])=>[e,n/t])}function yX(e,t){return e/t}function bX(e,t){return(n,r)=>n*e+r*t}function xX(e,t,n,r){let i=Math.max.apply(Math,e.map(_X)),a=Math.max.apply(Math,t.map(_X)),{text:o,vector:s}=r&&r.text&&r.vector?r:SX(n),c=new Map,l=e.length,u=bX(o,s);for(let t=0;t<l;t++){let[n,r]=e[t],a=u(yX(r,i),0);c.set(n,a)}let d=t.length;for(let e=0;e<d;e++){let[n,r]=t[e],i=yX(r,a),o=c.get(n)??0;c.set(n,o+u(0,i))}return[...c].sort((e,t)=>t[1]-e[1])}function SX(e){return{text:.5,vector:.5}}function CX(e,t,n){let r=t.mode??`fulltext`;if(r===`fulltext`)return uX(e,t,n);if(r===`vector`)return mX(e,t);if(r===`hybrid`)return gX(e,t);throw xq(`INVALID_SEARCH_MODE`,r)}function wX(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=lq(m,i);if(!(h===void 0||o.has(h))&&(o.set(h,!0),u++,!(u<=n)&&(s.push({id:Iq(e.internalDocumentIDStore,f),score:p,document:m}),c.add(f),u>=n+r)))break}return s}function TX(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:Iq(e.internalDocumentIDStore,r),score:c,document:t},o.add(r)}}return a}var EX=r(BK(),1),DX=z({at:P(),transport:P(),outcome:P(),reference:P().optional(),error:P().optional()}),OX=z({reason:P(),at:P()});z({version:F().int().catch(1),id:P(),createdAt:P(),bundleLevel:P(),zipBytes:F().int().nonnegative().catch(0),zipDeleted:I().optional(),state:P(),systemWide:I().optional(),projectSlug:P().nullable().optional(),reference:P().optional(),lastError:OX.optional(),attempts:L(DX).optional(),note:P().optional()});var kX=`0.0.0-unknown`,AX={protocol:`x-ok-client-protocol`,runtime:`x-ok-client-runtime`,kind:`x-ok-client-kind`};function jX({kind:e,runtimeVersion:t}){return{[AX.protocol]:`1`,[AX.runtime]:t,[AX.kind]:e}}function MX({kind:e,runtimeVersion:t}){return{clientProtocolVersion:1,clientRuntimeVersion:t,clientKind:e}}var NX=`extra/screenshot.png`,PX=[{name:`macos-home-path`,regex:/\/Users\/[^/]+\//g,replacement:`~/`},{name:`linux-home-path`,regex:/\/home\/[^/]+\//g,replacement:`~/`},{name:`github-pat`,regex:/\b(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:/\b(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/g,replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/\bsk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:/\bsk-[A-Za-z0-9]{20,}\b/g,replacement:`[REDACTED-OPENAI]`},{name:`bearer-token`,regex:/([Aa]uthorization:\s*[Bb]earer\s+)\S+/g,replacement:`$1[REDACTED]`},{name:`jwt`,regex:/eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,replacement:`[REDACTED-JWT]`},{name:`url-credentials`,regex:/:\/\/[^/\s:@]+:[^/\s:@]+@/g,replacement:`://[REDACTED]@`},{name:`github-pat-fine-grained`,regex:/\bgithub_pat_[0-9A-Za-z_]{20,}/g,replacement:`[REDACTED-GH-PAT]`},{name:`openai-key-modern`,regex:/\bsk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/g,replacement:`[REDACTED-OPENAI]`},{name:`slack-token`,regex:/\bxox[a-z]-[A-Za-z0-9-]{10,}/g,replacement:`[REDACTED-SLACK]`},{name:`google-api-key`,regex:/\bAIza[0-9A-Za-z_-]{35}/g,replacement:`[REDACTED-GOOGLE]`},{name:`stripe-secret-key`,regex:/\b(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/g,replacement:`[REDACTED-STRIPE]`},{name:`gitlab-pat`,regex:/\bglpat-[0-9A-Za-z_-]{20,}/g,replacement:`[REDACTED-GITLAB]`},{name:`bearer-token-json`,regex:/("[Aa]uthorization"\s*:\s*"[Bb]earer\s+)[^"]+/g,replacement:`$1[REDACTED]`}];PX.map(e=>e.name);function FX(e){let t=new Set,n=0;return{redacted:e.split(`
|
|
408
408
|
`).map(e=>{let r=e,i=!1;for(let{name:e,regex:n,replacement:a}of PX)n.lastIndex=0,n.test(r)&&(t.add(e),i=!0,n.lastIndex=0,r=r.replace(n,a));return i&&n++,r}).join(`
|
|
409
|
-
`),patterns:[...t],lineCount:n}}function IX(e){return FX(e).redacted}var LX=8192,RX=32768,zX=`…[truncated]`;function BX(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 VX(e){return e.length<=8192?e:`${e.slice(0,LX-12)}${zX}`}function HX(e,t){return!(e.host===`desktop`&&t.host!==`desktop`||e.singleFileHidden&&t.singleFile||e.requiresTerminalLive&&!t.terminalLive||e.requiresCanExpandAll&&!t.canExpandAll||e.requiresCanCollapseAll&&!t.canCollapseAll||e.requiresActiveDoc&&!t.hasActiveDoc||e.requiresInstallSkill&&!t.showInstallSkill||e.requiresTargetKinds&&!e.requiresTargetKinds.includes(t.activeTargetKind))}var UX=[{id:`navigate-back`,menuActionId:`navigate-back`,labelKey:`back`,keywords:[`previous history`],shortcutId:`navigate-back`,shortcutDesktopOnly:!0,availability:{host:`desktop`},palette:{group:`commands`,visibility:`search-only`},menu:[{section:`view-history`,order:0,platform:`mac`,accelerator:`Cmd+[`},{section:`view-history`,order:0,platform:`other`,accelerator:`Alt+Left`}]},{id:`navigate-forward`,menuActionId:`navigate-forward`,labelKey:`forward`,keywords:[`next history`],shortcutId:`navigate-forward`,shortcutDesktopOnly:!0,availability:{host:`desktop`},palette:{group:`commands`,visibility:`search-only`},menu:[{section:`view-history`,order:1,platform:`mac`,accelerator:`Cmd+]`},{section:`view-history`,order:1,platform:`other`,accelerator:`Alt+Right`}]},{id:`new-file`,menuActionId:`new-doc`,labelKey:`newFile`,keywords:[`create file`],shortcutId:`new-item`,availability:{},palette:{group:`commands`,visibility:`always`},menu:[{section:`file-create`,order:0,accelerator:`CmdOrCtrl+N`}]},{id:`new-folder`,menuActionId:`new-folder`,labelKey:`newFolder`,keywords:[`create folder`],shortcutId:`new-folder`,shortcutDesktopOnly:!0,availability:{},palette:{group:`commands`,visibility:`always`},menu:[{section:`file-create`,order:1,accelerator:`CmdOrCtrl+Shift+N`}]},{id:`open-graph`,labelKey:`openGraph`,keywords:[`graph panel network`],availability:{requiresActiveDoc:!0},palette:{group:`commands`,visibility:`always`}},{id:`initialize-starter-pack`,labelKey:`initializeStarterPack`,keywords:[`scaffold`,`seed`,`pack`,`starter`],availability:{},palette:{group:`commands`,visibility:`always`}},{id:`new-skill`,labelKey:`newSkill`,keywords:[`skill`,`create`,`author`,`new`],availability:{singleFileHidden:!0},palette:{group:`commands`,visibility:`always`}},{id:`new-project`,menuActionId:`new-project`,labelKey:`newProject`,keywords:[`create new project scaffold`],availability:{host:`desktop`},palette:{group:`project`,visibility:`always`},menu:[{section:`file-project`,order:0,ellipsis:!0}]},{id:`open-folder`,labelKey:`openFolderOnDisk`,keywords:[`project`,`folder`,`disk`],shortcutId:`open-folder`,availability:{host:`desktop`},palette:{group:`project`,visibility:`always`},menu:[{section:`file-project`,order:2,accelerator:`CmdOrCtrl+O`,ellipsis:!0,menuLabelKey:`openFolder`}]},{id:`open-file`,labelKey:`openFileOnDisk`,keywords:[`file`,`markdown`,`single`,`standalone`,`temporary`],shortcutId:`open-file`,availability:{host:`desktop`},palette:{group:`project`,visibility:`always`},menu:[{section:`file-project`,order:3,accelerator:`CmdOrCtrl+Shift+O`,ellipsis:!0,menuLabelKey:`openFile`}]},{id:`open-skills`,labelKey:`openSkills`,keywords:[`skills marketplace explore import discover`],availability:{singleFileHidden:!0},palette:{group:`project`,visibility:`always`},menu:[]},{id:`switch-project`,labelKey:`switchProject`,keywords:[`switch project navigator projects`],shortcutId:`switch-project`,availability:{host:`desktop`,singleFileHidden:!0},palette:{group:`project`,visibility:`always`},menu:[{section:`file-project`,order:1,accelerator:`CmdOrCtrl+Shift+P`,ellipsis:!0}]},{id:`settings`,labelKey:`settings`,keywords:[`preferences config`],shortcutId:`settings`,availability:{singleFileHidden:!0},palette:{group:`project`,visibility:`always`},menu:[{section:`app-settings`,order:0,platform:`mac`,accelerator:`CmdOrCtrl+,`,ellipsis:!0},{section:`file-settings`,order:0,platform:`other`,accelerator:`CmdOrCtrl+,`,ellipsis:!0}]},{id:`install-claude-desktop`,labelKey:`installClaudeDesktop`,keywords:[`claude desktop install cowork`],availability:{requiresInstallSkill:!0},palette:{group:`project`,visibility:`always`},menu:[{section:`help-install`,order:0,ellipsis:!0,menuLabelText:`Install for Claude Chat & Cowork (desktop app)`}]},{id:`report-bug`,menuActionId:`report-bug`,labelKey:`reportBug`,keywords:[`bug report issue feedback problem`],availability:{host:`desktop`},palette:{group:`project`,visibility:`always`},menu:[{section:`help-links`,order:1,ellipsis:!0}]},{id:`bug-report-history`,labelKey:`bugReportHistory`,keywords:[`bug report history previous reports past retry resend`],availability:{host:`desktop`},palette:{group:`project`,visibility:`always`}},{id:`send-feedback`,menuActionId:`send-feedback`,labelKey:`sendFeedback`,keywords:[`feedback`,`suggestion`,`idea`,`rate`,`survey`,`contact`],availability:{},palette:{group:`project`,visibility:`always`},menu:[{section:`help-links`,order:2,ellipsis:!0}]},{id:`new-from-template`,menuActionId:`new-from-template`,labelKey:`newFromTemplate`,keywords:[`template`,`create`,`new`],availability:{singleFileHidden:!0},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-create`,order:2,ellipsis:!0}]},{id:`rename`,menuActionId:`rename`,labelKey:`rename`,keywords:[`rename`,`file`,`folder`],availability:{host:`desktop`,requiresTargetKinds:[`doc`,`folder`,`asset`]},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-item`,order:1}]},{id:`duplicate`,menuActionId:`duplicate`,labelKey:`duplicate`,keywords:[`duplicate`,`copy`,`file`,`folder`],shortcutId:`file-tree-duplicate`,availability:{host:`desktop`,requiresTargetKinds:[`doc`,`folder`]},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-item`,order:0,accelerator:`CmdOrCtrl+D`}]},{id:`move-to-trash`,menuActionId:`move-to-trash`,labelKey:`moveToTrash`,keywords:[`delete`,`trash`,`remove`],shortcutId:`file-tree-delete`,availability:{host:`desktop`,requiresTargetKinds:[`doc`,`folder`,`asset`]},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-item`,order:2,accelerator:`CmdOrCtrl+Delete`}]},{id:`reveal-in-finder`,menuActionId:`reveal-in-finder`,labelKey:`revealInFinder`,keywords:[`finder`,`reveal`,`show`,`file`],availability:{host:`desktop`,requiresTargetKinds:[`doc`,`folder`,`asset`,`project`]},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-reveal`,order:0}]},{id:`send-to-ai`,menuActionId:`send-to-ai`,labelKey:`openWithAi`,keywords:[`ai`,`agent`,`handoff`],availability:{host:`desktop`,requiresTargetKinds:[`doc`,`folder`,`project`]},menu:[{section:`file-reveal`,order:1}]},{id:`copy-full-path`,menuActionId:`copy-full-path`,labelKey:`copyFullPath`,keywords:[`copy`,`path`,`absolute`,`full`],availability:{host:`desktop`,requiresTargetKinds:[`doc`,`folder`,`asset`,`project`]},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-copy-path`,order:0,menuLabelKey:`fullPath`}]},{id:`copy-relative-path`,menuActionId:`copy-relative-path`,labelKey:`copyRelativePath`,keywords:[`copy`,`path`,`relative`],availability:{host:`desktop`,requiresTargetKinds:[`doc`,`folder`,`asset`,`project`]},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-copy-path`,order:1,menuLabelKey:`relativePath`}]},{id:`close-tab`,menuActionId:`close-active-tab-or-window`,labelKey:`closeTab`,keywords:[`close`,`tab`,`window`],availability:{host:`desktop`},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-close`,order:0,platform:`mac`,accelerator:`CmdOrCtrl+W`}]},{id:`new-worktree`,menuActionId:`new-worktree`,labelKey:`newWorktree`,keywords:[`worktree`,`branch`,`new`],availability:{host:`desktop`},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-worktree`,order:0,ellipsis:!0}]},{id:`switch-worktree`,menuActionId:`switch-worktree`,labelKey:`switchWorktree`,keywords:[`worktree`,`switch`,`branch`],availability:{host:`desktop`},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-worktree`,order:1,ellipsis:!0}]},{id:`toggle-sidebar`,menuActionId:`toggle-sidebar`,labelKey:`sidebarHide`,keywords:[`sidebar`,`files`,`panel`,`toggle`],shortcutId:`toggle-files-sidebar`,stateToggle:{showKey:`sidebarShow`,hideKey:`sidebarHide`,stateField:`sidebarVisible`,defaultVisible:!0},availability:{},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-panels`,order:0,accelerator:`CmdOrCtrl+Alt+S`}]},{id:`toggle-doc-panel`,menuActionId:`toggle-doc-panel`,labelKey:`docPanelHide`,keywords:[`document`,`panel`,`info`,`toggle`],shortcutId:`toggle-document-panel`,stateToggle:{showKey:`docPanelShow`,hideKey:`docPanelHide`,stateField:`docPanelVisible`,defaultVisible:!0},availability:{},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-panels`,order:1,accelerator:`CmdOrCtrl+Alt+B`}]},{id:`toggle-terminal`,menuActionId:`toggle-terminal`,labelKey:`terminalShow`,keywords:[`terminal`,`shell`,`console`,`toggle`],shortcutId:`toggle-terminal-panel`,stateToggle:{showKey:`terminalShow`,hideKey:`terminalHide`,stateField:`terminalVisible`,defaultVisible:!1},availability:{host:`desktop`},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-panels`,order:2,accelerator:`CmdOrCtrl+J`}]},{id:`toggle-agent-panel`,menuActionId:`toggle-agent-panel`,labelKey:`agentPanelShow`,keywords:[`agent`,`agents`,`chat`,`ai`,`ask`,`panel`,`toggle`],shortcutId:`toggle-agent-panel`,stateToggle:{showKey:`agentPanelShow`,hideKey:`agentPanelHide`,stateField:`agentPanelVisible`,defaultVisible:!1},availability:{},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-panels`,order:3,accelerator:`CmdOrCtrl+L`}]},{id:`toggle-show-hidden-files`,menuActionId:`toggle-show-hidden-files`,labelKey:`showHiddenFiles`,keywords:[`hidden`,`dotfiles`,`files`,`show`],checkField:`showHiddenFiles`,availability:{},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-visibility`,order:0,accelerator:`CmdOrCtrl+Shift+.`,checkbox:!0}]},{id:`toggle-show-ok-folders`,menuActionId:`toggle-show-ok-folders`,labelKey:`showOkFolders`,keywords:[`ok`,`folders`,`hidden`,`show`],checkField:`showOkFolders`,availability:{},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-visibility`,order:1,checkbox:!0}]},{id:`toggle-show-only-markdown-files`,menuActionId:`toggle-show-only-markdown-files`,labelKey:`showOnlyMarkdownFiles`,keywords:[`markdown`,`filter`,`files`,`only`],checkField:`showOnlyMarkdownFiles`,availability:{},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-visibility`,order:2,checkbox:!0}]},{id:`toggle-show-skills-section`,menuActionId:`toggle-show-skills-section`,labelKey:`showSkillsSection`,keywords:[`skills`,`section`,`sidebar`,`show`],checkField:`showSkillsSection`,availability:{},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-visibility`,order:3,checkbox:!0}]},{id:`expand-all-tree`,menuActionId:`expand-all-tree`,labelKey:`expandAll`,keywords:[`expand`,`tree`,`folders`,`all`],availability:{requiresCanExpandAll:!0},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-tree`,order:0,smartHide:!0}]},{id:`collapse-all-tree`,menuActionId:`collapse-all-tree`,labelKey:`collapseAll`,keywords:[`collapse`,`tree`,`folders`,`all`],availability:{requiresCanCollapseAll:!0},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-tree`,order:1,smartHide:!0}]},{id:`new-terminal`,menuActionId:`new-terminal`,labelKey:`newTerminal`,keywords:[`terminal`,`shell`,`new`,`tab`],availability:{host:`desktop`},palette:{group:`terminal`,visibility:`search-only`},menu:[{section:`terminal`,order:0}]},{id:`new-terminal-window`,keywords:[],availability:{host:`desktop`},menu:[{section:`terminal`,order:1,menuLabelText:`New Terminal Window`}]},{id:`kill-terminal`,menuActionId:`kill-terminal`,labelKey:`killTerminal`,keywords:[`terminal`,`kill`,`close`,`session`],availability:{host:`desktop`,requiresTerminalLive:!0},palette:{group:`terminal`,visibility:`search-only`},menu:[{section:`terminal`,order:2}]},{id:`check-for-updates`,labelKey:`checkForUpdates`,keywords:[`update`,`upgrade`,`version`,`check`],availability:{host:`desktop`},palette:{group:`app`,visibility:`search-only`},menu:[{section:`app-updates`,order:0,platform:`mac`,ellipsis:!0},{section:`help-updates`,order:0,platform:`other`,ellipsis:!0}]},{id:`set-up-integrations`,labelKey:`setUpIntegrations`,keywords:[`integrations`,`mcp`,`setup`,`claude`,`configure`],availability:{host:`desktop`},palette:{group:`app`,visibility:`search-only`},menu:[{section:`file-integrations`,order:0,ellipsis:!0}]},{id:`toggle-spell-check`,labelKey:`checkSpelling`,keywords:[`spell`,`spelling`,`check`,`typing`],availability:{host:`desktop`},palette:{group:`app`,visibility:`search-only`},menu:[{section:`edit-spell`,order:0,checkbox:!0}]},{id:`open-github`,labelKey:`openOnGithub`,keywords:[`github`,`source`,`repository`,`code`],availability:{},palette:{group:`app`,visibility:`search-only`},menu:[{section:`help-links`,order:0}]},{id:`uninstall`,keywords:[],availability:{host:`desktop`},menu:[{section:`app-uninstall`,order:0,platform:`mac`,ellipsis:!0,menuLabelText:`Uninstall OpenKnowledge`}]}],WX=new Set([`*`,`_`,"`",`~`,`\\`]),GX=/^\]\([^)]*\)/,KX=512,qX=/^(?:#{1,6}[ \t]+|>[ \t]?|(?:[-*+]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?)/,JX=32,YX=`|`,XX=/^(?:`{3,}[^`\n]*|~{3,}[^\n]*)$/,ZX=/^(?:(?:[-*_][ \t]*){3,}|=+[ \t]*|[|\-: \t]*-[|\-: \t]*)$/,QX=1024;function $X(e,t){let n=e.indexOf(`
|
|
409
|
+
`),patterns:[...t],lineCount:n}}function IX(e){return FX(e).redacted}var LX=8192,RX=32768,zX=`…[truncated]`;function BX(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 VX(e){return e.length<=8192?e:`${e.slice(0,LX-12)}${zX}`}function HX(e,t){return!(e.host===`desktop`&&t.host!==`desktop`||e.singleFileHidden&&t.singleFile||e.requiresTerminalLive&&!t.terminalLive||e.requiresCanExpandAll&&!t.canExpandAll||e.requiresCanCollapseAll&&!t.canCollapseAll||e.requiresActiveDoc&&!t.hasActiveDoc||e.requiresInstallSkill&&!t.showInstallSkill||e.requiresTargetKinds&&!e.requiresTargetKinds.includes(t.activeTargetKind))}var UX=[{id:`navigate-back`,menuActionId:`navigate-back`,labelKey:`back`,keywords:[`previous history`],shortcutId:`navigate-back`,shortcutDesktopOnly:!0,availability:{host:`desktop`},palette:{group:`commands`,visibility:`search-only`},menu:[{section:`view-history`,order:0,platform:`mac`,accelerator:`Cmd+[`},{section:`view-history`,order:0,platform:`other`,accelerator:`Alt+Left`}]},{id:`navigate-forward`,menuActionId:`navigate-forward`,labelKey:`forward`,keywords:[`next history`],shortcutId:`navigate-forward`,shortcutDesktopOnly:!0,availability:{host:`desktop`},palette:{group:`commands`,visibility:`search-only`},menu:[{section:`view-history`,order:1,platform:`mac`,accelerator:`Cmd+]`},{section:`view-history`,order:1,platform:`other`,accelerator:`Alt+Right`}]},{id:`new-file`,menuActionId:`new-doc`,labelKey:`newFile`,keywords:[`create file`],shortcutId:`new-item`,availability:{},palette:{group:`commands`,visibility:`always`},menu:[{section:`file-create`,order:0,accelerator:`CmdOrCtrl+N`}]},{id:`new-folder`,menuActionId:`new-folder`,labelKey:`newFolder`,keywords:[`create folder`],shortcutId:`new-folder`,shortcutDesktopOnly:!0,availability:{},palette:{group:`commands`,visibility:`always`},menu:[{section:`file-create`,order:1,accelerator:`CmdOrCtrl+Shift+N`}]},{id:`open-graph`,labelKey:`openGraph`,keywords:[`graph panel network`],availability:{requiresActiveDoc:!0},palette:{group:`commands`,visibility:`always`}},{id:`initialize-starter-pack`,labelKey:`initializeStarterPack`,keywords:[`scaffold`,`seed`,`pack`,`starter`],availability:{},palette:{group:`commands`,visibility:`always`}},{id:`new-skill`,labelKey:`newSkill`,keywords:[`skill`,`create`,`author`,`new`],availability:{singleFileHidden:!0},palette:{group:`commands`,visibility:`always`}},{id:`new-project`,menuActionId:`new-project`,labelKey:`newProject`,keywords:[`create new project scaffold`],availability:{host:`desktop`},palette:{group:`project`,visibility:`always`},menu:[{section:`file-project`,order:0,ellipsis:!0}]},{id:`open-folder`,labelKey:`openFolderOnDisk`,keywords:[`project`,`folder`,`disk`],shortcutId:`open-folder`,availability:{host:`desktop`},palette:{group:`project`,visibility:`always`},menu:[{section:`file-project`,order:2,accelerator:`CmdOrCtrl+O`,ellipsis:!0,menuLabelKey:`openFolder`}]},{id:`open-file`,labelKey:`openFileOnDisk`,keywords:[`file`,`markdown`,`single`,`standalone`,`temporary`],shortcutId:`open-file`,availability:{host:`desktop`},palette:{group:`project`,visibility:`always`},menu:[{section:`file-project`,order:3,accelerator:`CmdOrCtrl+Shift+O`,ellipsis:!0,menuLabelKey:`openFile`}]},{id:`open-skills`,labelKey:`openSkills`,keywords:[`skills marketplace explore import discover`],availability:{singleFileHidden:!0},palette:{group:`project`,visibility:`always`},menu:[]},{id:`switch-project`,labelKey:`switchProject`,keywords:[`switch project navigator projects`],shortcutId:`switch-project`,availability:{host:`desktop`,singleFileHidden:!0},palette:{group:`project`,visibility:`always`},menu:[{section:`file-project`,order:1,accelerator:`CmdOrCtrl+Shift+P`,ellipsis:!0}]},{id:`settings`,labelKey:`settings`,keywords:[`preferences config`],shortcutId:`settings`,availability:{singleFileHidden:!0},palette:{group:`project`,visibility:`always`},menu:[{section:`app-settings`,order:0,platform:`mac`,accelerator:`CmdOrCtrl+,`,ellipsis:!0},{section:`file-settings`,order:0,platform:`other`,accelerator:`CmdOrCtrl+,`,ellipsis:!0}]},{id:`install-claude-desktop`,labelKey:`installClaudeDesktop`,keywords:[`claude desktop install cowork`],availability:{requiresInstallSkill:!0},palette:{group:`project`,visibility:`always`},menu:[{section:`help-install`,order:0,ellipsis:!0,menuLabelText:`Install for Claude Chat & Cowork (desktop app)`}]},{id:`report-bug`,menuActionId:`report-bug`,labelKey:`reportBug`,keywords:[`bug report issue feedback problem`],availability:{host:`desktop`},palette:{group:`project`,visibility:`always`},menu:[{section:`help-links`,order:1,ellipsis:!0}]},{id:`bug-report-history`,labelKey:`bugReportHistory`,keywords:[`bug report history previous reports past retry resend`],availability:{host:`desktop`},palette:{group:`project`,visibility:`always`}},{id:`send-feedback`,menuActionId:`send-feedback`,labelKey:`sendFeedback`,keywords:[`feedback`,`suggestion`,`idea`,`rate`,`survey`,`contact`],availability:{},palette:{group:`project`,visibility:`always`},menu:[{section:`help-links`,order:2,ellipsis:!0}]},{id:`new-from-template`,menuActionId:`new-from-template`,labelKey:`newFromTemplate`,keywords:[`template`,`create`,`new`],availability:{singleFileHidden:!0},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-create`,order:2,ellipsis:!0}]},{id:`rename`,menuActionId:`rename`,labelKey:`rename`,keywords:[`rename`,`file`,`folder`],availability:{host:`desktop`,requiresTargetKinds:[`doc`,`folder`,`asset`]},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-item`,order:1}]},{id:`duplicate`,menuActionId:`duplicate`,labelKey:`duplicate`,keywords:[`duplicate`,`copy`,`file`,`folder`],shortcutId:`file-tree-duplicate`,availability:{host:`desktop`,requiresTargetKinds:[`doc`,`folder`]},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-item`,order:0,accelerator:`CmdOrCtrl+D`}]},{id:`move-to-trash`,menuActionId:`move-to-trash`,labelKey:`moveToTrash`,keywords:[`delete`,`trash`,`remove`],shortcutId:`file-tree-delete`,availability:{host:`desktop`,requiresTargetKinds:[`doc`,`folder`,`asset`]},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-item`,order:2,accelerator:`CmdOrCtrl+Delete`}]},{id:`reveal-in-finder`,menuActionId:`reveal-in-finder`,labelKey:`revealInFinder`,keywords:[`finder`,`reveal`,`show`,`file`],availability:{host:`desktop`,requiresTargetKinds:[`doc`,`folder`,`asset`,`project`]},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-reveal`,order:0}]},{id:`send-to-ai`,menuActionId:`send-to-ai`,labelKey:`openWithAi`,keywords:[`ai`,`agent`,`handoff`],availability:{host:`desktop`,requiresTargetKinds:[`doc`,`folder`,`project`]},menu:[{section:`file-reveal`,order:1}]},{id:`copy-full-path`,menuActionId:`copy-full-path`,labelKey:`copyFullPath`,keywords:[`copy`,`path`,`absolute`,`full`],availability:{host:`desktop`,requiresTargetKinds:[`doc`,`folder`,`asset`,`project`]},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-copy-path`,order:0,menuLabelKey:`fullPath`}]},{id:`copy-relative-path`,menuActionId:`copy-relative-path`,labelKey:`copyRelativePath`,keywords:[`copy`,`path`,`relative`],availability:{host:`desktop`,requiresTargetKinds:[`doc`,`folder`,`asset`,`project`]},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-copy-path`,order:1,menuLabelKey:`relativePath`}]},{id:`close-tab`,menuActionId:`close-active-tab-or-window`,labelKey:`closeTab`,keywords:[`close`,`tab`,`window`],availability:{host:`desktop`},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-close`,order:0,platform:`mac`,accelerator:`CmdOrCtrl+W`}]},{id:`new-worktree`,menuActionId:`new-worktree`,labelKey:`newWorktree`,keywords:[`worktree`,`branch`,`new`],availability:{host:`desktop`},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-worktree`,order:0,ellipsis:!0}]},{id:`switch-worktree`,menuActionId:`switch-worktree`,labelKey:`switchWorktree`,keywords:[`worktree`,`switch`,`branch`],availability:{host:`desktop`},palette:{group:`file`,visibility:`search-only`},menu:[{section:`file-worktree`,order:1,ellipsis:!0}]},{id:`toggle-sidebar`,menuActionId:`toggle-sidebar`,labelKey:`sidebarHide`,keywords:[`sidebar`,`files`,`panel`,`toggle`],shortcutId:`toggle-files-sidebar`,stateToggle:{showKey:`sidebarShow`,hideKey:`sidebarHide`,stateField:`sidebarVisible`,defaultVisible:!0},availability:{},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-panels`,order:0,accelerator:`CmdOrCtrl+Alt+S`}]},{id:`toggle-doc-panel`,menuActionId:`toggle-doc-panel`,labelKey:`docPanelHide`,keywords:[`document`,`panel`,`info`,`toggle`],shortcutId:`toggle-document-panel`,stateToggle:{showKey:`docPanelShow`,hideKey:`docPanelHide`,stateField:`docPanelVisible`,defaultVisible:!0},availability:{},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-panels`,order:1,accelerator:`CmdOrCtrl+Alt+B`}]},{id:`toggle-terminal`,menuActionId:`toggle-terminal`,labelKey:`terminalShow`,keywords:[`terminal`,`shell`,`console`,`panel`,`toggle bottom dock`,`show terminal`,`hide terminal`],shortcutId:`toggle-terminal-panel`,stateToggle:{showKey:`terminalShow`,hideKey:`terminalHide`,stateField:`terminalVisible`,defaultVisible:!1},availability:{host:`desktop`},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-panels`,order:2,accelerator:`CmdOrCtrl+J`}]},{id:`toggle-agent-panel`,menuActionId:`toggle-agent-panel`,labelKey:`agentPanelShow`,keywords:[`agent`,`agents`,`chat`,`ai`,`ask`,`panel`,`toggle`],shortcutId:`toggle-agent-panel`,stateToggle:{showKey:`agentPanelShow`,hideKey:`agentPanelHide`,stateField:`agentPanelVisible`,defaultVisible:!1},availability:{},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-panels`,order:3,accelerator:`CmdOrCtrl+L`}]},{id:`toggle-show-hidden-files`,menuActionId:`toggle-show-hidden-files`,labelKey:`showHiddenFiles`,keywords:[`hidden`,`dotfiles`,`files`,`show`],checkField:`showHiddenFiles`,availability:{},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-visibility`,order:0,accelerator:`CmdOrCtrl+Shift+.`,checkbox:!0}]},{id:`toggle-show-ok-folders`,menuActionId:`toggle-show-ok-folders`,labelKey:`showOkFolders`,keywords:[`ok`,`folders`,`hidden`,`show`],checkField:`showOkFolders`,availability:{},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-visibility`,order:1,checkbox:!0}]},{id:`toggle-show-only-markdown-files`,menuActionId:`toggle-show-only-markdown-files`,labelKey:`showOnlyMarkdownFiles`,keywords:[`markdown`,`filter`,`files`,`only`],checkField:`showOnlyMarkdownFiles`,availability:{},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-visibility`,order:2,checkbox:!0}]},{id:`toggle-show-skills-section`,menuActionId:`toggle-show-skills-section`,labelKey:`showSkillsSection`,keywords:[`skills`,`section`,`sidebar`,`show`],checkField:`showSkillsSection`,availability:{},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-visibility`,order:3,checkbox:!0}]},{id:`expand-all-tree`,menuActionId:`expand-all-tree`,labelKey:`expandAll`,keywords:[`expand`,`tree`,`folders`,`all`],availability:{requiresCanExpandAll:!0},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-tree`,order:0,smartHide:!0}]},{id:`collapse-all-tree`,menuActionId:`collapse-all-tree`,labelKey:`collapseAll`,keywords:[`collapse`,`tree`,`folders`,`all`],availability:{requiresCanCollapseAll:!0},palette:{group:`view`,visibility:`search-only`},menu:[{section:`view-tree`,order:1,smartHide:!0}]},{id:`new-terminal`,menuActionId:`new-terminal`,labelKey:`newTerminal`,keywords:[`terminal`,`shell`,`new`,`tab`],availability:{host:`desktop`},palette:{group:`terminal`,visibility:`search-only`},menu:[{section:`terminal`,order:0}]},{id:`new-terminal-window`,keywords:[],availability:{host:`desktop`},menu:[{section:`terminal`,order:1,menuLabelText:`New Terminal Window`}]},{id:`kill-terminal`,menuActionId:`kill-terminal`,labelKey:`killTerminal`,keywords:[`terminal`,`kill`,`close`,`session`],availability:{host:`desktop`,requiresTerminalLive:!0},palette:{group:`terminal`,visibility:`search-only`},menu:[{section:`terminal`,order:2}]},{id:`check-for-updates`,labelKey:`checkForUpdates`,keywords:[`update`,`upgrade`,`version`,`check`],availability:{host:`desktop`},palette:{group:`app`,visibility:`search-only`},menu:[{section:`app-updates`,order:0,platform:`mac`,ellipsis:!0},{section:`help-updates`,order:0,platform:`other`,ellipsis:!0}]},{id:`set-up-integrations`,labelKey:`setUpIntegrations`,keywords:[`integrations`,`mcp`,`setup`,`claude`,`configure`],availability:{host:`desktop`},palette:{group:`app`,visibility:`search-only`},menu:[{section:`file-integrations`,order:0,ellipsis:!0}]},{id:`toggle-spell-check`,labelKey:`checkSpelling`,keywords:[`spell`,`spelling`,`check`,`typing`],availability:{host:`desktop`},palette:{group:`app`,visibility:`search-only`},menu:[{section:`edit-spell`,order:0,checkbox:!0}]},{id:`open-github`,labelKey:`openOnGithub`,keywords:[`github`,`source`,`repository`,`code`],availability:{},palette:{group:`app`,visibility:`search-only`},menu:[{section:`help-links`,order:0}]},{id:`uninstall`,keywords:[],availability:{host:`desktop`},menu:[{section:`app-uninstall`,order:0,platform:`mac`,ellipsis:!0,menuLabelText:`Uninstall OpenKnowledge`}]}],WX=new Set([`*`,`_`,"`",`~`,`\\`]),GX=/^\]\([^)]*\)/,KX=512,qX=/^(?:#{1,6}[ \t]+|>[ \t]?|(?:[-*+]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?)/,JX=32,YX=`|`,XX=/^(?:`{3,}[^`\n]*|~{3,}[^\n]*)$/,ZX=/^(?:(?:[-*_][ \t]*){3,}|=+[ \t]*|[|\-: \t]*-[|\-: \t]*)$/,QX=1024;function $X(e,t){let n=e.indexOf(`
|
|
410
410
|
`,t),r=n===-1?e.length:n;if(r>t&&e[r-1]===`\r`&&--r,r-t>QX)return 0;let i=e.slice(t,r);return i.length===0||!XX.test(i)&&!ZX.test(i)?0:i.length}function eZ(e){return e===` `||e===` `||e===`
|
|
411
411
|
`||e===`\r`||e===`\f`||e===`\v`}function tZ(e,t){for(let n=t-1;n>=0;--n){let t=e[n];if(t===`
|
|
412
412
|
`)return!0;if(t!==` `&&t!==` `)return!1}return!0}function nZ(e,t){let n=e[t];if(n===void 0)return 0;if(tZ(e,t)){let n=$X(e,t);if(n>0)return n}return n===YX||WX.has(n)||n===`[`?1:n===`]`?e[t+1]===`]`?2:GX.exec(e.slice(t,t+KX))?.[0].length??0:tZ(e,t)?qX.exec(e.slice(t,t+JX))?.[0].length??0:0}function rZ(e,t,{syntaxIn:n}){let r=[];if(t.length===0)return r;let i=n===`haystack`;for(let n=0;n<e.length;n+=1){let a=e[n];if(a===void 0||eZ(a)||i&&nZ(e,n)>0)continue;let o=n,s=0;for(;o<e.length&&s<t.length;){let n=e[o],r=t[s];if(n===r){o+=1,s+=1;continue}if(eZ(r)){s+=1;continue}if(eZ(n)){o+=1;continue}let a=i?nZ(e,o):nZ(t,s);if(a>0){i?o+=a:s+=a;continue}break}s===t.length&&r.push({start:n,end:o})}return r}var iZ=`source`;function aZ(e){return{ok:!1,error:e}}function oZ(e){return{ok:!0,...e}}function sZ(){return Of.parse({})}function cZ(e,t){let n=e.toString();if(n.length===0)return sZ();let r=Au(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(`; `)}`),sZ();let i=r.toJSON()??{},a=Of.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)`}`),sZ())}function lZ(e,t,n={}){return Af(`config.bind`,{"config.scope":t,"config.transport":`ytext`},()=>uZ(e,t,n))}function uZ(e,t,n){let{ytextKey:r=iZ}=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=cZ(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 aZ({code:`WRITE_ERROR`,detail:`ConfigBinding (${t}) has been disposed`});let n=If(e,t);if(n!==null)return aZ(n);let r=Au(a.toString()),o=r.contents!==null&&!as(r.contents);if(r.errors.length>0||o){jf(`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=Au(``)}r.contents===null&&(r.contents=r.createNode({}));let s=Rf(r,e),l=r.toJSON()??{},u=Af(`config.validate`,{"config.scope":t,"config.validation.layer":`L1`},e=>{let t=Of.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)jf(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!u.success)return aZ({code:`SCHEMA_INVALID`,issues:u.error.issues.map(zf)});let d=r.toString();return i.transact(()=>{a.length>0&&a.delete(0,a.length),a.insert(0,d)}),oZ({effective:u.data,appliedPaths:s})}return{current(){return cZ(a,t)},patch(e){return Af(`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 dZ=`source`,fZ=800;function pZ(e){return{ok:!1,error:e}}function mZ(e){return{ok:!0,...e}}function hZ(e,t={}){let{ytextKey:n=dZ,acceptanceDelayMs:r=fZ}=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?pZ({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),mZ({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 gZ(e,t,n){return _Z([e,t,n],[])}function _Z(e,t){if(t.length>0){let n=Pf(Of,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=vZ(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=>yZ(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]=_Z(r.map(t=>t===void 0?void 0:t[e]),[...t,e]);return a}function vZ(e){for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return e[t]}function yZ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var bZ=2e3;function xZ(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 SZ(e,t){for(let[,n]of e.entries()){let e=n;if(e.timestamp&&e.timestamp>t)return!0}return!1}var CZ=`#fafafa`,wZ=`#171717`,TZ=[`invalid-args`,`nested-project`,`target-not-empty`,`mkdir-failed`,`git-init-failed`,`init-failed`,`discovery-failed`],EZ=[`.mdx`,`.md`],DZ=`epoch`,OZ=512*1024;function kZ(e,t=OZ){return typeof e==`number`&&Number.isFinite(e)&&e>t}var AZ=10*1024*1024,jZ={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/};function MZ(){if(typeof navigator>`u`)return null;let e=navigator.userAgent;for(let[t,n]of Object.entries(jZ))if(n.test(e))return t;return null}var NZ=[`incoming`,`outgoing`,`both`];function PZ(e){return NZ.includes(e)}var FZ=`open-knowledge`,IZ=`https://github.com/inkeep/open-knowledge`,LZ=[{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)">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{xa as e}from"./dist-
|
|
1
|
+
import{xa as e}from"./dist-B1W6XlK32.js";function t(t){return e.includes(t)}function n(e){if(e.startsWith(h)||e.startsWith(y)||e.startsWith(b)||e.startsWith(C)||!e.startsWith(`#/`))return null;let t=e.slice(2),n=g(t),r=n>=0?t.slice(0,n):t;if(!r)return null;try{return r.split(`/`).map(decodeURIComponent).join(`/`)}catch{return r}}function r(e){if(e.startsWith(h)||!e.startsWith(`#/`))return null;let t=e.slice(2),n=t.indexOf(`#`);if(n<0)return null;let r=t.slice(n+1);if(!r)return null;try{return decodeURIComponent(r)}catch{return r}}function i(e,t){let n=`#/${e}`;return t?`${n}#${encodeURIComponent(t)}`:n}var a=`__okHashHistoryEntry`;function o(e){return{...typeof e==`object`&&e?e:{},[a]:!0}}function s(e){return typeof e==`object`&&!!e&&e[a]===!0}function c(){s(window.history.state)||window.history.replaceState(o(window.history.state),``)}function l(e){let{pathname:t,search:n}=window.location;window.history.replaceState(o(window.history.state),``,`${t}${n}${e}`)}function u(e){if(window.location.hash===e)return;let{pathname:t,search:n}=window.location;window.history.pushState(o(window.history.state),``,`${t}${n}${e}`)}function d(e){return e.endsWith(`.mdx`)?e.slice(0,-4):e.endsWith(`.md`)?e.slice(0,-3):e}function f(e,t){let n=e.replace(/^\/+|\/+$/g,``),r=n?`#/${n}/`:`#/`;return t?`${r}#${encodeURIComponent(t)}`:r}function p(e,t,n){if(e===`folder`)return f(t);let r=`#/${encodeURIComponent(t)}`;return n==null||n===``?r:`${r}?branch=${encodeURIComponent(n)}`}function m(e){if(e===`#/`)return!0;if(!e.startsWith(`#/`))return!1;let t=e.slice(2);return t.length>0&&t[0]===`?`}var h=`#/__asset__/`;function g(e){let t=e.indexOf(`?`),n=e.indexOf(`#`);return t<0?n:n<0?t:Math.min(t,n)}function _(e){if(!e.startsWith(h))return null;let t=e.slice(12);if(!t)return null;try{return t.split(`/`).map(decodeURIComponent).join(`/`)}catch{return t}}function v(e){return`${h}${e.split(`/`).map(encodeURIComponent).join(`/`)}`}var y=`#/__skill-file__/`,b=`#/__skills__`;function x(){return b}function S(e){return e===b||e.startsWith(`${b}/`)}var C=`#/__skill-preview__/`,w=[`explore`,`detected`,`builtin`];function T(e){return e!==void 0&&w.includes(e)}var E=`project`;function D(e){return[e.flavor,e.source,e.name,e.subtitle,e.level??E].map(encodeURIComponent).join(`/`)}function O(e){if(!e)return null;let n;try{n=e.split(`/`).map(decodeURIComponent)}catch{return null}if(n.length<4||n.length>6)return null;let[r,i,a,o,s,c]=n;return!T(r)||!i||!a?null:{flavor:r,source:i,name:a,subtitle:o??``,...s&&t(s)?{level:s}:{},...c?{path:c}:{}}}function k(e){let t=D(e);return e.path&&(t+=`/${encodeURIComponent(e.path)}`),`${C}${t}`}function A(e){return e.startsWith(C)?O(e.slice(20)):null}var j=`:`;function M(e){let t=e.host===void 0?e.name:`${e.name}${j}${e.host}`;return`${y}${[e.scope,t].map(encodeURIComponent).join(`/`)}/${e.path.split(`/`).map(encodeURIComponent).join(`/`)}`}function N(e){if(!e.startsWith(y))return null;let n=e.slice(17);if(!n)return null;let r;try{r=n.split(`/`).map(decodeURIComponent)}catch{return null}if(r.length<3)return null;let[i,a,...o]=r,s=o.join(`/`);if(!i||!a||!s||!t(i))return null;let c=a.indexOf(j),l=c===-1?a:a.slice(0,c),u=c===-1?void 0:a.slice(c+1);return l?{scope:i,name:l,path:s,...u?{host:u}:{}}:null}var P=/\.(md|mdx)$/i;function F(e){return e.trim().replace(/^\.\/+/,``).replace(/^\/+/,``)}function I(e){return F(e).replace(P,``)}function L(e){let t=F(e);return t?P.test(t)?t:`${t}.md`:`untitled.md`}function R(e){let t=I(e),n=t.lastIndexOf(`/`);return{initialDir:n>0?t.slice(0,n):``,suggestedName:`${n>=0?t.slice(n+1):t||`untitled`}.md`}}export{S as C,A as S,m as _,_ as a,l as b,p as c,v as d,i as f,x as g,k as h,r as i,D as l,M as m,L as n,O as o,f as p,I as r,n as s,R as t,d as u,c as v,N as x,u as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as e}from"./dist-
|
|
1
|
+
import{k as e}from"./dist-B1W6XlK32.js";var t=`open-knowledge:documents-changed`,n=new Set(e.options);function r(e){return e===void 0||!Array.isArray(e)?[`files`]:[...new Set(e.filter(e=>n.has(e)))]}function i(e=[`files`]){window.dispatchEvent(new CustomEvent(t,{detail:{channels:r(e)}}))}function a(e){let n=t=>{e(r(t instanceof CustomEvent?t.detail?.channels:void 0))};return window.addEventListener(t,n),()=>window.removeEventListener(t,n)}var o=`open-knowledge:doc-persisted`;function s(e){window.dispatchEvent(new CustomEvent(o,{detail:{docName:e}}))}function c(e){let t=t=>{if(!(t instanceof CustomEvent))return;let n=t.detail?.docName;typeof n==`string`&&n.length>0&&e(n)};return window.addEventListener(o,t),()=>window.removeEventListener(o,t)}var l=`open-knowledge:branch-changed`;function u(e){window.dispatchEvent(new CustomEvent(l,{detail:{branch:e}}))}function d(e){let t=t=>{if(!(t instanceof CustomEvent))return;let n=t.detail;e(n?.branch??null)};return window.addEventListener(l,t),()=>window.removeEventListener(l,t)}var f=`open-knowledge:templates-changed`;function p(){window.dispatchEvent(new CustomEvent(f))}function m(e){let t=()=>e();return window.addEventListener(f,t),()=>window.removeEventListener(f,t)}var h=`open-knowledge:skills-changed`;function g(){window.dispatchEvent(new CustomEvent(h))}function _(e){let t=()=>e();return window.addEventListener(h,t),()=>window.removeEventListener(h,t)}var v=new Set,y=(e,t)=>`${e}\u0000${t}`;function b(e,t){v.add(y(e,t)),g()}function x(e,t){v.delete(y(e,t))&&g()}function S(e){return v.size===0?e:e.filter(e=>!v.has(y(e.scope,e.name)))}export{i as a,x as c,a as d,_ as f,s as i,d as l,b as n,g as o,m as p,u as r,p as s,S as t,c as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Co as e,Do as t,xo as n}from"./dist-
|
|
1
|
+
import{Co as e,Do as t,xo as n}from"./dist-B1W6XlK32.js";import{d as r,f as i,p as a}from"./doc-paths-BPPZUgg6.js";import{t as o}from"./file-tree-rename-validation-DEz_ryBu.js";import{c as s,l as c,s as l}from"./file-tree-utils-Bl84nllO.js";import{a as u}from"./navigation-targets-BekPm3G2.js";var d=`application/x-open-knowledge-sidebar-item+json`,f={image:!0,video:!0,audio:!0,pdf:!0,text:!0,mermaid:!0};function p(e){return JSON.stringify(e)}function m(e){return e?Array.from(e.types).includes(d):!1}function ee(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:a(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:r(e.assetPath)}:{target:u(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:i(e.docName)}}function h(e){if(!e||!m(e))return null;let t=e.getData(d);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!g(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!_(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _(e){return typeof e==`string`&&Object.hasOwn(f,e)}var v=`.md`,y=/\.(md|mdx)$/i;function b(t,r=v){return y.test(t)||e(t)||n(t)?t:`${t}${r}`}function x(e){return $(e).replace(y,``)}function S(e,t){let n=$(e),r=k(t),i=t.find(e=>s(e)&&A(e,r)===n)??t.find(e=>s(e)&&w(e)===n);if(i)return i.docName;let a=x(n);return t.find(e=>{let t=w(e);return t!==n&&y.test(t)&&x(t)===a})&&y.test(n)?n:a}function C(e,t){let n=k(t);return t.find(t=>A(t,n)===e)??t.find(t=>w(t)===e)}function w(e){return c(e)?D(e.path):l(e)?e.path:b(e.docName,e.docExt)}function T(e){let t=$(e).match(y);return t?`.${t[1].toLowerCase()}`:void 0}function E(e){return $(e)}function D(e){let t=$(e.trim());return t?`${t}/`:``}function O(e){return e.endsWith(`/`)?E(e):x(e)}function k(e){let t=new Map;for(let n of e){if(!s(n))continue;let e=n.docName.match(y);if(!e)continue;let r=n.docName.slice(0,-e[0].length),i=t.get(r);i?i.add(e[0]):t.set(r,new Set([e[0]]))}return t}function A(e,t){let n=w(e);if(!s(e))return n;let r=e.docName.match(y);if(!r)return n;let i=e.docName.slice(0,-r[0].length);return(t.get(i)?.size??0)>1?n:`${e.docName}${e.docExt??v}`}function j(e){let t=k(e),n=new Set,r=[];for(let i of e){let e=A(i,t);n.has(e)||(n.add(e),r.push(e))}return r}function M(e){return[...e].sort().join(`\0`)}function N(e){return M(j(e))}function P(e,t={}){let n=new Set;for(let r of e){let e=(c(r)||l(r)?r.path:r.docName).split(`/`).filter(Boolean);if(!t.includeOkFolders&&e.includes(`.ok`))continue;if(c(r)){let e=D(r.path);e&&n.add(e)}let i=c(r)?e.length:e.length-1;for(let t=1;t<=i;t++)n.add(`${e.slice(0,t).join(`/`)}/`)}return[...n].sort()}function F(e){if(!e)return[];let t=$(e.replace(y,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function I(e,t,n){let r=T(e);if(r)return r;let i=n.find(e=>s(e)&&e.docName===t);return i?i.docExt??v:Q(e).includes(`.`)?void 0:v}function L(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!l(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function R(e,t,n){if(T(e))return null;let r=n.find(e=>l(e)&&e.path===t);return r?r.path:Q(e).includes(`.`)?t:L(t,n)}function z(e,t){let n=e.kind===`directory`,r=n?E(e.path):S(e.path,t);if(n)return{kind:`folder`,name:$(Q(e.path)).replace(y,``),path:r,treePath:V(e.path,!0)};let i=R(e.path,r,t);if(i)return{kind:`asset`,name:$(Q(i)),path:i,treePath:i};let a=I(e.path,r,t);return{kind:`file`,name:$(Q(e.path)).replace(y,``),path:r,treePath:V(e.path,!1),docExt:a}}function B(e){return e.kind===`directory`?E(e.path):e.path}function V(e,t){return t?D(e):y.test(e)?e:`${e}${v}`}function H(e,t,n){let r=D(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${v}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function U(e,t){return e===`file`?V(t,!1):`${E(t)}/index${v}`}function W(e,t){return t.kind===`root`||t.directoryPath==null?Q(e):`${t.directoryPath}${Q(e)}`}function G(e,t){if(t)return E(D(e));let n=x(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function K(e,t){let n=E(D(e));return n?`${n}/${t}`:t}function q(e,t,n){e.append(`parentDocName`,K(t,n)),e.append(`placement`,`parent-dir`)}function J(e,t){return(t.path??K(e,t.src)).replace(/^\/+/,``)}function Y(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function X(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function Z(e,n){let r=o(e).toLowerCase();if(r===``)return null;let i=new Date().toISOString();if(r===`.md`||r===`.mdx`)return{kind:`document`,docName:x(e),docExt:r,modified:i,size:n.size};let a=r.startsWith(`.`)?r.slice(1):r;return{kind:`asset`,path:e,assetExt:a,mediaKind:t(a),modified:i,size:n.size}}function Q(e){let t=$(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function $(e){return e.endsWith(`/`)?e.slice(0,-1):e}export{h as A,z as C,d as D,J as E,m as O,S,O as T,G as _,U as a,E as b,j as c,w as d,X as f,V as g,Y as h,W as i,p as j,ee as k,N as l,D as m,P as n,H as o,C as p,F as r,b as s,q as t,Z as u,B as v,M as w,x,L as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Pa as e,mr as t}from"./dist-
|
|
1
|
+
import{Pa as e,mr as t}from"./dist-B1W6XlK32.js";function n(e){return e.kind===`asset`}function r(e){return e.kind===`document`}function i(e){return e.kind===`folder`}function a(e){let t=[],n=0;for(let r of e)switch(r.kind){case`document`:if(r.docName===void 0){n+=1;break}t.push({kind:`document`,docName:r.docName,docExt:r.docExt,size:r.size,modified:r.modified,isSymlink:r.isSymlink,canonicalDocName:r.canonicalDocName,targetPath:r.targetPath});break;case`asset`:if(r.path===void 0||r.assetExt===void 0){n+=1;break}t.push({kind:`asset`,path:r.path,assetExt:r.assetExt,mediaKind:r.mediaKind??null,size:r.size,modified:r.modified,referencedBy:r.referencedBy});break;case`file`:if(r.path===void 0){n+=1;break}t.push({kind:`asset`,path:r.path,assetExt:r.assetExt??o(r.path),mediaKind:null,size:r.size,modified:r.modified,referencedBy:[]});break;case`folder`:if(r.path===void 0){n+=1;break}t.push({kind:`folder`,path:r.path,size:r.size,modified:r.modified,hasChildren:r.hasChildren,isSymlink:r.isSymlink,targetPath:r.targetPath});break;default:r.kind;break}return n>0&&console.warn(`[file-tree-utils] dropped ${n} listing entries missing variant identity fields`),t}function o(e){let t=e.includes(`/`)?e.split(`/`).pop()??e:e,n=t.lastIndexOf(`.`);return n>0&&n<t.length-1?t.slice(n+1).toLowerCase():t.startsWith(`.`)&&t.length>1?t.slice(1).toLowerCase():`file`}function s(e){if(!e)return[];let t=e.split(`/`).filter(Boolean),n=[];for(let e=1;e<t.length;e++)n.push(t.slice(0,e).join(`/`));return n}function c(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t>0?e.slice(0,t):``}function l(e){return e.split(`/`).some(e=>e.toLowerCase()===`.ok`)}function u(e,t){return t&&e!==`document`&&e!==`folder`}function d(e,n){return!n&&t(e)}function f(e,n={}){let{showHiddenFiles:r=!1,showOnlyMarkdownFiles:i=!1,showOkFolders:a=!1}=n;return e.filter(e=>{let n=e.docName??e.path??``;if(n===``||u(e.kind,i))return!1;let o=n.split(`/`),s=o.indexOf(`.ok`);if(s!==-1){if(!a)return!1;let e=o.slice(0,s).join(`/`);return r||e===``||!t(e)}return!d(n,r)})}function p(t,n={}){let{showHiddenFiles:r=!1,showOnlyMarkdownFiles:i=!1}=n,a=t.docName??t.path??``;return a===``||e(a)||l(a)?{hiddenFiles:!1,onlyMarkdownFiles:!1}:{hiddenFiles:d(a,r),onlyMarkdownFiles:u(t.kind,i)}}function m(e){let{visibility:t={},unfilteredRootEntryCount:n,knownPageCount:r}=e;return(n>0||r>0)&&(t.showOnlyMarkdownFiles??!1)?`filtered-to-zero`:`true-empty`}export{f as a,r as c,a as d,c as i,i as l,m as n,l as o,s as r,n as s,p as t,o as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-BbgVV4EV.js";import{t}from"./parse-api-error-BFe1cdS7.js";import{s as n}from"./documents-events-
|
|
1
|
+
import{t as e}from"./createLucideIcon-BbgVV4EV.js";import{t}from"./parse-api-error-BFe1cdS7.js";import{s as n}from"./documents-events-yek6VMZz.js";var r=e(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]);async function i(e){return t(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function a(e,t){try{let n=await fetch(`/api/folder-config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,frontmatter:t})});return n.ok?{ok:!0}:{ok:!1,error:await i(n)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function o(e){try{let t=await fetch(`/api/template`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await i(t)};let r=await t.json().catch(()=>null);return n(),{ok:!0,created:r?.created??!1,warnings:r?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function s(e,t){try{let r=`?folder=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`,a=await fetch(`/api/template${r}`,{method:`DELETE`});if(!a.ok)return{ok:!1,error:await i(a)};let o=await a.json().catch(()=>null);return n(),{ok:!0,existed:o?.existed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function c(e){try{let t=await fetch(`/api/template`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await i(t)};let r=await t.json().catch(()=>null);return n(),{ok:!0,committed:r?.committed??!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function l(e){try{let t=await fetch(`/api/template/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await i(t)};let r=await t.json().catch(()=>null);return n(),{ok:!0,path:r?.path??``,created:r?.created??!1,warnings:r?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}export{o as a,a as i,l as n,r as o,c as r,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{zn as n}from"./DocumentContext-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{zn as n}from"./DocumentContext-x5CUxxhI.js";import{t as r}from"./react-f2sANaYj.js";import{r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{r as s,t as c}from"./button-RQ5o7P7w.js";import{t as l}from"./separator-C4EdGs_S.js";import{t as u}from"./x-B3zGPHCO.js";var d=a(),f=t(),p=s(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function m(e){let t=(0,d.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=o(p({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let s;return t[7]!==r||t[8]!==i||t[9]!==a?(s=(0,f.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":r,className:a,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=s):s=t[10],s}function h(e){let t=(0,d.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,s;t[4]===n?s=t[5]:(s=o(`relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto`,n),t[4]=n,t[5]=s);let c;return t[6]!==a||t[7]!==r||t[8]!==s?(c=(0,f.jsx)(l,{"data-slot":`button-group-separator`,orientation:a,className:s,...r}),t[6]=a,t[7]=r,t[8]=s,t[9]=c):c=t[9],c}var g=`button, a[href], [role="menuitem"], [role="button"], input, textarea, select, [contenteditable="true"]`;function _(e,t){e.target instanceof HTMLElement&&(!(e.currentTarget instanceof HTMLElement)||!e.currentTarget.contains(e.target)||e.target.closest(g)||(e.preventDefault(),t.current?.focus()))}var v=e(r(),1);function y(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function b(e){let t=(0,d.c)(21),{path:r,onRemove:a}=e,{_:o}=i(),s,l;t[0]!==o||t[1]!==r?(s=y(r),l=o({id:`hnq8fP`,values:{label:s}}),t[0]=o,t[1]=r,t[2]=s,t[3]=l):(s=t[2],l=t[3]);let p=l,m=`composer-context-chip-file-${r}`,h;t[4]===a?h=t[5]:(h=e=>{(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),a())},t[4]=a,t[5]=h);let g;t[6]===r?g=t[7]:(g=(0,f.jsx)(`span`,{className:`absolute top-1/2 left-1/2 inline-flex size-3 -translate-x-1/2 -translate-y-1/2 opacity-100 transition-opacity duration-150 ease-out group-hover/chip:opacity-0 group-focus-within/chip:opacity-0 motion-reduce:transition-none`,children:(0,f.jsx)(n,{path:r,className:`size-3`,showExtensionBadge:!1})}),t[6]=r,t[7]=g);let _;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,f.jsx)(u,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0}),t[8]=_):_=t[8];let v;t[9]!==a||t[10]!==p||t[11]!==h||t[12]!==g?(v=(0,f.jsxs)(c,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":p,onClick:a,onKeyDown:h,className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[g,_]}),t[9]=a,t[10]=p,t[11]=h,t[12]=g,t[13]=v):v=t[13];let b;t[14]===s?b=t[15]:(b=(0,f.jsx)(`span`,{className:`min-w-0 truncate`,children:s}),t[14]=s,t[15]=b);let x;return t[16]!==r||t[17]!==m||t[18]!==v||t[19]!==b?(x=(0,f.jsxs)(`span`,{"data-testid":m,title:r,className:`group/chip inline-flex max-w-[14rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[v,b]}),t[16]=r,t[17]=m,t[18]=v,t[19]=b,t[20]=x):x=t[20],x}function x(e){let t=(0,d.c)(13),{files:n,onRemoveFile:r,className:i,children:a}=e,s;t[0]===n?s=t[1]:(s=n===void 0?[]:n,t[0]=n,t[1]=s);let c=s;if(c.length===0&&v.Children.toArray(a).length===0)return null;let l;t[2]===i?l=t[3]:(l=o(`flex flex-wrap items-center gap-1`,i),t[2]=i,t[3]=l);let u;if(t[4]!==c||t[5]!==r){let e;t[7]===r?e=t[8]:(e=e=>(0,f.jsx)(b,{path:e,onRemove:()=>r?.(e)},e),t[7]=r,t[8]=e),u=c.map(e),t[4]=c,t[5]=r,t[6]=u}else u=t[6];let p;return t[9]!==a||t[10]!==l||t[11]!==u?(p=(0,f.jsxs)(`div`,{className:l,"data-testid":`composer-context-chips`,children:[u,a]}),t[9]=a,t[10]=l,t[11]=u,t[12]=p):p=t[12],p}function S(){let e=(0,d.c)(2),[t,n]=(0,v.useState)(C),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`);n(e.matches);let t=e=>n(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,v.useEffect)(r,i),t}function C(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var w=`ok-acp-follow-file-v1`;function T(){try{return localStorage.getItem(w)!==`0`}catch{return!0}}function E(e){try{localStorage.setItem(w,e?`1`:`0`)}catch{}}function D(e){return e===``||e.startsWith(`/`)||e.startsWith(`\\`)||e.split(`/`).some(e=>e===``||e.startsWith(`.`))?null:e}function O(e,t){let n=t.pathSeparator,r=e=>n===`\\`?e.replaceAll(`\\`,`/`):e,i=r(t.contentDir).replace(/\/$/,``),a=r(e);if(!a.startsWith(`${i}/`))return null;let o=a.slice(i.length+1),s=/\.(md|mdx)$/.exec(o);return s===null?null:D(o.slice(0,-s[0].length))}function k(e,t){let n=e[t];return typeof n==`string`&&n!==``?n:null}var A=new Set([`cat`,`ls`,`grep`,`rg`,`find`,`head`,`tail`,`wc`,`sort`,`uniq`,`cut`,`sed`,`awk`,`bat`,`less`,`more`]);function j(e,t){let n=[],r=/"([^"]*)"|'([^']*)'|(\S+)/g,i=r.exec(e);for(;i!==null;)n.push(i[1]??i[2]??i[3]??``),i=r.exec(e);let a=n[0];if(a===void 0||!A.has(a))return null;for(let e of n.slice(1)){if(e.startsWith(`-`)||/[*?[\]]/.test(e))continue;let n=/\.(md|mdx)$/i.exec(e);if(n===null)continue;if(e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e)){if(t!==null){let n=O(e,t);if(n!==null)return n}continue}let r=D(e.replace(/^\.\//,``).slice(0,-n[0].length));if(r!==null)return r}return null}function M(e){if(typeof e!=`object`||!e)return null;let t=e,n=k(t,`tool`)??k(t,`name`),r=t;if(typeof t.arguments==`object`&&t.arguments!==null)r=t.arguments;else if(typeof t.arguments==`string`)try{let e=JSON.parse(t.arguments);typeof e==`object`&&e&&(r=e)}catch{}return{tool:n,args:r}}function N(e,t,n,r){let i=M(e);if(i===null)return null;let{tool:a,args:o}=i;if(a===`delete`||a===null&&/\bdelete\b/i.test(t))return null;let s=typeof o.document==`object`&&o.document!==null?o.document:null,c=null;if(Array.isArray(o.documents))for(let e=o.documents.length-1;e>=0;e--){let t=o.documents[e];if(typeof t==`object`&&t){c=t;break}}let l=(s===null?null:k(s,`path`))??(c===null?null:k(c,`path`))??k(o,`to`)??k(o,`docName`);if(l!==null)return D(l.replace(/\.(md|mdx)$/,``));let u=k(o,`command`);if(u!==null){let e=j(u,n);return e!==null&&r.commandTargetExists!==void 0&&!r.commandTargetExists(e)?null:e}return null}function P(e,t,n={}){if(e.toolKind===`delete`)return null;let r=N(e.rawInput,e.title,t,n);if(r!==null)return r;if(t===null)return null;for(let n=e.locations.length-1;n>=0;n--){let r=e.locations[n];if(r===void 0)continue;let i=O(r.path,t);if(i!==null)return i}return null}function F(e,t,n={}){let r=null;for(let i of e){if(i.kind!==`tool_call`)continue;let e=P(i,t,n);e!==null&&(r=e)}return r}export{S as a,m as c,E as i,h as l,T as n,x as o,D as r,_ as s,F as t};
|