vibedoc 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +2 -0
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +39 -11
  5. package/.next/routes-manifest.json +12 -0
  6. package/.next/server/app/(app)/activity/page.js.nft.json +1 -1
  7. package/.next/server/app/(app)/activity/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/(app)/board/page.js.nft.json +1 -1
  9. package/.next/server/app/(app)/board/page_client-reference-manifest.js +1 -1
  10. package/.next/server/app/(app)/chat/page/app-paths-manifest.json +3 -0
  11. package/.next/server/app/(app)/chat/page/build-manifest.json +20 -0
  12. package/.next/server/app/(app)/chat/page/next-font-manifest.json +11 -0
  13. package/.next/server/app/(app)/chat/page/react-loadable-manifest.json +1 -0
  14. package/.next/server/app/(app)/chat/page/server-reference-manifest.json +4 -0
  15. package/.next/server/app/(app)/chat/page.js +15 -0
  16. package/.next/server/app/(app)/chat/page.js.map +5 -0
  17. package/.next/server/app/(app)/chat/page.js.nft.json +1 -0
  18. package/.next/server/app/(app)/chat/page_client-reference-manifest.js +3 -0
  19. package/.next/server/app/(app)/docs/page.js.nft.json +1 -1
  20. package/.next/server/app/(app)/docs/page_client-reference-manifest.js +1 -1
  21. package/.next/server/app/(app)/explorer/page.js.nft.json +1 -1
  22. package/.next/server/app/(app)/explorer/page_client-reference-manifest.js +1 -1
  23. package/.next/server/app/(app)/memory/page.js.nft.json +1 -1
  24. package/.next/server/app/(app)/memory/page_client-reference-manifest.js +1 -1
  25. package/.next/server/app/(app)/roadmap/page.js.nft.json +1 -1
  26. package/.next/server/app/(app)/roadmap/page_client-reference-manifest.js +1 -1
  27. package/.next/server/app/(app)/settings/page.js.nft.json +1 -1
  28. package/.next/server/app/(app)/settings/page_client-reference-manifest.js +1 -1
  29. package/.next/server/app/(app)/setup/page.js.nft.json +1 -1
  30. package/.next/server/app/(app)/setup/page_client-reference-manifest.js +1 -1
  31. package/.next/server/app/_global-error.html +1 -1
  32. package/.next/server/app/_global-error.rsc +1 -1
  33. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  34. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  35. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  36. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  37. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  38. package/.next/server/app/_not-found.html +1 -1
  39. package/.next/server/app/_not-found.rsc +2 -2
  40. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  41. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  42. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  43. package/.next/server/app/activity.html +1 -1
  44. package/.next/server/app/activity.rsc +22 -23
  45. package/.next/server/app/activity.segments/!KGFwcCk/activity/__PAGE__.segment.rsc +9 -10
  46. package/.next/server/app/activity.segments/_full.segment.rsc +22 -23
  47. package/.next/server/app/activity.segments/_tree.segment.rsc +2 -2
  48. package/.next/server/app/api/activity/route.js.nft.json +1 -1
  49. package/.next/server/app/api/backlinks/route.js.nft.json +1 -1
  50. package/.next/server/app/api/chat/route.js.nft.json +1 -1
  51. package/.next/server/app/api/context/route.js.nft.json +1 -1
  52. package/.next/server/app/api/conversations/route/app-paths-manifest.json +3 -0
  53. package/.next/server/app/api/conversations/route/build-manifest.json +12 -0
  54. package/.next/server/app/api/conversations/route/server-reference-manifest.json +4 -0
  55. package/.next/server/app/api/conversations/route.js +9 -0
  56. package/.next/server/app/api/conversations/route.js.map +5 -0
  57. package/.next/server/app/api/conversations/route.js.nft.json +1 -0
  58. package/.next/server/app/api/conversations/route_client-reference-manifest.js +3 -0
  59. package/.next/server/app/api/decisions/route.js.nft.json +1 -1
  60. package/.next/server/app/api/docs/route.js.nft.json +1 -1
  61. package/.next/server/app/api/explorer/route.js.nft.json +1 -1
  62. package/.next/server/app/api/mcp/route.js.nft.json +1 -1
  63. package/.next/server/app/api/memory/route.js.nft.json +1 -1
  64. package/.next/server/app/api/plan/apply/route.js.nft.json +1 -1
  65. package/.next/server/app/api/projects/route.js.nft.json +1 -1
  66. package/.next/server/app/api/registry/route.js.nft.json +1 -1
  67. package/.next/server/app/api/roadmap/create/route.js.nft.json +1 -1
  68. package/.next/server/app/api/roadmap/delete/route.js.nft.json +1 -1
  69. package/.next/server/app/api/roadmap/generate/route.js.nft.json +1 -1
  70. package/.next/server/app/api/roadmap/layout/route.js.nft.json +1 -1
  71. package/.next/server/app/api/roadmap/route.js.nft.json +1 -1
  72. package/.next/server/app/api/roadmap/update/route.js.nft.json +1 -1
  73. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  74. package/.next/server/app/api/settings/route.js.nft.json +1 -1
  75. package/.next/server/app/api/setup/generate/route.js.nft.json +1 -1
  76. package/.next/server/app/api/setup/write/route.js.nft.json +1 -1
  77. package/.next/server/app/api/summary/route.js.nft.json +1 -1
  78. package/.next/server/app/api/tasks/create/route.js.nft.json +1 -1
  79. package/.next/server/app/api/tasks/route.js.nft.json +1 -1
  80. package/.next/server/app/board.html +1 -1
  81. package/.next/server/app/board.rsc +22 -23
  82. package/.next/server/app/board.segments/!KGFwcCk/board/__PAGE__.segment.rsc +9 -10
  83. package/.next/server/app/board.segments/_full.segment.rsc +22 -23
  84. package/.next/server/app/board.segments/_tree.segment.rsc +2 -2
  85. package/.next/server/app/chat.html +1 -0
  86. package/.next/server/app/chat.meta +31 -0
  87. package/.next/server/app/chat.rsc +29 -0
  88. package/.next/server/app/chat.segments/!KGFwcCk/chat/__PAGE__.segment.rsc +31 -0
  89. package/.next/server/app/chat.segments/_full.segment.rsc +29 -0
  90. package/.next/server/app/chat.segments/_tree.segment.rsc +4 -0
  91. package/.next/server/app/docs.html +1 -1
  92. package/.next/server/app/docs.rsc +22 -27
  93. package/.next/server/app/docs.segments/!KGFwcCk/docs/__PAGE__.segment.rsc +6 -6
  94. package/.next/server/app/docs.segments/_full.segment.rsc +22 -27
  95. package/.next/server/app/docs.segments/_tree.segment.rsc +2 -2
  96. package/.next/server/app/explorer.html +1 -1
  97. package/.next/server/app/explorer.rsc +22 -23
  98. package/.next/server/app/explorer.segments/!KGFwcCk/explorer/__PAGE__.segment.rsc +9 -10
  99. package/.next/server/app/explorer.segments/_full.segment.rsc +22 -23
  100. package/.next/server/app/explorer.segments/_tree.segment.rsc +2 -2
  101. package/.next/server/app/index.html +1 -1
  102. package/.next/server/app/index.rsc +2 -2
  103. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  104. package/.next/server/app/index.segments/_full.segment.rsc +2 -2
  105. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  106. package/.next/server/app/memory.html +1 -1
  107. package/.next/server/app/memory.rsc +22 -23
  108. package/.next/server/app/memory.segments/!KGFwcCk/memory/__PAGE__.segment.rsc +9 -10
  109. package/.next/server/app/memory.segments/_full.segment.rsc +22 -23
  110. package/.next/server/app/memory.segments/_tree.segment.rsc +2 -2
  111. package/.next/server/app/page.js.nft.json +1 -1
  112. package/.next/server/app/page_client-reference-manifest.js +1 -1
  113. package/.next/server/app/roadmap.html +1 -1
  114. package/.next/server/app/roadmap.rsc +22 -26
  115. package/.next/server/app/roadmap.segments/!KGFwcCk/roadmap/__PAGE__.segment.rsc +9 -11
  116. package/.next/server/app/roadmap.segments/_full.segment.rsc +22 -26
  117. package/.next/server/app/roadmap.segments/_tree.segment.rsc +2 -2
  118. package/.next/server/app/settings.html +1 -1
  119. package/.next/server/app/settings.rsc +22 -23
  120. package/.next/server/app/settings.segments/!KGFwcCk/settings/__PAGE__.segment.rsc +9 -10
  121. package/.next/server/app/settings.segments/_full.segment.rsc +22 -23
  122. package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  123. package/.next/server/app/setup.html +1 -1
  124. package/.next/server/app/setup.rsc +22 -23
  125. package/.next/server/app/setup.segments/!KGFwcCk/setup/__PAGE__.segment.rsc +9 -10
  126. package/.next/server/app/setup.segments/_full.segment.rsc +22 -23
  127. package/.next/server/app/setup.segments/_tree.segment.rsc +2 -2
  128. package/.next/server/app-paths-manifest.json +2 -0
  129. package/.next/server/chunks/11mp_@anthropic-ai_sdk_1htgzmb._.js +3 -0
  130. package/.next/server/chunks/11mp_@anthropic-ai_sdk_1htgzmb._.js.map +1 -0
  131. package/.next/server/chunks/11mp_@anthropic-ai_sdk_index_mjs_0d2_lq6._.js +3 -0
  132. package/.next/server/chunks/[root-of-the-server]__1613hjb._.js +4 -4
  133. package/.next/server/chunks/[root-of-the-server]__1613hjb._.js.map +1 -1
  134. package/.next/server/chunks/[root-of-the-server]__1jxu2x9._.js +3 -0
  135. package/.next/server/chunks/[root-of-the-server]__1jxu2x9._.js.map +1 -0
  136. package/.next/server/chunks/_1b5fqxy._.js +1 -1
  137. package/.next/server/chunks/_1b5fqxy._.js.map +1 -1
  138. package/.next/server/chunks/_next-internal_server_app_api_conversations_route_actions_1-pu7gs.js +3 -0
  139. package/.next/server/chunks/ssr/{0_nd_mermaid_dist_mermaid_core_mjs_10jvzv6._.js → 0_nd_mermaid_dist_mermaid_core_mjs_0vv_0i3._.js} +2 -2
  140. package/.next/server/chunks/ssr/{1u84_katex_dist_katex_mjs_05prlqa._.js → 1u84_katex_dist_katex_mjs_1z0p1bs._.js} +1 -1
  141. package/.next/server/chunks/ssr/1x05_lucide-react_dist_esm_icons_0cvmffy._.js +3 -0
  142. package/.next/server/chunks/ssr/1x05_lucide-react_dist_esm_icons_0cvmffy._.js.map +1 -0
  143. package/.next/server/chunks/ssr/1x05_lucide-react_dist_esm_icons_0u3jxas._.js +3 -0
  144. package/.next/server/chunks/ssr/1x05_lucide-react_dist_esm_icons_0u3jxas._.js.map +1 -0
  145. package/.next/server/chunks/ssr/[root-of-the-server]__0xt_0w2._.js.map +1 -1
  146. package/.next/server/chunks/ssr/[root-of-the-server]__11lfnu0._.js +3 -0
  147. package/.next/server/chunks/ssr/[root-of-the-server]__11lfnu0._.js.map +1 -0
  148. package/.next/server/chunks/ssr/_059qmur._.js +3 -0
  149. package/.next/server/chunks/ssr/_059qmur._.js.map +1 -0
  150. package/.next/server/chunks/ssr/_081irea._.js +3 -0
  151. package/.next/server/chunks/ssr/_081irea._.js.map +1 -0
  152. package/.next/server/chunks/ssr/_0d8t8l4._.js +3 -0
  153. package/.next/server/chunks/ssr/_0d8t8l4._.js.map +1 -0
  154. package/.next/server/chunks/ssr/_0dyvcdg._.js +3 -0
  155. package/.next/server/chunks/ssr/_0dyvcdg._.js.map +1 -0
  156. package/.next/server/chunks/ssr/_1-ghqy4._.js +3 -0
  157. package/.next/server/chunks/ssr/_1-ghqy4._.js.map +1 -0
  158. package/.next/server/chunks/ssr/_17jy5db._.js +3 -0
  159. package/.next/server/chunks/ssr/_17jy5db._.js.map +1 -0
  160. package/.next/server/chunks/ssr/_1c95ems._.js +1 -1
  161. package/.next/server/chunks/ssr/_1c95ems._.js.map +1 -1
  162. package/.next/server/chunks/ssr/_1dllfz5._.js +4 -0
  163. package/.next/server/chunks/ssr/_1dllfz5._.js.map +1 -0
  164. package/.next/server/chunks/ssr/_next-internal_server_app_(app)_chat_page_actions_0g4tbzt.js +3 -0
  165. package/.next/server/chunks/ssr/node_modules__pnpm_006_c8z._.js +3 -0
  166. package/.next/server/chunks/ssr/node_modules__pnpm_006_c8z._.js.map +1 -0
  167. package/.next/server/chunks/ssr/{node_modules__pnpm_1kngagu._.js → node_modules__pnpm_0286-tg._.js} +1 -1
  168. package/.next/server/chunks/ssr/{node_modules__pnpm_1ad2q27._.js → node_modules__pnpm_04khl_s._.js} +1 -1
  169. package/.next/server/chunks/ssr/{node_modules__pnpm_0ns_6dd._.js → node_modules__pnpm_07t_e8c._.js} +1 -1
  170. package/.next/server/chunks/ssr/{node_modules__pnpm_0baie09._.js → node_modules__pnpm_08sqeu2._.js} +1 -1
  171. package/.next/server/chunks/ssr/{node_modules__pnpm_1jfqun_._.js → node_modules__pnpm_09_i2jk._.js} +1 -1
  172. package/.next/server/chunks/ssr/node_modules__pnpm_09_i2jk._.js.map +1 -0
  173. package/.next/server/chunks/ssr/{node_modules__pnpm_1o3_0-n._.js → node_modules__pnpm_0a9b2ei._.js} +1 -1
  174. package/.next/server/chunks/ssr/{node_modules__pnpm_0e15nhj._.js → node_modules__pnpm_0ah02mu._.js} +1 -1
  175. package/.next/server/chunks/ssr/{node_modules__pnpm_20tdqv_._.js → node_modules__pnpm_0cj8ryj._.js} +1 -1
  176. package/.next/server/chunks/ssr/{node_modules__pnpm_0wnlgm-._.js → node_modules__pnpm_0dwi7mu._.js} +2 -2
  177. package/.next/server/chunks/ssr/node_modules__pnpm_0dwi7mu._.js.map +1 -0
  178. package/.next/server/chunks/ssr/{node_modules__pnpm_1h890n6._.js → node_modules__pnpm_0f77_ng._.js} +1 -1
  179. package/.next/server/chunks/ssr/{node_modules__pnpm_1u8p2h3._.js → node_modules__pnpm_0fd3pr1._.js} +2 -2
  180. package/.next/server/chunks/ssr/{node_modules__pnpm_1zu-9we._.js → node_modules__pnpm_0gifu-u._.js} +2 -2
  181. package/.next/server/chunks/ssr/{node_modules__pnpm_1_o0jyk._.js → node_modules__pnpm_0jpv2b6._.js} +2 -2
  182. package/.next/server/chunks/ssr/{node_modules__pnpm_1f3lm9p._.js → node_modules__pnpm_0og06fy._.js} +1 -1
  183. package/.next/server/chunks/ssr/{node_modules__pnpm_12s6q4d._.js → node_modules__pnpm_0qc3gsk._.js} +1 -1
  184. package/.next/server/chunks/ssr/{node_modules__pnpm_0e3u5g-._.js → node_modules__pnpm_0ts89ne._.js} +1 -1
  185. package/.next/server/chunks/ssr/{node_modules__pnpm_1moe8b6._.js → node_modules__pnpm_0ttvopp._.js} +1 -1
  186. package/.next/server/chunks/ssr/{node_modules__pnpm_1ly58kw._.js → node_modules__pnpm_0u3u82f._.js} +1 -1
  187. package/.next/server/chunks/ssr/{node_modules__pnpm_1hw4h9e._.js → node_modules__pnpm_0y35hs4._.js} +1 -1
  188. package/.next/server/chunks/ssr/{node_modules__pnpm_0jhh7p5._.js → node_modules__pnpm_104pzhc._.js} +2 -2
  189. package/.next/server/chunks/ssr/{node_modules__pnpm_1gqkoe3._.js → node_modules__pnpm_195j8p_._.js} +1 -1
  190. package/.next/server/chunks/ssr/node_modules__pnpm_1kcnkjs._.js +3 -0
  191. package/.next/server/chunks/ssr/node_modules__pnpm_1kcnkjs._.js.map +1 -0
  192. package/.next/server/chunks/ssr/{node_modules__pnpm_0i0uccx._.js → node_modules__pnpm_1l8k8w1._.js} +1 -1
  193. package/.next/server/chunks/ssr/{node_modules__pnpm_0rd-a9g._.js → node_modules__pnpm_1w0f1m5._.js} +1 -1
  194. package/.next/server/chunks/ssr/{node_modules__pnpm_1gtgu48._.js → node_modules__pnpm_1woddr6._.js} +2 -2
  195. package/.next/server/chunks/ssr/{node_modules__pnpm_0_z3_bl._.js → node_modules__pnpm_1x0t5_z._.js} +1 -1
  196. package/.next/server/chunks/ssr/{node_modules__pnpm_07_kgbe._.js → node_modules__pnpm_1xzf8g_._.js} +1 -1
  197. package/.next/server/chunks/ssr/{node_modules__pnpm_08em703._.js → node_modules__pnpm_1yq90z7._.js} +1 -1
  198. package/.next/server/chunks/ssr/node_modules__pnpm_1yq90z7._.js.map +1 -0
  199. package/.next/server/chunks/ssr/src_app_(app)_chat_page_tsx_0c3e4l4._.js +3 -0
  200. package/.next/server/chunks/ssr/src_app_(app)_chat_page_tsx_0c3e4l4._.js.map +1 -0
  201. package/.next/server/chunks/ssr/src_app_(app)_layout_tsx_1yu5hom._.js +3 -0
  202. package/.next/server/chunks/ssr/src_app_(app)_layout_tsx_1yu5hom._.js.map +1 -0
  203. package/.next/server/chunks/ssr/src_app_(app)_roadmap_page_tsx_0vcq3jr._.js +5 -0
  204. package/.next/server/chunks/ssr/src_app_(app)_roadmap_page_tsx_0vcq3jr._.js.map +1 -0
  205. package/.next/server/chunks/ssr/src_app_(app)_settings_page_tsx_0zevtee._.js +2 -2
  206. package/.next/server/chunks/ssr/src_app_(app)_settings_page_tsx_0zevtee._.js.map +1 -1
  207. package/.next/server/chunks/ssr/src_context_ChatContext_tsx_0lowp8p._.js +5 -0
  208. package/.next/server/chunks/ssr/src_context_ChatContext_tsx_0lowp8p._.js.map +1 -0
  209. package/.next/server/chunks/ssr/{_1wf14_u._.js → src_lib_templates_index_ts_1s61uk7._.js} +2 -2
  210. package/.next/server/chunks/ssr/{_1wf14_u._.js.map → src_lib_templates_index_ts_1s61uk7._.js.map} +1 -1
  211. package/.next/server/middleware-build-manifest.js +3 -3
  212. package/.next/server/next-font-manifest.js +1 -1
  213. package/.next/server/next-font-manifest.json +4 -0
  214. package/.next/server/pages/404.html +1 -1
  215. package/.next/server/pages/500.html +1 -1
  216. package/.next/server/prefetch-hints.json +19 -0
  217. package/.next/server/server-reference-manifest.js +1 -1
  218. package/.next/server/server-reference-manifest.json +1 -1
  219. package/.next/static/chunks/050mq8l4e1ubn.js +1 -0
  220. package/.next/static/chunks/098le48845_fg.js +3 -0
  221. package/.next/static/chunks/0cw4-ebkoufdc.js +1 -0
  222. package/.next/static/chunks/0feo-go1w5nct.js +1 -0
  223. package/.next/static/chunks/14sefb904pl64.js +21 -0
  224. package/.next/static/chunks/1fer-wulyrjrs.js +3 -0
  225. package/.next/static/chunks/1o7b1x4umy8a6.js +1 -0
  226. package/.next/static/chunks/1q_io1j58aukw.js +1 -0
  227. package/.next/static/chunks/1t-cgh4477hfo.js +1 -0
  228. package/.next/static/chunks/1u-1po1qesc9f.js +1 -0
  229. package/.next/static/chunks/1u5kegkgm0xoz.js +1 -0
  230. package/.next/static/chunks/24ygzsgd-moqy.js +1 -0
  231. package/.next/static/chunks/26folxgplfa9t.js +68 -0
  232. package/.next/static/chunks/2ocixvjhv34_3.js +1 -0
  233. package/.next/static/chunks/3_lsdgxa-h7ma.css +10 -0
  234. package/.next/static/chunks/3rmv-sb9w9i3e.js +1 -0
  235. package/.next/static/chunks/3ttzomivj48jh.js +2 -0
  236. package/README.md +1 -1
  237. package/package.json +1 -1
  238. package/.next/server/chunks/ssr/1x05_lucide-react_dist_esm_icons_08ca0b4._.js +0 -3
  239. package/.next/server/chunks/ssr/1x05_lucide-react_dist_esm_icons_08ca0b4._.js.map +0 -1
  240. package/.next/server/chunks/ssr/1x05_lucide-react_dist_esm_icons_0c1k9is._.js +0 -3
  241. package/.next/server/chunks/ssr/1x05_lucide-react_dist_esm_icons_0c1k9is._.js.map +0 -1
  242. package/.next/server/chunks/ssr/_01suk2m._.js +0 -3
  243. package/.next/server/chunks/ssr/_01suk2m._.js.map +0 -1
  244. package/.next/server/chunks/ssr/_0qyglif._.js +0 -5
  245. package/.next/server/chunks/ssr/_0qyglif._.js.map +0 -1
  246. package/.next/server/chunks/ssr/_0skuoxv._.js +0 -6
  247. package/.next/server/chunks/ssr/_0skuoxv._.js.map +0 -1
  248. package/.next/server/chunks/ssr/_14i_6yb._.js +0 -3
  249. package/.next/server/chunks/ssr/_14i_6yb._.js.map +0 -1
  250. package/.next/server/chunks/ssr/_1cbhuz4._.js +0 -3
  251. package/.next/server/chunks/ssr/_1cbhuz4._.js.map +0 -1
  252. package/.next/server/chunks/ssr/_1ewk_mn._.js +0 -3
  253. package/.next/server/chunks/ssr/_1ewk_mn._.js.map +0 -1
  254. package/.next/server/chunks/ssr/node_modules__pnpm_1dcmsrg._.js +0 -3
  255. package/.next/server/chunks/ssr/node_modules__pnpm_1dcmsrg._.js.map +0 -1
  256. package/.next/server/chunks/ssr/src_components_008q3v8._.js +0 -3
  257. package/.next/server/chunks/ssr/src_components_008q3v8._.js.map +0 -1
  258. package/.next/static/chunks/02sab26ica2x3.js +0 -1
  259. package/.next/static/chunks/0eggcu0ovk8sd.js +0 -68
  260. package/.next/static/chunks/0iva6rdtfqpbz.js +0 -1
  261. package/.next/static/chunks/0qm101bdsxdyh.css +0 -10
  262. package/.next/static/chunks/0wg9n5zb8mo2p.js +0 -1
  263. package/.next/static/chunks/0wjw1laqwg-cr.js +0 -21
  264. package/.next/static/chunks/0z_y7el6m76yk.js +0 -1
  265. package/.next/static/chunks/1-ekntoveuxzd.js +0 -4
  266. package/.next/static/chunks/1g6fxjtlpv6p5.js +0 -1
  267. package/.next/static/chunks/1ytqu-ra-fylk.js +0 -3
  268. package/.next/static/chunks/3dlnlsyyysw5m.js +0 -1
  269. package/.next/static/chunks/3kkg030rcpz7l.js +0 -1
  270. package/.next/static/chunks/3pf_4ye6ju8gt.js +0 -1
  271. /package/.next/server/chunks/{ssr/0_nd_mermaid_dist_mermaid_core_mjs_10jvzv6._.js.map → 11mp_@anthropic-ai_sdk_index_mjs_0d2_lq6._.js.map} +0 -0
  272. /package/.next/server/chunks/{ssr/1u84_katex_dist_katex_mjs_05prlqa._.js.map → _next-internal_server_app_api_conversations_route_actions_1-pu7gs.js.map} +0 -0
  273. /package/.next/server/chunks/ssr/{node_modules__pnpm_08em703._.js.map → 0_nd_mermaid_dist_mermaid_core_mjs_0vv_0i3._.js.map} +0 -0
  274. /package/.next/server/chunks/ssr/{node_modules__pnpm_0wnlgm-._.js.map → 1u84_katex_dist_katex_mjs_1z0p1bs._.js.map} +0 -0
  275. /package/.next/server/chunks/ssr/{node_modules__pnpm_1jfqun_._.js.map → _next-internal_server_app_(app)_chat_page_actions_0g4tbzt.js.map} +0 -0
  276. /package/.next/server/chunks/ssr/{node_modules__pnpm_1kngagu._.js.map → node_modules__pnpm_0286-tg._.js.map} +0 -0
  277. /package/.next/server/chunks/ssr/{node_modules__pnpm_1ad2q27._.js.map → node_modules__pnpm_04khl_s._.js.map} +0 -0
  278. /package/.next/server/chunks/ssr/{node_modules__pnpm_0ns_6dd._.js.map → node_modules__pnpm_07t_e8c._.js.map} +0 -0
  279. /package/.next/server/chunks/ssr/{node_modules__pnpm_0baie09._.js.map → node_modules__pnpm_08sqeu2._.js.map} +0 -0
  280. /package/.next/server/chunks/ssr/{node_modules__pnpm_1o3_0-n._.js.map → node_modules__pnpm_0a9b2ei._.js.map} +0 -0
  281. /package/.next/server/chunks/ssr/{node_modules__pnpm_0e15nhj._.js.map → node_modules__pnpm_0ah02mu._.js.map} +0 -0
  282. /package/.next/server/chunks/ssr/{node_modules__pnpm_20tdqv_._.js.map → node_modules__pnpm_0cj8ryj._.js.map} +0 -0
  283. /package/.next/server/chunks/ssr/{node_modules__pnpm_1h890n6._.js.map → node_modules__pnpm_0f77_ng._.js.map} +0 -0
  284. /package/.next/server/chunks/ssr/{node_modules__pnpm_1u8p2h3._.js.map → node_modules__pnpm_0fd3pr1._.js.map} +0 -0
  285. /package/.next/server/chunks/ssr/{node_modules__pnpm_1zu-9we._.js.map → node_modules__pnpm_0gifu-u._.js.map} +0 -0
  286. /package/.next/server/chunks/ssr/{node_modules__pnpm_1_o0jyk._.js.map → node_modules__pnpm_0jpv2b6._.js.map} +0 -0
  287. /package/.next/server/chunks/ssr/{node_modules__pnpm_1f3lm9p._.js.map → node_modules__pnpm_0og06fy._.js.map} +0 -0
  288. /package/.next/server/chunks/ssr/{node_modules__pnpm_12s6q4d._.js.map → node_modules__pnpm_0qc3gsk._.js.map} +0 -0
  289. /package/.next/server/chunks/ssr/{node_modules__pnpm_0e3u5g-._.js.map → node_modules__pnpm_0ts89ne._.js.map} +0 -0
  290. /package/.next/server/chunks/ssr/{node_modules__pnpm_1moe8b6._.js.map → node_modules__pnpm_0ttvopp._.js.map} +0 -0
  291. /package/.next/server/chunks/ssr/{node_modules__pnpm_1ly58kw._.js.map → node_modules__pnpm_0u3u82f._.js.map} +0 -0
  292. /package/.next/server/chunks/ssr/{node_modules__pnpm_1hw4h9e._.js.map → node_modules__pnpm_0y35hs4._.js.map} +0 -0
  293. /package/.next/server/chunks/ssr/{node_modules__pnpm_0jhh7p5._.js.map → node_modules__pnpm_104pzhc._.js.map} +0 -0
  294. /package/.next/server/chunks/ssr/{node_modules__pnpm_1gqkoe3._.js.map → node_modules__pnpm_195j8p_._.js.map} +0 -0
  295. /package/.next/server/chunks/ssr/{node_modules__pnpm_0i0uccx._.js.map → node_modules__pnpm_1l8k8w1._.js.map} +0 -0
  296. /package/.next/server/chunks/ssr/{node_modules__pnpm_0rd-a9g._.js.map → node_modules__pnpm_1w0f1m5._.js.map} +0 -0
  297. /package/.next/server/chunks/ssr/{node_modules__pnpm_1gtgu48._.js.map → node_modules__pnpm_1woddr6._.js.map} +0 -0
  298. /package/.next/server/chunks/ssr/{node_modules__pnpm_0_z3_bl._.js.map → node_modules__pnpm_1x0t5_z._.js.map} +0 -0
  299. /package/.next/server/chunks/ssr/{node_modules__pnpm_07_kgbe._.js.map → node_modules__pnpm_1xzf8g_._.js.map} +0 -0
  300. /package/.next/static/{ICaoXcRMmgrIFWk8C_Z6D → uJ5RYxgFnE5svAvnuLDXN}/_buildManifest.js +0 -0
  301. /package/.next/static/{ICaoXcRMmgrIFWk8C_Z6D → uJ5RYxgFnE5svAvnuLDXN}/_clientMiddlewareManifest.js +0 -0
  302. /package/.next/static/{ICaoXcRMmgrIFWk8C_Z6D → uJ5RYxgFnE5svAvnuLDXN}/_ssgManifest.js +0 -0
