@nestjs-ssr/react 0.1.7 → 0.1.9

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.
@@ -0,0 +1,2659 @@
1
+ #!/usr/bin/env node
2
+ import { formatWithOptions } from 'util';
3
+ import g, { stdin, stdout } from 'process';
4
+ import f from 'readline';
5
+ import * as tty from 'tty';
6
+ import { WriteStream } from 'tty';
7
+ import { existsSync, mkdirSync, copyFileSync, writeFileSync, readFileSync } from 'fs';
8
+ import { dirname, sep, resolve, join } from 'path';
9
+ import { fileURLToPath } from 'url';
10
+ import { execSync } from 'child_process';
11
+
12
+ var __defProp = Object.defineProperty;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
15
+ var __esm = (fn, res) => function __init() {
16
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
17
+ };
18
+ var __export = (target, all) => {
19
+ for (var name in all)
20
+ __defProp(target, name, { get: all[name], enumerable: true });
21
+ };
22
+
23
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs
24
+ var prompt_exports = {};
25
+ __export(prompt_exports, {
26
+ kCancel: () => kCancel,
27
+ prompt: () => prompt
28
+ });
29
+ function getDefaultExportFromCjs(x2) {
30
+ return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
31
+ }
32
+ function requireSrc() {
33
+ if (hasRequiredSrc) return src;
34
+ hasRequiredSrc = 1;
35
+ const ESC = "\x1B";
36
+ const CSI = `${ESC}[`;
37
+ const beep = "\x07";
38
+ const cursor = {
39
+ to(x2, y3) {
40
+ if (!y3) return `${CSI}${x2 + 1}G`;
41
+ return `${CSI}${y3 + 1};${x2 + 1}H`;
42
+ },
43
+ move(x2, y3) {
44
+ let ret = "";
45
+ if (x2 < 0) ret += `${CSI}${-x2}D`;
46
+ else if (x2 > 0) ret += `${CSI}${x2}C`;
47
+ if (y3 < 0) ret += `${CSI}${-y3}A`;
48
+ else if (y3 > 0) ret += `${CSI}${y3}B`;
49
+ return ret;
50
+ },
51
+ up: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}A`, "up"),
52
+ down: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}B`, "down"),
53
+ forward: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}C`, "forward"),
54
+ backward: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}D`, "backward"),
55
+ nextLine: /* @__PURE__ */ __name((count = 1) => `${CSI}E`.repeat(count), "nextLine"),
56
+ prevLine: /* @__PURE__ */ __name((count = 1) => `${CSI}F`.repeat(count), "prevLine"),
57
+ left: `${CSI}G`,
58
+ hide: `${CSI}?25l`,
59
+ show: `${CSI}?25h`,
60
+ save: `${ESC}7`,
61
+ restore: `${ESC}8`
62
+ };
63
+ const scroll = {
64
+ up: /* @__PURE__ */ __name((count = 1) => `${CSI}S`.repeat(count), "up"),
65
+ down: /* @__PURE__ */ __name((count = 1) => `${CSI}T`.repeat(count), "down")
66
+ };
67
+ const erase = {
68
+ screen: `${CSI}2J`,
69
+ up: /* @__PURE__ */ __name((count = 1) => `${CSI}1J`.repeat(count), "up"),
70
+ down: /* @__PURE__ */ __name((count = 1) => `${CSI}J`.repeat(count), "down"),
71
+ line: `${CSI}2K`,
72
+ lineEnd: `${CSI}K`,
73
+ lineStart: `${CSI}1K`,
74
+ lines(count) {
75
+ let clear = "";
76
+ for (let i2 = 0; i2 < count; i2++)
77
+ clear += this.line + (i2 < count - 1 ? cursor.up() : "");
78
+ if (count)
79
+ clear += cursor.left;
80
+ return clear;
81
+ }
82
+ };
83
+ src = { cursor, scroll, erase, beep };
84
+ return src;
85
+ }
86
+ function requirePicocolors() {
87
+ if (hasRequiredPicocolors) return picocolors.exports;
88
+ hasRequiredPicocolors = 1;
89
+ let p = process || {}, argv2 = p.argv || [], env2 = p.env || {};
90
+ let isColorSupported2 = !(!!env2.NO_COLOR || argv2.includes("--no-color")) && (!!env2.FORCE_COLOR || argv2.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env2.TERM !== "dumb" || !!env2.CI);
91
+ let formatter = /* @__PURE__ */ __name((open, close, replace = open) => (input) => {
92
+ let string = "" + input, index = string.indexOf(close, open.length);
93
+ return ~index ? open + replaceClose2(string, close, replace, index) + close : open + string + close;
94
+ }, "formatter");
95
+ let replaceClose2 = /* @__PURE__ */ __name((string, close, replace, index) => {
96
+ let result = "", cursor = 0;
97
+ do {
98
+ result += string.substring(cursor, index) + replace;
99
+ cursor = index + close.length;
100
+ index = string.indexOf(close, cursor);
101
+ } while (~index);
102
+ return result + string.substring(cursor);
103
+ }, "replaceClose");
104
+ let createColors2 = /* @__PURE__ */ __name((enabled = isColorSupported2) => {
105
+ let f3 = enabled ? formatter : () => String;
106
+ return {
107
+ isColorSupported: enabled,
108
+ reset: f3("\x1B[0m", "\x1B[0m"),
109
+ bold: f3("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
110
+ dim: f3("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
111
+ italic: f3("\x1B[3m", "\x1B[23m"),
112
+ underline: f3("\x1B[4m", "\x1B[24m"),
113
+ inverse: f3("\x1B[7m", "\x1B[27m"),
114
+ hidden: f3("\x1B[8m", "\x1B[28m"),
115
+ strikethrough: f3("\x1B[9m", "\x1B[29m"),
116
+ black: f3("\x1B[30m", "\x1B[39m"),
117
+ red: f3("\x1B[31m", "\x1B[39m"),
118
+ green: f3("\x1B[32m", "\x1B[39m"),
119
+ yellow: f3("\x1B[33m", "\x1B[39m"),
120
+ blue: f3("\x1B[34m", "\x1B[39m"),
121
+ magenta: f3("\x1B[35m", "\x1B[39m"),
122
+ cyan: f3("\x1B[36m", "\x1B[39m"),
123
+ white: f3("\x1B[37m", "\x1B[39m"),
124
+ gray: f3("\x1B[90m", "\x1B[39m"),
125
+ bgBlack: f3("\x1B[40m", "\x1B[49m"),
126
+ bgRed: f3("\x1B[41m", "\x1B[49m"),
127
+ bgGreen: f3("\x1B[42m", "\x1B[49m"),
128
+ bgYellow: f3("\x1B[43m", "\x1B[49m"),
129
+ bgBlue: f3("\x1B[44m", "\x1B[49m"),
130
+ bgMagenta: f3("\x1B[45m", "\x1B[49m"),
131
+ bgCyan: f3("\x1B[46m", "\x1B[49m"),
132
+ bgWhite: f3("\x1B[47m", "\x1B[49m"),
133
+ blackBright: f3("\x1B[90m", "\x1B[39m"),
134
+ redBright: f3("\x1B[91m", "\x1B[39m"),
135
+ greenBright: f3("\x1B[92m", "\x1B[39m"),
136
+ yellowBright: f3("\x1B[93m", "\x1B[39m"),
137
+ blueBright: f3("\x1B[94m", "\x1B[39m"),
138
+ magentaBright: f3("\x1B[95m", "\x1B[39m"),
139
+ cyanBright: f3("\x1B[96m", "\x1B[39m"),
140
+ whiteBright: f3("\x1B[97m", "\x1B[39m"),
141
+ bgBlackBright: f3("\x1B[100m", "\x1B[49m"),
142
+ bgRedBright: f3("\x1B[101m", "\x1B[49m"),
143
+ bgGreenBright: f3("\x1B[102m", "\x1B[49m"),
144
+ bgYellowBright: f3("\x1B[103m", "\x1B[49m"),
145
+ bgBlueBright: f3("\x1B[104m", "\x1B[49m"),
146
+ bgMagentaBright: f3("\x1B[105m", "\x1B[49m"),
147
+ bgCyanBright: f3("\x1B[106m", "\x1B[49m"),
148
+ bgWhiteBright: f3("\x1B[107m", "\x1B[49m")
149
+ };
150
+ }, "createColors");
151
+ picocolors.exports = createColors2();
152
+ picocolors.exports.createColors = createColors2;
153
+ return picocolors.exports;
154
+ }
155
+ function J({ onlyFirst: t2 = false } = {}) {
156
+ const F3 = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
157
+ return new RegExp(F3, t2 ? void 0 : "g");
158
+ }
159
+ function T$1(t2) {
160
+ if (typeof t2 != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof t2}\``);
161
+ return t2.replace(Q, "");
162
+ }
163
+ function O(t2) {
164
+ return t2 && t2.__esModule && Object.prototype.hasOwnProperty.call(t2, "default") ? t2.default : t2;
165
+ }
166
+ function A$1(t2, u3 = {}) {
167
+ if (typeof t2 != "string" || t2.length === 0 || (u3 = { ambiguousIsNarrow: true, ...u3 }, t2 = T$1(t2), t2.length === 0)) return 0;
168
+ t2 = t2.replace(FD(), " ");
169
+ const F3 = u3.ambiguousIsNarrow ? 1 : 2;
170
+ let e2 = 0;
171
+ for (const s2 of t2) {
172
+ const i2 = s2.codePointAt(0);
173
+ if (i2 <= 31 || i2 >= 127 && i2 <= 159 || i2 >= 768 && i2 <= 879) continue;
174
+ switch (DD.eastAsianWidth(s2)) {
175
+ case "F":
176
+ case "W":
177
+ e2 += 2;
178
+ break;
179
+ case "A":
180
+ e2 += F3;
181
+ break;
182
+ default:
183
+ e2 += 1;
184
+ }
185
+ }
186
+ return e2;
187
+ }
188
+ function sD() {
189
+ const t2 = /* @__PURE__ */ new Map();
190
+ for (const [u3, F3] of Object.entries(r)) {
191
+ for (const [e2, s2] of Object.entries(F3)) r[e2] = { open: `\x1B[${s2[0]}m`, close: `\x1B[${s2[1]}m` }, F3[e2] = r[e2], t2.set(s2[0], s2[1]);
192
+ Object.defineProperty(r, u3, { value: F3, enumerable: false });
193
+ }
194
+ return Object.defineProperty(r, "codes", { value: t2, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = L$1(), r.color.ansi256 = N(), r.color.ansi16m = I(), r.bgColor.ansi = L$1(m), r.bgColor.ansi256 = N(m), r.bgColor.ansi16m = I(m), Object.defineProperties(r, { rgbToAnsi256: { value: /* @__PURE__ */ __name((u3, F3, e2) => u3 === F3 && F3 === e2 ? u3 < 8 ? 16 : u3 > 248 ? 231 : Math.round((u3 - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u3 / 255 * 5) + 6 * Math.round(F3 / 255 * 5) + Math.round(e2 / 255 * 5), "value"), enumerable: false }, hexToRgb: { value: /* @__PURE__ */ __name((u3) => {
195
+ const F3 = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u3.toString(16));
196
+ if (!F3) return [0, 0, 0];
197
+ let [e2] = F3;
198
+ e2.length === 3 && (e2 = [...e2].map((i2) => i2 + i2).join(""));
199
+ const s2 = Number.parseInt(e2, 16);
200
+ return [s2 >> 16 & 255, s2 >> 8 & 255, s2 & 255];
201
+ }, "value"), enumerable: false }, hexToAnsi256: { value: /* @__PURE__ */ __name((u3) => r.rgbToAnsi256(...r.hexToRgb(u3)), "value"), enumerable: false }, ansi256ToAnsi: { value: /* @__PURE__ */ __name((u3) => {
202
+ if (u3 < 8) return 30 + u3;
203
+ if (u3 < 16) return 90 + (u3 - 8);
204
+ let F3, e2, s2;
205
+ if (u3 >= 232) F3 = ((u3 - 232) * 10 + 8) / 255, e2 = F3, s2 = F3;
206
+ else {
207
+ u3 -= 16;
208
+ const C3 = u3 % 36;
209
+ F3 = Math.floor(u3 / 36) / 5, e2 = Math.floor(C3 / 6) / 5, s2 = C3 % 6 / 5;
210
+ }
211
+ const i2 = Math.max(F3, e2, s2) * 2;
212
+ if (i2 === 0) return 30;
213
+ let D2 = 30 + (Math.round(s2) << 2 | Math.round(e2) << 1 | Math.round(F3));
214
+ return i2 === 2 && (D2 += 60), D2;
215
+ }, "value"), enumerable: false }, rgbToAnsi: { value: /* @__PURE__ */ __name((u3, F3, e2) => r.ansi256ToAnsi(r.rgbToAnsi256(u3, F3, e2)), "value"), enumerable: false }, hexToAnsi: { value: /* @__PURE__ */ __name((u3) => r.ansi256ToAnsi(r.hexToAnsi256(u3)), "value"), enumerable: false } }), r;
216
+ }
217
+ function G(t2, u3, F3) {
218
+ return String(t2).normalize().replace(/\r\n/g, `
219
+ `).split(`
220
+ `).map((e2) => oD(e2, u3, F3)).join(`
221
+ `);
222
+ }
223
+ function k$1(t2, u3) {
224
+ if (typeof t2 == "string") return c.aliases.get(t2) === u3;
225
+ for (const F3 of t2) if (F3 !== void 0 && k$1(F3, u3)) return true;
226
+ return false;
227
+ }
228
+ function lD(t2, u3) {
229
+ if (t2 === u3) return;
230
+ const F3 = t2.split(`
231
+ `), e2 = u3.split(`
232
+ `), s2 = [];
233
+ for (let i2 = 0; i2 < Math.max(F3.length, e2.length); i2++) F3[i2] !== e2[i2] && s2.push(i2);
234
+ return s2;
235
+ }
236
+ function d$1(t2, u3) {
237
+ const F3 = t2;
238
+ F3.isTTY && F3.setRawMode(u3);
239
+ }
240
+ function ce() {
241
+ return g.platform !== "win32" ? g.env.TERM !== "linux" : !!g.env.CI || !!g.env.WT_SESSION || !!g.env.TERMINUS_SUBLIME || g.env.ConEmuTask === "{cmd::Cmder}" || g.env.TERM_PROGRAM === "Terminus-Sublime" || g.env.TERM_PROGRAM === "vscode" || g.env.TERM === "xterm-256color" || g.env.TERM === "alacritty" || g.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
242
+ }
243
+ async function prompt(message, opts = {}) {
244
+ const handleCancel = /* @__PURE__ */ __name((value) => {
245
+ if (typeof value !== "symbol" || value.toString() !== "Symbol(clack:cancel)") {
246
+ return value;
247
+ }
248
+ switch (opts.cancel) {
249
+ case "reject": {
250
+ const error = new Error("Prompt cancelled.");
251
+ error.name = "ConsolaPromptCancelledError";
252
+ if (Error.captureStackTrace) {
253
+ Error.captureStackTrace(error, prompt);
254
+ }
255
+ throw error;
256
+ }
257
+ case "undefined": {
258
+ return void 0;
259
+ }
260
+ case "null": {
261
+ return null;
262
+ }
263
+ case "symbol": {
264
+ return kCancel;
265
+ }
266
+ default:
267
+ case "default": {
268
+ return opts.default ?? opts.initial;
269
+ }
270
+ }
271
+ }, "handleCancel");
272
+ if (!opts.type || opts.type === "text") {
273
+ return await he({
274
+ message,
275
+ defaultValue: opts.default,
276
+ placeholder: opts.placeholder,
277
+ initialValue: opts.initial
278
+ }).then(handleCancel);
279
+ }
280
+ if (opts.type === "confirm") {
281
+ return await ye({
282
+ message,
283
+ initialValue: opts.initial
284
+ }).then(handleCancel);
285
+ }
286
+ if (opts.type === "select") {
287
+ return await ve({
288
+ message,
289
+ options: opts.options.map(
290
+ (o3) => typeof o3 === "string" ? { value: o3, label: o3 } : o3
291
+ ),
292
+ initialValue: opts.initial
293
+ }).then(handleCancel);
294
+ }
295
+ if (opts.type === "multiselect") {
296
+ return await fe({
297
+ message,
298
+ options: opts.options.map(
299
+ (o3) => typeof o3 === "string" ? { value: o3, label: o3 } : o3
300
+ ),
301
+ required: opts.required,
302
+ initialValues: opts.initial
303
+ }).then(handleCancel);
304
+ }
305
+ throw new Error(`Unknown prompt type: ${opts.type}`);
306
+ }
307
+ var src, hasRequiredSrc, srcExports, picocolors, hasRequiredPicocolors, picocolorsExports, e, Q, P$1, X, DD, uD, FD, m, L$1, N, I, r, tD, eD, iD, v, CD, w$1, W$1, rD, R, y, V$1, z, ED, _, nD, oD, aD, c, S, AD, pD, h, x, fD, bD, mD, Y, wD, SD, $D, q, jD, PD, V, u, le, L, W, C, o, d, k, P, A, T, F, w, B, he, ye, ve, fe, kCancel;
308
+ var init_prompt = __esm({
309
+ "../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs"() {
310
+ __name(getDefaultExportFromCjs, "getDefaultExportFromCjs");
311
+ __name(requireSrc, "requireSrc");
312
+ srcExports = requireSrc();
313
+ picocolors = { exports: {} };
314
+ __name(requirePicocolors, "requirePicocolors");
315
+ picocolorsExports = /* @__PURE__ */ requirePicocolors();
316
+ e = /* @__PURE__ */ getDefaultExportFromCjs(picocolorsExports);
317
+ __name(J, "J");
318
+ Q = J();
319
+ __name(T$1, "T$1");
320
+ __name(O, "O");
321
+ P$1 = { exports: {} };
322
+ (function(t2) {
323
+ var u3 = {};
324
+ t2.exports = u3, u3.eastAsianWidth = function(e2) {
325
+ var s2 = e2.charCodeAt(0), i2 = e2.length == 2 ? e2.charCodeAt(1) : 0, D2 = s2;
326
+ return 55296 <= s2 && s2 <= 56319 && 56320 <= i2 && i2 <= 57343 && (s2 &= 1023, i2 &= 1023, D2 = s2 << 10 | i2, D2 += 65536), D2 == 12288 || 65281 <= D2 && D2 <= 65376 || 65504 <= D2 && D2 <= 65510 ? "F" : D2 == 8361 || 65377 <= D2 && D2 <= 65470 || 65474 <= D2 && D2 <= 65479 || 65482 <= D2 && D2 <= 65487 || 65490 <= D2 && D2 <= 65495 || 65498 <= D2 && D2 <= 65500 || 65512 <= D2 && D2 <= 65518 ? "H" : 4352 <= D2 && D2 <= 4447 || 4515 <= D2 && D2 <= 4519 || 4602 <= D2 && D2 <= 4607 || 9001 <= D2 && D2 <= 9002 || 11904 <= D2 && D2 <= 11929 || 11931 <= D2 && D2 <= 12019 || 12032 <= D2 && D2 <= 12245 || 12272 <= D2 && D2 <= 12283 || 12289 <= D2 && D2 <= 12350 || 12353 <= D2 && D2 <= 12438 || 12441 <= D2 && D2 <= 12543 || 12549 <= D2 && D2 <= 12589 || 12593 <= D2 && D2 <= 12686 || 12688 <= D2 && D2 <= 12730 || 12736 <= D2 && D2 <= 12771 || 12784 <= D2 && D2 <= 12830 || 12832 <= D2 && D2 <= 12871 || 12880 <= D2 && D2 <= 13054 || 13056 <= D2 && D2 <= 19903 || 19968 <= D2 && D2 <= 42124 || 42128 <= D2 && D2 <= 42182 || 43360 <= D2 && D2 <= 43388 || 44032 <= D2 && D2 <= 55203 || 55216 <= D2 && D2 <= 55238 || 55243 <= D2 && D2 <= 55291 || 63744 <= D2 && D2 <= 64255 || 65040 <= D2 && D2 <= 65049 || 65072 <= D2 && D2 <= 65106 || 65108 <= D2 && D2 <= 65126 || 65128 <= D2 && D2 <= 65131 || 110592 <= D2 && D2 <= 110593 || 127488 <= D2 && D2 <= 127490 || 127504 <= D2 && D2 <= 127546 || 127552 <= D2 && D2 <= 127560 || 127568 <= D2 && D2 <= 127569 || 131072 <= D2 && D2 <= 194367 || 177984 <= D2 && D2 <= 196605 || 196608 <= D2 && D2 <= 262141 ? "W" : 32 <= D2 && D2 <= 126 || 162 <= D2 && D2 <= 163 || 165 <= D2 && D2 <= 166 || D2 == 172 || D2 == 175 || 10214 <= D2 && D2 <= 10221 || 10629 <= D2 && D2 <= 10630 ? "Na" : D2 == 161 || D2 == 164 || 167 <= D2 && D2 <= 168 || D2 == 170 || 173 <= D2 && D2 <= 174 || 176 <= D2 && D2 <= 180 || 182 <= D2 && D2 <= 186 || 188 <= D2 && D2 <= 191 || D2 == 198 || D2 == 208 || 215 <= D2 && D2 <= 216 || 222 <= D2 && D2 <= 225 || D2 == 230 || 232 <= D2 && D2 <= 234 || 236 <= D2 && D2 <= 237 || D2 == 240 || 242 <= D2 && D2 <= 243 || 247 <= D2 && D2 <= 250 || D2 == 252 || D2 == 254 || D2 == 257 || D2 == 273 || D2 == 275 || D2 == 283 || 294 <= D2 && D2 <= 295 || D2 == 299 || 305 <= D2 && D2 <= 307 || D2 == 312 || 319 <= D2 && D2 <= 322 || D2 == 324 || 328 <= D2 && D2 <= 331 || D2 == 333 || 338 <= D2 && D2 <= 339 || 358 <= D2 && D2 <= 359 || D2 == 363 || D2 == 462 || D2 == 464 || D2 == 466 || D2 == 468 || D2 == 470 || D2 == 472 || D2 == 474 || D2 == 476 || D2 == 593 || D2 == 609 || D2 == 708 || D2 == 711 || 713 <= D2 && D2 <= 715 || D2 == 717 || D2 == 720 || 728 <= D2 && D2 <= 731 || D2 == 733 || D2 == 735 || 768 <= D2 && D2 <= 879 || 913 <= D2 && D2 <= 929 || 931 <= D2 && D2 <= 937 || 945 <= D2 && D2 <= 961 || 963 <= D2 && D2 <= 969 || D2 == 1025 || 1040 <= D2 && D2 <= 1103 || D2 == 1105 || D2 == 8208 || 8211 <= D2 && D2 <= 8214 || 8216 <= D2 && D2 <= 8217 || 8220 <= D2 && D2 <= 8221 || 8224 <= D2 && D2 <= 8226 || 8228 <= D2 && D2 <= 8231 || D2 == 8240 || 8242 <= D2 && D2 <= 8243 || D2 == 8245 || D2 == 8251 || D2 == 8254 || D2 == 8308 || D2 == 8319 || 8321 <= D2 && D2 <= 8324 || D2 == 8364 || D2 == 8451 || D2 == 8453 || D2 == 8457 || D2 == 8467 || D2 == 8470 || 8481 <= D2 && D2 <= 8482 || D2 == 8486 || D2 == 8491 || 8531 <= D2 && D2 <= 8532 || 8539 <= D2 && D2 <= 8542 || 8544 <= D2 && D2 <= 8555 || 8560 <= D2 && D2 <= 8569 || D2 == 8585 || 8592 <= D2 && D2 <= 8601 || 8632 <= D2 && D2 <= 8633 || D2 == 8658 || D2 == 8660 || D2 == 8679 || D2 == 8704 || 8706 <= D2 && D2 <= 8707 || 8711 <= D2 && D2 <= 8712 || D2 == 8715 || D2 == 8719 || D2 == 8721 || D2 == 8725 || D2 == 8730 || 8733 <= D2 && D2 <= 8736 || D2 == 8739 || D2 == 8741 || 8743 <= D2 && D2 <= 8748 || D2 == 8750 || 8756 <= D2 && D2 <= 8759 || 8764 <= D2 && D2 <= 8765 || D2 == 8776 || D2 == 8780 || D2 == 8786 || 8800 <= D2 && D2 <= 8801 || 8804 <= D2 && D2 <= 8807 || 8810 <= D2 && D2 <= 8811 || 8814 <= D2 && D2 <= 8815 || 8834 <= D2 && D2 <= 8835 || 8838 <= D2 && D2 <= 8839 || D2 == 8853 || D2 == 8857 || D2 == 8869 || D2 == 8895 || D2 == 8978 || 9312 <= D2 && D2 <= 9449 || 9451 <= D2 && D2 <= 9547 || 9552 <= D2 && D2 <= 9587 || 9600 <= D2 && D2 <= 9615 || 9618 <= D2 && D2 <= 9621 || 9632 <= D2 && D2 <= 9633 || 9635 <= D2 && D2 <= 9641 || 9650 <= D2 && D2 <= 9651 || 9654 <= D2 && D2 <= 9655 || 9660 <= D2 && D2 <= 9661 || 9664 <= D2 && D2 <= 9665 || 9670 <= D2 && D2 <= 9672 || D2 == 9675 || 9678 <= D2 && D2 <= 9681 || 9698 <= D2 && D2 <= 9701 || D2 == 9711 || 9733 <= D2 && D2 <= 9734 || D2 == 9737 || 9742 <= D2 && D2 <= 9743 || 9748 <= D2 && D2 <= 9749 || D2 == 9756 || D2 == 9758 || D2 == 9792 || D2 == 9794 || 9824 <= D2 && D2 <= 9825 || 9827 <= D2 && D2 <= 9829 || 9831 <= D2 && D2 <= 9834 || 9836 <= D2 && D2 <= 9837 || D2 == 9839 || 9886 <= D2 && D2 <= 9887 || 9918 <= D2 && D2 <= 9919 || 9924 <= D2 && D2 <= 9933 || 9935 <= D2 && D2 <= 9953 || D2 == 9955 || 9960 <= D2 && D2 <= 9983 || D2 == 10045 || D2 == 10071 || 10102 <= D2 && D2 <= 10111 || 11093 <= D2 && D2 <= 11097 || 12872 <= D2 && D2 <= 12879 || 57344 <= D2 && D2 <= 63743 || 65024 <= D2 && D2 <= 65039 || D2 == 65533 || 127232 <= D2 && D2 <= 127242 || 127248 <= D2 && D2 <= 127277 || 127280 <= D2 && D2 <= 127337 || 127344 <= D2 && D2 <= 127386 || 917760 <= D2 && D2 <= 917999 || 983040 <= D2 && D2 <= 1048573 || 1048576 <= D2 && D2 <= 1114109 ? "A" : "N";
327
+ }, u3.characterLength = function(e2) {
328
+ var s2 = this.eastAsianWidth(e2);
329
+ return s2 == "F" || s2 == "W" || s2 == "A" ? 2 : 1;
330
+ };
331
+ function F3(e2) {
332
+ return e2.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
333
+ }
334
+ __name(F3, "F");
335
+ u3.length = function(e2) {
336
+ for (var s2 = F3(e2), i2 = 0, D2 = 0; D2 < s2.length; D2++) i2 = i2 + this.characterLength(s2[D2]);
337
+ return i2;
338
+ }, u3.slice = function(e2, s2, i2) {
339
+ textLen = u3.length(e2), s2 = s2 || 0, i2 = i2 || 1, s2 < 0 && (s2 = textLen + s2), i2 < 0 && (i2 = textLen + i2);
340
+ for (var D2 = "", C3 = 0, o3 = F3(e2), E = 0; E < o3.length; E++) {
341
+ var a2 = o3[E], n2 = u3.length(a2);
342
+ if (C3 >= s2 - (n2 == 2 ? 1 : 0)) if (C3 + n2 <= i2) D2 += a2;
343
+ else break;
344
+ C3 += n2;
345
+ }
346
+ return D2;
347
+ };
348
+ })(P$1);
349
+ X = P$1.exports;
350
+ DD = O(X);
351
+ uD = /* @__PURE__ */ __name(function() {
352
+ return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
353
+ }, "uD");
354
+ FD = O(uD);
355
+ __name(A$1, "A$1");
356
+ m = 10;
357
+ L$1 = /* @__PURE__ */ __name((t2 = 0) => (u3) => `\x1B[${u3 + t2}m`, "L$1");
358
+ N = /* @__PURE__ */ __name((t2 = 0) => (u3) => `\x1B[${38 + t2};5;${u3}m`, "N");
359
+ I = /* @__PURE__ */ __name((t2 = 0) => (u3, F3, e2) => `\x1B[${38 + t2};2;${u3};${F3};${e2}m`, "I");
360
+ r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
361
+ Object.keys(r.modifier);
362
+ tD = Object.keys(r.color);
363
+ eD = Object.keys(r.bgColor);
364
+ [...tD, ...eD];
365
+ __name(sD, "sD");
366
+ iD = sD();
367
+ v = /* @__PURE__ */ new Set(["\x1B", "\x9B"]);
368
+ CD = 39;
369
+ w$1 = "\x07";
370
+ W$1 = "[";
371
+ rD = "]";
372
+ R = "m";
373
+ y = `${rD}8;;`;
374
+ V$1 = /* @__PURE__ */ __name((t2) => `${v.values().next().value}${W$1}${t2}${R}`, "V$1");
375
+ z = /* @__PURE__ */ __name((t2) => `${v.values().next().value}${y}${t2}${w$1}`, "z");
376
+ ED = /* @__PURE__ */ __name((t2) => t2.split(" ").map((u3) => A$1(u3)), "ED");
377
+ _ = /* @__PURE__ */ __name((t2, u3, F3) => {
378
+ const e2 = [...u3];
379
+ let s2 = false, i2 = false, D2 = A$1(T$1(t2[t2.length - 1]));
380
+ for (const [C3, o3] of e2.entries()) {
381
+ const E = A$1(o3);
382
+ if (D2 + E <= F3 ? t2[t2.length - 1] += o3 : (t2.push(o3), D2 = 0), v.has(o3) && (s2 = true, i2 = e2.slice(C3 + 1).join("").startsWith(y)), s2) {
383
+ i2 ? o3 === w$1 && (s2 = false, i2 = false) : o3 === R && (s2 = false);
384
+ continue;
385
+ }
386
+ D2 += E, D2 === F3 && C3 < e2.length - 1 && (t2.push(""), D2 = 0);
387
+ }
388
+ !D2 && t2[t2.length - 1].length > 0 && t2.length > 1 && (t2[t2.length - 2] += t2.pop());
389
+ }, "_");
390
+ nD = /* @__PURE__ */ __name((t2) => {
391
+ const u3 = t2.split(" ");
392
+ let F3 = u3.length;
393
+ for (; F3 > 0 && !(A$1(u3[F3 - 1]) > 0); ) F3--;
394
+ return F3 === u3.length ? t2 : u3.slice(0, F3).join(" ") + u3.slice(F3).join("");
395
+ }, "nD");
396
+ oD = /* @__PURE__ */ __name((t2, u3, F3 = {}) => {
397
+ if (F3.trim !== false && t2.trim() === "") return "";
398
+ let e2 = "", s2, i2;
399
+ const D2 = ED(t2);
400
+ let C3 = [""];
401
+ for (const [E, a2] of t2.split(" ").entries()) {
402
+ F3.trim !== false && (C3[C3.length - 1] = C3[C3.length - 1].trimStart());
403
+ let n2 = A$1(C3[C3.length - 1]);
404
+ if (E !== 0 && (n2 >= u3 && (F3.wordWrap === false || F3.trim === false) && (C3.push(""), n2 = 0), (n2 > 0 || F3.trim === false) && (C3[C3.length - 1] += " ", n2++)), F3.hard && D2[E] > u3) {
405
+ const B2 = u3 - n2, p = 1 + Math.floor((D2[E] - B2 - 1) / u3);
406
+ Math.floor((D2[E] - 1) / u3) < p && C3.push(""), _(C3, a2, u3);
407
+ continue;
408
+ }
409
+ if (n2 + D2[E] > u3 && n2 > 0 && D2[E] > 0) {
410
+ if (F3.wordWrap === false && n2 < u3) {
411
+ _(C3, a2, u3);
412
+ continue;
413
+ }
414
+ C3.push("");
415
+ }
416
+ if (n2 + D2[E] > u3 && F3.wordWrap === false) {
417
+ _(C3, a2, u3);
418
+ continue;
419
+ }
420
+ C3[C3.length - 1] += a2;
421
+ }
422
+ F3.trim !== false && (C3 = C3.map((E) => nD(E)));
423
+ const o3 = [...C3.join(`
424
+ `)];
425
+ for (const [E, a2] of o3.entries()) {
426
+ if (e2 += a2, v.has(a2)) {
427
+ const { groups: B2 } = new RegExp(`(?:\\${W$1}(?<code>\\d+)m|\\${y}(?<uri>.*)${w$1})`).exec(o3.slice(E).join("")) || { groups: {} };
428
+ if (B2.code !== void 0) {
429
+ const p = Number.parseFloat(B2.code);
430
+ s2 = p === CD ? void 0 : p;
431
+ } else B2.uri !== void 0 && (i2 = B2.uri.length === 0 ? void 0 : B2.uri);
432
+ }
433
+ const n2 = iD.codes.get(Number(s2));
434
+ o3[E + 1] === `
435
+ ` ? (i2 && (e2 += z("")), s2 && n2 && (e2 += V$1(n2))) : a2 === `
436
+ ` && (s2 && n2 && (e2 += V$1(s2)), i2 && (e2 += z(i2)));
437
+ }
438
+ return e2;
439
+ }, "oD");
440
+ __name(G, "G");
441
+ aD = ["up", "down", "left", "right", "space", "enter", "cancel"];
442
+ c = { actions: new Set(aD), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]) };
443
+ __name(k$1, "k$1");
444
+ __name(lD, "lD");
445
+ globalThis.process.platform.startsWith("win");
446
+ S = Symbol("clack:cancel");
447
+ __name(d$1, "d$1");
448
+ AD = Object.defineProperty;
449
+ pD = /* @__PURE__ */ __name((t2, u3, F3) => u3 in t2 ? AD(t2, u3, { enumerable: true, configurable: true, writable: true, value: F3 }) : t2[u3] = F3, "pD");
450
+ h = /* @__PURE__ */ __name((t2, u3, F3) => (pD(t2, typeof u3 != "symbol" ? u3 + "" : u3, F3), F3), "h");
451
+ x = class {
452
+ static {
453
+ __name(this, "x");
454
+ }
455
+ constructor(u3, F3 = true) {
456
+ h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
457
+ const { input: e2 = stdin, output: s2 = stdout, render: i2, signal: D2, ...C3 } = u3;
458
+ this.opts = C3, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i2.bind(this), this._track = F3, this._abortSignal = D2, this.input = e2, this.output = s2;
459
+ }
460
+ unsubscribe() {
461
+ this._subscribers.clear();
462
+ }
463
+ setSubscriber(u3, F3) {
464
+ const e2 = this._subscribers.get(u3) ?? [];
465
+ e2.push(F3), this._subscribers.set(u3, e2);
466
+ }
467
+ on(u3, F3) {
468
+ this.setSubscriber(u3, { cb: F3 });
469
+ }
470
+ once(u3, F3) {
471
+ this.setSubscriber(u3, { cb: F3, once: true });
472
+ }
473
+ emit(u3, ...F3) {
474
+ const e2 = this._subscribers.get(u3) ?? [], s2 = [];
475
+ for (const i2 of e2) i2.cb(...F3), i2.once && s2.push(() => e2.splice(e2.indexOf(i2), 1));
476
+ for (const i2 of s2) i2();
477
+ }
478
+ prompt() {
479
+ return new Promise((u3, F3) => {
480
+ if (this._abortSignal) {
481
+ if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u3(S);
482
+ this._abortSignal.addEventListener("abort", () => {
483
+ this.state = "cancel", this.close();
484
+ }, { once: true });
485
+ }
486
+ const e2 = new WriteStream(0);
487
+ e2._write = (s2, i2, D2) => {
488
+ this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D2();
489
+ }, this.input.pipe(e2), this.rl = f.createInterface({ input: this.input, output: e2, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), f.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), d$1(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
490
+ this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u3(this.value);
491
+ }), this.once("cancel", () => {
492
+ this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u3(S);
493
+ });
494
+ });
495
+ }
496
+ onKeypress(u3, F3) {
497
+ if (this.state === "error" && (this.state = "active"), F3?.name && (!this._track && c.aliases.has(F3.name) && this.emit("cursor", c.aliases.get(F3.name)), c.actions.has(F3.name) && this.emit("cursor", F3.name)), u3 && (u3.toLowerCase() === "y" || u3.toLowerCase() === "n") && this.emit("confirm", u3.toLowerCase() === "y"), u3 === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u3 && this.emit("key", u3.toLowerCase()), F3?.name === "return") {
498
+ if (this.opts.validate) {
499
+ const e2 = this.opts.validate(this.value);
500
+ e2 && (this.error = e2 instanceof Error ? e2.message : e2, this.state = "error", this.rl?.write(this.value));
501
+ }
502
+ this.state !== "error" && (this.state = "submit");
503
+ }
504
+ k$1([u3, F3?.name, F3?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
505
+ }
506
+ close() {
507
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
508
+ `), d$1(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
509
+ }
510
+ restoreCursor() {
511
+ const u3 = G(this._prevFrame, process.stdout.columns, { hard: true }).split(`
512
+ `).length - 1;
513
+ this.output.write(srcExports.cursor.move(-999, u3 * -1));
514
+ }
515
+ render() {
516
+ const u3 = G(this._render(this) ?? "", process.stdout.columns, { hard: true });
517
+ if (u3 !== this._prevFrame) {
518
+ if (this.state === "initial") this.output.write(srcExports.cursor.hide);
519
+ else {
520
+ const F3 = lD(this._prevFrame, u3);
521
+ if (this.restoreCursor(), F3 && F3?.length === 1) {
522
+ const e2 = F3[0];
523
+ this.output.write(srcExports.cursor.move(0, e2)), this.output.write(srcExports.erase.lines(1));
524
+ const s2 = u3.split(`
525
+ `);
526
+ this.output.write(s2[e2]), this._prevFrame = u3, this.output.write(srcExports.cursor.move(0, s2.length - e2 - 1));
527
+ return;
528
+ }
529
+ if (F3 && F3?.length > 1) {
530
+ const e2 = F3[0];
531
+ this.output.write(srcExports.cursor.move(0, e2)), this.output.write(srcExports.erase.down());
532
+ const s2 = u3.split(`
533
+ `).slice(e2);
534
+ this.output.write(s2.join(`
535
+ `)), this._prevFrame = u3;
536
+ return;
537
+ }
538
+ this.output.write(srcExports.erase.down());
539
+ }
540
+ this.output.write(u3), this.state === "initial" && (this.state = "active"), this._prevFrame = u3;
541
+ }
542
+ }
543
+ };
544
+ fD = class extends x {
545
+ static {
546
+ __name(this, "fD");
547
+ }
548
+ get cursor() {
549
+ return this.value ? 0 : 1;
550
+ }
551
+ get _value() {
552
+ return this.cursor === 0;
553
+ }
554
+ constructor(u3) {
555
+ super(u3, false), this.value = !!u3.initialValue, this.on("value", () => {
556
+ this.value = this._value;
557
+ }), this.on("confirm", (F3) => {
558
+ this.output.write(srcExports.cursor.move(0, -1)), this.value = F3, this.state = "submit", this.close();
559
+ }), this.on("cursor", () => {
560
+ this.value = !this.value;
561
+ });
562
+ }
563
+ };
564
+ bD = Object.defineProperty;
565
+ mD = /* @__PURE__ */ __name((t2, u3, F3) => u3 in t2 ? bD(t2, u3, { enumerable: true, configurable: true, writable: true, value: F3 }) : t2[u3] = F3, "mD");
566
+ Y = /* @__PURE__ */ __name((t2, u3, F3) => (mD(t2, typeof u3 != "symbol" ? u3 + "" : u3, F3), F3), "Y");
567
+ wD = class extends x {
568
+ static {
569
+ __name(this, "wD");
570
+ }
571
+ constructor(u3) {
572
+ super(u3, false), Y(this, "options"), Y(this, "cursor", 0), this.options = u3.options, this.value = [...u3.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F3 }) => F3 === u3.cursorAt), 0), this.on("key", (F3) => {
573
+ F3 === "a" && this.toggleAll();
574
+ }), this.on("cursor", (F3) => {
575
+ switch (F3) {
576
+ case "left":
577
+ case "up":
578
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
579
+ break;
580
+ case "down":
581
+ case "right":
582
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
583
+ break;
584
+ case "space":
585
+ this.toggleValue();
586
+ break;
587
+ }
588
+ });
589
+ }
590
+ get _value() {
591
+ return this.options[this.cursor].value;
592
+ }
593
+ toggleAll() {
594
+ const u3 = this.value.length === this.options.length;
595
+ this.value = u3 ? [] : this.options.map((F3) => F3.value);
596
+ }
597
+ toggleValue() {
598
+ const u3 = this.value.includes(this._value);
599
+ this.value = u3 ? this.value.filter((F3) => F3 !== this._value) : [...this.value, this._value];
600
+ }
601
+ };
602
+ SD = Object.defineProperty;
603
+ $D = /* @__PURE__ */ __name((t2, u3, F3) => u3 in t2 ? SD(t2, u3, { enumerable: true, configurable: true, writable: true, value: F3 }) : t2[u3] = F3, "$D");
604
+ q = /* @__PURE__ */ __name((t2, u3, F3) => ($D(t2, typeof u3 != "symbol" ? u3 + "" : u3, F3), F3), "q");
605
+ jD = class extends x {
606
+ static {
607
+ __name(this, "jD");
608
+ }
609
+ constructor(u3) {
610
+ super(u3, false), q(this, "options"), q(this, "cursor", 0), this.options = u3.options, this.cursor = this.options.findIndex(({ value: F3 }) => F3 === u3.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F3) => {
611
+ switch (F3) {
612
+ case "left":
613
+ case "up":
614
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
615
+ break;
616
+ case "down":
617
+ case "right":
618
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
619
+ break;
620
+ }
621
+ this.changeValue();
622
+ });
623
+ }
624
+ get _value() {
625
+ return this.options[this.cursor];
626
+ }
627
+ changeValue() {
628
+ this.value = this._value.value;
629
+ }
630
+ };
631
+ PD = class extends x {
632
+ static {
633
+ __name(this, "PD");
634
+ }
635
+ get valueWithCursor() {
636
+ if (this.state === "submit") return this.value;
637
+ if (this.cursor >= this.value.length) return `${this.value}\u2588`;
638
+ const u3 = this.value.slice(0, this.cursor), [F3, ...e$1] = this.value.slice(this.cursor);
639
+ return `${u3}${e.inverse(F3)}${e$1.join("")}`;
640
+ }
641
+ get cursor() {
642
+ return this._cursor;
643
+ }
644
+ constructor(u3) {
645
+ super(u3), this.on("finalize", () => {
646
+ this.value || (this.value = u3.defaultValue);
647
+ });
648
+ }
649
+ };
650
+ __name(ce, "ce");
651
+ V = ce();
652
+ u = /* @__PURE__ */ __name((t2, n2) => V ? t2 : n2, "u");
653
+ le = u("\u276F", ">");
654
+ L = u("\u25A0", "x");
655
+ W = u("\u25B2", "x");
656
+ C = u("\u2714", "\u221A");
657
+ o = u("");
658
+ d = u("");
659
+ k = u("\u25CF", ">");
660
+ P = u("\u25CB", " ");
661
+ A = u("\u25FB", "[\u2022]");
662
+ T = u("\u25FC", "[+]");
663
+ F = u("\u25FB", "[ ]");
664
+ w = /* @__PURE__ */ __name((t2) => {
665
+ switch (t2) {
666
+ case "initial":
667
+ case "active":
668
+ return e.cyan(le);
669
+ case "cancel":
670
+ return e.red(L);
671
+ case "error":
672
+ return e.yellow(W);
673
+ case "submit":
674
+ return e.green(C);
675
+ }
676
+ }, "w");
677
+ B = /* @__PURE__ */ __name((t2) => {
678
+ const { cursor: n2, options: s2, style: r3 } = t2, i2 = t2.maxItems ?? Number.POSITIVE_INFINITY, a2 = Math.max(process.stdout.rows - 4, 0), c3 = Math.min(a2, Math.max(i2, 5));
679
+ let l2 = 0;
680
+ n2 >= l2 + c3 - 3 ? l2 = Math.max(Math.min(n2 - c3 + 3, s2.length - c3), 0) : n2 < l2 + 2 && (l2 = Math.max(n2 - 2, 0));
681
+ const $ = c3 < s2.length && l2 > 0, p = c3 < s2.length && l2 + c3 < s2.length;
682
+ return s2.slice(l2, l2 + c3).map((M, v2, x2) => {
683
+ const j = v2 === 0 && $, E = v2 === x2.length - 1 && p;
684
+ return j || E ? e.dim("...") : r3(M, v2 + l2 === n2);
685
+ });
686
+ }, "B");
687
+ he = /* @__PURE__ */ __name((t2) => new PD({ validate: t2.validate, placeholder: t2.placeholder, defaultValue: t2.defaultValue, initialValue: t2.initialValue, render() {
688
+ const n2 = `${e.gray(o)}
689
+ ${w(this.state)} ${t2.message}
690
+ `, s2 = t2.placeholder ? e.inverse(t2.placeholder[0]) + e.dim(t2.placeholder.slice(1)) : e.inverse(e.hidden("_")), r3 = this.value ? this.valueWithCursor : s2;
691
+ switch (this.state) {
692
+ case "error":
693
+ return `${n2.trim()}
694
+ ${e.yellow(o)} ${r3}
695
+ ${e.yellow(d)} ${e.yellow(this.error)}
696
+ `;
697
+ case "submit":
698
+ return `${n2}${e.gray(o)} ${e.dim(this.value || t2.placeholder)}`;
699
+ case "cancel":
700
+ return `${n2}${e.gray(o)} ${e.strikethrough(e.dim(this.value ?? ""))}${this.value?.trim() ? `
701
+ ${e.gray(o)}` : ""}`;
702
+ default:
703
+ return `${n2}${e.cyan(o)} ${r3}
704
+ ${e.cyan(d)}
705
+ `;
706
+ }
707
+ } }).prompt(), "he");
708
+ ye = /* @__PURE__ */ __name((t2) => {
709
+ const n2 = t2.active ?? "Yes", s2 = t2.inactive ?? "No";
710
+ return new fD({ active: n2, inactive: s2, initialValue: t2.initialValue ?? true, render() {
711
+ const r3 = `${e.gray(o)}
712
+ ${w(this.state)} ${t2.message}
713
+ `, i2 = this.value ? n2 : s2;
714
+ switch (this.state) {
715
+ case "submit":
716
+ return `${r3}${e.gray(o)} ${e.dim(i2)}`;
717
+ case "cancel":
718
+ return `${r3}${e.gray(o)} ${e.strikethrough(e.dim(i2))}
719
+ ${e.gray(o)}`;
720
+ default:
721
+ return `${r3}${e.cyan(o)} ${this.value ? `${e.green(k)} ${n2}` : `${e.dim(P)} ${e.dim(n2)}`} ${e.dim("/")} ${this.value ? `${e.dim(P)} ${e.dim(s2)}` : `${e.green(k)} ${s2}`}
722
+ ${e.cyan(d)}
723
+ `;
724
+ }
725
+ } }).prompt();
726
+ }, "ye");
727
+ ve = /* @__PURE__ */ __name((t2) => {
728
+ const n2 = /* @__PURE__ */ __name((s2, r3) => {
729
+ const i2 = s2.label ?? String(s2.value);
730
+ switch (r3) {
731
+ case "selected":
732
+ return `${e.dim(i2)}`;
733
+ case "active":
734
+ return `${e.green(k)} ${i2} ${s2.hint ? e.dim(`(${s2.hint})`) : ""}`;
735
+ case "cancelled":
736
+ return `${e.strikethrough(e.dim(i2))}`;
737
+ default:
738
+ return `${e.dim(P)} ${e.dim(i2)}`;
739
+ }
740
+ }, "n");
741
+ return new jD({ options: t2.options, initialValue: t2.initialValue, render() {
742
+ const s2 = `${e.gray(o)}
743
+ ${w(this.state)} ${t2.message}
744
+ `;
745
+ switch (this.state) {
746
+ case "submit":
747
+ return `${s2}${e.gray(o)} ${n2(this.options[this.cursor], "selected")}`;
748
+ case "cancel":
749
+ return `${s2}${e.gray(o)} ${n2(this.options[this.cursor], "cancelled")}
750
+ ${e.gray(o)}`;
751
+ default:
752
+ return `${s2}${e.cyan(o)} ${B({ cursor: this.cursor, options: this.options, maxItems: t2.maxItems, style: /* @__PURE__ */ __name((r3, i2) => n2(r3, i2 ? "active" : "inactive"), "style") }).join(`
753
+ ${e.cyan(o)} `)}
754
+ ${e.cyan(d)}
755
+ `;
756
+ }
757
+ } }).prompt();
758
+ }, "ve");
759
+ fe = /* @__PURE__ */ __name((t2) => {
760
+ const n2 = /* @__PURE__ */ __name((s2, r3) => {
761
+ const i2 = s2.label ?? String(s2.value);
762
+ return r3 === "active" ? `${e.cyan(A)} ${i2} ${s2.hint ? e.dim(`(${s2.hint})`) : ""}` : r3 === "selected" ? `${e.green(T)} ${e.dim(i2)}` : r3 === "cancelled" ? `${e.strikethrough(e.dim(i2))}` : r3 === "active-selected" ? `${e.green(T)} ${i2} ${s2.hint ? e.dim(`(${s2.hint})`) : ""}` : r3 === "submitted" ? `${e.dim(i2)}` : `${e.dim(F)} ${e.dim(i2)}`;
763
+ }, "n");
764
+ return new wD({ options: t2.options, initialValues: t2.initialValues, required: t2.required ?? true, cursorAt: t2.cursorAt, validate(s2) {
765
+ if (this.required && s2.length === 0) return `Please select at least one option.
766
+ ${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`;
767
+ }, render() {
768
+ const s2 = `${e.gray(o)}
769
+ ${w(this.state)} ${t2.message}
770
+ `, r3 = /* @__PURE__ */ __name((i2, a2) => {
771
+ const c3 = this.value.includes(i2.value);
772
+ return a2 && c3 ? n2(i2, "active-selected") : c3 ? n2(i2, "selected") : n2(i2, a2 ? "active" : "inactive");
773
+ }, "r");
774
+ switch (this.state) {
775
+ case "submit":
776
+ return `${s2}${e.gray(o)} ${this.options.filter(({ value: i2 }) => this.value.includes(i2)).map((i2) => n2(i2, "submitted")).join(e.dim(", ")) || e.dim("none")}`;
777
+ case "cancel": {
778
+ const i2 = this.options.filter(({ value: a2 }) => this.value.includes(a2)).map((a2) => n2(a2, "cancelled")).join(e.dim(", "));
779
+ return `${s2}${e.gray(o)} ${i2.trim() ? `${i2}
780
+ ${e.gray(o)}` : ""}`;
781
+ }
782
+ case "error": {
783
+ const i2 = this.error.split(`
784
+ `).map((a2, c3) => c3 === 0 ? `${e.yellow(d)} ${e.yellow(a2)}` : ` ${a2}`).join(`
785
+ `);
786
+ return `${s2 + e.yellow(o)} ${B({ options: this.options, cursor: this.cursor, maxItems: t2.maxItems, style: r3 }).join(`
787
+ ${e.yellow(o)} `)}
788
+ ${i2}
789
+ `;
790
+ }
791
+ default:
792
+ return `${s2}${e.cyan(o)} ${B({ options: this.options, cursor: this.cursor, maxItems: t2.maxItems, style: r3 }).join(`
793
+ ${e.cyan(o)} `)}
794
+ ${e.cyan(d)}
795
+ `;
796
+ }
797
+ } }).prompt();
798
+ }, "fe");
799
+ `${e.gray(o)} `;
800
+ kCancel = Symbol.for("cancel");
801
+ __name(prompt, "prompt");
802
+ }
803
+ });
804
+
805
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
806
+ var LogLevels = {
807
+ fatal: 0,
808
+ error: 0,
809
+ warn: 1,
810
+ log: 2,
811
+ info: 3,
812
+ success: 3,
813
+ fail: 3,
814
+ debug: 4,
815
+ trace: 5,
816
+ verbose: Number.POSITIVE_INFINITY
817
+ };
818
+ var LogTypes = {
819
+ // Silent
820
+ silent: {
821
+ level: -1
822
+ },
823
+ // Level 0
824
+ fatal: {
825
+ level: LogLevels.fatal
826
+ },
827
+ error: {
828
+ level: LogLevels.error
829
+ },
830
+ // Level 1
831
+ warn: {
832
+ level: LogLevels.warn
833
+ },
834
+ // Level 2
835
+ log: {
836
+ level: LogLevels.log
837
+ },
838
+ // Level 3
839
+ info: {
840
+ level: LogLevels.info
841
+ },
842
+ success: {
843
+ level: LogLevels.success
844
+ },
845
+ fail: {
846
+ level: LogLevels.fail
847
+ },
848
+ ready: {
849
+ level: LogLevels.info
850
+ },
851
+ start: {
852
+ level: LogLevels.info
853
+ },
854
+ box: {
855
+ level: LogLevels.info
856
+ },
857
+ // Level 4
858
+ debug: {
859
+ level: LogLevels.debug
860
+ },
861
+ // Level 5
862
+ trace: {
863
+ level: LogLevels.trace
864
+ },
865
+ // Verbose
866
+ verbose: {
867
+ level: LogLevels.verbose
868
+ }
869
+ };
870
+ function isPlainObject$1(value) {
871
+ if (value === null || typeof value !== "object") {
872
+ return false;
873
+ }
874
+ const prototype = Object.getPrototypeOf(value);
875
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
876
+ return false;
877
+ }
878
+ if (Symbol.iterator in value) {
879
+ return false;
880
+ }
881
+ if (Symbol.toStringTag in value) {
882
+ return Object.prototype.toString.call(value) === "[object Module]";
883
+ }
884
+ return true;
885
+ }
886
+ __name(isPlainObject$1, "isPlainObject$1");
887
+ function _defu(baseObject, defaults, namespace = ".", merger) {
888
+ if (!isPlainObject$1(defaults)) {
889
+ return _defu(baseObject, {}, namespace, merger);
890
+ }
891
+ const object = Object.assign({}, defaults);
892
+ for (const key in baseObject) {
893
+ if (key === "__proto__" || key === "constructor") {
894
+ continue;
895
+ }
896
+ const value = baseObject[key];
897
+ if (value === null || value === void 0) {
898
+ continue;
899
+ }
900
+ if (merger && merger(object, key, value, namespace)) {
901
+ continue;
902
+ }
903
+ if (Array.isArray(value) && Array.isArray(object[key])) {
904
+ object[key] = [...value, ...object[key]];
905
+ } else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
906
+ object[key] = _defu(
907
+ value,
908
+ object[key],
909
+ (namespace ? `${namespace}.` : "") + key.toString(),
910
+ merger
911
+ );
912
+ } else {
913
+ object[key] = value;
914
+ }
915
+ }
916
+ return object;
917
+ }
918
+ __name(_defu, "_defu");
919
+ function createDefu(merger) {
920
+ return (...arguments_) => (
921
+ // eslint-disable-next-line unicorn/no-array-reduce
922
+ arguments_.reduce((p, c3) => _defu(p, c3, "", merger), {})
923
+ );
924
+ }
925
+ __name(createDefu, "createDefu");
926
+ var defu = createDefu();
927
+ function isPlainObject(obj) {
928
+ return Object.prototype.toString.call(obj) === "[object Object]";
929
+ }
930
+ __name(isPlainObject, "isPlainObject");
931
+ function isLogObj(arg) {
932
+ if (!isPlainObject(arg)) {
933
+ return false;
934
+ }
935
+ if (!arg.message && !arg.args) {
936
+ return false;
937
+ }
938
+ if (arg.stack) {
939
+ return false;
940
+ }
941
+ return true;
942
+ }
943
+ __name(isLogObj, "isLogObj");
944
+ var paused = false;
945
+ var queue = [];
946
+ var Consola = class _Consola {
947
+ static {
948
+ __name(this, "Consola");
949
+ }
950
+ options;
951
+ _lastLog;
952
+ _mockFn;
953
+ /**
954
+ * Creates an instance of Consola with specified options or defaults.
955
+ *
956
+ * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
957
+ */
958
+ constructor(options = {}) {
959
+ const types = options.types || LogTypes;
960
+ this.options = defu(
961
+ {
962
+ ...options,
963
+ defaults: { ...options.defaults },
964
+ level: _normalizeLogLevel(options.level, types),
965
+ reporters: [...options.reporters || []]
966
+ },
967
+ {
968
+ types: LogTypes,
969
+ throttle: 1e3,
970
+ throttleMin: 5,
971
+ formatOptions: {
972
+ date: true,
973
+ colors: false,
974
+ compact: true
975
+ }
976
+ }
977
+ );
978
+ for (const type in types) {
979
+ const defaults = {
980
+ type,
981
+ ...this.options.defaults,
982
+ ...types[type]
983
+ };
984
+ this[type] = this._wrapLogFn(defaults);
985
+ this[type].raw = this._wrapLogFn(
986
+ defaults,
987
+ true
988
+ );
989
+ }
990
+ if (this.options.mockFn) {
991
+ this.mockTypes();
992
+ }
993
+ this._lastLog = {};
994
+ }
995
+ /**
996
+ * Gets the current log level of the Consola instance.
997
+ *
998
+ * @returns {number} The current log level.
999
+ */
1000
+ get level() {
1001
+ return this.options.level;
1002
+ }
1003
+ /**
1004
+ * Sets the minimum log level that will be output by the instance.
1005
+ *
1006
+ * @param {number} level - The new log level to set.
1007
+ */
1008
+ set level(level) {
1009
+ this.options.level = _normalizeLogLevel(
1010
+ level,
1011
+ this.options.types,
1012
+ this.options.level
1013
+ );
1014
+ }
1015
+ /**
1016
+ * Displays a prompt to the user and returns the response.
1017
+ * Throw an error if `prompt` is not supported by the current configuration.
1018
+ *
1019
+ * @template T
1020
+ * @param {string} message - The message to display in the prompt.
1021
+ * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
1022
+ * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
1023
+ */
1024
+ prompt(message, opts) {
1025
+ if (!this.options.prompt) {
1026
+ throw new Error("prompt is not supported!");
1027
+ }
1028
+ return this.options.prompt(message, opts);
1029
+ }
1030
+ /**
1031
+ * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
1032
+ *
1033
+ * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
1034
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
1035
+ */
1036
+ create(options) {
1037
+ const instance = new _Consola({
1038
+ ...this.options,
1039
+ ...options
1040
+ });
1041
+ if (this._mockFn) {
1042
+ instance.mockTypes(this._mockFn);
1043
+ }
1044
+ return instance;
1045
+ }
1046
+ /**
1047
+ * Creates a new Consola instance with the specified default log object properties.
1048
+ *
1049
+ * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
1050
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
1051
+ */
1052
+ withDefaults(defaults) {
1053
+ return this.create({
1054
+ ...this.options,
1055
+ defaults: {
1056
+ ...this.options.defaults,
1057
+ ...defaults
1058
+ }
1059
+ });
1060
+ }
1061
+ /**
1062
+ * Creates a new Consola instance with a specified tag, which will be included in every log.
1063
+ *
1064
+ * @param {string} tag - The tag to include in each log of the new instance.
1065
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
1066
+ */
1067
+ withTag(tag) {
1068
+ return this.withDefaults({
1069
+ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
1070
+ });
1071
+ }
1072
+ /**
1073
+ * Adds a custom reporter to the Consola instance.
1074
+ * Reporters will be called for each log message, depending on their implementation and log level.
1075
+ *
1076
+ * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
1077
+ * @returns {Consola} The current Consola instance.
1078
+ */
1079
+ addReporter(reporter) {
1080
+ this.options.reporters.push(reporter);
1081
+ return this;
1082
+ }
1083
+ /**
1084
+ * Removes a custom reporter from the Consola instance.
1085
+ * If no reporter is specified, all reporters will be removed.
1086
+ *
1087
+ * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
1088
+ * @returns {Consola} The current Consola instance.
1089
+ */
1090
+ removeReporter(reporter) {
1091
+ if (reporter) {
1092
+ const i2 = this.options.reporters.indexOf(reporter);
1093
+ if (i2 !== -1) {
1094
+ return this.options.reporters.splice(i2, 1);
1095
+ }
1096
+ } else {
1097
+ this.options.reporters.splice(0);
1098
+ }
1099
+ return this;
1100
+ }
1101
+ /**
1102
+ * Replaces all reporters of the Consola instance with the specified array of reporters.
1103
+ *
1104
+ * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
1105
+ * @returns {Consola} The current Consola instance.
1106
+ */
1107
+ setReporters(reporters) {
1108
+ this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
1109
+ return this;
1110
+ }
1111
+ wrapAll() {
1112
+ this.wrapConsole();
1113
+ this.wrapStd();
1114
+ }
1115
+ restoreAll() {
1116
+ this.restoreConsole();
1117
+ this.restoreStd();
1118
+ }
1119
+ /**
1120
+ * Overrides console methods with Consola logging methods for consistent logging.
1121
+ */
1122
+ wrapConsole() {
1123
+ for (const type in this.options.types) {
1124
+ if (!console["__" + type]) {
1125
+ console["__" + type] = console[type];
1126
+ }
1127
+ console[type] = this[type].raw;
1128
+ }
1129
+ }
1130
+ /**
1131
+ * Restores the original console methods, removing Consola overrides.
1132
+ */
1133
+ restoreConsole() {
1134
+ for (const type in this.options.types) {
1135
+ if (console["__" + type]) {
1136
+ console[type] = console["__" + type];
1137
+ delete console["__" + type];
1138
+ }
1139
+ }
1140
+ }
1141
+ /**
1142
+ * Overrides standard output and error streams to redirect them through Consola.
1143
+ */
1144
+ wrapStd() {
1145
+ this._wrapStream(this.options.stdout, "log");
1146
+ this._wrapStream(this.options.stderr, "log");
1147
+ }
1148
+ _wrapStream(stream, type) {
1149
+ if (!stream) {
1150
+ return;
1151
+ }
1152
+ if (!stream.__write) {
1153
+ stream.__write = stream.write;
1154
+ }
1155
+ stream.write = (data) => {
1156
+ this[type].raw(String(data).trim());
1157
+ };
1158
+ }
1159
+ /**
1160
+ * Restores the original standard output and error streams, removing the Consola redirection.
1161
+ */
1162
+ restoreStd() {
1163
+ this._restoreStream(this.options.stdout);
1164
+ this._restoreStream(this.options.stderr);
1165
+ }
1166
+ _restoreStream(stream) {
1167
+ if (!stream) {
1168
+ return;
1169
+ }
1170
+ if (stream.__write) {
1171
+ stream.write = stream.__write;
1172
+ delete stream.__write;
1173
+ }
1174
+ }
1175
+ /**
1176
+ * Pauses logging, queues incoming logs until resumed.
1177
+ */
1178
+ pauseLogs() {
1179
+ paused = true;
1180
+ }
1181
+ /**
1182
+ * Resumes logging, processing any queued logs.
1183
+ */
1184
+ resumeLogs() {
1185
+ paused = false;
1186
+ const _queue = queue.splice(0);
1187
+ for (const item of _queue) {
1188
+ item[0]._logFn(item[1], item[2]);
1189
+ }
1190
+ }
1191
+ /**
1192
+ * Replaces logging methods with mocks if a mock function is provided.
1193
+ *
1194
+ * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
1195
+ */
1196
+ mockTypes(mockFn) {
1197
+ const _mockFn = mockFn || this.options.mockFn;
1198
+ this._mockFn = _mockFn;
1199
+ if (typeof _mockFn !== "function") {
1200
+ return;
1201
+ }
1202
+ for (const type in this.options.types) {
1203
+ this[type] = _mockFn(type, this.options.types[type]) || this[type];
1204
+ this[type].raw = this[type];
1205
+ }
1206
+ }
1207
+ _wrapLogFn(defaults, isRaw) {
1208
+ return (...args) => {
1209
+ if (paused) {
1210
+ queue.push([this, defaults, args, isRaw]);
1211
+ return;
1212
+ }
1213
+ return this._logFn(defaults, args, isRaw);
1214
+ };
1215
+ }
1216
+ _logFn(defaults, args, isRaw) {
1217
+ if ((defaults.level || 0) > this.level) {
1218
+ return false;
1219
+ }
1220
+ const logObj = {
1221
+ date: /* @__PURE__ */ new Date(),
1222
+ args: [],
1223
+ ...defaults,
1224
+ level: _normalizeLogLevel(defaults.level, this.options.types)
1225
+ };
1226
+ if (!isRaw && args.length === 1 && isLogObj(args[0])) {
1227
+ Object.assign(logObj, args[0]);
1228
+ } else {
1229
+ logObj.args = [...args];
1230
+ }
1231
+ if (logObj.message) {
1232
+ logObj.args.unshift(logObj.message);
1233
+ delete logObj.message;
1234
+ }
1235
+ if (logObj.additional) {
1236
+ if (!Array.isArray(logObj.additional)) {
1237
+ logObj.additional = logObj.additional.split("\n");
1238
+ }
1239
+ logObj.args.push("\n" + logObj.additional.join("\n"));
1240
+ delete logObj.additional;
1241
+ }
1242
+ logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
1243
+ logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
1244
+ const resolveLog = /* @__PURE__ */ __name((newLog = false) => {
1245
+ const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
1246
+ if (this._lastLog.object && repeated > 0) {
1247
+ const args2 = [...this._lastLog.object.args];
1248
+ if (repeated > 1) {
1249
+ args2.push(`(repeated ${repeated} times)`);
1250
+ }
1251
+ this._log({ ...this._lastLog.object, args: args2 });
1252
+ this._lastLog.count = 1;
1253
+ }
1254
+ if (newLog) {
1255
+ this._lastLog.object = logObj;
1256
+ this._log(logObj);
1257
+ }
1258
+ }, "resolveLog");
1259
+ clearTimeout(this._lastLog.timeout);
1260
+ const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
1261
+ this._lastLog.time = logObj.date;
1262
+ if (diffTime < this.options.throttle) {
1263
+ try {
1264
+ const serializedLog = JSON.stringify([
1265
+ logObj.type,
1266
+ logObj.tag,
1267
+ logObj.args
1268
+ ]);
1269
+ const isSameLog = this._lastLog.serialized === serializedLog;
1270
+ this._lastLog.serialized = serializedLog;
1271
+ if (isSameLog) {
1272
+ this._lastLog.count = (this._lastLog.count || 0) + 1;
1273
+ if (this._lastLog.count > this.options.throttleMin) {
1274
+ this._lastLog.timeout = setTimeout(
1275
+ resolveLog,
1276
+ this.options.throttle
1277
+ );
1278
+ return;
1279
+ }
1280
+ }
1281
+ } catch {
1282
+ }
1283
+ }
1284
+ resolveLog(true);
1285
+ }
1286
+ _log(logObj) {
1287
+ for (const reporter of this.options.reporters) {
1288
+ reporter.log(logObj, {
1289
+ options: this.options
1290
+ });
1291
+ }
1292
+ }
1293
+ };
1294
+ function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
1295
+ if (input === void 0) {
1296
+ return defaultLevel;
1297
+ }
1298
+ if (typeof input === "number") {
1299
+ return input;
1300
+ }
1301
+ if (types[input] && types[input].level !== void 0) {
1302
+ return types[input].level;
1303
+ }
1304
+ return defaultLevel;
1305
+ }
1306
+ __name(_normalizeLogLevel, "_normalizeLogLevel");
1307
+ Consola.prototype.add = Consola.prototype.addReporter;
1308
+ Consola.prototype.remove = Consola.prototype.removeReporter;
1309
+ Consola.prototype.clear = Consola.prototype.removeReporter;
1310
+ Consola.prototype.withScope = Consola.prototype.withTag;
1311
+ Consola.prototype.mock = Consola.prototype.mockTypes;
1312
+ Consola.prototype.pause = Consola.prototype.pauseLogs;
1313
+ Consola.prototype.resume = Consola.prototype.resumeLogs;
1314
+ function createConsola(options = {}) {
1315
+ return new Consola(options);
1316
+ }
1317
+ __name(createConsola, "createConsola");
1318
+ function parseStack(stack, message) {
1319
+ const cwd = process.cwd() + sep;
1320
+ const lines = stack.split("\n").splice(message.split("\n").length).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
1321
+ return lines;
1322
+ }
1323
+ __name(parseStack, "parseStack");
1324
+ function writeStream(data, stream) {
1325
+ const write = stream.__write || stream.write;
1326
+ return write.call(stream, data);
1327
+ }
1328
+ __name(writeStream, "writeStream");
1329
+ var bracket = /* @__PURE__ */ __name((x2) => x2 ? `[${x2}]` : "", "bracket");
1330
+ var BasicReporter = class {
1331
+ static {
1332
+ __name(this, "BasicReporter");
1333
+ }
1334
+ formatStack(stack, message, opts) {
1335
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
1336
+ return indent + parseStack(stack, message).join(`
1337
+ ${indent}`);
1338
+ }
1339
+ formatError(err, opts) {
1340
+ const message = err.message ?? formatWithOptions(opts, err);
1341
+ const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
1342
+ const level = opts?.errorLevel || 0;
1343
+ const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
1344
+ const causedError = err.cause ? "\n\n" + this.formatError(err.cause, { ...opts, errorLevel: level + 1 }) : "";
1345
+ return causedPrefix + message + "\n" + stack + causedError;
1346
+ }
1347
+ formatArgs(args, opts) {
1348
+ const _args = args.map((arg) => {
1349
+ if (arg && typeof arg.stack === "string") {
1350
+ return this.formatError(arg, opts);
1351
+ }
1352
+ return arg;
1353
+ });
1354
+ return formatWithOptions(opts, ..._args);
1355
+ }
1356
+ formatDate(date, opts) {
1357
+ return opts.date ? date.toLocaleTimeString() : "";
1358
+ }
1359
+ filterAndJoin(arr) {
1360
+ return arr.filter(Boolean).join(" ");
1361
+ }
1362
+ formatLogObj(logObj, opts) {
1363
+ const message = this.formatArgs(logObj.args, opts);
1364
+ if (logObj.type === "box") {
1365
+ return "\n" + [
1366
+ bracket(logObj.tag),
1367
+ logObj.title && logObj.title,
1368
+ ...message.split("\n")
1369
+ ].filter(Boolean).map((l2) => " > " + l2).join("\n") + "\n";
1370
+ }
1371
+ return this.filterAndJoin([
1372
+ bracket(logObj.type),
1373
+ bracket(logObj.tag),
1374
+ message
1375
+ ]);
1376
+ }
1377
+ log(logObj, ctx) {
1378
+ const line = this.formatLogObj(logObj, {
1379
+ columns: ctx.options.stdout.columns || 0,
1380
+ ...ctx.options.formatOptions
1381
+ });
1382
+ return writeStream(
1383
+ line + "\n",
1384
+ logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
1385
+ );
1386
+ }
1387
+ };
1388
+ var {
1389
+ env = {},
1390
+ argv = [],
1391
+ platform = ""
1392
+ } = typeof process === "undefined" ? {} : process;
1393
+ var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
1394
+ var isForced = "FORCE_COLOR" in env || argv.includes("--color");
1395
+ var isWindows = platform === "win32";
1396
+ var isDumbTerminal = env.TERM === "dumb";
1397
+ var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
1398
+ var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
1399
+ var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
1400
+ function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
1401
+ return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
1402
+ }
1403
+ __name(replaceClose, "replaceClose");
1404
+ function clearBleed(index, string, open, close, replace) {
1405
+ return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
1406
+ }
1407
+ __name(clearBleed, "clearBleed");
1408
+ function filterEmpty(open, close, replace = open, at = open.length + 1) {
1409
+ return (string) => string || !(string === "" || string === void 0) ? clearBleed(
1410
+ ("" + string).indexOf(close, at),
1411
+ string,
1412
+ open,
1413
+ close,
1414
+ replace
1415
+ ) : "";
1416
+ }
1417
+ __name(filterEmpty, "filterEmpty");
1418
+ function init(open, close, replace) {
1419
+ return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
1420
+ }
1421
+ __name(init, "init");
1422
+ var colorDefs = {
1423
+ reset: init(0, 0),
1424
+ bold: init(1, 22, "\x1B[22m\x1B[1m"),
1425
+ dim: init(2, 22, "\x1B[22m\x1B[2m"),
1426
+ italic: init(3, 23),
1427
+ underline: init(4, 24),
1428
+ inverse: init(7, 27),
1429
+ hidden: init(8, 28),
1430
+ strikethrough: init(9, 29),
1431
+ black: init(30, 39),
1432
+ red: init(31, 39),
1433
+ green: init(32, 39),
1434
+ yellow: init(33, 39),
1435
+ blue: init(34, 39),
1436
+ magenta: init(35, 39),
1437
+ cyan: init(36, 39),
1438
+ white: init(37, 39),
1439
+ gray: init(90, 39),
1440
+ bgBlack: init(40, 49),
1441
+ bgRed: init(41, 49),
1442
+ bgGreen: init(42, 49),
1443
+ bgYellow: init(43, 49),
1444
+ bgBlue: init(44, 49),
1445
+ bgMagenta: init(45, 49),
1446
+ bgCyan: init(46, 49),
1447
+ bgWhite: init(47, 49),
1448
+ blackBright: init(90, 39),
1449
+ redBright: init(91, 39),
1450
+ greenBright: init(92, 39),
1451
+ yellowBright: init(93, 39),
1452
+ blueBright: init(94, 39),
1453
+ magentaBright: init(95, 39),
1454
+ cyanBright: init(96, 39),
1455
+ whiteBright: init(97, 39),
1456
+ bgBlackBright: init(100, 49),
1457
+ bgRedBright: init(101, 49),
1458
+ bgGreenBright: init(102, 49),
1459
+ bgYellowBright: init(103, 49),
1460
+ bgBlueBright: init(104, 49),
1461
+ bgMagentaBright: init(105, 49),
1462
+ bgCyanBright: init(106, 49),
1463
+ bgWhiteBright: init(107, 49)
1464
+ };
1465
+ function createColors(useColor = isColorSupported) {
1466
+ return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
1467
+ }
1468
+ __name(createColors, "createColors");
1469
+ var colors = createColors();
1470
+ function getColor(color, fallback = "reset") {
1471
+ return colors[color] || colors[fallback];
1472
+ }
1473
+ __name(getColor, "getColor");
1474
+ var ansiRegex = [
1475
+ String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
1476
+ String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
1477
+ ].join("|");
1478
+ function stripAnsi(text) {
1479
+ return text.replace(new RegExp(ansiRegex, "g"), "");
1480
+ }
1481
+ __name(stripAnsi, "stripAnsi");
1482
+ var boxStylePresets = {
1483
+ solid: {
1484
+ tl: "\u250C",
1485
+ tr: "\u2510",
1486
+ bl: "\u2514",
1487
+ br: "\u2518",
1488
+ h: "\u2500",
1489
+ v: "\u2502"
1490
+ },
1491
+ double: {
1492
+ tl: "\u2554",
1493
+ tr: "\u2557",
1494
+ bl: "\u255A",
1495
+ br: "\u255D",
1496
+ h: "\u2550",
1497
+ v: "\u2551"
1498
+ },
1499
+ doubleSingle: {
1500
+ tl: "\u2553",
1501
+ tr: "\u2556",
1502
+ bl: "\u2559",
1503
+ br: "\u255C",
1504
+ h: "\u2500",
1505
+ v: "\u2551"
1506
+ },
1507
+ doubleSingleRounded: {
1508
+ tl: "\u256D",
1509
+ tr: "\u256E",
1510
+ bl: "\u2570",
1511
+ br: "\u256F",
1512
+ h: "\u2500",
1513
+ v: "\u2551"
1514
+ },
1515
+ singleThick: {
1516
+ tl: "\u250F",
1517
+ tr: "\u2513",
1518
+ bl: "\u2517",
1519
+ br: "\u251B",
1520
+ h: "\u2501",
1521
+ v: "\u2503"
1522
+ },
1523
+ singleDouble: {
1524
+ tl: "\u2552",
1525
+ tr: "\u2555",
1526
+ bl: "\u2558",
1527
+ br: "\u255B",
1528
+ h: "\u2550",
1529
+ v: "\u2502"
1530
+ },
1531
+ singleDoubleRounded: {
1532
+ tl: "\u256D",
1533
+ tr: "\u256E",
1534
+ bl: "\u2570",
1535
+ br: "\u256F",
1536
+ h: "\u2550",
1537
+ v: "\u2502"
1538
+ },
1539
+ rounded: {
1540
+ tl: "\u256D",
1541
+ tr: "\u256E",
1542
+ bl: "\u2570",
1543
+ br: "\u256F",
1544
+ h: "\u2500",
1545
+ v: "\u2502"
1546
+ }
1547
+ };
1548
+ var defaultStyle = {
1549
+ borderColor: "white",
1550
+ borderStyle: "rounded",
1551
+ valign: "center",
1552
+ padding: 2,
1553
+ marginLeft: 1,
1554
+ marginTop: 1,
1555
+ marginBottom: 1
1556
+ };
1557
+ function box(text, _opts = {}) {
1558
+ const opts = {
1559
+ ..._opts,
1560
+ style: {
1561
+ ...defaultStyle,
1562
+ ..._opts.style
1563
+ }
1564
+ };
1565
+ const textLines = text.split("\n");
1566
+ const boxLines = [];
1567
+ const _color = getColor(opts.style.borderColor);
1568
+ const borderStyle = {
1569
+ ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
1570
+ };
1571
+ if (_color) {
1572
+ for (const key in borderStyle) {
1573
+ borderStyle[key] = _color(
1574
+ borderStyle[key]
1575
+ );
1576
+ }
1577
+ }
1578
+ const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
1579
+ const height = textLines.length + paddingOffset;
1580
+ const width = Math.max(
1581
+ ...textLines.map((line) => stripAnsi(line).length),
1582
+ opts.title ? stripAnsi(opts.title).length : 0
1583
+ ) + paddingOffset;
1584
+ const widthOffset = width + paddingOffset;
1585
+ const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
1586
+ if (opts.style.marginTop > 0) {
1587
+ boxLines.push("".repeat(opts.style.marginTop));
1588
+ }
1589
+ if (opts.title) {
1590
+ const title = _color ? _color(opts.title) : opts.title;
1591
+ const left = borderStyle.h.repeat(
1592
+ Math.floor((width - stripAnsi(opts.title).length) / 2)
1593
+ );
1594
+ const right = borderStyle.h.repeat(
1595
+ width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
1596
+ );
1597
+ boxLines.push(
1598
+ `${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`
1599
+ );
1600
+ } else {
1601
+ boxLines.push(
1602
+ `${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
1603
+ );
1604
+ }
1605
+ const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
1606
+ for (let i2 = 0; i2 < height; i2++) {
1607
+ if (i2 < valignOffset || i2 >= valignOffset + textLines.length) {
1608
+ boxLines.push(
1609
+ `${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
1610
+ );
1611
+ } else {
1612
+ const line = textLines[i2 - valignOffset];
1613
+ const left = " ".repeat(paddingOffset);
1614
+ const right = " ".repeat(width - stripAnsi(line).length);
1615
+ boxLines.push(
1616
+ `${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
1617
+ );
1618
+ }
1619
+ }
1620
+ boxLines.push(
1621
+ `${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
1622
+ );
1623
+ if (opts.style.marginBottom > 0) {
1624
+ boxLines.push("".repeat(opts.style.marginBottom));
1625
+ }
1626
+ return boxLines.join("\n");
1627
+ }
1628
+ __name(box, "box");
1629
+ var r2 = /* @__PURE__ */ Object.create(null);
1630
+ var i = /* @__PURE__ */ __name((e2) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e2 ? r2 : globalThis), "i");
1631
+ var o2 = new Proxy(r2, { get(e2, s2) {
1632
+ return i()[s2] ?? r2[s2];
1633
+ }, has(e2, s2) {
1634
+ const E = i();
1635
+ return s2 in E || s2 in r2;
1636
+ }, set(e2, s2, E) {
1637
+ const B2 = i(true);
1638
+ return B2[s2] = E, true;
1639
+ }, deleteProperty(e2, s2) {
1640
+ if (!s2) return false;
1641
+ const E = i(true);
1642
+ return delete E[s2], true;
1643
+ }, ownKeys() {
1644
+ const e2 = i(true);
1645
+ return Object.keys(e2);
1646
+ } });
1647
+ var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
1648
+ var f2 = [["APPVEYOR"], ["AWS_AMPLIFY", "AWS_APP_ID", { ci: true }], ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"], ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"], ["APPCIRCLE", "AC_APPCIRCLE"], ["BAMBOO", "bamboo_planKey"], ["BITBUCKET", "BITBUCKET_COMMIT"], ["BITRISE", "BITRISE_IO"], ["BUDDY", "BUDDY_WORKSPACE_ID"], ["BUILDKITE"], ["CIRCLE", "CIRCLECI"], ["CIRRUS", "CIRRUS_CI"], ["CLOUDFLARE_PAGES", "CF_PAGES", { ci: true }], ["CODEBUILD", "CODEBUILD_BUILD_ARN"], ["CODEFRESH", "CF_BUILD_ID"], ["DRONE"], ["DRONE", "DRONE_BUILD_EVENT"], ["DSARI"], ["GITHUB_ACTIONS"], ["GITLAB", "GITLAB_CI"], ["GITLAB", "CI_MERGE_REQUEST_ID"], ["GOCD", "GO_PIPELINE_LABEL"], ["LAYERCI"], ["HUDSON", "HUDSON_URL"], ["JENKINS", "JENKINS_URL"], ["MAGNUM"], ["NETLIFY"], ["NETLIFY", "NETLIFY_LOCAL", { ci: false }], ["NEVERCODE"], ["RENDER"], ["SAIL", "SAILCI"], ["SEMAPHORE"], ["SCREWDRIVER"], ["SHIPPABLE"], ["SOLANO", "TDDIUM"], ["STRIDER"], ["TEAMCITY", "TEAMCITY_VERSION"], ["TRAVIS"], ["VERCEL", "NOW_BUILDER"], ["VERCEL", "VERCEL", { ci: false }], ["VERCEL", "VERCEL_ENV", { ci: false }], ["APPCENTER", "APPCENTER_BUILD_ID"], ["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }], ["CODESANDBOX", "CODESANDBOX_HOST", { ci: false }], ["STACKBLITZ"], ["STORMKIT"], ["CLEAVR"], ["ZEABUR"], ["CODESPHERE", "CODESPHERE_APP_ID", { ci: true }], ["RAILWAY", "RAILWAY_PROJECT_ID"], ["RAILWAY", "RAILWAY_SERVICE_ID"], ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"], ["FIREBASE_APP_HOSTING", "FIREBASE_APP_HOSTING", { ci: true }]];
1649
+ function b() {
1650
+ if (globalThis.process?.env) for (const e2 of f2) {
1651
+ const s2 = e2[1] || e2[0];
1652
+ if (globalThis.process?.env[s2]) return { name: e2[0].toLowerCase(), ...e2[2] };
1653
+ }
1654
+ return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? { name: "stackblitz", ci: false } : { name: "", ci: false };
1655
+ }
1656
+ __name(b, "b");
1657
+ var l = b();
1658
+ l.name;
1659
+ function n(e2) {
1660
+ return e2 ? e2 !== "false" : false;
1661
+ }
1662
+ __name(n, "n");
1663
+ var I2 = globalThis.process?.platform || "";
1664
+ var T2 = n(o2.CI) || l.ci !== false;
1665
+ var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
1666
+ var g2 = n(o2.DEBUG);
1667
+ var R2 = t === "test" || n(o2.TEST);
1668
+ n(o2.MINIMAL) || T2 || R2 || !a;
1669
+ var A2 = /^win/i.test(I2);
1670
+ !n(o2.NO_COLOR) && (n(o2.FORCE_COLOR) || (a || A2) && o2.TERM !== "dumb" || T2);
1671
+ var C2 = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
1672
+ Number(C2?.split(".")[0]) || null;
1673
+ var y2 = globalThis.process || /* @__PURE__ */ Object.create(null);
1674
+ var _2 = { versions: {} };
1675
+ new Proxy(y2, { get(e2, s2) {
1676
+ if (s2 === "env") return o2;
1677
+ if (s2 in e2) return e2[s2];
1678
+ if (s2 in _2) return _2[s2];
1679
+ } });
1680
+ var c2 = globalThis.process?.release?.name === "node";
1681
+ var O2 = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
1682
+ var D = !!globalThis.Deno;
1683
+ var L2 = !!globalThis.fastly;
1684
+ var S2 = !!globalThis.Netlify;
1685
+ var u2 = !!globalThis.EdgeRuntime;
1686
+ var N2 = globalThis.navigator?.userAgent === "Cloudflare-Workers";
1687
+ var F2 = [[S2, "netlify"], [u2, "edge-light"], [N2, "workerd"], [L2, "fastly"], [D, "deno"], [O2, "bun"], [c2, "node"]];
1688
+ function G2() {
1689
+ const e2 = F2.find((s2) => s2[0]);
1690
+ if (e2) return { name: e2[1] };
1691
+ }
1692
+ __name(G2, "G");
1693
+ var P2 = G2();
1694
+ P2?.name || "";
1695
+ function ansiRegex2({ onlyFirst = false } = {}) {
1696
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
1697
+ const pattern = [
1698
+ `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
1699
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
1700
+ ].join("|");
1701
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
1702
+ }
1703
+ __name(ansiRegex2, "ansiRegex");
1704
+ var regex = ansiRegex2();
1705
+ function stripAnsi2(string) {
1706
+ if (typeof string !== "string") {
1707
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
1708
+ }
1709
+ return string.replace(regex, "");
1710
+ }
1711
+ __name(stripAnsi2, "stripAnsi");
1712
+ function isAmbiguous(x2) {
1713
+ return x2 === 161 || x2 === 164 || x2 === 167 || x2 === 168 || x2 === 170 || x2 === 173 || x2 === 174 || x2 >= 176 && x2 <= 180 || x2 >= 182 && x2 <= 186 || x2 >= 188 && x2 <= 191 || x2 === 198 || x2 === 208 || x2 === 215 || x2 === 216 || x2 >= 222 && x2 <= 225 || x2 === 230 || x2 >= 232 && x2 <= 234 || x2 === 236 || x2 === 237 || x2 === 240 || x2 === 242 || x2 === 243 || x2 >= 247 && x2 <= 250 || x2 === 252 || x2 === 254 || x2 === 257 || x2 === 273 || x2 === 275 || x2 === 283 || x2 === 294 || x2 === 295 || x2 === 299 || x2 >= 305 && x2 <= 307 || x2 === 312 || x2 >= 319 && x2 <= 322 || x2 === 324 || x2 >= 328 && x2 <= 331 || x2 === 333 || x2 === 338 || x2 === 339 || x2 === 358 || x2 === 359 || x2 === 363 || x2 === 462 || x2 === 464 || x2 === 466 || x2 === 468 || x2 === 470 || x2 === 472 || x2 === 474 || x2 === 476 || x2 === 593 || x2 === 609 || x2 === 708 || x2 === 711 || x2 >= 713 && x2 <= 715 || x2 === 717 || x2 === 720 || x2 >= 728 && x2 <= 731 || x2 === 733 || x2 === 735 || x2 >= 768 && x2 <= 879 || x2 >= 913 && x2 <= 929 || x2 >= 931 && x2 <= 937 || x2 >= 945 && x2 <= 961 || x2 >= 963 && x2 <= 969 || x2 === 1025 || x2 >= 1040 && x2 <= 1103 || x2 === 1105 || x2 === 8208 || x2 >= 8211 && x2 <= 8214 || x2 === 8216 || x2 === 8217 || x2 === 8220 || x2 === 8221 || x2 >= 8224 && x2 <= 8226 || x2 >= 8228 && x2 <= 8231 || x2 === 8240 || x2 === 8242 || x2 === 8243 || x2 === 8245 || x2 === 8251 || x2 === 8254 || x2 === 8308 || x2 === 8319 || x2 >= 8321 && x2 <= 8324 || x2 === 8364 || x2 === 8451 || x2 === 8453 || x2 === 8457 || x2 === 8467 || x2 === 8470 || x2 === 8481 || x2 === 8482 || x2 === 8486 || x2 === 8491 || x2 === 8531 || x2 === 8532 || x2 >= 8539 && x2 <= 8542 || x2 >= 8544 && x2 <= 8555 || x2 >= 8560 && x2 <= 8569 || x2 === 8585 || x2 >= 8592 && x2 <= 8601 || x2 === 8632 || x2 === 8633 || x2 === 8658 || x2 === 8660 || x2 === 8679 || x2 === 8704 || x2 === 8706 || x2 === 8707 || x2 === 8711 || x2 === 8712 || x2 === 8715 || x2 === 8719 || x2 === 8721 || x2 === 8725 || x2 === 8730 || x2 >= 8733 && x2 <= 8736 || x2 === 8739 || x2 === 8741 || x2 >= 8743 && x2 <= 8748 || x2 === 8750 || x2 >= 8756 && x2 <= 8759 || x2 === 8764 || x2 === 8765 || x2 === 8776 || x2 === 8780 || x2 === 8786 || x2 === 8800 || x2 === 8801 || x2 >= 8804 && x2 <= 8807 || x2 === 8810 || x2 === 8811 || x2 === 8814 || x2 === 8815 || x2 === 8834 || x2 === 8835 || x2 === 8838 || x2 === 8839 || x2 === 8853 || x2 === 8857 || x2 === 8869 || x2 === 8895 || x2 === 8978 || x2 >= 9312 && x2 <= 9449 || x2 >= 9451 && x2 <= 9547 || x2 >= 9552 && x2 <= 9587 || x2 >= 9600 && x2 <= 9615 || x2 >= 9618 && x2 <= 9621 || x2 === 9632 || x2 === 9633 || x2 >= 9635 && x2 <= 9641 || x2 === 9650 || x2 === 9651 || x2 === 9654 || x2 === 9655 || x2 === 9660 || x2 === 9661 || x2 === 9664 || x2 === 9665 || x2 >= 9670 && x2 <= 9672 || x2 === 9675 || x2 >= 9678 && x2 <= 9681 || x2 >= 9698 && x2 <= 9701 || x2 === 9711 || x2 === 9733 || x2 === 9734 || x2 === 9737 || x2 === 9742 || x2 === 9743 || x2 === 9756 || x2 === 9758 || x2 === 9792 || x2 === 9794 || x2 === 9824 || x2 === 9825 || x2 >= 9827 && x2 <= 9829 || x2 >= 9831 && x2 <= 9834 || x2 === 9836 || x2 === 9837 || x2 === 9839 || x2 === 9886 || x2 === 9887 || x2 === 9919 || x2 >= 9926 && x2 <= 9933 || x2 >= 9935 && x2 <= 9939 || x2 >= 9941 && x2 <= 9953 || x2 === 9955 || x2 === 9960 || x2 === 9961 || x2 >= 9963 && x2 <= 9969 || x2 === 9972 || x2 >= 9974 && x2 <= 9977 || x2 === 9979 || x2 === 9980 || x2 === 9982 || x2 === 9983 || x2 === 10045 || x2 >= 10102 && x2 <= 10111 || x2 >= 11094 && x2 <= 11097 || x2 >= 12872 && x2 <= 12879 || x2 >= 57344 && x2 <= 63743 || x2 >= 65024 && x2 <= 65039 || x2 === 65533 || x2 >= 127232 && x2 <= 127242 || x2 >= 127248 && x2 <= 127277 || x2 >= 127280 && x2 <= 127337 || x2 >= 127344 && x2 <= 127373 || x2 === 127375 || x2 === 127376 || x2 >= 127387 && x2 <= 127404 || x2 >= 917760 && x2 <= 917999 || x2 >= 983040 && x2 <= 1048573 || x2 >= 1048576 && x2 <= 1114109;
1714
+ }
1715
+ __name(isAmbiguous, "isAmbiguous");
1716
+ function isFullWidth(x2) {
1717
+ return x2 === 12288 || x2 >= 65281 && x2 <= 65376 || x2 >= 65504 && x2 <= 65510;
1718
+ }
1719
+ __name(isFullWidth, "isFullWidth");
1720
+ function isWide(x2) {
1721
+ return x2 >= 4352 && x2 <= 4447 || x2 === 8986 || x2 === 8987 || x2 === 9001 || x2 === 9002 || x2 >= 9193 && x2 <= 9196 || x2 === 9200 || x2 === 9203 || x2 === 9725 || x2 === 9726 || x2 === 9748 || x2 === 9749 || x2 >= 9776 && x2 <= 9783 || x2 >= 9800 && x2 <= 9811 || x2 === 9855 || x2 >= 9866 && x2 <= 9871 || x2 === 9875 || x2 === 9889 || x2 === 9898 || x2 === 9899 || x2 === 9917 || x2 === 9918 || x2 === 9924 || x2 === 9925 || x2 === 9934 || x2 === 9940 || x2 === 9962 || x2 === 9970 || x2 === 9971 || x2 === 9973 || x2 === 9978 || x2 === 9981 || x2 === 9989 || x2 === 9994 || x2 === 9995 || x2 === 10024 || x2 === 10060 || x2 === 10062 || x2 >= 10067 && x2 <= 10069 || x2 === 10071 || x2 >= 10133 && x2 <= 10135 || x2 === 10160 || x2 === 10175 || x2 === 11035 || x2 === 11036 || x2 === 11088 || x2 === 11093 || x2 >= 11904 && x2 <= 11929 || x2 >= 11931 && x2 <= 12019 || x2 >= 12032 && x2 <= 12245 || x2 >= 12272 && x2 <= 12287 || x2 >= 12289 && x2 <= 12350 || x2 >= 12353 && x2 <= 12438 || x2 >= 12441 && x2 <= 12543 || x2 >= 12549 && x2 <= 12591 || x2 >= 12593 && x2 <= 12686 || x2 >= 12688 && x2 <= 12773 || x2 >= 12783 && x2 <= 12830 || x2 >= 12832 && x2 <= 12871 || x2 >= 12880 && x2 <= 42124 || x2 >= 42128 && x2 <= 42182 || x2 >= 43360 && x2 <= 43388 || x2 >= 44032 && x2 <= 55203 || x2 >= 63744 && x2 <= 64255 || x2 >= 65040 && x2 <= 65049 || x2 >= 65072 && x2 <= 65106 || x2 >= 65108 && x2 <= 65126 || x2 >= 65128 && x2 <= 65131 || x2 >= 94176 && x2 <= 94180 || x2 === 94192 || x2 === 94193 || x2 >= 94208 && x2 <= 100343 || x2 >= 100352 && x2 <= 101589 || x2 >= 101631 && x2 <= 101640 || x2 >= 110576 && x2 <= 110579 || x2 >= 110581 && x2 <= 110587 || x2 === 110589 || x2 === 110590 || x2 >= 110592 && x2 <= 110882 || x2 === 110898 || x2 >= 110928 && x2 <= 110930 || x2 === 110933 || x2 >= 110948 && x2 <= 110951 || x2 >= 110960 && x2 <= 111355 || x2 >= 119552 && x2 <= 119638 || x2 >= 119648 && x2 <= 119670 || x2 === 126980 || x2 === 127183 || x2 === 127374 || x2 >= 127377 && x2 <= 127386 || x2 >= 127488 && x2 <= 127490 || x2 >= 127504 && x2 <= 127547 || x2 >= 127552 && x2 <= 127560 || x2 === 127568 || x2 === 127569 || x2 >= 127584 && x2 <= 127589 || x2 >= 127744 && x2 <= 127776 || x2 >= 127789 && x2 <= 127797 || x2 >= 127799 && x2 <= 127868 || x2 >= 127870 && x2 <= 127891 || x2 >= 127904 && x2 <= 127946 || x2 >= 127951 && x2 <= 127955 || x2 >= 127968 && x2 <= 127984 || x2 === 127988 || x2 >= 127992 && x2 <= 128062 || x2 === 128064 || x2 >= 128066 && x2 <= 128252 || x2 >= 128255 && x2 <= 128317 || x2 >= 128331 && x2 <= 128334 || x2 >= 128336 && x2 <= 128359 || x2 === 128378 || x2 === 128405 || x2 === 128406 || x2 === 128420 || x2 >= 128507 && x2 <= 128591 || x2 >= 128640 && x2 <= 128709 || x2 === 128716 || x2 >= 128720 && x2 <= 128722 || x2 >= 128725 && x2 <= 128727 || x2 >= 128732 && x2 <= 128735 || x2 === 128747 || x2 === 128748 || x2 >= 128756 && x2 <= 128764 || x2 >= 128992 && x2 <= 129003 || x2 === 129008 || x2 >= 129292 && x2 <= 129338 || x2 >= 129340 && x2 <= 129349 || x2 >= 129351 && x2 <= 129535 || x2 >= 129648 && x2 <= 129660 || x2 >= 129664 && x2 <= 129673 || x2 >= 129679 && x2 <= 129734 || x2 >= 129742 && x2 <= 129756 || x2 >= 129759 && x2 <= 129769 || x2 >= 129776 && x2 <= 129784 || x2 >= 131072 && x2 <= 196605 || x2 >= 196608 && x2 <= 262141;
1722
+ }
1723
+ __name(isWide, "isWide");
1724
+ function validate(codePoint) {
1725
+ if (!Number.isSafeInteger(codePoint)) {
1726
+ throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
1727
+ }
1728
+ }
1729
+ __name(validate, "validate");
1730
+ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
1731
+ validate(codePoint);
1732
+ if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
1733
+ return 2;
1734
+ }
1735
+ return 1;
1736
+ }
1737
+ __name(eastAsianWidth, "eastAsianWidth");
1738
+ var emojiRegex = /* @__PURE__ */ __name(() => {
1739
+ return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
1740
+ }, "emojiRegex");
1741
+ var segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: /* @__PURE__ */ __name((str) => str.split(""), "segment") };
1742
+ var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
1743
+ function stringWidth$1(string, options = {}) {
1744
+ if (typeof string !== "string" || string.length === 0) {
1745
+ return 0;
1746
+ }
1747
+ const {
1748
+ ambiguousIsNarrow = true,
1749
+ countAnsiEscapeCodes = false
1750
+ } = options;
1751
+ if (!countAnsiEscapeCodes) {
1752
+ string = stripAnsi2(string);
1753
+ }
1754
+ if (string.length === 0) {
1755
+ return 0;
1756
+ }
1757
+ let width = 0;
1758
+ const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
1759
+ for (const { segment: character } of segmenter.segment(string)) {
1760
+ const codePoint = character.codePointAt(0);
1761
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
1762
+ continue;
1763
+ }
1764
+ if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
1765
+ continue;
1766
+ }
1767
+ if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
1768
+ continue;
1769
+ }
1770
+ if (codePoint >= 55296 && codePoint <= 57343) {
1771
+ continue;
1772
+ }
1773
+ if (codePoint >= 65024 && codePoint <= 65039) {
1774
+ continue;
1775
+ }
1776
+ if (defaultIgnorableCodePointRegex.test(character)) {
1777
+ continue;
1778
+ }
1779
+ if (emojiRegex().test(character)) {
1780
+ width += 2;
1781
+ continue;
1782
+ }
1783
+ width += eastAsianWidth(codePoint, eastAsianWidthOptions);
1784
+ }
1785
+ return width;
1786
+ }
1787
+ __name(stringWidth$1, "stringWidth$1");
1788
+ function isUnicodeSupported() {
1789
+ const { env: env2 } = g;
1790
+ const { TERM, TERM_PROGRAM } = env2;
1791
+ if (g.platform !== "win32") {
1792
+ return TERM !== "linux";
1793
+ }
1794
+ return Boolean(env2.WT_SESSION) || Boolean(env2.TERMINUS_SUBLIME) || env2.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env2.TERMINAL_EMULATOR === "JetBrains-JediTerm";
1795
+ }
1796
+ __name(isUnicodeSupported, "isUnicodeSupported");
1797
+ var TYPE_COLOR_MAP = {
1798
+ info: "cyan",
1799
+ fail: "red",
1800
+ success: "green",
1801
+ ready: "green",
1802
+ start: "magenta"
1803
+ };
1804
+ var LEVEL_COLOR_MAP = {
1805
+ 0: "red",
1806
+ 1: "yellow"
1807
+ };
1808
+ var unicode = isUnicodeSupported();
1809
+ var s = /* @__PURE__ */ __name((c3, fallback) => unicode ? c3 : fallback, "s");
1810
+ var TYPE_ICONS = {
1811
+ error: s("\u2716", "\xD7"),
1812
+ fatal: s("\u2716", "\xD7"),
1813
+ ready: s("\u2714", "\u221A"),
1814
+ warn: s("\u26A0", "\u203C"),
1815
+ info: s("\u2139", "i"),
1816
+ success: s("\u2714", "\u221A"),
1817
+ debug: s("\u2699", "D"),
1818
+ trace: s("\u2192", "\u2192"),
1819
+ fail: s("\u2716", "\xD7"),
1820
+ start: s("\u25D0", "o"),
1821
+ log: ""
1822
+ };
1823
+ function stringWidth(str) {
1824
+ const hasICU = typeof Intl === "object";
1825
+ if (!hasICU || !Intl.Segmenter) {
1826
+ return stripAnsi(str).length;
1827
+ }
1828
+ return stringWidth$1(str);
1829
+ }
1830
+ __name(stringWidth, "stringWidth");
1831
+ var FancyReporter = class extends BasicReporter {
1832
+ static {
1833
+ __name(this, "FancyReporter");
1834
+ }
1835
+ formatStack(stack, message, opts) {
1836
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
1837
+ return `
1838
+ ${indent}` + parseStack(stack, message).map(
1839
+ (line) => " " + line.replace(/^at +/, (m2) => colors.gray(m2)).replace(/\((.+)\)/, (_3, m2) => `(${colors.cyan(m2)})`)
1840
+ ).join(`
1841
+ ${indent}`);
1842
+ }
1843
+ formatType(logObj, isBadge, opts) {
1844
+ const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
1845
+ if (isBadge) {
1846
+ return getBgColor(typeColor)(
1847
+ colors.black(` ${logObj.type.toUpperCase()} `)
1848
+ );
1849
+ }
1850
+ const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
1851
+ return _type ? getColor2(typeColor)(_type) : "";
1852
+ }
1853
+ formatLogObj(logObj, opts) {
1854
+ const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
1855
+ "\n"
1856
+ );
1857
+ if (logObj.type === "box") {
1858
+ return box(
1859
+ characterFormat(
1860
+ message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
1861
+ ),
1862
+ {
1863
+ title: logObj.title ? characterFormat(logObj.title) : void 0,
1864
+ style: logObj.style
1865
+ }
1866
+ );
1867
+ }
1868
+ const date = this.formatDate(logObj.date, opts);
1869
+ const coloredDate = date && colors.gray(date);
1870
+ const isBadge = logObj.badge ?? logObj.level < 2;
1871
+ const type = this.formatType(logObj, isBadge, opts);
1872
+ const tag = logObj.tag ? colors.gray(logObj.tag) : "";
1873
+ let line;
1874
+ const left = this.filterAndJoin([type, characterFormat(message)]);
1875
+ const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
1876
+ const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
1877
+ line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
1878
+ line += characterFormat(
1879
+ additional.length > 0 ? "\n" + additional.join("\n") : ""
1880
+ );
1881
+ if (logObj.type === "trace") {
1882
+ const _err = new Error("Trace: " + logObj.message);
1883
+ line += this.formatStack(_err.stack || "", _err.message);
1884
+ }
1885
+ return isBadge ? "\n" + line + "\n" : line;
1886
+ }
1887
+ };
1888
+ function characterFormat(str) {
1889
+ return str.replace(/`([^`]+)`/gm, (_3, m2) => colors.cyan(m2)).replace(/\s+_([^_]+)_\s+/gm, (_3, m2) => ` ${colors.underline(m2)} `);
1890
+ }
1891
+ __name(characterFormat, "characterFormat");
1892
+ function getColor2(color = "white") {
1893
+ return colors[color] || colors.white;
1894
+ }
1895
+ __name(getColor2, "getColor");
1896
+ function getBgColor(color = "bgWhite") {
1897
+ return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
1898
+ }
1899
+ __name(getBgColor, "getBgColor");
1900
+ function createConsola2(options = {}) {
1901
+ let level = _getDefaultLogLevel();
1902
+ if (process.env.CONSOLA_LEVEL) {
1903
+ level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
1904
+ }
1905
+ const consola2 = createConsola({
1906
+ level,
1907
+ defaults: { level },
1908
+ stdout: process.stdout,
1909
+ stderr: process.stderr,
1910
+ prompt: /* @__PURE__ */ __name((...args) => Promise.resolve().then(() => (init_prompt(), prompt_exports)).then((m2) => m2.prompt(...args)), "prompt"),
1911
+ reporters: options.reporters || [
1912
+ options.fancy ?? !(T2 || R2) ? new FancyReporter() : new BasicReporter()
1913
+ ],
1914
+ ...options
1915
+ });
1916
+ return consola2;
1917
+ }
1918
+ __name(createConsola2, "createConsola");
1919
+ function _getDefaultLogLevel() {
1920
+ if (g2) {
1921
+ return LogLevels.debug;
1922
+ }
1923
+ if (R2) {
1924
+ return LogLevels.warn;
1925
+ }
1926
+ return LogLevels.info;
1927
+ }
1928
+ __name(_getDefaultLogLevel, "_getDefaultLogLevel");
1929
+ var consola = createConsola2();
1930
+
1931
+ // ../../node_modules/.pnpm/citty@0.1.6/node_modules/citty/dist/index.mjs
1932
+ function toArray(val) {
1933
+ if (Array.isArray(val)) {
1934
+ return val;
1935
+ }
1936
+ return val === void 0 ? [] : [val];
1937
+ }
1938
+ __name(toArray, "toArray");
1939
+ function formatLineColumns(lines, linePrefix = "") {
1940
+ const maxLengh = [];
1941
+ for (const line of lines) {
1942
+ for (const [i2, element] of line.entries()) {
1943
+ maxLengh[i2] = Math.max(maxLengh[i2] || 0, element.length);
1944
+ }
1945
+ }
1946
+ return lines.map(
1947
+ (l2) => l2.map(
1948
+ (c3, i2) => linePrefix + c3[i2 === 0 ? "padStart" : "padEnd"](maxLengh[i2])
1949
+ ).join(" ")
1950
+ ).join("\n");
1951
+ }
1952
+ __name(formatLineColumns, "formatLineColumns");
1953
+ function resolveValue(input) {
1954
+ return typeof input === "function" ? input() : input;
1955
+ }
1956
+ __name(resolveValue, "resolveValue");
1957
+ var CLIError = class extends Error {
1958
+ static {
1959
+ __name(this, "CLIError");
1960
+ }
1961
+ constructor(message, code) {
1962
+ super(message);
1963
+ this.code = code;
1964
+ this.name = "CLIError";
1965
+ }
1966
+ };
1967
+ var NUMBER_CHAR_RE = /\d/;
1968
+ var STR_SPLITTERS = ["-", "_", "/", "."];
1969
+ function isUppercase(char = "") {
1970
+ if (NUMBER_CHAR_RE.test(char)) {
1971
+ return void 0;
1972
+ }
1973
+ return char !== char.toLowerCase();
1974
+ }
1975
+ __name(isUppercase, "isUppercase");
1976
+ function splitByCase(str, separators) {
1977
+ const splitters = separators ?? STR_SPLITTERS;
1978
+ const parts = [];
1979
+ if (!str || typeof str !== "string") {
1980
+ return parts;
1981
+ }
1982
+ let buff = "";
1983
+ let previousUpper;
1984
+ let previousSplitter;
1985
+ for (const char of str) {
1986
+ const isSplitter = splitters.includes(char);
1987
+ if (isSplitter === true) {
1988
+ parts.push(buff);
1989
+ buff = "";
1990
+ previousUpper = void 0;
1991
+ continue;
1992
+ }
1993
+ const isUpper = isUppercase(char);
1994
+ if (previousSplitter === false) {
1995
+ if (previousUpper === false && isUpper === true) {
1996
+ parts.push(buff);
1997
+ buff = char;
1998
+ previousUpper = isUpper;
1999
+ continue;
2000
+ }
2001
+ if (previousUpper === true && isUpper === false && buff.length > 1) {
2002
+ const lastChar = buff.at(-1);
2003
+ parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
2004
+ buff = lastChar + char;
2005
+ previousUpper = isUpper;
2006
+ continue;
2007
+ }
2008
+ }
2009
+ buff += char;
2010
+ previousUpper = isUpper;
2011
+ previousSplitter = isSplitter;
2012
+ }
2013
+ parts.push(buff);
2014
+ return parts;
2015
+ }
2016
+ __name(splitByCase, "splitByCase");
2017
+ function upperFirst(str) {
2018
+ return str ? str[0].toUpperCase() + str.slice(1) : "";
2019
+ }
2020
+ __name(upperFirst, "upperFirst");
2021
+ function lowerFirst(str) {
2022
+ return str ? str[0].toLowerCase() + str.slice(1) : "";
2023
+ }
2024
+ __name(lowerFirst, "lowerFirst");
2025
+ function pascalCase(str, opts) {
2026
+ return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
2027
+ }
2028
+ __name(pascalCase, "pascalCase");
2029
+ function camelCase(str, opts) {
2030
+ return lowerFirst(pascalCase(str || "", opts));
2031
+ }
2032
+ __name(camelCase, "camelCase");
2033
+ function kebabCase(str, joiner) {
2034
+ return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
2035
+ }
2036
+ __name(kebabCase, "kebabCase");
2037
+ function toArr(any) {
2038
+ return any == void 0 ? [] : Array.isArray(any) ? any : [any];
2039
+ }
2040
+ __name(toArr, "toArr");
2041
+ function toVal(out, key, val, opts) {
2042
+ let x2;
2043
+ const old = out[key];
2044
+ const nxt = ~opts.string.indexOf(key) ? val == void 0 || val === true ? "" : String(val) : typeof val === "boolean" ? val : ~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x2 = +val, x2 * 0 === 0) ? x2 : val), !!val) : (x2 = +val, x2 * 0 === 0) ? x2 : val;
2045
+ out[key] = old == void 0 ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
2046
+ }
2047
+ __name(toVal, "toVal");
2048
+ function parseRawArgs(args = [], opts = {}) {
2049
+ let k2;
2050
+ let arr;
2051
+ let arg;
2052
+ let name;
2053
+ let val;
2054
+ const out = { _: [] };
2055
+ let i2 = 0;
2056
+ let j = 0;
2057
+ let idx = 0;
2058
+ const len = args.length;
2059
+ const alibi = opts.alias !== void 0;
2060
+ const strict = opts.unknown !== void 0;
2061
+ const defaults = opts.default !== void 0;
2062
+ opts.alias = opts.alias || {};
2063
+ opts.string = toArr(opts.string);
2064
+ opts.boolean = toArr(opts.boolean);
2065
+ if (alibi) {
2066
+ for (k2 in opts.alias) {
2067
+ arr = opts.alias[k2] = toArr(opts.alias[k2]);
2068
+ for (i2 = 0; i2 < arr.length; i2++) {
2069
+ (opts.alias[arr[i2]] = arr.concat(k2)).splice(i2, 1);
2070
+ }
2071
+ }
2072
+ }
2073
+ for (i2 = opts.boolean.length; i2-- > 0; ) {
2074
+ arr = opts.alias[opts.boolean[i2]] || [];
2075
+ for (j = arr.length; j-- > 0; ) {
2076
+ opts.boolean.push(arr[j]);
2077
+ }
2078
+ }
2079
+ for (i2 = opts.string.length; i2-- > 0; ) {
2080
+ arr = opts.alias[opts.string[i2]] || [];
2081
+ for (j = arr.length; j-- > 0; ) {
2082
+ opts.string.push(arr[j]);
2083
+ }
2084
+ }
2085
+ if (defaults) {
2086
+ for (k2 in opts.default) {
2087
+ name = typeof opts.default[k2];
2088
+ arr = opts.alias[k2] = opts.alias[k2] || [];
2089
+ if (opts[name] !== void 0) {
2090
+ opts[name].push(k2);
2091
+ for (i2 = 0; i2 < arr.length; i2++) {
2092
+ opts[name].push(arr[i2]);
2093
+ }
2094
+ }
2095
+ }
2096
+ }
2097
+ const keys = strict ? Object.keys(opts.alias) : [];
2098
+ for (i2 = 0; i2 < len; i2++) {
2099
+ arg = args[i2];
2100
+ if (arg === "--") {
2101
+ out._ = out._.concat(args.slice(++i2));
2102
+ break;
2103
+ }
2104
+ for (j = 0; j < arg.length; j++) {
2105
+ if (arg.charCodeAt(j) !== 45) {
2106
+ break;
2107
+ }
2108
+ }
2109
+ if (j === 0) {
2110
+ out._.push(arg);
2111
+ } else if (arg.substring(j, j + 3) === "no-") {
2112
+ name = arg.slice(Math.max(0, j + 3));
2113
+ if (strict && !~keys.indexOf(name)) {
2114
+ return opts.unknown(arg);
2115
+ }
2116
+ out[name] = false;
2117
+ } else {
2118
+ for (idx = j + 1; idx < arg.length; idx++) {
2119
+ if (arg.charCodeAt(idx) === 61) {
2120
+ break;
2121
+ }
2122
+ }
2123
+ name = arg.substring(j, idx);
2124
+ val = arg.slice(Math.max(0, ++idx)) || i2 + 1 === len || ("" + args[i2 + 1]).charCodeAt(0) === 45 || args[++i2];
2125
+ arr = j === 2 ? [name] : name;
2126
+ for (idx = 0; idx < arr.length; idx++) {
2127
+ name = arr[idx];
2128
+ if (strict && !~keys.indexOf(name)) {
2129
+ return opts.unknown("-".repeat(j) + name);
2130
+ }
2131
+ toVal(out, name, idx + 1 < arr.length || val, opts);
2132
+ }
2133
+ }
2134
+ }
2135
+ if (defaults) {
2136
+ for (k2 in opts.default) {
2137
+ if (out[k2] === void 0) {
2138
+ out[k2] = opts.default[k2];
2139
+ }
2140
+ }
2141
+ }
2142
+ if (alibi) {
2143
+ for (k2 in out) {
2144
+ arr = opts.alias[k2] || [];
2145
+ while (arr.length > 0) {
2146
+ out[arr.shift()] = out[k2];
2147
+ }
2148
+ }
2149
+ }
2150
+ return out;
2151
+ }
2152
+ __name(parseRawArgs, "parseRawArgs");
2153
+ function parseArgs(rawArgs, argsDef) {
2154
+ const parseOptions = {
2155
+ boolean: [],
2156
+ string: [],
2157
+ mixed: [],
2158
+ alias: {},
2159
+ default: {}
2160
+ };
2161
+ const args = resolveArgs(argsDef);
2162
+ for (const arg of args) {
2163
+ if (arg.type === "positional") {
2164
+ continue;
2165
+ }
2166
+ if (arg.type === "string") {
2167
+ parseOptions.string.push(arg.name);
2168
+ } else if (arg.type === "boolean") {
2169
+ parseOptions.boolean.push(arg.name);
2170
+ }
2171
+ if (arg.default !== void 0) {
2172
+ parseOptions.default[arg.name] = arg.default;
2173
+ }
2174
+ if (arg.alias) {
2175
+ parseOptions.alias[arg.name] = arg.alias;
2176
+ }
2177
+ }
2178
+ const parsed = parseRawArgs(rawArgs, parseOptions);
2179
+ const [...positionalArguments] = parsed._;
2180
+ const parsedArgsProxy = new Proxy(parsed, {
2181
+ get(target, prop) {
2182
+ return target[prop] ?? target[camelCase(prop)] ?? target[kebabCase(prop)];
2183
+ }
2184
+ });
2185
+ for (const [, arg] of args.entries()) {
2186
+ if (arg.type === "positional") {
2187
+ const nextPositionalArgument = positionalArguments.shift();
2188
+ if (nextPositionalArgument !== void 0) {
2189
+ parsedArgsProxy[arg.name] = nextPositionalArgument;
2190
+ } else if (arg.default === void 0 && arg.required !== false) {
2191
+ throw new CLIError(
2192
+ `Missing required positional argument: ${arg.name.toUpperCase()}`,
2193
+ "EARG"
2194
+ );
2195
+ } else {
2196
+ parsedArgsProxy[arg.name] = arg.default;
2197
+ }
2198
+ } else if (arg.required && parsedArgsProxy[arg.name] === void 0) {
2199
+ throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");
2200
+ }
2201
+ }
2202
+ return parsedArgsProxy;
2203
+ }
2204
+ __name(parseArgs, "parseArgs");
2205
+ function resolveArgs(argsDef) {
2206
+ const args = [];
2207
+ for (const [name, argDef] of Object.entries(argsDef || {})) {
2208
+ args.push({
2209
+ ...argDef,
2210
+ name,
2211
+ alias: toArray(argDef.alias)
2212
+ });
2213
+ }
2214
+ return args;
2215
+ }
2216
+ __name(resolveArgs, "resolveArgs");
2217
+ function defineCommand(def) {
2218
+ return def;
2219
+ }
2220
+ __name(defineCommand, "defineCommand");
2221
+ async function runCommand(cmd, opts) {
2222
+ const cmdArgs = await resolveValue(cmd.args || {});
2223
+ const parsedArgs = parseArgs(opts.rawArgs, cmdArgs);
2224
+ const context = {
2225
+ rawArgs: opts.rawArgs,
2226
+ args: parsedArgs,
2227
+ data: opts.data,
2228
+ cmd
2229
+ };
2230
+ if (typeof cmd.setup === "function") {
2231
+ await cmd.setup(context);
2232
+ }
2233
+ let result;
2234
+ try {
2235
+ const subCommands = await resolveValue(cmd.subCommands);
2236
+ if (subCommands && Object.keys(subCommands).length > 0) {
2237
+ const subCommandArgIndex = opts.rawArgs.findIndex(
2238
+ (arg) => !arg.startsWith("-")
2239
+ );
2240
+ const subCommandName = opts.rawArgs[subCommandArgIndex];
2241
+ if (subCommandName) {
2242
+ if (!subCommands[subCommandName]) {
2243
+ throw new CLIError(
2244
+ `Unknown command \`${subCommandName}\``,
2245
+ "E_UNKNOWN_COMMAND"
2246
+ );
2247
+ }
2248
+ const subCommand = await resolveValue(subCommands[subCommandName]);
2249
+ if (subCommand) {
2250
+ await runCommand(subCommand, {
2251
+ rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1)
2252
+ });
2253
+ }
2254
+ } else if (!cmd.run) {
2255
+ throw new CLIError(`No command specified.`, "E_NO_COMMAND");
2256
+ }
2257
+ }
2258
+ if (typeof cmd.run === "function") {
2259
+ result = await cmd.run(context);
2260
+ }
2261
+ } finally {
2262
+ if (typeof cmd.cleanup === "function") {
2263
+ await cmd.cleanup(context);
2264
+ }
2265
+ }
2266
+ return { result };
2267
+ }
2268
+ __name(runCommand, "runCommand");
2269
+ async function resolveSubCommand(cmd, rawArgs, parent) {
2270
+ const subCommands = await resolveValue(cmd.subCommands);
2271
+ if (subCommands && Object.keys(subCommands).length > 0) {
2272
+ const subCommandArgIndex = rawArgs.findIndex((arg) => !arg.startsWith("-"));
2273
+ const subCommandName = rawArgs[subCommandArgIndex];
2274
+ const subCommand = await resolveValue(subCommands[subCommandName]);
2275
+ if (subCommand) {
2276
+ return resolveSubCommand(
2277
+ subCommand,
2278
+ rawArgs.slice(subCommandArgIndex + 1),
2279
+ cmd
2280
+ );
2281
+ }
2282
+ }
2283
+ return [cmd, parent];
2284
+ }
2285
+ __name(resolveSubCommand, "resolveSubCommand");
2286
+ async function showUsage(cmd, parent) {
2287
+ try {
2288
+ consola.log(await renderUsage(cmd, parent) + "\n");
2289
+ } catch (error) {
2290
+ consola.error(error);
2291
+ }
2292
+ }
2293
+ __name(showUsage, "showUsage");
2294
+ async function renderUsage(cmd, parent) {
2295
+ const cmdMeta = await resolveValue(cmd.meta || {});
2296
+ const cmdArgs = resolveArgs(await resolveValue(cmd.args || {}));
2297
+ const parentMeta = await resolveValue(parent?.meta || {});
2298
+ const commandName = `${parentMeta.name ? `${parentMeta.name} ` : ""}` + (cmdMeta.name || process.argv[1]);
2299
+ const argLines = [];
2300
+ const posLines = [];
2301
+ const commandsLines = [];
2302
+ const usageLine = [];
2303
+ for (const arg of cmdArgs) {
2304
+ if (arg.type === "positional") {
2305
+ const name = arg.name.toUpperCase();
2306
+ const isRequired = arg.required !== false && arg.default === void 0;
2307
+ const defaultHint = arg.default ? `="${arg.default}"` : "";
2308
+ posLines.push([
2309
+ "`" + name + defaultHint + "`",
2310
+ arg.description || "",
2311
+ arg.valueHint ? `<${arg.valueHint}>` : ""
2312
+ ]);
2313
+ usageLine.push(isRequired ? `<${name}>` : `[${name}]`);
2314
+ } else {
2315
+ const isRequired = arg.required === true && arg.default === void 0;
2316
+ const argStr = (arg.type === "boolean" && arg.default === true ? [
2317
+ ...(arg.alias || []).map((a2) => `--no-${a2}`),
2318
+ `--no-${arg.name}`
2319
+ ].join(", ") : [...(arg.alias || []).map((a2) => `-${a2}`), `--${arg.name}`].join(
2320
+ ", "
2321
+ )) + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "");
2322
+ argLines.push([
2323
+ "`" + argStr + (isRequired ? " (required)" : "") + "`",
2324
+ arg.description || ""
2325
+ ]);
2326
+ if (isRequired) {
2327
+ usageLine.push(argStr);
2328
+ }
2329
+ }
2330
+ }
2331
+ if (cmd.subCommands) {
2332
+ const commandNames = [];
2333
+ const subCommands = await resolveValue(cmd.subCommands);
2334
+ for (const [name, sub] of Object.entries(subCommands)) {
2335
+ const subCmd = await resolveValue(sub);
2336
+ const meta = await resolveValue(subCmd?.meta);
2337
+ commandsLines.push([`\`${name}\``, meta?.description || ""]);
2338
+ commandNames.push(name);
2339
+ }
2340
+ usageLine.push(commandNames.join("|"));
2341
+ }
2342
+ const usageLines = [];
2343
+ const version = cmdMeta.version || parentMeta.version;
2344
+ usageLines.push(
2345
+ colors.gray(
2346
+ `${cmdMeta.description} (${commandName + (version ? ` v${version}` : "")})`
2347
+ ),
2348
+ ""
2349
+ );
2350
+ const hasOptions = argLines.length > 0 || posLines.length > 0;
2351
+ usageLines.push(
2352
+ `${colors.underline(colors.bold("USAGE"))} \`${commandName}${hasOptions ? " [OPTIONS]" : ""} ${usageLine.join(" ")}\``,
2353
+ ""
2354
+ );
2355
+ if (posLines.length > 0) {
2356
+ usageLines.push(colors.underline(colors.bold("ARGUMENTS")), "");
2357
+ usageLines.push(formatLineColumns(posLines, " "));
2358
+ usageLines.push("");
2359
+ }
2360
+ if (argLines.length > 0) {
2361
+ usageLines.push(colors.underline(colors.bold("OPTIONS")), "");
2362
+ usageLines.push(formatLineColumns(argLines, " "));
2363
+ usageLines.push("");
2364
+ }
2365
+ if (commandsLines.length > 0) {
2366
+ usageLines.push(colors.underline(colors.bold("COMMANDS")), "");
2367
+ usageLines.push(formatLineColumns(commandsLines, " "));
2368
+ usageLines.push(
2369
+ "",
2370
+ `Use \`${commandName} <command> --help\` for more information about a command.`
2371
+ );
2372
+ }
2373
+ return usageLines.filter((l2) => typeof l2 === "string").join("\n");
2374
+ }
2375
+ __name(renderUsage, "renderUsage");
2376
+ async function runMain(cmd, opts = {}) {
2377
+ const rawArgs = opts.rawArgs || process.argv.slice(2);
2378
+ const showUsage$1 = opts.showUsage || showUsage;
2379
+ try {
2380
+ if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
2381
+ await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
2382
+ process.exit(0);
2383
+ } else if (rawArgs.length === 1 && rawArgs[0] === "--version") {
2384
+ const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
2385
+ if (!meta?.version) {
2386
+ throw new CLIError("No version specified", "E_NO_VERSION");
2387
+ }
2388
+ consola.log(meta.version);
2389
+ } else {
2390
+ await runCommand(cmd, { rawArgs });
2391
+ }
2392
+ } catch (error) {
2393
+ const isCLIError = error instanceof CLIError;
2394
+ if (!isCLIError) {
2395
+ consola.error(error, "\n");
2396
+ }
2397
+ if (isCLIError) {
2398
+ await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
2399
+ }
2400
+ consola.error(error.message);
2401
+ process.exit(1);
2402
+ }
2403
+ }
2404
+ __name(runMain, "runMain");
2405
+
2406
+ // src/cli/init.ts
2407
+ var __filename$1 = fileURLToPath(import.meta.url);
2408
+ var __dirname$1 = dirname(__filename$1);
2409
+ var main = defineCommand({
2410
+ meta: {
2411
+ name: "nestjs-ssr",
2412
+ description: "Initialize @nestjs-ssr/react in your NestJS project",
2413
+ version: "0.1.6"
2414
+ },
2415
+ args: {
2416
+ force: {
2417
+ type: "boolean",
2418
+ description: "Overwrite existing files",
2419
+ alias: "f"
2420
+ },
2421
+ views: {
2422
+ type: "string",
2423
+ description: "Views directory path",
2424
+ default: "src/views"
2425
+ },
2426
+ "skip-install": {
2427
+ type: "boolean",
2428
+ description: "Skip automatic dependency installation",
2429
+ default: false
2430
+ }
2431
+ },
2432
+ async run({ args }) {
2433
+ const cwd = process.cwd();
2434
+ const viewsDir = args.views;
2435
+ consola.box("@nestjs-ssr/react initialization");
2436
+ consola.start("Setting up your NestJS SSR React project...\n");
2437
+ const templateLocations = [
2438
+ resolve(__dirname$1, "../../src/templates"),
2439
+ resolve(__dirname$1, "../templates")
2440
+ ];
2441
+ const templateDir = templateLocations.find((loc) => existsSync(join(loc, "entry-client.tsx")));
2442
+ if (!templateDir) {
2443
+ consola.error("Failed to locate template files");
2444
+ consola.info("Searched:", templateLocations);
2445
+ process.exit(1);
2446
+ }
2447
+ const globalTypesLocations = [
2448
+ resolve(__dirname$1, "../../src/global.d.ts"),
2449
+ resolve(__dirname$1, "../global.d.ts")
2450
+ ];
2451
+ const globalTypesSrc = globalTypesLocations.find((loc) => existsSync(loc));
2452
+ if (!globalTypesSrc) {
2453
+ consola.error("Failed to locate global.d.ts");
2454
+ consola.info("Searched:", globalTypesLocations);
2455
+ process.exit(1);
2456
+ }
2457
+ const tsconfigPath = join(cwd, "tsconfig.json");
2458
+ if (!existsSync(tsconfigPath)) {
2459
+ consola.error("No tsconfig.json found in project root");
2460
+ consola.info("Please create a tsconfig.json file first");
2461
+ process.exit(1);
2462
+ }
2463
+ consola.start("Creating entry-client.tsx...");
2464
+ const entryClientSrc = join(templateDir, "entry-client.tsx");
2465
+ const entryClientDest = join(cwd, viewsDir, "entry-client.tsx");
2466
+ mkdirSync(join(cwd, viewsDir), {
2467
+ recursive: true
2468
+ });
2469
+ if (existsSync(entryClientDest) && !args.force) {
2470
+ consola.warn(`${viewsDir}/entry-client.tsx already exists (use --force to overwrite)`);
2471
+ } else {
2472
+ copyFileSync(entryClientSrc, entryClientDest);
2473
+ consola.success(`Created ${viewsDir}/entry-client.tsx`);
2474
+ }
2475
+ consola.start("Creating entry-server.tsx...");
2476
+ const entryServerSrc = join(templateDir, "entry-server.tsx");
2477
+ const entryServerDest = join(cwd, viewsDir, "entry-server.tsx");
2478
+ if (existsSync(entryServerDest) && !args.force) {
2479
+ consola.warn(`${viewsDir}/entry-server.tsx already exists (use --force to overwrite)`);
2480
+ } else {
2481
+ copyFileSync(entryServerSrc, entryServerDest);
2482
+ consola.success(`Created ${viewsDir}/entry-server.tsx`);
2483
+ }
2484
+ consola.start("Creating global.d.ts...");
2485
+ const globalTypesDest = join(cwd, "src/global.d.ts");
2486
+ if (existsSync(globalTypesDest) && !args.force) {
2487
+ consola.warn("src/global.d.ts already exists (use --force to overwrite)");
2488
+ } else {
2489
+ copyFileSync(globalTypesSrc, globalTypesDest);
2490
+ consola.success("Created src/global.d.ts");
2491
+ }
2492
+ consola.start("Configuring vite.config.js...");
2493
+ const viteConfigPath = join(cwd, "vite.config.js");
2494
+ const viteConfigTs = join(cwd, "vite.config.ts");
2495
+ const useTypeScript = existsSync(viteConfigTs);
2496
+ const configPath = useTypeScript ? viteConfigTs : viteConfigPath;
2497
+ if (existsSync(configPath)) {
2498
+ consola.warn(`${useTypeScript ? "vite.config.ts" : "vite.config.js"} already exists`);
2499
+ consola.info("Please manually add to your Vite config:");
2500
+ consola.log(" import { resolve } from 'path';");
2501
+ consola.log(" build: {");
2502
+ consola.log(" rollupOptions: {");
2503
+ consola.log(` input: { client: resolve(__dirname, '${viewsDir}/entry-client.tsx') }`);
2504
+ consola.log(" }");
2505
+ consola.log(" }");
2506
+ } else {
2507
+ const viteConfig = `import { defineConfig } from 'vite';
2508
+ import react from '@vitejs/plugin-react';
2509
+ import { resolve } from 'path';
2510
+
2511
+ export default defineConfig({
2512
+ plugins: [react()],
2513
+ resolve: {
2514
+ alias: {
2515
+ '@': resolve(__dirname, 'src'),
2516
+ },
2517
+ },
2518
+ server: {
2519
+ port: 5173,
2520
+ strictPort: true,
2521
+ hmr: { port: 5173 },
2522
+ },
2523
+ build: {
2524
+ outDir: 'dist/client',
2525
+ manifest: true,
2526
+ rollupOptions: {
2527
+ input: {
2528
+ client: resolve(__dirname, '${viewsDir}/entry-client.tsx'),
2529
+ },
2530
+ },
2531
+ },
2532
+ });
2533
+ `;
2534
+ writeFileSync(viteConfigPath, viteConfig);
2535
+ consola.success("Created vite.config.js");
2536
+ }
2537
+ consola.start("Configuring tsconfig.json...");
2538
+ try {
2539
+ const tsconfig = JSON.parse(readFileSync(tsconfigPath, "utf-8"));
2540
+ let updated = false;
2541
+ if (!tsconfig.compilerOptions) {
2542
+ tsconfig.compilerOptions = {};
2543
+ }
2544
+ if (tsconfig.compilerOptions.jsx !== "react-jsx") {
2545
+ tsconfig.compilerOptions.jsx = "react-jsx";
2546
+ updated = true;
2547
+ }
2548
+ if (!tsconfig.compilerOptions.paths) {
2549
+ tsconfig.compilerOptions.paths = {};
2550
+ }
2551
+ if (!tsconfig.compilerOptions.paths["@/*"]) {
2552
+ tsconfig.compilerOptions.paths["@/*"] = [
2553
+ "./src/*"
2554
+ ];
2555
+ updated = true;
2556
+ }
2557
+ if (!tsconfig.compilerOptions.types) {
2558
+ tsconfig.compilerOptions.types = [];
2559
+ }
2560
+ if (!tsconfig.compilerOptions.types.includes("vite/client")) {
2561
+ tsconfig.compilerOptions.types.push("vite/client");
2562
+ updated = true;
2563
+ }
2564
+ if (updated) {
2565
+ writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2));
2566
+ consola.success("Updated tsconfig.json");
2567
+ } else {
2568
+ consola.info("tsconfig.json already configured");
2569
+ }
2570
+ } catch (error) {
2571
+ consola.error("Failed to update tsconfig.json:", error);
2572
+ }
2573
+ consola.start("Configuring build scripts...");
2574
+ const packageJsonPath = join(cwd, "package.json");
2575
+ if (!existsSync(packageJsonPath)) {
2576
+ consola.warn("No package.json found, skipping build script setup");
2577
+ } else {
2578
+ try {
2579
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
2580
+ if (!packageJson.scripts) {
2581
+ packageJson.scripts = {};
2582
+ }
2583
+ const existingBuild = packageJson.scripts.build;
2584
+ const defaultNestBuild = "nest build";
2585
+ const ssrBuildPrefix = "vite build && ";
2586
+ let shouldUpdate = false;
2587
+ let newBuildScript = "";
2588
+ if (!existingBuild) {
2589
+ newBuildScript = `${ssrBuildPrefix}${defaultNestBuild}`;
2590
+ shouldUpdate = true;
2591
+ } else if (existingBuild.includes("vite build")) {
2592
+ consola.info("Build script already includes vite build");
2593
+ } else if (existingBuild === defaultNestBuild) {
2594
+ newBuildScript = `${ssrBuildPrefix}${existingBuild}`;
2595
+ shouldUpdate = true;
2596
+ } else {
2597
+ consola.warn(`Found custom build script: "${existingBuild}"`);
2598
+ consola.info('SSR requires running "vite build" before your build command');
2599
+ consola.info(`Recommended: ${ssrBuildPrefix}${existingBuild}`);
2600
+ consola.info("Please manually update your build script in package.json");
2601
+ }
2602
+ if (shouldUpdate) {
2603
+ packageJson.scripts.build = newBuildScript;
2604
+ writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
2605
+ consola.success(`Updated build script to: "${newBuildScript}"`);
2606
+ }
2607
+ if (!args["skip-install"]) {
2608
+ consola.start("Checking dependencies...");
2609
+ const requiredDeps = {
2610
+ "react": "^19.0.0",
2611
+ "react-dom": "^19.0.0",
2612
+ "vite": "^7.0.0",
2613
+ "@vitejs/plugin-react": "^4.0.0"
2614
+ };
2615
+ const missingDeps = [];
2616
+ const allDeps = {
2617
+ ...packageJson.dependencies,
2618
+ ...packageJson.devDependencies
2619
+ };
2620
+ for (const [dep, version] of Object.entries(requiredDeps)) {
2621
+ if (!allDeps[dep]) {
2622
+ missingDeps.push(`${dep}@${version}`);
2623
+ }
2624
+ }
2625
+ if (missingDeps.length > 0) {
2626
+ consola.info(`Missing dependencies: ${missingDeps.join(", ")}`);
2627
+ let packageManager = "npm";
2628
+ if (existsSync(join(cwd, "pnpm-lock.yaml"))) packageManager = "pnpm";
2629
+ else if (existsSync(join(cwd, "yarn.lock"))) packageManager = "yarn";
2630
+ const installCmd = packageManager === "npm" ? `npm install ${missingDeps.join(" ")}` : `${packageManager} add ${missingDeps.join(" ")}`;
2631
+ try {
2632
+ consola.start(`Installing dependencies with ${packageManager}...`);
2633
+ execSync(installCmd, {
2634
+ cwd,
2635
+ stdio: "inherit"
2636
+ });
2637
+ consola.success("Dependencies installed!");
2638
+ } catch (error) {
2639
+ consola.error("Failed to install dependencies:", error);
2640
+ consola.info(`Please manually run: ${installCmd}`);
2641
+ }
2642
+ } else {
2643
+ consola.success("All required dependencies are already installed");
2644
+ }
2645
+ }
2646
+ } catch (error) {
2647
+ consola.error("Failed to update package.json:", error);
2648
+ }
2649
+ }
2650
+ consola.success("\nInitialization complete!");
2651
+ consola.box("Next steps");
2652
+ consola.info(`1. Create your first view component in ${viewsDir}/`);
2653
+ consola.info("2. Render it from a NestJS controller using render.render()");
2654
+ consola.info("3. Run your dev server with: pnpm start:dev");
2655
+ }
2656
+ });
2657
+ runMain(main);
2658
+ //# sourceMappingURL=init.mjs.map
2659
+ //# sourceMappingURL=init.mjs.map