nitro-nightly 4.0.0-20251030-091344-d4418b98 → 4.0.0-20251030-121649-98b56dfe

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 (334) hide show
  1. package/dist/_build/common.mjs +763 -0
  2. package/dist/_build/rolldown.mjs +216 -0
  3. package/dist/_build/rollup.mjs +359 -0
  4. package/dist/_build/vite.build.mjs +67 -0
  5. package/dist/_build/vite.plugin.mjs +747 -0
  6. package/dist/_chunks/B-7HiF0V.mjs +1303 -0
  7. package/dist/_chunks/B3asVbT4.mjs +151 -0
  8. package/dist/_chunks/B5ooyfLk.mjs +372 -0
  9. package/dist/_chunks/DXMHy5ca.mjs +43 -0
  10. package/dist/_dev.d.mts +12 -0
  11. package/dist/_dev.mjs +675 -0
  12. package/dist/_libs/acorn.mjs +5034 -0
  13. package/dist/_libs/c12.mjs +2798 -0
  14. package/dist/_libs/chokidar.mjs +1560 -0
  15. package/dist/_libs/citty.mjs +333 -0
  16. package/dist/_libs/commondir.mjs +22 -0
  17. package/dist/_libs/compatx.mjs +46 -0
  18. package/dist/_libs/confbox.mjs +2920 -0
  19. package/dist/_libs/debug.mjs +848 -0
  20. package/dist/_libs/deepmerge.mjs +86 -0
  21. package/dist/_libs/depd.mjs +314 -0
  22. package/dist/_libs/dot-prop.mjs +138 -0
  23. package/dist/_libs/duplexer.mjs +71 -0
  24. package/dist/_libs/ee-first.mjs +68 -0
  25. package/dist/_libs/encodeurl.mjs +49 -0
  26. package/dist/_libs/escape-html.mjs +58 -0
  27. package/dist/_libs/escape-string-regexp.mjs +8 -0
  28. package/dist/_libs/estree-walker.mjs +330 -0
  29. package/dist/_libs/etag.mjs +75 -0
  30. package/dist/{_chunks/_deps → _libs}/fdir.mjs +49 -104
  31. package/dist/_libs/fresh.mjs +85 -0
  32. package/dist/_libs/function-bind.mjs +63 -0
  33. package/dist/_libs/gen-mapping.mjs +612 -0
  34. package/dist/_libs/giget.mjs +19076 -0
  35. package/dist/_libs/gzip-size.mjs +21 -0
  36. package/dist/_libs/hasown.mjs +14 -0
  37. package/dist/_libs/http-errors.mjs +436 -0
  38. package/dist/_libs/httpxy.mjs +410 -0
  39. package/dist/_libs/is-core-module.mjs +220 -0
  40. package/dist/_libs/is-module.mjs +13 -0
  41. package/dist/_libs/is-reference.mjs +32 -0
  42. package/dist/{_chunks/_deps → _libs}/js-tokens.mjs +83 -112
  43. package/dist/_libs/klona.mjs +90 -0
  44. package/dist/_libs/knitwork.mjs +124 -0
  45. package/dist/_libs/local-pkg.mjs +1686 -0
  46. package/dist/{_chunks/_deps → _libs}/magic-string.mjs +272 -629
  47. package/dist/_libs/mime-db.mjs +7642 -0
  48. package/dist/_libs/mime-types.mjs +162 -0
  49. package/dist/_libs/mime.mjs +1391 -0
  50. package/dist/_libs/node-fetch-native.mjs +173 -0
  51. package/dist/_libs/on-finished.mjs +170 -0
  52. package/dist/_libs/parseurl.mjs +103 -0
  53. package/dist/_libs/path-parse.mjs +47 -0
  54. package/dist/_libs/pathe.mjs +41 -0
  55. package/dist/_libs/picomatch.mjs +1673 -0
  56. package/dist/_libs/plugin-alias.mjs +64 -0
  57. package/dist/_libs/plugin-commonjs.mjs +1489 -0
  58. package/dist/_libs/plugin-inject.mjs +135 -0
  59. package/dist/_libs/plugin-json.mjs +36 -0
  60. package/dist/_libs/plugin-node-resolve.mjs +1553 -0
  61. package/dist/_libs/plugin-replace.mjs +104 -0
  62. package/dist/_libs/pretty-bytes.mjs +116 -0
  63. package/dist/_libs/range-parser.mjs +102 -0
  64. package/dist/_libs/remapping.mjs +117 -0
  65. package/dist/{_chunks/_deps → _libs}/rou3.mjs +7 -22
  66. package/dist/_libs/send.mjs +857 -0
  67. package/dist/_libs/serve-static.mjs +124 -0
  68. package/dist/_libs/std-env.mjs +158 -0
  69. package/dist/_libs/strip-literal.mjs +51 -0
  70. package/dist/{_chunks/_deps → _libs}/tinyglobby.mjs +32 -33
  71. package/dist/_libs/ultrahtml.mjs +138 -0
  72. package/dist/_libs/unimport.mjs +3520 -0
  73. package/dist/_libs/untyped.mjs +271 -0
  74. package/dist/_libs/unwasm.mjs +5825 -0
  75. package/dist/{_chunks/_deps/@pi0 → _libs}/vite-plugin-fullstack.mjs +28 -42
  76. package/dist/_presets.mjs +1723 -0
  77. package/dist/builder.d.mts +37 -35
  78. package/dist/builder.mjs +45 -117
  79. package/dist/cli/_chunks/build.mjs +43 -0
  80. package/dist/cli/_chunks/common.mjs +15 -0
  81. package/dist/cli/_chunks/detect-acorn.mjs +12 -0
  82. package/dist/cli/_chunks/dev.mjs +79 -0
  83. package/dist/cli/_chunks/dist.mjs +3 -0
  84. package/dist/cli/_chunks/dist2.mjs +4 -0
  85. package/dist/cli/_chunks/esm.mjs +3 -0
  86. package/dist/cli/_chunks/json5.mjs +4 -0
  87. package/dist/cli/_chunks/jsonc.mjs +4 -0
  88. package/dist/cli/_chunks/list.mjs +27 -0
  89. package/dist/cli/_chunks/multipart-parser.mjs +6 -0
  90. package/dist/cli/_chunks/prepare.mjs +19 -0
  91. package/dist/cli/_chunks/run.mjs +55 -0
  92. package/dist/cli/_chunks/task.mjs +16 -0
  93. package/dist/cli/_chunks/toml.mjs +4 -0
  94. package/dist/cli/_chunks/yaml.mjs +4 -0
  95. package/dist/cli/index.d.mts +1 -1
  96. package/dist/cli/index.mjs +19 -18
  97. package/dist/presets/_nitro/runtime/nitro-dev.d.mts +1 -0
  98. package/dist/presets/_nitro/runtime/nitro-dev.mjs +42 -33
  99. package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +2 -2
  100. package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +4 -8
  101. package/dist/presets/_nitro/runtime/service-worker.d.mts +1 -0
  102. package/dist/presets/_nitro/runtime/service-worker.mjs +14 -11
  103. package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +1 -0
  104. package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +6 -5
  105. package/dist/presets/aws-lambda/runtime/_utils.d.mts +8 -13
  106. package/dist/presets/aws-lambda/runtime/_utils.mjs +95 -81
  107. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +1 -2
  108. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +25 -27
  109. package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +7 -7
  110. package/dist/presets/azure/runtime/_utils.mjs +43 -43
  111. package/dist/presets/azure/runtime/azure-swa.d.mts +2 -2
  112. package/dist/presets/azure/runtime/azure-swa.mjs +22 -21
  113. package/dist/presets/bun/runtime/bun.d.mts +1 -0
  114. package/dist/presets/bun/runtime/bun.mjs +18 -17
  115. package/dist/presets/cloudflare/runtime/_module-handler.d.mts +10 -7
  116. package/dist/presets/cloudflare/runtime/_module-handler.mjs +78 -87
  117. package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +6 -14
  118. package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +53 -58
  119. package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +1 -7
  120. package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +12 -14
  121. package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +12 -12
  122. package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +35 -39
  123. package/dist/presets/cloudflare/runtime/plugin.dev.d.mts +2 -2
  124. package/dist/presets/cloudflare/runtime/plugin.dev.mjs +86 -76
  125. package/dist/presets/deno/runtime/deno-deploy.d.mts +1 -0
  126. package/dist/presets/deno/runtime/deno-deploy.mjs +12 -11
  127. package/dist/presets/deno/runtime/deno-server.d.mts +2 -1
  128. package/dist/presets/deno/runtime/deno-server.mjs +31 -39
  129. package/dist/presets/netlify/runtime/netlify-edge.d.mts +2 -1
  130. package/dist/presets/netlify/runtime/netlify-edge.mjs +14 -11
  131. package/dist/presets/netlify/runtime/netlify.mjs +11 -17
  132. package/dist/presets/node/runtime/node-cluster.mjs +49 -48
  133. package/dist/presets/node/runtime/node-middleware.d.mts +3 -2
  134. package/dist/presets/node/runtime/node-middleware.mjs +7 -6
  135. package/dist/presets/node/runtime/node-server.mjs +33 -23
  136. package/dist/presets/standard/runtime/server.d.mts +1 -3
  137. package/dist/presets/standard/runtime/server.mjs +1 -3
  138. package/dist/presets/stormkit/runtime/stormkit.d.mts +13 -13
  139. package/dist/presets/stormkit/runtime/stormkit.mjs +20 -20
  140. package/dist/presets/vercel/runtime/vercel.d.mts +3 -3
  141. package/dist/presets/vercel/runtime/vercel.mjs +15 -14
  142. package/dist/presets/winterjs/runtime/winterjs.d.mts +2 -0
  143. package/dist/presets/winterjs/runtime/winterjs.mjs +72 -68
  144. package/dist/presets/zeabur/runtime/zeabur.d.mts +1 -1
  145. package/dist/runtime/index.d.mts +12 -1
  146. package/dist/runtime/index.mjs +12 -7
  147. package/dist/runtime/internal/app.mjs +175 -162
  148. package/dist/runtime/internal/cache.d.mts +10 -4
  149. package/dist/runtime/internal/cache.mjs +247 -216
  150. package/dist/runtime/internal/context.d.mts +9 -9
  151. package/dist/runtime/internal/context.mjs +17 -10
  152. package/dist/runtime/internal/database.mjs +8 -10
  153. package/dist/runtime/internal/error/dev.d.mts +5 -4
  154. package/dist/runtime/internal/error/dev.mjs +106 -105
  155. package/dist/runtime/internal/error/prod.d.mts +2 -2
  156. package/dist/runtime/internal/error/prod.mjs +48 -52
  157. package/dist/runtime/internal/error/utils.d.mts +4 -4
  158. package/dist/runtime/internal/error/utils.mjs +1 -1
  159. package/dist/runtime/internal/index.d.mts +2 -0
  160. package/dist/runtime/internal/index.mjs +2 -0
  161. package/dist/runtime/internal/lib/http-graceful-shutdown.d.mts +14 -14
  162. package/dist/runtime/internal/lib/http-graceful-shutdown.mjs +248 -209
  163. package/dist/runtime/internal/meta.d.mts +1 -1
  164. package/dist/runtime/internal/meta.mjs +1 -1
  165. package/dist/runtime/internal/plugin.d.mts +2 -2
  166. package/dist/runtime/internal/plugin.mjs +1 -1
  167. package/dist/runtime/internal/renderer.mjs +39 -31
  168. package/dist/runtime/internal/route-rules.d.mts +8 -8
  169. package/dist/runtime/internal/route-rules.mjs +53 -51
  170. package/dist/runtime/internal/routes/dev-tasks.d.mts +1 -30
  171. package/dist/runtime/internal/routes/dev-tasks.mjs +15 -17
  172. package/dist/runtime/internal/routes/openapi.d.mts +1 -0
  173. package/dist/runtime/internal/routes/openapi.mjs +81 -87
  174. package/dist/runtime/internal/routes/renderer-template.d.mts +1 -1
  175. package/dist/runtime/internal/routes/renderer-template.dev.d.mts +1 -2
  176. package/dist/runtime/internal/routes/renderer-template.dev.mjs +10 -17
  177. package/dist/runtime/internal/routes/renderer-template.mjs +1 -1
  178. package/dist/runtime/internal/routes/scalar.d.mts +1 -0
  179. package/dist/runtime/internal/routes/scalar.mjs +22 -23
  180. package/dist/runtime/internal/routes/swagger.d.mts +1 -0
  181. package/dist/runtime/internal/routes/swagger.mjs +9 -11
  182. package/dist/runtime/internal/runtime-config.d.mts +4 -4
  183. package/dist/runtime/internal/runtime-config.mjs +40 -35
  184. package/dist/runtime/internal/shutdown.d.mts +2 -7
  185. package/dist/runtime/internal/shutdown.mjs +30 -29
  186. package/dist/runtime/internal/static.mjs +63 -74
  187. package/dist/runtime/internal/storage.mjs +2 -2
  188. package/dist/runtime/internal/task.d.mts +6 -6
  189. package/dist/runtime/internal/task.mjs +56 -59
  190. package/dist/runtime/internal/utils.d.mts +1 -1
  191. package/dist/runtime/internal/utils.mjs +4 -10
  192. package/dist/types/index.d.mts +2566 -3851
  193. package/dist/types/index.mjs +1 -1
  194. package/dist/vite.d.mts +56 -52
  195. package/dist/vite.mjs +55 -132
  196. package/package.json +10 -10
  197. package/dist/_build/build.mjs +0 -368
  198. package/dist/_build/build2.mjs +0 -556
  199. package/dist/_build/info.mjs +0 -1002
  200. package/dist/_build/prepare.mjs +0 -1511
  201. package/dist/_build/snapshot.mjs +0 -185
  202. package/dist/_build/vite.mjs +0 -959
  203. package/dist/_build/vite2.mjs +0 -149
  204. package/dist/_chunks/_deps/@jridgewell/gen-mapping.mjs +0 -189
  205. package/dist/_chunks/_deps/@jridgewell/remapping.mjs +0 -137
  206. package/dist/_chunks/_deps/@jridgewell/resolve-uri.mjs +0 -231
  207. package/dist/_chunks/_deps/@jridgewell/sourcemap-codec.mjs +0 -173
  208. package/dist/_chunks/_deps/@jridgewell/trace-mapping.mjs +0 -170
  209. package/dist/_chunks/_deps/@rollup/plugin-alias.mjs +0 -89
  210. package/dist/_chunks/_deps/@rollup/plugin-commonjs.mjs +0 -2376
  211. package/dist/_chunks/_deps/@rollup/plugin-inject.mjs +0 -212
  212. package/dist/_chunks/_deps/@rollup/plugin-json.mjs +0 -37
  213. package/dist/_chunks/_deps/@rollup/plugin-node-resolve.mjs +0 -1386
  214. package/dist/_chunks/_deps/@rollup/plugin-replace.mjs +0 -133
  215. package/dist/_chunks/_deps/@rollup/pluginutils.mjs +0 -346
  216. package/dist/_chunks/_deps/acorn.mjs +0 -6225
  217. package/dist/_chunks/_deps/c12.mjs +0 -510
  218. package/dist/_chunks/_deps/chokidar.mjs +0 -1428
  219. package/dist/_chunks/_deps/citty.mjs +0 -460
  220. package/dist/_chunks/_deps/commondir.mjs +0 -77
  221. package/dist/_chunks/_deps/compatx.mjs +0 -76
  222. package/dist/_chunks/_deps/confbox.mjs +0 -300
  223. package/dist/_chunks/_deps/debug.mjs +0 -885
  224. package/dist/_chunks/_deps/deepmerge.mjs +0 -147
  225. package/dist/_chunks/_deps/depd.mjs +0 -550
  226. package/dist/_chunks/_deps/dot-prop.mjs +0 -282
  227. package/dist/_chunks/_deps/dotenv.mjs +0 -555
  228. package/dist/_chunks/_deps/duplexer.mjs +0 -1
  229. package/dist/_chunks/_deps/ee-first.mjs +0 -104
  230. package/dist/_chunks/_deps/encodeurl.mjs +0 -69
  231. package/dist/_chunks/_deps/escape-html.mjs +0 -87
  232. package/dist/_chunks/_deps/escape-string-regexp.mjs +0 -13
  233. package/dist/_chunks/_deps/estree-walker.mjs +0 -433
  234. package/dist/_chunks/_deps/etag.mjs +0 -147
  235. package/dist/_chunks/_deps/exsolve.mjs +0 -1416
  236. package/dist/_chunks/_deps/fresh.mjs +0 -145
  237. package/dist/_chunks/_deps/function-bind.mjs +0 -106
  238. package/dist/_chunks/_deps/giget.mjs +0 -451
  239. package/dist/_chunks/_deps/gzip-size.mjs +0 -19
  240. package/dist/_chunks/_deps/hasown.mjs +0 -19
  241. package/dist/_chunks/_deps/http-errors.mjs +0 -307
  242. package/dist/_chunks/_deps/httpxy.mjs +0 -580
  243. package/dist/_chunks/_deps/inherits.mjs +0 -57
  244. package/dist/_chunks/_deps/is-core-module.mjs +0 -596
  245. package/dist/_chunks/_deps/is-module.mjs +0 -25
  246. package/dist/_chunks/_deps/is-reference.mjs +0 -31
  247. package/dist/_chunks/_deps/klona.mjs +0 -137
  248. package/dist/_chunks/_deps/knitwork.mjs +0 -172
  249. package/dist/_chunks/_deps/local-pkg.mjs +0 -163
  250. package/dist/_chunks/_deps/mime-db.mjs +0 -11685
  251. package/dist/_chunks/_deps/mime-types.mjs +0 -287
  252. package/dist/_chunks/_deps/mime.mjs +0 -1172
  253. package/dist/_chunks/_deps/mlly.mjs +0 -2413
  254. package/dist/_chunks/_deps/ms.mjs +0 -172
  255. package/dist/_chunks/_deps/node-fetch-native.mjs +0 -3
  256. package/dist/_chunks/_deps/nypm.mjs +0 -219
  257. package/dist/_chunks/_deps/on-finished.mjs +0 -246
  258. package/dist/_chunks/_deps/parseurl.mjs +0 -168
  259. package/dist/_chunks/_deps/path-parse.mjs +0 -85
  260. package/dist/_chunks/_deps/pathe.mjs +0 -251
  261. package/dist/_chunks/_deps/perfect-debounce.mjs +0 -88
  262. package/dist/_chunks/_deps/picomatch.mjs +0 -2144
  263. package/dist/_chunks/_deps/pkg-types.mjs +0 -247
  264. package/dist/_chunks/_deps/pretty-bytes.mjs +0 -180
  265. package/dist/_chunks/_deps/quansync.mjs +0 -99
  266. package/dist/_chunks/_deps/range-parser.mjs +0 -171
  267. package/dist/_chunks/_deps/rc9.mjs +0 -219
  268. package/dist/_chunks/_deps/readdirp.mjs +0 -245
  269. package/dist/_chunks/_deps/resolve.mjs +0 -1260
  270. package/dist/_chunks/_deps/send.mjs +0 -1022
  271. package/dist/_chunks/_deps/serve-static.mjs +0 -228
  272. package/dist/_chunks/_deps/setprototypeof.mjs +0 -26
  273. package/dist/_chunks/_deps/statuses.mjs +0 -457
  274. package/dist/_chunks/_deps/std-env.mjs +0 -3
  275. package/dist/_chunks/_deps/strip-literal.mjs +0 -67
  276. package/dist/_chunks/_deps/supports-color.mjs +0 -44
  277. package/dist/_chunks/_deps/tinyexec.mjs +0 -552
  278. package/dist/_chunks/_deps/toidentifier.mjs +0 -41
  279. package/dist/_chunks/_deps/ultrahtml.mjs +0 -3
  280. package/dist/_chunks/_deps/unimport.mjs +0 -2267
  281. package/dist/_chunks/_deps/unplugin-utils.mjs +0 -65
  282. package/dist/_chunks/_deps/unplugin.mjs +0 -1294
  283. package/dist/_chunks/_deps/untyped.mjs +0 -375
  284. package/dist/_chunks/_deps/unwasm.mjs +0 -6959
  285. package/dist/_chunks/_deps/webpack-virtual-modules.mjs +0 -360
  286. package/dist/_chunks/_presets/_all.mjs +0 -59
  287. package/dist/_chunks/_presets/_nitro.mjs +0 -74
  288. package/dist/_chunks/_presets/_resolve.mjs +0 -64
  289. package/dist/_chunks/_presets/_static.mjs +0 -69
  290. package/dist/_chunks/_presets/_types.mjs +0 -3
  291. package/dist/_chunks/_presets/_utils.mjs +0 -31
  292. package/dist/_chunks/_presets/alwaysdata.mjs +0 -17
  293. package/dist/_chunks/_presets/aws-amplify.mjs +0 -111
  294. package/dist/_chunks/_presets/aws-lambda.mjs +0 -23
  295. package/dist/_chunks/_presets/azure.mjs +0 -162
  296. package/dist/_chunks/_presets/bun.mjs +0 -19
  297. package/dist/_chunks/_presets/cleavr.mjs +0 -15
  298. package/dist/_chunks/_presets/cloudflare.mjs +0 -608
  299. package/dist/_chunks/_presets/deno.mjs +0 -196
  300. package/dist/_chunks/_presets/digitalocean.mjs +0 -14
  301. package/dist/_chunks/_presets/firebase.mjs +0 -47
  302. package/dist/_chunks/_presets/flightcontrol.mjs +0 -14
  303. package/dist/_chunks/_presets/genezio.mjs +0 -13
  304. package/dist/_chunks/_presets/heroku.mjs +0 -14
  305. package/dist/_chunks/_presets/iis.mjs +0 -194
  306. package/dist/_chunks/_presets/index.mjs +0 -62
  307. package/dist/_chunks/_presets/koyeb.mjs +0 -14
  308. package/dist/_chunks/_presets/netlify.mjs +0 -241
  309. package/dist/_chunks/_presets/node.mjs +0 -54
  310. package/dist/_chunks/_presets/platform.mjs +0 -14
  311. package/dist/_chunks/_presets/render.mjs +0 -14
  312. package/dist/_chunks/_presets/standard.mjs +0 -23
  313. package/dist/_chunks/_presets/stormkit.mjs +0 -18
  314. package/dist/_chunks/_presets/vercel.mjs +0 -375
  315. package/dist/_chunks/_presets/winterjs.mjs +0 -22
  316. package/dist/_chunks/_presets/zeabur.mjs +0 -69
  317. package/dist/_chunks/_presets/zerops.mjs +0 -27
  318. package/dist/_chunks/app.mjs +0 -600
  319. package/dist/_chunks/builder.mjs +0 -648
  320. package/dist/_chunks/server.mjs +0 -256
  321. package/dist/_cli/build.mjs +0 -49
  322. package/dist/_cli/common.mjs +0 -13
  323. package/dist/_cli/dev.mjs +0 -121
  324. package/dist/_cli/index.mjs +0 -16
  325. package/dist/_cli/list.mjs +0 -33
  326. package/dist/_cli/prepare.mjs +0 -23
  327. package/dist/_cli/run.mjs +0 -59
  328. package/dist/presets/cloudflare/runtime/shims/workers.dev.d.mts +0 -21
  329. package/dist/runtime/internal/empty.d.mts +0 -0
  330. package/dist/runtime/internal/vite/dev-entry.d.mts +0 -1
  331. package/dist/runtime/internal/vite/dev-worker.d.mts +0 -1
  332. package/dist/runtime/internal/vite/prod-setup.d.mts +0 -4
  333. package/dist/runtime/internal/vite/ssr-renderer.d.mts +0 -4
  334. /package/lib/{indexd.mts → index.d.mts} +0 -0
