@inkeep/open-knowledge 0.72.1 → 0.73.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/cli.mjs +46 -46
  2. package/dist/constants-CEZpdo1d.mjs +1 -0
  3. package/dist/{dist-CcOixwu-.mjs → dist-CVJfSfJh.mjs} +487 -487
  4. package/dist/{dist-CXSbeq2s.mjs → dist-zTxXoqu4.mjs} +1 -1
  5. package/dist/index.mjs +139 -139
  6. package/dist/{init-BS1jW1ap.mjs → init-BvmRO7re.mjs} +7 -7
  7. package/dist/init-C8CSY0Tx.mjs +1 -0
  8. package/dist/{launch-json-removal-Dmx0AXXx.mjs → launch-json-removal-CosW_PcO.mjs} +1 -1
  9. package/dist/{loader-CL02d_x_.mjs → loader-CEEaL4dv.mjs} +1 -1
  10. package/dist/loader-F8eJIfWh.mjs +1 -0
  11. package/dist/{md-manager-BGnqyqi1-BjukM0Wf.mjs → md-manager-BGnqyqi1-BMsQT5x6.mjs} +2 -2
  12. package/dist/{open-browser-DG4YB3Kq.mjs → open-browser-CRzbTK-f.mjs} +1 -1
  13. package/dist/parse-worker.mjs +1 -1
  14. package/dist/{preview-3wmj89l7.mjs → preview-BB49HMe1.mjs} +1 -1
  15. package/dist/preview-k50i2F9f.mjs +1 -0
  16. package/dist/public/assets/{ActivityModeContent-uyL7HxG4.js → ActivityModeContent-D2Z1UD5R.js} +1 -1
  17. package/dist/public/assets/{AddPropertiesButton-kMcRRaht.js → AddPropertiesButton-Bc5I-T1P.js} +1 -1
  18. package/dist/public/assets/{AgentDiffPane-DlRsWC8t.js → AgentDiffPane-C1-isSha.js} +1 -1
  19. package/dist/public/assets/{CodeMirrorPropInput-Osrkcwto.js → CodeMirrorPropInput-BFpi9-JK.js} +1 -1
  20. package/dist/public/assets/{DocumentContext-Ckj_fGkD.js → DocumentContext-Ce2jrrZM.js} +1 -1
  21. package/dist/public/assets/{EditorModeToggle-CQxeuGZ_.js → EditorModeToggle-DpldfDuY.js} +1 -1
  22. package/dist/public/assets/{EnableSyncConfirmDialog-CA01i92r.js → EnableSyncConfirmDialog-BD40jYPB.js} +1 -1
  23. package/dist/public/assets/{ExcalidrawDocEditor-D-ocWTWF.js → ExcalidrawDocEditor-DYjthBkp.js} +1 -1
  24. package/dist/public/assets/FeedbackForm-C5jyOOK8.js +1 -0
  25. package/dist/public/assets/{ImportSkillDialog-R3IhN3Zg.js → ImportSkillDialog-DlUE4xMR.js} +1 -1
  26. package/dist/public/assets/{LintConfigEditor-CXH61qO_.js → LintConfigEditor-CMb40sS3.js} +1 -1
  27. package/dist/public/assets/ManagedArtifactProperties-Bqjumbt5.js +1 -0
  28. package/dist/public/assets/{ManagedArtifactProperties-BdPi4vMO.js → ManagedArtifactProperties-DvfLdDaI.js} +1 -1
  29. package/dist/public/assets/{MermaidDocEditor-C12-umtW.js → MermaidDocEditor-DtgUtnxJ.js} +1 -1
  30. package/dist/public/assets/{PropertyDisplayRow-u_fa68vA.js → PropertyDisplayRow-keuAQPQN.js} +1 -1
  31. package/dist/public/assets/{SchemaConfigEditor-uitUtWhc.js → SchemaConfigEditor-DJC8iCyK.js} +1 -1
  32. package/dist/public/assets/{SessionsHost-3PDZonm6.js → SessionsHost-YiyoMDk5.js} +2 -2
  33. package/dist/public/assets/{SettingsDialogBody-Dlu-99dz.js → SettingsDialogBody-DLC4YQqo.js} +3 -3
  34. package/dist/public/assets/{ShareReceiveMissDialog-BZ0Lb3a2.js → ShareReceiveMissDialog-ap4bFNBa.js} +1 -1
  35. package/dist/public/assets/{SkillToolbarControls-BSHCQUbz.js → SkillToolbarControls-HlbPVAU5.js} +1 -1
  36. package/dist/public/assets/{SourceEditor-poDc1YYf.js → SourceEditor-BVS7qo5G.js} +1 -1
  37. package/dist/public/assets/{TerminalWindowApp-DxC0L8ej.js → TerminalWindowApp-D5YwfFOH.js} +1 -1
  38. package/dist/public/assets/{TextDocEditor-CNydPhYv.js → TextDocEditor-Cm1Rk7ny.js} +1 -1
  39. package/dist/public/assets/{ThreadView-3ZJAojtX.js → ThreadView-BPVZsQ5l.js} +1 -1
  40. package/dist/public/assets/{TimelineDiffPane-BNpCxl6F.js → TimelineDiffPane-YAy1OOxQ.js} +1 -1
  41. package/dist/public/assets/auth-state-cache-iQdJ_AHz.js +11 -0
  42. package/dist/public/assets/client-version-CMGzUGQE.js +1 -0
  43. package/dist/public/assets/{comment-chips-wepHZxJr.js → comment-chips-DmIwJ-wW.js} +1 -1
  44. package/dist/public/assets/{config-provider-CgevtbAS.js → config-provider-qcD7mGjX.js} +1 -1
  45. package/dist/public/assets/{doc-undo-manager-CKf9Alk-.js → doc-undo-manager-DJOkcu-w.js} +1 -1
  46. package/dist/public/assets/{index-Bjwwfhy7.js → index-D_nXtmmr.js} +9 -9
  47. package/dist/public/assets/messages-2CCeaXgq.js +1 -0
  48. package/dist/public/assets/messages-B5Cy4Veu.js +1 -0
  49. package/dist/public/assets/messages-BCR56nIb.js +1 -0
  50. package/dist/public/assets/messages-Bb4gjUnB.js +1 -0
  51. package/dist/public/assets/messages-Bo_5-aWE.js +1 -0
  52. package/dist/public/assets/messages-BsEqbtZD.js +1 -0
  53. package/dist/public/assets/messages-BuYjs7AI.js +1 -0
  54. package/dist/public/assets/messages-Cu2My5ex.js +1 -0
  55. package/dist/public/assets/messages-CzRLSOUe.js +1 -0
  56. package/dist/public/assets/messages-DxD6EViS.js +1 -0
  57. package/dist/public/assets/messages-ORxAvZuU.js +1 -0
  58. package/dist/public/assets/messages-Pop8iOQs.js +1 -0
  59. package/dist/public/assets/{pending-receive-nav-store-MCJgRMYe.js → pending-receive-nav-store-Dp-GJh6H.js} +1 -1
  60. package/dist/public/assets/{progress-DJjufkGx.js → progress-0bc15e77.js} +1 -1
  61. package/dist/public/assets/{selection-context-B8ZIL5JO.js → selection-context-QyOAcEgY.js} +1 -1
  62. package/dist/public/assets/{src-BElhG2ey.js → src-DhTYDBF3.js} +1 -1
  63. package/dist/public/assets/{telemetry-impl-G9GQmQGJ.js → telemetry-impl-8ZYvwPMn.js} +1 -1
  64. package/dist/public/assets/{telemetry-startup-CFqb8A-j.js → telemetry-startup-CyNQc5no.js} +1 -1
  65. package/dist/public/assets/{typing-burst-detector-ioDPbVRU.js → typing-burst-detector-CJQTOwN-.js} +1 -1
  66. package/dist/public/assets/{uninstall-DUwSv4xo.js → uninstall-D7J9l_Nx.js} +1 -1
  67. package/dist/public/assets/{use-activity-panel-L8e44D-R.js → use-activity-panel-mkYR166G.js} +1 -1
  68. package/dist/public/assets/{use-apply-config-language-B1_PbqOr.js → use-apply-config-language-CIgvKvgq.js} +2 -2
  69. package/dist/public/assets/{use-open-skill-CBFScxeq.js → use-open-skill-UUYljzC3.js} +1 -1
  70. package/dist/public/assets/{use-terminal-enabled-DJfeEdc9.js → use-terminal-enabled-D-QN86kl.js} +1 -1
  71. package/dist/public/assets/{use-timeline-entry-diff-C0-bJpxe.js → use-timeline-entry-diff-bJ09tm3c.js} +1 -1
  72. package/dist/public/index.html +19 -19
  73. package/dist/public/uninstall.html +3 -3
  74. package/dist/{registry-probes-DKj0WLeS.mjs → registry-probes-DckeILOy.mjs} +2 -2
  75. package/dist/{removal-file-path-DhT0omld.mjs → removal-file-path-BFu_FOlk.mjs} +1 -1
  76. package/dist/{repair-launch-json-CNzchJ8n.mjs → repair-launch-json-DMmLuuJS.mjs} +1 -1
  77. package/dist/{repair-mcp-configs-DaUjejVb.mjs → repair-mcp-configs-CuM0zUY4.mjs} +1 -1
  78. package/dist/src-CFwCZ01D.mjs +11 -0
  79. package/dist/src-CH-N8Aye.mjs +1 -0
  80. package/dist/start-BHgaCGiL.mjs +1 -0
  81. package/dist/{start-pHLrP0Fc.mjs → start-CJt2OxMi.mjs} +3 -3
  82. package/package.json +4 -4
  83. package/dist/constants-D-4RXqyQ.mjs +0 -1
  84. package/dist/init-F7KLTwk5.mjs +0 -1
  85. package/dist/loader-CtwQlMad.mjs +0 -1
  86. package/dist/preview-DlQPs5AD.mjs +0 -1
  87. package/dist/public/assets/FeedbackForm-BlgbTCeE.js +0 -1
  88. package/dist/public/assets/ManagedArtifactProperties-DVepOHzB.js +0 -1
  89. package/dist/public/assets/auth-state-cache-viUmuSBS.js +0 -11
  90. package/dist/public/assets/client-version-Dpo5n_gA.js +0 -1
  91. package/dist/public/assets/messages-8o9dkJJ8.js +0 -1
  92. package/dist/public/assets/messages-BApjWZBM.js +0 -1
  93. package/dist/public/assets/messages-BKwDlgqX.js +0 -1
  94. package/dist/public/assets/messages-BcN2AMRx.js +0 -1
  95. package/dist/public/assets/messages-BvWDj_ta.js +0 -1
  96. package/dist/public/assets/messages-C5r4coom.js +0 -1
  97. package/dist/public/assets/messages-CDBtIcly.js +0 -1
  98. package/dist/public/assets/messages-DToR3YWR.js +0 -1
  99. package/dist/public/assets/messages-DY_W63qi.js +0 -1
  100. package/dist/public/assets/messages-DaESnN9t.js +0 -1
  101. package/dist/public/assets/messages-DnLgXawv.js +0 -1
  102. package/dist/public/assets/messages-oUlW9lVw.js +0 -1
  103. package/dist/src-JVd8AAVk.mjs +0 -11
  104. package/dist/src-db54VFgM.mjs +0 -1
  105. package/dist/start-CMHGAxEf.mjs +0 -1
@@ -541,7 +541,7 @@ $2`).split(`
541
541
  `?(c+=1,l=1):l+=1;return{line:c,column:l}};for(let e of o.matchAll(Uue)){let{index:i}=e;if((a===void 0?o[i-1]:n[a+i-1])===`!`)continue;let s=r&&a!==void 0?{start:u(i),end:u(i+e[0].length)}:void 0;t.message(Wue(e[0]),s)}})}),Kue=[`index`,`log`],que=S5(`reserved-casing`,(e,t)=>{let n=t.data.okfDocName;if(n===void 0)return;let r=B0(n),i=r.toLowerCase();Kue.includes(i)&&r!==i&&t.message(`This file is named "${r}", but the Open Knowledge Format only recognizes "${i}". On a case-sensitive filesystem a consumer reads it as an ordinary concept document rather than the reserved file it is meant to be.`)}),E5=[{id:`no-wiki-links`,rule:Gue},{id:`log-shape`,rule:Hue},{id:`index-shape`,rule:Rue},{id:`reserved-casing`,rule:que}],Jue=E5.map(e=>e.rule);function Yue(e){return e===void 0?Jue:E5.filter(t=>h5(e,t.id)).map(e=>e.rule)}const Xue=to([P(),L(Ad),so(M(),qa())]),Zue={id:`markdownlint`,sliceSchema:I({enabled:P(),rules:so(M(),Xue)}),defaultSlice:{enabled:!1,rules:Q8},async lint(e,t){return yue(e,$8(t.rules))},fix(e,t){return vue(e,$8(t.rules))}},Que=I({appliesTo:to([M(),F(M())]).optional(),file:M(),enabled:P().optional(),key:M().optional(),schema:so(M(),qa()).optional()}),D5=[Zue,{id:`frontmatter`,sliceSchema:I({enabled:P(),schemas:F(Que)}),defaultSlice:{enabled:!1,schemas:[]},async lint(e,t,n){return m5(e,n5(t.schemas,n.docName))},frontmatter:{schemasForDoc:(e,t)=>n5(e.schemas,t),narrowSliceToFrontmatter:e=>e,advertisedMappings:e=>e.schemas}},{id:`okf`,sliceSchema:I({enabled:P(),rules:so(M(),P()).optional(),generate:I({index:P().optional()}).optional()}),defaultSlice:{enabled:!1},async lint(e,t,n){return[...Iue(e,Yue(t.rules),n.docName),...Nue(e,t.rules,n.docName)]},frontmatter:{schemasForDoc:(e,t)=>x5(e.rules,t),narrowSliceToFrontmatter:e=>({...e,rules:{...e.rules,...jue}}),advertisedMappings:e=>Mue(e.rules)}}],$ue={enabled:!0,plugins:Object.fromEntries(D5.map(e=>[e.id,e.defaultSlice]))};function O5(e,t){return e.enabled&&e.plugins[t]?.enabled===!0}function ede(e){if(!e?.enabled)return[];let t=[];for(let n of D5){if(n.frontmatter===void 0)continue;let r=e.plugins[n.id];r?.enabled===!0&&t.push(...n.frontmatter.advertisedMappings(r))}return t}const tde=I({docName:j4,summary:P4,content:M().optional(),...N4}).loose(),nde=I({docName:j4,summary:P4,markdown:M(),position:L([`append`,`prepend`,`replace`]).optional(),extension:L(C0).optional(),...N4}).loose(),rde=I({docName:j4,summary:P4,find:M().min(1),replace:M(),offset:N().int().nonnegative().optional(),...N4}).loose(),ide=I({docName:j4,connectionId:M().min(1),scope:L([`last`,`session`,`file`,`count`]).optional(),count:N().int().positive().optional(),...N4}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]}),k5=I({value:M(),truncatedFrom:N().int().nonnegative().optional(),hint:M().optional()}).loose(),ade=ro(`kind`,[I({kind:R(`inline`),content:M()}),I({kind:R(`truncated`),byteLength:N().int().nonnegative(),hint:M()})]),A5=I({kind:R(`content-divergence`),intendedBytes:N().int().nonnegative(),actualBytes:N().int().nonnegative(),byteDelta:N().int(),divergenceType:M().optional(),currentState:ade.optional(),hint:M().optional()}).loose(),ode=I({type:R(`orphan`),parentCandidates:F(M()),message:M()}).loose(),j5=I({kind:R(`disk-edit-reconciled`),intendedBytes:N().int().nonnegative(),actualBytes:N().int().nonnegative(),byteDelta:N().int(),mergeOutcome:M().optional(),hint:M().optional()}).loose();ro(`kind`,[A5,j5]);const M5=Object.keys({"content-divergence":!0,"disk-edit-reconciled":!0});function sde(e){return M5.includes(e)}function cde(e){throw Error(`Unexpected WriteWarning variant: ${JSON.stringify(e)}`)}const lde=I({kind:R(`mermaid-parse-error`),fenceIndex:N().int().positive(),fenceFirstLine:M(),message:M(),line:N().int().positive().optional()}).loose(),N5=I({href:M(),targetKind:M(),role:M(),sourceForm:M(),resolvedTarget:M().nullable(),reason:M(),resolutionMethod:M(),fallbackTarget:M().nullable().optional(),definition:I({line:N().int().nonnegative(),label:M()}).loose().optional()}).loose(),P5=ro(`kind`,[A5,j5,lde,I({kind:R(`lint-violation`),source:M(),code:M(),message:M(),severity:L([`error`,`warning`,`info`,`hint`]),line:N().int().positive(),column:N().int().positive(),linkTarget:M().optional(),localTarget:N5.optional()}).loose()]),F5=F(P5).min(1),I5=I({href:M(),resolvedTo:M().nullable(),reason:L([`no-such-doc`,`no-such-file`,`unresolvable`]),localTarget:N5.optional()}).loose(),L5=F(I5),ude=[`reserved-log-policy`],R5=I({reason:M().min(1),count:N().int().positive()}).loose(),dde=I({timestamp:M().min(1),summary:k5.optional(),warnings:F5.optional()}).loose(),fde=I({timestamp:M().min(1),subscriberCount:N().int().nonnegative(),systemSubscriberCount:N().int().nonnegative(),hints:F(ode).optional(),summary:k5.optional(),warnings:F5.optional(),brokenLinks:L5,brokenLinkSuppression:R5.optional()}).loose(),pde=I({timestamp:M().min(1),subscriberCount:N().int().nonnegative(),systemSubscriberCount:N().int().nonnegative(),summary:k5.optional(),warnings:F5.optional(),brokenLinks:L5,brokenLinkSuppression:R5.optional()}).loose(),mde=I({docName:M().min(1),scope:L([`last`,`session`,`count`]),undone:P()}).loose(),hde=I({docs:F(I({docName:M4,markdown:M(),position:L([`append`,`prepend`,`replace`]).optional(),extension:L(C0).optional(),summary:P4}).loose()).min(1).max(100),...N4}).loose(),gde=I({type:l3,title:M(),detail:M().optional()}).loose(),_de=ro(`status`,[I({status:R(`written`),docName:M().min(1),summary:k5.optional(),warnings:F5.optional(),brokenLinks:L5,brokenLinkSuppression:R5.optional()}).loose(),I({status:R(`error`),docName:M().min(1),error:gde}).loose()]),vde=I({timestamp:M().min(1),results:F(_de),written:N().int().nonnegative(),failed:N().int().nonnegative()}).loose(),yde=I({docName:j4,patch:so(M(),to([Hc,Ua()])),types:so(M(),L(zc)).optional(),summary:P4,...N4}).loose(),bde=I({timestamp:M().min(1),subscriberCount:N().int().nonnegative(),systemSubscriberCount:N().int().nonnegative(),appliedKeys:F(M()),summary:k5.optional(),warnings:F5.optional(),brokenLinks:L5,brokenLinkSuppression:R5.optional()}).loose();function xde(e){return{enabled:e.enabled??!0,plugins:{markdownlint:{...e.markdownlint,rules:e.markdownlint.rules??Q8},frontmatter:{enabled:e.frontmatter?.enabled??!1,schemas:e.frontmatter?.schemas??[]},okf:{enabled:e.okf?.enabled??!1,...e.okf?.rules===void 0?{}:{rules:e.okf.rules},generate:{index:e.okf?.generate?.index??!1}}}}}const Sde=Object.fromEntries(D5.map(e=>[e.id,e.sliceSchema])),Cde=I({effective:I({enabled:P(),plugins:I(Sde)}),configFile:M().nullable().optional(),configProblems:F(M()).optional()}),wde=to([P(),so(M(),qa())]),Tde=I({ruleId:M().min(1).max(64).regex(/^[A-Za-z][A-Za-z0-9_-]*$/),value:to([wde,Ua()])}),Ede=I({file:M().min(1).max(512),delete:R(!0).optional(),field:M().min(1).max(256).optional(),parentPath:F(to([M().min(1).max(256),I({items:R(!0)}).strict()])).max(8).optional(),removeField:R(!0).optional(),renameTo:M().min(1).max(256).optional(),constraint:I({type:L([`string`,`number`,`boolean`,`array`,`object`]).nullable().optional(),enum:F(to([M(),N(),P()])).nullable().optional(),itemsEnum:F(to([M(),N(),P()])).nullable().optional(),itemsType:L([`string`,`number`,`boolean`,`object`]).nullable().optional(),pattern:M().nullable().optional(),format:M().nullable().optional(),description:M().max(2048).nullable().optional(),required:P().optional()}).optional()}).refine(e=>e.delete===void 0||e.field===void 0&&e.constraint===void 0&&e.removeField===void 0&&e.renameTo===void 0,{message:`delete cannot be combined with a field edit`}).refine(e=>[e.constraint,e.removeField,e.renameTo].filter(e=>e!==void 0).length<=1,{message:`constraint, removeField, and renameTo are mutually exclusive`}).refine(e=>e.removeField===void 0&&e.renameTo===void 0||e.field!==void 0,{message:`removeField and renameTo require field`}).refine(e=>e.parentPath===void 0||e.field!==void 0,{message:`parentPath requires field`}).refine(e=>e.field===void 0?e.constraint===void 0:e.constraint!==void 0||e.removeField!==void 0||e.renameTo!==void 0,{message:`field requires constraint, removeField, or renameTo`}),Dde=I({schemas:F(M()),truncated:P()}).strict(),z5=I({line:N(),character:N()}),B5=I({start:z5,end:z5}),V5=I({range:B5,severity:L([`error`,`warning`,`info`,`hint`]),source:M(),code:M(),message:M(),fixes:F(I({range:B5,newText:M()})).optional(),frontmatterScope:L(Dd).optional(),frontmatterProperty:M().optional()}),H5=F(M()).optional(),U5=I({file:M(),diagnostics:F(V5),ran:H5,warnings:F(M()).optional()}),Ode=I({files:F(U5),fileCount:N(),errorCount:N(),warningCount:N(),warnings:F(M()),ran:H5}),kde=V5.extend({linkTarget:M().optional(),localTarget:N5.optional()}),Ade=I({files:F(I({file:M(),diagnostics:F(kde)})),fileCount:N(),errorCount:N(),warningCount:N(),warnings:F(M()),ran:H5,brokenLinkSuppression:R5.optional()}),W5=I({errorCount:N().int().nonnegative(),warningCount:N().int().nonnegative()}),jde=I({files:F(I({file:M(),lint:W5,links:W5})),fileCount:N().int().nonnegative(),errorCount:N().int().nonnegative(),warningCount:N().int().nonnegative(),warnings:F(M()),brokenLinkSuppression:R5.optional()}),Mde=I({docName:j4,summary:P4,...N4}).loose(),G5=`Re-lint after fix failed: `;function Nde(e){return e.startsWith(G5)}const K5=[`re-lint-threw`,`source-went-blind`];function Pde(e){return typeof e==`string`&&K5.includes(e)}const q5=I({reason:L(K5),message:M().min(1)}),Fde=I({file:M(),fixedCount:N(),diagnostics:F(V5),errorCount:N(),warningCount:N(),ran:H5,warnings:F(M()).optional(),diagnosticsArePreFix:P().optional(),reLintFailure:q5.optional()});function J5(){let e=r5[a5];return`${JSON.stringify({$schema:e,type:`object`},null,2)}\n`}function Ide(e){let t=e.trim().replace(/^\.\//,``);if(!t.startsWith(`.ok/schemas/`))return!1;let n=t.slice(12);return n.length>0&&!n.includes(`/`)&&!n.includes(`\\`)&&n!==`.`&&n!==`..`}function Lde(e){let t=e.trim().toLowerCase().split(`/`).pop()??``;return t.endsWith(`.schema.json`)&&t.length>12?!0:Ide(e)&&t.endsWith(`.json`)}var Y5=class extends Error{};function X5(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Z5(e,t,n){let r=e;for(let e of t){if(typeof e!=`string`){let e=r.items;if(e===void 0){if(!n)throw new Y5(`field path items does not exist`);let e={type:`object`};r.items=e,r=e;continue}if(!X5(e))throw new Y5(`field path items is not an object sub-schema`);r=e;continue}let t=$5(r),i=t[e];if(i===void 0){if(!n)throw new Y5(`field path ${JSON.stringify(e)} does not exist`);let i={type:`object`};r.properties={...t,[e]:i},r=i;continue}if(!X5(i))throw new Y5(`field path ${JSON.stringify(e)} is not an object property`);r=i}return r}function Rde(e,t,n,r=[]){let i;i=e.trim()===``?JSON.parse(J5()):Q5(e);let a=Z5(i,r,!0),o=$5(a),s={...X5(o[t])?o[t]:{}};for(let e of[`type`,`enum`,`pattern`,`format`,`description`]){if(!(e in n))continue;let t=n[e];t==null?delete s[e]:s[e]=t}if(`itemsEnum`in n||`itemsType`in n){if(s.items!==void 0&&!X5(s.items))throw new Y5(`field path items is not an object sub-schema`);let e=X5(s.items)?{...s.items}:{};`itemsEnum`in n&&(n.itemsEnum===null||n.itemsEnum===void 0?delete e.enum:e.enum=n.itemsEnum),`itemsType`in n&&(n.itemsType===null||n.itemsType===void 0?delete e.type:e.type=n.itemsType),Object.keys(e).length>0?s.items=e:delete s.items}if(Object.keys(s).length>0)a.properties={...o,[t]:s};else if(t in o){let{[t]:e,...n}=o;Object.keys(n).length>0?a.properties=n:delete a.properties}if(n.required!==void 0){let e=e7(a),r=e.includes(t);n.required&&!r?a.required=[...e,t]:!n.required&&r&&t7(a,e.filter(e=>e!==t))}return`${JSON.stringify(i,null,2)}\n`}function Q5(e){let t;try{t=JSON.parse(e)}catch(e){throw new Y5(`schema is not valid JSON (${e instanceof Error?e.message:String(e)})`)}if(!X5(t))throw new Y5(`schema is not a JSON object`);return t}function $5(e){return X5(e.properties)?e.properties:{}}function e7(e){return Array.isArray(e.required)?e.required.filter(e=>typeof e==`string`):[]}function t7(e,t){t.length>0?e.required=t:delete e.required}function zde(e,t,n=[]){let r=Q5(e),i=Z5(r,n,!1),a=$5(i);if(t in a){let{[t]:e,...n}=a;Object.keys(n).length>0?i.properties=n:delete i.properties}return t7(i,e7(i).filter(e=>e!==t)),`${JSON.stringify(r,null,2)}\n`}function Bde(e,t,n,r=[]){let i=Q5(e),a=Z5(i,r,!1),o=$5(a);if(!(t in o))throw new Y5(`field ${JSON.stringify(t)} does not exist`);if(n in o)throw new Y5(`field ${JSON.stringify(n)} already exists`);let s={};for(let[e,r]of Object.entries(o))s[e===t?n:e]=r;return a.properties=s,t7(a,e7(a).map(e=>e===t?n:e)),`${JSON.stringify(i,null,2)}\n`}function Vde(){return b5.map(e=>({path:`${g5}/${_5(e.id)}`,ruleId:e.id,contents:`${JSON.stringify({$comment:"Generated by the OpenKnowledge `okf` lint plugin — do not edit. The plugin validates from its own compiled copy and never reads this file, so changes here have no effect and are overwritten when the server restarts. This describes an external format (Google’s Open Knowledge Format); to change what is enforced, change the rule toggles under Settings → this project → Plugins → OKF.",...e.schema},null,2)}\n`}))}function n7(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?{stem:t,ext:``}:{stem:t.slice(0,n),ext:t.slice(n)}}function Hde(e){let t=new Set(e.filter(e=>n7(e).ext.toLowerCase()===`.md`).map(e=>e.slice(0,e.lastIndexOf(`.`)))),n=[];for(let r of e){if(n7(r).ext.toLowerCase()!==`.mdx`)continue;let e=r.slice(0,r.lastIndexOf(`.`)),i=`"${r}" won't be picked up by an Open Knowledge Format consumer — the format is .md-only, and nothing scanning for .md files will open an .mdx.`;n.push({file:r,code:`project-no-mdx`,message:t.has(e)?`${i} It is also shadowed by "${e}.md", so a consumer reads that file instead and gets different content than this project shows you.`:i})}return n}const Ude=[{id:`project-no-mdx`,run:Hde}];function Wde(e,t){let n=e.filter(e=>C0.some(t=>e.toLowerCase().endsWith(t)));return n.length===0?[]:Ude.filter(e=>h5(t,e.id)).flatMap(e=>e.run(n))}function r7(e){return`source "${e.source}" ${e.phase} failed`}function Gde(e){let t=e.docName===void 0?``:` on "${e.docName}"`;return`${r7(e)}${t}: ${e.message}`}function Kde(e){let t=new Map;for(let n of e){let e=[n.source,n.phase,n.message].join(`\0`),r=t.get(e)??{first:n,docNames:new Set};n.docName!==void 0&&r.docNames.add(n.docName),t.set(e,r)}return[...t.values()].map(({first:e,docNames:t})=>t.size<=1?Gde(e):`${r7(e)} on ${t.size} documents (first: "${e.docName}"): ${e.message}`)}const qde=[{id:`MD001`,alias:`heading-increment`,aliases:[`heading-increment`],name:`Heading levels should only increment by one level at a time`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md001.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`}]},{id:`MD003`,alias:`heading-style`,aliases:[`heading-style`],name:`Heading style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md003.md`,tags:[`headings`],options:[{key:`style`,type:`enum`,description:`Heading style`,enum:[`consistent`,`atx`,`atx_closed`,`setext`,`setext_with_atx`,`setext_with_atx_closed`],default:`consistent`}]},{id:`MD004`,alias:`ul-style`,aliases:[`ul-style`],name:`Unordered list style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md004.md`,tags:[`bullet`,`ul`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`consistent`,`asterisk`,`plus`,`dash`,`sublist`],default:`consistent`}]},{id:`MD005`,alias:`list-indent`,aliases:[`list-indent`],name:`Inconsistent indentation for list items at the same level`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md005.md`,tags:[`bullet`,`ul`,`indentation`],options:[]},{id:`MD007`,alias:`ul-indent`,aliases:[`ul-indent`],name:`Unordered list indentation`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md007.md`,tags:[`bullet`,`ul`,`indentation`],options:[{key:`indent`,type:`integer`,description:`Spaces for indent`,default:2,minimum:1},{key:`start_indented`,type:`boolean`,description:`Whether to indent the first level of the list`,default:!1},{key:`start_indent`,type:`integer`,description:`Spaces for first level indent (when start_indented is set)`,default:2,minimum:1}]},{id:`MD009`,alias:`no-trailing-spaces`,aliases:[`no-trailing-spaces`],name:`Trailing spaces`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md009.md`,tags:[`whitespace`],options:[{key:`br_spaces`,type:`integer`,description:`Spaces for line break`,default:2,minimum:0},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!1},{key:`list_item_empty_lines`,type:`boolean`,description:`Allow spaces for empty lines in list items`,default:!1},{key:`strict`,type:`boolean`,description:`Include unnecessary breaks`,default:!1}]},{id:`MD010`,alias:`no-hard-tabs`,aliases:[`no-hard-tabs`],name:`Hard tabs`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md010.md`,tags:[`whitespace`,`hard_tab`],options:[{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`ignore_code_languages`,type:`string-array`,description:`Fenced code languages to ignore`,default:[]},{key:`spaces_per_tab`,type:`integer`,description:`Number of spaces for each hard tab`,default:1,minimum:0}]},{id:`MD011`,alias:`no-reversed-links`,aliases:[`no-reversed-links`],name:`Reversed link syntax`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md011.md`,tags:[`links`],options:[]},{id:`MD012`,alias:`no-multiple-blanks`,aliases:[`no-multiple-blanks`],name:`Multiple consecutive blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md012.md`,tags:[`whitespace`,`blank_lines`],options:[{key:`maximum`,type:`integer`,description:`Consecutive blank lines`,default:1,minimum:1}]},{id:`MD013`,alias:`line-length`,aliases:[`line-length`],name:`Line length`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md013.md`,tags:[`line_length`],options:[{key:`line_length`,type:`integer`,description:`Number of characters`,default:80,minimum:1},{key:`heading_line_length`,type:`integer`,description:`Number of characters for headings`,default:80,minimum:1},{key:`code_block_line_length`,type:`integer`,description:`Number of characters for code blocks`,default:80,minimum:1},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`tables`,type:`boolean`,description:`Include tables`,default:!0},{key:`headings`,type:`boolean`,description:`Include headings`,default:!0},{key:`strict`,type:`boolean`,description:`Strict length checking`,default:!1},{key:`stern`,type:`boolean`,description:`Stern length checking`,default:!1}]},{id:`MD014`,alias:`commands-show-output`,aliases:[`commands-show-output`],name:`Dollar signs used before commands without showing output`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md014.md`,tags:[`code`],options:[]},{id:`MD018`,alias:`no-missing-space-atx`,aliases:[`no-missing-space-atx`],name:`No space after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md018.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD019`,alias:`no-multiple-space-atx`,aliases:[`no-multiple-space-atx`],name:`Multiple spaces after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md019.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD020`,alias:`no-missing-space-closed-atx`,aliases:[`no-missing-space-closed-atx`],name:`No space inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md020.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD021`,alias:`no-multiple-space-closed-atx`,aliases:[`no-multiple-space-closed-atx`],name:`Multiple spaces inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md021.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD022`,alias:`blanks-around-headings`,aliases:[`blanks-around-headings`],name:`Headings should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md022.md`,tags:[`headings`,`blank_lines`],options:[{key:`include_front_matter`,type:`boolean`,description:`Include front matter content`,default:!1},{key:`lines_above`,type:`unsupported`,description:`Blank lines above heading`,default:1},{key:`lines_below`,type:`unsupported`,description:`Blank lines below heading`,default:1}]},{id:`MD023`,alias:`heading-start-left`,aliases:[`heading-start-left`],name:`Headings must start at the beginning of the line`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md023.md`,tags:[`headings`,`spaces`],options:[]},{id:`MD024`,alias:`no-duplicate-heading`,aliases:[`no-duplicate-heading`],name:`Multiple headings with the same content`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md024.md`,tags:[`headings`],options:[{key:`siblings_only`,type:`boolean`,description:`Only check sibling headings`,default:!1}]},{id:`MD025`,alias:`single-title`,aliases:[`single-title`,`single-h1`],name:`Multiple top-level headings in the same document`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md025.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD026`,alias:`no-trailing-punctuation`,aliases:[`no-trailing-punctuation`],name:`Trailing punctuation in heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md026.md`,tags:[`headings`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!。,;:!`}]},{id:`MD027`,alias:`no-multiple-space-blockquote`,aliases:[`no-multiple-space-blockquote`],name:`Multiple spaces after blockquote symbol`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md027.md`,tags:[`indentation`,`whitespace`,`blockquote`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD028`,alias:`no-blanks-blockquote`,aliases:[`no-blanks-blockquote`],name:`Blank line inside blockquote`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md028.md`,tags:[`whitespace`,`blockquote`],options:[]},{id:`MD029`,alias:`ol-prefix`,aliases:[`ol-prefix`],name:`Ordered list item prefix`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md029.md`,tags:[`ol`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`one`,`ordered`,`one_or_ordered`,`zero`],default:`one_or_ordered`}]},{id:`MD030`,alias:`list-marker-space`,aliases:[`list-marker-space`],name:`Spaces after list markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md030.md`,tags:[`ul`,`whitespace`,`ol`],options:[{key:`ul_single`,type:`integer`,description:`Spaces for single-line unordered list items`,default:1,minimum:1},{key:`ol_single`,type:`integer`,description:`Spaces for single-line ordered list items`,default:1,minimum:1},{key:`ul_multi`,type:`integer`,description:`Spaces for multi-line unordered list items`,default:1,minimum:1},{key:`ol_multi`,type:`integer`,description:`Spaces for multi-line ordered list items`,default:1,minimum:1}]},{id:`MD031`,alias:`blanks-around-fences`,aliases:[`blanks-around-fences`],name:`Fenced code blocks should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md031.md`,tags:[`blank_lines`,`code`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD032`,alias:`blanks-around-lists`,aliases:[`blanks-around-lists`],name:`Lists should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md032.md`,tags:[`bullet`,`ul`,`blank_lines`,`ol`],options:[]},{id:`MD033`,alias:`no-inline-html`,aliases:[`no-inline-html`],name:`Inline HTML`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md033.md`,tags:[`html`],options:[{key:`allowed_elements`,type:`string-array`,description:`Allowed elements`,default:[]},{key:`table_allowed_elements`,type:`string-array`,description:`Allowed elements in tables`,default:[]}]},{id:`MD034`,alias:`no-bare-urls`,aliases:[`no-bare-urls`],name:`Bare URL used`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md034.md`,tags:[`links`,`url`],options:[]},{id:`MD035`,alias:`hr-style`,aliases:[`hr-style`],name:`Horizontal rule style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md035.md`,tags:[`hr`],options:[{key:`style`,type:`string`,description:`Horizontal rule style`,default:`consistent`}]},{id:`MD036`,alias:`no-emphasis-as-heading`,aliases:[`no-emphasis-as-heading`],name:`Emphasis used instead of a heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md036.md`,tags:[`headings`,`emphasis`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!?。,;:!?`}]},{id:`MD037`,alias:`no-space-in-emphasis`,aliases:[`no-space-in-emphasis`],name:`Spaces inside emphasis markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md037.md`,tags:[`whitespace`,`emphasis`],options:[]},{id:`MD038`,alias:`no-space-in-code`,aliases:[`no-space-in-code`],name:`Spaces inside code span elements`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md038.md`,tags:[`whitespace`,`code`],options:[]},{id:`MD039`,alias:`no-space-in-links`,aliases:[`no-space-in-links`],name:`Spaces inside link text`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md039.md`,tags:[`whitespace`,`links`],options:[]},{id:`MD040`,alias:`fenced-code-language`,aliases:[`fenced-code-language`],name:`Fenced code blocks should have a language specified`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md040.md`,tags:[`code`,`language`],options:[{key:`allowed_languages`,type:`string-array`,description:`List of languages`,default:[]},{key:`language_only`,type:`boolean`,description:`Require language only`,default:!1}]},{id:`MD041`,alias:`first-line-heading`,aliases:[`first-line-heading`,`first-line-h1`],name:`First line in a file should be a top-level heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md041.md`,tags:[`headings`],options:[{key:`allow_preamble`,type:`boolean`,description:`Allow content before first heading`,default:!1},{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD042`,alias:`no-empty-links`,aliases:[`no-empty-links`],name:`No empty links`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md042.md`,tags:[`links`],options:[]},{id:`MD043`,alias:`required-headings`,aliases:[`required-headings`],name:`Required heading structure`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md043.md`,tags:[`headings`],options:[{key:`headings`,type:`string-array`,description:`List of headings`,default:[]},{key:`match_case`,type:`boolean`,description:`Match case of headings`,default:!1}]},{id:`MD044`,alias:`proper-names`,aliases:[`proper-names`],name:`Proper names should have the correct capitalization`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md044.md`,tags:[`spelling`],options:[{key:`names`,type:`string-array`,description:`List of proper names`,default:[]},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`html_elements`,type:`boolean`,description:`Include HTML elements`,default:!0}]},{id:`MD045`,alias:`no-alt-text`,aliases:[`no-alt-text`],name:`Images should have alternate text (alt text)`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md045.md`,tags:[`accessibility`,`images`],options:[]},{id:`MD046`,alias:`code-block-style`,aliases:[`code-block-style`],name:`Code block style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md046.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Block style`,enum:[`consistent`,`fenced`,`indented`],default:`consistent`}]},{id:`MD047`,alias:`single-trailing-newline`,aliases:[`single-trailing-newline`],name:`Files should end with a single newline character`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md047.md`,tags:[`blank_lines`],options:[]},{id:`MD048`,alias:`code-fence-style`,aliases:[`code-fence-style`],name:`Code fence style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md048.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Code fence style`,enum:[`consistent`,`backtick`,`tilde`],default:`consistent`}]},{id:`MD049`,alias:`emphasis-style`,aliases:[`emphasis-style`],name:`Emphasis style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md049.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Emphasis style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD050`,alias:`strong-style`,aliases:[`strong-style`],name:`Strong style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md050.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Strong style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD051`,alias:`link-fragments`,aliases:[`link-fragments`],name:`Link fragments should be valid`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md051.md`,tags:[`links`],options:[{key:`ignore_case`,type:`boolean`,description:`Ignore case of fragments`,default:!1},{key:`ignored_pattern`,type:`string`,description:`Pattern for ignoring additional fragments`,default:``}]},{id:`MD052`,alias:`reference-links-images`,aliases:[`reference-links-images`],name:`Reference links and images should use a label that is defined`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md052.md`,tags:[`links`,`images`],options:[{key:`ignored_labels`,type:`string-array`,description:`Ignored link labels`,default:[`x`]},{key:`shortcut_syntax`,type:`boolean`,description:`Include shortcut syntax`,default:!1}]},{id:`MD053`,alias:`link-image-reference-definitions`,aliases:[`link-image-reference-definitions`],name:`Link and image reference definitions should be needed`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md053.md`,tags:[`links`,`images`],options:[{key:`ignored_definitions`,type:`string-array`,description:`Ignored definitions`,default:[`//`]}]},{id:`MD054`,alias:`link-image-style`,aliases:[`link-image-style`],name:`Link and image style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md054.md`,tags:[`links`,`images`],options:[{key:`autolink`,type:`boolean`,description:`Allow autolinks`,default:!0},{key:`inline`,type:`boolean`,description:`Allow inline links and images`,default:!0},{key:`full`,type:`boolean`,description:`Allow full reference links and images`,default:!0},{key:`collapsed`,type:`boolean`,description:`Allow collapsed reference links and images`,default:!0},{key:`shortcut`,type:`boolean`,description:`Allow shortcut reference links and images`,default:!0},{key:`url_inline`,type:`boolean`,description:`Allow URLs as inline links`,default:!0}]},{id:`MD055`,alias:`table-pipe-style`,aliases:[`table-pipe-style`],name:`Table pipe style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table pipe style`,enum:[`consistent`,`leading_only`,`trailing_only`,`leading_and_trailing`,`no_leading_or_trailing`],default:`consistent`}]},{id:`MD056`,alias:`table-column-count`,aliases:[`table-column-count`],name:`Table column count`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md056.md`,tags:[`table`],options:[]},{id:`MD058`,alias:`blanks-around-tables`,aliases:[`blanks-around-tables`],name:`Tables should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md058.md`,tags:[`table`],options:[]},{id:`MD059`,alias:`descriptive-link-text`,aliases:[`descriptive-link-text`],name:`Link text should be descriptive`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md059.md`,tags:[`links`,`accessibility`],options:[{key:`prohibited_texts`,type:`string-array`,description:`Prohibited link texts`,default:[`click here`,`here`,`link`,`more`]}]},{id:`MD060`,alias:`table-column-style`,aliases:[`table-column-style`],name:`Table column style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md060.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table column style`,enum:[`any`,`aligned`,`compact`,`tight`],default:`any`},{key:`aligned_delimiter`,type:`boolean`,description:`Aligned delimiter columns`,default:!1}]}],Jde=(()=>{let e=new Map;for(let t of qde){e.set(t.id.toUpperCase(),t.id);for(let n of t.aliases)e.set(n.toUpperCase(),t.id)}return e})();function i7(e){return Jde.get(e.toUpperCase())??null}function Yde(e,t){let n=i7(t);if(n===null)return;let r;for(let[t,i]of Object.entries(e))i7(t)===n&&(r={key:t,value:i});return r}function Xde(e){let t={lint:{errorCount:0,warningCount:0},links:{errorCount:0,warningCount:0}};for(let n of e){let e=n.source===`links`?t.links:t.lint;n.severity===`error`?e.errorCount+=1:e.warningCount+=1}return t}function Zde(e,t){let n=D5.filter(t=>O5(e,t.id)).map(e=>e.id);return t.mode===`audit`&&t.linksValidation!==`off`&&n.push(`links`),n}function Qde(e){return e===void 0?[]:e.length===0?[`No checks ran.`]:[`Checks run: ${e.join(`, `)}.`]}async function $de(e,t,n,r){if(!t.enabled)return[];let i=[];for(let a of D5){if(!O5(t,a.id))continue;let o=t.plugins[a.id];try{i.push(...await a.lint(e,o,{docName:n}))}catch(e){console.warn(`[lint] plugin "${a.id}" failed${n?` on "${n}"`:``}`,e),r?.({source:a.id,phase:`lint`,...n===void 0?{}:{docName:n},message:a7(e)})}}return i}function efe(e,t,n,r){if(!t.enabled)return e;let i=e;for(let e of D5){if(!O5(t,e.id)||!e.fix)continue;let a=t.plugins[e.id];try{i=e.fix(i,a)}catch(t){console.warn(`[lint] plugin "${e.id}" fix failed${n?` on "${n}"`:``}`,t),r?.({source:e.id,phase:`fix`,...n===void 0?{}:{docName:n},message:a7(t)})}}return i}function a7(e){let t=o7(e);return t.length>500?`${t.slice(0,500)}… (truncated)`:t}function o7(e,t=0){if(e instanceof Error)return e.cause===void 0||t>=3?e.message:`${e.message} (cause: ${o7(e.cause,t+1)})`;if(typeof e==`object`&&e)try{let t=JSON.stringify(e);if(t!==void 0)return t}catch{}return String(e)}const tfe=/\p{M}+/gu,nfe=/[^\p{L}\p{N}]+/gu,rfe=/^-+|-+$/g;function s7(e){return e.trim().normalize(`NFKD`).replace(tfe,``).toLowerCase().replace(nfe,`-`).replace(rfe,``)}function ife(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function afe(e,t){let n=s7(e);return n?ife(n,t):``}const ofe=new Set([`img`,`video`,`audio`,`mark`,`u`,`ins`]);new Map(L3.flatMap(e=>e.surface===`compat`&&ofe.has(e.rendersAs)?[[e.name,e]]:[])),Nie(`<>`);const c7=[{tagName:`Mirror`,attrName:`src`,resolution:`bare-doc-name`},{tagName:`Excalidraw`,attrName:`src`,resolution:`doc-relative`}];for(let e of c7){let t=L3.find(t=>t.name===e.tagName);if(!t)throw Error(`JSX_SRC_REF_TAGS: no built-in component descriptor named '${e.tagName}' — the rename-rewrite and backlink passes for this entry would silently never match. Fix the tagName to match a descriptor in builtInComponents.`);if(!t.props.some(t=>t.name===e.attrName))throw Error(`JSX_SRC_REF_TAGS: component '${e.tagName}' declares no prop named '${e.attrName}' — the rename-rewrite and backlink passes for this entry would silently never match. Fix the attrName to match one of the descriptor's props.`)}const sfe=zB(),cfe=rB(),lfe=iB();function ufe(){return L3.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function l7(){return ufe().filter(e=>{let t=u7(e);return t!==`fence`&&t!==`html`})}function u7(e){return e.name===`MermaidFence`?`fence`:e.name===`HtmlAlignBlock`?`html`:e.hasChildren?`jsx-block`:`jsx-void`}function d7(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:u7(e)}}function dfe(e){if(e.hidden!==!0&&e.type!==`reactnode`){if(`defaultValue`in e&&e.defaultValue!==void 0)return e.defaultValue;if(e.type===`enum`)return e.enumValues[0];if(e.type===`string`)return``;if(e.type===`number`)return 0;if(e.type===`boolean`)return!1}}function ffe(e,t){return!(e.omitOnDefault===!0&&`defaultValue`in e&&Object.is(e.defaultValue,t)||e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&t===``)}function pfe(e){let t=[];for(let n of e.props){let e=dfe(n);e!==void 0&&ffe(n,e)&&t.push(g3(n.name,e))}return t}function mfe(e){return LO(e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`Body content here.`,{extensions:[sfe],mdastExtensions:[cfe]}).children}function hfe(e){let t=u7(e),n;if(t===`fence`)n={type:`code`,lang:`mermaid`,meta:null,value:e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`graph LR
