@inkeep/open-knowledge 0.11.0-beta.4 → 0.11.0-beta.6

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 (283) hide show
  1. package/dist/alias-JE7RI5QX-oTDRHt3W.mjs +1 -0
  2. package/dist/assets/skills/discovery/SKILL.md +1 -1
  3. package/dist/assets/skills/project/SKILL.md +1 -1
  4. package/dist/awk2-POPGKRAI-BZ_7e8H1.mjs +1 -0
  5. package/dist/base64-4YMZCVJ5-BhIrz6He.mjs +1 -0
  6. package/dist/basename-AA2KJYZQ-C5R0pcfV.mjs +1 -0
  7. package/dist/bash-IJWYRKFO-DywpGlyx.mjs +1 -0
  8. package/dist/{build-Dt6UA4sF.mjs → build-CJEQ0nGy.mjs} +1 -1
  9. package/dist/build-CZpdADQB.mjs +1 -0
  10. package/dist/cat-RDUMLXKC-BNwer8pK.mjs +1 -0
  11. package/dist/chmod-SYMGL4JA-BN-B1xmG.mjs +1 -0
  12. package/dist/{chunk-24IMIIXA-B6yIPkk2.mjs → chunk-24IMIIXA-C-Zyd2K_.mjs} +2 -2
  13. package/dist/{chunk-3THT3N7L-DztAF386.mjs → chunk-3THT3N7L-Ce6LrnIA.mjs} +1 -1
  14. package/dist/{chunk-44UOCSGV-CaFxJDHm.mjs → chunk-44UOCSGV-uErOrz7G.mjs} +1 -1
  15. package/dist/{chunk-5QMZ5MUS-CAp625aG.mjs → chunk-5QMZ5MUS-BfIuRNkK.mjs} +2 -2
  16. package/dist/{chunk-62RKD26F-CBIDfuTL.mjs → chunk-62RKD26F-CvuML91F.mjs} +2 -2
  17. package/dist/{chunk-A4JSPFCI-v5lUtffG.mjs → chunk-A4JSPFCI-k-tJSZgB.mjs} +2 -2
  18. package/dist/{chunk-A5O5YHGN-DvJz5Cpw.mjs → chunk-A5O5YHGN-C6ngIqYR.mjs} +2 -2
  19. package/dist/{chunk-BBXLRYSX-DHx5dxhT.mjs → chunk-BBXLRYSX-Oks1GMhO.mjs} +2 -2
  20. package/dist/{chunk-BRGMQKJV-CD9YvPOS.mjs → chunk-BRGMQKJV-CHO764qS.mjs} +2 -2
  21. package/dist/{chunk-CR5AFCPT-BWXo8X-o.mjs → chunk-CR5AFCPT-CH8ZGz3B.mjs} +2 -2
  22. package/dist/{chunk-CWQS3NFK-Co4ALolT.mjs → chunk-CWQS3NFK-BP3kiNgH.mjs} +1 -1
  23. package/dist/{chunk-D6CWQ5DW-Cik2LGX1.mjs → chunk-D6CWQ5DW-BgQGt8eQ.mjs} +2 -2
  24. package/dist/{chunk-DXB73IDG-DIKSLkPq.mjs → chunk-DXB73IDG-C2RuFAAY.mjs} +1 -1
  25. package/dist/{chunk-F55TLFGB-oTuag-aK.mjs → chunk-F55TLFGB-Bkfd8ak_.mjs} +2 -2
  26. package/dist/{chunk-FEIOJCZD-C25Und0M.mjs → chunk-FEIOJCZD-DmvuPNqm.mjs} +2 -2
  27. package/dist/{chunk-GFQRA5P5-DnjwTqP3.mjs → chunk-GFQRA5P5-ePq2jelx.mjs} +1 -1
  28. package/dist/{chunk-GOV5EKKI-i-yw_7Ty.mjs → chunk-GOV5EKKI-CyL1eJ32.mjs} +2 -2
  29. package/dist/{chunk-HWBSOZZR-Bw5kf-cE.mjs → chunk-HWBSOZZR-BeVrNfQw.mjs} +2 -2
  30. package/dist/{chunk-I57KEIP3-DwNGEmJW.mjs → chunk-I57KEIP3-5RFY25TO.mjs} +2 -2
  31. package/dist/{chunk-IPJHKYVM-C3IodQq7.mjs → chunk-IPJHKYVM-D6H6ZTtk.mjs} +1 -1
  32. package/dist/{chunk-J642UCRS-DuJ82Ao2.mjs → chunk-J642UCRS-D87gHOLP.mjs} +2 -2
  33. package/dist/{chunk-LPQPILI2-CfDX1Tyv.mjs → chunk-LPQPILI2-DyyhWSR7.mjs} +2 -2
  34. package/dist/{chunk-MDDMCKUK-BrBgeH_z.mjs → chunk-MDDMCKUK-poQ25EjI.mjs} +2 -2
  35. package/dist/{chunk-MIZPJHVH-D3ET6RI_.mjs → chunk-MIZPJHVH-BdoPqh_Y.mjs} +2 -2
  36. package/dist/{chunk-MLXIYONF-dOe6Iqcc.mjs → chunk-MLXIYONF-DwewZM3r.mjs} +2 -2
  37. package/dist/{chunk-NAERJDUW-CYdostkt.mjs → chunk-NAERJDUW-BFcmkHme.mjs} +2 -2
  38. package/dist/{chunk-NUYSJFDK-CU1FKadr.mjs → chunk-NUYSJFDK-DAvAseHr.mjs} +2 -2
  39. package/dist/{chunk-NYQYO467-DUxnOnNG.mjs → chunk-NYQYO467-_2947cgi.mjs} +2 -2
  40. package/dist/{chunk-OARHFVLG-CpUL83N9.mjs → chunk-OARHFVLG-vxL5zuWx.mjs} +2 -2
  41. package/dist/{chunk-OCLXQMOG-LAs82g00.mjs → chunk-OCLXQMOG-C7k2qEN6.mjs} +2 -2
  42. package/dist/{chunk-OCS6LSEM-y5pQiBQp.mjs → chunk-OCS6LSEM-Lh1p0H-V.mjs} +2 -2
  43. package/dist/{chunk-OJDRYQWQ-ikvLWpfV.mjs → chunk-OJDRYQWQ-DWhg7YHU.mjs} +1 -1
  44. package/dist/{chunk-OL3S66CO-DjFShiWt.mjs → chunk-OL3S66CO-B3hSNlNP.mjs} +2 -2
  45. package/dist/{chunk-PBXLG62G-CU755yEQ.mjs → chunk-PBXLG62G-MmAqjdXR.mjs} +2 -2
  46. package/dist/{chunk-R6VWJ2ZL-FwG_Za20.mjs → chunk-R6VWJ2ZL-D1Ufj9fh.mjs} +1 -1
  47. package/dist/{chunk-SYMJJMQ4-tl6Dz6VW.mjs → chunk-SYMJJMQ4-DLPoQaug.mjs} +2 -2
  48. package/dist/{chunk-T56QNPHK-Dzjonwlk.mjs → chunk-T56QNPHK-TppyesRp.mjs} +2 -2
  49. package/dist/{chunk-TLSUDHID-DYvzalvd.mjs → chunk-TLSUDHID-BeulIM_X.mjs} +2 -2
  50. package/dist/{chunk-TOMNU26N-DYqwg_75.mjs → chunk-TOMNU26N-DfLjxpHW.mjs} +2 -2
  51. package/dist/{chunk-UNYNJIFU-B6KF1Gqq.mjs → chunk-UNYNJIFU--HT-3lrq.mjs} +3 -3
  52. package/dist/{chunk-VLGZJRPG-ChVasMna.mjs → chunk-VLGZJRPG-DbWYxLfI.mjs} +2 -2
  53. package/dist/{chunk-XHM67O4N-53eJIPK0.mjs → chunk-XHM67O4N-BWGDFyz_.mjs} +1 -1
  54. package/dist/{chunk-XORM457F-BlSrSdGX.mjs → chunk-XORM457F-D-QrjagQ.mjs} +2 -2
  55. package/dist/{chunk-YCFVLTST-uJkMN44i.mjs → chunk-YCFVLTST-CFJxSbsH.mjs} +2 -2
  56. package/dist/{chunk-YFG2CMIF-DYVCRkoM.mjs → chunk-YFG2CMIF-DkT4NiqV.mjs} +2 -2
  57. package/dist/{chunk-YNYSPYQ5-DesxOVHh.mjs → chunk-YNYSPYQ5-iQGTFdx0.mjs} +1 -1
  58. package/dist/{chunk-YS3AZT3J-DqU1hDNV.mjs → chunk-YS3AZT3J-w6Dw8reo.mjs} +2 -2
  59. package/dist/{chunk-YTNYSM6T-ChSQxUVG.mjs → chunk-YTNYSM6T-Cz_dxkBy.mjs} +2 -2
  60. package/dist/{chunk-Z6LRHWXI-CEAGkbzj.mjs → chunk-Z6LRHWXI-BcgkPhhu.mjs} +2 -2
  61. package/dist/clear-5CZ5X4YR-B6kVcfOw.mjs +1 -0
  62. package/dist/cli.mjs +50 -50
  63. package/dist/column-WLPMMSTS-CEev_e2R.mjs +1 -0
  64. package/dist/comm-5SLSESQG-BXsiD7To.mjs +1 -0
  65. package/dist/constants-DSCKzAUk.mjs +2 -0
  66. package/dist/cp-XOYR4ABJ-Dy5aHk72.mjs +1 -0
  67. package/dist/{curl-47BFPSFW-CseKVLFy.mjs → curl-47BFPSFW-CdMFK7aW.mjs} +2 -2
  68. package/dist/cut-OPC3VAGB-GohHdbJ4.mjs +1 -0
  69. package/dist/date-DD7FVA2V-RM_vdvCh.mjs +1 -0
  70. package/dist/diff-HJF2MPDN-Ci7M3Pfx.mjs +1 -0
  71. package/dist/dirname-LEMTZZFS-C6aDcxLl.mjs +1 -0
  72. package/dist/dist-CHRfgQ3D.mjs +1 -0
  73. package/dist/{dist-D0BxLviK.mjs → dist-DFDll_q5.mjs} +16 -17
  74. package/dist/{dist-bundle-BK4P1EQn.mjs → dist-bundle-B3l-HkEL.mjs} +1 -1
  75. package/dist/dist-bundle-XlngXUNr.mjs +1 -0
  76. package/dist/du-WO2ENHXQ-Da1HuQkH.mjs +1 -0
  77. package/dist/echo-O45JWWI2-Cr9jHdYm.mjs +1 -0
  78. package/dist/env-5EPCWSXR-6RSqo9Bn.mjs +1 -0
  79. package/dist/{esm-s2X3YAg-.mjs → esm-k1YlZnpm.mjs} +1 -1
  80. package/dist/expand-DTNXU4LQ-D4dbwBrD.mjs +1 -0
  81. package/dist/expansion-ENLSRCXJ-Bv6RV19y.mjs +1 -0
  82. package/dist/expr-5T3UU5KE-D7ekHiOy.mjs +1 -0
  83. package/dist/file-ZIGAJ4YS-DzKHvjCj.mjs +1 -0
  84. package/dist/find-TPUOAIUQ-DuBwOGWI.mjs +1 -0
  85. package/dist/{flag-coverage-QT4N2Z44-C7XMLkDY.mjs → flag-coverage-QT4N2Z44-C38ybzz7.mjs} +2 -2
  86. package/dist/fold-LDSORVYE-BQyKAmCr.mjs +1 -0
  87. package/dist/{getMachineId-bsd-BCJXEJCn.mjs → getMachineId-bsd-CzP05Ffc.mjs} +2 -2
  88. package/dist/{getMachineId-bsd-GIcY1fmf.mjs → getMachineId-bsd-D0erQsHH.mjs} +2 -2
  89. package/dist/{getMachineId-bsd-D7C80Q-x.mjs → getMachineId-bsd-Dp2q7huT.mjs} +2 -2
  90. package/dist/{getMachineId-darwin-C9wsuHP1.mjs → getMachineId-darwin-C4PiguA-.mjs} +2 -2
  91. package/dist/{getMachineId-darwin-D9y6ky_l.mjs → getMachineId-darwin-COcA_c6l.mjs} +2 -2
  92. package/dist/{getMachineId-darwin-DG876t7S.mjs → getMachineId-darwin-CywdnyvB.mjs} +2 -2
  93. package/dist/{getMachineId-linux-Bt9mk0EE.mjs → getMachineId-linux-BRPjBsHg.mjs} +2 -2
  94. package/dist/{getMachineId-linux-D9atImpV.mjs → getMachineId-linux-CQZJR55S.mjs} +2 -2
  95. package/dist/{getMachineId-linux-BJESQahL.mjs → getMachineId-linux-DcN5tfI_.mjs} +2 -2
  96. package/dist/{getMachineId-unsupported-Dabs3aBp.mjs → getMachineId-unsupported-BokXsjFr.mjs} +2 -2
  97. package/dist/{getMachineId-unsupported-cApRznzG.mjs → getMachineId-unsupported-DZAxq-oW.mjs} +2 -2
  98. package/dist/{getMachineId-unsupported-DAbsbHrs.mjs → getMachineId-unsupported-GPbM_evk.mjs} +2 -2
  99. package/dist/{getMachineId-win-CU_iAQo9.mjs → getMachineId-win-B20yaCSB.mjs} +2 -2
  100. package/dist/{getMachineId-win-CH98qgwX.mjs → getMachineId-win-BXWDfxLS.mjs} +2 -2
  101. package/dist/{getMachineId-win-1MPHaim9.mjs → getMachineId-win-BfSvDvM7.mjs} +2 -2
  102. package/dist/gh-detect-C3kYac-p.mjs +3 -0
  103. package/dist/{git-handle-BSAUg1L_-Bn2h-fYS.mjs → git-handle-BSAUg1L_-B0dX3OSo.mjs} +1 -1
  104. package/dist/git-handle-CvT4CaVU-BqccGnFS.mjs +1 -0
  105. package/dist/grep-3AIAIJVR-DhLMPK9o.mjs +1 -0
  106. package/dist/gzip-AQXSGOVS-kzAFjO_Y.mjs +1 -0
  107. package/dist/head-HT2B6D2J-BR-dv_ar.mjs +1 -0
  108. package/dist/help-VVWX7SA5-jdvqGfQj.mjs +1 -0
  109. package/dist/history-J4QRNGRO-jb5B-tWQ.mjs +1 -0
  110. package/dist/hostname-BK6HG2DE-CVVAGatl.mjs +1 -0
  111. package/dist/html-to-markdown-TFCECAGV-B5yiu2Qr.mjs +1 -0
  112. package/dist/index.d.mts +12 -1
  113. package/dist/index.mjs +1 -1
  114. package/dist/{init-DRfbG7u0.mjs → init-DOOSSLEH.mjs} +15 -15
  115. package/dist/init-s_zGdaxm.mjs +1 -0
  116. package/dist/join-GG2LDHE5-BLgXAHZ_.mjs +1 -0
  117. package/dist/jq-ODXZBPLY-JpgGenzN.mjs +1 -0
  118. package/dist/{js-exec-M6UR76J5-Cw-W_H_2.mjs → js-exec-M6UR76J5-Bo7dCQVP.mjs} +3 -3
  119. package/dist/{libesm-B_qVEpZ1.mjs → libesm-BXjuRhd9.mjs} +1 -1
  120. package/dist/ln-4TRFBYAT-C7xn5Rqr.mjs +1 -0
  121. package/dist/{loader-Dr74NhT-.mjs → loader-BrdaUVEQ.mjs} +3 -3
  122. package/dist/loader-DePwbagD.mjs +1 -0
  123. package/dist/ls-KSXFZCWH-BFVVAoBi.mjs +1 -0
  124. package/dist/md5sum-INMIK4DX-0GZIz1Ci.mjs +1 -0
  125. package/dist/mkdir-TDEMSB6C-DTyG__G-.mjs +1 -0
  126. package/dist/mv-Z6MORUFL-CmjBk72Q.mjs +1 -0
  127. package/dist/nl-U5YJDM32-5XaxKjVN.mjs +1 -0
  128. package/dist/od-VJEF2UR5-BYZOEzSd.mjs +1 -0
  129. package/dist/paste-7N6AFSDS-BnDgUhuq.mjs +1 -0
  130. package/dist/{preview-WlY5Fo0D.mjs → preview-BHPfi0n1.mjs} +2 -2
  131. package/dist/preview-CQODygq-.mjs +1 -0
  132. package/dist/printf-CX64KX2P-0abCeF-D.mjs +1 -0
  133. package/dist/public/assets/{ActivityModeContent-DYz6rey5.js → ActivityModeContent-A9JVnd1C.js} +1 -1
  134. package/dist/public/assets/{DocumentContext-B4QIWPrL.js → DocumentContext-CmBtR_Ex.js} +1 -1
  135. package/dist/public/assets/{GraphPanel-DFeRGhXy.js → GraphPanel-BvMeDFSM.js} +1 -1
  136. package/dist/public/assets/{SettingsDialogBody-B8ZGJUn1.js → SettingsDialogBody-Dhgc3_Ok.js} +1 -1
  137. package/dist/public/assets/{SourceEditor-_U6sbaL_.js → SourceEditor-D0EQlBRn.js} +1 -1
  138. package/dist/public/assets/{config-validation-events-DOsyw_ZJ.js → config-validation-events-BnNnGv50.js} +1 -1
  139. package/dist/public/assets/{index-BDfLuihf.js → index-BXJoxA8K.js} +4 -4
  140. package/dist/public/assets/{keyboard-shortcuts-Cb78kYel.js → keyboard-shortcuts-DGQUJa57.js} +1 -1
  141. package/dist/public/assets/{prop-types-IdQnEpCT.js → prop-types-z8aPJgr3.js} +155 -153
  142. package/dist/public/assets/{target-navigation-intent-CE2P4fcd.js → target-navigation-intent-BAXnlSRH.js} +1 -1
  143. package/dist/public/assets/{typing-burst-detector-jWK_zqz9.js → typing-burst-detector-DihrFfB5.js} +1 -1
  144. package/dist/public/index.html +7 -7
  145. package/dist/pwd-D4OZ7N27-AYS4A9o1.mjs +1 -0
  146. package/dist/{python3-AUFTPCU6-C02r6EXI.mjs → python3-AUFTPCU6-1PPUn2I7.mjs} +2 -2
  147. package/dist/readlink-MI4GCHJF-BvzND_DT.mjs +1 -0
  148. package/dist/{repair-launch-json-bfPeTjC1.mjs → repair-launch-json-C6PTJ9xk.mjs} +2 -2
  149. package/dist/{repair-mcp-configs-Dv7-MChW.mjs → repair-mcp-configs-1DLQ_aI_.mjs} +2 -2
  150. package/dist/{repair-skills-DYNSfoYx.mjs → repair-skills-CjT8z59t.mjs} +2 -2
  151. package/dist/repair-skills-DIfWiu1E.mjs +1 -0
  152. package/dist/rev-XOSYPP45-Bqdhxuez.mjs +1 -0
  153. package/dist/rg-FOQSCCX3-CrVzsut-.mjs +1 -0
  154. package/dist/rm-RTZG23RL-DVQCHLUL.mjs +1 -0
  155. package/dist/rmdir-XTQXT7RK-DrUUkxCF.mjs +1 -0
  156. package/dist/sed-VFTTATXJ-QHemmbCP.mjs +1 -0
  157. package/dist/seq-RN5ZUASB-BBSGpJq5.mjs +1 -0
  158. package/dist/{server-lock-BpjJj3OD-0F8DEGbQ.mjs → server-lock-BpjJj3OD-vTp6kF0e.mjs} +10 -8
  159. package/dist/server-lock-CyhBidkz-C2yQNfyA.mjs +1 -0
  160. package/dist/sha1sum-VJPNLNU6-D6-7B21n.mjs +1 -0
  161. package/dist/sha256sum-PI32XWXY-BYVtIJOS.mjs +1 -0
  162. package/dist/sleep-VZFPZFWA-C-x_VGtG.mjs +1 -0
  163. package/dist/sort-DCNRDA7U-BTlvuG7X.mjs +1 -0
  164. package/dist/split-SITCSYCZ-BmGbaiMe.mjs +1 -0
  165. package/dist/sqlite3-56UMWEY3-Cjvsy5Oo.mjs +1 -0
  166. package/dist/{src-C_kqzFe0.mjs → src-DPAvJMN5.mjs} +3 -3
  167. package/dist/{start-C2GdC0f6.mjs → start-CQvloGGb.mjs} +2 -2
  168. package/dist/start-DMPvMQIA.mjs +1 -0
  169. package/dist/stat-BT5A227F-BjNsVAze.mjs +1 -0
  170. package/dist/strings-7PLOGTPD-B6_kjNM-.mjs +1 -0
  171. package/dist/tac-SJGXQ4T2-BEQ9sZmi.mjs +1 -0
  172. package/dist/tail-S5ULNTJU-DSe2aEO8.mjs +1 -0
  173. package/dist/tar-ANUBEFJY-HbwMpE1g.mjs +1 -0
  174. package/dist/tee-O7VXZDCO-BD6QXg_b.mjs +1 -0
  175. package/dist/time-DEUO3QV2-CRnH51wk.mjs +1 -0
  176. package/dist/timeout-VRKMCG72-D_oS0IDg.mjs +1 -0
  177. package/dist/touch-DX2IJOQ4-4yR1M9Nd.mjs +1 -0
  178. package/dist/tr-2HXZRDSW-Ca-NmLk7.mjs +1 -0
  179. package/dist/tree-LYXBS7DC-CR3kfmh6.mjs +1 -0
  180. package/dist/true-WHJNXCHG-x85l8vsW.mjs +1 -0
  181. package/dist/unexpand-RGTMIGZM-D-1EwjbB.mjs +1 -0
  182. package/dist/uniq-SUNANL47-DtBj3lmA.mjs +1 -0
  183. package/dist/wc-TQB3VNOX-Qw6WjSl1.mjs +1 -0
  184. package/dist/which-XZHEH76L-B-Xo178d.mjs +1 -0
  185. package/dist/whoami-DGKU3D2X-_Mgzu6ty.mjs +1 -0
  186. package/dist/{write-project-skill-CPYFetL-.mjs → write-project-skill-B4WKDHbQ.mjs} +2 -2
  187. package/dist/xan-BXDXYEIB-qijhj_cA.mjs +1 -0
  188. package/dist/xan-view-ECQUO7AJ-BfZejrY6.mjs +1 -0
  189. package/dist/xargs-I6EZUCYF-aS184J1w.mjs +1 -0
  190. package/dist/{yazl-DjRp4wSy.mjs → yazl-CB0sfSbo.mjs} +1 -1
  191. package/dist/yazl-Dqnhfxk7.mjs +1 -0
  192. package/dist/yq-MJMAR36V-Cgql6fKu.mjs +1 -0
  193. package/package.json +1 -1
  194. package/dist/alias-JE7RI5QX-DvXqsNuT.mjs +0 -1
  195. package/dist/awk2-POPGKRAI-DjdS5H9u.mjs +0 -1
  196. package/dist/base64-4YMZCVJ5-KM4zCU91.mjs +0 -1
  197. package/dist/basename-AA2KJYZQ-623KrTZh.mjs +0 -1
  198. package/dist/bash-IJWYRKFO-Czh-Vt61.mjs +0 -1
  199. package/dist/build-CcnIXJkq.mjs +0 -1
  200. package/dist/cat-RDUMLXKC-BcPFfXNy.mjs +0 -1
  201. package/dist/chmod-SYMGL4JA-DNQ-_FB-.mjs +0 -1
  202. package/dist/clear-5CZ5X4YR-DQDNPZFX.mjs +0 -1
  203. package/dist/column-WLPMMSTS-D7ZdQMYX.mjs +0 -1
  204. package/dist/comm-5SLSESQG-D314YMTX.mjs +0 -1
  205. package/dist/constants-LiLVgWIu.mjs +0 -2
  206. package/dist/cp-XOYR4ABJ-BoeqT96E.mjs +0 -1
  207. package/dist/cut-OPC3VAGB-BduNLBmG.mjs +0 -1
  208. package/dist/date-DD7FVA2V-CXtS-UgC.mjs +0 -1
  209. package/dist/diff-HJF2MPDN-BIBcfzYf.mjs +0 -1
  210. package/dist/dirname-LEMTZZFS-y-nYlas9.mjs +0 -1
  211. package/dist/dist-DDYBq5tf.mjs +0 -1
  212. package/dist/dist-bundle-CjV1Pdeo.mjs +0 -1
  213. package/dist/du-WO2ENHXQ-DxBFDhE9.mjs +0 -1
  214. package/dist/echo-O45JWWI2-D2qFOnG-.mjs +0 -1
  215. package/dist/env-5EPCWSXR-3enSMuUq.mjs +0 -1
  216. package/dist/expand-DTNXU4LQ-ByrWF7LC.mjs +0 -1
  217. package/dist/expansion-ENLSRCXJ-ZEK-CtLJ.mjs +0 -1
  218. package/dist/expr-5T3UU5KE-DslbMHGH.mjs +0 -1
  219. package/dist/file-ZIGAJ4YS-5ydJB32I.mjs +0 -1
  220. package/dist/find-TPUOAIUQ-B-6hQsZ1.mjs +0 -1
  221. package/dist/fold-LDSORVYE-BcrX-J9k.mjs +0 -1
  222. package/dist/gh-detect-DjyibUoa.mjs +0 -3
  223. package/dist/git-handle-CvT4CaVU-HAzuhDq0.mjs +0 -1
  224. package/dist/grep-3AIAIJVR-Gk5ggptS.mjs +0 -1
  225. package/dist/gzip-AQXSGOVS-DVhom50G.mjs +0 -1
  226. package/dist/head-HT2B6D2J-ahSJqSiq.mjs +0 -1
  227. package/dist/help-VVWX7SA5-DWuklTmV.mjs +0 -1
  228. package/dist/history-J4QRNGRO-DF-FzAzf.mjs +0 -1
  229. package/dist/hostname-BK6HG2DE-BduSSI6z.mjs +0 -1
  230. package/dist/html-to-markdown-TFCECAGV-Dyh1D0fg.mjs +0 -1
  231. package/dist/init-CehvDihd.mjs +0 -1
  232. package/dist/join-GG2LDHE5-DbbozPoG.mjs +0 -1
  233. package/dist/jq-ODXZBPLY-DDNFO29H.mjs +0 -1
  234. package/dist/ln-4TRFBYAT-D-c9GUlv.mjs +0 -1
  235. package/dist/loader-CX4fDb28.mjs +0 -1
  236. package/dist/ls-KSXFZCWH-Cpvwn_RB.mjs +0 -1
  237. package/dist/md5sum-INMIK4DX-ysJE_fRH.mjs +0 -1
  238. package/dist/mkdir-TDEMSB6C-Doj-uc1V.mjs +0 -1
  239. package/dist/mv-Z6MORUFL-CB3JJwR7.mjs +0 -1
  240. package/dist/nl-U5YJDM32-DNpHPr0D.mjs +0 -1
  241. package/dist/od-VJEF2UR5-CU4HUmLC.mjs +0 -1
  242. package/dist/paste-7N6AFSDS-CRLhW5JD.mjs +0 -1
  243. package/dist/preview-b3CbdBUE.mjs +0 -1
  244. package/dist/printf-CX64KX2P-BRDA91sv.mjs +0 -1
  245. package/dist/pwd-D4OZ7N27-DOBMwDAQ.mjs +0 -1
  246. package/dist/readlink-MI4GCHJF-C7jxdmka.mjs +0 -1
  247. package/dist/repair-skills-C9qAyzit.mjs +0 -1
  248. package/dist/rev-XOSYPP45-BrzxRIO9.mjs +0 -1
  249. package/dist/rg-FOQSCCX3-D0ctWk6O.mjs +0 -1
  250. package/dist/rm-RTZG23RL-DZt78fCD.mjs +0 -1
  251. package/dist/rmdir-XTQXT7RK-CJJKrOdm.mjs +0 -1
  252. package/dist/sed-VFTTATXJ-Cv8KiT35.mjs +0 -1
  253. package/dist/seq-RN5ZUASB-BD6p5vId.mjs +0 -1
  254. package/dist/server-lock-CyhBidkz-DRsKQAKO.mjs +0 -1
  255. package/dist/sha1sum-VJPNLNU6-DukJfnER.mjs +0 -1
  256. package/dist/sha256sum-PI32XWXY-QlLE_NGo.mjs +0 -1
  257. package/dist/sleep-VZFPZFWA-gwZmptDS.mjs +0 -1
  258. package/dist/sort-DCNRDA7U-Bnmzizlk.mjs +0 -1
  259. package/dist/split-SITCSYCZ-NsOC8k0n.mjs +0 -1
  260. package/dist/sqlite3-56UMWEY3-URg2-QXI.mjs +0 -1
  261. package/dist/start-Cuu2M83v.mjs +0 -1
  262. package/dist/stat-BT5A227F-Di81wqB8.mjs +0 -1
  263. package/dist/strings-7PLOGTPD-DKTG3t3M.mjs +0 -1
  264. package/dist/tac-SJGXQ4T2-CMuGqDl5.mjs +0 -1
  265. package/dist/tail-S5ULNTJU-CxhswWhX.mjs +0 -1
  266. package/dist/tar-ANUBEFJY-BBFrIW8E.mjs +0 -1
  267. package/dist/tee-O7VXZDCO-DwJ0hUpW.mjs +0 -1
  268. package/dist/time-DEUO3QV2-W5vzutuD.mjs +0 -1
  269. package/dist/timeout-VRKMCG72-wW3XOtt7.mjs +0 -1
  270. package/dist/touch-DX2IJOQ4-C7eGjNGd.mjs +0 -1
  271. package/dist/tr-2HXZRDSW-DlafN6SW.mjs +0 -1
  272. package/dist/tree-LYXBS7DC-Ou8JkGQ1.mjs +0 -1
  273. package/dist/true-WHJNXCHG-B4B4ZHqp.mjs +0 -1
  274. package/dist/unexpand-RGTMIGZM-D6xZmTWp.mjs +0 -1
  275. package/dist/uniq-SUNANL47-Ce9L4IzE.mjs +0 -1
  276. package/dist/wc-TQB3VNOX-dwG38U4n.mjs +0 -1
  277. package/dist/which-XZHEH76L-Cw9SQliE.mjs +0 -1
  278. package/dist/whoami-DGKU3D2X-hzRI9gvz.mjs +0 -1
  279. package/dist/xan-BXDXYEIB-loWv9Mk3.mjs +0 -1
  280. package/dist/xan-view-ECQUO7AJ-8Lt55NoE.mjs +0 -1
  281. package/dist/xargs-I6EZUCYF-CG6axhMW.mjs +0 -1
  282. package/dist/yazl-CJayzk0b.mjs +0 -1
  283. package/dist/yq-MJMAR36V-CsEAtdgj.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,r as n,t as r}from"./chunk-FK9Q3tQk.mjs";import{c as i,n as a,r as o}from"./esm-s2X3YAg-.mjs";import{closeSync as s,existsSync as c,mkdirSync as l,openSync as u,readFileSync as d,unlinkSync as f,writeFileSync as p,writeSync as m}from"node:fs";import h,{dirname as g,resolve as _}from"node:path";import v from"node:process";import{hostname as y}from"node:os";import{fileURLToPath as b,fileURLToPath as x}from"node:url";var S=r((e=>{let t=Symbol.for(`yaml.alias`),n=Symbol.for(`yaml.document`),r=Symbol.for(`yaml.map`),i=Symbol.for(`yaml.pair`),a=Symbol.for(`yaml.scalar`),o=Symbol.for(`yaml.seq`),s=Symbol.for(`yaml.node.type`),c=e=>!!e&&typeof e==`object`&&e[s]===t,l=e=>!!e&&typeof e==`object`&&e[s]===n,u=e=>!!e&&typeof e==`object`&&e[s]===r,d=e=>!!e&&typeof e==`object`&&e[s]===i,f=e=>!!e&&typeof e==`object`&&e[s]===a,p=e=>!!e&&typeof e==`object`&&e[s]===o;function m(e){if(e&&typeof e==`object`)switch(e[s]){case r:case o:return!0}return!1}function h(e){if(e&&typeof e==`object`)switch(e[s]){case t:case r:case a:case o:return!0}return!1}e.ALIAS=t,e.DOC=n,e.MAP=r,e.NODE_TYPE=s,e.PAIR=i,e.SCALAR=a,e.SEQ=o,e.hasAnchor=e=>(f(e)||m(e))&&!!e.anchor,e.isAlias=c,e.isCollection=m,e.isDocument=l,e.isMap=u,e.isNode=h,e.isPair=d,e.isScalar=f,e.isSeq=p})),C=r((e=>{var t=S();let n=Symbol(`break visit`),r=Symbol(`skip children`),i=Symbol(`remove node`);function a(e,n){let r=l(n);t.isDocument(e)?o(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):o(null,e,r,Object.freeze([]))}a.BREAK=n,a.SKIP=r,a.REMOVE=i;function o(e,r,a,s){let c=u(e,r,a,s);if(t.isNode(c)||t.isPair(c))return d(e,s,c),o(e,c,a,s);if(typeof c!=`symbol`){if(t.isCollection(r)){s=Object.freeze(s.concat(r));for(let e=0;e<r.items.length;++e){let t=o(e,r.items[e],a,s);if(typeof t==`number`)e=t-1;else if(t===n)return n;else t===i&&(r.items.splice(e,1),--e)}}else if(t.isPair(r)){s=Object.freeze(s.concat(r));let e=o(`key`,r.key,a,s);if(e===n)return n;e===i&&(r.key=null);let t=o(`value`,r.value,a,s);if(t===n)return n;t===i&&(r.value=null)}}return c}async function s(e,n){let r=l(n);t.isDocument(e)?await c(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):await c(null,e,r,Object.freeze([]))}s.BREAK=n,s.SKIP=r,s.REMOVE=i;async function c(e,r,a,o){let s=await u(e,r,a,o);if(t.isNode(s)||t.isPair(s))return d(e,o,s),c(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e<r.items.length;++e){let t=await c(e,r.items[e],a,o);if(typeof t==`number`)e=t-1;else if(t===n)return n;else t===i&&(r.items.splice(e,1),--e)}}else if(t.isPair(r)){o=Object.freeze(o.concat(r));let e=await c(`key`,r.key,a,o);if(e===n)return n;e===i&&(r.key=null);let t=await c(`value`,r.value,a,o);if(t===n)return n;t===i&&(r.value=null)}}return s}function l(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function u(e,n,r,i){if(typeof r==`function`)return r(e,n,i);if(t.isMap(n))return r.Map?.(e,n,i);if(t.isSeq(n))return r.Seq?.(e,n,i);if(t.isPair(n))return r.Pair?.(e,n,i);if(t.isScalar(n))return r.Scalar?.(e,n,i);if(t.isAlias(n))return r.Alias?.(e,n,i)}function d(e,n,r){let i=n[n.length-1];if(t.isCollection(i))i.items[e]=r;else if(t.isPair(i))e===`key`?i.key=r:i.value=r;else if(t.isDocument(i))i.contents=r;else{let e=t.isAlias(i)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}e.visit=a,e.visitAsync=s})),w=r((e=>{var t=S(),n=C();let r={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},i=e=>e.replace(/[!,[\]{}]/g,e=>r[e]);var a=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+i(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],i=Object.entries(this.tags),a;if(e&&i.length>0&&t.isNode(e.contents)){let r={};n.visit(e.contents,(e,n)=>{t.isNode(n)&&n.tag&&(r[n.tag]=!0)}),a=Object.keys(r)}else a=[];for(let[t,n]of i)t===`!!`&&n===`tag:yaml.org,2002:`||(!e||a.some(e=>e.startsWith(n)))&&r.push(`%TAG ${t} ${n}`);return r.join(`
1
+ import{i as e,o as t,r as n,t as r}from"./chunk-FK9Q3tQk.mjs";import{c as i,n as a,r as o}from"./esm-k1YlZnpm.mjs";import{closeSync as s,existsSync as c,mkdirSync as l,openSync as u,readFileSync as d,unlinkSync as f,writeFileSync as p,writeSync as m}from"node:fs";import h,{dirname as g,resolve as _}from"node:path";import v from"node:process";import{hostname as y}from"node:os";import{fileURLToPath as b,fileURLToPath as x}from"node:url";var S=r((e=>{let t=Symbol.for(`yaml.alias`),n=Symbol.for(`yaml.document`),r=Symbol.for(`yaml.map`),i=Symbol.for(`yaml.pair`),a=Symbol.for(`yaml.scalar`),o=Symbol.for(`yaml.seq`),s=Symbol.for(`yaml.node.type`),c=e=>!!e&&typeof e==`object`&&e[s]===t,l=e=>!!e&&typeof e==`object`&&e[s]===n,u=e=>!!e&&typeof e==`object`&&e[s]===r,d=e=>!!e&&typeof e==`object`&&e[s]===i,f=e=>!!e&&typeof e==`object`&&e[s]===a,p=e=>!!e&&typeof e==`object`&&e[s]===o;function m(e){if(e&&typeof e==`object`)switch(e[s]){case r:case o:return!0}return!1}function h(e){if(e&&typeof e==`object`)switch(e[s]){case t:case r:case a:case o:return!0}return!1}e.ALIAS=t,e.DOC=n,e.MAP=r,e.NODE_TYPE=s,e.PAIR=i,e.SCALAR=a,e.SEQ=o,e.hasAnchor=e=>(f(e)||m(e))&&!!e.anchor,e.isAlias=c,e.isCollection=m,e.isDocument=l,e.isMap=u,e.isNode=h,e.isPair=d,e.isScalar=f,e.isSeq=p})),C=r((e=>{var t=S();let n=Symbol(`break visit`),r=Symbol(`skip children`),i=Symbol(`remove node`);function a(e,n){let r=l(n);t.isDocument(e)?o(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):o(null,e,r,Object.freeze([]))}a.BREAK=n,a.SKIP=r,a.REMOVE=i;function o(e,r,a,s){let c=u(e,r,a,s);if(t.isNode(c)||t.isPair(c))return d(e,s,c),o(e,c,a,s);if(typeof c!=`symbol`){if(t.isCollection(r)){s=Object.freeze(s.concat(r));for(let e=0;e<r.items.length;++e){let t=o(e,r.items[e],a,s);if(typeof t==`number`)e=t-1;else if(t===n)return n;else t===i&&(r.items.splice(e,1),--e)}}else if(t.isPair(r)){s=Object.freeze(s.concat(r));let e=o(`key`,r.key,a,s);if(e===n)return n;e===i&&(r.key=null);let t=o(`value`,r.value,a,s);if(t===n)return n;t===i&&(r.value=null)}}return c}async function s(e,n){let r=l(n);t.isDocument(e)?await c(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):await c(null,e,r,Object.freeze([]))}s.BREAK=n,s.SKIP=r,s.REMOVE=i;async function c(e,r,a,o){let s=await u(e,r,a,o);if(t.isNode(s)||t.isPair(s))return d(e,o,s),c(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e<r.items.length;++e){let t=await c(e,r.items[e],a,o);if(typeof t==`number`)e=t-1;else if(t===n)return n;else t===i&&(r.items.splice(e,1),--e)}}else if(t.isPair(r)){o=Object.freeze(o.concat(r));let e=await c(`key`,r.key,a,o);if(e===n)return n;e===i&&(r.key=null);let t=await c(`value`,r.value,a,o);if(t===n)return n;t===i&&(r.value=null)}}return s}function l(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function u(e,n,r,i){if(typeof r==`function`)return r(e,n,i);if(t.isMap(n))return r.Map?.(e,n,i);if(t.isSeq(n))return r.Seq?.(e,n,i);if(t.isPair(n))return r.Pair?.(e,n,i);if(t.isScalar(n))return r.Scalar?.(e,n,i);if(t.isAlias(n))return r.Alias?.(e,n,i)}function d(e,n,r){let i=n[n.length-1];if(t.isCollection(i))i.items[e]=r;else if(t.isPair(i))e===`key`?i.key=r:i.value=r;else if(t.isDocument(i))i.contents=r;else{let e=t.isAlias(i)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}e.visit=a,e.visitAsync=s})),w=r((e=>{var t=S(),n=C();let r={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},i=e=>e.replace(/[!,[\]{}]/g,e=>r[e]);var a=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+i(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],i=Object.entries(this.tags),a;if(e&&i.length>0&&t.isNode(e.contents)){let r={};n.visit(e.contents,(e,n)=>{t.isNode(n)&&n.tag&&(r[n.tag]=!0)}),a=Object.keys(r)}else a=[];for(let[t,n]of i)t===`!!`&&n===`tag:yaml.org,2002:`||(!e||a.some(e=>e.startsWith(n)))&&r.push(`%TAG ${t} ${n}`);return r.join(`
2
2
  `)}};a.defaultYaml={explicit:!1,version:`1.2`},a.defaultTags={"!!":`tag:yaml.org,2002:`},e.Directives=a})),T=r((e=>{var t=S(),n=C();function r(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function i(e){let t=new Set;return n.visit(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function a(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function o(e,n){let r=[],o=new Map,s=null;return{onAnchor:t=>{r.push(t),s??=i(e);let o=a(n,s);return s.add(o),o},setAnchors:()=>{for(let e of r){let n=o.get(e);if(typeof n==`object`&&n.anchor&&(t.isScalar(n.node)||t.isCollection(n.node)))n.node.anchor=n.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:o}}e.anchorIsValid=r,e.anchorNames=i,e.createNodeAnchors=o,e.findNewAnchor=a})),E=r((e=>{function t(e,n,r,i){if(i&&typeof i==`object`)if(Array.isArray(i))for(let n=0,r=i.length;n<r;++n){let r=i[n],a=t(e,i,String(n),r);a===void 0?delete i[n]:a!==r&&(i[n]=a)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let r=i.get(n),a=t(e,i,n,r);a===void 0?i.delete(n):a!==r&&i.set(n,a)}else if(i instanceof Set)for(let n of Array.from(i)){let r=t(e,i,n,n);r===void 0?i.delete(n):r!==n&&(i.delete(n),i.add(r))}else for(let[n,r]of Object.entries(i)){let a=t(e,i,n,r);a===void 0?delete i[n]:a!==r&&(i[n]=a)}return e.call(n,r,i)}e.applyReviver=t})),ee=r((e=>{var t=S();function n(e,r,i){if(Array.isArray(e))return e.map((e,t)=>n(e,String(t),i));if(e&&typeof e.toJSON==`function`){if(!i||!t.hasAnchor(e))return e.toJSON(r,i);let n={aliasCount:0,count:1,res:void 0};i.anchors.set(e,n),i.onCreate=e=>{n.res=e,delete i.onCreate};let a=e.toJSON(r,i);return i.onCreate&&i.onCreate(a),a}return typeof e==`bigint`&&!i?.keep?Number(e):e}e.toJS=n})),te=r((e=>{var t=E(),n=S(),r=ee();e.NodeBase=class{constructor(e){Object.defineProperty(this,n.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:a,onAnchor:o,reviver:s}={}){if(!n.isDocument(e))throw TypeError(`A document argument is required`);let c={anchors:new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof a==`number`?a:100},l=r.toJS(this,``,c);if(typeof o==`function`)for(let{count:e,res:t}of c.anchors.values())o(t,e);return typeof s==`function`?t.applyReviver(s,{"":l},``,l):l}}})),ne=r((e=>{var t=T(),n=C(),r=S(),i=te(),a=ee(),o=class extends i.NodeBase{constructor(e){super(r.ALIAS),this.source=e,Object.defineProperty(this,`tag`,{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],n.visit(e,{Node:(e,t)=>{(r.isAlias(t)||r.hasAnchor(t))&&i.push(t)}}),t&&(t.aliasResolveCache=i));let a;for(let e of i){if(e===this)break;e.anchor===this.source&&(a=e)}return a}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,o=this.resolve(r,t);if(!o){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let c=n.get(o);if(c||=(a.toJS(o,null,t),n.get(o)),c?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(c.count+=1,c.aliasCount===0&&(c.aliasCount=s(r,o,n)),c.count*c.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return c.res}toString(e,n,r){let i=`*${this.source}`;if(e){if(t.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${i} `}return i}};function s(e,t,n){if(r.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(r.isCollection(t)){let r=0;for(let i of t.items){let t=s(e,i,n);t>r&&(r=t)}return r}else if(r.isPair(t)){let r=s(e,t.key,n),i=s(e,t.value,n);return Math.max(r,i)}return 1}e.Alias=o})),re=r((e=>{var t=S(),n=te(),r=ee();let i=e=>!e||typeof e!=`function`&&typeof e!=`object`;var a=class extends n.NodeBase{constructor(e){super(t.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:r.toJS(this.value,e,t)}toString(){return String(this.value)}};a.BLOCK_FOLDED=`BLOCK_FOLDED`,a.BLOCK_LITERAL=`BLOCK_LITERAL`,a.PLAIN=`PLAIN`,a.QUOTE_DOUBLE=`QUOTE_DOUBLE`,a.QUOTE_SINGLE=`QUOTE_SINGLE`,e.Scalar=a,e.isScalarValue=i})),ie=r((e=>{var t=ne(),n=S(),r=re();function i(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function a(e,a,o){if(n.isDocument(e)&&(e=e.contents),n.isNode(e))return e;if(n.isPair(e)){let t=o.schema[n.MAP].createNode?.(o.schema,null,o);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:s,onAnchor:c,onTagObj:l,schema:u,sourceObjects:d}=o,f;if(s&&e&&typeof e==`object`){if(f=d.get(e),f)return f.anchor??=c(e),new t.Alias(f.anchor);f={anchor:null,node:null},d.set(e,f)}a?.startsWith(`!!`)&&(a=`tag:yaml.org,2002:`+a.slice(2));let p=i(e,a,u.tags);if(!p){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new r.Scalar(e);return f&&(f.node=t),t}p=e instanceof Map?u[n.MAP]:Symbol.iterator in Object(e)?u[n.SEQ]:u[n.MAP]}l&&(l(p),delete o.onTagObj);let m=p?.createNode?p.createNode(o.schema,e,o):typeof p?.nodeClass?.from==`function`?p.nodeClass.from(o.schema,e,o):new r.Scalar(e);return a?m.tag=a:p.default||(m.tag=p.tag),f&&(f.node=m),m}e.createNode=a})),ae=r((e=>{var t=ie(),n=S(),r=te();function i(e,n,r){let i=r;for(let e=n.length-1;e>=0;--e){let t=n[e];if(typeof t==`number`&&Number.isInteger(t)&&t>=0){let e=[];e[t]=i,i=e}else i=new Map([[t,i]])}return t.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}let a=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;e.Collection=class extends r.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,`schema`,{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>n.isNode(t)||n.isPair(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(a(e))this.add(t);else{let[r,...a]=e,o=this.get(r,!0);if(n.isCollection(o))o.addIn(a,t);else if(o===void 0&&this.schema)this.set(r,i(this.schema,a,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${a}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let i=this.get(t,!0);if(n.isCollection(i))return i.deleteIn(r);throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...i]=e,a=this.get(r,!0);return i.length===0?!t&&n.isScalar(a)?a.value:a:n.isCollection(a)?a.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!n.isPair(t))return!1;let r=t.value;return r==null||e&&n.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let i=this.get(t,!0);return n.isCollection(i)?i.hasIn(r):!1}setIn(e,t){let[r,...a]=e;if(a.length===0)this.set(r,t);else{let e=this.get(r,!0);if(n.isCollection(e))e.setIn(a,t);else if(e===void 0&&this.schema)this.set(r,i(this.schema,a,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${a}`)}}},e.collectionFromPath=i,e.isEmptyPath=a})),oe=r((e=>{let t=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function n(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}e.indentComment=n,e.lineComment=(e,t,r)=>e.endsWith(`
3
3
  `)?n(r,t):r.includes(`
4
4
  `)?`
@@ -407,9 +407,11 @@ $2`).split(`
407
407
  `),c=(s===-1?o:o.slice(0,s)).trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`),l=[];for(let e of c){let t=e.match(/-/g);l.push(t?t.length:0)}l.some(e=>e>0)&&(e.data.sourceDashCounts=l);for(let n of e.children??[]){if(n.type!==`tableRow`||!n.position)continue;let e=n.position.start.offset,r=n.position.end.offset;if(typeof e!=`number`||typeof r!=`number`)continue;let i=t.slice(e,r),a=i.indexOf(`
408
408
  `);a!==-1&&(i=i.slice(0,a));let o=HX(i);o.length>0&&o[0]===``&&i.startsWith(`|`)&&o.shift(),o.length>0&&o[o.length-1]===``&&i.endsWith(`|`)&&o.pop();let s=n.children??[],c=Math.min(s.length,o.length);for(let e=0;e<c;e++){let t=s[e];if(t.type!==`tableCell`)continue;let n=o[e],r=0;for(;r<n.length&&n[r]===` `;)r++;let i=0;for(;i<n.length-r&&n[n.length-1-i]===` `;)i++;t.data||={},t.data.sourcePadding={left:r,right:i}}}break}case`link`:case`linkReference`:if(`children`in e&&e.children.length===0&&(e.data.sourceRaw=t.slice(i,a)),e.type===`link`){let n=t[i];if(n!==`[`&&n!==`<`&&!e.title)e.data.sourceStyle=`gfm-autolink`;else if(n===`[`){let n=t.slice(i,a),r=n.lastIndexOf(`](`);if(r!==-1){let t=r+2;for(;t<n.length&&(n[t]===` `||n[t]===` `);)t++;if(n[t]===`<`&&(e.data.sourceUrlForm=`angle-bracketed`),e.title!==void 0&&e.title!==null&&n[n.length-1]===`)`){let t=n.length-2;for(;t>r+1&&(n[t]===` `||n[t]===` `||n[t]===`
409
409
  `);)t--;n[t]===`"`?e.data.sourceTitleMarker=`double`:n[t]===`'`?e.data.sourceTitleMarker=`single`:n[t]===`)`&&(e.data.sourceTitleMarker=`paren`)}}}}break;case`definition`:{let n=t.slice(i,a);if(e.data.sourceLayout=n.includes(`
410
- `)?`multiline`:`inline`,typeof e.title==`string`&&n.length>0){let t=n[n.length-1];t===`"`?e.data.sourceTitleMarker=`double`:t===`'`?e.data.sourceTitleMarker=`single`:t===`)`&&(e.data.sourceTitleMarker=`paren`)}break}case`mdxJsxFlowElement`:case`mdxJsxTextElement`:case`mdxFlowExpression`:case`mdxTextExpression`:e.data.sourceRaw=t.slice(i,a);break;case`break`:t.slice(i,a).includes(`\\`)?e.data.sourceStyle=`backslash`:e.data.sourceStyle=`spaces`;break}}function WX(){return RegExp(`(^|\\s)#([a-zA-Z][\\w/-]*)`,`g`)}const GX=WX();function KX(e,t){if(t<=0||e[t-1]!==`\\`)return!1;let n=t-1,r=0;for(;n>=0&&e[n]===`\\`;)r++,n--;return r%2==1}function qX(e,t=``){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value,a=typeof i.position?.start?.offset==`number`?i.position?.start?.offset??0:0;GX.lastIndex=0;let o=[],s=0;for(;;){let n=GX.exec(e);if(n===null)break;let i=n[1]??``,c=n[2]??``,l=n.index+i.length;if(t&&a>=0){let n=a,r=0,i=-1;for(;r<=l&&n<t.length;){let a=t[n]===`\\`&&n+1<t.length&&e[r]===t[n+1],o=a?n+1:n;if(r===l){i=o;break}n=a?n+2:n+1,r+=1}if(i>=0&&KX(t,i))continue}l>s&&o.push({type:`text`,value:e.slice(s,l)});let u={type:`tag`,value:c};o.push(u),s=l+1+c.length,r=!0}o.length===0?n.push(i):(s<e.length&&o.push({type:`text`,value:e.slice(s)}),n.push(...o))}r&&(e.children=n)}const JX=new Set(`root.paragraph.heading.text.emphasis.strong.blockquote.list.listItem.code.inlineCode.link.image.linkReference.imageReference.definition.html.thematicBreak.break.yaml.toml.table.tableRow.tableCell.delete.footnoteDefinition.footnoteReference.mdxFlowExpression.mdxJsxFlowElement.mdxJsxTextElement.mdxTextExpression.wikiLink.wikiLinkEmbed.tag.math.inlineMath.mark.comment.commentBlock.rawMdxFallbackMdast`.split(`.`));function YX(e,t){let n=e.position?.start?.offset??0,r=e.position?.end?.offset??0,i=r>n?t.slice(n,r):``;return{type:`rawMdxFallbackMdast`,originalType:e.type??`unknown`,value:i||(e.type??`unknown`),position:e.position}}function XX(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;BX(e,t);let r=typeof process<`u`&&process.env?.OK_DEBUG_POSITION_SLICE===`1`;Tj(e,(e,t,i)=>{if(i!==void 0&&typeof t==`number`&&typeof e.type==`string`&&!JX.has(e.type)){let r=YX(e,n);return i.children[t]=r,Sj}if(`children`in e&&Array.isArray(e.children)){let t=e;t.children.some(e=>e.type===`text`)&&(zX(t),qX(t,n))}if(UX(e,n,r),e.type===`heading`&&i!==void 0&&typeof t==`number`&&e.data?.sourceStyle===`setext`){let n=e.position?.end?.line,r=i.children[t+1],a=r?.position?.start?.line;if(r?.type===`paragraph`&&typeof n==`number`&&typeof a==`number`&&a===n+1){let t=e;t.data??={},t.data.sourceContiguousNext=!0}}})}}function ZX(e,t){let n={type:`mdxJsxFlowElement`,name:`MermaidFence`,attributes:[{type:`mdxJsxAttribute`,name:`chart`,value:e}],children:[]};return t&&(n.position=t),n}function QX(){return e=>{Tj(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`mermaid`)return;let r=ZX(typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}function $X(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const eZ=(e,t)=>{if($X(e,t))return 0;let n=e.position,r=t.position;if(!n||!r)return;let i=r.start.line-n.end.line-1;return i>=1?i:void 0},tZ=VB(),nZ=aB(),rZ=oB();function iZ(){let e=this.data();e.micromarkExtensions||=[],e.fromMarkdownExtensions||=[],e.toMarkdownExtensions||=[];let t=e.micromarkExtensions;t.some(e=>e===tZ)||t.push(tZ);let n=e.fromMarkdownExtensions;n.some(e=>e===nZ)||n.push(nZ);let r=e.toMarkdownExtensions;r.some(e=>e===rZ)||r.push(rZ)}const aZ=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function oZ(){return e=>{Tj(e,`text`,(e,t,n)=>{if(n===void 0||t==null)return;let r=e.value;if(r.indexOf(`$`)===-1)return;aZ.lastIndex=0;let i=[],a;for(;(a=aZ.exec(r))!==null;)i.push(a);if(i.length===0)return;let o=[],s=0;for(let e of i){let t=e.index,n=t+e[0].length;if(t>s){let e={type:`text`,value:r.slice(s,t)};o.push(e)}let i={type:`inlineMath`,value:e[1]};o.push(i),s=n}if(s<r.length){let e={type:`text`,value:r.slice(s)};o.push(e)}return n.children.splice(t,1,...o),[Sj,t+o.length]})}}const sZ={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[a-zA-Z]`}]};function cZ(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===sZ)||e.toMarkdownExtensions.push(sZ)}const lZ={name:`wikiLink`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===91?(e.enter(`wikiLink`),e.enter(`wikiLinkMarker`),e.consume(t),s):n(t)}function s(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),c):n(t)}function c(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),d(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),l):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),r++,c)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),d(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),i++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),d(t)):(e.consume(t),a++,u)}function d(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),f):n(t)}function f(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLink`),t):n(r)}}},uZ={name:`wikiLinkEmbed`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===33?(e.enter(`wikiLinkEmbed`),e.enter(`wikiLinkEmbedBang`),e.consume(t),e.exit(`wikiLinkEmbedBang`),s):n(t)}function s(t){return t===91?(e.enter(`wikiLinkMarker`),e.consume(t),c):n(t)}function c(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),l):n(t)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),f(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),u):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),r++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),f(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),i++,u)}function d(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),f(t)):(e.consume(t),a++,d)}function f(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),p):n(t)}function p(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLinkEmbed`),t):n(r)}}};function dZ(){return{text:{91:lZ,33:uZ}}}function fZ(e){this.enter({type:`wikiLink`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function pZ(e){this.enter({type:`wikiLinkEmbed`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function mZ(e){return e.stack[e.stack.length-1]}function hZ(e){let t=mZ(this);t.data.target=this.sliceSerialize(e).trim()}function gZ(e){let t=mZ(this),n=this.sliceSerialize(e).trim();t.data.anchor=n.length?n:null}function _Z(e){let t=mZ(this),n=this.sliceSerialize(e).trim();t.data.alias=n.length?n:null}function vZ(e){let{target:t,anchor:n,alias:r}=e.data,i=r||(n?`${t}#${n}`:t);e.value=i,e.children=[{type:`text`,value:i}]}function yZ(e){vZ(mZ(this)),this.exit(e)}function bZ(e){vZ(mZ(this)),this.exit(e)}const xZ={enter:{wikiLink:fZ,wikiLinkEmbed:pZ},exit:{wikiLinkTarget:hZ,wikiLinkAnchor:gZ,wikiLinkAlias:_Z,wikiLink:yZ,wikiLinkEmbed:bZ}},SZ={handlers:{wikiLink:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`[[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`},wikiLinkEmbed:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`![[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`}},unsafe:[{character:`[`,inConstruct:[`phrasing`]}]},CZ=dZ();function wZ(){let e=this.data();e.micromarkExtensions||=[],e.micromarkExtensions.some(e=>e===CZ)||e.micromarkExtensions.push(CZ),e.fromMarkdownExtensions||=[],e.fromMarkdownExtensions.some(e=>e===xZ)||e.fromMarkdownExtensions.push(xZ),e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===SZ)||e.toMarkdownExtensions.push(SZ)}function TZ(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const EZ=[{name:`remark-parse`,plugin:yz},{name:`remark-frontmatter`,plugin:vR,options:[`yaml`]},{name:`remark-mdx-agnostic`,plugin:iZ},{name:`remark-gfm`,plugin:mL},{name:`remark-math`,plugin:PR,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:wZ},{name:`remark-github-alerts`,plugin:SR,options:QY},{name:`callout-transformer`,plugin:ZY},{name:`restore-from-mdx`,plugin:OY},{name:`restore-entity-refs`,plugin:IY},{name:`restore-backslash-escapes`,plugin:zY},{name:`details-accordion-promoter`,plugin:xX},{name:`image-promoter`,plugin:kX},{name:`indented-code-promoter`,plugin:FX},{name:`math-promoter`,plugin:LX},{name:`single-dollar-math-promoter`,plugin:oZ},{name:`highlight-promoter`,plugin:OX},{name:`mermaid-promoter`,plugin:QX},{name:`comment-promoter`,plugin:tX},{name:`merged-post-parse-walker`,plugin:XX},{name:`ensure-non-empty-doc`,plugin:()=>TZ}];function DZ(e){let t=wL();for(let e of EZ)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(JL,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function OZ(e){let t=wL().use(vR,[`yaml`]).use(mL,{tablePipeAlign:!1}).use(PR,{singleDollarTextMath:!1}).use(iZ).use(wZ).use(cZ).use(hL,{bullet:`-`,fences:!0,rule:`-`,join:[eZ],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function kZ(e,t){let n=new XA(NY(EY(RY(e)))),r=t.parse(n);n.value=e;let i=t.runSync(r,n);return t.stringify(i)}function AZ(e,t){let n=new XA(NY(EY(RY(e)))),r=t.parse(n);return n.value=e,t.runSync(r,n)}function jZ(e,t,n){let r=XL(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers});return String(t.stringify(r))}function MZ(){return typeof process>`u`||!process.env?!1:process.env.NODE_ENV===`development`||process.env.NODE_ENV===`test`}function NZ(e){let t=e.lastIndexOf(`/`);return t===-1?``:t===0?`/`:e.slice(0,t)}function PZ(e,t){let n=e?`${e}/${t}`:t,r=n.startsWith(`/`),i=[];for(let e of n.split(`/`))if(!(e===``||e===`.`)){if(e===`..`){let e=i[i.length-1];i.length>0&&e!==`..`?i.pop():r||i.push(`..`);continue}i.push(e)}let a=i.join(`/`);return r?`/${a}`:a}function FZ(e,t){if(typeof e!=`string`||e===``||!t||e.startsWith(`/`)||!AK(e))return e;let n=PZ(NZ(t),e);return n===``||n===`..`||n.startsWith(`../`)?(MZ()&&console.warn(`[resolve-image-url] doc-relative path escapes contentDir; emitting raw URL: ${e} (from sourcePath ${t})`),e):`/${n}`}const IZ={text(e,t,n,r){if(typeof e.data?.sourceRaw==`string`&&ZK(e.data.sourceRaw,e.value??``))return e.data.sourceRaw;if(e.data?.escapedChars?.length){let t=e.value??``,i=e.data.escapedChars,a=``,o=0;for(let{offset:e,char:s}of i)e>o&&(a+=HZ(n,t.slice(o,e),r)),a+=`\\${s}`,o=e+1;return o<t.length&&(a+=HZ(n,t.slice(o),r)),a}return HZ(n,(e.value??``).replaceAll(`\xA0`,` `),r)},emphasis(e,t,n,r){let i=e.data?.sourceDelimiter??`*`,a=n.createTracker(r),o=n.enter(`emphasis`),s=a.move(i);return s+=n.containerPhrasing(e,{before:s,after:i,...a.current()}),s+=a.move(i),o(),s},strong(e,t,n,r){let i=e.data?.sourceDelimiter??`**`,a=n.createTracker(r),o=n.enter(`strong`),s=a.move(i);return s+=n.containerPhrasing(e,{before:s,after:i,...a.current()}),s+=a.move(i),o(),s},link(e,t,n,r){if(e.data?.sourceStyle===`autolink`)return`<${e.url??``}>`;if(e.data?.sourceStyle===`gfm-autolink`){let t=e.children?.length===1?e.children[0]:null;if(t?.type===`text`&&typeof t.value==`string`)return t.value}let i=n.createTracker(r),a=n.enter(`link`),o=n.enter(`label`),s=i.move(`[`);s+=i.move(n.containerPhrasing(e,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`),l=String(e.url??``),u=e.data?.sourceUrlForm===`angle-bracketed`,d=l.startsWith(`<`)&&l.endsWith(`>`),f=u&&!d?`<${l}>`:zZ(l);if(s+=i.move(f),c(),e.title){let t=e.data?.sourceTitleMarker??`double`;s+=i.move(RZ(e.title,t))}return s+=i.move(`)`),a(),s},image(e,t,n,r){let i=n.createTracker(r),a=n.enter(`image`),o=n.enter(`label`),s=i.move(`![`);s+=i.move(n.safe(e.alt??``,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`);if(s+=i.move(zZ(String(e.url??``))),c(),e.title){let t=n.enter(`titleQuote`);s+=i.move(` "`),s+=i.move(n.safe(e.title,{before:s,after:`"`,...i.current()})),s+=i.move(`"`),t()}return s+=i.move(`)`),a(),s},definition(e,t,n,r){let i=e.data?.sourceLayout??`inline`,a=e.data?.sourceTitleMarker??`double`,o=n.enter(`definition`),s=n.createTracker(r),c=n.enter(`label`),l=s.move(`[`);l+=s.move(n.safe(n.associationId(e),{before:l,after:`]`,...s.current()})),l+=s.move(`]:`),c();let u=i===`multiline`?`
411
- `:` `;l+=s.move(u);let d=String(e.url??``);if(!d||/[\0- ]/.test(d)){let e=n.enter(`destinationLiteral`);l+=s.move(`<`),l+=s.move(n.safe(d,{before:l,after:`>`,...s.current()})),l+=s.move(`>`),e()}else{let e=n.enter(`destinationRaw`);l+=s.move(zZ(d)),e()}if(e.title){let t=i===`multiline`?`
412
- `:` `;l+=s.move(RZ(e.title,a,t))}return o(),l},thematicBreak(e,t,n){let r=e.data?.sourceRaw;return Array.isArray(n?.indexStack)&&n.indexStack.length===1&&n.indexStack[0]===0&&(!r||/^-[-\s]*-\s*$/.test(r))?`***`:r??`---`},break(e){return e.data?.sourceStyle===`backslash`?`\\
410
+ `)?`multiline`:`inline`,typeof e.title==`string`&&n.length>0){let t=n[n.length-1];t===`"`?e.data.sourceTitleMarker=`double`:t===`'`?e.data.sourceTitleMarker=`single`:t===`)`&&(e.data.sourceTitleMarker=`paren`)}break}case`mdxJsxFlowElement`:case`mdxJsxTextElement`:case`mdxFlowExpression`:case`mdxTextExpression`:e.data.sourceRaw=t.slice(i,a);break;case`break`:t.slice(i,a).includes(`\\`)?e.data.sourceStyle=`backslash`:e.data.sourceStyle=`spaces`;break}}function WX(){return RegExp(`(^|\\s)#([a-zA-Z][\\w/-]*)`,`g`)}const GX=WX();function KX(e,t){if(t<=0||e[t-1]!==`\\`)return!1;let n=t-1,r=0;for(;n>=0&&e[n]===`\\`;)r++,n--;return r%2==1}function qX(e,t=``){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value,a=typeof i.position?.start?.offset==`number`?i.position?.start?.offset??0:0;GX.lastIndex=0;let o=[],s=0;for(;;){let n=GX.exec(e);if(n===null)break;let i=n[1]??``,c=n[2]??``,l=n.index+i.length;if(t&&a>=0){let n=a,r=0,i=-1;for(;r<=l&&n<t.length;){let a=t[n]===`\\`&&n+1<t.length&&e[r]===t[n+1],o=a?n+1:n;if(r===l){i=o;break}n=a?n+2:n+1,r+=1}if(i>=0&&KX(t,i))continue}l>s&&o.push({type:`text`,value:e.slice(s,l)});let u={type:`tag`,value:c};o.push(u),s=l+1+c.length,r=!0}o.length===0?n.push(i):(s<e.length&&o.push({type:`text`,value:e.slice(s)}),n.push(...o))}r&&(e.children=n)}const JX=new Set(`root.paragraph.heading.text.emphasis.strong.blockquote.list.listItem.code.inlineCode.link.image.linkReference.imageReference.definition.html.thematicBreak.break.yaml.toml.table.tableRow.tableCell.delete.footnoteDefinition.footnoteReference.mdxFlowExpression.mdxJsxFlowElement.mdxJsxTextElement.mdxTextExpression.wikiLink.wikiLinkEmbed.tag.math.inlineMath.mark.comment.commentBlock.rawMdxFallbackMdast`.split(`.`));function YX(e,t){if(!e||typeof e!=`object`)return null;if(typeof e.offset==`number`)return e.offset>=0&&e.offset<=t.length?e.offset:null;let{line:n,column:r}=e;if(typeof n!=`number`||typeof r!=`number`||n<1||r<1)return null;let i=0;for(let e=1;e<n;e++){let e=t.indexOf(`
411
+ `,i);if(e===-1)return null;i=e+1}let a=t.indexOf(`
412
+ `,i),o=a===-1?t.length:a,s=i+r-1;return s<=o?s:null}function XX(e,t){if(!e)return null;let n=YX(e.start,t),r=YX(e.end,t);return n===null||r===null||r<n?null:t.slice(n,r)}function ZX(e,t){let n=XX(e.position,t);return{type:`rawMdxFallbackMdast`,originalType:e.type??`unknown`,value:n??``,unresolvedPosition:n===null,position:e.position}}function QX(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;BX(e,t);let r=typeof process<`u`&&process.env?.OK_DEBUG_POSITION_SLICE===`1`;Tj(e,(e,t,i)=>{if(i!==void 0&&typeof t==`number`&&typeof e.type==`string`&&!JX.has(e.type)){let r=ZX(e,n);return i.children[t]=r,Sj}if(`children`in e&&Array.isArray(e.children)){let t=e;t.children.some(e=>e.type===`text`)&&(zX(t),qX(t,n))}if(UX(e,n,r),e.type===`heading`&&i!==void 0&&typeof t==`number`&&e.data?.sourceStyle===`setext`){let n=e.position?.end?.line,r=i.children[t+1],a=r?.position?.start?.line;if(r?.type===`paragraph`&&typeof n==`number`&&typeof a==`number`&&a===n+1){let t=e;t.data??={},t.data.sourceContiguousNext=!0}}})}}function $X(e,t){let n={type:`mdxJsxFlowElement`,name:`MermaidFence`,attributes:[{type:`mdxJsxAttribute`,name:`chart`,value:e}],children:[]};return t&&(n.position=t),n}function eZ(){return e=>{Tj(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`mermaid`)return;let r=$X(typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}function tZ(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const nZ=(e,t)=>{if(tZ(e,t))return 0;let n=e.position,r=t.position;if(!n||!r)return;let i=r.start.line-n.end.line-1;return i>=1?i:void 0},rZ=VB(),iZ=aB(),aZ=oB();function oZ(){let e=this.data();e.micromarkExtensions||=[],e.fromMarkdownExtensions||=[],e.toMarkdownExtensions||=[];let t=e.micromarkExtensions;t.some(e=>e===rZ)||t.push(rZ);let n=e.fromMarkdownExtensions;n.some(e=>e===iZ)||n.push(iZ);let r=e.toMarkdownExtensions;r.some(e=>e===aZ)||r.push(aZ)}const sZ=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function cZ(){return e=>{Tj(e,`text`,(e,t,n)=>{if(n===void 0||t==null)return;let r=e.value;if(r.indexOf(`$`)===-1)return;sZ.lastIndex=0;let i=[],a;for(;(a=sZ.exec(r))!==null;)i.push(a);if(i.length===0)return;let o=[],s=0;for(let e of i){let t=e.index,n=t+e[0].length;if(t>s){let e={type:`text`,value:r.slice(s,t)};o.push(e)}let i={type:`inlineMath`,value:e[1]};o.push(i),s=n}if(s<r.length){let e={type:`text`,value:r.slice(s)};o.push(e)}return n.children.splice(t,1,...o),[Sj,t+o.length]})}}const lZ={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[a-zA-Z]`}]};function uZ(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===lZ)||e.toMarkdownExtensions.push(lZ)}const dZ={name:`wikiLink`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===91?(e.enter(`wikiLink`),e.enter(`wikiLinkMarker`),e.consume(t),s):n(t)}function s(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),c):n(t)}function c(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),d(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),l):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),r++,c)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),d(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),i++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),d(t)):(e.consume(t),a++,u)}function d(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),f):n(t)}function f(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLink`),t):n(r)}}},fZ={name:`wikiLinkEmbed`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===33?(e.enter(`wikiLinkEmbed`),e.enter(`wikiLinkEmbedBang`),e.consume(t),e.exit(`wikiLinkEmbedBang`),s):n(t)}function s(t){return t===91?(e.enter(`wikiLinkMarker`),e.consume(t),c):n(t)}function c(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),l):n(t)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),f(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),u):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),r++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),f(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),i++,u)}function d(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),f(t)):(e.consume(t),a++,d)}function f(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),p):n(t)}function p(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLinkEmbed`),t):n(r)}}};function pZ(){return{text:{91:dZ,33:fZ}}}function mZ(e){this.enter({type:`wikiLink`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function hZ(e){this.enter({type:`wikiLinkEmbed`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function gZ(e){return e.stack[e.stack.length-1]}function _Z(e){let t=gZ(this);t.data.target=this.sliceSerialize(e).trim()}function vZ(e){let t=gZ(this),n=this.sliceSerialize(e).trim();t.data.anchor=n.length?n:null}function yZ(e){let t=gZ(this),n=this.sliceSerialize(e).trim();t.data.alias=n.length?n:null}function bZ(e){let{target:t,anchor:n,alias:r}=e.data,i=r||(n?`${t}#${n}`:t);e.value=i,e.children=[{type:`text`,value:i}]}function xZ(e){bZ(gZ(this)),this.exit(e)}function SZ(e){bZ(gZ(this)),this.exit(e)}const CZ={enter:{wikiLink:mZ,wikiLinkEmbed:hZ},exit:{wikiLinkTarget:_Z,wikiLinkAnchor:vZ,wikiLinkAlias:yZ,wikiLink:xZ,wikiLinkEmbed:SZ}},wZ={handlers:{wikiLink:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`[[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`},wikiLinkEmbed:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`![[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`}},unsafe:[{character:`[`,inConstruct:[`phrasing`]}]},TZ=pZ();function EZ(){let e=this.data();e.micromarkExtensions||=[],e.micromarkExtensions.some(e=>e===TZ)||e.micromarkExtensions.push(TZ),e.fromMarkdownExtensions||=[],e.fromMarkdownExtensions.some(e=>e===CZ)||e.fromMarkdownExtensions.push(CZ),e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===wZ)||e.toMarkdownExtensions.push(wZ)}function DZ(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const OZ=[{name:`remark-parse`,plugin:yz},{name:`remark-frontmatter`,plugin:vR,options:[`yaml`]},{name:`remark-mdx-agnostic`,plugin:oZ},{name:`remark-gfm`,plugin:mL},{name:`remark-math`,plugin:PR,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:EZ},{name:`remark-github-alerts`,plugin:SR,options:QY},{name:`callout-transformer`,plugin:ZY},{name:`restore-from-mdx`,plugin:OY},{name:`restore-entity-refs`,plugin:IY},{name:`restore-backslash-escapes`,plugin:zY},{name:`details-accordion-promoter`,plugin:xX},{name:`image-promoter`,plugin:kX},{name:`indented-code-promoter`,plugin:FX},{name:`math-promoter`,plugin:LX},{name:`single-dollar-math-promoter`,plugin:cZ},{name:`highlight-promoter`,plugin:OX},{name:`mermaid-promoter`,plugin:eZ},{name:`comment-promoter`,plugin:tX},{name:`merged-post-parse-walker`,plugin:QX},{name:`ensure-non-empty-doc`,plugin:()=>DZ}];function kZ(e){let t=wL();for(let e of OZ)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(JL,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function AZ(e){let t=wL().use(vR,[`yaml`]).use(mL,{tablePipeAlign:!1}).use(PR,{singleDollarTextMath:!1}).use(oZ).use(EZ).use(uZ).use(hL,{bullet:`-`,fences:!0,rule:`-`,join:[nZ],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function jZ(e,t){let n=new XA(NY(EY(RY(e)))),r=t.parse(n);n.value=e;let i=t.runSync(r,n);return t.stringify(i)}function MZ(e,t){let n=new XA(NY(EY(RY(e)))),r=t.parse(n);return n.value=e,t.runSync(r,n)}function NZ(e,t,n){let r=XL(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers});return String(t.stringify(r))}function PZ(){return typeof process>`u`||!process.env?!1:process.env.NODE_ENV===`development`||process.env.NODE_ENV===`test`}function FZ(e){let t=e.lastIndexOf(`/`);return t===-1?``:t===0?`/`:e.slice(0,t)}function IZ(e,t){let n=e?`${e}/${t}`:t,r=n.startsWith(`/`),i=[];for(let e of n.split(`/`))if(!(e===``||e===`.`)){if(e===`..`){let e=i[i.length-1];i.length>0&&e!==`..`?i.pop():r||i.push(`..`);continue}i.push(e)}let a=i.join(`/`);return r?`/${a}`:a}function LZ(e,t){if(typeof e!=`string`||e===``||!t||e.startsWith(`/`)||!AK(e))return e;let n=IZ(FZ(t),e);return n===``||n===`..`||n.startsWith(`../`)?(PZ()&&console.warn(`[resolve-image-url] doc-relative path escapes contentDir; emitting raw URL: ${e} (from sourcePath ${t})`),e):`/${n}`}const RZ={text(e,t,n,r){if(typeof e.data?.sourceRaw==`string`&&ZK(e.data.sourceRaw,e.value??``))return e.data.sourceRaw;if(e.data?.escapedChars?.length){let t=e.value??``,i=e.data.escapedChars,a=``,o=0;for(let{offset:e,char:s}of i)e>o&&(a+=WZ(n,t.slice(o,e),r)),a+=`\\${s}`,o=e+1;return o<t.length&&(a+=WZ(n,t.slice(o),r)),a}return WZ(n,(e.value??``).replaceAll(`\xA0`,` `),r)},emphasis(e,t,n,r){let i=e.data?.sourceDelimiter??`*`,a=n.createTracker(r),o=n.enter(`emphasis`),s=a.move(i);return s+=n.containerPhrasing(e,{before:s,after:i,...a.current()}),s+=a.move(i),o(),s},strong(e,t,n,r){let i=e.data?.sourceDelimiter??`**`,a=n.createTracker(r),o=n.enter(`strong`),s=a.move(i);return s+=n.containerPhrasing(e,{before:s,after:i,...a.current()}),s+=a.move(i),o(),s},link(e,t,n,r){if(e.data?.sourceStyle===`autolink`)return`<${e.url??``}>`;if(e.data?.sourceStyle===`gfm-autolink`){let t=e.children?.length===1?e.children[0]:null;if(t?.type===`text`&&typeof t.value==`string`)return t.value}let i=n.createTracker(r),a=n.enter(`link`),o=n.enter(`label`),s=i.move(`[`);s+=i.move(n.containerPhrasing(e,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`),l=String(e.url??``),u=e.data?.sourceUrlForm===`angle-bracketed`,d=l.startsWith(`<`)&&l.endsWith(`>`),f=u&&!d?`<${l}>`:VZ(l);if(s+=i.move(f),c(),e.title){let t=e.data?.sourceTitleMarker??`double`;s+=i.move(BZ(e.title,t))}return s+=i.move(`)`),a(),s},image(e,t,n,r){let i=n.createTracker(r),a=n.enter(`image`),o=n.enter(`label`),s=i.move(`![`);s+=i.move(n.safe(e.alt??``,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`);if(s+=i.move(VZ(String(e.url??``))),c(),e.title){let t=n.enter(`titleQuote`);s+=i.move(` "`),s+=i.move(n.safe(e.title,{before:s,after:`"`,...i.current()})),s+=i.move(`"`),t()}return s+=i.move(`)`),a(),s},definition(e,t,n,r){let i=e.data?.sourceLayout??`inline`,a=e.data?.sourceTitleMarker??`double`,o=n.enter(`definition`),s=n.createTracker(r),c=n.enter(`label`),l=s.move(`[`);l+=s.move(n.safe(n.associationId(e),{before:l,after:`]`,...s.current()})),l+=s.move(`]:`),c();let u=i===`multiline`?`
413
+ `:` `;l+=s.move(u);let d=String(e.url??``);if(!d||/[\0- ]/.test(d)){let e=n.enter(`destinationLiteral`);l+=s.move(`<`),l+=s.move(n.safe(d,{before:l,after:`>`,...s.current()})),l+=s.move(`>`),e()}else{let e=n.enter(`destinationRaw`);l+=s.move(VZ(d)),e()}if(e.title){let t=i===`multiline`?`
414
+ `:` `;l+=s.move(BZ(e.title,a,t))}return o(),l},thematicBreak(e,t,n){let r=e.data?.sourceRaw;return Array.isArray(n?.indexStack)&&n.indexStack.length===1&&n.indexStack[0]===0&&(!r||/^-[-\s]*-\s*$/.test(r))?`***`:r??`---`},break(e){return e.data?.sourceStyle===`backslash`?`\\
413
415
  `:`
414
416
  `},code(e){let t=e.value??``;if(e.data?.sourceStyle===`indented`)return t.split(`
415
417
  `).map(e=>e.length>0?` ${e}`:e).join(`
@@ -422,7 +424,7 @@ $2`).split(`
422
424
 
423
425
  `:`
424
426
  `;return l.join(f)},table(e,t,n,r){let i=n.enter(`table`),a=[],o=[],s=e.children??[];for(let e of s){let t=e.children??[],i=[],s=[];for(let e of t){let t=n.enter(`tableCell`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,{...r,before:` `,after:` `});a(),t(),i.push(o);let c=e.data?.sourcePadding;s.push(c&&typeof c.left==`number`&&typeof c.right==`number`?{left:c.left,right:c.right}:null)}a.push(i),o.push(s)}i();let c=e.align??[],l=e.data?.sourceDashCounts,u=a[0]?.length??0,d=a.slice(1).reduce((e,t)=>Math.max(e,t.length),0),f=Math.max(u,d,c.length),p=[];for(let e=0;e<f;e++){let t=c[e],n=``,r=``;t===`center`?(n=`:`,r=`:`):t===`left`?n=`:`:t===`right`&&(r=`:`);let i=l?.[e],a=typeof i==`number`&&i>=1?i:1;p.push(n+`-`.repeat(a)+r)}let m=(e,t)=>{let n=[];for(let r=0;r<f;r++){let i=e[r]??``,a=t[r]??{left:1,right:1};n.push(` `.repeat(a.left)+i+` `.repeat(a.right))}return`|${n.join(`|`)}|`},h=Array.from({length:f},()=>null);if(a.length===0)return m(p,h);let g=[];g.push(m(a[0],o[0]??[])),g.push(m(p,h));for(let e=1;e<a.length;e++)g.push(m(a[e],o[e]??[]));return g.join(`
425
- `)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=LZ(i.attributes??[]);if(!i.children||i.children.length===0)return s?c?`<${s} ${c} />`:`<${s} />`:``;let l=c?`<${s} ${c}>`:`<${s}>`,u=`</${s}>`;return`${l}\n\n${n.containerFlow({type:`root`,children:i.children},r)}\n\n${u}`},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),o+=i.move(`==`),a(),o},comment(e,t,n,r){let i=e.data?.sourceForm,a=i===`html`?`<!-- `:`%%`,o=i===`html`?` -->`:`%%`,s=n.createTracker(r),c=n.enter(`comment`),l=s.move(a);return l+=n.containerPhrasing(e,{before:l,after:o,...s.current()}),l+=s.move(o),c(),l},commentBlock(e,t,n,r){let i=n.createTracker(r),a=n.enter(`commentBlock`),o=e.children??[],s=e.data?.sourceForm,c=e.data?.sourceLayout,l=o.length===1&&o[0]?.type===`paragraph`;if(s===`html`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`<!-- `,after:` -->`,...i.current()});return a(),`<!-- ${t} -->`}if(c===`inline`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`%% `,after:` %%`,...i.current()});return a(),`%% ${t} %%`}let u=n.containerFlow(e,i.current());return a(),`%%\n\n${u}\n\n%%`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;if(typeof t==`string`)return t;let n=e.name??``,r=LZ(e.attributes??[]);return r?`<${n} ${r} />`:`<${n}/>`},rawMdxFallback(e){return e.value??``},blockquote(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.containerFlow(e,a.current());i();let s=e.data?.sourceMarkerSpacings,c=0;return n.indentLines(o,(e,t,n)=>n?`>`:s?.[c++]===`none`?`>${e}`:`> ${e}`)}};function LZ(e){let t=[];for(let n of e){if(n.type===`mdxJsxExpressionAttribute`){t.push(`{${n.value}}`);continue}let e=n.name;if(n.value===null||n.value===void 0){t.push(e);continue}if(typeof n.value==`string`){if(n.value.includes(`"`)){let r=n.value.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`);t.push(`${e}={"${r}"}`)}else t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function RZ(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function zZ(e){if(!e)return``;let t=0,n=!0;for(let r of e)r===`(`?t++:r===`)`&&(t--,t<0&&(n=!1));return t!==0&&(n=!1),n?e:e.replace(/[\\()]/g,`\\$&`)}function BZ(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>VZ(t)?e:`\\${e}`)}function VZ(e){if(e.charCodeAt(0)!==35)return!1;let t=e[1]===`x`||e[1]===`X`?Number.parseInt(e.slice(2),16):Number.parseInt(e.slice(1),10);return t===9||t===10||t===11||t===12||t===13||t===32}function HZ(e,t,n){let r=e.unsafe;e.unsafe=r.filter(e=>!(e.character===`&`&&e.after===`[#A-Za-z]`||e.character===`<`||e.character===`[`||e.character===`(`||e.character==="`"));let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return BZ(i)}function UZ(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var WZ=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};constructor(e){this.schema=Ny(e.extensions),this.handlers=eQ(this.schema,this.parseCtx);let{nodeHandlers:t,markHandlers:n}=tQ(this.schema);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=DZ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=OZ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers,toMarkdownHandlers:IZ})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return kZ(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?AZ(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?eY(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e){let t;try{t=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}return jZ(t,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}};const GZ=UJ();function KZ(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else i?.type===`boolean`?r[e]=t.value===`true`:r[e]=t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function qZ(e){let t=!1;return e.descendants(e=>t||e.type.name===`jsxInline`?!1:e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function JZ(e){return e.attrs.sourceDirty||qZ(e)}function YZ(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0?!0:t.every(e=>e.type===`text`&&e.value===``)}function XZ(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),Object.keys(n).length===0?e:{...e,data:n}}function ZZ(e,t){if(e.length===0)return XZ({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return XZ({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[ZZ(n.children,t)]}}return XZ({type:`inlineCode`,value:QZ(e)},t)}function QZ(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=QZ(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const $Z=UG;function eQ(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=GL(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=GL(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null;return n.table.createAndFill({sourceDashCounts:s},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=FZ(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i){let t=n.replaceAll(`\xA0`,` `);return r.sourceLiteral?e.text(t,[r.sourceLiteral.create({sourceRaw:i})]):e.text(t)}let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n.replaceAll(`\xA0`,` `));let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[],l=0;for(let t of s){if(t.offset>l){let r=n.slice(l,t.offset).replaceAll(`\xA0`,` `);r&&c.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length).replaceAll(`\xA0`,` `);i&&(t.kind===`escape`?c.push(e.text(i,[r.escapeMark.create()])):r.sourceLiteral?c.push(e.text(i,[r.sourceLiteral.create({sourceRaw:t.raw})])):c.push(e.text(i))),l=t.offset+t.length}}if(l<n.length){let t=n.slice(l).replaceAll(`\xA0`,` `);t&&c.push(e.text(t))}return c.length===1?c[0]:c}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1})]));let a=r.strike??r.delete;if(a&&(i.delete=KL(a)),r.highlight&&(i.mark=KL(r.highlight)),r.comment&&(i.comment=KL(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=GL(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=KL(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=KL(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=GL(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`})),n.list&&(i.list=GL(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=GL(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:``,title:null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=GZ.getOrWildcard(o),c=KZ(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=FZ(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=lq(o),{resolveEmbed:u,sourcePath:d}=t.current,f=u&&d?u(o,d)??null:null,p=f?`/${f}`:o,m=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(m&&$Z.has(l)&&n.jsxComponent&&GZ.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,alt:s??o,target:o,anchor:c,alias:s}});if(m&&WG.has(l)&&n.jsxComponent&&GZ.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&KG.has(l)&&n.jsxComponent&&GZ.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&qG.has(l)&&n.jsxComponent&&GZ.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:UZ(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(eK.has(l)&&r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}if(r.link){let t=r.link.create({href:o,title:null,linkStyle:`inline`,refLabel:null});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=GL(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function tQ(e){let t={},n={},r=e.nodes,i=e.marks;r.paragraph&&(t.paragraph=ZL(`paragraph`)),r.blockquote&&(t.blockquote=ZL(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),r.heading&&(t.heading=ZL(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0}}))),r.codeBlock&&(t.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t}}}),r.thematicBreak&&(t.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),r.hardBreak&&(t.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle}})),r.list&&(t.list=ZL(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),r.listItem&&(t.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&YZ(r[0])?r.slice(1):r;return{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,children:i}}),r.table&&(t.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c=Array.isArray(s)&&s.length>0?{sourceDashCounts:s}:void 0,l={type:`table`,align:i,children:o};return c&&(l.data=c),l}),r.tableRow&&(t.tableRow=ZL(`tableRow`));let a=e=>{let t=e.attrs.sourcePadding,n={};return typeof t==`object`&&t&&typeof t.left==`number`&&typeof t.right==`number`&&(n.sourcePadding=t),Object.keys(n).length>0?{data:n}:{}};if(r.tableCell&&(t.tableCell=ZL(`tableCell`,a)),r.tableHeader&&(t.tableHeader=ZL(`tableCell`,a)),r.image&&(t.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),r.imageReference&&(t.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),r.htmlBlock&&(t.htmlBlock=e=>({type:`html`,value:e.attrs.content})),r.linkDefinition??r.linkRefDef){let e=r.linkDefinition?`linkDefinition`:`linkRefDef`;t[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(r.jsxComponent&&(t.jsxComponent=(e,t,n)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let r=e.attrs.componentName||null,i=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!JZ(e)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:r,attributes:i,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:GZ.getOrWildcard(r??`*`).serialize(e,{all:e=>n.all(e),registry:GZ,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),r.rawMdxFallback&&(t.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),r.jsxInline&&(t.jsxInline=e=>{let t=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),r.mathInline&&(t.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;return typeof n==`string`&&n.length>0?{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]}:{type:`inlineMath`,value:t}}),r.wikiLink&&(t.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),r.tag&&(t.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),r.wikiLinkEmbed&&(t.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),i.emphasis&&(n.emphasis=QL(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.strong&&(n.strong=QL(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.code&&(n.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return ZZ(n,{sourceFenceChar:r,sourceFenceLength:i})}),i.strike??i.delete){let e=i.strike?`strike`:`delete`;n[e]=QL(`delete`)}return i.highlight&&(n.highlight=QL(`mark`)),i.comment&&(n.comment=QL(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),r.commentBlock&&(t.commentBlock=ZL(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),r.footnoteReference&&(t.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),r.footnoteDefinition&&(t.footnoteDefinition=ZL(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),i.link&&(n.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,n=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,r=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),i.escapeMark&&(n.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data=t.data??{},t.data.escapedChars=t.data.escapedChars??[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),i.sourceLiteral&&(n.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return ZK(t,e.value)&&(e.data=e.data??{},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:t,markHandlers:n}}const nQ=/\p{M}+/gu,rQ=/[^\p{L}\p{N}]+/gu,iQ=/^-+|-+$/g;function aQ(e){return e.trim().normalize(`NFKD`).replace(nQ,``).toLowerCase().replace(rQ,`-`).replace(iQ,``)}function oQ(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function sQ(e,t){let n=aQ(e);return n?oQ(n,t):``}const cQ=VB(),lQ=aB(),uQ=oB();function dQ(){return VJ.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function fQ(){return dQ().filter(e=>pQ(e)!==`fence`)}function pQ(e){return e.name===`MermaidFence`?`fence`:e.hasChildren?`jsx-block`:`jsx-void`}function mQ(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:pQ(e)}}function hQ(e){if(e.hidden!==!0&&e.type!==`reactnode`){if(`defaultValue`in e&&e.defaultValue!==void 0)return e.defaultValue;if(e.type===`enum`)return e.enumValues[0];if(e.type===`string`)return``;if(e.type===`number`)return 0;if(e.type===`boolean`)return!1}}function gQ(e,t){return!(e.omitOnDefault===!0&&`defaultValue`in e&&Object.is(e.defaultValue,t)||e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&t===``)}function _Q(e){let t=[];for(let n of e.props){let e=hQ(n);e!==void 0&&gQ(n,e)&&t.push(eJ(n.name,e))}return t}function vQ(e){return pz(e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`Body content here.`,{extensions:[cQ],mdastExtensions:[lQ]}).children}function yQ(e){let t=pQ(e),n;if(t===`fence`)n={type:`code`,lang:`mermaid`,meta:null,value:e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`graph LR
426
- A --> B`};else{let r=_Q(e),i=t===`jsx-block`?vQ(e):[];n={type:`mdxJsxFlowElement`,name:e.name,attributes:r,children:i}}return oP({type:`root`,children:[n]},{extensions:[uQ]}).trimEnd()}function bQ(e){let t=[];for(let n of e.props){if(n.hidden===!0)continue;let e={name:n.name,type:n.type,required:n.required};n.description!==void 0&&(e.description=n.description),n.advanced===!0&&(e.advanced=!0),n.omitOnDefault===!0&&(e.omitOnDefault=!0),n.type===`enum`&&(e.values=n.enumValues,n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue)),n.type===`string`&&(n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.language!==void 0&&(e.language=n.language),n.accept!==void 0&&(e.accept=n.accept)),n.type===`boolean`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.type===`number`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),t.push(e)}return t}function xQ(e){return{...mQ(e),example:yQ(e),params:bQ(e)}}function SQ(){return[``,"**Custom canonical components.** OK `.md` / `.mdx` supports the JSX components below — use whichever is semantically useful in any part of the doc. For full source syntax + parameter schemas, call `palette({ components: [ids] })` with the ids you want to use. Fenced code blocks render naturally and don't need a fetch — including ` ```mermaid ` for diagrams and ` ```html preview ` for interactive HTML/JS/CSS pages (the fence info-string `preview` token renders the block as a live iframe; works for `html` / `htm` / `xml`; optional `h=` / `w=` tokens set size, e.g. ` ```html preview h=400px `). Use ` ```html preview ` whenever you want anything interactive or JS-powered (charts, demos, calculators, animations) — just author the standalone HTML page in the fence. Call `palette` for the markdown-native component forms (write `> [!NOTE]`, not `<Callout>`), copy-ready themed `html preview` starters, and the theme tokens (`var(--chart-1)`, `var(--foreground)`, …) an embed should reference so it tracks the reader's light/dark theme. Arbitrary `<TagName>` JSX falls through as raw MDX when no canonical fits.",``,...fQ().map(mQ).map(e=>`- \`${e.id}\` (${e.kind}) — ${e.description}`)].join(`
427
- `)}const CQ=N({docName:yq,summary:xq,content:k().optional(),...bq}).loose(),wQ=N({docName:yq,summary:xq,markdown:k(),position:P([`append`,`prepend`,`replace`]).optional(),extension:P([`.md`,`.mdx`]).optional(),...bq}).loose(),TQ=N({docName:yq,summary:xq,find:k().min(1),replace:k(),offset:A().int().nonnegative().optional(),...bq}).loose(),EQ=N({docName:yq,connectionId:k().min(1),scope:P([`last`,`session`,`file`]).optional(),...bq}).loose(),DQ=N({value:k(),truncatedFrom:A().int().nonnegative().optional(),hint:k().optional()}).loose(),OQ=Zs(`kind`,[N({kind:F(`inline`),content:k()}),N({kind:F(`truncated`),byteLength:A().int().nonnegative(),hint:k()})]),kQ=N({kind:F(`content-divergence`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),divergenceType:k().optional(),currentState:OQ.optional(),hint:k().optional()}).loose(),AQ=N({type:F(`orphan`),parentCandidates:M(k()),message:k()}).loose(),jQ=Zs(`kind`,[kQ,N({kind:F(`disk-edit-reconciled`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),hint:k().optional()}).loose()]),MQ=N({timestamp:k().min(1),summary:DQ.optional(),warning:jQ.optional()}).loose(),NQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),hints:M(AQ).optional(),summary:DQ.optional(),warning:jQ.optional()}).loose(),PQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),summary:DQ.optional(),warning:jQ.optional()}).loose(),FQ=N({docName:k().min(1),scope:P([`last`,`session`]),undone:j()}).loose(),IQ=N({docName:yq,patch:tc(k(),Ys([jW,Rs()])),types:tc(k(),P(AW)).optional(),summary:xq,...bq}).loose(),LQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),appliedKeys:M(k()),summary:DQ.optional(),warning:jQ.optional()}).loose(),RQ=N({entries:M(N({level:P([`info`,`warn`,`error`]),message:k().max(8192),event:k().optional(),fields:tc(k(),Hs()).optional(),ts:A().optional(),sourceId:k().optional(),lineNumber:A().optional()}).loose()).max(100)}).loose(),zQ=N({accepted:A().int().min(0)}).loose(),BQ=N({status:k().min(1),reason:k()}).loose(),VQ=N({docName:k().min(1),content:k(),lifecycle:BQ.nullable()}).loose(),HQ=N({documents:M(N({kind:P([`document`,`asset`,`folder`]).default(`document`),docName:k().min(1).optional(),docExt:k().min(1).default(`.md`),size:A().int().nonnegative(),modified:k().min(1),isSymlink:j().default(!1),canonicalDocName:k().nullable().default(null),targetPath:k().nullable().default(null),path:k().min(1).optional(),assetExt:k().min(1).optional(),mediaKind:P([`image`,`video`,`audio`,`pdf`,`text`]).nullable().optional(),referencedBy:M(k().min(1)).optional(),hasChildren:j().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName)`})),truncated:j().optional()}).loose(),UQ=N({source:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),WQ=N({docName:k().min(1),backlinks:M(UQ)}).loose(),GQ=N({counts:tc(k().min(1),A().int().nonnegative())}).loose(),KQ=Zs(`kind`,[N({kind:F(`doc`),docName:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),N({kind:F(`external`),url:k().min(1),title:k(),snippet:k().nullable()}).loose()]),qQ=N({docName:k().min(1),forwardLinks:M(KQ)}).loose(),JQ=Zs(`kind`,[N({id:k().min(1),kind:F(`doc`),docName:k().min(1),anchor:k().nullable(),label:k(),cluster:k().nullable(),category:k().nullable(),tags:M(k()).nullable()}).loose(),N({id:k().min(1),kind:F(`external`),url:k().min(1),label:k()}).loose()]),YQ=N({source:k().min(1),target:k().min(1)}).loose(),XQ=N({nodes:M(JQ),links:M(YQ)}).loose(),ZQ=N({ts:A().int().min(0),url:k(),method:k(),ua:k().optional(),origin:k().optional(),referer:k().optional(),host:k().optional(),remote:k().optional(),secChUa:k().optional(),secChUaMobile:k().optional(),secChUaPlatform:k().optional(),secFetchSite:k().optional(),secFetchDest:k().optional(),secFetchMode:k().optional(),secFetchUser:k().optional()}).loose(),QQ=N({app:Ys([F(`cursor`),F(`codex`),F(`claude`),Rs()]),signals_fired:M(k())}).loose(),$Q=N({entries:M(ZQ),count:A().int().min(0),detection:QQ}).loose(),e$=N({writers:M(N({id:k().min(1),name:k().optional(),email:k().optional()}).loose()).optional(),summary:xq,...bq}).loose(),t$=N({checkpointRef:k().min(1)}).loose(),n$=N({v:A().int().optional(),id:k().min(1),name:k().min(1),colorSeed:k().optional(),docs:M(k()),summaries:M(k()).optional()}).loose(),r$=N({entries:M(N({sha:k().min(1),timestamp:k().min(1),author:k(),authorEmail:k(),type:P([`checkpoint`,`wip`,`upstream`,`park`]),message:k(),contributors:M(n$),checkpoint:Hs().nullable()}).loose()),total:A().int().nonnegative().optional(),truncated:j().optional()}).loose(),i$=N({sha:k().regex(/^[0-9a-f]{40}$/i),content:k(),timestamp:k(),author:k()}).loose(),a$=N({lines:M(N({type:P([`added`,`removed`,`unchanged`]),text:k()}).loose()),additions:A().int().nonnegative(),deletions:A().int().nonnegative()}).loose(),o$=N({contentDir:k().min(1),pathSeparator:P([`/`,`\\`]),symlinkResolved:j()}).loose(),s$=M(Zs(`source`,[N({docName:k().min(1),timestamp:k().min(1),size:A().int().nonnegative(),source:F(`flat`)}).loose(),N({docName:k().min(1),timestamp:k().min(1),source:F(`timeline`),sha:k().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),c$=N({orphans:M(N({docName:k().min(1),title:k()}).loose())}).loose(),l$=N({hubs:M(N({docName:k().min(1),title:k(),count:A().int().nonnegative()}).loose())}).loose(),u$=N({source:k().min(1),title:k(),snippet:k().nullable()}).loose(),d$=N({deadLinks:M(N({target:k().min(1),sources:M(u$)}).loose())}).loose(),f$=N({target:N({docName:k().min(1),title:k(),aliases:M(k())}).loose(),mentions:M(N({source:k().min(1),excerpt:k(),offset:A().int().nonnegative()}).loose()),truncated:j()}).loose(),p$=N({dir:k().min(1),port:A().int().min(1).max(65535).optional()}).loose(),m$=N({port:A().int().positive()}).loose(),h$=N({projectPath:k().min(1)}).loose(),g$=P([`not-a-git-worktree`,`init-failed`]),_$=Zs(`ok`,[N({ok:F(!0),projectPath:k().min(1)}).loose(),N({ok:F(!1),reason:g$,message:k().min(1)}).loose()]),v$=N({host:k().min(1).optional()}).loose(),y$=N({key:k().min(1)}).loose(),b$=N({keyPresent:j()}).loose(),x$=N({name:k().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:k().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),S$=N({identity:N({name:k().min(1),email:k().min(1)}).loose().nullable()}).loose(),C$=N({authenticated:j()}).loose(),w$=N({}).loose(),T$=N({stackIndex:A().int().min(0),ts:A().int().min(0),additions:A().int().min(0),deletions:A().int().min(0)}).loose(),E$=N({docName:k().min(1),additionsTotal:A().int().min(0),deletionsTotal:A().int().min(0),lastTs:A().int().min(0),bursts:M(T$)}).loose(),D$=N({displayName:k().min(1),color:k().min(1),icon:k().optional(),connectionId:k().min(1)}).loose(),O$=N({sessionAlive:j(),agent:D$.nullable(),files:M(E$)}).loose(),k$=N({diff:k(),generatedAt:A().int().min(0)}).loose(),A$=N({}).loose(),j$=N({}).loose(),M$=N({}).loose(),N$=N({}).loose(),P$=N({}).loose(),F$=N({displayName:k().min(1),icon:k(),color:k().min(1),currentDoc:k().nullable(),mode:P([`idle`,`writing`]),ts:A().int().min(0)}).loose(),I$=N({presence:tc(k().min(1),F$)}).loose(),L$=tc(k().min(1),j()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});N({path:k().min(1,`path must be non-empty`)}).loose();const R$=N({}).loose(),z$=N({fromDocName:k().min(1),toDocName:k().min(1)}).loose(),B$=N({fromPath:k().min(1),toPath:k().min(1)}).loose(),V$=N({}).loose(),H$=N({path:k().min(1),...bq,summary:xq}).loose(),U$=N({docName:k().min(1)}).loose(),W$=N({path:k().min(1),...bq,summary:xq}).loose(),G$=N({path:k().min(1)}).loose(),K$=N({kind:P([`file`,`folder`]),path:k().min(1),...bq,summary:xq}).loose(),q$=N({kind:P([`file`,`folder`]),path:k().min(1),duplicatedDocNames:M(k().min(1))}).loose(),J$=N({pages:M(N({docName:k().min(1),title:k(),docExt:k().min(1),size:A().int().nonnegative(),modified:k().min(1),icon:k().min(1).max(2048).optional()}).loose())}).loose(),Y$=N({level:A().int().min(1).max(6),text:k(),slug:k()}).loose(),X$=N({docName:k().min(1),headings:M(Y$)}).loose(),Z$=N({docName:k().min(1),rewrites:A().int().nonnegative()}).loose(),Q$=N({kind:P([`file`,`folder`,`asset`]),fromPath:k().min(1),toPath:k().min(1),...bq,summary:xq}).loose(),$$=N({renamed:M(z$),renamedAssets:M(B$),rewrittenDocs:M(Z$).optional(),summary:DQ.optional()}).loose(),e1=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...bq}).loose(),t1=N({deletedDocNames:M(k().min(1))}).loose(),n1=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...bq,summary:xq}).loose(),r1=N({deletedDocNames:M(k().min(1))}).loose(),i1=N({docName:k().min(1),commitSha:k().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:xq,...bq}).loose(),a1=N({restoredFrom:k().min(1),timestamp:k().min(1),summary:DQ.optional(),warning:kQ.optional()}).loose(),o1=P([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),s1=N({label:k().min(1),webUrl:_s().nullable()}).loose(),c1=Zs(`checkStatus`,[N({checkStatus:F(`allowed`)}).loose(),N({checkStatus:F(`denied`),deniedReason:P([`no-collaborator`,`private-no-access`,`repo-not-found`])}).loose(),N({checkStatus:F(`unknown`),unknownError:P([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`]).optional()}).loose()]),l1=P([`auth-403`,`auth-401`,`auth-scope-mismatch`,`semantic-protected-branch`]),u1=N({state:o1,lastSyncUtc:k().nullable(),lastFetchUtc:k().nullable(),lastPushedSha:k().nullable(),ahead:A().int().min(0),behind:A().int().min(0),consecutiveFailures:A().int().min(0),conflictCount:A().int().min(0),hasRemote:j(),syncEnabled:j(),identityUnresolved:j(),remote:s1.nullable().optional(),pushError:k().optional(),pushErrorCode:l1.optional(),pullError:k().optional(),pullErrorCode:l1.optional(),pausedReason:k().optional(),pushPermission:c1.optional()}).loose(),d1=N({op:P([`sync`,`push`,`pull`]).optional()}).loose(),f1=N({op:P([`sync`,`push`,`pull`])}).loose(),p1=N({conflicts:M(N({file:k().min(1),detectedAt:k().min(1),oursSha:k().optional(),theirsSha:k().optional(),baseSha:k().optional()}).loose())}).loose(),m1=N({file:k().min(1),strategy:P([`mine`,`theirs`,`content`,`delete`]),content:k().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),h1=N({}).loose(),g1=N({file:k().min(1),base:k(),ours:k(),theirs:k(),kind:P([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:k().nullable()}).loose(),_1=N({plan:Tc(e=>e!==void 0,{message:`plan is required`})}).loose(),v1=N({plan:Tc(e=>e!==void 0,{message:`plan is required`})}).loose(),y1=N({result:Tc(e=>e!==void 0,{message:`result is required`})}).loose(),b1=N({path:k().min(1),summary:k().min(1)}).loose(),x1=N({files:A().int().nonnegative(),folders:A().int().nonnegative()}).loose(),S1=N({packs:M(N({id:k().min(1),name:k().min(1),description:k().min(1),defaultSubfolder:k().optional(),folders:M(b1),entryCounts:x1}).loose())}).loose(),C1=N({noOpen:j().optional(),out:k().min(1).optional()}).loose(),w1=N({reason:P([`unsupported-platform`,`spawn-error`]),message:k()}).loose(),T1=Zs(`status`,[N({status:F(`installed`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k()}).loose(),N({status:F(`built`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k(),handoffError:w1.optional()}).loose(),N({status:F(`failed`),buildError:k()}).loose(),N({status:F(`skip-current`),skillVersion:k(),recordedAt:k().optional()}).loose()]),E1=N({tags:M(N({name:k().min(1),count:A().int().nonnegative(),isLeaf:j()}).loose())}).loose(),D1=N({docName:k().min(1),title:k(),matchingTags:M(k().min(1)),snippet:k().nullable()}).loose(),O1=N({name:k().min(1),docs:M(D1)}).loose(),k1=N({folder:Hs(),frontmatter_local:tc(k(),Hs()).nullable()}).loose(),A1=N({path:k(),frontmatter:tc(k(),Hs()).optional()}).loose(),j1=N({applied:Hs()}).loose(),M1=tc(k(),Hs()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),N1=N({template:N({name:k().min(1),folder:k(),scope:P([`local`,`inherited`]),path:k().min(1),frontmatter:M1,body:k()}).strict()}).strict(),P1=N({templates:M(N({name:k().min(1),title:k().optional(),description:k().optional(),path:k().min(1),source_folder:k()}).strict()),truncated:j()}).strict(),F1=N({folder:k(),name:k(),body:k().optional(),frontmatter:M1.optional(),...bq,summary:xq}).strict(),I1=N({path:k().min(1),created:j(),warnings:M(k())}).strict(),L1=N({existed:j(),path:k().min(1)}).strict(),R1=N({fromFolder:k(),fromName:k(),toFolder:k(),toName:k(),body:k().optional(),frontmatter:M1.optional(),...bq,summary:xq}).strict(),z1=N({from:k().min(1),to:k().min(1),committed:j()}).strict(),B1=N({query:k().optional(),intent:P([`autocomplete`,`full_text`,`omnibar`]).optional(),scopes:M(P([`page`,`folder`,`content`])).optional(),scope:k().optional(),limit:A().int().nonnegative().optional(),semantic:j().optional()}).loose(),V1=N({kind:P([`page`,`folder`,`content`]),path:k().min(1),title:k(),score:A(),signals:tc(k(),Hs()),snippet:k().optional()}).loose(),H1=N({capable:j(),applied:j(),coverage:N({embedded:A().int().nonnegative(),total:A().int().nonnegative()})}).loose(),U1=N({enabled:j(),keyPresent:j(),keySource:P([`file`,`env`]).nullable(),ready:j(),capable:j(),embedded:A().int().nonnegative(),total:A().int().nonnegative()}).loose(),W1=N({query:k(),intent:P([`autocomplete`,`full_text`,`omnibar`]),results:M(V1),elapsedMs:A().nonnegative(),semantic:H1.optional()}).loose(),G1=N({version:k().min(1),recordedAt:k().min(1)}).loose(),K1=N({currentVersion:k().min(1),targets:tc(k(),G1.nullable())}).loose(),q1=`server-info`,J1=`branch-switched`,Y1=`disk-ack`,X1=`config-validation-rejected`,Z1=`config-ignore-nested-error`,Q1=P([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),$1=N({v:F(1),ch:F(q1),seq:A(),serverInstanceId:k().min(1),currentBranch:k().min(1).optional()}).loose(),e0=N({v:F(1),ch:F(J1),seq:A(),branch:k().min(1)}).loose(),t0=N({v:F(1),ch:Q1,seq:A()}).loose(),n0=N({v:F(1),ch:F(Y1),seq:A(),docName:k().min(1),sv:k().min(1)}).loose(),r0=N({v:F(1),ch:F(X1),seq:A(),docName:k().min(1),error:al}).loose(),i0=N({v:F(1),ch:F(Z1),seq:A(),path:k().min(1),error:k().min(1)}).loose(),a0={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},o0=new WeakMap;function s0(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function c0(e){return e.trim().toLowerCase()}function l0(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function u0(e){return e.split(`/`).filter(Boolean).join(` `)}function d0(e){let t=l0(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0;return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:u0(e.path),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function f0(e){let t=jU({schema:a0});return e.length>0&&HU(t,e),t}function p0(e){let t={documents:e};return o0.set(t,f0(e)),t}function m0(e){let t=o0.get(e);if(t)return t;let n=f0(e.documents);return o0.set(e,n),n}function h0(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`]:[`page`,`folder`]}function g0(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function _0(e,t){let n=c0(t);if(!n)return 0;let r=c0(e.title),i=c0(e.name),a=c0(e.path),o=a.split(`/`);return r===n||i===n?700:a===n?650:r.startsWith(n)||i.startsWith(n)?600:o.some(e=>e.startsWith(n))?550:r.includes(n)||i.includes(n)?500:a.includes(n)?450:-1}function v0(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function y0(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function b0(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}function x0(e,t){return c0(t).length<4?0:e===`full_text`?1:0}function S0(e,t,n={}){let r=n.intent??`omnibar`,i=s0(n.limit),a=new Set(n.scopes??h0(r)),o=e.documents.filter(e=>g0(e,a)),s=c0(t);if(!s)return o.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,i).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let c=vW(m0(e),{term:s,properties:y0(r),boost:b0(r),tolerance:x0(r,s),limit:Math.max(i*4,40)}),l=new Map(c.hits.filter(e=>g0(e.document,a)).map(e=>[e.document.id,e.score])),u=v0(o),d=new Map;for(let e of o)_0(e,s)>=0&&d.set(e.id,e);for(let e of c.hits)g0(e.document,a)&&d.set(e.document.id,e.document);return n.semantic?w0({scopedDocuments:o,candidates:d,fullTextScores:l,recency:u,normalizedQuery:s,semantic:n.semantic,limit:i}):[...d.values()].map(e=>{let t=Math.max(0,_0(e,s)),n=l.get(e.id)??0,r=u.get(e.id)??0;return{document:e,score:t+n*20+r,signals:{lexical:t,fullText:n,recency:r}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score).slice(0,i)}function C0(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function w0(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,semantic:o,limit:s}=e,c=o.rrfK??60,l=o.candidateLimit??64,u=o.similarityFloor??.35,d=o.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=[...n.values()].map(e=>{let t=Math.max(0,_0(e,a)),n=r.get(e.id)??0,o=i.get(e.id)??0,s=d.get(e.id),c=s!==void 0&&s>=u;return{document:e,score:t+n*20+o,signals:c?{lexical:t,fullText:n,recency:o,vector:s}:{lexical:t,fullText:n,recency:o},lexical:t,fullText:n,recency:o,cosine:s}}),h=C0(m.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),g=C0(m.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=e=>{let t=0,n=h.get(e);n!==void 0&&(t+=1/(c+n));let r=g.get(e);return r!==void 0&&(t+=1/(c+r)),t};return m.sort((e,t)=>{let n=e.lexical>0?1:0,r=t.lexical>0?1:0;if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=_(e.document.id),a=_(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n})).slice(0,s)}function T0(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),E0(n)}function E0(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const D0=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),O0=globalThis;O0[D0]===void 0&&(O0[D0]=Fi());const k0=O0[D0],A0=[`.ok`,`skill-state.yml`],j0=[`claude-cowork`,`cli-hosts`],M0=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],N0=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,P0=qs({version:k().regex(N0,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(k0,{description:`Recorded skill version for this target.`}),recordedAt:Vo().register(k0,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:P(M0).register(k0,{description:`Install-source surface that recorded this entry.`}).optional()}),F0=qs({schema:F(1).register(k0,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:qs({"claude-cowork":P0.optional(),"cli-hosts":P0.optional()}).register(k0,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({})});function I0(){return{schema:1,targets:{}}}function L0(){let e=!1,t=``,n=0;return r=>{let i=R0(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function R0(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}const z0=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],B0={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function V0(e,t=z0){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const H0={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function U0(e){return e?H0[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const W0={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function G0(e){let t=e?.trim();return t?W0[U0(t)]??t:`Agent`}function K0(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}const q0=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function J0(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function Y0(e){let t=e.trim();return q0.test(t)||t.startsWith(`//`)}function X0(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(Y0(n))return{kind:`external`,url:n};let r=K0(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=J0(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function Z0(e,t){let n=e.trim();if(!n)return null;if(Y0(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=J0(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function Q0(e,t){let n=e.trim();if(!n||q0.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function $0(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function e2(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function t2(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function n2(e){return e.split(`/`).filter(e=>e!==``)}function r2(e,t){let n=t2(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function i2(e,t){let n=t2(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:n2(r).length}function a2(e,t){let n=n2(e),r=n2(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function o2(){let e=new Map;function t(t){let n=$0(t);if(n===``)return;let r=e2(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=$0(t),r=e2(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=t2($0(n)),o=[],s=[];for(let e of i)r2(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=i2(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=i2(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=a2(a,t2(t));for(let r=1;r<e.length;r++){let i=e[r],o=a2(a,t2(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function s2(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function c2(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}function l2(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function u2(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function d2(){try{let e=_(g(b(import.meta.url)),`..`,`package.json`),t=JSON.parse(d(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}const f2=d2(),p2=1;var m2=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`Open Knowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function h2(e,t){return _(e,`${t}.lock`)}const g2=new Map;function _2(e){g2.set(e,(g2.get(e)??0)+1)}function v2(e){let t=g2.get(e);return t===void 0||t<=1?(g2.delete(e),!0):(g2.set(e,t-1),!1)}function y2(e,t){try{let n=JSON.parse(d(e,`utf-8`));return n&&typeof n==`object`&&u2(n.pid)?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function b2(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;l(n,{recursive:!0});let a=h2(n,t),o={pid:process.pid,hostname:y(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??f2},d=JSON.stringify(o,null,2);for(let e=0;e<3;e++){if(!c(a))try{let e=u(a,`wx`,384);try{m(e,d)}finally{s(e)}return _2(a),x2({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=y2(a,i);if(e){let r=e.hostname===y();if(r&&e.pid===process.pid)return p(a,d,{encoding:`utf-8`,mode:384}),_2(a),x2({lockName:t,lockDir:n,lockPath:a});if(r&&l2(e.pid))throw new m2(e,a,t);console.warn(`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{f(a)}catch{}}throw Error(`${i} Failed to acquire ${a} after 3 attempts (concurrent acquire contention).`)}function x2(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>T2({lockName:t,lockDir:n}),updatePort:e=>S2({lockName:t,lockDir:n,port:e})}}function S2(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=h2(n,t);if(!c(a)){console.warn(`${i} Lock file missing at ${a} during port update — skipping`);return}let o;try{let e=JSON.parse(d(a,`utf-8`));if(!e||typeof e!=`object`||!u2(e.pid)){console.warn(`${i} Corrupt lock at ${a} during port update — skipping`);return}o=e}catch{console.warn(`${i} Unreadable lock at ${a} during port update — skipping`);return}if(o.pid===process.pid&&!(typeof o.hostname==`string`&&o.hostname!==y())){o.port=r;try{p(a,JSON.stringify(o,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function C2(e){let{lockName:t,lockDir:n}=e,r=h2(n,t);if(!c(r))return null;let i;try{let e=JSON.parse(d(r,`utf-8`));if(!e||typeof e!=`object`||!u2(e.pid))return null;i=e}catch{return null}if(i.hostname!==y())return null;if(!l2(i.pid)){try{f(r)}catch{}return null}return i}function w2(e){let{lockName:t,lockDir:n}=e,r=h2(n,t);if(!c(r))return{status:`absent`};let i;try{i=JSON.parse(d(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!u2(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(o.hostname!==y())return{status:`stale`,lock:o};if(!l2(o.pid)){try{f(r)}catch{}return{status:`stale`,lock:o}}return o.protocolVersion===void 0||o.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:o}}function T2(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=h2(n,t);if(v2(i)&&c(i))try{let e=JSON.parse(d(i,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||typeof e.hostname==`string`&&e.hostname!==y())return;f(i)}catch(e){console.warn(`${r} Failed to release ${i}: ${e instanceof Error?e.message:String(e)}`)}}var E2=class extends m2{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function D2(e,t){try{return b2({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof m2&&e.lockName===`server`?new E2(e.existing,e.lockPath):e}}function O2(e,t){S2({lockName:`server`,lockDir:e,port:t})}function k2(e){return C2({lockName:`server`,lockDir:e})}function A2(e){T2({lockName:`server`,lockDir:e})}export{xG as $,sc as $i,O1 as $n,fG as $r,m$ as $t,Gq as A,Zc as Ai,y1 as An,d0 as Ar,LQ as At,n0 as B,oc as Bi,Pq as Bn,UZ as Br,pK as Bt,PQ as C,ft as Ca,Lc as Ci,PG as Cn,Z0 as Cr,$Q as Ct,NQ as D,bl as Di,B1 as Dn,L0 as Dr,j1 as Dt,wQ as E,xl as Ei,t$ as En,o2 as Er,A1 as Et,rG as F,Qc as Fi,Cq as Fn,I0 as Fr,QG as Ft,Y1 as G,j as Gi,f$ as Gn,U0 as Gr,x$ as Gt,J1 as H,Rs as Hi,F0 as Hn,sQ as Hr,w$ as Ht,e0 as I,Yc as Ii,Tq as In,T0 as Ir,C1 as It,gG as J,$s as Ji,m1 as Jn,_q as Jr,b$ as Jt,q1 as K,Tc as Ki,g1 as Kn,Lq as Kr,C$ as Kt,i0 as L,Hc as Li,Aq as Ln,s2 as Lr,T1 as Lt,WQ as M,ll as Mi,_1 as Mn,pG as Mr,r$ as Mt,zq as N,ol as Ni,U1 as Nn,VW as Nr,i$ as Nt,CQ as O,hl as Oi,W1 as On,WX as Or,qQ as Ot,QW as P,pl as Pi,Uq as Pn,G0 as Pr,l$ as Pt,SG as Q,N as Qi,f1 as Qn,eG as Qr,p$ as Qt,r0 as R,Uc as Ri,kq as Rn,hq as Rr,L$ as Rt,TQ as S,pt as Sa,zc as Si,N0 as Sn,X0 as Sr,JG as St,FQ as T,Fc as Ti,e$ as Tn,V0 as Tr,k1 as Tt,Z1 as U,Bs as Ui,R$ as Un,JJ as Ur,v$ as Ut,$1 as V,P as Vi,K1 as Vn,fQ as Vr,XQ as Vt,X1 as W,M as Wi,Qq as Wn,sq as Wr,S$ as Wt,CG as X,qs as Xi,u1 as Xn,Fq as Xr,h$ as Xt,wG as Y,F as Yi,h1 as Yn,MG as Yr,y$ as Yt,bG as Z,A as Zi,d1 as Zn,mK as Zr,_$ as Zt,B0 as _,on as _a,Cf as _i,a1 as _n,jQ as _r,HQ as _t,b2 as a,_s as aa,SQ as ai,c$ as an,F1 as ar,G$ as at,O$ as b,O as ba,Bc as bi,A0 as bn,YW as br,q$ as bt,u2 as c,da as ca,S0 as ci,hG as cn,j$ as cr,$G as ct,w2 as d,ai as da,c2 as di,Wq as dn,n1 as dr,NG as dt,Oc as ea,zW as ei,WZ as en,E1 as er,Bq as et,k2 as f,vr as fa,ZW as fi,Jq as fn,r1 as fr,EG as ft,O2 as g,mn as ga,Ny as gi,i1 as gn,o$ as gr,a$ as gt,S2 as h,fn as ha,gq as hi,s$ as hn,Yq as hr,t1 as ht,E2 as i,Hs as ia,WW as ii,jG as in,z1 as ir,W$ as it,GQ as j,vl as ji,S1 as jn,mG as jr,jW as jt,MQ as k,Wc as ki,v1 as kn,p0 as kr,IQ as kt,h2 as l,Ua as la,dq as li,X$ as ln,M$ as lr,AG as lt,A2 as m,un as ma,LW as mi,$$ as mn,Xq as mr,e1 as mt,f2 as n,k as na,IG as ni,P$ as nn,N1 as nr,RQ as nt,D2 as o,Vo as oa,Q0 as oi,FG as on,I1 as or,H$ as ot,T2 as p,cn as pa,aQ as pi,Q$ as pn,kG as pr,d$ as pt,yG as q,Zs as qi,p1 as qn,NW as qr,Zq as qt,p2 as r,Ys as ra,xQ as ri,N$ as rn,R1 as rr,zQ as rt,l2 as s,zo as sa,K0 as si,LG as sn,P1 as sr,U$ as st,m2 as t,tc as ta,IW as ti,I$ as tn,L1 as tr,Hq as tt,C2 as u,Wa as ua,FW as ui,J$ as un,A$ as ur,RG as ut,DG as v,Lt as va,I as vi,ZG as vn,DW as vr,VQ as vt,EQ as w,Ic as wi,vG as wn,_G as wr,V$ as wt,k$ as x,D as xa,Rc as xi,j0 as xn,qq as xr,OG as xt,YG as y,Tt as ya,yl as yi,XG as yn,EW as yr,K$ as yt,t0 as z,Ns as zi,Mq as zn,XW as zr,TG as zt};
428
- //# sourceMappingURL=server-lock-BpjJj3OD-0F8DEGbQ.mjs.map
427
+ `)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=zZ(i.attributes??[]);if(!i.children||i.children.length===0)return s?c?`<${s} ${c} />`:`<${s} />`:``;let l=c?`<${s} ${c}>`:`<${s}>`,u=`</${s}>`;return`${l}\n\n${n.containerFlow({type:`root`,children:i.children},r)}\n\n${u}`},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),o+=i.move(`==`),a(),o},comment(e,t,n,r){let i=e.data?.sourceForm,a=i===`html`?`<!-- `:`%%`,o=i===`html`?` -->`:`%%`,s=n.createTracker(r),c=n.enter(`comment`),l=s.move(a);return l+=n.containerPhrasing(e,{before:l,after:o,...s.current()}),l+=s.move(o),c(),l},commentBlock(e,t,n,r){let i=n.createTracker(r),a=n.enter(`commentBlock`),o=e.children??[],s=e.data?.sourceForm,c=e.data?.sourceLayout,l=o.length===1&&o[0]?.type===`paragraph`;if(s===`html`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`<!-- `,after:` -->`,...i.current()});return a(),`<!-- ${t} -->`}if(c===`inline`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`%% `,after:` %%`,...i.current()});return a(),`%% ${t} %%`}let u=n.containerFlow(e,i.current());return a(),`%%\n\n${u}\n\n%%`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;if(typeof t==`string`)return t;let n=e.name??``,r=zZ(e.attributes??[]);return r?`<${n} ${r} />`:`<${n}/>`},rawMdxFallback(e){return e.value??``},blockquote(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.containerFlow(e,a.current());i();let s=e.data?.sourceMarkerSpacings,c=0;return n.indentLines(o,(e,t,n)=>n?`>`:s?.[c++]===`none`?`>${e}`:`> ${e}`)}};function zZ(e){let t=[];for(let n of e){if(n.type===`mdxJsxExpressionAttribute`){t.push(`{${n.value}}`);continue}let e=n.name;if(n.value===null||n.value===void 0){t.push(e);continue}if(typeof n.value==`string`){if(n.value.includes(`"`)){let r=n.value.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`);t.push(`${e}={"${r}"}`)}else t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function BZ(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function VZ(e){if(!e)return``;let t=0,n=!0;for(let r of e)r===`(`?t++:r===`)`&&(t--,t<0&&(n=!1));return t!==0&&(n=!1),n?e:e.replace(/[\\()]/g,`\\$&`)}function HZ(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>UZ(t)?e:`\\${e}`)}function UZ(e){if(e.charCodeAt(0)!==35)return!1;let t=e[1]===`x`||e[1]===`X`?Number.parseInt(e.slice(2),16):Number.parseInt(e.slice(1),10);return t===9||t===10||t===11||t===12||t===13||t===32}function WZ(e,t,n){let r=e.unsafe;e.unsafe=r.filter(e=>!(e.character===`&`&&e.after===`[#A-Za-z]`||e.character===`<`||e.character===`[`||e.character===`(`||e.character==="`"));let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return HZ(i)}function GZ(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var KZ=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};constructor(e){this.schema=Ny(e.extensions),this.handlers=nQ(this.schema,this.parseCtx);let{nodeHandlers:t,markHandlers:n}=rQ(this.schema);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=kZ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=AZ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers,toMarkdownHandlers:RZ})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return jZ(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?MZ(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?eY(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e){let t;try{t=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}return NZ(t,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}};const qZ=UJ();function JZ(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else i?.type===`boolean`?r[e]=t.value===`true`:r[e]=t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function YZ(e){let t=!1;return e.descendants(e=>t||e.type.name===`jsxInline`?!1:e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function XZ(e){return e.attrs.sourceDirty||YZ(e)}function ZZ(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0?!0:t.every(e=>e.type===`text`&&e.value===``)}function QZ(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),Object.keys(n).length===0?e:{...e,data:n}}function $Z(e,t){if(e.length===0)return QZ({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return QZ({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[$Z(n.children,t)]}}return QZ({type:`inlineCode`,value:eQ(e)},t)}function eQ(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=eQ(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const tQ=UG;function nQ(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=GL(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=GL(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null;return n.table.createAndFill({sourceDashCounts:s},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=LZ(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i){let t=n.replaceAll(`\xA0`,` `);return r.sourceLiteral?e.text(t,[r.sourceLiteral.create({sourceRaw:i})]):e.text(t)}let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n.replaceAll(`\xA0`,` `));let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[],l=0;for(let t of s){if(t.offset>l){let r=n.slice(l,t.offset).replaceAll(`\xA0`,` `);r&&c.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length).replaceAll(`\xA0`,` `);i&&(t.kind===`escape`?c.push(e.text(i,[r.escapeMark.create()])):r.sourceLiteral?c.push(e.text(i,[r.sourceLiteral.create({sourceRaw:t.raw})])):c.push(e.text(i))),l=t.offset+t.length}}if(l<n.length){let t=n.slice(l).replaceAll(`\xA0`,` `);t&&c.push(e.text(t))}return c.length===1?c[0]:c}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1})]));let a=r.strike??r.delete;if(a&&(i.delete=KL(a)),r.highlight&&(i.mark=KL(r.highlight)),r.comment&&(i.comment=KL(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=GL(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=KL(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=KL(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=GL(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`})),n.list&&(i.list=GL(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=GL(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:``,title:null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=qZ.getOrWildcard(o),c=JZ(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=LZ(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=lq(o),{resolveEmbed:u,sourcePath:d}=t.current,f=u&&d?u(o,d)??null:null,p=f?`/${f}`:o,m=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(m&&tQ.has(l)&&n.jsxComponent&&qZ.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,alt:s??o,target:o,anchor:c,alias:s}});if(m&&WG.has(l)&&n.jsxComponent&&qZ.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&KG.has(l)&&n.jsxComponent&&qZ.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&qG.has(l)&&n.jsxComponent&&qZ.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:GZ(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(eK.has(l)&&r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}if(r.link){let t=r.link.create({href:o,title:null,linkStyle:`inline`,refLabel:null});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=GL(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function rQ(e){let t={},n={},r=e.nodes,i=e.marks;r.paragraph&&(t.paragraph=ZL(`paragraph`)),r.blockquote&&(t.blockquote=ZL(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),r.heading&&(t.heading=ZL(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0}}))),r.codeBlock&&(t.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t}}}),r.thematicBreak&&(t.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),r.hardBreak&&(t.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle}})),r.list&&(t.list=ZL(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),r.listItem&&(t.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&ZZ(r[0])?r.slice(1):r;return{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,children:i}}),r.table&&(t.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c=Array.isArray(s)&&s.length>0?{sourceDashCounts:s}:void 0,l={type:`table`,align:i,children:o};return c&&(l.data=c),l}),r.tableRow&&(t.tableRow=ZL(`tableRow`));let a=e=>{let t=e.attrs.sourcePadding,n={};return typeof t==`object`&&t&&typeof t.left==`number`&&typeof t.right==`number`&&(n.sourcePadding=t),Object.keys(n).length>0?{data:n}:{}};if(r.tableCell&&(t.tableCell=ZL(`tableCell`,a)),r.tableHeader&&(t.tableHeader=ZL(`tableCell`,a)),r.image&&(t.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),r.imageReference&&(t.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),r.htmlBlock&&(t.htmlBlock=e=>({type:`html`,value:e.attrs.content})),r.linkDefinition??r.linkRefDef){let e=r.linkDefinition?`linkDefinition`:`linkRefDef`;t[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(r.jsxComponent&&(t.jsxComponent=(e,t,n)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let r=e.attrs.componentName||null,i=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!XZ(e)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:r,attributes:i,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:qZ.getOrWildcard(r??`*`).serialize(e,{all:e=>n.all(e),registry:qZ,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),r.rawMdxFallback&&(t.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),r.jsxInline&&(t.jsxInline=e=>{let t=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),r.mathInline&&(t.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;return typeof n==`string`&&n.length>0?{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]}:{type:`inlineMath`,value:t}}),r.wikiLink&&(t.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),r.tag&&(t.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),r.wikiLinkEmbed&&(t.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),i.emphasis&&(n.emphasis=QL(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.strong&&(n.strong=QL(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.code&&(n.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return $Z(n,{sourceFenceChar:r,sourceFenceLength:i})}),i.strike??i.delete){let e=i.strike?`strike`:`delete`;n[e]=QL(`delete`)}return i.highlight&&(n.highlight=QL(`mark`)),i.comment&&(n.comment=QL(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),r.commentBlock&&(t.commentBlock=ZL(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),r.footnoteReference&&(t.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),r.footnoteDefinition&&(t.footnoteDefinition=ZL(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),i.link&&(n.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,n=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,r=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),i.escapeMark&&(n.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data=t.data??{},t.data.escapedChars=t.data.escapedChars??[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),i.sourceLiteral&&(n.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return ZK(t,e.value)&&(e.data=e.data??{},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:t,markHandlers:n}}const iQ=/\p{M}+/gu,aQ=/[^\p{L}\p{N}]+/gu,oQ=/^-+|-+$/g;function sQ(e){return e.trim().normalize(`NFKD`).replace(iQ,``).toLowerCase().replace(aQ,`-`).replace(oQ,``)}function cQ(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function lQ(e,t){let n=sQ(e);return n?cQ(n,t):``}const uQ=VB(),dQ=aB(),fQ=oB();function pQ(){return VJ.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function mQ(){return pQ().filter(e=>hQ(e)!==`fence`)}function hQ(e){return e.name===`MermaidFence`?`fence`:e.hasChildren?`jsx-block`:`jsx-void`}function gQ(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:hQ(e)}}function _Q(e){if(e.hidden!==!0&&e.type!==`reactnode`){if(`defaultValue`in e&&e.defaultValue!==void 0)return e.defaultValue;if(e.type===`enum`)return e.enumValues[0];if(e.type===`string`)return``;if(e.type===`number`)return 0;if(e.type===`boolean`)return!1}}function vQ(e,t){return!(e.omitOnDefault===!0&&`defaultValue`in e&&Object.is(e.defaultValue,t)||e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&t===``)}function yQ(e){let t=[];for(let n of e.props){let e=_Q(n);e!==void 0&&vQ(n,e)&&t.push(eJ(n.name,e))}return t}function bQ(e){return pz(e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`Body content here.`,{extensions:[uQ],mdastExtensions:[dQ]}).children}function xQ(e){let t=hQ(e),n;if(t===`fence`)n={type:`code`,lang:`mermaid`,meta:null,value:e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`graph LR
428
+ A --> B`};else{let r=yQ(e),i=t===`jsx-block`?bQ(e):[];n={type:`mdxJsxFlowElement`,name:e.name,attributes:r,children:i}}return oP({type:`root`,children:[n]},{extensions:[fQ]}).trimEnd()}function SQ(e){let t=[];for(let n of e.props){if(n.hidden===!0)continue;let e={name:n.name,type:n.type,required:n.required};n.description!==void 0&&(e.description=n.description),n.advanced===!0&&(e.advanced=!0),n.omitOnDefault===!0&&(e.omitOnDefault=!0),n.type===`enum`&&(e.values=n.enumValues,n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue)),n.type===`string`&&(n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.language!==void 0&&(e.language=n.language),n.accept!==void 0&&(e.accept=n.accept)),n.type===`boolean`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.type===`number`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),t.push(e)}return t}function CQ(e){return{...gQ(e),example:xQ(e),params:SQ(e)}}function wQ(){return[``,"**Custom canonical components.** OK `.md` / `.mdx` supports the JSX components below — use whichever is semantically useful in any part of the doc. For full source syntax + parameter schemas, call `palette({ components: [ids] })` with the ids you want to use. Fenced code blocks render naturally and don't need a fetch — including ` ```mermaid ` for diagrams and ` ```html preview ` for interactive HTML/JS/CSS pages (the fence info-string `preview` token renders the block as a live iframe; works for `html` / `htm` / `xml`; optional `h=` / `w=` tokens set size, e.g. ` ```html preview h=400px `). Use ` ```html preview ` whenever you want anything interactive or JS-powered (charts, demos, calculators, animations) — just author the standalone HTML page in the fence. Call `palette` for the markdown-native component forms (write `> [!NOTE]`, not `<Callout>`), copy-ready themed `html preview` starters, and the theme tokens (`var(--chart-1)`, `var(--foreground)`, …) an embed should reference so it tracks the reader's light/dark theme. Arbitrary `<TagName>` JSX falls through as raw MDX when no canonical fits.",``,...mQ().map(gQ).map(e=>`- \`${e.id}\` (${e.kind}) — ${e.description}`)].join(`
429
+ `)}const TQ=N({docName:yq,summary:xq,content:k().optional(),...bq}).loose(),EQ=N({docName:yq,summary:xq,markdown:k(),position:P([`append`,`prepend`,`replace`]).optional(),extension:P([`.md`,`.mdx`]).optional(),...bq}).loose(),DQ=N({docName:yq,summary:xq,find:k().min(1),replace:k(),offset:A().int().nonnegative().optional(),...bq}).loose(),OQ=N({docName:yq,connectionId:k().min(1),scope:P([`last`,`session`,`file`]).optional(),...bq}).loose(),kQ=N({value:k(),truncatedFrom:A().int().nonnegative().optional(),hint:k().optional()}).loose(),AQ=Zs(`kind`,[N({kind:F(`inline`),content:k()}),N({kind:F(`truncated`),byteLength:A().int().nonnegative(),hint:k()})]),jQ=N({kind:F(`content-divergence`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),divergenceType:k().optional(),currentState:AQ.optional(),hint:k().optional()}).loose(),MQ=N({type:F(`orphan`),parentCandidates:M(k()),message:k()}).loose(),NQ=Zs(`kind`,[jQ,N({kind:F(`disk-edit-reconciled`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),hint:k().optional()}).loose()]),PQ=N({timestamp:k().min(1),summary:kQ.optional(),warning:NQ.optional()}).loose(),FQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),hints:M(MQ).optional(),summary:kQ.optional(),warning:NQ.optional()}).loose(),IQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),summary:kQ.optional(),warning:NQ.optional()}).loose(),LQ=N({docName:k().min(1),scope:P([`last`,`session`]),undone:j()}).loose(),RQ=N({docName:yq,patch:tc(k(),Ys([jW,Rs()])),types:tc(k(),P(AW)).optional(),summary:xq,...bq}).loose(),zQ=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),appliedKeys:M(k()),summary:kQ.optional(),warning:NQ.optional()}).loose(),BQ=N({entries:M(N({level:P([`info`,`warn`,`error`]),message:k().max(8192),event:k().optional(),fields:tc(k(),Hs()).optional(),ts:A().optional(),sourceId:k().optional(),lineNumber:A().optional()}).loose()).max(100)}).loose(),VQ=N({accepted:A().int().min(0)}).loose(),HQ=N({status:k().min(1),reason:k()}).loose(),UQ=N({docName:k().min(1),content:k(),lifecycle:HQ.nullable()}).loose(),WQ=N({documents:M(N({kind:P([`document`,`asset`,`folder`]).default(`document`),docName:k().min(1).optional(),docExt:k().min(1).default(`.md`),size:A().int().nonnegative(),modified:k().min(1),isSymlink:j().default(!1),canonicalDocName:k().nullable().default(null),targetPath:k().nullable().default(null),path:k().min(1).optional(),assetExt:k().min(1).optional(),mediaKind:P([`image`,`video`,`audio`,`pdf`,`text`]).nullable().optional(),referencedBy:M(k().min(1)).optional(),hasChildren:j().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName)`})),truncated:j().optional()}).loose(),GQ=N({source:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),KQ=N({docName:k().min(1),backlinks:M(GQ)}).loose(),qQ=N({counts:tc(k().min(1),A().int().nonnegative())}).loose(),JQ=Zs(`kind`,[N({kind:F(`doc`),docName:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),N({kind:F(`external`),url:k().min(1),title:k(),snippet:k().nullable()}).loose()]),YQ=N({docName:k().min(1),forwardLinks:M(JQ)}).loose(),XQ=Zs(`kind`,[N({id:k().min(1),kind:F(`doc`),docName:k().min(1),anchor:k().nullable(),label:k(),cluster:k().nullable(),category:k().nullable(),tags:M(k()).nullable()}).loose(),N({id:k().min(1),kind:F(`external`),url:k().min(1),label:k()}).loose()]),ZQ=N({source:k().min(1),target:k().min(1)}).loose(),QQ=N({nodes:M(XQ),links:M(ZQ)}).loose(),$Q=N({ts:A().int().min(0),url:k(),method:k(),ua:k().optional(),origin:k().optional(),referer:k().optional(),host:k().optional(),remote:k().optional(),secChUa:k().optional(),secChUaMobile:k().optional(),secChUaPlatform:k().optional(),secFetchSite:k().optional(),secFetchDest:k().optional(),secFetchMode:k().optional(),secFetchUser:k().optional()}).loose(),e$=N({app:Ys([F(`cursor`),F(`codex`),F(`claude`),Rs()]),signals_fired:M(k())}).loose(),t$=N({entries:M($Q),count:A().int().min(0),detection:e$}).loose(),n$=N({writers:M(N({id:k().min(1),name:k().optional(),email:k().optional()}).loose()).optional(),summary:xq,...bq}).loose(),r$=N({checkpointRef:k().min(1)}).loose(),i$=N({v:A().int().optional(),id:k().min(1),name:k().min(1),colorSeed:k().optional(),docs:M(k()),summaries:M(k()).optional()}).loose(),a$=N({entries:M(N({sha:k().min(1),timestamp:k().min(1),author:k(),authorEmail:k(),type:P([`checkpoint`,`wip`,`upstream`,`park`]),message:k(),contributors:M(i$),checkpoint:Hs().nullable()}).loose()),total:A().int().nonnegative().optional(),truncated:j().optional()}).loose(),o$=N({sha:k().regex(/^[0-9a-f]{40}$/i),content:k(),timestamp:k(),author:k()}).loose(),s$=N({lines:M(N({type:P([`added`,`removed`,`unchanged`]),text:k()}).loose()),additions:A().int().nonnegative(),deletions:A().int().nonnegative()}).loose(),c$=N({contentDir:k().min(1),pathSeparator:P([`/`,`\\`]),symlinkResolved:j()}).loose(),l$=M(Zs(`source`,[N({docName:k().min(1),timestamp:k().min(1),size:A().int().nonnegative(),source:F(`flat`)}).loose(),N({docName:k().min(1),timestamp:k().min(1),source:F(`timeline`),sha:k().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),u$=N({orphans:M(N({docName:k().min(1),title:k()}).loose())}).loose(),d$=N({hubs:M(N({docName:k().min(1),title:k(),count:A().int().nonnegative()}).loose())}).loose(),f$=N({source:k().min(1),title:k(),snippet:k().nullable()}).loose(),p$=N({deadLinks:M(N({target:k().min(1),sources:M(f$)}).loose())}).loose(),m$=N({target:N({docName:k().min(1),title:k(),aliases:M(k())}).loose(),mentions:M(N({source:k().min(1),excerpt:k(),offset:A().int().nonnegative()}).loose()),truncated:j()}).loose(),h$=N({dir:k().min(1),port:A().int().min(1).max(65535).optional()}).loose(),g$=N({port:A().int().positive()}).loose(),_$=N({projectPath:k().min(1)}).loose(),v$=P([`not-a-git-worktree`,`init-failed`]),y$=Zs(`ok`,[N({ok:F(!0),projectPath:k().min(1)}).loose(),N({ok:F(!1),reason:v$,message:k().min(1)}).loose()]),b$=N({host:k().min(1).optional()}).loose(),x$=N({key:k().min(1)}).loose(),S$=N({keyPresent:j()}).loose(),C$=N({name:k().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:k().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),w$=N({authenticated:j()}).loose(),T$=N({}).loose(),E$=N({stackIndex:A().int().min(0),ts:A().int().min(0),additions:A().int().min(0),deletions:A().int().min(0)}).loose(),D$=N({docName:k().min(1),additionsTotal:A().int().min(0),deletionsTotal:A().int().min(0),lastTs:A().int().min(0),bursts:M(E$)}).loose(),O$=N({displayName:k().min(1),color:k().min(1),icon:k().optional(),connectionId:k().min(1)}).loose(),k$=N({sessionAlive:j(),agent:O$.nullable(),files:M(D$)}).loose(),A$=N({diff:k(),generatedAt:A().int().min(0)}).loose(),j$=N({}).loose(),M$=N({}).loose(),N$=N({}).loose(),P$=N({}).loose(),F$=N({}).loose(),I$=N({displayName:k().min(1),icon:k(),color:k().min(1),currentDoc:k().nullable(),mode:P([`idle`,`writing`]),ts:A().int().min(0)}).loose(),L$=N({presence:tc(k().min(1),I$)}).loose(),R$=tc(k().min(1),j()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});N({path:k().min(1,`path must be non-empty`)}).loose();const z$=N({}).loose(),B$=N({fromDocName:k().min(1),toDocName:k().min(1)}).loose(),V$=N({fromPath:k().min(1),toPath:k().min(1)}).loose(),H$=N({}).loose(),U$=N({path:k().min(1),...bq,summary:xq}).loose(),W$=N({docName:k().min(1)}).loose(),G$=N({path:k().min(1),...bq,summary:xq}).loose(),K$=N({path:k().min(1)}).loose(),q$=N({kind:P([`file`,`folder`]),path:k().min(1),...bq,summary:xq}).loose(),J$=N({kind:P([`file`,`folder`]),path:k().min(1),duplicatedDocNames:M(k().min(1))}).loose(),Y$=N({pages:M(N({docName:k().min(1),title:k(),docExt:k().min(1),size:A().int().nonnegative(),modified:k().min(1),icon:k().min(1).max(2048).optional()}).loose())}).loose(),X$=N({level:A().int().min(1).max(6),text:k(),slug:k()}).loose(),Z$=N({docName:k().min(1),headings:M(X$)}).loose(),Q$=N({docName:k().min(1),rewrites:A().int().nonnegative()}).loose(),$$=N({kind:P([`file`,`folder`,`asset`]),fromPath:k().min(1),toPath:k().min(1),...bq,summary:xq}).loose(),e1=N({renamed:M(B$),renamedAssets:M(V$),rewrittenDocs:M(Q$).optional(),summary:kQ.optional()}).loose(),t1=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...bq}).loose(),n1=N({deletedDocNames:M(k().min(1))}).loose(),r1=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...bq,summary:xq}).loose(),i1=N({deletedDocNames:M(k().min(1))}).loose(),a1=N({docName:k().min(1),commitSha:k().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:xq,...bq}).loose(),o1=N({restoredFrom:k().min(1),timestamp:k().min(1),summary:kQ.optional(),warning:jQ.optional()}).loose(),s1=P([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),c1=N({label:k().min(1),webUrl:_s().nullable()}).loose(),l1=Zs(`checkStatus`,[N({checkStatus:F(`allowed`)}).loose(),N({checkStatus:F(`denied`),deniedReason:P([`no-collaborator`,`private-no-access`,`repo-not-found`])}).loose(),N({checkStatus:F(`unknown`),unknownError:P([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`]).optional()}).loose()]),u1=P([`auth-403`,`auth-401`,`auth-scope-mismatch`,`semantic-protected-branch`]),d1=N({state:s1,lastSyncUtc:k().nullable(),lastFetchUtc:k().nullable(),lastPushedSha:k().nullable(),ahead:A().int().min(0),behind:A().int().min(0),consecutiveFailures:A().int().min(0),conflictCount:A().int().min(0),hasRemote:j(),syncEnabled:j(),identityUnresolved:j(),remote:c1.nullable().optional(),pushError:k().optional(),pushErrorCode:u1.optional(),pullError:k().optional(),pullErrorCode:u1.optional(),pausedReason:k().optional(),pushPermission:l1.optional()}).loose(),f1=N({op:P([`sync`,`push`,`pull`]).optional()}).loose(),p1=N({op:P([`sync`,`push`,`pull`])}).loose(),m1=N({conflicts:M(N({file:k().min(1),detectedAt:k().min(1),oursSha:k().optional(),theirsSha:k().optional(),baseSha:k().optional()}).loose())}).loose(),h1=N({file:k().min(1),strategy:P([`mine`,`theirs`,`content`,`delete`]),content:k().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),g1=N({}).loose(),_1=N({file:k().min(1),base:k(),ours:k(),theirs:k(),kind:P([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:k().nullable()}).loose(),v1=N({plan:Tc(e=>e!==void 0,{message:`plan is required`})}).loose(),y1=N({plan:Tc(e=>e!==void 0,{message:`plan is required`})}).loose(),b1=N({result:Tc(e=>e!==void 0,{message:`result is required`})}).loose(),x1=N({path:k().min(1),summary:k().min(1)}).loose(),S1=N({files:A().int().nonnegative(),folders:A().int().nonnegative()}).loose(),C1=N({packs:M(N({id:k().min(1),name:k().min(1),description:k().min(1),defaultSubfolder:k().optional(),folders:M(x1),entryCounts:S1}).loose())}).loose(),w1=N({noOpen:j().optional(),out:k().min(1).optional()}).loose(),T1=N({reason:P([`unsupported-platform`,`spawn-error`]),message:k()}).loose(),E1=Zs(`status`,[N({status:F(`installed`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k()}).loose(),N({status:F(`built`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k(),handoffError:T1.optional()}).loose(),N({status:F(`failed`),buildError:k()}).loose(),N({status:F(`skip-current`),skillVersion:k(),recordedAt:k().optional()}).loose()]),D1=N({tags:M(N({name:k().min(1),count:A().int().nonnegative(),isLeaf:j()}).loose())}).loose(),O1=N({docName:k().min(1),title:k(),matchingTags:M(k().min(1)),snippet:k().nullable()}).loose(),k1=N({name:k().min(1),docs:M(O1)}).loose(),A1=N({folder:Hs(),frontmatter_local:tc(k(),Hs()).nullable()}).loose(),j1=N({path:k(),frontmatter:tc(k(),Hs()).optional()}).loose(),M1=N({applied:Hs()}).loose(),N1=tc(k(),Hs()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),P1=N({template:N({name:k().min(1),folder:k(),scope:P([`local`,`inherited`]),path:k().min(1),frontmatter:N1,body:k()}).strict()}).strict(),F1=N({templates:M(N({name:k().min(1),title:k().optional(),description:k().optional(),path:k().min(1),source_folder:k()}).strict()),truncated:j()}).strict(),I1=N({folder:k(),name:k(),body:k().optional(),frontmatter:N1.optional(),...bq,summary:xq}).strict(),L1=N({path:k().min(1),created:j(),warnings:M(k())}).strict(),R1=N({existed:j(),path:k().min(1)}).strict(),z1=N({fromFolder:k(),fromName:k(),toFolder:k(),toName:k(),body:k().optional(),frontmatter:N1.optional(),...bq,summary:xq}).strict(),B1=N({from:k().min(1),to:k().min(1),committed:j()}).strict(),V1=N({query:k().optional(),intent:P([`autocomplete`,`full_text`,`omnibar`]).optional(),scopes:M(P([`page`,`folder`,`content`])).optional(),scope:k().optional(),limit:A().int().nonnegative().optional(),semantic:j().optional()}).loose(),H1=N({kind:P([`page`,`folder`,`content`]),path:k().min(1),title:k(),score:A(),signals:tc(k(),Hs()),snippet:k().optional()}).loose(),U1=N({capable:j(),applied:j(),coverage:N({embedded:A().int().nonnegative(),total:A().int().nonnegative()})}).loose(),W1=N({enabled:j(),keyPresent:j(),keySource:P([`file`,`env`]).nullable(),ready:j(),capable:j(),embedded:A().int().nonnegative(),total:A().int().nonnegative()}).loose(),G1=N({query:k(),intent:P([`autocomplete`,`full_text`,`omnibar`]),results:M(H1),elapsedMs:A().nonnegative(),semantic:U1.optional()}).loose(),K1=N({version:k().min(1),recordedAt:k().min(1)}).loose(),q1=N({currentVersion:k().min(1),targets:tc(k(),K1.nullable())}).loose(),J1=`server-info`,Y1=`branch-switched`,X1=`disk-ack`,Z1=`config-validation-rejected`,Q1=`config-ignore-nested-error`,$1=P([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),e0=N({v:F(1),ch:F(J1),seq:A(),serverInstanceId:k().min(1),currentBranch:k().min(1).optional()}).loose(),t0=N({v:F(1),ch:F(Y1),seq:A(),branch:k().min(1)}).loose(),n0=N({v:F(1),ch:$1,seq:A()}).loose(),r0=N({v:F(1),ch:F(X1),seq:A(),docName:k().min(1),sv:k().min(1)}).loose(),i0=N({v:F(1),ch:F(Z1),seq:A(),docName:k().min(1),error:al}).loose(),a0=N({v:F(1),ch:F(Q1),seq:A(),path:k().min(1),error:k().min(1)}).loose(),o0={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},s0=new WeakMap;function c0(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function l0(e){return e.trim().toLowerCase()}function u0(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function d0(e){return e.split(`/`).filter(Boolean).join(` `)}function f0(e){let t=u0(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0;return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:d0(e.path),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function p0(e){let t=jU({schema:o0});return e.length>0&&HU(t,e),t}function m0(e){let t={documents:e};return s0.set(t,p0(e)),t}function h0(e){let t=s0.get(e);if(t)return t;let n=p0(e.documents);return s0.set(e,n),n}function g0(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`]:[`page`,`folder`]}function _0(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function v0(e,t){let n=l0(t);if(!n)return 0;let r=l0(e.title),i=l0(e.name),a=l0(e.path),o=a.split(`/`);return r===n||i===n?700:a===n?650:r.startsWith(n)||i.startsWith(n)?600:o.some(e=>e.startsWith(n))?550:r.includes(n)||i.includes(n)?500:a.includes(n)?450:-1}function y0(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function b0(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function x0(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}function S0(e,t){return l0(t).length<4?0:e===`full_text`?1:0}function C0(e,t,n={}){let r=n.intent??`omnibar`,i=c0(n.limit),a=new Set(n.scopes??g0(r)),o=e.documents.filter(e=>_0(e,a)),s=l0(t);if(!s)return o.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,i).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let c=vW(h0(e),{term:s,properties:b0(r),boost:x0(r),tolerance:S0(r,s),limit:Math.max(i*4,40)}),l=new Map(c.hits.filter(e=>_0(e.document,a)).map(e=>[e.document.id,e.score])),u=y0(o),d=new Map;for(let e of o)v0(e,s)>=0&&d.set(e.id,e);for(let e of c.hits)_0(e.document,a)&&d.set(e.document.id,e.document);return n.semantic?T0({scopedDocuments:o,candidates:d,fullTextScores:l,recency:u,normalizedQuery:s,semantic:n.semantic,limit:i}):[...d.values()].map(e=>{let t=Math.max(0,v0(e,s)),n=l.get(e.id)??0,r=u.get(e.id)??0;return{document:e,score:t+n*20+r,signals:{lexical:t,fullText:n,recency:r}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score).slice(0,i)}function w0(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function T0(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,semantic:o,limit:s}=e,c=o.rrfK??60,l=o.candidateLimit??64,u=o.similarityFloor??.35,d=o.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=[...n.values()].map(e=>{let t=Math.max(0,v0(e,a)),n=r.get(e.id)??0,o=i.get(e.id)??0,s=d.get(e.id),c=s!==void 0&&s>=u;return{document:e,score:t+n*20+o,signals:c?{lexical:t,fullText:n,recency:o,vector:s}:{lexical:t,fullText:n,recency:o},lexical:t,fullText:n,recency:o,cosine:s}}),h=w0(m.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),g=w0(m.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=e=>{let t=0,n=h.get(e);n!==void 0&&(t+=1/(c+n));let r=g.get(e);return r!==void 0&&(t+=1/(c+r)),t};return m.sort((e,t)=>{let n=e.lexical>0?1:0,r=t.lexical>0?1:0;if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=_(e.document.id),a=_(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n})).slice(0,s)}function E0(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),D0(n)}function D0(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const O0=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),k0=globalThis;k0[O0]===void 0&&(k0[O0]=Fi());const A0=k0[O0],j0=[`.ok`,`skill-state.yml`],M0=[`claude-cowork`,`cli-hosts`],N0=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],P0=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,F0=qs({version:k().regex(P0,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(A0,{description:`Recorded skill version for this target.`}),recordedAt:Vo().register(A0,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:P(N0).register(A0,{description:`Install-source surface that recorded this entry.`}).optional()}),I0=qs({schema:F(1).register(A0,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:qs({"claude-cowork":F0.optional(),"cli-hosts":F0.optional()}).register(A0,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({})});function L0(){return{schema:1,targets:{}}}function R0(){let e=!1,t=``,n=0;return r=>{let i=z0(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function z0(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}const B0=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],V0={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function H0(e,t=B0){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const U0={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function W0(e){return e?U0[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const G0={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function K0(e){let t=e?.trim();return t?G0[W0(t)]??t:`Agent`}function q0(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}const J0=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function Y0(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function X0(e){let t=e.trim();return J0.test(t)||t.startsWith(`//`)}function Z0(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(X0(n))return{kind:`external`,url:n};let r=q0(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=Y0(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function Q0(e,t){let n=e.trim();if(!n)return null;if(X0(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=Y0(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function $0(e,t){let n=e.trim();if(!n||J0.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function e2(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function t2(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function n2(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function r2(e){return e.split(`/`).filter(e=>e!==``)}function i2(e,t){let n=n2(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function a2(e,t){let n=n2(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:r2(r).length}function o2(e,t){let n=r2(e),r=r2(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function s2(){let e=new Map;function t(t){let n=e2(t);if(n===``)return;let r=t2(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=e2(t),r=t2(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=n2(e2(n)),o=[],s=[];for(let e of i)i2(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=a2(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=a2(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=o2(a,n2(t));for(let r=1;r<e.length;r++){let i=e[r],o=o2(a,n2(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function c2(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function l2(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}function u2(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function d2(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function f2(){try{let e=_(g(b(import.meta.url)),`..`,`package.json`),t=JSON.parse(d(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}const p2=f2(),m2=1;var h2=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`Open Knowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function g2(e,t){return _(e,`${t}.lock`)}const _2=new Map;function v2(e){_2.set(e,(_2.get(e)??0)+1)}function y2(e){let t=_2.get(e);return t===void 0||t<=1?(_2.delete(e),!0):(_2.set(e,t-1),!1)}function b2(e,t){try{let n=JSON.parse(d(e,`utf-8`));return n&&typeof n==`object`&&d2(n.pid)?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function x2(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;l(n,{recursive:!0});let a=g2(n,t),o={pid:process.pid,hostname:y(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??p2},d=JSON.stringify(o,null,2);for(let e=0;e<3;e++){if(!c(a))try{let e=u(a,`wx`,384);try{m(e,d)}finally{s(e)}return v2(a),S2({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=b2(a,i);if(e){let r=e.hostname===y();if(r&&e.pid===process.pid)return p(a,d,{encoding:`utf-8`,mode:384}),v2(a),S2({lockName:t,lockDir:n,lockPath:a});if(r&&u2(e.pid))throw new h2(e,a,t);console.warn(`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{f(a)}catch{}}throw Error(`${i} Failed to acquire ${a} after 3 attempts (concurrent acquire contention).`)}function S2(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>E2({lockName:t,lockDir:n}),updatePort:e=>C2({lockName:t,lockDir:n,port:e})}}function C2(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=g2(n,t);if(!c(a)){console.warn(`${i} Lock file missing at ${a} during port update — skipping`);return}let o;try{let e=JSON.parse(d(a,`utf-8`));if(!e||typeof e!=`object`||!d2(e.pid)){console.warn(`${i} Corrupt lock at ${a} during port update — skipping`);return}o=e}catch{console.warn(`${i} Unreadable lock at ${a} during port update — skipping`);return}if(o.pid===process.pid&&!(typeof o.hostname==`string`&&o.hostname!==y())){o.port=r;try{p(a,JSON.stringify(o,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function w2(e){let{lockName:t,lockDir:n}=e,r=g2(n,t);if(!c(r))return null;let i;try{let e=JSON.parse(d(r,`utf-8`));if(!e||typeof e!=`object`||!d2(e.pid))return null;i=e}catch{return null}if(i.hostname!==y())return null;if(!u2(i.pid)){try{f(r)}catch{}return null}return i}function T2(e){let{lockName:t,lockDir:n}=e,r=g2(n,t);if(!c(r))return{status:`absent`};let i;try{i=JSON.parse(d(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!d2(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(o.hostname!==y())return{status:`stale`,lock:o};if(!u2(o.pid)){try{f(r)}catch{}return{status:`stale`,lock:o}}return o.protocolVersion===void 0||o.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:o}}function E2(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=g2(n,t);if(y2(i)&&c(i))try{let e=JSON.parse(d(i,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||typeof e.hostname==`string`&&e.hostname!==y())return;f(i)}catch(e){console.warn(`${r} Failed to release ${i}: ${e instanceof Error?e.message:String(e)}`)}}var D2=class extends h2{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function O2(e,t){try{return x2({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof h2&&e.lockName===`server`?new D2(e.existing,e.lockPath):e}}function k2(e,t){C2({lockName:`server`,lockDir:e,port:t})}function A2(e){return w2({lockName:`server`,lockDir:e})}function j2(e){E2({lockName:`server`,lockDir:e})}export{xG as $,Oc as $i,D1 as $n,zW as $r,KZ as $t,Gq as A,vl as Ai,C1 as An,mG as Ar,zQ as At,r0 as B,P as Bi,q1 as Bn,mQ as Br,pK as Bt,IQ as C,Ic as Ci,vG as Cn,_G as Cr,t$ as Ct,FQ as D,hl as Di,G1 as Dn,WX as Dr,M1 as Dt,EQ as E,bl as Ei,V1 as En,R0 as Er,j1 as Et,rG as F,Yc as Fi,Tq as Fn,E0 as Fr,QG as Ft,X1 as G,Tc as Gi,_1 as Gn,Lq as Gr,w$ as Gt,Y1 as H,Bs as Hi,z$ as Hn,JJ as Hr,T$ as Ht,t0 as I,Hc as Ii,Aq as In,c2 as Ir,w1 as It,gG as J,F as Ji,g1 as Jn,MG as Jr,x$ as Jt,J1 as K,Zs as Ki,m1 as Kn,NW as Kr,Zq as Kt,a0 as L,Uc as Li,kq as Ln,hq as Lr,E1 as Lt,KQ as M,ol as Mi,W1 as Mn,VW as Mr,a$ as Mt,zq as N,pl as Ni,Uq as Nn,K0 as Nr,o$ as Nt,TQ as O,Wc as Oi,y1 as On,m0 as Or,YQ as Ot,QW as P,Qc as Pi,Cq as Pn,L0 as Pr,d$ as Pt,SG as Q,sc as Qi,k1 as Qn,fG as Qr,g$ as Qt,i0 as R,Ns as Ri,Mq as Rn,XW as Rr,R$ as Rt,DQ as S,ft as Sa,Lc as Si,PG as Sn,Q0 as Sr,JG as St,LQ as T,xl as Ti,r$ as Tn,s2 as Tr,A1 as Tt,Q1 as U,M as Ui,Qq as Un,sq as Ur,b$ as Ut,e0 as V,Rs as Vi,I0 as Vn,lQ as Vr,QQ as Vt,Z1 as W,j as Wi,m$ as Wn,W0 as Wr,C$ as Wt,CG as X,A as Xi,f1 as Xn,mK as Xr,y$ as Xt,wG as Y,qs as Yi,d1 as Yn,Fq as Yr,_$ as Yt,bG as Z,N as Zi,p1 as Zn,eG as Zr,h$ as Zt,V0 as _,Lt as _a,I as _i,ZG as _n,DW as _r,WQ as _t,x2 as a,Vo as aa,$0 as ai,FG as an,L1 as ar,K$ as at,k$ as b,D as ba,Rc as bi,M0 as bn,qq as br,J$ as bt,d2 as c,Ua as ca,dq as ci,Z$ as cn,N$ as cr,$G as ct,T2 as d,vr as da,ZW as di,Jq as dn,i1 as dr,NG as dt,tc as ea,IW as ei,L$ as en,R1 as er,Bq as et,A2 as f,cn as fa,sQ as fi,$$ as fn,kG as fr,EG as ft,k2 as g,on as ga,Cf as gi,o1 as gn,NQ as gr,s$ as gt,C2 as h,mn as ha,Ny as hi,a1 as hn,c$ as hr,n1 as ht,D2 as i,_s as ia,wQ as ii,u$ as in,I1 as ir,G$ as it,qQ as j,ll as ji,v1 as jn,pG as jr,jW as jt,PQ as k,Zc as ki,b1 as kn,f0 as kr,RQ as kt,g2 as l,Wa as la,FW as li,Y$ as ln,j$ as lr,AG as lt,j2 as m,fn as ma,gq as mi,l$ as mn,Yq as mr,t1 as mt,p2 as n,Ys as na,CQ as ni,P$ as nn,z1 as nr,BQ as nt,O2 as o,zo as oa,q0 as oi,LG as on,F1 as or,U$ as ot,E2 as p,un as pa,LW as pi,e1 as pn,Xq as pr,p$ as pt,yG as q,$s as qi,h1 as qn,_q as qr,S$ as qt,m2 as r,Hs as ra,WW as ri,jG as rn,B1 as rr,VQ as rt,u2 as s,da as sa,C0 as si,hG as sn,M$ as sr,W$ as st,h2 as t,k as ta,IG as ti,F$ as tn,P1 as tr,Hq as tt,w2 as u,ai as ua,l2 as ui,Wq as un,r1 as ur,RG as ut,DG as v,Tt as va,yl as vi,XG as vn,EW as vr,UQ as vt,OQ as w,Fc as wi,n$ as wn,H0 as wr,H$ as wt,A$ as x,pt as xa,zc as xi,P0 as xn,Z0 as xr,OG as xt,YG as y,O as ya,Bc as yi,j0 as yn,YW as yr,q$ as yt,n0 as z,oc as zi,Pq as zn,GZ as zr,TG as zt};
430
+ //# sourceMappingURL=server-lock-BpjJj3OD-vTp6kF0e.mjs.map
@@ -0,0 +1 @@
1
+ import{g as e}from"./server-lock-BpjJj3OD-vTp6kF0e.mjs";export{e as updateServerLockPort};
@@ -0,0 +1 @@
1
+ import"./chunk-DXB73IDG-C2RuFAAY.mjs";import{t as e}from"./chunk-XKQRETAK-cVWA9gEB.mjs";export{e as sha1sumCommand};
@@ -0,0 +1 @@
1
+ import"./chunk-DXB73IDG-C2RuFAAY.mjs";import{t as e}from"./chunk-5V6VZH6T-BCr5_GDF.mjs";export{e as sha256sumCommand};
@@ -0,0 +1 @@
1
+ import"./chunk-DXB73IDG-C2RuFAAY.mjs";import"./chunk-5QMZ5MUS-BfIuRNkK.mjs";import"./chunk-A5O5YHGN-C6ngIqYR.mjs";import{n as e}from"./chunk-GOV5EKKI-CyL1eJ32.mjs";export{e as sleepCommand};
@@ -0,0 +1 @@
1
+ import"./chunk-DXB73IDG-C2RuFAAY.mjs";import{n as e}from"./chunk-KMEYNNUA-DfdK88O_.mjs";export{e as sortCommand};
@@ -0,0 +1 @@
1
+ import"./chunk-DXB73IDG-C2RuFAAY.mjs";import{n as e}from"./chunk-MYE6AGBJ-B4pRo9ma.mjs";export{e as split};
@@ -0,0 +1 @@
1
+ import"./chunk-DXB73IDG-C2RuFAAY.mjs";import"./chunk-5QMZ5MUS-BfIuRNkK.mjs";import"./chunk-A5O5YHGN-C6ngIqYR.mjs";import"./chunk-24IMIIXA-C-Zyd2K_.mjs";import{t as e}from"./chunk-HWBSOZZR-BeVrNfQw.mjs";export{e as sqlite3Command};
@@ -1,7 +1,7 @@
1
- import{o as e}from"./chunk-FK9Q3tQk.mjs";import{t}from"./esm-CEs3LWY3.mjs";import{c as n,l as r,s as i}from"./server-lock-BpjJj3OD-0F8DEGbQ.mjs";import"./gh-detect-DjyibUoa.mjs";import{g as a,h as o,k as s}from"./init-DRfbG7u0.mjs";import{Fr as c}from"./dist-D0BxLviK.mjs";import"./loader-Dr74NhT-.mjs";import{c as l}from"./colors-BtKMHmBX.mjs";import"./preview-WlY5Fo0D.mjs";import{n as u}from"./write-project-skill-CPYFetL-.mjs";import{spawnSync as d}from"node:child_process";import{existsSync as f,lstatSync as p,readFileSync as m,readdirSync as h,statSync as ee}from"node:fs";import{basename as te,dirname as g,isAbsolute as _,join as v,relative as y,resolve as b}from"node:path";import{hostname as ne}from"node:os";import{readFile as x,realpath as S}from"node:fs/promises";function C(e,t,a={}){let o=r(e,t);if(!f(o))return{status:`missing`,lockPath:o};let s;try{s=JSON.parse(m(o,`utf-8`))}catch{return{status:`corrupt`,lockPath:o}}if(!s||typeof s!=`object`||!n(s.pid))return{status:`corrupt`,lockPath:o};let c=s;if(!(a.isAlive??i)(c.pid))return{status:`dead-pid`,lockPath:o,lock:c};let l=a.host??ne();return c.hostname===l?{status:`alive`,lockPath:o,lock:c}:{status:`foreign-host`,lockPath:o,lock:c}}function w(e){return e.replace(/:\d+$/,``)}function T(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:w(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:w(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:w(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.-]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function E(e){let t;try{t=new URL(e)}catch{return null}if(t.hostname!==`github.com`&&t.hostname!==`www.github.com`)return null;let n=t.pathname.split(`/`).filter(e=>e.length>0);if(n.length<5||n[2]!==`blob`)return null;let r,i,a,o;try{r=decodeURIComponent(n[0]),i=decodeURIComponent(n[1]),a=decodeURIComponent(n[3]),o=n.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!r||!i||!a||o.length===0||o.some(e=>e.length===0)?null:{owner:r,repo:i,branch:a,path:o.join(`/`)}}function D(e){let t;try{t=new URL(e)}catch{return null}if(t.hostname!==`github.com`&&t.hostname!==`www.github.com`)return null;let n=t.pathname.split(`/`);if(n.length<5||n[0]!==``||n[3]!==`tree`)return null;let r=n.slice(5);r.length===1&&r[0]===``&&r.pop();let i,a,o,s;try{i=decodeURIComponent(n[1]),a=decodeURIComponent(n[2]),o=decodeURIComponent(n[4]),s=r.map(e=>decodeURIComponent(e))}catch{return null}return!i||!a||!o||s.some(e=>e.length===0)?null:{owner:i,repo:a,branch:o,path:s.join(`/`)}}function O(e){let t=E(e);if(t)return{kind:`doc`,...t};let n=D(e);return n?{kind:`folder`,...n}:null}const k=2e3,A=2e3,re=[/cli\.mjs/,/(^|[\s/])(open-knowledge|ok)\s+(start|mcp|ui)(\s|$)/,/Open Knowledge(?:\.app| Helper)/,/(^|[\s/])bun([\s/]).*?(run dev|packages\/app|vite|hocuspocus)/,/(^|[\s/])node([\s/]).*?(packages\/(cli|app)|vite|hocuspocus)/,/(^|\s)--ok-lock-dir-b64=/,/(^|\s)--ok-project-path=/];function j(e){return re.some(t=>t.test(e))}function ie(e){let t=e.trim().split(/\s+/).find(e=>e.startsWith(`--ok-lock-dir-b64=`));if(t==null)return null;let n=t.slice(18);if(!n)return null;try{let e=Buffer.from(n,`base64url`).toString(`utf8`);return _(e)?e:null}catch{return null}}function ae(e){let t=e.indexOf(`--ok-project-path=`);if(t===-1)return null;let n=t+18,r=e.slice(n),i=r.search(/\s--/),a=(i===-1?r:r.slice(0,i)).trim();return a&&_(a)?a:null}function oe(e){let t=[];for(let n of e.split(`
1
+ import{o as e}from"./chunk-FK9Q3tQk.mjs";import{t}from"./esm-CEs3LWY3.mjs";import{c as n,l as r,s as i}from"./server-lock-BpjJj3OD-vTp6kF0e.mjs";import"./gh-detect-C3kYac-p.mjs";import{Ir as a}from"./dist-DFDll_q5.mjs";import{g as o,h as s,k as c}from"./init-DOOSSLEH.mjs";import"./loader-BrdaUVEQ.mjs";import{c as l}from"./colors-BtKMHmBX.mjs";import"./preview-BHPfi0n1.mjs";import{n as u}from"./write-project-skill-B4WKDHbQ.mjs";import{spawnSync as d}from"node:child_process";import{existsSync as f,lstatSync as p,readFileSync as m,readdirSync as h,statSync as ee}from"node:fs";import{basename as te,dirname as g,isAbsolute as _,join as v,relative as y,resolve as b}from"node:path";import{hostname as ne}from"node:os";import{readFile as x,realpath as S}from"node:fs/promises";function C(e,t,a={}){let o=r(e,t);if(!f(o))return{status:`missing`,lockPath:o};let s;try{s=JSON.parse(m(o,`utf-8`))}catch{return{status:`corrupt`,lockPath:o}}if(!s||typeof s!=`object`||!n(s.pid))return{status:`corrupt`,lockPath:o};let c=s;if(!(a.isAlive??i)(c.pid))return{status:`dead-pid`,lockPath:o,lock:c};let l=a.host??ne();return c.hostname===l?{status:`alive`,lockPath:o,lock:c}:{status:`foreign-host`,lockPath:o,lock:c}}function w(e){return e.replace(/:\d+$/,``)}function T(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:w(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:w(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:w(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.-]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function E(e){let t;try{t=new URL(e)}catch{return null}if(t.hostname!==`github.com`&&t.hostname!==`www.github.com`)return null;let n=t.pathname.split(`/`).filter(e=>e.length>0);if(n.length<5||n[2]!==`blob`)return null;let r,i,a,o;try{r=decodeURIComponent(n[0]),i=decodeURIComponent(n[1]),a=decodeURIComponent(n[3]),o=n.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!r||!i||!a||o.length===0||o.some(e=>e.length===0)?null:{owner:r,repo:i,branch:a,path:o.join(`/`)}}function D(e){let t;try{t=new URL(e)}catch{return null}if(t.hostname!==`github.com`&&t.hostname!==`www.github.com`)return null;let n=t.pathname.split(`/`);if(n.length<5||n[0]!==``||n[3]!==`tree`)return null;let r=n.slice(5);r.length===1&&r[0]===``&&r.pop();let i,a,o,s;try{i=decodeURIComponent(n[1]),a=decodeURIComponent(n[2]),o=decodeURIComponent(n[4]),s=r.map(e=>decodeURIComponent(e))}catch{return null}return!i||!a||!o||s.some(e=>e.length===0)?null:{owner:i,repo:a,branch:o,path:s.join(`/`)}}function O(e){let t=E(e);if(t)return{kind:`doc`,...t};let n=D(e);return n?{kind:`folder`,...n}:null}const k=2e3,A=2e3,re=[/cli\.mjs/,/(^|[\s/])(open-knowledge|ok)\s+(start|mcp|ui)(\s|$)/,/Open Knowledge(?:\.app| Helper)/,/(^|[\s/])bun([\s/]).*?(run dev|packages\/app|vite|hocuspocus)/,/(^|[\s/])node([\s/]).*?(packages\/(cli|app)|vite|hocuspocus)/,/(^|\s)--ok-lock-dir-b64=/,/(^|\s)--ok-project-path=/];function j(e){return re.some(t=>t.test(e))}function ie(e){let t=e.trim().split(/\s+/).find(e=>e.startsWith(`--ok-lock-dir-b64=`));if(t==null)return null;let n=t.slice(18);if(!n)return null;try{let e=Buffer.from(n,`base64url`).toString(`utf8`);return _(e)?e:null}catch{return null}}function ae(e){let t=e.indexOf(`--ok-project-path=`);if(t===-1)return null;let n=t+18,r=e.slice(n),i=r.search(/\s--/),a=(i===-1?r:r.slice(0,i)).trim();return a&&_(a)?a:null}function oe(e){let t=[];for(let n of e.split(`
2
2
  `)){let e=n.trim();if(!e)continue;let r=e.indexOf(` `);if(r===-1)continue;let i=e.slice(0,r),a=e.slice(r+1),o=Number.parseInt(i,10);!Number.isNaN(o)&&j(a)&&t.push({pid:o,command:a})}return t}function se(e){let t=[],n=e.split(`
3
3
  `);for(let e=1;e<n.length;e++){let r=n[e]?.trim();if(!r)continue;let i=r.indexOf(` `);if(i===-1)continue;let a=r.slice(0,i),o=r.slice(i+1).trim(),s=Number.parseInt(a,10);!Number.isNaN(s)&&j(o)&&t.push({pid:s,command:o})}return t}async function ce(){let e=d(`pgrep`,[`-a`,`-f`,`cli\\.mjs|open-knowledge|Open Knowledge(\\.app| Helper)|--ok-lock-dir-b64=|--ok-project-path=|(^|[ /])ok[ ]+(start|mcp|ui)([ ]|$)|packages/(cli|app)|hocuspocus|vite`],{encoding:`utf-8`,timeout:k});if(!(e.error!=null&&e.error.code===`ENOENT`)){let t=e.stdout??``,n=oe(t);if(n.length>0||t.trim()===``)return n}let t=d(`ps`,[`-axo`,`pid,command`],{encoding:`utf-8`,timeout:k});return t.error!=null||!t.stdout?[]:se(t.stdout)}function M(e){let t=e.trim().split(/\s+/).filter(Boolean);for(let e of t){if(e.startsWith(`@`))continue;let t=te(e);if(t===`open-knowledge`||t===`ok`||e.endsWith(`/packages/cli/src/cli.ts`)||e.endsWith(`/packages/cli/dist/cli.mjs`)||t===`cli.mjs`||t===`cli.ts`)return e}return null}function N(e){let t=d(`ps`,[`-p`,String(e),`-o`,`command=`],{encoding:`utf-8`,timeout:k});return t.error!=null||!t.stdout?null:t.stdout.trim()||null}function P(e){let t=d(`ps`,[`-p`,String(e),`-o`,`%cpu=,%mem=`],{encoding:`utf-8`,timeout:k});if(t.error!=null||!t.stdout)return null;let[n,r]=t.stdout.trim().split(/\s+/),i=Number.parseFloat(n??``),a=Number.parseFloat(r??``);return Number.isNaN(i)||Number.isNaN(a)?null:{cpuPercent:i,memPercent:a}}async function F(e){let t=d(`lsof`,[`-p`,String(e),`-a`,`-d`,`cwd`,`-Fn`],{encoding:`utf-8`,timeout:k});if(t.error!=null)return null;let n=t.stdout??``;for(let e of n.split(`
4
4
  `))if(e.startsWith(`n`)&&e.length>1)return e.slice(1);return null}function I(e){let t=[],n=e.split(`
5
5
  `);for(let e=1;e<n.length;e++){let r=n[e]?.trim();if(!r)continue;let i=r.split(/\s+/);if(i.length<2)continue;let a=Number.parseInt(i[1]??``,10);Number.isNaN(a)||t.push(a)}return[...new Set(t)]}function L(e){return f(v(e,`server.lock`))||f(v(e,`ui.lock`))}function R(e,t){for(let n of[v(t,`.ok`,`local`),v(t,`.ok`)])f(n)&&L(n)&&e.add(n)}function z(e,t){let n=0,r=(t,i)=>{if(n>=A||(n++,R(e,t),i>=3))return;let a;try{a=h(t)}catch{return}for(let e of a){if(n>=A)return;if(e===`node_modules`||e===`.git`||e===`Library`||e.startsWith(`.`)&&e!==`.ok`)continue;let a=v(t,e),o=!1;try{o=p(a).isDirectory()}catch{continue}o&&r(a,i+1)}};r(t,0)}async function B(){let e=new Set,t=await ce(),n=t.map(e=>F(e.pid)),r=await Promise.all(n);for(let n of t){let t=ie(n.command);t!=null&&f(t)&&e.add(t);let r=ae(n.command);r!=null&&R(e,r)}for(let t of r)t!=null&&R(e,t);let i=d(`lsof`,[`-iTCP`,`-sTCP:LISTEN`,`-nP`],{encoding:`utf-8`,timeout:k});if(i.error==null&&i.stdout){let n=I(i.stdout),r=new Set(t.map(e=>e.pid)),a=n.filter(e=>!r.has(e)).map(e=>F(e)),o=await Promise.all(a);for(let t of o)t!=null&&R(e,t)}(e.size===0||r.some(e=>e===`/`))&&z(e,process.cwd());let a=new Map;for(let t of e)try{let e=await S(t);a.set(e,e)}catch{a.set(t,t)}return[...a.values()]}var V=e(l(),1);function H(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function U(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function W(e,t,n,r,i,a){if(t.status===`missing`||t.status===`corrupt`)return null;let o=t.lock,s=null;if(n.status!==`missing`&&n.status!==`corrupt`){let e=n.lock;s={port:e.port,status:n.status,pid:e.pid,startedAt:e.startedAt,usage:a}}return{directory:o.worktreeRoot,server:{port:o.port,status:t.status,pid:o.pid,startedAt:o.startedAt,usage:i},ui:s,hostname:o.hostname,lockPath:t.lockPath,binary:r==null?null:M(r),command:r,isDesktop:H(r)}}function G(e){return e.ui==null?!1:e.ui.status===`alive`||e.ui.status===`foreign-host`}function K(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:t===`dead-pid`&&G(e)?`ui-orphan`:`stale`}const le=new Set([`running`,`desktop`,`foreign`,`ui-orphan`]);function ue(e){switch(e){case`running`:return V.default.green(e);case`desktop`:return V.default.blue(e);case`foreign`:return V.default.cyan(e);case`ui-orphan`:return V.default.magenta(e);case`stale`:return V.default.yellow(e)}}function q(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function de(e){return`${q(e.server.usage)} | ${q(e.ui?.usage??null)}`}function fe(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null||e.ui.status===`dead-pid`?`—`:String(e.ui.port)}`}function pe(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>{let t=K(e),n=t===`ui-orphan`&&e.ui!=null?e.ui.pid:e.server.pid;return[e.directory,fe(e),de(e),t,String(n),U(e.server.startedAt),e.binary??`—`]}),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=ue(K(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=V.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
6
- `)}async function J(e={}){let t=e.discover??B,n=e.inspect??C,r=e.log??(e=>console.log(e)),i=e.resolveCommand??N,a=e.resolveUsage??P,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=n(e,`ui`),o=W(e,t,r,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid),r.status===`missing`||r.status===`corrupt`?null:a(r.lock.pid));o!=null&&s.push(o)}if(e.json){let e=s.map(e=>({...e,displayStatus:K(e)}));r(JSON.stringify(e,null,2));return}r(pe(e.all?s:s.filter(e=>le.has(K(e)))))}function me(){return new t(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await J({all:t.all===!0||e===`all`,json:t.json===!0})})}function he(e,t,n={}){let r=n.isAlive??i,a=[];for(let[n,i]of[[`server`,e],[`ui`,t]])(i.status===`alive`||i.status===`foreign-host`&&r(i.lock.pid))&&a.push({name:n,pid:i.lock.pid,port:i.lock.port});return{targets:a}}function Y(e){let t=e.inspect??(t=>C(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=he(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function X(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function Z(e,t=i){let n=await B(),r=null;for(let i of n){let n=C(i,`server`),a=C(i,`ui`);if(X(n,t)&&n.lock.port===e||X(a,t)&&a.lock.port===e)return i;r===null&&(X(n,t)&&n.lock.pid===e||X(a,t)&&a.lock.pid===e)&&(r=i)}return r}function Q(e){let t=Y({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function ge(e){return new t(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).action(async t=>{let n=t.length===0?void 0:t.join(` `);if(n===void 0){e();let t=Y({lockDir:c(process.cwd()),log:()=>{}});if(t.hadTargets){if(t.stopped.length>0){let e=t.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}t.failed.length>0&&(process.exitCode=1)}else await J({});return}if(n===`all`){let e=await B();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=C(n,`server`),r=C(n,`ui`);!X(e,i)&&!X(r,i)||(Q(n),t++)}t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(n)){let e=Number.parseInt(n,10),t=await Z(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}Q(t);return}Q(c(n))})}async function _e(e,t){let n,r;try{n=await S(b(e)),r=await S(b(g(e)))}catch{return{kind:`not-git`}}if(!$(n,r))return{kind:`symlink-escape`};let i=v(n,`.git`),a;try{a=ee(i)}catch{return{kind:`not-git`}}let o;if(a.isDirectory()){let e;try{e=await S(i)}catch{return{kind:`not-git`}}if(!$(e,n))return{kind:`symlink-escape`};o=e}else if(a.isFile()){let e;try{e=await x(i,`utf-8`)}catch{return{kind:`not-git`}}let t=/^gitdir:\s*(.+)$/m.exec(e.trim());if(!t)return{kind:`not-git`};let r=t[1].trim(),a=_(r)?r:b(n,r);try{o=await S(a)}catch{return{kind:`not-git`}}}else return{kind:`not-git`};let s=v(await ve(o),`config`),c;try{c=await x(s,`utf-8`)}catch{return{kind:`not-git`}}let l=be(c);if(l===null)return{kind:`no-origin`};let u=T(l);if(u===null||u.hostname!==`github.com`)return{kind:`non-github`};let d=u.owner.toLowerCase()===t.owner.toLowerCase(),f=u.name.toLowerCase()===t.repo.toLowerCase();return!d||!f?{kind:`wrong-repo`,actualOwner:u.owner,actualRepo:u.name}:{kind:`ok`,gitRemoteUrl:`https://github.com/${u.owner}/${u.name}.git`}}async function ve(e){let t;try{t=(await x(v(e,`commondir`),`utf-8`)).trim()}catch{return e}if(t.length===0)return e;let n=_(t)?t:b(e,t);try{return await S(n)}catch{return n}}function $(e,t){if(e===t)return!0;let n=y(t,e);return n.length>0&&!n.startsWith(`..`)&&!_(n)}function ye(e){let t=e.indexOf(`#`),n=e.indexOf(`;`),r=-1;return t>=0&&n>=0?r=Math.min(t,n):t>=0?r=t:n>=0&&(r=n),(r===-1?e:e.slice(0,r)).trim()}function be(e){let t=!1;for(let n of e.split(/\r?\n/)){let e=ye(n);if(e.length===0)continue;if(e.startsWith(`[`)){t=/^\[\s*remote\s+["']origin["']\s*\]$/.test(e);continue}if(!t)continue;let r=/^url\s*=\s*(.+)$/.exec(e);if(r)return xe(r[1])}return null}function xe(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}const Se=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=a(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let n=u(e,t);return{integration:`project-skill`,editorId:e.id,action:n.action,...n.path?{path:n.path}:{},...n.error?{error:n.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function Ce(e,t,n={},r=Se){let i=[];for(let a of t){let t=s[a];for(let a of r)i.push(a.write(t,e,n))}return i}function we(e,t,n={}){return{integrations:Ce(e,t,n),claudeLaunchJson:t.includes(`claude`)?o(e,n):void 0}}export{me as a,P as c,D as d,T as f,ge as i,E as l,_e as n,B as o,C as p,Y as r,N as s,we as t,O as u};
7
- //# sourceMappingURL=src-C_kqzFe0.mjs.map
6
+ `)}async function J(e={}){let t=e.discover??B,n=e.inspect??C,r=e.log??(e=>console.log(e)),i=e.resolveCommand??N,a=e.resolveUsage??P,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=n(e,`ui`),o=W(e,t,r,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid),r.status===`missing`||r.status===`corrupt`?null:a(r.lock.pid));o!=null&&s.push(o)}if(e.json){let e=s.map(e=>({...e,displayStatus:K(e)}));r(JSON.stringify(e,null,2));return}r(pe(e.all?s:s.filter(e=>le.has(K(e)))))}function me(){return new t(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await J({all:t.all===!0||e===`all`,json:t.json===!0})})}function he(e,t,n={}){let r=n.isAlive??i,a=[];for(let[n,i]of[[`server`,e],[`ui`,t]])(i.status===`alive`||i.status===`foreign-host`&&r(i.lock.pid))&&a.push({name:n,pid:i.lock.pid,port:i.lock.port});return{targets:a}}function Y(e){let t=e.inspect??(t=>C(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=he(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function X(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function Z(e,t=i){let n=await B(),r=null;for(let i of n){let n=C(i,`server`),a=C(i,`ui`);if(X(n,t)&&n.lock.port===e||X(a,t)&&a.lock.port===e)return i;r===null&&(X(n,t)&&n.lock.pid===e||X(a,t)&&a.lock.pid===e)&&(r=i)}return r}function Q(e){let t=Y({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function ge(e){return new t(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).action(async t=>{let n=t.length===0?void 0:t.join(` `);if(n===void 0){e();let t=Y({lockDir:a(process.cwd()),log:()=>{}});if(t.hadTargets){if(t.stopped.length>0){let e=t.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}t.failed.length>0&&(process.exitCode=1)}else await J({});return}if(n===`all`){let e=await B();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=C(n,`server`),r=C(n,`ui`);!X(e,i)&&!X(r,i)||(Q(n),t++)}t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(n)){let e=Number.parseInt(n,10),t=await Z(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}Q(t);return}Q(a(n))})}async function _e(e,t){let n,r;try{n=await S(b(e)),r=await S(b(g(e)))}catch{return{kind:`not-git`}}if(!$(n,r))return{kind:`symlink-escape`};let i=v(n,`.git`),a;try{a=ee(i)}catch{return{kind:`not-git`}}let o;if(a.isDirectory()){let e;try{e=await S(i)}catch{return{kind:`not-git`}}if(!$(e,n))return{kind:`symlink-escape`};o=e}else if(a.isFile()){let e;try{e=await x(i,`utf-8`)}catch{return{kind:`not-git`}}let t=/^gitdir:\s*(.+)$/m.exec(e.trim());if(!t)return{kind:`not-git`};let r=t[1].trim(),a=_(r)?r:b(n,r);try{o=await S(a)}catch{return{kind:`not-git`}}}else return{kind:`not-git`};let s=v(await ve(o),`config`),c;try{c=await x(s,`utf-8`)}catch{return{kind:`not-git`}}let l=be(c);if(l===null)return{kind:`no-origin`};let u=T(l);if(u===null||u.hostname!==`github.com`)return{kind:`non-github`};let d=u.owner.toLowerCase()===t.owner.toLowerCase(),f=u.name.toLowerCase()===t.repo.toLowerCase();return!d||!f?{kind:`wrong-repo`,actualOwner:u.owner,actualRepo:u.name}:{kind:`ok`,gitRemoteUrl:`https://github.com/${u.owner}/${u.name}.git`}}async function ve(e){let t;try{t=(await x(v(e,`commondir`),`utf-8`)).trim()}catch{return e}if(t.length===0)return e;let n=_(t)?t:b(e,t);try{return await S(n)}catch{return n}}function $(e,t){if(e===t)return!0;let n=y(t,e);return n.length>0&&!n.startsWith(`..`)&&!_(n)}function ye(e){let t=e.indexOf(`#`),n=e.indexOf(`;`),r=-1;return t>=0&&n>=0?r=Math.min(t,n):t>=0?r=t:n>=0&&(r=n),(r===-1?e:e.slice(0,r)).trim()}function be(e){let t=!1;for(let n of e.split(/\r?\n/)){let e=ye(n);if(e.length===0)continue;if(e.startsWith(`[`)){t=/^\[\s*remote\s+["']origin["']\s*\]$/.test(e);continue}if(!t)continue;let r=/^url\s*=\s*(.+)$/.exec(e);if(r)return xe(r[1])}return null}function xe(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}const Se=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=o(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let n=u(e,t);return{integration:`project-skill`,editorId:e.id,action:n.action,...n.path?{path:n.path}:{},...n.error?{error:n.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function Ce(e,t,n={},r=Se){let i=[];for(let a of t){let t=c[a];for(let a of r)i.push(a.write(t,e,n))}return i}function we(e,t,n={}){return{integrations:Ce(e,t,n),claudeLaunchJson:t.includes(`claude`)?s(e,n):void 0}}export{me as a,P as c,D as d,T as f,ge as i,E as l,_e as n,B as o,C as p,Y as r,N as s,we as t,O as u};
7
+ //# sourceMappingURL=src-DPAvJMN5.mjs.map