varlock 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/audit.command-LLD5UIAW.js +16 -0
  2. package/dist/audit.command-LLD5UIAW.js.map +1 -0
  3. package/dist/auto-load.js +6 -6
  4. package/dist/{chunk-QSYH5IDD.js → chunk-5DRCCFKV.js} +3 -3
  5. package/dist/{chunk-QSYH5IDD.js.map → chunk-5DRCCFKV.js.map} +1 -1
  6. package/dist/{chunk-E3F6QKDZ.js → chunk-C5LW5EET.js} +6 -6
  7. package/dist/{chunk-E3F6QKDZ.js.map → chunk-C5LW5EET.js.map} +1 -1
  8. package/dist/chunk-CESFJIM4.js +198 -0
  9. package/dist/chunk-CESFJIM4.js.map +1 -0
  10. package/dist/{chunk-5DUWGI2N.js → chunk-DIPEXEIL.js} +3 -3
  11. package/dist/{chunk-5DUWGI2N.js.map → chunk-DIPEXEIL.js.map} +1 -1
  12. package/dist/{chunk-SDN53OAC.js → chunk-F6ZYIWAR.js} +160 -72
  13. package/dist/chunk-F6ZYIWAR.js.map +1 -0
  14. package/dist/{chunk-2PFIYNFA.js → chunk-FA5SNEKN.js} +30 -13
  15. package/dist/chunk-FA5SNEKN.js.map +1 -0
  16. package/dist/{chunk-XWYFSG46.js → chunk-GKN3UJNE.js} +651 -821
  17. package/dist/chunk-GKN3UJNE.js.map +1 -0
  18. package/dist/{chunk-TQXYC3G3.js → chunk-HH647LSU.js} +5 -5
  19. package/dist/{chunk-TQXYC3G3.js.map → chunk-HH647LSU.js.map} +1 -1
  20. package/dist/{chunk-6RF54KKR.js → chunk-HMWAOBZR.js} +78 -24
  21. package/dist/chunk-HMWAOBZR.js.map +1 -0
  22. package/dist/{chunk-H6NILU2I.js → chunk-INGOLNLE.js} +4 -4
  23. package/dist/{chunk-H6NILU2I.js.map → chunk-INGOLNLE.js.map} +1 -1
  24. package/dist/{chunk-JIUWL2NT.js → chunk-IO2OGZQU.js} +9 -9
  25. package/dist/chunk-IO2OGZQU.js.map +1 -0
  26. package/dist/chunk-IRXBCLL2.js +2045 -0
  27. package/dist/chunk-IRXBCLL2.js.map +1 -0
  28. package/dist/{chunk-QP7TS4SU.js → chunk-JOGGSYT2.js} +6 -6
  29. package/dist/chunk-JOGGSYT2.js.map +1 -0
  30. package/dist/{chunk-F6RTQ5QX.js → chunk-KFALDUEO.js} +3 -3
  31. package/dist/{chunk-F6RTQ5QX.js.map → chunk-KFALDUEO.js.map} +1 -1
  32. package/dist/{chunk-VN4LKYXR.js → chunk-KI5QLKPU.js} +6 -6
  33. package/dist/{chunk-VN4LKYXR.js.map → chunk-KI5QLKPU.js.map} +1 -1
  34. package/dist/{chunk-JUPAI2X4.js → chunk-M6QE3D2O.js} +7 -7
  35. package/dist/{chunk-JUPAI2X4.js.map → chunk-M6QE3D2O.js.map} +1 -1
  36. package/dist/{chunk-CDLU5P62.js → chunk-MPHVA4WC.js} +3 -3
  37. package/dist/{chunk-CDLU5P62.js.map → chunk-MPHVA4WC.js.map} +1 -1
  38. package/dist/{chunk-U2O3AUM2.js → chunk-NW4KR67N.js} +8 -8
  39. package/dist/{chunk-U2O3AUM2.js.map → chunk-NW4KR67N.js.map} +1 -1
  40. package/dist/{chunk-S5O4AAVX.js → chunk-OGGTDFVX.js} +8 -8
  41. package/dist/{chunk-S5O4AAVX.js.map → chunk-OGGTDFVX.js.map} +1 -1
  42. package/dist/chunk-P33JXOU6.js +523 -0
  43. package/dist/chunk-P33JXOU6.js.map +1 -0
  44. package/dist/{chunk-R73FENLU.js → chunk-QDEAHBCB.js} +3 -3
  45. package/dist/{chunk-R73FENLU.js.map → chunk-QDEAHBCB.js.map} +1 -1
  46. package/dist/{chunk-RBFS2QGC.js → chunk-RQZZDYWL.js} +8 -8
  47. package/dist/{chunk-RBFS2QGC.js.map → chunk-RQZZDYWL.js.map} +1 -1
  48. package/dist/{chunk-MGWUDHT5.js → chunk-UUJK65RS.js} +11 -3
  49. package/dist/chunk-UUJK65RS.js.map +1 -0
  50. package/dist/{chunk-A6THM3IR.js → chunk-WJLMLKSG.js} +5 -5
  51. package/dist/{chunk-A6THM3IR.js.map → chunk-WJLMLKSG.js.map} +1 -1
  52. package/dist/{chunk-YO6WHPM4.js → chunk-WTBUNHUJ.js} +5 -5
  53. package/dist/{chunk-YO6WHPM4.js.map → chunk-WTBUNHUJ.js.map} +1 -1
  54. package/dist/chunk-XUY3HAO2.js +171 -0
  55. package/dist/chunk-XUY3HAO2.js.map +1 -0
  56. package/dist/{chunk-ZJNDICC4.js → chunk-XXSPHSF7.js} +6 -6
  57. package/dist/{chunk-ZJNDICC4.js.map → chunk-XXSPHSF7.js.map} +1 -1
  58. package/dist/{chunk-GURKQO4J.js → chunk-YWTIKDGU.js} +7 -2
  59. package/dist/chunk-YWTIKDGU.js.map +1 -0
  60. package/dist/{chunk-F5H5MJ6U.js → chunk-ZTFQ7ZVH.js} +2 -5
  61. package/dist/chunk-ZTFQ7ZVH.js.map +1 -0
  62. package/dist/cli/cli-executable.js +54 -51
  63. package/dist/cli/cli-executable.js.map +1 -1
  64. package/dist/config-item-SQFJ2BJ2.js +7 -0
  65. package/dist/{config-item-6LTV4PNH.js.map → config-item-SQFJ2BJ2.js.map} +1 -1
  66. package/dist/dist-ZBZ52DPW.js +4 -0
  67. package/dist/{dist-WGIHRGBZ.js.map → dist-ZBZ52DPW.js.map} +1 -1
  68. package/dist/dotenv-compat.js +6 -6
  69. package/dist/encrypt.command-WISNYCTG.js +14 -0
  70. package/dist/{encrypt.command-F2OTB6HD.js.map → encrypt.command-WISNYCTG.js.map} +1 -1
  71. package/dist/{env-graph-iNQyTcya.d.ts → env-graph-DImkUkjl.d.ts} +30 -19
  72. package/dist/explain.command-THO6CRHD.js +15 -0
  73. package/dist/{explain.command-TEIPRC7Q.js.map → explain.command-THO6CRHD.js.map} +1 -1
  74. package/dist/index.d.ts +2 -2
  75. package/dist/index.js +14 -15
  76. package/dist/index.js.map +1 -1
  77. package/dist/init.command-3EDACW36.js +14 -0
  78. package/dist/{init.command-5LP3UFKD.js.map → init.command-3EDACW36.js.map} +1 -1
  79. package/dist/install-plugin.command-MXBZTBTE.js +13 -0
  80. package/dist/{install-plugin.command-X7RSLPUJ.js.map → install-plugin.command-MXBZTBTE.js.map} +1 -1
  81. package/dist/lib/exec-sync-varlock.js +1 -1
  82. package/dist/load.command-XRABTXAE.js +15 -0
  83. package/dist/{load.command-7SQRDQ3E.js.map → load.command-XRABTXAE.js.map} +1 -1
  84. package/dist/lock.command-O5MPBQ2I.js +7 -0
  85. package/dist/{lock.command-4LTGMJA3.js.map → lock.command-O5MPBQ2I.js.map} +1 -1
  86. package/dist/plugin-lib.d.ts +2 -2
  87. package/dist/plugin-lib.js +2 -2
  88. package/dist/printenv.command-DLCI4IPZ.js +15 -0
  89. package/dist/{printenv.command-ON7RMFEU.js.map → printenv.command-DLCI4IPZ.js.map} +1 -1
  90. package/dist/reveal.command-6BTK3FJZ.js +15 -0
  91. package/dist/{reveal.command-BW6XYVXH.js.map → reveal.command-6BTK3FJZ.js.map} +1 -1
  92. package/dist/run.command-5CIHZECD.js +16 -0
  93. package/dist/{run.command-5QADABYL.js.map → run.command-5CIHZECD.js.map} +1 -1
  94. package/dist/runtime/env.d.ts +1 -1
  95. package/dist/runtime/env.js +1 -1
  96. package/dist/runtime/init-edge.cjs +9 -1
  97. package/dist/runtime/init-server.cjs +9 -1
  98. package/dist/runtime/patch-console.js +2 -2
  99. package/dist/runtime/patch-response.js +2 -2
  100. package/dist/runtime/patch-server-response.js +2 -2
  101. package/dist/scan.command-PW3OOLQY.js +16 -0
  102. package/dist/{scan.command-ZVW3XAUG.js.map → scan.command-PW3OOLQY.js.map} +1 -1
  103. package/dist/telemetry.command-TZDNG2WR.js +13 -0
  104. package/dist/{telemetry.command-PY6E4QSH.js.map → telemetry.command-TZDNG2WR.js.map} +1 -1
  105. package/dist/typegen.command-QD26Q3MP.js +14 -0
  106. package/dist/{typegen.command-KZ4O5IKQ.js.map → typegen.command-QD26Q3MP.js.map} +1 -1
  107. package/native-bins/darwin/VarlockEnclave.app/Contents/CodeResources +0 -0
  108. package/native-bins/darwin/VarlockEnclave.app/Contents/MacOS/varlock-local-encrypt +0 -0
  109. package/native-bins/win32-x64/varlock-local-encrypt.exe +0 -0
  110. package/package.json +2 -2
  111. package/dist/chunk-2PFIYNFA.js.map +0 -1
  112. package/dist/chunk-6RF54KKR.js.map +0 -1
  113. package/dist/chunk-7GFD2ATN.js +0 -136
  114. package/dist/chunk-7GFD2ATN.js.map +0 -1
  115. package/dist/chunk-F5H5MJ6U.js.map +0 -1
  116. package/dist/chunk-GURKQO4J.js.map +0 -1
  117. package/dist/chunk-HDKXXS2X.js +0 -1959
  118. package/dist/chunk-HDKXXS2X.js.map +0 -1
  119. package/dist/chunk-JIUWL2NT.js.map +0 -1
  120. package/dist/chunk-MGWUDHT5.js.map +0 -1
  121. package/dist/chunk-QP7TS4SU.js.map +0 -1
  122. package/dist/chunk-SDN53OAC.js.map +0 -1
  123. package/dist/chunk-XWYFSG46.js.map +0 -1
  124. package/dist/config-item-6LTV4PNH.js +0 -7
  125. package/dist/dist-WGIHRGBZ.js +0 -4
  126. package/dist/encrypt.command-F2OTB6HD.js +0 -14
  127. package/dist/explain.command-TEIPRC7Q.js +0 -15
  128. package/dist/init.command-5LP3UFKD.js +0 -13
  129. package/dist/install-plugin.command-X7RSLPUJ.js +0 -13
  130. package/dist/load.command-7SQRDQ3E.js +0 -15
  131. package/dist/lock.command-4LTGMJA3.js +0 -7
  132. package/dist/printenv.command-ON7RMFEU.js +0 -15
  133. package/dist/reveal.command-BW6XYVXH.js +0 -15
  134. package/dist/run.command-5QADABYL.js +0 -16
  135. package/dist/scan.command-ZVW3XAUG.js +0 -16
  136. package/dist/telemetry.command-PY6E4QSH.js +0 -13
  137. package/dist/typegen.command-KZ4O5IKQ.js +0 -15
