superslate 0.8.0 → 0.8.1

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 (2) hide show
  1. package/dist/cli.js +610 -1037
  2. package/package.json +4 -4
package/dist/cli.js CHANGED
@@ -19,13 +19,15 @@ var __toESM = (mod, isNodeMode, target) => {
19
19
  return cached;
20
20
  }
21
21
  target = mod != null ? __create(__getProtoOf(mod)) : {};
22
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
23
- for (let key of __getOwnPropNames(mod))
24
- if (!__hasOwnProp.call(to, key))
25
- __defProp(to, key, {
26
- get: __accessProp.bind(mod, key),
27
- enumerable: true
28
- });
22
+ const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
23
+ if (mod && typeof mod === "object" || typeof mod === "function") {
24
+ for (let key of __getOwnPropNames(mod))
25
+ if (!__hasOwnProp.call(to, key))
26
+ __defProp(to, key, {
27
+ get: __accessProp.bind(mod, key),
28
+ enumerable: true
29
+ });
30
+ }
29
31
  if (canCache)
30
32
  cache.set(mod, to);
31
33
  return to;
@@ -33,51 +35,51 @@ var __toESM = (mod, isNodeMode, target) => {
33
35
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
34
36
 
35
37
  // node_modules/sisteransi/src/index.js
36
- var require_src = __commonJS((exports, module) => {
37
- var ESC2 = "\x1B";
38
- var CSI2 = `${ESC2}[`;
38
+ var require_src = __commonJS(function(exports, module) {
39
+ var ESC = "\x1B";
40
+ var CSI = `${ESC}[`;
39
41
  var beep = "\x07";
40
42
  var cursor = {
41
43
  to(x, y) {
42
44
  if (!y)
43
- return `${CSI2}${x + 1}G`;
44
- return `${CSI2}${y + 1};${x + 1}H`;
45
+ return `${CSI}${x + 1}G`;
46
+ return `${CSI}${y + 1};${x + 1}H`;
45
47
  },
46
48
  move(x, y) {
47
49
  let ret = "";
48
50
  if (x < 0)
49
- ret += `${CSI2}${-x}D`;
51
+ ret += `${CSI}${-x}D`;
50
52
  else if (x > 0)
51
- ret += `${CSI2}${x}C`;
53
+ ret += `${CSI}${x}C`;
52
54
  if (y < 0)
53
- ret += `${CSI2}${-y}A`;
55
+ ret += `${CSI}${-y}A`;
54
56
  else if (y > 0)
55
- ret += `${CSI2}${y}B`;
57
+ ret += `${CSI}${y}B`;
56
58
  return ret;
57
59
  },
58
- up: (count = 1) => `${CSI2}${count}A`,
59
- down: (count = 1) => `${CSI2}${count}B`,
60
- forward: (count = 1) => `${CSI2}${count}C`,
61
- backward: (count = 1) => `${CSI2}${count}D`,
62
- nextLine: (count = 1) => `${CSI2}E`.repeat(count),
63
- prevLine: (count = 1) => `${CSI2}F`.repeat(count),
64
- left: `${CSI2}G`,
65
- hide: `${CSI2}?25l`,
66
- show: `${CSI2}?25h`,
67
- save: `${ESC2}7`,
68
- restore: `${ESC2}8`
60
+ up: (count = 1) => `${CSI}${count}A`,
61
+ down: (count = 1) => `${CSI}${count}B`,
62
+ forward: (count = 1) => `${CSI}${count}C`,
63
+ backward: (count = 1) => `${CSI}${count}D`,
64
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
65
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
66
+ left: `${CSI}G`,
67
+ hide: `${CSI}?25l`,
68
+ show: `${CSI}?25h`,
69
+ save: `${ESC}7`,
70
+ restore: `${ESC}8`
69
71
  };
70
72
  var scroll = {
71
- up: (count = 1) => `${CSI2}S`.repeat(count),
72
- down: (count = 1) => `${CSI2}T`.repeat(count)
73
+ up: (count = 1) => `${CSI}S`.repeat(count),
74
+ down: (count = 1) => `${CSI}T`.repeat(count)
73
75
  };
74
76
  var erase = {
75
- screen: `${CSI2}2J`,
76
- up: (count = 1) => `${CSI2}1J`.repeat(count),
77
- down: (count = 1) => `${CSI2}J`.repeat(count),
78
- line: `${CSI2}2K`,
79
- lineEnd: `${CSI2}K`,
80
- lineStart: `${CSI2}1K`,
77
+ screen: `${CSI}2J`,
78
+ up: (count = 1) => `${CSI}1J`.repeat(count),
79
+ down: (count = 1) => `${CSI}J`.repeat(count),
80
+ line: `${CSI}2K`,
81
+ lineEnd: `${CSI}K`,
82
+ lineStart: `${CSI}1K`,
81
83
  lines(count) {
82
84
  let clear = "";
83
85
  for (let i = 0;i < count; i++)
@@ -440,30 +442,11 @@ function wrapAnsi(string, columns, options) {
440
442
  // node_modules/@clack/core/dist/index.mjs
441
443
  var import_sisteransi = __toESM(require_src(), 1);
442
444
  import { ReadStream } from "node:tty";
443
- function findCursor(s, o, l2) {
444
- if (!l2.some((r) => !r.disabled))
445
+ function findCursor(s, o, l) {
446
+ if (!l.some((r) => !r.disabled))
445
447
  return s;
446
- const t = s + o, n = Math.max(l2.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
447
- return l2[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l2) : e;
448
- }
449
- function findTextCursor(s, o, l2, i) {
450
- const t = i.split(`
451
- `);
452
- let n = 0, e = s;
453
- for (const r of t) {
454
- if (e <= r.length)
455
- break;
456
- e -= r.length + 1, n++;
457
- }
458
- for (n = Math.max(0, Math.min(t.length - 1, n + l2)), e = Math.min(e, t[n].length) + o;e < 0 && n > 0; )
459
- n--, e += t[n].length + 1;
460
- for (;e > t[n].length && n < t.length - 1; )
461
- e -= t[n].length + 1, n++;
462
- e = Math.max(0, Math.min(t[n].length, e));
463
- let h = 0;
464
- for (let r = 0;r < n; r++)
465
- h += t[r].length + 1;
466
- return h + e;
448
+ const t = s + o, n = Math.max(l.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
449
+ return l[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l) : e;
467
450
  }
468
451
  var a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
469
452
  var t = [
@@ -495,6 +478,7 @@ var settings = {
495
478
  error: "Something went wrong"
496
479
  },
497
480
  withGuide: true,
481
+ accessible: undefined,
498
482
  date: {
499
483
  monthNames: [...t],
500
484
  messages: {
@@ -506,6 +490,14 @@ var settings = {
506
490
  }
507
491
  }
508
492
  };
493
+ function isAccessible(n) {
494
+ if (n !== undefined)
495
+ return n;
496
+ if (settings.accessible !== undefined)
497
+ return settings.accessible;
498
+ const e = process.env.ACCESSIBLE;
499
+ return e !== undefined && e !== "" && e !== "0" && e !== "false";
500
+ }
509
501
  function isActionKey(n, e) {
510
502
  if (typeof n == "string")
511
503
  return settings.aliases.get(n) === e;
@@ -518,14 +510,14 @@ function diffLines(i, s) {
518
510
  if (i === s)
519
511
  return;
520
512
  const e = i.split(`
521
- `), t2 = s.split(`
522
- `), r = Math.max(e.length, t2.length), f = [];
513
+ `), t = s.split(`
514
+ `), r = Math.max(e.length, t.length), f = [];
523
515
  for (let n = 0;n < r; n++)
524
- e[n] !== t2[n] && f.push(n);
516
+ e[n] !== t[n] && f.push(n);
525
517
  return {
526
518
  lines: f,
527
519
  numLinesBefore: e.length,
528
- numLinesAfter: t2.length,
520
+ numLinesAfter: t.length,
529
521
  numLines: r
530
522
  };
531
523
  }
@@ -542,7 +534,7 @@ function block({
542
534
  input: e = stdin,
543
535
  output: r = stdout,
544
536
  overwrite: o = true,
545
- hideCursor: t2 = true
537
+ hideCursor: n = true
546
538
  } = {}) {
547
539
  const s = l.createInterface({
548
540
  input: e,
@@ -551,10 +543,10 @@ function block({
551
543
  tabSize: 1
552
544
  });
553
545
  l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
554
- const n = (f, { name: a, sequence: p }) => {
546
+ const t = (f, { name: a, sequence: w }) => {
555
547
  const c = String(f);
556
- if (isActionKey([c, a, p], "cancel")) {
557
- t2 && r.write(import_sisteransi.cursor.show), process.exit(0);
548
+ if (isActionKey([c, a, w], "cancel")) {
549
+ n && r.write(import_sisteransi.cursor.show), process.exit(0);
558
550
  return;
559
551
  }
560
552
  if (!o)
@@ -562,39 +554,37 @@ function block({
562
554
  const i = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
563
555
  l.moveCursor(r, i, m, () => {
564
556
  l.clearLine(r, 1, () => {
565
- e.once("keypress", n);
557
+ e.once("keypress", t);
566
558
  });
567
559
  });
568
560
  };
569
- return t2 && r.write(import_sisteransi.cursor.hide), e.once("keypress", n), () => {
570
- e.off("keypress", n), t2 && r.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
561
+ return n && r.write(import_sisteransi.cursor.hide), e.once("keypress", t), () => {
562
+ e.off("keypress", t), n && r.write(import_sisteransi.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
571
563
  };
572
564
  }
573
565
  var getColumns = (e) => ("columns" in e) && typeof e.columns == "number" ? e.columns : 80;
574
566
  var getRows = (e) => ("rows" in e) && typeof e.rows == "number" ? e.rows : 20;
575
- function wrapTextWithPrefix(e, r, o, t2 = o, s = o, n) {
567
+ function wrapTextWithPrefix(e, r, o, n = o, s = o, t) {
576
568
  const f = getColumns(e ?? stdout);
577
569
  return wrapAnsi(r, f - o.length, {
578
570
  hard: true,
579
571
  trim: false
580
572
  }).split(`
581
573
  `).map((c, i, m) => {
582
- const d = n ? n(c, i) : c;
583
- return i === 0 ? `${t2}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
574
+ const d = t ? t(c, i) : c;
575
+ return i === 0 ? `${n}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
584
576
  }).join(`
585
577
  `);
586
578
  }
587
- function runValidation(e, n) {
579
+ function runValidation(e, a) {
588
580
  if ("~standard" in e) {
589
- const a = e["~standard"].validate(n);
590
- if (a instanceof Promise)
591
- throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
592
- return a.issues?.at(0)?.message;
581
+ const n = e["~standard"].validate(a);
582
+ return n instanceof Promise ? n.then((r) => r.issues?.at(0)?.message) : n.issues?.at(0)?.message;
593
583
  }
594
- return e(n);
584
+ return e(a);
595
585
  }
596
586
 
597
- class V {
587
+ class y {
598
588
  input;
599
589
  output;
600
590
  _abortSignal;
@@ -609,35 +599,38 @@ class V {
609
599
  error = "";
610
600
  value;
611
601
  userInput = "";
612
- constructor(t2, e = true) {
613
- const { input: i = stdin, output: n = stdout, render: s, signal: r, ...o } = t2;
614
- this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = s.bind(this), this._track = e, this._abortSignal = r, this.input = i, this.output = n;
602
+ get accessible() {
603
+ return isAccessible(this.opts.accessible);
604
+ }
605
+ constructor(t, e = true) {
606
+ const { input: i = stdin, output: s = stdout, render: r, signal: n, ...o } = t;
607
+ this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r.bind(this), this._track = e, this._abortSignal = n, this.input = i, this.output = s;
615
608
  }
616
609
  unsubscribe() {
617
610
  this._subscribers.clear();
618
611
  }
619
- setSubscriber(t2, e) {
620
- const i = this._subscribers.get(t2) ?? [];
621
- i.push(e), this._subscribers.set(t2, i);
612
+ setSubscriber(t, e) {
613
+ const i = this._subscribers.get(t) ?? [];
614
+ i.push(e), this._subscribers.set(t, i);
622
615
  }
623
- on(t2, e) {
624
- this.setSubscriber(t2, { cb: e });
616
+ on(t, e) {
617
+ this.setSubscriber(t, { cb: e });
625
618
  }
626
- once(t2, e) {
627
- this.setSubscriber(t2, { cb: e, once: true });
619
+ once(t, e) {
620
+ this.setSubscriber(t, { cb: e, once: true });
628
621
  }
629
- emit(t2, ...e) {
630
- const i = this._subscribers.get(t2) ?? [], n = [];
631
- for (const s of i)
632
- s.cb(...e), s.once && n.push(() => i.splice(i.indexOf(s), 1));
633
- for (const s of n)
634
- s();
622
+ emit(t, ...e) {
623
+ const i = this._subscribers.get(t) ?? [], s = [];
624
+ for (const r of i)
625
+ r.cb(...e), r.once && s.push(() => i.splice(i.indexOf(r), 1));
626
+ for (const r of s)
627
+ r();
635
628
  }
636
629
  prompt() {
637
- return new Promise((t2) => {
630
+ return new Promise((t) => {
638
631
  if (this._abortSignal) {
639
632
  if (this._abortSignal.aborted)
640
- return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
633
+ return this.state = "cancel", this.close(), t(CANCEL_SYMBOL);
641
634
  this._abortSignal.addEventListener("abort", () => {
642
635
  this.state = "cancel", this.close();
643
636
  }, { once: true });
@@ -649,179 +642,102 @@ class V {
649
642
  escapeCodeTimeout: 50,
650
643
  terminal: true
651
644
  }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
652
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
645
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(this.value);
653
646
  }), this.once("cancel", () => {
654
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
647
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(CANCEL_SYMBOL);
655
648
  });
656
649
  });
657
650
  }
658
- _isActionKey(t2, e) {
659
- return t2 === "\t";
651
+ _isActionKey(t, e) {
652
+ return t === "\t";
660
653
  }
661
- _shouldSubmit(t2, e) {
654
+ _shouldSubmit(t, e) {
662
655
  return true;
663
656
  }
664
- _setValue(t2) {
665
- this.value = t2, this.emit("value", this.value);
657
+ _setValue(t) {
658
+ this.value = t, this.emit("value", this.value);
666
659
  }
667
- _setUserInput(t2, e) {
668
- this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
660
+ _setUserInput(t, e) {
661
+ this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
669
662
  }
670
663
  _clearUserInput() {
671
664
  this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
672
665
  }
673
- onKeypress(t2, e) {
674
- if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
675
- if (this.opts.validate) {
676
- const i = runValidation(this.opts.validate, this.value);
677
- i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
666
+ async onKeypress(t, e) {
667
+ if (this.state !== "validating") {
668
+ if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t, e), e?.name === "return" && this._shouldSubmit(t, e)) {
669
+ if (this.opts.validate) {
670
+ const i = runValidation(this.opts.validate, this.value);
671
+ let s;
672
+ i instanceof Promise ? (this.state = "validating", this.render(), s = await i) : s = i, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
673
+ }
674
+ this.state !== "error" && (this.state = "submit");
678
675
  }
679
- this.state !== "error" && (this.state = "submit");
676
+ isActionKey([t, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
680
677
  }
681
- isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
682
678
  }
683
679
  close() {
684
680
  this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
685
681
  `), setRawMode(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
686
682
  }
687
683
  restoreCursor() {
688
- const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
684
+ const t = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
689
685
  `).length - 1;
690
- this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
686
+ this.output.write(import_sisteransi.cursor.move(-999, t * -1));
691
687
  }
692
688
  render() {
693
- const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
689
+ const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
694
690
  hard: true,
695
691
  trim: false
696
692
  });
697
- if (t2 !== this._prevFrame) {
693
+ if (t !== this._prevFrame) {
698
694
  if (this.state === "initial")
699
695
  this.output.write(import_sisteransi.cursor.hide);
700
696
  else {
701
- const e = diffLines(this._prevFrame, t2), i = getRows(this.output);
697
+ const e = diffLines(this._prevFrame, t), i = getRows(this.output);
702
698
  if (this.restoreCursor(), e) {
703
- const n = Math.max(0, e.numLinesAfter - i), s = Math.max(0, e.numLinesBefore - i);
704
- let r = e.lines.find((o) => o >= n);
705
- if (r === undefined) {
706
- this._prevFrame = t2;
699
+ const s = Math.max(0, e.numLinesAfter - i), r = Math.max(0, e.numLinesBefore - i);
700
+ let n = e.lines.find((o) => o >= s);
701
+ if (n === undefined) {
702
+ this._prevFrame = t;
707
703
  return;
708
704
  }
709
705
  if (e.lines.length === 1) {
710
- this.output.write(import_sisteransi.cursor.move(0, r - s)), this.output.write(import_sisteransi.erase.lines(1));
711
- const o = t2.split(`
706
+ this.output.write(import_sisteransi.cursor.move(0, n - r)), this.output.write(import_sisteransi.erase.lines(1));
707
+ const o = t.split(`
712
708
  `);
713
- this.output.write(o[r]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - r - 1));
709
+ this.output.write(o[n]), this._prevFrame = t, this.output.write(import_sisteransi.cursor.move(0, o.length - n - 1));
714
710
  return;
715
711
  } else if (e.lines.length > 1) {
716
- if (n < s)
717
- r = n;
712
+ if (s < r)
713
+ n = s;
718
714
  else {
719
- const h = r - s;
715
+ const h = n - r;
720
716
  h > 0 && this.output.write(import_sisteransi.cursor.move(0, h));
721
717
  }
722
718
  this.output.write(import_sisteransi.erase.down());
723
- const f = t2.split(`
724
- `).slice(r);
719
+ const f = t.split(`
720
+ `).slice(n);
725
721
  this.output.write(f.join(`
726
- `)), this._prevFrame = t2;
722
+ `)), this._prevFrame = t;
727
723
  return;
728
724
  }
729
725
  }
730
726
  this.output.write(import_sisteransi.erase.down());
731
727
  }
732
- this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
728
+ this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
733
729
  }
734
730
  }
735
731
  }
736
- function p$1(l2, e) {
737
- if (l2 === undefined || e.length === 0)
738
- return 0;
739
- const i = e.findIndex((s) => s.value === l2);
740
- return i !== -1 ? i : 0;
741
- }
742
- function g(l2, e) {
743
- return (e.label ?? String(e.value)).toLowerCase().includes(l2.toLowerCase());
744
- }
745
- function m(l2, e) {
746
- if (e)
747
- return l2 ? e : e[0];
748
- }
749
- var T$1 = class T extends V {
750
- filteredOptions;
751
- multiple;
752
- isNavigating = false;
753
- selectedValues = [];
754
- focusedValue;
755
- #e = 0;
756
- #s = "";
757
- #t;
758
- #i;
759
- #n;
760
- get cursor() {
761
- return this.#e;
762
- }
763
- get userInputWithCursor() {
764
- if (!this.userInput)
765
- return styleText(["inverse", "hidden"], "_");
766
- if (this._cursor >= this.userInput.length)
767
- return `${this.userInput}█`;
768
- const e = this.userInput.slice(0, this.cursor), t2 = this.userInput.slice(this.cursor, this.cursor + 1), i = this.userInput.slice(this.cursor + 1);
769
- return `${e}${styleText("inverse", t2)}${i}`;
770
- }
771
- get options() {
772
- return typeof this.#i == "function" ? this.#i() : this.#i;
773
- }
774
- constructor(e) {
775
- super(e), this.#i = e.options, this.#n = e.placeholder;
776
- const t2 = this.options;
777
- this.filteredOptions = [...t2], this.multiple = e.multiple === true, this.#t = typeof e.options == "function" ? e.filter : e.filter ?? g;
778
- let i;
779
- if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0]?.value]), i)
780
- for (const s of i) {
781
- const n = t2.findIndex((o) => o.value === s);
782
- n !== -1 && (this.toggleSelected(s), this.#e = n);
783
- }
784
- this.focusedValue = this.options[this.#e]?.value, this.on("key", (s, n) => this.#l(s, n)), this.on("userInput", (s) => this.#u(s));
785
- }
786
- _isActionKey(e, t2) {
787
- return e === "\t" || this.multiple && this.isNavigating && t2.name === "space" && e !== undefined && e !== "";
788
- }
789
- #l(e, t2) {
790
- const i = t2.name === "up", s = t2.name === "down", n = t2.name === "return", o = this.userInput === "" || this.userInput === "\t", u = this.#n, a = this.options, f = u !== undefined && u !== "" && a.some((r) => !r.disabled && (this.#t ? this.#t(u, r) : true));
791
- if (t2.name === "tab" && o && f) {
792
- this.userInput === "\t" && this._clearUserInput(), this._setUserInput(u, true), this.isNavigating = false;
793
- return;
794
- }
795
- i || s ? (this.#e = findCursor(this.#e, i ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = m(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (t2.name === "tab" || this.isNavigating && t2.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
796
- }
797
- deselectAll() {
798
- this.selectedValues = [];
799
- }
800
- toggleSelected(e) {
801
- this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((t2) => t2 !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
802
- }
803
- #u(e) {
804
- if (e !== this.#s) {
805
- this.#s = e;
806
- const t2 = this.options;
807
- e && this.#t ? this.filteredOptions = t2.filter((n) => this.#t?.(e, n)) : this.filteredOptions = [...t2];
808
- const i = p$1(this.focusedValue, this.filteredOptions);
809
- this.#e = findCursor(i, 0, this.filteredOptions);
810
- const s = this.filteredOptions[this.#e];
811
- s && !s.disabled ? this.focusedValue = s.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
812
- }
813
- }
814
- };
815
-
816
- class r extends V {
732
+ class r extends y {
817
733
  get cursor() {
818
734
  return this.value ? 0 : 1;
819
735
  }
820
736
  get _value() {
821
737
  return this.cursor === 0;
822
738
  }
823
- constructor(t2) {
824
- super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
739
+ constructor(t) {
740
+ super(t, false), this.value = !!t.initialValue, this.on("userInput", () => {
825
741
  this.value = this._value;
826
742
  }), this.on("confirm", (i) => {
827
743
  this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i, this.state = "submit", this.close();
@@ -830,366 +746,7 @@ class r extends V {
830
746
  });
831
747
  }
832
748
  }
833
- var _ = {
834
- Y: { type: "year", len: 4 },
835
- M: { type: "month", len: 2 },
836
- D: { type: "day", len: 2 }
837
- };
838
- function M(r2) {
839
- return [...r2].map((t2) => _[t2]);
840
- }
841
- function P(r2) {
842
- const i = new Intl.DateTimeFormat(r2, {
843
- year: "numeric",
844
- month: "2-digit",
845
- day: "2-digit"
846
- }).formatToParts(new Date(2000, 0, 15)), s = [];
847
- let n = "/";
848
- for (const e of i)
849
- e.type === "literal" ? n = e.value.trim() || e.value : (e.type === "year" || e.type === "month" || e.type === "day") && s.push({ type: e.type, len: e.type === "year" ? 4 : 2 });
850
- return { segments: s, separator: n };
851
- }
852
- function p(r2) {
853
- return Number.parseInt((r2 || "0").replace(/_/g, "0"), 10) || 0;
854
- }
855
- function f(r2) {
856
- return {
857
- year: p(r2.year),
858
- month: p(r2.month),
859
- day: p(r2.day)
860
- };
861
- }
862
- function c(r2, t2) {
863
- return new Date(r2 || 2001, t2 || 1, 0).getDate();
864
- }
865
- function b(r2) {
866
- const { year: t2, month: i, day: s } = f(r2);
867
- if (!t2 || t2 < 0 || t2 > 9999 || !i || i < 1 || i > 12 || !s || s < 1)
868
- return;
869
- const n = new Date(Date.UTC(t2, i - 1, s));
870
- if (!(n.getUTCFullYear() !== t2 || n.getUTCMonth() !== i - 1 || n.getUTCDate() !== s))
871
- return { year: t2, month: i, day: s };
872
- }
873
- function C(r2) {
874
- const t2 = b(r2);
875
- return t2 ? new Date(Date.UTC(t2.year, t2.month - 1, t2.day)) : undefined;
876
- }
877
- function T2(r2, t2, i, s) {
878
- const n = i ? {
879
- year: i.getUTCFullYear(),
880
- month: i.getUTCMonth() + 1,
881
- day: i.getUTCDate()
882
- } : null, e = s ? {
883
- year: s.getUTCFullYear(),
884
- month: s.getUTCMonth() + 1,
885
- day: s.getUTCDate()
886
- } : null;
887
- return r2 === "year" ? { min: n?.year ?? 1, max: e?.year ?? 9999 } : r2 === "month" ? {
888
- min: n && t2.year === n.year ? n.month : 1,
889
- max: e && t2.year === e.year ? e.month : 12
890
- } : {
891
- min: n && t2.year === n.year && t2.month === n.month ? n.day : 1,
892
- max: e && t2.year === e.year && t2.month === e.month ? e.day : c(t2.year, t2.month)
893
- };
894
- }
895
-
896
- class U extends V {
897
- #i;
898
- #o;
899
- #t;
900
- #h;
901
- #u;
902
- #e = { segmentIndex: 0, positionInSegment: 0 };
903
- #n = true;
904
- #s = null;
905
- inlineError = "";
906
- get segmentCursor() {
907
- return { ...this.#e };
908
- }
909
- get segmentValues() {
910
- return { ...this.#t };
911
- }
912
- get segments() {
913
- return this.#i;
914
- }
915
- get separator() {
916
- return this.#o;
917
- }
918
- get formattedValue() {
919
- return this.#l(this.#t);
920
- }
921
- #l(t2) {
922
- return this.#i.map((i) => t2[i.type]).join(this.#o);
923
- }
924
- #r() {
925
- this._setUserInput(this.#l(this.#t)), this._setValue(C(this.#t) ?? undefined);
926
- }
927
- constructor(t2) {
928
- const i = t2.format ? { segments: M(t2.format), separator: t2.separator ?? "/" } : P(t2.locale), s = t2.separator ?? i.separator, n = t2.format ? M(t2.format) : i.segments, e = t2.initialValue ?? t2.defaultValue, m2 = e ? {
929
- year: String(e.getUTCFullYear()).padStart(4, "0"),
930
- month: String(e.getUTCMonth() + 1).padStart(2, "0"),
931
- day: String(e.getUTCDate()).padStart(2, "0")
932
- } : { year: "____", month: "__", day: "__" }, o = n.map((a) => m2[a.type]).join(s);
933
- super({ ...t2, initialUserInput: o }, false), this.#i = n, this.#o = s, this.#t = m2, this.#h = t2.minDate, this.#u = t2.maxDate, this.#r(), this.on("cursor", (a) => this.#f(a)), this.on("key", (a, u) => this.#y(a, u)), this.on("finalize", () => this.#p(t2));
934
- }
935
- #a() {
936
- const t2 = Math.max(0, Math.min(this.#e.segmentIndex, this.#i.length - 1)), i = this.#i[t2];
937
- if (i)
938
- return this.#e.positionInSegment = Math.max(0, Math.min(this.#e.positionInSegment, i.len - 1)), { segment: i, index: t2 };
939
- }
940
- #m(t2) {
941
- this.inlineError = "", this.#s = null;
942
- const i = this.#a();
943
- i && (this.#e.segmentIndex = Math.max(0, Math.min(this.#i.length - 1, i.index + t2)), this.#e.positionInSegment = 0, this.#n = true);
944
- }
945
- #d(t2) {
946
- const i = this.#a();
947
- if (!i)
948
- return;
949
- const { segment: s } = i, n = this.#t[s.type], e = !n || n.replace(/_/g, "") === "", m2 = Number.parseInt((n || "0").replace(/_/g, "0"), 10) || 0, o = T2(s.type, f(this.#t), this.#h, this.#u);
950
- let a;
951
- e ? a = t2 === 1 ? o.min : o.max : a = Math.max(Math.min(o.max, m2 + t2), o.min), this.#t = {
952
- ...this.#t,
953
- [s.type]: a.toString().padStart(s.len, "0")
954
- }, this.#n = true, this.#s = null, this.#r();
955
- }
956
- #f(t2) {
957
- if (t2)
958
- switch (t2) {
959
- case "right":
960
- return this.#m(1);
961
- case "left":
962
- return this.#m(-1);
963
- case "up":
964
- return this.#d(1);
965
- case "down":
966
- return this.#d(-1);
967
- }
968
- }
969
- #y(t2, i) {
970
- if (i?.name === "backspace" || i?.sequence === "" || i?.sequence === "\b" || t2 === "" || t2 === "\b") {
971
- this.inlineError = "";
972
- const n = this.#a();
973
- if (!n)
974
- return;
975
- if (!this.#t[n.segment.type].replace(/_/g, "")) {
976
- this.#m(-1);
977
- return;
978
- }
979
- this.#t[n.segment.type] = "_".repeat(n.segment.len), this.#n = true, this.#e.positionInSegment = 0, this.#r();
980
- return;
981
- }
982
- if (i?.name === "tab") {
983
- this.inlineError = "";
984
- const n = this.#a();
985
- if (!n)
986
- return;
987
- const e = i.shift ? -1 : 1, m2 = n.index + e;
988
- m2 >= 0 && m2 < this.#i.length && (this.#e.segmentIndex = m2, this.#e.positionInSegment = 0, this.#n = true);
989
- return;
990
- }
991
- if (t2 && /^[0-9]$/.test(t2)) {
992
- const n = this.#a();
993
- if (!n)
994
- return;
995
- const { segment: e } = n, m2 = !this.#t[e.type].replace(/_/g, "");
996
- if (this.#n && this.#s !== null && !m2) {
997
- const h = this.#s + t2, d = { ...this.#t, [e.type]: h }, g2 = this.#g(d, e);
998
- if (g2) {
999
- this.inlineError = g2, this.#s = null, this.#n = false;
1000
- return;
1001
- }
1002
- this.inlineError = "", this.#t[e.type] = h, this.#s = null, this.#n = false, this.#r(), n.index < this.#i.length - 1 && (this.#e.segmentIndex = n.index + 1, this.#e.positionInSegment = 0, this.#n = true);
1003
- return;
1004
- }
1005
- this.#n && !m2 && (this.#t[e.type] = "_".repeat(e.len), this.#e.positionInSegment = 0), this.#n = false, this.#s = null;
1006
- const o = this.#t[e.type], a = o.indexOf("_"), u = a >= 0 ? a : Math.min(this.#e.positionInSegment, e.len - 1);
1007
- if (u < 0 || u >= e.len)
1008
- return;
1009
- let l2 = o.slice(0, u) + t2 + o.slice(u + 1), D = false;
1010
- if (u === 0 && o === "__" && (e.type === "month" || e.type === "day")) {
1011
- const h = Number.parseInt(t2, 10);
1012
- l2 = `0${t2}`, D = h <= (e.type === "month" ? 1 : 2);
1013
- }
1014
- if (e.type === "year" && (l2 = (o.replace(/_/g, "") + t2).padStart(e.len, "_")), !l2.includes("_")) {
1015
- const h = { ...this.#t, [e.type]: l2 }, d = this.#g(h, e);
1016
- if (d) {
1017
- this.inlineError = d;
1018
- return;
1019
- }
1020
- }
1021
- this.inlineError = "", this.#t[e.type] = l2;
1022
- const y = l2.includes("_") ? undefined : b(this.#t);
1023
- if (y) {
1024
- const { year: h, month: d } = y, g2 = c(h, d);
1025
- this.#t = {
1026
- year: String(Math.max(0, Math.min(9999, h))).padStart(4, "0"),
1027
- month: String(Math.max(1, Math.min(12, d))).padStart(2, "0"),
1028
- day: String(Math.max(1, Math.min(g2, y.day))).padStart(2, "0")
1029
- };
1030
- }
1031
- this.#r();
1032
- const S = l2.indexOf("_");
1033
- D ? (this.#n = true, this.#s = t2) : S >= 0 ? this.#e.positionInSegment = S : a >= 0 && n.index < this.#i.length - 1 ? (this.#e.segmentIndex = n.index + 1, this.#e.positionInSegment = 0, this.#n = true) : this.#e.positionInSegment = Math.min(u + 1, e.len - 1);
1034
- }
1035
- }
1036
- #g(t2, i) {
1037
- const { month: s, day: n } = f(t2);
1038
- if (i.type === "month" && (s < 0 || s > 12))
1039
- return settings.date.messages.invalidMonth;
1040
- if (i.type === "day" && (n < 0 || n > 31))
1041
- return settings.date.messages.invalidDay(31, "any month");
1042
- }
1043
- #p(t2) {
1044
- const { year: i, month: s, day: n } = f(this.#t);
1045
- if (i && s && n) {
1046
- const e = c(i, s);
1047
- this.#t = {
1048
- ...this.#t,
1049
- day: String(Math.min(n, e)).padStart(2, "0")
1050
- };
1051
- }
1052
- this.value = C(this.#t) ?? t2.defaultValue ?? undefined;
1053
- }
1054
- }
1055
- var u$2 = class u extends V {
1056
- options;
1057
- cursor = 0;
1058
- #t;
1059
- getGroupItems(t2) {
1060
- return this.options.filter((r2) => r2.group === t2);
1061
- }
1062
- isGroupSelected(t2) {
1063
- const r2 = this.getGroupItems(t2), e = this.value;
1064
- return e === undefined ? false : r2.every((s) => e.includes(s.value));
1065
- }
1066
- toggleValue() {
1067
- const t2 = this.options[this.cursor];
1068
- if (t2 !== undefined)
1069
- if (this.value === undefined && (this.value = []), t2.group === true) {
1070
- const r2 = t2.value, e = this.getGroupItems(r2);
1071
- this.isGroupSelected(r2) ? this.value = this.value.filter((s) => e.findIndex((i) => i.value === s) === -1) : this.value = [...this.value, ...e.map((s) => s.value)], this.value = Array.from(new Set(this.value));
1072
- } else {
1073
- const r2 = this.value.includes(t2.value);
1074
- this.value = r2 ? this.value.filter((e) => e !== t2.value) : [...this.value, t2.value];
1075
- }
1076
- }
1077
- constructor(t2) {
1078
- super(t2, false);
1079
- const { options: r2 } = t2;
1080
- this.#t = t2.selectableGroups !== false, this.options = Object.entries(r2).flatMap(([e, s]) => [
1081
- { value: e, group: true, label: e },
1082
- ...s.map((i) => ({ ...i, group: e }))
1083
- ]), this.value = [...t2.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: e }) => e === t2.cursorAt), this.#t ? 0 : 1), this.on("cursor", (e) => {
1084
- switch (e) {
1085
- case "left":
1086
- case "up": {
1087
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
1088
- const s = this.options[this.cursor]?.group === true;
1089
- !this.#t && s && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
1090
- break;
1091
- }
1092
- case "down":
1093
- case "right": {
1094
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
1095
- const s = this.options[this.cursor]?.group === true;
1096
- !this.#t && s && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
1097
- break;
1098
- }
1099
- case "space":
1100
- this.toggleValue();
1101
- break;
1102
- }
1103
- });
1104
- }
1105
- };
1106
- var o = /* @__PURE__ */ new Set(["up", "down", "left", "right"]);
1107
-
1108
- class h extends V {
1109
- #t = false;
1110
- #s;
1111
- focused = "editor";
1112
- get userInputWithCursor() {
1113
- if (this.state === "submit")
1114
- return this.userInput;
1115
- const t2 = this.userInput;
1116
- if (this.cursor >= t2.length)
1117
- return `${t2}█`;
1118
- const s = t2.slice(0, this.cursor), r2 = t2.slice(this.cursor, this.cursor + 1), i = t2.slice(this.cursor + 1);
1119
- return r2 === `
1120
- ` ? `${s}█
1121
- ${i}` : `${s}${styleText("inverse", r2)}${i}`;
1122
- }
1123
- get cursor() {
1124
- return this._cursor;
1125
- }
1126
- #r(t2) {
1127
- if (this.userInput.length === 0) {
1128
- this._setUserInput(t2);
1129
- return;
1130
- }
1131
- this._setUserInput(this.userInput.slice(0, this.cursor) + t2 + this.userInput.slice(this.cursor));
1132
- }
1133
- #i(t2) {
1134
- const s = this.value ?? "";
1135
- switch (t2) {
1136
- case "up":
1137
- this._cursor = findTextCursor(this._cursor, 0, -1, s);
1138
- return;
1139
- case "down":
1140
- this._cursor = findTextCursor(this._cursor, 0, 1, s);
1141
- return;
1142
- case "left":
1143
- this._cursor = findTextCursor(this._cursor, -1, 0, s);
1144
- return;
1145
- case "right":
1146
- this._cursor = findTextCursor(this._cursor, 1, 0, s);
1147
- return;
1148
- }
1149
- }
1150
- _shouldSubmit(t2, s) {
1151
- if (this.#s)
1152
- return this.focused === "submit" ? true : (this.#r(`
1153
- `), this._cursor++, false);
1154
- const r2 = this.#t;
1155
- return this.#t = true, r2 && this.cursor === this.userInput.length ? (this.userInput[this.cursor - 1] === `
1156
- ` && (this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--), true) : (this.#r(`
1157
- `), this._cursor++, false);
1158
- }
1159
- constructor(t2) {
1160
- const s = t2.initialUserInput ?? t2.initialValue;
1161
- super({
1162
- ...t2,
1163
- initialUserInput: s
1164
- }, false), s !== undefined && (this._cursor = s.length), this.#s = t2.showSubmit ?? false, this.on("key", (r2, i) => {
1165
- if (i?.name && o.has(i.name)) {
1166
- this.#t = false, this.#i(i.name);
1167
- return;
1168
- }
1169
- if (r2 === "\t" && this.#s) {
1170
- this.focused = this.focused === "editor" ? "submit" : "editor";
1171
- return;
1172
- }
1173
- if (i?.name !== "return") {
1174
- if (this.#t = false, i?.name === "backspace" && this.cursor > 0) {
1175
- this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--;
1176
- return;
1177
- }
1178
- if (i?.name === "delete" && this.cursor < this.userInput.length) {
1179
- this._setUserInput(this.userInput.slice(0, this.cursor) + this.userInput.slice(this.cursor + 1));
1180
- return;
1181
- }
1182
- r2 && (this.#s && this.focused === "submit" && (this.focused = "editor"), this.#r(r2 ?? ""), this._cursor++);
1183
- }
1184
- }), this.on("userInput", (r2) => {
1185
- this._setValue(r2);
1186
- }), this.on("finalize", () => {
1187
- this.value || (this.value = t2.defaultValue), this.value === undefined && (this.value = "");
1188
- });
1189
- }
1190
- }
1191
-
1192
- class a extends V {
749
+ class a extends y {
1193
750
  options;
1194
751
  cursor = 0;
1195
752
  get _value() {
@@ -1200,14 +757,14 @@ class a extends V {
1200
757
  }
1201
758
  toggleAll() {
1202
759
  const e = this._enabledOptions, i = this.value !== undefined && this.value.length === e.length;
1203
- this.value = i ? [] : e.map((t2) => t2.value);
760
+ this.value = i ? [] : e.map((t) => t.value);
1204
761
  }
1205
762
  toggleInvert() {
1206
763
  const e = this.value;
1207
764
  if (!e)
1208
765
  return;
1209
- const i = this._enabledOptions.filter((t2) => !e.includes(t2.value));
1210
- this.value = i.map((t2) => t2.value);
766
+ const i = this._enabledOptions.filter((t) => !e.includes(t.value));
767
+ this.value = i.map((t) => t.value);
1211
768
  }
1212
769
  toggleValue() {
1213
770
  this.value === undefined && (this.value = []);
@@ -1216,11 +773,11 @@ class a extends V {
1216
773
  }
1217
774
  constructor(e) {
1218
775
  super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
1219
- const i = Math.max(this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt), 0);
1220
- this.cursor = this.options[i]?.disabled ? findCursor(i, 1, this.options) : i, this.on("key", (t2, l2) => {
1221
- l2.name === "a" && this.toggleAll(), l2.name === "i" && this.toggleInvert();
1222
- }), this.on("cursor", (t2) => {
1223
- switch (t2) {
776
+ const i = Math.max(this.options.findIndex(({ value: t }) => t === e.cursorAt), 0);
777
+ this.cursor = this.options[i]?.disabled ? findCursor(i, 1, this.options) : i, this.on("key", (t, l) => {
778
+ l.name === "a" && this.toggleAll(), l.name === "i" && this.toggleInvert();
779
+ }), this.on("cursor", (t) => {
780
+ switch (t) {
1224
781
  case "left":
1225
782
  case "up":
1226
783
  this.cursor = findCursor(this.cursor, -1, this.options);
@@ -1236,7 +793,7 @@ class a extends V {
1236
793
  });
1237
794
  }
1238
795
  }
1239
- var u$1 = class u2 extends V {
796
+ var u$1 = class u extends y {
1240
797
  _mask = "•";
1241
798
  get cursor() {
1242
799
  return this._cursor;
@@ -1247,24 +804,24 @@ var u$1 = class u2 extends V {
1247
804
  get userInputWithCursor() {
1248
805
  if (this.state === "submit" || this.state === "cancel")
1249
806
  return this.masked;
1250
- const t2 = this.userInput;
1251
- if (this.cursor >= t2.length)
807
+ const t = this.userInput;
808
+ if (this.cursor >= t.length)
1252
809
  return `${this.masked}${styleText(["inverse", "hidden"], "_")}`;
1253
- const s = this.masked, r2 = s.slice(0, this.cursor), i = s.slice(this.cursor, this.cursor + 1), o2 = s.slice(this.cursor + 1);
1254
- return `${r2}${styleText("inverse", i)}${o2}`;
810
+ const s = this.masked, r = s.slice(0, this.cursor), i = s.slice(this.cursor, this.cursor + 1), o = s.slice(this.cursor + 1);
811
+ return `${r}${styleText("inverse", i)}${o}`;
1255
812
  }
1256
813
  clear() {
1257
814
  this._clearUserInput();
1258
815
  }
1259
- constructor({ mask: t2, ...s }) {
1260
- super(s), this._mask = t2 ?? "•", this.on("userInput", (r2) => {
1261
- this._setValue(r2);
816
+ constructor({ mask: t, ...s }) {
817
+ super(s), this._mask = t ?? "•", this.on("userInput", (r) => {
818
+ this._setValue(r);
1262
819
  }), this.on("finalize", () => {
1263
820
  this.value === undefined && (this.value = "");
1264
821
  });
1265
822
  }
1266
823
  };
1267
- var n$1 = class n extends V {
824
+ var n$1 = class n extends y {
1268
825
  options;
1269
826
  cursor = 0;
1270
827
  get _selectedValue() {
@@ -1276,8 +833,8 @@ var n$1 = class n extends V {
1276
833
  }
1277
834
  constructor(e) {
1278
835
  super(e, false), this.options = e.options;
1279
- const o2 = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o2 === -1 ? 0 : o2;
1280
- this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
836
+ const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t = o === -1 ? 0 : o;
837
+ this.cursor = this.options[t]?.disabled ? findCursor(t, 1, this.options) : t, this.changeValue(), this.on("cursor", (s) => {
1281
838
  switch (s) {
1282
839
  case "left":
1283
840
  case "up":
@@ -1292,27 +849,27 @@ var n$1 = class n extends V {
1292
849
  });
1293
850
  }
1294
851
  };
1295
- class n2 extends V {
852
+ class n extends y {
1296
853
  get userInputWithCursor() {
1297
854
  if (this.state === "submit")
1298
855
  return this.userInput;
1299
- const t2 = this.userInput;
1300
- if (this.cursor >= t2.length)
856
+ const t = this.userInput;
857
+ if (this.cursor >= t.length)
1301
858
  return `${this.userInput}█`;
1302
- const r2 = t2.slice(0, this.cursor), s = t2.slice(this.cursor, this.cursor + 1), e = t2.slice(this.cursor + 1);
1303
- return `${r2}${styleText("inverse", s)}${e}`;
859
+ const r = t.slice(0, this.cursor), s = t.slice(this.cursor, this.cursor + 1), e = t.slice(this.cursor + 1);
860
+ return `${r}${styleText("inverse", s)}${e}`;
1304
861
  }
1305
862
  get cursor() {
1306
863
  return this._cursor;
1307
864
  }
1308
- constructor(t2) {
865
+ constructor(t) {
1309
866
  super({
1310
- ...t2,
1311
- initialUserInput: t2.initialUserInput ?? t2.initialValue
1312
- }), this.on("userInput", (r2) => {
1313
- this._setValue(r2);
867
+ ...t,
868
+ initialUserInput: t.initialUserInput ?? t.initialValue
869
+ }), this.on("userInput", (r) => {
870
+ this._setValue(r);
1314
871
  }), this.on("finalize", () => {
1315
- this.value || (this.value = t2.defaultValue), this.value === undefined && (this.value = "");
872
+ this.value || (this.value = t.defaultValue), this.value === undefined && (this.value = "");
1316
873
  });
1317
874
  }
1318
875
  }
@@ -1329,8 +886,8 @@ function isUnicodeSupported() {
1329
886
  }
1330
887
  var unicode = isUnicodeSupported();
1331
888
  var isCI = () => process.env.CI === "true";
1332
- var isTTY = (o2) => o2.isTTY === true;
1333
- var unicodeOr = (o2, e) => unicode ? o2 : e;
889
+ var isTTY = (o) => o.isTTY === true;
890
+ var unicodeOr = (o, e) => unicode ? o : e;
1334
891
  var S_STEP_ACTIVE = unicodeOr("◆", "*");
1335
892
  var S_STEP_CANCEL = unicodeOr("■", "x");
1336
893
  var S_STEP_ERROR = unicodeOr("▲", "x");
@@ -1356,8 +913,8 @@ var S_INFO = unicodeOr("●", "•");
1356
913
  var S_SUCCESS = unicodeOr("◆", "*");
1357
914
  var S_WARN = unicodeOr("▲", "!");
1358
915
  var S_ERROR = unicodeOr("■", "x");
1359
- var symbol = (o2) => {
1360
- switch (o2) {
916
+ var symbol = (o) => {
917
+ switch (o) {
1361
918
  case "initial":
1362
919
  case "active":
1363
920
  return styleText2("cyan", S_STEP_ACTIVE);
@@ -1367,37 +924,39 @@ var symbol = (o2) => {
1367
924
  return styleText2("yellow", S_STEP_ERROR);
1368
925
  case "submit":
1369
926
  return styleText2("green", S_STEP_SUBMIT);
927
+ case "validating":
928
+ return styleText2("dim", S_STEP_ACTIVE);
1370
929
  }
1371
930
  };
1372
- var confirm = (i) => {
1373
- const a2 = i.active ?? "Yes", s = i.inactive ?? "No";
931
+ var confirm = (e) => {
932
+ const a = e.active ?? "Yes", o = e.inactive ?? "No";
1374
933
  return new r({
1375
- active: a2,
1376
- inactive: s,
1377
- signal: i.signal,
1378
- input: i.input,
1379
- output: i.output,
1380
- initialValue: i.initialValue ?? true,
934
+ active: a,
935
+ inactive: o,
936
+ signal: e.signal,
937
+ input: e.input,
938
+ output: e.output,
939
+ initialValue: e.initialValue ?? true,
1381
940
  render() {
1382
- const e = i.withGuide ?? settings.withGuide, u4 = `${symbol(this.state)} `, l2 = e ? `${styleText2("gray", S_BAR)} ` : "", f2 = wrapTextWithPrefix(i.output, i.message, l2, u4), o2 = `${e ? `${styleText2("gray", S_BAR)}
1383
- ` : ""}${f2}
1384
- `, c2 = this.value ? a2 : s;
941
+ const i = e.withGuide ?? settings.withGuide, u = `${symbol(this.state)} `, l = i ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(e.output, e.message, l, u), s = `${i ? `${styleText2("gray", S_BAR)}
942
+ ` : ""}${f}
943
+ `, c = this.value ? a : o;
1385
944
  switch (this.state) {
1386
945
  case "submit": {
1387
- const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
1388
- return `${o2}${r2}${styleText2("dim", c2)}`;
946
+ const r = i ? `${styleText2("gray", S_BAR)} ` : "";
947
+ return `${s}${r}${styleText2("dim", c)}`;
1389
948
  }
1390
949
  case "cancel": {
1391
- const r2 = e ? `${styleText2("gray", S_BAR)} ` : "";
1392
- return `${o2}${r2}${styleText2(["strikethrough", "dim"], c2)}${e ? `
950
+ const r = i ? `${styleText2("gray", S_BAR)} ` : "";
951
+ return `${s}${r}${styleText2(["strikethrough", "dim"], c)}${i ? `
1393
952
  ${styleText2("gray", S_BAR)}` : ""}`;
1394
953
  }
1395
954
  default: {
1396
- const r2 = e ? `${styleText2("cyan", S_BAR)} ` : "", g2 = e ? styleText2("cyan", S_BAR_END) : "";
1397
- return `${o2}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${i.vertical ? e ? `
955
+ const r = i ? `${styleText2("cyan", S_BAR)} ` : "", g = i ? styleText2("cyan", S_BAR_END) : "";
956
+ return `${s}${r}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a)}`}${e.vertical ? i ? `
1398
957
  ${styleText2("cyan", S_BAR)} ` : `
1399
- ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", s)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${s}`}
1400
- ${g2}
958
+ ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", o)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${o}`}
959
+ ${g}
1401
960
  `;
1402
961
  }
1403
962
  }
@@ -1412,23 +971,23 @@ var MULTISELECT_INSTRUCTIONS = [
1412
971
  var log = {
1413
972
  message: (s = [], {
1414
973
  symbol: e = styleText2("gray", S_BAR),
1415
- secondarySymbol: r2 = styleText2("gray", S_BAR),
1416
- output: m2 = process.stdout,
1417
- spacing: l2 = 1,
1418
- withGuide: c2
974
+ secondarySymbol: r = styleText2("gray", S_BAR),
975
+ output: m = process.stdout,
976
+ spacing: l = 1,
977
+ withGuide: c
1419
978
  } = {}) => {
1420
- const t2 = [], o2 = c2 ?? settings.withGuide, f2 = o2 ? r2 : "", O = o2 ? `${e} ` : "", u4 = o2 ? `${r2} ` : "";
1421
- for (let i = 0;i < l2; i++)
1422
- t2.push(f2);
1423
- const g2 = Array.isArray(s) ? s : s.split(`
979
+ const t = [], o = c ?? settings.withGuide, f = o ? r : "", O = o ? `${e} ` : "", u = o ? `${r} ` : "";
980
+ for (let i = 0;i < l; i++)
981
+ t.push(f);
982
+ const g = Array.isArray(s) ? s : s.split(`
1424
983
  `);
1425
- if (g2.length > 0) {
1426
- const [i, ...y] = g2;
1427
- i.length > 0 ? t2.push(`${O}${i}`) : t2.push(o2 ? e : "");
1428
- for (const p2 of y)
1429
- p2.length > 0 ? t2.push(`${u4}${p2}`) : t2.push(o2 ? r2 : "");
984
+ if (g.length > 0) {
985
+ const [i, ...y] = g;
986
+ i.length > 0 ? t.push(`${O}${i}`) : t.push(o ? e : "");
987
+ for (const p of y)
988
+ p.length > 0 ? t.push(`${u}${p}`) : t.push(o ? r : "");
1430
989
  }
1431
- m2.write(`${t2.join(`
990
+ m.write(`${t.join(`
1432
991
  `)}
1433
992
  `);
1434
993
  },
@@ -1451,157 +1010,157 @@ var log = {
1451
1010
  log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
1452
1011
  }
1453
1012
  };
1454
- var cancel = (o2 = "", t2) => {
1455
- const i = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
1456
- i.write(`${e}${styleText2("red", o2)}
1013
+ var cancel = (o = "", t) => {
1014
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
1015
+ i.write(`${e}${styleText2("red", o)}
1457
1016
 
1458
1017
  `);
1459
1018
  };
1460
- var intro = (o2 = "", t2) => {
1461
- const i = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
1462
- i.write(`${e}${o2}
1019
+ var intro = (o = "", t) => {
1020
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
1021
+ i.write(`${e}${o}
1463
1022
  `);
1464
1023
  };
1465
- var outro = (o2 = "", t2) => {
1466
- const i = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
1024
+ var outro = (o = "", t) => {
1025
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
1467
1026
  ${styleText2("gray", S_BAR_END)} ` : "";
1468
- i.write(`${e}${o2}
1027
+ i.write(`${e}${o}
1469
1028
 
1470
1029
  `);
1471
1030
  };
1472
- var password = (r2) => new u$1({
1473
- validate: r2.validate,
1474
- mask: r2.mask ?? S_PASSWORD_MASK,
1475
- signal: r2.signal,
1476
- input: r2.input,
1477
- output: r2.output,
1031
+ var password = (e) => new u$1({
1032
+ validate: e.validate,
1033
+ mask: e.mask ?? S_PASSWORD_MASK,
1034
+ signal: e.signal,
1035
+ input: e.input,
1036
+ output: e.output,
1478
1037
  render() {
1479
- const e = r2.withGuide ?? settings.withGuide, o2 = `${e ? `${styleText2("gray", S_BAR)}
1480
- ` : ""}${symbol(this.state)} ${r2.message}
1481
- `, c2 = this.userInputWithCursor, i = this.masked;
1038
+ const r = e.withGuide ?? settings.withGuide, o = `${r ? `${styleText2("gray", S_BAR)}
1039
+ ` : ""}${symbol(this.state)} ${e.message}
1040
+ `, m = this.userInputWithCursor, i = this.masked;
1482
1041
  switch (this.state) {
1483
1042
  case "error": {
1484
- const s = e ? `${styleText2("yellow", S_BAR)} ` : "", n3 = e ? `${styleText2("yellow", S_BAR_END)} ` : "", l2 = i ?? "";
1485
- return r2.clearOnError && this.clear(), `${o2.trim()}
1486
- ${s}${l2}
1487
- ${n3}${styleText2("yellow", this.error)}
1043
+ const s = r ? `${styleText2("yellow", S_BAR)} ` : "", n = r ? `${styleText2("yellow", S_BAR_END)} ` : "", d = i ?? "";
1044
+ return e.clearOnError && this.clear(), `${o.trim()}
1045
+ ${s}${d}
1046
+ ${n}${styleText2("yellow", this.error)}
1488
1047
  `;
1489
1048
  }
1490
1049
  case "submit": {
1491
- const s = e ? `${styleText2("gray", S_BAR)} ` : "", n3 = i ? styleText2("dim", i) : "";
1492
- return `${o2}${s}${n3}`;
1050
+ const s = r ? `${styleText2("gray", S_BAR)} ` : "", n = i ? styleText2("dim", i) : "";
1051
+ return `${o}${s}${n}`;
1493
1052
  }
1494
1053
  case "cancel": {
1495
- const s = e ? `${styleText2("gray", S_BAR)} ` : "", n3 = i ? styleText2(["strikethrough", "dim"], i) : "";
1496
- return `${o2}${s}${n3}${i && e ? `
1054
+ const s = r ? `${styleText2("gray", S_BAR)} ` : "", n = i ? styleText2(["strikethrough", "dim"], i) : "";
1055
+ return `${o}${s}${n}${i && r ? `
1497
1056
  ${styleText2("gray", S_BAR)}` : ""}`;
1498
1057
  }
1499
1058
  default: {
1500
- const s = e ? `${styleText2("cyan", S_BAR)} ` : "", n3 = e ? styleText2("cyan", S_BAR_END) : "";
1501
- return `${o2}${s}${c2}
1502
- ${n3}
1059
+ const s = r ? `${styleText2("cyan", S_BAR)} ` : "", n = r ? styleText2("cyan", S_BAR_END) : "";
1060
+ return `${o}${s}${m}
1061
+ ${n}
1503
1062
  `;
1504
1063
  }
1505
1064
  }
1506
1065
  }
1507
1066
  }).prompt();
1508
- var W = (l2) => styleText2("magenta", l2);
1067
+ var W = (l) => styleText2("magenta", l);
1509
1068
  var spinner = ({
1510
- indicator: l2 = "dots",
1511
- onCancel: h2,
1512
- output: n3 = process.stdout,
1069
+ indicator: l = "dots",
1070
+ onCancel: h,
1071
+ output: n = process.stdout,
1513
1072
  cancelMessage: G,
1514
1073
  errorMessage: O,
1515
1074
  frames: E = unicode ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"],
1516
1075
  delay: F = unicode ? 80 : 120,
1517
- signal: m2,
1076
+ signal: m,
1518
1077
  ...I
1519
1078
  } = {}) => {
1520
- const u4 = isCI();
1521
- let M2, T3, d = false, S = false, s = "", p2, w = performance.now();
1522
- const x = getColumns(n3), k = I?.styleFrame ?? W, g2 = (e) => {
1523
- const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
1524
- S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
1525
- }, f2 = () => g2(2), i = () => g2(1), A = () => {
1526
- process.on("uncaughtExceptionMonitor", f2), process.on("unhandledRejection", f2), process.on("SIGINT", i), process.on("SIGTERM", i), process.on("exit", g2), m2 && m2.addEventListener("abort", i);
1079
+ const u = isCI();
1080
+ let M, T, d = false, S = false, s = "", p, w = performance.now();
1081
+ const x = getColumns(n), k = I?.styleFrame ?? W, g = (e) => {
1082
+ const r = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
1083
+ S = e === 1, d && (a(r, e), S && typeof h == "function" && h());
1084
+ }, f = () => g(2), i = () => g(1), A = () => {
1085
+ process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i), process.on("SIGTERM", i), process.on("exit", g), m && m.addEventListener("abort", i);
1527
1086
  }, H = () => {
1528
- process.removeListener("uncaughtExceptionMonitor", f2), process.removeListener("unhandledRejection", f2), process.removeListener("SIGINT", i), process.removeListener("SIGTERM", i), process.removeListener("exit", g2), m2 && m2.removeEventListener("abort", i);
1087
+ process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i), process.removeListener("SIGTERM", i), process.removeListener("exit", g), m && m.removeEventListener("abort", i);
1529
1088
  }, y = () => {
1530
- if (p2 === undefined)
1089
+ if (p === undefined)
1531
1090
  return;
1532
- u4 && n3.write(`
1091
+ u && n.write(`
1533
1092
  `);
1534
- const r2 = wrapAnsi(p2, x, {
1093
+ const r = wrapAnsi(p, x, {
1535
1094
  hard: true,
1536
1095
  trim: false
1537
1096
  }).split(`
1538
1097
  `);
1539
- r2.length > 1 && n3.write(import_sisteransi2.cursor.up(r2.length - 1)), n3.write(import_sisteransi2.cursor.to(0)), n3.write(import_sisteransi2.erase.down());
1540
- }, C2 = (e) => e.replace(/\.+$/, ""), _2 = (e) => {
1541
- const r2 = (performance.now() - e) / 1000, t2 = Math.floor(r2 / 60), o2 = Math.floor(r2 % 60);
1542
- return t2 > 0 ? `[${t2}m ${o2}s]` : `[${o2}s]`;
1543
- }, N = I.withGuide ?? settings.withGuide, P2 = (e = "") => {
1544
- d = true, M2 = block({ output: n3 }), s = C2(e), w = performance.now(), N && n3.write(`${styleText2("gray", S_BAR)}
1098
+ r.length > 1 && n.write(import_sisteransi2.cursor.up(r.length - 1)), n.write(import_sisteransi2.cursor.to(0)), n.write(import_sisteransi2.erase.down());
1099
+ }, C = (e) => e.replace(/\.+$/, ""), _ = (e) => {
1100
+ const r = (performance.now() - e) / 1000, t = Math.floor(r / 60), o = Math.floor(r % 60);
1101
+ return t > 0 ? `[${t}m ${o}s]` : `[${o}s]`;
1102
+ }, N = I.withGuide ?? settings.withGuide, P = (e = "") => {
1103
+ d = true, M = block({ output: n }), s = C(e), w = performance.now(), N && n.write(`${styleText2("gray", S_BAR)}
1545
1104
  `);
1546
- let r2 = 0, t2 = 0;
1547
- A(), T3 = setInterval(() => {
1548
- if (u4 && s === p2)
1105
+ let r = 0, t = 0;
1106
+ A(), T = setInterval(() => {
1107
+ if (u && s === p)
1549
1108
  return;
1550
- y(), p2 = s;
1551
- const o2 = k(E[r2]);
1109
+ y(), p = s;
1110
+ const o = k(E[r]);
1552
1111
  let v;
1553
- if (u4)
1554
- v = `${o2} ${s}...`;
1555
- else if (l2 === "timer")
1556
- v = `${o2} ${s} ${_2(w)}`;
1112
+ if (u)
1113
+ v = `${o} ${s}...`;
1114
+ else if (l === "timer")
1115
+ v = `${o} ${s} ${_(w)}`;
1557
1116
  else {
1558
- const B = ".".repeat(Math.floor(t2)).slice(0, 3);
1559
- v = `${o2} ${s}${B}`;
1117
+ const B = ".".repeat(Math.floor(t)).slice(0, 3);
1118
+ v = `${o} ${s}${B}`;
1560
1119
  }
1561
1120
  const j = wrapAnsi(v, x, {
1562
1121
  hard: true,
1563
1122
  trim: false
1564
1123
  });
1565
- n3.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
1124
+ n.write(j), r = r + 1 < E.length ? r + 1 : 0, t = t < 4 ? t + 0.125 : 0;
1566
1125
  }, F);
1567
- }, a2 = (e = "", r2 = 0, t2 = false) => {
1126
+ }, a = (e = "", r = 0, t = false) => {
1568
1127
  if (!d)
1569
1128
  return;
1570
- d = false, clearInterval(T3), y();
1571
- const o2 = r2 === 0 ? styleText2("green", S_STEP_SUBMIT) : r2 === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
1572
- s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o2} ${s} ${_2(w)}
1573
- `) : n3.write(`${o2} ${s}
1574
- `)), H(), M2();
1129
+ d = false, clearInterval(T), y();
1130
+ const o = r === 0 ? styleText2("green", S_STEP_SUBMIT) : r === 1 ? styleText2("red", S_STEP_CANCEL) : styleText2("red", S_STEP_ERROR);
1131
+ s = e ?? s, t || (l === "timer" ? n.write(`${o} ${s} ${_(w)}
1132
+ `) : n.write(`${o} ${s}
1133
+ `)), H(), M();
1575
1134
  };
1576
1135
  return {
1577
- start: P2,
1578
- stop: (e = "") => a2(e, 0),
1136
+ start: P,
1137
+ stop: (e = "") => a(e, 0),
1579
1138
  message: (e = "") => {
1580
- s = C2(e ?? s);
1139
+ s = C(e ?? s);
1581
1140
  },
1582
- cancel: (e = "") => a2(e, 1),
1583
- error: (e = "") => a2(e, 2),
1584
- clear: () => a2("", 0, true),
1141
+ cancel: (e = "") => a(e, 1),
1142
+ error: (e = "") => a(e, 2),
1143
+ clear: () => a("", 0, true),
1585
1144
  get isCancelled() {
1586
1145
  return S;
1587
1146
  }
1588
1147
  };
1589
1148
  };
1590
- var u4 = {
1149
+ var u2 = {
1591
1150
  light: unicodeOr("─", "-"),
1592
1151
  heavy: unicodeOr("━", "="),
1593
1152
  block: unicodeOr("█", "#")
1594
1153
  };
1595
1154
  function progress({
1596
- style: o2 = "heavy",
1155
+ style: o = "heavy",
1597
1156
  max: d = 100,
1598
1157
  size: v = 40,
1599
1158
  ...x
1600
1159
  } = {}) {
1601
- const r2 = spinner(x);
1602
- let a2 = 0, n3 = "";
1603
- const c2 = Math.max(1, d), l2 = Math.max(1, v), S = (t2) => {
1604
- switch (t2) {
1160
+ const r = spinner(x);
1161
+ let a = 0, n = "";
1162
+ const c = Math.max(1, d), l = Math.max(1, v), S = (t) => {
1163
+ switch (t) {
1605
1164
  case "initial":
1606
1165
  case "active":
1607
1166
  return (e) => styleText2("magenta", e);
@@ -1613,23 +1172,23 @@ function progress({
1613
1172
  default:
1614
1173
  return (e) => styleText2("magenta", e);
1615
1174
  }
1616
- }, p2 = (t2, e) => {
1617
- const m2 = Math.floor(a2 / c2 * l2);
1618
- return `${S(t2)(u4[o2].repeat(m2))}${styleText2("dim", u4[o2].repeat(l2 - m2))} ${e}`;
1619
- }, h2 = (t2 = "") => {
1620
- n3 = t2, r2.start(p2("initial", t2));
1621
- }, g2 = (t2 = 1, e) => {
1622
- a2 = Math.min(c2, t2 + a2), r2.message(p2("active", e ?? n3)), n3 = e ?? n3;
1175
+ }, p = (t, e) => {
1176
+ const m = Math.floor(a / c * l);
1177
+ return `${S(t)(u2[o].repeat(m))}${styleText2("dim", u2[o].repeat(l - m))} ${e}`;
1178
+ }, h = (t = "") => {
1179
+ n = t, r.start(p("initial", t));
1180
+ }, g = (t = 1, e) => {
1181
+ a = Math.min(c, t + a), r.message(p("active", e ?? n)), n = e ?? n;
1623
1182
  };
1624
1183
  return {
1625
- start: h2,
1626
- stop: r2.stop,
1627
- cancel: r2.cancel,
1628
- error: r2.error,
1629
- clear: r2.clear,
1630
- advance: g2,
1631
- isCancelled: r2.isCancelled,
1632
- message: (t2) => g2(0, t2)
1184
+ start: h,
1185
+ stop: r.stop,
1186
+ cancel: r.cancel,
1187
+ error: r.error,
1188
+ clear: r.clear,
1189
+ advance: g,
1190
+ isCancelled: r.isCancelled,
1191
+ message: (t) => g(0, t)
1633
1192
  };
1634
1193
  }
1635
1194
  var SELECT_INSTRUCTIONS = [
@@ -1637,39 +1196,45 @@ var SELECT_INSTRUCTIONS = [
1637
1196
  `${styleText2("dim", "Enter:")} confirm`
1638
1197
  ];
1639
1198
  var i = `${styleText2("gray", S_BAR)} `;
1640
- var text = (e) => new n2({
1641
- validate: e.validate,
1642
- placeholder: e.placeholder,
1643
- defaultValue: e.defaultValue,
1644
- initialValue: e.initialValue,
1645
- output: e.output,
1646
- signal: e.signal,
1647
- input: e.input,
1199
+ var text = (t) => new n({
1200
+ validate: t.validate,
1201
+ placeholder: t.placeholder,
1202
+ defaultValue: t.defaultValue,
1203
+ initialValue: t.initialValue,
1204
+ output: t.output,
1205
+ signal: t.signal,
1206
+ input: t.input,
1648
1207
  render() {
1649
- const i2 = e?.withGuide ?? settings.withGuide, s = `${`${i2 ? `${styleText2("gray", S_BAR)}
1650
- ` : ""}${symbol(this.state)} `}${e.message}
1651
- `, c2 = e.placeholder && e.placeholder.length > 0 ? styleText2("inverse", e.placeholder[0]) + styleText2("dim", e.placeholder.slice(1)) : styleText2(["inverse", "hidden"], "_"), o2 = this.userInput ? this.userInputWithCursor : c2, l2 = this.value ?? "";
1208
+ const r = t?.withGuide ?? settings.withGuide, l = `${`${r ? `${styleText2("gray", S_BAR)}
1209
+ ` : ""}${symbol(this.state)} `}${t.message}
1210
+ `, d = t.placeholder && t.placeholder.length > 0 ? styleText2("inverse", t.placeholder[0]) + styleText2("dim", t.placeholder.slice(1)) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
1652
1211
  switch (this.state) {
1212
+ case "validating": {
1213
+ const n = r ? `${styleText2("cyan", S_BAR)} ` : "", i = r ? styleText2("cyan", S_BAR_END) : "", c = styleText2("dim", o), $ = styleText2("dim", "Validating...");
1214
+ return `${l}${n}${c}
1215
+ ${i} ${$}
1216
+ `;
1217
+ }
1653
1218
  case "error": {
1654
- const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", r2 = i2 ? `${styleText2("yellow", S_BAR)} ` : "", d = i2 ? styleText2("yellow", S_BAR_END) : "";
1655
- return `${s.trim()}
1656
- ${r2}${o2}
1657
- ${d}${n3}
1219
+ const n = this.error ? ` ${styleText2("yellow", this.error)}` : "", i = r ? `${styleText2("yellow", S_BAR)} ` : "", c = r ? styleText2("yellow", S_BAR_END) : "";
1220
+ return `${l.trim()}
1221
+ ${i}${o}
1222
+ ${c}${n}
1658
1223
  `;
1659
1224
  }
1660
1225
  case "submit": {
1661
- const n3 = l2 ? ` ${styleText2("dim", l2)}` : "", r2 = i2 ? styleText2("gray", S_BAR) : "";
1662
- return `${s}${r2}${n3}`;
1226
+ const n = s ? `${r ? " " : ""}${styleText2("dim", s)}` : "", i = r ? styleText2("gray", S_BAR) : "";
1227
+ return `${l}${i}${n}`;
1663
1228
  }
1664
1229
  case "cancel": {
1665
- const n3 = l2 ? ` ${styleText2(["strikethrough", "dim"], l2)}` : "", r2 = i2 ? styleText2("gray", S_BAR) : "";
1666
- return `${s}${r2}${n3}${l2.trim() ? `
1667
- ${r2}` : ""}`;
1230
+ const n = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i = r ? styleText2("gray", S_BAR) : "";
1231
+ return `${l}${i}${n}${s.trim() ? `
1232
+ ${i}` : ""}`;
1668
1233
  }
1669
1234
  default: {
1670
- const n3 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", r2 = i2 ? styleText2("cyan", S_BAR_END) : "";
1671
- return `${s}${n3}${o2}
1672
- ${r2}
1235
+ const n = r ? `${styleText2("cyan", S_BAR)} ` : "", i = r ? styleText2("cyan", S_BAR_END) : "";
1236
+ return `${l}${n}${o}
1237
+ ${i}
1673
1238
  `;
1674
1239
  }
1675
1240
  }
@@ -1772,7 +1337,7 @@ function isUnicodeSupported2() {
1772
1337
  }
1773
1338
  var unicode2 = isUnicodeSupported2();
1774
1339
  var isCI2 = () => process.env.CI === "true";
1775
- var unicodeOr2 = (o2, e) => unicode2 ? o2 : e;
1340
+ var unicodeOr2 = (o, e) => unicode2 ? o : e;
1776
1341
  var S_STEP_ACTIVE2 = unicodeOr2("◆", "*");
1777
1342
  var S_STEP_CANCEL2 = unicodeOr2("■", "x");
1778
1343
  var S_STEP_ERROR2 = unicodeOr2("▲", "x");
@@ -1798,8 +1363,8 @@ var S_INFO2 = unicodeOr2("●", "•");
1798
1363
  var S_SUCCESS2 = unicodeOr2("◆", "*");
1799
1364
  var S_WARN2 = unicodeOr2("▲", "!");
1800
1365
  var S_ERROR2 = unicodeOr2("■", "x");
1801
- var symbol2 = (o2) => {
1802
- switch (o2) {
1366
+ var symbol2 = (o) => {
1367
+ switch (o) {
1803
1368
  case "initial":
1804
1369
  case "active":
1805
1370
  return styleText3("cyan", S_STEP_ACTIVE2);
@@ -1809,10 +1374,12 @@ var symbol2 = (o2) => {
1809
1374
  return styleText3("yellow", S_STEP_ERROR2);
1810
1375
  case "submit":
1811
1376
  return styleText3("green", S_STEP_SUBMIT2);
1377
+ case "validating":
1378
+ return styleText3("dim", S_STEP_ACTIVE2);
1812
1379
  }
1813
1380
  };
1814
- var symbolBar = (o2) => {
1815
- switch (o2) {
1381
+ var symbolBar = (o) => {
1382
+ switch (o) {
1816
1383
  case "initial":
1817
1384
  case "active":
1818
1385
  return styleText3("cyan", S_BAR2);
@@ -1824,94 +1391,94 @@ var symbolBar = (o2) => {
1824
1391
  return styleText3("green", S_BAR2);
1825
1392
  }
1826
1393
  };
1827
- function formatInstructionFooter(o2, e) {
1828
- const r2 = [`${e ? `${styleText3("cyan", S_BAR2)} ` : ""}${o2.join(" • ")}`];
1829
- return e && r2.push(styleText3("cyan", S_BAR_END2)), r2;
1830
- }
1831
- var I = (l2, e, w, p2, b2, C2 = false) => {
1832
- let r2 = e, O = 0;
1833
- if (C2)
1834
- for (let i2 = p2 - 1;i2 >= w; i2--) {
1835
- const m2 = l2[i2];
1836
- if (m2 && (r2 -= m2.length), O++, r2 <= b2)
1394
+ function formatInstructionFooter(o, e) {
1395
+ const r = [`${e ? `${styleText3("cyan", S_BAR2)} ` : ""}${o.join(" • ")}`];
1396
+ return e && r.push(styleText3("cyan", S_BAR_END2)), r;
1397
+ }
1398
+ var I = (l, e, w, p, b, C = false) => {
1399
+ let r = e, O = 0;
1400
+ if (C)
1401
+ for (let i = p - 1;i >= w; i--) {
1402
+ const m = l[i];
1403
+ if (m && (r -= m.length), O++, r <= b)
1837
1404
  break;
1838
1405
  }
1839
1406
  else
1840
- for (let i2 = w;i2 < p2; i2++) {
1841
- const m2 = l2[i2];
1842
- if (m2 && (r2 -= m2.length), O++, r2 <= b2)
1407
+ for (let i = w;i < p; i++) {
1408
+ const m = l[i];
1409
+ if (m && (r -= m.length), O++, r <= b)
1843
1410
  break;
1844
1411
  }
1845
- return { lineCount: r2, removals: O };
1412
+ return { lineCount: r, removals: O };
1846
1413
  };
1847
1414
  var limitOptions = ({
1848
- cursor: l2,
1415
+ cursor: l,
1849
1416
  options: e,
1850
1417
  style: w,
1851
- output: p2 = process.stdout,
1852
- maxItems: b2 = Number.POSITIVE_INFINITY,
1853
- columnPadding: C2 = 0,
1854
- rowPadding: r2 = 4
1418
+ output: p = process.stdout,
1419
+ maxItems: b = Number.POSITIVE_INFINITY,
1420
+ columnPadding: C = 0,
1421
+ rowPadding: r = 4
1855
1422
  }) => {
1856
- const i2 = getColumns(p2) - C2, m2 = getRows(p2), M2 = styleText3("dim", "..."), v = Math.max(m2 - r2, 0), a2 = Math.max(Math.min(b2, v), 5);
1857
- let f2 = 0;
1858
- l2 >= a2 - 3 && (f2 = Math.max(Math.min(l2 - a2 + 3, e.length - a2), 0));
1859
- let d = a2 < e.length && f2 > 0, c2 = a2 < e.length && f2 + a2 < e.length;
1860
- const W2 = Math.min(f2 + a2, e.length), s = [];
1861
- let g2 = 0;
1862
- d && g2++, c2 && g2++;
1863
- const T3 = f2 + (d ? 1 : 0), y = W2 - (c2 ? 1 : 0);
1864
- for (let t2 = T3;t2 < y; t2++) {
1865
- const n3 = e[t2], o2 = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o2, i2, {
1423
+ const i = getColumns(p) - C, m = getRows(p), M = styleText3("dim", "..."), v = Math.max(m - r, 0), a = Math.max(Math.min(b, v), 5);
1424
+ let f = 0;
1425
+ l >= a - 3 && (f = Math.max(Math.min(l - a + 3, e.length - a), 0));
1426
+ let d = a < e.length && f > 0, c = a < e.length && f + a < e.length;
1427
+ const W = Math.min(f + a, e.length), s = [];
1428
+ let g = 0;
1429
+ d && g++, c && g++;
1430
+ const T = f + (d ? 1 : 0), y = W - (c ? 1 : 0);
1431
+ for (let t = T;t < y; t++) {
1432
+ const n = e[t], o = n ? w(n, t === l) : "", h = wrapAnsi(o, i, {
1866
1433
  hard: true,
1867
1434
  trim: false
1868
1435
  }).split(`
1869
1436
  `);
1870
- s.push(h2), g2 += h2.length;
1437
+ s.push(h), g += h.length;
1871
1438
  }
1872
- if (g2 > v) {
1873
- let t2 = 0, n3 = 0, o2 = g2;
1874
- const h2 = l2 - T3;
1875
- let u5 = v;
1876
- const L = () => I(s, o2, 0, h2, u5), E = () => I(s, o2, h2 + 1, s.length, u5, true);
1877
- d ? ({ lineCount: o2, removals: t2 } = L(), o2 > u5 && (c2 || (u5 -= 1), { lineCount: o2, removals: n3 } = E())) : (c2 || (u5 -= 1), { lineCount: o2, removals: n3 } = E(), o2 > u5 && (u5 -= 1, { lineCount: o2, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c2 = true, s.splice(s.length - n3, n3));
1439
+ if (g > v) {
1440
+ let t = 0, n = 0, o = g;
1441
+ const h = l - T;
1442
+ let u = v;
1443
+ const L = () => I(s, o, 0, h, u), E = () => I(s, o, h + 1, s.length, u, true);
1444
+ d ? ({ lineCount: o, removals: t } = L(), o > u && (c || (u -= 1), { lineCount: o, removals: n } = E())) : (c || (u -= 1), { lineCount: o, removals: n } = E(), o > u && (u -= 1, { lineCount: o, removals: t } = L())), t > 0 && (d = true, s.splice(0, t)), n > 0 && (c = true, s.splice(s.length - n, n));
1878
1445
  }
1879
1446
  const x = [];
1880
- d && x.push(M2);
1881
- for (const t2 of s)
1882
- for (const n3 of t2)
1883
- x.push(n3);
1884
- return c2 && x.push(M2), x;
1447
+ d && x.push(M);
1448
+ for (const t of s)
1449
+ for (const n of t)
1450
+ x.push(n);
1451
+ return c && x.push(M), x;
1885
1452
  };
1886
- var confirm2 = (i2) => {
1887
- const a2 = i2.active ?? "Yes", s = i2.inactive ?? "No";
1453
+ var confirm2 = (e) => {
1454
+ const a = e.active ?? "Yes", o = e.inactive ?? "No";
1888
1455
  return new r({
1889
- active: a2,
1890
- inactive: s,
1891
- signal: i2.signal,
1892
- input: i2.input,
1893
- output: i2.output,
1894
- initialValue: i2.initialValue ?? true,
1456
+ active: a,
1457
+ inactive: o,
1458
+ signal: e.signal,
1459
+ input: e.input,
1460
+ output: e.output,
1461
+ initialValue: e.initialValue ?? true,
1895
1462
  render() {
1896
- const e = i2.withGuide ?? settings.withGuide, u5 = `${symbol2(this.state)} `, l2 = e ? `${styleText3("gray", S_BAR2)} ` : "", f2 = wrapTextWithPrefix(i2.output, i2.message, l2, u5), o2 = `${e ? `${styleText3("gray", S_BAR2)}
1897
- ` : ""}${f2}
1898
- `, c2 = this.value ? a2 : s;
1463
+ const i = e.withGuide ?? settings.withGuide, u = `${symbol2(this.state)} `, l = i ? `${styleText3("gray", S_BAR2)} ` : "", f = wrapTextWithPrefix(e.output, e.message, l, u), s = `${i ? `${styleText3("gray", S_BAR2)}
1464
+ ` : ""}${f}
1465
+ `, c = this.value ? a : o;
1899
1466
  switch (this.state) {
1900
1467
  case "submit": {
1901
- const r2 = e ? `${styleText3("gray", S_BAR2)} ` : "";
1902
- return `${o2}${r2}${styleText3("dim", c2)}`;
1468
+ const r = i ? `${styleText3("gray", S_BAR2)} ` : "";
1469
+ return `${s}${r}${styleText3("dim", c)}`;
1903
1470
  }
1904
1471
  case "cancel": {
1905
- const r2 = e ? `${styleText3("gray", S_BAR2)} ` : "";
1906
- return `${o2}${r2}${styleText3(["strikethrough", "dim"], c2)}${e ? `
1472
+ const r = i ? `${styleText3("gray", S_BAR2)} ` : "";
1473
+ return `${s}${r}${styleText3(["strikethrough", "dim"], c)}${i ? `
1907
1474
  ${styleText3("gray", S_BAR2)}` : ""}`;
1908
1475
  }
1909
1476
  default: {
1910
- const r2 = e ? `${styleText3("cyan", S_BAR2)} ` : "", g2 = e ? styleText3("cyan", S_BAR_END2) : "";
1911
- return `${o2}${r2}${this.value ? `${styleText3("green", S_RADIO_ACTIVE2)} ${a2}` : `${styleText3("dim", S_RADIO_INACTIVE2)} ${styleText3("dim", a2)}`}${i2.vertical ? e ? `
1477
+ const r = i ? `${styleText3("cyan", S_BAR2)} ` : "", g = i ? styleText3("cyan", S_BAR_END2) : "";
1478
+ return `${s}${r}${this.value ? `${styleText3("green", S_RADIO_ACTIVE2)} ${a}` : `${styleText3("dim", S_RADIO_INACTIVE2)} ${styleText3("dim", a)}`}${e.vertical ? i ? `
1912
1479
  ${styleText3("cyan", S_BAR2)} ` : `
1913
- ` : ` ${styleText3("dim", "/")} `}${this.value ? `${styleText3("dim", S_RADIO_INACTIVE2)} ${styleText3("dim", s)}` : `${styleText3("green", S_RADIO_ACTIVE2)} ${s}`}
1914
- ${g2}
1480
+ ` : ` ${styleText3("dim", "/")} `}${this.value ? `${styleText3("dim", S_RADIO_INACTIVE2)} ${styleText3("dim", o)}` : `${styleText3("green", S_RADIO_ACTIVE2)} ${o}`}
1481
+ ${g}
1915
1482
  `;
1916
1483
  }
1917
1484
  }
@@ -1923,83 +1490,83 @@ var MULTISELECT_INSTRUCTIONS2 = [
1923
1490
  `${styleText3("dim", "Space:")} select`,
1924
1491
  `${styleText3("dim", "Enter:")} confirm`
1925
1492
  ];
1926
- var m2 = (i2, u5) => i2.split(`
1927
- `).map((d) => u5(d)).join(`
1493
+ var m = (i, u) => i.split(`
1494
+ `).map((d) => u(d)).join(`
1928
1495
  `);
1929
- var multiselect = (i2) => {
1930
- const u5 = (t2, a2) => {
1931
- const r2 = t2.label ?? String(t2.value);
1932
- return a2 === "disabled" ? `${styleText3("gray", S_CHECKBOX_INACTIVE2)} ${m2(r2, (o2) => styleText3(["strikethrough", "gray"], o2))}${t2.hint ? ` ${styleText3("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${styleText3("cyan", S_CHECKBOX_ACTIVE2)} ${r2}${t2.hint ? ` ${styleText3("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${styleText3("green", S_CHECKBOX_SELECTED2)} ${m2(r2, (o2) => styleText3("dim", o2))}${t2.hint ? ` ${styleText3("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m2(r2, (o2) => styleText3(["strikethrough", "dim"], o2))}` : a2 === "active-selected" ? `${styleText3("green", S_CHECKBOX_SELECTED2)} ${r2}${t2.hint ? ` ${styleText3("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m2(r2, (o2) => styleText3("dim", o2))}` : `${styleText3("dim", S_CHECKBOX_INACTIVE2)} ${m2(r2, (o2) => styleText3("dim", o2))}`;
1933
- }, d = i2.required ?? true, v = i2.showInstructions ?? true;
1496
+ var multiselect = (i) => {
1497
+ const u = (t, a) => {
1498
+ const r = t.label ?? String(t.value);
1499
+ return a === "disabled" ? `${styleText3("gray", S_CHECKBOX_INACTIVE2)} ${m(r, (o) => styleText3(["strikethrough", "gray"], o))}${t.hint ? ` ${styleText3("dim", `(${t.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${styleText3("cyan", S_CHECKBOX_ACTIVE2)} ${r}${t.hint ? ` ${styleText3("dim", `(${t.hint})`)}` : ""}` : a === "selected" ? `${styleText3("green", S_CHECKBOX_SELECTED2)} ${m(r, (o) => styleText3("dim", o))}${t.hint ? ` ${styleText3("dim", `(${t.hint})`)}` : ""}` : a === "cancelled" ? `${m(r, (o) => styleText3(["strikethrough", "dim"], o))}` : a === "active-selected" ? `${styleText3("green", S_CHECKBOX_SELECTED2)} ${r}${t.hint ? ` ${styleText3("dim", `(${t.hint})`)}` : ""}` : a === "submitted" ? `${m(r, (o) => styleText3("dim", o))}` : `${styleText3("dim", S_CHECKBOX_INACTIVE2)} ${m(r, (o) => styleText3("dim", o))}`;
1500
+ }, d = i.required ?? true, x = i.showInstructions ?? true;
1934
1501
  return new a({
1935
- options: i2.options,
1936
- signal: i2.signal,
1937
- input: i2.input,
1938
- output: i2.output,
1939
- initialValues: i2.initialValues,
1502
+ options: i.options,
1503
+ signal: i.signal,
1504
+ input: i.input,
1505
+ output: i.output,
1506
+ initialValues: i.initialValues,
1940
1507
  required: d,
1941
- cursorAt: i2.cursorAt,
1942
- validate(t2) {
1943
- if (d && (t2 === undefined || t2.length === 0))
1508
+ cursorAt: i.cursorAt,
1509
+ validate(t) {
1510
+ if (d && (t === undefined || t.length === 0))
1944
1511
  return `Please select at least one option.
1945
1512
  ${styleText3("reset", styleText3("dim", `Press ${styleText3(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText3("gray", styleText3("bgWhite", styleText3("inverse", " enter ")))} to submit`))}`;
1946
1513
  },
1947
1514
  render() {
1948
- const t2 = i2.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(i2.output, i2.message, t2 ? `${symbolBar(this.state)} ` : "", `${symbol2(this.state)} `), r2 = `${t2 ? `${styleText3("gray", S_BAR2)}
1949
- ` : ""}${a2}
1950
- `, o2 = this.value ?? [], p2 = (n3, l2) => {
1951
- if (n3.disabled)
1952
- return u5(n3, "disabled");
1953
- const s = o2.includes(n3.value);
1954
- return l2 && s ? u5(n3, "active-selected") : s ? u5(n3, "selected") : u5(n3, l2 ? "active" : "inactive");
1515
+ const t = i.withGuide ?? settings.withGuide, a = wrapTextWithPrefix(i.output, i.message, t ? `${symbolBar(this.state)} ` : "", `${symbol2(this.state)} `), r = `${t ? `${styleText3("gray", S_BAR2)}
1516
+ ` : ""}${a}
1517
+ `, o = this.value ?? [], g = (n, l) => {
1518
+ if (n.disabled)
1519
+ return u(n, "disabled");
1520
+ const s = o.includes(n.value);
1521
+ return l && s ? u(n, "active-selected") : s ? u(n, "selected") : u(n, l ? "active" : "inactive");
1955
1522
  };
1956
1523
  switch (this.state) {
1957
1524
  case "submit": {
1958
- const n3 = this.options.filter(({ value: s }) => o2.includes(s)).map((s) => u5(s, "submitted")).join(styleText3("dim", ", ")) || styleText3("dim", "none"), l2 = wrapTextWithPrefix(i2.output, n3, t2 ? `${styleText3("gray", S_BAR2)} ` : "");
1959
- return `${r2}${l2}`;
1525
+ const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "submitted")).join(styleText3("dim", ", ")) || styleText3("dim", "none"), l = wrapTextWithPrefix(i.output, n, t ? `${styleText3("gray", S_BAR2)} ` : "");
1526
+ return `${r}${l}`;
1960
1527
  }
1961
1528
  case "cancel": {
1962
- const n3 = this.options.filter(({ value: s }) => o2.includes(s)).map((s) => u5(s, "cancelled")).join(styleText3("dim", ", "));
1963
- if (n3.trim() === "")
1964
- return `${r2}${styleText3("gray", S_BAR2)}`;
1965
- const l2 = wrapTextWithPrefix(i2.output, n3, t2 ? `${styleText3("gray", S_BAR2)} ` : "");
1966
- return `${r2}${l2}${t2 ? `
1529
+ const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "cancelled")).join(styleText3("dim", ", "));
1530
+ if (n.trim() === "")
1531
+ return `${r}${styleText3("gray", S_BAR2)}`;
1532
+ const l = wrapTextWithPrefix(i.output, n, t ? `${styleText3("gray", S_BAR2)} ` : "");
1533
+ return `${r}${l}${t ? `
1967
1534
  ${styleText3("gray", S_BAR2)}` : ""}`;
1968
1535
  }
1969
1536
  case "error": {
1970
- const n3 = t2 ? `${styleText3("yellow", S_BAR2)} ` : "", l2 = this.error.split(`
1971
- `).map(($, C2) => C2 === 0 ? `${t2 ? `${styleText3("yellow", S_BAR_END2)} ` : ""}${styleText3("yellow", $)}` : ` ${$}`).join(`
1972
- `), s = r2.split(`
1973
- `).length, h2 = l2.split(`
1537
+ const n = t ? `${styleText3("yellow", S_BAR2)} ` : "", l = this.error.split(`
1538
+ `).map(($, v) => v === 0 ? `${t ? `${styleText3("yellow", S_BAR_END2)} ` : ""}${styleText3("yellow", $)}` : ` ${$}`).join(`
1539
+ `), s = r.split(`
1540
+ `).length, h = l.split(`
1974
1541
  `).length + 1;
1975
- return `${r2}${n3}${limitOptions({
1976
- output: i2.output,
1542
+ return `${r}${n}${limitOptions({
1543
+ output: i.output,
1977
1544
  options: this.options,
1978
1545
  cursor: this.cursor,
1979
- maxItems: i2.maxItems,
1980
- columnPadding: n3.length,
1981
- rowPadding: s + h2,
1982
- style: p2
1546
+ maxItems: i.maxItems,
1547
+ columnPadding: n.length,
1548
+ rowPadding: s + h,
1549
+ style: g
1983
1550
  }).join(`
1984
- ${n3}`)}
1985
- ${l2}
1551
+ ${n}`)}
1552
+ ${l}
1986
1553
  `;
1987
1554
  }
1988
1555
  default: {
1989
- const n3 = t2 ? `${styleText3("cyan", S_BAR2)} ` : "", l2 = r2.split(`
1990
- `).length, s = v ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS2, t2) : t2 ? [styleText3("cyan", S_BAR_END2)] : [], h2 = s.join(`
1556
+ const n = t ? `${styleText3("cyan", S_BAR2)} ` : "", l = r.split(`
1557
+ `).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS2, t) : t ? [styleText3("cyan", S_BAR_END2)] : [], h = s.join(`
1991
1558
  `), $ = s.length + 1;
1992
- return `${r2}${n3}${limitOptions({
1993
- output: i2.output,
1559
+ return `${r}${n}${limitOptions({
1560
+ output: i.output,
1994
1561
  options: this.options,
1995
1562
  cursor: this.cursor,
1996
- maxItems: i2.maxItems,
1997
- columnPadding: n3.length,
1998
- rowPadding: l2 + $,
1999
- style: p2
1563
+ maxItems: i.maxItems,
1564
+ columnPadding: n.length,
1565
+ rowPadding: l + $,
1566
+ style: g
2000
1567
  }).join(`
2001
- ${n3}`)}
2002
- ${h2}
1568
+ ${n}`)}
1569
+ ${h}
2003
1570
  `;
2004
1571
  }
2005
1572
  }
@@ -2009,23 +1576,23 @@ ${h2}
2009
1576
  var log2 = {
2010
1577
  message: (s = [], {
2011
1578
  symbol: e = styleText3("gray", S_BAR2),
2012
- secondarySymbol: r2 = styleText3("gray", S_BAR2),
2013
- output: m3 = process.stdout,
2014
- spacing: l2 = 1,
2015
- withGuide: c2
1579
+ secondarySymbol: r = styleText3("gray", S_BAR2),
1580
+ output: m = process.stdout,
1581
+ spacing: l = 1,
1582
+ withGuide: c
2016
1583
  } = {}) => {
2017
- const t2 = [], o2 = c2 ?? settings.withGuide, f2 = o2 ? r2 : "", O = o2 ? `${e} ` : "", u5 = o2 ? `${r2} ` : "";
2018
- for (let i2 = 0;i2 < l2; i2++)
2019
- t2.push(f2);
2020
- const g2 = Array.isArray(s) ? s : s.split(`
1584
+ const t = [], o = c ?? settings.withGuide, f = o ? r : "", O = o ? `${e} ` : "", u = o ? `${r} ` : "";
1585
+ for (let i = 0;i < l; i++)
1586
+ t.push(f);
1587
+ const g = Array.isArray(s) ? s : s.split(`
2021
1588
  `);
2022
- if (g2.length > 0) {
2023
- const [i2, ...y] = g2;
2024
- i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o2 ? e : "");
2025
- for (const p2 of y)
2026
- p2.length > 0 ? t2.push(`${u5}${p2}`) : t2.push(o2 ? r2 : "");
1589
+ if (g.length > 0) {
1590
+ const [i, ...y] = g;
1591
+ i.length > 0 ? t.push(`${O}${i}`) : t.push(o ? e : "");
1592
+ for (const p of y)
1593
+ p.length > 0 ? t.push(`${u}${p}`) : t.push(o ? r : "");
2027
1594
  }
2028
- m3.write(`${t2.join(`
1595
+ m.write(`${t.join(`
2029
1596
  `)}
2030
1597
  `);
2031
1598
  },
@@ -2048,107 +1615,107 @@ var log2 = {
2048
1615
  log2.message(s, { ...e, symbol: styleText3("red", S_ERROR2) });
2049
1616
  }
2050
1617
  };
2051
- var cancel2 = (o2 = "", t2) => {
2052
- const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText3("gray", S_BAR_END2)} ` : "";
2053
- i2.write(`${e}${styleText3("red", o2)}
1618
+ var cancel2 = (o = "", t) => {
1619
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText3("gray", S_BAR_END2)} ` : "";
1620
+ i.write(`${e}${styleText3("red", o)}
2054
1621
 
2055
1622
  `);
2056
1623
  };
2057
- var intro2 = (o2 = "", t2) => {
2058
- const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText3("gray", S_BAR_START2)} ` : "";
2059
- i2.write(`${e}${o2}
1624
+ var intro2 = (o = "", t) => {
1625
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText3("gray", S_BAR_START2)} ` : "";
1626
+ i.write(`${e}${o}
2060
1627
  `);
2061
1628
  };
2062
- var outro2 = (o2 = "", t2) => {
2063
- const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText3("gray", S_BAR2)}
1629
+ var outro2 = (o = "", t) => {
1630
+ const i = t?.output ?? process.stdout, e = t?.withGuide ?? settings.withGuide ? `${styleText3("gray", S_BAR2)}
2064
1631
  ${styleText3("gray", S_BAR_END2)} ` : "";
2065
- i2.write(`${e}${o2}
1632
+ i.write(`${e}${o}
2066
1633
 
2067
1634
  `);
2068
1635
  };
2069
- var W2 = (l2) => styleText3("magenta", l2);
1636
+ var W2 = (l) => styleText3("magenta", l);
2070
1637
  var spinner2 = ({
2071
- indicator: l2 = "dots",
2072
- onCancel: h2,
2073
- output: n3 = process.stdout,
1638
+ indicator: l = "dots",
1639
+ onCancel: h,
1640
+ output: n = process.stdout,
2074
1641
  cancelMessage: G,
2075
1642
  errorMessage: O,
2076
1643
  frames: E = unicode2 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"],
2077
1644
  delay: F = unicode2 ? 80 : 120,
2078
- signal: m3,
2079
- ...I2
1645
+ signal: m,
1646
+ ...I
2080
1647
  } = {}) => {
2081
- const u5 = isCI2();
2082
- let M2, T3, d = false, S = false, s = "", p2, w = performance.now();
2083
- const x = getColumns(n3), k = I2?.styleFrame ?? W2, g2 = (e) => {
2084
- const r2 = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
2085
- S = e === 1, d && (a2(r2, e), S && typeof h2 == "function" && h2());
2086
- }, f2 = () => g2(2), i2 = () => g2(1), A = () => {
2087
- process.on("uncaughtExceptionMonitor", f2), process.on("unhandledRejection", f2), process.on("SIGINT", i2), process.on("SIGTERM", i2), process.on("exit", g2), m3 && m3.addEventListener("abort", i2);
1648
+ const u = isCI2();
1649
+ let M, T, d = false, S = false, s = "", p, w = performance.now();
1650
+ const x = getColumns(n), k = I?.styleFrame ?? W2, g = (e) => {
1651
+ const r = e > 1 ? O ?? settings.messages.error : G ?? settings.messages.cancel;
1652
+ S = e === 1, d && (a(r, e), S && typeof h == "function" && h());
1653
+ }, f = () => g(2), i = () => g(1), A = () => {
1654
+ process.on("uncaughtExceptionMonitor", f), process.on("unhandledRejection", f), process.on("SIGINT", i), process.on("SIGTERM", i), process.on("exit", g), m && m.addEventListener("abort", i);
2088
1655
  }, H = () => {
2089
- process.removeListener("uncaughtExceptionMonitor", f2), process.removeListener("unhandledRejection", f2), process.removeListener("SIGINT", i2), process.removeListener("SIGTERM", i2), process.removeListener("exit", g2), m3 && m3.removeEventListener("abort", i2);
1656
+ process.removeListener("uncaughtExceptionMonitor", f), process.removeListener("unhandledRejection", f), process.removeListener("SIGINT", i), process.removeListener("SIGTERM", i), process.removeListener("exit", g), m && m.removeEventListener("abort", i);
2090
1657
  }, y = () => {
2091
- if (p2 === undefined)
1658
+ if (p === undefined)
2092
1659
  return;
2093
- u5 && n3.write(`
1660
+ u && n.write(`
2094
1661
  `);
2095
- const r2 = wrapAnsi(p2, x, {
1662
+ const r = wrapAnsi(p, x, {
2096
1663
  hard: true,
2097
1664
  trim: false
2098
1665
  }).split(`
2099
1666
  `);
2100
- r2.length > 1 && n3.write(import_sisteransi3.cursor.up(r2.length - 1)), n3.write(import_sisteransi3.cursor.to(0)), n3.write(import_sisteransi3.erase.down());
2101
- }, C2 = (e) => e.replace(/\.+$/, ""), _2 = (e) => {
2102
- const r2 = (performance.now() - e) / 1000, t2 = Math.floor(r2 / 60), o2 = Math.floor(r2 % 60);
2103
- return t2 > 0 ? `[${t2}m ${o2}s]` : `[${o2}s]`;
2104
- }, N = I2.withGuide ?? settings.withGuide, P2 = (e = "") => {
2105
- d = true, M2 = block({ output: n3 }), s = C2(e), w = performance.now(), N && n3.write(`${styleText3("gray", S_BAR2)}
1667
+ r.length > 1 && n.write(import_sisteransi3.cursor.up(r.length - 1)), n.write(import_sisteransi3.cursor.to(0)), n.write(import_sisteransi3.erase.down());
1668
+ }, C = (e) => e.replace(/\.+$/, ""), _ = (e) => {
1669
+ const r = (performance.now() - e) / 1000, t = Math.floor(r / 60), o = Math.floor(r % 60);
1670
+ return t > 0 ? `[${t}m ${o}s]` : `[${o}s]`;
1671
+ }, N = I.withGuide ?? settings.withGuide, P = (e = "") => {
1672
+ d = true, M = block({ output: n }), s = C(e), w = performance.now(), N && n.write(`${styleText3("gray", S_BAR2)}
2106
1673
  `);
2107
- let r2 = 0, t2 = 0;
2108
- A(), T3 = setInterval(() => {
2109
- if (u5 && s === p2)
1674
+ let r = 0, t = 0;
1675
+ A(), T = setInterval(() => {
1676
+ if (u && s === p)
2110
1677
  return;
2111
- y(), p2 = s;
2112
- const o2 = k(E[r2]);
1678
+ y(), p = s;
1679
+ const o = k(E[r]);
2113
1680
  let v;
2114
- if (u5)
2115
- v = `${o2} ${s}...`;
2116
- else if (l2 === "timer")
2117
- v = `${o2} ${s} ${_2(w)}`;
1681
+ if (u)
1682
+ v = `${o} ${s}...`;
1683
+ else if (l === "timer")
1684
+ v = `${o} ${s} ${_(w)}`;
2118
1685
  else {
2119
- const B = ".".repeat(Math.floor(t2)).slice(0, 3);
2120
- v = `${o2} ${s}${B}`;
1686
+ const B = ".".repeat(Math.floor(t)).slice(0, 3);
1687
+ v = `${o} ${s}${B}`;
2121
1688
  }
2122
1689
  const j = wrapAnsi(v, x, {
2123
1690
  hard: true,
2124
1691
  trim: false
2125
1692
  });
2126
- n3.write(j), r2 = r2 + 1 < E.length ? r2 + 1 : 0, t2 = t2 < 4 ? t2 + 0.125 : 0;
1693
+ n.write(j), r = r + 1 < E.length ? r + 1 : 0, t = t < 4 ? t + 0.125 : 0;
2127
1694
  }, F);
2128
- }, a2 = (e = "", r2 = 0, t2 = false) => {
1695
+ }, a = (e = "", r = 0, t = false) => {
2129
1696
  if (!d)
2130
1697
  return;
2131
- d = false, clearInterval(T3), y();
2132
- const o2 = r2 === 0 ? styleText3("green", S_STEP_SUBMIT2) : r2 === 1 ? styleText3("red", S_STEP_CANCEL2) : styleText3("red", S_STEP_ERROR2);
2133
- s = e ?? s, t2 || (l2 === "timer" ? n3.write(`${o2} ${s} ${_2(w)}
2134
- `) : n3.write(`${o2} ${s}
2135
- `)), H(), M2();
1698
+ d = false, clearInterval(T), y();
1699
+ const o = r === 0 ? styleText3("green", S_STEP_SUBMIT2) : r === 1 ? styleText3("red", S_STEP_CANCEL2) : styleText3("red", S_STEP_ERROR2);
1700
+ s = e ?? s, t || (l === "timer" ? n.write(`${o} ${s} ${_(w)}
1701
+ `) : n.write(`${o} ${s}
1702
+ `)), H(), M();
2136
1703
  };
2137
1704
  return {
2138
- start: P2,
2139
- stop: (e = "") => a2(e, 0),
1705
+ start: P,
1706
+ stop: (e = "") => a(e, 0),
2140
1707
  message: (e = "") => {
2141
- s = C2(e ?? s);
1708
+ s = C(e ?? s);
2142
1709
  },
2143
- cancel: (e = "") => a2(e, 1),
2144
- error: (e = "") => a2(e, 2),
2145
- clear: () => a2("", 0, true),
1710
+ cancel: (e = "") => a(e, 1),
1711
+ error: (e = "") => a(e, 2),
1712
+ clear: () => a("", 0, true),
2146
1713
  get isCancelled() {
2147
1714
  return S;
2148
1715
  }
2149
1716
  };
2150
1717
  };
2151
- var u5 = {
1718
+ var u3 = {
2152
1719
  light: unicodeOr2("─", "-"),
2153
1720
  heavy: unicodeOr2("━", "="),
2154
1721
  block: unicodeOr2("█", "#")
@@ -2157,63 +1724,63 @@ var SELECT_INSTRUCTIONS2 = [
2157
1724
  `${styleText3("dim", "↑/↓")} to navigate`,
2158
1725
  `${styleText3("dim", "Enter:")} confirm`
2159
1726
  ];
2160
- var c2 = (t2, o2) => t2.includes(`
2161
- `) ? t2.split(`
2162
- `).map((d) => o2(d)).join(`
2163
- `) : o2(t2);
2164
- var select = (t2) => {
2165
- const o2 = (n3, m3) => {
2166
- if (n3 === undefined)
1727
+ var c = (t, o) => t.includes(`
1728
+ `) ? t.split(`
1729
+ `).map((d) => o(d)).join(`
1730
+ `) : o(t);
1731
+ var select = (t) => {
1732
+ const o = (n, m) => {
1733
+ if (n === undefined)
2167
1734
  return "";
2168
- const s = n3.label ?? String(n3.value);
2169
- switch (m3) {
1735
+ const s = n.label ?? String(n.value);
1736
+ switch (m) {
2170
1737
  case "disabled":
2171
- return `${styleText3("gray", S_RADIO_INACTIVE2)} ${c2(s, (i2) => styleText3("gray", i2))}${n3.hint ? ` ${styleText3("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
1738
+ return `${styleText3("gray", S_RADIO_INACTIVE2)} ${c(s, (i) => styleText3("gray", i))}${n.hint ? ` ${styleText3("dim", `(${n.hint ?? "disabled"})`)}` : ""}`;
2172
1739
  case "selected":
2173
- return `${c2(s, (i2) => styleText3("dim", i2))}`;
1740
+ return `${c(s, (i) => styleText3("dim", i))}`;
2174
1741
  case "active":
2175
- return `${styleText3("green", S_RADIO_ACTIVE2)} ${s}${n3.hint ? ` ${styleText3("dim", `(${n3.hint})`)}` : ""}`;
1742
+ return `${styleText3("green", S_RADIO_ACTIVE2)} ${s}${n.hint ? ` ${styleText3("dim", `(${n.hint})`)}` : ""}`;
2176
1743
  case "cancelled":
2177
- return `${c2(s, (i2) => styleText3(["strikethrough", "dim"], i2))}`;
1744
+ return `${c(s, (i) => styleText3(["strikethrough", "dim"], i))}`;
2178
1745
  default:
2179
- return `${styleText3("dim", S_RADIO_INACTIVE2)} ${c2(s, (i2) => styleText3("dim", i2))}`;
1746
+ return `${styleText3("dim", S_RADIO_INACTIVE2)} ${c(s, (i) => styleText3("dim", i))}`;
2180
1747
  }
2181
- }, d = t2.showInstructions ?? true;
1748
+ }, d = t.showInstructions ?? true;
2182
1749
  return new n$1({
2183
- options: t2.options,
2184
- signal: t2.signal,
2185
- input: t2.input,
2186
- output: t2.output,
2187
- initialValue: t2.initialValue,
1750
+ options: t.options,
1751
+ signal: t.signal,
1752
+ input: t.input,
1753
+ output: t.output,
1754
+ initialValue: t.initialValue,
2188
1755
  render() {
2189
- const n3 = t2.withGuide ?? settings.withGuide, m3 = `${symbol2(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(t2.output, t2.message, s, m3), u6 = `${n3 ? `${styleText3("gray", S_BAR2)}
2190
- ` : ""}${i2}
1756
+ const n = t.withGuide ?? settings.withGuide, m = `${symbol2(this.state)} `, s = `${symbolBar(this.state)} `, i = wrapTextWithPrefix(t.output, t.message, s, m), u = `${n ? `${styleText3("gray", S_BAR2)}
1757
+ ` : ""}${i}
2191
1758
  `;
2192
1759
  switch (this.state) {
2193
1760
  case "submit": {
2194
- const r2 = n3 ? `${styleText3("gray", S_BAR2)} ` : "", a2 = wrapTextWithPrefix(t2.output, o2(this.options[this.cursor], "selected"), r2);
2195
- return `${u6}${a2}`;
1761
+ const r = n ? `${styleText3("gray", S_BAR2)} ` : "", a = wrapTextWithPrefix(t.output, o(this.options[this.cursor], "selected"), r);
1762
+ return `${u}${a}`;
2196
1763
  }
2197
1764
  case "cancel": {
2198
- const r2 = n3 ? `${styleText3("gray", S_BAR2)} ` : "", a2 = wrapTextWithPrefix(t2.output, o2(this.options[this.cursor], "cancelled"), r2);
2199
- return `${u6}${a2}${n3 ? `
1765
+ const r = n ? `${styleText3("gray", S_BAR2)} ` : "", a = wrapTextWithPrefix(t.output, o(this.options[this.cursor], "cancelled"), r);
1766
+ return `${u}${a}${n ? `
2200
1767
  ${styleText3("gray", S_BAR2)}` : ""}`;
2201
1768
  }
2202
1769
  default: {
2203
- const r2 = n3 ? `${styleText3("cyan", S_BAR2)} ` : "", a2 = u6.split(`
2204
- `).length, p2 = d ? formatInstructionFooter(SELECT_INSTRUCTIONS2, n3) : n3 ? [styleText3("cyan", S_BAR_END2)] : [], b2 = p2.join(`
2205
- `), f2 = p2.length + 1;
2206
- return `${u6}${r2}${limitOptions({
2207
- output: t2.output,
1770
+ const r = n ? `${styleText3("cyan", S_BAR2)} ` : "", a = u.split(`
1771
+ `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS2, n) : n ? [styleText3("cyan", S_BAR_END2)] : [], f = p.join(`
1772
+ `), b = p.length + 1;
1773
+ return `${u}${r}${limitOptions({
1774
+ output: t.output,
2208
1775
  cursor: this.cursor,
2209
1776
  options: this.options,
2210
- maxItems: t2.maxItems,
2211
- columnPadding: r2.length,
2212
- rowPadding: a2 + f2,
2213
- style: (g2, x) => o2(g2, g2.disabled ? "disabled" : x ? "active" : "inactive")
1777
+ maxItems: t.maxItems,
1778
+ columnPadding: r.length,
1779
+ rowPadding: a + b,
1780
+ style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
2214
1781
  }).join(`
2215
- ${r2}`)}
2216
- ${b2}
1782
+ ${r}`)}
1783
+ ${f}
2217
1784
  `;
2218
1785
  }
2219
1786
  }
@@ -2221,39 +1788,45 @@ ${b2}
2221
1788
  }).prompt();
2222
1789
  };
2223
1790
  var i2 = `${styleText3("gray", S_BAR2)} `;
2224
- var text2 = (e) => new n2({
2225
- validate: e.validate,
2226
- placeholder: e.placeholder,
2227
- defaultValue: e.defaultValue,
2228
- initialValue: e.initialValue,
2229
- output: e.output,
2230
- signal: e.signal,
2231
- input: e.input,
1791
+ var text2 = (t) => new n({
1792
+ validate: t.validate,
1793
+ placeholder: t.placeholder,
1794
+ defaultValue: t.defaultValue,
1795
+ initialValue: t.initialValue,
1796
+ output: t.output,
1797
+ signal: t.signal,
1798
+ input: t.input,
2232
1799
  render() {
2233
- const i3 = e?.withGuide ?? settings.withGuide, s = `${`${i3 ? `${styleText3("gray", S_BAR2)}
2234
- ` : ""}${symbol2(this.state)} `}${e.message}
2235
- `, c3 = e.placeholder && e.placeholder.length > 0 ? styleText3("inverse", e.placeholder[0]) + styleText3("dim", e.placeholder.slice(1)) : styleText3(["inverse", "hidden"], "_"), o2 = this.userInput ? this.userInputWithCursor : c3, l2 = this.value ?? "";
1800
+ const r = t?.withGuide ?? settings.withGuide, l = `${`${r ? `${styleText3("gray", S_BAR2)}
1801
+ ` : ""}${symbol2(this.state)} `}${t.message}
1802
+ `, d = t.placeholder && t.placeholder.length > 0 ? styleText3("inverse", t.placeholder[0]) + styleText3("dim", t.placeholder.slice(1)) : styleText3(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
2236
1803
  switch (this.state) {
1804
+ case "validating": {
1805
+ const n = r ? `${styleText3("cyan", S_BAR2)} ` : "", i = r ? styleText3("cyan", S_BAR_END2) : "", c = styleText3("dim", o), $ = styleText3("dim", "Validating...");
1806
+ return `${l}${n}${c}
1807
+ ${i} ${$}
1808
+ `;
1809
+ }
2237
1810
  case "error": {
2238
- const n3 = this.error ? ` ${styleText3("yellow", this.error)}` : "", r2 = i3 ? `${styleText3("yellow", S_BAR2)} ` : "", d = i3 ? styleText3("yellow", S_BAR_END2) : "";
2239
- return `${s.trim()}
2240
- ${r2}${o2}
2241
- ${d}${n3}
1811
+ const n = this.error ? ` ${styleText3("yellow", this.error)}` : "", i = r ? `${styleText3("yellow", S_BAR2)} ` : "", c = r ? styleText3("yellow", S_BAR_END2) : "";
1812
+ return `${l.trim()}
1813
+ ${i}${o}
1814
+ ${c}${n}
2242
1815
  `;
2243
1816
  }
2244
1817
  case "submit": {
2245
- const n3 = l2 ? ` ${styleText3("dim", l2)}` : "", r2 = i3 ? styleText3("gray", S_BAR2) : "";
2246
- return `${s}${r2}${n3}`;
1818
+ const n = s ? `${r ? " " : ""}${styleText3("dim", s)}` : "", i = r ? styleText3("gray", S_BAR2) : "";
1819
+ return `${l}${i}${n}`;
2247
1820
  }
2248
1821
  case "cancel": {
2249
- const n3 = l2 ? ` ${styleText3(["strikethrough", "dim"], l2)}` : "", r2 = i3 ? styleText3("gray", S_BAR2) : "";
2250
- return `${s}${r2}${n3}${l2.trim() ? `
2251
- ${r2}` : ""}`;
1822
+ const n = s ? ` ${styleText3(["strikethrough", "dim"], s)}` : "", i = r ? styleText3("gray", S_BAR2) : "";
1823
+ return `${l}${i}${n}${s.trim() ? `
1824
+ ${i}` : ""}`;
2252
1825
  }
2253
1826
  default: {
2254
- const n3 = i3 ? `${styleText3("cyan", S_BAR2)} ` : "", r2 = i3 ? styleText3("cyan", S_BAR_END2) : "";
2255
- return `${s}${n3}${o2}
2256
- ${r2}
1827
+ const n = r ? `${styleText3("cyan", S_BAR2)} ` : "", i = r ? styleText3("cyan", S_BAR_END2) : "";
1828
+ return `${l}${n}${o}
1829
+ ${i}
2257
1830
  `;
2258
1831
  }
2259
1832
  }
@@ -2278,19 +1851,19 @@ function runCaptured(command, options) {
2278
1851
  env: options.env ?? process.env,
2279
1852
  stdio: ["ignore", "pipe", "pipe"]
2280
1853
  });
2281
- let stdout2 = "";
1854
+ let stdout = "";
2282
1855
  let stderr = "";
2283
1856
  child.stdout.setEncoding("utf8");
2284
1857
  child.stderr.setEncoding("utf8");
2285
1858
  child.stdout.on("data", (chunk) => {
2286
- stdout2 += chunk;
1859
+ stdout += chunk;
2287
1860
  });
2288
1861
  child.stderr.on("data", (chunk) => {
2289
1862
  stderr += chunk;
2290
1863
  });
2291
1864
  child.on("error", reject);
2292
1865
  child.on("close", (code, signal) => {
2293
- resolve({ exitCode: code ?? (signal ? 1 : 0), stdout: stdout2, stderr });
1866
+ resolve({ exitCode: code ?? (signal ? 1 : 0), stdout, stderr });
2294
1867
  });
2295
1868
  });
2296
1869
  }
@@ -2601,10 +2174,10 @@ ${dryRunDescription(client, root)}`);
2601
2174
  outro2("Dry run complete. No client configuration was changed.");
2602
2175
  return;
2603
2176
  }
2604
- const progress2 = spinner2();
2605
- progress2.start("Testing the local MCP server");
2177
+ const progress = spinner2();
2178
+ progress.start("Testing the local MCP server");
2606
2179
  await smokeServer(root);
2607
- progress2.stop("Local MCP server passed its protocol self-check");
2180
+ progress.stop("Local MCP server passed its protocol self-check");
2608
2181
  for (const client of clients) {
2609
2182
  const result = client === "codex" ? await configureCodex(root) : client === "cursor" ? await configureCursor(root) : await configureClaude(root);
2610
2183
  log2.success(`${client}: ${result}`);
@@ -2989,25 +2562,25 @@ function runCaptured2(command, options) {
2989
2562
  const [file, ...args] = command;
2990
2563
  if (!file)
2991
2564
  throw new Error("runCaptured requires a command");
2992
- return new Promise((resolve3, reject) => {
2565
+ return new Promise((resolve, reject) => {
2993
2566
  const child = spawn2(file, args, {
2994
2567
  cwd: options.cwd,
2995
2568
  env: options.env ?? process.env,
2996
2569
  stdio: ["ignore", "pipe", "pipe"]
2997
2570
  });
2998
- let stdout2 = "";
2571
+ let stdout = "";
2999
2572
  let stderr = "";
3000
2573
  child.stdout.setEncoding("utf8");
3001
2574
  child.stderr.setEncoding("utf8");
3002
2575
  child.stdout.on("data", (chunk) => {
3003
- stdout2 += chunk;
2576
+ stdout += chunk;
3004
2577
  });
3005
2578
  child.stderr.on("data", (chunk) => {
3006
2579
  stderr += chunk;
3007
2580
  });
3008
2581
  child.on("error", reject);
3009
2582
  child.on("close", (code, signal) => {
3010
- resolve3({ exitCode: code ?? (signal ? 1 : 0), stdout: stdout2, stderr });
2583
+ resolve({ exitCode: code ?? (signal ? 1 : 0), stdout, stderr });
3011
2584
  });
3012
2585
  });
3013
2586
  }
@@ -3015,7 +2588,7 @@ function runInherited(command, options) {
3015
2588
  const [file, ...args] = command;
3016
2589
  if (!file)
3017
2590
  throw new Error("runInherited requires a command");
3018
- return new Promise((resolve3, reject) => {
2591
+ return new Promise((resolve, reject) => {
3019
2592
  const child = spawn2(file, args, {
3020
2593
  cwd: options.cwd,
3021
2594
  env: options.env ?? process.env,
@@ -3023,7 +2596,7 @@ function runInherited(command, options) {
3023
2596
  });
3024
2597
  child.on("error", reject);
3025
2598
  child.on("close", (code, signal) => {
3026
- resolve3(code ?? (signal === "SIGINT" ? 130 : 1));
2599
+ resolve(code ?? (signal === "SIGINT" ? 130 : 1));
3027
2600
  });
3028
2601
  });
3029
2602
  }
@@ -3583,8 +3156,8 @@ function wrapBrandedJsxText(content, brandName, width = 100) {
3583
3156
  const output = [];
3584
3157
  for (let index = 0;index < lines.length; ) {
3585
3158
  const line = lines[index] ?? "";
3586
- const text3 = line.trim();
3587
- if (!text3 || text3.startsWith("<") || text3.startsWith("{") || text3.startsWith("//") || text3.includes("<") || text3.includes(">")) {
3159
+ const text = line.trim();
3160
+ if (!text || text.startsWith("<") || text.startsWith("{") || text.startsWith("//") || text.includes("<") || text.includes(">")) {
3588
3161
  output.push(line);
3589
3162
  index += 1;
3590
3163
  continue;
@@ -3877,12 +3450,12 @@ async function trackedTemplatePaths(sourceDirectory) {
3877
3450
  });
3878
3451
  if (topLevel !== sourceDirectory)
3879
3452
  return;
3880
- const { stdout: stdout2 } = await execFileAsync("git", ["ls-files", "-z"], {
3453
+ const { stdout } = await execFileAsync("git", ["ls-files", "-z"], {
3881
3454
  cwd: sourceDirectory,
3882
3455
  maxBuffer: 64 * 1024 * 1024
3883
3456
  });
3884
3457
  const tracked = new Set;
3885
- for (const path of stdout2.split("\x00")) {
3458
+ for (const path of stdout.split("\x00")) {
3886
3459
  if (!path)
3887
3460
  continue;
3888
3461
  tracked.add(path);
@@ -4428,8 +4001,8 @@ function assertSiblingTarget(source, target) {
4428
4001
  throw new Error(`Create the new app beside the ${CLI_NAME} source checkout, not inside it.`);
4429
4002
  }
4430
4003
  }
4431
- function commandFailureOutput(stdout2, stderr) {
4432
- const output = (stderr.trim() || stdout2.trim()).split(`
4004
+ function commandFailureOutput(stdout, stderr) {
4005
+ const output = (stderr.trim() || stdout.trim()).split(`
4433
4006
  `).slice(-12).join(`
4434
4007
  `);
4435
4008
  return output ? `
@@ -4437,12 +4010,12 @@ function commandFailureOutput(stdout2, stderr) {
4437
4010
  ${output}` : "";
4438
4011
  }
4439
4012
  async function installDependencies(target) {
4440
- const { stdout: stdout2, stderr, exitCode } = await runCaptured2(["pnpm", "install", "--frozen-lockfile"], {
4013
+ const { stdout, stderr, exitCode } = await runCaptured2(["pnpm", "install", "--frozen-lockfile"], {
4441
4014
  cwd: target,
4442
4015
  env: { ...process.env, CI: "1" }
4443
4016
  });
4444
4017
  if (exitCode !== 0) {
4445
- throw new Error(`Dependency installation failed.${commandFailureOutput(stdout2, stderr)}`);
4018
+ throw new Error(`Dependency installation failed.${commandFailureOutput(stdout, stderr)}`);
4446
4019
  }
4447
4020
  }
4448
4021
  async function occupiedDevelopmentPorts() {
@@ -4638,14 +4211,14 @@ if (isEntrypoint(import.meta.url)) {
4638
4211
  });
4639
4212
  }
4640
4213
  export {
4641
- usage,
4642
- suggestScope,
4643
- suggestBrandName,
4644
- printRunnableCommands,
4645
- parseArguments,
4646
- occupiedDevelopmentPorts,
4647
- formatBytes,
4648
- findAvailablePort,
4214
+ collectLicenseKey,
4649
4215
  describeTargetConflict,
4650
- collectLicenseKey
4216
+ findAvailablePort,
4217
+ formatBytes,
4218
+ occupiedDevelopmentPorts,
4219
+ parseArguments,
4220
+ printRunnableCommands,
4221
+ suggestBrandName,
4222
+ suggestScope,
4223
+ usage
4651
4224
  };