@inkeep/open-knowledge 0.86.13-beta.8 → 0.86.13-beta.9
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/assets/skills/project/references/linking.md +1 -1
- package/dist/cli.mjs +60 -60
- package/dist/constants-MkX1_7dG.mjs +1 -0
- package/dist/{dist-CUHyT8Po.mjs → dist-B2mNPHPS.mjs} +1 -1
- package/dist/{dist-jVEVXcLW.mjs → dist-v2lkJBLz.mjs} +494 -493
- package/dist/index.mjs +9 -9
- package/dist/{init-kdH152Ks.mjs → init-DcmVBoE-.mjs} +33 -33
- package/dist/init-Udt9RQTb.mjs +1 -0
- package/dist/{launch-json-removal-DfnXNgcq.mjs → launch-json-removal-CHhPsbmP.mjs} +1 -1
- package/dist/{loader-BAPBaCdj.mjs → loader-D8aRCnDL.mjs} +1 -1
- package/dist/loader-MSLOcQCZ.mjs +1 -0
- package/dist/{md-manager-BGnqyqi1-BZjgceH4.mjs → md-manager-BGnqyqi1-C2aCFGjW.mjs} +106 -106
- package/dist/{open-browser-4-JUxTJq.mjs → open-browser-Ccrfb4Zg.mjs} +1 -1
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-S7YFOnEc.mjs → preview-BJ6gs2RH.mjs} +1 -1
- package/dist/preview-CntWf8G9.mjs +1 -0
- package/dist/public/assets/{AccountSection-By8eO4DF.js → AccountSection-DtjsHl4P.js} +1 -1
- package/dist/public/assets/{ActivityModeContent-DXsf7rkL.js → ActivityModeContent-ue0cjhAi.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-C9-ztZw_.js → AddPropertiesButton-Bpz_-y_I.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-6LWBfRF0.js → AgentDiffPane-DieBkA8J.js} +1 -1
- package/dist/public/assets/{AttachmentsSection-CjwmogoS.js → AttachmentsSection-D0ANkE-3.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-DzNQgYlQ.js → CodeMirrorPropInput-Dkw0G_gY.js} +4 -4
- package/dist/public/assets/{ContentRulesSection-BT2fCLNL.js → ContentRulesSection-DrL9S92F.js} +1 -1
- package/dist/public/assets/{DocumentContext-Db80U3dt.js → DocumentContext-BT4R__b_.js} +28 -28
- package/dist/public/assets/{EditorModeToggle-DF54OEB_.js → EditorModeToggle-BrSFayGL.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-BCE8VhOn.js → ExcalidrawDocEditor-Cw7cxWTm.js} +1 -1
- package/dist/public/assets/FeedbackForm-Bqmfw-XS.js +1 -0
- package/dist/public/assets/{GraphPanel-BZ86oMzh.js → GraphPanel-Bq6fUIBW.js} +1 -1
- package/dist/public/assets/{ImageAttachments-DA_IO7l-.js → ImageAttachments-BkNRauWd.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-iNvdKf3A.js → ImportSkillDialog-Cqcp5gZh.js} +1 -1
- package/dist/public/assets/{LinkPreviewsSection-DJJDT9tt.js → LinkPreviewsSection-D7bkvkE6.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-Bqtg6Wo1.js → LintConfigEditor-B86O_7x_.js} +1 -1
- package/dist/public/assets/{LintingSection-Cgt0cds5.js → LintingSection-BokrC8-Q.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-Bz4exizS.js → ManagedArtifactProperties-XJly8z5W.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-yyVotSha.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-DN2R0mvw.js → MermaidDocEditor-BYZqgvF7.js} +1 -1
- package/dist/public/assets/{NetworkAccessSection-C65GEQs_.js → NetworkAccessSection-CVAEH3yW.js} +1 -1
- package/dist/public/assets/{OkignoreSection-CB1scSj_.js → OkignoreSection-GTDGySNc.js} +1 -1
- package/dist/public/assets/{PageListContext-DhMqc0Dx.js → PageListContext-HSyJOlMQ.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-BwqAwXVj.js → PropertyDisplayRow-DvzKSJ4l.js} +1 -1
- package/dist/public/assets/{PublishToGitHubDialog-CK-eGzTy.js → PublishToGitHubDialog-CncGO5IH.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-tgBrnYBX.js → ReportBugDialogBody-C3o-b5FB.js} +1 -1
- package/dist/public/assets/{ReportBugMenuTrigger-CxTQeLcC.js → ReportBugMenuTrigger-BSic8aEj.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-92Y3R-gV.js → SchemaConfigEditor-XhXJlVUd.js} +1 -1
- package/dist/public/assets/{SearchSection-D1TBVHyq.js → SearchSection-C2fJ-AZD.js} +1 -1
- package/dist/public/assets/{SessionsHost-CXSwHd_R.js → SessionsHost-w8sD1wRy.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-BlwAeg8V.js → SettingsDialogBody-CptWw-8n.js} +2 -2
- package/dist/public/assets/{ShareReceiveMissDialog-V3V9l5_l.js → ShareReceiveMissDialog-BqbonvaU.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-BIwWYubn.js → SkillToolbarControls-PlEcYJis.js} +1 -1
- package/dist/public/assets/{SourceEditor-BaYDGvRA.js → SourceEditor-CspQKnvE.js} +1 -1
- package/dist/public/assets/{SyncSection-BZtJ8qBB.js → SyncSection-az1Jic0z.js} +1 -1
- package/dist/public/assets/{SyncStatusBadge-DWP0pdU-.js → SyncStatusBadge-oD2nm86o.js} +1 -1
- package/dist/public/assets/{TerminalPanel-BfnrGC_7.js → TerminalPanel-C-9jJEyf.js} +1 -1
- package/dist/public/assets/{TerminalSection-hk0zu5zG.js → TerminalSection-Bf1m8ylg.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-lrQ93TuF.js → TerminalWindowApp-B1e5eVxf.js} +1 -1
- package/dist/public/assets/{TextDocEditor-CtVCY0Jr.js → TextDocEditor--crQL7j8.js} +1 -1
- package/dist/public/assets/{ThreadView-CCU9GEGb.js → ThreadView-DuI0ePSb.js} +3 -3
- package/dist/public/assets/{TimelineDiffPane-9rHxONpH.js → TimelineDiffPane-CGC7pH5m.js} +1 -1
- package/dist/public/assets/{client-version-LCIbDwjv.js → client-version-o0-e6Xg8.js} +1 -1
- package/dist/public/assets/{comment-chips-BL9CA_7r.js → comment-chips-BYzSWjE3.js} +3 -3
- package/dist/public/assets/{config-provider-C3qfGKpJ.js → config-provider-BcgiYSim.js} +1 -1
- package/dist/public/assets/{doc-undo-manager-CLUlSazH.js → doc-undo-manager-B-Erku0G.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-CW5EohSW.js → file-tree-adapter-D27t3A4R.js} +1 -1
- package/dist/public/assets/globals-G6Xf2xYI.css +1 -0
- package/dist/public/assets/index-DGrnzC_B.js +2205 -0
- package/dist/public/assets/{lint-plugins-Gc193-uk.js → lint-plugins-yQ5R3Dg-.js} +1 -1
- package/dist/public/assets/navigation-targets-pcYc32Il.js +1 -0
- package/dist/public/assets/{page-list-cache-B9RqU_KB.js → page-list-cache-C-bM1SMu.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-CBSAFtzU.js → pending-receive-nav-store-BV9hiWqU.js} +1 -1
- package/dist/public/assets/{preferred-session-events-ZmfH8TC-.js → preferred-session-events-CnOr_7vC.js} +1 -1
- package/dist/public/assets/progress-CIQy-NPJ.js +10 -0
- package/dist/public/assets/{selection-context-DLM2xYX3.js → selection-context-CP5ebTKT.js} +1 -1
- package/dist/public/assets/{src-B6V0x6iY.js → src-BUcEmKCH.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-OCgrT_rG.js → target-navigation-intent-B9dIW1Bq.js} +1 -1
- package/dist/public/assets/{telemetry-impl-EfUmLz7w.js → telemetry-impl-Bou1hrP6.js} +1 -1
- package/dist/public/assets/{telemetry-startup-B098Rfya.js → telemetry-startup-tSXZexaZ.js} +1 -1
- package/dist/public/assets/typing-burst-detector-adZ2R93j.js +8 -0
- package/dist/public/assets/{uninstall-BhKucRvy.js → uninstall-BNoyrj3Z.js} +1 -1
- package/dist/public/assets/{use-activity-panel-BXxBc9js.js → use-activity-panel-B0NYKsaf.js} +1 -1
- package/dist/public/assets/{use-installed-clis-DoWN-tVr.js → use-installed-clis-BqTMhT_v.js} +2 -2
- package/dist/public/assets/{use-open-skill-D4CHLLCX.js → use-open-skill-B7ZDbwPM.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-CC9zzjLB.js → use-terminal-enabled-MD4VMEe5.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-CYAX4sjQ.js → use-timeline-entry-diff-DBiVVCYO.js} +2 -2
- package/dist/public/index.html +28 -28
- package/dist/public/uninstall.html +3 -3
- package/dist/registry-probes-Bi3J6EAt.mjs +17 -0
- package/dist/{removal-file-path-U4VI8Y6X.mjs → removal-file-path-Ca9-pX6Q.mjs} +1 -1
- package/dist/{repair-launch-json-CVn0L03H.mjs → repair-launch-json-CwPWeO2c.mjs} +1 -1
- package/dist/{repair-mcp-configs-CNMFjBnO.mjs → repair-mcp-configs-DNzXqCJ8.mjs} +1 -1
- package/dist/src-C63FVPx1.mjs +1 -0
- package/dist/src-DgPsVo-K.mjs +16 -0
- package/dist/{start-CloYBm1u.mjs → start-Bd1cuWOs.mjs} +3 -3
- package/dist/start-DqnTaf73.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-DsqstLHH.mjs +0 -1
- package/dist/init-Cazf_ig6.mjs +0 -1
- package/dist/loader-55F_2Z6p.mjs +0 -1
- package/dist/preview-Cf3plc2s.mjs +0 -1
- package/dist/public/assets/FeedbackForm-BwnVqBbq.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-NyM5UGrR.js +0 -1
- package/dist/public/assets/globals-BddzEyvs.css +0 -1
- package/dist/public/assets/index-DR4V3jNo.js +0 -2205
- package/dist/public/assets/navigation-targets-CcY2FHJZ.js +0 -1
- package/dist/public/assets/progress-CY6HiIpq.js +0 -10
- package/dist/public/assets/typing-burst-detector-CTTymTnu.js +0 -8
- package/dist/registry-probes--fuRXE7y.mjs +0 -17
- package/dist/src-CQO5GchD.mjs +0 -1
- package/dist/src-oPFH8u4O.mjs +0 -16
- package/dist/start-BND4jpTX.mjs +0 -1
- /package/dist/public/assets/{globals-BfTv_Hnc.js → globals-aghZx9Sb.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as e,h as t,p as n,y as r}from"./constants-upload-CVKO8P4d.js";import{C as i,S as a,_ as o,b as s,d as c,g as l,h as u,m as d,v as f,w as p,x as m,y as h}from"./constants-cc1-Bt4QPTUe.js";import{t as g}from"./doc-extensions-CcO7K8uD-DG9uHV54.js";import{r as _}from"./doc-paths-cEiFVCxr.js";import{o as v,r as y}from"./file-tree-utils-BPUSn1l0.js";var b=524288;function x(e,t=b){return typeof e==`number`&&Number.isFinite(e)&&e>t}var ee=10485760,te=/\p{M}+/gu,ne=/[^\p{L}\p{N}]+/gu,re=/^-+|-+$/g;function S(e){return e.trim().normalize(`NFKD`).replace(te,``).toLowerCase().replace(ne,`-`).replace(re,``)}function ie(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function ae(e,t){let n=S(e);return n?ie(n,t):``}function oe(e,t){let n=S(e);return t?`#${n}-${S(t)}`:`#${n}`}var se={document:{unicode:`NFC`,case:`sensitive`},folder:{unicode:`NFC`,case:`sensitive`},file:{unicode:`NFC`,case:`insensitive`}};function C(e,t){let n=se[e],r=t.normalize(n.unicode);return n.case===`insensitive`?r.toLowerCase():r}function w(e){return C(`file`,e)}function T(e,t){return e<t?-1:+(e>t)}function E(e,t){let n=t.split(`/`),r=n.length-1;return n.map((t,n)=>C(n===r?e:`folder`,t)).join(`/`)}var D=Symbol.for(`@inkeep/open-knowledge-core/target-namespace`),ce=class extends Set{kind;[D]=!0;byKey=new Map;constructor(e,t){super(),this.kind=e;for(let e of t)this.add(e)}add(e){if(super.has(e))return this;super.add(e);let t=E(this.kind,e),n=this.byKey.get(t);if(n===void 0)return this.byKey.set(t,[e]),this;let r=0;for(;r<n.length&&T(n[r],e)<0;)r++;return n.splice(r,0,e),this}delete(e){if(!super.delete(e))return!1;let t=E(this.kind,e),n=this.byKey.get(t);return n===void 0?!0:(n.splice(n.indexOf(e),1),n.length===0&&this.byKey.delete(t),!0)}clear(){super.clear(),this.byKey.clear()}lookup(e){if(super.has(e))return{kind:`exact`,name:e};let t=this.byKey.get(E(this.kind,e));if(t===void 0)return{kind:`absent`};let n=t[0];return t.length===1?{kind:`equivalent`,name:n}:{kind:`ambiguous`,name:n,candidates:[...t]}}resolve(e){return super.has(e)?e:this.byKey.get(E(this.kind,e))?.[0]}};function O(e,t=[]){return new ce(e,t)}function le(e){return e[D]===!0}function k(e,t){return le(e)?e.resolve(t):e.has(t)?t:void 0}function ue(e,t){let n=e;return n[D]===!0&&n.kind===t}function A(e,t){return ue(t,e)?t:O(e,t)}function j(e){if(!e.includes(`%`))return e;let t;try{t=decodeURIComponent(e)}catch{return e}return t===`.`||t===`..`||t.includes(`/`)||t.includes(`\\`)||t.includes(`\0`)?e:t}function de(e){return e===`.`||e===`..`?e:encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.codePointAt(0)?.toString(16).toUpperCase()}`)}function fe(e){return e.split(`/`).map(de).join(`/`)}function M(e){return e.split(`/`).map(j).join(`/`)}function N(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),a=r>=0?n.slice(0,r):n,o=r>=0?n.slice(r+1):null,s=(a.split(`?`)[0]??``).trim();if(!s)return null;let c=j(s.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(c){let e=`.${(c[1]??``).toLowerCase()}`;if(!g.includes(e))return null}let l=s.startsWith(`/`),u=l?s.slice(1):s,d=l?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[],f=u.split(`/`),p=f.length-1;for(let e=0;e<f.length;e++){let t=j(f[e]??``);if(e===p&&(t=i(t)),t===`..`){if(d.length===0)return null;d.pop()}else t!==`.`&&t!==``&&d.push(t)}return d.length===0?null:{docName:d.join(`/`),anchor:o||null}}function pe(e){throw Error(`Unhandled ClassifiedLinkTarget variant: ${JSON.stringify(e)}`)}var P=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function F(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function I(e){return e.split(`/`).filter(Boolean)}function L(e){let t=e.trim();return P.test(t)||t.startsWith(`//`)}function me(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(L(n))return{kind:`external`,url:n};let r=n.indexOf(`#`),i=M(r<0?n:n.slice(0,r)),a=h(i,t);if(a)return{kind:`doc`,docName:a,anchor:r<0?null:n.slice(r+1)};let o=s(i,t);if(o)return{kind:`doc`,docName:o,anchor:r<0?null:n.slice(r+1)};let c=N(n,t);if(c)return{kind:`doc`,docName:c.docName,anchor:c.anchor};let l=F(i);return l&&l!==`md`&&l!==`mdx`?{kind:`asset`,url:n,ext:l,literal:!1}:null}function he(e,t){let n=e.trim();if(!n)return null;if(L(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=F(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r,literal:!0}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function ge(e,t,n){let r=e.trim();if(!r||P.test(r)||r.startsWith(`//`)||r.startsWith(`#`))return null;let i=r.indexOf(`#`),a=((i>=0?r.slice(0,i):r).split(`?`)[0]??``).trim();if(!a)return null;let o=a.startsWith(`/`),s=o?a.slice(1):a,c=o?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of s.split(`/`))if(e===`..`){if(c.length===0)return null;c.pop()}else e!==`.`&&e!==``&&c.push(n.literal?e:j(e));return c.length===0?null:c.join(`/`)}function _e(e,t,n=null,r=`.md`){let i=I(e);i.pop();let a=I(t),o=0;for(;o<i.length&&o<a.length&&i[o]===a[o];)o+=1;let s=i.slice(o).map(()=>`..`),c=a.slice(o),l=[...s,...c].join(`/`);return l||=a.at(-1)??t,!l.startsWith(`./`)&&!l.startsWith(`../`)&&(l=`./${l}`),`${fe(l)}${r}${n?`#${n}`:``}`}function R(e){return`pagesBySlug`in e}function z(e){return R(e)?e.pages:e}function B(e,t){return R(e)?e.assetPaths??new Set:t??new Set}function V(e,t){return R(e)?e.filePaths??new Set:t??new Set}function ve(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e);e&&(i===void 0||T(r,i)<0)&&n.set(e,r)}return n}function ye(e,t){let n=new Map,r=[...e].sort(T);for(let e of r){let r=e.lastIndexOf(`/`),i=t(r===-1?e:e.slice(r+1));i&&!n.has(i)&&n.set(i,e)}return n}function be(e,t){let n=S(e);if(!n)return;if(R(t))return t.pagesBySlug.get(n);let r;for(let e of t)S(e)===n&&(r===void 0||T(e,r)<0)&&(r=e);return r}function xe(e,t){if(e.includes(`/`))return;let n=S(e);if(!n)return;if(R(t))return t.pagesByBasename?.get(n);let r;for(let e of t){let t=e.lastIndexOf(`/`);S(t===-1?e:e.slice(t+1))===n&&(r===void 0||T(e,r)<0)&&(r=e)}return r}function H(e){let t=e.trim();if(!t)return[];let n=S(t);return n.length>0&&n!==t?[n]:[]}function U(e,t){let n=e.trim();if(!n)return;let r=k(z(t),n);if(r!==void 0)return r;let i=n.replace(/\.(md|mdx)$/i,``);if(i!==n){let e=W(i,t);if(e!==void 0)return e}return W(n,t)}function W(e,t){let n=e.trim();if(!n)return;let r=z(t),i=k(r,n);if(i!==void 0)return i;let a=be(n,t);if(a)return a;for(let e of H(n)){let t=k(r,e);if(t!==void 0)return t}return Se(n,r)||xe(n,t)}function Se(e,t){let n=k(t,`${e}/index`);if(n!==void 0)return n;let r=e.lastIndexOf(`/`),i=r===-1?e:e.slice(r+1);return i?k(t,`${e}/${i}`):void 0}function G(e){let t=((e.trim().split(`#`)[0]??``).trim().split(`?`)[0]??``).trim();return t.startsWith(`/`)?t.slice(1):t}function Ce(e){let t=new Map;for(let n of e){let e=w(n),r=t.get(e);(r===void 0||T(n,r)<0)&&t.set(e,n)}return t}function we(e){let t=A(`file`,e),n;return e=>{let r=t.resolve(e);return r===void 0?(n??=Ce(t),n.get(w(e))):r}}function K(e,t,n){let r=G(e);if(!r)return null;let i=n?[t,n]:[t];for(let e of i){let t=we(e)(r);if(t!==void 0)return t}if(r.includes(`/`))return null;let a=C(`file`,r),o=[];for(let e of i)for(let t of e){let e=t.lastIndexOf(`/`);C(`file`,e===-1?t:t.slice(e+1))===a&&o.push(t)}return o.length===0?null:o.sort(T)[0]??null}function Te(...e){let t=new Set;for(let n of e)for(let e of n)t.add(`path:${w(e)}`),t.add(`basename:${C(`file`,e.slice(e.lastIndexOf(`/`)+1))}`);return t}function Ee(e,t,n,r){let i=e.trim();if(!i)return!1;let a=G(i),o=R(t)?t.assetTargetKeys:void 0;if(o!==void 0){if(o.has(`path:${w(a)}`)||!a.includes(`/`)&&o.has(`basename:${C(`file`,a)}`))return!0}else if(K(i,B(t,n),V(t,r)))return!0;return U(i,t)!==void 0}function De(e,t,n){let r=he(e,t);return r===null||r.kind!==`asset`||K(r.url,B(n),V(n))!==null||U(e,n)===void 0?r:{kind:`doc`,docName:e.trim(),anchor:t?.trim()||null}}function Oe(e){return e.scope===`project`?i(q(e)):a(e.scope,e.name,e.hostQualifier)}function q(e){return e.canonicalPath??e.path}function ke(e,t){return e.scope===`project`?`${q(e).replace(/\/SKILL\.mdx?$/i,``)}/${i(t)}`:m(e.scope,e.name,t,e.hostQualifier)}function J(e){let t=l(e);return t?.kind===`skill`?t.name:null}function Y(e){let t=e.trim();return{normalizedTarget:t.replace(/^\.\/+/,``).replace(/^\/+/,``).replace(/\/+$/g,``),expectsFolder:/\/+$/.test(t)}}function Ae(e){return _(e).replace(/\/+$/g,``)}function X(e){return e.slice(0,e.lastIndexOf(`/`))}var Z=/\.(md|mdx)$/i;function je(e,t){let{normalizedTarget:n,expectsFolder:r}=Y(e);return r||!Z.test(n)||k(t,n)!==void 0?e:n.replace(Z,``)}function Q(e){let t=new Set;for(let n of e)for(let e of y(n))t.add(e);return t}function Me(e,t){return t?`${e}${t}`:(e.split(`/`).pop()??``).lastIndexOf(`.`)>0?e:`${e}.md`}function Ne(t,n){if(!v(t)||o(t)||k(n.pages,t)!==void 0)return null;let r=Me(t,n.docExt);return{kind:`asset`,target:r,assetPath:r,mediaKind:e(r.slice(r.lastIndexOf(`.`)+1))}}function Pe(e,i){let a=e,s=je(a,i.pages);if(c(s)){let e=u(s);if(e?.kind===`skill`&&e.scope===`project`){let t=f(e.name);return{kind:`doc`,target:t,docName:t}}let t=d(s);if(t){let e=p(t.folder,t.name);return{kind:`doc`,target:e,docName:e}}return{kind:`doc`,target:s,docName:s}}if(J(s))return{kind:`doc`,target:s,docName:s};let l=o(s);if(l){let e=p(l.folder,l.name);return{kind:`doc`,target:e,docName:e}}let{normalizedTarget:m,expectsFolder:h}=Y(a);if(!m)return{kind:`missing`,target:m};if(!h&&(t(m)||n(m)||r(m)))return{kind:`doc`,target:m,docName:m};let g=Ae(a),_=h?void 0:U(m,{pages:i.pages,pagesBySlug:i.pagesBySlug??new Map,pagesByBasename:i.pagesByBasename}),v=h?[g]:[m,g];for(let e of v){let t=k(i.pages,`${e}/index`);if(t!==void 0&&(h||_===t))return{kind:`folder-index`,target:e,folderPath:X(t),docName:t,noteKind:`canonical-index`};let n=e.split(`/`).pop(),r=n?k(i.pages,`${e}/${n}`):void 0;if(r!==void 0&&(h||_===r))return{kind:`folder-index`,target:e,folderPath:X(r),docName:r,noteKind:`legacy-folder-note`}}if(_!==void 0)return{kind:`doc`,target:_,docName:_};let y=k(i.folderPaths??Q(i.pages),g);if(y!==void 0)return{kind:`folder`,target:g,folderPath:y};if(!h){let e=Ne(m,i);if(e)return e}return{kind:`missing`,target:g||m}}function Fe(e){return e.kind===`folder-index`?{kind:`folder`,target:e.folderPath,folderPath:e.folderPath}:e}function $(e,t,n=b){return typeof t!=`number`||!x(t,n)?null:{kind:`large-file`,target:e,docName:e,size:t,limit:n}}function Ie(e,t,n=b){return e.kind!==`doc`&&e.kind!==`folder-index`?e:$(e.docName,t.get(e.docName)?.size,n)??e}function Le(e){switch(e.kind){case`doc`:case`folder-index`:case`large-file`:return e.docName;case`missing`:return e.target;case`asset`:case`skill-file`:case`skills`:case`skill-preview`:case`folder`:return null}}export{ae as A,L as C,A as D,N as E,oe as M,ee as N,O,x as P,F as S,M as T,De as _,Ne as a,_e as b,J as c,ye as d,ve as f,K as g,Ee as h,$ as i,S as j,k,ke as l,H as m,Le as n,Pe as o,Te as p,Fe as r,Ie as s,Q as t,Oe as u,U as v,ge as w,me as x,pe as y};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{K as n,X as r,Y as i}from"./DocumentContext-Db80U3dt.js";import{t as a}from"./react-f2sANaYj.js";import{r as o}from"./dist-Nvb76hAm.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{t as c}from"./utils-CPqDy6Hr.js";import{c as l,l as u}from"./dist-DTFuvKje.js";import{i as d,n as f,r as p,t as m}from"./tooltip-DBqLYfio.js";import{t as h}from"./button-DzgjsZzC.js";import{J as g,X as _,Y as v,at as y,it as b,n as x,o as S,z as C}from"./dist-Dc8tD1th.js";import{t as w}from"./dist-C_FzPxEX2.js";import{t as T}from"./workspace-paths-BjilyZF6.js";import{t as E}from"./createLucideIcon-DdBzwsHe.js";import{a as D,d as O,h as ee,r as te,t as ne}from"./dropdown-menu-DtLu9NwU.js";import{$ as k,A,K as re,St as ie,Z as ae,bt as oe,f as j,g as se,h as M,k as ce,l as le,m as N,p as P,sr as ue,u as F,xt as I,yt as L}from"./CodeMirrorPropInput-DzNQgYlQ.js";import{t as de}from"./spinner-Bx8xD6f8.js";import{b as fe}from"./comment-chips-BL9CA_7r.js";import{t as R}from"./paperclip-BHdV1F_7.js";import{t as pe}from"./plus-zPnYzcqL.js";import{t as z}from"./x-DM2drskU.js";import{t as me}from"./badge-DmdA1C7r.js";import{r as he}from"./doc-paths-cEiFVCxr.js";import{h as ge}from"./file-tree-adapter-CW5EohSW.js";import{r as _e}from"./image-attachment-0vTbHPE_.js";import{C as B,T as ve,w as ye}from"./thread-client-Bqra55t5.js";var V=e(a(),1),H=t(),U=`Progress`,W=100,[be,xe]=l(U),[G,K]=be(U),q=V.forwardRef((e,t)=>{let{__scopeProgress:n,value:r=null,max:i,getValueLabel:a=Y,...o}=e;(i||i===0)&&!Ce(i)&&console.error(Te(`${i}`,`Progress`));let s=Ce(i)?i:W;r!==null&&!we(r,s)&&console.error(Ee(`${r}`,`Progress`));let c=we(r,s)?r:null,l=Z(c)?a(c,s):void 0;return(0,H.jsx)(G,{scope:n,value:c,max:s,children:(0,H.jsx)(u.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":Z(c)?c:void 0,"aria-valuetext":l,role:`progressbar`,"data-state":X(c,s),"data-value":c??void 0,"data-max":s,...o,ref:t})})});q.displayName=U;var Se=`ProgressIndicator`,J=V.forwardRef((e,t)=>{let{__scopeProgress:n,...r}=e,i=K(Se,n);return(0,H.jsx)(u.div,{"data-state":X(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:t})});J.displayName=Se;function Y(e,t){return`${Math.round(e/t*100)}%`}function X(e,t){return e==null?`indeterminate`:e===t?`complete`:`loading`}function Z(e){return typeof e==`number`}function Ce(e){return Z(e)&&!isNaN(e)&&e>0}function we(e,t){return Z(e)&&!isNaN(e)&&e<=t&&e>=0}function Te(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${W}\`.`}function Ee(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
2
|
-
- a positive number
|
|
3
|
-
- less than the value passed to \`max\` (or ${W} if no \`max\` prop is set)
|
|
4
|
-
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
5
|
-
|
|
6
|
-
Defaulting to \`null\`.`}var De=q,Oe=J,ke=E(`at-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]),Ae=E(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),je=E(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),Me=E(`square-slash`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),Q=s(),Ne=`ok-ask-ai-draft-v2`,Pe={doc:null,dismissed:!1};function Fe(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var Ie=null,Le=new Set;function Re(e){if(e===null)return!0;let t=e.content;return!Array.isArray(t)||t.length===0?!0:t.every(e=>{let t=e.content;return!Array.isArray(t)||t.length===0})}function ze(){let e=Fe();if(!e)return Pe;try{let t=e.getItem(Ne);if(!t)return Pe;let n=JSON.parse(t);return typeof n!=`object`||!n||Array.isArray(n)?Pe:{doc:n,dismissed:!1}}catch(e){return console.warn(`failed to parse stored draft — clearing`,e),Pe}}function Be(){return Ie===null&&(Ie=ze()),Ie}function Ve(e){let t=Fe();if(t)try{e&&!Re(e)?t.setItem(Ne,JSON.stringify(e)):t.removeItem(Ne)}catch{}}function He(){for(let e of Le)e()}function Ue(){return Be()}function We(e){let t=e&&!Re(e)?e:null;Ie={...Be(),doc:t},Ve(t),He()}function Ge(){We(null)}var Ke=L;function qe(e){let t=ce(e).kind;return t===`folder`||t===`asset`?t:`page`}function Je(e){let t=(0,Q.c)(14),{items:r,query:i,selectedIndex:a,onSelect:s,loading:c,error:l,hasMore:u}=e,d=c===void 0?!1:c,f=l===void 0?!1:l,p=u===void 0?!1:u,{_:m}=o(),h=(0,V.useId)(),g=(0,V.useRef)(null),_,v;t[0]===a?(_=t[1],v=t[2]):(_=()=>{(g.current?.querySelectorAll(`[role="option"]`))?.item(a)?.scrollIntoView({block:`nearest`})},v=[a],t[0]=a,t[1]=_,t[2]=v),(0,V.useEffect)(_,v);let y=a>=0&&a<r.length?r[a]:null,b;return t[3]!==m||t[4]!==f||t[5]!==p||t[6]!==r||t[7]!==h||t[8]!==d||t[9]!==s||t[10]!==i||t[11]!==a||t[12]!==y?(b=(0,H.jsx)(`div`,{ref:g,className:`w-80 max-w-[min(28rem,90vw)] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:d?(0,H.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:m({id:`3m2GBo`})}):f?(0,H.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`assertive`,children:m({id:`weP6me`})}):r.length===0?(0,H.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:i.trim()===``?m({id:`0E9DR6`}):m({id:`yQyglE`})}):(0,H.jsxs)(`div`,{role:`listbox`,id:h,"aria-label":m({id:`05n5wS`}),tabIndex:-1,className:`max-h-64 overflow-y-auto overscroll-contain subtle-scrollbar`,children:[(0,H.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:y?y.title:``}),r.map((e,t)=>{let r=t===a,i=qe(e.path),o=i===`folder`,c=o?`${e.path}/`:e.path;return(0,H.jsxs)(`button`,{id:`${h}-option-${t}`,type:`button`,role:`option`,"aria-selected":r,"data-active":r,"data-mention-kind":i,"data-testid":`composer-mention-option-${e.docName}`,className:`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left ${r?`bg-accent text-accent-foreground`:``}`,onMouseDown:t=>{t.preventDefault(),s(e)},children:[(0,H.jsx)(n,{path:e.path,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,H.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,H.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,H.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),o?(0,H.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:m({id:`kNqMMd`})}):null]}),(0,H.jsx)(`span`,{className:`line-clamp-2 break-all text-xs text-muted-foreground`,children:c})]})]},e.docName)}),p?(0,H.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,"aria-hidden":!0,children:m({id:`F1T9y_`})}):null]})}),t[3]=m,t[4]=f,t[5]=p,t[6]=r,t[7]=h,t[8]=d,t[9]=s,t[10]=i,t[11]=a,t[12]=y,t[13]=b):b=t[13],b}function Ye(e){let t=(0,Q.c)(12),{items:n,query:r,selectedIndex:i,onSelect:a,commandsKnown:s}=e,{_:c}=o(),l=(0,V.useId)(),u=(0,V.useRef)(null),d,f;t[0]===i?(d=t[1],f=t[2]):(d=()=>{(u.current?.querySelectorAll(`[role="option"]`))?.item(i)?.scrollIntoView({block:`nearest`})},f=[i],t[0]=i,t[1]=d,t[2]=f),(0,V.useEffect)(d,f);let p=i>=0&&i<n.length?n[i]:null,m;return t[3]!==c||t[4]!==s||t[5]!==n||t[6]!==l||t[7]!==a||t[8]!==r||t[9]!==i||t[10]!==p?(m=(0,H.jsx)(`div`,{ref:u,"data-testid":`composer-slash-menu`,className:`w-[42rem] max-w-[min(42rem,90vw)] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:n.length===0?(0,H.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:s?r.trim()===``?c({id:`QohqVL`}):c({id:`odYWGJ`}):c({id:`9OPs7U`})}):(0,H.jsxs)(`div`,{role:`listbox`,id:l,"aria-label":c({id:`67Dpmh`}),tabIndex:-1,className:`max-h-64 overflow-y-auto overscroll-contain subtle-scrollbar`,children:[(0,H.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:p?`/${p.name}`:``}),n.map((e,t)=>{let n=t===i;return(0,H.jsxs)(`button`,{id:`${l}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-active":n,"data-testid":`composer-slash-option-${e.name}`,className:`flex w-full items-baseline gap-2 rounded-md px-2 py-1.5 text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseDown:t=>{t.preventDefault(),a(e)},children:[(0,H.jsxs)(`span`,{className:`shrink-0 font-mono text-sm font-medium`,children:[`/`,e.name]}),(0,H.jsx)(`span`,{className:`line-clamp-2 min-w-0 flex-1 text-xs text-muted-foreground`,children:e.description})]},e.name)})]})}),t[3]=c,t[4]=s,t[5]=n,t[6]=l,t[7]=a,t[8]=r,t[9]=i,t[10]=p,t[11]=m):m=t[11],m}var Xe=new y(`composerSlashSuggestion`),Ze=S.create({name:`composerCommand`,group:`inline`,inline:!0,atom:!0,selectable:!1,addAttributes(){return{name:{default:``},description:{default:``},hint:{default:``}}},parseHTML(){return[{tag:`span[data-composer-command]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.name??``);return[`span`,C(t,{"data-composer-command":n,class:`composer-slash-token composer-slash-token-known`}),`/${n}`]},renderText({node:e}){return`/${e.attrs.name}`}}),Qe=new y(`composerSlashToken`),$e=`composerSlashCommand`;function et(e){return e.storage[$e]}function tt(e){return et(e)?.commands??null}function nt(e,t){let n=et(e);return n===void 0||n.commands===t?!1:(n.commands=t,!0)}function rt(e){let t=tt(e);if(t===null)return!1;let n=ue(e);if(n===void 0)return!1;let{state:r}=n,i=[];if(r.doc.descendants((e,t)=>{e.type.name===`composerCommand`&&i.push({pos:t,node:e})}),i.length===0)return!1;let a=r.tr;for(let{pos:e,node:n}of i.reverse()){let i=String(n.attrs.name??``),o=t.find(e=>e.name===i);if(o===void 0){a.replaceWith(e,e+n.nodeSize,r.schema.text(`/${i}`));continue}let s=o.input?.hint??``;(n.attrs.description!==o.description||n.attrs.hint!==s)&&a.setNodeMarkup(e,void 0,{name:i,description:o.description,hint:s})}return a.docChanged?(n.dispatch(a.setMeta(`addToHistory`,!1)),!0):!1}function it(e,t){let n=t.trim().toLowerCase();if(n===``)return[...e];let r=[],i=[],a=[];for(let t of e){let e=t.name.toLowerCase();e.startsWith(n)?r.push(t):e.includes(n)?i.push(t):t.description.toLowerCase().includes(n)&&a.push(t)}return[...r,...i,...a]}function at(e){let t=/^\/(\S+)/.exec(e);return t===null?null:{name:t[1]??``,length:t[0].length}}var ot=[` `,` `,`
|
|
7
|
-
`,`\xA0`];function st(e){return/^\S*/.exec(e)?.[0].length??0}function ct(e,t){let n=at(e);if(n===null||t===null)return null;let r=t.find(e=>e.name===n.name);return r===void 0?{kind:`unknown`,name:n.name,agentHasCommands:t.length>0}:{kind:`known`,name:r.name,description:r.description}}function lt(e){return ut(e.state.doc.firstChild)}function ut(e){let t=e?.firstChild??null;return t?.isText?t.text??``:``}function dt(e,t){let n=e.firstChild,r=n?.firstChild??null;if(r!==null&&r.type.name===`composerCommand`){if(!mt(e))return _.empty;let t=String(r.attrs.hint??``),i=String(r.attrs.description??``),a=t===``?i===``?``:`— ${i}`:t;return a===``?_.empty:_.create(e,[ft(1+(n?.content.size??0),a,String(r.attrs.name))])}if(t===null)return _.empty;let i=at(ut(e.firstChild));if(i===null)return _.empty;let a=t.find(e=>e.name===i.name),o=[v.inline(1,1+i.length,{class:a===void 0?`composer-slash-token composer-slash-token-unknown`:`composer-slash-token composer-slash-token-known`})];if(a!==void 0&&pt(e,i.length)){let t=a.input?.hint!=null&&a.input.hint!==``?a.input.hint:`— ${a.description}`;(a.description!==``||a.input?.hint)&&o.push(ft(1+(e.firstChild?.firstChild?.nodeSize??0),t,a.name))}return _.create(e,o)}function ft(e,t,n){return v.widget(e,()=>{let e=document.createElement(`span`);return e.className=`composer-slash-ghost`,e.setAttribute(`aria-hidden`,`true`),e.textContent=t,e},{side:1,key:`slash-ghost:${n}`})}function pt(e,t){if(e.childCount!==1)return!1;let n=e.firstChild;if(n===null||n.childCount!==1)return!1;let r=n.firstChild;if(r===null||!r.isText)return!1;let i=r.text??``;return i.length<=t+1&&(i.length===t||i.endsWith(` `))}function mt(e){if(e.childCount!==1)return!1;let t=e.firstChild;if(t===null)return!1;if(t.childCount===1)return!0;if(t.childCount!==2)return!1;let n=t.child(1);return n.isText&&/^\s*$/.test(n.text??``)}var ht=x.create({name:$e,addOptions(){return{commands:null}},addStorage(){return{commands:this.options.commands}},addProseMirrorPlugins(){let e=this.storage,t=()=>e.commands??null;return[new b({key:Qe,state:{init:(e,n)=>dt(n.doc,t()),apply:e=>dt(e.doc,t())},props:{decorations(e){return this.getState(e)}}}),A({editor:this.editor,pluginKey:Xe,char:`/`,allowedPrefixes:[...ot],items:({query:e})=>{let n=t();return n===null||n.length===0?[]:it(n,e)},command:({editor:e,range:t,props:n})=>{let r=e.state.doc.resolve(t.to),i=e.state.doc.textBetween(t.to,r.end()),a=st(i),o=/^\s/.test(i.slice(a))?``:` `,s=t.from===1;try{e.chain().focus().deleteRange({from:t.from,to:t.to+a}).insertContent(s?[{type:`composerCommand`,attrs:{name:n.name,description:n.description,hint:n.input?.hint??``}},...o===``?[]:[{type:`text`,text:o}]]:[{type:`text`,text:`/${n.name}${o}`}]).run()}catch(e){console.error(`[composer-slash-command] insert failed`,{item:n,range:t},e)}},render:()=>{let e=null,n=null,r=0,i={popup:null,stopAutoUpdate:null},a=null,o=null,s=e=>{n?.command(e)},c=e=>{o=e.editor.view,M(o,(e.items??[]).length)},l=e=>({items:e.items??[],query:e.query??``,selectedIndex:r,onSelect:s,commandsKnown:t()!==null}),u=()=>{!e||!n||e.updateProps(l(n))};return{onBeforeStart(t){n=t,r=0,c(t);let o=P(()=>n,`composer-slash`);i.popup=o.popup,a=o.doPosition,e=new ae(Ye,{props:l(t),editor:t.editor}),o.popup.appendChild(e.element),i.stopAutoUpdate=o.startAutoUpdate(),o.reveal()},onStart(e){n=e,r=0,c(e),u()},onUpdate(e){n=e,r=Math.min(r,Math.max(0,e.items.length-1)),c(e),u(),a?.()},onKeyDown({event:e}){if(!n)return!1;let t=n.items;if(e.key===`ArrowDown`)return t.length===0?!1:(r=(r+1)%t.length,u(),!0);if(e.key===`ArrowUp`)return t.length===0?!1:(r=(r-1+t.length)%t.length,u(),!0);if(e.key===`Enter`||e.key===`Tab`){let e=t[r];return e?(n.command(e),!0):!1}return!1},onExit(){N(i),a=null,e?.destroy(),e=null,n=null,r=0,o!==null&&(j(o),o=null)}}}})]}}),gt=8,_t=4,vt=`composerMention`,yt={currentDocName:null,recentPaths:[]};function bt(e){return e.storage[vt]}function xt(e){return bt(e)?.recency??yt}function St(e,t){let n=bt(e);n!==void 0&&(n.recency=t)}function Ct(e,t){let n=t.currentDocName===null?null:he(t.currentDocName),r=new Map;for(let[e,n]of t.recentPaths.entries())r.set(n,e+1);let i=[];for(let t of e){if(n!==null&&t.docName===n){i.push({page:t,order:0});continue}let e=r.get(Tt(t));e!==void 0&&i.push({page:t,order:e})}i.sort((e,t)=>e.order-t.order);let a=i.slice(0,_t).map(e=>e.page),o=new Set(a);return[...a,...F(e.filter(e=>!o.has(e)),``)]}var wt=new y(`composerMentionSuggestion`);function Tt(e){return e.kind===`asset`?e.docName.replace(/^\//,``):e.kind===`folder`?e.docName:T(e.docName)}var Et=S.create({name:`doc`,topNode:!0,content:`paragraph+`}),Dt=S.create({name:`paragraph`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML(){return[`p`,0]}}),Ot=S.create({name:`text`,group:`inline`}),kt=S.create({name:`hardBreak`,group:`inline`,inline:!0,selectable:!1,parseHTML(){return[{tag:`br`}]},renderHTML(){return[`br`]},addKeyboardShortcuts(){return{"Shift-Enter":()=>this.editor.commands.insertContent({type:`hardBreak`})}}}),At=x.create({name:`composerHistory`,addProseMirrorPlugins(){return[oe(),g({"Mod-z":ie,"Mod-y":I,"Shift-Mod-z":I})]}}),jt=S.create({name:vt,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{path:{default:``},label:{default:``},mentionKind:{default:`file`}}},parseHTML(){return[{tag:`span[data-composer-mention]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.label||e.attrs.path);return[`span`,C(t,{"data-composer-mention":String(e.attrs.path??``),class:`composer-mention-chip`}),`@${n}`]},renderText({node:e}){return`@${e.attrs.path}`},addNodeView(){return({node:e,editor:t,getPos:n})=>{let a=String(e.attrs.path??``),o=String(e.attrs.label||e.attrs.path),s=document.createElement(`span`);s.className=`composer-mention-chip group/mention`,s.setAttribute(`data-composer-mention`,a),s.title=o;let c=document.createElement(`button`);c.type=`button`,c.className=`composer-mention-icon`,c.setAttribute(`aria-label`,w._({id:`Xzy0s0`,values:{fullLabel:o}}));let l=document.createElement(`span`);l.className=`composer-mention-glyph composer-mention-glyph-icon`,l.setAttribute(`aria-hidden`,`true`),l.innerHTML=i(a),c.appendChild(l);let u=document.createElement(`span`);u.className=`composer-mention-glyph composer-mention-glyph-x`,u.setAttribute(`aria-hidden`,`true`),u.innerHTML=r(z),c.appendChild(u),c.addEventListener(`mousedown`,e=>e.preventDefault()),c.addEventListener(`click`,r=>{r.preventDefault();let i=typeof n==`function`?n():null;i!=null&&t.chain().focus().deleteRange({from:i,to:i+e.nodeSize}).run()}),s.appendChild(c);let d=document.createElement(`span`);return d.className=`composer-mention-label`,d.textContent=o,s.appendChild(d),{dom:s}}},addStorage(){return{recency:yt}},addProseMirrorPlugins(){return[Pt(this.editor)]}});function Mt(e){return[Et,Dt,Ot,kt,At,jt,Ze,...e?.slashCommands===void 0?[]:[ht.configure({commands:e.slashCommands})],...e?.placeholder?[Ke.configure({placeholder:e.placeholder,showOnlyWhenEditable:!1})]:[]]}function Nt(e=()=>le({includeFolders:!0})){let t=[],n=!1,r=null,i=!1;return{snapshot(){return{loaded:n,error:i}},async getItems(a,o=yt){if(!n){r||=e();try{t=await r,n=!0,i=!1}catch(e){console.error(`[composer-mention] failed to fetch pages`,e),t=[],i=!0}finally{r=null}}return(a===``?Ct(t,o):F(t,a)).slice(0,gt).map(e=>({docName:e.docName,title:e.title,path:Tt(e),kind:e.kind===`folder`?`folder`:`file`})).filter(e=>e.path!==``)},reset(){t=[],n=!1,r=null,i=!1}}}function Pt(e){let t=Nt();return A({editor:e,pluginKey:wt,char:`@`,items:({query:n})=>t.getItems(n,xt(e)),command:({editor:e,range:t,props:n})=>{try{e.chain().focus().deleteRange(t).insertContent([{type:`composerMention`,attrs:{path:n.path,label:n.title,mentionKind:n.kind}},{type:`text`,text:` `}]).run()}catch(e){console.error(`[composer-mention] insert failed`,{item:n,range:t},e)}},render:()=>{let e=null,n=null,r=0,i={popup:null,stopAutoUpdate:null},a=null,o=null,s=null,c=e=>{n?.command(e)},l=e=>{s=e.editor.view,M(s,(e.items??[]).length)},u=e=>{let n=e.items??[],{loaded:i,error:a}=t.snapshot();return{items:n,query:e.query??``,selectedIndex:r,onSelect:c,loading:!i&&!a,error:a,hasMore:n.length>=gt}},d=()=>{!e||!n||e.updateProps(u(n))};return{onBeforeStart(t){n=t,r=0,l(t);let s=P(()=>n,`composer-mention`);i.popup=s.popup,a=s.doPosition,o=s.reveal,e=new ae(Je,{props:u(t),editor:t.editor}),s.popup.appendChild(e.element),i.stopAutoUpdate=s.startAutoUpdate()},onStart(e){n=e,r=0,l(e),d(),o?.()},onUpdate(e){n=e,r=Math.min(r,Math.max(0,e.items.length-1)),l(e),d(),a?.()},onKeyDown({event:e}){if(!n)return!1;let t=n.items;if(e.key===`ArrowDown`)return t.length===0?!1:(r=(r+1)%t.length,d(),!0);if(e.key===`ArrowUp`)return t.length===0?!1:(r=(r-1+t.length)%t.length,d(),!0);if(e.key===`Enter`||e.key===`Tab`){let e=t[r];return e?(n.command(e),!0):!1}return!1},onExit(){N(i),a=null,o=null,e?.destroy(),e=null,n=null,r=0,s!==null&&(j(s),s=null),t.reset()}}}})}function Ft(e){let t=[],n=[],r=new Set,i=[];return e.state.doc.forEach(e=>{let a=``;e.forEach(e=>{if(e.type.name===`composerMention`){let i=String(e.attrs.path??``);if(i!==``&&(a+=`@${i}`,!r.has(i))){r.add(i),t.push(i);let a=String(e.attrs.label??``),o=e.attrs.mentionKind===`folder`?`folder`:`file`;n.push({kind:o,path:i,name:a===``?i:a})}}else e.type.name===`composerCommand`?a+=`/${String(e.attrs.name??``)}`:e.isText?a+=e.text??``:e.type.name===`hardBreak`&&(a+=`
|
|
8
|
-
`)}),i.push(a)}),{instruction:i.join(`
|
|
9
|
-
`).trim(),mentions:t,attachments:n}}function $(e){let{instruction:t,mentions:n}=Ft(e);return t===``&&n.length===0}function It(e){let t=e?.content;return!Array.isArray(t)||t.length===0?!1:t.some(e=>Array.isArray(e.content)&&e.content.length>0)}function Lt(e){return e.split(`
|
|
10
|
-
`).map(e=>({type:`paragraph`,content:e===``?[]:[{type:`text`,text:e}]}))}function Rt(e){let t=(0,Q.c)(75),{ref:n,ariaLabel:r,ariaDescribedBy:i,onEmptyChange:a,onContentChange:s,onMentionsChange:l,onSubmit:u,onEscape:d,className:f,placeholder:p,initialDoc:m,disabled:h,testId:g,slashCommands:_,mentionRecency:v,attachmentDrop:y}=e,b=h===void 0?!1:h,{_:x}=o(),[S,C]=(0,V.useState)(null),[w,T]=(0,V.useState)(null),E=(0,V.useRef)(0),D;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{E.current+=1,T({text:e,id:E.current})},t[0]=D):D=t[0];let O=D,ee,te;t[1]===w?(ee=t[2],te=t[3]):(ee=()=>{if(w===null)return;let e=setTimeout(()=>T(null),4e3);return()=>clearTimeout(e)},te=[w],t[1]=w,t[2]=ee,t[3]=te),(0,V.useEffect)(ee,te);let ne=(0,V.useRef)(a),A=(0,V.useRef)(s),ie=(0,V.useRef)(l),ae=(0,V.useRef)(u),oe=(0,V.useRef)(d),j;t[4]!==s||t[5]!==a||t[6]!==d||t[7]!==l||t[8]!==u?(j=()=>{ne.current=a,A.current=s,ie.current=l,ae.current=u,oe.current=d},t[4]=s,t[5]=a,t[6]=d,t[7]=l,t[8]=u,t[9]=j):j=t[9],(0,V.useEffect)(j);let M;t[10]!==p||t[11]!==_?(M=Mt({placeholder:p,slashCommands:_}),t[10]=p,t[11]=_,t[12]=M):M=t[12];let ce=m??void 0,le=!b,N;t[13]===i?N=t[14]:(N=i===void 0?{}:{"aria-describedby":i},t[13]=i,t[14]=N);let P;t[15]===g?P=t[16]:(P=g===void 0?{}:{"data-testid":g},t[15]=g,t[16]=P);let ue;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ue=c(`composer-prosemirror py-1 outline-none`),t[17]=ue):ue=t[17];let F;t[18]!==r||t[19]!==P||t[20]!==N?(F={role:`textbox`,"aria-label":r,...N,"aria-multiline":`true`,...P,class:ue},t[18]=r,t[19]=P,t[20]=N,t[21]=F):F=t[21];let I;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(I=(e,t)=>t.key===`Escape`?wt.getState(e.state)?.active||Xe.getState(e.state)?.active?!1:oe.current===void 0?(e.dom.blur(),!0):(oe.current(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?(wt.getState(e.state)?.active||Xe.getState(e.state)?.active)&&se(e)?!1:(ae.current(),!0):!1,t[22]=I):I=t[22];let L;t[23]===F?L=t[24]:(L={attributes:F,handleKeyDown:I},t[23]=F,t[24]=L);let de;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(de=e=>{let{editor:t}=e;ne.current($(t)),A.current?.(t.getJSON()),ie.current?.(Ft(t).mentions),C(ct(lt(t),tt(t)))},t[25]=de):de=t[25];let fe;t[26]!==L||t[27]!==M||t[28]!==ce||t[29]!==le?(fe={extensions:M,content:ce,immediatelyRender:!0,editable:le,editorProps:L,onUpdate:de},t[26]=L,t[27]=M,t[28]=ce,t[29]=le,t[30]=fe):fe=t[30];let R=k(fe),pe,z;t[31]!==i||t[32]!==r||t[33]!==R||t[34]!==p?(pe=()=>{if(!R||R.isDestroyed)return;let e=R.extensionManager.extensions.find(Vt);e&&(e.options.placeholder=p??``);let t=R.editorView;t&&(t.dom.setAttribute(`aria-label`,r??``),i===void 0?t.dom.removeAttribute(`aria-describedby`):t.dom.setAttribute(`aria-describedby`,i),t.dispatch(R.state.tr.setMeta(`addToHistory`,!1)))},z=[R,p,r,i],t[31]=i,t[32]=r,t[33]=R,t[34]=p,t[35]=pe,t[36]=z):(pe=t[35],z=t[36]),(0,V.useEffect)(pe,z);let me,he;t[37]!==b||t[38]!==R?(me=()=>{if(!R||R.isDestroyed)return;let e=!b;R.isEditable!==e&&R.setEditable(e,!1);let t=R.editorView;t&&(b?t.dom.setAttribute(`aria-disabled`,`true`):t.dom.removeAttribute(`aria-disabled`))},he=[R,b],t[37]=b,t[38]=R,t[39]=me,t[40]=he):(me=t[39],he=t[40]),(0,V.useEffect)(me,he);let B,ve;t[41]!==R||t[42]!==_?(B=()=>{if(!(!R||R.isDestroyed)){if(nt(R,_??null)){let e=R.editorView;e&&e.dispatch(R.state.tr.setMeta(`addToHistory`,!1)),rt(R)}C(ct(lt(R),tt(R)))}},ve=[R,_],t[41]=R,t[42]=_,t[43]=B,t[44]=ve):(B=t[43],ve=t[44]),(0,V.useEffect)(B,ve);let ye,U;t[45]!==R||t[46]!==v?(ye=()=>{!R||R.isDestroyed||St(R,v??yt)},U=[R,v],t[45]=R,t[46]=v,t[47]=ye,t[48]=U):(ye=t[47],U=t[48]),(0,V.useEffect)(ye,U);let W;t[49]!==R||t[50]!==m?(W=()=>{R&&($(R)&&It(m)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),Ge()),ne.current($(R)),ie.current?.(Ft(R).mentions))},t[49]=R,t[50]=m,t[51]=W):W=t[51];let be;t[52]===R?be=t[53]:(be=[R],t[52]=R,t[53]=be),(0,V.useEffect)(W,be);let xe,G;t[54]===R?(xe=t[55],G=t[56]):(xe=()=>{let e=()=>{R&&(ne.current($(R)),A.current?.(R.getJSON()),ie.current?.(Ft(R).mentions),C(ct(lt(R),tt(R))))};return{focus:()=>R?.commands.focus(),refuseDrop:e=>{E.current+=1,T({text:e,id:E.current})},focusEnd:()=>R?.commands.focus(`end`),blur:()=>R?.commands.blur(),clear:()=>R?.commands.clearContent(!0),setText:t=>{R&&(R.commands.setContent(Lt(t)),e())},appendText:t=>{!R||t===``||($(R)?R.commands.setContent(Lt(t)):R.commands.insertContentAt(R.state.doc.content.size,[{type:`paragraph`,content:[]},...Lt(t)]),e())},getDoc:()=>R?R.getJSON():null,setDoc:t=>{R&&(R.commands.setContent(t),rt(R),e())},getContent:()=>R?Ft(R):{instruction:``,mentions:[],attachments:[]},openMentionPicker:()=>{R&&R.chain().focus().insertContent(`@`).run()},openSlashCommandPicker:()=>{!R||!$(R)||(tt(R)?.length??0)===0||R.chain().focus().insertContent(`/`).run()}}},G=[R],t[54]=R,t[55]=xe,t[56]=G),(0,V.useImperativeHandle)(n,xe,G);let K=y,q;t[57]!==x||t[58]!==K?(q=K.kind===`host`?{}:{onDragEnter:Bt,onDragOver:zt,onDrop:e=>{if(!ge(e))return;e.preventDefault(),e.stopPropagation();let t=_e(e.dataTransfer);if(t.length===0){O(x({id:`rNi1kZ`}));return}if(K.kind===`accept`){K.onFiles(t);return}O(K.reason??x({id:`SgAFuo`}))}},t[57]=x,t[58]=K,t[59]=q):q=t[59];let Se=q,J;t[60]!==f||t[61]!==Se||t[62]!==R?(J=(0,H.jsx)(re,{editor:R,className:f,...Se}),t[60]=f,t[61]=Se,t[62]=R,t[63]=J):J=t[63];let Y;t[64]!==K.kind||t[65]!==w?(Y=K.kind===`host`?null:(0,H.jsx)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":`composer-drop-refusal`,children:w===null?null:(0,H.jsx)(`p`,{className:`px-2.5 py-1 text-muted-foreground text-xs`,children:w.text},w.id)}),t[64]=K.kind,t[65]=w,t[66]=Y):Y=t[66];let X;t[67]!==x||t[68]!==_||t[69]!==S?(X=_===void 0?null:(0,H.jsx)(`p`,{className:c(`truncate px-2.5 text-xs text-muted-foreground`,S?.kind===`unknown`&&`pb-1`),"aria-live":`polite`,"aria-atomic":`true`,"data-testid":`composer-slash-hint`,children:S?.kind===`unknown`?S.agentHasCommands?x({id:`mBK8zm`,values:{0:S.name}}):x({id:`Q9AxTM`}):null}),t[67]=x,t[68]=_,t[69]=S,t[70]=X):X=t[70];let Z;return t[71]!==J||t[72]!==Y||t[73]!==X?(Z=(0,H.jsxs)(H.Fragment,{children:[J,Y,X]}),t[71]=J,t[72]=Y,t[73]=X,t[74]=Z):Z=t[74],Z}function zt(e){ge(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}function Bt(e){ge(e)&&e.preventDefault()}function Vt(e){return e.name===`placeholder`}function Ht({multiple:e,onFiles:t}){let n=document.createElement(`input`);n.type=`file`,n.multiple=e,n.addEventListener(`change`,()=>{let e=Array.from(n.files??[]);e.length>0&&t(e)},{once:!0}),n.click()}var Ut=(0,V.createContext)(null);function Wt(e,t){let n=e.lastIndexOf(`.`);if(n>0&&n<e.length-1)return e.slice(n+1).toLowerCase();let r=t.lastIndexOf(`/`);return r>0&&r<t.length-1?t.slice(r+1).toLowerCase():`file`}function Gt(e){let t=(0,Q.c)(23),{testIdPrefix:n,images:r,uploads:i,onRemove:a}=e,{_:s}=o(),c=(0,V.use)(Ut),l=i.length>0,u=`${n}-pending-images`,d;if(t[0]!==s||t[1]!==r||t[2]!==a||t[3]!==c||t[4]!==n){let e;t[6]!==s||t[7]!==a||t[8]!==c||t[9]!==n?(e=(e,t)=>{let r=e.kind===`image`||e.kind===`blob`?`${t}:${e.name}:${e.data.slice(0,24)}`:`${t}:${e.name}:${e.path}`,i=e.kind===`image`?`data:${e.mimeType};base64,${e.data}`:null,o=e.kind===`file`||e.kind===`folder`?Wt(e.name,``):Wt(e.name,e.mimeType);return(0,H.jsxs)(`div`,{className:`group relative inline-flex size-14`,title:e.name,children:[i!==null&&c!==null?(0,H.jsx)(h,{type:`button`,variant:`ghost`,onClick:()=>c({src:i,name:e.name}),className:`size-full items-center justify-center overflow-hidden rounded-md border border-input bg-muted p-0 hover:bg-muted`,"aria-label":e.name,"data-testid":`${n}-pending-image-preview`,children:(0,H.jsx)(`img`,{src:i,alt:e.name,className:`h-full w-full object-cover`,draggable:!1})}):(0,H.jsx)(`div`,{className:`inline-flex size-full items-center justify-center overflow-hidden rounded-md border border-input bg-muted`,children:i===null?(0,H.jsx)(`span`,{className:`text-muted-foreground text-xs uppercase`,children:o}):(0,H.jsx)(`img`,{src:i,alt:e.name,className:`h-full w-full object-cover`,draggable:!1})}),(0,H.jsx)(h,{type:`button`,size:`icon`,variant:`secondary`,onClick:e=>{e.stopPropagation(),a(t)},"aria-label":s({id:`w61W3L`,values:{0:e.name}}),className:`absolute top-0.5 end-0.5 size-5 rounded-full border border-border bg-background/80 p-0 shadow-sm opacity-0 backdrop-blur-sm transition-opacity group-hover:opacity-100 focus-visible:opacity-100`,"data-testid":`${n}-pending-image-remove`,children:(0,H.jsx)(z,{className:`size-3`,"aria-hidden":`true`})})]},r)},t[6]=s,t[7]=a,t[8]=c,t[9]=n,t[10]=e):e=t[10],d=r.map(e),t[0]=s,t[1]=r,t[2]=a,t[3]=c,t[4]=n,t[5]=d}else d=t[5];let f;if(t[11]!==s||t[12]!==n||t[13]!==i){let e;t[15]!==s||t[16]!==n?(e=e=>{let t=e.name;return(0,H.jsx)(`div`,{role:`img`,"aria-label":s({id:`KDuPiY`,values:{fileName:t}}),className:`relative inline-flex size-14 items-center justify-center overflow-hidden rounded-md border border-input bg-muted`,title:e.name,"data-testid":`${n}-pending-upload`,children:(0,H.jsx)(de,{className:`size-4 text-muted-foreground`,"aria-hidden":`true`})},e.id)},t[15]=s,t[16]=n,t[17]=e):e=t[17],f=i.map(e),t[11]=s,t[12]=n,t[13]=i,t[14]=f}else f=t[14];let p;return t[18]!==l||t[19]!==u||t[20]!==d||t[21]!==f?(p=(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2 px-3 pt-2 pb-1`,"aria-busy":l,"data-testid":u,children:[d,f]}),t[18]=l,t[19]=u,t[20]=d,t[21]=f,t[22]=p):p=t[22],p}var Kt=`button, a[href], [role="menuitem"], [role="button"], input, textarea, select, [contenteditable="true"]`;function qt(e,t){if(!(e.target instanceof HTMLElement)||!(e.currentTarget instanceof HTMLElement)||!e.currentTarget.contains(e.target)||e.target.closest(Kt))return;e.preventDefault();let n=t.current;n!==null&&(n.focusEnd===void 0?n.focus():n.focusEnd())}var Jt=(0,V.createContext)(null);function Yt(){let e=(0,V.use)(Jt);if(e===null)throw Error(`Composer picker menu items must be rendered inside ComposerAddMenu`);return e}function Xt(e){let t=(0,Q.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,H.jsx)(p,{delayDuration:400,disableHoverableContent:!0,children:n}),t[0]=n,t[1]=r),r}function Zt(e){let t=(0,Q.c)(28),{children:n,composerRef:r,disabled:i,disabledFocusTargetRef:a,testId:s,size:c}=e,l=i===void 0?!1:i,u=c===void 0?`icon-sm`:c,{_:p}=o(),g;t[0]===p?g=t[1]:(g=p({id:`9D9gK1`}),t[0]=p,t[1]=g);let _=g,v=(0,V.useRef)(null),[y,b]=(0,V.useState)(!1),x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{v.current=e},t[2]=x):x=t[2];let S=!l&&y,C;t[3]===l?C=t[4]:(C=e=>{l||(e&&(v.current=null),b(e))},t[3]=l,t[4]=C);let w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,H.jsx)(pe,{className:`size-3.5`,"aria-hidden":`true`}),t[5]=w):w=t[5];let T;t[6]!==l||t[7]!==_||t[8]!==u||t[9]!==s?(T=(0,H.jsx)(d,{asChild:!0,children:(0,H.jsx)(ee,{asChild:!0,children:(0,H.jsx)(h,{type:`button`,size:u,variant:`ghost`,className:`rounded-lg`,disabled:l,"aria-label":_,"data-testid":s,children:w})})}),t[6]=l,t[7]=_,t[8]=u,t[9]=s,t[10]=T):T=t[10];let E;t[11]===_?E=t[12]:(E=(0,H.jsx)(f,{side:`top`,children:_}),t[11]=_,t[12]=E);let D;t[13]!==T||t[14]!==E?(D=(0,H.jsxs)(m,{children:[T,E]}),t[13]=T,t[14]=E,t[15]=D):D=t[15];let O;t[16]!==r||t[17]!==l||t[18]!==a?(O=e=>{if(l){e.preventDefault(),v.current=null,b(!1),a?.current?.focus();return}let t=v.current;t!==null&&(e.preventDefault(),v.current=null,r.current?.focus(),t())},t[16]=r,t[17]=l,t[18]=a,t[19]=O):O=t[19];let k;t[20]!==n||t[21]!==O?(k=(0,H.jsx)(te,{side:`top`,align:`start`,className:`min-w-52`,"data-composer-portal":``,onCloseAutoFocus:O,children:n}),t[20]=n,t[21]=O,t[22]=k):k=t[22];let A;return t[23]!==D||t[24]!==k||t[25]!==S||t[26]!==C?(A=(0,H.jsx)(Jt,{value:x,children:(0,H.jsxs)(ne,{open:S,onOpenChange:C,children:[D,k]})}),t[23]=D,t[24]=k,t[25]=S,t[26]=C,t[27]=A):A=t[27],A}function Qt(e){let t=(0,Q.c)(15),{onFiles:n,attachmentMode:r}=e,i=r===void 0?`embedded`:r,{_:a}=o(),s=Yt(),c;t[0]!==n||t[1]!==s?(c=()=>s(()=>Ht({multiple:!0,onFiles:n})),t[0]=n,t[1]=s,t[2]=c):c=t[2];let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,H.jsx)(R,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`}),t[3]=l):l=t[3];let u;t[4]===a?u=t[5]:(u=a({id:`N7m8E-`}),t[4]=a,t[5]=u);let d;t[6]!==a||t[7]!==i?(d=i===`reference`?a({id:`dkE4kf`}):null,t[6]=a,t[7]=i,t[8]=d):d=t[8];let f;t[9]!==u||t[10]!==d?(f=(0,H.jsxs)(`span`,{children:[u,d]}),t[9]=u,t[10]=d,t[11]=f):f=t[11];let p;return t[12]!==c||t[13]!==f?(p=(0,H.jsxs)(D,{onSelect:c,children:[l,f]}),t[12]=c,t[13]=f,t[14]=p):p=t[14],p}function $t(e){let t=(0,Q.c)(18),{count:n,onSelect:r}=e,{_:i}=o(),a=Yt(),s;t[0]!==i||t[1]!==n?(s=i({id:`jVe0gf`,values:{count:n}}),t[0]=i,t[1]=n,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==a?(c=()=>a(r),t[3]=r,t[4]=a,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,H.jsx)(fe,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`}),t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=i({id:`5hn4gs`}),t[7]=i,t[8]=u);let d;t[9]===u?d=t[10]:(d=(0,H.jsx)(`span`,{children:u}),t[9]=u,t[10]=d);let f;t[11]===n?f=t[12]:(f=(0,H.jsx)(me,{variant:`gray`,"aria-hidden":`true`,className:`ms-auto h-4 min-w-4 rounded-xs px-1 text-2xs leading-none tabular-nums`,children:n}),t[11]=n,t[12]=f);let p;return t[13]!==s||t[14]!==c||t[15]!==d||t[16]!==f?(p=(0,H.jsxs)(D,{"aria-label":s,onSelect:c,children:[l,d,f]}),t[13]=s,t[14]=c,t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function en(e){let t=(0,Q.c)(12),{onSelect:n}=e,{_:r}=o(),i=Yt(),a;t[0]!==n||t[1]!==i?(a=()=>i(n),t[0]=n,t[1]=i,t[2]=a):a=t[2];let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,H.jsx)(ke,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`}),t[3]=s):s=t[3];let c;t[4]===r?c=t[5]:(c=r({id:`Iw8I0n`}),t[4]=r,t[5]=c);let l;t[6]===c?l=t[7]:(l=(0,H.jsx)(`span`,{children:c}),t[6]=c,t[7]=l);let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,H.jsx)(O,{"aria-hidden":`true`,children:`@`}),t[8]=u):u=t[8];let d;return t[9]!==a||t[10]!==l?(d=(0,H.jsxs)(D,{onSelect:a,children:[s,l,u]}),t[9]=a,t[10]=l,t[11]=d):d=t[11],d}function tn(e){let t=(0,Q.c)(12),{onSelect:n}=e,{_:r}=o(),i=Yt(),a;t[0]!==n||t[1]!==i?(a=()=>i(n),t[0]=n,t[1]=i,t[2]=a):a=t[2];let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,H.jsx)(Me,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`}),t[3]=s):s=t[3];let c;t[4]===r?c=t[5]:(c=r({id:`45MZFs`}),t[4]=r,t[5]=c);let l;t[6]===c?l=t[7]:(l=(0,H.jsx)(`span`,{children:c}),t[6]=c,t[7]=l);let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,H.jsx)(O,{"aria-hidden":`true`,children:`/`}),t[8]=u):u=t[8];let d;return t[9]!==a||t[10]!==l?(d=(0,H.jsxs)(D,{onSelect:a,children:[s,l,u]}),t[9]=a,t[10]=l,t[11]=d):d=t[11],d}function nn(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function rn(e){let t=(0,Q.c)(21),{path:r,onRemove:i}=e,{_:a}=o(),s,c;t[0]!==a||t[1]!==r?(s=nn(r),c=a({id:`hnq8fP`,values:{label:s}}),t[0]=a,t[1]=r,t[2]=s,t[3]=c):(s=t[2],c=t[3]);let l=c,u=`composer-context-chip-file-${r}`,d;t[4]===i?d=t[5]:(d=e=>{(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),i())},t[4]=i,t[5]=d);let f;t[6]===r?f=t[7]:(f=(0,H.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,H.jsx)(n,{path:r,className:`size-3`,showExtensionBadge:!1})}),t[6]=r,t[7]=f);let p;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,H.jsx)(z,{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]=p):p=t[8];let m;t[9]!==i||t[10]!==l||t[11]!==d||t[12]!==f?(m=(0,H.jsxs)(h,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":l,onClick:i,onKeyDown:d,className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[f,p]}),t[9]=i,t[10]=l,t[11]=d,t[12]=f,t[13]=m):m=t[13];let g;t[14]===s?g=t[15]:(g=(0,H.jsx)(`span`,{className:`min-w-0 truncate`,children:s}),t[14]=s,t[15]=g);let _;return t[16]!==r||t[17]!==u||t[18]!==m||t[19]!==g?(_=(0,H.jsxs)(`span`,{"data-testid":u,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:[m,g]}),t[16]=r,t[17]=u,t[18]=m,t[19]=g,t[20]=_):_=t[20],_}function an(e){let t=(0,Q.c)(13),{files:n,onRemoveFile:r,className:i,children:a}=e,o;t[0]===n?o=t[1]:(o=n===void 0?[]:n,t[0]=n,t[1]=o);let s=o;if(s.length===0&&V.Children.toArray(a).length===0)return null;let l;t[2]===i?l=t[3]:(l=c(`flex flex-wrap items-center gap-1`,i),t[2]=i,t[3]=l);let u;if(t[4]!==s||t[5]!==r){let e;t[7]===r?e=t[8]:(e=e=>(0,H.jsx)(rn,{path:e,onRemove:()=>r?.(e)},e),t[7]=r,t[8]=e),u=s.map(e),t[4]=s,t[5]=r,t[6]=u}else u=t[6];let d;return t[9]!==a||t[10]!==l||t[11]!==u?(d=(0,H.jsxs)(`div`,{className:l,"data-testid":`composer-context-chips`,children:[u,a]}),t[9]=a,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}var on=5200;function sn(e,t){let n=(0,Q.c)(9),[r,i]=(0,V.useState)(0),[a,o]=(0,V.useState)(!0),[s,c]=(0,V.useState)(e.length);s!==e.length&&(c(e.length),i(0),o(!0));let l,u;if(n[0]!==t||n[1]!==a?(l=()=>{if(!t)return;if(a){let e=setTimeout(()=>o(!1),on);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(cn),o(!0)},500);return()=>clearTimeout(e)},u=[a,t],n[0]=t,n[1]=a,n[2]=l,n[3]=u):(l=n[2],u=n[3]),(0,V.useEffect)(l,u),!t){let t=e[0]??``,r;return n[4]===t?r=n[5]:(r={text:t,visible:!0},n[4]=t,n[5]=r),r}let d=e[e.length>0?r%e.length:0]??``,f;return n[6]!==d||n[7]!==a?(f={text:d,visible:a},n[6]=d,n[7]=a,n[8]=f):f=n[8],f}function cn(e){return e+1}function ln(e){let t=(0,Q.c)(9),{phrases:n,rotating:r,className:i,testId:a}=e,{text:o,visible:s}=sn(n,r);if(o===``)return null;let l=s?`opacity-100`:`opacity-0`,u;t[0]!==i||t[1]!==l?(u=c(`pointer-events-none absolute inset-0 text-base leading-[1.5] text-muted-foreground/60 transition-opacity duration-500 ease-in-out md:text-sm`,l,i),t[0]=i,t[1]=l,t[2]=u):u=t[2];let d;t[3]===o?d=t[4]:(d=(0,H.jsx)(`span`,{"data-rotating-placeholder":o,className:`block min-w-0 truncate before:content-[attr(data-rotating-placeholder)]`}),t[3]=o,t[4]=d);let f;return t[5]!==u||t[6]!==d||t[7]!==a?(f=(0,H.jsx)(`div`,{"aria-hidden":!0,"data-testid":a,className:u,children:d}),t[5]=u,t[6]=d,t[7]=a,t[8]=f):f=t[8],f}var un=`ok-acp-follow-file-v1`;function dn(){try{return localStorage.getItem(un)!==`0`}catch{return!0}}function fn(e){try{localStorage.setItem(un,e?`1`:`0`)}catch{}}function pn(e){return e===``||e.startsWith(`/`)||e.startsWith(`\\`)||e.split(`/`).some(e=>e===``||e.startsWith(`.`))?null:e}function mn(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:pn(o.slice(0,-s[0].length))}var hn=new Set(ve);function gn(e,t,n){let r=ye(e);if(r===null)return null;let{tool:i,args:a}=r;if(i===`delete`||i===null&&/\bdelete\b/i.test(t))return null;let o=typeof a.document==`object`&&a.document!==null?a.document:null,s=null;if(Array.isArray(a.documents))for(let e=a.documents.length-1;e>=0;e--){let t=a.documents[e];if(typeof t==`object`&&t){s=t;break}}let c=(o===null?null:B(o,`path`))??(s===null?null:B(s,`path`))??B(a,`to`);if(c!==null)return pn(c.replace(/\.(md|mdx)$/,``));let l=B(a,`docName`);return l===null||!(i!==null&&hn.has(i))&&!(n===`edit`||n===`move`)?null:pn(l.replace(/\.(md|mdx)$/,``))}function _n(e,t){if(e.toolKind===`delete`)return null;let n=gn(e.rawInput,e.title,e.toolKind);if(n!==null)return n;if(t===null||e.toolKind!==`edit`&&e.toolKind!==`move`)return null;for(let n=e.locations.length-1;n>=0;n--){let r=e.locations[n];if(r===void 0)continue;let i=mn(r.path,t);if(i!==null)return i}return null}var vn={lastFollowed:null,yielded:!1,reArmed:!1};function yn(e,t,n){if(e===null||n.lastFollowed===e)return{navigateTo:null,state:n};if(n.lastFollowed!==null&&t!==null&&t!==n.lastFollowed&&t!==e&&!n.reArmed)return{navigateTo:null,state:{...n,yielded:!0}};if(n.yielded&&!n.reArmed)return{navigateTo:null,state:n};let r={lastFollowed:e,yielded:!1,reArmed:!1};return t===e?{navigateTo:null,state:r}:{navigateTo:e,state:r}}function bn(e,t){let n=null;for(let r of e){if(r.kind!==`tool_call`)continue;let e=_n(r,t);e!==null&&(n=e)}return n}var xn=new Set([`(connected)`,`(agent thread)`]);function Sn(e){return e!=null&&xn.has(e)}function Cn(e){let t=(0,Q.c)(16),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,value:o,max:i,indeterminateFillPercent:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=typeof i==`number`&&i>0?i:100,l=typeof o==`number`&&o>=0&&o<=s?o/s*100:r??0,u=Math.min(100,Math.max(0,l)),d;t[6]===n?d=t[7]:(d=c(`relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted`,n),t[6]=n,t[7]=d);let f=`translateX(-${100-u}%)`,p;t[8]===f?p=t[9]:(p=(0,H.jsx)(Oe,{"data-slot":`progress-indicator`,className:`size-full flex-1 bg-primary transition-all motion-reduce:transition-none`,style:{transform:f}}),t[8]=f,t[9]=p);let m;return t[10]!==i||t[11]!==a||t[12]!==d||t[13]!==p||t[14]!==o?(m=(0,H.jsx)(De,{"data-slot":`progress`,value:o,max:i,className:d,...a,children:p}),t[10]=i,t[11]=a,t[12]=d,t[13]=p,t[14]=o,t[15]=m):m=t[15],m}export{Ke as C,je as D,We as E,Ae as O,Rt as S,Ue as T,Xt as _,mn as a,Gt as b,pn as c,an as d,Zt as f,en as g,Qt as h,yn as i,fn as l,$t as m,Sn as n,bn as o,tn as p,vn as r,dn as s,Cn as t,ln as u,qt as v,Ge as w,Ht as x,Ut as y};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Di as n,Fr as r,Kn as i,Xn as a,Z as o,en as s,i as c,kn as l,kr as u,pr as d,tn as f,tr as p,wi as m}from"./DocumentContext-Db80U3dt.js";import{t as h}from"./react-f2sANaYj.js";import{n as g,r as _}from"./dist-Nvb76hAm.js";import{r as v,t as y}from"./useQuery-ZeEDLtxh.js";import{t as b}from"./compiler-runtime-BfE3aGVn.js";import{t as x}from"./utils-CPqDy6Hr.js";import{i as S,n as C,t as w}from"./tooltip-DBqLYfio.js";import{n as T,r as E,t as D}from"./collapsible-BKbszYZV.js";import{n as O,t as k}from"./toggle-group-B7p69Qfd.js";import{t as A}from"./button-DzgjsZzC.js";import{y as ee}from"./constants-upload-CVKO8P4d.js";import{n as j}from"./dist-BGzUo_18.js";import{t as M}from"./dist-C_FzPxEX2.js";import{d as N}from"./constants-cc1-Bt4QPTUe.js";import{f as te,v as P}from"./documents-events-ddyuXdQl.js";import{n as F}from"./_envelope-q8XHEv4O-C-Qnl5Tu.js";import{C as I,gt as L,pt as R}from"./schemas-api-CzJwuc5a.js";import{t as z}from"./note-window-mode-CI3Yju9B.js";import{t as B}from"./createLucideIcon-DdBzwsHe.js";import{t as V}from"./chevron-right-Bofu4lib.js";import{n as ne,t as re}from"./lint-plugin-meta-CtDE2R0v.js";import{t as H}from"./circle-alert-eBm4JPxY.js";import{Gn as U,S as W,Un as G,fr as K,ft as q,lr as J,lt as Y,rn as ie,sr as X,tt as ae}from"./CodeMirrorPropInput-DzNQgYlQ.js";import{t as oe}from"./info-CyR0W2SK.js";import{t as se}from"./refresh-cw-CC7UZEnZ.js";import{t as ce}from"./sparkles-BS2TX_Um.js";import{t as le}from"./triangle-alert-BXrUEeRU.js";import{t as ue}from"./wrench-DqFwoSdV.js";import{t as de}from"./badge-DmdA1C7r.js";import{c as fe}from"./use-settings-route-Bj-m9X61.js";import{l as pe,s as me}from"./doc-hash-BJkweiX9.js";import{t as he}from"./diagnostic-breadcrumb-DPgUDxA8.js";import{n as ge,t as _e}from"./perf-CPPbaRwr.js";import{A as ve}from"./navigation-targets-CcY2FHJZ.js";import{T as ye,x as be}from"./config-provider-C3qfGKpJ.js";import{J as xe,K as Se,Mt as Ce,Nt as we,X as Te,wt as Ee}from"./dist-D2SphF3p.js";import{n as De,r as Oe}from"./PageListContext-DhMqc0Dx.js";import{a as ke,c as Ae,i as je,n as Me,r as Ne,s as Pe,t as Fe}from"./panel-D58OeY-f.js";import{d as Ie,h as Le,u as Re,y as ze}from"./markdown-lint-CBp7xF-c.js";import{t as Be}from"./skeleton-C73NNmDC.js";import{a as Ve,c as He,d as Ue}from"./lint-config-client-BuUP6NLf.js";var We=B(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Ge=56,Ke=2,qe=150,Je=2e3;function Ye(e,t,n){return e.top+e.height/2-(n+t)/2}function Xe(e,t){let n=Math.max(0,t.scrollHeight-t.clientHeight);return Math.max(0,Math.min(e,n))}function Ze(e){let{docName:t,container:n,measureTarget:r,placement:o,intent:s,grade:c,landedMode:l,transition:u,onOutcome:d,onDiscardQueuedTarget:f,toolbarOffset:m=Ge,driftThresholdPx:h=Ke,quietMs:g=qe,abandonAfterMs:_=Je}=e,v=e.contentColumn??n.firstElementChild,y=i(t,`landing`),b=a(t,{yieldsToNavigation:s===`toggle`,supersede:()=>N(`superseded`)}),x=n.style.overflowAnchor;n.style.overflowAnchor=`none`,u&&ge(`ok/mode-switch/transition`,{from:u.from,to:u.to,grade:c});let S=!1,C=null,w,T,E=0,D,O=()=>{let e=r();return e===null?null:Xe(o===`center`?Ye(e,n.clientHeight,m):e.top-m,n)},k=()=>{let e=O();if(e===null)return{measurable:!1,moved:!1};C=e;let t=Math.abs(n.scrollTop-e)>h;return t&&(n.scrollTop=e),{measurable:!0,moved:t}},A=()=>n.scrollTop-(O()??C??n.scrollTop),ee=()=>{w&&clearTimeout(w),T&&clearTimeout(T),E&&cancelAnimationFrame(E),D?.disconnect(),n.removeEventListener(`wheel`,P),n.removeEventListener(`touchstart`,P),n.removeEventListener(`contentvisibilityautostatechange`,F,!0),n.style.overflowAnchor=x,y.release(),b.release()},j=()=>{if(S)return;S=!0;let e;try{k(),e=A(),C!==null&&p({docName:t,container:n,targetScrollTop:n.scrollTop,mode:l})}finally{ee()}ge(`ok/landing/land`,{grade:c,delta:e}),d?.({status:`landed`,delta:e})},M=()=>{if(S)return;S=!0;let e=C??n.scrollTop,t;try{t=A()}finally{ee()}ge(`ok/landing/abandoned`,{grade:c,target:e,delta:t}),d?.({status:`abandoned`,delta:t})},N=e=>{S||(S=!0,ee(),e===`mode-flip`&&f?.(),d?.({status:`cancelled`,reason:e}))},te=()=>{w&&clearTimeout(w),w=setTimeout(j,g)};function P(){N(`user-scroll`)}function F(){if(S)return;let{measurable:e,moved:t}=k();e&&(t||w===void 0)&&te()}try{k().measurable&&te(),n.addEventListener(`contentvisibilityautostatechange`,F,!0),n.addEventListener(`wheel`,P,{passive:!0}),n.addEventListener(`touchstart`,P,{passive:!0}),typeof ResizeObserver<`u`&&v&&(D=new ResizeObserver(F),D.observe(v)),E=requestAnimationFrame(F),T=setTimeout(M,_)}catch(e){throw S=!0,ee(),e}return{cancel:N}}function Qe(e){switch(e){case`bulletList`:case`orderedList`:case`taskList`:case`list`:return`list`;case`codeBlock`:case`code`:return`code`;case`horizontalRule`:case`thematicBreak`:return`thematicBreak`;case`jsxComponent`:case`mdxJsxFlowElement`:case`mdxJsxTextElement`:return`jsx`;case`htmlBlock`:case`html`:return`html`;default:return e}}function $e(e){return typeof e!=`object`||!e?``:`value`in e&&typeof e.value==`string`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map($e).join(``):``}function et(e,t){let{frontmatter:n,body:r}=L(e),i=n===``?0:n.split(`
|
|
2
|
-
`).length-1;try{return{blocks:t.parseToEditorMdast(r).children.map(e=>({start:(e.position?.start.line??1/0)+i,end:(e.position?.end.line??-1/0)+i,kind:Qe(e.type),text:$e(e)})),fmLineCount:i}}catch{return performance.mark(`ok/block-spans/parse-failed`),{blocks:[],fmLineCount:i}}}function tt(e,t){let{blocks:n,fmLineCount:r}=et(e,t);return{spans:n.map(e=>({start:e.start,end:e.end})),fmLineCount:r}}function nt(e,t){if(e.length===0)return null;let n=0,r=e.length-1,i=e.length-1;for(;n<=r;){let a=n+r>>1,o=e[a];o!==void 0&&o.end>=t?(i=a,r=a-1):n=a+1}return i}function rt(e){let t=0;for(let n=e.childCount-1;n>=0;n--){let r=e.child(n);if(r.type.name!==`paragraph`||r.content.size!==0)break;t++}return t===e.childCount?0:e.childCount}function it(e,t,n){let r=e.childCount,i=Math.max(0,Math.min(t,r)),a=Math.max(i,Math.min(n,r));if(a<=i)return null;let o=0;for(let t=0;t<i;t++)o+=e.child(t).nodeSize;let s=o;for(let t=i;t<a;t++)o+=e.child(t).nodeSize;let c=o,l=e.content.size,u=Math.max(0,Math.min(s,l)),d=Math.max(u,Math.min(c,l));return d<=u?null:{from:u,to:d}}function at(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
|
|
3
|
-
`&&t.push(n+1);return t}function ot(e,t,n){return t<=1?0:t-1>=e.length?n:e[t-1]??n}function st(e,t){let n=0,r=e.length-1,i=1;for(;n<=r;){let a=n+r>>1;(e[a]??0)<=t?(i=a+1,n=a+1):r=a-1}return i}function ct(e,t,n){return Math.max(t,Math.min(e,n))}function lt(e,t){let n=e=>e.replace(/\s+/g,` `).trim();return n(e)===n(t)}function ut(e,t){return t.inRange?t.tripwireOk?lt(e.content,t.text)?`exact`:e.kind===t.kind?`same-type-ordinal`:`ordinal`:`ordinal`:`clamped`}function dt(e){let t=null,n=null;function r(r){return n!==null&&t===r?n:(n={blocks:et(r,e).blocks,lineStarts:at(r)},t=r,n)}return{captureFromWysiwyg(e,t,n){if(e.childCount===0)return null;let r=ct(t,0,e.content.size),i=0,a=e.childCount-1,o=0;for(let t=0;t<e.childCount;t++){let n=e.child(t).nodeSize;if(r<i+n){a=t,o=i+1;break}i+=n,o=i+1}let s=e.child(a),c={blockIndex:a,kind:Qe(s.type.name),content:s.textContent};return n?.refine&&(c.selectionInBlock=Math.max(0,r-o)),c},captureFromSource(e,t,n){let{blocks:i,lineStarts:a}=r(e);if(i.length===0)return null;let o=ct(t,0,e.length),s=nt(i,st(a,o));if(s===null)return null;let c=i[s];if(!c)return null;let l={blockIndex:s,kind:c.kind,content:c.text};if(n?.refine){let t=ot(a,c.start,e.length);l.selectionInBlock=Math.max(0,o-t)}return l},resolveInSource(e,{source:t,doc:n}){let{blocks:i,lineStarts:a}=r(t);if(i.length===0)return null;let o=e.blockIndex>=0&&e.blockIndex<i.length,s=rt(n)===i.length,c=i[ct(e.blockIndex,0,i.length-1)],l=ot(a,c.start,t.length),u=Math.min(ot(a,c.end+1,t.length),t.length),d=ut(e,{inRange:o,tripwireOk:s,kind:c.kind,text:c.text}),f=l;return d===`exact`&&e.selectionInBlock!==void 0&&(f=ct(l+e.selectionInBlock,l,u)),{blockStart:l,blockEnd:u,point:f,confidence:d}},resolveInWysiwyg(e,{source:t,doc:n}){let i=rt(n);if(i===0)return null;let{blocks:a}=r(t),o=e.blockIndex>=0&&e.blockIndex<i,s=i===a.length,c=ct(e.blockIndex,0,i-1),l=it(n,c,c+1);if(l===null)return null;let u=n.child(c),d=ut(e,{inRange:o,tripwireOk:s,kind:Qe(u.type.name),text:u.textContent});return{blockStart:l.from,blockEnd:l.to,point:l.from,confidence:d}}}}var ft=Ce.define(),pt=Ce.define(),mt=Se.mark({class:s}),ht=we.define({create(){return Se.none},update(e,t){let n=e.map(t.changes);for(let e of t.effects)e.is(ft)?n=Se.set([mt.range(e.value.from,e.value.to)]):e.is(pt)&&(n=Se.none);return n},provide:e=>xe.decorations.from(e)}),gt=new WeakMap,_t=Te.define(e=>({destroy(){let t=gt.get(e);t!==void 0&&(clearTimeout(t),gt.delete(e))}}));function vt(e,t,n,r){let i=f(e.state.doc.length,t,n,r);if(!i)return;e.dispatch({effects:ft.of(i)});let a=gt.get(e);a!==void 0&&clearTimeout(a);let o=setTimeout(()=>{gt.delete(e),e.dispatch({effects:pt.of(null)})},Y);gt.set(e,o)}function yt(){return[ht,_t]}var bt=3e4;function xt(){let e=new Map,t=e=>e?Date.now()-e.rememberedAt>bt?null:e.navigation:null;return{remember(t,n){e.set(t,{navigation:n,rememberedAt:Date.now()})},peek(n){return t(e.get(n))},consume(n){let r=e.get(n);return e.delete(n),t(r)},clear(t){e.delete(t)},clearForTest(){e.clear()}}}var St=xt(),Ct=xt(),wt=St.remember,Tt=St.peek,Et=St.consume,Dt=St.clear;St.clearForTest;var Ot=Ct.remember,kt=Ct.peek,At=Ct.consume,jt=Ct.clear;Ct.clearForTest;function Mt(e,t,n){return{start:ye(e,t),end:ye(e,n)}}function Nt(e,t){let n=be(e.start,t),r=be(e.end,t);return n===null||r===null||r.index<=n.index?null:n.index}var Pt=`open-knowledge:view-in-source`,Ft=null;function It(){return Ft??=dt(ae()),Ft}function Lt(e,t,n,r,i=`toggle`){let a=r.captureFromWysiwyg(e,t,{refine:i===`jump`});if(!a)return null;let o=r.resolveInSource(a,{source:n.toString(),doc:e});return{kind:`selection-offset`,intent:i,anchor:a,pin:o?Mt(n,o.blockStart,o.blockEnd):void 0}}function Rt(e){let{editor:t,docName:n,ytext:r}=e,i=X(t);if(!i)return;let a=i.state.selection.from,o=Lt(i.state.doc,a,r,It(),`jump`);o&&wt(n,o),window.dispatchEvent(new CustomEvent(Pt,{detail:{docName:n}}))}function zt(e,t,n,r,i){let a=r.captureFromSource(e,t);if(!a)return null;let o=i?r.resolveInSource(a,{source:e,doc:i}):null;return{kind:`selection-offset`,anchor:a,pin:o?Mt(n,o.blockStart,o.blockEnd):void 0}}function Bt(e,t){let{source:n,pmDoc:r,ydoc:i,resolver:a}=t;if(e.pin){let t=Nt(e.pin,i);if(t===null){let t=a.resolveInWysiwyg(e.anchor,{source:n,doc:r});return t?{...t,point:t.blockStart,confidence:`clamped`}:null}let o=a.captureFromSource(n,t);if(o)return a.resolveInWysiwyg(o,{source:n,doc:r})}return a.resolveInWysiwyg(e.anchor,{source:n,doc:r})}function Vt(e,t){let{source:n,pmDoc:r,ydoc:i,resolver:a}=t;if(e.pin){let t=Nt(e.pin,i);if(t===null){let t=a.resolveInSource(e.anchor,{source:n,doc:r});return t?{...t,point:t.blockStart,confidence:`clamped`}:null}let o=a.captureFromSource(n,t);if(o)return a.resolveInSource(o,{source:n,doc:r})}return a.resolveInSource(e.anchor,{source:n,doc:r})}function Ht(e,t){try{return e.coordsAtPos(t)}catch{return null}}function Ut(e,t,n){let r=Math.max(0,Math.min(n,e.state.doc.length)),i=t.getBoundingClientRect().top,a=Ht(e,r);if(a)return{top:a.top-i+t.scrollTop,height:a.bottom-a.top};try{let n=e.lineBlockAt(r);return{top:e.documentTop-i+t.scrollTop+n.top,height:n.height}}catch{return null}}function Wt(e,t){if(e.isDestroyed)return null;try{let n=e.nodeDOM(t);if(n instanceof HTMLElement)return n;let{node:r}=e.domAtPos(t);return r instanceof HTMLElement?r:r.parentElement}catch{return null}}function Gt(e,t,n){if(e.isDestroyed)return null;let r=Wt(e,Math.max(0,Math.min(n,e.state.doc.content.size)));if(!r)return null;let i=r.getBoundingClientRect(),a=t.getBoundingClientRect().top;return{top:i.top-a+t.scrollTop,height:i.height}}function Kt(){return typeof document>`u`?null:l()}function qt(e,t){let n=t.getBoundingClientRect(),r=n.left+n.width/2,i=W();for(let t of[i+1,i+12,i+40]){let i=e.posAtCoords({left:r,top:n.top+t});if(i)return i.pos}return null}function Jt(e,t){let n=t.getBoundingClientRect(),r=n.left+n.width/2,i=W();for(let t of[i+1,i+12,i+40]){let i=e.posAtCoords({x:r,y:n.top+t});if(i!==null)return i}return null}function Yt(e){let{from:t,to:n,docName:r,ytext:i}=e;t===`wysiwyg`&&n===`source`?Xt(r,i):t===`source`&&n===`wysiwyg`&&Zt(r,i)}function Xt(e,t){let n=Tt(e);if(n&&n.kind!==`selection-offset`)return;let r=d(e);if(!r)return;let i=X(r);if(!i)return;let a=Kt();if(!a)return;let o=qt(i,a);if(o===null)return;let s=Lt(i.state.doc,o,t,It());s&&wt(e,s)}function Zt(e,t){let n=G(e);if(!n)return;let r=Kt();if(!r)return;let i=Jt(n,r);if(i===null)return;let a=d(e),o=a?X(a)?.state.doc:void 0,s=zt(t.toString(),i,t,It(),o);s&&Ot(e,s)}function Qt(e){let{view:t,docName:n,navigation:r,ydoc:i,transition:o}=e,s=d(n),c=s?X(s)?.state.doc:void 0;if(!c)return null;let l=Vt(r,{source:t.state.doc.toString(),pmDoc:c,ydoc:i,resolver:It()});if(!l)return null;let u=Kt();if(!u)return null;let f=l,p=r.intent===`jump`,m=p?f.point:f.blockStart;t.dispatch({effects:xe.scrollIntoView(m,{y:`start`})});let h=!1,g=null,_=a(n,{yieldsToNavigation:!p,supersede:()=>{h=!0,_.release()}}),v=e=>{if(!h){if(Ht(t,m)===null&&e<8){requestAnimationFrame(()=>v(e+1));return}try{p&&(t.dispatch({selection:Ee.cursor(m)}),t.focus())}finally{_.release()}g=Ze({docName:n,container:u,contentColumn:t.contentDOM,measureTarget:()=>Ut(t,u,m),placement:p?`center`:`top`,intent:p?`jump`:`toggle`,grade:f.confidence,landedMode:`source`,transition:o,toolbarOffset:W(),onOutcome:p?e=>{e.status===`landed`&&vt(t,f.blockStart,f.blockEnd,f.confidence)}:void 0,onDiscardQueuedTarget:()=>Dt(n)})}};return v(0),{cancel:e=>{h=!0,_.release(),g?.cancel(e)}}}function $t(e){let{editor:t,docName:n,navigation:r,ydoc:i,transition:a}=e,o=X(t);if(!o)return null;let s=Bt(r,{source:i.getText(`source`).toString(),pmDoc:o.state.doc,ydoc:i,resolver:It()});if(!s)return null;let c=Kt();if(!c)return null;let l=s;return Ze({docName:n,container:c,contentColumn:o.dom,measureTarget:()=>Gt(o,c,l.point),placement:`top`,intent:`toggle`,grade:l.confidence,landedMode:`wysiwyg`,transition:a,toolbarOffset:W(),onDiscardQueuedTarget:()=>jt(n)})}var en={words:0,chars:0,tokens:0},tn=/[ -〿-ゟ゠-ヿ㐀-䶿一-鿿豈---ក-]/,nn=/[\p{L}\p{N}]/u,rn=new Set([`text`,`inlineCode`,`code`,`tag`]),an=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),on=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function sn(e,t){if(!e)return;let n=e.type;if(!an.has(n)){if(rn.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
|
|
4
|
-
`));return}if(n===`wikiLink`||n===`wikiLinkEmbed`){let n=e.data?.alias??e.value??``;n&&t.push(n);return}if(Array.isArray(e.children)){for(let n of e.children)sn(n,t);if(on.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`
|
|
5
|
-
`)&&t.push(`
|
|
6
|
-
`)}}}}function cn(e){try{let t=ae().parseToMdast(e),n=[];return sn(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function ln(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))nn.test(n)&&t++;return t}function un(e){let t=globalThis.Intl.Segmenter;if(!t)return ln(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function dn(e){let t=tn.test(e)?1.5:4;return Math.ceil(e.length/t)}function fn(e){return e?{words:tn.test(e)?un(e):ln(e),chars:e.length,tokens:dn(e)}:{words:0,chars:0,tokens:0}}function pn(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=L(e);return t.trim()?fn(cn(t)):{words:0,chars:0,tokens:0}}function mn(e){return fn(e)}function hn(e,{isMarkdown:t}){let n=e.trim();return n?fn(t?cn(e):n):en}function gn(e,t){return e!==null&&ee(e)?`source`:t}var _n=new Map,vn=new Set,yn=(e,t)=>`${t}:${e}`;function bn(){for(let e of vn)e()}function xn(e,t,n){let r=yn(e,t);if(n===null){_n.delete(r)&&bn();return}let i=_n.get(r);i&&i.words===n.words&&i.chars===n.chars&&i.tokens===n.tokens||(_n.set(r,n),bn())}function Sn(e,t){return e===null?null:_n.get(yn(e,t))??null}function Cn(e){return vn.add(e),()=>{vn.delete(e)}}function wn(e){let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
|
|
7
|
-
`,` `);return i.trim()?hn(i,{isMarkdown:!1}):null}function Tn(e){let t=[];for(let n of e.state.selection.ranges)n.empty||t.push(e.state.sliceDoc(n.from,n.to));if(t.length===0)return null;let n=t.join(`
|
|
8
|
-
`);return n.trim()?hn(n,{isMarkdown:!0}):null}var Z=e(h(),1),Q=b(),$=t();function En(e){let t=(0,Q.c)(14),{scope:n,onScopeChange:r,projectLabel:i}=e,{_:a}=_(),o;t[0]===r?o=t[1]:(o=e=>{e&&r(e)},t[0]=r,t[1]=o);let s;t[2]===a?s=t[3]:(s=a({id:`aBgwis`}),t[2]=a,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(O,{value:`doc`,className:`flex-1`,"data-testid":`panel-scope-doc`,children:(0,$.jsx)(g,{id:`UpCz01`})}),t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=i??(0,$.jsx)(g,{id:`ZWyHmq`}),t[5]=i,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,$.jsx)(O,{value:`project`,className:`flex-1`,"data-testid":`panel-scope-project`,children:l}),t[7]=l,t[8]=u);let d;return t[9]!==n||t[10]!==o||t[11]!==s||t[12]!==u?(d=(0,$.jsx)(`div`,{className:`shrink-0 px-4 pb-2`,children:(0,$.jsxs)(k,{type:`single`,variant:`segmented`,size:`sm`,spacing:1,value:n,onValueChange:o,"aria-label":s,className:`w-full rounded-md bg-muted p-0.5 dark:bg-background`,children:[c,u]})}),t[9]=n,t[10]=o,t[11]=s,t[12]=u,t[13]=d):d=t[13],d}function Dn(e){let t=e.localTarget;if(e.source!==`links`||t===void 0)return e.message;let n=t.resolvedTarget??t.href;return t.reason===`unresolvable`?t.role===`image`?M._({id:`W5qdI_`,values:{shown:n}}):M._({id:`bpMVIA`,values:{shown:n}}):t.reason===`excluded`?t.role===`image`?M._({id:`qAC6UE`,values:{shown:n}}):M._({id:`gssxm9`,values:{shown:n}}):t.targetKind===`file`?t.role===`image`?M._({id:`iSWh95`,values:{shown:n}}):M._({id:`fOzzSV`,values:{shown:n}}):M._({id:`XBBZnv`,values:{shown:n}})}var On=`audit-superseded`;async function kn(e={kind:`project`},t){return jn(e,Ie,!1,t)}async function An(e={kind:`project`},t){return jn(e,Re,!0,t)}async function jn(e,t,n,r){try{let i=new URLSearchParams;e.kind===`path`?i.set(`path`,e.path):e.kind===`doc`&&i.set(`doc`,e.docName),n&&i.set(`counts`,`1`);let a=i.size===0?``:`?${i}`,o=await fetch(`/api/audit${a}`,r===void 0?void 0:{signal:r});if(!o.ok)return o.status===409?On:(console.warn(`[audit] request failed`,o.status,o.statusText),null);let s;try{s=await o.json()}catch{return r?.aborted===!0||console.warn(`[audit] response body is not valid JSON`),null}let c=t.safeParse(s);return c.success?c.data:(console.warn(`[audit] response failed schema validation`,c.error.issues),null)}catch(e){return r?.aborted===!0||console.warn(`[audit] fetch threw`,e),null}}function Mn(e,t){let n=!1,r=!1,i=!1,a=[],o,s=null,c=()=>({findings:a,...o===void 0?{}:{brokenLinkSuppression:o}}),l=()=>{if(r){i=!0;return}r=!0,s=new AbortController,t({status:`loading`,...c()}),kn({kind:`doc`,docName:e},s.signal).then(e=>{if(!(n||s?.signal.aborted===!0)){if(e===null){t({status:`failed`,...c()});return}if(e===`audit-superseded`){i=!0;return}i||(a=e.files.flatMap(e=>e.diagnostics).filter(e=>e.source===`links`),o=e.brokenLinkSuppression,t({status:`loaded`,...c()}))}}).finally(()=>{n||(r=!1,s=null,i&&(i=!1,l()))})};l();let u=P(e=>{(e.includes(`backlinks`)||te(e))&&l()}),d=He(l);return()=>{n=!0,s?.abort(),u(),d()}}function Nn(e){let t=(0,Q.c)(6),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={docName:null,state:{status:`idle`,findings:[]}},t[0]=n):n=t[0];let[r,i]=(0,Z.useState)(n),a,o;if(t[1]===e?(a=t[2],o=t[3]):(a=()=>{if(e===null){i({docName:null,state:{status:`idle`,findings:[]}});return}return i({docName:e,state:{status:`loading`,findings:[]}}),Mn(e,t=>i({docName:e,state:t}))},o=[e],t[1]=e,t[2]=a,t[3]=o),(0,Z.useEffect)(a,o),r.docName!==e){let n;return t[4]===e?n=t[5]:(n=e===null?{status:`idle`,findings:[]}:{status:`loading`,findings:[]},t[4]=e,t[5]=n),n}return r.state}function Pn(e){return Math.min(50,Math.max(1,Math.ceil(e/10)))}function Fn(e,t){return e===t||e%Pn(t)===0}var In=[250,500,1e3,2e3,4e3];function Ln(e){return e.status===503&&e.problemType===`urn:ok:error:too-many-agent-sessions`}async function Rn(e,t){let n=await t.fixItem(e);for(let r of In){if(n.ok||!Ln(n)||!t.shouldContinue()||(console.debug(`[sweep] capacity refusal, backing off %dms`,r),await t.sleep(r),!t.shouldContinue()))break;n=await t.fixItem(e)}return n}async function zn(e){let t=e.items.length,n=[];for(let[r,i]of e.items.entries()){if(r>0&&(await e.sleep(15),!e.shouldContinue()))return{failures:n,cancelled:!0};let a=await Rn(i,e);if(a.ok||n.push({item:i,detail:a.errorDetail}),!e.shouldContinue())return{failures:n,cancelled:!0};let o=r+1;Fn(o,t)&&e.onProgress(o,t)}return{failures:n,cancelled:!1}}function Bn(e){return new Promise(t=>setTimeout(t,e))}var Vn=null,Hn=!1,Un=new Set,Wn=new Set;function Gn(e){Vn=e;for(let e of Un)e()}function Kn(e){return Un.add(e),()=>{Un.delete(e)}}function qn(){return Vn}function Jn(){return(0,Z.useSyncExternalStore)(Kn,qn,qn)}function Yn(e){return Wn.add(e),()=>{Wn.delete(e)}}function Xn(){Hn=!0}function Zn(e,t,n){if(e.length>0&&(console.warn(`[lint] fix-all: ${e.length} of ${n} files failed`,e.map(e=>({file:e.item.file,detail:e.detail}))),!t)){let t=e[0];j.error(M._({id:`se-tU0`,values:{0:e.length,total:n}}),{description:t===void 0?void 0:`${t.item.file}${t.detail===null?``:` — ${t.detail}`}`})}if(t){j.info(M._({id:`H1TmTu`}));return}e.length===0&&j.success(M._({id:`SWX1O7`,values:{total:n}}))}async function Qn({items:e,fixItem:t,sleep:n=Bn}){if(Vn!==null||e.length===0)return;let r=e.length;Hn=!1,Gn({done:0,total:r});let i=[],a=!1,o=!1;try{let o=await zn({items:e,fixItem:t,sleep:n,onProgress:e=>Gn({done:e,total:r}),shouldContinue:()=>!Hn});i=o.failures,a=o.cancelled}catch(e){console.warn(`[lint] fix-all: sweep threw`,e),o=!0}finally{Gn(null)}try{o?j.error(M._({id:`vwV-kH`})):Zn(i,a,r)}finally{for(let e of Wn)e()}}var $n={errorCount:0,warningCount:0},er=new Map,tr=new Set,nr=new Map;function rr(){let e=new Map;for(let[t,n]of er){let r=n.lint.errorCount+n.links.errorCount,i=n.lint.warningCount+n.links.warningCount;r===0&&i===0||e.set(t,{errorCount:r,warningCount:i})}nr=e;for(let e of tr)e()}var ir=Le;function ar(e){return tr.add(e),()=>{tr.delete(e)}}function or(){return nr}function sr(e){er.clear();for(let t of e)er.set(me(t.file),ir(t.diagnostics));rr()}function cr(e){er.clear();for(let t of e)er.set(me(t.file),{lint:t.lint,links:t.links});rr()}function lr(e,t){er.set(e,ir(t)),rr()}function ur(e,t,n){let r=er.get(e)??{lint:$n,links:$n},i=r[t];i.errorCount===n.errorCount&&i.warningCount===n.warningCount||(er.set(e,{...r,[t]:n}),rr())}var dr=`open-knowledge:lint-nav`;function fr(e,t){return e.range.start.line-t.range.start.line||e.range.start.character-t.range.start.character}function pr(e,t){return{docName:e,line:t.range.start.line+1,column:t.range.start.character+1,source:t.source,...t.frontmatterScope===void 0?{}:{frontmatterScope:t.frontmatterScope}}}function mr(e){if(e.source!==`links`)return null;let t=e.localTarget;return t===void 0?`document`:t.role===`image`?`image`:t.targetKind===`file`?`file`:t.targetKind===`document`?`document`:`unresolvable`}var hr={document:u,file:r,image:J,unresolvable:u};function gr(e){return e.linkTarget!==void 0&&mr(e)===`document`}function _r(e){let t=(0,Q.c)(40),{diagnostic:n,instanceCount:r}=e,{_:i}=_(),a=n.severity===`error`?H:le,o=n.range.start.line+1,s;t[0]===n?s=t[1]:(s=mr(n),t[0]=n,t[1]=s);let c=s,l=c===null?null:hr[c],u=r!==void 0&&r>1,d=n.severity===`error`?`text-destructive`:`text-amber-500`,f;t[2]===d?f=t[3]:(f=x(`mt-0.5 size-3.5 shrink-0`,d),t[2]=d,t[3]=f);let p;t[4]!==a||t[5]!==f?(p=(0,$.jsx)(a,{"aria-hidden":`true`,className:f}),t[4]=a,t[5]=f,t[6]=p):p=t[6];let m;t[7]===n?m=t[8]:(m=Dn(n),t[7]=n,t[8]=m);let h;t[9]===m?h=t[10]:(h=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 text-foreground`,children:m}),t[9]=m,t[10]=h);let v;t[11]!==u||t[12]!==r?(v=u?(0,$.jsxs)(`span`,{className:`mt-0.5 flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(de,{variant:`gray`,"data-testid":`problems-instance-count`,className:`h-4 px-1 font-sans text-[10px] leading-none`,children:(0,$.jsx)(g,{id:`iZCZmF`,values:{instanceCount:r}})}),(0,$.jsx)(V,{"aria-hidden":`true`,className:`size-3 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`})]}):null,t[11]=u,t[12]=r,t[13]=v):v=t[13];let y;t[14]!==p||t[15]!==h||t[16]!==v?(y=(0,$.jsxs)(`span`,{className:`flex items-start gap-1.5 text-sm`,children:[p,h,v]}),t[14]=p,t[15]=h,t[16]=v,t[17]=y):y=t[17];let b=c??void 0,S=l!==null&&`gap-0.5`,C;t[18]===S?C=t[19]:(C=x(`h-4 shrink-0 px-1 font-sans text-[10px] uppercase leading-none`,S),t[18]=S,t[19]=C);let w;t[20]===l?w=t[21]:(w=l===null?null:(0,$.jsx)(l,{"aria-hidden":`true`,className:`size-2.5`}),t[20]=l,t[21]=w);let T;t[22]!==n.source||t[23]!==C||t[24]!==w||t[25]!==b?(T=(0,$.jsxs)(de,{variant:`gray`,"data-testid":`problems-source-tag`,"data-target-kind":b,className:C,children:[w,n.source]}),t[22]=n.source,t[23]=C,t[24]=w,t[25]=b,t[26]=T):T=t[26];let E;t[27]!==i||t[28]!==n.code||t[29]!==o||t[30]!==u?(E=u?n.code:`${n.code} · ${i({id:`enPTnx`,values:{displayLine:o}})}`,t[27]=i,t[28]=n.code,t[29]=o,t[30]=u,t[31]=E):E=t[31];let D;t[32]===E?D=t[33]:(D=(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:E}),t[32]=E,t[33]=D);let O;t[34]!==T||t[35]!==D?(O=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 ps-5 font-mono text-xs text-muted-foreground`,children:[T,D]}),t[34]=T,t[35]=D,t[36]=O):O=t[36];let k;return t[37]!==O||t[38]!==y?(k=(0,$.jsxs)($.Fragment,{children:[y,O]}),t[37]=O,t[38]=y,t[39]=k):k=t[39],k}function vr(e){let t=new Map;for(let n of e){let e=`${n.source}/${n.code}\u0000${n.linkTarget??``}\u0000${n.message}`,r=t.get(e);r===void 0?t.set(e,{key:e,instances:[n]}):r.instances.push(n)}return[...t.values()]}function yr(e){let t=(0,Q.c)(63),{group:n,onNavigate:r,navTitle:i,renderActions:a}=e,{_:o}=_(),s=n.instances[0],c,l,u,d,f,p,m,h;if(t[0]!==o||t[1]!==s||t[2]!==n.instances.length||t[3]!==i||t[4]!==r||t[5]!==a){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Dn(s);if(n.instances.length===1){let e;t[14]!==s||t[15]!==a?(e=a(s),t[14]=s,t[15]=a,t[16]=e):e=t[16];let n=e,o;t[17]!==s||t[18]!==r?(o=()=>r(s),t[17]=s,t[18]=r,t[19]=o):o=t[19];let c;t[20]!==s||t[21]!==i?(c=i(s),t[20]=s,t[21]=i,t[22]=c):c=t[22];let l;t[23]===s?l=t[24]:(l=(0,$.jsx)(_r,{diagnostic:s}),t[23]=s,t[24]=l);let u;t[25]!==l||t[26]!==o||t[27]!==c?(u=(0,$.jsx)(`button`,{type:`button`,onClick:o,className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left`,title:c,children:l}),t[25]=l,t[26]=o,t[27]=c,t[28]=u):u=t[28];let d;t[29]===n?d=t[30]:(d=n===null?null:(0,$.jsx)(`div`,{className:`absolute bottom-1 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:n}),t[29]=n,t[30]=d);let f;t[31]!==u||t[32]!==d?(f=(0,$.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[u,d]}),t[31]=u,t[32]=d,t[33]=f):f=t[33],h=f;break bb0}p=`rounded`,m=`problems-duplicate-group`,l=D,t[34]!==s||t[35]!==n.instances.length?(f=(0,$.jsx)(E,{className:`group flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:(0,$.jsx)(_r,{diagnostic:s,instanceCount:n.instances.length})}),t[34]=s,t[35]=n.instances.length,t[36]=f):f=t[36],c=T,d=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,u=o({id:`_Bix3-`,values:{localizedFirstMessage:e}})}t[0]=o,t[1]=s,t[2]=n.instances.length,t[3]=i,t[4]=r,t[5]=a,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g;if(t[37]!==o||t[38]!==n.instances||t[39]!==i||t[40]!==r||t[41]!==a){let e;t[43]!==o||t[44]!==i||t[45]!==r||t[46]!==a?(e=e=>{let t=a(e),n=e.range.start.line+1,s=Dn(e);return(0,$.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`flex w-full cursor-pointer rounded px-2 py-1 text-left font-mono text-xs text-muted-foreground`,title:i(e),"aria-label":o({id:`txUHO8`,values:{localizedMessage:s,displayLine:n}}),children:o({id:`enPTnx`,values:{displayLine:n}})}),t===null?null:(0,$.jsx)(`div`,{className:`absolute bottom-0.5 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:t})]},br(e))},t[43]=o,t[44]=i,t[45]=r,t[46]=a,t[47]=e):e=t[47],g=n.instances.map(e),t[37]=o,t[38]=n.instances,t[39]=i,t[40]=r,t[41]=a,t[42]=g}else g=t[42];let v;t[48]!==u||t[49]!==g?(v=(0,$.jsx)(`ul`,{"aria-label":u,className:`flex flex-col gap-0.5 pb-1 ps-5`,"data-testid":`problems-duplicate-instances`,children:g}),t[48]=u,t[49]=g,t[50]=v):v=t[50];let y;t[51]!==c||t[52]!==d||t[53]!==v?(y=(0,$.jsx)(c,{className:d,children:v}),t[51]=c,t[52]=d,t[53]=v,t[54]=y):y=t[54];let b;t[55]!==l||t[56]!==f||t[57]!==y?(b=(0,$.jsxs)(l,{children:[f,y]}),t[55]=l,t[56]=f,t[57]=y,t[58]=b):b=t[58];let x;return t[59]!==b||t[60]!==p||t[61]!==m?(x=(0,$.jsx)(`li`,{className:p,"data-testid":m,children:b}),t[59]=b,t[60]=p,t[61]=m,t[62]=x):x=t[62],x}function br(e){return`${e.source}/${e.code}-${e.range.start.line}-${e.range.start.character}-${e.message}`}function xr(e){return e.reduce((e,t)=>e+ +((t.fixes?.length??0)>0),0)}function Sr(e){let t=(0,Q.c)(11),{target:n,creating:r,disabled:i,onCreate:a}=e,{_:o}=_(),s;t[0]!==o||t[1]!==n?(s=o({id:`oWsZk8`,values:{target:n}}),t[0]=o,t[1]=n,t[2]=s):s=t[2];let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(K,{"aria-hidden":`true`,className:`size-3`}),t[3]=c):c=t[3];let l;t[4]===r?l=t[5]:(l=r?(0,$.jsx)(g,{id:`E9bKSA`}):(0,$.jsx)(g,{id:`XRuL0i`}),t[4]=r,t[5]=l);let u;return t[6]!==i||t[7]!==a||t[8]!==s||t[9]!==l?(u=(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:i,onClick:a,"aria-label":s,"data-testid":`problems-create-page`,children:[c,l]}),t[6]=i,t[7]=a,t[8]=s,t[9]=l,t[10]=u):u=t[10],u}function Cr(e){let t=(0,Q.c)(8),{tip:n,testId:r,children:i}=e,a;t[0]===i?a=t[1]:(a=(0,$.jsx)(S,{asChild:!0,children:(0,$.jsx)(`span`,{className:`inline-flex shrink-0`,children:i})}),t[0]=i,t[1]=a);let o;t[2]!==r||t[3]!==n?(o=(0,$.jsx)(C,{"data-testid":r,children:n}),t[2]=r,t[3]=n,t[4]=o):o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(w,{children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function wr(e){let t=(0,Q.c)(21),{count:n,problemCount:r,aiAvailable:i,disabled:a,onClick:o,children:s}=e,{_:c}=_(),l;t[0]!==i||t[1]!==n||t[2]!==r?(l=n>0?(0,$.jsx)(g,{id:`vjwsDi`,values:{count:n}}):r===0?(0,$.jsx)(g,{id:`gAhHu7`}):i?(0,$.jsx)(g,{id:`zA9zRL`}):(0,$.jsx)(g,{id:`X3MMeA`}),t[0]=i,t[1]=n,t[2]=r,t[3]=l):l=t[3];let u;t[4]!==c||t[5]!==s||t[6]!==n||t[7]!==r?(u=s===void 0?r===0?c({id:`4m-xuX`}):n===0?c({id:`SqIoy_`}):void 0:void 0,t[4]=c,t[5]=s,t[6]=n,t[7]=r,t[8]=u):u=t[8];let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(ue,{"aria-hidden":`true`,className:`size-3`}),t[9]=d):d=t[9];let f;t[10]!==s||t[11]!==n?(f=s??(0,$.jsx)(g,{id:`RZXTlY`,values:{count:n}}),t[10]=s,t[11]=n,t[12]=f):f=t[12];let p;t[13]!==a||t[14]!==o||t[15]!==u||t[16]!==f?(p=(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:a,onClick:o,"aria-label":u,"data-testid":`problems-auto-fix`,children:[d,f]}),t[13]=a,t[14]=o,t[15]=u,t[16]=f,t[17]=p):p=t[17];let m;return t[18]!==l||t[19]!==p?(m=(0,$.jsx)(Cr,{testId:`problems-auto-fix-tip`,tip:l,children:p}),t[18]=l,t[19]=p,t[20]=m):m=t[20],m}function Tr(e){let t=(0,Q.c)(12),{count:n,disabled:r,onClick:i}=e,a;t[0]===n?a=t[1]:(a=(0,$.jsx)(g,{id:`mgDKWS`,values:{count:n}}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(ce,{"aria-hidden":`true`,className:`size-3`}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,$.jsx)(g,{id:`gyHDWC`,values:{count:n}}),t[3]=n,t[4]=s);let c;t[5]!==r||t[6]!==i||t[7]!==s?(c=(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:r,onClick:i,"data-testid":`problems-fix-with-ai`,children:[o,s]}),t[5]=r,t[6]=i,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,$.jsx)(Cr,{testId:`problems-fix-with-ai-tip`,tip:a,children:c}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function Er(e){let t=(0,Q.c)(59),{docName:r,diagnostics:i,linkFindingsStatus:a,brokenLinkSuppression:s,onFix:c,onAutoFix:l,onAskAi:u,onFixWithAi:d}=e,f=a===void 0?`loaded`:a,{_:p}=_(),h=(0,Z.useRef)(null),v=(0,Z.useId)(),[y,b]=(0,Z.useState)(`doc`),x;t[0]===r?x=t[1]:(x=ee(r),t[0]=r,t[1]=x);let T=!x,{data:E}=Ue(),D=E===null?null:E.effective.enabled?re.filter(e=>E.effective.plugins[e.id].enabled):[],O=D!==null&&D.length===0,k=s!==void 0,M=(y===`project`||T)&&D!==null&&D.length>0,N;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(N={status:`idle`},t[2]=N):N=t[2];let[F,I]=(0,Z.useState)(N),L=Jn(),R=De(),[z,B]=(0,Z.useState)(null),V=(0,Z.useRef)(!0),ne,H;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(ne=()=>(V.current=!0,()=>{V.current=!1}),H=[],t[3]=ne,t[4]=H):(ne=t[3],H=t[4]),(0,Z.useEffect)(ne,H);let U=(0,Z.useRef)(Pr),W=(0,Z.useRef)(Nr),G;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(G={status:`idle`},t[5]=G):G=t[5];let K=(0,Z.useRef)(G),q;t[6]===F?q=t[7]:(q=()=>{F.status!==`loading`&&(K.current=F)},t[6]=F,t[7]=q),(0,Z.useEffect)(q);let J=(0,Z.useRef)(0),Y=[...i].sort(fr),ie=xr(Y),X;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(X=async function(){J.current+=1;let e=J.current,t=K.current;I({status:`loading`});let n=await kn();if(n===`audit-superseded`){J.current===e&&V.current&&I(t.status===`idle`?{status:`failed`}:t);return}n!==null&&sr(n.files),V.current&&I(n===null?{status:`failed`}:{status:`loaded`,result:n})},t[8]=X):X=t[8];let ae=X,oe;t[9]!==p||t[10]!==F.status||t[11]!==z||t[12]!==R?(oe=async function(e){let t=e.linkTarget;if(!(t===void 0||z!==null||R===null)){B(t);try{await o({initialDir:``,suggestedName:t},{addPage:R.addPage})}catch(e){let t=e;j.error(t instanceof Error?t.message:p({id:`tfi40B`})),V.current&&B(null);return}j.success(p({id:`EWCJFu`,values:{target:t}})),V.current&&B(null),V.current&&F.status===`loaded`&&await ae()}},t[9]=p,t[10]=F.status,t[11]=z,t[12]=R,t[13]=oe):oe=t[13];let se=oe,le=F.status===`loaded`?F.result.files.filter(jr):[],de=function(){Qn({items:le,fixItem:Ar})},he;t[14]===F.status?he=t[15]:(he=function(e){b(e),e===`project`&&F.status===`idle`&&ae()},t[14]=F.status,t[15]=he);let ge=he,_e;t[16]===F.status?_e=t[17]:(_e=()=>{U.current=()=>{F.status===`idle`||F.status===`failed`||ae()}},t[16]=F.status,t[17]=_e),(0,Z.useEffect)(_e);let ve,ye;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(ve=()=>He(()=>U.current()),ye=[],t[18]=ve,t[19]=ye):(ve=t[18],ye=t[19]),(0,Z.useEffect)(ve,ye);let be,xe;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>P(e=>{te(e)&&U.current()}),xe=[],t[20]=be,t[21]=xe):(be=t[20],xe=t[21]),(0,Z.useEffect)(be,xe);let Se;t[22]===ge?Se=t[23]:(Se=(e,t)=>{e===`problems`&&(m(`problems`),t.scope!==void 0&&ge(t.scope),t.focus===`panel`&&h.current?.focus({preventScroll:!0}))},t[22]=ge,t[23]=Se);let Ce=(0,Z.useEffectEvent)(Se),we;t[24]===Ce?we=t[25]:(we=()=>{let e=m(`problems`);return e!==null&&Ce(`problems`,e),n(Ce)},t[24]=Ce,t[25]=we);let Te;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Te=[],t[26]=Te):Te=t[26],(0,Z.useEffect)(we,Te);let Ee;t[27]===F.status?Ee=t[28]:(Ee=()=>{W.current=()=>{F.status===`idle`||F.status===`failed`||ae().catch(e=>{console.warn(`[lint] post-sweep re-audit failed`,e),V.current&&I({status:`failed`})})}},t[27]=F.status,t[28]=Ee),(0,Z.useEffect)(Ee);let Oe,Ie;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=()=>Yn(()=>W.current()),Ie=[],t[29]=Oe,t[30]=Ie):(Oe=t[29],Ie=t[30]),(0,Z.useEffect)(Oe,Ie);let Le;t[31]===r?Le=t[32]:(Le=function(e){let t=pr(r,e);wt(r,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(dr,{detail:t}))},t[31]=r,t[32]=Le);let Re=Le,ze;t[33]!==r||t[34]!==Re?(ze=function(e,t){let n=me(e);if(n===r){Re(t);return}wt(n,{kind:`lint`,detail:pr(n,t)}),window.location.hash=pe(n)},t[33]=r,t[34]=Re,t[35]=ze):ze=t[35];let Be=ze,Ve;t[36]!==p||t[37]!==se||t[38]!==z||t[39]!==u||t[40]!==c||t[41]!==R?(Ve=function(e){let t=c!==void 0&&(e.fixes?.length??0)>0,n=gr(e)&&R!==null;if(!t&&!n&&u===void 0)return null;let r=`${e.source}/${e.code}`;return(0,$.jsxs)($.Fragment,{children:[n?(0,$.jsx)(Sr,{target:e.linkTarget??``,creating:z===e.linkTarget,disabled:z!==null,onCreate:()=>void se(e)}):null,t?(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>c?.(e),"aria-label":p({id:`fZj9em`,values:{flatId:r}}),"data-testid":`problems-fix`,children:[(0,$.jsx)(ue,{"aria-hidden":`true`,className:`size-3`}),(0,$.jsx)(g,{id:`c4fVUV`})]}):null,u===void 0?null:(0,$.jsxs)(A,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>u(e),"aria-label":p({id:`hh4mVC`,values:{flatId:r}}),"data-testid":`problems-ask-ai`,children:[(0,$.jsx)(ce,{"aria-hidden":`true`,className:`size-3`}),(0,$.jsx)(g,{id:`xWEvuo`})]})]})},t[36]=p,t[37]=se,t[38]=z,t[39]=u,t[40]=c,t[41]=R,t[42]=Ve):Ve=t[42];let We=Ve,Ge=Fe,Ke;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,$.jsx)(g,{id:`OXdGnd`}),t[43]=Ke):Ke=t[43];let qe;t[44]===v?qe=t[45]:(qe=(0,$.jsx)(Ae,{id:v,children:Ke}),t[44]=v,t[45]=qe);let Je=y===`doc`&&Y.length>0&&(0,$.jsx)(Ne,{children:Y.length}),Ye=M&&(0,$.jsxs)(w,{children:[(0,$.jsx)(S,{className:`shrink-0 cursor-default rounded-md bg-muted-foreground/5 px-2 py-1 font-mono text-xs text-muted-foreground`,"data-testid":`problems-active-plugins`,children:(0,$.jsx)(g,{id:`yxF19Y`,values:{0:D.length}})}),(0,$.jsx)(C,{"data-testid":`problems-active-plugins-tooltip`,children:(0,$.jsx)(g,{id:`ws5o1F`,values:{0:D.map(kr).join(`, `)}})})]}),Xe;t[46]!==qe||t[47]!==Je||t[48]!==Ye?(Xe=(0,$.jsx)(Pe,{children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[qe,Je,Ye]})}),t[46]=qe,t[47]=Je,t[48]=Ye,t[49]=Xe):Xe=t[49];let Ze;t[50]!==ge||t[51]!==y?(Ze=(0,$.jsx)(En,{scope:y,onScopeChange:ge}),t[50]=ge,t[51]=y,t[52]=Ze):Ze=t[52];let Qe=y===`doc`?(0,$.jsxs)(Me,{className:`px-2 py-2`,children:[f===`idle`||f===`loading`?(0,$.jsx)(je,{className:`px-2 pb-2`,role:`status`,"aria-live":`polite`,"data-testid":`problems-links-loading`,children:(0,$.jsx)(g,{id:`W9NSe0`})}):f===`failed`?(0,$.jsx)(ke,{className:`px-2 pb-2`,role:`status`,"data-testid":`problems-links-failed`,children:Y.length>0||k?(0,$.jsx)(g,{id:`IoHQYP`}):(0,$.jsx)(g,{id:`gpbKxw`})}):null,k&&(0,$.jsx)(zr,{suppression:s}),Y.length===0?f===`loaded`?T?O?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(je,{className:`px-2`,"data-testid":`problems-no-plugins`,children:k?(0,$.jsx)(g,{id:`mI1KPS`}):(0,$.jsx)(g,{id:`Hngy37`})}),(0,$.jsx)(`div`,{className:`px-2 pt-2`,children:(0,$.jsx)(A,{variant:`outline`,size:`sm`,onClick:fe,"data-testid":`problems-enable-plugins`,children:(0,$.jsx)(g,{id:`rnX-1S`})})})]}):k?null:(0,$.jsx)(je,{className:`px-2`,children:(0,$.jsx)(g,{id:`ZI8uvA`})}):(0,$.jsx)(je,{className:`px-2`,"data-testid":`problems-markdown-not-applicable`,children:(0,$.jsx)(g,{id:`Kdvukk`})}):null:(0,$.jsxs)($.Fragment,{children:[l!==void 0||d!==void 0?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1 px-2 pb-1`,children:[l!==void 0&&(0,$.jsx)(wr,{count:ie,problemCount:Y.length,aiAvailable:d!==void 0,disabled:ie===0,onClick:l}),d!==void 0&&(0,$.jsx)(Tr,{count:Y.length,disabled:!1,onClick:()=>d(`doc`)})]}):null,(0,$.jsx)(`ul`,{"aria-label":p({id:`OXdGnd`}),className:`flex flex-col gap-0.5`,children:vr(Y).map(e=>(0,$.jsx)(yr,{group:e,onNavigate:Re,navTitle:e=>p({id:`vbMHjo`,values:{0:e.range.start.line+1}}),renderActions:We},e.key))})]})]}):(0,$.jsx)(Fr,{audit:F,onRefresh:()=>void ae(),onNavigate:Be,fixableCount:le.reduce(Or,0),problemCount:F.status===`loaded`?F.result.files.reduce(Dr,0):0,fixing:L,onAutoFix:de,onCancelFix:Xn,onFixWithAi:d===void 0||F.status!==`loaded`?void 0:()=>d(`project`),onCreateTarget:R===null?void 0:e=>void se(e),creatingTarget:z}),$e;return t[53]!==Ge||t[54]!==v||t[55]!==Xe||t[56]!==Ze||t[57]!==Qe?($e=(0,$.jsxs)(Ge,{ref:h,tabIndex:-1,"aria-labelledby":v,"data-testid":`problems-panel`,children:[Xe,Ze,Qe]}),t[53]=Ge,t[54]=v,t[55]=Xe,t[56]=Ze,t[57]=Qe,t[58]=$e):$e=t[58],$e}function Dr(e,t){return e+t.diagnostics.length}function Or(e,t){return e+xr(t.diagnostics)}function kr(e){return e.label}function Ar(e){return Ve(me(e.file))}function jr(e){return e.diagnostics.some(Mr)}function Mr(e){return(e.fixes?.length??0)>0}function Nr(){}function Pr(){}function Fr(e){let t=(0,Q.c)(81),{audit:n,onRefresh:r,onNavigate:i,fixableCount:a,problemCount:o,fixing:s,onAutoFix:c,onCancelFix:l,onFixWithAi:u,onCreateTarget:d,creatingTarget:f}=e,{_:p}=_(),m=n.status===`loading`||n.status===`idle`,h;t[0]!==n.result||t[1]!==n.status?(h=n.status===`loaded`?n.result.files:[],t[0]=n.result,t[1]=n.status,t[2]=h):h=t[2];let v=h,[y,b]=(0,Z.useState)(Rr),x;t[3]!==y||t[4]!==v?(x=v.length>0&&v.every(e=>y.has(e.file)),t[3]=y,t[4]=v,t[5]=x):x=t[5];let T=x,E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e,t){b(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},t[6]=E):E=t[6];let D=E,O;t[7]!==T||t[8]!==v?(O=function(){b(T?new Set:new Set(v.map(Lr)))},t[7]=T,t[8]=v,t[9]=O):O=t[9];let k=O,ee;t[10]!==n.result||t[11]!==n.status?(ee=n.status===`loaded`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{id:`DsDwR-`,values:{0:n.result.errorCount}}),` · `,(0,$.jsx)(g,{id:`W1SI2K`,values:{0:n.result.warningCount}})]}),t[10]=n.result,t[11]=n.status,t[12]=ee):ee=t[12];let j;t[13]===ee?j=t[14]:(j=(0,$.jsx)(`p`,{className:`min-w-0 truncate text-xs text-muted-foreground`,"data-testid":`problems-audit-summary`,children:ee}),t[13]=ee,t[14]=j);let M;t[15]!==p||t[16]!==T||t[17]!==v.length||t[18]!==k?(M=v.length>0?(0,$.jsxs)(w,{children:[(0,$.jsx)(S,{asChild:!0,children:(0,$.jsx)(A,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":p(T?{id:`I4LGsH`}:{id:`Ugvy4O`}),"data-testid":`problems-audit-expand-toggle`,onClick:k,children:T?(0,$.jsx)(We,{"aria-hidden":`true`,className:`size-3.5`}):(0,$.jsx)(ne,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,$.jsx)(C,{"data-testid":`problems-audit-expand-toggle-tooltip`,children:T?(0,$.jsx)(g,{id:`I4LGsH`}):(0,$.jsx)(g,{id:`Ugvy4O`})})]}):null,t[15]=p,t[16]=T,t[17]=v.length,t[18]=k,t[19]=M):M=t[19];let N;t[20]===p?N=t[21]:(N=p({id:`I7y_vn`}),t[20]=p,t[21]=N);let te=m||s!==null,P;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),t[22]=P):P=t[22];let F;t[23]!==r||t[24]!==N||t[25]!==te?(F=(0,$.jsx)(S,{asChild:!0,children:(0,$.jsx)(A,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":N,"data-testid":`problems-audit-refresh`,disabled:te,onClick:r,children:P})}),t[23]=r,t[24]=N,t[25]=te,t[26]=F):F=t[26];let I;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(C,{"data-testid":`problems-audit-refresh-tooltip`,children:(0,$.jsx)(g,{id:`I7y_vn`})}),t[27]=I):I=t[27];let L;t[28]===F?L=t[29]:(L=(0,$.jsxs)(w,{children:[F,I]}),t[28]=F,t[29]=L);let R;t[30]!==L||t[31]!==M?(R=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[M,L]}),t[30]=L,t[31]=M,t[32]=R):R=t[32];let z;t[33]!==R||t[34]!==j?(z=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[j,R]}),t[33]=R,t[34]=j,t[35]=z):z=t[35];let B;t[36]!==p||t[37]!==s?(B=s===null?null:(0,$.jsx)(`span`,{className:`sr-only`,role:`status`,children:p({id:`gZElfU`,values:{0:s.done,1:s.total}})}),t[36]=p,t[37]=s,t[38]=B):B=t[38];let V;t[39]!==p||t[40]!==s||t[41]!==l?(V=s===null?null:(0,$.jsxs)(w,{children:[(0,$.jsx)(S,{asChild:!0,children:(0,$.jsx)(A,{variant:`ghost`,size:`sm`,className:`h-6 shrink-0 px-2 text-muted-foreground`,"aria-label":p({id:`q2cLM6`}),"data-testid":`problems-cancel-fix`,onClick:l,children:(0,$.jsx)(g,{id:`ygCKqB`})})}),(0,$.jsx)(C,{"data-testid":`problems-cancel-fix-tooltip`,children:(0,$.jsx)(g,{id:`yvSAuM`})})]}),t[39]=p,t[40]=s,t[41]=l,t[42]=V):V=t[42];let re=u!==void 0,H=m||s!==null||a===0,U;t[43]===s?U=t[44]:(U=s===null?void 0:(0,$.jsx)(g,{id:`S9t1PI`,values:{0:s.done,1:s.total}}),t[43]=s,t[44]=U);let W;t[45]!==a||t[46]!==c||t[47]!==o||t[48]!==re||t[49]!==H||t[50]!==U?(W=(0,$.jsx)(wr,{count:a,problemCount:o,aiAvailable:re,disabled:H,onClick:c,children:U}),t[45]=a,t[46]=c,t[47]=o,t[48]=re,t[49]=H,t[50]=U,t[51]=W):W=t[51];let G;t[52]!==s||t[53]!==u||t[54]!==o?(G=u!==void 0&&o>0?(0,$.jsx)(Tr,{count:o,disabled:s!==null,onClick:u}):null,t[52]=s,t[53]=u,t[54]=o,t[55]=G):G=t[55];let K;t[56]!==B||t[57]!==V||t[58]!==W||t[59]!==G?(K=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1`,children:[B,V,W,G]}),t[56]=B,t[57]=V,t[58]=W,t[59]=G,t[60]=K):K=t[60];let q;t[61]!==z||t[62]!==K?(q=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1 px-2 pb-1`,children:[z,K]}),t[61]=z,t[62]=K,t[63]=q):q=t[63];let J;t[64]!==p||t[65]!==m?(J=m&&(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,role:`status`,"aria-busy":`true`,"aria-label":p({id:`dx-TwN`}),children:[1,2,3].map(Ir)}),t[64]=p,t[65]=m,t[66]=J):J=t[66];let Y;t[67]===n.status?Y=t[68]:(Y=n.status===`failed`&&(0,$.jsx)(ke,{className:`px-2 text-xs`,children:(0,$.jsx)(g,{id:`IFezUv`})}),t[67]=n.status,t[68]=Y);let ie;t[69]!==n.result||t[70]!==n.status||t[71]!==f||t[72]!==y||t[73]!==d||t[74]!==i?(ie=n.status===`loaded`&&(0,$.jsx)(Br,{result:n.result,onNavigate:i,onCreateTarget:d,creatingTarget:f,expandedFiles:y,onToggleFile:D}),t[69]=n.result,t[70]=n.status,t[71]=f,t[72]=y,t[73]=d,t[74]=i,t[75]=ie):ie=t[75];let X;return t[76]!==q||t[77]!==J||t[78]!==Y||t[79]!==ie?(X=(0,$.jsxs)(Me,{className:`px-2 py-2`,"data-testid":`problems-project-scope`,children:[q,J,Y,ie]}),t[76]=q,t[77]=J,t[78]=Y,t[79]=ie,t[80]=X):X=t[80],X}function Ir(e){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded px-2 py-1.5`,children:[(0,$.jsx)(Be,{className:`mt-0.5 size-3.5 shrink-0 rounded`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,$.jsx)(Be,{className:`h-3 w-28`}),(0,$.jsx)(Be,{className:`h-3 w-40`})]})]},e)}function Lr(e){return e.file}function Rr(){return new Set}function zr(e){let t=(0,Q.c)(6),{suppression:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(oe,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),t[0]=r):r=t[0];let i;t[1]===n.count?i=t[2]:(i=(0,$.jsx)(g,{id:`gi9c0-`,values:{0:n.count}}),t[1]=n.count,t[2]=i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(g,{id:`l91IVc`}),t[3]=a):a=t[3];let o;return t[4]===i?o=t[5]:(o=(0,$.jsxs)(`div`,{role:`note`,"aria-live":`polite`,"data-testid":`problems-broken-link-suppression`,className:`mx-2 mb-1 flex items-start gap-1.5 rounded-md border border-border/70 bg-muted/40 px-2 py-1.5 text-xs text-muted-foreground`,children:[r,(0,$.jsxs)(`span`,{className:`min-w-0`,children:[i,` `,a]})]}),t[4]=i,t[5]=o),o}function Br(e){let t=(0,Q.c)(24),{result:n,onNavigate:r,onCreateTarget:i,creatingTarget:a,expandedFiles:o,onToggleFile:s}=e,{_:c}=_(),l,u,d,f;if(t[0]!==c||t[1]!==n.warnings){let e=n.warnings.filter(Ur);l=n.warnings.filter(ze),u=`flex flex-col gap-1`,d=e.length>0&&(0,$.jsx)(`ul`,{"aria-label":c({id:`Rsdhj9`}),className:`flex flex-col gap-0.5 pb-1`,children:e.map(Hr)}),f=l.map(Vr),t[0]=c,t[1]=n.warnings,t[2]=l,t[3]=u,t[4]=d,t[5]=f}else l=t[2],u=t[3],d=t[4],f=t[5];let p;t[6]===n.brokenLinkSuppression?p=t[7]:(p=n.brokenLinkSuppression!==void 0&&(0,$.jsx)(zr,{suppression:n.brokenLinkSuppression}),t[6]=n.brokenLinkSuppression,t[7]=p);let m;t[8]!==a||t[9]!==l||t[10]!==o||t[11]!==i||t[12]!==r||t[13]!==s||t[14]!==n.brokenLinkSuppression||t[15]!==n.fileCount||t[16]!==n.files?(m=n.files.length===0?n.brokenLinkSuppression===void 0&&l.length===0?(0,$.jsx)(je,{className:`px-2`,children:(0,$.jsx)(g,{id:`k_Dqw1`,values:{0:n.fileCount}})}):null:n.files.map(e=>(0,$.jsx)(Wr,{file:e,onNavigate:r,onCreateTarget:i,creatingTarget:a,open:o.has(e.file),onOpenChange:t=>s(e.file,t)},e.file)),t[8]=a,t[9]=l,t[10]=o,t[11]=i,t[12]=r,t[13]=s,t[14]=n.brokenLinkSuppression,t[15]=n.fileCount,t[16]=n.files,t[17]=m):m=t[17];let h;return t[18]!==u||t[19]!==d||t[20]!==f||t[21]!==p||t[22]!==m?(h=(0,$.jsxs)(`div`,{className:u,children:[d,f,p,m]}),t[18]=u,t[19]=d,t[20]=f,t[21]=p,t[22]=m,t[23]=h):h=t[23],h}function Vr(e){return(0,$.jsxs)(`div`,{role:`status`,className:`flex items-start gap-1.5 px-2 text-xs`,children:[(0,$.jsx)(oe,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`min-w-0 text-foreground`,children:e})]},e)}function Hr(e,t){return(0,$.jsxs)(`li`,{className:`flex items-start gap-1.5 px-2 text-xs`,children:[(0,$.jsx)(le,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-500`}),(0,$.jsx)(`span`,{className:`min-w-0 text-foreground`,children:e})]},`${t}-${e}`)}function Ur(e){return!ze(e)}function Wr(e){let t=(0,Q.c)(45),{file:n,onNavigate:r,onCreateTarget:i,creatingTarget:a,open:o,onOpenChange:s}=e,{_:c}=_(),l,u,d,f,p,m,h,g,v,y;if(t[0]!==c||t[1]!==a||t[2]!==n.diagnostics||t[3]!==n.file||t[4]!==i||t[5]!==r||t[6]!==s||t[7]!==o){let e=[...n.diagnostics].sort(fr);u=D,h=o,g=s,v=`problems-audit-group`;let _;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(V,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`}),t[18]=_):_=t[18];let b;t[19]===n.file?b=t[20]:(b=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,title:n.file,children:n.file}),t[19]=n.file,t[20]=b),y=(0,$.jsxs)(E,{className:`group flex w-full cursor-pointer items-center gap-1.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:[_,b,(0,$.jsx)(de,{variant:`gray`,"data-testid":`problems-audit-file-count`,className:`shrink-0`,children:e.length})]}),l=T,m=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in] motion-reduce:animate-none`,t[21]!==c||t[22]!==n.file?(d=c({id:`zAJzIg`,values:{0:n.file}}),t[21]=c,t[22]=n.file,t[23]=d):d=t[23],f=`flex flex-col gap-0.5 pb-1 ps-3`;let x;t[24]!==c||t[25]!==a||t[26]!==n.file||t[27]!==i||t[28]!==r?(x=e=>(0,$.jsx)(yr,{group:e,onNavigate:e=>r(n.file,e),navTitle:e=>c({id:`xKDsGS`,values:{0:e.range.start.line+1,1:n.file}}),renderActions:e=>!gr(e)||i===void 0?null:(0,$.jsx)(Sr,{target:e.linkTarget??``,creating:a===e.linkTarget,disabled:a!==null,onCreate:()=>i(e)})},e.key),t[24]=c,t[25]=a,t[26]=n.file,t[27]=i,t[28]=r,t[29]=x):x=t[29],p=vr(e).map(x),t[0]=c,t[1]=a,t[2]=n.diagnostics,t[3]=n.file,t[4]=i,t[5]=r,t[6]=s,t[7]=o,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=v,t[17]=y}else l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13],h=t[14],g=t[15],v=t[16],y=t[17];let b;t[30]!==d||t[31]!==f||t[32]!==p?(b=(0,$.jsx)(`ul`,{"aria-label":d,className:f,children:p}),t[30]=d,t[31]=f,t[32]=p,t[33]=b):b=t[33];let x;t[34]!==l||t[35]!==m||t[36]!==b?(x=(0,$.jsx)(l,{className:m,children:b}),t[34]=l,t[35]=m,t[36]=b,t[37]=x):x=t[37];let S;return t[38]!==u||t[39]!==x||t[40]!==h||t[41]!==g||t[42]!==v||t[43]!==y?(S=(0,$.jsxs)(u,{open:h,onOpenChange:g,"data-testid":v,children:[y,x]}),t[38]=u,t[39]=x,t[40]=h,t[41]=g,t[42]=v,t[43]=y,t[44]=S):S=t[44],S}function Gr(e,t){return e.has(t)||N(t)}var Kr=/^(#{1,6})\s+(.+)$/;function qr(e,t){let n=(e.endsWith(`\r`)?e.slice(0,-1):e).match(Kr);if(!n)return null;let r=n[2].trim(),i=ve(r,t);return i?{level:n[1].length,text:r,slug:i}:null}var Jr=null,Yr=[];function Xr(e){if(e===Jr)return Yr;let t=Zr(e);return Jr=e,Yr=t,t}function Zr(e){let t=[],n=new Map,r=ie();for(let i=Qr(e);i<=e.lines;i++){let a=e.line(i);if(r(a.text))continue;let o=qr(a.text,n);o&&t.push({slug:o.slug,from:a.from})}return t}function Qr(e){if(!$r(e.line(1).text))return 1;for(let t=2;t<=e.lines;t++)if($r(e.line(t).text))return t+1;return 1}function $r(e){return R.test(e.endsWith(`\r`)?e.slice(0,-1):e)}function ei(e){let t=document.getElementById(e);return t?t.getBoundingClientRect().top:null}function ti(e){let t=new Map;for(let n of Xr(e.state.doc))t.set(n.slug,n.from);let n=e.documentTop;return r=>{let i=t.get(r);return i===void 0?null:n+e.lineBlockAt(i).top}}function ni(e,t){let n=(0,Q.c)(9),r;n[0]===t?r=n[1]:(r=t===void 0?{}:t,n[0]=t,n[1]=r);let{isSourceMode:i,docName:a}=r,o=i===void 0?!1:i,[s,c]=(0,Z.useState)(void 0),l=(0,Z.useRef)(null),u;n[2]===a?u=n[3]:(u=()=>a?G(a):null,n[2]=a,n[3]=u);let d=(0,Z.useSyncExternalStore)(U,u,ri),f,p;return n[4]!==o||n[5]!==e||n[6]!==d?(f=()=>{if(e.length===0||o&&!d){c(void 0);return}let t=function(){let t=o&&d?ti(d):ei,n=window.innerHeight/2,r,i;for(let a of e){let e=t(a);e!==null&&(e<0?r=a:i===void 0&&e<n&&(i=a))}c(i??r??e[0])},n=function(){l.current===null&&(l.current=requestAnimationFrame(()=>{l.current=null,t()}))};return document.addEventListener(`scroll`,n,{capture:!0,passive:!0}),t(),()=>{document.removeEventListener(`scroll`,n,{capture:!0}),l.current!==null&&(cancelAnimationFrame(l.current),l.current=null)}},p=[e,o,d],n[4]=o,n[5]=e,n[6]=d,n[7]=f,n[8]=p):(f=n[7],p=n[8]),(0,Z.useEffect)(f,p),s}function ri(){return null}var ii=300;async function ai(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new q(M._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=F.safeParse(n);throw e.success?Error(e.data.title):new q(M._({id:`zlErBl`}),{status:t.status})}let r=I.safeParse(n);if(!r.success)throw new q(M._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var oi=32,si=12,ci=6,li=`open-knowledge:outline-nav`,ui=`ok-outline-nav`,di=`ok-outline-nav-dispatch`,fi=`ok-outline-nav-settled`;function pi(e){let t=(0,Q.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(_e,{name:`outline-panel`,children:(0,$.jsx)(mi,{...e})}),t[0]=e,t[1]=n),n}function mi(e){let t=(0,Q.c)(67),{docName:n,isSourceMode:r,className:i}=e,a=i===void 0?``:i,{_:o}=_(),{pages:s,loading:l,error:u}=Oe(),d=v(),{activeProvider:f,activeDocName:p}=c(),m;t[0]!==n||t[1]!==s?(m=Gr(s,n),t[0]=n,t[1]=s,t[2]=m):m=t[2];let h=m,b;t[3]===d?b=t[4]:(b=d.getQueryCache(),t[3]=d,t[4]=b);let S=b,C;t[5]!==n||t[6]!==d?(C=()=>d.getQueryState([`page-headings`,n])!==void 0,t[5]=n,t[6]=d,t[7]=C):C=t[7];let w=(0,Z.useSyncExternalStore)(S.subscribe,C),T=!l&&u===null&&!h&&w,E,D;t[8]===n?(E=t[9],D=t[10]):(E=[`page-headings`,n],D=()=>ai(n),t[8]=n,t[9]=E,t[10]=D);let O=!l&&h,k;t[11]!==E||t[12]!==D||t[13]!==O?(k={queryKey:E,queryFn:D,enabled:O,staleTime:1/0},t[11]=E,t[12]=D,t[13]=O,t[14]=k):k=t[14];let{data:A,isLoading:ee,error:j}=y(k),M;t[15]===A?M=t[16]:(M=A===void 0?[]:A,t[15]=A,t[16]=M);let N=M,te,P;t[17]!==n||t[18]!==T||t[19]!==d?(te=()=>{T&&d.resetQueries({queryKey:[`page-headings`,n]})},P=[T,n,d],t[17]=n,t[18]=T,t[19]=d,t[20]=te,t[21]=P):(te=t[20],P=t[21]),(0,Z.useEffect)(te,P);let F,I;t[22]!==p||t[23]!==f||t[24]!==n||t[25]!==d?(F=()=>{if(!f||p!==n)return;let e=f.document,t=null,r=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,d.invalidateQueries({queryKey:[`page-headings`,n]})},ii)};return e.on(`update`,r),d.invalidateQueries({queryKey:[`page-headings`,n]}),()=>{e.off(`update`,r),t!==null&&clearTimeout(t)}},I=[f,p,n,d],t[22]=p,t[23]=f,t[24]=n,t[25]=d,t[26]=F,t[27]=I):(F=t[26],I=t[27]),(0,Z.useEffect)(F,I);let L=l||ee,R;t[28]===N?R=t[29]:(R=N.map(hi),t[28]=N,t[29]=R);let z=R,B;t[30]!==n||t[31]!==r?(B={isSourceMode:r,docName:n},t[30]=n,t[31]=r,t[32]=B):B=t[32];let V=ni(z,B),ne,re,H,U,W,G,K;if(t[33]!==o||t[34]!==V||t[35]!==a||t[36]!==n||t[37]!==j||t[38]!==N||t[39]!==L||t[40]!==r||t[41]!==T){let e=V?N.findIndex(e=>e.slug===V):-1,i=function(t,i){let a={docName:n,index:t,slug:i,mode:r?`source`:`wysiwyg`};a.mode===`source`&&wt(n,{kind:`outline`,detail:a}),he(di,{docName:n,index:t,mode:a.mode,outlineCount:N.length,headingLevel:N[t]?.level,activeIndex:e}),window.dispatchEvent(new CustomEvent(li,{detail:a}))},s=((e>=0?N[e].level:1)-1)*si+(si-ci)/2,c=e*oi+(oi-ci)/2;re=Fe,G=a;let l;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(Ae,{children:(0,$.jsx)(g,{id:`dD7NPy`})}),t[49]=l):l=t[49];let u;t[50]!==j||t[51]!==N.length||t[52]!==L||t[53]!==T?(u=!L&&!j&&!T&&(0,$.jsx)(Ne,{children:N.length}),t[50]=j,t[51]=N.length,t[52]=L,t[53]=T,t[54]=u):u=t[54],t[55]===u?K=t[56]:(K=(0,$.jsx)(Pe,{children:(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[l,u]})}),t[55]=u,t[56]=K),ne=Me,H=`px-3 py-2`,U=L,W=T?(0,$.jsx)(je,{className:`px-2`,role:`status`,children:(0,$.jsx)(g,{id:`0x9smA`})}):j?(0,$.jsx)(ke,{className:`px-2`,children:j instanceof Error?j.message:o({id:`GuqOb1`})}):N.length===0&&!L?(0,$.jsx)(je,{className:`px-2`,children:(0,$.jsx)(g,{id:`0BB9ID`})}):(0,$.jsxs)(`nav`,{"aria-label":o({id:`BymzO4`}),className:`relative`,children:[e>=0&&(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-0 top-0 rounded-full bg-primary motion-safe:[transition:transform_0.25s_var(--ease-out-strong)]`,style:{width:ci,height:ci,transform:`translate(${s}px, ${c}px)`}}),N.map((e,t)=>{let n=e.slug===V;return(0,$.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>i(t,e.slug),className:x(`w-full cursor-pointer truncate py-1.5 pe-2 text-left text-sm transition-colors`,n?`font-medium text-primary`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${(e.level-1)*si+20}px`},title:e.text,children:e.text},t)})]}),t[33]=o,t[34]=V,t[35]=a,t[36]=n,t[37]=j,t[38]=N,t[39]=L,t[40]=r,t[41]=T,t[42]=ne,t[43]=re,t[44]=H,t[45]=U,t[46]=W,t[47]=G,t[48]=K}else ne=t[42],re=t[43],H=t[44],U=t[45],W=t[46],G=t[47],K=t[48];let q;t[57]!==ne||t[58]!==H||t[59]!==U||t[60]!==W?(q=(0,$.jsx)(ne,{className:H,"aria-busy":U,children:W}),t[57]=ne,t[58]=H,t[59]=U,t[60]=W,t[61]=q):q=t[61];let J;return t[62]!==re||t[63]!==G||t[64]!==K||t[65]!==q?(J=(0,$.jsxs)(re,{className:G,children:[K,q]}),t[62]=re,t[63]=G,t[64]=K,t[65]=q,t[66]=J):J=t[66],J}function hi(e){return e.slug}var gi=!1;function _i(){return gi||!z()?!1:(gi=!0,!0)}export{mn as A,kt as B,Sn as C,Cn as D,wn as E,Pt as F,rt as G,yt as H,Dt as I,tt as K,Et as L,Rt as M,Qt as N,en as O,$t as P,At as R,gn as S,Tn as T,nt as U,wt as V,it as W,An as _,pi as a,Dn as b,dr as c,lr as d,ur as f,kn as g,On as h,fi as i,Yt as j,pn as k,Er as l,ar as m,ui as n,Xr as o,cr as p,li as r,Gr as s,_i as t,or as u,Mn as v,xn as w,En as x,Nn as y,Tt as z};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{Af as r,Ba as i,Df as a,Ff as o,Ju as s,Mf as c,Rc as l,Sf as u,Uc as d,if as f,jf as p,lf as m,md as h,of as g,sf as _,wf as v,xf as y}from"./md-manager-BGnqyqi1-BZjgceH4.mjs";import{Ao as ee,Go as b,Ln as te,Zn as x,cs as ne,fr as re,m as S,ns as C,ss as ie,ts as w,va as ae}from"./dist-jVEVXcLW.mjs";import{A as oe,E as se,F as ce,M as le,N as T,S as ue,T as de,Y as fe,Z as E,at as pe,b as me,et as he,f as ge,ft as _e,it as ve,j as ye,k as D,lt as be,nt as xe,ot as Se,p as Ce,rt as we,s as Te,ut as Ee,y as De,z as Oe}from"./init-kdH152Ks.mjs";import{t as ke}from"./is-object-BGze3w87.mjs";import{t as Ae}from"./removal-file-path-U4VI8Y6X.mjs";import{spawn as je}from"node:child_process";import{basename as Me,dirname as O,join as k,resolve as A,win32 as Ne}from"node:path";import{accessSync as Pe,constants as j,existsSync as M,lstatSync as N,mkdirSync as Fe,readFileSync as P,readdirSync as F,realpathSync as I,rmSync as Ie,rmdirSync as Le,statSync as L,unlinkSync as Re}from"node:fs";import{homedir as R}from"node:os";import{createHash as ze}from"node:crypto";import{isDeepStrictEqual as Be}from"node:util";import{setTimeout as Ve}from"node:timers/promises";var He=s();let Ue;function We(){return Ue}function Ge(e,t){if(t!==void 0&&t.length>0)return t;try{return re(e)?.rootPath}catch{return}}function Ke(e){let t=Ge(e.cwd,e.configuredProjectName),n=te({name:`cli`,project:t});return Ue=n,n.info({command:e.command,cwd:e.cwd,project:t},`cli command started`),n}function z(){return d(l)}function B(){return a().keyringService}function V(e){try{e()}catch{}}var qe=class{backend=`keyring`;onKeychainRead;constructor(e){this.onKeychainRead=e}async get(e){let{Entry:t}=await import(`@napi-rs/keyring`),n;try{n=new t(B(),e).getPassword()}catch(t){return V(()=>this.onKeychainRead?.({kind:`read-error`,host:e,error:t instanceof Error?t.name:`unknown`})),null}if(n==null)return V(()=>this.onKeychainRead?.({kind:`absent`,host:e})),null;try{return JSON.parse(n)}catch{return V(()=>this.onKeychainRead?.({kind:`corrupt-entry`,host:e,error:`corrupt-entry`})),null}}async set(e,t,n,r){let{Entry:i}=await import(`@napi-rs/keyring`),a=new i(B(),e),o={login:t,token:n,...r};a.setPassword(JSON.stringify(o))}async clear(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{new t(B(),e).deletePassword()}catch{}}},H=class{backend=`file`;authFile;constructor(e){this.authFile=e??k(C(),`auth.yml`)}read(){if(!M(this.authFile))return{};try{let e=P(this.authFile,`utf-8`);return(0,He.parse)(e)??{}}catch(e){let t=e instanceof Error?e.message:`unknown error`;return process.stderr.write(`[auth] Failed to parse ${this.authFile}: ${t}. Starting with empty credentials.\n`),{}}}write(e){let t=O(this.authFile);M(t)||Fe(t,{recursive:!0,mode:448}),w(this.authFile,(0,He.stringify)(e),{mode:384})}async get(e){return this.read()[e]??null}async set(e,t,n,r){let i=this.read();i[e]={login:t,token:n,...r},this.write(i)}async clear(e){let t=this.read();delete t[e],this.write(t)}},Je=class{backend=`keyring`;keychain;file;constructor(e,t){this.keychain=e,this.file=t}async get(e){let t=await this.keychain.get(e);if(t!=null)return t;let n=await this.file.get(e);if(n==null)return null;try{await this.keychain.set(e,n.login,n.token,{gitProtocol:n.gitProtocol,name:n.name,email:n.email}),await this.file.clear(e),process.stderr.write(`[auth] migrated ${e} credential from ${z()} to the OS keychain\n`)}catch{}return n}set(e,t,n,r){return this.keychain.set(e,t,n,r)}async clear(e){await this.keychain.clear(e),await this.file.get(e)!=null&&await this.file.clear(e)}};async function Ye(e,t){try{let{Entry:n}=await import(`@napi-rs/keyring`);return new n(B(),`__probe__`),process.stderr.write(`[auth] token storage: OS keychain
|
|
2
|
-
`),V(()=>t?.onBackendSelected?.({backend:`keyring`})),new Je(new qe(t?.onKeychainRead),new H(e))}catch(n){let r=n instanceof Error?`${n.name}: ${n.message}`:String(n);return process.stderr.write(`[auth] token storage: file (${z()}) — OS keychain unavailable: ${r}\n`),V(()=>t?.onBackendSelected?.({backend:`file`,reason:r})),new H(e)}}function Xe(e){let t=null;return function(){if(t)return t;let n=2e3;return t=(async()=>{let t=null,r=new Promise(r=>{t=setTimeout(()=>{process.stderr.write(`[auth] token storage: keyring init exceeded ${n}ms; falling back to file (${z()})\n`),r(new H(e))},n)});try{return await Promise.race([Ye(e),r])}catch{return new H(e)}finally{t!==null&&clearTimeout(t)}})(),t}}function Ze(e){let t=Xe(e);return{async get(e){let n=await(await t()).get(e);return n===null?null:{token:n.token,login:n.login}}}}function Qe(e){let t=Xe(e);return{backend:`file`,async get(e){return(await t()).get(e)},async set(e,n,r,i){return(await t()).set(e,n,r,i)},async clear(e){return(await t()).clear(e)}}}async function $e(e,t){let n=[],r=new H(t);await r.get(e)!=null&&(await r.clear(e),n.push(`file`));let i;try{let{Entry:t}=await import(`@napi-rs/keyring`);new t(B(),`__probe__`);let r,a=await new qe(e=>{e.kind===`read-error`&&(r=e.error??`read-error`)}).get(e);if(r!==void 0)i=r;else if(a!=null)try{new t(B(),e).deletePassword(),n.push(`keychain`)}catch(e){i=e instanceof Error?e.name:`delete-error`}}catch{}return{touched:n,keychainError:i}}function et(e){let t={...e};return delete t.ELECTRON_RUN_AS_NODE,t}function tt(e){let t=e?.code;return t===`ENOENT`||t===`EACCES`||t===`EPERM`?{ok:!1,reason:`not-installed`}:{ok:!1,reason:`spawn-error`}}function nt(e){return ee({detached:!0,stdio:`ignore`,shell:!1,env:et(e)})}function rt(e,t,n={}){let r=(n.spawn??je)(e,[...t],nt(n.env??process.env));return r.unref(),r}function it(e,t,n={}){let r=n.spawn??je,i=n.timeoutMs??2e3;return new Promise(a=>{let o=!1,s=e=>{o||(o=!0,a(e))},c=setTimeout(()=>s({ok:!1,reason:`timeout`}),i);try{let i=r(e,[...t],nt(n.env??process.env));i.once(`error`,e=>{clearTimeout(c),s(tt(e))}),i.once(`spawn`,()=>{clearTimeout(c),s({ok:!0})});try{i.unref()}catch{}}catch(e){clearTimeout(c),s(tt(e))}})}const at=y.stable.appId,U=v,ot=[`stable`,`beta`];function st(e,t,n=e=>console.error(e)){try{return o(e,t)}catch(i){let a=o({...e,[u]:void 0},t);return n(`Treating this CLI as ${r(a)} for this command: ${i instanceof Error?i.message:String(i)}`),a}}function W(e){return ot.includes(e)||!U.includes(e)?ot:[e,...ot]}function ct(e){return e.bundlePath===void 0?null:{bundlePath:e.bundlePath,protocolScheme:y[e.product].protocolScheme}}function lt(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return L(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function ut(e,t){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let n=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(n?.[1]){let e=n[1];return{path:e,product:U.find(t=>e.endsWith(`/${y[t].productName}.app`))??t}}}let n=e.homeDir??R();for(let r of W(t)){let{productName:t}=y[r];for(let i of[k(n,`Applications`),`/Applications`]){let n=k(i,`${t}.app`);if(dt(e,k(n,`Contents`,`MacOS`,t)))return{path:n,product:r}}}return null}function dt(e,t){try{let n=e.statSync(t);return n?typeof n.isFile==`function`&&n.isFile():!1}catch{return!1}}function ft(e,t){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=U.find(t=>e.execPath.toLowerCase().endsWith(`\\${p(y[t]).toLowerCase()}`));if(t)return{path:e.execPath,product:t}}let n=e.env.LOCALAPPDATA;if(n)for(let r of W(t))for(let t of c(y[r])){let i=Ne.join(n,`Programs`,t,p(y[r]));if(dt(e,i))return{path:i,product:r}}return null}function pt(e,t){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=U.find(t=>e.execPath.endsWith(`/${y[t].linuxExecutableName}`));if(t)return{path:e.execPath,product:t}}for(let n of W(t)){let{productName:t,linuxExecutableName:r}=y[n],i=`/opt/${t}/${r}`;if(dt(e,i))return{path:i,product:n}}return null}function mt(e){let t=st(e.env,e.execPath,e.warn);if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`,cliProduct:t};if(e.platform!==`darwin`&&e.platform!==`win32`&&e.platform!==`linux`)return{available:!1,reason:`unsupported-platform`,cliProduct:t};let n;try{n=e.platform===`darwin`?ut(e,t):e.platform===`win32`?ft(e,t):pt(e,t)}catch{return{available:!1,reason:`stat-error`,cliProduct:t}}if(!n)return{available:!1,reason:`no-bundle`,cliProduct:t};let r={bundlePath:n.path,product:n.product,cliProduct:t};return e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,...r}:!(e.isTTY===!0||e.platform===`win32`&&e.isTTY===void 0&&!e.env.CI)||e.env.SSH_CONNECTION||e.env.SSH_TTY||e.platform===`linux`&&!e.env.DISPLAY&&!e.env.WAYLAND_DISPLAY?{available:!1,reason:`headless`,...r}:{available:!0,reason:`available`,...r}}function ht(e,t){let n=e.log??(e=>console.error(e)),r=e.platform??process.platform;if(t.bundlePath===void 0){n(`Desktop launch skipped: no resolved desktop executable (caller bug).`);return}let{productName:i}=y[t.product],[a]=y[t.cliProduct].cliCommandNames;n(`Launching ${i} desktop (use \`${a} start\` for the browser server, or \`OK_FORCE_BROWSER=1\` to always skip)`);let o=t.bundlePath;if(r===`darwin`){rt(`open`,[`-a`,o],{spawn:e.spawn});return}rt(o,[],{spawn:e.spawn})}function gt(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found (checked the standard install locations for this OS). Install it from https://openknowledge.ai/download, or omit --mode for browser mode.`;case`darwin-only`:case`unsupported-platform`:return`Desktop app is not available on this platform. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect the desktop install (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available but launch dispatch did not fire (caller bug).`}}function G(e){return e.replace(/[\p{Cc}\p{Zl}\p{Zp}\p{Bidi_Control}\u200b\ufeff]/gu,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}function _t(e){return ze(`sha256`).update(e).digest(`hex`)}function K(e){return k(C(A(e)),`pi-trust`)}function vt(e,t){return k(K(e),_t(A(t)))}function yt(e,t,n){return k(vt(e,t),`${_t(n)}.json`)}var q=class extends Error{constructor(e,t,n,r){super(`Pi trust receipt at ${G(e)} ${G(t)}; ${G(n)}`,{cause:r}),this.name=`PiTrustReceiptError`}};function J(e,t,n){let r=n.code,i=n instanceof Error?n.message:String(n),a;switch(r){case`EACCES`:case`EPERM`:a=`check receipt and parent-directory permissions, then retry`;break;case`ENOENT`:a=`the location no longer exists; restore access to its expected location, then retry`;break;default:a=`check the path and available storage, then retry`}return new q(e,`could not ${t}: ${i}`,a,n)}function Y(e){let t;try{t=N(e)}catch(t){if(t.code===`ENOENT`)return!1;throw J(e,`be inspected`,t)}if(!t.isDirectory())throw new q(e,`is not a regular directory`,`restore the intended receipt directory without a symlink, then retry`);return!0}function bt(e,t){return Object.keys(e).length===t.length&&t.every(t=>Object.hasOwn(e,t))}function xt(e,t){if(!ke(e)||!bt(e,[`version`,`cwd`,`configuredTrustPath`,`canonicalTrustPath`,`state`,`previous`])||e.version!==1||typeof e.cwd!=`string`||e.cwd!==A(e.cwd)||typeof e.configuredTrustPath!=`string`||e.configuredTrustPath!==A(e.configuredTrustPath)||typeof e.canonicalTrustPath!=`string`||e.canonicalTrustPath!==A(e.canonicalTrustPath)||e.state!==`pending`&&e.state!==`committed`||!ke(e.previous))throw new q(t,`has invalid contents`,`restore a valid ownership record from a backup without guessing its trust decision, then retry`);let n;if(e.previous.present===!1&&bt(e.previous,[`present`]))n={present:!1};else if(e.previous.present===!0&&bt(e.previous,[`present`,`value`]))n={present:!0,value:e.previous.value};else throw new q(t,`has an invalid previous decision`,`restore the recorded previous decision from a backup without guessing its value, then retry`);return{version:1,cwd:e.cwd,configuredTrustPath:e.configuredTrustPath,canonicalTrustPath:e.canonicalTrustPath,state:e.state,previous:n}}function St(e,t,n){let r;try{r=N(n)}catch(e){throw J(n,`be inspected`,e)}if(!r.isFile())throw new q(n,`is not a regular file`,`restore the intended receipt as a regular file without a symlink, then retry`);let i;try{i=P(n,`utf8`)}catch(e){throw J(n,`be read`,e)}let a;try{a=JSON.parse(i)}catch(e){throw new q(n,`is not valid JSON`,`repair its JSON syntax without changing the recorded decision, then retry`,e)}let o=xt(a,n);if(o.cwd!==A(t)||n!==yt(e,t,o.canonicalTrustPath))throw new q(n,`does not match its project or trust-store location`,`restore the ownership record to its original project and trust-store location, then retry`);return{path:n,record:o}}function Ct(e,t){let{record:n,path:r}=t;for(let t of[K(e),vt(e,n.cwd)])if(!Y(t))throw new q(t,`no longer exists`,`restore access to the expected receipt directory, then retry`);let i=St(e,n.cwd,r);if(!Be(i.record,n))throw new q(r,`changed while its trust decision was being updated`,`retry to read its current ownership record`);return i}function wt(e,t,n,r,i){let a={version:1,cwd:A(t),configuredTrustPath:A(n),canonicalTrustPath:A(r),state:`pending`,previous:i},o=yt(e,a.cwd,a.canonicalTrustPath),s=`${JSON.stringify(a,null,2)}\n`;if(!Be(xt(JSON.parse(s),o),a))throw new q(o,`cannot preserve the previous decision as JSON`,`provide the original decision as a JSON value before retrying`);Y(K(e)),Y(O(o));try{Fe(O(o),{recursive:!0,mode:448})}catch(e){throw J(O(o),`be created`,e)}let c;try{c=N(o,{throwIfNoEntry:!1})}catch(e){throw J(o,`be inspected`,e)}if(c)throw new q(o,`already exists`,`reconcile the existing ownership record before recording another grant`);try{w(o,s,{mode:384})}catch(e){throw J(o,`be written`,e)}return{path:o,record:a}}function Tt(e,t){let n=Ct(e,t);if(n.record.state!==`pending`)throw new q(n.path,`is already committed`,`use the current ownership record without committing it again`);let r={...n.record,state:`committed`};try{w(n.path,`${JSON.stringify(r,null,2)}\n`,{mode:384})}catch(e){throw J(n.path,`be committed`,e)}return{path:n.path,record:r}}function X(e,t){if(!Y(K(e)))return[];let n=vt(e,t);if(!Y(n))return[];let r;try{r=F(n).sort()}catch(e){throw J(n,`be listed`,e)}return r.filter(e=>/^[a-f0-9]{64}\.json$/.test(e)).map(r=>St(e,t,k(n,r)))}function Z(e,t){let n=Ct(e,t);try{Re(n.path)}catch(e){throw J(n.path,`be removed after reconciling its grant`,e)}for(let t of[O(n.path),K(e)])try{Le(t)}catch(e){let n=e.code;if(n!==`ENOTEMPTY`&&n!==`EEXIST`&&n!==`ENOENT`)throw J(t,`be removed after reconciling its grant`,e)}}var Et=n(((t,n)=>{var r=e(`constants`),i=process.cwd,a=null,o=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return a||=i.call(process),a};try{process.cwd()}catch{}if(typeof process.chdir==`function`){var s=process.chdir;process.chdir=function(e){a=null,s.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,s)}n.exports=c;function c(e){r.hasOwnProperty(`O_SYMLINK`)&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||n(e),e.chown=s(e.chown),e.fchown=s(e.fchown),e.lchown=s(e.lchown),e.chmod=i(e.chmod),e.fchmod=i(e.fchmod),e.lchmod=i(e.lchmod),e.chownSync=c(e.chownSync),e.fchownSync=c(e.fchownSync),e.lchownSync=c(e.lchownSync),e.chmodSync=a(e.chmodSync),e.fchmodSync=a(e.fchmodSync),e.lchmodSync=a(e.lchmodSync),e.stat=l(e.stat),e.fstat=l(e.fstat),e.lstat=l(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){}),o===`win32`&&(e.rename=typeof e.rename==`function`?(function(t){function n(n,r,i){var a=Date.now(),o=0;t(n,r,function s(c){if(c&&(c.code===`EACCES`||c.code===`EPERM`||c.code===`EBUSY`)&&Date.now()-a<6e4){setTimeout(function(){e.stat(r,function(e,a){e&&e.code===`ENOENT`?t(n,r,s):i(c)})},o),o<100&&(o+=10);return}i&&i(c)})}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.rename):e.rename),e.read=typeof e.read==`function`?(function(t){function n(n,r,i,a,o,s){var c;if(s&&typeof s==`function`){var l=0;c=function(u,d,f){if(u&&u.code===`EAGAIN`&&l<10)return l++,t.call(e,n,r,i,a,o,c);s.apply(this,arguments)}}return t.call(e,n,r,i,a,o,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n})(e.read):e.read,e.readSync=typeof e.readSync==`function`?(function(t){return function(n,r,i,a,o){for(var s=0;;)try{return t.call(e,n,r,i,a,o)}catch(e){if(e.code===`EAGAIN`&&s<10){s++;continue}throw e}}})(e.readSync):e.readSync;function t(e){e.lchmod=function(t,n,i){e.open(t,r.O_WRONLY|r.O_SYMLINK,n,function(t,r){if(t){i&&i(t);return}e.fchmod(r,n,function(t){e.close(r,function(e){i&&i(t||e)})})})},e.lchmodSync=function(t,n){var i=e.openSync(t,r.O_WRONLY|r.O_SYMLINK,n),a=!0,o;try{o=e.fchmodSync(i,n),a=!1}finally{if(a)try{e.closeSync(i)}catch{}else e.closeSync(i)}return o}}function n(e){r.hasOwnProperty(`O_SYMLINK`)&&e.futimes?(e.lutimes=function(t,n,i,a){e.open(t,r.O_SYMLINK,function(t,r){if(t){a&&a(t);return}e.futimes(r,n,i,function(t){e.close(r,function(e){a&&a(t||e)})})})},e.lutimesSync=function(t,n,i){var a=e.openSync(t,r.O_SYMLINK),o,s=!0;try{o=e.futimesSync(a,n,i),s=!1}finally{if(s)try{e.closeSync(a)}catch{}else e.closeSync(a)}return o}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}function i(t){return t&&function(n,r,i){return t.call(e,n,r,function(e){d(e)&&(e=null),i&&i.apply(this,arguments)})}}function a(t){return t&&function(n,r){try{return t.call(e,n,r)}catch(e){if(!d(e))throw e}}}function s(t){return t&&function(n,r,i,a){return t.call(e,n,r,i,function(e){d(e)&&(e=null),a&&a.apply(this,arguments)})}}function c(t){return t&&function(n,r,i){try{return t.call(e,n,r,i)}catch(e){if(!d(e))throw e}}}function l(t){return t&&function(n,r,i){typeof r==`function`&&(i=r,r=null);function a(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),i&&i.apply(this,arguments)}return r?t.call(e,n,r,a):t.call(e,n,a)}}function u(t){return t&&function(n,r){var i=r?t.call(e,n,r):t.call(e,n);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}}function d(e){return!e||e.code===`ENOSYS`||(!process.getuid||process.getuid()!==0)&&(e.code===`EINVAL`||e.code===`EPERM`)}}})),Dt=n(((t,n)=>{var r=e(`stream`).Stream;n.exports=i;function i(e){return{ReadStream:t,WriteStream:n};function t(n,i){if(!(this instanceof t))return new t(n,i);r.call(this);var a=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags=`r`,this.mode=438,this.bufferSize=65536,i||={};for(var o=Object.keys(i),s=0,c=o.length;s<c;s++){var l=o[s];this[l]=i[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!=`number`)throw TypeError(`start must be a Number`);if(this.end===void 0)this.end=1/0;else if(typeof this.end!=`number`)throw TypeError(`end must be a Number`);if(this.start>this.end)throw Error(`start must be <= end`);this.pos=this.start}if(this.fd!==null){process.nextTick(function(){a._read()});return}e.open(this.path,this.flags,this.mode,function(e,t){if(e){a.emit(`error`,e),a.readable=!1;return}a.fd=t,a.emit(`open`,t),a._read()})}function n(t,i){if(!(this instanceof n))return new n(t,i);r.call(this),this.path=t,this.fd=null,this.writable=!0,this.flags=`w`,this.encoding=`binary`,this.mode=438,this.bytesWritten=0,i||={};for(var a=Object.keys(i),o=0,s=a.length;o<s;o++){var c=a[o];this[c]=i[c]}if(this.start!==void 0){if(typeof this.start!=`number`)throw TypeError(`start must be a Number`);if(this.start<0)throw Error(`start must be >= zero`);this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}})),Ot=n(((e,t)=>{t.exports=r;var n=Object.getPrototypeOf||function(e){return e.__proto__};function r(e){if(typeof e!=`object`||!e)return e;if(e instanceof Object)var t={__proto__:n(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}})),kt=n(((t,n)=>{var r=e(`fs`),i=Et(),a=Dt(),o=Ot(),s=e(`util`),c,l;typeof Symbol==`function`&&typeof Symbol.for==`function`?(c=Symbol.for(`graceful-fs.queue`),l=Symbol.for(`graceful-fs.previous`)):(c=`___graceful-fs.queue`,l=`___graceful-fs.previous`);function u(){}function d(e,t){Object.defineProperty(e,c,{get:function(){return t}})}var f=u;s.debuglog?f=s.debuglog(`gfs4`):/\bgfs4\b/i.test(process.env.NODE_DEBUG||``)&&(f=function(){var e=s.format.apply(s,arguments);e=`GFS4: `+e.split(/\n/).join(`
|
|
3
|
-
GFS4: `),console.error(e)}),r[c]||(d(r,global[c]||[]),r.close=(function(e){function t(t,n){return e.call(r,t,function(e){e||g(),typeof n==`function`&&n.apply(this,arguments)})}return Object.defineProperty(t,l,{value:e}),t})(r.close),r.closeSync=(function(e){function t(t){e.apply(r,arguments),g()}return Object.defineProperty(t,l,{value:e}),t})(r.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||``)&&process.on(`exit`,function(){f(r[c]),e(`assert`).equal(r[c].length,0)})),global[c]||d(global,r[c]),n.exports=p(o(r)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!r.__patched&&(n.exports=p(r),r.__patched=!0);function p(e){i(e),e.gracefulify=p,e.createReadStream=re,e.createWriteStream=S;var t=e.readFile;e.readFile=n;function n(e,n,r){return typeof n==`function`&&(r=n,n=null),i(e,n,r);function i(e,n,r,a){return t(e,n,function(t){t&&(t.code===`EMFILE`||t.code===`ENFILE`)?m([i,[e,n,r],t,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var r=e.writeFile;e.writeFile=o;function o(e,t,n,i){return typeof n==`function`&&(i=n,n=null),a(e,t,n,i);function a(e,t,n,i,o){return r(e,t,n,function(r){r&&(r.code===`EMFILE`||r.code===`ENFILE`)?m([a,[e,t,n,i],r,o||Date.now(),Date.now()]):typeof i==`function`&&i.apply(this,arguments)})}}var s=e.appendFile;s&&(e.appendFile=c);function c(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,a){return s(e,t,n,function(o){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?m([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var l=e.copyFile;l&&(e.copyFile=u);function u(e,t,n,r){return typeof n==`function`&&(r=n,n=0),i(e,t,n,r);function i(e,t,n,r,a){return l(e,t,n,function(o){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?m([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}var d=e.readdir;e.readdir=h;var f=/^v[0-5]\./;function h(e,t,n){typeof t==`function`&&(n=t,t=null);var r=f.test(process.version)?function(e,t,n,r){return d(e,i(e,t,n,r))}:function(e,t,n,r){return d(e,t,i(e,t,n,r))};return r(e,t,n);function i(e,t,n,i){return function(a,o){a&&(a.code===`EMFILE`||a.code===`ENFILE`)?m([r,[e,t,n],a,i||Date.now(),Date.now()]):(o&&o.sort&&o.sort(),typeof n==`function`&&n.call(this,a,o))}}}if(process.version.substr(0,4)===`v0.8`){var g=a(e);b=g.ReadStream,x=g.WriteStream}var _=e.ReadStream;_&&(b.prototype=Object.create(_.prototype),b.prototype.open=te);var v=e.WriteStream;v&&(x.prototype=Object.create(v.prototype),x.prototype.open=ne),Object.defineProperty(e,"ReadStream",{get:function(){return b},set:function(e){b=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return x},set:function(e){x=e},enumerable:!0,configurable:!0});var y=b;Object.defineProperty(e,"FileReadStream",{get:function(){return y},set:function(e){y=e},enumerable:!0,configurable:!0});var ee=x;Object.defineProperty(e,"FileWriteStream",{get:function(){return ee},set:function(e){ee=e},enumerable:!0,configurable:!0});function b(e,t){return this instanceof b?(_.apply(this,arguments),this):b.apply(Object.create(b.prototype),arguments)}function te(){var e=this;ie(e.path,e.flags,e.mode,function(t,n){t?(e.autoClose&&e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n),e.read())})}function x(e,t){return this instanceof x?(v.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}function ne(){var e=this;ie(e.path,e.flags,e.mode,function(t,n){t?(e.destroy(),e.emit(`error`,t)):(e.fd=n,e.emit(`open`,n))})}function re(t,n){return new e.ReadStream(t,n)}function S(t,n){return new e.WriteStream(t,n)}var C=e.open;e.open=ie;function ie(e,t,n,r){return typeof n==`function`&&(r=n,n=null),i(e,t,n,r);function i(e,t,n,r,a){return C(e,t,n,function(o,s){o&&(o.code===`EMFILE`||o.code===`ENFILE`)?m([i,[e,t,n,r],o,a||Date.now(),Date.now()]):typeof r==`function`&&r.apply(this,arguments)})}}return e}function m(e){f(`ENQUEUE`,e[0].name,e[1]),r[c].push(e),_()}var h;function g(){for(var e=Date.now(),t=0;t<r[c].length;++t)r[c][t].length>2&&(r[c][t][3]=e,r[c][t][4]=e);_()}function _(){if(clearTimeout(h),h=void 0,r[c].length!==0){var e=r[c].shift(),t=e[0],n=e[1],i=e[2],a=e[3],o=e[4];if(a===void 0)f(`RETRY`,t.name,n),t.apply(null,n);else if(Date.now()-a>=6e4){f(`TIMEOUT`,t.name,n);var s=n.pop();typeof s==`function`&&s.call(null,i)}else{var l=Date.now()-o,u=Math.max(o-a,1);l>=Math.min(u*1.2,100)?(f(`RETRY`,t.name,n),t.apply(null,n.concat([a]))):r[c].push(e)}h===void 0&&(h=setTimeout(_,0))}}})),At=n(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0){if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1}var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),jt=n((e=>{var t=At();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&n.forever,unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),Mt=n(((e,t)=>{t.exports=jt()})),Nt=n(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),Pt=n(((t,n)=>{var r=global.process;let i=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!i(r))n.exports=function(){return function(){}};else{var a=e(`assert`),o=Nt(),s=/^win/i.test(r.platform),c=e(`events`);typeof c!=`function`&&(c=c.EventEmitter);var l;r.__signal_exit_emitter__?l=r.__signal_exit_emitter__:(l=r.__signal_exit_emitter__=new c,l.count=0,l.emitted={}),l.infinite||(l.setMaxListeners(1/0),l.infinite=!0),n.exports=function(e,t){if(!i(global.process))return function(){};a.equal(typeof e,`function`,`a callback must be provided for exit handler`),p===!1&&m();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),l.on(n,e),function(){l.removeListener(n,e),l.listeners(`exit`).length===0&&l.listeners(`afterexit`).length===0&&u()}};var u=function(){!p||!i(global.process)||(p=!1,o.forEach(function(e){try{r.removeListener(e,f[e])}catch{}}),r.emit=_,r.reallyExit=h,--l.count)};n.exports.unload=u;var d=function(e,t,n){l.emitted[e]||(l.emitted[e]=!0,l.emit(e,t,n))},f={};o.forEach(function(e){f[e]=function(){i(global.process)&&r.listeners(e).length===l.count&&(u(),d(`exit`,null,e),d(`afterexit`,null,e),s&&e===`SIGHUP`&&(e=`SIGINT`),r.kill(r.pid,e))}}),n.exports.signals=function(){return o};var p=!1,m=function(){p||!i(global.process)||(p=!0,l.count+=1,o=o.filter(function(e){try{return r.on(e,f[e]),!0}catch{return!1}}),r.emit=v,r.reallyExit=g)};n.exports.load=m;var h=r.reallyExit,g=function(e){i(global.process)&&(r.exitCode=e||0,d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),h.call(r,r.exitCode))},_=r.emit,v=function(e,t){if(e===`exit`&&i(global.process)){t!==void 0&&(r.exitCode=t);var n=_.apply(this,arguments);return d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),n}return _.apply(this,arguments)}}})),Ft=n(((e,t)=>{let n=Symbol();function r(e,t,r){let i=t[n];if(i)return t.stat(e,(e,t)=>{if(e)return r(e);r(null,t.mtime,i)});let a=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,a,a,i=>{if(i)return r(i);t.stat(e,(e,i)=>{if(e)return r(e);let a=i.mtime.getTime()%1e3==0?`s`:`ms`;Object.defineProperty(t,n,{value:a}),r(null,i.mtime,a)})})}function i(e){let t=Date.now();return e===`s`&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}t.exports.probe=r,t.exports.getMtime=i})),It=n(((t,n)=>{let r=e(`path`),i=kt(),a=Mt(),o=Pt(),s=Ft(),c={};function l(e,t){return t.lockfilePath||`${e}.lock`}function u(e,t,n){if(!t.realpath)return n(null,r.resolve(e));t.fs.realpath(e,n)}function d(e,t,n){let r=l(e,t);t.fs.mkdir(r,i=>{if(!i)return s.probe(r,t.fs,(e,i,a)=>{if(e)return t.fs.rmdir(r,()=>{}),n(e);n(null,i,a)});if(i.code!==`EEXIST`)return n(i);if(t.stale<=0)return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));t.fs.stat(r,(r,i)=>{if(r)return r.code===`ENOENT`?d(e,{...t,stale:0},n):n(r);if(!f(i,t))return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));p(e,t,r=>{if(r)return n(r);d(e,{...t,stale:0},n)})})})}function f(e,t){return e.mtime.getTime()<Date.now()-t.stale}function p(e,t,n){t.fs.rmdir(l(e,t),e=>{if(e&&e.code!==`ENOENT`)return n(e);n()})}function m(e,t){let n=c[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(r,i)=>{let a=n.lastUpdate+t.stale<Date.now();if(r)return r.code===`ENOENT`||a?h(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,m(e,t));if(n.mtime.getTime()!==i.mtime.getTime())return h(e,n,Object.assign(Error(`Unable to update lock within the stale threshold`),{code:`ECOMPROMISED`}));let o=s.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,o,o,r=>{let i=n.lastUpdate+t.stale<Date.now();if(!n.released){if(r)return r.code===`ENOENT`||i?h(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,m(e,t));n.mtime=o,n.lastUpdate=Date.now(),n.updateDelay=null,m(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function h(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),c[e]===t&&delete c[e],t.options.onCompromised(n)}function g(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:e=>{throw e},...t},t.retries=t.retries||0,t.retries=typeof t.retries==`number`?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),u(e,t,(e,r)=>{if(e)return n(e);let i=a.operation(t.retries);i.attempt(()=>{d(r,t,(e,a,o)=>{if(i.retry(e))return;if(e)return n(i.mainError());let s=c[r]={lockfilePath:l(r,t),mtime:a,mtimePrecision:o,options:t,lastUpdate:Date.now()};m(r,t),n(null,e=>{if(s.released)return e&&e(Object.assign(Error(`Lock is already released`),{code:`ERELEASED`}));_(r,{...t,realpath:!1},e)})})})})}function _(e,t,n){t={fs:i,realpath:!0,...t},u(e,t,(e,r)=>{if(e)return n(e);let i=c[r];if(!i)return n(Object.assign(Error(`Lock is not acquired/owned by you`),{code:`ENOTACQUIRED`}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete c[r],p(r,t,n)})}function v(e,t,n){t={stale:1e4,realpath:!0,fs:i,...t},t.stale=Math.max(t.stale||0,2e3),u(e,t,(e,r)=>{if(e)return n(e);t.fs.stat(l(r,t),(e,r)=>e?e.code===`ENOENT`?n(null,!1):n(e):n(null,!f(r,t)))})}function y(){return c}o(()=>{for(let e in c){let t=c[e].options;try{t.fs.rmdirSync(l(e,t))}catch{}}}),n.exports.lock=g,n.exports.unlock=_,n.exports.check=v,n.exports.getLocks=y})),Lt=n(((e,t)=>{let n=kt();function r(e){let t=[`mkdir`,`realpath`,`stat`,`rmdir`,`utimes`],n={...e};return t.forEach(t=>{n[t]=(...n)=>{let r=n.pop(),i;try{i=e[`${t}Sync`](...n)}catch(e){return r(e)}r(null,i)}}),n}function i(e){return(...t)=>new Promise((n,r)=>{t.push((e,t)=>{e?r(e):n(t)}),e(...t)})}function a(e){return(...t)=>{let n,r;if(t.push((e,t)=>{n=e,r=t}),e(...t),n)throw n;return r}}function o(e){if(e={...e},e.fs=r(e.fs||n),typeof e.retries==`number`&&e.retries>0||e.retries&&typeof e.retries.retries==`number`&&e.retries.retries>0)throw Object.assign(Error(`Cannot use retries with the sync api`),{code:`ESYNC`});return e}t.exports={toPromise:i,toSync:a,toSyncOptions:o}})),Rt=t(n(((e,t)=>{let n=It(),{toPromise:r,toSync:i,toSyncOptions:a}=Lt();async function o(e,t){let i=await r(n.lock)(e,t);return r(i)}function s(e,t){let r=i(n.lock)(e,a(t));return i(r)}function c(e,t){return r(n.unlock)(e,t)}function l(e,t){return i(n.unlock)(e,a(t))}function u(e,t){return r(n.check)(e,t)}function d(e,t){return i(n.check)(e,a(t))}t.exports=o,t.exports.lock=o,t.exports.unlock=c,t.exports.lockSync=s,t.exports.unlockSync=l,t.exports.check=u,t.exports.checkSync=d}))(),1);const zt=5e3;function Bt(e,t,n){if(!(e instanceof Error)||!(`code`in e)||e.code!==`ELOCKED`)throw e;let r=t-performance.now();if(r<=0)throw Object.assign(Error(`Could not acquire Pi trust lock at ${n}.lock within ${zt}ms`,{cause:e}),{code:`ELOCKED`});return Math.min(25,r)}function Vt(e,t){We()?.warn(t,e)}function Ht(e,t){if(e.length===0)return;if(e.length===1)throw e[0];let[n,r]=e,i=n instanceof Error?n.message:String(n),a=r instanceof Error?r.message:String(r);throw AggregateError(e,`Pi trust update failed: ${i}\nReleasing Pi trust lock ${t}.lock also failed: ${a}`)}async function Ut(e,t,n){await ie(`${t}.ok.lock`,async()=>{let t=performance.now()+zt,r;for(;;)try{r=await Rt.default.lock(O(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){await Ve(Bt(n,t,e))}let i=[];try{n()}catch(e){i.push(e)}finally{try{await r()}catch(e){i.push(e)}}Ht(i,e)},{onWarn:Vt})}function Wt(e,t,n){ne(`${t}.ok.lock`,()=>{let t=performance.now()+zt,r=new Int32Array(new SharedArrayBuffer(4)),i;for(;;)try{i=Rt.default.lockSync(O(e),{realpath:!1,lockfilePath:`${e}.lock`});break}catch(n){Atomics.wait(r,0,0,Bt(n,t,e))}let a=[];try{n()}catch(e){a.push(e)}finally{try{i()}catch(e){a.push(e)}}Ht(a,e)},{onWarn:Vt})}const Gt=[`settings.json`,`prompts`,`themes`,`SYSTEM.md`,`APPEND_SYSTEM.md`];var Kt=class extends Error{name=`PiResourceInspectionError`};function qt(e){let t;try{t=N(e)}catch(e){if(e.code===`ENOENT`)return!1;throw e}let n;try{n=L(e)}catch(e){throw t.isSymbolicLink()&&e.code===`ENOENT`?new Kt(le(`missing-symlink-target`),{cause:e}):e}return Pe(e,j.R_OK|(n.isDirectory()?j.X_OK:0)),!0}function Jt(e){return e===`open-knowledge`||e.startsWith(`open-knowledge-`)}function Yt(e,t,n){let r=e;try{let i=I(e),a;r=t;try{a=I(t)}catch(e){if(e.code!==`ENOENT`)throw e;a=A(t)}let o=k(a,`.agents`,`skills`),s=[];for(let e of Gt)r=k(i,`.pi`,e),qt(r)&&s.push(r);if(r=k(i,`.pi`,`extensions`),qt(r))for(let t of F(r).sort()){let i=k(r,t);A(n)!==k(A(e),`.pi`,`extensions`,t)&&s.push(i)}for(let e of[k(i,`.pi`,`skills`),k(i,`.agents`,`skills`)])if(e!==o&&(r=e,qt(e)))for(let t of F(e).sort())Jt(t)||s.push(k(e,t));let c=O(i);for(;c!==i;){r=k(c,`.agents`,`skills`),r!==o&&qt(r)&&s.push(r);let e=O(c);if(e===c)break;c=e}return s.length===0?{kind:`none`}:{kind:`shared`,paths:s.sort()}}catch(e){return{kind:`unreadable`,error:`Could not inspect Pi project resources at ${G(r)}: ${e instanceof Kt?e.message:le(T(e))}`}}}function Xt(e,t,n){let r=A(e),i=be({home:t,env:n??(t===void 0?process.env:{})});return{cwd:r,bridgePath:E.pi.projectConfigPath(r),trustPath:k(i,`trust.json`)}}function Zt(e){try{let t=I(e);return L(t).isDirectory()?(Pe(t,j.X_OK),{kind:`ready`,project:{path:e,canonical:t}}):{kind:`refused`,error:`Pi project path ${G(e)} is not a directory; restore the intended project directory, then retry`}}catch(t){return{kind:`refused`,error:`Pi project directory ${G(e)} could not be resolved or accessed: ${G(t instanceof Error?t.message:String(t))}; restore the directory or symlink and check its permissions, then retry`}}}function Qt(e){let t=Zt(e.path);if(t.kind===`refused`)return t.error;if(t.project.canonical!==e.canonical)return`Pi project path ${G(e.path)} changed while waiting for its trust lock; restore the intended project location, then retry`}function $t(e,t,n){let r=Te(E.pi,e,n,t);if(r.kind===`absent`)return{state:`absent`,text:null};if(r.kind!==`present`)return{state:`unreadable`,text:null};let i=r.entry,a=Array.isArray(i.args)&&typeof i.args[0]==`string`?i.args[0]:null;return ve(i)?{state:`own-current`,text:a}:se(i)?{state:`own-stale`,text:a}:{state:`foreign`,text:a}}function en(e,t){let n;try{n=P(e.path,`utf-8`)}catch(t){let n=t.code;return e.kind===`missing`&&n===`ENOENT`?{state:`untrusted`,entries:{},trailingNewline:!1}:{state:`unreadable`,reason:T(t)}}if(n.trim()===``)return{state:`untrusted`,entries:{},trailingNewline:!1};let r;try{r=JSON.parse(n)}catch{return{state:`unreadable`,reason:`invalid-json`}}return ke(r)?{state:r[t]===!0?`trusted`:`untrusted`,entries:r,trailingNewline:n.endsWith(`
|
|
4
|
-
`)}:{state:`unreadable`,reason:`invalid-json`}}function tn(e){switch(e){case`invalid-json`:return`the file is not a valid JSON object; repair its JSON, then retry`;case`path-changed`:return`the path changed while waiting for its lock; retry to check its current state`;case`unavailable-root`:return`the filesystem root is unavailable; reconnect the drive or network share, then retry`;default:return le(e)}}function Q(e,t){return{kind:`refused`,error:`trust store ${G(e)}: ${tn(t)}`}}function nn(e){let t=Ae(e);try{switch(t.kind){case`declined`:return Q(e,t.reason);case`ready`:return{kind:`ready`,path:I(t.path)};case`not-present`:break;default:throw Error(`unhandled trust file resolution: ${t}`)}let n=O(e),r=[Me(e)],i=N(n,{throwIfNoEntry:!1});for(;!i;){let t=O(n);if(t===n)return Q(e,`unavailable-root`);r.unshift(Me(n)),n=t,i=N(n,{throwIfNoEntry:!1})}try{return{kind:`missing`,path:k(I(n),...r)}}catch(t){return Q(e,i.isSymbolicLink()&&t.code===`ENOENT`?`missing-symlink-target`:T(t))}}catch(t){return Q(e,T(t))}}function rn(e,t){let n=nn(e);return n.kind===`refused`?n:n.path!==t.path||t.kind===`ready`&&n.kind===`missing`?Q(e,`path-changed`):n}function an(e,t,n){let r=Xt(e,t,n),i=Zt(r.cwd);if(i.kind===`refused`)return{...r,project:`unavailable`,error:i.error};let a=$t(r.cwd,r.bridgePath,t).state,o=nn(r.trustPath),s=o.kind===`refused`?`unreadable`:o.kind===`missing`?`untrusted`:en(o,i.project.canonical).state;return{...r,project:`ready`,canonicalCwd:i.project.canonical,bridge:a,trust:s,bridgeLoadable:(a===`own-current`||a===`own-stale`)&&s===`trusted`,otherExtensions:on(r.bridgePath).displayNames}}function on(e){let t=O(e),n=Me(e);try{return{displayNames:F(t).filter(e=>e!==n&&e.endsWith(`.ts`)).sort().map(e=>G(JSON.stringify(e)))}}catch{return{displayNames:[]}}}async function sn(e,t={mode:`published`},n,r,i){let a=Xt(e,n,r),o=Zt(a.cwd);if(o.kind===`refused`)return{...a,ok:!1,bridge:`refused-project-path`,trust:`skipped`,error:o.error};if(i!==void 0&&o.project.canonical!==i)return{...a,ok:!1,bridge:`refused-project-path`,trust:`skipped`,error:`The approved Pi project directory ${G(i)} no longer matches the current directory ${G(o.project.canonical)}. Reopen the intended project and approve the Pi integration again; no bridge or trust settings were changed.`};let s=$t(a.cwd,a.bridgePath,n);if(s.state===`foreign`)return{...a,ok:!1,bridge:`refused-foreign`,trust:`skipped`};if(s.state===`unreadable`)return{...a,ok:!1,bridge:`refused-unreadable`,trust:`skipped`};let c;if(s.state===`absent`)c=`written`;else{let e;try{e=de(t)}catch{e=void 0}c=e!==void 0&&s.text===e?`unchanged`:`refreshed`}if(c!==`unchanged`){let e=me(E.pi,a.cwd,t,n,a.bridgePath);if(e.action!==`written`&&e.action!==`overwritten`)return{...a,ok:!1,bridge:`failed`,trust:`skipped`,error:e.error===void 0?`bridge write ${e.action}`:G(e.error)}}let l=await cn(a.trustPath,o.project,n??R());return{...a,ok:l.action===`already-trusted`||l.action===`added`,bridge:c,trust:l.action,...l.error===void 0?{}:{error:l.error}}}async function cn(e,t,n){let r=t.canonical,i=nn(e);if(i.kind===`refused`)return{action:`refused-unreadable`,error:i.error};try{Fe(O(i.path),{recursive:!0})}catch(e){return{action:`failed`,error:G(e instanceof Error?e.message:String(e))}}let a={action:`added`};try{await Ut(e,i.path,()=>{let o=Qt(t);if(o){a.action=`refused-unreadable`,a.error=o;return}let s=rn(e,i);if(s.kind===`refused`){a.action=`refused-unreadable`,a.error=s.error;return}let c=en(s,r);if(c.state===`trusted`){a.action=`already-trusted`;return}if(c.state===`unreadable`){a.action=`refused-unreadable`,a.error=Q(e,c.reason).error;return}let l=$(n,()=>{let t=X(n,r).find(e=>e.record.canonicalTrustPath===s.path);return t&&Z(n,t),wt(n,r,e,s.path,Object.hasOwn(c.entries,r)?{present:!0,value:c.entries[r]}:{present:!1})}),u={...c.entries,[r]:!0},d=JSON.stringify(u,null,2)+(c.trailingNewline?`
|
|
5
|
-
`:``),f=D(s.path);w(s.path,d,f===void 0?void 0:{mode:f}),$(n,()=>Tt(n,l)),a.action=`added`})}catch(e){return{action:`failed`,error:G(e instanceof Error?e.message:String(e))}}return a}function ln(e){let t=[],n=e;try{for(;;){if(N(n,{throwIfNoEntry:!1})){if(t.length===0)return;let e=I(n);return L(e).isDirectory()?(Pe(e,j.X_OK),k(e,...t)):void 0}let e=O(n);if(e===n)return;t.unshift(Me(n)),n=e}}catch{return}}function un(e){let t={"not-present":0,removed:1,"kept-unowned":2,"kept-shared":3,"kept-unverified":4,"refused-unreadable":5,failed:6},n=e.reduce((e,n)=>t[n.action]>t[e.action]?n:e,{action:`not-present`}),r=e.flatMap(e=>e.error??[]),i=e.flatMap(e=>e.detail??[]);return r.length>0?{action:n.error===void 0?`failed`:n.action,error:[...r,...i].join(`
|
|
6
|
-
`)}:n.detail===void 0?n:{...n,detail:i.join(`
|
|
7
|
-
`)}}function dn(e,t,n,r={}){let i=Xt(e,t,n),a=t??R(),o=Zt(i.cwd),s=o.kind===`refused`&&r.recordedOnly?ln(i.cwd):void 0,c=o.kind===`ready`?o.project.canonical:s,l;try{l=$(a,()=>{let e=X(a,i.cwd);return c===void 0||c===i.cwd?e:[...X(a,c),...e]})}catch(e){return{action:`failed`,error:G(e instanceof Error?e.message:String(e))}}if(l.length===0&&r.recordedOnly)return o.kind===`ready`||s!==void 0?{action:`not-present`}:{action:`kept-unverified`,error:`${o.error}. OpenKnowledge could not verify whether this path refers to a project with recorded Pi trust; cleanup was left pending. Retry once the project path can be resolved to check again.`};if(o.kind===`refused`){if(l.length===0)return{action:`kept-unverified`,error:o.error};let e=l.map(({path:e,record:t})=>`key ${G(JSON.stringify(t.cwd))}; configured store ${G(JSON.stringify(t.configuredTrustPath))}; recorded destination ${G(JSON.stringify(t.canonicalTrustPath))}; ownership record ${G(JSON.stringify(e))} (${t.state})`);return{action:`kept-unverified`,error:[`${o.error}. OpenKnowledge kept these Pi trust ownership records; current trust decisions were not checked:`,...e,`To review manually, close Pi, verify the intended store against its recorded destination, and inspect only the exact key. A pending record does not prove setup completed or ownership of a current grant. If you choose to undo a current true decision, restore the recorded previous value, or remove that key only when no previous entry was recorded. Preserve other current decisions; parent-folder and global trust settings still apply.`].join(`
|
|
8
|
-
`)}}let u=Yt(o.project.canonical,a,E.pi.projectConfigPath(o.project.canonical));if(u.kind===`unreadable`)return{action:`kept-unverified`,error:u.error};let d=u.kind===`shared`?u.paths:[],f=[],p=new Map,m=(e,t)=>{let n=p.get(e);if(!n){let t=nn(e);if(t.kind===`refused`){f.push({action:`refused-unreadable`,error:t.error});return}n={trustPath:e,resolved:t,keys:new Map},p.set(e,n)}if(t){if(n.resolved.path!==t.record.canonicalTrustPath){f.push({action:`refused-unreadable`,error:`Pi trust store ${G(e)} no longer points to its recorded destination ${G(t.record.canonicalTrustPath)}; restore the intended file location or symlink, then retry`});return}n.keys.set(t.record.cwd,{cwd:t.record.cwd,mode:`recorded`,receipt:t})}};for(let e of l)m(e.record.configuredTrustPath,e);m(i.trustPath);for(let e of p.values()){for(let t of[o.project.canonical,i.cwd])e.keys.has(t)||e.keys.set(t,{cwd:t,mode:`inspect`,receipt:l.find(n=>n.record.cwd===t&&n.record.canonicalTrustPath===e.resolved.path)});f.push(fn(e,a,d,o.project))}return un(f)}function $(e,t){try{return t()}catch(t){throw t instanceof q?t:Error(`Could not access OpenKnowledge's Pi trust ownership records at ${G(k(C(e),`pi-trust`))}: ${G(t instanceof Error?t.message:String(t))}. Check the records and their permissions, then retry.`,{cause:t})}}function fn(e,t,n,r){let{trustPath:i,resolved:a}=e,o=[...e.keys.values()];if(!o.some(e=>e.mode===`recorded`)&&a.kind===`missing`)return{action:`not-present`};if(a.kind===`missing`)try{N(O(a.path))}catch(e){return{action:`failed`,error:`The recorded Pi trust directory ${G(O(a.path))} is unavailable: ${G(e instanceof Error?e.message:String(e))}. Restore access to its parent directory or mounted drive, then retry; the ownership record was kept.`}}let s=[],c={result:{action:`not-present`}};try{Wt(i,a.path,()=>{let e=Qt(r);if(e){c.result={action:`kept-unverified`,error:e};return}let l=rn(i,a);if(l.kind===`refused`){c.result={action:`refused-unreadable`,error:l.error};return}let u=en(l,r.canonical);if(u.state===`unreadable`){c.result={action:`refused-unreadable`,error:Q(i,u.reason).error};return}let d=o.map(e=>({cwd:e.cwd,mode:e.mode,expectedConfiguredPath:e.receipt?.record.configuredTrustPath,receipt:$(t,()=>X(t,e.cwd).find(e=>e.record.canonicalTrustPath===l.path))}));if(d.some(e=>e.receipt&&e.receipt.record.configuredTrustPath!==e.expectedConfiguredPath)){c.result={action:`failed`,error:`The Pi trust ownership record changed during cleanup; retry to read its current location.`};return}for(let e of d){try{pn(e,t,i,l.path,u,n,r,c)}catch(t){let n=G(t instanceof Error?t.message:String(t)),r=t instanceof q?``:`; retry to check its current state.`;s.push({action:`failed`,error:`Pi trust entry ${G(JSON.stringify(e.cwd))} in ${G(i)} could not be reconciled: ${n}${r}`})}s.push(c.result),c.result={action:`not-present`}}})}catch(e){s.push({action:`failed`,error:G(e instanceof Error?e.message:String(e))})}return un([...s,c.result])}function pn(e,t,n,r,i,a,o,s){let{cwd:c,receipt:l}=e;if(i.entries[c]!==!0){l&&e.mode===`recorded`&&$(t,()=>Z(t,l)),s.result={action:`not-present`};return}let u=`To remove this grant manually, close Pi and remove only the ${G(JSON.stringify(c))} entry from ${G(n)}; parent-folder and global trust settings still apply.`;if(a.length>0&&c===o.canonical){let n=`kept Pi's folder trust because other resources still need it: ${a.slice(0,3).map(e=>G(JSON.stringify(e))).join(`, `)}${a.length>3?` (+${a.length-3} more)`:``}. ${u} Removing this grant may stop Pi from loading those resources, including any not listed here.`;s.result={action:`kept-shared`,detail:n},l&&e.mode===`recorded`&&$(t,()=>Z(t,l)),s.result={action:`kept-shared`,detail:`${n} ${l?e.mode===`recorded`?`OpenKnowledge has relinquished this grant and will not revoke it on later cleanup runs.`:`OpenKnowledge kept the existing ownership record; cleanup of its recorded location remains incomplete.`:`OpenKnowledge has no ownership record for this grant and will not revoke it on later cleanup runs.`}`};return}if(e.mode===`inspect`||!l||l.record.state===`pending`){let e=l?l.record.state===`pending`?`its ownership record is pending after an interrupted setup; completion cannot be verified. Re-running setup or cleanup does not reconcile this record while the folder remains trusted.`:`OpenKnowledge must reconcile its recorded location at ${G(l.record.configuredTrustPath)} before removing it.`:`no OpenKnowledge ownership record exists; this includes every grant made before ownership recording was introduced.`;s.result={action:`kept-unowned`,detail:`${c===o.canonical?`kept Pi's folder trust because ${e}`:`kept a Pi trust entry under a non-canonical project path because ${e} Pi uses the real project directory instead of this key.`} ${u}`};return}let d={...i.entries};l.record.previous.present?d[c]=l.record.previous.value:delete d[c];let f=JSON.stringify(d,null,2)+(i.trailingNewline?`
|
|
9
|
-
`:``),p=D(r);w(r,f,p===void 0?void 0:{mode:p}),i.entries=d,$(t,()=>Z(t,l)),s.result={action:`removed`}}function mn(e){return ve(e)||pe(e)||se(e)}const hn=10485760;function gn(e,t,n,r=!1){let i=dn(e,t,n,{recordedOnly:r});switch(i.action){case`removed`:case`not-present`:return{trust:i.action};case`kept-shared`:case`kept-unowned`:return{trust:i.action,trustDetail:i.detail};case`failed`:case`refused-unreadable`:case`kept-unverified`:{let e=r?`Trust cleanup remains incomplete`:`The bridge file was left untouched`;throw Error(`Pi trust cleanup failed (${i.action}):\n${i.error}\n${e} so cleanup can be retried.`)}default:throw Error(`unhandled Pi trust cleanup result: ${i}`)}}function _n(e,t,n,r){if(e.id!==`pi`)return{kind:`not-present`};let i=gn(t,n,r,!0);return i.trust===`not-present`?{kind:`not-present`}:{kind:`removed`,...i}}function vn(e,t,n,r,i){let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=Ae(a);if(o.kind===`not-present`)return _n(e,t,n,i);if(o.kind===`declined`)return o;let s=Te(e,t,n,o.path);if(s.kind===`absent`||s.kind===`no-entry`)return _n(e,t,n,i);if(s.kind===`decline`)return{kind:`declined`,reason:s.reason};if(!mn(s.entry))return{kind:`left-foreign`};let c=e.serverName(t);if(e.format===`file`){let e=gn(t,n,i);try{Ie(a,{force:!0})}catch(t){throw e.trustDetail?Error(`${t instanceof Error?t.message:String(t)}\n${e.trustDetail}`,{cause:t}):t}return{kind:`removed`,...e}}return e.format===`toml`?xn(o.path,c):e.format===`yaml`?bn(o.path,e.topLevelKey,c):yn(o.path,e.topLevelKey,e.serverMapSubKey,c)}function yn(e,t,n,r){let i;try{i=P(e,`utf-8`)}catch(e){return{kind:`declined`,reason:T(e)}}if(Buffer.byteLength(i,`utf-8`)>hn)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=ye(i,De(t,n,r));return o?(w(e,a,{mode:D(e)}),{kind:`removed`}):{kind:`not-present`}}function bn(e,t,n){let r;try{r=P(e,`utf-8`)}catch(e){return{kind:`declined`,reason:T(e)}}if(Buffer.byteLength(r,`utf-8`)>hn)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,He.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=oe(a);a.trim()===``||a.endsWith(`
|
|
10
|
-
`)?c.endsWith(`
|
|
11
|
-
`)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
|
|
12
|
-
`).replace(/\n/g,`\r
|
|
13
|
-
`));let u=`${i?``:``}${c}`;return u!==r&&w(e,u,{mode:D(e)}),{kind:`removed`}}function xn(e,t){let n=_e();if(n.backend===`fallback`)return{kind:`declined`,reason:`no-native-writer`};let r;try{r=P(e,`utf-8`)}catch(e){return{kind:`declined`,reason:T(e)}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=oe(a),s=a.trim()===``||a.endsWith(`
|
|
14
|
-
`),c;try{c=n.removeEntry(a,t)}catch{return{kind:`declined`,reason:`unparseable`}}if(!c.existed)return{kind:`not-present`};let l=c.text;s?l.endsWith(`
|
|
15
|
-
`)||(l=`${l}\n`):l=l.replace(/\n+$/,``),o&&(l=l.replace(/\r\n/g,`
|
|
16
|
-
`).replace(/\n/g,`\r
|
|
17
|
-
`));let u=`${i?``:``}${l}`;return u!==r&&w(e,u,{mode:D(e)}),{kind:`removed`}}function Sn(e,t){let n=_[e];return n===null?null:k(t,...n.split(`/`),S.discovery,`SKILL.md`)}function Cn(e,t){let n=Sn(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};if(!x(t).some(t=>t.editorId===e))return{editorId:e,label:e,action:`skipped-unsupported`,path:n};try{let r=ae(`discovery`,{checkDesktop:!0});return ce(O(n),t),{editorId:e,label:e,action:Oe(r,n),path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function wn(e){return M(k(e,...`.agents/skills`.split(`/`),S.discovery))?!0:f.some(t=>{let n=Sn(t,e);return n!==null&&M(O(n))})}function Tn(e,t){let n=Sn(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};let r=O(n);try{return M(n)?(ce(r,t),Ie(r,{recursive:!0,force:!0}),{editorId:e,label:e,action:`removed`,path:n}):{editorId:e,label:e,action:`not-present`,path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function En(e){return e===`opencode`?Se:we}function Dn(e,t,n){let r=E[e],i=En(e),a=[],o=r.projectConfigPath?.(t);o!==void 0&&a.push({scope:`project`,configPath:o});try{a.push({scope:`user`,configPath:r.configPath(t,n)})}catch{}for(let o of a){let a=Ce(r,t,n,o.configPath);if(a!==null&&i(a))return{editorId:e,scope:o.scope,configPath:o.configPath}}return null}function On(e,t,n=[]){let r=M(k(e,S[t]))?`satisfied`:`absent`;return{...r===`satisfied`?{state:r,strictness:[`reclaim-permissive`]}:{state:r},...n.length===0?{}:{sharedWith:n}}}function kn(e,t){let n=fe.flatMap(t=>{let n=e[t];return n===null?[]:[{editor:t,root:n}]}),r=m.filter(e=>e.scope===t).map(e=>({editor:e.editorId,root:i}));return[...n,...r]}function An(e,t,n,r){let i=b(e,kn(t,r)),a=i.find(e=>e.host===n);if(a===void 0||a.state===`absent`)return[];let o=a.real;return i.filter(e=>e.host!==n&&e.state!==`absent`&&e.real===o).map(e=>e.host)}function jn(e,t){let n=(t??R()).replace(/[\\/]+$/,``);if(!n.includes(`\\`))return e.startsWith(`${n}/`)?`~/${e.slice(n.length+1)}`:e;let r=e=>e.replace(/\\/g,`/`),i=r(n),a=r(e);return a.startsWith(`${i}/`)?`~/${a.slice(i.length+1)}`:e}function Mn(e,t){let n=E[e];return ue(n,``,t)&&!ge(n,``,t)}function Nn(e,t,n,r,i){let a=E[e],o;if(i===void 0)try{o=a.configPath(n,r)}catch{return{state:`structural-na`}}else o=i;let s=i===void 0?jn(o,r):void 0,c=Te(a,n,r,i);switch(c.kind){case`absent`:case`no-entry`:return i===void 0&&Mn(e,r)?{state:`structural-na`}:{state:`absent`,path:s};case`decline`:return{state:`unprobed`};case`present`:{let{entry:r}=c,i=[];ve(r)&&i.push(`reclaim-permissive`),pe(r)&&i.push(`pre-approval-exact`),En(e)(r)&&i.push(`injection-functional`);let o=he(a,n);return i.length>0&&(o!==null&&xe(r,o)||t.includes(`pre-approval-exact`)&&i.includes(`reclaim-permissive`)&&!i.includes(`pre-approval-exact`))?{state:`drifted`,strictness:i,path:s}:i.length>0?{state:`satisfied`,strictness:i,path:s}:Ee(a)?{state:`foreign-replaceable`,path:s}:{state:`foreign`,path:s}}}}function Pn(e){let{cwd:t,home:n}=e;return e=>{if(e.pathId===null)return null;let r=h(e.pathId);if(r===null)return null;if(r.kind===`central-skill-store`)return n===void 0?null:On(k(n,i),`discovery`,An(n,_,e.agent,`global`));let a=r.editor;switch(r.kind){case`editor-user-skill-root`:{let e=_[a];return e===null||n===void 0?null:x(n).some(e=>e.editorId===a)?On(k(n,e),`discovery`,An(n,_,a,`global`)):{state:`structural-na`}}case`editor-project-skill-root`:{let e=g[a];return e===null?null:On(k(t,e),`project`,An(t,g,a,`project`))}case`editor-user-config`:return Nn(a,e.strictness,t,n);case`editor-project-config`:{let r=E[a].projectConfigPath?.(t);return r===void 0?null:Nn(a,e.strictness,t,n,r)}}}}export{Qe as C,Ze as S,Ke as T,rt as _,Cn as a,$e as b,an as c,ct as d,W as f,st as g,gt as h,wn as i,at as l,ht as m,Dn as n,vn as o,mt as p,Tn as r,sn as s,Pn as t,lt as u,it as v,We as w,Ye as x,z as y};
|
package/dist/src-CQO5GchD.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./md-manager-BGnqyqi1-BZjgceH4.mjs";import"./src-oPFH8u4O.mjs";import"./init-kdH152Ks.mjs";import"./registry-probes--fuRXE7y.mjs";import"./start-CloYBm1u.mjs";import{n as e}from"./loader-BAPBaCdj.mjs";import"./preview-S7YFOnEc.mjs";import"./repair-mcp-configs-CNMFjBnO.mjs";export{e as loadConfig};
|