create-aixyz-app 0.0.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1191 @@
1
+ #!/usr/bin/env node
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __toESM = (mod, isNodeMode, target) => {
8
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
9
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
+ for (let key of __getOwnPropNames(mod))
11
+ if (!__hasOwnProp.call(to, key))
12
+ __defProp(to, key, {
13
+ get: () => mod[key],
14
+ enumerable: true
15
+ });
16
+ return to;
17
+ };
18
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
+
20
+ // ../../node_modules/.bun/picocolors@1.1.1/node_modules/picocolors/picocolors.js
21
+ var require_picocolors = __commonJS((exports, module) => {
22
+ var p = process || {};
23
+ var argv = p.argv || [];
24
+ var env = p.env || {};
25
+ 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);
26
+ var formatter = (open, close, replace = open) => (input) => {
27
+ let string = "" + input, index = string.indexOf(close, open.length);
28
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
29
+ };
30
+ var replaceClose = (string, close, replace, index) => {
31
+ let result = "", cursor = 0;
32
+ do {
33
+ result += string.substring(cursor, index) + replace;
34
+ cursor = index + close.length;
35
+ index = string.indexOf(close, cursor);
36
+ } while (~index);
37
+ return result + string.substring(cursor);
38
+ };
39
+ var createColors = (enabled = isColorSupported) => {
40
+ let f = enabled ? formatter : () => String;
41
+ return {
42
+ isColorSupported: enabled,
43
+ reset: f("\x1B[0m", "\x1B[0m"),
44
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
45
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
46
+ italic: f("\x1B[3m", "\x1B[23m"),
47
+ underline: f("\x1B[4m", "\x1B[24m"),
48
+ inverse: f("\x1B[7m", "\x1B[27m"),
49
+ hidden: f("\x1B[8m", "\x1B[28m"),
50
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
51
+ black: f("\x1B[30m", "\x1B[39m"),
52
+ red: f("\x1B[31m", "\x1B[39m"),
53
+ green: f("\x1B[32m", "\x1B[39m"),
54
+ yellow: f("\x1B[33m", "\x1B[39m"),
55
+ blue: f("\x1B[34m", "\x1B[39m"),
56
+ magenta: f("\x1B[35m", "\x1B[39m"),
57
+ cyan: f("\x1B[36m", "\x1B[39m"),
58
+ white: f("\x1B[37m", "\x1B[39m"),
59
+ gray: f("\x1B[90m", "\x1B[39m"),
60
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
61
+ bgRed: f("\x1B[41m", "\x1B[49m"),
62
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
63
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
64
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
65
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
66
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
67
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
68
+ blackBright: f("\x1B[90m", "\x1B[39m"),
69
+ redBright: f("\x1B[91m", "\x1B[39m"),
70
+ greenBright: f("\x1B[92m", "\x1B[39m"),
71
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
72
+ blueBright: f("\x1B[94m", "\x1B[39m"),
73
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
74
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
75
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
76
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
77
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
78
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
79
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
80
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
81
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
82
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
83
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
84
+ };
85
+ };
86
+ module.exports = createColors();
87
+ module.exports.createColors = createColors;
88
+ });
89
+
90
+ // ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
91
+ var require_src = __commonJS((exports, module) => {
92
+ var ESC = "\x1B";
93
+ var CSI = `${ESC}[`;
94
+ var beep = "\x07";
95
+ var cursor = {
96
+ to(x, y) {
97
+ if (!y)
98
+ return `${CSI}${x + 1}G`;
99
+ return `${CSI}${y + 1};${x + 1}H`;
100
+ },
101
+ move(x, y) {
102
+ let ret = "";
103
+ if (x < 0)
104
+ ret += `${CSI}${-x}D`;
105
+ else if (x > 0)
106
+ ret += `${CSI}${x}C`;
107
+ if (y < 0)
108
+ ret += `${CSI}${-y}A`;
109
+ else if (y > 0)
110
+ ret += `${CSI}${y}B`;
111
+ return ret;
112
+ },
113
+ up: (count = 1) => `${CSI}${count}A`,
114
+ down: (count = 1) => `${CSI}${count}B`,
115
+ forward: (count = 1) => `${CSI}${count}C`,
116
+ backward: (count = 1) => `${CSI}${count}D`,
117
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
118
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
119
+ left: `${CSI}G`,
120
+ hide: `${CSI}?25l`,
121
+ show: `${CSI}?25h`,
122
+ save: `${ESC}7`,
123
+ restore: `${ESC}8`
124
+ };
125
+ var scroll = {
126
+ up: (count = 1) => `${CSI}S`.repeat(count),
127
+ down: (count = 1) => `${CSI}T`.repeat(count)
128
+ };
129
+ var erase = {
130
+ screen: `${CSI}2J`,
131
+ up: (count = 1) => `${CSI}1J`.repeat(count),
132
+ down: (count = 1) => `${CSI}J`.repeat(count),
133
+ line: `${CSI}2K`,
134
+ lineEnd: `${CSI}K`,
135
+ lineStart: `${CSI}1K`,
136
+ lines(count) {
137
+ let clear = "";
138
+ for (let i = 0;i < count; i++)
139
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
140
+ if (count)
141
+ clear += cursor.left;
142
+ return clear;
143
+ }
144
+ };
145
+ module.exports = { cursor, scroll, erase, beep };
146
+ });
147
+
148
+ // ../../node_modules/.bun/@clack+core@1.0.1/node_modules/@clack/core/dist/index.mjs
149
+ var import_picocolors = __toESM(require_picocolors(), 1);
150
+ var import_sisteransi = __toESM(require_src(), 1);
151
+ import { stdout as R, stdin as q } from "node:process";
152
+ import * as k from "node:readline";
153
+ import ot from "node:readline";
154
+ import { ReadStream as J } from "node:tty";
155
+ function B(t, e, s) {
156
+ if (!s.some((u) => !u.disabled))
157
+ return t;
158
+ const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
159
+ return s[n].disabled ? B(n, e < 0 ? -1 : 1, s) : n;
160
+ }
161
+ var 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;
162
+ var lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
163
+ var 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;
164
+ var O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
165
+ var y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
166
+ var L = /\t{1,1000}/y;
167
+ var P = /[\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;
168
+ var M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
169
+ var ct = /\p{M}+/gu;
170
+ var ft = { limit: 1 / 0, ellipsis: "" };
171
+ var X = (t, e = {}, s = {}) => {
172
+ const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.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, V = s.wideWidth ?? 2;
173
+ let h = 0, o = 0, p = t.length, v = 0, F = false, d = p, b = Math.max(0, i - n), C = 0, w = 0, c = 0, f = 0;
174
+ t:
175
+ for (;; ) {
176
+ if (w > C || o >= p && o > h) {
177
+ const ut = t.slice(C, w) || t.slice(h, o);
178
+ v = 0;
179
+ for (const Y of ut.replaceAll(ct, "")) {
180
+ const $ = Y.codePointAt(0) || 0;
181
+ if (lt($) ? f = m : ht($) ? f = V : E !== A && at($) ? f = E : f = A, c + f > b && (d = Math.min(d, Math.max(C, h) + v)), c + f > i) {
182
+ F = true;
183
+ break t;
184
+ }
185
+ v += Y.length, c += f;
186
+ }
187
+ C = w = 0;
188
+ }
189
+ if (o >= p)
190
+ break;
191
+ if (M.lastIndex = o, M.test(t)) {
192
+ if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
193
+ F = true;
194
+ break;
195
+ }
196
+ c += f, C = h, w = o, o = h = M.lastIndex;
197
+ continue;
198
+ }
199
+ if (O.lastIndex = o, O.test(t)) {
200
+ if (c + u > b && (d = Math.min(d, o)), c + u > i) {
201
+ F = true;
202
+ break;
203
+ }
204
+ c += u, C = h, w = o, o = h = O.lastIndex;
205
+ continue;
206
+ }
207
+ if (y.lastIndex = o, y.test(t)) {
208
+ if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
209
+ F = true;
210
+ break;
211
+ }
212
+ c += f, C = h, w = o, o = h = y.lastIndex;
213
+ continue;
214
+ }
215
+ if (L.lastIndex = o, L.test(t)) {
216
+ if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
217
+ F = true;
218
+ break;
219
+ }
220
+ c += f, C = h, w = o, o = h = L.lastIndex;
221
+ continue;
222
+ }
223
+ if (P.lastIndex = o, P.test(t)) {
224
+ if (c + g > b && (d = Math.min(d, o)), c + g > i) {
225
+ F = true;
226
+ break;
227
+ }
228
+ c += g, C = h, w = o, o = h = P.lastIndex;
229
+ continue;
230
+ }
231
+ o += 1;
232
+ }
233
+ return { width: F ? b : c, index: F ? d : p, truncated: F, ellipsed: F && i >= n };
234
+ };
235
+ var pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
236
+ var S = (t, e = {}) => X(t, pt, e).width;
237
+ var W = "\x1B";
238
+ var Z = "›";
239
+ var Ft = 39;
240
+ var j = "\x07";
241
+ var Q = "[";
242
+ var dt = "]";
243
+ var tt = "m";
244
+ var U = `${dt}8;;`;
245
+ var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
246
+ var mt = (t) => {
247
+ if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
248
+ return 39;
249
+ if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
250
+ return 49;
251
+ if (t === 1 || t === 2)
252
+ return 22;
253
+ if (t === 3)
254
+ return 23;
255
+ if (t === 4)
256
+ return 24;
257
+ if (t === 7)
258
+ return 27;
259
+ if (t === 8)
260
+ return 28;
261
+ if (t === 9)
262
+ return 29;
263
+ if (t === 0)
264
+ return 0;
265
+ };
266
+ var st = (t) => `${W}${Q}${t}${tt}`;
267
+ var it = (t) => `${W}${U}${t}${j}`;
268
+ var gt = (t) => t.map((e) => S(e));
269
+ var G = (t, e, s) => {
270
+ const i = e[Symbol.iterator]();
271
+ let r = false, n = false, u = t.at(-1), a = u === undefined ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
272
+ for (;!l.done; ) {
273
+ const m = l.value, A = S(m);
274
+ a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === W || m === Z) && (r = true, n = e.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;
275
+ }
276
+ u = t.at(-1), !a && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
277
+ };
278
+ var vt = (t) => {
279
+ const e = t.split(" ");
280
+ let s = e.length;
281
+ for (;s > 0 && !(S(e[s - 1]) > 0); )
282
+ s--;
283
+ return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
284
+ };
285
+ var Et = (t, e, s = {}) => {
286
+ if (s.trim !== false && t.trim() === "")
287
+ return "";
288
+ let i = "", r, n;
289
+ const u = t.split(" "), a = gt(u);
290
+ let l = [""];
291
+ for (const [h, o] of u.entries()) {
292
+ s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
293
+ let p = S(l.at(-1) ?? "");
294
+ if (h !== 0 && (p >= e && (s.wordWrap === false || s.trim === false) && (l.push(""), p = 0), (p > 0 || s.trim === false) && (l[l.length - 1] += " ", p++)), s.hard && a[h] > e) {
295
+ const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
296
+ Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
297
+ continue;
298
+ }
299
+ if (p + a[h] > e && p > 0 && a[h] > 0) {
300
+ if (s.wordWrap === false && p < e) {
301
+ G(l, o, e);
302
+ continue;
303
+ }
304
+ l.push("");
305
+ }
306
+ if (p + a[h] > e && s.wordWrap === false) {
307
+ G(l, o, e);
308
+ continue;
309
+ }
310
+ l[l.length - 1] += o;
311
+ }
312
+ s.trim !== false && (l = l.map((h) => vt(h)));
313
+ const E = l.join(`
314
+ `), g = E[Symbol.iterator]();
315
+ let m = g.next(), A = g.next(), V = 0;
316
+ for (;!m.done; ) {
317
+ const h = m.value, o = A.value;
318
+ if (i += h, h === W || h === Z) {
319
+ et.lastIndex = V + 1;
320
+ const F = et.exec(E)?.groups;
321
+ if (F?.code !== undefined) {
322
+ const d = Number.parseFloat(F.code);
323
+ r = d === Ft ? undefined : d;
324
+ } else
325
+ F?.uri !== undefined && (n = F.uri.length === 0 ? undefined : F.uri);
326
+ }
327
+ const p = r ? mt(r) : undefined;
328
+ o === `
329
+ ` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
330
+ ` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
331
+ }
332
+ return i;
333
+ };
334
+ function K(t, e, s) {
335
+ return String(t).normalize().replaceAll(`\r
336
+ `, `
337
+ `).split(`
338
+ `).map((i) => Et(i, e, s)).join(`
339
+ `);
340
+ }
341
+ var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
342
+ var _ = { actions: new Set(At), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
343
+ function H(t, e) {
344
+ if (typeof t == "string")
345
+ return _.aliases.get(t) === e;
346
+ for (const s of t)
347
+ if (s !== undefined && H(s, e))
348
+ return true;
349
+ return false;
350
+ }
351
+ function _t(t, e) {
352
+ if (t === e)
353
+ return;
354
+ const s = t.split(`
355
+ `), i = e.split(`
356
+ `), r = Math.max(s.length, i.length), n = [];
357
+ for (let u = 0;u < r; u++)
358
+ s[u] !== i[u] && n.push(u);
359
+ return { lines: n, numLinesBefore: s.length, numLinesAfter: i.length, numLines: r };
360
+ }
361
+ var bt = globalThis.process.platform.startsWith("win");
362
+ var z = Symbol("clack:cancel");
363
+ function Ct(t) {
364
+ return t === z;
365
+ }
366
+ function T(t, e) {
367
+ const s = t;
368
+ s.isTTY && s.setRawMode(e);
369
+ }
370
+ function Bt({ input: t = q, output: e = R, overwrite: s = true, hideCursor: i = true } = {}) {
371
+ const r = k.createInterface({ input: t, output: e, prompt: "", tabSize: 1 });
372
+ k.emitKeypressEvents(t, r), t instanceof J && t.isTTY && t.setRawMode(true);
373
+ const n = (u, { name: a, sequence: l }) => {
374
+ const E = String(u);
375
+ if (H([E, a, l], "cancel")) {
376
+ i && e.write(import_sisteransi.cursor.show), process.exit(0);
377
+ return;
378
+ }
379
+ if (!s)
380
+ return;
381
+ const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
382
+ k.moveCursor(e, g, m, () => {
383
+ k.clearLine(e, 1, () => {
384
+ t.once("keypress", n);
385
+ });
386
+ });
387
+ };
388
+ return i && e.write(import_sisteransi.cursor.hide), t.once("keypress", n), () => {
389
+ t.off("keypress", n), i && e.write(import_sisteransi.cursor.show), t instanceof J && t.isTTY && !bt && t.setRawMode(false), r.terminal = false, r.close();
390
+ };
391
+ }
392
+ var rt = (t) => ("columns" in t) && typeof t.columns == "number" ? t.columns : 80;
393
+ var nt = (t) => ("rows" in t) && typeof t.rows == "number" ? t.rows : 20;
394
+ class x {
395
+ input;
396
+ output;
397
+ _abortSignal;
398
+ rl;
399
+ opts;
400
+ _render;
401
+ _track = false;
402
+ _prevFrame = "";
403
+ _subscribers = new Map;
404
+ _cursor = 0;
405
+ state = "initial";
406
+ error = "";
407
+ value;
408
+ userInput = "";
409
+ constructor(e, s = true) {
410
+ const { input: i = q, output: r = R, render: n, signal: u, ...a } = e;
411
+ 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;
412
+ }
413
+ unsubscribe() {
414
+ this._subscribers.clear();
415
+ }
416
+ setSubscriber(e, s) {
417
+ const i = this._subscribers.get(e) ?? [];
418
+ i.push(s), this._subscribers.set(e, i);
419
+ }
420
+ on(e, s) {
421
+ this.setSubscriber(e, { cb: s });
422
+ }
423
+ once(e, s) {
424
+ this.setSubscriber(e, { cb: s, once: true });
425
+ }
426
+ emit(e, ...s) {
427
+ const i = this._subscribers.get(e) ?? [], r = [];
428
+ for (const n of i)
429
+ n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
430
+ for (const n of r)
431
+ n();
432
+ }
433
+ prompt() {
434
+ return new Promise((e) => {
435
+ if (this._abortSignal) {
436
+ if (this._abortSignal.aborted)
437
+ return this.state = "cancel", this.close(), e(z);
438
+ this._abortSignal.addEventListener("abort", () => {
439
+ this.state = "cancel", this.close();
440
+ }, { once: true });
441
+ }
442
+ this.rl = ot.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== undefined && 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", () => {
443
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(this.value);
444
+ }), this.once("cancel", () => {
445
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(z);
446
+ });
447
+ });
448
+ }
449
+ _isActionKey(e, s) {
450
+ return e === "\t";
451
+ }
452
+ _setValue(e) {
453
+ this.value = e, this.emit("value", this.value);
454
+ }
455
+ _setUserInput(e, s) {
456
+ this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
457
+ }
458
+ _clearUserInput() {
459
+ this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
460
+ }
461
+ onKeypress(e, s) {
462
+ if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, 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)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
463
+ if (this.opts.validate) {
464
+ const i = this.opts.validate(this.value);
465
+ i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
466
+ }
467
+ this.state !== "error" && (this.state = "submit");
468
+ }
469
+ H([e, 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();
470
+ }
471
+ close() {
472
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
473
+ `), T(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
474
+ }
475
+ restoreCursor() {
476
+ const e = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
477
+ `).length - 1;
478
+ this.output.write(import_sisteransi.cursor.move(-999, e * -1));
479
+ }
480
+ render() {
481
+ const e = K(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
482
+ if (e !== this._prevFrame) {
483
+ if (this.state === "initial")
484
+ this.output.write(import_sisteransi.cursor.hide);
485
+ else {
486
+ const s = _t(this._prevFrame, e), i = nt(this.output);
487
+ if (this.restoreCursor(), s) {
488
+ const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
489
+ let u = s.lines.find((a) => a >= r);
490
+ if (u === undefined) {
491
+ this._prevFrame = e;
492
+ return;
493
+ }
494
+ if (s.lines.length === 1) {
495
+ this.output.write(import_sisteransi.cursor.move(0, u - n)), this.output.write(import_sisteransi.erase.lines(1));
496
+ const a = e.split(`
497
+ `);
498
+ this.output.write(a[u]), this._prevFrame = e, this.output.write(import_sisteransi.cursor.move(0, a.length - u - 1));
499
+ return;
500
+ } else if (s.lines.length > 1) {
501
+ if (r < n)
502
+ u = r;
503
+ else {
504
+ const l = u - n;
505
+ l > 0 && this.output.write(import_sisteransi.cursor.move(0, l));
506
+ }
507
+ this.output.write(import_sisteransi.erase.down());
508
+ const a = e.split(`
509
+ `).slice(u);
510
+ this.output.write(a.join(`
511
+ `)), this._prevFrame = e;
512
+ return;
513
+ }
514
+ }
515
+ this.output.write(import_sisteransi.erase.down());
516
+ }
517
+ this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
518
+ }
519
+ }
520
+ }
521
+ function wt(t, e) {
522
+ if (t === undefined || e.length === 0)
523
+ return 0;
524
+ const s = e.findIndex((i) => i.value === t);
525
+ return s !== -1 ? s : 0;
526
+ }
527
+ function Dt(t, e) {
528
+ return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
529
+ }
530
+ function St(t, e) {
531
+ if (e)
532
+ return t ? e : e[0];
533
+ }
534
+
535
+ class Vt extends x {
536
+ filteredOptions;
537
+ multiple;
538
+ isNavigating = false;
539
+ selectedValues = [];
540
+ focusedValue;
541
+ #t = 0;
542
+ #s = "";
543
+ #i;
544
+ #e;
545
+ get cursor() {
546
+ return this.#t;
547
+ }
548
+ get userInputWithCursor() {
549
+ if (!this.userInput)
550
+ return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
551
+ if (this._cursor >= this.userInput.length)
552
+ return `${this.userInput}█`;
553
+ const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
554
+ return `${e}${import_picocolors.default.inverse(s)}${i.join("")}`;
555
+ }
556
+ get options() {
557
+ return typeof this.#e == "function" ? this.#e() : this.#e;
558
+ }
559
+ constructor(e) {
560
+ super(e), this.#e = e.options;
561
+ const s = this.options;
562
+ this.filteredOptions = [...s], this.multiple = e.multiple === true, this.#i = e.filter ?? Dt;
563
+ let i;
564
+ if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i)
565
+ for (const r of i) {
566
+ const n = s.findIndex((u) => u.value === r);
567
+ n !== -1 && (this.toggleSelected(r), this.#t = n);
568
+ }
569
+ this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
570
+ }
571
+ _isActionKey(e, s) {
572
+ return e === "\t" || this.multiple && this.isNavigating && s.name === "space" && e !== undefined && e !== "";
573
+ }
574
+ #r(e, s) {
575
+ const i = s.name === "up", r = s.name === "down", n = s.name === "return";
576
+ 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 !== undefined && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
577
+ }
578
+ deselectAll() {
579
+ this.selectedValues = [];
580
+ }
581
+ toggleSelected(e) {
582
+ this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
583
+ }
584
+ #n(e) {
585
+ if (e !== this.#s) {
586
+ this.#s = e;
587
+ const s = this.options;
588
+ e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
589
+ const i = wt(this.focusedValue, this.filteredOptions);
590
+ this.#t = B(i, 0, this.filteredOptions);
591
+ const r = this.filteredOptions[this.#t];
592
+ r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
593
+ }
594
+ }
595
+ }
596
+ class yt extends x {
597
+ options;
598
+ cursor = 0;
599
+ #t;
600
+ getGroupItems(e) {
601
+ return this.options.filter((s) => s.group === e);
602
+ }
603
+ isGroupSelected(e) {
604
+ const s = this.getGroupItems(e), i = this.value;
605
+ return i === undefined ? false : s.every((r) => i.includes(r.value));
606
+ }
607
+ toggleValue() {
608
+ const e = this.options[this.cursor];
609
+ if (this.value === undefined && (this.value = []), e.group === true) {
610
+ const s = e.value, i = this.getGroupItems(s);
611
+ 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));
612
+ } else {
613
+ const s = this.value.includes(e.value);
614
+ this.value = s ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
615
+ }
616
+ }
617
+ constructor(e) {
618
+ super(e, false);
619
+ const { options: s } = e;
620
+ this.#t = e.selectableGroups !== false, this.options = Object.entries(s).flatMap(([i, r]) => [{ value: i, group: true, label: i }, ...r.map((n) => ({ ...n, group: i }))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
621
+ switch (i) {
622
+ case "left":
623
+ case "up": {
624
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
625
+ const r = this.options[this.cursor]?.group === true;
626
+ !this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
627
+ break;
628
+ }
629
+ case "down":
630
+ case "right": {
631
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
632
+ const r = this.options[this.cursor]?.group === true;
633
+ !this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
634
+ break;
635
+ }
636
+ case "space":
637
+ this.toggleValue();
638
+ break;
639
+ }
640
+ });
641
+ }
642
+ }
643
+ class $t extends x {
644
+ get userInputWithCursor() {
645
+ if (this.state === "submit")
646
+ return this.userInput;
647
+ const e = this.userInput;
648
+ if (this.cursor >= e.length)
649
+ return `${this.userInput}█`;
650
+ const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
651
+ return `${s}${import_picocolors.default.inverse(i)}${r.join("")}`;
652
+ }
653
+ get cursor() {
654
+ return this._cursor;
655
+ }
656
+ constructor(e) {
657
+ super({ ...e, initialUserInput: e.initialUserInput ?? e.initialValue }), this.on("userInput", (s) => {
658
+ this._setValue(s);
659
+ }), this.on("finalize", () => {
660
+ this.value || (this.value = e.defaultValue), this.value === undefined && (this.value = "");
661
+ });
662
+ }
663
+ }
664
+
665
+ // ../../node_modules/.bun/@clack+prompts@1.0.1/node_modules/@clack/prompts/dist/index.mjs
666
+ var import_picocolors2 = __toESM(require_picocolors(), 1);
667
+ import N2 from "node:process";
668
+ var import_sisteransi2 = __toESM(require_src(), 1);
669
+ function me() {
670
+ 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";
671
+ }
672
+ var et2 = me();
673
+ var ct2 = () => process.env.CI === "true";
674
+ var C = (t, r) => et2 ? t : r;
675
+ var Rt = C("◆", "*");
676
+ var dt2 = C("■", "x");
677
+ var $t2 = C("▲", "x");
678
+ var V = C("◇", "o");
679
+ var ht2 = C("┌", "T");
680
+ var d = C("│", "|");
681
+ var x2 = C("└", "—");
682
+ var Ot = C("┐", "T");
683
+ var Pt = C("┘", "—");
684
+ var Q2 = C("●", ">");
685
+ var H2 = C("○", " ");
686
+ var st2 = C("◻", "[•]");
687
+ var U2 = C("◼", "[+]");
688
+ var q2 = C("◻", "[ ]");
689
+ var Nt = C("▪", "•");
690
+ var rt2 = C("─", "-");
691
+ var mt2 = C("╮", "+");
692
+ var Wt2 = C("├", "+");
693
+ var pt2 = C("╯", "+");
694
+ var gt2 = C("╰", "+");
695
+ var Lt2 = C("╭", "+");
696
+ var ft2 = C("●", "•");
697
+ var Ft2 = C("◆", "*");
698
+ var yt2 = C("▲", "!");
699
+ var Et2 = C("■", "x");
700
+ var W2 = (t) => {
701
+ switch (t) {
702
+ case "initial":
703
+ case "active":
704
+ return import_picocolors2.default.cyan(Rt);
705
+ case "cancel":
706
+ return import_picocolors2.default.red(dt2);
707
+ case "error":
708
+ return import_picocolors2.default.yellow($t2);
709
+ case "submit":
710
+ return import_picocolors2.default.green(V);
711
+ }
712
+ };
713
+ var 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;
714
+ var ge = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
715
+ var 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;
716
+ var At2 = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
717
+ var it2 = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
718
+ var nt2 = /\t{1,1000}/y;
719
+ var wt2 = /[\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;
720
+ var at2 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
721
+ var Fe = /\p{M}+/gu;
722
+ var ye = { limit: 1 / 0, ellipsis: "" };
723
+ var jt = (t, r = {}, s = {}) => {
724
+ 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;
725
+ 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;
726
+ t:
727
+ for (;; ) {
728
+ if (B2 > I2 || m >= h && m > $) {
729
+ const _2 = t.slice(I2, B2) || t.slice($, m);
730
+ y2 = 0;
731
+ for (const D2 of _2.replaceAll(Fe, "")) {
732
+ const T2 = D2.codePointAt(0) || 0;
733
+ 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) {
734
+ f = true;
735
+ break t;
736
+ }
737
+ y2 += D2.length, A += w;
738
+ }
739
+ I2 = B2 = 0;
740
+ }
741
+ if (m >= h)
742
+ break;
743
+ if (at2.lastIndex = m, at2.test(t)) {
744
+ if (y2 = at2.lastIndex - m, w = y2 * p, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / p))), A + w > i) {
745
+ f = true;
746
+ break;
747
+ }
748
+ A += w, I2 = $, B2 = m, m = $ = at2.lastIndex;
749
+ continue;
750
+ }
751
+ if (At2.lastIndex = m, At2.test(t)) {
752
+ if (A + u > S2 && (v = Math.min(v, m)), A + u > i) {
753
+ f = true;
754
+ break;
755
+ }
756
+ A += u, I2 = $, B2 = m, m = $ = At2.lastIndex;
757
+ continue;
758
+ }
759
+ if (it2.lastIndex = m, it2.test(t)) {
760
+ if (y2 = it2.lastIndex - m, w = y2 * l, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / l))), A + w > i) {
761
+ f = true;
762
+ break;
763
+ }
764
+ A += w, I2 = $, B2 = m, m = $ = it2.lastIndex;
765
+ continue;
766
+ }
767
+ if (nt2.lastIndex = m, nt2.test(t)) {
768
+ if (y2 = nt2.lastIndex - m, w = y2 * n, A + w > S2 && (v = Math.min(v, m + Math.floor((S2 - A) / n))), A + w > i) {
769
+ f = true;
770
+ break;
771
+ }
772
+ A += w, I2 = $, B2 = m, m = $ = nt2.lastIndex;
773
+ continue;
774
+ }
775
+ if (wt2.lastIndex = m, wt2.test(t)) {
776
+ if (A + g > S2 && (v = Math.min(v, m)), A + g > i) {
777
+ f = true;
778
+ break;
779
+ }
780
+ A += g, I2 = $, B2 = m, m = $ = wt2.lastIndex;
781
+ continue;
782
+ }
783
+ m += 1;
784
+ }
785
+ return { width: f ? S2 : A, index: f ? v : h, truncated: f, ellipsed: f && i >= o };
786
+ };
787
+ var Ee = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
788
+ var M2 = (t, r = {}) => jt(t, Ee, r).width;
789
+ var ot2 = "\x1B";
790
+ var Gt = "›";
791
+ var ve = 39;
792
+ var Ct2 = "\x07";
793
+ var kt2 = "[";
794
+ var Ae = "]";
795
+ var Vt2 = "m";
796
+ var St2 = `${Ae}8;;`;
797
+ var Ht = new RegExp(`(?:\\${kt2}(?<code>\\d+)m|\\${St2}(?<uri>.*)${Ct2})`, "y");
798
+ var we = (t) => {
799
+ if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
800
+ return 39;
801
+ if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
802
+ return 49;
803
+ if (t === 1 || t === 2)
804
+ return 22;
805
+ if (t === 3)
806
+ return 23;
807
+ if (t === 4)
808
+ return 24;
809
+ if (t === 7)
810
+ return 27;
811
+ if (t === 8)
812
+ return 28;
813
+ if (t === 9)
814
+ return 29;
815
+ if (t === 0)
816
+ return 0;
817
+ };
818
+ var Ut = (t) => `${ot2}${kt2}${t}${Vt2}`;
819
+ var Kt = (t) => `${ot2}${St2}${t}${Ct2}`;
820
+ var Ce = (t) => t.map((r) => M2(r));
821
+ var It2 = (t, r, s) => {
822
+ const i = r[Symbol.iterator]();
823
+ let a = false, o = false, u = t.at(-1), l = u === undefined ? 0 : M2(u), n = i.next(), c = i.next(), g = 0;
824
+ for (;!n.done; ) {
825
+ const F = n.value, p = M2(F);
826
+ 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;
827
+ }
828
+ u = t.at(-1), !l && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
829
+ };
830
+ var Se = (t) => {
831
+ const r = t.split(" ");
832
+ let s = r.length;
833
+ for (;s > 0 && !(M2(r[s - 1]) > 0); )
834
+ s--;
835
+ return s === r.length ? t : r.slice(0, s).join(" ") + r.slice(s).join("");
836
+ };
837
+ var Ie = (t, r, s = {}) => {
838
+ if (s.trim !== false && t.trim() === "")
839
+ return "";
840
+ let i = "", a, o;
841
+ const u = t.split(" "), l = Ce(u);
842
+ let n = [""];
843
+ for (const [$, m] of u.entries()) {
844
+ s.trim !== false && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
845
+ let h = M2(n.at(-1) ?? "");
846
+ 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) {
847
+ const y2 = r - h, f = 1 + Math.floor((l[$] - y2 - 1) / r);
848
+ Math.floor((l[$] - 1) / r) < f && n.push(""), It2(n, m, r);
849
+ continue;
850
+ }
851
+ if (h + l[$] > r && h > 0 && l[$] > 0) {
852
+ if (s.wordWrap === false && h < r) {
853
+ It2(n, m, r);
854
+ continue;
855
+ }
856
+ n.push("");
857
+ }
858
+ if (h + l[$] > r && s.wordWrap === false) {
859
+ It2(n, m, r);
860
+ continue;
861
+ }
862
+ n[n.length - 1] += m;
863
+ }
864
+ s.trim !== false && (n = n.map(($) => Se($)));
865
+ const c = n.join(`
866
+ `), g = c[Symbol.iterator]();
867
+ let F = g.next(), p = g.next(), E = 0;
868
+ for (;!F.done; ) {
869
+ const $ = F.value, m = p.value;
870
+ if (i += $, $ === ot2 || $ === Gt) {
871
+ Ht.lastIndex = E + 1;
872
+ const f = Ht.exec(c)?.groups;
873
+ if (f?.code !== undefined) {
874
+ const v = Number.parseFloat(f.code);
875
+ a = v === ve ? undefined : v;
876
+ } else
877
+ f?.uri !== undefined && (o = f.uri.length === 0 ? undefined : f.uri);
878
+ }
879
+ const h = a ? we(a) : undefined;
880
+ m === `
881
+ ` ? (o && (i += Kt("")), a && h && (i += Ut(h))) : $ === `
882
+ ` && (a && h && (i += Ut(a)), o && (i += Kt(o))), E += $.length, F = p, p = g.next();
883
+ }
884
+ return i;
885
+ };
886
+ function J2(t, r, s) {
887
+ return String(t).normalize().replaceAll(`\r
888
+ `, `
889
+ `).split(`
890
+ `).map((i) => Ie(i, r, s)).join(`
891
+ `);
892
+ }
893
+ var 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 } = {}) => {
894
+ const u = [], l = o ?? _.withGuide, n = l ? s : "", c = l ? `${r} ` : "", g = l ? `${s} ` : "";
895
+ for (let p = 0;p < a; p++)
896
+ u.push(n);
897
+ const F = Array.isArray(t) ? t : t.split(`
898
+ `);
899
+ if (F.length > 0) {
900
+ const [p, ...E] = F;
901
+ p.length > 0 ? u.push(`${c}${p}`) : u.push(l ? r : "");
902
+ for (const $ of E)
903
+ $.length > 0 ? u.push(`${g}${$}`) : u.push(l ? s : "");
904
+ }
905
+ i.write(`${u.join(`
906
+ `)}
907
+ `);
908
+ }, info: (t, r) => {
909
+ R2.message(t, { ...r, symbol: import_picocolors2.default.blue(ft2) });
910
+ }, success: (t, r) => {
911
+ R2.message(t, { ...r, symbol: import_picocolors2.default.green(Ft2) });
912
+ }, step: (t, r) => {
913
+ R2.message(t, { ...r, symbol: import_picocolors2.default.green(V) });
914
+ }, warn: (t, r) => {
915
+ R2.message(t, { ...r, symbol: import_picocolors2.default.yellow(yt2) });
916
+ }, warning: (t, r) => {
917
+ R2.warn(t, r);
918
+ }, error: (t, r) => {
919
+ R2.message(t, { ...r, symbol: import_picocolors2.default.red(Et2) });
920
+ } };
921
+ var Ne = (t = "", r) => {
922
+ (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(x2)} ${import_picocolors2.default.red(t)}
923
+
924
+ `);
925
+ };
926
+ var We = (t = "", r) => {
927
+ (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(ht2)} ${t}
928
+ `);
929
+ };
930
+ var Le = (t = "", r) => {
931
+ (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(d)}
932
+ ${import_picocolors2.default.gray(x2)} ${t}
933
+
934
+ `);
935
+ };
936
+ var Ge = (t) => import_picocolors2.default.dim(t);
937
+ var ke = (t, r, s) => {
938
+ const i = { hard: true, trim: false }, a = J2(t, r, i).split(`
939
+ `), 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);
940
+ return J2(t, l, i);
941
+ };
942
+ var Ve = (t = "", r = "", s) => {
943
+ const i = s?.output ?? N2.stdout, a = s?.withGuide ?? _.withGuide, o = s?.format ?? Ge, u = ["", ...ke(t, rt(i) - 6, o).split(`
944
+ `).map(o), ""], l = M2(r), n = Math.max(u.reduce((p, E) => {
945
+ const $ = M2(E);
946
+ return $ > p ? $ : p;
947
+ }, 0), l) + 2, c = u.map((p) => `${import_picocolors2.default.gray(d)} ${p}${" ".repeat(n - M2(p))}${import_picocolors2.default.gray(d)}`).join(`
948
+ `), g = a ? `${import_picocolors2.default.gray(d)}
949
+ ` : "", F = a ? Wt2 : gt2;
950
+ 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)}
951
+ ${c}
952
+ ${import_picocolors2.default.gray(F + rt2.repeat(n + 2) + pt2)}
953
+ `);
954
+ };
955
+ var Ke = import_picocolors2.default.magenta;
956
+ var bt2 = ({ indicator: t = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = et2 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], delay: u = et2 ? 80 : 120, signal: l, ...n } = {}) => {
957
+ const c = ct2();
958
+ let g, F, p = false, E = false, $ = "", m, h = performance.now();
959
+ const y2 = rt(s), f = n?.styleFrame ?? Ke, v = (b) => {
960
+ const O2 = b > 1 ? a ?? _.messages.error : i ?? _.messages.cancel;
961
+ E = b === 1, p && (L2(O2, b), E && typeof r == "function" && r());
962
+ }, S2 = () => v(2), I2 = () => v(1), B2 = () => {
963
+ 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);
964
+ }, A = () => {
965
+ 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);
966
+ }, w = () => {
967
+ if (m === undefined)
968
+ return;
969
+ c && s.write(`
970
+ `);
971
+ const b = J2(m, y2, { hard: true, trim: false }).split(`
972
+ `);
973
+ 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());
974
+ }, _2 = (b) => b.replace(/\.+$/, ""), D2 = (b) => {
975
+ const O2 = (performance.now() - b) / 1000, j2 = Math.floor(O2 / 60), G2 = Math.floor(O2 % 60);
976
+ return j2 > 0 ? `[${j2}m ${G2}s]` : `[${G2}s]`;
977
+ }, T2 = n.withGuide ?? _.withGuide, Y = (b = "") => {
978
+ p = true, g = Bt({ output: s }), $ = _2(b), h = performance.now(), T2 && s.write(`${import_picocolors2.default.gray(d)}
979
+ `);
980
+ let O2 = 0, j2 = 0;
981
+ B2(), F = setInterval(() => {
982
+ if (c && $ === m)
983
+ return;
984
+ w(), m = $;
985
+ const G2 = f(o[O2]);
986
+ let tt2;
987
+ if (c)
988
+ tt2 = `${G2} ${$}...`;
989
+ else if (t === "timer")
990
+ tt2 = `${G2} ${$} ${D2(h)}`;
991
+ else {
992
+ const te = ".".repeat(Math.floor(j2)).slice(0, 3);
993
+ tt2 = `${G2} ${$}${te}`;
994
+ }
995
+ const Zt = J2(tt2, y2, { hard: true, trim: false });
996
+ s.write(Zt), O2 = O2 + 1 < o.length ? O2 + 1 : 0, j2 = j2 < 4 ? j2 + 0.125 : 0;
997
+ }, u);
998
+ }, L2 = (b = "", O2 = 0, j2 = false) => {
999
+ if (!p)
1000
+ return;
1001
+ p = false, clearInterval(F), w();
1002
+ const G2 = O2 === 0 ? import_picocolors2.default.green(V) : O2 === 1 ? import_picocolors2.default.red(dt2) : import_picocolors2.default.red($t2);
1003
+ $ = b ?? $, j2 || (t === "timer" ? s.write(`${G2} ${$} ${D2(h)}
1004
+ `) : s.write(`${G2} ${$}
1005
+ `)), A(), g();
1006
+ };
1007
+ return { start: Y, stop: (b = "") => L2(b, 0), message: (b = "") => {
1008
+ $ = _2(b ?? $);
1009
+ }, cancel: (b = "") => L2(b, 1), error: (b = "") => L2(b, 2), clear: () => L2("", 0, true), get isCancelled() {
1010
+ return E;
1011
+ } };
1012
+ };
1013
+ var zt = { light: C("─", "-"), heavy: C("━", "="), block: C("█", "#") };
1014
+ var Qt = `${import_picocolors2.default.gray(d)} `;
1015
+ var 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() {
1016
+ const r = t?.withGuide ?? _.withGuide, s = `${`${r ? `${import_picocolors2.default.gray(d)}
1017
+ ` : ""}${W2(this.state)} `}${t.message}
1018
+ `, 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 ?? "";
1019
+ switch (this.state) {
1020
+ case "error": {
1021
+ const u = this.error ? ` ${import_picocolors2.default.yellow(this.error)}` : "", l = r ? `${import_picocolors2.default.yellow(d)} ` : "", n = r ? import_picocolors2.default.yellow(x2) : "";
1022
+ return `${s.trim()}
1023
+ ${l}${a}
1024
+ ${n}${u}
1025
+ `;
1026
+ }
1027
+ case "submit": {
1028
+ const u = o ? ` ${import_picocolors2.default.dim(o)}` : "", l = r ? import_picocolors2.default.gray(d) : "";
1029
+ return `${s}${l}${u}`;
1030
+ }
1031
+ case "cancel": {
1032
+ const u = o ? ` ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o))}` : "", l = r ? import_picocolors2.default.gray(d) : "";
1033
+ return `${s}${l}${u}${o.trim() ? `
1034
+ ${l}` : ""}`;
1035
+ }
1036
+ default: {
1037
+ const u = r ? `${import_picocolors2.default.cyan(d)} ` : "", l = r ? import_picocolors2.default.cyan(x2) : "";
1038
+ return `${s}${u}${a}
1039
+ ${l}
1040
+ `;
1041
+ }
1042
+ }
1043
+ } }).prompt();
1044
+
1045
+ // src/index.ts
1046
+ import { execSync } from "node:child_process";
1047
+ import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
1048
+ import { join, resolve } from "node:path";
1049
+ import { fileURLToPath } from "node:url";
1050
+ var args = process.argv.slice(2);
1051
+ var flags = new Set(args.filter((a) => a.startsWith("-")));
1052
+ var positional = args.filter((a) => !a.startsWith("-"));
1053
+ var useDefaults = flags.has("--yes") || flags.has("-y");
1054
+ function checkBunInstalled() {
1055
+ try {
1056
+ execSync("bun --version", { stdio: "ignore" });
1057
+ return true;
1058
+ } catch {
1059
+ return false;
1060
+ }
1061
+ }
1062
+ function detectPackageManager() {
1063
+ const userAgent = process.env.npm_config_user_agent || "";
1064
+ if (userAgent.includes("bun"))
1065
+ return "bun";
1066
+ if (userAgent.includes("npm"))
1067
+ return "npm";
1068
+ if (userAgent.includes("yarn"))
1069
+ return "yarn";
1070
+ if (userAgent.includes("pnpm"))
1071
+ return "pnpm";
1072
+ return "unknown";
1073
+ }
1074
+ function sanitizePkgName(name) {
1075
+ return name.toLowerCase().replace(/[^a-z0-9-\s]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
1076
+ }
1077
+ We("Create AIXYZ App");
1078
+ var hasBun = checkBunInstalled();
1079
+ var packageManager = detectPackageManager();
1080
+ if (!hasBun) {
1081
+ R2.error("Bun is not installed on your system.");
1082
+ R2.info("Please install Bun by visiting: https://bun.sh");
1083
+ R2.info("Run: curl -fsSL https://bun.sh/install | bash");
1084
+ Ne("Cannot continue without Bun.");
1085
+ process.exit(1);
1086
+ }
1087
+ var agentName = positional[0];
1088
+ if (!agentName) {
1089
+ if (useDefaults) {
1090
+ agentName = "my-agent";
1091
+ } else {
1092
+ const name = await Ze({
1093
+ message: "What is your agent named?",
1094
+ placeholder: "my-agent",
1095
+ defaultValue: "my-agent",
1096
+ validate(value) {
1097
+ if (!value)
1098
+ return "Agent name is required.";
1099
+ }
1100
+ });
1101
+ if (Ct(name)) {
1102
+ Ne("Operation cancelled.");
1103
+ process.exit(0);
1104
+ }
1105
+ agentName = name;
1106
+ }
1107
+ }
1108
+ var pkgName = sanitizePkgName(agentName);
1109
+ var targetDir = resolve(process.cwd(), pkgName);
1110
+ if (existsSync(targetDir)) {
1111
+ const contents = readdirSync(targetDir);
1112
+ if (contents.length > 0) {
1113
+ Ne(`Directory "${pkgName}" already exists and is not empty.`);
1114
+ process.exit(1);
1115
+ }
1116
+ }
1117
+ var openaiApiKey = "";
1118
+ if (!useDefaults) {
1119
+ const apiKey = await Ze({
1120
+ message: "OpenAI API Key (optional, can be set later in .env.local):",
1121
+ placeholder: "sk-...",
1122
+ validate(value) {
1123
+ if (value && !value.startsWith("sk-")) {
1124
+ return "OpenAI API keys typically start with 'sk-'";
1125
+ }
1126
+ }
1127
+ });
1128
+ if (Ct(apiKey)) {
1129
+ Ne("Operation cancelled.");
1130
+ process.exit(0);
1131
+ }
1132
+ openaiApiKey = apiKey || "";
1133
+ }
1134
+ var __filename2 = fileURLToPath(import.meta.url);
1135
+ var templateDir = join(__filename2, "..", "..", "templates", "default");
1136
+ if (!existsSync(templateDir)) {
1137
+ Ne("Template directory not found. This is a bug in create-aixyz-app.");
1138
+ process.exit(1);
1139
+ }
1140
+ mkdirSync(targetDir, { recursive: true });
1141
+ cpSync(templateDir, targetDir, { recursive: true });
1142
+ var gitignoreSrc = join(targetDir, "gitignore");
1143
+ if (existsSync(gitignoreSrc)) {
1144
+ renameSync(gitignoreSrc, join(targetDir, ".gitignore"));
1145
+ }
1146
+ var envLocalSrc = join(targetDir, "env.local");
1147
+ if (existsSync(envLocalSrc)) {
1148
+ const envContent = openaiApiKey ? `OPENAI_API_KEY=${openaiApiKey}
1149
+ ` : `OPENAI_API_KEY=
1150
+ `;
1151
+ writeFileSync(join(targetDir, ".env.local"), envContent);
1152
+ if (envLocalSrc !== join(targetDir, ".env.local")) {
1153
+ renameSync(envLocalSrc, join(targetDir, ".env.local"));
1154
+ }
1155
+ }
1156
+ var filesToReplace = ["package.json", "aixyz.config.ts"];
1157
+ for (const file of filesToReplace) {
1158
+ const filePath = join(targetDir, file);
1159
+ if (existsSync(filePath)) {
1160
+ let content = readFileSync(filePath, "utf-8");
1161
+ content = content.replaceAll("{{PKG_NAME}}", pkgName);
1162
+ content = content.replaceAll("{{AGENT_NAME}}", agentName);
1163
+ writeFileSync(filePath, content);
1164
+ }
1165
+ }
1166
+ var s = bt2();
1167
+ s.start("Installing dependencies...");
1168
+ try {
1169
+ execSync("bun install", { cwd: targetDir, stdio: "ignore" });
1170
+ s.stop("Dependencies installed.");
1171
+ } catch {
1172
+ s.stop("Failed to install dependencies. You can run `bun install` manually.");
1173
+ }
1174
+ s.start("Initializing git...");
1175
+ try {
1176
+ execSync("git init", { cwd: targetDir, stdio: "ignore" });
1177
+ execSync("git add -A", { cwd: targetDir, stdio: "ignore" });
1178
+ execSync('git commit -m "Initial commit from create-aixyz-app"', { cwd: targetDir, stdio: "ignore" });
1179
+ s.stop("Git initialized.");
1180
+ } catch {
1181
+ s.stop("Failed to initialize git. You can run `git init` manually.");
1182
+ }
1183
+ if (packageManager !== "bun" && packageManager !== "unknown") {
1184
+ R2.warn("");
1185
+ R2.error(`⚠️ You are using ${packageManager}, but this project requires Bun.`);
1186
+ R2.error(" Please use Bun for this project: https://bun.sh");
1187
+ R2.warn("");
1188
+ }
1189
+ Ve([`cd ${pkgName}`, openaiApiKey ? "" : "Set OPENAI_API_KEY in .env.local", "bun run dev"].filter(Boolean).join(`
1190
+ `), "Next steps");
1191
+ Le(`Success! Created ${agentName} at ./${pkgName}`);