@@ -0,0 +1,2798 @@
1
+ import { i as __require, s as __toESM, t as __commonJS } from "../_chunks/DXMHy5ca.mjs";
2
+ import path, { isAbsolute, resolve } from "node:path";
3
+ import process$1 from "node:process";
4
+ import fs, { existsSync, lstatSync, promises, readFileSync, realpathSync, statSync } from "node:fs";
5
+ import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
6
+ import assert from "node:assert";
7
+ import v8 from "node:v8";
8
+ import { format, inspect } from "node:util";
9
+ import { readFile, rm, writeFile } from "node:fs/promises";
10
+ import { homedir } from "node:os";
11
+ import { createJiti } from "jiti";
12
+ import destr from "destr";
13
+ import { defu } from "defu";
14
+
15
+ //#region node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
16
+ const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
17
+ function normalizeWindowsPath(input = "") {
18
+ if (!input) return input;
19
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r$1) => r$1.toUpperCase());
20
+ }
21
+ const _UNC_REGEX = /^[/\\]{2}/;
22
+ const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
23
+ const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
24
+ const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
25
+ const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
26
+ const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
27
+ const normalize$1 = function(path$2) {
28
+ if (path$2.length === 0) return ".";
29
+ path$2 = normalizeWindowsPath(path$2);
30
+ const isUNCPath = path$2.match(_UNC_REGEX);
31
+ const isPathAbsolute = isAbsolute$1(path$2);
32
+ const trailingSeparator = path$2[path$2.length - 1] === "/";
33
+ path$2 = normalizeString(path$2, !isPathAbsolute);
34
+ if (path$2.length === 0) {
35
+ if (isPathAbsolute) return "/";
36
+ return trailingSeparator ? "./" : ".";
37
+ }
38
+ if (trailingSeparator) path$2 += "/";
39
+ if (_DRIVE_LETTER_RE.test(path$2)) path$2 += "/";
40
+ if (isUNCPath) {
41
+ if (!isPathAbsolute) return `//./${path$2}`;
42
+ return `//${path$2}`;
43
+ }
44
+ return isPathAbsolute && !isAbsolute$1(path$2) ? `/${path$2}` : path$2;
45
+ };
46
+ const join$1 = function(...segments) {
47
+ let path$2 = "";
48
+ for (const seg of segments) {
49
+ if (!seg) continue;
50
+ if (path$2.length > 0) {
51
+ const pathTrailing = path$2[path$2.length - 1] === "/";
52
+ const segLeading = seg[0] === "/";
53
+ if (pathTrailing && segLeading) path$2 += seg.slice(1);
54
+ else path$2 += pathTrailing || segLeading ? seg : `/${seg}`;
55
+ } else path$2 += seg;
56
+ }
57
+ return normalize$1(path$2);
58
+ };
59
+ function cwd() {
60
+ if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
61
+ return "/";
62
+ }
63
+ const resolve$1 = function(...arguments_) {
64
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
65
+ let resolvedPath = "";
66
+ let resolvedAbsolute = false;
67
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
68
+ const path$2 = index >= 0 ? arguments_[index] : cwd();
69
+ if (!path$2 || path$2.length === 0) continue;
70
+ resolvedPath = `${path$2}/${resolvedPath}`;
71
+ resolvedAbsolute = isAbsolute$1(path$2);
72
+ }
73
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
74
+ if (resolvedAbsolute && !isAbsolute$1(resolvedPath)) return `/${resolvedPath}`;
75
+ return resolvedPath.length > 0 ? resolvedPath : ".";
76
+ };
77
+ function normalizeString(path$2, allowAboveRoot) {
78
+ let res = "";
79
+ let lastSegmentLength = 0;
80
+ let lastSlash = -1;
81
+ let dots = 0;
82
+ let char = null;
83
+ for (let index = 0; index <= path$2.length; ++index) {
84
+ if (index < path$2.length) char = path$2[index];
85
+ else if (char === "/") break;
86
+ else char = "/";
87
+ if (char === "/") {
88
+ if (lastSlash === index - 1 || dots === 1);
89
+ else if (dots === 2) {
90
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
91
+ if (res.length > 2) {
92
+ const lastSlashIndex = res.lastIndexOf("/");
93
+ if (lastSlashIndex === -1) {
94
+ res = "";
95
+ lastSegmentLength = 0;
96
+ } else {
97
+ res = res.slice(0, lastSlashIndex);
98
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
99
+ }
100
+ lastSlash = index;
101
+ dots = 0;
102
+ continue;
103
+ } else if (res.length > 0) {
104
+ res = "";
105
+ lastSegmentLength = 0;
106
+ lastSlash = index;
107
+ dots = 0;
108
+ continue;
109
+ }
110
+ }
111
+ if (allowAboveRoot) {
112
+ res += res.length > 0 ? "/.." : "..";
113
+ lastSegmentLength = 2;
114
+ }
115
+ } else {
116
+ if (res.length > 0) res += `/${path$2.slice(lastSlash + 1, index)}`;
117
+ else res = path$2.slice(lastSlash + 1, index);
118
+ lastSegmentLength = index - lastSlash - 1;
119
+ }
120
+ lastSlash = index;
121
+ dots = 0;
122
+ } else if (char === "." && dots !== -1) ++dots;
123
+ else dots = -1;
124
+ }
125
+ return res;
126
+ }
127
+ const isAbsolute$1 = function(p) {
128
+ return _IS_ABSOLUTE_RE.test(p);
129
+ };
130
+ const extname$1 = function(p) {
131
+ if (p === "..") return "";
132
+ const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
133
+ return match && match[1] || "";
134
+ };
135
+ const relative$1 = function(from, to) {
136
+ const _from = resolve$1(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
137
+ const _to = resolve$1(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
138
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) return _to.join("/");
139
+ const _fromCopy = [..._from];
140
+ for (const segment of _fromCopy) {
141
+ if (_to[0] !== segment) break;
142
+ _from.shift();
143
+ _to.shift();
144
+ }
145
+ return [..._from.map(() => ".."), ..._to].join("/");
146
+ };
147
+ const dirname$1 = function(p) {
148
+ const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
149
+ if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
150
+ return segments.join("/") || (isAbsolute$1(p) ? "/" : ".");
151
+ };
152
+ const basename$1 = function(p, extension) {
153
+ const segments = normalizeWindowsPath(p).split("/");
154
+ let lastSegment = "";
155
+ for (let i = segments.length - 1; i >= 0; i--) {
156
+ const val = segments[i];
157
+ if (val) {
158
+ lastSegment = val;
159
+ break;
160
+ }
161
+ }
162
+ return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
163
+ };
164
+ const parse$2 = function(p) {
165
+ const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
166
+ const base = basename$1(p);
167
+ const extension = extname$1(base);
168
+ return {
169
+ root,
170
+ dir: dirname$1(p),
171
+ base,
172
+ ext: extension,
173
+ name: base.slice(0, base.length - extension.length)
174
+ };
175
+ };
176
+
177
+ //#endregion
178
+ //#region node_modules/.pnpm/confbox@0.2.2/node_modules/confbox/dist/shared/confbox.DA7CpUDY.mjs
179
+ const b = /^(?:( )+|\t+)/, d$1 = "space", h$1 = "tab";
180
+ function g(e, t) {
181
+ const n = /* @__PURE__ */ new Map();
182
+ let s = 0, o, i;
183
+ for (const c of e.split(/\n/g)) {
184
+ if (!c) continue;
185
+ let f, a, l, p, r$1;
186
+ const y = c.match(b);
187
+ if (y === null) s = 0, o = "";
188
+ else {
189
+ if (f = y[0].length, a = y[1] ? d$1 : h$1, t && a === d$1 && f === 1) continue;
190
+ a !== o && (s = 0), o = a, l = 1, p = 0;
191
+ const u = f - s;
192
+ if (s = f, u === 0) l = 0, p = 1;
193
+ else {
194
+ const I$1 = u > 0 ? u : -u;
195
+ i = T(a, I$1);
196
+ }
197
+ r$1 = n.get(i), r$1 = r$1 === void 0 ? [1, 0] : [r$1[0] + l, r$1[1] + p], n.set(i, r$1);
198
+ }
199
+ }
200
+ return n;
201
+ }
202
+ function T(e, t) {
203
+ return (e === d$1 ? "s" : "t") + String(t);
204
+ }
205
+ function w(e) {
206
+ return {
207
+ type: e[0] === "s" ? d$1 : h$1,
208
+ amount: Number(e.slice(1))
209
+ };
210
+ }
211
+ function E(e) {
212
+ let t, n = 0, s = 0;
213
+ for (const [o, [i, c]] of e) (i > n || i === n && c > s) && (n = i, s = c, t = o);
214
+ return t;
215
+ }
216
+ function S$2(e, t) {
217
+ return (e === d$1 ? " " : " ").repeat(t);
218
+ }
219
+ function _(e) {
220
+ if (typeof e != "string") throw new TypeError("Expected a string");
221
+ let t = g(e, !0);
222
+ t.size === 0 && (t = g(e, !1));
223
+ const n = E(t);
224
+ let s, o = 0, i = "";
225
+ return n !== void 0 && ({type: s, amount: o} = w(n), i = S$2(s, o)), {
226
+ amount: o,
227
+ type: s,
228
+ indent: i
229
+ };
230
+ }
231
+ const m = Symbol.for("__confbox_fmt__"), k = /^(\s+)/, v = /(\s+)$/;
232
+ function x$2(e, t = {}) {
233
+ return {
234
+ sample: t.indent === void 0 && t.preserveIndentation !== !1 && e.slice(0, t?.sampleSize || 1024),
235
+ whiteSpace: t.preserveWhitespace === !1 ? void 0 : {
236
+ start: k.exec(e)?.[0] || "",
237
+ end: v.exec(e)?.[0] || ""
238
+ }
239
+ };
240
+ }
241
+ function N(e, t, n) {
242
+ !t || typeof t != "object" || Object.defineProperty(t, m, {
243
+ enumerable: !1,
244
+ configurable: !0,
245
+ writable: !0,
246
+ value: x$2(e, n)
247
+ });
248
+ }
249
+ function C(e, t) {
250
+ if (!e || typeof e != "object" || !(m in e)) return {
251
+ indent: t?.indent ?? 2,
252
+ whitespace: {
253
+ start: "",
254
+ end: ""
255
+ }
256
+ };
257
+ const n = e[m];
258
+ return {
259
+ indent: t?.indent || _(n.sample || "").indent,
260
+ whitespace: n.whiteSpace || {
261
+ start: "",
262
+ end: ""
263
+ }
264
+ };
265
+ }
266
+
267
+ //#endregion
268
+ //#region node_modules/.pnpm/confbox@0.2.2/node_modules/confbox/dist/shared/confbox.DnMsyigM.mjs
269
+ function $$1(n, l = !1) {
270
+ const g$1 = n.length;
271
+ let e = 0, u = "", p = 0, k$1 = 16, A = 0, o = 0, O$1 = 0, B = 0, b$1 = 0;
272
+ function I$1(i, T$1) {
273
+ let s = 0, c = 0;
274
+ for (; s < i;) {
275
+ let t = n.charCodeAt(e);
276
+ if (t >= 48 && t <= 57) c = c * 16 + t - 48;
277
+ else if (t >= 65 && t <= 70) c = c * 16 + t - 65 + 10;
278
+ else if (t >= 97 && t <= 102) c = c * 16 + t - 97 + 10;
279
+ else break;
280
+ e++, s++;
281
+ }
282
+ return s < i && (c = -1), c;
283
+ }
284
+ function V(i) {
285
+ e = i, u = "", p = 0, k$1 = 16, b$1 = 0;
286
+ }
287
+ function F() {
288
+ let i = e;
289
+ if (n.charCodeAt(e) === 48) e++;
290
+ else for (e++; e < n.length && L(n.charCodeAt(e));) e++;
291
+ if (e < n.length && n.charCodeAt(e) === 46) if (e++, e < n.length && L(n.charCodeAt(e))) for (e++; e < n.length && L(n.charCodeAt(e));) e++;
292
+ else return b$1 = 3, n.substring(i, e);
293
+ let T$1 = e;
294
+ if (e < n.length && (n.charCodeAt(e) === 69 || n.charCodeAt(e) === 101)) if (e++, (e < n.length && n.charCodeAt(e) === 43 || n.charCodeAt(e) === 45) && e++, e < n.length && L(n.charCodeAt(e))) {
295
+ for (e++; e < n.length && L(n.charCodeAt(e));) e++;
296
+ T$1 = e;
297
+ } else b$1 = 3;
298
+ return n.substring(i, T$1);
299
+ }
300
+ function a() {
301
+ let i = "", T$1 = e;
302
+ for (;;) {
303
+ if (e >= g$1) {
304
+ i += n.substring(T$1, e), b$1 = 2;
305
+ break;
306
+ }
307
+ const s = n.charCodeAt(e);
308
+ if (s === 34) {
309
+ i += n.substring(T$1, e), e++;
310
+ break;
311
+ }
312
+ if (s === 92) {
313
+ if (i += n.substring(T$1, e), e++, e >= g$1) {
314
+ b$1 = 2;
315
+ break;
316
+ }
317
+ switch (n.charCodeAt(e++)) {
318
+ case 34:
319
+ i += "\"";
320
+ break;
321
+ case 92:
322
+ i += "\\";
323
+ break;
324
+ case 47:
325
+ i += "/";
326
+ break;
327
+ case 98:
328
+ i += "\b";
329
+ break;
330
+ case 102:
331
+ i += "\f";
332
+ break;
333
+ case 110:
334
+ i += `
335
+ `;
336
+ break;
337
+ case 114:
338
+ i += "\r";
339
+ break;
340
+ case 116:
341
+ i += " ";
342
+ break;
343
+ case 117:
344
+ const t = I$1(4);
345
+ t >= 0 ? i += String.fromCharCode(t) : b$1 = 4;
346
+ break;
347
+ default: b$1 = 5;
348
+ }
349
+ T$1 = e;
350
+ continue;
351
+ }
352
+ if (s >= 0 && s <= 31) if (r(s)) {
353
+ i += n.substring(T$1, e), b$1 = 2;
354
+ break;
355
+ } else b$1 = 6;
356
+ e++;
357
+ }
358
+ return i;
359
+ }
360
+ function w$1() {
361
+ if (u = "", b$1 = 0, p = e, o = A, B = O$1, e >= g$1) return p = g$1, k$1 = 17;
362
+ let i = n.charCodeAt(e);
363
+ if (J(i)) {
364
+ do
365
+ e++, u += String.fromCharCode(i), i = n.charCodeAt(e);
366
+ while (J(i));
367
+ return k$1 = 15;
368
+ }
369
+ if (r(i)) return e++, u += String.fromCharCode(i), i === 13 && n.charCodeAt(e) === 10 && (e++, u += `
370
+ `), A++, O$1 = e, k$1 = 14;
371
+ switch (i) {
372
+ case 123: return e++, k$1 = 1;
373
+ case 125: return e++, k$1 = 2;
374
+ case 91: return e++, k$1 = 3;
375
+ case 93: return e++, k$1 = 4;
376
+ case 58: return e++, k$1 = 6;
377
+ case 44: return e++, k$1 = 5;
378
+ case 34: return e++, u = a(), k$1 = 10;
379
+ case 47:
380
+ const T$1 = e - 1;
381
+ if (n.charCodeAt(e + 1) === 47) {
382
+ for (e += 2; e < g$1 && !r(n.charCodeAt(e));) e++;
383
+ return u = n.substring(T$1, e), k$1 = 12;
384
+ }
385
+ if (n.charCodeAt(e + 1) === 42) {
386
+ e += 2;
387
+ const s = g$1 - 1;
388
+ let c = !1;
389
+ for (; e < s;) {
390
+ const t = n.charCodeAt(e);
391
+ if (t === 42 && n.charCodeAt(e + 1) === 47) {
392
+ e += 2, c = !0;
393
+ break;
394
+ }
395
+ e++, r(t) && (t === 13 && n.charCodeAt(e) === 10 && e++, A++, O$1 = e);
396
+ }
397
+ return c || (e++, b$1 = 1), u = n.substring(T$1, e), k$1 = 13;
398
+ }
399
+ return u += String.fromCharCode(i), e++, k$1 = 16;
400
+ case 45: if (u += String.fromCharCode(i), e++, e === g$1 || !L(n.charCodeAt(e))) return k$1 = 16;
401
+ case 48:
402
+ case 49:
403
+ case 50:
404
+ case 51:
405
+ case 52:
406
+ case 53:
407
+ case 54:
408
+ case 55:
409
+ case 56:
410
+ case 57: return u += F(), k$1 = 11;
411
+ default:
412
+ for (; e < g$1 && v$1(i);) e++, i = n.charCodeAt(e);
413
+ if (p !== e) {
414
+ switch (u = n.substring(p, e), u) {
415
+ case "true": return k$1 = 8;
416
+ case "false": return k$1 = 9;
417
+ case "null": return k$1 = 7;
418
+ }
419
+ return k$1 = 16;
420
+ }
421
+ return u += String.fromCharCode(i), e++, k$1 = 16;
422
+ }
423
+ }
424
+ function v$1(i) {
425
+ if (J(i) || r(i)) return !1;
426
+ switch (i) {
427
+ case 125:
428
+ case 93:
429
+ case 123:
430
+ case 91:
431
+ case 34:
432
+ case 58:
433
+ case 44:
434
+ case 47: return !1;
435
+ }
436
+ return !0;
437
+ }
438
+ function j$1() {
439
+ let i;
440
+ do
441
+ i = w$1();
442
+ while (i >= 12 && i <= 15);
443
+ return i;
444
+ }
445
+ return {
446
+ setPosition: V,
447
+ getPosition: () => e,
448
+ scan: l ? j$1 : w$1,
449
+ getToken: () => k$1,
450
+ getTokenValue: () => u,
451
+ getTokenOffset: () => p,
452
+ getTokenLength: () => e - p,
453
+ getTokenStartLine: () => o,
454
+ getTokenStartCharacter: () => p - B,
455
+ getTokenError: () => b$1
456
+ };
457
+ }
458
+ function J(n) {
459
+ return n === 32 || n === 9;
460
+ }
461
+ function r(n) {
462
+ return n === 10 || n === 13;
463
+ }
464
+ function L(n) {
465
+ return n >= 48 && n <= 57;
466
+ }
467
+ var Q;
468
+ (function(n) {
469
+ n[n.lineFeed = 10] = "lineFeed", n[n.carriageReturn = 13] = "carriageReturn", n[n.space = 32] = "space", n[n._0 = 48] = "_0", n[n._1 = 49] = "_1", n[n._2 = 50] = "_2", n[n._3 = 51] = "_3", n[n._4 = 52] = "_4", n[n._5 = 53] = "_5", n[n._6 = 54] = "_6", n[n._7 = 55] = "_7", n[n._8 = 56] = "_8", n[n._9 = 57] = "_9", n[n.a = 97] = "a", n[n.b = 98] = "b", n[n.c = 99] = "c", n[n.d = 100] = "d", n[n.e = 101] = "e", n[n.f = 102] = "f", n[n.g = 103] = "g", n[n.h = 104] = "h", n[n.i = 105] = "i", n[n.j = 106] = "j", n[n.k = 107] = "k", n[n.l = 108] = "l", n[n.m = 109] = "m", n[n.n = 110] = "n", n[n.o = 111] = "o", n[n.p = 112] = "p", n[n.q = 113] = "q", n[n.r = 114] = "r", n[n.s = 115] = "s", n[n.t = 116] = "t", n[n.u = 117] = "u", n[n.v = 118] = "v", n[n.w = 119] = "w", n[n.x = 120] = "x", n[n.y = 121] = "y", n[n.z = 122] = "z", n[n.A = 65] = "A", n[n.B = 66] = "B", n[n.C = 67] = "C", n[n.D = 68] = "D", n[n.E = 69] = "E", n[n.F = 70] = "F", n[n.G = 71] = "G", n[n.H = 72] = "H", n[n.I = 73] = "I", n[n.J = 74] = "J", n[n.K = 75] = "K", n[n.L = 76] = "L", n[n.M = 77] = "M", n[n.N = 78] = "N", n[n.O = 79] = "O", n[n.P = 80] = "P", n[n.Q = 81] = "Q", n[n.R = 82] = "R", n[n.S = 83] = "S", n[n.T = 84] = "T", n[n.U = 85] = "U", n[n.V = 86] = "V", n[n.W = 87] = "W", n[n.X = 88] = "X", n[n.Y = 89] = "Y", n[n.Z = 90] = "Z", n[n.asterisk = 42] = "asterisk", n[n.backslash = 92] = "backslash", n[n.closeBrace = 125] = "closeBrace", n[n.closeBracket = 93] = "closeBracket", n[n.colon = 58] = "colon", n[n.comma = 44] = "comma", n[n.dot = 46] = "dot", n[n.doubleQuote = 34] = "doubleQuote", n[n.minus = 45] = "minus", n[n.openBrace = 123] = "openBrace", n[n.openBracket = 91] = "openBracket", n[n.plus = 43] = "plus", n[n.slash = 47] = "slash", n[n.formFeed = 12] = "formFeed", n[n.tab = 9] = "tab";
470
+ })(Q || (Q = {})), new Array(20).fill(0).map((n, l) => " ".repeat(l));
471
+ const N$1 = 200;
472
+ new Array(N$1).fill(0).map((n, l) => `
473
+ ` + " ".repeat(l)), new Array(N$1).fill(0).map((n, l) => "\r" + " ".repeat(l)), new Array(N$1).fill(0).map((n, l) => `\r
474
+ ` + " ".repeat(l)), new Array(N$1).fill(0).map((n, l) => `
475
+ ` + " ".repeat(l)), new Array(N$1).fill(0).map((n, l) => "\r" + " ".repeat(l)), new Array(N$1).fill(0).map((n, l) => `\r
476
+ ` + " ".repeat(l));
477
+ var U;
478
+ (function(n) {
479
+ n.DEFAULT = { allowTrailingComma: !1 };
480
+ })(U || (U = {}));
481
+ function S$1(n, l = [], g$1 = U.DEFAULT) {
482
+ let e = null, u = [];
483
+ const p = [];
484
+ function k$1(o) {
485
+ Array.isArray(u) ? u.push(o) : e !== null && (u[e] = o);
486
+ }
487
+ return P(n, {
488
+ onObjectBegin: () => {
489
+ const o = {};
490
+ k$1(o), p.push(u), u = o, e = null;
491
+ },
492
+ onObjectProperty: (o) => {
493
+ e = o;
494
+ },
495
+ onObjectEnd: () => {
496
+ u = p.pop();
497
+ },
498
+ onArrayBegin: () => {
499
+ const o = [];
500
+ k$1(o), p.push(u), u = o, e = null;
501
+ },
502
+ onArrayEnd: () => {
503
+ u = p.pop();
504
+ },
505
+ onLiteralValue: k$1,
506
+ onError: (o, O$1, B) => {
507
+ l.push({
508
+ error: o,
509
+ offset: O$1,
510
+ length: B
511
+ });
512
+ }
513
+ }, g$1), u[0];
514
+ }
515
+ function P(n, l, g$1 = U.DEFAULT) {
516
+ const e = $$1(n, !1), u = [];
517
+ let p = 0;
518
+ function k$1(f) {
519
+ return f ? () => p === 0 && f(e.getTokenOffset(), e.getTokenLength(), e.getTokenStartLine(), e.getTokenStartCharacter()) : () => !0;
520
+ }
521
+ function A(f) {
522
+ return f ? (m$1) => p === 0 && f(m$1, e.getTokenOffset(), e.getTokenLength(), e.getTokenStartLine(), e.getTokenStartCharacter()) : () => !0;
523
+ }
524
+ function o(f) {
525
+ return f ? (m$1) => p === 0 && f(m$1, e.getTokenOffset(), e.getTokenLength(), e.getTokenStartLine(), e.getTokenStartCharacter(), () => u.slice()) : () => !0;
526
+ }
527
+ function O$1(f) {
528
+ return f ? () => {
529
+ p > 0 ? p++ : f(e.getTokenOffset(), e.getTokenLength(), e.getTokenStartLine(), e.getTokenStartCharacter(), () => u.slice()) === !1 && (p = 1);
530
+ } : () => !0;
531
+ }
532
+ function B(f) {
533
+ return f ? () => {
534
+ p > 0 && p--, p === 0 && f(e.getTokenOffset(), e.getTokenLength(), e.getTokenStartLine(), e.getTokenStartCharacter());
535
+ } : () => !0;
536
+ }
537
+ const b$1 = O$1(l.onObjectBegin), I$1 = o(l.onObjectProperty), V = B(l.onObjectEnd), F = O$1(l.onArrayBegin), a = B(l.onArrayEnd), w$1 = o(l.onLiteralValue), v$1 = A(l.onSeparator), j$1 = k$1(l.onComment), i = A(l.onError), T$1 = g$1 && g$1.disallowComments, s = g$1 && g$1.allowTrailingComma;
538
+ function c() {
539
+ for (;;) {
540
+ const f = e.scan();
541
+ switch (e.getTokenError()) {
542
+ case 4:
543
+ t(14);
544
+ break;
545
+ case 5:
546
+ t(15);
547
+ break;
548
+ case 3:
549
+ t(13);
550
+ break;
551
+ case 1:
552
+ T$1 || t(11);
553
+ break;
554
+ case 2:
555
+ t(12);
556
+ break;
557
+ case 6:
558
+ t(16);
559
+ break;
560
+ }
561
+ switch (f) {
562
+ case 12:
563
+ case 13:
564
+ T$1 ? t(10) : j$1();
565
+ break;
566
+ case 16:
567
+ t(1);
568
+ break;
569
+ case 15:
570
+ case 14: break;
571
+ default: return f;
572
+ }
573
+ }
574
+ }
575
+ function t(f, m$1 = [], y = []) {
576
+ if (i(f), m$1.length + y.length > 0) {
577
+ let _$1 = e.getToken();
578
+ for (; _$1 !== 17;) {
579
+ if (m$1.indexOf(_$1) !== -1) {
580
+ c();
581
+ break;
582
+ } else if (y.indexOf(_$1) !== -1) break;
583
+ _$1 = c();
584
+ }
585
+ }
586
+ }
587
+ function D(f) {
588
+ const m$1 = e.getTokenValue();
589
+ return f ? w$1(m$1) : (I$1(m$1), u.push(m$1)), c(), !0;
590
+ }
591
+ function G() {
592
+ switch (e.getToken()) {
593
+ case 11:
594
+ const f = e.getTokenValue();
595
+ let m$1 = Number(f);
596
+ isNaN(m$1) && (t(2), m$1 = 0), w$1(m$1);
597
+ break;
598
+ case 7:
599
+ w$1(null);
600
+ break;
601
+ case 8:
602
+ w$1(!0);
603
+ break;
604
+ case 9:
605
+ w$1(!1);
606
+ break;
607
+ default: return !1;
608
+ }
609
+ return c(), !0;
610
+ }
611
+ function M() {
612
+ return e.getToken() !== 10 ? (t(3, [], [2, 5]), !1) : (D(!1), e.getToken() === 6 ? (v$1(":"), c(), E$1() || t(4, [], [2, 5])) : t(5, [], [2, 5]), u.pop(), !0);
613
+ }
614
+ function X() {
615
+ b$1(), c();
616
+ let f = !1;
617
+ for (; e.getToken() !== 2 && e.getToken() !== 17;) {
618
+ if (e.getToken() === 5) {
619
+ if (f || t(4, [], []), v$1(","), c(), e.getToken() === 2 && s) break;
620
+ } else f && t(6, [], []);
621
+ M() || t(4, [], [2, 5]), f = !0;
622
+ }
623
+ return V(), e.getToken() !== 2 ? t(7, [2], []) : c(), !0;
624
+ }
625
+ function Y() {
626
+ F(), c();
627
+ let f = !0, m$1 = !1;
628
+ for (; e.getToken() !== 4 && e.getToken() !== 17;) {
629
+ if (e.getToken() === 5) {
630
+ if (m$1 || t(4, [], []), v$1(","), c(), e.getToken() === 4 && s) break;
631
+ } else m$1 && t(6, [], []);
632
+ f ? (u.push(0), f = !1) : u[u.length - 1]++, E$1() || t(4, [], [4, 5]), m$1 = !0;
633
+ }
634
+ return a(), f || u.pop(), e.getToken() !== 4 ? t(8, [4], []) : c(), !0;
635
+ }
636
+ function E$1() {
637
+ switch (e.getToken()) {
638
+ case 3: return Y();
639
+ case 1: return X();
640
+ case 10: return D(!0);
641
+ default: return G();
642
+ }
643
+ }
644
+ return c(), e.getToken() === 17 ? g$1.allowEmptyContent ? !0 : (t(4, [], []), !1) : E$1() ? (e.getToken() !== 17 && t(9, [], []), !0) : (t(4, [], []), !1);
645
+ }
646
+ var W;
647
+ (function(n) {
648
+ n[n.None = 0] = "None", n[n.UnexpectedEndOfComment = 1] = "UnexpectedEndOfComment", n[n.UnexpectedEndOfString = 2] = "UnexpectedEndOfString", n[n.UnexpectedEndOfNumber = 3] = "UnexpectedEndOfNumber", n[n.InvalidUnicode = 4] = "InvalidUnicode", n[n.InvalidEscapeCharacter = 5] = "InvalidEscapeCharacter", n[n.InvalidCharacter = 6] = "InvalidCharacter";
649
+ })(W || (W = {}));
650
+ var H;
651
+ (function(n) {
652
+ n[n.OpenBraceToken = 1] = "OpenBraceToken", n[n.CloseBraceToken = 2] = "CloseBraceToken", n[n.OpenBracketToken = 3] = "OpenBracketToken", n[n.CloseBracketToken = 4] = "CloseBracketToken", n[n.CommaToken = 5] = "CommaToken", n[n.ColonToken = 6] = "ColonToken", n[n.NullKeyword = 7] = "NullKeyword", n[n.TrueKeyword = 8] = "TrueKeyword", n[n.FalseKeyword = 9] = "FalseKeyword", n[n.StringLiteral = 10] = "StringLiteral", n[n.NumericLiteral = 11] = "NumericLiteral", n[n.LineCommentTrivia = 12] = "LineCommentTrivia", n[n.BlockCommentTrivia = 13] = "BlockCommentTrivia", n[n.LineBreakTrivia = 14] = "LineBreakTrivia", n[n.Trivia = 15] = "Trivia", n[n.Unknown = 16] = "Unknown", n[n.EOF = 17] = "EOF";
653
+ })(H || (H = {}));
654
+ const K = S$1;
655
+ var q;
656
+ (function(n) {
657
+ n[n.InvalidSymbol = 1] = "InvalidSymbol", n[n.InvalidNumberFormat = 2] = "InvalidNumberFormat", n[n.PropertyNameExpected = 3] = "PropertyNameExpected", n[n.ValueExpected = 4] = "ValueExpected", n[n.ColonExpected = 5] = "ColonExpected", n[n.CommaExpected = 6] = "CommaExpected", n[n.CloseBraceExpected = 7] = "CloseBraceExpected", n[n.CloseBracketExpected = 8] = "CloseBracketExpected", n[n.EndOfFileExpected = 9] = "EndOfFileExpected", n[n.InvalidCommentToken = 10] = "InvalidCommentToken", n[n.UnexpectedEndOfComment = 11] = "UnexpectedEndOfComment", n[n.UnexpectedEndOfString = 12] = "UnexpectedEndOfString", n[n.UnexpectedEndOfNumber = 13] = "UnexpectedEndOfNumber", n[n.InvalidUnicode = 14] = "InvalidUnicode", n[n.InvalidEscapeCharacter = 15] = "InvalidEscapeCharacter", n[n.InvalidCharacter = 16] = "InvalidCharacter";
658
+ })(q || (q = {}));
659
+ function x(n, l) {
660
+ const g$1 = JSON.parse(n, l?.reviver);
661
+ return N(n, g$1, l), g$1;
662
+ }
663
+ function h(n, l) {
664
+ const g$1 = K(n, l?.errors, l);
665
+ return N(n, g$1, l), g$1;
666
+ }
667
+
668
+ //#endregion
669
+ //#region node_modules/.pnpm/confbox@0.2.2/node_modules/confbox/dist/ini.mjs
670
+ var O, x$1;
671
+ function j() {
672
+ if (x$1) return O;
673
+ x$1 = 1;
674
+ const { hasOwnProperty: y } = Object.prototype, d$2 = (e, t = {}) => {
675
+ typeof t == "string" && (t = { section: t }), t.align = t.align === !0, t.newline = t.newline === !0, t.sort = t.sort === !0, t.whitespace = t.whitespace === !0 || t.align === !0, t.platform = t.platform || typeof process < "u" && process.platform, t.bracketedArray = t.bracketedArray !== !1;
676
+ const s = t.platform === "win32" ? `\r
677
+ ` : `
678
+ `, r$1 = t.whitespace ? " = " : "=", c = [], o = t.sort ? Object.keys(e).sort() : Object.keys(e);
679
+ let g$1 = 0;
680
+ t.align && (g$1 = h$2(o.filter((n) => e[n] === null || Array.isArray(e[n]) || typeof e[n] != "object").map((n) => Array.isArray(e[n]) ? `${n}[]` : n).concat([""]).reduce((n, i) => h$2(n).length >= h$2(i).length ? n : i)).length);
681
+ let l = "";
682
+ const m$1 = t.bracketedArray ? "[]" : "";
683
+ for (const n of o) {
684
+ const i = e[n];
685
+ if (i && Array.isArray(i)) for (const f of i) l += h$2(`${n}${m$1}`).padEnd(g$1, " ") + r$1 + h$2(f) + s;
686
+ else i && typeof i == "object" ? c.push(n) : l += h$2(n).padEnd(g$1, " ") + r$1 + h$2(i) + s;
687
+ }
688
+ t.section && l.length && (l = "[" + h$2(t.section) + "]" + (t.newline ? s + s : s) + l);
689
+ for (const n of c) {
690
+ const i = k$1(n, ".").join("\\."), f = (t.section ? t.section + "." : "") + i, u = d$2(e[n], {
691
+ ...t,
692
+ section: f
693
+ });
694
+ l.length && u.length && (l += s), l += u;
695
+ }
696
+ return l;
697
+ };
698
+ function k$1(e, t) {
699
+ var s = 0, r$1 = 0, c = 0, o = [];
700
+ do
701
+ if (c = e.indexOf(t, s), c !== -1) {
702
+ if (s = c + t.length, c > 0 && e[c - 1] === "\\") continue;
703
+ o.push(e.slice(r$1, c)), r$1 = c + t.length;
704
+ }
705
+ while (c !== -1);
706
+ return o.push(e.slice(r$1)), o;
707
+ }
708
+ const w$1 = (e, t = {}) => {
709
+ t.bracketedArray = t.bracketedArray !== !1;
710
+ const s = Object.create(null);
711
+ let r$1 = s, c = null;
712
+ const o = /^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i, g$1 = e.split(/[\r\n]+/g), l = {};
713
+ for (const n of g$1) {
714
+ if (!n || n.match(/^\s*[;#]/) || n.match(/^\s*$/)) continue;
715
+ const i = n.match(o);
716
+ if (!i) continue;
717
+ if (i[1] !== void 0) {
718
+ if (c = A(i[1]), c === "__proto__") {
719
+ r$1 = Object.create(null);
720
+ continue;
721
+ }
722
+ r$1 = s[c] = s[c] || Object.create(null);
723
+ continue;
724
+ }
725
+ const f = A(i[2]);
726
+ let u;
727
+ t.bracketedArray ? u = f.length > 2 && f.slice(-2) === "[]" : (l[f] = (l?.[f] || 0) + 1, u = l[f] > 1);
728
+ const a = u && f.endsWith("[]") ? f.slice(0, -2) : f;
729
+ if (a === "__proto__") continue;
730
+ const p = i[3] ? A(i[4]) : !0, b$1 = p === "true" || p === "false" || p === "null" ? JSON.parse(p) : p;
731
+ u && (y.call(r$1, a) ? Array.isArray(r$1[a]) || (r$1[a] = [r$1[a]]) : r$1[a] = []), Array.isArray(r$1[a]) ? r$1[a].push(b$1) : r$1[a] = b$1;
732
+ }
733
+ const m$1 = [];
734
+ for (const n of Object.keys(s)) {
735
+ if (!y.call(s, n) || typeof s[n] != "object" || Array.isArray(s[n])) continue;
736
+ const i = k$1(n, ".");
737
+ r$1 = s;
738
+ const f = i.pop(), u = f.replace(/\\\./g, ".");
739
+ for (const a of i) a !== "__proto__" && ((!y.call(r$1, a) || typeof r$1[a] != "object") && (r$1[a] = Object.create(null)), r$1 = r$1[a]);
740
+ r$1 === s && u === f || (r$1[u] = s[n], m$1.push(n));
741
+ }
742
+ for (const n of m$1) delete s[n];
743
+ return s;
744
+ }, _$1 = (e) => e.startsWith("\"") && e.endsWith("\"") || e.startsWith("'") && e.endsWith("'"), h$2 = (e) => typeof e != "string" || e.match(/[=\r\n]/) || e.match(/^\[/) || e.length > 1 && _$1(e) || e !== e.trim() ? JSON.stringify(e) : e.split(";").join("\\;").split("#").join("\\#"), A = (e) => {
745
+ if (e = (e || "").trim(), _$1(e)) {
746
+ e.charAt(0) === "'" && (e = e.slice(1, -1));
747
+ try {
748
+ e = JSON.parse(e);
749
+ } catch {}
750
+ } else {
751
+ let t = !1, s = "";
752
+ for (let r$1 = 0, c = e.length; r$1 < c; r$1++) {
753
+ const o = e.charAt(r$1);
754
+ if (t) "\\;#".indexOf(o) !== -1 ? s += o : s += "\\" + o, t = !1;
755
+ else {
756
+ if (";#".indexOf(o) !== -1) break;
757
+ o === "\\" ? t = !0 : s += o;
758
+ }
759
+ }
760
+ return t && (s += "\\"), s.trim();
761
+ }
762
+ return e;
763
+ };
764
+ return O = {
765
+ parse: w$1,
766
+ decode: w$1,
767
+ stringify: d$2,
768
+ encode: d$2,
769
+ safe: h$2,
770
+ unsafe: A
771
+ }, O;
772
+ }
773
+ var I = j();
774
+ function S(y, d$2) {
775
+ return I.parse(y, d$2);
776
+ }
777
+
778
+ //#endregion
779
+ //#region node_modules/.pnpm/exsolve@1.0.7/node_modules/exsolve/dist/index.mjs
780
+ const nodeBuiltins = [
781
+ "_http_agent",
782
+ "_http_client",
783
+ "_http_common",
784
+ "_http_incoming",
785
+ "_http_outgoing",
786
+ "_http_server",
787
+ "_stream_duplex",
788
+ "_stream_passthrough",
789
+ "_stream_readable",
790
+ "_stream_transform",
791
+ "_stream_wrap",
792
+ "_stream_writable",
793
+ "_tls_common",
794
+ "_tls_wrap",
795
+ "assert",
796
+ "assert/strict",
797
+ "async_hooks",
798
+ "buffer",
799
+ "child_process",
800
+ "cluster",
801
+ "console",
802
+ "constants",
803
+ "crypto",
804
+ "dgram",
805
+ "diagnostics_channel",
806
+ "dns",
807
+ "dns/promises",
808
+ "domain",
809
+ "events",
810
+ "fs",
811
+ "fs/promises",
812
+ "http",
813
+ "http2",
814
+ "https",
815
+ "inspector",
816
+ "inspector/promises",
817
+ "module",
818
+ "net",
819
+ "os",
820
+ "path",
821
+ "path/posix",
822
+ "path/win32",
823
+ "perf_hooks",
824
+ "process",
825
+ "punycode",
826
+ "querystring",
827
+ "readline",
828
+ "readline/promises",
829
+ "repl",
830
+ "stream",
831
+ "stream/consumers",
832
+ "stream/promises",
833
+ "stream/web",
834
+ "string_decoder",
835
+ "sys",
836
+ "timers",
837
+ "timers/promises",
838
+ "tls",
839
+ "trace_events",
840
+ "tty",
841
+ "url",
842
+ "util",
843
+ "util/types",
844
+ "v8",
845
+ "vm",
846
+ "wasi",
847
+ "worker_threads",
848
+ "zlib"
849
+ ];
850
+ const own$1 = {}.hasOwnProperty;
851
+ const classRegExp = /^([A-Z][a-z\d]*)+$/;
852
+ const kTypes = /* @__PURE__ */ new Set([
853
+ "string",
854
+ "function",
855
+ "number",
856
+ "object",
857
+ "Function",
858
+ "Object",
859
+ "boolean",
860
+ "bigint",
861
+ "symbol"
862
+ ]);
863
+ const messages = /* @__PURE__ */ new Map();
864
+ const nodeInternalPrefix = "__node_internal_";
865
+ let userStackTraceLimit;
866
+ function formatList(array, type = "and") {
867
+ return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array.at(-1)}`;
868
+ }
869
+ function createError(sym, value, constructor) {
870
+ messages.set(sym, value);
871
+ return makeNodeErrorWithCode(constructor, sym);
872
+ }
873
+ function makeNodeErrorWithCode(Base, key) {
874
+ return function NodeError(...parameters) {
875
+ const limit = Error.stackTraceLimit;
876
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
877
+ const error = new Base();
878
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
879
+ const message = getMessage(key, parameters, error);
880
+ Object.defineProperties(error, {
881
+ message: {
882
+ value: message,
883
+ enumerable: false,
884
+ writable: true,
885
+ configurable: true
886
+ },
887
+ toString: {
888
+ value() {
889
+ return `${this.name} [${key}]: ${this.message}`;
890
+ },
891
+ enumerable: false,
892
+ writable: true,
893
+ configurable: true
894
+ }
895
+ });
896
+ captureLargerStackTrace(error);
897
+ error.code = key;
898
+ return error;
899
+ };
900
+ }
901
+ function isErrorStackTraceLimitWritable() {
902
+ try {
903
+ if (v8.startupSnapshot.isBuildingSnapshot()) return false;
904
+ } catch {}
905
+ const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
906
+ if (desc === void 0) return Object.isExtensible(Error);
907
+ return own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
908
+ }
909
+ function hideStackFrames(wrappedFunction) {
910
+ const hidden = nodeInternalPrefix + wrappedFunction.name;
911
+ Object.defineProperty(wrappedFunction, "name", { value: hidden });
912
+ return wrappedFunction;
913
+ }
914
+ const captureLargerStackTrace = hideStackFrames(function(error) {
915
+ const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
916
+ if (stackTraceLimitIsWritable) {
917
+ userStackTraceLimit = Error.stackTraceLimit;
918
+ Error.stackTraceLimit = Number.POSITIVE_INFINITY;
919
+ }
920
+ Error.captureStackTrace(error);
921
+ if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
922
+ return error;
923
+ });
924
+ function getMessage(key, parameters, self) {
925
+ const message = messages.get(key);
926
+ assert(message !== void 0, "expected `message` to be found");
927
+ if (typeof message === "function") {
928
+ assert(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`);
929
+ return Reflect.apply(message, self, parameters);
930
+ }
931
+ const regex = /%[dfijoOs]/g;
932
+ let expectedLength = 0;
933
+ while (regex.exec(message) !== null) expectedLength++;
934
+ assert(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`);
935
+ if (parameters.length === 0) return message;
936
+ parameters.unshift(message);
937
+ return Reflect.apply(format, null, parameters);
938
+ }
939
+ function determineSpecificType(value) {
940
+ if (value === null || value === void 0) return String(value);
941
+ if (typeof value === "function" && value.name) return `function ${value.name}`;
942
+ if (typeof value === "object") {
943
+ if (value.constructor && value.constructor.name) return `an instance of ${value.constructor.name}`;
944
+ return `${inspect(value, { depth: -1 })}`;
945
+ }
946
+ let inspected = inspect(value, { colors: false });
947
+ if (inspected.length > 28) inspected = `${inspected.slice(0, 25)}...`;
948
+ return `type ${typeof value} (${inspected})`;
949
+ }
950
+ createError("ERR_INVALID_ARG_TYPE", (name, expected, actual) => {
951
+ assert(typeof name === "string", "'name' must be a string");
952
+ if (!Array.isArray(expected)) expected = [expected];
953
+ let message = "The ";
954
+ if (name.endsWith(" argument")) message += `${name} `;
955
+ else {
956
+ const type = name.includes(".") ? "property" : "argument";
957
+ message += `"${name}" ${type} `;
958
+ }
959
+ message += "must be ";
960
+ const types = [];
961
+ const instances = [];
962
+ const other = [];
963
+ for (const value of expected) {
964
+ assert(typeof value === "string", "All expected entries have to be of type string");
965
+ if (kTypes.has(value)) types.push(value.toLowerCase());
966
+ else if (classRegExp.exec(value) === null) {
967
+ assert(value !== "object", "The value \"object\" should be written as \"Object\"");
968
+ other.push(value);
969
+ } else instances.push(value);
970
+ }
971
+ if (instances.length > 0) {
972
+ const pos = types.indexOf("object");
973
+ if (pos !== -1) {
974
+ types.slice(pos, 1);
975
+ instances.push("Object");
976
+ }
977
+ }
978
+ if (types.length > 0) {
979
+ message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(types, "or")}`;
980
+ if (instances.length > 0 || other.length > 0) message += " or ";
981
+ }
982
+ if (instances.length > 0) {
983
+ message += `an instance of ${formatList(instances, "or")}`;
984
+ if (other.length > 0) message += " or ";
985
+ }
986
+ if (other.length > 0) if (other.length > 1) message += `one of ${formatList(other, "or")}`;
987
+ else {
988
+ if (other[0]?.toLowerCase() !== other[0]) message += "an ";
989
+ message += `${other[0]}`;
990
+ }
991
+ message += `. Received ${determineSpecificType(actual)}`;
992
+ return message;
993
+ }, TypeError);
994
+ const ERR_INVALID_MODULE_SPECIFIER = createError(
995
+ "ERR_INVALID_MODULE_SPECIFIER",
996
+ /**
997
+ * @param {string} request
998
+ * @param {string} reason
999
+ * @param {string} [base]
1000
+ */
1001
+ (request, reason, base) => {
1002
+ return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
1003
+ },
1004
+ TypeError
1005
+ );
1006
+ const ERR_INVALID_PACKAGE_CONFIG = createError("ERR_INVALID_PACKAGE_CONFIG", (path$2, base, message) => {
1007
+ return `Invalid package config ${path$2}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
1008
+ }, Error);
1009
+ const ERR_INVALID_PACKAGE_TARGET = createError("ERR_INVALID_PACKAGE_TARGET", (packagePath, key, target, isImport = false, base) => {
1010
+ const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
1011
+ if (key === ".") {
1012
+ assert(isImport === false);
1013
+ return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? "; targets must start with \"./\"" : ""}`;
1014
+ }
1015
+ return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(target)} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? "; targets must start with \"./\"" : ""}`;
1016
+ }, Error);
1017
+ const ERR_MODULE_NOT_FOUND = createError("ERR_MODULE_NOT_FOUND", (path$2, base, exactUrl = false) => {
1018
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path$2}' imported from ${base}`;
1019
+ }, Error);
1020
+ createError("ERR_NETWORK_IMPORT_DISALLOWED", "import of '%s' by %s is not supported: %s", Error);
1021
+ const ERR_PACKAGE_IMPORT_NOT_DEFINED = createError("ERR_PACKAGE_IMPORT_NOT_DEFINED", (specifier, packagePath, base) => {
1022
+ return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath || ""}package.json` : ""} imported from ${base}`;
1023
+ }, TypeError);
1024
+ const ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
1025
+ "ERR_PACKAGE_PATH_NOT_EXPORTED",
1026
+ /**
1027
+ * @param {string} packagePath
1028
+ * @param {string} subpath
1029
+ * @param {string} [base]
1030
+ */
1031
+ (packagePath, subpath, base) => {
1032
+ if (subpath === ".") return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
1033
+ return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
1034
+ },
1035
+ Error
1036
+ );
1037
+ const ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", "Directory import '%s' is not supported resolving ES modules imported from %s", Error);
1038
+ const ERR_UNSUPPORTED_RESOLVE_REQUEST = createError("ERR_UNSUPPORTED_RESOLVE_REQUEST", "Failed to resolve module specifier \"%s\" from \"%s\": Invalid relative URL or base scheme is not hierarchical.", TypeError);
1039
+ const ERR_UNKNOWN_FILE_EXTENSION = createError("ERR_UNKNOWN_FILE_EXTENSION", (extension, path$2) => {
1040
+ return `Unknown file extension "${extension}" for ${path$2}`;
1041
+ }, TypeError);
1042
+ createError("ERR_INVALID_ARG_VALUE", (name, value, reason = "is invalid") => {
1043
+ let inspected = inspect(value);
1044
+ if (inspected.length > 128) inspected = `${inspected.slice(0, 128)}...`;
1045
+ return `The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${inspected}`;
1046
+ }, TypeError);
1047
+ const hasOwnProperty$1 = {}.hasOwnProperty;
1048
+ const cache = /* @__PURE__ */ new Map();
1049
+ function read$1(jsonPath, { base, specifier }) {
1050
+ const existing = cache.get(jsonPath);
1051
+ if (existing) return existing;
1052
+ let string;
1053
+ try {
1054
+ string = fs.readFileSync(path.toNamespacedPath(jsonPath), "utf8");
1055
+ } catch (error) {
1056
+ const exception = error;
1057
+ if (exception.code !== "ENOENT") throw exception;
1058
+ }
1059
+ const result = {
1060
+ exists: false,
1061
+ pjsonPath: jsonPath,
1062
+ main: void 0,
1063
+ name: void 0,
1064
+ type: "none",
1065
+ exports: void 0,
1066
+ imports: void 0
1067
+ };
1068
+ if (string !== void 0) {
1069
+ let parsed;
1070
+ try {
1071
+ parsed = JSON.parse(string);
1072
+ } catch (error_) {
1073
+ const error = new ERR_INVALID_PACKAGE_CONFIG(jsonPath, (base ? `"${specifier}" from ` : "") + fileURLToPath(base || specifier), error_.message);
1074
+ error.cause = error_;
1075
+ throw error;
1076
+ }
1077
+ result.exists = true;
1078
+ if (hasOwnProperty$1.call(parsed, "name") && typeof parsed.name === "string") result.name = parsed.name;
1079
+ if (hasOwnProperty$1.call(parsed, "main") && typeof parsed.main === "string") result.main = parsed.main;
1080
+ if (hasOwnProperty$1.call(parsed, "exports")) result.exports = parsed.exports;
1081
+ if (hasOwnProperty$1.call(parsed, "imports")) result.imports = parsed.imports;
1082
+ if (hasOwnProperty$1.call(parsed, "type") && (parsed.type === "commonjs" || parsed.type === "module")) result.type = parsed.type;
1083
+ }
1084
+ cache.set(jsonPath, result);
1085
+ return result;
1086
+ }
1087
+ function getPackageScopeConfig(resolved) {
1088
+ let packageJSONUrl = new URL("package.json", resolved);
1089
+ while (true) {
1090
+ if (packageJSONUrl.pathname.endsWith("node_modules/package.json")) break;
1091
+ const packageConfig = read$1(fileURLToPath(packageJSONUrl), { specifier: resolved });
1092
+ if (packageConfig.exists) return packageConfig;
1093
+ const lastPackageJSONUrl = packageJSONUrl;
1094
+ packageJSONUrl = new URL("../package.json", packageJSONUrl);
1095
+ if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) break;
1096
+ }
1097
+ return {
1098
+ pjsonPath: fileURLToPath(packageJSONUrl),
1099
+ exists: false,
1100
+ type: "none"
1101
+ };
1102
+ }
1103
+ const hasOwnProperty = {}.hasOwnProperty;
1104
+ const extensionFormatMap = {
1105
+ __proto__: null,
1106
+ ".json": "json",
1107
+ ".cjs": "commonjs",
1108
+ ".cts": "commonjs",
1109
+ ".js": "module",
1110
+ ".ts": "module",
1111
+ ".mts": "module",
1112
+ ".mjs": "module"
1113
+ };
1114
+ const protocolHandlers = {
1115
+ __proto__: null,
1116
+ "data:": getDataProtocolModuleFormat,
1117
+ "file:": getFileProtocolModuleFormat,
1118
+ "node:": () => "builtin"
1119
+ };
1120
+ function mimeToFormat(mime) {
1121
+ if (mime && /\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(mime)) return "module";
1122
+ if (mime === "application/json") return "json";
1123
+ return null;
1124
+ }
1125
+ function getDataProtocolModuleFormat(parsed) {
1126
+ const { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(parsed.pathname) || [
1127
+ null,
1128
+ null,
1129
+ null
1130
+ ];
1131
+ return mimeToFormat(mime);
1132
+ }
1133
+ function extname$2(url) {
1134
+ const pathname = url.pathname;
1135
+ let index = pathname.length;
1136
+ while (index--) {
1137
+ const code = pathname.codePointAt(index);
1138
+ if (code === 47) return "";
1139
+ if (code === 46) return pathname.codePointAt(index - 1) === 47 ? "" : pathname.slice(index);
1140
+ }
1141
+ return "";
1142
+ }
1143
+ function getFileProtocolModuleFormat(url, _context, ignoreErrors) {
1144
+ const ext = extname$2(url);
1145
+ if (ext === ".js") {
1146
+ const { type: packageType } = getPackageScopeConfig(url);
1147
+ if (packageType !== "none") return packageType;
1148
+ return "commonjs";
1149
+ }
1150
+ if (ext === "") {
1151
+ const { type: packageType } = getPackageScopeConfig(url);
1152
+ if (packageType === "none" || packageType === "commonjs") return "commonjs";
1153
+ return "module";
1154
+ }
1155
+ const format$1 = extensionFormatMap[ext];
1156
+ if (format$1) return format$1;
1157
+ if (ignoreErrors) return;
1158
+ throw new ERR_UNKNOWN_FILE_EXTENSION(ext, fileURLToPath(url));
1159
+ }
1160
+ function defaultGetFormatWithoutErrors(url, context) {
1161
+ const protocol = url.protocol;
1162
+ if (!hasOwnProperty.call(protocolHandlers, protocol)) return null;
1163
+ return protocolHandlers[protocol](url, context, true) || null;
1164
+ }
1165
+ const RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
1166
+ const own = {}.hasOwnProperty;
1167
+ const invalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i;
1168
+ const deprecatedInvalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i;
1169
+ const invalidPackageNameRegEx = /^\.|%|\\/;
1170
+ const patternRegEx = /\*/g;
1171
+ const encodedSeparatorRegEx = /%2f|%5c/i;
1172
+ const emittedPackageWarnings = /* @__PURE__ */ new Set();
1173
+ const doubleSlashRegEx = /[/\\]{2}/;
1174
+ function emitInvalidSegmentDeprecation(target, request, match, packageJsonUrl, internal, base, isTarget) {
1175
+ if (process$1.noDeprecation) return;
1176
+ const pjsonPath = fileURLToPath(packageJsonUrl);
1177
+ const double = doubleSlashRegEx.exec(isTarget ? target : request) !== null;
1178
+ process$1.emitWarning(`Use of deprecated ${double ? "double slash" : "leading or trailing slash matching"} resolving "${target}" for module request "${request}" ${request === match ? "" : `matched to "${match}" `}in the "${internal ? "imports" : "exports"}" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath(base)}` : ""}.`, "DeprecationWarning", "DEP0166");
1179
+ }
1180
+ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
1181
+ if (process$1.noDeprecation) return;
1182
+ if (defaultGetFormatWithoutErrors(url, { parentURL: base.href }) !== "module") return;
1183
+ const urlPath = fileURLToPath(url.href);
1184
+ const packagePath = fileURLToPath(new URL$1(".", packageJsonUrl));
1185
+ const basePath = fileURLToPath(base);
1186
+ if (!main) process$1.emitWarning(`No "main" or "exports" field defined in the package.json for ${packagePath} resolving the main entry point "${urlPath.slice(packagePath.length)}", imported from ${basePath}.
1187
+ Default "index" lookups for the main are deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
1188
+ else if (path.resolve(packagePath, main) !== urlPath) process$1.emitWarning(`Package ${packagePath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(packagePath.length)}", imported from ${basePath}.
1189
+ Automatic extension resolution of the "main" field is deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
1190
+ }
1191
+ function tryStatSync(path2) {
1192
+ try {
1193
+ return statSync(path2);
1194
+ } catch {}
1195
+ }
1196
+ function fileExists(url) {
1197
+ const stats = statSync(url, { throwIfNoEntry: false });
1198
+ const isFile = stats ? stats.isFile() : void 0;
1199
+ return isFile === null || isFile === void 0 ? false : isFile;
1200
+ }
1201
+ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
1202
+ let guess;
1203
+ if (packageConfig.main !== void 0) {
1204
+ guess = new URL$1(packageConfig.main, packageJsonUrl);
1205
+ if (fileExists(guess)) return guess;
1206
+ const tries2 = [
1207
+ `./${packageConfig.main}.js`,
1208
+ `./${packageConfig.main}.json`,
1209
+ `./${packageConfig.main}.node`,
1210
+ `./${packageConfig.main}/index.js`,
1211
+ `./${packageConfig.main}/index.json`,
1212
+ `./${packageConfig.main}/index.node`
1213
+ ];
1214
+ let i2 = -1;
1215
+ while (++i2 < tries2.length) {
1216
+ guess = new URL$1(tries2[i2], packageJsonUrl);
1217
+ if (fileExists(guess)) break;
1218
+ guess = void 0;
1219
+ }
1220
+ if (guess) {
1221
+ emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main);
1222
+ return guess;
1223
+ }
1224
+ }
1225
+ const tries = [
1226
+ "./index.js",
1227
+ "./index.json",
1228
+ "./index.node"
1229
+ ];
1230
+ let i = -1;
1231
+ while (++i < tries.length) {
1232
+ guess = new URL$1(tries[i], packageJsonUrl);
1233
+ if (fileExists(guess)) break;
1234
+ guess = void 0;
1235
+ }
1236
+ if (guess) {
1237
+ emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main);
1238
+ return guess;
1239
+ }
1240
+ throw new ERR_MODULE_NOT_FOUND(fileURLToPath(new URL$1(".", packageJsonUrl)), fileURLToPath(base));
1241
+ }
1242
+ function finalizeResolution(resolved, base, preserveSymlinks) {
1243
+ if (encodedSeparatorRegEx.exec(resolved.pathname) !== null) throw new ERR_INVALID_MODULE_SPECIFIER(resolved.pathname, String.raw`must not include encoded "/" or "\" characters`, fileURLToPath(base));
1244
+ let filePath;
1245
+ try {
1246
+ filePath = fileURLToPath(resolved);
1247
+ } catch (error) {
1248
+ Object.defineProperty(error, "input", { value: String(resolved) });
1249
+ Object.defineProperty(error, "module", { value: String(base) });
1250
+ throw error;
1251
+ }
1252
+ const stats = tryStatSync(filePath.endsWith("/") ? filePath.slice(-1) : filePath);
1253
+ if (stats && stats.isDirectory()) {
1254
+ const error = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, fileURLToPath(base));
1255
+ error.url = String(resolved);
1256
+ throw error;
1257
+ }
1258
+ if (!stats || !stats.isFile()) {
1259
+ const error = new ERR_MODULE_NOT_FOUND(filePath || resolved.pathname, base && fileURLToPath(base), true);
1260
+ error.url = String(resolved);
1261
+ throw error;
1262
+ }
1263
+ {
1264
+ const real = realpathSync(filePath);
1265
+ const { search, hash } = resolved;
1266
+ resolved = pathToFileURL(real + (filePath.endsWith(path.sep) ? "/" : ""));
1267
+ resolved.search = search;
1268
+ resolved.hash = hash;
1269
+ }
1270
+ return resolved;
1271
+ }
1272
+ function importNotDefined(specifier, packageJsonUrl, base) {
1273
+ return new ERR_PACKAGE_IMPORT_NOT_DEFINED(specifier, packageJsonUrl && fileURLToPath(new URL$1(".", packageJsonUrl)), fileURLToPath(base));
1274
+ }
1275
+ function exportsNotFound(subpath, packageJsonUrl, base) {
1276
+ return new ERR_PACKAGE_PATH_NOT_EXPORTED(fileURLToPath(new URL$1(".", packageJsonUrl)), subpath, base && fileURLToPath(base));
1277
+ }
1278
+ function throwInvalidSubpath(request, match, packageJsonUrl, internal, base) {
1279
+ throw new ERR_INVALID_MODULE_SPECIFIER(request, `request is not a valid match in pattern "${match}" for the "${internal ? "imports" : "exports"}" resolution of ${fileURLToPath(packageJsonUrl)}`, base && fileURLToPath(base));
1280
+ }
1281
+ function invalidPackageTarget(subpath, target, packageJsonUrl, internal, base) {
1282
+ target = typeof target === "object" && target !== null ? JSON.stringify(target, null, "") : `${target}`;
1283
+ return new ERR_INVALID_PACKAGE_TARGET(fileURLToPath(new URL$1(".", packageJsonUrl)), subpath, target, internal, base && fileURLToPath(base));
1284
+ }
1285
+ function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base, pattern, internal, isPathMap, conditions) {
1286
+ if (subpath !== "" && !pattern && target.at(-1) !== "/") throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
1287
+ if (!target.startsWith("./")) {
1288
+ if (internal && !target.startsWith("../") && !target.startsWith("/")) {
1289
+ let isURL = false;
1290
+ try {
1291
+ new URL$1(target);
1292
+ isURL = true;
1293
+ } catch {}
1294
+ if (!isURL) return packageResolve(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target + subpath, packageJsonUrl, conditions);
1295
+ }
1296
+ throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
1297
+ }
1298
+ if (invalidSegmentRegEx.exec(target.slice(2)) !== null) if (deprecatedInvalidSegmentRegEx.exec(target.slice(2)) === null) {
1299
+ if (!isPathMap) {
1300
+ const request = pattern ? match.replace("*", () => subpath) : match + subpath;
1301
+ emitInvalidSegmentDeprecation(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target, request, match, packageJsonUrl, internal, base, true);
1302
+ }
1303
+ } else throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
1304
+ const resolved = new URL$1(target, packageJsonUrl);
1305
+ const resolvedPath = resolved.pathname;
1306
+ const packagePath = new URL$1(".", packageJsonUrl).pathname;
1307
+ if (!resolvedPath.startsWith(packagePath)) throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
1308
+ if (subpath === "") return resolved;
1309
+ if (invalidSegmentRegEx.exec(subpath) !== null) {
1310
+ const request = pattern ? match.replace("*", () => subpath) : match + subpath;
1311
+ if (deprecatedInvalidSegmentRegEx.exec(subpath) === null) {
1312
+ if (!isPathMap) emitInvalidSegmentDeprecation(pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, () => subpath) : target, request, match, packageJsonUrl, internal, base, false);
1313
+ } else throwInvalidSubpath(request, match, packageJsonUrl, internal, base);
1314
+ }
1315
+ if (pattern) return new URL$1(RegExpPrototypeSymbolReplace.call(patternRegEx, resolved.href, () => subpath));
1316
+ return new URL$1(subpath, resolved);
1317
+ }
1318
+ function isArrayIndex(key) {
1319
+ const keyNumber = Number(key);
1320
+ if (`${keyNumber}` !== key) return false;
1321
+ return keyNumber >= 0 && keyNumber < 4294967295;
1322
+ }
1323
+ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions) {
1324
+ if (typeof target === "string") return resolvePackageTargetString(target, subpath, packageSubpath, packageJsonUrl, base, pattern, internal, isPathMap, conditions);
1325
+ if (Array.isArray(target)) {
1326
+ const targetList = target;
1327
+ if (targetList.length === 0) return null;
1328
+ let lastException;
1329
+ let i = -1;
1330
+ while (++i < targetList.length) {
1331
+ const targetItem = targetList[i];
1332
+ let resolveResult;
1333
+ try {
1334
+ resolveResult = resolvePackageTarget(packageJsonUrl, targetItem, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions);
1335
+ } catch (error) {
1336
+ const exception = error;
1337
+ lastException = exception;
1338
+ if (exception.code === "ERR_INVALID_PACKAGE_TARGET") continue;
1339
+ throw error;
1340
+ }
1341
+ if (resolveResult === void 0) continue;
1342
+ if (resolveResult === null) {
1343
+ lastException = null;
1344
+ continue;
1345
+ }
1346
+ return resolveResult;
1347
+ }
1348
+ if (lastException === void 0 || lastException === null) return null;
1349
+ throw lastException;
1350
+ }
1351
+ if (typeof target === "object" && target !== null) {
1352
+ const keys = Object.getOwnPropertyNames(target);
1353
+ let i = -1;
1354
+ while (++i < keys.length) {
1355
+ const key = keys[i];
1356
+ if (isArrayIndex(key)) throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(packageJsonUrl), fileURLToPath(base), "\"exports\" cannot contain numeric property keys.");
1357
+ }
1358
+ i = -1;
1359
+ while (++i < keys.length) {
1360
+ const key = keys[i];
1361
+ if (key === "default" || conditions && conditions.has(key)) {
1362
+ const conditionalTarget = target[key];
1363
+ const resolveResult = resolvePackageTarget(packageJsonUrl, conditionalTarget, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions);
1364
+ if (resolveResult === void 0) continue;
1365
+ return resolveResult;
1366
+ }
1367
+ }
1368
+ return null;
1369
+ }
1370
+ if (target === null) return null;
1371
+ throw invalidPackageTarget(packageSubpath, target, packageJsonUrl, internal, base);
1372
+ }
1373
+ function isConditionalExportsMainSugar(exports, packageJsonUrl, base) {
1374
+ if (typeof exports === "string" || Array.isArray(exports)) return true;
1375
+ if (typeof exports !== "object" || exports === null) return false;
1376
+ const keys = Object.getOwnPropertyNames(exports);
1377
+ let isConditionalSugar = false;
1378
+ let i = 0;
1379
+ let keyIndex = -1;
1380
+ while (++keyIndex < keys.length) {
1381
+ const key = keys[keyIndex];
1382
+ const currentIsConditionalSugar = key === "" || key[0] !== ".";
1383
+ if (i++ === 0) isConditionalSugar = currentIsConditionalSugar;
1384
+ else if (isConditionalSugar !== currentIsConditionalSugar) throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(packageJsonUrl), fileURLToPath(base), `"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`);
1385
+ }
1386
+ return isConditionalSugar;
1387
+ }
1388
+ function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
1389
+ if (process$1.noDeprecation) return;
1390
+ const pjsonPath = fileURLToPath(pjsonUrl);
1391
+ if (emittedPackageWarnings.has(pjsonPath + "|" + match)) return;
1392
+ emittedPackageWarnings.add(pjsonPath + "|" + match);
1393
+ process$1.emitWarning(`Use of deprecated trailing slash pattern mapping "${match}" in the "exports" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath(base)}` : ""}. Mapping specifiers ending in "/" is no longer supported.`, "DeprecationWarning", "DEP0155");
1394
+ }
1395
+ function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions) {
1396
+ let exports = packageConfig.exports;
1397
+ if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) exports = { ".": exports };
1398
+ if (own.call(exports, packageSubpath) && !packageSubpath.includes("*") && !packageSubpath.endsWith("/")) {
1399
+ const target = exports[packageSubpath];
1400
+ const resolveResult = resolvePackageTarget(packageJsonUrl, target, "", packageSubpath, base, false, false, false, conditions);
1401
+ if (resolveResult === null || resolveResult === void 0) throw exportsNotFound(packageSubpath, packageJsonUrl, base);
1402
+ return resolveResult;
1403
+ }
1404
+ let bestMatch = "";
1405
+ let bestMatchSubpath = "";
1406
+ const keys = Object.getOwnPropertyNames(exports);
1407
+ let i = -1;
1408
+ while (++i < keys.length) {
1409
+ const key = keys[i];
1410
+ const patternIndex = key.indexOf("*");
1411
+ if (patternIndex !== -1 && packageSubpath.startsWith(key.slice(0, patternIndex))) {
1412
+ if (packageSubpath.endsWith("/")) emitTrailingSlashPatternDeprecation(packageSubpath, packageJsonUrl, base);
1413
+ const patternTrailer = key.slice(patternIndex + 1);
1414
+ if (packageSubpath.length >= key.length && packageSubpath.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf("*") === patternIndex) {
1415
+ bestMatch = key;
1416
+ bestMatchSubpath = packageSubpath.slice(patternIndex, packageSubpath.length - patternTrailer.length);
1417
+ }
1418
+ }
1419
+ }
1420
+ if (bestMatch) {
1421
+ const target = exports[bestMatch];
1422
+ const resolveResult = resolvePackageTarget(packageJsonUrl, target, bestMatchSubpath, bestMatch, base, true, false, packageSubpath.endsWith("/"), conditions);
1423
+ if (resolveResult === null || resolveResult === void 0) throw exportsNotFound(packageSubpath, packageJsonUrl, base);
1424
+ return resolveResult;
1425
+ }
1426
+ throw exportsNotFound(packageSubpath, packageJsonUrl, base);
1427
+ }
1428
+ function patternKeyCompare(a, b$1) {
1429
+ const aPatternIndex = a.indexOf("*");
1430
+ const bPatternIndex = b$1.indexOf("*");
1431
+ const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
1432
+ const baseLengthB = bPatternIndex === -1 ? b$1.length : bPatternIndex + 1;
1433
+ if (baseLengthA > baseLengthB) return -1;
1434
+ if (baseLengthB > baseLengthA) return 1;
1435
+ if (aPatternIndex === -1) return 1;
1436
+ if (bPatternIndex === -1) return -1;
1437
+ if (a.length > b$1.length) return -1;
1438
+ if (b$1.length > a.length) return 1;
1439
+ return 0;
1440
+ }
1441
+ function packageImportsResolve(name, base, conditions) {
1442
+ if (name === "#" || name.startsWith("#/") || name.endsWith("/")) throw new ERR_INVALID_MODULE_SPECIFIER(name, "is not a valid internal imports specifier name", fileURLToPath(base));
1443
+ let packageJsonUrl;
1444
+ const packageConfig = getPackageScopeConfig(base);
1445
+ if (packageConfig.exists) {
1446
+ packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);
1447
+ const imports = packageConfig.imports;
1448
+ if (imports) if (own.call(imports, name) && !name.includes("*")) {
1449
+ const resolveResult = resolvePackageTarget(packageJsonUrl, imports[name], "", name, base, false, true, false, conditions);
1450
+ if (resolveResult !== null && resolveResult !== void 0) return resolveResult;
1451
+ } else {
1452
+ let bestMatch = "";
1453
+ let bestMatchSubpath = "";
1454
+ const keys = Object.getOwnPropertyNames(imports);
1455
+ let i = -1;
1456
+ while (++i < keys.length) {
1457
+ const key = keys[i];
1458
+ const patternIndex = key.indexOf("*");
1459
+ if (patternIndex !== -1 && name.startsWith(key.slice(0, -1))) {
1460
+ const patternTrailer = key.slice(patternIndex + 1);
1461
+ if (name.length >= key.length && name.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf("*") === patternIndex) {
1462
+ bestMatch = key;
1463
+ bestMatchSubpath = name.slice(patternIndex, name.length - patternTrailer.length);
1464
+ }
1465
+ }
1466
+ }
1467
+ if (bestMatch) {
1468
+ const target = imports[bestMatch];
1469
+ const resolveResult = resolvePackageTarget(packageJsonUrl, target, bestMatchSubpath, bestMatch, base, true, true, false, conditions);
1470
+ if (resolveResult !== null && resolveResult !== void 0) return resolveResult;
1471
+ }
1472
+ }
1473
+ }
1474
+ throw importNotDefined(name, packageJsonUrl, base);
1475
+ }
1476
+ function parsePackageName(specifier, base) {
1477
+ let separatorIndex = specifier.indexOf("/");
1478
+ let validPackageName = true;
1479
+ let isScoped = false;
1480
+ if (specifier[0] === "@") {
1481
+ isScoped = true;
1482
+ if (separatorIndex === -1 || specifier.length === 0) validPackageName = false;
1483
+ else separatorIndex = specifier.indexOf("/", separatorIndex + 1);
1484
+ }
1485
+ const packageName = separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex);
1486
+ if (invalidPackageNameRegEx.exec(packageName) !== null) validPackageName = false;
1487
+ if (!validPackageName) throw new ERR_INVALID_MODULE_SPECIFIER(specifier, "is not a valid package name", fileURLToPath(base));
1488
+ return {
1489
+ packageName,
1490
+ packageSubpath: "." + (separatorIndex === -1 ? "" : specifier.slice(separatorIndex)),
1491
+ isScoped
1492
+ };
1493
+ }
1494
+ function packageResolve(specifier, base, conditions) {
1495
+ if (nodeBuiltins.includes(specifier)) return new URL$1("node:" + specifier);
1496
+ const { packageName, packageSubpath, isScoped } = parsePackageName(specifier, base);
1497
+ const packageConfig = getPackageScopeConfig(base);
1498
+ if (packageConfig.exists && packageConfig.name === packageName && packageConfig.exports !== void 0 && packageConfig.exports !== null) return packageExportsResolve(pathToFileURL(packageConfig.pjsonPath), packageSubpath, packageConfig, base, conditions);
1499
+ let packageJsonUrl = new URL$1("./node_modules/" + packageName + "/package.json", base);
1500
+ let packageJsonPath = fileURLToPath(packageJsonUrl);
1501
+ let lastPath;
1502
+ do {
1503
+ const stat$1 = tryStatSync(packageJsonPath.slice(0, -13));
1504
+ if (!stat$1 || !stat$1.isDirectory()) {
1505
+ lastPath = packageJsonPath;
1506
+ packageJsonUrl = new URL$1((isScoped ? "../../../../node_modules/" : "../../../node_modules/") + packageName + "/package.json", packageJsonUrl);
1507
+ packageJsonPath = fileURLToPath(packageJsonUrl);
1508
+ continue;
1509
+ }
1510
+ const packageConfig2 = read$1(packageJsonPath, {
1511
+ base,
1512
+ specifier
1513
+ });
1514
+ if (packageConfig2.exports !== void 0 && packageConfig2.exports !== null) return packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig2, base, conditions);
1515
+ if (packageSubpath === ".") return legacyMainResolve(packageJsonUrl, packageConfig2, base);
1516
+ return new URL$1(packageSubpath, packageJsonUrl);
1517
+ } while (packageJsonPath.length !== lastPath.length);
1518
+ throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), false);
1519
+ }
1520
+ function isRelativeSpecifier(specifier) {
1521
+ if (specifier[0] === ".") {
1522
+ if (specifier.length === 1 || specifier[1] === "/") return true;
1523
+ if (specifier[1] === "." && (specifier.length === 2 || specifier[2] === "/")) return true;
1524
+ }
1525
+ return false;
1526
+ }
1527
+ function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {
1528
+ if (specifier === "") return false;
1529
+ if (specifier[0] === "/") return true;
1530
+ return isRelativeSpecifier(specifier);
1531
+ }
1532
+ function moduleResolve(specifier, base, conditions, preserveSymlinks) {
1533
+ const protocol = base.protocol;
1534
+ const isData = protocol === "data:";
1535
+ let resolved;
1536
+ if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) try {
1537
+ resolved = new URL$1(specifier, base);
1538
+ } catch (error_) {
1539
+ const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
1540
+ error.cause = error_;
1541
+ throw error;
1542
+ }
1543
+ else if (protocol === "file:" && specifier[0] === "#") resolved = packageImportsResolve(specifier, base, conditions);
1544
+ else try {
1545
+ resolved = new URL$1(specifier);
1546
+ } catch (error_) {
1547
+ if (isData && !nodeBuiltins.includes(specifier)) {
1548
+ const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
1549
+ error.cause = error_;
1550
+ throw error;
1551
+ }
1552
+ resolved = packageResolve(specifier, base, conditions);
1553
+ }
1554
+ assert(resolved !== void 0, "expected to be defined");
1555
+ if (resolved.protocol !== "file:") return resolved;
1556
+ return finalizeResolution(resolved, base);
1557
+ }
1558
+ const DEFAULT_CONDITIONS_SET = /* @__PURE__ */ new Set(["node", "import"]);
1559
+ const isWindows = /* @__PURE__ */ (() => process.platform === "win32")();
1560
+ const NOT_FOUND_ERRORS = /* @__PURE__ */ new Set([
1561
+ "ERR_MODULE_NOT_FOUND",
1562
+ "ERR_UNSUPPORTED_DIR_IMPORT",
1563
+ "MODULE_NOT_FOUND",
1564
+ "ERR_PACKAGE_PATH_NOT_EXPORTED",
1565
+ "ERR_PACKAGE_IMPORT_NOT_DEFINED"
1566
+ ]);
1567
+ const globalCache = /* @__PURE__ */ (() => globalThis["__EXSOLVE_CACHE__"] ||= /* @__PURE__ */ new Map())();
1568
+ function resolveModuleURL(input, options) {
1569
+ const parsedInput = _parseInput(input);
1570
+ if ("external" in parsedInput) return parsedInput.external;
1571
+ const specifier = parsedInput.specifier;
1572
+ let url = parsedInput.url;
1573
+ let absolutePath = parsedInput.absolutePath;
1574
+ let cacheKey;
1575
+ let cacheObj;
1576
+ if (options?.cache !== false) {
1577
+ cacheKey = _cacheKey(absolutePath || specifier, options);
1578
+ cacheObj = options?.cache && typeof options?.cache === "object" ? options.cache : globalCache;
1579
+ }
1580
+ if (cacheObj) {
1581
+ const cached = cacheObj.get(cacheKey);
1582
+ if (typeof cached === "string") return cached;
1583
+ if (cached instanceof Error) {
1584
+ if (options?.try) return;
1585
+ throw cached;
1586
+ }
1587
+ }
1588
+ if (absolutePath) try {
1589
+ const stat$1 = lstatSync(absolutePath);
1590
+ if (stat$1.isSymbolicLink()) {
1591
+ absolutePath = realpathSync(absolutePath);
1592
+ url = pathToFileURL(absolutePath);
1593
+ }
1594
+ if (stat$1.isFile()) {
1595
+ if (cacheObj) cacheObj.set(cacheKey, url.href);
1596
+ return url.href;
1597
+ }
1598
+ } catch (error) {
1599
+ if (error?.code !== "ENOENT") {
1600
+ if (cacheObj) cacheObj.set(cacheKey, error);
1601
+ throw error;
1602
+ }
1603
+ }
1604
+ const conditionsSet = options?.conditions ? new Set(options.conditions) : DEFAULT_CONDITIONS_SET;
1605
+ const target = specifier || url.href;
1606
+ const bases = _normalizeBases(options?.from);
1607
+ const suffixes = options?.suffixes || [""];
1608
+ const extensions = options?.extensions ? ["", ...options.extensions] : [""];
1609
+ let resolved;
1610
+ for (const base of bases) {
1611
+ for (const suffix of suffixes) {
1612
+ let name = _join(target, suffix);
1613
+ if (name === ".") name += "/.";
1614
+ for (const extension of extensions) {
1615
+ resolved = _tryModuleResolve(name + extension, base, conditionsSet);
1616
+ if (resolved) break;
1617
+ }
1618
+ if (resolved) break;
1619
+ }
1620
+ if (resolved) break;
1621
+ }
1622
+ if (!resolved) {
1623
+ const error = /* @__PURE__ */ new Error(`Cannot resolve module "${input}" (from: ${bases.map((u) => _fmtPath(u)).join(", ")})`);
1624
+ error.code = "ERR_MODULE_NOT_FOUND";
1625
+ if (cacheObj) cacheObj.set(cacheKey, error);
1626
+ if (options?.try) return;
1627
+ throw error;
1628
+ }
1629
+ if (cacheObj) cacheObj.set(cacheKey, resolved.href);
1630
+ return resolved.href;
1631
+ }
1632
+ function resolveModulePath(id, options) {
1633
+ const resolved = resolveModuleURL(id, options);
1634
+ if (!resolved) return;
1635
+ if (!resolved.startsWith("file://") && options?.try) return;
1636
+ const absolutePath = fileURLToPath(resolved);
1637
+ return isWindows ? _normalizeWinPath(absolutePath) : absolutePath;
1638
+ }
1639
+ function _tryModuleResolve(specifier, base, conditions) {
1640
+ try {
1641
+ return moduleResolve(specifier, base, conditions);
1642
+ } catch (error) {
1643
+ if (!NOT_FOUND_ERRORS.has(error?.code)) throw error;
1644
+ }
1645
+ }
1646
+ function _normalizeBases(inputs) {
1647
+ const urls = (Array.isArray(inputs) ? inputs : [inputs]).flatMap((input) => _normalizeBase(input));
1648
+ if (urls.length === 0) return [pathToFileURL("./")];
1649
+ return urls;
1650
+ }
1651
+ function _normalizeBase(input) {
1652
+ if (!input) return [];
1653
+ if (_isURL(input)) return [input];
1654
+ if (typeof input !== "string") return [];
1655
+ if (/^(?:node|data|http|https|file):/.test(input)) return new URL(input);
1656
+ try {
1657
+ if (input.endsWith("/") || statSync(input).isDirectory()) return pathToFileURL(input + "/");
1658
+ return pathToFileURL(input);
1659
+ } catch {
1660
+ return [pathToFileURL(input + "/"), pathToFileURL(input)];
1661
+ }
1662
+ }
1663
+ function _fmtPath(input) {
1664
+ try {
1665
+ return fileURLToPath(input);
1666
+ } catch {
1667
+ return input;
1668
+ }
1669
+ }
1670
+ function _cacheKey(id, opts) {
1671
+ return JSON.stringify([
1672
+ id,
1673
+ (opts?.conditions || ["node", "import"]).sort(),
1674
+ opts?.extensions,
1675
+ opts?.from,
1676
+ opts?.suffixes
1677
+ ]);
1678
+ }
1679
+ function _join(a, b$1) {
1680
+ if (!a || !b$1 || b$1 === "/") return a;
1681
+ return (a.endsWith("/") ? a : a + "/") + (b$1.startsWith("/") ? b$1.slice(1) : b$1);
1682
+ }
1683
+ function _normalizeWinPath(path$2) {
1684
+ return path$2.replace(/\\/g, "/").replace(/^[a-z]:\//, (r$1) => r$1.toUpperCase());
1685
+ }
1686
+ function _isURL(input) {
1687
+ return input instanceof URL || input?.constructor?.name === "URL";
1688
+ }
1689
+ function _parseInput(input) {
1690
+ if (typeof input === "string") {
1691
+ if (input.startsWith("file:")) {
1692
+ const url = new URL(input);
1693
+ return {
1694
+ url,
1695
+ absolutePath: fileURLToPath(url)
1696
+ };
1697
+ }
1698
+ if (isAbsolute(input)) return {
1699
+ url: pathToFileURL(input),
1700
+ absolutePath: input
1701
+ };
1702
+ if (/^(?:node|data|http|https):/.test(input)) return { external: input };
1703
+ if (nodeBuiltins.includes(input) && !input.includes(":")) return { external: `node:${input}` };
1704
+ return { specifier: input };
1705
+ }
1706
+ if (_isURL(input)) {
1707
+ if (input.protocol === "file:") return {
1708
+ url: input,
1709
+ absolutePath: fileURLToPath(input)
1710
+ };
1711
+ return { external: input.href };
1712
+ }
1713
+ throw new TypeError("id must be a `string` or `URL`");
1714
+ }
1715
+
1716
+ //#endregion
1717
+ //#region node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs
1718
+ const defaultFindOptions = {
1719
+ startingFrom: ".",
1720
+ rootPattern: /^node_modules$/,
1721
+ reverse: false,
1722
+ test: (filePath) => {
1723
+ try {
1724
+ if (statSync(filePath).isFile()) return true;
1725
+ } catch {}
1726
+ }
1727
+ };
1728
+ async function findFile(filename, _options = {}) {
1729
+ const filenames = Array.isArray(filename) ? filename : [filename];
1730
+ const options = {
1731
+ ...defaultFindOptions,
1732
+ ..._options
1733
+ };
1734
+ const basePath = resolve$1(options.startingFrom);
1735
+ const leadingSlash = basePath[0] === "/";
1736
+ const segments = basePath.split("/").filter(Boolean);
1737
+ if (filenames.includes(segments.at(-1)) && await options.test(basePath)) return basePath;
1738
+ if (leadingSlash) segments[0] = "/" + segments[0];
1739
+ let root = segments.findIndex((r$1) => r$1.match(options.rootPattern));
1740
+ if (root === -1) root = 0;
1741
+ if (options.reverse) for (let index = root + 1; index <= segments.length; index++) for (const filename2 of filenames) {
1742
+ const filePath = join$1(...segments.slice(0, index), filename2);
1743
+ if (await options.test(filePath)) return filePath;
1744
+ }
1745
+ else for (let index = segments.length; index > root; index--) for (const filename2 of filenames) {
1746
+ const filePath = join$1(...segments.slice(0, index), filename2);
1747
+ if (await options.test(filePath)) return filePath;
1748
+ }
1749
+ throw new Error(`Cannot find matching ${filename} in ${options.startingFrom} or parent directories`);
1750
+ }
1751
+ function findNearestFile(filename, options = {}) {
1752
+ return findFile(filename, options);
1753
+ }
1754
+ function _resolvePath(id, opts = {}) {
1755
+ if (id instanceof URL || id.startsWith("file://")) return normalize$1(fileURLToPath(id));
1756
+ if (isAbsolute$1(id)) return normalize$1(id);
1757
+ return resolveModulePath(id, {
1758
+ ...opts,
1759
+ from: opts.from || opts.parent || opts.url
1760
+ });
1761
+ }
1762
+ const lockFiles = [
1763
+ "yarn.lock",
1764
+ "package-lock.json",
1765
+ "pnpm-lock.yaml",
1766
+ "npm-shrinkwrap.json",
1767
+ "bun.lockb",
1768
+ "bun.lock",
1769
+ "deno.lock"
1770
+ ];
1771
+ const packageFiles = [
1772
+ "package.json",
1773
+ "package.json5",
1774
+ "package.yaml"
1775
+ ];
1776
+ const workspaceFiles = [
1777
+ "pnpm-workspace.yaml",
1778
+ "lerna.json",
1779
+ "turbo.json",
1780
+ "rush.json",
1781
+ "deno.json",
1782
+ "deno.jsonc"
1783
+ ];
1784
+ const FileCache = /* @__PURE__ */ new Map();
1785
+ async function readPackageJSON(id, options = {}) {
1786
+ const resolvedPath = await resolvePackageJSON(id, options);
1787
+ const cache$1 = options.cache && typeof options.cache !== "boolean" ? options.cache : FileCache;
1788
+ if (options.cache && cache$1.has(resolvedPath)) return cache$1.get(resolvedPath);
1789
+ const blob = await promises.readFile(resolvedPath, "utf8");
1790
+ let parsed;
1791
+ try {
1792
+ parsed = x(blob);
1793
+ } catch {
1794
+ parsed = h(blob);
1795
+ }
1796
+ cache$1.set(resolvedPath, parsed);
1797
+ return parsed;
1798
+ }
1799
+ async function resolvePackageJSON(id = process.cwd(), options = {}) {
1800
+ return findNearestFile("package.json", {
1801
+ ...options,
1802
+ startingFrom: _resolvePath(id, options)
1803
+ });
1804
+ }
1805
+ const workspaceTests = {
1806
+ workspaceFile: (opts) => findFile(workspaceFiles, opts).then((r$1) => dirname$1(r$1)),
1807
+ gitConfig: (opts) => findFile(".git/config", opts).then((r$1) => resolve$1(r$1, "../..")),
1808
+ lockFile: (opts) => findFile(lockFiles, opts).then((r$1) => dirname$1(r$1)),
1809
+ packageJson: (opts) => findFile(packageFiles, opts).then((r$1) => dirname$1(r$1))
1810
+ };
1811
+ async function findWorkspaceDir(id = process.cwd(), options = {}) {
1812
+ const startingFrom = _resolvePath(id, options);
1813
+ const tests = options.tests || [
1814
+ "workspaceFile",
1815
+ "gitConfig",
1816
+ "lockFile",
1817
+ "packageJson"
1818
+ ];
1819
+ for (const testName of tests) {
1820
+ const test = workspaceTests[testName];
1821
+ if (options[testName] === false || !test) continue;
1822
+ const direction = options[testName] || (testName === "gitConfig" ? "closest" : "furthest");
1823
+ const detected = await test({
1824
+ ...options,
1825
+ startingFrom,
1826
+ reverse: direction === "furthest"
1827
+ }).catch(() => {});
1828
+ if (detected) return detected;
1829
+ }
1830
+ throw new Error(`Cannot detect workspace root from ${id}`);
1831
+ }
1832
+ async function resolveGitConfig(dir, opts) {
1833
+ return findNearestFile(".git/config", {
1834
+ ...opts,
1835
+ startingFrom: dir
1836
+ });
1837
+ }
1838
+ async function readGitConfig(dir, opts) {
1839
+ return parseGitConfig(await readFile(await resolveGitConfig(dir, opts), "utf8"));
1840
+ }
1841
+ function parseGitConfig(ini) {
1842
+ return S(ini.replaceAll(/^\[(\w+) "(.+)"\]$/gm, "[$1.$2]"));
1843
+ }
1844
+
1845
+ //#endregion
1846
+ //#region node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.mjs
1847
+ function isBuffer(obj) {
1848
+ return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
1849
+ }
1850
+ function keyIdentity(key) {
1851
+ return key;
1852
+ }
1853
+ function flatten(target, opts) {
1854
+ opts = opts || {};
1855
+ const delimiter = opts.delimiter || ".";
1856
+ const maxDepth = opts.maxDepth;
1857
+ const transformKey = opts.transformKey || keyIdentity;
1858
+ const output = {};
1859
+ function step(object, prev, currentDepth) {
1860
+ currentDepth = currentDepth || 1;
1861
+ Object.keys(object).forEach(function(key) {
1862
+ const value = object[key];
1863
+ const isarray = opts.safe && Array.isArray(value);
1864
+ const type = Object.prototype.toString.call(value);
1865
+ const isbuffer = isBuffer(value);
1866
+ const isobject = type === "[object Object]" || type === "[object Array]";
1867
+ const newKey = prev ? prev + delimiter + transformKey(key) : transformKey(key);
1868
+ if (!isarray && !isbuffer && isobject && Object.keys(value).length && (!opts.maxDepth || currentDepth < maxDepth)) return step(value, newKey, currentDepth + 1);
1869
+ output[newKey] = value;
1870
+ });
1871
+ }
1872
+ step(target);
1873
+ return output;
1874
+ }
1875
+ function unflatten(target, opts) {
1876
+ opts = opts || {};
1877
+ const delimiter = opts.delimiter || ".";
1878
+ const overwrite = opts.overwrite || false;
1879
+ const transformKey = opts.transformKey || keyIdentity;
1880
+ const result = {};
1881
+ if (isBuffer(target) || Object.prototype.toString.call(target) !== "[object Object]") return target;
1882
+ function getkey(key) {
1883
+ const parsedKey = Number(key);
1884
+ return isNaN(parsedKey) || key.indexOf(".") !== -1 || opts.object ? key : parsedKey;
1885
+ }
1886
+ function addKeys(keyPrefix, recipient, target$1) {
1887
+ return Object.keys(target$1).reduce(function(result$1, key) {
1888
+ result$1[keyPrefix + delimiter + key] = target$1[key];
1889
+ return result$1;
1890
+ }, recipient);
1891
+ }
1892
+ function isEmpty(val) {
1893
+ const type = Object.prototype.toString.call(val);
1894
+ const isArray = type === "[object Array]";
1895
+ const isObject = type === "[object Object]";
1896
+ if (!val) return true;
1897
+ else if (isArray) return !val.length;
1898
+ else if (isObject) return !Object.keys(val).length;
1899
+ }
1900
+ target = Object.keys(target).reduce(function(result$1, key) {
1901
+ const type = Object.prototype.toString.call(target[key]);
1902
+ if (!(type === "[object Object]" || type === "[object Array]") || isEmpty(target[key])) {
1903
+ result$1[key] = target[key];
1904
+ return result$1;
1905
+ } else return addKeys(key, result$1, flatten(target[key], opts));
1906
+ }, {});
1907
+ Object.keys(target).forEach(function(key) {
1908
+ const split = key.split(delimiter).map(transformKey);
1909
+ let key1 = getkey(split.shift());
1910
+ let key2 = getkey(split[0]);
1911
+ let recipient = result;
1912
+ while (key2 !== void 0) {
1913
+ if (key1 === "__proto__") return;
1914
+ const type = Object.prototype.toString.call(recipient[key1]);
1915
+ const isobject = type === "[object Object]" || type === "[object Array]";
1916
+ if (!overwrite && !isobject && typeof recipient[key1] !== "undefined") return;
1917
+ if (overwrite && !isobject || !overwrite && recipient[key1] == null) recipient[key1] = typeof key2 === "number" && !opts.object ? [] : {};
1918
+ recipient = recipient[key1];
1919
+ if (split.length > 0) {
1920
+ key1 = getkey(split.shift());
1921
+ key2 = getkey(split[0]);
1922
+ }
1923
+ }
1924
+ recipient[key1] = unflatten(target[key], opts);
1925
+ });
1926
+ return result;
1927
+ }
1928
+ const RE_KEY_VAL = /^\s*([^\s=]+)\s*=\s*(.*)?\s*$/;
1929
+ const RE_LINES = /\n|\r|\r\n/;
1930
+ const defaults = {
1931
+ name: ".conf",
1932
+ dir: process.cwd(),
1933
+ flat: false
1934
+ };
1935
+ function withDefaults(options) {
1936
+ if (typeof options === "string") options = { name: options };
1937
+ return {
1938
+ ...defaults,
1939
+ ...options
1940
+ };
1941
+ }
1942
+ function parse$1(contents, options = {}) {
1943
+ const config$1 = {};
1944
+ const lines = contents.split(RE_LINES);
1945
+ for (const line of lines) {
1946
+ const match = line.match(RE_KEY_VAL);
1947
+ if (!match) continue;
1948
+ const key = match[1];
1949
+ if (!key || key === "__proto__" || key === "constructor") continue;
1950
+ const value = destr((match[2] || "").trim());
1951
+ if (key.endsWith("[]")) {
1952
+ const nkey = key.slice(0, Math.max(0, key.length - 2));
1953
+ config$1[nkey] = (config$1[nkey] || []).concat(value);
1954
+ continue;
1955
+ }
1956
+ config$1[key] = value;
1957
+ }
1958
+ return options.flat ? config$1 : unflatten(config$1, { overwrite: true });
1959
+ }
1960
+ function parseFile(path$2, options) {
1961
+ if (!existsSync(path$2)) return {};
1962
+ return parse$1(readFileSync(path$2, "utf8"), options);
1963
+ }
1964
+ function read(options) {
1965
+ options = withDefaults(options);
1966
+ return parseFile(resolve(options.dir, options.name), options);
1967
+ }
1968
+ function readUser(options) {
1969
+ options = withDefaults(options);
1970
+ options.dir = process.env.XDG_CONFIG_HOME || homedir();
1971
+ return read(options);
1972
+ }
1973
+
1974
+ //#endregion
1975
+ //#region node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json
1976
+ var require_package = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json": ((exports, module) => {
1977
+ module.exports = {
1978
+ "name": "dotenv",
1979
+ "version": "17.2.3",
1980
+ "description": "Loads environment variables from .env file",
1981
+ "main": "lib/main.js",
1982
+ "types": "lib/main.d.ts",
1983
+ "exports": {
1984
+ ".": {
1985
+ "types": "./lib/main.d.ts",
1986
+ "require": "./lib/main.js",
1987
+ "default": "./lib/main.js"
1988
+ },
1989
+ "./config": "./config.js",
1990
+ "./config.js": "./config.js",
1991
+ "./lib/env-options": "./lib/env-options.js",
1992
+ "./lib/env-options.js": "./lib/env-options.js",
1993
+ "./lib/cli-options": "./lib/cli-options.js",
1994
+ "./lib/cli-options.js": "./lib/cli-options.js",
1995
+ "./package.json": "./package.json"
1996
+ },
1997
+ "scripts": {
1998
+ "dts-check": "tsc --project tests/types/tsconfig.json",
1999
+ "lint": "standard",
2000
+ "pretest": "npm run lint && npm run dts-check",
2001
+ "test": "tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000",
2002
+ "test:coverage": "tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
2003
+ "prerelease": "npm test",
2004
+ "release": "standard-version"
2005
+ },
2006
+ "repository": {
2007
+ "type": "git",
2008
+ "url": "git://github.com/motdotla/dotenv.git"
2009
+ },
2010
+ "homepage": "https://github.com/motdotla/dotenv#readme",
2011
+ "funding": "https://dotenvx.com",
2012
+ "keywords": [
2013
+ "dotenv",
2014
+ "env",
2015
+ ".env",
2016
+ "environment",
2017
+ "variables",
2018
+ "config",
2019
+ "settings"
2020
+ ],
2021
+ "readmeFilename": "README.md",
2022
+ "license": "BSD-2-Clause",
2023
+ "devDependencies": {
2024
+ "@types/node": "^18.11.3",
2025
+ "decache": "^4.6.2",
2026
+ "sinon": "^14.0.1",
2027
+ "standard": "^17.0.0",
2028
+ "standard-version": "^9.5.0",
2029
+ "tap": "^19.2.0",
2030
+ "typescript": "^4.8.4"
2031
+ },
2032
+ "engines": { "node": ">=12" },
2033
+ "browser": { "fs": false }
2034
+ };
2035
+ }) });
2036
+
2037
+ //#endregion
2038
+ //#region node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js
2039
+ var require_main = /* @__PURE__ */ __commonJS({ "node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js": ((exports, module) => {
2040
+ const fs$1 = __require("fs");
2041
+ const path$1 = __require("path");
2042
+ const os$1 = __require("os");
2043
+ const crypto = __require("crypto");
2044
+ const version = require_package().version;
2045
+ const TIPS = [
2046
+ "🔐 encrypt with Dotenvx: https://dotenvx.com",
2047
+ "🔐 prevent committing .env to code: https://dotenvx.com/precommit",
2048
+ "🔐 prevent building .env in docker: https://dotenvx.com/prebuild",
2049
+ "📡 add observability to secrets: https://dotenvx.com/ops",
2050
+ "👥 sync secrets across teammates & machines: https://dotenvx.com/ops",
2051
+ "🗂️ backup and recover secrets: https://dotenvx.com/ops",
2052
+ "✅ audit secrets and track compliance: https://dotenvx.com/ops",
2053
+ "🔄 add secrets lifecycle management: https://dotenvx.com/ops",
2054
+ "🔑 add access controls to secrets: https://dotenvx.com/ops",
2055
+ "🛠️ run anywhere with `dotenvx run -- yourcommand`",
2056
+ "⚙️ specify custom .env file path with { path: '/custom/path/.env' }",
2057
+ "⚙️ enable debug logging with { debug: true }",
2058
+ "⚙️ override existing env vars with { override: true }",
2059
+ "⚙️ suppress all logs with { quiet: true }",
2060
+ "⚙️ write to custom object with { processEnv: myObject }",
2061
+ "⚙️ load multiple .env files with { path: ['.env.local', '.env'] }"
2062
+ ];
2063
+ function _getRandomTip() {
2064
+ return TIPS[Math.floor(Math.random() * TIPS.length)];
2065
+ }
2066
+ function parseBoolean(value) {
2067
+ if (typeof value === "string") return ![
2068
+ "false",
2069
+ "0",
2070
+ "no",
2071
+ "off",
2072
+ ""
2073
+ ].includes(value.toLowerCase());
2074
+ return Boolean(value);
2075
+ }
2076
+ function supportsAnsi() {
2077
+ return process.stdout.isTTY;
2078
+ }
2079
+ function dim(text) {
2080
+ return supportsAnsi() ? `\x1b[2m${text}\x1b[0m` : text;
2081
+ }
2082
+ const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
2083
+ function parse(src) {
2084
+ const obj = {};
2085
+ let lines = src.toString();
2086
+ lines = lines.replace(/\r\n?/gm, "\n");
2087
+ let match;
2088
+ while ((match = LINE.exec(lines)) != null) {
2089
+ const key = match[1];
2090
+ let value = match[2] || "";
2091
+ value = value.trim();
2092
+ const maybeQuote = value[0];
2093
+ value = value.replace(/^(['"`])([\s\S]*)\1$/gm, "$2");
2094
+ if (maybeQuote === "\"") {
2095
+ value = value.replace(/\\n/g, "\n");
2096
+ value = value.replace(/\\r/g, "\r");
2097
+ }
2098
+ obj[key] = value;
2099
+ }
2100
+ return obj;
2101
+ }
2102
+ function _parseVault(options) {
2103
+ options = options || {};
2104
+ const vaultPath = _vaultPath(options);
2105
+ options.path = vaultPath;
2106
+ const result = DotenvModule.configDotenv(options);
2107
+ if (!result.parsed) {
2108
+ const err = /* @__PURE__ */ new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
2109
+ err.code = "MISSING_DATA";
2110
+ throw err;
2111
+ }
2112
+ const keys = _dotenvKey(options).split(",");
2113
+ const length = keys.length;
2114
+ let decrypted;
2115
+ for (let i = 0; i < length; i++) try {
2116
+ const attrs = _instructions(result, keys[i].trim());
2117
+ decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
2118
+ break;
2119
+ } catch (error) {
2120
+ if (i + 1 >= length) throw error;
2121
+ }
2122
+ return DotenvModule.parse(decrypted);
2123
+ }
2124
+ function _warn(message) {
2125
+ console.error(`[dotenv@${version}][WARN] ${message}`);
2126
+ }
2127
+ function _debug(message) {
2128
+ console.log(`[dotenv@${version}][DEBUG] ${message}`);
2129
+ }
2130
+ function _log(message) {
2131
+ console.log(`[dotenv@${version}] ${message}`);
2132
+ }
2133
+ function _dotenvKey(options) {
2134
+ if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) return options.DOTENV_KEY;
2135
+ if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) return process.env.DOTENV_KEY;
2136
+ return "";
2137
+ }
2138
+ function _instructions(result, dotenvKey) {
2139
+ let uri;
2140
+ try {
2141
+ uri = new URL(dotenvKey);
2142
+ } catch (error) {
2143
+ if (error.code === "ERR_INVALID_URL") {
2144
+ const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
2145
+ err.code = "INVALID_DOTENV_KEY";
2146
+ throw err;
2147
+ }
2148
+ throw error;
2149
+ }
2150
+ const key = uri.password;
2151
+ if (!key) {
2152
+ const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Missing key part");
2153
+ err.code = "INVALID_DOTENV_KEY";
2154
+ throw err;
2155
+ }
2156
+ const environment = uri.searchParams.get("environment");
2157
+ if (!environment) {
2158
+ const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Missing environment part");
2159
+ err.code = "INVALID_DOTENV_KEY";
2160
+ throw err;
2161
+ }
2162
+ const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
2163
+ const ciphertext = result.parsed[environmentKey];
2164
+ if (!ciphertext) {
2165
+ const err = /* @__PURE__ */ new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
2166
+ err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
2167
+ throw err;
2168
+ }
2169
+ return {
2170
+ ciphertext,
2171
+ key
2172
+ };
2173
+ }
2174
+ function _vaultPath(options) {
2175
+ let possibleVaultPath = null;
2176
+ if (options && options.path && options.path.length > 0) if (Array.isArray(options.path)) {
2177
+ for (const filepath of options.path) if (fs$1.existsSync(filepath)) possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
2178
+ } else possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
2179
+ else possibleVaultPath = path$1.resolve(process.cwd(), ".env.vault");
2180
+ if (fs$1.existsSync(possibleVaultPath)) return possibleVaultPath;
2181
+ return null;
2182
+ }
2183
+ function _resolveHome(envPath) {
2184
+ return envPath[0] === "~" ? path$1.join(os$1.homedir(), envPath.slice(1)) : envPath;
2185
+ }
2186
+ function _configVault(options) {
2187
+ const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
2188
+ const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options && options.quiet);
2189
+ if (debug || !quiet) _log("Loading env from encrypted .env.vault");
2190
+ const parsed = DotenvModule._parseVault(options);
2191
+ let processEnv = process.env;
2192
+ if (options && options.processEnv != null) processEnv = options.processEnv;
2193
+ DotenvModule.populate(processEnv, parsed, options);
2194
+ return { parsed };
2195
+ }
2196
+ function configDotenv(options) {
2197
+ const dotenvPath = path$1.resolve(process.cwd(), ".env");
2198
+ let encoding = "utf8";
2199
+ let processEnv = process.env;
2200
+ if (options && options.processEnv != null) processEnv = options.processEnv;
2201
+ let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
2202
+ let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options && options.quiet);
2203
+ if (options && options.encoding) encoding = options.encoding;
2204
+ else if (debug) _debug("No encoding is specified. UTF-8 is used by default");
2205
+ let optionPaths = [dotenvPath];
2206
+ if (options && options.path) if (!Array.isArray(options.path)) optionPaths = [_resolveHome(options.path)];
2207
+ else {
2208
+ optionPaths = [];
2209
+ for (const filepath of options.path) optionPaths.push(_resolveHome(filepath));
2210
+ }
2211
+ let lastError;
2212
+ const parsedAll = {};
2213
+ for (const path$2 of optionPaths) try {
2214
+ const parsed = DotenvModule.parse(fs$1.readFileSync(path$2, { encoding }));
2215
+ DotenvModule.populate(parsedAll, parsed, options);
2216
+ } catch (e) {
2217
+ if (debug) _debug(`Failed to load ${path$2} ${e.message}`);
2218
+ lastError = e;
2219
+ }
2220
+ const populated = DotenvModule.populate(processEnv, parsedAll, options);
2221
+ debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
2222
+ quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
2223
+ if (debug || !quiet) {
2224
+ const keysCount = Object.keys(populated).length;
2225
+ const shortPaths = [];
2226
+ for (const filePath of optionPaths) try {
2227
+ const relative$2 = path$1.relative(process.cwd(), filePath);
2228
+ shortPaths.push(relative$2);
2229
+ } catch (e) {
2230
+ if (debug) _debug(`Failed to load ${filePath} ${e.message}`);
2231
+ lastError = e;
2232
+ }
2233
+ _log(`injecting env (${keysCount}) from ${shortPaths.join(",")} ${dim(`-- tip: ${_getRandomTip()}`)}`);
2234
+ }
2235
+ if (lastError) return {
2236
+ parsed: parsedAll,
2237
+ error: lastError
2238
+ };
2239
+ else return { parsed: parsedAll };
2240
+ }
2241
+ function config(options) {
2242
+ if (_dotenvKey(options).length === 0) return DotenvModule.configDotenv(options);
2243
+ const vaultPath = _vaultPath(options);
2244
+ if (!vaultPath) {
2245
+ _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
2246
+ return DotenvModule.configDotenv(options);
2247
+ }
2248
+ return DotenvModule._configVault(options);
2249
+ }
2250
+ function decrypt(encrypted, keyStr) {
2251
+ const key = Buffer.from(keyStr.slice(-64), "hex");
2252
+ let ciphertext = Buffer.from(encrypted, "base64");
2253
+ const nonce = ciphertext.subarray(0, 12);
2254
+ const authTag = ciphertext.subarray(-16);
2255
+ ciphertext = ciphertext.subarray(12, -16);
2256
+ try {
2257
+ const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
2258
+ aesgcm.setAuthTag(authTag);
2259
+ return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
2260
+ } catch (error) {
2261
+ const isRange = error instanceof RangeError;
2262
+ const invalidKeyLength = error.message === "Invalid key length";
2263
+ const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
2264
+ if (isRange || invalidKeyLength) {
2265
+ const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
2266
+ err.code = "INVALID_DOTENV_KEY";
2267
+ throw err;
2268
+ } else if (decryptionFailed) {
2269
+ const err = /* @__PURE__ */ new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
2270
+ err.code = "DECRYPTION_FAILED";
2271
+ throw err;
2272
+ } else throw error;
2273
+ }
2274
+ }
2275
+ function populate(processEnv, parsed, options = {}) {
2276
+ const debug = Boolean(options && options.debug);
2277
+ const override = Boolean(options && options.override);
2278
+ const populated = {};
2279
+ if (typeof parsed !== "object") {
2280
+ const err = /* @__PURE__ */ new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
2281
+ err.code = "OBJECT_REQUIRED";
2282
+ throw err;
2283
+ }
2284
+ for (const key of Object.keys(parsed)) if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
2285
+ if (override === true) {
2286
+ processEnv[key] = parsed[key];
2287
+ populated[key] = parsed[key];
2288
+ }
2289
+ if (debug) if (override === true) _debug(`"${key}" is already defined and WAS overwritten`);
2290
+ else _debug(`"${key}" is already defined and was NOT overwritten`);
2291
+ } else {
2292
+ processEnv[key] = parsed[key];
2293
+ populated[key] = parsed[key];
2294
+ }
2295
+ return populated;
2296
+ }
2297
+ const DotenvModule = {
2298
+ configDotenv,
2299
+ _configVault,
2300
+ _parseVault,
2301
+ config,
2302
+ decrypt,
2303
+ parse,
2304
+ populate
2305
+ };
2306
+ module.exports.configDotenv = DotenvModule.configDotenv;
2307
+ module.exports._configVault = DotenvModule._configVault;
2308
+ module.exports._parseVault = DotenvModule._parseVault;
2309
+ module.exports.config = DotenvModule.config;
2310
+ module.exports.decrypt = DotenvModule.decrypt;
2311
+ module.exports.parse = DotenvModule.parse;
2312
+ module.exports.populate = DotenvModule.populate;
2313
+ module.exports = DotenvModule;
2314
+ }) });
2315
+
2316
+ //#endregion
2317
+ //#region node_modules/.pnpm/c12@3.3.1_magicast@0.3.5/node_modules/c12/dist/shared/c12.8GPsgFQh.mjs
2318
+ var import_main$1 = /* @__PURE__ */ __toESM(require_main(), 1);
2319
+ async function setupDotenv(options) {
2320
+ const targetEnvironment = options.env ?? process.env;
2321
+ const environment = await loadDotenv({
2322
+ cwd: options.cwd,
2323
+ fileName: options.fileName ?? ".env",
2324
+ env: targetEnvironment,
2325
+ interpolate: options.interpolate ?? true
2326
+ });
2327
+ const dotenvVars = getDotEnvVars(targetEnvironment);
2328
+ for (const key in environment) {
2329
+ if (key.startsWith("_")) continue;
2330
+ if (targetEnvironment[key] === void 0 || dotenvVars.has(key)) targetEnvironment[key] = environment[key];
2331
+ }
2332
+ return environment;
2333
+ }
2334
+ async function loadDotenv(options) {
2335
+ const environment = /* @__PURE__ */ Object.create(null);
2336
+ const cwd$1 = resolve$1(options.cwd || ".");
2337
+ const _fileName = options.fileName || ".env";
2338
+ const dotenvFiles = typeof _fileName === "string" ? [_fileName] : _fileName;
2339
+ const dotenvVars = getDotEnvVars(options.env || {});
2340
+ Object.assign(environment, options.env);
2341
+ for (const file of dotenvFiles) {
2342
+ const dotenvFile = resolve$1(cwd$1, file);
2343
+ if (!statSync(dotenvFile, { throwIfNoEntry: false })?.isFile()) continue;
2344
+ const parsed = import_main$1.parse(await promises.readFile(dotenvFile, "utf8"));
2345
+ for (const key in parsed) {
2346
+ if (key in environment && !dotenvVars.has(key)) continue;
2347
+ environment[key] = parsed[key];
2348
+ dotenvVars.add(key);
2349
+ }
2350
+ }
2351
+ if (options.interpolate) interpolate(environment);
2352
+ return environment;
2353
+ }
2354
+ function interpolate(target, source = {}, parse$3 = (v$1) => v$1) {
2355
+ function getValue(key) {
2356
+ return source[key] === void 0 ? target[key] : source[key];
2357
+ }
2358
+ function interpolate2(value, parents = []) {
2359
+ if (typeof value !== "string") return value;
2360
+ return parse$3((value.match(/(.?\${?(?:[\w:]+)?}?)/g) || []).reduce((newValue, match) => {
2361
+ const parts = /(.?)\${?([\w:]+)?}?/g.exec(match) || [];
2362
+ const prefix = parts[1];
2363
+ let value2, replacePart;
2364
+ if (prefix === "\\") {
2365
+ replacePart = parts[0] || "";
2366
+ value2 = replacePart.replace(String.raw`\$`, "$");
2367
+ } else {
2368
+ const key = parts[2];
2369
+ replacePart = (parts[0] || "").slice(prefix.length);
2370
+ if (parents.includes(key)) {
2371
+ console.warn(`Please avoid recursive environment variables ( loop: ${parents.join(" > ")} > ${key} )`);
2372
+ return "";
2373
+ }
2374
+ value2 = getValue(key);
2375
+ value2 = interpolate2(value2, [...parents, key]);
2376
+ }
2377
+ return value2 === void 0 ? newValue : newValue.replace(replacePart, value2);
2378
+ }, value));
2379
+ }
2380
+ for (const key in target) target[key] = interpolate2(getValue(key));
2381
+ }
2382
+ function getDotEnvVars(targetEnvironment) {
2383
+ const globalRegistry = globalThis.__c12_dotenv_vars__ ||= /* @__PURE__ */ new Map();
2384
+ if (!globalRegistry.has(targetEnvironment)) globalRegistry.set(targetEnvironment, /* @__PURE__ */ new Set());
2385
+ return globalRegistry.get(targetEnvironment);
2386
+ }
2387
+ const _normalize = (p) => p?.replace(/\\/g, "/");
2388
+ const ASYNC_LOADERS = {
2389
+ ".yaml": () => import("../cli/_chunks/yaml.mjs").then((r$1) => r$1.parseYAML),
2390
+ ".yml": () => import("../cli/_chunks/yaml.mjs").then((r$1) => r$1.parseYAML),
2391
+ ".jsonc": () => import("../cli/_chunks/jsonc.mjs").then((r$1) => r$1.parseJSONC),
2392
+ ".json5": () => import("../cli/_chunks/json5.mjs").then((r$1) => r$1.parseJSON5),
2393
+ ".toml": () => import("../cli/_chunks/toml.mjs").then((r$1) => r$1.parseTOML)
2394
+ };
2395
+ const SUPPORTED_EXTENSIONS = Object.freeze([
2396
+ ".js",
2397
+ ".ts",
2398
+ ".mjs",
2399
+ ".cjs",
2400
+ ".mts",
2401
+ ".cts",
2402
+ ".json",
2403
+ ".jsonc",
2404
+ ".json5",
2405
+ ".yaml",
2406
+ ".yml",
2407
+ ".toml"
2408
+ ]);
2409
+ async function loadConfig(options) {
2410
+ options.cwd = resolve$1(process.cwd(), options.cwd || ".");
2411
+ options.name = options.name || "config";
2412
+ options.envName = options.envName ?? process.env.NODE_ENV;
2413
+ options.configFile = options.configFile ?? (options.name === "config" ? "config" : `${options.name}.config`);
2414
+ options.rcFile = options.rcFile ?? `.${options.name}rc`;
2415
+ if (options.extend !== false) options.extend = {
2416
+ extendKey: "extends",
2417
+ ...options.extend
2418
+ };
2419
+ const _merger = options.merger || defu;
2420
+ options.jiti = options.jiti || createJiti(join$1(options.cwd, options.configFile), {
2421
+ interopDefault: true,
2422
+ moduleCache: false,
2423
+ extensions: [...SUPPORTED_EXTENSIONS],
2424
+ ...options.jitiOptions
2425
+ });
2426
+ const r$1 = {
2427
+ config: {},
2428
+ cwd: options.cwd,
2429
+ configFile: resolve$1(options.cwd, options.configFile),
2430
+ layers: [],
2431
+ _configFile: void 0
2432
+ };
2433
+ const rawConfigs = {
2434
+ overrides: options.overrides,
2435
+ main: void 0,
2436
+ rc: void 0,
2437
+ packageJson: void 0,
2438
+ defaultConfig: options.defaultConfig
2439
+ };
2440
+ if (options.dotenv) await setupDotenv({
2441
+ cwd: options.cwd,
2442
+ ...options.dotenv === true ? {} : options.dotenv
2443
+ });
2444
+ const _mainConfig = await resolveConfig(".", options);
2445
+ if (_mainConfig.configFile) {
2446
+ rawConfigs.main = _mainConfig.config;
2447
+ r$1.configFile = _mainConfig.configFile;
2448
+ r$1._configFile = _mainConfig._configFile;
2449
+ }
2450
+ if (_mainConfig.meta) r$1.meta = _mainConfig.meta;
2451
+ if (options.rcFile) {
2452
+ const rcSources = [];
2453
+ rcSources.push(read({
2454
+ name: options.rcFile,
2455
+ dir: options.cwd
2456
+ }));
2457
+ if (options.globalRc) {
2458
+ const workspaceDir = await findWorkspaceDir(options.cwd).catch(() => {});
2459
+ if (workspaceDir) rcSources.push(read({
2460
+ name: options.rcFile,
2461
+ dir: workspaceDir
2462
+ }));
2463
+ rcSources.push(readUser({
2464
+ name: options.rcFile,
2465
+ dir: options.cwd
2466
+ }));
2467
+ }
2468
+ rawConfigs.rc = _merger({}, ...rcSources);
2469
+ }
2470
+ if (options.packageJson) {
2471
+ const keys = (Array.isArray(options.packageJson) ? options.packageJson : [typeof options.packageJson === "string" ? options.packageJson : options.name]).filter((t) => t && typeof t === "string");
2472
+ const pkgJsonFile = await readPackageJSON(options.cwd).catch(() => {});
2473
+ rawConfigs.packageJson = _merger({}, ...keys.map((key) => pkgJsonFile?.[key]));
2474
+ }
2475
+ const configs = {};
2476
+ for (const key in rawConfigs) {
2477
+ const value = rawConfigs[key];
2478
+ configs[key] = await (typeof value === "function" ? value({
2479
+ configs,
2480
+ rawConfigs
2481
+ }) : value);
2482
+ }
2483
+ if (Array.isArray(configs.main)) r$1.config = configs.main;
2484
+ else {
2485
+ r$1.config = _merger(configs.overrides, configs.main, configs.rc, configs.packageJson, configs.defaultConfig);
2486
+ if (options.extend) {
2487
+ await extendConfig(r$1.config, options);
2488
+ r$1.layers = r$1.config._layers;
2489
+ delete r$1.config._layers;
2490
+ r$1.config = _merger(r$1.config, ...r$1.layers.map((e) => e.config));
2491
+ }
2492
+ }
2493
+ r$1.layers = [...[
2494
+ configs.overrides && {
2495
+ config: configs.overrides,
2496
+ configFile: void 0,
2497
+ cwd: void 0
2498
+ },
2499
+ {
2500
+ config: configs.main,
2501
+ configFile: options.configFile,
2502
+ cwd: options.cwd
2503
+ },
2504
+ configs.rc && {
2505
+ config: configs.rc,
2506
+ configFile: options.rcFile
2507
+ },
2508
+ configs.packageJson && {
2509
+ config: configs.packageJson,
2510
+ configFile: "package.json"
2511
+ }
2512
+ ].filter((l) => l && l.config), ...r$1.layers];
2513
+ if (options.defaults) r$1.config = _merger(r$1.config, options.defaults);
2514
+ if (options.omit$Keys) {
2515
+ for (const key in r$1.config) if (key.startsWith("$")) delete r$1.config[key];
2516
+ }
2517
+ if (options.configFileRequired && !r$1._configFile) throw new Error(`Required config (${r$1.configFile}) cannot be resolved.`);
2518
+ return r$1;
2519
+ }
2520
+ async function extendConfig(config$1, options) {
2521
+ config$1._layers = config$1._layers || [];
2522
+ if (!options.extend) return;
2523
+ let keys = options.extend.extendKey;
2524
+ if (typeof keys === "string") keys = [keys];
2525
+ const extendSources = [];
2526
+ for (const key of keys) {
2527
+ extendSources.push(...(Array.isArray(config$1[key]) ? config$1[key] : [config$1[key]]).filter(Boolean));
2528
+ delete config$1[key];
2529
+ }
2530
+ for (let extendSource of extendSources) {
2531
+ const originalExtendSource = extendSource;
2532
+ let sourceOptions = {};
2533
+ if (extendSource.source) {
2534
+ sourceOptions = extendSource.options || {};
2535
+ extendSource = extendSource.source;
2536
+ }
2537
+ if (Array.isArray(extendSource)) {
2538
+ sourceOptions = extendSource[1] || {};
2539
+ extendSource = extendSource[0];
2540
+ }
2541
+ if (typeof extendSource !== "string") {
2542
+ console.warn(`Cannot extend config from \`${JSON.stringify(originalExtendSource)}\` in ${options.cwd}`);
2543
+ continue;
2544
+ }
2545
+ const _config = await resolveConfig(extendSource, options, sourceOptions);
2546
+ if (!_config.config) {
2547
+ console.warn(`Cannot extend config from \`${extendSource}\` in ${options.cwd}`);
2548
+ continue;
2549
+ }
2550
+ await extendConfig(_config.config, {
2551
+ ...options,
2552
+ cwd: _config.cwd
2553
+ });
2554
+ config$1._layers.push(_config);
2555
+ if (_config.config._layers) {
2556
+ config$1._layers.push(..._config.config._layers);
2557
+ delete _config.config._layers;
2558
+ }
2559
+ }
2560
+ }
2561
+ const GIGET_PREFIXES = [
2562
+ "gh:",
2563
+ "github:",
2564
+ "gitlab:",
2565
+ "bitbucket:",
2566
+ "https://",
2567
+ "http://"
2568
+ ];
2569
+ const NPM_PACKAGE_RE = /^(@[\da-z~-][\d._a-z~-]*\/)?[\da-z~-][\d._a-z~-]*($|\/.*)/;
2570
+ async function resolveConfig(source, options, sourceOptions = {}) {
2571
+ if (options.resolve) {
2572
+ const res2 = await options.resolve(source, options);
2573
+ if (res2) return res2;
2574
+ }
2575
+ const _merger = options.merger || defu;
2576
+ const customProviderKeys = Object.keys(sourceOptions.giget?.providers || {}).map((key) => `${key}:`);
2577
+ const gigetPrefixes = customProviderKeys.length > 0 ? [.../* @__PURE__ */ new Set([...customProviderKeys, ...GIGET_PREFIXES])] : GIGET_PREFIXES;
2578
+ if (options.giget !== false && gigetPrefixes.some((prefix) => source.startsWith(prefix))) {
2579
+ const { downloadTemplate } = await import("../cli/_chunks/dist2.mjs");
2580
+ const { digest } = await import("ohash");
2581
+ const cloneName = source.replace(/\W+/g, "_").split("_").splice(0, 3).join("_") + "_" + digest(source).slice(0, 10).replace(/[-_]/g, "");
2582
+ let cloneDir;
2583
+ const localNodeModules = resolve$1(options.cwd, "node_modules");
2584
+ const parentDir = dirname$1(options.cwd);
2585
+ if (basename$1(parentDir) === ".c12") cloneDir = join$1(parentDir, cloneName);
2586
+ else if (existsSync(localNodeModules)) cloneDir = join$1(localNodeModules, ".c12", cloneName);
2587
+ else cloneDir = process.env.XDG_CACHE_HOME ? resolve$1(process.env.XDG_CACHE_HOME, "c12", cloneName) : resolve$1(homedir(), ".cache/c12", cloneName);
2588
+ if (existsSync(cloneDir) && !sourceOptions.install) await rm(cloneDir, { recursive: true });
2589
+ source = (await downloadTemplate(source, {
2590
+ dir: cloneDir,
2591
+ install: sourceOptions.install,
2592
+ force: sourceOptions.install,
2593
+ auth: sourceOptions.auth,
2594
+ ...options.giget,
2595
+ ...sourceOptions.giget
2596
+ })).dir;
2597
+ }
2598
+ if (NPM_PACKAGE_RE.test(source)) source = tryResolve(source, options) || source;
2599
+ const ext = extname$1(source);
2600
+ const isDir = !ext || ext === basename$1(source);
2601
+ const cwd$1 = resolve$1(options.cwd, isDir ? source : dirname$1(source));
2602
+ if (isDir) source = options.configFile;
2603
+ const res = {
2604
+ config: void 0,
2605
+ configFile: void 0,
2606
+ cwd: cwd$1,
2607
+ source,
2608
+ sourceOptions
2609
+ };
2610
+ res.configFile = tryResolve(resolve$1(cwd$1, source), options) || tryResolve(resolve$1(cwd$1, ".config", source.replace(/\.config$/, "")), options) || tryResolve(resolve$1(cwd$1, ".config", source), options) || source;
2611
+ if (!existsSync(res.configFile)) return res;
2612
+ res._configFile = res.configFile;
2613
+ const configFileExt = extname$1(res.configFile) || "";
2614
+ if (configFileExt in ASYNC_LOADERS) res.config = (await ASYNC_LOADERS[configFileExt]())(await readFile(res.configFile, "utf8"));
2615
+ else res.config = await options.jiti.import(res.configFile, { default: true });
2616
+ if (typeof res.config === "function") res.config = await res.config(options.context);
2617
+ if (options.envName) {
2618
+ const envConfig = {
2619
+ ...res.config["$" + options.envName],
2620
+ ...res.config.$env?.[options.envName]
2621
+ };
2622
+ if (Object.keys(envConfig).length > 0) res.config = _merger(envConfig, res.config);
2623
+ }
2624
+ res.meta = defu(res.sourceOptions.meta, res.config.$meta);
2625
+ delete res.config.$meta;
2626
+ if (res.sourceOptions.overrides) res.config = _merger(res.sourceOptions.overrides, res.config);
2627
+ res.configFile = _normalize(res.configFile);
2628
+ res.source = _normalize(res.source);
2629
+ return res;
2630
+ }
2631
+ function tryResolve(id, options) {
2632
+ const res = resolveModulePath(id, {
2633
+ try: true,
2634
+ from: pathToFileURL(join$1(options.cwd || ".", options.configFile || "/")),
2635
+ suffixes: ["", "/index"],
2636
+ extensions: SUPPORTED_EXTENSIONS,
2637
+ cache: false
2638
+ });
2639
+ return res ? normalize$1(res) : void 0;
2640
+ }
2641
+
2642
+ //#endregion
2643
+ //#region node_modules/.pnpm/perfect-debounce@2.0.0/node_modules/perfect-debounce/dist/index.mjs
2644
+ const DEBOUNCE_DEFAULTS = { trailing: true };
2645
+ /**
2646
+ Debounce functions
2647
+ @param fn - Promise-returning/async function to debounce.
2648
+ @param wait - Milliseconds to wait before calling `fn`. Default value is 25ms
2649
+ @returns A function that delays calling `fn` until after `wait` milliseconds have elapsed since the last time it was called.
2650
+ @example
2651
+ ```
2652
+ import { debounce } from 'perfect-debounce';
2653
+ const expensiveCall = async input => input;
2654
+ const debouncedFn = debounce(expensiveCall, 200);
2655
+ for (const number of [1, 2, 3]) {
2656
+ console.log(await debouncedFn(number));
2657
+ }
2658
+ //=> 1
2659
+ //=> 2
2660
+ //=> 3
2661
+ ```
2662
+ */
2663
+ function debounce(fn, wait = 25, options = {}) {
2664
+ options = {
2665
+ ...DEBOUNCE_DEFAULTS,
2666
+ ...options
2667
+ };
2668
+ if (!Number.isFinite(wait)) throw new TypeError("Expected `wait` to be a finite number");
2669
+ let leadingValue;
2670
+ let timeout;
2671
+ let resolveList = [];
2672
+ let currentPromise;
2673
+ let trailingArgs;
2674
+ const applyFn = (_this, args) => {
2675
+ currentPromise = _applyPromised(fn, _this, args);
2676
+ currentPromise.finally(() => {
2677
+ currentPromise = null;
2678
+ if (options.trailing && trailingArgs && !timeout) {
2679
+ const promise = applyFn(_this, trailingArgs);
2680
+ trailingArgs = null;
2681
+ return promise;
2682
+ }
2683
+ });
2684
+ return currentPromise;
2685
+ };
2686
+ const debounced = function(...args) {
2687
+ if (options.trailing) trailingArgs = args;
2688
+ if (currentPromise) return currentPromise;
2689
+ return new Promise((resolve$2) => {
2690
+ const shouldCallNow = !timeout && options.leading;
2691
+ clearTimeout(timeout);
2692
+ timeout = setTimeout(() => {
2693
+ timeout = null;
2694
+ const promise = options.leading ? leadingValue : applyFn(this, args);
2695
+ trailingArgs = null;
2696
+ for (const _resolve of resolveList) _resolve(promise);
2697
+ resolveList = [];
2698
+ }, wait);
2699
+ if (shouldCallNow) {
2700
+ leadingValue = applyFn(this, args);
2701
+ resolve$2(leadingValue);
2702
+ } else resolveList.push(resolve$2);
2703
+ });
2704
+ };
2705
+ const _clearTimeout = (timer) => {
2706
+ if (timer) {
2707
+ clearTimeout(timer);
2708
+ timeout = null;
2709
+ }
2710
+ };
2711
+ debounced.isPending = () => !!timeout;
2712
+ debounced.cancel = () => {
2713
+ _clearTimeout(timeout);
2714
+ resolveList = [];
2715
+ trailingArgs = null;
2716
+ };
2717
+ debounced.flush = () => {
2718
+ _clearTimeout(timeout);
2719
+ if (!trailingArgs || currentPromise) return;
2720
+ const args = trailingArgs;
2721
+ trailingArgs = null;
2722
+ return applyFn(this, args);
2723
+ };
2724
+ return debounced;
2725
+ }
2726
+ async function _applyPromised(fn, _this, args) {
2727
+ return await fn.apply(_this, args);
2728
+ }
2729
+
2730
+ //#endregion
2731
+ //#region node_modules/.pnpm/c12@3.3.1_magicast@0.3.5/node_modules/c12/dist/index.mjs
2732
+ var import_main = /* @__PURE__ */ __toESM(require_main(), 1);
2733
+ const eventMap = {
2734
+ add: "created",
2735
+ change: "updated",
2736
+ unlink: "removed"
2737
+ };
2738
+ async function watchConfig(options) {
2739
+ let config$1 = await loadConfig(options);
2740
+ const configName = options.name || "config";
2741
+ const configFileName = options.configFile ?? (options.name === "config" ? "config" : `${options.name}.config`);
2742
+ const watchingFiles = [...new Set((config$1.layers || []).filter((l) => l.cwd).flatMap((l) => [
2743
+ ...SUPPORTED_EXTENSIONS.flatMap((ext) => [
2744
+ resolve$1(l.cwd, configFileName + ext),
2745
+ resolve$1(l.cwd, ".config", configFileName + ext),
2746
+ resolve$1(l.cwd, ".config", configFileName.replace(/\.config$/, "") + ext)
2747
+ ]),
2748
+ l.source && resolve$1(l.cwd, l.source),
2749
+ options.rcFile && resolve$1(l.cwd, typeof options.rcFile === "string" ? options.rcFile : `.${configName}rc`),
2750
+ options.packageJson && resolve$1(l.cwd, "package.json")
2751
+ ]).filter(Boolean))];
2752
+ const watch$1 = await import("../cli/_chunks/esm.mjs").then((r$1) => r$1.watch || r$1.default || r$1);
2753
+ const { diff } = await import("ohash/utils");
2754
+ const _fswatcher = watch$1(watchingFiles, {
2755
+ ignoreInitial: true,
2756
+ ...options.chokidarOptions
2757
+ });
2758
+ const onChange = async (event, path$2) => {
2759
+ const type = eventMap[event];
2760
+ if (!type) return;
2761
+ if (options.onWatch) await options.onWatch({
2762
+ type,
2763
+ path: path$2
2764
+ });
2765
+ const oldConfig = config$1;
2766
+ try {
2767
+ config$1 = await loadConfig(options);
2768
+ } catch (error) {
2769
+ console.warn(`Failed to load config ${path$2}
2770
+ ${error}`);
2771
+ return;
2772
+ }
2773
+ const changeCtx = {
2774
+ newConfig: config$1,
2775
+ oldConfig,
2776
+ getDiff: () => diff(oldConfig.config, config$1.config)
2777
+ };
2778
+ if (options.acceptHMR) {
2779
+ if (await options.acceptHMR(changeCtx)) return;
2780
+ }
2781
+ if (options.onUpdate) await options.onUpdate(changeCtx);
2782
+ };
2783
+ if (options.debounce === false) _fswatcher.on("all", onChange);
2784
+ else _fswatcher.on("all", debounce(onChange, options.debounce ?? 100));
2785
+ const utils = {
2786
+ watchingFiles,
2787
+ unwatch: async () => {
2788
+ await _fswatcher.close();
2789
+ }
2790
+ };
2791
+ return new Proxy(utils, { get(_$1, prop) {
2792
+ if (prop in utils) return utils[prop];
2793
+ return config$1[prop];
2794
+ } });
2795
+ }
2796
+
2797
+ //#endregion
2798
+ export { parse$2 as C, normalizeWindowsPath as S, resolve$1 as T, dirname$1 as _, findNearestFile as a, join$1 as b, readGitConfig as c, resolvePackageJSON as d, resolveModulePath as f, basename$1 as g, N as h, findFile as i, readPackageJSON as l, C as m, debounce as n, findWorkspaceDir as o, h as p, loadConfig as r, parseGitConfig as s, watchConfig as t, resolveGitConfig as u, extname$1 as v, relative$1 as w, normalize$1 as x, isAbsolute$1 as y };