@nestjs-ssr/react 0.1.8 → 0.1.10

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.
package/dist/cli/init.js CHANGED
@@ -1,2437 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var util = require('util');
5
- var g = require('process');
6
- var f = require('readline');
7
- var tty = require('tty');
8
4
  var fs = require('fs');
9
5
  var path = require('path');
10
6
  var url = require('url');
7
+ var child_process = require('child_process');
8
+ var consola = require('consola');
9
+ var citty = require('citty');
11
10
 
12
11
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
13
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
-
15
- function _interopNamespace(e) {
16
- if (e && e.__esModule) return e;
17
- var n = Object.create(null);
18
- if (e) {
19
- Object.keys(e).forEach(function (k) {
20
- if (k !== 'default') {
21
- var d = Object.getOwnPropertyDescriptor(e, k);
22
- Object.defineProperty(n, k, d.get ? d : {
23
- enumerable: true,
24
- get: function () { return e[k]; }
25
- });
26
- }
27
- });
28
- }
29
- n.default = e;
30
- return Object.freeze(n);
31
- }
32
-
33
- var g__default = /*#__PURE__*/_interopDefault(g);
34
- var f__default = /*#__PURE__*/_interopDefault(f);
35
- var tty__namespace = /*#__PURE__*/_interopNamespace(tty);
36
-
37
- var __defProp = Object.defineProperty;
38
- var __getOwnPropNames = Object.getOwnPropertyNames;
39
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
40
- var __esm = (fn, res) => function __init() {
41
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
42
- };
43
- var __export = (target, all) => {
44
- for (var name in all)
45
- __defProp(target, name, { get: all[name], enumerable: true });
46
- };
47
-
48
- // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs
49
- var prompt_exports = {};
50
- __export(prompt_exports, {
51
- kCancel: () => kCancel,
52
- prompt: () => prompt
53
- });
54
- function getDefaultExportFromCjs(x2) {
55
- return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
56
- }
57
- function requireSrc() {
58
- if (hasRequiredSrc) return src;
59
- hasRequiredSrc = 1;
60
- const ESC = "\x1B";
61
- const CSI = `${ESC}[`;
62
- const beep = "\x07";
63
- const cursor = {
64
- to(x2, y3) {
65
- if (!y3) return `${CSI}${x2 + 1}G`;
66
- return `${CSI}${y3 + 1};${x2 + 1}H`;
67
- },
68
- move(x2, y3) {
69
- let ret = "";
70
- if (x2 < 0) ret += `${CSI}${-x2}D`;
71
- else if (x2 > 0) ret += `${CSI}${x2}C`;
72
- if (y3 < 0) ret += `${CSI}${-y3}A`;
73
- else if (y3 > 0) ret += `${CSI}${y3}B`;
74
- return ret;
75
- },
76
- up: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}A`, "up"),
77
- down: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}B`, "down"),
78
- forward: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}C`, "forward"),
79
- backward: /* @__PURE__ */ __name((count = 1) => `${CSI}${count}D`, "backward"),
80
- nextLine: /* @__PURE__ */ __name((count = 1) => `${CSI}E`.repeat(count), "nextLine"),
81
- prevLine: /* @__PURE__ */ __name((count = 1) => `${CSI}F`.repeat(count), "prevLine"),
82
- left: `${CSI}G`,
83
- hide: `${CSI}?25l`,
84
- show: `${CSI}?25h`,
85
- save: `${ESC}7`,
86
- restore: `${ESC}8`
87
- };
88
- const scroll = {
89
- up: /* @__PURE__ */ __name((count = 1) => `${CSI}S`.repeat(count), "up"),
90
- down: /* @__PURE__ */ __name((count = 1) => `${CSI}T`.repeat(count), "down")
91
- };
92
- const erase = {
93
- screen: `${CSI}2J`,
94
- up: /* @__PURE__ */ __name((count = 1) => `${CSI}1J`.repeat(count), "up"),
95
- down: /* @__PURE__ */ __name((count = 1) => `${CSI}J`.repeat(count), "down"),
96
- line: `${CSI}2K`,
97
- lineEnd: `${CSI}K`,
98
- lineStart: `${CSI}1K`,
99
- lines(count) {
100
- let clear = "";
101
- for (let i2 = 0; i2 < count; i2++)
102
- clear += this.line + (i2 < count - 1 ? cursor.up() : "");
103
- if (count)
104
- clear += cursor.left;
105
- return clear;
106
- }
107
- };
108
- src = { cursor, scroll, erase, beep };
109
- return src;
110
- }
111
- function requirePicocolors() {
112
- if (hasRequiredPicocolors) return picocolors.exports;
113
- hasRequiredPicocolors = 1;
114
- let p = process || {}, argv2 = p.argv || [], env2 = p.env || {};
115
- 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);
116
- let formatter = /* @__PURE__ */ __name((open, close, replace = open) => (input) => {
117
- let string = "" + input, index = string.indexOf(close, open.length);
118
- return ~index ? open + replaceClose2(string, close, replace, index) + close : open + string + close;
119
- }, "formatter");
120
- let replaceClose2 = /* @__PURE__ */ __name((string, close, replace, index) => {
121
- let result = "", cursor = 0;
122
- do {
123
- result += string.substring(cursor, index) + replace;
124
- cursor = index + close.length;
125
- index = string.indexOf(close, cursor);
126
- } while (~index);
127
- return result + string.substring(cursor);
128
- }, "replaceClose");
129
- let createColors2 = /* @__PURE__ */ __name((enabled = isColorSupported2) => {
130
- let f3 = enabled ? formatter : () => String;
131
- return {
132
- isColorSupported: enabled,
133
- reset: f3("\x1B[0m", "\x1B[0m"),
134
- bold: f3("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
135
- dim: f3("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
136
- italic: f3("\x1B[3m", "\x1B[23m"),
137
- underline: f3("\x1B[4m", "\x1B[24m"),
138
- inverse: f3("\x1B[7m", "\x1B[27m"),
139
- hidden: f3("\x1B[8m", "\x1B[28m"),
140
- strikethrough: f3("\x1B[9m", "\x1B[29m"),
141
- black: f3("\x1B[30m", "\x1B[39m"),
142
- red: f3("\x1B[31m", "\x1B[39m"),
143
- green: f3("\x1B[32m", "\x1B[39m"),
144
- yellow: f3("\x1B[33m", "\x1B[39m"),
145
- blue: f3("\x1B[34m", "\x1B[39m"),
146
- magenta: f3("\x1B[35m", "\x1B[39m"),
147
- cyan: f3("\x1B[36m", "\x1B[39m"),
148
- white: f3("\x1B[37m", "\x1B[39m"),
149
- gray: f3("\x1B[90m", "\x1B[39m"),
150
- bgBlack: f3("\x1B[40m", "\x1B[49m"),
151
- bgRed: f3("\x1B[41m", "\x1B[49m"),
152
- bgGreen: f3("\x1B[42m", "\x1B[49m"),
153
- bgYellow: f3("\x1B[43m", "\x1B[49m"),
154
- bgBlue: f3("\x1B[44m", "\x1B[49m"),
155
- bgMagenta: f3("\x1B[45m", "\x1B[49m"),
156
- bgCyan: f3("\x1B[46m", "\x1B[49m"),
157
- bgWhite: f3("\x1B[47m", "\x1B[49m"),
158
- blackBright: f3("\x1B[90m", "\x1B[39m"),
159
- redBright: f3("\x1B[91m", "\x1B[39m"),
160
- greenBright: f3("\x1B[92m", "\x1B[39m"),
161
- yellowBright: f3("\x1B[93m", "\x1B[39m"),
162
- blueBright: f3("\x1B[94m", "\x1B[39m"),
163
- magentaBright: f3("\x1B[95m", "\x1B[39m"),
164
- cyanBright: f3("\x1B[96m", "\x1B[39m"),
165
- whiteBright: f3("\x1B[97m", "\x1B[39m"),
166
- bgBlackBright: f3("\x1B[100m", "\x1B[49m"),
167
- bgRedBright: f3("\x1B[101m", "\x1B[49m"),
168
- bgGreenBright: f3("\x1B[102m", "\x1B[49m"),
169
- bgYellowBright: f3("\x1B[103m", "\x1B[49m"),
170
- bgBlueBright: f3("\x1B[104m", "\x1B[49m"),
171
- bgMagentaBright: f3("\x1B[105m", "\x1B[49m"),
172
- bgCyanBright: f3("\x1B[106m", "\x1B[49m"),
173
- bgWhiteBright: f3("\x1B[107m", "\x1B[49m")
174
- };
175
- }, "createColors");
176
- picocolors.exports = createColors2();
177
- picocolors.exports.createColors = createColors2;
178
- return picocolors.exports;
179
- }
180
- function J({ onlyFirst: t2 = false } = {}) {
181
- 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("|");
182
- return new RegExp(F3, t2 ? void 0 : "g");
183
- }
184
- function T$1(t2) {
185
- if (typeof t2 != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof t2}\``);
186
- return t2.replace(Q, "");
187
- }
188
- function O(t2) {
189
- return t2 && t2.__esModule && Object.prototype.hasOwnProperty.call(t2, "default") ? t2.default : t2;
190
- }
191
- function A$1(t2, u3 = {}) {
192
- if (typeof t2 != "string" || t2.length === 0 || (u3 = { ambiguousIsNarrow: true, ...u3 }, t2 = T$1(t2), t2.length === 0)) return 0;
193
- t2 = t2.replace(FD(), " ");
194
- const F3 = u3.ambiguousIsNarrow ? 1 : 2;
195
- let e2 = 0;
196
- for (const s2 of t2) {
197
- const i2 = s2.codePointAt(0);
198
- if (i2 <= 31 || i2 >= 127 && i2 <= 159 || i2 >= 768 && i2 <= 879) continue;
199
- switch (DD.eastAsianWidth(s2)) {
200
- case "F":
201
- case "W":
202
- e2 += 2;
203
- break;
204
- case "A":
205
- e2 += F3;
206
- break;
207
- default:
208
- e2 += 1;
209
- }
210
- }
211
- return e2;
212
- }
213
- function sD() {
214
- const t2 = /* @__PURE__ */ new Map();
215
- for (const [u3, F3] of Object.entries(r)) {
216
- 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]);
217
- Object.defineProperty(r, u3, { value: F3, enumerable: false });
218
- }
219
- 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) => {
220
- const F3 = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u3.toString(16));
221
- if (!F3) return [0, 0, 0];
222
- let [e2] = F3;
223
- e2.length === 3 && (e2 = [...e2].map((i2) => i2 + i2).join(""));
224
- const s2 = Number.parseInt(e2, 16);
225
- return [s2 >> 16 & 255, s2 >> 8 & 255, s2 & 255];
226
- }, "value"), enumerable: false }, hexToAnsi256: { value: /* @__PURE__ */ __name((u3) => r.rgbToAnsi256(...r.hexToRgb(u3)), "value"), enumerable: false }, ansi256ToAnsi: { value: /* @__PURE__ */ __name((u3) => {
227
- if (u3 < 8) return 30 + u3;
228
- if (u3 < 16) return 90 + (u3 - 8);
229
- let F3, e2, s2;
230
- if (u3 >= 232) F3 = ((u3 - 232) * 10 + 8) / 255, e2 = F3, s2 = F3;
231
- else {
232
- u3 -= 16;
233
- const C3 = u3 % 36;
234
- F3 = Math.floor(u3 / 36) / 5, e2 = Math.floor(C3 / 6) / 5, s2 = C3 % 6 / 5;
235
- }
236
- const i2 = Math.max(F3, e2, s2) * 2;
237
- if (i2 === 0) return 30;
238
- let D2 = 30 + (Math.round(s2) << 2 | Math.round(e2) << 1 | Math.round(F3));
239
- return i2 === 2 && (D2 += 60), D2;
240
- }, "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;
241
- }
242
- function G(t2, u3, F3) {
243
- return String(t2).normalize().replace(/\r\n/g, `
244
- `).split(`
245
- `).map((e2) => oD(e2, u3, F3)).join(`
246
- `);
247
- }
248
- function k$1(t2, u3) {
249
- if (typeof t2 == "string") return c.aliases.get(t2) === u3;
250
- for (const F3 of t2) if (F3 !== void 0 && k$1(F3, u3)) return true;
251
- return false;
252
- }
253
- function lD(t2, u3) {
254
- if (t2 === u3) return;
255
- const F3 = t2.split(`
256
- `), e2 = u3.split(`
257
- `), s2 = [];
258
- for (let i2 = 0; i2 < Math.max(F3.length, e2.length); i2++) F3[i2] !== e2[i2] && s2.push(i2);
259
- return s2;
260
- }
261
- function d$1(t2, u3) {
262
- const F3 = t2;
263
- F3.isTTY && F3.setRawMode(u3);
264
- }
265
- function ce() {
266
- return g__default.default.platform !== "win32" ? g__default.default.env.TERM !== "linux" : !!g__default.default.env.CI || !!g__default.default.env.WT_SESSION || !!g__default.default.env.TERMINUS_SUBLIME || g__default.default.env.ConEmuTask === "{cmd::Cmder}" || g__default.default.env.TERM_PROGRAM === "Terminus-Sublime" || g__default.default.env.TERM_PROGRAM === "vscode" || g__default.default.env.TERM === "xterm-256color" || g__default.default.env.TERM === "alacritty" || g__default.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
267
- }
268
- async function prompt(message, opts = {}) {
269
- const handleCancel = /* @__PURE__ */ __name((value) => {
270
- if (typeof value !== "symbol" || value.toString() !== "Symbol(clack:cancel)") {
271
- return value;
272
- }
273
- switch (opts.cancel) {
274
- case "reject": {
275
- const error = new Error("Prompt cancelled.");
276
- error.name = "ConsolaPromptCancelledError";
277
- if (Error.captureStackTrace) {
278
- Error.captureStackTrace(error, prompt);
279
- }
280
- throw error;
281
- }
282
- case "undefined": {
283
- return void 0;
284
- }
285
- case "null": {
286
- return null;
287
- }
288
- case "symbol": {
289
- return kCancel;
290
- }
291
- default:
292
- case "default": {
293
- return opts.default ?? opts.initial;
294
- }
295
- }
296
- }, "handleCancel");
297
- if (!opts.type || opts.type === "text") {
298
- return await he({
299
- message,
300
- defaultValue: opts.default,
301
- placeholder: opts.placeholder,
302
- initialValue: opts.initial
303
- }).then(handleCancel);
304
- }
305
- if (opts.type === "confirm") {
306
- return await ye({
307
- message,
308
- initialValue: opts.initial
309
- }).then(handleCancel);
310
- }
311
- if (opts.type === "select") {
312
- return await ve({
313
- message,
314
- options: opts.options.map(
315
- (o3) => typeof o3 === "string" ? { value: o3, label: o3 } : o3
316
- ),
317
- initialValue: opts.initial
318
- }).then(handleCancel);
319
- }
320
- if (opts.type === "multiselect") {
321
- return await fe({
322
- message,
323
- options: opts.options.map(
324
- (o3) => typeof o3 === "string" ? { value: o3, label: o3 } : o3
325
- ),
326
- required: opts.required,
327
- initialValues: opts.initial
328
- }).then(handleCancel);
329
- }
330
- throw new Error(`Unknown prompt type: ${opts.type}`);
331
- }
332
- 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;
333
- var init_prompt = __esm({
334
- "../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs"() {
335
- __name(getDefaultExportFromCjs, "getDefaultExportFromCjs");
336
- __name(requireSrc, "requireSrc");
337
- srcExports = requireSrc();
338
- picocolors = { exports: {} };
339
- __name(requirePicocolors, "requirePicocolors");
340
- picocolorsExports = /* @__PURE__ */ requirePicocolors();
341
- e = /* @__PURE__ */ getDefaultExportFromCjs(picocolorsExports);
342
- __name(J, "J");
343
- Q = J();
344
- __name(T$1, "T$1");
345
- __name(O, "O");
346
- P$1 = { exports: {} };
347
- (function(t2) {
348
- var u3 = {};
349
- t2.exports = u3, u3.eastAsianWidth = function(e2) {
350
- var s2 = e2.charCodeAt(0), i2 = e2.length == 2 ? e2.charCodeAt(1) : 0, D2 = s2;
351
- 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";
352
- }, u3.characterLength = function(e2) {
353
- var s2 = this.eastAsianWidth(e2);
354
- return s2 == "F" || s2 == "W" || s2 == "A" ? 2 : 1;
355
- };
356
- function F3(e2) {
357
- return e2.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
358
- }
359
- __name(F3, "F");
360
- u3.length = function(e2) {
361
- for (var s2 = F3(e2), i2 = 0, D2 = 0; D2 < s2.length; D2++) i2 = i2 + this.characterLength(s2[D2]);
362
- return i2;
363
- }, u3.slice = function(e2, s2, i2) {
364
- textLen = u3.length(e2), s2 = s2 || 0, i2 = i2 || 1, s2 < 0 && (s2 = textLen + s2), i2 < 0 && (i2 = textLen + i2);
365
- for (var D2 = "", C3 = 0, o3 = F3(e2), E = 0; E < o3.length; E++) {
366
- var a2 = o3[E], n2 = u3.length(a2);
367
- if (C3 >= s2 - (n2 == 2 ? 1 : 0)) if (C3 + n2 <= i2) D2 += a2;
368
- else break;
369
- C3 += n2;
370
- }
371
- return D2;
372
- };
373
- })(P$1);
374
- X = P$1.exports;
375
- DD = O(X);
376
- uD = /* @__PURE__ */ __name(function() {
377
- 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;
378
- }, "uD");
379
- FD = O(uD);
380
- __name(A$1, "A$1");
381
- m = 10;
382
- L$1 = /* @__PURE__ */ __name((t2 = 0) => (u3) => `\x1B[${u3 + t2}m`, "L$1");
383
- N = /* @__PURE__ */ __name((t2 = 0) => (u3) => `\x1B[${38 + t2};5;${u3}m`, "N");
384
- I = /* @__PURE__ */ __name((t2 = 0) => (u3, F3, e2) => `\x1B[${38 + t2};2;${u3};${F3};${e2}m`, "I");
385
- 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] } };
386
- Object.keys(r.modifier);
387
- tD = Object.keys(r.color);
388
- eD = Object.keys(r.bgColor);
389
- [...tD, ...eD];
390
- __name(sD, "sD");
391
- iD = sD();
392
- v = /* @__PURE__ */ new Set(["\x1B", "\x9B"]);
393
- CD = 39;
394
- w$1 = "\x07";
395
- W$1 = "[";
396
- rD = "]";
397
- R = "m";
398
- y = `${rD}8;;`;
399
- V$1 = /* @__PURE__ */ __name((t2) => `${v.values().next().value}${W$1}${t2}${R}`, "V$1");
400
- z = /* @__PURE__ */ __name((t2) => `${v.values().next().value}${y}${t2}${w$1}`, "z");
401
- ED = /* @__PURE__ */ __name((t2) => t2.split(" ").map((u3) => A$1(u3)), "ED");
402
- _ = /* @__PURE__ */ __name((t2, u3, F3) => {
403
- const e2 = [...u3];
404
- let s2 = false, i2 = false, D2 = A$1(T$1(t2[t2.length - 1]));
405
- for (const [C3, o3] of e2.entries()) {
406
- const E = A$1(o3);
407
- 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) {
408
- i2 ? o3 === w$1 && (s2 = false, i2 = false) : o3 === R && (s2 = false);
409
- continue;
410
- }
411
- D2 += E, D2 === F3 && C3 < e2.length - 1 && (t2.push(""), D2 = 0);
412
- }
413
- !D2 && t2[t2.length - 1].length > 0 && t2.length > 1 && (t2[t2.length - 2] += t2.pop());
414
- }, "_");
415
- nD = /* @__PURE__ */ __name((t2) => {
416
- const u3 = t2.split(" ");
417
- let F3 = u3.length;
418
- for (; F3 > 0 && !(A$1(u3[F3 - 1]) > 0); ) F3--;
419
- return F3 === u3.length ? t2 : u3.slice(0, F3).join(" ") + u3.slice(F3).join("");
420
- }, "nD");
421
- oD = /* @__PURE__ */ __name((t2, u3, F3 = {}) => {
422
- if (F3.trim !== false && t2.trim() === "") return "";
423
- let e2 = "", s2, i2;
424
- const D2 = ED(t2);
425
- let C3 = [""];
426
- for (const [E, a2] of t2.split(" ").entries()) {
427
- F3.trim !== false && (C3[C3.length - 1] = C3[C3.length - 1].trimStart());
428
- let n2 = A$1(C3[C3.length - 1]);
429
- 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) {
430
- const B2 = u3 - n2, p = 1 + Math.floor((D2[E] - B2 - 1) / u3);
431
- Math.floor((D2[E] - 1) / u3) < p && C3.push(""), _(C3, a2, u3);
432
- continue;
433
- }
434
- if (n2 + D2[E] > u3 && n2 > 0 && D2[E] > 0) {
435
- if (F3.wordWrap === false && n2 < u3) {
436
- _(C3, a2, u3);
437
- continue;
438
- }
439
- C3.push("");
440
- }
441
- if (n2 + D2[E] > u3 && F3.wordWrap === false) {
442
- _(C3, a2, u3);
443
- continue;
444
- }
445
- C3[C3.length - 1] += a2;
446
- }
447
- F3.trim !== false && (C3 = C3.map((E) => nD(E)));
448
- const o3 = [...C3.join(`
449
- `)];
450
- for (const [E, a2] of o3.entries()) {
451
- if (e2 += a2, v.has(a2)) {
452
- const { groups: B2 } = new RegExp(`(?:\\${W$1}(?<code>\\d+)m|\\${y}(?<uri>.*)${w$1})`).exec(o3.slice(E).join("")) || { groups: {} };
453
- if (B2.code !== void 0) {
454
- const p = Number.parseFloat(B2.code);
455
- s2 = p === CD ? void 0 : p;
456
- } else B2.uri !== void 0 && (i2 = B2.uri.length === 0 ? void 0 : B2.uri);
457
- }
458
- const n2 = iD.codes.get(Number(s2));
459
- o3[E + 1] === `
460
- ` ? (i2 && (e2 += z("")), s2 && n2 && (e2 += V$1(n2))) : a2 === `
461
- ` && (s2 && n2 && (e2 += V$1(s2)), i2 && (e2 += z(i2)));
462
- }
463
- return e2;
464
- }, "oD");
465
- __name(G, "G");
466
- aD = ["up", "down", "left", "right", "space", "enter", "cancel"];
467
- c = { actions: new Set(aD), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]) };
468
- __name(k$1, "k$1");
469
- __name(lD, "lD");
470
- globalThis.process.platform.startsWith("win");
471
- S = Symbol("clack:cancel");
472
- __name(d$1, "d$1");
473
- AD = Object.defineProperty;
474
- pD = /* @__PURE__ */ __name((t2, u3, F3) => u3 in t2 ? AD(t2, u3, { enumerable: true, configurable: true, writable: true, value: F3 }) : t2[u3] = F3, "pD");
475
- h = /* @__PURE__ */ __name((t2, u3, F3) => (pD(t2, typeof u3 != "symbol" ? u3 + "" : u3, F3), F3), "h");
476
- x = class {
477
- static {
478
- __name(this, "x");
479
- }
480
- constructor(u3, F3 = true) {
481
- 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");
482
- const { input: e2 = g.stdin, output: s2 = g.stdout, render: i2, signal: D2, ...C3 } = u3;
483
- 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;
484
- }
485
- unsubscribe() {
486
- this._subscribers.clear();
487
- }
488
- setSubscriber(u3, F3) {
489
- const e2 = this._subscribers.get(u3) ?? [];
490
- e2.push(F3), this._subscribers.set(u3, e2);
491
- }
492
- on(u3, F3) {
493
- this.setSubscriber(u3, { cb: F3 });
494
- }
495
- once(u3, F3) {
496
- this.setSubscriber(u3, { cb: F3, once: true });
497
- }
498
- emit(u3, ...F3) {
499
- const e2 = this._subscribers.get(u3) ?? [], s2 = [];
500
- for (const i2 of e2) i2.cb(...F3), i2.once && s2.push(() => e2.splice(e2.indexOf(i2), 1));
501
- for (const i2 of s2) i2();
502
- }
503
- prompt() {
504
- return new Promise((u3, F3) => {
505
- if (this._abortSignal) {
506
- if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u3(S);
507
- this._abortSignal.addEventListener("abort", () => {
508
- this.state = "cancel", this.close();
509
- }, { once: true });
510
- }
511
- const e2 = new tty.WriteStream(0);
512
- e2._write = (s2, i2, D2) => {
513
- this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D2();
514
- }, this.input.pipe(e2), this.rl = f__default.default.createInterface({ input: this.input, output: e2, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), f__default.default.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", () => {
515
- this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u3(this.value);
516
- }), this.once("cancel", () => {
517
- this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u3(S);
518
- });
519
- });
520
- }
521
- onKeypress(u3, F3) {
522
- 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") {
523
- if (this.opts.validate) {
524
- const e2 = this.opts.validate(this.value);
525
- e2 && (this.error = e2 instanceof Error ? e2.message : e2, this.state = "error", this.rl?.write(this.value));
526
- }
527
- this.state !== "error" && (this.state = "submit");
528
- }
529
- 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();
530
- }
531
- close() {
532
- this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
533
- `), d$1(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
534
- }
535
- restoreCursor() {
536
- const u3 = G(this._prevFrame, process.stdout.columns, { hard: true }).split(`
537
- `).length - 1;
538
- this.output.write(srcExports.cursor.move(-999, u3 * -1));
539
- }
540
- render() {
541
- const u3 = G(this._render(this) ?? "", process.stdout.columns, { hard: true });
542
- if (u3 !== this._prevFrame) {
543
- if (this.state === "initial") this.output.write(srcExports.cursor.hide);
544
- else {
545
- const F3 = lD(this._prevFrame, u3);
546
- if (this.restoreCursor(), F3 && F3?.length === 1) {
547
- const e2 = F3[0];
548
- this.output.write(srcExports.cursor.move(0, e2)), this.output.write(srcExports.erase.lines(1));
549
- const s2 = u3.split(`
550
- `);
551
- this.output.write(s2[e2]), this._prevFrame = u3, this.output.write(srcExports.cursor.move(0, s2.length - e2 - 1));
552
- return;
553
- }
554
- if (F3 && F3?.length > 1) {
555
- const e2 = F3[0];
556
- this.output.write(srcExports.cursor.move(0, e2)), this.output.write(srcExports.erase.down());
557
- const s2 = u3.split(`
558
- `).slice(e2);
559
- this.output.write(s2.join(`
560
- `)), this._prevFrame = u3;
561
- return;
562
- }
563
- this.output.write(srcExports.erase.down());
564
- }
565
- this.output.write(u3), this.state === "initial" && (this.state = "active"), this._prevFrame = u3;
566
- }
567
- }
568
- };
569
- fD = class extends x {
570
- static {
571
- __name(this, "fD");
572
- }
573
- get cursor() {
574
- return this.value ? 0 : 1;
575
- }
576
- get _value() {
577
- return this.cursor === 0;
578
- }
579
- constructor(u3) {
580
- super(u3, false), this.value = !!u3.initialValue, this.on("value", () => {
581
- this.value = this._value;
582
- }), this.on("confirm", (F3) => {
583
- this.output.write(srcExports.cursor.move(0, -1)), this.value = F3, this.state = "submit", this.close();
584
- }), this.on("cursor", () => {
585
- this.value = !this.value;
586
- });
587
- }
588
- };
589
- bD = Object.defineProperty;
590
- mD = /* @__PURE__ */ __name((t2, u3, F3) => u3 in t2 ? bD(t2, u3, { enumerable: true, configurable: true, writable: true, value: F3 }) : t2[u3] = F3, "mD");
591
- Y = /* @__PURE__ */ __name((t2, u3, F3) => (mD(t2, typeof u3 != "symbol" ? u3 + "" : u3, F3), F3), "Y");
592
- wD = class extends x {
593
- static {
594
- __name(this, "wD");
595
- }
596
- constructor(u3) {
597
- 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) => {
598
- F3 === "a" && this.toggleAll();
599
- }), this.on("cursor", (F3) => {
600
- switch (F3) {
601
- case "left":
602
- case "up":
603
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
604
- break;
605
- case "down":
606
- case "right":
607
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
608
- break;
609
- case "space":
610
- this.toggleValue();
611
- break;
612
- }
613
- });
614
- }
615
- get _value() {
616
- return this.options[this.cursor].value;
617
- }
618
- toggleAll() {
619
- const u3 = this.value.length === this.options.length;
620
- this.value = u3 ? [] : this.options.map((F3) => F3.value);
621
- }
622
- toggleValue() {
623
- const u3 = this.value.includes(this._value);
624
- this.value = u3 ? this.value.filter((F3) => F3 !== this._value) : [...this.value, this._value];
625
- }
626
- };
627
- SD = Object.defineProperty;
628
- $D = /* @__PURE__ */ __name((t2, u3, F3) => u3 in t2 ? SD(t2, u3, { enumerable: true, configurable: true, writable: true, value: F3 }) : t2[u3] = F3, "$D");
629
- q = /* @__PURE__ */ __name((t2, u3, F3) => ($D(t2, typeof u3 != "symbol" ? u3 + "" : u3, F3), F3), "q");
630
- jD = class extends x {
631
- static {
632
- __name(this, "jD");
633
- }
634
- constructor(u3) {
635
- 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) => {
636
- switch (F3) {
637
- case "left":
638
- case "up":
639
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
640
- break;
641
- case "down":
642
- case "right":
643
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
644
- break;
645
- }
646
- this.changeValue();
647
- });
648
- }
649
- get _value() {
650
- return this.options[this.cursor];
651
- }
652
- changeValue() {
653
- this.value = this._value.value;
654
- }
655
- };
656
- PD = class extends x {
657
- static {
658
- __name(this, "PD");
659
- }
660
- get valueWithCursor() {
661
- if (this.state === "submit") return this.value;
662
- if (this.cursor >= this.value.length) return `${this.value}\u2588`;
663
- const u3 = this.value.slice(0, this.cursor), [F3, ...e$1] = this.value.slice(this.cursor);
664
- return `${u3}${e.inverse(F3)}${e$1.join("")}`;
665
- }
666
- get cursor() {
667
- return this._cursor;
668
- }
669
- constructor(u3) {
670
- super(u3), this.on("finalize", () => {
671
- this.value || (this.value = u3.defaultValue);
672
- });
673
- }
674
- };
675
- __name(ce, "ce");
676
- V = ce();
677
- u = /* @__PURE__ */ __name((t2, n2) => V ? t2 : n2, "u");
678
- le = u("\u276F", ">");
679
- L = u("\u25A0", "x");
680
- W = u("\u25B2", "x");
681
- C = u("\u2714", "\u221A");
682
- o = u("");
683
- d = u("");
684
- k = u("\u25CF", ">");
685
- P = u("\u25CB", " ");
686
- A = u("\u25FB", "[\u2022]");
687
- T = u("\u25FC", "[+]");
688
- F = u("\u25FB", "[ ]");
689
- w = /* @__PURE__ */ __name((t2) => {
690
- switch (t2) {
691
- case "initial":
692
- case "active":
693
- return e.cyan(le);
694
- case "cancel":
695
- return e.red(L);
696
- case "error":
697
- return e.yellow(W);
698
- case "submit":
699
- return e.green(C);
700
- }
701
- }, "w");
702
- B = /* @__PURE__ */ __name((t2) => {
703
- 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));
704
- let l2 = 0;
705
- 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));
706
- const $ = c3 < s2.length && l2 > 0, p = c3 < s2.length && l2 + c3 < s2.length;
707
- return s2.slice(l2, l2 + c3).map((M, v2, x2) => {
708
- const j = v2 === 0 && $, E = v2 === x2.length - 1 && p;
709
- return j || E ? e.dim("...") : r3(M, v2 + l2 === n2);
710
- });
711
- }, "B");
712
- he = /* @__PURE__ */ __name((t2) => new PD({ validate: t2.validate, placeholder: t2.placeholder, defaultValue: t2.defaultValue, initialValue: t2.initialValue, render() {
713
- const n2 = `${e.gray(o)}
714
- ${w(this.state)} ${t2.message}
715
- `, s2 = t2.placeholder ? e.inverse(t2.placeholder[0]) + e.dim(t2.placeholder.slice(1)) : e.inverse(e.hidden("_")), r3 = this.value ? this.valueWithCursor : s2;
716
- switch (this.state) {
717
- case "error":
718
- return `${n2.trim()}
719
- ${e.yellow(o)} ${r3}
720
- ${e.yellow(d)} ${e.yellow(this.error)}
721
- `;
722
- case "submit":
723
- return `${n2}${e.gray(o)} ${e.dim(this.value || t2.placeholder)}`;
724
- case "cancel":
725
- return `${n2}${e.gray(o)} ${e.strikethrough(e.dim(this.value ?? ""))}${this.value?.trim() ? `
726
- ${e.gray(o)}` : ""}`;
727
- default:
728
- return `${n2}${e.cyan(o)} ${r3}
729
- ${e.cyan(d)}
730
- `;
731
- }
732
- } }).prompt(), "he");
733
- ye = /* @__PURE__ */ __name((t2) => {
734
- const n2 = t2.active ?? "Yes", s2 = t2.inactive ?? "No";
735
- return new fD({ active: n2, inactive: s2, initialValue: t2.initialValue ?? true, render() {
736
- const r3 = `${e.gray(o)}
737
- ${w(this.state)} ${t2.message}
738
- `, i2 = this.value ? n2 : s2;
739
- switch (this.state) {
740
- case "submit":
741
- return `${r3}${e.gray(o)} ${e.dim(i2)}`;
742
- case "cancel":
743
- return `${r3}${e.gray(o)} ${e.strikethrough(e.dim(i2))}
744
- ${e.gray(o)}`;
745
- default:
746
- 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}`}
747
- ${e.cyan(d)}
748
- `;
749
- }
750
- } }).prompt();
751
- }, "ye");
752
- ve = /* @__PURE__ */ __name((t2) => {
753
- const n2 = /* @__PURE__ */ __name((s2, r3) => {
754
- const i2 = s2.label ?? String(s2.value);
755
- switch (r3) {
756
- case "selected":
757
- return `${e.dim(i2)}`;
758
- case "active":
759
- return `${e.green(k)} ${i2} ${s2.hint ? e.dim(`(${s2.hint})`) : ""}`;
760
- case "cancelled":
761
- return `${e.strikethrough(e.dim(i2))}`;
762
- default:
763
- return `${e.dim(P)} ${e.dim(i2)}`;
764
- }
765
- }, "n");
766
- return new jD({ options: t2.options, initialValue: t2.initialValue, render() {
767
- const s2 = `${e.gray(o)}
768
- ${w(this.state)} ${t2.message}
769
- `;
770
- switch (this.state) {
771
- case "submit":
772
- return `${s2}${e.gray(o)} ${n2(this.options[this.cursor], "selected")}`;
773
- case "cancel":
774
- return `${s2}${e.gray(o)} ${n2(this.options[this.cursor], "cancelled")}
775
- ${e.gray(o)}`;
776
- default:
777
- 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(`
778
- ${e.cyan(o)} `)}
779
- ${e.cyan(d)}
780
- `;
781
- }
782
- } }).prompt();
783
- }, "ve");
784
- fe = /* @__PURE__ */ __name((t2) => {
785
- const n2 = /* @__PURE__ */ __name((s2, r3) => {
786
- const i2 = s2.label ?? String(s2.value);
787
- 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)}`;
788
- }, "n");
789
- return new wD({ options: t2.options, initialValues: t2.initialValues, required: t2.required ?? true, cursorAt: t2.cursorAt, validate(s2) {
790
- if (this.required && s2.length === 0) return `Please select at least one option.
791
- ${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`;
792
- }, render() {
793
- const s2 = `${e.gray(o)}
794
- ${w(this.state)} ${t2.message}
795
- `, r3 = /* @__PURE__ */ __name((i2, a2) => {
796
- const c3 = this.value.includes(i2.value);
797
- return a2 && c3 ? n2(i2, "active-selected") : c3 ? n2(i2, "selected") : n2(i2, a2 ? "active" : "inactive");
798
- }, "r");
799
- switch (this.state) {
800
- case "submit":
801
- 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")}`;
802
- case "cancel": {
803
- const i2 = this.options.filter(({ value: a2 }) => this.value.includes(a2)).map((a2) => n2(a2, "cancelled")).join(e.dim(", "));
804
- return `${s2}${e.gray(o)} ${i2.trim() ? `${i2}
805
- ${e.gray(o)}` : ""}`;
806
- }
807
- case "error": {
808
- const i2 = this.error.split(`
809
- `).map((a2, c3) => c3 === 0 ? `${e.yellow(d)} ${e.yellow(a2)}` : ` ${a2}`).join(`
810
- `);
811
- return `${s2 + e.yellow(o)} ${B({ options: this.options, cursor: this.cursor, maxItems: t2.maxItems, style: r3 }).join(`
812
- ${e.yellow(o)} `)}
813
- ${i2}
814
- `;
815
- }
816
- default:
817
- return `${s2}${e.cyan(o)} ${B({ options: this.options, cursor: this.cursor, maxItems: t2.maxItems, style: r3 }).join(`
818
- ${e.cyan(o)} `)}
819
- ${e.cyan(d)}
820
- `;
821
- }
822
- } }).prompt();
823
- }, "fe");
824
- `${e.gray(o)} `;
825
- kCancel = Symbol.for("cancel");
826
- __name(prompt, "prompt");
827
- }
828
- });
829
-
830
- // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
831
- var LogLevels = {
832
- fatal: 0,
833
- error: 0,
834
- warn: 1,
835
- log: 2,
836
- info: 3,
837
- success: 3,
838
- fail: 3,
839
- debug: 4,
840
- trace: 5,
841
- verbose: Number.POSITIVE_INFINITY
842
- };
843
- var LogTypes = {
844
- // Silent
845
- silent: {
846
- level: -1
847
- },
848
- // Level 0
849
- fatal: {
850
- level: LogLevels.fatal
851
- },
852
- error: {
853
- level: LogLevels.error
854
- },
855
- // Level 1
856
- warn: {
857
- level: LogLevels.warn
858
- },
859
- // Level 2
860
- log: {
861
- level: LogLevels.log
862
- },
863
- // Level 3
864
- info: {
865
- level: LogLevels.info
866
- },
867
- success: {
868
- level: LogLevels.success
869
- },
870
- fail: {
871
- level: LogLevels.fail
872
- },
873
- ready: {
874
- level: LogLevels.info
875
- },
876
- start: {
877
- level: LogLevels.info
878
- },
879
- box: {
880
- level: LogLevels.info
881
- },
882
- // Level 4
883
- debug: {
884
- level: LogLevels.debug
885
- },
886
- // Level 5
887
- trace: {
888
- level: LogLevels.trace
889
- },
890
- // Verbose
891
- verbose: {
892
- level: LogLevels.verbose
893
- }
894
- };
895
- function isPlainObject$1(value) {
896
- if (value === null || typeof value !== "object") {
897
- return false;
898
- }
899
- const prototype = Object.getPrototypeOf(value);
900
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
901
- return false;
902
- }
903
- if (Symbol.iterator in value) {
904
- return false;
905
- }
906
- if (Symbol.toStringTag in value) {
907
- return Object.prototype.toString.call(value) === "[object Module]";
908
- }
909
- return true;
910
- }
911
- __name(isPlainObject$1, "isPlainObject$1");
912
- function _defu(baseObject, defaults, namespace = ".", merger) {
913
- if (!isPlainObject$1(defaults)) {
914
- return _defu(baseObject, {}, namespace, merger);
915
- }
916
- const object = Object.assign({}, defaults);
917
- for (const key in baseObject) {
918
- if (key === "__proto__" || key === "constructor") {
919
- continue;
920
- }
921
- const value = baseObject[key];
922
- if (value === null || value === void 0) {
923
- continue;
924
- }
925
- if (merger && merger(object, key, value, namespace)) {
926
- continue;
927
- }
928
- if (Array.isArray(value) && Array.isArray(object[key])) {
929
- object[key] = [...value, ...object[key]];
930
- } else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
931
- object[key] = _defu(
932
- value,
933
- object[key],
934
- (namespace ? `${namespace}.` : "") + key.toString(),
935
- merger
936
- );
937
- } else {
938
- object[key] = value;
939
- }
940
- }
941
- return object;
942
- }
943
- __name(_defu, "_defu");
944
- function createDefu(merger) {
945
- return (...arguments_) => (
946
- // eslint-disable-next-line unicorn/no-array-reduce
947
- arguments_.reduce((p, c3) => _defu(p, c3, "", merger), {})
948
- );
949
- }
950
- __name(createDefu, "createDefu");
951
- var defu = createDefu();
952
- function isPlainObject(obj) {
953
- return Object.prototype.toString.call(obj) === "[object Object]";
954
- }
955
- __name(isPlainObject, "isPlainObject");
956
- function isLogObj(arg) {
957
- if (!isPlainObject(arg)) {
958
- return false;
959
- }
960
- if (!arg.message && !arg.args) {
961
- return false;
962
- }
963
- if (arg.stack) {
964
- return false;
965
- }
966
- return true;
967
- }
968
- __name(isLogObj, "isLogObj");
969
- var paused = false;
970
- var queue = [];
971
- var Consola = class _Consola {
972
- static {
973
- __name(this, "Consola");
974
- }
975
- options;
976
- _lastLog;
977
- _mockFn;
978
- /**
979
- * Creates an instance of Consola with specified options or defaults.
980
- *
981
- * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
982
- */
983
- constructor(options = {}) {
984
- const types = options.types || LogTypes;
985
- this.options = defu(
986
- {
987
- ...options,
988
- defaults: { ...options.defaults },
989
- level: _normalizeLogLevel(options.level, types),
990
- reporters: [...options.reporters || []]
991
- },
992
- {
993
- types: LogTypes,
994
- throttle: 1e3,
995
- throttleMin: 5,
996
- formatOptions: {
997
- date: true,
998
- colors: false,
999
- compact: true
1000
- }
1001
- }
1002
- );
1003
- for (const type in types) {
1004
- const defaults = {
1005
- type,
1006
- ...this.options.defaults,
1007
- ...types[type]
1008
- };
1009
- this[type] = this._wrapLogFn(defaults);
1010
- this[type].raw = this._wrapLogFn(
1011
- defaults,
1012
- true
1013
- );
1014
- }
1015
- if (this.options.mockFn) {
1016
- this.mockTypes();
1017
- }
1018
- this._lastLog = {};
1019
- }
1020
- /**
1021
- * Gets the current log level of the Consola instance.
1022
- *
1023
- * @returns {number} The current log level.
1024
- */
1025
- get level() {
1026
- return this.options.level;
1027
- }
1028
- /**
1029
- * Sets the minimum log level that will be output by the instance.
1030
- *
1031
- * @param {number} level - The new log level to set.
1032
- */
1033
- set level(level) {
1034
- this.options.level = _normalizeLogLevel(
1035
- level,
1036
- this.options.types,
1037
- this.options.level
1038
- );
1039
- }
1040
- /**
1041
- * Displays a prompt to the user and returns the response.
1042
- * Throw an error if `prompt` is not supported by the current configuration.
1043
- *
1044
- * @template T
1045
- * @param {string} message - The message to display in the prompt.
1046
- * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
1047
- * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
1048
- */
1049
- prompt(message, opts) {
1050
- if (!this.options.prompt) {
1051
- throw new Error("prompt is not supported!");
1052
- }
1053
- return this.options.prompt(message, opts);
1054
- }
1055
- /**
1056
- * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
1057
- *
1058
- * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
1059
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
1060
- */
1061
- create(options) {
1062
- const instance = new _Consola({
1063
- ...this.options,
1064
- ...options
1065
- });
1066
- if (this._mockFn) {
1067
- instance.mockTypes(this._mockFn);
1068
- }
1069
- return instance;
1070
- }
1071
- /**
1072
- * Creates a new Consola instance with the specified default log object properties.
1073
- *
1074
- * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
1075
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
1076
- */
1077
- withDefaults(defaults) {
1078
- return this.create({
1079
- ...this.options,
1080
- defaults: {
1081
- ...this.options.defaults,
1082
- ...defaults
1083
- }
1084
- });
1085
- }
1086
- /**
1087
- * Creates a new Consola instance with a specified tag, which will be included in every log.
1088
- *
1089
- * @param {string} tag - The tag to include in each log of the new instance.
1090
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
1091
- */
1092
- withTag(tag) {
1093
- return this.withDefaults({
1094
- tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
1095
- });
1096
- }
1097
- /**
1098
- * Adds a custom reporter to the Consola instance.
1099
- * Reporters will be called for each log message, depending on their implementation and log level.
1100
- *
1101
- * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
1102
- * @returns {Consola} The current Consola instance.
1103
- */
1104
- addReporter(reporter) {
1105
- this.options.reporters.push(reporter);
1106
- return this;
1107
- }
1108
- /**
1109
- * Removes a custom reporter from the Consola instance.
1110
- * If no reporter is specified, all reporters will be removed.
1111
- *
1112
- * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
1113
- * @returns {Consola} The current Consola instance.
1114
- */
1115
- removeReporter(reporter) {
1116
- if (reporter) {
1117
- const i2 = this.options.reporters.indexOf(reporter);
1118
- if (i2 !== -1) {
1119
- return this.options.reporters.splice(i2, 1);
1120
- }
1121
- } else {
1122
- this.options.reporters.splice(0);
1123
- }
1124
- return this;
1125
- }
1126
- /**
1127
- * Replaces all reporters of the Consola instance with the specified array of reporters.
1128
- *
1129
- * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
1130
- * @returns {Consola} The current Consola instance.
1131
- */
1132
- setReporters(reporters) {
1133
- this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
1134
- return this;
1135
- }
1136
- wrapAll() {
1137
- this.wrapConsole();
1138
- this.wrapStd();
1139
- }
1140
- restoreAll() {
1141
- this.restoreConsole();
1142
- this.restoreStd();
1143
- }
1144
- /**
1145
- * Overrides console methods with Consola logging methods for consistent logging.
1146
- */
1147
- wrapConsole() {
1148
- for (const type in this.options.types) {
1149
- if (!console["__" + type]) {
1150
- console["__" + type] = console[type];
1151
- }
1152
- console[type] = this[type].raw;
1153
- }
1154
- }
1155
- /**
1156
- * Restores the original console methods, removing Consola overrides.
1157
- */
1158
- restoreConsole() {
1159
- for (const type in this.options.types) {
1160
- if (console["__" + type]) {
1161
- console[type] = console["__" + type];
1162
- delete console["__" + type];
1163
- }
1164
- }
1165
- }
1166
- /**
1167
- * Overrides standard output and error streams to redirect them through Consola.
1168
- */
1169
- wrapStd() {
1170
- this._wrapStream(this.options.stdout, "log");
1171
- this._wrapStream(this.options.stderr, "log");
1172
- }
1173
- _wrapStream(stream, type) {
1174
- if (!stream) {
1175
- return;
1176
- }
1177
- if (!stream.__write) {
1178
- stream.__write = stream.write;
1179
- }
1180
- stream.write = (data) => {
1181
- this[type].raw(String(data).trim());
1182
- };
1183
- }
1184
- /**
1185
- * Restores the original standard output and error streams, removing the Consola redirection.
1186
- */
1187
- restoreStd() {
1188
- this._restoreStream(this.options.stdout);
1189
- this._restoreStream(this.options.stderr);
1190
- }
1191
- _restoreStream(stream) {
1192
- if (!stream) {
1193
- return;
1194
- }
1195
- if (stream.__write) {
1196
- stream.write = stream.__write;
1197
- delete stream.__write;
1198
- }
1199
- }
1200
- /**
1201
- * Pauses logging, queues incoming logs until resumed.
1202
- */
1203
- pauseLogs() {
1204
- paused = true;
1205
- }
1206
- /**
1207
- * Resumes logging, processing any queued logs.
1208
- */
1209
- resumeLogs() {
1210
- paused = false;
1211
- const _queue = queue.splice(0);
1212
- for (const item of _queue) {
1213
- item[0]._logFn(item[1], item[2]);
1214
- }
1215
- }
1216
- /**
1217
- * Replaces logging methods with mocks if a mock function is provided.
1218
- *
1219
- * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
1220
- */
1221
- mockTypes(mockFn) {
1222
- const _mockFn = mockFn || this.options.mockFn;
1223
- this._mockFn = _mockFn;
1224
- if (typeof _mockFn !== "function") {
1225
- return;
1226
- }
1227
- for (const type in this.options.types) {
1228
- this[type] = _mockFn(type, this.options.types[type]) || this[type];
1229
- this[type].raw = this[type];
1230
- }
1231
- }
1232
- _wrapLogFn(defaults, isRaw) {
1233
- return (...args) => {
1234
- if (paused) {
1235
- queue.push([this, defaults, args, isRaw]);
1236
- return;
1237
- }
1238
- return this._logFn(defaults, args, isRaw);
1239
- };
1240
- }
1241
- _logFn(defaults, args, isRaw) {
1242
- if ((defaults.level || 0) > this.level) {
1243
- return false;
1244
- }
1245
- const logObj = {
1246
- date: /* @__PURE__ */ new Date(),
1247
- args: [],
1248
- ...defaults,
1249
- level: _normalizeLogLevel(defaults.level, this.options.types)
1250
- };
1251
- if (!isRaw && args.length === 1 && isLogObj(args[0])) {
1252
- Object.assign(logObj, args[0]);
1253
- } else {
1254
- logObj.args = [...args];
1255
- }
1256
- if (logObj.message) {
1257
- logObj.args.unshift(logObj.message);
1258
- delete logObj.message;
1259
- }
1260
- if (logObj.additional) {
1261
- if (!Array.isArray(logObj.additional)) {
1262
- logObj.additional = logObj.additional.split("\n");
1263
- }
1264
- logObj.args.push("\n" + logObj.additional.join("\n"));
1265
- delete logObj.additional;
1266
- }
1267
- logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
1268
- logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
1269
- const resolveLog = /* @__PURE__ */ __name((newLog = false) => {
1270
- const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
1271
- if (this._lastLog.object && repeated > 0) {
1272
- const args2 = [...this._lastLog.object.args];
1273
- if (repeated > 1) {
1274
- args2.push(`(repeated ${repeated} times)`);
1275
- }
1276
- this._log({ ...this._lastLog.object, args: args2 });
1277
- this._lastLog.count = 1;
1278
- }
1279
- if (newLog) {
1280
- this._lastLog.object = logObj;
1281
- this._log(logObj);
1282
- }
1283
- }, "resolveLog");
1284
- clearTimeout(this._lastLog.timeout);
1285
- const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
1286
- this._lastLog.time = logObj.date;
1287
- if (diffTime < this.options.throttle) {
1288
- try {
1289
- const serializedLog = JSON.stringify([
1290
- logObj.type,
1291
- logObj.tag,
1292
- logObj.args
1293
- ]);
1294
- const isSameLog = this._lastLog.serialized === serializedLog;
1295
- this._lastLog.serialized = serializedLog;
1296
- if (isSameLog) {
1297
- this._lastLog.count = (this._lastLog.count || 0) + 1;
1298
- if (this._lastLog.count > this.options.throttleMin) {
1299
- this._lastLog.timeout = setTimeout(
1300
- resolveLog,
1301
- this.options.throttle
1302
- );
1303
- return;
1304
- }
1305
- }
1306
- } catch {
1307
- }
1308
- }
1309
- resolveLog(true);
1310
- }
1311
- _log(logObj) {
1312
- for (const reporter of this.options.reporters) {
1313
- reporter.log(logObj, {
1314
- options: this.options
1315
- });
1316
- }
1317
- }
1318
- };
1319
- function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
1320
- if (input === void 0) {
1321
- return defaultLevel;
1322
- }
1323
- if (typeof input === "number") {
1324
- return input;
1325
- }
1326
- if (types[input] && types[input].level !== void 0) {
1327
- return types[input].level;
1328
- }
1329
- return defaultLevel;
1330
- }
1331
- __name(_normalizeLogLevel, "_normalizeLogLevel");
1332
- Consola.prototype.add = Consola.prototype.addReporter;
1333
- Consola.prototype.remove = Consola.prototype.removeReporter;
1334
- Consola.prototype.clear = Consola.prototype.removeReporter;
1335
- Consola.prototype.withScope = Consola.prototype.withTag;
1336
- Consola.prototype.mock = Consola.prototype.mockTypes;
1337
- Consola.prototype.pause = Consola.prototype.pauseLogs;
1338
- Consola.prototype.resume = Consola.prototype.resumeLogs;
1339
- function createConsola(options = {}) {
1340
- return new Consola(options);
1341
- }
1342
- __name(createConsola, "createConsola");
1343
- function parseStack(stack, message) {
1344
- const cwd = process.cwd() + path.sep;
1345
- const lines = stack.split("\n").splice(message.split("\n").length).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
1346
- return lines;
1347
- }
1348
- __name(parseStack, "parseStack");
1349
- function writeStream(data, stream) {
1350
- const write = stream.__write || stream.write;
1351
- return write.call(stream, data);
1352
- }
1353
- __name(writeStream, "writeStream");
1354
- var bracket = /* @__PURE__ */ __name((x2) => x2 ? `[${x2}]` : "", "bracket");
1355
- var BasicReporter = class {
1356
- static {
1357
- __name(this, "BasicReporter");
1358
- }
1359
- formatStack(stack, message, opts) {
1360
- const indent = " ".repeat((opts?.errorLevel || 0) + 1);
1361
- return indent + parseStack(stack, message).join(`
1362
- ${indent}`);
1363
- }
1364
- formatError(err, opts) {
1365
- const message = err.message ?? util.formatWithOptions(opts, err);
1366
- const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
1367
- const level = opts?.errorLevel || 0;
1368
- const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
1369
- const causedError = err.cause ? "\n\n" + this.formatError(err.cause, { ...opts, errorLevel: level + 1 }) : "";
1370
- return causedPrefix + message + "\n" + stack + causedError;
1371
- }
1372
- formatArgs(args, opts) {
1373
- const _args = args.map((arg) => {
1374
- if (arg && typeof arg.stack === "string") {
1375
- return this.formatError(arg, opts);
1376
- }
1377
- return arg;
1378
- });
1379
- return util.formatWithOptions(opts, ..._args);
1380
- }
1381
- formatDate(date, opts) {
1382
- return opts.date ? date.toLocaleTimeString() : "";
1383
- }
1384
- filterAndJoin(arr) {
1385
- return arr.filter(Boolean).join(" ");
1386
- }
1387
- formatLogObj(logObj, opts) {
1388
- const message = this.formatArgs(logObj.args, opts);
1389
- if (logObj.type === "box") {
1390
- return "\n" + [
1391
- bracket(logObj.tag),
1392
- logObj.title && logObj.title,
1393
- ...message.split("\n")
1394
- ].filter(Boolean).map((l2) => " > " + l2).join("\n") + "\n";
1395
- }
1396
- return this.filterAndJoin([
1397
- bracket(logObj.type),
1398
- bracket(logObj.tag),
1399
- message
1400
- ]);
1401
- }
1402
- log(logObj, ctx) {
1403
- const line = this.formatLogObj(logObj, {
1404
- columns: ctx.options.stdout.columns || 0,
1405
- ...ctx.options.formatOptions
1406
- });
1407
- return writeStream(
1408
- line + "\n",
1409
- logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
1410
- );
1411
- }
1412
- };
1413
- var {
1414
- env = {},
1415
- argv = [],
1416
- platform = ""
1417
- } = typeof process === "undefined" ? {} : process;
1418
- var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
1419
- var isForced = "FORCE_COLOR" in env || argv.includes("--color");
1420
- var isWindows = platform === "win32";
1421
- var isDumbTerminal = env.TERM === "dumb";
1422
- var isCompatibleTerminal = tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM && !isDumbTerminal;
1423
- var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
1424
- var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
1425
- 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)) {
1426
- return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
1427
- }
1428
- __name(replaceClose, "replaceClose");
1429
- function clearBleed(index, string, open, close, replace) {
1430
- return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
1431
- }
1432
- __name(clearBleed, "clearBleed");
1433
- function filterEmpty(open, close, replace = open, at = open.length + 1) {
1434
- return (string) => string || !(string === "" || string === void 0) ? clearBleed(
1435
- ("" + string).indexOf(close, at),
1436
- string,
1437
- open,
1438
- close,
1439
- replace
1440
- ) : "";
1441
- }
1442
- __name(filterEmpty, "filterEmpty");
1443
- function init(open, close, replace) {
1444
- return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
1445
- }
1446
- __name(init, "init");
1447
- var colorDefs = {
1448
- reset: init(0, 0),
1449
- bold: init(1, 22, "\x1B[22m\x1B[1m"),
1450
- dim: init(2, 22, "\x1B[22m\x1B[2m"),
1451
- italic: init(3, 23),
1452
- underline: init(4, 24),
1453
- inverse: init(7, 27),
1454
- hidden: init(8, 28),
1455
- strikethrough: init(9, 29),
1456
- black: init(30, 39),
1457
- red: init(31, 39),
1458
- green: init(32, 39),
1459
- yellow: init(33, 39),
1460
- blue: init(34, 39),
1461
- magenta: init(35, 39),
1462
- cyan: init(36, 39),
1463
- white: init(37, 39),
1464
- gray: init(90, 39),
1465
- bgBlack: init(40, 49),
1466
- bgRed: init(41, 49),
1467
- bgGreen: init(42, 49),
1468
- bgYellow: init(43, 49),
1469
- bgBlue: init(44, 49),
1470
- bgMagenta: init(45, 49),
1471
- bgCyan: init(46, 49),
1472
- bgWhite: init(47, 49),
1473
- blackBright: init(90, 39),
1474
- redBright: init(91, 39),
1475
- greenBright: init(92, 39),
1476
- yellowBright: init(93, 39),
1477
- blueBright: init(94, 39),
1478
- magentaBright: init(95, 39),
1479
- cyanBright: init(96, 39),
1480
- whiteBright: init(97, 39),
1481
- bgBlackBright: init(100, 49),
1482
- bgRedBright: init(101, 49),
1483
- bgGreenBright: init(102, 49),
1484
- bgYellowBright: init(103, 49),
1485
- bgBlueBright: init(104, 49),
1486
- bgMagentaBright: init(105, 49),
1487
- bgCyanBright: init(106, 49),
1488
- bgWhiteBright: init(107, 49)
1489
- };
1490
- function createColors(useColor = isColorSupported) {
1491
- return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
1492
- }
1493
- __name(createColors, "createColors");
1494
- var colors = createColors();
1495
- function getColor(color, fallback = "reset") {
1496
- return colors[color] || colors[fallback];
1497
- }
1498
- __name(getColor, "getColor");
1499
- var ansiRegex = [
1500
- String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
1501
- String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
1502
- ].join("|");
1503
- function stripAnsi(text) {
1504
- return text.replace(new RegExp(ansiRegex, "g"), "");
1505
- }
1506
- __name(stripAnsi, "stripAnsi");
1507
- var boxStylePresets = {
1508
- solid: {
1509
- tl: "\u250C",
1510
- tr: "\u2510",
1511
- bl: "\u2514",
1512
- br: "\u2518",
1513
- h: "\u2500",
1514
- v: "\u2502"
1515
- },
1516
- double: {
1517
- tl: "\u2554",
1518
- tr: "\u2557",
1519
- bl: "\u255A",
1520
- br: "\u255D",
1521
- h: "\u2550",
1522
- v: "\u2551"
1523
- },
1524
- doubleSingle: {
1525
- tl: "\u2553",
1526
- tr: "\u2556",
1527
- bl: "\u2559",
1528
- br: "\u255C",
1529
- h: "\u2500",
1530
- v: "\u2551"
1531
- },
1532
- doubleSingleRounded: {
1533
- tl: "\u256D",
1534
- tr: "\u256E",
1535
- bl: "\u2570",
1536
- br: "\u256F",
1537
- h: "\u2500",
1538
- v: "\u2551"
1539
- },
1540
- singleThick: {
1541
- tl: "\u250F",
1542
- tr: "\u2513",
1543
- bl: "\u2517",
1544
- br: "\u251B",
1545
- h: "\u2501",
1546
- v: "\u2503"
1547
- },
1548
- singleDouble: {
1549
- tl: "\u2552",
1550
- tr: "\u2555",
1551
- bl: "\u2558",
1552
- br: "\u255B",
1553
- h: "\u2550",
1554
- v: "\u2502"
1555
- },
1556
- singleDoubleRounded: {
1557
- tl: "\u256D",
1558
- tr: "\u256E",
1559
- bl: "\u2570",
1560
- br: "\u256F",
1561
- h: "\u2550",
1562
- v: "\u2502"
1563
- },
1564
- rounded: {
1565
- tl: "\u256D",
1566
- tr: "\u256E",
1567
- bl: "\u2570",
1568
- br: "\u256F",
1569
- h: "\u2500",
1570
- v: "\u2502"
1571
- }
1572
- };
1573
- var defaultStyle = {
1574
- borderColor: "white",
1575
- borderStyle: "rounded",
1576
- valign: "center",
1577
- padding: 2,
1578
- marginLeft: 1,
1579
- marginTop: 1,
1580
- marginBottom: 1
1581
- };
1582
- function box(text, _opts = {}) {
1583
- const opts = {
1584
- ..._opts,
1585
- style: {
1586
- ...defaultStyle,
1587
- ..._opts.style
1588
- }
1589
- };
1590
- const textLines = text.split("\n");
1591
- const boxLines = [];
1592
- const _color = getColor(opts.style.borderColor);
1593
- const borderStyle = {
1594
- ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
1595
- };
1596
- if (_color) {
1597
- for (const key in borderStyle) {
1598
- borderStyle[key] = _color(
1599
- borderStyle[key]
1600
- );
1601
- }
1602
- }
1603
- const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
1604
- const height = textLines.length + paddingOffset;
1605
- const width = Math.max(
1606
- ...textLines.map((line) => stripAnsi(line).length),
1607
- opts.title ? stripAnsi(opts.title).length : 0
1608
- ) + paddingOffset;
1609
- const widthOffset = width + paddingOffset;
1610
- const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
1611
- if (opts.style.marginTop > 0) {
1612
- boxLines.push("".repeat(opts.style.marginTop));
1613
- }
1614
- if (opts.title) {
1615
- const title = _color ? _color(opts.title) : opts.title;
1616
- const left = borderStyle.h.repeat(
1617
- Math.floor((width - stripAnsi(opts.title).length) / 2)
1618
- );
1619
- const right = borderStyle.h.repeat(
1620
- width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
1621
- );
1622
- boxLines.push(
1623
- `${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`
1624
- );
1625
- } else {
1626
- boxLines.push(
1627
- `${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
1628
- );
1629
- }
1630
- const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
1631
- for (let i2 = 0; i2 < height; i2++) {
1632
- if (i2 < valignOffset || i2 >= valignOffset + textLines.length) {
1633
- boxLines.push(
1634
- `${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
1635
- );
1636
- } else {
1637
- const line = textLines[i2 - valignOffset];
1638
- const left = " ".repeat(paddingOffset);
1639
- const right = " ".repeat(width - stripAnsi(line).length);
1640
- boxLines.push(
1641
- `${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
1642
- );
1643
- }
1644
- }
1645
- boxLines.push(
1646
- `${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
1647
- );
1648
- if (opts.style.marginBottom > 0) {
1649
- boxLines.push("".repeat(opts.style.marginBottom));
1650
- }
1651
- return boxLines.join("\n");
1652
- }
1653
- __name(box, "box");
1654
- var r2 = /* @__PURE__ */ Object.create(null);
1655
- var i = /* @__PURE__ */ __name((e2) => globalThis.process?.env || undefined || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e2 ? r2 : globalThis), "i");
1656
- var o2 = new Proxy(r2, { get(e2, s2) {
1657
- return i()[s2] ?? r2[s2];
1658
- }, has(e2, s2) {
1659
- const E = i();
1660
- return s2 in E || s2 in r2;
1661
- }, set(e2, s2, E) {
1662
- const B2 = i(true);
1663
- return B2[s2] = E, true;
1664
- }, deleteProperty(e2, s2) {
1665
- if (!s2) return false;
1666
- const E = i(true);
1667
- return delete E[s2], true;
1668
- }, ownKeys() {
1669
- const e2 = i(true);
1670
- return Object.keys(e2);
1671
- } });
1672
- var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
1673
- 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 }]];
1674
- function b() {
1675
- if (globalThis.process?.env) for (const e2 of f2) {
1676
- const s2 = e2[1] || e2[0];
1677
- if (globalThis.process?.env[s2]) return { name: e2[0].toLowerCase(), ...e2[2] };
1678
- }
1679
- return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? { name: "stackblitz", ci: false } : { name: "", ci: false };
1680
- }
1681
- __name(b, "b");
1682
- var l = b();
1683
- l.name;
1684
- function n(e2) {
1685
- return e2 ? e2 !== "false" : false;
1686
- }
1687
- __name(n, "n");
1688
- var I2 = globalThis.process?.platform || "";
1689
- var T2 = n(o2.CI) || l.ci !== false;
1690
- var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
1691
- var g2 = n(o2.DEBUG);
1692
- var R2 = t === "test" || n(o2.TEST);
1693
- n(o2.MINIMAL) || T2 || R2 || !a;
1694
- var A2 = /^win/i.test(I2);
1695
- !n(o2.NO_COLOR) && (n(o2.FORCE_COLOR) || (a || A2) && o2.TERM !== "dumb" || T2);
1696
- var C2 = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
1697
- Number(C2?.split(".")[0]) || null;
1698
- var y2 = globalThis.process || /* @__PURE__ */ Object.create(null);
1699
- var _2 = { versions: {} };
1700
- new Proxy(y2, { get(e2, s2) {
1701
- if (s2 === "env") return o2;
1702
- if (s2 in e2) return e2[s2];
1703
- if (s2 in _2) return _2[s2];
1704
- } });
1705
- var c2 = globalThis.process?.release?.name === "node";
1706
- var O2 = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
1707
- var D = !!globalThis.Deno;
1708
- var L2 = !!globalThis.fastly;
1709
- var S2 = !!globalThis.Netlify;
1710
- var u2 = !!globalThis.EdgeRuntime;
1711
- var N2 = globalThis.navigator?.userAgent === "Cloudflare-Workers";
1712
- var F2 = [[S2, "netlify"], [u2, "edge-light"], [N2, "workerd"], [L2, "fastly"], [D, "deno"], [O2, "bun"], [c2, "node"]];
1713
- function G2() {
1714
- const e2 = F2.find((s2) => s2[0]);
1715
- if (e2) return { name: e2[1] };
1716
- }
1717
- __name(G2, "G");
1718
- var P2 = G2();
1719
- P2?.name || "";
1720
- function ansiRegex2({ onlyFirst = false } = {}) {
1721
- const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
1722
- const pattern = [
1723
- `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
1724
- "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
1725
- ].join("|");
1726
- return new RegExp(pattern, onlyFirst ? void 0 : "g");
1727
- }
1728
- __name(ansiRegex2, "ansiRegex");
1729
- var regex = ansiRegex2();
1730
- function stripAnsi2(string) {
1731
- if (typeof string !== "string") {
1732
- throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
1733
- }
1734
- return string.replace(regex, "");
1735
- }
1736
- __name(stripAnsi2, "stripAnsi");
1737
- function isAmbiguous(x2) {
1738
- 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;
1739
- }
1740
- __name(isAmbiguous, "isAmbiguous");
1741
- function isFullWidth(x2) {
1742
- return x2 === 12288 || x2 >= 65281 && x2 <= 65376 || x2 >= 65504 && x2 <= 65510;
1743
- }
1744
- __name(isFullWidth, "isFullWidth");
1745
- function isWide(x2) {
1746
- 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;
1747
- }
1748
- __name(isWide, "isWide");
1749
- function validate(codePoint) {
1750
- if (!Number.isSafeInteger(codePoint)) {
1751
- throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
1752
- }
1753
- }
1754
- __name(validate, "validate");
1755
- function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
1756
- validate(codePoint);
1757
- if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
1758
- return 2;
1759
- }
1760
- return 1;
1761
- }
1762
- __name(eastAsianWidth, "eastAsianWidth");
1763
- var emojiRegex = /* @__PURE__ */ __name(() => {
1764
- 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;
1765
- }, "emojiRegex");
1766
- var segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: /* @__PURE__ */ __name((str) => str.split(""), "segment") };
1767
- var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
1768
- function stringWidth$1(string, options = {}) {
1769
- if (typeof string !== "string" || string.length === 0) {
1770
- return 0;
1771
- }
1772
- const {
1773
- ambiguousIsNarrow = true,
1774
- countAnsiEscapeCodes = false
1775
- } = options;
1776
- if (!countAnsiEscapeCodes) {
1777
- string = stripAnsi2(string);
1778
- }
1779
- if (string.length === 0) {
1780
- return 0;
1781
- }
1782
- let width = 0;
1783
- const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
1784
- for (const { segment: character } of segmenter.segment(string)) {
1785
- const codePoint = character.codePointAt(0);
1786
- if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
1787
- continue;
1788
- }
1789
- if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
1790
- continue;
1791
- }
1792
- if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
1793
- continue;
1794
- }
1795
- if (codePoint >= 55296 && codePoint <= 57343) {
1796
- continue;
1797
- }
1798
- if (codePoint >= 65024 && codePoint <= 65039) {
1799
- continue;
1800
- }
1801
- if (defaultIgnorableCodePointRegex.test(character)) {
1802
- continue;
1803
- }
1804
- if (emojiRegex().test(character)) {
1805
- width += 2;
1806
- continue;
1807
- }
1808
- width += eastAsianWidth(codePoint, eastAsianWidthOptions);
1809
- }
1810
- return width;
1811
- }
1812
- __name(stringWidth$1, "stringWidth$1");
1813
- function isUnicodeSupported() {
1814
- const { env: env2 } = g__default.default;
1815
- const { TERM, TERM_PROGRAM } = env2;
1816
- if (g__default.default.platform !== "win32") {
1817
- return TERM !== "linux";
1818
- }
1819
- 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";
1820
- }
1821
- __name(isUnicodeSupported, "isUnicodeSupported");
1822
- var TYPE_COLOR_MAP = {
1823
- info: "cyan",
1824
- fail: "red",
1825
- success: "green",
1826
- ready: "green",
1827
- start: "magenta"
1828
- };
1829
- var LEVEL_COLOR_MAP = {
1830
- 0: "red",
1831
- 1: "yellow"
1832
- };
1833
- var unicode = isUnicodeSupported();
1834
- var s = /* @__PURE__ */ __name((c3, fallback) => unicode ? c3 : fallback, "s");
1835
- var TYPE_ICONS = {
1836
- error: s("\u2716", "\xD7"),
1837
- fatal: s("\u2716", "\xD7"),
1838
- ready: s("\u2714", "\u221A"),
1839
- warn: s("\u26A0", "\u203C"),
1840
- info: s("\u2139", "i"),
1841
- success: s("\u2714", "\u221A"),
1842
- debug: s("\u2699", "D"),
1843
- trace: s("\u2192", "\u2192"),
1844
- fail: s("\u2716", "\xD7"),
1845
- start: s("\u25D0", "o"),
1846
- log: ""
1847
- };
1848
- function stringWidth(str) {
1849
- const hasICU = typeof Intl === "object";
1850
- if (!hasICU || !Intl.Segmenter) {
1851
- return stripAnsi(str).length;
1852
- }
1853
- return stringWidth$1(str);
1854
- }
1855
- __name(stringWidth, "stringWidth");
1856
- var FancyReporter = class extends BasicReporter {
1857
- static {
1858
- __name(this, "FancyReporter");
1859
- }
1860
- formatStack(stack, message, opts) {
1861
- const indent = " ".repeat((opts?.errorLevel || 0) + 1);
1862
- return `
1863
- ${indent}` + parseStack(stack, message).map(
1864
- (line) => " " + line.replace(/^at +/, (m2) => colors.gray(m2)).replace(/\((.+)\)/, (_3, m2) => `(${colors.cyan(m2)})`)
1865
- ).join(`
1866
- ${indent}`);
1867
- }
1868
- formatType(logObj, isBadge, opts) {
1869
- const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
1870
- if (isBadge) {
1871
- return getBgColor(typeColor)(
1872
- colors.black(` ${logObj.type.toUpperCase()} `)
1873
- );
1874
- }
1875
- const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
1876
- return _type ? getColor2(typeColor)(_type) : "";
1877
- }
1878
- formatLogObj(logObj, opts) {
1879
- const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
1880
- "\n"
1881
- );
1882
- if (logObj.type === "box") {
1883
- return box(
1884
- characterFormat(
1885
- message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
1886
- ),
1887
- {
1888
- title: logObj.title ? characterFormat(logObj.title) : void 0,
1889
- style: logObj.style
1890
- }
1891
- );
1892
- }
1893
- const date = this.formatDate(logObj.date, opts);
1894
- const coloredDate = date && colors.gray(date);
1895
- const isBadge = logObj.badge ?? logObj.level < 2;
1896
- const type = this.formatType(logObj, isBadge, opts);
1897
- const tag = logObj.tag ? colors.gray(logObj.tag) : "";
1898
- let line;
1899
- const left = this.filterAndJoin([type, characterFormat(message)]);
1900
- const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
1901
- const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
1902
- line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
1903
- line += characterFormat(
1904
- additional.length > 0 ? "\n" + additional.join("\n") : ""
1905
- );
1906
- if (logObj.type === "trace") {
1907
- const _err = new Error("Trace: " + logObj.message);
1908
- line += this.formatStack(_err.stack || "", _err.message);
1909
- }
1910
- return isBadge ? "\n" + line + "\n" : line;
1911
- }
1912
- };
1913
- function characterFormat(str) {
1914
- return str.replace(/`([^`]+)`/gm, (_3, m2) => colors.cyan(m2)).replace(/\s+_([^_]+)_\s+/gm, (_3, m2) => ` ${colors.underline(m2)} `);
1915
- }
1916
- __name(characterFormat, "characterFormat");
1917
- function getColor2(color = "white") {
1918
- return colors[color] || colors.white;
1919
- }
1920
- __name(getColor2, "getColor");
1921
- function getBgColor(color = "bgWhite") {
1922
- return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
1923
- }
1924
- __name(getBgColor, "getBgColor");
1925
- function createConsola2(options = {}) {
1926
- let level = _getDefaultLogLevel();
1927
- if (process.env.CONSOLA_LEVEL) {
1928
- level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
1929
- }
1930
- const consola2 = createConsola({
1931
- level,
1932
- defaults: { level },
1933
- stdout: process.stdout,
1934
- stderr: process.stderr,
1935
- prompt: /* @__PURE__ */ __name((...args) => Promise.resolve().then(() => (init_prompt(), prompt_exports)).then((m2) => m2.prompt(...args)), "prompt"),
1936
- reporters: options.reporters || [
1937
- options.fancy ?? !(T2 || R2) ? new FancyReporter() : new BasicReporter()
1938
- ],
1939
- ...options
1940
- });
1941
- return consola2;
1942
- }
1943
- __name(createConsola2, "createConsola");
1944
- function _getDefaultLogLevel() {
1945
- if (g2) {
1946
- return LogLevels.debug;
1947
- }
1948
- if (R2) {
1949
- return LogLevels.warn;
1950
- }
1951
- return LogLevels.info;
1952
- }
1953
- __name(_getDefaultLogLevel, "_getDefaultLogLevel");
1954
- var consola = createConsola2();
1955
-
1956
- // ../../node_modules/.pnpm/citty@0.1.6/node_modules/citty/dist/index.mjs
1957
- function toArray(val) {
1958
- if (Array.isArray(val)) {
1959
- return val;
1960
- }
1961
- return val === void 0 ? [] : [val];
1962
- }
1963
- __name(toArray, "toArray");
1964
- function formatLineColumns(lines, linePrefix = "") {
1965
- const maxLengh = [];
1966
- for (const line of lines) {
1967
- for (const [i2, element] of line.entries()) {
1968
- maxLengh[i2] = Math.max(maxLengh[i2] || 0, element.length);
1969
- }
1970
- }
1971
- return lines.map(
1972
- (l2) => l2.map(
1973
- (c3, i2) => linePrefix + c3[i2 === 0 ? "padStart" : "padEnd"](maxLengh[i2])
1974
- ).join(" ")
1975
- ).join("\n");
1976
- }
1977
- __name(formatLineColumns, "formatLineColumns");
1978
- function resolveValue(input) {
1979
- return typeof input === "function" ? input() : input;
1980
- }
1981
- __name(resolveValue, "resolveValue");
1982
- var CLIError = class extends Error {
1983
- static {
1984
- __name(this, "CLIError");
1985
- }
1986
- constructor(message, code) {
1987
- super(message);
1988
- this.code = code;
1989
- this.name = "CLIError";
1990
- }
1991
- };
1992
- var NUMBER_CHAR_RE = /\d/;
1993
- var STR_SPLITTERS = ["-", "_", "/", "."];
1994
- function isUppercase(char = "") {
1995
- if (NUMBER_CHAR_RE.test(char)) {
1996
- return void 0;
1997
- }
1998
- return char !== char.toLowerCase();
1999
- }
2000
- __name(isUppercase, "isUppercase");
2001
- function splitByCase(str, separators) {
2002
- const splitters = separators ?? STR_SPLITTERS;
2003
- const parts = [];
2004
- if (!str || typeof str !== "string") {
2005
- return parts;
2006
- }
2007
- let buff = "";
2008
- let previousUpper;
2009
- let previousSplitter;
2010
- for (const char of str) {
2011
- const isSplitter = splitters.includes(char);
2012
- if (isSplitter === true) {
2013
- parts.push(buff);
2014
- buff = "";
2015
- previousUpper = void 0;
2016
- continue;
2017
- }
2018
- const isUpper = isUppercase(char);
2019
- if (previousSplitter === false) {
2020
- if (previousUpper === false && isUpper === true) {
2021
- parts.push(buff);
2022
- buff = char;
2023
- previousUpper = isUpper;
2024
- continue;
2025
- }
2026
- if (previousUpper === true && isUpper === false && buff.length > 1) {
2027
- const lastChar = buff.at(-1);
2028
- parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
2029
- buff = lastChar + char;
2030
- previousUpper = isUpper;
2031
- continue;
2032
- }
2033
- }
2034
- buff += char;
2035
- previousUpper = isUpper;
2036
- previousSplitter = isSplitter;
2037
- }
2038
- parts.push(buff);
2039
- return parts;
2040
- }
2041
- __name(splitByCase, "splitByCase");
2042
- function upperFirst(str) {
2043
- return str ? str[0].toUpperCase() + str.slice(1) : "";
2044
- }
2045
- __name(upperFirst, "upperFirst");
2046
- function lowerFirst(str) {
2047
- return str ? str[0].toLowerCase() + str.slice(1) : "";
2048
- }
2049
- __name(lowerFirst, "lowerFirst");
2050
- function pascalCase(str, opts) {
2051
- return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
2052
- }
2053
- __name(pascalCase, "pascalCase");
2054
- function camelCase(str, opts) {
2055
- return lowerFirst(pascalCase(str || "", opts));
2056
- }
2057
- __name(camelCase, "camelCase");
2058
- function kebabCase(str, joiner) {
2059
- return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
2060
- }
2061
- __name(kebabCase, "kebabCase");
2062
- function toArr(any) {
2063
- return any == void 0 ? [] : Array.isArray(any) ? any : [any];
2064
- }
2065
- __name(toArr, "toArr");
2066
- function toVal(out, key, val, opts) {
2067
- let x2;
2068
- const old = out[key];
2069
- 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;
2070
- out[key] = old == void 0 ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
2071
- }
2072
- __name(toVal, "toVal");
2073
- function parseRawArgs(args = [], opts = {}) {
2074
- let k2;
2075
- let arr;
2076
- let arg;
2077
- let name;
2078
- let val;
2079
- const out = { _: [] };
2080
- let i2 = 0;
2081
- let j = 0;
2082
- let idx = 0;
2083
- const len = args.length;
2084
- const alibi = opts.alias !== void 0;
2085
- const strict = opts.unknown !== void 0;
2086
- const defaults = opts.default !== void 0;
2087
- opts.alias = opts.alias || {};
2088
- opts.string = toArr(opts.string);
2089
- opts.boolean = toArr(opts.boolean);
2090
- if (alibi) {
2091
- for (k2 in opts.alias) {
2092
- arr = opts.alias[k2] = toArr(opts.alias[k2]);
2093
- for (i2 = 0; i2 < arr.length; i2++) {
2094
- (opts.alias[arr[i2]] = arr.concat(k2)).splice(i2, 1);
2095
- }
2096
- }
2097
- }
2098
- for (i2 = opts.boolean.length; i2-- > 0; ) {
2099
- arr = opts.alias[opts.boolean[i2]] || [];
2100
- for (j = arr.length; j-- > 0; ) {
2101
- opts.boolean.push(arr[j]);
2102
- }
2103
- }
2104
- for (i2 = opts.string.length; i2-- > 0; ) {
2105
- arr = opts.alias[opts.string[i2]] || [];
2106
- for (j = arr.length; j-- > 0; ) {
2107
- opts.string.push(arr[j]);
2108
- }
2109
- }
2110
- if (defaults) {
2111
- for (k2 in opts.default) {
2112
- name = typeof opts.default[k2];
2113
- arr = opts.alias[k2] = opts.alias[k2] || [];
2114
- if (opts[name] !== void 0) {
2115
- opts[name].push(k2);
2116
- for (i2 = 0; i2 < arr.length; i2++) {
2117
- opts[name].push(arr[i2]);
2118
- }
2119
- }
2120
- }
2121
- }
2122
- const keys = strict ? Object.keys(opts.alias) : [];
2123
- for (i2 = 0; i2 < len; i2++) {
2124
- arg = args[i2];
2125
- if (arg === "--") {
2126
- out._ = out._.concat(args.slice(++i2));
2127
- break;
2128
- }
2129
- for (j = 0; j < arg.length; j++) {
2130
- if (arg.charCodeAt(j) !== 45) {
2131
- break;
2132
- }
2133
- }
2134
- if (j === 0) {
2135
- out._.push(arg);
2136
- } else if (arg.substring(j, j + 3) === "no-") {
2137
- name = arg.slice(Math.max(0, j + 3));
2138
- if (strict && !~keys.indexOf(name)) {
2139
- return opts.unknown(arg);
2140
- }
2141
- out[name] = false;
2142
- } else {
2143
- for (idx = j + 1; idx < arg.length; idx++) {
2144
- if (arg.charCodeAt(idx) === 61) {
2145
- break;
2146
- }
2147
- }
2148
- name = arg.substring(j, idx);
2149
- val = arg.slice(Math.max(0, ++idx)) || i2 + 1 === len || ("" + args[i2 + 1]).charCodeAt(0) === 45 || args[++i2];
2150
- arr = j === 2 ? [name] : name;
2151
- for (idx = 0; idx < arr.length; idx++) {
2152
- name = arr[idx];
2153
- if (strict && !~keys.indexOf(name)) {
2154
- return opts.unknown("-".repeat(j) + name);
2155
- }
2156
- toVal(out, name, idx + 1 < arr.length || val, opts);
2157
- }
2158
- }
2159
- }
2160
- if (defaults) {
2161
- for (k2 in opts.default) {
2162
- if (out[k2] === void 0) {
2163
- out[k2] = opts.default[k2];
2164
- }
2165
- }
2166
- }
2167
- if (alibi) {
2168
- for (k2 in out) {
2169
- arr = opts.alias[k2] || [];
2170
- while (arr.length > 0) {
2171
- out[arr.shift()] = out[k2];
2172
- }
2173
- }
2174
- }
2175
- return out;
2176
- }
2177
- __name(parseRawArgs, "parseRawArgs");
2178
- function parseArgs(rawArgs, argsDef) {
2179
- const parseOptions = {
2180
- boolean: [],
2181
- string: [],
2182
- mixed: [],
2183
- alias: {},
2184
- default: {}
2185
- };
2186
- const args = resolveArgs(argsDef);
2187
- for (const arg of args) {
2188
- if (arg.type === "positional") {
2189
- continue;
2190
- }
2191
- if (arg.type === "string") {
2192
- parseOptions.string.push(arg.name);
2193
- } else if (arg.type === "boolean") {
2194
- parseOptions.boolean.push(arg.name);
2195
- }
2196
- if (arg.default !== void 0) {
2197
- parseOptions.default[arg.name] = arg.default;
2198
- }
2199
- if (arg.alias) {
2200
- parseOptions.alias[arg.name] = arg.alias;
2201
- }
2202
- }
2203
- const parsed = parseRawArgs(rawArgs, parseOptions);
2204
- const [...positionalArguments] = parsed._;
2205
- const parsedArgsProxy = new Proxy(parsed, {
2206
- get(target, prop) {
2207
- return target[prop] ?? target[camelCase(prop)] ?? target[kebabCase(prop)];
2208
- }
2209
- });
2210
- for (const [, arg] of args.entries()) {
2211
- if (arg.type === "positional") {
2212
- const nextPositionalArgument = positionalArguments.shift();
2213
- if (nextPositionalArgument !== void 0) {
2214
- parsedArgsProxy[arg.name] = nextPositionalArgument;
2215
- } else if (arg.default === void 0 && arg.required !== false) {
2216
- throw new CLIError(
2217
- `Missing required positional argument: ${arg.name.toUpperCase()}`,
2218
- "EARG"
2219
- );
2220
- } else {
2221
- parsedArgsProxy[arg.name] = arg.default;
2222
- }
2223
- } else if (arg.required && parsedArgsProxy[arg.name] === void 0) {
2224
- throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");
2225
- }
2226
- }
2227
- return parsedArgsProxy;
2228
- }
2229
- __name(parseArgs, "parseArgs");
2230
- function resolveArgs(argsDef) {
2231
- const args = [];
2232
- for (const [name, argDef] of Object.entries(argsDef || {})) {
2233
- args.push({
2234
- ...argDef,
2235
- name,
2236
- alias: toArray(argDef.alias)
2237
- });
2238
- }
2239
- return args;
2240
- }
2241
- __name(resolveArgs, "resolveArgs");
2242
- function defineCommand(def) {
2243
- return def;
2244
- }
2245
- __name(defineCommand, "defineCommand");
2246
- async function runCommand(cmd, opts) {
2247
- const cmdArgs = await resolveValue(cmd.args || {});
2248
- const parsedArgs = parseArgs(opts.rawArgs, cmdArgs);
2249
- const context = {
2250
- rawArgs: opts.rawArgs,
2251
- args: parsedArgs,
2252
- data: opts.data,
2253
- cmd
2254
- };
2255
- if (typeof cmd.setup === "function") {
2256
- await cmd.setup(context);
2257
- }
2258
- let result;
2259
- try {
2260
- const subCommands = await resolveValue(cmd.subCommands);
2261
- if (subCommands && Object.keys(subCommands).length > 0) {
2262
- const subCommandArgIndex = opts.rawArgs.findIndex(
2263
- (arg) => !arg.startsWith("-")
2264
- );
2265
- const subCommandName = opts.rawArgs[subCommandArgIndex];
2266
- if (subCommandName) {
2267
- if (!subCommands[subCommandName]) {
2268
- throw new CLIError(
2269
- `Unknown command \`${subCommandName}\``,
2270
- "E_UNKNOWN_COMMAND"
2271
- );
2272
- }
2273
- const subCommand = await resolveValue(subCommands[subCommandName]);
2274
- if (subCommand) {
2275
- await runCommand(subCommand, {
2276
- rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1)
2277
- });
2278
- }
2279
- } else if (!cmd.run) {
2280
- throw new CLIError(`No command specified.`, "E_NO_COMMAND");
2281
- }
2282
- }
2283
- if (typeof cmd.run === "function") {
2284
- result = await cmd.run(context);
2285
- }
2286
- } finally {
2287
- if (typeof cmd.cleanup === "function") {
2288
- await cmd.cleanup(context);
2289
- }
2290
- }
2291
- return { result };
2292
- }
2293
- __name(runCommand, "runCommand");
2294
- async function resolveSubCommand(cmd, rawArgs, parent) {
2295
- const subCommands = await resolveValue(cmd.subCommands);
2296
- if (subCommands && Object.keys(subCommands).length > 0) {
2297
- const subCommandArgIndex = rawArgs.findIndex((arg) => !arg.startsWith("-"));
2298
- const subCommandName = rawArgs[subCommandArgIndex];
2299
- const subCommand = await resolveValue(subCommands[subCommandName]);
2300
- if (subCommand) {
2301
- return resolveSubCommand(
2302
- subCommand,
2303
- rawArgs.slice(subCommandArgIndex + 1),
2304
- cmd
2305
- );
2306
- }
2307
- }
2308
- return [cmd, parent];
2309
- }
2310
- __name(resolveSubCommand, "resolveSubCommand");
2311
- async function showUsage(cmd, parent) {
2312
- try {
2313
- consola.log(await renderUsage(cmd, parent) + "\n");
2314
- } catch (error) {
2315
- consola.error(error);
2316
- }
2317
- }
2318
- __name(showUsage, "showUsage");
2319
- async function renderUsage(cmd, parent) {
2320
- const cmdMeta = await resolveValue(cmd.meta || {});
2321
- const cmdArgs = resolveArgs(await resolveValue(cmd.args || {}));
2322
- const parentMeta = await resolveValue(parent?.meta || {});
2323
- const commandName = `${parentMeta.name ? `${parentMeta.name} ` : ""}` + (cmdMeta.name || process.argv[1]);
2324
- const argLines = [];
2325
- const posLines = [];
2326
- const commandsLines = [];
2327
- const usageLine = [];
2328
- for (const arg of cmdArgs) {
2329
- if (arg.type === "positional") {
2330
- const name = arg.name.toUpperCase();
2331
- const isRequired = arg.required !== false && arg.default === void 0;
2332
- const defaultHint = arg.default ? `="${arg.default}"` : "";
2333
- posLines.push([
2334
- "`" + name + defaultHint + "`",
2335
- arg.description || "",
2336
- arg.valueHint ? `<${arg.valueHint}>` : ""
2337
- ]);
2338
- usageLine.push(isRequired ? `<${name}>` : `[${name}]`);
2339
- } else {
2340
- const isRequired = arg.required === true && arg.default === void 0;
2341
- const argStr = (arg.type === "boolean" && arg.default === true ? [
2342
- ...(arg.alias || []).map((a2) => `--no-${a2}`),
2343
- `--no-${arg.name}`
2344
- ].join(", ") : [...(arg.alias || []).map((a2) => `-${a2}`), `--${arg.name}`].join(
2345
- ", "
2346
- )) + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "");
2347
- argLines.push([
2348
- "`" + argStr + (isRequired ? " (required)" : "") + "`",
2349
- arg.description || ""
2350
- ]);
2351
- if (isRequired) {
2352
- usageLine.push(argStr);
2353
- }
2354
- }
2355
- }
2356
- if (cmd.subCommands) {
2357
- const commandNames = [];
2358
- const subCommands = await resolveValue(cmd.subCommands);
2359
- for (const [name, sub] of Object.entries(subCommands)) {
2360
- const subCmd = await resolveValue(sub);
2361
- const meta = await resolveValue(subCmd?.meta);
2362
- commandsLines.push([`\`${name}\``, meta?.description || ""]);
2363
- commandNames.push(name);
2364
- }
2365
- usageLine.push(commandNames.join("|"));
2366
- }
2367
- const usageLines = [];
2368
- const version = cmdMeta.version || parentMeta.version;
2369
- usageLines.push(
2370
- colors.gray(
2371
- `${cmdMeta.description} (${commandName + (version ? ` v${version}` : "")})`
2372
- ),
2373
- ""
2374
- );
2375
- const hasOptions = argLines.length > 0 || posLines.length > 0;
2376
- usageLines.push(
2377
- `${colors.underline(colors.bold("USAGE"))} \`${commandName}${hasOptions ? " [OPTIONS]" : ""} ${usageLine.join(" ")}\``,
2378
- ""
2379
- );
2380
- if (posLines.length > 0) {
2381
- usageLines.push(colors.underline(colors.bold("ARGUMENTS")), "");
2382
- usageLines.push(formatLineColumns(posLines, " "));
2383
- usageLines.push("");
2384
- }
2385
- if (argLines.length > 0) {
2386
- usageLines.push(colors.underline(colors.bold("OPTIONS")), "");
2387
- usageLines.push(formatLineColumns(argLines, " "));
2388
- usageLines.push("");
2389
- }
2390
- if (commandsLines.length > 0) {
2391
- usageLines.push(colors.underline(colors.bold("COMMANDS")), "");
2392
- usageLines.push(formatLineColumns(commandsLines, " "));
2393
- usageLines.push(
2394
- "",
2395
- `Use \`${commandName} <command> --help\` for more information about a command.`
2396
- );
2397
- }
2398
- return usageLines.filter((l2) => typeof l2 === "string").join("\n");
2399
- }
2400
- __name(renderUsage, "renderUsage");
2401
- async function runMain(cmd, opts = {}) {
2402
- const rawArgs = opts.rawArgs || process.argv.slice(2);
2403
- const showUsage$1 = opts.showUsage || showUsage;
2404
- try {
2405
- if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
2406
- await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
2407
- process.exit(0);
2408
- } else if (rawArgs.length === 1 && rawArgs[0] === "--version") {
2409
- const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
2410
- if (!meta?.version) {
2411
- throw new CLIError("No version specified", "E_NO_VERSION");
2412
- }
2413
- consola.log(meta.version);
2414
- } else {
2415
- await runCommand(cmd, { rawArgs });
2416
- }
2417
- } catch (error) {
2418
- const isCLIError = error instanceof CLIError;
2419
- if (!isCLIError) {
2420
- consola.error(error, "\n");
2421
- }
2422
- if (isCLIError) {
2423
- await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
2424
- }
2425
- consola.error(error.message);
2426
- process.exit(1);
2427
- }
2428
- }
2429
- __name(runMain, "runMain");
2430
-
2431
- // src/cli/init.ts
2432
12
  var __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('init.js', document.baseURI).href)));
