gh-ssh 1.0.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +76 -0
  3. package/dist/cli.js +2329 -0
  4. package/package.json +66 -0
package/dist/cli.js ADDED
@@ -0,0 +1,2329 @@
1
+ #!/usr/bin/env node
2
+ import { readFileSync as Ae, existsSync as M, readdirSync as Lt, mkdirSync as Rt, writeFileSync as Ut, chmodSync as $t } from "node:fs";
3
+ import { dirname as lt, join as I, isAbsolute as Tt, basename as oe } from "node:path";
4
+ import { fileURLToPath as Ot } from "node:url";
5
+ import { spawnSync as Q } from "node:child_process";
6
+ import { homedir as V } from "node:os";
7
+ import * as Mt from "node:readline";
8
+ import { AsyncLocalStorage as It, AsyncResource as Se } from "node:async_hooks";
9
+ import _t from "stream";
10
+ import { stripVTControlCharacters as Pt } from "node:util";
11
+ import jt from "tty";
12
+ import qt from "node:tty";
13
+ import S from "node:process";
14
+ const Nt = {
15
+ help: !1,
16
+ version: !1
17
+ }, Ht = (e) => {
18
+ const t = { ...Nt }, n = [], s = (u) => typeof u == "string" && u.length > 0 && !u.startsWith("-");
19
+ for (let u = 0; u < e.length; u += 1) {
20
+ const i = e[u];
21
+ switch (i) {
22
+ case "-h":
23
+ case "--help":
24
+ t.help = !0;
25
+ break;
26
+ case "-v":
27
+ case "--version":
28
+ t.version = !0;
29
+ break;
30
+ case "--email":
31
+ s(e[u + 1]) ? (t.email = e[u + 1], u += 1) : n.push(i);
32
+ break;
33
+ case "--type": {
34
+ const r = e[u + 1];
35
+ if (!s(r)) {
36
+ n.push(i);
37
+ break;
38
+ }
39
+ r === "ed25519" || r === "rsa" ? (t.type = r, u += 1) : (n.push(i, r ?? ""), u += 1);
40
+ break;
41
+ }
42
+ case "--key-name":
43
+ s(e[u + 1]) ? (t.keyName = e[u + 1], u += 1) : n.push(i);
44
+ break;
45
+ case "--update-config":
46
+ t.updateConfig = !0;
47
+ break;
48
+ case "--skip-config":
49
+ t.skipConfig = !0;
50
+ break;
51
+ default:
52
+ n.push(i);
53
+ break;
54
+ }
55
+ }
56
+ return { options: t, unknown: n };
57
+ }, at = 7, Me = `gh-ssh
58
+ Interactive CLI that guides you through creating or reusing SSH keys and connecting them to GitHub.
59
+
60
+ Usage:
61
+ gh-ssh
62
+
63
+ Options:
64
+ -h, --help Show help
65
+ -v, --version Show version
66
+ --email <email> GitHub email for key comment
67
+ --type <ed25519|rsa> Key type (default: ed25519)
68
+ --key-name <name> Key filename in ~/.ssh (default: id_ed25519 or id_rsa)
69
+ --update-config Update ~/.ssh/config with the selected key
70
+ --skip-config Skip updating ~/.ssh/config
71
+ `, Wt = (e) => {
72
+ let t = e;
73
+ for (; ; ) {
74
+ const n = I(t, "package.json");
75
+ if (M(n))
76
+ return n;
77
+ const s = lt(t);
78
+ if (s === t)
79
+ return null;
80
+ t = s;
81
+ }
82
+ }, Gt = () => {
83
+ try {
84
+ const e = Ot(import.meta.url), t = lt(e), n = Wt(t);
85
+ if (!n)
86
+ return null;
87
+ const s = Ae(n, "utf8");
88
+ return JSON.parse(s).version ?? null;
89
+ } catch {
90
+ return null;
91
+ }
92
+ }, Kt = (e) => process.platform !== "darwin" ? !1 : Q("pbcopy", [], {
93
+ input: e,
94
+ encoding: "utf8"
95
+ }).status === 0, ct = (e, t, n) => {
96
+ const s = Q(e, t, {
97
+ stdio: "pipe",
98
+ encoding: "utf8",
99
+ input: n?.input
100
+ });
101
+ return s.status === 0 ? {
102
+ ok: !0,
103
+ stdout: typeof s.stdout == "string" ? s.stdout : void 0
104
+ } : {
105
+ ok: !1,
106
+ stdout: typeof s.stdout == "string" ? s.stdout : void 0
107
+ };
108
+ }, Vt = () => {
109
+ const e = ct("git", ["config", "--get", "user.email"]);
110
+ if (!e.ok || !e.stdout)
111
+ return null;
112
+ const t = e.stdout.trim();
113
+ return t.length > 0 ? t : null;
114
+ }, zt = (e) => {
115
+ const t = /SSH_AUTH_SOCK=([^;]+);/.exec(e), n = /SSH_AGENT_PID=([0-9]+);/.exec(e);
116
+ return {
117
+ socket: t?.[1],
118
+ pid: n?.[1]
119
+ };
120
+ }, Yt = (e) => M(e) ? Lt(e, { withFileTypes: !0 }).filter((t) => t.isFile() && t.name.endsWith(".pub")).map((t) => I(e, t.name)) : [], ht = (e) => {
121
+ M(e) || Rt(e, { recursive: !0, mode: 448 });
122
+ }, ft = (e, t) => {
123
+ const n = t.endsWith(".pub") ? t.slice(0, -4) : t;
124
+ return n === "~" ? V() : n.startsWith("~/") ? I(V(), n.slice(2)) : Tt(n) ? n : I(e, n);
125
+ }, Zt = () => {
126
+ if (process.env.SSH_AUTH_SOCK)
127
+ return { ok: !0 };
128
+ const e = ct("ssh-agent", ["-s"]);
129
+ if (!e.ok || !e.stdout)
130
+ return { ok: !1, reason: "start_failed" };
131
+ const t = zt(e.stdout);
132
+ return t.socket && (process.env.SSH_AUTH_SOCK = t.socket), t.pid && (process.env.SSH_AGENT_PID = t.pid), t.socket ? { ok: !0 } : { ok: !1, reason: "no_socket" };
133
+ }, Jt = (e) => Q("ssh-add", [e], {
134
+ stdio: "inherit",
135
+ env: process.env
136
+ }).status === 0, Ie = (e, t, n) => {
137
+ const s = ["-t", n, "-C", t, "-f", e];
138
+ return n === "rsa" && s.push("-b", "4096"), Q("ssh-keygen", s, { stdio: "inherit" }).status === 0;
139
+ }, Qt = (e) => {
140
+ if (!e)
141
+ return [];
142
+ const t = e.split(`
143
+ `);
144
+ return t.length > 0 && t[t.length - 1] === "" && t.pop(), t;
145
+ }, Xt = (e) => e.replace(/^\s*Host\s+/i, "").trim().split(/\s+/).filter(Boolean), dt = (e, t) => {
146
+ let n = -1;
147
+ for (let s = 0; s < e.length; s += 1) {
148
+ const u = e[s];
149
+ if (!/^\s*Host\s+(.+)$/i.exec(u))
150
+ continue;
151
+ if (n !== -1)
152
+ return { start: n, end: s };
153
+ Xt(u).includes(t) && (n = s);
154
+ }
155
+ return n === -1 ? null : { start: n, end: e.length };
156
+ }, pt = (e) => e.replace(/\s+#.*$/, "").trim(), eu = (e) => e.replace(/^"(.*)"$/, "$1"), le = (e) => /\s/.test(e) ? `"${e}"` : e, tu = (e, t) => {
157
+ const n = new RegExp(`^\\s*${t}\\s+(.+)$`, "i").exec(e);
158
+ return n ? pt(n[1]) : null;
159
+ }, uu = (e, t, n, s) => {
160
+ for (let u = t + 1; u < n; u += 1) {
161
+ const i = tu(e[u], s);
162
+ if (i)
163
+ return i;
164
+ }
165
+ }, _e = (e) => {
166
+ const t = eu(pt(e));
167
+ return t === "~" ? V() : t.startsWith("~/") ? I(V(), t.slice(2)) : t;
168
+ }, nu = (e) => {
169
+ const t = V();
170
+ if (e === t)
171
+ return le("~");
172
+ const n = `${t}/`;
173
+ return e.startsWith(n) ? le(`~/${e.slice(n.length)}`) : le(e);
174
+ }, Ft = (e) => {
175
+ const t = I(e, "config");
176
+ if (!M(t))
177
+ return { ok: !0, content: "", lines: [], configPath: t };
178
+ try {
179
+ const n = Ae(t, "utf8");
180
+ return { ok: !0, content: n, lines: Qt(n), configPath: t };
181
+ } catch {
182
+ return { ok: !1, reason: "read_failed", configPath: t };
183
+ }
184
+ }, ru = (e, t) => {
185
+ const n = Ft(e);
186
+ if (!n.ok)
187
+ return { ok: !1, reason: n.reason };
188
+ const s = dt(n.lines, t);
189
+ return s ? { ok: !0, info: { exists: !0, identityFile: uu(
190
+ n.lines,
191
+ s.start,
192
+ s.end,
193
+ "IdentityFile"
194
+ ) } } : { ok: !0, info: { exists: !1 } };
195
+ }, su = (e, t) => _e(e) === _e(t), iu = (e, t) => {
196
+ ht(e);
197
+ const n = Ft(e);
198
+ if (!n.ok)
199
+ return { ok: !1, reason: n.reason };
200
+ const { lines: s, content: u, configPath: i } = n, r = dt(s, t.host), D = " ", o = nu(t.identityFile), a = [];
201
+ if (t.hostName && a.push(`${D}HostName ${t.hostName}`), a.push(`${D}IdentityFile ${o}`), a.push(`${D}IdentitiesOnly yes`), t.useKeychain && a.push(`${D}UseKeychain yes`), r) {
202
+ const h = s.slice(r.start, r.end), f = h[0], g = [
203
+ /^\s*IdentityFile\s+/i,
204
+ /^\s*IdentitiesOnly\s+/i,
205
+ ...t.useKeychain ? [/^\s*UseKeychain\s+/i] : [],
206
+ ...t.hostName ? [/^\s*HostName\s+/i] : []
207
+ ], d = h.slice(1).filter((p) => !g.some((F) => F.test(p))), C = [f, ...a, ...d];
208
+ s.splice(
209
+ r.start,
210
+ r.end - r.start,
211
+ ...C
212
+ );
213
+ } else
214
+ s.length > 0 && s[s.length - 1].trim() !== "" && s.push(""), s.push(`Host ${t.host}`, ...a);
215
+ const l = `${s.join(`
216
+ `)}
217
+ `, c = u.endsWith(`
218
+ `) ? u : `${u}
219
+ `;
220
+ if (l === c)
221
+ return { ok: !0, changed: !1 };
222
+ try {
223
+ Ut(i, l, { mode: 384 }), $t(i, 384);
224
+ } catch {
225
+ return { ok: !1, reason: "write_failed" };
226
+ }
227
+ return { ok: !0, changed: !0 };
228
+ }, Du = !!process.stdout.isTTY && !process.env.NO_COLOR && process.env.TERM !== "dumb", H = (e, t) => Du ? `\x1B[${e}m${t}\x1B[0m` : t, L = {
229
+ bold: (e) => H("1", e),
230
+ dim: (e) => H("2", e),
231
+ red: (e) => H("31", e),
232
+ green: (e) => H("32", e),
233
+ yellow: (e) => H("33", e),
234
+ cyan: (e) => H("36", e)
235
+ }, w = {
236
+ header: "🚀",
237
+ subtitle: "🔐",
238
+ info: "💡",
239
+ success: "🎉",
240
+ warn: "⚠️",
241
+ error: "💥",
242
+ step: "🧭",
243
+ list: "🔹",
244
+ step1: "🔎",
245
+ step2: "🔐",
246
+ step3: "🧰",
247
+ step4: "➕",
248
+ step5: "📋",
249
+ step6: "✅",
250
+ step7: "🔗",
251
+ loading: "⏳"
252
+ }, re = (e, t) => t(`[${e}]`), O = (e) => {
253
+ console.log(`${w.info} ${re("INFO", L.cyan)} ${e}`);
254
+ }, W = (e) => {
255
+ console.log(`${w.success} ${re("OK", L.green)} ${e}`);
256
+ }, v = (e) => {
257
+ console.log(`${w.warn} ${re("WARN", L.yellow)} ${e}`);
258
+ }, P = (e) => {
259
+ console.error(`${w.error} ${re("ERROR", L.red)} ${e}`);
260
+ }, ou = () => {
261
+ console.log(L.bold(`${w.header} gh-ssh`)), console.log(L.dim(`${w.subtitle} GitHub SSH key setup`)), console.log(L.dim("----------------------------------------"));
262
+ }, $ = (e, t, n = w.step) => {
263
+ console.log(""), console.log(
264
+ `${n} ${L.cyan(`Step ${e}/${at}`)} ${L.bold(t)}`
265
+ );
266
+ }, lu = (e) => {
267
+ e.forEach((t) => {
268
+ console.log(` ${w.list} ${t}`);
269
+ });
270
+ }, T = async (e = 500) => {
271
+ console.log(L.dim(`${w.loading} Loading next step...`)), await new Promise((t) => {
272
+ setTimeout(t, e);
273
+ });
274
+ }, ae = (e, t = []) => (
275
+ // The up key
276
+ e.name === "up" || // Vim keybinding: hjkl keys map to left/down/up/right
277
+ t.includes("vim") && e.name === "k" || // Emacs keybinding: Ctrl+P means "previous" in Emacs navigation conventions
278
+ t.includes("emacs") && e.ctrl && e.name === "p"
279
+ ), Pe = (e, t = []) => (
280
+ // The down key
281
+ e.name === "down" || // Vim keybinding: hjkl keys map to left/down/up/right
282
+ t.includes("vim") && e.name === "j" || // Emacs keybinding: Ctrl+N means "next" in Emacs navigation conventions
283
+ t.includes("emacs") && e.ctrl && e.name === "n"
284
+ ), gt = (e) => e.name === "backspace", Ct = (e) => e.name === "tab", au = (e) => "1234567890".includes(e.name), ve = (e) => e.name === "enter" || e.name === "return";
285
+ class cu extends Error {
286
+ name = "AbortPromptError";
287
+ message = "Prompt was aborted";
288
+ constructor(t) {
289
+ super(), this.cause = t?.cause;
290
+ }
291
+ }
292
+ class hu extends Error {
293
+ name = "CancelPromptError";
294
+ message = "Prompt was canceled";
295
+ }
296
+ class je extends Error {
297
+ name = "ExitPromptError";
298
+ }
299
+ class fu extends Error {
300
+ name = "HookError";
301
+ }
302
+ class mt extends Error {
303
+ name = "ValidationError";
304
+ }
305
+ const Et = new It();
306
+ function du(e) {
307
+ return {
308
+ rl: e,
309
+ hooks: [],
310
+ hooksCleanup: [],
311
+ hooksEffect: [],
312
+ index: 0,
313
+ handleChange() {
314
+ }
315
+ };
316
+ }
317
+ function pu(e, t) {
318
+ const n = du(e);
319
+ return Et.run(n, () => {
320
+ function s(u) {
321
+ n.handleChange = () => {
322
+ n.index = 0, u();
323
+ }, n.handleChange();
324
+ }
325
+ return t(s);
326
+ });
327
+ }
328
+ function j() {
329
+ const e = Et.getStore();
330
+ if (!e)
331
+ throw new fu("[Inquirer] Hook functions can only be called from within a prompt");
332
+ return e;
333
+ }
334
+ function bt() {
335
+ return j().rl;
336
+ }
337
+ function Bt(e) {
338
+ const t = (...n) => {
339
+ const s = j();
340
+ let u = !1;
341
+ const i = s.handleChange;
342
+ s.handleChange = () => {
343
+ u = !0;
344
+ };
345
+ const r = e(...n);
346
+ return u && i(), s.handleChange = i, r;
347
+ };
348
+ return Se.bind(t);
349
+ }
350
+ function Le(e) {
351
+ const t = j(), { index: n } = t, s = {
352
+ get() {
353
+ return t.hooks[n];
354
+ },
355
+ set(i) {
356
+ t.hooks[n] = i;
357
+ },
358
+ initialized: n in t.hooks
359
+ }, u = e(s);
360
+ return t.index++, u;
361
+ }
362
+ function Fu() {
363
+ j().handleChange();
364
+ }
365
+ const Y = {
366
+ queue(e) {
367
+ const t = j(), { index: n } = t;
368
+ t.hooksEffect.push(() => {
369
+ t.hooksCleanup[n]?.();
370
+ const s = e(bt());
371
+ if (s != null && typeof s != "function")
372
+ throw new mt("useEffect return value must be a cleanup function or nothing.");
373
+ t.hooksCleanup[n] = s;
374
+ });
375
+ },
376
+ run() {
377
+ const e = j();
378
+ Bt(() => {
379
+ e.hooksEffect.forEach((t) => {
380
+ t();
381
+ }), e.hooksEffect.length = 0;
382
+ })();
383
+ },
384
+ clearAll() {
385
+ const e = j();
386
+ e.hooksCleanup.forEach((t) => {
387
+ t?.();
388
+ }), e.hooksEffect.length = 0, e.hooksCleanup.length = 0;
389
+ }
390
+ };
391
+ function A(e) {
392
+ return Le((t) => {
393
+ const n = Se.bind(function(i) {
394
+ t.get() !== i && (t.set(i), Fu());
395
+ });
396
+ if (t.initialized)
397
+ return [t.get(), n];
398
+ const s = typeof e == "function" ? e() : e;
399
+ return t.set(s), [s, n];
400
+ });
401
+ }
402
+ function se(e, t) {
403
+ Le((n) => {
404
+ const s = n.get();
405
+ (!Array.isArray(s) || t.some((i, r) => !Object.is(i, s[r]))) && Y.queue(e), n.set(t);
406
+ });
407
+ }
408
+ function ie(e) {
409
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
410
+ }
411
+ var ce, qe;
412
+ function gu() {
413
+ if (qe) return ce;
414
+ qe = 1;
415
+ const t = qt?.WriteStream?.prototype?.hasColors?.() ?? !1, n = (u, i) => {
416
+ if (!t)
417
+ return (o) => o;
418
+ const r = `\x1B[${u}m`, D = `\x1B[${i}m`;
419
+ return (o) => {
420
+ const a = o + "";
421
+ let l = a.indexOf(D);
422
+ if (l === -1)
423
+ return r + a + D;
424
+ let c = r, h = 0;
425
+ const g = (i === 22 ? D : "") + r;
426
+ for (; l !== -1; )
427
+ c += a.slice(h, l) + g, h = l + D.length, l = a.indexOf(D, h);
428
+ return c += a.slice(h) + D, c;
429
+ };
430
+ }, s = {};
431
+ return s.reset = n(0, 0), s.bold = n(1, 22), s.dim = n(2, 22), s.italic = n(3, 23), s.underline = n(4, 24), s.overline = n(53, 55), s.inverse = n(7, 27), s.hidden = n(8, 28), s.strikethrough = n(9, 29), s.black = n(30, 39), s.red = n(31, 39), s.green = n(32, 39), s.yellow = n(33, 39), s.blue = n(34, 39), s.magenta = n(35, 39), s.cyan = n(36, 39), s.white = n(37, 39), s.gray = n(90, 39), s.bgBlack = n(40, 49), s.bgRed = n(41, 49), s.bgGreen = n(42, 49), s.bgYellow = n(43, 49), s.bgBlue = n(44, 49), s.bgMagenta = n(45, 49), s.bgCyan = n(46, 49), s.bgWhite = n(47, 49), s.bgGray = n(100, 49), s.redBright = n(91, 39), s.greenBright = n(92, 39), s.yellowBright = n(93, 39), s.blueBright = n(94, 39), s.magentaBright = n(95, 39), s.cyanBright = n(96, 39), s.whiteBright = n(97, 39), s.bgRedBright = n(101, 49), s.bgGreenBright = n(102, 49), s.bgYellowBright = n(103, 49), s.bgBlueBright = n(104, 49), s.bgMagentaBright = n(105, 49), s.bgCyanBright = n(106, 49), s.bgWhiteBright = n(107, 49), ce = s, ce;
432
+ }
433
+ var Cu = /* @__PURE__ */ gu();
434
+ const y = /* @__PURE__ */ ie(Cu);
435
+ function mu() {
436
+ return S.platform !== "win32" ? S.env.TERM !== "linux" : !!S.env.WT_SESSION || // Windows Terminal
437
+ !!S.env.TERMINUS_SUBLIME || // Terminus (<0.2.27)
438
+ S.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
439
+ S.env.TERM_PROGRAM === "Terminus-Sublime" || S.env.TERM_PROGRAM === "vscode" || S.env.TERM === "xterm-256color" || S.env.TERM === "alacritty" || S.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
440
+ }
441
+ const yt = {
442
+ circleQuestionMark: "(?)",
443
+ questionMarkPrefix: "(?)",
444
+ square: "█",
445
+ squareDarkShade: "▓",
446
+ squareMediumShade: "▒",
447
+ squareLightShade: "░",
448
+ squareTop: "▀",
449
+ squareBottom: "▄",
450
+ squareLeft: "▌",
451
+ squareRight: "▐",
452
+ squareCenter: "■",
453
+ bullet: "●",
454
+ dot: "․",
455
+ ellipsis: "…",
456
+ pointerSmall: "›",
457
+ triangleUp: "▲",
458
+ triangleUpSmall: "▴",
459
+ triangleDown: "▼",
460
+ triangleDownSmall: "▾",
461
+ triangleLeftSmall: "◂",
462
+ triangleRightSmall: "▸",
463
+ home: "⌂",
464
+ heart: "♥",
465
+ musicNote: "♪",
466
+ musicNoteBeamed: "♫",
467
+ arrowUp: "↑",
468
+ arrowDown: "↓",
469
+ arrowLeft: "←",
470
+ arrowRight: "→",
471
+ arrowLeftRight: "↔",
472
+ arrowUpDown: "↕",
473
+ almostEqual: "≈",
474
+ notEqual: "≠",
475
+ lessOrEqual: "≤",
476
+ greaterOrEqual: "≥",
477
+ identical: "≡",
478
+ infinity: "∞",
479
+ subscriptZero: "₀",
480
+ subscriptOne: "₁",
481
+ subscriptTwo: "₂",
482
+ subscriptThree: "₃",
483
+ subscriptFour: "₄",
484
+ subscriptFive: "₅",
485
+ subscriptSix: "₆",
486
+ subscriptSeven: "₇",
487
+ subscriptEight: "₈",
488
+ subscriptNine: "₉",
489
+ oneHalf: "½",
490
+ oneThird: "⅓",
491
+ oneQuarter: "¼",
492
+ oneFifth: "⅕",
493
+ oneSixth: "⅙",
494
+ oneEighth: "⅛",
495
+ twoThirds: "⅔",
496
+ twoFifths: "⅖",
497
+ threeQuarters: "¾",
498
+ threeFifths: "⅗",
499
+ threeEighths: "⅜",
500
+ fourFifths: "⅘",
501
+ fiveSixths: "⅚",
502
+ fiveEighths: "⅝",
503
+ sevenEighths: "⅞",
504
+ line: "─",
505
+ lineBold: "━",
506
+ lineDouble: "═",
507
+ lineDashed0: "┄",
508
+ lineDashed1: "┅",
509
+ lineDashed2: "┈",
510
+ lineDashed3: "┉",
511
+ lineDashed4: "╌",
512
+ lineDashed5: "╍",
513
+ lineDashed6: "╴",
514
+ lineDashed7: "╶",
515
+ lineDashed8: "╸",
516
+ lineDashed9: "╺",
517
+ lineDashed10: "╼",
518
+ lineDashed11: "╾",
519
+ lineDashed12: "−",
520
+ lineDashed13: "–",
521
+ lineDashed14: "‐",
522
+ lineDashed15: "⁃",
523
+ lineVertical: "│",
524
+ lineVerticalBold: "┃",
525
+ lineVerticalDouble: "║",
526
+ lineVerticalDashed0: "┆",
527
+ lineVerticalDashed1: "┇",
528
+ lineVerticalDashed2: "┊",
529
+ lineVerticalDashed3: "┋",
530
+ lineVerticalDashed4: "╎",
531
+ lineVerticalDashed5: "╏",
532
+ lineVerticalDashed6: "╵",
533
+ lineVerticalDashed7: "╷",
534
+ lineVerticalDashed8: "╹",
535
+ lineVerticalDashed9: "╻",
536
+ lineVerticalDashed10: "╽",
537
+ lineVerticalDashed11: "╿",
538
+ lineDownLeft: "┐",
539
+ lineDownLeftArc: "╮",
540
+ lineDownBoldLeftBold: "┓",
541
+ lineDownBoldLeft: "┒",
542
+ lineDownLeftBold: "┑",
543
+ lineDownDoubleLeftDouble: "╗",
544
+ lineDownDoubleLeft: "╖",
545
+ lineDownLeftDouble: "╕",
546
+ lineDownRight: "┌",
547
+ lineDownRightArc: "╭",
548
+ lineDownBoldRightBold: "┏",
549
+ lineDownBoldRight: "┎",
550
+ lineDownRightBold: "┍",
551
+ lineDownDoubleRightDouble: "╔",
552
+ lineDownDoubleRight: "╓",
553
+ lineDownRightDouble: "╒",
554
+ lineUpLeft: "┘",
555
+ lineUpLeftArc: "╯",
556
+ lineUpBoldLeftBold: "┛",
557
+ lineUpBoldLeft: "┚",
558
+ lineUpLeftBold: "┙",
559
+ lineUpDoubleLeftDouble: "╝",
560
+ lineUpDoubleLeft: "╜",
561
+ lineUpLeftDouble: "╛",
562
+ lineUpRight: "└",
563
+ lineUpRightArc: "╰",
564
+ lineUpBoldRightBold: "┗",
565
+ lineUpBoldRight: "┖",
566
+ lineUpRightBold: "┕",
567
+ lineUpDoubleRightDouble: "╚",
568
+ lineUpDoubleRight: "╙",
569
+ lineUpRightDouble: "╘",
570
+ lineUpDownLeft: "┤",
571
+ lineUpBoldDownBoldLeftBold: "┫",
572
+ lineUpBoldDownBoldLeft: "┨",
573
+ lineUpDownLeftBold: "┥",
574
+ lineUpBoldDownLeftBold: "┩",
575
+ lineUpDownBoldLeftBold: "┪",
576
+ lineUpDownBoldLeft: "┧",
577
+ lineUpBoldDownLeft: "┦",
578
+ lineUpDoubleDownDoubleLeftDouble: "╣",
579
+ lineUpDoubleDownDoubleLeft: "╢",
580
+ lineUpDownLeftDouble: "╡",
581
+ lineUpDownRight: "├",
582
+ lineUpBoldDownBoldRightBold: "┣",
583
+ lineUpBoldDownBoldRight: "┠",
584
+ lineUpDownRightBold: "┝",
585
+ lineUpBoldDownRightBold: "┡",
586
+ lineUpDownBoldRightBold: "┢",
587
+ lineUpDownBoldRight: "┟",
588
+ lineUpBoldDownRight: "┞",
589
+ lineUpDoubleDownDoubleRightDouble: "╠",
590
+ lineUpDoubleDownDoubleRight: "╟",
591
+ lineUpDownRightDouble: "╞",
592
+ lineDownLeftRight: "┬",
593
+ lineDownBoldLeftBoldRightBold: "┳",
594
+ lineDownLeftBoldRightBold: "┯",
595
+ lineDownBoldLeftRight: "┰",
596
+ lineDownBoldLeftBoldRight: "┱",
597
+ lineDownBoldLeftRightBold: "┲",
598
+ lineDownLeftRightBold: "┮",
599
+ lineDownLeftBoldRight: "┭",
600
+ lineDownDoubleLeftDoubleRightDouble: "╦",
601
+ lineDownDoubleLeftRight: "╥",
602
+ lineDownLeftDoubleRightDouble: "╤",
603
+ lineUpLeftRight: "┴",
604
+ lineUpBoldLeftBoldRightBold: "┻",
605
+ lineUpLeftBoldRightBold: "┷",
606
+ lineUpBoldLeftRight: "┸",
607
+ lineUpBoldLeftBoldRight: "┹",
608
+ lineUpBoldLeftRightBold: "┺",
609
+ lineUpLeftRightBold: "┶",
610
+ lineUpLeftBoldRight: "┵",
611
+ lineUpDoubleLeftDoubleRightDouble: "╩",
612
+ lineUpDoubleLeftRight: "╨",
613
+ lineUpLeftDoubleRightDouble: "╧",
614
+ lineUpDownLeftRight: "┼",
615
+ lineUpBoldDownBoldLeftBoldRightBold: "╋",
616
+ lineUpDownBoldLeftBoldRightBold: "╈",
617
+ lineUpBoldDownLeftBoldRightBold: "╇",
618
+ lineUpBoldDownBoldLeftRightBold: "╊",
619
+ lineUpBoldDownBoldLeftBoldRight: "╉",
620
+ lineUpBoldDownLeftRight: "╀",
621
+ lineUpDownBoldLeftRight: "╁",
622
+ lineUpDownLeftBoldRight: "┽",
623
+ lineUpDownLeftRightBold: "┾",
624
+ lineUpBoldDownBoldLeftRight: "╂",
625
+ lineUpDownLeftBoldRightBold: "┿",
626
+ lineUpBoldDownLeftBoldRight: "╃",
627
+ lineUpBoldDownLeftRightBold: "╄",
628
+ lineUpDownBoldLeftBoldRight: "╅",
629
+ lineUpDownBoldLeftRightBold: "╆",
630
+ lineUpDoubleDownDoubleLeftDoubleRightDouble: "╬",
631
+ lineUpDoubleDownDoubleLeftRight: "╫",
632
+ lineUpDownLeftDoubleRightDouble: "╪",
633
+ lineCross: "╳",
634
+ lineBackslash: "╲",
635
+ lineSlash: "╱"
636
+ }, Eu = {
637
+ tick: "✔",
638
+ info: "ℹ",
639
+ warning: "⚠",
640
+ cross: "✘",
641
+ squareSmall: "◻",
642
+ squareSmallFilled: "◼",
643
+ circle: "◯",
644
+ circleFilled: "◉",
645
+ circleDotted: "◌",
646
+ circleDouble: "◎",
647
+ circleCircle: "ⓞ",
648
+ circleCross: "ⓧ",
649
+ circlePipe: "Ⓘ",
650
+ radioOn: "◉",
651
+ radioOff: "◯",
652
+ checkboxOn: "☒",
653
+ checkboxOff: "☐",
654
+ checkboxCircleOn: "ⓧ",
655
+ checkboxCircleOff: "Ⓘ",
656
+ pointer: "❯",
657
+ triangleUpOutline: "△",
658
+ triangleLeft: "◀",
659
+ triangleRight: "▶",
660
+ lozenge: "◆",
661
+ lozengeOutline: "◇",
662
+ hamburger: "☰",
663
+ smiley: "㋡",
664
+ mustache: "෴",
665
+ star: "★",
666
+ play: "▶",
667
+ nodejs: "⬢",
668
+ oneSeventh: "⅐",
669
+ oneNinth: "⅑",
670
+ oneTenth: "⅒"
671
+ }, bu = {
672
+ tick: "√",
673
+ info: "i",
674
+ warning: "‼",
675
+ cross: "×",
676
+ squareSmall: "□",
677
+ squareSmallFilled: "■",
678
+ circle: "( )",
679
+ circleFilled: "(*)",
680
+ circleDotted: "( )",
681
+ circleDouble: "( )",
682
+ circleCircle: "(○)",
683
+ circleCross: "(×)",
684
+ circlePipe: "(│)",
685
+ radioOn: "(*)",
686
+ radioOff: "( )",
687
+ checkboxOn: "[×]",
688
+ checkboxOff: "[ ]",
689
+ checkboxCircleOn: "(×)",
690
+ checkboxCircleOff: "( )",
691
+ pointer: ">",
692
+ triangleUpOutline: "∆",
693
+ triangleLeft: "◄",
694
+ triangleRight: "►",
695
+ lozenge: "♦",
696
+ lozengeOutline: "◊",
697
+ hamburger: "≡",
698
+ smiley: "☺",
699
+ mustache: "┌─┐",
700
+ star: "✶",
701
+ play: "►",
702
+ nodejs: "♦",
703
+ oneSeventh: "1/7",
704
+ oneNinth: "1/9",
705
+ oneTenth: "1/10"
706
+ }, Bu = {
707
+ ...yt,
708
+ ...Eu
709
+ }, yu = {
710
+ ...yt,
711
+ ...bu
712
+ }, wu = mu(), Re = wu ? Bu : yu, xu = {
713
+ prefix: {
714
+ idle: y.blue("?"),
715
+ done: y.green(Re.tick)
716
+ },
717
+ spinner: {
718
+ interval: 80,
719
+ frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((e) => y.yellow(e))
720
+ },
721
+ style: {
722
+ answer: y.cyan,
723
+ message: y.bold,
724
+ error: (e) => y.red(`> ${e}`),
725
+ defaultAnswer: (e) => y.dim(`(${e})`),
726
+ help: y.dim,
727
+ highlight: y.cyan,
728
+ key: (e) => y.cyan(y.bold(`<${e}>`))
729
+ }
730
+ };
731
+ function Ne(e) {
732
+ if (typeof e != "object" || e === null)
733
+ return !1;
734
+ let t = e;
735
+ for (; Object.getPrototypeOf(t) !== null; )
736
+ t = Object.getPrototypeOf(t);
737
+ return Object.getPrototypeOf(e) === t;
738
+ }
739
+ function wt(...e) {
740
+ const t = {};
741
+ for (const n of e)
742
+ for (const [s, u] of Object.entries(n)) {
743
+ const i = t[s];
744
+ t[s] = Ne(i) && Ne(u) ? wt(i, u) : u;
745
+ }
746
+ return t;
747
+ }
748
+ function De(...e) {
749
+ const t = [
750
+ xu,
751
+ ...e.filter((n) => n != null)
752
+ ];
753
+ return wt(...t);
754
+ }
755
+ function Ue({ status: e = "idle", theme: t }) {
756
+ const [n, s] = A(!1), [u, i] = A(0), { prefix: r, spinner: D } = De(t);
757
+ return se(() => {
758
+ if (e === "loading") {
759
+ let a, l = -1;
760
+ const c = setTimeout(() => {
761
+ s(!0), a = setInterval(() => {
762
+ l = l + 1, i(l % D.frames.length);
763
+ }, D.interval);
764
+ }, 300);
765
+ return () => {
766
+ clearTimeout(c), clearInterval(a);
767
+ };
768
+ } else
769
+ s(!1);
770
+ }, [e]), n ? D.frames[u] : typeof r == "string" ? r : r[e === "loading" ? "idle" : e] ?? r.idle;
771
+ }
772
+ function he(e, t) {
773
+ return Le((n) => {
774
+ const s = n.get();
775
+ if (!s || s.dependencies.length !== t.length || s.dependencies.some((u, i) => u !== t[i])) {
776
+ const u = e();
777
+ return n.set({ value: u, dependencies: t }), u;
778
+ }
779
+ return s.value;
780
+ });
781
+ }
782
+ function $e(e) {
783
+ return A({ current: e })[0];
784
+ }
785
+ function Te(e) {
786
+ const t = $e(e);
787
+ t.current = e, se((n) => {
788
+ let s = !1;
789
+ const u = Bt((i, r) => {
790
+ s || t.current(r, n);
791
+ });
792
+ return n.input.on("keypress", u), () => {
793
+ s = !0, n.input.removeListener("keypress", u);
794
+ };
795
+ }, []);
796
+ }
797
+ var fe, He;
798
+ function ku() {
799
+ if (He) return fe;
800
+ He = 1, fe = t;
801
+ function e(n) {
802
+ const s = {
803
+ defaultWidth: 0,
804
+ output: process.stdout,
805
+ tty: jt
806
+ };
807
+ return n ? (Object.keys(s).forEach(function(u) {
808
+ n[u] || (n[u] = s[u]);
809
+ }), n) : s;
810
+ }
811
+ function t(n) {
812
+ const s = e(n);
813
+ if (s.output.getWindowSize)
814
+ return s.output.getWindowSize()[0] || s.defaultWidth;
815
+ if (s.tty.getWindowSize)
816
+ return s.tty.getWindowSize()[1] || s.defaultWidth;
817
+ if (s.output.columns)
818
+ return s.output.columns;
819
+ if (process.env.CLI_WIDTH) {
820
+ const u = parseInt(process.env.CLI_WIDTH, 10);
821
+ if (!isNaN(u) && u !== 0)
822
+ return u;
823
+ }
824
+ return s.defaultWidth;
825
+ }
826
+ return fe;
827
+ }
828
+ var Au = ku();
829
+ const Su = /* @__PURE__ */ ie(Au);
830
+ var ee = { exports: {} }, de, We;
831
+ function vu() {
832
+ return We || (We = 1, de = ({ onlyFirst: e = !1 } = {}) => {
833
+ const t = [
834
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
835
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
836
+ ].join("|");
837
+ return new RegExp(t, e ? void 0 : "g");
838
+ }), de;
839
+ }
840
+ var pe, Ge;
841
+ function xt() {
842
+ if (Ge) return pe;
843
+ Ge = 1;
844
+ const e = vu();
845
+ return pe = (t) => typeof t == "string" ? t.replace(e(), "") : t, pe;
846
+ }
847
+ var te = { exports: {} }, Ke;
848
+ function Lu() {
849
+ if (Ke) return te.exports;
850
+ Ke = 1;
851
+ const e = (t) => Number.isNaN(t) ? !1 : t >= 4352 && (t <= 4447 || // Hangul Jamo
852
+ t === 9001 || // LEFT-POINTING ANGLE BRACKET
853
+ t === 9002 || // RIGHT-POINTING ANGLE BRACKET
854
+ // CJK Radicals Supplement .. Enclosed CJK Letters and Months
855
+ 11904 <= t && t <= 12871 && t !== 12351 || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
856
+ 12880 <= t && t <= 19903 || // CJK Unified Ideographs .. Yi Radicals
857
+ 19968 <= t && t <= 42182 || // Hangul Jamo Extended-A
858
+ 43360 <= t && t <= 43388 || // Hangul Syllables
859
+ 44032 <= t && t <= 55203 || // CJK Compatibility Ideographs
860
+ 63744 <= t && t <= 64255 || // Vertical Forms
861
+ 65040 <= t && t <= 65049 || // CJK Compatibility Forms .. Small Form Variants
862
+ 65072 <= t && t <= 65131 || // Halfwidth and Fullwidth Forms
863
+ 65281 <= t && t <= 65376 || 65504 <= t && t <= 65510 || // Kana Supplement
864
+ 110592 <= t && t <= 110593 || // Enclosed Ideographic Supplement
865
+ 127488 <= t && t <= 127569 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
866
+ 131072 <= t && t <= 262141);
867
+ return te.exports = e, te.exports.default = e, te.exports;
868
+ }
869
+ var Fe, Ve;
870
+ function Ru() {
871
+ return Ve || (Ve = 1, Fe = function() {
872
+ return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
873
+ }), Fe;
874
+ }
875
+ var ze;
876
+ function Uu() {
877
+ if (ze) return ee.exports;
878
+ ze = 1;
879
+ const e = xt(), t = Lu(), n = Ru(), s = (u) => {
880
+ if (typeof u != "string" || u.length === 0 || (u = e(u), u.length === 0))
881
+ return 0;
882
+ u = u.replace(n(), " ");
883
+ let i = 0;
884
+ for (let r = 0; r < u.length; r++) {
885
+ const D = u.codePointAt(r);
886
+ D <= 31 || D >= 127 && D <= 159 || D >= 768 && D <= 879 || (D > 65535 && r++, i += t(D) ? 2 : 1);
887
+ }
888
+ return i;
889
+ };
890
+ return ee.exports = s, ee.exports.default = s, ee.exports;
891
+ }
892
+ var ue = { exports: {} }, ge, Ye;
893
+ function $u() {
894
+ return Ye || (Ye = 1, ge = {
895
+ aliceblue: [240, 248, 255],
896
+ antiquewhite: [250, 235, 215],
897
+ aqua: [0, 255, 255],
898
+ aquamarine: [127, 255, 212],
899
+ azure: [240, 255, 255],
900
+ beige: [245, 245, 220],
901
+ bisque: [255, 228, 196],
902
+ black: [0, 0, 0],
903
+ blanchedalmond: [255, 235, 205],
904
+ blue: [0, 0, 255],
905
+ blueviolet: [138, 43, 226],
906
+ brown: [165, 42, 42],
907
+ burlywood: [222, 184, 135],
908
+ cadetblue: [95, 158, 160],
909
+ chartreuse: [127, 255, 0],
910
+ chocolate: [210, 105, 30],
911
+ coral: [255, 127, 80],
912
+ cornflowerblue: [100, 149, 237],
913
+ cornsilk: [255, 248, 220],
914
+ crimson: [220, 20, 60],
915
+ cyan: [0, 255, 255],
916
+ darkblue: [0, 0, 139],
917
+ darkcyan: [0, 139, 139],
918
+ darkgoldenrod: [184, 134, 11],
919
+ darkgray: [169, 169, 169],
920
+ darkgreen: [0, 100, 0],
921
+ darkgrey: [169, 169, 169],
922
+ darkkhaki: [189, 183, 107],
923
+ darkmagenta: [139, 0, 139],
924
+ darkolivegreen: [85, 107, 47],
925
+ darkorange: [255, 140, 0],
926
+ darkorchid: [153, 50, 204],
927
+ darkred: [139, 0, 0],
928
+ darksalmon: [233, 150, 122],
929
+ darkseagreen: [143, 188, 143],
930
+ darkslateblue: [72, 61, 139],
931
+ darkslategray: [47, 79, 79],
932
+ darkslategrey: [47, 79, 79],
933
+ darkturquoise: [0, 206, 209],
934
+ darkviolet: [148, 0, 211],
935
+ deeppink: [255, 20, 147],
936
+ deepskyblue: [0, 191, 255],
937
+ dimgray: [105, 105, 105],
938
+ dimgrey: [105, 105, 105],
939
+ dodgerblue: [30, 144, 255],
940
+ firebrick: [178, 34, 34],
941
+ floralwhite: [255, 250, 240],
942
+ forestgreen: [34, 139, 34],
943
+ fuchsia: [255, 0, 255],
944
+ gainsboro: [220, 220, 220],
945
+ ghostwhite: [248, 248, 255],
946
+ gold: [255, 215, 0],
947
+ goldenrod: [218, 165, 32],
948
+ gray: [128, 128, 128],
949
+ green: [0, 128, 0],
950
+ greenyellow: [173, 255, 47],
951
+ grey: [128, 128, 128],
952
+ honeydew: [240, 255, 240],
953
+ hotpink: [255, 105, 180],
954
+ indianred: [205, 92, 92],
955
+ indigo: [75, 0, 130],
956
+ ivory: [255, 255, 240],
957
+ khaki: [240, 230, 140],
958
+ lavender: [230, 230, 250],
959
+ lavenderblush: [255, 240, 245],
960
+ lawngreen: [124, 252, 0],
961
+ lemonchiffon: [255, 250, 205],
962
+ lightblue: [173, 216, 230],
963
+ lightcoral: [240, 128, 128],
964
+ lightcyan: [224, 255, 255],
965
+ lightgoldenrodyellow: [250, 250, 210],
966
+ lightgray: [211, 211, 211],
967
+ lightgreen: [144, 238, 144],
968
+ lightgrey: [211, 211, 211],
969
+ lightpink: [255, 182, 193],
970
+ lightsalmon: [255, 160, 122],
971
+ lightseagreen: [32, 178, 170],
972
+ lightskyblue: [135, 206, 250],
973
+ lightslategray: [119, 136, 153],
974
+ lightslategrey: [119, 136, 153],
975
+ lightsteelblue: [176, 196, 222],
976
+ lightyellow: [255, 255, 224],
977
+ lime: [0, 255, 0],
978
+ limegreen: [50, 205, 50],
979
+ linen: [250, 240, 230],
980
+ magenta: [255, 0, 255],
981
+ maroon: [128, 0, 0],
982
+ mediumaquamarine: [102, 205, 170],
983
+ mediumblue: [0, 0, 205],
984
+ mediumorchid: [186, 85, 211],
985
+ mediumpurple: [147, 112, 219],
986
+ mediumseagreen: [60, 179, 113],
987
+ mediumslateblue: [123, 104, 238],
988
+ mediumspringgreen: [0, 250, 154],
989
+ mediumturquoise: [72, 209, 204],
990
+ mediumvioletred: [199, 21, 133],
991
+ midnightblue: [25, 25, 112],
992
+ mintcream: [245, 255, 250],
993
+ mistyrose: [255, 228, 225],
994
+ moccasin: [255, 228, 181],
995
+ navajowhite: [255, 222, 173],
996
+ navy: [0, 0, 128],
997
+ oldlace: [253, 245, 230],
998
+ olive: [128, 128, 0],
999
+ olivedrab: [107, 142, 35],
1000
+ orange: [255, 165, 0],
1001
+ orangered: [255, 69, 0],
1002
+ orchid: [218, 112, 214],
1003
+ palegoldenrod: [238, 232, 170],
1004
+ palegreen: [152, 251, 152],
1005
+ paleturquoise: [175, 238, 238],
1006
+ palevioletred: [219, 112, 147],
1007
+ papayawhip: [255, 239, 213],
1008
+ peachpuff: [255, 218, 185],
1009
+ peru: [205, 133, 63],
1010
+ pink: [255, 192, 203],
1011
+ plum: [221, 160, 221],
1012
+ powderblue: [176, 224, 230],
1013
+ purple: [128, 0, 128],
1014
+ rebeccapurple: [102, 51, 153],
1015
+ red: [255, 0, 0],
1016
+ rosybrown: [188, 143, 143],
1017
+ royalblue: [65, 105, 225],
1018
+ saddlebrown: [139, 69, 19],
1019
+ salmon: [250, 128, 114],
1020
+ sandybrown: [244, 164, 96],
1021
+ seagreen: [46, 139, 87],
1022
+ seashell: [255, 245, 238],
1023
+ sienna: [160, 82, 45],
1024
+ silver: [192, 192, 192],
1025
+ skyblue: [135, 206, 235],
1026
+ slateblue: [106, 90, 205],
1027
+ slategray: [112, 128, 144],
1028
+ slategrey: [112, 128, 144],
1029
+ snow: [255, 250, 250],
1030
+ springgreen: [0, 255, 127],
1031
+ steelblue: [70, 130, 180],
1032
+ tan: [210, 180, 140],
1033
+ teal: [0, 128, 128],
1034
+ thistle: [216, 191, 216],
1035
+ tomato: [255, 99, 71],
1036
+ turquoise: [64, 224, 208],
1037
+ violet: [238, 130, 238],
1038
+ wheat: [245, 222, 179],
1039
+ white: [255, 255, 255],
1040
+ whitesmoke: [245, 245, 245],
1041
+ yellow: [255, 255, 0],
1042
+ yellowgreen: [154, 205, 50]
1043
+ }), ge;
1044
+ }
1045
+ var Ce, Ze;
1046
+ function kt() {
1047
+ if (Ze) return Ce;
1048
+ Ze = 1;
1049
+ const e = $u(), t = {};
1050
+ for (const u of Object.keys(e))
1051
+ t[e[u]] = u;
1052
+ const n = {
1053
+ rgb: { channels: 3, labels: "rgb" },
1054
+ hsl: { channels: 3, labels: "hsl" },
1055
+ hsv: { channels: 3, labels: "hsv" },
1056
+ hwb: { channels: 3, labels: "hwb" },
1057
+ cmyk: { channels: 4, labels: "cmyk" },
1058
+ xyz: { channels: 3, labels: "xyz" },
1059
+ lab: { channels: 3, labels: "lab" },
1060
+ lch: { channels: 3, labels: "lch" },
1061
+ hex: { channels: 1, labels: ["hex"] },
1062
+ keyword: { channels: 1, labels: ["keyword"] },
1063
+ ansi16: { channels: 1, labels: ["ansi16"] },
1064
+ ansi256: { channels: 1, labels: ["ansi256"] },
1065
+ hcg: { channels: 3, labels: ["h", "c", "g"] },
1066
+ apple: { channels: 3, labels: ["r16", "g16", "b16"] },
1067
+ gray: { channels: 1, labels: ["gray"] }
1068
+ };
1069
+ Ce = n;
1070
+ for (const u of Object.keys(n)) {
1071
+ if (!("channels" in n[u]))
1072
+ throw new Error("missing channels property: " + u);
1073
+ if (!("labels" in n[u]))
1074
+ throw new Error("missing channel labels property: " + u);
1075
+ if (n[u].labels.length !== n[u].channels)
1076
+ throw new Error("channel and label counts mismatch: " + u);
1077
+ const { channels: i, labels: r } = n[u];
1078
+ delete n[u].channels, delete n[u].labels, Object.defineProperty(n[u], "channels", { value: i }), Object.defineProperty(n[u], "labels", { value: r });
1079
+ }
1080
+ n.rgb.hsl = function(u) {
1081
+ const i = u[0] / 255, r = u[1] / 255, D = u[2] / 255, o = Math.min(i, r, D), a = Math.max(i, r, D), l = a - o;
1082
+ let c, h;
1083
+ a === o ? c = 0 : i === a ? c = (r - D) / l : r === a ? c = 2 + (D - i) / l : D === a && (c = 4 + (i - r) / l), c = Math.min(c * 60, 360), c < 0 && (c += 360);
1084
+ const f = (o + a) / 2;
1085
+ return a === o ? h = 0 : f <= 0.5 ? h = l / (a + o) : h = l / (2 - a - o), [c, h * 100, f * 100];
1086
+ }, n.rgb.hsv = function(u) {
1087
+ let i, r, D, o, a;
1088
+ const l = u[0] / 255, c = u[1] / 255, h = u[2] / 255, f = Math.max(l, c, h), g = f - Math.min(l, c, h), d = function(C) {
1089
+ return (f - C) / 6 / g + 1 / 2;
1090
+ };
1091
+ return g === 0 ? (o = 0, a = 0) : (a = g / f, i = d(l), r = d(c), D = d(h), l === f ? o = D - r : c === f ? o = 1 / 3 + i - D : h === f && (o = 2 / 3 + r - i), o < 0 ? o += 1 : o > 1 && (o -= 1)), [
1092
+ o * 360,
1093
+ a * 100,
1094
+ f * 100
1095
+ ];
1096
+ }, n.rgb.hwb = function(u) {
1097
+ const i = u[0], r = u[1];
1098
+ let D = u[2];
1099
+ const o = n.rgb.hsl(u)[0], a = 1 / 255 * Math.min(i, Math.min(r, D));
1100
+ return D = 1 - 1 / 255 * Math.max(i, Math.max(r, D)), [o, a * 100, D * 100];
1101
+ }, n.rgb.cmyk = function(u) {
1102
+ const i = u[0] / 255, r = u[1] / 255, D = u[2] / 255, o = Math.min(1 - i, 1 - r, 1 - D), a = (1 - i - o) / (1 - o) || 0, l = (1 - r - o) / (1 - o) || 0, c = (1 - D - o) / (1 - o) || 0;
1103
+ return [a * 100, l * 100, c * 100, o * 100];
1104
+ };
1105
+ function s(u, i) {
1106
+ return (u[0] - i[0]) ** 2 + (u[1] - i[1]) ** 2 + (u[2] - i[2]) ** 2;
1107
+ }
1108
+ return n.rgb.keyword = function(u) {
1109
+ const i = t[u];
1110
+ if (i)
1111
+ return i;
1112
+ let r = 1 / 0, D;
1113
+ for (const o of Object.keys(e)) {
1114
+ const a = e[o], l = s(u, a);
1115
+ l < r && (r = l, D = o);
1116
+ }
1117
+ return D;
1118
+ }, n.keyword.rgb = function(u) {
1119
+ return e[u];
1120
+ }, n.rgb.xyz = function(u) {
1121
+ let i = u[0] / 255, r = u[1] / 255, D = u[2] / 255;
1122
+ i = i > 0.04045 ? ((i + 0.055) / 1.055) ** 2.4 : i / 12.92, r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92, D = D > 0.04045 ? ((D + 0.055) / 1.055) ** 2.4 : D / 12.92;
1123
+ const o = i * 0.4124 + r * 0.3576 + D * 0.1805, a = i * 0.2126 + r * 0.7152 + D * 0.0722, l = i * 0.0193 + r * 0.1192 + D * 0.9505;
1124
+ return [o * 100, a * 100, l * 100];
1125
+ }, n.rgb.lab = function(u) {
1126
+ const i = n.rgb.xyz(u);
1127
+ let r = i[0], D = i[1], o = i[2];
1128
+ r /= 95.047, D /= 100, o /= 108.883, r = r > 8856e-6 ? r ** (1 / 3) : 7.787 * r + 16 / 116, D = D > 8856e-6 ? D ** (1 / 3) : 7.787 * D + 16 / 116, o = o > 8856e-6 ? o ** (1 / 3) : 7.787 * o + 16 / 116;
1129
+ const a = 116 * D - 16, l = 500 * (r - D), c = 200 * (D - o);
1130
+ return [a, l, c];
1131
+ }, n.hsl.rgb = function(u) {
1132
+ const i = u[0] / 360, r = u[1] / 100, D = u[2] / 100;
1133
+ let o, a, l;
1134
+ if (r === 0)
1135
+ return l = D * 255, [l, l, l];
1136
+ D < 0.5 ? o = D * (1 + r) : o = D + r - D * r;
1137
+ const c = 2 * D - o, h = [0, 0, 0];
1138
+ for (let f = 0; f < 3; f++)
1139
+ a = i + 1 / 3 * -(f - 1), a < 0 && a++, a > 1 && a--, 6 * a < 1 ? l = c + (o - c) * 6 * a : 2 * a < 1 ? l = o : 3 * a < 2 ? l = c + (o - c) * (2 / 3 - a) * 6 : l = c, h[f] = l * 255;
1140
+ return h;
1141
+ }, n.hsl.hsv = function(u) {
1142
+ const i = u[0];
1143
+ let r = u[1] / 100, D = u[2] / 100, o = r;
1144
+ const a = Math.max(D, 0.01);
1145
+ D *= 2, r *= D <= 1 ? D : 2 - D, o *= a <= 1 ? a : 2 - a;
1146
+ const l = (D + r) / 2, c = D === 0 ? 2 * o / (a + o) : 2 * r / (D + r);
1147
+ return [i, c * 100, l * 100];
1148
+ }, n.hsv.rgb = function(u) {
1149
+ const i = u[0] / 60, r = u[1] / 100;
1150
+ let D = u[2] / 100;
1151
+ const o = Math.floor(i) % 6, a = i - Math.floor(i), l = 255 * D * (1 - r), c = 255 * D * (1 - r * a), h = 255 * D * (1 - r * (1 - a));
1152
+ switch (D *= 255, o) {
1153
+ case 0:
1154
+ return [D, h, l];
1155
+ case 1:
1156
+ return [c, D, l];
1157
+ case 2:
1158
+ return [l, D, h];
1159
+ case 3:
1160
+ return [l, c, D];
1161
+ case 4:
1162
+ return [h, l, D];
1163
+ case 5:
1164
+ return [D, l, c];
1165
+ }
1166
+ }, n.hsv.hsl = function(u) {
1167
+ const i = u[0], r = u[1] / 100, D = u[2] / 100, o = Math.max(D, 0.01);
1168
+ let a, l;
1169
+ l = (2 - r) * D;
1170
+ const c = (2 - r) * o;
1171
+ return a = r * o, a /= c <= 1 ? c : 2 - c, a = a || 0, l /= 2, [i, a * 100, l * 100];
1172
+ }, n.hwb.rgb = function(u) {
1173
+ const i = u[0] / 360;
1174
+ let r = u[1] / 100, D = u[2] / 100;
1175
+ const o = r + D;
1176
+ let a;
1177
+ o > 1 && (r /= o, D /= o);
1178
+ const l = Math.floor(6 * i), c = 1 - D;
1179
+ a = 6 * i - l, (l & 1) !== 0 && (a = 1 - a);
1180
+ const h = r + a * (c - r);
1181
+ let f, g, d;
1182
+ switch (l) {
1183
+ default:
1184
+ case 6:
1185
+ case 0:
1186
+ f = c, g = h, d = r;
1187
+ break;
1188
+ case 1:
1189
+ f = h, g = c, d = r;
1190
+ break;
1191
+ case 2:
1192
+ f = r, g = c, d = h;
1193
+ break;
1194
+ case 3:
1195
+ f = r, g = h, d = c;
1196
+ break;
1197
+ case 4:
1198
+ f = h, g = r, d = c;
1199
+ break;
1200
+ case 5:
1201
+ f = c, g = r, d = h;
1202
+ break;
1203
+ }
1204
+ return [f * 255, g * 255, d * 255];
1205
+ }, n.cmyk.rgb = function(u) {
1206
+ const i = u[0] / 100, r = u[1] / 100, D = u[2] / 100, o = u[3] / 100, a = 1 - Math.min(1, i * (1 - o) + o), l = 1 - Math.min(1, r * (1 - o) + o), c = 1 - Math.min(1, D * (1 - o) + o);
1207
+ return [a * 255, l * 255, c * 255];
1208
+ }, n.xyz.rgb = function(u) {
1209
+ const i = u[0] / 100, r = u[1] / 100, D = u[2] / 100;
1210
+ let o, a, l;
1211
+ return o = i * 3.2406 + r * -1.5372 + D * -0.4986, a = i * -0.9689 + r * 1.8758 + D * 0.0415, l = i * 0.0557 + r * -0.204 + D * 1.057, o = o > 31308e-7 ? 1.055 * o ** (1 / 2.4) - 0.055 : o * 12.92, a = a > 31308e-7 ? 1.055 * a ** (1 / 2.4) - 0.055 : a * 12.92, l = l > 31308e-7 ? 1.055 * l ** (1 / 2.4) - 0.055 : l * 12.92, o = Math.min(Math.max(0, o), 1), a = Math.min(Math.max(0, a), 1), l = Math.min(Math.max(0, l), 1), [o * 255, a * 255, l * 255];
1212
+ }, n.xyz.lab = function(u) {
1213
+ let i = u[0], r = u[1], D = u[2];
1214
+ i /= 95.047, r /= 100, D /= 108.883, i = i > 8856e-6 ? i ** (1 / 3) : 7.787 * i + 16 / 116, r = r > 8856e-6 ? r ** (1 / 3) : 7.787 * r + 16 / 116, D = D > 8856e-6 ? D ** (1 / 3) : 7.787 * D + 16 / 116;
1215
+ const o = 116 * r - 16, a = 500 * (i - r), l = 200 * (r - D);
1216
+ return [o, a, l];
1217
+ }, n.lab.xyz = function(u) {
1218
+ const i = u[0], r = u[1], D = u[2];
1219
+ let o, a, l;
1220
+ a = (i + 16) / 116, o = r / 500 + a, l = a - D / 200;
1221
+ const c = a ** 3, h = o ** 3, f = l ** 3;
1222
+ return a = c > 8856e-6 ? c : (a - 16 / 116) / 7.787, o = h > 8856e-6 ? h : (o - 16 / 116) / 7.787, l = f > 8856e-6 ? f : (l - 16 / 116) / 7.787, o *= 95.047, a *= 100, l *= 108.883, [o, a, l];
1223
+ }, n.lab.lch = function(u) {
1224
+ const i = u[0], r = u[1], D = u[2];
1225
+ let o;
1226
+ o = Math.atan2(D, r) * 360 / 2 / Math.PI, o < 0 && (o += 360);
1227
+ const l = Math.sqrt(r * r + D * D);
1228
+ return [i, l, o];
1229
+ }, n.lch.lab = function(u) {
1230
+ const i = u[0], r = u[1], o = u[2] / 360 * 2 * Math.PI, a = r * Math.cos(o), l = r * Math.sin(o);
1231
+ return [i, a, l];
1232
+ }, n.rgb.ansi16 = function(u, i = null) {
1233
+ const [r, D, o] = u;
1234
+ let a = i === null ? n.rgb.hsv(u)[2] : i;
1235
+ if (a = Math.round(a / 50), a === 0)
1236
+ return 30;
1237
+ let l = 30 + (Math.round(o / 255) << 2 | Math.round(D / 255) << 1 | Math.round(r / 255));
1238
+ return a === 2 && (l += 60), l;
1239
+ }, n.hsv.ansi16 = function(u) {
1240
+ return n.rgb.ansi16(n.hsv.rgb(u), u[2]);
1241
+ }, n.rgb.ansi256 = function(u) {
1242
+ const i = u[0], r = u[1], D = u[2];
1243
+ return i === r && r === D ? i < 8 ? 16 : i > 248 ? 231 : Math.round((i - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(i / 255 * 5) + 6 * Math.round(r / 255 * 5) + Math.round(D / 255 * 5);
1244
+ }, n.ansi16.rgb = function(u) {
1245
+ let i = u % 10;
1246
+ if (i === 0 || i === 7)
1247
+ return u > 50 && (i += 3.5), i = i / 10.5 * 255, [i, i, i];
1248
+ const r = (~~(u > 50) + 1) * 0.5, D = (i & 1) * r * 255, o = (i >> 1 & 1) * r * 255, a = (i >> 2 & 1) * r * 255;
1249
+ return [D, o, a];
1250
+ }, n.ansi256.rgb = function(u) {
1251
+ if (u >= 232) {
1252
+ const a = (u - 232) * 10 + 8;
1253
+ return [a, a, a];
1254
+ }
1255
+ u -= 16;
1256
+ let i;
1257
+ const r = Math.floor(u / 36) / 5 * 255, D = Math.floor((i = u % 36) / 6) / 5 * 255, o = i % 6 / 5 * 255;
1258
+ return [r, D, o];
1259
+ }, n.rgb.hex = function(u) {
1260
+ const r = (((Math.round(u[0]) & 255) << 16) + ((Math.round(u[1]) & 255) << 8) + (Math.round(u[2]) & 255)).toString(16).toUpperCase();
1261
+ return "000000".substring(r.length) + r;
1262
+ }, n.hex.rgb = function(u) {
1263
+ const i = u.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
1264
+ if (!i)
1265
+ return [0, 0, 0];
1266
+ let r = i[0];
1267
+ i[0].length === 3 && (r = r.split("").map((c) => c + c).join(""));
1268
+ const D = parseInt(r, 16), o = D >> 16 & 255, a = D >> 8 & 255, l = D & 255;
1269
+ return [o, a, l];
1270
+ }, n.rgb.hcg = function(u) {
1271
+ const i = u[0] / 255, r = u[1] / 255, D = u[2] / 255, o = Math.max(Math.max(i, r), D), a = Math.min(Math.min(i, r), D), l = o - a;
1272
+ let c, h;
1273
+ return l < 1 ? c = a / (1 - l) : c = 0, l <= 0 ? h = 0 : o === i ? h = (r - D) / l % 6 : o === r ? h = 2 + (D - i) / l : h = 4 + (i - r) / l, h /= 6, h %= 1, [h * 360, l * 100, c * 100];
1274
+ }, n.hsl.hcg = function(u) {
1275
+ const i = u[1] / 100, r = u[2] / 100, D = r < 0.5 ? 2 * i * r : 2 * i * (1 - r);
1276
+ let o = 0;
1277
+ return D < 1 && (o = (r - 0.5 * D) / (1 - D)), [u[0], D * 100, o * 100];
1278
+ }, n.hsv.hcg = function(u) {
1279
+ const i = u[1] / 100, r = u[2] / 100, D = i * r;
1280
+ let o = 0;
1281
+ return D < 1 && (o = (r - D) / (1 - D)), [u[0], D * 100, o * 100];
1282
+ }, n.hcg.rgb = function(u) {
1283
+ const i = u[0] / 360, r = u[1] / 100, D = u[2] / 100;
1284
+ if (r === 0)
1285
+ return [D * 255, D * 255, D * 255];
1286
+ const o = [0, 0, 0], a = i % 1 * 6, l = a % 1, c = 1 - l;
1287
+ let h = 0;
1288
+ switch (Math.floor(a)) {
1289
+ case 0:
1290
+ o[0] = 1, o[1] = l, o[2] = 0;
1291
+ break;
1292
+ case 1:
1293
+ o[0] = c, o[1] = 1, o[2] = 0;
1294
+ break;
1295
+ case 2:
1296
+ o[0] = 0, o[1] = 1, o[2] = l;
1297
+ break;
1298
+ case 3:
1299
+ o[0] = 0, o[1] = c, o[2] = 1;
1300
+ break;
1301
+ case 4:
1302
+ o[0] = l, o[1] = 0, o[2] = 1;
1303
+ break;
1304
+ default:
1305
+ o[0] = 1, o[1] = 0, o[2] = c;
1306
+ }
1307
+ return h = (1 - r) * D, [
1308
+ (r * o[0] + h) * 255,
1309
+ (r * o[1] + h) * 255,
1310
+ (r * o[2] + h) * 255
1311
+ ];
1312
+ }, n.hcg.hsv = function(u) {
1313
+ const i = u[1] / 100, r = u[2] / 100, D = i + r * (1 - i);
1314
+ let o = 0;
1315
+ return D > 0 && (o = i / D), [u[0], o * 100, D * 100];
1316
+ }, n.hcg.hsl = function(u) {
1317
+ const i = u[1] / 100, D = u[2] / 100 * (1 - i) + 0.5 * i;
1318
+ let o = 0;
1319
+ return D > 0 && D < 0.5 ? o = i / (2 * D) : D >= 0.5 && D < 1 && (o = i / (2 * (1 - D))), [u[0], o * 100, D * 100];
1320
+ }, n.hcg.hwb = function(u) {
1321
+ const i = u[1] / 100, r = u[2] / 100, D = i + r * (1 - i);
1322
+ return [u[0], (D - i) * 100, (1 - D) * 100];
1323
+ }, n.hwb.hcg = function(u) {
1324
+ const i = u[1] / 100, D = 1 - u[2] / 100, o = D - i;
1325
+ let a = 0;
1326
+ return o < 1 && (a = (D - o) / (1 - o)), [u[0], o * 100, a * 100];
1327
+ }, n.apple.rgb = function(u) {
1328
+ return [u[0] / 65535 * 255, u[1] / 65535 * 255, u[2] / 65535 * 255];
1329
+ }, n.rgb.apple = function(u) {
1330
+ return [u[0] / 255 * 65535, u[1] / 255 * 65535, u[2] / 255 * 65535];
1331
+ }, n.gray.rgb = function(u) {
1332
+ return [u[0] / 100 * 255, u[0] / 100 * 255, u[0] / 100 * 255];
1333
+ }, n.gray.hsl = function(u) {
1334
+ return [0, 0, u[0]];
1335
+ }, n.gray.hsv = n.gray.hsl, n.gray.hwb = function(u) {
1336
+ return [0, 100, u[0]];
1337
+ }, n.gray.cmyk = function(u) {
1338
+ return [0, 0, 0, u[0]];
1339
+ }, n.gray.lab = function(u) {
1340
+ return [u[0], 0, 0];
1341
+ }, n.gray.hex = function(u) {
1342
+ const i = Math.round(u[0] / 100 * 255) & 255, D = ((i << 16) + (i << 8) + i).toString(16).toUpperCase();
1343
+ return "000000".substring(D.length) + D;
1344
+ }, n.rgb.gray = function(u) {
1345
+ return [(u[0] + u[1] + u[2]) / 3 / 255 * 100];
1346
+ }, Ce;
1347
+ }
1348
+ var me, Je;
1349
+ function Tu() {
1350
+ if (Je) return me;
1351
+ Je = 1;
1352
+ const e = kt();
1353
+ function t() {
1354
+ const i = {}, r = Object.keys(e);
1355
+ for (let D = r.length, o = 0; o < D; o++)
1356
+ i[r[o]] = {
1357
+ // http://jsperf.com/1-vs-infinity
1358
+ // micro-opt, but this is simple.
1359
+ distance: -1,
1360
+ parent: null
1361
+ };
1362
+ return i;
1363
+ }
1364
+ function n(i) {
1365
+ const r = t(), D = [i];
1366
+ for (r[i].distance = 0; D.length; ) {
1367
+ const o = D.pop(), a = Object.keys(e[o]);
1368
+ for (let l = a.length, c = 0; c < l; c++) {
1369
+ const h = a[c], f = r[h];
1370
+ f.distance === -1 && (f.distance = r[o].distance + 1, f.parent = o, D.unshift(h));
1371
+ }
1372
+ }
1373
+ return r;
1374
+ }
1375
+ function s(i, r) {
1376
+ return function(D) {
1377
+ return r(i(D));
1378
+ };
1379
+ }
1380
+ function u(i, r) {
1381
+ const D = [r[i].parent, i];
1382
+ let o = e[r[i].parent][i], a = r[i].parent;
1383
+ for (; r[a].parent; )
1384
+ D.unshift(r[a].parent), o = s(e[r[a].parent][a], o), a = r[a].parent;
1385
+ return o.conversion = D, o;
1386
+ }
1387
+ return me = function(i) {
1388
+ const r = n(i), D = {}, o = Object.keys(r);
1389
+ for (let a = o.length, l = 0; l < a; l++) {
1390
+ const c = o[l];
1391
+ r[c].parent !== null && (D[c] = u(c, r));
1392
+ }
1393
+ return D;
1394
+ }, me;
1395
+ }
1396
+ var Ee, Qe;
1397
+ function Ou() {
1398
+ if (Qe) return Ee;
1399
+ Qe = 1;
1400
+ const e = kt(), t = Tu(), n = {}, s = Object.keys(e);
1401
+ function u(r) {
1402
+ const D = function(...o) {
1403
+ const a = o[0];
1404
+ return a == null ? a : (a.length > 1 && (o = a), r(o));
1405
+ };
1406
+ return "conversion" in r && (D.conversion = r.conversion), D;
1407
+ }
1408
+ function i(r) {
1409
+ const D = function(...o) {
1410
+ const a = o[0];
1411
+ if (a == null)
1412
+ return a;
1413
+ a.length > 1 && (o = a);
1414
+ const l = r(o);
1415
+ if (typeof l == "object")
1416
+ for (let c = l.length, h = 0; h < c; h++)
1417
+ l[h] = Math.round(l[h]);
1418
+ return l;
1419
+ };
1420
+ return "conversion" in r && (D.conversion = r.conversion), D;
1421
+ }
1422
+ return s.forEach((r) => {
1423
+ n[r] = {}, Object.defineProperty(n[r], "channels", { value: e[r].channels }), Object.defineProperty(n[r], "labels", { value: e[r].labels });
1424
+ const D = t(r);
1425
+ Object.keys(D).forEach((a) => {
1426
+ const l = D[a];
1427
+ n[r][a] = i(l), n[r][a].raw = u(l);
1428
+ });
1429
+ }), Ee = n, Ee;
1430
+ }
1431
+ ue.exports;
1432
+ var Xe;
1433
+ function Mu() {
1434
+ return Xe || (Xe = 1, (function(e) {
1435
+ const t = (l, c) => (...h) => `\x1B[${l(...h) + c}m`, n = (l, c) => (...h) => {
1436
+ const f = l(...h);
1437
+ return `\x1B[${38 + c};5;${f}m`;
1438
+ }, s = (l, c) => (...h) => {
1439
+ const f = l(...h);
1440
+ return `\x1B[${38 + c};2;${f[0]};${f[1]};${f[2]}m`;
1441
+ }, u = (l) => l, i = (l, c, h) => [l, c, h], r = (l, c, h) => {
1442
+ Object.defineProperty(l, c, {
1443
+ get: () => {
1444
+ const f = h();
1445
+ return Object.defineProperty(l, c, {
1446
+ value: f,
1447
+ enumerable: !0,
1448
+ configurable: !0
1449
+ }), f;
1450
+ },
1451
+ enumerable: !0,
1452
+ configurable: !0
1453
+ });
1454
+ };
1455
+ let D;
1456
+ const o = (l, c, h, f) => {
1457
+ D === void 0 && (D = Ou());
1458
+ const g = f ? 10 : 0, d = {};
1459
+ for (const [C, p] of Object.entries(D)) {
1460
+ const F = C === "ansi16" ? "ansi" : C;
1461
+ C === c ? d[F] = l(h, g) : typeof p == "object" && (d[F] = l(p[c], g));
1462
+ }
1463
+ return d;
1464
+ };
1465
+ function a() {
1466
+ const l = /* @__PURE__ */ new Map(), c = {
1467
+ modifier: {
1468
+ reset: [0, 0],
1469
+ // 21 isn't widely supported and 22 does the same thing
1470
+ bold: [1, 22],
1471
+ dim: [2, 22],
1472
+ italic: [3, 23],
1473
+ underline: [4, 24],
1474
+ inverse: [7, 27],
1475
+ hidden: [8, 28],
1476
+ strikethrough: [9, 29]
1477
+ },
1478
+ color: {
1479
+ black: [30, 39],
1480
+ red: [31, 39],
1481
+ green: [32, 39],
1482
+ yellow: [33, 39],
1483
+ blue: [34, 39],
1484
+ magenta: [35, 39],
1485
+ cyan: [36, 39],
1486
+ white: [37, 39],
1487
+ // Bright color
1488
+ blackBright: [90, 39],
1489
+ redBright: [91, 39],
1490
+ greenBright: [92, 39],
1491
+ yellowBright: [93, 39],
1492
+ blueBright: [94, 39],
1493
+ magentaBright: [95, 39],
1494
+ cyanBright: [96, 39],
1495
+ whiteBright: [97, 39]
1496
+ },
1497
+ bgColor: {
1498
+ bgBlack: [40, 49],
1499
+ bgRed: [41, 49],
1500
+ bgGreen: [42, 49],
1501
+ bgYellow: [43, 49],
1502
+ bgBlue: [44, 49],
1503
+ bgMagenta: [45, 49],
1504
+ bgCyan: [46, 49],
1505
+ bgWhite: [47, 49],
1506
+ // Bright color
1507
+ bgBlackBright: [100, 49],
1508
+ bgRedBright: [101, 49],
1509
+ bgGreenBright: [102, 49],
1510
+ bgYellowBright: [103, 49],
1511
+ bgBlueBright: [104, 49],
1512
+ bgMagentaBright: [105, 49],
1513
+ bgCyanBright: [106, 49],
1514
+ bgWhiteBright: [107, 49]
1515
+ }
1516
+ };
1517
+ c.color.gray = c.color.blackBright, c.bgColor.bgGray = c.bgColor.bgBlackBright, c.color.grey = c.color.blackBright, c.bgColor.bgGrey = c.bgColor.bgBlackBright;
1518
+ for (const [h, f] of Object.entries(c)) {
1519
+ for (const [g, d] of Object.entries(f))
1520
+ c[g] = {
1521
+ open: `\x1B[${d[0]}m`,
1522
+ close: `\x1B[${d[1]}m`
1523
+ }, f[g] = c[g], l.set(d[0], d[1]);
1524
+ Object.defineProperty(c, h, {
1525
+ value: f,
1526
+ enumerable: !1
1527
+ });
1528
+ }
1529
+ return Object.defineProperty(c, "codes", {
1530
+ value: l,
1531
+ enumerable: !1
1532
+ }), c.color.close = "\x1B[39m", c.bgColor.close = "\x1B[49m", r(c.color, "ansi", () => o(t, "ansi16", u, !1)), r(c.color, "ansi256", () => o(n, "ansi256", u, !1)), r(c.color, "ansi16m", () => o(s, "rgb", i, !1)), r(c.bgColor, "ansi", () => o(t, "ansi16", u, !0)), r(c.bgColor, "ansi256", () => o(n, "ansi256", u, !0)), r(c.bgColor, "ansi16m", () => o(s, "rgb", i, !0)), c;
1533
+ }
1534
+ Object.defineProperty(e, "exports", {
1535
+ enumerable: !0,
1536
+ get: a
1537
+ });
1538
+ })(ue)), ue.exports;
1539
+ }
1540
+ var be, et;
1541
+ function Iu() {
1542
+ if (et) return be;
1543
+ et = 1;
1544
+ const e = Uu(), t = xt(), n = Mu(), s = /* @__PURE__ */ new Set([
1545
+ "\x1B",
1546
+ "›"
1547
+ ]), u = 39, i = (l) => `${s.values().next().value}[${l}m`, r = (l) => l.split(" ").map((c) => e(c)), D = (l, c, h) => {
1548
+ const f = [...c];
1549
+ let g = !1, d = e(t(l[l.length - 1]));
1550
+ for (const [C, p] of f.entries()) {
1551
+ const F = e(p);
1552
+ if (d + F <= h ? l[l.length - 1] += p : (l.push(p), d = 0), s.has(p))
1553
+ g = !0;
1554
+ else if (g && p === "m") {
1555
+ g = !1;
1556
+ continue;
1557
+ }
1558
+ g || (d += F, d === h && C < f.length - 1 && (l.push(""), d = 0));
1559
+ }
1560
+ !d && l[l.length - 1].length > 0 && l.length > 1 && (l[l.length - 2] += l.pop());
1561
+ }, o = (l) => {
1562
+ const c = l.split(" ");
1563
+ let h = c.length;
1564
+ for (; h > 0 && !(e(c[h - 1]) > 0); )
1565
+ h--;
1566
+ return h === c.length ? l : c.slice(0, h).join(" ") + c.slice(h).join("");
1567
+ }, a = (l, c, h = {}) => {
1568
+ if (h.trim !== !1 && l.trim() === "")
1569
+ return "";
1570
+ let f = "", g = "", d;
1571
+ const C = r(l);
1572
+ let p = [""];
1573
+ for (const [F, m] of l.split(" ").entries()) {
1574
+ h.trim !== !1 && (p[p.length - 1] = p[p.length - 1].trimLeft());
1575
+ let E = e(p[p.length - 1]);
1576
+ if (F !== 0 && (E >= c && (h.wordWrap === !1 || h.trim === !1) && (p.push(""), E = 0), (E > 0 || h.trim === !1) && (p[p.length - 1] += " ", E++)), h.hard && C[F] > c) {
1577
+ const B = c - E, N = 1 + Math.floor((C[F] - B - 1) / c);
1578
+ Math.floor((C[F] - 1) / c) < N && p.push(""), D(p, m, c);
1579
+ continue;
1580
+ }
1581
+ if (E + C[F] > c && E > 0 && C[F] > 0) {
1582
+ if (h.wordWrap === !1 && E < c) {
1583
+ D(p, m, c);
1584
+ continue;
1585
+ }
1586
+ p.push("");
1587
+ }
1588
+ if (E + C[F] > c && h.wordWrap === !1) {
1589
+ D(p, m, c);
1590
+ continue;
1591
+ }
1592
+ p[p.length - 1] += m;
1593
+ }
1594
+ h.trim !== !1 && (p = p.map(o)), f = p.join(`
1595
+ `);
1596
+ for (const [F, m] of [...f].entries()) {
1597
+ if (g += m, s.has(m)) {
1598
+ const B = parseFloat(/\d[^m]*/.exec(f.slice(F, F + 4)));
1599
+ d = B === u ? null : B;
1600
+ }
1601
+ const E = n.codes.get(Number(d));
1602
+ d && E && (f[F + 1] === `
1603
+ ` ? g += i(E) : m === `
1604
+ ` && (g += i(d)));
1605
+ }
1606
+ return g;
1607
+ };
1608
+ return be = (l, c, h) => String(l).normalize().replace(/\r\n/g, `
1609
+ `).split(`
1610
+ `).map((f) => a(f, c, h)).join(`
1611
+ `), be;
1612
+ }
1613
+ var _u = Iu();
1614
+ const Pu = /* @__PURE__ */ ie(_u);
1615
+ function xe(e, t) {
1616
+ return e.split(`
1617
+ `).flatMap((n) => Pu(n, t, { trim: !1, hard: !0 }).split(`
1618
+ `).map((s) => s.trimEnd())).join(`
1619
+ `);
1620
+ }
1621
+ function At() {
1622
+ return Su({ defaultWidth: 80, output: bt().output });
1623
+ }
1624
+ function ju({ active: e, renderedItems: t, pageSize: n, loop: s }) {
1625
+ const u = $e({
1626
+ lastPointer: e,
1627
+ lastActive: void 0
1628
+ }), { lastPointer: i, lastActive: r } = u.current, D = Math.floor(n / 2), o = t.reduce((c, h) => c + h.length, 0), a = t.slice(0, e).reduce((c, h) => c + h.length, 0);
1629
+ let l = a;
1630
+ if (o > n)
1631
+ if (s)
1632
+ l = i, // First render, skip this logic.
1633
+ r != null && // Only move the pointer down when the user moves down.
1634
+ r < e && // Check user didn't move up across page boundary.
1635
+ e - r < n && (l = Math.min(
1636
+ // Furthest allowed position for the pointer is the middle of the list
1637
+ D,
1638
+ Math.abs(e - r) === 1 ? Math.min(
1639
+ // Move the pointer at most the height of the last active item.
1640
+ i + (t[r]?.length ?? 0),
1641
+ // If the user moved by one item, move the pointer to the natural position of the active item as
1642
+ // long as it doesn't move the cursor up.
1643
+ Math.max(a, i)
1644
+ ) : (
1645
+ // Otherwise, move the pointer down by the difference between the active and last active item.
1646
+ i + e - r
1647
+ )
1648
+ ));
1649
+ else {
1650
+ const c = t.slice(e).reduce((h, f) => h + f.length, 0);
1651
+ l = c < n - D ? (
1652
+ // If the active item is near the end of the list, progressively move the cursor towards the end.
1653
+ n - c
1654
+ ) : (
1655
+ // Otherwise, progressively move the pointer to the middle of the list.
1656
+ Math.min(a, D)
1657
+ );
1658
+ }
1659
+ return u.current.lastPointer = l, u.current.lastActive = e, l;
1660
+ }
1661
+ function qu({ items: e, active: t, renderItem: n, pageSize: s, loop: u = !0 }) {
1662
+ const i = At(), r = (p) => (p % e.length + e.length) % e.length, D = e.map((p, F) => p == null ? [] : xe(n({ item: p, index: F, isActive: F === t }), i).split(`
1663
+ `)), o = D.reduce((p, F) => p + F.length, 0), a = (p) => D[p] ?? [], l = ju({ active: t, renderedItems: D, pageSize: s, loop: u }), c = a(t).slice(0, s), h = l + c.length <= s ? l : s - c.length, f = Array.from({ length: s });
1664
+ f.splice(h, c.length, ...c);
1665
+ const g = /* @__PURE__ */ new Set([t]);
1666
+ let d = h + c.length, C = r(t + 1);
1667
+ for (; d < s && !g.has(C) && (u && o > s ? C !== t : C > t); ) {
1668
+ const F = a(C).slice(0, s - d);
1669
+ f.splice(d, F.length, ...F), g.add(C), d += F.length, C = r(C + 1);
1670
+ }
1671
+ for (d = h - 1, C = r(t - 1); d >= 0 && !g.has(C) && (u && o > s ? C !== t : C < t); ) {
1672
+ const p = a(C), F = p.slice(Math.max(0, p.length - d - 1));
1673
+ f.splice(d - F.length + 1, F.length, ...F), g.add(C), d -= F.length, C = r(C - 1);
1674
+ }
1675
+ return f.filter((p) => typeof p == "string").join(`
1676
+ `);
1677
+ }
1678
+ var Be, tt;
1679
+ function Nu() {
1680
+ if (tt) return Be;
1681
+ tt = 1;
1682
+ const e = _t;
1683
+ class t extends e {
1684
+ #u = null;
1685
+ constructor(s = {}) {
1686
+ super(s), this.writable = this.readable = !0, this.muted = !1, this.on("pipe", this._onpipe), this.replace = s.replace, this._prompt = s.prompt || null, this._hadControl = !1;
1687
+ }
1688
+ #t(s, u) {
1689
+ return this._dest ? this._dest[s] : this._src ? this._src[s] : u;
1690
+ }
1691
+ #e(s, ...u) {
1692
+ typeof this._dest?.[s] == "function" && this._dest[s](...u), typeof this._src?.[s] == "function" && this._src[s](...u);
1693
+ }
1694
+ get isTTY() {
1695
+ return this.#u !== null ? this.#u : this.#t("isTTY", !1);
1696
+ }
1697
+ // basically just get replace the getter/setter with a regular value
1698
+ set isTTY(s) {
1699
+ this.#u = s;
1700
+ }
1701
+ get rows() {
1702
+ return this.#t("rows");
1703
+ }
1704
+ get columns() {
1705
+ return this.#t("columns");
1706
+ }
1707
+ mute() {
1708
+ this.muted = !0;
1709
+ }
1710
+ unmute() {
1711
+ this.muted = !1;
1712
+ }
1713
+ _onpipe(s) {
1714
+ this._src = s;
1715
+ }
1716
+ pipe(s, u) {
1717
+ return this._dest = s, super.pipe(s, u);
1718
+ }
1719
+ pause() {
1720
+ if (this._src)
1721
+ return this._src.pause();
1722
+ }
1723
+ resume() {
1724
+ if (this._src)
1725
+ return this._src.resume();
1726
+ }
1727
+ write(s) {
1728
+ if (this.muted) {
1729
+ if (!this.replace)
1730
+ return !0;
1731
+ if (s.match(/^\u001b/))
1732
+ return s.indexOf(this._prompt) === 0 && (s = s.slice(this._prompt.length), s = s.replace(/./g, this.replace), s = this._prompt + s), this._hadControl = !0, this.emit("data", s);
1733
+ this._prompt && this._hadControl && s.indexOf(this._prompt) === 0 && (this._hadControl = !1, this.emit("data", this._prompt), s = s.slice(this._prompt.length)), s = s.toString().replace(/./g, this.replace);
1734
+ }
1735
+ this.emit("data", s);
1736
+ }
1737
+ end(s) {
1738
+ this.muted && (s && this.replace ? s = s.toString().replace(/./g, this.replace) : s = null), s && this.emit("data", s), this.emit("end");
1739
+ }
1740
+ destroy(...s) {
1741
+ return this.#e("destroy", ...s);
1742
+ }
1743
+ destroySoon(...s) {
1744
+ return this.#e("destroySoon", ...s);
1745
+ }
1746
+ close(...s) {
1747
+ return this.#e("close", ...s);
1748
+ }
1749
+ }
1750
+ return Be = t, Be;
1751
+ }
1752
+ var Hu = Nu();
1753
+ const Wu = /* @__PURE__ */ ie(Hu), K = [];
1754
+ K.push("SIGHUP", "SIGINT", "SIGTERM");
1755
+ process.platform !== "win32" && K.push(
1756
+ "SIGALRM",
1757
+ "SIGABRT",
1758
+ "SIGVTALRM",
1759
+ "SIGXCPU",
1760
+ "SIGXFSZ",
1761
+ "SIGUSR2",
1762
+ "SIGTRAP",
1763
+ "SIGSYS",
1764
+ "SIGQUIT",
1765
+ "SIGIOT"
1766
+ // should detect profiler and enable/disable accordingly.
1767
+ // see #21
1768
+ // 'SIGPROF'
1769
+ );
1770
+ process.platform === "linux" && K.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
1771
+ const ne = (e) => !!e && typeof e == "object" && typeof e.removeListener == "function" && typeof e.emit == "function" && typeof e.reallyExit == "function" && typeof e.listeners == "function" && typeof e.kill == "function" && typeof e.pid == "number" && typeof e.on == "function", ye = /* @__PURE__ */ Symbol.for("signal-exit emitter"), we = globalThis, Gu = Object.defineProperty.bind(Object);
1772
+ class Ku {
1773
+ emitted = {
1774
+ afterExit: !1,
1775
+ exit: !1
1776
+ };
1777
+ listeners = {
1778
+ afterExit: [],
1779
+ exit: []
1780
+ };
1781
+ count = 0;
1782
+ id = Math.random();
1783
+ constructor() {
1784
+ if (we[ye])
1785
+ return we[ye];
1786
+ Gu(we, ye, {
1787
+ value: this,
1788
+ writable: !1,
1789
+ enumerable: !1,
1790
+ configurable: !1
1791
+ });
1792
+ }
1793
+ on(t, n) {
1794
+ this.listeners[t].push(n);
1795
+ }
1796
+ removeListener(t, n) {
1797
+ const s = this.listeners[t], u = s.indexOf(n);
1798
+ u !== -1 && (u === 0 && s.length === 1 ? s.length = 0 : s.splice(u, 1));
1799
+ }
1800
+ emit(t, n, s) {
1801
+ if (this.emitted[t])
1802
+ return !1;
1803
+ this.emitted[t] = !0;
1804
+ let u = !1;
1805
+ for (const i of this.listeners[t])
1806
+ u = i(n, s) === !0 || u;
1807
+ return t === "exit" && (u = this.emit("afterExit", n, s) || u), u;
1808
+ }
1809
+ }
1810
+ class St {
1811
+ }
1812
+ const Vu = (e) => ({
1813
+ onExit(t, n) {
1814
+ return e.onExit(t, n);
1815
+ },
1816
+ load() {
1817
+ return e.load();
1818
+ },
1819
+ unload() {
1820
+ return e.unload();
1821
+ }
1822
+ });
1823
+ class zu extends St {
1824
+ onExit() {
1825
+ return () => {
1826
+ };
1827
+ }
1828
+ load() {
1829
+ }
1830
+ unload() {
1831
+ }
1832
+ }
1833
+ class Yu extends St {
1834
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
1835
+ // so use a supported signal instead
1836
+ /* c8 ignore start */
1837
+ #u = ke.platform === "win32" ? "SIGINT" : "SIGHUP";
1838
+ /* c8 ignore stop */
1839
+ #t = new Ku();
1840
+ #e;
1841
+ #s;
1842
+ #i;
1843
+ #r = {};
1844
+ #n = !1;
1845
+ constructor(t) {
1846
+ super(), this.#e = t, this.#r = {};
1847
+ for (const n of K)
1848
+ this.#r[n] = () => {
1849
+ const s = this.#e.listeners(n);
1850
+ let { count: u } = this.#t;
1851
+ const i = t;
1852
+ if (typeof i.__signal_exit_emitter__ == "object" && typeof i.__signal_exit_emitter__.count == "number" && (u += i.__signal_exit_emitter__.count), s.length === u) {
1853
+ this.unload();
1854
+ const r = this.#t.emit("exit", null, n), D = n === "SIGHUP" ? this.#u : n;
1855
+ r || t.kill(t.pid, D);
1856
+ }
1857
+ };
1858
+ this.#i = t.reallyExit, this.#s = t.emit;
1859
+ }
1860
+ onExit(t, n) {
1861
+ if (!ne(this.#e))
1862
+ return () => {
1863
+ };
1864
+ this.#n === !1 && this.load();
1865
+ const s = n?.alwaysLast ? "afterExit" : "exit";
1866
+ return this.#t.on(s, t), () => {
1867
+ this.#t.removeListener(s, t), this.#t.listeners.exit.length === 0 && this.#t.listeners.afterExit.length === 0 && this.unload();
1868
+ };
1869
+ }
1870
+ load() {
1871
+ if (!this.#n) {
1872
+ this.#n = !0, this.#t.count += 1;
1873
+ for (const t of K)
1874
+ try {
1875
+ const n = this.#r[t];
1876
+ n && this.#e.on(t, n);
1877
+ } catch {
1878
+ }
1879
+ this.#e.emit = (t, ...n) => this.#o(t, ...n), this.#e.reallyExit = (t) => this.#D(t);
1880
+ }
1881
+ }
1882
+ unload() {
1883
+ this.#n && (this.#n = !1, K.forEach((t) => {
1884
+ const n = this.#r[t];
1885
+ if (!n)
1886
+ throw new Error("Listener not defined for signal: " + t);
1887
+ try {
1888
+ this.#e.removeListener(t, n);
1889
+ } catch {
1890
+ }
1891
+ }), this.#e.emit = this.#s, this.#e.reallyExit = this.#i, this.#t.count -= 1);
1892
+ }
1893
+ #D(t) {
1894
+ return ne(this.#e) ? (this.#e.exitCode = t || 0, this.#t.emit("exit", this.#e.exitCode, null), this.#i.call(this.#e, this.#e.exitCode)) : 0;
1895
+ }
1896
+ #o(t, ...n) {
1897
+ const s = this.#s;
1898
+ if (t === "exit" && ne(this.#e)) {
1899
+ typeof n[0] == "number" && (this.#e.exitCode = n[0]);
1900
+ const u = s.call(this.#e, t, ...n);
1901
+ return this.#t.emit("exit", this.#e.exitCode, null), u;
1902
+ } else
1903
+ return s.call(this.#e, t, ...n);
1904
+ }
1905
+ }
1906
+ const ke = globalThis.process, {
1907
+ /**
1908
+ * Called when the process is exiting, whether via signal, explicit
1909
+ * exit, or running out of stuff to do.
1910
+ *
1911
+ * If the global process object is not suitable for instrumentation,
1912
+ * then this will be a no-op.
1913
+ *
1914
+ * Returns a function that may be used to unload signal-exit.
1915
+ */
1916
+ onExit: Zu
1917
+ } = Vu(ne(ke) ? new Yu(ke) : new zu()), q = "\x1B[", Ju = q + "G", Qu = q + "?25l", Xu = q + "?25h", vt = (e = 1) => e > 0 ? `${q}${e}A` : "", ut = (e = 1) => e > 0 ? `${q}${e}B` : "", nt = (e, t) => `${q}${e + 1}G`, rt = q + "2K", st = (e) => e > 0 ? (rt + vt(1)).repeat(e - 1) + rt + Ju : "", it = (e) => e.split(`
1918
+ `).length, en = (e) => e.split(`
1919
+ `).pop() ?? "";
1920
+ class tn {
1921
+ // These variables are keeping information to allow correct prompt re-rendering
1922
+ height = 0;
1923
+ extraLinesUnderPrompt = 0;
1924
+ cursorPos;
1925
+ rl;
1926
+ constructor(t) {
1927
+ this.rl = t, this.cursorPos = t.getCursorPos();
1928
+ }
1929
+ write(t) {
1930
+ this.rl.output.unmute(), this.rl.output.write(t), this.rl.output.mute();
1931
+ }
1932
+ render(t, n = "") {
1933
+ const s = en(t), u = Pt(s);
1934
+ let i = u;
1935
+ this.rl.line.length > 0 && (i = i.slice(0, -this.rl.line.length)), this.rl.setPrompt(i), this.cursorPos = this.rl.getCursorPos();
1936
+ const r = At();
1937
+ t = xe(t, r), n = xe(n, r), u.length % r === 0 && (t += `
1938
+ `);
1939
+ let D = t + (n ? `
1940
+ ` + n : "");
1941
+ const a = Math.floor(u.length / r) - this.cursorPos.rows + (n ? it(n) : 0);
1942
+ a > 0 && (D += vt(a)), D += nt(this.cursorPos.cols), this.write(ut(this.extraLinesUnderPrompt) + st(this.height) + D), this.extraLinesUnderPrompt = a, this.height = it(D);
1943
+ }
1944
+ checkCursorPos() {
1945
+ const t = this.rl.getCursorPos();
1946
+ t.cols !== this.cursorPos.cols && (this.write(nt(t.cols)), this.cursorPos = t);
1947
+ }
1948
+ done({ clearContent: t }) {
1949
+ this.rl.setPrompt("");
1950
+ let n = ut(this.extraLinesUnderPrompt);
1951
+ n += t ? st(this.height) : `
1952
+ `, n += Xu, this.write(n), this.rl.close();
1953
+ }
1954
+ }
1955
+ class un extends Promise {
1956
+ // Available starting from Node 22
1957
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
1958
+ static withResolver() {
1959
+ let t, n;
1960
+ return { promise: new Promise((u, i) => {
1961
+ t = u, n = i;
1962
+ }), resolve: t, reject: n };
1963
+ }
1964
+ }
1965
+ function nn() {
1966
+ const e = Error.prepareStackTrace;
1967
+ let t = [];
1968
+ try {
1969
+ Error.prepareStackTrace = (n, s) => {
1970
+ const u = s.slice(1);
1971
+ return t = u, u;
1972
+ }, new Error().stack;
1973
+ } catch {
1974
+ return t;
1975
+ }
1976
+ return Error.prepareStackTrace = e, t;
1977
+ }
1978
+ function Oe(e) {
1979
+ const t = nn();
1980
+ return (s, u = {}) => {
1981
+ const { input: i = process.stdin, signal: r } = u, D = /* @__PURE__ */ new Set(), o = new Wu();
1982
+ o.pipe(u.output ?? process.stdout);
1983
+ const a = Mt.createInterface({
1984
+ terminal: !0,
1985
+ input: i,
1986
+ output: o
1987
+ }), l = new tn(a), { promise: c, resolve: h, reject: f } = un.withResolver(), g = () => f(new hu());
1988
+ if (r) {
1989
+ const p = () => f(new cu({ cause: r.reason }));
1990
+ if (r.aborted)
1991
+ return p(), Object.assign(c, { cancel: g });
1992
+ r.addEventListener("abort", p), D.add(() => r.removeEventListener("abort", p));
1993
+ }
1994
+ D.add(Zu((p, F) => {
1995
+ f(new je(`User force closed the prompt with ${p} ${F}`));
1996
+ }));
1997
+ const d = () => f(new je("User force closed the prompt with SIGINT"));
1998
+ a.on("SIGINT", d), D.add(() => a.removeListener("SIGINT", d));
1999
+ const C = () => l.checkCursorPos();
2000
+ return a.input.on("keypress", C), D.add(() => a.input.removeListener("keypress", C)), pu(a, (p) => {
2001
+ const F = Se.bind(() => Y.clearAll());
2002
+ return a.on("close", F), D.add(() => a.removeListener("close", F)), p(() => {
2003
+ try {
2004
+ const m = e(s, (N) => {
2005
+ setImmediate(() => h(N));
2006
+ });
2007
+ if (m === void 0) {
2008
+ const N = t[1]?.getFileName();
2009
+ throw new Error(`Prompt functions must return a string.
2010
+ at ${N}`);
2011
+ }
2012
+ const [E, B] = typeof m == "string" ? [m] : m;
2013
+ l.render(E, B), Y.run();
2014
+ } catch (m) {
2015
+ f(m);
2016
+ }
2017
+ }), Object.assign(c.then((m) => (Y.clearAll(), m), (m) => {
2018
+ throw Y.clearAll(), m;
2019
+ }).finally(() => {
2020
+ D.forEach((m) => m()), l.done({ clearContent: !!u.clearPromptOnDone }), o.end();
2021
+ }).then(() => c), { cancel: g });
2022
+ });
2023
+ };
2024
+ }
2025
+ class Z {
2026
+ separator = y.dim(Array.from({ length: 15 }).join(Re.line));
2027
+ type = "separator";
2028
+ constructor(t) {
2029
+ t && (this.separator = t);
2030
+ }
2031
+ static isSeparator(t) {
2032
+ return !!(t && typeof t == "object" && "type" in t && t.type === "separator");
2033
+ }
2034
+ }
2035
+ function Dt(e, t) {
2036
+ let n = t !== !1;
2037
+ return /^(y|yes)/i.test(e) ? n = !0 : /^(n|no)/i.test(e) && (n = !1), n;
2038
+ }
2039
+ function ot(e) {
2040
+ return e ? "Yes" : "No";
2041
+ }
2042
+ const rn = Oe((e, t) => {
2043
+ const { transformer: n = ot } = e, [s, u] = A("idle"), [i, r] = A(""), D = De(e.theme), o = Ue({ status: s, theme: D });
2044
+ Te((h, f) => {
2045
+ if (s === "idle")
2046
+ if (ve(h)) {
2047
+ const g = Dt(i, e.default);
2048
+ r(n(g)), u("done"), t(g);
2049
+ } else if (Ct(h)) {
2050
+ const g = ot(!Dt(i, e.default));
2051
+ f.clearLine(0), f.write(g), r(g);
2052
+ } else
2053
+ r(f.line);
2054
+ });
2055
+ let a = i, l = "";
2056
+ s === "done" ? a = D.style.answer(i) : l = ` ${D.style.defaultAnswer(e.default === !1 ? "y/N" : "Y/n")}`;
2057
+ const c = D.style.message(e.message, s);
2058
+ return `${o} ${c}${l} ${a}`;
2059
+ }), sn = {
2060
+ validationFailureMode: "keep"
2061
+ }, Dn = Oe((e, t) => {
2062
+ const { prefill: n = "tab" } = e, s = De(sn, e.theme), [u, i] = A("idle"), [r = "", D] = A(e.default), [o, a] = A(), [l, c] = A(""), h = Ue({ status: u, theme: s });
2063
+ async function f(F) {
2064
+ const { required: m, pattern: E, patternError: B = "Invalid input" } = e;
2065
+ return m && !F ? "You must provide a value" : E && !E.test(F) ? B : typeof e.validate == "function" ? await e.validate(F) || "You must provide a valid value" : !0;
2066
+ }
2067
+ Te(async (F, m) => {
2068
+ if (u === "idle")
2069
+ if (ve(F)) {
2070
+ const E = l || r;
2071
+ i("loading");
2072
+ const B = await f(E);
2073
+ B === !0 ? (c(E), i("done"), t(E)) : (s.validationFailureMode === "clear" ? c("") : m.write(l), a(B), i("idle"));
2074
+ } else gt(F) && !l ? D(void 0) : Ct(F) && !l ? (D(void 0), m.clearLine(0), m.write(r), c(r)) : (c(m.line), a(void 0));
2075
+ }), se((F) => {
2076
+ n === "editable" && r && (F.write(r), c(r));
2077
+ }, []);
2078
+ const g = s.style.message(e.message, u);
2079
+ let d = l;
2080
+ typeof e.transformer == "function" ? d = e.transformer(l, { isFinal: u === "done" }) : u === "done" && (d = s.style.answer(l));
2081
+ let C;
2082
+ r && u !== "done" && !l && (C = s.style.defaultAnswer(r));
2083
+ let p = "";
2084
+ return o && (p = s.style.error(o)), [
2085
+ [h, g, C, d].filter((F) => F !== void 0).join(" "),
2086
+ p
2087
+ ];
2088
+ }), on = {
2089
+ icon: { cursor: Re.pointer },
2090
+ style: {
2091
+ disabled: (e) => y.dim(`- ${e}`),
2092
+ description: (e) => y.cyan(e),
2093
+ keysHelpTip: (e) => e.map(([t, n]) => `${y.bold(t)} ${y.dim(n)}`).join(y.dim(" • "))
2094
+ },
2095
+ helpMode: "always",
2096
+ indexMode: "hidden",
2097
+ keybindings: []
2098
+ };
2099
+ function G(e) {
2100
+ return !Z.isSeparator(e) && !e.disabled;
2101
+ }
2102
+ function ln(e) {
2103
+ return e.map((t) => {
2104
+ if (Z.isSeparator(t))
2105
+ return t;
2106
+ if (typeof t == "string")
2107
+ return {
2108
+ value: t,
2109
+ name: t,
2110
+ short: t,
2111
+ disabled: !1
2112
+ };
2113
+ const n = t.name ?? String(t.value), s = {
2114
+ value: t.value,
2115
+ name: n,
2116
+ short: t.short ?? n,
2117
+ disabled: t.disabled ?? !1
2118
+ };
2119
+ return t.description && (s.description = t.description), s;
2120
+ });
2121
+ }
2122
+ const an = Oe((e, t) => {
2123
+ const { loop: n = !0, pageSize: s = 7 } = e, u = De(on, e.theme), { keybindings: i } = u, [r, D] = A("idle"), o = Ue({ status: r, theme: u }), a = $e(), l = !i.includes("vim"), c = he(() => ln(e.choices), [e.choices]), h = he(() => {
2124
+ const b = c.findIndex(G), x = c.findLastIndex(G);
2125
+ if (b === -1)
2126
+ throw new mt("[select prompt] No selectable choices. All choices are disabled.");
2127
+ return { first: b, last: x };
2128
+ }, [c]), f = he(() => "default" in e ? c.findIndex((b) => G(b) && b.value === e.default) : -1, [e.default, c]), [g, d] = A(f === -1 ? h.first : f), C = c[g];
2129
+ Te((b, x) => {
2130
+ if (clearTimeout(a.current), ve(b))
2131
+ D("done"), t(C.value);
2132
+ else if (ae(b, i) || Pe(b, i)) {
2133
+ if (x.clearLine(0), n || ae(b, i) && g !== h.first || Pe(b, i) && g !== h.last) {
2134
+ const _ = ae(b, i) ? -1 : 1;
2135
+ let k = g;
2136
+ do
2137
+ k = (k + _ + c.length) % c.length;
2138
+ while (!G(c[k]));
2139
+ d(k);
2140
+ }
2141
+ } else if (au(b) && !Number.isNaN(Number(x.line))) {
2142
+ const _ = Number(x.line) - 1;
2143
+ let k = -1;
2144
+ const U = c.findIndex((z) => Z.isSeparator(z) ? !1 : (k++, k === _)), X = c[U];
2145
+ X != null && G(X) && d(U), a.current = setTimeout(() => {
2146
+ x.clearLine(0);
2147
+ }, 700);
2148
+ } else if (gt(b))
2149
+ x.clearLine(0);
2150
+ else if (l) {
2151
+ const _ = x.line.toLowerCase(), k = c.findIndex((U) => Z.isSeparator(U) || !G(U) ? !1 : U.name.toLowerCase().startsWith(_));
2152
+ k !== -1 && d(k), a.current = setTimeout(() => {
2153
+ x.clearLine(0);
2154
+ }, 700);
2155
+ }
2156
+ }), se(() => () => {
2157
+ clearTimeout(a.current);
2158
+ }, []);
2159
+ const p = u.style.message(e.message, r);
2160
+ let F;
2161
+ if (u.helpMode !== "never")
2162
+ if (e.instructions) {
2163
+ const { pager: b, navigation: x } = e.instructions;
2164
+ F = u.style.help(c.length > s ? b : x);
2165
+ } else
2166
+ F = u.style.keysHelpTip([
2167
+ ["↑↓", "navigate"],
2168
+ ["⏎", "select"]
2169
+ ]);
2170
+ let m = 0;
2171
+ const E = qu({
2172
+ items: c,
2173
+ active: g,
2174
+ renderItem({ item: b, isActive: x, index: _ }) {
2175
+ if (Z.isSeparator(b))
2176
+ return m++, ` ${b.separator}`;
2177
+ const k = u.indexMode === "number" ? `${_ + 1 - m}. ` : "";
2178
+ if (b.disabled) {
2179
+ const z = typeof b.disabled == "string" ? b.disabled : "(disabled)";
2180
+ return u.style.disabled(`${k}${b.name} ${z}`);
2181
+ }
2182
+ const U = x ? u.style.highlight : (z) => z, X = x ? u.icon.cursor : " ";
2183
+ return U(`${X} ${k}${b.name}`);
2184
+ },
2185
+ pageSize: s,
2186
+ loop: n
2187
+ });
2188
+ if (r === "done")
2189
+ return [o, p, u.style.answer(C.short)].filter(Boolean).join(" ");
2190
+ const { description: B } = C;
2191
+ return `${[
2192
+ [o, p].filter(Boolean).join(" "),
2193
+ E,
2194
+ " ",
2195
+ B ? u.style.description(B) : "",
2196
+ F
2197
+ ].filter(Boolean).join(`
2198
+ `).trimEnd()}${Qu}`;
2199
+ }), R = async (e, t) => rn({ message: e, default: t }), J = async (e, t) => Dn({ message: e, default: t }), cn = async (e, t) => an({
2200
+ message: e,
2201
+ choices: t.map((n) => ({ name: n, value: n }))
2202
+ }), hn = async (e, t) => {
2203
+ let n = t;
2204
+ for (; M(n) || M(`${n}.pub`); ) {
2205
+ if (await R(
2206
+ `Key already exists at ${n}. Overwrite?`,
2207
+ !1
2208
+ ))
2209
+ return n;
2210
+ const u = (await J("Enter a different key name")).trim();
2211
+ u && (n = ft(e, u));
2212
+ }
2213
+ return n;
2214
+ }, fn = async () => {
2215
+ for (; ; ) {
2216
+ const e = (await J(
2217
+ "Alias name (creates Host github.com-<alias>)",
2218
+ "github-work"
2219
+ )).trim();
2220
+ if (!e) {
2221
+ v("Alias cannot be empty.");
2222
+ continue;
2223
+ }
2224
+ if (/\s/.test(e)) {
2225
+ v("Alias cannot contain spaces.");
2226
+ continue;
2227
+ }
2228
+ return e;
2229
+ }
2230
+ }, dn = async (e) => {
2231
+ const t = I(V(), ".ssh");
2232
+ let n = null, s = "github.com";
2233
+ $(1, "Check for existing SSH keys", w.step1);
2234
+ const u = Yt(t);
2235
+ if (u.length > 0) {
2236
+ const f = u.map((d) => oe(d));
2237
+ if (O("Found existing public keys:"), lu(f), await R("Reuse an existing key", !1)) {
2238
+ const d = await cn("Select a key", f), p = I(t, d).replace(/\.pub$/, "");
2239
+ M(p) ? (n = p, await T(), $(2, "Use existing SSH key", w.step2), W(`Using ${oe(p)}`)) : v(`Private key not found at ${p}.`);
2240
+ }
2241
+ } else
2242
+ O("No existing public keys found in ~/.ssh.");
2243
+ if (!n) {
2244
+ await T(), $(2, "Generate a new SSH key pair", w.step2), ht(t);
2245
+ const f = Vt(), g = e.email ?? await J("GitHub email", f ?? void 0);
2246
+ g || (P("Email is required to generate the key."), process.exit(1));
2247
+ let d = e.type ?? "ed25519";
2248
+ if (!e.type) {
2249
+ const E = await J(
2250
+ "Key type (ed25519 or rsa)",
2251
+ "ed25519"
2252
+ );
2253
+ (E === "ed25519" || E === "rsa") && (d = E);
2254
+ }
2255
+ const C = e.keyName ?? (d === "ed25519" ? "id_ed25519" : "id_rsa"), p = e.keyName ?? await J("Key name", C);
2256
+ let F = ft(t, p);
2257
+ F = await hn(t, F);
2258
+ const m = Ie(F, g, d);
2259
+ !m && d === "ed25519" ? await R(
2260
+ "ed25519 failed. Try rsa 4096 instead",
2261
+ !0
2262
+ ) ? Ie(F, g, "rsa") || (P("Failed to generate RSA key."), process.exit(1)) : process.exit(1) : m || (P("Failed to generate SSH key."), process.exit(1)), n = F, W(`Key ready: ${oe(F)}`);
2263
+ }
2264
+ n || (P("No SSH key selected. Exiting."), process.exit(1));
2265
+ const i = `${n}.pub`;
2266
+ M(i) || (P(`Public key not found at ${i}.`), process.exit(1)), await T(), $(3, "Start ssh-agent", w.step3);
2267
+ const r = Zt();
2268
+ if (r.ok ? W("ssh-agent is running.") : (r.reason === "start_failed" && v(
2269
+ `Failed to start ssh-agent. Run 'eval "$(ssh-agent -s)"' manually.`
2270
+ ), v("Continuing without ssh-agent.")), await T(), $(4, "Add key to ssh-agent", w.step4), Jt(n) ? W("Key added to ssh-agent.") : v(`ssh-add failed. Try: ssh-add ${n}`), await T(), $(5, "Update SSH config", w.step5), !(e.skipConfig ? !1 : e.updateConfig ? !0 : await R("Update ~/.ssh/config to use this key", !0)))
2271
+ O("Skipping SSH config update.");
2272
+ else {
2273
+ const f = await R(
2274
+ "Set an SSH host alias for this key",
2275
+ !1
2276
+ ), g = f ? await fn() : null, d = g ? `github.com-${g}` : "github.com";
2277
+ g && (s = d);
2278
+ const C = f ? "github.com" : void 0, p = ru(t, d);
2279
+ if (!p.ok)
2280
+ v("Failed to read ~/.ssh/config.");
2281
+ else {
2282
+ const F = p.info.identityFile, m = F ? su(F, n) : !1;
2283
+ let E = !0;
2284
+ if (F && !m && !e.updateConfig && (E = await R(
2285
+ `SSH config already has an IdentityFile for ${d}. Overwrite?`,
2286
+ !1
2287
+ )), !E)
2288
+ O("Skipping SSH config update.");
2289
+ else {
2290
+ const B = iu(t, {
2291
+ host: d,
2292
+ identityFile: n,
2293
+ hostName: C,
2294
+ useKeychain: process.platform === "darwin"
2295
+ });
2296
+ B.ok ? B.changed ? W(`SSH config updated for ${d}.`) : O("SSH config already up to date.") : v("Failed to update ~/.ssh/config.");
2297
+ }
2298
+ }
2299
+ }
2300
+ await T(), $(6, "Add the public key to GitHub", w.step6);
2301
+ const a = Ae(i, "utf8");
2302
+ Kt(a) ? W("Public key copied to clipboard.") : (v("Copy failed. The public key is printed below:"), console.log(a.trim())), O("Open https://github.com/settings/keys to add a new SSH key.");
2303
+ let c = await R(
2304
+ "Did you add the key to your GitHub SSH keys page",
2305
+ !1
2306
+ );
2307
+ for (; !c; )
2308
+ O("Paste the key in GitHub, then return here."), await T(), c = await R(
2309
+ "Have you added the key to your GitHub SSH keys page",
2310
+ !1
2311
+ );
2312
+ await T(), $(7, "Verify your SSH connection", w.step7), await R(`Run 'ssh -T git@${s}' now`, !1) && Q("ssh", ["-T", `git@${s}`], { stdio: "inherit" });
2313
+ }, pn = async () => {
2314
+ const { options: e, unknown: t } = Ht(process.argv.slice(2));
2315
+ if (t.length > 0 && (P(`Unknown arguments: ${t.join(" ")}`), console.log(Me), process.exit(1)), e.help) {
2316
+ console.log(Me);
2317
+ return;
2318
+ }
2319
+ if (e.version) {
2320
+ const n = Gt();
2321
+ console.log(n ?? "unknown");
2322
+ return;
2323
+ }
2324
+ ou(), O(`This tool will guide you through ${at} steps.`), process.platform !== "darwin" && v("This workflow is optimized for macOS."), await dn(e);
2325
+ };
2326
+ pn().catch((e) => {
2327
+ const t = e instanceof Error ? e.message : String(e);
2328
+ P(`Unexpected error: ${t}`), process.exit(1);
2329
+ });