@donotdev/cli 0.0.14 → 0.0.16

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 (184) hide show
  1. package/dependencies-matrix.json +372 -88
  2. package/dist/bin/commands/agent-setup.js +7 -1
  3. package/dist/bin/commands/build.js +141 -44
  4. package/dist/bin/commands/bump.js +81 -41
  5. package/dist/bin/commands/cacheout.js +37 -9
  6. package/dist/bin/commands/create-app.js +276 -121
  7. package/dist/bin/commands/create-project.js +506 -217
  8. package/dist/bin/commands/deploy.js +1785 -694
  9. package/dist/bin/commands/dev.js +177 -43
  10. package/dist/bin/commands/doctor.d.ts +6 -0
  11. package/dist/bin/commands/doctor.d.ts.map +1 -0
  12. package/dist/bin/commands/{lint.js → doctor.js} +1215 -156
  13. package/dist/bin/commands/doctor.js.map +1 -0
  14. package/dist/bin/commands/emu.js +451 -104
  15. package/dist/bin/commands/format.js +37 -9
  16. package/dist/bin/commands/make-admin.js +77499 -11
  17. package/dist/bin/commands/preview.js +181 -43
  18. package/dist/bin/commands/setup.d.ts +6 -0
  19. package/dist/bin/commands/setup.d.ts.map +1 -0
  20. package/dist/bin/commands/setup.js +11733 -0
  21. package/dist/bin/commands/setup.js.map +1 -0
  22. package/dist/bin/commands/supabase-setup.d.ts +6 -0
  23. package/dist/bin/commands/supabase-setup.d.ts.map +1 -0
  24. package/dist/bin/commands/supabase-setup.js +7 -0
  25. package/dist/bin/commands/supabase-setup.js.map +1 -0
  26. package/dist/bin/commands/sync-secrets.js +211 -34
  27. package/dist/bin/commands/type-check.d.ts +14 -0
  28. package/dist/bin/commands/type-check.d.ts.map +1 -0
  29. package/dist/bin/commands/type-check.js +2049 -0
  30. package/dist/bin/commands/type-check.js.map +1 -0
  31. package/dist/bin/commands/wai.js +3 -1
  32. package/dist/bin/dndev.js +73 -52
  33. package/dist/bin/donotdev.js +54 -45
  34. package/dist/index.js +4212 -3050
  35. package/package.json +3 -3
  36. package/templates/app-demo/src/App.tsx.example +1 -0
  37. package/templates/app-demo/src/pages/FullPage.tsx.example +2 -2
  38. package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +2 -2
  39. package/templates/app-demo/src/themes.css.example +5 -12
  40. package/templates/app-expo/.env.example +44 -0
  41. package/templates/app-expo/.expo/README.md.example +5 -0
  42. package/templates/app-expo/.gitignore.example +36 -0
  43. package/templates/app-expo/README.md.example +58 -0
  44. package/templates/app-expo/app/.gitkeep +2 -0
  45. package/templates/app-expo/app/_layout.tsx.example +41 -0
  46. package/templates/app-expo/app/form.tsx.example +52 -0
  47. package/templates/app-expo/app/index.tsx.example +89 -0
  48. package/templates/app-expo/app/list.tsx.example +32 -0
  49. package/templates/app-expo/app/profile.tsx.example +76 -0
  50. package/templates/app-expo/app/signin.tsx.example +53 -0
  51. package/templates/app-expo/app.json.example +39 -0
  52. package/templates/app-expo/assets/adaptive-icon.png +0 -0
  53. package/templates/app-expo/assets/favicon.png +0 -0
  54. package/templates/app-expo/assets/icon.png +0 -0
  55. package/templates/app-expo/assets/splash.png +0 -0
  56. package/templates/app-expo/babel.config.js.example +10 -0
  57. package/templates/app-expo/eas.json.example +20 -0
  58. package/templates/app-expo/expo-env.d.ts.example +4 -0
  59. package/templates/app-expo/metro.config.js.example +20 -0
  60. package/templates/app-expo/service-account-key.json.example +12 -0
  61. package/templates/app-expo/src/config/app.ts.example +46 -0
  62. package/templates/app-expo/src/config/providers.ts.example +7 -0
  63. package/templates/app-expo/tsconfig.json.example +19 -0
  64. package/templates/app-next/.env.example +4 -33
  65. package/templates/app-next/src/app/ClientLayout.tsx.example +2 -0
  66. package/templates/app-next/src/app/layout.tsx.example +7 -6
  67. package/templates/app-next/src/config/providers.ts.example +7 -0
  68. package/templates/app-next/src/globals.css.example +2 -11
  69. package/templates/app-next/src/pages/HomePage.tsx.example +1 -1
  70. package/templates/app-next/src/themes.css.example +10 -13
  71. package/templates/app-vite/.env.example +3 -32
  72. package/templates/app-vite/index.html.example +2 -24
  73. package/templates/app-vite/src/App.tsx.example +2 -0
  74. package/templates/app-vite/src/config/providers.ts.example +7 -0
  75. package/templates/app-vite/src/globals.css.example +2 -12
  76. package/templates/app-vite/src/pages/FormPageExample.tsx.example +1 -2
  77. package/templates/app-vite/src/pages/HomePage.tsx.example +2 -2
  78. package/templates/app-vite/src/themes.css.example +109 -79
  79. package/templates/app-vite/vercel.json.example +11 -0
  80. package/templates/functions-firebase/README.md.example +1 -1
  81. package/templates/functions-firebase/build.mjs.example +2 -72
  82. package/templates/functions-firebase/functions-firebase/.env.example.example +24 -26
  83. package/templates/functions-firebase/functions-firebase/README.md.example +1 -1
  84. package/templates/functions-firebase/functions-firebase/build.mjs.example +2 -72
  85. package/templates/functions-firebase/functions-firebase/tsconfig.json.example +1 -1
  86. package/templates/functions-firebase/functions.config.js.example +1 -1
  87. package/templates/functions-supabase/supabase/config.toml.example +59 -0
  88. package/templates/functions-supabase/supabase/functions/.env.example +13 -0
  89. package/templates/functions-supabase/supabase/functions/cancel-subscription/index.ts.example +7 -0
  90. package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +11 -0
  91. package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +11 -0
  92. package/templates/functions-supabase/supabase/functions/create-customer-portal/index.ts.example +7 -0
  93. package/templates/functions-supabase/supabase/functions/crud/index.ts.example +16 -0
  94. package/templates/functions-supabase/supabase/functions/delete-account/index.ts.example +7 -0
  95. package/templates/functions-supabase/supabase/functions/deno.json.example +8 -0
  96. package/templates/functions-supabase/supabase/functions/get-custom-claims/index.ts.example +7 -0
  97. package/templates/functions-supabase/supabase/functions/get-user-auth-status/index.ts.example +7 -0
  98. package/templates/functions-supabase/supabase/functions/refresh-subscription-status/index.ts.example +7 -0
  99. package/templates/functions-supabase/supabase/functions/remove-custom-claims/index.ts.example +7 -0
  100. package/templates/functions-supabase/supabase/functions/set-custom-claims/index.ts.example +7 -0
  101. package/templates/functions-supabase/supabase/migrations/20250101000000_idempotency.sql +24 -0
  102. package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +22 -0
  103. package/templates/functions-supabase/supabase/migrations/20250101000002_cleanup_jobs.sql +28 -0
  104. package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +28 -0
  105. package/templates/functions-vercel/functions-vercel/tsconfig.json.example +1 -1
  106. package/templates/functions-vercel/functions-vercel/vercel.json.example +1 -1
  107. package/templates/functions-vercel/vercel.json.example +1 -1
  108. package/templates/github/github/workflows/firebase-deploy.yml.example +1 -1
  109. package/templates/github/workflows/firebase-deploy.yml.example +1 -1
  110. package/templates/overlay-firebase/env.fragment.example +34 -0
  111. package/templates/overlay-firebase/env.fragment.expo.example +34 -0
  112. package/templates/overlay-firebase/env.fragment.nextjs.example +34 -0
  113. package/templates/overlay-firebase/src/config/providers.expo.ts.example +49 -0
  114. package/templates/overlay-firebase/src/config/providers.ts.example +23 -0
  115. package/templates/overlay-supabase/env.fragment.example +12 -0
  116. package/templates/overlay-supabase/env.fragment.expo.example +12 -0
  117. package/templates/overlay-supabase/env.fragment.nextjs.example +12 -0
  118. package/templates/overlay-supabase/src/config/providers.expo.ts.example +35 -0
  119. package/templates/overlay-supabase/src/config/providers.ts.example +33 -0
  120. package/templates/overlay-supabase/vercel.headers.example +23 -0
  121. package/templates/overlay-supabase/vercel.json.example +22 -0
  122. package/templates/overlay-vercel/env.fragment.example +34 -0
  123. package/templates/overlay-vercel/env.fragment.nextjs.example +34 -0
  124. package/templates/overlay-vercel/src/config/providers.ts.example +24 -0
  125. package/templates/root-consumer/.claude/agents/architect.md.example +2 -310
  126. package/templates/root-consumer/.claude/agents/builder.md.example +2 -326
  127. package/templates/root-consumer/.claude/agents/coder.md.example +2 -83
  128. package/templates/root-consumer/.claude/agents/extractor.md.example +2 -231
  129. package/templates/root-consumer/.claude/agents/polisher.md.example +2 -132
  130. package/templates/root-consumer/.claude/agents/prompt-engineer.md.example +2 -81
  131. package/templates/root-consumer/.claude/commands/grill.md.example +30 -0
  132. package/templates/root-consumer/.claude/commands/techdebt.md.example +28 -0
  133. package/templates/root-consumer/.clinerules.example +1 -0
  134. package/templates/root-consumer/.cursor/rules/no-docs.mdc.example +15 -0
  135. package/templates/root-consumer/.cursorrules.example +1 -0
  136. package/templates/root-consumer/.github/copilot-instructions.md.example +1 -0
  137. package/templates/root-consumer/.windsurfrules.example +1 -0
  138. package/templates/root-consumer/AI.md.example +44 -123
  139. package/templates/root-consumer/CLAUDE.md.example +1 -134
  140. package/templates/root-consumer/CONVENTIONS.md.example +1 -0
  141. package/templates/root-consumer/GEMINI.md.example +1 -0
  142. package/templates/root-consumer/firebase.json.example +1 -1
  143. package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +22 -2
  144. package/templates/root-consumer/guides/dndev/COMPONENTS_ADV.md.example +0 -18
  145. package/templates/root-consumer/guides/dndev/COMPONENTS_UI.md.example +1 -1
  146. package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +101 -32
  147. package/templates/root-consumer/guides/dndev/INDEX.md.example +4 -2
  148. package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +3 -3
  149. package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +241 -12
  150. package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +13 -7
  151. package/templates/root-consumer/guides/dndev/SETUP_OAUTH_PROVIDERS.md.example +60 -0
  152. package/templates/root-consumer/guides/dndev/SETUP_SOC2.md.example +234 -0
  153. package/templates/root-consumer/guides/dndev/SETUP_STRIPE.md.example +62 -0
  154. package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +124 -0
  155. package/templates/root-consumer/guides/dndev/SETUP_THEMES.md.example +6 -2
  156. package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +176 -0
  157. package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +5 -9
  158. package/templates/root-consumer/guides/dndev/essences_reference.css.example +174 -0
  159. package/templates/root-consumer/guides/wai-way/WAI_WAY_CLI.md.example +7 -8
  160. package/templates/root-consumer/guides/wai-way/agents/builder.md.example +10 -0
  161. package/templates/root-consumer/guides/wai-way/agents/extractor.md.example +25 -5
  162. package/templates/root-consumer/guides/wai-way/agents/polisher.md.example +13 -2
  163. package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +2 -2
  164. package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +55 -15
  165. package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +15 -4
  166. package/templates/root-consumer/guides/wai-way/spec_template.md.example +7 -6
  167. package/dist/bin/commands/lint.d.ts +0 -11
  168. package/dist/bin/commands/lint.d.ts.map +0 -1
  169. package/dist/bin/commands/lint.js.map +0 -1
  170. package/dist/bin/commands/staging.d.ts +0 -11
  171. package/dist/bin/commands/staging.d.ts.map +0 -1
  172. package/dist/bin/commands/staging.js +0 -12
  173. package/dist/bin/commands/staging.js.map +0 -1
  174. package/templates/app-payload/.env.example +0 -28
  175. package/templates/app-payload/README.md.example +0 -233
  176. package/templates/app-payload/collections/Company.ts.example +0 -125
  177. package/templates/app-payload/collections/Hero.ts.example +0 -62
  178. package/templates/app-payload/collections/Media.ts.example +0 -41
  179. package/templates/app-payload/collections/Products.ts.example +0 -115
  180. package/templates/app-payload/collections/Services.ts.example +0 -104
  181. package/templates/app-payload/collections/Testimonials.ts.example +0 -92
  182. package/templates/app-payload/collections/Users.ts.example +0 -35
  183. package/templates/app-payload/src/server.ts.example +0 -79
  184. package/templates/app-payload/tsconfig.json.example +0 -24