@@ -0,0 +1,2045 @@
1
+ import { __commonJS, __name, __toESM } from './chunk-6PEHRAEP.js';
2
+ import { styleText, stripVTControlCharacters } from 'util';
3
+ import j2, { stdin, stdout } from 'process';
4
+ import * as b from 'readline';
5
+ import b__default from 'readline';
6
+ import { ReadStream } from 'tty';
7
+ import { existsSync, lstatSync, readdirSync } from 'fs';
8
+ import { dirname, join } from 'path';
9
+
10
+ // ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
11
+ var require_src = __commonJS({
12
+ "../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
13
+ var ESC2 = "\x1B";
14
+ var CSI2 = `${ESC2}[`;
15
+ var beep = "\x07";
16
+ var cursor = {
17
+ to(x2, y) {
18
+ if (!y) return `${CSI2}${x2 + 1}G`;
19
+ return `${CSI2}${y + 1};${x2 + 1}H`;
20
+ },
21
+ move(x2, y) {
22
+ let ret = "";
23
+ if (x2 < 0) ret += `${CSI2}${-x2}D`;
24
+ else if (x2 > 0) ret += `${CSI2}${x2}C`;
25
+ if (y < 0) ret += `${CSI2}${-y}A`;
26
+ else if (y > 0) ret += `${CSI2}${y}B`;
27
+ return ret;
28
+ },
29
+ up: /* @__PURE__ */ __name((count = 1) => `${CSI2}${count}A`, "up"),
30
+ down: /* @__PURE__ */ __name((count = 1) => `${CSI2}${count}B`, "down"),
31
+ forward: /* @__PURE__ */ __name((count = 1) => `${CSI2}${count}C`, "forward"),
32
+ backward: /* @__PURE__ */ __name((count = 1) => `${CSI2}${count}D`, "backward"),
33
+ nextLine: /* @__PURE__ */ __name((count = 1) => `${CSI2}E`.repeat(count), "nextLine"),
34
+ prevLine: /* @__PURE__ */ __name((count = 1) => `${CSI2}F`.repeat(count), "prevLine"),
35
+ left: `${CSI2}G`,
36
+ hide: `${CSI2}?25l`,
37
+ show: `${CSI2}?25h`,
38
+ save: `${ESC2}7`,
39
+ restore: `${ESC2}8`
40
+ };
41
+ var scroll = {
42
+ up: /* @__PURE__ */ __name((count = 1) => `${CSI2}S`.repeat(count), "up"),
43
+ down: /* @__PURE__ */ __name((count = 1) => `${CSI2}T`.repeat(count), "down")
44
+ };
45
+ var erase = {
46
+ screen: `${CSI2}2J`,
47
+ up: /* @__PURE__ */ __name((count = 1) => `${CSI2}1J`.repeat(count), "up"),
48
+ down: /* @__PURE__ */ __name((count = 1) => `${CSI2}J`.repeat(count), "down"),
49
+ line: `${CSI2}2K`,
50
+ lineEnd: `${CSI2}K`,
51
+ lineStart: `${CSI2}1K`,
52
+ lines(count) {
53
+ let clear = "";
54
+ for (let i = 0; i < count; i++)
55
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
56
+ if (count)
57
+ clear += cursor.left;
58
+ return clear;
59
+ }
60
+ };
61
+ module.exports = { cursor, scroll, erase, beep };
62
+ }
63
+ });
64
+
65
+ // ../../node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
66
+ var getCodePointsLength = /* @__PURE__ */ (() => {
67
+ const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
68
+ return (input) => {
69
+ let surrogatePairsNr = 0;
70
+ SURROGATE_PAIR_RE.lastIndex = 0;
71
+ while (SURROGATE_PAIR_RE.test(input)) {
72
+ surrogatePairsNr += 1;
73
+ }
74
+ return input.length - surrogatePairsNr;
75
+ };
76
+ })();
77
+ var isFullWidth = /* @__PURE__ */ __name((x2) => {
78
+ return x2 === 12288 || x2 >= 65281 && x2 <= 65376 || x2 >= 65504 && x2 <= 65510;
79
+ }, "isFullWidth");
80
+ var isWideNotCJKTNotEmoji = /* @__PURE__ */ __name((x2) => {
81
+ return x2 === 8987 || x2 === 9001 || x2 >= 12272 && x2 <= 12287 || x2 >= 12289 && x2 <= 12350 || x2 >= 12441 && x2 <= 12543 || x2 >= 12549 && x2 <= 12591 || x2 >= 12593 && x2 <= 12686 || x2 >= 12688 && x2 <= 12771 || x2 >= 12783 && x2 <= 12830 || x2 >= 12832 && x2 <= 12871 || x2 >= 12880 && x2 <= 19903 || x2 >= 65040 && x2 <= 65049 || x2 >= 65072 && x2 <= 65106 || x2 >= 65108 && x2 <= 65126 || x2 >= 65128 && x2 <= 65131 || x2 >= 127488 && x2 <= 127490 || x2 >= 127504 && x2 <= 127547 || x2 >= 127552 && x2 <= 127560 || x2 >= 131072 && x2 <= 196605 || x2 >= 196608 && x2 <= 262141;
82
+ }, "isWideNotCJKTNotEmoji");
83
+
84
+ // ../../node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
85
+ var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
86
+ var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
87
+ var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
88
+ var TAB_RE = /\t{1,1000}/y;
89
+ var EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
90
+ var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
91
+ var MODIFIER_RE = new RegExp("\\p{M}+", "gu");
92
+ var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
93
+ var getStringTruncatedWidth = /* @__PURE__ */ __name((input, truncationOptions = {}, widthOptions = {}) => {
94
+ const LIMIT = truncationOptions.limit ?? Infinity;
95
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
96
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
97
+ const ANSI_WIDTH = 0;
98
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
99
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
100
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
101
+ const FULL_WIDTH_WIDTH = 2;
102
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
103
+ const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
104
+ const PARSE_BLOCKS = [
105
+ [LATIN_RE, REGULAR_WIDTH],
106
+ [ANSI_RE, ANSI_WIDTH],
107
+ [CONTROL_RE, CONTROL_WIDTH],
108
+ [TAB_RE, TAB_WIDTH],
109
+ [EMOJI_RE, EMOJI_WIDTH],
110
+ [CJKT_WIDE_RE, WIDE_WIDTH]
111
+ ];
112
+ let indexPrev = 0;
113
+ let index = 0;
114
+ let length = input.length;
115
+ let lengthExtra = 0;
116
+ let truncationEnabled = false;
117
+ let truncationIndex = length;
118
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
119
+ let unmatchedStart = 0;
120
+ let unmatchedEnd = 0;
121
+ let width = 0;
122
+ let widthExtra = 0;
123
+ outer: while (true) {
124
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
125
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
126
+ lengthExtra = 0;
127
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
128
+ const codePoint = char.codePointAt(0) || 0;
129
+ if (isFullWidth(codePoint)) {
130
+ widthExtra = FULL_WIDTH_WIDTH;
131
+ } else if (isWideNotCJKTNotEmoji(codePoint)) {
132
+ widthExtra = WIDE_WIDTH;
133
+ } else {
134
+ widthExtra = REGULAR_WIDTH;
135
+ }
136
+ if (width + widthExtra > truncationLimit) {
137
+ truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
138
+ }
139
+ if (width + widthExtra > LIMIT) {
140
+ truncationEnabled = true;
141
+ break outer;
142
+ }
143
+ lengthExtra += char.length;
144
+ width += widthExtra;
145
+ }
146
+ unmatchedStart = unmatchedEnd = 0;
147
+ }
148
+ if (index >= length) {
149
+ break outer;
150
+ }
151
+ for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
152
+ const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
153
+ BLOCK_RE.lastIndex = index;
154
+ if (BLOCK_RE.test(input)) {
155
+ lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
156
+ widthExtra = lengthExtra * BLOCK_WIDTH;
157
+ if (width + widthExtra > truncationLimit) {
158
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
159
+ }
160
+ if (width + widthExtra > LIMIT) {
161
+ truncationEnabled = true;
162
+ break outer;
163
+ }
164
+ width += widthExtra;
165
+ unmatchedStart = indexPrev;
166
+ unmatchedEnd = index;
167
+ index = indexPrev = BLOCK_RE.lastIndex;
168
+ continue outer;
169
+ }
170
+ }
171
+ index += 1;
172
+ }
173
+ return {
174
+ width: truncationEnabled ? truncationLimit : width,
175
+ index: truncationEnabled ? truncationIndex : length,
176
+ truncated: truncationEnabled,
177
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
178
+ };
179
+ }, "getStringTruncatedWidth");
180
+ var dist_default = getStringTruncatedWidth;
181
+
182
+ // ../../node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
183
+ var NO_TRUNCATION2 = {
184
+ limit: Infinity,
185
+ ellipsis: "",
186
+ ellipsisWidth: 0
187
+ };
188
+ var fastStringWidth = /* @__PURE__ */ __name((input, options = {}) => {
189
+ return dist_default(input, NO_TRUNCATION2, options).width;
190
+ }, "fastStringWidth");
191
+ var dist_default2 = fastStringWidth;
192
+
193
+ // ../../node_modules/.bun/fast-wrap-ansi@0.2.0/node_modules/fast-wrap-ansi/lib/main.js
194
+ var ESC = "\x1B";
195
+ var CSI = "\x9B";
196
+ var END_CODE = 39;
197
+ var ANSI_ESCAPE_BELL = "\x07";
198
+ var ANSI_CSI = "[";
199
+ var ANSI_OSC = "]";
200
+ var ANSI_SGR_TERMINATOR = "m";
201
+ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
202
+ var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
203
+ var getClosingCode = /* @__PURE__ */ __name((openingCode) => {
204
+ if (openingCode >= 30 && openingCode <= 37)
205
+ return 39;
206
+ if (openingCode >= 90 && openingCode <= 97)
207
+ return 39;
208
+ if (openingCode >= 40 && openingCode <= 47)
209
+ return 49;
210
+ if (openingCode >= 100 && openingCode <= 107)
211
+ return 49;
212
+ if (openingCode === 1 || openingCode === 2)
213
+ return 22;
214
+ if (openingCode === 3)
215
+ return 23;
216
+ if (openingCode === 4)
217
+ return 24;
218
+ if (openingCode === 7)
219
+ return 27;
220
+ if (openingCode === 8)
221
+ return 28;
222
+ if (openingCode === 9)
223
+ return 29;
224
+ if (openingCode === 0)
225
+ return 0;
226
+ return void 0;
227
+ }, "getClosingCode");
228
+ var wrapAnsiCode = /* @__PURE__ */ __name((code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`, "wrapAnsiCode");
229
+ var wrapAnsiHyperlink = /* @__PURE__ */ __name((url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`, "wrapAnsiHyperlink");
230
+ var wrapWord = /* @__PURE__ */ __name((rows, word, columns) => {
231
+ const characters = word[Symbol.iterator]();
232
+ let isInsideEscape = false;
233
+ let isInsideLinkEscape = false;
234
+ let lastRow = rows.at(-1);
235
+ let visible = lastRow === void 0 ? 0 : dist_default2(lastRow);
236
+ let currentCharacter = characters.next();
237
+ let nextCharacter = characters.next();
238
+ let rawCharacterIndex = 0;
239
+ while (!currentCharacter.done) {
240
+ const character = currentCharacter.value;
241
+ const characterLength = dist_default2(character);
242
+ if (visible + characterLength <= columns) {
243
+ rows[rows.length - 1] += character;
244
+ } else {
245
+ rows.push(character);
246
+ visible = 0;
247
+ }
248
+ if (character === ESC || character === CSI) {
249
+ isInsideEscape = true;
250
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
251
+ }
252
+ if (isInsideEscape) {
253
+ if (isInsideLinkEscape) {
254
+ if (character === ANSI_ESCAPE_BELL) {
255
+ isInsideEscape = false;
256
+ isInsideLinkEscape = false;
257
+ }
258
+ } else if (character === ANSI_SGR_TERMINATOR) {
259
+ isInsideEscape = false;
260
+ }
261
+ } else {
262
+ visible += characterLength;
263
+ if (visible === columns && !nextCharacter.done) {
264
+ rows.push("");
265
+ visible = 0;
266
+ }
267
+ }
268
+ currentCharacter = nextCharacter;
269
+ nextCharacter = characters.next();
270
+ rawCharacterIndex += character.length;
271
+ }
272
+ lastRow = rows.at(-1);
273
+ if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
274
+ rows[rows.length - 2] += rows.pop();
275
+ }
276
+ }, "wrapWord");
277
+ var stringVisibleTrimSpacesRight = /* @__PURE__ */ __name((string) => {
278
+ const words = string.split(" ");
279
+ let last = words.length;
280
+ while (last) {
281
+ if (dist_default2(words[last - 1])) {
282
+ break;
283
+ }
284
+ last--;
285
+ }
286
+ if (last === words.length) {
287
+ return string;
288
+ }
289
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
290
+ }, "stringVisibleTrimSpacesRight");
291
+ var exec = /* @__PURE__ */ __name((string, columns, options = {}) => {
292
+ if (options.trim !== false && string.trim() === "") {
293
+ return "";
294
+ }
295
+ let returnValue = "";
296
+ let escapeCode;
297
+ let escapeUrl;
298
+ const words = string.split(" ");
299
+ let rows = [""];
300
+ let rowLength = 0;
301
+ for (let index = 0; index < words.length; index++) {
302
+ const word = words[index];
303
+ if (options.trim !== false) {
304
+ const row = rows.at(-1) ?? "";
305
+ const trimmed = row.trimStart();
306
+ if (row.length !== trimmed.length) {
307
+ rows[rows.length - 1] = trimmed;
308
+ rowLength = dist_default2(trimmed);
309
+ }
310
+ }
311
+ if (index !== 0) {
312
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
313
+ rows.push("");
314
+ rowLength = 0;
315
+ }
316
+ if (rowLength || options.trim === false) {
317
+ rows[rows.length - 1] += " ";
318
+ rowLength++;
319
+ }
320
+ }
321
+ const wordLength = dist_default2(word);
322
+ if (options.hard && wordLength > columns) {
323
+ const remainingColumns = columns - rowLength;
324
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
325
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
326
+ if (breaksStartingNextLine < breaksStartingThisLine) {
327
+ rows.push("");
328
+ }
329
+ wrapWord(rows, word, columns);
330
+ rowLength = dist_default2(rows.at(-1) ?? "");
331
+ continue;
332
+ }
333
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
334
+ if (options.wordWrap === false && rowLength < columns) {
335
+ wrapWord(rows, word, columns);
336
+ rowLength = dist_default2(rows.at(-1) ?? "");
337
+ continue;
338
+ }
339
+ rows.push("");
340
+ rowLength = 0;
341
+ }
342
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
343
+ wrapWord(rows, word, columns);
344
+ rowLength = dist_default2(rows.at(-1) ?? "");
345
+ continue;
346
+ }
347
+ rows[rows.length - 1] += word;
348
+ rowLength += wordLength;
349
+ }
350
+ if (options.trim !== false) {
351
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
352
+ }
353
+ const preString = rows.join("\n");
354
+ let inSurrogate = false;
355
+ for (let i = 0; i < preString.length; i++) {
356
+ const character = preString[i];
357
+ returnValue += character;
358
+ if (!inSurrogate) {
359
+ inSurrogate = character >= "\uD800" && character <= "\uDBFF";
360
+ if (inSurrogate) {
361
+ continue;
362
+ }
363
+ } else {
364
+ inSurrogate = false;
365
+ }
366
+ if (character === ESC || character === CSI) {
367
+ GROUP_REGEX.lastIndex = i + 1;
368
+ const groupsResult = GROUP_REGEX.exec(preString);
369
+ const groups = groupsResult?.groups;
370
+ if (groups?.code !== void 0) {
371
+ const code = Number.parseFloat(groups.code);
372
+ escapeCode = code === END_CODE ? void 0 : code;
373
+ } else if (groups?.uri !== void 0) {
374
+ escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
375
+ }
376
+ }
377
+ if (preString[i + 1] === "\n") {
378
+ if (escapeUrl) {
379
+ returnValue += wrapAnsiHyperlink("");
380
+ }
381
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
382
+ if (escapeCode && closingCode) {
383
+ returnValue += wrapAnsiCode(closingCode);
384
+ }
385
+ } else if (character === "\n") {
386
+ if (escapeCode && getClosingCode(escapeCode)) {
387
+ returnValue += wrapAnsiCode(escapeCode);
388
+ }
389
+ if (escapeUrl) {
390
+ returnValue += wrapAnsiHyperlink(escapeUrl);
391
+ }
392
+ }
393
+ }
394
+ return returnValue;
395
+ }, "exec");
396
+ var CRLF_OR_LF = /\r?\n/;
397
+ function wrapAnsi(string, columns, options) {
398
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
399
+ }
400
+ __name(wrapAnsi, "wrapAnsi");
401
+
402
+ // ../../node_modules/.bun/@clack+core@1.3.0/node_modules/@clack/core/dist/index.mjs
403
+ var import_sisteransi = __toESM(require_src(), 1);
404
+ function d(r, t, s) {
405
+ if (!s.some((o) => !o.disabled)) return r;
406
+ const e2 = r + t, i = Math.max(s.length - 1, 0), n = e2 < 0 ? i : e2 > i ? 0 : e2;
407
+ return s[n].disabled ? d(n, t < 0 ? -1 : 1, s) : n;
408
+ }
409
+ __name(d, "d");
410
+ function I(r, t, s, e2) {
411
+ const i = e2.split(`
412
+ `);
413
+ let n = 0, o = r;
414
+ for (const a of i) {
415
+ if (o <= a.length) break;
416
+ o -= a.length + 1, n++;
417
+ }
418
+ for (n = Math.max(0, Math.min(i.length - 1, n + s)), o = Math.min(o, i[n].length) + t; o < 0 && n > 0; ) n--, o += i[n].length + 1;
419
+ for (; o > i[n].length && n < i.length - 1; ) o -= i[n].length + 1, n++;
420
+ o = Math.max(0, Math.min(i[n].length, o));
421
+ let u = 0;
422
+ for (let a = 0; a < n; a++) u += i[a].length + 1;
423
+ return u + o;
424
+ }
425
+ __name(I, "I");
426
+ var G = ["up", "down", "left", "right", "space", "enter", "cancel"];
427
+ var K = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
428
+ var h = { actions: new Set(G), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true, date: { monthNames: [...K], messages: { required: "Please enter a valid date", invalidMonth: "There are only 12 months in a year", invalidDay: /* @__PURE__ */ __name((r, t) => `There are only ${r} days in ${t}`, "invalidDay"), afterMin: /* @__PURE__ */ __name((r) => `Date must be on or after ${r.toISOString().slice(0, 10)}`, "afterMin"), beforeMax: /* @__PURE__ */ __name((r) => `Date must be on or before ${r.toISOString().slice(0, 10)}`, "beforeMax") } } };
429
+ function j(r) {
430
+ if (r.aliases !== void 0) {
431
+ const t = r.aliases;
432
+ for (const s in t) {
433
+ if (!Object.hasOwn(t, s)) continue;
434
+ const e2 = t[s];
435
+ h.actions.has(e2) && (h.aliases.has(s) || h.aliases.set(s, e2));
436
+ }
437
+ }
438
+ if (r.messages !== void 0) {
439
+ const t = r.messages;
440
+ t.cancel !== void 0 && (h.messages.cancel = t.cancel), t.error !== void 0 && (h.messages.error = t.error);
441
+ }
442
+ if (r.withGuide !== void 0 && (h.withGuide = r.withGuide !== false), r.date !== void 0) {
443
+ const t = r.date;
444
+ t.monthNames !== void 0 && (h.date.monthNames = [...t.monthNames]), t.messages !== void 0 && (t.messages.required !== void 0 && (h.date.messages.required = t.messages.required), t.messages.invalidMonth !== void 0 && (h.date.messages.invalidMonth = t.messages.invalidMonth), t.messages.invalidDay !== void 0 && (h.date.messages.invalidDay = t.messages.invalidDay), t.messages.afterMin !== void 0 && (h.date.messages.afterMin = t.messages.afterMin), t.messages.beforeMax !== void 0 && (h.date.messages.beforeMax = t.messages.beforeMax));
445
+ }
446
+ }
447
+ __name(j, "j");
448
+ function C(r, t) {
449
+ if (typeof r == "string") return h.aliases.get(r) === t;
450
+ for (const s of r) if (s !== void 0 && C(s, t)) return true;
451
+ return false;
452
+ }
453
+ __name(C, "C");
454
+ function z(r, t) {
455
+ if (r === t) return;
456
+ const s = r.split(`
457
+ `), e2 = t.split(`
458
+ `), i = Math.max(s.length, e2.length), n = [];
459
+ for (let o = 0; o < i; o++) s[o] !== e2[o] && n.push(o);
460
+ return { lines: n, numLinesBefore: s.length, numLinesAfter: e2.length, numLines: i };
461
+ }
462
+ __name(z, "z");
463
+ var Y = globalThis.process.platform.startsWith("win");
464
+ var k = /* @__PURE__ */ Symbol("clack:cancel");
465
+ function q(r) {
466
+ return r === k;
467
+ }
468
+ __name(q, "q");
469
+ function w(r, t) {
470
+ const s = r;
471
+ s.isTTY && s.setRawMode(t);
472
+ }
473
+ __name(w, "w");
474
+ function R({ input: r = stdin, output: t = stdout, overwrite: s = true, hideCursor: e2 = true } = {}) {
475
+ const i = b.createInterface({ input: r, output: t, prompt: "", tabSize: 1 });
476
+ b.emitKeypressEvents(r, i), r instanceof ReadStream && r.isTTY && r.setRawMode(true);
477
+ const n = /* @__PURE__ */ __name((o, { name: u, sequence: a }) => {
478
+ const l = String(o);
479
+ if (C([l, u, a], "cancel")) {
480
+ e2 && t.write(import_sisteransi.cursor.show), process.exit(0);
481
+ return;
482
+ }
483
+ if (!s) return;
484
+ const f = u === "return" ? 0 : -1, y = u === "return" ? -1 : 0;
485
+ b.moveCursor(t, f, y, () => {
486
+ b.clearLine(t, 1, () => {
487
+ r.once("keypress", n);
488
+ });
489
+ });
490
+ }, "n");
491
+ return e2 && t.write(import_sisteransi.cursor.hide), r.once("keypress", n), () => {
492
+ r.off("keypress", n), e2 && t.write(import_sisteransi.cursor.show), r instanceof ReadStream && r.isTTY && !Y && r.setRawMode(false), i.terminal = false, i.close();
493
+ };
494
+ }
495
+ __name(R, "R");
496
+ var A = /* @__PURE__ */ __name((r) => "columns" in r && typeof r.columns == "number" ? r.columns : 80, "A");
497
+ var L = /* @__PURE__ */ __name((r) => "rows" in r && typeof r.rows == "number" ? r.rows : 20, "L");
498
+ function W(r, t, s, e2 = s, i) {
499
+ const n = A(r ?? stdout);
500
+ return wrapAnsi(t, n - s.length, { hard: true, trim: false }).split(`
501
+ `).map((o, u) => {
502
+ const a = i ? i(o, u) : o;
503
+ return `${u === 0 ? e2 : s}${a}`;
504
+ }).join(`
505
+ `);
506
+ }
507
+ __name(W, "W");
508
+ var p = class {
509
+ static {
510
+ __name(this, "p");
511
+ }
512
+ input;
513
+ output;
514
+ _abortSignal;
515
+ rl;
516
+ opts;
517
+ _render;
518
+ _track = false;
519
+ _prevFrame = "";
520
+ _subscribers = /* @__PURE__ */ new Map();
521
+ _cursor = 0;
522
+ state = "initial";
523
+ error = "";
524
+ value;
525
+ userInput = "";
526
+ constructor(t, s = true) {
527
+ const { input: e2 = stdin, output: i = stdout, render: n, signal: o, ...u } = t;
528
+ this.opts = u, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = o, this.input = e2, this.output = i;
529
+ }
530
+ unsubscribe() {
531
+ this._subscribers.clear();
532
+ }
533
+ setSubscriber(t, s) {
534
+ const e2 = this._subscribers.get(t) ?? [];
535
+ e2.push(s), this._subscribers.set(t, e2);
536
+ }
537
+ on(t, s) {
538
+ this.setSubscriber(t, { cb: s });
539
+ }
540
+ once(t, s) {
541
+ this.setSubscriber(t, { cb: s, once: true });
542
+ }
543
+ emit(t, ...s) {
544
+ const e2 = this._subscribers.get(t) ?? [], i = [];
545
+ for (const n of e2) n.cb(...s), n.once && i.push(() => e2.splice(e2.indexOf(n), 1));
546
+ for (const n of i) n();
547
+ }
548
+ prompt() {
549
+ return new Promise((t) => {
550
+ if (this._abortSignal) {
551
+ if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(k);
552
+ this._abortSignal.addEventListener("abort", () => {
553
+ this.state = "cancel", this.close();
554
+ }, { once: true });
555
+ }
556
+ this.rl = b__default.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), w(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
557
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t(this.value);
558
+ }), this.once("cancel", () => {
559
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t(k);
560
+ });
561
+ });
562
+ }
563
+ _isActionKey(t, s) {
564
+ return t === " ";
565
+ }
566
+ _shouldSubmit(t, s) {
567
+ return true;
568
+ }
569
+ _setValue(t) {
570
+ this.value = t, this.emit("value", this.value);
571
+ }
572
+ _setUserInput(t, s) {
573
+ this.userInput = t ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
574
+ }
575
+ _clearUserInput() {
576
+ this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
577
+ }
578
+ onKeypress(t, s) {
579
+ if (this._track && s.name !== "return" && (s.name && this._isActionKey(t, s) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && h.aliases.has(s.name) && this.emit("cursor", h.aliases.get(s.name)), h.actions.has(s.name) && this.emit("cursor", s.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t?.toLowerCase(), s), s?.name === "return" && this._shouldSubmit(t, s)) {
580
+ if (this.opts.validate) {
581
+ const e2 = this.opts.validate(this.value);
582
+ e2 && (this.error = e2 instanceof Error ? e2.message : e2, this.state = "error", this.rl?.write(this.userInput));
583
+ }
584
+ this.state !== "error" && (this.state = "submit");
585
+ }
586
+ C([t, s?.name, s?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
587
+ }
588
+ close() {
589
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
590
+ `), w(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
591
+ }
592
+ restoreCursor() {
593
+ const t = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
594
+ `).length - 1;
595
+ this.output.write(import_sisteransi.cursor.move(-999, t * -1));
596
+ }
597
+ render() {
598
+ const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
599
+ if (t !== this._prevFrame) {
600
+ if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
601
+ else {
602
+ const s = z(this._prevFrame, t), e2 = L(this.output);
603
+ if (this.restoreCursor(), s) {
604
+ const i = Math.max(0, s.numLinesAfter - e2), n = Math.max(0, s.numLinesBefore - e2);
605
+ let o = s.lines.find((u) => u >= i);
606
+ if (o === void 0) {
607
+ this._prevFrame = t;
608
+ return;
609
+ }
610
+ if (s.lines.length === 1) {
611
+ this.output.write(import_sisteransi.cursor.move(0, o - n)), this.output.write(import_sisteransi.erase.lines(1));
612
+ const u = t.split(`
613
+ `);
614
+ this.output.write(u[o]), this._prevFrame = t, this.output.write(import_sisteransi.cursor.move(0, u.length - o - 1));
615
+ return;
616
+ } else if (s.lines.length > 1) {
617
+ if (i < n) o = i;
618
+ else {
619
+ const a = o - n;
620
+ a > 0 && this.output.write(import_sisteransi.cursor.move(0, a));
621
+ }
622
+ this.output.write(import_sisteransi.erase.down());
623
+ const u = t.split(`
624
+ `).slice(o);
625
+ this.output.write(u.join(`
626
+ `)), this._prevFrame = t;
627
+ return;
628
+ }
629
+ }
630
+ this.output.write(import_sisteransi.erase.down());
631
+ }
632
+ this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
633
+ }
634
+ }
635
+ };
636
+ function B(r, t) {
637
+ if (r === void 0 || t.length === 0) return 0;
638
+ const s = t.findIndex((e2) => e2.value === r);
639
+ return s !== -1 ? s : 0;
640
+ }
641
+ __name(B, "B");
642
+ function J(r, t) {
643
+ return (t.label ?? String(t.value)).toLowerCase().includes(r.toLowerCase());
644
+ }
645
+ __name(J, "J");
646
+ function H(r, t) {
647
+ if (t) return r ? t : t[0];
648
+ }
649
+ __name(H, "H");
650
+ var Q = class extends p {
651
+ static {
652
+ __name(this, "Q");
653
+ }
654
+ filteredOptions;
655
+ multiple;
656
+ isNavigating = false;
657
+ selectedValues = [];
658
+ focusedValue;
659
+ #s = 0;
660
+ #r = "";
661
+ #t;
662
+ #n;
663
+ #u;
664
+ get cursor() {
665
+ return this.#s;
666
+ }
667
+ get userInputWithCursor() {
668
+ if (!this.userInput) return styleText(["inverse", "hidden"], "_");
669
+ if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
670
+ const t = this.userInput.slice(0, this._cursor), [s, ...e2] = this.userInput.slice(this._cursor);
671
+ return `${t}${styleText("inverse", s)}${e2.join("")}`;
672
+ }
673
+ get options() {
674
+ return typeof this.#n == "function" ? this.#n() : this.#n;
675
+ }
676
+ constructor(t) {
677
+ super(t), this.#n = t.options, this.#u = t.placeholder;
678
+ const s = this.options;
679
+ this.filteredOptions = [...s], this.multiple = t.multiple === true, this.#t = typeof t.options == "function" ? t.filter : t.filter ?? J;
680
+ let e2;
681
+ if (t.initialValue && Array.isArray(t.initialValue) ? this.multiple ? e2 = t.initialValue : e2 = t.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (e2 = [this.options[0].value]), e2) for (const i of e2) {
682
+ const n = s.findIndex((o) => o.value === i);
683
+ n !== -1 && (this.toggleSelected(i), this.#s = n);
684
+ }
685
+ this.focusedValue = this.options[this.#s]?.value, this.on("key", (i, n) => this.#e(i, n)), this.on("userInput", (i) => this.#i(i));
686
+ }
687
+ _isActionKey(t, s) {
688
+ return t === " " || this.multiple && this.isNavigating && s.name === "space" && t !== void 0 && t !== "";
689
+ }
690
+ #e(t, s) {
691
+ const e2 = s.name === "up", i = s.name === "down", n = s.name === "return", o = this.userInput === "" || this.userInput === " ", u = this.#u, a = this.options, l = u !== void 0 && u !== "" && a.some((f) => !f.disabled && (this.#t ? this.#t(u, f) : true));
692
+ if (s.name === "tab" && o && l) {
693
+ this.userInput === " " && this._clearUserInput(), this._setUserInput(u, true), this.isNavigating = false;
694
+ return;
695
+ }
696
+ e2 || i ? (this.#s = d(this.#s, e2 ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#s]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = H(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== void 0 && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
697
+ }
698
+ deselectAll() {
699
+ this.selectedValues = [];
700
+ }
701
+ toggleSelected(t) {
702
+ this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(t) ? this.selectedValues = this.selectedValues.filter((s) => s !== t) : this.selectedValues = [...this.selectedValues, t] : this.selectedValues = [t]);
703
+ }
704
+ #i(t) {
705
+ if (t !== this.#r) {
706
+ this.#r = t;
707
+ const s = this.options;
708
+ t && this.#t ? this.filteredOptions = s.filter((n) => this.#t?.(t, n)) : this.filteredOptions = [...s];
709
+ const e2 = B(this.focusedValue, this.filteredOptions);
710
+ this.#s = d(e2, 0, this.filteredOptions);
711
+ const i = this.filteredOptions[this.#s];
712
+ i && !i.disabled ? this.focusedValue = i.value : this.focusedValue = void 0, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
713
+ }
714
+ }
715
+ };
716
+ var X = class extends p {
717
+ static {
718
+ __name(this, "X");
719
+ }
720
+ get cursor() {
721
+ return this.value ? 0 : 1;
722
+ }
723
+ get _value() {
724
+ return this.cursor === 0;
725
+ }
726
+ constructor(t) {
727
+ super(t, false), this.value = !!t.initialValue, this.on("userInput", () => {
728
+ this.value = this._value;
729
+ }), this.on("confirm", (s) => {
730
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
731
+ }), this.on("cursor", () => {
732
+ this.value = !this.value;
733
+ });
734
+ }
735
+ };
736
+ var Z = { Y: { type: "year", len: 4 }, M: { type: "month", len: 2 }, D: { type: "day", len: 2 } };
737
+ function P(r) {
738
+ return [...r].map((t) => Z[t]);
739
+ }
740
+ __name(P, "P");
741
+ function tt(r) {
742
+ const t = new Intl.DateTimeFormat(r, { year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(new Date(2e3, 0, 15)), s = [];
743
+ let e2 = "/";
744
+ for (const i of t) i.type === "literal" ? e2 = i.value.trim() || i.value : (i.type === "year" || i.type === "month" || i.type === "day") && s.push({ type: i.type, len: i.type === "year" ? 4 : 2 });
745
+ return { segments: s, separator: e2 };
746
+ }
747
+ __name(tt, "tt");
748
+ function U(r) {
749
+ return Number.parseInt((r || "0").replace(/_/g, "0"), 10) || 0;
750
+ }
751
+ __name(U, "U");
752
+ function x(r) {
753
+ return { year: U(r.year), month: U(r.month), day: U(r.day) };
754
+ }
755
+ __name(x, "x");
756
+ function $(r, t) {
757
+ return new Date(r || 2001, t || 1, 0).getDate();
758
+ }
759
+ __name($, "$");
760
+ function F(r) {
761
+ const { year: t, month: s, day: e2 } = x(r);
762
+ if (!t || t < 0 || t > 9999 || !s || s < 1 || s > 12 || !e2 || e2 < 1) return;
763
+ const i = new Date(Date.UTC(t, s - 1, e2));
764
+ if (!(i.getUTCFullYear() !== t || i.getUTCMonth() !== s - 1 || i.getUTCDate() !== e2)) return { year: t, month: s, day: e2 };
765
+ }
766
+ __name(F, "F");
767
+ function N(r) {
768
+ const t = F(r);
769
+ return t ? new Date(Date.UTC(t.year, t.month - 1, t.day)) : void 0;
770
+ }
771
+ __name(N, "N");
772
+ function st(r, t, s, e2) {
773
+ const i = s ? { year: s.getUTCFullYear(), month: s.getUTCMonth() + 1, day: s.getUTCDate() } : null, n = e2 ? { year: e2.getUTCFullYear(), month: e2.getUTCMonth() + 1, day: e2.getUTCDate() } : null;
774
+ return r === "year" ? { min: i?.year ?? 1, max: n?.year ?? 9999 } : r === "month" ? { min: i && t.year === i.year ? i.month : 1, max: n && t.year === n.year ? n.month : 12 } : { min: i && t.year === i.year && t.month === i.month ? i.day : 1, max: n && t.year === n.year && t.month === n.month ? n.day : $(t.year, t.month) };
775
+ }
776
+ __name(st, "st");
777
+ var et = class extends p {
778
+ static {
779
+ __name(this, "et");
780
+ }
781
+ #s;
782
+ #r;
783
+ #t;
784
+ #n;
785
+ #u;
786
+ #e = { segmentIndex: 0, positionInSegment: 0 };
787
+ #i = true;
788
+ #o = null;
789
+ inlineError = "";
790
+ get segmentCursor() {
791
+ return { ...this.#e };
792
+ }
793
+ get segmentValues() {
794
+ return { ...this.#t };
795
+ }
796
+ get segments() {
797
+ return this.#s;
798
+ }
799
+ get separator() {
800
+ return this.#r;
801
+ }
802
+ get formattedValue() {
803
+ return this.#c(this.#t);
804
+ }
805
+ #c(t) {
806
+ return this.#s.map((s) => t[s.type]).join(this.#r);
807
+ }
808
+ #a() {
809
+ this._setUserInput(this.#c(this.#t)), this._setValue(N(this.#t) ?? void 0);
810
+ }
811
+ constructor(t) {
812
+ const s = t.format ? { segments: P(t.format), separator: t.separator ?? "/" } : tt(t.locale), e2 = t.separator ?? s.separator, i = t.format ? P(t.format) : s.segments, n = t.initialValue ?? t.defaultValue, o = n ? { year: String(n.getUTCFullYear()).padStart(4, "0"), month: String(n.getUTCMonth() + 1).padStart(2, "0"), day: String(n.getUTCDate()).padStart(2, "0") } : { year: "____", month: "__", day: "__" }, u = i.map((a) => o[a.type]).join(e2);
813
+ super({ ...t, initialUserInput: u }, false), this.#s = i, this.#r = e2, this.#t = o, this.#n = t.minDate, this.#u = t.maxDate, this.#a(), this.on("cursor", (a) => this.#d(a)), this.on("key", (a, l) => this.#f(a, l)), this.on("finalize", () => this.#g(t));
814
+ }
815
+ #h() {
816
+ const t = Math.max(0, Math.min(this.#e.segmentIndex, this.#s.length - 1)), s = this.#s[t];
817
+ if (s) return this.#e.positionInSegment = Math.max(0, Math.min(this.#e.positionInSegment, s.len - 1)), { segment: s, index: t };
818
+ }
819
+ #l(t) {
820
+ this.inlineError = "", this.#o = null;
821
+ const s = this.#h();
822
+ s && (this.#e.segmentIndex = Math.max(0, Math.min(this.#s.length - 1, s.index + t)), this.#e.positionInSegment = 0, this.#i = true);
823
+ }
824
+ #p(t) {
825
+ const s = this.#h();
826
+ if (!s) return;
827
+ const { segment: e2 } = s, i = this.#t[e2.type], n = !i || i.replace(/_/g, "") === "", o = Number.parseInt((i || "0").replace(/_/g, "0"), 10) || 0, u = st(e2.type, x(this.#t), this.#n, this.#u);
828
+ let a;
829
+ n ? a = t === 1 ? u.min : u.max : a = Math.max(Math.min(u.max, o + t), u.min), this.#t = { ...this.#t, [e2.type]: a.toString().padStart(e2.len, "0") }, this.#i = true, this.#o = null, this.#a();
830
+ }
831
+ #d(t) {
832
+ if (t) switch (t) {
833
+ case "right":
834
+ return this.#l(1);
835
+ case "left":
836
+ return this.#l(-1);
837
+ case "up":
838
+ return this.#p(1);
839
+ case "down":
840
+ return this.#p(-1);
841
+ }
842
+ }
843
+ #f(t, s) {
844
+ if (s?.name === "backspace" || s?.sequence === "\x7F" || s?.sequence === "\b" || t === "\x7F" || t === "\b") {
845
+ this.inlineError = "";
846
+ const e2 = this.#h();
847
+ if (!e2) return;
848
+ if (!this.#t[e2.segment.type].replace(/_/g, "")) {
849
+ this.#l(-1);
850
+ return;
851
+ }
852
+ this.#t[e2.segment.type] = "_".repeat(e2.segment.len), this.#i = true, this.#e.positionInSegment = 0, this.#a();
853
+ return;
854
+ }
855
+ if (s?.name === "tab") {
856
+ this.inlineError = "";
857
+ const e2 = this.#h();
858
+ if (!e2) return;
859
+ const i = s.shift ? -1 : 1, n = e2.index + i;
860
+ n >= 0 && n < this.#s.length && (this.#e.segmentIndex = n, this.#e.positionInSegment = 0, this.#i = true);
861
+ return;
862
+ }
863
+ if (t && /^[0-9]$/.test(t)) {
864
+ const e2 = this.#h();
865
+ if (!e2) return;
866
+ const { segment: i } = e2, n = !this.#t[i.type].replace(/_/g, "");
867
+ if (this.#i && this.#o !== null && !n) {
868
+ const m = this.#o + t, g = { ...this.#t, [i.type]: m }, _ = this.#m(g, i);
869
+ if (_) {
870
+ this.inlineError = _, this.#o = null, this.#i = false;
871
+ return;
872
+ }
873
+ this.inlineError = "", this.#t[i.type] = m, this.#o = null, this.#i = false, this.#a(), e2.index < this.#s.length - 1 && (this.#e.segmentIndex = e2.index + 1, this.#e.positionInSegment = 0, this.#i = true);
874
+ return;
875
+ }
876
+ this.#i && !n && (this.#t[i.type] = "_".repeat(i.len), this.#e.positionInSegment = 0), this.#i = false, this.#o = null;
877
+ const o = this.#t[i.type], u = o.indexOf("_"), a = u >= 0 ? u : Math.min(this.#e.positionInSegment, i.len - 1);
878
+ if (a < 0 || a >= i.len) return;
879
+ let l = o.slice(0, a) + t + o.slice(a + 1), f = false;
880
+ if (a === 0 && o === "__" && (i.type === "month" || i.type === "day")) {
881
+ const m = Number.parseInt(t, 10);
882
+ l = `0${t}`, f = m <= (i.type === "month" ? 1 : 2);
883
+ }
884
+ if (i.type === "year" && (l = (o.replace(/_/g, "") + t).padStart(i.len, "_")), !l.includes("_")) {
885
+ const m = { ...this.#t, [i.type]: l }, g = this.#m(m, i);
886
+ if (g) {
887
+ this.inlineError = g;
888
+ return;
889
+ }
890
+ }
891
+ this.inlineError = "", this.#t[i.type] = l;
892
+ const y = l.includes("_") ? void 0 : F(this.#t);
893
+ if (y) {
894
+ const { year: m, month: g } = y, _ = $(m, g);
895
+ this.#t = { year: String(Math.max(0, Math.min(9999, m))).padStart(4, "0"), month: String(Math.max(1, Math.min(12, g))).padStart(2, "0"), day: String(Math.max(1, Math.min(_, y.day))).padStart(2, "0") };
896
+ }
897
+ this.#a();
898
+ const T = l.indexOf("_");
899
+ f ? (this.#i = true, this.#o = t) : T >= 0 ? this.#e.positionInSegment = T : u >= 0 && e2.index < this.#s.length - 1 ? (this.#e.segmentIndex = e2.index + 1, this.#e.positionInSegment = 0, this.#i = true) : this.#e.positionInSegment = Math.min(a + 1, i.len - 1);
900
+ }
901
+ }
902
+ #m(t, s) {
903
+ const { month: e2, day: i } = x(t);
904
+ if (s.type === "month" && (e2 < 0 || e2 > 12)) return h.date.messages.invalidMonth;
905
+ if (s.type === "day" && (i < 0 || i > 31)) return h.date.messages.invalidDay(31, "any month");
906
+ }
907
+ #g(t) {
908
+ const { year: s, month: e2, day: i } = x(this.#t);
909
+ if (s && e2 && i) {
910
+ const n = $(s, e2);
911
+ this.#t = { ...this.#t, day: String(Math.min(i, n)).padStart(2, "0") };
912
+ }
913
+ this.value = N(this.#t) ?? t.defaultValue ?? void 0;
914
+ }
915
+ };
916
+ var it = class extends p {
917
+ static {
918
+ __name(this, "it");
919
+ }
920
+ options;
921
+ cursor = 0;
922
+ #s;
923
+ getGroupItems(t) {
924
+ return this.options.filter((s) => s.group === t);
925
+ }
926
+ isGroupSelected(t) {
927
+ const s = this.getGroupItems(t), e2 = this.value;
928
+ return e2 === void 0 ? false : s.every((i) => e2.includes(i.value));
929
+ }
930
+ toggleValue() {
931
+ const t = this.options[this.cursor];
932
+ if (this.value === void 0 && (this.value = []), t.group === true) {
933
+ const s = t.value, e2 = this.getGroupItems(s);
934
+ this.isGroupSelected(s) ? this.value = this.value.filter((i) => e2.findIndex((n) => n.value === i) === -1) : this.value = [...this.value, ...e2.map((i) => i.value)], this.value = Array.from(new Set(this.value));
935
+ } else {
936
+ const s = this.value.includes(t.value);
937
+ this.value = s ? this.value.filter((e2) => e2 !== t.value) : [...this.value, t.value];
938
+ }
939
+ }
940
+ constructor(t) {
941
+ super(t, false);
942
+ const { options: s } = t;
943
+ this.#s = t.selectableGroups !== false, this.options = Object.entries(s).flatMap(([e2, i]) => [{ value: e2, group: true, label: e2 }, ...i.map((n) => ({ ...n, group: e2 }))]), this.value = [...t.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: e2 }) => e2 === t.cursorAt), this.#s ? 0 : 1), this.on("cursor", (e2) => {
944
+ switch (e2) {
945
+ case "left":
946
+ case "up": {
947
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
948
+ const i = this.options[this.cursor]?.group === true;
949
+ !this.#s && i && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
950
+ break;
951
+ }
952
+ case "down":
953
+ case "right": {
954
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
955
+ const i = this.options[this.cursor]?.group === true;
956
+ !this.#s && i && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
957
+ break;
958
+ }
959
+ case "space":
960
+ this.toggleValue();
961
+ break;
962
+ }
963
+ });
964
+ }
965
+ };
966
+ var rt = class extends p {
967
+ static {
968
+ __name(this, "rt");
969
+ }
970
+ #s = false;
971
+ #r;
972
+ focused = "editor";
973
+ get userInputWithCursor() {
974
+ if (this.state === "submit") return this.userInput;
975
+ const t = this.userInput;
976
+ if (this.cursor >= t.length) return `${t}\u2588`;
977
+ const s = t.slice(0, this.cursor), e2 = t[this.cursor], i = t.slice(this.cursor + 1);
978
+ return e2 === `
979
+ ` ? `${s}\u2588
980
+ ${i}` : `${s}${styleText("inverse", e2)}${i}`;
981
+ }
982
+ get cursor() {
983
+ return this._cursor;
984
+ }
985
+ #t(t) {
986
+ if (this.userInput.length === 0) {
987
+ this._setUserInput(t);
988
+ return;
989
+ }
990
+ this._setUserInput(this.userInput.slice(0, this.cursor) + t + this.userInput.slice(this.cursor));
991
+ }
992
+ #n(t) {
993
+ const s = this.value ?? "";
994
+ switch (t) {
995
+ case "up":
996
+ this._cursor = I(this._cursor, 0, -1, s);
997
+ return;
998
+ case "down":
999
+ this._cursor = I(this._cursor, 0, 1, s);
1000
+ return;
1001
+ case "left":
1002
+ this._cursor = I(this._cursor, -1, 0, s);
1003
+ return;
1004
+ case "right":
1005
+ this._cursor = I(this._cursor, 1, 0, s);
1006
+ return;
1007
+ }
1008
+ }
1009
+ _shouldSubmit(t, s) {
1010
+ if (this.#r) return this.focused === "submit" ? true : (this.#t(`
1011
+ `), this._cursor++, false);
1012
+ const e2 = this.#s;
1013
+ return this.#s = true, e2 ? (this.userInput[this.cursor - 1] === `
1014
+ ` && (this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--), true) : (this.#t(`
1015
+ `), this._cursor++, false);
1016
+ }
1017
+ constructor(t) {
1018
+ super(t, false), this.#r = t.showSubmit ?? false, this.on("key", (s, e2) => {
1019
+ if (e2?.name && h.actions.has(e2.name)) {
1020
+ this.#n(e2.name);
1021
+ return;
1022
+ }
1023
+ if (s === " " && this.#r) {
1024
+ this.focused = this.focused === "editor" ? "submit" : "editor";
1025
+ return;
1026
+ }
1027
+ if (e2?.name !== "return") {
1028
+ if (this.#s = false, e2?.name === "backspace" && this.cursor > 0) {
1029
+ this._setUserInput(this.userInput.slice(0, this.cursor - 1) + this.userInput.slice(this.cursor)), this._cursor--;
1030
+ return;
1031
+ }
1032
+ if (e2?.name === "delete" && this.cursor < this.userInput.length) {
1033
+ this._setUserInput(this.userInput.slice(0, this.cursor) + this.userInput.slice(this.cursor + 1));
1034
+ return;
1035
+ }
1036
+ s && (this.#r && this.focused === "submit" && (this.focused = "editor"), this.#t(s ?? ""), this._cursor++);
1037
+ }
1038
+ }), this.on("userInput", (s) => {
1039
+ this._setValue(s);
1040
+ }), this.on("finalize", () => {
1041
+ this.value || (this.value = t.defaultValue), this.value === void 0 && (this.value = "");
1042
+ });
1043
+ }
1044
+ };
1045
+ var nt = class extends p {
1046
+ static {
1047
+ __name(this, "nt");
1048
+ }
1049
+ options;
1050
+ cursor = 0;
1051
+ get _value() {
1052
+ return this.options[this.cursor].value;
1053
+ }
1054
+ get _enabledOptions() {
1055
+ return this.options.filter((t) => t.disabled !== true);
1056
+ }
1057
+ toggleAll() {
1058
+ const t = this._enabledOptions, s = this.value !== void 0 && this.value.length === t.length;
1059
+ this.value = s ? [] : t.map((e2) => e2.value);
1060
+ }
1061
+ toggleInvert() {
1062
+ const t = this.value;
1063
+ if (!t) return;
1064
+ const s = this._enabledOptions.filter((e2) => !t.includes(e2.value));
1065
+ this.value = s.map((e2) => e2.value);
1066
+ }
1067
+ toggleValue() {
1068
+ this.value === void 0 && (this.value = []);
1069
+ const t = this.value.includes(this._value);
1070
+ this.value = t ? this.value.filter((s) => s !== this._value) : [...this.value, this._value];
1071
+ }
1072
+ constructor(t) {
1073
+ super(t, false), this.options = t.options, this.value = [...t.initialValues ?? []];
1074
+ const s = Math.max(this.options.findIndex(({ value: e2 }) => e2 === t.cursorAt), 0);
1075
+ this.cursor = this.options[s].disabled ? d(s, 1, this.options) : s, this.on("key", (e2) => {
1076
+ e2 === "a" && this.toggleAll(), e2 === "i" && this.toggleInvert();
1077
+ }), this.on("cursor", (e2) => {
1078
+ switch (e2) {
1079
+ case "left":
1080
+ case "up":
1081
+ this.cursor = d(this.cursor, -1, this.options);
1082
+ break;
1083
+ case "down":
1084
+ case "right":
1085
+ this.cursor = d(this.cursor, 1, this.options);
1086
+ break;
1087
+ case "space":
1088
+ this.toggleValue();
1089
+ break;
1090
+ }
1091
+ });
1092
+ }
1093
+ };
1094
+ var ot = class extends p {
1095
+ static {
1096
+ __name(this, "ot");
1097
+ }
1098
+ _mask = "\u2022";
1099
+ get cursor() {
1100
+ return this._cursor;
1101
+ }
1102
+ get masked() {
1103
+ return this.userInput.replaceAll(/./g, this._mask);
1104
+ }
1105
+ get userInputWithCursor() {
1106
+ if (this.state === "submit" || this.state === "cancel") return this.masked;
1107
+ const t = this.userInput;
1108
+ if (this.cursor >= t.length) return `${this.masked}${styleText(["inverse", "hidden"], "_")}`;
1109
+ const s = this.masked, e2 = s.slice(0, this.cursor), i = s.slice(this.cursor);
1110
+ return `${e2}${styleText("inverse", i[0])}${i.slice(1)}`;
1111
+ }
1112
+ clear() {
1113
+ this._clearUserInput();
1114
+ }
1115
+ constructor({ mask: t, ...s }) {
1116
+ super(s), this._mask = t ?? "\u2022", this.on("userInput", (e2) => {
1117
+ this._setValue(e2);
1118
+ });
1119
+ }
1120
+ };
1121
+ var ut = class extends p {
1122
+ static {
1123
+ __name(this, "ut");
1124
+ }
1125
+ options;
1126
+ cursor = 0;
1127
+ get _selectedValue() {
1128
+ return this.options[this.cursor];
1129
+ }
1130
+ changeValue() {
1131
+ this.value = this._selectedValue.value;
1132
+ }
1133
+ constructor(t) {
1134
+ super(t, false), this.options = t.options;
1135
+ const s = this.options.findIndex(({ value: i }) => i === t.initialValue), e2 = s === -1 ? 0 : s;
1136
+ this.cursor = this.options[e2].disabled ? d(e2, 1, this.options) : e2, this.changeValue(), this.on("cursor", (i) => {
1137
+ switch (i) {
1138
+ case "left":
1139
+ case "up":
1140
+ this.cursor = d(this.cursor, -1, this.options);
1141
+ break;
1142
+ case "down":
1143
+ case "right":
1144
+ this.cursor = d(this.cursor, 1, this.options);
1145
+ break;
1146
+ }
1147
+ this.changeValue();
1148
+ });
1149
+ }
1150
+ };
1151
+ var at = class extends p {
1152
+ static {
1153
+ __name(this, "at");
1154
+ }
1155
+ options;
1156
+ cursor = 0;
1157
+ constructor(t) {
1158
+ super(t, false), this.options = t.options;
1159
+ const s = t.caseSensitive === true, e2 = this.options.map(({ value: [i] }) => s ? i : i?.toLowerCase());
1160
+ this.cursor = Math.max(e2.indexOf(t.initialValue), 0), this.on("key", (i, n) => {
1161
+ if (!i) return;
1162
+ const o = s && n.shift ? i.toUpperCase() : i;
1163
+ if (!e2.includes(o)) return;
1164
+ const u = this.options.find(({ value: [a] }) => s ? a === o : a?.toLowerCase() === i);
1165
+ u && (this.value = u.value, this.state = "submit", this.emit("submit"));
1166
+ });
1167
+ }
1168
+ };
1169
+ var ht = class extends p {
1170
+ static {
1171
+ __name(this, "ht");
1172
+ }
1173
+ get userInputWithCursor() {
1174
+ if (this.state === "submit") return this.userInput;
1175
+ const t = this.userInput;
1176
+ if (this.cursor >= t.length) return `${this.userInput}\u2588`;
1177
+ const s = t.slice(0, this.cursor), [e2, ...i] = t.slice(this.cursor);
1178
+ return `${s}${styleText("inverse", e2)}${i.join("")}`;
1179
+ }
1180
+ get cursor() {
1181
+ return this._cursor;
1182
+ }
1183
+ constructor(t) {
1184
+ super({ ...t, initialUserInput: t.initialUserInput ?? t.initialValue }), this.on("userInput", (s) => {
1185
+ this._setValue(s);
1186
+ }), this.on("finalize", () => {
1187
+ this.value || (this.value = t.defaultValue), this.value === void 0 && (this.value = "");
1188
+ });
1189
+ }
1190
+ };
1191
+ var import_sisteransi2 = __toESM(require_src(), 1);
1192
+ function te() {
1193
+ return j2.platform !== "win32" ? j2.env.TERM !== "linux" : !!j2.env.CI || !!j2.env.WT_SESSION || !!j2.env.TERMINUS_SUBLIME || j2.env.ConEmuTask === "{cmd::Cmder}" || j2.env.TERM_PROGRAM === "Terminus-Sublime" || j2.env.TERM_PROGRAM === "vscode" || j2.env.TERM === "xterm-256color" || j2.env.TERM === "alacritty" || j2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
1194
+ }
1195
+ __name(te, "te");
1196
+ var tt2 = te();
1197
+ var at2 = /* @__PURE__ */ __name(() => process.env.CI === "true", "at");
1198
+ var Tt = /* @__PURE__ */ __name((t) => t.isTTY === true, "Tt");
1199
+ var w2 = /* @__PURE__ */ __name((t, r) => tt2 ? t : r, "w");
1200
+ var _t = w2("\u25C6", "*");
1201
+ var ot2 = w2("\u25A0", "x");
1202
+ var ut2 = w2("\u25B2", "x");
1203
+ var F2 = w2("\u25C7", "o");
1204
+ var lt = w2("\u250C", "T");
1205
+ var $2 = w2("\u2502", "|");
1206
+ var E2 = w2("\u2514", "\u2014");
1207
+ var It = w2("\u2510", "T");
1208
+ var Et = w2("\u2518", "\u2014");
1209
+ var z2 = w2("\u25CF", ">");
1210
+ var H2 = w2("\u25CB", " ");
1211
+ var et2 = w2("\u25FB", "[\u2022]");
1212
+ var U2 = w2("\u25FC", "[+]");
1213
+ var J2 = w2("\u25FB", "[ ]");
1214
+ var Gt = w2("\u25AA", "\u2022");
1215
+ var st2 = w2("\u2500", "-");
1216
+ var ct = w2("\u256E", "+");
1217
+ var xt = w2("\u251C", "+");
1218
+ var $t = w2("\u256F", "+");
1219
+ var dt = w2("\u2570", "+");
1220
+ var Ot = w2("\u256D", "+");
1221
+ var ht2 = w2("\u25CF", "\u2022");
1222
+ var pt = w2("\u25C6", "*");
1223
+ var mt = w2("\u25B2", "!");
1224
+ var gt = w2("\u25A0", "x");
1225
+ var M = /* @__PURE__ */ __name((t) => {
1226
+ switch (t) {
1227
+ case "initial":
1228
+ case "active":
1229
+ return styleText("cyan", _t);
1230
+ case "cancel":
1231
+ return styleText("red", ot2);
1232
+ case "error":
1233
+ return styleText("yellow", ut2);
1234
+ case "submit":
1235
+ return styleText("green", F2);
1236
+ }
1237
+ }, "M");
1238
+ var yt = /* @__PURE__ */ __name((t) => {
1239
+ switch (t) {
1240
+ case "initial":
1241
+ case "active":
1242
+ return styleText("cyan", $2);
1243
+ case "cancel":
1244
+ return styleText("red", $2);
1245
+ case "error":
1246
+ return styleText("yellow", $2);
1247
+ case "submit":
1248
+ return styleText("green", $2);
1249
+ }
1250
+ }, "yt");
1251
+ var ee = /* @__PURE__ */ __name((t, r, s, i, u) => {
1252
+ let n = r, o = 0;
1253
+ for (let c2 = s; c2 < i; c2++) {
1254
+ const a = t[c2];
1255
+ if (n = n - a.length, o++, n <= u) break;
1256
+ }
1257
+ return { lineCount: n, removals: o };
1258
+ }, "ee");
1259
+ var Y2 = /* @__PURE__ */ __name(({ cursor: t, options: r, style: s, output: i = process.stdout, maxItems: u = Number.POSITIVE_INFINITY, columnPadding: n = 0, rowPadding: o = 4 }) => {
1260
+ const c2 = A(i) - n, a = L(i), l = styleText("dim", "..."), d2 = Math.max(a - o, 0), y = Math.max(Math.min(u, d2), 5);
1261
+ let p2 = 0;
1262
+ t >= y - 3 && (p2 = Math.max(Math.min(t - y + 3, r.length - y), 0));
1263
+ let m = y < r.length && p2 > 0, g = y < r.length && p2 + y < r.length;
1264
+ const S2 = Math.min(p2 + y, r.length), h2 = [];
1265
+ let f = 0;
1266
+ m && f++, g && f++;
1267
+ const v2 = p2 + (m ? 1 : 0), T = S2 - (g ? 1 : 0);
1268
+ for (let b2 = v2; b2 < T; b2++) {
1269
+ const G2 = wrapAnsi(s(r[b2], b2 === t), c2, { hard: true, trim: false }).split(`
1270
+ `);
1271
+ h2.push(G2), f += G2.length;
1272
+ }
1273
+ if (f > d2) {
1274
+ let b2 = 0, G2 = 0, x2 = f;
1275
+ const A2 = t - v2, P2 = /* @__PURE__ */ __name((N2, D2) => ee(h2, x2, N2, D2, d2), "P");
1276
+ m ? ({ lineCount: x2, removals: b2 } = P2(0, A2), x2 > d2 && ({ lineCount: x2, removals: G2 } = P2(A2 + 1, h2.length))) : ({ lineCount: x2, removals: G2 } = P2(A2 + 1, h2.length), x2 > d2 && ({ lineCount: x2, removals: b2 } = P2(0, A2))), b2 > 0 && (m = true, h2.splice(0, b2)), G2 > 0 && (g = true, h2.splice(h2.length - G2, G2));
1277
+ }
1278
+ const C2 = [];
1279
+ m && C2.push(l);
1280
+ for (const b2 of h2) for (const G2 of b2) C2.push(G2);
1281
+ return g && C2.push(l), C2;
1282
+ }, "Y");
1283
+ function Mt(t) {
1284
+ return t.label ?? String(t.value ?? "");
1285
+ }
1286
+ __name(Mt, "Mt");
1287
+ function Rt(t, r) {
1288
+ if (!t) return true;
1289
+ const s = (r.label ?? String(r.value ?? "")).toLowerCase(), i = (r.hint ?? "").toLowerCase(), u = String(r.value).toLowerCase(), n = t.toLowerCase();
1290
+ return s.includes(n) || i.includes(n) || u.includes(n);
1291
+ }
1292
+ __name(Rt, "Rt");
1293
+ function se(t, r) {
1294
+ const s = [];
1295
+ for (const i of r) t.includes(i.value) && s.push(i);
1296
+ return s;
1297
+ }
1298
+ __name(se, "se");
1299
+ var At = /* @__PURE__ */ __name((t) => new Q({ options: t.options, initialValue: t.initialValue ? [t.initialValue] : void 0, initialUserInput: t.initialUserInput, placeholder: t.placeholder, filter: t.filter ?? ((r, s) => Rt(r, s)), signal: t.signal, input: t.input, output: t.output, validate: t.validate, render() {
1300
+ const r = t.withGuide ?? h.withGuide, s = r ? [`${styleText("gray", $2)}`, `${M(this.state)} ${t.message}`] : [`${M(this.state)} ${t.message}`], i = this.userInput, u = this.options, n = t.placeholder, o = i === "" && n !== void 0, c2 = /* @__PURE__ */ __name((a, l) => {
1301
+ const d2 = Mt(a), y = a.hint && a.value === this.focusedValue ? styleText("dim", ` (${a.hint})`) : "";
1302
+ switch (l) {
1303
+ case "active":
1304
+ return `${styleText("green", z2)} ${d2}${y}`;
1305
+ case "inactive":
1306
+ return `${styleText("dim", H2)} ${styleText("dim", d2)}`;
1307
+ case "disabled":
1308
+ return `${styleText("gray", H2)} ${styleText(["strikethrough", "gray"], d2)}`;
1309
+ }
1310
+ }, "c");
1311
+ switch (this.state) {
1312
+ case "submit": {
1313
+ const a = se(this.selectedValues, u), l = a.length > 0 ? ` ${styleText("dim", a.map(Mt).join(", "))}` : "", d2 = r ? styleText("gray", $2) : "";
1314
+ return `${s.join(`
1315
+ `)}
1316
+ ${d2}${l}`;
1317
+ }
1318
+ case "cancel": {
1319
+ const a = i ? ` ${styleText(["strikethrough", "dim"], i)}` : "", l = r ? styleText("gray", $2) : "";
1320
+ return `${s.join(`
1321
+ `)}
1322
+ ${l}${a}`;
1323
+ }
1324
+ default: {
1325
+ const a = this.state === "error" ? "yellow" : "cyan", l = r ? `${styleText(a, $2)} ` : "", d2 = r ? styleText(a, E2) : "";
1326
+ let y = "";
1327
+ if (this.isNavigating || o) {
1328
+ const v2 = o ? n : i;
1329
+ y = v2 !== "" ? ` ${styleText("dim", v2)}` : "";
1330
+ } else y = ` ${this.userInputWithCursor}`;
1331
+ const p2 = this.filteredOptions.length !== u.length ? styleText("dim", ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", m = this.filteredOptions.length === 0 && i ? [`${l}${styleText("yellow", "No matches found")}`] : [], g = this.state === "error" ? [`${l}${styleText("yellow", this.error)}`] : [];
1332
+ r && s.push(`${l.trimEnd()}`), s.push(`${l}${styleText("dim", "Search:")}${y}${p2}`, ...m, ...g);
1333
+ const S2 = [`${styleText("dim", "\u2191/\u2193")} to select`, `${styleText("dim", "Enter:")} confirm`, `${styleText("dim", "Type:")} to search`], h2 = [`${l}${S2.join(" \u2022 ")}`, d2], f = this.filteredOptions.length === 0 ? [] : Y2({ cursor: this.cursor, options: this.filteredOptions, columnPadding: r ? 3 : 0, rowPadding: s.length + h2.length, style: /* @__PURE__ */ __name((v2, T) => c2(v2, v2.disabled ? "disabled" : T ? "active" : "inactive"), "style"), maxItems: t.maxItems, output: t.output });
1334
+ return [...s, ...f.map((v2) => `${l}${v2}`), ...h2].join(`
1335
+ `);
1336
+ }
1337
+ }
1338
+ } }).prompt(), "At");
1339
+ var ie = /* @__PURE__ */ __name((t) => {
1340
+ const r = /* @__PURE__ */ __name((i, u, n, o) => {
1341
+ const c2 = n.includes(i.value), a = i.label ?? String(i.value ?? ""), l = i.hint && o !== void 0 && i.value === o ? styleText("dim", ` (${i.hint})`) : "", d2 = c2 ? styleText("green", U2) : styleText("dim", J2);
1342
+ return i.disabled ? `${styleText("gray", J2)} ${styleText(["strikethrough", "gray"], a)}` : u ? `${d2} ${a}${l}` : `${d2} ${styleText("dim", a)}`;
1343
+ }, "r"), s = new Q({ options: t.options, multiple: true, placeholder: t.placeholder, filter: t.filter ?? ((i, u) => Rt(i, u)), validate: /* @__PURE__ */ __name(() => {
1344
+ if (t.required && s.selectedValues.length === 0) return "Please select at least one item";
1345
+ }, "validate"), initialValue: t.initialValues, signal: t.signal, input: t.input, output: t.output, render() {
1346
+ const i = t.withGuide ?? h.withGuide, u = `${i ? `${styleText("gray", $2)}
1347
+ ` : ""}${M(this.state)} ${t.message}
1348
+ `, n = this.userInput, o = t.placeholder, c2 = n === "" && o !== void 0, a = this.isNavigating || c2 ? styleText("dim", c2 ? o : n) : this.userInputWithCursor, l = this.options, d2 = this.filteredOptions.length !== l.length ? styleText("dim", ` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "";
1349
+ switch (this.state) {
1350
+ case "submit":
1351
+ return `${u}${i ? `${styleText("gray", $2)} ` : ""}${styleText("dim", `${this.selectedValues.length} items selected`)}`;
1352
+ case "cancel":
1353
+ return `${u}${i ? `${styleText("gray", $2)} ` : ""}${styleText(["strikethrough", "dim"], n)}`;
1354
+ default: {
1355
+ const y = this.state === "error" ? "yellow" : "cyan", p2 = i ? `${styleText(y, $2)} ` : "", m = i ? styleText(y, E2) : "", g = [`${styleText("dim", "\u2191/\u2193")} to navigate`, `${styleText("dim", this.isNavigating ? "Space/Tab:" : "Tab:")} select`, `${styleText("dim", "Enter:")} confirm`, `${styleText("dim", "Type:")} to search`], S2 = this.filteredOptions.length === 0 && n ? [`${p2}${styleText("yellow", "No matches found")}`] : [], h2 = this.state === "error" ? [`${p2}${styleText("yellow", this.error)}`] : [], f = [...`${u}${i ? styleText(y, $2) : ""}`.split(`
1356
+ `), `${p2}${styleText("dim", "Search:")} ${a}${d2}`, ...S2, ...h2], v2 = [`${p2}${g.join(" \u2022 ")}`, m], T = Y2({ cursor: this.cursor, options: this.filteredOptions, style: /* @__PURE__ */ __name((C2, b2) => r(C2, b2, this.selectedValues, this.focusedValue), "style"), maxItems: t.maxItems, output: t.output, rowPadding: f.length + v2.length });
1357
+ return [...f, ...T.map((C2) => `${p2}${C2}`), ...v2].join(`
1358
+ `);
1359
+ }
1360
+ }
1361
+ } });
1362
+ return s.prompt();
1363
+ }, "ie");
1364
+ var re = [Ot, ct, dt, $t];
1365
+ var ne = [lt, It, E2, Et];
1366
+ function Pt(t, r, s, i) {
1367
+ let u = s, n = s;
1368
+ return i === "center" ? u = Math.floor((r - t) / 2) : i === "right" && (u = r - t - s), n = r - u - t, [u, n];
1369
+ }
1370
+ __name(Pt, "Pt");
1371
+ var ae = /* @__PURE__ */ __name((t) => t, "ae");
1372
+ var oe = /* @__PURE__ */ __name((t = "", r = "", s) => {
1373
+ const i = s?.output ?? process.stdout, u = A(i), n = 2, o = s?.titlePadding ?? 1, c2 = s?.contentPadding ?? 2, a = s?.width === void 0 || s.width === "auto" ? 1 : Math.min(1, s.width), l = s?.withGuide ?? h.withGuide ? `${$2} ` : "", d2 = s?.formatBorder ?? ae, y = (s?.rounded ? re : ne).map(d2), p2 = d2(st2), m = d2($2), g = dist_default2(l), S2 = dist_default2(r), h2 = u - g;
1374
+ let f = Math.floor(u * a) - g;
1375
+ if (s?.width === "auto") {
1376
+ const P2 = t.split(`
1377
+ `);
1378
+ let N2 = S2 + o * 2;
1379
+ for (const rt2 of P2) {
1380
+ const W2 = dist_default2(rt2) + c2 * 2;
1381
+ W2 > N2 && (N2 = W2);
1382
+ }
1383
+ const D2 = N2 + n;
1384
+ D2 < f && (f = D2);
1385
+ }
1386
+ f % 2 !== 0 && (f < h2 ? f++ : f--);
1387
+ const v2 = f - n, T = v2 - o * 2, C2 = S2 > T ? `${r.slice(0, T - 3)}...` : r, [b2, G2] = Pt(dist_default2(C2), v2, o, s?.titleAlign), x2 = wrapAnsi(t, v2 - c2 * 2, { hard: true, trim: false });
1388
+ i.write(`${l}${y[0]}${p2.repeat(b2)}${C2}${p2.repeat(G2)}${y[1]}
1389
+ `);
1390
+ const A2 = x2.split(`
1391
+ `);
1392
+ for (const P2 of A2) {
1393
+ const [N2, D2] = Pt(dist_default2(P2), v2, c2, s?.contentAlign);
1394
+ i.write(`${l}${m}${" ".repeat(N2)}${P2}${" ".repeat(D2)}${m}
1395
+ `);
1396
+ }
1397
+ i.write(`${l}${y[2]}${p2.repeat(v2)}${y[3]}
1398
+ `);
1399
+ }, "oe");
1400
+ var ue = /* @__PURE__ */ __name((t) => {
1401
+ const r = t.active ?? "Yes", s = t.inactive ?? "No";
1402
+ return new X({ active: r, inactive: s, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue ?? true, render() {
1403
+ const i = t.withGuide ?? h.withGuide, u = `${M(this.state)} `, n = i ? `${styleText("gray", $2)} ` : "", o = W(t.output, t.message, n, u), c2 = `${i ? `${styleText("gray", $2)}
1404
+ ` : ""}${o}
1405
+ `, a = this.value ? r : s;
1406
+ switch (this.state) {
1407
+ case "submit": {
1408
+ const l = i ? `${styleText("gray", $2)} ` : "";
1409
+ return `${c2}${l}${styleText("dim", a)}`;
1410
+ }
1411
+ case "cancel": {
1412
+ const l = i ? `${styleText("gray", $2)} ` : "";
1413
+ return `${c2}${l}${styleText(["strikethrough", "dim"], a)}${i ? `
1414
+ ${styleText("gray", $2)}` : ""}`;
1415
+ }
1416
+ default: {
1417
+ const l = i ? `${styleText("cyan", $2)} ` : "", d2 = i ? styleText("cyan", E2) : "";
1418
+ return `${c2}${l}${this.value ? `${styleText("green", z2)} ${r}` : `${styleText("dim", H2)} ${styleText("dim", r)}`}${t.vertical ? i ? `
1419
+ ${styleText("cyan", $2)} ` : `
1420
+ ` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", H2)} ${styleText("dim", s)}` : `${styleText("green", z2)} ${s}`}
1421
+ ${d2}
1422
+ `;
1423
+ }
1424
+ }
1425
+ } }).prompt();
1426
+ }, "ue");
1427
+ var le = /* @__PURE__ */ __name((t) => {
1428
+ const r = t.validate;
1429
+ return new et({ ...t, validate(s) {
1430
+ if (s === void 0) return t.defaultValue !== void 0 ? void 0 : r ? r(s) : h.date.messages.required;
1431
+ const i = /* @__PURE__ */ __name((u) => u.toISOString().slice(0, 10), "i");
1432
+ if (t.minDate && i(s) < i(t.minDate)) return h.date.messages.afterMin(t.minDate);
1433
+ if (t.maxDate && i(s) > i(t.maxDate)) return h.date.messages.beforeMax(t.maxDate);
1434
+ if (r) return r(s);
1435
+ }, render() {
1436
+ const s = (t?.withGuide ?? h.withGuide) !== false, i = `${`${s ? `${styleText("gray", $2)}
1437
+ ` : ""}${M(this.state)} `}${t.message}
1438
+ `, u = this.state !== "initial" ? this.state : "active", n = ce(this, u), o = this.value instanceof Date ? this.formattedValue : "";
1439
+ switch (this.state) {
1440
+ case "error": {
1441
+ const c2 = this.error ? ` ${styleText("yellow", this.error)}` : "", a = s ? `${styleText("yellow", $2)} ` : "", l = s ? styleText("yellow", E2) : "";
1442
+ return `${i.trim()}
1443
+ ${a}${n}
1444
+ ${l}${c2}
1445
+ `;
1446
+ }
1447
+ case "submit": {
1448
+ const c2 = o ? ` ${styleText("dim", o)}` : "", a = s ? styleText("gray", $2) : "";
1449
+ return `${i}${a}${c2}`;
1450
+ }
1451
+ case "cancel": {
1452
+ const c2 = o ? ` ${styleText(["strikethrough", "dim"], o)}` : "", a = s ? styleText("gray", $2) : "";
1453
+ return `${i}${a}${c2}${o.trim() ? `
1454
+ ${a}` : ""}`;
1455
+ }
1456
+ default: {
1457
+ const c2 = s ? `${styleText("cyan", $2)} ` : "", a = s ? styleText("cyan", E2) : "", l = s ? `${styleText("cyan", $2)} ` : "", d2 = this.inlineError ? `
1458
+ ${l}${styleText("yellow", this.inlineError)}` : "";
1459
+ return `${i}${c2}${n}${d2}
1460
+ ${a}
1461
+ `;
1462
+ }
1463
+ }
1464
+ } }).prompt();
1465
+ }, "le");
1466
+ function ce(t, r) {
1467
+ const s = t.segmentValues, i = t.segmentCursor;
1468
+ if (r === "submit" || r === "cancel") return t.formattedValue;
1469
+ const u = styleText("gray", t.separator);
1470
+ return t.segments.map((n, o) => {
1471
+ const c2 = o === i.segmentIndex && !["submit", "cancel"].includes(r), a = de[n.type];
1472
+ return $e(s[n.type], { isActive: c2, label: a });
1473
+ }).join(u);
1474
+ }
1475
+ __name(ce, "ce");
1476
+ function $e(t, r) {
1477
+ const s = !t || t.replace(/_/g, "") === "";
1478
+ return r.isActive ? styleText("inverse", s ? r.label : t.replace(/_/g, " ")) : s ? styleText("dim", r.label) : t.replace(/_/g, styleText("dim", " "));
1479
+ }
1480
+ __name($e, "$e");
1481
+ var de = { year: "yyyy", month: "mm", day: "dd" };
1482
+ var he = /* @__PURE__ */ __name(async (t, r) => {
1483
+ const s = {}, i = Object.keys(t);
1484
+ for (const u of i) {
1485
+ const n = t[u], o = await n({ results: s })?.catch((c2) => {
1486
+ throw c2;
1487
+ });
1488
+ if (typeof r?.onCancel == "function" && q(o)) {
1489
+ s[u] = "canceled", r.onCancel({ results: s });
1490
+ continue;
1491
+ }
1492
+ s[u] = o;
1493
+ }
1494
+ return s;
1495
+ }, "he");
1496
+ var pe = /* @__PURE__ */ __name((t) => {
1497
+ const { selectableGroups: r = true, groupSpacing: s = 0 } = t, i = /* @__PURE__ */ __name((n, o, c2 = []) => {
1498
+ const a = n.label ?? String(n.value), l = typeof n.group == "string", d2 = l && (c2[c2.indexOf(n) + 1] ?? { group: true }), y = l && d2 && d2.group === true, p2 = l ? r ? `${y ? E2 : $2} ` : " " : "";
1499
+ let m = "";
1500
+ if (s > 0 && !l) {
1501
+ const S2 = `
1502
+ ${styleText("cyan", $2)}`;
1503
+ m = `${S2.repeat(s - 1)}${S2} `;
1504
+ }
1505
+ if (o === "active") return `${m}${styleText("dim", p2)}${styleText("cyan", et2)} ${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
1506
+ if (o === "group-active") return `${m}${p2}${styleText("cyan", et2)} ${styleText("dim", a)}`;
1507
+ if (o === "group-active-selected") return `${m}${p2}${styleText("green", U2)} ${styleText("dim", a)}`;
1508
+ if (o === "selected") {
1509
+ const S2 = l || r ? styleText("green", U2) : "";
1510
+ return `${m}${styleText("dim", p2)}${S2} ${styleText("dim", a)}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
1511
+ }
1512
+ if (o === "cancelled") return `${styleText(["strikethrough", "dim"], a)}`;
1513
+ if (o === "active-selected") return `${m}${styleText("dim", p2)}${styleText("green", U2)} ${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`;
1514
+ if (o === "submitted") return `${styleText("dim", a)}`;
1515
+ const g = l || r ? styleText("dim", J2) : "";
1516
+ return `${m}${styleText("dim", p2)}${g} ${styleText("dim", a)}`;
1517
+ }, "i"), u = t.required ?? true;
1518
+ return new it({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValues: t.initialValues, required: u, cursorAt: t.cursorAt, selectableGroups: r, validate(n) {
1519
+ if (u && (n === void 0 || n.length === 0)) return `Please select at least one option.
1520
+ ${styleText("reset", styleText("dim", `Press ${styleText(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText("gray", styleText(["bgWhite", "inverse"], " enter "))} to submit`))}`;
1521
+ }, render() {
1522
+ const n = t.withGuide ?? h.withGuide, o = `${n ? `${styleText("gray", $2)}
1523
+ ` : ""}${M(this.state)} ${t.message}
1524
+ `, c2 = this.value ?? [];
1525
+ switch (this.state) {
1526
+ case "submit": {
1527
+ const a = this.options.filter(({ value: d2 }) => c2.includes(d2)).map((d2) => i(d2, "submitted")), l = a.length === 0 ? "" : ` ${a.join(styleText("dim", ", "))}`;
1528
+ return `${o}${n ? styleText("gray", $2) : ""}${l}`;
1529
+ }
1530
+ case "cancel": {
1531
+ const a = this.options.filter(({ value: l }) => c2.includes(l)).map((l) => i(l, "cancelled")).join(styleText("dim", ", "));
1532
+ return `${o}${n ? `${styleText("gray", $2)} ` : ""}${a.trim() ? `${a}${n ? `
1533
+ ${styleText("gray", $2)}` : ""}` : ""}`;
1534
+ }
1535
+ case "error": {
1536
+ const a = this.error.split(`
1537
+ `).map((l, d2) => d2 === 0 ? `${n ? `${styleText("yellow", E2)} ` : ""}${styleText("yellow", l)}` : ` ${l}`).join(`
1538
+ `);
1539
+ return `${o}${n ? `${styleText("yellow", $2)} ` : ""}${this.options.map((l, d2, y) => {
1540
+ const p2 = c2.includes(l.value) || l.group === true && this.isGroupSelected(`${l.value}`), m = d2 === this.cursor;
1541
+ return !m && typeof l.group == "string" && this.options[this.cursor].value === l.group ? i(l, p2 ? "group-active-selected" : "group-active", y) : m && p2 ? i(l, "active-selected", y) : p2 ? i(l, "selected", y) : i(l, m ? "active" : "inactive", y);
1542
+ }).join(`
1543
+ ${n ? `${styleText("yellow", $2)} ` : ""}`)}
1544
+ ${a}
1545
+ `;
1546
+ }
1547
+ default: {
1548
+ const a = this.options.map((d2, y, p2) => {
1549
+ const m = c2.includes(d2.value) || d2.group === true && this.isGroupSelected(`${d2.value}`), g = y === this.cursor, S2 = !g && typeof d2.group == "string" && this.options[this.cursor].value === d2.group;
1550
+ let h2 = "";
1551
+ return S2 ? h2 = i(d2, m ? "group-active-selected" : "group-active", p2) : g && m ? h2 = i(d2, "active-selected", p2) : m ? h2 = i(d2, "selected", p2) : h2 = i(d2, g ? "active" : "inactive", p2), `${y !== 0 && !h2.startsWith(`
1552
+ `) ? " " : ""}${h2}`;
1553
+ }).join(`
1554
+ ${n ? styleText("cyan", $2) : ""}`), l = a.startsWith(`
1555
+ `) ? "" : " ";
1556
+ return `${o}${n ? styleText("cyan", $2) : ""}${l}${a}
1557
+ ${n ? styleText("cyan", E2) : ""}
1558
+ `;
1559
+ }
1560
+ }
1561
+ } }).prompt();
1562
+ }, "pe");
1563
+ var R2 = { message: /* @__PURE__ */ __name((t = [], { symbol: r = styleText("gray", $2), secondarySymbol: s = styleText("gray", $2), output: i = process.stdout, spacing: u = 1, withGuide: n } = {}) => {
1564
+ const o = [], c2 = n ?? h.withGuide, a = c2 ? s : "", l = c2 ? `${r} ` : "", d2 = c2 ? `${s} ` : "";
1565
+ for (let p2 = 0; p2 < u; p2++) o.push(a);
1566
+ const y = Array.isArray(t) ? t : t.split(`
1567
+ `);
1568
+ if (y.length > 0) {
1569
+ const [p2, ...m] = y;
1570
+ p2.length > 0 ? o.push(`${l}${p2}`) : o.push(c2 ? r : "");
1571
+ for (const g of m) g.length > 0 ? o.push(`${d2}${g}`) : o.push(c2 ? s : "");
1572
+ }
1573
+ i.write(`${o.join(`
1574
+ `)}
1575
+ `);
1576
+ }, "message"), info: /* @__PURE__ */ __name((t, r) => {
1577
+ R2.message(t, { ...r, symbol: styleText("blue", ht2) });
1578
+ }, "info"), success: /* @__PURE__ */ __name((t, r) => {
1579
+ R2.message(t, { ...r, symbol: styleText("green", pt) });
1580
+ }, "success"), step: /* @__PURE__ */ __name((t, r) => {
1581
+ R2.message(t, { ...r, symbol: styleText("green", F2) });
1582
+ }, "step"), warn: /* @__PURE__ */ __name((t, r) => {
1583
+ R2.message(t, { ...r, symbol: styleText("yellow", mt) });
1584
+ }, "warn"), warning: /* @__PURE__ */ __name((t, r) => {
1585
+ R2.warn(t, r);
1586
+ }, "warning"), error: /* @__PURE__ */ __name((t, r) => {
1587
+ R2.message(t, { ...r, symbol: styleText("red", gt) });
1588
+ }, "error") };
1589
+ var me = /* @__PURE__ */ __name((t = "", r) => {
1590
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? h.withGuide ? `${styleText("gray", E2)} ` : "";
1591
+ s.write(`${i}${styleText("red", t)}
1592
+
1593
+ `);
1594
+ }, "me");
1595
+ var ge = /* @__PURE__ */ __name((t = "", r) => {
1596
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? h.withGuide ? `${styleText("gray", lt)} ` : "";
1597
+ s.write(`${i}${t}
1598
+ `);
1599
+ }, "ge");
1600
+ var ye = /* @__PURE__ */ __name((t = "", r) => {
1601
+ const s = r?.output ?? process.stdout, i = r?.withGuide ?? h.withGuide ? `${styleText("gray", $2)}
1602
+ ${styleText("gray", E2)} ` : "";
1603
+ s.write(`${i}${t}
1604
+
1605
+ `);
1606
+ }, "ye");
1607
+ var fe = /* @__PURE__ */ __name((t) => new rt({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, showSubmit: t.showSubmit, output: t.output, signal: t.signal, input: t.input, render() {
1608
+ const r = t?.withGuide ?? h.withGuide, s = `${`${r ? `${styleText("gray", $2)}
1609
+ ` : ""}${M(this.state)} `}${t.message}
1610
+ `, i = t.placeholder ? styleText("inverse", t.placeholder[0]) + styleText("dim", t.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), u = this.userInput ? this.userInputWithCursor : i, n = this.value ?? "", o = t.showSubmit ? `
1611
+ ${styleText(this.focused === "submit" ? "cyan" : "dim", "[ submit ]")}` : "";
1612
+ switch (this.state) {
1613
+ case "error": {
1614
+ const c2 = `${styleText("yellow", $2)} `, a = r ? W(t.output, u, c2, void 0) : u, l = styleText("yellow", E2);
1615
+ return `${s}${a}
1616
+ ${l} ${styleText("yellow", this.error)}${o}
1617
+ `;
1618
+ }
1619
+ case "submit": {
1620
+ const c2 = `${styleText("gray", $2)} `, a = r ? W(t.output, n, c2, void 0, (l) => styleText("dim", l)) : n ? styleText("dim", n) : "";
1621
+ return `${s}${a}`;
1622
+ }
1623
+ case "cancel": {
1624
+ const c2 = `${styleText("gray", $2)} `, a = r ? W(t.output, n, c2, void 0, (l) => styleText(["strikethrough", "dim"], l)) : n ? styleText(["strikethrough", "dim"], n) : "";
1625
+ return `${s}${a}`;
1626
+ }
1627
+ default: {
1628
+ const c2 = r ? `${styleText("cyan", $2)} ` : "", a = r ? styleText("cyan", E2) : "", l = r ? W(t.output, u, c2) : u;
1629
+ return `${s}${l}
1630
+ ${a}${o}
1631
+ `;
1632
+ }
1633
+ }
1634
+ } }).prompt(), "fe");
1635
+ var Q2 = /* @__PURE__ */ __name((t, r) => t.split(`
1636
+ `).map((s) => r(s)).join(`
1637
+ `), "Q");
1638
+ var ve = /* @__PURE__ */ __name((t) => {
1639
+ const r = /* @__PURE__ */ __name((i, u) => {
1640
+ const n = i.label ?? String(i.value);
1641
+ return u === "disabled" ? `${styleText("gray", J2)} ${Q2(n, (o) => styleText(["strikethrough", "gray"], o))}${i.hint ? ` ${styleText("dim", `(${i.hint ?? "disabled"})`)}` : ""}` : u === "active" ? `${styleText("cyan", et2)} ${n}${i.hint ? ` ${styleText("dim", `(${i.hint})`)}` : ""}` : u === "selected" ? `${styleText("green", U2)} ${Q2(n, (o) => styleText("dim", o))}${i.hint ? ` ${styleText("dim", `(${i.hint})`)}` : ""}` : u === "cancelled" ? `${Q2(n, (o) => styleText(["strikethrough", "dim"], o))}` : u === "active-selected" ? `${styleText("green", U2)} ${n}${i.hint ? ` ${styleText("dim", `(${i.hint})`)}` : ""}` : u === "submitted" ? `${Q2(n, (o) => styleText("dim", o))}` : `${styleText("dim", J2)} ${Q2(n, (o) => styleText("dim", o))}`;
1642
+ }, "r"), s = t.required ?? true;
1643
+ return new nt({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValues: t.initialValues, required: s, cursorAt: t.cursorAt, validate(i) {
1644
+ if (s && (i === void 0 || i.length === 0)) return `Please select at least one option.
1645
+ ${styleText("reset", styleText("dim", `Press ${styleText(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
1646
+ }, render() {
1647
+ const i = t.withGuide ?? h.withGuide, u = W(t.output, t.message, i ? `${yt(this.state)} ` : "", `${M(this.state)} `), n = `${i ? `${styleText("gray", $2)}
1648
+ ` : ""}${u}
1649
+ `, o = this.value ?? [], c2 = /* @__PURE__ */ __name((a, l) => {
1650
+ if (a.disabled) return r(a, "disabled");
1651
+ const d2 = o.includes(a.value);
1652
+ return l && d2 ? r(a, "active-selected") : d2 ? r(a, "selected") : r(a, l ? "active" : "inactive");
1653
+ }, "c");
1654
+ switch (this.state) {
1655
+ case "submit": {
1656
+ const a = this.options.filter(({ value: d2 }) => o.includes(d2)).map((d2) => r(d2, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none"), l = W(t.output, a, i ? `${styleText("gray", $2)} ` : "");
1657
+ return `${n}${l}`;
1658
+ }
1659
+ case "cancel": {
1660
+ const a = this.options.filter(({ value: d2 }) => o.includes(d2)).map((d2) => r(d2, "cancelled")).join(styleText("dim", ", "));
1661
+ if (a.trim() === "") return `${n}${styleText("gray", $2)}`;
1662
+ const l = W(t.output, a, i ? `${styleText("gray", $2)} ` : "");
1663
+ return `${n}${l}${i ? `
1664
+ ${styleText("gray", $2)}` : ""}`;
1665
+ }
1666
+ case "error": {
1667
+ const a = i ? `${styleText("yellow", $2)} ` : "", l = this.error.split(`
1668
+ `).map((p2, m) => m === 0 ? `${i ? `${styleText("yellow", E2)} ` : ""}${styleText("yellow", p2)}` : ` ${p2}`).join(`
1669
+ `), d2 = n.split(`
1670
+ `).length, y = l.split(`
1671
+ `).length + 1;
1672
+ return `${n}${a}${Y2({ output: t.output, options: this.options, cursor: this.cursor, maxItems: t.maxItems, columnPadding: a.length, rowPadding: d2 + y, style: c2 }).join(`
1673
+ ${a}`)}
1674
+ ${l}
1675
+ `;
1676
+ }
1677
+ default: {
1678
+ const a = i ? `${styleText("cyan", $2)} ` : "", l = n.split(`
1679
+ `).length, d2 = i ? 2 : 1;
1680
+ return `${n}${a}${Y2({ output: t.output, options: this.options, cursor: this.cursor, maxItems: t.maxItems, columnPadding: a.length, rowPadding: l + d2, style: c2 }).join(`
1681
+ ${a}`)}
1682
+ ${i ? styleText("cyan", E2) : ""}
1683
+ `;
1684
+ }
1685
+ }
1686
+ } }).prompt();
1687
+ }, "ve");
1688
+ var we = /* @__PURE__ */ __name((t) => styleText("dim", t), "we");
1689
+ var be = /* @__PURE__ */ __name((t, r, s) => {
1690
+ const i = { hard: true, trim: false }, u = wrapAnsi(t, r, i).split(`
1691
+ `), n = u.reduce((a, l) => Math.max(dist_default2(l), a), 0), o = u.map(s).reduce((a, l) => Math.max(dist_default2(l), a), 0), c2 = r - (o - n);
1692
+ return wrapAnsi(t, c2, i);
1693
+ }, "be");
1694
+ var Se = /* @__PURE__ */ __name((t = "", r = "", s) => {
1695
+ const i = s?.output ?? j2.stdout, u = s?.withGuide ?? h.withGuide, n = s?.format ?? we, o = ["", ...be(t, A(i) - 6, n).split(`
1696
+ `).map(n), ""], c2 = dist_default2(r), a = Math.max(o.reduce((p2, m) => {
1697
+ const g = dist_default2(m);
1698
+ return g > p2 ? g : p2;
1699
+ }, 0), c2) + 2, l = o.map((p2) => `${styleText("gray", $2)} ${p2}${" ".repeat(a - dist_default2(p2))}${styleText("gray", $2)}`).join(`
1700
+ `), d2 = u ? `${styleText("gray", $2)}
1701
+ ` : "", y = u ? xt : dt;
1702
+ i.write(`${d2}${styleText("green", F2)} ${styleText("reset", r)} ${styleText("gray", st2.repeat(Math.max(a - c2 - 1, 1)) + ct)}
1703
+ ${l}
1704
+ ${styleText("gray", y + st2.repeat(a + 2) + $t)}
1705
+ `);
1706
+ }, "Se");
1707
+ var Ce = /* @__PURE__ */ __name((t) => new ot({ validate: t.validate, mask: t.mask ?? Gt, signal: t.signal, input: t.input, output: t.output, render() {
1708
+ const r = t.withGuide ?? h.withGuide, s = `${r ? `${styleText("gray", $2)}
1709
+ ` : ""}${M(this.state)} ${t.message}
1710
+ `, i = this.userInputWithCursor, u = this.masked;
1711
+ switch (this.state) {
1712
+ case "error": {
1713
+ const n = r ? `${styleText("yellow", $2)} ` : "", o = r ? `${styleText("yellow", E2)} ` : "", c2 = u ?? "";
1714
+ return t.clearOnError && this.clear(), `${s.trim()}
1715
+ ${n}${c2}
1716
+ ${o}${styleText("yellow", this.error)}
1717
+ `;
1718
+ }
1719
+ case "submit": {
1720
+ const n = r ? `${styleText("gray", $2)} ` : "", o = u ? styleText("dim", u) : "";
1721
+ return `${s}${n}${o}`;
1722
+ }
1723
+ case "cancel": {
1724
+ const n = r ? `${styleText("gray", $2)} ` : "", o = u ? styleText(["strikethrough", "dim"], u) : "";
1725
+ return `${s}${n}${o}${u && r ? `
1726
+ ${styleText("gray", $2)}` : ""}`;
1727
+ }
1728
+ default: {
1729
+ const n = r ? `${styleText("cyan", $2)} ` : "", o = r ? styleText("cyan", E2) : "";
1730
+ return `${s}${n}${i}
1731
+ ${o}
1732
+ `;
1733
+ }
1734
+ }
1735
+ } }).prompt(), "Ce");
1736
+ var Te = /* @__PURE__ */ __name((t) => {
1737
+ const r = t.validate;
1738
+ return At({ ...t, initialUserInput: t.initialValue ?? t.root ?? process.cwd(), maxItems: 5, validate(s) {
1739
+ if (!Array.isArray(s)) {
1740
+ if (!s) return "Please select a path";
1741
+ if (r) return r(s);
1742
+ }
1743
+ }, options() {
1744
+ const s = this.userInput;
1745
+ if (s === "") return [];
1746
+ try {
1747
+ let i;
1748
+ existsSync(s) ? lstatSync(s).isDirectory() && (!t.directory || s.endsWith("/")) ? i = s : i = dirname(s) : i = dirname(s);
1749
+ const u = s.length > 1 && s.endsWith("/") ? s.slice(0, -1) : s;
1750
+ return readdirSync(i).map((n) => {
1751
+ const o = join(i, n), c2 = lstatSync(o);
1752
+ return { name: n, path: o, isDirectory: c2.isDirectory() };
1753
+ }).filter(({ path: n, isDirectory: o }) => n.startsWith(u) && (o || !t.directory)).map((n) => ({ value: n.path }));
1754
+ } catch {
1755
+ return [];
1756
+ }
1757
+ } });
1758
+ }, "Te");
1759
+ var _e = /* @__PURE__ */ __name((t) => styleText("magenta", t), "_e");
1760
+ var ft = /* @__PURE__ */ __name(({ indicator: t = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: u, frames: n = tt2 ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], delay: o = tt2 ? 80 : 120, signal: c2, ...a } = {}) => {
1761
+ const l = at2();
1762
+ let d2, y, p2 = false, m = false, g = "", S2, h2 = performance.now();
1763
+ const f = A(s), v2 = a?.styleFrame ?? _e, T = /* @__PURE__ */ __name((I2) => {
1764
+ const V2 = I2 > 1 ? u ?? h.messages.error : i ?? h.messages.cancel;
1765
+ m = I2 === 1, p2 && (W2(V2, I2), m && typeof r == "function" && r());
1766
+ }, "T"), C2 = /* @__PURE__ */ __name(() => T(2), "C"), b2 = /* @__PURE__ */ __name(() => T(1), "b"), G2 = /* @__PURE__ */ __name(() => {
1767
+ process.on("uncaughtExceptionMonitor", C2), process.on("unhandledRejection", C2), process.on("SIGINT", b2), process.on("SIGTERM", b2), process.on("exit", T), c2 && c2.addEventListener("abort", b2);
1768
+ }, "G"), x2 = /* @__PURE__ */ __name(() => {
1769
+ process.removeListener("uncaughtExceptionMonitor", C2), process.removeListener("unhandledRejection", C2), process.removeListener("SIGINT", b2), process.removeListener("SIGTERM", b2), process.removeListener("exit", T), c2 && c2.removeEventListener("abort", b2);
1770
+ }, "x"), A2 = /* @__PURE__ */ __name(() => {
1771
+ if (S2 === void 0) return;
1772
+ l && s.write(`
1773
+ `);
1774
+ const I2 = wrapAnsi(S2, f, { hard: true, trim: false }).split(`
1775
+ `);
1776
+ I2.length > 1 && s.write(import_sisteransi2.cursor.up(I2.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
1777
+ }, "A"), P2 = /* @__PURE__ */ __name((I2) => I2.replace(/\.+$/, ""), "P"), N2 = /* @__PURE__ */ __name((I2) => {
1778
+ const V2 = (performance.now() - I2) / 1e3, B2 = Math.floor(V2 / 60), L2 = Math.floor(V2 % 60);
1779
+ return B2 > 0 ? `[${B2}m ${L2}s]` : `[${L2}s]`;
1780
+ }, "N"), D2 = a.withGuide ?? h.withGuide, rt2 = /* @__PURE__ */ __name((I2 = "") => {
1781
+ p2 = true, d2 = R({ output: s }), g = P2(I2), h2 = performance.now(), D2 && s.write(`${styleText("gray", $2)}
1782
+ `);
1783
+ let V2 = 0, B2 = 0;
1784
+ G2(), y = setInterval(() => {
1785
+ if (l && g === S2) return;
1786
+ A2(), S2 = g;
1787
+ const L2 = v2(n[V2]);
1788
+ let Z2;
1789
+ if (l) Z2 = `${L2} ${g}...`;
1790
+ else if (t === "timer") Z2 = `${L2} ${g} ${N2(h2)}`;
1791
+ else {
1792
+ const kt = ".".repeat(Math.floor(B2)).slice(0, 3);
1793
+ Z2 = `${L2} ${g}${kt}`;
1794
+ }
1795
+ const Nt = wrapAnsi(Z2, f, { hard: true, trim: false });
1796
+ s.write(Nt), V2 = V2 + 1 < n.length ? V2 + 1 : 0, B2 = B2 < 4 ? B2 + 0.125 : 0;
1797
+ }, o);
1798
+ }, "rt"), W2 = /* @__PURE__ */ __name((I2 = "", V2 = 0, B2 = false) => {
1799
+ if (!p2) return;
1800
+ p2 = false, clearInterval(y), A2();
1801
+ const L2 = V2 === 0 ? styleText("green", F2) : V2 === 1 ? styleText("red", ot2) : styleText("red", ut2);
1802
+ g = I2 ?? g, B2 || (t === "timer" ? s.write(`${L2} ${g} ${N2(h2)}
1803
+ `) : s.write(`${L2} ${g}
1804
+ `)), x2(), d2();
1805
+ }, "W");
1806
+ return { start: rt2, stop: /* @__PURE__ */ __name((I2 = "") => W2(I2, 0), "stop"), message: /* @__PURE__ */ __name((I2 = "") => {
1807
+ g = P2(I2 ?? g);
1808
+ }, "message"), cancel: /* @__PURE__ */ __name((I2 = "") => W2(I2, 1), "cancel"), error: /* @__PURE__ */ __name((I2 = "") => W2(I2, 2), "error"), clear: /* @__PURE__ */ __name(() => W2("", 0, true), "clear"), get isCancelled() {
1809
+ return m;
1810
+ } };
1811
+ }, "ft");
1812
+ var Vt = { light: w2("\u2500", "-"), heavy: w2("\u2501", "="), block: w2("\u2588", "#") };
1813
+ function Ie({ style: t = "heavy", max: r = 100, size: s = 40, ...i } = {}) {
1814
+ const u = ft(i);
1815
+ let n = 0, o = "";
1816
+ const c2 = Math.max(1, r), a = Math.max(1, s), l = /* @__PURE__ */ __name((m) => {
1817
+ switch (m) {
1818
+ case "initial":
1819
+ case "active":
1820
+ return (g) => styleText("magenta", g);
1821
+ case "error":
1822
+ case "cancel":
1823
+ return (g) => styleText("red", g);
1824
+ case "submit":
1825
+ return (g) => styleText("green", g);
1826
+ default:
1827
+ return (g) => styleText("magenta", g);
1828
+ }
1829
+ }, "l"), d2 = /* @__PURE__ */ __name((m, g) => {
1830
+ const S2 = Math.floor(n / c2 * a);
1831
+ return `${l(m)(Vt[t].repeat(S2))}${styleText("dim", Vt[t].repeat(a - S2))} ${g}`;
1832
+ }, "d"), y = /* @__PURE__ */ __name((m = "") => {
1833
+ o = m, u.start(d2("initial", m));
1834
+ }, "y"), p2 = /* @__PURE__ */ __name((m = 1, g) => {
1835
+ n = Math.min(c2, m + n), u.message(d2("active", g ?? o)), o = g ?? o;
1836
+ }, "p");
1837
+ return { start: y, stop: u.stop, cancel: u.cancel, error: u.error, clear: u.clear, advance: p2, isCancelled: u.isCancelled, message: /* @__PURE__ */ __name((m) => p2(0, m), "message") };
1838
+ }
1839
+ __name(Ie, "Ie");
1840
+ var it2 = /* @__PURE__ */ __name((t, r) => t.includes(`
1841
+ `) ? t.split(`
1842
+ `).map((s) => r(s)).join(`
1843
+ `) : r(t), "it");
1844
+ var Ee = /* @__PURE__ */ __name((t) => {
1845
+ const r = /* @__PURE__ */ __name((s, i) => {
1846
+ const u = s.label ?? String(s.value);
1847
+ switch (i) {
1848
+ case "disabled":
1849
+ return `${styleText("gray", H2)} ${it2(u, (n) => styleText("gray", n))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
1850
+ case "selected":
1851
+ return `${it2(u, (n) => styleText("dim", n))}`;
1852
+ case "active":
1853
+ return `${styleText("green", z2)} ${u}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
1854
+ case "cancelled":
1855
+ return `${it2(u, (n) => styleText(["strikethrough", "dim"], n))}`;
1856
+ default:
1857
+ return `${styleText("dim", H2)} ${it2(u, (n) => styleText("dim", n))}`;
1858
+ }
1859
+ }, "r");
1860
+ return new ut({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue, render() {
1861
+ const s = t.withGuide ?? h.withGuide, i = `${M(this.state)} `, u = `${yt(this.state)} `, n = W(t.output, t.message, u, i), o = `${s ? `${styleText("gray", $2)}
1862
+ ` : ""}${n}
1863
+ `;
1864
+ switch (this.state) {
1865
+ case "submit": {
1866
+ const c2 = s ? `${styleText("gray", $2)} ` : "", a = W(t.output, r(this.options[this.cursor], "selected"), c2);
1867
+ return `${o}${a}`;
1868
+ }
1869
+ case "cancel": {
1870
+ const c2 = s ? `${styleText("gray", $2)} ` : "", a = W(t.output, r(this.options[this.cursor], "cancelled"), c2);
1871
+ return `${o}${a}${s ? `
1872
+ ${styleText("gray", $2)}` : ""}`;
1873
+ }
1874
+ default: {
1875
+ const c2 = s ? `${styleText("cyan", $2)} ` : "", a = s ? styleText("cyan", E2) : "", l = o.split(`
1876
+ `).length, d2 = s ? 2 : 1;
1877
+ return `${o}${c2}${Y2({ output: t.output, cursor: this.cursor, options: this.options, maxItems: t.maxItems, columnPadding: c2.length, rowPadding: l + d2, style: /* @__PURE__ */ __name((y, p2) => r(y, y.disabled ? "disabled" : p2 ? "active" : "inactive"), "style") }).join(`
1878
+ ${c2}`)}
1879
+ ${a}
1880
+ `;
1881
+ }
1882
+ }
1883
+ } }).prompt();
1884
+ }, "Ee");
1885
+ var Ge = /* @__PURE__ */ __name((t) => {
1886
+ const r = /* @__PURE__ */ __name((s, i = "inactive") => {
1887
+ const u = s.label ?? String(s.value);
1888
+ return i === "selected" ? `${styleText("dim", u)}` : i === "cancelled" ? `${styleText(["strikethrough", "dim"], u)}` : i === "active" ? `${styleText(["bgCyan", "gray"], ` ${s.value} `)} ${u}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}` : `${styleText(["gray", "bgWhite", "inverse"], ` ${s.value} `)} ${u}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
1889
+ }, "r");
1890
+ return new at({ options: t.options, signal: t.signal, input: t.input, output: t.output, initialValue: t.initialValue, caseSensitive: t.caseSensitive, render() {
1891
+ const s = t.withGuide ?? h.withGuide, i = `${s ? `${styleText("gray", $2)}
1892
+ ` : ""}${M(this.state)} ${t.message}
1893
+ `;
1894
+ switch (this.state) {
1895
+ case "submit": {
1896
+ const u = s ? `${styleText("gray", $2)} ` : "", n = this.options.find((c2) => c2.value === this.value) ?? t.options[0], o = W(t.output, r(n, "selected"), u);
1897
+ return `${i}${o}`;
1898
+ }
1899
+ case "cancel": {
1900
+ const u = s ? `${styleText("gray", $2)} ` : "", n = W(t.output, r(this.options[0], "cancelled"), u);
1901
+ return `${i}${n}${s ? `
1902
+ ${styleText("gray", $2)}` : ""}`;
1903
+ }
1904
+ default: {
1905
+ const u = s ? `${styleText("cyan", $2)} ` : "", n = s ? styleText("cyan", E2) : "", o = this.options.map((c2, a) => W(t.output, r(c2, a === this.cursor ? "active" : "inactive"), u)).join(`
1906
+ `);
1907
+ return `${i}${o}
1908
+ ${n}
1909
+ `;
1910
+ }
1911
+ }
1912
+ } }).prompt();
1913
+ }, "Ge");
1914
+ var jt = `${styleText("gray", $2)} `;
1915
+ var K2 = { message: /* @__PURE__ */ __name(async (t, { symbol: r = styleText("gray", $2) } = {}) => {
1916
+ process.stdout.write(`${styleText("gray", $2)}
1917
+ ${r} `);
1918
+ let s = 3;
1919
+ for await (let i of t) {
1920
+ i = i.replace(/\n/g, `
1921
+ ${jt}`), i.includes(`
1922
+ `) && (s = 3 + stripVTControlCharacters(i.slice(i.lastIndexOf(`
1923
+ `))).length);
1924
+ const u = stripVTControlCharacters(i).length;
1925
+ s + u < process.stdout.columns ? (s += u, process.stdout.write(i)) : (process.stdout.write(`
1926
+ ${jt}${i.trimStart()}`), s = 3 + stripVTControlCharacters(i.trimStart()).length);
1927
+ }
1928
+ process.stdout.write(`
1929
+ `);
1930
+ }, "message"), info: /* @__PURE__ */ __name((t) => K2.message(t, { symbol: styleText("blue", ht2) }), "info"), success: /* @__PURE__ */ __name((t) => K2.message(t, { symbol: styleText("green", pt) }), "success"), step: /* @__PURE__ */ __name((t) => K2.message(t, { symbol: styleText("green", F2) }), "step"), warn: /* @__PURE__ */ __name((t) => K2.message(t, { symbol: styleText("yellow", mt) }), "warn"), warning: /* @__PURE__ */ __name((t) => K2.warn(t), "warning"), error: /* @__PURE__ */ __name((t) => K2.message(t, { symbol: styleText("red", gt) }), "error") };
1931
+ var xe = /* @__PURE__ */ __name(async (t, r) => {
1932
+ for (const s of t) {
1933
+ if (s.enabled === false) continue;
1934
+ const i = ft(r);
1935
+ i.start(s.title);
1936
+ const u = await s.task(i.message);
1937
+ i.stop(u || s.title);
1938
+ }
1939
+ }, "xe");
1940
+ var Oe = /* @__PURE__ */ __name((t) => t.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, ""), "Oe");
1941
+ var Me = /* @__PURE__ */ __name((t) => {
1942
+ const r = t.output ?? process.stdout, s = A(r), i = styleText("gray", $2), u = t.spacing ?? 1, n = 3, o = t.retainLog === true, c2 = !at2() && Tt(r);
1943
+ r.write(`${i}
1944
+ `), r.write(`${styleText("green", F2)} ${t.title}
1945
+ `);
1946
+ for (let h2 = 0; h2 < u; h2++) r.write(`${i}
1947
+ `);
1948
+ const a = [{ value: "", full: "" }];
1949
+ let l = false;
1950
+ const d2 = /* @__PURE__ */ __name((h2) => {
1951
+ if (a.length === 0) return;
1952
+ let f = 0;
1953
+ h2 && (f += u + 2);
1954
+ for (const v2 of a) {
1955
+ const { value: T, result: C2 } = v2;
1956
+ let b2 = C2?.message ?? T;
1957
+ if (b2.length === 0) continue;
1958
+ C2 === void 0 && v2.header !== void 0 && v2.header !== "" && (b2 += `
1959
+ ${v2.header}`);
1960
+ const G2 = b2.split(`
1961
+ `).reduce((x2, A2) => A2 === "" ? x2 + 1 : x2 + Math.ceil((A2.length + n) / s), 0);
1962
+ f += G2;
1963
+ }
1964
+ f > 0 && (f += 1, r.write(import_sisteransi2.erase.lines(f)));
1965
+ }, "d"), y = /* @__PURE__ */ __name((h2, f, v2) => {
1966
+ const T = v2 ? `${h2.full}
1967
+ ${h2.value}` : h2.value;
1968
+ h2.header !== void 0 && h2.header !== "" && R2.message(h2.header.split(`
1969
+ `).map((C2) => styleText("bold", C2)), { output: r, secondarySymbol: i, symbol: i, spacing: 0 }), R2.message(T.split(`
1970
+ `).map((C2) => styleText("dim", C2)), { output: r, secondarySymbol: i, symbol: i, spacing: f ?? u });
1971
+ }, "y"), p2 = /* @__PURE__ */ __name(() => {
1972
+ for (const h2 of a) {
1973
+ const { header: f, value: v2, full: T } = h2;
1974
+ (f === void 0 || f.length === 0) && v2.length === 0 || y(h2, void 0, o === true && T.length > 0);
1975
+ }
1976
+ }, "p"), m = /* @__PURE__ */ __name((h2, f, v2) => {
1977
+ if (d2(false), (v2?.raw !== true || !l) && h2.value !== "" && (h2.value += `
1978
+ `), h2.value += Oe(f), l = v2?.raw === true, t.limit !== void 0) {
1979
+ const T = h2.value.split(`
1980
+ `), C2 = T.length - t.limit;
1981
+ if (C2 > 0) {
1982
+ const b2 = T.splice(0, C2);
1983
+ o && (h2.full += (h2.full === "" ? "" : `
1984
+ `) + b2.join(`
1985
+ `));
1986
+ }
1987
+ h2.value = T.join(`
1988
+ `);
1989
+ }
1990
+ c2 && g();
1991
+ }, "m"), g = /* @__PURE__ */ __name(() => {
1992
+ for (const h2 of a) h2.result ? h2.result.status === "error" ? R2.error(h2.result.message, { output: r, secondarySymbol: i, spacing: 0 }) : R2.success(h2.result.message, { output: r, secondarySymbol: i, spacing: 0 }) : h2.value !== "" && y(h2, 0);
1993
+ }, "g"), S2 = /* @__PURE__ */ __name((h2, f) => {
1994
+ d2(false), h2.result = f, c2 && g();
1995
+ }, "S");
1996
+ return { message(h2, f) {
1997
+ m(a[0], h2, f);
1998
+ }, group(h2) {
1999
+ const f = { header: h2, value: "", full: "" };
2000
+ return a.push(f), { message(v2, T) {
2001
+ m(f, v2, T);
2002
+ }, error(v2) {
2003
+ S2(f, { status: "error", message: v2 });
2004
+ }, success(v2) {
2005
+ S2(f, { status: "success", message: v2 });
2006
+ } };
2007
+ }, error(h2, f) {
2008
+ d2(true), R2.error(h2, { output: r, secondarySymbol: i, spacing: 1 }), f?.showLog !== false && p2(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
2009
+ }, success(h2, f) {
2010
+ d2(true), R2.success(h2, { output: r, secondarySymbol: i, spacing: 1 }), f?.showLog === true && p2(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
2011
+ } };
2012
+ }, "Me");
2013
+ var Re = /* @__PURE__ */ __name((t) => new ht({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, output: t.output, signal: t.signal, input: t.input, render() {
2014
+ const r = t?.withGuide ?? h.withGuide, s = `${`${r ? `${styleText("gray", $2)}
2015
+ ` : ""}${M(this.state)} `}${t.message}
2016
+ `, i = t.placeholder ? styleText("inverse", t.placeholder[0]) + styleText("dim", t.placeholder.slice(1)) : styleText(["inverse", "hidden"], "_"), u = this.userInput ? this.userInputWithCursor : i, n = this.value ?? "";
2017
+ switch (this.state) {
2018
+ case "error": {
2019
+ const o = this.error ? ` ${styleText("yellow", this.error)}` : "", c2 = r ? `${styleText("yellow", $2)} ` : "", a = r ? styleText("yellow", E2) : "";
2020
+ return `${s.trim()}
2021
+ ${c2}${u}
2022
+ ${a}${o}
2023
+ `;
2024
+ }
2025
+ case "submit": {
2026
+ const o = n ? ` ${styleText("dim", n)}` : "", c2 = r ? styleText("gray", $2) : "";
2027
+ return `${s}${c2}${o}`;
2028
+ }
2029
+ case "cancel": {
2030
+ const o = n ? ` ${styleText(["strikethrough", "dim"], n)}` : "", c2 = r ? styleText("gray", $2) : "";
2031
+ return `${s}${c2}${o}${n.trim() ? `
2032
+ ${c2}` : ""}`;
2033
+ }
2034
+ default: {
2035
+ const o = r ? `${styleText("cyan", $2)} ` : "", c2 = r ? styleText("cyan", E2) : "";
2036
+ return `${s}${o}${u}
2037
+ ${c2}
2038
+ `;
2039
+ }
2040
+ }
2041
+ } }).prompt(), "Re");
2042
+
2043
+ export { $2 as $, $t, At, Ce, E2 as E, Ee, Et, F2 as F, Ge, Gt, H2 as H, Ie, It, J2 as J, K2 as K, M, Me, Ot, R2 as R, Re, Se, Te, Tt, U2 as U, X, Y2 as Y, _t, at2 as at, ct, dt, et2 as et, fe, ft, ge, gt, h, he, ht2 as ht, ie, j, le, lt, me, mt, nt, oe, ot, ot2, pe, pt, q, st2 as st, tt2 as tt, ue, ut, ut2, ve, w2 as w, xe, xt, ye, yt, z2 as z };
2044
+ //# sourceMappingURL=chunk-IRXBCLL2.js.map
2045
+ //# sourceMappingURL=chunk-IRXBCLL2.js.map