@bento-js/cli 0.0.2
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/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc +111 -0
- package/.husky/pre-commit +1 -0
- package/LICENSE +674 -0
- package/README.md +11 -0
- package/bin/cli +1775 -0
- package/bun.lock +403 -0
- package/eslint.config.ts +16 -0
- package/package.json +41 -0
- package/prettier.config.ts +24 -0
- package/src/index.ts +13 -0
- package/src/logger.ts +5 -0
- package/src/subCommands/init.ts +14 -0
- package/tsconfig.json +20 -0
package/bin/cli
ADDED
|
@@ -0,0 +1,1775 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, {
|
|
5
|
+
get: all[name],
|
|
6
|
+
enumerable: true,
|
|
7
|
+
configurable: true,
|
|
8
|
+
set: (newValue) => all[name] = () => newValue
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
12
|
+
|
|
13
|
+
// node_modules/consola/dist/chunks/prompt.mjs
|
|
14
|
+
var exports_prompt = {};
|
|
15
|
+
__export(exports_prompt, {
|
|
16
|
+
prompt: () => prompt,
|
|
17
|
+
kCancel: () => kCancel
|
|
18
|
+
});
|
|
19
|
+
import g, { stdin, stdout } from "node:process";
|
|
20
|
+
import f from "node:readline";
|
|
21
|
+
import { WriteStream } from "node:tty";
|
|
22
|
+
function getDefaultExportFromCjs(x) {
|
|
23
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
24
|
+
}
|
|
25
|
+
function requireSrc() {
|
|
26
|
+
if (hasRequiredSrc)
|
|
27
|
+
return src;
|
|
28
|
+
hasRequiredSrc = 1;
|
|
29
|
+
const ESC = "\x1B";
|
|
30
|
+
const CSI = `${ESC}[`;
|
|
31
|
+
const beep = "\x07";
|
|
32
|
+
const cursor = {
|
|
33
|
+
to(x, y) {
|
|
34
|
+
if (!y)
|
|
35
|
+
return `${CSI}${x + 1}G`;
|
|
36
|
+
return `${CSI}${y + 1};${x + 1}H`;
|
|
37
|
+
},
|
|
38
|
+
move(x, y) {
|
|
39
|
+
let ret = "";
|
|
40
|
+
if (x < 0)
|
|
41
|
+
ret += `${CSI}${-x}D`;
|
|
42
|
+
else if (x > 0)
|
|
43
|
+
ret += `${CSI}${x}C`;
|
|
44
|
+
if (y < 0)
|
|
45
|
+
ret += `${CSI}${-y}A`;
|
|
46
|
+
else if (y > 0)
|
|
47
|
+
ret += `${CSI}${y}B`;
|
|
48
|
+
return ret;
|
|
49
|
+
},
|
|
50
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
51
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
52
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
53
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
54
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
55
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
56
|
+
left: `${CSI}G`,
|
|
57
|
+
hide: `${CSI}?25l`,
|
|
58
|
+
show: `${CSI}?25h`,
|
|
59
|
+
save: `${ESC}7`,
|
|
60
|
+
restore: `${ESC}8`
|
|
61
|
+
};
|
|
62
|
+
const scroll = {
|
|
63
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
64
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
65
|
+
};
|
|
66
|
+
const erase = {
|
|
67
|
+
screen: `${CSI}2J`,
|
|
68
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
69
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
70
|
+
line: `${CSI}2K`,
|
|
71
|
+
lineEnd: `${CSI}K`,
|
|
72
|
+
lineStart: `${CSI}1K`,
|
|
73
|
+
lines(count) {
|
|
74
|
+
let clear = "";
|
|
75
|
+
for (let i = 0;i < count; i++)
|
|
76
|
+
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
77
|
+
if (count)
|
|
78
|
+
clear += cursor.left;
|
|
79
|
+
return clear;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
src = { cursor, scroll, erase, beep };
|
|
83
|
+
return src;
|
|
84
|
+
}
|
|
85
|
+
function requirePicocolors() {
|
|
86
|
+
if (hasRequiredPicocolors)
|
|
87
|
+
return picocolors.exports;
|
|
88
|
+
hasRequiredPicocolors = 1;
|
|
89
|
+
let p = process || {}, argv2 = p.argv || [], env2 = p.env || {};
|
|
90
|
+
let isColorSupported2 = !(!!env2.NO_COLOR || argv2.includes("--no-color")) && (!!env2.FORCE_COLOR || argv2.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env2.TERM !== "dumb" || !!env2.CI);
|
|
91
|
+
let formatter = (open, close, replace = open) => (input) => {
|
|
92
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
93
|
+
return ~index ? open + replaceClose2(string, close, replace, index) + close : open + string + close;
|
|
94
|
+
};
|
|
95
|
+
let replaceClose2 = (string, close, replace, index) => {
|
|
96
|
+
let result = "", cursor = 0;
|
|
97
|
+
do {
|
|
98
|
+
result += string.substring(cursor, index) + replace;
|
|
99
|
+
cursor = index + close.length;
|
|
100
|
+
index = string.indexOf(close, cursor);
|
|
101
|
+
} while (~index);
|
|
102
|
+
return result + string.substring(cursor);
|
|
103
|
+
};
|
|
104
|
+
let createColors2 = (enabled = isColorSupported2) => {
|
|
105
|
+
let f2 = enabled ? formatter : () => String;
|
|
106
|
+
return {
|
|
107
|
+
isColorSupported: enabled,
|
|
108
|
+
reset: f2("\x1B[0m", "\x1B[0m"),
|
|
109
|
+
bold: f2("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
110
|
+
dim: f2("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
111
|
+
italic: f2("\x1B[3m", "\x1B[23m"),
|
|
112
|
+
underline: f2("\x1B[4m", "\x1B[24m"),
|
|
113
|
+
inverse: f2("\x1B[7m", "\x1B[27m"),
|
|
114
|
+
hidden: f2("\x1B[8m", "\x1B[28m"),
|
|
115
|
+
strikethrough: f2("\x1B[9m", "\x1B[29m"),
|
|
116
|
+
black: f2("\x1B[30m", "\x1B[39m"),
|
|
117
|
+
red: f2("\x1B[31m", "\x1B[39m"),
|
|
118
|
+
green: f2("\x1B[32m", "\x1B[39m"),
|
|
119
|
+
yellow: f2("\x1B[33m", "\x1B[39m"),
|
|
120
|
+
blue: f2("\x1B[34m", "\x1B[39m"),
|
|
121
|
+
magenta: f2("\x1B[35m", "\x1B[39m"),
|
|
122
|
+
cyan: f2("\x1B[36m", "\x1B[39m"),
|
|
123
|
+
white: f2("\x1B[37m", "\x1B[39m"),
|
|
124
|
+
gray: f2("\x1B[90m", "\x1B[39m"),
|
|
125
|
+
bgBlack: f2("\x1B[40m", "\x1B[49m"),
|
|
126
|
+
bgRed: f2("\x1B[41m", "\x1B[49m"),
|
|
127
|
+
bgGreen: f2("\x1B[42m", "\x1B[49m"),
|
|
128
|
+
bgYellow: f2("\x1B[43m", "\x1B[49m"),
|
|
129
|
+
bgBlue: f2("\x1B[44m", "\x1B[49m"),
|
|
130
|
+
bgMagenta: f2("\x1B[45m", "\x1B[49m"),
|
|
131
|
+
bgCyan: f2("\x1B[46m", "\x1B[49m"),
|
|
132
|
+
bgWhite: f2("\x1B[47m", "\x1B[49m"),
|
|
133
|
+
blackBright: f2("\x1B[90m", "\x1B[39m"),
|
|
134
|
+
redBright: f2("\x1B[91m", "\x1B[39m"),
|
|
135
|
+
greenBright: f2("\x1B[92m", "\x1B[39m"),
|
|
136
|
+
yellowBright: f2("\x1B[93m", "\x1B[39m"),
|
|
137
|
+
blueBright: f2("\x1B[94m", "\x1B[39m"),
|
|
138
|
+
magentaBright: f2("\x1B[95m", "\x1B[39m"),
|
|
139
|
+
cyanBright: f2("\x1B[96m", "\x1B[39m"),
|
|
140
|
+
whiteBright: f2("\x1B[97m", "\x1B[39m"),
|
|
141
|
+
bgBlackBright: f2("\x1B[100m", "\x1B[49m"),
|
|
142
|
+
bgRedBright: f2("\x1B[101m", "\x1B[49m"),
|
|
143
|
+
bgGreenBright: f2("\x1B[102m", "\x1B[49m"),
|
|
144
|
+
bgYellowBright: f2("\x1B[103m", "\x1B[49m"),
|
|
145
|
+
bgBlueBright: f2("\x1B[104m", "\x1B[49m"),
|
|
146
|
+
bgMagentaBright: f2("\x1B[105m", "\x1B[49m"),
|
|
147
|
+
bgCyanBright: f2("\x1B[106m", "\x1B[49m"),
|
|
148
|
+
bgWhiteBright: f2("\x1B[107m", "\x1B[49m")
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
picocolors.exports = createColors2();
|
|
152
|
+
picocolors.exports.createColors = createColors2;
|
|
153
|
+
return picocolors.exports;
|
|
154
|
+
}
|
|
155
|
+
function J({ onlyFirst: t = false } = {}) {
|
|
156
|
+
const F = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
157
|
+
return new RegExp(F, t ? undefined : "g");
|
|
158
|
+
}
|
|
159
|
+
function T$1(t) {
|
|
160
|
+
if (typeof t != "string")
|
|
161
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);
|
|
162
|
+
return t.replace(Q, "");
|
|
163
|
+
}
|
|
164
|
+
function O(t) {
|
|
165
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
166
|
+
}
|
|
167
|
+
function A$1(t, u = {}) {
|
|
168
|
+
if (typeof t != "string" || t.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, t = T$1(t), t.length === 0))
|
|
169
|
+
return 0;
|
|
170
|
+
t = t.replace(FD(), " ");
|
|
171
|
+
const F = u.ambiguousIsNarrow ? 1 : 2;
|
|
172
|
+
let e2 = 0;
|
|
173
|
+
for (const s of t) {
|
|
174
|
+
const i = s.codePointAt(0);
|
|
175
|
+
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879)
|
|
176
|
+
continue;
|
|
177
|
+
switch (DD.eastAsianWidth(s)) {
|
|
178
|
+
case "F":
|
|
179
|
+
case "W":
|
|
180
|
+
e2 += 2;
|
|
181
|
+
break;
|
|
182
|
+
case "A":
|
|
183
|
+
e2 += F;
|
|
184
|
+
break;
|
|
185
|
+
default:
|
|
186
|
+
e2 += 1;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return e2;
|
|
190
|
+
}
|
|
191
|
+
function sD() {
|
|
192
|
+
const t = new Map;
|
|
193
|
+
for (const [u, F] of Object.entries(r)) {
|
|
194
|
+
for (const [e2, s] of Object.entries(F))
|
|
195
|
+
r[e2] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, F[e2] = r[e2], t.set(s[0], s[1]);
|
|
196
|
+
Object.defineProperty(r, u, { value: F, enumerable: false });
|
|
197
|
+
}
|
|
198
|
+
return Object.defineProperty(r, "codes", { value: t, 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: (u, F, e2) => u === F && F === e2 ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(F / 255 * 5) + Math.round(e2 / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
|
|
199
|
+
const F = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
|
|
200
|
+
if (!F)
|
|
201
|
+
return [0, 0, 0];
|
|
202
|
+
let [e2] = F;
|
|
203
|
+
e2.length === 3 && (e2 = [...e2].map((i) => i + i).join(""));
|
|
204
|
+
const s = Number.parseInt(e2, 16);
|
|
205
|
+
return [s >> 16 & 255, s >> 8 & 255, s & 255];
|
|
206
|
+
}, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
|
|
207
|
+
if (u < 8)
|
|
208
|
+
return 30 + u;
|
|
209
|
+
if (u < 16)
|
|
210
|
+
return 90 + (u - 8);
|
|
211
|
+
let F, e2, s;
|
|
212
|
+
if (u >= 232)
|
|
213
|
+
F = ((u - 232) * 10 + 8) / 255, e2 = F, s = F;
|
|
214
|
+
else {
|
|
215
|
+
u -= 16;
|
|
216
|
+
const C = u % 36;
|
|
217
|
+
F = Math.floor(u / 36) / 5, e2 = Math.floor(C / 6) / 5, s = C % 6 / 5;
|
|
218
|
+
}
|
|
219
|
+
const i = Math.max(F, e2, s) * 2;
|
|
220
|
+
if (i === 0)
|
|
221
|
+
return 30;
|
|
222
|
+
let D = 30 + (Math.round(s) << 2 | Math.round(e2) << 1 | Math.round(F));
|
|
223
|
+
return i === 2 && (D += 60), D;
|
|
224
|
+
}, enumerable: false }, rgbToAnsi: { value: (u, F, e2) => r.ansi256ToAnsi(r.rgbToAnsi256(u, F, e2)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
|
|
225
|
+
}
|
|
226
|
+
function G(t, u, F) {
|
|
227
|
+
return String(t).normalize().replace(/\r\n/g, `
|
|
228
|
+
`).split(`
|
|
229
|
+
`).map((e2) => oD(e2, u, F)).join(`
|
|
230
|
+
`);
|
|
231
|
+
}
|
|
232
|
+
function k$1(t, u) {
|
|
233
|
+
if (typeof t == "string")
|
|
234
|
+
return c.aliases.get(t) === u;
|
|
235
|
+
for (const F of t)
|
|
236
|
+
if (F !== undefined && k$1(F, u))
|
|
237
|
+
return true;
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
function lD(t, u) {
|
|
241
|
+
if (t === u)
|
|
242
|
+
return;
|
|
243
|
+
const F = t.split(`
|
|
244
|
+
`), e2 = u.split(`
|
|
245
|
+
`), s = [];
|
|
246
|
+
for (let i = 0;i < Math.max(F.length, e2.length); i++)
|
|
247
|
+
F[i] !== e2[i] && s.push(i);
|
|
248
|
+
return s;
|
|
249
|
+
}
|
|
250
|
+
function d$1(t, u) {
|
|
251
|
+
const F = t;
|
|
252
|
+
F.isTTY && F.setRawMode(u);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
class x {
|
|
256
|
+
constructor(u, F = true) {
|
|
257
|
+
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", new Map), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
258
|
+
const { input: e2 = stdin, output: s = stdout, render: i, signal: D, ...C } = u;
|
|
259
|
+
this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = F, this._abortSignal = D, this.input = e2, this.output = s;
|
|
260
|
+
}
|
|
261
|
+
unsubscribe() {
|
|
262
|
+
this._subscribers.clear();
|
|
263
|
+
}
|
|
264
|
+
setSubscriber(u, F) {
|
|
265
|
+
const e2 = this._subscribers.get(u) ?? [];
|
|
266
|
+
e2.push(F), this._subscribers.set(u, e2);
|
|
267
|
+
}
|
|
268
|
+
on(u, F) {
|
|
269
|
+
this.setSubscriber(u, { cb: F });
|
|
270
|
+
}
|
|
271
|
+
once(u, F) {
|
|
272
|
+
this.setSubscriber(u, { cb: F, once: true });
|
|
273
|
+
}
|
|
274
|
+
emit(u, ...F) {
|
|
275
|
+
const e2 = this._subscribers.get(u) ?? [], s = [];
|
|
276
|
+
for (const i of e2)
|
|
277
|
+
i.cb(...F), i.once && s.push(() => e2.splice(e2.indexOf(i), 1));
|
|
278
|
+
for (const i of s)
|
|
279
|
+
i();
|
|
280
|
+
}
|
|
281
|
+
prompt() {
|
|
282
|
+
return new Promise((u, F) => {
|
|
283
|
+
if (this._abortSignal) {
|
|
284
|
+
if (this._abortSignal.aborted)
|
|
285
|
+
return this.state = "cancel", this.close(), u(S);
|
|
286
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
287
|
+
this.state = "cancel", this.close();
|
|
288
|
+
}, { once: true });
|
|
289
|
+
}
|
|
290
|
+
const e2 = new WriteStream(0);
|
|
291
|
+
e2._write = (s, i, D) => {
|
|
292
|
+
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
|
|
293
|
+
}, this.input.pipe(e2), this.rl = f.createInterface({ input: this.input, output: e2, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), f.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== undefined && 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", () => {
|
|
294
|
+
this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(this.value);
|
|
295
|
+
}), this.once("cancel", () => {
|
|
296
|
+
this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(S);
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
onKeypress(u, F) {
|
|
301
|
+
if (this.state === "error" && (this.state = "active"), F?.name && (!this._track && c.aliases.has(F.name) && this.emit("cursor", c.aliases.get(F.name)), c.actions.has(F.name) && this.emit("cursor", F.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === "\t" && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), F?.name === "return") {
|
|
302
|
+
if (this.opts.validate) {
|
|
303
|
+
const e2 = this.opts.validate(this.value);
|
|
304
|
+
e2 && (this.error = e2 instanceof Error ? e2.message : e2, this.state = "error", this.rl?.write(this.value));
|
|
305
|
+
}
|
|
306
|
+
this.state !== "error" && (this.state = "submit");
|
|
307
|
+
}
|
|
308
|
+
k$1([u, F?.name, F?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
309
|
+
}
|
|
310
|
+
close() {
|
|
311
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
312
|
+
`), d$1(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
313
|
+
}
|
|
314
|
+
restoreCursor() {
|
|
315
|
+
const u = G(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
316
|
+
`).length - 1;
|
|
317
|
+
this.output.write(srcExports.cursor.move(-999, u * -1));
|
|
318
|
+
}
|
|
319
|
+
render() {
|
|
320
|
+
const u = G(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
321
|
+
if (u !== this._prevFrame) {
|
|
322
|
+
if (this.state === "initial")
|
|
323
|
+
this.output.write(srcExports.cursor.hide);
|
|
324
|
+
else {
|
|
325
|
+
const F = lD(this._prevFrame, u);
|
|
326
|
+
if (this.restoreCursor(), F && F?.length === 1) {
|
|
327
|
+
const e2 = F[0];
|
|
328
|
+
this.output.write(srcExports.cursor.move(0, e2)), this.output.write(srcExports.erase.lines(1));
|
|
329
|
+
const s = u.split(`
|
|
330
|
+
`);
|
|
331
|
+
this.output.write(s[e2]), this._prevFrame = u, this.output.write(srcExports.cursor.move(0, s.length - e2 - 1));
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
if (F && F?.length > 1) {
|
|
335
|
+
const e2 = F[0];
|
|
336
|
+
this.output.write(srcExports.cursor.move(0, e2)), this.output.write(srcExports.erase.down());
|
|
337
|
+
const s = u.split(`
|
|
338
|
+
`).slice(e2);
|
|
339
|
+
this.output.write(s.join(`
|
|
340
|
+
`)), this._prevFrame = u;
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
this.output.write(srcExports.erase.down());
|
|
344
|
+
}
|
|
345
|
+
this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function ce() {
|
|
350
|
+
return g.platform !== "win32" ? g.env.TERM !== "linux" : !!g.env.CI || !!g.env.WT_SESSION || !!g.env.TERMINUS_SUBLIME || g.env.ConEmuTask === "{cmd::Cmder}" || g.env.TERM_PROGRAM === "Terminus-Sublime" || g.env.TERM_PROGRAM === "vscode" || g.env.TERM === "xterm-256color" || g.env.TERM === "alacritty" || g.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
351
|
+
}
|
|
352
|
+
async function prompt(message, opts = {}) {
|
|
353
|
+
const handleCancel = (value) => {
|
|
354
|
+
if (typeof value !== "symbol" || value.toString() !== "Symbol(clack:cancel)") {
|
|
355
|
+
return value;
|
|
356
|
+
}
|
|
357
|
+
switch (opts.cancel) {
|
|
358
|
+
case "reject": {
|
|
359
|
+
const error = new Error("Prompt cancelled.");
|
|
360
|
+
error.name = "ConsolaPromptCancelledError";
|
|
361
|
+
if (Error.captureStackTrace) {
|
|
362
|
+
Error.captureStackTrace(error, prompt);
|
|
363
|
+
}
|
|
364
|
+
throw error;
|
|
365
|
+
}
|
|
366
|
+
case "undefined": {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
case "null": {
|
|
370
|
+
return null;
|
|
371
|
+
}
|
|
372
|
+
case "symbol": {
|
|
373
|
+
return kCancel;
|
|
374
|
+
}
|
|
375
|
+
default:
|
|
376
|
+
case "default": {
|
|
377
|
+
return opts.default ?? opts.initial;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
if (!opts.type || opts.type === "text") {
|
|
382
|
+
return await he({
|
|
383
|
+
message,
|
|
384
|
+
defaultValue: opts.default,
|
|
385
|
+
placeholder: opts.placeholder,
|
|
386
|
+
initialValue: opts.initial
|
|
387
|
+
}).then(handleCancel);
|
|
388
|
+
}
|
|
389
|
+
if (opts.type === "confirm") {
|
|
390
|
+
return await ye({
|
|
391
|
+
message,
|
|
392
|
+
initialValue: opts.initial
|
|
393
|
+
}).then(handleCancel);
|
|
394
|
+
}
|
|
395
|
+
if (opts.type === "select") {
|
|
396
|
+
return await ve({
|
|
397
|
+
message,
|
|
398
|
+
options: opts.options.map((o2) => typeof o2 === "string" ? { value: o2, label: o2 } : o2),
|
|
399
|
+
initialValue: opts.initial
|
|
400
|
+
}).then(handleCancel);
|
|
401
|
+
}
|
|
402
|
+
if (opts.type === "multiselect") {
|
|
403
|
+
return await fe({
|
|
404
|
+
message,
|
|
405
|
+
options: opts.options.map((o2) => typeof o2 === "string" ? { value: o2, label: o2 } : o2),
|
|
406
|
+
required: opts.required,
|
|
407
|
+
initialValues: opts.initial
|
|
408
|
+
}).then(handleCancel);
|
|
409
|
+
}
|
|
410
|
+
throw new Error(`Unknown prompt type: ${opts.type}`);
|
|
411
|
+
}
|
|
412
|
+
var src, hasRequiredSrc, srcExports, picocolors, hasRequiredPicocolors, picocolorsExports, e, Q, P$1, X, DD, uD = function() {
|
|
413
|
+
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;
|
|
414
|
+
}, FD, m = 10, L$1 = (t = 0) => (u) => `\x1B[${u + t}m`, N = (t = 0) => (u) => `\x1B[${38 + t};5;${u}m`, I = (t = 0) => (u, F, e2) => `\x1B[${38 + t};2;${u};${F};${e2}m`, r, tD, eD, iD, v, CD = 39, w$1 = "\x07", W$1 = "[", rD = "]", R = "m", y, V$1 = (t) => `${v.values().next().value}${W$1}${t}${R}`, z = (t) => `${v.values().next().value}${y}${t}${w$1}`, ED = (t) => t.split(" ").map((u) => A$1(u)), _ = (t, u, F) => {
|
|
415
|
+
const e2 = [...u];
|
|
416
|
+
let s = false, i = false, D = A$1(T$1(t[t.length - 1]));
|
|
417
|
+
for (const [C, o] of e2.entries()) {
|
|
418
|
+
const E = A$1(o);
|
|
419
|
+
if (D + E <= F ? t[t.length - 1] += o : (t.push(o), D = 0), v.has(o) && (s = true, i = e2.slice(C + 1).join("").startsWith(y)), s) {
|
|
420
|
+
i ? o === w$1 && (s = false, i = false) : o === R && (s = false);
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
D += E, D === F && C < e2.length - 1 && (t.push(""), D = 0);
|
|
424
|
+
}
|
|
425
|
+
!D && t[t.length - 1].length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
426
|
+
}, nD = (t) => {
|
|
427
|
+
const u = t.split(" ");
|
|
428
|
+
let F = u.length;
|
|
429
|
+
for (;F > 0 && !(A$1(u[F - 1]) > 0); )
|
|
430
|
+
F--;
|
|
431
|
+
return F === u.length ? t : u.slice(0, F).join(" ") + u.slice(F).join("");
|
|
432
|
+
}, oD = (t, u, F = {}) => {
|
|
433
|
+
if (F.trim !== false && t.trim() === "")
|
|
434
|
+
return "";
|
|
435
|
+
let e2 = "", s, i;
|
|
436
|
+
const D = ED(t);
|
|
437
|
+
let C = [""];
|
|
438
|
+
for (const [E, a] of t.split(" ").entries()) {
|
|
439
|
+
F.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart());
|
|
440
|
+
let n = A$1(C[C.length - 1]);
|
|
441
|
+
if (E !== 0 && (n >= u && (F.wordWrap === false || F.trim === false) && (C.push(""), n = 0), (n > 0 || F.trim === false) && (C[C.length - 1] += " ", n++)), F.hard && D[E] > u) {
|
|
442
|
+
const B = u - n, p = 1 + Math.floor((D[E] - B - 1) / u);
|
|
443
|
+
Math.floor((D[E] - 1) / u) < p && C.push(""), _(C, a, u);
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
if (n + D[E] > u && n > 0 && D[E] > 0) {
|
|
447
|
+
if (F.wordWrap === false && n < u) {
|
|
448
|
+
_(C, a, u);
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
451
|
+
C.push("");
|
|
452
|
+
}
|
|
453
|
+
if (n + D[E] > u && F.wordWrap === false) {
|
|
454
|
+
_(C, a, u);
|
|
455
|
+
continue;
|
|
456
|
+
}
|
|
457
|
+
C[C.length - 1] += a;
|
|
458
|
+
}
|
|
459
|
+
F.trim !== false && (C = C.map((E) => nD(E)));
|
|
460
|
+
const o = [...C.join(`
|
|
461
|
+
`)];
|
|
462
|
+
for (const [E, a] of o.entries()) {
|
|
463
|
+
if (e2 += a, v.has(a)) {
|
|
464
|
+
const { groups: B } = new RegExp(`(?:\\${W$1}(?<code>\\d+)m|\\${y}(?<uri>.*)${w$1})`).exec(o.slice(E).join("")) || { groups: {} };
|
|
465
|
+
if (B.code !== undefined) {
|
|
466
|
+
const p = Number.parseFloat(B.code);
|
|
467
|
+
s = p === CD ? undefined : p;
|
|
468
|
+
} else
|
|
469
|
+
B.uri !== undefined && (i = B.uri.length === 0 ? undefined : B.uri);
|
|
470
|
+
}
|
|
471
|
+
const n = iD.codes.get(Number(s));
|
|
472
|
+
o[E + 1] === `
|
|
473
|
+
` ? (i && (e2 += z("")), s && n && (e2 += V$1(n))) : a === `
|
|
474
|
+
` && (s && n && (e2 += V$1(s)), i && (e2 += z(i)));
|
|
475
|
+
}
|
|
476
|
+
return e2;
|
|
477
|
+
}, aD, c, S, AD, pD = (t, u, F) => (u in t) ? AD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F, h = (t, u, F) => (pD(t, typeof u != "symbol" ? u + "" : u, F), F), fD, bD, mD = (t, u, F) => (u in t) ? bD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F, Y = (t, u, F) => (mD(t, typeof u != "symbol" ? u + "" : u, F), F), wD, SD, $D = (t, u, F) => (u in t) ? SD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F, q = (t, u, F) => ($D(t, typeof u != "symbol" ? u + "" : u, F), F), jD, PD, V, u = (t, n) => V ? t : n, le, L, W, C, o, d, k, P, A, T, F, w = (t) => {
|
|
478
|
+
switch (t) {
|
|
479
|
+
case "initial":
|
|
480
|
+
case "active":
|
|
481
|
+
return e.cyan(le);
|
|
482
|
+
case "cancel":
|
|
483
|
+
return e.red(L);
|
|
484
|
+
case "error":
|
|
485
|
+
return e.yellow(W);
|
|
486
|
+
case "submit":
|
|
487
|
+
return e.green(C);
|
|
488
|
+
}
|
|
489
|
+
}, B = (t) => {
|
|
490
|
+
const { cursor: n, options: s, style: r2 } = t, i = t.maxItems ?? Number.POSITIVE_INFINITY, a = Math.max(process.stdout.rows - 4, 0), c2 = Math.min(a, Math.max(i, 5));
|
|
491
|
+
let l = 0;
|
|
492
|
+
n >= l + c2 - 3 ? l = Math.max(Math.min(n - c2 + 3, s.length - c2), 0) : n < l + 2 && (l = Math.max(n - 2, 0));
|
|
493
|
+
const $ = c2 < s.length && l > 0, p = c2 < s.length && l + c2 < s.length;
|
|
494
|
+
return s.slice(l, l + c2).map((M, v2, x2) => {
|
|
495
|
+
const j = v2 === 0 && $, E = v2 === x2.length - 1 && p;
|
|
496
|
+
return j || E ? e.dim("...") : r2(M, v2 + l === n);
|
|
497
|
+
});
|
|
498
|
+
}, he = (t) => new PD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
|
|
499
|
+
const n = `${e.gray(o)}
|
|
500
|
+
${w(this.state)} ${t.message}
|
|
501
|
+
`, s = t.placeholder ? e.inverse(t.placeholder[0]) + e.dim(t.placeholder.slice(1)) : e.inverse(e.hidden("_")), r2 = this.value ? this.valueWithCursor : s;
|
|
502
|
+
switch (this.state) {
|
|
503
|
+
case "error":
|
|
504
|
+
return `${n.trim()}
|
|
505
|
+
${e.yellow(o)} ${r2}
|
|
506
|
+
${e.yellow(d)} ${e.yellow(this.error)}
|
|
507
|
+
`;
|
|
508
|
+
case "submit":
|
|
509
|
+
return `${n}${e.gray(o)} ${e.dim(this.value || t.placeholder)}`;
|
|
510
|
+
case "cancel":
|
|
511
|
+
return `${n}${e.gray(o)} ${e.strikethrough(e.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
512
|
+
${e.gray(o)}` : ""}`;
|
|
513
|
+
default:
|
|
514
|
+
return `${n}${e.cyan(o)} ${r2}
|
|
515
|
+
${e.cyan(d)}
|
|
516
|
+
`;
|
|
517
|
+
}
|
|
518
|
+
} }).prompt(), ye = (t) => {
|
|
519
|
+
const n = t.active ?? "Yes", s = t.inactive ?? "No";
|
|
520
|
+
return new fD({ active: n, inactive: s, initialValue: t.initialValue ?? true, render() {
|
|
521
|
+
const r2 = `${e.gray(o)}
|
|
522
|
+
${w(this.state)} ${t.message}
|
|
523
|
+
`, i = this.value ? n : s;
|
|
524
|
+
switch (this.state) {
|
|
525
|
+
case "submit":
|
|
526
|
+
return `${r2}${e.gray(o)} ${e.dim(i)}`;
|
|
527
|
+
case "cancel":
|
|
528
|
+
return `${r2}${e.gray(o)} ${e.strikethrough(e.dim(i))}
|
|
529
|
+
${e.gray(o)}`;
|
|
530
|
+
default:
|
|
531
|
+
return `${r2}${e.cyan(o)} ${this.value ? `${e.green(k)} ${n}` : `${e.dim(P)} ${e.dim(n)}`} ${e.dim("/")} ${this.value ? `${e.dim(P)} ${e.dim(s)}` : `${e.green(k)} ${s}`}
|
|
532
|
+
${e.cyan(d)}
|
|
533
|
+
`;
|
|
534
|
+
}
|
|
535
|
+
} }).prompt();
|
|
536
|
+
}, ve = (t) => {
|
|
537
|
+
const n = (s, r2) => {
|
|
538
|
+
const i = s.label ?? String(s.value);
|
|
539
|
+
switch (r2) {
|
|
540
|
+
case "selected":
|
|
541
|
+
return `${e.dim(i)}`;
|
|
542
|
+
case "active":
|
|
543
|
+
return `${e.green(k)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}`;
|
|
544
|
+
case "cancelled":
|
|
545
|
+
return `${e.strikethrough(e.dim(i))}`;
|
|
546
|
+
default:
|
|
547
|
+
return `${e.dim(P)} ${e.dim(i)}`;
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
return new jD({ options: t.options, initialValue: t.initialValue, render() {
|
|
551
|
+
const s = `${e.gray(o)}
|
|
552
|
+
${w(this.state)} ${t.message}
|
|
553
|
+
`;
|
|
554
|
+
switch (this.state) {
|
|
555
|
+
case "submit":
|
|
556
|
+
return `${s}${e.gray(o)} ${n(this.options[this.cursor], "selected")}`;
|
|
557
|
+
case "cancel":
|
|
558
|
+
return `${s}${e.gray(o)} ${n(this.options[this.cursor], "cancelled")}
|
|
559
|
+
${e.gray(o)}`;
|
|
560
|
+
default:
|
|
561
|
+
return `${s}${e.cyan(o)} ${B({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (r2, i) => n(r2, i ? "active" : "inactive") }).join(`
|
|
562
|
+
${e.cyan(o)} `)}
|
|
563
|
+
${e.cyan(d)}
|
|
564
|
+
`;
|
|
565
|
+
}
|
|
566
|
+
} }).prompt();
|
|
567
|
+
}, fe = (t) => {
|
|
568
|
+
const n = (s, r2) => {
|
|
569
|
+
const i = s.label ?? String(s.value);
|
|
570
|
+
return r2 === "active" ? `${e.cyan(A)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r2 === "selected" ? `${e.green(T)} ${e.dim(i)}` : r2 === "cancelled" ? `${e.strikethrough(e.dim(i))}` : r2 === "active-selected" ? `${e.green(T)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r2 === "submitted" ? `${e.dim(i)}` : `${e.dim(F)} ${e.dim(i)}`;
|
|
571
|
+
};
|
|
572
|
+
return new wD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(s) {
|
|
573
|
+
if (this.required && s.length === 0)
|
|
574
|
+
return `Please select at least one option.
|
|
575
|
+
${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`;
|
|
576
|
+
}, render() {
|
|
577
|
+
const s = `${e.gray(o)}
|
|
578
|
+
${w(this.state)} ${t.message}
|
|
579
|
+
`, r2 = (i, a) => {
|
|
580
|
+
const c2 = this.value.includes(i.value);
|
|
581
|
+
return a && c2 ? n(i, "active-selected") : c2 ? n(i, "selected") : n(i, a ? "active" : "inactive");
|
|
582
|
+
};
|
|
583
|
+
switch (this.state) {
|
|
584
|
+
case "submit":
|
|
585
|
+
return `${s}${e.gray(o)} ${this.options.filter(({ value: i }) => this.value.includes(i)).map((i) => n(i, "submitted")).join(e.dim(", ")) || e.dim("none")}`;
|
|
586
|
+
case "cancel": {
|
|
587
|
+
const i = this.options.filter(({ value: a }) => this.value.includes(a)).map((a) => n(a, "cancelled")).join(e.dim(", "));
|
|
588
|
+
return `${s}${e.gray(o)} ${i.trim() ? `${i}
|
|
589
|
+
${e.gray(o)}` : ""}`;
|
|
590
|
+
}
|
|
591
|
+
case "error": {
|
|
592
|
+
const i = this.error.split(`
|
|
593
|
+
`).map((a, c2) => c2 === 0 ? `${e.yellow(d)} ${e.yellow(a)}` : ` ${a}`).join(`
|
|
594
|
+
`);
|
|
595
|
+
return `${s + e.yellow(o)} ${B({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: r2 }).join(`
|
|
596
|
+
${e.yellow(o)} `)}
|
|
597
|
+
${i}
|
|
598
|
+
`;
|
|
599
|
+
}
|
|
600
|
+
default:
|
|
601
|
+
return `${s}${e.cyan(o)} ${B({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: r2 }).join(`
|
|
602
|
+
${e.cyan(o)} `)}
|
|
603
|
+
${e.cyan(d)}
|
|
604
|
+
`;
|
|
605
|
+
}
|
|
606
|
+
} }).prompt();
|
|
607
|
+
}, kCancel;
|
|
608
|
+
var init_prompt = __esm(() => {
|
|
609
|
+
srcExports = requireSrc();
|
|
610
|
+
picocolors = { exports: {} };
|
|
611
|
+
picocolorsExports = /* @__PURE__ */ requirePicocolors();
|
|
612
|
+
e = /* @__PURE__ */ getDefaultExportFromCjs(picocolorsExports);
|
|
613
|
+
Q = J();
|
|
614
|
+
P$1 = { exports: {} };
|
|
615
|
+
(function(t) {
|
|
616
|
+
var u = {};
|
|
617
|
+
t.exports = u, u.eastAsianWidth = function(e2) {
|
|
618
|
+
var s = e2.charCodeAt(0), i = e2.length == 2 ? e2.charCodeAt(1) : 0, D = s;
|
|
619
|
+
return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D = s << 10 | i, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
|
|
620
|
+
}, u.characterLength = function(e2) {
|
|
621
|
+
var s = this.eastAsianWidth(e2);
|
|
622
|
+
return s == "F" || s == "W" || s == "A" ? 2 : 1;
|
|
623
|
+
};
|
|
624
|
+
function F(e2) {
|
|
625
|
+
return e2.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
626
|
+
}
|
|
627
|
+
u.length = function(e2) {
|
|
628
|
+
for (var s = F(e2), i = 0, D = 0;D < s.length; D++)
|
|
629
|
+
i = i + this.characterLength(s[D]);
|
|
630
|
+
return i;
|
|
631
|
+
}, u.slice = function(e2, s, i) {
|
|
632
|
+
textLen = u.length(e2), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
633
|
+
for (var D = "", C = 0, o = F(e2), E = 0;E < o.length; E++) {
|
|
634
|
+
var a = o[E], n = u.length(a);
|
|
635
|
+
if (C >= s - (n == 2 ? 1 : 0))
|
|
636
|
+
if (C + n <= i)
|
|
637
|
+
D += a;
|
|
638
|
+
else
|
|
639
|
+
break;
|
|
640
|
+
C += n;
|
|
641
|
+
}
|
|
642
|
+
return D;
|
|
643
|
+
};
|
|
644
|
+
})(P$1);
|
|
645
|
+
X = P$1.exports;
|
|
646
|
+
DD = O(X);
|
|
647
|
+
FD = O(uD);
|
|
648
|
+
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] } };
|
|
649
|
+
Object.keys(r.modifier);
|
|
650
|
+
tD = Object.keys(r.color);
|
|
651
|
+
eD = Object.keys(r.bgColor);
|
|
652
|
+
[...tD, ...eD];
|
|
653
|
+
iD = sD();
|
|
654
|
+
v = new Set(["\x1B", ""]);
|
|
655
|
+
y = `${rD}8;;`;
|
|
656
|
+
aD = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
657
|
+
c = { actions: new Set(aD), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]) };
|
|
658
|
+
globalThis.process.platform.startsWith("win");
|
|
659
|
+
S = Symbol("clack:cancel");
|
|
660
|
+
AD = Object.defineProperty;
|
|
661
|
+
fD = class fD extends x {
|
|
662
|
+
get cursor() {
|
|
663
|
+
return this.value ? 0 : 1;
|
|
664
|
+
}
|
|
665
|
+
get _value() {
|
|
666
|
+
return this.cursor === 0;
|
|
667
|
+
}
|
|
668
|
+
constructor(u) {
|
|
669
|
+
super(u, false), this.value = !!u.initialValue, this.on("value", () => {
|
|
670
|
+
this.value = this._value;
|
|
671
|
+
}), this.on("confirm", (F) => {
|
|
672
|
+
this.output.write(srcExports.cursor.move(0, -1)), this.value = F, this.state = "submit", this.close();
|
|
673
|
+
}), this.on("cursor", () => {
|
|
674
|
+
this.value = !this.value;
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
bD = Object.defineProperty;
|
|
679
|
+
wD = class extends x {
|
|
680
|
+
constructor(u) {
|
|
681
|
+
super(u, false), Y(this, "options"), Y(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F }) => F === u.cursorAt), 0), this.on("key", (F) => {
|
|
682
|
+
F === "a" && this.toggleAll();
|
|
683
|
+
}), this.on("cursor", (F) => {
|
|
684
|
+
switch (F) {
|
|
685
|
+
case "left":
|
|
686
|
+
case "up":
|
|
687
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
688
|
+
break;
|
|
689
|
+
case "down":
|
|
690
|
+
case "right":
|
|
691
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
692
|
+
break;
|
|
693
|
+
case "space":
|
|
694
|
+
this.toggleValue();
|
|
695
|
+
break;
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
get _value() {
|
|
700
|
+
return this.options[this.cursor].value;
|
|
701
|
+
}
|
|
702
|
+
toggleAll() {
|
|
703
|
+
const u = this.value.length === this.options.length;
|
|
704
|
+
this.value = u ? [] : this.options.map((F) => F.value);
|
|
705
|
+
}
|
|
706
|
+
toggleValue() {
|
|
707
|
+
const u = this.value.includes(this._value);
|
|
708
|
+
this.value = u ? this.value.filter((F) => F !== this._value) : [...this.value, this._value];
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
SD = Object.defineProperty;
|
|
712
|
+
jD = class jD extends x {
|
|
713
|
+
constructor(u) {
|
|
714
|
+
super(u, false), q(this, "options"), q(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: F }) => F === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F) => {
|
|
715
|
+
switch (F) {
|
|
716
|
+
case "left":
|
|
717
|
+
case "up":
|
|
718
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
719
|
+
break;
|
|
720
|
+
case "down":
|
|
721
|
+
case "right":
|
|
722
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
723
|
+
break;
|
|
724
|
+
}
|
|
725
|
+
this.changeValue();
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
get _value() {
|
|
729
|
+
return this.options[this.cursor];
|
|
730
|
+
}
|
|
731
|
+
changeValue() {
|
|
732
|
+
this.value = this._value.value;
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
PD = class PD extends x {
|
|
736
|
+
get valueWithCursor() {
|
|
737
|
+
if (this.state === "submit")
|
|
738
|
+
return this.value;
|
|
739
|
+
if (this.cursor >= this.value.length)
|
|
740
|
+
return `${this.value}█`;
|
|
741
|
+
const u = this.value.slice(0, this.cursor), [F, ...e$1] = this.value.slice(this.cursor);
|
|
742
|
+
return `${u}${e.inverse(F)}${e$1.join("")}`;
|
|
743
|
+
}
|
|
744
|
+
get cursor() {
|
|
745
|
+
return this._cursor;
|
|
746
|
+
}
|
|
747
|
+
constructor(u) {
|
|
748
|
+
super(u), this.on("finalize", () => {
|
|
749
|
+
this.value || (this.value = u.defaultValue);
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
V = ce();
|
|
754
|
+
le = u("❯", ">");
|
|
755
|
+
L = u("■", "x");
|
|
756
|
+
W = u("▲", "x");
|
|
757
|
+
C = u("✔", "√");
|
|
758
|
+
o = u("");
|
|
759
|
+
d = u("");
|
|
760
|
+
k = u("●", ">");
|
|
761
|
+
P = u("○", " ");
|
|
762
|
+
A = u("◻", "[•]");
|
|
763
|
+
T = u("◼", "[+]");
|
|
764
|
+
F = u("◻", "[ ]");
|
|
765
|
+
`${e.gray(o)} `;
|
|
766
|
+
kCancel = Symbol.for("cancel");
|
|
767
|
+
});
|
|
768
|
+
|
|
769
|
+
// node_modules/citty/dist/index.mjs
|
|
770
|
+
function defineCommand(def) {
|
|
771
|
+
return def;
|
|
772
|
+
}
|
|
773
|
+
// package.json
|
|
774
|
+
var version = "0.0.1";
|
|
775
|
+
|
|
776
|
+
// node_modules/consola/dist/core.mjs
|
|
777
|
+
var LogLevels = {
|
|
778
|
+
silent: Number.NEGATIVE_INFINITY,
|
|
779
|
+
fatal: 0,
|
|
780
|
+
error: 0,
|
|
781
|
+
warn: 1,
|
|
782
|
+
log: 2,
|
|
783
|
+
info: 3,
|
|
784
|
+
success: 3,
|
|
785
|
+
fail: 3,
|
|
786
|
+
ready: 3,
|
|
787
|
+
start: 3,
|
|
788
|
+
box: 3,
|
|
789
|
+
debug: 4,
|
|
790
|
+
trace: 5,
|
|
791
|
+
verbose: Number.POSITIVE_INFINITY
|
|
792
|
+
};
|
|
793
|
+
var LogTypes = {
|
|
794
|
+
silent: {
|
|
795
|
+
level: -1
|
|
796
|
+
},
|
|
797
|
+
fatal: {
|
|
798
|
+
level: LogLevels.fatal
|
|
799
|
+
},
|
|
800
|
+
error: {
|
|
801
|
+
level: LogLevels.error
|
|
802
|
+
},
|
|
803
|
+
warn: {
|
|
804
|
+
level: LogLevels.warn
|
|
805
|
+
},
|
|
806
|
+
log: {
|
|
807
|
+
level: LogLevels.log
|
|
808
|
+
},
|
|
809
|
+
info: {
|
|
810
|
+
level: LogLevels.info
|
|
811
|
+
},
|
|
812
|
+
success: {
|
|
813
|
+
level: LogLevels.success
|
|
814
|
+
},
|
|
815
|
+
fail: {
|
|
816
|
+
level: LogLevels.fail
|
|
817
|
+
},
|
|
818
|
+
ready: {
|
|
819
|
+
level: LogLevels.info
|
|
820
|
+
},
|
|
821
|
+
start: {
|
|
822
|
+
level: LogLevels.info
|
|
823
|
+
},
|
|
824
|
+
box: {
|
|
825
|
+
level: LogLevels.info
|
|
826
|
+
},
|
|
827
|
+
debug: {
|
|
828
|
+
level: LogLevels.debug
|
|
829
|
+
},
|
|
830
|
+
trace: {
|
|
831
|
+
level: LogLevels.trace
|
|
832
|
+
},
|
|
833
|
+
verbose: {
|
|
834
|
+
level: LogLevels.verbose
|
|
835
|
+
}
|
|
836
|
+
};
|
|
837
|
+
function isPlainObject$1(value) {
|
|
838
|
+
if (value === null || typeof value !== "object") {
|
|
839
|
+
return false;
|
|
840
|
+
}
|
|
841
|
+
const prototype = Object.getPrototypeOf(value);
|
|
842
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
843
|
+
return false;
|
|
844
|
+
}
|
|
845
|
+
if (Symbol.iterator in value) {
|
|
846
|
+
return false;
|
|
847
|
+
}
|
|
848
|
+
if (Symbol.toStringTag in value) {
|
|
849
|
+
return Object.prototype.toString.call(value) === "[object Module]";
|
|
850
|
+
}
|
|
851
|
+
return true;
|
|
852
|
+
}
|
|
853
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
854
|
+
if (!isPlainObject$1(defaults)) {
|
|
855
|
+
return _defu(baseObject, {}, namespace, merger);
|
|
856
|
+
}
|
|
857
|
+
const object = Object.assign({}, defaults);
|
|
858
|
+
for (const key in baseObject) {
|
|
859
|
+
if (key === "__proto__" || key === "constructor") {
|
|
860
|
+
continue;
|
|
861
|
+
}
|
|
862
|
+
const value = baseObject[key];
|
|
863
|
+
if (value === null || value === undefined) {
|
|
864
|
+
continue;
|
|
865
|
+
}
|
|
866
|
+
if (merger && merger(object, key, value, namespace)) {
|
|
867
|
+
continue;
|
|
868
|
+
}
|
|
869
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
870
|
+
object[key] = [...value, ...object[key]];
|
|
871
|
+
} else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
|
|
872
|
+
object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
873
|
+
} else {
|
|
874
|
+
object[key] = value;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
return object;
|
|
878
|
+
}
|
|
879
|
+
function createDefu(merger) {
|
|
880
|
+
return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
|
|
881
|
+
}
|
|
882
|
+
var defu = createDefu();
|
|
883
|
+
function isPlainObject(obj) {
|
|
884
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
885
|
+
}
|
|
886
|
+
function isLogObj(arg) {
|
|
887
|
+
if (!isPlainObject(arg)) {
|
|
888
|
+
return false;
|
|
889
|
+
}
|
|
890
|
+
if (!arg.message && !arg.args) {
|
|
891
|
+
return false;
|
|
892
|
+
}
|
|
893
|
+
if (arg.stack) {
|
|
894
|
+
return false;
|
|
895
|
+
}
|
|
896
|
+
return true;
|
|
897
|
+
}
|
|
898
|
+
var paused = false;
|
|
899
|
+
var queue = [];
|
|
900
|
+
|
|
901
|
+
class Consola {
|
|
902
|
+
options;
|
|
903
|
+
_lastLog;
|
|
904
|
+
_mockFn;
|
|
905
|
+
constructor(options = {}) {
|
|
906
|
+
const types = options.types || LogTypes;
|
|
907
|
+
this.options = defu({
|
|
908
|
+
...options,
|
|
909
|
+
defaults: { ...options.defaults },
|
|
910
|
+
level: _normalizeLogLevel(options.level, types),
|
|
911
|
+
reporters: [...options.reporters || []]
|
|
912
|
+
}, {
|
|
913
|
+
types: LogTypes,
|
|
914
|
+
throttle: 1000,
|
|
915
|
+
throttleMin: 5,
|
|
916
|
+
formatOptions: {
|
|
917
|
+
date: true,
|
|
918
|
+
colors: false,
|
|
919
|
+
compact: true
|
|
920
|
+
}
|
|
921
|
+
});
|
|
922
|
+
for (const type in types) {
|
|
923
|
+
const defaults = {
|
|
924
|
+
type,
|
|
925
|
+
...this.options.defaults,
|
|
926
|
+
...types[type]
|
|
927
|
+
};
|
|
928
|
+
this[type] = this._wrapLogFn(defaults);
|
|
929
|
+
this[type].raw = this._wrapLogFn(defaults, true);
|
|
930
|
+
}
|
|
931
|
+
if (this.options.mockFn) {
|
|
932
|
+
this.mockTypes();
|
|
933
|
+
}
|
|
934
|
+
this._lastLog = {};
|
|
935
|
+
}
|
|
936
|
+
get level() {
|
|
937
|
+
return this.options.level;
|
|
938
|
+
}
|
|
939
|
+
set level(level) {
|
|
940
|
+
this.options.level = _normalizeLogLevel(level, this.options.types, this.options.level);
|
|
941
|
+
}
|
|
942
|
+
prompt(message, opts) {
|
|
943
|
+
if (!this.options.prompt) {
|
|
944
|
+
throw new Error("prompt is not supported!");
|
|
945
|
+
}
|
|
946
|
+
return this.options.prompt(message, opts);
|
|
947
|
+
}
|
|
948
|
+
create(options) {
|
|
949
|
+
const instance = new Consola({
|
|
950
|
+
...this.options,
|
|
951
|
+
...options
|
|
952
|
+
});
|
|
953
|
+
if (this._mockFn) {
|
|
954
|
+
instance.mockTypes(this._mockFn);
|
|
955
|
+
}
|
|
956
|
+
return instance;
|
|
957
|
+
}
|
|
958
|
+
withDefaults(defaults) {
|
|
959
|
+
return this.create({
|
|
960
|
+
...this.options,
|
|
961
|
+
defaults: {
|
|
962
|
+
...this.options.defaults,
|
|
963
|
+
...defaults
|
|
964
|
+
}
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
withTag(tag) {
|
|
968
|
+
return this.withDefaults({
|
|
969
|
+
tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
addReporter(reporter) {
|
|
973
|
+
this.options.reporters.push(reporter);
|
|
974
|
+
return this;
|
|
975
|
+
}
|
|
976
|
+
removeReporter(reporter) {
|
|
977
|
+
if (reporter) {
|
|
978
|
+
const i = this.options.reporters.indexOf(reporter);
|
|
979
|
+
if (i !== -1) {
|
|
980
|
+
return this.options.reporters.splice(i, 1);
|
|
981
|
+
}
|
|
982
|
+
} else {
|
|
983
|
+
this.options.reporters.splice(0);
|
|
984
|
+
}
|
|
985
|
+
return this;
|
|
986
|
+
}
|
|
987
|
+
setReporters(reporters) {
|
|
988
|
+
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
|
|
989
|
+
return this;
|
|
990
|
+
}
|
|
991
|
+
wrapAll() {
|
|
992
|
+
this.wrapConsole();
|
|
993
|
+
this.wrapStd();
|
|
994
|
+
}
|
|
995
|
+
restoreAll() {
|
|
996
|
+
this.restoreConsole();
|
|
997
|
+
this.restoreStd();
|
|
998
|
+
}
|
|
999
|
+
wrapConsole() {
|
|
1000
|
+
for (const type in this.options.types) {
|
|
1001
|
+
if (!console["__" + type]) {
|
|
1002
|
+
console["__" + type] = console[type];
|
|
1003
|
+
}
|
|
1004
|
+
console[type] = this[type].raw;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
restoreConsole() {
|
|
1008
|
+
for (const type in this.options.types) {
|
|
1009
|
+
if (console["__" + type]) {
|
|
1010
|
+
console[type] = console["__" + type];
|
|
1011
|
+
delete console["__" + type];
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
wrapStd() {
|
|
1016
|
+
this._wrapStream(this.options.stdout, "log");
|
|
1017
|
+
this._wrapStream(this.options.stderr, "log");
|
|
1018
|
+
}
|
|
1019
|
+
_wrapStream(stream, type) {
|
|
1020
|
+
if (!stream) {
|
|
1021
|
+
return;
|
|
1022
|
+
}
|
|
1023
|
+
if (!stream.__write) {
|
|
1024
|
+
stream.__write = stream.write;
|
|
1025
|
+
}
|
|
1026
|
+
stream.write = (data) => {
|
|
1027
|
+
this[type].raw(String(data).trim());
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
restoreStd() {
|
|
1031
|
+
this._restoreStream(this.options.stdout);
|
|
1032
|
+
this._restoreStream(this.options.stderr);
|
|
1033
|
+
}
|
|
1034
|
+
_restoreStream(stream) {
|
|
1035
|
+
if (!stream) {
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
if (stream.__write) {
|
|
1039
|
+
stream.write = stream.__write;
|
|
1040
|
+
delete stream.__write;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
pauseLogs() {
|
|
1044
|
+
paused = true;
|
|
1045
|
+
}
|
|
1046
|
+
resumeLogs() {
|
|
1047
|
+
paused = false;
|
|
1048
|
+
const _queue = queue.splice(0);
|
|
1049
|
+
for (const item of _queue) {
|
|
1050
|
+
item[0]._logFn(item[1], item[2]);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
mockTypes(mockFn) {
|
|
1054
|
+
const _mockFn = mockFn || this.options.mockFn;
|
|
1055
|
+
this._mockFn = _mockFn;
|
|
1056
|
+
if (typeof _mockFn !== "function") {
|
|
1057
|
+
return;
|
|
1058
|
+
}
|
|
1059
|
+
for (const type in this.options.types) {
|
|
1060
|
+
this[type] = _mockFn(type, this.options.types[type]) || this[type];
|
|
1061
|
+
this[type].raw = this[type];
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
_wrapLogFn(defaults, isRaw) {
|
|
1065
|
+
return (...args) => {
|
|
1066
|
+
if (paused) {
|
|
1067
|
+
queue.push([this, defaults, args, isRaw]);
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
return this._logFn(defaults, args, isRaw);
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
_logFn(defaults, args, isRaw) {
|
|
1074
|
+
if ((defaults.level || 0) > this.level) {
|
|
1075
|
+
return false;
|
|
1076
|
+
}
|
|
1077
|
+
const logObj = {
|
|
1078
|
+
date: /* @__PURE__ */ new Date,
|
|
1079
|
+
args: [],
|
|
1080
|
+
...defaults,
|
|
1081
|
+
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
1082
|
+
};
|
|
1083
|
+
if (!isRaw && args.length === 1 && isLogObj(args[0])) {
|
|
1084
|
+
Object.assign(logObj, args[0]);
|
|
1085
|
+
} else {
|
|
1086
|
+
logObj.args = [...args];
|
|
1087
|
+
}
|
|
1088
|
+
if (logObj.message) {
|
|
1089
|
+
logObj.args.unshift(logObj.message);
|
|
1090
|
+
delete logObj.message;
|
|
1091
|
+
}
|
|
1092
|
+
if (logObj.additional) {
|
|
1093
|
+
if (!Array.isArray(logObj.additional)) {
|
|
1094
|
+
logObj.additional = logObj.additional.split(`
|
|
1095
|
+
`);
|
|
1096
|
+
}
|
|
1097
|
+
logObj.args.push(`
|
|
1098
|
+
` + logObj.additional.join(`
|
|
1099
|
+
`));
|
|
1100
|
+
delete logObj.additional;
|
|
1101
|
+
}
|
|
1102
|
+
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
1103
|
+
logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
|
|
1104
|
+
const resolveLog = (newLog = false) => {
|
|
1105
|
+
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
|
|
1106
|
+
if (this._lastLog.object && repeated > 0) {
|
|
1107
|
+
const args2 = [...this._lastLog.object.args];
|
|
1108
|
+
if (repeated > 1) {
|
|
1109
|
+
args2.push(`(repeated ${repeated} times)`);
|
|
1110
|
+
}
|
|
1111
|
+
this._log({ ...this._lastLog.object, args: args2 });
|
|
1112
|
+
this._lastLog.count = 1;
|
|
1113
|
+
}
|
|
1114
|
+
if (newLog) {
|
|
1115
|
+
this._lastLog.object = logObj;
|
|
1116
|
+
this._log(logObj);
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
clearTimeout(this._lastLog.timeout);
|
|
1120
|
+
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
|
|
1121
|
+
this._lastLog.time = logObj.date;
|
|
1122
|
+
if (diffTime < this.options.throttle) {
|
|
1123
|
+
try {
|
|
1124
|
+
const serializedLog = JSON.stringify([
|
|
1125
|
+
logObj.type,
|
|
1126
|
+
logObj.tag,
|
|
1127
|
+
logObj.args
|
|
1128
|
+
]);
|
|
1129
|
+
const isSameLog = this._lastLog.serialized === serializedLog;
|
|
1130
|
+
this._lastLog.serialized = serializedLog;
|
|
1131
|
+
if (isSameLog) {
|
|
1132
|
+
this._lastLog.count = (this._lastLog.count || 0) + 1;
|
|
1133
|
+
if (this._lastLog.count > this.options.throttleMin) {
|
|
1134
|
+
this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
} catch {}
|
|
1139
|
+
}
|
|
1140
|
+
resolveLog(true);
|
|
1141
|
+
}
|
|
1142
|
+
_log(logObj) {
|
|
1143
|
+
for (const reporter of this.options.reporters) {
|
|
1144
|
+
reporter.log(logObj, {
|
|
1145
|
+
options: this.options
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
|
|
1151
|
+
if (input === undefined) {
|
|
1152
|
+
return defaultLevel;
|
|
1153
|
+
}
|
|
1154
|
+
if (typeof input === "number") {
|
|
1155
|
+
return input;
|
|
1156
|
+
}
|
|
1157
|
+
if (types[input] && types[input].level !== undefined) {
|
|
1158
|
+
return types[input].level;
|
|
1159
|
+
}
|
|
1160
|
+
return defaultLevel;
|
|
1161
|
+
}
|
|
1162
|
+
Consola.prototype.add = Consola.prototype.addReporter;
|
|
1163
|
+
Consola.prototype.remove = Consola.prototype.removeReporter;
|
|
1164
|
+
Consola.prototype.clear = Consola.prototype.removeReporter;
|
|
1165
|
+
Consola.prototype.withScope = Consola.prototype.withTag;
|
|
1166
|
+
Consola.prototype.mock = Consola.prototype.mockTypes;
|
|
1167
|
+
Consola.prototype.pause = Consola.prototype.pauseLogs;
|
|
1168
|
+
Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
1169
|
+
function createConsola(options = {}) {
|
|
1170
|
+
return new Consola(options);
|
|
1171
|
+
}
|
|
1172
|
+
// node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
|
|
1173
|
+
import { formatWithOptions } from "node:util";
|
|
1174
|
+
import { sep } from "node:path";
|
|
1175
|
+
function parseStack(stack, message) {
|
|
1176
|
+
const cwd = process.cwd() + sep;
|
|
1177
|
+
const lines = stack.split(`
|
|
1178
|
+
`).splice(message.split(`
|
|
1179
|
+
`).length).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
|
|
1180
|
+
return lines;
|
|
1181
|
+
}
|
|
1182
|
+
function writeStream(data, stream) {
|
|
1183
|
+
const write = stream.__write || stream.write;
|
|
1184
|
+
return write.call(stream, data);
|
|
1185
|
+
}
|
|
1186
|
+
var bracket = (x) => x ? `[${x}]` : "";
|
|
1187
|
+
|
|
1188
|
+
class BasicReporter {
|
|
1189
|
+
formatStack(stack, message, opts) {
|
|
1190
|
+
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
1191
|
+
return indent + parseStack(stack, message).join(`
|
|
1192
|
+
${indent}`);
|
|
1193
|
+
}
|
|
1194
|
+
formatError(err, opts) {
|
|
1195
|
+
const message = err.message ?? formatWithOptions(opts, err);
|
|
1196
|
+
const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
|
|
1197
|
+
const level = opts?.errorLevel || 0;
|
|
1198
|
+
const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
|
|
1199
|
+
const causedError = err.cause ? `
|
|
1200
|
+
|
|
1201
|
+
` + this.formatError(err.cause, { ...opts, errorLevel: level + 1 }) : "";
|
|
1202
|
+
return causedPrefix + message + `
|
|
1203
|
+
` + stack + causedError;
|
|
1204
|
+
}
|
|
1205
|
+
formatArgs(args, opts) {
|
|
1206
|
+
const _args = args.map((arg) => {
|
|
1207
|
+
if (arg && typeof arg.stack === "string") {
|
|
1208
|
+
return this.formatError(arg, opts);
|
|
1209
|
+
}
|
|
1210
|
+
return arg;
|
|
1211
|
+
});
|
|
1212
|
+
return formatWithOptions(opts, ..._args);
|
|
1213
|
+
}
|
|
1214
|
+
formatDate(date, opts) {
|
|
1215
|
+
return opts.date ? date.toLocaleTimeString() : "";
|
|
1216
|
+
}
|
|
1217
|
+
filterAndJoin(arr) {
|
|
1218
|
+
return arr.filter(Boolean).join(" ");
|
|
1219
|
+
}
|
|
1220
|
+
formatLogObj(logObj, opts) {
|
|
1221
|
+
const message = this.formatArgs(logObj.args, opts);
|
|
1222
|
+
if (logObj.type === "box") {
|
|
1223
|
+
return `
|
|
1224
|
+
` + [
|
|
1225
|
+
bracket(logObj.tag),
|
|
1226
|
+
logObj.title && logObj.title,
|
|
1227
|
+
...message.split(`
|
|
1228
|
+
`)
|
|
1229
|
+
].filter(Boolean).map((l) => " > " + l).join(`
|
|
1230
|
+
`) + `
|
|
1231
|
+
`;
|
|
1232
|
+
}
|
|
1233
|
+
return this.filterAndJoin([
|
|
1234
|
+
bracket(logObj.type),
|
|
1235
|
+
bracket(logObj.tag),
|
|
1236
|
+
message
|
|
1237
|
+
]);
|
|
1238
|
+
}
|
|
1239
|
+
log(logObj, ctx) {
|
|
1240
|
+
const line = this.formatLogObj(logObj, {
|
|
1241
|
+
columns: ctx.options.stdout.columns || 0,
|
|
1242
|
+
...ctx.options.formatOptions
|
|
1243
|
+
});
|
|
1244
|
+
return writeStream(line + `
|
|
1245
|
+
`, logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
// node_modules/consola/dist/index.mjs
|
|
1250
|
+
import g$1 from "node:process";
|
|
1251
|
+
|
|
1252
|
+
// node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
|
|
1253
|
+
import * as tty from "node:tty";
|
|
1254
|
+
var {
|
|
1255
|
+
env = {},
|
|
1256
|
+
argv = [],
|
|
1257
|
+
platform = ""
|
|
1258
|
+
} = typeof process === "undefined" ? {} : process;
|
|
1259
|
+
var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
1260
|
+
var isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
1261
|
+
var isWindows = platform === "win32";
|
|
1262
|
+
var isDumbTerminal = env.TERM === "dumb";
|
|
1263
|
+
var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
1264
|
+
var isCI = "CI" in env && (("GITHUB_ACTIONS" in env) || ("GITLAB_CI" in env) || ("CIRCLECI" in env));
|
|
1265
|
+
var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
1266
|
+
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)) {
|
|
1267
|
+
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
1268
|
+
}
|
|
1269
|
+
function clearBleed(index, string, open, close, replace) {
|
|
1270
|
+
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
1271
|
+
}
|
|
1272
|
+
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
1273
|
+
return (string) => string || !(string === "" || string === undefined) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
|
|
1274
|
+
}
|
|
1275
|
+
function init(open, close, replace) {
|
|
1276
|
+
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
1277
|
+
}
|
|
1278
|
+
var colorDefs = {
|
|
1279
|
+
reset: init(0, 0),
|
|
1280
|
+
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
1281
|
+
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
1282
|
+
italic: init(3, 23),
|
|
1283
|
+
underline: init(4, 24),
|
|
1284
|
+
inverse: init(7, 27),
|
|
1285
|
+
hidden: init(8, 28),
|
|
1286
|
+
strikethrough: init(9, 29),
|
|
1287
|
+
black: init(30, 39),
|
|
1288
|
+
red: init(31, 39),
|
|
1289
|
+
green: init(32, 39),
|
|
1290
|
+
yellow: init(33, 39),
|
|
1291
|
+
blue: init(34, 39),
|
|
1292
|
+
magenta: init(35, 39),
|
|
1293
|
+
cyan: init(36, 39),
|
|
1294
|
+
white: init(37, 39),
|
|
1295
|
+
gray: init(90, 39),
|
|
1296
|
+
bgBlack: init(40, 49),
|
|
1297
|
+
bgRed: init(41, 49),
|
|
1298
|
+
bgGreen: init(42, 49),
|
|
1299
|
+
bgYellow: init(43, 49),
|
|
1300
|
+
bgBlue: init(44, 49),
|
|
1301
|
+
bgMagenta: init(45, 49),
|
|
1302
|
+
bgCyan: init(46, 49),
|
|
1303
|
+
bgWhite: init(47, 49),
|
|
1304
|
+
blackBright: init(90, 39),
|
|
1305
|
+
redBright: init(91, 39),
|
|
1306
|
+
greenBright: init(92, 39),
|
|
1307
|
+
yellowBright: init(93, 39),
|
|
1308
|
+
blueBright: init(94, 39),
|
|
1309
|
+
magentaBright: init(95, 39),
|
|
1310
|
+
cyanBright: init(96, 39),
|
|
1311
|
+
whiteBright: init(97, 39),
|
|
1312
|
+
bgBlackBright: init(100, 49),
|
|
1313
|
+
bgRedBright: init(101, 49),
|
|
1314
|
+
bgGreenBright: init(102, 49),
|
|
1315
|
+
bgYellowBright: init(103, 49),
|
|
1316
|
+
bgBlueBright: init(104, 49),
|
|
1317
|
+
bgMagentaBright: init(105, 49),
|
|
1318
|
+
bgCyanBright: init(106, 49),
|
|
1319
|
+
bgWhiteBright: init(107, 49)
|
|
1320
|
+
};
|
|
1321
|
+
function createColors(useColor = isColorSupported) {
|
|
1322
|
+
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
1323
|
+
}
|
|
1324
|
+
var colors = createColors();
|
|
1325
|
+
function getColor(color, fallback = "reset") {
|
|
1326
|
+
return colors[color] || colors[fallback];
|
|
1327
|
+
}
|
|
1328
|
+
var ansiRegex = [
|
|
1329
|
+
String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
|
|
1330
|
+
String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
|
|
1331
|
+
].join("|");
|
|
1332
|
+
function stripAnsi(text) {
|
|
1333
|
+
return text.replace(new RegExp(ansiRegex, "g"), "");
|
|
1334
|
+
}
|
|
1335
|
+
var boxStylePresets = {
|
|
1336
|
+
solid: {
|
|
1337
|
+
tl: "┌",
|
|
1338
|
+
tr: "┐",
|
|
1339
|
+
bl: "└",
|
|
1340
|
+
br: "┘",
|
|
1341
|
+
h: "─",
|
|
1342
|
+
v: "│"
|
|
1343
|
+
},
|
|
1344
|
+
double: {
|
|
1345
|
+
tl: "╔",
|
|
1346
|
+
tr: "╗",
|
|
1347
|
+
bl: "╚",
|
|
1348
|
+
br: "╝",
|
|
1349
|
+
h: "═",
|
|
1350
|
+
v: "║"
|
|
1351
|
+
},
|
|
1352
|
+
doubleSingle: {
|
|
1353
|
+
tl: "╓",
|
|
1354
|
+
tr: "╖",
|
|
1355
|
+
bl: "╙",
|
|
1356
|
+
br: "╜",
|
|
1357
|
+
h: "─",
|
|
1358
|
+
v: "║"
|
|
1359
|
+
},
|
|
1360
|
+
doubleSingleRounded: {
|
|
1361
|
+
tl: "╭",
|
|
1362
|
+
tr: "╮",
|
|
1363
|
+
bl: "╰",
|
|
1364
|
+
br: "╯",
|
|
1365
|
+
h: "─",
|
|
1366
|
+
v: "║"
|
|
1367
|
+
},
|
|
1368
|
+
singleThick: {
|
|
1369
|
+
tl: "┏",
|
|
1370
|
+
tr: "┓",
|
|
1371
|
+
bl: "┗",
|
|
1372
|
+
br: "┛",
|
|
1373
|
+
h: "━",
|
|
1374
|
+
v: "┃"
|
|
1375
|
+
},
|
|
1376
|
+
singleDouble: {
|
|
1377
|
+
tl: "╒",
|
|
1378
|
+
tr: "╕",
|
|
1379
|
+
bl: "╘",
|
|
1380
|
+
br: "╛",
|
|
1381
|
+
h: "═",
|
|
1382
|
+
v: "│"
|
|
1383
|
+
},
|
|
1384
|
+
singleDoubleRounded: {
|
|
1385
|
+
tl: "╭",
|
|
1386
|
+
tr: "╮",
|
|
1387
|
+
bl: "╰",
|
|
1388
|
+
br: "╯",
|
|
1389
|
+
h: "═",
|
|
1390
|
+
v: "│"
|
|
1391
|
+
},
|
|
1392
|
+
rounded: {
|
|
1393
|
+
tl: "╭",
|
|
1394
|
+
tr: "╮",
|
|
1395
|
+
bl: "╰",
|
|
1396
|
+
br: "╯",
|
|
1397
|
+
h: "─",
|
|
1398
|
+
v: "│"
|
|
1399
|
+
}
|
|
1400
|
+
};
|
|
1401
|
+
var defaultStyle = {
|
|
1402
|
+
borderColor: "white",
|
|
1403
|
+
borderStyle: "rounded",
|
|
1404
|
+
valign: "center",
|
|
1405
|
+
padding: 2,
|
|
1406
|
+
marginLeft: 1,
|
|
1407
|
+
marginTop: 1,
|
|
1408
|
+
marginBottom: 1
|
|
1409
|
+
};
|
|
1410
|
+
function box(text, _opts = {}) {
|
|
1411
|
+
const opts = {
|
|
1412
|
+
..._opts,
|
|
1413
|
+
style: {
|
|
1414
|
+
...defaultStyle,
|
|
1415
|
+
..._opts.style
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1418
|
+
const textLines = text.split(`
|
|
1419
|
+
`);
|
|
1420
|
+
const boxLines = [];
|
|
1421
|
+
const _color = getColor(opts.style.borderColor);
|
|
1422
|
+
const borderStyle = {
|
|
1423
|
+
...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
|
|
1424
|
+
};
|
|
1425
|
+
if (_color) {
|
|
1426
|
+
for (const key in borderStyle) {
|
|
1427
|
+
borderStyle[key] = _color(borderStyle[key]);
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
|
|
1431
|
+
const height = textLines.length + paddingOffset;
|
|
1432
|
+
const width = Math.max(...textLines.map((line) => stripAnsi(line).length), opts.title ? stripAnsi(opts.title).length : 0) + paddingOffset;
|
|
1433
|
+
const widthOffset = width + paddingOffset;
|
|
1434
|
+
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
|
|
1435
|
+
if (opts.style.marginTop > 0) {
|
|
1436
|
+
boxLines.push("".repeat(opts.style.marginTop));
|
|
1437
|
+
}
|
|
1438
|
+
if (opts.title) {
|
|
1439
|
+
const title = _color ? _color(opts.title) : opts.title;
|
|
1440
|
+
const left = borderStyle.h.repeat(Math.floor((width - stripAnsi(opts.title).length) / 2));
|
|
1441
|
+
const right = borderStyle.h.repeat(width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset);
|
|
1442
|
+
boxLines.push(`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`);
|
|
1443
|
+
} else {
|
|
1444
|
+
boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
|
|
1445
|
+
}
|
|
1446
|
+
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
1447
|
+
for (let i = 0;i < height; i++) {
|
|
1448
|
+
if (i < valignOffset || i >= valignOffset + textLines.length) {
|
|
1449
|
+
boxLines.push(`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`);
|
|
1450
|
+
} else {
|
|
1451
|
+
const line = textLines[i - valignOffset];
|
|
1452
|
+
const left = " ".repeat(paddingOffset);
|
|
1453
|
+
const right = " ".repeat(width - stripAnsi(line).length);
|
|
1454
|
+
boxLines.push(`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`);
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
boxLines.push(`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`);
|
|
1458
|
+
if (opts.style.marginBottom > 0) {
|
|
1459
|
+
boxLines.push("".repeat(opts.style.marginBottom));
|
|
1460
|
+
}
|
|
1461
|
+
return boxLines.join(`
|
|
1462
|
+
`);
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
// node_modules/consola/dist/index.mjs
|
|
1466
|
+
var r2 = Object.create(null);
|
|
1467
|
+
var i = (e2) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e2 ? r2 : globalThis);
|
|
1468
|
+
var o2 = new Proxy(r2, { get(e2, s) {
|
|
1469
|
+
return i()[s] ?? r2[s];
|
|
1470
|
+
}, has(e2, s) {
|
|
1471
|
+
const E = i();
|
|
1472
|
+
return s in E || s in r2;
|
|
1473
|
+
}, set(e2, s, E) {
|
|
1474
|
+
const B2 = i(true);
|
|
1475
|
+
return B2[s] = E, true;
|
|
1476
|
+
}, deleteProperty(e2, s) {
|
|
1477
|
+
if (!s)
|
|
1478
|
+
return false;
|
|
1479
|
+
const E = i(true);
|
|
1480
|
+
return delete E[s], true;
|
|
1481
|
+
}, ownKeys() {
|
|
1482
|
+
const e2 = i(true);
|
|
1483
|
+
return Object.keys(e2);
|
|
1484
|
+
} });
|
|
1485
|
+
var t = typeof process < "u" && process.env && "development" || "";
|
|
1486
|
+
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 }]];
|
|
1487
|
+
function b() {
|
|
1488
|
+
if (globalThis.process?.env)
|
|
1489
|
+
for (const e2 of f2) {
|
|
1490
|
+
const s = e2[1] || e2[0];
|
|
1491
|
+
if (globalThis.process?.env[s])
|
|
1492
|
+
return { name: e2[0].toLowerCase(), ...e2[2] };
|
|
1493
|
+
}
|
|
1494
|
+
return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? { name: "stackblitz", ci: false } : { name: "", ci: false };
|
|
1495
|
+
}
|
|
1496
|
+
var l = b();
|
|
1497
|
+
l.name;
|
|
1498
|
+
function n(e2) {
|
|
1499
|
+
return e2 ? e2 !== "false" : false;
|
|
1500
|
+
}
|
|
1501
|
+
var I2 = globalThis.process?.platform || "";
|
|
1502
|
+
var T2 = n(o2.CI) || l.ci !== false;
|
|
1503
|
+
var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
|
|
1504
|
+
var g2 = n(o2.DEBUG);
|
|
1505
|
+
var R2 = t === "test" || n(o2.TEST);
|
|
1506
|
+
n(o2.MINIMAL);
|
|
1507
|
+
var A2 = /^win/i.test(I2);
|
|
1508
|
+
!n(o2.NO_COLOR) && (n(o2.FORCE_COLOR) || (a || A2) && o2.TERM);
|
|
1509
|
+
var C2 = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
|
|
1510
|
+
Number(C2?.split(".")[0]);
|
|
1511
|
+
var y2 = globalThis.process || Object.create(null);
|
|
1512
|
+
var _2 = { versions: {} };
|
|
1513
|
+
new Proxy(y2, { get(e2, s) {
|
|
1514
|
+
if (s === "env")
|
|
1515
|
+
return o2;
|
|
1516
|
+
if (s in e2)
|
|
1517
|
+
return e2[s];
|
|
1518
|
+
if (s in _2)
|
|
1519
|
+
return _2[s];
|
|
1520
|
+
} });
|
|
1521
|
+
var c2 = globalThis.process?.release?.name === "node";
|
|
1522
|
+
var O2 = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
|
|
1523
|
+
var D = !!globalThis.Deno;
|
|
1524
|
+
var L2 = !!globalThis.fastly;
|
|
1525
|
+
var S2 = !!globalThis.Netlify;
|
|
1526
|
+
var u2 = !!globalThis.EdgeRuntime;
|
|
1527
|
+
var N2 = globalThis.navigator?.userAgent === "Cloudflare-Workers";
|
|
1528
|
+
var F2 = [[S2, "netlify"], [u2, "edge-light"], [N2, "workerd"], [L2, "fastly"], [D, "deno"], [O2, "bun"], [c2, "node"]];
|
|
1529
|
+
function G2() {
|
|
1530
|
+
const e2 = F2.find((s) => s[0]);
|
|
1531
|
+
if (e2)
|
|
1532
|
+
return { name: e2[1] };
|
|
1533
|
+
}
|
|
1534
|
+
var P2 = G2();
|
|
1535
|
+
P2?.name;
|
|
1536
|
+
function ansiRegex2({ onlyFirst = false } = {}) {
|
|
1537
|
+
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
1538
|
+
const pattern = [
|
|
1539
|
+
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
|
|
1540
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
|
|
1541
|
+
].join("|");
|
|
1542
|
+
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
|
1543
|
+
}
|
|
1544
|
+
var regex = ansiRegex2();
|
|
1545
|
+
function stripAnsi2(string) {
|
|
1546
|
+
if (typeof string !== "string") {
|
|
1547
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
1548
|
+
}
|
|
1549
|
+
return string.replace(regex, "");
|
|
1550
|
+
}
|
|
1551
|
+
function isAmbiguous(x2) {
|
|
1552
|
+
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;
|
|
1553
|
+
}
|
|
1554
|
+
function isFullWidth(x2) {
|
|
1555
|
+
return x2 === 12288 || x2 >= 65281 && x2 <= 65376 || x2 >= 65504 && x2 <= 65510;
|
|
1556
|
+
}
|
|
1557
|
+
function isWide(x2) {
|
|
1558
|
+
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;
|
|
1559
|
+
}
|
|
1560
|
+
function validate(codePoint) {
|
|
1561
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
1562
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
1566
|
+
validate(codePoint);
|
|
1567
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
|
|
1568
|
+
return 2;
|
|
1569
|
+
}
|
|
1570
|
+
return 1;
|
|
1571
|
+
}
|
|
1572
|
+
var emojiRegex = () => {
|
|
1573
|
+
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;
|
|
1574
|
+
};
|
|
1575
|
+
var segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter : { segment: (str) => str.split("") };
|
|
1576
|
+
var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
1577
|
+
function stringWidth$1(string, options = {}) {
|
|
1578
|
+
if (typeof string !== "string" || string.length === 0) {
|
|
1579
|
+
return 0;
|
|
1580
|
+
}
|
|
1581
|
+
const {
|
|
1582
|
+
ambiguousIsNarrow = true,
|
|
1583
|
+
countAnsiEscapeCodes = false
|
|
1584
|
+
} = options;
|
|
1585
|
+
if (!countAnsiEscapeCodes) {
|
|
1586
|
+
string = stripAnsi2(string);
|
|
1587
|
+
}
|
|
1588
|
+
if (string.length === 0) {
|
|
1589
|
+
return 0;
|
|
1590
|
+
}
|
|
1591
|
+
let width = 0;
|
|
1592
|
+
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
1593
|
+
for (const { segment: character } of segmenter.segment(string)) {
|
|
1594
|
+
const codePoint = character.codePointAt(0);
|
|
1595
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
1596
|
+
continue;
|
|
1597
|
+
}
|
|
1598
|
+
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
1599
|
+
continue;
|
|
1600
|
+
}
|
|
1601
|
+
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
|
|
1602
|
+
continue;
|
|
1603
|
+
}
|
|
1604
|
+
if (codePoint >= 55296 && codePoint <= 57343) {
|
|
1605
|
+
continue;
|
|
1606
|
+
}
|
|
1607
|
+
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
1608
|
+
continue;
|
|
1609
|
+
}
|
|
1610
|
+
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
1611
|
+
continue;
|
|
1612
|
+
}
|
|
1613
|
+
if (emojiRegex().test(character)) {
|
|
1614
|
+
width += 2;
|
|
1615
|
+
continue;
|
|
1616
|
+
}
|
|
1617
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
1618
|
+
}
|
|
1619
|
+
return width;
|
|
1620
|
+
}
|
|
1621
|
+
function isUnicodeSupported() {
|
|
1622
|
+
const { env: env2 } = g$1;
|
|
1623
|
+
const { TERM, TERM_PROGRAM } = env2;
|
|
1624
|
+
if (g$1.platform !== "win32") {
|
|
1625
|
+
return TERM !== "linux";
|
|
1626
|
+
}
|
|
1627
|
+
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";
|
|
1628
|
+
}
|
|
1629
|
+
var TYPE_COLOR_MAP = {
|
|
1630
|
+
info: "cyan",
|
|
1631
|
+
fail: "red",
|
|
1632
|
+
success: "green",
|
|
1633
|
+
ready: "green",
|
|
1634
|
+
start: "magenta"
|
|
1635
|
+
};
|
|
1636
|
+
var LEVEL_COLOR_MAP = {
|
|
1637
|
+
0: "red",
|
|
1638
|
+
1: "yellow"
|
|
1639
|
+
};
|
|
1640
|
+
var unicode = isUnicodeSupported();
|
|
1641
|
+
var s = (c3, fallback) => unicode ? c3 : fallback;
|
|
1642
|
+
var TYPE_ICONS = {
|
|
1643
|
+
error: s("✖", "×"),
|
|
1644
|
+
fatal: s("✖", "×"),
|
|
1645
|
+
ready: s("✔", "√"),
|
|
1646
|
+
warn: s("⚠", "‼"),
|
|
1647
|
+
info: s("ℹ", "i"),
|
|
1648
|
+
success: s("✔", "√"),
|
|
1649
|
+
debug: s("⚙", "D"),
|
|
1650
|
+
trace: s("→", "→"),
|
|
1651
|
+
fail: s("✖", "×"),
|
|
1652
|
+
start: s("◐", "o"),
|
|
1653
|
+
log: ""
|
|
1654
|
+
};
|
|
1655
|
+
function stringWidth(str) {
|
|
1656
|
+
const hasICU = typeof Intl === "object";
|
|
1657
|
+
if (!hasICU || !Intl.Segmenter) {
|
|
1658
|
+
return stripAnsi(str).length;
|
|
1659
|
+
}
|
|
1660
|
+
return stringWidth$1(str);
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
class FancyReporter extends BasicReporter {
|
|
1664
|
+
formatStack(stack, message, opts) {
|
|
1665
|
+
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
1666
|
+
return `
|
|
1667
|
+
${indent}` + parseStack(stack, message).map((line) => " " + line.replace(/^at +/, (m2) => colors.gray(m2)).replace(/\((.+)\)/, (_3, m2) => `(${colors.cyan(m2)})`)).join(`
|
|
1668
|
+
${indent}`);
|
|
1669
|
+
}
|
|
1670
|
+
formatType(logObj, isBadge, opts) {
|
|
1671
|
+
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
1672
|
+
if (isBadge) {
|
|
1673
|
+
return getBgColor(typeColor)(colors.black(` ${logObj.type.toUpperCase()} `));
|
|
1674
|
+
}
|
|
1675
|
+
const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
|
|
1676
|
+
return _type ? getColor2(typeColor)(_type) : "";
|
|
1677
|
+
}
|
|
1678
|
+
formatLogObj(logObj, opts) {
|
|
1679
|
+
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(`
|
|
1680
|
+
`);
|
|
1681
|
+
if (logObj.type === "box") {
|
|
1682
|
+
return box(characterFormat(message + (additional.length > 0 ? `
|
|
1683
|
+
` + additional.join(`
|
|
1684
|
+
`) : "")), {
|
|
1685
|
+
title: logObj.title ? characterFormat(logObj.title) : undefined,
|
|
1686
|
+
style: logObj.style
|
|
1687
|
+
});
|
|
1688
|
+
}
|
|
1689
|
+
const date = this.formatDate(logObj.date, opts);
|
|
1690
|
+
const coloredDate = date && colors.gray(date);
|
|
1691
|
+
const isBadge = logObj.badge ?? logObj.level < 2;
|
|
1692
|
+
const type = this.formatType(logObj, isBadge, opts);
|
|
1693
|
+
const tag = logObj.tag ? colors.gray(logObj.tag) : "";
|
|
1694
|
+
let line;
|
|
1695
|
+
const left = this.filterAndJoin([type, characterFormat(message)]);
|
|
1696
|
+
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
1697
|
+
const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
|
|
1698
|
+
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
|
|
1699
|
+
line += characterFormat(additional.length > 0 ? `
|
|
1700
|
+
` + additional.join(`
|
|
1701
|
+
`) : "");
|
|
1702
|
+
if (logObj.type === "trace") {
|
|
1703
|
+
const _err = new Error("Trace: " + logObj.message);
|
|
1704
|
+
line += this.formatStack(_err.stack || "", _err.message);
|
|
1705
|
+
}
|
|
1706
|
+
return isBadge ? `
|
|
1707
|
+
` + line + `
|
|
1708
|
+
` : line;
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
function characterFormat(str) {
|
|
1712
|
+
return str.replace(/`([^`]+)`/gm, (_3, m2) => colors.cyan(m2)).replace(/\s+_([^_]+)_\s+/gm, (_3, m2) => ` ${colors.underline(m2)} `);
|
|
1713
|
+
}
|
|
1714
|
+
function getColor2(color = "white") {
|
|
1715
|
+
return colors[color] || colors.white;
|
|
1716
|
+
}
|
|
1717
|
+
function getBgColor(color = "bgWhite") {
|
|
1718
|
+
return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
|
|
1719
|
+
}
|
|
1720
|
+
function createConsola2(options = {}) {
|
|
1721
|
+
let level = _getDefaultLogLevel();
|
|
1722
|
+
if (process.env.CONSOLA_LEVEL) {
|
|
1723
|
+
level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
|
|
1724
|
+
}
|
|
1725
|
+
const consola2 = createConsola({
|
|
1726
|
+
level,
|
|
1727
|
+
defaults: { level },
|
|
1728
|
+
stdout: process.stdout,
|
|
1729
|
+
stderr: process.stderr,
|
|
1730
|
+
prompt: (...args) => Promise.resolve().then(() => (init_prompt(), exports_prompt)).then((m2) => m2.prompt(...args)),
|
|
1731
|
+
reporters: options.reporters || [
|
|
1732
|
+
options.fancy ?? !(T2 || R2) ? new FancyReporter : new BasicReporter
|
|
1733
|
+
],
|
|
1734
|
+
...options
|
|
1735
|
+
});
|
|
1736
|
+
return consola2;
|
|
1737
|
+
}
|
|
1738
|
+
function _getDefaultLogLevel() {
|
|
1739
|
+
if (g2) {
|
|
1740
|
+
return LogLevels.debug;
|
|
1741
|
+
}
|
|
1742
|
+
if (R2) {
|
|
1743
|
+
return LogLevels.warn;
|
|
1744
|
+
}
|
|
1745
|
+
return LogLevels.info;
|
|
1746
|
+
}
|
|
1747
|
+
var consola = createConsola2();
|
|
1748
|
+
|
|
1749
|
+
// src/logger.ts
|
|
1750
|
+
var base = createConsola2({ defaults: { level: 3, tag: "bento" } });
|
|
1751
|
+
var useLogger = (tag) => tag ? base.withTag(tag) : base;
|
|
1752
|
+
|
|
1753
|
+
// src/subCommands/init.ts
|
|
1754
|
+
var console2 = useLogger();
|
|
1755
|
+
var init_default = {
|
|
1756
|
+
meta: {
|
|
1757
|
+
name: "init",
|
|
1758
|
+
description: "create a new bento project"
|
|
1759
|
+
},
|
|
1760
|
+
args: {},
|
|
1761
|
+
run({ args }) {
|
|
1762
|
+
console2.info(args);
|
|
1763
|
+
}
|
|
1764
|
+
};
|
|
1765
|
+
|
|
1766
|
+
// src/index.ts
|
|
1767
|
+
var main = defineCommand({
|
|
1768
|
+
meta: {
|
|
1769
|
+
name: "bento",
|
|
1770
|
+
version
|
|
1771
|
+
},
|
|
1772
|
+
subCommands: {
|
|
1773
|
+
init: init_default
|
|
1774
|
+
}
|
|
1775
|
+
});
|