kanbo-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +79 -0
  3. package/dist/better-sqlite3-fU3G4xnX.cjs +2254 -0
  4. package/dist/better-sqlite3-fU3G4xnX.cjs.map +1 -0
  5. package/dist/cli.cjs +42949 -0
  6. package/dist/cli.cjs.map +1 -0
  7. package/dist/dist-Cd6wg8pp.cjs +942 -0
  8. package/dist/dist-Cd6wg8pp.cjs.map +1 -0
  9. package/dist/drizzle-postgres/0000_board.sql +135 -0
  10. package/dist/drizzle-postgres/0001_history_order.sql +2 -0
  11. package/dist/drizzle-postgres/0002_issue_pull_requests.sql +16 -0
  12. package/dist/drizzle-postgres/0003_milestone_start_date.sql +1 -0
  13. package/dist/drizzle-postgres/0004_status_entry_rules.sql +1 -0
  14. package/dist/drizzle-postgres/0005_run_external_session_ref.sql +1 -0
  15. package/dist/drizzle-postgres/README.md +61 -0
  16. package/dist/drizzle-postgres/meta/0000_snapshot.json +1078 -0
  17. package/dist/drizzle-postgres/meta/0001_snapshot.json +1090 -0
  18. package/dist/drizzle-postgres/meta/0002_snapshot.json +1239 -0
  19. package/dist/drizzle-postgres/meta/0003_snapshot.json +1245 -0
  20. package/dist/drizzle-postgres/meta/0004_snapshot.json +1251 -0
  21. package/dist/drizzle-postgres/meta/0005_snapshot.json +1257 -0
  22. package/dist/drizzle-postgres/meta/_journal.json +48 -0
  23. package/dist/drizzle-sqlite/0000_board.sql +133 -0
  24. package/dist/drizzle-sqlite/0001_issue_pull_requests.sql +15 -0
  25. package/dist/drizzle-sqlite/0002_milestone_start_date.sql +1 -0
  26. package/dist/drizzle-sqlite/0003_status_entry_rules.sql +1 -0
  27. package/dist/drizzle-sqlite/0004_run_external_session_ref.sql +1 -0
  28. package/dist/drizzle-sqlite/README.md +67 -0
  29. package/dist/drizzle-sqlite/meta/0000_snapshot.json +946 -0
  30. package/dist/drizzle-sqlite/meta/0001_snapshot.json +1054 -0
  31. package/dist/drizzle-sqlite/meta/0002_snapshot.json +1061 -0
  32. package/dist/drizzle-sqlite/meta/0003_snapshot.json +1068 -0
  33. package/dist/drizzle-sqlite/meta/0004_snapshot.json +1075 -0
  34. package/dist/drizzle-sqlite/meta/_journal.json +41 -0
  35. package/dist/lib/board-store-B16YarvX.d.mts +281 -0
  36. package/dist/lib/board-store-BHHo_ZlR.d.cts +281 -0
  37. package/dist/lib/index.cjs +340 -0
  38. package/dist/lib/index.cjs.map +1 -0
  39. package/dist/lib/index.d.cts +1608 -0
  40. package/dist/lib/index.d.mts +1608 -0
  41. package/dist/lib/index.mjs +284 -0
  42. package/dist/lib/index.mjs.map +1 -0
  43. package/dist/lib/manifest-C0EcwwgO.mjs +7866 -0
  44. package/dist/lib/manifest-C0EcwwgO.mjs.map +1 -0
  45. package/dist/lib/manifest-CpZOcB_6.cjs +8272 -0
  46. package/dist/lib/manifest-CpZOcB_6.cjs.map +1 -0
  47. package/dist/lib/mcp/index.cjs +184 -0
  48. package/dist/lib/mcp/index.cjs.map +1 -0
  49. package/dist/lib/mcp/index.d.cts +346 -0
  50. package/dist/lib/mcp/index.d.mts +346 -0
  51. package/dist/lib/mcp/index.mjs +173 -0
  52. package/dist/lib/mcp/index.mjs.map +1 -0
  53. package/dist/lib/migrate-BhYi9cXw.mjs +656 -0
  54. package/dist/lib/migrate-BhYi9cXw.mjs.map +1 -0
  55. package/dist/lib/migrate-DnMjTCvu.cjs +709 -0
  56. package/dist/lib/migrate-DnMjTCvu.cjs.map +1 -0
  57. package/dist/lib/migrations-path-CZxVOgeD.cjs +109 -0
  58. package/dist/lib/migrations-path-CZxVOgeD.cjs.map +1 -0
  59. package/dist/lib/migrations-path-Ciwan537.mjs +80 -0
  60. package/dist/lib/migrations-path-Ciwan537.mjs.map +1 -0
  61. package/dist/lib/postgres/index.cjs +56 -0
  62. package/dist/lib/postgres/index.cjs.map +1 -0
  63. package/dist/lib/postgres/index.d.cts +3403 -0
  64. package/dist/lib/postgres/index.d.mts +3403 -0
  65. package/dist/lib/postgres/index.mjs +35 -0
  66. package/dist/lib/postgres/index.mjs.map +1 -0
  67. package/dist/lib/roles.sql-B9rt-x4o.cjs +1033 -0
  68. package/dist/lib/roles.sql-B9rt-x4o.cjs.map +1 -0
  69. package/dist/lib/roles.sql-CvyCGt38.mjs +920 -0
  70. package/dist/lib/roles.sql-CvyCGt38.mjs.map +1 -0
  71. package/dist/lib/schema-epoch-ZyumVL_A.d.cts +16 -0
  72. package/dist/lib/schema-epoch-ZyumVL_A.d.mts +16 -0
  73. package/dist/lib/schema-fsHqNAip.d.cts +3612 -0
  74. package/dist/lib/schema-fsHqNAip.d.mts +3612 -0
  75. package/dist/lib/sqlite/index.cjs +23 -0
  76. package/dist/lib/sqlite/index.d.cts +175 -0
  77. package/dist/lib/sqlite/index.d.mts +175 -0
  78. package/dist/lib/sqlite/index.mjs +4 -0
  79. package/dist/lib/sqlite/schema.cjs +266 -0
  80. package/dist/lib/sqlite/schema.cjs.map +1 -0
  81. package/dist/lib/sqlite/schema.d.cts +2 -0
  82. package/dist/lib/sqlite/schema.d.mts +2 -0
  83. package/dist/lib/sqlite/schema.mjs +256 -0
  84. package/dist/lib/sqlite/schema.mjs.map +1 -0
  85. package/dist/lib/tool-names-9cmCn0gP.d.cts +112 -0
  86. package/dist/lib/tool-names-Dxg1UTUl.d.mts +112 -0
  87. package/dist/page/board.css +477 -0
  88. package/dist/page/board.js +2 -0
  89. package/drizzle-postgres/0000_board.sql +135 -0
  90. package/drizzle-postgres/0001_history_order.sql +2 -0
  91. package/drizzle-postgres/0002_issue_pull_requests.sql +16 -0
  92. package/drizzle-postgres/0003_milestone_start_date.sql +1 -0
  93. package/drizzle-postgres/0004_status_entry_rules.sql +1 -0
  94. package/drizzle-postgres/0005_run_external_session_ref.sql +1 -0
  95. package/drizzle-postgres/README.md +61 -0
  96. package/drizzle-postgres/meta/0000_snapshot.json +1078 -0
  97. package/drizzle-postgres/meta/0001_snapshot.json +1090 -0
  98. package/drizzle-postgres/meta/0002_snapshot.json +1239 -0
  99. package/drizzle-postgres/meta/0003_snapshot.json +1245 -0
  100. package/drizzle-postgres/meta/0004_snapshot.json +1251 -0
  101. package/drizzle-postgres/meta/0005_snapshot.json +1257 -0
  102. package/drizzle-postgres/meta/_journal.json +48 -0
  103. package/drizzle-sqlite/0000_board.sql +133 -0
  104. package/drizzle-sqlite/0001_issue_pull_requests.sql +15 -0
  105. package/drizzle-sqlite/0002_milestone_start_date.sql +1 -0
  106. package/drizzle-sqlite/0003_status_entry_rules.sql +1 -0
  107. package/drizzle-sqlite/0004_run_external_session_ref.sql +1 -0
  108. package/drizzle-sqlite/README.md +67 -0
  109. package/drizzle-sqlite/meta/0000_snapshot.json +946 -0
  110. package/drizzle-sqlite/meta/0001_snapshot.json +1054 -0
  111. package/drizzle-sqlite/meta/0002_snapshot.json +1061 -0
  112. package/drizzle-sqlite/meta/0003_snapshot.json +1068 -0
  113. package/drizzle-sqlite/meta/0004_snapshot.json +1075 -0
  114. package/drizzle-sqlite/meta/_journal.json +41 -0
  115. package/package.json +147 -0
