@inkeep/open-knowledge 0.67.0-beta.1 → 0.67.0-beta.2

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 (134) hide show
  1. package/dist/{acp-harness-probe-5enbQPMI.mjs → acp-harness-probe-CQY5xnxl.mjs} +2 -2
  2. package/dist/cli.mjs +6 -6
  3. package/dist/constants-CzBR8OPk.mjs +2 -0
  4. package/dist/git-handle-COMbZr8u.mjs +1 -0
  5. package/dist/{git-handle-DdhcdkCE.mjs → git-handle-IQZoLUBW.mjs} +2 -2
  6. package/dist/index.d.mts +17 -17
  7. package/dist/index.mjs +2 -2
  8. package/dist/init-BR7HCaX9.mjs +1 -0
  9. package/dist/{init-aeanAEIJ.mjs → init-BnAKA1pC.mjs} +3 -3
  10. package/dist/{launch-json-removal-BFPTw2ut.mjs → launch-json-removal-BcBDWCAT.mjs} +2 -2
  11. package/dist/{loader-egUaB2jL.mjs → loader-DWla98le.mjs} +2 -2
  12. package/dist/loader-Dd9ywqT3.mjs +1 -0
  13. package/dist/md-manager-CmAEZsv6.mjs +2 -0
  14. package/dist/{open-browser-DJSSG7gq.mjs → open-browser-B5VbCpAQ.mjs} +2 -2
  15. package/dist/parse-worker.mjs +1 -1
  16. package/dist/{preview-DOiZrE1T.mjs → preview-CfABQUF8.mjs} +2 -2
  17. package/dist/preview-DDpTCIRk.mjs +1 -0
  18. package/dist/public/assets/{ActivityModeContent-D-0cSRrW.js → ActivityModeContent-DpHKV3Fo.js} +1 -1
  19. package/dist/public/assets/{AddPropertiesButton-YKnjelq2.js → AddPropertiesButton-DCG8p8wj.js} +1 -1
  20. package/dist/public/assets/{AgentDiffPane-D0kPMcBi.js → AgentDiffPane-CyCKmqFc.js} +1 -1
  21. package/dist/public/assets/{AgentThreadClientBinder-D5KcxShu.js → AgentThreadClientBinder-BsOqdmmj.js} +1 -1
  22. package/dist/public/assets/{BugReportHistory-Bt_2AhdY.js → BugReportHistory-BOFdT2af.js} +1 -1
  23. package/dist/public/assets/{BugReportHistoryDialog-BnvDhUu-.js → BugReportHistoryDialog-DpY63nIu.js} +1 -1
  24. package/dist/public/assets/{CodeMirrorPropInput-CwOB60rY.js → CodeMirrorPropInput-u4XFoleT.js} +1 -1
  25. package/dist/public/assets/{ConsentDialogBody-CaipvBFe.js → ConsentDialogBody-DlRCrCDb.js} +1 -1
  26. package/dist/public/assets/{DocumentContext-Bsw895IC.js → DocumentContext-Dnh6K82B.js} +1 -1
  27. package/dist/public/assets/{EditorModeToggle-Bn8sDhg7.js → EditorModeToggle-DeXquZw1.js} +1 -1
  28. package/dist/public/assets/{EnableSyncConfirmDialog-CgEa2Lel.js → EnableSyncConfirmDialog-BQhuZB86.js} +1 -1
  29. package/dist/public/assets/{ExcalidrawDocEditor-e98m3yrW.js → ExcalidrawDocEditor-B5oJcC6a.js} +1 -1
  30. package/dist/public/assets/FeedbackForm-2-zq8vF8.js +1 -0
  31. package/dist/public/assets/{GraphPanel-N6573H16.js → GraphPanel-BV7L6-3Z.js} +1 -1
  32. package/dist/public/assets/{ImportSkillDialog-DqMQBoo8.js → ImportSkillDialog-DrVFzW8E.js} +1 -1
  33. package/dist/public/assets/{LintConfigEditor-DQILdKTF.js → LintConfigEditor-DWVqaaqf.js} +1 -1
  34. package/dist/public/assets/ManagedArtifactProperties-DGS7RCxV.js +1 -0
  35. package/dist/public/assets/{ManagedArtifactProperties-CoXIlO52.js → ManagedArtifactProperties-PAJxXrcG.js} +1 -1
  36. package/dist/public/assets/{MermaidDocEditor-iHa0I65N.js → MermaidDocEditor-Cp9hfV1H.js} +1 -1
  37. package/dist/public/assets/{PropertyDisplayRow-B-mow9Ko.js → PropertyDisplayRow-DAgkBnyy.js} +1 -1
  38. package/dist/public/assets/{ReportBugDialogBody-Cjh3Yh5B.js → ReportBugDialogBody-B10t6ztH.js} +1 -1
  39. package/dist/public/assets/{ReportBugMenuTrigger-q_dLhiO9.js → ReportBugMenuTrigger-DoOFK964.js} +2 -2
  40. package/dist/public/assets/{SchemaConfigEditor-Dg2Xv_wN.js → SchemaConfigEditor-D2FZCIZ7.js} +1 -1
  41. package/dist/public/assets/{SessionsHost-CXkO6eTK.js → SessionsHost-CLKxzr4u.js} +2 -2
  42. package/dist/public/assets/{SettingsDialogBody-B90ZfLI-.js → SettingsDialogBody-aojU_6yY.js} +1 -1
  43. package/dist/public/assets/{ShareBranchSwitchDialog-CAh_Zb4e.js → ShareBranchSwitchDialog-Cgqp6DLk.js} +1 -1
  44. package/dist/public/assets/{ShareReceiveDialog-YN1GVIoH.js → ShareReceiveDialog-C2we44vF.js} +1 -1
  45. package/dist/public/assets/{ShareReceiveMissDialog-BslE-oFr.js → ShareReceiveMissDialog-Bni3yXgl.js} +1 -1
  46. package/dist/public/assets/{SkillCostValue-JVEHCicc.js → SkillCostValue-CzTA99wi.js} +1 -1
  47. package/dist/public/assets/{SkillEditBanner-C0vOlwrp.js → SkillEditBanner-zkwvfJID.js} +1 -1
  48. package/dist/public/assets/{SkillInstallMenu-DuZtBLEk.js → SkillInstallMenu-BHR-9UNP.js} +1 -1
  49. package/dist/public/assets/{SkillOriginInline-8mndfQn_.js → SkillOriginInline-B-7m47QP.js} +1 -1
  50. package/dist/public/assets/{SkillToolbarControls-C4zdjIgn.js → SkillToolbarControls-iK4e4bEe.js} +1 -1
  51. package/dist/public/assets/{SlidesToolbarControls-B1bIgq-2.js → SlidesToolbarControls-doFfuHJv.js} +1 -1
  52. package/dist/public/assets/{SourceEditor-DUHzc0vf.js → SourceEditor-CRs3D5y2.js} +1 -1
  53. package/dist/public/assets/{TerminalPanel-iaEaHe0J.js → TerminalPanel-t4vv_7oY.js} +1 -1
  54. package/dist/public/assets/{TerminalWindowApp-CBu5NLqp.js → TerminalWindowApp-CzZqjo-p.js} +1 -1
  55. package/dist/public/assets/{TextDocEditor-JsL28P0A.js → TextDocEditor-CdjxMtrt.js} +1 -1
  56. package/dist/public/assets/{ThreadView-aQoZ82F0.js → ThreadView-C6uVuEhA.js} +1 -1
  57. package/dist/public/assets/{TimelineDiffPane-DA1QA7NK.js → TimelineDiffPane-DFbxsUjY.js} +1 -1
  58. package/dist/public/assets/{agent-diff-store-DtxT_Ooz.js → agent-diff-store-CI9-nZ0i.js} +1 -1
  59. package/dist/public/assets/{auth-state-cache-C3ZozEKy.js → auth-state-cache-B_mn7bAt.js} +1 -1
  60. package/dist/public/assets/{bug-report-send-manager-DyOyYvtc.js → bug-report-send-manager-uz1N726r.js} +1 -1
  61. package/dist/public/assets/{client-version-By8mf75p.js → client-version-CEClhR52.js} +1 -1
  62. package/dist/public/assets/{comment-chips-CgqGEtXc.js → comment-chips-yb9PnjC0.js} +1 -1
  63. package/dist/public/assets/{config-provider-wH0NVfSu.js → config-provider-BKNG21ZO.js} +1 -1
  64. package/dist/public/assets/{dist-CV2GCpOd.js → dist-B09M7HMS.js} +1 -1
  65. package/dist/public/assets/{doc-paths-DIVeqETn.js → doc-paths-BQkA8AK7.js} +1 -1
  66. package/dist/public/assets/{documents-events-DtnOXlfX.js → documents-events-Cm7G-T0h.js} +1 -1
  67. package/dist/public/assets/{file-tree-adapter-DEjD0Pu_.js → file-tree-adapter-CTmhzMR7.js} +1 -1
  68. package/dist/public/assets/{file-tree-utils-ys3LwEvP.js → file-tree-utils-Dw0qduRo.js} +1 -1
  69. package/dist/public/assets/{folder-config-api-BEFECEIF.js → folder-config-api-DXrqFQFU.js} +1 -1
  70. package/dist/public/assets/i18n-DeMGB8Bx.js +1 -0
  71. package/dist/public/assets/{index-C7GceT7c.js → index-C7cNeh3S.js} +7 -7
  72. package/dist/public/assets/{launcher-selection-E18xz3aA.js → launcher-selection-DQx0NqY7.js} +1 -1
  73. package/dist/public/assets/{lint-config-client-BkUD6SV-.js → lint-config-client-DKl0UxkD.js} +1 -1
  74. package/dist/public/assets/{markdownlint-rule-browser-CP0Fb0-9.js → markdownlint-rule-browser-CvkMak5i.js} +1 -1
  75. package/dist/public/assets/{page-list-cache-Bj9bjDW4.js → page-list-cache-DXgYf538.js} +1 -1
  76. package/dist/public/assets/{pending-receive-nav-store-BX-8fLvd.js → pending-receive-nav-store-Dw2-EiMe.js} +1 -1
  77. package/dist/public/assets/{progress-CUbgsLyb.js → progress-vSWRgJqM.js} +1 -1
  78. package/dist/public/assets/{project-paths-Bd0yFlZ5.js → project-paths-DEnB9tdt.js} +1 -1
  79. package/dist/public/assets/{prop-types-DO_gRwRt.js → prop-types-DoF2_bUg.js} +1 -1
  80. package/dist/public/assets/{receive-store-m6d3FxaB.js → receive-store-Ds63Aih2.js} +1 -1
  81. package/dist/public/assets/{selection-context-CNW65XVV.js → selection-context-BPiksgZ3.js} +1 -1
  82. package/dist/public/assets/{skill-scope-DFZ_SHdC.js → skill-scope-tOoaxMej.js} +1 -1
  83. package/dist/public/assets/{skills-api-DxRE5EZQ.js → skills-api-DRYrLN_f.js} +1 -1
  84. package/dist/public/assets/{src-C_PWwlFO.js → src-Mka2WkyS.js} +1 -1
  85. package/dist/public/assets/{startup-marks-BWr5BogJ.js → startup-marks-oHCT4d7K.js} +1 -1
  86. package/dist/public/assets/{tag-pill-input-LshOKGhD.js → tag-pill-input-Cs4RMU0P.js} +1 -1
  87. package/dist/public/assets/{target-navigation-intent-BLz2rhJ9.js → target-navigation-intent-MvlUyaZ0.js} +1 -1
  88. package/dist/public/assets/{telemetry-startup-DT1reB9O.js → telemetry-startup-B_4IqvTc.js} +1 -1
  89. package/dist/public/assets/{terminal-cli-display-uGo_RJa9.js → terminal-cli-display-nVuwR0QR.js} +1 -1
  90. package/dist/public/assets/{terminal-command-events-Cx8h3XNf.js → terminal-command-events-BBHZDeWG.js} +1 -1
  91. package/dist/public/assets/{typing-burst-detector-CNU1-vqf.js → typing-burst-detector-dsiADuQh.js} +1 -1
  92. package/dist/public/assets/{uninstall-CAw-VgxU.js → uninstall-BMzmB4--.js} +1 -1
  93. package/dist/public/assets/{use-activity-panel-CPZKbDLj.js → use-activity-panel-CQXXnWdh.js} +1 -1
  94. package/dist/public/assets/{use-apply-config-color-theme-tbsOUFmL.js → use-apply-config-color-theme-EQzX-tJq.js} +1 -1
  95. package/dist/public/assets/{use-collab-url-DRZxhN7P.js → use-collab-url-BnB65bTi.js} +1 -1
  96. package/dist/public/assets/{use-live-xterm-theme-B0Dgjjuu.js → use-live-xterm-theme-D1A4AVj9.js} +1 -1
  97. package/dist/public/assets/{use-open-skill-lEwSPp01.js → use-open-skill-Cl-CoKvQ.js} +1 -1
  98. package/dist/public/assets/{use-settings-route-DTY_xCA7.js → use-settings-route-C-4dXobi.js} +1 -1
  99. package/dist/public/assets/{use-skill-origin-CDGIUSHM.js → use-skill-origin-Cxdz_jJG.js} +1 -1
  100. package/dist/public/assets/{use-skills-DHTWSwQB.js → use-skills-Bp0S7YlJ.js} +1 -1
  101. package/dist/public/assets/{use-terminal-enabled-DxW9RFe7.js → use-terminal-enabled-DJjeF-1r.js} +1 -1
  102. package/dist/public/assets/{use-timeline-entry-diff-gjnd_HCL.js → use-timeline-entry-diff-j3PBCTgr.js} +1 -1
  103. package/dist/public/assets/{use-workspace-C5H_J2oR.js → use-workspace-D3DgKmW_.js} +1 -1
  104. package/dist/public/index.html +48 -48
  105. package/dist/public/uninstall.html +3 -3
  106. package/dist/{repair-launch-json-Da7CAli_.mjs → repair-launch-json-DxcVTMbs.mjs} +2 -2
  107. package/dist/{repair-mcp-configs-Bmxf0zpG.mjs → repair-mcp-configs-DZQWWQln.mjs} +2 -2
  108. package/dist/repair-skills-C7esPWUj.mjs +1 -0
  109. package/dist/{repair-skills-sAqBCXOp.mjs → repair-skills-k83Ipv-J.mjs} +2 -2
  110. package/dist/{resolve-project-root-BGJWrr7S.mjs → resolve-project-root-DCYPHzur.mjs} +2 -2
  111. package/dist/{server-lock-BKFglZ7W.mjs → server-lock-7h8qd644.mjs} +2 -2
  112. package/dist/server-lock-B8gf8uNF.mjs +1 -0
  113. package/dist/{skill-teardown-BfpV0B4c.mjs → skill-teardown-CUW2_c9Q.mjs} +2 -2
  114. package/dist/{src-QSCGwG0O.mjs → src-CA9zRmPt.mjs} +2 -2
  115. package/dist/{src-BRP7ysCx.mjs → src-CNuuM8T0.mjs} +4 -4
  116. package/dist/{src-Dbt5dMPy.mjs → src-CS_k7GF4.mjs} +2 -2
  117. package/dist/src-CkQqw1Wp.mjs +1 -0
  118. package/dist/{src-DqDKpWQW.mjs → src-DraT8WdY.mjs} +1 -1
  119. package/dist/start-Cp7U3NfU.mjs +1 -0
  120. package/dist/{start-D4uoZIi8.mjs → start-DuCVBkW-.mjs} +3 -3
  121. package/package.json +4 -4
  122. package/dist/constants-CL8WMjuI.mjs +0 -2
  123. package/dist/git-handle-CU7BKn2c.mjs +0 -1
  124. package/dist/init-tXvUPtrZ.mjs +0 -1
  125. package/dist/loader-BX91sIcm.mjs +0 -1
  126. package/dist/md-manager-D8UOdkMq.mjs +0 -2
  127. package/dist/preview-CDuoKWSj.mjs +0 -1
  128. package/dist/public/assets/FeedbackForm-C2egUHDW.js +0 -1
  129. package/dist/public/assets/ManagedArtifactProperties-CiNLT1jV.js +0 -1
  130. package/dist/public/assets/i18n-B2e6ZOjH.js +0 -1
  131. package/dist/repair-skills-Ds2Fajtu.mjs +0 -1
  132. package/dist/server-lock-BB9BC2RO.mjs +0 -1
  133. package/dist/src-Cc_DXisa.mjs +0 -1
  134. package/dist/start-Dh7PYrab.mjs +0 -1
