@wangs-ui/create-react-app 1.0.30 → 1.0.32

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.
package/dist/bin.js CHANGED
@@ -1,9 +1,1093 @@
1
1
  #!/usr/bin/env node
2
2
  import path from "node:path";
3
- import process$1 from "node:process";
3
+ import process$1, { stdin, stdout } from "node:process";
4
4
  import fs from "node:fs";
5
5
  import { fileURLToPath } from "node:url";
6
- import { cancel, intro, isCancel, multiselect, outro, select, spinner, text } from "@clack/prompts";
6
+ import { styleText } from "node:util";
7
+ import * as l from "node:readline";
8
+ import l__default from "node:readline";
9
+ import { ReadStream } from "node:tty";
10
+ //#region \0rolldown/runtime.js
11
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
12
+ //#endregion
13
+ //#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
14
+ var getCodePointsLength = (() => {
15
+ const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
16
+ return (input) => {
17
+ let surrogatePairsNr = 0;
18
+ SURROGATE_PAIR_RE.lastIndex = 0;
19
+ while (SURROGATE_PAIR_RE.test(input)) surrogatePairsNr += 1;
20
+ return input.length - surrogatePairsNr;
21
+ };
22
+ })();
23
+ var isFullWidth = (x) => {
24
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
25
+ };
26
+ var isWideNotCJKTNotEmoji = (x) => {
27
+ return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
28
+ };
29
+ //#endregion
30
+ //#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
31
+ var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
32
+ var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
33
+ var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy;
34
+ var TAB_RE = /\t{1,1000}/y;
35
+ var EMOJI_RE = /[\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?))*/uy;
36
+ var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
37
+ var MODIFIER_RE = /\p{M}+/gu;
38
+ var NO_TRUNCATION$1 = {
39
+ limit: Infinity,
40
+ ellipsis: ""
41
+ };
42
+ var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
43
+ const LIMIT = truncationOptions.limit ?? Infinity;
44
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
45
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
46
+ const ANSI_WIDTH = 0;
47
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
48
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
49
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
50
+ const FULL_WIDTH_WIDTH = 2;
51
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
52
+ const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
53
+ const PARSE_BLOCKS = [
54
+ [LATIN_RE, REGULAR_WIDTH],
55
+ [ANSI_RE, ANSI_WIDTH],
56
+ [CONTROL_RE, CONTROL_WIDTH],
57
+ [TAB_RE, TAB_WIDTH],
58
+ [EMOJI_RE, EMOJI_WIDTH],
59
+ [CJKT_WIDE_RE, WIDE_WIDTH]
60
+ ];
61
+ let indexPrev = 0;
62
+ let index = 0;
63
+ let length = input.length;
64
+ let lengthExtra = 0;
65
+ let truncationEnabled = false;
66
+ let truncationIndex = length;
67
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
68
+ let unmatchedStart = 0;
69
+ let unmatchedEnd = 0;
70
+ let width = 0;
71
+ let widthExtra = 0;
72
+ outer: while (true) {
73
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
74
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
75
+ lengthExtra = 0;
76
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
77
+ const codePoint = char.codePointAt(0) || 0;
78
+ if (isFullWidth(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
79
+ else if (isWideNotCJKTNotEmoji(codePoint)) widthExtra = WIDE_WIDTH;
80
+ else widthExtra = REGULAR_WIDTH;
81
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
82
+ if (width + widthExtra > LIMIT) {
83
+ truncationEnabled = true;
84
+ break outer;
85
+ }
86
+ lengthExtra += char.length;
87
+ width += widthExtra;
88
+ }
89
+ unmatchedStart = unmatchedEnd = 0;
90
+ }
91
+ if (index >= length) break outer;
92
+ for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
93
+ const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
94
+ BLOCK_RE.lastIndex = index;
95
+ if (BLOCK_RE.test(input)) {
96
+ lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
97
+ widthExtra = lengthExtra * BLOCK_WIDTH;
98
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
99
+ if (width + widthExtra > LIMIT) {
100
+ truncationEnabled = true;
101
+ break outer;
102
+ }
103
+ width += widthExtra;
104
+ unmatchedStart = indexPrev;
105
+ unmatchedEnd = index;
106
+ index = indexPrev = BLOCK_RE.lastIndex;
107
+ continue outer;
108
+ }
109
+ }
110
+ index += 1;
111
+ }
112
+ return {
113
+ width: truncationEnabled ? truncationLimit : width,
114
+ index: truncationEnabled ? truncationIndex : length,
115
+ truncated: truncationEnabled,
116
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
117
+ };
118
+ };
119
+ //#endregion
120
+ //#region ../../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
121
+ var NO_TRUNCATION = {
122
+ limit: Infinity,
123
+ ellipsis: "",
124
+ ellipsisWidth: 0
125
+ };
126
+ var fastStringWidth = (input, options = {}) => {
127
+ return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
128
+ };
129
+ //#endregion
130
+ //#region ../../node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
131
+ var ESC = "\x1B";
132
+ var CSI = "›";
133
+ var END_CODE = 39;
134
+ var ANSI_ESCAPE_BELL = "\x07";
135
+ var ANSI_CSI = "[";
136
+ var ANSI_OSC = "]";
137
+ var ANSI_SGR_TERMINATOR = "m";
138
+ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
139
+ var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
140
+ var getClosingCode = (openingCode) => {
141
+ if (openingCode >= 30 && openingCode <= 37) return 39;
142
+ if (openingCode >= 90 && openingCode <= 97) return 39;
143
+ if (openingCode >= 40 && openingCode <= 47) return 49;
144
+ if (openingCode >= 100 && openingCode <= 107) return 49;
145
+ if (openingCode === 1 || openingCode === 2) return 22;
146
+ if (openingCode === 3) return 23;
147
+ if (openingCode === 4) return 24;
148
+ if (openingCode === 7) return 27;
149
+ if (openingCode === 8) return 28;
150
+ if (openingCode === 9) return 29;
151
+ if (openingCode === 0) return 0;
152
+ };
153
+ var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
154
+ var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
155
+ var wrapWord = (rows, word, columns) => {
156
+ const characters = word[Symbol.iterator]();
157
+ let isInsideEscape = false;
158
+ let isInsideLinkEscape = false;
159
+ let lastRow = rows.at(-1);
160
+ let visible = lastRow === void 0 ? 0 : fastStringWidth(lastRow);
161
+ let currentCharacter = characters.next();
162
+ let nextCharacter = characters.next();
163
+ let rawCharacterIndex = 0;
164
+ while (!currentCharacter.done) {
165
+ const character = currentCharacter.value;
166
+ const characterLength = fastStringWidth(character);
167
+ if (visible + characterLength <= columns) rows[rows.length - 1] += character;
168
+ else {
169
+ rows.push(character);
170
+ visible = 0;
171
+ }
172
+ if (character === ESC || character === CSI) {
173
+ isInsideEscape = true;
174
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
175
+ }
176
+ if (isInsideEscape) {
177
+ if (isInsideLinkEscape) {
178
+ if (character === ANSI_ESCAPE_BELL) {
179
+ isInsideEscape = false;
180
+ isInsideLinkEscape = false;
181
+ }
182
+ } else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
183
+ } else {
184
+ visible += characterLength;
185
+ if (visible === columns && !nextCharacter.done) {
186
+ rows.push("");
187
+ visible = 0;
188
+ }
189
+ }
190
+ currentCharacter = nextCharacter;
191
+ nextCharacter = characters.next();
192
+ rawCharacterIndex += character.length;
193
+ }
194
+ lastRow = rows.at(-1);
195
+ if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
196
+ };
197
+ var stringVisibleTrimSpacesRight = (string) => {
198
+ const words = string.split(" ");
199
+ let last = words.length;
200
+ while (last) {
201
+ if (fastStringWidth(words[last - 1])) break;
202
+ last--;
203
+ }
204
+ if (last === words.length) return string;
205
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
206
+ };
207
+ var exec = (string, columns, options = {}) => {
208
+ if (options.trim !== false && string.trim() === "") return "";
209
+ let returnValue = "";
210
+ let escapeCode;
211
+ let escapeUrl;
212
+ const words = string.split(" ");
213
+ let rows = [""];
214
+ let rowLength = 0;
215
+ for (let index = 0; index < words.length; index++) {
216
+ const word = words[index];
217
+ if (options.trim !== false) {
218
+ const row = rows.at(-1) ?? "";
219
+ const trimmed = row.trimStart();
220
+ if (row.length !== trimmed.length) {
221
+ rows[rows.length - 1] = trimmed;
222
+ rowLength = fastStringWidth(trimmed);
223
+ }
224
+ }
225
+ if (index !== 0) {
226
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
227
+ rows.push("");
228
+ rowLength = 0;
229
+ }
230
+ if (rowLength || options.trim === false) {
231
+ rows[rows.length - 1] += " ";
232
+ rowLength++;
233
+ }
234
+ }
235
+ const wordLength = fastStringWidth(word);
236
+ if (options.hard && wordLength > columns) {
237
+ const remainingColumns = columns - rowLength;
238
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
239
+ if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
240
+ wrapWord(rows, word, columns);
241
+ rowLength = fastStringWidth(rows.at(-1) ?? "");
242
+ continue;
243
+ }
244
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
245
+ if (options.wordWrap === false && rowLength < columns) {
246
+ wrapWord(rows, word, columns);
247
+ rowLength = fastStringWidth(rows.at(-1) ?? "");
248
+ continue;
249
+ }
250
+ rows.push("");
251
+ rowLength = 0;
252
+ }
253
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
254
+ wrapWord(rows, word, columns);
255
+ rowLength = fastStringWidth(rows.at(-1) ?? "");
256
+ continue;
257
+ }
258
+ rows[rows.length - 1] += word;
259
+ rowLength += wordLength;
260
+ }
261
+ if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
262
+ const preString = rows.join("\n");
263
+ let inSurrogate = false;
264
+ for (let i = 0; i < preString.length; i++) {
265
+ const character = preString[i];
266
+ returnValue += character;
267
+ if (!inSurrogate) {
268
+ inSurrogate = character >= "\ud800" && character <= "\udbff";
269
+ if (inSurrogate) continue;
270
+ } else inSurrogate = false;
271
+ if (character === ESC || character === CSI) {
272
+ GROUP_REGEX.lastIndex = i + 1;
273
+ const groups = GROUP_REGEX.exec(preString)?.groups;
274
+ if (groups?.code !== void 0) {
275
+ const code = Number.parseFloat(groups.code);
276
+ escapeCode = code === END_CODE ? void 0 : code;
277
+ } else if (groups?.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
278
+ }
279
+ if (preString[i + 1] === "\n") {
280
+ if (escapeUrl) returnValue += wrapAnsiHyperlink("");
281
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
282
+ if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
283
+ } else if (character === "\n") {
284
+ if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
285
+ if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
286
+ }
287
+ }
288
+ return returnValue;
289
+ };
290
+ var CRLF_OR_LF = /\r?\n/;
291
+ function wrapAnsi(string, columns, options) {
292
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
293
+ }
294
+ //#endregion
295
+ //#region ../../node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs
296
+ var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
297
+ var ESC = "\x1B";
298
+ var CSI = `${ESC}[`;
299
+ var beep = "\x07";
300
+ var cursor = {
301
+ to(x, y) {
302
+ if (!y) return `${CSI}${x + 1}G`;
303
+ return `${CSI}${y + 1};${x + 1}H`;
304
+ },
305
+ move(x, y) {
306
+ let ret = "";
307
+ if (x < 0) ret += `${CSI}${-x}D`;
308
+ else if (x > 0) ret += `${CSI}${x}C`;
309
+ if (y < 0) ret += `${CSI}${-y}A`;
310
+ else if (y > 0) ret += `${CSI}${y}B`;
311
+ return ret;
312
+ },
313
+ up: (count = 1) => `${CSI}${count}A`,
314
+ down: (count = 1) => `${CSI}${count}B`,
315
+ forward: (count = 1) => `${CSI}${count}C`,
316
+ backward: (count = 1) => `${CSI}${count}D`,
317
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
318
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
319
+ left: `${CSI}G`,
320
+ hide: `${CSI}?25l`,
321
+ show: `${CSI}?25h`,
322
+ save: `${ESC}7`,
323
+ restore: `${ESC}8`
324
+ };
325
+ module.exports = {
326
+ cursor,
327
+ scroll: {
328
+ up: (count = 1) => `${CSI}S`.repeat(count),
329
+ down: (count = 1) => `${CSI}T`.repeat(count)
330
+ },
331
+ erase: {
332
+ screen: `${CSI}2J`,
333
+ up: (count = 1) => `${CSI}1J`.repeat(count),
334
+ down: (count = 1) => `${CSI}J`.repeat(count),
335
+ line: `${CSI}2K`,
336
+ lineEnd: `${CSI}K`,
337
+ lineStart: `${CSI}1K`,
338
+ lines(count) {
339
+ let clear = "";
340
+ for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
341
+ if (count) clear += cursor.left;
342
+ return clear;
343
+ }
344
+ },
345
+ beep
346
+ };
347
+ })))();
348
+ function findCursor(s, o, l) {
349
+ if (!l.some((r) => !r.disabled)) return s;
350
+ const t = s + o, n = Math.max(l.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
351
+ return l[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l) : e;
352
+ }
353
+ var settings = {
354
+ actions: new Set([
355
+ "up",
356
+ "down",
357
+ "left",
358
+ "right",
359
+ "space",
360
+ "enter",
361
+ "cancel"
362
+ ]),
363
+ aliases: /* @__PURE__ */ new Map([
364
+ ["k", "up"],
365
+ ["j", "down"],
366
+ ["h", "left"],
367
+ ["l", "right"],
368
+ ["", "cancel"],
369
+ ["escape", "cancel"]
370
+ ]),
371
+ messages: {
372
+ cancel: "Canceled",
373
+ error: "Something went wrong"
374
+ },
375
+ withGuide: true,
376
+ date: {
377
+ monthNames: [...[
378
+ "January",
379
+ "February",
380
+ "March",
381
+ "April",
382
+ "May",
383
+ "June",
384
+ "July",
385
+ "August",
386
+ "September",
387
+ "October",
388
+ "November",
389
+ "December"
390
+ ]],
391
+ messages: {
392
+ required: "Please enter a valid date",
393
+ invalidMonth: "There are only 12 months in a year",
394
+ invalidDay: (n, e) => `There are only ${n} days in ${e}`,
395
+ afterMin: (n) => `Date must be on or after ${n.toISOString().slice(0, 10)}`,
396
+ beforeMax: (n) => `Date must be on or before ${n.toISOString().slice(0, 10)}`
397
+ }
398
+ }
399
+ };
400
+ function isActionKey(n, e) {
401
+ if (typeof n == "string") return settings.aliases.get(n) === e;
402
+ for (const s of n) if (s !== void 0 && isActionKey(s, e)) return true;
403
+ return false;
404
+ }
405
+ function diffLines(i, s) {
406
+ if (i === s) return;
407
+ const e = i.split(`
408
+ `), t = s.split(`
409
+ `), r = Math.max(e.length, t.length), f = [];
410
+ for (let n = 0; n < r; n++) e[n] !== t[n] && f.push(n);
411
+ return {
412
+ lines: f,
413
+ numLinesBefore: e.length,
414
+ numLinesAfter: t.length,
415
+ numLines: r
416
+ };
417
+ }
418
+ var R = globalThis.process.platform.startsWith("win");
419
+ var CANCEL_SYMBOL = Symbol("clack:cancel");
420
+ function isCancel(e) {
421
+ return e === CANCEL_SYMBOL;
422
+ }
423
+ function setRawMode(e, r) {
424
+ const o = e;
425
+ o.isTTY && o.setRawMode(r);
426
+ }
427
+ function block({ input: e = stdin, output: r = stdout, overwrite: o = true, hideCursor: t = true } = {}) {
428
+ const s = l.createInterface({
429
+ input: e,
430
+ output: r,
431
+ prompt: "",
432
+ tabSize: 1
433
+ });
434
+ l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
435
+ const n = (f, { name: a, sequence: p }) => {
436
+ if (isActionKey([
437
+ String(f),
438
+ a,
439
+ p
440
+ ], "cancel")) {
441
+ t && r.write(import_src.cursor.show), process.exit(0);
442
+ return;
443
+ }
444
+ if (!o) return;
445
+ const i = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
446
+ l.moveCursor(r, i, m, () => {
447
+ l.clearLine(r, 1, () => {
448
+ e.once("keypress", n);
449
+ });
450
+ });
451
+ };
452
+ return t && r.write(import_src.cursor.hide), e.once("keypress", n), () => {
453
+ e.off("keypress", n), t && r.write(import_src.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
454
+ };
455
+ }
456
+ var getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80, getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
457
+ function wrapTextWithPrefix(e, r, o, t = o, s = o, n) {
458
+ return wrapAnsi(r, getColumns(e ?? stdout) - o.length, {
459
+ hard: true,
460
+ trim: false
461
+ }).split(`
462
+ `).map((c, i, m) => {
463
+ const d = n ? n(c, i) : c;
464
+ return i === 0 ? `${t}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
465
+ }).join(`
466
+ `);
467
+ }
468
+ function runValidation(e, n) {
469
+ if ("~standard" in e) {
470
+ const a = e["~standard"].validate(n);
471
+ if (a instanceof Promise) throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
472
+ return a.issues?.at(0)?.message;
473
+ }
474
+ return e(n);
475
+ }
476
+ var V = class {
477
+ input;
478
+ output;
479
+ _abortSignal;
480
+ rl;
481
+ opts;
482
+ _render;
483
+ _track = false;
484
+ _prevFrame = "";
485
+ _subscribers = /* @__PURE__ */ new Map();
486
+ _cursor = 0;
487
+ state = "initial";
488
+ error = "";
489
+ value;
490
+ userInput = "";
491
+ constructor(t, e = true) {
492
+ const { input: i = stdin, output: n = stdout, render: s, signal: r, ...o } = t;
493
+ this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s.bind(this), this._track = e, this._abortSignal = r, this.input = i, this.output = n;
494
+ }
495
+ /**
496
+ * Unsubscribe all listeners
497
+ */
498
+ unsubscribe() {
499
+ this._subscribers.clear();
500
+ }
501
+ /**
502
+ * Set a subscriber with opts
503
+ * @param event - The event name
504
+ */
505
+ setSubscriber(t, e) {
506
+ const i = this._subscribers.get(t) ?? [];
507
+ i.push(e), this._subscribers.set(t, i);
508
+ }
509
+ /**
510
+ * Subscribe to an event
511
+ * @param event - The event name
512
+ * @param cb - The callback
513
+ */
514
+ on(t, e) {
515
+ this.setSubscriber(t, { cb: e });
516
+ }
517
+ /**
518
+ * Subscribe to an event once
519
+ * @param event - The event name
520
+ * @param cb - The callback
521
+ */
522
+ once(t, e) {
523
+ this.setSubscriber(t, {
524
+ cb: e,
525
+ once: true
526
+ });
527
+ }
528
+ /**
529
+ * Emit an event with data
530
+ * @param event - The event name
531
+ * @param data - The data to pass to the callback
532
+ */
533
+ emit(t, ...e) {
534
+ const i = this._subscribers.get(t) ?? [], n = [];
535
+ for (const s of i) s.cb(...e), s.once && n.push(() => i.splice(i.indexOf(s), 1));
536
+ for (const s of n) s();
537
+ }
538
+ prompt() {
539
+ return new Promise((t) => {
540
+ if (this._abortSignal) {
541
+ if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(CANCEL_SYMBOL);
542
+ this._abortSignal.addEventListener("abort", () => {
543
+ this.state = "cancel", this.close();
544
+ }, { once: true });
545
+ }
546
+ this.rl = l__default.createInterface({
547
+ input: this.input,
548
+ tabSize: 2,
549
+ prompt: "",
550
+ escapeCodeTimeout: 50,
551
+ terminal: true
552
+ }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
553
+ this.output.write(import_src.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(this.value);
554
+ }), this.once("cancel", () => {
555
+ this.output.write(import_src.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(CANCEL_SYMBOL);
556
+ });
557
+ });
558
+ }
559
+ _isActionKey(t, e) {
560
+ return t === " ";
561
+ }
562
+ _shouldSubmit(t, e) {
563
+ return true;
564
+ }
565
+ _setValue(t) {
566
+ this.value = t, this.emit("value", this.value);
567
+ }
568
+ _setUserInput(t, e) {
569
+ this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
570
+ }
571
+ _clearUserInput() {
572
+ this.rl?.write(null, {
573
+ ctrl: true,
574
+ name: "u"
575
+ }), this._setUserInput("");
576
+ }
577
+ onKeypress(t, e) {
578
+ if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
579
+ ctrl: true,
580
+ name: "h"
581
+ }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t, e), e?.name === "return" && this._shouldSubmit(t, e)) {
582
+ if (this.opts.validate) {
583
+ const i = runValidation(this.opts.validate, this.value);
584
+ i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
585
+ }
586
+ this.state !== "error" && (this.state = "submit");
587
+ }
588
+ isActionKey([
589
+ t,
590
+ e?.name,
591
+ e?.sequence
592
+ ], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
593
+ }
594
+ close() {
595
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
596
+ `), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
597
+ }
598
+ restoreCursor() {
599
+ const t = wrapAnsi(this._prevFrame, process.stdout.columns, {
600
+ hard: true,
601
+ trim: false
602
+ }).split(`
603
+ `).length - 1;
604
+ this.output.write(import_src.cursor.move(-999, t * -1));
605
+ }
606
+ render() {
607
+ const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
608
+ hard: true,
609
+ trim: false
610
+ });
611
+ if (t !== this._prevFrame) {
612
+ if (this.state === "initial") this.output.write(import_src.cursor.hide);
613
+ else {
614
+ const e = diffLines(this._prevFrame, t), i = getRows(this.output);
615
+ if (this.restoreCursor(), e) {
616
+ const n = Math.max(0, e.numLinesAfter - i), s = Math.max(0, e.numLinesBefore - i);
617
+ let r = e.lines.find((o) => o >= n);
618
+ if (r === void 0) {
619
+ this._prevFrame = t;
620
+ return;
621
+ }
622
+ if (e.lines.length === 1) {
623
+ this.output.write(import_src.cursor.move(0, r - s)), this.output.write(import_src.erase.lines(1));
624
+ const o = t.split(`
625
+ `);
626
+ this.output.write(o[r]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, o.length - r - 1));
627
+ return;
628
+ } else if (e.lines.length > 1) {
629
+ if (n < s) r = n;
630
+ else {
631
+ const h = r - s;
632
+ h > 0 && this.output.write(import_src.cursor.move(0, h));
633
+ }
634
+ this.output.write(import_src.erase.down());
635
+ const f = t.split(`
636
+ `).slice(r);
637
+ this.output.write(f.join(`
638
+ `)), this._prevFrame = t;
639
+ return;
640
+ }
641
+ }
642
+ this.output.write(import_src.erase.down());
643
+ }
644
+ this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
645
+ }
646
+ }
647
+ };
648
+ var a = class extends V {
649
+ options;
650
+ cursor = 0;
651
+ get _value() {
652
+ return this.options[this.cursor]?.value;
653
+ }
654
+ get _enabledOptions() {
655
+ return this.options.filter((e) => e.disabled !== true);
656
+ }
657
+ toggleAll() {
658
+ const e = this._enabledOptions, i = this.value !== void 0 && this.value.length === e.length;
659
+ this.value = i ? [] : e.map((t) => t.value);
660
+ }
661
+ toggleInvert() {
662
+ const e = this.value;
663
+ if (!e) return;
664
+ const i = this._enabledOptions.filter((t) => !e.includes(t.value));
665
+ this.value = i.map((t) => t.value);
666
+ }
667
+ toggleValue() {
668
+ this.value === void 0 && (this.value = []);
669
+ const e = this.value.includes(this._value);
670
+ this.value = e ? this.value.filter((i) => i !== this._value) : [...this.value, this._value];
671
+ }
672
+ constructor(e) {
673
+ super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
674
+ const i = Math.max(this.options.findIndex(({ value: t }) => t === e.cursorAt), 0);
675
+ this.cursor = this.options[i]?.disabled ? findCursor(i, 1, this.options) : i, this.on("key", (t, l) => {
676
+ l.name === "a" && this.toggleAll(), l.name === "i" && this.toggleInvert();
677
+ }), this.on("cursor", (t) => {
678
+ switch (t) {
679
+ case "left":
680
+ case "up":
681
+ this.cursor = findCursor(this.cursor, -1, this.options);
682
+ break;
683
+ case "down":
684
+ case "right":
685
+ this.cursor = findCursor(this.cursor, 1, this.options);
686
+ break;
687
+ case "space":
688
+ this.toggleValue();
689
+ break;
690
+ }
691
+ });
692
+ }
693
+ };
694
+ var n$1 = class n extends V {
695
+ options;
696
+ cursor = 0;
697
+ get _selectedValue() {
698
+ return this.options[this.cursor];
699
+ }
700
+ changeValue() {
701
+ const e = this._selectedValue;
702
+ this.value = e === void 0 ? void 0 : e.value;
703
+ }
704
+ constructor(e) {
705
+ super(e, false), this.options = e.options;
706
+ const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t = o === -1 ? 0 : o;
707
+ this.cursor = this.options[t]?.disabled ? findCursor(t, 1, this.options) : t, this.changeValue(), this.on("cursor", (s) => {
708
+ switch (s) {
709
+ case "left":
710
+ case "up":
711
+ this.cursor = findCursor(this.cursor, -1, this.options);
712
+ break;
713
+ case "down":
714
+ case "right":
715
+ this.cursor = findCursor(this.cursor, 1, this.options);
716
+ break;
717
+ }
718
+ this.changeValue();
719
+ });
720
+ }
721
+ };
722
+ var n = class extends V {
723
+ get userInputWithCursor() {
724
+ if (this.state === "submit") return this.userInput;
725
+ const t = this.userInput;
726
+ if (this.cursor >= t.length) return `${this.userInput}\u2588`;
727
+ const r = t.slice(0, this.cursor), s = t.slice(this.cursor, this.cursor + 1), e = t.slice(this.cursor + 1);
728
+ return `${r}${styleText("inverse", s)}${e}`;
729
+ }
730
+ get cursor() {
731
+ return this._cursor;
732
+ }
733
+ constructor(t) {
734
+ super({
735
+ ...t,
736
+ initialUserInput: t.initialUserInput ?? t.initialValue
737
+ }), this.on("userInput", (r) => {
738
+ this._setValue(r);
739
+ }), this.on("finalize", () => {
740
+ this.value || (this.value = t.defaultValue), this.value === void 0 && (this.value = "");
741
+ });
742
+ }
743
+ };
744
+ //#endregion
745
+ //#region ../../node_modules/.pnpm/@clack+prompts@1.7.0/node_modules/@clack/prompts/dist/index.mjs
746
+ function isUnicodeSupported() {
747
+ if (process$1.platform !== "win32") return process$1.env.TERM !== "linux";
748
+ return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
749
+ }
750
+ var unicode = isUnicodeSupported(), isCI = () => process.env.CI === "true", unicodeOr = (o, e) => unicode ? o : e, S_STEP_ACTIVE = unicodeOr("◆", "*"), S_STEP_CANCEL = unicodeOr("■", "x"), S_STEP_ERROR = unicodeOr("▲", "x"), S_STEP_SUBMIT = unicodeOr("◇", "o"), S_BAR_START = unicodeOr("┌", "T"), S_BAR = unicodeOr("│", "|"), S_BAR_END = unicodeOr("└", "—"), S_RADIO_ACTIVE = unicodeOr("●", ">"), S_RADIO_INACTIVE = unicodeOr("○", " "), S_CHECKBOX_ACTIVE = unicodeOr("◻", "[•]"), S_CHECKBOX_SELECTED = unicodeOr("◼", "[+]"), S_CHECKBOX_INACTIVE = unicodeOr("◻", "[ ]"), symbol = (o) => {
751
+ switch (o) {
752
+ case "initial":
753
+ case "active": return styleText("cyan", S_STEP_ACTIVE);
754
+ case "cancel": return styleText("red", S_STEP_CANCEL);
755
+ case "error": return styleText("yellow", S_STEP_ERROR);
756
+ case "submit": return styleText("green", S_STEP_SUBMIT);
757
+ }
758
+ }, symbolBar = (o) => {
759
+ switch (o) {
760
+ case "initial":
761
+ case "active": return styleText("cyan", S_BAR);
762
+ case "cancel": return styleText("red", S_BAR);
763
+ case "error": return styleText("yellow", S_BAR);
764
+ case "submit": return styleText("green", S_BAR);
765
+ }
766
+ };
767
+ function formatInstructionFooter(o, e) {
768
+ const r = [`${e ? `${styleText("cyan", S_BAR)} ` : ""}${o.join(" • ")}`];
769
+ return e && r.push(styleText("cyan", S_BAR_END)), r;
770
+ }
771
+ var I = (l, e, w, p, b, C = false) => {
772
+ let r = e, O = 0;
773
+ if (C) for (let i = p - 1; i >= w; i--) {
774
+ const m = l[i];
775
+ if (m && (r -= m.length), O++, r <= b) break;
776
+ }
777
+ else for (let i = w; i < p; i++) {
778
+ const m = l[i];
779
+ if (m && (r -= m.length), O++, r <= b) break;
780
+ }
781
+ return {
782
+ lineCount: r,
783
+ removals: O
784
+ };
785
+ };
786
+ var limitOptions = ({ cursor: l, options: e, style: w, output: p = process.stdout, maxItems: b = Number.POSITIVE_INFINITY, columnPadding: C = 0, rowPadding: r = 4 }) => {
787
+ const i = getColumns(p) - C, m = getRows(p), M = styleText("dim", "..."), v = Math.max(m - r, 0), a = Math.max(Math.min(b, v), 5);
788
+ let f = 0;
789
+ l >= a - 3 && (f = Math.max(Math.min(l - a + 3, e.length - a), 0));
790
+ let d = a < e.length && f > 0, c = a < e.length && f + a < e.length;
791
+ const W = Math.min(f + a, e.length), s = [];
792
+ let g = 0;
793
+ d && g++, c && g++;
794
+ const T = f + (d ? 1 : 0), y = W - (c ? 1 : 0);
795
+ for (let t = T; t < y; t++) {
796
+ const n = e[t], h = wrapAnsi(n ? w(n, t === l) : "", i, {
797
+ hard: true,
798
+ trim: false
799
+ }).split(`
800
+ `);
801
+ s.push(h), g += h.length;
802
+ }
803
+ if (g > v) {
804
+ let t = 0, n = 0, o = g;
805
+ const h = l - T;
806
+ let u = v;
807
+ const L = () => I(s, o, 0, h, u), E = () => I(s, o, h + 1, s.length, u, true);
808
+ d ? ({lineCount: o, removals: t} = L(), o > u && (c || (u -= 1), {lineCount: o, removals: n} = E())) : (c || (u -= 1), {lineCount: o, removals: n} = E(), o > u && (u -= 1, {lineCount: o, removals: t} = L())), t > 0 && (d = true, s.splice(0, t)), n > 0 && (c = true, s.splice(s.length - n, n));
809
+ }
810
+ const x = [];
811
+ d && x.push(M);
812
+ for (const t of s) for (const n of t) x.push(n);
813
+ return c && x.push(M), x;
814
+ };
815
+ var MULTISELECT_INSTRUCTIONS = [
816
+ `${styleText("dim", "↑/↓")} to navigate`,
817
+ `${styleText("dim", "Space:")} select`,
818
+ `${styleText("dim", "Enter:")} confirm`
819
+ ];
820
+ var m = (i, u) => i.split(`
821
+ `).map((d) => u(d)).join(`
822
+ `);
823
+ var multiselect = (i) => {
824
+ const u = (t, a) => {
825
+ const r = t.label ?? String(t.value);
826
+ return a === "disabled" ? `${styleText("gray", S_CHECKBOX_INACTIVE)} ${m(r, (o) => styleText(["strikethrough", "gray"], o))}${t.hint ? ` ${styleText("dim", `(${t.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${styleText("cyan", S_CHECKBOX_ACTIVE)} ${r}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "selected" ? `${styleText("green", S_CHECKBOX_SELECTED)} ${m(r, (o) => styleText("dim", o))}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "cancelled" ? `${m(r, (o) => styleText(["strikethrough", "dim"], o))}` : a === "active-selected" ? `${styleText("green", S_CHECKBOX_SELECTED)} ${r}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "submitted" ? `${m(r, (o) => styleText("dim", o))}` : `${styleText("dim", S_CHECKBOX_INACTIVE)} ${m(r, (o) => styleText("dim", o))}`;
827
+ }, d = i.required ?? true, v = i.showInstructions ?? true;
828
+ return new a({
829
+ options: i.options,
830
+ signal: i.signal,
831
+ input: i.input,
832
+ output: i.output,
833
+ initialValues: i.initialValues,
834
+ required: d,
835
+ cursorAt: i.cursorAt,
836
+ validate(t) {
837
+ if (d && (t === void 0 || t.length === 0)) return `Please select at least one option.
838
+ ${styleText("reset", styleText("dim", `Press ${styleText([
839
+ "gray",
840
+ "bgWhite",
841
+ "inverse"
842
+ ], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
843
+ },
844
+ render() {
845
+ const t = i.withGuide ?? settings.withGuide, a = wrapTextWithPrefix(i.output, i.message, t ? `${symbolBar(this.state)} ` : "", `${symbol(this.state)} `), r = `${t ? `${styleText("gray", S_BAR)}
846
+ ` : ""}${a}
847
+ `, o = this.value ?? [], p = (n, l) => {
848
+ if (n.disabled) return u(n, "disabled");
849
+ const s = o.includes(n.value);
850
+ return l && s ? u(n, "active-selected") : s ? u(n, "selected") : u(n, l ? "active" : "inactive");
851
+ };
852
+ switch (this.state) {
853
+ case "submit": {
854
+ const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none");
855
+ return `${r}${wrapTextWithPrefix(i.output, n, t ? `${styleText("gray", S_BAR)} ` : "")}`;
856
+ }
857
+ case "cancel": {
858
+ const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "cancelled")).join(styleText("dim", ", "));
859
+ if (n.trim() === "") return `${r}${styleText("gray", S_BAR)}`;
860
+ return `${r}${wrapTextWithPrefix(i.output, n, t ? `${styleText("gray", S_BAR)} ` : "")}${t ? `
861
+ ${styleText("gray", S_BAR)}` : ""}`;
862
+ }
863
+ case "error": {
864
+ const n = t ? `${styleText("yellow", S_BAR)} ` : "", l = this.error.split(`
865
+ `).map(($, C) => C === 0 ? `${t ? `${styleText("yellow", S_BAR_END)} ` : ""}${styleText("yellow", $)}` : ` ${$}`).join(`
866
+ `), s = r.split(`
867
+ `).length, h = l.split(`
868
+ `).length + 1;
869
+ return `${r}${n}${limitOptions({
870
+ output: i.output,
871
+ options: this.options,
872
+ cursor: this.cursor,
873
+ maxItems: i.maxItems,
874
+ columnPadding: n.length,
875
+ rowPadding: s + h,
876
+ style: p
877
+ }).join(`
878
+ ${n}`)}
879
+ ${l}
880
+ `;
881
+ }
882
+ default: {
883
+ const n = t ? `${styleText("cyan", S_BAR)} ` : "", l = r.split(`
884
+ `).length, s = v ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t) : t ? [styleText("cyan", S_BAR_END)] : [], h = s.join(`
885
+ `), $ = s.length + 1;
886
+ return `${r}${n}${limitOptions({
887
+ output: i.output,
888
+ options: this.options,
889
+ cursor: this.cursor,
890
+ maxItems: i.maxItems,
891
+ columnPadding: n.length,
892
+ rowPadding: l + $,
893
+ style: p
894
+ }).join(`
895
+ ${n}`)}
896
+ ${h}
897
+ `;
898
+ }
899
+ }
900
+ }
901
+ }).prompt();
902
+ };
903
+ var cancel = (o = "", t) => {
904
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR_END)} ` : "";
905
+ i.write(`${e}${styleText("red", o)}
906
+
907
+ `);
908
+ }, intro = (o = "", t) => {
909
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR_START)} ` : "";
910
+ i.write(`${e}${o}
911
+ `);
912
+ }, outro = (o = "", t) => {
913
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText("gray", S_BAR)}
914
+ ${styleText("gray", S_BAR_END)} ` : "";
915
+ i.write(`${e}${o}
916
+
917
+ `);
918
+ };
919
+ var W = (l) => styleText("magenta", l);
920
+ var spinner = ({ indicator: l = "dots", onCancel: h, output: n = process.stdout, cancelMessage: G, errorMessage: O, frames: E = unicode ? [
921
+ "◒",
922
+ "◐",
923
+ "◓",
924
+ "◑"
925
+ ] : [
926
+ "•",
927
+ "o",
928
+ "O",
929
+ "0"
930
+ ], delay: F = unicode ? 80 : 120, signal: m, ...I } = {}) => {
931
+ const u = isCI();
932
+ let M, T, d = false, S = false, s = "", p, w = performance.now();
933
+ const x = getColumns(n), k = I?.styleFrame ?? W, g = (e) => {
934
+ const r = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
935
+ S = e === 1, d && (a(r, e), S && typeof h == "function" && h());
936
+ }, f = () => g(2), i = () => g(1), A = () => {
937
+ process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i), process.on("SIGTERM", i), process.on("exit", g), m && m.addEventListener("abort", i);
938
+ }, H = () => {
939
+ process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i), process.removeListener("SIGTERM", i), process.removeListener("exit", g), m && m.removeEventListener("abort", i);
940
+ }, y = () => {
941
+ if (p === void 0) return;
942
+ u && n.write(`
943
+ `);
944
+ const r = wrapAnsi(p, x, {
945
+ hard: true,
946
+ trim: false
947
+ }).split(`
948
+ `);
949
+ r.length > 1 && n.write(import_src.cursor.up(r.length - 1)), n.write(import_src.cursor.to(0)), n.write(import_src.erase.down());
950
+ }, C = (e) => e.replace(/\.+$/, ""), _ = (e) => {
951
+ const r = (performance.now() - e) / 1e3, t = Math.floor(r / 60), o = Math.floor(r % 60);
952
+ return t > 0 ? `[${t}m ${o}s]` : `[${o}s]`;
953
+ }, N = I.withGuide ?? settings.withGuide, P = (e = "") => {
954
+ d = true, M = block({ output: n }), s = C(e), w = performance.now(), N && n.write(`${styleText("gray", S_BAR)}
955
+ `);
956
+ let r = 0, t = 0;
957
+ A(), T = setInterval(() => {
958
+ if (u && s === p) return;
959
+ y(), p = s;
960
+ const o = k(E[r]);
961
+ let v;
962
+ if (u) v = `${o} ${s}...`;
963
+ else if (l === "timer") v = `${o} ${s} ${_(w)}`;
964
+ else {
965
+ const B = ".".repeat(Math.floor(t)).slice(0, 3);
966
+ v = `${o} ${s}${B}`;
967
+ }
968
+ const j = wrapAnsi(v, x, {
969
+ hard: true,
970
+ trim: false
971
+ });
972
+ n.write(j), r = r + 1 < E.length ? r + 1 : 0, t = t < 4 ? t + .125 : 0;
973
+ }, F);
974
+ }, a = (e = "", r = 0, t = false) => {
975
+ if (!d) return;
976
+ d = false, clearInterval(T), y();
977
+ const o = r === 0 ? styleText("green", S_STEP_SUBMIT) : r === 1 ? styleText("red", S_STEP_CANCEL) : styleText("red", S_STEP_ERROR);
978
+ s = e ?? s, t || (l === "timer" ? n.write(`${o} ${s} ${_(w)}
979
+ `) : n.write(`${o} ${s}
980
+ `)), H(), M();
981
+ };
982
+ return {
983
+ start: P,
984
+ stop: (e = "") => a(e, 0),
985
+ message: (e = "") => {
986
+ s = C(e ?? s);
987
+ },
988
+ cancel: (e = "") => a(e, 1),
989
+ error: (e = "") => a(e, 2),
990
+ clear: () => a("", 0, true),
991
+ get isCancelled() {
992
+ return S;
993
+ }
994
+ };
995
+ };
996
+ var SELECT_INSTRUCTIONS = [`${styleText("dim", "↑/↓")} to navigate`, `${styleText("dim", "Enter:")} confirm`];
997
+ var c = (t, o) => t.includes(`
998
+ `) ? t.split(`
999
+ `).map((d) => o(d)).join(`
1000
+ `) : o(t);
1001
+ var select = (t) => {
1002
+ const o = (n, m) => {
1003
+ if (n === void 0) return "";
1004
+ const s = n.label ?? String(n.value);
1005
+ switch (m) {
1006
+ case "disabled": return `${styleText("gray", S_RADIO_INACTIVE)} ${c(s, (i) => styleText("gray", i))}${n.hint ? ` ${styleText("dim", `(${n.hint ?? "disabled"})`)}` : ""}`;
1007
+ case "selected": return `${c(s, (i) => styleText("dim", i))}`;
1008
+ case "active": return `${styleText("green", S_RADIO_ACTIVE)} ${s}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
1009
+ case "cancelled": return `${c(s, (i) => styleText(["strikethrough", "dim"], i))}`;
1010
+ default: return `${styleText("dim", S_RADIO_INACTIVE)} ${c(s, (i) => styleText("dim", i))}`;
1011
+ }
1012
+ }, d = t.showInstructions ?? true;
1013
+ return new n$1({
1014
+ options: t.options,
1015
+ signal: t.signal,
1016
+ input: t.input,
1017
+ output: t.output,
1018
+ initialValue: t.initialValue,
1019
+ render() {
1020
+ const n = t.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i = wrapTextWithPrefix(t.output, t.message, s, m), u = `${n ? `${styleText("gray", S_BAR)}
1021
+ ` : ""}${i}
1022
+ `;
1023
+ switch (this.state) {
1024
+ case "submit": {
1025
+ const r = n ? `${styleText("gray", S_BAR)} ` : "";
1026
+ return `${u}${wrapTextWithPrefix(t.output, o(this.options[this.cursor], "selected"), r)}`;
1027
+ }
1028
+ case "cancel": {
1029
+ const r = n ? `${styleText("gray", S_BAR)} ` : "";
1030
+ return `${u}${wrapTextWithPrefix(t.output, o(this.options[this.cursor], "cancelled"), r)}${n ? `
1031
+ ${styleText("gray", S_BAR)}` : ""}`;
1032
+ }
1033
+ default: {
1034
+ const r = n ? `${styleText("cyan", S_BAR)} ` : "", a = u.split(`
1035
+ `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [], b = p.join(`
1036
+ `), f = p.length + 1;
1037
+ return `${u}${r}${limitOptions({
1038
+ output: t.output,
1039
+ cursor: this.cursor,
1040
+ options: this.options,
1041
+ maxItems: t.maxItems,
1042
+ columnPadding: r.length,
1043
+ rowPadding: a + f,
1044
+ style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
1045
+ }).join(`
1046
+ ${r}`)}
1047
+ ${b}
1048
+ `;
1049
+ }
1050
+ }
1051
+ }
1052
+ }).prompt();
1053
+ };
1054
+ `${styleText("gray", S_BAR)}`;
1055
+ var text = (e) => new n({
1056
+ validate: e.validate,
1057
+ placeholder: e.placeholder,
1058
+ defaultValue: e.defaultValue,
1059
+ initialValue: e.initialValue,
1060
+ output: e.output,
1061
+ signal: e.signal,
1062
+ input: e.input,
1063
+ render() {
1064
+ const i = e?.withGuide ?? settings.withGuide, s = `${`${i ? `${styleText("gray", S_BAR)}
1065
+ ` : ""}${symbol(this.state)} `}${e.message}
1066
+ `, c = e.placeholder && e.placeholder.length > 0 ? styleText("inverse", e.placeholder[0]) + styleText("dim", e.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : c, l = this.value ?? "";
1067
+ switch (this.state) {
1068
+ case "error": {
1069
+ const n = this.error ? ` ${styleText("yellow", this.error)}` : "", r = i ? `${styleText("yellow", S_BAR)} ` : "", d = i ? styleText("yellow", S_BAR_END) : "";
1070
+ return `${s.trim()}
1071
+ ${r}${o}
1072
+ ${d}${n}
1073
+ `;
1074
+ }
1075
+ case "submit": {
1076
+ const n = l ? ` ${styleText("dim", l)}` : "";
1077
+ return `${s}${i ? styleText("gray", S_BAR) : ""}${n}`;
1078
+ }
1079
+ case "cancel": {
1080
+ const n = l ? ` ${styleText(["strikethrough", "dim"], l)}` : "", r = i ? styleText("gray", S_BAR) : "";
1081
+ return `${s}${r}${n}${l.trim() ? `
1082
+ ${r}` : ""}`;
1083
+ }
1084
+ default: return `${s}${i ? `${styleText("cyan", S_BAR)} ` : ""}${o}
1085
+ ${i ? styleText("cyan", S_BAR_END) : ""}
1086
+ `;
1087
+ }
1088
+ }
1089
+ }).prompt();
1090
+ //#endregion
7
1091
  //#region src/utils/fs.ts
8
1092
  /**
9
1093
  * Recursively copy a template directory into the target directory,
@@ -183,16 +1267,17 @@ async function promptUser(initialOptions) {
183
1267
  message: "What is your project name?",
184
1268
  placeholder: "my-wangs-app",
185
1269
  defaultValue: "my-wangs-app",
1270
+ initialValue: "my-wangs-app",
186
1271
  validate: (value) => {
187
- if (!value || value.trim().length === 0) return "Project name cannot be empty";
188
- if (/[<>:"/\\|?*]/.test(value)) return "Project name contains invalid characters";
1272
+ const effective = (value || "").trim();
1273
+ if (effective && /[<>:"/\\|?*]/.test(effective)) return "Project name contains invalid characters";
189
1274
  }
190
1275
  });
191
1276
  if (isCancel(nameResponse)) {
192
1277
  cancel("Project scaffolding cancelled.");
193
1278
  process$1.exit(0);
194
1279
  }
195
- projectName = nameResponse.trim();
1280
+ projectName = (nameResponse || "my-wangs-app").trim();
196
1281
  }
197
1282
  if (!preset) {
198
1283
  const presetResponse = await select({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wangs-ui/create-react-app",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "Scaffold a modern React app with Wangs UI, Vite 8, Oxlint, Oxfmt, and AI Agent MCP integration",
5
5
  "keywords": [
6
6
  "antigravity",
@@ -13,10 +13,10 @@
13
13
  "format:check": "oxfmt --check"
14
14
  },
15
15
  "dependencies": {
16
- "@wangs-ui/react-core": "^1.0.30",
17
- "@wangs-ui/react-i18n": "^1.0.30",
18
- "@wangs-ui/react-icons": "^1.0.30",
19
- "@wangs-ui/react-presets": "^1.0.30",
16
+ "@wangs-ui/react-core": "^1.0.32",
17
+ "@wangs-ui/react-i18n": "^1.0.32",
18
+ "@wangs-ui/react-icons": "^1.0.32",
19
+ "@wangs-ui/react-presets": "^1.0.32",
20
20
  "clsx": "^2.1.1",
21
21
  "react": "^19.2.7",
22
22
  "react-dom": "^19.2.7",