create-rotor 0.1.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,1437 @@
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
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
12
+ var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
20
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
21
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
+ for (let key of __getOwnPropNames(mod))
23
+ if (!__hasOwnProp.call(to, key))
24
+ __defProp(to, key, {
25
+ get: __accessProp.bind(mod, key),
26
+ enumerable: true
27
+ });
28
+ if (canCache)
29
+ cache.set(mod, to);
30
+ return to;
31
+ };
32
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
+
34
+ // node_modules/sisteransi/src/index.js
35
+ var require_src = __commonJS((exports, module) => {
36
+ var ESC = "\x1B";
37
+ var CSI = `${ESC}[`;
38
+ var beep = "\x07";
39
+ var cursor = {
40
+ to(x, y) {
41
+ if (!y)
42
+ return `${CSI}${x + 1}G`;
43
+ return `${CSI}${y + 1};${x + 1}H`;
44
+ },
45
+ move(x, y) {
46
+ let ret = "";
47
+ if (x < 0)
48
+ ret += `${CSI}${-x}D`;
49
+ else if (x > 0)
50
+ ret += `${CSI}${x}C`;
51
+ if (y < 0)
52
+ ret += `${CSI}${-y}A`;
53
+ else if (y > 0)
54
+ ret += `${CSI}${y}B`;
55
+ return ret;
56
+ },
57
+ up: (count = 1) => `${CSI}${count}A`,
58
+ down: (count = 1) => `${CSI}${count}B`,
59
+ forward: (count = 1) => `${CSI}${count}C`,
60
+ backward: (count = 1) => `${CSI}${count}D`,
61
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
62
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
63
+ left: `${CSI}G`,
64
+ hide: `${CSI}?25l`,
65
+ show: `${CSI}?25h`,
66
+ save: `${ESC}7`,
67
+ restore: `${ESC}8`
68
+ };
69
+ var scroll = {
70
+ up: (count = 1) => `${CSI}S`.repeat(count),
71
+ down: (count = 1) => `${CSI}T`.repeat(count)
72
+ };
73
+ var erase = {
74
+ screen: `${CSI}2J`,
75
+ up: (count = 1) => `${CSI}1J`.repeat(count),
76
+ down: (count = 1) => `${CSI}J`.repeat(count),
77
+ line: `${CSI}2K`,
78
+ lineEnd: `${CSI}K`,
79
+ lineStart: `${CSI}1K`,
80
+ lines(count) {
81
+ let clear = "";
82
+ for (let i = 0;i < count; i++)
83
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
84
+ if (count)
85
+ clear += cursor.left;
86
+ return clear;
87
+ }
88
+ };
89
+ module.exports = { cursor, scroll, erase, beep };
90
+ });
91
+
92
+ // src/index.ts
93
+ import { execSync } from "node:child_process";
94
+ import { cpSync, existsSync as existsSync2, renameSync, rmSync as rmSync2 } from "node:fs";
95
+ import { join as join2, resolve } from "node:path";
96
+
97
+ // node_modules/@clack/core/dist/index.mjs
98
+ var import_sisteransi = __toESM(require_src(), 1);
99
+ import { styleText as D } from "node:util";
100
+ import { stdout as R, stdin as q } from "node:process";
101
+ import * as k from "node:readline";
102
+ import ot from "node:readline";
103
+ import { ReadStream as J } from "node:tty";
104
+ function x(t, e, s) {
105
+ if (!s.some((u) => !u.disabled))
106
+ return t;
107
+ const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
108
+ return s[n].disabled ? x(n, e < 0 ? -1 : 1, s) : n;
109
+ }
110
+ 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;
111
+ var lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
112
+ 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;
113
+ var O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
114
+ var y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
115
+ var L = /\t{1,1000}/y;
116
+ 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;
117
+ var M = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
118
+ var ct = /\p{M}+/gu;
119
+ var ft = { limit: 1 / 0, ellipsis: "" };
120
+ var X = (t, e = {}, s = {}) => {
121
+ 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;
122
+ 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;
123
+ t:
124
+ for (;; ) {
125
+ if (w > C || o >= p && o > h) {
126
+ const ut = t.slice(C, w) || t.slice(h, o);
127
+ v = 0;
128
+ for (const Y of ut.replaceAll(ct, "")) {
129
+ const $ = Y.codePointAt(0) || 0;
130
+ 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) {
131
+ F = true;
132
+ break t;
133
+ }
134
+ v += Y.length, c += f;
135
+ }
136
+ C = w = 0;
137
+ }
138
+ if (o >= p)
139
+ break;
140
+ if (M.lastIndex = o, M.test(t)) {
141
+ if (v = M.lastIndex - o, f = v * A, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + f > i) {
142
+ F = true;
143
+ break;
144
+ }
145
+ c += f, C = h, w = o, o = h = M.lastIndex;
146
+ continue;
147
+ }
148
+ if (O.lastIndex = o, O.test(t)) {
149
+ if (c + u > b && (d = Math.min(d, o)), c + u > i) {
150
+ F = true;
151
+ break;
152
+ }
153
+ c += u, C = h, w = o, o = h = O.lastIndex;
154
+ continue;
155
+ }
156
+ if (y.lastIndex = o, y.test(t)) {
157
+ if (v = y.lastIndex - o, f = v * a, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + f > i) {
158
+ F = true;
159
+ break;
160
+ }
161
+ c += f, C = h, w = o, o = h = y.lastIndex;
162
+ continue;
163
+ }
164
+ if (L.lastIndex = o, L.test(t)) {
165
+ if (v = L.lastIndex - o, f = v * l, c + f > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + f > i) {
166
+ F = true;
167
+ break;
168
+ }
169
+ c += f, C = h, w = o, o = h = L.lastIndex;
170
+ continue;
171
+ }
172
+ if (P.lastIndex = o, P.test(t)) {
173
+ if (c + g > b && (d = Math.min(d, o)), c + g > i) {
174
+ F = true;
175
+ break;
176
+ }
177
+ c += g, C = h, w = o, o = h = P.lastIndex;
178
+ continue;
179
+ }
180
+ o += 1;
181
+ }
182
+ return { width: F ? b : c, index: F ? d : p, truncated: F, ellipsed: F && i >= n };
183
+ };
184
+ var pt = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
185
+ var S = (t, e = {}) => X(t, pt, e).width;
186
+ var T = "\x1B";
187
+ var Z = "›";
188
+ var Ft = 39;
189
+ var j = "\x07";
190
+ var Q = "[";
191
+ var dt = "]";
192
+ var tt = "m";
193
+ var U = `${dt}8;;`;
194
+ var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
195
+ var mt = (t) => {
196
+ if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
197
+ return 39;
198
+ if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
199
+ return 49;
200
+ if (t === 1 || t === 2)
201
+ return 22;
202
+ if (t === 3)
203
+ return 23;
204
+ if (t === 4)
205
+ return 24;
206
+ if (t === 7)
207
+ return 27;
208
+ if (t === 8)
209
+ return 28;
210
+ if (t === 9)
211
+ return 29;
212
+ if (t === 0)
213
+ return 0;
214
+ };
215
+ var st = (t) => `${T}${Q}${t}${tt}`;
216
+ var it = (t) => `${T}${U}${t}${j}`;
217
+ var gt = (t) => t.map((e) => S(e));
218
+ var G = (t, e, s) => {
219
+ const i = e[Symbol.iterator]();
220
+ let r = false, n = false, u = t.at(-1), a = u === undefined ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
221
+ for (;!l.done; ) {
222
+ const m = l.value, A = S(m);
223
+ a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === T || 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;
224
+ }
225
+ u = t.at(-1), !a && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
226
+ };
227
+ var vt = (t) => {
228
+ const e = t.split(" ");
229
+ let s = e.length;
230
+ for (;s > 0 && !(S(e[s - 1]) > 0); )
231
+ s--;
232
+ return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
233
+ };
234
+ var Et = (t, e, s = {}) => {
235
+ if (s.trim !== false && t.trim() === "")
236
+ return "";
237
+ let i = "", r, n;
238
+ const u = t.split(" "), a = gt(u);
239
+ let l = [""];
240
+ for (const [h, o] of u.entries()) {
241
+ s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
242
+ let p = S(l.at(-1) ?? "");
243
+ 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) {
244
+ const v = e - p, F = 1 + Math.floor((a[h] - v - 1) / e);
245
+ Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
246
+ continue;
247
+ }
248
+ if (p + a[h] > e && p > 0 && a[h] > 0) {
249
+ if (s.wordWrap === false && p < e) {
250
+ G(l, o, e);
251
+ continue;
252
+ }
253
+ l.push("");
254
+ }
255
+ if (p + a[h] > e && s.wordWrap === false) {
256
+ G(l, o, e);
257
+ continue;
258
+ }
259
+ l[l.length - 1] += o;
260
+ }
261
+ s.trim !== false && (l = l.map((h) => vt(h)));
262
+ const E = l.join(`
263
+ `), g = E[Symbol.iterator]();
264
+ let m = g.next(), A = g.next(), V = 0;
265
+ for (;!m.done; ) {
266
+ const h = m.value, o = A.value;
267
+ if (i += h, h === T || h === Z) {
268
+ et.lastIndex = V + 1;
269
+ const F = et.exec(E)?.groups;
270
+ if (F?.code !== undefined) {
271
+ const d = Number.parseFloat(F.code);
272
+ r = d === Ft ? undefined : d;
273
+ } else
274
+ F?.uri !== undefined && (n = F.uri.length === 0 ? undefined : F.uri);
275
+ }
276
+ const p = r ? mt(r) : undefined;
277
+ o === `
278
+ ` ? (n && (i += it("")), r && p && (i += st(p))) : h === `
279
+ ` && (r && p && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
280
+ }
281
+ return i;
282
+ };
283
+ function K(t, e, s) {
284
+ return String(t).normalize().replaceAll(`\r
285
+ `, `
286
+ `).split(`
287
+ `).map((i) => Et(i, e, s)).join(`
288
+ `);
289
+ }
290
+ var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
291
+ 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 };
292
+ function H(t, e) {
293
+ if (typeof t == "string")
294
+ return _.aliases.get(t) === e;
295
+ for (const s of t)
296
+ if (s !== undefined && H(s, e))
297
+ return true;
298
+ return false;
299
+ }
300
+ function _t(t, e) {
301
+ if (t === e)
302
+ return;
303
+ const s = t.split(`
304
+ `), i = e.split(`
305
+ `), r = Math.max(s.length, i.length), n = [];
306
+ for (let u = 0;u < r; u++)
307
+ s[u] !== i[u] && n.push(u);
308
+ return { lines: n, numLinesBefore: s.length, numLinesAfter: i.length, numLines: r };
309
+ }
310
+ var bt = globalThis.process.platform.startsWith("win");
311
+ var z = Symbol("clack:cancel");
312
+ function Ct(t) {
313
+ return t === z;
314
+ }
315
+ function W(t, e) {
316
+ const s = t;
317
+ s.isTTY && s.setRawMode(e);
318
+ }
319
+ function xt({ input: t = q, output: e = R, overwrite: s = true, hideCursor: i = true } = {}) {
320
+ const r = k.createInterface({ input: t, output: e, prompt: "", tabSize: 1 });
321
+ k.emitKeypressEvents(t, r), t instanceof J && t.isTTY && t.setRawMode(true);
322
+ const n = (u, { name: a, sequence: l }) => {
323
+ const E = String(u);
324
+ if (H([E, a, l], "cancel")) {
325
+ i && e.write(import_sisteransi.cursor.show), process.exit(0);
326
+ return;
327
+ }
328
+ if (!s)
329
+ return;
330
+ const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
331
+ k.moveCursor(e, g, m, () => {
332
+ k.clearLine(e, 1, () => {
333
+ t.once("keypress", n);
334
+ });
335
+ });
336
+ };
337
+ return i && e.write(import_sisteransi.cursor.hide), t.once("keypress", n), () => {
338
+ 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();
339
+ };
340
+ }
341
+ var rt = (t) => ("columns" in t) && typeof t.columns == "number" ? t.columns : 80;
342
+ var nt = (t) => ("rows" in t) && typeof t.rows == "number" ? t.rows : 20;
343
+ function Bt(t, e, s, i = s) {
344
+ const r = rt(t ?? R);
345
+ return K(e, r - s.length, { hard: true, trim: false }).split(`
346
+ `).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
347
+ `);
348
+ }
349
+
350
+ class B {
351
+ input;
352
+ output;
353
+ _abortSignal;
354
+ rl;
355
+ opts;
356
+ _render;
357
+ _track = false;
358
+ _prevFrame = "";
359
+ _subscribers = new Map;
360
+ _cursor = 0;
361
+ state = "initial";
362
+ error = "";
363
+ value;
364
+ userInput = "";
365
+ constructor(e, s = true) {
366
+ const { input: i = q, output: r = R, render: n, signal: u, ...a } = e;
367
+ 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;
368
+ }
369
+ unsubscribe() {
370
+ this._subscribers.clear();
371
+ }
372
+ setSubscriber(e, s) {
373
+ const i = this._subscribers.get(e) ?? [];
374
+ i.push(s), this._subscribers.set(e, i);
375
+ }
376
+ on(e, s) {
377
+ this.setSubscriber(e, { cb: s });
378
+ }
379
+ once(e, s) {
380
+ this.setSubscriber(e, { cb: s, once: true });
381
+ }
382
+ emit(e, ...s) {
383
+ const i = this._subscribers.get(e) ?? [], r = [];
384
+ for (const n of i)
385
+ n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
386
+ for (const n of r)
387
+ n();
388
+ }
389
+ prompt() {
390
+ return new Promise((e) => {
391
+ if (this._abortSignal) {
392
+ if (this._abortSignal.aborted)
393
+ return this.state = "cancel", this.close(), e(z);
394
+ this._abortSignal.addEventListener("abort", () => {
395
+ this.state = "cancel", this.close();
396
+ }, { once: true });
397
+ }
398
+ 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), W(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
399
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), W(this.input, false), e(this.value);
400
+ }), this.once("cancel", () => {
401
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), W(this.input, false), e(z);
402
+ });
403
+ });
404
+ }
405
+ _isActionKey(e, s) {
406
+ return e === "\t";
407
+ }
408
+ _setValue(e) {
409
+ this.value = e, this.emit("value", this.value);
410
+ }
411
+ _setUserInput(e, s) {
412
+ this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
413
+ }
414
+ _clearUserInput() {
415
+ this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
416
+ }
417
+ onKeypress(e, s) {
418
+ 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") {
419
+ if (this.opts.validate) {
420
+ const i = this.opts.validate(this.value);
421
+ i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
422
+ }
423
+ this.state !== "error" && (this.state = "submit");
424
+ }
425
+ 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();
426
+ }
427
+ close() {
428
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
429
+ `), W(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
430
+ }
431
+ restoreCursor() {
432
+ const e = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
433
+ `).length - 1;
434
+ this.output.write(import_sisteransi.cursor.move(-999, e * -1));
435
+ }
436
+ render() {
437
+ const e = K(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
438
+ if (e !== this._prevFrame) {
439
+ if (this.state === "initial")
440
+ this.output.write(import_sisteransi.cursor.hide);
441
+ else {
442
+ const s = _t(this._prevFrame, e), i = nt(this.output);
443
+ if (this.restoreCursor(), s) {
444
+ const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
445
+ let u = s.lines.find((a) => a >= r);
446
+ if (u === undefined) {
447
+ this._prevFrame = e;
448
+ return;
449
+ }
450
+ if (s.lines.length === 1) {
451
+ this.output.write(import_sisteransi.cursor.move(0, u - n)), this.output.write(import_sisteransi.erase.lines(1));
452
+ const a = e.split(`
453
+ `);
454
+ this.output.write(a[u]), this._prevFrame = e, this.output.write(import_sisteransi.cursor.move(0, a.length - u - 1));
455
+ return;
456
+ } else if (s.lines.length > 1) {
457
+ if (r < n)
458
+ u = r;
459
+ else {
460
+ const l = u - n;
461
+ l > 0 && this.output.write(import_sisteransi.cursor.move(0, l));
462
+ }
463
+ this.output.write(import_sisteransi.erase.down());
464
+ const a = e.split(`
465
+ `).slice(u);
466
+ this.output.write(a.join(`
467
+ `)), this._prevFrame = e;
468
+ return;
469
+ }
470
+ }
471
+ this.output.write(import_sisteransi.erase.down());
472
+ }
473
+ this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
474
+ }
475
+ }
476
+ }
477
+ function wt(t, e) {
478
+ if (t === undefined || e.length === 0)
479
+ return 0;
480
+ const s = e.findIndex((i) => i.value === t);
481
+ return s !== -1 ? s : 0;
482
+ }
483
+ function Dt(t, e) {
484
+ return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
485
+ }
486
+ function St(t, e) {
487
+ if (e)
488
+ return t ? e : e[0];
489
+ }
490
+
491
+ class Vt extends B {
492
+ filteredOptions;
493
+ multiple;
494
+ isNavigating = false;
495
+ selectedValues = [];
496
+ focusedValue;
497
+ #t = 0;
498
+ #s = "";
499
+ #i;
500
+ #e;
501
+ get cursor() {
502
+ return this.#t;
503
+ }
504
+ get userInputWithCursor() {
505
+ if (!this.userInput)
506
+ return D(["inverse", "hidden"], "_");
507
+ if (this._cursor >= this.userInput.length)
508
+ return `${this.userInput}█`;
509
+ const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
510
+ return `${e}${D("inverse", s)}${i.join("")}`;
511
+ }
512
+ get options() {
513
+ return typeof this.#e == "function" ? this.#e() : this.#e;
514
+ }
515
+ constructor(e) {
516
+ super(e), this.#e = e.options;
517
+ const s = this.options;
518
+ this.filteredOptions = [...s], this.multiple = e.multiple === true, this.#i = e.filter ?? Dt;
519
+ let i;
520
+ 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)
521
+ for (const r of i) {
522
+ const n = s.findIndex((u) => u.value === r);
523
+ n !== -1 && (this.toggleSelected(r), this.#t = n);
524
+ }
525
+ this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
526
+ }
527
+ _isActionKey(e, s) {
528
+ return e === "\t" || this.multiple && this.isNavigating && s.name === "space" && e !== undefined && e !== "";
529
+ }
530
+ #r(e, s) {
531
+ const i = s.name === "up", r = s.name === "down", n = s.name === "return";
532
+ i || r ? (this.#t = x(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);
533
+ }
534
+ deselectAll() {
535
+ this.selectedValues = [];
536
+ }
537
+ toggleSelected(e) {
538
+ 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]);
539
+ }
540
+ #n(e) {
541
+ if (e !== this.#s) {
542
+ this.#s = e;
543
+ const s = this.options;
544
+ e ? this.filteredOptions = s.filter((n) => this.#i(e, n)) : this.filteredOptions = [...s];
545
+ const i = wt(this.focusedValue, this.filteredOptions);
546
+ this.#t = x(i, 0, this.filteredOptions);
547
+ const r = this.filteredOptions[this.#t];
548
+ r && !r.disabled ? this.focusedValue = r.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
549
+ }
550
+ }
551
+ }
552
+
553
+ class kt extends B {
554
+ get cursor() {
555
+ return this.value ? 0 : 1;
556
+ }
557
+ get _value() {
558
+ return this.cursor === 0;
559
+ }
560
+ constructor(e) {
561
+ super(e, false), this.value = !!e.initialValue, this.on("userInput", () => {
562
+ this.value = this._value;
563
+ }), this.on("confirm", (s) => {
564
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
565
+ }), this.on("cursor", () => {
566
+ this.value = !this.value;
567
+ });
568
+ }
569
+ }
570
+
571
+ class yt extends B {
572
+ options;
573
+ cursor = 0;
574
+ #t;
575
+ getGroupItems(e) {
576
+ return this.options.filter((s) => s.group === e);
577
+ }
578
+ isGroupSelected(e) {
579
+ const s = this.getGroupItems(e), i = this.value;
580
+ return i === undefined ? false : s.every((r) => i.includes(r.value));
581
+ }
582
+ toggleValue() {
583
+ const e = this.options[this.cursor];
584
+ if (this.value === undefined && (this.value = []), e.group === true) {
585
+ const s = e.value, i = this.getGroupItems(s);
586
+ 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));
587
+ } else {
588
+ const s = this.value.includes(e.value);
589
+ this.value = s ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
590
+ }
591
+ }
592
+ constructor(e) {
593
+ super(e, false);
594
+ const { options: s } = e;
595
+ 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) => {
596
+ switch (i) {
597
+ case "left":
598
+ case "up": {
599
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
600
+ const r = this.options[this.cursor]?.group === true;
601
+ !this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
602
+ break;
603
+ }
604
+ case "down":
605
+ case "right": {
606
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
607
+ const r = this.options[this.cursor]?.group === true;
608
+ !this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
609
+ break;
610
+ }
611
+ case "space":
612
+ this.toggleValue();
613
+ break;
614
+ }
615
+ });
616
+ }
617
+ }
618
+ var Lt = class extends B {
619
+ options;
620
+ cursor = 0;
621
+ get _value() {
622
+ return this.options[this.cursor].value;
623
+ }
624
+ get _enabledOptions() {
625
+ return this.options.filter((e) => e.disabled !== true);
626
+ }
627
+ toggleAll() {
628
+ const e = this._enabledOptions, s = this.value !== undefined && this.value.length === e.length;
629
+ this.value = s ? [] : e.map((i) => i.value);
630
+ }
631
+ toggleInvert() {
632
+ const e = this.value;
633
+ if (!e)
634
+ return;
635
+ const s = this._enabledOptions.filter((i) => !e.includes(i.value));
636
+ this.value = s.map((i) => i.value);
637
+ }
638
+ toggleValue() {
639
+ this.value === undefined && (this.value = []);
640
+ const e = this.value.includes(this._value);
641
+ this.value = e ? this.value.filter((s) => s !== this._value) : [...this.value, this._value];
642
+ }
643
+ constructor(e) {
644
+ super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
645
+ const s = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), 0);
646
+ this.cursor = this.options[s].disabled ? x(s, 1, this.options) : s, this.on("key", (i) => {
647
+ i === "a" && this.toggleAll(), i === "i" && this.toggleInvert();
648
+ }), this.on("cursor", (i) => {
649
+ switch (i) {
650
+ case "left":
651
+ case "up":
652
+ this.cursor = x(this.cursor, -1, this.options);
653
+ break;
654
+ case "down":
655
+ case "right":
656
+ this.cursor = x(this.cursor, 1, this.options);
657
+ break;
658
+ case "space":
659
+ this.toggleValue();
660
+ break;
661
+ }
662
+ });
663
+ }
664
+ };
665
+ class $t extends B {
666
+ get userInputWithCursor() {
667
+ if (this.state === "submit")
668
+ return this.userInput;
669
+ const e = this.userInput;
670
+ if (this.cursor >= e.length)
671
+ return `${this.userInput}█`;
672
+ const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
673
+ return `${s}${D("inverse", i)}${r.join("")}`;
674
+ }
675
+ get cursor() {
676
+ return this._cursor;
677
+ }
678
+ constructor(e) {
679
+ super({ ...e, initialUserInput: e.initialUserInput ?? e.initialValue }), this.on("userInput", (s) => {
680
+ this._setValue(s);
681
+ }), this.on("finalize", () => {
682
+ this.value || (this.value = e.defaultValue), this.value === undefined && (this.value = "");
683
+ });
684
+ }
685
+ }
686
+
687
+ // node_modules/@clack/prompts/dist/index.mjs
688
+ import { styleText as t, stripVTControlCharacters as ue } from "node:util";
689
+ import N2 from "node:process";
690
+ var import_sisteransi2 = __toESM(require_src(), 1);
691
+ function pt2() {
692
+ 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";
693
+ }
694
+ var ee = pt2();
695
+ var ce = () => process.env.CI === "true";
696
+ var I2 = (e, r) => ee ? e : r;
697
+ var Re = I2("◆", "*");
698
+ var $e = I2("■", "x");
699
+ var de = I2("▲", "x");
700
+ var V = I2("◇", "o");
701
+ var he = I2("┌", "T");
702
+ var h = I2("│", "|");
703
+ var x2 = I2("└", "—");
704
+ var Oe = I2("┐", "T");
705
+ var Pe = I2("┘", "—");
706
+ var z2 = I2("●", ">");
707
+ var H2 = I2("○", " ");
708
+ var te = I2("◻", "[•]");
709
+ var U2 = I2("◼", "[+]");
710
+ var q2 = I2("◻", "[ ]");
711
+ var Ne = I2("▪", "•");
712
+ var se = I2("─", "-");
713
+ var pe = I2("╮", "+");
714
+ var We = I2("├", "+");
715
+ var me = I2("╯", "+");
716
+ var ge = I2("╰", "+");
717
+ var Ge = I2("╭", "+");
718
+ var fe = I2("●", "•");
719
+ var Fe = I2("◆", "*");
720
+ var ye = I2("▲", "!");
721
+ var Ee = I2("■", "x");
722
+ var W2 = (e) => {
723
+ switch (e) {
724
+ case "initial":
725
+ case "active":
726
+ return t("cyan", Re);
727
+ case "cancel":
728
+ return t("red", $e);
729
+ case "error":
730
+ return t("yellow", de);
731
+ case "submit":
732
+ return t("green", V);
733
+ }
734
+ };
735
+ var ve = (e) => {
736
+ switch (e) {
737
+ case "initial":
738
+ case "active":
739
+ return t("cyan", h);
740
+ case "cancel":
741
+ return t("red", h);
742
+ case "error":
743
+ return t("yellow", h);
744
+ case "submit":
745
+ return t("green", h);
746
+ }
747
+ };
748
+ var mt2 = (e) => e === 161 || e === 164 || e === 167 || e === 168 || e === 170 || e === 173 || e === 174 || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || e === 198 || e === 208 || e === 215 || e === 216 || e >= 222 && e <= 225 || e === 230 || e >= 232 && e <= 234 || e === 236 || e === 237 || e === 240 || e === 242 || e === 243 || e >= 247 && e <= 250 || e === 252 || e === 254 || e === 257 || e === 273 || e === 275 || e === 283 || e === 294 || e === 295 || e === 299 || e >= 305 && e <= 307 || e === 312 || e >= 319 && e <= 322 || e === 324 || e >= 328 && e <= 331 || e === 333 || e === 338 || e === 339 || e === 358 || e === 359 || e === 363 || e === 462 || e === 464 || e === 466 || e === 468 || e === 470 || e === 472 || e === 474 || e === 476 || e === 593 || e === 609 || e === 708 || e === 711 || e >= 713 && e <= 715 || e === 717 || e === 720 || e >= 728 && e <= 731 || e === 733 || e === 735 || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || e === 1025 || e >= 1040 && e <= 1103 || e === 1105 || e === 8208 || e >= 8211 && e <= 8214 || e === 8216 || e === 8217 || e === 8220 || e === 8221 || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || e === 8240 || e === 8242 || e === 8243 || e === 8245 || e === 8251 || e === 8254 || e === 8308 || e === 8319 || e >= 8321 && e <= 8324 || e === 8364 || e === 8451 || e === 8453 || e === 8457 || e === 8467 || e === 8470 || e === 8481 || e === 8482 || e === 8486 || e === 8491 || e === 8531 || e === 8532 || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || e === 8585 || e >= 8592 && e <= 8601 || e === 8632 || e === 8633 || e === 8658 || e === 8660 || e === 8679 || e === 8704 || e === 8706 || e === 8707 || e === 8711 || e === 8712 || e === 8715 || e === 8719 || e === 8721 || e === 8725 || e === 8730 || e >= 8733 && e <= 8736 || e === 8739 || e === 8741 || e >= 8743 && e <= 8748 || e === 8750 || e >= 8756 && e <= 8759 || e === 8764 || e === 8765 || e === 8776 || e === 8780 || e === 8786 || e === 8800 || e === 8801 || e >= 8804 && e <= 8807 || e === 8810 || e === 8811 || e === 8814 || e === 8815 || e === 8834 || e === 8835 || e === 8838 || e === 8839 || e === 8853 || e === 8857 || e === 8869 || e === 8895 || e === 8978 || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || e === 9632 || e === 9633 || e >= 9635 && e <= 9641 || e === 9650 || e === 9651 || e === 9654 || e === 9655 || e === 9660 || e === 9661 || e === 9664 || e === 9665 || e >= 9670 && e <= 9672 || e === 9675 || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || e === 9711 || e === 9733 || e === 9734 || e === 9737 || e === 9742 || e === 9743 || e === 9756 || e === 9758 || e === 9792 || e === 9794 || e === 9824 || e === 9825 || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || e === 9836 || e === 9837 || e === 9839 || e === 9886 || e === 9887 || e === 9919 || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || e === 9955 || e === 9960 || e === 9961 || e >= 9963 && e <= 9969 || e === 9972 || e >= 9974 && e <= 9977 || e === 9979 || e === 9980 || e === 9982 || e === 9983 || e === 10045 || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || e === 65533 || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || e === 127375 || e === 127376 || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109;
749
+ var gt2 = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510;
750
+ var ft2 = (e) => e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9800 && e <= 9811 || e === 9855 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141;
751
+ var we = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
752
+ var re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
753
+ var ie = /\t{1,1000}/y;
754
+ var Ae = /[\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;
755
+ var ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
756
+ var Ft2 = /\p{M}+/gu;
757
+ var yt2 = { limit: 1 / 0, ellipsis: "" };
758
+ var Le = (e, r = {}, s = {}) => {
759
+ const i = r.limit ?? 1 / 0, a = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (a ? Le(a, yt2, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, n = s.tabWidth ?? 8, c = s.ambiguousWidth ?? 1, p = s.emojiWidth ?? 2, f = s.fullWidthWidth ?? 2, g = s.regularWidth ?? 1, E = s.wideWidth ?? 2;
760
+ let $ = 0, m = 0, d = e.length, F = 0, y2 = false, v = d, C = Math.max(0, i - o), A = 0, b = 0, w = 0, S2 = 0;
761
+ e:
762
+ for (;; ) {
763
+ if (b > A || m >= d && m > $) {
764
+ const T2 = e.slice(A, b) || e.slice($, m);
765
+ F = 0;
766
+ for (const M2 of T2.replaceAll(Ft2, "")) {
767
+ const O2 = M2.codePointAt(0) || 0;
768
+ if (gt2(O2) ? S2 = f : ft2(O2) ? S2 = E : c !== g && mt2(O2) ? S2 = c : S2 = g, w + S2 > C && (v = Math.min(v, Math.max(A, $) + F)), w + S2 > i) {
769
+ y2 = true;
770
+ break e;
771
+ }
772
+ F += M2.length, w += S2;
773
+ }
774
+ A = b = 0;
775
+ }
776
+ if (m >= d)
777
+ break;
778
+ if (ne.lastIndex = m, ne.test(e)) {
779
+ if (F = ne.lastIndex - m, S2 = F * g, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / g))), w + S2 > i) {
780
+ y2 = true;
781
+ break;
782
+ }
783
+ w += S2, A = $, b = m, m = $ = ne.lastIndex;
784
+ continue;
785
+ }
786
+ if (we.lastIndex = m, we.test(e)) {
787
+ if (w + u > C && (v = Math.min(v, m)), w + u > i) {
788
+ y2 = true;
789
+ break;
790
+ }
791
+ w += u, A = $, b = m, m = $ = we.lastIndex;
792
+ continue;
793
+ }
794
+ if (re.lastIndex = m, re.test(e)) {
795
+ if (F = re.lastIndex - m, S2 = F * l, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / l))), w + S2 > i) {
796
+ y2 = true;
797
+ break;
798
+ }
799
+ w += S2, A = $, b = m, m = $ = re.lastIndex;
800
+ continue;
801
+ }
802
+ if (ie.lastIndex = m, ie.test(e)) {
803
+ if (F = ie.lastIndex - m, S2 = F * n, w + S2 > C && (v = Math.min(v, m + Math.floor((C - w) / n))), w + S2 > i) {
804
+ y2 = true;
805
+ break;
806
+ }
807
+ w += S2, A = $, b = m, m = $ = ie.lastIndex;
808
+ continue;
809
+ }
810
+ if (Ae.lastIndex = m, Ae.test(e)) {
811
+ if (w + p > C && (v = Math.min(v, m)), w + p > i) {
812
+ y2 = true;
813
+ break;
814
+ }
815
+ w += p, A = $, b = m, m = $ = Ae.lastIndex;
816
+ continue;
817
+ }
818
+ m += 1;
819
+ }
820
+ return { width: y2 ? C : w, index: y2 ? v : d, truncated: y2, ellipsed: y2 && i >= o };
821
+ };
822
+ var Et2 = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
823
+ var D2 = (e, r = {}) => Le(e, Et2, r).width;
824
+ var ae = "\x1B";
825
+ var je = "›";
826
+ var vt2 = 39;
827
+ var Ce = "\x07";
828
+ var ke = "[";
829
+ var wt2 = "]";
830
+ var Ve = "m";
831
+ var Se = `${wt2}8;;`;
832
+ var He = new RegExp(`(?:\\${ke}(?<code>\\d+)m|\\${Se}(?<uri>.*)${Ce})`, "y");
833
+ var At2 = (e) => {
834
+ if (e >= 30 && e <= 37 || e >= 90 && e <= 97)
835
+ return 39;
836
+ if (e >= 40 && e <= 47 || e >= 100 && e <= 107)
837
+ return 49;
838
+ if (e === 1 || e === 2)
839
+ return 22;
840
+ if (e === 3)
841
+ return 23;
842
+ if (e === 4)
843
+ return 24;
844
+ if (e === 7)
845
+ return 27;
846
+ if (e === 8)
847
+ return 28;
848
+ if (e === 9)
849
+ return 29;
850
+ if (e === 0)
851
+ return 0;
852
+ };
853
+ var Ue = (e) => `${ae}${ke}${e}${Ve}`;
854
+ var Ke = (e) => `${ae}${Se}${e}${Ce}`;
855
+ var Ct2 = (e) => e.map((r) => D2(r));
856
+ var Ie = (e, r, s) => {
857
+ const i = r[Symbol.iterator]();
858
+ let a = false, o = false, u = e.at(-1), l = u === undefined ? 0 : D2(u), n = i.next(), c = i.next(), p = 0;
859
+ for (;!n.done; ) {
860
+ const f = n.value, g = D2(f);
861
+ l + g <= s ? e[e.length - 1] += f : (e.push(f), l = 0), (f === ae || f === je) && (a = true, o = r.startsWith(Se, p + 1)), a ? o ? f === Ce && (a = false, o = false) : f === Ve && (a = false) : (l += g, l === s && !c.done && (e.push(""), l = 0)), n = c, c = i.next(), p += f.length;
862
+ }
863
+ u = e.at(-1), !l && u !== undefined && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
864
+ };
865
+ var St2 = (e) => {
866
+ const r = e.split(" ");
867
+ let s = r.length;
868
+ for (;s > 0 && !(D2(r[s - 1]) > 0); )
869
+ s--;
870
+ return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
871
+ };
872
+ var It2 = (e, r, s = {}) => {
873
+ if (s.trim !== false && e.trim() === "")
874
+ return "";
875
+ let i = "", a, o;
876
+ const u = e.split(" "), l = Ct2(u);
877
+ let n = [""];
878
+ for (const [$, m] of u.entries()) {
879
+ s.trim !== false && (n[n.length - 1] = (n.at(-1) ?? "").trimStart());
880
+ let d = D2(n.at(-1) ?? "");
881
+ if ($ !== 0 && (d >= r && (s.wordWrap === false || s.trim === false) && (n.push(""), d = 0), (d > 0 || s.trim === false) && (n[n.length - 1] += " ", d++)), s.hard && l[$] > r) {
882
+ const F = r - d, y2 = 1 + Math.floor((l[$] - F - 1) / r);
883
+ Math.floor((l[$] - 1) / r) < y2 && n.push(""), Ie(n, m, r);
884
+ continue;
885
+ }
886
+ if (d + l[$] > r && d > 0 && l[$] > 0) {
887
+ if (s.wordWrap === false && d < r) {
888
+ Ie(n, m, r);
889
+ continue;
890
+ }
891
+ n.push("");
892
+ }
893
+ if (d + l[$] > r && s.wordWrap === false) {
894
+ Ie(n, m, r);
895
+ continue;
896
+ }
897
+ n[n.length - 1] += m;
898
+ }
899
+ s.trim !== false && (n = n.map(($) => St2($)));
900
+ const c = n.join(`
901
+ `), p = c[Symbol.iterator]();
902
+ let f = p.next(), g = p.next(), E = 0;
903
+ for (;!f.done; ) {
904
+ const $ = f.value, m = g.value;
905
+ if (i += $, $ === ae || $ === je) {
906
+ He.lastIndex = E + 1;
907
+ const y2 = He.exec(c)?.groups;
908
+ if (y2?.code !== undefined) {
909
+ const v = Number.parseFloat(y2.code);
910
+ a = v === vt2 ? undefined : v;
911
+ } else
912
+ y2?.uri !== undefined && (o = y2.uri.length === 0 ? undefined : y2.uri);
913
+ }
914
+ const d = a ? At2(a) : undefined;
915
+ m === `
916
+ ` ? (o && (i += Ke("")), a && d && (i += Ue(d))) : $ === `
917
+ ` && (a && d && (i += Ue(a)), o && (i += Ke(o))), E += $.length, f = g, g = p.next();
918
+ }
919
+ return i;
920
+ };
921
+ function J2(e, r, s) {
922
+ return String(e).normalize().replaceAll(`\r
923
+ `, `
924
+ `).split(`
925
+ `).map((i) => It2(i, r, s)).join(`
926
+ `);
927
+ }
928
+ var bt2 = (e, r, s, i, a) => {
929
+ let o = r, u = 0;
930
+ for (let l = s;l < i; l++) {
931
+ const n = e[l];
932
+ if (o = o - n.length, u++, o <= a)
933
+ break;
934
+ }
935
+ return { lineCount: o, removals: u };
936
+ };
937
+ var X2 = ({ cursor: e, options: r, style: s, output: i = process.stdout, maxItems: a = Number.POSITIVE_INFINITY, columnPadding: o = 0, rowPadding: u = 4 }) => {
938
+ const l = rt(i) - o, n = nt(i), c = t("dim", "..."), p = Math.max(n - u, 0), f = Math.max(Math.min(a, p), 5);
939
+ let g = 0;
940
+ e >= f - 3 && (g = Math.max(Math.min(e - f + 3, r.length - f), 0));
941
+ let E = f < r.length && g > 0, $ = f < r.length && g + f < r.length;
942
+ const m = Math.min(g + f, r.length), d = [];
943
+ let F = 0;
944
+ E && F++, $ && F++;
945
+ const y2 = g + (E ? 1 : 0), v = m - ($ ? 1 : 0);
946
+ for (let A = y2;A < v; A++) {
947
+ const b = J2(s(r[A], A === e), l, { hard: true, trim: false }).split(`
948
+ `);
949
+ d.push(b), F += b.length;
950
+ }
951
+ if (F > p) {
952
+ let A = 0, b = 0, w = F;
953
+ const S2 = e - y2, T2 = (M2, O2) => bt2(d, w, M2, O2, p);
954
+ E ? ({ lineCount: w, removals: A } = T2(0, S2), w > p && ({ lineCount: w, removals: b } = T2(S2 + 1, d.length))) : ({ lineCount: w, removals: b } = T2(S2 + 1, d.length), w > p && ({ lineCount: w, removals: A } = T2(0, S2))), A > 0 && (E = true, d.splice(0, A)), b > 0 && ($ = true, d.splice(d.length - b, b));
955
+ }
956
+ const C = [];
957
+ E && C.push(c);
958
+ for (const A of d)
959
+ for (const b of A)
960
+ C.push(b);
961
+ return $ && C.push(c), C;
962
+ };
963
+ var Rt = (e) => {
964
+ const r = e.active ?? "Yes", s = e.inactive ?? "No";
965
+ return new kt({ active: r, inactive: s, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue ?? true, render() {
966
+ const i = e.withGuide ?? _.withGuide, a = `${i ? `${t("gray", h)}
967
+ ` : ""}${W2(this.state)} ${e.message}
968
+ `, o = this.value ? r : s;
969
+ switch (this.state) {
970
+ case "submit": {
971
+ const u = i ? `${t("gray", h)} ` : "";
972
+ return `${a}${u}${t("dim", o)}`;
973
+ }
974
+ case "cancel": {
975
+ const u = i ? `${t("gray", h)} ` : "";
976
+ return `${a}${u}${t(["strikethrough", "dim"], o)}${i ? `
977
+ ${t("gray", h)}` : ""}`;
978
+ }
979
+ default: {
980
+ const u = i ? `${t("cyan", h)} ` : "", l = i ? t("cyan", x2) : "";
981
+ return `${a}${u}${this.value ? `${t("green", z2)} ${r}` : `${t("dim", H2)} ${t("dim", r)}`}${e.vertical ? i ? `
982
+ ${t("cyan", h)} ` : `
983
+ ` : ` ${t("dim", "/")} `}${this.value ? `${t("dim", H2)} ${t("dim", s)}` : `${t("green", z2)} ${s}`}
984
+ ${l}
985
+ `;
986
+ }
987
+ }
988
+ } }).prompt();
989
+ };
990
+ var Nt = (e = "", r) => {
991
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", x2)} ` : "";
992
+ s.write(`${i}${t("red", e)}
993
+
994
+ `);
995
+ };
996
+ var Wt2 = (e = "", r) => {
997
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", he)} ` : "";
998
+ s.write(`${i}${e}
999
+ `);
1000
+ };
1001
+ var Gt = (e = "", r) => {
1002
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? _.withGuide ? `${t("gray", h)}
1003
+ ${t("gray", x2)} ` : "";
1004
+ s.write(`${i}${e}
1005
+
1006
+ `);
1007
+ };
1008
+ var Q2 = (e, r) => e.split(`
1009
+ `).map((s) => r(s)).join(`
1010
+ `);
1011
+ var Lt2 = (e) => {
1012
+ const r = (i, a) => {
1013
+ const o = i.label ?? String(i.value);
1014
+ return a === "disabled" ? `${t("gray", q2)} ${Q2(o, (u) => t(["strikethrough", "gray"], u))}${i.hint ? ` ${t("dim", `(${i.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${t("cyan", te)} ${o}${i.hint ? ` ${t("dim", `(${i.hint})`)}` : ""}` : a === "selected" ? `${t("green", U2)} ${Q2(o, (u) => t("dim", u))}${i.hint ? ` ${t("dim", `(${i.hint})`)}` : ""}` : a === "cancelled" ? `${Q2(o, (u) => t(["strikethrough", "dim"], u))}` : a === "active-selected" ? `${t("green", U2)} ${o}${i.hint ? ` ${t("dim", `(${i.hint})`)}` : ""}` : a === "submitted" ? `${Q2(o, (u) => t("dim", u))}` : `${t("dim", q2)} ${Q2(o, (u) => t("dim", u))}`;
1015
+ }, s = e.required ?? true;
1016
+ return new Lt({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValues: e.initialValues, required: s, cursorAt: e.cursorAt, validate(i) {
1017
+ if (s && (i === undefined || i.length === 0))
1018
+ return `Please select at least one option.
1019
+ ${t("reset", t("dim", `Press ${t(["gray", "bgWhite", "inverse"], " space ")} to select, ${t("gray", t("bgWhite", t("inverse", " enter ")))} to submit`))}`;
1020
+ }, render() {
1021
+ const i = Bt(e.output, e.message, `${ve(this.state)} `, `${W2(this.state)} `), a = `${t("gray", h)}
1022
+ ${i}
1023
+ `, o = this.value ?? [], u = (l, n) => {
1024
+ if (l.disabled)
1025
+ return r(l, "disabled");
1026
+ const c = o.includes(l.value);
1027
+ return n && c ? r(l, "active-selected") : c ? r(l, "selected") : r(l, n ? "active" : "inactive");
1028
+ };
1029
+ switch (this.state) {
1030
+ case "submit": {
1031
+ const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "submitted")).join(t("dim", ", ")) || t("dim", "none"), n = Bt(e.output, l, `${t("gray", h)} `);
1032
+ return `${a}${n}`;
1033
+ }
1034
+ case "cancel": {
1035
+ const l = this.options.filter(({ value: c }) => o.includes(c)).map((c) => r(c, "cancelled")).join(t("dim", ", "));
1036
+ if (l.trim() === "")
1037
+ return `${a}${t("gray", h)}`;
1038
+ const n = Bt(e.output, l, `${t("gray", h)} `);
1039
+ return `${a}${n}
1040
+ ${t("gray", h)}`;
1041
+ }
1042
+ case "error": {
1043
+ const l = `${t("yellow", h)} `, n = this.error.split(`
1044
+ `).map((f, g) => g === 0 ? `${t("yellow", x2)} ${t("yellow", f)}` : ` ${f}`).join(`
1045
+ `), c = a.split(`
1046
+ `).length, p = n.split(`
1047
+ `).length + 1;
1048
+ return `${a}${l}${X2({ output: e.output, options: this.options, cursor: this.cursor, maxItems: e.maxItems, columnPadding: l.length, rowPadding: c + p, style: u }).join(`
1049
+ ${l}`)}
1050
+ ${n}
1051
+ `;
1052
+ }
1053
+ default: {
1054
+ const l = `${t("cyan", h)} `, n = a.split(`
1055
+ `).length;
1056
+ return `${a}${l}${X2({ output: e.output, options: this.options, cursor: this.cursor, maxItems: e.maxItems, columnPadding: l.length, rowPadding: n + 2, style: u }).join(`
1057
+ ${l}`)}
1058
+ ${t("cyan", x2)}
1059
+ `;
1060
+ }
1061
+ }
1062
+ } }).prompt();
1063
+ };
1064
+ var Kt = (e) => t("magenta", e);
1065
+ var be = ({ indicator: e = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: a, frames: o = ee ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], delay: u = ee ? 80 : 120, signal: l, ...n } = {}) => {
1066
+ const c = ce();
1067
+ let p, f, g = false, E = false, $ = "", m, d = performance.now();
1068
+ const F = rt(s), y2 = n?.styleFrame ?? Kt, v = (B2) => {
1069
+ const P2 = B2 > 1 ? a ?? _.messages.error : i ?? _.messages.cancel;
1070
+ E = B2 === 1, g && (k2(P2, B2), E && typeof r == "function" && r());
1071
+ }, C = () => v(2), A = () => v(1), b = () => {
1072
+ process.on("uncaughtExceptionMonitor", C), process.on("unhandledRejection", C), process.on("SIGINT", A), process.on("SIGTERM", A), process.on("exit", v), l && l.addEventListener("abort", A);
1073
+ }, w = () => {
1074
+ process.removeListener("uncaughtExceptionMonitor", C), process.removeListener("unhandledRejection", C), process.removeListener("SIGINT", A), process.removeListener("SIGTERM", A), process.removeListener("exit", v), l && l.removeEventListener("abort", A);
1075
+ }, S2 = () => {
1076
+ if (m === undefined)
1077
+ return;
1078
+ c && s.write(`
1079
+ `);
1080
+ const B2 = J2(m, F, { hard: true, trim: false }).split(`
1081
+ `);
1082
+ B2.length > 1 && s.write(import_sisteransi2.cursor.up(B2.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
1083
+ }, T2 = (B2) => B2.replace(/\.+$/, ""), M2 = (B2) => {
1084
+ const P2 = (performance.now() - B2) / 1000, G2 = Math.floor(P2 / 60), L2 = Math.floor(P2 % 60);
1085
+ return G2 > 0 ? `[${G2}m ${L2}s]` : `[${L2}s]`;
1086
+ }, O2 = n.withGuide ?? _.withGuide, le = (B2 = "") => {
1087
+ g = true, p = xt({ output: s }), $ = T2(B2), d = performance.now(), O2 && s.write(`${t("gray", h)}
1088
+ `);
1089
+ let P2 = 0, G2 = 0;
1090
+ b(), f = setInterval(() => {
1091
+ if (c && $ === m)
1092
+ return;
1093
+ S2(), m = $;
1094
+ const L2 = y2(o[P2]);
1095
+ let Z2;
1096
+ if (c)
1097
+ Z2 = `${L2} ${$}...`;
1098
+ else if (e === "timer")
1099
+ Z2 = `${L2} ${$} ${M2(d)}`;
1100
+ else {
1101
+ const et2 = ".".repeat(Math.floor(G2)).slice(0, 3);
1102
+ Z2 = `${L2} ${$}${et2}`;
1103
+ }
1104
+ const Ze = J2(Z2, F, { hard: true, trim: false });
1105
+ s.write(Ze), P2 = P2 + 1 < o.length ? P2 + 1 : 0, G2 = G2 < 4 ? G2 + 0.125 : 0;
1106
+ }, u);
1107
+ }, k2 = (B2 = "", P2 = 0, G2 = false) => {
1108
+ if (!g)
1109
+ return;
1110
+ g = false, clearInterval(f), S2();
1111
+ const L2 = P2 === 0 ? t("green", V) : P2 === 1 ? t("red", $e) : t("red", de);
1112
+ $ = B2 ?? $, G2 || (e === "timer" ? s.write(`${L2} ${$} ${M2(d)}
1113
+ `) : s.write(`${L2} ${$}
1114
+ `)), w(), p();
1115
+ };
1116
+ return { start: le, stop: (B2 = "") => k2(B2, 0), message: (B2 = "") => {
1117
+ $ = T2(B2 ?? $);
1118
+ }, cancel: (B2 = "") => k2(B2, 1), error: (B2 = "") => k2(B2, 2), clear: () => k2("", 0, true), get isCancelled() {
1119
+ return E;
1120
+ } };
1121
+ };
1122
+ var ze = { light: I2("─", "-"), heavy: I2("━", "="), block: I2("█", "#") };
1123
+ var Qe = `${t("gray", h)} `;
1124
+ var Zt = (e) => new $t({ validate: e.validate, placeholder: e.placeholder, defaultValue: e.defaultValue, initialValue: e.initialValue, output: e.output, signal: e.signal, input: e.input, render() {
1125
+ const r = e?.withGuide ?? _.withGuide, s = `${`${r ? `${t("gray", h)}
1126
+ ` : ""}${W2(this.state)} `}${e.message}
1127
+ `, i = e.placeholder ? t("inverse", e.placeholder[0]) + t("dim", e.placeholder.slice(1)) : t(["inverse", "hidden"], "_"), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
1128
+ switch (this.state) {
1129
+ case "error": {
1130
+ const u = this.error ? ` ${t("yellow", this.error)}` : "", l = r ? `${t("yellow", h)} ` : "", n = r ? t("yellow", x2) : "";
1131
+ return `${s.trim()}
1132
+ ${l}${a}
1133
+ ${n}${u}
1134
+ `;
1135
+ }
1136
+ case "submit": {
1137
+ const u = o ? ` ${t("dim", o)}` : "", l = r ? t("gray", h) : "";
1138
+ return `${s}${l}${u}`;
1139
+ }
1140
+ case "cancel": {
1141
+ const u = o ? ` ${t(["strikethrough", "dim"], o)}` : "", l = r ? t("gray", h) : "";
1142
+ return `${s}${l}${u}${o.trim() ? `
1143
+ ${l}` : ""}`;
1144
+ }
1145
+ default: {
1146
+ const u = r ? `${t("cyan", h)} ` : "", l = r ? t("cyan", x2) : "";
1147
+ return `${s}${u}${a}
1148
+ ${l}
1149
+ `;
1150
+ }
1151
+ }
1152
+ } }).prompt();
1153
+
1154
+ // src/constants.ts
1155
+ var MODULES = {
1156
+ shadcn: {
1157
+ name: "shadcn",
1158
+ label: "shadcn/ui",
1159
+ hint: "UI component library (Base UI)",
1160
+ files: ["components.json", "lib/utils.ts", "components/ui"],
1161
+ dependencies: {
1162
+ "class-variance-authority": "0.7.1",
1163
+ clsx: "2.1.1",
1164
+ "tailwind-merge": "3.5.0",
1165
+ "lucide-react": "0.577.0"
1166
+ },
1167
+ devDependencies: {},
1168
+ envMarker: "shadcn"
1169
+ },
1170
+ swr: {
1171
+ name: "swr",
1172
+ label: "SWR",
1173
+ hint: "Data fetching",
1174
+ files: [],
1175
+ dependencies: {
1176
+ swr: "2.4.1"
1177
+ },
1178
+ devDependencies: {},
1179
+ envMarker: "swr"
1180
+ },
1181
+ drizzle: {
1182
+ name: "drizzle",
1183
+ label: "Drizzle + Supabase",
1184
+ hint: "Database",
1185
+ files: ["lib/db.ts", "lib/schema.ts", "drizzle.config.ts"],
1186
+ dependencies: {
1187
+ "drizzle-orm": "0.45.1",
1188
+ "@supabase/supabase-js": "2.99.1",
1189
+ postgres: "3.4.8"
1190
+ },
1191
+ devDependencies: {
1192
+ "drizzle-kit": "0.31.9"
1193
+ },
1194
+ envMarker: "drizzle"
1195
+ },
1196
+ ai: {
1197
+ name: "ai",
1198
+ label: "Vercel AI SDK",
1199
+ hint: "AI integration",
1200
+ files: ["lib/ai.ts"],
1201
+ dependencies: {
1202
+ ai: "6.0.116",
1203
+ "@ai-sdk/openai": "3.0.41"
1204
+ },
1205
+ devDependencies: {},
1206
+ envMarker: "ai"
1207
+ }
1208
+ };
1209
+ var VERSION = "0.1.0";
1210
+
1211
+ // src/helpers.ts
1212
+ import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
1213
+ import { join } from "node:path";
1214
+ function trimDependencies(pkgPath, selectedModules) {
1215
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
1216
+ const unselected = Object.keys(MODULES).filter((m) => !selectedModules.includes(m));
1217
+ for (const moduleName of unselected) {
1218
+ const mod = MODULES[moduleName];
1219
+ for (const dep of Object.keys(mod.dependencies)) {
1220
+ delete pkg.dependencies?.[dep];
1221
+ }
1222
+ for (const dep of Object.keys(mod.devDependencies)) {
1223
+ delete pkg.devDependencies?.[dep];
1224
+ }
1225
+ }
1226
+ writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}
1227
+ `);
1228
+ }
1229
+ function trimScripts(pkgPath, selectedModules) {
1230
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
1231
+ if (!selectedModules.includes("drizzle")) {
1232
+ for (const key of Object.keys(pkg.scripts || {})) {
1233
+ if (key.startsWith("db:")) {
1234
+ delete pkg.scripts[key];
1235
+ }
1236
+ }
1237
+ }
1238
+ writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}
1239
+ `);
1240
+ }
1241
+ function trimEnvFile(envPath, selectedModules) {
1242
+ if (!existsSync(envPath))
1243
+ return;
1244
+ const content = readFileSync(envPath, "utf-8");
1245
+ const lines = content.split(`
1246
+ `);
1247
+ const result = [];
1248
+ let skipping = false;
1249
+ for (const line of lines) {
1250
+ const startMatch = line.match(/^#\s*\[(\w+)\]\s*$/);
1251
+ const endMatch = line.match(/^#\s*\[\/(\w+)\]\s*$/);
1252
+ if (startMatch) {
1253
+ const marker = startMatch[1];
1254
+ if (!selectedModules.includes(marker)) {
1255
+ skipping = true;
1256
+ continue;
1257
+ }
1258
+ }
1259
+ if (endMatch) {
1260
+ if (skipping) {
1261
+ skipping = false;
1262
+ continue;
1263
+ }
1264
+ }
1265
+ if (!skipping) {
1266
+ result.push(line);
1267
+ }
1268
+ }
1269
+ const cleaned = result.filter((line) => !line.match(/^#\s*\[\/?\w+\]\s*$/)).join(`
1270
+ `).replace(/\n{3,}/g, `
1271
+
1272
+ `).trim();
1273
+ writeFileSync(envPath, cleaned ? `${cleaned}
1274
+ ` : "");
1275
+ }
1276
+ function removeModuleFiles(projectDir, selectedModules) {
1277
+ const unselected = Object.keys(MODULES).filter((m) => !selectedModules.includes(m));
1278
+ for (const moduleName of unselected) {
1279
+ const mod = MODULES[moduleName];
1280
+ for (const file of mod.files) {
1281
+ const filePath = join(projectDir, file);
1282
+ if (existsSync(filePath)) {
1283
+ rmSync(filePath, { recursive: true, force: true });
1284
+ }
1285
+ }
1286
+ }
1287
+ }
1288
+ function replaceProjectName(projectDir, projectName) {
1289
+ const filesToReplace = [
1290
+ "package.json",
1291
+ "app/layout.tsx",
1292
+ "app/page.tsx",
1293
+ "README.md"
1294
+ ];
1295
+ for (const file of filesToReplace) {
1296
+ const filePath = join(projectDir, file);
1297
+ if (!existsSync(filePath))
1298
+ continue;
1299
+ const content = readFileSync(filePath, "utf-8");
1300
+ writeFileSync(filePath, content.replaceAll("{{PROJECT_NAME}}", projectName));
1301
+ }
1302
+ }
1303
+ function trimCssShadcn(cssPath) {
1304
+ if (!existsSync(cssPath))
1305
+ return;
1306
+ const content = readFileSync(cssPath, "utf-8");
1307
+ const lines = content.split(`
1308
+ `);
1309
+ const result = [];
1310
+ let skipping = false;
1311
+ for (const line of lines) {
1312
+ if (line.match(/^\/\*\s*\[shadcn\]\s*\*\/\s*$/)) {
1313
+ skipping = true;
1314
+ continue;
1315
+ }
1316
+ if (line.match(/^\/\*\s*\[\/shadcn\]\s*\*\/\s*$/)) {
1317
+ skipping = false;
1318
+ continue;
1319
+ }
1320
+ if (!skipping) {
1321
+ result.push(line);
1322
+ }
1323
+ }
1324
+ const cleaned = result.join(`
1325
+ `).replace(/\n{3,}/g, `
1326
+
1327
+ `).trim();
1328
+ writeFileSync(cssPath, `${cleaned}
1329
+ `);
1330
+ }
1331
+
1332
+ // src/index.ts
1333
+ function getTemplatePath() {
1334
+ return resolve(import.meta.dirname, "..", "template");
1335
+ }
1336
+ function validateProjectName(name) {
1337
+ if (!name)
1338
+ return "Project name is required";
1339
+ if (!/^[a-z0-9@][a-z0-9-._~/]*$/.test(name)) {
1340
+ return "Invalid name: use lowercase, hyphens, no spaces";
1341
+ }
1342
+ return;
1343
+ }
1344
+ async function main() {
1345
+ const args = process.argv.slice(2);
1346
+ if (args.includes("--version") || args.includes("-v")) {
1347
+ console.log(VERSION);
1348
+ process.exit(0);
1349
+ }
1350
+ if (args.includes("--help") || args.includes("-h")) {
1351
+ console.log(`
1352
+ create-rotor v${VERSION}
1353
+
1354
+ Usage: create-rotor [project-name]
1355
+
1356
+ Options:
1357
+ -v, --version Show version
1358
+ -h, --help Show help
1359
+ `);
1360
+ process.exit(0);
1361
+ }
1362
+ Wt2("create-rotor");
1363
+ const argName = args.find((a) => !a.startsWith("-"));
1364
+ let projectName;
1365
+ if (argName && !validateProjectName(argName)) {
1366
+ projectName = argName;
1367
+ } else {
1368
+ const nameResult = await Zt({
1369
+ message: "Project name?",
1370
+ placeholder: "my-app",
1371
+ validate: validateProjectName
1372
+ });
1373
+ if (Ct(nameResult)) {
1374
+ Nt("Cancelled.");
1375
+ process.exit(0);
1376
+ }
1377
+ projectName = nameResult;
1378
+ }
1379
+ const targetDir = resolve(process.cwd(), projectName);
1380
+ if (existsSync2(targetDir)) {
1381
+ const overwrite = await Rt({
1382
+ message: `Directory "${projectName}" already exists. Overwrite?`
1383
+ });
1384
+ if (Ct(overwrite) || !overwrite) {
1385
+ Nt("Cancelled.");
1386
+ process.exit(0);
1387
+ }
1388
+ rmSync2(targetDir, { recursive: true, force: true });
1389
+ }
1390
+ const features = await Lt2({
1391
+ message: "Select optional features:",
1392
+ options: Object.values(MODULES).map((m) => ({
1393
+ value: m.name,
1394
+ label: m.label,
1395
+ hint: m.hint
1396
+ })),
1397
+ required: false
1398
+ });
1399
+ if (Ct(features)) {
1400
+ Nt("Cancelled.");
1401
+ process.exit(0);
1402
+ }
1403
+ const selectedModules = features;
1404
+ const initGit = await Rt({
1405
+ message: "Initialize git repository?",
1406
+ initialValue: true
1407
+ });
1408
+ if (Ct(initGit)) {
1409
+ Nt("Cancelled.");
1410
+ process.exit(0);
1411
+ }
1412
+ const s = be();
1413
+ s.start("Creating project...");
1414
+ const templatePath = getTemplatePath();
1415
+ cpSync(templatePath, targetDir, { recursive: true });
1416
+ renameSync(join2(targetDir, "gitignore"), join2(targetDir, ".gitignore"));
1417
+ replaceProjectName(targetDir, projectName);
1418
+ removeModuleFiles(targetDir, selectedModules);
1419
+ trimDependencies(join2(targetDir, "package.json"), selectedModules);
1420
+ trimScripts(join2(targetDir, "package.json"), selectedModules);
1421
+ trimEnvFile(join2(targetDir, ".env.example"), selectedModules);
1422
+ if (!selectedModules.includes("shadcn")) {
1423
+ trimCssShadcn(join2(targetDir, "app", "globals.css"));
1424
+ }
1425
+ if (initGit) {
1426
+ execSync("git init", { cwd: targetDir, stdio: "ignore" });
1427
+ execSync("git add -A", { cwd: targetDir, stdio: "ignore" });
1428
+ execSync('git commit -m "init"', { cwd: targetDir, stdio: "ignore" });
1429
+ }
1430
+ s.stop("Project created!");
1431
+ Gt(`Done! Next steps:
1432
+
1433
+ cd ${projectName}
1434
+ bun install
1435
+ bun dev`);
1436
+ }
1437
+ main().catch(console.error);