2433
13
  var __dirname$1 = path.dirname(__filename$1);
2434
- var main = defineCommand({
14
+ var main = citty.defineCommand({
2435
15
  meta: {
2436
16
  name: "nestjs-ssr",
2437
17
  description: "Initialize @nestjs-ssr/react in your NestJS project",
@@ -2447,82 +27,69 @@ var main = defineCommand({
2447
27
  type: "string",
2448
28
  description: "Views directory path",
2449
29
  default: "src/views"
30
+ },
31
+ "skip-install": {
32
+ type: "boolean",
33
+ description: "Skip automatic dependency installation",
34
+ default: false
2450
35
  }
2451
36
  },
2452
37
  async run({ args }) {
2453
38
  const cwd = process.cwd();
2454
39
  const viewsDir = args.views;
2455
- consola.box("@nestjs-ssr/react initialization");
2456
- consola.start("Setting up your NestJS SSR React project...\n");
40
+ consola.consola.box("@nestjs-ssr/react initialization");
41
+ consola.consola.start("Setting up your NestJS SSR React project...\n");
2457
42
  const templateLocations = [
2458
43
  path.resolve(__dirname$1, "../../src/templates"),
2459
44
  path.resolve(__dirname$1, "../templates")
2460
45
  ];
2461
46
  const templateDir = templateLocations.find((loc) => fs.existsSync(path.join(loc, "entry-client.tsx")));
2462
47
  if (!templateDir) {
2463
- consola.error("Failed to locate template files");
2464
- consola.info("Searched:", templateLocations);
2465
- process.exit(1);
2466
- }
2467
- const globalTypesLocations = [
2468
- path.resolve(__dirname$1, "../../src/global.d.ts"),
2469
- path.resolve(__dirname$1, "../global.d.ts")
2470
- ];
2471
- const globalTypesSrc = globalTypesLocations.find((loc) => fs.existsSync(loc));
2472
- if (!globalTypesSrc) {
2473
- consola.error("Failed to locate global.d.ts");
2474
- consola.info("Searched:", globalTypesLocations);
48
+ consola.consola.error("Failed to locate template files");
49
+ consola.consola.info("Searched:", templateLocations);
2475
50
  process.exit(1);
2476
51
  }
2477
52
  const tsconfigPath = path.join(cwd, "tsconfig.json");
2478
53
  if (!fs.existsSync(tsconfigPath)) {
2479
- consola.error("No tsconfig.json found in project root");
2480
- consola.info("Please create a tsconfig.json file first");
54
+ consola.consola.error("No tsconfig.json found in project root");
55
+ consola.consola.info("Please create a tsconfig.json file first");
2481
56
  process.exit(1);
2482
57
  }
2483
- consola.start("Creating entry-client.tsx...");
58
+ consola.consola.start("Creating entry-client.tsx...");
2484
59
  const entryClientSrc = path.join(templateDir, "entry-client.tsx");
2485
60
  const entryClientDest = path.join(cwd, viewsDir, "entry-client.tsx");
2486
61
  fs.mkdirSync(path.join(cwd, viewsDir), {
2487
62
  recursive: true
2488
63
  });
2489
64
  if (fs.existsSync(entryClientDest) && !args.force) {
2490
- consola.warn(`${viewsDir}/entry-client.tsx already exists (use --force to overwrite)`);
65
+ consola.consola.warn(`${viewsDir}/entry-client.tsx already exists (use --force to overwrite)`);
2491
66
  } else {
2492
67
  fs.copyFileSync(entryClientSrc, entryClientDest);
2493
- consola.success(`Created ${viewsDir}/entry-client.tsx`);
68
+ consola.consola.success(`Created ${viewsDir}/entry-client.tsx`);
2494
69
  }
2495
- consola.start("Creating entry-server.tsx...");
70
+ consola.consola.start("Creating entry-server.tsx...");
2496
71
  const entryServerSrc = path.join(templateDir, "entry-server.tsx");
2497
72
  const entryServerDest = path.join(cwd, viewsDir, "entry-server.tsx");
2498
73
  if (fs.existsSync(entryServerDest) && !args.force) {
2499
- consola.warn(`${viewsDir}/entry-server.tsx already exists (use --force to overwrite)`);
74
+ consola.consola.warn(`${viewsDir}/entry-server.tsx already exists (use --force to overwrite)`);
2500
75
  } else {
2501
76
  fs.copyFileSync(entryServerSrc, entryServerDest);
2502
- consola.success(`Created ${viewsDir}/entry-server.tsx`);
2503
- }
2504
- consola.start("Creating global.d.ts...");
2505
- const globalTypesDest = path.join(cwd, "src/global.d.ts");
2506
- if (fs.existsSync(globalTypesDest) && !args.force) {
2507
- consola.warn("src/global.d.ts already exists (use --force to overwrite)");
2508
- } else {
2509
- fs.copyFileSync(globalTypesSrc, globalTypesDest);
2510
- consola.success("Created src/global.d.ts");
77
+ consola.consola.success(`Created ${viewsDir}/entry-server.tsx`);
2511
78
  }
2512
- consola.start("Configuring vite.config.js...");
79
+ consola.consola.start("Configuring vite.config.js...");
2513
80
  const viteConfigPath = path.join(cwd, "vite.config.js");
2514
81
  const viteConfigTs = path.join(cwd, "vite.config.ts");
2515
82
  const useTypeScript = fs.existsSync(viteConfigTs);
2516
83
  const configPath = useTypeScript ? viteConfigTs : viteConfigPath;
2517
84
  if (fs.existsSync(configPath)) {
2518
- consola.warn(`${useTypeScript ? "vite.config.ts" : "vite.config.js"} already exists`);
2519
- consola.info("Please manually add to your Vite config:");
2520
- consola.log(" import { resolve } from 'path';");
2521
- consola.log(" build: {");
2522
- consola.log(" rollupOptions: {");
2523
- consola.log(` input: { client: resolve(__dirname, '${viewsDir}/entry-client.tsx') }`);
2524
- consola.log(" }");
2525
- consola.log(" }");
85
+ consola.consola.warn(`${useTypeScript ? "vite.config.ts" : "vite.config.js"} already exists`);
86
+ consola.consola.info("Please manually add to your Vite config:");
87
+ consola.consola.log(" import { resolve } from 'path';");
88
+ consola.consola.log(" build: {");
89
+ consola.consola.log(" rollupOptions: {");
90
+ consola.consola.log(` input: { client: resolve(__dirname, '${viewsDir}/entry-client.tsx') }`);
91
+ consola.consola.log(" }");
92
+ consola.consola.log(" }");
2526
93
  } else {
2527
94
  const viteConfig = `import { defineConfig } from 'vite';
2528
95
  import react from '@vitejs/plugin-react';
@@ -2552,9 +119,9 @@ export default defineConfig({
2552
119
  });
2553
120
  `;
2554
121
  fs.writeFileSync(viteConfigPath, viteConfig);
2555
- consola.success("Created vite.config.js");
122
+ consola.consola.success("Created vite.config.js");
2556
123
  }
2557
- consola.start("Configuring tsconfig.json...");
124
+ consola.consola.start("Configuring tsconfig.json...");
2558
125
  try {
2559
126
  const tsconfig = JSON.parse(fs.readFileSync(tsconfigPath, "utf-8"));
2560
127
  let updated = false;
@@ -2574,67 +141,179 @@ export default defineConfig({
2574
141
  ];
2575
142
  updated = true;
2576
143
  }
2577
- if (!tsconfig.compilerOptions.types) {
2578
- tsconfig.compilerOptions.types = [];
144
+ if (!tsconfig.include) {
145
+ tsconfig.include = [];
146
+ }
147
+ const hasTsx = tsconfig.include.some((pattern) => pattern.includes("**/*.tsx"));
148
+ if (!hasTsx) {
149
+ if (!tsconfig.include.includes("src/**/*.tsx")) {
150
+ tsconfig.include.push("src/**/*.tsx");
151
+ updated = true;
152
+ }
153
+ }
154
+ if (!tsconfig.exclude) {
155
+ tsconfig.exclude = [];
2579
156
  }
2580
- if (!tsconfig.compilerOptions.types.includes("vite/client")) {
2581
- tsconfig.compilerOptions.types.push("vite/client");
157
+ const hasEntryClientExclude = tsconfig.exclude.some((pattern) => pattern.includes("entry-client.tsx"));
158
+ if (!hasEntryClientExclude) {
159
+ tsconfig.exclude.push("src/views/entry-client.tsx");
2582
160
  updated = true;
2583
161
  }
2584
162
  if (updated) {
2585
163
  fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2));
2586
- consola.success("Updated tsconfig.json");
164
+ consola.consola.success("Updated tsconfig.json");
2587
165
  } else {
2588
- consola.info("tsconfig.json already configured");
166
+ consola.consola.info("tsconfig.json already configured");
2589
167
  }
2590
168
  } catch (error) {
2591
- consola.error("Failed to update tsconfig.json:", error);
169
+ consola.consola.error("Failed to update tsconfig.json:", error);
2592
170
  }
2593
- consola.start("Configuring build scripts...");
171
+ consola.consola.start("Configuring tsconfig.build.json...");
172
+ const tsconfigBuildPath = path.join(cwd, "tsconfig.build.json");
173
+ try {
174
+ let tsconfigBuild;
175
+ let buildUpdated = false;
176
+ if (fs.existsSync(tsconfigBuildPath)) {
177
+ tsconfigBuild = JSON.parse(fs.readFileSync(tsconfigBuildPath, "utf-8"));
178
+ } else {
179
+ tsconfigBuild = {
180
+ extends: "./tsconfig.json",
181
+ exclude: [
182
+ "node_modules",
183
+ "test",
184
+ "dist",
185
+ "**/*spec.ts"
186
+ ]
187
+ };
188
+ buildUpdated = true;
189
+ }
190
+ if (!tsconfigBuild.exclude) {
191
+ tsconfigBuild.exclude = [];
192
+ }
193
+ const hasEntryClientExclude = tsconfigBuild.exclude.some((pattern) => pattern.includes("entry-client.tsx"));
194
+ if (!hasEntryClientExclude) {
195
+ tsconfigBuild.exclude.push("src/views/entry-client.tsx");
196
+ buildUpdated = true;
197
+ }
198
+ if (buildUpdated) {
199
+ fs.writeFileSync(tsconfigBuildPath, JSON.stringify(tsconfigBuild, null, 2));
200
+ consola.consola.success("Updated tsconfig.build.json");
201
+ } else {
202
+ consola.consola.info("tsconfig.build.json already configured");
203
+ }
204
+ } catch (error) {
205
+ consola.consola.error("Failed to update tsconfig.build.json:", error);
206
+ }
207
+ consola.consola.start("Configuring nest-cli.json...");
208
+ const nestCliPath = path.join(cwd, "nest-cli.json");
209
+ try {
210
+ if (fs.existsSync(nestCliPath)) {
211
+ const nestCli = JSON.parse(fs.readFileSync(nestCliPath, "utf-8"));
212
+ let nestUpdated = false;
213
+ if (!nestCli.exclude) {
214
+ nestCli.exclude = [];
215
+ }
216
+ const hasEntryClientExclude = nestCli.exclude.some((pattern) => pattern.includes("entry-client.tsx"));
217
+ if (!hasEntryClientExclude) {
218
+ nestCli.exclude.push("**/entry-client.tsx");
219
+ nestUpdated = true;
220
+ }
221
+ if (nestUpdated) {
222
+ fs.writeFileSync(nestCliPath, JSON.stringify(nestCli, null, 2));
223
+ consola.consola.success("Updated nest-cli.json");
224
+ } else {
225
+ consola.consola.info("nest-cli.json already configured");
226
+ }
227
+ } else {
228
+ consola.consola.info("No nest-cli.json found, skipping");
229
+ }
230
+ } catch (error) {
231
+ consola.consola.error("Failed to update nest-cli.json:", error);
232
+ }
233
+ consola.consola.start("Configuring build scripts...");
2594
234
  const packageJsonPath = path.join(cwd, "package.json");
2595
235
  if (!fs.existsSync(packageJsonPath)) {
2596
- consola.warn("No package.json found, skipping build script setup");
236
+ consola.consola.warn("No package.json found, skipping build script setup");
2597
237
  } else {
2598
238
  try {
2599
239
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
2600
240
  if (!packageJson.scripts) {
2601
241
  packageJson.scripts = {};
2602
242
  }
2603
- const existingBuild = packageJson.scripts.build;
2604
- const defaultNestBuild = "nest build";
2605
- const ssrBuildPrefix = "vite build && ";
2606
243
  let shouldUpdate = false;
2607
- let newBuildScript = "";
2608
- if (!existingBuild) {
2609
- newBuildScript = `${ssrBuildPrefix}${defaultNestBuild}`;
244
+ if (!packageJson.scripts["build:client"]) {
245
+ packageJson.scripts["build:client"] = "vite build --ssrManifest --outDir dist/client";
246
+ shouldUpdate = true;
247
+ }
248
+ if (!packageJson.scripts["build:server"]) {
249
+ packageJson.scripts["build:server"] = `vite build --ssr ${viewsDir}/entry-server.tsx --outDir dist/server`;
2610
250
  shouldUpdate = true;
2611
- } else if (existingBuild.includes("vite build")) {
2612
- consola.info("Build script already includes vite build");
2613
- } else if (existingBuild === defaultNestBuild) {
2614
- newBuildScript = `${ssrBuildPrefix}${existingBuild}`;
251
+ }
252
+ const existingBuild = packageJson.scripts.build;
253
+ const recommendedBuild = "pnpm build:client && pnpm build:server && nest build";
254
+ if (!existingBuild) {
255
+ packageJson.scripts.build = recommendedBuild;
2615
256
  shouldUpdate = true;
257
+ } else if (!existingBuild.includes("build:client") || !existingBuild.includes("build:server")) {
258
+ consola.consola.warn(`Found existing build script: "${existingBuild}"`);
259
+ consola.consola.info("SSR requires building client and server bundles");
260
+ consola.consola.info(`Recommended: ${recommendedBuild}`);
261
+ consola.consola.info("Please manually update your build script in package.json");
2616
262
  } else {
2617
- consola.warn(`Found custom build script: "${existingBuild}"`);
2618
- consola.info('SSR requires running "vite build" before your build command');
2619
- consola.info(`Recommended: ${ssrBuildPrefix}${existingBuild}`);
2620
- consola.info("Please manually update your build script in package.json");
263
+ consola.consola.info("Build scripts already configured");
2621
264
  }
2622
265
  if (shouldUpdate) {
2623
- packageJson.scripts.build = newBuildScript;
2624
266
  fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
2625
- consola.success(`Updated build script to: "${newBuildScript}"`);
267
+ consola.consola.success("Updated build scripts in package.json");
268
+ }
269
+ if (!args["skip-install"]) {
270
+ consola.consola.start("Checking dependencies...");
271
+ const requiredDeps = {
272
+ "react": "^19.0.0",
273
+ "react-dom": "^19.0.0",
274
+ "vite": "^7.0.0",
275
+ "@vitejs/plugin-react": "^4.0.0"
276
+ };
277
+ const missingDeps = [];
278
+ const allDeps = {
279
+ ...packageJson.dependencies,
280
+ ...packageJson.devDependencies
281
+ };
282
+ for (const [dep, version] of Object.entries(requiredDeps)) {
283
+ if (!allDeps[dep]) {
284
+ missingDeps.push(`${dep}@${version}`);
285
+ }
286
+ }
287
+ if (missingDeps.length > 0) {
288
+ consola.consola.info(`Missing dependencies: ${missingDeps.join(", ")}`);
289
+ let packageManager = "npm";
290
+ if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) packageManager = "pnpm";
291
+ else if (fs.existsSync(path.join(cwd, "yarn.lock"))) packageManager = "yarn";
292
+ const installCmd = packageManager === "npm" ? `npm install ${missingDeps.join(" ")}` : `${packageManager} add ${missingDeps.join(" ")}`;
293
+ try {
294
+ consola.consola.start(`Installing dependencies with ${packageManager}...`);
295
+ child_process.execSync(installCmd, {
296
+ cwd,
297
+ stdio: "inherit"
298
+ });
299
+ consola.consola.success("Dependencies installed!");
300
+ } catch (error) {
301
+ consola.consola.error("Failed to install dependencies:", error);
302
+ consola.consola.info(`Please manually run: ${installCmd}`);
303
+ }
304
+ } else {
305
+ consola.consola.success("All required dependencies are already installed");
306
+ }
2626
307
  }
2627
308
  } catch (error) {
2628
- consola.error("Failed to update package.json:", error);
309
+ consola.consola.error("Failed to update package.json:", error);
2629
310
  }
2630
311
  }
2631
- consola.success("\nInitialization complete!");
2632
- consola.box("Next steps");
2633
- consola.info(`1. Create your first view component in ${viewsDir}/`);
2634
- consola.info("2. Render it from a NestJS controller using render.render()");
2635
- consola.info("3. Run your dev server with: pnpm start:dev");
312
+ consola.consola.success("\nInitialization complete!");
313
+ consola.consola.box("Next steps");
314
+ consola.consola.info(`1. Create your first view component in ${viewsDir}/`);
315
+ consola.consola.info("2. Render it from a NestJS controller using render.render()");
316
+ consola.consola.info("3. Run your dev server with: pnpm start:dev");
2636
317
  }
2637
318
  });
2638
- runMain(main);
2639
- //# sourceMappingURL=init.js.map
2640
- //# sourceMappingURL=init.js.map
319
+ citty.runMain(main);