@upstart.gg/sdk 0.0.95 → 0.0.97

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 (527) hide show
  1. package/dist/node/cli/api.js +2 -2
  2. package/dist/node/cli/api.js.map +1 -1
  3. package/dist/node/cli/commands/login/cmd-login.js +6 -6
  4. package/dist/node/cli/commands/login/cmd-login.js.map +1 -1
  5. package/dist/node/cli/commands/logout/cmd-logout.js +2 -2
  6. package/dist/node/cli/commands/publish/cmd-publish.d.ts.map +1 -1
  7. package/dist/node/cli/commands/publish/cmd-publish.js +18 -18
  8. package/dist/node/cli/commands/publish/cmd-publish.js.map +1 -1
  9. package/dist/node/cli/commands/publish/uploader.js +7 -7
  10. package/dist/node/cli/commands/publish/uploader.js.map +1 -1
  11. package/dist/node/cli/is-logged-in.js +2 -2
  12. package/dist/node/cli/is-logged-in.js.map +1 -1
  13. package/dist/node/cli/program.js +24 -24
  14. package/dist/node/cli/program.js.map +1 -1
  15. package/dist/node/shared/config.d.ts +4 -14
  16. package/dist/node/shared/config.d.ts.map +1 -1
  17. package/dist/node/shared/config.js +4 -4
  18. package/dist/node/shared/config.js.map +1 -1
  19. package/dist/node/shared/logger.d.ts.map +1 -1
  20. package/dist/node/shared/logger.js +2 -2
  21. package/dist/node/shared/logger.js.map +1 -1
  22. package/dist/shared/ajv.d.ts +2 -0
  23. package/dist/shared/ajv.d.ts.map +1 -1
  24. package/dist/shared/ajv.js +1 -1
  25. package/dist/shared/attributes.d.ts +45 -83
  26. package/dist/shared/attributes.d.ts.map +1 -1
  27. package/dist/shared/attributes.js +1 -1
  28. package/dist/shared/brick-manifest.d.ts +7 -17
  29. package/dist/shared/brick-manifest.d.ts.map +1 -1
  30. package/dist/shared/brick-manifest.js +1 -1
  31. package/dist/shared/bricks/manifests/accordion.manifest.d.ts +111 -0
  32. package/dist/shared/bricks/manifests/accordion.manifest.d.ts.map +1 -0
  33. package/dist/shared/bricks/manifests/accordion.manifest.js +3 -0
  34. package/dist/shared/bricks/manifests/all-manifests.d.ts +5 -0
  35. package/dist/shared/bricks/manifests/all-manifests.d.ts.map +1 -1
  36. package/dist/shared/bricks/manifests/all-manifests.js +1 -1
  37. package/dist/shared/bricks/manifests/button.manifest.d.ts +22 -13
  38. package/dist/shared/bricks/manifests/button.manifest.d.ts.map +1 -1
  39. package/dist/shared/bricks/manifests/button.manifest.js +1 -1
  40. package/dist/shared/bricks/manifests/card.manifest.d.ts +44 -54
  41. package/dist/shared/bricks/manifests/card.manifest.d.ts.map +1 -1
  42. package/dist/shared/bricks/manifests/card.manifest.js +1 -1
  43. package/dist/shared/bricks/manifests/carousel.manifest.d.ts +39 -12
  44. package/dist/shared/bricks/manifests/carousel.manifest.d.ts.map +1 -1
  45. package/dist/shared/bricks/manifests/carousel.manifest.js +1 -1
  46. package/dist/shared/bricks/manifests/container.manifest.d.ts +49 -172
  47. package/dist/shared/bricks/manifests/container.manifest.d.ts.map +1 -1
  48. package/dist/shared/bricks/manifests/container.manifest.js +1 -1
  49. package/dist/shared/bricks/manifests/divider.manifest.d.ts +63 -0
  50. package/dist/shared/bricks/manifests/divider.manifest.d.ts.map +1 -0
  51. package/dist/shared/bricks/manifests/divider.manifest.js +3 -0
  52. package/dist/shared/bricks/manifests/footer.manifest.d.ts +30 -35
  53. package/dist/shared/bricks/manifests/footer.manifest.d.ts.map +1 -1
  54. package/dist/shared/bricks/manifests/footer.manifest.js +1 -1
  55. package/dist/shared/bricks/manifests/form.manifest.d.ts +22 -12
  56. package/dist/shared/bricks/manifests/form.manifest.d.ts.map +1 -1
  57. package/dist/shared/bricks/manifests/form.manifest.js +1 -1
  58. package/dist/shared/bricks/manifests/hero.manifest.d.ts +31 -71
  59. package/dist/shared/bricks/manifests/hero.manifest.d.ts.map +1 -1
  60. package/dist/shared/bricks/manifests/hero.manifest.js +1 -1
  61. package/dist/shared/bricks/manifests/icon.manifest.d.ts +18 -12
  62. package/dist/shared/bricks/manifests/icon.manifest.d.ts.map +1 -1
  63. package/dist/shared/bricks/manifests/icon.manifest.js +1 -1
  64. package/dist/shared/bricks/manifests/image.manifest.d.ts +36 -50
  65. package/dist/shared/bricks/manifests/image.manifest.d.ts.map +1 -1
  66. package/dist/shared/bricks/manifests/image.manifest.js +1 -1
  67. package/dist/shared/bricks/manifests/images-gallery.manifest.d.ts +55 -115
  68. package/dist/shared/bricks/manifests/images-gallery.manifest.d.ts.map +1 -1
  69. package/dist/shared/bricks/manifests/images-gallery.manifest.js +1 -1
  70. package/dist/shared/bricks/manifests/map.manifest.d.ts +36 -12
  71. package/dist/shared/bricks/manifests/map.manifest.d.ts.map +1 -1
  72. package/dist/shared/bricks/manifests/map.manifest.js +1 -1
  73. package/dist/shared/bricks/manifests/navbar.manifest.d.ts +160 -0
  74. package/dist/shared/bricks/manifests/navbar.manifest.d.ts.map +1 -0
  75. package/dist/shared/bricks/manifests/navbar.manifest.js +3 -0
  76. package/dist/shared/bricks/manifests/sidebar.manifest.d.ts +83 -12
  77. package/dist/shared/bricks/manifests/sidebar.manifest.d.ts.map +1 -1
  78. package/dist/shared/bricks/manifests/sidebar.manifest.js +1 -1
  79. package/dist/shared/bricks/manifests/social-links.manifest.d.ts +37 -12
  80. package/dist/shared/bricks/manifests/social-links.manifest.d.ts.map +1 -1
  81. package/dist/shared/bricks/manifests/social-links.manifest.js +1 -1
  82. package/dist/shared/bricks/manifests/testimonials.manifest.d.ts +94 -0
  83. package/dist/shared/bricks/manifests/testimonials.manifest.d.ts.map +1 -0
  84. package/dist/shared/bricks/manifests/testimonials.manifest.js +3 -0
  85. package/dist/shared/bricks/manifests/text.manifest.d.ts +31 -63
  86. package/dist/shared/bricks/manifests/text.manifest.d.ts.map +1 -1
  87. package/dist/shared/bricks/manifests/text.manifest.js +1 -1
  88. package/dist/shared/bricks/manifests/timeline.manifest.d.ts +122 -0
  89. package/dist/shared/bricks/manifests/timeline.manifest.d.ts.map +1 -0
  90. package/dist/shared/bricks/manifests/timeline.manifest.js +3 -0
  91. package/dist/shared/bricks/manifests/video.manifest.d.ts +38 -12
  92. package/dist/shared/bricks/manifests/video.manifest.d.ts.map +1 -1
  93. package/dist/shared/bricks/manifests/video.manifest.js +1 -1
  94. package/dist/shared/bricks/props/_style-presets.d.ts +1 -1
  95. package/dist/shared/bricks/props/_style-presets.d.ts.map +1 -1
  96. package/dist/shared/bricks/props/_style-presets.js +1 -1
  97. package/dist/shared/bricks/props/align.d.ts +7 -3
  98. package/dist/shared/bricks/props/align.d.ts.map +1 -1
  99. package/dist/shared/bricks/props/align.js +1 -1
  100. package/dist/shared/bricks/props/background.d.ts +8 -1
  101. package/dist/shared/bricks/props/background.d.ts.map +1 -1
  102. package/dist/shared/bricks/props/background.js +1 -1
  103. package/dist/shared/bricks/props/boolean.js +1 -1
  104. package/dist/shared/bricks/props/border.d.ts +24 -22
  105. package/dist/shared/bricks/props/border.d.ts.map +1 -1
  106. package/dist/shared/bricks/props/border.js +1 -1
  107. package/dist/shared/bricks/props/color.d.ts +5 -0
  108. package/dist/shared/bricks/props/color.d.ts.map +1 -0
  109. package/dist/shared/bricks/props/color.js +3 -0
  110. package/dist/shared/bricks/props/common.d.ts +9 -1
  111. package/dist/shared/bricks/props/common.d.ts.map +1 -1
  112. package/dist/shared/bricks/props/common.js +1 -1
  113. package/dist/shared/bricks/props/container.d.ts +37 -45
  114. package/dist/shared/bricks/props/container.d.ts.map +1 -1
  115. package/dist/shared/bricks/props/container.js +1 -1
  116. package/dist/shared/bricks/props/css-length.d.ts +5 -0
  117. package/dist/shared/bricks/props/css-length.d.ts.map +1 -0
  118. package/dist/shared/bricks/props/css-length.js +3 -0
  119. package/dist/shared/bricks/props/datasource.d.ts +9 -13
  120. package/dist/shared/bricks/props/datasource.d.ts.map +1 -1
  121. package/dist/shared/bricks/props/datasource.js +1 -1
  122. package/dist/shared/bricks/props/date.d.ts +4 -0
  123. package/dist/shared/bricks/props/date.d.ts.map +1 -0
  124. package/dist/shared/bricks/props/date.js +3 -0
  125. package/dist/shared/bricks/props/effects.d.ts +4 -21
  126. package/dist/shared/bricks/props/effects.d.ts.map +1 -1
  127. package/dist/shared/bricks/props/effects.js +1 -1
  128. package/dist/shared/bricks/props/enum.d.ts +13 -0
  129. package/dist/shared/bricks/props/enum.d.ts.map +1 -0
  130. package/dist/shared/bricks/props/enum.js +3 -0
  131. package/dist/shared/bricks/props/file.d.ts +2 -0
  132. package/dist/shared/bricks/props/file.d.ts.map +1 -0
  133. package/dist/shared/bricks/props/file.js +3 -0
  134. package/dist/shared/bricks/props/geolocation.d.ts +16 -0
  135. package/dist/shared/bricks/props/geolocation.d.ts.map +1 -0
  136. package/dist/shared/bricks/props/geolocation.js +3 -0
  137. package/dist/shared/bricks/props/helpers.d.ts +8 -4
  138. package/dist/shared/bricks/props/helpers.d.ts.map +1 -1
  139. package/dist/shared/bricks/props/helpers.js +1 -1
  140. package/dist/shared/bricks/props/image.d.ts +7 -1
  141. package/dist/shared/bricks/props/image.d.ts.map +1 -1
  142. package/dist/shared/bricks/props/image.js +1 -1
  143. package/dist/shared/bricks/props/number.js +1 -1
  144. package/dist/shared/bricks/props/padding.d.ts +2 -1
  145. package/dist/shared/bricks/props/padding.d.ts.map +1 -1
  146. package/dist/shared/bricks/props/padding.js +1 -1
  147. package/dist/shared/bricks/props/position.d.ts.map +1 -1
  148. package/dist/shared/bricks/props/position.js +1 -1
  149. package/dist/shared/bricks/props/preset.d.ts +92 -0
  150. package/dist/shared/bricks/props/preset.d.ts.map +1 -0
  151. package/dist/shared/bricks/props/preset.js +3 -0
  152. package/dist/shared/bricks/props/string.d.ts +8 -3
  153. package/dist/shared/bricks/props/string.d.ts.map +1 -1
  154. package/dist/shared/bricks/props/string.js +1 -1
  155. package/dist/shared/bricks/props/text.d.ts +3 -4
  156. package/dist/shared/bricks/props/text.d.ts.map +1 -1
  157. package/dist/shared/bricks/props/text.js +1 -1
  158. package/dist/shared/bricks/props/types.d.ts +5 -2
  159. package/dist/shared/bricks/props/types.d.ts.map +1 -1
  160. package/dist/shared/bricks.d.ts +243 -134
  161. package/dist/shared/bricks.d.ts.map +1 -1
  162. package/dist/shared/bricks.js +1 -1
  163. package/dist/shared/chunk-2AJYHJFG.js +8 -0
  164. package/dist/shared/chunk-2FHWS73Y.js +6 -0
  165. package/dist/shared/chunk-3FJVF357.js +3 -0
  166. package/dist/shared/chunk-3RHYJ6E7.js +5 -0
  167. package/dist/shared/chunk-3VZACK2Y.js +3 -0
  168. package/dist/shared/chunk-3XCKZ4JQ.js +3 -0
  169. package/dist/shared/chunk-4MPRHJWO.js +3 -0
  170. package/dist/shared/chunk-5EOWW7BX.js +4 -0
  171. package/dist/shared/chunk-5HYPCOSS.js +3 -0
  172. package/dist/shared/chunk-5K5C6XFX.js +3 -0
  173. package/dist/shared/chunk-6QS5PKLA.js +3 -0
  174. package/dist/shared/chunk-74EL657O.js +3 -0
  175. package/dist/shared/chunk-AJDYOLKP.js +3 -0
  176. package/dist/shared/chunk-ALFOZHAH.js +3 -0
  177. package/dist/shared/{chunk-FGU4BGP4.js → chunk-ATDJCXC2.js} +1 -1
  178. package/dist/shared/chunk-BJSO43AS.js +3 -0
  179. package/dist/shared/chunk-BTKLQQZA.js +3 -0
  180. package/dist/shared/chunk-CAVNF3BU.js +3 -0
  181. package/dist/shared/chunk-CCNU3J56.js +3 -0
  182. package/dist/shared/chunk-CTRS76PX.js +3 -0
  183. package/dist/shared/chunk-DCH2FI6T.js +8 -0
  184. package/dist/shared/chunk-DFSQR6QC.js +3 -0
  185. package/dist/shared/chunk-ENU4SEHO.js +3 -0
  186. package/dist/shared/chunk-G7LX3UKQ.js +3 -0
  187. package/dist/shared/chunk-GGJBTPGW.js +3 -0
  188. package/dist/shared/chunk-H24R3IWA.js +3 -0
  189. package/dist/shared/chunk-HYVQXAK5.js +3 -0
  190. package/dist/shared/chunk-LKVQQQTI.js +3 -0
  191. package/dist/shared/chunk-MITJPRGD.js +6 -0
  192. package/dist/shared/chunk-NLZBY65T.js +3 -0
  193. package/dist/shared/chunk-OUI2VDNM.js +3 -0
  194. package/dist/shared/chunk-OYIL5SCU.js +3 -0
  195. package/dist/shared/chunk-P5DZK4TS.js +3 -0
  196. package/dist/shared/chunk-PK3R5VOF.js +3 -0
  197. package/dist/shared/chunk-QPATZM3I.js +3 -0
  198. package/dist/shared/chunk-RDBEWW4G.js +7 -0
  199. package/dist/shared/chunk-RPBQZW5I.js +3 -0
  200. package/dist/shared/chunk-SLSIAUYV.js +3 -0
  201. package/dist/shared/chunk-SUG225LF.js +3 -0
  202. package/dist/shared/chunk-U5XOIYSS.js +3 -0
  203. package/dist/shared/{chunk-HIZPJNEM.js → chunk-UL7L3HYV.js} +1 -1
  204. package/dist/shared/chunk-V6BCYHZH.js +3 -0
  205. package/dist/shared/chunk-VA5LFJVE.js +3 -0
  206. package/dist/shared/chunk-VAC73HJE.js +3 -0
  207. package/dist/shared/chunk-VBWC36L2.js +3 -0
  208. package/dist/shared/chunk-VLGLD6GR.js +3 -0
  209. package/dist/shared/chunk-VTFWVTPI.js +3 -0
  210. package/dist/shared/chunk-WAAKB6OB.js +3 -0
  211. package/dist/shared/chunk-Y36SM2AO.js +3 -0
  212. package/dist/shared/chunk-Y7CEEEVW.js +3 -0
  213. package/dist/shared/chunk-YZ5Y4WE6.js +3 -0
  214. package/dist/shared/chunk-Z7SYP6FG.js +3 -0
  215. package/dist/shared/chunk-ZJNA4QQC.js +3 -0
  216. package/dist/shared/chunk-ZMDHKAWL.js +3 -0
  217. package/dist/shared/context.d.ts +38 -0
  218. package/dist/shared/context.d.ts.map +1 -0
  219. package/dist/shared/{chunk-WJ5CDDXW.js → context.js} +0 -1
  220. package/dist/shared/datarecords/types.d.ts +40 -20
  221. package/dist/shared/datarecords/types.d.ts.map +1 -1
  222. package/dist/shared/datarecords/types.js +1 -1
  223. package/dist/shared/datasources/external/http-json/fetcher.d.ts.map +1 -0
  224. package/dist/shared/datasources/external/http-json/options.d.ts.map +1 -0
  225. package/dist/shared/datasources/external/{json → http-json}/schema.d.ts +0 -1
  226. package/dist/shared/datasources/external/http-json/schema.d.ts.map +1 -0
  227. package/dist/shared/datasources/external/http-json/tests/fetcher.test.d.ts.map +1 -0
  228. package/dist/shared/datasources/external/rss/fetcher.d.ts.map +1 -1
  229. package/dist/shared/datasources/external/rss/sample.d.ts.map +1 -1
  230. package/dist/shared/datasources/external/rss/schema.d.ts +7 -13
  231. package/dist/shared/datasources/external/rss/schema.d.ts.map +1 -1
  232. package/dist/shared/datasources/external/youtube/list/sample.d.ts +23 -32
  233. package/dist/shared/datasources/external/youtube/list/sample.d.ts.map +1 -1
  234. package/dist/shared/datasources/external/youtube/list/schema.d.ts +24 -33
  235. package/dist/shared/datasources/external/youtube/list/schema.d.ts.map +1 -1
  236. package/dist/shared/datasources/internal/blog/schema.d.ts.map +1 -1
  237. package/dist/shared/datasources/internal/changelog/schema.d.ts.map +1 -1
  238. package/dist/shared/datasources/internal/recipes/schema.d.ts.map +1 -1
  239. package/dist/shared/datasources/samples.d.ts +1 -1
  240. package/dist/shared/datasources/samples.d.ts.map +1 -1
  241. package/dist/shared/datasources/schemas.d.ts +33 -583
  242. package/dist/shared/datasources/schemas.d.ts.map +1 -1
  243. package/dist/shared/datasources/schemas.js +1 -1
  244. package/dist/shared/datasources/types.d.ts +75 -1314
  245. package/dist/shared/datasources/types.d.ts.map +1 -1
  246. package/dist/shared/datasources/types.js +1 -1
  247. package/dist/shared/datasources.d.ts +14 -0
  248. package/dist/shared/datasources.d.ts.map +1 -1
  249. package/dist/shared/datasources.js +1 -1
  250. package/dist/shared/images.d.ts +30 -0
  251. package/dist/shared/images.d.ts.map +1 -0
  252. package/dist/shared/images.js +3 -0
  253. package/dist/shared/layout-constants.js +1 -1
  254. package/dist/shared/page.d.ts +110 -2676
  255. package/dist/shared/page.d.ts.map +1 -1
  256. package/dist/shared/page.js +1 -1
  257. package/dist/shared/prompt.d.ts +4 -0
  258. package/dist/shared/prompt.d.ts.map +1 -0
  259. package/dist/shared/prompt.js +3 -0
  260. package/dist/shared/responsive.d.ts +3 -3
  261. package/dist/shared/responsive.d.ts.map +1 -1
  262. package/dist/shared/responsive.js +1 -1
  263. package/dist/shared/site.d.ts +545 -0
  264. package/dist/shared/site.d.ts.map +1 -0
  265. package/dist/shared/site.js +3 -0
  266. package/dist/shared/sitemap.d.ts +38 -0
  267. package/dist/shared/sitemap.d.ts.map +1 -0
  268. package/dist/shared/sitemap.js +3 -0
  269. package/dist/shared/theme.d.ts +41 -19
  270. package/dist/shared/theme.d.ts.map +1 -1
  271. package/dist/shared/theme.js +1 -1
  272. package/dist/shared/themes/color-system.d.ts +5 -309
  273. package/dist/shared/themes/color-system.d.ts.map +1 -1
  274. package/dist/shared/themes/color-system.js +1 -1
  275. package/dist/shared/utils/invariant.js +1 -1
  276. package/dist/shared/utils/schema.d.ts +10 -1
  277. package/dist/shared/utils/schema.d.ts.map +1 -1
  278. package/dist/shared/utils/schema.js +1 -1
  279. package/dist/shared/utils/typed-ref.d.ts +32 -0
  280. package/dist/shared/utils/typed-ref.d.ts.map +1 -0
  281. package/dist/shared/utils/typed-ref.js +3 -0
  282. package/package.json +12 -12
  283. package/src/node/cli/api.ts +101 -0
  284. package/src/node/cli/commands/cmd-build.ts +64 -0
  285. package/src/node/cli/commands/login/cmd-login.ts +111 -0
  286. package/src/node/cli/commands/logout/cmd-logout.ts +11 -0
  287. package/src/node/cli/commands/publish/cmd-publish.ts +135 -0
  288. package/src/node/cli/commands/publish/parse-gitignore.ts +278 -0
  289. package/src/node/cli/commands/publish/uploader.ts +333 -0
  290. package/src/node/cli/constants.ts +14 -0
  291. package/src/node/cli/is-logged-in.ts +28 -0
  292. package/src/node/cli/program.ts +77 -0
  293. package/src/node/cli/store.ts +64 -0
  294. package/src/node/cli/tests/api.test.ts +161 -0
  295. package/src/node/cli/types.ts +34 -0
  296. package/src/node/cli/utils.ts +20 -0
  297. package/src/node/shared/config.ts +69 -0
  298. package/src/node/shared/logger.ts +44 -0
  299. package/src/shared/ajv.ts +111 -0
  300. package/src/shared/analytics/init.ts +14 -0
  301. package/src/shared/analytics/track.ts +21 -0
  302. package/src/shared/analytics/types.ts +13 -0
  303. package/src/shared/attributes.ts +222 -0
  304. package/src/shared/brick-manifest.ts +110 -0
  305. package/src/shared/bricks/manifests/accordion.manifest.ts +179 -0
  306. package/src/shared/bricks/manifests/all-manifests.ts +92 -0
  307. package/src/shared/bricks/manifests/button.manifest.ts +145 -0
  308. package/src/shared/bricks/manifests/card.manifest.ts +269 -0
  309. package/src/shared/bricks/manifests/carousel.manifest.ts +106 -0
  310. package/src/shared/bricks/manifests/container.manifest.ts +357 -0
  311. package/src/shared/bricks/manifests/divider.manifest.ts +121 -0
  312. package/src/shared/bricks/manifests/footer.manifest.ts +487 -0
  313. package/src/shared/bricks/manifests/form.manifest.ts +112 -0
  314. package/src/shared/bricks/manifests/hero.manifest.ts +132 -0
  315. package/src/shared/bricks/manifests/icon.manifest.ts +130 -0
  316. package/src/shared/bricks/manifests/image.manifest.ts +203 -0
  317. package/src/shared/bricks/manifests/images-gallery.manifest.ts +227 -0
  318. package/src/shared/bricks/manifests/map.manifest.ts +75 -0
  319. package/src/shared/bricks/manifests/navbar.manifest.ts +344 -0
  320. package/src/shared/bricks/manifests/sidebar.manifest.ts +90 -0
  321. package/src/shared/bricks/manifests/social-links.manifest.ts +370 -0
  322. package/src/shared/bricks/manifests/testimonials.manifest.ts +397 -0
  323. package/src/shared/bricks/manifests/tests/header.manifest.test.ts +10 -0
  324. package/src/shared/bricks/manifests/text.manifest.ts +164 -0
  325. package/src/shared/bricks/manifests/timeline.manifest.ts +456 -0
  326. package/src/shared/bricks/manifests/video.manifest.ts +59 -0
  327. package/src/shared/bricks/props/_style-presets.ts +352 -0
  328. package/src/shared/bricks/props/align.ts +59 -0
  329. package/src/shared/bricks/props/background.ts +118 -0
  330. package/src/shared/bricks/props/boolean.ts +11 -0
  331. package/src/shared/bricks/props/border.ts +84 -0
  332. package/src/shared/bricks/props/color.ts +24 -0
  333. package/src/shared/bricks/props/common.ts +37 -0
  334. package/src/shared/bricks/props/container.ts +356 -0
  335. package/src/shared/bricks/props/css-length.ts +25 -0
  336. package/src/shared/bricks/props/datasource.ts +60 -0
  337. package/src/shared/bricks/props/date.ts +24 -0
  338. package/src/shared/bricks/props/effects.ts +123 -0
  339. package/src/shared/bricks/props/enum.ts +42 -0
  340. package/src/shared/bricks/props/file.ts +12 -0
  341. package/src/shared/bricks/props/geolocation.ts +30 -0
  342. package/src/shared/bricks/props/helpers.ts +101 -0
  343. package/src/shared/bricks/props/image.ts +90 -0
  344. package/src/shared/bricks/props/number.ts +16 -0
  345. package/src/shared/bricks/props/padding.ts +21 -0
  346. package/src/shared/bricks/props/position.ts +27 -0
  347. package/src/shared/bricks/props/preset.ts +136 -0
  348. package/src/shared/bricks/props/string.ts +60 -0
  349. package/src/shared/bricks/props/tests/align.test.ts +37 -0
  350. package/src/shared/bricks/props/tests/background.test.ts +102 -0
  351. package/src/shared/bricks/props/tests/border.test.ts +38 -0
  352. package/src/shared/bricks/props/tests/effects.test.ts +37 -0
  353. package/src/shared/bricks/props/tests/helpers.test.ts +133 -0
  354. package/src/shared/bricks/props/tests/image.test.ts +71 -0
  355. package/src/shared/bricks/props/tests/padding.ts +12 -0
  356. package/src/shared/bricks/props/tests/string.test.ts +79 -0
  357. package/src/shared/bricks/props/text.ts +66 -0
  358. package/src/shared/bricks/props/types.ts +57 -0
  359. package/src/shared/bricks.ts +232 -0
  360. package/src/shared/context.ts +39 -0
  361. package/src/shared/datarecords/external/airtable/handler.ts +21 -0
  362. package/src/shared/datarecords/external/airtable/options.ts +22 -0
  363. package/src/shared/datarecords/external/generic-webhook/handler.ts +10 -0
  364. package/src/shared/datarecords/external/generic-webhook/options.ts +13 -0
  365. package/src/shared/datarecords/external/google/oauth/config.ts +30 -0
  366. package/src/shared/datarecords/external/google/sheets/handler.ts +26 -0
  367. package/src/shared/datarecords/external/google/sheets/options.ts +9 -0
  368. package/src/shared/datarecords/types.ts +120 -0
  369. package/src/shared/datarecords.ts +5 -0
  370. package/src/shared/datasources/README.md +3 -0
  371. package/src/shared/datasources/external/facebook/posts/fetcher.ts +62 -0
  372. package/src/shared/datasources/external/facebook/posts/sample.ts +35 -0
  373. package/src/shared/datasources/external/facebook/posts/schema.ts +33 -0
  374. package/src/shared/datasources/external/facebook/posts/tests/fetcher.test.ts +91 -0
  375. package/src/shared/datasources/external/http-json/fetcher.ts +28 -0
  376. package/src/shared/datasources/external/http-json/options.ts +12 -0
  377. package/src/shared/datasources/external/http-json/schema.ts +6 -0
  378. package/src/shared/datasources/external/http-json/tests/fetcher.test.ts +70 -0
  379. package/src/shared/datasources/external/instagram/feed/fetcher.ts +43 -0
  380. package/src/shared/datasources/external/instagram/feed/sample.ts +22 -0
  381. package/src/shared/datasources/external/instagram/feed/schema.ts +23 -0
  382. package/src/shared/datasources/external/instagram/feed/tests/fetcher.test.ts +82 -0
  383. package/src/shared/datasources/external/mastodon/account/fetcher.ts +33 -0
  384. package/src/shared/datasources/external/mastodon/account/sample.ts +33 -0
  385. package/src/shared/datasources/external/mastodon/account/schema.ts +45 -0
  386. package/src/shared/datasources/external/mastodon/account/tests/fetcher.test.ts +65 -0
  387. package/src/shared/datasources/external/mastodon/options.ts +11 -0
  388. package/src/shared/datasources/external/mastodon/status/fetcher.ts +45 -0
  389. package/src/shared/datasources/external/mastodon/status/sample.array.ts +59 -0
  390. package/src/shared/datasources/external/mastodon/status/sample.single.ts +55 -0
  391. package/src/shared/datasources/external/mastodon/status/schema.ts +130 -0
  392. package/src/shared/datasources/external/mastodon/status/tests/fetcher.test.ts +74 -0
  393. package/src/shared/datasources/external/meta/oauth/config.ts +16 -0
  394. package/src/shared/datasources/external/meta/options.ts +11 -0
  395. package/src/shared/datasources/external/rss/fetcher.ts +30 -0
  396. package/src/shared/datasources/external/rss/options.ts +11 -0
  397. package/src/shared/datasources/external/rss/sample.ts +22 -0
  398. package/src/shared/datasources/external/rss/schema.ts +42 -0
  399. package/src/shared/datasources/external/threads/media/fetcher.ts +63 -0
  400. package/src/shared/datasources/external/threads/media/sample.ts +44 -0
  401. package/src/shared/datasources/external/threads/media/schema.ts +37 -0
  402. package/src/shared/datasources/external/tiktok/oauth/config.ts +17 -0
  403. package/src/shared/datasources/external/tiktok/video/fetcher.ts +49 -0
  404. package/src/shared/datasources/external/tiktok/video/options.ts +12 -0
  405. package/src/shared/datasources/external/tiktok/video/sample.ts +26 -0
  406. package/src/shared/datasources/external/tiktok/video/schema.ts +27 -0
  407. package/src/shared/datasources/external/youtube/list/fetcher.ts +46 -0
  408. package/src/shared/datasources/external/youtube/list/options.ts +15 -0
  409. package/src/shared/datasources/external/youtube/list/sample.ts +33 -0
  410. package/src/shared/datasources/external/youtube/list/schema.ts +38 -0
  411. package/src/shared/datasources/external/youtube/oauth/config.ts +15 -0
  412. package/src/shared/datasources/fetcher.ts +17 -0
  413. package/src/shared/datasources/internal/blog/schema.ts +69 -0
  414. package/src/shared/datasources/internal/changelog/schema.ts +48 -0
  415. package/src/shared/datasources/internal/contact-info/schema.ts +20 -0
  416. package/src/shared/datasources/internal/cv/schema.ts +217 -0
  417. package/src/shared/datasources/internal/faq/schema.ts +27 -0
  418. package/src/shared/datasources/internal/job-board/schema.ts +228 -0
  419. package/src/shared/datasources/internal/links/schema.ts +15 -0
  420. package/src/shared/datasources/internal/recipes/schema.ts +42 -0
  421. package/src/shared/datasources/internal/restaurant/schema.ts +225 -0
  422. package/src/shared/datasources/provider-options.ts +7 -0
  423. package/src/shared/datasources/samples.ts +26 -0
  424. package/src/shared/datasources/schemas.ts +45 -0
  425. package/src/shared/datasources/types.ts +276 -0
  426. package/src/shared/datasources/utils.ts +16 -0
  427. package/src/shared/datasources.ts +42 -0
  428. package/src/shared/env.ts +23 -0
  429. package/src/shared/errors.ts +1 -0
  430. package/src/shared/images.ts +44 -0
  431. package/src/shared/index.ts +3 -0
  432. package/src/shared/layout-constants.ts +25 -0
  433. package/src/shared/manifest.ts +50 -0
  434. package/src/shared/oauth.ts +16 -0
  435. package/src/shared/page.ts +61 -0
  436. package/src/shared/prompt.ts +9 -0
  437. package/src/shared/responsive.ts +5 -0
  438. package/src/shared/site.ts +97 -0
  439. package/src/shared/sitemap.ts +66 -0
  440. package/src/shared/social-icons.ts +307 -0
  441. package/src/shared/tests/attributes.test.ts +37 -0
  442. package/src/shared/theme.ts +245 -0
  443. package/src/shared/themes/README.md +34 -0
  444. package/src/shared/themes/color-system.ts +127 -0
  445. package/src/shared/utils/canvas-data-uri.ts +2 -0
  446. package/src/shared/utils/invariant.ts +25 -0
  447. package/src/shared/utils/json-date.ts +8 -0
  448. package/src/shared/utils/merge.ts +12 -0
  449. package/src/shared/utils/object-hash.ts +7 -0
  450. package/src/shared/utils/schema.ts +30 -0
  451. package/src/shared/utils/try-catch.ts +12 -0
  452. package/src/shared/utils/typed-ref.ts +41 -0
  453. package/dist/shared/bricks/manifests/countdown.manifest.d.ts +0 -57
  454. package/dist/shared/bricks/manifests/countdown.manifest.d.ts.map +0 -1
  455. package/dist/shared/bricks/manifests/countdown.manifest.js +0 -3
  456. package/dist/shared/bricks/manifests/generic-component.manifest.d.ts +0 -62
  457. package/dist/shared/bricks/manifests/generic-component.manifest.d.ts.map +0 -1
  458. package/dist/shared/bricks/manifests/generic-component.manifest.js +0 -3
  459. package/dist/shared/bricks/manifests/header.manifest.d.ts +0 -275
  460. package/dist/shared/bricks/manifests/header.manifest.d.ts.map +0 -1
  461. package/dist/shared/bricks/manifests/header.manifest.js +0 -3
  462. package/dist/shared/bricks/props/_docs-common-styles.d.ts +0 -59
  463. package/dist/shared/bricks/props/_docs-common-styles.d.ts.map +0 -1
  464. package/dist/shared/bricks/props/_docs-common-styles.js +0 -3
  465. package/dist/shared/bricks/props/tests/container.test.d.ts +0 -2
  466. package/dist/shared/bricks/props/tests/container.test.d.ts.map +0 -1
  467. package/dist/shared/chunk-2ZPY4LCA.js +0 -3
  468. package/dist/shared/chunk-3CY6AZG7.js +0 -3
  469. package/dist/shared/chunk-4FLI7C3B.js +0 -3
  470. package/dist/shared/chunk-64II435T.js +0 -3
  471. package/dist/shared/chunk-6LDLGZUM.js +0 -3
  472. package/dist/shared/chunk-6MEWEGNA.js +0 -3
  473. package/dist/shared/chunk-AZ63RF3K.js +0 -3
  474. package/dist/shared/chunk-BK6LBWDI.js +0 -3
  475. package/dist/shared/chunk-BMDB2V7J.js +0 -3
  476. package/dist/shared/chunk-BXEKJXEP.js +0 -3
  477. package/dist/shared/chunk-DAPQ4JPP.js +0 -3
  478. package/dist/shared/chunk-ERSFH7XA.js +0 -3
  479. package/dist/shared/chunk-F2ZVIFHO.js +0 -3
  480. package/dist/shared/chunk-H6L4KRCJ.js +0 -3
  481. package/dist/shared/chunk-IKAMZM4I.js +0 -3
  482. package/dist/shared/chunk-IWSVY2VC.js +0 -3
  483. package/dist/shared/chunk-JVDUEZYO.js +0 -3
  484. package/dist/shared/chunk-KB4HY432.js +0 -3
  485. package/dist/shared/chunk-LDOM2LJF.js +0 -3
  486. package/dist/shared/chunk-P5FVZ5PL.js +0 -3
  487. package/dist/shared/chunk-PD7P5KSV.js +0 -3
  488. package/dist/shared/chunk-PJ6HA55L.js +0 -3
  489. package/dist/shared/chunk-PSSJMWGU.js +0 -3
  490. package/dist/shared/chunk-Q4MXTCE4.js +0 -8
  491. package/dist/shared/chunk-QCQH5WLN.js +0 -3
  492. package/dist/shared/chunk-RBYYMUOZ.js +0 -3
  493. package/dist/shared/chunk-RHRJYPU3.js +0 -3
  494. package/dist/shared/chunk-S64XUCWM.js +0 -3
  495. package/dist/shared/chunk-SO5M7CYA.js +0 -3
  496. package/dist/shared/chunk-SQVL4WSX.js +0 -3
  497. package/dist/shared/chunk-SWGSHUTE.js +0 -3
  498. package/dist/shared/chunk-U44NTSIO.js +0 -3
  499. package/dist/shared/chunk-U4R5EGBK.js +0 -3
  500. package/dist/shared/chunk-U5WW6K7W.js +0 -3
  501. package/dist/shared/chunk-V2NS45PF.js +0 -3
  502. package/dist/shared/chunk-WOEBR25A.js +0 -3
  503. package/dist/shared/chunk-WPTVLIYS.js +0 -3
  504. package/dist/shared/chunk-WXKRIUTA.js +0 -3
  505. package/dist/shared/chunk-XBX6II3M.js +0 -3
  506. package/dist/shared/chunk-XGCBIXOO.js +0 -3
  507. package/dist/shared/chunk-YY6DANZF.js +0 -3
  508. package/dist/shared/chunk-ZWQHIQEQ.js +0 -3
  509. package/dist/shared/datasources/external/json/fetcher.d.ts.map +0 -1
  510. package/dist/shared/datasources/external/json/options.d.ts.map +0 -1
  511. package/dist/shared/datasources/external/json/schema.d.ts.map +0 -1
  512. package/dist/shared/datasources/external/json/tests/fetcher.test.d.ts.map +0 -1
  513. package/dist/shared/datasources/external/rss/tests/fetcher.test.d.ts +0 -2
  514. package/dist/shared/datasources/external/rss/tests/fetcher.test.d.ts.map +0 -1
  515. package/dist/shared/template.d.ts +0 -898
  516. package/dist/shared/template.d.ts.map +0 -1
  517. package/dist/shared/template.js +0 -3
  518. package/dist/shared/tests/page.test.d.ts +0 -2
  519. package/dist/shared/tests/page.test.d.ts.map +0 -1
  520. package/dist/shared/tests/test-config.d.ts +0 -3
  521. package/dist/shared/tests/test-config.d.ts.map +0 -1
  522. package/dist/shared/themes/all-themes.d.ts +0 -3
  523. package/dist/shared/themes/all-themes.d.ts.map +0 -1
  524. package/dist/shared/themes/all-themes.js +0 -3
  525. /package/dist/shared/datasources/external/{json → http-json}/fetcher.d.ts +0 -0
  526. /package/dist/shared/datasources/external/{json → http-json}/options.d.ts +0 -0
  527. /package/dist/shared/datasources/external/{json → http-json}/tests/fetcher.test.d.ts +0 -0
