@brucewaynedecoy/make-docs 2.0.2 → 2.0.4

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 (46) hide show
  1. package/README.md +30 -75
  2. package/dist/{backup-73HQNKMC.js → backup-CM7RL2Q7.js} +5 -5
  3. package/dist/chunk-3EXHM5L2.js +1225 -0
  4. package/dist/chunk-3EXHM5L2.js.map +1 -0
  5. package/dist/{chunk-LVQSJF63.js → chunk-52FTNVXS.js} +242 -76
  6. package/dist/{chunk-LVQSJF63.js.map → chunk-52FTNVXS.js.map} +1 -1
  7. package/dist/{chunk-LQ5NSWCJ.js → chunk-65QWMODG.js} +2 -2
  8. package/dist/{chunk-HJYIQTMD.js → chunk-7R2PPKTB.js} +2 -2
  9. package/dist/{chunk-BENO4IH5.js → chunk-ADVNSMA7.js} +3 -3
  10. package/dist/{chunk-G5EF63GG.js → chunk-GERMRLJ2.js} +2 -2
  11. package/dist/{chunk-3BAJQXGH.js → chunk-J5QDGRZ7.js} +3 -3
  12. package/dist/{chunk-GNP6HRVP.js → chunk-LV3CBXZB.js} +20 -20
  13. package/dist/{chunk-GNP6HRVP.js.map → chunk-LV3CBXZB.js.map} +1 -1
  14. package/dist/{chunk-LRVV7UDD.js → chunk-M7DMFIKU.js} +2 -2
  15. package/dist/{chunk-64CTKJO7.js → chunk-OR5ZVGLG.js} +6 -5
  16. package/dist/chunk-OR5ZVGLG.js.map +1 -0
  17. package/dist/{chunk-MXBHCHSM.js → chunk-YVSASZMT.js} +3 -3
  18. package/dist/chunk-YVSASZMT.js.map +1 -0
  19. package/dist/index.js +118 -110
  20. package/dist/index.js.map +1 -1
  21. package/dist/{self-YYXOLDKU.js → self-36ULRIJ6.js} +17 -17
  22. package/dist/{self-YYXOLDKU.js.map → self-36ULRIJ6.js.map} +1 -1
  23. package/dist/{server-O2ZELIMX.js → server-H754TA4Q.js} +9 -9
  24. package/dist/{setup-system-HZROFNMP.js → setup-system-JI36YJ6D.js} +15 -15
  25. package/dist/{setup-system-HZROFNMP.js.map → setup-system-JI36YJ6D.js.map} +1 -1
  26. package/dist/{skills-command-MGGHY7HU.js → skills-command-IGDVLNKY.js} +28 -28
  27. package/dist/{skills-command-MGGHY7HU.js.map → skills-command-IGDVLNKY.js.map} +1 -1
  28. package/dist/{uninstall-3UXXXNFO.js → uninstall-VBGMQQLA.js} +8 -8
  29. package/dist/{virtual_make-docs-first-party-skills-ZII74YOB.js → virtual_make-docs-first-party-skills-H3FC47C2.js} +2 -2
  30. package/dist/{virtual_make-docs-first-party-skills-ZII74YOB.js.map → virtual_make-docs-first-party-skills-H3FC47C2.js.map} +1 -1
  31. package/package.json +4 -4
  32. package/template/.make-docs/system/contracts/output-contract.md +3 -1
  33. package/template/.make-docs/system/references/prd-change-management.md +14 -2
  34. package/dist/chunk-64CTKJO7.js.map +0 -1
  35. package/dist/chunk-MXBHCHSM.js.map +0 -1
  36. package/dist/chunk-Z5K4FHYP.js +0 -922
  37. package/dist/chunk-Z5K4FHYP.js.map +0 -1
  38. /package/dist/{backup-73HQNKMC.js.map → backup-CM7RL2Q7.js.map} +0 -0
  39. /package/dist/{chunk-LQ5NSWCJ.js.map → chunk-65QWMODG.js.map} +0 -0
  40. /package/dist/{chunk-HJYIQTMD.js.map → chunk-7R2PPKTB.js.map} +0 -0
  41. /package/dist/{chunk-BENO4IH5.js.map → chunk-ADVNSMA7.js.map} +0 -0
  42. /package/dist/{chunk-G5EF63GG.js.map → chunk-GERMRLJ2.js.map} +0 -0
  43. /package/dist/{chunk-3BAJQXGH.js.map → chunk-J5QDGRZ7.js.map} +0 -0
  44. /package/dist/{chunk-LRVV7UDD.js.map → chunk-M7DMFIKU.js.map} +0 -0
  45. /package/dist/{server-O2ZELIMX.js.map → server-H754TA4Q.js.map} +0 -0
  46. /package/dist/{uninstall-3UXXXNFO.js.map → uninstall-VBGMQQLA.js.map} +0 -0
