create-rsbuild 1.0.1-rc.0 → 1.0.1-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,1651 +1,104 @@
1
- #!/usr/bin/env node
2
- import { createRequire } from 'module';
3
- var require = createRequire(import.meta['url']);
4
-
5
- var __create = Object.create;
6
- var __defProp = Object.defineProperty;
7
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
- var __getOwnPropNames = Object.getOwnPropertyNames;
9
- var __getProtoOf = Object.getPrototypeOf;
10
- var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __require = /* @__PURE__ */ ((x3) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x3, {
12
- get: (a3, b3) => (typeof require !== "undefined" ? require : a3)[b3]
13
- }) : x3)(function(x3) {
14
- if (typeof require !== "undefined")
15
- return require.apply(this, arguments);
16
- throw Error('Dynamic require of "' + x3 + '" is not supported');
17
- });
18
- var __esm = (fn, res) => function __init() {
19
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
20
- };
21
- var __commonJS = (cb, mod) => function __require2() {
22
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
23
- };
24
- var __copyProps = (to, from, except, desc) => {
25
- if (from && typeof from === "object" || typeof from === "function") {
26
- for (let key of __getOwnPropNames(from))
27
- if (!__hasOwnProp.call(to, key) && key !== except)
28
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29
- }
30
- return to;
31
- };
32
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
33
- // If the importer is in node compatibility mode or this is not an ESM
34
- // file that has been converted to a CommonJS file using a Babel-
35
- // compatible transform (i.e. "__esModule" has not been set), then set
36
- // "default" to the CommonJS "module.exports" for node compatibility.
37
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
38
- mod
39
- ));
40
-
41
- // ../../node_modules/.pnpm/@modern-js+module-tools@2.58.2_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js
42
- import { fileURLToPath } from "url";
43
- import path from "path";
44
- var getFilename, getDirname, __dirname;
45
- var init_esm = __esm({
46
- "../../node_modules/.pnpm/@modern-js+module-tools@2.58.2_typescript@5.5.2/node_modules/@modern-js/module-tools/shims/esm.js"() {
47
- "use strict";
48
- getFilename = () => fileURLToPath(import.meta.url);
49
- getDirname = () => path.dirname(getFilename());
50
- __dirname = /* @__PURE__ */ getDirname();
51
- }
52
- });
53
-
54
- // ../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
55
- var require_src = __commonJS({
56
- "../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
57
- "use strict";
58
- init_esm();
59
- var ESC = "\x1B";
60
- var CSI = `${ESC}[`;
61
- var beep = "\x07";
62
- var cursor = {
63
- to(x3, y3) {
64
- if (!y3)
65
- return `${CSI}${x3 + 1}G`;
66
- return `${CSI}${y3 + 1};${x3 + 1}H`;
67
- },
68
- move(x3, y3) {
69
- let ret = "";
70
- if (x3 < 0)
71
- ret += `${CSI}${-x3}D`;
72
- else if (x3 > 0)
73
- ret += `${CSI}${x3}C`;
74
- if (y3 < 0)
75
- ret += `${CSI}${-y3}A`;
76
- else if (y3 > 0)
77
- ret += `${CSI}${y3}B`;
78
- return ret;
79
- },
80
- up: (count = 1) => `${CSI}${count}A`,
81
- down: (count = 1) => `${CSI}${count}B`,
82
- forward: (count = 1) => `${CSI}${count}C`,
83
- backward: (count = 1) => `${CSI}${count}D`,
84
- nextLine: (count = 1) => `${CSI}E`.repeat(count),
85
- prevLine: (count = 1) => `${CSI}F`.repeat(count),
86
- left: `${CSI}G`,
87
- hide: `${CSI}?25l`,
88
- show: `${CSI}?25h`,
89
- save: `${ESC}7`,
90
- restore: `${ESC}8`
91
- };
92
- var scroll = {
93
- up: (count = 1) => `${CSI}S`.repeat(count),
94
- down: (count = 1) => `${CSI}T`.repeat(count)
95
- };
96
- var erase = {
97
- screen: `${CSI}2J`,
98
- up: (count = 1) => `${CSI}1J`.repeat(count),
99
- down: (count = 1) => `${CSI}J`.repeat(count),
100
- line: `${CSI}2K`,
101
- lineEnd: `${CSI}K`,
102
- lineStart: `${CSI}1K`,
103
- lines(count) {
104
- let clear = "";
105
- for (let i = 0; i < count; i++)
106
- clear += this.line + (i < count - 1 ? cursor.up() : "");
107
- if (count)
108
- clear += cursor.left;
109
- return clear;
110
- }
111
- };
112
- module.exports = { cursor, scroll, erase, beep };
113
- }
114
- });
115
-
116
- // ../../node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js
117
- var require_picocolors = __commonJS({
118
- "../../node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js"(exports, module) {
119
- "use strict";
120
- init_esm();
121
- var argv = process.argv || [];
122
- var env2 = process.env;
123
- var isColorSupported = !("NO_COLOR" in env2 || argv.includes("--no-color")) && ("FORCE_COLOR" in env2 || argv.includes("--color") || process.platform === "win32" || __require != null && __require("tty").isatty(1) && env2.TERM !== "dumb" || "CI" in env2);
124
- var formatter2 = (open, close, replace = open) => (input) => {
125
- let string = "" + input;
126
- let index = string.indexOf(close, open.length);
127
- return ~index ? open + replaceClose2(string, close, replace, index) + close : open + string + close;
128
- };
129
- var replaceClose2 = (string, close, replace, index) => {
130
- let result = "";
131
- let cursor = 0;
132
- do {
133
- result += string.substring(cursor, index) + replace;
134
- cursor = index + close.length;
135
- index = string.indexOf(close, cursor);
136
- } while (~index);
137
- return result + string.substring(cursor);
138
- };
139
- var createColors = (enabled = isColorSupported) => {
140
- let init = enabled ? formatter2 : () => String;
141
- return {
142
- isColorSupported: enabled,
143
- reset: init("\x1B[0m", "\x1B[0m"),
144
- bold: init("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
145
- dim: init("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
146
- italic: init("\x1B[3m", "\x1B[23m"),
147
- underline: init("\x1B[4m", "\x1B[24m"),
148
- inverse: init("\x1B[7m", "\x1B[27m"),
149
- hidden: init("\x1B[8m", "\x1B[28m"),
150
- strikethrough: init("\x1B[9m", "\x1B[29m"),
151
- black: init("\x1B[30m", "\x1B[39m"),
152
- red: init("\x1B[31m", "\x1B[39m"),
153
- green: init("\x1B[32m", "\x1B[39m"),
154
- yellow: init("\x1B[33m", "\x1B[39m"),
155
- blue: init("\x1B[34m", "\x1B[39m"),
156
- magenta: init("\x1B[35m", "\x1B[39m"),
157
- cyan: init("\x1B[36m", "\x1B[39m"),
158
- white: init("\x1B[37m", "\x1B[39m"),
159
- gray: init("\x1B[90m", "\x1B[39m"),
160
- bgBlack: init("\x1B[40m", "\x1B[49m"),
161
- bgRed: init("\x1B[41m", "\x1B[49m"),
162
- bgGreen: init("\x1B[42m", "\x1B[49m"),
163
- bgYellow: init("\x1B[43m", "\x1B[49m"),
164
- bgBlue: init("\x1B[44m", "\x1B[49m"),
165
- bgMagenta: init("\x1B[45m", "\x1B[49m"),
166
- bgCyan: init("\x1B[46m", "\x1B[49m"),
167
- bgWhite: init("\x1B[47m", "\x1B[49m")
168
- };
169
- };
170
- module.exports = createColors();
171
- module.exports.createColors = createColors;
172
- }
173
- });
174
-
175
- // ../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js
176
- var require_cjs = __commonJS({
177
- "../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js"(exports, module) {
178
- "use strict";
179
- init_esm();
180
- var isMergeableObject = function isMergeableObject2(value) {
181
- return isNonNullObject(value) && !isSpecial(value);
182
- };
183
- function isNonNullObject(value) {
184
- return !!value && typeof value === "object";
185
- }
186
- function isSpecial(value) {
187
- var stringValue = Object.prototype.toString.call(value);
188
- return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
189
- }
190
- var canUseSymbol = typeof Symbol === "function" && Symbol.for;
191
- var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
192
- function isReactElement(value) {
193
- return value.$$typeof === REACT_ELEMENT_TYPE;
194
- }
195
- function emptyTarget(val) {
196
- return Array.isArray(val) ? [] : {};
197
- }
198
- function cloneUnlessOtherwiseSpecified(value, options) {
199
- return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value;
200
- }
201
- function defaultArrayMerge(target, source, options) {
202
- return target.concat(source).map(function(element) {
203
- return cloneUnlessOtherwiseSpecified(element, options);
204
- });
205
- }
206
- function getMergeFunction(key, options) {
207
- if (!options.customMerge) {
208
- return deepmerge2;
209
- }
210
- var customMerge = options.customMerge(key);
211
- return typeof customMerge === "function" ? customMerge : deepmerge2;
212
- }
213
- function getEnumerableOwnPropertySymbols(target) {
214
- return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
215
- return Object.propertyIsEnumerable.call(target, symbol);
216
- }) : [];
217
- }
218
- function getKeys(target) {
219
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
220
- }
221
- function propertyIsOnObject(object, property) {
222
- try {
223
- return property in object;
224
- } catch (_3) {
225
- return false;
226
- }
227
- }
228
- function propertyIsUnsafe(target, key) {
229
- return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
230
- }
231
- function mergeObject(target, source, options) {
232
- var destination = {};
233
- if (options.isMergeableObject(target)) {
234
- getKeys(target).forEach(function(key) {
235
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
236
- });
237
- }
238
- getKeys(source).forEach(function(key) {
239
- if (propertyIsUnsafe(target, key)) {
240
- return;
241
- }
242
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
243
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
244
- } else {
245
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
246
- }
247
- });
248
- return destination;
249
- }
250
- function deepmerge2(target, source, options) {
251
- options = options || {};
252
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
253
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
254
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
255
- var sourceIsArray = Array.isArray(source);
256
- var targetIsArray = Array.isArray(target);
257
- var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
258
- if (!sourceAndTargetTypesMatch) {
259
- return cloneUnlessOtherwiseSpecified(source, options);
260
- } else if (sourceIsArray) {
261
- return options.arrayMerge(target, source, options);
262
- } else {
263
- return mergeObject(target, source, options);
264
- }
265
- }
266
- deepmerge2.all = function deepmergeAll(array, options) {
267
- if (!Array.isArray(array)) {
268
- throw new Error("first argument should be an array");
269
- }
270
- return array.reduce(function(prev, next) {
271
- return deepmerge2(prev, next, options);
272
- }, {});
273
- };
274
- var deepmerge_1 = deepmerge2;
275
- module.exports = deepmerge_1;
276
- }
277
- });
278
-
279
- // ../../node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js
280
- var require_minimist = __commonJS({
281
- "../../node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js"(exports, module) {
282
- "use strict";
283
- init_esm();
284
- function hasKey(obj, keys) {
285
- var o2 = obj;
286
- keys.slice(0, -1).forEach(function(key2) {
287
- o2 = o2[key2] || {};
288
- });
289
- var key = keys[keys.length - 1];
290
- return key in o2;
291
- }
292
- function isNumber(x3) {
293
- if (typeof x3 === "number") {
294
- return true;
295
- }
296
- if (/^0x[0-9a-f]+$/i.test(x3)) {
297
- return true;
298
- }
299
- return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x3);
300
- }
301
- function isConstructorOrProto(obj, key) {
302
- return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
303
- }
304
- module.exports = function(args, opts) {
305
- if (!opts) {
306
- opts = {};
307
- }
308
- var flags = {
309
- bools: {},
310
- strings: {},
311
- unknownFn: null
312
- };
313
- if (typeof opts.unknown === "function") {
314
- flags.unknownFn = opts.unknown;
315
- }
316
- if (typeof opts.boolean === "boolean" && opts.boolean) {
317
- flags.allBools = true;
318
- } else {
319
- [].concat(opts.boolean).filter(Boolean).forEach(function(key2) {
320
- flags.bools[key2] = true;
321
- });
322
- }
323
- var aliases = {};
324
- function aliasIsBoolean(key2) {
325
- return aliases[key2].some(function(x3) {
326
- return flags.bools[x3];
327
- });
328
- }
329
- Object.keys(opts.alias || {}).forEach(function(key2) {
330
- aliases[key2] = [].concat(opts.alias[key2]);
331
- aliases[key2].forEach(function(x3) {
332
- aliases[x3] = [key2].concat(aliases[key2].filter(function(y3) {
333
- return x3 !== y3;
334
- }));
335
- });
336
- });
337
- [].concat(opts.string).filter(Boolean).forEach(function(key2) {
338
- flags.strings[key2] = true;
339
- if (aliases[key2]) {
340
- [].concat(aliases[key2]).forEach(function(k2) {
341
- flags.strings[k2] = true;
342
- });
343
- }
344
- });
345
- var defaults = opts.default || {};
346
- var argv = { _: [] };
347
- function argDefined(key2, arg2) {
348
- return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases[key2];
349
- }
350
- function setKey(obj, keys, value2) {
351
- var o2 = obj;
352
- for (var i2 = 0; i2 < keys.length - 1; i2++) {
353
- var key2 = keys[i2];
354
- if (isConstructorOrProto(o2, key2)) {
355
- return;
356
- }
357
- if (o2[key2] === void 0) {
358
- o2[key2] = {};
359
- }
360
- if (o2[key2] === Object.prototype || o2[key2] === Number.prototype || o2[key2] === String.prototype) {
361
- o2[key2] = {};
362
- }
363
- if (o2[key2] === Array.prototype) {
364
- o2[key2] = [];
365
- }
366
- o2 = o2[key2];
367
- }
368
- var lastKey = keys[keys.length - 1];
369
- if (isConstructorOrProto(o2, lastKey)) {
370
- return;
371
- }
372
- if (o2 === Object.prototype || o2 === Number.prototype || o2 === String.prototype) {
373
- o2 = {};
374
- }
375
- if (o2 === Array.prototype) {
376
- o2 = [];
377
- }
378
- if (o2[lastKey] === void 0 || flags.bools[lastKey] || typeof o2[lastKey] === "boolean") {
379
- o2[lastKey] = value2;
380
- } else if (Array.isArray(o2[lastKey])) {
381
- o2[lastKey].push(value2);
382
- } else {
383
- o2[lastKey] = [o2[lastKey], value2];
384
- }
385
- }
386
- function setArg(key2, val, arg2) {
387
- if (arg2 && flags.unknownFn && !argDefined(key2, arg2)) {
388
- if (flags.unknownFn(arg2) === false) {
389
- return;
390
- }
391
- }
392
- var value2 = !flags.strings[key2] && isNumber(val) ? Number(val) : val;
393
- setKey(argv, key2.split("."), value2);
394
- (aliases[key2] || []).forEach(function(x3) {
395
- setKey(argv, x3.split("."), value2);
396
- });
397
- }
398
- Object.keys(flags.bools).forEach(function(key2) {
399
- setArg(key2, defaults[key2] === void 0 ? false : defaults[key2]);
400
- });
401
- var notFlags = [];
402
- if (args.indexOf("--") !== -1) {
403
- notFlags = args.slice(args.indexOf("--") + 1);
404
- args = args.slice(0, args.indexOf("--"));
405
- }
406
- for (var i = 0; i < args.length; i++) {
407
- var arg = args[i];
408
- var key;
409
- var next;
410
- if (/^--.+=/.test(arg)) {
411
- var m2 = arg.match(/^--([^=]+)=([\s\S]*)$/);
412
- key = m2[1];
413
- var value = m2[2];
414
- if (flags.bools[key]) {
415
- value = value !== "false";
416
- }
417
- setArg(key, value, arg);
418
- } else if (/^--no-.+/.test(arg)) {
419
- key = arg.match(/^--no-(.+)/)[1];
420
- setArg(key, false, arg);
421
- } else if (/^--.+/.test(arg)) {
422
- key = arg.match(/^--(.+)/)[1];
423
- next = args[i + 1];
424
- if (next !== void 0 && !/^(-|--)[^-]/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) {
425
- setArg(key, next, arg);
426
- i += 1;
427
- } else if (/^(true|false)$/.test(next)) {
428
- setArg(key, next === "true", arg);
429
- i += 1;
430
- } else {
431
- setArg(key, flags.strings[key] ? "" : true, arg);
432
- }
433
- } else if (/^-[^-]+/.test(arg)) {
434
- var letters = arg.slice(1, -1).split("");
435
- var broken = false;
436
- for (var j2 = 0; j2 < letters.length; j2++) {
437
- next = arg.slice(j2 + 2);
438
- if (next === "-") {
439
- setArg(letters[j2], next, arg);
440
- continue;
441
- }
442
- if (/[A-Za-z]/.test(letters[j2]) && next[0] === "=") {
443
- setArg(letters[j2], next.slice(1), arg);
444
- broken = true;
445
- break;
446
- }
447
- if (/[A-Za-z]/.test(letters[j2]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
448
- setArg(letters[j2], next, arg);
449
- broken = true;
450
- break;
451
- }
452
- if (letters[j2 + 1] && letters[j2 + 1].match(/\W/)) {
453
- setArg(letters[j2], arg.slice(j2 + 2), arg);
454
- broken = true;
455
- break;
456
- } else {
457
- setArg(letters[j2], flags.strings[letters[j2]] ? "" : true, arg);
458
- }
459
- }
460
- key = arg.slice(-1)[0];
461
- if (!broken && key !== "-") {
462
- if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) {
463
- setArg(key, args[i + 1], arg);
464
- i += 1;
465
- } else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) {
466
- setArg(key, args[i + 1] === "true", arg);
467
- i += 1;
468
- } else {
469
- setArg(key, flags.strings[key] ? "" : true, arg);
1
+ import { fileURLToPath as __webpack_fileURLToPath__ } from "url";
2
+ import { dirname as __webpack_dirname__ } from "path";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_create_rstack__ from "create-rstack";
5
+ var external_node_path_namespaceObject = __WEBPACK_EXTERNAL_MODULE_node_path__;
6
+ var external_create_rstack_namespaceObject = __WEBPACK_EXTERNAL_MODULE_create_rstack__;
7
+ var src_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
8
+ //#!/usr/bin/env node
9
+ const frameworkAlias = {
10
+ vue: 'vue3',
11
+ 'solid-js': 'solid'
12
+ };
13
+ async function getTemplateName({ template }) {
14
+ if ('string' == typeof template) {
15
+ const pair = template.split('-');
16
+ const language = pair[1] ?? 'js';
17
+ const framework = pair[0];
18
+ return `${frameworkAlias[framework] ?? framework}-${language}`;
19
+ }
20
+ const framework = (0, external_create_rstack_namespaceObject.checkCancel)(await (0, external_create_rstack_namespaceObject.select)({
21
+ message: 'Select framework',
22
+ options: [
23
+ {
24
+ value: 'vanilla',
25
+ label: 'Vanilla'
26
+ },
27
+ {
28
+ value: 'react',
29
+ label: 'React'
30
+ },
31
+ {
32
+ value: 'vue3',
33
+ label: 'Vue 3'
34
+ },
35
+ {
36
+ value: 'vue2',
37
+ label: 'Vue 2'
38
+ },
39
+ {
40
+ value: 'lit',
41
+ label: 'Lit'
42
+ },
43
+ {
44
+ value: 'preact',
45
+ label: 'Preact'
46
+ },
47
+ {
48
+ value: 'svelte',
49
+ label: 'Svelte'
50
+ },
51
+ {
52
+ value: 'solid',
53
+ label: 'Solid'
470
54
  }
471
- }
472
- } else {
473
- if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
474
- argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));
475
- }
476
- if (opts.stopEarly) {
477
- argv._.push.apply(argv._, args.slice(i + 1));
478
- break;
479
- }
480
- }
481
- }
482
- Object.keys(defaults).forEach(function(k2) {
483
- if (!hasKey(argv, k2.split("."))) {
484
- setKey(argv, k2.split("."), defaults[k2]);
485
- (aliases[k2] || []).forEach(function(x3) {
486
- setKey(argv, x3.split("."), defaults[k2]);
487
- });
488
- }
489
- });
490
- if (opts["--"]) {
491
- argv["--"] = notFlags.slice();
492
- } else {
493
- notFlags.forEach(function(k2) {
494
- argv._.push(k2);
495
- });
496
- }
497
- return argv;
498
- };
499
- }
500
- });
501
-
502
- // src/index.ts
503
- init_esm();
504
- import fs from "fs";
505
- import path2 from "path";
506
-
507
- // ../../node_modules/.pnpm/@clack+prompts@0.7.0/node_modules/@clack/prompts/dist/index.mjs
508
- init_esm();
509
-
510
- // ../../node_modules/.pnpm/@clack+core@0.3.4/node_modules/@clack/core/dist/index.mjs
511
- init_esm();
512
- var import_sisteransi = __toESM(require_src(), 1);
513
- var import_picocolors = __toESM(require_picocolors(), 1);
514
- import { stdin as $, stdout as k } from "process";
515
- import * as f from "readline";
516
- import _ from "readline";
517
- import { WriteStream as U } from "tty";
518
- function q({ onlyFirst: t = false } = {}) {
519
- const u = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
520
- return new RegExp(u, t ? void 0 : "g");
521
- }
522
- function S(t) {
523
- if (typeof t != "string")
524
- throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);
525
- return t.replace(q(), "");
526
- }
527
- function j(t) {
528
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
529
- }
530
- var M = { exports: {} };
531
- (function(t) {
532
- var u = {};
533
- t.exports = u, u.eastAsianWidth = function(e2) {
534
- var s = e2.charCodeAt(0), C2 = e2.length == 2 ? e2.charCodeAt(1) : 0, D = s;
535
- return 55296 <= s && s <= 56319 && 56320 <= C2 && C2 <= 57343 && (s &= 1023, C2 &= 1023, D = s << 10 | C2, 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";
536
- }, u.characterLength = function(e2) {
537
- var s = this.eastAsianWidth(e2);
538
- return s == "F" || s == "W" || s == "A" ? 2 : 1;
539
- };
540
- function F(e2) {
541
- return e2.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
542
- }
543
- u.length = function(e2) {
544
- for (var s = F(e2), C2 = 0, D = 0; D < s.length; D++)
545
- C2 = C2 + this.characterLength(s[D]);
546
- return C2;
547
- }, u.slice = function(e2, s, C2) {
548
- textLen = u.length(e2), s = s || 0, C2 = C2 || 1, s < 0 && (s = textLen + s), C2 < 0 && (C2 = textLen + C2);
549
- for (var D = "", i = 0, n = F(e2), E2 = 0; E2 < n.length; E2++) {
550
- var h2 = n[E2], o2 = u.length(h2);
551
- if (i >= s - (o2 == 2 ? 1 : 0))
552
- if (i + o2 <= C2)
553
- D += h2;
554
- else
555
- break;
556
- i += o2;
557
- }
558
- return D;
559
- };
560
- })(M);
561
- var J = M.exports;
562
- var Q = j(J);
563
- var X = function() {
564
- 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;
565
- };
566
- var DD = j(X);
567
- function A(t, u = {}) {
568
- if (typeof t != "string" || t.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, t = S(t), t.length === 0))
569
- return 0;
570
- t = t.replace(DD(), " ");
571
- const F = u.ambiguousIsNarrow ? 1 : 2;
572
- let e2 = 0;
573
- for (const s of t) {
574
- const C2 = s.codePointAt(0);
575
- if (C2 <= 31 || C2 >= 127 && C2 <= 159 || C2 >= 768 && C2 <= 879)
576
- continue;
577
- switch (Q.eastAsianWidth(s)) {
578
- case "F":
579
- case "W":
580
- e2 += 2;
581
- break;
582
- case "A":
583
- e2 += F;
584
- break;
585
- default:
586
- e2 += 1;
587
- }
588
- }
589
- return e2;
590
- }
591
- var m = 10;
592
- var T = (t = 0) => (u) => `\x1B[${u + t}m`;
593
- var P = (t = 0) => (u) => `\x1B[${38 + t};5;${u}m`;
594
- var W = (t = 0) => (u, F, e2) => `\x1B[${38 + t};2;${u};${F};${e2}m`;
595
- var 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] } };
596
- Object.keys(r.modifier);
597
- var uD = Object.keys(r.color);
598
- var FD = Object.keys(r.bgColor);
599
- [...uD, ...FD];
600
- function tD() {
601
- const t = /* @__PURE__ */ new Map();
602
- for (const [u, F] of Object.entries(r)) {
603
- for (const [e2, s] of Object.entries(F))
604
- r[e2] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, F[e2] = r[e2], t.set(s[0], s[1]);
605
- Object.defineProperty(r, u, { value: F, enumerable: false });
606
- }
607
- return Object.defineProperty(r, "codes", { value: t, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = T(), r.color.ansi256 = P(), r.color.ansi16m = W(), r.bgColor.ansi = T(m), r.bgColor.ansi256 = P(m), r.bgColor.ansi16m = W(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) => {
608
- const F = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
609
- if (!F)
610
- return [0, 0, 0];
611
- let [e2] = F;
612
- e2.length === 3 && (e2 = [...e2].map((C2) => C2 + C2).join(""));
613
- const s = Number.parseInt(e2, 16);
614
- return [s >> 16 & 255, s >> 8 & 255, s & 255];
615
- }, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
616
- if (u < 8)
617
- return 30 + u;
618
- if (u < 16)
619
- return 90 + (u - 8);
620
- let F, e2, s;
621
- if (u >= 232)
622
- F = ((u - 232) * 10 + 8) / 255, e2 = F, s = F;
623
- else {
624
- u -= 16;
625
- const i = u % 36;
626
- F = Math.floor(u / 36) / 5, e2 = Math.floor(i / 6) / 5, s = i % 6 / 5;
627
- }
628
- const C2 = Math.max(F, e2, s) * 2;
629
- if (C2 === 0)
630
- return 30;
631
- let D = 30 + (Math.round(s) << 2 | Math.round(e2) << 1 | Math.round(F));
632
- return C2 === 2 && (D += 60), D;
633
- }, 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;
634
- }
635
- var eD = tD();
636
- var g = /* @__PURE__ */ new Set(["\x1B", "›"]);
637
- var sD = 39;
638
- var b = "\x07";
639
- var O = "[";
640
- var CD = "]";
641
- var I = "m";
642
- var w = `${CD}8;;`;
643
- var N = (t) => `${g.values().next().value}${O}${t}${I}`;
644
- var L = (t) => `${g.values().next().value}${w}${t}${b}`;
645
- var iD = (t) => t.split(" ").map((u) => A(u));
646
- var y = (t, u, F) => {
647
- const e2 = [...u];
648
- let s = false, C2 = false, D = A(S(t[t.length - 1]));
649
- for (const [i, n] of e2.entries()) {
650
- const E2 = A(n);
651
- if (D + E2 <= F ? t[t.length - 1] += n : (t.push(n), D = 0), g.has(n) && (s = true, C2 = e2.slice(i + 1).join("").startsWith(w)), s) {
652
- C2 ? n === b && (s = false, C2 = false) : n === I && (s = false);
653
- continue;
654
- }
655
- D += E2, D === F && i < e2.length - 1 && (t.push(""), D = 0);
656
- }
657
- !D && t[t.length - 1].length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
658
- };
659
- var rD = (t) => {
660
- const u = t.split(" ");
661
- let F = u.length;
662
- for (; F > 0 && !(A(u[F - 1]) > 0); )
663
- F--;
664
- return F === u.length ? t : u.slice(0, F).join(" ") + u.slice(F).join("");
665
- };
666
- var ED = (t, u, F = {}) => {
667
- if (F.trim !== false && t.trim() === "")
668
- return "";
669
- let e2 = "", s, C2;
670
- const D = iD(t);
671
- let i = [""];
672
- for (const [E2, h2] of t.split(" ").entries()) {
673
- F.trim !== false && (i[i.length - 1] = i[i.length - 1].trimStart());
674
- let o2 = A(i[i.length - 1]);
675
- if (E2 !== 0 && (o2 >= u && (F.wordWrap === false || F.trim === false) && (i.push(""), o2 = 0), (o2 > 0 || F.trim === false) && (i[i.length - 1] += " ", o2++)), F.hard && D[E2] > u) {
676
- const B2 = u - o2, p = 1 + Math.floor((D[E2] - B2 - 1) / u);
677
- Math.floor((D[E2] - 1) / u) < p && i.push(""), y(i, h2, u);
678
- continue;
679
- }
680
- if (o2 + D[E2] > u && o2 > 0 && D[E2] > 0) {
681
- if (F.wordWrap === false && o2 < u) {
682
- y(i, h2, u);
683
- continue;
684
- }
685
- i.push("");
686
- }
687
- if (o2 + D[E2] > u && F.wordWrap === false) {
688
- y(i, h2, u);
689
- continue;
690
- }
691
- i[i.length - 1] += h2;
692
- }
693
- F.trim !== false && (i = i.map((E2) => rD(E2)));
694
- const n = [...i.join(`
695
- `)];
696
- for (const [E2, h2] of n.entries()) {
697
- if (e2 += h2, g.has(h2)) {
698
- const { groups: B2 } = new RegExp(`(?:\\${O}(?<code>\\d+)m|\\${w}(?<uri>.*)${b})`).exec(n.slice(E2).join("")) || { groups: {} };
699
- if (B2.code !== void 0) {
700
- const p = Number.parseFloat(B2.code);
701
- s = p === sD ? void 0 : p;
702
- } else
703
- B2.uri !== void 0 && (C2 = B2.uri.length === 0 ? void 0 : B2.uri);
704
- }
705
- const o2 = eD.codes.get(Number(s));
706
- n[E2 + 1] === `
707
- ` ? (C2 && (e2 += L("")), s && o2 && (e2 += N(o2))) : h2 === `
708
- ` && (s && o2 && (e2 += N(s)), C2 && (e2 += L(C2)));
709
- }
710
- return e2;
711
- };
712
- function R(t, u, F) {
713
- return String(t).normalize().replace(/\r\n/g, `
714
- `).split(`
715
- `).map((e2) => ED(e2, u, F)).join(`
716
- `);
717
- }
718
- var oD = Object.defineProperty;
719
- var nD = (t, u, F) => u in t ? oD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
720
- var a = (t, u, F) => (nD(t, typeof u != "symbol" ? u + "" : u, F), F);
721
- function aD(t, u) {
722
- if (t === u)
723
- return;
724
- const F = t.split(`
725
- `), e2 = u.split(`
726
- `), s = [];
727
- for (let C2 = 0; C2 < Math.max(F.length, e2.length); C2++)
728
- F[C2] !== e2[C2] && s.push(C2);
729
- return s;
730
- }
731
- var V = Symbol("clack:cancel");
732
- function hD(t) {
733
- return t === V;
734
- }
735
- function v(t, u) {
736
- t.isTTY && t.setRawMode(u);
737
- }
738
- var z = /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"]]);
739
- var lD = /* @__PURE__ */ new Set(["up", "down", "left", "right", "space", "enter"]);
740
- var x = class {
741
- constructor({ render: u, input: F = $, output: e2 = k, ...s }, C2 = true) {
742
- a(this, "input"), a(this, "output"), a(this, "rl"), a(this, "opts"), a(this, "_track", false), a(this, "_render"), a(this, "_cursor", 0), a(this, "state", "initial"), a(this, "value"), a(this, "error", ""), a(this, "subscribers", /* @__PURE__ */ new Map()), a(this, "_prevFrame", ""), this.opts = s, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = u.bind(this), this._track = C2, this.input = F, this.output = e2;
743
- }
744
- prompt() {
745
- const u = new U(0);
746
- return u._write = (F, e2, s) => {
747
- this._track && (this.value = this.rl.line.replace(/\t/g, ""), this._cursor = this.rl.cursor, this.emit("value", this.value)), s();
748
- }, this.input.pipe(u), this.rl = _.createInterface({ input: this.input, output: u, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), _.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), v(this.input, true), this.output.on("resize", this.render), this.render(), new Promise((F, e2) => {
749
- this.once("submit", () => {
750
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), v(this.input, false), F(this.value);
751
- }), this.once("cancel", () => {
752
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), v(this.input, false), F(V);
753
- });
754
- });
755
- }
756
- on(u, F) {
757
- const e2 = this.subscribers.get(u) ?? [];
758
- e2.push({ cb: F }), this.subscribers.set(u, e2);
759
- }
760
- once(u, F) {
761
- const e2 = this.subscribers.get(u) ?? [];
762
- e2.push({ cb: F, once: true }), this.subscribers.set(u, e2);
763
- }
764
- emit(u, ...F) {
765
- const e2 = this.subscribers.get(u) ?? [], s = [];
766
- for (const C2 of e2)
767
- C2.cb(...F), C2.once && s.push(() => e2.splice(e2.indexOf(C2), 1));
768
- for (const C2 of s)
769
- C2();
770
- }
771
- unsubscribe() {
772
- this.subscribers.clear();
773
- }
774
- onKeypress(u, F) {
775
- if (this.state === "error" && (this.state = "active"), F?.name && !this._track && z.has(F.name) && this.emit("cursor", z.get(F.name)), F?.name && lD.has(F.name) && this.emit("cursor", F.name), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === " " && 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") {
776
- if (this.opts.validate) {
777
- const e2 = this.opts.validate(this.value);
778
- e2 && (this.error = e2, this.state = "error", this.rl.write(this.value));
779
- }
780
- this.state !== "error" && (this.state = "submit");
781
- }
782
- u === "" && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
783
- }
784
- close() {
785
- this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
786
- `), v(this.input, false), this.rl.close(), this.emit(`${this.state}`, this.value), this.unsubscribe();
787
- }
788
- restoreCursor() {
789
- const u = R(this._prevFrame, process.stdout.columns, { hard: true }).split(`
790
- `).length - 1;
791
- this.output.write(import_sisteransi.cursor.move(-999, u * -1));
792
- }
793
- render() {
794
- const u = R(this._render(this) ?? "", process.stdout.columns, { hard: true });
795
- if (u !== this._prevFrame) {
796
- if (this.state === "initial")
797
- this.output.write(import_sisteransi.cursor.hide);
798
- else {
799
- const F = aD(this._prevFrame, u);
800
- if (this.restoreCursor(), F && F?.length === 1) {
801
- const e2 = F[0];
802
- this.output.write(import_sisteransi.cursor.move(0, e2)), this.output.write(import_sisteransi.erase.lines(1));
803
- const s = u.split(`
804
- `);
805
- this.output.write(s[e2]), this._prevFrame = u, this.output.write(import_sisteransi.cursor.move(0, s.length - e2 - 1));
806
- return;
807
- } else if (F && F?.length > 1) {
808
- const e2 = F[0];
809
- this.output.write(import_sisteransi.cursor.move(0, e2)), this.output.write(import_sisteransi.erase.down());
810
- const s = u.split(`
811
- `).slice(e2);
812
- this.output.write(s.join(`
813
- `)), this._prevFrame = u;
814
- return;
815
- }
816
- this.output.write(import_sisteransi.erase.down());
817
- }
818
- this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
819
- }
820
- }
821
- };
822
- var pD = Object.defineProperty;
823
- var fD = (t, u, F) => u in t ? pD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
824
- var K = (t, u, F) => (fD(t, typeof u != "symbol" ? u + "" : u, F), F);
825
- var gD = class extends x {
826
- constructor(u) {
827
- super(u, false), K(this, "options"), K(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) => {
828
- F === "a" && this.toggleAll();
829
- }), this.on("cursor", (F) => {
830
- switch (F) {
831
- case "left":
832
- case "up":
833
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
834
- break;
835
- case "down":
836
- case "right":
837
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
838
- break;
839
- case "space":
840
- this.toggleValue();
841
- break;
842
- }
843
- });
844
- }
845
- get _value() {
846
- return this.options[this.cursor].value;
847
- }
848
- toggleAll() {
849
- const u = this.value.length === this.options.length;
850
- this.value = u ? [] : this.options.map((F) => F.value);
851
- }
852
- toggleValue() {
853
- const u = this.value.includes(this._value);
854
- this.value = u ? this.value.filter((F) => F !== this._value) : [...this.value, this._value];
855
- }
856
- };
857
- var bD = Object.defineProperty;
858
- var wD = (t, u, F) => u in t ? bD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
859
- var Z = (t, u, F) => (wD(t, typeof u != "symbol" ? u + "" : u, F), F);
860
- var yD = class extends x {
861
- constructor(u) {
862
- super(u, false), Z(this, "options"), Z(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) => {
863
- switch (F) {
864
- case "left":
865
- case "up":
866
- this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
867
- break;
868
- case "down":
869
- case "right":
870
- this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
871
- break;
872
- }
873
- this.changeValue();
874
- });
875
- }
876
- get _value() {
877
- return this.options[this.cursor];
878
- }
879
- changeValue() {
880
- this.value = this._value.value;
881
- }
882
- };
883
- var SD = Object.defineProperty;
884
- var jD = (t, u, F) => u in t ? SD(t, u, { enumerable: true, configurable: true, writable: true, value: F }) : t[u] = F;
885
- var MD = (t, u, F) => (jD(t, typeof u != "symbol" ? u + "" : u, F), F);
886
- var TD = class extends x {
887
- constructor(u) {
888
- super(u), MD(this, "valueWithCursor", ""), this.on("finalize", () => {
889
- this.value || (this.value = u.defaultValue), this.valueWithCursor = this.value;
890
- }), this.on("value", () => {
891
- if (this.cursor >= this.value.length)
892
- this.valueWithCursor = `${this.value}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
893
- else {
894
- const F = this.value.slice(0, this.cursor), e2 = this.value.slice(this.cursor);
895
- this.valueWithCursor = `${F}${import_picocolors.default.inverse(e2[0])}${e2.slice(1)}`;
896
- }
897
- });
898
- }
899
- get cursor() {
900
- return this._cursor;
901
- }
902
- };
903
- var PD = globalThis.process.platform.startsWith("win");
904
-
905
- // ../../node_modules/.pnpm/@clack+prompts@0.7.0/node_modules/@clack/prompts/dist/index.mjs
906
- var import_picocolors2 = __toESM(require_picocolors(), 1);
907
- var import_sisteransi2 = __toESM(require_src(), 1);
908
- import h from "process";
909
- function q2() {
910
- return h.platform !== "win32" ? h.env.TERM !== "linux" : Boolean(h.env.CI) || Boolean(h.env.WT_SESSION) || Boolean(h.env.TERMINUS_SUBLIME) || h.env.ConEmuTask === "{cmd::Cmder}" || h.env.TERM_PROGRAM === "Terminus-Sublime" || h.env.TERM_PROGRAM === "vscode" || h.env.TERM === "xterm-256color" || h.env.TERM === "alacritty" || h.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
911
- }
912
- var _2 = q2();
913
- var o = (r2, n) => _2 ? r2 : n;
914
- var H = o("◆", "*");
915
- var I2 = o("■", "x");
916
- var x2 = o("▲", "x");
917
- var S2 = o("◇", "o");
918
- var K2 = o("┌", "T");
919
- var a2 = o("│", "|");
920
- var d2 = o("└", "—");
921
- var b2 = o("●", ">");
922
- var E = o("○", " ");
923
- var C = o("◻", "[•]");
924
- var w2 = o("◼", "[+]");
925
- var M2 = o("◻", "[ ]");
926
- var U2 = o("▪", "•");
927
- var B = o("─", "-");
928
- var Z2 = o("╮", "+");
929
- var z2 = o("├", "+");
930
- var X2 = o("╯", "+");
931
- var J2 = o("●", "•");
932
- var Y = o("◆", "*");
933
- var Q2 = o("▲", "!");
934
- var ee = o("■", "x");
935
- var y2 = (r2) => {
936
- switch (r2) {
937
- case "initial":
938
- case "active":
939
- return import_picocolors2.default.cyan(H);
940
- case "cancel":
941
- return import_picocolors2.default.red(I2);
942
- case "error":
943
- return import_picocolors2.default.yellow(x2);
944
- case "submit":
945
- return import_picocolors2.default.green(S2);
946
- }
947
- };
948
- var te = (r2) => new TD({ validate: r2.validate, placeholder: r2.placeholder, defaultValue: r2.defaultValue, initialValue: r2.initialValue, render() {
949
- const n = `${import_picocolors2.default.gray(a2)}
950
- ${y2(this.state)} ${r2.message}
951
- `, i = r2.placeholder ? import_picocolors2.default.inverse(r2.placeholder[0]) + import_picocolors2.default.dim(r2.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), t = this.value ? this.valueWithCursor : i;
952
- switch (this.state) {
953
- case "error":
954
- return `${n.trim()}
955
- ${import_picocolors2.default.yellow(a2)} ${t}
956
- ${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
957
- `;
958
- case "submit":
959
- return `${n}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.dim(this.value || r2.placeholder)}`;
960
- case "cancel":
961
- return `${n}${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
962
- ` + import_picocolors2.default.gray(a2) : ""}`;
963
- default:
964
- return `${n}${import_picocolors2.default.cyan(a2)} ${t}
965
- ${import_picocolors2.default.cyan(d2)}
966
- `;
967
- }
968
- } }).prompt();
969
- var ie = (r2) => {
970
- const n = (t, s) => {
971
- const c2 = t.label ?? String(t.value);
972
- return s === "active" ? `${import_picocolors2.default.green(b2)} ${c2} ${t.hint ? import_picocolors2.default.dim(`(${t.hint})`) : ""}` : s === "selected" ? `${import_picocolors2.default.dim(c2)}` : s === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(c2))}` : `${import_picocolors2.default.dim(E)} ${import_picocolors2.default.dim(c2)}`;
973
- };
974
- let i = 0;
975
- return new yD({ options: r2.options, initialValue: r2.initialValue, render() {
976
- const t = `${import_picocolors2.default.gray(a2)}
977
- ${y2(this.state)} ${r2.message}
978
- `;
979
- switch (this.state) {
980
- case "submit":
981
- return `${t}${import_picocolors2.default.gray(a2)} ${n(this.options[this.cursor], "selected")}`;
982
- case "cancel":
983
- return `${t}${import_picocolors2.default.gray(a2)} ${n(this.options[this.cursor], "cancelled")}
984
- ${import_picocolors2.default.gray(a2)}`;
985
- default: {
986
- const s = r2.maxItems === void 0 ? 1 / 0 : Math.max(r2.maxItems, 5);
987
- this.cursor >= i + s - 3 ? i = Math.max(Math.min(this.cursor - s + 3, this.options.length - s), 0) : this.cursor < i + 2 && (i = Math.max(this.cursor - 2, 0));
988
- const c2 = s < this.options.length && i > 0, l2 = s < this.options.length && i + s < this.options.length;
989
- return `${t}${import_picocolors2.default.cyan(a2)} ${this.options.slice(i, i + s).map((u, m2, $2) => m2 === 0 && c2 ? import_picocolors2.default.dim("...") : m2 === $2.length - 1 && l2 ? import_picocolors2.default.dim("...") : n(u, m2 + i === this.cursor ? "active" : "inactive")).join(`
990
- ${import_picocolors2.default.cyan(a2)} `)}
991
- ${import_picocolors2.default.cyan(d2)}
992
- `;
993
- }
994
- }
995
- } }).prompt();
996
- };
997
- var ae = (r2) => {
998
- const n = (i, t) => {
999
- const s = i.label ?? String(i.value);
1000
- return t === "active" ? `${import_picocolors2.default.cyan(C)} ${s} ${i.hint ? import_picocolors2.default.dim(`(${i.hint})`) : ""}` : t === "selected" ? `${import_picocolors2.default.green(w2)} ${import_picocolors2.default.dim(s)}` : t === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}` : t === "active-selected" ? `${import_picocolors2.default.green(w2)} ${s} ${i.hint ? import_picocolors2.default.dim(`(${i.hint})`) : ""}` : t === "submitted" ? `${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.dim(M2)} ${import_picocolors2.default.dim(s)}`;
1001
- };
1002
- return new gD({ options: r2.options, initialValues: r2.initialValues, required: r2.required ?? true, cursorAt: r2.cursorAt, validate(i) {
1003
- if (this.required && i.length === 0)
1004
- return `Please select at least one option.
1005
- ${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
1006
- }, render() {
1007
- let i = `${import_picocolors2.default.gray(a2)}
1008
- ${y2(this.state)} ${r2.message}
1009
- `;
1010
- switch (this.state) {
1011
- case "submit":
1012
- return `${i}${import_picocolors2.default.gray(a2)} ${this.options.filter(({ value: t }) => this.value.includes(t)).map((t) => n(t, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none")}`;
1013
- case "cancel": {
1014
- const t = this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "cancelled")).join(import_picocolors2.default.dim(", "));
1015
- return `${i}${import_picocolors2.default.gray(a2)} ${t.trim() ? `${t}
1016
- ${import_picocolors2.default.gray(a2)}` : ""}`;
1017
- }
1018
- case "error": {
1019
- const t = this.error.split(`
1020
- `).map((s, c2) => c2 === 0 ? `${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(s)}` : ` ${s}`).join(`
1021
- `);
1022
- return i + import_picocolors2.default.yellow(a2) + " " + this.options.map((s, c2) => {
1023
- const l2 = this.value.includes(s.value), u = c2 === this.cursor;
1024
- return u && l2 ? n(s, "active-selected") : l2 ? n(s, "selected") : n(s, u ? "active" : "inactive");
1025
- }).join(`
1026
- ${import_picocolors2.default.yellow(a2)} `) + `
1027
- ` + t + `
1028
- `;
1029
- }
1030
- default:
1031
- return `${i}${import_picocolors2.default.cyan(a2)} ${this.options.map((t, s) => {
1032
- const c2 = this.value.includes(t.value), l2 = s === this.cursor;
1033
- return l2 && c2 ? n(t, "active-selected") : c2 ? n(t, "selected") : n(t, l2 ? "active" : "inactive");
1034
- }).join(`
1035
- ${import_picocolors2.default.cyan(a2)} `)}
1036
- ${import_picocolors2.default.cyan(d2)}
1037
- `;
1038
- }
1039
- } }).prompt();
1040
- };
1041
- var R2 = (r2) => r2.replace(me(), "");
1042
- var le = (r2 = "", n = "") => {
1043
- const i = `
1044
- ${r2}
1045
- `.split(`
1046
- `), t = R2(n).length, s = Math.max(i.reduce((l2, u) => (u = R2(u), u.length > l2 ? u.length : l2), 0), t) + 2, c2 = i.map((l2) => `${import_picocolors2.default.gray(a2)} ${import_picocolors2.default.dim(l2)}${" ".repeat(s - R2(l2).length)}${import_picocolors2.default.gray(a2)}`).join(`
1047
- `);
1048
- process.stdout.write(`${import_picocolors2.default.gray(a2)}
1049
- ${import_picocolors2.default.green(S2)} ${import_picocolors2.default.reset(n)} ${import_picocolors2.default.gray(B.repeat(Math.max(s - t - 1, 1)) + Z2)}
1050
- ${c2}
1051
- ${import_picocolors2.default.gray(z2 + B.repeat(s + 2) + X2)}
1052
- `);
1053
- };
1054
- var ue = (r2 = "") => {
1055
- process.stdout.write(`${import_picocolors2.default.gray(d2)} ${import_picocolors2.default.red(r2)}
1056
-
1057
- `);
1058
- };
1059
- var $e = (r2 = "") => {
1060
- process.stdout.write(`${import_picocolors2.default.gray(a2)}
1061
- ${import_picocolors2.default.gray(d2)} ${r2}
1062
-
1063
- `);
1064
- };
1065
- function me() {
1066
- const r2 = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
1067
- return new RegExp(r2, "g");
1068
- }
1069
-
1070
- // src/index.ts
1071
- var import_deepmerge = __toESM(require_cjs());
1072
- var import_minimist = __toESM(require_minimist());
1073
-
1074
- // ../../node_modules/.pnpm/rslog@1.2.2/node_modules/rslog/dist/index.mjs
1075
- init_esm();
1076
- import process2 from "process";
1077
- import os from "os";
1078
- import tty from "tty";
1079
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
1080
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
1081
- const position = argv.indexOf(prefix + flag);
1082
- const terminatorPosition = argv.indexOf("--");
1083
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
1084
- }
1085
- var { env } = process2;
1086
- var flagForceColor;
1087
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
1088
- flagForceColor = 0;
1089
- } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
1090
- flagForceColor = 1;
1091
- }
1092
- function envForceColor() {
1093
- if ("FORCE_COLOR" in env) {
1094
- if (env.FORCE_COLOR === "true") {
1095
- return 1;
1096
- }
1097
- if (env.FORCE_COLOR === "false") {
1098
- return 0;
1099
- }
1100
- return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
1101
- }
1102
- }
1103
- function translateLevel(level) {
1104
- if (level === 0) {
1105
- return false;
1106
- }
1107
- return {
1108
- level,
1109
- hasBasic: true,
1110
- has256: level >= 2,
1111
- has16m: level >= 3
1112
- };
1113
- }
1114
- function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
1115
- const noFlagForceColor = envForceColor();
1116
- if (noFlagForceColor !== void 0) {
1117
- flagForceColor = noFlagForceColor;
1118
- }
1119
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
1120
- if (forceColor === 0) {
1121
- return 0;
1122
- }
1123
- if (sniffFlags) {
1124
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
1125
- return 3;
1126
- }
1127
- if (hasFlag("color=256")) {
1128
- return 2;
1129
- }
1130
- }
1131
- if ("TF_BUILD" in env && "AGENT_NAME" in env) {
1132
- return 1;
1133
- }
1134
- if (haveStream && !streamIsTTY && forceColor === void 0) {
1135
- return 0;
1136
- }
1137
- const min = forceColor || 0;
1138
- if (env.TERM === "dumb") {
1139
- return min;
1140
- }
1141
- if (process2.platform === "win32") {
1142
- const osRelease = os.release().split(".");
1143
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
1144
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
1145
- }
1146
- return 1;
1147
- }
1148
- if ("CI" in env) {
1149
- if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
1150
- return 3;
1151
- }
1152
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
1153
- return 1;
1154
- }
1155
- return min;
1156
- }
1157
- if ("TEAMCITY_VERSION" in env) {
1158
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
1159
- }
1160
- if (env.COLORTERM === "truecolor") {
1161
- return 3;
1162
- }
1163
- if (env.TERM === "xterm-kitty") {
1164
- return 3;
1165
- }
1166
- if ("TERM_PROGRAM" in env) {
1167
- const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
1168
- switch (env.TERM_PROGRAM) {
1169
- case "iTerm.app": {
1170
- return version >= 3 ? 3 : 2;
1171
- }
1172
- case "Apple_Terminal": {
1173
- return 2;
1174
- }
1175
- }
1176
- }
1177
- if (/-256(color)?$/i.test(env.TERM)) {
1178
- return 2;
1179
- }
1180
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
1181
- return 1;
1182
- }
1183
- if ("COLORTERM" in env) {
1184
- return 1;
1185
- }
1186
- return min;
1187
- }
1188
- function createSupportsColor(stream, options = {}) {
1189
- const level = _supportsColor(stream, {
1190
- streamIsTTY: stream && stream.isTTY,
1191
- ...options
1192
- });
1193
- return translateLevel(level);
1194
- }
1195
- var supportsColor = {
1196
- stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
1197
- stderr: createSupportsColor({ isTTY: tty.isatty(2) })
1198
- };
1199
- var supports_color_default = supportsColor;
1200
- var colorLevel = supports_color_default.stdout ? supports_color_default.stdout.level : 0;
1201
- var errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/;
1202
- var anonymousErrorStackRegExp = /^\s*at\s.*\(<anonymous>\)$/;
1203
- var isErrorStackMessage = (message) => errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
1204
- var formatter = (open, close, replace = open) => colorLevel >= 2 ? (input) => {
1205
- let string = "" + input;
1206
- let index = string.indexOf(close, open.length);
1207
- return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
1208
- } : String;
1209
- var replaceClose = (string, close, replace, index) => {
1210
- let start = string.substring(0, index) + replace;
1211
- let end = string.substring(index + close.length);
1212
- let nextIndex = end.indexOf(close);
1213
- return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
1214
- };
1215
- var bold = formatter("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m");
1216
- var red = formatter("\x1B[31m", "\x1B[39m");
1217
- var green = formatter("\x1B[32m", "\x1B[39m");
1218
- var yellow = formatter("\x1B[33m", "\x1B[39m");
1219
- var magenta = formatter("\x1B[35m", "\x1B[39m");
1220
- var cyan = formatter("\x1B[36m", "\x1B[39m");
1221
- var gray = formatter("\x1B[90m", "\x1B[39m");
1222
- var startColor = [189, 255, 243];
1223
- var endColor = [74, 194, 154];
1224
- var isWord = (char) => !/[\s\n]/.test(char);
1225
- var gradient = (message) => {
1226
- if (colorLevel < 3) {
1227
- return colorLevel === 2 ? bold(cyan(message)) : message;
1228
- }
1229
- let chars = [...message];
1230
- let steps = chars.filter(isWord).length;
1231
- let r2 = startColor[0];
1232
- let g2 = startColor[1];
1233
- let b3 = startColor[2];
1234
- let rStep = (endColor[0] - r2) / steps;
1235
- let gStep = (endColor[1] - g2) / steps;
1236
- let bStep = (endColor[2] - b3) / steps;
1237
- let output = "";
1238
- for (let char of chars) {
1239
- if (isWord(char)) {
1240
- r2 += rStep;
1241
- g2 += gStep;
1242
- b3 += bStep;
1243
- }
1244
- output += `\x1B[38;2;${Math.round(r2)};${Math.round(g2)};${Math.round(
1245
- b3
1246
- )}m${char}\x1B[39m`;
1247
- }
1248
- return bold(output);
1249
- };
1250
- var LOG_LEVEL = {
1251
- error: 0,
1252
- warn: 1,
1253
- info: 2,
1254
- log: 3,
1255
- verbose: 4
1256
- };
1257
- var LOG_TYPES = {
1258
- // Level error
1259
- error: {
1260
- label: "error",
1261
- level: "error",
1262
- color: red
1263
- },
1264
- // Level warn
1265
- warn: {
1266
- label: "warn",
1267
- level: "warn",
1268
- color: yellow
1269
- },
1270
- // Level info
1271
- info: {
1272
- label: "info",
1273
- level: "info",
1274
- color: cyan
1275
- },
1276
- start: {
1277
- label: "start",
1278
- level: "info",
1279
- color: cyan
1280
- },
1281
- ready: {
1282
- label: "ready",
1283
- level: "info",
1284
- color: green
1285
- },
1286
- success: {
1287
- label: "success",
1288
- level: "info",
1289
- color: green
1290
- },
1291
- // Level log
1292
- log: {
1293
- level: "log"
1294
- },
1295
- // Level debug
1296
- debug: {
1297
- label: "debug",
1298
- level: "verbose",
1299
- color: magenta
1300
- }
1301
- };
1302
- var createLogger = (options = {}) => {
1303
- let maxLevel = options.level || "log";
1304
- let log = (type, message, ...args) => {
1305
- if (LOG_LEVEL[LOG_TYPES[type].level] > LOG_LEVEL[maxLevel]) {
1306
- return;
1307
- }
1308
- if (message === void 0 || message === null) {
1309
- return console.log();
1310
- }
1311
- let logType = LOG_TYPES[type];
1312
- let label = "";
1313
- let text = "";
1314
- if ("label" in logType) {
1315
- label = (logType.label || "").padEnd(7);
1316
- label = bold(logType.color ? logType.color(label) : label);
1317
- }
1318
- if (message instanceof Error) {
1319
- if (message.stack) {
1320
- let [name, ...rest] = message.stack.split("\n");
1321
- if (name.startsWith("Error: ")) {
1322
- name = name.slice(7);
1323
- }
1324
- text = `${name}
1325
- ${gray(rest.join("\n"))}`;
1326
- } else {
1327
- text = message.message;
1328
- }
1329
- } else if (logType.level === "error" && typeof message === "string") {
1330
- let lines = message.split("\n");
1331
- text = lines.map((line) => isErrorStackMessage(line) ? gray(line) : line).join("\n");
1332
- } else {
1333
- text = `${message}`;
1334
- }
1335
- console.log(label.length ? `${label} ${text}` : text, ...args);
1336
- };
1337
- let logger2 = {
1338
- greet: (message) => log("log", gradient(message))
1339
- };
1340
- Object.keys(LOG_TYPES).forEach((key) => {
1341
- logger2[key] = (...args) => log(key, ...args);
1342
- });
1343
- Object.defineProperty(logger2, "level", {
1344
- get: () => maxLevel,
1345
- set(val) {
1346
- maxLevel = val;
1347
- }
1348
- });
1349
- logger2.override = (customLogger) => {
1350
- Object.assign(logger2, customLogger);
1351
- };
1352
- return logger2;
1353
- };
1354
- var logger = createLogger();
1355
-
1356
- // src/index.ts
1357
- function cancelAndExit() {
1358
- ue("Operation cancelled.");
1359
- process.exit(0);
1360
- }
1361
- function checkCancel(value) {
1362
- if (hD(value)) {
1363
- cancelAndExit();
1364
- }
1365
- return value;
1366
- }
1367
- function formatProjectName(input) {
1368
- const formatted = input.trim().replace(/\/+$/g, "");
1369
- return {
1370
- packageName: formatted.startsWith("@") ? formatted : path2.basename(formatted),
1371
- targetDir: formatted
1372
- };
1373
- }
1374
- function pkgFromUserAgent(userAgent) {
1375
- if (!userAgent)
1376
- return void 0;
1377
- const pkgSpec = userAgent.split(" ")[0];
1378
- const pkgSpecArr = pkgSpec.split("/");
1379
- return {
1380
- name: pkgSpecArr[0],
1381
- version: pkgSpecArr[1]
1382
- };
1383
- }
1384
- function isEmptyDir(path3) {
1385
- const files = fs.readdirSync(path3);
1386
- return files.length === 0 || files.length === 1 && files[0] === ".git";
1387
- }
1388
- function logHelpMessage() {
1389
- logger.log(`
1390
- Usage: create-rsbuild [options]
1391
-
1392
- Options:
1393
-
1394
- -h, --help display help for command
1395
- -d, --dir create project in specified directory
1396
- -t, --template specify the template to use
1397
- --tools select additional tools (biome, eslint, prettier)
1398
- --override override files in target directory
1399
-
1400
- Templates:
1401
-
1402
- react react-ts
1403
- vue3 vue3-ts
1404
- vue2 vue2-ts
1405
- lit lit-ts
1406
- preact preact-ts
1407
- svelte svelte-ts
1408
- solid solid-ts
1409
- vanilla vanilla-ts
1410
- `);
1411
- }
1412
- var frameworkAlias = {
1413
- vue: "vue3",
1414
- "solid-js": "solid"
1415
- };
1416
- async function getTemplate({ template }) {
1417
- if (typeof template === "string") {
1418
- const pair = template.split("-");
1419
- const language2 = pair[1] ?? "js";
1420
- const framework2 = pair[0];
1421
- return {
1422
- framework: frameworkAlias[framework2] ?? framework2,
1423
- language: language2
1424
- };
1425
- }
1426
- const framework = checkCancel(
1427
- await ie({
1428
- message: "Select framework",
1429
- options: [
1430
- { value: "react", label: "React" },
1431
- { value: "vue3", label: "Vue 3" },
1432
- { value: "vue2", label: "Vue 2" },
1433
- { value: "lit", label: "Lit" },
1434
- { value: "preact", label: "Preact" },
1435
- { value: "svelte", label: "Svelte" },
1436
- { value: "solid", label: "Solid" },
1437
- { value: "vanilla", label: "Vanilla" }
1438
- ]
1439
- })
1440
- );
1441
- const language = checkCancel(
1442
- await ie({
1443
- message: "Select language",
1444
- options: [
1445
- { value: "ts", label: "TypeScript" },
1446
- { value: "js", label: "JavaScript" }
1447
- ]
1448
- })
1449
- );
1450
- return {
1451
- framework,
1452
- language
1453
- };
1454
- }
1455
- async function getTools({ tools, dir, template }) {
1456
- if (tools) {
1457
- return Array.isArray(tools) ? tools : [tools];
1458
- }
1459
- if (dir && template) {
1460
- return [];
1461
- }
1462
- return checkCancel(
1463
- await ae({
1464
- message: "Select additional tools (Use <space> to select, <enter> to continue)",
1465
- options: [
1466
- { value: "biome", label: "Add Biome for code linting and formatting" },
1467
- { value: "eslint", label: "Add ESLint for code linting" },
1468
- { value: "prettier", label: "Add Prettier for code formatting" }
1469
- ],
1470
- required: false
1471
- })
1472
- );
1473
- }
1474
- async function main() {
1475
- const argv = (0, import_minimist.default)(process.argv.slice(2), {
1476
- alias: { h: "help", d: "dir", t: "template" }
1477
- });
1478
- console.log("");
1479
- logger.greet("◆ Create Rsbuild Project");
1480
- if (argv.help) {
1481
- logHelpMessage();
1482
- return;
1483
- }
1484
- const cwd = process.cwd();
1485
- const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent);
1486
- const pkgManager = pkgInfo ? pkgInfo.name : "npm";
1487
- const packageRoot = path2.resolve(__dirname, "..");
1488
- const packageJsonPath = path2.join(packageRoot, "package.json");
1489
- const { version } = __require(packageJsonPath);
1490
- const projectName = argv.dir ?? checkCancel(
1491
- await te({
1492
- message: "Project name or path",
1493
- placeholder: "rsbuild-project",
1494
- defaultValue: "rsbuild-project",
1495
- validate(value) {
1496
- if (value.length === 0) {
1497
- return "Project name is required";
1498
- }
1499
- }
1500
- })
1501
- );
1502
- const { targetDir, packageName } = formatProjectName(projectName);
1503
- const distFolder = path2.isAbsolute(targetDir) ? targetDir : path2.join(cwd, targetDir);
1504
- if (!argv.override && fs.existsSync(distFolder) && !isEmptyDir(distFolder)) {
1505
- const option = checkCancel(
1506
- await ie({
1507
- message: `"${targetDir}" is not empty, please choose:`,
55
+ ]
56
+ }));
57
+ const language = (0, external_create_rstack_namespaceObject.checkCancel)(await (0, external_create_rstack_namespaceObject.select)({
58
+ message: 'Select language',
1508
59
  options: [
1509
- { value: "yes", label: "Continue and override files" },
1510
- { value: "no", label: "Cancel operation" }
60
+ {
61
+ value: 'ts',
62
+ label: 'TypeScript'
63
+ },
64
+ {
65
+ value: 'js',
66
+ label: 'JavaScript'
67
+ }
1511
68
  ]
1512
- })
1513
- );
1514
- if (option === "no") {
1515
- cancelAndExit();
1516
- }
1517
- }
1518
- const { framework, language } = await getTemplate(argv);
1519
- const tools = await getTools(argv);
1520
- const srcFolder = path2.join(packageRoot, `template-${framework}-${language}`);
1521
- const commonFolder = path2.join(packageRoot, "template-common");
1522
- if (!fs.existsSync(srcFolder)) {
1523
- throw new Error(
1524
- `Invalid input: template "${framework}-${language}" not found. `
1525
- );
1526
- }
1527
- copyFolder({
1528
- from: commonFolder,
1529
- to: distFolder,
1530
- version
1531
- });
1532
- copyFolder({
1533
- from: srcFolder,
1534
- to: distFolder,
1535
- version,
1536
- packageName
1537
- });
1538
- for (const tool of tools) {
1539
- const toolFolder = path2.join(packageRoot, `template-${tool}`);
1540
- if (tool === "eslint") {
1541
- let subFolder = path2.join(toolFolder, `${framework}-${language}`);
1542
- if (!fs.existsSync(subFolder)) {
1543
- subFolder = path2.join(toolFolder, `common-${language}`);
1544
- }
1545
- copyFolder({
1546
- from: subFolder,
1547
- to: distFolder,
1548
- version,
1549
- isMergePackageJson: true
1550
- });
1551
- } else {
1552
- copyFolder({
1553
- from: toolFolder,
1554
- to: distFolder,
1555
- version,
1556
- isMergePackageJson: true
1557
- });
1558
- }
1559
- }
1560
- const nextSteps = [
1561
- `cd ${targetDir}`,
1562
- `${pkgManager} i`,
1563
- `${pkgManager} run dev`
1564
- ];
1565
- le(nextSteps.join("\n"), "Next steps");
1566
- $e("Done.");
1567
- }
1568
- function sortObjectKeys(obj) {
1569
- const sortedKeys = Object.keys(obj).sort();
1570
- const sortedObj = {};
1571
- for (const key of sortedKeys) {
1572
- sortedObj[key] = obj[key];
1573
- }
1574
- return sortedObj;
1575
- }
1576
- function mergePackageJson(targetPackage, extraPackage) {
1577
- if (!fs.existsSync(targetPackage)) {
1578
- return;
1579
- }
1580
- const targetJson = JSON.parse(fs.readFileSync(targetPackage, "utf-8"));
1581
- const extraJson = JSON.parse(fs.readFileSync(extraPackage, "utf-8"));
1582
- const mergedJson = (0, import_deepmerge.default)(targetJson, extraJson);
1583
- mergedJson.name = targetJson.name || extraJson.name;
1584
- for (const key of ["scripts", "dependencies", "devDependencies"]) {
1585
- if (!(key in mergedJson)) {
1586
- continue;
1587
- }
1588
- mergedJson[key] = sortObjectKeys(
1589
- mergedJson[key]
1590
- );
1591
- }
1592
- fs.writeFileSync(targetPackage, `${JSON.stringify(mergedJson, null, 2)}
1593
- `);
1594
- }
1595
- function copyFolder({
1596
- from,
1597
- to,
1598
- version,
1599
- packageName,
1600
- isMergePackageJson
1601
- }) {
1602
- const renameFiles = {
1603
- gitignore: ".gitignore"
1604
- };
1605
- const skipFiles = ["node_modules", "dist"];
1606
- fs.mkdirSync(to, { recursive: true });
1607
- for (const file of fs.readdirSync(from)) {
1608
- if (skipFiles.includes(file)) {
1609
- continue;
1610
- }
1611
- const srcFile = path2.resolve(from, file);
1612
- const distFile = renameFiles[file] ? path2.resolve(to, renameFiles[file]) : path2.resolve(to, file);
1613
- const stat = fs.statSync(srcFile);
1614
- if (stat.isDirectory()) {
1615
- copyFolder({
1616
- from: srcFile,
1617
- to: distFile,
1618
- version
1619
- });
1620
- } else if (file === "package.json") {
1621
- const targetPackage = path2.resolve(to, "package.json");
1622
- if (isMergePackageJson && fs.existsSync(targetPackage)) {
1623
- mergePackageJson(targetPackage, srcFile);
1624
- } else {
1625
- fs.copyFileSync(srcFile, distFile);
1626
- updatePackageJson(distFile, version, packageName);
1627
- }
1628
- } else {
1629
- fs.copyFileSync(srcFile, distFile);
1630
- }
1631
- }
1632
- }
1633
- var isStableVersion = (version) => {
1634
- return ["alpha", "beta", "rc", "canary", "nightly"].every(
1635
- (tag) => !version.includes(tag)
1636
- );
1637
- };
1638
- var updatePackageJson = (pkgJsonPath, version, name) => {
1639
- let content = fs.readFileSync(pkgJsonPath, "utf-8");
1640
- const targetVersion = isStableVersion(version) ? `^${version}` : version;
1641
- content = content.replace(/workspace:\*/g, targetVersion);
1642
- const pkg = JSON.parse(content);
1643
- if (name && name !== ".") {
1644
- pkg.name = name;
1645
- }
1646
- fs.writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2));
1647
- };
1648
- main();
1649
- export {
1650
- main
1651
- };
69
+ }));
70
+ return `${framework}-${language}`;
71
+ }
72
+ function mapESLintTemplate(templateName) {
73
+ switch(templateName){
74
+ case 'react-js':
75
+ case 'react-ts':
76
+ case 'vue-js':
77
+ case 'vue-ts':
78
+ case 'svelte-js':
79
+ case 'svelte-ts':
80
+ return templateName;
81
+ }
82
+ const language = templateName.split('-')[1];
83
+ return `vanilla-${language}`;
84
+ }
85
+ (0, external_create_rstack_namespaceObject.create)({
86
+ root: external_node_path_namespaceObject["default"].resolve(src_dirname, '..'),
87
+ name: 'rsbuild',
88
+ templates: [
89
+ 'react-js',
90
+ 'react-ts',
91
+ 'vue3-js',
92
+ 'vue3-ts',
93
+ 'vue2-js',
94
+ 'vue2-ts',
95
+ 'svelte-js',
96
+ 'svelte-ts',
97
+ 'solid-js',
98
+ 'solid-ts',
99
+ 'vanilla-js',
100
+ 'vanilla-ts'
101
+ ],
102
+ getTemplateName,
103
+ mapESLintTemplate
104
+ });