@@ -1,44 +1,44 @@
1
1
  #!/usr/bin/env node
2
2
  /*! Upstart.gg - Copyright (C) 2024 Flippable - https://github.com/upstart-gg/upstart/blob/main/LICENSE */
3
3
 
4
- var Ir=Object.create;var Be=Object.defineProperty;var jr=Object.getOwnPropertyDescriptor;var Ur=Object.getOwnPropertyNames;var $r=Object.getPrototypeOf,Wr=Object.prototype.hasOwnProperty;var dt=(i,t)=>()=>(i&&(t=i(i=0)),t);var Cs=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Br=(i,t)=>{for(var e in t)Be(i,e,{get:t[e],enumerable:!0})},zr=(i,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ur(t))!Wr.call(i,r)&&r!==e&&Be(i,r,{get:()=>t[r],enumerable:!(s=jr(t,r))||s.enumerable});return i};var Gr=(i,t,e)=>(e=i!=null?Ir($r(i)):{},zr(t||!i||!i.__esModule?Be(e,"default",{value:i,enumerable:!0}):e,i));function oe(){let i;if(process.env.npm_config_user_agent){let t=process.env.npm_config_user_agent.split(" ")[0];i=t.slice(0,t.lastIndexOf("/"))}return i||(console.log("Warning: could not detect package manager"),i="npm"),i}function _s(i){return`[${i.error}]${i.error_description?`: ${i.error_description}`:""}`}var ze=dt(()=>{"use strict"});var ks,Ge,ct,yh,Ns,Ds,Ps,Ls,Fs,lt=dt(()=>{"use strict";ks="upstart-cli",Ge=process.env.PUBLIC_UPSTART_OAUTH_CLIENT_ID??"50000000-0000-0000-0000-000000000001",ct=process.env.PUBLIC_UPSTART_API_BASE_URL??"https://api.upstart.gg",yh=process.env.PUBLIC_UPSTART_EDITOR_BASE_URL??"https://upstart.gg",Ns=10,Ds="oauth/devicecode",Ps="oauth/token",Ls="oauth/userinfo",Fs="v1/templates"});import Hr from"conf";import It from"node:path";import qr from"node:crypto";import pt from"node:fs";import{fileURLToPath as Vr}from"node:url";import Kr from"chalk";function Ms(){let i=M.get("access_token");if(!i){let t=oe();throw new Error(`Access token not found. Please run ${Kr.cyan(`${t} run enpage:login`)} to authenticate.`)}return i}function Xr(){let i=Yr;for(;i!==It.parse(i).root;){let t=It.join(i,"node_modules");if(pt.existsSync(t))return t;i=It.dirname(i)}return null}function Zr(){let i=Xr();if(!i)throw new Error("Could not find nearest node_modules directory.");let t=It.join(i,".enpage-tmp");pt.existsSync(t)||pt.mkdirSync(t,{recursive:!0,mode:448});let e=It.join(t,".enpage-key");if(!pt.existsSync(e)){let r=qr.randomBytes(32).toString("hex");return pt.writeFileSync(e,r,{mode:384}),r}return pt.readFileSync(e,"utf8")}var Yr,Jr,M,mt=dt(()=>{"use strict";lt();ze();Yr=Vr(new URL(".",import.meta.url)),Jr=Zr(),M=new Hr({projectName:ks,encryptionKey:Jr,clearInvalidConfig:!0})});var js,Is=dt(()=>{js="0.0.95"});import{createLogger as tn}from"vite";import gt from"chalk";function He(i,t,e=!1){let s=tn(i==="debug"?"info":i,{prefix:"[upstart]",allowClearScreen:t});return e&&s.info(gt.hex("#7270c6").bold(`\u{1F680} Upstart v${js}
5
- `)),{...s,success:(r,n)=>s.info(gt.green(r),n),error:(r,n)=>s.error(gt.red(r),n),warn:(r,n)=>s.warn(gt.yellow(r),n),warnOnce:(r,n)=>s.warnOnce(gt.yellow(r),n),debug:(r,n)=>{i==="debug"&&s.info(gt.gray(r),n)}}}var C,jt=dt(()=>{"use strict";Is();C=He()});var zs={};Br(zs,{get:()=>dn,post:()=>st});async function st(i,t,e={}){M.get("access_token")&&(e.Authorization=`Bearer ${M.get("access_token")}`);let s=await fetch(Ws(i),{method:"POST",headers:{"Content-Type":t instanceof URLSearchParams?"application/x-www-form-urlencoded":"application/json",...e},body:t instanceof URLSearchParams?t:JSON.stringify(t)}).catch(r=>{C.error(`Fatal Error requesting API: ${r.message} (${r.cause.code})`),C.error("Please check your internet connection and try again, or retry later."),process.exit(1)});return Bs(s)}async function dn(i,t={}){M.get("access_token")&&(t.Authorization=`Bearer ${M.get("access_token")}`);let e=await fetch(Ws(i),{headers:t,method:"GET"}).catch(s=>{C.error(`Fatal Error requesting API: ${s.message} (${s.cause.code})`),C.error("Please check your internet connection and try again, or retry later."),process.exit(1)});return Bs(e)}function Ws(i){let t=new URL(ct.endsWith("/")?ct:`${ct}/`);return new URL(i,t)}async function Bs(i){let t=i.headers.get("content-type")?.startsWith("application/json")?await i.json():await i.text();return i.ok?{isSuccess:!0,isError:!1,status:i.status,statusText:i.statusText,data:t}:{isSuccess:!1,isError:!0,status:i.status,statusText:i.statusText,data:t}}var Ut=dt(()=>{"use strict";jt();lt();mt()});var ri=Cs((kc,ii)=>{"use strict";ii.exports=ei;function ei(i,t,e){i instanceof RegExp&&(i=ti(i,e)),t instanceof RegExp&&(t=ti(t,e));var s=si(i,t,e);return s&&{start:s[0],end:s[1],pre:e.slice(0,s[0]),body:e.slice(s[0]+i.length,s[1]),post:e.slice(s[1]+t.length)}}function ti(i,t){var e=t.match(i);return e?e[0]:null}ei.range=si;function si(i,t,e){var s,r,n,o,a,h=e.indexOf(i),c=e.indexOf(t,h+1),l=h;if(h>=0&&c>0){if(i===t)return[h,c];for(s=[],n=e.length;l>=0&&!a;)l==h?(s.push(l),h=e.indexOf(i,l+1)):s.length==1?a=[s.pop(),c]:(r=s.pop(),r<n&&(n=r,o=c),c=e.indexOf(t,l+1)),l=h<c&&h>=0?h:c;s.length&&(a=[n,o])}return a}});var ui=Cs((Nc,fi)=>{"use strict";var ni=ri();fi.exports=Hn;var oi="\0SLASH"+Math.random()+"\0",ai="\0OPEN"+Math.random()+"\0",Ve="\0CLOSE"+Math.random()+"\0",hi="\0COMMA"+Math.random()+"\0",ci="\0PERIOD"+Math.random()+"\0";function qe(i){return parseInt(i,10)==i?parseInt(i,10):i.charCodeAt(0)}function zn(i){return i.split("\\\\").join(oi).split("\\{").join(ai).split("\\}").join(Ve).split("\\,").join(hi).split("\\.").join(ci)}function Gn(i){return i.split(oi).join("\\").split(ai).join("{").split(Ve).join("}").split(hi).join(",").split(ci).join(".")}function li(i){if(!i)return[""];var t=[],e=ni("{","}",i);if(!e)return i.split(",");var s=e.pre,r=e.body,n=e.post,o=s.split(",");o[o.length-1]+="{"+r+"}";var a=li(n);return n.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),t.push.apply(t,o),t}function Hn(i){return i?(i.substr(0,2)==="{}"&&(i="\\{\\}"+i.substr(2)),zt(zn(i),!0).map(Gn)):[]}function qn(i){return"{"+i+"}"}function Vn(i){return/^-?0\d/.test(i)}function Kn(i,t){return i<=t}function Yn(i,t){return i>=t}function zt(i,t){var e=[],s=ni("{","}",i);if(!s)return[i];var r=s.pre,n=s.post.length?zt(s.post,!1):[""];if(/\$$/.test(s.pre))for(var o=0;o<n.length;o++){var a=r+"{"+s.body+"}"+n[o];e.push(a)}else{var h=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),l=h||c,f=s.body.indexOf(",")>=0;if(!l&&!f)return s.post.match(/,.*\}/)?(i=s.pre+"{"+s.body+Ve+s.post,zt(i)):[i];var u;if(l)u=s.body.split(/\.\./);else if(u=li(s.body),u.length===1&&(u=zt(u[0],!1).map(qn),u.length===1))return n.map(function(Mt){return s.pre+u[0]+Mt});var d;if(l){var g=qe(u[0]),p=qe(u[1]),y=Math.max(u[0].length,u[1].length),m=u.length==3?Math.abs(qe(u[2])):1,b=Kn,w=p<g;w&&(m*=-1,b=Yn);var S=u.some(Vn);d=[];for(var E=g;b(E,p);E+=m){var v;if(c)v=String.fromCharCode(E),v==="\\"&&(v="");else if(v=String(E),S){var N=y-v.length;if(N>0){var V=new Array(N+1).join("0");E<0?v="-"+V+v.slice(1):v=V+v}}d.push(v)}}else{d=[];for(var L=0;L<u.length;L++)d.push.apply(d,zt(u[L],!1))}for(var L=0;L<d.length;L++)for(var o=0;o<n.length;o++){var a=r+d[L]+n[o];(!t||l||a)&&e.push(a)}}return e}});import{program as Ft}from"commander";ze();mt();import{resolve as J}from"node:path";import{existsSync as Bt,readFileSync as Fn,writeFileSync as Mn}from"node:fs";import it from"chalk";lt();jt();import $t from"node:path";import Wt from"node:fs";import pn from"node:crypto";import mn from"fast-glob";import Hs from"node:http";import gn from"node:https";import{pipeline as wn}from"node:stream";import Gs from"chalk";import yn from"form-data";import*as ae from"node:fs";var en=/[<>"|?*\n\r\t\f\x00-\x1F]/,sn=/(?:^|\/)[*]{2}($|\/)/,rn=248,nn=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),on=i=>typeof i=="string"&&i.length<=rn&&!en.test(i),an=i=>i.split(/\r\n?|\n/);var hn=i=>nn(i)&&Array.isArray(i.patterns)&&Array.isArray(i.sections);var he=(i,t={})=>{let e=t.path;if(hn(i))return i;on(i)&&ae.existsSync(i)&&(e=i,i=ae.readFileSync(i,"utf8"));let s=an(i),r=new Map,n={sections:[],patterns:[]},o={name:"default",patterns:[]},a=null;for(let h of s){let c=h.trim();if(c.startsWith("#")){let[,l]=/^#+\s*(.*)\s*$/.exec(c)||[];if(a){r.delete(a.name),a.comment=a.comment?`${a.comment}
4
+ var Fr=Object.create;var Be=Object.defineProperty;var Mr=Object.getOwnPropertyDescriptor;var Ir=Object.getOwnPropertyNames;var Ur=Object.getPrototypeOf,jr=Object.prototype.hasOwnProperty;var Mt=(i,t)=>()=>(i&&(t=i(i=0)),t);var Cs=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),$r=(i,t)=>{for(var e in t)Be(i,e,{get:t[e],enumerable:!0})},Wr=(i,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ir(t))!jr.call(i,r)&&r!==e&&Be(i,r,{get:()=>t[r],enumerable:!(s=Mr(t,r))||s.enumerable});return i};var Br=(i,t,e)=>(e=i!=null?Fr(Ur(i)):{},Wr(t||!i||!i.__esModule?Be(e,"default",{value:i,enumerable:!0}):e,i));function oe(){let i;if(process.env.npm_config_user_agent){let t=process.env.npm_config_user_agent.split(" ")[0];i=t.slice(0,t.lastIndexOf("/"))}return i||(console.log("Warning: could not detect package manager"),i="npm"),i}function _s(i){return`[${i.error}]${i.error_description?`: ${i.error_description}`:""}`}var ze=Mt(()=>{"use strict"});var ks,Ge,ct,gh,Ns,Ps,Ds,Ls,Fs,lt=Mt(()=>{"use strict";ks="upstart-cli",Ge=process.env.PUBLIC_UPSTART_OAUTH_CLIENT_ID??"50000000-0000-0000-0000-000000000001",ct=process.env.PUBLIC_UPSTART_API_BASE_URL??"https://api.upstart.gg",gh=process.env.PUBLIC_UPSTART_EDITOR_BASE_URL??"https://upstart.gg",Ns=10,Ps="oauth/devicecode",Ds="oauth/token",Ls="oauth/userinfo",Fs="v1/templates"});import zr from"conf";import It from"node:path";import Gr from"node:crypto";import dt from"node:fs";import{fileURLToPath as Hr}from"node:url";import qr from"chalk";function Ms(){let i=M.get("access_token");if(!i){let t=oe();throw new Error(`Access token not found. Please run ${qr.cyan(`${t} run enpage:login`)} to authenticate.`)}return i}function Yr(){let i=Vr;for(;i!==It.parse(i).root;){let t=It.join(i,"node_modules");if(dt.existsSync(t))return t;i=It.dirname(i)}return null}function Jr(){let i=Yr();if(!i)throw new Error("Could not find nearest node_modules directory.");let t=It.join(i,".enpage-tmp");dt.existsSync(t)||dt.mkdirSync(t,{recursive:!0,mode:448});let e=It.join(t,".enpage-key");if(!dt.existsSync(e)){let r=Gr.randomBytes(32).toString("hex");return dt.writeFileSync(e,r,{mode:384}),r}return dt.readFileSync(e,"utf8")}var Vr,Kr,M,pt=Mt(()=>{"use strict";lt();ze();Vr=Hr(new URL(".",import.meta.url)),Kr=Jr(),M=new zr({projectName:ks,encryptionKey:Kr,clearInvalidConfig:!0})});import{createLogger as Xr}from"vite";import mt from"chalk";function He(i,t,e=!1){let s=Xr(i==="debug"?"info":i,{prefix:"[upstart]",allowClearScreen:t});return e&&s.info(mt.hex("#7270c6").bold(`\u{1F680} Upstart v${Zr}
5
+ `)),{...s,success:(r,n)=>s.info(mt.green(r),n),error:(r,n)=>s.error(mt.red(r),n),warn:(r,n)=>s.warn(mt.yellow(r),n),warnOnce:(r,n)=>s.warnOnce(mt.yellow(r),n),debug:(r,n)=>{i==="debug"&&s.info(mt.gray(r),n)}}}var Zr,C,Ut=Mt(()=>{"use strict";Zr=.1;C=He()});var Ws={};$r(Ws,{get:()=>fn,post:()=>st});async function st(i,t,e={}){M.get("access_token")&&(e.Authorization=`Bearer ${M.get("access_token")}`);let s=await fetch(js(i),{method:"POST",headers:{"Content-Type":t instanceof URLSearchParams?"application/x-www-form-urlencoded":"application/json",...e},body:t instanceof URLSearchParams?t:JSON.stringify(t)}).catch(r=>{C.error(`Fatal Error requesting API: ${r.message} (${r.cause.code})`),C.error("Please check your internet connection and try again, or retry later."),process.exit(1)});return $s(s)}async function fn(i,t={}){M.get("access_token")&&(t.Authorization=`Bearer ${M.get("access_token")}`);let e=await fetch(js(i),{headers:t,method:"GET"}).catch(s=>{C.error(`Fatal Error requesting API: ${s.message} (${s.cause.code})`),C.error("Please check your internet connection and try again, or retry later."),process.exit(1)});return $s(e)}function js(i){let t=new URL(ct.endsWith("/")?ct:`${ct}/`);return new URL(i,t)}async function $s(i){let t=i.headers.get("content-type")?.startsWith("application/json")?await i.json():await i.text();return i.ok?{isSuccess:!0,isError:!1,status:i.status,statusText:i.statusText,data:t}:{isSuccess:!1,isError:!0,status:i.status,statusText:i.statusText,data:t}}var jt=Mt(()=>{"use strict";Ut();lt();pt()});var si=Cs((Oc,ei)=>{"use strict";ei.exports=Qs;function Qs(i,t,e){i instanceof RegExp&&(i=Zs(i,e)),t instanceof RegExp&&(t=Zs(t,e));var s=ti(i,t,e);return s&&{start:s[0],end:s[1],pre:e.slice(0,s[0]),body:e.slice(s[0]+i.length,s[1]),post:e.slice(s[1]+t.length)}}function Zs(i,t){var e=t.match(i);return e?e[0]:null}Qs.range=ti;function ti(i,t,e){var s,r,n,o,a,h=e.indexOf(i),c=e.indexOf(t,h+1),l=h;if(h>=0&&c>0){if(i===t)return[h,c];for(s=[],n=e.length;l>=0&&!a;)l==h?(s.push(l),h=e.indexOf(i,l+1)):s.length==1?a=[s.pop(),c]:(r=s.pop(),r<n&&(n=r,o=c),c=e.indexOf(t,l+1)),l=h<c&&h>=0?h:c;s.length&&(a=[n,o])}return a}});var li=Cs((Ac,ci)=>{"use strict";var ii=si();ci.exports=zn;var ri="\0SLASH"+Math.random()+"\0",ni="\0OPEN"+Math.random()+"\0",Ve="\0CLOSE"+Math.random()+"\0",oi="\0COMMA"+Math.random()+"\0",ai="\0PERIOD"+Math.random()+"\0";function qe(i){return parseInt(i,10)==i?parseInt(i,10):i.charCodeAt(0)}function Wn(i){return i.split("\\\\").join(ri).split("\\{").join(ni).split("\\}").join(Ve).split("\\,").join(oi).split("\\.").join(ai)}function Bn(i){return i.split(ri).join("\\").split(ni).join("{").split(Ve).join("}").split(oi).join(",").split(ai).join(".")}function hi(i){if(!i)return[""];var t=[],e=ii("{","}",i);if(!e)return i.split(",");var s=e.pre,r=e.body,n=e.post,o=s.split(",");o[o.length-1]+="{"+r+"}";var a=hi(n);return n.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),t.push.apply(t,o),t}function zn(i){return i?(i.substr(0,2)==="{}"&&(i="\\{\\}"+i.substr(2)),zt(Wn(i),!0).map(Bn)):[]}function Gn(i){return"{"+i+"}"}function Hn(i){return/^-?0\d/.test(i)}function qn(i,t){return i<=t}function Vn(i,t){return i>=t}function zt(i,t){var e=[],s=ii("{","}",i);if(!s)return[i];var r=s.pre,n=s.post.length?zt(s.post,!1):[""];if(/\$$/.test(s.pre))for(var o=0;o<n.length;o++){var a=r+"{"+s.body+"}"+n[o];e.push(a)}else{var h=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),l=h||c,f=s.body.indexOf(",")>=0;if(!l&&!f)return s.post.match(/,.*\}/)?(i=s.pre+"{"+s.body+Ve+s.post,zt(i)):[i];var u;if(l)u=s.body.split(/\.\./);else if(u=hi(s.body),u.length===1&&(u=zt(u[0],!1).map(Gn),u.length===1))return n.map(function(Ft){return s.pre+u[0]+Ft});var d;if(l){var g=qe(u[0]),p=qe(u[1]),y=Math.max(u[0].length,u[1].length),m=u.length==3?Math.abs(qe(u[2])):1,b=qn,w=p<g;w&&(m*=-1,b=Vn);var S=u.some(Hn);d=[];for(var E=g;b(E,p);E+=m){var v;if(c)v=String.fromCharCode(E),v==="\\"&&(v="");else if(v=String(E),S){var N=y-v.length;if(N>0){var V=new Array(N+1).join("0");E<0?v="-"+V+v.slice(1):v=V+v}}d.push(v)}}else{d=[];for(var L=0;L<u.length;L++)d.push.apply(d,zt(u[L],!1))}for(var L=0;L<d.length;L++)for(var o=0;o<n.length;o++){var a=r+d[L]+n[o];(!t||l||a)&&e.push(a)}}return e}});import{program as Lt}from"commander";ze();pt();import{resolve as J}from"node:path";import{existsSync as Bt,readFileSync as Dn,writeFileSync as Ln}from"node:fs";import it from"chalk";lt();Ut();import $t from"node:path";import Wt from"node:fs";import un from"node:crypto";import dn from"fast-glob";import zs from"node:http";import pn from"node:https";import{pipeline as mn}from"node:stream";import Bs from"chalk";import gn from"form-data";import*as ae from"node:fs";var Qr=/[<>"|?*\n\r\t\f\x00-\x1F]/,tn=/(?:^|\/)[*]{2}($|\/)/,en=248,sn=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),rn=i=>typeof i=="string"&&i.length<=en&&!Qr.test(i),nn=i=>i.split(/\r\n?|\n/);var on=i=>sn(i)&&Array.isArray(i.patterns)&&Array.isArray(i.sections);var he=(i,t={})=>{let e=t.path;if(on(i))return i;rn(i)&&ae.existsSync(i)&&(e=i,i=ae.readFileSync(i,"utf8"));let s=nn(i),r=new Map,n={sections:[],patterns:[]},o={name:"default",patterns:[]},a=null;for(let h of s){let c=h.trim();if(c.startsWith("#")){let[,l]=/^#+\s*(.*)\s*$/.exec(c)||[];if(a){r.delete(a.name),a.comment=a.comment?`${a.comment}
6
6
  ${c}`:c,a.name=l?`${a.name.trim()}
7
- ${l.trim()}`:a.name.trim(),r.set(a.name.toLowerCase().trim(),a);continue}o={name:l?.trim()||"",comment:c,patterns:[]},r.set(o.name.toLowerCase(),o),n.sections.push(o),a=o;continue}c!==""&&(o.patterns.push(c),n.patterns.push(c)),a=null}return(t.dedupe===!0||t.unique===!0)&&(n=Us(n,{...t,format:!1})),n.path=e,n.input=Buffer.from(i),n.format=h=>un(n,{...t,...h}),n.dedupe=h=>Us(n,{...t,...h}),n.globs=h=>ln(n,{path:e,...t,...h}),n};var Us=(i,t)=>{let e=he(i,{...t,dedupe:!1}),s=new Map,r={sections:[],patterns:[]},n;for(let o of e.sections){let{name:a="",comment:h,patterns:c}=o,l=a.trim().toLowerCase();for(let f of c)r.patterns.includes(f)||r.patterns.push(f);a&&s.has(l)?(n=s.get(l),n.patterns=[...n.patterns,...c]):(n={name:a,comment:h,patterns:c},r.sections.push(n),s.set(l,n))}for(let o of r.sections)o.patterns=[...new Set(o.patterns)];return r},cn=i=>{if(sn.test(i))return i;let t=!1;return i.startsWith("/")?(i=i.slice(1),t=!0):i.slice(1,i.length-1).includes("/")&&(t=!0),i+=i.endsWith("/")?"**/":"/**",t?i:`**/${i}`},ln=(i,t={})=>{let e=he(i,t),s=[],r=0,n=e.patterns.concat(t.ignore||[]).concat((t.unignore||[]).map(a=>a.startsWith("!")?a:`!${a}`)),o=(a,h)=>{let c=s[s.length-1],l=a?"unignore":"ignore";c&&c.type===l?c.patterns.includes(h)||c.patterns.push(h):(s.push({type:l,path:t.path||null,patterns:[h],index:r}),r++)};for(let a of n){let h="";a.startsWith("!")&&(a=a.slice(1),h="!"),o(h,a.startsWith("/")?a.slice(1):a),o(h,cn(a))}return s},fn=(i={name:"",patterns:[]})=>{let t=[i.comment||""];return i.patterns?.length&&(t.push(i.patterns.join(`
7
+ ${l.trim()}`:a.name.trim(),r.set(a.name.toLowerCase().trim(),a);continue}o={name:l?.trim()||"",comment:c,patterns:[]},r.set(o.name.toLowerCase(),o),n.sections.push(o),a=o;continue}c!==""&&(o.patterns.push(c),n.patterns.push(c)),a=null}return(t.dedupe===!0||t.unique===!0)&&(n=Is(n,{...t,format:!1})),n.path=e,n.input=Buffer.from(i),n.format=h=>ln(n,{...t,...h}),n.dedupe=h=>Is(n,{...t,...h}),n.globs=h=>hn(n,{path:e,...t,...h}),n};var Is=(i,t)=>{let e=he(i,{...t,dedupe:!1}),s=new Map,r={sections:[],patterns:[]},n;for(let o of e.sections){let{name:a="",comment:h,patterns:c}=o,l=a.trim().toLowerCase();for(let f of c)r.patterns.includes(f)||r.patterns.push(f);a&&s.has(l)?(n=s.get(l),n.patterns=[...n.patterns,...c]):(n={name:a,comment:h,patterns:c},r.sections.push(n),s.set(l,n))}for(let o of r.sections)o.patterns=[...new Set(o.patterns)];return r},an=i=>{if(tn.test(i))return i;let t=!1;return i.startsWith("/")?(i=i.slice(1),t=!0):i.slice(1,i.length-1).includes("/")&&(t=!0),i+=i.endsWith("/")?"**/":"/**",t?i:`**/${i}`},hn=(i,t={})=>{let e=he(i,t),s=[],r=0,n=e.patterns.concat(t.ignore||[]).concat((t.unignore||[]).map(a=>a.startsWith("!")?a:`!${a}`)),o=(a,h)=>{let c=s[s.length-1],l=a?"unignore":"ignore";c&&c.type===l?c.patterns.includes(h)||c.patterns.push(h):(s.push({type:l,path:t.path||null,patterns:[h],index:r}),r++)};for(let a of n){let h="";a.startsWith("!")&&(a=a.slice(1),h="!"),o(h,a.startsWith("/")?a.slice(1):a),o(h,an(a))}return s},cn=(i={name:"",patterns:[]})=>{let t=[i.comment||""];return i.patterns?.length&&(t.push(i.patterns.join(`
8
8
  `)),t.push("")),t.join(`
9
- `)},un=(i,t={})=>{let e=he(i,t),s=t.formatSection||fn,r=e.sections||e,n=[];for(let o of[].concat(r))n.push(s(o));return n.join(`
10
- `)};var $s=he;Ut();import Sn from"p-queue";import bn from"ora";import{customAlphabet as En}from"nanoid";var wt=class extends Error{constructor(e,s,r){super(`${e}: ${s}`);this.error=e;this.error_description=s;this.filename=r;this.name="UploadError"}},xn={maxDataSize:12*1024*1024,retryAttempts:2,retryDelay:1e3},vn=new Hs.Agent({keepAlive:!0,maxSockets:10,keepAliveMsecs:3e3});async function Tn(i){let t=$t.join(i,".gitignore"),s=Wt.existsSync(t)?$s(Wt.readFileSync(t,"utf-8")).patterns:[];return mn("**/*",{cwd:i,onlyFiles:!0,dot:!0,absolute:!0,ignore:["node_modules/**",".cache/**","**/.DS_Store",".gitignore",".env",".env.*",".git/**","dist/**",...s]})}async function Rn(i,t,e,s,r,n,o){let a=async h=>{try{return await On(i,t,e,s,r,n,o)}catch(c){if(h<o.retryAttempts)return C.warn(`Retrying upload for ${t} (attempt ${h+1})`),await new Promise(l=>setTimeout(l,o.retryDelay)),a(h+1);throw c}};return a(0)}async function On(i,t,e,s,r,n,o){return new Promise((a,h)=>{let c=Wt.statSync(i),l=$t.basename(i),f=Date.now(),u=new yn({maxDataSize:o.maxDataSize}),d=Wt.createReadStream(i),g=0,p=w=>{g+=w.length};d.on("data",p),u.append("file",d,{filename:l,knownLength:c.size});let y={agent:vn,method:"POST",headers:{authorization:`Bearer ${n}`,"x-upstart-template-file-path":t,"x-upstart-template-id":s,...u.getHeaders()}},b=(e.startsWith("https")?gn:Hs).request(e,y,w=>{let S="";w.on("data",E=>{S+=E}),w.on("end",()=>{let E=Date.now(),v={fileName:l,fileSize:c.size,uploadDuration:E-f,statusCode:w.statusCode??0,serverResponse:S};if(w.statusCode&&w.statusCode>=200&&w.statusCode<300)r.text=`Uploaded ${t}`,a(v);else{let N;if(w.headers["content-type"]?.startsWith("application/json")){let V=JSON.parse(S);N=new wt(V.error||"unknown_error",V.error_description||"Unknown error occurred",t)}else N=new wt("unknown_error",S||"Unknown error occurred",t);r.fail(`Failed to upload ${t} [${N.error}] ${N.error_description}`),h(N)}})});b.on("error",w=>{h(new wt("request_error",w.message,t))}),wn(u,b,w=>{w&&h(new wt("pipeline_error",`Pipeline failed for ${l}: ${w.message}`,t))})})}function An(i,t,e){e.length>0?(C.error(Gs.red(`Failed to upload ${e.length} files:`)),e.forEach(s=>{let r=s.reason;C.error(`- ${r.filename}: ${r.error_description} (${r.error})`)})):C.info(Gs.green(`Uploaded ${t.length} files successfully for template ${i}.
11
- `))}async function qs(i,t,e,s=!1,r={}){let n={...xn,...r},o=new Sn({concurrency:Ns}),a=await Tn(t),h=a.length,c={},l=_n(),f=0;for(let m of a){let b=$t.relative(t,m),w=await Cn(m);c[b]=w}s&&(C.info(`Dry run mode enabled. Skipping upload.
12
- `),C.info("The following files would have been uploaded:"),a.forEach(m=>C.info(`- ${m}`)),process.exit(0));let u=bn(`Uploading ${h} files...`).start(),d=a.map(m=>{let b=$t.resolve(t,m),w=$t.relative(t,m),S=`${ct}/v1/templates/${i}/upload/${l}`;return o.add(async()=>{let E=await Rn(b,w,S,i,u,e,n);return f++,E})}),g=await Promise.allSettled(d);u.stop();let p=g.filter(m=>m.status==="fulfilled"),y=g.filter(m=>m.status==="rejected");if(An(i,p.map(m=>m.value),y),!y.length&&p.length){let m=`${ct}/v1/templates/${i}/upload/${l}/finalize`,w=await st(m,{signatures:c});if(w.isError)return C.error(`Failed to finalize upload: ${w.data.error_description} (${w.data.error})`),{filesCount:h,uploadedFiles:p.map(S=>S.value),failedFiles:[],success:!1}}return{filesCount:h,uploadedFiles:p.map(m=>m.value),failedFiles:y,success:y.length===0}}async function Cn(i){let t=await pn.subtle.digest("SHA-1",Wt.readFileSync(i));return Array.from(new Uint8Array(t)).map(e=>e.toString(16).padStart(2,"0")).join("")}function _n(){let i=En("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",5),t=new Date,e=t.getUTCFullYear(),s=(t.getUTCMonth()+1).toString().padStart(2,"0"),r=t.getUTCDate().toString().padStart(2,"0"),n=t.getUTCHours().toString().padStart(2,"0"),o=t.getUTCMinutes().toString().padStart(2,"0"),a=t.getUTCSeconds().toString().padStart(2,"0");return`${e}${s}${r}${n}${o}${a}_${i()}`}Ut();lt();import Xs from"node:path";jt();import kn from"node:fs";import{readFile as Nn}from"node:fs/promises";import Dn from"fast-glob";import{basename as Vs,dirname as Pn,extname as Ln}from"node:path";async function Ks(i,t=C){kn.existsSync(i)||(t.error(`\u{1F534} No enpage.config.js found!
9
+ `)},ln=(i,t={})=>{let e=he(i,t),s=t.formatSection||cn,r=e.sections||e,n=[];for(let o of[].concat(r))n.push(s(o));return n.join(`
10
+ `)};var Us=he;jt();import wn from"p-queue";import yn from"ora";import{customAlphabet as Sn}from"nanoid";var gt=class extends Error{constructor(e,s,r){super(`${e}: ${s}`);this.error=e;this.error_description=s;this.filename=r;this.name="UploadError"}},bn={maxDataSize:12*1024*1024,retryAttempts:2,retryDelay:1e3},En=new zs.Agent({keepAlive:!0,maxSockets:10,keepAliveMsecs:3e3});async function xn(i){let t=$t.join(i,".gitignore"),s=Wt.existsSync(t)?Us(Wt.readFileSync(t,"utf-8")).patterns:[];return dn("**/*",{cwd:i,onlyFiles:!0,dot:!0,absolute:!0,ignore:["node_modules/**",".cache/**","**/.DS_Store",".gitignore",".env",".env.*",".git/**","dist/**",...s]})}async function vn(i,t,e,s,r,n,o){let a=async h=>{try{return await Tn(i,t,e,s,r,n,o)}catch(c){if(h<o.retryAttempts)return C.warn(`Retrying upload for ${t} (attempt ${h+1})`),await new Promise(l=>setTimeout(l,o.retryDelay)),a(h+1);throw c}};return a(0)}async function Tn(i,t,e,s,r,n,o){return new Promise((a,h)=>{let c=Wt.statSync(i),l=$t.basename(i),f=Date.now(),u=new gn({maxDataSize:o.maxDataSize}),d=Wt.createReadStream(i),g=0,p=w=>{g+=w.length};d.on("data",p),u.append("file",d,{filename:l,knownLength:c.size});let y={agent:En,method:"POST",headers:{authorization:`Bearer ${n}`,"x-upstart-template-file-path":t,"x-upstart-template-id":s,...u.getHeaders()}},b=(e.startsWith("https")?pn:zs).request(e,y,w=>{let S="";w.on("data",E=>{S+=E}),w.on("end",()=>{let E=Date.now(),v={fileName:l,fileSize:c.size,uploadDuration:E-f,statusCode:w.statusCode??0,serverResponse:S};if(w.statusCode&&w.statusCode>=200&&w.statusCode<300)r.text=`Uploaded ${t}`,a(v);else{let N;if(w.headers["content-type"]?.startsWith("application/json")){let V=JSON.parse(S);N=new gt(V.error||"unknown_error",V.error_description||"Unknown error occurred",t)}else N=new gt("unknown_error",S||"Unknown error occurred",t);r.fail(`Failed to upload ${t} [${N.error}] ${N.error_description}`),h(N)}})});b.on("error",w=>{h(new gt("request_error",w.message,t))}),mn(u,b,w=>{w&&h(new gt("pipeline_error",`Pipeline failed for ${l}: ${w.message}`,t))})})}function Rn(i,t,e){e.length>0?(C.error(Bs.red(`Failed to upload ${e.length} files:`)),e.forEach(s=>{let r=s.reason;C.error(`- ${r.filename}: ${r.error_description} (${r.error})`)})):C.info(Bs.green(`Uploaded ${t.length} files successfully for template ${i}.
11
+ `))}async function Gs(i,t,e,s=!1,r={}){let n={...bn,...r},o=new wn({concurrency:Ns}),a=await xn(t),h=a.length,c={},l=An(),f=0;for(let m of a){let b=$t.relative(t,m),w=await On(m);c[b]=w}s&&(C.info(`Dry run mode enabled. Skipping upload.
12
+ `),C.info("The following files would have been uploaded:"),a.forEach(m=>C.info(`- ${m}`)),process.exit(0));let u=yn(`Uploading ${h} files...`).start(),d=a.map(m=>{let b=$t.resolve(t,m),w=$t.relative(t,m),S=`${ct}/v1/templates/${i}/upload/${l}`;return o.add(async()=>{let E=await vn(b,w,S,i,u,e,n);return f++,E})}),g=await Promise.allSettled(d);u.stop();let p=g.filter(m=>m.status==="fulfilled"),y=g.filter(m=>m.status==="rejected");if(Rn(i,p.map(m=>m.value),y),!y.length&&p.length){let m=`${ct}/v1/templates/${i}/upload/${l}/finalize`,w=await st(m,{signatures:c});if(w.isError)return C.error(`Failed to finalize upload: ${w.data.error_description} (${w.data.error})`),{filesCount:h,uploadedFiles:p.map(S=>S.value),failedFiles:[],success:!1}}return{filesCount:h,uploadedFiles:p.map(m=>m.value),failedFiles:y,success:y.length===0}}async function On(i){let t=await un.subtle.digest("SHA-1",Wt.readFileSync(i));return Array.from(new Uint8Array(t)).map(e=>e.toString(16).padStart(2,"0")).join("")}function An(){let i=Sn("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",5),t=new Date,e=t.getUTCFullYear(),s=(t.getUTCMonth()+1).toString().padStart(2,"0"),r=t.getUTCDate().toString().padStart(2,"0"),n=t.getUTCHours().toString().padStart(2,"0"),o=t.getUTCMinutes().toString().padStart(2,"0"),a=t.getUTCSeconds().toString().padStart(2,"0");return`${e}${s}${r}${n}${o}${a}_${i()}`}jt();lt();import Ys from"node:path";Ut();import Cn from"node:fs";import{readFile as _n}from"node:fs/promises";import kn from"fast-glob";import{basename as Hs,dirname as Nn,extname as Pn}from"node:path";async function qs(i,t=C){Cn.existsSync(i)||(t.error(`\u{1F534} No enpage.config.js found!
13
13
  Your project must have an enpage.config.js file in the root directory.
14
14
 
15
- `),process.exit(1));let e=await import(i),s=Pn(i),r={},n=await Dn(["README.enpage.md","README.enpage.*.md"],{cwd:s,onlyFiles:!0,absolute:!0,caseSensitiveMatch:!1});for(let o of n){let a=Vs(o,".md"),h=Ln(a),c=(h===".enpage"?"en":h.substring(1)).toLowerCase();t.debug(`Found template readme file (${c}): ${Vs(o)}`),r[c]=await Nn(o,"utf-8")}return e.manifest&&(e.manifest.readme=r),e}function Ys(i,t){for(let e in i.datasources)if((i.datasources[e].provider==="json-object"||i.datasources[e].provider==="json-array")&&!i.datasources[e].sampleData)throw t.error(`\u{1F534} Error: Datasource "${e}" is missing sample data - nothing will be rendered during development! Please check your enpage.config.js file and add a "sampleData" key to your ${e} datasource.`),new Error(`Missing sample data for datasource "${e}"`);return i}lt();mt();async function Js(i=!1){let t=M.get("access_token"),e=M.get("expires_at");if(!t)return!1;if(e&&e<Date.now())return console.log("Seems like your token expired..."),!1;if(!i)return!0;let{get:s}=await Promise.resolve().then(()=>(Ut(),zs)),{isSuccess:r}=await s(Ls);return r}async function Zs({options:i,args:t,logger:e}){if(!await Js(!0)){let f=oe();e.error(` ${it.redBright("Error")}: User token not found. Please run ${it.cyan(`${f} run enpage:login`)} to authenticate or set the ${it.cyan("ENPAGE_API_TOKEN")} environment variable.
16
- `),process.exit(1)}let s=t.length?Xs.isAbsolute(t[0])?t[0]:J(process.cwd(),t[0]):process.cwd();Bt(s)||(e.error(` Template directory not found: ${s}. Aborting.
17
- `),process.exit(1));let r=t.length>1?Xs.isAbsolute(t[1])?t[1]:J(process.cwd(),t[1]):J(s,"dist");Bt(r)||(e.error(` Dist directory not found: ${r}.
15
+ `),process.exit(1));let e=await import(i),s=Nn(i),r={},n=await kn(["README.enpage.md","README.enpage.*.md"],{cwd:s,onlyFiles:!0,absolute:!0,caseSensitiveMatch:!1});for(let o of n){let a=Hs(o,".md"),h=Pn(a),c=(h===".enpage"?"en":h.substring(1)).toLowerCase();t.debug(`Found template readme file (${c}): ${Hs(o)}`),r[c]=await _n(o,"utf-8")}return e}function Vs(i,t){for(let e in i.site.datasources)if(i.site.datasources[e].provider==="http-json"&&!i.site.datasources[e].sampleData)throw t.error(`\u{1F534} Error: Datasource "${e}" is missing sample data - nothing will be rendered during development! Please check your enpage.config.js file and add a "sampleData" key to your ${e} datasource.`),new Error(`Missing sample data for datasource "${e}"`);return i}lt();pt();async function Ks(i=!1){let t=M.get("access_token"),e=M.get("expires_at");if(!t)return!1;if(e&&e<Date.now())return console.log("Seems like your token expired..."),!1;if(!i)return!0;let{get:s}=await Promise.resolve().then(()=>(jt(),Ws)),{isSuccess:r}=await s(Ls);return r}async function Js({options:i,args:t,logger:e}){if(!await Ks(!0)){let f=oe();e.error(` ${it.redBright("Error")}: User token not found. Please run ${it.cyan(`${f} run enpage:login`)} to authenticate or set the ${it.cyan("ENPAGE_API_TOKEN")} environment variable.
16
+ `),process.exit(1)}let s=t.length?Ys.isAbsolute(t[0])?t[0]:J(process.cwd(),t[0]):process.cwd();Bt(s)||(e.error(` Template directory not found: ${s}. Aborting.
17
+ `),process.exit(1));let r=t.length>1?Ys.isAbsolute(t[1])?t[1]:J(process.cwd(),t[1]):J(s,"dist");Bt(r)||(e.error(` Dist directory not found: ${r}.
18
18
  Please run 'build' before publishing. Aborting.
19
19
  `),process.exit(1)),Bt(J(s,"enpage.config.js"))||(e.error(` ${it.redBright("Error")}: file enpage.config.js not found in ${s}. Aborting.
20
- `),process.exit(1));let n=await Ks(J(s,"enpage.config.js"),e);Ys(n,e);let o=Ms(),a=In(s);a||(e.error(` ${it.redBright("Error")}: package.json file not found in ${s}. Aborting.
21
- `),process.exit(1));let h=await jn(a);if(h||(e.error(` ${it.redBright("Error")}: cannot read/parse package.json file in ${s}. Aborting.
22
- `),process.exit(1)),!h.enpage?.id){let{data:f,isError:u,status:d}=await st(Fs,{manifest:n.manifest});u&&(e.error(` ${it.redBright("Error")}: Cannot register template: ${_s(f)}
23
- `),process.exit(1)),h.enpage??={},h.enpage.id=f.template.id;try{i.dryRun||Mn(a,JSON.stringify(h,null,2))}catch{e.error(` ${it.redBright("Error")}: Cannot update template id in package.json file located in ${s}. Aborting.
20
+ `),process.exit(1));let n=await qs(J(s,"enpage.config.js"),e);Vs(n,e);let o=Ms(),a=Fn(s);a||(e.error(` ${it.redBright("Error")}: package.json file not found in ${s}. Aborting.
21
+ `),process.exit(1));let h=await Mn(a);if(h||(e.error(` ${it.redBright("Error")}: cannot read/parse package.json file in ${s}. Aborting.
22
+ `),process.exit(1)),!h.enpage?.id){let{data:f,isError:u,status:d}=await st(Fs,{});u&&(e.error(` ${it.redBright("Error")}: Cannot register template: ${_s(f)}
23
+ `),process.exit(1)),h.enpage??={},h.enpage.id=f.template.id;try{i.dryRun||Ln(a,JSON.stringify(h,null,2))}catch{e.error(` ${it.redBright("Error")}: Cannot update template id in package.json file located in ${s}. Aborting.
24
24
  `),process.exit(1)}}let c=h.enpage.id;e.info(`Submitting template to Enpage...
25
- `),(await qs(c,s,o,i.dryRun)).success||(e.error(`
25
+ `),(await Gs(c,s,o,i.dryRun)).success||(e.error(`
26
26
  Upload failed. See details above.
27
27
  `),process.exit(1)),e.success(`Template ${c} published.
28
- `)}function In(i){return Bt(J(i,"package.json"))?J(i,"package.json"):Bt(J(i,"template-package.json"))?J(i,"template-package.json"):!1}function jn(i){try{return JSON.parse(Fn(i,"utf-8"))}catch{return null}}lt();Ut();mt();import Un from"chalk";import{confirm as $n}from"@inquirer/prompts";import Wn from"open";async function Bn(i,t){for(;;){let e=new URLSearchParams({grant_type:"device_code",device_code:i,client_id:Ge}),s=await st(Ps,e),{data:r,isSuccess:n}=s;if(n)return r;if(r.error==="authorization_pending")await new Promise(o=>setTimeout(o,5e3));else return t.error(`Error while polling for login: ${r.error_description??r.error}`),!1}}async function Qs({options:i,logger:t}){t.info(`Logging in to Enpage...
29
- `);let{isError:e,data:s}=await st(Ds,{client_id:Ge,scope:"profile,templates:publish"});e&&(t.error("Failed to get device code. Please try again."),t.error(`Error: ${s.error_description??s.error}`),process.exit(1));let{verification_uri:r,device_code:n}=s;await $n({message:"Would you like to open the login page in your browser?",default:!0}).catch(h=>{process.exit(0)})?Wn(r):t.info(`
28
+ `)}function Fn(i){return Bt(J(i,"package.json"))?J(i,"package.json"):Bt(J(i,"template-package.json"))?J(i,"template-package.json"):!1}function Mn(i){try{return JSON.parse(Dn(i,"utf-8"))}catch{return null}}lt();jt();pt();import In from"chalk";import{confirm as Un}from"@inquirer/prompts";import jn from"open";async function $n(i,t){for(;;){let e=new URLSearchParams({grant_type:"device_code",device_code:i,client_id:Ge}),s=await st(Ds,e),{data:r,isSuccess:n}=s;if(n)return r;if(r.error==="authorization_pending")await new Promise(o=>setTimeout(o,5e3));else return t.error(`Error while polling for login: ${r.error_description??r.error}`),!1}}async function Xs({options:i,logger:t}){t.info(`Logging in to Enpage...
29
+ `);let{isError:e,data:s}=await st(Ps,{client_id:Ge,scope:"profile,templates:publish"});e&&(t.error("Failed to get device code. Please try again."),t.error(`Error: ${s.error_description??s.error}`),process.exit(1));let{verification_uri:r,device_code:n}=s;await Un({message:"Would you like to open the login page in your browser?",default:!0}).catch(h=>{process.exit(0)})?jn(r):t.info(`
30
30
  Please visit the following URL to login:
31
31
  ${r}
32
- `),t.info(Un.gray(`
32
+ `),t.info(In.gray(`
33
33
  Waiting for login...
34
- `));let a=await Bn(n,t);a||(t.error("Login failed. Please try again."),process.exit(1)),M.set({...a,...a.expires_in?{expires_at:Date.now()+a.expires_in*1e3}:{}}),t.info(`Login successful!
35
- `),process.exitCode=0}import{build as Rs}from"vite";import dh,{resolve as Pr}from"node:path";import{fileURLToPath as ph}from"node:url";var bi=Gr(ui(),1);var Gt=i=>{if(typeof i!="string")throw new TypeError("invalid pattern");if(i.length>65536)throw new TypeError("pattern is too long")};var Jn={"[: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]},Ht=i=>i.replace(/[[\]\\-]/g,"\\$&"),Xn=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),di=i=>i.join(""),pi=(i,t)=>{let e=t;if(i.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],r=[],n=e+1,o=!1,a=!1,h=!1,c=!1,l=e,f="";t:for(;n<i.length;){let p=i.charAt(n);if((p==="!"||p==="^")&&n===e+1){c=!0,n++;continue}if(p==="]"&&o&&!h){l=n+1;break}if(o=!0,p==="\\"&&!h){h=!0,n++;continue}if(p==="["&&!h){for(let[y,[m,b,w]]of Object.entries(Jn))if(i.startsWith(y,n)){if(f)return["$.",!1,i.length-e,!0];n+=y.length,w?r.push(m):s.push(m),a=a||b;continue t}}if(h=!1,f){p>f?s.push(Ht(f)+"-"+Ht(p)):p===f&&s.push(Ht(p)),f="",n++;continue}if(i.startsWith("-]",n+1)){s.push(Ht(p+"-")),n+=2;continue}if(i.startsWith("-",n+1)){f=p,n+=2;continue}s.push(Ht(p)),n++}if(l<n)return["",!1,0,!1];if(!s.length&&!r.length)return["$.",!1,i.length-e,!0];if(r.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!c){let p=s[0].length===2?s[0].slice(-1):s[0];return[Xn(p),!1,l-e,!1]}let u="["+(c?"^":"")+di(s)+"]",d="["+(c?"":"^")+di(r)+"]";return[s.length&&r.length?"("+u+"|"+d+")":s.length?u:d,a,l-e,!0]};var B=(i,{windowsPathsNoEscape:t=!1}={})=>t?i.replace(/\[([^\/\\])\]/g,"$1"):i.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var Zn=new Set(["!","?","+","*","@"]),mi=i=>Zn.has(i),Qn="(?!(?:^|/)\\.\\.?(?:$|/))",ce="(?!\\.)",to=new Set(["[","."]),eo=new Set(["..","."]),so=new Set("().*{}+?[]^$\\!"),io=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Ke="[^/]",gi=Ke+"*?",wi=Ke+"+?",yt=class i{type;#t;#e;#n=!1;#r=[];#o;#b;#w;#a=!1;#f;#h;#c=!1;constructor(t,e,s={}){this.type=t,t&&(this.#e=!0),this.#o=e,this.#t=this.#o?this.#o.#t:this,this.#f=this.#t===this?s:this.#t.#f,this.#w=this.#t===this?[]:this.#t.#w,t==="!"&&!this.#t.#a&&this.#w.push(this),this.#b=this.#o?this.#o.#r.length:0}get hasMagic(){if(this.#e!==void 0)return this.#e;for(let t of this.#r)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#e=!0;return this.#e}toString(){return this.#h!==void 0?this.#h:this.type?this.#h=this.type+"("+this.#r.map(t=>String(t)).join("|")+")":this.#h=this.#r.map(t=>String(t)).join("")}#s(){if(this!==this.#t)throw new Error("should only call on root");if(this.#a)return this;this.toString(),this.#a=!0;let t;for(;t=this.#w.pop();){if(t.type!=="!")continue;let e=t,s=e.#o;for(;s;){for(let r=e.#b+1;!s.type&&r<s.#r.length;r++)for(let n of t.#r){if(typeof n=="string")throw new Error("string part in extglob AST??");n.copyIn(s.#r[r])}e=s,s=e.#o}}return this}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof i&&e.#o===this))throw new Error("invalid part: "+e);this.#r.push(e)}}toJSON(){let t=this.type===null?this.#r.slice().map(e=>typeof e=="string"?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#a&&this.#o?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#o?.isStart())return!1;if(this.#b===0)return!0;let t=this.#o;for(let e=0;e<this.#b;e++){let s=t.#r[e];if(!(s instanceof i&&s.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let t=this.#o?this.#o.#r.length:0;return this.#b===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new i(this.type,t);for(let s of this.#r)e.copyIn(s);return e}static#u(t,e,s,r){let n=!1,o=!1,a=-1,h=!1;if(e.type===null){let d=s,g="";for(;d<t.length;){let p=t.charAt(d++);if(n||p==="\\"){n=!n,g+=p;continue}if(o){d===a+1?(p==="^"||p==="!")&&(h=!0):p==="]"&&!(d===a+2&&h)&&(o=!1),g+=p;continue}else if(p==="["){o=!0,a=d,h=!1,g+=p;continue}if(!r.noext&&mi(p)&&t.charAt(d)==="("){e.push(g),g="";let y=new i(p,e);d=i.#u(t,y,d,r),e.push(y);continue}g+=p}return e.push(g),d}let c=s+1,l=new i(null,e),f=[],u="";for(;c<t.length;){let d=t.charAt(c++);if(n||d==="\\"){n=!n,u+=d;continue}if(o){c===a+1?(d==="^"||d==="!")&&(h=!0):d==="]"&&!(c===a+2&&h)&&(o=!1),u+=d;continue}else if(d==="["){o=!0,a=c,h=!1,u+=d;continue}if(mi(d)&&t.charAt(c)==="("){l.push(u),u="";let g=new i(d,l);l.push(g),c=i.#u(t,g,c,r);continue}if(d==="|"){l.push(u),u="",f.push(l),l=new i(null,e);continue}if(d===")")return u===""&&e.#r.length===0&&(e.#c=!0),l.push(u),u="",e.push(...f,l),c;u+=d}return e.type=null,e.#e=void 0,e.#r=[t.substring(s-1)],c}static fromGlob(t,e={}){let s=new i(null,void 0,e);return i.#u(t,s,0,e),s}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[e,s,r,n]=this.toRegExpSource();if(!(r||this.#e||this.#f.nocase&&!this.#f.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let a=(this.#f.nocase?"i":"")+(n?"u":"");return Object.assign(new RegExp(`^${e}$`,a),{_src:e,_glob:t})}get options(){return this.#f}toRegExpSource(t){let e=t??!!this.#f.dot;if(this.#t===this&&this.#s(),!this.type){let h=this.isStart()&&this.isEnd(),c=this.#r.map(d=>{let[g,p,y,m]=typeof d=="string"?i.#p(d,this.#e,h):d.toRegExpSource(t);return this.#e=this.#e||y,this.#n=this.#n||m,g}).join(""),l="";if(this.isStart()&&typeof this.#r[0]=="string"&&!(this.#r.length===1&&eo.has(this.#r[0]))){let g=to,p=e&&g.has(c.charAt(0))||c.startsWith("\\.")&&g.has(c.charAt(2))||c.startsWith("\\.\\.")&&g.has(c.charAt(4)),y=!e&&!t&&g.has(c.charAt(0));l=p?Qn:y?ce:""}let f="";return this.isEnd()&&this.#t.#a&&this.#o?.type==="!"&&(f="(?:$|\\/)"),[l+c+f,B(c),this.#e=!!this.#e,this.#n]}let s=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",n=this.#y(e);if(this.isStart()&&this.isEnd()&&!n&&this.type!=="!"){let h=this.toString();return this.#r=[h],this.type=null,this.#e=void 0,[h,B(this.toString()),!1,!1]}let o=!s||t||e||!ce?"":this.#y(!0);o===n&&(o=""),o&&(n=`(?:${n})(?:${o})*?`);let a="";if(this.type==="!"&&this.#c)a=(this.isStart()&&!e?ce:"")+wi;else{let h=this.type==="!"?"))"+(this.isStart()&&!e&&!t?ce:"")+gi+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=r+n+h}return[a,B(n),this.#e=!!this.#e,this.#n]}#y(t){return this.#r.map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,r,n,o]=e.toRegExpSource(t);return this.#n=this.#n||o,s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static#p(t,e,s=!1){let r=!1,n="",o=!1;for(let a=0;a<t.length;a++){let h=t.charAt(a);if(r){r=!1,n+=(so.has(h)?"\\":"")+h;continue}if(h==="\\"){a===t.length-1?n+="\\\\":r=!0;continue}if(h==="["){let[c,l,f,u]=pi(t,a);if(f){n+=c,o=o||l,a+=f-1,e=e||u;continue}}if(h==="*"){s&&t==="*"?n+=wi:n+=gi,e=!0;continue}if(h==="?"){n+=Ke,e=!0;continue}n+=io(h)}return[n,B(t),!!e,o]}};var St=(i,{windowsPathsNoEscape:t=!1}={})=>t?i.replace(/[?*()[\]]/g,"[$&]"):i.replace(/[?*()[\]\\]/g,"\\$&");var D=(i,t,e={})=>(Gt(t),!e.nocomment&&t.charAt(0)==="#"?!1:new I(t,e).match(i)),ro=/^\*+([^+@!?\*\[\(]*)$/,no=i=>t=>!t.startsWith(".")&&t.endsWith(i),oo=i=>t=>t.endsWith(i),ao=i=>(i=i.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(i)),ho=i=>(i=i.toLowerCase(),t=>t.toLowerCase().endsWith(i)),co=/^\*+\.\*+$/,lo=i=>!i.startsWith(".")&&i.includes("."),fo=i=>i!=="."&&i!==".."&&i.includes("."),uo=/^\.\*+$/,po=i=>i!=="."&&i!==".."&&i.startsWith("."),mo=/^\*+$/,go=i=>i.length!==0&&!i.startsWith("."),wo=i=>i.length!==0&&i!=="."&&i!=="..",yo=/^\?+([^+@!?\*\[\(]*)?$/,So=([i,t=""])=>{let e=Ei([i]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},bo=([i,t=""])=>{let e=xi([i]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},Eo=([i,t=""])=>{let e=xi([i]);return t?s=>e(s)&&s.endsWith(t):e},xo=([i,t=""])=>{let e=Ei([i]);return t?s=>e(s)&&s.endsWith(t):e},Ei=([i])=>{let t=i.length;return e=>e.length===t&&!e.startsWith(".")},xi=([i])=>{let t=i.length;return e=>e.length===t&&e!=="."&&e!==".."},vi=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",yi={win32:{sep:"\\"},posix:{sep:"/"}},vo=vi==="win32"?yi.win32.sep:yi.posix.sep;D.sep=vo;var A=Symbol("globstar **");D.GLOBSTAR=A;var To="[^/]",Ro=To+"*?",Oo="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Ao="(?:(?!(?:\\/|^)\\.).)*?",Co=(i,t={})=>e=>D(e,i,t);D.filter=Co;var U=(i,t={})=>Object.assign({},i,t),_o=i=>{if(!i||typeof i!="object"||!Object.keys(i).length)return D;let t=D;return Object.assign((s,r,n={})=>t(s,r,U(i,n)),{Minimatch:class extends t.Minimatch{constructor(r,n={}){super(r,U(i,n))}static defaults(r){return t.defaults(U(i,r)).Minimatch}},AST:class extends t.AST{constructor(r,n,o={}){super(r,n,U(i,o))}static fromGlob(r,n={}){return t.AST.fromGlob(r,U(i,n))}},unescape:(s,r={})=>t.unescape(s,U(i,r)),escape:(s,r={})=>t.escape(s,U(i,r)),filter:(s,r={})=>t.filter(s,U(i,r)),defaults:s=>t.defaults(U(i,s)),makeRe:(s,r={})=>t.makeRe(s,U(i,r)),braceExpand:(s,r={})=>t.braceExpand(s,U(i,r)),match:(s,r,n={})=>t.match(s,r,U(i,n)),sep:t.sep,GLOBSTAR:A})};D.defaults=_o;var Ti=(i,t={})=>(Gt(i),t.nobrace||!/\{(?:(?!\{).)*\}/.test(i)?[i]:(0,bi.default)(i));D.braceExpand=Ti;var ko=(i,t={})=>new I(i,t).makeRe();D.makeRe=ko;var No=(i,t,e={})=>{let s=new I(t,e);return i=i.filter(r=>s.match(r)),s.options.nonull&&!i.length&&i.push(t),i};D.match=No;var Si=/[?*]|[+@!]\(.*?\)|\[|\]/,Do=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),I=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){Gt(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||vi,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,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=e.windowsNoMagicRoot!==void 0?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(typeof e!="string")return!0;return!1}debug(...t){}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=(...n)=>console.error(...n)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(n=>this.slashSplit(n));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let r=this.globParts.map((n,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let h=n[0]===""&&n[1]===""&&(n[2]==="?"||!Si.test(n[2]))&&!Si.test(n[3]),c=/^[a-z]:/i.test(n[0]);if(h)return[...n.slice(0,4),...n.slice(4).map(l=>this.parse(l))];if(c)return[n[0],...n.slice(1).map(l=>this.parse(l))]}return n.map(h=>this.parse(h))});if(this.debug(this.pattern,r),this.set=r.filter(n=>n.indexOf(!1)===-1),this.isWindows)for(let n=0;n<this.set.length;n++){let o=this.set[n];o[0]===""&&o[1]===""&&this.globParts[n][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s=0;s<t.length;s++)for(let r=0;r<t[s].length;r++)t[s][r]==="**"&&(t[s][r]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let r=s;for(;e[r+1]==="**";)r++;r!==s&&e.splice(s,r-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,r)=>{let n=s[s.length-1];return r==="**"&&n==="**"?s:r===".."&&n&&n!==".."&&n!=="."&&n!=="**"?(s.pop(),s):(s.push(r),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let r=1;r<t.length-1;r++){let n=t[r];r===1&&n===""&&t[0]===""||(n==="."||n==="")&&(e=!0,t.splice(r,1),r--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let r=t[s-1];r&&r!=="."&&r!==".."&&r!=="**"&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let r=-1;for(;(r=s.indexOf("**",r+1))!==-1;){let o=r;for(;s[o+1]==="**";)o++;o>r&&s.splice(r+1,o-r);let a=s[r+1],h=s[r+2],c=s[r+3];if(a!==".."||!h||h==="."||h===".."||!c||c==="."||c==="..")continue;e=!0,s.splice(r,1);let l=s.slice(0);l[r]="**",t.push(l),r--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let a=s[o];o===1&&a===""&&s[0]===""||(a==="."||a==="")&&(e=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let n=0;for(;(n=s.indexOf("..",n+1))!==-1;){let o=s[n-1];if(o&&o!=="."&&o!==".."&&o!=="**"){e=!0;let h=n===1&&s[n+1]==="**"?["."]:[];s.splice(n-1,2,...h),s.length===0&&s.push(""),n-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){let r=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(r){t[e]=[],t[s]=r;break}}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let r=0,n=0,o=[],a="";for(;r<t.length&&n<e.length;)if(t[r]===e[n])o.push(a==="b"?e[n]:t[r]),r++,n++;else if(s&&t[r]==="**"&&e[n]===t[r+1])o.push(t[r]),r++;else if(s&&e[n]==="**"&&t[r]===e[n+1])o.push(e[n]),n++;else if(t[r]==="*"&&e[n]&&(this.options.dot||!e[n].startsWith("."))&&e[n]!=="**"){if(a==="b")return!1;a="a",o.push(t[r]),r++,n++}else if(e[n]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(a==="a")return!1;a="b",o.push(e[n]),r++,n++}else return!1;return t.length===e.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let r=0;r<t.length&&t.charAt(r)==="!";r++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){let r=this.options;if(this.isWindows){let p=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),y=!p&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),m=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),b=!m&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),w=y?3:p?0:void 0,S=b?3:m?0:void 0;if(typeof w=="number"&&typeof S=="number"){let[E,v]=[t[w],e[S]];E.toLowerCase()===v.toLowerCase()&&(e[S]=E,S>w?e=e.slice(S):w>S&&(t=t.slice(w)))}}let{optimizationLevel:n=1}=this.options;n>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var o=0,a=0,h=t.length,c=e.length;o<h&&a<c;o++,a++){this.debug("matchOne loop");var l=e[a],f=t[o];if(this.debug(e,l,f),l===!1)return!1;if(l===A){this.debug("GLOBSTAR",[e,l,f]);var u=o,d=a+1;if(d===c){for(this.debug("** at the end");o<h;o++)if(t[o]==="."||t[o]===".."||!r.dot&&t[o].charAt(0)===".")return!1;return!0}for(;u<h;){var g=t[u];if(this.debug(`
34
+ `));let a=await $n(n,t);a||(t.error("Login failed. Please try again."),process.exit(1)),M.set({...a,...a.expires_in?{expires_at:Date.now()+a.expires_in*1e3}:{}}),t.info(`Login successful!
35
+ `),process.exitCode=0}import{build as Rs}from"vite";import fh,{resolve as Nr}from"node:path";import{fileURLToPath as uh}from"node:url";var yi=Br(li(),1);var Gt=i=>{if(typeof i!="string")throw new TypeError("invalid pattern");if(i.length>65536)throw new TypeError("pattern is too long")};var Kn={"[: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]},Ht=i=>i.replace(/[[\]\\-]/g,"\\$&"),Yn=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),fi=i=>i.join(""),ui=(i,t)=>{let e=t;if(i.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],r=[],n=e+1,o=!1,a=!1,h=!1,c=!1,l=e,f="";t:for(;n<i.length;){let p=i.charAt(n);if((p==="!"||p==="^")&&n===e+1){c=!0,n++;continue}if(p==="]"&&o&&!h){l=n+1;break}if(o=!0,p==="\\"&&!h){h=!0,n++;continue}if(p==="["&&!h){for(let[y,[m,b,w]]of Object.entries(Kn))if(i.startsWith(y,n)){if(f)return["$.",!1,i.length-e,!0];n+=y.length,w?r.push(m):s.push(m),a=a||b;continue t}}if(h=!1,f){p>f?s.push(Ht(f)+"-"+Ht(p)):p===f&&s.push(Ht(p)),f="",n++;continue}if(i.startsWith("-]",n+1)){s.push(Ht(p+"-")),n+=2;continue}if(i.startsWith("-",n+1)){f=p,n+=2;continue}s.push(Ht(p)),n++}if(l<n)return["",!1,0,!1];if(!s.length&&!r.length)return["$.",!1,i.length-e,!0];if(r.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!c){let p=s[0].length===2?s[0].slice(-1):s[0];return[Yn(p),!1,l-e,!1]}let u="["+(c?"^":"")+fi(s)+"]",d="["+(c?"":"^")+fi(r)+"]";return[s.length&&r.length?"("+u+"|"+d+")":s.length?u:d,a,l-e,!0]};var B=(i,{windowsPathsNoEscape:t=!1}={})=>t?i.replace(/\[([^\/\\])\]/g,"$1"):i.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var Jn=new Set(["!","?","+","*","@"]),di=i=>Jn.has(i),Xn="(?!(?:^|/)\\.\\.?(?:$|/))",ce="(?!\\.)",Zn=new Set(["[","."]),Qn=new Set(["..","."]),to=new Set("().*{}+?[]^$\\!"),eo=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Ke="[^/]",pi=Ke+"*?",mi=Ke+"+?",wt=class i{type;#t;#e;#n=!1;#r=[];#o;#b;#w;#a=!1;#f;#h;#c=!1;constructor(t,e,s={}){this.type=t,t&&(this.#e=!0),this.#o=e,this.#t=this.#o?this.#o.#t:this,this.#f=this.#t===this?s:this.#t.#f,this.#w=this.#t===this?[]:this.#t.#w,t==="!"&&!this.#t.#a&&this.#w.push(this),this.#b=this.#o?this.#o.#r.length:0}get hasMagic(){if(this.#e!==void 0)return this.#e;for(let t of this.#r)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#e=!0;return this.#e}toString(){return this.#h!==void 0?this.#h:this.type?this.#h=this.type+"("+this.#r.map(t=>String(t)).join("|")+")":this.#h=this.#r.map(t=>String(t)).join("")}#s(){if(this!==this.#t)throw new Error("should only call on root");if(this.#a)return this;this.toString(),this.#a=!0;let t;for(;t=this.#w.pop();){if(t.type!=="!")continue;let e=t,s=e.#o;for(;s;){for(let r=e.#b+1;!s.type&&r<s.#r.length;r++)for(let n of t.#r){if(typeof n=="string")throw new Error("string part in extglob AST??");n.copyIn(s.#r[r])}e=s,s=e.#o}}return this}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof i&&e.#o===this))throw new Error("invalid part: "+e);this.#r.push(e)}}toJSON(){let t=this.type===null?this.#r.slice().map(e=>typeof e=="string"?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#a&&this.#o?.type==="!")&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#o?.isStart())return!1;if(this.#b===0)return!0;let t=this.#o;for(let e=0;e<this.#b;e++){let s=t.#r[e];if(!(s instanceof i&&s.type==="!"))return!1}return!0}isEnd(){if(this.#t===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let t=this.#o?this.#o.#r.length:0;return this.#b===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new i(this.type,t);for(let s of this.#r)e.copyIn(s);return e}static#u(t,e,s,r){let n=!1,o=!1,a=-1,h=!1;if(e.type===null){let d=s,g="";for(;d<t.length;){let p=t.charAt(d++);if(n||p==="\\"){n=!n,g+=p;continue}if(o){d===a+1?(p==="^"||p==="!")&&(h=!0):p==="]"&&!(d===a+2&&h)&&(o=!1),g+=p;continue}else if(p==="["){o=!0,a=d,h=!1,g+=p;continue}if(!r.noext&&di(p)&&t.charAt(d)==="("){e.push(g),g="";let y=new i(p,e);d=i.#u(t,y,d,r),e.push(y);continue}g+=p}return e.push(g),d}let c=s+1,l=new i(null,e),f=[],u="";for(;c<t.length;){let d=t.charAt(c++);if(n||d==="\\"){n=!n,u+=d;continue}if(o){c===a+1?(d==="^"||d==="!")&&(h=!0):d==="]"&&!(c===a+2&&h)&&(o=!1),u+=d;continue}else if(d==="["){o=!0,a=c,h=!1,u+=d;continue}if(di(d)&&t.charAt(c)==="("){l.push(u),u="";let g=new i(d,l);l.push(g),c=i.#u(t,g,c,r);continue}if(d==="|"){l.push(u),u="",f.push(l),l=new i(null,e);continue}if(d===")")return u===""&&e.#r.length===0&&(e.#c=!0),l.push(u),u="",e.push(...f,l),c;u+=d}return e.type=null,e.#e=void 0,e.#r=[t.substring(s-1)],c}static fromGlob(t,e={}){let s=new i(null,void 0,e);return i.#u(t,s,0,e),s}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();let t=this.toString(),[e,s,r,n]=this.toRegExpSource();if(!(r||this.#e||this.#f.nocase&&!this.#f.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let a=(this.#f.nocase?"i":"")+(n?"u":"");return Object.assign(new RegExp(`^${e}$`,a),{_src:e,_glob:t})}get options(){return this.#f}toRegExpSource(t){let e=t??!!this.#f.dot;if(this.#t===this&&this.#s(),!this.type){let h=this.isStart()&&this.isEnd(),c=this.#r.map(d=>{let[g,p,y,m]=typeof d=="string"?i.#p(d,this.#e,h):d.toRegExpSource(t);return this.#e=this.#e||y,this.#n=this.#n||m,g}).join(""),l="";if(this.isStart()&&typeof this.#r[0]=="string"&&!(this.#r.length===1&&Qn.has(this.#r[0]))){let g=Zn,p=e&&g.has(c.charAt(0))||c.startsWith("\\.")&&g.has(c.charAt(2))||c.startsWith("\\.\\.")&&g.has(c.charAt(4)),y=!e&&!t&&g.has(c.charAt(0));l=p?Xn:y?ce:""}let f="";return this.isEnd()&&this.#t.#a&&this.#o?.type==="!"&&(f="(?:$|\\/)"),[l+c+f,B(c),this.#e=!!this.#e,this.#n]}let s=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",n=this.#y(e);if(this.isStart()&&this.isEnd()&&!n&&this.type!=="!"){let h=this.toString();return this.#r=[h],this.type=null,this.#e=void 0,[h,B(this.toString()),!1,!1]}let o=!s||t||e||!ce?"":this.#y(!0);o===n&&(o=""),o&&(n=`(?:${n})(?:${o})*?`);let a="";if(this.type==="!"&&this.#c)a=(this.isStart()&&!e?ce:"")+mi;else{let h=this.type==="!"?"))"+(this.isStart()&&!e&&!t?ce:"")+pi+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=r+n+h}return[a,B(n),this.#e=!!this.#e,this.#n]}#y(t){return this.#r.map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,r,n,o]=e.toRegExpSource(t);return this.#n=this.#n||o,s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static#p(t,e,s=!1){let r=!1,n="",o=!1;for(let a=0;a<t.length;a++){let h=t.charAt(a);if(r){r=!1,n+=(to.has(h)?"\\":"")+h;continue}if(h==="\\"){a===t.length-1?n+="\\\\":r=!0;continue}if(h==="["){let[c,l,f,u]=ui(t,a);if(f){n+=c,o=o||l,a+=f-1,e=e||u;continue}}if(h==="*"){s&&t==="*"?n+=mi:n+=pi,e=!0;continue}if(h==="?"){n+=Ke,e=!0;continue}n+=eo(h)}return[n,B(t),!!e,o]}};var yt=(i,{windowsPathsNoEscape:t=!1}={})=>t?i.replace(/[?*()[\]]/g,"[$&]"):i.replace(/[?*()[\]\\]/g,"\\$&");var P=(i,t,e={})=>(Gt(t),!e.nocomment&&t.charAt(0)==="#"?!1:new I(t,e).match(i)),so=/^\*+([^+@!?\*\[\(]*)$/,io=i=>t=>!t.startsWith(".")&&t.endsWith(i),ro=i=>t=>t.endsWith(i),no=i=>(i=i.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(i)),oo=i=>(i=i.toLowerCase(),t=>t.toLowerCase().endsWith(i)),ao=/^\*+\.\*+$/,ho=i=>!i.startsWith(".")&&i.includes("."),co=i=>i!=="."&&i!==".."&&i.includes("."),lo=/^\.\*+$/,fo=i=>i!=="."&&i!==".."&&i.startsWith("."),uo=/^\*+$/,po=i=>i.length!==0&&!i.startsWith("."),mo=i=>i.length!==0&&i!=="."&&i!=="..",go=/^\?+([^+@!?\*\[\(]*)?$/,wo=([i,t=""])=>{let e=Si([i]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},yo=([i,t=""])=>{let e=bi([i]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},So=([i,t=""])=>{let e=bi([i]);return t?s=>e(s)&&s.endsWith(t):e},bo=([i,t=""])=>{let e=Si([i]);return t?s=>e(s)&&s.endsWith(t):e},Si=([i])=>{let t=i.length;return e=>e.length===t&&!e.startsWith(".")},bi=([i])=>{let t=i.length;return e=>e.length===t&&e!=="."&&e!==".."},Ei=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",gi={win32:{sep:"\\"},posix:{sep:"/"}},Eo=Ei==="win32"?gi.win32.sep:gi.posix.sep;P.sep=Eo;var A=Symbol("globstar **");P.GLOBSTAR=A;var xo="[^/]",vo=xo+"*?",To="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Ro="(?:(?!(?:\\/|^)\\.).)*?",Oo=(i,t={})=>e=>P(e,i,t);P.filter=Oo;var j=(i,t={})=>Object.assign({},i,t),Ao=i=>{if(!i||typeof i!="object"||!Object.keys(i).length)return P;let t=P;return Object.assign((s,r,n={})=>t(s,r,j(i,n)),{Minimatch:class extends t.Minimatch{constructor(r,n={}){super(r,j(i,n))}static defaults(r){return t.defaults(j(i,r)).Minimatch}},AST:class extends t.AST{constructor(r,n,o={}){super(r,n,j(i,o))}static fromGlob(r,n={}){return t.AST.fromGlob(r,j(i,n))}},unescape:(s,r={})=>t.unescape(s,j(i,r)),escape:(s,r={})=>t.escape(s,j(i,r)),filter:(s,r={})=>t.filter(s,j(i,r)),defaults:s=>t.defaults(j(i,s)),makeRe:(s,r={})=>t.makeRe(s,j(i,r)),braceExpand:(s,r={})=>t.braceExpand(s,j(i,r)),match:(s,r,n={})=>t.match(s,r,j(i,n)),sep:t.sep,GLOBSTAR:A})};P.defaults=Ao;var xi=(i,t={})=>(Gt(i),t.nobrace||!/\{(?:(?!\{).)*\}/.test(i)?[i]:(0,yi.default)(i));P.braceExpand=xi;var Co=(i,t={})=>new I(i,t).makeRe();P.makeRe=Co;var _o=(i,t,e={})=>{let s=new I(t,e);return i=i.filter(r=>s.match(r)),s.options.nonull&&!i.length&&i.push(t),i};P.match=_o;var wi=/[?*]|[+@!]\(.*?\)|\[|\]/,ko=i=>i.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),I=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){Gt(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||Ei,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,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=e.windowsNoMagicRoot!==void 0?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(typeof e!="string")return!0;return!1}debug(...t){}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=(...n)=>console.error(...n)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(n=>this.slashSplit(n));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let r=this.globParts.map((n,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let h=n[0]===""&&n[1]===""&&(n[2]==="?"||!wi.test(n[2]))&&!wi.test(n[3]),c=/^[a-z]:/i.test(n[0]);if(h)return[...n.slice(0,4),...n.slice(4).map(l=>this.parse(l))];if(c)return[n[0],...n.slice(1).map(l=>this.parse(l))]}return n.map(h=>this.parse(h))});if(this.debug(this.pattern,r),this.set=r.filter(n=>n.indexOf(!1)===-1),this.isWindows)for(let n=0;n<this.set.length;n++){let o=this.set[n];o[0]===""&&o[1]===""&&this.globParts[n][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s=0;s<t.length;s++)for(let r=0;r<t[s].length;r++)t[s][r]==="**"&&(t[s][r]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let r=s;for(;e[r+1]==="**";)r++;r!==s&&e.splice(s,r-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,r)=>{let n=s[s.length-1];return r==="**"&&n==="**"?s:r===".."&&n&&n!==".."&&n!=="."&&n!=="**"?(s.pop(),s):(s.push(r),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let r=1;r<t.length-1;r++){let n=t[r];r===1&&n===""&&t[0]===""||(n==="."||n==="")&&(e=!0,t.splice(r,1),r--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let r=t[s-1];r&&r!=="."&&r!==".."&&r!=="**"&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let r=-1;for(;(r=s.indexOf("**",r+1))!==-1;){let o=r;for(;s[o+1]==="**";)o++;o>r&&s.splice(r+1,o-r);let a=s[r+1],h=s[r+2],c=s[r+3];if(a!==".."||!h||h==="."||h===".."||!c||c==="."||c==="..")continue;e=!0,s.splice(r,1);let l=s.slice(0);l[r]="**",t.push(l),r--}if(!this.preserveMultipleSlashes){for(let o=1;o<s.length-1;o++){let a=s[o];o===1&&a===""&&s[0]===""||(a==="."||a==="")&&(e=!0,s.splice(o,1),o--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let n=0;for(;(n=s.indexOf("..",n+1))!==-1;){let o=s[n-1];if(o&&o!=="."&&o!==".."&&o!=="**"){e=!0;let h=n===1&&s[n+1]==="**"?["."]:[];s.splice(n-1,2,...h),s.length===0&&s.push(""),n-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){let r=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(r){t[e]=[],t[s]=r;break}}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let r=0,n=0,o=[],a="";for(;r<t.length&&n<e.length;)if(t[r]===e[n])o.push(a==="b"?e[n]:t[r]),r++,n++;else if(s&&t[r]==="**"&&e[n]===t[r+1])o.push(t[r]),r++;else if(s&&e[n]==="**"&&t[r]===e[n+1])o.push(e[n]),n++;else if(t[r]==="*"&&e[n]&&(this.options.dot||!e[n].startsWith("."))&&e[n]!=="**"){if(a==="b")return!1;a="a",o.push(t[r]),r++,n++}else if(e[n]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(a==="a")return!1;a="b",o.push(e[n]),r++,n++}else return!1;return t.length===e.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let r=0;r<t.length&&t.charAt(r)==="!";r++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){let r=this.options;if(this.isWindows){let p=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),y=!p&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),m=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),b=!m&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),w=y?3:p?0:void 0,S=b?3:m?0:void 0;if(typeof w=="number"&&typeof S=="number"){let[E,v]=[t[w],e[S]];E.toLowerCase()===v.toLowerCase()&&(e[S]=E,S>w?e=e.slice(S):w>S&&(t=t.slice(w)))}}let{optimizationLevel:n=1}=this.options;n>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var o=0,a=0,h=t.length,c=e.length;o<h&&a<c;o++,a++){this.debug("matchOne loop");var l=e[a],f=t[o];if(this.debug(e,l,f),l===!1)return!1;if(l===A){this.debug("GLOBSTAR",[e,l,f]);var u=o,d=a+1;if(d===c){for(this.debug("** at the end");o<h;o++)if(t[o]==="."||t[o]===".."||!r.dot&&t[o].charAt(0)===".")return!1;return!0}for(;u<h;){var g=t[u];if(this.debug(`
36
36
  globstar while`,t,u,e,d,g),this.matchOne(t.slice(u),e.slice(d),s))return this.debug("globstar found match!",u,h,g),!0;if(g==="."||g===".."||!r.dot&&g.charAt(0)==="."){this.debug("dot detected!",t,u,e,d);break}this.debug("globstar swallow a segment, and continue"),u++}return!!(s&&(this.debug(`
37
- >>> no match, partial?`,t,u,e,d),u===h))}let p;if(typeof l=="string"?(p=f===l,this.debug("string match",l,f,p)):(p=l.test(f),this.debug("pattern match",l,f,p)),!p)return!1}if(o===h&&a===c)return!0;if(o===h)return s;if(a===c)return o===h-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return Ti(this.pattern,this.options)}parse(t){Gt(t);let e=this.options;if(t==="**")return A;if(t==="")return"";let s,r=null;(s=t.match(mo))?r=e.dot?wo:go:(s=t.match(ro))?r=(e.nocase?e.dot?ho:ao:e.dot?oo:no)(s[1]):(s=t.match(yo))?r=(e.nocase?e.dot?bo:So:e.dot?Eo:xo)(s):(s=t.match(co))?r=e.dot?fo:lo:(s=t.match(uo))&&(r=po);let n=yt.fromGlob(t,this.options).toMMPattern();return r&&typeof n=="object"&&Reflect.defineProperty(n,"test",{value:r}),n}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,s=e.noglobstar?Ro:e.dot?Oo:Ao,r=new Set(e.nocase?["i"]:[]),n=t.map(h=>{let c=h.map(l=>{if(l instanceof RegExp)for(let f of l.flags.split(""))r.add(f);return typeof l=="string"?Do(l):l===A?A:l._src});return c.forEach((l,f)=>{let u=c[f+1],d=c[f-1];l!==A||d===A||(d===void 0?u!==void 0&&u!==A?c[f+1]="(?:\\/|"+s+"\\/)?"+u:c[f]=s:u===void 0?c[f-1]=d+"(?:\\/|"+s+")?":u!==A&&(c[f-1]=d+"(?:\\/|\\/"+s+"\\/)"+u,c[f+1]=A))}),c.filter(l=>l!==A).join("/")}).join("|"),[o,a]=t.length>1?["(?:",")"]:["",""];n="^"+o+n+a+"$",this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...r].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 s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let r=this.slashSplit(t);this.debug(this.pattern,"split",r);let n=this.set;this.debug(this.pattern,"set",n);let o=r[r.length-1];if(!o)for(let a=r.length-2;!o&&a>=0;a--)o=r[a];for(let a=0;a<n.length;a++){let h=n[a],c=r;if(s.matchBase&&h.length===1&&(c=[o]),this.matchOne(c,h,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return D.defaults(t).Minimatch}};D.AST=yt;D.Minimatch=I;D.escape=St;D.unescape=B;import{fileURLToPath as la}from"node:url";var bt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Oi=new Set,Ye=typeof process=="object"&&process?process:{},Ai=(i,t,e,s)=>{typeof Ye.emitWarning=="function"?Ye.emitWarning(i,t,e,s):console.error(`[${e}] ${t}: ${i}`)},le=globalThis.AbortController,Ri=globalThis.AbortSignal;if(typeof le>"u"){Ri=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,r){this._onabort.push(r)}},le=class{constructor(){t()}signal=new Ri;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let r of this.signal._onabort)r(s);this.signal.onabort?.(s)}}};let i=Ye.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{i&&(i=!1,Ai("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",t))}}var Po=i=>!Oi.has(i),Xc=Symbol("type"),rt=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),Ci=i=>rt(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?Et:null:null,Et=class extends Array{constructor(t){super(t),this.fill(0)}},Je=class i{heap;length;static#t=!1;static create(t){let e=Ci(t);if(!e)return[];i.#t=!0;let s=new i(t,e);return i.#t=!1,s}constructor(t,e){if(!i.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},qt=class i{#t;#e;#n;#r;#o;#b;#w;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#f;#h;#c;#s;#u;#y;#p;#m;#A;#g;#C;#x;#E;#S;#R;#d;#k;static unsafeExposeInternals(t){return{starts:t.#x,ttls:t.#E,sizes:t.#C,keyMap:t.#h,keyList:t.#c,valList:t.#s,next:t.#u,prev:t.#y,get head(){return t.#p},get tail(){return t.#m},free:t.#A,isBackgroundFetch:e=>t.#l(e),backgroundFetch:(e,s,r,n)=>t.#F(e,s,r,n),moveToTail:e=>t.#j(e),indexes:e=>t.#O(e),rindexes:e=>t.#_(e),isStale:e=>t.#T(e)}}get max(){return this.#t}get maxSize(){return this.#e}get calculatedSize(){return this.#f}get size(){return this.#a}get fetchMethod(){return this.#b}get memoMethod(){return this.#w}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#o}constructor(t){let{max:e=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:h,dispose:c,onInsert:l,disposeAfter:f,noDisposeOnSet:u,noUpdateTTL:d,maxSize:g=0,maxEntrySize:p=0,sizeCalculation:y,fetchMethod:m,memoMethod:b,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:E,allowStaleOnFetchAbort:v,ignoreFetchAbort:N}=t;if(e!==0&&!rt(e))throw new TypeError("max option must be a nonnegative integer");let V=e?Ci(e):Array;if(!V)throw new Error("invalid max value: "+e);if(this.#t=e,this.#e=g,this.maxEntrySize=p||this.#e,this.sizeCalculation=y,this.sizeCalculation){if(!this.#e&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#w=b,m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#b=m,this.#R=!!m,this.#h=new Map,this.#c=new Array(e).fill(void 0),this.#s=new Array(e).fill(void 0),this.#u=new V(e),this.#y=new V(e),this.#p=0,this.#m=0,this.#A=Je.create(e),this.#a=0,this.#f=0,typeof c=="function"&&(this.#n=c),typeof l=="function"&&(this.#r=l),typeof f=="function"?(this.#o=f,this.#g=[]):(this.#o=void 0,this.#g=void 0),this.#S=!!this.#n,this.#k=!!this.#r,this.#d=!!this.#o,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!E,this.allowStaleOnFetchAbort=!!v,this.ignoreFetchAbort=!!N,this.maxEntrySize!==0){if(this.#e!==0&&!rt(this.#e))throw new TypeError("maxSize must be a positive integer if specified");if(!rt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#$()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=rt(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!rt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#i()}if(this.#t===0&&this.ttl===0&&this.#e===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#e){let L="LRU_CACHE_UNBOUNDED";Po(L)&&(Oi.add(L),Ai("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",L,i))}}getRemainingTTL(t){return this.#h.has(t)?1/0:0}#i(){let t=new Et(this.#t),e=new Et(this.#t);this.#E=t,this.#x=e,this.#N=(n,o,a=bt.now())=>{if(e[n]=o!==0?a:0,t[n]=o,o!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#T(n)&&this.#D(this.#c[n],"expire")},o+1);h.unref&&h.unref()}},this.#P=n=>{e[n]=t[n]!==0?bt.now():0},this.#v=(n,o)=>{if(t[o]){let a=t[o],h=e[o];if(!a||!h)return;n.ttl=a,n.start=h,n.now=s||r();let c=n.now-h;n.remainingTTL=a-c}};let s=0,r=()=>{let n=bt.now();if(this.ttlResolution>0){s=n;let o=setTimeout(()=>s=0,this.ttlResolution);o.unref&&o.unref()}return n};this.getRemainingTTL=n=>{let o=this.#h.get(n);if(o===void 0)return 0;let a=t[o],h=e[o];if(!a||!h)return 1/0;let c=(s||r())-h;return a-c},this.#T=n=>{let o=e[n],a=t[n];return!!a&&!!o&&(s||r())-o>a}}#P=()=>{};#v=()=>{};#N=()=>{};#T=()=>!1;#$(){let t=new Et(this.#t);this.#f=0,this.#C=t,this.#L=e=>{this.#f-=t[e],t[e]=0},this.#W=(e,s,r,n)=>{if(this.#l(s))return 0;if(!rt(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,e),!rt(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.#M=(e,s,r)=>{if(t[e]=s,this.#e){let n=this.#e-t[e];for(;this.#f>n;)this.#I(!0)}this.#f+=t[e],r&&(r.entrySize=s,r.totalCalculatedSize=this.#f)}}#L=t=>{};#M=(t,e,s)=>{};#W=(t,e,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#O({allowStale:t=this.allowStale}={}){if(this.#a)for(let e=this.#m;!(!this.#B(e)||((t||!this.#T(e))&&(yield e),e===this.#p));)e=this.#y[e]}*#_({allowStale:t=this.allowStale}={}){if(this.#a)for(let e=this.#p;!(!this.#B(e)||((t||!this.#T(e))&&(yield e),e===this.#m));)e=this.#u[e]}#B(t){return t!==void 0&&this.#h.get(this.#c[t])===t}*entries(){for(let t of this.#O())this.#s[t]!==void 0&&this.#c[t]!==void 0&&!this.#l(this.#s[t])&&(yield[this.#c[t],this.#s[t]])}*rentries(){for(let t of this.#_())this.#s[t]!==void 0&&this.#c[t]!==void 0&&!this.#l(this.#s[t])&&(yield[this.#c[t],this.#s[t]])}*keys(){for(let t of this.#O()){let e=this.#c[t];e!==void 0&&!this.#l(this.#s[t])&&(yield e)}}*rkeys(){for(let t of this.#_()){let e=this.#c[t];e!==void 0&&!this.#l(this.#s[t])&&(yield e)}}*values(){for(let t of this.#O())this.#s[t]!==void 0&&!this.#l(this.#s[t])&&(yield this.#s[t])}*rvalues(){for(let t of this.#_())this.#s[t]!==void 0&&!this.#l(this.#s[t])&&(yield this.#s[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let s of this.#O()){let r=this.#s[s],n=this.#l(r)?r.__staleWhileFetching:r;if(n!==void 0&&t(n,this.#c[s],this))return this.get(this.#c[s],e)}}forEach(t,e=this){for(let s of this.#O()){let r=this.#s[s],n=this.#l(r)?r.__staleWhileFetching:r;n!==void 0&&t.call(e,n,this.#c[s],this)}}rforEach(t,e=this){for(let s of this.#_()){let r=this.#s[s],n=this.#l(r)?r.__staleWhileFetching:r;n!==void 0&&t.call(e,n,this.#c[s],this)}}purgeStale(){let t=!1;for(let e of this.#_({allowStale:!0}))this.#T(e)&&(this.#D(this.#c[e],"expire"),t=!0);return t}info(t){let e=this.#h.get(t);if(e===void 0)return;let s=this.#s[e],r=this.#l(s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(this.#E&&this.#x){let o=this.#E[e],a=this.#x[e];if(o&&a){let h=o-(bt.now()-a);n.ttl=h,n.start=Date.now()}}return this.#C&&(n.size=this.#C[e]),n}dump(){let t=[];for(let e of this.#O({allowStale:!0})){let s=this.#c[e],r=this.#s[e],n=this.#l(r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(this.#E&&this.#x){o.ttl=this.#E[e];let a=bt.now()-this.#x[e];o.start=Math.floor(Date.now()-a)}this.#C&&(o.size=this.#C[e]),t.unshift([s,o])}return t}load(t){this.clear();for(let[e,s]of t){if(s.start){let r=Date.now()-s.start;s.start=bt.now()-r}this.set(e,s.value,s)}}set(t,e,s={}){if(e===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=s,{noUpdateTTL:c=this.noUpdateTTL}=s,l=this.#W(t,e,s.size||0,a);if(this.maxEntrySize&&l>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this.#D(t,"set"),this;let f=this.#a===0?void 0:this.#h.get(t);if(f===void 0)f=this.#a===0?this.#m:this.#A.length!==0?this.#A.pop():this.#a===this.#t?this.#I(!1):this.#a,this.#c[f]=t,this.#s[f]=e,this.#h.set(t,f),this.#u[this.#m]=f,this.#y[f]=this.#m,this.#m=f,this.#a++,this.#M(f,l,h),h&&(h.set="add"),c=!1,this.#k&&this.#r?.(e,t,"add");else{this.#j(f);let u=this.#s[f];if(e!==u){if(this.#R&&this.#l(u)){u.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=u;d!==void 0&&!o&&(this.#S&&this.#n?.(d,t,"set"),this.#d&&this.#g?.push([d,t,"set"]))}else o||(this.#S&&this.#n?.(u,t,"set"),this.#d&&this.#g?.push([u,t,"set"]));if(this.#L(f),this.#M(f,l,h),this.#s[f]=e,h){h.set="replace";let d=u&&this.#l(u)?u.__staleWhileFetching:u;d!==void 0&&(h.oldValue=d)}}else h&&(h.set="update");this.#k&&this.onInsert?.(e,t,e===u?"update":"replace")}if(r!==0&&!this.#E&&this.#i(),this.#E&&(c||this.#N(f,r,n),h&&this.#v(h,f)),!o&&this.#d&&this.#g){let u=this.#g,d;for(;d=u?.shift();)this.#o?.(...d)}return this}pop(){try{for(;this.#a;){let t=this.#s[this.#p];if(this.#I(!0),this.#l(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#d&&this.#g){let t=this.#g,e;for(;e=t?.shift();)this.#o?.(...e)}}}#I(t){let e=this.#p,s=this.#c[e],r=this.#s[e];return this.#R&&this.#l(r)?r.__abortController.abort(new Error("evicted")):(this.#S||this.#d)&&(this.#S&&this.#n?.(r,s,"evict"),this.#d&&this.#g?.push([r,s,"evict"])),this.#L(e),t&&(this.#c[e]=void 0,this.#s[e]=void 0,this.#A.push(e)),this.#a===1?(this.#p=this.#m=0,this.#A.length=0):this.#p=this.#u[e],this.#h.delete(s),this.#a--,e}has(t,e={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=e,n=this.#h.get(t);if(n!==void 0){let o=this.#s[n];if(this.#l(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#T(n))r&&(r.has="stale",this.#v(r,n));else return s&&this.#P(n),r&&(r.has="hit",this.#v(r,n)),!0}else r&&(r.has="miss");return!1}peek(t,e={}){let{allowStale:s=this.allowStale}=e,r=this.#h.get(t);if(r===void 0||!s&&this.#T(r))return;let n=this.#s[r];return this.#l(n)?n.__staleWhileFetching:n}#F(t,e,s,r){let n=e===void 0?void 0:this.#s[e];if(this.#l(n))return n;let o=new le,{signal:a}=s;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let h={signal:o.signal,options:s,context:r},c=(p,y=!1)=>{let{aborted:m}=o.signal,b=s.ignoreFetchAbort&&p!==void 0;if(s.status&&(m&&!y?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,b&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),m&&!b&&!y)return f(o.signal.reason);let w=d;return this.#s[e]===d&&(p===void 0?w.__staleWhileFetching?this.#s[e]=w.__staleWhileFetching:this.#D(t,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(t,p,h.options))),p},l=p=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=p),f(p)),f=p=>{let{aborted:y}=o.signal,m=y&&s.allowStaleOnFetchAbort,b=m||s.allowStaleOnFetchRejection,w=b||s.noDeleteOnFetchRejection,S=d;if(this.#s[e]===d&&(!w||S.__staleWhileFetching===void 0?this.#D(t,"fetch"):m||(this.#s[e]=S.__staleWhileFetching)),b)return s.status&&S.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw p},u=(p,y)=>{let m=this.#b?.(t,n,h);m&&m instanceof Promise&&m.then(b=>p(b===void 0?void 0:b),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(p(void 0),s.allowStaleOnFetchAbort&&(p=b=>c(b,!0)))})};s.status&&(s.status.fetchDispatched=!0);let d=new Promise(u).then(c,l),g=Object.assign(d,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return e===void 0?(this.set(t,g,{...h.options,status:void 0}),e=this.#h.get(t)):this.#s[e]=g,g}#l(t){if(!this.#R)return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof le}async fetch(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:p,forceRefresh:y=!1,status:m,signal:b}=e;if(!this.#R)return m&&(m.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:m});let w={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:a,size:h,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:g,ignoreFetchAbort:d,status:m,signal:b},S=this.#h.get(t);if(S===void 0){m&&(m.fetch="miss");let E=this.#F(t,S,w,p);return E.__returned=E}else{let E=this.#s[S];if(this.#l(E)){let Mt=s&&E.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",Mt&&(m.returnedStale=!0)),Mt?E.__staleWhileFetching:E.__returned=E}let v=this.#T(S);if(!y&&!v)return m&&(m.fetch="hit"),this.#j(S),r&&this.#P(S),m&&this.#v(m,S),E;let N=this.#F(t,S,w,p),L=N.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=v?"stale":"refresh",L&&v&&(m.returnedStale=!0)),L?N.__staleWhileFetching:N.__returned=N}}async forceFetch(t,e={}){let s=await this.fetch(t,e);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,e={}){let s=this.#w;if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=e,a=this.get(t,o);if(!n&&a!==void 0)return a;let h=s(t,a,{options:o,context:r});return this.set(t,h,o),h}get(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=e,a=this.#h.get(t);if(a!==void 0){let h=this.#s[a],c=this.#l(h);return o&&this.#v(o,a),this.#T(a)?(o&&(o.get="stale"),c?(o&&s&&h.__staleWhileFetching!==void 0&&(o.returnedStale=!0),s?h.__staleWhileFetching:void 0):(n||this.#D(t,"expire"),o&&s&&(o.returnedStale=!0),s?h:void 0)):(o&&(o.get="hit"),c?h.__staleWhileFetching:(this.#j(a),r&&this.#P(a),h))}else o&&(o.get="miss")}#z(t,e){this.#y[e]=t,this.#u[t]=e}#j(t){t!==this.#m&&(t===this.#p?this.#p=this.#u[t]:this.#z(this.#y[t],this.#u[t]),this.#z(this.#m,t),this.#m=t)}delete(t){return this.#D(t,"delete")}#D(t,e){let s=!1;if(this.#a!==0){let r=this.#h.get(t);if(r!==void 0)if(s=!0,this.#a===1)this.#U(e);else{this.#L(r);let n=this.#s[r];if(this.#l(n)?n.__abortController.abort(new Error("deleted")):(this.#S||this.#d)&&(this.#S&&this.#n?.(n,t,e),this.#d&&this.#g?.push([n,t,e])),this.#h.delete(t),this.#c[r]=void 0,this.#s[r]=void 0,r===this.#m)this.#m=this.#y[r];else if(r===this.#p)this.#p=this.#u[r];else{let o=this.#y[r];this.#u[o]=this.#u[r];let a=this.#u[r];this.#y[a]=this.#y[r]}this.#a--,this.#A.push(r)}}if(this.#d&&this.#g?.length){let r=this.#g,n;for(;n=r?.shift();)this.#o?.(...n)}return s}clear(){return this.#U("delete")}#U(t){for(let e of this.#_({allowStale:!0})){let s=this.#s[e];if(this.#l(s))s.__abortController.abort(new Error("deleted"));else{let r=this.#c[e];this.#S&&this.#n?.(s,r,t),this.#d&&this.#g?.push([s,r,t])}}if(this.#h.clear(),this.#s.fill(void 0),this.#c.fill(void 0),this.#E&&this.#x&&(this.#E.fill(0),this.#x.fill(0)),this.#C&&this.#C.fill(0),this.#p=0,this.#m=0,this.#A.length=0,this.#f=0,this.#a=0,this.#d&&this.#g){let e=this.#g,s;for(;s=e?.shift();)this.#o?.(...s)}}};import{posix as Go,win32 as os}from"node:path";import{fileURLToPath as Ho}from"node:url";import{lstatSync as qo,readdir as Vo,readdirSync as Ko,readlinkSync as Yo,realpathSync as Jo}from"fs";import*as Xo from"node:fs";import{lstat as Qo,readdir as ta,readlink as ea,realpath as sa}from"node:fs/promises";import{EventEmitter as is}from"node:events";import Pi from"node:stream";import{StringDecoder as Lo}from"node:string_decoder";var _i=typeof process=="object"&&process?process:{stdout:null,stderr:null},Fo=i=>!!i&&typeof i=="object"&&(i instanceof ot||i instanceof Pi||Mo(i)||Io(i)),Mo=i=>!!i&&typeof i=="object"&&i instanceof is&&typeof i.pipe=="function"&&i.pipe!==Pi.Writable.prototype.pipe,Io=i=>!!i&&typeof i=="object"&&i instanceof is&&typeof i.write=="function"&&typeof i.end=="function",X=Symbol("EOF"),Z=Symbol("maybeEmitEnd"),nt=Symbol("emittedEnd"),fe=Symbol("emittingEnd"),Vt=Symbol("emittedError"),ue=Symbol("closed"),ki=Symbol("read"),de=Symbol("flush"),Ni=Symbol("flushChunk"),z=Symbol("encoding"),xt=Symbol("decoder"),T=Symbol("flowing"),Kt=Symbol("paused"),vt=Symbol("resume"),R=Symbol("buffer"),P=Symbol("pipes"),O=Symbol("bufferLength"),Xe=Symbol("bufferPush"),pe=Symbol("bufferShift"),_=Symbol("objectMode"),x=Symbol("destroyed"),Ze=Symbol("error"),Qe=Symbol("emitData"),Di=Symbol("emitEnd"),ts=Symbol("emitEnd2"),K=Symbol("async"),es=Symbol("abort"),me=Symbol("aborted"),Yt=Symbol("signal"),ft=Symbol("dataListeners"),j=Symbol("discarded"),Jt=i=>Promise.resolve().then(i),jo=i=>i(),Uo=i=>i==="end"||i==="finish"||i==="prefinish",$o=i=>i instanceof ArrayBuffer||!!i&&typeof i=="object"&&i.constructor&&i.constructor.name==="ArrayBuffer"&&i.byteLength>=0,Wo=i=>!Buffer.isBuffer(i)&&ArrayBuffer.isView(i),ge=class{src;dest;opts;ondrain;constructor(t,e,s){this.src=t,this.dest=e,this.opts=s,this.ondrain=()=>t[vt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ss=class extends ge{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,s){super(t,e,s),this.proxyErrors=r=>e.emit("error",r),t.on("error",this.proxyErrors)}},Bo=i=>!!i.objectMode,zo=i=>!i.objectMode&&!!i.encoding&&i.encoding!=="buffer",ot=class extends is{[T]=!1;[Kt]=!1;[P]=[];[R]=[];[_];[z];[K];[xt];[X]=!1;[nt]=!1;[fe]=!1;[ue]=!1;[Vt]=null;[O]=0;[x]=!1;[Yt];[me]=!1;[ft]=0;[j]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Bo(e)?(this[_]=!0,this[z]=null):zo(e)?(this[z]=e.encoding,this[_]=!1):(this[_]=!1,this[z]=null),this[K]=!!e.async,this[xt]=this[z]?new Lo(this[z]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[R]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[P]});let{signal:s}=e;s&&(this[Yt]=s,s.aborted?this[es]():s.addEventListener("abort",()=>this[es]()))}get bufferLength(){return this[O]}get encoding(){return this[z]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[_]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[K]}set async(t){this[K]=this[K]||!!t}[es](){this[me]=!0,this.emit("abort",this[Yt]?.reason),this.destroy(this[Yt]?.reason)}get aborted(){return this[me]}set aborted(t){}write(t,e,s){if(this[me])return!1;if(this[X])throw new Error("write after end");if(this[x])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(s=e,e="utf8"),e||(e="utf8");let r=this[K]?Jt:jo;if(!this[_]&&!Buffer.isBuffer(t)){if(Wo(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if($o(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[_]?(this[T]&&this[O]!==0&&this[de](!0),this[T]?this.emit("data",t):this[Xe](t),this[O]!==0&&this.emit("readable"),s&&r(s),this[T]):t.length?(typeof t=="string"&&!(e===this[z]&&!this[xt]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[z]&&(t=this[xt].write(t)),this[T]&&this[O]!==0&&this[de](!0),this[T]?this.emit("data",t):this[Xe](t),this[O]!==0&&this.emit("readable"),s&&r(s),this[T]):(this[O]!==0&&this.emit("readable"),s&&r(s),this[T])}read(t){if(this[x])return null;if(this[j]=!1,this[O]===0||t===0||t&&t>this[O])return this[Z](),null;this[_]&&(t=null),this[R].length>1&&!this[_]&&(this[R]=[this[z]?this[R].join(""):Buffer.concat(this[R],this[O])]);let e=this[ki](t||null,this[R][0]);return this[Z](),e}[ki](t,e){if(this[_])this[pe]();else{let s=e;t===s.length||t===null?this[pe]():typeof s=="string"?(this[R][0]=s.slice(t),e=s.slice(0,t),this[O]-=t):(this[R][0]=s.subarray(t),e=s.subarray(0,t),this[O]-=t)}return this.emit("data",e),!this[R].length&&!this[X]&&this.emit("drain"),e}end(t,e,s){return typeof t=="function"&&(s=t,t=void 0),typeof e=="function"&&(s=e,e="utf8"),t!==void 0&&this.write(t,e),s&&this.once("end",s),this[X]=!0,this.writable=!1,(this[T]||!this[Kt])&&this[Z](),this}[vt](){this[x]||(!this[ft]&&!this[P].length&&(this[j]=!0),this[Kt]=!1,this[T]=!0,this.emit("resume"),this[R].length?this[de]():this[X]?this[Z]():this.emit("drain"))}resume(){return this[vt]()}pause(){this[T]=!1,this[Kt]=!0,this[j]=!1}get destroyed(){return this[x]}get flowing(){return this[T]}get paused(){return this[Kt]}[Xe](t){this[_]?this[O]+=1:this[O]+=t.length,this[R].push(t)}[pe](){return this[_]?this[O]-=1:this[O]-=this[R][0].length,this[R].shift()}[de](t=!1){do;while(this[Ni](this[pe]())&&this[R].length);!t&&!this[R].length&&!this[X]&&this.emit("drain")}[Ni](t){return this.emit("data",t),this[T]}pipe(t,e){if(this[x])return t;this[j]=!1;let s=this[nt];return e=e||{},t===_i.stdout||t===_i.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,s?e.end&&t.end():(this[P].push(e.proxyErrors?new ss(this,t,e):new ge(this,t,e)),this[K]?Jt(()=>this[vt]()):this[vt]()),t}unpipe(t){let e=this[P].find(s=>s.dest===t);e&&(this[P].length===1?(this[T]&&this[ft]===0&&(this[T]=!1),this[P]=[]):this[P].splice(this[P].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let s=super.on(t,e);if(t==="data")this[j]=!1,this[ft]++,!this[P].length&&!this[T]&&this[vt]();else if(t==="readable"&&this[O]!==0)super.emit("readable");else if(Uo(t)&&this[nt])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[Vt]){let r=e;this[K]?Jt(()=>r.call(this,this[Vt])):r.call(this,this[Vt])}return s}removeListener(t,e){return this.off(t,e)}off(t,e){let s=super.off(t,e);return t==="data"&&(this[ft]=this.listeners("data").length,this[ft]===0&&!this[j]&&!this[P].length&&(this[T]=!1)),s}removeAllListeners(t){let e=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[ft]=0,!this[j]&&!this[P].length&&(this[T]=!1)),e}get emittedEnd(){return this[nt]}[Z](){!this[fe]&&!this[nt]&&!this[x]&&this[R].length===0&&this[X]&&(this[fe]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ue]&&this.emit("close"),this[fe]=!1)}emit(t,...e){let s=e[0];if(t!=="error"&&t!=="close"&&t!==x&&this[x])return!1;if(t==="data")return!this[_]&&!s?!1:this[K]?(Jt(()=>this[Qe](s)),!0):this[Qe](s);if(t==="end")return this[Di]();if(t==="close"){if(this[ue]=!0,!this[nt]&&!this[x])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(t==="error"){this[Vt]=s,super.emit(Ze,s);let n=!this[Yt]||this.listeners("error").length?super.emit("error",s):!1;return this[Z](),n}else if(t==="resume"){let n=super.emit("resume");return this[Z](),n}else if(t==="finish"||t==="prefinish"){let n=super.emit(t);return this.removeAllListeners(t),n}let r=super.emit(t,...e);return this[Z](),r}[Qe](t){for(let s of this[P])s.dest.write(t)===!1&&this.pause();let e=this[j]?!1:super.emit("data",t);return this[Z](),e}[Di](){return this[nt]?!1:(this[nt]=!0,this.readable=!1,this[K]?(Jt(()=>this[ts]()),!0):this[ts]())}[ts](){if(this[xt]){let e=this[xt].end();if(e){for(let s of this[P])s.dest.write(e);this[j]||super.emit("data",e)}}for(let e of this[P])e.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[_]||(t.dataLength=0);let e=this.promise();return this.on("data",s=>{t.push(s),this[_]||(t.dataLength+=s.length)}),await e,t}async concat(){if(this[_])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[z]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(x,()=>e(new Error("stream destroyed"))),this.on("error",s=>e(s)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[j]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[X])return e();let n,o,a=f=>{this.off("data",h),this.off("end",c),this.off(x,l),e(),o(f)},h=f=>{this.off("error",a),this.off("end",c),this.off(x,l),this.pause(),n({value:f,done:!!this[X]})},c=()=>{this.off("error",a),this.off("data",h),this.off(x,l),e(),n({done:!0,value:void 0})},l=()=>a(new Error("stream destroyed"));return new Promise((f,u)=>{o=u,n=f,this.once(x,l),this.once("error",a),this.once("end",c),this.once("data",h)})},throw:e,return:e,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[j]=!1;let t=!1,e=()=>(this.pause(),this.off(Ze,e),this.off(x,e),this.off("end",e),t=!0,{done:!0,value:void 0}),s=()=>{if(t)return e();let r=this.read();return r===null?e():{done:!1,value:r}};return this.once("end",e),this.once(Ze,e),this.once(x,e),{next:s,throw:e,return:e,[Symbol.iterator](){return this}}}destroy(t){if(this[x])return t?this.emit("error",t):this.emit(x),this;this[x]=!0,this[j]=!0,this[R].length=0,this[O]=0;let e=this;return typeof e.close=="function"&&!this[ue]&&e.close(),t?this.emit("error",t):this.emit(x),this}static get isStream(){return Fo}};var Zo=Jo.native,Zt={lstatSync:qo,readdir:Vo,readdirSync:Ko,readlinkSync:Yo,realpathSync:Zo,promises:{lstat:Qo,readdir:ta,readlink:ea,realpath:sa}},ji=i=>!i||i===Zt||i===Xo?Zt:{...Zt,...i,promises:{...Zt.promises,...i.promises||{}}},Ui=/^\\\\\?\\([a-z]:)\\?$/i,ia=i=>i.replace(/\//g,"\\").replace(Ui,"$1\\"),ra=/[\\\/]/,W=0,$i=1,Wi=2,Y=4,Bi=6,zi=8,ut=10,Gi=12,$=15,Xt=~$,rs=16,Li=32,Qt=64,G=128,we=256,Se=512,Fi=Qt|G|Se,na=1023,ns=i=>i.isFile()?zi:i.isDirectory()?Y:i.isSymbolicLink()?ut:i.isCharacterDevice()?Wi:i.isBlockDevice()?Bi:i.isSocket()?Gi:i.isFIFO()?$i:W,Mi=new Map,te=i=>{let t=Mi.get(i);if(t)return t;let e=i.normalize("NFKD");return Mi.set(i,e),e},Ii=new Map,ye=i=>{let t=Ii.get(i);if(t)return t;let e=te(i.toLowerCase());return Ii.set(i,e),e},be=class extends qt{constructor(){super({max:256})}},as=class extends qt{constructor(t=16*1024){super({maxSize:t,sizeCalculation:e=>e.length+1})}},Hi=Symbol("PathScurry setAsCwd"),k=class{name;root;roots;parent;nocase;isCWD=!1;#t;#e;get dev(){return this.#e}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#o;get uid(){return this.#o}#b;get gid(){return this.#b}#w;get rdev(){return this.#w}#a;get blksize(){return this.#a}#f;get ino(){return this.#f}#h;get size(){return this.#h}#c;get blocks(){return this.#c}#s;get atimeMs(){return this.#s}#u;get mtimeMs(){return this.#u}#y;get ctimeMs(){return this.#y}#p;get birthtimeMs(){return this.#p}#m;get atime(){return this.#m}#A;get mtime(){return this.#A}#g;get ctime(){return this.#g}#C;get birthtime(){return this.#C}#x;#E;#S;#R;#d;#k;#i;#P;#v;#N;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,e=W,s,r,n,o,a){this.name=t,this.#x=n?ye(t):te(t),this.#i=e&na,this.nocase=n,this.roots=r,this.root=s||this,this.#P=o,this.#S=a.fullpath,this.#d=a.relative,this.#k=a.relativePosix,this.parent=a.parent,this.parent?this.#t=this.parent.#t:this.#t=ji(a.fs)}depth(){return this.#E!==void 0?this.#E:this.parent?this.#E=this.parent.depth()+1:this.#E=0}childrenCache(){return this.#P}resolve(t){if(!t)return this;let e=this.getRootString(t),r=t.substring(e.length).split(this.splitSep);return e?this.getRoot(e).#T(r):this.#T(r)}#T(t){let e=this;for(let s of t)e=e.child(s);return e}children(){let t=this.#P.get(this);if(t)return t;let e=Object.assign([],{provisional:0});return this.#P.set(this,e),this.#i&=~rs,e}child(t,e){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let s=this.children(),r=this.nocase?ye(t):te(t);for(let h of s)if(h.#x===r)return h;let n=this.parent?this.sep:"",o=this.#S?this.#S+n+t:void 0,a=this.newChild(t,W,{...e,parent:this,fullpath:o});return this.canReaddir()||(a.#i|=G),s.push(a),a}relative(){if(this.isCWD)return"";if(this.#d!==void 0)return this.#d;let t=this.name,e=this.parent;if(!e)return this.#d=this.name;let s=e.relative();return s+(!s||!e.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#k!==void 0)return this.#k;let t=this.name,e=this.parent;if(!e)return this.#k=this.fullpathPosix();let s=e.relativePosix();return s+(!s||!e.parent?"":"/")+t}fullpath(){if(this.#S!==void 0)return this.#S;let t=this.name,e=this.parent;if(!e)return this.#S=this.name;let r=e.fullpath()+(e.parent?this.sep:"")+t;return this.#S=r}fullpathPosix(){if(this.#R!==void 0)return this.#R;if(this.sep==="/")return this.#R=this.fullpath();if(!this.parent){let r=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(r)?this.#R=`//?/${r}`:this.#R=r}let t=this.parent,e=t.fullpathPosix(),s=e+(!e||!t.parent?"":"/")+this.name;return this.#R=s}isUnknown(){return(this.#i&$)===W}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(this.#i&$)===zi}isDirectory(){return(this.#i&$)===Y}isCharacterDevice(){return(this.#i&$)===Wi}isBlockDevice(){return(this.#i&$)===Bi}isFIFO(){return(this.#i&$)===$i}isSocket(){return(this.#i&$)===Gi}isSymbolicLink(){return(this.#i&ut)===ut}lstatCached(){return this.#i&Li?this:void 0}readlinkCached(){return this.#v}realpathCached(){return this.#N}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#v)return!0;if(!this.parent)return!1;let t=this.#i&$;return!(t!==W&&t!==ut||this.#i&we||this.#i&G)}calledReaddir(){return!!(this.#i&rs)}isENOENT(){return!!(this.#i&G)}isNamed(t){return this.nocase?this.#x===ye(t):this.#x===te(t)}async readlink(){let t=this.#v;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=await this.#t.promises.readlink(this.fullpath()),s=(await this.parent.realpath())?.resolve(e);if(s)return this.#v=s}catch(e){this.#I(e.code);return}}readlinkSync(){let t=this.#v;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=this.#t.readlinkSync(this.fullpath()),s=this.parent.realpathSync()?.resolve(e);if(s)return this.#v=s}catch(e){this.#I(e.code);return}}#$(t){this.#i|=rs;for(let e=t.provisional;e<t.length;e++){let s=t[e];s&&s.#L()}}#L(){this.#i&G||(this.#i=(this.#i|G)&Xt,this.#M())}#M(){let t=this.children();t.provisional=0;for(let e of t)e.#L()}#W(){this.#i|=Se,this.#O()}#O(){if(this.#i&Qt)return;let t=this.#i;(t&$)===Y&&(t&=Xt),this.#i=t|Qt,this.#M()}#_(t=""){t==="ENOTDIR"||t==="EPERM"?this.#O():t==="ENOENT"?this.#L():this.children().provisional=0}#B(t=""){t==="ENOTDIR"?this.parent.#O():t==="ENOENT"&&this.#L()}#I(t=""){let e=this.#i;e|=we,t==="ENOENT"&&(e|=G),(t==="EINVAL"||t==="UNKNOWN")&&(e&=Xt),this.#i=e,t==="ENOTDIR"&&this.parent&&this.parent.#O()}#F(t,e){return this.#z(t,e)||this.#l(t,e)}#l(t,e){let s=ns(t),r=this.newChild(t.name,s,{parent:this}),n=r.#i&$;return n!==Y&&n!==ut&&n!==W&&(r.#i|=Qt),e.unshift(r),e.provisional++,r}#z(t,e){for(let s=e.provisional;s<e.length;s++){let r=e[s];if((this.nocase?ye(t.name):te(t.name))===r.#x)return this.#j(t,r,s,e)}}#j(t,e,s,r){let n=e.name;return e.#i=e.#i&Xt|ns(t),n!==t.name&&(e.name=t.name),s!==r.provisional&&(s===r.length-1?r.pop():r.splice(s,1),r.unshift(e)),r.provisional++,e}async lstat(){if(!(this.#i&G))try{return this.#D(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#B(t.code)}}lstatSync(){if(!(this.#i&G))try{return this.#D(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#B(t.code)}}#D(t){let{atime:e,atimeMs:s,birthtime:r,birthtimeMs:n,blksize:o,blocks:a,ctime:h,ctimeMs:c,dev:l,gid:f,ino:u,mode:d,mtime:g,mtimeMs:p,nlink:y,rdev:m,size:b,uid:w}=t;this.#m=e,this.#s=s,this.#C=r,this.#p=n,this.#a=o,this.#c=a,this.#g=h,this.#y=c,this.#e=l,this.#b=f,this.#f=u,this.#n=d,this.#A=g,this.#u=p,this.#r=y,this.#w=m,this.#h=b,this.#o=w;let S=ns(t);this.#i=this.#i&Xt|S|Li,S!==W&&S!==Y&&S!==ut&&(this.#i|=Qt)}#U=[];#H=!1;#q(t){this.#H=!1;let e=this.#U.slice();this.#U.length=0,e.forEach(s=>s(null,t))}readdirCB(t,e=!1){if(!this.canReaddir()){e?t(null,[]):queueMicrotask(()=>t(null,[]));return}let s=this.children();if(this.calledReaddir()){let n=s.slice(0,s.provisional);e?t(null,n):queueMicrotask(()=>t(null,n));return}if(this.#U.push(t),this.#H)return;this.#H=!0;let r=this.fullpath();this.#t.readdir(r,{withFileTypes:!0},(n,o)=>{if(n)this.#_(n.code),s.provisional=0;else{for(let a of o)this.#F(a,s);this.#$(s)}this.#q(s.slice(0,s.provisional))})}#G;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.#G)await this.#G;else{let s=()=>{};this.#G=new Promise(r=>s=r);try{for(let r of await this.#t.promises.readdir(e,{withFileTypes:!0}))this.#F(r,t);this.#$(t)}catch(r){this.#_(r.code),t.provisional=0}this.#G=void 0,s()}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 s of this.#t.readdirSync(e,{withFileTypes:!0}))this.#F(s,t);this.#$(t)}catch(s){this.#_(s.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#i&Fi)return!1;let t=$&this.#i;return t===W||t===Y||t===ut}shouldWalk(t,e){return(this.#i&Y)===Y&&!(this.#i&Fi)&&!t.has(this)&&(!e||e(this))}async realpath(){if(this.#N)return this.#N;if(!((Se|we|G)&this.#i))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#N=this.resolve(t)}catch{this.#W()}}realpathSync(){if(this.#N)return this.#N;if(!((Se|we|G)&this.#i))try{let t=this.#t.realpathSync(this.fullpath());return this.#N=this.resolve(t)}catch{this.#W()}}[Hi](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let e=new Set([]),s=[],r=this;for(;r&&r.parent;)e.add(r),r.#d=s.join(this.sep),r.#k=s.join("/"),r=r.parent,s.push("..");for(r=t;r&&r.parent&&!e.has(r);)r.#d=void 0,r.#k=void 0,r=r.parent}},Ee=class i extends k{sep="\\";splitSep=ra;constructor(t,e=W,s,r,n,o,a){super(t,e,s,r,n,o,a)}newChild(t,e=W,s={}){return new i(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(t){return os.parse(t).root}getRoot(t){if(t=ia(t.toUpperCase()),t===this.root.name)return this.root;for(let[e,s]of Object.entries(this.roots))if(this.sameRoot(t,e))return this.roots[t]=s;return this.roots[t]=new Tt(t,this).root}sameRoot(t,e=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(Ui,"$1\\"),t===e}},xe=class i extends k{splitSep="/";sep="/";constructor(t,e=W,s,r,n,o,a){super(t,e,s,r,n,o,a)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,e=W,s={}){return new i(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}},ve=class{root;rootPath;roots;cwd;#t;#e;#n;nocase;#r;constructor(t=process.cwd(),e,s,{nocase:r,childrenCacheSize:n=16*1024,fs:o=Zt}={}){this.#r=ji(o),(t instanceof URL||t.startsWith("file://"))&&(t=Ho(t));let a=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#t=new be,this.#e=new be,this.#n=new as(n);let h=a.substring(this.rootPath.length).split(s);if(h.length===1&&!h[0]&&h.pop(),r===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=r,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let c=this.root,l=h.length-1,f=e.sep,u=this.rootPath,d=!1;for(let g of h){let p=l--;c=c.child(g,{relative:new Array(p).fill("..").join(f),relativePosix:new Array(p).fill("..").join("/"),fullpath:u+=(d?"":f)+g}),d=!0}this.cwd=c}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#n}resolve(...t){let e="";for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=this.#t.get(e);if(s!==void 0)return s;let r=this.cwd.resolve(e).fullpath();return this.#t.set(e,r),r}resolvePosix(...t){let e="";for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=this.#e.get(e);if(s!==void 0)return s;let r=this.cwd.resolve(e).fullpathPosix();return this.#e.set(e,r),r}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd);let{withFileTypes:s}=e;if(t.canReaddir()){let r=await t.readdir();return s?r:r.map(n=>n.name)}else return[]}readdirSync(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd);let{withFileTypes:s=!0}=e;return t.canReaddir()?s?t.readdirSync():t.readdirSync().map(r=>r.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t.withFileTypes,t=this.cwd);let s=await t.readlink();return e?s:s?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t.withFileTypes,t=this.cwd);let s=t.readlinkSync();return e?s:s?.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t.withFileTypes,t=this.cwd);let s=await t.realpath();return e?s:s?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t.withFileTypes,t=this.cwd);let s=t.realpathSync();return e?s:s?.fullpath()}async walk(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:o}=e,a=[];(!n||n(t))&&a.push(s?t:t.fullpath());let h=new Set,c=(f,u)=>{h.add(f),f.readdirCB((d,g)=>{if(d)return u(d);let p=g.length;if(!p)return u();let y=()=>{--p===0&&u()};for(let m of g)(!n||n(m))&&a.push(s?m:m.fullpath()),r&&m.isSymbolicLink()?m.realpath().then(b=>b?.isUnknown()?b.lstat():b).then(b=>b?.shouldWalk(h,o)?c(b,y):y()):m.shouldWalk(h,o)?c(m,y):y()},!0)},l=t;return new Promise((f,u)=>{c(l,d=>{if(d)return u(d);f(a)})})}walkSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:o}=e,a=[];(!n||n(t))&&a.push(s?t:t.fullpath());let h=new Set([t]);for(let c of h){let l=c.readdirSync();for(let f of l){(!n||n(f))&&a.push(s?f:f.fullpath());let u=f;if(f.isSymbolicLink()){if(!(r&&(u=f.realpathSync())))continue;u.isUnknown()&&u.lstatSync()}u.shouldWalk(h,o)&&h.add(u)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd),this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:o}=e;(!n||n(t))&&(yield s?t:t.fullpath());let a=new Set([t]);for(let h of a){let c=h.readdirSync();for(let l of c){(!n||n(l))&&(yield s?l:l.fullpath());let f=l;if(l.isSymbolicLink()){if(!(r&&(f=l.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(a,o)&&a.add(f)}}}stream(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:o}=e,a=new ot({objectMode:!0});(!n||n(t))&&a.write(s?t:t.fullpath());let h=new Set,c=[t],l=0,f=()=>{let u=!1;for(;!u;){let d=c.shift();if(!d){l===0&&a.end();return}l++,h.add(d);let g=(y,m,b=!1)=>{if(y)return a.emit("error",y);if(r&&!b){let w=[];for(let S of m)S.isSymbolicLink()&&w.push(S.realpath().then(E=>E?.isUnknown()?E.lstat():E));if(w.length){Promise.all(w).then(()=>g(null,m,!0));return}}for(let w of m)w&&(!n||n(w))&&(a.write(s?w:w.fullpath())||(u=!0));l--;for(let w of m){let S=w.realpathCached()||w;S.shouldWalk(h,o)&&c.push(S)}u&&!a.flowing?a.once("drain",f):p||f()},p=!0;d.readdirCB(g,!0),p=!1}};return f(),a}streamSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:o}=e,a=new ot({objectMode:!0}),h=new Set;(!n||n(t))&&a.write(s?t:t.fullpath());let c=[t],l=0,f=()=>{let u=!1;for(;!u;){let d=c.shift();if(!d){l===0&&a.end();return}l++,h.add(d);let g=d.readdirSync();for(let p of g)(!n||n(p))&&(a.write(s?p:p.fullpath())||(u=!0));l--;for(let p of g){let y=p;if(p.isSymbolicLink()){if(!(r&&(y=p.realpathSync())))continue;y.isUnknown()&&y.lstatSync()}y.shouldWalk(h,o)&&c.push(y)}}u&&!a.flowing&&a.once("drain",f)};return f(),a}chdir(t=this.cwd){let e=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[Hi](e)}},Tt=class extends ve{sep="\\";constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,os,"\\",{...e,nocase:s}),this.nocase=s;for(let r=this.cwd;r;r=r.parent)r.nocase=this.nocase}parseRootPath(t){return os.parse(t).root.toUpperCase()}newRoot(t){return new Ee(this.rootPath,Y,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},Rt=class extends ve{sep="/";constructor(t=process.cwd(),e={}){let{nocase:s=!1}=e;super(t,Go,"/",{...e,nocase:s}),this.nocase=s}parseRootPath(t){return"/"}newRoot(t){return new xe(this.rootPath,Y,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},ee=class extends Rt{constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,{...e,nocase:s})}},cl=process.platform==="win32"?Ee:xe,qi=process.platform==="win32"?Tt:process.platform==="darwin"?ee:Rt;var oa=i=>i.length>=1,aa=i=>i.length>=1,Ot=class i{#t;#e;#n;length;#r;#o;#b;#w;#a;#f;#h=!0;constructor(t,e,s,r){if(!oa(t))throw new TypeError("empty pattern list");if(!aa(e))throw new TypeError("empty glob list");if(e.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#e=e,this.#n=s,this.#r=r,this.#n===0){if(this.isUNC()){let[n,o,a,h,...c]=this.#t,[l,f,u,d,...g]=this.#e;c[0]===""&&(c.shift(),g.shift());let p=[n,o,a,h,""].join("/"),y=[l,f,u,d,""].join("/");this.#t=[p,...c],this.#e=[y,...g],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[n,...o]=this.#t,[a,...h]=this.#e;o[0]===""&&(o.shift(),h.shift());let c=n+"/",l=a+"/";this.#t=[c,...o],this.#e=[l,...h],this.length=this.#t.length}}}pattern(){return this.#t[this.#n]}isString(){return typeof this.#t[this.#n]=="string"}isGlobstar(){return this.#t[this.#n]===A}isRegExp(){return this.#t[this.#n]instanceof RegExp}globString(){return this.#b=this.#b||(this.#n===0?this.isAbsolute()?this.#e[0]+this.#e.slice(1).join("/"):this.#e.join("/"):this.#e.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new i(this.#t,this.#e,this.#n+1,this.#r),this.#o.#f=this.#f,this.#o.#a=this.#a,this.#o.#w=this.#w,this.#o):this.#o=null}isUNC(){let t=this.#t;return this.#a!==void 0?this.#a:this.#a=this.#r==="win32"&&this.#n===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3]}isDrive(){let t=this.#t;return this.#w!==void 0?this.#w:this.#w=this.#r==="win32"&&this.#n===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#f!==void 0?this.#f:this.#f=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#n===0?t:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#h)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#h?!1:(this.#h=!1,!0)}};var ha=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",At=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:e,nocase:s,noext:r,noglobstar:n,platform:o=ha}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:e,nocase:s,noext:r,noglobstar:n,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of t)this.add(a)}add(t){let e=new I(t,this.mmopts);for(let s=0;s<e.set.length;s++){let r=e.set[s],n=e.globParts[s];if(!r||!n)throw new Error("invalid pattern object");for(;r[0]==="."&&n[0]===".";)r.shift(),n.shift();let o=new Ot(r,n,0,this.platform),a=new I(o.globString(),this.mmopts),h=n[n.length-1]==="**",c=o.isAbsolute();c?this.absolute.push(a):this.relative.push(a),h&&(c?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(t){let e=t.fullpath(),s=`${e}/`,r=t.relative()||".",n=`${r}/`;for(let o of this.relative)if(o.match(r)||o.match(n))return!0;for(let o of this.absolute)if(o.match(e)||o.match(s))return!0;return!1}childrenIgnored(t){let e=t.fullpath()+"/",s=(t.relative()||".")+"/";for(let r of this.relativeChildren)if(r.match(s))return!0;for(let r of this.absoluteChildren)if(r.match(e))return!0;return!1}};var hs=class i{store;constructor(t=new Map){this.store=t}copy(){return new i(new Map(this.store))}hasWalked(t,e){return this.store.get(t.fullpath())?.has(e.globString())}storeWalked(t,e){let s=t.fullpath(),r=this.store.get(s);r?r.add(e.globString()):this.store.set(s,new Set([e.globString()]))}},cs=class{store=new Map;add(t,e,s){let r=(e?2:0)|(s?1:0),n=this.store.get(t);this.store.set(t,n===void 0?r:r&n)}entries(){return[...this.store.entries()].map(([t,e])=>[t,!!(e&2),!!(e&1)])}},ls=class{store=new Map;add(t,e){if(!t.canReaddir())return;let s=this.store.get(t);s?s.find(r=>r.globString()===e.globString())||s.push(e):this.store.set(t,[e])}get(t){let e=this.store.get(t);if(!e)throw new 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())}},se=class i{hasWalkedCache;matches=new cs;subwalks=new ls;patterns;follow;dot;opts;constructor(t,e){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=e?e.copy():new hs}processPatterns(t,e){this.patterns=e;let s=e.map(r=>[t,r]);for(let[r,n]of s){this.hasWalkedCache.storeWalked(r,n);let o=n.root(),a=n.isAbsolute()&&this.opts.absolute!==!1;if(o){r=r.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let f=n.rest();if(f)n=f;else{this.matches.add(r,!0,!1);continue}}if(r.isENOENT())continue;let h,c,l=!1;for(;typeof(h=n.pattern())=="string"&&(c=n.rest());)r=r.resolve(h),n=c,l=!0;if(h=n.pattern(),c=n.rest(),l){if(this.hasWalkedCache.hasWalked(r,n))continue;this.hasWalkedCache.storeWalked(r,n)}if(typeof h=="string"){let f=h===".."||h===""||h===".";this.matches.add(r.resolve(h),a,f);continue}else if(h===A){(!r.isSymbolicLink()||this.follow||n.checkFollowGlobstar())&&this.subwalks.add(r,n);let f=c?.pattern(),u=c?.rest();if(!c||(f===""||f===".")&&!u)this.matches.add(r,a,f===""||f===".");else if(f===".."){let d=r.parent||r;u?this.hasWalkedCache.hasWalked(d,u)||this.subwalks.add(d,u):this.matches.add(d,a,!0)}}else h instanceof RegExp&&this.subwalks.add(r,n)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new i(this.opts,this.hasWalkedCache)}filterEntries(t,e){let s=this.subwalks.get(t),r=this.child();for(let n of e)for(let o of s){let a=o.isAbsolute(),h=o.pattern(),c=o.rest();h===A?r.testGlobstar(n,o,c,a):h instanceof RegExp?r.testRegExp(n,h,c,a):r.testString(n,h,c,a)}return r}testGlobstar(t,e,s,r){if((this.dot||!t.name.startsWith("."))&&(e.hasMore()||this.matches.add(t,r,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,e):t.isSymbolicLink()&&(s&&e.checkFollowGlobstar()?this.subwalks.add(t,s):e.markFollowGlobstar()&&this.subwalks.add(t,e)))),s){let n=s.pattern();if(typeof n=="string"&&n!==".."&&n!==""&&n!==".")this.testString(t,n,s.rest(),r);else if(n===".."){let o=t.parent||t;this.subwalks.add(o,s)}else n instanceof RegExp&&this.testRegExp(t,n,s.rest(),r)}}testRegExp(t,e,s,r){e.test(t.name)&&(s?this.subwalks.add(t,s):this.matches.add(t,r,!1))}testString(t,e,s,r){t.isNamed(e)&&(s?this.subwalks.add(t,s):this.matches.add(t,r,!1))}};var ca=(i,t)=>typeof i=="string"?new At([i],t):Array.isArray(i)?new At(i,t):i,Te=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#e;#n;signal;maxDepth;includeChildMatches;constructor(t,e,s){if(this.patterns=t,this.path=e,this.opts=s,this.#n=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#e=ca(s.ignore??[],s),!this.includeChildMatches&&typeof this.#e.add!="function")){let r="cannot ignore child matches, ignore lacks add() method.";throw new Error(r)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#r(t){return this.seen.has(t)||!!this.#e?.ignored?.(t)}#o(t){return!!this.#e?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.signal?.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||await t.realpath(),!s)return;t=s}let n=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&n?.isSymbolicLink()){let o=await n.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(n,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.#r(t)?t:void 0}matchCheckSync(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||t.realpathSync(),!s)return;t=s}let n=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&n?.isSymbolicLink()){let o=n.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(n,e)}matchFinish(t,e){if(this.#r(t))return;if(!this.includeChildMatches&&this.#e?.add){let n=`${t.relativePosix()}/**`;this.#e.add(n)}let s=this.opts.absolute===void 0?e:this.opts.absolute;this.seen.add(t);let r=this.opts.mark&&t.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(s){let n=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(n+r)}else{let n=this.opts.posix?t.relativePosix():t.relative(),o=this.opts.dotRelative&&!n.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(n?o+n+r:"."+r)}}async match(t,e,s){let r=await this.matchCheck(t,s);r&&this.matchFinish(r,e)}matchSync(t,e,s){let r=this.matchCheckSync(t,s);r&&this.matchFinish(r,e)}walkCB(t,e,s){this.signal?.aborted&&s(),this.walkCB2(t,e,new se(this.opts),s)}walkCB2(t,e,s,r){if(this.#o(t))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2(t,e,s,r));return}s.processPatterns(t,e);let n=1,o=()=>{--n===0&&r()};for(let[a,h,c]of s.matches.entries())this.#r(a)||(n++,this.match(a,h,c).then(()=>o()));for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;n++;let h=a.readdirCached();a.calledReaddir()?this.walkCB3(a,h,s,o):a.readdirCB((c,l)=>this.walkCB3(a,l,s,o),!0)}o()}walkCB3(t,e,s,r){s=s.filterEntries(t,e);let n=1,o=()=>{--n===0&&r()};for(let[a,h,c]of s.matches.entries())this.#r(a)||(n++,this.match(a,h,c).then(()=>o()));for(let[a,h]of s.subwalks.entries())n++,this.walkCB2(a,h,s.child(),o);o()}walkCBSync(t,e,s){this.signal?.aborted&&s(),this.walkCB2Sync(t,e,new se(this.opts),s)}walkCB2Sync(t,e,s,r){if(this.#o(t))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2Sync(t,e,s,r));return}s.processPatterns(t,e);let n=1,o=()=>{--n===0&&r()};for(let[a,h,c]of s.matches.entries())this.#r(a)||this.matchSync(a,h,c);for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;n++;let h=a.readdirSync();this.walkCB3Sync(a,h,s,o)}o()}walkCB3Sync(t,e,s,r){s=s.filterEntries(t,e);let n=1,o=()=>{--n===0&&r()};for(let[a,h,c]of s.matches.entries())this.#r(a)||this.matchSync(a,h,c);for(let[a,h]of s.subwalks.entries())n++,this.walkCB2Sync(a,h,s.child(),o);o()}},ie=class extends Te{matches=new Set;constructor(t,e,s){super(t,e,s)}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}},re=class extends Te{results;constructor(t,e,s){super(t,e,s),this.results=new ot({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}};var fa=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",H=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 new 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=la(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=e.includeChildMatches!==!1,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(h=>h.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(h=>h.includes("/")?h:`./**/${h}`)}if(this.pattern=t,this.platform=e.platform||fa,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,e.nocase!==void 0&&e.nocase!==e.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let h=e.platform==="win32"?Tt:e.platform==="darwin"?ee:e.platform?Rt:qi;this.scurry=new h(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",r={...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},n=this.pattern.map(h=>new I(h,r)),[o,a]=n.reduce((h,c)=>(h[0].push(...c.set),h[1].push(...c.globParts),h),[[],[]]);this.patterns=o.map((h,c)=>{let l=a[c];if(!l)throw new Error("invalid pattern object");return new Ot(h,l,0,this.platform)})}async walk(){return[...await new ie(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 ie(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 re(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 re(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()}};var fs=(i,t={})=>{Array.isArray(i)||(i=[i]);for(let e of i)if(new I(e,t).hasMagic())return!0;return!1};function Oe(i,t={}){return new H(i,t).streamSync()}function Ki(i,t={}){return new H(i,t).stream()}function Ae(i,t={}){return new H(i,t).walkSync()}async function Vi(i,t={}){return new H(i,t).walk()}function Ce(i,t={}){return new H(i,t).iterateSync()}function Yi(i,t={}){return new H(i,t).iterate()}var ua=Oe,da=Object.assign(Ki,{sync:Oe}),pa=Ce,ma=Object.assign(Yi,{sync:Ce}),ga=Object.assign(Ae,{stream:Oe,iterate:Ce}),Re=Object.assign(Vi,{glob:Vi,globSync:Ae,sync:ga,globStream:Ki,stream:da,globStreamSync:Oe,streamSync:ua,globIterate:Yi,iterate:ma,globIterateSync:Ce,iterateSync:pa,Glob:H,hasMagic:fs,escape:St,unescape:B});Re.glob=Re;var at=(i,t)=>typeof i>"u"||typeof i===t,Ji=i=>!!i&&typeof i=="object"&&at(i.preserveRoot,"boolean")&&at(i.tmp,"string")&&at(i.maxRetries,"number")&&at(i.retryDelay,"number")&&at(i.backoff,"number")&&at(i.maxBackoff,"number")&&(at(i.glob,"boolean")||i.glob&&typeof i.glob=="object")&&at(i.filter,"function"),Xi=i=>{if(!Ji(i))throw new Error("invalid rimraf options")},Zi=i=>{Xi(i);let{glob:t,...e}=i;if(!t)return e;let s=t===!0?i.signal?{signal:i.signal}:{}:i.signal?{signal:i.signal,...t}:t;return{...e,glob:{...s,absolute:!0,withFileTypes:!1}}},Qi=(i={})=>Zi(i),tr=(i={})=>Zi(i);import{parse as er,resolve as wa}from"path";import{inspect as ya}from"util";var q=process.env.__TESTING_RIMRAF_PLATFORM__||process.platform;var Sa=(i,t={})=>{let e=typeof i;if(e!=="string"){let r=i&&e==="object"&&i.constructor,o=`The "path" argument must be of type string. Received ${r&&r.name?`an instance of ${r.name}`:e==="object"?ya(i):`type ${e} ${i}`}`;throw Object.assign(new TypeError(o),{path:i,code:"ERR_INVALID_ARG_TYPE"})}if(/\0/.test(i)){let r="path must be a string without null bytes";throw Object.assign(new TypeError(r),{path:i,code:"ERR_INVALID_ARG_VALUE"})}i=wa(i);let{root:s}=er(i);if(i===s&&t.preserveRoot!==!1){let r="refusing to remove root directory without preserveRoot:false";throw Object.assign(new Error(r),{path:i,code:"ERR_PRESERVE_ROOT"})}if(q==="win32"){let r=/[*|"<>?:]/,{root:n}=er(i);if(r.test(i.substring(n.length)))throw Object.assign(new Error("Illegal characters in path."),{path:i,code:"EINVAL"})}return i},ne=Sa;import Q from"fs";import{chmodSync as _e,mkdirSync as Kl,renameSync as ir,rmdirSync as Ct,rmSync as rr,statSync as nr,lstatSync as _t,unlinkSync as kt}from"fs";import{readdirSync as ba}from"fs";var sr=i=>ba(i,{withFileTypes:!0}),Ea=(i,t)=>new Promise((e,s)=>Q.chmod(i,t,(r,...n)=>r?s(r):e(...n))),xa=(i,t)=>new Promise((e,s)=>Q.mkdir(i,t,(r,n)=>r?s(r):e(n))),va=i=>new Promise((t,e)=>Q.readdir(i,{withFileTypes:!0},(s,r)=>s?e(s):t(r))),Ta=(i,t)=>new Promise((e,s)=>Q.rename(i,t,(r,...n)=>r?s(r):e(...n))),Ra=(i,t)=>new Promise((e,s)=>Q.rm(i,t,(r,...n)=>r?s(r):e(...n))),Oa=i=>new Promise((t,e)=>Q.rmdir(i,(s,...r)=>s?e(s):t(...r))),Aa=i=>new Promise((t,e)=>Q.stat(i,(s,r)=>s?e(s):t(r))),Ca=i=>new Promise((t,e)=>Q.lstat(i,(s,r)=>s?e(s):t(r))),_a=i=>new Promise((t,e)=>Q.unlink(i,(s,...r)=>s?e(s):t(...r))),F={chmod:Ea,mkdir:xa,readdir:va,rename:Ta,rm:Ra,rmdir:Oa,stat:Aa,lstat:Ca,unlink:_a};import{parse as or,resolve as ar}from"path";var{readdir:ka}=F,Nt=i=>ka(i).catch(t=>t),Dt=i=>{try{return sr(i)}catch(t){return t}};var tt=async i=>i.catch(t=>{if(t.code!=="ENOENT")throw t}),et=i=>{try{return i()}catch(t){if(t?.code!=="ENOENT")throw t}};var{lstat:Na,rmdir:Da,unlink:Pa}=F,ke=async(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return await hr(i,t,await Na(i))}catch(e){if(e?.code==="ENOENT")return!0;throw e}},Ne=(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return cr(i,t,_t(i))}catch(e){if(e?.code==="ENOENT")return!0;throw e}},hr=async(i,t,e)=>{if(t?.signal?.aborted)throw t.signal.reason;let s=e.isDirectory()?await Nt(i):null;if(!Array.isArray(s)){if(s){if(s.code==="ENOENT")return!0;if(s.code!=="ENOTDIR")throw s}return t.filter&&!await t.filter(i,e)?!1:(await tt(Pa(i)),!0)}return!(await Promise.all(s.map(n=>hr(ar(i,n.name),t,n)))).reduce((n,o)=>n&&o,!0)||t.preserveRoot===!1&&i===or(i).root||t.filter&&!await t.filter(i,e)?!1:(await tt(Da(i)),!0)},cr=(i,t,e)=>{if(t?.signal?.aborted)throw t.signal.reason;let s=e.isDirectory()?Dt(i):null;if(!Array.isArray(s)){if(s){if(s.code==="ENOENT")return!0;if(s.code!=="ENOTDIR")throw s}return t.filter&&!t.filter(i,e)?!1:(et(()=>kt(i)),!0)}let r=!0;for(let n of s){let o=ar(i,n.name);r=cr(o,t,n)&&r}return t.preserveRoot===!1&&i===or(i).root||!r||t.filter&&!t.filter(i,e)?!1:(et(()=>Ct(i)),!0)};import{parse as yr,resolve as Sr}from"path";var{chmod:La}=F,us=i=>async t=>{try{return await i(t)}catch(e){let s=e;if(s?.code==="ENOENT")return;if(s?.code==="EPERM"){try{await La(t,438)}catch(r){if(r?.code==="ENOENT")return;throw e}return await i(t)}throw e}},ds=i=>t=>{try{return i(t)}catch(e){let s=e;if(s?.code==="ENOENT")return;if(s?.code==="EPERM"){try{_e(t,438)}catch(r){if(r?.code==="ENOENT")return;throw e}return i(t)}throw e}};var lr=new Set(["EMFILE","ENFILE","EBUSY"]),ps=i=>{let t=async(e,s,r=1,n=0)=>{let o=s.maxBackoff||200,a=s.backoff||1.2,h=s.maxRetries||10,c=0;for(;;)try{return await i(e)}catch(l){let f=l;if(f?.path===e&&f?.code&&lr.has(f.code)){if(r=Math.ceil(r*a),n=r+n,n<o)return new Promise((u,d)=>{setTimeout(()=>{t(e,s,r,n).then(u,d)},r)});if(c<h){c++;continue}}throw l}};return t},ms=i=>(e,s)=>{let r=s.maxRetries||10,n=0;for(;;)try{return i(e)}catch(o){let a=o;if(a?.path===e&&a?.code&&lr.has(a.code)&&n<r){n++;continue}throw o}};import{basename as Ba,parse as Le,resolve as Fe}from"path";import{tmpdir as Pe}from"os";import{parse as De,resolve as fr}from"path";var{stat:Fa}=F,Ma=i=>{try{return nr(i).isDirectory()}catch{return!1}},Ia=i=>Fa(i).then(t=>t.isDirectory(),()=>!1),ja=async i=>{let{root:t}=De(i),e=Pe(),{root:s}=De(e);if(t.toLowerCase()===s.toLowerCase())return e;let r=fr(t,"/temp");return await Ia(r)?r:t},Ua=i=>{let{root:t}=De(i),e=Pe(),{root:s}=De(e);if(t.toLowerCase()===s.toLowerCase())return e;let r=fr(t,"/temp");return Ma(r)?r:t},$a=async()=>Pe(),Wa=()=>Pe(),ur=q==="win32"?ja:$a,dr=q==="win32"?Ua:Wa;var{lstat:za,rename:Ga,unlink:pr,rmdir:Ha,chmod:qa}=F,wr=i=>`.${Ba(i)}.${Math.random()}`,Va=async i=>pr(i).catch(t=>{if(t.code==="EPERM")return qa(i,438).then(()=>pr(i),e=>{if(e.code!=="ENOENT")throw t});if(t.code==="ENOENT")return;throw t}),Ka=i=>{try{kt(i)}catch(t){if(t?.code==="EPERM")try{return _e(i,438)}catch(e){if(e?.code==="ENOENT")return;throw t}else if(t?.code==="ENOENT")return;throw t}},Me=async(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return await gs(i,t,await za(i))}catch(e){if(e?.code==="ENOENT")return!0;throw e}},gs=async(i,t,e)=>{if(t?.signal?.aborted)throw t.signal.reason;if(!t.tmp)return gs(i,{...t,tmp:await ur(i)},e);if(i===t.tmp&&Le(i).root!==i)throw new Error("cannot delete temp directory used for deletion");let s=e.isDirectory()?await Nt(i):null;if(!Array.isArray(s)){if(s){if(s.code==="ENOENT")return!0;if(s.code!=="ENOTDIR")throw s}return t.filter&&!await t.filter(i,e)?!1:(await tt(mr(i,t.tmp,Va)),!0)}return!(await Promise.all(s.map(n=>gs(Fe(i,n.name),t,n)))).reduce((n,o)=>n&&o,!0)||t.preserveRoot===!1&&i===Le(i).root||t.filter&&!await t.filter(i,e)?!1:(await tt(mr(i,t.tmp,Ha)),!0)},mr=async(i,t,e)=>{let s=Fe(t,wr(i));return await Ga(i,s),await e(s)},Ie=(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return ws(i,t,_t(i))}catch(e){if(e?.code==="ENOENT")return!0;throw e}},ws=(i,t,e)=>{if(t?.signal?.aborted)throw t.signal.reason;if(!t.tmp)return ws(i,{...t,tmp:dr(i)},e);let s=t.tmp;if(i===t.tmp&&Le(i).root!==i)throw new Error("cannot delete temp directory used for deletion");let r=e.isDirectory()?Dt(i):null;if(!Array.isArray(r)){if(r){if(r.code==="ENOENT")return!0;if(r.code!=="ENOTDIR")throw r}return t.filter&&!t.filter(i,e)?!1:(et(()=>gr(i,s,Ka)),!0)}let n=!0;for(let o of r){let a=Fe(i,o.name);n=ws(a,t,o)&&n}return!n||t.preserveRoot===!1&&i===Le(i).root||t.filter&&!t.filter(i,e)?!1:(et(()=>gr(i,s,Ct)),!0)},gr=(i,t,e)=>{let s=Fe(t,wr(i));return ir(i,s),e(s)};var{unlink:Ya,rmdir:Ja,lstat:Xa}=F,Za=ps(us(Ya)),Qa=ms(ds(kt)),th=ps(us(Ja)),eh=ms(ds(Ct)),sh=async(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;let{filter:e,...s}=t;try{return await th(i,s)}catch(r){if(r?.code==="ENOTEMPTY")return await Me(i,s);throw r}},ih=(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;let{filter:e,...s}=t;try{return eh(i,s)}catch(r){if(r?.code==="ENOTEMPTY")return Ie(i,s);throw r}},ht=Symbol("start"),br=Symbol("child"),je=Symbol("finish"),Ue=async(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return await ys(i,t,await Xa(i),ht)}catch(e){if(e?.code==="ENOENT")return!0;throw e}},$e=(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return Ss(i,t,_t(i),ht)}catch(e){if(e?.code==="ENOENT")return!0;throw e}},ys=async(i,t,e,s=ht)=>{if(t?.signal?.aborted)throw t.signal.reason;let r=e.isDirectory()?await Nt(i):null;if(!Array.isArray(r)){if(r){if(r.code==="ENOENT")return!0;if(r.code!=="ENOTDIR")throw r}return t.filter&&!await t.filter(i,e)?!1:(await tt(Za(i,t)),!0)}let n=s===ht?br:s,o=(await Promise.all(r.map(a=>ys(Sr(i,a.name),t,a,n)))).reduce((a,h)=>a&&h,!0);if(s===ht)return ys(i,t,e,je);if(s===je){if(t.preserveRoot===!1&&i===yr(i).root||!o||t.filter&&!await t.filter(i,e))return!1;await tt(sh(i,t))}return!0},Ss=(i,t,e,s=ht)=>{let r=e.isDirectory()?Dt(i):null;if(!Array.isArray(r)){if(r){if(r.code==="ENOENT")return!0;if(r.code!=="ENOTDIR")throw r}return t.filter&&!t.filter(i,e)?!1:(et(()=>Qa(i,t)),!0)}let n=!0;for(let o of r){let a=s===ht?br:s,h=Sr(i,o.name);n=Ss(h,t,o,a)&&n}if(s===ht)return Ss(i,t,e,je);if(s===je){if(t.preserveRoot===!1&&i===yr(i).root||!n||t.filter&&!t.filter(i,e))return!1;et(()=>{ih(i,t)})}return!0};var bs=q==="win32"?Ue:ke,Es=q==="win32"?$e:Ne;var{rm:rh}=F,xs=async(i,t)=>(await rh(i,{...t,force:!0,recursive:!0}),!0),vs=(i,t)=>(rr(i,{...t,force:!0,recursive:!0}),!0);var nh=process.env.__TESTING_RIMRAF_NODE_VERSION__||process.version,oh=nh.replace(/^v/,"").split("."),[Er=0,ah=0]=oh.map(i=>parseInt(i,10)),xr=Er>14||Er===14&&ah>=14,vr=!xr||q==="win32"?()=>!1:i=>!i?.signal&&!i?.filter,Tr=!xr||q==="win32"?()=>!1:i=>!i?.signal&&!i?.filter;var Pt=i=>async(t,e)=>{let s=Qi(e);return s.glob&&(t=await Re(t,s.glob)),Array.isArray(t)?!!(await Promise.all(t.map(r=>i(ne(r,s),s)))).reduce((r,n)=>r&&n,!0):!!await i(ne(t,s),s)},Lt=i=>(t,e)=>{let s=tr(e);return s.glob&&(t=Ae(t,s.glob)),Array.isArray(t)?!!t.map(r=>i(ne(r,s),s)).reduce((r,n)=>r&&n,!0):!!i(ne(t,s),s)},Ar=Lt(vs),hh=Object.assign(Pt(xs),{sync:Ar}),Cr=Lt(Es),ch=Object.assign(Pt(bs),{sync:Cr}),_r=Lt($e),lh=Object.assign(Pt(Ue),{sync:_r}),kr=Lt(Ne),fh=Object.assign(Pt(ke),{sync:kr}),Nr=Lt(Ie),uh=Object.assign(Pt(Me),{sync:Nr}),Ts=Lt((i,t)=>Tr(t)?vs(i,t):Es(i,t)),Dr=Ts,Rr=Pt((i,t)=>vr(t)?xs(i,t):bs(i,t)),Or=Object.assign(Rr,{rimraf:Rr,sync:Ts,rimrafSync:Ts,manual:ch,manualSync:Cr,native:hh,nativeSync:Ar,posix:fh,posixSync:kr,windows:lh,windowsSync:_r,moveRemove:uh,moveRemoveSync:Nr});Or.rimraf=Or;var Lr=ph(new URL(".",import.meta.url)),Os=Pr(Lr,"../builder/vite-config.js"),mh=Pr(Lr,"../builder/vite-entry-server.js");async function Fr({options:i,logger:t}){t.info(`Building template...
38
- `),i.clean&&Dr(dh.join(process.cwd(),"dist"));let e="production";i.ssr==="local"&&(e="development",process.env.NODE_ENV=e),i.ssr?(await Rs({configFile:Os,customLogger:t,mode:e,logLevel:i.logLevel,clearScreen:i.clearScreen,build:{ssrManifest:!0,emptyOutDir:!0}}),await Rs({configFile:Os,customLogger:t,mode:e,logLevel:i.logLevel,clearScreen:i.clearScreen,ssr:{target:"webworker"},build:{ssr:mh}})):await Rs({configFile:Os,customLogger:t,logLevel:i.logLevel,clearScreen:i.clearScreen,build:{emptyOutDir:!0}})}jt();mt();async function Mr({options:i,logger:t}){t.info("Logging out fom Enpage..."),M.clear(),t.info(`Done.
39
- `),process.exit(0)}var As;Ft.name("enpage").option("-l, --logLevel <level>","[string] info | warn | error | silent | debug").option("--clearScreen","[boolean] allow/disable clear screen when logging").option("--dry-run","[boolean] run command without making changes").hook("preAction",i=>{As=He(i.optsWithGlobals().logLevel,i.optsWithGlobals().clearScreen,!0),process.removeAllListeners("warning"),process.on("warning",t=>{t.name==="DeprecationWarning"&&t.message.includes("util.isArray")||As.warnOnce(`Warning: ${t.name} - ${t.message}`)})});Ft.command("build").description("Build template").option("--ssr [type]",`Enable server side rendering.
37
+ >>> no match, partial?`,t,u,e,d),u===h))}let p;if(typeof l=="string"?(p=f===l,this.debug("string match",l,f,p)):(p=l.test(f),this.debug("pattern match",l,f,p)),!p)return!1}if(o===h&&a===c)return!0;if(o===h)return s;if(a===c)return o===h-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return xi(this.pattern,this.options)}parse(t){Gt(t);let e=this.options;if(t==="**")return A;if(t==="")return"";let s,r=null;(s=t.match(uo))?r=e.dot?mo:po:(s=t.match(so))?r=(e.nocase?e.dot?oo:no:e.dot?ro:io)(s[1]):(s=t.match(go))?r=(e.nocase?e.dot?yo:wo:e.dot?So:bo)(s):(s=t.match(ao))?r=e.dot?co:ho:(s=t.match(lo))&&(r=fo);let n=wt.fromGlob(t,this.options).toMMPattern();return r&&typeof n=="object"&&Reflect.defineProperty(n,"test",{value:r}),n}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let e=this.options,s=e.noglobstar?vo:e.dot?To:Ro,r=new Set(e.nocase?["i"]:[]),n=t.map(h=>{let c=h.map(l=>{if(l instanceof RegExp)for(let f of l.flags.split(""))r.add(f);return typeof l=="string"?ko(l):l===A?A:l._src});return c.forEach((l,f)=>{let u=c[f+1],d=c[f-1];l!==A||d===A||(d===void 0?u!==void 0&&u!==A?c[f+1]="(?:\\/|"+s+"\\/)?"+u:c[f]=s:u===void 0?c[f-1]=d+"(?:\\/|"+s+")?":u!==A&&(c[f-1]=d+"(?:\\/|\\/"+s+"\\/)"+u,c[f+1]=A))}),c.filter(l=>l!==A).join("/")}).join("|"),[o,a]=t.length>1?["(?:",")"]:["",""];n="^"+o+n+a+"$",this.negate&&(n="^(?!"+n+").+$");try{this.regexp=new RegExp(n,[...r].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 s=this.options;this.isWindows&&(t=t.split("\\").join("/"));let r=this.slashSplit(t);this.debug(this.pattern,"split",r);let n=this.set;this.debug(this.pattern,"set",n);let o=r[r.length-1];if(!o)for(let a=r.length-2;!o&&a>=0;a--)o=r[a];for(let a=0;a<n.length;a++){let h=n[a],c=r;if(s.matchBase&&h.length===1&&(c=[o]),this.matchOne(c,h,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return P.defaults(t).Minimatch}};P.AST=wt;P.Minimatch=I;P.escape=yt;P.unescape=B;import{fileURLToPath as ha}from"node:url";var St=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ti=new Set,Ye=typeof process=="object"&&process?process:{},Ri=(i,t,e,s)=>{typeof Ye.emitWarning=="function"?Ye.emitWarning(i,t,e,s):console.error(`[${e}] ${t}: ${i}`)},le=globalThis.AbortController,vi=globalThis.AbortSignal;if(typeof le>"u"){vi=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(s,r){this._onabort.push(r)}},le=class{constructor(){t()}signal=new vi;abort(s){if(!this.signal.aborted){this.signal.reason=s,this.signal.aborted=!0;for(let r of this.signal._onabort)r(s);this.signal.onabort?.(s)}}};let i=Ye.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{i&&(i=!1,Ri("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",t))}}var No=i=>!Ti.has(i),Vc=Symbol("type"),rt=i=>i&&i===Math.floor(i)&&i>0&&isFinite(i),Oi=i=>rt(i)?i<=Math.pow(2,8)?Uint8Array:i<=Math.pow(2,16)?Uint16Array:i<=Math.pow(2,32)?Uint32Array:i<=Number.MAX_SAFE_INTEGER?bt:null:null,bt=class extends Array{constructor(t){super(t),this.fill(0)}},Je=class i{heap;length;static#t=!1;static create(t){let e=Oi(t);if(!e)return[];i.#t=!0;let s=new i(t,e);return i.#t=!1,s}constructor(t,e){if(!i.#t)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},qt=class i{#t;#e;#n;#r;#o;#b;#w;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#f;#h;#c;#s;#u;#y;#p;#m;#A;#g;#C;#x;#E;#S;#R;#d;#k;static unsafeExposeInternals(t){return{starts:t.#x,ttls:t.#E,sizes:t.#C,keyMap:t.#h,keyList:t.#c,valList:t.#s,next:t.#u,prev:t.#y,get head(){return t.#p},get tail(){return t.#m},free:t.#A,isBackgroundFetch:e=>t.#l(e),backgroundFetch:(e,s,r,n)=>t.#F(e,s,r,n),moveToTail:e=>t.#U(e),indexes:e=>t.#O(e),rindexes:e=>t.#_(e),isStale:e=>t.#T(e)}}get max(){return this.#t}get maxSize(){return this.#e}get calculatedSize(){return this.#f}get size(){return this.#a}get fetchMethod(){return this.#b}get memoMethod(){return this.#w}get dispose(){return this.#n}get onInsert(){return this.#r}get disposeAfter(){return this.#o}constructor(t){let{max:e=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:h,dispose:c,onInsert:l,disposeAfter:f,noDisposeOnSet:u,noUpdateTTL:d,maxSize:g=0,maxEntrySize:p=0,sizeCalculation:y,fetchMethod:m,memoMethod:b,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:E,allowStaleOnFetchAbort:v,ignoreFetchAbort:N}=t;if(e!==0&&!rt(e))throw new TypeError("max option must be a nonnegative integer");let V=e?Oi(e):Array;if(!V)throw new Error("invalid max value: "+e);if(this.#t=e,this.#e=g,this.maxEntrySize=p||this.#e,this.sizeCalculation=y,this.sizeCalculation){if(!this.#e&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(b!==void 0&&typeof b!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#w=b,m!==void 0&&typeof m!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#b=m,this.#R=!!m,this.#h=new Map,this.#c=new Array(e).fill(void 0),this.#s=new Array(e).fill(void 0),this.#u=new V(e),this.#y=new V(e),this.#p=0,this.#m=0,this.#A=Je.create(e),this.#a=0,this.#f=0,typeof c=="function"&&(this.#n=c),typeof l=="function"&&(this.#r=l),typeof f=="function"?(this.#o=f,this.#g=[]):(this.#o=void 0,this.#g=void 0),this.#S=!!this.#n,this.#k=!!this.#r,this.#d=!!this.#o,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!E,this.allowStaleOnFetchAbort=!!v,this.ignoreFetchAbort=!!N,this.maxEntrySize!==0){if(this.#e!==0&&!rt(this.#e))throw new TypeError("maxSize must be a positive integer if specified");if(!rt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#$()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=rt(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!rt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#i()}if(this.#t===0&&this.ttl===0&&this.#e===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#e){let L="LRU_CACHE_UNBOUNDED";No(L)&&(Ti.add(L),Ri("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",L,i))}}getRemainingTTL(t){return this.#h.has(t)?1/0:0}#i(){let t=new bt(this.#t),e=new bt(this.#t);this.#E=t,this.#x=e,this.#N=(n,o,a=St.now())=>{if(e[n]=o!==0?a:0,t[n]=o,o!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#T(n)&&this.#P(this.#c[n],"expire")},o+1);h.unref&&h.unref()}},this.#D=n=>{e[n]=t[n]!==0?St.now():0},this.#v=(n,o)=>{if(t[o]){let a=t[o],h=e[o];if(!a||!h)return;n.ttl=a,n.start=h,n.now=s||r();let c=n.now-h;n.remainingTTL=a-c}};let s=0,r=()=>{let n=St.now();if(this.ttlResolution>0){s=n;let o=setTimeout(()=>s=0,this.ttlResolution);o.unref&&o.unref()}return n};this.getRemainingTTL=n=>{let o=this.#h.get(n);if(o===void 0)return 0;let a=t[o],h=e[o];if(!a||!h)return 1/0;let c=(s||r())-h;return a-c},this.#T=n=>{let o=e[n],a=t[n];return!!a&&!!o&&(s||r())-o>a}}#D=()=>{};#v=()=>{};#N=()=>{};#T=()=>!1;#$(){let t=new bt(this.#t);this.#f=0,this.#C=t,this.#L=e=>{this.#f-=t[e],t[e]=0},this.#W=(e,s,r,n)=>{if(this.#l(s))return 0;if(!rt(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,e),!rt(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r},this.#M=(e,s,r)=>{if(t[e]=s,this.#e){let n=this.#e-t[e];for(;this.#f>n;)this.#I(!0)}this.#f+=t[e],r&&(r.entrySize=s,r.totalCalculatedSize=this.#f)}}#L=t=>{};#M=(t,e,s)=>{};#W=(t,e,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#O({allowStale:t=this.allowStale}={}){if(this.#a)for(let e=this.#m;!(!this.#B(e)||((t||!this.#T(e))&&(yield e),e===this.#p));)e=this.#y[e]}*#_({allowStale:t=this.allowStale}={}){if(this.#a)for(let e=this.#p;!(!this.#B(e)||((t||!this.#T(e))&&(yield e),e===this.#m));)e=this.#u[e]}#B(t){return t!==void 0&&this.#h.get(this.#c[t])===t}*entries(){for(let t of this.#O())this.#s[t]!==void 0&&this.#c[t]!==void 0&&!this.#l(this.#s[t])&&(yield[this.#c[t],this.#s[t]])}*rentries(){for(let t of this.#_())this.#s[t]!==void 0&&this.#c[t]!==void 0&&!this.#l(this.#s[t])&&(yield[this.#c[t],this.#s[t]])}*keys(){for(let t of this.#O()){let e=this.#c[t];e!==void 0&&!this.#l(this.#s[t])&&(yield e)}}*rkeys(){for(let t of this.#_()){let e=this.#c[t];e!==void 0&&!this.#l(this.#s[t])&&(yield e)}}*values(){for(let t of this.#O())this.#s[t]!==void 0&&!this.#l(this.#s[t])&&(yield this.#s[t])}*rvalues(){for(let t of this.#_())this.#s[t]!==void 0&&!this.#l(this.#s[t])&&(yield this.#s[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let s of this.#O()){let r=this.#s[s],n=this.#l(r)?r.__staleWhileFetching:r;if(n!==void 0&&t(n,this.#c[s],this))return this.get(this.#c[s],e)}}forEach(t,e=this){for(let s of this.#O()){let r=this.#s[s],n=this.#l(r)?r.__staleWhileFetching:r;n!==void 0&&t.call(e,n,this.#c[s],this)}}rforEach(t,e=this){for(let s of this.#_()){let r=this.#s[s],n=this.#l(r)?r.__staleWhileFetching:r;n!==void 0&&t.call(e,n,this.#c[s],this)}}purgeStale(){let t=!1;for(let e of this.#_({allowStale:!0}))this.#T(e)&&(this.#P(this.#c[e],"expire"),t=!0);return t}info(t){let e=this.#h.get(t);if(e===void 0)return;let s=this.#s[e],r=this.#l(s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(this.#E&&this.#x){let o=this.#E[e],a=this.#x[e];if(o&&a){let h=o-(St.now()-a);n.ttl=h,n.start=Date.now()}}return this.#C&&(n.size=this.#C[e]),n}dump(){let t=[];for(let e of this.#O({allowStale:!0})){let s=this.#c[e],r=this.#s[e],n=this.#l(r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(this.#E&&this.#x){o.ttl=this.#E[e];let a=St.now()-this.#x[e];o.start=Math.floor(Date.now()-a)}this.#C&&(o.size=this.#C[e]),t.unshift([s,o])}return t}load(t){this.clear();for(let[e,s]of t){if(s.start){let r=Date.now()-s.start;s.start=St.now()-r}this.set(e,s.value,s)}}set(t,e,s={}){if(e===void 0)return this.delete(t),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=s,{noUpdateTTL:c=this.noUpdateTTL}=s,l=this.#W(t,e,s.size||0,a);if(this.maxEntrySize&&l>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this.#P(t,"set"),this;let f=this.#a===0?void 0:this.#h.get(t);if(f===void 0)f=this.#a===0?this.#m:this.#A.length!==0?this.#A.pop():this.#a===this.#t?this.#I(!1):this.#a,this.#c[f]=t,this.#s[f]=e,this.#h.set(t,f),this.#u[this.#m]=f,this.#y[f]=this.#m,this.#m=f,this.#a++,this.#M(f,l,h),h&&(h.set="add"),c=!1,this.#k&&this.#r?.(e,t,"add");else{this.#U(f);let u=this.#s[f];if(e!==u){if(this.#R&&this.#l(u)){u.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=u;d!==void 0&&!o&&(this.#S&&this.#n?.(d,t,"set"),this.#d&&this.#g?.push([d,t,"set"]))}else o||(this.#S&&this.#n?.(u,t,"set"),this.#d&&this.#g?.push([u,t,"set"]));if(this.#L(f),this.#M(f,l,h),this.#s[f]=e,h){h.set="replace";let d=u&&this.#l(u)?u.__staleWhileFetching:u;d!==void 0&&(h.oldValue=d)}}else h&&(h.set="update");this.#k&&this.onInsert?.(e,t,e===u?"update":"replace")}if(r!==0&&!this.#E&&this.#i(),this.#E&&(c||this.#N(f,r,n),h&&this.#v(h,f)),!o&&this.#d&&this.#g){let u=this.#g,d;for(;d=u?.shift();)this.#o?.(...d)}return this}pop(){try{for(;this.#a;){let t=this.#s[this.#p];if(this.#I(!0),this.#l(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#d&&this.#g){let t=this.#g,e;for(;e=t?.shift();)this.#o?.(...e)}}}#I(t){let e=this.#p,s=this.#c[e],r=this.#s[e];return this.#R&&this.#l(r)?r.__abortController.abort(new Error("evicted")):(this.#S||this.#d)&&(this.#S&&this.#n?.(r,s,"evict"),this.#d&&this.#g?.push([r,s,"evict"])),this.#L(e),t&&(this.#c[e]=void 0,this.#s[e]=void 0,this.#A.push(e)),this.#a===1?(this.#p=this.#m=0,this.#A.length=0):this.#p=this.#u[e],this.#h.delete(s),this.#a--,e}has(t,e={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=e,n=this.#h.get(t);if(n!==void 0){let o=this.#s[n];if(this.#l(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#T(n))r&&(r.has="stale",this.#v(r,n));else return s&&this.#D(n),r&&(r.has="hit",this.#v(r,n)),!0}else r&&(r.has="miss");return!1}peek(t,e={}){let{allowStale:s=this.allowStale}=e,r=this.#h.get(t);if(r===void 0||!s&&this.#T(r))return;let n=this.#s[r];return this.#l(n)?n.__staleWhileFetching:n}#F(t,e,s,r){let n=e===void 0?void 0:this.#s[e];if(this.#l(n))return n;let o=new le,{signal:a}=s;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let h={signal:o.signal,options:s,context:r},c=(p,y=!1)=>{let{aborted:m}=o.signal,b=s.ignoreFetchAbort&&p!==void 0;if(s.status&&(m&&!y?(s.status.fetchAborted=!0,s.status.fetchError=o.signal.reason,b&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),m&&!b&&!y)return f(o.signal.reason);let w=d;return this.#s[e]===d&&(p===void 0?w.__staleWhileFetching?this.#s[e]=w.__staleWhileFetching:this.#P(t,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(t,p,h.options))),p},l=p=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=p),f(p)),f=p=>{let{aborted:y}=o.signal,m=y&&s.allowStaleOnFetchAbort,b=m||s.allowStaleOnFetchRejection,w=b||s.noDeleteOnFetchRejection,S=d;if(this.#s[e]===d&&(!w||S.__staleWhileFetching===void 0?this.#P(t,"fetch"):m||(this.#s[e]=S.__staleWhileFetching)),b)return s.status&&S.__staleWhileFetching!==void 0&&(s.status.returnedStale=!0),S.__staleWhileFetching;if(S.__returned===S)throw p},u=(p,y)=>{let m=this.#b?.(t,n,h);m&&m instanceof Promise&&m.then(b=>p(b===void 0?void 0:b),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(p(void 0),s.allowStaleOnFetchAbort&&(p=b=>c(b,!0)))})};s.status&&(s.status.fetchDispatched=!0);let d=new Promise(u).then(c,l),g=Object.assign(d,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return e===void 0?(this.set(t,g,{...h.options,status:void 0}),e=this.#h.get(t)):this.#s[e]=g,g}#l(t){if(!this.#R)return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof le}async fetch(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:g=this.allowStaleOnFetchAbort,context:p,forceRefresh:y=!1,status:m,signal:b}=e;if(!this.#R)return m&&(m.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:m});let w={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:a,size:h,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:g,ignoreFetchAbort:d,status:m,signal:b},S=this.#h.get(t);if(S===void 0){m&&(m.fetch="miss");let E=this.#F(t,S,w,p);return E.__returned=E}else{let E=this.#s[S];if(this.#l(E)){let Ft=s&&E.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",Ft&&(m.returnedStale=!0)),Ft?E.__staleWhileFetching:E.__returned=E}let v=this.#T(S);if(!y&&!v)return m&&(m.fetch="hit"),this.#U(S),r&&this.#D(S),m&&this.#v(m,S),E;let N=this.#F(t,S,w,p),L=N.__staleWhileFetching!==void 0&&s;return m&&(m.fetch=v?"stale":"refresh",L&&v&&(m.returnedStale=!0)),L?N.__staleWhileFetching:N.__returned=N}}async forceFetch(t,e={}){let s=await this.fetch(t,e);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(t,e={}){let s=this.#w;if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=e,a=this.get(t,o);if(!n&&a!==void 0)return a;let h=s(t,a,{options:o,context:r});return this.set(t,h,o),h}get(t,e={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=e,a=this.#h.get(t);if(a!==void 0){let h=this.#s[a],c=this.#l(h);return o&&this.#v(o,a),this.#T(a)?(o&&(o.get="stale"),c?(o&&s&&h.__staleWhileFetching!==void 0&&(o.returnedStale=!0),s?h.__staleWhileFetching:void 0):(n||this.#P(t,"expire"),o&&s&&(o.returnedStale=!0),s?h:void 0)):(o&&(o.get="hit"),c?h.__staleWhileFetching:(this.#U(a),r&&this.#D(a),h))}else o&&(o.get="miss")}#z(t,e){this.#y[e]=t,this.#u[t]=e}#U(t){t!==this.#m&&(t===this.#p?this.#p=this.#u[t]:this.#z(this.#y[t],this.#u[t]),this.#z(this.#m,t),this.#m=t)}delete(t){return this.#P(t,"delete")}#P(t,e){let s=!1;if(this.#a!==0){let r=this.#h.get(t);if(r!==void 0)if(s=!0,this.#a===1)this.#j(e);else{this.#L(r);let n=this.#s[r];if(this.#l(n)?n.__abortController.abort(new Error("deleted")):(this.#S||this.#d)&&(this.#S&&this.#n?.(n,t,e),this.#d&&this.#g?.push([n,t,e])),this.#h.delete(t),this.#c[r]=void 0,this.#s[r]=void 0,r===this.#m)this.#m=this.#y[r];else if(r===this.#p)this.#p=this.#u[r];else{let o=this.#y[r];this.#u[o]=this.#u[r];let a=this.#u[r];this.#y[a]=this.#y[r]}this.#a--,this.#A.push(r)}}if(this.#d&&this.#g?.length){let r=this.#g,n;for(;n=r?.shift();)this.#o?.(...n)}return s}clear(){return this.#j("delete")}#j(t){for(let e of this.#_({allowStale:!0})){let s=this.#s[e];if(this.#l(s))s.__abortController.abort(new Error("deleted"));else{let r=this.#c[e];this.#S&&this.#n?.(s,r,t),this.#d&&this.#g?.push([s,r,t])}}if(this.#h.clear(),this.#s.fill(void 0),this.#c.fill(void 0),this.#E&&this.#x&&(this.#E.fill(0),this.#x.fill(0)),this.#C&&this.#C.fill(0),this.#p=0,this.#m=0,this.#A.length=0,this.#f=0,this.#a=0,this.#d&&this.#g){let e=this.#g,s;for(;s=e?.shift();)this.#o?.(...s)}}};import{posix as Bo,win32 as os}from"node:path";import{fileURLToPath as zo}from"node:url";import{lstatSync as Go,readdir as Ho,readdirSync as qo,readlinkSync as Vo,realpathSync as Ko}from"fs";import*as Yo from"node:fs";import{lstat as Xo,readdir as Zo,readlink as Qo,realpath as ta}from"node:fs/promises";import{EventEmitter as is}from"node:events";import Ni from"node:stream";import{StringDecoder as Po}from"node:string_decoder";var Ai=typeof process=="object"&&process?process:{stdout:null,stderr:null},Do=i=>!!i&&typeof i=="object"&&(i instanceof ot||i instanceof Ni||Lo(i)||Fo(i)),Lo=i=>!!i&&typeof i=="object"&&i instanceof is&&typeof i.pipe=="function"&&i.pipe!==Ni.Writable.prototype.pipe,Fo=i=>!!i&&typeof i=="object"&&i instanceof is&&typeof i.write=="function"&&typeof i.end=="function",X=Symbol("EOF"),Z=Symbol("maybeEmitEnd"),nt=Symbol("emittedEnd"),fe=Symbol("emittingEnd"),Vt=Symbol("emittedError"),ue=Symbol("closed"),Ci=Symbol("read"),de=Symbol("flush"),_i=Symbol("flushChunk"),z=Symbol("encoding"),Et=Symbol("decoder"),T=Symbol("flowing"),Kt=Symbol("paused"),xt=Symbol("resume"),R=Symbol("buffer"),D=Symbol("pipes"),O=Symbol("bufferLength"),Xe=Symbol("bufferPush"),pe=Symbol("bufferShift"),_=Symbol("objectMode"),x=Symbol("destroyed"),Ze=Symbol("error"),Qe=Symbol("emitData"),ki=Symbol("emitEnd"),ts=Symbol("emitEnd2"),K=Symbol("async"),es=Symbol("abort"),me=Symbol("aborted"),Yt=Symbol("signal"),ft=Symbol("dataListeners"),U=Symbol("discarded"),Jt=i=>Promise.resolve().then(i),Mo=i=>i(),Io=i=>i==="end"||i==="finish"||i==="prefinish",Uo=i=>i instanceof ArrayBuffer||!!i&&typeof i=="object"&&i.constructor&&i.constructor.name==="ArrayBuffer"&&i.byteLength>=0,jo=i=>!Buffer.isBuffer(i)&&ArrayBuffer.isView(i),ge=class{src;dest;opts;ondrain;constructor(t,e,s){this.src=t,this.dest=e,this.opts=s,this.ondrain=()=>t[xt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ss=class extends ge{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,s){super(t,e,s),this.proxyErrors=r=>e.emit("error",r),t.on("error",this.proxyErrors)}},$o=i=>!!i.objectMode,Wo=i=>!i.objectMode&&!!i.encoding&&i.encoding!=="buffer",ot=class extends is{[T]=!1;[Kt]=!1;[D]=[];[R]=[];[_];[z];[K];[Et];[X]=!1;[nt]=!1;[fe]=!1;[ue]=!1;[Vt]=null;[O]=0;[x]=!1;[Yt];[me]=!1;[ft]=0;[U]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");$o(e)?(this[_]=!0,this[z]=null):Wo(e)?(this[z]=e.encoding,this[_]=!1):(this[_]=!1,this[z]=null),this[K]=!!e.async,this[Et]=this[z]?new Po(this[z]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[R]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[D]});let{signal:s}=e;s&&(this[Yt]=s,s.aborted?this[es]():s.addEventListener("abort",()=>this[es]()))}get bufferLength(){return this[O]}get encoding(){return this[z]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[_]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[K]}set async(t){this[K]=this[K]||!!t}[es](){this[me]=!0,this.emit("abort",this[Yt]?.reason),this.destroy(this[Yt]?.reason)}get aborted(){return this[me]}set aborted(t){}write(t,e,s){if(this[me])return!1;if(this[X])throw new Error("write after end");if(this[x])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(s=e,e="utf8"),e||(e="utf8");let r=this[K]?Jt:Mo;if(!this[_]&&!Buffer.isBuffer(t)){if(jo(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Uo(t))t=Buffer.from(t);else if(typeof t!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[_]?(this[T]&&this[O]!==0&&this[de](!0),this[T]?this.emit("data",t):this[Xe](t),this[O]!==0&&this.emit("readable"),s&&r(s),this[T]):t.length?(typeof t=="string"&&!(e===this[z]&&!this[Et]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[z]&&(t=this[Et].write(t)),this[T]&&this[O]!==0&&this[de](!0),this[T]?this.emit("data",t):this[Xe](t),this[O]!==0&&this.emit("readable"),s&&r(s),this[T]):(this[O]!==0&&this.emit("readable"),s&&r(s),this[T])}read(t){if(this[x])return null;if(this[U]=!1,this[O]===0||t===0||t&&t>this[O])return this[Z](),null;this[_]&&(t=null),this[R].length>1&&!this[_]&&(this[R]=[this[z]?this[R].join(""):Buffer.concat(this[R],this[O])]);let e=this[Ci](t||null,this[R][0]);return this[Z](),e}[Ci](t,e){if(this[_])this[pe]();else{let s=e;t===s.length||t===null?this[pe]():typeof s=="string"?(this[R][0]=s.slice(t),e=s.slice(0,t),this[O]-=t):(this[R][0]=s.subarray(t),e=s.subarray(0,t),this[O]-=t)}return this.emit("data",e),!this[R].length&&!this[X]&&this.emit("drain"),e}end(t,e,s){return typeof t=="function"&&(s=t,t=void 0),typeof e=="function"&&(s=e,e="utf8"),t!==void 0&&this.write(t,e),s&&this.once("end",s),this[X]=!0,this.writable=!1,(this[T]||!this[Kt])&&this[Z](),this}[xt](){this[x]||(!this[ft]&&!this[D].length&&(this[U]=!0),this[Kt]=!1,this[T]=!0,this.emit("resume"),this[R].length?this[de]():this[X]?this[Z]():this.emit("drain"))}resume(){return this[xt]()}pause(){this[T]=!1,this[Kt]=!0,this[U]=!1}get destroyed(){return this[x]}get flowing(){return this[T]}get paused(){return this[Kt]}[Xe](t){this[_]?this[O]+=1:this[O]+=t.length,this[R].push(t)}[pe](){return this[_]?this[O]-=1:this[O]-=this[R][0].length,this[R].shift()}[de](t=!1){do;while(this[_i](this[pe]())&&this[R].length);!t&&!this[R].length&&!this[X]&&this.emit("drain")}[_i](t){return this.emit("data",t),this[T]}pipe(t,e){if(this[x])return t;this[U]=!1;let s=this[nt];return e=e||{},t===Ai.stdout||t===Ai.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,s?e.end&&t.end():(this[D].push(e.proxyErrors?new ss(this,t,e):new ge(this,t,e)),this[K]?Jt(()=>this[xt]()):this[xt]()),t}unpipe(t){let e=this[D].find(s=>s.dest===t);e&&(this[D].length===1?(this[T]&&this[ft]===0&&(this[T]=!1),this[D]=[]):this[D].splice(this[D].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let s=super.on(t,e);if(t==="data")this[U]=!1,this[ft]++,!this[D].length&&!this[T]&&this[xt]();else if(t==="readable"&&this[O]!==0)super.emit("readable");else if(Io(t)&&this[nt])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[Vt]){let r=e;this[K]?Jt(()=>r.call(this,this[Vt])):r.call(this,this[Vt])}return s}removeListener(t,e){return this.off(t,e)}off(t,e){let s=super.off(t,e);return t==="data"&&(this[ft]=this.listeners("data").length,this[ft]===0&&!this[U]&&!this[D].length&&(this[T]=!1)),s}removeAllListeners(t){let e=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[ft]=0,!this[U]&&!this[D].length&&(this[T]=!1)),e}get emittedEnd(){return this[nt]}[Z](){!this[fe]&&!this[nt]&&!this[x]&&this[R].length===0&&this[X]&&(this[fe]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ue]&&this.emit("close"),this[fe]=!1)}emit(t,...e){let s=e[0];if(t!=="error"&&t!=="close"&&t!==x&&this[x])return!1;if(t==="data")return!this[_]&&!s?!1:this[K]?(Jt(()=>this[Qe](s)),!0):this[Qe](s);if(t==="end")return this[ki]();if(t==="close"){if(this[ue]=!0,!this[nt]&&!this[x])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(t==="error"){this[Vt]=s,super.emit(Ze,s);let n=!this[Yt]||this.listeners("error").length?super.emit("error",s):!1;return this[Z](),n}else if(t==="resume"){let n=super.emit("resume");return this[Z](),n}else if(t==="finish"||t==="prefinish"){let n=super.emit(t);return this.removeAllListeners(t),n}let r=super.emit(t,...e);return this[Z](),r}[Qe](t){for(let s of this[D])s.dest.write(t)===!1&&this.pause();let e=this[U]?!1:super.emit("data",t);return this[Z](),e}[ki](){return this[nt]?!1:(this[nt]=!0,this.readable=!1,this[K]?(Jt(()=>this[ts]()),!0):this[ts]())}[ts](){if(this[Et]){let e=this[Et].end();if(e){for(let s of this[D])s.dest.write(e);this[U]||super.emit("data",e)}}for(let e of this[D])e.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[_]||(t.dataLength=0);let e=this.promise();return this.on("data",s=>{t.push(s),this[_]||(t.dataLength+=s.length)}),await e,t}async concat(){if(this[_])throw new Error("cannot concat in objectMode");let t=await this.collect();return this[z]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(x,()=>e(new Error("stream destroyed"))),this.on("error",s=>e(s)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[U]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[X])return e();let n,o,a=f=>{this.off("data",h),this.off("end",c),this.off(x,l),e(),o(f)},h=f=>{this.off("error",a),this.off("end",c),this.off(x,l),this.pause(),n({value:f,done:!!this[X]})},c=()=>{this.off("error",a),this.off("data",h),this.off(x,l),e(),n({done:!0,value:void 0})},l=()=>a(new Error("stream destroyed"));return new Promise((f,u)=>{o=u,n=f,this.once(x,l),this.once("error",a),this.once("end",c),this.once("data",h)})},throw:e,return:e,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[U]=!1;let t=!1,e=()=>(this.pause(),this.off(Ze,e),this.off(x,e),this.off("end",e),t=!0,{done:!0,value:void 0}),s=()=>{if(t)return e();let r=this.read();return r===null?e():{done:!1,value:r}};return this.once("end",e),this.once(Ze,e),this.once(x,e),{next:s,throw:e,return:e,[Symbol.iterator](){return this}}}destroy(t){if(this[x])return t?this.emit("error",t):this.emit(x),this;this[x]=!0,this[U]=!0,this[R].length=0,this[O]=0;let e=this;return typeof e.close=="function"&&!this[ue]&&e.close(),t?this.emit("error",t):this.emit(x),this}static get isStream(){return Do}};var Jo=Ko.native,Zt={lstatSync:Go,readdir:Ho,readdirSync:qo,readlinkSync:Vo,realpathSync:Jo,promises:{lstat:Xo,readdir:Zo,readlink:Qo,realpath:ta}},Mi=i=>!i||i===Zt||i===Yo?Zt:{...Zt,...i,promises:{...Zt.promises,...i.promises||{}}},Ii=/^\\\\\?\\([a-z]:)\\?$/i,ea=i=>i.replace(/\//g,"\\").replace(Ii,"$1\\"),sa=/[\\\/]/,W=0,Ui=1,ji=2,Y=4,$i=6,Wi=8,ut=10,Bi=12,$=15,Xt=~$,rs=16,Pi=32,Qt=64,G=128,we=256,Se=512,Di=Qt|G|Se,ia=1023,ns=i=>i.isFile()?Wi:i.isDirectory()?Y:i.isSymbolicLink()?ut:i.isCharacterDevice()?ji:i.isBlockDevice()?$i:i.isSocket()?Bi:i.isFIFO()?Ui:W,Li=new Map,te=i=>{let t=Li.get(i);if(t)return t;let e=i.normalize("NFKD");return Li.set(i,e),e},Fi=new Map,ye=i=>{let t=Fi.get(i);if(t)return t;let e=te(i.toLowerCase());return Fi.set(i,e),e},be=class extends qt{constructor(){super({max:256})}},as=class extends qt{constructor(t=16*1024){super({maxSize:t,sizeCalculation:e=>e.length+1})}},zi=Symbol("PathScurry setAsCwd"),k=class{name;root;roots;parent;nocase;isCWD=!1;#t;#e;get dev(){return this.#e}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#o;get uid(){return this.#o}#b;get gid(){return this.#b}#w;get rdev(){return this.#w}#a;get blksize(){return this.#a}#f;get ino(){return this.#f}#h;get size(){return this.#h}#c;get blocks(){return this.#c}#s;get atimeMs(){return this.#s}#u;get mtimeMs(){return this.#u}#y;get ctimeMs(){return this.#y}#p;get birthtimeMs(){return this.#p}#m;get atime(){return this.#m}#A;get mtime(){return this.#A}#g;get ctime(){return this.#g}#C;get birthtime(){return this.#C}#x;#E;#S;#R;#d;#k;#i;#D;#v;#N;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,e=W,s,r,n,o,a){this.name=t,this.#x=n?ye(t):te(t),this.#i=e&ia,this.nocase=n,this.roots=r,this.root=s||this,this.#D=o,this.#S=a.fullpath,this.#d=a.relative,this.#k=a.relativePosix,this.parent=a.parent,this.parent?this.#t=this.parent.#t:this.#t=Mi(a.fs)}depth(){return this.#E!==void 0?this.#E:this.parent?this.#E=this.parent.depth()+1:this.#E=0}childrenCache(){return this.#D}resolve(t){if(!t)return this;let e=this.getRootString(t),r=t.substring(e.length).split(this.splitSep);return e?this.getRoot(e).#T(r):this.#T(r)}#T(t){let e=this;for(let s of t)e=e.child(s);return e}children(){let t=this.#D.get(this);if(t)return t;let e=Object.assign([],{provisional:0});return this.#D.set(this,e),this.#i&=~rs,e}child(t,e){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let s=this.children(),r=this.nocase?ye(t):te(t);for(let h of s)if(h.#x===r)return h;let n=this.parent?this.sep:"",o=this.#S?this.#S+n+t:void 0,a=this.newChild(t,W,{...e,parent:this,fullpath:o});return this.canReaddir()||(a.#i|=G),s.push(a),a}relative(){if(this.isCWD)return"";if(this.#d!==void 0)return this.#d;let t=this.name,e=this.parent;if(!e)return this.#d=this.name;let s=e.relative();return s+(!s||!e.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#k!==void 0)return this.#k;let t=this.name,e=this.parent;if(!e)return this.#k=this.fullpathPosix();let s=e.relativePosix();return s+(!s||!e.parent?"":"/")+t}fullpath(){if(this.#S!==void 0)return this.#S;let t=this.name,e=this.parent;if(!e)return this.#S=this.name;let r=e.fullpath()+(e.parent?this.sep:"")+t;return this.#S=r}fullpathPosix(){if(this.#R!==void 0)return this.#R;if(this.sep==="/")return this.#R=this.fullpath();if(!this.parent){let r=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(r)?this.#R=`//?/${r}`:this.#R=r}let t=this.parent,e=t.fullpathPosix(),s=e+(!e||!t.parent?"":"/")+this.name;return this.#R=s}isUnknown(){return(this.#i&$)===W}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(this.#i&$)===Wi}isDirectory(){return(this.#i&$)===Y}isCharacterDevice(){return(this.#i&$)===ji}isBlockDevice(){return(this.#i&$)===$i}isFIFO(){return(this.#i&$)===Ui}isSocket(){return(this.#i&$)===Bi}isSymbolicLink(){return(this.#i&ut)===ut}lstatCached(){return this.#i&Pi?this:void 0}readlinkCached(){return this.#v}realpathCached(){return this.#N}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#v)return!0;if(!this.parent)return!1;let t=this.#i&$;return!(t!==W&&t!==ut||this.#i&we||this.#i&G)}calledReaddir(){return!!(this.#i&rs)}isENOENT(){return!!(this.#i&G)}isNamed(t){return this.nocase?this.#x===ye(t):this.#x===te(t)}async readlink(){let t=this.#v;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=await this.#t.promises.readlink(this.fullpath()),s=(await this.parent.realpath())?.resolve(e);if(s)return this.#v=s}catch(e){this.#I(e.code);return}}readlinkSync(){let t=this.#v;if(t)return t;if(this.canReadlink()&&this.parent)try{let e=this.#t.readlinkSync(this.fullpath()),s=this.parent.realpathSync()?.resolve(e);if(s)return this.#v=s}catch(e){this.#I(e.code);return}}#$(t){this.#i|=rs;for(let e=t.provisional;e<t.length;e++){let s=t[e];s&&s.#L()}}#L(){this.#i&G||(this.#i=(this.#i|G)&Xt,this.#M())}#M(){let t=this.children();t.provisional=0;for(let e of t)e.#L()}#W(){this.#i|=Se,this.#O()}#O(){if(this.#i&Qt)return;let t=this.#i;(t&$)===Y&&(t&=Xt),this.#i=t|Qt,this.#M()}#_(t=""){t==="ENOTDIR"||t==="EPERM"?this.#O():t==="ENOENT"?this.#L():this.children().provisional=0}#B(t=""){t==="ENOTDIR"?this.parent.#O():t==="ENOENT"&&this.#L()}#I(t=""){let e=this.#i;e|=we,t==="ENOENT"&&(e|=G),(t==="EINVAL"||t==="UNKNOWN")&&(e&=Xt),this.#i=e,t==="ENOTDIR"&&this.parent&&this.parent.#O()}#F(t,e){return this.#z(t,e)||this.#l(t,e)}#l(t,e){let s=ns(t),r=this.newChild(t.name,s,{parent:this}),n=r.#i&$;return n!==Y&&n!==ut&&n!==W&&(r.#i|=Qt),e.unshift(r),e.provisional++,r}#z(t,e){for(let s=e.provisional;s<e.length;s++){let r=e[s];if((this.nocase?ye(t.name):te(t.name))===r.#x)return this.#U(t,r,s,e)}}#U(t,e,s,r){let n=e.name;return e.#i=e.#i&Xt|ns(t),n!==t.name&&(e.name=t.name),s!==r.provisional&&(s===r.length-1?r.pop():r.splice(s,1),r.unshift(e)),r.provisional++,e}async lstat(){if(!(this.#i&G))try{return this.#P(await this.#t.promises.lstat(this.fullpath())),this}catch(t){this.#B(t.code)}}lstatSync(){if(!(this.#i&G))try{return this.#P(this.#t.lstatSync(this.fullpath())),this}catch(t){this.#B(t.code)}}#P(t){let{atime:e,atimeMs:s,birthtime:r,birthtimeMs:n,blksize:o,blocks:a,ctime:h,ctimeMs:c,dev:l,gid:f,ino:u,mode:d,mtime:g,mtimeMs:p,nlink:y,rdev:m,size:b,uid:w}=t;this.#m=e,this.#s=s,this.#C=r,this.#p=n,this.#a=o,this.#c=a,this.#g=h,this.#y=c,this.#e=l,this.#b=f,this.#f=u,this.#n=d,this.#A=g,this.#u=p,this.#r=y,this.#w=m,this.#h=b,this.#o=w;let S=ns(t);this.#i=this.#i&Xt|S|Pi,S!==W&&S!==Y&&S!==ut&&(this.#i|=Qt)}#j=[];#H=!1;#q(t){this.#H=!1;let e=this.#j.slice();this.#j.length=0,e.forEach(s=>s(null,t))}readdirCB(t,e=!1){if(!this.canReaddir()){e?t(null,[]):queueMicrotask(()=>t(null,[]));return}let s=this.children();if(this.calledReaddir()){let n=s.slice(0,s.provisional);e?t(null,n):queueMicrotask(()=>t(null,n));return}if(this.#j.push(t),this.#H)return;this.#H=!0;let r=this.fullpath();this.#t.readdir(r,{withFileTypes:!0},(n,o)=>{if(n)this.#_(n.code),s.provisional=0;else{for(let a of o)this.#F(a,s);this.#$(s)}this.#q(s.slice(0,s.provisional))})}#G;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.#G)await this.#G;else{let s=()=>{};this.#G=new Promise(r=>s=r);try{for(let r of await this.#t.promises.readdir(e,{withFileTypes:!0}))this.#F(r,t);this.#$(t)}catch(r){this.#_(r.code),t.provisional=0}this.#G=void 0,s()}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 s of this.#t.readdirSync(e,{withFileTypes:!0}))this.#F(s,t);this.#$(t)}catch(s){this.#_(s.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(this.#i&Di)return!1;let t=$&this.#i;return t===W||t===Y||t===ut}shouldWalk(t,e){return(this.#i&Y)===Y&&!(this.#i&Di)&&!t.has(this)&&(!e||e(this))}async realpath(){if(this.#N)return this.#N;if(!((Se|we|G)&this.#i))try{let t=await this.#t.promises.realpath(this.fullpath());return this.#N=this.resolve(t)}catch{this.#W()}}realpathSync(){if(this.#N)return this.#N;if(!((Se|we|G)&this.#i))try{let t=this.#t.realpathSync(this.fullpath());return this.#N=this.resolve(t)}catch{this.#W()}}[zi](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let e=new Set([]),s=[],r=this;for(;r&&r.parent;)e.add(r),r.#d=s.join(this.sep),r.#k=s.join("/"),r=r.parent,s.push("..");for(r=t;r&&r.parent&&!e.has(r);)r.#d=void 0,r.#k=void 0,r=r.parent}},Ee=class i extends k{sep="\\";splitSep=sa;constructor(t,e=W,s,r,n,o,a){super(t,e,s,r,n,o,a)}newChild(t,e=W,s={}){return new i(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(t){return os.parse(t).root}getRoot(t){if(t=ea(t.toUpperCase()),t===this.root.name)return this.root;for(let[e,s]of Object.entries(this.roots))if(this.sameRoot(t,e))return this.roots[t]=s;return this.roots[t]=new vt(t,this).root}sameRoot(t,e=this.root.name){return t=t.toUpperCase().replace(/\//g,"\\").replace(Ii,"$1\\"),t===e}},xe=class i extends k{splitSep="/";sep="/";constructor(t,e=W,s,r,n,o,a){super(t,e,s,r,n,o,a)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,e=W,s={}){return new i(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}},ve=class{root;rootPath;roots;cwd;#t;#e;#n;nocase;#r;constructor(t=process.cwd(),e,s,{nocase:r,childrenCacheSize:n=16*1024,fs:o=Zt}={}){this.#r=Mi(o),(t instanceof URL||t.startsWith("file://"))&&(t=zo(t));let a=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#t=new be,this.#e=new be,this.#n=new as(n);let h=a.substring(this.rootPath.length).split(s);if(h.length===1&&!h[0]&&h.pop(),r===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=r,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let c=this.root,l=h.length-1,f=e.sep,u=this.rootPath,d=!1;for(let g of h){let p=l--;c=c.child(g,{relative:new Array(p).fill("..").join(f),relativePosix:new Array(p).fill("..").join("/"),fullpath:u+=(d?"":f)+g}),d=!0}this.cwd=c}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#n}resolve(...t){let e="";for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=this.#t.get(e);if(s!==void 0)return s;let r=this.cwd.resolve(e).fullpath();return this.#t.set(e,r),r}resolvePosix(...t){let e="";for(let n=t.length-1;n>=0;n--){let o=t[n];if(!(!o||o===".")&&(e=e?`${o}/${e}`:o,this.isAbsolute(o)))break}let s=this.#e.get(e);if(s!==void 0)return s;let r=this.cwd.resolve(e).fullpathPosix();return this.#e.set(e,r),r}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd);let{withFileTypes:s}=e;if(t.canReaddir()){let r=await t.readdir();return s?r:r.map(n=>n.name)}else return[]}readdirSync(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd);let{withFileTypes:s=!0}=e;return t.canReaddir()?s?t.readdirSync():t.readdirSync().map(r=>r.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t.withFileTypes,t=this.cwd);let s=await t.readlink();return e?s:s?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t.withFileTypes,t=this.cwd);let s=t.readlinkSync();return e?s:s?.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t.withFileTypes,t=this.cwd);let s=await t.realpath();return e?s:s?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t.withFileTypes,t=this.cwd);let s=t.realpathSync();return e?s:s?.fullpath()}async walk(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:o}=e,a=[];(!n||n(t))&&a.push(s?t:t.fullpath());let h=new Set,c=(f,u)=>{h.add(f),f.readdirCB((d,g)=>{if(d)return u(d);let p=g.length;if(!p)return u();let y=()=>{--p===0&&u()};for(let m of g)(!n||n(m))&&a.push(s?m:m.fullpath()),r&&m.isSymbolicLink()?m.realpath().then(b=>b?.isUnknown()?b.lstat():b).then(b=>b?.shouldWalk(h,o)?c(b,y):y()):m.shouldWalk(h,o)?c(m,y):y()},!0)},l=t;return new Promise((f,u)=>{c(l,d=>{if(d)return u(d);f(a)})})}walkSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:o}=e,a=[];(!n||n(t))&&a.push(s?t:t.fullpath());let h=new Set([t]);for(let c of h){let l=c.readdirSync();for(let f of l){(!n||n(f))&&a.push(s?f:f.fullpath());let u=f;if(f.isSymbolicLink()){if(!(r&&(u=f.realpathSync())))continue;u.isUnknown()&&u.lstatSync()}u.shouldWalk(h,o)&&h.add(u)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd),this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:o}=e;(!n||n(t))&&(yield s?t:t.fullpath());let a=new Set([t]);for(let h of a){let c=h.readdirSync();for(let l of c){(!n||n(l))&&(yield s?l:l.fullpath());let f=l;if(l.isSymbolicLink()){if(!(r&&(f=l.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(a,o)&&a.add(f)}}}stream(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:o}=e,a=new ot({objectMode:!0});(!n||n(t))&&a.write(s?t:t.fullpath());let h=new Set,c=[t],l=0,f=()=>{let u=!1;for(;!u;){let d=c.shift();if(!d){l===0&&a.end();return}l++,h.add(d);let g=(y,m,b=!1)=>{if(y)return a.emit("error",y);if(r&&!b){let w=[];for(let S of m)S.isSymbolicLink()&&w.push(S.realpath().then(E=>E?.isUnknown()?E.lstat():E));if(w.length){Promise.all(w).then(()=>g(null,m,!0));return}}for(let w of m)w&&(!n||n(w))&&(a.write(s?w:w.fullpath())||(u=!0));l--;for(let w of m){let S=w.realpathCached()||w;S.shouldWalk(h,o)&&c.push(S)}u&&!a.flowing?a.once("drain",f):p||f()},p=!0;d.readdirCB(g,!0),p=!1}};return f(),a}streamSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof k||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:r=!1,filter:n,walkFilter:o}=e,a=new ot({objectMode:!0}),h=new Set;(!n||n(t))&&a.write(s?t:t.fullpath());let c=[t],l=0,f=()=>{let u=!1;for(;!u;){let d=c.shift();if(!d){l===0&&a.end();return}l++,h.add(d);let g=d.readdirSync();for(let p of g)(!n||n(p))&&(a.write(s?p:p.fullpath())||(u=!0));l--;for(let p of g){let y=p;if(p.isSymbolicLink()){if(!(r&&(y=p.realpathSync())))continue;y.isUnknown()&&y.lstatSync()}y.shouldWalk(h,o)&&c.push(y)}}u&&!a.flowing&&a.once("drain",f)};return f(),a}chdir(t=this.cwd){let e=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[zi](e)}},vt=class extends ve{sep="\\";constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,os,"\\",{...e,nocase:s}),this.nocase=s;for(let r=this.cwd;r;r=r.parent)r.nocase=this.nocase}parseRootPath(t){return os.parse(t).root.toUpperCase()}newRoot(t){return new Ee(this.rootPath,Y,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}},Tt=class extends ve{sep="/";constructor(t=process.cwd(),e={}){let{nocase:s=!1}=e;super(t,Bo,"/",{...e,nocase:s}),this.nocase=s}parseRootPath(t){return"/"}newRoot(t){return new xe(this.rootPath,Y,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}},ee=class extends Tt{constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,{...e,nocase:s})}},nl=process.platform==="win32"?Ee:xe,Gi=process.platform==="win32"?vt:process.platform==="darwin"?ee:Tt;var ra=i=>i.length>=1,na=i=>i.length>=1,Rt=class i{#t;#e;#n;length;#r;#o;#b;#w;#a;#f;#h=!0;constructor(t,e,s,r){if(!ra(t))throw new TypeError("empty pattern list");if(!na(e))throw new TypeError("empty glob list");if(e.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#t=t,this.#e=e,this.#n=s,this.#r=r,this.#n===0){if(this.isUNC()){let[n,o,a,h,...c]=this.#t,[l,f,u,d,...g]=this.#e;c[0]===""&&(c.shift(),g.shift());let p=[n,o,a,h,""].join("/"),y=[l,f,u,d,""].join("/");this.#t=[p,...c],this.#e=[y,...g],this.length=this.#t.length}else if(this.isDrive()||this.isAbsolute()){let[n,...o]=this.#t,[a,...h]=this.#e;o[0]===""&&(o.shift(),h.shift());let c=n+"/",l=a+"/";this.#t=[c,...o],this.#e=[l,...h],this.length=this.#t.length}}}pattern(){return this.#t[this.#n]}isString(){return typeof this.#t[this.#n]=="string"}isGlobstar(){return this.#t[this.#n]===A}isRegExp(){return this.#t[this.#n]instanceof RegExp}globString(){return this.#b=this.#b||(this.#n===0?this.isAbsolute()?this.#e[0]+this.#e.slice(1).join("/"):this.#e.join("/"):this.#e.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new i(this.#t,this.#e,this.#n+1,this.#r),this.#o.#f=this.#f,this.#o.#a=this.#a,this.#o.#w=this.#w,this.#o):this.#o=null}isUNC(){let t=this.#t;return this.#a!==void 0?this.#a:this.#a=this.#r==="win32"&&this.#n===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3]}isDrive(){let t=this.#t;return this.#w!==void 0?this.#w:this.#w=this.#r==="win32"&&this.#n===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0])}isAbsolute(){let t=this.#t;return this.#f!==void 0?this.#f:this.#f=t[0]===""&&t.length>1||this.isDrive()||this.isUNC()}root(){let t=this.#t[0];return typeof t=="string"&&this.isAbsolute()&&this.#n===0?t:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#h)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#h?!1:(this.#h=!1,!0)}};var oa=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ot=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:e,nocase:s,noext:r,noglobstar:n,platform:o=oa}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:e,nocase:s,noext:r,noglobstar:n,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of t)this.add(a)}add(t){let e=new I(t,this.mmopts);for(let s=0;s<e.set.length;s++){let r=e.set[s],n=e.globParts[s];if(!r||!n)throw new Error("invalid pattern object");for(;r[0]==="."&&n[0]===".";)r.shift(),n.shift();let o=new Rt(r,n,0,this.platform),a=new I(o.globString(),this.mmopts),h=n[n.length-1]==="**",c=o.isAbsolute();c?this.absolute.push(a):this.relative.push(a),h&&(c?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(t){let e=t.fullpath(),s=`${e}/`,r=t.relative()||".",n=`${r}/`;for(let o of this.relative)if(o.match(r)||o.match(n))return!0;for(let o of this.absolute)if(o.match(e)||o.match(s))return!0;return!1}childrenIgnored(t){let e=t.fullpath()+"/",s=(t.relative()||".")+"/";for(let r of this.relativeChildren)if(r.match(s))return!0;for(let r of this.absoluteChildren)if(r.match(e))return!0;return!1}};var hs=class i{store;constructor(t=new Map){this.store=t}copy(){return new i(new Map(this.store))}hasWalked(t,e){return this.store.get(t.fullpath())?.has(e.globString())}storeWalked(t,e){let s=t.fullpath(),r=this.store.get(s);r?r.add(e.globString()):this.store.set(s,new Set([e.globString()]))}},cs=class{store=new Map;add(t,e,s){let r=(e?2:0)|(s?1:0),n=this.store.get(t);this.store.set(t,n===void 0?r:r&n)}entries(){return[...this.store.entries()].map(([t,e])=>[t,!!(e&2),!!(e&1)])}},ls=class{store=new Map;add(t,e){if(!t.canReaddir())return;let s=this.store.get(t);s?s.find(r=>r.globString()===e.globString())||s.push(e):this.store.set(t,[e])}get(t){let e=this.store.get(t);if(!e)throw new 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())}},se=class i{hasWalkedCache;matches=new cs;subwalks=new ls;patterns;follow;dot;opts;constructor(t,e){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=e?e.copy():new hs}processPatterns(t,e){this.patterns=e;let s=e.map(r=>[t,r]);for(let[r,n]of s){this.hasWalkedCache.storeWalked(r,n);let o=n.root(),a=n.isAbsolute()&&this.opts.absolute!==!1;if(o){r=r.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let f=n.rest();if(f)n=f;else{this.matches.add(r,!0,!1);continue}}if(r.isENOENT())continue;let h,c,l=!1;for(;typeof(h=n.pattern())=="string"&&(c=n.rest());)r=r.resolve(h),n=c,l=!0;if(h=n.pattern(),c=n.rest(),l){if(this.hasWalkedCache.hasWalked(r,n))continue;this.hasWalkedCache.storeWalked(r,n)}if(typeof h=="string"){let f=h===".."||h===""||h===".";this.matches.add(r.resolve(h),a,f);continue}else if(h===A){(!r.isSymbolicLink()||this.follow||n.checkFollowGlobstar())&&this.subwalks.add(r,n);let f=c?.pattern(),u=c?.rest();if(!c||(f===""||f===".")&&!u)this.matches.add(r,a,f===""||f===".");else if(f===".."){let d=r.parent||r;u?this.hasWalkedCache.hasWalked(d,u)||this.subwalks.add(d,u):this.matches.add(d,a,!0)}}else h instanceof RegExp&&this.subwalks.add(r,n)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new i(this.opts,this.hasWalkedCache)}filterEntries(t,e){let s=this.subwalks.get(t),r=this.child();for(let n of e)for(let o of s){let a=o.isAbsolute(),h=o.pattern(),c=o.rest();h===A?r.testGlobstar(n,o,c,a):h instanceof RegExp?r.testRegExp(n,h,c,a):r.testString(n,h,c,a)}return r}testGlobstar(t,e,s,r){if((this.dot||!t.name.startsWith("."))&&(e.hasMore()||this.matches.add(t,r,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,e):t.isSymbolicLink()&&(s&&e.checkFollowGlobstar()?this.subwalks.add(t,s):e.markFollowGlobstar()&&this.subwalks.add(t,e)))),s){let n=s.pattern();if(typeof n=="string"&&n!==".."&&n!==""&&n!==".")this.testString(t,n,s.rest(),r);else if(n===".."){let o=t.parent||t;this.subwalks.add(o,s)}else n instanceof RegExp&&this.testRegExp(t,n,s.rest(),r)}}testRegExp(t,e,s,r){e.test(t.name)&&(s?this.subwalks.add(t,s):this.matches.add(t,r,!1))}testString(t,e,s,r){t.isNamed(e)&&(s?this.subwalks.add(t,s):this.matches.add(t,r,!1))}};var aa=(i,t)=>typeof i=="string"?new Ot([i],t):Array.isArray(i)?new Ot(i,t):i,Te=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#t=[];#e;#n;signal;maxDepth;includeChildMatches;constructor(t,e,s){if(this.patterns=t,this.path=e,this.opts=s,this.#n=!s.posix&&s.platform==="win32"?"\\":"/",this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(this.#e=aa(s.ignore??[],s),!this.includeChildMatches&&typeof this.#e.add!="function")){let r="cannot ignore child matches, ignore lacks add() method.";throw new Error(r)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{this.#t.length=0}))}#r(t){return this.seen.has(t)||!!this.#e?.ignored?.(t)}#o(t){return!!this.#e?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=this.#t.shift());)t()}onResume(t){this.signal?.aborted||(this.paused?this.#t.push(t):t())}async matchCheck(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||await t.realpath(),!s)return;t=s}let n=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&n?.isSymbolicLink()){let o=await n.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(n,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.#r(t)?t:void 0}matchCheckSync(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||t.realpathSync(),!s)return;t=s}let n=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&n?.isSymbolicLink()){let o=n.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(n,e)}matchFinish(t,e){if(this.#r(t))return;if(!this.includeChildMatches&&this.#e?.add){let n=`${t.relativePosix()}/**`;this.#e.add(n)}let s=this.opts.absolute===void 0?e:this.opts.absolute;this.seen.add(t);let r=this.opts.mark&&t.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(s){let n=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(n+r)}else{let n=this.opts.posix?t.relativePosix():t.relative(),o=this.opts.dotRelative&&!n.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(n?o+n+r:"."+r)}}async match(t,e,s){let r=await this.matchCheck(t,s);r&&this.matchFinish(r,e)}matchSync(t,e,s){let r=this.matchCheckSync(t,s);r&&this.matchFinish(r,e)}walkCB(t,e,s){this.signal?.aborted&&s(),this.walkCB2(t,e,new se(this.opts),s)}walkCB2(t,e,s,r){if(this.#o(t))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2(t,e,s,r));return}s.processPatterns(t,e);let n=1,o=()=>{--n===0&&r()};for(let[a,h,c]of s.matches.entries())this.#r(a)||(n++,this.match(a,h,c).then(()=>o()));for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;n++;let h=a.readdirCached();a.calledReaddir()?this.walkCB3(a,h,s,o):a.readdirCB((c,l)=>this.walkCB3(a,l,s,o),!0)}o()}walkCB3(t,e,s,r){s=s.filterEntries(t,e);let n=1,o=()=>{--n===0&&r()};for(let[a,h,c]of s.matches.entries())this.#r(a)||(n++,this.match(a,h,c).then(()=>o()));for(let[a,h]of s.subwalks.entries())n++,this.walkCB2(a,h,s.child(),o);o()}walkCBSync(t,e,s){this.signal?.aborted&&s(),this.walkCB2Sync(t,e,new se(this.opts),s)}walkCB2Sync(t,e,s,r){if(this.#o(t))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2Sync(t,e,s,r));return}s.processPatterns(t,e);let n=1,o=()=>{--n===0&&r()};for(let[a,h,c]of s.matches.entries())this.#r(a)||this.matchSync(a,h,c);for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;n++;let h=a.readdirSync();this.walkCB3Sync(a,h,s,o)}o()}walkCB3Sync(t,e,s,r){s=s.filterEntries(t,e);let n=1,o=()=>{--n===0&&r()};for(let[a,h,c]of s.matches.entries())this.#r(a)||this.matchSync(a,h,c);for(let[a,h]of s.subwalks.entries())n++,this.walkCB2Sync(a,h,s.child(),o);o()}},ie=class extends Te{matches=new Set;constructor(t,e,s){super(t,e,s)}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}},re=class extends Te{results;constructor(t,e,s){super(t,e,s),this.results=new ot({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}};var ca=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",H=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 new 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=ha(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=e.includeChildMatches!==!1,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(h=>h.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(h=>h.includes("/")?h:`./**/${h}`)}if(this.pattern=t,this.platform=e.platform||ca,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,e.nocase!==void 0&&e.nocase!==e.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let h=e.platform==="win32"?vt:e.platform==="darwin"?ee:e.platform?Tt:Gi;this.scurry=new h(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",r={...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},n=this.pattern.map(h=>new I(h,r)),[o,a]=n.reduce((h,c)=>(h[0].push(...c.set),h[1].push(...c.globParts),h),[[],[]]);this.patterns=o.map((h,c)=>{let l=a[c];if(!l)throw new Error("invalid pattern object");return new Rt(h,l,0,this.platform)})}async walk(){return[...await new ie(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 ie(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 re(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 re(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()}};var fs=(i,t={})=>{Array.isArray(i)||(i=[i]);for(let e of i)if(new I(e,t).hasMagic())return!0;return!1};function Oe(i,t={}){return new H(i,t).streamSync()}function qi(i,t={}){return new H(i,t).stream()}function Ae(i,t={}){return new H(i,t).walkSync()}async function Hi(i,t={}){return new H(i,t).walk()}function Ce(i,t={}){return new H(i,t).iterateSync()}function Vi(i,t={}){return new H(i,t).iterate()}var la=Oe,fa=Object.assign(qi,{sync:Oe}),ua=Ce,da=Object.assign(Vi,{sync:Ce}),pa=Object.assign(Ae,{stream:Oe,iterate:Ce}),Re=Object.assign(Hi,{glob:Hi,globSync:Ae,sync:pa,globStream:qi,stream:fa,globStreamSync:Oe,streamSync:la,globIterate:Vi,iterate:da,globIterateSync:Ce,iterateSync:ua,Glob:H,hasMagic:fs,escape:yt,unescape:B});Re.glob=Re;var at=(i,t)=>typeof i>"u"||typeof i===t,Ki=i=>!!i&&typeof i=="object"&&at(i.preserveRoot,"boolean")&&at(i.tmp,"string")&&at(i.maxRetries,"number")&&at(i.retryDelay,"number")&&at(i.backoff,"number")&&at(i.maxBackoff,"number")&&(at(i.glob,"boolean")||i.glob&&typeof i.glob=="object")&&at(i.filter,"function"),Yi=i=>{if(!Ki(i))throw new Error("invalid rimraf options")},Ji=i=>{Yi(i);let{glob:t,...e}=i;if(!t)return e;let s=t===!0?i.signal?{signal:i.signal}:{}:i.signal?{signal:i.signal,...t}:t;return{...e,glob:{...s,absolute:!0,withFileTypes:!1}}},Xi=(i={})=>Ji(i),Zi=(i={})=>Ji(i);import{parse as Qi,resolve as ma}from"path";import{inspect as ga}from"util";var q=process.env.__TESTING_RIMRAF_PLATFORM__||process.platform;var wa=(i,t={})=>{let e=typeof i;if(e!=="string"){let r=i&&e==="object"&&i.constructor,o=`The "path" argument must be of type string. Received ${r&&r.name?`an instance of ${r.name}`:e==="object"?ga(i):`type ${e} ${i}`}`;throw Object.assign(new TypeError(o),{path:i,code:"ERR_INVALID_ARG_TYPE"})}if(/\0/.test(i)){let r="path must be a string without null bytes";throw Object.assign(new TypeError(r),{path:i,code:"ERR_INVALID_ARG_VALUE"})}i=ma(i);let{root:s}=Qi(i);if(i===s&&t.preserveRoot!==!1){let r="refusing to remove root directory without preserveRoot:false";throw Object.assign(new Error(r),{path:i,code:"ERR_PRESERVE_ROOT"})}if(q==="win32"){let r=/[*|"<>?:]/,{root:n}=Qi(i);if(r.test(i.substring(n.length)))throw Object.assign(new Error("Illegal characters in path."),{path:i,code:"EINVAL"})}return i},ne=wa;import Q from"fs";import{chmodSync as _e,mkdirSync as Gl,renameSync as er,rmdirSync as At,rmSync as sr,statSync as ir,lstatSync as Ct,unlinkSync as _t}from"fs";import{readdirSync as ya}from"fs";var tr=i=>ya(i,{withFileTypes:!0}),Sa=(i,t)=>new Promise((e,s)=>Q.chmod(i,t,(r,...n)=>r?s(r):e(...n))),ba=(i,t)=>new Promise((e,s)=>Q.mkdir(i,t,(r,n)=>r?s(r):e(n))),Ea=i=>new Promise((t,e)=>Q.readdir(i,{withFileTypes:!0},(s,r)=>s?e(s):t(r))),xa=(i,t)=>new Promise((e,s)=>Q.rename(i,t,(r,...n)=>r?s(r):e(...n))),va=(i,t)=>new Promise((e,s)=>Q.rm(i,t,(r,...n)=>r?s(r):e(...n))),Ta=i=>new Promise((t,e)=>Q.rmdir(i,(s,...r)=>s?e(s):t(...r))),Ra=i=>new Promise((t,e)=>Q.stat(i,(s,r)=>s?e(s):t(r))),Oa=i=>new Promise((t,e)=>Q.lstat(i,(s,r)=>s?e(s):t(r))),Aa=i=>new Promise((t,e)=>Q.unlink(i,(s,...r)=>s?e(s):t(...r))),F={chmod:Sa,mkdir:ba,readdir:Ea,rename:xa,rm:va,rmdir:Ta,stat:Ra,lstat:Oa,unlink:Aa};import{parse as rr,resolve as nr}from"path";var{readdir:Ca}=F,kt=i=>Ca(i).catch(t=>t),Nt=i=>{try{return tr(i)}catch(t){return t}};var tt=async i=>i.catch(t=>{if(t.code!=="ENOENT")throw t}),et=i=>{try{return i()}catch(t){if(t?.code!=="ENOENT")throw t}};var{lstat:_a,rmdir:ka,unlink:Na}=F,ke=async(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return await or(i,t,await _a(i))}catch(e){if(e?.code==="ENOENT")return!0;throw e}},Ne=(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return ar(i,t,Ct(i))}catch(e){if(e?.code==="ENOENT")return!0;throw e}},or=async(i,t,e)=>{if(t?.signal?.aborted)throw t.signal.reason;let s=e.isDirectory()?await kt(i):null;if(!Array.isArray(s)){if(s){if(s.code==="ENOENT")return!0;if(s.code!=="ENOTDIR")throw s}return t.filter&&!await t.filter(i,e)?!1:(await tt(Na(i)),!0)}return!(await Promise.all(s.map(n=>or(nr(i,n.name),t,n)))).reduce((n,o)=>n&&o,!0)||t.preserveRoot===!1&&i===rr(i).root||t.filter&&!await t.filter(i,e)?!1:(await tt(ka(i)),!0)},ar=(i,t,e)=>{if(t?.signal?.aborted)throw t.signal.reason;let s=e.isDirectory()?Nt(i):null;if(!Array.isArray(s)){if(s){if(s.code==="ENOENT")return!0;if(s.code!=="ENOTDIR")throw s}return t.filter&&!t.filter(i,e)?!1:(et(()=>_t(i)),!0)}let r=!0;for(let n of s){let o=nr(i,n.name);r=ar(o,t,n)&&r}return t.preserveRoot===!1&&i===rr(i).root||!r||t.filter&&!t.filter(i,e)?!1:(et(()=>At(i)),!0)};import{parse as gr,resolve as wr}from"path";var{chmod:Pa}=F,us=i=>async t=>{try{return await i(t)}catch(e){let s=e;if(s?.code==="ENOENT")return;if(s?.code==="EPERM"){try{await Pa(t,438)}catch(r){if(r?.code==="ENOENT")return;throw e}return await i(t)}throw e}},ds=i=>t=>{try{return i(t)}catch(e){let s=e;if(s?.code==="ENOENT")return;if(s?.code==="EPERM"){try{_e(t,438)}catch(r){if(r?.code==="ENOENT")return;throw e}return i(t)}throw e}};var hr=new Set(["EMFILE","ENFILE","EBUSY"]),ps=i=>{let t=async(e,s,r=1,n=0)=>{let o=s.maxBackoff||200,a=s.backoff||1.2,h=s.maxRetries||10,c=0;for(;;)try{return await i(e)}catch(l){let f=l;if(f?.path===e&&f?.code&&hr.has(f.code)){if(r=Math.ceil(r*a),n=r+n,n<o)return new Promise((u,d)=>{setTimeout(()=>{t(e,s,r,n).then(u,d)},r)});if(c<h){c++;continue}}throw l}};return t},ms=i=>(e,s)=>{let r=s.maxRetries||10,n=0;for(;;)try{return i(e)}catch(o){let a=o;if(a?.path===e&&a?.code&&hr.has(a.code)&&n<r){n++;continue}throw o}};import{basename as $a,parse as Le,resolve as Fe}from"path";import{tmpdir as De}from"os";import{parse as Pe,resolve as cr}from"path";var{stat:Da}=F,La=i=>{try{return ir(i).isDirectory()}catch{return!1}},Fa=i=>Da(i).then(t=>t.isDirectory(),()=>!1),Ma=async i=>{let{root:t}=Pe(i),e=De(),{root:s}=Pe(e);if(t.toLowerCase()===s.toLowerCase())return e;let r=cr(t,"/temp");return await Fa(r)?r:t},Ia=i=>{let{root:t}=Pe(i),e=De(),{root:s}=Pe(e);if(t.toLowerCase()===s.toLowerCase())return e;let r=cr(t,"/temp");return La(r)?r:t},Ua=async()=>De(),ja=()=>De(),lr=q==="win32"?Ma:Ua,fr=q==="win32"?Ia:ja;var{lstat:Wa,rename:Ba,unlink:ur,rmdir:za,chmod:Ga}=F,mr=i=>`.${$a(i)}.${Math.random()}`,Ha=async i=>ur(i).catch(t=>{if(t.code==="EPERM")return Ga(i,438).then(()=>ur(i),e=>{if(e.code!=="ENOENT")throw t});if(t.code==="ENOENT")return;throw t}),qa=i=>{try{_t(i)}catch(t){if(t?.code==="EPERM")try{return _e(i,438)}catch(e){if(e?.code==="ENOENT")return;throw t}else if(t?.code==="ENOENT")return;throw t}},Me=async(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return await gs(i,t,await Wa(i))}catch(e){if(e?.code==="ENOENT")return!0;throw e}},gs=async(i,t,e)=>{if(t?.signal?.aborted)throw t.signal.reason;if(!t.tmp)return gs(i,{...t,tmp:await lr(i)},e);if(i===t.tmp&&Le(i).root!==i)throw new Error("cannot delete temp directory used for deletion");let s=e.isDirectory()?await kt(i):null;if(!Array.isArray(s)){if(s){if(s.code==="ENOENT")return!0;if(s.code!=="ENOTDIR")throw s}return t.filter&&!await t.filter(i,e)?!1:(await tt(dr(i,t.tmp,Ha)),!0)}return!(await Promise.all(s.map(n=>gs(Fe(i,n.name),t,n)))).reduce((n,o)=>n&&o,!0)||t.preserveRoot===!1&&i===Le(i).root||t.filter&&!await t.filter(i,e)?!1:(await tt(dr(i,t.tmp,za)),!0)},dr=async(i,t,e)=>{let s=Fe(t,mr(i));return await Ba(i,s),await e(s)},Ie=(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return ws(i,t,Ct(i))}catch(e){if(e?.code==="ENOENT")return!0;throw e}},ws=(i,t,e)=>{if(t?.signal?.aborted)throw t.signal.reason;if(!t.tmp)return ws(i,{...t,tmp:fr(i)},e);let s=t.tmp;if(i===t.tmp&&Le(i).root!==i)throw new Error("cannot delete temp directory used for deletion");let r=e.isDirectory()?Nt(i):null;if(!Array.isArray(r)){if(r){if(r.code==="ENOENT")return!0;if(r.code!=="ENOTDIR")throw r}return t.filter&&!t.filter(i,e)?!1:(et(()=>pr(i,s,qa)),!0)}let n=!0;for(let o of r){let a=Fe(i,o.name);n=ws(a,t,o)&&n}return!n||t.preserveRoot===!1&&i===Le(i).root||t.filter&&!t.filter(i,e)?!1:(et(()=>pr(i,s,At)),!0)},pr=(i,t,e)=>{let s=Fe(t,mr(i));return er(i,s),e(s)};var{unlink:Va,rmdir:Ka,lstat:Ya}=F,Ja=ps(us(Va)),Xa=ms(ds(_t)),Za=ps(us(Ka)),Qa=ms(ds(At)),th=async(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;let{filter:e,...s}=t;try{return await Za(i,s)}catch(r){if(r?.code==="ENOTEMPTY")return await Me(i,s);throw r}},eh=(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;let{filter:e,...s}=t;try{return Qa(i,s)}catch(r){if(r?.code==="ENOTEMPTY")return Ie(i,s);throw r}},ht=Symbol("start"),yr=Symbol("child"),Ue=Symbol("finish"),je=async(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return await ys(i,t,await Ya(i),ht)}catch(e){if(e?.code==="ENOENT")return!0;throw e}},$e=(i,t)=>{if(t?.signal?.aborted)throw t.signal.reason;try{return Ss(i,t,Ct(i),ht)}catch(e){if(e?.code==="ENOENT")return!0;throw e}},ys=async(i,t,e,s=ht)=>{if(t?.signal?.aborted)throw t.signal.reason;let r=e.isDirectory()?await kt(i):null;if(!Array.isArray(r)){if(r){if(r.code==="ENOENT")return!0;if(r.code!=="ENOTDIR")throw r}return t.filter&&!await t.filter(i,e)?!1:(await tt(Ja(i,t)),!0)}let n=s===ht?yr:s,o=(await Promise.all(r.map(a=>ys(wr(i,a.name),t,a,n)))).reduce((a,h)=>a&&h,!0);if(s===ht)return ys(i,t,e,Ue);if(s===Ue){if(t.preserveRoot===!1&&i===gr(i).root||!o||t.filter&&!await t.filter(i,e))return!1;await tt(th(i,t))}return!0},Ss=(i,t,e,s=ht)=>{let r=e.isDirectory()?Nt(i):null;if(!Array.isArray(r)){if(r){if(r.code==="ENOENT")return!0;if(r.code!=="ENOTDIR")throw r}return t.filter&&!t.filter(i,e)?!1:(et(()=>Xa(i,t)),!0)}let n=!0;for(let o of r){let a=s===ht?yr:s,h=wr(i,o.name);n=Ss(h,t,o,a)&&n}if(s===ht)return Ss(i,t,e,Ue);if(s===Ue){if(t.preserveRoot===!1&&i===gr(i).root||!n||t.filter&&!t.filter(i,e))return!1;et(()=>{eh(i,t)})}return!0};var bs=q==="win32"?je:ke,Es=q==="win32"?$e:Ne;var{rm:sh}=F,xs=async(i,t)=>(await sh(i,{...t,force:!0,recursive:!0}),!0),vs=(i,t)=>(sr(i,{...t,force:!0,recursive:!0}),!0);var ih=process.env.__TESTING_RIMRAF_NODE_VERSION__||process.version,rh=ih.replace(/^v/,"").split("."),[Sr=0,nh=0]=rh.map(i=>parseInt(i,10)),br=Sr>14||Sr===14&&nh>=14,Er=!br||q==="win32"?()=>!1:i=>!i?.signal&&!i?.filter,xr=!br||q==="win32"?()=>!1:i=>!i?.signal&&!i?.filter;var Pt=i=>async(t,e)=>{let s=Xi(e);return s.glob&&(t=await Re(t,s.glob)),Array.isArray(t)?!!(await Promise.all(t.map(r=>i(ne(r,s),s)))).reduce((r,n)=>r&&n,!0):!!await i(ne(t,s),s)},Dt=i=>(t,e)=>{let s=Zi(e);return s.glob&&(t=Ae(t,s.glob)),Array.isArray(t)?!!t.map(r=>i(ne(r,s),s)).reduce((r,n)=>r&&n,!0):!!i(ne(t,s),s)},Rr=Dt(vs),oh=Object.assign(Pt(xs),{sync:Rr}),Or=Dt(Es),ah=Object.assign(Pt(bs),{sync:Or}),Ar=Dt($e),hh=Object.assign(Pt(je),{sync:Ar}),Cr=Dt(Ne),ch=Object.assign(Pt(ke),{sync:Cr}),_r=Dt(Ie),lh=Object.assign(Pt(Me),{sync:_r}),Ts=Dt((i,t)=>xr(t)?vs(i,t):Es(i,t)),kr=Ts,vr=Pt((i,t)=>Er(t)?xs(i,t):bs(i,t)),Tr=Object.assign(vr,{rimraf:vr,sync:Ts,rimrafSync:Ts,manual:ah,manualSync:Or,native:oh,nativeSync:Rr,posix:ch,posixSync:Cr,windows:hh,windowsSync:Ar,moveRemove:lh,moveRemoveSync:_r});Tr.rimraf=Tr;var Pr=uh(new URL(".",import.meta.url)),Os=Nr(Pr,"../builder/vite-config.js"),dh=Nr(Pr,"../builder/vite-entry-server.js");async function Dr({options:i,logger:t}){t.info(`Building template...
38
+ `),i.clean&&kr(fh.join(process.cwd(),"dist"));let e="production";i.ssr==="local"&&(e="development",process.env.NODE_ENV=e),i.ssr?(await Rs({configFile:Os,customLogger:t,mode:e,logLevel:i.logLevel,clearScreen:i.clearScreen,build:{ssrManifest:!0,emptyOutDir:!0}}),await Rs({configFile:Os,customLogger:t,mode:e,logLevel:i.logLevel,clearScreen:i.clearScreen,ssr:{target:"webworker"},build:{ssr:dh}})):await Rs({configFile:Os,customLogger:t,logLevel:i.logLevel,clearScreen:i.clearScreen,build:{emptyOutDir:!0}})}Ut();pt();async function Lr({options:i,logger:t}){t.info("Logging out fom Enpage..."),M.clear(),t.info(`Done.
39
+ `),process.exit(0)}var As;Lt.name("enpage").option("-l, --logLevel <level>","[string] info | warn | error | silent | debug").option("--clearScreen","[boolean] allow/disable clear screen when logging").option("--dry-run","[boolean] run command without making changes").hook("preAction",i=>{As=He(i.optsWithGlobals().logLevel,i.optsWithGlobals().clearScreen,!0),process.removeAllListeners("warning"),process.on("warning",t=>{t.name==="DeprecationWarning"&&t.message.includes("util.isArray")||As.warnOnce(`Warning: ${t.name} - ${t.message}`)})});Lt.command("build").description("Build template").option("--ssr [type]",`Enable server side rendering.
40
40
  Pass --ssr to generate a SSR-enabled build.
41
- Pass --ssr=local to generate a SSR-enabled build that can be tested locally.`,Boolean,!1).option("--no-clean","Don't clean directory before buidling").action(function(){Fr(We(this))});Ft.command("publish").description("Publish a template to Enpage").argument("[directory]","Directory to publish").option("--no-check","Don't check for required files").action(function(){Zs(We(this))});Ft.command("login").description("Login to Enpage").action(function(){Qs(We(this))});Ft.command("logout").description("Logout from Enpage").action(function(){Mr(We(this))});Ft.parse();function We(i){return{options:i.optsWithGlobals(),args:i.args,logger:As}}
41
+ Pass --ssr=local to generate a SSR-enabled build that can be tested locally.`,Boolean,!1).option("--no-clean","Don't clean directory before buidling").action(function(){Dr(We(this))});Lt.command("publish").description("Publish a template to Enpage").argument("[directory]","Directory to publish").option("--no-check","Don't check for required files").action(function(){Js(We(this))});Lt.command("login").description("Login to Enpage").action(function(){Xs(We(this))});Lt.command("logout").description("Logout from Enpage").action(function(){Lr(We(this))});Lt.parse();function We(i){return{options:i.optsWithGlobals(),args:i.args,logger:As}}
42
42
  /*!
43
43
  * parse-gitignore <https://github.com/jonschlinkert/parse-gitignore>
44
44
  * Copyright (c) 2015-present, Jon Schlinkert.