@@ -1,6 +1,6 @@
1
- module.exports=[522734,(t,e,i)=>{e.exports=t.x("fs",()=>require("fs"))},924868,(t,e,i)=>{e.exports=t.x("fs/promises",()=>require("fs/promises"))},687769,(t,e,i)=>{e.exports=t.x("node:events",()=>require("node:events"))},899871,(t,e,i)=>{e.exports=t.x("node:string_decoder",()=>require("node:string_decoder"))},857764,(t,e,i)=>{e.exports=t.x("node:url",()=>require("node:url"))},799501,975283,31451,t=>{"use strict";var e=t.i(924868),i=t.i(814747),s=t.i(857764),r=t.i(750227),n=t.i(522734),a=t.i(902157),o=t.i(912714),h=t.i(687769),l=t.i(81111),d=t.i(899871),u=(t,e,i)=>{let s=t instanceof RegExp?c(t,i):t,r=e instanceof RegExp?c(e,i):e,n=null!==s&&null!=r&&p(s,r,i);return n&&{start:n[0],end:n[1],pre:i.slice(0,n[0]),body:i.slice(n[0]+s.length,n[1]),post:i.slice(n[1]+r.length)}},c=(t,e)=>{let i=e.match(t);return i?i[0]:null},p=(t,e,i)=>{let s,r,n,a,o,h=i.indexOf(t),l=i.indexOf(e,h+1),d=h;if(h>=0&&l>0){if(t===e)return[h,l];for(s=[],n=i.length;d>=0&&!o;){if(d===h)s.push(d),h=i.indexOf(t,d+1);else if(1===s.length){let t=s.pop();void 0!==t&&(o=[t,l])}else void 0!==(r=s.pop())&&r<n&&(n=r,a=l),l=i.indexOf(e,d+1);d=h<l&&h>=0?h:l}s.length&&void 0!==a&&(o=[n,a])}return o},f="\0SLASH"+Math.random()+"\0",m="\0OPEN"+Math.random()+"\0",g="\0CLOSE"+Math.random()+"\0",w="\0COMMA"+Math.random()+"\0",y="\0PERIOD"+Math.random()+"\0",b=RegExp(f,"g"),v=RegExp(m,"g"),S=RegExp(g,"g"),k=RegExp(w,"g"),$=RegExp(y,"g"),E=/\\\\/g,x=/\\{/g,C=/\\}/g,O=/\\,/g,A=/\\./g;function R(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function T(t){return t.replace(b,"\\").replace(v,"{").replace(S,"}").replace(k,",").replace($,".")}function F(t){return"{"+t+"}"}function j(t){return/^-?0\d/.test(t)}function _(t,e){return t<=e}function D(t,e){return t>=e}var M=t=>{if("string"!=typeof t)throw TypeError("invalid pattern");if(t.length>65536)throw TypeError("pattern is too long")},P={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},N=t=>t.replace(/[[\]\\-]/g,"\\$&"),W=(t,e)=>{if("["!==t.charAt(e))throw Error("not in a brace expression");let i=[],s=[],r=e+1,n=!1,a=!1,o=!1,h=!1,l=e,d="";t:for(;r<t.length;){let u=t.charAt(r);if(("!"===u||"^"===u)&&r===e+1){h=!0,r++;continue}if("]"===u&&n&&!o){l=r+1;break}if(n=!0,"\\"===u&&!o){o=!0,r++;continue}if("["===u&&!o){for(let[n,[o,h,l]]of Object.entries(P))if(t.startsWith(n,r)){if(d)return["$.",!1,t.length-e,!0];r+=n.length,l?s.push(o):i.push(o),a=a||h;continue t}}if(o=!1,d){u>d?i.push(N(d)+"-"+N(u)):u===d&&i.push(N(u)),d="",r++;continue}if(t.startsWith("-]",r+1)){i.push(N(u+"-")),r+=2;continue}if(t.startsWith("-",r+1)){d=u,r+=2;continue}i.push(N(u)),r++}if(l<r)return["",!1,0,!1];if(!i.length&&!s.length)return["$.",!1,t.length-e,!0];if(0===s.length&&1===i.length&&/^\\?.$/.test(i[0])&&!h)return[(2===i[0].length?i[0].slice(-1):i[0]).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),!1,l-e,!1];let u="["+(h?"^":"")+i.join("")+"]",c="["+(h?"":"^")+s.join("")+"]";return[i.length&&s.length?"("+u+"|"+c+")":i.length?u:c,a,l-e,!0]},L=(t,{windowsPathsNoEscape:e=!1,magicalBraces:i=!0}={})=>i?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1"),z=new Set(["!","?","+","*","@"]),I=t=>z.has(t),U="(?!\\.)",B=new Set(["[","."]),G=new Set(["..","."]),q=new Set("().*{}+?[]^$\\!"),Y=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),H="[^/]",J=H+"*?",K=H+"+?",V=class t{type;#t;#e;#i=!1;#s=[];#r;#n;#a;#o=!1;#h;#l;#d=!1;constructor(t,e,i={}){this.type=t,t&&(this.#e=!0),this.#r=e,this.#t=this.#r?this.#r.#t:this,this.#h=this.#t===this?i:this.#t.#h,this.#a=this.#t===this?[]:this.#t.#a,"!"!==t||this.#t.#o||this.#a.push(this),this.#n=this.#r?this.#r.#s.length:0}get hasMagic(){if(void 0!==this.#e)return this.#e;for(let t of this.#s)if("string"!=typeof t&&(t.type||t.hasMagic))return this.#e=!0;return this.#e}toString(){return void 0!==this.#l?this.#l:this.type?this.#l=this.type+"("+this.#s.map(t=>String(t)).join("|")+")":this.#l=this.#s.map(t=>String(t)).join("")}#u(){let t;if(this!==this.#t)throw Error("should only call on root");if(this.#o)return this;for(this.toString(),this.#o=!0;t=this.#a.pop();){if("!"!==t.type)continue;let e=t,i=e.#r;for(;i;){for(let s=e.#n+1;!i.type&&s<i.#s.length;s++)for(let e of t.#s){if("string"==typeof e)throw Error("string part in extglob AST??");e.copyIn(i.#s[s])}i=(e=i).#r}}return this}push(...e){for(let i of e)if(""!==i){if("string"!=typeof i&&!(i instanceof t&&i.#r===this))throw Error("invalid part: "+i);this.#s.push(i)}}toJSON(){let t=null===this.type?this.#s.slice().map(t=>"string"==typeof t?t:t.toJSON()):[this.type,...this.#s.map(t=>t.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#o&&this.#r?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#r?.isStart())return!1;if(0===this.#n)return!0;let e=this.#r;for(let i=0;i<this.#n;i++){let s=e.#s[i];if(!(s instanceof t&&"!"===s.type))return!1}return!0}isEnd(){if(this.#t===this||this.#r?.type==="!")return!0;if(!this.#r?.isEnd())return!1;if(!this.type)return this.#r?.isEnd();let t=this.#r?this.#r.#s.length:0;return this.#n===t-1}copyIn(t){"string"==typeof t?this.push(t):this.push(t.clone(this))}clone(e){let i=new t(this.type,e);for(let t of this.#s)i.copyIn(t);return i}static #c(e,i,s,r){let n=!1,a=!1,o=-1,h=!1;if(null===i.type){let l=s,d="";for(;l<e.length;){let s=e.charAt(l++);if(n||"\\"===s){n=!n,d+=s;continue}if(a){l===o+1?("^"===s||"!"===s)&&(h=!0):"]"!==s||l===o+2&&h||(a=!1),d+=s;continue}if("["===s){a=!0,o=l,h=!1,d+=s;continue}if(!r.noext&&I(s)&&"("===e.charAt(l)){i.push(d),d="";let n=new t(s,i);l=t.#c(e,n,l,r),i.push(n);continue}d+=s}return i.push(d),l}let l=s+1,d=new t(null,i),u=[],c="";for(;l<e.length;){let s=e.charAt(l++);if(n||"\\"===s){n=!n,c+=s;continue}if(a){l===o+1?("^"===s||"!"===s)&&(h=!0):"]"!==s||l===o+2&&h||(a=!1),c+=s;continue}if("["===s){a=!0,o=l,h=!1,c+=s;continue}if(I(s)&&"("===e.charAt(l)){d.push(c),c="";let i=new t(s,d);d.push(i),l=t.#c(e,i,l,r);continue}if("|"===s){d.push(c),c="",u.push(d),d=new t(null,i);continue}if(")"===s)return""===c&&0===i.#s.length&&(i.#d=!0),d.push(c),c="",i.push(...u,d),l;c+=s}return i.type=null,i.#e=void 0,i.#s=[e.substring(s-1)],l}static fromGlob(e,i={}){let s=new t(null,void 0,i);return t.#c(e,s,0,i),s}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[e,i,s,r]=this.toRegExpSource();return s||this.#e||this.#h.nocase&&!this.#h.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()?Object.assign(RegExp(`^${e}$`,(this.#h.nocase?"i":"")+(r?"u":"")),{_src:e,_glob:t}):i}get options(){return this.#h}toRegExpSource(e){let i=e??!!this.#h.dot;if(this.#t===this&&this.#u(),!this.type){let s=this.isStart()&&this.isEnd()&&!this.#s.some(t=>"string"!=typeof t),r=this.#s.map(i=>{let[r,n,a,o]="string"==typeof i?t.#p(i,this.#e,s):i.toRegExpSource(e);return this.#e=this.#e||a,this.#i=this.#i||o,r}).join(""),n="";if(this.isStart()&&"string"==typeof this.#s[0]&&!(1===this.#s.length&&G.has(this.#s[0]))){let t=i&&B.has(r.charAt(0))||r.startsWith("\\.")&&B.has(r.charAt(2))||r.startsWith("\\.\\.")&&B.has(r.charAt(4)),s=!i&&!e&&B.has(r.charAt(0));n=t?"(?!(?:^|/)\\.\\.?(?:$|/))":s?U:""}let a="";return this.isEnd()&&this.#t.#o&&this.#r?.type==="!"&&(a="(?:$|\\/)"),[n+r+a,L(r),this.#e=!!this.#e,this.#i]}let s="*"===this.type||"+"===this.type,r="!"===this.type?"(?:(?!(?:":"(?:",n=this.#f(i);if(this.isStart()&&this.isEnd()&&!n&&"!"!==this.type){let t=this.toString();return this.#s=[t],this.type=null,this.#e=void 0,[t,L(this.toString()),!1,!1]}let a=!s||e||i||!U?"":this.#f(!0);a===n&&(a=""),a&&(n=`(?:${n})(?:${a})*?`);return["!"===this.type&&this.#d?(this.isStart()&&!i?U:"")+K:r+n+("!"===this.type?"))"+(!this.isStart()||i||e?"":U)+J+")":"@"===this.type?")":"?"===this.type?")?":"+"===this.type&&a?")":"*"===this.type&&a?")?":`)${this.type}`),L(n),this.#e=!!this.#e,this.#i]}#f(t){return this.#s.map(e=>{if("string"==typeof e)throw Error("string type in extglob ast??");let[i,s,r,n]=e.toRegExpSource(t);return this.#i=this.#i||n,i}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static #p(t,e,i=!1){let s=!1,r="",n=!1,a=!1;for(let o=0;o<t.length;o++){let h=t.charAt(o);if(s){s=!1,r+=(q.has(h)?"\\":"")+h;continue}if("*"===h){if(a)continue;a=!0,r+=i&&/^[*]+$/.test(t)?K:J,e=!0;continue}if(a=!1,"\\"===h){o===t.length-1?r+="\\\\":s=!0;continue}if("["===h){let[i,s,a,h]=W(t,o);if(a){r+=i,n=n||s,o+=a-1,e=e||h;continue}}if("?"===h){r+=H,e=!0;continue}r+=Y(h)}return[r,L(t),!!e,n]}},X=(t,{windowsPathsNoEscape:e=!1,magicalBraces:i=!1}={})=>i?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&"),Z=(t,e,i={})=>(M(e),(!!i.nocomment||"#"!==e.charAt(0))&&new tg(e,i).match(t)),Q=/^\*+([^+@!?\*\[\(]*)$/,tt=/^\*+\.\*+$/,te=t=>!t.startsWith(".")&&t.includes("."),ti=t=>"."!==t&&".."!==t&&t.includes("."),ts=/^\.\*+$/,tr=t=>"."!==t&&".."!==t&&t.startsWith("."),tn=/^\*+$/,ta=t=>0!==t.length&&!t.startsWith("."),to=t=>0!==t.length&&"."!==t&&".."!==t,th=/^\?+([^+@!?\*\[\(]*)?$/,tl=([t])=>{let e=t.length;return t=>t.length===e&&!t.startsWith(".")},td=([t])=>{let e=t.length;return t=>t.length===e&&"."!==t&&".."!==t},tu="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix";Z.sep="win32"===tu?"\\":"/";var tc=Symbol("globstar **");Z.GLOBSTAR=tc;Z.filter=(t,e={})=>i=>Z(i,t,e);var tp=(t,e={})=>Object.assign({},t,e);Z.defaults=t=>{if(!t||"object"!=typeof t||!Object.keys(t).length)return Z;let e=Z;return Object.assign((i,s,r={})=>e(i,s,tp(t,r)),{Minimatch:class extends e.Minimatch{constructor(e,i={}){super(e,tp(t,i))}static defaults(i){return e.defaults(tp(t,i)).Minimatch}},AST:class extends e.AST{constructor(e,i,s={}){super(e,i,tp(t,s))}static fromGlob(i,s={}){return e.AST.fromGlob(i,tp(t,s))}},unescape:(i,s={})=>e.unescape(i,tp(t,s)),escape:(i,s={})=>e.escape(i,tp(t,s)),filter:(i,s={})=>e.filter(i,tp(t,s)),defaults:i=>e.defaults(tp(t,i)),makeRe:(i,s={})=>e.makeRe(i,tp(t,s)),braceExpand:(i,s={})=>e.braceExpand(i,tp(t,s)),match:(i,s,r={})=>e.match(i,s,tp(t,r)),sep:e.sep,GLOBSTAR:tc})};var tf=(t,e={})=>(M(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:function(t,e={}){if(!t)return[];let{max:i=1e5}=e;return"{}"===t.slice(0,2)&&(t="\\{\\}"+t.slice(2)),(function t(e,i,s){let r=[],n=u("{","}",e);if(!n)return[e];let a=n.pre,o=n.post.length?t(n.post,i,!1):[""];if(/\$$/.test(n.pre))for(let t=0;t<o.length&&t<i;t++){let e=a+"{"+n.body+"}"+o[t];r.push(e)}else{let h,l,d=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),p=d||c,f=n.body.indexOf(",")>=0;if(!p&&!f)return n.post.match(/,(?!,).*\}/)?t(e=n.pre+"{"+n.body+g+n.post,i,!0):[e];if(p)h=n.body.split(/\.\./);else if(1===(h=function t(e){if(!e)return[""];let i=[],s=u("{","}",e);if(!s)return e.split(",");let{pre:r,body:n,post:a}=s,o=r.split(",");o[o.length-1]+="{"+n+"}";let h=t(a);return a.length&&(o[o.length-1]+=h.shift(),o.push.apply(o,h)),i.push.apply(i,o),i}(n.body)).length&&void 0!==h[0]&&1===(h=t(h[0],i,!1).map(F)).length)return o.map(t=>n.pre+h[0]+t);if(p&&void 0!==h[0]&&void 0!==h[1]){let t=R(h[0]),e=R(h[1]),i=Math.max(h[0].length,h[1].length),s=3===h.length&&void 0!==h[2]?Math.abs(R(h[2])):1,r=_;e<t&&(s*=-1,r=D);let n=h.some(j);l=[];for(let a=t;r(a,e);a+=s){let t;if(c)"\\"===(t=String.fromCharCode(a))&&(t="");else if(t=String(a),n){let e=i-t.length;if(e>0){let i=Array(e+1).join("0");t=a<0?"-"+i+t.slice(1):i+t}}l.push(t)}}else{l=[];for(let e=0;e<h.length;e++)l.push.apply(l,t(h[e],i,!1))}for(let t=0;t<l.length;t++)for(let e=0;e<o.length&&r.length<i;e++){let i=a+l[t]+o[e];(!s||p||i)&&r.push(i)}}return r})(t.replace(E,f).replace(x,m).replace(C,g).replace(O,w).replace(A,y),i,!0).map(T)}(t,{max:e.braceExpandMax}));Z.braceExpand=tf,Z.makeRe=(t,e={})=>new tg(t,e).makeRe(),Z.match=(t,e,i={})=>{let s=new tg(e,i);return t=t.filter(t=>s.match(t)),s.options.nonull&&!t.length&&t.push(e),t};var tm=/[?*]|[+@!]\(.*?\)|\[|\]/,tg=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){M(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||tu,this.isWindows="win32"===this.platform,this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||!1===e.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=void 0!==e.windowsNoMagicRoot?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if("string"!=typeof e)return!0;return!1}debug(){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&"#"===t.charAt(0)){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...t)=>console.error(...t)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(t=>this.slashSplit(t));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let s=this.globParts.map((t,e,i)=>{if(this.isWindows&&this.windowsNoMagicRoot){let e=""===t[0]&&""===t[1]&&("?"===t[2]||!tm.test(t[2]))&&!tm.test(t[3]),i=/^[a-z]:/i.test(t[0]);if(e)return[...t.slice(0,4),...t.slice(4).map(t=>this.parse(t))];if(i)return[t[0],...t.slice(1).map(t=>this.parse(t))]}return t.map(t=>this.parse(t))});if(this.debug(this.pattern,s),this.set=s.filter(t=>-1===t.indexOf(!1)),this.isWindows)for(let t=0;t<this.set.length;t++){let e=this.set[t];""===e[0]&&""===e[1]&&"?"===this.globParts[t][2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3])&&(e[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let e=0;e<t.length;e++)for(let i=0;i<t[e].length;i++)"**"===t[e][i]&&(t[e][i]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):t=e>=1?this.levelOneOptimize(t):this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(t=>{let e=-1;for(;-1!==(e=t.indexOf("**",e+1));){let i=e;for(;"**"===t[i+1];)i++;i!==e&&t.splice(e,i-e)}return t})}levelOneOptimize(t){return t.map(t=>0===(t=t.reduce((t,e)=>{let i=t[t.length-1];return"**"===e&&"**"===i||(".."===e&&i&&".."!==i&&"."!==i&&"**"!==i?t.pop():t.push(e)),t},[])).length?[""]:t)}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let s=t[i];1===i&&""===s&&""===t[0]||("."===s||""===s)&&(e=!0,t.splice(i,1),i--)}"."===t[0]&&2===t.length&&("."===t[1]||""===t[1])&&(e=!0,t.pop())}let i=0;for(;-1!==(i=t.indexOf("..",i+1));){let s=t[i-1];s&&"."!==s&&".."!==s&&"**"!==s&&(e=!0,t.splice(i-1,2),i-=2)}}while(e)return 0===t.length?[""]:t}firstPhasePreProcess(t){let e=!1;do for(let i of(e=!1,t)){let s=-1;for(;-1!==(s=i.indexOf("**",s+1));){let r=s;for(;"**"===i[r+1];)r++;r>s&&i.splice(s+1,r-s);let n=i[s+1],a=i[s+2],o=i[s+3];if(".."!==n||!a||"."===a||".."===a||!o||"."===o||".."===o)continue;e=!0,i.splice(s,1);let h=i.slice(0);h[s]="**",t.push(h),s--}if(!this.preserveMultipleSlashes){for(let t=1;t<i.length-1;t++){let s=i[t];1===t&&""===s&&""===i[0]||("."===s||""===s)&&(e=!0,i.splice(t,1),t--)}"."===i[0]&&2===i.length&&("."===i[1]||""===i[1])&&(e=!0,i.pop())}let r=0;for(;-1!==(r=i.indexOf("..",r+1));){let t=i[r-1];if(t&&"."!==t&&".."!==t&&"**"!==t){e=!0;let t=1===r&&"**"===i[r+1]?["."]:[];i.splice(r-1,2,...t),0===i.length&&i.push(""),r-=2}}}while(e)return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let i=e+1;i<t.length;i++){let s=this.partsMatch(t[e],t[i],!this.preserveMultipleSlashes);if(s){t[e]=[],t[i]=s;break}}return t.filter(t=>t.length)}partsMatch(t,e,i=!1){let s=0,r=0,n=[],a="";for(;s<t.length&&r<e.length;)if(t[s]===e[r])n.push("b"===a?e[r]:t[s]),s++,r++;else if(i&&"**"===t[s]&&e[r]===t[s+1])n.push(t[s]),s++;else if(i&&"**"===e[r]&&t[s]===e[r+1])n.push(e[r]),r++;else if("*"===t[s]&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&"**"!==e[r]){if("b"===a)return!1;a="a",n.push(t[s]),s++,r++}else{if("*"!==e[r]||!t[s]||!this.options.dot&&t[s].startsWith(".")||"**"===t[s]||"a"===a)return!1;a="b",n.push(e[r]),s++,r++}return t.length===e.length&&n}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,i=0;for(let s=0;s<t.length&&"!"===t.charAt(s);s++)e=!e,i++;i&&(this.pattern=t.slice(i)),this.negate=e}matchOne(t,e,i=!1){let s=this.options;if(this.isWindows){let i="string"==typeof t[0]&&/^[a-z]:$/i.test(t[0]),s=!i&&""===t[0]&&""===t[1]&&"?"===t[2]&&/^[a-z]:$/i.test(t[3]),r="string"==typeof e[0]&&/^[a-z]:$/i.test(e[0]),n=!r&&""===e[0]&&""===e[1]&&"?"===e[2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3]),a=s?3:i?0:void 0,o=n?3:r?0:void 0;if("number"==typeof a&&"number"==typeof o){let[i,s]=[t[a],e[o]];i.toLowerCase()===s.toLowerCase()&&(e[o]=i,o>a?e=e.slice(o):a>o&&(t=t.slice(a)))}}let{optimizationLevel:r=1}=this.options;r>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var n=0,a=0,o=t.length,h=e.length;n<o&&a<h;n++,a++){let r;this.debug("matchOne loop");var l=e[a],d=t[n];if(this.debug(e,l,d),!1===l)return!1;if(l===tc){this.debug("GLOBSTAR",[e,l,d]);var u=n,c=a+1;if(c===h){for(this.debug("** at the end");n<o;n++)if("."===t[n]||".."===t[n]||!s.dot&&"."===t[n].charAt(0))return!1;return!0}for(;u<o;){var p=t[u];if(this.debug(`
1
+ module.exports=[522734,(t,e,i)=>{e.exports=t.x("fs",()=>require("fs"))},924868,(t,e,i)=>{e.exports=t.x("fs/promises",()=>require("fs/promises"))},687769,(t,e,i)=>{e.exports=t.x("node:events",()=>require("node:events"))},899871,(t,e,i)=>{e.exports=t.x("node:string_decoder",()=>require("node:string_decoder"))},857764,(t,e,i)=>{e.exports=t.x("node:url",()=>require("node:url"))},799501,975283,31451,t=>{"use strict";var e=t.i(924868),i=t.i(814747),s=t.i(857764),r=t.i(750227),n=t.i(522734),a=t.i(902157),o=t.i(912714),h=t.i(687769),l=t.i(81111),d=t.i(899871),u=(t,e,i)=>{let s=t instanceof RegExp?c(t,i):t,r=e instanceof RegExp?c(e,i):e,n=null!==s&&null!=r&&p(s,r,i);return n&&{start:n[0],end:n[1],pre:i.slice(0,n[0]),body:i.slice(n[0]+s.length,n[1]),post:i.slice(n[1]+r.length)}},c=(t,e)=>{let i=e.match(t);return i?i[0]:null},p=(t,e,i)=>{let s,r,n,a,o,h=i.indexOf(t),l=i.indexOf(e,h+1),d=h;if(h>=0&&l>0){if(t===e)return[h,l];for(s=[],n=i.length;d>=0&&!o;){if(d===h)s.push(d),h=i.indexOf(t,d+1);else if(1===s.length){let t=s.pop();void 0!==t&&(o=[t,l])}else void 0!==(r=s.pop())&&r<n&&(n=r,a=l),l=i.indexOf(e,d+1);d=h<l&&h>=0?h:l}s.length&&void 0!==a&&(o=[n,a])}return o},f="\0SLASH"+Math.random()+"\0",m="\0OPEN"+Math.random()+"\0",g="\0CLOSE"+Math.random()+"\0",w="\0COMMA"+Math.random()+"\0",y="\0PERIOD"+Math.random()+"\0",b=RegExp(f,"g"),v=RegExp(m,"g"),S=RegExp(g,"g"),k=RegExp(w,"g"),$=RegExp(y,"g"),E=/\\\\/g,x=/\\{/g,C=/\\}/g,O=/\\,/g,A=/\\./g;function R(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function j(t){return t.replace(b,"\\").replace(v,"{").replace(S,"}").replace(k,",").replace($,".")}function F(t){return"{"+t+"}"}function T(t){return/^-?0\d/.test(t)}function _(t,e){return t<=e}function D(t,e){return t>=e}var M=t=>{if("string"!=typeof t)throw TypeError("invalid pattern");if(t.length>65536)throw TypeError("pattern is too long")},P={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},N=t=>t.replace(/[[\]\\-]/g,"\\$&"),W=(t,e)=>{if("["!==t.charAt(e))throw Error("not in a brace expression");let i=[],s=[],r=e+1,n=!1,a=!1,o=!1,h=!1,l=e,d="";t:for(;r<t.length;){let u=t.charAt(r);if(("!"===u||"^"===u)&&r===e+1){h=!0,r++;continue}if("]"===u&&n&&!o){l=r+1;break}if(n=!0,"\\"===u&&!o){o=!0,r++;continue}if("["===u&&!o){for(let[n,[o,h,l]]of Object.entries(P))if(t.startsWith(n,r)){if(d)return["$.",!1,t.length-e,!0];r+=n.length,l?s.push(o):i.push(o),a=a||h;continue t}}if(o=!1,d){u>d?i.push(N(d)+"-"+N(u)):u===d&&i.push(N(u)),d="",r++;continue}if(t.startsWith("-]",r+1)){i.push(N(u+"-")),r+=2;continue}if(t.startsWith("-",r+1)){d=u,r+=2;continue}i.push(N(u)),r++}if(l<r)return["",!1,0,!1];if(!i.length&&!s.length)return["$.",!1,t.length-e,!0];if(0===s.length&&1===i.length&&/^\\?.$/.test(i[0])&&!h)return[(2===i[0].length?i[0].slice(-1):i[0]).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),!1,l-e,!1];let u="["+(h?"^":"")+i.join("")+"]",c="["+(h?"":"^")+s.join("")+"]";return[i.length&&s.length?"("+u+"|"+c+")":i.length?u:c,a,l-e,!0]},L=(t,{windowsPathsNoEscape:e=!1,magicalBraces:i=!0}={})=>i?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1"),z=new Set(["!","?","+","*","@"]),I=t=>z.has(t),U="(?!\\.)",B=new Set(["[","."]),G=new Set(["..","."]),q=new Set("().*{}+?[]^$\\!"),Y=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),H="[^/]",J=H+"*?",K=H+"+?",V=class t{type;#t;#e;#i=!1;#s=[];#r;#n;#a;#o=!1;#h;#l;#d=!1;constructor(t,e,i={}){this.type=t,t&&(this.#e=!0),this.#r=e,this.#t=this.#r?this.#r.#t:this,this.#h=this.#t===this?i:this.#t.#h,this.#a=this.#t===this?[]:this.#t.#a,"!"!==t||this.#t.#o||this.#a.push(this),this.#n=this.#r?this.#r.#s.length:0}get hasMagic(){if(void 0!==this.#e)return this.#e;for(let t of this.#s)if("string"!=typeof t&&(t.type||t.hasMagic))return this.#e=!0;return this.#e}toString(){return void 0!==this.#l?this.#l:this.type?this.#l=this.type+"("+this.#s.map(t=>String(t)).join("|")+")":this.#l=this.#s.map(t=>String(t)).join("")}#u(){let t;if(this!==this.#t)throw Error("should only call on root");if(this.#o)return this;for(this.toString(),this.#o=!0;t=this.#a.pop();){if("!"!==t.type)continue;let e=t,i=e.#r;for(;i;){for(let s=e.#n+1;!i.type&&s<i.#s.length;s++)for(let e of t.#s){if("string"==typeof e)throw Error("string part in extglob AST??");e.copyIn(i.#s[s])}i=(e=i).#r}}return this}push(...e){for(let i of e)if(""!==i){if("string"!=typeof i&&!(i instanceof t&&i.#r===this))throw Error("invalid part: "+i);this.#s.push(i)}}toJSON(){let t=null===this.type?this.#s.slice().map(t=>"string"==typeof t?t:t.toJSON()):[this.type,...this.#s.map(t=>t.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#o&&this.#r?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#r?.isStart())return!1;if(0===this.#n)return!0;let e=this.#r;for(let i=0;i<this.#n;i++){let s=e.#s[i];if(!(s instanceof t&&"!"===s.type))return!1}return!0}isEnd(){if(this.#t===this||this.#r?.type==="!")return!0;if(!this.#r?.isEnd())return!1;if(!this.type)return this.#r?.isEnd();let t=this.#r?this.#r.#s.length:0;return this.#n===t-1}copyIn(t){"string"==typeof t?this.push(t):this.push(t.clone(this))}clone(e){let i=new t(this.type,e);for(let t of this.#s)i.copyIn(t);return i}static #c(e,i,s,r){let n=!1,a=!1,o=-1,h=!1;if(null===i.type){let l=s,d="";for(;l<e.length;){let s=e.charAt(l++);if(n||"\\"===s){n=!n,d+=s;continue}if(a){l===o+1?("^"===s||"!"===s)&&(h=!0):"]"!==s||l===o+2&&h||(a=!1),d+=s;continue}if("["===s){a=!0,o=l,h=!1,d+=s;continue}if(!r.noext&&I(s)&&"("===e.charAt(l)){i.push(d),d="";let n=new t(s,i);l=t.#c(e,n,l,r),i.push(n);continue}d+=s}return i.push(d),l}let l=s+1,d=new t(null,i),u=[],c="";for(;l<e.length;){let s=e.charAt(l++);if(n||"\\"===s){n=!n,c+=s;continue}if(a){l===o+1?("^"===s||"!"===s)&&(h=!0):"]"!==s||l===o+2&&h||(a=!1),c+=s;continue}if("["===s){a=!0,o=l,h=!1,c+=s;continue}if(I(s)&&"("===e.charAt(l)){d.push(c),c="";let i=new t(s,d);d.push(i),l=t.#c(e,i,l,r);continue}if("|"===s){d.push(c),c="",u.push(d),d=new t(null,i);continue}if(")"===s)return""===c&&0===i.#s.length&&(i.#d=!0),d.push(c),c="",i.push(...u,d),l;c+=s}return i.type=null,i.#e=void 0,i.#s=[e.substring(s-1)],l}static fromGlob(e,i={}){let s=new t(null,void 0,i);return t.#c(e,s,0,i),s}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[e,i,s,r]=this.toRegExpSource();return s||this.#e||this.#h.nocase&&!this.#h.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()?Object.assign(RegExp(`^${e}$`,(this.#h.nocase?"i":"")+(r?"u":"")),{_src:e,_glob:t}):i}get options(){return this.#h}toRegExpSource(e){let i=e??!!this.#h.dot;if(this.#t===this&&this.#u(),!this.type){let s=this.isStart()&&this.isEnd()&&!this.#s.some(t=>"string"!=typeof t),r=this.#s.map(i=>{let[r,n,a,o]="string"==typeof i?t.#p(i,this.#e,s):i.toRegExpSource(e);return this.#e=this.#e||a,this.#i=this.#i||o,r}).join(""),n="";if(this.isStart()&&"string"==typeof this.#s[0]&&!(1===this.#s.length&&G.has(this.#s[0]))){let t=i&&B.has(r.charAt(0))||r.startsWith("\\.")&&B.has(r.charAt(2))||r.startsWith("\\.\\.")&&B.has(r.charAt(4)),s=!i&&!e&&B.has(r.charAt(0));n=t?"(?!(?:^|/)\\.\\.?(?:$|/))":s?U:""}let a="";return this.isEnd()&&this.#t.#o&&this.#r?.type==="!"&&(a="(?:$|\\/)"),[n+r+a,L(r),this.#e=!!this.#e,this.#i]}let s="*"===this.type||"+"===this.type,r="!"===this.type?"(?:(?!(?:":"(?:",n=this.#f(i);if(this.isStart()&&this.isEnd()&&!n&&"!"!==this.type){let t=this.toString();return this.#s=[t],this.type=null,this.#e=void 0,[t,L(this.toString()),!1,!1]}let a=!s||e||i||!U?"":this.#f(!0);a===n&&(a=""),a&&(n=`(?:${n})(?:${a})*?`);return["!"===this.type&&this.#d?(this.isStart()&&!i?U:"")+K:r+n+("!"===this.type?"))"+(!this.isStart()||i||e?"":U)+J+")":"@"===this.type?")":"?"===this.type?")?":"+"===this.type&&a?")":"*"===this.type&&a?")?":`)${this.type}`),L(n),this.#e=!!this.#e,this.#i]}#f(t){return this.#s.map(e=>{if("string"==typeof e)throw Error("string type in extglob ast??");let[i,s,r,n]=e.toRegExpSource(t);return this.#i=this.#i||n,i}).filter(t=>!(this.isStart()&&this.isEnd())||!!t).join("|")}static #p(t,e,i=!1){let s=!1,r="",n=!1,a=!1;for(let o=0;o<t.length;o++){let h=t.charAt(o);if(s){s=!1,r+=(q.has(h)?"\\":"")+h;continue}if("*"===h){if(a)continue;a=!0,r+=i&&/^[*]+$/.test(t)?K:J,e=!0;continue}if(a=!1,"\\"===h){o===t.length-1?r+="\\\\":s=!0;continue}if("["===h){let[i,s,a,h]=W(t,o);if(a){r+=i,n=n||s,o+=a-1,e=e||h;continue}}if("?"===h){r+=H,e=!0;continue}r+=Y(h)}return[r,L(t),!!e,n]}},X=(t,{windowsPathsNoEscape:e=!1,magicalBraces:i=!1}={})=>i?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&"),Z=(t,e,i={})=>(M(e),(!!i.nocomment||"#"!==e.charAt(0))&&new tg(e,i).match(t)),Q=/^\*+([^+@!?\*\[\(]*)$/,tt=/^\*+\.\*+$/,te=t=>!t.startsWith(".")&&t.includes("."),ti=t=>"."!==t&&".."!==t&&t.includes("."),ts=/^\.\*+$/,tr=t=>"."!==t&&".."!==t&&t.startsWith("."),tn=/^\*+$/,ta=t=>0!==t.length&&!t.startsWith("."),to=t=>0!==t.length&&"."!==t&&".."!==t,th=/^\?+([^+@!?\*\[\(]*)?$/,tl=([t])=>{let e=t.length;return t=>t.length===e&&!t.startsWith(".")},td=([t])=>{let e=t.length;return t=>t.length===e&&"."!==t&&".."!==t},tu="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix";Z.sep="win32"===tu?"\\":"/";var tc=Symbol("globstar **");Z.GLOBSTAR=tc;Z.filter=(t,e={})=>i=>Z(i,t,e);var tp=(t,e={})=>Object.assign({},t,e);Z.defaults=t=>{if(!t||"object"!=typeof t||!Object.keys(t).length)return Z;let e=Z;return Object.assign((i,s,r={})=>e(i,s,tp(t,r)),{Minimatch:class extends e.Minimatch{constructor(e,i={}){super(e,tp(t,i))}static defaults(i){return e.defaults(tp(t,i)).Minimatch}},AST:class extends e.AST{constructor(e,i,s={}){super(e,i,tp(t,s))}static fromGlob(i,s={}){return e.AST.fromGlob(i,tp(t,s))}},unescape:(i,s={})=>e.unescape(i,tp(t,s)),escape:(i,s={})=>e.escape(i,tp(t,s)),filter:(i,s={})=>e.filter(i,tp(t,s)),defaults:i=>e.defaults(tp(t,i)),makeRe:(i,s={})=>e.makeRe(i,tp(t,s)),braceExpand:(i,s={})=>e.braceExpand(i,tp(t,s)),match:(i,s,r={})=>e.match(i,s,tp(t,r)),sep:e.sep,GLOBSTAR:tc})};var tf=(t,e={})=>(M(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:function(t,e={}){if(!t)return[];let{max:i=1e5}=e;return"{}"===t.slice(0,2)&&(t="\\{\\}"+t.slice(2)),(function t(e,i,s){let r=[],n=u("{","}",e);if(!n)return[e];let a=n.pre,o=n.post.length?t(n.post,i,!1):[""];if(/\$$/.test(n.pre))for(let t=0;t<o.length&&t<i;t++){let e=a+"{"+n.body+"}"+o[t];r.push(e)}else{let h,l,d=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),p=d||c,f=n.body.indexOf(",")>=0;if(!p&&!f)return n.post.match(/,(?!,).*\}/)?t(e=n.pre+"{"+n.body+g+n.post,i,!0):[e];if(p)h=n.body.split(/\.\./);else if(1===(h=function t(e){if(!e)return[""];let i=[],s=u("{","}",e);if(!s)return e.split(",");let{pre:r,body:n,post:a}=s,o=r.split(",");o[o.length-1]+="{"+n+"}";let h=t(a);return a.length&&(o[o.length-1]+=h.shift(),o.push.apply(o,h)),i.push.apply(i,o),i}(n.body)).length&&void 0!==h[0]&&1===(h=t(h[0],i,!1).map(F)).length)return o.map(t=>n.pre+h[0]+t);if(p&&void 0!==h[0]&&void 0!==h[1]){let t=R(h[0]),e=R(h[1]),i=Math.max(h[0].length,h[1].length),s=3===h.length&&void 0!==h[2]?Math.abs(R(h[2])):1,r=_;e<t&&(s*=-1,r=D);let n=h.some(T);l=[];for(let a=t;r(a,e);a+=s){let t;if(c)"\\"===(t=String.fromCharCode(a))&&(t="");else if(t=String(a),n){let e=i-t.length;if(e>0){let i=Array(e+1).join("0");t=a<0?"-"+i+t.slice(1):i+t}}l.push(t)}}else{l=[];for(let e=0;e<h.length;e++)l.push.apply(l,t(h[e],i,!1))}for(let t=0;t<l.length;t++)for(let e=0;e<o.length&&r.length<i;e++){let i=a+l[t]+o[e];(!s||p||i)&&r.push(i)}}return r})(t.replace(E,f).replace(x,m).replace(C,g).replace(O,w).replace(A,y),i,!0).map(j)}(t,{max:e.braceExpandMax}));Z.braceExpand=tf,Z.makeRe=(t,e={})=>new tg(t,e).makeRe(),Z.match=(t,e,i={})=>{let s=new tg(e,i);return t=t.filter(t=>s.match(t)),s.options.nonull&&!t.length&&t.push(e),t};var tm=/[?*]|[+@!]\(.*?\)|\[|\]/,tg=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){M(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||tu,this.isWindows="win32"===this.platform,this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||!1===e.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=void 0!==e.windowsNoMagicRoot?e.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let e of t)if("string"!=typeof e)return!0;return!1}debug(){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&"#"===t.charAt(0)){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...t)=>console.error(...t)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(t=>this.slashSplit(t));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let s=this.globParts.map((t,e,i)=>{if(this.isWindows&&this.windowsNoMagicRoot){let e=""===t[0]&&""===t[1]&&("?"===t[2]||!tm.test(t[2]))&&!tm.test(t[3]),i=/^[a-z]:/i.test(t[0]);if(e)return[...t.slice(0,4),...t.slice(4).map(t=>this.parse(t))];if(i)return[t[0],...t.slice(1).map(t=>this.parse(t))]}return t.map(t=>this.parse(t))});if(this.debug(this.pattern,s),this.set=s.filter(t=>-1===t.indexOf(!1)),this.isWindows)for(let t=0;t<this.set.length;t++){let e=this.set[t];""===e[0]&&""===e[1]&&"?"===this.globParts[t][2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3])&&(e[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let e=0;e<t.length;e++)for(let i=0;i<t[e].length;i++)"**"===t[e][i]&&(t[e][i]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):t=e>=1?this.levelOneOptimize(t):this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(t=>{let e=-1;for(;-1!==(e=t.indexOf("**",e+1));){let i=e;for(;"**"===t[i+1];)i++;i!==e&&t.splice(e,i-e)}return t})}levelOneOptimize(t){return t.map(t=>0===(t=t.reduce((t,e)=>{let i=t[t.length-1];return"**"===e&&"**"===i||(".."===e&&i&&".."!==i&&"."!==i&&"**"!==i?t.pop():t.push(e)),t},[])).length?[""]:t)}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let s=t[i];1===i&&""===s&&""===t[0]||("."===s||""===s)&&(e=!0,t.splice(i,1),i--)}"."===t[0]&&2===t.length&&("."===t[1]||""===t[1])&&(e=!0,t.pop())}let i=0;for(;-1!==(i=t.indexOf("..",i+1));){let s=t[i-1];s&&"."!==s&&".."!==s&&"**"!==s&&(e=!0,t.splice(i-1,2),i-=2)}}while(e)return 0===t.length?[""]:t}firstPhasePreProcess(t){let e=!1;do for(let i of(e=!1,t)){let s=-1;for(;-1!==(s=i.indexOf("**",s+1));){let r=s;for(;"**"===i[r+1];)r++;r>s&&i.splice(s+1,r-s);let n=i[s+1],a=i[s+2],o=i[s+3];if(".."!==n||!a||"."===a||".."===a||!o||"."===o||".."===o)continue;e=!0,i.splice(s,1);let h=i.slice(0);h[s]="**",t.push(h),s--}if(!this.preserveMultipleSlashes){for(let t=1;t<i.length-1;t++){let s=i[t];1===t&&""===s&&""===i[0]||("."===s||""===s)&&(e=!0,i.splice(t,1),t--)}"."===i[0]&&2===i.length&&("."===i[1]||""===i[1])&&(e=!0,i.pop())}let r=0;for(;-1!==(r=i.indexOf("..",r+1));){let t=i[r-1];if(t&&"."!==t&&".."!==t&&"**"!==t){e=!0;let t=1===r&&"**"===i[r+1]?["."]:[];i.splice(r-1,2,...t),0===i.length&&i.push(""),r-=2}}}while(e)return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let i=e+1;i<t.length;i++){let s=this.partsMatch(t[e],t[i],!this.preserveMultipleSlashes);if(s){t[e]=[],t[i]=s;break}}return t.filter(t=>t.length)}partsMatch(t,e,i=!1){let s=0,r=0,n=[],a="";for(;s<t.length&&r<e.length;)if(t[s]===e[r])n.push("b"===a?e[r]:t[s]),s++,r++;else if(i&&"**"===t[s]&&e[r]===t[s+1])n.push(t[s]),s++;else if(i&&"**"===e[r]&&t[s]===e[r+1])n.push(e[r]),r++;else if("*"===t[s]&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&"**"!==e[r]){if("b"===a)return!1;a="a",n.push(t[s]),s++,r++}else{if("*"!==e[r]||!t[s]||!this.options.dot&&t[s].startsWith(".")||"**"===t[s]||"a"===a)return!1;a="b",n.push(e[r]),s++,r++}return t.length===e.length&&n}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,i=0;for(let s=0;s<t.length&&"!"===t.charAt(s);s++)e=!e,i++;i&&(this.pattern=t.slice(i)),this.negate=e}matchOne(t,e,i=!1){let s=this.options;if(this.isWindows){let i="string"==typeof t[0]&&/^[a-z]:$/i.test(t[0]),s=!i&&""===t[0]&&""===t[1]&&"?"===t[2]&&/^[a-z]:$/i.test(t[3]),r="string"==typeof e[0]&&/^[a-z]:$/i.test(e[0]),n=!r&&""===e[0]&&""===e[1]&&"?"===e[2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3]),a=s?3:i?0:void 0,o=n?3:r?0:void 0;if("number"==typeof a&&"number"==typeof o){let[i,s]=[t[a],e[o]];i.toLowerCase()===s.toLowerCase()&&(e[o]=i,o>a?e=e.slice(o):a>o&&(t=t.slice(a)))}}let{optimizationLevel:r=1}=this.options;r>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var n=0,a=0,o=t.length,h=e.length;n<o&&a<h;n++,a++){let r;this.debug("matchOne loop");var l=e[a],d=t[n];if(this.debug(e,l,d),!1===l)return!1;if(l===tc){this.debug("GLOBSTAR",[e,l,d]);var u=n,c=a+1;if(c===h){for(this.debug("** at the end");n<o;n++)if("."===t[n]||".."===t[n]||!s.dot&&"."===t[n].charAt(0))return!1;return!0}for(;u<o;){var p=t[u];if(this.debug(`
2
2
  globstar while`,t,u,e,c,p),this.matchOne(t.slice(u),e.slice(c),i))return this.debug("globstar found match!",u,o,p),!0;if("."===p||".."===p||!s.dot&&"."===p.charAt(0)){this.debug("dot detected!",t,u,e,c);break}this.debug("globstar swallow a segment, and continue"),u++}return!!(i&&(this.debug(`
3
- >>> no match, partial?`,t,u,e,c),u===o))}if("string"==typeof l?(r=d===l,this.debug("string match",l,d,r)):(r=l.test(d),this.debug("pattern match",l,d,r)),!r)return!1}if(n===o&&a===h)return!0;if(n===o)return i;if(a===h)return n===o-1&&""===t[n];throw Error("wtf?")}braceExpand(){return tf(this.pattern,this.options)}parse(t){M(t);let e=this.options;if("**"===t)return tc;if(""===t)return"";let i,s=null;(i=t.match(tn))?s=e.dot?to:ta:(i=t.match(Q))?s=(e.nocase?e.dot?t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)):t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)):e.dot?t=>e=>e.endsWith(t):t=>e=>!e.startsWith(".")&&e.endsWith(t))(i[1]):(i=t.match(th))?s=(e.nocase?e.dot?([t,e=""])=>{let i=td([t]);return e?(e=e.toLowerCase(),t=>i(t)&&t.toLowerCase().endsWith(e)):i}:([t,e=""])=>{let i=tl([t]);return e?(e=e.toLowerCase(),t=>i(t)&&t.toLowerCase().endsWith(e)):i}:e.dot?([t,e=""])=>{let i=td([t]);return e?t=>i(t)&&t.endsWith(e):i}:([t,e=""])=>{let i=tl([t]);return e?t=>i(t)&&t.endsWith(e):i})(i):(i=t.match(tt))?s=e.dot?ti:te:(i=t.match(ts))&&(s=tr);let r=V.fromGlob(t,this.options).toMMPattern();return s&&"object"==typeof r&&Reflect.defineProperty(r,"test",{value:s}),r}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,i=e.noglobstar?"[^/]*?":e.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",s=new Set(e.nocase?["i"]:[]),r=t.map(t=>{let e=t.map(t=>{if(t instanceof RegExp)for(let e of t.flags.split(""))s.add(e);return"string"==typeof t?t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):t===tc?tc:t._src});e.forEach((t,s)=>{let r=e[s+1],n=e[s-1];t!==tc||n===tc||(void 0===n?void 0!==r&&r!==tc?e[s+1]="(?:\\/|"+i+"\\/)?"+r:e[s]=i:void 0===r?e[s-1]=n+"(?:\\/|\\/"+i+")?":r!==tc&&(e[s-1]=n+"(?:\\/|\\/"+i+"\\/)"+r,e[s+1]=tc))});let r=e.filter(t=>t!==tc);if(this.partial&&r.length>=1){let t=[];for(let e=1;e<=r.length;e++)t.push(r.slice(0,e).join("/"));return"(?:"+t.join("|")+")"}return r.join("/")}).join("|"),[n,a]=t.length>1?["(?:",")"]:["",""];r="^"+n+r+a+"$",this.partial&&(r="^(?:\\/|"+n+r.slice(1,-1)+a+")$"),this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...s].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return""===t;if("/"===t&&e)return!0;let i=this.options;this.isWindows&&(t=t.split("\\").join("/"));let s=this.slashSplit(t);this.debug(this.pattern,"split",s);let r=this.set;this.debug(this.pattern,"set",r);let n=s[s.length-1];if(!n)for(let t=s.length-2;!n&&t>=0;t--)n=s[t];for(let t=0;t<r.length;t++){let a=r[t],o=s;if(i.matchBase&&1===a.length&&(o=[n]),this.matchOne(o,a,e))return!!i.flipNegate||!this.negate}return!i.flipNegate&&this.negate}static defaults(t){return Z.defaults(t).Minimatch}};Z.AST=V,Z.Minimatch=tg,Z.escape=X,Z.unescape=L;var tw="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,ty=new Set,tb="object"==typeof process&&process?process:{},tv=(t,e,i,s)=>{"function"==typeof tb.emitWarning?tb.emitWarning(t,e,i,s):console.error(`[${i}] ${e}: ${t}`)},tS=globalThis.AbortController,tk=globalThis.AbortSignal;if(typeof tS>"u"){tk=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(t,e){this._onabort.push(e)}},tS=class{constructor(){e()}signal=new tk;abort(t){if(!this.signal.aborted){for(let e of(this.signal.reason=t,this.signal.aborted=!0,this.signal._onabort))e(t);this.signal.onabort?.(t)}}};let t=tb.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,tv("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var t$=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),tE=t=>t$(t)?t<=256?Uint8Array:t<=65536?Uint16Array:t<=0x100000000?Uint32Array:t<=Number.MAX_SAFE_INTEGER?tx:null:null,tx=class extends Array{constructor(t){super(t),this.fill(0)}},tC=class t{heap;length;static #t=!1;static create(e){let i=tE(e);if(!i)return[];t.#t=!0;let s=new t(e,i);return t.#t=!1,s}constructor(e,i){if(!t.#t)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},tO=class t{#t;#e;#i;#s;#r;#n;#a;#o;get perf(){return this.#o}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#h;#l;#d;#u;#c;#f;#p;#m;#g;#w;#y;#b;#v;#S;#k;#$;#E;#x;#C;static unsafeExposeInternals(t){return{starts:t.#v,ttls:t.#S,autopurgeTimers:t.#k,sizes:t.#b,keyMap:t.#d,keyList:t.#u,valList:t.#c,next:t.#f,prev:t.#p,get head(){return t.#m},get tail(){return t.#g},free:t.#w,isBackgroundFetch:e=>t.#O(e),backgroundFetch:(e,i,s,r)=>t.#A(e,i,s,r),moveToTail:e=>t.#R(e),indexes:e=>t.#T(e),rindexes:e=>t.#F(e),isStale:e=>t.#j(e)}}get max(){return this.#t}get maxSize(){return this.#e}get calculatedSize(){return this.#l}get size(){return this.#h}get fetchMethod(){return this.#n}get memoMethod(){return this.#a}get dispose(){return this.#i}get onInsert(){return this.#s}get disposeAfter(){return this.#r}constructor(e){let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:a,updateAgeOnHas:o,allowStale:h,dispose:l,onInsert:d,disposeAfter:u,noDisposeOnSet:c,noUpdateTTL:p,maxSize:f=0,maxEntrySize:m=0,sizeCalculation:g,fetchMethod:w,memoMethod:y,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:k,ignoreFetchAbort:$,perf:E}=e;if(void 0!==E&&"function"!=typeof E?.now)throw TypeError("perf option must have a now() method if specified");if(this.#o=E??tw,0!==i&&!t$(i))throw TypeError("max option must be a nonnegative integer");let x=i?tE(i):Array;if(!x)throw Error("invalid max value: "+i);if(this.#t=i,this.#e=f,this.maxEntrySize=m||this.#e,this.sizeCalculation=g,this.sizeCalculation){if(!this.#e&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw TypeError("sizeCalculation set to non-function")}if(void 0!==y&&"function"!=typeof y)throw TypeError("memoMethod must be a function if defined");if(this.#a=y,void 0!==w&&"function"!=typeof w)throw TypeError("fetchMethod must be a function if specified");if(this.#n=w,this.#E=!!w,this.#d=new Map,this.#u=Array(i).fill(void 0),this.#c=Array(i).fill(void 0),this.#f=new x(i),this.#p=new x(i),this.#m=0,this.#g=0,this.#w=tC.create(i),this.#h=0,this.#l=0,"function"==typeof l&&(this.#i=l),"function"==typeof d&&(this.#s=d),"function"==typeof u?(this.#r=u,this.#y=[]):(this.#r=void 0,this.#y=void 0),this.#$=!!this.#i,this.#C=!!this.#s,this.#x=!!this.#r,this.noDisposeOnSet=!!c,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!k,this.ignoreFetchAbort=!!$,0!==this.maxEntrySize){if(0!==this.#e&&!t$(this.#e))throw TypeError("maxSize must be a positive integer if specified");if(!t$(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#_()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!o,this.ttlResolution=t$(r)||0===r?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!t$(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#D()}if(0===this.#t&&0===this.ttl&&0===this.#e)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#e){let e="LRU_CACHE_UNBOUNDED";(t=>!ty.has(t))(e)&&(ty.add(e),tv("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,t))}}getRemainingTTL(t){return this.#d.has(t)?1/0:0}#D(){let t=new tx(this.#t),e=new tx(this.#t);this.#S=t,this.#v=e;let i=this.ttlAutopurge?Array(this.#t):void 0;this.#k=i,this.#M=(s,r,n=this.#o.now())=>{if(e[s]=0!==r?n:0,t[s]=r,i?.[s]&&(clearTimeout(i[s]),i[s]=void 0),0!==r&&i){let t=setTimeout(()=>{this.#j(s)&&this.#P(this.#u[s],"expire")},r+1);t.unref&&t.unref(),i[s]=t}},this.#N=i=>{e[i]=0!==t[i]?this.#o.now():0},this.#W=(i,n)=>{if(t[n]){let a=t[n],o=e[n];if(!a||!o)return;i.ttl=a,i.start=o,i.now=s||r();let h=i.now-o;i.remainingTTL=a-h}};let s=0,r=()=>{let t=this.#o.now();if(this.ttlResolution>0){s=t;let e=setTimeout(()=>s=0,this.ttlResolution);e.unref&&e.unref()}return t};this.getRemainingTTL=i=>{let n=this.#d.get(i);if(void 0===n)return 0;let a=t[n],o=e[n];return a&&o?a-((s||r())-o):1/0},this.#j=i=>{let n=e[i],a=t[i];return!!a&&!!n&&(s||r())-n>a}}#N=()=>{};#W=()=>{};#M=()=>{};#j=()=>!1;#_(){let t=new tx(this.#t);this.#l=0,this.#b=t,this.#L=e=>{this.#l-=t[e],t[e]=0},this.#z=(t,e,i,s)=>{if(this.#O(e))return 0;if(!t$(i))if(s){if("function"!=typeof s)throw TypeError("sizeCalculation must be a function");if(!t$(i=s(e,t)))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#I=(e,i,s)=>{if(t[e]=i,this.#e){let i=this.#e-t[e];for(;this.#l>i;)this.#U(!0)}this.#l+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#l)}}#L=t=>{};#I=(t,e,i)=>{};#z=(t,e,i,s)=>{if(i||s)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#g;!(!this.#B(e)||((t||!this.#j(e))&&(yield e),e===this.#m));)e=this.#p[e]}*#F({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#m;!(!this.#B(e)||((t||!this.#j(e))&&(yield e),e===this.#g));)e=this.#f[e]}#B(t){return void 0!==t&&this.#d.get(this.#u[t])===t}*entries(){for(let t of this.#T())void 0===this.#c[t]||void 0===this.#u[t]||this.#O(this.#c[t])||(yield[this.#u[t],this.#c[t]])}*rentries(){for(let t of this.#F())void 0===this.#c[t]||void 0===this.#u[t]||this.#O(this.#c[t])||(yield[this.#u[t],this.#c[t]])}*keys(){for(let t of this.#T()){let e=this.#u[t];void 0===e||this.#O(this.#c[t])||(yield e)}}*rkeys(){for(let t of this.#F()){let e=this.#u[t];void 0===e||this.#O(this.#c[t])||(yield e)}}*values(){for(let t of this.#T())void 0===this.#c[t]||this.#O(this.#c[t])||(yield this.#c[t])}*rvalues(){for(let t of this.#F())void 0===this.#c[t]||this.#O(this.#c[t])||(yield this.#c[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let i of this.#T()){let s=this.#c[i],r=this.#O(s)?s.__staleWhileFetching:s;if(void 0!==r&&t(r,this.#u[i],this))return this.get(this.#u[i],e)}}forEach(t,e=this){for(let i of this.#T()){let s=this.#c[i],r=this.#O(s)?s.__staleWhileFetching:s;void 0!==r&&t.call(e,r,this.#u[i],this)}}rforEach(t,e=this){for(let i of this.#F()){let s=this.#c[i],r=this.#O(s)?s.__staleWhileFetching:s;void 0!==r&&t.call(e,r,this.#u[i],this)}}purgeStale(){let t=!1;for(let e of this.#F({allowStale:!0}))this.#j(e)&&(this.#P(this.#u[e],"expire"),t=!0);return t}info(t){let e=this.#d.get(t);if(void 0===e)return;let i=this.#c[e],s=this.#O(i)?i.__staleWhileFetching:i;if(void 0===s)return;let r={value:s};if(this.#S&&this.#v){let t=this.#S[e],i=this.#v[e];t&&i&&(r.ttl=t-(this.#o.now()-i),r.start=Date.now())}return this.#b&&(r.size=this.#b[e]),r}dump(){let t=[];for(let e of this.#T({allowStale:!0})){let i=this.#u[e],s=this.#c[e],r=this.#O(s)?s.__staleWhileFetching:s;if(void 0===r||void 0===i)continue;let n={value:r};if(this.#S&&this.#v){n.ttl=this.#S[e];let t=this.#o.now()-this.#v[e];n.start=Math.floor(Date.now()-t)}this.#b&&(n.size=this.#b[e]),t.unshift([i,n])}return t}load(t){for(let[e,i]of(this.clear(),t)){if(i.start){let t=Date.now()-i.start;i.start=this.#o.now()-t}this.set(e,i.value,i)}}set(t,e,i={}){if(void 0===e)return this.delete(t),this;let{ttl:s=this.ttl,start:r,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:o}=i,{noUpdateTTL:h=this.noUpdateTTL}=i,l=this.#z(t,e,i.size||0,a);if(this.maxEntrySize&&l>this.maxEntrySize)return o&&(o.set="miss",o.maxEntrySizeExceeded=!0),this.#P(t,"set"),this;let d=0===this.#h?void 0:this.#d.get(t);if(void 0===d)d=0===this.#h?this.#g:0!==this.#w.length?this.#w.pop():this.#h===this.#t?this.#U(!1):this.#h,this.#u[d]=t,this.#c[d]=e,this.#d.set(t,d),this.#f[this.#g]=d,this.#p[d]=this.#g,this.#g=d,this.#h++,this.#I(d,l,o),o&&(o.set="add"),h=!1,this.#C&&this.#s?.(e,t,"add");else{this.#R(d);let i=this.#c[d];if(e!==i){if(this.#E&&this.#O(i)){i.__abortController.abort(Error("replaced"));let{__staleWhileFetching:e}=i;void 0!==e&&!n&&(this.#$&&this.#i?.(e,t,"set"),this.#x&&this.#y?.push([e,t,"set"]))}else n||(this.#$&&this.#i?.(i,t,"set"),this.#x&&this.#y?.push([i,t,"set"]));if(this.#L(d),this.#I(d,l,o),this.#c[d]=e,o){o.set="replace";let t=i&&this.#O(i)?i.__staleWhileFetching:i;void 0!==t&&(o.oldValue=t)}}else o&&(o.set="update");this.#C&&this.onInsert?.(e,t,e===i?"update":"replace")}if(0===s||this.#S||this.#D(),this.#S&&(h||this.#M(d,s,r),o&&this.#W(o,d)),!n&&this.#x&&this.#y){let t=this.#y,e;for(;e=t?.shift();)this.#r?.(...e)}return this}pop(){try{for(;this.#h;){let t=this.#c[this.#m];if(this.#U(!0),this.#O(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(void 0!==t)return t}}finally{if(this.#x&&this.#y){let t=this.#y,e;for(;e=t?.shift();)this.#r?.(...e)}}}#U(t){let e=this.#m,i=this.#u[e],s=this.#c[e];return this.#E&&this.#O(s)?s.__abortController.abort(Error("evicted")):(this.#$||this.#x)&&(this.#$&&this.#i?.(s,i,"evict"),this.#x&&this.#y?.push([s,i,"evict"])),this.#L(e),this.#k?.[e]&&(clearTimeout(this.#k[e]),this.#k[e]=void 0),t&&(this.#u[e]=void 0,this.#c[e]=void 0,this.#w.push(e)),1===this.#h?(this.#m=this.#g=0,this.#w.length=0):this.#m=this.#f[e],this.#d.delete(i),this.#h--,e}has(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,r=this.#d.get(t);if(void 0!==r){let t=this.#c[r];if(this.#O(t)&&void 0===t.__staleWhileFetching)return!1;if(!this.#j(r))return i&&this.#N(r),s&&(s.has="hit",this.#W(s,r)),!0;s&&(s.has="stale",this.#W(s,r))}else s&&(s.has="miss");return!1}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=this.#d.get(t);if(void 0===s||!i&&this.#j(s))return;let r=this.#c[s];return this.#O(r)?r.__staleWhileFetching:r}#A(t,e,i,s){let r=void 0===e?void 0:this.#c[e];if(this.#O(r))return r;let n=new tS,{signal:a}=i;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let o={signal:n.signal,options:i,context:s},h=(s,r=!1)=>{let{aborted:a}=n.signal,h=i.ignoreFetchAbort&&void 0!==s,d=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&void 0!==s);if(i.status&&(a&&!r?(i.status.fetchAborted=!0,i.status.fetchError=n.signal.reason,h&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),a&&!h&&!r)return l(n.signal.reason,d);let c=this.#c[e];return(c===u||h&&r&&void 0===c)&&(void 0===s?void 0!==u.__staleWhileFetching?this.#c[e]=u.__staleWhileFetching:this.#P(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,s,o.options))),s},l=(s,r)=>{let{aborted:a}=n.signal,o=a&&i.allowStaleOnFetchAbort,h=o||i.allowStaleOnFetchRejection,l=h||i.noDeleteOnFetchRejection;if(this.#c[e]===u&&(l&&(r||void 0!==u.__staleWhileFetching)?o||(this.#c[e]=u.__staleWhileFetching):this.#P(t,"fetch")),h)return i.status&&void 0!==u.__staleWhileFetching&&(i.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw s},d=(e,s)=>{let a=this.#n?.(t,r,o);a&&a instanceof Promise&&a.then(t=>e(void 0===t?void 0:t),s),n.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(e(void 0),i.allowStaleOnFetchAbort&&(e=t=>h(t,!0)))})};i.status&&(i.status.fetchDispatched=!0);let u=new Promise(d).then(h,t=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=t),l(t,!1))),c=Object.assign(u,{__abortController:n,__staleWhileFetching:r,__returned:void 0});return void 0===e?(this.set(t,c,{...o.options,status:void 0}),e=this.#d.get(t)):this.#c[e]=c,c}#O(t){return!!this.#E&&!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof tS}async fetch(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:o=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:c=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:f,forceRefresh:m=!1,status:g,signal:w}=e;if(!this.#E)return g&&(g.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:r,status:g});let y={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:r,ttl:n,noDisposeOnSet:a,size:o,sizeCalculation:h,noUpdateTTL:l,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:p,ignoreFetchAbort:c,status:g,signal:w},b=this.#d.get(t);if(void 0===b){g&&(g.fetch="miss");let e=this.#A(t,b,y,f);return e.__returned=e}{let e=this.#c[b];if(this.#O(e)){let t=i&&void 0!==e.__staleWhileFetching;return g&&(g.fetch="inflight",t&&(g.returnedStale=!0)),t?e.__staleWhileFetching:e.__returned=e}let r=this.#j(b);if(!m&&!r)return g&&(g.fetch="hit"),this.#R(b),s&&this.#N(b),g&&this.#W(g,b),e;let n=this.#A(t,b,y,f),a=void 0!==n.__staleWhileFetching&&i;return g&&(g.fetch=r?"stale":"refresh",a&&r&&(g.returnedStale=!0)),a?n.__staleWhileFetching:n.__returned=n}}async forceFetch(t,e={}){let i=await this.fetch(t,e);if(void 0===i)throw Error("fetch() returned undefined");return i}memo(t,e={}){let i=this.#a;if(!i)throw Error("no memoMethod provided to constructor");let{context:s,forceRefresh:r,...n}=e,a=this.get(t,n);if(!r&&void 0!==a)return a;let o=i(t,a,{options:n,context:s});return this.set(t,o,n),o}get(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:n}=e,a=this.#d.get(t);if(void 0!==a){let e=this.#c[a],o=this.#O(e);return n&&this.#W(n,a),this.#j(a)?(n&&(n.get="stale"),o?(n&&i&&void 0!==e.__staleWhileFetching&&(n.returnedStale=!0),i?e.__staleWhileFetching:void 0):(r||this.#P(t,"expire"),n&&i&&(n.returnedStale=!0),i?e:void 0)):(n&&(n.get="hit"),o?e.__staleWhileFetching:(this.#R(a),s&&this.#N(a),e))}n&&(n.get="miss")}#G(t,e){this.#p[e]=t,this.#f[t]=e}#R(t){t!==this.#g&&(t===this.#m?this.#m=this.#f[t]:this.#G(this.#p[t],this.#f[t]),this.#G(this.#g,t),this.#g=t)}delete(t){return this.#P(t,"delete")}#P(t,e){let i=!1;if(0!==this.#h){let s=this.#d.get(t);if(void 0!==s)if(this.#k?.[s]&&(clearTimeout(this.#k?.[s]),this.#k[s]=void 0),i=!0,1===this.#h)this.#q(e);else{this.#L(s);let i=this.#c[s];if(this.#O(i)?i.__abortController.abort(Error("deleted")):(this.#$||this.#x)&&(this.#$&&this.#i?.(i,t,e),this.#x&&this.#y?.push([i,t,e])),this.#d.delete(t),this.#u[s]=void 0,this.#c[s]=void 0,s===this.#g)this.#g=this.#p[s];else if(s===this.#m)this.#m=this.#f[s];else{let t=this.#p[s];this.#f[t]=this.#f[s];let e=this.#f[s];this.#p[e]=this.#p[s]}this.#h--,this.#w.push(s)}}if(this.#x&&this.#y?.length){let t=this.#y,e;for(;e=t?.shift();)this.#r?.(...e)}return i}clear(){return this.#q("delete")}#q(t){for(let e of this.#F({allowStale:!0})){let i=this.#c[e];if(this.#O(i))i.__abortController.abort(Error("deleted"));else{let s=this.#u[e];this.#$&&this.#i?.(i,s,t),this.#x&&this.#y?.push([i,s,t])}}if(this.#d.clear(),this.#c.fill(void 0),this.#u.fill(void 0),this.#S&&this.#v){for(let t of(this.#S.fill(0),this.#v.fill(0),this.#k??[]))void 0!==t&&clearTimeout(t);this.#k?.fill(void 0)}if(this.#b&&this.#b.fill(0),this.#m=0,this.#g=0,this.#w.length=0,this.#l=0,this.#h=0,this.#x&&this.#y){let t=this.#y,e;for(;e=t?.shift();)this.#r?.(...e)}}},tA="object"==typeof process&&process?process:{stdout:null,stderr:null},tR=t=>!!t&&"object"==typeof t&&(t instanceof es||t instanceof l.default||tT(t)||tF(t)),tT=t=>!!t&&"object"==typeof t&&t instanceof h.EventEmitter&&"function"==typeof t.pipe&&t.pipe!==l.default.Writable.prototype.pipe,tF=t=>!!t&&"object"==typeof t&&t instanceof h.EventEmitter&&"function"==typeof t.write&&"function"==typeof t.end,tj=Symbol("EOF"),t_=Symbol("maybeEmitEnd"),tD=Symbol("emittedEnd"),tM=Symbol("emittingEnd"),tP=Symbol("emittedError"),tN=Symbol("closed"),tW=Symbol("read"),tL=Symbol("flush"),tz=Symbol("flushChunk"),tI=Symbol("encoding"),tU=Symbol("decoder"),tB=Symbol("flowing"),tG=Symbol("paused"),tq=Symbol("resume"),tY=Symbol("buffer"),tH=Symbol("pipes"),tJ=Symbol("bufferLength"),tK=Symbol("bufferPush"),tV=Symbol("bufferShift"),tX=Symbol("objectMode"),tZ=Symbol("destroyed"),tQ=Symbol("error"),t0=Symbol("emitData"),t1=Symbol("emitEnd"),t2=Symbol("emitEnd2"),t8=Symbol("async"),t3=Symbol("abort"),t4=Symbol("aborted"),t6=Symbol("signal"),t5=Symbol("dataListeners"),t7=Symbol("discarded"),t9=t=>Promise.resolve().then(t),et=t=>t(),ee=class{src;dest;opts;ondrain;constructor(t,e,i){this.src=t,this.dest=e,this.opts=i,this.ondrain=()=>t[tq](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ei=class extends ee{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,i){super(t,e,i),this.proxyErrors=t=>this.dest.emit("error",t),t.on("error",this.proxyErrors)}},es=class extends h.EventEmitter{[tB]=!1;[tG]=!1;[tH]=[];[tY]=[];[tX];[tI];[t8];[tU];[tj]=!1;[tD]=!1;[tM]=!1;[tN]=!1;[tP]=null;[tJ]=0;[tZ]=!1;[t6];[t4]=!1;[t5]=0;[t7]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&"string"==typeof e.encoding)throw TypeError("Encoding and objectMode may not be used together");(t=>!!t.objectMode)(e)?(this[tX]=!0,this[tI]=null):(t=>!t.objectMode&&!!t.encoding&&"buffer"!==t.encoding)(e)?(this[tI]=e.encoding,this[tX]=!1):(this[tX]=!1,this[tI]=null),this[t8]=!!e.async,this[tU]=this[tI]?new d.StringDecoder(this[tI]):null,e&&!0===e.debugExposeBuffer&&Object.defineProperty(this,"buffer",{get:()=>this[tY]}),e&&!0===e.debugExposePipes&&Object.defineProperty(this,"pipes",{get:()=>this[tH]});let{signal:i}=e;i&&(this[t6]=i,i.aborted?this[t3]():i.addEventListener("abort",()=>this[t3]()))}get bufferLength(){return this[tJ]}get encoding(){return this[tI]}set encoding(t){throw Error("Encoding must be set at instantiation time")}setEncoding(t){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[tX]}set objectMode(t){throw Error("objectMode must be set at instantiation time")}get async(){return this[t8]}set async(t){this[t8]=this[t8]||!!t}[t3](){this[t4]=!0,this.emit("abort",this[t6]?.reason),this.destroy(this[t6]?.reason)}get aborted(){return this[t4]}set aborted(t){}write(t,e,i){if(this[t4])return!1;if(this[tj])throw Error("write after end");if(this[tZ])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;"function"==typeof e&&(i=e,e="utf8"),e||(e="utf8");let s=this[t8]?t9:et;if(!this[tX]&&!Buffer.isBuffer(t)){let e;if(e=t,!Buffer.isBuffer(e)&&ArrayBuffer.isView(e))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else{let e;if((e=t)instanceof ArrayBuffer||e&&"object"==typeof e&&e.constructor&&"ArrayBuffer"===e.constructor.name&&e.byteLength>=0)t=Buffer.from(t);else if("string"!=typeof t)throw Error("Non-contiguous data written to non-objectMode stream")}}return this[tX]?(this[tB]&&0!==this[tJ]&&this[tL](!0),this[tB]?this.emit("data",t):this[tK](t)):t.length&&("string"==typeof t&&(e!==this[tI]||this[tU]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[tI]&&(t=this[tU].write(t)),this[tB]&&0!==this[tJ]&&this[tL](!0),this[tB]?this.emit("data",t):this[tK](t)),0!==this[tJ]&&this.emit("readable"),i&&s(i),this[tB]}read(t){if(this[tZ])return null;if(this[t7]=!1,0===this[tJ]||0===t||t&&t>this[tJ])return this[t_](),null;this[tX]&&(t=null),this[tY].length>1&&!this[tX]&&(this[tY]=[this[tI]?this[tY].join(""):Buffer.concat(this[tY],this[tJ])]);let e=this[tW](t||null,this[tY][0]);return this[t_](),e}[tW](t,e){if(this[tX])this[tV]();else{let i=e;t===i.length||null===t?this[tV]():("string"==typeof i?(this[tY][0]=i.slice(t),e=i.slice(0,t)):(this[tY][0]=i.subarray(t),e=i.subarray(0,t)),this[tJ]-=t)}return this.emit("data",e),this[tY].length||this[tj]||this.emit("drain"),e}end(t,e,i){return"function"==typeof t&&(i=t,t=void 0),"function"==typeof e&&(i=e,e="utf8"),void 0!==t&&this.write(t,e),i&&this.once("end",i),this[tj]=!0,this.writable=!1,(this[tB]||!this[tG])&&this[t_](),this}[tq](){this[tZ]||(this[t5]||this[tH].length||(this[t7]=!0),this[tG]=!1,this[tB]=!0,this.emit("resume"),this[tY].length?this[tL]():this[tj]?this[t_]():this.emit("drain"))}resume(){return this[tq]()}pause(){this[tB]=!1,this[tG]=!0,this[t7]=!1}get destroyed(){return this[tZ]}get flowing(){return this[tB]}get paused(){return this[tG]}[tK](t){this[tX]?this[tJ]+=1:this[tJ]+=t.length,this[tY].push(t)}[tV](){return this[tX]?this[tJ]-=1:this[tJ]-=this[tY][0].length,this[tY].shift()}[tL](t=!1){do;while(this[tz](this[tV]())&&this[tY].length)t||this[tY].length||this[tj]||this.emit("drain")}[tz](t){return this.emit("data",t),this[tB]}pipe(t,e){if(this[tZ])return t;this[t7]=!1;let i=this[tD];return e=e||{},t===tA.stdout||t===tA.stderr?e.end=!1:e.end=!1!==e.end,e.proxyErrors=!!e.proxyErrors,i?e.end&&t.end():(this[tH].push(e.proxyErrors?new ei(this,t,e):new ee(this,t,e)),this[t8]?t9(()=>this[tq]()):this[tq]()),t}unpipe(t){let e=this[tH].find(e=>e.dest===t);e&&(1===this[tH].length?(this[tB]&&0===this[t5]&&(this[tB]=!1),this[tH]=[]):this[tH].splice(this[tH].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let i=super.on(t,e);if("data"===t)this[t7]=!1,this[t5]++,this[tH].length||this[tB]||this[tq]();else if("readable"===t&&0!==this[tJ])super.emit("readable");else("end"===t||"finish"===t||"prefinish"===t)&&this[tD]?(super.emit(t),this.removeAllListeners(t)):"error"===t&&this[tP]&&(this[t8]?t9(()=>e.call(this,this[tP])):e.call(this,this[tP]));return i}removeListener(t,e){return this.off(t,e)}off(t,e){let i=super.off(t,e);return"data"===t&&(this[t5]=this.listeners("data").length,0!==this[t5]||this[t7]||this[tH].length||(this[tB]=!1)),i}removeAllListeners(t){let e=super.removeAllListeners(t);return("data"===t||void 0===t)&&(this[t5]=0,this[t7]||this[tH].length||(this[tB]=!1)),e}get emittedEnd(){return this[tD]}[t_](){this[tM]||this[tD]||this[tZ]||0!==this[tY].length||!this[tj]||(this[tM]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[tN]&&this.emit("close"),this[tM]=!1)}emit(t,...e){let i=e[0];if("error"!==t&&"close"!==t&&t!==tZ&&this[tZ])return!1;if("data"===t)return(!!this[tX]||!!i)&&(this[t8]?(t9(()=>this[t0](i)),!0):this[t0](i));if("end"===t)return this[t1]();if("close"===t){if(this[tN]=!0,!this[tD]&&!this[tZ])return!1;let t=super.emit("close");return this.removeAllListeners("close"),t}if("error"===t){this[tP]=i,super.emit(tQ,i);let t=(!this[t6]||!!this.listeners("error").length)&&super.emit("error",i);return this[t_](),t}if("resume"===t){let t=super.emit("resume");return this[t_](),t}if("finish"===t||"prefinish"===t){let e=super.emit(t);return this.removeAllListeners(t),e}let s=super.emit(t,...e);return this[t_](),s}[t0](t){for(let e of this[tH])!1===e.dest.write(t)&&this.pause();let e=!this[t7]&&super.emit("data",t);return this[t_](),e}[t1](){return!this[tD]&&(this[tD]=!0,this.readable=!1,this[t8]?(t9(()=>this[t2]()),!0):this[t2]())}[t2](){if(this[tU]){let t=this[tU].end();if(t){for(let e of this[tH])e.dest.write(t);this[t7]||super.emit("data",t)}}for(let t of this[tH])t.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[tX]||(t.dataLength=0);let e=this.promise();return this.on("data",e=>{t.push(e),this[tX]||(t.dataLength+=e.length)}),await e,t}async concat(){if(this[tX])throw Error("cannot concat in objectMode");let t=await this.collect();return this[tI]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(tZ,()=>e(Error("stream destroyed"))),this.on("error",t=>e(t)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[t7]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let i=this.read();if(null!==i)return Promise.resolve({done:!1,value:i});if(this[tj])return e();let s,r,n=t=>{this.off("data",a),this.off("end",o),this.off(tZ,h),e(),r(t)},a=t=>{this.off("error",n),this.off("end",o),this.off(tZ,h),this.pause(),s({value:t,done:!!this[tj]})},o=()=>{this.off("error",n),this.off("data",a),this.off(tZ,h),e(),s({done:!0,value:void 0})},h=()=>n(Error("stream destroyed"));return new Promise((t,e)=>{r=e,s=t,this.once(tZ,h),this.once("error",n),this.once("end",o),this.once("data",a)})},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[t7]=!1;let t=!1,e=()=>(this.pause(),this.off(tQ,e),this.off(tZ,e),this.off("end",e),t=!0,{done:!0,value:void 0}),i=()=>{if(t)return e();let i=this.read();return null===i?e():{done:!1,value:i}};return this.once("end",e),this.once(tQ,e),this.once(tZ,e),{next:i,throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){return this[tZ]||(this[tZ]=!0,this[t7]=!0,this[tY].length=0,this[tJ]=0,"function"!=typeof this.close||this[tN]||this.close()),t?this.emit("error",t):this.emit(tZ),this}static get isStream(){return tR}},er=n.realpathSync.native,en={lstatSync:n.lstatSync,readdir:n.readdir,readdirSync:n.readdirSync,readlinkSync:n.readlinkSync,realpathSync:er,promises:{lstat:o.lstat,readdir:o.readdir,readlink:o.readlink,realpath:o.realpath}},ea=t=>t&&t!==en&&t!==a?{...en,...t,promises:{...en.promises,...t.promises||{}}}:en,eo=/^\\\\\?\\([a-z]:)\\?$/i,eh=/[\\\/]/,el=t=>t.isFile()?8:t.isDirectory()?4:t.isSymbolicLink()?10:t.isCharacterDevice()?2:t.isBlockDevice()?6:t.isSocket()?12:+!!t.isFIFO(),ed=new tO({max:4096}),eu=t=>{let e=ed.get(t);if(e)return e;let i=t.normalize("NFKD");return ed.set(t,i),i},ec=new tO({max:4096}),ep=t=>{let e=ec.get(t);if(e)return e;let i=eu(t.toLowerCase());return ec.set(t,i),i},ef=class extends tO{constructor(){super({max:256})}},em=class extends tO{constructor(t=16384){super({maxSize:t,sizeCalculation:t=>t.length+1})}},eg=Symbol("PathScurry setAsCwd"),ew=class{name;root;roots;parent;nocase;isCWD=!1;#t;#e;get dev(){return this.#e}#i;get mode(){return this.#i}#s;get nlink(){return this.#s}#r;get uid(){return this.#r}#n;get gid(){return this.#n}#a;get rdev(){return this.#a}#o;get blksize(){return this.#o}#h;get ino(){return this.#h}#l;get size(){return this.#l}#d;get blocks(){return this.#d}#u;get atimeMs(){return this.#u}#c;get mtimeMs(){return this.#c}#f;get ctimeMs(){return this.#f}#p;get birthtimeMs(){return this.#p}#m;get atime(){return this.#m}#g;get mtime(){return this.#g}#w;get ctime(){return this.#w}#y;get birthtime(){return this.#y}#b;#v;#S;#k;#$;#E;#x;#C;#D;#N;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,e=0,i,s,r,n,a){this.name=t,this.#b=r?ep(t):eu(t),this.#x=1023&e,this.nocase=r,this.roots=s,this.root=i||this,this.#C=n,this.#S=a.fullpath,this.#$=a.relative,this.#E=a.relativePosix,this.parent=a.parent,this.parent?this.#t=this.parent.#t:this.#t=ea(a.fs)}depth(){return void 0!==this.#v?this.#v:this.parent?this.#v=this.parent.depth()+1:this.#v=0}childrenCache(){return this.#C}resolve(t){if(!t)return this;let e=this.getRootString(t),i=t.substring(e.length).split(this.splitSep);return e?this.getRoot(e).#W(i):this.#W(i)}#W(t){let e=this;for(let i of t)e=e.child(i);return e}children(){let t=this.#C.get(this);if(t)return t;let e=Object.assign([],{provisional:0});return this.#C.set(this,e),this.#x&=-17,e}child(t,e){if(""===t||"."===t)return this;if(".."===t)return this.parent||this;let i=this.children(),s=this.nocase?ep(t):eu(t);for(let t of i)if(t.#b===s)return t;let r=this.parent?this.sep:"",n=this.#S?this.#S+r+t:void 0,a=this.newChild(t,0,{...e,parent:this,fullpath:n});return this.canReaddir()||(a.#x|=128),i.push(a),a}relative(){if(this.isCWD)return"";if(void 0!==this.#$)return this.#$;let t=this.name,e=this.parent;if(!e)return this.#$=this.name;let i=e.relative();return i+(i&&e.parent?this.sep:"")+t}relativePosix(){if("/"===this.sep)return this.relative();if(this.isCWD)return"";if(void 0!==this.#E)return this.#E;let t=this.name,e=this.parent;if(!e)return this.#E=this.fullpathPosix();let i=e.relativePosix();return i+(i&&e.parent?"/":"")+t}fullpath(){if(void 0!==this.#S)return this.#S;let t=this.name,e=this.parent;if(!e)return this.#S=this.name;let i=e.fullpath()+(e.parent?this.sep:"")+t;return this.#S=i}fullpathPosix(){if(void 0!==this.#k)return this.#k;if("/"===this.sep)return this.#k=this.fullpath();if(!this.parent){let t=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(t)?this.#k=`//?/${t}`:this.#k=t}let t=this.parent,e=t.fullpathPosix(),i=e+(e&&t.parent?"/":"")+this.name;return this.#k=i}isUnknown(){return(15&this.#x)==0}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(15&this.#x)==8}isDirectory(){return(15&this.#x)==4}isCharacterDevice(){return(15&this.#x)==2}isBlockDevice(){return(15&this.#x)==6}isFIFO(){return(15&this.#x)==1}isSocket(){return(15&this.#x)==12}isSymbolicLink(){return(10&this.#x)==10}lstatCached(){return 32&this.#x?this:void 0}readlinkCached(){return this.#D}realpathCached(){return this.#N}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#D)return!0;if(!this.parent)return!1;let t=15&this.#x;return!(0!==t&&10!==t||256&this.#x||128&this.#x)}calledReaddir(){return!!(16&this.#x)}isENOENT(){return!!(128&this.#x)}isNamed(t){return this.nocase?this.#b===ep(t):this.#b===eu(t)}async readlink(){let t=this.#D;if(t)return t;if(this.canReadlink()&&this.parent)try{let t=await this.#t.promises.readlink(this.fullpath()),e=(await this.parent.realpath())?.resolve(t);if(e)return this.#D=e}catch(t){this.#F(t.code);return}}readlinkSync(){let t=this.#D;if(t)return t;if(this.canReadlink()&&this.parent)try{let t=this.#t.readlinkSync(this.fullpath()),e=this.parent.realpathSync()?.resolve(t);if(e)return this.#D=e}catch(t){this.#F(t.code);return}}#M(t){this.#x|=16;for(let e=t.provisional;e<t.length;e++){let i=t[e];i&&i.#j()}}#j(){128&this.#x||(this.#x=(128|this.#x)&-16,this.#_())}#_(){let t=this.children();for(let e of(t.provisional=0,t))e.#j()}#L(){this.#x|=512,this.#I()}#I(){if(64&this.#x)return;let t=this.#x;(15&t)==4&&(t&=-16),this.#x=64|t,this.#_()}#z(t=""){"ENOTDIR"===t||"EPERM"===t?this.#I():"ENOENT"===t?this.#j():this.children().provisional=0}#T(t=""){"ENOTDIR"===t?this.parent.#I():"ENOENT"===t&&this.#j()}#F(t=""){let e=this.#x;e|=256,"ENOENT"===t&&(e|=128),("EINVAL"===t||"UNKNOWN"===t)&&(e&=-16),this.#x=e,"ENOTDIR"===t&&this.parent&&this.parent.#I()}#B(t,e){return this.#A(t,e)||this.#U(t,e)}#U(t,e){let i=el(t),s=this.newChild(t.name,i,{parent:this}),r=15&s.#x;return 4!==r&&10!==r&&0!==r&&(s.#x|=64),e.unshift(s),e.provisional++,s}#A(t,e){for(let i=e.provisional;i<e.length;i++){let s=e[i];if((this.nocase?ep(t.name):eu(t.name))===s.#b)return this.#O(t,s,i,e)}}#O(t,e,i,s){let r=e.name;return e.#x=-16&e.#x|el(t),r!==t.name&&(e.name=t.name),i!==s.provisional&&(i===s.length-1?s.pop():s.splice(i,1),s.unshift(e)),s.provisional++,e}async lstat(){if((128&this.#x)==0)try{return this.#G(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#T(t.code)}}lstatSync(){if((128&this.#x)==0)try{return this.#G(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#T(t.code)}}#G(t){let{atime:e,atimeMs:i,birthtime:s,birthtimeMs:r,blksize:n,blocks:a,ctime:o,ctimeMs:h,dev:l,gid:d,ino:u,mode:c,mtime:p,mtimeMs:f,nlink:m,rdev:g,size:w,uid:y}=t;this.#m=e,this.#u=i,this.#y=s,this.#p=r,this.#o=n,this.#d=a,this.#w=o,this.#f=h,this.#e=l,this.#n=d,this.#h=u,this.#i=c,this.#g=p,this.#c=f,this.#s=m,this.#a=g,this.#l=w,this.#r=y;let b=el(t);this.#x=-16&this.#x|b|32,0!==b&&4!==b&&10!==b&&(this.#x|=64)}#R=[];#P=!1;#q(t){this.#P=!1;let e=this.#R.slice();this.#R.length=0,e.forEach(e=>e(null,t))}readdirCB(t,e=!1){if(!this.canReaddir())return void(e?t(null,[]):queueMicrotask(()=>t(null,[])));let i=this.children();if(this.calledReaddir()){let s=i.slice(0,i.provisional);e?t(null,s):queueMicrotask(()=>t(null,s));return}if(this.#R.push(t),this.#P)return;this.#P=!0;let s=this.fullpath();this.#t.readdir(s,{withFileTypes:!0},(t,e)=>{if(t)this.#z(t.code),i.provisional=0;else{for(let t of e)this.#B(t,i);this.#M(i)}this.#q(i.slice(0,i.provisional))})}#Y;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();if(this.#Y)await this.#Y;else{let i=()=>{};this.#Y=new Promise(t=>i=t);try{for(let i of(await this.#t.promises.readdir(e,{withFileTypes:!0})))this.#B(i,t);this.#M(t)}catch(e){this.#z(e.code),t.provisional=0}this.#Y=void 0,i()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();try{for(let i of this.#t.readdirSync(e,{withFileTypes:!0}))this.#B(i,t);this.#M(t)}catch(e){this.#z(e.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(704&this.#x)return!1;let t=15&this.#x;return 0===t||4===t||10===t}shouldWalk(t,e){return(4&this.#x)==4&&!(704&this.#x)&&!t.has(this)&&(!e||e(this))}async realpath(){if(this.#N)return this.#N;if(!(896&this.#x))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#N=this.resolve(t)}catch{this.#L()}}realpathSync(){if(this.#N)return this.#N;if(!(896&this.#x))try{let t=this.#t.realpathSync(this.fullpath());return this.#N=this.resolve(t)}catch{this.#L()}}[eg](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let e=new Set([]),i=[],s=this;for(;s&&s.parent;)e.add(s),s.#$=i.join(this.sep),s.#E=i.join("/"),s=s.parent,i.push("..");for(s=t;s&&s.parent&&!e.has(s);)s.#$=void 0,s.#E=void 0,s=s.parent}},ey=class t extends ew{sep="\\";splitSep=eh;constructor(t,e=0,i,s,r,n,a){super(t,e,i,s,r,n,a)}newChild(e,i=0,s={}){return new t(e,i,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(t){return r.win32.parse(t).root}getRoot(t){if((t=t.toUpperCase().replace(/\//g,"\\").replace(eo,"$1\\"))===this.root.name)return this.root;for(let[e,i]of Object.entries(this.roots))if(this.sameRoot(t,e))return this.roots[t]=i;return this.roots[t]=new eS(t,this).root}sameRoot(t,e=this.root.name){return(t=t.toUpperCase().replace(/\//g,"\\").replace(eo,"$1\\"))===e}},eb=class t extends ew{splitSep="/";sep="/";constructor(t,e=0,i,s,r,n,a){super(t,e,i,s,r,n,a)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(e,i=0,s={}){return new t(e,i,this.root,this.roots,this.nocase,this.childrenCache(),s)}},ev=class{root;rootPath;roots;cwd;#t;#e;#i;nocase;#s;constructor(t=process.cwd(),e,i,{nocase:r,childrenCacheSize:n=16384,fs:a=en}={}){this.#s=ea(a),(t instanceof URL||t.startsWith("file://"))&&(t=(0,s.fileURLToPath)(t));let o=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(o),this.#t=new ef,this.#e=new ef,this.#i=new em(n);let h=o.substring(this.rootPath.length).split(i);if(1!==h.length||h[0]||h.pop(),void 0===r)throw TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=r,this.root=this.newRoot(this.#s),this.roots[this.rootPath]=this.root;let l=this.root,d=h.length-1,u=e.sep,c=this.rootPath,p=!1;for(let t of h){let e=d--;l=l.child(t,{relative:Array(e).fill("..").join(u),relativePosix:Array(e).fill("..").join("/"),fullpath:c+=(p?"":u)+t}),p=!0}this.cwd=l}depth(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#i}resolve(...t){let e="";for(let i=t.length-1;i>=0;i--){let s=t[i];if(!(!s||"."===s)&&(e=e?`${s}/${e}`:s,this.isAbsolute(s)))break}let i=this.#t.get(e);if(void 0!==i)return i;let s=this.cwd.resolve(e).fullpath();return this.#t.set(e,s),s}resolvePosix(...t){let e="";for(let i=t.length-1;i>=0;i--){let s=t[i];if(!(!s||"."===s)&&(e=e?`${s}/${e}`:s,this.isAbsolute(s)))break}let i=this.#e.get(e);if(void 0!==i)return i;let s=this.cwd.resolve(e).fullpathPosix();return this.#e.set(e,s),s}relative(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:!0}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd);let{withFileTypes:i}=e;if(!t.canReaddir())return[];{let e=await t.readdir();return i?e:e.map(t=>t.name)}}readdirSync(t=this.cwd,e={withFileTypes:!0}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd);let{withFileTypes:i=!0}=e;return t.canReaddir()?i?t.readdirSync():t.readdirSync().map(t=>t.name):[]}async lstat(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t.withFileTypes,t=this.cwd);let i=await t.readlink();return e?i:i?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t.withFileTypes,t=this.cwd);let i=t.readlinkSync();return e?i:i?.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t.withFileTypes,t=this.cwd);let i=await t.realpath();return e?i:i?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t.withFileTypes,t=this.cwd);let i=t.realpathSync();return e?i:i?.fullpath()}async walk(t=this.cwd,e={}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:r,walkFilter:n}=e,a=[];(!r||r(t))&&a.push(i?t:t.fullpath());let o=new Set,h=(t,e)=>{o.add(t),t.readdirCB((t,l)=>{if(t)return e(t);let d=l.length;if(!d)return e();let u=()=>{0==--d&&e()};for(let t of l)(!r||r(t))&&a.push(i?t:t.fullpath()),s&&t.isSymbolicLink()?t.realpath().then(t=>t?.isUnknown()?t.lstat():t).then(t=>t?.shouldWalk(o,n)?h(t,u):u()):t.shouldWalk(o,n)?h(t,u):u()},!0)},l=t;return new Promise((t,e)=>{h(l,i=>{if(i)return e(i);t(a)})})}walkSync(t=this.cwd,e={}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:r,walkFilter:n}=e,a=[];(!r||r(t))&&a.push(i?t:t.fullpath());let o=new Set([t]);for(let t of o)for(let e of t.readdirSync()){(!r||r(e))&&a.push(i?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!(s&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(o,n)&&o.add(t)}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd),this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:r,walkFilter:n}=e;(!r||r(t))&&(yield i?t:t.fullpath());let a=new Set([t]);for(let t of a)for(let e of t.readdirSync()){(!r||r(e))&&(yield i?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!(s&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(a,n)&&a.add(t)}}stream(t=this.cwd,e={}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:r,walkFilter:n}=e,a=new es({objectMode:!0});(!r||r(t))&&a.write(i?t:t.fullpath());let o=new Set,h=[t],l=0,d=()=>{let t=!1;for(;!t;){let e=h.shift();if(!e){0===l&&a.end();return}l++,o.add(e);let u=(e,p,f=!1)=>{if(e)return a.emit("error",e);if(s&&!f){let t=[];for(let e of p)e.isSymbolicLink()&&t.push(e.realpath().then(t=>t?.isUnknown()?t.lstat():t));if(t.length)return void Promise.all(t).then(()=>u(null,p,!0))}for(let e of p)e&&(!r||r(e))&&(a.write(i?e:e.fullpath())||(t=!0));for(let t of(l--,p)){let e=t.realpathCached()||t;e.shouldWalk(o,n)&&h.push(e)}t&&!a.flowing?a.once("drain",d):c||d()},c=!0;e.readdirCB(u,!0),c=!1}};return d(),a}streamSync(t=this.cwd,e={}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:r,walkFilter:n}=e,a=new es({objectMode:!0}),o=new Set;(!r||r(t))&&a.write(i?t:t.fullpath());let h=[t],l=0,d=()=>{let t=!1;for(;!t;){let e=h.shift();if(!e){0===l&&a.end();return}l++,o.add(e);let d=e.readdirSync();for(let e of d)(!r||r(e))&&(a.write(i?e:e.fullpath())||(t=!0));for(let t of(l--,d)){let e=t;if(t.isSymbolicLink()){if(!(s&&(e=t.realpathSync())))continue;e.isUnknown()&&e.lstatSync()}e.shouldWalk(o,n)&&h.push(e)}}t&&!a.flowing&&a.once("drain",d)};return d(),a}chdir(t=this.cwd){let e=this.cwd;this.cwd="string"==typeof t?this.cwd.resolve(t):t,this.cwd[eg](e)}},eS=class extends ev{sep="\\";constructor(t=process.cwd(),e={}){let{nocase:i=!0}=e;super(t,r.win32,"\\",{...e,nocase:i}),this.nocase=i;for(let t=this.cwd;t;t=t.parent)t.nocase=this.nocase}parseRootPath(t){return r.win32.parse(t).root.toUpperCase()}newRoot(t){return new ey(this.rootPath,4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},ek=class extends ev{sep="/";constructor(t=process.cwd(),e={}){let{nocase:i=!1}=e;super(t,r.posix,"/",{...e,nocase:i}),this.nocase=i}parseRootPath(t){return"/"}newRoot(t){return new eb(this.rootPath,4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},e$=class extends ek{constructor(t=process.cwd(),e={}){let{nocase:i=!0}=e;super(t,{...e,nocase:i})}},eE=Symbol.for("nodejs.util.inspect.custom"),ex=class t{#t;#e;#i;length;#s;#r;#n;#a;#o;#h;#l=!0;constructor(t,e,i,s){if(!(t=>t.length>=1)(t))throw TypeError("empty pattern list");if(!(t=>t.length>=1)(e))throw TypeError("empty glob list");if(e.length!==t.length)throw TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,i<0||i>=this.length)throw TypeError("index out of range");if(this.#t=t,this.#e=e,this.#i=i,this.#s=s,0===this.#i){if(this.isUNC()){let[t,e,i,s,...r]=this.#t,[n,a,o,h,...l]=this.#e;""===r[0]&&(r.shift(),l.shift());let d=[t,e,i,s,""].join("/"),u=[n,a,o,h,""].join("/");this.#t=[d,...r],this.#e=[u,...l],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[t,...e]=this.#t,[i,...s]=this.#e;""===e[0]&&(e.shift(),s.shift()),this.#t=[t+"/",...e],this.#e=[i+"/",...s],this.length=this.#t.length}}}[eE](){return"Pattern <"+this.#e.slice(this.#i).join("/")+">"}pattern(){return this.#t[this.#i]}isString(){return"string"==typeof this.#t[this.#i]}isGlobstar(){return this.#t[this.#i]===tc}isRegExp(){return this.#t[this.#i]instanceof RegExp}globString(){return this.#n=this.#n||(0===this.#i?this.isAbsolute()?this.#e[0]+this.#e.slice(1).join("/"):this.#e.join("/"):this.#e.slice(this.#i).join("/"))}hasMore(){return this.length>this.#i+1}rest(){return void 0!==this.#r?this.#r:this.hasMore()?(this.#r=new t(this.#t,this.#e,this.#i+1,this.#s),this.#r.#h=this.#h,this.#r.#o=this.#o,this.#r.#a=this.#a,this.#r):this.#r=null}isUNC(){let t=this.#t;return void 0!==this.#o?this.#o:this.#o="win32"===this.#s&&0===this.#i&&""===t[0]&&""===t[1]&&"string"==typeof t[2]&&!!t[2]&&"string"==typeof t[3]&&!!t[3]}isDrive(){let t=this.#t;return void 0!==this.#a?this.#a:this.#a="win32"===this.#s&&0===this.#i&&this.length>1&&"string"==typeof t[0]&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return void 0!==this.#h?this.#h:this.#h=""===t[0]&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return"string"==typeof t&&this.isAbsolute()&&0===this.#i?t:""}checkFollowGlobstar(){return!(0===this.#i||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return 0!==this.#i&&!!this.isGlobstar()&&!!this.#l&&(this.#l=!1,!0)}},eC="object"==typeof process&&process&&"string"==typeof process.platform?process.platform:"linux",eO=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:e,nocase:i,noext:s,noglobstar:r,platform:n=eC}){for(let a of(this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=n,this.mmopts={dot:!0,nobrace:e,nocase:i,noext:s,noglobstar:r,optimizationLevel:2,platform:n,nocomment:!0,nonegate:!0},t))this.add(a)}add(t){let e=new tg(t,this.mmopts);for(let t=0;t<e.set.length;t++){let i=e.set[t],s=e.globParts[t];if(!i||!s)throw Error("invalid pattern object");for(;"."===i[0]&&"."===s[0];)i.shift(),s.shift();let r=new ex(i,s,0,this.platform),n=new tg(r.globString(),this.mmopts),a="**"===s[s.length-1],o=r.isAbsolute();o?this.absolute.push(n):this.relative.push(n),a&&(o?this.absoluteChildren.push(n):this.relativeChildren.push(n))}}ignored(t){let e=t.fullpath(),i=`${e}/`,s=t.relative()||".",r=`${s}/`;for(let t of this.relative)if(t.match(s)||t.match(r))return!0;for(let t of this.absolute)if(t.match(e)||t.match(i))return!0;return!1}childrenIgnored(t){let e=t.fullpath()+"/",i=(t.relative()||".")+"/";for(let t of this.relativeChildren)if(t.match(i))return!0;for(let t of this.absoluteChildren)if(t.match(e))return!0;return!1}},eA=class t{store;constructor(t=new Map){this.store=t}copy(){return new t(new Map(this.store))}hasWalked(t,e){return this.store.get(t.fullpath())?.has(e.globString())}storeWalked(t,e){let i=t.fullpath(),s=this.store.get(i);s?s.add(e.globString()):this.store.set(i,new Set([e.globString()]))}},eR=class{store=new Map;add(t,e,i){let s=2*!!e|!!i,r=this.store.get(t);this.store.set(t,void 0===r?s:s&r)}entries(){return[...this.store.entries()].map(([t,e])=>[t,!!(2&e),!!(1&e)])}},eT=class{store=new Map;add(t,e){if(!t.canReaddir())return;let i=this.store.get(t);i?i.find(t=>t.globString()===e.globString())||i.push(e):this.store.set(t,[e])}get(t){let e=this.store.get(t);if(!e)throw Error("attempting to walk unknown path");return e}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},eF=class t{hasWalkedCache;matches=new eR;subwalks=new eT;patterns;follow;dot;opts;constructor(t,e){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=e?e.copy():new eA}processPatterns(t,e){for(let[i,s]of(this.patterns=e,e.map(e=>[t,e]))){this.hasWalkedCache.storeWalked(i,s);let t=s.root(),e=s.isAbsolute()&&!1!==this.opts.absolute;if(t){i=i.resolve("/"===t&&void 0!==this.opts.root?this.opts.root:t);let e=s.rest();if(e)s=e;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let r,n,a=!1;for(;"string"==typeof(r=s.pattern())&&(n=s.rest());)i=i.resolve(r),s=n,a=!0;if(r=s.pattern(),n=s.rest(),a){if(this.hasWalkedCache.hasWalked(i,s))continue;this.hasWalkedCache.storeWalked(i,s)}if("string"==typeof r){let t=".."===r||""===r||"."===r;this.matches.add(i.resolve(r),e,t);continue}if(r===tc){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let t=n?.pattern(),r=n?.rest();if(n&&(""!==t&&"."!==t||r)){if(".."===t){let t=i.parent||i;r?this.hasWalkedCache.hasWalked(t,r)||this.subwalks.add(t,r):this.matches.add(t,e,!0)}}else this.matches.add(i,e,""===t||"."===t)}else r instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new t(this.opts,this.hasWalkedCache)}filterEntries(t,e){let i=this.subwalks.get(t),s=this.child();for(let t of e)for(let e of i){let i=e.isAbsolute(),r=e.pattern(),n=e.rest();r===tc?s.testGlobstar(t,e,n,i):r instanceof RegExp?s.testRegExp(t,r,n,i):s.testString(t,r,n,i)}return s}testGlobstar(t,e,i,s){if((this.dot||!t.name.startsWith("."))&&(e.hasMore()||this.matches.add(t,s,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,e):t.isSymbolicLink()&&(i&&e.checkFollowGlobstar()?this.subwalks.add(t,i):e.markFollowGlobstar()&&this.subwalks.add(t,e)))),i){let e=i.pattern();if("string"==typeof e&&".."!==e&&""!==e&&"."!==e)this.testString(t,e,i.rest(),s);else if(".."===e){let e=t.parent||t;this.subwalks.add(e,i)}else e instanceof RegExp&&this.testRegExp(t,e,i.rest(),s)}}testRegExp(t,e,i,s){e.test(t.name)&&(i?this.subwalks.add(t,i):this.matches.add(t,s,!1))}testString(t,e,i,s){t.isNamed(e)&&(i?this.subwalks.add(t,i):this.matches.add(t,s,!1))}},ej=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#e;#i;signal;maxDepth;includeChildMatches;constructor(t,e,i){if(this.patterns=t,this.path=e,this.opts=i,this.#i=i.posix||"win32"!==i.platform?"/":"\\",this.includeChildMatches=!1!==i.includeChildMatches,(i.ignore||!this.includeChildMatches)&&(this.#e=((t,e)=>"string"==typeof t?new eO([t],e):Array.isArray(t)?new eO(t,e):t)(i.ignore??[],i),!this.includeChildMatches&&"function"!=typeof this.#e.add))throw Error("cannot ignore child matches, ignore lacks add() method.");this.maxDepth=i.maxDepth||1/0,i.signal&&(this.signal=i.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#s(t){return this.seen.has(t)||!!this.#e?.ignored?.(t)}#r(t){return!!this.#e?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){let t;if(!this.signal?.aborted)for(this.paused=!1;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.signal?.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,e){let i;if(e&&this.opts.nodir)return;if(this.opts.realpath){if(!(i=t.realpathCached()||await t.realpath()))return;t=i}let s=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let t=await s.realpath();t&&(t.isUnknown()||this.opts.stat)&&await t.lstat()}return this.matchCheckTest(s,e)}matchCheckTest(t,e){return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!e||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#s(t)?t:void 0}matchCheckSync(t,e){let i;if(e&&this.opts.nodir)return;if(this.opts.realpath){if(!(i=t.realpathCached()||t.realpathSync()))return;t=i}let s=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let t=s.realpathSync();t&&(t?.isUnknown()||this.opts.stat)&&t.lstatSync()}return this.matchCheckTest(s,e)}matchFinish(t,e){if(this.#s(t))return;if(!this.includeChildMatches&&this.#e?.add){let e=`${t.relativePosix()}/**`;this.#e.add(e)}let i=void 0===this.opts.absolute?e:this.opts.absolute;this.seen.add(t);let s=this.opts.mark&&t.isDirectory()?this.#i:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(i){let e=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(e+s)}else{let e=this.opts.posix?t.relativePosix():t.relative(),i=this.opts.dotRelative&&!e.startsWith(".."+this.#i)?"."+this.#i:"";this.matchEmit(e?i+e+s:"."+s)}}async match(t,e,i){let s=await this.matchCheck(t,i);s&&this.matchFinish(s,e)}matchSync(t,e,i){let s=this.matchCheckSync(t,i);s&&this.matchFinish(s,e)}walkCB(t,e,i){this.signal?.aborted&&i(),this.walkCB2(t,e,new eF(this.opts),i)}walkCB2(t,e,i,s){if(this.#r(t))return s();if(this.signal?.aborted&&s(),this.paused)return void this.onResume(()=>this.walkCB2(t,e,i,s));i.processPatterns(t,e);let r=1,n=()=>{0==--r&&s()};for(let[t,e,s]of i.matches.entries())this.#s(t)||(r++,this.match(t,e,s).then(()=>n()));for(let t of i.subwalkTargets()){if(this.maxDepth!==1/0&&t.depth()>=this.maxDepth)continue;r++;let e=t.readdirCached();t.calledReaddir()?this.walkCB3(t,e,i,n):t.readdirCB((e,s)=>this.walkCB3(t,s,i,n),!0)}n()}walkCB3(t,e,i,s){i=i.filterEntries(t,e);let r=1,n=()=>{0==--r&&s()};for(let[t,e,s]of i.matches.entries())this.#s(t)||(r++,this.match(t,e,s).then(()=>n()));for(let[t,e]of i.subwalks.entries())r++,this.walkCB2(t,e,i.child(),n);n()}walkCBSync(t,e,i){this.signal?.aborted&&i(),this.walkCB2Sync(t,e,new eF(this.opts),i)}walkCB2Sync(t,e,i,s){if(this.#r(t))return s();if(this.signal?.aborted&&s(),this.paused)return void this.onResume(()=>this.walkCB2Sync(t,e,i,s));i.processPatterns(t,e);let r=1,n=()=>{0==--r&&s()};for(let[t,e,s]of i.matches.entries())this.#s(t)||this.matchSync(t,e,s);for(let t of i.subwalkTargets()){if(this.maxDepth!==1/0&&t.depth()>=this.maxDepth)continue;r++;let e=t.readdirSync();this.walkCB3Sync(t,e,i,n)}n()}walkCB3Sync(t,e,i,s){i=i.filterEntries(t,e);let r=1,n=()=>{0==--r&&s()};for(let[t,e,s]of i.matches.entries())this.#s(t)||this.matchSync(t,e,s);for(let[t,e]of i.subwalks.entries())r++,this.walkCB2Sync(t,e,i.child(),n);n()}},e_=class extends ej{matches=new Set;constructor(t,e,i){super(t,e,i)}matchEmit(t){this.matches.add(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((t,e)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?e(this.signal.reason):t(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},eD=class extends ej{results;constructor(t,e,i){super(t,e,i),this.results=new es({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(t){this.results.write(t),this.results.flowing||this.pause()}stream(){let t=this.path;return t.isUnknown()?t.lstat().then(()=>{this.walkCB(t,this.patterns,()=>this.results.end())}):this.walkCB(t,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}},eM="object"==typeof process&&process&&"string"==typeof process.platform?process.platform:"linux",eP=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(t,e){if(!e)throw TypeError("glob options required");if(this.withFileTypes=!!e.withFileTypes,this.signal=e.signal,this.follow=!!e.follow,this.dot=!!e.dot,this.dotRelative=!!e.dotRelative,this.nodir=!!e.nodir,this.mark=!!e.mark,e.cwd?(e.cwd instanceof URL||e.cwd.startsWith("file://"))&&(e.cwd=(0,s.fileURLToPath)(e.cwd)):this.cwd="",this.cwd=e.cwd||"",this.root=e.root,this.magicalBraces=!!e.magicalBraces,this.nobrace=!!e.nobrace,this.noext=!!e.noext,this.realpath=!!e.realpath,this.absolute=e.absolute,this.includeChildMatches=!1!==e.includeChildMatches,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth="number"==typeof e.maxDepth?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&void 0!==this.absolute)throw Error("cannot set absolute and withFileTypes:true");if("string"==typeof t&&(t=[t]),this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||!1===e.allowWindowsEscape,this.windowsPathsNoEscape&&(t=t.map(t=>t.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw TypeError("base matching requires globstar");t=t.map(t=>t.includes("/")?t:`./**/${t}`)}if(this.pattern=t,this.platform=e.platform||eM,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,void 0!==e.nocase&&e.nocase!==e.scurry.nocase)throw Error("nocase option contradicts provided scurry option")}else{let t="win32"===e.platform?eS:"darwin"===e.platform?e$:(e.platform,ek);this.scurry=new t(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let i="darwin"===this.platform||"win32"===this.platform,r={braceExpandMax:1e4,...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:i,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},[n,a]=this.pattern.map(t=>new tg(t,r)).reduce((t,e)=>(t[0].push(...e.set),t[1].push(...e.globParts),t),[[],[]]);this.patterns=n.map((t,e)=>{let i=a[e];if(!i)throw Error("invalid pattern object");return new ex(t,i,0,this.platform)})}async walk(){return[...await new e_(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new e_(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new eD(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new eD(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};function eN(t,e={}){return new eP(t,e).streamSync()}function eW(t,e={}){return new eP(t,e).stream()}function eL(t,e={}){return new eP(t,e).walkSync()}async function ez(t,e={}){return new eP(t,e).walk()}function eI(t,e={}){return new eP(t,e).iterateSync()}function eU(t,e={}){return new eP(t,e).iterate()}var eB=Object.assign(eW,{sync:eN}),eG=Object.assign(eU,{sync:eI}),eq=Object.assign(eL,{stream:eN,iterate:eI}),eY=Object.assign(ez,{glob:ez,globSync:eL,sync:eq,globStream:eW,stream:eB,globStreamSync:eN,streamSync:eN,globIterate:eU,iterate:eG,globIterateSync:eI,iterateSync:eI,Glob:eP,hasMagic:(t,e={})=>{for(let i of(Array.isArray(t)||(t=[t]),t))if(new tg(i,e).hasMagic())return!0;return!1},escape:X,unescape:L});eY.glob=eY;let eH=/\b(shipped|done|released|complete[d]?)\b/i;function eJ(t){return t.replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[*_`]/g,"").replace(/\s+/g," ").trim()}function eK(t){return t.length>80?`${t.slice(0,79).trimEnd()}…`:t}function eV(t){return t.length&&t.every(t=>"done"===t)?"done":t.some(t=>"planned"!==t)?"in-progress":"planned"}let eX=t=>{let e=parseFloat(t);return Number.isFinite(e)?e:1/0},eZ=t=>"done"===t||"cancelled"===t,eQ=t=>!!t&&"object"==typeof t&&!Array.isArray(t),e0=t=>"string"==typeof t?t.trim():"";function e1(t,e,i="is not an existing roadmap item"){let s=e.find(e=>e.id===t.toUpperCase());return s?null!==s.parent?{error:`parent ${s.id} is an epic, not a horizon (max depth is 2)`}:{id:s.id}:{error:`parent "${t}" ${i}`}}let e2=(t,e,i)=>t.find(t=>(t.parent??"")===e&&t.title.trim().toLowerCase()===i.toLowerCase())?.id;function e8(t,e){if(!eQ(t))return["plan must be an object"];if("roadmap"===t.kind)return function(t,e){let i=[],s=t.horizons??[],r=t.epics??[];if(Array.isArray(s)||i.push("horizons must be an array"),Array.isArray(r)||i.push("epics must be an array"),i.length>0)return i;if(s.length+r.length===0)return["a roadmap plan needs at least one horizon or epic"];let n=new Set,a=new Set,o=(t,e,s)=>{let r=eQ(t)?e0(t.key):"";r?n.has(r)?i.push(`duplicate key "${r}"`):(n.add(r),s&&a.add(r)):i.push(`${e}: key is required`)};s.forEach((t,e)=>o(t,`horizon #${e+1}`,!0)),r.forEach((t,e)=>o(t,`epic #${e+1}`,!1));let h=new Map,l=(t,s,r)=>{let n=`${t}\0${s.toLowerCase()}`,a=e2(e.roadmap,t,s)??h.get(n);a?i.push(`${r}: "${s}" already exists ${t?`under ${t}`:"as a horizon"} (${a})`):h.set(n,r)};return s.forEach((t,e)=>{if(!eQ(t))return void i.push(`horizon #${e+1} must be an object`);let s=e0(t.key)||`horizon #${e+1}`,r=e0(t.title);r?l("",r,s):i.push(`${s}: title is required`),void 0!==t.body&&"string"!=typeof t.body&&i.push(`${s}: body must be a markdown string`)}),r.forEach((t,s)=>{if(!eQ(t))return void i.push(`epic #${s+1} must be an object`);let r=e0(t.key)||`epic #${s+1}`,o=e0(t.title);o||i.push(`${r}: title is required`),"string"!=typeof t.body&&i.push(`${r}: body must be a markdown string`),void 0===t.status||e3.includes(t.status)||i.push(`${r}: status must be one of ${e3.join(", ")} (got ${JSON.stringify(t.status)})`);let h=e0(t.parent),d="";if(h)if(a.has(h))d=h;else if(n.has(h))i.push(`${r}: parent "${h}" is an epic in this plan; an epic's parent must be a horizon`);else{let t=e1(h,e.roadmap,"is neither a horizon key in this plan nor an existing roadmap item");"id"in t?d=t.id:i.push(`${r}: ${t.error}`)}else i.push(`${r}: parent is required (an existing horizon id or a horizon key in this plan)`);o&&d&&l(d,o,r)}),i}(t,e);if("breakdown"!==t.kind)return[`plan.kind must be "breakdown" or "roadmap" (got ${JSON.stringify(t.kind)})`];let i=[],s=e0(t.epic).toUpperCase();if(void 0!==t.epic&&"string"!=typeof t.epic)i.push("epic must be a string (an epic id)");else if(s&&void 0!==t.newEpic)i.push("pass either epic (an existing epic) or newEpic, not both");else if(s){let r=e.roadmap.find(t=>t.id===s);r?r.parent||i.push(`${r.id} is a horizon, not an epic; pass an epic id`):i.push(`Epic ${JSON.stringify(t.epic)} not found`)}else if(void 0!==t.newEpic){let s=t.newEpic;if(eQ(s)){let t=e0(s.title),r=e0(s.parent);if(t||i.push("newEpic: title is required"),"string"!=typeof s.body&&i.push("newEpic: body must be a markdown string"),r){let s=e1(r,e.roadmap);if("error"in s)i.push(`newEpic: ${s.error}`);else if(t){let r=e2(e.roadmap,s.id,t);r&&i.push(`newEpic: "${t}" already exists under ${s.id} (${r})`)}}else i.push("newEpic: parent is required (an existing horizon id)")}else i.push("newEpic must be an object { title, parent, body }")}if(!Array.isArray(t.tasks)||0===t.tasks.length)return i.push("tasks must be a non-empty array"),i;let r=t.tasks,n=new Set(e.taskIds.map(t=>t.toUpperCase())),a=new Map;r.forEach((t,e)=>{let s=eQ(t)?e0(t.key):"";s?a.has(s)?i.push(`duplicate key "${s}"`):a.set(s,e):i.push(`task #${e+1}: key is required`)});let o=new Map;r.forEach((t,e)=>{var s;let r;if(!eQ(t))return void i.push(`task #${e+1} must be an object`);let h=e0(t.key)||`task #${e+1}`;if(e0(t.title)||i.push(`${h}: title is required`),"string"!=typeof t.body&&i.push(`${h}: body must be a markdown string`),void 0!==t.size&&"string"!=typeof t.size&&i.push(`${h}: size must be a string`),void 0===t.due||"string"==typeof t.due&&(r=(s=t.due).match(/^(\d{4})-(\d{2})-(\d{2})$/))&&new Date(Date.UTC(+r[1],r[2]-1,+r[3])).toISOString().slice(0,10)===s||i.push(`${h}: due must be a date YYYY-MM-DD (got ${JSON.stringify(t.due)})`),void 0===t.dependsOn)return;if(!Array.isArray(t.dependsOn))return void i.push(`${h}: dependsOn must be an array`);let l=[];for(let e of t.dependsOn){let t=e0(e);a.has(t)?l.push(t):n.has(t.toUpperCase())||i.push(`${h}: dependsOn "${String(e)}" is neither a key in this plan nor an existing task`)}e0(t.key)&&o.set(e0(t.key),l)});let h=new Map,l=new Set,d=(t,e)=>{if("done"!==h.get(t)){if("open"===h.get(t)){let s=[...e.slice(e.indexOf(t)),t];s.some(t=>l.has(t))||i.push(`dependency cycle: ${s.join(" → ")}`),s.forEach(t=>l.add(t));return}for(let i of(h.set(t,"open"),o.get(t)??[]))d(i,[...e,t]);h.set(t,"done")}};for(let t of o.keys())d(t,[]);for(let[t,e]of o)if(!l.has(t))for(let s of e)(a.get(s)??0)>(a.get(t)??0)&&i.push(`${t} depends on ${s}, which comes later; list ${s} first`);return i}let e3=["planned","in-progress","done"];function e4(t,e){if("roadmap"===t.kind)return function(t,e){let i=[],s=t.horizons??[],r=t.epics??[],n=new Set(s.map(t=>t.key)),a=new Set([...n,...r.map(t=>t.key)]),o=new Set(e);for(let t of o)a.has(t)||i.push(`unknown key "${t}"`);let h=s.filter(t=>o.has(t.key)),l=r.filter(t=>o.has(t.key));for(let t of(h.length+l.length===0&&i.push("nothing selected"),l)){let e=t.parent.trim();n.has(e)&&!o.has(e)&&i.push(`${t.key} is under ${e}, which you unchecked; check ${e} or uncheck ${t.key}`)}return{plan:{...t,horizons:h,epics:l},errors:i}}(t,e);let i=[],s=new Set(t.tasks.map(t=>t.key.trim())),r=new Set(e.map(t=>t.trim()));for(let t of r)s.has(t)||i.push(`unknown key "${t}"`);let n=t.tasks.filter(t=>r.has(t.key.trim()));for(let t of(0===n.length&&i.push("nothing selected"),n))for(let e of(t.dependsOn??[]).map(t=>t.trim()))s.has(e)&&!r.has(e)&&i.push(`${t.key.trim()} depends on ${e}, which you unchecked`);return{plan:{...t,tasks:n},errors:i}}t.s(["planTarget",0,function(t){return e0(t.epic)?e0(t.epic).toUpperCase():t.newEpic?`new epic "${e0(t.newEpic.title)}"`:"no epic"},"selectPlan",0,e4,"validatePlan",0,e8],975283);let e6=(t,e)=>`${t} ${e}${1===t?"":"s"}`;t.s(["SESSION_GAP_MS",0,18e5,"groupSessions",0,function(t,e={}){let i=e.gapMs??18e5,s=[...t].sort((t,e)=>t.timestamp.localeCompare(e.timestamp)),r=new Map,n=new Map;for(let t of s){let e=t.sessionId;if(!e){let s=Date.parse(t.timestamp),r=n.get(t.actor);(!r||"session_start"===t.type||s-r.lastAt>i)&&(r={id:`legacy_${t.id}`,lastAt:s},n.set(t.actor,r)),r.lastAt=s,e=r.id}let s=r.get(e);s?s.push(t):r.set(e,[t])}return[...r].map(([t,e])=>(function(t,e){let i=new Map,s=new Set,r=[],n=!1,a=0;for(let t of e){"task_updated"===t.type&&t.taskId&&t.taskStatus&&i.set(t.taskId,t.taskStatus);let e=function(t){switch(t.type){case"doc_created":return t.detail??t.title.replace(/^Created: /,"");case"doc_deleted":return t.title.replace(/^Deleted /,"");case"doc_renamed":return t.title.split(" → ")[1]??null;default:return null}}(t);e&&s.add(e),"decision_logged"===t.type&&r.push(t.title),"memory_updated"===t.type&&(n=!0),"roadmap_updated"===t.type&&a++}let o=[...i].map(([t,e])=>({id:t,lastStatus:e})),h=o.filter(t=>"done"===t.lastStatus).length,l=[o.length?`${e6(o.length,"task")} moved${h?` (${h} done)`:""}`:"",s.size?`${e6(s.size,"doc")} changed`:"",r.length?e6(r.length,"ADR"):"",a?e6(a,"roadmap edit"):"",n?"memory updated":""].filter(Boolean);return{id:t,actor:e[0].actor,start:e[0].timestamp,end:e[e.length-1].timestamp,eventCount:e.length,eventIds:e.map(t=>t.id),tasks:o,docs:[...s],decisions:r,memoryUpdated:n,headline:l.join(" · ")||e6(e.length,"event")}})(t,e)).sort((t,e)=>e.start.localeCompare(t.start))},"sessionDuration",0,function(t){let e=Math.round((Date.parse(t.end)-Date.parse(t.start))/6e4);return e<1?"<1m":e<60?`${e}m`:`${Math.floor(e/60)}h ${e%60}m`},"sessionsForTask",0,function(t,e){return t.filter(t=>t.tasks.some(t=>t.id===e))}],31451);let e5={todo:"📋","in-progress":"🔨",blocked:"🚫",done:"✅",cancelled:"❌"},e7={ready:"todo",planned:"todo","not started":"todo",wip:"in-progress",doing:"in-progress",active:"in-progress",start:"in-progress",started:"in-progress",complete:"done",completed:"done",finished:"done",finish:"done",block:"blocked",cancel:"cancelled",skip:"cancelled"};function e9(){return process.env.VIBEDOC_ROOT||process.cwd()}async function it(t){let s=t||i.default.dirname(e9()),r=[];try{for(let t of(await e.default.readdir(s,{withFileTypes:!0}))){if(!t.isDirectory())continue;let n=i.default.join(s,t.name),a=!1;for(let t of["CLAUDE.md","AGENTS.md","docs/architecture",".vibedoc"])try{await e.default.access(i.default.join(n,t)),a=!0;break}catch{}a&&r.push({id:t.name,name:t.name,root:n,hasVibedoc:!0})}}catch{}let n=e9(),a=i.default.basename(n),o=r.findIndex(t=>t.root===n);if(o>0){let[t]=r.splice(o,1);r.unshift(t)}else -1===o&&r.unshift({id:a,name:a,root:n,hasVibedoc:!0});return r}async function ie(t){return(await eY("**/*.md",{cwd:t,ignore:["node_modules/**",".git/**",".next/**"],nodir:!0})).sort().map(t=>{var e;return{path:t,section:(e=t).includes("/")?e.startsWith("memory/")?"memory":e.startsWith("plans/")?"plans":e.includes("01-overview")?"overview":e.includes("02-high-level")||e.includes("high-level-design")?"high-level-design":e.includes("03-services")||e.includes("/services/")?"services":e.includes("04-data")||e.includes("/data/")?"data":e.includes("05-infra")||e.includes("/infrastructure/")?"infrastructure":e.includes("06-security")||e.includes("/security/")?"security":e.includes("07-observ")||e.includes("/observability/")?"observability":e.includes("08-resil")||e.includes("/resilience/")?"resilience":e.includes("decisions/")||e.includes("ADR")?"decisions":"other":"root",name:i.default.basename(t,".md")}})}async function ii(t,s){for(let r of[i.default.join(s,t),i.default.join(s,`${t}.md`),i.default.join(s,"docs",t),i.default.join(s,"docs",`${t}.md`),i.default.join(s,"docs","architecture",t),i.default.join(s,"docs","architecture",`${t}.md`),i.default.join(s,"memory",t),i.default.join(s,"memory",`${t}.md`),i.default.join(s,"plans",t),i.default.join(s,"plans",`${t}.md`)])try{let t=await e.default.readFile(r,"utf8");return{path:i.default.relative(s,r),content:t}}catch{}for(let r of[`**/${t}.md`,`**/${t}*.md`,`**/*${t}*.md`]){let t=await eY(r,{cwd:s,ignore:["node_modules/**",".git/**",".next/**"],nodir:!0,nocase:!0});if(t.length>0){let r=await e.default.readFile(i.default.join(s,t[0]),"utf8");return{path:t[0],content:r}}}throw Error(`Doc not found: "${t}"`)}async function is(t,s,r){let n=i.default.resolve(r),a=i.default.resolve(r,t);if(!a.startsWith(n+i.default.sep)&&a!==n)throw Error("Path outside root");await e.default.mkdir(i.default.dirname(a),{recursive:!0}),await e.default.writeFile(a,s,"utf8")}async function ir(t,s,r,n=!1){let a=i.default.resolve(r),o=i.default.resolve(r,t);if(!o.startsWith(a+i.default.sep))throw Error("Path outside root");let h=await e.default.readFile(o,"utf8").catch(t=>{if("ENOENT"===t.code)return"";throw t}),l=function(t,e){let i=t;for(let[t,s]of e.entries()){if("string"!=typeof s?.old_string||"string"!=typeof s?.new_string)return{error:`Edit ${t+1}: old_string and new_string must be strings`};if(""===s.old_string){if(""!==i)return{error:`Edit ${t+1}: empty old_string is only allowed for a new, empty doc`};i=s.new_string;continue}let e=i.indexOf(s.old_string);if(-1===e)return{error:`Edit ${t+1}: old_string not found in the doc`};if(-1!==i.indexOf(s.old_string,e+1))return{error:`Edit ${t+1}: old_string matches more than once; include more surrounding text`};i=i.slice(0,e)+s.new_string+i.slice(e+s.old_string.length)}return{content:i}}(h,s);if("error"in l)throw Error(l.error);return n||(await e.default.mkdir(i.default.dirname(o),{recursive:!0}),await e.default.writeFile(o,l.content,"utf8")),{before:h,content:l.content}}async function ia(t,e){let i=[];for(let s of t)try{let{content:t}=await ii(s,e);i.push(`--- FILE: ${s} ---
3
+ >>> no match, partial?`,t,u,e,c),u===o))}if("string"==typeof l?(r=d===l,this.debug("string match",l,d,r)):(r=l.test(d),this.debug("pattern match",l,d,r)),!r)return!1}if(n===o&&a===h)return!0;if(n===o)return i;if(a===h)return n===o-1&&""===t[n];throw Error("wtf?")}braceExpand(){return tf(this.pattern,this.options)}parse(t){M(t);let e=this.options;if("**"===t)return tc;if(""===t)return"";let i,s=null;(i=t.match(tn))?s=e.dot?to:ta:(i=t.match(Q))?s=(e.nocase?e.dot?t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)):t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)):e.dot?t=>e=>e.endsWith(t):t=>e=>!e.startsWith(".")&&e.endsWith(t))(i[1]):(i=t.match(th))?s=(e.nocase?e.dot?([t,e=""])=>{let i=td([t]);return e?(e=e.toLowerCase(),t=>i(t)&&t.toLowerCase().endsWith(e)):i}:([t,e=""])=>{let i=tl([t]);return e?(e=e.toLowerCase(),t=>i(t)&&t.toLowerCase().endsWith(e)):i}:e.dot?([t,e=""])=>{let i=td([t]);return e?t=>i(t)&&t.endsWith(e):i}:([t,e=""])=>{let i=tl([t]);return e?t=>i(t)&&t.endsWith(e):i})(i):(i=t.match(tt))?s=e.dot?ti:te:(i=t.match(ts))&&(s=tr);let r=V.fromGlob(t,this.options).toMMPattern();return s&&"object"==typeof r&&Reflect.defineProperty(r,"test",{value:s}),r}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,i=e.noglobstar?"[^/]*?":e.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",s=new Set(e.nocase?["i"]:[]),r=t.map(t=>{let e=t.map(t=>{if(t instanceof RegExp)for(let e of t.flags.split(""))s.add(e);return"string"==typeof t?t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):t===tc?tc:t._src});e.forEach((t,s)=>{let r=e[s+1],n=e[s-1];t!==tc||n===tc||(void 0===n?void 0!==r&&r!==tc?e[s+1]="(?:\\/|"+i+"\\/)?"+r:e[s]=i:void 0===r?e[s-1]=n+"(?:\\/|\\/"+i+")?":r!==tc&&(e[s-1]=n+"(?:\\/|\\/"+i+"\\/)"+r,e[s+1]=tc))});let r=e.filter(t=>t!==tc);if(this.partial&&r.length>=1){let t=[];for(let e=1;e<=r.length;e++)t.push(r.slice(0,e).join("/"));return"(?:"+t.join("|")+")"}return r.join("/")}).join("|"),[n,a]=t.length>1?["(?:",")"]:["",""];r="^"+n+r+a+"$",this.partial&&(r="^(?:\\/|"+n+r.slice(1,-1)+a+")$"),this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...s].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return""===t;if("/"===t&&e)return!0;let i=this.options;this.isWindows&&(t=t.split("\\").join("/"));let s=this.slashSplit(t);this.debug(this.pattern,"split",s);let r=this.set;this.debug(this.pattern,"set",r);let n=s[s.length-1];if(!n)for(let t=s.length-2;!n&&t>=0;t--)n=s[t];for(let t=0;t<r.length;t++){let a=r[t],o=s;if(i.matchBase&&1===a.length&&(o=[n]),this.matchOne(o,a,e))return!!i.flipNegate||!this.negate}return!i.flipNegate&&this.negate}static defaults(t){return Z.defaults(t).Minimatch}};Z.AST=V,Z.Minimatch=tg,Z.escape=X,Z.unescape=L;var tw="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,ty=new Set,tb="object"==typeof process&&process?process:{},tv=(t,e,i,s)=>{"function"==typeof tb.emitWarning?tb.emitWarning(t,e,i,s):console.error(`[${i}] ${e}: ${t}`)},tS=globalThis.AbortController,tk=globalThis.AbortSignal;if(typeof tS>"u"){tk=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(t,e){this._onabort.push(e)}},tS=class{constructor(){e()}signal=new tk;abort(t){if(!this.signal.aborted){for(let e of(this.signal.reason=t,this.signal.aborted=!0,this.signal._onabort))e(t);this.signal.onabort?.(t)}}};let t=tb.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,tv("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var t$=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),tE=t=>t$(t)?t<=256?Uint8Array:t<=65536?Uint16Array:t<=0x100000000?Uint32Array:t<=Number.MAX_SAFE_INTEGER?tx:null:null,tx=class extends Array{constructor(t){super(t),this.fill(0)}},tC=class t{heap;length;static #t=!1;static create(e){let i=tE(e);if(!i)return[];t.#t=!0;let s=new t(e,i);return t.#t=!1,s}constructor(e,i){if(!t.#t)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},tO=class t{#t;#e;#i;#s;#r;#n;#a;#o;get perf(){return this.#o}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#h;#l;#d;#u;#c;#f;#p;#m;#g;#w;#y;#b;#v;#S;#k;#$;#E;#x;#C;static unsafeExposeInternals(t){return{starts:t.#v,ttls:t.#S,autopurgeTimers:t.#k,sizes:t.#b,keyMap:t.#d,keyList:t.#u,valList:t.#c,next:t.#f,prev:t.#p,get head(){return t.#m},get tail(){return t.#g},free:t.#w,isBackgroundFetch:e=>t.#O(e),backgroundFetch:(e,i,s,r)=>t.#A(e,i,s,r),moveToTail:e=>t.#R(e),indexes:e=>t.#j(e),rindexes:e=>t.#F(e),isStale:e=>t.#T(e)}}get max(){return this.#t}get maxSize(){return this.#e}get calculatedSize(){return this.#l}get size(){return this.#h}get fetchMethod(){return this.#n}get memoMethod(){return this.#a}get dispose(){return this.#i}get onInsert(){return this.#s}get disposeAfter(){return this.#r}constructor(e){let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:a,updateAgeOnHas:o,allowStale:h,dispose:l,onInsert:d,disposeAfter:u,noDisposeOnSet:c,noUpdateTTL:p,maxSize:f=0,maxEntrySize:m=0,sizeCalculation:g,fetchMethod:w,memoMethod:y,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:k,ignoreFetchAbort:$,perf:E}=e;if(void 0!==E&&"function"!=typeof E?.now)throw TypeError("perf option must have a now() method if specified");if(this.#o=E??tw,0!==i&&!t$(i))throw TypeError("max option must be a nonnegative integer");let x=i?tE(i):Array;if(!x)throw Error("invalid max value: "+i);if(this.#t=i,this.#e=f,this.maxEntrySize=m||this.#e,this.sizeCalculation=g,this.sizeCalculation){if(!this.#e&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw TypeError("sizeCalculation set to non-function")}if(void 0!==y&&"function"!=typeof y)throw TypeError("memoMethod must be a function if defined");if(this.#a=y,void 0!==w&&"function"!=typeof w)throw TypeError("fetchMethod must be a function if specified");if(this.#n=w,this.#E=!!w,this.#d=new Map,this.#u=Array(i).fill(void 0),this.#c=Array(i).fill(void 0),this.#f=new x(i),this.#p=new x(i),this.#m=0,this.#g=0,this.#w=tC.create(i),this.#h=0,this.#l=0,"function"==typeof l&&(this.#i=l),"function"==typeof d&&(this.#s=d),"function"==typeof u?(this.#r=u,this.#y=[]):(this.#r=void 0,this.#y=void 0),this.#$=!!this.#i,this.#C=!!this.#s,this.#x=!!this.#r,this.noDisposeOnSet=!!c,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!k,this.ignoreFetchAbort=!!$,0!==this.maxEntrySize){if(0!==this.#e&&!t$(this.#e))throw TypeError("maxSize must be a positive integer if specified");if(!t$(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#_()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!o,this.ttlResolution=t$(r)||0===r?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!t$(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#D()}if(0===this.#t&&0===this.ttl&&0===this.#e)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#e){let e="LRU_CACHE_UNBOUNDED";(t=>!ty.has(t))(e)&&(ty.add(e),tv("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,t))}}getRemainingTTL(t){return this.#d.has(t)?1/0:0}#D(){let t=new tx(this.#t),e=new tx(this.#t);this.#S=t,this.#v=e;let i=this.ttlAutopurge?Array(this.#t):void 0;this.#k=i,this.#M=(s,r,n=this.#o.now())=>{if(e[s]=0!==r?n:0,t[s]=r,i?.[s]&&(clearTimeout(i[s]),i[s]=void 0),0!==r&&i){let t=setTimeout(()=>{this.#T(s)&&this.#P(this.#u[s],"expire")},r+1);t.unref&&t.unref(),i[s]=t}},this.#N=i=>{e[i]=0!==t[i]?this.#o.now():0},this.#W=(i,n)=>{if(t[n]){let a=t[n],o=e[n];if(!a||!o)return;i.ttl=a,i.start=o,i.now=s||r();let h=i.now-o;i.remainingTTL=a-h}};let s=0,r=()=>{let t=this.#o.now();if(this.ttlResolution>0){s=t;let e=setTimeout(()=>s=0,this.ttlResolution);e.unref&&e.unref()}return t};this.getRemainingTTL=i=>{let n=this.#d.get(i);if(void 0===n)return 0;let a=t[n],o=e[n];return a&&o?a-((s||r())-o):1/0},this.#T=i=>{let n=e[i],a=t[i];return!!a&&!!n&&(s||r())-n>a}}#N=()=>{};#W=()=>{};#M=()=>{};#T=()=>!1;#_(){let t=new tx(this.#t);this.#l=0,this.#b=t,this.#L=e=>{this.#l-=t[e],t[e]=0},this.#z=(t,e,i,s)=>{if(this.#O(e))return 0;if(!t$(i))if(s){if("function"!=typeof s)throw TypeError("sizeCalculation must be a function");if(!t$(i=s(e,t)))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#I=(e,i,s)=>{if(t[e]=i,this.#e){let i=this.#e-t[e];for(;this.#l>i;)this.#U(!0)}this.#l+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#l)}}#L=t=>{};#I=(t,e,i)=>{};#z=(t,e,i,s)=>{if(i||s)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#j({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#g;!(!this.#B(e)||((t||!this.#T(e))&&(yield e),e===this.#m));)e=this.#p[e]}*#F({allowStale:t=this.allowStale}={}){if(this.#h)for(let e=this.#m;!(!this.#B(e)||((t||!this.#T(e))&&(yield e),e===this.#g));)e=this.#f[e]}#B(t){return void 0!==t&&this.#d.get(this.#u[t])===t}*entries(){for(let t of this.#j())void 0===this.#c[t]||void 0===this.#u[t]||this.#O(this.#c[t])||(yield[this.#u[t],this.#c[t]])}*rentries(){for(let t of this.#F())void 0===this.#c[t]||void 0===this.#u[t]||this.#O(this.#c[t])||(yield[this.#u[t],this.#c[t]])}*keys(){for(let t of this.#j()){let e=this.#u[t];void 0===e||this.#O(this.#c[t])||(yield e)}}*rkeys(){for(let t of this.#F()){let e=this.#u[t];void 0===e||this.#O(this.#c[t])||(yield e)}}*values(){for(let t of this.#j())void 0===this.#c[t]||this.#O(this.#c[t])||(yield this.#c[t])}*rvalues(){for(let t of this.#F())void 0===this.#c[t]||this.#O(this.#c[t])||(yield this.#c[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let i of this.#j()){let s=this.#c[i],r=this.#O(s)?s.__staleWhileFetching:s;if(void 0!==r&&t(r,this.#u[i],this))return this.get(this.#u[i],e)}}forEach(t,e=this){for(let i of this.#j()){let s=this.#c[i],r=this.#O(s)?s.__staleWhileFetching:s;void 0!==r&&t.call(e,r,this.#u[i],this)}}rforEach(t,e=this){for(let i of this.#F()){let s=this.#c[i],r=this.#O(s)?s.__staleWhileFetching:s;void 0!==r&&t.call(e,r,this.#u[i],this)}}purgeStale(){let t=!1;for(let e of this.#F({allowStale:!0}))this.#T(e)&&(this.#P(this.#u[e],"expire"),t=!0);return t}info(t){let e=this.#d.get(t);if(void 0===e)return;let i=this.#c[e],s=this.#O(i)?i.__staleWhileFetching:i;if(void 0===s)return;let r={value:s};if(this.#S&&this.#v){let t=this.#S[e],i=this.#v[e];t&&i&&(r.ttl=t-(this.#o.now()-i),r.start=Date.now())}return this.#b&&(r.size=this.#b[e]),r}dump(){let t=[];for(let e of this.#j({allowStale:!0})){let i=this.#u[e],s=this.#c[e],r=this.#O(s)?s.__staleWhileFetching:s;if(void 0===r||void 0===i)continue;let n={value:r};if(this.#S&&this.#v){n.ttl=this.#S[e];let t=this.#o.now()-this.#v[e];n.start=Math.floor(Date.now()-t)}this.#b&&(n.size=this.#b[e]),t.unshift([i,n])}return t}load(t){for(let[e,i]of(this.clear(),t)){if(i.start){let t=Date.now()-i.start;i.start=this.#o.now()-t}this.set(e,i.value,i)}}set(t,e,i={}){if(void 0===e)return this.delete(t),this;let{ttl:s=this.ttl,start:r,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:o}=i,{noUpdateTTL:h=this.noUpdateTTL}=i,l=this.#z(t,e,i.size||0,a);if(this.maxEntrySize&&l>this.maxEntrySize)return o&&(o.set="miss",o.maxEntrySizeExceeded=!0),this.#P(t,"set"),this;let d=0===this.#h?void 0:this.#d.get(t);if(void 0===d)d=0===this.#h?this.#g:0!==this.#w.length?this.#w.pop():this.#h===this.#t?this.#U(!1):this.#h,this.#u[d]=t,this.#c[d]=e,this.#d.set(t,d),this.#f[this.#g]=d,this.#p[d]=this.#g,this.#g=d,this.#h++,this.#I(d,l,o),o&&(o.set="add"),h=!1,this.#C&&this.#s?.(e,t,"add");else{this.#R(d);let i=this.#c[d];if(e!==i){if(this.#E&&this.#O(i)){i.__abortController.abort(Error("replaced"));let{__staleWhileFetching:e}=i;void 0!==e&&!n&&(this.#$&&this.#i?.(e,t,"set"),this.#x&&this.#y?.push([e,t,"set"]))}else n||(this.#$&&this.#i?.(i,t,"set"),this.#x&&this.#y?.push([i,t,"set"]));if(this.#L(d),this.#I(d,l,o),this.#c[d]=e,o){o.set="replace";let t=i&&this.#O(i)?i.__staleWhileFetching:i;void 0!==t&&(o.oldValue=t)}}else o&&(o.set="update");this.#C&&this.onInsert?.(e,t,e===i?"update":"replace")}if(0===s||this.#S||this.#D(),this.#S&&(h||this.#M(d,s,r),o&&this.#W(o,d)),!n&&this.#x&&this.#y){let t=this.#y,e;for(;e=t?.shift();)this.#r?.(...e)}return this}pop(){try{for(;this.#h;){let t=this.#c[this.#m];if(this.#U(!0),this.#O(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(void 0!==t)return t}}finally{if(this.#x&&this.#y){let t=this.#y,e;for(;e=t?.shift();)this.#r?.(...e)}}}#U(t){let e=this.#m,i=this.#u[e],s=this.#c[e];return this.#E&&this.#O(s)?s.__abortController.abort(Error("evicted")):(this.#$||this.#x)&&(this.#$&&this.#i?.(s,i,"evict"),this.#x&&this.#y?.push([s,i,"evict"])),this.#L(e),this.#k?.[e]&&(clearTimeout(this.#k[e]),this.#k[e]=void 0),t&&(this.#u[e]=void 0,this.#c[e]=void 0,this.#w.push(e)),1===this.#h?(this.#m=this.#g=0,this.#w.length=0):this.#m=this.#f[e],this.#d.delete(i),this.#h--,e}has(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,r=this.#d.get(t);if(void 0!==r){let t=this.#c[r];if(this.#O(t)&&void 0===t.__staleWhileFetching)return!1;if(!this.#T(r))return i&&this.#N(r),s&&(s.has="hit",this.#W(s,r)),!0;s&&(s.has="stale",this.#W(s,r))}else s&&(s.has="miss");return!1}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=this.#d.get(t);if(void 0===s||!i&&this.#T(s))return;let r=this.#c[s];return this.#O(r)?r.__staleWhileFetching:r}#A(t,e,i,s){let r=void 0===e?void 0:this.#c[e];if(this.#O(r))return r;let n=new tS,{signal:a}=i;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let o={signal:n.signal,options:i,context:s},h=(s,r=!1)=>{let{aborted:a}=n.signal,h=i.ignoreFetchAbort&&void 0!==s,d=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&void 0!==s);if(i.status&&(a&&!r?(i.status.fetchAborted=!0,i.status.fetchError=n.signal.reason,h&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),a&&!h&&!r)return l(n.signal.reason,d);let c=this.#c[e];return(c===u||h&&r&&void 0===c)&&(void 0===s?void 0!==u.__staleWhileFetching?this.#c[e]=u.__staleWhileFetching:this.#P(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(t,s,o.options))),s},l=(s,r)=>{let{aborted:a}=n.signal,o=a&&i.allowStaleOnFetchAbort,h=o||i.allowStaleOnFetchRejection,l=h||i.noDeleteOnFetchRejection;if(this.#c[e]===u&&(l&&(r||void 0!==u.__staleWhileFetching)?o||(this.#c[e]=u.__staleWhileFetching):this.#P(t,"fetch")),h)return i.status&&void 0!==u.__staleWhileFetching&&(i.status.returnedStale=!0),u.__staleWhileFetching;if(u.__returned===u)throw s},d=(e,s)=>{let a=this.#n?.(t,r,o);a&&a instanceof Promise&&a.then(t=>e(void 0===t?void 0:t),s),n.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(e(void 0),i.allowStaleOnFetchAbort&&(e=t=>h(t,!0)))})};i.status&&(i.status.fetchDispatched=!0);let u=new Promise(d).then(h,t=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=t),l(t,!1))),c=Object.assign(u,{__abortController:n,__staleWhileFetching:r,__returned:void 0});return void 0===e?(this.set(t,c,{...o.options,status:void 0}),e=this.#d.get(t)):this.#c[e]=c,c}#O(t){return!!this.#E&&!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof tS}async fetch(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:o=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:c=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:f,forceRefresh:m=!1,status:g,signal:w}=e;if(!this.#E)return g&&(g.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:r,status:g});let y={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:r,ttl:n,noDisposeOnSet:a,size:o,sizeCalculation:h,noUpdateTTL:l,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:p,ignoreFetchAbort:c,status:g,signal:w},b=this.#d.get(t);if(void 0===b){g&&(g.fetch="miss");let e=this.#A(t,b,y,f);return e.__returned=e}{let e=this.#c[b];if(this.#O(e)){let t=i&&void 0!==e.__staleWhileFetching;return g&&(g.fetch="inflight",t&&(g.returnedStale=!0)),t?e.__staleWhileFetching:e.__returned=e}let r=this.#T(b);if(!m&&!r)return g&&(g.fetch="hit"),this.#R(b),s&&this.#N(b),g&&this.#W(g,b),e;let n=this.#A(t,b,y,f),a=void 0!==n.__staleWhileFetching&&i;return g&&(g.fetch=r?"stale":"refresh",a&&r&&(g.returnedStale=!0)),a?n.__staleWhileFetching:n.__returned=n}}async forceFetch(t,e={}){let i=await this.fetch(t,e);if(void 0===i)throw Error("fetch() returned undefined");return i}memo(t,e={}){let i=this.#a;if(!i)throw Error("no memoMethod provided to constructor");let{context:s,forceRefresh:r,...n}=e,a=this.get(t,n);if(!r&&void 0!==a)return a;let o=i(t,a,{options:n,context:s});return this.set(t,o,n),o}get(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:n}=e,a=this.#d.get(t);if(void 0!==a){let e=this.#c[a],o=this.#O(e);return n&&this.#W(n,a),this.#T(a)?(n&&(n.get="stale"),o?(n&&i&&void 0!==e.__staleWhileFetching&&(n.returnedStale=!0),i?e.__staleWhileFetching:void 0):(r||this.#P(t,"expire"),n&&i&&(n.returnedStale=!0),i?e:void 0)):(n&&(n.get="hit"),o?e.__staleWhileFetching:(this.#R(a),s&&this.#N(a),e))}n&&(n.get="miss")}#G(t,e){this.#p[e]=t,this.#f[t]=e}#R(t){t!==this.#g&&(t===this.#m?this.#m=this.#f[t]:this.#G(this.#p[t],this.#f[t]),this.#G(this.#g,t),this.#g=t)}delete(t){return this.#P(t,"delete")}#P(t,e){let i=!1;if(0!==this.#h){let s=this.#d.get(t);if(void 0!==s)if(this.#k?.[s]&&(clearTimeout(this.#k?.[s]),this.#k[s]=void 0),i=!0,1===this.#h)this.#q(e);else{this.#L(s);let i=this.#c[s];if(this.#O(i)?i.__abortController.abort(Error("deleted")):(this.#$||this.#x)&&(this.#$&&this.#i?.(i,t,e),this.#x&&this.#y?.push([i,t,e])),this.#d.delete(t),this.#u[s]=void 0,this.#c[s]=void 0,s===this.#g)this.#g=this.#p[s];else if(s===this.#m)this.#m=this.#f[s];else{let t=this.#p[s];this.#f[t]=this.#f[s];let e=this.#f[s];this.#p[e]=this.#p[s]}this.#h--,this.#w.push(s)}}if(this.#x&&this.#y?.length){let t=this.#y,e;for(;e=t?.shift();)this.#r?.(...e)}return i}clear(){return this.#q("delete")}#q(t){for(let e of this.#F({allowStale:!0})){let i=this.#c[e];if(this.#O(i))i.__abortController.abort(Error("deleted"));else{let s=this.#u[e];this.#$&&this.#i?.(i,s,t),this.#x&&this.#y?.push([i,s,t])}}if(this.#d.clear(),this.#c.fill(void 0),this.#u.fill(void 0),this.#S&&this.#v){for(let t of(this.#S.fill(0),this.#v.fill(0),this.#k??[]))void 0!==t&&clearTimeout(t);this.#k?.fill(void 0)}if(this.#b&&this.#b.fill(0),this.#m=0,this.#g=0,this.#w.length=0,this.#l=0,this.#h=0,this.#x&&this.#y){let t=this.#y,e;for(;e=t?.shift();)this.#r?.(...e)}}},tA="object"==typeof process&&process?process:{stdout:null,stderr:null},tR=t=>!!t&&"object"==typeof t&&(t instanceof es||t instanceof l.default||tj(t)||tF(t)),tj=t=>!!t&&"object"==typeof t&&t instanceof h.EventEmitter&&"function"==typeof t.pipe&&t.pipe!==l.default.Writable.prototype.pipe,tF=t=>!!t&&"object"==typeof t&&t instanceof h.EventEmitter&&"function"==typeof t.write&&"function"==typeof t.end,tT=Symbol("EOF"),t_=Symbol("maybeEmitEnd"),tD=Symbol("emittedEnd"),tM=Symbol("emittingEnd"),tP=Symbol("emittedError"),tN=Symbol("closed"),tW=Symbol("read"),tL=Symbol("flush"),tz=Symbol("flushChunk"),tI=Symbol("encoding"),tU=Symbol("decoder"),tB=Symbol("flowing"),tG=Symbol("paused"),tq=Symbol("resume"),tY=Symbol("buffer"),tH=Symbol("pipes"),tJ=Symbol("bufferLength"),tK=Symbol("bufferPush"),tV=Symbol("bufferShift"),tX=Symbol("objectMode"),tZ=Symbol("destroyed"),tQ=Symbol("error"),t0=Symbol("emitData"),t1=Symbol("emitEnd"),t2=Symbol("emitEnd2"),t8=Symbol("async"),t3=Symbol("abort"),t4=Symbol("aborted"),t6=Symbol("signal"),t5=Symbol("dataListeners"),t7=Symbol("discarded"),t9=t=>Promise.resolve().then(t),et=t=>t(),ee=class{src;dest;opts;ondrain;constructor(t,e,i){this.src=t,this.dest=e,this.opts=i,this.ondrain=()=>t[tq](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ei=class extends ee{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,i){super(t,e,i),this.proxyErrors=t=>this.dest.emit("error",t),t.on("error",this.proxyErrors)}},es=class extends h.EventEmitter{[tB]=!1;[tG]=!1;[tH]=[];[tY]=[];[tX];[tI];[t8];[tU];[tT]=!1;[tD]=!1;[tM]=!1;[tN]=!1;[tP]=null;[tJ]=0;[tZ]=!1;[t6];[t4]=!1;[t5]=0;[t7]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&"string"==typeof e.encoding)throw TypeError("Encoding and objectMode may not be used together");(t=>!!t.objectMode)(e)?(this[tX]=!0,this[tI]=null):(t=>!t.objectMode&&!!t.encoding&&"buffer"!==t.encoding)(e)?(this[tI]=e.encoding,this[tX]=!1):(this[tX]=!1,this[tI]=null),this[t8]=!!e.async,this[tU]=this[tI]?new d.StringDecoder(this[tI]):null,e&&!0===e.debugExposeBuffer&&Object.defineProperty(this,"buffer",{get:()=>this[tY]}),e&&!0===e.debugExposePipes&&Object.defineProperty(this,"pipes",{get:()=>this[tH]});let{signal:i}=e;i&&(this[t6]=i,i.aborted?this[t3]():i.addEventListener("abort",()=>this[t3]()))}get bufferLength(){return this[tJ]}get encoding(){return this[tI]}set encoding(t){throw Error("Encoding must be set at instantiation time")}setEncoding(t){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[tX]}set objectMode(t){throw Error("objectMode must be set at instantiation time")}get async(){return this[t8]}set async(t){this[t8]=this[t8]||!!t}[t3](){this[t4]=!0,this.emit("abort",this[t6]?.reason),this.destroy(this[t6]?.reason)}get aborted(){return this[t4]}set aborted(t){}write(t,e,i){if(this[t4])return!1;if(this[tT])throw Error("write after end");if(this[tZ])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;"function"==typeof e&&(i=e,e="utf8"),e||(e="utf8");let s=this[t8]?t9:et;if(!this[tX]&&!Buffer.isBuffer(t)){let e;if(e=t,!Buffer.isBuffer(e)&&ArrayBuffer.isView(e))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else{let e;if((e=t)instanceof ArrayBuffer||e&&"object"==typeof e&&e.constructor&&"ArrayBuffer"===e.constructor.name&&e.byteLength>=0)t=Buffer.from(t);else if("string"!=typeof t)throw Error("Non-contiguous data written to non-objectMode stream")}}return this[tX]?(this[tB]&&0!==this[tJ]&&this[tL](!0),this[tB]?this.emit("data",t):this[tK](t)):t.length&&("string"==typeof t&&(e!==this[tI]||this[tU]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[tI]&&(t=this[tU].write(t)),this[tB]&&0!==this[tJ]&&this[tL](!0),this[tB]?this.emit("data",t):this[tK](t)),0!==this[tJ]&&this.emit("readable"),i&&s(i),this[tB]}read(t){if(this[tZ])return null;if(this[t7]=!1,0===this[tJ]||0===t||t&&t>this[tJ])return this[t_](),null;this[tX]&&(t=null),this[tY].length>1&&!this[tX]&&(this[tY]=[this[tI]?this[tY].join(""):Buffer.concat(this[tY],this[tJ])]);let e=this[tW](t||null,this[tY][0]);return this[t_](),e}[tW](t,e){if(this[tX])this[tV]();else{let i=e;t===i.length||null===t?this[tV]():("string"==typeof i?(this[tY][0]=i.slice(t),e=i.slice(0,t)):(this[tY][0]=i.subarray(t),e=i.subarray(0,t)),this[tJ]-=t)}return this.emit("data",e),this[tY].length||this[tT]||this.emit("drain"),e}end(t,e,i){return"function"==typeof t&&(i=t,t=void 0),"function"==typeof e&&(i=e,e="utf8"),void 0!==t&&this.write(t,e),i&&this.once("end",i),this[tT]=!0,this.writable=!1,(this[tB]||!this[tG])&&this[t_](),this}[tq](){this[tZ]||(this[t5]||this[tH].length||(this[t7]=!0),this[tG]=!1,this[tB]=!0,this.emit("resume"),this[tY].length?this[tL]():this[tT]?this[t_]():this.emit("drain"))}resume(){return this[tq]()}pause(){this[tB]=!1,this[tG]=!0,this[t7]=!1}get destroyed(){return this[tZ]}get flowing(){return this[tB]}get paused(){return this[tG]}[tK](t){this[tX]?this[tJ]+=1:this[tJ]+=t.length,this[tY].push(t)}[tV](){return this[tX]?this[tJ]-=1:this[tJ]-=this[tY][0].length,this[tY].shift()}[tL](t=!1){do;while(this[tz](this[tV]())&&this[tY].length)t||this[tY].length||this[tT]||this.emit("drain")}[tz](t){return this.emit("data",t),this[tB]}pipe(t,e){if(this[tZ])return t;this[t7]=!1;let i=this[tD];return e=e||{},t===tA.stdout||t===tA.stderr?e.end=!1:e.end=!1!==e.end,e.proxyErrors=!!e.proxyErrors,i?e.end&&t.end():(this[tH].push(e.proxyErrors?new ei(this,t,e):new ee(this,t,e)),this[t8]?t9(()=>this[tq]()):this[tq]()),t}unpipe(t){let e=this[tH].find(e=>e.dest===t);e&&(1===this[tH].length?(this[tB]&&0===this[t5]&&(this[tB]=!1),this[tH]=[]):this[tH].splice(this[tH].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let i=super.on(t,e);if("data"===t)this[t7]=!1,this[t5]++,this[tH].length||this[tB]||this[tq]();else if("readable"===t&&0!==this[tJ])super.emit("readable");else("end"===t||"finish"===t||"prefinish"===t)&&this[tD]?(super.emit(t),this.removeAllListeners(t)):"error"===t&&this[tP]&&(this[t8]?t9(()=>e.call(this,this[tP])):e.call(this,this[tP]));return i}removeListener(t,e){return this.off(t,e)}off(t,e){let i=super.off(t,e);return"data"===t&&(this[t5]=this.listeners("data").length,0!==this[t5]||this[t7]||this[tH].length||(this[tB]=!1)),i}removeAllListeners(t){let e=super.removeAllListeners(t);return("data"===t||void 0===t)&&(this[t5]=0,this[t7]||this[tH].length||(this[tB]=!1)),e}get emittedEnd(){return this[tD]}[t_](){this[tM]||this[tD]||this[tZ]||0!==this[tY].length||!this[tT]||(this[tM]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[tN]&&this.emit("close"),this[tM]=!1)}emit(t,...e){let i=e[0];if("error"!==t&&"close"!==t&&t!==tZ&&this[tZ])return!1;if("data"===t)return(!!this[tX]||!!i)&&(this[t8]?(t9(()=>this[t0](i)),!0):this[t0](i));if("end"===t)return this[t1]();if("close"===t){if(this[tN]=!0,!this[tD]&&!this[tZ])return!1;let t=super.emit("close");return this.removeAllListeners("close"),t}if("error"===t){this[tP]=i,super.emit(tQ,i);let t=(!this[t6]||!!this.listeners("error").length)&&super.emit("error",i);return this[t_](),t}if("resume"===t){let t=super.emit("resume");return this[t_](),t}if("finish"===t||"prefinish"===t){let e=super.emit(t);return this.removeAllListeners(t),e}let s=super.emit(t,...e);return this[t_](),s}[t0](t){for(let e of this[tH])!1===e.dest.write(t)&&this.pause();let e=!this[t7]&&super.emit("data",t);return this[t_](),e}[t1](){return!this[tD]&&(this[tD]=!0,this.readable=!1,this[t8]?(t9(()=>this[t2]()),!0):this[t2]())}[t2](){if(this[tU]){let t=this[tU].end();if(t){for(let e of this[tH])e.dest.write(t);this[t7]||super.emit("data",t)}}for(let t of this[tH])t.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[tX]||(t.dataLength=0);let e=this.promise();return this.on("data",e=>{t.push(e),this[tX]||(t.dataLength+=e.length)}),await e,t}async concat(){if(this[tX])throw Error("cannot concat in objectMode");let t=await this.collect();return this[tI]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(tZ,()=>e(Error("stream destroyed"))),this.on("error",t=>e(t)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[t7]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let i=this.read();if(null!==i)return Promise.resolve({done:!1,value:i});if(this[tT])return e();let s,r,n=t=>{this.off("data",a),this.off("end",o),this.off(tZ,h),e(),r(t)},a=t=>{this.off("error",n),this.off("end",o),this.off(tZ,h),this.pause(),s({value:t,done:!!this[tT]})},o=()=>{this.off("error",n),this.off("data",a),this.off(tZ,h),e(),s({done:!0,value:void 0})},h=()=>n(Error("stream destroyed"));return new Promise((t,e)=>{r=e,s=t,this.once(tZ,h),this.once("error",n),this.once("end",o),this.once("data",a)})},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[t7]=!1;let t=!1,e=()=>(this.pause(),this.off(tQ,e),this.off(tZ,e),this.off("end",e),t=!0,{done:!0,value:void 0}),i=()=>{if(t)return e();let i=this.read();return null===i?e():{done:!1,value:i}};return this.once("end",e),this.once(tQ,e),this.once(tZ,e),{next:i,throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){return this[tZ]||(this[tZ]=!0,this[t7]=!0,this[tY].length=0,this[tJ]=0,"function"!=typeof this.close||this[tN]||this.close()),t?this.emit("error",t):this.emit(tZ),this}static get isStream(){return tR}},er=n.realpathSync.native,en={lstatSync:n.lstatSync,readdir:n.readdir,readdirSync:n.readdirSync,readlinkSync:n.readlinkSync,realpathSync:er,promises:{lstat:o.lstat,readdir:o.readdir,readlink:o.readlink,realpath:o.realpath}},ea=t=>t&&t!==en&&t!==a?{...en,...t,promises:{...en.promises,...t.promises||{}}}:en,eo=/^\\\\\?\\([a-z]:)\\?$/i,eh=/[\\\/]/,el=t=>t.isFile()?8:t.isDirectory()?4:t.isSymbolicLink()?10:t.isCharacterDevice()?2:t.isBlockDevice()?6:t.isSocket()?12:+!!t.isFIFO(),ed=new tO({max:4096}),eu=t=>{let e=ed.get(t);if(e)return e;let i=t.normalize("NFKD");return ed.set(t,i),i},ec=new tO({max:4096}),ep=t=>{let e=ec.get(t);if(e)return e;let i=eu(t.toLowerCase());return ec.set(t,i),i},ef=class extends tO{constructor(){super({max:256})}},em=class extends tO{constructor(t=16384){super({maxSize:t,sizeCalculation:t=>t.length+1})}},eg=Symbol("PathScurry setAsCwd"),ew=class{name;root;roots;parent;nocase;isCWD=!1;#t;#e;get dev(){return this.#e}#i;get mode(){return this.#i}#s;get nlink(){return this.#s}#r;get uid(){return this.#r}#n;get gid(){return this.#n}#a;get rdev(){return this.#a}#o;get blksize(){return this.#o}#h;get ino(){return this.#h}#l;get size(){return this.#l}#d;get blocks(){return this.#d}#u;get atimeMs(){return this.#u}#c;get mtimeMs(){return this.#c}#f;get ctimeMs(){return this.#f}#p;get birthtimeMs(){return this.#p}#m;get atime(){return this.#m}#g;get mtime(){return this.#g}#w;get ctime(){return this.#w}#y;get birthtime(){return this.#y}#b;#v;#S;#k;#$;#E;#x;#C;#D;#N;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,e=0,i,s,r,n,a){this.name=t,this.#b=r?ep(t):eu(t),this.#x=1023&e,this.nocase=r,this.roots=s,this.root=i||this,this.#C=n,this.#S=a.fullpath,this.#$=a.relative,this.#E=a.relativePosix,this.parent=a.parent,this.parent?this.#t=this.parent.#t:this.#t=ea(a.fs)}depth(){return void 0!==this.#v?this.#v:this.parent?this.#v=this.parent.depth()+1:this.#v=0}childrenCache(){return this.#C}resolve(t){if(!t)return this;let e=this.getRootString(t),i=t.substring(e.length).split(this.splitSep);return e?this.getRoot(e).#W(i):this.#W(i)}#W(t){let e=this;for(let i of t)e=e.child(i);return e}children(){let t=this.#C.get(this);if(t)return t;let e=Object.assign([],{provisional:0});return this.#C.set(this,e),this.#x&=-17,e}child(t,e){if(""===t||"."===t)return this;if(".."===t)return this.parent||this;let i=this.children(),s=this.nocase?ep(t):eu(t);for(let t of i)if(t.#b===s)return t;let r=this.parent?this.sep:"",n=this.#S?this.#S+r+t:void 0,a=this.newChild(t,0,{...e,parent:this,fullpath:n});return this.canReaddir()||(a.#x|=128),i.push(a),a}relative(){if(this.isCWD)return"";if(void 0!==this.#$)return this.#$;let t=this.name,e=this.parent;if(!e)return this.#$=this.name;let i=e.relative();return i+(i&&e.parent?this.sep:"")+t}relativePosix(){if("/"===this.sep)return this.relative();if(this.isCWD)return"";if(void 0!==this.#E)return this.#E;let t=this.name,e=this.parent;if(!e)return this.#E=this.fullpathPosix();let i=e.relativePosix();return i+(i&&e.parent?"/":"")+t}fullpath(){if(void 0!==this.#S)return this.#S;let t=this.name,e=this.parent;if(!e)return this.#S=this.name;let i=e.fullpath()+(e.parent?this.sep:"")+t;return this.#S=i}fullpathPosix(){if(void 0!==this.#k)return this.#k;if("/"===this.sep)return this.#k=this.fullpath();if(!this.parent){let t=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(t)?this.#k=`//?/${t}`:this.#k=t}let t=this.parent,e=t.fullpathPosix(),i=e+(e&&t.parent?"/":"")+this.name;return this.#k=i}isUnknown(){return(15&this.#x)==0}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(15&this.#x)==8}isDirectory(){return(15&this.#x)==4}isCharacterDevice(){return(15&this.#x)==2}isBlockDevice(){return(15&this.#x)==6}isFIFO(){return(15&this.#x)==1}isSocket(){return(15&this.#x)==12}isSymbolicLink(){return(10&this.#x)==10}lstatCached(){return 32&this.#x?this:void 0}readlinkCached(){return this.#D}realpathCached(){return this.#N}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#D)return!0;if(!this.parent)return!1;let t=15&this.#x;return!(0!==t&&10!==t||256&this.#x||128&this.#x)}calledReaddir(){return!!(16&this.#x)}isENOENT(){return!!(128&this.#x)}isNamed(t){return this.nocase?this.#b===ep(t):this.#b===eu(t)}async readlink(){let t=this.#D;if(t)return t;if(this.canReadlink()&&this.parent)try{let t=await this.#t.promises.readlink(this.fullpath()),e=(await this.parent.realpath())?.resolve(t);if(e)return this.#D=e}catch(t){this.#F(t.code);return}}readlinkSync(){let t=this.#D;if(t)return t;if(this.canReadlink()&&this.parent)try{let t=this.#t.readlinkSync(this.fullpath()),e=this.parent.realpathSync()?.resolve(t);if(e)return this.#D=e}catch(t){this.#F(t.code);return}}#M(t){this.#x|=16;for(let e=t.provisional;e<t.length;e++){let i=t[e];i&&i.#T()}}#T(){128&this.#x||(this.#x=(128|this.#x)&-16,this.#_())}#_(){let t=this.children();for(let e of(t.provisional=0,t))e.#T()}#L(){this.#x|=512,this.#I()}#I(){if(64&this.#x)return;let t=this.#x;(15&t)==4&&(t&=-16),this.#x=64|t,this.#_()}#z(t=""){"ENOTDIR"===t||"EPERM"===t?this.#I():"ENOENT"===t?this.#T():this.children().provisional=0}#j(t=""){"ENOTDIR"===t?this.parent.#I():"ENOENT"===t&&this.#T()}#F(t=""){let e=this.#x;e|=256,"ENOENT"===t&&(e|=128),("EINVAL"===t||"UNKNOWN"===t)&&(e&=-16),this.#x=e,"ENOTDIR"===t&&this.parent&&this.parent.#I()}#B(t,e){return this.#A(t,e)||this.#U(t,e)}#U(t,e){let i=el(t),s=this.newChild(t.name,i,{parent:this}),r=15&s.#x;return 4!==r&&10!==r&&0!==r&&(s.#x|=64),e.unshift(s),e.provisional++,s}#A(t,e){for(let i=e.provisional;i<e.length;i++){let s=e[i];if((this.nocase?ep(t.name):eu(t.name))===s.#b)return this.#O(t,s,i,e)}}#O(t,e,i,s){let r=e.name;return e.#x=-16&e.#x|el(t),r!==t.name&&(e.name=t.name),i!==s.provisional&&(i===s.length-1?s.pop():s.splice(i,1),s.unshift(e)),s.provisional++,e}async lstat(){if((128&this.#x)==0)try{return this.#G(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#j(t.code)}}lstatSync(){if((128&this.#x)==0)try{return this.#G(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#j(t.code)}}#G(t){let{atime:e,atimeMs:i,birthtime:s,birthtimeMs:r,blksize:n,blocks:a,ctime:o,ctimeMs:h,dev:l,gid:d,ino:u,mode:c,mtime:p,mtimeMs:f,nlink:m,rdev:g,size:w,uid:y}=t;this.#m=e,this.#u=i,this.#y=s,this.#p=r,this.#o=n,this.#d=a,this.#w=o,this.#f=h,this.#e=l,this.#n=d,this.#h=u,this.#i=c,this.#g=p,this.#c=f,this.#s=m,this.#a=g,this.#l=w,this.#r=y;let b=el(t);this.#x=-16&this.#x|b|32,0!==b&&4!==b&&10!==b&&(this.#x|=64)}#R=[];#P=!1;#q(t){this.#P=!1;let e=this.#R.slice();this.#R.length=0,e.forEach(e=>e(null,t))}readdirCB(t,e=!1){if(!this.canReaddir())return void(e?t(null,[]):queueMicrotask(()=>t(null,[])));let i=this.children();if(this.calledReaddir()){let s=i.slice(0,i.provisional);e?t(null,s):queueMicrotask(()=>t(null,s));return}if(this.#R.push(t),this.#P)return;this.#P=!0;let s=this.fullpath();this.#t.readdir(s,{withFileTypes:!0},(t,e)=>{if(t)this.#z(t.code),i.provisional=0;else{for(let t of e)this.#B(t,i);this.#M(i)}this.#q(i.slice(0,i.provisional))})}#Y;async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();if(this.#Y)await this.#Y;else{let i=()=>{};this.#Y=new Promise(t=>i=t);try{for(let i of(await this.#t.promises.readdir(e,{withFileTypes:!0})))this.#B(i,t);this.#M(t)}catch(e){this.#z(e.code),t.provisional=0}this.#Y=void 0,i()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();try{for(let i of this.#t.readdirSync(e,{withFileTypes:!0}))this.#B(i,t);this.#M(t)}catch(e){this.#z(e.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(704&this.#x)return!1;let t=15&this.#x;return 0===t||4===t||10===t}shouldWalk(t,e){return(4&this.#x)==4&&!(704&this.#x)&&!t.has(this)&&(!e||e(this))}async realpath(){if(this.#N)return this.#N;if(!(896&this.#x))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#N=this.resolve(t)}catch{this.#L()}}realpathSync(){if(this.#N)return this.#N;if(!(896&this.#x))try{let t=this.#t.realpathSync(this.fullpath());return this.#N=this.resolve(t)}catch{this.#L()}}[eg](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let e=new Set([]),i=[],s=this;for(;s&&s.parent;)e.add(s),s.#$=i.join(this.sep),s.#E=i.join("/"),s=s.parent,i.push("..");for(s=t;s&&s.parent&&!e.has(s);)s.#$=void 0,s.#E=void 0,s=s.parent}},ey=class t extends ew{sep="\\";splitSep=eh;constructor(t,e=0,i,s,r,n,a){super(t,e,i,s,r,n,a)}newChild(e,i=0,s={}){return new t(e,i,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(t){return r.win32.parse(t).root}getRoot(t){if((t=t.toUpperCase().replace(/\//g,"\\").replace(eo,"$1\\"))===this.root.name)return this.root;for(let[e,i]of Object.entries(this.roots))if(this.sameRoot(t,e))return this.roots[t]=i;return this.roots[t]=new eS(t,this).root}sameRoot(t,e=this.root.name){return(t=t.toUpperCase().replace(/\//g,"\\").replace(eo,"$1\\"))===e}},eb=class t extends ew{splitSep="/";sep="/";constructor(t,e=0,i,s,r,n,a){super(t,e,i,s,r,n,a)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(e,i=0,s={}){return new t(e,i,this.root,this.roots,this.nocase,this.childrenCache(),s)}},ev=class{root;rootPath;roots;cwd;#t;#e;#i;nocase;#s;constructor(t=process.cwd(),e,i,{nocase:r,childrenCacheSize:n=16384,fs:a=en}={}){this.#s=ea(a),(t instanceof URL||t.startsWith("file://"))&&(t=(0,s.fileURLToPath)(t));let o=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(o),this.#t=new ef,this.#e=new ef,this.#i=new em(n);let h=o.substring(this.rootPath.length).split(i);if(1!==h.length||h[0]||h.pop(),void 0===r)throw TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=r,this.root=this.newRoot(this.#s),this.roots[this.rootPath]=this.root;let l=this.root,d=h.length-1,u=e.sep,c=this.rootPath,p=!1;for(let t of h){let e=d--;l=l.child(t,{relative:Array(e).fill("..").join(u),relativePosix:Array(e).fill("..").join("/"),fullpath:c+=(p?"":u)+t}),p=!0}this.cwd=l}depth(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#i}resolve(...t){let e="";for(let i=t.length-1;i>=0;i--){let s=t[i];if(!(!s||"."===s)&&(e=e?`${s}/${e}`:s,this.isAbsolute(s)))break}let i=this.#t.get(e);if(void 0!==i)return i;let s=this.cwd.resolve(e).fullpath();return this.#t.set(e,s),s}resolvePosix(...t){let e="";for(let i=t.length-1;i>=0;i--){let s=t[i];if(!(!s||"."===s)&&(e=e?`${s}/${e}`:s,this.isAbsolute(s)))break}let i=this.#e.get(e);if(void 0!==i)return i;let s=this.cwd.resolve(e).fullpathPosix();return this.#e.set(e,s),s}relative(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:!0}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd);let{withFileTypes:i}=e;if(!t.canReaddir())return[];{let e=await t.readdir();return i?e:e.map(t=>t.name)}}readdirSync(t=this.cwd,e={withFileTypes:!0}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd);let{withFileTypes:i=!0}=e;return t.canReaddir()?i?t.readdirSync():t.readdirSync().map(t=>t.name):[]}async lstat(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t.withFileTypes,t=this.cwd);let i=await t.readlink();return e?i:i?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t.withFileTypes,t=this.cwd);let i=t.readlinkSync();return e?i:i?.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t.withFileTypes,t=this.cwd);let i=await t.realpath();return e?i:i?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t.withFileTypes,t=this.cwd);let i=t.realpathSync();return e?i:i?.fullpath()}async walk(t=this.cwd,e={}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:r,walkFilter:n}=e,a=[];(!r||r(t))&&a.push(i?t:t.fullpath());let o=new Set,h=(t,e)=>{o.add(t),t.readdirCB((t,l)=>{if(t)return e(t);let d=l.length;if(!d)return e();let u=()=>{0==--d&&e()};for(let t of l)(!r||r(t))&&a.push(i?t:t.fullpath()),s&&t.isSymbolicLink()?t.realpath().then(t=>t?.isUnknown()?t.lstat():t).then(t=>t?.shouldWalk(o,n)?h(t,u):u()):t.shouldWalk(o,n)?h(t,u):u()},!0)},l=t;return new Promise((t,e)=>{h(l,i=>{if(i)return e(i);t(a)})})}walkSync(t=this.cwd,e={}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:r,walkFilter:n}=e,a=[];(!r||r(t))&&a.push(i?t:t.fullpath());let o=new Set([t]);for(let t of o)for(let e of t.readdirSync()){(!r||r(e))&&a.push(i?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!(s&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(o,n)&&o.add(t)}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd),this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:r,walkFilter:n}=e;(!r||r(t))&&(yield i?t:t.fullpath());let a=new Set([t]);for(let t of a)for(let e of t.readdirSync()){(!r||r(e))&&(yield i?e:e.fullpath());let t=e;if(e.isSymbolicLink()){if(!(s&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(a,n)&&a.add(t)}}stream(t=this.cwd,e={}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:r,walkFilter:n}=e,a=new es({objectMode:!0});(!r||r(t))&&a.write(i?t:t.fullpath());let o=new Set,h=[t],l=0,d=()=>{let t=!1;for(;!t;){let e=h.shift();if(!e){0===l&&a.end();return}l++,o.add(e);let u=(e,p,f=!1)=>{if(e)return a.emit("error",e);if(s&&!f){let t=[];for(let e of p)e.isSymbolicLink()&&t.push(e.realpath().then(t=>t?.isUnknown()?t.lstat():t));if(t.length)return void Promise.all(t).then(()=>u(null,p,!0))}for(let e of p)e&&(!r||r(e))&&(a.write(i?e:e.fullpath())||(t=!0));for(let t of(l--,p)){let e=t.realpathCached()||t;e.shouldWalk(o,n)&&h.push(e)}t&&!a.flowing?a.once("drain",d):c||d()},c=!0;e.readdirCB(u,!0),c=!1}};return d(),a}streamSync(t=this.cwd,e={}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof ew||(e=t,t=this.cwd);let{withFileTypes:i=!0,follow:s=!1,filter:r,walkFilter:n}=e,a=new es({objectMode:!0}),o=new Set;(!r||r(t))&&a.write(i?t:t.fullpath());let h=[t],l=0,d=()=>{let t=!1;for(;!t;){let e=h.shift();if(!e){0===l&&a.end();return}l++,o.add(e);let d=e.readdirSync();for(let e of d)(!r||r(e))&&(a.write(i?e:e.fullpath())||(t=!0));for(let t of(l--,d)){let e=t;if(t.isSymbolicLink()){if(!(s&&(e=t.realpathSync())))continue;e.isUnknown()&&e.lstatSync()}e.shouldWalk(o,n)&&h.push(e)}}t&&!a.flowing&&a.once("drain",d)};return d(),a}chdir(t=this.cwd){let e=this.cwd;this.cwd="string"==typeof t?this.cwd.resolve(t):t,this.cwd[eg](e)}},eS=class extends ev{sep="\\";constructor(t=process.cwd(),e={}){let{nocase:i=!0}=e;super(t,r.win32,"\\",{...e,nocase:i}),this.nocase=i;for(let t=this.cwd;t;t=t.parent)t.nocase=this.nocase}parseRootPath(t){return r.win32.parse(t).root.toUpperCase()}newRoot(t){return new ey(this.rootPath,4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},ek=class extends ev{sep="/";constructor(t=process.cwd(),e={}){let{nocase:i=!1}=e;super(t,r.posix,"/",{...e,nocase:i}),this.nocase=i}parseRootPath(t){return"/"}newRoot(t){return new eb(this.rootPath,4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},e$=class extends ek{constructor(t=process.cwd(),e={}){let{nocase:i=!0}=e;super(t,{...e,nocase:i})}},eE=Symbol.for("nodejs.util.inspect.custom"),ex=class t{#t;#e;#i;length;#s;#r;#n;#a;#o;#h;#l=!0;constructor(t,e,i,s){if(!(t=>t.length>=1)(t))throw TypeError("empty pattern list");if(!(t=>t.length>=1)(e))throw TypeError("empty glob list");if(e.length!==t.length)throw TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,i<0||i>=this.length)throw TypeError("index out of range");if(this.#t=t,this.#e=e,this.#i=i,this.#s=s,0===this.#i){if(this.isUNC()){let[t,e,i,s,...r]=this.#t,[n,a,o,h,...l]=this.#e;""===r[0]&&(r.shift(),l.shift());let d=[t,e,i,s,""].join("/"),u=[n,a,o,h,""].join("/");this.#t=[d,...r],this.#e=[u,...l],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[t,...e]=this.#t,[i,...s]=this.#e;""===e[0]&&(e.shift(),s.shift()),this.#t=[t+"/",...e],this.#e=[i+"/",...s],this.length=this.#t.length}}}[eE](){return"Pattern <"+this.#e.slice(this.#i).join("/")+">"}pattern(){return this.#t[this.#i]}isString(){return"string"==typeof this.#t[this.#i]}isGlobstar(){return this.#t[this.#i]===tc}isRegExp(){return this.#t[this.#i]instanceof RegExp}globString(){return this.#n=this.#n||(0===this.#i?this.isAbsolute()?this.#e[0]+this.#e.slice(1).join("/"):this.#e.join("/"):this.#e.slice(this.#i).join("/"))}hasMore(){return this.length>this.#i+1}rest(){return void 0!==this.#r?this.#r:this.hasMore()?(this.#r=new t(this.#t,this.#e,this.#i+1,this.#s),this.#r.#h=this.#h,this.#r.#o=this.#o,this.#r.#a=this.#a,this.#r):this.#r=null}isUNC(){let t=this.#t;return void 0!==this.#o?this.#o:this.#o="win32"===this.#s&&0===this.#i&&""===t[0]&&""===t[1]&&"string"==typeof t[2]&&!!t[2]&&"string"==typeof t[3]&&!!t[3]}isDrive(){let t=this.#t;return void 0!==this.#a?this.#a:this.#a="win32"===this.#s&&0===this.#i&&this.length>1&&"string"==typeof t[0]&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return void 0!==this.#h?this.#h:this.#h=""===t[0]&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return"string"==typeof t&&this.isAbsolute()&&0===this.#i?t:""}checkFollowGlobstar(){return!(0===this.#i||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return 0!==this.#i&&!!this.isGlobstar()&&!!this.#l&&(this.#l=!1,!0)}},eC="object"==typeof process&&process&&"string"==typeof process.platform?process.platform:"linux",eO=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:e,nocase:i,noext:s,noglobstar:r,platform:n=eC}){for(let a of(this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=n,this.mmopts={dot:!0,nobrace:e,nocase:i,noext:s,noglobstar:r,optimizationLevel:2,platform:n,nocomment:!0,nonegate:!0},t))this.add(a)}add(t){let e=new tg(t,this.mmopts);for(let t=0;t<e.set.length;t++){let i=e.set[t],s=e.globParts[t];if(!i||!s)throw Error("invalid pattern object");for(;"."===i[0]&&"."===s[0];)i.shift(),s.shift();let r=new ex(i,s,0,this.platform),n=new tg(r.globString(),this.mmopts),a="**"===s[s.length-1],o=r.isAbsolute();o?this.absolute.push(n):this.relative.push(n),a&&(o?this.absoluteChildren.push(n):this.relativeChildren.push(n))}}ignored(t){let e=t.fullpath(),i=`${e}/`,s=t.relative()||".",r=`${s}/`;for(let t of this.relative)if(t.match(s)||t.match(r))return!0;for(let t of this.absolute)if(t.match(e)||t.match(i))return!0;return!1}childrenIgnored(t){let e=t.fullpath()+"/",i=(t.relative()||".")+"/";for(let t of this.relativeChildren)if(t.match(i))return!0;for(let t of this.absoluteChildren)if(t.match(e))return!0;return!1}},eA=class t{store;constructor(t=new Map){this.store=t}copy(){return new t(new Map(this.store))}hasWalked(t,e){return this.store.get(t.fullpath())?.has(e.globString())}storeWalked(t,e){let i=t.fullpath(),s=this.store.get(i);s?s.add(e.globString()):this.store.set(i,new Set([e.globString()]))}},eR=class{store=new Map;add(t,e,i){let s=2*!!e|!!i,r=this.store.get(t);this.store.set(t,void 0===r?s:s&r)}entries(){return[...this.store.entries()].map(([t,e])=>[t,!!(2&e),!!(1&e)])}},ej=class{store=new Map;add(t,e){if(!t.canReaddir())return;let i=this.store.get(t);i?i.find(t=>t.globString()===e.globString())||i.push(e):this.store.set(t,[e])}get(t){let e=this.store.get(t);if(!e)throw Error("attempting to walk unknown path");return e}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},eF=class t{hasWalkedCache;matches=new eR;subwalks=new ej;patterns;follow;dot;opts;constructor(t,e){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=e?e.copy():new eA}processPatterns(t,e){for(let[i,s]of(this.patterns=e,e.map(e=>[t,e]))){this.hasWalkedCache.storeWalked(i,s);let t=s.root(),e=s.isAbsolute()&&!1!==this.opts.absolute;if(t){i=i.resolve("/"===t&&void 0!==this.opts.root?this.opts.root:t);let e=s.rest();if(e)s=e;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let r,n,a=!1;for(;"string"==typeof(r=s.pattern())&&(n=s.rest());)i=i.resolve(r),s=n,a=!0;if(r=s.pattern(),n=s.rest(),a){if(this.hasWalkedCache.hasWalked(i,s))continue;this.hasWalkedCache.storeWalked(i,s)}if("string"==typeof r){let t=".."===r||""===r||"."===r;this.matches.add(i.resolve(r),e,t);continue}if(r===tc){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let t=n?.pattern(),r=n?.rest();if(n&&(""!==t&&"."!==t||r)){if(".."===t){let t=i.parent||i;r?this.hasWalkedCache.hasWalked(t,r)||this.subwalks.add(t,r):this.matches.add(t,e,!0)}}else this.matches.add(i,e,""===t||"."===t)}else r instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new t(this.opts,this.hasWalkedCache)}filterEntries(t,e){let i=this.subwalks.get(t),s=this.child();for(let t of e)for(let e of i){let i=e.isAbsolute(),r=e.pattern(),n=e.rest();r===tc?s.testGlobstar(t,e,n,i):r instanceof RegExp?s.testRegExp(t,r,n,i):s.testString(t,r,n,i)}return s}testGlobstar(t,e,i,s){if((this.dot||!t.name.startsWith("."))&&(e.hasMore()||this.matches.add(t,s,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,e):t.isSymbolicLink()&&(i&&e.checkFollowGlobstar()?this.subwalks.add(t,i):e.markFollowGlobstar()&&this.subwalks.add(t,e)))),i){let e=i.pattern();if("string"==typeof e&&".."!==e&&""!==e&&"."!==e)this.testString(t,e,i.rest(),s);else if(".."===e){let e=t.parent||t;this.subwalks.add(e,i)}else e instanceof RegExp&&this.testRegExp(t,e,i.rest(),s)}}testRegExp(t,e,i,s){e.test(t.name)&&(i?this.subwalks.add(t,i):this.matches.add(t,s,!1))}testString(t,e,i,s){t.isNamed(e)&&(i?this.subwalks.add(t,i):this.matches.add(t,s,!1))}},eT=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#e;#i;signal;maxDepth;includeChildMatches;constructor(t,e,i){if(this.patterns=t,this.path=e,this.opts=i,this.#i=i.posix||"win32"!==i.platform?"/":"\\",this.includeChildMatches=!1!==i.includeChildMatches,(i.ignore||!this.includeChildMatches)&&(this.#e=((t,e)=>"string"==typeof t?new eO([t],e):Array.isArray(t)?new eO(t,e):t)(i.ignore??[],i),!this.includeChildMatches&&"function"!=typeof this.#e.add))throw Error("cannot ignore child matches, ignore lacks add() method.");this.maxDepth=i.maxDepth||1/0,i.signal&&(this.signal=i.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#s(t){return this.seen.has(t)||!!this.#e?.ignored?.(t)}#r(t){return!!this.#e?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){let t;if(!this.signal?.aborted)for(this.paused=!1;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.signal?.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,e){let i;if(e&&this.opts.nodir)return;if(this.opts.realpath){if(!(i=t.realpathCached()||await t.realpath()))return;t=i}let s=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let t=await s.realpath();t&&(t.isUnknown()||this.opts.stat)&&await t.lstat()}return this.matchCheckTest(s,e)}matchCheckTest(t,e){return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!e||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!t.realpathCached()?.isDirectory())&&!this.#s(t)?t:void 0}matchCheckSync(t,e){let i;if(e&&this.opts.nodir)return;if(this.opts.realpath){if(!(i=t.realpathCached()||t.realpathSync()))return;t=i}let s=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let t=s.realpathSync();t&&(t?.isUnknown()||this.opts.stat)&&t.lstatSync()}return this.matchCheckTest(s,e)}matchFinish(t,e){if(this.#s(t))return;if(!this.includeChildMatches&&this.#e?.add){let e=`${t.relativePosix()}/**`;this.#e.add(e)}let i=void 0===this.opts.absolute?e:this.opts.absolute;this.seen.add(t);let s=this.opts.mark&&t.isDirectory()?this.#i:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(i){let e=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(e+s)}else{let e=this.opts.posix?t.relativePosix():t.relative(),i=this.opts.dotRelative&&!e.startsWith(".."+this.#i)?"."+this.#i:"";this.matchEmit(e?i+e+s:"."+s)}}async match(t,e,i){let s=await this.matchCheck(t,i);s&&this.matchFinish(s,e)}matchSync(t,e,i){let s=this.matchCheckSync(t,i);s&&this.matchFinish(s,e)}walkCB(t,e,i){this.signal?.aborted&&i(),this.walkCB2(t,e,new eF(this.opts),i)}walkCB2(t,e,i,s){if(this.#r(t))return s();if(this.signal?.aborted&&s(),this.paused)return void this.onResume(()=>this.walkCB2(t,e,i,s));i.processPatterns(t,e);let r=1,n=()=>{0==--r&&s()};for(let[t,e,s]of i.matches.entries())this.#s(t)||(r++,this.match(t,e,s).then(()=>n()));for(let t of i.subwalkTargets()){if(this.maxDepth!==1/0&&t.depth()>=this.maxDepth)continue;r++;let e=t.readdirCached();t.calledReaddir()?this.walkCB3(t,e,i,n):t.readdirCB((e,s)=>this.walkCB3(t,s,i,n),!0)}n()}walkCB3(t,e,i,s){i=i.filterEntries(t,e);let r=1,n=()=>{0==--r&&s()};for(let[t,e,s]of i.matches.entries())this.#s(t)||(r++,this.match(t,e,s).then(()=>n()));for(let[t,e]of i.subwalks.entries())r++,this.walkCB2(t,e,i.child(),n);n()}walkCBSync(t,e,i){this.signal?.aborted&&i(),this.walkCB2Sync(t,e,new eF(this.opts),i)}walkCB2Sync(t,e,i,s){if(this.#r(t))return s();if(this.signal?.aborted&&s(),this.paused)return void this.onResume(()=>this.walkCB2Sync(t,e,i,s));i.processPatterns(t,e);let r=1,n=()=>{0==--r&&s()};for(let[t,e,s]of i.matches.entries())this.#s(t)||this.matchSync(t,e,s);for(let t of i.subwalkTargets()){if(this.maxDepth!==1/0&&t.depth()>=this.maxDepth)continue;r++;let e=t.readdirSync();this.walkCB3Sync(t,e,i,n)}n()}walkCB3Sync(t,e,i,s){i=i.filterEntries(t,e);let r=1,n=()=>{0==--r&&s()};for(let[t,e,s]of i.matches.entries())this.#s(t)||this.matchSync(t,e,s);for(let[t,e]of i.subwalks.entries())r++,this.walkCB2Sync(t,e,i.child(),n);n()}},e_=class extends eT{matches=new Set;constructor(t,e,i){super(t,e,i)}matchEmit(t){this.matches.add(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((t,e)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?e(this.signal.reason):t(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},eD=class extends eT{results;constructor(t,e,i){super(t,e,i),this.results=new es({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(t){this.results.write(t),this.results.flowing||this.pause()}stream(){let t=this.path;return t.isUnknown()?t.lstat().then(()=>{this.walkCB(t,this.patterns,()=>this.results.end())}):this.walkCB(t,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}},eM="object"==typeof process&&process&&"string"==typeof process.platform?process.platform:"linux",eP=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(t,e){if(!e)throw TypeError("glob options required");if(this.withFileTypes=!!e.withFileTypes,this.signal=e.signal,this.follow=!!e.follow,this.dot=!!e.dot,this.dotRelative=!!e.dotRelative,this.nodir=!!e.nodir,this.mark=!!e.mark,e.cwd?(e.cwd instanceof URL||e.cwd.startsWith("file://"))&&(e.cwd=(0,s.fileURLToPath)(e.cwd)):this.cwd="",this.cwd=e.cwd||"",this.root=e.root,this.magicalBraces=!!e.magicalBraces,this.nobrace=!!e.nobrace,this.noext=!!e.noext,this.realpath=!!e.realpath,this.absolute=e.absolute,this.includeChildMatches=!1!==e.includeChildMatches,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth="number"==typeof e.maxDepth?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&void 0!==this.absolute)throw Error("cannot set absolute and withFileTypes:true");if("string"==typeof t&&(t=[t]),this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||!1===e.allowWindowsEscape,this.windowsPathsNoEscape&&(t=t.map(t=>t.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw TypeError("base matching requires globstar");t=t.map(t=>t.includes("/")?t:`./**/${t}`)}if(this.pattern=t,this.platform=e.platform||eM,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,void 0!==e.nocase&&e.nocase!==e.scurry.nocase)throw Error("nocase option contradicts provided scurry option")}else{let t="win32"===e.platform?eS:"darwin"===e.platform?e$:(e.platform,ek);this.scurry=new t(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let i="darwin"===this.platform||"win32"===this.platform,r={braceExpandMax:1e4,...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:i,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},[n,a]=this.pattern.map(t=>new tg(t,r)).reduce((t,e)=>(t[0].push(...e.set),t[1].push(...e.globParts),t),[[],[]]);this.patterns=n.map((t,e)=>{let i=a[e];if(!i)throw Error("invalid pattern object");return new ex(t,i,0,this.platform)})}async walk(){return[...await new e_(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new e_(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new eD(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new eD(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};function eN(t,e={}){return new eP(t,e).streamSync()}function eW(t,e={}){return new eP(t,e).stream()}function eL(t,e={}){return new eP(t,e).walkSync()}async function ez(t,e={}){return new eP(t,e).walk()}function eI(t,e={}){return new eP(t,e).iterateSync()}function eU(t,e={}){return new eP(t,e).iterate()}var eB=Object.assign(eW,{sync:eN}),eG=Object.assign(eU,{sync:eI}),eq=Object.assign(eL,{stream:eN,iterate:eI}),eY=Object.assign(ez,{glob:ez,globSync:eL,sync:eq,globStream:eW,stream:eB,globStreamSync:eN,streamSync:eN,globIterate:eU,iterate:eG,globIterateSync:eI,iterateSync:eI,Glob:eP,hasMagic:(t,e={})=>{for(let i of(Array.isArray(t)||(t=[t]),t))if(new tg(i,e).hasMagic())return!0;return!1},escape:X,unescape:L});eY.glob=eY;let eH=/\b(shipped|done|released|complete[d]?)\b/i;function eJ(t){return t.replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[*_`]/g,"").replace(/\s+/g," ").trim()}function eK(t){return t.length>80?`${t.slice(0,79).trimEnd()}…`:t}function eV(t){return t.length&&t.every(t=>"done"===t)?"done":t.some(t=>"planned"!==t)?"in-progress":"planned"}let eX=t=>{let e=parseFloat(t);return Number.isFinite(e)?e:1/0},eZ=t=>"done"===t||"cancelled"===t,eQ=t=>!!t&&"object"==typeof t&&!Array.isArray(t),e0=t=>"string"==typeof t?t.trim():"";function e1(t,e,i="is not an existing roadmap item"){let s=e.find(e=>e.id===t.toUpperCase());return s?null!==s.parent?{error:`parent ${s.id} is an epic, not a horizon (max depth is 2)`}:{id:s.id}:{error:`parent "${t}" ${i}`}}let e2=(t,e,i)=>t.find(t=>(t.parent??"")===e&&t.title.trim().toLowerCase()===i.toLowerCase())?.id;function e8(t,e){if(!eQ(t))return["plan must be an object"];if("roadmap"===t.kind)return function(t,e){let i=[],s=t.horizons??[],r=t.epics??[];if(Array.isArray(s)||i.push("horizons must be an array"),Array.isArray(r)||i.push("epics must be an array"),i.length>0)return i;if(s.length+r.length===0)return["a roadmap plan needs at least one horizon or epic"];let n=new Set,a=new Set,o=(t,e,s)=>{let r=eQ(t)?e0(t.key):"";r?n.has(r)?i.push(`duplicate key "${r}"`):(n.add(r),s&&a.add(r)):i.push(`${e}: key is required`)};s.forEach((t,e)=>o(t,`horizon #${e+1}`,!0)),r.forEach((t,e)=>o(t,`epic #${e+1}`,!1));let h=new Map,l=(t,s,r)=>{let n=`${t}\0${s.toLowerCase()}`,a=e2(e.roadmap,t,s)??h.get(n);a?i.push(`${r}: "${s}" already exists ${t?`under ${t}`:"as a horizon"} (${a})`):h.set(n,r)};return s.forEach((t,e)=>{if(!eQ(t))return void i.push(`horizon #${e+1} must be an object`);let s=e0(t.key)||`horizon #${e+1}`,r=e0(t.title);r?l("",r,s):i.push(`${s}: title is required`),void 0!==t.body&&"string"!=typeof t.body&&i.push(`${s}: body must be a markdown string`)}),r.forEach((t,s)=>{if(!eQ(t))return void i.push(`epic #${s+1} must be an object`);let r=e0(t.key)||`epic #${s+1}`,o=e0(t.title);o||i.push(`${r}: title is required`),"string"!=typeof t.body&&i.push(`${r}: body must be a markdown string`),void 0===t.status||e3.includes(t.status)||i.push(`${r}: status must be one of ${e3.join(", ")} (got ${JSON.stringify(t.status)})`);let h=e0(t.parent),d="";if(h)if(a.has(h))d=h;else if(n.has(h))i.push(`${r}: parent "${h}" is an epic in this plan; an epic's parent must be a horizon`);else{let t=e1(h,e.roadmap,"is neither a horizon key in this plan nor an existing roadmap item");"id"in t?d=t.id:i.push(`${r}: ${t.error}`)}else i.push(`${r}: parent is required (an existing horizon id or a horizon key in this plan)`);o&&d&&l(d,o,r)}),i}(t,e);if("breakdown"!==t.kind)return[`plan.kind must be "breakdown" or "roadmap" (got ${JSON.stringify(t.kind)})`];let i=[],s=e0(t.epic).toUpperCase();if(void 0!==t.epic&&"string"!=typeof t.epic)i.push("epic must be a string (an epic id)");else if(s&&void 0!==t.newEpic)i.push("pass either epic (an existing epic) or newEpic, not both");else if(s){let r=e.roadmap.find(t=>t.id===s);r?r.parent||i.push(`${r.id} is a horizon, not an epic; pass an epic id`):i.push(`Epic ${JSON.stringify(t.epic)} not found`)}else if(void 0!==t.newEpic){let s=t.newEpic;if(eQ(s)){let t=e0(s.title),r=e0(s.parent);if(t||i.push("newEpic: title is required"),"string"!=typeof s.body&&i.push("newEpic: body must be a markdown string"),r){let s=e1(r,e.roadmap);if("error"in s)i.push(`newEpic: ${s.error}`);else if(t){let r=e2(e.roadmap,s.id,t);r&&i.push(`newEpic: "${t}" already exists under ${s.id} (${r})`)}}else i.push("newEpic: parent is required (an existing horizon id)")}else i.push("newEpic must be an object { title, parent, body }")}if(!Array.isArray(t.tasks)||0===t.tasks.length)return i.push("tasks must be a non-empty array"),i;let r=t.tasks,n=new Set(e.taskIds.map(t=>t.toUpperCase())),a=new Map;r.forEach((t,e)=>{let s=eQ(t)?e0(t.key):"";s?a.has(s)?i.push(`duplicate key "${s}"`):a.set(s,e):i.push(`task #${e+1}: key is required`)});let o=new Map;r.forEach((t,e)=>{var s;let r;if(!eQ(t))return void i.push(`task #${e+1} must be an object`);let h=e0(t.key)||`task #${e+1}`;if(e0(t.title)||i.push(`${h}: title is required`),"string"!=typeof t.body&&i.push(`${h}: body must be a markdown string`),void 0!==t.size&&"string"!=typeof t.size&&i.push(`${h}: size must be a string`),void 0===t.due||"string"==typeof t.due&&(r=(s=t.due).match(/^(\d{4})-(\d{2})-(\d{2})$/))&&new Date(Date.UTC(+r[1],r[2]-1,+r[3])).toISOString().slice(0,10)===s||i.push(`${h}: due must be a date YYYY-MM-DD (got ${JSON.stringify(t.due)})`),void 0===t.dependsOn)return;if(!Array.isArray(t.dependsOn))return void i.push(`${h}: dependsOn must be an array`);let l=[];for(let e of t.dependsOn){let t=e0(e);a.has(t)?l.push(t):n.has(t.toUpperCase())||i.push(`${h}: dependsOn "${String(e)}" is neither a key in this plan nor an existing task`)}e0(t.key)&&o.set(e0(t.key),l)});let h=new Map,l=new Set,d=(t,e)=>{if("done"!==h.get(t)){if("open"===h.get(t)){let s=[...e.slice(e.indexOf(t)),t];s.some(t=>l.has(t))||i.push(`dependency cycle: ${s.join(" → ")}`),s.forEach(t=>l.add(t));return}for(let i of(h.set(t,"open"),o.get(t)??[]))d(i,[...e,t]);h.set(t,"done")}};for(let t of o.keys())d(t,[]);for(let[t,e]of o)if(!l.has(t))for(let s of e)(a.get(s)??0)>(a.get(t)??0)&&i.push(`${t} depends on ${s}, which comes later; list ${s} first`);return i}let e3=["planned","in-progress","done"];function e4(t,e){if("roadmap"===t.kind)return function(t,e){let i=[],s=t.horizons??[],r=t.epics??[],n=new Set(s.map(t=>t.key)),a=new Set([...n,...r.map(t=>t.key)]),o=new Set(e);for(let t of o)a.has(t)||i.push(`unknown key "${t}"`);let h=s.filter(t=>o.has(t.key)),l=r.filter(t=>o.has(t.key));for(let t of(h.length+l.length===0&&i.push("nothing selected"),l)){let e=t.parent.trim();n.has(e)&&!o.has(e)&&i.push(`${t.key} is under ${e}, which you unchecked; check ${e} or uncheck ${t.key}`)}return{plan:{...t,horizons:h,epics:l},errors:i}}(t,e);let i=[],s=new Set(t.tasks.map(t=>t.key.trim())),r=new Set(e.map(t=>t.trim()));for(let t of r)s.has(t)||i.push(`unknown key "${t}"`);let n=t.tasks.filter(t=>r.has(t.key.trim()));for(let t of(0===n.length&&i.push("nothing selected"),n))for(let e of(t.dependsOn??[]).map(t=>t.trim()))s.has(e)&&!r.has(e)&&i.push(`${t.key.trim()} depends on ${e}, which you unchecked`);return{plan:{...t,tasks:n},errors:i}}t.s(["planTarget",0,function(t){return e0(t.epic)?e0(t.epic).toUpperCase():t.newEpic?`new epic "${e0(t.newEpic.title)}"`:"no epic"},"selectPlan",0,e4,"validatePlan",0,e8],975283);let e6=(t,e)=>`${t} ${e}${1===t?"":"s"}`;t.s(["SESSION_GAP_MS",0,18e5,"groupSessions",0,function(t,e={}){let i=e.gapMs??18e5,s=[...t].sort((t,e)=>t.timestamp.localeCompare(e.timestamp)),r=new Map,n=new Map;for(let t of s){let e=t.sessionId;if(!e){let s=Date.parse(t.timestamp),r=n.get(t.actor);(!r||"session_start"===t.type||s-r.lastAt>i)&&(r={id:`legacy_${t.id}`,lastAt:s},n.set(t.actor,r)),r.lastAt=s,e=r.id}let s=r.get(e);s?s.push(t):r.set(e,[t])}return[...r].map(([t,e])=>(function(t,e){let i=new Map,s=new Set,r=[],n=!1,a=0;for(let t of e){"task_updated"===t.type&&t.taskId&&t.taskStatus&&i.set(t.taskId,t.taskStatus);let e=function(t){switch(t.type){case"doc_created":return t.detail??t.title.replace(/^Created: /,"");case"doc_deleted":return t.title.replace(/^Deleted /,"");case"doc_renamed":return t.title.split(" → ")[1]??null;default:return null}}(t);e&&s.add(e),"decision_logged"===t.type&&r.push(t.title),"memory_updated"===t.type&&(n=!0),"roadmap_updated"===t.type&&a++}let o=[...i].map(([t,e])=>({id:t,lastStatus:e})),h=o.filter(t=>"done"===t.lastStatus).length,l=[o.length?`${e6(o.length,"task")} moved${h?` (${h} done)`:""}`:"",s.size?`${e6(s.size,"doc")} changed`:"",r.length?e6(r.length,"ADR"):"",a?e6(a,"roadmap edit"):"",n?"memory updated":""].filter(Boolean);return{id:t,actor:e[0].actor,start:e[0].timestamp,end:e[e.length-1].timestamp,eventCount:e.length,eventIds:e.map(t=>t.id),tasks:o,docs:[...s],decisions:r,memoryUpdated:n,headline:l.join(" · ")||e6(e.length,"event")}})(t,e)).sort((t,e)=>e.start.localeCompare(t.start))},"sessionDuration",0,function(t){let e=Math.round((Date.parse(t.end)-Date.parse(t.start))/6e4);return e<1?"<1m":e<60?`${e}m`:`${Math.floor(e/60)}h ${e%60}m`},"sessionsForTask",0,function(t,e){return t.filter(t=>t.tasks.some(t=>t.id===e))}],31451);let e5={todo:"📋","in-progress":"🔨",blocked:"🚫",done:"✅",cancelled:"❌"},e7={ready:"todo",planned:"todo","not started":"todo",wip:"in-progress",doing:"in-progress",active:"in-progress",start:"in-progress",started:"in-progress",complete:"done",completed:"done",finished:"done",finish:"done",block:"blocked",cancel:"cancelled",skip:"cancelled"};function e9(){return process.env.VIBEDOC_ROOT||process.cwd()}async function it(t){let s=t||i.default.dirname(e9()),r=[];try{for(let t of(await e.default.readdir(s,{withFileTypes:!0}))){if(!t.isDirectory())continue;let n=i.default.join(s,t.name),a=!1;for(let t of["CLAUDE.md","AGENTS.md","docs/architecture",".vibedoc"])try{await e.default.access(i.default.join(n,t)),a=!0;break}catch{}a&&r.push({id:t.name,name:t.name,root:n,hasVibedoc:!0})}}catch{}let n=e9(),a=i.default.basename(n),o=r.findIndex(t=>t.root===n);if(o>0){let[t]=r.splice(o,1);r.unshift(t)}else -1===o&&r.unshift({id:a,name:a,root:n,hasVibedoc:!0});return r}async function ie(t){return(await eY("**/*.md",{cwd:t,ignore:["node_modules/**",".git/**",".next/**"],nodir:!0})).sort().map(t=>{var e;return{path:t,section:(e=t).includes("/")?e.startsWith("memory/")?"memory":e.startsWith("plans/")?"plans":e.includes("01-overview")?"overview":e.includes("02-high-level")||e.includes("high-level-design")?"high-level-design":e.includes("03-services")||e.includes("/services/")?"services":e.includes("04-data")||e.includes("/data/")?"data":e.includes("05-infra")||e.includes("/infrastructure/")?"infrastructure":e.includes("06-security")||e.includes("/security/")?"security":e.includes("07-observ")||e.includes("/observability/")?"observability":e.includes("08-resil")||e.includes("/resilience/")?"resilience":e.includes("decisions/")||e.includes("ADR")?"decisions":"other":"root",name:i.default.basename(t,".md")}})}async function ii(t,s){for(let r of[i.default.join(s,t),i.default.join(s,`${t}.md`),i.default.join(s,"docs",t),i.default.join(s,"docs",`${t}.md`),i.default.join(s,"docs","architecture",t),i.default.join(s,"docs","architecture",`${t}.md`),i.default.join(s,"memory",t),i.default.join(s,"memory",`${t}.md`),i.default.join(s,"plans",t),i.default.join(s,"plans",`${t}.md`)])try{let t=await e.default.readFile(r,"utf8");return{path:i.default.relative(s,r),content:t}}catch{}for(let r of[`**/${t}.md`,`**/${t}*.md`,`**/*${t}*.md`]){let t=await eY(r,{cwd:s,ignore:["node_modules/**",".git/**",".next/**"],nodir:!0,nocase:!0});if(t.length>0){let r=await e.default.readFile(i.default.join(s,t[0]),"utf8");return{path:t[0],content:r}}}throw Error(`Doc not found: "${t}"`)}async function is(t,s,r){let n=i.default.resolve(r),a=i.default.resolve(r,t);if(!a.startsWith(n+i.default.sep)&&a!==n)throw Error("Path outside root");await e.default.mkdir(i.default.dirname(a),{recursive:!0}),await e.default.writeFile(a,s,"utf8")}async function ir(t,s,r,n=!1){let a=i.default.resolve(r),o=i.default.resolve(r,t);if(!o.startsWith(a+i.default.sep))throw Error("Path outside root");let h=await e.default.readFile(o,"utf8").catch(t=>{if("ENOENT"===t.code)return"";throw t}),l=function(t,e){let i=t;for(let[t,s]of e.entries()){if("string"!=typeof s?.old_string||"string"!=typeof s?.new_string)return{error:`Edit ${t+1}: old_string and new_string must be strings`};if(""===s.old_string){if(""!==i)return{error:`Edit ${t+1}: empty old_string is only allowed for a new, empty doc`};i=s.new_string;continue}let e=i.indexOf(s.old_string);if(-1===e)return{error:`Edit ${t+1}: old_string not found in the doc`};if(-1!==i.indexOf(s.old_string,e+1))return{error:`Edit ${t+1}: old_string matches more than once; include more surrounding text`};i=i.slice(0,e)+s.new_string+i.slice(e+s.old_string.length)}return{content:i}}(h,s);if("error"in l)throw Error(l.error);return n||(await e.default.mkdir(i.default.dirname(o),{recursive:!0}),await e.default.writeFile(o,l.content,"utf8")),{before:h,content:l.content}}async function ia(t,e){let i=[];for(let s of t)try{let{content:t}=await ii(s,e);i.push(`--- FILE: ${s} ---
4
4
 
5
5
  ${t.trim()}`)}catch{}return i.join("\n\n---\n\n")}async function io(t,s,r){let n=i.default.resolve(r),a=i.default.resolve(r,t);if(!a.startsWith(n+i.default.sep)&&a!==n)throw Error("Path outside root");try{await e.default.access(a);let i=Error(`File already exists: ${t}`);throw i.code="EEXIST",i}catch(t){if("ENOENT"!==t.code)throw t}await e.default.mkdir(i.default.dirname(a),{recursive:!0}),await e.default.writeFile(a,s,"utf8"),await i_(r,{type:"doc_created",actor:"human",title:`Created: ${t}`,detail:t});try{let{exists:t}=await iB(r);t&&await iG(r)}catch{}}async function ih(t,s){let r=await eY("**/*.md",{cwd:s,ignore:["node_modules/**",".git/**",".next/**"],nodir:!0}),n=t.toLowerCase(),a=[];for(let t of r)try{let r=(await e.default.readFile(i.default.join(s,t),"utf8")).split("\n").map((t,e)=>({line:e+1,text:t.trim().slice(0,120)})).filter(t=>t.text.toLowerCase().includes(n));r.length>0&&a.push({file:t,hits:r.slice(0,4),totalHits:r.length})}catch{}return a.sort((t,e)=>e.totalHits-t.totalHits).slice(0,20)}function il(t,e){let s,r=e.split("\n"),n=i.default.basename(t,".md"),a=(r.find(t=>t.startsWith("# "))||"").replace(/^#+\s*/,"").replace(/^T\d+\s*[:—–-]\s*/i,"").trim()||n,o={};for(let t of r.slice(0,i5(r))){let e=t.match(/\*\*([^*]+):\*\*\s*(.+)/);e&&(o[e[1].toLowerCase().trim()]=e[2].trim())}let h=e7[s=(o.status||"todo").replace(/[📋🔨✅🚫❌]/g,"").trim().toLowerCase().trim().replace(/[📋🔨✅🚫❌\s]+$/,"").trim()]||s,l=n.match(/^(T\d+)/i);return{id:l?l[1].toUpperCase():n.toUpperCase(),title:a,status:h,size:o.size||"",phase:o.phase||"",dependsOn:o["depends on"]||"",due:i3(o.due||""),file:t,raw:e}}async function id(t){let s=await eY("plans/tasks/T*.md",{cwd:t,nodir:!0});0===s.length&&(s=await eY("plans/T*.md",{cwd:t,nodir:!0}));let r=[];for(let n of s.sort())try{let s=await e.default.readFile(i.default.join(t,n),"utf8");r.push(il(n,s))}catch{}let n={todo:[],"in-progress":[],blocked:[],done:[],cancelled:[]};for(let t of r){let e=n[t.status]?t.status:"todo";n[e].push(t)}return{tasks:r,board:n}}async function iu(t,s){let r=t.toUpperCase().startsWith("T")?t.toUpperCase():`T${t}`;for(let t of[`plans/tasks/${r}*.md`,`plans/${r}*.md`]){let r=await eY(t,{cwd:s,nodir:!0});if(r.length>0){let t=await e.default.readFile(i.default.join(s,r[0]),"utf8");return il(r[0],t)}}throw Error(`Task not found: ${t}`)}async function ic(t,s,r,n="human"){let a=await iu(t,r),o=a.status,h=e5[s],l=a.raw,d=/(\*\*Status:\*\*\s*).+/;return l=d.test(l)?l.replace(d,`$1${h} ${iy(s)}`):l.replace(/^(#[^\n]+\n)/,`$1**Status:** ${h} ${iy(s)}
6
6
  `),await e.default.writeFile(i.default.join(r,a.file),l,"utf8"),await i_(r,{type:"task_updated",actor:n,title:`${a.id} moved to ${s}`,detail:a.title,taskId:a.id,taskStatus:s}),{task:{...a,status:s,raw:l},previousStatus:o}}let ip=Promise.resolve();function im(t){let e=ip.then(t,t);return ip=e.catch(()=>{}),e}async function ig(t,s){let{tasks:r}=await id(s),n=t.title.replace(/\s+/g," ").trim(),a=r.map(t=>parseInt(t.id.replace(/^T/i,""),10)).filter(t=>!isNaN(t)),o=a.length>0?Math.max(...a)+1:1,h=`T${String(o).padStart(3,"0")}`,l=n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40)||"task",d=`${h}-${l}.md`,u=i.default.join(s,"plans","tasks");await e.default.mkdir(u,{recursive:!0});let c=i.default.join(u,d),p=t.due?i3(t.due):null;if(t.due&&!p)throw new iJ(`due must be a date YYYY-MM-DD (got ${JSON.stringify(t.due)})`);let f=`# ${h}: ${n}
@@ -81,8 +81,8 @@ ${u.map(t=>`- ${t}`).join("\n")||"- (none noted)"}
81
81
  ${c}
82
82
  `;await e.default.mkdir(i.default.join(s,"memory"),{recursive:!0}),await e.default.writeFile(i.default.join(s,"memory","MEMORY.md"),g,"utf8"),await i_(s,{type:"memory_updated",actor:r,title:"Session memory updated",detail:c.slice(0,120)})}let ik=".vibedoc-activity.json",i$=".vibedoc-descriptions.json";async function iE(t){try{let s=await e.default.readFile(i.default.join(t,i$),"utf8");return JSON.parse(s)}catch{return{}}}async function ix(t,s){let r=i.default.join(t,i$);await e.default.mkdir(i.default.dirname(r),{recursive:!0}),await e.default.writeFile(r,JSON.stringify(s,null,2),"utf8")}async function iC(t,e,s){let r=i.default.normalize(e).replace(/\\/g,"/"),n=await iE(t);n[r]=s,await ix(t,n)}let iO=null;async function iA(){if(!iO){let{default:e}=await t.A(400829);iO=new e({apiKey:process.env.ANTHROPIC_API_KEY})}return iO}async function iR(t,s){let r=i.default.resolve(s),n=i.default.resolve(s,t);if(!n.startsWith(r+i.default.sep)&&n!==r)throw Error("Path outside root");let a=await iA(),o=await e.default.readFile(n,"utf8"),h=(await a.messages.create({model:"claude-haiku-4-5-20251001",max_tokens:100,messages:[{role:"user",content:`Write a single sentence (max 120 characters) describing what this file is about. Output ONLY the sentence, nothing else.
83
83
 
84
- ${o.slice(0,2e3)}`}]})).content.find(t=>"text"===t.type);if(!h)throw Error("No text block in Anthropic response");let l=h.text.trim().slice(0,120);return await iC(s,t,{description:l,source:"ai",updatedAt:new Date().toISOString()}),l}async function iT(t){let s=await ie(t),r=await iE(t);return Promise.all(s.map(async s=>{let n=r[s.path],a=n?.description??"",o=n?.source??"extracted",h=new Date().toISOString();try{h=(await e.default.stat(i.default.join(t,s.path))).mtime.toISOString()}catch{}let l=n?.updatedAt??h;if(!n)try{let r=await e.default.readFile(i.default.join(t,s.path),"utf8");a=function(t){let e=t.split("\n"),i="";for(let t of e){let e=t.match(/^#{1,3}\s+(.+)/);if(e&&!i){i=e[1].trim().slice(0,120);continue}let s=t.trim();if(s&&!s.startsWith("#")&&!s.startsWith("```")&&!s.startsWith("|")&&!s.startsWith("-")&&!s.startsWith("*")&&s.length>20)return s.slice(0,120)}return i}(r)}catch{}return{path:s.path,name:s.name,section:s.section,description:a,source:o,updatedAt:l,mtime:h}}))}let iF=globalThis,ij=iF.vibedocSessions??(iF.vibedocSessions=new Map);async function i_(t,s){let r,n,a=Date.now(),o={id:`evt_${a}_${Math.random().toString(36).slice(2,7)}`,timestamp:new Date(a).toISOString(),...s,sessionId:(r=`${t}\0${s.actor}`,(n=ij.get(r))&&"session_start"!==s.type&&!(a-n.lastAt>18e5)||(n={id:`ses_${a}_${Math.random().toString(36).slice(2,7)}`,lastAt:a},ij.set(r,n)),n.lastAt=a,n.id)},h=i.default.join(t,ik),l=[];try{let t=await e.default.readFile(h,"utf8");l=JSON.parse(t)}catch{}l.unshift(o),l.length>2e3&&(l=l.slice(0,2e3)),await e.default.writeFile(h,JSON.stringify(l,null,2),"utf8")}async function iD(t,s=50){try{let r=await e.default.readFile(i.default.join(t,ik),"utf8");return JSON.parse(r).slice(0,s)}catch{return[]}}async function iM(t,e="ai"){await i_(t,{type:"session_start",actor:e,title:"Session started",detail:"Agent connected"})}async function iP(t,s,r){let n,a=i.default.resolve(r),o=i.default.resolve(r,t);if(!o.startsWith(a+i.default.sep)&&o!==a)throw Error("Path outside root");try{n=await e.default.readFile(o,"utf8")}catch{throw Error(`Doc not found: ${t}`)}await e.default.writeFile(o,n.trimEnd()+"\n\n"+s,"utf8")}async function iN(t,s,r){let n=i.default.resolve(r),a=i.default.resolve(r,t),o=i.default.resolve(r,s);if(!a.startsWith(n+i.default.sep)&&a!==n||!o.startsWith(n+i.default.sep)&&o!==n)throw Error("Path outside root");await e.default.mkdir(i.default.dirname(o),{recursive:!0});try{await e.default.rename(a,o)}catch(t){if("EXDEV"===t.code)await e.default.copyFile(a,o),await e.default.unlink(a);else throw t}await i_(r,{type:"doc_renamed",actor:"human",title:`Renamed ${t} → ${s}`});try{let{exists:t}=await iB(r);t&&await iG(r)}catch{}}async function iW(t,s){let r=i.default.resolve(s),n=i.default.resolve(s,t);if(!n.startsWith(r+i.default.sep)&&n!==r)throw Error("Path outside root");await e.default.unlink(n),await i_(s,{type:"doc_deleted",actor:"human",title:`Deleted ${t}`});try{let{exists:t}=await iB(s);t&&await iG(s)}catch{}}let iL="docs/REGISTRY.md",iz="<!-- REGISTRY_ANNOTATIONS_START -->",iI="<!-- REGISTRY_ANNOTATIONS_END -->";function iU(t){let e=new Map,i=t.indexOf(iz),s=t.indexOf(iI);if(-1===i||-1===s)return e;for(let r of t.slice(i+iz.length,s).split("\n").filter(t=>t.startsWith("|")&&!t.includes("---")&&!t.includes("Path"))){let t=r.split("|").map(t=>t.trim()).filter(Boolean);t.length>=3&&e.set(t[0],{description:t[1],keywords:t[2]})}return e}async function iB(t){try{return{content:await e.default.readFile(i.default.join(t,iL),"utf8"),exists:!0}}catch{return{content:"*(No REGISTRY.md found — call vibedoc_rebuild_registry to generate it)*",exists:!1}}}async function iG(t,s="human"){let r=(await ie(t)).map(t=>t.path),n="";try{n=await e.default.readFile(i.default.join(t,iL),"utf8")}catch{}let a=iU(n),o=function(t){let e=new Map;for(let s of t){let t=i.default.dirname(s);e.has(t)||e.set(t,[]),e.get(t).push(i.default.basename(s))}let s=[],r=Array.from(e.keys()).sort(),n=new Set;return!function t(a,o){if(n.has(a))return;n.add(a);let h=" ".repeat(o);if("."!==a){let t=a.split("/");s.push(`${h}${t[t.length-1]}/`)}let l="."===a?0:o+1,d=" ".repeat(l);for(let t of(e.get(a)||[]).sort())s.push(`${d}${t}`);for(let e of r)e!==a&&i.default.dirname(e)===a&&t(e,l)}(".",0),s.join("\n")}(r),h=[];for(let t of r){let e=a.get(t);h.push(`| ${t} | ${e?.description??""} | ${e?.keywords??""} |`)}let l=new Date().toISOString(),d=["# Document Registry",`**Generated:** ${l} **Total:** ${r.length} files`,"","> Edit the Annotations table — it survives rebuilds.","> Run `vibedoc_rebuild_registry` after adding/removing docs.","","## File Tree","```",o,"```","","## Annotations","",iz,"| Path | Description | Keywords |","|------|-------------|----------|",...h,iI,""].join("\n");return await is(iL,d,t),await i_(t,{type:"registry_rebuilt",actor:s,title:"Document registry rebuilt",detail:`${r.length} files indexed`}),{path:iL,totalFiles:r.length}}async function iq(t,e,i,s){let{content:r,exists:n}=await iB(s);if(!n)throw Error("Registry not found — call vibedoc_rebuild_registry first");let a=iU(r);a.set(t,{description:e,keywords:i});let o=r.indexOf(iz),h=r.indexOf(iI);if(-1===o||-1===h)throw Error("Registry format invalid — rebuild first");let l=[iz,"| Path | Description | Keywords |","|------|-------------|----------|",...Array.from(a.entries()).map(([t,e])=>`| ${t} | ${e.description} | ${e.keywords} |`),iI].join("\n"),d=r.slice(0,o)+l+r.slice(h+iI.length);await is(iL,d,s)}async function iY(t,s){let r=await eY("**/*.md",{cwd:s,ignore:["node_modules/**",".git/**",".next/**"],nodir:!0}),n=t.replace(/\\/g,"/"),a=i.default.basename(n),o=[];for(let t of r)if(t.replace(/\\/g,"/")!==n)try{(await e.default.readFile(i.default.join(s,t),"utf8")).split("\n").forEach((e,i)=>{/\[.*\]\(.*\)/.test(e)&&(e.includes(a)||e.includes(n))&&o.push({file:t,line:i+1,text:e.trim().slice(0,120)})})}catch{}return o}async function iH(t){let[{tasks:e,board:s},r,n,a]=await Promise.all([id(t),ie(t),iv(t),iD(t,10)]);return{root:t,name:i.default.basename(t),tasks:{total:e.length,board:{todo:s.todo.length,"in-progress":s["in-progress"].length,blocked:s.blocked.length,done:s.done.length,cancelled:s.cancelled.length},active:s["in-progress"],blocked:s.blocked},docs:{total:r.length},memory:n,activity:a}}class iJ extends Error{status;constructor(t,e=400){super(t),this.status=e,this.name="RoadmapError"}}let iK=i.default.join("plans","roadmap"),iV=i.default.join(iK,"layout.json"),iX=["planned","in-progress","done"],iZ=/^\*\*([^*]+):\*\*/;function iQ(t){let e=String(t??"").trim().toUpperCase();if(!/^R\d+$/.test(e))throw new iJ(`Invalid roadmap id: ${String(t)}`);return e}function i0(t){let e=i.default.basename(t).match(/^(R\d+)(?:-|\.md$)/i);return e?e[1].toUpperCase():null}function i1(t){let e=String(t??"").toLowerCase().trim().replace(/\s+/g,"-");if(!iX.includes(e))throw new iJ(`Invalid status "${String(t)}" (expected ${iX.join(" | ")})`);return e}function i2(t){if(!Array.isArray(t))throw new iJ("tasks must be an array of task ids");return t.map(t=>{let e=String(t).trim().toUpperCase();if(!/^T\d+$/.test(e))throw new iJ(`Invalid task id: ${String(t)}`);return e})}function i8(t){let e=String(t??"").replace(/\s+/g," ").trim();if(!e)throw new iJ("Title is required");return e}function i3(t){let e=t.match(/^(\d{4})-(\d{2})-(\d{2})$/);return e&&new Date(Date.UTC(+e[1],e[2]-1,+e[3])).toISOString().slice(0,10)===t?t:null}function i4(t){if(null===t||""===t)return null;let e="string"==typeof t?i3(t.trim()):null;if(!e)throw new iJ(`due must be a date YYYY-MM-DD (got ${JSON.stringify(t)})`);return e}function i6(t){let e=Number(t);if("number"!=typeof t||!Number.isFinite(e))throw new iJ("order must be a finite number");return e}function i5(t){let e=t.findIndex(t=>t.startsWith("# ")),i=e=e<0?0:e+1;for(;i<t.length&&""===t[i].trim();)i++;for(i<t.length&&iZ.test(t[i])&&(e=i);e<t.length&&iZ.test(t[e]);)e++;return e}function i7(t,e){let s=e.split("\n"),r=s.find(t=>t.startsWith("# ")),n=i0(t)??i.default.basename(t,".md").toUpperCase(),a=(r||"").replace(/^#+\s*/,"").replace(/^R\d+:\s*/i,"").trim()||n,o=i5(s),h={};for(let t of s.slice(0,Math.min(o,30))){let e=t.match(/\*\*([^*]+):\*\*\s*(.+)/);e&&(h[e[1].toLowerCase().trim()]=e[2].trim())}let l=(h.parent||"").toUpperCase(),d="planned";try{d=i1((h.status||"").replace(/[^a-z\s-]/gi,""))}catch{}let u=parseFloat(h.order||"");return{id:n,title:a,parent:/^R\d+$/.test(l)?l:null,status:d,order:Number.isFinite(u)?u:0,tasks:(h.tasks||"").split(/[,\s]+/).map(t=>t.toUpperCase()).filter(t=>/^T\d+$/.test(t)),due:i3(h.due||""),body:s.slice(o).join("\n").trim(),file:t}}async function i9(t){let s=await eY("plans/roadmap/R*.md",{cwd:t,nodir:!0}),r=[];for(let n of s)if(i0(n))try{let s=await e.default.readFile(i.default.join(t,n),"utf8");r.push({item:i7(n,s),raw:s})}catch{}return r}async function st(t,s){let r=iQ(t),n=(await eY(`plans/roadmap/${r}*.md`,{cwd:s,nodir:!0})).filter(t=>i0(t)===r).sort();if(0===n.length)throw new iJ(`Roadmap item not found: ${r}`,404);let a=await e.default.readFile(i.default.join(s,n[0]),"utf8");return{item:i7(n[0],a),raw:a}}function se(t,e,i){if(t===e)throw new iJ("An item cannot be its own parent");let s=i.find(e=>e.id===t);if(!s)throw new iJ(`Parent not found: ${t}`);if(null!==s.parent)throw new iJ(`Parent ${t} is not a horizon (max depth is 2)`)}function si(t){if("string"!=typeof t)throw new iJ("body must be a string");return t.trim()}let ss=Promise.resolve();function sr(t){let e=ss.then(t,t);return ss=e.catch(()=>{}),e}function sn(t){return t.length>0?t.join(", "):"—"}async function sa(t){var e;let i,[s,r]=await Promise.all([i9(t),sw(t)]);return{items:(e=s.map(t=>t.item),i=t=>parseInt(t.slice(1),10),e.sort((t,e)=>t.order-e.order||i(t.id)-i(e.id))),layout:r}}async function so(t,e){return(await st(t,e)).item}function sh(t,e,i="human"){return sr(()=>sp(t??{},e,i))}let sl=t=>`R${String(t).padStart(3,"0")}`;async function sd(t,s){let r=s.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40),n=r?`${s.id}-${r}.md`:`${s.id}.md`,a=[`# ${s.id}: ${s.title}`,...s.parent?[`**Parent:** ${s.parent}`]:[],`**Status:** ${s.status}`,`**Order:** ${s.order}`,`**Tasks:** ${sn(s.tasks)}`,...s.due?[`**Due:** ${s.due}`]:[],""].join("\n")+(s.body?`
84
+ ${o.slice(0,2e3)}`}]})).content.find(t=>"text"===t.type);if(!h)throw Error("No text block in Anthropic response");let l=h.text.trim().slice(0,120);return await iC(s,t,{description:l,source:"ai",updatedAt:new Date().toISOString()}),l}async function ij(t){let s=await ie(t),r=await iE(t);return Promise.all(s.map(async s=>{let n=r[s.path],a=n?.description??"",o=n?.source??"extracted",h=new Date().toISOString();try{h=(await e.default.stat(i.default.join(t,s.path))).mtime.toISOString()}catch{}let l=n?.updatedAt??h;if(!n)try{let r=await e.default.readFile(i.default.join(t,s.path),"utf8");a=function(t){let e=t.split("\n"),i="";for(let t of e){let e=t.match(/^#{1,3}\s+(.+)/);if(e&&!i){i=e[1].trim().slice(0,120);continue}let s=t.trim();if(s&&!s.startsWith("#")&&!s.startsWith("```")&&!s.startsWith("|")&&!s.startsWith("-")&&!s.startsWith("*")&&s.length>20)return s.slice(0,120)}return i}(r)}catch{}return{path:s.path,name:s.name,section:s.section,description:a,source:o,updatedAt:l,mtime:h}}))}let iF=globalThis,iT=iF.vibedocSessions??(iF.vibedocSessions=new Map);async function i_(t,s){let r,n,a=Date.now(),o={id:`evt_${a}_${Math.random().toString(36).slice(2,7)}`,timestamp:new Date(a).toISOString(),...s,sessionId:(r=`${t}\0${s.actor}`,(n=iT.get(r))&&"session_start"!==s.type&&!(a-n.lastAt>18e5)||(n={id:`ses_${a}_${Math.random().toString(36).slice(2,7)}`,lastAt:a},iT.set(r,n)),n.lastAt=a,n.id)},h=i.default.join(t,ik),l=[];try{let t=await e.default.readFile(h,"utf8");l=JSON.parse(t)}catch{}l.unshift(o),l.length>2e3&&(l=l.slice(0,2e3)),await e.default.writeFile(h,JSON.stringify(l,null,2),"utf8")}async function iD(t,s=50){try{let r=await e.default.readFile(i.default.join(t,ik),"utf8");return JSON.parse(r).slice(0,s)}catch{return[]}}async function iM(t,e="ai"){await i_(t,{type:"session_start",actor:e,title:"Session started",detail:"Agent connected"})}async function iP(t,s,r){let n,a=i.default.resolve(r),o=i.default.resolve(r,t);if(!o.startsWith(a+i.default.sep)&&o!==a)throw Error("Path outside root");try{n=await e.default.readFile(o,"utf8")}catch{throw Error(`Doc not found: ${t}`)}await e.default.writeFile(o,n.trimEnd()+"\n\n"+s,"utf8")}async function iN(t,s,r){let n=i.default.resolve(r),a=i.default.resolve(r,t),o=i.default.resolve(r,s);if(!a.startsWith(n+i.default.sep)&&a!==n||!o.startsWith(n+i.default.sep)&&o!==n)throw Error("Path outside root");await e.default.mkdir(i.default.dirname(o),{recursive:!0});try{await e.default.rename(a,o)}catch(t){if("EXDEV"===t.code)await e.default.copyFile(a,o),await e.default.unlink(a);else throw t}await i_(r,{type:"doc_renamed",actor:"human",title:`Renamed ${t} → ${s}`});try{let{exists:t}=await iB(r);t&&await iG(r)}catch{}}async function iW(t,s){let r=i.default.resolve(s),n=i.default.resolve(s,t);if(!n.startsWith(r+i.default.sep)&&n!==r)throw Error("Path outside root");await e.default.unlink(n),await i_(s,{type:"doc_deleted",actor:"human",title:`Deleted ${t}`});try{let{exists:t}=await iB(s);t&&await iG(s)}catch{}}let iL="docs/REGISTRY.md",iz="<!-- REGISTRY_ANNOTATIONS_START -->",iI="<!-- REGISTRY_ANNOTATIONS_END -->";function iU(t){let e=new Map,i=t.indexOf(iz),s=t.indexOf(iI);if(-1===i||-1===s)return e;for(let r of t.slice(i+iz.length,s).split("\n").filter(t=>t.startsWith("|")&&!t.includes("---")&&!t.includes("Path"))){let t=r.split("|").map(t=>t.trim()).filter(Boolean);t.length>=3&&e.set(t[0],{description:t[1],keywords:t[2]})}return e}async function iB(t){try{return{content:await e.default.readFile(i.default.join(t,iL),"utf8"),exists:!0}}catch{return{content:"*(No REGISTRY.md found — call vibedoc_rebuild_registry to generate it)*",exists:!1}}}async function iG(t,s="human"){let r=(await ie(t)).map(t=>t.path),n="";try{n=await e.default.readFile(i.default.join(t,iL),"utf8")}catch{}let a=iU(n),o=function(t){let e=new Map;for(let s of t){let t=i.default.dirname(s);e.has(t)||e.set(t,[]),e.get(t).push(i.default.basename(s))}let s=[],r=Array.from(e.keys()).sort(),n=new Set;return!function t(a,o){if(n.has(a))return;n.add(a);let h=" ".repeat(o);if("."!==a){let t=a.split("/");s.push(`${h}${t[t.length-1]}/`)}let l="."===a?0:o+1,d=" ".repeat(l);for(let t of(e.get(a)||[]).sort())s.push(`${d}${t}`);for(let e of r)e!==a&&i.default.dirname(e)===a&&t(e,l)}(".",0),s.join("\n")}(r),h=[];for(let t of r){let e=a.get(t);h.push(`| ${t} | ${e?.description??""} | ${e?.keywords??""} |`)}let l=new Date().toISOString(),d=["# Document Registry",`**Generated:** ${l} **Total:** ${r.length} files`,"","> Edit the Annotations table — it survives rebuilds.","> Run `vibedoc_rebuild_registry` after adding/removing docs.","","## File Tree","```",o,"```","","## Annotations","",iz,"| Path | Description | Keywords |","|------|-------------|----------|",...h,iI,""].join("\n");return await is(iL,d,t),await i_(t,{type:"registry_rebuilt",actor:s,title:"Document registry rebuilt",detail:`${r.length} files indexed`}),{path:iL,totalFiles:r.length}}async function iq(t,e,i,s){let{content:r,exists:n}=await iB(s);if(!n)throw Error("Registry not found — call vibedoc_rebuild_registry first");let a=iU(r);a.set(t,{description:e,keywords:i});let o=r.indexOf(iz),h=r.indexOf(iI);if(-1===o||-1===h)throw Error("Registry format invalid — rebuild first");let l=[iz,"| Path | Description | Keywords |","|------|-------------|----------|",...Array.from(a.entries()).map(([t,e])=>`| ${t} | ${e.description} | ${e.keywords} |`),iI].join("\n"),d=r.slice(0,o)+l+r.slice(h+iI.length);await is(iL,d,s)}async function iY(t,s){let r=await eY("**/*.md",{cwd:s,ignore:["node_modules/**",".git/**",".next/**"],nodir:!0}),n=t.replace(/\\/g,"/"),a=i.default.basename(n),o=[];for(let t of r)if(t.replace(/\\/g,"/")!==n)try{(await e.default.readFile(i.default.join(s,t),"utf8")).split("\n").forEach((e,i)=>{/\[.*\]\(.*\)/.test(e)&&(e.includes(a)||e.includes(n))&&o.push({file:t,line:i+1,text:e.trim().slice(0,120)})})}catch{}return o}async function iH(t){let[{tasks:e,board:s},r,n,a]=await Promise.all([id(t),ie(t),iv(t),iD(t,10)]);return{root:t,name:i.default.basename(t),tasks:{total:e.length,board:{todo:s.todo.length,"in-progress":s["in-progress"].length,blocked:s.blocked.length,done:s.done.length,cancelled:s.cancelled.length},active:s["in-progress"],blocked:s.blocked},docs:{total:r.length},memory:n,activity:a}}class iJ extends Error{status;constructor(t,e=400){super(t),this.status=e,this.name="RoadmapError"}}let iK=i.default.join("plans","roadmap"),iV=i.default.join(iK,"layout.json"),iX=["planned","in-progress","done"],iZ=/^\*\*([^*]+):\*\*/;function iQ(t){let e=String(t??"").trim().toUpperCase();if(!/^R\d+$/.test(e))throw new iJ(`Invalid roadmap id: ${String(t)}`);return e}function i0(t){let e=i.default.basename(t).match(/^(R\d+)(?:-|\.md$)/i);return e?e[1].toUpperCase():null}function i1(t){let e=String(t??"").toLowerCase().trim().replace(/\s+/g,"-");if(!iX.includes(e))throw new iJ(`Invalid status "${String(t)}" (expected ${iX.join(" | ")})`);return e}function i2(t){if(!Array.isArray(t))throw new iJ("tasks must be an array of task ids");return t.map(t=>{let e=String(t).trim().toUpperCase();if(!/^T\d+$/.test(e))throw new iJ(`Invalid task id: ${String(t)}`);return e})}function i8(t){let e=String(t??"").replace(/\s+/g," ").trim();if(!e)throw new iJ("Title is required");return e}function i3(t){let e=t.match(/^(\d{4})-(\d{2})-(\d{2})$/);return e&&new Date(Date.UTC(+e[1],e[2]-1,+e[3])).toISOString().slice(0,10)===t?t:null}function i4(t){if(null===t||""===t)return null;let e="string"==typeof t?i3(t.trim()):null;if(!e)throw new iJ(`due must be a date YYYY-MM-DD (got ${JSON.stringify(t)})`);return e}function i6(t){let e=Number(t);if("number"!=typeof t||!Number.isFinite(e))throw new iJ("order must be a finite number");return e}function i5(t){let e=t.findIndex(t=>t.startsWith("# ")),i=e=e<0?0:e+1;for(;i<t.length&&""===t[i].trim();)i++;for(i<t.length&&iZ.test(t[i])&&(e=i);e<t.length&&iZ.test(t[e]);)e++;return e}function i7(t,e){let s=e.split("\n"),r=s.find(t=>t.startsWith("# ")),n=i0(t)??i.default.basename(t,".md").toUpperCase(),a=(r||"").replace(/^#+\s*/,"").replace(/^R\d+:\s*/i,"").trim()||n,o=i5(s),h={};for(let t of s.slice(0,Math.min(o,30))){let e=t.match(/\*\*([^*]+):\*\*\s*(.+)/);e&&(h[e[1].toLowerCase().trim()]=e[2].trim())}let l=(h.parent||"").toUpperCase(),d="planned";try{d=i1((h.status||"").replace(/[^a-z\s-]/gi,""))}catch{}let u=parseFloat(h.order||"");return{id:n,title:a,parent:/^R\d+$/.test(l)?l:null,status:d,order:Number.isFinite(u)?u:0,tasks:(h.tasks||"").split(/[,\s]+/).map(t=>t.toUpperCase()).filter(t=>/^T\d+$/.test(t)),due:i3(h.due||""),body:s.slice(o).join("\n").trim(),file:t}}async function i9(t){let s=await eY("plans/roadmap/R*.md",{cwd:t,nodir:!0}),r=[];for(let n of s)if(i0(n))try{let s=await e.default.readFile(i.default.join(t,n),"utf8");r.push({item:i7(n,s),raw:s})}catch{}return r}async function st(t,s){let r=iQ(t),n=(await eY(`plans/roadmap/${r}*.md`,{cwd:s,nodir:!0})).filter(t=>i0(t)===r).sort();if(0===n.length)throw new iJ(`Roadmap item not found: ${r}`,404);let a=await e.default.readFile(i.default.join(s,n[0]),"utf8");return{item:i7(n[0],a),raw:a}}function se(t,e,i){if(t===e)throw new iJ("An item cannot be its own parent");let s=i.find(e=>e.id===t);if(!s)throw new iJ(`Parent not found: ${t}`);if(null!==s.parent)throw new iJ(`Parent ${t} is not a horizon (max depth is 2)`)}function si(t){if("string"!=typeof t)throw new iJ("body must be a string");return t.trim()}let ss=Promise.resolve();function sr(t){let e=ss.then(t,t);return ss=e.catch(()=>{}),e}function sn(t){return t.length>0?t.join(", "):"—"}async function sa(t){var e;let i,[s,r]=await Promise.all([i9(t),sw(t)]);return{items:(e=s.map(t=>t.item),i=t=>parseInt(t.slice(1),10),e.sort((t,e)=>t.order-e.order||i(t.id)-i(e.id))),layout:r}}async function so(t,e){return(await st(t,e)).item}function sh(t,e,i="human"){return sr(()=>sp(t??{},e,i))}let sl=t=>`R${String(t).padStart(3,"0")}`;async function sd(t,s){let r=s.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40),n=r?`${s.id}-${r}.md`:`${s.id}.md`,a=[`# ${s.id}: ${s.title}`,...s.parent?[`**Parent:** ${s.parent}`]:[],`**Status:** ${s.status}`,`**Order:** ${s.order}`,`**Tasks:** ${sn(s.tasks)}`,...s.due?[`**Due:** ${s.due}`]:[],""].join("\n")+(s.body?`
85
85
  ${s.body}
86
- `:"");await e.default.writeFile(i.default.join(t,iK,n),a,{flag:"wx",encoding:"utf8"})}async function su(t){return(await sc(t)).source}async function sc(t){let s;try{let s=function(t){let e=[],i=null,s=[],r=null,n=0,a=()=>{if(i&&n>0){i.body=s.join(" ").trim();let t=e.filter(t=>t.parent===i?.key).map(t=>t.status);"done"!==i.status&&(i.status=eV(t))}else i&&e.splice(e.indexOf(i),1);i=null,r=null,s=[],n=0};for(let o of t.split("\n")){let t=o.match(/^##\s+(.+?)\s*#*\s*$/);if(t){a();let s=eK(eJ(t[1]));i={key:`h${e.length}`,title:s,parent:null,status:eH.test(s)?"done":"planned",tasks:[],body:""},e.push(i);continue}if(!i)continue;if(/^#/.test(o)){a();continue}let h=o.match(/^[-*]\s+(?:\[([ xX])\]\s+)?(.*)$/);if(h){let t=h[2],s=t.match(/^\*\*(.+?)\*\*\s*(?:[—–:-]\s*)?(.*)$/),a=eK(eJ(s?s[1]:t));if(!a)continue;let o=h[1]?"x"===h[1].toLowerCase()?"done":"planned":"done"===i.status?"done":"planned";r={key:`f${e.length}`,title:a,parent:i.key,status:o,tasks:[],body:s?s[2].trim():""},e.push(r),n++;continue}let l=o.match(/^\s+(\S.*)$/);r&&l?r.body=[r.body,l[1].replace(/^[-*]\s+/,"- ")].filter(Boolean).join("\n"):!r&&o.trim()&&!/^-{3,}$/.test(o.trim())&&s.push(o.trim())}return a(),e}(await e.default.readFile(i.default.join(t,"ROADMAP.md"),"utf8"));if(s.length>0)return{source:"roadmap-md",drafts:s}}catch{}let{tasks:r}=await id(t),n=function(t){let e=new Map;for(let i of t){if("cancelled"===i.status)continue;let t=eJ(i.phase||"").replace(/^—$/,"")||"Unphased";e.set(t,[...e.get(t)??[],i])}let i=[...e.keys()].sort((t,e)=>eX(t)-eX(e)||t.localeCompare(e)),s=[];for(let t of i){let i=`h${s.length}`,r=(e.get(t)??[]).map(t=>({key:`f${t.id}`,title:eK(t.title),parent:i,status:"done"===t.status?"done":"in-progress"===t.status?"in-progress":"planned",tasks:[t.id],body:""}));s.push({key:i,title:eK(t),parent:null,status:eV(r.map(t=>t.status)),tasks:[],body:""},...r)}return s}(r);return n.length>0?{source:"tasks",drafts:n}:{source:"starter",drafts:[(s=(t,e,i,s)=>({key:t,title:e,parent:null,status:i,tasks:[],body:s}))("shipped","Shipped","done","What is already live."),s("now","Now","planned","What we are building right now."),s("next","Next","planned","Planned once the current work ships."),s("later","Later","planned","Ideas — not committed.")]}}async function sp(t,s,r){let n=i8(t.title),a=void 0===t.status?"planned":i1(t.status),o=void 0===t.tasks?[]:i2(t.tasks),h=void 0===t.body?"":si(t.body),l=void 0===t.due?null:i4(t.due),d=(await i9(s)).map(t=>t.item),u=null==t.parent||""===t.parent?null:iQ(t.parent);u&&se(u,null,d);let c=d.filter(t=>t.parent===u).map(t=>t.order),p=void 0===t.order?(c.length>0?Math.max(...c):0)+10:i6(t.order),f=d.map(t=>parseInt(t.id.slice(1),10)).filter(t=>!isNaN(t)),m=sl(f.length>0?Math.max(...f)+1:1);return await e.default.mkdir(i.default.join(s,iK),{recursive:!0}),await sd(s,{id:m,title:n,parent:u,status:a,order:p,tasks:o,due:l,body:h}),await i_(s,{type:"roadmap_updated",actor:r,title:`${m} created`,detail:n}),so(m,s)}function sf(t,e,i,s="human"){return sr(()=>sm(t,e,i,s))}async function sm(t,s,r,n){let a,{item:o,raw:h}=await st(t,r),l=s??{},d=void 0===l.title?void 0:i8(l.title),u=void 0===l.status?void 0:i1(l.status),c=void 0===l.order?void 0:i6(l.order),p=void 0===l.tasks?void 0:i2(l.tasks),f=void 0===l.body?void 0:si(l.body),m=void 0===l.due?void 0:i4(l.due);if(void 0!==l.parent&&null!==(a=null===l.parent||""===l.parent?null:iQ(l.parent))){let t=(await i9(r)).map(t=>t.item);if(se(a,o.id,t),t.some(t=>t.parent===o.id))throw new iJ(`${o.id} has children and cannot be given a parent`)}let g=h.split("\n");if(void 0!==d){let t=g.findIndex(t=>t.startsWith("# "));t>=0?g[t]=`# ${o.id}: ${d}`:g.unshift(`# ${o.id}: ${d}`)}let w=i5(g),y=g.slice(0,w),b=g.slice(w),v=(t,e)=>{let i=y.findIndex(e=>e.match(iZ)?.[1].trim().toLowerCase()===t.toLowerCase());if(null===e){i>=0&&y.splice(i,1);return}let s=`**${t}:** ${e}`;i>=0?y[i]=s:y.push(s)};void 0!==a&&v("Parent",a),void 0!==u&&v("Status",u),void 0!==c&&v("Order",String(c)),void 0!==p&&v("Tasks",sn(p)),void 0!==m&&v("Due",m),void 0!==f&&(b=f?["",f,""]:[""]),await e.default.writeFile(i.default.join(r,o.file),[...y,...b].join("\n"),"utf8");let S=await so(o.id,r);return await i_(r,{type:"roadmap_updated",actor:n,title:`${o.id} updated`,detail:S.title}),S}async function sg(t,s,r){let{item:n}=await st(t,s),a=(await i9(s)).map(t=>t.item).filter(t=>t.parent===n.id).map(t=>t.id);if(a.length>0)throw new iJ(`${n.id} still has children (${a.join(", ")}); move or delete them first`);await e.default.unlink(i.default.join(s,n.file)),await sy({},s),await i_(s,{type:"roadmap_updated",actor:r,title:`${n.id} deleted`,detail:n.title})}async function sw(t){try{let s=JSON.parse(await e.default.readFile(i.default.join(t,iV),"utf8"));if(!s||"object"!=typeof s||Array.isArray(s))return{};let r={};for(let[t,e]of Object.entries(s))e&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&(r[t]={x:e.x,y:e.y});return r}catch{return{}}}async function sy(t,s){let r={};for(let[e,i]of Object.entries(t??{})){let t=e.trim().toUpperCase();if(!(/^R\d+$/.test(t)&&i&&"object"==typeof i&&"number"==typeof i.x&&"number"==typeof i.y&&Number.isFinite(i.x)&&Number.isFinite(i.y)))throw new iJ(`Invalid position for ${e}`);r[t]={x:i.x,y:i.y}}let n={...await sw(s),...r},a=new Set((await i9(s)).map(t=>t.item.id)),o={};for(let t of Object.keys(n).sort())a.has(t)&&(o[t]=n[t]);return await e.default.mkdir(i.default.join(s,iK),{recursive:!0}),await e.default.writeFile(i.default.join(s,iV),JSON.stringify(o,null,2)+"\n","utf8"),o}let sb={roadmap:"roadmap-planner",breakdown:"epic-breakdown"};async function sv(t){if(!Object.hasOwn(sb,t))throw Error(`Unknown planning kind "${t}" (expected: ${Object.keys(sb).join(", ")})`);return(await e.default.readFile(i.default.join(process.cwd(),"skills",sb[t],"SKILL.md"),"utf-8")).replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/,"").trimStart()}t.s(["RoadmapError",0,iJ,"appendDoc",0,iP,"applyPlan",0,function(t,e,i,s="human"){return t?.kind==="roadmap"?sr(async()=>{let[r,{tasks:n}]=await Promise.all([i9(i),id(i)]),a=iw(t,e,r.map(t=>t.item),n.map(t=>t.id));if("roadmap"!==a.kind)throw new iJ("expected a roadmap plan");let o=new Map,h=[];for(let t of a.horizons){let e=await sp({title:t.title.trim(),body:t.body},i,s);o.set(t.key.trim(),e.id),h.push({key:t.key,id:e.id,file:e.file})}for(let t of a.epics){let e=o.get(t.parent.trim())??t.parent.trim().toUpperCase(),r=await sp({title:t.title.trim(),parent:e,status:t.status,body:t.body},i,s);h.push({key:t.key,id:r.id,file:r.file})}return{created:h,epic:null}}):im(async()=>{let[{items:r},{tasks:n}]=await Promise.all([sa(i),id(i)]),a=iw(t,e,r,n.map(t=>t.id));if("breakdown"!==a.kind)throw new iJ("expected a breakdown plan");let o=a.epic?.trim()?await so(a.epic,i):a.newEpic?await sh({title:a.newEpic.title.trim(),parent:a.newEpic.parent.trim().toUpperCase(),body:a.newEpic.body},i,s):null,h=new Map,l=[];for(let t of a.tasks){let e=(t.dependsOn??[]).map(t=>h.get(t.trim())??t.trim().toUpperCase()),s=await ig({title:t.title.trim(),phase:o?`${o.id} — ${o.title}`:void 0,size:t.size,dependsOn:e.join(", ")||void 0,due:t.due,body:t.body},i);h.set(t.key.trim(),s.id),l.push({key:t.key,id:s.id,file:s.file})}if(!o)return{created:l,epic:null};let d=await so(o.id,i),u=await sf(o.id,{tasks:[...d.tasks,...l.map(t=>t.id)]},i,s);return{created:l,epic:u}})},"claimNextTask",0,function(t,e){return im(async()=>{let i=await so(t,e);if(!i.parent)throw Error(`${i.id} is a horizon; pass an epic id`);let{tasks:s}=await id(e),r=function(t,e){let i=new Map(e.map(t=>[t.id,t])),s=t.tasks.map(t=>i.get(t)).filter(t=>!!t),r=t=>[...new Set((t.dependsOn.match(/\bT\d+\b/gi)??[]).map(t=>t.toUpperCase()))].filter(t=>{let e=i.get(t);return!e||!eZ(e.status)});for(let t of s)if("todo"===t.status&&!r(t).length)return{kind:"ready",taskId:t.id};if(s.every(t=>eZ(t.status)))return{kind:"finished"};let n=new Set(t.tasks),a=new Map,o=t=>{if(a.has(t))return a.get(t)??!1;a.set(t,!1);let e=i.get(t),s=!!e&&"blocked"!==e.status&&("todo"!==e.status||n.has(t)&&r(e).every(o));return a.set(t,s),s},h=[];for(let e of t.tasks){let t=i.get(e);if(t){if("in-progress"===t.status)h.push({taskId:e,reason:`${e} is in progress (claimed)`});else if("blocked"===t.status)h.push({taskId:e,reason:`${e} is blocked`});else if("todo"===t.status){let s=r(t).map(t=>`${t} (${i.get(t)?.status??"missing"})`);h.push({taskId:e,reason:`${e} waits on ${s.join(", ")}`})}}else h.push({taskId:e,reason:`${e} has no task file`})}return{kind:"waiting",waiting:h,needsHuman:h.every(t=>!o(t.taskId))}}(i,s);if("ready"!==r.kind)return{result:r};let{task:n,previousStatus:a}=await ic(r.taskId,"in-progress",e,"ai");return{result:r,task:n,previousStatus:a}})},"createDoc",0,io,"createRoadmapItem",0,sh,"createTask",0,function(t,e){return im(()=>ig(t,e))},"deleteDoc",0,iW,"deleteRoadmapItem",0,function(t,e,i="human"){return sr(()=>sg(t,e,i))},"detectRoadmapSource",0,su,"discoverProjects",0,it,"editDoc",0,ir,"enrichDescription",0,iR,"findBacklinks",0,iY,"generateRoadmap",0,function(t,s="human"){return sr(async()=>{if((await i9(t)).length>0)throw new iJ("Roadmap already exists");let{source:r,drafts:n}=await sc(t),a=new Map(n.map((t,e)=>[t.key,sl(e+1)])),o=new Map;for(let s of(await e.default.mkdir(i.default.join(t,iK),{recursive:!0}),n)){let e=(o.get(s.parent)??0)+1;o.set(s.parent,e),await sd(t,{id:a.get(s.key),title:s.title,parent:null===s.parent?null:a.get(s.parent)??null,status:s.status,order:10*e,tasks:s.tasks,due:null,body:s.body})}await i_(t,{type:"roadmap_updated",actor:s,title:`Roadmap generated (${n.length} items)`,detail:`from ${r}`});let{items:h}=await sa(t);return{items:h,source:r}})},"getConfiguredRoot",0,e9,"getContext",0,ia,"getProjectSummary",0,iH,"getTask",0,iu,"listDocs",0,ie,"listExplorerFiles",0,iT,"listRoadmap",0,sa,"listTasks",0,id,"logDecision",0,ib,"logSessionStart",0,iM,"readActivity",0,iD,"readDoc",0,ii,"readMemory",0,iv,"readPlanningSkill",0,sv,"readRegistry",0,iB,"rebuildRegistry",0,iG,"renameDoc",0,iN,"searchDocs",0,ih,"updateMemory",0,iS,"updateRegistryAnnotation",0,iq,"updateRoadmapItem",0,sf,"updateTaskStatus",0,ic,"writeDoc",0,is,"writeRoadmapLayout",0,function(t,e){return sr(()=>sy(t,e))}],799501)}];
86
+ `:"");await e.default.writeFile(i.default.join(t,iK,n),a,{flag:"wx",encoding:"utf8"})}async function su(t){return(await sc(t)).source}async function sc(t){let s;try{let s=function(t){let e=[],i=null,s=[],r=null,n=0,a=()=>{if(i&&n>0){i.body=s.join(" ").trim();let t=e.filter(t=>t.parent===i?.key).map(t=>t.status);"done"!==i.status&&(i.status=eV(t))}else i&&e.splice(e.indexOf(i),1);i=null,r=null,s=[],n=0};for(let o of t.split("\n")){let t=o.match(/^##\s+(.+?)\s*#*\s*$/);if(t){a();let s=eK(eJ(t[1]));i={key:`h${e.length}`,title:s,parent:null,status:eH.test(s)?"done":"planned",tasks:[],body:""},e.push(i);continue}if(!i)continue;if(/^#/.test(o)){a();continue}let h=o.match(/^[-*]\s+(?:\[([ xX])\]\s+)?(.*)$/);if(h){let t=h[2],s=t.match(/^\*\*(.+?)\*\*\s*(?:[—–:-]\s*)?(.*)$/),a=eK(eJ(s?s[1]:t));if(!a)continue;let o=h[1]?"x"===h[1].toLowerCase()?"done":"planned":"done"===i.status?"done":"planned";r={key:`f${e.length}`,title:a,parent:i.key,status:o,tasks:[],body:s?s[2].trim():""},e.push(r),n++;continue}let l=o.match(/^\s+(\S.*)$/);r&&l?r.body=[r.body,l[1].replace(/^[-*]\s+/,"- ")].filter(Boolean).join("\n"):!r&&o.trim()&&!/^-{3,}$/.test(o.trim())&&s.push(o.trim())}return a(),e}(await e.default.readFile(i.default.join(t,"ROADMAP.md"),"utf8"));if(s.length>0)return{source:"roadmap-md",drafts:s}}catch{}let{tasks:r}=await id(t),n=function(t){let e=new Map;for(let i of t){if("cancelled"===i.status)continue;let t=eJ(i.phase||"").replace(/^—$/,"")||"Unphased";e.set(t,[...e.get(t)??[],i])}let i=[...e.keys()].sort((t,e)=>eX(t)-eX(e)||t.localeCompare(e)),s=[];for(let t of i){let i=`h${s.length}`,r=(e.get(t)??[]).map(t=>({key:`f${t.id}`,title:eK(t.title),parent:i,status:"done"===t.status?"done":"in-progress"===t.status?"in-progress":"planned",tasks:[t.id],body:""}));s.push({key:i,title:eK(t),parent:null,status:eV(r.map(t=>t.status)),tasks:[],body:""},...r)}return s}(r);return n.length>0?{source:"tasks",drafts:n}:{source:"starter",drafts:[(s=(t,e,i,s)=>({key:t,title:e,parent:null,status:i,tasks:[],body:s}))("shipped","Shipped","done","What is already live."),s("now","Now","planned","What we are building right now."),s("next","Next","planned","Planned once the current work ships."),s("later","Later","planned","Ideas — not committed.")]}}async function sp(t,s,r){let n=i8(t.title),a=void 0===t.status?"planned":i1(t.status),o=void 0===t.tasks?[]:i2(t.tasks),h=void 0===t.body?"":si(t.body),l=void 0===t.due?null:i4(t.due),d=(await i9(s)).map(t=>t.item),u=null==t.parent||""===t.parent?null:iQ(t.parent);u&&se(u,null,d);let c=d.filter(t=>t.parent===u).map(t=>t.order),p=void 0===t.order?(c.length>0?Math.max(...c):0)+10:i6(t.order),f=d.map(t=>parseInt(t.id.slice(1),10)).filter(t=>!isNaN(t)),m=sl(f.length>0?Math.max(...f)+1:1);return await e.default.mkdir(i.default.join(s,iK),{recursive:!0}),await sd(s,{id:m,title:n,parent:u,status:a,order:p,tasks:o,due:l,body:h}),await i_(s,{type:"roadmap_updated",actor:r,title:`${m} created`,detail:n}),so(m,s)}function sf(t,e,i,s="human"){return sr(()=>sm(t,e,i,s))}async function sm(t,s,r,n){let a,{item:o,raw:h}=await st(t,r),l=s??{},d=void 0===l.title?void 0:i8(l.title),u=void 0===l.status?void 0:i1(l.status),c=void 0===l.order?void 0:i6(l.order),p=void 0===l.tasks?void 0:i2(l.tasks),f=void 0===l.body?void 0:si(l.body),m=void 0===l.due?void 0:i4(l.due);if(void 0!==l.parent&&null!==(a=null===l.parent||""===l.parent?null:iQ(l.parent))){let t=(await i9(r)).map(t=>t.item);if(se(a,o.id,t),t.some(t=>t.parent===o.id))throw new iJ(`${o.id} has children and cannot be given a parent`)}let g=h.split("\n");if(void 0!==d){let t=g.findIndex(t=>t.startsWith("# "));t>=0?g[t]=`# ${o.id}: ${d}`:g.unshift(`# ${o.id}: ${d}`)}let w=i5(g),y=g.slice(0,w),b=g.slice(w),v=(t,e)=>{let i=y.findIndex(e=>e.match(iZ)?.[1].trim().toLowerCase()===t.toLowerCase());if(null===e){i>=0&&y.splice(i,1);return}let s=`**${t}:** ${e}`;i>=0?y[i]=s:y.push(s)};void 0!==a&&v("Parent",a),void 0!==u&&v("Status",u),void 0!==c&&v("Order",String(c)),void 0!==p&&v("Tasks",sn(p)),void 0!==m&&v("Due",m),void 0!==f&&(b=f?["",f,""]:[""]),await e.default.writeFile(i.default.join(r,o.file),[...y,...b].join("\n"),"utf8");let S=await so(o.id,r);return await i_(r,{type:"roadmap_updated",actor:n,title:`${o.id} updated`,detail:S.title}),S}async function sg(t,s,r){let{item:n}=await st(t,s),a=(await i9(s)).map(t=>t.item).filter(t=>t.parent===n.id).map(t=>t.id);if(a.length>0)throw new iJ(`${n.id} still has children (${a.join(", ")}); move or delete them first`);await e.default.unlink(i.default.join(s,n.file)),await sy({},s),await i_(s,{type:"roadmap_updated",actor:r,title:`${n.id} deleted`,detail:n.title})}async function sw(t){try{let s=JSON.parse(await e.default.readFile(i.default.join(t,iV),"utf8"));if(!s||"object"!=typeof s||Array.isArray(s))return{};let r={};for(let[t,e]of Object.entries(s))e&&Number.isFinite(e.x)&&Number.isFinite(e.y)&&(r[t]={x:e.x,y:e.y});return r}catch{return{}}}async function sy(t,s){let r={};for(let[e,i]of Object.entries(t??{})){let t=e.trim().toUpperCase();if(!(/^R\d+$/.test(t)&&i&&"object"==typeof i&&"number"==typeof i.x&&"number"==typeof i.y&&Number.isFinite(i.x)&&Number.isFinite(i.y)))throw new iJ(`Invalid position for ${e}`);r[t]={x:i.x,y:i.y}}let n={...await sw(s),...r},a=new Set((await i9(s)).map(t=>t.item.id)),o={};for(let t of Object.keys(n).sort())a.has(t)&&(o[t]=n[t]);return await e.default.mkdir(i.default.join(s,iK),{recursive:!0}),await e.default.writeFile(i.default.join(s,iV),JSON.stringify(o,null,2)+"\n","utf8"),o}let sb={roadmap:"roadmap-planner",breakdown:"epic-breakdown"};async function sv(t){if(!Object.hasOwn(sb,t))throw Error(`Unknown planning kind "${t}" (expected: ${Object.keys(sb).join(", ")})`);return(await e.default.readFile(i.default.join(process.cwd(),"skills",sb[t],"SKILL.md"),"utf-8")).replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/,"").trimStart()}let sS=i.default.join(".vibedoc","chats"),sk=/^[a-z0-9-]{1,64}$/;function s$(t,e){if(!sk.test(t))throw Error(`Invalid chat id "${t}"`);return i.default.join(e,sS,`${t}.json`)}async function sE(t){let s=i.default.join(t,sS),r=await e.default.readdir(s).catch(()=>[]);return(await Promise.all(r.filter(t=>t.endsWith(".json")).map(async t=>{try{return JSON.parse(await e.default.readFile(i.default.join(s,t),"utf-8"))}catch(e){return console.warn(`[vibedoc] skipping unreadable chat ${t}: ${e.message}`),null}}))).filter(t=>null!==t)}async function sx(t,s){let r=t?.id;if("string"!=typeof r)throw Error("chat.id is required");let n=s$(r,s);await e.default.mkdir(i.default.dirname(n),{recursive:!0});let a=`${n}.tmp`;await e.default.writeFile(a,JSON.stringify(t),"utf-8"),await e.default.rename(a,n)}async function sC(t,i){await e.default.rm(s$(t,i),{force:!0})}t.s(["RoadmapError",0,iJ,"appendDoc",0,iP,"applyPlan",0,function(t,e,i,s="human"){return t?.kind==="roadmap"?sr(async()=>{let[r,{tasks:n}]=await Promise.all([i9(i),id(i)]),a=iw(t,e,r.map(t=>t.item),n.map(t=>t.id));if("roadmap"!==a.kind)throw new iJ("expected a roadmap plan");let o=new Map,h=[];for(let t of a.horizons){let e=await sp({title:t.title.trim(),body:t.body},i,s);o.set(t.key.trim(),e.id),h.push({key:t.key,id:e.id,file:e.file})}for(let t of a.epics){let e=o.get(t.parent.trim())??t.parent.trim().toUpperCase(),r=await sp({title:t.title.trim(),parent:e,status:t.status,body:t.body},i,s);h.push({key:t.key,id:r.id,file:r.file})}return{created:h,epic:null}}):im(async()=>{let[{items:r},{tasks:n}]=await Promise.all([sa(i),id(i)]),a=iw(t,e,r,n.map(t=>t.id));if("breakdown"!==a.kind)throw new iJ("expected a breakdown plan");let o=a.epic?.trim()?await so(a.epic,i):a.newEpic?await sh({title:a.newEpic.title.trim(),parent:a.newEpic.parent.trim().toUpperCase(),body:a.newEpic.body},i,s):null,h=new Map,l=[];for(let t of a.tasks){let e=(t.dependsOn??[]).map(t=>h.get(t.trim())??t.trim().toUpperCase()),s=await ig({title:t.title.trim(),phase:o?`${o.id} — ${o.title}`:void 0,size:t.size,dependsOn:e.join(", ")||void 0,due:t.due,body:t.body},i);h.set(t.key.trim(),s.id),l.push({key:t.key,id:s.id,file:s.file})}if(!o)return{created:l,epic:null};let d=await so(o.id,i),u=await sf(o.id,{tasks:[...d.tasks,...l.map(t=>t.id)]},i,s);return{created:l,epic:u}})},"claimNextTask",0,function(t,e){return im(async()=>{let i=await so(t,e);if(!i.parent)throw Error(`${i.id} is a horizon; pass an epic id`);let{tasks:s}=await id(e),r=function(t,e){let i=new Map(e.map(t=>[t.id,t])),s=t.tasks.map(t=>i.get(t)).filter(t=>!!t),r=t=>[...new Set((t.dependsOn.match(/\bT\d+\b/gi)??[]).map(t=>t.toUpperCase()))].filter(t=>{let e=i.get(t);return!e||!eZ(e.status)});for(let t of s)if("todo"===t.status&&!r(t).length)return{kind:"ready",taskId:t.id};if(s.every(t=>eZ(t.status)))return{kind:"finished"};let n=new Set(t.tasks),a=new Map,o=t=>{if(a.has(t))return a.get(t)??!1;a.set(t,!1);let e=i.get(t),s=!!e&&"blocked"!==e.status&&("todo"!==e.status||n.has(t)&&r(e).every(o));return a.set(t,s),s},h=[];for(let e of t.tasks){let t=i.get(e);if(t){if("in-progress"===t.status)h.push({taskId:e,reason:`${e} is in progress (claimed)`});else if("blocked"===t.status)h.push({taskId:e,reason:`${e} is blocked`});else if("todo"===t.status){let s=r(t).map(t=>`${t} (${i.get(t)?.status??"missing"})`);h.push({taskId:e,reason:`${e} waits on ${s.join(", ")}`})}}else h.push({taskId:e,reason:`${e} has no task file`})}return{kind:"waiting",waiting:h,needsHuman:h.every(t=>!o(t.taskId))}}(i,s);if("ready"!==r.kind)return{result:r};let{task:n,previousStatus:a}=await ic(r.taskId,"in-progress",e,"ai");return{result:r,task:n,previousStatus:a}})},"createDoc",0,io,"createRoadmapItem",0,sh,"createTask",0,function(t,e){return im(()=>ig(t,e))},"deleteChat",0,sC,"deleteDoc",0,iW,"deleteRoadmapItem",0,function(t,e,i="human"){return sr(()=>sg(t,e,i))},"detectRoadmapSource",0,su,"discoverProjects",0,it,"editDoc",0,ir,"enrichDescription",0,iR,"findBacklinks",0,iY,"generateRoadmap",0,function(t,s="human"){return sr(async()=>{if((await i9(t)).length>0)throw new iJ("Roadmap already exists");let{source:r,drafts:n}=await sc(t),a=new Map(n.map((t,e)=>[t.key,sl(e+1)])),o=new Map;for(let s of(await e.default.mkdir(i.default.join(t,iK),{recursive:!0}),n)){let e=(o.get(s.parent)??0)+1;o.set(s.parent,e),await sd(t,{id:a.get(s.key),title:s.title,parent:null===s.parent?null:a.get(s.parent)??null,status:s.status,order:10*e,tasks:s.tasks,due:null,body:s.body})}await i_(t,{type:"roadmap_updated",actor:s,title:`Roadmap generated (${n.length} items)`,detail:`from ${r}`});let{items:h}=await sa(t);return{items:h,source:r}})},"getConfiguredRoot",0,e9,"getContext",0,ia,"getProjectSummary",0,iH,"getTask",0,iu,"listChats",0,sE,"listDocs",0,ie,"listExplorerFiles",0,ij,"listRoadmap",0,sa,"listTasks",0,id,"logDecision",0,ib,"logSessionStart",0,iM,"readActivity",0,iD,"readDoc",0,ii,"readMemory",0,iv,"readPlanningSkill",0,sv,"readRegistry",0,iB,"rebuildRegistry",0,iG,"renameDoc",0,iN,"saveChat",0,sx,"searchDocs",0,ih,"updateMemory",0,iS,"updateRegistryAnnotation",0,iq,"updateRoadmapItem",0,sf,"updateTaskStatus",0,ic,"writeDoc",0,is,"writeRoadmapLayout",0,function(t,e){return sr(()=>sy(t,e))}],799501)}];
87
87
 
88
88
  //# sourceMappingURL=%5Broot-of-the-server%5D__1613hjb._.js.map