package/dist/index.d.mts CHANGED
@@ -9841,23 +9841,6 @@ declare module '@tiptap/core' {
9841
9841
  * special-case in the mdxJsxTextElement handler.
9842
9842
  */
9843
9843
  //#endregion
9844
- //#region ../../node_modules/.pnpm/@tiptap+extension-horizontal-rule@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.4__@tiptap+pm@3.22.4/node_modules/@tiptap/extension-horizontal-rule/dist/index.d.ts
9845
- declare module '@tiptap/core' {
9846
- interface Commands<ReturnType> {
9847
- horizontalRule: {
9848
- /**
9849
- * Add a horizontal rule
9850
- * @example editor.commands.setHorizontalRule()
9851
- */
9852
- setHorizontalRule: () => ReturnType;
9853
- };
9854
- }
9855
- }
9856
- /**
9857
- * This extension allows you to insert horizontal rules.
9858
- * @see https://www.tiptap.dev/api/nodes/horizontal-rule
9859
- */
9860
- //#endregion
9861
9844
  //#region ../../node_modules/.pnpm/@tiptap+extension-blockquote@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.4_/node_modules/@tiptap/extension-blockquote/dist/index.d.ts
9862
9845
  declare module '@tiptap/core' {
9863
9846
  interface Commands<ReturnType> {
@@ -9881,6 +9864,23 @@ declare module '@tiptap/core' {
9881
9864
  * Matches a blockquote to a `>` as input.
9882
9865
  */
9883
9866
  //#endregion
9867
+ //#region ../../node_modules/.pnpm/@tiptap+extension-horizontal-rule@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.4__@tiptap+pm@3.22.4/node_modules/@tiptap/extension-horizontal-rule/dist/index.d.ts
9868
+ declare module '@tiptap/core' {
9869
+ interface Commands<ReturnType> {
9870
+ horizontalRule: {
9871
+ /**
9872
+ * Add a horizontal rule
9873
+ * @example editor.commands.setHorizontalRule()
9874
+ */
9875
+ setHorizontalRule: () => ReturnType;
9876
+ };
9877
+ }
9878
+ }
9879
+ /**
9880
+ * This extension allows you to insert horizontal rules.
9881
+ * @see https://www.tiptap.dev/api/nodes/horizontal-rule
9882
+ */
9883
+ //#endregion
9884
9884
  //#region ../../node_modules/.pnpm/@tiptap+extension-code@3.22.3_@tiptap+core@3.22.3_@tiptap+pm@3.22.4_/node_modules/@tiptap/extension-code/dist/index.d.ts
9885
9885
  declare module '@tiptap/core' {
9886
9886
  interface Commands<ReturnType> {
package/dist/index.mjs CHANGED
@@ -177,7 +177,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
177
177
 
178
178
  `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=On,s=!hn.jitless,c=s&&hee.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Or([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function kr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Pn(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Rn(e,r,gn())))}),t)}const Ar=P(`$ZodUnion`,(e,t)=>{br.init(e,t),Cn(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Cn(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Cn(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Cn(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>xn(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>kr(t,r,e,i)):kr(o,r,e,i)}}),Vte=P(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Ar.init(e,t);let n=e._zod.parse;Cn(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=yn(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!On(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Hte=P(`$ZodIntersection`,(e,t)=>{br.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Mr(e,t,n)):Mr(e,i,a)}});function jr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(kn(e)&&kn(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=jr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=jr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Mr(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Pn(e))return e;let o=jr(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const Ute=P(`$ZodRecord`,(e,t)=>{br.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!kn(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>Rn(e,r,gn())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...In(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...In(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&mr.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Rn(e,r,gn())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...In(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...In(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Wte=P(`$ZodEnum`,(e,t)=>{br.init(e,t);let n=_n(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>gee.has(typeof e)).map(e=>typeof e==`string`?jn(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Gte=P(`$ZodLiteral`,(e,t)=>{if(br.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?jn(e):e?jn(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Kte=P(`$ZodTransform`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new mn(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new pn;return n.value=i,n.fallback=!0,n}});function Nr(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Pr=P(`$ZodOptional`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Cn(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Cn(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${xn(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Nr(e,r)):Nr(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),qte=P(`$ZodExactOptional`,(e,t)=>{Pr.init(e,t),Cn(e._zod,`values`,()=>t.innerType._zod.values),Cn(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Jte=P(`$ZodNullable`,(e,t)=>{br.init(e,t),Cn(e._zod,`optin`,()=>t.innerType._zod.optin),Cn(e._zod,`optout`,()=>t.innerType._zod.optout),Cn(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${xn(e.source)}|null)$`):void 0}),Cn(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Yte=P(`$ZodDefault`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,Cn(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Fr(e,t)):Fr(r,t)}});function Fr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Xte=P(`$ZodPrefault`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,Cn(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Zte=P(`$ZodNonOptional`,(e,t)=>{br.init(e,t),Cn(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Ir(t,e)):Ir(i,e)}});function Ir(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const Lr=P(`$ZodCatch`,(e,t)=>{br.init(e,t),e._zod.optin=`optional`,Cn(e._zod,`optout`,()=>t.innerType._zod.optout),Cn(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Rn(e,n,gn()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Rn(e,n,gn()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Rr=P(`$ZodPipe`,(e,t)=>{br.init(e,t),Cn(e._zod,`values`,()=>t.in._zod.values),Cn(e._zod,`optin`,()=>t.in._zod.optin),Cn(e._zod,`optout`,()=>t.out._zod.optout),Cn(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>zr(e,t.in,n)):zr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>zr(e,t.out,n)):zr(r,t.out,n)}});function zr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const Br=P(`$ZodPreprocess`,(e,t)=>{Rr.init(e,t)}),Vr=P(`$ZodReadonly`,(e,t)=>{br.init(e,t),Cn(e._zod,`propValues`,()=>t.innerType._zod.propValues),Cn(e._zod,`values`,()=>t.innerType._zod.values),Cn(e._zod,`optin`,()=>t.innerType?._zod?.optin),Cn(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Hr):Hr(r)}});function Hr(e){return e.value=Object.freeze(e.value),e}const Ur=P(`$ZodLazy`,(e,t)=>{br.init(e,t),Cn(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),Cn(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),Cn(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),Cn(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),Cn(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Wr=P(`$ZodCustom`,(e,t)=>{hr.init(e,t),br.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Gr(t,n,r,e));Gr(i,n,r,e)}});function Gr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Bn(e))}}var Kr,qr=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Jr(){return new qr}(Kr=globalThis).__zod_globalRegistry??(Kr.__zod_globalRegistry=Jr());const Yr=globalThis.__zod_globalRegistry;function Xr(e,t){return new e({type:`string`,...Nn(t)})}function Zr(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...Nn(t)})}function Qr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...Nn(t)})}function $r(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...Nn(t)})}function ei(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...Nn(t)})}function ti(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...Nn(t)})}function ni(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...Nn(t)})}function ri(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...Nn(t)})}function ii(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...Nn(t)})}function ai(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...Nn(t)})}function oi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...Nn(t)})}function si(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...Nn(t)})}function ci(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...Nn(t)})}function li(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...Nn(t)})}function ui(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...Nn(t)})}function di(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...Nn(t)})}function fi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...Nn(t)})}function pi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...Nn(t)})}function mi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...Nn(t)})}function hi(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...Nn(t)})}function gi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...Nn(t)})}function _i(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...Nn(t)})}function vi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...Nn(t)})}function yi(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...Nn(t)})}function bi(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...Nn(t)})}function xi(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...Nn(t)})}function Si(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...Nn(t)})}function Ci(e,t){return new e({type:`number`,checks:[],...Nn(t)})}function wi(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...Nn(t)})}function Ti(e,t){return new e({type:`boolean`,...Nn(t)})}function Ei(e,t){return new e({type:`null`,...Nn(t)})}function Di(e){return new e({type:`unknown`})}function Oi(e,t){return new e({type:`never`,...Nn(t)})}function ki(e,t){return new _r({check:`less_than`,...Nn(t),value:e,inclusive:!1})}function Ai(e,t){return new _r({check:`less_than`,...Nn(t),value:e,inclusive:!0})}function ji(e,t){return new vr({check:`greater_than`,...Nn(t),value:e,inclusive:!1})}function Mi(e,t){return new vr({check:`greater_than`,...Nn(t),value:e,inclusive:!0})}function Ni(e,t){return new Jee({check:`multiple_of`,...Nn(t),value:e})}function Pi(e,t){return new Xee({check:`max_length`,...Nn(t),maximum:e})}function Fi(e,t){return new Zee({check:`min_length`,...Nn(t),minimum:e})}function Ii(e,t){return new Qee({check:`length_equals`,...Nn(t),length:e})}function Li(e,t){return new $ee({check:`string_format`,format:`regex`,...Nn(t),pattern:e})}function Ri(e){return new ete({check:`string_format`,format:`lowercase`,...Nn(e)})}function zi(e){return new tte({check:`string_format`,format:`uppercase`,...Nn(e)})}function Bi(e,t){return new nte({check:`string_format`,format:`includes`,...Nn(t),includes:e})}function Vi(e,t){return new rte({check:`string_format`,format:`starts_with`,...Nn(t),prefix:e})}function Hi(e,t){return new ite({check:`string_format`,format:`ends_with`,...Nn(t),suffix:e})}function Ui(e){return new ate({check:`overwrite`,tx:e})}function Wi(e){return Ui(t=>t.normalize(e))}function Gi(){return Ui(e=>e.trim())}function Ki(){return Ui(e=>e.toLowerCase())}function qi(){return Ui(e=>e.toUpperCase())}function Ji(){return Ui(e=>mee(e))}function Yi(e,t,n){return new e({type:`array`,element:t,...Nn(n)})}function Xi(e,t,n){let r=Nn(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function Zi(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...Nn(n)})}function Qi(e,t){let n=$i(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Bn(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Bn(r))}},e(t.value,t)),t);return n}function $i(e,t){let n=new hr({check:`custom`,...Nn(t)});return n._zod.check=e,n}function ea(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Yr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function ta(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,ta(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&ia(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function na(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
179
179
 
180
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ra(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:oa(t,`input`,e.processors),output:oa(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function ia(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return ia(r.element,n);if(r.type===`set`)return ia(r.valueType,n);if(r.type===`lazy`)return ia(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return ia(r.innerType,n);if(r.type===`intersection`)return ia(r.left,n)||ia(r.right,n);if(r.type===`record`||r.type===`map`)return ia(r.keyType,n)||ia(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:ia(r.in,n)||ia(r.out,n);if(r.type===`object`){for(let e in r.shape)if(ia(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(ia(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(ia(e,n))return!0;return!!(r.rest&&ia(r.rest,n))}return!1}const aa=(e,t={})=>n=>{let r=ea({...n,processors:t});return ta(e,r),na(r,e),ra(r,e)},oa=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ea({...i??{},target:a,io:t,processors:n});return ta(e,o),na(o,e),ra(o,e)},sa={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ca=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=sa[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},la=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},ua=(e,t,n,r)=>{n.type=`boolean`},da=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},fa=(e,t,n,r)=>{n.not={}},pa=(e,t,n,r)=>{let i=e._zod.def,a=_n(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ma=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},ha=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ga=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},_a=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=ta(a.element,t,{...r,path:[...r.path,`items`]})},va=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=ta(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=ta(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ya=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>ta(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ba=(e,t,n,r)=>{let i=e._zod.def,a=ta(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=ta(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},xa=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=ta(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=ta(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=ta(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Sa=(e,t,n,r)=>{let i=e._zod.def,a=ta(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ca=(e,t,n,r)=>{let i=e._zod.def;ta(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},wa=(e,t,n,r)=>{let i=e._zod.def;ta(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ta=(e,t,n,r)=>{let i=e._zod.def;ta(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ea=(e,t,n,r)=>{let i=e._zod.def;ta(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Da=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;ta(o,t,r);let s=t.seen.get(e);s.ref=o},Oa=(e,t,n,r)=>{let i=e._zod.def;ta(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ka=(e,t,n,r)=>{let i=e._zod.def;ta(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Aa=(e,t,n,r)=>{let i=e._zod.innerType;ta(i,t,r);let a=t.seen.get(e);a.ref=i},ja=P(`ZodISODateTime`,(e,t)=>{yte.init(e,t),$a.init(e,t)});function Ma(e){return yi(ja,e)}const Na=P(`ZodISODate`,(e,t)=>{bte.init(e,t),$a.init(e,t)});function Pa(e){return bi(Na,e)}const Fa=P(`ZodISOTime`,(e,t)=>{xte.init(e,t),$a.init(e,t)});function Ia(e){return xi(Fa,e)}const La=P(`ZodISODuration`,(e,t)=>{Ste.init(e,t),$a.init(e,t)});function Ra(e){return Si(La,e)}const za=P(`ZodError`,(e,t)=>{Hn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Gn(e,t)},flatten:{value:t=>Wn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,vn,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,vn,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Ba=Kn(za),Va=qn(za),Ha=Jn(za),Ua=Xn(za),Wa=Qn(za),Ga=$n(za),Ka=er(za),qa=tr(za),Ja=nr(za),Qte=rr(za),$te=ir(za),ene=ar(za),Ya=new WeakMap;function Xa(e,t,n){let r=Object.getPrototypeOf(e),i=Ya.get(r);if(i||(i=new Set,Ya.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const Za=P(`ZodType`,(e,t)=>(br.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:oa(e,`input`),output:oa(e,`output`)}}),e.toJSONSchema=aa(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>Ba(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ha(e,t,n),e.parseAsync=async(t,n)=>Va(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ua(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Wa(e,t,n),e.decode=(t,n)=>Ga(e,t,n),e.encodeAsync=async(t,n)=>Ka(e,t,n),e.decodeAsync=async(t,n)=>qa(e,t,n),e.safeEncode=(t,n)=>Ja(e,t,n),e.safeDecode=(t,n)=>Qte(e,t,n),e.safeEncodeAsync=async(t,n)=>$te(e,t,n),e.safeDecodeAsync=async(t,n)=>ene(e,t,n),Xa(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Tn(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Mn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Wne(e,t))},superRefine(e,t){return this.check(Gne(e,t))},overwrite(e){return this.check(Ui(e))},optional(){return vo(this)},exactOptional(){return jne(this)},nullable(){return yo(this)},nullish(){return vo(yo(this))},nonoptional(e){return Lne(this,e)},array(){return z(this)},or(e){return uo([this,e])},and(e){return po(this,e)},transform(e){return So(this,go(e))},default(e){return Pne(this,e)},prefault(e){return Ine(this,e)},catch(e){return zne(this,e)},pipe(e){return So(this,e)},readonly(){return Hne(this)},describe(e){let t=this.clone();return Yr.add(t,{description:e}),t},meta(...e){if(e.length===0)return Yr.get(this);let t=this.clone();return Yr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return Yr.get(e)?.description},configurable:!0}),e)),Qa=P(`_ZodString`,(e,t)=>{xr.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ca(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Xa(e,`_ZodString`,{regex(...e){return this.check(Li(...e))},includes(...e){return this.check(Bi(...e))},startsWith(...e){return this.check(Vi(...e))},endsWith(...e){return this.check(Hi(...e))},min(...e){return this.check(Fi(...e))},max(...e){return this.check(Pi(...e))},length(...e){return this.check(Ii(...e))},nonempty(...e){return this.check(Fi(1,...e))},lowercase(e){return this.check(Ri(e))},uppercase(e){return this.check(zi(e))},trim(){return this.check(Gi())},normalize(...e){return this.check(Wi(...e))},toLowerCase(){return this.check(Ki())},toUpperCase(){return this.check(qi())},slugify(){return this.check(Ji())}})}),tne=P(`ZodString`,(e,t)=>{xr.init(e,t),Qa.init(e,t),e.email=t=>e.check(Zr(nne,t)),e.url=t=>e.check(ri(no,t)),e.jwt=t=>e.check(vi(vne,t)),e.emoji=t=>e.check(ii(ine,t)),e.guid=t=>e.check(Qr(eo,t)),e.uuid=t=>e.check($r(to,t)),e.uuidv4=t=>e.check(ei(to,t)),e.uuidv6=t=>e.check(ti(to,t)),e.uuidv7=t=>e.check(ni(to,t)),e.nanoid=t=>e.check(ai(ane,t)),e.guid=t=>e.check(Qr(eo,t)),e.cuid=t=>e.check(oi(one,t)),e.cuid2=t=>e.check(si(sne,t)),e.ulid=t=>e.check(ci(cne,t)),e.base64=t=>e.check(hi(hne,t)),e.base64url=t=>e.check(gi(gne,t)),e.xid=t=>e.check(li(lne,t)),e.ksuid=t=>e.check(ui(une,t)),e.ipv4=t=>e.check(di(dne,t)),e.ipv6=t=>e.check(fi(fne,t)),e.cidrv4=t=>e.check(pi(pne,t)),e.cidrv6=t=>e.check(mi(mne,t)),e.e164=t=>e.check(_i(_ne,t)),e.datetime=t=>e.check(Ma(t)),e.date=t=>e.check(Pa(t)),e.time=t=>e.check(Ia(t)),e.duration=t=>e.check(Ra(t))});function F(e){return Xr(tne,e)}const $a=P(`ZodStringFormat`,(e,t)=>{Sr.init(e,t),Qa.init(e,t)}),nne=P(`ZodEmail`,(e,t)=>{ute.init(e,t),$a.init(e,t)}),eo=P(`ZodGUID`,(e,t)=>{cte.init(e,t),$a.init(e,t)}),to=P(`ZodUUID`,(e,t)=>{lte.init(e,t),$a.init(e,t)});function rne(e){return $r(to,e)}const no=P(`ZodURL`,(e,t)=>{dte.init(e,t),$a.init(e,t)});function ro(e){return ri(no,e)}const ine=P(`ZodEmoji`,(e,t)=>{fte.init(e,t),$a.init(e,t)}),ane=P(`ZodNanoID`,(e,t)=>{pte.init(e,t),$a.init(e,t)}),one=P(`ZodCUID`,(e,t)=>{mte.init(e,t),$a.init(e,t)}),sne=P(`ZodCUID2`,(e,t)=>{hte.init(e,t),$a.init(e,t)}),cne=P(`ZodULID`,(e,t)=>{gte.init(e,t),$a.init(e,t)}),lne=P(`ZodXID`,(e,t)=>{_te.init(e,t),$a.init(e,t)}),une=P(`ZodKSUID`,(e,t)=>{vte.init(e,t),$a.init(e,t)}),dne=P(`ZodIPv4`,(e,t)=>{Cte.init(e,t),$a.init(e,t)}),fne=P(`ZodIPv6`,(e,t)=>{wte.init(e,t),$a.init(e,t)}),pne=P(`ZodCIDRv4`,(e,t)=>{Tte.init(e,t),$a.init(e,t)}),mne=P(`ZodCIDRv6`,(e,t)=>{Ete.init(e,t),$a.init(e,t)}),hne=P(`ZodBase64`,(e,t)=>{Dte.init(e,t),$a.init(e,t)}),gne=P(`ZodBase64URL`,(e,t)=>{kte.init(e,t),$a.init(e,t)}),_ne=P(`ZodE164`,(e,t)=>{Ate.init(e,t),$a.init(e,t)}),vne=P(`ZodJWT`,(e,t)=>{Mte.init(e,t),$a.init(e,t)}),io=P(`ZodNumber`,(e,t)=>{wr.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>la(e,t,n,r),Xa(e,`ZodNumber`,{gt(e,t){return this.check(ji(e,t))},gte(e,t){return this.check(Mi(e,t))},min(e,t){return this.check(Mi(e,t))},lt(e,t){return this.check(ki(e,t))},lte(e,t){return this.check(Ai(e,t))},max(e,t){return this.check(Ai(e,t))},int(e){return this.check(ao(e))},safe(e){return this.check(ao(e))},positive(e){return this.check(ji(0,e))},nonnegative(e){return this.check(Mi(0,e))},negative(e){return this.check(ki(0,e))},nonpositive(e){return this.check(Ai(0,e))},multipleOf(e,t){return this.check(Ni(e,t))},step(e,t){return this.check(Ni(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function I(e){return Ci(io,e)}const yne=P(`ZodNumberFormat`,(e,t)=>{Nte.init(e,t),io.init(e,t)});function ao(e){return wi(yne,e)}const bne=P(`ZodBoolean`,(e,t)=>{Pte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ua(e,t,n,r)});function L(e){return Ti(bne,e)}const xne=P(`ZodNull`,(e,t)=>{Fte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>da(e,t,n,r)});function oo(e){return Ei(xne,e)}const Sne=P(`ZodUnknown`,(e,t)=>{Ite.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function R(){return Di(Sne)}const Cne=P(`ZodNever`,(e,t)=>{Lte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fa(e,t,n,r)});function wne(e){return Oi(Cne,e)}const Tne=P(`ZodArray`,(e,t)=>{Rte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_a(e,t,n,r),e.element=t.element,Xa(e,`ZodArray`,{min(e,t){return this.check(Fi(e,t))},nonempty(e){return this.check(Fi(1,e))},max(e,t){return this.check(Pi(e,t))},length(e,t){return this.check(Ii(e,t))},unwrap(){return this.element}})});function z(e,t){return Yi(Tne,e,t)}const so=P(`ZodObject`,(e,t)=>{Bte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>va(e,t,n,r),Cn(e,`shape`,()=>t.shape),Xa(e,`ZodObject`,{keyof(){return H(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:R()})},loose(){return this.clone({...this._zod.def,catchall:R()})},strict(){return this.clone({...this._zod.def,catchall:wne()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return xee(this,e)},safeExtend(e){return See(this,e)},merge(e){return Cee(this,e)},pick(e){return yee(this,e)},omit(e){return bee(this,e)},partial(...e){return wee(_o,this,e[0])},required(...e){return Tee(bo,this,e[0])}})});function B(e,t){return new so({type:`object`,shape:e??{},...Nn(t)})}function co(e,t){return new so({type:`object`,shape:e,catchall:R(),...Nn(t)})}const lo=P(`ZodUnion`,(e,t)=>{Ar.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ya(e,t,n,r),e.options=t.options});function uo(e,t){return new lo({type:`union`,options:e,...Nn(t)})}const Ene=P(`ZodDiscriminatedUnion`,(e,t)=>{lo.init(e,t),Vte.init(e,t)});function fo(e,t,n){return new Ene({type:`union`,options:t,discriminator:e,...Nn(n)})}const Dne=P(`ZodIntersection`,(e,t)=>{Hte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ba(e,t,n,r)});function po(e,t){return new Dne({type:`intersection`,left:e,right:t})}const mo=P(`ZodRecord`,(e,t)=>{Ute.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xa(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function V(e,t,n){return!t||!t._zod?new mo({type:`record`,keyType:F(),valueType:e,...Nn(t)}):new mo({type:`record`,keyType:e,valueType:t,...Nn(n)})}const ho=P(`ZodEnum`,(e,t)=>{Wte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pa(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new ho({...t,checks:[],...Nn(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ho({...t,checks:[],...Nn(r),entries:i})}});function H(e,t){return new ho({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Nn(t)})}const One=P(`ZodLiteral`,(e,t)=>{Gte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ma(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function U(e,t){return new One({type:`literal`,values:Array.isArray(e)?e:[e],...Nn(t)})}const kne=P(`ZodTransform`,(e,t)=>{Kte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ga(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new mn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Bn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Bn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function go(e){return new kne({type:`transform`,transform:e})}const _o=P(`ZodOptional`,(e,t)=>{Pr.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vo(e){return new _o({type:`optional`,innerType:e})}const Ane=P(`ZodExactOptional`,(e,t)=>{qte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jne(e){return new Ane({type:`optional`,innerType:e})}const Mne=P(`ZodNullable`,(e,t)=>{Jte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yo(e){return new Mne({type:`nullable`,innerType:e})}const Nne=P(`ZodDefault`,(e,t)=>{Yte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Pne(e,t){return new Nne({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():An(t)}})}const Fne=P(`ZodPrefault`,(e,t)=>{Xte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ta(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ine(e,t){return new Fne({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():An(t)}})}const bo=P(`ZodNonOptional`,(e,t)=>{Zte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ca(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lne(e,t){return new bo({type:`nonoptional`,innerType:e,...Nn(t)})}const Rne=P(`ZodCatch`,(e,t)=>{Lr.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function zne(e,t){return new Rne({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const xo=P(`ZodPipe`,(e,t)=>{Rr.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r),e.in=t.in,e.out=t.out});function So(e,t){return new xo({type:`pipe`,in:e,out:t})}const Bne=P(`ZodPreprocess`,(e,t)=>{xo.init(e,t),Br.init(e,t)}),Vne=P(`ZodReadonly`,(e,t)=>{Vr.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hne(e){return new Vne({type:`readonly`,innerType:e})}const Une=P(`ZodLazy`,(e,t)=>{Ur.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Co(e){return new Une({type:`lazy`,getter:e})}const wo=P(`ZodCustom`,(e,t)=>{Wr.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ha(e,t,n,r)});function To(e,t){return Xi(wo,e??(()=>!0),t)}function Wne(e,t={}){return Zi(wo,e,t)}function Gne(e,t){return Qi(e,t)}function Eo(e,t){return new Bne({type:`pipe`,in:go(e),out:t})}const Do=`state/bug-reports`,Kne=co({at:F(),transport:F(),outcome:F(),reference:F().optional(),error:F().optional(),errorCode:F().optional()}),qne=co({reason:F(),at:F(),errorCode:F().optional()});co({version:I().int().catch(1),id:F(),createdAt:F(),bundleLevel:F(),zipBytes:I().int().nonnegative().catch(0),zipDeleted:L().optional(),state:F(),systemWide:L().optional(),projectSlug:F().nullable().optional(),reference:F().optional(),lastError:qne.optional(),attempts:z(Kne).optional(),note:F().optional()}),co({version:I().int().catch(1),id:F().optional(),sentAt:F().optional(),reference:F().optional()});const Oo=[{name:`github-pat`,regex:/\b(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:/\b(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/g,replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/\bsk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:/\bsk-[A-Za-z0-9]{20,}\b/g,replacement:`[REDACTED-OPENAI]`},{name:`bearer-token`,regex:/([Aa]uthorization:\s*[Bb]earer\s+)(?:\\"[^\s"\\]+\\"|"[A-Za-z0-9\-._~+/=]+"|[^\s"\\]+)/g,replacement:`$1[REDACTED]`},{name:`jwt`,regex:/eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,replacement:`[REDACTED-JWT]`},{name:`url-credentials`,regex:/:\/\/[^/\s:@"]+:[^/\s:@"]+@/g,replacement:`://[REDACTED]@`},{name:`github-pat-fine-grained`,regex:/\bgithub_pat_[0-9A-Za-z_]{20,}/g,replacement:`[REDACTED-GH-PAT]`},{name:`openai-key-modern`,regex:/\bsk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/g,replacement:`[REDACTED-OPENAI]`},{name:`slack-token`,regex:/\bxox[a-z]-[A-Za-z0-9-]{10,}/g,replacement:`[REDACTED-SLACK]`},{name:`google-api-key`,regex:/\bAIza[0-9A-Za-z_-]{35}/g,replacement:`[REDACTED-GOOGLE]`},{name:`stripe-secret-key`,regex:/\b(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/g,replacement:`[REDACTED-STRIPE]`},{name:`gitlab-pat`,regex:/\bglpat-[0-9A-Za-z_-]{20,}/g,replacement:`[REDACTED-GITLAB]`},{name:`bearer-token-json`,regex:/("[Aa]uthorization"\s*:\s*"[Bb]earer\s+)(?:\\"[^"\\]+\\"|[^"\\]+)/g,replacement:`$1[REDACTED]`},{name:`macos-home-path`,regex:/\/Users\/[^/"]+\//g,replacement:`~/`},{name:`linux-home-path`,regex:/\/home\/[^/"]+\//g,replacement:`~/`}],Jne=Oo.map(e=>e.name);function ko(e){let t=new Set,n=0;return{redacted:e.split(`
180
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ra(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:oa(t,`input`,e.processors),output:oa(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function ia(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return ia(r.element,n);if(r.type===`set`)return ia(r.valueType,n);if(r.type===`lazy`)return ia(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return ia(r.innerType,n);if(r.type===`intersection`)return ia(r.left,n)||ia(r.right,n);if(r.type===`record`||r.type===`map`)return ia(r.keyType,n)||ia(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:ia(r.in,n)||ia(r.out,n);if(r.type===`object`){for(let e in r.shape)if(ia(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(ia(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(ia(e,n))return!0;return!!(r.rest&&ia(r.rest,n))}return!1}const aa=(e,t={})=>n=>{let r=ea({...n,processors:t});return ta(e,r),na(r,e),ra(r,e)},oa=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ea({...i??{},target:a,io:t,processors:n});return ta(e,o),na(o,e),ra(o,e)},sa={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ca=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=sa[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},la=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},ua=(e,t,n,r)=>{n.type=`boolean`},da=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},fa=(e,t,n,r)=>{n.not={}},pa=(e,t,n,r)=>{let i=e._zod.def,a=_n(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ma=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},ha=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ga=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},_a=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=ta(a.element,t,{...r,path:[...r.path,`items`]})},va=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=ta(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=ta(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ya=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>ta(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},ba=(e,t,n,r)=>{let i=e._zod.def,a=ta(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=ta(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},xa=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=ta(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=ta(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=ta(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Sa=(e,t,n,r)=>{let i=e._zod.def,a=ta(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ca=(e,t,n,r)=>{let i=e._zod.def;ta(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},wa=(e,t,n,r)=>{let i=e._zod.def;ta(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ta=(e,t,n,r)=>{let i=e._zod.def;ta(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ea=(e,t,n,r)=>{let i=e._zod.def;ta(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Da=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;ta(o,t,r);let s=t.seen.get(e);s.ref=o},Oa=(e,t,n,r)=>{let i=e._zod.def;ta(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ka=(e,t,n,r)=>{let i=e._zod.def;ta(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Aa=(e,t,n,r)=>{let i=e._zod.innerType;ta(i,t,r);let a=t.seen.get(e);a.ref=i},ja=P(`ZodISODateTime`,(e,t)=>{yte.init(e,t),$a.init(e,t)});function Ma(e){return yi(ja,e)}const Na=P(`ZodISODate`,(e,t)=>{bte.init(e,t),$a.init(e,t)});function Pa(e){return bi(Na,e)}const Fa=P(`ZodISOTime`,(e,t)=>{xte.init(e,t),$a.init(e,t)});function Ia(e){return xi(Fa,e)}const La=P(`ZodISODuration`,(e,t)=>{Ste.init(e,t),$a.init(e,t)});function Ra(e){return Si(La,e)}const za=P(`ZodError`,(e,t)=>{Hn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Gn(e,t)},flatten:{value:t=>Wn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,vn,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,vn,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Ba=Kn(za),Va=qn(za),Ha=Jn(za),Ua=Xn(za),Wa=Qn(za),Ga=$n(za),Ka=er(za),qa=tr(za),Ja=nr(za),Qte=rr(za),$te=ir(za),ene=ar(za),Ya=new WeakMap;function Xa(e,t,n){let r=Object.getPrototypeOf(e),i=Ya.get(r);if(i||(i=new Set,Ya.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const Za=P(`ZodType`,(e,t)=>(br.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:oa(e,`input`),output:oa(e,`output`)}}),e.toJSONSchema=aa(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>Ba(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ha(e,t,n),e.parseAsync=async(t,n)=>Va(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ua(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Wa(e,t,n),e.decode=(t,n)=>Ga(e,t,n),e.encodeAsync=async(t,n)=>Ka(e,t,n),e.decodeAsync=async(t,n)=>qa(e,t,n),e.safeEncode=(t,n)=>Ja(e,t,n),e.safeDecode=(t,n)=>Qte(e,t,n),e.safeEncodeAsync=async(t,n)=>$te(e,t,n),e.safeDecodeAsync=async(t,n)=>ene(e,t,n),Xa(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Tn(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Mn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Wne(e,t))},superRefine(e,t){return this.check(Gne(e,t))},overwrite(e){return this.check(Ui(e))},optional(){return vo(this)},exactOptional(){return jne(this)},nullable(){return yo(this)},nullish(){return vo(yo(this))},nonoptional(e){return Lne(this,e)},array(){return z(this)},or(e){return uo([this,e])},and(e){return po(this,e)},transform(e){return So(this,go(e))},default(e){return Pne(this,e)},prefault(e){return Ine(this,e)},catch(e){return zne(this,e)},pipe(e){return So(this,e)},readonly(){return Hne(this)},describe(e){let t=this.clone();return Yr.add(t,{description:e}),t},meta(...e){if(e.length===0)return Yr.get(this);let t=this.clone();return Yr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return Yr.get(e)?.description},configurable:!0}),e)),Qa=P(`_ZodString`,(e,t)=>{xr.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ca(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Xa(e,`_ZodString`,{regex(...e){return this.check(Li(...e))},includes(...e){return this.check(Bi(...e))},startsWith(...e){return this.check(Vi(...e))},endsWith(...e){return this.check(Hi(...e))},min(...e){return this.check(Fi(...e))},max(...e){return this.check(Pi(...e))},length(...e){return this.check(Ii(...e))},nonempty(...e){return this.check(Fi(1,...e))},lowercase(e){return this.check(Ri(e))},uppercase(e){return this.check(zi(e))},trim(){return this.check(Gi())},normalize(...e){return this.check(Wi(...e))},toLowerCase(){return this.check(Ki())},toUpperCase(){return this.check(qi())},slugify(){return this.check(Ji())}})}),tne=P(`ZodString`,(e,t)=>{xr.init(e,t),Qa.init(e,t),e.email=t=>e.check(Zr(nne,t)),e.url=t=>e.check(ri(no,t)),e.jwt=t=>e.check(vi(vne,t)),e.emoji=t=>e.check(ii(ine,t)),e.guid=t=>e.check(Qr(eo,t)),e.uuid=t=>e.check($r(to,t)),e.uuidv4=t=>e.check(ei(to,t)),e.uuidv6=t=>e.check(ti(to,t)),e.uuidv7=t=>e.check(ni(to,t)),e.nanoid=t=>e.check(ai(ane,t)),e.guid=t=>e.check(Qr(eo,t)),e.cuid=t=>e.check(oi(one,t)),e.cuid2=t=>e.check(si(sne,t)),e.ulid=t=>e.check(ci(cne,t)),e.base64=t=>e.check(hi(hne,t)),e.base64url=t=>e.check(gi(gne,t)),e.xid=t=>e.check(li(lne,t)),e.ksuid=t=>e.check(ui(une,t)),e.ipv4=t=>e.check(di(dne,t)),e.ipv6=t=>e.check(fi(fne,t)),e.cidrv4=t=>e.check(pi(pne,t)),e.cidrv6=t=>e.check(mi(mne,t)),e.e164=t=>e.check(_i(_ne,t)),e.datetime=t=>e.check(Ma(t)),e.date=t=>e.check(Pa(t)),e.time=t=>e.check(Ia(t)),e.duration=t=>e.check(Ra(t))});function F(e){return Xr(tne,e)}const $a=P(`ZodStringFormat`,(e,t)=>{Sr.init(e,t),Qa.init(e,t)}),nne=P(`ZodEmail`,(e,t)=>{ute.init(e,t),$a.init(e,t)}),eo=P(`ZodGUID`,(e,t)=>{cte.init(e,t),$a.init(e,t)}),to=P(`ZodUUID`,(e,t)=>{lte.init(e,t),$a.init(e,t)});function rne(e){return $r(to,e)}const no=P(`ZodURL`,(e,t)=>{dte.init(e,t),$a.init(e,t)});function ro(e){return ri(no,e)}const ine=P(`ZodEmoji`,(e,t)=>{fte.init(e,t),$a.init(e,t)}),ane=P(`ZodNanoID`,(e,t)=>{pte.init(e,t),$a.init(e,t)}),one=P(`ZodCUID`,(e,t)=>{mte.init(e,t),$a.init(e,t)}),sne=P(`ZodCUID2`,(e,t)=>{hte.init(e,t),$a.init(e,t)}),cne=P(`ZodULID`,(e,t)=>{gte.init(e,t),$a.init(e,t)}),lne=P(`ZodXID`,(e,t)=>{_te.init(e,t),$a.init(e,t)}),une=P(`ZodKSUID`,(e,t)=>{vte.init(e,t),$a.init(e,t)}),dne=P(`ZodIPv4`,(e,t)=>{Cte.init(e,t),$a.init(e,t)}),fne=P(`ZodIPv6`,(e,t)=>{wte.init(e,t),$a.init(e,t)}),pne=P(`ZodCIDRv4`,(e,t)=>{Tte.init(e,t),$a.init(e,t)}),mne=P(`ZodCIDRv6`,(e,t)=>{Ete.init(e,t),$a.init(e,t)}),hne=P(`ZodBase64`,(e,t)=>{Dte.init(e,t),$a.init(e,t)}),gne=P(`ZodBase64URL`,(e,t)=>{kte.init(e,t),$a.init(e,t)}),_ne=P(`ZodE164`,(e,t)=>{Ate.init(e,t),$a.init(e,t)}),vne=P(`ZodJWT`,(e,t)=>{Mte.init(e,t),$a.init(e,t)}),io=P(`ZodNumber`,(e,t)=>{wr.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>la(e,t,n,r),Xa(e,`ZodNumber`,{gt(e,t){return this.check(ji(e,t))},gte(e,t){return this.check(Mi(e,t))},min(e,t){return this.check(Mi(e,t))},lt(e,t){return this.check(ki(e,t))},lte(e,t){return this.check(Ai(e,t))},max(e,t){return this.check(Ai(e,t))},int(e){return this.check(ao(e))},safe(e){return this.check(ao(e))},positive(e){return this.check(ji(0,e))},nonnegative(e){return this.check(Mi(0,e))},negative(e){return this.check(ki(0,e))},nonpositive(e){return this.check(Ai(0,e))},multipleOf(e,t){return this.check(Ni(e,t))},step(e,t){return this.check(Ni(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function I(e){return Ci(io,e)}const yne=P(`ZodNumberFormat`,(e,t)=>{Nte.init(e,t),io.init(e,t)});function ao(e){return wi(yne,e)}const bne=P(`ZodBoolean`,(e,t)=>{Pte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ua(e,t,n,r)});function L(e){return Ti(bne,e)}const xne=P(`ZodNull`,(e,t)=>{Fte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>da(e,t,n,r)});function oo(e){return Ei(xne,e)}const Sne=P(`ZodUnknown`,(e,t)=>{Ite.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function R(){return Di(Sne)}const Cne=P(`ZodNever`,(e,t)=>{Lte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fa(e,t,n,r)});function wne(e){return Oi(Cne,e)}const Tne=P(`ZodArray`,(e,t)=>{Rte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_a(e,t,n,r),e.element=t.element,Xa(e,`ZodArray`,{min(e,t){return this.check(Fi(e,t))},nonempty(e){return this.check(Fi(1,e))},max(e,t){return this.check(Pi(e,t))},length(e,t){return this.check(Ii(e,t))},unwrap(){return this.element}})});function z(e,t){return Yi(Tne,e,t)}const so=P(`ZodObject`,(e,t)=>{Bte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>va(e,t,n,r),Cn(e,`shape`,()=>t.shape),Xa(e,`ZodObject`,{keyof(){return H(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:R()})},loose(){return this.clone({...this._zod.def,catchall:R()})},strict(){return this.clone({...this._zod.def,catchall:wne()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return xee(this,e)},safeExtend(e){return See(this,e)},merge(e){return Cee(this,e)},pick(e){return yee(this,e)},omit(e){return bee(this,e)},partial(...e){return wee(_o,this,e[0])},required(...e){return Tee(bo,this,e[0])}})});function B(e,t){return new so({type:`object`,shape:e??{},...Nn(t)})}function co(e,t){return new so({type:`object`,shape:e,catchall:R(),...Nn(t)})}const lo=P(`ZodUnion`,(e,t)=>{Ar.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ya(e,t,n,r),e.options=t.options});function uo(e,t){return new lo({type:`union`,options:e,...Nn(t)})}const Ene=P(`ZodDiscriminatedUnion`,(e,t)=>{lo.init(e,t),Vte.init(e,t)});function fo(e,t,n){return new Ene({type:`union`,options:t,discriminator:e,...Nn(n)})}const Dne=P(`ZodIntersection`,(e,t)=>{Hte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ba(e,t,n,r)});function po(e,t){return new Dne({type:`intersection`,left:e,right:t})}const mo=P(`ZodRecord`,(e,t)=>{Ute.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xa(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function V(e,t,n){return!t||!t._zod?new mo({type:`record`,keyType:F(),valueType:e,...Nn(t)}):new mo({type:`record`,keyType:e,valueType:t,...Nn(n)})}const ho=P(`ZodEnum`,(e,t)=>{Wte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pa(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new ho({...t,checks:[],...Nn(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ho({...t,checks:[],...Nn(r),entries:i})}});function H(e,t){return new ho({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Nn(t)})}const One=P(`ZodLiteral`,(e,t)=>{Gte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ma(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function U(e,t){return new One({type:`literal`,values:Array.isArray(e)?e:[e],...Nn(t)})}const kne=P(`ZodTransform`,(e,t)=>{Kte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ga(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new mn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Bn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Bn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function go(e){return new kne({type:`transform`,transform:e})}const _o=P(`ZodOptional`,(e,t)=>{Pr.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vo(e){return new _o({type:`optional`,innerType:e})}const Ane=P(`ZodExactOptional`,(e,t)=>{qte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jne(e){return new Ane({type:`optional`,innerType:e})}const Mne=P(`ZodNullable`,(e,t)=>{Jte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yo(e){return new Mne({type:`nullable`,innerType:e})}const Nne=P(`ZodDefault`,(e,t)=>{Yte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Pne(e,t){return new Nne({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():An(t)}})}const Fne=P(`ZodPrefault`,(e,t)=>{Xte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ta(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ine(e,t){return new Fne({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():An(t)}})}const bo=P(`ZodNonOptional`,(e,t)=>{Zte.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ca(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lne(e,t){return new bo({type:`nonoptional`,innerType:e,...Nn(t)})}const Rne=P(`ZodCatch`,(e,t)=>{Lr.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function zne(e,t){return new Rne({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const xo=P(`ZodPipe`,(e,t)=>{Rr.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r),e.in=t.in,e.out=t.out});function So(e,t){return new xo({type:`pipe`,in:e,out:t})}const Bne=P(`ZodPreprocess`,(e,t)=>{xo.init(e,t),Br.init(e,t)}),Vne=P(`ZodReadonly`,(e,t)=>{Vr.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hne(e){return new Vne({type:`readonly`,innerType:e})}const Une=P(`ZodLazy`,(e,t)=>{Ur.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Co(e){return new Une({type:`lazy`,getter:e})}const wo=P(`ZodCustom`,(e,t)=>{Wr.init(e,t),Za.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ha(e,t,n,r)});function To(e,t){return Xi(wo,e??(()=>!0),t)}function Wne(e,t={}){return Zi(wo,e,t)}function Gne(e,t){return Qi(e,t)}function Eo(e,t){return new Bne({type:`pipe`,in:go(e),out:t})}const Do=`state/bug-reports`,Kne=co({at:F(),transport:F(),outcome:F(),reference:F().optional(),error:F().optional(),errorCode:F().optional()}),qne=co({reason:F(),at:F(),errorCode:F().optional()});co({version:I().int().catch(1),id:F(),createdAt:F(),bundleLevel:F(),zipBytes:I().int().nonnegative().catch(0),zipDeleted:L().optional(),state:F(),systemWide:L().optional(),projectSlug:F().nullable().optional(),reference:F().optional(),lastError:qne.optional(),attempts:z(Kne).optional(),note:F().optional()}),co({version:I().int().catch(1),id:F().optional(),sentAt:F().optional(),reference:F().optional()});const Oo=[{name:`github-pat`,regex:/\b(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:/\b(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/g,replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/\bsk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:/\bsk-[A-Za-z0-9]{20,}\b/g,replacement:`[REDACTED-OPENAI]`},{name:`bearer-token`,regex:/([Aa]uthorization:\s*[Bb]earer\s+)(?:\\"[^\s"\\]+\\"|"[A-Za-z0-9\-._~+/=]+"|[^\s"\\]+)/g,replacement:`$1[REDACTED]`},{name:`jwt`,regex:/eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,replacement:`[REDACTED-JWT]`},{name:`url-credentials`,regex:/:\/\/[^/\s:@"]+:[^/\s:@"]+@/g,replacement:`://[REDACTED]@`},{name:`github-pat-fine-grained`,regex:/\bgithub_pat_[0-9A-Za-z_]{20,}/g,replacement:`[REDACTED-GH-PAT]`},{name:`openai-key-modern`,regex:/\bsk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/g,replacement:`[REDACTED-OPENAI]`},{name:`slack-token`,regex:/\bxox[a-z]-[A-Za-z0-9-]{10,}/g,replacement:`[REDACTED-SLACK]`},{name:`google-api-key`,regex:/\bAIza[0-9A-Za-z_-]{35}/g,replacement:`[REDACTED-GOOGLE]`},{name:`stripe-secret-key`,regex:/\b(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/g,replacement:`[REDACTED-STRIPE]`},{name:`gitlab-pat`,regex:/\bglpat-[0-9A-Za-z_-]{20,}/g,replacement:`[REDACTED-GITLAB]`},{name:`bearer-token-json`,regex:/("[Aa]uthorization"\s*:\s*"[Bb]earer\s+)(?:\\"[^"\\]+\\"|[^"\\]+)/g,replacement:`$1[REDACTED]`},{name:`macos-home-path`,regex:/\/Users\/[^/"\r]*[^/"\r\\]/g,replacement:`~`},{name:`linux-home-path`,regex:/\/home\/[^/"\r]*[^/"\r\\]/g,replacement:`~`},{name:`windows-home-path`,regex:/[A-Za-z]:\\{1,2}Users\\{1,2}(?:(?![A-Za-z]:\\)[^\\"\r])+/gi,replacement:`~`}],Jne=Oo.map(e=>e.name);function ko(e){let t=new Set,n=0;return{redacted:e.split(`
181
181
  `).map(e=>{let r=e,i=!1;for(let{name:e,regex:n,replacement:a}of Oo)n.lastIndex=0,n.test(r)&&(t.add(e),i=!0,n.lastIndex=0,r=r.replace(n,a));return i&&n++,r}).join(`
182
182
  `),patterns:[...t],lineCount:n}}function Ao(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Mo(e.position):`start`in e||`end`in e?Mo(e):`line`in e||`column`in e?jo(e):``}function jo(e){return No(e&&e.line)+`:`+No(e&&e.column)}function Mo(e){return jo(e&&e.start)+`-`+jo(e&&e.end)}function No(e){return e&&typeof e==`number`?e:1}var Po=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Ao(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Po.prototype.file=``,Po.prototype.name=``,Po.prototype.reason=``,Po.prototype.message=``,Po.prototype.stack=``,Po.prototype.column=void 0,Po.prototype.line=void 0,Po.prototype.ancestors=void 0,Po.prototype.cause=void 0,Po.prototype.fatal=void 0,Po.prototype.place=void 0,Po.prototype.ruleId=void 0,Po.prototype.source=void 0;const Fo=new Map([[32,` `],[9,` `],[160,`\xA0`]]);function Io(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function Lo(e){let t=Io(e);return t!==null&&Fo.has(t)}function Yne(e){let t=Io(e);return t===null?null:Fo.get(t)??null}const Ro=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function zo(e){Ro.lastIndex=0;let t=e.match(Ro);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=Yne(e);if(t===null)return null;n+=t}return n}const Xne=[`off`,`follow`,`full`],Bo=`pull`,Vo=[`off`,`follow`,`full`,Bo],Zne=[`follow`,`full`,Bo],Ho=3600,Qne=new Set(Object.keys({sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,feature:`gherkin`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`})),$ne=new Set([`md`,`mdx`,`mmd`,`mermaid`]);new Set([...Qne,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!$ne.has(e)));const Uo=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],ere=[`video/mp4`,`video/webm`,`video/ogg`],tre=[`audio/mpeg`,`audio/wav`,`audio/ogg`],nre=[`application/pdf`],Wo=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Go=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),rre=new Set([`pdf`]),Ko=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),qo=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Jo=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),ire=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),Yo=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Xo=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],Zo=[`mp4`,`webm`,`mov`,`m4v`],Qo=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],$o=[`pdf`],es=[`json`,`toml`,`lock`];function ts(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}ts(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,Xo,Wo),ts(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,Zo,Go),ts(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,Qo,Ko),ts(`SIDEBAR_PDF_ASSET_EXTENSIONS`,$o,rre),ts(`FILE_ATTACHMENT_EXTENSIONS`,[...qo],Yo),ts(`WIKI_EMBED_EXTENSIONS`,[...Yo],Jo),new Set(Xo),new Set(Zo),new Set(Qo),new Set($o),new Set(es),ts(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...Xo,...Zo,...Qo,...$o,...es])],ire);const are=new Set([`base`,`canvas`]),ore=new Set([`mmd`,`mermaid`]),sre=new Set([`excalidraw`]),ns=new Set([...Jo,...are,...ore,...sre]),rs=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`,`ko`],cre=new Set([`ar`,`ur`]),lre=rs.filter(e=>!cre.has(e)),ure=[`markdownlint`,`frontmatter`,`okf`],dre=[`missing`,`invalid`];[...ure];const fre=[`off`,`warning`,`error`],is=`warning`,pre=[`error`,`warning`],as=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],mre={base00:`default background`,base01:`alt background — cards, popovers, sidebar`,base02:`selection background, borders`,base03:`comments, invisibles`,base04:`secondary text`,base05:`default foreground`,base06:`light foreground`,base07:`lightest foreground`,base08:`red — variables, tags, diff deleted`,base09:`orange — numbers, constants`,base0A:`yellow — classes, search highlight`,base0B:`green — strings, diff inserted`,base0C:`cyan — support, escapes, quotes`,base0D:`blue — functions, headings, accent`,base0E:`magenta — keywords, storage`,base0F:`deprecated markers, embedded tags`},hre=/\P{White_Space}/u;function gre(e){return hre.test(e)}function _re(e){let t=e.palette;return{background:t.base00,foreground:t.base05,card:t.base01,"card-foreground":t.base05,popover:t.base01,"popover-foreground":t.base05,primary:t.base0D,"primary-foreground":t.base00,secondary:t.base01,"secondary-foreground":t.base05,muted:t.base01,"muted-foreground":t.base04,accent:t.base02,"accent-foreground":t.base05,destructive:t.base08,border:t.base02,input:t.base02,ring:t.base0D,"selection-soft":t.base02,"chart-1":t.base0D,"chart-2":t.base0B,"chart-3":t.base0A,"chart-4":t.base0E,"chart-5":t.base08,sidebar:t.base01,"sidebar-foreground":t.base05,"sidebar-primary":t.base0D,"sidebar-primary-foreground":t.base00,"sidebar-accent":t.base02,"sidebar-accent-foreground":t.base0D,"sidebar-hover":t.base02,"sidebar-border":t.base02,"sidebar-ring":t.base0D,"syntax-keyword":t.base0E,"syntax-tag":t.base08,"syntax-attr":t.base0D,"syntax-string":t.base0B,"syntax-number":t.base09,"syntax-atom":t.base0C,"syntax-comment":t.base03,"syntax-func":t.base0D,"syntax-var":t.base08,"syntax-type":t.base0A,"syntax-operator":t.base05,"syntax-meta":t.base0F,"syntax-bg":t.base01,"link-color":t.base0D,"broken-link-color":t.base08,"lint-warning-color":t.base0A,"lint-error-color":t.base08,"diff-added":t.base0B,"diff-removed":t.base08,"callout-note-color":t.base0D,"callout-info-color":t.base0D,"callout-todo-color":t.base0D,"callout-abstract-color":t.base0C,"callout-tip-color":t.base0B,"callout-success-color":t.base0B,"callout-important-color":t.base0E,"callout-example-color":t.base0E,"callout-question-color":t.base0E,"callout-warning-color":t.base0A,"callout-caution-color":t.base09,"callout-danger-color":t.base09,"callout-failure-color":t.base08,"callout-bug-color":t.base08,"callout-quote-color":t.base03,...yre(t)}}const ss={black:`base00`,red:`base08`,green:`base0B`,yellow:`base0A`,blue:`base0D`,magenta:`base0E`,cyan:`base0C`,white:`base05`,brightBlack:`base03`,brightRed:`base08`,brightGreen:`base0B`,brightYellow:`base0A`,brightBlue:`base0D`,brightMagenta:`base0E`,brightCyan:`base0C`,brightWhite:`base07`},vre=Object.keys(ss);function yre(e){let t={};for(let n of vre)t[`ansi-${bre(n)}`]=e[ss[n]];return t}function bre(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}const xre={name:`Dracula`,author:`clach04 (https://github.com/clach04)`,variant:`dark`,palette:{base00:`#282a36`,base01:`#21222c`,base02:`#44475a`,base03:`#6272a4`,base04:`#9ea8c7`,base05:`#f8f8f2`,base06:`#f8f8f2`,base07:`#ffffff`,base08:`#ff5555`,base09:`#ffb86c`,base0A:`#f1fa8c`,base0B:`#50fa7b`,base0C:`#8be9fd`,base0D:`#bd93f9`,base0E:`#ff79c6`,base0F:`#993333`}},Sre={name:`Catppuccin Frappé`,author:`https://github.com/catppuccin/catppuccin`,variant:`dark`,palette:{base00:`#303446`,base01:`#292c3c`,base02:`#414559`,base03:`#51576d`,base04:`#626880`,base05:`#c6d0f5`,base06:`#f2d5cf`,base07:`#babbf1`,base08:`#e78284`,base09:`#ef9f76`,base0A:`#e5c890`,base0B:`#a6d189`,base0C:`#81c8be`,base0D:`#8caaee`,base0E:`#ca9ee6`,base0F:`#eebebe`}},Cre={name:`Catppuccin Latte`,author:`https://github.com/catppuccin/catppuccin`,variant:`light`,palette:{base00:`#eff1f5`,base01:`#e6e9ef`,base02:`#ccd0da`,base03:`#bcc0cc`,base04:`#acb0be`,base05:`#4c4f69`,base06:`#dc8a78`,base07:`#7287fd`,base08:`#d20f39`,base09:`#fe640b`,base0A:`#df8e1d`,base0B:`#40a02b`,base0C:`#179299`,base0D:`#1d62ec`,base0E:`#8839ef`,base0F:`#dd7878`}},wre={name:`Monokai`,author:`Wimer Hazenberg (http://www.monokai.nl)`,variant:`dark`,palette:{base00:`#272822`,base01:`#383830`,base02:`#49483e`,base03:`#75715e`,base04:`#a59f85`,base05:`#f8f8f2`,base06:`#f5f4f1`,base07:`#f9f8f5`,base08:`#f92672`,base09:`#fd971f`,base0A:`#f4bf75`,base0B:`#a6e22e`,base0C:`#a1efe4`,base0D:`#66d9ef`,base0E:`#ae81ff`,base0F:`#cc6633`}},Tre={name:`Gruvbox dark, medium`,author:`Dawid Kurek, morhetz (https://github.com/morhetz/gruvbox)`,variant:`dark`,palette:{base00:`#282828`,base01:`#3c3836`,base02:`#504945`,base03:`#665c54`,base04:`#bdae93`,base05:`#d5c4a1`,base06:`#ebdbb2`,base07:`#fbf1c7`,base08:`#fb4934`,base09:`#fe8019`,base0A:`#fabd2f`,base0B:`#b8bb26`,base0C:`#8ec07c`,base0D:`#83a598`,base0E:`#d3869b`,base0F:`#d65d0e`}},Ere={name:`Solarized Dark`,author:`Ethan Schoonover (modified by aramisgithub)`,variant:`dark`,palette:{base00:`#002b36`,base01:`#073642`,base02:`#586e75`,base03:`#657b83`,base04:`#839496`,base05:`#93a1a1`,base06:`#eee8d5`,base07:`#fdf6e3`,base08:`#dc322f`,base09:`#cb4b16`,base0A:`#b58900`,base0B:`#859900`,base0C:`#2aa198`,base0D:`#2995e1`,base0E:`#6c71c4`,base0F:`#d33682`}};function cs(e,t,n){return{id:e,label:t,kind:n.variant,scheme:n,toTokens:()=>_re(n)}}function ls(e,t){return{id:e,label:t,kind:`system`}}const us=[ls(`default`,`Default`),cs(`dracula`,`Dracula`,xre),cs(`catppuccin-frappe`,`Catppuccin Frappé`,Sre),cs(`catppuccin-latte`,`Catppuccin Latte`,Cre),cs(`monokai`,`Monokai`,wre),cs(`gruvbox`,`Gruvbox`,Tre),cs(`solarized`,`Solarized`,Ere),ls(`custom`,`Custom`)],Dre=us.map(e=>e.id),ds=/^[a-z0-9-]{1,32}$/;new Map(us.map(e=>[e.id,e]));const fs=Symbol.for(`@inkeep/open-knowledge/field-registry`),ps=globalThis;ps[fs]===void 0&&(ps[fs]=Jr());const ms=ps[fs];function Ore(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=kre(t)?ms.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function kre(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}function Are(){return Object.fromEntries(as.map(e=>[e,F().register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${mre[e]}, as a #rrggbb hex string.`}).optional()]))}function hs(){return Dre.filter(e=>e!==`default`&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}const gs=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),_s=52428800,vs=26214400,ys=12582912,bs=`https://api.openai.com/v1`,xs=`text-embedding-3-small`,Ss=Object.freeze([`127.0.0.1`]),jre=/^[1-9]\d*(s|m|h)$/,Mre=/^https?:\/\//;function Cs(e){let t=e.trim();return t===``?`./`:t}function ws(e){let t=Cs(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}const Ts=co({content:co({dir:F().register(ms,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore. Read at server start; changing it requires a restart.`}).default(`.`),attachmentFolderPath:F().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(ws,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:co({theme:H([`light`,`dark`,`system`]).register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),language:H([`system`,...rs]).register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Interface language. 'system' follows the operating system. A personal preference (user scope) — not shared with the project, and never applied to document content.`}).optional(),colorThemeLight:F().register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${hs()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(ds,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeDark:F().register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${hs()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(ds,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorTheme:F().register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A short theme id (lowercase letters, digits, and hyphens; max 32 characters); an id no palette matches falls back to 'default'. A personal preference (user scope) — not shared with the project.`}).regex(ds,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeEnabled:L().register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:co({name:F().register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:F().register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:H([`dark`,`light`]).register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...Are()}).optional(),preview:co({autoOpen:L().register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:co({showHiddenFiles:L().register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:L().register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:L().register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:L().register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillGroups:L().register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Group skills in the sidebar by where they came from — the publisher they were imported from, or the plugin that ships them. Skills you authored stay ungrouped at the top of their scope. Per-machine (project-local) — not shared with collaborators.`}).default(!0),pinnedProjectSkills:z(F()).register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Project-scope skills pinned to the top of the Skills sidebar, by name. A pinned skill also keeps its normal row, so a provenance group still lists everything from its source. Per-machine (project-local) — not shared with collaborators.`}).default([]),pinnedGlobalSkills:z(F()).register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Global-scope skills pinned to the top of the Skills sidebar, by name. Stored per USER rather than per project, so a pinned global skill follows you into every project.`}).default([])}).optional()}).default({preview:{autoOpen:!0}}),editor:co({wordWrap:L().register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:L().register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Reuse one tab when clicking through the Files and Skills sidebars, the way an editor preview tab works. Turn off to open every click in its own tab. Pinned tabs keep their own tab either way. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0,previewTabs:!0}),agents:co({autoApproveOkTools:L().register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."}).default(!0)}).default({autoApproveOkTools:!0}),autoSync:co({mode:H(Vo).register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`What this machine syncs on a schedule for this project: 'off' (Manual — nothing scheduled; the manual pull/push actions still work), 'follow' (Auto, pull only — scheduled pulls, never a scheduled push; 'pull' is accepted as a legacy alias), or 'full' (Auto, pull and push — bidirectional). Explicit user-triggered pushes work in every mode. null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared. Supersedes the legacy autoSync.enabled boolean.`}).nullable().default(null),enabled:L().register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Legacy per-machine sync toggle, superseded by autoSync.mode. Read only when mode is absent (true = full, false = off). null = not chosen yet. Per-machine (project-local) — not shared.`}).nullable().default(null),resumeMode:H(Zne).register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`When sync is paused (autoSync.mode 'off') after having been enabled, the active mode to resume into ('follow' | 'full'). Per-machine UI memory; ignored while a mode is active. Not shared.`}).optional(),pullIntervalSeconds:I().int().min(30).max(Ho).register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Seconds between scheduled pulls while autoSync.mode is follow or full (default 30). An unauthenticated follower is additionally floored to the anonymous poll minimum, so a lower value there has no effect. Per-machine (project-local) — not shared.`}).optional().catch(void 0),pushIntervalSeconds:I().int().min(30).max(Ho).register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Seconds between scheduled pushes while autoSync.mode is full (default 60). Ignored in every other mode, which never pushes on a schedule. Each cycle with pending edits authors a commit, so a shorter interval means more, smaller commits in the repo's shared history. Per-machine (project-local) — not shared.`}).optional().catch(void 0),default:uo([L(),H(Vo)]).register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Committed project default for a machine's sync mode on first open: 'off' | 'follow' | 'full', or the legacy boolean (true = full, false = off). null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.mode choice overrides it.`}).nullable().default(null)}).default({mode:null,enabled:null,default:null}),terminal:co({enabled:L().register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null),shell:F().register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Absolute Windows shell executable override for the in-app terminal. PowerShell, cmd.exe, and Git Bash support OpenKnowledge-managed launches (agent chat tabs and fixed commands such as Resolve in terminal or Install Slidev) and dropped-file path insertion. A different existing executable remains usable for plain terminal tabs and shows a capability notice; requested agent and command launches open only the plain shell without running the agent or command, and dropped-file paths are refused. Empty values use automatic shell discovery. Per-machine (project-local), human-managed, and never shared via git, clone, or sync.`}).optional()}).default({enabled:null}),slides:co({enabled:L().register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Whether the Slides plugin appears in Settings → Plugins. When on, a document whose frontmatter has `slides: true` offers an action that opens the deck in a dedicated window (desktop only, requires a resolvable slidev). A personal preference (user scope). Default off."}).default(!1)}).default({enabled:!1}),telemetry:co({localSink:co({enabled:L().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:co({maxBytes:I().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(_s)}).default({maxBytes:_s}),logs:co({maxBytes:I().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(vs)}).default({maxBytes:vs}),attributeDenylist:z(F()).register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...gs])}).default({enabled:!0,spans:{maxBytes:_s},logs:{maxBytes:vs},attributeDenylist:[...gs]}),skillInstallReports:co({enabled:L().register(ms,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Report skill installs to skills.sh so a published skill shows an accurate install count. Sends the skill name, its source repo, and which agent tools it was installed for — never file contents, and never for a private or local source. One report per skill per machine. Default on; the DO_NOT_TRACK and DISABLE_TELEMETRY environment variables also turn it off.`}).default(!0)}).default({enabled:!0})}).default({localSink:{enabled:!0,spans:{maxBytes:_s},logs:{maxBytes:vs},attributeDenylist:[...gs]},skillInstallReports:{enabled:!0}}),lossCapture:co({enabled:L().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Record bridge loss-class events (content-free) under .ok/local/loss-capture/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),maxBytes:I().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(ys)}).default({enabled:!0,maxBytes:ys}),bridge:co({backgroundThrottle:co({enabled:L().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Keep the desktop window's timers running at full rate while it holds unsynced work, so backgrounding the app never starves sync or recovery; when the window is idle the OS-default background throttling is restored (battery). Honored by the desktop app. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),deferGuard:co({enabled:L().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Defer a drain-shaped Observer B re-derive when the WYSIWYG fragment holds an un-propagated keystroke Y.Text lacks, so the keystroke survives instead of being stomped. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),lossDetector:co({enabled:L().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Detect content the bridge silently dropped at its reconciliation boundary (an Observer-A apply arm or a paired agent-undo derive) and write a recovery checkpoint plus a content-free loss event. Detection only — never blocks a write. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),fixedPoint:co({enabled:L().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Bound the Y.Text→WYSIWYG re-derive loop with a drain-count backstop: a run of re-derive drains that never reaches a raw-byte fixed point freezes the re-derive loop and writes a recovery checkpoint plus a content-free loss event, instead of churning unbounded. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),preDrain:co({enabled:L().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Before an agent write or undo rebuilds the WYSIWYG fragment, flush an un-propagated keystroke that provably does not overlap the operation into Y.Text so the keystroke survives instead of needing recovery; overlapping or unmodellable cases fall back to the checkpoint floor. Scope: appending writes and single-frame undos — a write that replaces the whole body (replace / edit) overwrites the keystroke either way, so those always take the checkpoint floor. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),flushOnHide:co({enabled:L().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`On tab hide/unload, force-send each doc's unsynced work to the server and commit its local cache, and re-sync on return to foreground, so a backgrounded tab never strands edits that IndexedDB alone would lose on recycle. Honored client-side. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0})}).default({backgroundThrottle:{enabled:!0},deferGuard:{enabled:!0},lossDetector:{enabled:!0},fixedPoint:{enabled:!0},preDrain:{enabled:!0},flushOnHide:{enabled:!0}}),search:co({semantic:co({enabled:L().register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:F().register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override to point at a self-hosted server (Ollama / vLLM / LM Studio) or another provider. The API key is NOT stored here — set it with `ok embeddings set-key` (`~/.ok/secrets.yml`); it is sent to whichever endpoint this names."}).default(bs),model:F().register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(xs),dimensions:I().int().positive().register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit (recommended) to detect the model's native size from its first response — that is what lets a non-OpenAI model work without knowing its size up front. Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality; a server that ignores the request param then fails loudly instead of silently. Changing it re-embeds the corpus.`}).optional(),similarityFloor:I().min(0).max(1).register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional()}).default({enabled:!1,baseUrl:bs,model:xs})}).default({semantic:{enabled:!1,baseUrl:bs,model:xs}}),contentRules:co({markdownlint:B({enabled:L().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:B({enabled:L().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:z(B({appliesTo:uo([F(),z(F())]).optional(),file:F(),enabled:L().optional()})).register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Frontmatter schema mappings: which docs (appliesTo globs) validate against which JSON Schema file (project-root-relative path).`}).default([])}).default({enabled:!1,schemas:[]}),okf:B({enabled:L().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the OKF plugin (Open Knowledge Format portability + conformance rules) contributes diagnostics. Advisory warnings; never blocks a write.`}).default(!1),rules:V(F(),L()).register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Per-rule opt-outs for the OKF plugin, keyed by rule id (e.g. no-wiki-links). Omit a rule to leave it enabled; set false to silence it while keeping the plugin on.`}).optional(),generate:B({index:L().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether OK generates and maintains a navigation index.md in every folder that contains Markdown, each listing the documents in that folder grouped by frontmatter type and linking to its subfolders. OK owns these files: edits to them are replaced on the next rebuild.`}).default(!1)}).default({index:!1})}).default({enabled:!1,generate:{index:!1}})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]},okf:{enabled:!1,generate:{index:!1}}}),validation:co({links:H(fre).register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(is),fileTreeIndicators:L().register(ms,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0)}).default({links:is,fileTreeIndicators:!0}),linkPreviews:co({enabled:L().register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata — outbound egress, one request per previewed link. Default ON; set to false to turn external previews off. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!0)}).default({enabled:!0}),server:co({port:I().int().min(1).max(65535).register(ms,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`TCP port the server listens on. Unset by default: a local start picks a free port dynamically, and deployment platforms inject the PORT environment variable instead. Read at server start; changing it requires a restart.`}).optional(),bind:z(F().min(1)).min(1).register(ms,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Addresses the server binds, e.g. [127.0.0.1] or [0.0.0.0]. Default loopback-only ([127.0.0.1]): nothing off this machine can connect. A non-loopback bind additionally requires the server.allowExternal consent interlock. Per-machine (project-local): a value committed to .ok/config.yml is ignored, so one machine exposing the server can never break local clones for the rest of the team — the exposing host sets it via OK_BIND, --bind, or .ok/local/config.yml. Lists replace, never merge. Read at server start; changing it requires a restart.`}).default([...Ss]),externalUrl:ro({protocol:/^https?$/}).regex(Mre).register(ms,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Canonical external origin the server is reached at, e.g. https://kb.example.com — its host joins the Host/Origin allowlists (external-Host + CORS admission). Unset by default: the server admits only loopback Hosts. Setting it declares external exposure, which additionally requires the server.allowExternal consent interlock. Read at server start; changing it requires a restart.`}).optional(),allowExternal:L().register(ms,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Exposure consent interlock. Once the unified server boot lands, a non-loopback server.bind or a server.externalUrl without allowExternal: true will be refused at boot with a one-line fix. Default off. Per-machine (project-local) — consent never travels via git, clone, or share; containers consent via the environment instead.`}).default(!1),openBrowser:L().register(ms,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Open the UI in a browser when the server starts. Default derived: true when every bind address is loopback (a laptop start pops the UI), false otherwise (a container or exposed bind is headless and must never try). Acts once at start. Per-machine (project-local) — not shared.`}).optional(),idleShutdown:uo([U(`off`),F().regex(jre)]).register(ms,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m' for a loopback-only, unexposed server; 'off' otherwise — a non-loopback bind, or a loopback bind declared externally reachable (server.allowExternal + server.externalUrl), stays up, because a remote agent keeps it busy over /mcp, which the idle timer does not count. Residual case the derivation cannot see: a loopback server reached by remote agents with no server.externalUrl (e.g. behind a same-box reverse proxy) still idles at 30m — set 'off' by hand. Reloadable — a valid change applies without a restart. Per-machine (project-local) — not shared.`}).optional()}).default({bind:[...Ss],allowExternal:!1})});var Es,Ds=n((()=>{Es=`1.9.1`}));function Nre(e){let t=new Set([e]),n=new Set,r=e.match(Os);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(Os);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var Os,ks,Pre=n((()=>{Ds(),Os=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,ks=Nre(Es)}));function As(e,t,n,r=!1){let i=Fs[Ps]=Fs[Ps]??{version:Es};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${Es}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${Es}.`),!0}function js(e){let t=Fs[Ps]?.version;if(!(!t||!ks(t)))return Fs[Ps]?.[e]}function Ms(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Es}.`);let n=Fs[Ps];n&&delete n[e]}var Ns,Ps,Fs,Is=n((()=>{Ds(),Pre(),Ns=Es.split(`.`)[0],Ps=Symbol.for(`opentelemetry.js.api.${Ns}`),Fs=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function Ls(e,t,n){let r=js(`diag`);if(r)return r[e](t,...n)}var Rs,Fre=n((()=>{Is(),Rs=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return Ls(`debug`,this._namespace,e)}error(...e){return Ls(`error`,this._namespace,e)}info(...e){return Ls(`info`,this._namespace,e)}warn(...e){return Ls(`warn`,this._namespace,e)}verbose(...e){return Ls(`verbose`,this._namespace,e)}}})),zs,Bs=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(zs||={})}));function Vs(e,t){e<zs.NONE?e=zs.NONE:e>zs.ALL&&(e=zs.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,zs.ERROR),warn:n(`warn`,zs.WARN),info:n(`info`,zs.INFO),debug:n(`debug`,zs.DEBUG),verbose:n(`verbose`,zs.VERBOSE)}}var Hs=n((()=>{Bs()})),Us,Ws,Gs=n((()=>{Fre(),Hs(),Bs(),Is(),Us=`diag`,Ws=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=js(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:zs.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=js(`diag`),i=Vs(n.logLevel??zs.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return As(`diag`,i,t,!0)},t.disable=()=>{Ms(Us,t)},t.createComponentLogger=e=>new Rs(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}}));function Ks(e){return Symbol.for(e)}var qs,Js,Ys=n((()=>{qs=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},Js=new qs})),Xs,Zs=n((()=>{Ys(),Xs=class{active(){return Js}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Qs,$s,ec,tc=n((()=>{Zs(),Is(),Gs(),Qs=`context`,$s=new Xs,ec=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return As(Qs,e,Ws.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return js(Qs)||$s}disable(){this._getContextManager().disable(),Ms(Qs,Ws.instance())}}})),nc,rc=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(nc||={})})),ic,ac,oc,sc=n((()=>{rc(),ic=`0000000000000000`,ac=`00000000000000000000000000000000`,oc={traceId:ac,spanId:ic,traceFlags:nc.NONE}})),cc,lc=n((()=>{sc(),cc=class{constructor(e=oc){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function uc(e){return e.getValue(gc)||void 0}function dc(){return uc(ec.getInstance().active())}function fc(e,t){return e.setValue(gc,t)}function pc(e){return e.deleteValue(gc)}function mc(e,t){return fc(e,new cc(t))}function hc(e){return uc(e)?.spanContext()}var gc,_c=n((()=>{Ys(),lc(),tc(),gc=Ks(`OpenTelemetry Context Key SPAN`)}));function vc(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(Cc[e.charCodeAt(t)]|0)+(Cc[e.charCodeAt(t+1)]|0)+(Cc[e.charCodeAt(t+2)]|0)+(Cc[e.charCodeAt(t+3)]|0);return n===t}function yc(e){return vc(e,32)&&e!==`00000000000000000000000000000000`}function bc(e){return vc(e,16)&&e!==`0000000000000000`}function xc(e){return yc(e.traceId)&&bc(e.spanId)}function Sc(e){return new cc(e)}var Cc,wc=n((()=>{sc(),lc(),Cc=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}));function Tc(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var Ec,Dc,Oc=n((()=>{tc(),_c(),lc(),wc(),Ec=ec.getInstance(),Dc=class{startSpan(e,t,n=Ec.active()){if(t?.root)return new cc;let r=n&&hc(n);return Tc(r)&&xc(r)?new cc(r):new cc}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??Ec.active(),c=this.startSpan(e,i,s),l=fc(s,c);return Ec.with(l,o,void 0,c)}}})),kc,Ac,jc=n((()=>{Oc(),kc=new Dc,Ac=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):kc}}})),Mc,Nc=n((()=>{Oc(),Mc=class{getTracer(e,t,n){return new Dc}}})),Pc,Fc,Ic=n((()=>{jc(),Nc(),Pc=new Mc,Fc=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new Ac(this,e,t,n)}getDelegate(){return this._delegate??Pc}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}})),Lc,Rc=n((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Lc||={})})),zc,Bc=n((()=>{tc(),zc=ec.getInstance()})),Vc,Hc,Uc=n((()=>{Is(),Ic(),wc(),_c(),Gs(),Vc=`trace`,Hc=class e{constructor(){this._proxyTracerProvider=new Fc,this.wrapSpanContext=Sc,this.isSpanContextValid=xc,this.deleteSpan=pc,this.getSpan=uc,this.getActiveSpan=dc,this.getSpanContext=hc,this.setSpan=fc,this.setSpanContext=mc}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=As(Vc,this._proxyTracerProvider,Ws.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return js(Vc)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){Ms(Vc,Ws.instance()),this._proxyTracerProvider=new Fc}}})),Wc,Gc=n((()=>{Uc(),Wc=Hc.getInstance()})),Kc=n((()=>{Gs(),Ys(),Bs(),jc(),Ic(),Rc(),rc(),wc(),sc(),Bc(),Gc()}));function qc(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function Jc(e,t){let n=e;for(let e of t){n=qc(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function Yc(e,t){let n=Jc(e,t);if(n!==void 0)return Ore(n)}const Xc=new Map([[`PORT`,[`server`,`port`]],[`OK_BIND`,[`server`,`bind`]],[`OK_EXTERNAL_URL`,[`server`,`externalUrl`]],[`OK_ALLOW_EXTERNAL`,[`server`,`allowExternal`]],[`OK_OPEN_BROWSER`,[`server`,`openBrowser`]],[`OK_IDLE_SHUTDOWN`,[`server`,`idleShutdown`]]]);function Zc(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toUpperCase()}function Qc(e){return`OK_${(e[0]===`server`?e.slice(1):e).map(Zc).join(`_`)}`}function $c(e,t){if(t.length===0)return e.contents??null;let n=e.getIn(t,!0);if((0,on.isNode)(n))return n;for(let n=t.length-1;n>=0;n--){let r=e.getIn(t.slice(0,n),!0);if((0,on.isNode)(r))return r}return e.contents??null}function el(e,t){let n=1,r=1,i=Math.min(t,e.length);for(let t=0;t<i;t++)e.charCodeAt(t)===10?(n++,r=1):r++;return{line:n,column:r}}function tl(e,t,n,r,i){let a=e.split(`
183
183
  `),o=r-1;if(o<0||o>=a.length)return``;let s=a[o]??``,c=t-(i-1)+s.length,l=Math.max(1,Math.min(n,c)-t),u=[],d=String(o+2).length;for(let e=Math.max(0,o-1);e<=Math.min(a.length-1,o+1);e++){let t=e===o,n=t?`>`:` `,r=String(e+1).padStart(d,` `);if(u.push(`${n} ${r} | ${a[e]??``}`),t){let e=` `.repeat(2+d+3+i-1);u.push(`${e}${`^`.repeat(l)}`)}}return u.join(`
@@ -1528,6 +1528,6 @@ export default function okBridge(pi: {
1528
1528
  `))}function j9(e,t){let n=S(e,`utf-8`);if(n.trim().length!==0)try{let r=k9(JSON.parse(n),t),i=n.endsWith(`
1529
1529
  `)?`
1530
1530
  `:``;te(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=O9(n,t.contentDir);r!==n&&te(e,r)}}function M9(e,t){let n=S(e,`utf-8`),r=O9(n,t.contentDir);r!==n&&te(e,r)}function N9(e){try{return C(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>N(e,t.name))}catch{return[]}}const VTe=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function P9(e){return/\.log\.\d+$/.test(e)}function HTe(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||P9(e)}function UTe(e){let t={contentDir:e.contentDir};for(let n of[`telemetry`,`logs`,`process`])for(let r of N9(N(e.stagingDir,n)))HTe(r)?A9(r,t):r.endsWith(`.json`)?j9(r,t):M9(r,t);for(let n of N9(N(e.stagingDir,`state`))){let e=fe(n);n.endsWith(`.jsonl`)?A9(n,t):VTe.has(e)?j9(n,t):M9(n,t)}}const F9=[`.ok`,`local`,`telemetry`],I9=[`.ok`,`local`,`logs`],L9=[`.ok`,`local`,`loss-capture`],R9=`spans-current.jsonl`,z9=`spans-prev.jsonl`,B9=`server-current.jsonl`,V9=`server-prev.jsonl`,H9=`loss-current.jsonl`,U9=`loss-prev.jsonl`;function WTe(e){return N(e,...F9,R9)}function GTe(e){return N(e,...F9,z9)}function KTe(e){return N(e,...I9,B9)}function qTe(e){return N(e,...I9,V9)}function W9(e){return N(e,...L9,H9)}function JTe(e){return N(e,...L9,U9)}const G9=1e3;async function YTe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}async function XTe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}async function ZTe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}function QTe(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
1531
- `)}\n`:null}catch{return null}}function $Te(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`log`,`--oneline`,`-50`],u3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function eEe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],u3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function K9(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function tEe(){return{nodeVersion:process.version,platform:k(),arch:re()}}function nEe(){return process.env.OTEL_SDK_DISABLED===`false`}function q9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J9(e){if(!g(e))return{};let t;try{t=(0,on.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!q9(t))return{};let n=t.telemetry;if(!q9(n))return{};let r=n.localSink;return q9(r)?r:{}}function Y9(e){return typeof e==`boolean`?e:void 0}function rEe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function X9(e){if(q9(e))return rEe(e.maxBytes)}function iEe(e){let t=J9(YQ(`project`,e)),n=J9(YQ(`project-local`,e));return{enabled:Y9(n.enabled)??Y9(t.enabled)??!0,spansMaxBytes:X9(n.spans)??X9(t.spans)??52428800,logsMaxBytes:X9(n.logs)??X9(t.logs)??26214400}}function aEe(e){return Ae(`sha256`).update(e).digest(`hex`)}function oEe(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const sEe=[`"doc.name"`,`"docName"`];function cEe(e){let t=S(e,`utf-8`),n=0;for(let e of sEe){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!g(e))return!1;try{return v(pe(t),{recursive:!0}),m(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=C(e,{withFileTypes:!0});for(let i of r){let r=N(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const lEe=new Set([`.jsonl`]);function uEe(e){let t=e.lastIndexOf(`.`);return t===-1?!1:lEe.has(e.slice(t))}const dEe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`]);function fEe(e){if(P9(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:dEe.has(e.slice(t))}function pEe(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!fEe(r))continue;let{redacted:i,patterns:a,lineCount:o}=ko(S(n,`utf-8`));a.length!==0&&(te(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return _e(e,t).split(ye).join(`/`)}async function mEe(e){let t=ve(e.contentDir),n=ve(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??YTe,a=r.fetchAgentEffects??XTe,o=r.fetchWatcherRecent??ZTe,s=r.readShadowHead??$Te,c=r.readCheckpointRefs??eEe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.67.0-beta.1`),d=r.readDesktopEnv??K9,f=r.readLanguage??D9,p=r.readRuntime??tEe,h=r.isOtlpPushEnabled??nEe,_=y(N(le(),`ok-bundle-`));try{v(N(_,`telemetry`),{recursive:!0}),v(N(_,`logs`),{recursive:!0}),v(N(_,`state`),{recursive:!0}),Z9(WTe(n),N(_,`telemetry`,R9)),Z9(GTe(n),N(_,`telemetry`,z9)),Z9(KTe(n),N(_,`logs`,B9)),Z9(qTe(n),N(_,`logs`,V9));for(let t of e.userLogFiles??[])Z9(t,N(_,`logs`,fe(t)));for(let t of e.userStateFiles??[])Z9(t,N(_,Do,fe(t)));let y=N(n,`.ok`,`local`),b=N(y,`server.lock`),x=`not-running`,C=`no server.lock`,w=null;if(g(b)){Z9(b,N(_,`state`,`server.lock`));try{let e=S(b,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?w=t.port:C=`lock present but no port`}catch{C=`lock present but unparseable`}}if(w!==null){let e=await i(w);e===null?C=`agent-presence endpoint at :${w} unreachable`:(te(N(_,`state`,`agent-presence.json`),e),x=`running`,C=``);let t=await a(w);t!==null&&te(N(_,`state`,`agent-effects.json`),t);let n=await o(w);if(n!==null){let e=QTe(n);e!==null&&te(N(_,`state`,`watcher-recent.jsonl`),e)}}let T=s(t);T!==null&&te(N(_,`state`,`shadow-head.txt`),T);let E=c(t);E!==null&&te(N(_,`state`,`checkpoint-refs.txt`),E),Z9(W9(n),N(_,`state`,H9)),Z9(JTe(n),N(_,`state`,U9)),Z9(N(y,`last-spawn-error.log`),N(_,`state`,`last-spawn-error.log`)),Z9(N(y,dX),N(_,`state`,dX)),Z9(N(y,fX),N(_,`state`,fX));let ee=p(),ne=d(),re=f(),ie={ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:re}};te(N(_,`state`,`runtime.json`),`${JSON.stringify(ie,null,2)}\n`);let ae=x===`running`?`running
1531
+ `)}\n`:null}catch{return null}}function $Te(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`log`,`--oneline`,`-50`],u3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function eEe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],u3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function K9(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function tEe(){return{nodeVersion:process.version,platform:k(),arch:re()}}function nEe(){return process.env.OTEL_SDK_DISABLED===`false`}function q9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J9(e){if(!g(e))return{};let t;try{t=(0,on.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!q9(t))return{};let n=t.telemetry;if(!q9(n))return{};let r=n.localSink;return q9(r)?r:{}}function Y9(e){return typeof e==`boolean`?e:void 0}function rEe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function X9(e){if(q9(e))return rEe(e.maxBytes)}function iEe(e){let t=J9(YQ(`project`,e)),n=J9(YQ(`project-local`,e));return{enabled:Y9(n.enabled)??Y9(t.enabled)??!0,spansMaxBytes:X9(n.spans)??X9(t.spans)??52428800,logsMaxBytes:X9(n.logs)??X9(t.logs)??26214400}}function aEe(e){return Ae(`sha256`).update(e).digest(`hex`)}function oEe(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const sEe=[`"doc.name"`,`"docName"`];function cEe(e){let t=S(e,`utf-8`),n=0;for(let e of sEe){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!g(e))return!1;try{return v(pe(t),{recursive:!0}),m(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=C(e,{withFileTypes:!0});for(let i of r){let r=N(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const lEe=new Set([`.jsonl`]);function uEe(e){let t=e.lastIndexOf(`.`);return t===-1?!1:lEe.has(e.slice(t))}const dEe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`]);function fEe(e){if(P9(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:dEe.has(e.slice(t))}function pEe(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!fEe(r))continue;let{redacted:i,patterns:a,lineCount:o}=ko(S(n,`utf-8`));a.length!==0&&(te(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return _e(e,t).split(ye).join(`/`)}async function mEe(e){let t=ve(e.contentDir),n=ve(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??YTe,a=r.fetchAgentEffects??XTe,o=r.fetchWatcherRecent??ZTe,s=r.readShadowHead??$Te,c=r.readCheckpointRefs??eEe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.67.0-beta.2`),d=r.readDesktopEnv??K9,f=r.readLanguage??D9,p=r.readRuntime??tEe,h=r.isOtlpPushEnabled??nEe,_=y(N(le(),`ok-bundle-`));try{v(N(_,`telemetry`),{recursive:!0}),v(N(_,`logs`),{recursive:!0}),v(N(_,`state`),{recursive:!0}),Z9(WTe(n),N(_,`telemetry`,R9)),Z9(GTe(n),N(_,`telemetry`,z9)),Z9(KTe(n),N(_,`logs`,B9)),Z9(qTe(n),N(_,`logs`,V9));for(let t of e.userLogFiles??[])Z9(t,N(_,`logs`,fe(t)));for(let t of e.userStateFiles??[])Z9(t,N(_,Do,fe(t)));let y=N(n,`.ok`,`local`),b=N(y,`server.lock`),x=`not-running`,C=`no server.lock`,w=null;if(g(b)){Z9(b,N(_,`state`,`server.lock`));try{let e=S(b,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?w=t.port:C=`lock present but no port`}catch{C=`lock present but unparseable`}}if(w!==null){let e=await i(w);e===null?C=`agent-presence endpoint at :${w} unreachable`:(te(N(_,`state`,`agent-presence.json`),e),x=`running`,C=``);let t=await a(w);t!==null&&te(N(_,`state`,`agent-effects.json`),t);let n=await o(w);if(n!==null){let e=QTe(n);e!==null&&te(N(_,`state`,`watcher-recent.jsonl`),e)}}let T=s(t);T!==null&&te(N(_,`state`,`shadow-head.txt`),T);let E=c(t);E!==null&&te(N(_,`state`,`checkpoint-refs.txt`),E),Z9(W9(n),N(_,`state`,H9)),Z9(JTe(n),N(_,`state`,U9)),Z9(N(y,`last-spawn-error.log`),N(_,`state`,`last-spawn-error.log`)),Z9(N(y,dX),N(_,`state`,dX)),Z9(N(y,fX),N(_,`state`,fX));let ee=p(),ne=d(),re=f(),ie={ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:re}};te(N(_,`state`,`runtime.json`),`${JSON.stringify(ie,null,2)}\n`);let ae=x===`running`?`running
1532
1532
  `:`not-running (${C})\n`;if(te(N(_,`state`,`server-status.txt`),ae),e.processDir&&g(e.processDir)){let t=N(_,`process`);v(t,{recursive:!0}),m(e.processDir,t,{recursive:!0})}let oe=e.redact===!0;oe&&UTe({stagingDir:_,contentDir:t}),e.note&&te(N(_,`note.txt`),e.note);let se=null;e.scrubSecrets===!0&&(se=pEe(_));for(let t of e.extraFiles??[])Z9(t.sourcePath,N(_,`extra`,t.zipName??fe(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let k=iEe(n),ce=Q9(_),le=[],ue=0,A=0;for(let e of ce){let t=$9(_,e),n=O(e).size,r=uEe(t)?oEe(e):0;le.push({path:t,bytes:n,lines:r}),ue+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(A+=cEe(e))}let j={applied:oe};se!==null&&(j.secretScrub=se);let de={schemaVersion:2,createdAt:l().toISOString(),ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:re},contentDir:{pathSha256:aEe(t),absolutePath:oe?`<CONTENT_DIR>`:t},telemetry:{localSink:k,otlpPushEnabled:h()},redaction:j,serverStatus:x,files:le};te(N(_,`manifest.json`),`${JSON.stringify(de,null,2)}\n`);let pe=ce.some(e=>{try{return S(e,`utf-8`).includes(t)}catch{return!1}}),me={totalBytes:ue,fileCount:le.length,docNameCount:A,contentDirVisible:pe,redacted:oe},M=!1;return{stagingDir:_,manifest:de,summary:me,cleanup:()=>{M||(M=!0,D(_,{recursive:!0,force:!0}))}}}catch(e){throw D(_,{recursive:!0,force:!0}),e}}async function hEe(e){let{collected:t,outputPath:n}=e,r=pe(n);if(!g(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new zye.ZipFile,a=Q9(t.stagingDir);for(let e of a){let n=$9(t.stagingDir,e);i.addFile(e,n)}i.end();let o=h(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function gEe(e,t){let n=N(e,`.ok`,`config.yml`);if(g(n))try{let t=(0,on.parse)(S(n,`utf-8`)),r=k7(t)?t.content:void 0,i=k7(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return ve(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return ve(e)}async function _Ee(e,t,n,r){let i=o9(t,e.logger),a=await mEe({contentDir:gEe(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...aTe(i,e.userLogsDir??N(oe(),`.ok`,`logs`)),...c9(e.cachesDir??N(oe(),`Library`,`Caches`))],userStateFiles:l9(e.bugReportsDir??a9()),deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{v(pe(e.outputPath),{recursive:!0}),await hEe({collected:a,outputPath:e.outputPath});let t=a.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:i,files:a.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:a.manifest.createdAt}}}finally{a.cleanup()}}async function vEe(e){let{projectDir:t}=e,n=e.readDesktopEnv??K9,r=e.readLanguage??D9;if(e.level===`full`&&t!==void 0)return _Ee(e,t,n,r);let{zipPath:i,summary:a}=await uTe({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:c9(e.cachesDir??N(oe(),`Library`,`Caches`)),bugReportLedgerFiles:l9(e.bugReportsDir??a9()),logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:i,summary:{level:e.level,systemWide:t===void 0,projectSlug:a.projectSlug,files:a.files,redactions:a.redactions,redactedLineCount:a.redactedLineCount,generatedAt:a.generatedAt}}}export{N5 as ALL_EDITOR_IDS,P5 as EDITOR_LABELS,t7 as EDITOR_TARGETS,pCe as HOSTS_WITH_USER_SKILL_DIR,Jwe as LAUNCH_CONFIG_NAME,ATe as PATH_SHIM_BEGIN,MTe as PATH_SHIM_BLOCK_RE,jTe as PATH_SHIM_END,kwe as addOkPathsToGitExclude,x7 as assertProjectPathSafe,U5 as buildManagedServerEntry,bTe as buildMcpConfigDeclineEvent,xTe as buildMcpConfigMigrateEvent,i9 as classifyExistingMcpEntry,vEe as collectReportBundle,un as createTokenStore,nTe as defaultBugReportZipPath,Be as detectGh,Ue as detectGhAccounts,$we as detectInstalledEditors,DCe as editorConfigPathDisplay,ECe as editorEntryLocator,fTe as ensurePiBridge,R7 as formatTrackedRemediation,Mwe as getExcludedOkPaths,I7 as getInstalledSkillProjectionPaths,Owe as getNativeTomlMcpEditor,F7 as getOkArtifactPaths,V5 as isEntryUpToDate,W5 as isOwnManagedEntry,DTe as loadConfig,fee as makeLazyProbeTokenStore,a9 as okBugReportsDir,C9 as parseGitHubBlobUrl,OTe as parseGitHubShareUrl,w9 as parseGitHubTreeUrl,S9 as parseGitUrl,NTe as pathInstallMarkerPath,swe as previewContent,tTe as probeOwnManagedEditorMcpEntry,dTe as probePiBridgeState,L7 as probeTrackedOkPaths,n9 as readExistingMcpEntry,jwe as readSharingMode,ko as redactContent,Awe as removeOkPathsFromGitExclude,gTe as removeOwnMcpEntry,_we as removeProjectSkill,FTe as removeUserGlobalSkillBundle,pwe as resolveProjectRoot,wTe as runStop,v9 as truncatePriorEntry,E9 as userGlobalSkillBundleTargets,kTe as validateLocalFolderForShare,t9 as writeEditorMcpConfig,RTe as writeProjectAiIntegrations,w7 as writeProjectSkill,Qwe as writeUserMcpConfigs};
1533
1533
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ import"./src-CNuuM8T0.mjs";import{g as e}from"./init-BnAKA1pC.mjs";export{e as runInit};
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{yt as r}from"./sleep-BZCw-NJO.mjs";import{Hs as i,cc as a,ot as o,rt as s,ys as c}from"./src-Dbt5dMPy.mjs";import{Ar as l,Bi as u,La as d,Mi as f,Mr as p,Ni as m,Or as h,_n as g,bi as _,bn as v,d as y,er as b,f as x,fr as S,gn as ee,kr as C,mn as te,p as ne,pn as re,rr as ie,tr as ae,ur as oe,xi as se,yi as ce}from"./src-BRP7ysCx.mjs";import{I as w,P as le}from"./fs-traced-C5AXyho0.mjs";import{C as ue,a as T,d as de,f as fe,i as pe,l as me,n as he,o as ge,s as _e,t as ve,u as ye,x as be,y as xe}from"./resolve-project-root-BGJWrr7S.mjs";import{i as E,n as D,o as O,r as Se,s as k,t as A}from"./colors-DSyAT9Cz.mjs";import{t as Ce}from"./constants-CL8WMjuI.mjs";import{t as j}from"./is-object-Bw0-z8qH.mjs";import{t as we}from"./preview-DOiZrE1T.mjs";import{createRequire as Te}from"node:module";import{execFileSync as Ee}from"node:child_process";import De,{dirname as M,isAbsolute as Oe,join as N,relative as P,resolve as F,sep as ke}from"node:path";import I from"node:process";import{fileURLToPath as Ae}from"node:url";import{existsSync as L,lstatSync as je,mkdirSync as Me,readFileSync as R,readlinkSync as Ne,realpathSync as Pe,statSync as Fe,writeFileSync as Ie}from"node:fs";import{homedir as Le}from"node:os";import*as Re from"node:readline";import{inspect as ze,stripVTControlCharacters as Be,styleText as z}from"node:util";import{AsyncLocalStorage as Ve,AsyncResource as He}from"node:async_hooks";const Ue=new Set([`emacs`,`vim`]);function We(e){return Ue.has(e)}function Ge(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(We))):[]}const B=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,Ke=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,qe=e=>e.name===`space`,Je=e=>e.name===`backspace`,Ye=e=>`1234567890`.includes(e.name),Xe=e=>e.name===`enter`||e.name===`return`;var Ze=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Qe=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},$e=class extends Error{name=`ExitPromptError`},et=class extends Error{name=`HookError`},tt=class extends Error{name=`ValidationError`};const nt=new Ve;function rt(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function it(e,t){let n=rt(e);return nt.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function V(){let e=nt.getStore();if(!e)throw new et(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function at(){return V().rl}function ot(e){return He.bind((...t)=>{let n=V(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function st(e){let t=V(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function ct(){V().handleChange()}const H={queue(e){let t=V(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(at());if(r!=null&&typeof r!=`function`)throw new tt(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=V();ot(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=V();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function lt(e){return typeof e==`function`}function U(e){return st(t=>{let n=He.bind(function(e){t.get()!==e&&(t.set(e),ct())});if(t.initialized)return[t.get(),n];let r=lt(e)?e():e;return t.set(r),[r,n]})}function ut(e,t){st(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&H.queue(e),n.set(t)})}function dt(){return I.platform.startsWith(`win`)?!!I.env.CI||!!I.env.WT_SESSION||!!I.env.TERMINUS_SUBLIME||I.env.ConEmuTask===`{cmd::Cmder}`||I.env.TERM_PROGRAM===`Terminus-Sublime`||I.env.TERM_PROGRAM===`vscode`||I.env.TERM===`xterm-256color`||I.env.TERM===`alacritty`||I.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:I.env.TERM!==`linux`}const ft={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},pt={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},mt={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},ht={...ft,...pt},gt={...ft,...mt},W=dt()?ht:gt;Object.entries(pt);const _t={prefix:{idle:z(`blue`,`?`),done:z(`green`,W.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>z(`yellow`,e))},keybindings:[],style:{answer:e=>z(`cyan`,e),message:e=>z(`bold`,e),error:e=>z(`red`,`> ${e}`),defaultAnswer:e=>z(`dim`,`(${e})`),help:e=>z(`dim`,e),highlight:e=>z(`cyan`,e),key:e=>z(`cyan`,z(`bold`,`<${e}>`))}};function vt(){return{..._t,keybindings:Ge()}}function yt(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function bt(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=yt(n)&&yt(r)?bt(n,r):r}return t}function xt(...e){return bt(vt(),...e.filter(e=>e!=null))}function St({status:e=`idle`,theme:t}){let[n,r]=U(!1),[i,a]=U(0),{prefix:o,spinner:s}=xt(t);return ut(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function Ct(e,t){return st(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function wt(e){return U({current:e})[0]}function Tt(e){let t=wt(e);t.current=e,ut(e=>{let n=!1,r=ot((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var Et=t(n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}))(),1);const Dt=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),Ot=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,kt=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,At=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,jt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Mt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Nt=/\t{1,1000}/y,Pt=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Ft=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,It=/\p{M}+/gu,Lt={limit:1/0,ellipsis:``},Rt=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Rt(i,Lt,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Ft,l],[At,0],[jt,o],[Nt,s],[Pt,c],[Mt,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(It,``)){let t=e.codePointAt(0)||0;if(S=Ot(t)?2:kt(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===Mt?Dt(e.slice(p,n.lastIndex)):n===Pt?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},zt={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Rt(e,zt,t).width,Bt=`]8;;`,Vt=RegExp(`(?:\\[(?<code>\\d+)m|\\${Bt}(?<uri>.*))`,`y`),Ht=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Ut=e=>`[${e}m`,Wt=e=>`${Bt}${e}`,Gt=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(Bt,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Kt=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},qt=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=G(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=G(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Gt(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Gt(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Gt(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Kt(e)));let l=s.join(`
1
+ import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{yt as r}from"./sleep-BZCw-NJO.mjs";import{Hs as i,cc as a,ot as o,rt as s,ys as c}from"./src-CS_k7GF4.mjs";import{Ar as l,Bi as u,La as d,Mi as f,Mr as p,Ni as m,Or as h,_n as g,bi as _,bn as v,d as y,er as b,f as x,fr as S,gn as ee,kr as C,mn as te,p as ne,pn as re,rr as ie,tr as ae,ur as oe,xi as se,yi as ce}from"./src-CNuuM8T0.mjs";import{I as w,P as le}from"./fs-traced-C5AXyho0.mjs";import{C as ue,a as T,d as de,f as fe,i as pe,l as me,n as he,o as ge,s as _e,t as ve,u as ye,x as be,y as xe}from"./resolve-project-root-DCYPHzur.mjs";import{i as E,n as D,o as O,r as Se,s as k,t as A}from"./colors-DSyAT9Cz.mjs";import{t as Ce}from"./constants-CzBR8OPk.mjs";import{t as j}from"./is-object-Bw0-z8qH.mjs";import{t as we}from"./preview-CfABQUF8.mjs";import{createRequire as Te}from"node:module";import{execFileSync as Ee}from"node:child_process";import De,{dirname as M,isAbsolute as Oe,join as N,relative as P,resolve as F,sep as ke}from"node:path";import I from"node:process";import{fileURLToPath as Ae}from"node:url";import{existsSync as L,lstatSync as je,mkdirSync as Me,readFileSync as R,readlinkSync as Ne,realpathSync as Pe,statSync as Fe,writeFileSync as Ie}from"node:fs";import{homedir as Le}from"node:os";import*as Re from"node:readline";import{inspect as ze,stripVTControlCharacters as Be,styleText as z}from"node:util";import{AsyncLocalStorage as Ve,AsyncResource as He}from"node:async_hooks";const Ue=new Set([`emacs`,`vim`]);function We(e){return Ue.has(e)}function Ge(){let e=process.env.INQUIRER_KEYBINDINGS;return e?Array.from(new Set(e.toLowerCase().split(/[\s,]+/).filter(We))):[]}const B=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,Ke=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,qe=e=>e.name===`space`,Je=e=>e.name===`backspace`,Ye=e=>`1234567890`.includes(e.name),Xe=e=>e.name===`enter`||e.name===`return`;var Ze=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Qe=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},$e=class extends Error{name=`ExitPromptError`},et=class extends Error{name=`HookError`},tt=class extends Error{name=`ValidationError`};const nt=new Ve;function rt(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function it(e,t){let n=rt(e);return nt.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function V(){let e=nt.getStore();if(!e)throw new et(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function at(){return V().rl}function ot(e){return He.bind((...t)=>{let n=V(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function st(e){let t=V(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function ct(){V().handleChange()}const H={queue(e){let t=V(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(at());if(r!=null&&typeof r!=`function`)throw new tt(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=V();ot(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=V();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function lt(e){return typeof e==`function`}function U(e){return st(t=>{let n=He.bind(function(e){t.get()!==e&&(t.set(e),ct())});if(t.initialized)return[t.get(),n];let r=lt(e)?e():e;return t.set(r),[r,n]})}function ut(e,t){st(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&H.queue(e),n.set(t)})}function dt(){return I.platform.startsWith(`win`)?!!I.env.CI||!!I.env.WT_SESSION||!!I.env.TERMINUS_SUBLIME||I.env.ConEmuTask===`{cmd::Cmder}`||I.env.TERM_PROGRAM===`Terminus-Sublime`||I.env.TERM_PROGRAM===`vscode`||I.env.TERM===`xterm-256color`||I.env.TERM===`alacritty`||I.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:I.env.TERM!==`linux`}const ft={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},pt={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},mt={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},ht={...ft,...pt},gt={...ft,...mt},W=dt()?ht:gt;Object.entries(pt);const _t={prefix:{idle:z(`blue`,`?`),done:z(`green`,W.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>z(`yellow`,e))},keybindings:[],style:{answer:e=>z(`cyan`,e),message:e=>z(`bold`,e),error:e=>z(`red`,`> ${e}`),defaultAnswer:e=>z(`dim`,`(${e})`),help:e=>z(`dim`,e),highlight:e=>z(`cyan`,e),key:e=>z(`cyan`,z(`bold`,`<${e}>`))}};function vt(){return{..._t,keybindings:Ge()}}function yt(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function bt(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=yt(n)&&yt(r)?bt(n,r):r}return t}function xt(...e){return bt(vt(),...e.filter(e=>e!=null))}function St({status:e=`idle`,theme:t}){let[n,r]=U(!1),[i,a]=U(0),{prefix:o,spinner:s}=xt(t);return ut(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function Ct(e,t){return st(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function wt(e){return U({current:e})[0]}function Tt(e){let t=wt(e);t.current=e,ut(e=>{let n=!1,r=ot((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var Et=t(n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}))(),1);const Dt=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),Ot=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,kt=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,At=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,jt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Mt=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Nt=/\t{1,1000}/y,Pt=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Ft=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,It=/\p{M}+/gu,Lt={limit:1/0,ellipsis:``},Rt=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Rt(i,Lt,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Ft,l],[At,0],[jt,o],[Nt,s],[Pt,c],[Mt,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(It,``)){let t=e.codePointAt(0)||0;if(S=Ot(t)?2:kt(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===Mt?Dt(e.slice(p,n.lastIndex)):n===Pt?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},zt={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Rt(e,zt,t).width,Bt=`]8;;`,Vt=RegExp(`(?:\\[(?<code>\\d+)m|\\${Bt}(?<uri>.*))`,`y`),Ht=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Ut=e=>`[${e}m`,Wt=e=>`${Bt}${e}`,Gt=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(Bt,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Kt=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},qt=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=G(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=G(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Gt(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Gt(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Gt(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Kt(e)));let l=s.join(`
2
2
  `),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===`›`){Vt.lastIndex=e+1;let t=Vt.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
3
3
  `){a&&(r+=Wt(``));let e=i?Ht(i):void 0;i&&e&&(r+=Ut(e))}else t===`
4
4
  `&&(i&&Ht(i)&&(r+=Ut(i)),a&&(r+=Wt(a)))}return r},Jt=/\r?\n/;function Yt(e,t,n){return String(e).normalize().split(Jt).map(e=>qt(e,t,n)).join(`
@@ -635,6 +635,6 @@ export default function okBridge(pi: {
635
635
  `));let p=`${a?``:``}${d}`;return p!==i&&w(e,p,{mode:Y(e)}),{kind:l?`overwritten`:`written`}}const wi=e=>e!==`project`,Ti=e=>e!==`user`;async function Ei(){let e=await er({message:`Where should the MCP server be configured?
636
636
  `,required:!1,theme:{icon:{checked:`[x]`,unchecked:`[ ]`}},choices:[{name:`User-level (~/.claude.json, ~/.cursor/mcp.json, …)`,value:`user`,checked:!0},{name:`Project-level (.mcp.json, .cursor/mcp.json, …)`,value:`project`,checked:!0}]});return e.includes(`user`)&&e.includes(`project`)?`both`:e.includes(`user`)?`user`:e.includes(`project`)?`project`:null}async function Di(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??Ei)():`both`}async function Oi(e){return ar({message:`How do you want to handle OpenKnowledge config files (.ok/, .mcp.json)?`,default:e,choices:[{name:`Share with my team (commit alongside content)`,value:`shared`,description:`OK config gets committed alongside your project content.`},{name:`Local only (keep out of git via .git/info/exclude)`,value:`local-only`,description:"OK config stays on this machine only; teammates do not see it. Safe escape hatch via `ok config-sharing share`."}]})}async function ki(e){if(e.sharing!==void 0)return e.sharing;let t=Pn(e.projectRoot)===`local-only`||e.freshProject===!0?`local-only`:`shared`;return e.isTTY??process.stdout.isTTY?(e.promptFn??Oi)(t):t}var $=class extends Error{constructor(e){super(e),this.name=`ContentDirError`}};function Ai(e){if(e===void 0||e===!0)return new Set(_);if(e===!1)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(se.filter(e=>t.includes(e)))}function ji(e,t,n){let r=F(n,e),i;try{i=Fe(r)}catch(e){let t=e.code;throw t===`ENOENT`?new $(`--content-dir path does not exist: ${r}`):new $(`--content-dir path is not accessible (${t??`unknown error`}): ${r}`)}if(!i.isDirectory())throw new $(`--content-dir must be a directory: ${r}`);let a=P(Mi(t),Mi(r));if(a.startsWith(`..`)||Oe(a))throw new $(`--content-dir must be inside the project root (${t}); got ${r}`);return a===``?`.`:a}function Mi(e){try{return Pe(e)}catch{return e}}const Ni=`open-knowledge-ui`;function Pi(e,t,n){try{return L(e.detectPath?.(t,n)??M(e.configPath(t,n)))}catch{return!1}}function Fi(e,t,n){try{let r=F(M(e.configPath(t,n))),i=F(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+ke)}catch{return!1}}function Ii(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||Fi(e,t,r);if(!i&&s&&!Pi(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{he(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return Ri(e,o,a,n,{isProjectScope:i!==void 0});let c;try{c=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{Me(M(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let l={action:`written`},u;try{le(`${o}.lock`,()=>{let t=Jr(o).writePath;if(Me(M(t),{recursive:!0}),e.format===`toml`){let n=Si(ni(),t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}if(e.format===`yaml`){let n=Ci(t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}let n=xi(t,e.topLevelKey,a,c,e.serverMapSubKey);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){u=e instanceof Error?e:Error(String(e))}return u?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:u.message,...i===void 0?{}:{configScope:`project`}}:l.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:l.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:l.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const Li={pi:Br};function Ri(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=Li[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{Me(M(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{le(`${t}.lock`,()=>{let e=null;try{e=R(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}w(t,c,e===null?void 0:{mode:Y(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}function zi(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}function Bi(e,t,n,r){let i=Hi(e,t,n,r);return i.kind===`present`?i.entry:null}function Vi(e,t,n,r){let i=bi(e,t,r);if(!j(i))return{kind:`no-entry`};let a=i[n];return j(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function Hi(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!L(i))return{kind:`absent`};try{if(Fe(i).size>di)return{kind:`decline`,reason:`oversize`}}catch{return{kind:`decline`,reason:`unparseable`}}let a;try{a=R(i,`utf-8`)}catch{return{kind:`decline`,reason:`unparseable`}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:zr(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=ni().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return Vi(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,J.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:Vi(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=oi(a);return s?si(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:Vi(C(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function Ui(e={}){let t=F(e.cwd??process.cwd()),n=ve(t,{homeDir:e.home}),r=n.projectRoot;if(v(r,e.home??Le()))throw new g(r);let i=!L(N(r,`.ok`)),a=n.gitRootPromoted?P(r,t):void 0,o=e.contentDir===void 0?n.defaultContentDir:ji(e.contentDir,r,t);n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&o===`.`&&process.stderr.write(`${k(`[ok] Content scope promoted to the git repo root: ${r}`)}\n Ran in ${a}/, but .ok/ lives at the git root (one .ok/ per git repo),\n so the whole repo is now the content scope. To narrow it, re-run with\n \`ok init --content-dir .\`, or set content.dir: ${a} in .ok/config.yml.\n`);let s={mode:e.devMcp?`dev`:`published`},l=await ne(r),u;try{u=te(r,{contentDir:o})}catch(t){let i=_e.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:l.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDirRequested:e.contentDir,contentScaffoldFailed:!0,mcpAction:`failed`,mcpPath:i,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`,sharing:{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:!1}}}let d=u.created.includes(Ce),f=!1;if(l.didInit)try{f=ee(r)===`created`}catch(e){console.warn(`[ok] Skipping .gitignore seed at ${r}: ${e instanceof Error?e.message:String(e)}`)}try{re(r)}catch(e){console.warn(`[ok] Skipping project-skill .gitignore entry at ${r}: ${e instanceof Error?e.message:String(e)}`)}let p=await y(r);p.kind===`untracked`&&console.warn(`[ok] Untracked the OpenKnowledge project skill (${p.dirs.join(`, `)}) — it is now local-only. Teammates will see this as a deletion on their next pull.`);let m=await Di({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),h=e.editors??Yi(r,e.home),_=e.editors??h,x=xe(h),C=xe(_),w=e.mcp===!1||m===null,le=Array.from(new Map([...x,...w?[]:C].map(e=>[e.id,e])).values()),ue=x.filter(t=>Pi(t,r,e.home)),T=[],de=[],fe=new Set;for(let t of le){if(w){let n=``;try{n=t.configPath(r,e.home)}catch{}T.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(wi(m)&&x.includes(t)&&t.scope===`global`&&T.push(Ii(t,r,s,e.home)),Ti(m)&&C.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Ii(t,r,s,e.home,n);T.push(i),(i.action===`written`||i.action===`overwritten`)&&fe.add(n)}}let me=new Set;for(let t of C){let n=t.projectSkillPath?.(r);!n||me.has(n)||(me.add(n),de.push(pe(t,r,{home:e.home})))}let he=de.filter(e=>e.action===`written`||e.action===`overwritten`).map(e=>e.editorId);if(he.length>0){let t=e.home??Le();ie({source:c,skills:[ce.project],agents:he,scope:r},{home:t,enabled:S(t).enabled})}let ge=!w&&m!==null&&Ti(m)?C.filter(e=>!e.projectConfigPath&&!e.projectSkillPath).map(e=>e.label):void 0,ye=w?[]:ue.map(e=>zi(e,r)).filter(e=>e!==void 0).filter(e=>!fe.has(e.path)),be=e.installUserSkill??ae,E=e.home??Le(),D=Ai(e.skills),O=!1,Se=!1,A=!1,j=!1,we=!1;for(let t of se){if(!D.has(t))continue;await oe(E,ce[t],!0).catch(()=>{}),O=!0;let n=await be({home:e.home,bundleId:t,force:!0});n===`installed`?Se=!0:n===`failed`?A=!0:n===`no-hosts`?we=!0:j=!0}let Te=A?`failed`:Se?`installed`:O&&j?`skip-current`:O&&we?`no-hosts`:`declined`,Ee=Se?b(E).map(e=>e.editorId):[],De=w?`skipped-flag`:`skipped-missing`,M=T.find(e=>e.editorId===`claude`)??T[0]??{action:De,configPath:_e.claude.configPath(r,e.home)},Oe=await Wi({projectRoot:r,desiredMode:await ki({sharing:e.sharing,projectRoot:r,isTTY:e.isTTY,freshProject:i,promptFn:e.sharingPromptFn}),explicitFlag:e.sharing});return{projectRoot:r,contentCreated:u.created,contentUpdated:u.updated,contentSkipped:u.skipped,editors:T,projectSkills:de,legacyProjectConfigs:ye,skillInstall:Te,skillHosts:Ee,didGitInit:l.didInit,rootGitignoreCreated:f,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDir:d?o:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:M.action,mcpPath:M.configPath,mcpError:`error`in M?M.error:void 0,projectScopeUnsupportedLabels:ge,sharing:Oe}}async function Wi(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=Pn(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=An(t);if(n===`local-only`){let e=Mn(t,a);if(e.kind===`refused-tracked`){let t=e;return{kind:`refused-tracked`,tracked:t.tracked,remediation:t.remediation}}return e.kind===`no-exclude`?{kind:`no-exclude`,reason:e.reason,localOnlyRequested:r===`local-only`}:Gi(t,e,`add`)}if(i===`shared`)return{kind:`applied`,mode:`shared`,action:`noop`,appended:[],alreadyPresent:[],removed:[]};let o=Nn(t,a);return o.kind===`no-exclude`?{kind:`no-exclude`,reason:o.reason,localOnlyRequested:!1}:Gi(t,o,`remove`)}function Gi(e,t,n){let r=Pn(e);return n===`add`?{kind:`applied`,mode:r,action:t.appended.length>0?`added`:t.removed.length>0?`cleaned`:`noop`,appended:t.appended,alreadyPresent:t.alreadyPresent,removed:t.removed}:{kind:`applied`,mode:r,action:`removed`,appended:[],alreadyPresent:[],removed:t.removed}}function Ki(e){switch(e){case`oversize`:return`config too large to edit safely`;case`duplicate-container`:return`duplicate server block`;case`no-native-writer`:return`no format-preserving writer available`;default:return`config not readable`}}function qi(e,t){let n=[],r=e.editors.some(e=>e.action===`written`||e.action===`overwritten`),i=e.editors.some(e=>e.action===`failed`)||e.projectSkills.some(e=>e.action===`failed`),a=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-flag`),o=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-missing`);e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`),e.rootGitignoreCreated&&n.push(`Seeded .gitignore at ${t}/.gitignore (.DS_Store)`);let s=N(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(A(`Content scaffolded at ${s}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(A(`Content already present at ${s}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0)if(n.push(A(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`);else if(a)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(o)n.push(A(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(A(`MCP server configuration:`));for(let r of e.editors){let e=r.configPath.startsWith(t)?P(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),i=r.serverName===`open-knowledge`?``:` (${r.serverName})`,a=r.configScope===`project`?` (project)`:``,o=`${r.label}${a}`,s=` `.repeat(Math.max(1,20-o.length)),c=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${o}${s}${e} ${O(`registered`)}${i}${c}`);break;case`overwritten`:n.push(` ${o}${s}${e} ${O(`updated`)}${i}${c}`);break;case`skipped-missing`:n.push(` ${o}${s}${e} config root missing; skipped`);break;case`failed`:n.push(` ${o}${s}${e} ${Se(`FAILED`)}: ${r.error}`);break;case`declined`:n.push(` ${o}${s}${e} left unchanged (${Ki(r.declineReason)})`);break;case`skipped-flag`:break;default:r.action}}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}}if(e.projectSkills.length>0){n.push(``),n.push(A(`Project-local skills:`));for(let r of e.projectSkills){let e=`${r.label} (project)`,i=` `.repeat(Math.max(1,20-e.length)),a=r.path?P(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${O(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${O(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`skipped-prerequisite`:n.push(` ${e}${i}OpenKnowledge MCP is not configured; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${Se(`FAILED`)}: ${r.error}`);break}}}if(i&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${P(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall)switch(n.push(``),n.push(A(`User-global skill:`)),e.skillInstall){case`installed`:{let t=(e.skillHosts??[]).map(e=>ge[e]??e),r=t.length>0?t.join(`, `):`the shared ~/.agents store`;n.push(` open-knowledge ${O(`installed for ${r}`)}`),n.push(` ${D(`Counted on skills.sh (skill name + source repo, once per machine).`)}`),n.push(` ${D(`Opt out: DO_NOT_TRACK=1, or Settings → User → Preferences.`)}`);break}case`skip-current`:n.push(` open-knowledge ${O(`already installed at current version`)}`);break;case`declined`:n.push(` open-knowledge ${D(`skipped for this run (--no-skills)`)}`),n.push(` ${D(`Nothing was installed or removed. Any built-in skills already on this`)}`),n.push(` ${D(`machine are untouched. Run init without the flag to install them:`)}`),n.push(` ${D(` ok init`)}`);break;case`no-hosts`:n.push(` open-knowledge ${D(`skipped — no supported agent host detected in your home directory`)}`);break;case`failed`:n.push(` ${k(`open-knowledge install failed — MCP still configured; retry with:`)}`),n.push(` ${k(` ok repair-skills`)}`);break}if(e.contentDirRequested!==void 0&&e.contentDir===void 0&&!e.contentScaffoldFailed?(n.push(``),n.push(k(`⚠ --content-dir ${e.contentDirRequested} ignored — .ok/config.yml already exists`)),n.push(` Edit .ok/config.yml → content.dir directly to change the content scope.`)):e.contentDir!==void 0&&e.contentDir!==`.`?(n.push(``),n.push(`Content scope set to ${e.contentDir}/ (content.dir in .ok/config.yml).`)):e.gitRootPromoted&&e.contentDir===`.`&&e.contentDirRequested===void 0&&(n.push(``),n.push(k(`⚠ Content scope promoted to the git repo root`)),n.push(` .ok/ was initialized at ${t} because it contains a .git folder (one .ok/ per git repo),`),n.push(` not the sub-folder you ran \`ok init\` in${e.promotedFromDir?` (${e.promotedFromDir})`:``}. The whole repo is now the content scope.`),e.promotedFromDir&&(n.push(" To scope to just that sub-folder, re-run `ok init --content-dir .` from there, or set"),n.push(` content.dir: ${e.promotedFromDir} in .ok/config.yml.`))),e.preview?(n.push(``),n.push(we(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),n.push(``),n.push(...Qi(e.sharing,t)),r){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${O(`✓`)} ${A(`Next steps:`)}`),n.push(` 1. Open your editor (${E(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${E(`ok seed --list-packs`)} — browse the starter packs`),n.push(` - ${E(`ok seed`)} — scaffold an empty repo`),n.push(` 4. Ask your agent to capture a source, research a topic, or build a wiki —`),n.push(` the procedures ship as skills alongside the MCP tools.`)}return n.join(`
637
637
  `)}function Ji(e,t){return{projectRoot:e.projectRoot,gitRootPromoted:e.gitRootPromoted,promotedFromDir:e.promotedFromDir??null,contentDir:t.contentDir,contentDirRequested:e.contentDirRequested??null,contentDirApplied:e.contentDir!==void 0,contentFileCount:t.contentFileCount,previewError:e.previewWarning??null,didGitInit:e.didGitInit,mcpAction:e.mcpAction,editors:e.editors.map(e=>({editorId:e.editorId,label:e.label,action:e.action,configPath:e.configPath,scope:e.configScope===`project`?`project`:`user`}))}}function Yi(e,t){let n=[];for(let r of T)Pi(_e[r],e,t)&&n.push(r);return n}function Xi(){let e={log:console.log,info:console.info,debug:console.debug},t=(...e)=>{process.stderr.write(`${e.map(e=>typeof e==`string`?e:ze(e)).join(` `)}\n`)};return console.log=t,console.info=t,console.debug=t,()=>{console.log=e.log,console.info=e.info,console.debug=e.debug}}function Zi(){return new be(`init`).description(`Scaffold .ok/ in the current directory and register the MCP server for your editor(s)`).option(`--mcp`,`Register the MCP server for selected editors (default: true)`,!0).option(`--no-mcp`,`Scaffold the .ok/ directory but do not touch MCP config`).option(`--dev-mcp`,`Register a local dev MCP entry using node + packages/cli/dist/cli.mjs with debug logging`).option(`--content-dir <dir>`,`Limit content to <dir> instead of the whole project. <dir> is interpreted relative to your current directory (e.g. "." = the folder you run the command in), then saved to .ok/config.yml as content.dir.`).option(`--json`,`Emit a structured JSON summary to stdout (diagnostics stay on stderr)`).option(`--skills <ids>`,`Install only the named user-global skill bundles (comma list: discovery,write-skill)`).option(`--no-skills`,`Do not install any user-global skill bundles`).addOption(new ue(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new ue(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new ue(`--local-only`,`Keep OK config out of git via .git/info/exclude (per-clone, not committed)`).conflicts(`shared`)).action(async e=>{let t=process.cwd(),n=e.shared?`shared`:e.localOnly?`local-only`:void 0,r=e.json?Xi():null;try{let r;try{r=await Ui({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope,sharing:n,contentDir:e.contentDir,skills:e.skills})}catch(e){if(e instanceof $||e instanceof g){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof f||e instanceof m){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof x){process.stderr.write(`open-knowledge could not initialize a git repo for this project. Re-run, or run 'git init' yourself in the project folder.
638
- `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-BX91sIcm.mjs`),{resolveContentDir:s}=await import(`./src-DqDKpWQW.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-CDuoKWSj.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(Ji(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${qi(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function Qi(e,t){let n=[];switch(e.kind){case`applied`:return n.push(A(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${O(`local-only`)} — appended ${e.appended.length} path(s) to ${A(`${t}/.git/info/exclude`)} (per-clone, not committed).`),e.removed.length>0&&n.push(` cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`)):e.action===`cleaned`?n.push(` ${O(`local-only`)} — already excluded; cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${O(`local-only`)} — already excluded; nothing to do.`):n.push(` ${O(`local-only`)}`):e.action===`removed`?n.push(` ${O(`shared`)} — removed OK paths from ${A(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${O(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(k(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
638
+ `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-Dd9ywqT3.mjs`),{resolveContentDir:s}=await import(`./src-DraT8WdY.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-DDpTCIRk.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(Ji(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${qi(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function Qi(e,t){let n=[];switch(e.kind){case`applied`:return n.push(A(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${O(`local-only`)} — appended ${e.appended.length} path(s) to ${A(`${t}/.git/info/exclude`)} (per-clone, not committed).`),e.removed.length>0&&n.push(` cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`)):e.action===`cleaned`?n.push(` ${O(`local-only`)} — already excluded; cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${O(`local-only`)} — already excluded; nothing to do.`):n.push(` ${O(`local-only`)}`):e.action===`removed`?n.push(` ${O(`shared`)} — removed OK paths from ${A(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${O(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(k(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
639
639
  `))n.push(t.length>0?` ${t}`:``);return n.push(` Re-run ${E(`ok config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(k(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${E(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${E(`ok config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(k(`Sharing mode unavailable: ${e.reason}.`));return n}}export{Fn as A,xt as B,ar as C,Kn as D,Gn as E,Nn as F,Xe as H,Dn as I,hn as L,An as M,In as N,Mn as O,Pn as P,Tt as R,Rr as S,Y as T,U as V,vi as _,Ji as a,ni as b,qi as c,Bi as d,Ai as f,Ui as g,ki as h,Wi as i,jn as j,Ln as k,Qi as l,ji as m,Ni as n,Hi as o,Di as p,Li as r,Yi as s,$ as t,Zi as u,Ii as v,er as w,Br as x,ri as y,St as z};
640
- //# sourceMappingURL=init-aeanAEIJ.mjs.map
640
+ //# sourceMappingURL=init-BnAKA1pC.mjs.map
@@ -1,2 +1,2 @@
1
- import{Mr as e,kr as t}from"./src-BRP7ysCx.mjs";import{I as n}from"./fs-traced-C5AXyho0.mjs";import{D as r,T as i}from"./init-aeanAEIJ.mjs";import{t as a}from"./is-object-Bw0-z8qH.mjs";import{join as o}from"node:path";import{existsSync as s,readFileSync as c}from"node:fs";const l={allowTrailingComma:!0,disallowComments:!1};function u(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function d(a){let d=o(a,`.claude`,`launch.json`);if(!s(d))return{kind:`not-present`};let p;try{p=c(d,`utf-8`)}catch{return{kind:`declined`}}let m=[],h=e(p,m,l)??void 0;if(m.some(e=>!u(e,p))||!h||h.type!==`object`)return{kind:`declined`};let g=t(h).configurations;if(!Array.isArray(g))return{kind:`not-present`};let _=g.findIndex(f);if(_===-1)return{kind:`not-present`};let{text:v,changed:y}=r(p,[`configurations`,_]);return y?(n(d,v,{mode:i(d)}),{kind:`removed`}):{kind:`not-present`}}function f(e){if(!a(e))return!1;let t=e;if(t.name!==`open-knowledge-ui`||!Array.isArray(t.runtimeArgs))return!1;let n=t.runtimeArgs;return t.runtimeExecutable===`/bin/sh`?n.length===3&&n[0]===`-l`&&n[1]===`-c`&&typeof n[2]==`string`&&/^# ok-ui-v[1-9]\d*$/.test(n[2].split(/\r?\n/,1)[0]??``):t.runtimeExecutable===`npx`?p.some(e=>m(n,e)):t.runtimeExecutable===`powershell`&&n.length===4&&n[0]===`-NoProfile`&&n[1]===`-NonInteractive`&&n[2]===`-Command`&&typeof n[3]==`string`&&/^# ok-ui-win-v[1-9]\d*$/.test(n[3].split(/\r?\n/,1)[0]??``)}const p=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function m(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{d as t};
2
- //# sourceMappingURL=launch-json-removal-BFPTw2ut.mjs.map
1
+ import{Mr as e,kr as t}from"./src-CNuuM8T0.mjs";import{I as n}from"./fs-traced-C5AXyho0.mjs";import{D as r,T as i}from"./init-BnAKA1pC.mjs";import{t as a}from"./is-object-Bw0-z8qH.mjs";import{join as o}from"node:path";import{existsSync as s,readFileSync as c}from"node:fs";const l={allowTrailingComma:!0,disallowComments:!1};function u(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function d(a){let d=o(a,`.claude`,`launch.json`);if(!s(d))return{kind:`not-present`};let p;try{p=c(d,`utf-8`)}catch{return{kind:`declined`}}let m=[],h=e(p,m,l)??void 0;if(m.some(e=>!u(e,p))||!h||h.type!==`object`)return{kind:`declined`};let g=t(h).configurations;if(!Array.isArray(g))return{kind:`not-present`};let _=g.findIndex(f);if(_===-1)return{kind:`not-present`};let{text:v,changed:y}=r(p,[`configurations`,_]);return y?(n(d,v,{mode:i(d)}),{kind:`removed`}):{kind:`not-present`}}function f(e){if(!a(e))return!1;let t=e;if(t.name!==`open-knowledge-ui`||!Array.isArray(t.runtimeArgs))return!1;let n=t.runtimeArgs;return t.runtimeExecutable===`/bin/sh`?n.length===3&&n[0]===`-l`&&n[1]===`-c`&&typeof n[2]==`string`&&/^# ok-ui-v[1-9]\d*$/.test(n[2].split(/\r?\n/,1)[0]??``):t.runtimeExecutable===`npx`?p.some(e=>m(n,e)):t.runtimeExecutable===`powershell`&&n.length===4&&n[0]===`-NoProfile`&&n[1]===`-NonInteractive`&&n[2]===`-Command`&&typeof n[3]==`string`&&/^# ok-ui-win-v[1-9]\d*$/.test(n[3].split(/\r?\n/,1)[0]??``)}const p=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function m(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{d as t};
2
+ //# sourceMappingURL=launch-json-removal-BcBDWCAT.mjs.map
@@ -1,2 +1,2 @@
1
- import{g as e,h as t,x as n,y as r,yt as i}from"./sleep-BZCw-NJO.mjs";import{Oc as a,kc as o}from"./src-Dbt5dMPy.mjs";import{b as s}from"./src-BRP7ysCx.mjs";import{A as c,L as l}from"./fs-traced-C5AXyho0.mjs";import{t as u}from"./constants-CL8WMjuI.mjs";import{t as d}from"./is-object-Bw0-z8qH.mjs";import{resolve as f}from"node:path";import{existsSync as p,readFileSync as m}from"node:fs";import{realpath as h}from"node:fs/promises";var g=i();async function _(e){let t=f(e);try{return await h(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}function v(e){if(!p(e))return{value:null,path:e,source:null,doc:null};let t;try{t=m(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,g.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return d(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(e,t){return e.map(e=>{let r=e.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=n({file:t.path,source:t.source,doc:t.doc,path:r});if(e!==void 0)return{...i,source:e}}return i})}function b(n){let i=n??process.cwd(),d=[],p=[],m=[],h=[],g=c(`user`,i),_=l({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&d.push(g);let b=(n,r=!1)=>{let i=v(n);if(i.diagnostic!==void 0&&p.push(i.diagnostic),i.value===null)return{};let a=t({value:i.value,file:i.path,source:i.source,doc:i.doc});p.push(...a),d.push(n);let s=a.length>0?e(i.value):i.value;return r&&h.push(...o({value:s,file:i.path,source:i.source,doc:i.doc})),s},x=f(i,`.ok`,u),S=b(x,!0),C=b(c(`project-local`,i)),w=a(_.value,S,C),T=s.safeParse(w);if(!T.success){let e=v(x),t={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(r(t))}return{config:T.data,sources:d,diagnostics:p,sidelined:m,ignoredCommittedKeys:h}}function x(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=_(e.startupCwd);return async o=>{let s=await _(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,x as t};
2
- //# sourceMappingURL=loader-egUaB2jL.mjs.map
1
+ import{g as e,h as t,x as n,y as r,yt as i}from"./sleep-BZCw-NJO.mjs";import{Oc as a,kc as o}from"./src-CS_k7GF4.mjs";import{b as s}from"./src-CNuuM8T0.mjs";import{A as c,L as l}from"./fs-traced-C5AXyho0.mjs";import{t as u}from"./constants-CzBR8OPk.mjs";import{t as d}from"./is-object-Bw0-z8qH.mjs";import{resolve as f}from"node:path";import{existsSync as p,readFileSync as m}from"node:fs";import{realpath as h}from"node:fs/promises";var g=i();async function _(e){let t=f(e);try{return await h(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}function v(e){if(!p(e))return{value:null,path:e,source:null,doc:null};let t;try{t=m(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,g.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return d(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(e,t){return e.map(e=>{let r=e.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=n({file:t.path,source:t.source,doc:t.doc,path:r});if(e!==void 0)return{...i,source:e}}return i})}function b(n){let i=n??process.cwd(),d=[],p=[],m=[],h=[],g=c(`user`,i),_=l({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&d.push(g);let b=(n,r=!1)=>{let i=v(n);if(i.diagnostic!==void 0&&p.push(i.diagnostic),i.value===null)return{};let a=t({value:i.value,file:i.path,source:i.source,doc:i.doc});p.push(...a),d.push(n);let s=a.length>0?e(i.value):i.value;return r&&h.push(...o({value:s,file:i.path,source:i.source,doc:i.doc})),s},x=f(i,`.ok`,u),S=b(x,!0),C=b(c(`project-local`,i)),w=a(_.value,S,C),T=s.safeParse(w);if(!T.success){let e=v(x),t={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(r(t))}return{config:T.data,sources:d,diagnostics:p,sidelined:m,ignoredCommittedKeys:h}}function x(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=_(e.startupCwd);return async o=>{let s=await _(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,x as t};
2
+ //# sourceMappingURL=loader-DWla98le.mjs.map
@@ -0,0 +1 @@
1
+ import{n as e}from"./loader-DWla98le.mjs";export{e as loadConfig};
@@ -0,0 +1,2 @@
1
+ import{ls as e,ms as t,yo as n}from"./src-CS_k7GF4.mjs";const r=new n({extensions:e,deriveStructuralFreshness:!0}),i=t(e);export{i as n,r as t};
2
+ //# sourceMappingURL=md-manager-CmAEZsv6.mjs.map
@@ -1,2 +1,2 @@
1
- import{Bi as e}from"./src-BRP7ysCx.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}t(process.platform===`darwin`?`open`:process.platform===`win32`?`cmd`:`xdg-open`,process.platform===`win32`?[`/c`,`start`,``,a]:[a],e({}),e=>{e&&console.warn(`Could not auto-open browser (${e.message}); visit ${a} manually`)})}export{a as openBrowser};
2
- //# sourceMappingURL=open-browser-DJSSG7gq.mjs.map
1
+ import{Bi as e}from"./src-CNuuM8T0.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}t(process.platform===`darwin`?`open`:process.platform===`win32`?`cmd`:`xdg-open`,process.platform===`win32`?[`/c`,`start`,``,a]:[a],e({}),e=>{e&&console.warn(`Could not auto-open browser (${e.message}); visit ${a} manually`)})}export{a as openBrowser};
2
+ //# sourceMappingURL=open-browser-B5VbCpAQ.mjs.map