@@ -0,0 +1,942 @@
1
+ #!/usr/bin/env node
2
+ const require_cli = require("./cli.cjs");
3
+ require("node:path");
4
+ require("node:fs");
5
+ let node_process = require("node:process");
6
+ node_process = require_cli.__toESM(node_process, 1);
7
+ let node_util = require("node:util");
8
+ let node_readline = require("node:readline");
9
+ node_readline = require_cli.__toESM(node_readline, 1);
10
+ //#region node_modules/fast-string-truncated-width/dist/utils.js
11
+ const getCodePointsLength = (() => {
12
+ const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
13
+ return (input) => {
14
+ let surrogatePairsNr = 0;
15
+ SURROGATE_PAIR_RE.lastIndex = 0;
16
+ while (SURROGATE_PAIR_RE.test(input)) surrogatePairsNr += 1;
17
+ return input.length - surrogatePairsNr;
18
+ };
19
+ })();
20
+ const isFullWidth = (x) => {
21
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
22
+ };
23
+ const isWideNotCJKTNotEmoji = (x) => {
24
+ 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;
25
+ };
26
+ //#endregion
27
+ //#region node_modules/fast-string-truncated-width/dist/index.js
28
+ const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
29
+ const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
30
+ const CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy;
31
+ const TAB_RE = /\t{1,1000}/y;
32
+ const EMOJI_RE = /[\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?))*/uy;
33
+ const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
34
+ const MODIFIER_RE = /\p{M}+/gu;
35
+ const NO_TRUNCATION$1 = {
36
+ limit: Infinity,
37
+ ellipsis: ""
38
+ };
39
+ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
40
+ const LIMIT = truncationOptions.limit ?? Infinity;
41
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
42
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
43
+ const ANSI_WIDTH = 0;
44
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
45
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
46
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
47
+ const FULL_WIDTH_WIDTH = 2;
48
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
49
+ const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
50
+ const PARSE_BLOCKS = [
51
+ [LATIN_RE, REGULAR_WIDTH],
52
+ [ANSI_RE, ANSI_WIDTH],
53
+ [CONTROL_RE, CONTROL_WIDTH],
54
+ [TAB_RE, TAB_WIDTH],
55
+ [EMOJI_RE, EMOJI_WIDTH],
56
+ [CJKT_WIDE_RE, WIDE_WIDTH]
57
+ ];
58
+ let indexPrev = 0;
59
+ let index = 0;
60
+ let length = input.length;
61
+ let lengthExtra = 0;
62
+ let truncationEnabled = false;
63
+ let truncationIndex = length;
64
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
65
+ let unmatchedStart = 0;
66
+ let unmatchedEnd = 0;
67
+ let width = 0;
68
+ let widthExtra = 0;
69
+ outer: while (true) {
70
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
71
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
72
+ lengthExtra = 0;
73
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
74
+ const codePoint = char.codePointAt(0) || 0;
75
+ if (isFullWidth(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
76
+ else if (isWideNotCJKTNotEmoji(codePoint)) widthExtra = WIDE_WIDTH;
77
+ else widthExtra = REGULAR_WIDTH;
78
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
79
+ if (width + widthExtra > LIMIT) {
80
+ truncationEnabled = true;
81
+ break outer;
82
+ }
83
+ lengthExtra += char.length;
84
+ width += widthExtra;
85
+ }
86
+ unmatchedStart = unmatchedEnd = 0;
87
+ }
88
+ if (index >= length) break outer;
89
+ for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
90
+ const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
91
+ BLOCK_RE.lastIndex = index;
92
+ if (BLOCK_RE.test(input)) {
93
+ lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
94
+ widthExtra = lengthExtra * BLOCK_WIDTH;
95
+ if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
96
+ if (width + widthExtra > LIMIT) {
97
+ truncationEnabled = true;
98
+ break outer;
99
+ }
100
+ width += widthExtra;
101
+ unmatchedStart = indexPrev;
102
+ unmatchedEnd = index;
103
+ index = indexPrev = BLOCK_RE.lastIndex;
104
+ continue outer;
105
+ }
106
+ }
107
+ index += 1;
108
+ }
109
+ return {
110
+ width: truncationEnabled ? truncationLimit : width,
111
+ index: truncationEnabled ? truncationIndex : length,
112
+ truncated: truncationEnabled,
113
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
114
+ };
115
+ };
116
+ //#endregion
117
+ //#region node_modules/fast-string-width/dist/index.js
118
+ const NO_TRUNCATION = {
119
+ limit: Infinity,
120
+ ellipsis: "",
121
+ ellipsisWidth: 0
122
+ };
123
+ const fastStringWidth = (input, options = {}) => {
124
+ return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
125
+ };
126
+ //#endregion
127
+ //#region node_modules/fast-wrap-ansi/lib/main.js
128
+ const ESC = "\x1B";
129
+ const CSI = "›";
130
+ const END_CODE = 39;
131
+ const ANSI_ESCAPE_BELL = "\x07";
132
+ const ANSI_CSI = "[";
133
+ const ANSI_OSC = "]";
134
+ const ANSI_SGR_TERMINATOR = "m";
135
+ const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
136
+ const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
137
+ const getClosingCode = (openingCode) => {
138
+ if (openingCode >= 30 && openingCode <= 37) return 39;
139
+ if (openingCode >= 90 && openingCode <= 97) return 39;
140
+ if (openingCode >= 40 && openingCode <= 47) return 49;
141
+ if (openingCode >= 100 && openingCode <= 107) return 49;
142
+ if (openingCode === 1 || openingCode === 2) return 22;
143
+ if (openingCode === 3) return 23;
144
+ if (openingCode === 4) return 24;
145
+ if (openingCode === 7) return 27;
146
+ if (openingCode === 8) return 28;
147
+ if (openingCode === 9) return 29;
148
+ if (openingCode === 0) return 0;
149
+ };
150
+ const wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
151
+ const wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
152
+ const wrapWord = (rows, word, columns) => {
153
+ const characters = word[Symbol.iterator]();
154
+ let isInsideEscape = false;
155
+ let isInsideLinkEscape = false;
156
+ let lastRow = rows.at(-1);
157
+ let visible = lastRow === void 0 ? 0 : fastStringWidth(lastRow);
158
+ let currentCharacter = characters.next();
159
+ let nextCharacter = characters.next();
160
+ let rawCharacterIndex = 0;
161
+ while (!currentCharacter.done) {
162
+ const character = currentCharacter.value;
163
+ const characterLength = fastStringWidth(character);
164
+ if (visible + characterLength <= columns) rows[rows.length - 1] += character;
165
+ else {
166
+ rows.push(character);
167
+ visible = 0;
168
+ }
169
+ if (character === ESC || character === CSI) {
170
+ isInsideEscape = true;
171
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
172
+ }
173
+ if (isInsideEscape) {
174
+ if (isInsideLinkEscape) {
175
+ if (character === ANSI_ESCAPE_BELL) {
176
+ isInsideEscape = false;
177
+ isInsideLinkEscape = false;
178
+ }
179
+ } else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
180
+ } else {
181
+ visible += characterLength;
182
+ if (visible === columns && !nextCharacter.done) {
183
+ rows.push("");
184
+ visible = 0;
185
+ }
186
+ }
187
+ currentCharacter = nextCharacter;
188
+ nextCharacter = characters.next();
189
+ rawCharacterIndex += character.length;
190
+ }
191
+ lastRow = rows.at(-1);
192
+ if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
193
+ };
194
+ const stringVisibleTrimSpacesRight = (string) => {
195
+ const words = string.split(" ");
196
+ let last = words.length;
197
+ while (last) {
198
+ if (fastStringWidth(words[last - 1])) break;
199
+ last--;
200
+ }
201
+ if (last === words.length) return string;
202
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
203
+ };
204
+ const exec = (string, columns, options = {}) => {
205
+ if (options.trim !== false && string.trim() === "") return "";
206
+ let returnValue = "";
207
+ let escapeCode;
208
+ let escapeUrl;
209
+ const words = string.split(" ");
210
+ let rows = [""];
211
+ let rowLength = 0;
212
+ for (let index = 0; index < words.length; index++) {
213
+ const word = words[index];
214
+ if (options.trim !== false) {
215
+ const row = rows.at(-1) ?? "";
216
+ const trimmed = row.trimStart();
217
+ if (row.length !== trimmed.length) {
218
+ rows[rows.length - 1] = trimmed;
219
+ rowLength = fastStringWidth(trimmed);
220
+ }
221
+ }
222
+ if (index !== 0) {
223
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
224
+ rows.push("");
225
+ rowLength = 0;
226
+ }
227
+ if (rowLength || options.trim === false) {
228
+ rows[rows.length - 1] += " ";
229
+ rowLength++;
230
+ }
231
+ }
232
+ const wordLength = fastStringWidth(word);
233
+ if (options.hard && wordLength > columns) {
234
+ const remainingColumns = columns - rowLength;
235
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
236
+ if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
237
+ wrapWord(rows, word, columns);
238
+ rowLength = fastStringWidth(rows.at(-1) ?? "");
239
+ continue;
240
+ }
241
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
242
+ if (options.wordWrap === false && rowLength < columns) {
243
+ wrapWord(rows, word, columns);
244
+ rowLength = fastStringWidth(rows.at(-1) ?? "");
245
+ continue;
246
+ }
247
+ rows.push("");
248
+ rowLength = 0;
249
+ }
250
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
251
+ wrapWord(rows, word, columns);
252
+ rowLength = fastStringWidth(rows.at(-1) ?? "");
253
+ continue;
254
+ }
255
+ rows[rows.length - 1] += word;
256
+ rowLength += wordLength;
257
+ }
258
+ if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
259
+ const preString = rows.join("\n");
260
+ let inSurrogate = false;
261
+ for (let i = 0; i < preString.length; i++) {
262
+ const character = preString[i];
263
+ returnValue += character;
264
+ if (!inSurrogate) {
265
+ inSurrogate = character >= "\ud800" && character <= "\udbff";
266
+ if (inSurrogate) continue;
267
+ } else inSurrogate = false;
268
+ if (character === ESC || character === CSI) {
269
+ GROUP_REGEX.lastIndex = i + 1;
270
+ const groups = GROUP_REGEX.exec(preString)?.groups;
271
+ if (groups?.code !== void 0) {
272
+ const code = Number.parseFloat(groups.code);
273
+ escapeCode = code === END_CODE ? void 0 : code;
274
+ } else if (groups?.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
275
+ }
276
+ if (preString[i + 1] === "\n") {
277
+ if (escapeUrl) returnValue += wrapAnsiHyperlink("");
278
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
279
+ if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
280
+ } else if (character === "\n") {
281
+ if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
282
+ if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
283
+ }
284
+ }
285
+ return returnValue;
286
+ };
287
+ const CRLF_OR_LF = /\r?\n/;
288
+ function wrapAnsi(string, columns, options) {
289
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
290
+ }
291
+ //#endregion
292
+ //#region node_modules/@clack/core/dist/index.mjs
293
+ var import_src = (/* @__PURE__ */ require_cli.__commonJSMin(((exports, module) => {
294
+ const ESC = "\x1B";
295
+ const CSI = `${ESC}[`;
296
+ const beep = "\x07";
297
+ const cursor = {
298
+ to(x, y) {
299
+ if (!y) return `${CSI}${x + 1}G`;
300
+ return `${CSI}${y + 1};${x + 1}H`;
301
+ },
302
+ move(x, y) {
303
+ let ret = "";
304
+ if (x < 0) ret += `${CSI}${-x}D`;
305
+ else if (x > 0) ret += `${CSI}${x}C`;
306
+ if (y < 0) ret += `${CSI}${-y}A`;
307
+ else if (y > 0) ret += `${CSI}${y}B`;
308
+ return ret;
309
+ },
310
+ up: (count = 1) => `${CSI}${count}A`,
311
+ down: (count = 1) => `${CSI}${count}B`,
312
+ forward: (count = 1) => `${CSI}${count}C`,
313
+ backward: (count = 1) => `${CSI}${count}D`,
314
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
315
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
316
+ left: `${CSI}G`,
317
+ hide: `${CSI}?25l`,
318
+ show: `${CSI}?25h`,
319
+ save: `${ESC}7`,
320
+ restore: `${ESC}8`
321
+ };
322
+ module.exports = {
323
+ cursor,
324
+ scroll: {
325
+ up: (count = 1) => `${CSI}S`.repeat(count),
326
+ down: (count = 1) => `${CSI}T`.repeat(count)
327
+ },
328
+ erase: {
329
+ screen: `${CSI}2J`,
330
+ up: (count = 1) => `${CSI}1J`.repeat(count),
331
+ down: (count = 1) => `${CSI}J`.repeat(count),
332
+ line: `${CSI}2K`,
333
+ lineEnd: `${CSI}K`,
334
+ lineStart: `${CSI}1K`,
335
+ lines(count) {
336
+ let clear = "";
337
+ for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
338
+ if (count) clear += cursor.left;
339
+ return clear;
340
+ }
341
+ },
342
+ beep
343
+ };
344
+ })))();
345
+ function findCursor(s, o, l) {
346
+ if (!l.some((r) => !r.disabled)) return s;
347
+ const t = s + o, n = Math.max(l.length - 1, 0), e = t < 0 ? n : t > n ? 0 : t;
348
+ return l[e]?.disabled ? findCursor(e, o < 0 ? -1 : 1, l) : e;
349
+ }
350
+ const settings = {
351
+ actions: /* @__PURE__ */ new Set([
352
+ "up",
353
+ "down",
354
+ "left",
355
+ "right",
356
+ "space",
357
+ "enter",
358
+ "cancel"
359
+ ]),
360
+ aliases: /* @__PURE__ */ new Map([
361
+ ["k", "up"],
362
+ ["j", "down"],
363
+ ["h", "left"],
364
+ ["l", "right"],
365
+ ["", "cancel"],
366
+ ["escape", "cancel"]
367
+ ]),
368
+ messages: {
369
+ cancel: "Canceled",
370
+ error: "Something went wrong"
371
+ },
372
+ withGuide: true,
373
+ accessible: void 0,
374
+ date: {
375
+ monthNames: [...[
376
+ "January",
377
+ "February",
378
+ "March",
379
+ "April",
380
+ "May",
381
+ "June",
382
+ "July",
383
+ "August",
384
+ "September",
385
+ "October",
386
+ "November",
387
+ "December"
388
+ ]],
389
+ messages: {
390
+ required: "Please enter a valid date",
391
+ invalidMonth: "There are only 12 months in a year",
392
+ invalidDay: (n, e) => `There are only ${n} days in ${e}`,
393
+ afterMin: (n) => `Date must be on or after ${n.toISOString().slice(0, 10)}`,
394
+ beforeMax: (n) => `Date must be on or before ${n.toISOString().slice(0, 10)}`
395
+ }
396
+ }
397
+ };
398
+ function isAccessible(n) {
399
+ if (n !== void 0) return n;
400
+ if (settings.accessible !== void 0) return settings.accessible;
401
+ const e = process.env.ACCESSIBLE;
402
+ return e !== void 0 && e !== "" && e !== "0" && e !== "false";
403
+ }
404
+ function isActionKey(n, e) {
405
+ if (typeof n == "string") return settings.aliases.get(n) === e;
406
+ for (const s of n) if (s !== void 0 && isActionKey(s, e)) return true;
407
+ return false;
408
+ }
409
+ function diffLines(i, s) {
410
+ if (i === s) return;
411
+ const e = i.split(`
412
+ `), t = s.split(`
413
+ `), r = Math.max(e.length, t.length), f = [];
414
+ for (let n = 0; n < r; n++) e[n] !== t[n] && f.push(n);
415
+ return {
416
+ lines: f,
417
+ numLinesBefore: e.length,
418
+ numLinesAfter: t.length,
419
+ numLines: r
420
+ };
421
+ }
422
+ globalThis.process.platform.startsWith("win");
423
+ const CANCEL_SYMBOL = Symbol("clack:cancel");
424
+ function isCancel(e) {
425
+ return e === CANCEL_SYMBOL;
426
+ }
427
+ function setRawMode(e, r) {
428
+ const o = e;
429
+ o.isTTY && o.setRawMode(r);
430
+ }
431
+ const getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
432
+ const getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
433
+ function wrapTextWithPrefix(e, r, o, n = o, s = o, t) {
434
+ return wrapAnsi(r, getColumns(e ?? node_process.stdout) - o.length, {
435
+ hard: true,
436
+ trim: false
437
+ }).split(`
438
+ `).map((c, i, m) => {
439
+ const d = t ? t(c, i) : c;
440
+ return i === 0 ? `${n}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
441
+ }).join(`
442
+ `);
443
+ }
444
+ function runValidation(e, a) {
445
+ if ("~standard" in e) {
446
+ const n = e["~standard"].validate(a);
447
+ return n instanceof Promise ? n.then((r) => r.issues?.at(0)?.message) : n.issues?.at(0)?.message;
448
+ }
449
+ return e(a);
450
+ }
451
+ var y = class {
452
+ input;
453
+ output;
454
+ _abortSignal;
455
+ rl;
456
+ opts;
457
+ _render;
458
+ _track = false;
459
+ _prevFrame = "";
460
+ _subscribers = /* @__PURE__ */ new Map();
461
+ _cursor = 0;
462
+ state = "initial";
463
+ error = "";
464
+ value;
465
+ userInput = "";
466
+ /**
467
+ * Whether accessible (static, screen-reader friendly) output is enabled for
468
+ * this prompt, resolved from the `accessible` option, the global setting,
469
+ * and the `ACCESSIBLE` env var.
470
+ */
471
+ get accessible() {
472
+ return isAccessible(this.opts.accessible);
473
+ }
474
+ constructor(t, e = true) {
475
+ const { input: i = node_process.stdin, output: s = node_process.stdout, render: r, signal: n, ...o } = t;
476
+ this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r.bind(this), this._track = e, this._abortSignal = n, this.input = i, this.output = s;
477
+ }
478
+ /**
479
+ * Unsubscribe all listeners
480
+ */
481
+ unsubscribe() {
482
+ this._subscribers.clear();
483
+ }
484
+ /**
485
+ * Set a subscriber with opts
486
+ * @param event - The event name
487
+ */
488
+ setSubscriber(t, e) {
489
+ const i = this._subscribers.get(t) ?? [];
490
+ i.push(e), this._subscribers.set(t, i);
491
+ }
492
+ /**
493
+ * Subscribe to an event
494
+ * @param event - The event name
495
+ * @param cb - The callback
496
+ */
497
+ on(t, e) {
498
+ this.setSubscriber(t, { cb: e });
499
+ }
500
+ /**
501
+ * Subscribe to an event once
502
+ * @param event - The event name
503
+ * @param cb - The callback
504
+ */
505
+ once(t, e) {
506
+ this.setSubscriber(t, {
507
+ cb: e,
508
+ once: true
509
+ });
510
+ }
511
+ /**
512
+ * Emit an event with data
513
+ * @param event - The event name
514
+ * @param data - The data to pass to the callback
515
+ */
516
+ emit(t, ...e) {
517
+ const i = this._subscribers.get(t) ?? [], s = [];
518
+ for (const r of i) r.cb(...e), r.once && s.push(() => i.splice(i.indexOf(r), 1));
519
+ for (const r of s) r();
520
+ }
521
+ prompt() {
522
+ return new Promise((t) => {
523
+ if (this._abortSignal) {
524
+ if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t(CANCEL_SYMBOL);
525
+ this._abortSignal.addEventListener("abort", () => {
526
+ this.state = "cancel", this.close();
527
+ }, { once: true });
528
+ }
529
+ this.rl = node_readline.default.createInterface({
530
+ input: this.input,
531
+ tabSize: 2,
532
+ prompt: "",
533
+ escapeCodeTimeout: 50,
534
+ terminal: true
535
+ }), 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", () => {
536
+ this.output.write(import_src.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(this.value);
537
+ }), this.once("cancel", () => {
538
+ this.output.write(import_src.cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t(CANCEL_SYMBOL);
539
+ });
540
+ });
541
+ }
542
+ _isActionKey(t, e) {
543
+ return t === " ";
544
+ }
545
+ _shouldSubmit(t, e) {
546
+ return true;
547
+ }
548
+ _setValue(t) {
549
+ this.value = t, this.emit("value", this.value);
550
+ }
551
+ _setUserInput(t, e) {
552
+ this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
553
+ }
554
+ _clearUserInput() {
555
+ this.rl?.write(null, {
556
+ ctrl: true,
557
+ name: "u"
558
+ }), this._setUserInput("");
559
+ }
560
+ async onKeypress(t, e) {
561
+ if (this.state !== "validating") {
562
+ if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
563
+ ctrl: true,
564
+ name: "h"
565
+ }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t, e), e?.name === "return" && this._shouldSubmit(t, e)) {
566
+ if (this.opts.validate) {
567
+ const i = runValidation(this.opts.validate, this.value);
568
+ let s;
569
+ i instanceof Promise ? (this.state = "validating", this.render(), s = await i) : s = i, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
570
+ }
571
+ this.state !== "error" && (this.state = "submit");
572
+ }
573
+ isActionKey([
574
+ t,
575
+ e?.name,
576
+ e?.sequence
577
+ ], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
578
+ }
579
+ }
580
+ close() {
581
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
582
+ `), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
583
+ }
584
+ restoreCursor() {
585
+ const t = wrapAnsi(this._prevFrame, process.stdout.columns, {
586
+ hard: true,
587
+ trim: false
588
+ }).split(`
589
+ `).length - 1;
590
+ this.output.write(import_src.cursor.move(-999, t * -1));
591
+ }
592
+ render() {
593
+ const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, {
594
+ hard: true,
595
+ trim: false
596
+ });
597
+ if (t !== this._prevFrame) {
598
+ if (this.state === "initial") this.output.write(import_src.cursor.hide);
599
+ else {
600
+ const e = diffLines(this._prevFrame, t), i = getRows(this.output);
601
+ if (this.restoreCursor(), e) {
602
+ const s = Math.max(0, e.numLinesAfter - i), r = Math.max(0, e.numLinesBefore - i);
603
+ let n = e.lines.find((o) => o >= s);
604
+ if (n === void 0) {
605
+ this._prevFrame = t;
606
+ return;
607
+ }
608
+ if (e.lines.length === 1) {
609
+ this.output.write(import_src.cursor.move(0, n - r)), this.output.write(import_src.erase.lines(1));
610
+ const o = t.split(`
611
+ `);
612
+ this.output.write(o[n]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, o.length - n - 1));
613
+ return;
614
+ } else if (e.lines.length > 1) {
615
+ if (s < r) n = s;
616
+ else {
617
+ const h = n - r;
618
+ h > 0 && this.output.write(import_src.cursor.move(0, h));
619
+ }
620
+ this.output.write(import_src.erase.down());
621
+ const f = t.split(`
622
+ `).slice(n);
623
+ this.output.write(f.join(`
624
+ `)), this._prevFrame = t;
625
+ return;
626
+ }
627
+ }
628
+ this.output.write(import_src.erase.down());
629
+ }
630
+ this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
631
+ }
632
+ }
633
+ };
634
+ var a = class extends y {
635
+ options;
636
+ cursor = 0;
637
+ get _value() {
638
+ return this.options[this.cursor]?.value;
639
+ }
640
+ get _enabledOptions() {
641
+ return this.options.filter((e) => e.disabled !== true);
642
+ }
643
+ toggleAll() {
644
+ const e = this._enabledOptions, i = this.value !== void 0 && this.value.length === e.length;
645
+ this.value = i ? [] : e.map((t) => t.value);
646
+ }
647
+ toggleInvert() {
648
+ const e = this.value;
649
+ if (!e) return;
650
+ const i = this._enabledOptions.filter((t) => !e.includes(t.value));
651
+ this.value = i.map((t) => t.value);
652
+ }
653
+ toggleValue() {
654
+ this.value === void 0 && (this.value = []);
655
+ const e = this.value.includes(this._value);
656
+ this.value = e ? this.value.filter((i) => i !== this._value) : [...this.value, this._value];
657
+ }
658
+ constructor(e) {
659
+ super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
660
+ const i = Math.max(this.options.findIndex(({ value: t }) => t === e.cursorAt), 0);
661
+ this.cursor = this.options[i]?.disabled ? findCursor(i, 1, this.options) : i, this.on("key", (t, l) => {
662
+ l.name === "a" && this.toggleAll(), l.name === "i" && this.toggleInvert();
663
+ }), this.on("cursor", (t) => {
664
+ switch (t) {
665
+ case "left":
666
+ case "up":
667
+ this.cursor = findCursor(this.cursor, -1, this.options);
668
+ break;
669
+ case "down":
670
+ case "right":
671
+ this.cursor = findCursor(this.cursor, 1, this.options);
672
+ break;
673
+ case "space": this.toggleValue();
674
+ }
675
+ });
676
+ }
677
+ };
678
+ let n$1 = class n extends y {
679
+ options;
680
+ cursor = 0;
681
+ get _selectedValue() {
682
+ return this.options[this.cursor];
683
+ }
684
+ changeValue() {
685
+ const e = this._selectedValue;
686
+ this.value = e === void 0 ? void 0 : e.value;
687
+ }
688
+ constructor(e) {
689
+ super(e, false), this.options = e.options;
690
+ const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t = o === -1 ? 0 : o;
691
+ this.cursor = this.options[t]?.disabled ? findCursor(t, 1, this.options) : t, this.changeValue(), this.on("cursor", (s) => {
692
+ switch (s) {
693
+ case "left":
694
+ case "up":
695
+ this.cursor = findCursor(this.cursor, -1, this.options);
696
+ break;
697
+ case "down":
698
+ case "right": this.cursor = findCursor(this.cursor, 1, this.options);
699
+ }
700
+ this.changeValue();
701
+ });
702
+ }
703
+ };
704
+ //#endregion
705
+ //#region node_modules/@clack/prompts/dist/index.mjs
706
+ function isUnicodeSupported() {
707
+ if (node_process.default.platform !== "win32") return node_process.default.env.TERM !== "linux";
708
+ return Boolean(node_process.default.env.CI) || Boolean(node_process.default.env.WT_SESSION) || Boolean(node_process.default.env.TERMINUS_SUBLIME) || node_process.default.env.ConEmuTask === "{cmd::Cmder}" || node_process.default.env.TERM_PROGRAM === "Terminus-Sublime" || node_process.default.env.TERM_PROGRAM === "vscode" || node_process.default.env.TERM === "xterm-256color" || node_process.default.env.TERM === "alacritty" || node_process.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
709
+ }
710
+ const unicode = isUnicodeSupported();
711
+ const unicodeOr = (o, e) => unicode ? o : e;
712
+ const S_STEP_ACTIVE = unicodeOr("◆", "*");
713
+ const S_STEP_CANCEL = unicodeOr("■", "x");
714
+ const S_STEP_ERROR = unicodeOr("▲", "x");
715
+ const S_STEP_SUBMIT = unicodeOr("◇", "o");
716
+ const S_BAR = unicodeOr("│", "|");
717
+ const S_BAR_END = unicodeOr("└", "—");
718
+ const S_RADIO_ACTIVE = unicodeOr("●", ">");
719
+ const S_RADIO_INACTIVE = unicodeOr("○", " ");
720
+ const S_CHECKBOX_ACTIVE = unicodeOr("◻", "[•]");
721
+ const S_CHECKBOX_SELECTED = unicodeOr("◼", "[+]");
722
+ const S_CHECKBOX_INACTIVE = unicodeOr("◻", "[ ]");
723
+ const symbol = (o) => {
724
+ switch (o) {
725
+ case "initial":
726
+ case "active": return (0, node_util.styleText)("cyan", S_STEP_ACTIVE);
727
+ case "cancel": return (0, node_util.styleText)("red", S_STEP_CANCEL);
728
+ case "error": return (0, node_util.styleText)("yellow", S_STEP_ERROR);
729
+ case "submit": return (0, node_util.styleText)("green", S_STEP_SUBMIT);
730
+ case "validating": return (0, node_util.styleText)("dim", S_STEP_ACTIVE);
731
+ }
732
+ };
733
+ const symbolBar = (o) => {
734
+ switch (o) {
735
+ case "initial":
736
+ case "active": return (0, node_util.styleText)("cyan", S_BAR);
737
+ case "cancel": return (0, node_util.styleText)("red", S_BAR);
738
+ case "error": return (0, node_util.styleText)("yellow", S_BAR);
739
+ case "submit": return (0, node_util.styleText)("green", S_BAR);
740
+ }
741
+ };
742
+ function formatInstructionFooter(o, e) {
743
+ const r = [`${e ? `${(0, node_util.styleText)("cyan", S_BAR)} ` : ""}${o.join(" • ")}`];
744
+ return e && r.push((0, node_util.styleText)("cyan", S_BAR_END)), r;
745
+ }
746
+ const I = (l, e, w, p, b, C = false) => {
747
+ let r = e, O = 0;
748
+ if (C) for (let i = p - 1; i >= w; i--) {
749
+ const m = l[i];
750
+ if (m && (r -= m.length), O++, r <= b) break;
751
+ }
752
+ else for (let i = w; i < p; i++) {
753
+ const m = l[i];
754
+ if (m && (r -= m.length), O++, r <= b) break;
755
+ }
756
+ return {
757
+ lineCount: r,
758
+ removals: O
759
+ };
760
+ };
761
+ const limitOptions = ({ cursor: l, options: e, style: w, output: p = process.stdout, maxItems: b = Number.POSITIVE_INFINITY, columnPadding: C = 0, rowPadding: r = 4 }) => {
762
+ const i = getColumns(p) - C, m = getRows(p), M = (0, node_util.styleText)("dim", "..."), v = Math.max(m - r, 0), a = Math.max(Math.min(b, v), 5);
763
+ let f = 0;
764
+ l >= a - 3 && (f = Math.max(Math.min(l - a + 3, e.length - a), 0));
765
+ let d = a < e.length && f > 0, c = a < e.length && f + a < e.length;
766
+ const W = Math.min(f + a, e.length), s = [];
767
+ let g = 0;
768
+ d && g++, c && g++;
769
+ const T = f + (d ? 1 : 0), y = W - (c ? 1 : 0);
770
+ for (let t = T; t < y; t++) {
771
+ const n = e[t], h = wrapAnsi(n ? w(n, t === l) : "", i, {
772
+ hard: true,
773
+ trim: false
774
+ }).split(`
775
+ `);
776
+ s.push(h), g += h.length;
777
+ }
778
+ if (g > v) {
779
+ let t = 0, n = 0, o = g;
780
+ const h = l - T;
781
+ let u = v;
782
+ const L = () => I(s, o, 0, h, u), E = () => I(s, o, h + 1, s.length, u, true);
783
+ d ? ({lineCount: o, removals: t} = L(), o > u && (c || (u -= 1), {lineCount: o, removals: n} = E())) : (c || (u -= 1), {lineCount: o, removals: n} = E(), o > u && (u -= 1, {lineCount: o, removals: t} = L())), t > 0 && (d = true, s.splice(0, t)), n > 0 && (c = true, s.splice(s.length - n, n));
784
+ }
785
+ const x = [];
786
+ d && x.push(M);
787
+ for (const t of s) for (const n of t) x.push(n);
788
+ return c && x.push(M), x;
789
+ };
790
+ const MULTISELECT_INSTRUCTIONS = [
791
+ `${(0, node_util.styleText)("dim", "↑/↓")} to navigate`,
792
+ `${(0, node_util.styleText)("dim", "Space:")} select`,
793
+ `${(0, node_util.styleText)("dim", "Enter:")} confirm`
794
+ ];
795
+ const m = (i, u) => i.split(`
796
+ `).map((d) => u(d)).join(`
797
+ `);
798
+ const multiselect = (i) => {
799
+ const u = (t, a) => {
800
+ const r = t.label ?? String(t.value);
801
+ return a === "disabled" ? `${(0, node_util.styleText)("gray", S_CHECKBOX_INACTIVE)} ${m(r, (o) => (0, node_util.styleText)(["strikethrough", "gray"], o))}${t.hint ? ` ${(0, node_util.styleText)("dim", `(${t.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${(0, node_util.styleText)("cyan", S_CHECKBOX_ACTIVE)} ${r}${t.hint ? ` ${(0, node_util.styleText)("dim", `(${t.hint})`)}` : ""}` : a === "selected" ? `${(0, node_util.styleText)("green", S_CHECKBOX_SELECTED)} ${m(r, (o) => (0, node_util.styleText)("dim", o))}${t.hint ? ` ${(0, node_util.styleText)("dim", `(${t.hint})`)}` : ""}` : a === "cancelled" ? `${m(r, (o) => (0, node_util.styleText)(["strikethrough", "dim"], o))}` : a === "active-selected" ? `${(0, node_util.styleText)("green", S_CHECKBOX_SELECTED)} ${r}${t.hint ? ` ${(0, node_util.styleText)("dim", `(${t.hint})`)}` : ""}` : a === "submitted" ? `${m(r, (o) => (0, node_util.styleText)("dim", o))}` : `${(0, node_util.styleText)("dim", S_CHECKBOX_INACTIVE)} ${m(r, (o) => (0, node_util.styleText)("dim", o))}`;
802
+ }, d = i.required ?? true, x = i.showInstructions ?? true;
803
+ return new a({
804
+ options: i.options,
805
+ signal: i.signal,
806
+ input: i.input,
807
+ output: i.output,
808
+ initialValues: i.initialValues,
809
+ required: d,
810
+ cursorAt: i.cursorAt,
811
+ validate(t) {
812
+ if (d && (t === void 0 || t.length === 0)) return `Please select at least one option.
813
+ ${(0, node_util.styleText)("reset", (0, node_util.styleText)("dim", `Press ${(0, node_util.styleText)([
814
+ "gray",
815
+ "bgWhite",
816
+ "inverse"
817
+ ], " space ")} to select, ${(0, node_util.styleText)("gray", (0, node_util.styleText)("bgWhite", (0, node_util.styleText)("inverse", " enter ")))} to submit`))}`;
818
+ },
819
+ render() {
820
+ const t = i.withGuide ?? settings.withGuide, a = wrapTextWithPrefix(i.output, i.message, t ? `${symbolBar(this.state)} ` : "", `${symbol(this.state)} `), r = `${t ? `${(0, node_util.styleText)("gray", S_BAR)}
821
+ ` : ""}${a}
822
+ `, o = this.value ?? [], g = (n, l) => {
823
+ if (n.disabled) return u(n, "disabled");
824
+ const s = o.includes(n.value);
825
+ return l && s ? u(n, "active-selected") : s ? u(n, "selected") : u(n, l ? "active" : "inactive");
826
+ };
827
+ switch (this.state) {
828
+ case "submit": {
829
+ const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "submitted")).join((0, node_util.styleText)("dim", ", ")) || (0, node_util.styleText)("dim", "none");
830
+ return `${r}${wrapTextWithPrefix(i.output, n, t ? `${(0, node_util.styleText)("gray", S_BAR)} ` : "")}`;
831
+ }
832
+ case "cancel": {
833
+ const n = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u(s, "cancelled")).join((0, node_util.styleText)("dim", ", "));
834
+ if (n.trim() === "") return `${r}${(0, node_util.styleText)("gray", S_BAR)}`;
835
+ return `${r}${wrapTextWithPrefix(i.output, n, t ? `${(0, node_util.styleText)("gray", S_BAR)} ` : "")}${t ? `
836
+ ${(0, node_util.styleText)("gray", S_BAR)}` : ""}`;
837
+ }
838
+ case "error": {
839
+ const n = t ? `${(0, node_util.styleText)("yellow", S_BAR)} ` : "", l = this.error.split(`
840
+ `).map(($, v) => v === 0 ? `${t ? `${(0, node_util.styleText)("yellow", S_BAR_END)} ` : ""}${(0, node_util.styleText)("yellow", $)}` : ` ${$}`).join(`
841
+ `), s = r.split(`
842
+ `).length, h = l.split(`
843
+ `).length + 1;
844
+ return `${r}${n}${limitOptions({
845
+ output: i.output,
846
+ options: this.options,
847
+ cursor: this.cursor,
848
+ maxItems: i.maxItems,
849
+ columnPadding: n.length,
850
+ rowPadding: s + h,
851
+ style: g
852
+ }).join(`
853
+ ${n}`)}
854
+ ${l}
855
+ `;
856
+ }
857
+ default: {
858
+ const n = t ? `${(0, node_util.styleText)("cyan", S_BAR)} ` : "", l = r.split(`
859
+ `).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t) : t ? [(0, node_util.styleText)("cyan", S_BAR_END)] : [], h = s.join(`
860
+ `), $ = s.length + 1;
861
+ return `${r}${n}${limitOptions({
862
+ output: i.output,
863
+ options: this.options,
864
+ cursor: this.cursor,
865
+ maxItems: i.maxItems,
866
+ columnPadding: n.length,
867
+ rowPadding: l + $,
868
+ style: g
869
+ }).join(`
870
+ ${n}`)}
871
+ ${h}
872
+ `;
873
+ }
874
+ }
875
+ }
876
+ }).prompt();
877
+ };
878
+ const SELECT_INSTRUCTIONS = [`${(0, node_util.styleText)("dim", "↑/↓")} to navigate`, `${(0, node_util.styleText)("dim", "Enter:")} confirm`];
879
+ const c = (t, o) => t.includes(`
880
+ `) ? t.split(`
881
+ `).map((d) => o(d)).join(`
882
+ `) : o(t);
883
+ const select = (t) => {
884
+ const o = (n, m) => {
885
+ if (n === void 0) return "";
886
+ const s = n.label ?? String(n.value);
887
+ switch (m) {
888
+ case "disabled": return `${(0, node_util.styleText)("gray", S_RADIO_INACTIVE)} ${c(s, (i) => (0, node_util.styleText)("gray", i))}${n.hint ? ` ${(0, node_util.styleText)("dim", `(${n.hint ?? "disabled"})`)}` : ""}`;
889
+ case "selected": return `${c(s, (i) => (0, node_util.styleText)("dim", i))}`;
890
+ case "active": return `${(0, node_util.styleText)("green", S_RADIO_ACTIVE)} ${s}${n.hint ? ` ${(0, node_util.styleText)("dim", `(${n.hint})`)}` : ""}`;
891
+ case "cancelled": return `${c(s, (i) => (0, node_util.styleText)(["strikethrough", "dim"], i))}`;
892
+ default: return `${(0, node_util.styleText)("dim", S_RADIO_INACTIVE)} ${c(s, (i) => (0, node_util.styleText)("dim", i))}`;
893
+ }
894
+ }, d = t.showInstructions ?? true;
895
+ return new n$1({
896
+ options: t.options,
897
+ signal: t.signal,
898
+ input: t.input,
899
+ output: t.output,
900
+ initialValue: t.initialValue,
901
+ render() {
902
+ const n = t.withGuide ?? settings.withGuide, m = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i = wrapTextWithPrefix(t.output, t.message, s, m), u = `${n ? `${(0, node_util.styleText)("gray", S_BAR)}
903
+ ` : ""}${i}
904
+ `;
905
+ switch (this.state) {
906
+ case "submit": {
907
+ const r = n ? `${(0, node_util.styleText)("gray", S_BAR)} ` : "";
908
+ return `${u}${wrapTextWithPrefix(t.output, o(this.options[this.cursor], "selected"), r)}`;
909
+ }
910
+ case "cancel": {
911
+ const r = n ? `${(0, node_util.styleText)("gray", S_BAR)} ` : "";
912
+ return `${u}${wrapTextWithPrefix(t.output, o(this.options[this.cursor], "cancelled"), r)}${n ? `
913
+ ${(0, node_util.styleText)("gray", S_BAR)}` : ""}`;
914
+ }
915
+ default: {
916
+ const r = n ? `${(0, node_util.styleText)("cyan", S_BAR)} ` : "", a = u.split(`
917
+ `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [(0, node_util.styleText)("cyan", S_BAR_END)] : [], f = p.join(`
918
+ `), b = p.length + 1;
919
+ return `${u}${r}${limitOptions({
920
+ output: t.output,
921
+ cursor: this.cursor,
922
+ options: this.options,
923
+ maxItems: t.maxItems,
924
+ columnPadding: r.length,
925
+ rowPadding: a + b,
926
+ style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
927
+ }).join(`
928
+ ${r}`)}
929
+ ${f}
930
+ `;
931
+ }
932
+ }
933
+ }
934
+ }).prompt();
935
+ };
936
+ `${(0, node_util.styleText)("gray", S_BAR)}`;
937
+ //#endregion
938
+ exports.isCancel = isCancel;
939
+ exports.multiselect = multiselect;
940
+ exports.select = select;
941
+
942
+ //# sourceMappingURL=dist-Cd6wg8pp.cjs.map