@@ -0,0 +1,1225 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ __commonJS,
4
+ __toESM
5
+ } from "./chunk-D4HDZEJT.js";
6
+
7
+ // ../../node_modules/sisteransi/src/index.js
8
+ var require_src = __commonJS({
9
+ "../../node_modules/sisteransi/src/index.js"(exports, module) {
10
+ "use strict";
11
+ var ESC2 = "\x1B";
12
+ var CSI2 = `${ESC2}[`;
13
+ var beep = "\x07";
14
+ var cursor3 = {
15
+ to(x, y2) {
16
+ if (!y2) return `${CSI2}${x + 1}G`;
17
+ return `${CSI2}${y2 + 1};${x + 1}H`;
18
+ },
19
+ move(x, y2) {
20
+ let ret = "";
21
+ if (x < 0) ret += `${CSI2}${-x}D`;
22
+ else if (x > 0) ret += `${CSI2}${x}C`;
23
+ if (y2 < 0) ret += `${CSI2}${-y2}A`;
24
+ else if (y2 > 0) ret += `${CSI2}${y2}B`;
25
+ return ret;
26
+ },
27
+ up: (count = 1) => `${CSI2}${count}A`,
28
+ down: (count = 1) => `${CSI2}${count}B`,
29
+ forward: (count = 1) => `${CSI2}${count}C`,
30
+ backward: (count = 1) => `${CSI2}${count}D`,
31
+ nextLine: (count = 1) => `${CSI2}E`.repeat(count),
32
+ prevLine: (count = 1) => `${CSI2}F`.repeat(count),
33
+ left: `${CSI2}G`,
34
+ hide: `${CSI2}?25l`,
35
+ show: `${CSI2}?25h`,
36
+ save: `${ESC2}7`,
37
+ restore: `${ESC2}8`
38
+ };
39
+ var scroll = {
40
+ up: (count = 1) => `${CSI2}S`.repeat(count),
41
+ down: (count = 1) => `${CSI2}T`.repeat(count)
42
+ };
43
+ var erase3 = {
44
+ screen: `${CSI2}2J`,
45
+ up: (count = 1) => `${CSI2}1J`.repeat(count),
46
+ down: (count = 1) => `${CSI2}J`.repeat(count),
47
+ line: `${CSI2}2K`,
48
+ lineEnd: `${CSI2}K`,
49
+ lineStart: `${CSI2}1K`,
50
+ lines(count) {
51
+ let clear = "";
52
+ for (let i2 = 0; i2 < count; i2++)
53
+ clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
54
+ if (count)
55
+ clear += cursor3.left;
56
+ return clear;
57
+ }
58
+ };
59
+ module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
60
+ }
61
+ });
62
+
63
+ // ../../node_modules/@clack/core/dist/index.mjs
64
+ import { styleText } from "util";
65
+ import { stdout, stdin } from "process";
66
+ import * as l from "readline";
67
+ import l__default from "readline";
68
+
69
+ // ../../node_modules/fast-string-truncated-width/dist/utils.js
70
+ var getCodePointsLength = /* @__PURE__ */ (() => {
71
+ const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
72
+ return (input) => {
73
+ let surrogatePairsNr = 0;
74
+ SURROGATE_PAIR_RE.lastIndex = 0;
75
+ while (SURROGATE_PAIR_RE.test(input)) {
76
+ surrogatePairsNr += 1;
77
+ }
78
+ return input.length - surrogatePairsNr;
79
+ };
80
+ })();
81
+ var isFullWidth = (x) => {
82
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
83
+ };
84
+ var isWideNotCJKTNotEmoji = (x) => {
85
+ return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
86
+ };
87
+
88
+ // ../../node_modules/fast-string-truncated-width/dist/index.js
89
+ var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
90
+ var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
91
+ 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;
92
+ var TAB_RE = /\t{1,1000}/y;
93
+ 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");
94
+ var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
95
+ var MODIFIER_RE = new RegExp("\\p{M}+", "gu");
96
+ var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
97
+ var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
98
+ const LIMIT = truncationOptions.limit ?? Infinity;
99
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
100
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
101
+ const ANSI_WIDTH = 0;
102
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
103
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
104
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
105
+ const FULL_WIDTH_WIDTH = 2;
106
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
107
+ const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
108
+ const PARSE_BLOCKS = [
109
+ [LATIN_RE, REGULAR_WIDTH],
110
+ [ANSI_RE, ANSI_WIDTH],
111
+ [CONTROL_RE, CONTROL_WIDTH],
112
+ [TAB_RE, TAB_WIDTH],
113
+ [EMOJI_RE, EMOJI_WIDTH],
114
+ [CJKT_WIDE_RE, WIDE_WIDTH]
115
+ ];
116
+ let indexPrev = 0;
117
+ let index = 0;
118
+ let length = input.length;
119
+ let lengthExtra = 0;
120
+ let truncationEnabled = false;
121
+ let truncationIndex = length;
122
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
123
+ let unmatchedStart = 0;
124
+ let unmatchedEnd = 0;
125
+ let width = 0;
126
+ let widthExtra = 0;
127
+ outer: while (true) {
128
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
129
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
130
+ lengthExtra = 0;
131
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
132
+ const codePoint = char.codePointAt(0) || 0;
133
+ if (isFullWidth(codePoint)) {
134
+ widthExtra = FULL_WIDTH_WIDTH;
135
+ } else if (isWideNotCJKTNotEmoji(codePoint)) {
136
+ widthExtra = WIDE_WIDTH;
137
+ } else {
138
+ widthExtra = REGULAR_WIDTH;
139
+ }
140
+ if (width + widthExtra > truncationLimit) {
141
+ truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
142
+ }
143
+ if (width + widthExtra > LIMIT) {
144
+ truncationEnabled = true;
145
+ break outer;
146
+ }
147
+ lengthExtra += char.length;
148
+ width += widthExtra;
149
+ }
150
+ unmatchedStart = unmatchedEnd = 0;
151
+ }
152
+ if (index >= length) {
153
+ break outer;
154
+ }
155
+ for (let i2 = 0, l2 = PARSE_BLOCKS.length; i2 < l2; i2++) {
156
+ const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
157
+ BLOCK_RE.lastIndex = index;
158
+ if (BLOCK_RE.test(input)) {
159
+ lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
160
+ widthExtra = lengthExtra * BLOCK_WIDTH;
161
+ if (width + widthExtra > truncationLimit) {
162
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
163
+ }
164
+ if (width + widthExtra > LIMIT) {
165
+ truncationEnabled = true;
166
+ break outer;
167
+ }
168
+ width += widthExtra;
169
+ unmatchedStart = indexPrev;
170
+ unmatchedEnd = index;
171
+ index = indexPrev = BLOCK_RE.lastIndex;
172
+ continue outer;
173
+ }
174
+ }
175
+ index += 1;
176
+ }
177
+ return {
178
+ width: truncationEnabled ? truncationLimit : width,
179
+ index: truncationEnabled ? truncationIndex : length,
180
+ truncated: truncationEnabled,
181
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
182
+ };
183
+ };
184
+ var dist_default = getStringTruncatedWidth;
185
+
186
+ // ../../node_modules/fast-string-width/dist/index.js
187
+ var NO_TRUNCATION2 = {
188
+ limit: Infinity,
189
+ ellipsis: "",
190
+ ellipsisWidth: 0
191
+ };
192
+ var fastStringWidth = (input, options = {}) => {
193
+ return dist_default(input, NO_TRUNCATION2, options).width;
194
+ };
195
+ var dist_default2 = fastStringWidth;
196
+
197
+ // ../../node_modules/fast-wrap-ansi/lib/main.js
198
+ var ESC = "\x1B";
199
+ var CSI = "\x9B";
200
+ var END_CODE = 39;
201
+ var ANSI_ESCAPE_BELL = "\x07";
202
+ var ANSI_CSI = "[";
203
+ var ANSI_OSC = "]";
204
+ var ANSI_SGR_TERMINATOR = "m";
205
+ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
206
+ var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
207
+ var getClosingCode = (openingCode) => {
208
+ if (openingCode >= 30 && openingCode <= 37)
209
+ return 39;
210
+ if (openingCode >= 90 && openingCode <= 97)
211
+ return 39;
212
+ if (openingCode >= 40 && openingCode <= 47)
213
+ return 49;
214
+ if (openingCode >= 100 && openingCode <= 107)
215
+ return 49;
216
+ if (openingCode === 1 || openingCode === 2)
217
+ return 22;
218
+ if (openingCode === 3)
219
+ return 23;
220
+ if (openingCode === 4)
221
+ return 24;
222
+ if (openingCode === 7)
223
+ return 27;
224
+ if (openingCode === 8)
225
+ return 28;
226
+ if (openingCode === 9)
227
+ return 29;
228
+ if (openingCode === 0)
229
+ return 0;
230
+ return void 0;
231
+ };
232
+ var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
233
+ var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
234
+ var wrapWord = (rows, word, columns) => {
235
+ const characters = word[Symbol.iterator]();
236
+ let isInsideEscape = false;
237
+ let isInsideLinkEscape = false;
238
+ let lastRow = rows.at(-1);
239
+ let visible = lastRow === void 0 ? 0 : dist_default2(lastRow);
240
+ let currentCharacter = characters.next();
241
+ let nextCharacter = characters.next();
242
+ let rawCharacterIndex = 0;
243
+ while (!currentCharacter.done) {
244
+ const character = currentCharacter.value;
245
+ const characterLength = dist_default2(character);
246
+ if (visible + characterLength <= columns) {
247
+ rows[rows.length - 1] += character;
248
+ } else {
249
+ rows.push(character);
250
+ visible = 0;
251
+ }
252
+ if (character === ESC || character === CSI) {
253
+ isInsideEscape = true;
254
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
255
+ }
256
+ if (isInsideEscape) {
257
+ if (isInsideLinkEscape) {
258
+ if (character === ANSI_ESCAPE_BELL) {
259
+ isInsideEscape = false;
260
+ isInsideLinkEscape = false;
261
+ }
262
+ } else if (character === ANSI_SGR_TERMINATOR) {
263
+ isInsideEscape = false;
264
+ }
265
+ } else {
266
+ visible += characterLength;
267
+ if (visible === columns && !nextCharacter.done) {
268
+ rows.push("");
269
+ visible = 0;
270
+ }
271
+ }
272
+ currentCharacter = nextCharacter;
273
+ nextCharacter = characters.next();
274
+ rawCharacterIndex += character.length;
275
+ }
276
+ lastRow = rows.at(-1);
277
+ if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
278
+ rows[rows.length - 2] += rows.pop();
279
+ }
280
+ };
281
+ var stringVisibleTrimSpacesRight = (string) => {
282
+ const words = string.split(" ");
283
+ let last = words.length;
284
+ while (last) {
285
+ if (dist_default2(words[last - 1])) {
286
+ break;
287
+ }
288
+ last--;
289
+ }
290
+ if (last === words.length) {
291
+ return string;
292
+ }
293
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
294
+ };
295
+ var exec = (string, columns, options = {}) => {
296
+ if (options.trim !== false && string.trim() === "") {
297
+ return "";
298
+ }
299
+ let returnValue = "";
300
+ let escapeCode;
301
+ let escapeUrl;
302
+ const words = string.split(" ");
303
+ let rows = [""];
304
+ let rowLength = 0;
305
+ for (let index = 0; index < words.length; index++) {
306
+ const word = words[index];
307
+ if (options.trim !== false) {
308
+ const row = rows.at(-1) ?? "";
309
+ const trimmed = row.trimStart();
310
+ if (row.length !== trimmed.length) {
311
+ rows[rows.length - 1] = trimmed;
312
+ rowLength = dist_default2(trimmed);
313
+ }
314
+ }
315
+ if (index !== 0) {
316
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
317
+ rows.push("");
318
+ rowLength = 0;
319
+ }
320
+ if (rowLength || options.trim === false) {
321
+ rows[rows.length - 1] += " ";
322
+ rowLength++;
323
+ }
324
+ }
325
+ const wordLength = dist_default2(word);
326
+ if (options.hard && wordLength > columns) {
327
+ const remainingColumns = columns - rowLength;
328
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
329
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
330
+ if (breaksStartingNextLine < breaksStartingThisLine) {
331
+ rows.push("");
332
+ }
333
+ wrapWord(rows, word, columns);
334
+ rowLength = dist_default2(rows.at(-1) ?? "");
335
+ continue;
336
+ }
337
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
338
+ if (options.wordWrap === false && rowLength < columns) {
339
+ wrapWord(rows, word, columns);
340
+ rowLength = dist_default2(rows.at(-1) ?? "");
341
+ continue;
342
+ }
343
+ rows.push("");
344
+ rowLength = 0;
345
+ }
346
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
347
+ wrapWord(rows, word, columns);
348
+ rowLength = dist_default2(rows.at(-1) ?? "");
349
+ continue;
350
+ }
351
+ rows[rows.length - 1] += word;
352
+ rowLength += wordLength;
353
+ }
354
+ if (options.trim !== false) {
355
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
356
+ }
357
+ const preString = rows.join("\n");
358
+ let inSurrogate = false;
359
+ for (let i2 = 0; i2 < preString.length; i2++) {
360
+ const character = preString[i2];
361
+ returnValue += character;
362
+ if (!inSurrogate) {
363
+ inSurrogate = character >= "\uD800" && character <= "\uDBFF";
364
+ if (inSurrogate) {
365
+ continue;
366
+ }
367
+ } else {
368
+ inSurrogate = false;
369
+ }
370
+ if (character === ESC || character === CSI) {
371
+ GROUP_REGEX.lastIndex = i2 + 1;
372
+ const groupsResult = GROUP_REGEX.exec(preString);
373
+ const groups = groupsResult?.groups;
374
+ if (groups?.code !== void 0) {
375
+ const code = Number.parseFloat(groups.code);
376
+ escapeCode = code === END_CODE ? void 0 : code;
377
+ } else if (groups?.uri !== void 0) {
378
+ escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
379
+ }
380
+ }
381
+ if (preString[i2 + 1] === "\n") {
382
+ if (escapeUrl) {
383
+ returnValue += wrapAnsiHyperlink("");
384
+ }
385
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
386
+ if (escapeCode && closingCode) {
387
+ returnValue += wrapAnsiCode(closingCode);
388
+ }
389
+ } else if (character === "\n") {
390
+ if (escapeCode && getClosingCode(escapeCode)) {
391
+ returnValue += wrapAnsiCode(escapeCode);
392
+ }
393
+ if (escapeUrl) {
394
+ returnValue += wrapAnsiHyperlink(escapeUrl);
395
+ }
396
+ }
397
+ }
398
+ return returnValue;
399
+ };
400
+ var CRLF_OR_LF = /\r?\n/;
401
+ function wrapAnsi(string, columns, options) {
402
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
403
+ }
404
+
405
+ // ../../node_modules/@clack/core/dist/index.mjs
406
+ var import_sisteransi = __toESM(require_src(), 1);
407
+ import { ReadStream } from "tty";
408
+ function findCursor(s, o, l2) {
409
+ if (!l2.some((r2) => !r2.disabled))
410
+ return s;
411
+ const t2 = s + o, n3 = Math.max(l2.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
412
+ return l2[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l2) : e;
413
+ }
414
+ var a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
415
+ var t = [
416
+ "January",
417
+ "February",
418
+ "March",
419
+ "April",
420
+ "May",
421
+ "June",
422
+ "July",
423
+ "August",
424
+ "September",
425
+ "October",
426
+ "November",
427
+ "December"
428
+ ];
429
+ var settings = {
430
+ actions: new Set(a$1),
431
+ aliases: /* @__PURE__ */ new Map([
432
+ // vim support
433
+ ["k", "up"],
434
+ ["j", "down"],
435
+ ["h", "left"],
436
+ ["l", "right"],
437
+ ["", "cancel"],
438
+ // opinionated defaults!
439
+ ["escape", "cancel"]
440
+ ]),
441
+ messages: {
442
+ cancel: "Canceled",
443
+ error: "Something went wrong"
444
+ },
445
+ withGuide: true,
446
+ accessible: void 0,
447
+ date: {
448
+ monthNames: [...t],
449
+ messages: {
450
+ required: "Please enter a valid date",
451
+ invalidMonth: "There are only 12 months in a year",
452
+ invalidDay: (n3, e) => `There are only ${n3} days in ${e}`,
453
+ afterMin: (n3) => `Date must be on or after ${n3.toISOString().slice(0, 10)}`,
454
+ beforeMax: (n3) => `Date must be on or before ${n3.toISOString().slice(0, 10)}`
455
+ }
456
+ }
457
+ };
458
+ function isAccessible(n3) {
459
+ if (n3 !== void 0) return n3;
460
+ if (settings.accessible !== void 0) return settings.accessible;
461
+ const e = process.env.ACCESSIBLE;
462
+ return e !== void 0 && e !== "" && e !== "0" && e !== "false";
463
+ }
464
+ function isActionKey(n3, e) {
465
+ if (typeof n3 == "string")
466
+ return settings.aliases.get(n3) === e;
467
+ for (const s of n3)
468
+ if (s !== void 0 && isActionKey(s, e))
469
+ return true;
470
+ return false;
471
+ }
472
+ function diffLines(i2, s) {
473
+ if (i2 === s) return;
474
+ const e = i2.split(`
475
+ `), t2 = s.split(`
476
+ `), r2 = Math.max(e.length, t2.length), f = [];
477
+ for (let n3 = 0; n3 < r2; n3++)
478
+ e[n3] !== t2[n3] && f.push(n3);
479
+ return {
480
+ lines: f,
481
+ numLinesBefore: e.length,
482
+ numLinesAfter: t2.length,
483
+ numLines: r2
484
+ };
485
+ }
486
+ var R = globalThis.process.platform.startsWith("win");
487
+ var CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
488
+ function isCancel(e) {
489
+ return e === CANCEL_SYMBOL;
490
+ }
491
+ function setRawMode(e, r2) {
492
+ const o = e;
493
+ o.isTTY && o.setRawMode(r2);
494
+ }
495
+ var getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
496
+ var getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
497
+ function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
498
+ const f = getColumns(e ?? stdout);
499
+ return wrapAnsi(r2, f - o.length, {
500
+ hard: true,
501
+ trim: false
502
+ }).split(`
503
+ `).map((c2, i2, m2) => {
504
+ const d = t2 ? t2(c2, i2) : c2;
505
+ return i2 === 0 ? `${n3}${d}` : i2 === m2.length - 1 ? `${s}${d}` : `${o}${d}`;
506
+ }).join(`
507
+ `);
508
+ }
509
+ function runValidation(e, a2) {
510
+ if ("~standard" in e) {
511
+ const n3 = e["~standard"].validate(a2);
512
+ return n3 instanceof Promise ? n3.then((r2) => r2.issues?.at(0)?.message) : n3.issues?.at(0)?.message;
513
+ }
514
+ return e(a2);
515
+ }
516
+ var y = class {
517
+ input;
518
+ output;
519
+ _abortSignal;
520
+ rl;
521
+ opts;
522
+ _render;
523
+ _track = false;
524
+ _prevFrame = "";
525
+ _subscribers = /* @__PURE__ */ new Map();
526
+ _cursor = 0;
527
+ state = "initial";
528
+ error = "";
529
+ value;
530
+ userInput = "";
531
+ /**
532
+ * Whether accessible (static, screen-reader friendly) output is enabled for
533
+ * this prompt, resolved from the `accessible` option, the global setting,
534
+ * and the `ACCESSIBLE` env var.
535
+ */
536
+ get accessible() {
537
+ return isAccessible(this.opts.accessible);
538
+ }
539
+ constructor(t2, e = true) {
540
+ const { input: i2 = stdin, output: s = stdout, render: r2, signal: n3, ...o } = t2;
541
+ this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r2.bind(this), this._track = e, this._abortSignal = n3, this.input = i2, this.output = s;
542
+ }
543
+ /**
544
+ * Unsubscribe all listeners
545
+ */
546
+ unsubscribe() {
547
+ this._subscribers.clear();
548
+ }
549
+ /**
550
+ * Set a subscriber with opts
551
+ * @param event - The event name
552
+ */
553
+ setSubscriber(t2, e) {
554
+ const i2 = this._subscribers.get(t2) ?? [];
555
+ i2.push(e), this._subscribers.set(t2, i2);
556
+ }
557
+ /**
558
+ * Subscribe to an event
559
+ * @param event - The event name
560
+ * @param cb - The callback
561
+ */
562
+ on(t2, e) {
563
+ this.setSubscriber(t2, { cb: e });
564
+ }
565
+ /**
566
+ * Subscribe to an event once
567
+ * @param event - The event name
568
+ * @param cb - The callback
569
+ */
570
+ once(t2, e) {
571
+ this.setSubscriber(t2, { cb: e, once: true });
572
+ }
573
+ /**
574
+ * Emit an event with data
575
+ * @param event - The event name
576
+ * @param data - The data to pass to the callback
577
+ */
578
+ emit(t2, ...e) {
579
+ const i2 = this._subscribers.get(t2) ?? [], s = [];
580
+ for (const r2 of i2)
581
+ r2.cb(...e), r2.once && s.push(() => i2.splice(i2.indexOf(r2), 1));
582
+ for (const r2 of s)
583
+ r2();
584
+ }
585
+ prompt() {
586
+ return new Promise((t2) => {
587
+ if (this._abortSignal) {
588
+ if (this._abortSignal.aborted)
589
+ return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
590
+ this._abortSignal.addEventListener(
591
+ "abort",
592
+ () => {
593
+ this.state = "cancel", this.close();
594
+ },
595
+ { once: true }
596
+ );
597
+ }
598
+ this.rl = l__default.createInterface({
599
+ input: this.input,
600
+ tabSize: 2,
601
+ prompt: "",
602
+ escapeCodeTimeout: 50,
603
+ terminal: true
604
+ }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
605
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
606
+ }), this.once("cancel", () => {
607
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
608
+ });
609
+ });
610
+ }
611
+ _isActionKey(t2, e) {
612
+ return t2 === " ";
613
+ }
614
+ _shouldSubmit(t2, e) {
615
+ return true;
616
+ }
617
+ _setValue(t2) {
618
+ this.value = t2, this.emit("value", this.value);
619
+ }
620
+ _setUserInput(t2, e) {
621
+ this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
622
+ }
623
+ _clearUserInput() {
624
+ this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
625
+ }
626
+ async onKeypress(t2, e) {
627
+ if (this.state !== "validating") {
628
+ if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
629
+ if (this.opts.validate) {
630
+ const i2 = runValidation(this.opts.validate, this.value);
631
+ let s;
632
+ i2 instanceof Promise ? (this.state = "validating", this.render(), s = await i2) : s = i2, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
633
+ }
634
+ this.state !== "error" && (this.state = "submit");
635
+ }
636
+ isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
637
+ }
638
+ }
639
+ close() {
640
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
641
+ `), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
642
+ }
643
+ restoreCursor() {
644
+ const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
645
+ `).length - 1;
646
+ this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
647
+ }
648
+ render() {
649
+ const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
650
+ hard: true,
651
+ trim: false
652
+ });
653
+ if (t2 !== this._prevFrame) {
654
+ if (this.state === "initial")
655
+ this.output.write(import_sisteransi.cursor.hide);
656
+ else {
657
+ const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
658
+ if (this.restoreCursor(), e) {
659
+ const s = Math.max(0, e.numLinesAfter - i2), r2 = Math.max(0, e.numLinesBefore - i2);
660
+ let n3 = e.lines.find((o) => o >= s);
661
+ if (n3 === void 0) {
662
+ this._prevFrame = t2;
663
+ return;
664
+ }
665
+ if (e.lines.length === 1) {
666
+ this.output.write(import_sisteransi.cursor.move(0, n3 - r2)), this.output.write(import_sisteransi.erase.lines(1));
667
+ const o = t2.split(`
668
+ `);
669
+ this.output.write(o[n3]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, o.length - n3 - 1));
670
+ return;
671
+ } else if (e.lines.length > 1) {
672
+ if (s < r2)
673
+ n3 = s;
674
+ else {
675
+ const h2 = n3 - r2;
676
+ h2 > 0 && this.output.write(import_sisteransi.cursor.move(0, h2));
677
+ }
678
+ this.output.write(import_sisteransi.erase.down());
679
+ const f = t2.split(`
680
+ `).slice(n3);
681
+ this.output.write(f.join(`
682
+ `)), this._prevFrame = t2;
683
+ return;
684
+ }
685
+ }
686
+ this.output.write(import_sisteransi.erase.down());
687
+ }
688
+ this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
689
+ }
690
+ }
691
+ };
692
+ var r = class extends y {
693
+ get cursor() {
694
+ return this.value ? 0 : 1;
695
+ }
696
+ get _value() {
697
+ return this.cursor === 0;
698
+ }
699
+ constructor(t2) {
700
+ super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
701
+ this.value = this._value;
702
+ }), this.on("confirm", (i2) => {
703
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = i2, this.state = "submit", this.close();
704
+ }), this.on("cursor", () => {
705
+ this.value = !this.value;
706
+ });
707
+ }
708
+ };
709
+ var a = class extends y {
710
+ options;
711
+ cursor = 0;
712
+ get _value() {
713
+ return this.options[this.cursor]?.value;
714
+ }
715
+ get _enabledOptions() {
716
+ return this.options.filter((e) => e.disabled !== true);
717
+ }
718
+ toggleAll() {
719
+ const e = this._enabledOptions, i2 = this.value !== void 0 && this.value.length === e.length;
720
+ this.value = i2 ? [] : e.map((t2) => t2.value);
721
+ }
722
+ toggleInvert() {
723
+ const e = this.value;
724
+ if (!e)
725
+ return;
726
+ const i2 = this._enabledOptions.filter((t2) => !e.includes(t2.value));
727
+ this.value = i2.map((t2) => t2.value);
728
+ }
729
+ toggleValue() {
730
+ this.value === void 0 && (this.value = []);
731
+ const e = this.value.includes(this._value);
732
+ this.value = e ? this.value.filter((i2) => i2 !== this._value) : [...this.value, this._value];
733
+ }
734
+ constructor(e) {
735
+ super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
736
+ const i2 = Math.max(
737
+ this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt),
738
+ 0
739
+ );
740
+ this.cursor = this.options[i2]?.disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2, l2) => {
741
+ l2.name === "a" && this.toggleAll(), l2.name === "i" && this.toggleInvert();
742
+ }), this.on("cursor", (t2) => {
743
+ switch (t2) {
744
+ case "left":
745
+ case "up":
746
+ this.cursor = findCursor(this.cursor, -1, this.options);
747
+ break;
748
+ case "down":
749
+ case "right":
750
+ this.cursor = findCursor(this.cursor, 1, this.options);
751
+ break;
752
+ case "space":
753
+ this.toggleValue();
754
+ break;
755
+ }
756
+ });
757
+ }
758
+ };
759
+ var n$1 = class n extends y {
760
+ options;
761
+ cursor = 0;
762
+ get _selectedValue() {
763
+ return this.options[this.cursor];
764
+ }
765
+ changeValue() {
766
+ const e = this._selectedValue;
767
+ this.value = e === void 0 ? void 0 : e.value;
768
+ }
769
+ constructor(e) {
770
+ super(e, false), this.options = e.options;
771
+ const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o === -1 ? 0 : o;
772
+ this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
773
+ switch (s) {
774
+ case "left":
775
+ case "up":
776
+ this.cursor = findCursor(this.cursor, -1, this.options);
777
+ break;
778
+ case "down":
779
+ case "right":
780
+ this.cursor = findCursor(this.cursor, 1, this.options);
781
+ break;
782
+ }
783
+ this.changeValue();
784
+ });
785
+ }
786
+ };
787
+
788
+ // ../../node_modules/@clack/prompts/dist/index.mjs
789
+ import { styleText as styleText2, stripVTControlCharacters } from "util";
790
+ import process$1 from "process";
791
+ var import_sisteransi2 = __toESM(require_src(), 1);
792
+ import { existsSync, lstatSync, readdirSync } from "fs";
793
+ import { dirname, join } from "path";
794
+ function isUnicodeSupported() {
795
+ if (process$1.platform !== "win32") {
796
+ return process$1.env.TERM !== "linux";
797
+ }
798
+ return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
799
+ }
800
+ var unicode = isUnicodeSupported();
801
+ var unicodeOr = (o, e) => unicode ? o : e;
802
+ var S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
803
+ var S_STEP_CANCEL = unicodeOr("\u25A0", "x");
804
+ var S_STEP_ERROR = unicodeOr("\u25B2", "x");
805
+ var S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
806
+ var S_BAR_START = unicodeOr("\u250C", "T");
807
+ var S_BAR = unicodeOr("\u2502", "|");
808
+ var S_BAR_END = unicodeOr("\u2514", "\u2014");
809
+ var S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
810
+ var S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
811
+ var S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
812
+ var S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
813
+ var S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
814
+ var S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
815
+ var S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
816
+ var S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
817
+ var S_BAR_H = unicodeOr("\u2500", "-");
818
+ var S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
819
+ var S_CONNECT_LEFT = unicodeOr("\u251C", "+");
820
+ var S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
821
+ var S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
822
+ var S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
823
+ var S_INFO = unicodeOr("\u25CF", "\u2022");
824
+ var S_SUCCESS = unicodeOr("\u25C6", "*");
825
+ var S_WARN = unicodeOr("\u25B2", "!");
826
+ var S_ERROR = unicodeOr("\u25A0", "x");
827
+ var symbol = (o) => {
828
+ switch (o) {
829
+ case "initial":
830
+ case "active":
831
+ return styleText2("cyan", S_STEP_ACTIVE);
832
+ case "cancel":
833
+ return styleText2("red", S_STEP_CANCEL);
834
+ case "error":
835
+ return styleText2("yellow", S_STEP_ERROR);
836
+ case "submit":
837
+ return styleText2("green", S_STEP_SUBMIT);
838
+ case "validating":
839
+ return styleText2("dim", S_STEP_ACTIVE);
840
+ }
841
+ };
842
+ var symbolBar = (o) => {
843
+ switch (o) {
844
+ case "initial":
845
+ case "active":
846
+ return styleText2("cyan", S_BAR);
847
+ case "cancel":
848
+ return styleText2("red", S_BAR);
849
+ case "error":
850
+ return styleText2("yellow", S_BAR);
851
+ case "submit":
852
+ return styleText2("green", S_BAR);
853
+ }
854
+ };
855
+ function formatInstructionFooter(o, e) {
856
+ const r2 = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
857
+ return e && r2.push(styleText2("cyan", S_BAR_END)), r2;
858
+ }
859
+ var I = (l2, e, w, p, b, C2 = false) => {
860
+ let r2 = e, O = 0;
861
+ if (C2)
862
+ for (let i2 = p - 1; i2 >= w; i2--) {
863
+ const m2 = l2[i2];
864
+ if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
865
+ }
866
+ else
867
+ for (let i2 = w; i2 < p; i2++) {
868
+ const m2 = l2[i2];
869
+ if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
870
+ }
871
+ return { lineCount: r2, removals: O };
872
+ };
873
+ var limitOptions = ({
874
+ cursor: l2,
875
+ options: e,
876
+ style: w,
877
+ output: p = process.stdout,
878
+ maxItems: b = Number.POSITIVE_INFINITY,
879
+ columnPadding: C2 = 0,
880
+ rowPadding: r2 = 4
881
+ }) => {
882
+ const i2 = getColumns(p) - C2, m2 = getRows(p), M = styleText2("dim", "..."), v = Math.max(m2 - r2, 0), a2 = Math.max(Math.min(b, v), 5);
883
+ let f = 0;
884
+ l2 >= a2 - 3 && (f = Math.max(
885
+ Math.min(l2 - a2 + 3, e.length - a2),
886
+ 0
887
+ ));
888
+ let d = a2 < e.length && f > 0, c2 = a2 < e.length && f + a2 < e.length;
889
+ const W = Math.min(
890
+ f + a2,
891
+ e.length
892
+ ), s = [];
893
+ let g = 0;
894
+ d && g++, c2 && g++;
895
+ const T = f + (d ? 1 : 0), y2 = W - (c2 ? 1 : 0);
896
+ for (let t2 = T; t2 < y2; t2++) {
897
+ const n3 = e[t2], o = n3 ? w(n3, t2 === l2) : "", h2 = wrapAnsi(o, i2, {
898
+ hard: true,
899
+ trim: false
900
+ }).split(`
901
+ `);
902
+ s.push(h2), g += h2.length;
903
+ }
904
+ if (g > v) {
905
+ let t2 = 0, n3 = 0, o = g;
906
+ const h2 = l2 - T;
907
+ let u3 = v;
908
+ const L = () => I(s, o, 0, h2, u3), E = () => I(
909
+ s,
910
+ o,
911
+ h2 + 1,
912
+ s.length,
913
+ u3,
914
+ true
915
+ );
916
+ d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (c2 || (u3 -= 1), { lineCount: o, removals: n3 } = E())) : (c2 || (u3 -= 1), { lineCount: o, removals: n3 } = E(), o > u3 && (u3 -= 1, { lineCount: o, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c2 = true, s.splice(s.length - n3, n3));
917
+ }
918
+ const x = [];
919
+ d && x.push(M);
920
+ for (const t2 of s)
921
+ for (const n3 of t2)
922
+ x.push(n3);
923
+ return c2 && x.push(M), x;
924
+ };
925
+ var confirm = (e) => {
926
+ const a2 = e.active ?? "Yes", o = e.inactive ?? "No";
927
+ return new r({
928
+ active: a2,
929
+ inactive: o,
930
+ signal: e.signal,
931
+ input: e.input,
932
+ output: e.output,
933
+ initialValue: e.initialValue ?? true,
934
+ render() {
935
+ const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l2 = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
936
+ e.output,
937
+ e.message,
938
+ l2,
939
+ u3
940
+ ), s = `${i2 ? `${styleText2("gray", S_BAR)}
941
+ ` : ""}${f}
942
+ `, c2 = this.value ? a2 : o;
943
+ switch (this.state) {
944
+ case "submit": {
945
+ const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
946
+ return `${s}${r2}${styleText2("dim", c2)}`;
947
+ }
948
+ case "cancel": {
949
+ const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
950
+ return `${s}${r2}${styleText2(["strikethrough", "dim"], c2)}${i2 ? `
951
+ ${styleText2("gray", S_BAR)}` : ""}`;
952
+ }
953
+ default: {
954
+ const r2 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", g = i2 ? styleText2("cyan", S_BAR_END) : "";
955
+ return `${s}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${e.vertical ? i2 ? `
956
+ ${styleText2("cyan", S_BAR)} ` : `
957
+ ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", o)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${o}`}
958
+ ${g}
959
+ `;
960
+ }
961
+ }
962
+ }
963
+ }).prompt();
964
+ };
965
+ var MULTISELECT_INSTRUCTIONS = [
966
+ `${styleText2("dim", "\u2191/\u2193")} to navigate`,
967
+ `${styleText2("dim", "Space:")} select`,
968
+ `${styleText2("dim", "Enter:")} confirm`
969
+ ];
970
+ var m = (i2, u3) => i2.split(`
971
+ `).map((d) => u3(d)).join(`
972
+ `);
973
+ var multiselect = (i2) => {
974
+ const u3 = (t2, a2) => {
975
+ const r2 = t2.label ?? String(t2.value);
976
+ return a2 === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2(["strikethrough", "gray"], o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${m(r2, (o) => styleText2("dim", o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m(r2, (o) => styleText2(["strikethrough", "dim"], o))}` : a2 === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m(r2, (o) => styleText2("dim", o))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2("dim", o))}`;
977
+ }, d = i2.required ?? true, x = i2.showInstructions ?? true;
978
+ return new a({
979
+ options: i2.options,
980
+ signal: i2.signal,
981
+ input: i2.input,
982
+ output: i2.output,
983
+ initialValues: i2.initialValues,
984
+ required: d,
985
+ cursorAt: i2.cursorAt,
986
+ validate(t2) {
987
+ if (d && (t2 === void 0 || t2.length === 0))
988
+ return `Please select at least one option.
989
+ ${styleText2(
990
+ "reset",
991
+ styleText2(
992
+ "dim",
993
+ `Press ${styleText2(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText2(
994
+ "gray",
995
+ styleText2("bgWhite", styleText2("inverse", " enter "))
996
+ )} to submit`
997
+ )
998
+ )}`;
999
+ },
1000
+ render() {
1001
+ const t2 = i2.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(
1002
+ i2.output,
1003
+ i2.message,
1004
+ t2 ? `${symbolBar(this.state)} ` : "",
1005
+ `${symbol(this.state)} `
1006
+ ), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
1007
+ ` : ""}${a2}
1008
+ `, o = this.value ?? [], g = (n3, l2) => {
1009
+ if (n3.disabled)
1010
+ return u3(n3, "disabled");
1011
+ const s = o.includes(n3.value);
1012
+ return l2 && s ? u3(n3, "active-selected") : s ? u3(n3, "selected") : u3(n3, l2 ? "active" : "inactive");
1013
+ };
1014
+ switch (this.state) {
1015
+ case "submit": {
1016
+ const n3 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l2 = wrapTextWithPrefix(
1017
+ i2.output,
1018
+ n3,
1019
+ t2 ? `${styleText2("gray", S_BAR)} ` : ""
1020
+ );
1021
+ return `${r2}${l2}`;
1022
+ }
1023
+ case "cancel": {
1024
+ const n3 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "cancelled")).join(styleText2("dim", ", "));
1025
+ if (n3.trim() === "")
1026
+ return `${r2}${styleText2("gray", S_BAR)}`;
1027
+ const l2 = wrapTextWithPrefix(
1028
+ i2.output,
1029
+ n3,
1030
+ t2 ? `${styleText2("gray", S_BAR)} ` : ""
1031
+ );
1032
+ return `${r2}${l2}${t2 ? `
1033
+ ${styleText2("gray", S_BAR)}` : ""}`;
1034
+ }
1035
+ case "error": {
1036
+ const n3 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l2 = this.error.split(`
1037
+ `).map(
1038
+ ($, v) => v === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`
1039
+ ).join(`
1040
+ `), s = r2.split(`
1041
+ `).length, h2 = l2.split(`
1042
+ `).length + 1;
1043
+ return `${r2}${n3}${limitOptions({
1044
+ output: i2.output,
1045
+ options: this.options,
1046
+ cursor: this.cursor,
1047
+ maxItems: i2.maxItems,
1048
+ columnPadding: n3.length,
1049
+ rowPadding: s + h2,
1050
+ style: g
1051
+ }).join(`
1052
+ ${n3}`)}
1053
+ ${l2}
1054
+ `;
1055
+ }
1056
+ default: {
1057
+ const n3 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l2 = r2.split(`
1058
+ `).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
1059
+ `), $ = s.length + 1;
1060
+ return `${r2}${n3}${limitOptions({
1061
+ output: i2.output,
1062
+ options: this.options,
1063
+ cursor: this.cursor,
1064
+ maxItems: i2.maxItems,
1065
+ columnPadding: n3.length,
1066
+ rowPadding: l2 + $,
1067
+ style: g
1068
+ }).join(`
1069
+ ${n3}`)}
1070
+ ${h2}
1071
+ `;
1072
+ }
1073
+ }
1074
+ }
1075
+ }).prompt();
1076
+ };
1077
+ var intro = (o = "", t2) => {
1078
+ const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
1079
+ i2.write(`${e}${o}
1080
+ `);
1081
+ };
1082
+ var outro = (o = "", t2) => {
1083
+ const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
1084
+ ${styleText2("gray", S_BAR_END)} ` : "";
1085
+ i2.write(`${e}${o}
1086
+
1087
+ `);
1088
+ };
1089
+ var W$1 = (o) => o;
1090
+ var C = (o, e, s) => {
1091
+ const a2 = {
1092
+ hard: true,
1093
+ trim: false
1094
+ }, i2 = wrapAnsi(o, e, a2).split(`
1095
+ `), c2 = i2.reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), u3 = i2.map(s).reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), g = e - (u3 - c2);
1096
+ return wrapAnsi(o, g, a2);
1097
+ };
1098
+ var note = (o = "", e = "", s) => {
1099
+ const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c2 = s?.format ?? W$1, g = ["", ...C(o, getColumns(a2) - 6, c2).split(`
1100
+ `).map(c2), ""], n3 = dist_default2(e), t2 = Math.max(
1101
+ g.reduce((m2, F) => {
1102
+ const O = dist_default2(F);
1103
+ return O > m2 ? O : m2;
1104
+ }, 0),
1105
+ n3
1106
+ ) + 2, h2 = g.map(
1107
+ (m2) => `${styleText2("gray", S_BAR)} ${m2}${" ".repeat(t2 - dist_default2(m2))}${styleText2("gray", S_BAR)}`
1108
+ ).join(`
1109
+ `), T = i2 ? `${styleText2("gray", S_BAR)}
1110
+ ` : "", l$1 = i2 ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
1111
+ a2.write(
1112
+ `${T}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2(
1113
+ "gray",
1114
+ S_BAR_H.repeat(Math.max(t2 - n3 - 1, 1)) + S_CORNER_TOP_RIGHT
1115
+ )}
1116
+ ${h2}
1117
+ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1118
+ `
1119
+ );
1120
+ };
1121
+ var u2 = {
1122
+ light: unicodeOr("\u2500", "-"),
1123
+ heavy: unicodeOr("\u2501", "="),
1124
+ block: unicodeOr("\u2588", "#")
1125
+ };
1126
+ var SELECT_INSTRUCTIONS = [
1127
+ `${styleText2("dim", "\u2191/\u2193")} to navigate`,
1128
+ `${styleText2("dim", "Enter:")} confirm`
1129
+ ];
1130
+ var c = (t2, o) => t2.includes(`
1131
+ `) ? t2.split(`
1132
+ `).map((d) => o(d)).join(`
1133
+ `) : o(t2);
1134
+ var select = (t2) => {
1135
+ const o = (n3, m2) => {
1136
+ if (n3 === void 0)
1137
+ return "";
1138
+ const s = n3.label ?? String(n3.value);
1139
+ switch (m2) {
1140
+ case "disabled":
1141
+ return `${styleText2("gray", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
1142
+ case "selected":
1143
+ return `${c(s, (i2) => styleText2("dim", i2))}`;
1144
+ case "active":
1145
+ return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
1146
+ case "cancelled":
1147
+ return `${c(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
1148
+ default:
1149
+ return `${styleText2("dim", S_RADIO_INACTIVE)} ${c(s, (i2) => styleText2("dim", i2))}`;
1150
+ }
1151
+ }, d = t2.showInstructions ?? true;
1152
+ return new n$1({
1153
+ options: t2.options,
1154
+ signal: t2.signal,
1155
+ input: t2.input,
1156
+ output: t2.output,
1157
+ initialValue: t2.initialValue,
1158
+ render() {
1159
+ const n3 = t2.withGuide ?? settings.withGuide, m2 = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
1160
+ t2.output,
1161
+ t2.message,
1162
+ s,
1163
+ m2
1164
+ ), u3 = `${n3 ? `${styleText2("gray", S_BAR)}
1165
+ ` : ""}${i2}
1166
+ `;
1167
+ switch (this.state) {
1168
+ case "submit": {
1169
+ const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
1170
+ t2.output,
1171
+ o(this.options[this.cursor], "selected"),
1172
+ r2
1173
+ );
1174
+ return `${u3}${a2}`;
1175
+ }
1176
+ case "cancel": {
1177
+ const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
1178
+ t2.output,
1179
+ o(this.options[this.cursor], "cancelled"),
1180
+ r2
1181
+ );
1182
+ return `${u3}${a2}${n3 ? `
1183
+ ${styleText2("gray", S_BAR)}` : ""}`;
1184
+ }
1185
+ default: {
1186
+ const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
1187
+ `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1188
+ `), b = p.length + 1;
1189
+ return `${u3}${r2}${limitOptions({
1190
+ output: t2.output,
1191
+ cursor: this.cursor,
1192
+ options: this.options,
1193
+ maxItems: t2.maxItems,
1194
+ columnPadding: r2.length,
1195
+ rowPadding: a2 + b,
1196
+ style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
1197
+ }).join(`
1198
+ ${r2}`)}
1199
+ ${f}
1200
+ `;
1201
+ }
1202
+ }
1203
+ }
1204
+ }).prompt();
1205
+ };
1206
+ var i = `${styleText2("gray", S_BAR)} `;
1207
+
1208
+ export {
1209
+ isCancel,
1210
+ wrapTextWithPrefix,
1211
+ a,
1212
+ S_BAR,
1213
+ S_BAR_END,
1214
+ S_CHECKBOX_ACTIVE,
1215
+ S_CHECKBOX_SELECTED,
1216
+ S_CHECKBOX_INACTIVE,
1217
+ symbol,
1218
+ confirm,
1219
+ multiselect,
1220
+ intro,
1221
+ outro,
1222
+ note,
1223
+ select
1224
+ };
1225
+ //# sourceMappingURL=chunk-3EXHM5L2.js.map