@@ -0,0 +1,2049 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __esm = (fn, res) => function __init() {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ };
10
+ var __commonJS = (cb, mod) => function __require() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+ var __export = (target, all) => {
14
+ for (var name in all)
15
+ __defProp(target, name, { get: all[name], enumerable: true });
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from))
20
+ if (!__hasOwnProp.call(to, key) && key !== except)
21
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
+ }
23
+ return to;
24
+ };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
+ // If the importer is in node compatibility mode or this is not an ESM
27
+ // file that has been converted to a CommonJS file using a Babel-
28
+ // compatible transform (i.e. "__esModule" has not been set), then set
29
+ // "default" to the CommonJS "module.exports" for node compatibility.
30
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
+ mod
32
+ ));
33
+
34
+ // node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
35
+ var require_src = __commonJS({
36
+ "node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
37
+ "use strict";
38
+ init_utils();
39
+ var ESC = "\x1B";
40
+ var CSI = `${ESC}[`;
41
+ var beep = "\x07";
42
+ var cursor = {
43
+ to(x3, y2) {
44
+ if (!y2) return `${CSI}${x3 + 1}G`;
45
+ return `${CSI}${y2 + 1};${x3 + 1}H`;
46
+ },
47
+ move(x3, y2) {
48
+ let ret = "";
49
+ if (x3 < 0) ret += `${CSI}${-x3}D`;
50
+ else if (x3 > 0) ret += `${CSI}${x3}C`;
51
+ if (y2 < 0) ret += `${CSI}${-y2}A`;
52
+ else if (y2 > 0) ret += `${CSI}${y2}B`;
53
+ return ret;
54
+ },
55
+ up: (count = 1) => `${CSI}${count}A`,
56
+ down: (count = 1) => `${CSI}${count}B`,
57
+ forward: (count = 1) => `${CSI}${count}C`,
58
+ backward: (count = 1) => `${CSI}${count}D`,
59
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
60
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
61
+ left: `${CSI}G`,
62
+ hide: `${CSI}?25l`,
63
+ show: `${CSI}?25h`,
64
+ save: `${ESC}7`,
65
+ restore: `${ESC}8`
66
+ };
67
+ var scroll = {
68
+ up: (count = 1) => `${CSI}S`.repeat(count),
69
+ down: (count = 1) => `${CSI}T`.repeat(count)
70
+ };
71
+ var erase = {
72
+ screen: `${CSI}2J`,
73
+ up: (count = 1) => `${CSI}1J`.repeat(count),
74
+ down: (count = 1) => `${CSI}J`.repeat(count),
75
+ line: `${CSI}2K`,
76
+ lineEnd: `${CSI}K`,
77
+ lineStart: `${CSI}1K`,
78
+ lines(count) {
79
+ let clear = "";
80
+ for (let i = 0; i < count; i++)
81
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
82
+ if (count)
83
+ clear += cursor.left;
84
+ return clear;
85
+ }
86
+ };
87
+ module.exports = { cursor, scroll, erase, beep };
88
+ }
89
+ });
90
+
91
+ // node_modules/.bun/picocolors@1.1.1/node_modules/picocolors/picocolors.js
92
+ var require_picocolors = __commonJS({
93
+ "node_modules/.bun/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
94
+ init_utils();
95
+ var p = process || {};
96
+ var argv = p.argv || [];
97
+ var env = p.env || {};
98
+ var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
99
+ var formatter = (open, close, replace = open) => (input) => {
100
+ let string = "" + input, index = string.indexOf(close, open.length);
101
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
102
+ };
103
+ var replaceClose = (string, close, replace, index) => {
104
+ let result = "", cursor = 0;
105
+ do {
106
+ result += string.substring(cursor, index) + replace;
107
+ cursor = index + close.length;
108
+ index = string.indexOf(close, cursor);
109
+ } while (~index);
110
+ return result + string.substring(cursor);
111
+ };
112
+ var createColors = (enabled = isColorSupported) => {
113
+ let f = enabled ? formatter : () => String;
114
+ return {
115
+ isColorSupported: enabled,
116
+ reset: f("\x1B[0m", "\x1B[0m"),
117
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
118
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
119
+ italic: f("\x1B[3m", "\x1B[23m"),
120
+ underline: f("\x1B[4m", "\x1B[24m"),
121
+ inverse: f("\x1B[7m", "\x1B[27m"),
122
+ hidden: f("\x1B[8m", "\x1B[28m"),
123
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
124
+ black: f("\x1B[30m", "\x1B[39m"),
125
+ red: f("\x1B[31m", "\x1B[39m"),
126
+ green: f("\x1B[32m", "\x1B[39m"),
127
+ yellow: f("\x1B[33m", "\x1B[39m"),
128
+ blue: f("\x1B[34m", "\x1B[39m"),
129
+ magenta: f("\x1B[35m", "\x1B[39m"),
130
+ cyan: f("\x1B[36m", "\x1B[39m"),
131
+ white: f("\x1B[37m", "\x1B[39m"),
132
+ gray: f("\x1B[90m", "\x1B[39m"),
133
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
134
+ bgRed: f("\x1B[41m", "\x1B[49m"),
135
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
136
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
137
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
138
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
139
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
140
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
141
+ blackBright: f("\x1B[90m", "\x1B[39m"),
142
+ redBright: f("\x1B[91m", "\x1B[39m"),
143
+ greenBright: f("\x1B[92m", "\x1B[39m"),
144
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
145
+ blueBright: f("\x1B[94m", "\x1B[39m"),
146
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
147
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
148
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
149
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
150
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
151
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
152
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
153
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
154
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
155
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
156
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
157
+ };
158
+ };
159
+ module.exports = createColors();
160
+ module.exports.createColors = createColors;
161
+ }
162
+ });
163
+
164
+ // packages/tooling/src/bundler/utils.ts
165
+ import { Buffer as Buffer2 } from "node:buffer";
166
+ import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
167
+ import { createRequire } from "node:module";
168
+ import { dirname, resolve } from "node:path";
169
+ import process from "node:process";
170
+ import { fileURLToPath } from "node:url";
171
+ var require2, __filename, __dirname;
172
+ var init_utils = __esm({
173
+ "packages/tooling/src/bundler/utils.ts"() {
174
+ "use strict";
175
+ require2 = createRequire(import.meta.url);
176
+ __filename = fileURLToPath(import.meta.url);
177
+ __dirname = dirname(__filename);
178
+ if (typeof globalThis !== "undefined") {
179
+ globalThis.require = require2;
180
+ globalThis.__filename = __filename;
181
+ globalThis.__dirname = __dirname;
182
+ globalThis.Buffer = Buffer2;
183
+ globalThis.process = process;
184
+ if (typeof global === "undefined") {
185
+ globalThis.global = globalThis;
186
+ }
187
+ }
188
+ }
189
+ });
190
+
191
+ // node_modules/.bun/@clack+core@1.0.1/node_modules/@clack/core/dist/index.mjs
192
+ import { stdout as R, stdin as q } from "node:process";
193
+ import * as k from "node:readline";
194
+ import ot from "node:readline";
195
+ import { ReadStream as J } from "node:tty";
196
+ function B(t, e2, s) {
197
+ if (!s.some((u) => !u.disabled)) return t;
198
+ const i = t + e2, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
199
+ return s[n].disabled ? B(n, e2 < 0 ? -1 : 1, s) : n;
200
+ }
201
+ function K(t, e2, s) {
202
+ return String(t).normalize().replaceAll(`\r
203
+ `, `
204
+ `).split(`
205
+ `).map((i) => Et(i, e2, s)).join(`
206
+ `);
207
+ }
208
+ function It(t) {
209
+ if (t.aliases !== void 0) {
210
+ const e2 = t.aliases;
211
+ for (const s in e2) {
212
+ if (!Object.hasOwn(e2, s)) continue;
213
+ const i = e2[s];
214
+ _.actions.has(i) && (_.aliases.has(s) || _.aliases.set(s, i));
215
+ }
216
+ }
217
+ if (t.messages !== void 0) {
218
+ const e2 = t.messages;
219
+ e2.cancel !== void 0 && (_.messages.cancel = e2.cancel), e2.error !== void 0 && (_.messages.error = e2.error);
220
+ }
221
+ t.withGuide !== void 0 && (_.withGuide = t.withGuide !== false);
222
+ }
223
+ function H(t, e2) {
224
+ if (typeof t == "string") return _.aliases.get(t) === e2;
225
+ for (const s of t) if (s !== void 0 && H(s, e2)) return true;
226
+ return false;
227
+ }
228
+ function _t(t, e2) {
229
+ if (t === e2) return;
230
+ const s = t.split(`
231
+ `), i = e2.split(`
232
+ `), r = Math.max(s.length, i.length), n = [];
233
+ for (let u = 0; u < r; u++) s[u] !== i[u] && n.push(u);
234
+ return { lines: n, numLinesBefore: s.length, numLinesAfter: i.length, numLines: r };
235
+ }
236
+ function Ct(t) {
237
+ return t === z;
238
+ }
239
+ function T(t, e2) {
240
+ const s = t;
241
+ s.isTTY && s.setRawMode(e2);
242
+ }
243
+ function Bt({ input: t = q, output: e2 = R, overwrite: s = true, hideCursor: i = true } = {}) {
244
+ const r = k.createInterface({ input: t, output: e2, prompt: "", tabSize: 1 });
245
+ k.emitKeypressEvents(t, r), t instanceof J && t.isTTY && t.setRawMode(true);
246
+ const n = (u, { name: a, sequence: l }) => {
247
+ const E = String(u);
248
+ if (H([E, a, l], "cancel")) {
249
+ i && e2.write(import_sisteransi.cursor.show), process.exit(0);
250
+ return;
251
+ }
252
+ if (!s) return;
253
+ const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
254
+ k.moveCursor(e2, g, m, () => {
255
+ k.clearLine(e2, 1, () => {
256
+ t.once("keypress", n);
257
+ });
258
+ });
259
+ };
260
+ return i && e2.write(import_sisteransi.cursor.hide), t.once("keypress", n), () => {
261
+ t.off("keypress", n), i && e2.write(import_sisteransi.cursor.show), t instanceof J && t.isTTY && !bt && t.setRawMode(false), r.terminal = false, r.close();
262
+ };
263
+ }
264
+ function xt(t, e2, s, i = s) {
265
+ const r = rt(t ?? R);
266
+ return K(e2, r - s.length, { hard: true, trim: false }).split(`
267
+ `).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
268
+ `);
269
+ }
270
+ function wt(t, e2) {
271
+ if (t === void 0 || e2.length === 0) return 0;
272
+ const s = e2.findIndex((i) => i.value === t);
273
+ return s !== -1 ? s : 0;
274
+ }
275
+ function Dt(t, e2) {
276
+ return (e2.label ?? String(e2.value)).toLowerCase().includes(t.toLowerCase());
277
+ }
278
+ function St(t, e2) {
279
+ if (e2) return t ? e2 : e2[0];
280
+ }
281
+ var import_picocolors, import_sisteransi, at, lt, ht, O, y, L, P, M, ct, ft, X, pt, S, W, Z, Ft, j, Q, dt, tt, U, et, mt, st, it, gt, G, vt, Et, At, _, bt, z, rt, nt, x, Vt, kt, yt, Lt, Mt, Wt, Tt, $t;
282
+ var init_dist = __esm({
283
+ "node_modules/.bun/@clack+core@1.0.1/node_modules/@clack/core/dist/index.mjs"() {
284
+ init_utils();
285
+ import_picocolors = __toESM(require_picocolors(), 1);
286
+ import_sisteransi = __toESM(require_src(), 1);
287
+ at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109;
288
+ lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
289
+ ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141;
290
+ O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
291
+ y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
292
+ L = /\t{1,1000}/y;
293
+ P = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
294
+ M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
295
+ ct = new RegExp("\\p{M}+", "gu");
296
+ ft = { limit: 1 / 0, ellipsis: "" };
297
+ X = (t, e2 = {}, s = {}) => {
298
+ const i = e2.limit ?? 1 / 0, r = e2.ellipsis ?? "", n = e2?.ellipsisWidth ?? (r ? X(r, ft, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V2 = s.wideWidth ?? 2;
299
+ let h = 0, o = 0, p = t.length, v = 0, F = false, d2 = p, b = Math.max(0, i - n), C2 = 0, w = 0, c = 0, f = 0;
300
+ t: for (; ; ) {
301
+ if (w > C2 || o >= p && o > h) {
302
+ const ut2 = t.slice(C2, w) || t.slice(h, o);
303
+ v = 0;
304
+ for (const Y of ut2.replaceAll(ct, "")) {
305
+ const $ = Y.codePointAt(0) || 0;
306
+ if (lt($) ? f = m : ht($) ? f = V2 : E !== A && at($) ? f = E : f = A, c + f > b && (d2 = Math.min(d2, Math.max(C2, h) + v)), c + f > i) {
307
+ F = true;
308
+ break t;
309
+ }
310
+ v += Y.length, c += f;
311
+ }
312
+ C2 = w = 0;
313
+ }
314
+ if (o >= p) break;
315
+ if (M.lastIndex = o, M.test(t)) {
316
+ if (v = M.lastIndex - o, f = v * A, c + f > b && (d2 = Math.min(d2, o + Math.floor((b - c) / A))), c + f > i) {
317
+ F = true;
318
+ break;
319
+ }
320
+ c += f, C2 = h, w = o, o = h = M.lastIndex;
321
+ continue;
322
+ }
323
+ if (O.lastIndex = o, O.test(t)) {
324
+ if (c + u > b && (d2 = Math.min(d2, o)), c + u > i) {
325
+ F = true;
326
+ break;
327
+ }
328
+ c += u, C2 = h, w = o, o = h = O.lastIndex;
329
+ continue;
330
+ }
331
+ if (y.lastIndex = o, y.test(t)) {
332
+ if (v = y.lastIndex - o, f = v * a, c + f > b && (d2 = Math.min(d2, o + Math.floor((b - c) / a))), c + f > i) {
333
+ F = true;
334
+ break;
335
+ }
336
+ c += f, C2 = h, w = o, o = h = y.lastIndex;
337
+ continue;
338
+ }
339
+ if (L.lastIndex = o, L.test(t)) {
340
+ if (v = L.lastIndex - o, f = v * l, c + f > b && (d2 = Math.min(d2, o + Math.floor((b - c) / l))), c + f > i) {
341
+ F = true;
342
+ break;
343
+ }
344
+ c += f, C2 = h, w = o, o = h = L.lastIndex;
345
+ continue;
346
+ }
347
+ if (P.lastIndex = o, P.test(t)) {
348
+ if (c + g > b && (d2 = Math.min(d2, o)), c + g > i) {
349
+ F = true;
350
+ break;
351
+ }
352
+ c += g, C2 = h, w = o, o = h = P.lastIndex;
353
+ continue;
354
+ }
355
+ o += 1;
356
+ }
357
+ return { width: F ? b : c, index: F ? d2 : p, truncated: F, ellipsed: F && i >= n };
358
+ };
359
+ pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
360
+ S = (t, e2 = {}) => X(t, pt, e2).width;
361
+ W = "\x1B";
362
+ Z = "\x9B";
363
+ Ft = 39;
364
+ j = "\x07";
365
+ Q = "[";
366
+ dt = "]";
367
+ tt = "m";
368
+ U = `${dt}8;;`;
369
+ et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
370
+ mt = (t) => {
371
+ if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
372
+ if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
373
+ if (t === 1 || t === 2) return 22;
374
+ if (t === 3) return 23;
375
+ if (t === 4) return 24;
376
+ if (t === 7) return 27;
377
+ if (t === 8) return 28;
378
+ if (t === 9) return 29;
379
+ if (t === 0) return 0;
380
+ };
381
+ st = (t) => `${W}${Q}${t}${tt}`;
382
+ it = (t) => `${W}${U}${t}${j}`;
383
+ gt = (t) => t.map((e2) => S(e2));
384
+ G = (t, e2, s) => {
385
+ const i = e2[Symbol.iterator]();
386
+ let r = false, n = false, u = t.at(-1), a = u === void 0 ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
387
+ for (; !l.done; ) {
388
+ const m = l.value, A = S(m);
389
+ a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === W || m === Z) && (r = true, n = e2.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
390
+ }
391
+ u = t.at(-1), !a && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
392
+ };
393
+ vt = (t) => {
394
+ const e2 = t.split(" ");
395
+ let s = e2.length;
396
+ for (; s > 0 && !(S(e2[s - 1]) > 0); ) s--;
397
+ return s === e2.length ? t : e2.slice(0, s).join(" ") + e2.slice(s).join("");
398
+ };
399
+ Et = (t, e2, s = {}) => {
400
+ if (s.trim !== false && t.trim() === "") return "";
401
+ let i = "", r, n;
402
+ const u = t.split(" "), a = gt(u);
403
+ let l = [""];
404
+ for (const [h, o] of u.entries()) {
405
+ s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
406
+ let p = S(l.at(-1) ?? "");
407
+ if (h !== 0 && (p >= e2 && (s.wordWrap === false || s.trim === false) && (l.push(""), p = 0), (p > 0 || s.trim === false) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e2) {
408
+ const v = e2 - p, F = 1 + Math.floor((a[h] - v - 1) / e2);
409
+ Math.floor((a[h] - 1) / e2) < F && l.push(""), G(l, o, e2);
410
+ continue;
411
+ }
412
+ if (p + a[h] > e2 && p > 0 && a[h] > 0) {
413
+ if (s.wordWrap === false && p < e2) {
414
+ G(l, o, e2);
415
+ continue;
416
+ }
417
+ l.push("");
418
+ }
419
+ if (p + a[h] > e2 && s.wordWrap === false) {
420
+ G(l, o, e2);
421
+ continue;
422
+ }
423
+ l[l.length - 1] += o;
424
+ }
425
+ s.trim !== false && (l = l.map((h) => vt(h)));
426
+ const E = l.join(`
427
+ `), g = E[Symbol.iterator]();
428
+ let m = g.next(), A = g.next(), V2 = 0;
429
+ for (; !m.done; ) {
430
+ const h = m.value, o = A.value;
431
+ if (i += h, h === W || h === Z) {
432
+ et.lastIndex = V2 + 1;
433
+ const F = et.exec(E)?.groups;
434
+ if (F?.code !== void 0) {
435
+ const d2 = Number.parseFloat(F.code);
436
+ r = d2 === Ft ? void 0 : d2;
437
+ } else F?.uri !== void 0 && (n = F.uri.length === 0 ? void 0 : F.uri);
438
+ }
439
+ const p = r ? mt(r) : void 0;
440
+ o === `
441
+ ` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
442
+ ` && (r && p && (i += st(r)), n && (i += it(n))), V2 += h.length, m = A, A = g.next();
443
+ }
444
+ return i;
445
+ };
446
+ At = ["up", "down", "left", "right", "space", "enter", "cancel"];
447
+ _ = { actions: new Set(At), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
448
+ bt = globalThis.process.platform.startsWith("win");
449
+ z = /* @__PURE__ */ Symbol("clack:cancel");
450
+ rt = (t) => "columns" in t && typeof t.columns == "number" ? t.columns : 80;
451
+ nt = (t) => "rows" in t && typeof t.rows == "number" ? t.rows : 20;
452
+ x = class {
453
+ input;
454
+ output;
455
+ _abortSignal;
456
+ rl;
457
+ opts;
458
+ _render;
459
+ _track = false;
460
+ _prevFrame = "";
461
+ _subscribers = /* @__PURE__ */ new Map();
462
+ _cursor = 0;
463
+ state = "initial";
464
+ error = "";
465
+ value;
466
+ userInput = "";
467
+ constructor(e2, s = true) {
468
+ const { input: i = q, output: r = R, render: n, signal: u, ...a } = e2;
469
+ this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r;
470
+ }
471
+ unsubscribe() {
472
+ this._subscribers.clear();
473
+ }
474
+ setSubscriber(e2, s) {
475
+ const i = this._subscribers.get(e2) ?? [];
476
+ i.push(s), this._subscribers.set(e2, i);
477
+ }
478
+ on(e2, s) {
479
+ this.setSubscriber(e2, { cb: s });
480
+ }
481
+ once(e2, s) {
482
+ this.setSubscriber(e2, { cb: s, once: true });
483
+ }
484
+ emit(e2, ...s) {
485
+ const i = this._subscribers.get(e2) ?? [], r = [];
486
+ for (const n of i) n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
487
+ for (const n of r) n();
488
+ }
489
+ prompt() {
490
+ return new Promise((e2) => {
491
+ if (this._abortSignal) {
492
+ if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e2(z);
493
+ this._abortSignal.addEventListener("abort", () => {
494
+ this.state = "cancel", this.close();
495
+ }, { once: true });
496
+ }
497
+ this.rl = ot.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), T(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
498
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e2(this.value);
499
+ }), this.once("cancel", () => {
500
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e2(z);
501
+ });
502
+ });
503
+ }
504
+ _isActionKey(e2, s) {
505
+ return e2 === " ";
506
+ }
507
+ _setValue(e2) {
508
+ this.value = e2, this.emit("value", this.value);
509
+ }
510
+ _setUserInput(e2, s) {
511
+ this.userInput = e2 ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
512
+ }
513
+ _clearUserInput() {
514
+ this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
515
+ }
516
+ onKeypress(e2, s) {
517
+ if (this._track && s.name !== "return" && (s.name && this._isActionKey(e2, s) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && _.aliases.has(s.name) && this.emit("cursor", _.aliases.get(s.name)), _.actions.has(s.name) && this.emit("cursor", s.name)), e2 && (e2.toLowerCase() === "y" || e2.toLowerCase() === "n") && this.emit("confirm", e2.toLowerCase() === "y"), this.emit("key", e2?.toLowerCase(), s), s?.name === "return") {
518
+ if (this.opts.validate) {
519
+ const i = this.opts.validate(this.value);
520
+ i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
521
+ }
522
+ this.state !== "error" && (this.state = "submit");
523
+ }
524
+ H([e2, s?.name, s?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
525
+ }
526
+ close() {
527
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
528
+ `), T(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
529
+ }
530
+ restoreCursor() {
531
+ const e2 = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
532
+ `).length - 1;
533
+ this.output.write(import_sisteransi.cursor.move(-999, e2 * -1));
534
+ }
535
+ render() {
536
+ const e2 = K(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
537
+ if (e2 !== this._prevFrame) {
538
+ if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
539
+ else {
540
+ const s = _t(this._prevFrame, e2), i = nt(this.output);
541
+ if (this.restoreCursor(), s) {
542
+ const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
543
+ let u = s.lines.find((a) => a >= r);
544
+ if (u === void 0) {
545
+ this._prevFrame = e2;
546
+ return;
547
+ }
548
+ if (s.lines.length === 1) {
549
+ this.output.write(import_sisteransi.cursor.move(0, u - n)), this.output.write(import_sisteransi.erase.lines(1));
550
+ const a = e2.split(`
551
+ `);
552
+ this.output.write(a[u]), this._prevFrame = e2, this.output.write(import_sisteransi.cursor.move(0, a.length - u - 1));
553
+ return;
554
+ } else if (s.lines.length > 1) {
555
+ if (r < n) u = r;
556
+ else {
557
+ const l = u - n;
558
+ l > 0 && this.output.write(import_sisteransi.cursor.move(0, l));
559
+ }
560
+ this.output.write(import_sisteransi.erase.down());
561
+ const a = e2.split(`
562
+ `).slice(u);
563
+ this.output.write(a.join(`
564
+ `)), this._prevFrame = e2;
565
+ return;
566
+ }
567
+ }
568
+ this.output.write(import_sisteransi.erase.down());
569
+ }
570
+ this.output.write(e2), this.state === "initial" && (this.state = "active"), this._prevFrame = e2;
571
+ }
572
+ }
573
+ };
574
+ Vt = class extends x {
575
+ filteredOptions;
576
+ multiple;
577
+ isNavigating = false;
578
+ selectedValues = [];
579
+ focusedValue;
580
+ #t = 0;
581
+ #s = "";
582
+ #i;
583
+ #e;
584
+ get cursor() {
585
+ return this.#t;
586
+ }
587
+ get userInputWithCursor() {
588
+ if (!this.userInput) return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
589
+ if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
590
+ const e2 = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
591
+ return `${e2}${import_picocolors.default.inverse(s)}${i.join("")}`;
592
+ }
593
+ get options() {
594
+ return typeof this.#e == "function" ? this.#e() : this.#e;
595
+ }
596
+ constructor(e2) {
597
+ super(e2), this.#e = e2.options;
598
+ const s = this.options;
599
+ this.filteredOptions = [...s], this.multiple = e2.multiple === true, this.#i = e2.filter ?? Dt;
600
+ let i;
601
+ if (e2.initialValue && Array.isArray(e2.initialValue) ? this.multiple ? i = e2.initialValue : i = e2.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i) for (const r of i) {
602
+ const n = s.findIndex((u) => u.value === r);
603
+ n !== -1 && (this.toggleSelected(r), this.#t = n);
604
+ }
605
+ this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
606
+ }
607
+ _isActionKey(e2, s) {
608
+ return e2 === " " || this.multiple && this.isNavigating && s.name === "space" && e2 !== void 0 && e2 !== "";
609
+ }
610
+ #r(e2, s) {
611
+ const i = s.name === "up", r = s.name === "down", n = s.name === "return";
612
+ i || r ? (this.#t = B(this.#t, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = St(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== void 0 && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
613
+ }
614
+ deselectAll() {
615
+ this.selectedValues = [];
616
+ }
617
+ toggleSelected(e2) {
618
+ this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e2) ? this.selectedValues = this.selectedValues.filter((s) => s !== e2) : this.selectedValues = [...this.selectedValues, e2] : this.selectedValues = [e2]);
619
+ }
620
+ #n(e2) {
621
+ if (e2 !== this.#s) {
622
+ this.#s = e2;
623
+ const s = this.options;
624
+ e2 ? this.filteredOptions = s.filter((n) => this.#i(e2, n)) : this.filteredOptions = [...s];
625
+ const i = wt(this.focusedValue, this.filteredOptions);
626
+ this.#t = B(i, 0, this.filteredOptions);
627
+ const r = this.filteredOptions[this.#t];
628
+ r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = void 0, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
629
+ }
630
+ }
631
+ };
632
+ kt = class extends x {
633
+ get cursor() {
634
+ return this.value ? 0 : 1;
635
+ }
636
+ get _value() {
637
+ return this.cursor === 0;
638
+ }
639
+ constructor(e2) {
640
+ super(e2, false), this.value = !!e2.initialValue, this.on("userInput", () => {
641
+ this.value = this._value;
642
+ }), this.on("confirm", (s) => {
643
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
644
+ }), this.on("cursor", () => {
645
+ this.value = !this.value;
646
+ });
647
+ }
648
+ };
649
+ yt = class extends x {
650
+ options;
651
+ cursor = 0;
652
+ #t;
653
+ getGroupItems(e2) {
654
+ return this.options.filter((s) => s.group === e2);
655
+ }
656
+ isGroupSelected(e2) {
657
+ const s = this.getGroupItems(e2), i = this.value;
658
+ return i === void 0 ? false : s.every((r) => i.includes(r.value));
659
+ }
660
+ toggleValue() {
661
+ const e2 = this.options[this.cursor];
662
+ if (this.value === void 0 && (this.value = []), e2.group === true) {
663
+ const s = e2.value, i = this.getGroupItems(s);
664
+ this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
665
+ } else {
666
+ const s = this.value.includes(e2.value);
667
+ this.value = s ? this.value.filter((i) => i !== e2.value) : [...this.value, e2.value];
668
+ }
669
+ }
670
+ constructor(e2) {
671
+ super(e2, false);
672
+ const { options: s } = e2;
673
+ this.#t = e2.selectableGroups !== false, this.options = Object.entries(s).flatMap(([i, r]) => [{ value: i, group: true, label: i }, ...r.map((n) => ({ ...n, group: i }))]), this.value = [...e2.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e2.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
674
+ switch (i) {
675
+ case "left":
676
+ case "up": {
677
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
678
+ const r = this.options[this.cursor]?.group === true;
679
+ !this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
680
+ break;
681
+ }
682
+ case "down":
683
+ case "right": {
684
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
685
+ const r = this.options[this.cursor]?.group === true;
686
+ !this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
687
+ break;
688
+ }
689
+ case "space":
690
+ this.toggleValue();
691
+ break;
692
+ }
693
+ });
694
+ }
695
+ };
696
+ Lt = class extends x {
697
+ options;
698
+ cursor = 0;
699
+ get _value() {
700
+ return this.options[this.cursor].value;
701
+ }
702
+ get _enabledOptions() {
703
+ return this.options.filter((e2) => e2.disabled !== true);
704
+ }
705
+ toggleAll() {
706
+ const e2 = this._enabledOptions, s = this.value !== void 0 && this.value.length === e2.length;
707
+ this.value = s ? [] : e2.map((i) => i.value);
708
+ }
709
+ toggleInvert() {
710
+ const e2 = this.value;
711
+ if (!e2) return;
712
+ const s = this._enabledOptions.filter((i) => !e2.includes(i.value));
713
+ this.value = s.map((i) => i.value);
714
+ }
715
+ toggleValue() {
716
+ this.value === void 0 && (this.value = []);
717
+ const e2 = this.value.includes(this._value);
718
+ this.value = e2 ? this.value.filter((s) => s !== this._value) : [...this.value, this._value];
719
+ }
720
+ constructor(e2) {
721
+ super(e2, false), this.options = e2.options, this.value = [...e2.initialValues ?? []];
722
+ const s = Math.max(this.options.findIndex(({ value: i }) => i === e2.cursorAt), 0);
723
+ this.cursor = this.options[s].disabled ? B(s, 1, this.options) : s, this.on("key", (i) => {
724
+ i === "a" && this.toggleAll(), i === "i" && this.toggleInvert();
725
+ }), this.on("cursor", (i) => {
726
+ switch (i) {
727
+ case "left":
728
+ case "up":
729
+ this.cursor = B(this.cursor, -1, this.options);
730
+ break;
731
+ case "down":
732
+ case "right":
733
+ this.cursor = B(this.cursor, 1, this.options);
734
+ break;
735
+ case "space":
736
+ this.toggleValue();
737
+ break;
738
+ }
739
+ });
740
+ }
741
+ };
742
+ Mt = class extends x {
743
+ _mask = "\u2022";
744
+ get cursor() {
745
+ return this._cursor;
746
+ }
747
+ get masked() {
748
+ return this.userInput.replaceAll(/./g, this._mask);
749
+ }
750
+ get userInputWithCursor() {
751
+ if (this.state === "submit" || this.state === "cancel") return this.masked;
752
+ const e2 = this.userInput;
753
+ if (this.cursor >= e2.length) return `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
754
+ const s = this.masked, i = s.slice(0, this.cursor), r = s.slice(this.cursor);
755
+ return `${i}${import_picocolors.default.inverse(r[0])}${r.slice(1)}`;
756
+ }
757
+ clear() {
758
+ this._clearUserInput();
759
+ }
760
+ constructor({ mask: e2, ...s }) {
761
+ super(s), this._mask = e2 ?? "\u2022", this.on("userInput", (i) => {
762
+ this._setValue(i);
763
+ });
764
+ }
765
+ };
766
+ Wt = class extends x {
767
+ options;
768
+ cursor = 0;
769
+ get _selectedValue() {
770
+ return this.options[this.cursor];
771
+ }
772
+ changeValue() {
773
+ this.value = this._selectedValue.value;
774
+ }
775
+ constructor(e2) {
776
+ super(e2, false), this.options = e2.options;
777
+ const s = this.options.findIndex(({ value: r }) => r === e2.initialValue), i = s === -1 ? 0 : s;
778
+ this.cursor = this.options[i].disabled ? B(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
779
+ switch (r) {
780
+ case "left":
781
+ case "up":
782
+ this.cursor = B(this.cursor, -1, this.options);
783
+ break;
784
+ case "down":
785
+ case "right":
786
+ this.cursor = B(this.cursor, 1, this.options);
787
+ break;
788
+ }
789
+ this.changeValue();
790
+ });
791
+ }
792
+ };
793
+ Tt = class extends x {
794
+ options;
795
+ cursor = 0;
796
+ constructor(e2) {
797
+ super(e2, false), this.options = e2.options;
798
+ const s = e2.caseSensitive === true, i = this.options.map(({ value: [r] }) => s ? r : r?.toLowerCase());
799
+ this.cursor = Math.max(i.indexOf(e2.initialValue), 0), this.on("key", (r, n) => {
800
+ if (!r) return;
801
+ const u = s && n.shift ? r.toUpperCase() : r;
802
+ if (!i.includes(u)) return;
803
+ const a = this.options.find(({ value: [l] }) => s ? l === u : l?.toLowerCase() === r);
804
+ a && (this.value = a.value, this.state = "submit", this.emit("submit"));
805
+ });
806
+ }
807
+ };
808
+ $t = class extends x {
809
+ get userInputWithCursor() {
810
+ if (this.state === "submit") return this.userInput;
811
+ const e2 = this.userInput;
812
+ if (this.cursor >= e2.length) return `${this.userInput}\u2588`;
813
+ const s = e2.slice(0, this.cursor), [i, ...r] = e2.slice(this.cursor);
814
+ return `${s}${import_picocolors.default.inverse(i)}${r.join("")}`;
815
+ }
816
+ get cursor() {
817
+ return this._cursor;
818
+ }
819
+ constructor(e2) {
820
+ super({ ...e2, initialUserInput: e2.initialUserInput ?? e2.initialValue }), this.on("userInput", (s) => {
821
+ this._setValue(s);
822
+ }), this.on("finalize", () => {
823
+ this.value || (this.value = e2.defaultValue), this.value === void 0 && (this.value = "");
824
+ });
825
+ }
826
+ };
827
+ }
828
+ });
829
+
830
+ // node_modules/.bun/@clack+prompts@1.0.1/node_modules/@clack/prompts/dist/index.mjs
831
+ var dist_exports = {};
832
+ __export(dist_exports, {
833
+ S_BAR: () => d,
834
+ S_BAR_END: () => x2,
835
+ S_BAR_END_RIGHT: () => Pt,
836
+ S_BAR_H: () => rt2,
837
+ S_BAR_START: () => ht2,
838
+ S_BAR_START_RIGHT: () => Ot,
839
+ S_CHECKBOX_ACTIVE: () => st2,
840
+ S_CHECKBOX_INACTIVE: () => q2,
841
+ S_CHECKBOX_SELECTED: () => U2,
842
+ S_CONNECT_LEFT: () => Wt2,
843
+ S_CORNER_BOTTOM_LEFT: () => gt2,
844
+ S_CORNER_BOTTOM_RIGHT: () => pt2,
845
+ S_CORNER_TOP_LEFT: () => Lt2,
846
+ S_CORNER_TOP_RIGHT: () => mt2,
847
+ S_ERROR: () => Et2,
848
+ S_INFO: () => ft2,
849
+ S_PASSWORD_MASK: () => Nt,
850
+ S_RADIO_ACTIVE: () => Q2,
851
+ S_RADIO_INACTIVE: () => H2,
852
+ S_STEP_ACTIVE: () => Rt,
853
+ S_STEP_CANCEL: () => dt2,
854
+ S_STEP_ERROR: () => $t2,
855
+ S_STEP_SUBMIT: () => V,
856
+ S_SUCCESS: () => Ft2,
857
+ S_WARN: () => yt2,
858
+ autocomplete: () => Xt,
859
+ autocompleteMultiselect: () => xe,
860
+ box: () => Me,
861
+ cancel: () => Ne,
862
+ confirm: () => Re,
863
+ group: () => Oe,
864
+ groupMultiselect: () => Pe,
865
+ intro: () => We,
866
+ isCI: () => ct2,
867
+ isCancel: () => Ct,
868
+ isTTY: () => Mt2,
869
+ limitOptions: () => X2,
870
+ log: () => R2,
871
+ multiselect: () => je,
872
+ note: () => Ve,
873
+ outro: () => Le,
874
+ password: () => He,
875
+ path: () => Ue,
876
+ progress: () => qe,
877
+ select: () => Je,
878
+ selectKey: () => Xe,
879
+ settings: () => _,
880
+ spinner: () => bt2,
881
+ stream: () => K2,
882
+ symbol: () => W2,
883
+ symbolBar: () => vt2,
884
+ taskLog: () => Qe,
885
+ tasks: () => Ye,
886
+ text: () => Ze,
887
+ unicode: () => et2,
888
+ unicodeOr: () => C,
889
+ updateSettings: () => It
890
+ });
891
+ import N2 from "node:process";
892
+ import { readdirSync as de, existsSync as $e, lstatSync as xt2 } from "node:fs";
893
+ import { dirname as _t2, join as he } from "node:path";
894
+ import { stripVTControlCharacters as ut } from "node:util";
895
+ function me() {
896
+ return N2.platform !== "win32" ? N2.env.TERM !== "linux" : !!N2.env.CI || !!N2.env.WT_SESSION || !!N2.env.TERMINUS_SUBLIME || N2.env.ConEmuTask === "{cmd::Cmder}" || N2.env.TERM_PROGRAM === "Terminus-Sublime" || N2.env.TERM_PROGRAM === "vscode" || N2.env.TERM === "xterm-256color" || N2.env.TERM === "alacritty" || N2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
897
+ }
898
+ function J2(t, r, s) {
899
+ return String(t).normalize().replaceAll(`\r
900
+ `, `
901
+ `).split(`
902
+ `).map((i) => Ie(i, r, s)).join(`
903
+ `);
904
+ }
905
+ function qt(t) {
906
+ return t.label ?? String(t.value ?? "");
907
+ }
908
+ function Jt(t, r) {
909
+ if (!t) return true;
910
+ const s = (r.label ?? String(r.value ?? "")).toLowerCase(), i = (r.hint ?? "").toLowerCase(), a = String(r.value).toLowerCase(), o = t.toLowerCase();
911
+ return s.includes(o) || i.includes(o) || a.includes(o);
912
+ }
913
+ function Be(t, r) {
914
+ const s = [];
915
+ for (const i of r) t.includes(i.value) && s.push(i);
916
+ return s;
917
+ }
918
+ function Yt(t, r, s, i) {
919
+ let a = s, o = s;
920
+ return i === "center" ? a = Math.floor((r - t) / 2) : i === "right" && (a = r - t - s), o = r - a - t, [a, o];
921
+ }
922
+ function qe({ style: t = "heavy", max: r = 100, size: s = 40, ...i } = {}) {
923
+ const a = bt2(i);
924
+ let o = 0, u = "";
925
+ const l = Math.max(1, r), n = Math.max(1, s), c = (E) => {
926
+ switch (E) {
927
+ case "initial":
928
+ case "active":
929
+ return import_picocolors2.default.magenta;
930
+ case "error":
931
+ case "cancel":
932
+ return import_picocolors2.default.red;
933
+ case "submit":
934
+ return import_picocolors2.default.green;
935
+ default:
936
+ return import_picocolors2.default.magenta;
937
+ }
938
+ }, g = (E, $) => {
939
+ const m = Math.floor(o / l * n);
940
+ return `${c(E)(zt[t].repeat(m))}${import_picocolors2.default.dim(zt[t].repeat(n - m))} ${$}`;
941
+ }, F = (E = "") => {
942
+ u = E, a.start(g("initial", E));
943
+ }, p = (E = 1, $) => {
944
+ o = Math.min(l, E + o), a.message(g("active", $ ?? u)), u = $ ?? u;
945
+ };
946
+ return { start: F, stop: a.stop, cancel: a.cancel, error: a.error, clear: a.clear, advance: p, isCancelled: a.isCancelled, message: (E) => p(0, E) };
947
+ }
948
+ var import_picocolors2, import_sisteransi2, et2, ct2, Mt2, C, Rt, dt2, $t2, V, ht2, d, x2, Ot, Pt, Q2, H2, st2, U2, q2, Nt, rt2, mt2, Wt2, pt2, gt2, Lt2, ft2, Ft2, yt2, Et2, W2, vt2, pe, ge, fe, At2, it2, nt2, wt2, at2, Fe, ye, jt, Ee, M2, ot2, Gt, ve, Ct2, kt2, Ae, Vt2, St2, Ht, we, Ut, Kt, Ce, It2, Se, Ie, be, X2, Xt, xe, _e, De, Te, Me, Re, Oe, Pe, R2, Ne, We, Le, Z2, je, Ge, ke, Ve, He, Ue, Ke, bt2, zt, lt2, Je, Xe, Qt, K2, Ye, ze, Qe, Ze;
949
+ var init_dist2 = __esm({
950
+ "node_modules/.bun/@clack+prompts@1.0.1/node_modules/@clack/prompts/dist/index.mjs"() {
951
+ init_utils();
952
+ init_dist();
953
+ init_dist();
954
+ import_picocolors2 = __toESM(require_picocolors(), 1);
955
+ import_sisteransi2 = __toESM(require_src(), 1);
956
+ et2 = me();
957
+ ct2 = () => process.env.CI === "true";
958
+ Mt2 = (t) => t.isTTY === true;
959
+ C = (t, r) => et2 ? t : r;
960
+ Rt = C("\u25C6", "*");
961
+ dt2 = C("\u25A0", "x");
962
+ $t2 = C("\u25B2", "x");
963
+ V = C("\u25C7", "o");
964
+ ht2 = C("\u250C", "T");
965
+ d = C("\u2502", "|");
966
+ x2 = C("\u2514", "\u2014");
967
+ Ot = C("\u2510", "T");
968
+ Pt = C("\u2518", "\u2014");
969
+ Q2 = C("\u25CF", ">");
970
+ H2 = C("\u25CB", " ");
971
+ st2 = C("\u25FB", "[\u2022]");
972
+ U2 = C("\u25FC", "[+]");
973
+ q2 = C("\u25FB", "[ ]");
974
+ Nt = C("\u25AA", "\u2022");
975
+ rt2 = C("\u2500", "-");
976
+ mt2 = C("\u256E", "+");
977
+ Wt2 = C("\u251C", "+");
978
+ pt2 = C("\u256F", "+");
979
+ gt2 = C("\u2570", "+");
980
+ Lt2 = C("\u256D", "+");
981
+ ft2 = C("\u25CF", "\u2022");
982
+ Ft2 = C("\u25C6", "*");
983
+ yt2 = C("\u25B2", "!");
984
+ Et2 = C("\u25A0", "x");
985
+ W2 = (t) => {
986
+ switch (t) {
987
+ case "initial":
988
+ case "active":
989
+ return import_picocolors2.default.cyan(Rt);
990
+ case "cancel":
991
+ return import_picocolors2.default.red(dt2);
992
+ case "error":
993
+ return import_picocolors2.default.yellow($t2);
994
+ case "submit":
995
+ return import_picocolors2.default.green(V);
996
+ }
997
+ };
998
+ vt2 = (t) => {
999
+ switch (t) {
1000
+ case "initial":
1001
+ case "active":
1002
+ return import_picocolors2.default.cyan(d);
1003
+ case "cancel":
1004
+ return import_picocolors2.default.red(d);
1005
+ case "error":
1006
+ return import_picocolors2.default.yellow(d);
1007
+ case "submit":
1008
+ return import_picocolors2.default.green(d);
1009
+ }
1010
+ };
1011
+ pe = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109;
1012
+ ge = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
1013
+ fe = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141;
1014
+ At2 = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
1015
+ it2 = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
1016
+ nt2 = /\t{1,1000}/y;
1017
+ wt2 = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
1018
+ at2 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
1019
+ Fe = new RegExp("\\p{M}+", "gu");
1020
+ ye = { limit: 1 / 0, ellipsis: "" };
1021
+ jt = (t, r = {}, s = {}) => {
1022
+ const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? jt(a, ye, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, F = s.fullWidthWidth ?? 2, p = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
1023
+ let $ = 0, m = 0, h = t.length, y2 = 0, f = false, v = h, S2 = Math.max(0, i - o), I2 = 0, B2 = 0, A = 0, w = 0;
1024
+ t: for (; ; ) {
1025
+ if (B2 > I2 || m >= h && m > $) {
1026
+ const _2 = t.slice(I2, B2) || t.slice($, m);
1027
+ y2 = 0;
1028
+ for (const D2 of _2.replaceAll(Fe, "")) {
1029
+ const T2 = D2.codePointAt(0) || 0;
1030
+ if (ge(T2) ? w = F : fe(T2) ? w = E : c !== p && pe(T2) ? w = c : w = p, A + w > S2 && (v = Math.min(v, Math.max(I2, $) + y2)), A + w > i) {
1031
+ f = true;
1032
+ break t;
1033
+ }
1034
+ y2 += D2.length, A += w;
1035
+ }
1036
+ I2 = B2 = 0;
1037
+ }
1038
+ if (m >= h) break;
1039
+ if (at2.lastIndex = m, at2.test(t)) {
1040
+ if (y2 = at2.lastIndex - m, w = y2 * p, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / p))), A + w > i) {
1041
+ f = true;
1042
+ break;
1043
+ }
1044
+ A += w, I2 = $, B2 = m, m = $ = at2.lastIndex;
1045
+ continue;
1046
+ }
1047
+ if (At2.lastIndex = m, At2.test(t)) {
1048
+ if (A + u > S2 && (v = Math.min(v, m)), A + u > i) {
1049
+ f = true;
1050
+ break;
1051
+ }
1052
+ A += u, I2 = $, B2 = m, m = $ = At2.lastIndex;
1053
+ continue;
1054
+ }
1055
+ if (it2.lastIndex = m, it2.test(t)) {
1056
+ if (y2 = it2.lastIndex - m, w = y2 * l, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / l))), A + w > i) {
1057
+ f = true;
1058
+ break;
1059
+ }
1060
+ A += w, I2 = $, B2 = m, m = $ = it2.lastIndex;
1061
+ continue;
1062
+ }
1063
+ if (nt2.lastIndex = m, nt2.test(t)) {
1064
+ if (y2 = nt2.lastIndex - m, w = y2 * n, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / n))), A + w > i) {
1065
+ f = true;
1066
+ break;
1067
+ }
1068
+ A += w, I2 = $, B2 = m, m = $ = nt2.lastIndex;
1069
+ continue;
1070
+ }
1071
+ if (wt2.lastIndex = m, wt2.test(t)) {
1072
+ if (A + g > S2 && (v = Math.min(v, m)), A + g > i) {
1073
+ f = true;
1074
+ break;
1075
+ }
1076
+ A += g, I2 = $, B2 = m, m = $ = wt2.lastIndex;
1077
+ continue;
1078
+ }
1079
+ m += 1;
1080
+ }
1081
+ return { width: f ? S2 : A, index: f ? v : h, truncated: f, ellipsed: f && i >= o };
1082
+ };
1083
+ Ee = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
1084
+ M2 = (t, r = {}) => jt(t, Ee, r).width;
1085
+ ot2 = "\x1B";
1086
+ Gt = "\x9B";
1087
+ ve = 39;
1088
+ Ct2 = "\x07";
1089
+ kt2 = "[";
1090
+ Ae = "]";
1091
+ Vt2 = "m";
1092
+ St2 = `${Ae}8;;`;
1093
+ Ht = new RegExp(`(?:\\${kt2}(?<code>\\d+)m|\\${St2}(?<uri>.*)${Ct2})`, "y");
1094
+ we = (t) => {
1095
+ if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
1096
+ if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
1097
+ if (t === 1 || t === 2) return 22;
1098
+ if (t === 3) return 23;
1099
+ if (t === 4) return 24;
1100
+ if (t === 7) return 27;
1101
+ if (t === 8) return 28;
1102
+ if (t === 9) return 29;
1103
+ if (t === 0) return 0;
1104
+ };
1105
+ Ut = (t) => `${ot2}${kt2}${t}${Vt2}`;
1106
+ Kt = (t) => `${ot2}${St2}${t}${Ct2}`;
1107
+ Ce = (t) => t.map((r) => M2(r));
1108
+ It2 = (t, r, s) => {
1109
+ const i = r[Symbol.iterator]();
1110
+ let a = false, o = false, u = t.at(-1), l = u === void 0 ? 0 : M2(u), n = i.next(), c = i.next(), g = 0;
1111
+ for (; !n.done; ) {
1112
+ const F = n.value, p = M2(F);
1113
+ l + p <= s ? t[t.length - 1] += F : (t.push(F), l = 0), (F === ot2 || F === Gt) && (a = true, o = r.startsWith(St2, g + 1)), a ? o ? F === Ct2 && (a = false, o = false) : F === Vt2 && (a = false) : (l += p, l === s && !c.done && (t.push(""), l = 0)), n = c, c = i.next(), g += F.length;
1114
+ }
1115
+ u = t.at(-1), !l && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
1116
+ };
1117
+ Se = (t) => {
1118
+ const r = t.split(" ");
1119
+ let s = r.length;
1120
+ for (; s > 0 && !(M2(r[s - 1]) > 0); ) s--;
1121
+ return s === r.length ? t : r.slice(0, s).join(" ") + r.slice(s).join("");
1122
+ };
1123
+ Ie = (t, r, s = {}) => {
1124
+ if (s.trim !== false && t.trim() === "") return "";
1125
+ let i = "", a, o;
1126
+ const u = t.split(" "), l = Ce(u);
1127
+ let n = [""];
1128
+ for (const [$, m] of u.entries()) {
1129
+ s.trim !== false && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
1130
+ let h = M2(n.at(-1) ?? "");
1131
+ if ($ !== 0 && (h >= r && (s.wordWrap === false || s.trim === false) && (n.push(""), h = 0), (h > 0 || s.trim === false) && (n[n.length - 1] += " ", h++)), s.hard && l[$] > r) {
1132
+ const y2 = r - h, f = 1 + Math.floor((l[$] - y2 - 1) / r);
1133
+ Math.floor((l[$] - 1) / r) < f && n.push(""), It2(n, m, r);
1134
+ continue;
1135
+ }
1136
+ if (h + l[$] > r && h > 0 && l[$] > 0) {
1137
+ if (s.wordWrap === false && h < r) {
1138
+ It2(n, m, r);
1139
+ continue;
1140
+ }
1141
+ n.push("");
1142
+ }
1143
+ if (h + l[$] > r && s.wordWrap === false) {
1144
+ It2(n, m, r);
1145
+ continue;
1146
+ }
1147
+ n[n.length - 1] += m;
1148
+ }
1149
+ s.trim !== false && (n = n.map(($) => Se($)));
1150
+ const c = n.join(`
1151
+ `), g = c[Symbol.iterator]();
1152
+ let F = g.next(), p = g.next(), E = 0;
1153
+ for (; !F.done; ) {
1154
+ const $ = F.value, m = p.value;
1155
+ if (i += $, $ === ot2 || $ === Gt) {
1156
+ Ht.lastIndex = E + 1;
1157
+ const f = Ht.exec(c)?.groups;
1158
+ if (f?.code !== void 0) {
1159
+ const v = Number.parseFloat(f.code);
1160
+ a = v === ve ? void 0 : v;
1161
+ } else f?.uri !== void 0 && (o = f.uri.length === 0 ? void 0 : f.uri);
1162
+ }
1163
+ const h = a ? we(a) : void 0;
1164
+ m === `
1165
+ ` ? (o && (i += Kt("")), a && h && (i += Ut(h))) : $ === `
1166
+ ` && (a && h && (i += Ut(a)), o && (i += Kt(o))), E += $.length, F = p, p = g.next();
1167
+ }
1168
+ return i;
1169
+ };
1170
+ be = (t, r, s, i, a) => {
1171
+ let o = r, u = 0;
1172
+ for (let l = s; l < i; l++) {
1173
+ const n = t[l];
1174
+ if (o = o - n.length, u++, o <= a) break;
1175
+ }
1176
+ return { lineCount: o, removals: u };
1177
+ };
1178
+ X2 = (t) => {
1179
+ const { cursor: r, options: s, style: i } = t, a = t.output ?? process.stdout, o = rt(a), u = t.columnPadding ?? 0, l = t.rowPadding ?? 4, n = o - u, c = nt(a), g = import_picocolors2.default.dim("..."), F = t.maxItems ?? Number.POSITIVE_INFINITY, p = Math.max(c - l, 0), E = Math.max(Math.min(F, p), 5);
1180
+ let $ = 0;
1181
+ r >= E - 3 && ($ = Math.max(Math.min(r - E + 3, s.length - E), 0));
1182
+ let m = E < s.length && $ > 0, h = E < s.length && $ + E < s.length;
1183
+ const y2 = Math.min($ + E, s.length), f = [];
1184
+ let v = 0;
1185
+ m && v++, h && v++;
1186
+ const S2 = $ + (m ? 1 : 0), I2 = y2 - (h ? 1 : 0);
1187
+ for (let A = S2; A < I2; A++) {
1188
+ const w = J2(i(s[A], A === r), n, { hard: true, trim: false }).split(`
1189
+ `);
1190
+ f.push(w), v += w.length;
1191
+ }
1192
+ if (v > p) {
1193
+ let A = 0, w = 0, _2 = v;
1194
+ const D2 = r - S2, T2 = (Y, L2) => be(f, _2, Y, L2, p);
1195
+ m ? ({ lineCount: _2, removals: A } = T2(0, D2), _2 > p && ({ lineCount: _2, removals: w } = T2(D2 + 1, f.length))) : ({ lineCount: _2, removals: w } = T2(D2 + 1, f.length), _2 > p && ({ lineCount: _2, removals: A } = T2(0, D2))), A > 0 && (m = true, f.splice(0, A)), w > 0 && (h = true, f.splice(f.length - w, w));
1196
+ }
1197
+ const B2 = [];
1198
+ m && B2.push(g);
1199
+ for (const A of f) for (const w of A) B2.push(w);
1200
+ return h && B2.push(g), B2;
1201
+ };
1202
+ Xt = (t) => new Vt({ options: t.options, initialValue: t.initialValue ? [t.initialValue] : void 0, initialUserInput: t.initialUserInput, filter: t.filter ?? ((r, s) => Jt(r, s)), signal: t.signal, input: t.input, output: t.output, validate: t.validate, render() {
1203
+ const r = t.withGuide ?? _.withGuide, s = r ? [`${import_picocolors2.default.gray(d)}`, `${W2(this.state)} ${t.message}`] : [`${W2(this.state)} ${t.message}`], i = this.userInput, a = this.options, o = t.placeholder, u = i === "" && o !== void 0, l = (n, c) => {
1204
+ const g = qt(n), F = n.hint && n.value === this.focusedValue ? import_picocolors2.default.dim(` (${n.hint})`) : "";
1205
+ switch (c) {
1206
+ case "active":
1207
+ return `${import_picocolors2.default.green(Q2)} ${g}${F}`;
1208
+ case "inactive":
1209
+ return `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(g)}`;
1210
+ case "disabled":
1211
+ return `${import_picocolors2.default.gray(H2)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.gray(g))}`;
1212
+ }
1213
+ };
1214
+ switch (this.state) {
1215
+ case "submit": {
1216
+ const n = Be(this.selectedValues, a), c = n.length > 0 ? ` ${import_picocolors2.default.dim(n.map(qt).join(", "))}` : "", g = r ? import_picocolors2.default.gray(d) : "";
1217
+ return `${s.join(`
1218
+ `)}
1219
+ ${g}${c}`;
1220
+ }
1221
+ case "cancel": {
1222
+ const n = i ? ` ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(i))}` : "", c = r ? import_picocolors2.default.gray(d) : "";
1223
+ return `${s.join(`
1224
+ `)}
1225
+ ${c}${n}`;
1226
+ }
1227
+ default: {
1228
+ const n = this.state === "error" ? import_picocolors2.default.yellow : import_picocolors2.default.cyan, c = r ? `${n(d)} ` : "", g = r ? n(x2) : "";
1229
+ let F = "";
1230
+ if (this.isNavigating || u) {
1231
+ const f = u ? o : i;
1232
+ F = f !== "" ? ` ${import_picocolors2.default.dim(f)}` : "";
1233
+ } else F = ` ${this.userInputWithCursor}`;
1234
+ const p = this.filteredOptions.length !== a.length ? import_picocolors2.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", E = this.filteredOptions.length === 0 && i ? [`${c}${import_picocolors2.default.yellow("No matches found")}`] : [], $ = this.state === "error" ? [`${c}${import_picocolors2.default.yellow(this.error)}`] : [];
1235
+ r && s.push(`${c.trimEnd()}`), s.push(`${c}${import_picocolors2.default.dim("Search:")}${F}${p}`, ...E, ...$);
1236
+ const m = [`${import_picocolors2.default.dim("\u2191/\u2193")} to select`, `${import_picocolors2.default.dim("Enter:")} confirm`, `${import_picocolors2.default.dim("Type:")} to search`], h = [`${c}${m.join(" \u2022 ")}`, g], y2 = this.filteredOptions.length === 0 ? [] : X2({ cursor: this.cursor, options: this.filteredOptions, columnPadding: r ? 3 : 0, rowPadding: s.length + h.length, style: (f, v) => l(f, f.disabled ? "disabled" : v ? "active" : "inactive"), maxItems: t.maxItems, output: t.output });
1237
+ return [...s, ...y2.map((f) => `${c}${f}`), ...h].join(`
1238
+ `);
1239
+ }
1240
+ }
1241
+ } }).prompt();
1242
+ xe = (t) => {
1243
+ const r = (i, a, o, u) => {
1244
+ const l = o.includes(i.value), n = i.label ?? String(i.value ?? ""), c = i.hint && u !== void 0 && i.value === u ? import_picocolors2.default.dim(` (${i.hint})`) : "", g = l ? import_picocolors2.default.green(U2) : import_picocolors2.default.dim(q2);
1245
+ return i.disabled ? `${import_picocolors2.default.gray(q2)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.gray(n))}` : a ? `${g} ${n}${c}` : `${g} ${import_picocolors2.default.dim(n)}`;
1246
+ }, s = new Vt({ options: t.options, multiple: true, filter: t.filter ?? ((i, a) => Jt(i, a)), validate: () => {
1247
+ if (t.required && s.selectedValues.length === 0) return "Please select at least one item";
1248
+ }, initialValue: t.initialValues, signal: t.signal, input: t.input, output: t.output, render() {
1249
+ const i = `${import_picocolors2.default.gray(d)}
1250
+ ${W2(this.state)} ${t.message}
1251
+ `, a = this.userInput, o = t.placeholder, u = a === "" && o !== void 0, l = this.isNavigating || u ? import_picocolors2.default.dim(u ? o : a) : this.userInputWithCursor, n = this.options, c = this.filteredOptions.length !== n.length ? import_picocolors2.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "";
1252
+ switch (this.state) {
1253
+ case "submit":
1254
+ return `${i}${import_picocolors2.default.gray(d)} ${import_picocolors2.default.dim(`${this.selectedValues.length} items selected`)}`;
1255
+ case "cancel":
1256
+ return `${i}${import_picocolors2.default.gray(d)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(a))}`;
1257
+ default: {
1258
+ const g = this.state === "error" ? import_picocolors2.default.yellow : import_picocolors2.default.cyan, F = [`${import_picocolors2.default.dim("\u2191/\u2193")} to navigate`, `${import_picocolors2.default.dim(this.isNavigating ? "Space/Tab:" : "Tab:")} select`, `${import_picocolors2.default.dim("Enter:")} confirm`, `${import_picocolors2.default.dim("Type:")} to search`], p = this.filteredOptions.length === 0 && a ? [`${g(d)} ${import_picocolors2.default.yellow("No matches found")}`] : [], E = this.state === "error" ? [`${g(d)} ${import_picocolors2.default.yellow(this.error)}`] : [], $ = [...`${i}${g(d)}`.split(`
1259
+ `), `${g(d)} ${import_picocolors2.default.dim("Search:")} ${l}${c}`, ...p, ...E], m = [`${g(d)} ${F.join(" \u2022 ")}`, `${g(x2)}`], h = X2({ cursor: this.cursor, options: this.filteredOptions, style: (y2, f) => r(y2, f, this.selectedValues, this.focusedValue), maxItems: t.maxItems, output: t.output, rowPadding: $.length + m.length });
1260
+ return [...$, ...h.map((y2) => `${g(d)} ${y2}`), ...m].join(`
1261
+ `);
1262
+ }
1263
+ }
1264
+ } });
1265
+ return s.prompt();
1266
+ };
1267
+ _e = [Lt2, mt2, gt2, pt2];
1268
+ De = [ht2, Ot, x2, Pt];
1269
+ Te = (t) => t;
1270
+ Me = (t = "", r = "", s) => {
1271
+ const i = s?.output ?? process.stdout, a = rt(i), o = 2, u = s?.titlePadding ?? 1, l = s?.contentPadding ?? 2, n = s?.width === void 0 || s.width === "auto" ? 1 : Math.min(1, s.width), c = s?.withGuide ?? _.withGuide ? `${d} ` : "", g = s?.formatBorder ?? Te, F = (s?.rounded ? _e : De).map(g), p = g(rt2), E = g(d), $ = M2(c), m = M2(r), h = a - $;
1272
+ let y2 = Math.floor(a * n) - $;
1273
+ if (s?.width === "auto") {
1274
+ const _2 = t.split(`
1275
+ `);
1276
+ let D2 = m + u * 2;
1277
+ for (const Y of _2) {
1278
+ const L2 = M2(Y) + l * 2;
1279
+ L2 > D2 && (D2 = L2);
1280
+ }
1281
+ const T2 = D2 + o;
1282
+ T2 < y2 && (y2 = T2);
1283
+ }
1284
+ y2 % 2 !== 0 && (y2 < h ? y2++ : y2--);
1285
+ const f = y2 - o, v = f - u * 2, S2 = m > v ? `${r.slice(0, v - 3)}...` : r, [I2, B2] = Yt(M2(S2), f, u, s?.titleAlign), A = J2(t, f - l * 2, { hard: true, trim: false });
1286
+ i.write(`${c}${F[0]}${p.repeat(I2)}${S2}${p.repeat(B2)}${F[1]}
1287
+ `);
1288
+ const w = A.split(`
1289
+ `);
1290
+ for (const _2 of w) {
1291
+ const [D2, T2] = Yt(M2(_2), f, l, s?.contentAlign);
1292
+ i.write(`${c}${E}${" ".repeat(D2)}${_2}${" ".repeat(T2)}${E}
1293
+ `);
1294
+ }
1295
+ i.write(`${c}${F[2]}${p.repeat(f)}${F[3]}
1296
+ `);
1297
+ };
1298
+ Re = (t) => {
1299
+ const r = t.active ?? "Yes", s = t.inactive ?? "No";
1300
+ return new kt({ active: r, inactive: s, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue ?? true, render() {
1301
+ const i = t.withGuide ?? _.withGuide, a = `${i ? `${import_picocolors2.default.gray(d)}
1302
+ ` : ""}${W2(this.state)} ${t.message}
1303
+ `, o = this.value ? r : s;
1304
+ switch (this.state) {
1305
+ case "submit": {
1306
+ const u = i ? `${import_picocolors2.default.gray(d)} ` : "";
1307
+ return `${a}${u}${import_picocolors2.default.dim(o)}`;
1308
+ }
1309
+ case "cancel": {
1310
+ const u = i ? `${import_picocolors2.default.gray(d)} ` : "";
1311
+ return `${a}${u}${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o))}${i ? `
1312
+ ${import_picocolors2.default.gray(d)}` : ""}`;
1313
+ }
1314
+ default: {
1315
+ const u = i ? `${import_picocolors2.default.cyan(d)} ` : "", l = i ? import_picocolors2.default.cyan(x2) : "";
1316
+ return `${a}${u}${this.value ? `${import_picocolors2.default.green(Q2)} ${r}` : `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(r)}`}${t.vertical ? i ? `
1317
+ ${import_picocolors2.default.cyan(d)} ` : `
1318
+ ` : ` ${import_picocolors2.default.dim("/")} `}${this.value ? `${import_picocolors2.default.dim(H2)} ${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.green(Q2)} ${s}`}
1319
+ ${l}
1320
+ `;
1321
+ }
1322
+ }
1323
+ } }).prompt();
1324
+ };
1325
+ Oe = async (t, r) => {
1326
+ const s = {}, i = Object.keys(t);
1327
+ for (const a of i) {
1328
+ const o = t[a], u = await o({ results: s })?.catch((l) => {
1329
+ throw l;
1330
+ });
1331
+ if (typeof r?.onCancel == "function" && Ct(u)) {
1332
+ s[a] = "canceled", r.onCancel({ results: s });
1333
+ continue;
1334
+ }
1335
+ s[a] = u;
1336
+ }
1337
+ return s;
1338
+ };
1339
+ Pe = (t) => {
1340
+ const { selectableGroups: r = true, groupSpacing: s = 0 } = t, i = (o, u, l = []) => {
1341
+ const n = o.label ?? String(o.value), c = typeof o.group == "string", g = c && (l[l.indexOf(o) + 1] ?? { group: true }), F = c && g && g.group === true, p = c ? r ? `${F ? x2 : d} ` : " " : "";
1342
+ let E = "";
1343
+ if (s > 0 && !c) {
1344
+ const m = `
1345
+ ${import_picocolors2.default.cyan(d)}`;
1346
+ E = `${m.repeat(s - 1)}${m} `;
1347
+ }
1348
+ if (u === "active") return `${E}${import_picocolors2.default.dim(p)}${import_picocolors2.default.cyan(st2)} ${n}${o.hint ? ` ${import_picocolors2.default.dim(`(${o.hint})`)}` : ""}`;
1349
+ if (u === "group-active") return `${E}${p}${import_picocolors2.default.cyan(st2)} ${import_picocolors2.default.dim(n)}`;
1350
+ if (u === "group-active-selected") return `${E}${p}${import_picocolors2.default.green(U2)} ${import_picocolors2.default.dim(n)}`;
1351
+ if (u === "selected") {
1352
+ const m = c || r ? import_picocolors2.default.green(U2) : "";
1353
+ return `${E}${import_picocolors2.default.dim(p)}${m} ${import_picocolors2.default.dim(n)}${o.hint ? ` ${import_picocolors2.default.dim(`(${o.hint})`)}` : ""}`;
1354
+ }
1355
+ if (u === "cancelled") return `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(n))}`;
1356
+ if (u === "active-selected") return `${E}${import_picocolors2.default.dim(p)}${import_picocolors2.default.green(U2)} ${n}${o.hint ? ` ${import_picocolors2.default.dim(`(${o.hint})`)}` : ""}`;
1357
+ if (u === "submitted") return `${import_picocolors2.default.dim(n)}`;
1358
+ const $ = c || r ? import_picocolors2.default.dim(q2) : "";
1359
+ return `${E}${import_picocolors2.default.dim(p)}${$} ${import_picocolors2.default.dim(n)}`;
1360
+ }, a = t.required ?? true;
1361
+ return new yt({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValues: t.initialValues, required: a, cursorAt: t.cursorAt, selectableGroups: r, validate(o) {
1362
+ if (a && (o === void 0 || o.length === 0)) return `Please select at least one option.
1363
+ ${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
1364
+ }, render() {
1365
+ const o = `${import_picocolors2.default.gray(d)}
1366
+ ${W2(this.state)} ${t.message}
1367
+ `, u = this.value ?? [];
1368
+ switch (this.state) {
1369
+ case "submit": {
1370
+ const l = this.options.filter(({ value: c }) => u.includes(c)).map((c) => i(c, "submitted")), n = l.length === 0 ? "" : ` ${l.join(import_picocolors2.default.dim(", "))}`;
1371
+ return `${o}${import_picocolors2.default.gray(d)}${n}`;
1372
+ }
1373
+ case "cancel": {
1374
+ const l = this.options.filter(({ value: n }) => u.includes(n)).map((n) => i(n, "cancelled")).join(import_picocolors2.default.dim(", "));
1375
+ return `${o}${import_picocolors2.default.gray(d)} ${l.trim() ? `${l}
1376
+ ${import_picocolors2.default.gray(d)}` : ""}`;
1377
+ }
1378
+ case "error": {
1379
+ const l = this.error.split(`
1380
+ `).map((n, c) => c === 0 ? `${import_picocolors2.default.yellow(x2)} ${import_picocolors2.default.yellow(n)}` : ` ${n}`).join(`
1381
+ `);
1382
+ return `${o}${import_picocolors2.default.yellow(d)} ${this.options.map((n, c, g) => {
1383
+ const F = u.includes(n.value) || n.group === true && this.isGroupSelected(`${n.value}`), p = c === this.cursor;
1384
+ return !p && typeof n.group == "string" && this.options[this.cursor].value === n.group ? i(n, F ? "group-active-selected" : "group-active", g) : p && F ? i(n, "active-selected", g) : F ? i(n, "selected", g) : i(n, p ? "active" : "inactive", g);
1385
+ }).join(`
1386
+ ${import_picocolors2.default.yellow(d)} `)}
1387
+ ${l}
1388
+ `;
1389
+ }
1390
+ default: {
1391
+ const l = this.options.map((c, g, F) => {
1392
+ const p = u.includes(c.value) || c.group === true && this.isGroupSelected(`${c.value}`), E = g === this.cursor, $ = !E && typeof c.group == "string" && this.options[this.cursor].value === c.group;
1393
+ let m = "";
1394
+ return $ ? m = i(c, p ? "group-active-selected" : "group-active", F) : E && p ? m = i(c, "active-selected", F) : p ? m = i(c, "selected", F) : m = i(c, E ? "active" : "inactive", F), `${g !== 0 && !m.startsWith(`
1395
+ `) ? " " : ""}${m}`;
1396
+ }).join(`
1397
+ ${import_picocolors2.default.cyan(d)}`), n = l.startsWith(`
1398
+ `) ? "" : " ";
1399
+ return `${o}${import_picocolors2.default.cyan(d)}${n}${l}
1400
+ ${import_picocolors2.default.cyan(x2)}
1401
+ `;
1402
+ }
1403
+ }
1404
+ } }).prompt();
1405
+ };
1406
+ R2 = { message: (t = [], { symbol: r = import_picocolors2.default.gray(d), secondarySymbol: s = import_picocolors2.default.gray(d), output: i = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
1407
+ const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", g = l ? `${s} ` : "";
1408
+ for (let p = 0; p < a; p++) u.push(n);
1409
+ const F = Array.isArray(t) ? t : t.split(`
1410
+ `);
1411
+ if (F.length > 0) {
1412
+ const [p, ...E] = F;
1413
+ p.length > 0 ? u.push(`${c}${p}`) : u.push(l ? r : "");
1414
+ for (const $ of E) $.length > 0 ? u.push(`${g}${$}`) : u.push(l ? s : "");
1415
+ }
1416
+ i.write(`${u.join(`
1417
+ `)}
1418
+ `);
1419
+ }, info: (t, r) => {
1420
+ R2.message(t, { ...r, symbol: import_picocolors2.default.blue(ft2) });
1421
+ }, success: (t, r) => {
1422
+ R2.message(t, { ...r, symbol: import_picocolors2.default.green(Ft2) });
1423
+ }, step: (t, r) => {
1424
+ R2.message(t, { ...r, symbol: import_picocolors2.default.green(V) });
1425
+ }, warn: (t, r) => {
1426
+ R2.message(t, { ...r, symbol: import_picocolors2.default.yellow(yt2) });
1427
+ }, warning: (t, r) => {
1428
+ R2.warn(t, r);
1429
+ }, error: (t, r) => {
1430
+ R2.message(t, { ...r, symbol: import_picocolors2.default.red(Et2) });
1431
+ } };
1432
+ Ne = (t = "", r) => {
1433
+ (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(x2)} ${import_picocolors2.default.red(t)}
1434
+
1435
+ `);
1436
+ };
1437
+ We = (t = "", r) => {
1438
+ (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(ht2)} ${t}
1439
+ `);
1440
+ };
1441
+ Le = (t = "", r) => {
1442
+ (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(d)}
1443
+ ${import_picocolors2.default.gray(x2)} ${t}
1444
+
1445
+ `);
1446
+ };
1447
+ Z2 = (t, r) => t.split(`
1448
+ `).map((s) => r(s)).join(`
1449
+ `);
1450
+ je = (t) => {
1451
+ const r = (i, a) => {
1452
+ const o = i.label ?? String(i.value);
1453
+ return a === "disabled" ? `${import_picocolors2.default.gray(q2)} ${Z2(o, (u) => import_picocolors2.default.strikethrough(import_picocolors2.default.gray(u)))}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${import_picocolors2.default.cyan(st2)} ${o}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint})`)}` : ""}` : a === "selected" ? `${import_picocolors2.default.green(U2)} ${Z2(o, import_picocolors2.default.dim)}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint})`)}` : ""}` : a === "cancelled" ? `${Z2(o, (u) => import_picocolors2.default.strikethrough(import_picocolors2.default.dim(u)))}` : a === "active-selected" ? `${import_picocolors2.default.green(U2)} ${o}${i.hint ? ` ${import_picocolors2.default.dim(`(${i.hint})`)}` : ""}` : a === "submitted" ? `${Z2(o, import_picocolors2.default.dim)}` : `${import_picocolors2.default.dim(q2)} ${Z2(o, import_picocolors2.default.dim)}`;
1454
+ }, s = t.required ?? true;
1455
+ return new Lt({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValues: t.initialValues, required: s, cursorAt: t.cursorAt, validate(i) {
1456
+ if (s && (i === void 0 || i.length === 0)) return `Please select at least one option.
1457
+ ${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
1458
+ }, render() {
1459
+ const i = xt(t.output, t.message, `${vt2(this.state)} `, `${W2(this.state)} `), a = `${import_picocolors2.default.gray(d)}
1460
+ ${i}
1461
+ `, o = this.value ?? [], u = (l, n) => {
1462
+ if (l.disabled) return r(l, "disabled");
1463
+ const c = o.includes(l.value);
1464
+ return n && c ? r(l, "active-selected") : c ? r(l, "selected") : r(l, n ? "active" : "inactive");
1465
+ };
1466
+ switch (this.state) {
1467
+ case "submit": {
1468
+ const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none"), n = xt(t.output, l, `${import_picocolors2.default.gray(d)} `);
1469
+ return `${a}${n}`;
1470
+ }
1471
+ case "cancel": {
1472
+ const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(import_picocolors2.default.dim(", "));
1473
+ if (l.trim() === "") return `${a}${import_picocolors2.default.gray(d)}`;
1474
+ const n = xt(t.output, l, `${import_picocolors2.default.gray(d)} `);
1475
+ return `${a}${n}
1476
+ ${import_picocolors2.default.gray(d)}`;
1477
+ }
1478
+ case "error": {
1479
+ const l = `${import_picocolors2.default.yellow(d)} `, n = this.error.split(`
1480
+ `).map((F, p) => p === 0 ? `${import_picocolors2.default.yellow(x2)} ${import_picocolors2.default.yellow(F)}` : ` ${F}`).join(`
1481
+ `), c = a.split(`
1482
+ `).length, g = n.split(`
1483
+ `).length + 1;
1484
+ return `${a}${l}${X2({ output: t.output, options: this.options, cursor: this.cursor, maxItems: t.maxItems, columnPadding: l.length, rowPadding: c + g, style: u }).join(`
1485
+ ${l}`)}
1486
+ ${n}
1487
+ `;
1488
+ }
1489
+ default: {
1490
+ const l = `${import_picocolors2.default.cyan(d)} `, n = a.split(`
1491
+ `).length;
1492
+ return `${a}${l}${X2({ output: t.output, options: this.options, cursor: this.cursor, maxItems: t.maxItems, columnPadding: l.length, rowPadding: n + 2, style: u }).join(`
1493
+ ${l}`)}
1494
+ ${import_picocolors2.default.cyan(x2)}
1495
+ `;
1496
+ }
1497
+ }
1498
+ } }).prompt();
1499
+ };
1500
+ Ge = (t) => import_picocolors2.default.dim(t);
1501
+ ke = (t, r, s) => {
1502
+ const i = { hard: true, trim: false }, a = J2(t, r, i).split(`
1503
+ `), o = a.reduce((n, c) => Math.max(M2(c), n), 0), u = a.map(s).reduce((n, c) => Math.max(M2(c), n), 0), l = r - (u - o);
1504
+ return J2(t, l, i);
1505
+ };
1506
+ Ve = (t = "", r = "", s) => {
1507
+ const i = s?.output ?? N2.stdout, a = s?.withGuide ?? _.withGuide, o = s?.format ?? Ge, u = ["", ...ke(t, rt(i) - 6, o).split(`
1508
+ `).map(o), ""], l = M2(r), n = Math.max(u.reduce((p, E) => {
1509
+ const $ = M2(E);
1510
+ return $ > p ? $ : p;
1511
+ }, 0), l) + 2, c = u.map((p) => `${import_picocolors2.default.gray(d)} ${p}${" ".repeat(n - M2(p))}${import_picocolors2.default.gray(d)}`).join(`
1512
+ `), g = a ? `${import_picocolors2.default.gray(d)}
1513
+ ` : "", F = a ? Wt2 : gt2;
1514
+ i.write(`${g}${import_picocolors2.default.green(V)} ${import_picocolors2.default.reset(r)} ${import_picocolors2.default.gray(rt2.repeat(Math.max(n - l - 1, 1)) + mt2)}
1515
+ ${c}
1516
+ ${import_picocolors2.default.gray(F + rt2.repeat(n + 2) + pt2)}
1517
+ `);
1518
+ };
1519
+ He = (t) => new Mt({ validate: t.validate, mask: t.mask ?? Nt, signal: t.signal, input: t.input, output: t.output, render() {
1520
+ const r = t.withGuide ?? _.withGuide, s = `${r ? `${import_picocolors2.default.gray(d)}
1521
+ ` : ""}${W2(this.state)} ${t.message}
1522
+ `, i = this.userInputWithCursor, a = this.masked;
1523
+ switch (this.state) {
1524
+ case "error": {
1525
+ const o = r ? `${import_picocolors2.default.yellow(d)} ` : "", u = r ? `${import_picocolors2.default.yellow(x2)} ` : "", l = a ?? "";
1526
+ return t.clearOnError && this.clear(), `${s.trim()}
1527
+ ${o}${l}
1528
+ ${u}${import_picocolors2.default.yellow(this.error)}
1529
+ `;
1530
+ }
1531
+ case "submit": {
1532
+ const o = r ? `${import_picocolors2.default.gray(d)} ` : "", u = a ? import_picocolors2.default.dim(a) : "";
1533
+ return `${s}${o}${u}`;
1534
+ }
1535
+ case "cancel": {
1536
+ const o = r ? `${import_picocolors2.default.gray(d)} ` : "", u = a ? import_picocolors2.default.strikethrough(import_picocolors2.default.dim(a)) : "";
1537
+ return `${s}${o}${u}${a && r ? `
1538
+ ${import_picocolors2.default.gray(d)}` : ""}`;
1539
+ }
1540
+ default: {
1541
+ const o = r ? `${import_picocolors2.default.cyan(d)} ` : "", u = r ? import_picocolors2.default.cyan(x2) : "";
1542
+ return `${s}${o}${i}
1543
+ ${u}
1544
+ `;
1545
+ }
1546
+ }
1547
+ } }).prompt();
1548
+ Ue = (t) => {
1549
+ const r = t.validate;
1550
+ return Xt({ ...t, initialUserInput: t.initialValue ?? t.root ?? process.cwd(), maxItems: 5, validate(s) {
1551
+ if (!Array.isArray(s)) {
1552
+ if (!s) return "Please select a path";
1553
+ if (r) return r(s);
1554
+ }
1555
+ }, options() {
1556
+ const s = this.userInput;
1557
+ if (s === "") return [];
1558
+ try {
1559
+ let i;
1560
+ return $e(s) ? xt2(s).isDirectory() ? i = s : i = _t2(s) : i = _t2(s), de(i).map((a) => {
1561
+ const o = he(i, a), u = xt2(o);
1562
+ return { name: a, path: o, isDirectory: u.isDirectory() };
1563
+ }).filter(({ path: a, isDirectory: o }) => a.startsWith(s) && (t.directory || !o)).map((a) => ({ value: a.path }));
1564
+ } catch {
1565
+ return [];
1566
+ }
1567
+ } });
1568
+ };
1569
+ Ke = import_picocolors2.default.magenta;
1570
+ bt2 = ({ indicator: t = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = et2 ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], delay: u = et2 ? 80 : 120, signal: l, ...n } = {}) => {
1571
+ const c = ct2();
1572
+ let g, F, p = false, E = false, $ = "", m, h = performance.now();
1573
+ const y2 = rt(s), f = n?.styleFrame ?? Ke, v = (b) => {
1574
+ const O2 = b > 1 ? a ?? _.messages.error : i ?? _.messages.cancel;
1575
+ E = b === 1, p && (L2(O2, b), E && typeof r == "function" && r());
1576
+ }, S2 = () => v(2), I2 = () => v(1), B2 = () => {
1577
+ process.on("uncaughtExceptionMonitor", S2), process.on("unhandledRejection", S2), process.on("SIGINT", I2), process.on("SIGTERM", I2), process.on("exit", v), l && l.addEventListener("abort", I2);
1578
+ }, A = () => {
1579
+ process.removeListener("uncaughtExceptionMonitor", S2), process.removeListener("unhandledRejection", S2), process.removeListener("SIGINT", I2), process.removeListener("SIGTERM", I2), process.removeListener("exit", v), l && l.removeEventListener("abort", I2);
1580
+ }, w = () => {
1581
+ if (m === void 0) return;
1582
+ c && s.write(`
1583
+ `);
1584
+ const b = J2(m, y2, { hard: true, trim: false }).split(`
1585
+ `);
1586
+ b.length > 1 && s.write(import_sisteransi2.cursor.up(b.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
1587
+ }, _2 = (b) => b.replace(/\.+$/, ""), D2 = (b) => {
1588
+ const O2 = (performance.now() - b) / 1e3, j2 = Math.floor(O2 / 60), G2 = Math.floor(O2 % 60);
1589
+ return j2 > 0 ? `[${j2}m ${G2}s]` : `[${G2}s]`;
1590
+ }, T2 = n.withGuide ?? _.withGuide, Y = (b = "") => {
1591
+ p = true, g = Bt({ output: s }), $ = _2(b), h = performance.now(), T2 && s.write(`${import_picocolors2.default.gray(d)}
1592
+ `);
1593
+ let O2 = 0, j2 = 0;
1594
+ B2(), F = setInterval(() => {
1595
+ if (c && $ === m) return;
1596
+ w(), m = $;
1597
+ const G2 = f(o[O2]);
1598
+ let tt2;
1599
+ if (c) tt2 = `${G2} ${$}...`;
1600
+ else if (t === "timer") tt2 = `${G2} ${$} ${D2(h)}`;
1601
+ else {
1602
+ const te = ".".repeat(Math.floor(j2)).slice(0, 3);
1603
+ tt2 = `${G2} ${$}${te}`;
1604
+ }
1605
+ const Zt = J2(tt2, y2, { hard: true, trim: false });
1606
+ s.write(Zt), O2 = O2 + 1 < o.length ? O2 + 1 : 0, j2 = j2 < 4 ? j2 + 0.125 : 0;
1607
+ }, u);
1608
+ }, L2 = (b = "", O2 = 0, j2 = false) => {
1609
+ if (!p) return;
1610
+ p = false, clearInterval(F), w();
1611
+ const G2 = O2 === 0 ? import_picocolors2.default.green(V) : O2 === 1 ? import_picocolors2.default.red(dt2) : import_picocolors2.default.red($t2);
1612
+ $ = b ?? $, j2 || (t === "timer" ? s.write(`${G2} ${$} ${D2(h)}
1613
+ `) : s.write(`${G2} ${$}
1614
+ `)), A(), g();
1615
+ };
1616
+ return { start: Y, stop: (b = "") => L2(b, 0), message: (b = "") => {
1617
+ $ = _2(b ?? $);
1618
+ }, cancel: (b = "") => L2(b, 1), error: (b = "") => L2(b, 2), clear: () => L2("", 0, true), get isCancelled() {
1619
+ return E;
1620
+ } };
1621
+ };
1622
+ zt = { light: C("\u2500", "-"), heavy: C("\u2501", "="), block: C("\u2588", "#") };
1623
+ lt2 = (t, r) => t.includes(`
1624
+ `) ? t.split(`
1625
+ `).map((s) => r(s)).join(`
1626
+ `) : r(t);
1627
+ Je = (t) => {
1628
+ const r = (s, i) => {
1629
+ const a = s.label ?? String(s.value);
1630
+ switch (i) {
1631
+ case "disabled":
1632
+ return `${import_picocolors2.default.gray(H2)} ${lt2(a, import_picocolors2.default.gray)}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint ?? "disabled"})`)}` : ""}`;
1633
+ case "selected":
1634
+ return `${lt2(a, import_picocolors2.default.dim)}`;
1635
+ case "active":
1636
+ return `${import_picocolors2.default.green(Q2)} ${a}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint})`)}` : ""}`;
1637
+ case "cancelled":
1638
+ return `${lt2(a, (o) => import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o)))}`;
1639
+ default:
1640
+ return `${import_picocolors2.default.dim(H2)} ${lt2(a, import_picocolors2.default.dim)}`;
1641
+ }
1642
+ };
1643
+ return new Wt({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue, render() {
1644
+ const s = t.withGuide ?? _.withGuide, i = `${W2(this.state)} `, a = `${vt2(this.state)} `, o = xt(t.output, t.message, a, i), u = `${s ? `${import_picocolors2.default.gray(d)}
1645
+ ` : ""}${o}
1646
+ `;
1647
+ switch (this.state) {
1648
+ case "submit": {
1649
+ const l = s ? `${import_picocolors2.default.gray(d)} ` : "", n = xt(t.output, r(this.options[this.cursor], "selected"), l);
1650
+ return `${u}${n}`;
1651
+ }
1652
+ case "cancel": {
1653
+ const l = s ? `${import_picocolors2.default.gray(d)} ` : "", n = xt(t.output, r(this.options[this.cursor], "cancelled"), l);
1654
+ return `${u}${n}${s ? `
1655
+ ${import_picocolors2.default.gray(d)}` : ""}`;
1656
+ }
1657
+ default: {
1658
+ const l = s ? `${import_picocolors2.default.cyan(d)} ` : "", n = s ? import_picocolors2.default.cyan(x2) : "", c = u.split(`
1659
+ `).length, g = s ? 2 : 1;
1660
+ return `${u}${l}${X2({ output: t.output, cursor: this.cursor, options: this.options, maxItems: t.maxItems, columnPadding: l.length, rowPadding: c + g, style: (F, p) => r(F, F.disabled ? "disabled" : p ? "active" : "inactive") }).join(`
1661
+ ${l}`)}
1662
+ ${n}
1663
+ `;
1664
+ }
1665
+ }
1666
+ } }).prompt();
1667
+ };
1668
+ Xe = (t) => {
1669
+ const r = (s, i = "inactive") => {
1670
+ const a = s.label ?? String(s.value);
1671
+ return i === "selected" ? `${import_picocolors2.default.dim(a)}` : i === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(a))}` : i === "active" ? `${import_picocolors2.default.bgCyan(import_picocolors2.default.gray(` ${s.value} `))} ${a}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint})`)}` : ""}` : `${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(` ${s.value} `)))} ${a}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint})`)}` : ""}`;
1672
+ };
1673
+ return new Tt({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue, caseSensitive: t.caseSensitive, render() {
1674
+ const s = t.withGuide ?? _.withGuide, i = `${s ? `${import_picocolors2.default.gray(d)}
1675
+ ` : ""}${W2(this.state)} ${t.message}
1676
+ `;
1677
+ switch (this.state) {
1678
+ case "submit": {
1679
+ const a = s ? `${import_picocolors2.default.gray(d)} ` : "", o = this.options.find((l) => l.value === this.value) ?? t.options[0], u = xt(t.output, r(o, "selected"), a);
1680
+ return `${i}${u}`;
1681
+ }
1682
+ case "cancel": {
1683
+ const a = s ? `${import_picocolors2.default.gray(d)} ` : "", o = xt(t.output, r(this.options[0], "cancelled"), a);
1684
+ return `${i}${o}${s ? `
1685
+ ${import_picocolors2.default.gray(d)}` : ""}`;
1686
+ }
1687
+ default: {
1688
+ const a = s ? `${import_picocolors2.default.cyan(d)} ` : "", o = s ? import_picocolors2.default.cyan(x2) : "", u = this.options.map((l, n) => xt(t.output, r(l, n === this.cursor ? "active" : "inactive"), a)).join(`
1689
+ `);
1690
+ return `${i}${u}
1691
+ ${o}
1692
+ `;
1693
+ }
1694
+ }
1695
+ } }).prompt();
1696
+ };
1697
+ Qt = `${import_picocolors2.default.gray(d)} `;
1698
+ K2 = { message: async (t, { symbol: r = import_picocolors2.default.gray(d) } = {}) => {
1699
+ process.stdout.write(`${import_picocolors2.default.gray(d)}
1700
+ ${r} `);
1701
+ let s = 3;
1702
+ for await (let i of t) {
1703
+ i = i.replace(/\n/g, `
1704
+ ${Qt}`), i.includes(`
1705
+ `) && (s = 3 + ut(i.slice(i.lastIndexOf(`
1706
+ `))).length);
1707
+ const a = ut(i).length;
1708
+ s + a < process.stdout.columns ? (s += a, process.stdout.write(i)) : (process.stdout.write(`
1709
+ ${Qt}${i.trimStart()}`), s = 3 + ut(i.trimStart()).length);
1710
+ }
1711
+ process.stdout.write(`
1712
+ `);
1713
+ }, info: (t) => K2.message(t, { symbol: import_picocolors2.default.blue(ft2) }), success: (t) => K2.message(t, { symbol: import_picocolors2.default.green(Ft2) }), step: (t) => K2.message(t, { symbol: import_picocolors2.default.green(V) }), warn: (t) => K2.message(t, { symbol: import_picocolors2.default.yellow(yt2) }), warning: (t) => K2.warn(t), error: (t) => K2.message(t, { symbol: import_picocolors2.default.red(Et2) }) };
1714
+ Ye = async (t, r) => {
1715
+ for (const s of t) {
1716
+ if (s.enabled === false) continue;
1717
+ const i = bt2(r);
1718
+ i.start(s.title);
1719
+ const a = await s.task(i.message);
1720
+ i.stop(a || s.title);
1721
+ }
1722
+ };
1723
+ ze = (t) => t.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, "");
1724
+ Qe = (t) => {
1725
+ const r = t.output ?? process.stdout, s = rt(r), i = import_picocolors2.default.gray(d), a = t.spacing ?? 1, o = 3, u = t.retainLog === true, l = !ct2() && Mt2(r);
1726
+ r.write(`${i}
1727
+ `), r.write(`${import_picocolors2.default.green(V)} ${t.title}
1728
+ `);
1729
+ for (let h = 0; h < a; h++) r.write(`${i}
1730
+ `);
1731
+ const n = [{ value: "", full: "" }];
1732
+ let c = false;
1733
+ const g = (h) => {
1734
+ if (n.length === 0) return;
1735
+ let y2 = 0;
1736
+ h && (y2 += a + 2);
1737
+ for (const f of n) {
1738
+ const { value: v, result: S2 } = f;
1739
+ let I2 = S2?.message ?? v;
1740
+ if (I2.length === 0) continue;
1741
+ S2 === void 0 && f.header !== void 0 && f.header !== "" && (I2 += `
1742
+ ${f.header}`);
1743
+ const B2 = I2.split(`
1744
+ `).reduce((A, w) => w === "" ? A + 1 : A + Math.ceil((w.length + o) / s), 0);
1745
+ y2 += B2;
1746
+ }
1747
+ y2 > 0 && (y2 += 1, r.write(import_sisteransi2.erase.lines(y2)));
1748
+ }, F = (h, y2, f) => {
1749
+ const v = f ? `${h.full}
1750
+ ${h.value}` : h.value;
1751
+ h.header !== void 0 && h.header !== "" && R2.message(h.header.split(`
1752
+ `).map(import_picocolors2.default.bold), { output: r, secondarySymbol: i, symbol: i, spacing: 0 }), R2.message(v.split(`
1753
+ `).map(import_picocolors2.default.dim), { output: r, secondarySymbol: i, symbol: i, spacing: y2 ?? a });
1754
+ }, p = () => {
1755
+ for (const h of n) {
1756
+ const { header: y2, value: f, full: v } = h;
1757
+ (y2 === void 0 || y2.length === 0) && f.length === 0 || F(h, void 0, u === true && v.length > 0);
1758
+ }
1759
+ }, E = (h, y2, f) => {
1760
+ if (g(false), (f?.raw !== true || !c) && h.value !== "" && (h.value += `
1761
+ `), h.value += ze(y2), c = f?.raw === true, t.limit !== void 0) {
1762
+ const v = h.value.split(`
1763
+ `), S2 = v.length - t.limit;
1764
+ if (S2 > 0) {
1765
+ const I2 = v.splice(0, S2);
1766
+ u && (h.full += (h.full === "" ? "" : `
1767
+ `) + I2.join(`
1768
+ `));
1769
+ }
1770
+ h.value = v.join(`
1771
+ `);
1772
+ }
1773
+ l && $();
1774
+ }, $ = () => {
1775
+ for (const h of n) h.result ? h.result.status === "error" ? R2.error(h.result.message, { output: r, secondarySymbol: i, spacing: 0 }) : R2.success(h.result.message, { output: r, secondarySymbol: i, spacing: 0 }) : h.value !== "" && F(h, 0);
1776
+ }, m = (h, y2) => {
1777
+ g(false), h.result = y2, l && $();
1778
+ };
1779
+ return { message(h, y2) {
1780
+ E(n[0], h, y2);
1781
+ }, group(h) {
1782
+ const y2 = { header: h, value: "", full: "" };
1783
+ return n.push(y2), { message(f, v) {
1784
+ E(y2, f, v);
1785
+ }, error(f) {
1786
+ m(y2, { status: "error", message: f });
1787
+ }, success(f) {
1788
+ m(y2, { status: "success", message: f });
1789
+ } };
1790
+ }, error(h, y2) {
1791
+ g(true), R2.error(h, { output: r, secondarySymbol: i, spacing: 1 }), y2?.showLog !== false && p(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
1792
+ }, success(h, y2) {
1793
+ g(true), R2.success(h, { output: r, secondarySymbol: i, spacing: 1 }), y2?.showLog === true && p(), n.splice(1, n.length - 1), n[0].value = "", n[0].full = "";
1794
+ } };
1795
+ };
1796
+ Ze = (t) => new $t({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, output: t.output, signal: t.signal, input: t.input, render() {
1797
+ const r = t?.withGuide ?? _.withGuide, s = `${`${r ? `${import_picocolors2.default.gray(d)}
1798
+ ` : ""}${W2(this.state)} `}${t.message}
1799
+ `, i = t.placeholder ? import_picocolors2.default.inverse(t.placeholder[0]) + import_picocolors2.default.dim(t.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
1800
+ switch (this.state) {
1801
+ case "error": {
1802
+ const u = this.error ? ` ${import_picocolors2.default.yellow(this.error)}` : "", l = r ? `${import_picocolors2.default.yellow(d)} ` : "", n = r ? import_picocolors2.default.yellow(x2) : "";
1803
+ return `${s.trim()}
1804
+ ${l}${a}
1805
+ ${n}${u}
1806
+ `;
1807
+ }
1808
+ case "submit": {
1809
+ const u = o ? ` ${import_picocolors2.default.dim(o)}` : "", l = r ? import_picocolors2.default.gray(d) : "";
1810
+ return `${s}${l}${u}`;
1811
+ }
1812
+ case "cancel": {
1813
+ const u = o ? ` ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o))}` : "", l = r ? import_picocolors2.default.gray(d) : "";
1814
+ return `${s}${l}${u}${o.trim() ? `
1815
+ ${l}` : ""}`;
1816
+ }
1817
+ default: {
1818
+ const u = r ? `${import_picocolors2.default.cyan(d)} ` : "", l = r ? import_picocolors2.default.cyan(x2) : "";
1819
+ return `${s}${u}${a}
1820
+ ${l}
1821
+ `;
1822
+ }
1823
+ }
1824
+ } }).prompt();
1825
+ }
1826
+ });
1827
+
1828
+ // packages/cli/src/bin/commands/type-check.ts
1829
+ init_utils();
1830
+ import { spawn } from "node:child_process";
1831
+ import { existsSync, readFileSync as readFileSync2, readdirSync, statSync } from "node:fs";
1832
+ import { join } from "node:path";
1833
+ function detectPackageManager(dir) {
1834
+ let current = dir;
1835
+ for (let i = 0; i < 10; i++) {
1836
+ if (existsSync(join(current, "bun.lockb"))) return "bun";
1837
+ if (existsSync(join(current, "yarn.lock"))) return "yarn";
1838
+ if (existsSync(join(current, "pnpm-lock.yaml"))) return "pnpm";
1839
+ if (existsSync(join(current, "package-lock.json"))) return "npm";
1840
+ const parent = join(current, "..");
1841
+ if (parent === current) break;
1842
+ current = parent;
1843
+ }
1844
+ return "bun";
1845
+ }
1846
+ var SKIP_DIRS = /* @__PURE__ */ new Set([
1847
+ "node_modules",
1848
+ "dist",
1849
+ ".next",
1850
+ ".turbo",
1851
+ "build",
1852
+ "coverage",
1853
+ ".git",
1854
+ ".bun"
1855
+ ]);
1856
+ function findPackageJsonFiles(rootDir) {
1857
+ const results = [];
1858
+ function walk(dir) {
1859
+ let entries;
1860
+ try {
1861
+ entries = readdirSync(dir);
1862
+ } catch {
1863
+ return;
1864
+ }
1865
+ for (const entry of entries) {
1866
+ if (SKIP_DIRS.has(entry)) continue;
1867
+ const fullPath = join(dir, entry);
1868
+ try {
1869
+ const stat = statSync(fullPath);
1870
+ if (stat.isDirectory()) {
1871
+ walk(fullPath);
1872
+ } else if (entry === "package.json") {
1873
+ results.push(fullPath);
1874
+ }
1875
+ } catch {
1876
+ }
1877
+ }
1878
+ }
1879
+ walk(rootDir);
1880
+ return results;
1881
+ }
1882
+ function discoverPackages(cwd, filter) {
1883
+ const packageFiles = findPackageJsonFiles(cwd);
1884
+ const packages = [];
1885
+ for (const pkgFile of packageFiles) {
1886
+ try {
1887
+ const raw = readFileSync2(pkgFile, "utf-8");
1888
+ const json = JSON.parse(raw);
1889
+ const name = typeof json.name === "string" ? json.name : void 0;
1890
+ const scripts = json.scripts ?? {};
1891
+ if (!scripts["type-check"]) continue;
1892
+ const pkgDir = join(pkgFile, "..");
1893
+ const relativePath = pkgDir === cwd ? "." : pkgDir.startsWith(cwd + "/") ? pkgDir.slice(cwd.length + 1) : pkgDir;
1894
+ if (filter) {
1895
+ const filterLower = filter.toLowerCase();
1896
+ const nameLower = (name ?? "").toLowerCase();
1897
+ const relLower = relativePath.toLowerCase();
1898
+ if (!nameLower.includes(filterLower) && !relLower.includes(filterLower)) {
1899
+ continue;
1900
+ }
1901
+ }
1902
+ packages.push({
1903
+ name: name ?? relativePath,
1904
+ path: pkgDir,
1905
+ relativePath
1906
+ });
1907
+ } catch {
1908
+ continue;
1909
+ }
1910
+ }
1911
+ return packages.sort((a, b) => a.name.localeCompare(b.name));
1912
+ }
1913
+ function parseTypeScriptErrors(output) {
1914
+ const lines = output.split("\n");
1915
+ const errorLines = [];
1916
+ const errorPattern = /error TS\d+/;
1917
+ let errorCount = 0;
1918
+ for (let i = 0; i < lines.length; i++) {
1919
+ const line = lines[i];
1920
+ if (!line) continue;
1921
+ if (errorPattern.test(line)) {
1922
+ errorCount++;
1923
+ errorLines.push(line.trim());
1924
+ if (i + 1 < lines.length) {
1925
+ const next = lines[i + 1];
1926
+ if (next && /^\s+/.test(next)) {
1927
+ errorLines.push(next.trimEnd());
1928
+ i++;
1929
+ }
1930
+ }
1931
+ }
1932
+ }
1933
+ return { errorCount, errorLines };
1934
+ }
1935
+ function runTypeCheckInPackage(pkg, pm) {
1936
+ return new Promise((resolve2) => {
1937
+ let stdout = "";
1938
+ let stderr = "";
1939
+ const [cmd, ...cmdArgs] = pm === "bun" ? ["bun", "run", "type-check"] : pm === "yarn" ? ["yarn", "run", "type-check"] : pm === "pnpm" ? ["pnpm", "run", "type-check"] : ["npm", "run", "type-check"];
1940
+ const child = spawn(cmd, cmdArgs, {
1941
+ cwd: pkg.path,
1942
+ stdio: "pipe",
1943
+ shell: true
1944
+ });
1945
+ child.stdout?.on("data", (data) => {
1946
+ stdout += data.toString("utf8");
1947
+ });
1948
+ child.stderr?.on("data", (data) => {
1949
+ stderr += data.toString("utf8");
1950
+ });
1951
+ child.on("close", (code) => {
1952
+ const allOutput = stdout + (stderr ? "\n" + stderr : "");
1953
+ const { errorCount, errorLines } = parseTypeScriptErrors(allOutput);
1954
+ resolve2({
1955
+ success: code === 0,
1956
+ output: allOutput,
1957
+ errors: errorLines,
1958
+ errorCount
1959
+ });
1960
+ });
1961
+ child.on("error", (err) => {
1962
+ const msg = `Failed to run type-check: ${err.message}`;
1963
+ resolve2({
1964
+ success: false,
1965
+ output: msg,
1966
+ errors: [msg],
1967
+ errorCount: 1
1968
+ });
1969
+ });
1970
+ });
1971
+ }
1972
+ async function runWithSpinner(pkg, pm) {
1973
+ const { spinner } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
1974
+ const s = spinner();
1975
+ s.start(`Type-checking ${pkg.name} (${pkg.relativePath})...`);
1976
+ const result = await runTypeCheckInPackage(pkg, pm);
1977
+ if (result.success) {
1978
+ s.stop(`${pkg.name} \u2014 No errors`);
1979
+ } else {
1980
+ s.stop(`${pkg.name} \u2014 ${result.errorCount} error(s)`);
1981
+ }
1982
+ return result;
1983
+ }
1984
+ async function main(options = {}) {
1985
+ const cwd = process.cwd();
1986
+ const isTTY = process.stdout.isTTY;
1987
+ const packages = discoverPackages(cwd, options.app);
1988
+ if (packages.length === 0) {
1989
+ if (isTTY) {
1990
+ if (options.app) {
1991
+ }
1992
+ } else {
1993
+ }
1994
+ return 0;
1995
+ }
1996
+ const pm = detectPackageManager(cwd);
1997
+ let passed = 0;
1998
+ let failed = 0;
1999
+ let totalErrors = 0;
2000
+ if (isTTY) {
2001
+ const { intro, outro } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
2002
+ intro("dndev tc \u2014 TypeScript type-check");
2003
+ const failedPackages = [];
2004
+ for (const pkg of packages) {
2005
+ const result = await runWithSpinner(pkg, pm);
2006
+ if (result.success) {
2007
+ passed++;
2008
+ } else {
2009
+ failed++;
2010
+ totalErrors += result.errorCount;
2011
+ failedPackages.push({ pkg, result });
2012
+ }
2013
+ }
2014
+ if (failedPackages.length > 0 && options.verbose) {
2015
+ const { log } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
2016
+ for (const { pkg, result } of failedPackages) {
2017
+ log.error(`
2018
+ ${pkg.name} (${pkg.relativePath}) \u2014 ${result.errorCount} error(s):`);
2019
+ for (const line of result.errors) {
2020
+ log.error(` ${line}`);
2021
+ }
2022
+ }
2023
+ } else if (failedPackages.length > 0) {
2024
+ const { log } = await Promise.resolve().then(() => (init_dist2(), dist_exports));
2025
+ log.info("Run with --verbose to see detailed error messages");
2026
+ }
2027
+ if (failed === 0) {
2028
+ outro(`All ${passed} package(s) passed type-check`);
2029
+ } else {
2030
+ outro(`${passed} passed, ${failed} failed, ${totalErrors} total error(s)`);
2031
+ }
2032
+ } else {
2033
+ for (const pkg of packages) {
2034
+ const result = await runTypeCheckInPackage(pkg, pm);
2035
+ if (result.success) {
2036
+ passed++;
2037
+ } else {
2038
+ for (const line of result.errors) {
2039
+ }
2040
+ failed++;
2041
+ totalErrors += result.errorCount;
2042
+ }
2043
+ }
2044
+ }
2045
+ return failed > 0 ? 1 : 0;
2046
+ }
2047
+ export {
2048
+ main
2049
+ };