542
542
  A --> B`};else{let r=pfe(e),i=t===`jsx-block`?mfe(e):[];n={type:`mdxJsxFlowElement`,name:e.name,attributes:r,children:i}}return NI({type:`root`,children:[n]},{extensions:[lfe]}).trimEnd()}function gfe(e){let t=[];for(let n of e.props){if(n.hidden===!0)continue;let e={name:n.name,type:n.type,required:n.required};n.description!==void 0&&(e.description=n.description),n.advanced===!0&&(e.advanced=!0),n.omitOnDefault===!0&&(e.omitOnDefault=!0),n.type===`enum`&&(e.values=n.enumValues,n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue)),n.type===`string`&&(n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.language!==void 0&&(e.language=n.language),n.accept!==void 0&&(e.accept=n.accept)),n.type===`boolean`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.type===`number`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),t.push(e)}return t}function _fe(e){return{...d7(e),example:hfe(e),params:gfe(e)}}function f7(){return[``,"**Custom canonical components.** OK `.md` / `.mdx` supports the JSX components below. For source syntax + parameter schemas, call `palette({ components: [ids] })`. Arbitrary `<TagName>` JSX falls through as raw MDX when no canonical fits.",``,...l7().map(d7).map(e=>`- \`${e.id}\` (${e.kind}) — ${e.description}`)].join(`
543
543
  `)}function vfe(){return[f7(),``,"Fenced code blocks render naturally and don't need a fetch — including ` ```mermaid ` for diagrams (mermaid label text has sharp edges — `palette({ components: [\"Mermaid\"] })` lists them; parse failures come back as `warnings` entries on write/edit) and ` ```html preview ` for interactive HTML/JS/CSS pages (the fence info-string `preview` token renders the block as a live iframe; works for `html` / `htm` / `xml`; optional `h=` / `w=` tokens set size, e.g. ` ```html preview h=400px `). Use ` ```html preview ` whenever you want anything interactive or JS-powered (charts, demos, calculators, animations) — just author the standalone HTML page in the fence. Call `palette` for the markdown-native component forms (write `> [!NOTE]`, not `<Callout>`), copy-ready themed `html preview` starters, and the theme tokens (`var(--chart-1)`, `var(--foreground)`, …) an embed should reference so it tracks the reader's light/dark theme."].join(`
544
- `)}const yfe=I({intents:F(I({satisfierId:M().min(1),desired:L([`present`,`absent`])}).loose()),...N4,summary:P4}).loose(),bfe=I({satisfierId:M(),agentId:M(),piece:M(),scope:M(),kind:M(),pathId:M().optional(),desired:L([`present`,`absent`]),action:L(Oo),errorId:M().optional()}).loose(),xfe=I({kind:M(),satisfierIds:F(M()),agentIds:F(M()),pathId:M().optional(),blockedReason:M().optional()}).loose(),Sfe=I({state:M(),strictness:F(L(Eo)).optional()}).loose(),Cfe=I({probes:I({env:L([`desktop`,`local-web`,`remote-web`]),satisfiers:so(M(),Sfe)}).loose(),detection:I({detected:F(M()),probed:P()}).loose()}).loose(),wfe=I({actions:F(bfe),conflicts:F(xfe),withheld:F(M()),snapshot:Cfe}).loose(),Tfe=I({entries:F(I({level:L([`info`,`warn`,`error`]),message:M().max(8192),event:M().optional(),fields:so(M(),qa()).optional(),ts:N().optional(),sourceId:M().optional(),lineNumber:N().optional()}).loose()).max(100),droppedSinceLastFlush:N().int().min(0).optional()}).loose(),Efe=I({accepted:N().int().min(0)}).loose(),Dfe=I({exact:M().min(1),prefix:M(),suffix:M(),start:N().int().nonnegative(),end:N().int().nonnegative()}),Ofe=F(to([M(),N().int().nonnegative()])),kfe=ro(`kind`,[I({kind:R(`body`)}),I({kind:R(`property`),key:M().min(1),path:Ofe.default([])})]).default({kind:`body`}),Afe=L([`anchored`,`orphaned`,`resolved`]),p7=I({threadId:M().min(1),docName:M().min(1),target:kfe,anchor:Dfe.nullable(),state:Afe,queued:P(),latestComment:M(),createdBy:M().min(1),createdAt:N(),updatedAt:N().optional()}),m7=I({docName:M(),instruction:M(),property:M().nullable(),passage:I({exact:M(),prefix:M(),suffix:M()}).nullable(),anchorLost:P(),passageRepeats:P()}).loose(),h7=I({threadId:M(),ok:R(!0)}),g7=I({threadId:M(),ok:R(!1),error:R(`not-found`)}),jfe=I({threads:F(p7)}).loose(),Mfe=I({meta:p7,orphaned:P()}).loose(),Nfe=I({threadId:M()}).loose(),Pfe=I({meta:p7,payload:m7}).loose(),Ffe=I({results:F(to([h7.extend({meta:p7,payload:m7}),g7]))}).loose(),Ife=I({results:F(to([h7.extend({meta:p7}),g7]))}).loose(),Lfe=I({status:M().min(1),reason:M()}).loose(),Rfe=I({docName:M().min(1),content:M(),lifecycle:Lfe.nullable()}).loose(),zfe=I({documents:F(I({kind:L([`document`,`asset`,`folder`,`file`]).default(`document`),docName:M().min(1).optional(),docExt:M().min(1).default(`.md`),size:N().int().nonnegative(),modified:M().min(1),isSymlink:P().default(!1),canonicalDocName:M().nullable().default(null),targetPath:M().nullable().default(null),path:M().min(1).optional(),assetExt:M().min(1).optional(),mediaKind:L([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`,`excalidraw`]).nullable().optional(),referencedBy:F(M().min(1)).optional(),hasChildren:P().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:P().optional()}).loose(),Bfe=I({source:M().min(1),anchor:M().nullable(),title:M(),snippet:M().nullable()}).loose(),Vfe=I({docName:M().min(1),backlinks:F(Bfe)}).loose(),Hfe=I({counts:so(M().min(1),N().int().nonnegative())}).loose(),Ufe=I({counts:so(M().min(1),N().int().nonnegative())}).loose(),Wfe=ro(`kind`,[I({kind:R(`doc`),docName:M().min(1),anchor:M().nullable(),title:M(),snippet:M().nullable()}).loose(),I({kind:R(`external`),url:M().min(1),title:M(),snippet:M().nullable()}).loose()]),Gfe=I({role:M().min(1),sourceForm:M().min(1),targetKind:M().min(1),href:M(),resolvedTarget:M().nullable(),status:M().min(1),reason:M().nullable(),resolutionMethod:M().min(1),fallbackTarget:M().nullable().default(null),range:I({start:N().int().nonnegative(),end:N().int().nonnegative()}),line:N().int().nonnegative(),column:N().int().nonnegative(),definition:I({label:M(),line:N().int().nonnegative()}).nullable().default(null)}).loose(),Kfe=I({docName:M().min(1),forwardLinks:F(Wfe),localTargets:F(Gfe).optional()}).loose(),qfe=ro(`kind`,[I({id:M().min(1),kind:R(`doc`),docName:M().min(1),anchor:M().nullable(),label:M(),cluster:M().nullable(),category:M().nullable(),tags:F(M()).nullable(),managed:P().optional()}).loose(),I({id:M().min(1),kind:R(`external`),url:M().min(1),label:M()}).loose()]),Jfe=I({source:M().min(1),target:M().min(1)}).loose(),Yfe=I({nodes:F(qfe),links:F(Jfe)}).loose(),Xfe=I({ts:N().int().min(0),url:M(),method:M(),ua:M().optional(),origin:M().optional(),referer:M().optional(),host:M().optional(),remote:M().optional(),secChUa:M().optional(),secChUaMobile:M().optional(),secChUaPlatform:M().optional(),secFetchSite:M().optional(),secFetchDest:M().optional(),secFetchMode:M().optional(),secFetchUser:M().optional()}).loose(),Zfe=I({app:to([R(`cursor`),R(`codex`),R(`claude`),Ua()]),signals_fired:F(M())}).loose(),Qfe=I({entries:F(Xfe),count:N().int().min(0),detection:Zfe}).loose(),_7=[`M`,`A`,`D`,`R`,`C`,`U`,`T`,`?`,`!`,` `],v7=I({path:M().min(1),code:L(_7),origPath:M().min(1).optional(),syncScoped:P(),open:ro(`kind`,[I({kind:R(`doc`),docName:M().min(1)}),I({kind:R(`asset`),path:M().min(1)})]).optional()}).loose(),$fe=I({branch:M().nullable(),detached:P(),upstream:M().nullable(),staged:F(v7),notStaged:F(v7),untracked:F(v7),incoming:F(v7),truncated:P(),readable:P().default(!0)}).loose(),epe=I({writers:F(I({id:M().min(1),name:M().optional(),email:M().optional()}).loose()).optional(),summary:P4,...N4}).loose(),tpe=I({checkpointRef:M().min(1)}).loose(),npe=I({v:N().int().optional(),id:M().min(1),name:M().min(1),colorSeed:M().optional(),docs:F(M()),summaries:F(M()).optional()}).loose(),rpe=I({entries:F(I({sha:M().min(1),timestamp:M().min(1),author:M(),authorEmail:M(),type:L([`checkpoint`,`wip`,`upstream`,`park`]),message:M(),contributors:F(npe),checkpoint:qa().nullable(),parentSha:M().nullable().optional()}).loose()),total:N().int().nonnegative().optional(),truncated:P().optional(),hasMore:P().optional()}).loose(),ipe=I({sha:M().regex(/^[0-9a-f]{40}$/i),content:M(),timestamp:M(),author:M()}).loose(),ape=I({contentDir:M().min(1),pathSeparator:L([`/`,`\\`]),symlinkResolved:P()}).loose(),ope=F(ro(`source`,[I({docName:M().min(1),timestamp:M().min(1),size:N().int().nonnegative(),source:R(`flat`)}).loose(),I({docName:M().min(1),timestamp:M().min(1),source:R(`timeline`),sha:M().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),y7=I({domain:M().min(1),title:M().optional(),description:M().optional(),siteName:M().optional(),faviconDataUri:M().optional()}).loose(),spe=I({url:M()}).loose(),cpe=ro(`ok`,[I({ok:R(!0),metadata:y7}).loose(),I({ok:R(!1),reason:M()}).loose()]),lpe=I({orphans:F(I({docName:M().min(1),title:M()}).loose())}).loose(),upe=I({hubs:F(I({docName:M().min(1),title:M(),count:N().int().nonnegative()}).loose())}).loose(),dpe=I({source:M().min(1),title:M(),snippet:M().nullable()}).loose(),fpe=I({deadLinks:F(I({target:M().min(1),sources:F(dpe)}).loose())}).loose(),ppe=I({target:I({docName:M().min(1),title:M(),aliases:F(M())}).loose(),mentions:F(I({source:M().min(1),excerpt:M(),offset:N().int().nonnegative()}).loose()),truncated:P()}).loose(),mpe=I({projectPath:M().min(1)}).loose(),hpe=L([`not-a-git-worktree`,`init-failed`]),gpe=ro(`ok`,[I({ok:R(!0),projectPath:M().min(1)}).loose(),I({ok:R(!1),reason:hpe,message:M().min(1)}).loose()]),_pe=I({host:M().min(1).optional()}).loose(),vpe=I({host:M().min(1).optional(),token:M().min(1)}).loose(),ype=I({host:M(),login:M()}).loose(),bpe=I({key:M().min(1)}).loose(),xpe=I({keyPresent:P()}).loose(),Spe=L([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]),Cpe=ro(`ok`,[I({ok:R(!0),endpoint:M().min(1),model:M().min(1),dimensions:N().int().positive()}).loose(),I({ok:R(!1),endpoint:M().min(1),model:M().min(1),reason:Spe,status:N().int().optional()}).loose()]),wpe=I({name:M().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:M().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),Tpe=I({authenticated:P()}).loose(),Epe=I({channel:L([`login`,`gh-login`]).default(`login`)}).loose(),Dpe=I({}).loose(),Ope=I({stackIndex:N().int().min(0),ts:N().int().min(0),additions:N().int().min(0),deletions:N().int().min(0)}).loose(),kpe=I({docName:M().min(1),additionsTotal:N().int().min(0),deletionsTotal:N().int().min(0),lastTs:N().int().min(0),bursts:F(Ope)}).loose(),Ape=I({displayName:M().min(1),color:M().min(1),icon:M().optional(),connectionId:M().min(1)}).loose(),jpe=I({sessionAlive:P(),agent:Ape.nullable(),files:F(kpe)}).loose(),Mpe=I({diff:M(),before:M(),after:M(),properties:f4,generatedAt:N().int().min(0)}).loose(),Npe=I({}).loose(),Ppe=I({}).loose(),Fpe=I({}).loose(),Ipe=I({}).loose(),Lpe=I({}).loose(),Rpe=I({}).loose(),zpe=I({displayName:M().min(1),icon:M(),color:M().min(1),currentDoc:M().nullable(),mode:L([`idle`,`writing`]),ts:N().int().min(0)}).loose(),Bpe=I({presence:so(M().min(1),zpe)}).loose(),Vpe=I({sessionId:M().min(1),agentType:M().min(1),ts:N().int().min(0),insertedChars:N().int().min(0),deletedChars:N().int().min(0)}).loose(),Hpe=I({effects:F(I({"doc.name":M().min(1),entries:F(Vpe)}).loose())}).loose(),Upe=I({decisions:F(I({ts:N().int().min(0),decision:M().min(1),kind:M().min(1),"doc.name":M().min(1),pathRole:M().min(1)}).loose())}).loose(),Wpe=so(M().min(1),P()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});I({path:M().min(1,`path must be non-empty`)}).loose();const Gpe=I({}).loose(),Kpe=I({fromDocName:M().min(1),toDocName:M().min(1)}).loose(),qpe=I({fromPath:M().min(1),toPath:M().min(1)}).loose(),Jpe=I({}).loose(),Ype=I({path:M().min(1),...N4,summary:P4}).loose(),Xpe=I({docName:M().min(1)}).loose(),Zpe=I({path:M().min(1),...N4,summary:P4}).loose(),Qpe=I({path:M().min(1)}).loose(),$pe=I({kind:L([`file`,`folder`]),path:M().min(1),...N4,summary:P4}).loose(),eme=I({kind:L([`file`,`folder`]),path:M().min(1),duplicatedDocNames:F(M().min(1))}).loose(),tme=I({pages:F(I({docName:M().min(1),title:M(),docExt:M().min(1),size:N().int().nonnegative(),modified:M().min(1),icon:M().min(1).max(2048).optional()}).loose())}).loose(),nme=I({level:N().int().min(1).max(6),text:M(),slug:M()}).loose(),rme=I({docName:M().min(1),headings:F(nme)}).loose(),ime=I({docName:M().min(1),rewrites:N().int().nonnegative()}).loose(),ame=I({kind:L([`file`,`folder`,`asset`]),fromPath:M().min(1),toPath:M().min(1),...N4,summary:P4}).loose(),ome=I({renamed:F(Kpe),renamedAssets:F(qpe),rewrittenDocs:F(ime).optional(),summary:k5.optional()}).loose(),sme=I({kind:L([`file`,`folder`,`asset`]),path:M().min(1),...N4}).loose(),cme=I({deletedDocNames:F(M().min(1))}).loose(),lme=I({kind:L([`file`,`folder`,`asset`]),path:M().min(1),...N4,summary:P4}).loose(),ume=I({deletedDocNames:F(M().min(1))}).loose(),dme=I({docName:M().min(1),commitSha:M().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:P4,...N4}).loose(),fme=I({restoredFrom:M().min(1),timestamp:M().min(1),summary:k5.optional(),warnings:F5.optional()}).loose(),pme=/^#[0-9a-fA-F]{6}$/,mme=I(Object.fromEntries(jd.map(e=>[e,M().regex(pme,`must be a #rrggbb hex color`)]))),b7=M().min(1).refine(Fd,{message:`must contain a non-whitespace character`}),x7=I({name:b7,author:b7.optional(),variant:L([`dark`,`light`]),palette:mme}).loose(),hme=I({name:M().min(1),scheme:x7,stem:M().min(1).optional(),extension:L([`.yaml`,`.yml`]).optional()}).loose(),gme=I({id:M().min(1),filename:M().min(1)}).loose(),_me=I({id:M().min(1),scheme:x7}).loose(),vme=I({id:M().min(1),filename:M().min(1)}).loose(),yme=ro(`existed`,[I({existed:R(!1)}).loose(),I({existed:R(!0),filename:M().min(1),scheme:x7}).loose()]),bme=I({themes:F(ro(`ok`,[I({ok:R(!0),id:M().min(1),filename:M().min(1),scheme:x7}),I({ok:R(!1),filename:M().min(1),id:M().min(1).optional(),code:M().min(1),conflictingFilenames:F(M().min(1)).min(2).optional()})])),truncated:P()}).loose(),xme=L([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),Sme=I({label:M().min(1),webUrl:Sa().nullable()}).loose(),Cme=ro(`checkStatus`,[I({checkStatus:R(`allowed`)}).loose(),I({checkStatus:R(`denied`),deniedReason:L([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`]),resolvedLogin:M().optional(),declaredLogin:M().optional(),declaredSource:M().optional()}).loose(),I({checkStatus:R(`unknown`),unknownError:L([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),S7=L([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`auth-not-found-as-identity`,`semantic-protected-branch`]),wme=L(Du),Tme=L([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]),Eme=I({state:xme,lastSyncUtc:M().nullable(),lastRunUtc:M().nullable().optional(),lastPullOkUtc:M().nullable().optional(),lastPushOkUtc:M().nullable().optional(),lastFetchUtc:M().nullable(),lastPushedSha:M().nullable(),ahead:N().int().min(0),behind:N().int().min(0),consecutiveFailures:N().int().min(0),consecutivePushFailures:N().int().min(0).optional(),conflictCount:N().int().min(0),hasRemote:P(),syncEnabled:P(),identityUnresolved:P(),remote:Sme.nullable().optional(),pushError:M().optional(),pushErrorCode:S7.optional(),pullError:M().optional(),pullErrorCode:S7.optional(),pausedReason:M().optional(),blockingPaths:F(M().min(1)).optional(),pushPermission:Cme.optional(),syncMode:wme.optional(),lastPullUtc:M().nullable().optional(),lastPullOutcome:Tme.nullable().optional()}).loose(),Dme=I({action:L([`commit`]),paths:F(M().min(1)),commitSha:M().optional()}).loose(),Ome=I({action:L([`commit`])}).loose(),kme=I({op:L([`sync`,`push`,`pull`,`fetch`]).optional()}).loose(),Ame=I({op:L([`sync`,`push`,`pull`,`fetch`])}).loose(),C7=I({file:M().min(1),detectedAt:M().min(1),conflictKind:L([`git`,`stale-external-write`]).optional().catch(void 0),variant:R(`working-tree`).optional().catch(void 0),oursSha:M().optional(),theirsSha:M().optional(),baseSha:M().optional()}).loose(),jme=I({conflicts:F(C7)}).loose(),Mme=I({file:M().min(1),strategy:L([`mine`,`theirs`,`content`,`delete`]),content:M().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0,{message:`content must be provided when strategy is 'content' (an empty string keeps an empty file)`,path:[`content`]}),Nme=I({}).loose(),Pme=I({file:M().min(1),base:M(),ours:M(),theirs:M(),kind:L([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:M().nullable(),conflictKind:L([`git`,`stale-external-write`]).optional()}).loose(),Fme=I({plan:yo(e=>e!==void 0,{message:`plan is required`})}).loose(),Ime=I({plan:yo(e=>e!==void 0,{message:`plan is required`})}).loose(),Lme=I({result:yo(e=>e!==void 0,{message:`result is required`})}).loose(),Rme=I({packId:M().min(1)}).strict(),zme=I({installedHosts:F(M()),skills:F(I({name:M().min(1),created:P()}).strict())}).strict(),Bme=I({path:M().min(1),summary:M().min(1)}).loose(),Vme=I({files:N().int().nonnegative(),folders:N().int().nonnegative()}).loose(),Hme=I({packs:F(I({id:M().min(1),name:M().min(1),description:M().min(1),defaultSubfolder:M().optional(),folders:F(Bme),entryCounts:Vme}).loose())}).loose(),Ume=I({noOpen:P().optional(),out:M().min(1).optional()}).loose(),Wme=I({reason:L([`unsupported-platform`,`spawn-error`]),message:M()}).loose(),Gme=ro(`status`,[I({status:R(`installed`),outputPath:M(),size:N().int().nonnegative(),sha256:M(),skillVersion:M()}).loose(),I({status:R(`built`),outputPath:M(),size:N().int().nonnegative(),sha256:M(),skillVersion:M(),handoffError:Wme.optional()}).loose(),I({status:R(`failed`),buildError:M()}).loose(),I({status:R(`skip-current`),skillVersion:M(),recordedAt:M().optional()}).loose()]),w7=L(T),Kme=L(E);function qme(e){return e===`agents`||E.includes(e)}const Jme=I({alwaysOn:N().int().nonnegative(),onTrigger:N().int().nonnegative(),onDemand:N().int().nonnegative()}).strict(),Yme=[`.md`,`.mdx`,`.txt`];function T7(e){return Math.round(e/4)}function Xme(e){let t=e.lastIndexOf(`.`);return t!==-1&&Yme.includes(e.slice(t).toLowerCase())}function Zme(e){let t=T7((e.name??``).length+(e.description??``).length),n=T7(Jc(e.skillMd).body.length),r=e.files.some(e=>e.relPath===`overlay.yaml`),i=0;for(let t of e.files)t.content!==null&&t.relPath!==`SKILL.md`&&(r&&t.relPath.startsWith(`upstream/`)||Xme(t.relPath)&&(i+=t.content.length));return{alwaysOn:t,onTrigger:n,onDemand:T7(i)}}const Qme=I({tags:F(I({name:M().min(1),count:N().int().nonnegative(),isLeaf:P()}).loose())}).loose(),$me=I({docName:M().min(1),title:M(),matchingTags:F(M().min(1)),snippet:M().nullable()}).loose(),ehe=I({name:M().min(1),docs:F($me)}).loose(),the=I({folder:qa(),frontmatter_local:so(M(),qa()).nullable(),warnings:F(M()).optional().meta({description:"Non-fatal degradations of this response, one per entry; the field each affects is absent, null, or incomplete — the aligned `warningCodes` entry names which field and how."}),warningCodes:F(L([`symlink-refused`,`malformed-yaml`,`unverifiable`,`templates-symlink-refused`,`templates-unverifiable`])).optional().meta({description:"Machine-readable codes aligned 1:1 with `warnings`; switch on these, never on the English. `symlink-refused` / `malformed-yaml` / `unverifiable`: this folder's own `.ok/frontmatter.yml` (a symlink, malformed YAML, or an lstat failure) — `frontmatter_local` is null. `templates-symlink-refused` / `templates-unverifiable`: the `.ok/templates` directory on this folder, or a `.ok` or `.ok/templates` directory on an ancestor it inherits from — a symlink (wherever it points, dangling included), or a non-ENOTDIR `lstat` failure — `folder.templates_available` omits that directory's templates and may still list others. A non-directory `.ok` / `.ok/templates` (ENOTDIR) is treated as empty and yields no `templates-*` code. This folder's own symlinked `.ok` is a 400, never a warning."})}).loose(),nhe=I({path:M(),frontmatter:so(M(),qa()).optional()}).loose(),rhe=I({applied:qa()}).loose(),E7=so(M(),qa()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),ihe=I({template:I({name:M().min(1),folder:M(),scope:L([`local`,`inherited`]),path:M().min(1),frontmatter:E7,body:M()}).strict()}).strict(),ahe=I({templates:F(I({name:M().min(1),title:M().optional(),description:M().optional(),path:M().min(1),source_folder:M()}).strict()),truncated:P()}).strict(),ohe=I({folder:M(),name:M(),body:M().optional(),frontmatter:E7.optional(),...N4,summary:P4}).strict(),she=I({path:M().min(1),created:P(),warnings:F(M())}).strict(),che=I({sourcePath:M().min(1),targetFolder:M(),name:M().optional(),title:M().optional(),deleteSource:P().optional(),...N4,summary:P4}).strict(),lhe=I({path:M().min(1),created:P(),warnings:F(M())}).strict(),uhe=I({existed:P(),path:M().min(1)}).strict(),dhe=I({fromFolder:M(),fromName:M(),toFolder:M(),toName:M(),body:M().optional(),frontmatter:E7.optional(),...N4,summary:P4}).strict(),fhe=I({from:M().min(1),to:M().min(1),committed:P()}).strict(),D7=L(pl),phe=/^[a-z0-9-]+$/,mhe=/<\/?[A-Za-z][^>]*>/;function hhe(e){return mhe.test(e)}const ghe=/^[A-Za-z0-9_-]+$/,O7=I({name:M(),description:M(),metadata:I({pack:M()}).strict().optional()}).strict(),_he=I({skill:I({name:M().min(1),scope:D7,path:M().min(1),frontmatter:O7,body:M(),files:F(I({path:M().min(1),text:M().nullable()})).optional(),managed:P().optional()}).strict()}).strict(),vhe=I({source:M().min(1),publisher:M().optional(),skill:M().optional(),marketplaceUrl:M().optional(),importedAt:M().min(1),autoUpdate:P().optional()}).strict(),yhe=I({name:M().min(1),description:M().optional(),scope:D7,path:M().min(1),canonicalPath:M().min(1).optional(),filePaths:F(M()).optional(),absolutePath:M().min(1).optional(),installed:P(),hosts:F(M()),hostQualifier:M().optional().meta({description:"Set on a GLOBAL entry that shares its name with a distinct-content bundle in another host dir AND is not the by-name default: the host id whose root holds THIS bundle. Doc-name builders append it (`__skill__/global/<name>@<host>`) so each same-named bundle keeps its own tab and its own write-back path; the default bundle keeps the stable unqualified name."}),driftPaths:F(M()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:so(M(),M()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:F(M()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:F(M()).optional(),installableEditors:F(M()).optional(),hubOffered:P().optional().meta({description:"Whether the vendor-neutral `.agents/skills` hub is a live destination at this scope on THIS machine — server-computed via the same predicate that filters the Folders surface, so the install menu and Settings cannot disagree. True when the project already uses the hub OR a host that reads it is installed (`HUB_READER_EDITORS`)."}),linkMode:P().optional(),customPlacements:F(I({path:M(),mode:L([`copy`,`link`])}).strict()).optional(),plugin:I({name:M().min(1),marketplace:M().min(1),provider:M().min(1),url:M().optional()}).strict().optional(),managed:P().optional(),origin:vhe.optional(),pack:M().optional(),modified:P().optional(),revertable:P().optional(),ignored:P().optional(),size:Jme.optional()}).strict(),bhe=I({name:M().min(1),scope:D7,apply:P().optional()}).strict(),xhe=I({line:M().min(1),gitignorePath:M().min(1),applied:P(),alreadyTracked:P().optional()}).strict(),She=I({skills:F(yhe),truncated:P()}).strict(),Che=I({scope:D7.default(`project`),name:M().meta({description:`Managed skill name to create or update.`}),body:M().optional(),frontmatter:O7,...N4,summary:P4}).strict(),k7=[`skill-name-vendor-word`,`skill-body-too-long`],A7=F(L(k7)).meta({description:"Machine-readable codes aligned 1:1 with `warnings` (`warnings[i]` is the display text for `warningCodes[i]`)."}),whe=I({path:M().min(1),created:P(),warnings:F(M()),warningCodes:A7}).strict(),The=I({scope:D7.default(`project`),name:M(),dryRun:P().optional(),setAutoUpdate:P().optional(),...N4,summary:P4}).strict(),Ehe=I({name:M().min(1),updated:P(),source:M().min(1),localBody:M().optional(),upstreamBody:M().optional(),gitTracked:P().optional(),warnings:F(M()),warningCodes:A7}).strict(),Dhe=I({scope:D7.default(`project`),name:M(),...N4,summary:P4}).strict(),Ohe=I({name:M().min(1),baselineRef:M().min(1),restoredFiles:F(M()),warnings:F(M())}).strict(),j7=`This member also carries the one bookkeeping failure that does not undo the operation: the content change landed, but a state file this server keeps beside it refused to be rewritten because it could not be read, so the install or import records still describe the old state until an operator repairs that file. Absent when there is nothing to report; a server that predates this member omits it, so treat its absence as no warning rather than as an error.`,khe=I({existed:P(),path:M().min(1),warnings:F(M()).optional().meta({description:`Present when this delete removed a directory a retention record ties to a recovery copy an earlier failed move kept, whose source was never verified unchanged — either because this server verified the deleted directory against the copy that record describes, or because it could not read the directory and so could not confirm either way. Each entry says which of the two it is; neither claims more than the check established. ${j7}`})}).strict(),Ahe=I({scope:D7.default(`project`),fromName:M(),toName:M(),body:M().optional(),frontmatter:O7.optional(),...N4,summary:P4}).strict(),jhe=I({from:M().min(1),to:M().min(1),committed:P(),warnings:F(M()).optional().meta({description:`Present when the rename itself completed but something beside it did not. ${j7}`})}).strict(),Mhe=I({name:M(),toName:M().optional().meta({description:"Name for the skill at the destination scope; defaults to `name`. The SKILL.md `name` frontmatter is rewritten to match."}),fromScope:D7,toScope:D7,...N4,summary:P4}).strict(),M7=[`nothing-written`,`destination-removed`,`destination-stray`,`destination-retained`,`destination-retained-blocking`,`destination-unreadable`,`partially-applied`];function Nhe(e){return typeof e==`string`&&M7.includes(e)}const N7=[`intact`,`lossy`,`unknown`];function P7(e){return typeof e==`string`&&N7.includes(e)}const F7=[`unreadable`,`occupant-unverifiable`];function Phe(e){return typeof e==`string`&&F7.includes(e)}const Fhe={"nothing-written":!1,"destination-removed":!1,"destination-stray":!1,"destination-retained":!0,"destination-retained-blocking":!0,"destination-unreadable":!1,"partially-applied":!1};function Ihe(e){return Fhe[e]}function Lhe(e){let t=typeof e==`object`&&e?e:{},n=t.moveState,r=t.sourceState,i=t.retentionLedger;if(n===void 0&&r===void 0&&i===void 0)return{kind:`coherent`};let a=Nhe(n)?n:void 0,o=P7(r)?r:void 0,s=Phe(i)?i:void 0,c={...a===void 0?{}:{moveState:a},...o===void 0?{}:{sourceState:o},...s===void 0?{}:{retentionLedger:s}};return n!==void 0&&a===void 0||r!==void 0&&o===void 0||i!==void 0&&s===void 0||a===void 0?{kind:`unverified`,...c}:(Ihe(a)?o!==void 0&&s===void 0:a===`nothing-written`?o===void 0:o===void 0&&s===void 0)?{kind:`coherent`,...c}:{kind:`unverified`,...c}}const I7=`The server reported warnings in a shape this build does not recognise; treat this result as unverified.`;function Rhe(e){if(e===void 0)return[];let t=I7;if(!Array.isArray(e))return[t];let n=e.filter(e=>typeof e==`string`);return n.length===e.length?n:[...n,t]}const zhe=I({scope:D7,path:M().optional(),droppedLocations:F(M()).default([]).meta({description:"Locations the skill occupied at the source that were removed and not re-created at the destination: the `agents` hub and custom roots, which projection does not cover. Entries are install location ids, so they can be passed straight back as an install `add` list with `scope` set to the destination scope; custom roots resolve against that scope's base."}),warnings:F(M()).optional().meta({description:`Present when the move itself completed but something beside it did not. ${j7}`})}).strict().meta({description:"Scope-move result. Rename paths deliberately do not emit authoring warnings, consistent with same-scope rename and duplicate. Content-authoring and import responses carry those warnings and their codes. The Skills Studio client parses `droppedLocations` off the wire but deliberately does not render it yet; how a human is told what was removed is an open product decision."}),Bhe=I({scope:D7,name:M(),toName:M(),...N4,summary:P4}).strict(),Vhe=I({name:M().min(1)}).strict(),Hhe=I({name:M(),home:M().min(1)}).strict(),Uhe=I({docName:M().min(1)}).strict(),L7=L([`reference`,`script`,`file`]),Whe=I({scope:D7.default(`project`),name:M(),path:M().min(1),content:M(),...N4,summary:P4}).strict(),Ghe=I({path:M().min(1),created:P(),kind:L7,content:P()}).strict(),Khe=I({scope:D7.default(`project`),name:M(),from:M().min(1),to:M().min(1),...N4,summary:P4}).strict(),qhe=I({from:M().min(1),to:M().min(1),fromDocName:M().optional(),toDocName:M().optional()}).strict(),Jhe=I({path:M().min(1),kind:L7,text:M()}).strict(),Yhe=I({path:M().min(1),existed:P(),kind:L7}).strict(),R7=to([Kme,R(`agents`)]),z7=M().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),B7=to([R7,z7]),Xhe=I({scope:D7.default(`project`),name:M(),targets:F(R7).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:F(B7).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:F(B7).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:L([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:B7.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:P().optional(),setSource:M().min(1).optional(),place:I({dir:M().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:L([`copy`,`link`])}).strict().optional(),convert:I({target:B7.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:L([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:I({path:M().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...N4,summary:P4,fork:I({editor:M().min(1),action:L([`align`,`make-source`,`rename`]),toName:M().optional()}).strict().optional()}).strict().refine(e=>e.targets===void 0||e.add===void 0&&e.remove===void 0,{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>e.source===void 0||e.add===void 0&&e.remove===void 0,{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"}),V7=[`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`],Zhe=I({name:M().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:F(M()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:P().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:F(M()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:F(L(V7)).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:M().optional(),sourceMovedTo:M().optional()}).strict(),Qhe=I({scope:D7.default(`project`),name:M().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),$he=I({name:M().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:P().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict(),ege=I({targets:F(w7),configured:P(),folders:F(I({scope:D7,host:M(),root:M(),state:L([`own`,`linked`,`linked-parent`,`absent`]),target:M().optional(),drift:R(!0).optional(),expected:M().optional()}).strict()).optional()}).strict(),H7=I({action:R(`link`),scope:D7,root:M().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:M().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}),U7=I({action:R(`unlink`),scope:D7,root:M().min(1).meta({description:`The linked folder to materialize back.`}),exclude:F(M().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),W7=I({action:R(`add-root`),scope:D7,root:z7.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict(),tge=ro(`action`,[H7.extend({preview:P().optional().meta({description:`Return the merge plan only (moves, drops, removes, conflicts, strays) — nothing is written.`})}).strict(),U7,W7]),nge=ro(`action`,[H7.strict(),U7,W7]),rge=I({folderAction:tge}).strict(),ige=I({moves:F(M()),drops:F(M()),removes:F(M()),replaces:F(M()),conflicts:F(M()),strays:F(M())}).strict(),age=I({targets:F(w7),reprojected:F(I({name:M(),hosts:F(M())}).strict()),bundleHosts:F(M()),removedFrom:F(M()),folder:I({moved:F(M()),dropped:F(M()),linked:F(M())}).strict().optional(),preview:ige.optional()}).strict(),oge=I({scope:D7.default(`project`),name:M(),version:M().regex(/^[0-9a-f]{40}$/i),...N4,summary:P4}).strict(),sge=I({name:M().min(1),version:M(),restoredFiles:F(M()),warnings:F(M())}).strict(),cge=I({query:M().optional(),intent:L([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:L([`navigation`,`relevance`]).optional(),scopes:F(L([`page`,`folder`,`content`,`file`])).optional(),scope:M().optional(),limit:N().int().nonnegative().optional(),semantic:P().optional(),source:L([`omnibar`,`mcp`,`http`]).optional()}).loose(),lge=I({kind:L([`page`,`folder`,`content`,`file`]),path:M().min(1),title:M(),score:N(),signals:so(M(),qa()),snippet:M().optional()}).loose(),G7=L([`applied`,`no_match`,`warming`,`incapable`,`provider_error`,`restart_required`,`query_too_short`]),K7=L([`warm`,`corpus`,`query`,`dimensions`,`configured_dimensions`]);function uge(e){return e?.providerErrorReason===`dimensions`?`restart_required`:e?.providerErrorReason===`configured_dimensions`?`incapable`:e?.providerError||e?.providerErrorReason?`provider_error`:null}function dge(e){throw Error(`Unhandled SemanticProviderErrorReason variant: ${JSON.stringify(e)}`)}function fge(e,t){let n=e?.providerErrorReason;switch(n){case null:case void 0:return e?.providerError===!0;case`corpus`:return!1;case`query`:return t===`query`;case`warm`:case`dimensions`:case`configured_dimensions`:return!0;default:return dge(n)}}function pge(e){throw Error(`Unhandled SemanticQueryOutcome variant: ${JSON.stringify(e)}`)}const q7=I({capable:P(),applied:P(),outcome:G7,providerErrorReason:K7.nullable().optional().catch(null),coverage:I({embedded:N().int().nonnegative(),total:N().int().nonnegative()})}).loose(),mge=I({enabled:P(),keyPresent:P(),keyNotRequired:P(),keySource:L([`project`,`file`,`env`]).nullable(),keyHint:M().nullable(),ready:P(),capable:P(),providerError:P().optional(),providerErrorReason:K7.nullable().optional().catch(null),embedded:N().int().nonnegative(),total:N().int().nonnegative()}).loose();function hge(e){return!!(e?.enabled&&(e.keyPresent||e.keyNotRequired))}const gge=I({query:M(),intent:L([`autocomplete`,`full_text`,`omnibar`]),results:F(lge),elapsedMs:N().nonnegative(),semantic:q7.optional(),truncated:P().optional(),ready:P().optional()}).loose(),_ge=I({version:M().min(1),recordedAt:M().min(1)}).loose(),vge=I({currentVersion:M().min(1),targets:so(M(),_ge.nullable())}).loose(),yge=I({scope:D7.default(`project`),source:M().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:M().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:P().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),marketplace:P().optional().meta({description:"The source came from a skills.sh listing the user chose (the Explore tab), so the install is reported to skills.sh and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...N4,summary:P4}).strict(),bge=I({scope:D7.default(`project`),source:M().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:F(M().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:P().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),marketplace:P().optional().meta({description:"The source came from a skills.sh listing the user chose (a marketplace plugin bundle), so the import is reported to skills.sh as one batched install event and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...N4,summary:P4}).strict(),xge=I({results:F(I({requested:M(),status:L([`imported`,`already-imported`,`not-found`,`failed`]),name:M().optional(),collisionRenamedFrom:M().optional(),warnings:F(M()),warningCodes:A7,error:M().optional()}).loose()),imported:N(),alreadyImported:N(),failed:N()}).loose(),Sge=I({scope:D7.default(`project`),names:F(M().min(1)).min(1).max(100).meta({description:`Managed skill names to refresh from their recorded upstreams.`}),...N4,summary:P4}).strict(),Cge=I({results:F(I({requested:M(),status:L([`updated`,`up-to-date`,`not-found`,`failed`]),source:M().optional(),warnings:F(M()),warningCodes:A7,error:M().optional()}).loose()),updated:N(),upToDate:N(),failed:N()}).loose(),wge=I({source:M(),ref:M().optional(),contentHash:M(),publisher:M().optional()}).loose(),Tge=I({name:M().min(1).meta({description:`Managed skill name created or matched.`}),path:M().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:P().meta({description:`True when this request created new source files.`}),alreadyImported:P().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:M().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:wge,warnings:F(M()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`}),warningCodes:A7}).loose(),J7=`server-info`,Y7=`branch-switched`,X7=`disk-ack`,Z7=`config-validation-rejected`,Q7=`config-ignore-nested-error`,Ege=L([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`,`local-targets`]),Dge=I({v:R(1),ch:R(J7),seq:N(),serverInstanceId:M().min(1),currentBranch:M().min(1).optional()}).loose(),Oge=I({v:R(1),ch:R(Y7),seq:N(),branch:M().min(1)}).loose(),kge=I({v:R(1),ch:Ege,seq:N()}).loose(),Age=I({v:R(1),ch:R(X7),seq:N(),docName:M().min(1),sv:M().min(1)}).loose(),jge=I({v:R(1),ch:R(Z7),seq:N(),docName:M().min(1),error:zte}).loose(),Mge=I({v:R(1),ch:R(Q7),seq:N(),path:M().min(1),error:M().min(1)}).loose(),Nge={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},$7=new WeakMap;function Pge(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function e9(e){return e.trim().toLowerCase()}const Fge=/\.(?:md|mdx)$/;function Ige(e,t){if(t!==`page`)return e;let n=e.replace(Fge,``);return n.length>0?n:e}function Lge(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function Rge(e){let t=Lge(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}const t9=/[^\P{L}a-zàèéìòóù]|[^\P{Nd}0-9]|\p{Nl}/iu,n9=(()=>{let e=globalThis.Intl.Segmenter;return e?new e(`en`,{granularity:`word`}):null})();function zge(){let e=mY({language:`english`}),t=e.tokenize.bind(e);return e.tokenize=(e,n,r,i)=>{let a=t(e,n,r,i);if(!n9||typeof e!=`string`||!t9.test(e))return a;let o=new Set(a);for(let{segment:t,isWordLike:n}of n9.segment(e)){if(!n||!t9.test(t))continue;let e=t.toLowerCase();o.has(e)||(o.add(e),a.push(e))}return a},e}function r9(e){let t=OY({schema:Nge,components:{tokenizer:zge()}});return e.length>0&&zY(t,e),t}function i9(e){let t={documents:e};return $7.set(t,r9(e)),t}function Bge(e){let t=$7.get(e);if(t)return t;let n=r9(e.documents);return $7.set(e,n),n}const a9=new WeakSet;function Vge(e,t){return e===t||e.kind===t.kind&&e.path===t.path&&e.title===t.title&&e.name===t.name&&e.pathSegments===t.pathSegments&&e.modifiedTs===t.modifiedTs&&e.content===t.content}function Hge(e,t){let n=e=>({corpus:i9(t),inserted:0,updated:0,removed:0,rebuilt:!0,rebuildReason:e}),r=$7.get(e);if(!r)return n(`no-index`);if(a9.has(e))return n(`stale-base`);let i=new Map(t.map(e=>[e.id,e]));if(i.size!==t.length)return n(`duplicate-id`);let a=[],o=[],s=0;for(let t of e.documents){let e=i.get(t.id);e?Vge(t,e)||(a.push(t.id),o.push(e),s+=1):a.push(t.id)}let c=new Set(e.documents.map(e=>e.id));for(let e of t)c.has(e.id)||o.push(e);if(a.length+o.length>t.length)return n(`bulk-change`);a9.add(e);try{if(a.length>0&&GY(r,a),o.length>0&&zY(r,o),AY(r)!==t.length)throw Error(`Search index count ${AY(r)} diverged from document count ${t.length} after incremental update`)}catch{return n(`mutation-failed`)}let l={documents:t};return $7.set(l,r),{corpus:l,inserted:o.length-s,updated:s,removed:a.length-s,rebuilt:!1}}function Uge(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function o9(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function Wge(e,t){let n=e9(t);if(!n)return 0;let r=Ige(n,e.kind),i=e9(e.title),a=e9(e.name),o=e9(e.path),s=o.split(`/`);return i===r||a===r?700:o===r?650:i.startsWith(r)||a.startsWith(r)?600:s.some(e=>e.startsWith(r))?550:i.includes(r)||a.includes(r)?500:o.includes(r)?450:-1}function s9(e,t){let n=Wge(e,t);return n<=0?n:k4(e.path)?n*.5:n}function Gge(e){return e===`file`?-60:0}function Kge(e,t,n,r,i){let a=i>0?t/i:0,o=n/50,s=r===`file`?-.001:0,c=1*a+1*o+s;return e*1e3+c}function c9(e,t,n,r){return e+t*20+n+Gge(r)}function l9(e,t,n,r,i,a){return e===`relevance`?c9(t,n,r,i):Kge(t,n,r,i,a)}function qge(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function u9(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function Jge(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function Yge(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function Xge(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}const Zge=/[฀-๿ក-៿ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿\uf900-﫿＀-￯\u1100-\u11ff\u3130-\u318f\ua960-\ua97f\uac00-\ud7ff]/;function Qge(e,t){let n=e9(t);return n.length<4||Zge.test(n)?0:+(e===`full_text`)}function $ge(e){let{lexical:t,fullText:n}=e.signals;return t>=500?`lexical`:t===450&&n<=0?`pathOnly`:`body`}function e_e(e){let t=[],n=[],r=[];for(let i of e){let e=$ge(i);e===`lexical`?t.length<100&&t.push(i):e===`body`?n.length<6&&n.push(i):r.length<4&&r.push(i)}return[...t,...n,...r]}function d9(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=e_e(e),i=[],a=0,o=0;for(let e of r){if(e.document.kind===`folder`){if(a>=3)continue;a+=1}else if(e.document.kind===`file`){if(o>=3)continue;o+=1}if(i.push(e),i.length>=n)break}return i}function t_e(e,t,n={}){let r=n.intent??`omnibar`,i=qge(r,n.ranking),a=Pge(n.limit),o=new Set(n.scopes??Uge(r)),s=e.documents.filter(e=>o9(e,o)),c=e9(t);if(!c)return s.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,a).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let l=xX(Bge(e),{term:c,properties:Yge(r),boost:Xge(r),tolerance:Qge(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>o9(e.document,o)).map(e=>[e.document.id,e.score])),d=Jge(s),f=new Map;for(let e of s)s9(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)o9(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=u9(f.values(),u);return d9([...f.values()].map(t=>{let n=Math.max(0,s9(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:l9(i,n,r,a,t.kind,e),signals:{lexical:n,fullText:r,recency:a}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score),i,a)}return d9(n_e({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function f9(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function n_e(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,ranking:o,semantic:s}=e,c=s.rrfK??60,l=s.candidateLimit??64,u=s.similarityFloor??0,d=s.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=u9(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,s9(e,a)),n=r.get(e.id)??0,s=i.get(e.id)??0,c=d.get(e.id),l=c!==void 0&&c>=u;return{document:e,score:t>0?l9(o,t,n,s,e.kind,m):c9(t,n,s,e.kind),signals:l?{lexical:t,fullText:n,recency:s,vector:c}:{lexical:t,fullText:n,recency:s},lexical:t,fullText:n,recency:s,cosine:c}}),g=f9(h.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=f9(h.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),v=e=>{let t=0,n=g.get(e);n!==void 0&&(t+=1/(c+n));let r=_.get(e);return r!==void 0&&(t+=1/(c+r)),t};return h.sort((e,t)=>{let n=+(e.lexical>0),r=+(t.lexical>0);if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=v(e.document.id),a=v(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n}))}function r_e(e){return e.created.length>0||e.packSkills?.some(e=>e.pending)===!0||e.requiredPlugins?.some(e=>e.pending)===!0}const i_e=/^[A-Za-z0-9._-]+$/,a_e=/^(?:\d{1,3}\.){3}\d{1,3}$/;var p9=class extends Error{constructor(e){super(e),this.name=`InvalidShareUrlError`}};function o_e(e,t=0){if(h9(t,!0),t===0)return l_e(e);if(e.length>2985)throw new p9(`Share URL exceeds the v2 URL size limit`);c_e(m9(e),t);let n=new TextEncoder().encode(e);if(n.length>2985)throw new p9(`Share URL exceeds the v2 URL size limit`);let r=new Uint8Array(3+n.length);if(r[0]=2,r[1]=t>>>8,r[2]=t&255,r.set(n,3),r.length>2988)throw new p9(`Share payload exceeds the v2 size limit`);let i=x9(r);if(i.length>3984)throw new p9(`Share token exceeds the v2 size limit`);return i}function m9(e){if(!e.startsWith(`https://`))throw new p9(`Share URL must use canonical HTTPS spelling`);if(e.includes(`?`)||e.includes(`#`))throw new p9(`Share URL cannot contain a query or fragment`);let t=e.slice(8),n=t.indexOf(`/`);if(n<=0)throw new p9(`Share URL is missing its repository path`);let r=t.slice(0,n);g9(r);let i=t.slice(n+1).split(`/`);if(i.length<4||i.some(e=>e.length===0))throw new p9(`Share URL has an invalid path shape`);let[a,o,s,c,...l]=i;if(s!==`blob`&&s!==`tree`)throw new p9(`Share URL has an unsupported repository path shape`);let u=_9(a,`owner`),d=_9(o,`repository`),f=u_e(c),p=l.map(e=>d_e(e,`target`)),m=s===`blob`?`doc`:`folder`;if(m===`doc`&&p.length===0)throw new p9(`Document share URL is missing its target path`);let h={host:r,owner:u,repo:d,branch:f,kind:m,targetSegments:p};if(s_e(h)!==e)throw new p9(`Share URL is not canonically serialized`);return h}function s_e(e){if(g9(e.host),b9(e.owner,`owner`),b9(e.repo,`repository`),!Y4(e.branch))throw new p9(`Share URL branch is invalid`);if(e.kind!==`doc`&&e.kind!==`folder`)throw new p9(`Share URL target kind is invalid`);if(e.kind===`doc`&&e.targetSegments.length===0)throw new p9(`Document share URL is missing its target path`);for(let t of e.targetSegments)y9(t,`target`);let t=e.kind===`doc`?`blob`:`tree`,n=[encodeURIComponent(e.owner),encodeURIComponent(e.repo),t,encodeURIComponent(e.branch),...e.targetSegments.map(e=>encodeURIComponent(e))];return`https://${e.host}/${n.join(`/`)}`}function c_e(e,t){if(h9(t,!1),t>e.targetSegments.length)throw new p9(`Content root depth exceeds the repository target path`);let n=e.targetSegments.slice(t).join(`/`);if(e.kind===`doc`){if(n.length===0)throw new p9(`Document share target cannot be the content root`);return{kind:`doc`,docPath:n}}return{kind:`folder`,folderPath:n}}function l_e(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),x9(n)}function h9(e,t){if(!Number.isInteger(e)||e<+!t||e>65535)throw new p9(`Content root depth is invalid`)}function g9(e){if(e.length===0||e.length>253||e.endsWith(`.`)||e!==e.toLowerCase()||a_e.test(e))throw new p9(`Share URL host is not canonical`);if(e.split(`.`).some(e=>e.length===0||e.length>63||!/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(e)))throw new p9(`Share URL host is not a DNS name`);if(k0(e)!==e)throw new p9(`Share URL host is not a canonical GitHub host`)}function u_e(e){let t=v9(e,`branch`);if(!Y4(t))throw new p9(`Share URL branch is invalid`);return t}function d_e(e,t){let n=v9(e,t);return y9(n,t),n}function _9(e,t){let n=v9(e,t);return b9(n,t),n}function v9(e,t){let n;try{n=decodeURIComponent(e)}catch{throw new p9(`Share URL ${t} has malformed percent encoding`)}if(encodeURIComponent(n)!==e)throw new p9(`Share URL ${t} is not canonically encoded`);return n}function y9(e,t){if(e.length===0||e===`.`||e===`..`||e.toLowerCase()===`.git`||e.includes(`/`)||e.includes(`\\`)||f_e(e))throw new p9(`Share URL ${t} component is invalid`)}function b9(e,t){if(y9(e,t),!i_e.test(e)||e.startsWith(`-`))throw new p9(`Share URL ${t} component is invalid`)}function f_e(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<=31||n===127)return!0}return!1}function x9(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const S9=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),C9=globalThis;C9[S9]===void 0&&(C9[S9]=ar());const w9=C9[S9],p_e=[`.ok`,`skill-state.yml`],m_e=[`claude-cowork`,`cli-hosts`],h_e=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],T9=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,E9=$a({version:M().regex(T9,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(w9,{description:`Recorded skill version for this target.`}),recordedAt:Gi().register(w9,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:L(h_e).register(w9,{description:`Install-source surface that recorded this entry.`}).optional()}),g_e=$a({enabled:P().register(w9,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Gi().register(w9,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})}),__e=$a({schema:R(1).register(w9,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:$a({"claude-cowork":E9.optional(),"cli-hosts":E9.optional()}).register(w9,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:so(M(),g_e).register(w9,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:F(M()).register(w9,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});function v_e(e,t){return e??t.installedOnDisk}function y_e(){return{schema:1,targets:{}}}const D9=`template`;function O9(e){if(e.trim()===``)return{};let t;try{t=(0,Rc.parse)(e)}catch{return{}}return typeof t!=`object`||!t||Array.isArray(t)?{}:t}function k9(e,t){return e.trim()===``?t:`---\n${e}\n---\n${t}`}function b_e(e){let{frontmatter:t,body:n}=Jc(e);return t===``?{docFrontmatterText:``,markdown:e}:{docFrontmatterText:Xc(t),markdown:n}}function x_e(e){let t=e.split(`
544
+ `)}const yfe=I({intents:F(I({satisfierId:M().min(1),desired:L([`present`,`absent`])}).loose()),...N4,summary:P4}).loose(),bfe=I({satisfierId:M(),agentId:M(),piece:M(),scope:M(),kind:M(),pathId:M().optional(),desired:L([`present`,`absent`]),action:L(Oo),errorId:M().optional()}).loose(),xfe=I({kind:M(),satisfierIds:F(M()),agentIds:F(M()),pathId:M().optional(),blockedReason:M().optional()}).loose(),Sfe=I({state:M(),strictness:F(L(Eo)).optional()}).loose(),Cfe=I({probes:I({env:L([`desktop`,`local-web`,`remote-web`]),satisfiers:so(M(),Sfe)}).loose(),detection:I({detected:F(M()),probed:P()}).loose()}).loose(),wfe=I({actions:F(bfe),conflicts:F(xfe),withheld:F(M()),snapshot:Cfe}).loose(),Tfe=I({entries:F(I({level:L([`info`,`warn`,`error`]),message:M().max(8192),event:M().optional(),fields:so(M(),qa()).optional(),ts:N().optional(),sourceId:M().optional(),lineNumber:N().optional()}).loose()).max(100),droppedSinceLastFlush:N().int().min(0).optional()}).loose(),Efe=I({accepted:N().int().min(0)}).loose(),Dfe=I({exact:M().min(1),prefix:M(),suffix:M(),start:N().int().nonnegative(),end:N().int().nonnegative()}),Ofe=F(to([M(),N().int().nonnegative()])),kfe=ro(`kind`,[I({kind:R(`body`)}),I({kind:R(`property`),key:M().min(1),path:Ofe.default([])})]).default({kind:`body`}),Afe=L([`anchored`,`orphaned`,`resolved`]),p7=I({threadId:M().min(1),docName:M().min(1),target:kfe,anchor:Dfe.nullable(),state:Afe,queued:P(),latestComment:M(),createdBy:M().min(1),createdAt:N(),updatedAt:N().optional()}),m7=I({docName:M(),instruction:M(),property:M().nullable(),passage:I({exact:M(),prefix:M(),suffix:M()}).nullable(),anchorLost:P(),passageRepeats:P()}).loose(),h7=I({threadId:M(),ok:R(!0)}),g7=I({threadId:M(),ok:R(!1),error:R(`not-found`)}),jfe=I({threads:F(p7)}).loose(),Mfe=I({meta:p7,orphaned:P()}).loose(),Nfe=I({threadId:M()}).loose(),Pfe=I({meta:p7,payload:m7}).loose(),Ffe=I({results:F(to([h7.extend({meta:p7,payload:m7}),g7]))}).loose(),Ife=I({results:F(to([h7.extend({meta:p7}),g7]))}).loose(),Lfe=I({status:M().min(1),reason:M()}).loose(),Rfe=I({docName:M().min(1),content:M(),lifecycle:Lfe.nullable()}).loose(),zfe=I({documents:F(I({kind:L([`document`,`asset`,`folder`,`file`]).default(`document`),docName:M().min(1).optional(),docExt:M().min(1).default(`.md`),size:N().int().nonnegative(),modified:M().min(1),isSymlink:P().default(!1),canonicalDocName:M().nullable().default(null),targetPath:M().nullable().default(null),path:M().min(1).optional(),assetExt:M().min(1).optional(),mediaKind:L([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`,`excalidraw`]).nullable().optional(),referencedBy:F(M().min(1)).optional(),hasChildren:P().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:P().optional()}).loose(),Bfe=I({source:M().min(1),anchor:M().nullable(),title:M(),snippet:M().nullable()}).loose(),Vfe=I({docName:M().min(1),backlinks:F(Bfe)}).loose(),Hfe=I({counts:so(M().min(1),N().int().nonnegative())}).loose(),Ufe=I({counts:so(M().min(1),N().int().nonnegative())}).loose(),Wfe=ro(`kind`,[I({kind:R(`doc`),docName:M().min(1),anchor:M().nullable(),title:M(),snippet:M().nullable()}).loose(),I({kind:R(`external`),url:M().min(1),title:M(),snippet:M().nullable()}).loose()]),Gfe=I({role:M().min(1),sourceForm:M().min(1),targetKind:M().min(1),href:M(),resolvedTarget:M().nullable(),status:M().min(1),reason:M().nullable(),resolutionMethod:M().min(1),fallbackTarget:M().nullable().default(null),range:I({start:N().int().nonnegative(),end:N().int().nonnegative()}),line:N().int().nonnegative(),column:N().int().nonnegative(),definition:I({label:M(),line:N().int().nonnegative()}).nullable().default(null)}).loose(),Kfe=I({docName:M().min(1),forwardLinks:F(Wfe),localTargets:F(Gfe).optional()}).loose(),qfe=ro(`kind`,[I({id:M().min(1),kind:R(`doc`),docName:M().min(1),anchor:M().nullable(),label:M(),cluster:M().nullable(),category:M().nullable(),tags:F(M()).nullable(),managed:P().optional()}).loose(),I({id:M().min(1),kind:R(`external`),url:M().min(1),label:M()}).loose()]),Jfe=I({source:M().min(1),target:M().min(1)}).loose(),Yfe=I({nodes:F(qfe),links:F(Jfe)}).loose(),Xfe=I({ts:N().int().min(0),url:M(),method:M(),ua:M().optional(),origin:M().optional(),referer:M().optional(),host:M().optional(),remote:M().optional(),secChUa:M().optional(),secChUaMobile:M().optional(),secChUaPlatform:M().optional(),secFetchSite:M().optional(),secFetchDest:M().optional(),secFetchMode:M().optional(),secFetchUser:M().optional()}).loose(),Zfe=I({app:to([R(`cursor`),R(`codex`),R(`claude`),Ua()]),signals_fired:F(M())}).loose(),Qfe=I({entries:F(Xfe),count:N().int().min(0),detection:Zfe}).loose(),_7=[`M`,`A`,`D`,`R`,`C`,`U`,`T`,`?`,`!`,` `],v7=I({path:M().min(1),code:L(_7),origPath:M().min(1).optional(),syncScoped:P(),open:ro(`kind`,[I({kind:R(`doc`),docName:M().min(1)}),I({kind:R(`asset`),path:M().min(1)})]).optional()}).loose(),$fe=I({branch:M().nullable(),detached:P(),upstream:M().nullable(),staged:F(v7),notStaged:F(v7),untracked:F(v7),incoming:F(v7),truncated:P(),readable:P().default(!0)}).loose(),epe=I({writers:F(I({id:M().min(1),name:M().optional(),email:M().optional()}).loose()).optional(),summary:P4,...N4}).loose(),tpe=I({checkpointRef:M().min(1)}).loose(),npe=I({v:N().int().optional(),id:M().min(1),name:M().min(1),colorSeed:M().optional(),docs:F(M()),summaries:F(M()).optional()}).loose(),rpe=I({entries:F(I({sha:M().min(1),timestamp:M().min(1),author:M(),authorEmail:M(),type:L([`checkpoint`,`wip`,`upstream`,`park`]),message:M(),contributors:F(npe),checkpoint:qa().nullable(),parentSha:M().nullable().optional()}).loose()),total:N().int().nonnegative().optional(),truncated:P().optional(),hasMore:P().optional()}).loose(),ipe=I({sha:M().regex(/^[0-9a-f]{40}$/i),content:M(),timestamp:M(),author:M()}).loose(),ape=I({contentDir:M().min(1),pathSeparator:L([`/`,`\\`]),symlinkResolved:P()}).loose(),ope=F(ro(`source`,[I({docName:M().min(1),timestamp:M().min(1),size:N().int().nonnegative(),source:R(`flat`)}).loose(),I({docName:M().min(1),timestamp:M().min(1),source:R(`timeline`),sha:M().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),y7=I({domain:M().min(1),title:M().optional(),description:M().optional(),siteName:M().optional(),faviconDataUri:M().optional()}).loose(),spe=I({url:M()}).loose(),cpe=ro(`ok`,[I({ok:R(!0),metadata:y7}).loose(),I({ok:R(!1),reason:M()}).loose()]),lpe=I({orphans:F(I({docName:M().min(1),title:M()}).loose())}).loose(),upe=I({hubs:F(I({docName:M().min(1),title:M(),count:N().int().nonnegative()}).loose())}).loose(),dpe=I({source:M().min(1),title:M(),snippet:M().nullable()}).loose(),fpe=I({deadLinks:F(I({target:M().min(1),sources:F(dpe)}).loose())}).loose(),ppe=I({target:I({docName:M().min(1),title:M(),aliases:F(M())}).loose(),mentions:F(I({source:M().min(1),excerpt:M(),offset:N().int().nonnegative()}).loose()),truncated:P()}).loose(),mpe=I({projectPath:M().min(1)}).loose(),hpe=L([`not-a-git-worktree`,`init-failed`]),gpe=ro(`ok`,[I({ok:R(!0),projectPath:M().min(1)}).loose(),I({ok:R(!1),reason:hpe,message:M().min(1)}).loose()]),_pe=I({host:M().min(1).optional()}).loose(),vpe=I({host:M().min(1).optional(),token:M().min(1)}).loose(),ype=I({host:M(),login:M()}).loose(),bpe=I({key:M().min(1)}).loose(),xpe=I({keyPresent:P()}).loose(),Spe=L([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]),Cpe=ro(`ok`,[I({ok:R(!0),endpoint:M().min(1),model:M().min(1),dimensions:N().int().positive()}).loose(),I({ok:R(!1),endpoint:M().min(1),model:M().min(1),reason:Spe,status:N().int().optional()}).loose()]),wpe=I({name:M().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:M().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),Tpe=I({authenticated:P()}).loose(),Epe=I({channel:L([`login`,`gh-login`]).default(`login`)}).loose(),Dpe=I({}).loose(),Ope=I({stackIndex:N().int().min(0),ts:N().int().min(0),additions:N().int().min(0),deletions:N().int().min(0)}).loose(),kpe=I({docName:M().min(1),additionsTotal:N().int().min(0),deletionsTotal:N().int().min(0),lastTs:N().int().min(0),bursts:F(Ope)}).loose(),Ape=I({displayName:M().min(1),color:M().min(1),icon:M().optional(),connectionId:M().min(1)}).loose(),jpe=I({sessionAlive:P(),agent:Ape.nullable(),files:F(kpe)}).loose(),Mpe=I({diff:M(),before:M(),after:M(),properties:f4,generatedAt:N().int().min(0)}).loose(),Npe=I({}).loose(),Ppe=I({}).loose(),Fpe=I({}).loose(),Ipe=I({}).loose(),Lpe=I({}).loose(),Rpe=I({}).loose(),zpe=I({displayName:M().min(1),icon:M(),color:M().min(1),currentDoc:M().nullable(),mode:L([`idle`,`writing`]),ts:N().int().min(0)}).loose(),Bpe=I({presence:so(M().min(1),zpe)}).loose(),Vpe=I({sessionId:M().min(1),agentType:M().min(1),ts:N().int().min(0),insertedChars:N().int().min(0),deletedChars:N().int().min(0)}).loose(),Hpe=I({effects:F(I({"doc.name":M().min(1),entries:F(Vpe)}).loose())}).loose(),Upe=I({decisions:F(I({ts:N().int().min(0),decision:M().min(1),kind:M().min(1),"doc.name":M().min(1),pathRole:M().min(1)}).loose())}).loose(),Wpe=so(M().min(1),P()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});I({path:M().min(1,`path must be non-empty`)}).loose();const Gpe=I({}).loose(),Kpe=I({fromDocName:M().min(1),toDocName:M().min(1)}).loose(),qpe=I({fromPath:M().min(1),toPath:M().min(1)}).loose(),Jpe=I({}).loose(),Ype=I({path:M().min(1),...N4,summary:P4}).loose(),Xpe=I({docName:M().min(1)}).loose(),Zpe=I({path:M().min(1),...N4,summary:P4}).loose(),Qpe=I({path:M().min(1)}).loose(),$pe=I({kind:L([`file`,`folder`]),path:M().min(1),...N4,summary:P4}).loose(),eme=I({kind:L([`file`,`folder`]),path:M().min(1),duplicatedDocNames:F(M().min(1))}).loose(),tme=I({pages:F(I({docName:M().min(1),title:M(),docExt:M().min(1),size:N().int().nonnegative(),modified:M().min(1),icon:M().min(1).max(2048).optional()}).loose())}).loose(),nme=I({level:N().int().min(1).max(6),text:M(),slug:M()}).loose(),rme=I({docName:M().min(1),headings:F(nme)}).loose(),ime=I({docName:M().min(1),rewrites:N().int().nonnegative()}).loose(),ame=I({kind:L([`file`,`folder`,`asset`]),fromPath:M().min(1),toPath:M().min(1),...N4,summary:P4}).loose(),ome=I({renamed:F(Kpe),renamedAssets:F(qpe),rewrittenDocs:F(ime).optional(),summary:k5.optional()}).loose(),sme=I({kind:L([`file`,`folder`,`asset`]),path:M().min(1),...N4}).loose(),cme=I({deletedDocNames:F(M().min(1))}).loose(),lme=I({kind:L([`file`,`folder`,`asset`]),path:M().min(1),...N4,summary:P4}).loose(),ume=I({deletedDocNames:F(M().min(1))}).loose(),dme=I({docName:M().min(1),commitSha:M().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:P4,...N4}).loose(),fme=I({restoredFrom:M().min(1),timestamp:M().min(1),summary:k5.optional(),warnings:F5.optional()}).loose(),pme=/^#[0-9a-fA-F]{6}$/,mme=I(Object.fromEntries(jd.map(e=>[e,M().regex(pme,`must be a #rrggbb hex color`)]))),b7=M().min(1).refine(Fd,{message:`must contain a non-whitespace character`}),x7=I({name:b7,author:b7.optional(),variant:L([`dark`,`light`]),palette:mme}).loose(),hme=I({name:M().min(1),scheme:x7,stem:M().min(1).optional(),extension:L([`.yaml`,`.yml`]).optional()}).loose(),gme=I({id:M().min(1),filename:M().min(1)}).loose(),_me=I({id:M().min(1),scheme:x7}).loose(),vme=I({id:M().min(1),filename:M().min(1)}).loose(),yme=ro(`existed`,[I({existed:R(!1)}).loose(),I({existed:R(!0),filename:M().min(1),scheme:x7}).loose()]),bme=I({themes:F(ro(`ok`,[I({ok:R(!0),id:M().min(1),filename:M().min(1),scheme:x7}),I({ok:R(!1),filename:M().min(1),id:M().min(1).optional(),code:M().min(1),conflictingFilenames:F(M().min(1)).min(2).optional()})])),truncated:P()}).loose(),xme=L([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),Sme=I({label:M().min(1),webUrl:Sa().nullable()}).loose(),Cme=ro(`checkStatus`,[I({checkStatus:R(`allowed`)}).loose(),I({checkStatus:R(`denied`),deniedReason:L([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`]),resolvedLogin:M().optional(),declaredLogin:M().optional(),declaredSource:M().optional()}).loose(),I({checkStatus:R(`unknown`),unknownError:L([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),S7=L([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`auth-not-found-as-identity`,`semantic-protected-branch`]),wme=L(Du),Tme=L([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]),Eme=I({state:xme,lastSyncUtc:M().nullable(),lastRunUtc:M().nullable().optional(),lastPullOkUtc:M().nullable().optional(),lastPushOkUtc:M().nullable().optional(),lastFetchUtc:M().nullable(),lastPushedSha:M().nullable(),ahead:N().int().min(0),behind:N().int().min(0),consecutiveFailures:N().int().min(0),consecutivePushFailures:N().int().min(0).optional(),conflictCount:N().int().min(0),hasRemote:P(),syncEnabled:P(),identityUnresolved:P(),remote:Sme.nullable().optional(),pushError:M().optional(),pushErrorCode:S7.optional(),pullError:M().optional(),pullErrorCode:S7.optional(),pausedReason:M().optional(),blockingPaths:F(M().min(1)).optional(),pushPermission:Cme.optional(),syncMode:wme.optional(),lastPullUtc:M().nullable().optional(),lastPullOutcome:Tme.nullable().optional()}).loose(),Dme=I({action:L([`commit`]),paths:F(M().min(1)),commitSha:M().optional()}).loose(),Ome=I({action:L([`commit`])}).loose(),kme=I({op:L([`sync`,`push`,`pull`,`fetch`]).optional()}).loose(),Ame=I({op:L([`sync`,`push`,`pull`,`fetch`])}).loose(),C7=I({file:M().min(1),detectedAt:M().min(1),conflictKind:L([`git`,`stale-external-write`]).optional().catch(void 0),variant:R(`working-tree`).optional().catch(void 0),oursSha:M().optional(),theirsSha:M().optional(),baseSha:M().optional()}).loose(),jme=I({conflicts:F(C7)}).loose(),Mme=I({file:M().min(1),strategy:L([`mine`,`theirs`,`content`,`delete`]),content:M().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0,{message:`content must be provided when strategy is 'content' (an empty string keeps an empty file)`,path:[`content`]}),Nme=I({}).loose(),Pme=I({file:M().min(1),base:M(),ours:M(),theirs:M(),kind:L([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:M().nullable(),conflictKind:L([`git`,`stale-external-write`]).optional()}).loose(),Fme=I({plan:yo(e=>e!==void 0,{message:`plan is required`})}).loose(),Ime=I({plan:yo(e=>e!==void 0,{message:`plan is required`})}).loose(),Lme=I({result:yo(e=>e!==void 0,{message:`result is required`})}).loose(),Rme=I({packId:M().min(1)}).strict(),zme=I({installedHosts:F(M()),skills:F(I({name:M().min(1),created:P()}).strict())}).strict(),Bme=I({path:M().min(1),summary:M().min(1)}).loose(),Vme=I({files:N().int().nonnegative(),folders:N().int().nonnegative()}).loose(),Hme=I({packs:F(I({id:M().min(1),name:M().min(1),description:M().min(1),defaultSubfolder:M().optional(),folders:F(Bme),entryCounts:Vme}).loose())}).loose(),Ume=I({noOpen:P().optional(),out:M().min(1).optional()}).loose(),Wme=I({reason:L([`unsupported-platform`,`spawn-error`]),message:M()}).loose(),Gme=ro(`status`,[I({status:R(`installed`),outputPath:M(),size:N().int().nonnegative(),sha256:M(),skillVersion:M()}).loose(),I({status:R(`built`),outputPath:M(),size:N().int().nonnegative(),sha256:M(),skillVersion:M(),handoffError:Wme.optional()}).loose(),I({status:R(`failed`),buildError:M()}).loose(),I({status:R(`skip-current`),skillVersion:M(),recordedAt:M().optional()}).loose()]),w7=L(T),Kme=L(E);function qme(e){return e===`agents`||E.includes(e)}const Jme=I({alwaysOn:N().int().nonnegative(),onTrigger:N().int().nonnegative(),onDemand:N().int().nonnegative()}).strict(),Yme=[`.md`,`.mdx`,`.txt`];function T7(e){return Math.round(e/4)}function Xme(e){let t=e.lastIndexOf(`.`);return t!==-1&&Yme.includes(e.slice(t).toLowerCase())}function Zme(e){let t=T7((e.name??``).length+(e.description??``).length),n=T7(Jc(e.skillMd).body.length),r=e.files.some(e=>e.relPath===`overlay.yaml`),i=0;for(let t of e.files)t.content!==null&&t.relPath!==`SKILL.md`&&(r&&t.relPath.startsWith(`upstream/`)||Xme(t.relPath)&&(i+=t.content.length));return{alwaysOn:t,onTrigger:n,onDemand:T7(i)}}const Qme=I({tags:F(I({name:M().min(1),count:N().int().nonnegative(),isLeaf:P()}).loose())}).loose(),$me=I({docName:M().min(1),title:M(),matchingTags:F(M().min(1)),snippet:M().nullable()}).loose(),ehe=I({name:M().min(1),docs:F($me)}).loose(),the=I({folder:qa(),frontmatter_local:so(M(),qa()).nullable(),warnings:F(M()).optional().meta({description:"Non-fatal degradations of this response, one per entry; the field each affects is absent, null, or incomplete — the aligned `warningCodes` entry names which field and how."}),warningCodes:F(L([`symlink-refused`,`malformed-yaml`,`unverifiable`,`templates-symlink-refused`,`templates-unverifiable`])).optional().meta({description:"Machine-readable codes aligned 1:1 with `warnings`; switch on these, never on the English. `symlink-refused` / `malformed-yaml` / `unverifiable`: this folder's own `.ok/frontmatter.yml` (a symlink, malformed YAML, or an lstat failure) — `frontmatter_local` is null. `templates-symlink-refused` / `templates-unverifiable`: the `.ok/templates` directory on this folder, or a `.ok` or `.ok/templates` directory on an ancestor it inherits from — a symlink (wherever it points, dangling included), or a non-ENOTDIR `lstat` failure — `folder.templates_available` omits that directory's templates and may still list others. A non-directory `.ok` / `.ok/templates` (ENOTDIR) is treated as empty and yields no `templates-*` code. This folder's own symlinked `.ok` is a 400, never a warning."})}).loose(),nhe=I({path:M(),frontmatter:so(M(),qa()).optional()}).loose(),rhe=I({applied:qa()}).loose(),E7=so(M(),qa()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),ihe=I({template:I({name:M().min(1),folder:M(),scope:L([`local`,`inherited`]),path:M().min(1),frontmatter:E7,body:M()}).strict()}).strict(),ahe=I({templates:F(I({name:M().min(1),title:M().optional(),description:M().optional(),path:M().min(1),source_folder:M()}).strict()),truncated:P()}).strict(),ohe=I({folder:M(),name:M(),body:M().optional(),frontmatter:E7.optional(),...N4,summary:P4}).strict(),she=I({path:M().min(1),created:P(),warnings:F(M())}).strict(),che=I({sourcePath:M().min(1),targetFolder:M(),name:M().optional(),title:M().optional(),deleteSource:P().optional(),...N4,summary:P4}).strict(),lhe=I({path:M().min(1),created:P(),warnings:F(M())}).strict(),uhe=I({existed:P(),path:M().min(1)}).strict(),dhe=I({fromFolder:M(),fromName:M(),toFolder:M(),toName:M(),body:M().optional(),frontmatter:E7.optional(),...N4,summary:P4}).strict(),fhe=I({from:M().min(1),to:M().min(1),committed:P()}).strict(),D7=L(pl),phe=/^[a-z0-9-]+$/,mhe=/<\/?[A-Za-z][^>]*>/;function hhe(e){return mhe.test(e)}const ghe=/^[A-Za-z0-9_-]+$/,O7=I({name:M(),description:M(),metadata:I({pack:M()}).strict().optional()}).strict(),_he=I({skill:I({name:M().min(1),scope:D7,path:M().min(1),frontmatter:O7,body:M(),files:F(I({path:M().min(1),text:M().nullable()})).optional(),managed:P().optional()}).strict()}).strict(),vhe=I({source:M().min(1),publisher:M().optional(),skill:M().optional(),marketplaceUrl:M().optional(),importedAt:M().min(1),autoUpdate:P().optional()}).strict(),yhe=I({name:M().min(1),description:M().optional(),scope:D7,path:M().min(1),canonicalPath:M().min(1).optional(),filePaths:F(M()).optional(),absolutePath:M().min(1).optional(),installed:P(),hosts:F(M()),hostQualifier:M().optional().meta({description:"Set on a GLOBAL entry that shares its name with a distinct-content bundle in another host dir AND is not the by-name default: the host id whose root holds THIS bundle. Doc-name builders append it (`__skill__/global/<name>@<host>`) so each same-named bundle keeps its own tab and its own write-back path; the default bundle keeps the stable unqualified name."}),driftPaths:F(M()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:so(M(),M()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:F(M()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:F(M()).optional(),installableEditors:F(M()).optional(),hubOffered:P().optional().meta({description:"Whether the vendor-neutral `.agents/skills` hub is a live destination at this scope on THIS machine — server-computed via the same predicate that filters the Folders surface, so the install menu and Settings cannot disagree. True when the project already uses the hub OR a host that reads it is installed (`HUB_READER_EDITORS`)."}),linkMode:P().optional(),customPlacements:F(I({path:M(),mode:L([`copy`,`link`])}).strict()).optional(),plugin:I({name:M().min(1),marketplace:M().min(1),provider:M().min(1),url:M().optional()}).strict().optional(),managed:P().optional(),origin:vhe.optional(),pack:M().optional(),modified:P().optional(),revertable:P().optional(),ignored:P().optional(),size:Jme.optional()}).strict(),bhe=I({name:M().min(1),scope:D7,apply:P().optional()}).strict(),xhe=I({line:M().min(1),gitignorePath:M().min(1),applied:P(),alreadyTracked:P().optional()}).strict(),She=I({skills:F(yhe),truncated:P()}).strict(),Che=I({scope:D7.default(`project`),name:M().meta({description:`Managed skill name to create or update.`}),body:M().optional(),frontmatter:O7,...N4,summary:P4}).strict(),k7=[`skill-name-vendor-word`,`skill-body-too-long`],A7=F(L(k7)).meta({description:"Machine-readable codes aligned 1:1 with `warnings` (`warnings[i]` is the display text for `warningCodes[i]`)."}),whe=I({path:M().min(1),created:P(),warnings:F(M()),warningCodes:A7}).strict(),The=I({scope:D7.default(`project`),name:M(),dryRun:P().optional(),setAutoUpdate:P().optional(),...N4,summary:P4}).strict(),Ehe=I({name:M().min(1),updated:P(),source:M().min(1),localBody:M().optional(),upstreamBody:M().optional(),gitTracked:P().optional(),warnings:F(M()),warningCodes:A7}).strict(),Dhe=I({scope:D7.default(`project`),name:M(),...N4,summary:P4}).strict(),Ohe=I({name:M().min(1),baselineRef:M().min(1),restoredFiles:F(M()),warnings:F(M())}).strict(),j7=`This member also carries the one bookkeeping failure that does not undo the operation: the content change landed, but a state file this server keeps beside it refused to be rewritten because it could not be read, so the install or import records still describe the old state until an operator repairs that file. Absent when there is nothing to report; a server that predates this member omits it, so treat its absence as no warning rather than as an error.`,khe=I({existed:P(),path:M().min(1),warnings:F(M()).optional().meta({description:`Present when this delete removed a directory a retention record ties to a recovery copy an earlier failed move kept, whose source was never verified unchanged — either because this server verified the deleted directory against the copy that record describes, or because it could not read the directory and so could not confirm either way. Each entry says which of the two it is; neither claims more than the check established. ${j7}`})}).strict(),Ahe=I({scope:D7.default(`project`),fromName:M(),toName:M(),body:M().optional(),frontmatter:O7.optional(),...N4,summary:P4}).strict(),jhe=I({from:M().min(1),to:M().min(1),committed:P(),warnings:F(M()).optional().meta({description:`Present when the rename itself completed but something beside it did not. ${j7}`})}).strict(),Mhe=I({name:M(),toName:M().optional().meta({description:"Name for the skill at the destination scope; defaults to `name`. The SKILL.md `name` frontmatter is rewritten to match."}),fromScope:D7,toScope:D7,...N4,summary:P4}).strict(),M7=[`nothing-written`,`destination-removed`,`destination-stray`,`destination-retained`,`destination-retained-blocking`,`destination-unreadable`,`partially-applied`];function Nhe(e){return typeof e==`string`&&M7.includes(e)}const N7=[`intact`,`lossy`,`unknown`];function P7(e){return typeof e==`string`&&N7.includes(e)}const F7=[`unreadable`,`occupant-unverifiable`];function Phe(e){return typeof e==`string`&&F7.includes(e)}const Fhe={"nothing-written":!1,"destination-removed":!1,"destination-stray":!1,"destination-retained":!0,"destination-retained-blocking":!0,"destination-unreadable":!1,"partially-applied":!1};function Ihe(e){return Fhe[e]}function Lhe(e){let t=typeof e==`object`&&e?e:{},n=t.moveState,r=t.sourceState,i=t.retentionLedger;if(n===void 0&&r===void 0&&i===void 0)return{kind:`coherent`};let a=Nhe(n)?n:void 0,o=P7(r)?r:void 0,s=Phe(i)?i:void 0,c={...a===void 0?{}:{moveState:a},...o===void 0?{}:{sourceState:o},...s===void 0?{}:{retentionLedger:s}};return n!==void 0&&a===void 0||r!==void 0&&o===void 0||i!==void 0&&s===void 0||a===void 0?{kind:`unverified`,...c}:(Ihe(a)?o!==void 0&&s===void 0:a===`nothing-written`?o===void 0:o===void 0&&s===void 0)?{kind:`coherent`,...c}:{kind:`unverified`,...c}}const I7=`The server reported warnings in a shape this build does not recognise; treat this result as unverified.`;function Rhe(e){if(e===void 0)return[];let t=I7;if(!Array.isArray(e))return[t];let n=e.filter(e=>typeof e==`string`);return n.length===e.length?n:[...n,t]}const zhe=I({scope:D7,path:M().optional(),droppedLocations:F(M()).default([]).meta({description:"Locations the skill occupied at the source that were removed and not re-created at the destination: the `agents` hub and custom roots, which projection does not cover. Entries are install location ids, so they can be passed straight back as an install `add` list with `scope` set to the destination scope; custom roots resolve against that scope's base."}),warnings:F(M()).optional().meta({description:`Present when the move itself completed but something beside it did not. ${j7}`})}).strict().meta({description:"Scope-move result. Rename paths deliberately do not emit authoring warnings, consistent with same-scope rename and duplicate. Content-authoring and import responses carry those warnings and their codes. The Skills Studio client parses `droppedLocations` off the wire but deliberately does not render it yet; how a human is told what was removed is an open product decision."}),Bhe=I({scope:D7,name:M(),toName:M(),...N4,summary:P4}).strict(),Vhe=I({name:M().min(1)}).strict(),Hhe=I({name:M(),home:M().min(1)}).strict(),Uhe=I({docName:M().min(1)}).strict(),L7=L([`reference`,`script`,`file`]),Whe=I({scope:D7.default(`project`),name:M(),path:M().min(1),content:M(),...N4,summary:P4}).strict(),Ghe=I({path:M().min(1),created:P(),kind:L7,content:P()}).strict(),Khe=I({scope:D7.default(`project`),name:M(),from:M().min(1),to:M().min(1),...N4,summary:P4}).strict(),qhe=I({from:M().min(1),to:M().min(1),fromDocName:M().optional(),toDocName:M().optional()}).strict(),Jhe=I({path:M().min(1),kind:L7,text:M()}).strict(),Yhe=I({path:M().min(1),existed:P(),kind:L7}).strict(),R7=to([Kme,R(`agents`)]),z7=M().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),B7=to([R7,z7]),Xhe=I({scope:D7.default(`project`),name:M(),targets:F(R7).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:F(B7).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:F(B7).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:L([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:B7.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:P().optional(),setSource:M().min(1).optional(),place:I({dir:M().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:L([`copy`,`link`])}).strict().optional(),convert:I({target:B7.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:L([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:I({path:M().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...N4,summary:P4,fork:I({editor:M().min(1),action:L([`align`,`make-source`,`rename`]),toName:M().optional()}).strict().optional()}).strict().refine(e=>e.targets===void 0||e.add===void 0&&e.remove===void 0,{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>e.source===void 0||e.add===void 0&&e.remove===void 0,{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"}),V7=[`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`],Zhe=I({name:M().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:F(M()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:P().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:F(M()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:F(L(V7)).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:M().optional(),sourceMovedTo:M().optional()}).strict(),Qhe=I({scope:D7.default(`project`),name:M().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),$he=I({name:M().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:P().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict(),ege=I({targets:F(w7),configured:P(),folders:F(I({scope:D7,host:M(),root:M(),state:L([`own`,`linked`,`linked-parent`,`absent`]),target:M().optional(),drift:R(!0).optional(),expected:M().optional()}).strict()).optional()}).strict(),H7=I({action:R(`link`),scope:D7,root:M().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:M().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}),U7=I({action:R(`unlink`),scope:D7,root:M().min(1).meta({description:`The linked folder to materialize back.`}),exclude:F(M().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),W7=I({action:R(`add-root`),scope:D7,root:z7.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict(),tge=ro(`action`,[H7.extend({preview:P().optional().meta({description:`Return the merge plan only (moves, drops, removes, conflicts, strays) — nothing is written.`})}).strict(),U7,W7]),nge=ro(`action`,[H7.strict(),U7,W7]),rge=I({folderAction:tge}).strict(),ige=I({moves:F(M()),drops:F(M()),removes:F(M()),replaces:F(M()),conflicts:F(M()),strays:F(M())}).strict(),age=I({targets:F(w7),reprojected:F(I({name:M(),hosts:F(M())}).strict()),bundleHosts:F(M()),removedFrom:F(M()),folder:I({moved:F(M()),dropped:F(M()),linked:F(M())}).strict().optional(),preview:ige.optional()}).strict(),oge=I({scope:D7.default(`project`),name:M(),version:M().regex(/^[0-9a-f]{40}$/i),...N4,summary:P4}).strict(),sge=I({name:M().min(1),version:M(),restoredFiles:F(M()),warnings:F(M())}).strict(),cge=I({query:M().optional(),intent:L([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:L([`navigation`,`relevance`]).optional(),scopes:F(L([`page`,`folder`,`content`,`file`])).optional(),scope:M().optional(),limit:N().int().nonnegative().optional(),semantic:P().optional(),source:L([`omnibar`,`mcp`,`http`]).optional()}).loose(),lge=I({kind:L([`page`,`folder`,`content`,`file`]),path:M().min(1),title:M(),score:N(),signals:so(M(),qa()),snippet:M().optional()}).loose(),G7=L([`applied`,`no_match`,`warming`,`incapable`,`provider_error`,`restart_required`,`query_too_short`]),K7=L([`warm`,`corpus`,`query`,`dimensions`,`configured_dimensions`]);function uge(e){return e?.providerErrorReason===`dimensions`?`restart_required`:e?.providerErrorReason===`configured_dimensions`?`incapable`:e?.providerError||e?.providerErrorReason?`provider_error`:null}function dge(e){throw Error(`Unhandled SemanticProviderErrorReason variant: ${JSON.stringify(e)}`)}function fge(e,t){let n=e?.providerErrorReason;switch(n){case null:case void 0:return e?.providerError===!0;case`corpus`:return!1;case`query`:return t===`query`;case`warm`:case`dimensions`:case`configured_dimensions`:return!0;default:return dge(n)}}function pge(e){throw Error(`Unhandled SemanticQueryOutcome variant: ${JSON.stringify(e)}`)}const q7=I({capable:P(),applied:P(),outcome:G7,providerErrorReason:K7.nullable().optional().catch(null),coverage:I({embedded:N().int().nonnegative(),total:N().int().nonnegative()})}).loose(),mge=I({enabled:P(),keyPresent:P(),keyNotRequired:P(),keySource:L([`project`,`file`,`env`]).nullable(),keyHint:M().nullable(),ready:P(),capable:P(),providerError:P().optional(),providerErrorReason:K7.nullable().optional().catch(null),embedded:N().int().nonnegative(),total:N().int().nonnegative()}).loose();function hge(e){return!!(e?.enabled&&(e.keyPresent||e.keyNotRequired))}const gge=I({query:M(),intent:L([`autocomplete`,`full_text`,`omnibar`]),results:F(lge),elapsedMs:N().nonnegative(),semantic:q7.optional(),truncated:P().optional(),ready:P().optional()}).loose(),_ge=I({version:M().min(1),recordedAt:M().min(1)}).loose(),vge=I({currentVersion:M().min(1),targets:so(M(),_ge.nullable())}).loose(),yge=I({scope:D7.default(`project`),source:M().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:M().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:P().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),marketplace:P().optional().meta({description:"The source came from a skills.sh listing the user chose (the Explore tab), so the install is reported to skills.sh and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...N4,summary:P4}).strict(),bge=I({scope:D7.default(`project`),source:M().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:F(M().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:P().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),marketplace:P().optional().meta({description:"The source came from a skills.sh listing the user chose (a marketplace plugin bundle), so the import is reported to skills.sh as one batched install event and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...N4,summary:P4}).strict(),xge=I({results:F(I({requested:M(),status:L([`imported`,`already-imported`,`not-found`,`failed`]),name:M().optional(),collisionRenamedFrom:M().optional(),warnings:F(M()),warningCodes:A7,error:M().optional()}).loose()),imported:N(),alreadyImported:N(),failed:N()}).loose(),Sge=I({scope:D7.default(`project`),names:F(M().min(1)).min(1).max(100).meta({description:`Managed skill names to refresh from their recorded upstreams.`}),...N4,summary:P4}).strict(),Cge=I({results:F(I({requested:M(),status:L([`updated`,`up-to-date`,`not-found`,`failed`]),source:M().optional(),warnings:F(M()),warningCodes:A7,error:M().optional()}).loose()),updated:N(),upToDate:N(),failed:N()}).loose(),wge=I({source:M(),ref:M().optional(),contentHash:M(),publisher:M().optional()}).loose(),Tge=I({name:M().min(1).meta({description:`Managed skill name created or matched.`}),path:M().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:P().meta({description:`True when this request created new source files.`}),alreadyImported:P().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:M().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:wge,warnings:F(M()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`}),warningCodes:A7}).loose(),J7=`server-info`,Y7=`branch-switched`,X7=`disk-ack`,Z7=`config-validation-rejected`,Q7=`config-ignore-nested-error`,Ege=L([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`,`local-targets`]),Dge=I({v:R(1),ch:R(J7),seq:N(),serverInstanceId:M().min(1),currentBranch:M().min(1).optional()}).loose(),Oge=I({v:R(1),ch:R(Y7),seq:N(),branch:M().min(1)}).loose(),kge=I({v:R(1),ch:Ege,seq:N()}).loose(),Age=I({v:R(1),ch:R(X7),seq:N(),docName:M().min(1),sv:M().min(1)}).loose(),jge=I({v:R(1),ch:R(Z7),seq:N(),docName:M().min(1),error:zte}).loose(),Mge=I({v:R(1),ch:R(Q7),seq:N(),path:M().min(1),error:M().min(1)}).loose(),Nge={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},$7=new WeakMap;function Pge(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function e9(e){return e.trim().toLowerCase()}const Fge=/\.(?:md|mdx)$/;function Ige(e,t){if(t!==`page`)return e;let n=e.replace(Fge,``);return n.length>0?n:e}function Lge(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function Rge(e){let t=Lge(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}const t9=/[^\P{L}a-zàèéìòóù]|[^\P{Nd}0-9]|\p{Nl}/iu,n9=(()=>{let e=globalThis.Intl.Segmenter;return e?new e(`en`,{granularity:`word`}):null})();function zge(){let e=mY({language:`english`}),t=e.tokenize.bind(e);return e.tokenize=(e,n,r,i)=>{let a=t(e,n,r,i);if(!n9||typeof e!=`string`||!t9.test(e))return a;let o=new Set(a);for(let{segment:t,isWordLike:n}of n9.segment(e)){if(!n||!t9.test(t))continue;let e=t.toLowerCase();o.has(e)||(o.add(e),a.push(e))}return a},e}function r9(e){let t=OY({schema:Nge,components:{tokenizer:zge()}});return e.length>0&&zY(t,e),t}function i9(e){let t={documents:e};return $7.set(t,r9(e)),t}function Bge(e){let t=$7.get(e);if(t)return t;let n=r9(e.documents);return $7.set(e,n),n}const a9=new WeakSet;function Vge(e,t){return e===t||e.kind===t.kind&&e.path===t.path&&e.title===t.title&&e.name===t.name&&e.pathSegments===t.pathSegments&&e.modifiedTs===t.modifiedTs&&e.content===t.content}function Hge(e,t){let n=e=>({corpus:i9(t),inserted:0,updated:0,removed:0,rebuilt:!0,rebuildReason:e}),r=$7.get(e);if(!r)return n(`no-index`);if(a9.has(e))return n(`stale-base`);let i=new Map(t.map(e=>[e.id,e]));if(i.size!==t.length)return n(`duplicate-id`);let a=[],o=[],s=0;for(let t of e.documents){let e=i.get(t.id);e?Vge(t,e)||(a.push(t.id),o.push(e),s+=1):a.push(t.id)}let c=new Set(e.documents.map(e=>e.id));for(let e of t)c.has(e.id)||o.push(e);if(a.length+o.length>t.length)return n(`bulk-change`);a9.add(e);try{if(a.length>0&&GY(r,a),o.length>0&&zY(r,o),AY(r)!==t.length)throw Error(`Search index count ${AY(r)} diverged from document count ${t.length} after incremental update`)}catch{return n(`mutation-failed`)}let l={documents:t};return $7.set(l,r),{corpus:l,inserted:o.length-s,updated:s,removed:a.length-s,rebuilt:!1}}function Uge(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function o9(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function Wge(e,t){let n=e9(t);if(!n)return 0;let r=Ige(n,e.kind),i=e9(e.title),a=e9(e.name),o=e9(e.path),s=o.split(`/`);return i===r||a===r?700:o===r?650:i.startsWith(r)||a.startsWith(r)?600:s.some(e=>e.startsWith(r))?550:i.includes(r)||a.includes(r)?500:o.includes(r)?450:-1}function s9(e,t){let n=Wge(e,t);return n<=0?n:k4(e.path)?n*.5:n}function Gge(e){return e===`file`?-60:0}function Kge(e,t,n,r,i){let a=i>0?t/i:0,o=n/50,s=r===`file`?-.001:0,c=1*a+1*o+s;return e*1e3+c}function c9(e,t,n,r){return e+t*20+n+Gge(r)}function l9(e,t,n,r,i,a){return e===`relevance`?c9(t,n,r,i):Kge(t,n,r,i,a)}function qge(e,t){return t||(e===`full_text`?`relevance`:`navigation`)}function u9(e,t){let n=0;for(let r of e){let e=t.get(r.id)??0;e>n&&(n=e)}return n}function Jge(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function Yge(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function Xge(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}const Zge=/[฀-๿ក-៿ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿\uf900-﫿＀-￯\u1100-\u11ff\u3130-\u318f\ua960-\ua97f\uac00-\ud7ff]/;function Qge(e,t){let n=e9(t);return n.length<4||Zge.test(n)?0:+(e===`full_text`)}function $ge(e){let{lexical:t,fullText:n}=e.signals;return t>=500?`lexical`:t===450&&n<=0?`pathOnly`:`body`}function e_e(e){let t=[],n=[],r=[];for(let i of e){let e=$ge(i);e===`lexical`?t.length<100&&t.push(i):e===`body`?n.length<6&&n.push(i):r.length<4&&r.push(i)}return[...t,...n,...r]}function d9(e,t,n){if(t===`relevance`)return e.slice(0,n);let r=e_e(e),i=[],a=0,o=0;for(let e of r){if(e.document.kind===`folder`){if(a>=3)continue;a+=1}else if(e.document.kind===`file`){if(o>=3)continue;o+=1}if(i.push(e),i.length>=n)break}return i}function t_e(e,t,n={}){let r=n.intent??`omnibar`,i=qge(r,n.ranking),a=Pge(n.limit),o=new Set(n.scopes??Uge(r)),s=e.documents.filter(e=>o9(e,o)),c=e9(t);if(!c)return s.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,a).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let l=xX(Bge(e),{term:c,properties:Yge(r),boost:Xge(r),tolerance:Qge(r,c),limit:Math.max(a*4,40)}),u=new Map(l.hits.filter(e=>o9(e.document,o)).map(e=>[e.document.id,e.score])),d=Jge(s),f=new Map;for(let e of s)s9(e,c)>=0&&f.set(e.id,e);for(let e of l.hits)o9(e.document,o)&&f.set(e.document.id,e.document);if(!n.semantic){let e=u9(f.values(),u);return d9([...f.values()].map(t=>{let n=Math.max(0,s9(t,c)),r=u.get(t.id)??0,a=d.get(t.id)??0;return{document:t,score:l9(i,n,r,a,t.kind,e),signals:{lexical:n,fullText:r,recency:a}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score),i,a)}return d9(n_e({scopedDocuments:s,candidates:f,fullTextScores:u,recency:d,normalizedQuery:c,ranking:i,semantic:n.semantic}),i,a)}function f9(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function n_e(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,ranking:o,semantic:s}=e,c=s.rrfK??60,l=s.candidateLimit??64,u=s.similarityFloor??0,d=s.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=u9(n.values(),r),h=[...n.values()].map(e=>{let t=Math.max(0,s9(e,a)),n=r.get(e.id)??0,s=i.get(e.id)??0,c=d.get(e.id),l=c!==void 0&&c>=u;return{document:e,score:t>0?l9(o,t,n,s,e.kind,m):c9(t,n,s,e.kind),signals:l?{lexical:t,fullText:n,recency:s,vector:c}:{lexical:t,fullText:n,recency:s},lexical:t,fullText:n,recency:s,cosine:c}}),g=f9(h.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=f9(h.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),v=e=>{let t=0,n=g.get(e);n!==void 0&&(t+=1/(c+n));let r=_.get(e);return r!==void 0&&(t+=1/(c+r)),t};return h.sort((e,t)=>{let n=+(e.lexical>0),r=+(t.lexical>0);if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=v(e.document.id),a=v(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n}))}function r_e(e){return e.created.length>0||e.packSkills?.some(e=>e.pending)===!0||e.requiredPlugins?.some(e=>e.pending)===!0}const i_e=/^[A-Za-z0-9._-]+$/,a_e=/^(?:\d{1,3}\.){3}\d{1,3}$/;var p9=class extends Error{constructor(e){super(e),this.name=`InvalidShareUrlError`}};function o_e(e,t=0){if(h9(t,!0),t===0)return l_e(e);if(e.length>2985)throw new p9(`Share URL exceeds the v2 URL size limit`);c_e(m9(e),t);let n=new TextEncoder().encode(e);if(n.length>2985)throw new p9(`Share URL exceeds the v2 URL size limit`);let r=new Uint8Array(3+n.length);if(r[0]=2,r[1]=t>>>8,r[2]=t&255,r.set(n,3),r.length>2988)throw new p9(`Share payload exceeds the v2 size limit`);let i=x9(r);if(i.length>3984)throw new p9(`Share token exceeds the v2 size limit`);return i}function m9(e){if(!e.startsWith(`https://`))throw new p9(`Share URL must use canonical HTTPS spelling`);if(e.includes(`?`)||e.includes(`#`))throw new p9(`Share URL cannot contain a query or fragment`);let t=e.slice(8),n=t.indexOf(`/`);if(n<=0)throw new p9(`Share URL is missing its repository path`);let r=t.slice(0,n);g9(r);let i=t.slice(n+1).split(`/`);if(i.length<4||i.some(e=>e.length===0))throw new p9(`Share URL has an invalid path shape`);let[a,o,s,c,...l]=i;if(s!==`blob`&&s!==`tree`)throw new p9(`Share URL has an unsupported repository path shape`);let u=_9(a,`owner`),d=_9(o,`repository`),f=u_e(c),p=l.map(e=>d_e(e,`target`)),m=s===`blob`?`doc`:`folder`;if(m===`doc`&&p.length===0)throw new p9(`Document share URL is missing its target path`);let h={host:r,owner:u,repo:d,branch:f,kind:m,targetSegments:p};if(s_e(h)!==e)throw new p9(`Share URL is not canonically serialized`);return h}function s_e(e){if(g9(e.host),b9(e.owner,`owner`),b9(e.repo,`repository`),!Y4(e.branch))throw new p9(`Share URL branch is invalid`);if(e.kind!==`doc`&&e.kind!==`folder`)throw new p9(`Share URL target kind is invalid`);if(e.kind===`doc`&&e.targetSegments.length===0)throw new p9(`Document share URL is missing its target path`);for(let t of e.targetSegments)y9(t,`target`);let t=e.kind===`doc`?`blob`:`tree`,n=[encodeURIComponent(e.owner),encodeURIComponent(e.repo),t,encodeURIComponent(e.branch),...e.targetSegments.map(e=>encodeURIComponent(e))];return`https://${e.host}/${n.join(`/`)}`}function c_e(e,t){if(h9(t,!1),t>e.targetSegments.length)throw new p9(`Content root depth exceeds the repository target path`);let n=e.targetSegments.slice(t).join(`/`);if(e.kind===`doc`){if(n.length===0)throw new p9(`Document share target cannot be the content root`);return{kind:`doc`,docPath:n}}return{kind:`folder`,folderPath:n}}function l_e(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),x9(n)}function h9(e,t){if(!Number.isInteger(e)||e<+!t||e>65535)throw new p9(`Content root depth is invalid`)}function g9(e){if(e.length===0||e.length>253||e.endsWith(`.`)||e!==e.toLowerCase()||a_e.test(e))throw new p9(`Share URL host is not canonical`);if(e.split(`.`).some(e=>e.length===0||e.length>63||!/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(e)))throw new p9(`Share URL host is not a DNS name`);if(k0(e)!==e)throw new p9(`Share URL host is not a canonical GitHub host`)}function u_e(e){let t=v9(e,`branch`);if(!Y4(t))throw new p9(`Share URL branch is invalid`);return t}function d_e(e,t){let n=v9(e,t);return y9(n,t),n}function _9(e,t){let n=v9(e,t);return b9(n,t),n}function v9(e,t){let n;try{n=decodeURIComponent(e)}catch{throw new p9(`Share URL ${t} has malformed percent encoding`)}if(encodeURIComponent(n)!==e)throw new p9(`Share URL ${t} is not canonically encoded`);return n}function y9(e,t){if(e.length===0||e===`.`||e===`..`||e.toLowerCase()===`.git`||e.includes(`/`)||e.includes(`\\`)||f_e(e))throw new p9(`Share URL ${t} component is invalid`)}function b9(e,t){if(y9(e,t),!i_e.test(e)||e.startsWith(`-`))throw new p9(`Share URL ${t} component is invalid`)}function f_e(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<=31||n===127)return!0}return!1}function x9(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const S9=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),C9=globalThis;C9[S9]===void 0&&(C9[S9]=ar());const w9=C9[S9],p_e=[`.ok`,`skill-state.yml`],m_e=[`claude-cowork`,`cli-hosts`],h_e=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],T9=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,E9=$a({version:M().regex(T9,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(w9,{description:`Recorded skill version for this target.`}),recordedAt:Gi().register(w9,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:L(h_e).register(w9,{description:`Install-source surface that recorded this entry.`}).optional()}),g_e=$a({enabled:P().register(w9,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Gi().register(w9,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})}),__e=$a({schema:R(1).register(w9,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:$a({"claude-cowork":E9.optional(),"cli-hosts":E9.optional()}).register(w9,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:so(M(),g_e).register(w9,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:F(M()).register(w9,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});function v_e(e,t){return e??t.installedOnDisk}function y_e(){return{schema:1,targets:{}}}const b_e=[`auth-error`,`detached-head`,`dirty-tree`,`diverged-local-commits`,`external-changes-pending`,`git-index-locked`,`git-operation-in-progress`,`no-commits-yet`,`no-push-permission`,`non-content-merge-failure`,`protected-branch`],D9=`template`;function O9(e){if(e.trim()===``)return{};let t;try{t=(0,Rc.parse)(e)}catch{return{}}return typeof t!=`object`||!t||Array.isArray(t)?{}:t}function k9(e,t){return e.trim()===``?t:`---\n${e}\n---\n${t}`}function x_e(e){let{frontmatter:t,body:n}=Jc(e);return t===``?{docFrontmatterText:``,markdown:e}:{docFrontmatterText:Xc(t),markdown:n}}function S_e(e){let t=e.split(`
545
545
  `);if(!(t[0]??``).startsWith(`template:`))return null;let n=[t[0]??``],r=1;for(;r<t.length;){let e=t[r]??``;if(/^[ \t]/.test(e)){n.push(e),r++;continue}if(e.trim()===``){let i=r+1;for(;i<t.length&&(t[i]??``).trim()===``;)i++;if(i<t.length&&/^[ \t]/.test(t[i]??``)){n.push(e),r++;continue}}break}let i=O9(n.join(`
546
546
  `))[D9];return{identity:typeof i==`object`&&i&&!Array.isArray(i)?i:{},docFrontmatterText:t.slice(r).join(`
547
- `).replace(/\n+$/,``)}}function A9(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,{frontmatter:n,body:r}=Jc(t);if(n===``)return{identity:{},starterContent:t};let i=Xc(n),a=x_e(i);if(a)return{identity:a.identity,starterContent:k9(a.docFrontmatterText,r)};let{frontmatter:o}=Jc(r);if(o!==``)return{identity:O9(i),starterContent:r};let s=O9(i);return typeof s.title==`string`?{identity:s,starterContent:r}:{identity:{},starterContent:k9(i,r)}}function S_e(e,t){let{docFrontmatterText:n,markdown:r}=b_e(t),i={};for(let[t,n]of Object.entries(e))n!==void 0&&(i[t]=n);let a=(0,Rc.stringify)({[D9]:i});return`---\n${n.trim()===``?a:`${a}${n}\n`}---\n${r}`}function C_e(e){return A9(e).starterContent}const j9=e=>e*8+4;j9(92),j9(40);const w_e=/^(#{1,6})\s+(.+)$/;function T_e(e,t){let n=(e.endsWith(`\r`)?e.slice(0,-1):e).match(w_e);if(!n)return null;let r=n[2].trim(),i=afe(r,t);return i?{level:n[1].length,text:r,slug:i}:null}Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));const E_e={fileSystem:`File System`,gitUpstream:`Git (upstream)`,service:`OpenKnowledge (service)`,generator:`OpenKnowledge (generated)`},D_e=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],O_e={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function k_e(e,t=D_e){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const A_e={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`,"claude-acp":`claude`,"codex-acp":`openai`,"github-copilot-cli":`github`};function M9(e){return e?A_e[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const j_e={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function M_e(e){let t=e?.trim();return t?j_e[M9(t)]??t:`Agent`}function N9(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 P9(e){return e===`.`||e===`..`?e:encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.codePointAt(0)?.toString(16).toUpperCase()}`)}function N_e(e){return e.split(`/`).map(P9).join(`/`)}function F9(e){return e.split(`/`).map(N9).join(`/`)}function I9(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=N9(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=`.${(s[1]??``).toLowerCase()}`;if(!C0.includes(e))return null}let c=o.startsWith(`/`),l=c?o.slice(1):o,u=c?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[],d=l.split(`/`),f=d.length-1;for(let e=0;e<d.length;e++){let t=N9(d[e]??``);if(e===f&&(t=_l(t)),t===`..`){if(u.length===0)return null;u.pop()}else t!==`.`&&t!==``&&u.push(t)}return u.length===0?null:{docName:u.join(`/`),anchor:a||null}}function P_e(e){throw Error(`Unhandled ClassifiedLinkTarget variant: ${JSON.stringify(e)}`)}const L9=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function R9(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function z9(e){let t=e.trim();return L9.test(t)||t.startsWith(`//`)}function F_e(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(z9(n))return{kind:`external`,url:n};let r=n.indexOf(`#`),i=F9(r<0?n:n.slice(0,r)),a=Sl(i,t);if(a)return{kind:`doc`,docName:a,anchor:r<0?null:n.slice(r+1)};let o=xl(i,t);if(o)return{kind:`doc`,docName:o,anchor:r<0?null:n.slice(r+1)};let s=I9(n,t);if(s)return{kind:`doc`,docName:s.docName,anchor:s.anchor};let c=R9(i);return c&&c!==`md`&&c!==`mdx`?{kind:`asset`,url:n,ext:c,literal:!1}:null}function B9(e,t){let n=e.trim();if(!n)return null;if(z9(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=R9(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r,literal:!0}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function I_e(e,t,n){let r=e.trim();if(!r||L9.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:N9(e));return c.length===0?null:c.join(`/`)}function V9(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function H9(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function U9(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function W9(e){return e.split(`/`).filter(e=>e!==``)}function L_e(e,t){let n=U9(t);return e===``||n===e||n.startsWith(`${e}/`)}function G9(e,t){let n=U9(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:W9(r).length}function K9(e,t){let n=W9(e),r=W9(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function R_e(){let e=new Map;function t(t){let n=V9(t);if(n===``)return;let r=H9(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=V9(t),r=H9(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=U9(V9(n)),o=[],s=[];for(let e of i)L_e(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=G9(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=G9(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=K9(a,U9(t));for(let r=1;r<e.length;r++){let i=e[r],o=K9(a,U9(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}const q9=`unknown`;function z_e(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return q9;let r=Math.floor(Math.max(0,t-n)/1e3);if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function B_e(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function V_e(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}function J9(e){let t=e?.trim();return t===void 0||t===``?void 0:t}function H_e(e){return e.reason!==void 0||J9(e.note)!==void 0||J9(e.email)!==void 0}function U_e(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol===`https:`)return t;let n=t.hostname===`localhost`||t.hostname===`127.0.0.1`||t.hostname===`[::1]`;return t.protocol===`http:`&&n?t:null}function W_e(){return U_e((typeof process>`u`?void 0:J9(process.env?.OK_FEEDBACK_INTAKE_ORIGIN))??`https://openknowledge.ai`)}function G_e(e){let t=J9(e);if(t!==void 0)return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)?t:void 0}async function Y9(e,t,n){try{let r=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t),signal:AbortSignal.timeout(n)});if(r.ok){let e=await r.json().catch(()=>null);return{ok:!0,reference:typeof e?.reference==`string`?e.reference:``}}return r.status===400||r.status===413?{ok:!1,reason:`invalid`}:r.status===503?{ok:!1,reason:`unavailable`}:{ok:!1,reason:`error`}}catch(e){return{ok:!1,reason:e instanceof Error&&(e.name===`TimeoutError`||e.name===`AbortError`)?`timeout`:`error`}}}async function K_e(e,t={}){let n=W_e();if(n===null)return{ok:!1,reason:`error`};let r=new URL(`/api/feedback`,n),i=J9(e.note),a=G_e(e.email),o={kind:`uninstall`,reasons:e.reason===void 0?[]:[e.reason],...i===void 0?{}:{message:i},appVersion:e.appVersion,platform:e.platform,source:e.source},s=Date.now()+(t.timeoutMs??4e3),c=()=>s-Date.now();if(a===void 0)return Y9(r,o,c());let l=await Y9(r,{...o,email:a},c());return l.ok||l.reason!==`invalid`||c()<=0?l:Y9(r,o,c())}function X9(e){return`pagesBySlug`in e}function q_e(e){return X9(e)?e.pages:e}function J_e(e,t){return X9(e)?e.assetPaths??new Set:t??new Set}function Z9(e,t){return X9(e)?e.filePaths??new Set:t??new Set}function Q9(e,t){return e<t?-1:+(e>t)}function Y_e(e,t){let n=new Map;for(let r of e){let e=t(r);e&&!n.has(e)&&n.set(e,r)}return n}function X_e(e,t){let n=new Map,r=[...e].sort(Q9);for(let e of r){let r=e.lastIndexOf(`/`),i=t(r===-1?e:e.slice(r+1));i&&!n.has(i)&&n.set(i,e)}return n}function Z_e(e,t){let n=s7(e);if(n){if(X9(t))return t.pagesBySlug.get(n);for(let e of t)if(s7(e)===n)return e}}function Q_e(e,t){if(e.includes(`/`))return;let n=s7(e);if(!n)return;if(X9(t))return t.pagesByBasename?.get(n);let r;for(let e of t){let t=e.lastIndexOf(`/`);s7(t===-1?e:e.slice(t+1))===n&&(r===void 0||Q9(e,r)<0)&&(r=e)}return r}function $_e(e){let t=e.trim();if(!t)return[];let n=s7(t);return n.length>0&&n!==t?[n]:[]}function $9(e,t){let n=e.trim();if(!n)return;let r=q_e(t);if(r.has(n))return n;let i=Z_e(n,t);if(i)return i;for(let e of $_e(n))if(r.has(e))return e;return eve(n,r)||Q_e(n,t)}function eve(e,t){let n=`${e}/index`;if(t.has(n))return n;let r=e.lastIndexOf(`/`),i=r===-1?e:e.slice(r+1),a=i?`${e}/${i}`:null;if(a&&t.has(a))return a}function tve(e){let t=((e.trim().split(`#`)[0]??``).trim().split(`?`)[0]??``).trim();return t.startsWith(`/`)?t.slice(1):t}function nve(e,t,n){let r=tve(e);if(!r)return null;let i=r.toLowerCase(),a=n?[t,n]:[t];for(let e of a){if(e.has(r))return r;for(let t of e)if(t.toLowerCase()===i)return t}if(r.includes(`/`))return null;let o=[];for(let e of a)for(let t of e){let e=t.lastIndexOf(`/`);(e===-1?t:t.slice(e+1)).toLowerCase()===i&&o.push(t)}return o.length===0?null:o.sort(Q9)[0]??null}function rve(e,t,n){let r=B9(e,t);return r===null||r.kind!==`asset`||nve(r.url,J_e(n),Z9(n))!==null||$9(e,n)===void 0?r:{kind:`doc`,docName:e.trim(),anchor:t?.trim()||null}}const ive=new eue({extensions:o4,deriveStructuralFreshness:!0}),ave=aC(o4);export{D0 as $,oQ as $a,Hu as $c,U0 as $i,Ul as $l,tpe as $n,$de as $o,whe as $r,s7 as $s,ype as $t,fo as $u,Mge as A,B9 as Aa,Mf as Ac,te as Ad,kme as Ai,ul as Al,u1 as An,M9 as Ao,Bhe as Ar,s0 as As,upe as At,is as Au,f1 as B,G1 as Ba,Yte as Bc,dhe as Bi,Ll as Bl,k7 as Bn,h5 as Bo,nge as Br,t_e as Bs,Yfe as Bt,L as Bu,s3 as C,bZ as Ca,Ef as Cc,y as Cd,Pme as Ci,yu as Cl,tme as Cn,qQ as Co,W4 as Cr,Bde as Cs,Y5 as Ct,jl as Cu,R5 as D,F_e as Da,xf as Dc,ne as Dd,Mme as Di,xu as Dl,u3 as Dn,n4 as Do,Jae as Dr,y0 as Ds,$fe as Dt,ps as Du,I5 as E,i3 as Ea,Sf as Ec,x as Ed,Dme as Ei,Tu as El,Qae as En,Woe as Eo,J4 as Er,Vde as Es,_7 as Et,Lc as Eu,Y7 as F,S_e as Fa,Of as Fc,w as Fd,Qme as Fi,Hc as Fl,ome as Fn,z9 as Fo,Jhe as Fr,$9 as Fs,f3 as Ft,wte as Fu,Ufe as G,t8 as Ga,Zte as Gc,Ipe as Gi,tu as Gl,N7 as Gn,Pde as Go,vge as Gr,BQ as Gs,Cde as Gt,yo as Gu,qae as H,R_e as Ha,Cd as Hc,ohe as Hi,Gl as Hl,M7 as Hn,M$ as Ho,yge as Hr,fge as Hs,spe as Ht,Ga as Hu,Q7 as I,iQ as Ia,sp as Ic,uhe as Ii,vl as Il,ope as In,Lde as Io,Whe as Ir,q1 as Is,p9 as It,ute as Iu,C7 as J,F9 as Ja,df as Jc,Npe as Ji,ru as Jl,T9 as Jn,qme as Jo,Ahe as Jr,nZ as Js,Fde as Jt,ao as Ju,p7 as K,i9 as Ka,Ud as Kc,Ppe as Ki,nu as Kl,p_e as Kn,V0 as Ko,Zhe as Kr,C4 as Ks,U5 as Kt,ro as Ku,Z7 as L,aQ as La,td as Lc,ihe as Li,dl as Ll,dme as Ln,k4 as Lo,Ghe as Lr,Wde as Ls,c7 as Lt,So as Lu,kge as M,k_e as Ma,xd as Mc,oe as Md,D9 as Mi,ol as Ml,G5 as Mn,C_e as Mo,Hhe as Mr,aoe as Ms,Ume as Mt,lte as Mu,Age as N,X$ as Na,Af as Nc,E as Nd,ghe as Ni,cl as Nl,q5 as Nn,Lhe as No,Uhe as Nr,x0 as Ns,Gme as Nt,ms as Nu,r5 as O,I0 as Oa,bf as Oc,S as Od,Nme as Oi,Ml as Ol,Mfe as On,H_e as Oo,Yae as Or,I_e as Os,rpe as Ot,fs as Ou,Dge as P,t5 as Pa,kf as Pc,re as Pd,ehe as Pi,sl as Pl,ame as Pn,Z4 as Po,Yhe as Pr,rve as Ps,Wpe as Pt,ys as Pu,Xpe as Q,l0 as Qa,Vte as Qc,E0 as Qi,hl as Ql,epe as Qn,sde as Qo,Che as Qr,x4 as Qs,vpe as Qt,I as Qu,X7 as R,hhe as Ra,ed as Rc,che as Ri,fl as Rl,fme as Rn,a3 as Ro,Khe as Rr,T_e as Rs,O0 as Rt,Ra as Ru,Vfe as S,Y_e as Sa,Df as Sc,v as Sd,ppe as Si,Cu as Sl,rme as Sn,z_e as So,R4 as Sr,zde as Ss,bde as St,Jc as Su,e$ as T,S0 as Ta,kd as Tc,b as Td,Ome as Ti,Eu as Tl,Pfe as Tn,l7 as To,K4 as Tr,f7 as Ts,Dde as Tt,nl as Tu,Tfe as U,i8 as Ua,Hf as Uc,she as Ui,Kl as Ul,phe as Un,O4 as Uo,Tge as Ur,xQ as Us,cpe as Ut,F as Uu,c3 as V,Xde as Va,Gte as Vc,fhe as Vi,Il as Vl,V7 as Vn,j0 as Vo,_he as Vr,ede as Vs,y7 as Vt,Ua as Vu,Efe as W,FQ as Wa,jte as Wc,ahe as Wi,il as Wl,F7 as Wn,Nde as Wo,Xhe as Wr,s8 as Ws,Ode as Wt,P as Wu,Qpe as X,Zde as Xa,Hte as Xc,lme as Xi,eu as Xl,i5 as Xn,lue as Xo,zhe as Xr,hQ as Xs,Dpe as Xt,$a as Xu,Zpe as Y,$$ as Ya,uf as Yc,jfe as Yi,$l as Yl,C0 as Yn,P7 as Yo,Mhe as Yr,V_e as Ys,Epe as Yt,R as Yu,Ype as Z,w$ as Za,qte as Zc,ume as Zi,lu as Zl,E_e as Zn,Y4 as Zo,jhe as Zr,xde as Zs,_pe as Zt,N as Zu,tde as _,OZ as _a,Wte as _c,ke as _d,She as _i,Mte as _l,lpe as _n,Yde as _o,G7 as _r,K_e as _s,the as _t,Wl as _u,jpe as a,M5 as aa,$V as ac,Sa as ad,Ohe as ai,Jf as al,Cpe as an,loe as ao,bme as ar,x$ as as,fpe as at,fu as au,ude as b,eZ as ba,rd as bc,D as bd,Gpe as bi,Vf as bl,z0 as bn,K8 as bo,I4 as br,lQ as bs,Kfe as bt,gu as bu,wfe as c,a0 as ca,pp as cc,Ui as cd,ege as ci,If as cl,Tde as cn,N_e as co,gge as cr,GQ as cs,Nfe as ct,Qc as cu,ide as d,KZ as da,tne as dc,Zt as dd,bhe as di,Ru as dl,Rpe as dn,Zme as do,Rme as dr,uoe as ds,$pe as dt,wl as du,I7 as ea,QQ as ec,bo as ed,The as ei,bd as el,wpe as en,m4 as eo,yme as er,TQ as es,$ue as et,du as eu,mde as f,mQ as fa,$te as fc,et as fd,xhe as fi,Fu as fl,Lpe as fn,jX as fo,zme as fr,A9 as fs,eme as ft,hu as fu,fde as g,cde as ga,Td as gc,Qe as gd,xge as gi,Ute as gl,A0 as gn,i$ as go,K7 as gr,mZ as gs,J1 as gt,Sl as gu,nde as h,pge as ha,$u as hc,ot as hd,bge as hi,Kte as hl,g5 as hn,V1 as ho,mge as hr,r_e as hs,Jpe as ht,yl as hu,P5 as i,Ade as ia,PH as ic,qa as id,Dhe as ii,Lf as il,bpe as in,J5 as io,vme as ir,Rhe as is,T0 as it,Rl as iu,jge as j,p1 as ja,nd as jc,ee as jd,Ame as ji,ll as jl,s1 as jn,b0 as jo,Vhe as jr,I9 as js,ooe as jt,xo as ju,Oge as k,uge as ka,Qu as kc,T as kd,Eme as ki,al as kl,q9 as kn,moe as ko,khe as kr,v_e as ks,ipe as kt,ds as ku,rde as l,qZ as la,rne as lc,_r as ld,rge as li,Wd as ll,Hpe as ln,P9 as lo,Ime as lr,m9 as ls,zfe as lt,El as lu,vde as m,eoe as ma,mp as mc,it as md,$he as mi,Jte as ml,b5 as mn,d4 as mo,Fme as mr,JQ as ms,Qfe as mt,Yc as mu,ave as n,toe as na,T4 as nc,M as nd,oge as ni,Pf as nl,roe as nn,HQ as no,gme as nr,d0 as ns,a5 as nt,ml as nu,Mpe as o,ape as oa,Xh as oc,ba as od,D7 as oi,Sd as ol,mpe as on,IX as oo,cge as or,F8 as os,sme as ot,_u as ou,hde as p,P_e as pa,ene as pc,nt as pd,Qhe as pi,Qte as pl,Upe as pn,B_e as po,Hme as pr,S4 as ps,LX as pt,ql as pu,Ife as q,Rge as qa,Ff as qc,Fpe as qi,su as ql,m_e as qn,hge as qo,B7 as qr,Kde as qs,Mde as qt,Ba as qu,O_e as r,jde as ra,Qde as rc,to as rd,sge as ri,vd as rl,xpe as rn,SQ as ro,_me as rr,XQ as rs,H0 as rt,Nl as ru,yfe as s,C$ as sa,B as sc,Gi as sd,__e as si,Pu as sl,gpe as sn,y_e as so,q7 as sr,X6 as ss,cme as st,gl as su,ive as t,noe as ta,Hge as tc,so as td,Ehe as ti,ip as tl,Tpe as tn,M_e as to,hme as tr,c8 as ts,Q8 as tt,Gc as tu,pde as u,Rde as ua,gp as uc,zn as ud,age as ui,ff as ul,Bpe as un,o_e as uo,Lme as ur,s4 as us,Rfe as ut,Al as uu,dde as v,y4 as va,Lte as vc,_e as vd,Sge as vi,Ate as vl,E$ as vn,sue as vo,Zae as vr,R0 as vs,nhe as vt,$c as vu,gQ as w,i7 as wa,Tf as wc,ae as wd,jme as wi,Su as wl,Ffe as wn,pue as wo,U4 as wr,vfe as ws,Ede as wt,Xc as wu,Hfe as x,X_e as xa,wf as xc,ce as xd,ioe as xi,wu as xl,d1 as xn,u0 as xo,z4 as xr,m3 as xs,yde as xt,vu as xu,$ae as y,_4 as ya,Rf as yc,j as yd,Cge as yi,Bf as yl,L0 as yn,efe as yo,L4 as yr,_fe as ys,rhe as yt,Dl as yu,J7 as z,K1 as za,Xte as zc,lhe as zi,pl as zl,doe as zn,v0 as zo,qhe as zr,foe as zs,w0 as zt,uo as zu};
547
+ `).replace(/\n+$/,``)}}function A9(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,{frontmatter:n,body:r}=Jc(t);if(n===``)return{identity:{},starterContent:t};let i=Xc(n),a=S_e(i);if(a)return{identity:a.identity,starterContent:k9(a.docFrontmatterText,r)};let{frontmatter:o}=Jc(r);if(o!==``)return{identity:O9(i),starterContent:r};let s=O9(i);return typeof s.title==`string`?{identity:s,starterContent:r}:{identity:{},starterContent:k9(i,r)}}function C_e(e,t){let{docFrontmatterText:n,markdown:r}=x_e(t),i={};for(let[t,n]of Object.entries(e))n!==void 0&&(i[t]=n);let a=(0,Rc.stringify)({[D9]:i});return`---\n${n.trim()===``?a:`${a}${n}\n`}---\n${r}`}function w_e(e){return A9(e).starterContent}const j9=e=>e*8+4;j9(92),j9(40);const T_e=/^(#{1,6})\s+(.+)$/;function E_e(e,t){let n=(e.endsWith(`\r`)?e.slice(0,-1):e).match(T_e);if(!n)return null;let r=n[2].trim(),i=afe(r,t);return i?{level:n[1].length,text:r,slug:i}:null}Array.from({length:256},(e,t)=>(t+256).toString(16).slice(1));const D_e={fileSystem:`File System`,gitUpstream:`Git (upstream)`,service:`OpenKnowledge (service)`,generator:`OpenKnowledge (generated)`},O_e=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],k_e={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function A_e(e,t=O_e){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const j_e={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`,"claude-acp":`claude`,"codex-acp":`openai`,"github-copilot-cli":`github`};function M9(e){return e?j_e[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const M_e={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function N_e(e){let t=e?.trim();return t?M_e[M9(t)]??t:`Agent`}function N9(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 P9(e){return e===`.`||e===`..`?e:encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.codePointAt(0)?.toString(16).toUpperCase()}`)}function P_e(e){return e.split(`/`).map(P9).join(`/`)}function F9(e){return e.split(`/`).map(N9).join(`/`)}function I9(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=N9(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=`.${(s[1]??``).toLowerCase()}`;if(!C0.includes(e))return null}let c=o.startsWith(`/`),l=c?o.slice(1):o,u=c?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[],d=l.split(`/`),f=d.length-1;for(let e=0;e<d.length;e++){let t=N9(d[e]??``);if(e===f&&(t=_l(t)),t===`..`){if(u.length===0)return null;u.pop()}else t!==`.`&&t!==``&&u.push(t)}return u.length===0?null:{docName:u.join(`/`),anchor:a||null}}function F_e(e){throw Error(`Unhandled ClassifiedLinkTarget variant: ${JSON.stringify(e)}`)}const L9=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function R9(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function z9(e){let t=e.trim();return L9.test(t)||t.startsWith(`//`)}function B9(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(z9(n))return{kind:`external`,url:n};let r=n.indexOf(`#`),i=F9(r<0?n:n.slice(0,r)),a=Sl(i,t);if(a)return{kind:`doc`,docName:a,anchor:r<0?null:n.slice(r+1)};let o=xl(i,t);if(o)return{kind:`doc`,docName:o,anchor:r<0?null:n.slice(r+1)};let s=I9(n,t);if(s)return{kind:`doc`,docName:s.docName,anchor:s.anchor};let c=R9(i);return c&&c!==`md`&&c!==`mdx`?{kind:`asset`,url:n,ext:c,literal:!1}:null}function V9(e,t){let n=e.trim();if(!n)return null;if(z9(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=R9(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r,literal:!0}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function I_e(e,t,n){let r=e.trim();if(!r||L9.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:N9(e));return c.length===0?null:c.join(`/`)}function H9(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function U9(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function W9(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function G9(e){return e.split(`/`).filter(e=>e!==``)}function L_e(e,t){let n=W9(t);return e===``||n===e||n.startsWith(`${e}/`)}function K9(e,t){let n=W9(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:G9(r).length}function q9(e,t){let n=G9(e),r=G9(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function R_e(){let e=new Map;function t(t){let n=H9(t);if(n===``)return;let r=U9(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=H9(t),r=U9(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=W9(H9(n)),o=[],s=[];for(let e of i)L_e(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=K9(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=K9(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=q9(a,W9(t));for(let r=1;r<e.length;r++){let i=e[r],o=q9(a,W9(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}const J9=`unknown`;function z_e(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return J9;let r=Math.floor(Math.max(0,t-n)/1e3);if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function B_e(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function V_e(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}function Y9(e){let t=e?.trim();return t===void 0||t===``?void 0:t}function H_e(e){return e.reason!==void 0||Y9(e.note)!==void 0||Y9(e.email)!==void 0}function U_e(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol===`https:`)return t;let n=t.hostname===`localhost`||t.hostname===`127.0.0.1`||t.hostname===`[::1]`;return t.protocol===`http:`&&n?t:null}function W_e(){return U_e((typeof process>`u`?void 0:Y9(process.env?.OK_FEEDBACK_INTAKE_ORIGIN))??`https://openknowledge.ai`)}function G_e(e){let t=Y9(e);if(t!==void 0)return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)?t:void 0}async function X9(e,t,n){try{let r=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t),signal:AbortSignal.timeout(n)});if(r.ok){let e=await r.json().catch(()=>null);return{ok:!0,reference:typeof e?.reference==`string`?e.reference:``}}return r.status===400||r.status===413?{ok:!1,reason:`invalid`}:r.status===503?{ok:!1,reason:`unavailable`}:{ok:!1,reason:`error`}}catch(e){return{ok:!1,reason:e instanceof Error&&(e.name===`TimeoutError`||e.name===`AbortError`)?`timeout`:`error`}}}async function K_e(e,t={}){let n=W_e();if(n===null)return{ok:!1,reason:`error`};let r=new URL(`/api/feedback`,n),i=Y9(e.note),a=G_e(e.email),o={kind:`uninstall`,reasons:e.reason===void 0?[]:[e.reason],...i===void 0?{}:{message:i},appVersion:e.appVersion,platform:e.platform,source:e.source},s=Date.now()+(t.timeoutMs??4e3),c=()=>s-Date.now();if(a===void 0)return X9(r,o,c());let l=await X9(r,{...o,email:a},c());return l.ok||l.reason!==`invalid`||c()<=0?l:X9(r,o,c())}function Z9(e){return`pagesBySlug`in e}function q_e(e){return Z9(e)?e.pages:e}function J_e(e,t){return Z9(e)?e.assetPaths??new Set:t??new Set}function Y_e(e,t){return Z9(e)?e.filePaths??new Set:t??new Set}function Q9(e,t){return e<t?-1:+(e>t)}function X_e(e,t){let n=new Map;for(let r of e){let e=t(r);e&&!n.has(e)&&n.set(e,r)}return n}function Z_e(e,t){let n=new Map,r=[...e].sort(Q9);for(let e of r){let r=e.lastIndexOf(`/`),i=t(r===-1?e:e.slice(r+1));i&&!n.has(i)&&n.set(i,e)}return n}function Q_e(e,t){let n=s7(e);if(n){if(Z9(t))return t.pagesBySlug.get(n);for(let e of t)if(s7(e)===n)return e}}function $_e(e,t){if(e.includes(`/`))return;let n=s7(e);if(!n)return;if(Z9(t))return t.pagesByBasename?.get(n);let r;for(let e of t){let t=e.lastIndexOf(`/`);s7(t===-1?e:e.slice(t+1))===n&&(r===void 0||Q9(e,r)<0)&&(r=e)}return r}function eve(e){let t=e.trim();if(!t)return[];let n=s7(t);return n.length>0&&n!==t?[n]:[]}function $9(e,t){let n=e.trim();if(!n)return;let r=q_e(t);if(r.has(n))return n;let i=Q_e(n,t);if(i)return i;for(let e of eve(n))if(r.has(e))return e;return tve(n,r)||$_e(n,t)}function tve(e,t){let n=`${e}/index`;if(t.has(n))return n;let r=e.lastIndexOf(`/`),i=r===-1?e:e.slice(r+1),a=i?`${e}/${i}`:null;if(a&&t.has(a))return a}function nve(e){let t=((e.trim().split(`#`)[0]??``).trim().split(`?`)[0]??``).trim();return t.startsWith(`/`)?t.slice(1):t}function rve(e,t,n){let r=nve(e);if(!r)return null;let i=r.toLowerCase(),a=n?[t,n]:[t];for(let e of a){if(e.has(r))return r;for(let t of e)if(t.toLowerCase()===i)return t}if(r.includes(`/`))return null;let o=[];for(let e of a)for(let t of e){let e=t.lastIndexOf(`/`);(e===-1?t:t.slice(e+1)).toLowerCase()===i&&o.push(t)}return o.length===0?null:o.sort(Q9)[0]??null}function ive(e,t,n){let r=V9(e,t);return r===null||r.kind!==`asset`||rve(r.url,J_e(n),Y_e(n))!==null||$9(e,n)===void 0?r:{kind:`doc`,docName:e.trim(),anchor:t?.trim()||null}}const ave=new eue({extensions:o4,deriveStructuralFreshness:!0}),ove=aC(o4);export{D0 as $,l0 as $a,Vte as $c,E0 as $i,hl as $l,epe as $n,sde as $o,Che as $r,x4 as $s,ype as $t,I as $u,Mge as A,uge as Aa,Qu as Ac,T as Ad,Eme as Ai,al as Al,u1 as An,moe as Ao,khe as Ar,v_e as As,upe as At,ds as Au,f1 as B,K1 as Ba,Xte as Bc,lhe as Bi,pl as Bl,k7 as Bn,v0 as Bo,qhe as Br,foe as Bs,Yfe as Bt,uo as Bu,s3 as C,X_e as Ca,Df as Cc,v as Cd,ppe as Ci,Cu as Cl,tme as Cn,z_e as Co,R4 as Cr,zde as Cs,Y5 as Ct,Jc as Cu,R5 as D,i3 as Da,Sf as Dc,x as Dd,Dme as Di,Tu as Dl,u3 as Dn,Woe as Do,J4 as Dr,Vde as Ds,$fe as Dt,Lc as Du,I5 as E,S0 as Ea,kd as Ec,b as Ed,Ome as Ei,Eu as El,Qae as En,l7 as Eo,K4 as Er,f7 as Es,_7 as Et,nl as Eu,Y7 as F,t5 as Fa,kf as Fc,re as Fd,ehe as Fi,sl as Fl,ome as Fn,Z4 as Fo,Yhe as Fr,ive as Fs,f3 as Ft,ys as Fu,Ufe as G,FQ as Ga,jte as Gc,ahe as Gi,il as Gl,N7 as Gn,Nde as Go,Xhe as Gr,s8 as Gs,Cde as Gt,P as Gu,qae as H,Xde as Ha,Gte as Hc,fhe as Hi,Il as Hl,M7 as Hn,j0 as Ho,_he as Hr,ede as Hs,spe as Ht,Ua as Hu,Q7 as I,C_e as Ia,Of as Ic,w as Id,Qme as Ii,Hc as Il,ope as In,z9 as Io,Jhe as Ir,$9 as Is,p9 as It,wte as Iu,C7 as J,Rge as Ja,Ff as Jc,Fpe as Ji,su as Jl,T9 as Jn,hge as Jo,B7 as Jr,Kde as Js,Fde as Jt,Ba as Ju,p7 as K,t8 as Ka,Zte as Kc,Ipe as Ki,tu as Kl,p_e as Kn,Pde as Ko,vge as Kr,BQ as Ks,U5 as Kt,yo as Ku,Z7 as L,iQ as La,sp as Lc,uhe as Li,vl as Ll,dme as Ln,Lde as Lo,Whe as Lr,q1 as Ls,c7 as Lt,ute as Lu,kge as M,p1 as Ma,nd as Mc,ee as Md,Ame as Mi,ll as Ml,G5 as Mn,b0 as Mo,Vhe as Mr,I9 as Ms,Ume as Mt,xo as Mu,Age as N,A_e as Na,xd as Nc,oe as Nd,D9 as Ni,ol as Nl,q5 as Nn,w_e as No,Hhe as Nr,aoe as Ns,Gme as Nt,lte as Nu,r5 as O,B9 as Oa,xf as Oc,ne as Od,Mme as Oi,xu as Ol,Mfe as On,n4 as Oo,Jae as Or,y0 as Os,rpe as Ot,ps as Ou,Dge as P,X$ as Pa,Af as Pc,E as Pd,ghe as Pi,cl as Pl,ame as Pn,Lhe as Po,Uhe as Pr,x0 as Ps,Wpe as Pt,ms as Pu,Xpe as Q,w$ as Qa,qte as Qc,ume as Qi,lu as Ql,D_e as Qn,Y4 as Qo,jhe as Qr,xde as Qs,vpe as Qt,N as Qu,X7 as R,aQ as Ra,td as Rc,ihe as Ri,dl as Rl,fme as Rn,k4 as Ro,Ghe as Rr,Wde as Rs,O0 as Rt,So as Ru,Vfe as S,Z_e as Sa,wf as Sc,ce as Sd,ioe as Si,wu as Sl,rme as Sn,u0 as So,z4 as Sr,m3 as Ss,bde as St,vu as Su,e$ as T,i7 as Ta,Tf as Tc,ae as Td,jme as Ti,Su as Tl,Pfe as Tn,pue as To,U4 as Tr,vfe as Ts,Dde as Tt,Xc as Tu,Tfe as U,R_e as Ua,Cd as Uc,ohe as Ui,Gl as Ul,phe as Un,M$ as Uo,yge as Ur,fge as Us,cpe as Ut,Ga as Uu,c3 as V,G1 as Va,Yte as Vc,dhe as Vi,Ll as Vl,V7 as Vn,h5 as Vo,nge as Vr,t_e as Vs,y7 as Vt,L as Vu,Efe as W,i8 as Wa,Hf as Wc,she as Wi,Kl as Wl,F7 as Wn,O4 as Wo,Tge as Wr,xQ as Ws,Ode as Wt,F as Wu,Qpe as X,$$ as Xa,uf as Xc,jfe as Xi,$l as Xl,i5 as Xn,P7 as Xo,Mhe as Xr,V_e as Xs,Dpe as Xt,R as Xu,Zpe as Y,F9 as Ya,df as Yc,Npe as Yi,ru as Yl,C0 as Yn,qme as Yo,Ahe as Yr,nZ as Ys,Epe as Yt,ao as Yu,Ype as Z,Zde as Za,Hte as Zc,lme as Zi,eu as Zl,b_e as Zn,lue as Zo,zhe as Zr,hQ as Zs,_pe as Zt,$a as Zu,tde as _,cde as _a,Td as _c,Qe as _d,xge as _i,Ute as _l,lpe as _n,i$ as _o,K7 as _r,mZ as _s,the as _t,Sl as _u,jpe as a,Ade as aa,PH as ac,qa as ad,Dhe as ai,Lf as al,Cpe as an,J5 as ao,vme as ar,Rhe as as,fpe as at,Rl as au,ude as b,_4 as ba,Rf as bc,j as bd,Cge as bi,Bf as bl,z0 as bn,efe as bo,L4 as br,_fe as bs,Kfe as bt,Dl as bu,wfe as c,C$ as ca,B as cc,Gi as cd,__e as ci,Pu as cl,Tde as cn,y_e as co,q7 as cr,X6 as cs,Nfe as ct,gl as cu,ide as d,Rde as da,gp as dc,zn as dd,age as di,ff as dl,Rpe as dn,o_e as do,Lme as dr,s4 as ds,$pe as dt,Al as du,U0 as ea,s7 as ec,fo as ed,whe as ei,Hu as el,wpe as en,oQ as eo,tpe as er,$de as es,$ue as et,Ul as eu,mde as f,KZ as fa,tne as fc,Zt as fd,bhe as fi,Ru as fl,Lpe as fn,Zme as fo,Rme as fr,uoe as fs,eme as ft,wl as fu,fde as g,pge as ga,$u as gc,ot as gd,bge as gi,Kte as gl,A0 as gn,V1 as go,mge as gr,r_e as gs,J1 as gt,yl as gu,nde as h,eoe as ha,mp as hc,it as hd,$he as hi,Jte as hl,g5 as hn,d4 as ho,Fme as hr,JQ as hs,Jpe as ht,Yc as hu,P5 as i,jde as ia,Qde as ic,to as id,sge as ii,vd as il,bpe as in,SQ as io,_me as ir,XQ as is,T0 as it,Nl as iu,jge as j,V9 as ja,Mf as jc,te as jd,kme as ji,ul as jl,s1 as jn,M9 as jo,Bhe as jr,s0 as js,ooe as jt,is as ju,Oge as k,I0 as ka,bf as kc,S as kd,Nme as ki,Ml as kl,J9 as kn,H_e as ko,Yae as kr,I_e as ks,ipe as kt,fs as ku,rde as l,a0 as la,pp as lc,Ui as ld,ege as li,If as ll,Hpe as ln,P_e as lo,gge as lr,GQ as ls,zfe as lt,Qc as lu,vde as m,F_e as ma,ene as mc,nt as md,Qhe as mi,Qte as ml,b5 as mn,B_e as mo,Hme as mr,S4 as ms,Qfe as mt,ql as mu,ove as n,noe as na,Hge as nc,so as nd,Ehe as ni,ip as nl,roe as nn,N_e as no,hme as nr,c8 as ns,a5 as nt,Gc as nu,Mpe as o,M5 as oa,$V as oc,Sa as od,Ohe as oi,Jf as ol,mpe as on,loe as oo,bme as or,x$ as os,sme as ot,fu as ou,hde as p,mQ as pa,$te as pc,et as pd,xhe as pi,Fu as pl,Upe as pn,jX as po,zme as pr,A9 as ps,LX as pt,hu as pu,Ife as q,i9 as qa,Ud as qc,Ppe as qi,nu as ql,m_e as qn,V0 as qo,Zhe as qr,C4 as qs,Mde as qt,ro as qu,k_e as r,toe as ra,T4 as rc,M as rd,oge as ri,Pf as rl,xpe as rn,HQ as ro,gme as rr,d0 as rs,H0 as rt,ml as ru,yfe as s,ape as sa,Xh as sc,ba as sd,D7 as si,Sd as sl,gpe as sn,IX as so,cge as sr,F8 as ss,cme as st,_u as su,ave as t,I7 as ta,QQ as tc,bo as td,The as ti,bd as tl,Tpe as tn,m4 as to,yme as tr,TQ as ts,Q8 as tt,du as tu,pde as u,qZ as ua,rne as uc,_r as ud,rge as ui,Wd as ul,Bpe as un,P9 as uo,Ime as ur,m9 as us,Rfe as ut,El as uu,dde as v,OZ as va,Wte as vc,ke as vd,She as vi,Mte as vl,E$ as vn,Yde as vo,G7 as vr,K_e as vs,nhe as vt,Wl as vu,gQ as w,bZ as wa,Ef as wc,y as wd,Pme as wi,yu as wl,Ffe as wn,qQ as wo,W4 as wr,Bde as ws,Ede as wt,jl as wu,Hfe as x,eZ as xa,rd as xc,D as xd,Gpe as xi,Vf as xl,d1 as xn,K8 as xo,I4 as xr,lQ as xs,yde as xt,gu as xu,$ae as y,y4 as ya,Lte as yc,_e as yd,Sge as yi,Ate as yl,L0 as yn,sue as yo,Zae as yr,R0 as ys,rhe as yt,$c as yu,J7 as z,hhe as za,ed as zc,che as zi,fl as zl,doe as zn,a3 as zo,Khe as zr,E_e as zs,w0 as zt,Ra as zu};
@@ -1 +1 @@
1
- import{$a as e}from"./dist-CcOixwu-.mjs";import{execFile as t}from"node:child_process";const n=new Set([`http:`,`https:`]),r=/[\u0000-\u0020\u007F-\u009F"'`\\&|<>^()$;{}[\]*?!~]/;function i(e,t){console.warn(`Could not auto-open browser (${t}); visit ${e} manually`)}function a(a){let o;try{o=new URL(a)}catch{i(a,`invalid URL`);return}if(!n.has(o.protocol)){i(a,`unsupported scheme '${o.protocol}'`);return}if(r.test(a)){i(a,`URL contains unsafe characters`);return}let s=process.platform===`darwin`?`open`:process.platform===`win32`?`cmd`:`xdg-open`,c=process.platform===`win32`?[`/c`,`start`,``,a]:[a];t(s,c,e({}),e=>{e&&console.warn(`Could not auto-open browser (${e.message}); visit ${a} manually`)})}export{a as openBrowser};
1
+ import{$a as e}from"./dist-CVJfSfJh.mjs";import{execFile as t}from"node:child_process";const n=new Set([`http:`,`https:`]),r=/[\u0000-\u0020\u007F-\u009F"'`\\&|<>^()$;{}[\]*?!~]/;function i(e,t){console.warn(`Could not auto-open browser (${t}); visit ${e} manually`)}function a(a){let o;try{o=new URL(a)}catch{i(a,`invalid URL`);return}if(!n.has(o.protocol)){i(a,`unsupported scheme '${o.protocol}'`);return}if(r.test(a)){i(a,`URL contains unsafe characters`);return}let s=process.platform===`darwin`?`open`:process.platform===`win32`?`cmd`:`xdg-open`,c=process.platform===`win32`?[`/c`,`start`,``,a]:[a];t(s,c,e({}),e=>{e&&console.warn(`Could not auto-open browser (${e.message}); visit ${a} manually`)})}export{a as openBrowser};
@@ -1 +1 @@
1
- import{t as e}from"./md-manager-BGnqyqi1-BjukM0Wf.mjs";import{parentPort as t}from"node:worker_threads";function n(t){try{let n,r;if(t.embedTable!==void 0&&t.sourcePath!==void 0){let e=t.embedTable;r={sourcePath:t.sourcePath,resolveEmbed:t=>e[t]?.path??null,...t.wantSizes?{resolveSize:t=>e[t]?.size??null}:{}}}else if(t.recordEmbeds&&t.sourcePath!==void 0){let e=new Set;n=e,r={sourcePath:t.sourcePath,resolveEmbed:t=>(e.add(t),null),...t.wantSizes?{resolveSize:t=>(e.add(t),null)}:{}}}let i=e.parseWithFallback(t.body,r);return n!==void 0&&n.size>0?{id:t.id,ok:!0,parsedJson:i,requestedTargets:[...n]}:{id:t.id,ok:!0,parsedJson:i}}catch(e){return{id:t.id,ok:!1,message:e instanceof Error?e.message.slice(0,500):String(e).slice(0,500)}}}t?.on(`message`,e=>{t?.postMessage(n(e))});export{};
1
+ import{t as e}from"./md-manager-BGnqyqi1-BMsQT5x6.mjs";import{parentPort as t}from"node:worker_threads";function n(t){try{let n,r;if(t.embedTable!==void 0&&t.sourcePath!==void 0){let e=t.embedTable;r={sourcePath:t.sourcePath,resolveEmbed:t=>e[t]?.path??null,...t.wantSizes?{resolveSize:t=>e[t]?.size??null}:{}}}else if(t.recordEmbeds&&t.sourcePath!==void 0){let e=new Set;n=e,r={sourcePath:t.sourcePath,resolveEmbed:t=>(e.add(t),null),...t.wantSizes?{resolveSize:t=>(e.add(t),null)}:{}}}let i=e.parseWithFallback(t.body,r);return n!==void 0&&n.size>0?{id:t.id,ok:!0,parsedJson:i,requestedTargets:[...n]}:{id:t.id,ok:!0,parsedJson:i}}catch(e){return{id:t.id,ok:!1,message:e instanceof Error?e.message.slice(0,500):String(e).slice(0,500)}}}t?.on(`message`,e=>{t?.postMessage(n(e))});export{};
@@ -1,2 +1,2 @@
1
- import{gn as e}from"./dist-CcOixwu-.mjs";import"./constants-D-4RXqyQ.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);a.push(``);let c=t(i,`.ok`,`config.yml`);return r(c)?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
1
+ import{gn as e}from"./dist-CVJfSfJh.mjs";import"./constants-CEZpdo1d.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);a.push(``);let c=t(i,`.ok`,`config.yml`);return r(c)?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
2
2
  `)}export{c as n,l as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./preview-BB49HMe1.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{a as n,i as r}from"./DocumentContext-Ckj_fGkD.js";import{t as i}from"./react-f2sANaYj.js";import{n as a,r as o}from"./dist-Nvb76hAm.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{t as c}from"./button-Cym3gapE.js";import{i as l,n as u,t as d}from"./tooltip-BnyyQDRs.js";import{a as f,c as p,i as m,o as h,s as g,t as _}from"./dialog-DgIQr9zS.js";import{n as v}from"./dist-CJhtNlOm2.js";import{t as y}from"./dist-Cr4-nBVI.js";import{m as b}from"./Mermaid-C8EPNkJP.js";import{n as x}from"./upload-DGQJhdiQ.js";import{i as S}from"./prop-types-CSOYPYXZ.js";import{t as C}from"./spinner-Bp2_BYkl.js";import{t as w}from"./undo-2-BQ-ulCEU.js";import{l as T}from"./doc-hash-CPpxYNQW.js";import{s as E}from"./navigation-targets-3lAZ5aUO.js";import{a as D,i as O,n as k,o as A,t as ee}from"./agent-diff-store-DkuxiJNK.js";import{t as j}from"./timeline-diff-store-B803XeuZ.js";import{n as M}from"./use-activity-panel-L8e44D-R.js";var N=s(),P=e(i(),1),F=t();function te(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function I(e){let t=(0,N.c)(86),{burst:n,docName:r,editCount:i,sessionAlive:s,inFlight:v,onOpenDiff:y,onRestore:b}=e,{_:x}=o(),[S,T]=(0,P.useState)(ne),E,O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{let e=setInterval(()=>T(Date.now()),3e4);return()=>clearInterval(e)},O=[],t[0]=E,t[1]=O):(E=t[0],O=t[1]),(0,P.useEffect)(E,O);let[k,A]=(0,P.useState)(!1),ee=D(),j=n.stackIndex+1,M=ee?.docName===r&&ee.keptCount===j,I=i-j,re=!s||v||I<=0,ie;t[2]!==I||t[3]!==b?(ie=function(){A(!1),b(I)},t[2]=I,t[3]=b,t[4]=ie):ie=t[4];let ae=ie,L;t[5]!==n||t[6]!==y?(L=()=>y(n),t[5]=n,t[6]=y,t[7]=L):L=t[7];let R;t[8]!==x||t[9]!==j||t[10]!==r?(R=x({id:`Z79bnE`,values:{burstNumber:j,docName:r}}),t[8]=x,t[9]=j,t[10]=r,t[11]=R):R=t[11];let oe=M?`bg-muted`:`hover:bg-muted/40`,se;t[12]===oe?se=t[13]:(se=[`flex min-w-0 flex-1 items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground transition-colors`,oe],t[12]=oe,t[13]=se);let ce=se.join(` `),z;t[14]!==n.ts||t[15]!==S?(z=te(n.ts,S),t[14]=n.ts,t[15]=S,t[16]=z):z=t[16];let B;t[17]===z?B=t[18]:(B=(0,F.jsx)(`span`,{className:`font-mono`,children:z}),t[17]=z,t[18]=B);let V;t[19]===n.additions?V=t[20]:(V=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[19]=n.additions,t[20]=V);let H;t[21]===n.deletions?H=t[22]:(H=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[21]=n.deletions,t[22]=H);let U;t[23]!==V||t[24]!==H?(U=(0,F.jsxs)(`span`,{className:`ml-auto font-mono`,children:[V,` `,H]}),t[23]=V,t[24]=H,t[25]=U):U=t[25];let W;t[26]!==M||t[27]!==B||t[28]!==U||t[29]!==L||t[30]!==R||t[31]!==ce?(W=(0,F.jsxs)(`button`,{type:`button`,onClick:L,"aria-pressed":M,"aria-label":R,"data-testid":`activity-panel-burst-open`,className:ce,children:[B,U]}),t[26]=M,t[27]=B,t[28]=U,t[29]=L,t[30]=R,t[31]=ce,t[32]=W):W=t[32];let le;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1.5 h-3 w-px shrink-0 bg-border`}),t[33]=le):le=t[33];let G;t[34]!==x||t[35]!==j||t[36]!==r?(G=x({id:`Zhe80e`,values:{burstNumber:j,docName:r}}),t[34]=x,t[35]=j,t[36]=r,t[37]=G):G=t[37];let ue;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>A(!0),t[38]=ue):ue=t[38];let K;t[39]===v?K=t[40]:(K=v?(0,F.jsx)(C,{className:`size-3`,"aria-hidden":`true`}):(0,F.jsx)(w,{className:`size-3`,"aria-hidden":`true`}),t[39]=v,t[40]=K);let q;t[41]!==re||t[42]!==G||t[43]!==K?(q=(0,F.jsx)(l,{asChild:!0,children:(0,F.jsx)(c,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`activity-panel-burst-restore`,"aria-label":G,disabled:re,onClick:ue,children:K})}),t[41]=re,t[42]=G,t[43]=K,t[44]=q):q=t[44];let J;t[45]!==x||t[46]!==I||t[47]!==s?(J=x(s?I>0?{id:`SOPwPh`}:{id:`62bOuM`}:{id:`NzFvyK`}),t[45]=x,t[46]=I,t[47]=s,t[48]=J):J=t[48];let Y;t[49]===J?Y=t[50]:(Y=(0,F.jsx)(u,{side:`left`,children:J}),t[49]=J,t[50]=Y);let X;t[51]!==q||t[52]!==Y?(X=(0,F.jsxs)(d,{children:[q,Y]}),t[51]=q,t[52]=Y,t[53]=X):X=t[53];let Z;t[54]!==W||t[55]!==X?(Z=(0,F.jsxs)(`div`,{className:`flex items-center border-t border-border/50 pr-3`,children:[W,le,X]}),t[54]=W,t[55]=X,t[56]=Z):Z=t[56];let Q;t[57]===v?Q=t[58]:(Q=e=>{!e&&!v?A(!1):e&&A(!0)},t[57]=v,t[58]=Q);let de;t[59]===x?de=t[60]:(de=x({id:`a4FRQv`}),t[59]=x,t[60]=de);let fe;t[61]===de?fe=t[62]:(fe=(0,F.jsx)(p,{children:de}),t[61]=de,t[62]=fe);let pe;t[63]===I?pe=t[64]:(pe=(0,F.jsx)(f,{children:(0,F.jsx)(a,{id:`LKIPzv`,values:{laterEdits:I}})}),t[63]=I,t[64]=pe);let $;t[65]!==fe||t[66]!==pe?($=(0,F.jsxs)(g,{children:[fe,pe]}),t[65]=fe,t[66]=pe,t[67]=$):$=t[67];let me;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,F.jsx)(c,{variant:`outline`,"data-testid":`activity-panel-burst-restore-cancel`,onClick:()=>A(!1),children:(0,F.jsx)(a,{id:`dEgA5A`})}),t[68]=me):me=t[68];let he;t[69]===v?he=t[70]:(he=v?(0,F.jsx)(C,{className:`mr-2 size-4`,"aria-hidden":`true`}):null,t[69]=v,t[70]=he);let ge;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,F.jsx)(a,{id:`9uI_rE`}),t[71]=ge):ge=t[71];let _e;t[72]!==ae||t[73]!==v||t[74]!==he?(_e=(0,F.jsxs)(h,{children:[me,(0,F.jsxs)(c,{variant:`destructive`,"data-testid":`activity-panel-burst-restore-confirm`,disabled:v,onClick:ae,children:[he,ge]})]}),t[72]=ae,t[73]=v,t[74]=he,t[75]=_e):_e=t[75];let ve;t[76]!==$||t[77]!==_e?(ve=(0,F.jsxs)(m,{children:[$,_e]}),t[76]=$,t[77]=_e,t[78]=ve):ve=t[78];let ye;t[79]!==k||t[80]!==Q||t[81]!==ve?(ye=(0,F.jsx)(_,{open:k,onOpenChange:Q,children:ve}),t[79]=k,t[80]=Q,t[81]=ve,t[82]=ye):ye=t[82];let be;return t[83]!==Z||t[84]!==ye?(be=(0,F.jsxs)(F.Fragment,{children:[Z,ye]}),t[83]=Z,t[84]=ye,t[85]=be):be=t[85],be}function ne(){return Date.now()}function re(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return y._({id:`nYeBmY`,values:{hours:r}})}function ie(e){let t=(0,N.c)(56),{file:n,sessionAlive:r,isWriting:i,onNavigate:s,onUndoDrop:c,onSetVersion:l}=e,{_:u}=o(),{docName:d}=n,[f,p]=(0,P.useState)(!1),[m,h]=(0,P.useState)(ae),g,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=setInterval(()=>h(Date.now()),3e4);return()=>clearInterval(e)},_=[],t[0]=g,t[1]=_):(g=t[0],_=t[1]),(0,P.useEffect)(g,_);let v=n.bursts.length,y;t[2]!==n.docName||t[3]!==c||t[4]!==r||t[5]!==f?(y=e=>{e<=0||!r||f||(p(!0),Promise.resolve(c(n.docName,e)).finally(()=>{p(!1),ee()}))},t[2]=n.docName,t[3]=c,t[4]=r,t[5]=f,t[6]=y):y=t[6];let b=y;if(n.bursts.length===0)return null;let x;t[7]!==n.docName||t[8]!==s?(x=()=>s(n.docName),t[7]=n.docName,t[8]=s,t[9]=x):x=t[9];let S;t[10]!==u||t[11]!==d?(S=u({id:`QcpeeE`,values:{docName:d}}),t[10]=u,t[11]=d,t[12]=S):S=t[12];let C;t[13]!==n.docName||t[14]!==x||t[15]!==S?(C=(0,F.jsx)(`button`,{type:`button`,onClick:x,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":S,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[13]=n.docName,t[14]=x,t[15]=S,t[16]=C):C=t[16];let w;t[17]===n.additionsTotal?w=t[18]:(w=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[17]=n.additionsTotal,t[18]=w);let T;t[19]===n.deletionsTotal?T=t[20]:(T=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[19]=n.deletionsTotal,t[20]=T);let E;t[21]!==w||t[22]!==T?(E=(0,F.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[w,` `,T]}),t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==n.lastTs||t[25]!==m?(D=re(n.lastTs,m),t[24]=n.lastTs,t[25]=m,t[26]=D):D=t[26];let O;t[27]===D?O=t[28]:(O=(0,F.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:D}),t[27]=D,t[28]=O);let k;t[29]===i?k=t[30]:(k=i?(0,F.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,F.jsx)(a,{id:`6q0rnH`})}):null,t[29]=i,t[30]=k);let A;t[31]!==O||t[32]!==k||t[33]!==C||t[34]!==E?(A=(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[C,E,O,k]}),t[31]=O,t[32]=k,t[33]=C,t[34]=E,t[35]=A):A=t[35];let j;if(t[36]!==b||t[37]!==v||t[38]!==n.bursts||t[39]!==n.docName||t[40]!==l||t[41]!==r||t[42]!==f){let e;t[44]!==b||t[45]!==v||t[46]!==n.docName||t[47]!==l||t[48]!==r||t[49]!==f?(e=e=>(0,F.jsx)(I,{burst:e,docName:n.docName,editCount:v,sessionAlive:r,inFlight:f,onOpenDiff:e=>l(e.stackIndex+1),onRestore:b},`${n.docName}:${e.stackIndex}`),t[44]=b,t[45]=v,t[46]=n.docName,t[47]=l,t[48]=r,t[49]=f,t[50]=e):e=t[50],j=n.bursts.map(e),t[36]=b,t[37]=v,t[38]=n.bursts,t[39]=n.docName,t[40]=l,t[41]=r,t[42]=f,t[43]=j}else j=t[43];let M;t[51]===j?M=t[52]:(M=(0,F.jsx)(`div`,{children:j}),t[51]=j,t[52]=M);let te;return t[53]!==A||t[54]!==M?(te=(0,F.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[A,M]}),t[53]=A,t[54]=M,t[55]=te):te=t[55],te}function ae(){return Date.now()}async function L(e){let t=await fetch(`/api/agent-undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,agentId:e.connectionId})});if(!t.ok)throw Error(`agent-undo failed: HTTP ${t.status}`)}function R(e){typeof window>`u`||(window.location.hash=T(e))}function oe(){let e=(0,N.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(C,{className:`mr-2 size-4`,"aria-hidden":`true`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,F.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,F.jsx)(`span`,{className:`text-sm`,children:(0,F.jsx)(a,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function se(e){let t=(0,N.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,F.jsx)(x,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,F.jsx)(`p`,{className:`text-sm font-medium`,children:(0,F.jsx)(a,{id:`DhLHEb`})}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,F.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(a,{id:`6gRgw8`}),t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=(0,F.jsx)(c,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:l}),t[5]=r,t[6]=u);let d;return t[7]!==s||t[8]!==u?(d=(0,F.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,u]}),t[7]=s,t[8]=u,t[9]=d):d=t[9],d}function ce(){let e=(0,N.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,F.jsx)(`p`,{className:`text-sm italic`,children:(0,F.jsx)(a,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function z(e){let t=(0,N.c)(12),{onExit:n,showBackButton:r}=e,{_:i}=o(),s;t[0]===i?s=t[1]:(s=i({id:`kYL1lH`}),t[0]=i,t[1]=s);let c;t[2]!==n||t[3]!==r?(c=r?(0,F.jsx)(B,{onClick:n}):null,t[2]=n,t[3]=r,t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[c,l]}),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,F.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,F.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,F.jsx)(a,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==u?(f=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":s,children:[u,d]}),t[9]=s,t[10]=u,t[11]=f):f=t[11],f}function B(e){let t=(0,N.c)(9),{onClick:n}=e,{_:r}=o(),i;t[0]===r?i=t[1]:(i=r({id:`ogAuyr`}),t[0]=r,t[1]=i);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(b,{}),t[2]=s):s=t[2];let f;t[3]!==n||t[4]!==i?(f=(0,F.jsx)(l,{asChild:!0,children:(0,F.jsx)(c,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":i,"data-testid":`docpanel-exit-agent-mode`,children:s})}),t[3]=n,t[4]=i,t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,F.jsx)(u,{side:`bottom`,children:(0,F.jsx)(a,{id:`ogAuyr`})}),t[6]=p):p=t[6];let m;return t[7]===f?m=t[8]:(m=(0,F.jsxs)(d,{children:[f,p]}),t[7]=f,t[8]=m),m}function V(e){let t=(0,N.c)(9),{lastTs:n}=e,[r]=(0,P.useState)(H),i;t[0]!==n||t[1]!==r?(i=n?U(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(`span`,{className:`font-medium`,children:(0,F.jsx)(a,{id:`LCUy_N`})}),t[3]=s):s=t[3];let c;t[4]===o?c=t[5]:(c=o?(0,F.jsxs)(`span`,{children:[` · `,o]}):null,t[4]=o,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,F.jsx)(a,{id:`GK-IRZ`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,F.jsxs)(`div`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"data-testid":`activity-panel-session-ended`,children:[s,c,l]}),t[7]=c,t[8]=u),u}function H(){return Date.now()}function U(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return y._({id:`nYeBmY`,values:{hours:n}})}function W(e){let t=(0,N.c)(10),{agent:n,size:r}=e,i=r===void 0?28:r,a;t[0]!==n.color||t[1]!==i?(a={backgroundColor:n.color,width:i,height:i},t[0]=n.color,t[1]=i,t[2]=a):a=t[2];let o=i*.57,s=i*.57,c;t[3]!==n.icon||t[4]!==o||t[5]!==s?(c=(0,F.jsx)(A,{icon:n.icon,width:o,height:s}),t[3]=n.icon,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,F.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function le(e){let t=(0,N.c)(25),{data:n,status:r,error:i,reload:s,onExit:c,onNavigate:l,onUndoDrop:u,onSetVersion:d,showBackButton:f}=e,{_:p}=o(),m=n?.files?.[0]?.lastTs??null,h=n?.files?.length??0,g;t[0]===p?g=t[1]:(g=p({id:`kYL1lH`}),t[0]=p,t[1]=g);let _;t[2]!==c||t[3]!==f?(_=f?(0,F.jsx)(B,{onClick:c}):null,t[2]=c,t[3]=f,t[4]=_):_=t[4];let v;t[5]!==n||t[6]!==h||t[7]!==m?(v=n?.agent?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(W,{agent:n.agent}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,F.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,F.jsx)(a,{id:`F6pfE9`}):m===null?(0,F.jsx)(a,{id:`PMyJ9C`}):(0,F.jsx)(a,{id:`237hSL`}),n.files.length>0?(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsx)(a,{id:`u3BOHd`,values:{fileCount:h}})]}):null]})]})]}):(0,F.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})})}),t[5]=n,t[6]=h,t[7]=m,t[8]=v):v=t[8];let y;t[9]!==_||t[10]!==v?(y=(0,F.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]!==n||t[13]!==i||t[14]!==m||t[15]!==l||t[16]!==d||t[17]!==u||t[18]!==s||t[19]!==r?(b=(0,F.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:r===`loading`&&n===null?(0,F.jsx)(oe,{}):r===`error`&&i?(0,F.jsx)(se,{error:i,onRetry:s}):n===null?(0,F.jsx)(ce,{}):(0,F.jsxs)(F.Fragment,{children:[!n.sessionAlive&&m!==null?(0,F.jsx)(V,{lastTs:m}):null,n.files.length===0?(0,F.jsx)(ce,{}):n.files.map(e=>(0,F.jsx)(ie,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:l,onUndoDrop:u,onSetVersion:t=>d(e,t)},e.docName))]})}),t[12]=n,t[13]=i,t[14]=m,t[15]=l,t[16]=d,t[17]=u,t[18]=s,t[19]=r,t[20]=b):b=t[20];let x;return t[21]!==g||t[22]!==y||t[23]!==b?(x=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":g,children:[y,b]}),t[21]=g,t[22]=y,t[23]=b,t[24]=x):x=t[24],x}function G(e){let t=(0,N.c)(30),i;t[0]===e?i=t[1]:(i=e===void 0?{}:e,t[0]=e,t[1]=i);let{showBackButton:a}=i,s=a===void 0?!0:a,{_:c}=o(),{docPanelAgentId:l,closeActivityPanel:u}=r(),{openTargetTransition:d}=n(),{pageMeta:f}=S(),{data:p,status:m,error:h,reload:g}=M(l),_,y;if(t[2]!==p||t[3]!==l?(_=()=>{if(!(!p||l===null))for(let e of p.files)O(l,e.docName,e.bursts.length)},y=[p,l],t[2]=p,t[3]=l,t[4]=_,t[5]=y):(_=t[4],y=t[5]),(0,P.useEffect)(_,y),l===null){let e;return t[6]!==u||t[7]!==s?(e=(0,F.jsx)(z,{onExit:u,showBackButton:s}),t[6]=u,t[7]=s,t[8]=e):e=t[8],e}let b;t[9]!==d||t[10]!==f?(b=e=>{d(E({kind:`doc`,target:e,docName:e},f),{disposition:`permanent`,consumeActiveNewTab:!0}),R(e)},t[9]=d,t[10]=f,t[11]=b):b=t[11];let x=b,C;t[12]!==p||t[13]!==l?(C=(e,t)=>{if(!p?.agent||l===null)return;j();let n=e.bursts.length;k({agentId:l,agentName:p.agent.displayName,agentColor:p.agent.color,agentIcon:p.agent.icon,docName:e.docName,keptCount:Math.max(0,Math.min(t,n)),maxVersions:n})},t[12]=p,t[13]=l,t[14]=C):C=t[14];let w=C,T;t[15]!==c||t[16]!==p||t[17]!==l||t[18]!==g?(T=async(e,t)=>{if(!(t<=0))try{await L({connectionId:l,docName:e,scope:`count`,count:t,agentName:p?.agent?.displayName}),v.success(c(t===1?{id:`-dNlfM`,values:{docName:e}}:{id:`ApeA0n`,values:{dropCount:t,docName:e}})),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);v.error(c({id:`EqrC_R`,values:{message:n}})),g()}},t[15]=c,t[16]=p,t[17]=l,t[18]=g,t[19]=T):T=t[19];let D=T,A;return t[20]!==u||t[21]!==p||t[22]!==h||t[23]!==x||t[24]!==w||t[25]!==D||t[26]!==g||t[27]!==s||t[28]!==m?(A=(0,F.jsx)(le,{data:p,status:m,error:h,reload:g,onExit:u,onNavigate:x,onUndoDrop:D,onSetVersion:w,showBackButton:s}),t[20]=u,t[21]=p,t[22]=h,t[23]=x,t[24]=w,t[25]=D,t[26]=g,t[27]=s,t[28]=m,t[29]=A):A=t[29],A}export{G as ActivityModeContent};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{a as n,i as r}from"./DocumentContext-Ce2jrrZM.js";import{t as i}from"./react-f2sANaYj.js";import{n as a,r as o}from"./dist-Nvb76hAm.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{t as c}from"./button-Cym3gapE.js";import{i as l,n as u,t as d}from"./tooltip-BnyyQDRs.js";import{a as f,c as p,i as m,o as h,s as g,t as _}from"./dialog-DgIQr9zS.js";import{n as v}from"./dist-CJhtNlOm2.js";import{t as y}from"./dist-Cr4-nBVI.js";import{m as b}from"./Mermaid-C8EPNkJP.js";import{n as x}from"./upload-DGQJhdiQ.js";import{i as S}from"./prop-types-CSOYPYXZ.js";import{t as C}from"./spinner-Bp2_BYkl.js";import{t as w}from"./undo-2-BQ-ulCEU.js";import{l as T}from"./doc-hash-CPpxYNQW.js";import{s as E}from"./navigation-targets-3lAZ5aUO.js";import{a as D,i as O,n as k,o as A,t as ee}from"./agent-diff-store-DkuxiJNK.js";import{t as j}from"./timeline-diff-store-B803XeuZ.js";import{n as M}from"./use-activity-panel-mkYR166G.js";var N=s(),P=e(i(),1),F=t();function te(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function I(e){let t=(0,N.c)(86),{burst:n,docName:r,editCount:i,sessionAlive:s,inFlight:v,onOpenDiff:y,onRestore:b}=e,{_:x}=o(),[S,T]=(0,P.useState)(ne),E,O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{let e=setInterval(()=>T(Date.now()),3e4);return()=>clearInterval(e)},O=[],t[0]=E,t[1]=O):(E=t[0],O=t[1]),(0,P.useEffect)(E,O);let[k,A]=(0,P.useState)(!1),ee=D(),j=n.stackIndex+1,M=ee?.docName===r&&ee.keptCount===j,I=i-j,re=!s||v||I<=0,ie;t[2]!==I||t[3]!==b?(ie=function(){A(!1),b(I)},t[2]=I,t[3]=b,t[4]=ie):ie=t[4];let ae=ie,L;t[5]!==n||t[6]!==y?(L=()=>y(n),t[5]=n,t[6]=y,t[7]=L):L=t[7];let R;t[8]!==x||t[9]!==j||t[10]!==r?(R=x({id:`Z79bnE`,values:{burstNumber:j,docName:r}}),t[8]=x,t[9]=j,t[10]=r,t[11]=R):R=t[11];let oe=M?`bg-muted`:`hover:bg-muted/40`,se;t[12]===oe?se=t[13]:(se=[`flex min-w-0 flex-1 items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground transition-colors`,oe],t[12]=oe,t[13]=se);let ce=se.join(` `),z;t[14]!==n.ts||t[15]!==S?(z=te(n.ts,S),t[14]=n.ts,t[15]=S,t[16]=z):z=t[16];let B;t[17]===z?B=t[18]:(B=(0,F.jsx)(`span`,{className:`font-mono`,children:z}),t[17]=z,t[18]=B);let V;t[19]===n.additions?V=t[20]:(V=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[19]=n.additions,t[20]=V);let H;t[21]===n.deletions?H=t[22]:(H=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[21]=n.deletions,t[22]=H);let U;t[23]!==V||t[24]!==H?(U=(0,F.jsxs)(`span`,{className:`ml-auto font-mono`,children:[V,` `,H]}),t[23]=V,t[24]=H,t[25]=U):U=t[25];let W;t[26]!==M||t[27]!==B||t[28]!==U||t[29]!==L||t[30]!==R||t[31]!==ce?(W=(0,F.jsxs)(`button`,{type:`button`,onClick:L,"aria-pressed":M,"aria-label":R,"data-testid":`activity-panel-burst-open`,className:ce,children:[B,U]}),t[26]=M,t[27]=B,t[28]=U,t[29]=L,t[30]=R,t[31]=ce,t[32]=W):W=t[32];let le;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1.5 h-3 w-px shrink-0 bg-border`}),t[33]=le):le=t[33];let G;t[34]!==x||t[35]!==j||t[36]!==r?(G=x({id:`Zhe80e`,values:{burstNumber:j,docName:r}}),t[34]=x,t[35]=j,t[36]=r,t[37]=G):G=t[37];let ue;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>A(!0),t[38]=ue):ue=t[38];let K;t[39]===v?K=t[40]:(K=v?(0,F.jsx)(C,{className:`size-3`,"aria-hidden":`true`}):(0,F.jsx)(w,{className:`size-3`,"aria-hidden":`true`}),t[39]=v,t[40]=K);let q;t[41]!==re||t[42]!==G||t[43]!==K?(q=(0,F.jsx)(l,{asChild:!0,children:(0,F.jsx)(c,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`activity-panel-burst-restore`,"aria-label":G,disabled:re,onClick:ue,children:K})}),t[41]=re,t[42]=G,t[43]=K,t[44]=q):q=t[44];let J;t[45]!==x||t[46]!==I||t[47]!==s?(J=x(s?I>0?{id:`SOPwPh`}:{id:`62bOuM`}:{id:`NzFvyK`}),t[45]=x,t[46]=I,t[47]=s,t[48]=J):J=t[48];let Y;t[49]===J?Y=t[50]:(Y=(0,F.jsx)(u,{side:`left`,children:J}),t[49]=J,t[50]=Y);let X;t[51]!==q||t[52]!==Y?(X=(0,F.jsxs)(d,{children:[q,Y]}),t[51]=q,t[52]=Y,t[53]=X):X=t[53];let Z;t[54]!==W||t[55]!==X?(Z=(0,F.jsxs)(`div`,{className:`flex items-center border-t border-border/50 pr-3`,children:[W,le,X]}),t[54]=W,t[55]=X,t[56]=Z):Z=t[56];let Q;t[57]===v?Q=t[58]:(Q=e=>{!e&&!v?A(!1):e&&A(!0)},t[57]=v,t[58]=Q);let de;t[59]===x?de=t[60]:(de=x({id:`a4FRQv`}),t[59]=x,t[60]=de);let fe;t[61]===de?fe=t[62]:(fe=(0,F.jsx)(p,{children:de}),t[61]=de,t[62]=fe);let pe;t[63]===I?pe=t[64]:(pe=(0,F.jsx)(f,{children:(0,F.jsx)(a,{id:`LKIPzv`,values:{laterEdits:I}})}),t[63]=I,t[64]=pe);let $;t[65]!==fe||t[66]!==pe?($=(0,F.jsxs)(g,{children:[fe,pe]}),t[65]=fe,t[66]=pe,t[67]=$):$=t[67];let me;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,F.jsx)(c,{variant:`outline`,"data-testid":`activity-panel-burst-restore-cancel`,onClick:()=>A(!1),children:(0,F.jsx)(a,{id:`dEgA5A`})}),t[68]=me):me=t[68];let he;t[69]===v?he=t[70]:(he=v?(0,F.jsx)(C,{className:`mr-2 size-4`,"aria-hidden":`true`}):null,t[69]=v,t[70]=he);let ge;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,F.jsx)(a,{id:`9uI_rE`}),t[71]=ge):ge=t[71];let _e;t[72]!==ae||t[73]!==v||t[74]!==he?(_e=(0,F.jsxs)(h,{children:[me,(0,F.jsxs)(c,{variant:`destructive`,"data-testid":`activity-panel-burst-restore-confirm`,disabled:v,onClick:ae,children:[he,ge]})]}),t[72]=ae,t[73]=v,t[74]=he,t[75]=_e):_e=t[75];let ve;t[76]!==$||t[77]!==_e?(ve=(0,F.jsxs)(m,{children:[$,_e]}),t[76]=$,t[77]=_e,t[78]=ve):ve=t[78];let ye;t[79]!==k||t[80]!==Q||t[81]!==ve?(ye=(0,F.jsx)(_,{open:k,onOpenChange:Q,children:ve}),t[79]=k,t[80]=Q,t[81]=ve,t[82]=ye):ye=t[82];let be;return t[83]!==Z||t[84]!==ye?(be=(0,F.jsxs)(F.Fragment,{children:[Z,ye]}),t[83]=Z,t[84]=ye,t[85]=be):be=t[85],be}function ne(){return Date.now()}function re(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return y._({id:`nYeBmY`,values:{hours:r}})}function ie(e){let t=(0,N.c)(56),{file:n,sessionAlive:r,isWriting:i,onNavigate:s,onUndoDrop:c,onSetVersion:l}=e,{_:u}=o(),{docName:d}=n,[f,p]=(0,P.useState)(!1),[m,h]=(0,P.useState)(ae),g,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=setInterval(()=>h(Date.now()),3e4);return()=>clearInterval(e)},_=[],t[0]=g,t[1]=_):(g=t[0],_=t[1]),(0,P.useEffect)(g,_);let v=n.bursts.length,y;t[2]!==n.docName||t[3]!==c||t[4]!==r||t[5]!==f?(y=e=>{e<=0||!r||f||(p(!0),Promise.resolve(c(n.docName,e)).finally(()=>{p(!1),ee()}))},t[2]=n.docName,t[3]=c,t[4]=r,t[5]=f,t[6]=y):y=t[6];let b=y;if(n.bursts.length===0)return null;let x;t[7]!==n.docName||t[8]!==s?(x=()=>s(n.docName),t[7]=n.docName,t[8]=s,t[9]=x):x=t[9];let S;t[10]!==u||t[11]!==d?(S=u({id:`QcpeeE`,values:{docName:d}}),t[10]=u,t[11]=d,t[12]=S):S=t[12];let C;t[13]!==n.docName||t[14]!==x||t[15]!==S?(C=(0,F.jsx)(`button`,{type:`button`,onClick:x,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":S,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[13]=n.docName,t[14]=x,t[15]=S,t[16]=C):C=t[16];let w;t[17]===n.additionsTotal?w=t[18]:(w=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[17]=n.additionsTotal,t[18]=w);let T;t[19]===n.deletionsTotal?T=t[20]:(T=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[19]=n.deletionsTotal,t[20]=T);let E;t[21]!==w||t[22]!==T?(E=(0,F.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[w,` `,T]}),t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==n.lastTs||t[25]!==m?(D=re(n.lastTs,m),t[24]=n.lastTs,t[25]=m,t[26]=D):D=t[26];let O;t[27]===D?O=t[28]:(O=(0,F.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:D}),t[27]=D,t[28]=O);let k;t[29]===i?k=t[30]:(k=i?(0,F.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,F.jsx)(a,{id:`6q0rnH`})}):null,t[29]=i,t[30]=k);let A;t[31]!==O||t[32]!==k||t[33]!==C||t[34]!==E?(A=(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[C,E,O,k]}),t[31]=O,t[32]=k,t[33]=C,t[34]=E,t[35]=A):A=t[35];let j;if(t[36]!==b||t[37]!==v||t[38]!==n.bursts||t[39]!==n.docName||t[40]!==l||t[41]!==r||t[42]!==f){let e;t[44]!==b||t[45]!==v||t[46]!==n.docName||t[47]!==l||t[48]!==r||t[49]!==f?(e=e=>(0,F.jsx)(I,{burst:e,docName:n.docName,editCount:v,sessionAlive:r,inFlight:f,onOpenDiff:e=>l(e.stackIndex+1),onRestore:b},`${n.docName}:${e.stackIndex}`),t[44]=b,t[45]=v,t[46]=n.docName,t[47]=l,t[48]=r,t[49]=f,t[50]=e):e=t[50],j=n.bursts.map(e),t[36]=b,t[37]=v,t[38]=n.bursts,t[39]=n.docName,t[40]=l,t[41]=r,t[42]=f,t[43]=j}else j=t[43];let M;t[51]===j?M=t[52]:(M=(0,F.jsx)(`div`,{children:j}),t[51]=j,t[52]=M);let te;return t[53]!==A||t[54]!==M?(te=(0,F.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[A,M]}),t[53]=A,t[54]=M,t[55]=te):te=t[55],te}function ae(){return Date.now()}async function L(e){let t=await fetch(`/api/agent-undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,agentId:e.connectionId})});if(!t.ok)throw Error(`agent-undo failed: HTTP ${t.status}`)}function R(e){typeof window>`u`||(window.location.hash=T(e))}function oe(){let e=(0,N.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(C,{className:`mr-2 size-4`,"aria-hidden":`true`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,F.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,F.jsx)(`span`,{className:`text-sm`,children:(0,F.jsx)(a,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function se(e){let t=(0,N.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,F.jsx)(x,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,F.jsx)(`p`,{className:`text-sm font-medium`,children:(0,F.jsx)(a,{id:`DhLHEb`})}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,F.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(a,{id:`6gRgw8`}),t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=(0,F.jsx)(c,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:l}),t[5]=r,t[6]=u);let d;return t[7]!==s||t[8]!==u?(d=(0,F.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,u]}),t[7]=s,t[8]=u,t[9]=d):d=t[9],d}function ce(){let e=(0,N.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,F.jsx)(`p`,{className:`text-sm italic`,children:(0,F.jsx)(a,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function z(e){let t=(0,N.c)(12),{onExit:n,showBackButton:r}=e,{_:i}=o(),s;t[0]===i?s=t[1]:(s=i({id:`kYL1lH`}),t[0]=i,t[1]=s);let c;t[2]!==n||t[3]!==r?(c=r?(0,F.jsx)(B,{onClick:n}):null,t[2]=n,t[3]=r,t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[c,l]}),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,F.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,F.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,F.jsx)(a,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==u?(f=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":s,children:[u,d]}),t[9]=s,t[10]=u,t[11]=f):f=t[11],f}function B(e){let t=(0,N.c)(9),{onClick:n}=e,{_:r}=o(),i;t[0]===r?i=t[1]:(i=r({id:`ogAuyr`}),t[0]=r,t[1]=i);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(b,{}),t[2]=s):s=t[2];let f;t[3]!==n||t[4]!==i?(f=(0,F.jsx)(l,{asChild:!0,children:(0,F.jsx)(c,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":i,"data-testid":`docpanel-exit-agent-mode`,children:s})}),t[3]=n,t[4]=i,t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,F.jsx)(u,{side:`bottom`,children:(0,F.jsx)(a,{id:`ogAuyr`})}),t[6]=p):p=t[6];let m;return t[7]===f?m=t[8]:(m=(0,F.jsxs)(d,{children:[f,p]}),t[7]=f,t[8]=m),m}function V(e){let t=(0,N.c)(9),{lastTs:n}=e,[r]=(0,P.useState)(H),i;t[0]!==n||t[1]!==r?(i=n?U(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(`span`,{className:`font-medium`,children:(0,F.jsx)(a,{id:`LCUy_N`})}),t[3]=s):s=t[3];let c;t[4]===o?c=t[5]:(c=o?(0,F.jsxs)(`span`,{children:[` · `,o]}):null,t[4]=o,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,F.jsx)(a,{id:`GK-IRZ`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,F.jsxs)(`div`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"data-testid":`activity-panel-session-ended`,children:[s,c,l]}),t[7]=c,t[8]=u),u}function H(){return Date.now()}function U(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return y._({id:`nYeBmY`,values:{hours:n}})}function W(e){let t=(0,N.c)(10),{agent:n,size:r}=e,i=r===void 0?28:r,a;t[0]!==n.color||t[1]!==i?(a={backgroundColor:n.color,width:i,height:i},t[0]=n.color,t[1]=i,t[2]=a):a=t[2];let o=i*.57,s=i*.57,c;t[3]!==n.icon||t[4]!==o||t[5]!==s?(c=(0,F.jsx)(A,{icon:n.icon,width:o,height:s}),t[3]=n.icon,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,F.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function le(e){let t=(0,N.c)(25),{data:n,status:r,error:i,reload:s,onExit:c,onNavigate:l,onUndoDrop:u,onSetVersion:d,showBackButton:f}=e,{_:p}=o(),m=n?.files?.[0]?.lastTs??null,h=n?.files?.length??0,g;t[0]===p?g=t[1]:(g=p({id:`kYL1lH`}),t[0]=p,t[1]=g);let _;t[2]!==c||t[3]!==f?(_=f?(0,F.jsx)(B,{onClick:c}):null,t[2]=c,t[3]=f,t[4]=_):_=t[4];let v;t[5]!==n||t[6]!==h||t[7]!==m?(v=n?.agent?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(W,{agent:n.agent}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,F.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,F.jsx)(a,{id:`F6pfE9`}):m===null?(0,F.jsx)(a,{id:`PMyJ9C`}):(0,F.jsx)(a,{id:`237hSL`}),n.files.length>0?(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsx)(a,{id:`u3BOHd`,values:{fileCount:h}})]}):null]})]})]}):(0,F.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})})}),t[5]=n,t[6]=h,t[7]=m,t[8]=v):v=t[8];let y;t[9]!==_||t[10]!==v?(y=(0,F.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]!==n||t[13]!==i||t[14]!==m||t[15]!==l||t[16]!==d||t[17]!==u||t[18]!==s||t[19]!==r?(b=(0,F.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:r===`loading`&&n===null?(0,F.jsx)(oe,{}):r===`error`&&i?(0,F.jsx)(se,{error:i,onRetry:s}):n===null?(0,F.jsx)(ce,{}):(0,F.jsxs)(F.Fragment,{children:[!n.sessionAlive&&m!==null?(0,F.jsx)(V,{lastTs:m}):null,n.files.length===0?(0,F.jsx)(ce,{}):n.files.map(e=>(0,F.jsx)(ie,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:l,onUndoDrop:u,onSetVersion:t=>d(e,t)},e.docName))]})}),t[12]=n,t[13]=i,t[14]=m,t[15]=l,t[16]=d,t[17]=u,t[18]=s,t[19]=r,t[20]=b):b=t[20];let x;return t[21]!==g||t[22]!==y||t[23]!==b?(x=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":g,children:[y,b]}),t[21]=g,t[22]=y,t[23]=b,t[24]=x):x=t[24],x}function G(e){let t=(0,N.c)(30),i;t[0]===e?i=t[1]:(i=e===void 0?{}:e,t[0]=e,t[1]=i);let{showBackButton:a}=i,s=a===void 0?!0:a,{_:c}=o(),{docPanelAgentId:l,closeActivityPanel:u}=r(),{openTargetTransition:d}=n(),{pageMeta:f}=S(),{data:p,status:m,error:h,reload:g}=M(l),_,y;if(t[2]!==p||t[3]!==l?(_=()=>{if(!(!p||l===null))for(let e of p.files)O(l,e.docName,e.bursts.length)},y=[p,l],t[2]=p,t[3]=l,t[4]=_,t[5]=y):(_=t[4],y=t[5]),(0,P.useEffect)(_,y),l===null){let e;return t[6]!==u||t[7]!==s?(e=(0,F.jsx)(z,{onExit:u,showBackButton:s}),t[6]=u,t[7]=s,t[8]=e):e=t[8],e}let b;t[9]!==d||t[10]!==f?(b=e=>{d(E({kind:`doc`,target:e,docName:e},f),{disposition:`permanent`,consumeActiveNewTab:!0}),R(e)},t[9]=d,t[10]=f,t[11]=b):b=t[11];let x=b,C;t[12]!==p||t[13]!==l?(C=(e,t)=>{if(!p?.agent||l===null)return;j();let n=e.bursts.length;k({agentId:l,agentName:p.agent.displayName,agentColor:p.agent.color,agentIcon:p.agent.icon,docName:e.docName,keptCount:Math.max(0,Math.min(t,n)),maxVersions:n})},t[12]=p,t[13]=l,t[14]=C):C=t[14];let w=C,T;t[15]!==c||t[16]!==p||t[17]!==l||t[18]!==g?(T=async(e,t)=>{if(!(t<=0))try{await L({connectionId:l,docName:e,scope:`count`,count:t,agentName:p?.agent?.displayName}),v.success(c(t===1?{id:`-dNlfM`,values:{docName:e}}:{id:`ApeA0n`,values:{dropCount:t,docName:e}})),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);v.error(c({id:`EqrC_R`,values:{message:n}})),g()}},t[15]=c,t[16]=p,t[17]=l,t[18]=g,t[19]=T):T=t[19];let D=T,A;return t[20]!==u||t[21]!==p||t[22]!==h||t[23]!==x||t[24]!==w||t[25]!==D||t[26]!==g||t[27]!==s||t[28]!==m?(A=(0,F.jsx)(le,{data:p,status:m,error:h,reload:g,onExit:u,onNavigate:x,onUndoDrop:D,onSetVersion:w,showBackButton:s}),t[20]=u,t[21]=p,t[22]=h,t[23]=x,t[24]=w,t[25]=D,t[26]=g,t[27]=s,t[28]=m,t[29]=A):A=t[29],A}export{G as ActivityModeContent};