create-domis 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +4968 -8
  2. package/package.json +8 -17
package/dist/index.js CHANGED
@@ -1,10 +1,4970 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
14
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+
33
+ // node_modules/kleur/index.js
34
+ var require_kleur = __commonJS({
35
+ "node_modules/kleur/index.js"(exports, module) {
36
+ "use strict";
37
+ var { FORCE_COLOR, NODE_DISABLE_COLORS, TERM } = process.env;
38
+ var $ = {
39
+ enabled: !NODE_DISABLE_COLORS && TERM !== "dumb" && FORCE_COLOR !== "0",
40
+ // modifiers
41
+ reset: init(0, 0),
42
+ bold: init(1, 22),
43
+ dim: init(2, 22),
44
+ italic: init(3, 23),
45
+ underline: init(4, 24),
46
+ inverse: init(7, 27),
47
+ hidden: init(8, 28),
48
+ strikethrough: init(9, 29),
49
+ // colors
50
+ black: init(30, 39),
51
+ red: init(31, 39),
52
+ green: init(32, 39),
53
+ yellow: init(33, 39),
54
+ blue: init(34, 39),
55
+ magenta: init(35, 39),
56
+ cyan: init(36, 39),
57
+ white: init(37, 39),
58
+ gray: init(90, 39),
59
+ grey: init(90, 39),
60
+ // background colors
61
+ bgBlack: init(40, 49),
62
+ bgRed: init(41, 49),
63
+ bgGreen: init(42, 49),
64
+ bgYellow: init(43, 49),
65
+ bgBlue: init(44, 49),
66
+ bgMagenta: init(45, 49),
67
+ bgCyan: init(46, 49),
68
+ bgWhite: init(47, 49)
69
+ };
70
+ function run(arr, str) {
71
+ let i = 0, tmp, beg = "", end = "";
72
+ for (; i < arr.length; i++) {
73
+ tmp = arr[i];
74
+ beg += tmp.open;
75
+ end += tmp.close;
76
+ if (str.includes(tmp.close)) {
77
+ str = str.replace(tmp.rgx, tmp.close + tmp.open);
78
+ }
79
+ }
80
+ return beg + str + end;
81
+ }
82
+ function chain(has, keys) {
83
+ let ctx = { has, keys };
84
+ ctx.reset = $.reset.bind(ctx);
85
+ ctx.bold = $.bold.bind(ctx);
86
+ ctx.dim = $.dim.bind(ctx);
87
+ ctx.italic = $.italic.bind(ctx);
88
+ ctx.underline = $.underline.bind(ctx);
89
+ ctx.inverse = $.inverse.bind(ctx);
90
+ ctx.hidden = $.hidden.bind(ctx);
91
+ ctx.strikethrough = $.strikethrough.bind(ctx);
92
+ ctx.black = $.black.bind(ctx);
93
+ ctx.red = $.red.bind(ctx);
94
+ ctx.green = $.green.bind(ctx);
95
+ ctx.yellow = $.yellow.bind(ctx);
96
+ ctx.blue = $.blue.bind(ctx);
97
+ ctx.magenta = $.magenta.bind(ctx);
98
+ ctx.cyan = $.cyan.bind(ctx);
99
+ ctx.white = $.white.bind(ctx);
100
+ ctx.gray = $.gray.bind(ctx);
101
+ ctx.grey = $.grey.bind(ctx);
102
+ ctx.bgBlack = $.bgBlack.bind(ctx);
103
+ ctx.bgRed = $.bgRed.bind(ctx);
104
+ ctx.bgGreen = $.bgGreen.bind(ctx);
105
+ ctx.bgYellow = $.bgYellow.bind(ctx);
106
+ ctx.bgBlue = $.bgBlue.bind(ctx);
107
+ ctx.bgMagenta = $.bgMagenta.bind(ctx);
108
+ ctx.bgCyan = $.bgCyan.bind(ctx);
109
+ ctx.bgWhite = $.bgWhite.bind(ctx);
110
+ return ctx;
111
+ }
112
+ function init(open, close) {
113
+ let blk = {
114
+ open: `\x1B[${open}m`,
115
+ close: `\x1B[${close}m`,
116
+ rgx: new RegExp(`\\x1b\\[${close}m`, "g")
117
+ };
118
+ return function(txt) {
119
+ if (this !== void 0 && this.has !== void 0) {
120
+ this.has.includes(open) || (this.has.push(open), this.keys.push(blk));
121
+ return txt === void 0 ? this : $.enabled ? run(this.keys, txt + "") : txt + "";
122
+ }
123
+ return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt + "") : txt + "";
124
+ };
125
+ }
126
+ module.exports = $;
127
+ }
128
+ });
129
+
130
+ // node_modules/prompts/dist/util/action.js
131
+ var require_action = __commonJS({
132
+ "node_modules/prompts/dist/util/action.js"(exports, module) {
133
+ "use strict";
134
+ module.exports = (key, isSelect) => {
135
+ if (key.meta && key.name !== "escape") return;
136
+ if (key.ctrl) {
137
+ if (key.name === "a") return "first";
138
+ if (key.name === "c") return "abort";
139
+ if (key.name === "d") return "abort";
140
+ if (key.name === "e") return "last";
141
+ if (key.name === "g") return "reset";
142
+ }
143
+ if (isSelect) {
144
+ if (key.name === "j") return "down";
145
+ if (key.name === "k") return "up";
146
+ }
147
+ if (key.name === "return") return "submit";
148
+ if (key.name === "enter") return "submit";
149
+ if (key.name === "backspace") return "delete";
150
+ if (key.name === "delete") return "deleteForward";
151
+ if (key.name === "abort") return "abort";
152
+ if (key.name === "escape") return "exit";
153
+ if (key.name === "tab") return "next";
154
+ if (key.name === "pagedown") return "nextPage";
155
+ if (key.name === "pageup") return "prevPage";
156
+ if (key.name === "home") return "home";
157
+ if (key.name === "end") return "end";
158
+ if (key.name === "up") return "up";
159
+ if (key.name === "down") return "down";
160
+ if (key.name === "right") return "right";
161
+ if (key.name === "left") return "left";
162
+ return false;
163
+ };
164
+ }
165
+ });
166
+
167
+ // node_modules/prompts/dist/util/strip.js
168
+ var require_strip = __commonJS({
169
+ "node_modules/prompts/dist/util/strip.js"(exports, module) {
170
+ "use strict";
171
+ module.exports = (str) => {
172
+ const pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|");
173
+ const RGX = new RegExp(pattern, "g");
174
+ return typeof str === "string" ? str.replace(RGX, "") : str;
175
+ };
176
+ }
177
+ });
178
+
179
+ // node_modules/sisteransi/src/index.js
180
+ var require_src = __commonJS({
181
+ "node_modules/sisteransi/src/index.js"(exports, module) {
182
+ "use strict";
183
+ var ESC = "\x1B";
184
+ var CSI = `${ESC}[`;
185
+ var beep = "\x07";
186
+ var cursor = {
187
+ to(x, y) {
188
+ if (!y) return `${CSI}${x + 1}G`;
189
+ return `${CSI}${y + 1};${x + 1}H`;
190
+ },
191
+ move(x, y) {
192
+ let ret = "";
193
+ if (x < 0) ret += `${CSI}${-x}D`;
194
+ else if (x > 0) ret += `${CSI}${x}C`;
195
+ if (y < 0) ret += `${CSI}${-y}A`;
196
+ else if (y > 0) ret += `${CSI}${y}B`;
197
+ return ret;
198
+ },
199
+ up: (count = 1) => `${CSI}${count}A`,
200
+ down: (count = 1) => `${CSI}${count}B`,
201
+ forward: (count = 1) => `${CSI}${count}C`,
202
+ backward: (count = 1) => `${CSI}${count}D`,
203
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
204
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
205
+ left: `${CSI}G`,
206
+ hide: `${CSI}?25l`,
207
+ show: `${CSI}?25h`,
208
+ save: `${ESC}7`,
209
+ restore: `${ESC}8`
210
+ };
211
+ var scroll = {
212
+ up: (count = 1) => `${CSI}S`.repeat(count),
213
+ down: (count = 1) => `${CSI}T`.repeat(count)
214
+ };
215
+ var erase = {
216
+ screen: `${CSI}2J`,
217
+ up: (count = 1) => `${CSI}1J`.repeat(count),
218
+ down: (count = 1) => `${CSI}J`.repeat(count),
219
+ line: `${CSI}2K`,
220
+ lineEnd: `${CSI}K`,
221
+ lineStart: `${CSI}1K`,
222
+ lines(count) {
223
+ let clear = "";
224
+ for (let i = 0; i < count; i++)
225
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
226
+ if (count)
227
+ clear += cursor.left;
228
+ return clear;
229
+ }
230
+ };
231
+ module.exports = { cursor, scroll, erase, beep };
232
+ }
233
+ });
234
+
235
+ // node_modules/prompts/dist/util/clear.js
236
+ var require_clear = __commonJS({
237
+ "node_modules/prompts/dist/util/clear.js"(exports, module) {
238
+ "use strict";
239
+ function _createForOfIteratorHelper(o, allowArrayLike) {
240
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
241
+ if (!it) {
242
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
243
+ if (it) o = it;
244
+ var i = 0;
245
+ var F = function F2() {
246
+ };
247
+ return { s: F, n: function n() {
248
+ if (i >= o.length) return { done: true };
249
+ return { done: false, value: o[i++] };
250
+ }, e: function e(_e) {
251
+ throw _e;
252
+ }, f: F };
253
+ }
254
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
255
+ }
256
+ var normalCompletion = true, didErr = false, err;
257
+ return { s: function s() {
258
+ it = it.call(o);
259
+ }, n: function n() {
260
+ var step = it.next();
261
+ normalCompletion = step.done;
262
+ return step;
263
+ }, e: function e(_e2) {
264
+ didErr = true;
265
+ err = _e2;
266
+ }, f: function f() {
267
+ try {
268
+ if (!normalCompletion && it.return != null) it.return();
269
+ } finally {
270
+ if (didErr) throw err;
271
+ }
272
+ } };
273
+ }
274
+ function _unsupportedIterableToArray(o, minLen) {
275
+ if (!o) return;
276
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
277
+ var n = Object.prototype.toString.call(o).slice(8, -1);
278
+ if (n === "Object" && o.constructor) n = o.constructor.name;
279
+ if (n === "Map" || n === "Set") return Array.from(o);
280
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
281
+ }
282
+ function _arrayLikeToArray(arr, len) {
283
+ if (len == null || len > arr.length) len = arr.length;
284
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
285
+ return arr2;
286
+ }
287
+ var strip = require_strip();
288
+ var _require = require_src();
289
+ var erase = _require.erase;
290
+ var cursor = _require.cursor;
291
+ var width = (str) => [...strip(str)].length;
292
+ module.exports = function(prompt, perLine) {
293
+ if (!perLine) return erase.line + cursor.to(0);
294
+ let rows = 0;
295
+ const lines = prompt.split(/\r?\n/);
296
+ var _iterator = _createForOfIteratorHelper(lines), _step;
297
+ try {
298
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
299
+ let line = _step.value;
300
+ rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / perLine);
301
+ }
302
+ } catch (err) {
303
+ _iterator.e(err);
304
+ } finally {
305
+ _iterator.f();
306
+ }
307
+ return erase.lines(rows);
308
+ };
309
+ }
310
+ });
311
+
312
+ // node_modules/prompts/dist/util/figures.js
313
+ var require_figures = __commonJS({
314
+ "node_modules/prompts/dist/util/figures.js"(exports, module) {
315
+ "use strict";
316
+ var main2 = {
317
+ arrowUp: "\u2191",
318
+ arrowDown: "\u2193",
319
+ arrowLeft: "\u2190",
320
+ arrowRight: "\u2192",
321
+ radioOn: "\u25C9",
322
+ radioOff: "\u25EF",
323
+ tick: "\u2714",
324
+ cross: "\u2716",
325
+ ellipsis: "\u2026",
326
+ pointerSmall: "\u203A",
327
+ line: "\u2500",
328
+ pointer: "\u276F"
329
+ };
330
+ var win = {
331
+ arrowUp: main2.arrowUp,
332
+ arrowDown: main2.arrowDown,
333
+ arrowLeft: main2.arrowLeft,
334
+ arrowRight: main2.arrowRight,
335
+ radioOn: "(*)",
336
+ radioOff: "( )",
337
+ tick: "\u221A",
338
+ cross: "\xD7",
339
+ ellipsis: "...",
340
+ pointerSmall: "\xBB",
341
+ line: "\u2500",
342
+ pointer: ">"
343
+ };
344
+ var figures = process.platform === "win32" ? win : main2;
345
+ module.exports = figures;
346
+ }
347
+ });
348
+
349
+ // node_modules/prompts/dist/util/style.js
350
+ var require_style = __commonJS({
351
+ "node_modules/prompts/dist/util/style.js"(exports, module) {
352
+ "use strict";
353
+ var c = require_kleur();
354
+ var figures = require_figures();
355
+ var styles = Object.freeze({
356
+ password: {
357
+ scale: 1,
358
+ render: (input) => "*".repeat(input.length)
359
+ },
360
+ emoji: {
361
+ scale: 2,
362
+ render: (input) => "\u{1F603}".repeat(input.length)
363
+ },
364
+ invisible: {
365
+ scale: 0,
366
+ render: (input) => ""
367
+ },
368
+ default: {
369
+ scale: 1,
370
+ render: (input) => `${input}`
371
+ }
372
+ });
373
+ var render = (type) => styles[type] || styles.default;
374
+ var symbols = Object.freeze({
375
+ aborted: c.red(figures.cross),
376
+ done: c.green(figures.tick),
377
+ exited: c.yellow(figures.cross),
378
+ default: c.cyan("?")
379
+ });
380
+ var symbol = (done, aborted, exited) => aborted ? symbols.aborted : exited ? symbols.exited : done ? symbols.done : symbols.default;
381
+ var delimiter = (completing) => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
382
+ var item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : "+" : figures.line);
383
+ module.exports = {
384
+ styles,
385
+ render,
386
+ symbols,
387
+ symbol,
388
+ delimiter,
389
+ item
390
+ };
391
+ }
392
+ });
393
+
394
+ // node_modules/prompts/dist/util/lines.js
395
+ var require_lines = __commonJS({
396
+ "node_modules/prompts/dist/util/lines.js"(exports, module) {
397
+ "use strict";
398
+ var strip = require_strip();
399
+ module.exports = function(msg, perLine) {
400
+ let lines = String(strip(msg) || "").split(/\r?\n/);
401
+ if (!perLine) return lines.length;
402
+ return lines.map((l) => Math.ceil(l.length / perLine)).reduce((a, b) => a + b);
403
+ };
404
+ }
405
+ });
406
+
407
+ // node_modules/prompts/dist/util/wrap.js
408
+ var require_wrap = __commonJS({
409
+ "node_modules/prompts/dist/util/wrap.js"(exports, module) {
410
+ "use strict";
411
+ module.exports = (msg, opts = {}) => {
412
+ const tab = Number.isSafeInteger(parseInt(opts.margin)) ? new Array(parseInt(opts.margin)).fill(" ").join("") : opts.margin || "";
413
+ const width = opts.width;
414
+ return (msg || "").split(/\r?\n/g).map((line) => line.split(/\s+/g).reduce((arr, w) => {
415
+ if (w.length + tab.length >= width || arr[arr.length - 1].length + w.length + 1 < width) arr[arr.length - 1] += ` ${w}`;
416
+ else arr.push(`${tab}${w}`);
417
+ return arr;
418
+ }, [tab]).join("\n")).join("\n");
419
+ };
420
+ }
421
+ });
422
+
423
+ // node_modules/prompts/dist/util/entriesToDisplay.js
424
+ var require_entriesToDisplay = __commonJS({
425
+ "node_modules/prompts/dist/util/entriesToDisplay.js"(exports, module) {
426
+ "use strict";
427
+ module.exports = (cursor, total, maxVisible) => {
428
+ maxVisible = maxVisible || total;
429
+ let startIndex = Math.min(total - maxVisible, cursor - Math.floor(maxVisible / 2));
430
+ if (startIndex < 0) startIndex = 0;
431
+ let endIndex = Math.min(startIndex + maxVisible, total);
432
+ return {
433
+ startIndex,
434
+ endIndex
435
+ };
436
+ };
437
+ }
438
+ });
439
+
440
+ // node_modules/prompts/dist/util/index.js
441
+ var require_util = __commonJS({
442
+ "node_modules/prompts/dist/util/index.js"(exports, module) {
443
+ "use strict";
444
+ module.exports = {
445
+ action: require_action(),
446
+ clear: require_clear(),
447
+ style: require_style(),
448
+ strip: require_strip(),
449
+ figures: require_figures(),
450
+ lines: require_lines(),
451
+ wrap: require_wrap(),
452
+ entriesToDisplay: require_entriesToDisplay()
453
+ };
454
+ }
455
+ });
456
+
457
+ // node_modules/prompts/dist/elements/prompt.js
458
+ var require_prompt = __commonJS({
459
+ "node_modules/prompts/dist/elements/prompt.js"(exports, module) {
460
+ "use strict";
461
+ var readline = __require("readline");
462
+ var _require = require_util();
463
+ var action = _require.action;
464
+ var EventEmitter = __require("events");
465
+ var _require2 = require_src();
466
+ var beep = _require2.beep;
467
+ var cursor = _require2.cursor;
468
+ var color = require_kleur();
469
+ var Prompt = class extends EventEmitter {
470
+ constructor(opts = {}) {
471
+ super();
472
+ this.firstRender = true;
473
+ this.in = opts.stdin || process.stdin;
474
+ this.out = opts.stdout || process.stdout;
475
+ this.onRender = (opts.onRender || (() => void 0)).bind(this);
476
+ const rl = readline.createInterface({
477
+ input: this.in,
478
+ escapeCodeTimeout: 50
479
+ });
480
+ readline.emitKeypressEvents(this.in, rl);
481
+ if (this.in.isTTY) this.in.setRawMode(true);
482
+ const isSelect = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1;
483
+ const keypress = (str, key) => {
484
+ let a = action(key, isSelect);
485
+ if (a === false) {
486
+ this._ && this._(str, key);
487
+ } else if (typeof this[a] === "function") {
488
+ this[a](key);
489
+ } else {
490
+ this.bell();
491
+ }
492
+ };
493
+ this.close = () => {
494
+ this.out.write(cursor.show);
495
+ this.in.removeListener("keypress", keypress);
496
+ if (this.in.isTTY) this.in.setRawMode(false);
497
+ rl.close();
498
+ this.emit(this.aborted ? "abort" : this.exited ? "exit" : "submit", this.value);
499
+ this.closed = true;
500
+ };
501
+ this.in.on("keypress", keypress);
502
+ }
503
+ fire() {
504
+ this.emit("state", {
505
+ value: this.value,
506
+ aborted: !!this.aborted,
507
+ exited: !!this.exited
508
+ });
509
+ }
510
+ bell() {
511
+ this.out.write(beep);
512
+ }
513
+ render() {
514
+ this.onRender(color);
515
+ if (this.firstRender) this.firstRender = false;
516
+ }
517
+ };
518
+ module.exports = Prompt;
519
+ }
520
+ });
521
+
522
+ // node_modules/prompts/dist/elements/text.js
523
+ var require_text = __commonJS({
524
+ "node_modules/prompts/dist/elements/text.js"(exports, module) {
525
+ "use strict";
526
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
527
+ try {
528
+ var info = gen[key](arg);
529
+ var value = info.value;
530
+ } catch (error) {
531
+ reject(error);
532
+ return;
533
+ }
534
+ if (info.done) {
535
+ resolve(value);
536
+ } else {
537
+ Promise.resolve(value).then(_next, _throw);
538
+ }
539
+ }
540
+ function _asyncToGenerator(fn) {
541
+ return function() {
542
+ var self = this, args2 = arguments;
543
+ return new Promise(function(resolve, reject) {
544
+ var gen = fn.apply(self, args2);
545
+ function _next(value) {
546
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
547
+ }
548
+ function _throw(err) {
549
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
550
+ }
551
+ _next(void 0);
552
+ });
553
+ };
554
+ }
555
+ var color = require_kleur();
556
+ var Prompt = require_prompt();
557
+ var _require = require_src();
558
+ var erase = _require.erase;
559
+ var cursor = _require.cursor;
560
+ var _require2 = require_util();
561
+ var style = _require2.style;
562
+ var clear = _require2.clear;
563
+ var lines = _require2.lines;
564
+ var figures = _require2.figures;
565
+ var TextPrompt = class extends Prompt {
566
+ constructor(opts = {}) {
567
+ super(opts);
568
+ this.transform = style.render(opts.style);
569
+ this.scale = this.transform.scale;
570
+ this.msg = opts.message;
571
+ this.initial = opts.initial || ``;
572
+ this.validator = opts.validate || (() => true);
573
+ this.value = ``;
574
+ this.errorMsg = opts.error || `Please Enter A Valid Value`;
575
+ this.cursor = Number(!!this.initial);
576
+ this.cursorOffset = 0;
577
+ this.clear = clear(``, this.out.columns);
578
+ this.render();
579
+ }
580
+ set value(v) {
581
+ if (!v && this.initial) {
582
+ this.placeholder = true;
583
+ this.rendered = color.gray(this.transform.render(this.initial));
584
+ } else {
585
+ this.placeholder = false;
586
+ this.rendered = this.transform.render(v);
587
+ }
588
+ this._value = v;
589
+ this.fire();
590
+ }
591
+ get value() {
592
+ return this._value;
593
+ }
594
+ reset() {
595
+ this.value = ``;
596
+ this.cursor = Number(!!this.initial);
597
+ this.cursorOffset = 0;
598
+ this.fire();
599
+ this.render();
600
+ }
601
+ exit() {
602
+ this.abort();
603
+ }
604
+ abort() {
605
+ this.value = this.value || this.initial;
606
+ this.done = this.aborted = true;
607
+ this.error = false;
608
+ this.red = false;
609
+ this.fire();
610
+ this.render();
611
+ this.out.write("\n");
612
+ this.close();
613
+ }
614
+ validate() {
615
+ var _this = this;
616
+ return _asyncToGenerator(function* () {
617
+ let valid = yield _this.validator(_this.value);
618
+ if (typeof valid === `string`) {
619
+ _this.errorMsg = valid;
620
+ valid = false;
621
+ }
622
+ _this.error = !valid;
623
+ })();
624
+ }
625
+ submit() {
626
+ var _this2 = this;
627
+ return _asyncToGenerator(function* () {
628
+ _this2.value = _this2.value || _this2.initial;
629
+ _this2.cursorOffset = 0;
630
+ _this2.cursor = _this2.rendered.length;
631
+ yield _this2.validate();
632
+ if (_this2.error) {
633
+ _this2.red = true;
634
+ _this2.fire();
635
+ _this2.render();
636
+ return;
637
+ }
638
+ _this2.done = true;
639
+ _this2.aborted = false;
640
+ _this2.fire();
641
+ _this2.render();
642
+ _this2.out.write("\n");
643
+ _this2.close();
644
+ })();
645
+ }
646
+ next() {
647
+ if (!this.placeholder) return this.bell();
648
+ this.value = this.initial;
649
+ this.cursor = this.rendered.length;
650
+ this.fire();
651
+ this.render();
652
+ }
653
+ moveCursor(n) {
654
+ if (this.placeholder) return;
655
+ this.cursor = this.cursor + n;
656
+ this.cursorOffset += n;
657
+ }
658
+ _(c, key) {
659
+ let s1 = this.value.slice(0, this.cursor);
660
+ let s2 = this.value.slice(this.cursor);
661
+ this.value = `${s1}${c}${s2}`;
662
+ this.red = false;
663
+ this.cursor = this.placeholder ? 0 : s1.length + 1;
664
+ this.render();
665
+ }
666
+ delete() {
667
+ if (this.isCursorAtStart()) return this.bell();
668
+ let s1 = this.value.slice(0, this.cursor - 1);
669
+ let s2 = this.value.slice(this.cursor);
670
+ this.value = `${s1}${s2}`;
671
+ this.red = false;
672
+ if (this.isCursorAtStart()) {
673
+ this.cursorOffset = 0;
674
+ } else {
675
+ this.cursorOffset++;
676
+ this.moveCursor(-1);
677
+ }
678
+ this.render();
679
+ }
680
+ deleteForward() {
681
+ if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();
682
+ let s1 = this.value.slice(0, this.cursor);
683
+ let s2 = this.value.slice(this.cursor + 1);
684
+ this.value = `${s1}${s2}`;
685
+ this.red = false;
686
+ if (this.isCursorAtEnd()) {
687
+ this.cursorOffset = 0;
688
+ } else {
689
+ this.cursorOffset++;
690
+ }
691
+ this.render();
692
+ }
693
+ first() {
694
+ this.cursor = 0;
695
+ this.render();
696
+ }
697
+ last() {
698
+ this.cursor = this.value.length;
699
+ this.render();
700
+ }
701
+ left() {
702
+ if (this.cursor <= 0 || this.placeholder) return this.bell();
703
+ this.moveCursor(-1);
704
+ this.render();
705
+ }
706
+ right() {
707
+ if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();
708
+ this.moveCursor(1);
709
+ this.render();
710
+ }
711
+ isCursorAtStart() {
712
+ return this.cursor === 0 || this.placeholder && this.cursor === 1;
713
+ }
714
+ isCursorAtEnd() {
715
+ return this.cursor === this.rendered.length || this.placeholder && this.cursor === this.rendered.length + 1;
716
+ }
717
+ render() {
718
+ if (this.closed) return;
719
+ if (!this.firstRender) {
720
+ if (this.outputError) this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns));
721
+ this.out.write(clear(this.outputText, this.out.columns));
722
+ }
723
+ super.render();
724
+ this.outputError = "";
725
+ this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.red ? color.red(this.rendered) : this.rendered].join(` `);
726
+ if (this.error) {
727
+ this.outputError += this.errorMsg.split(`
728
+ `).reduce((a, l, i) => a + `
729
+ ${i ? " " : figures.pointerSmall} ${color.red().italic(l)}`, ``);
730
+ }
731
+ this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore + cursor.move(this.cursorOffset, 0));
732
+ }
733
+ };
734
+ module.exports = TextPrompt;
735
+ }
736
+ });
737
+
738
+ // node_modules/prompts/dist/elements/select.js
739
+ var require_select = __commonJS({
740
+ "node_modules/prompts/dist/elements/select.js"(exports, module) {
741
+ "use strict";
742
+ var color = require_kleur();
743
+ var Prompt = require_prompt();
744
+ var _require = require_util();
745
+ var style = _require.style;
746
+ var clear = _require.clear;
747
+ var figures = _require.figures;
748
+ var wrap = _require.wrap;
749
+ var entriesToDisplay = _require.entriesToDisplay;
750
+ var _require2 = require_src();
751
+ var cursor = _require2.cursor;
752
+ var SelectPrompt = class extends Prompt {
753
+ constructor(opts = {}) {
754
+ super(opts);
755
+ this.msg = opts.message;
756
+ this.hint = opts.hint || "- Use arrow-keys. Return to submit.";
757
+ this.warn = opts.warn || "- This option is disabled";
758
+ this.cursor = opts.initial || 0;
759
+ this.choices = opts.choices.map((ch, idx) => {
760
+ if (typeof ch === "string") ch = {
761
+ title: ch,
762
+ value: idx
763
+ };
764
+ return {
765
+ title: ch && (ch.title || ch.value || ch),
766
+ value: ch && (ch.value === void 0 ? idx : ch.value),
767
+ description: ch && ch.description,
768
+ selected: ch && ch.selected,
769
+ disabled: ch && ch.disabled
770
+ };
771
+ });
772
+ this.optionsPerPage = opts.optionsPerPage || 10;
773
+ this.value = (this.choices[this.cursor] || {}).value;
774
+ this.clear = clear("", this.out.columns);
775
+ this.render();
776
+ }
777
+ moveCursor(n) {
778
+ this.cursor = n;
779
+ this.value = this.choices[n].value;
780
+ this.fire();
781
+ }
782
+ reset() {
783
+ this.moveCursor(0);
784
+ this.fire();
785
+ this.render();
786
+ }
787
+ exit() {
788
+ this.abort();
789
+ }
790
+ abort() {
791
+ this.done = this.aborted = true;
792
+ this.fire();
793
+ this.render();
794
+ this.out.write("\n");
795
+ this.close();
796
+ }
797
+ submit() {
798
+ if (!this.selection.disabled) {
799
+ this.done = true;
800
+ this.aborted = false;
801
+ this.fire();
802
+ this.render();
803
+ this.out.write("\n");
804
+ this.close();
805
+ } else this.bell();
806
+ }
807
+ first() {
808
+ this.moveCursor(0);
809
+ this.render();
810
+ }
811
+ last() {
812
+ this.moveCursor(this.choices.length - 1);
813
+ this.render();
814
+ }
815
+ up() {
816
+ if (this.cursor === 0) {
817
+ this.moveCursor(this.choices.length - 1);
818
+ } else {
819
+ this.moveCursor(this.cursor - 1);
820
+ }
821
+ this.render();
822
+ }
823
+ down() {
824
+ if (this.cursor === this.choices.length - 1) {
825
+ this.moveCursor(0);
826
+ } else {
827
+ this.moveCursor(this.cursor + 1);
828
+ }
829
+ this.render();
830
+ }
831
+ next() {
832
+ this.moveCursor((this.cursor + 1) % this.choices.length);
833
+ this.render();
834
+ }
835
+ _(c, key) {
836
+ if (c === " ") return this.submit();
837
+ }
838
+ get selection() {
839
+ return this.choices[this.cursor];
840
+ }
841
+ render() {
842
+ if (this.closed) return;
843
+ if (this.firstRender) this.out.write(cursor.hide);
844
+ else this.out.write(clear(this.outputText, this.out.columns));
845
+ super.render();
846
+ let _entriesToDisplay = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
847
+ this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)].join(" ");
848
+ if (!this.done) {
849
+ this.outputText += "\n";
850
+ for (let i = startIndex; i < endIndex; i++) {
851
+ let title, prefix, desc = "", v = this.choices[i];
852
+ if (i === startIndex && startIndex > 0) {
853
+ prefix = figures.arrowUp;
854
+ } else if (i === endIndex - 1 && endIndex < this.choices.length) {
855
+ prefix = figures.arrowDown;
856
+ } else {
857
+ prefix = " ";
858
+ }
859
+ if (v.disabled) {
860
+ title = this.cursor === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
861
+ prefix = (this.cursor === i ? color.bold().gray(figures.pointer) + " " : " ") + prefix;
862
+ } else {
863
+ title = this.cursor === i ? color.cyan().underline(v.title) : v.title;
864
+ prefix = (this.cursor === i ? color.cyan(figures.pointer) + " " : " ") + prefix;
865
+ if (v.description && this.cursor === i) {
866
+ desc = ` - ${v.description}`;
867
+ if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
868
+ desc = "\n" + wrap(v.description, {
869
+ margin: 3,
870
+ width: this.out.columns
871
+ });
872
+ }
873
+ }
874
+ }
875
+ this.outputText += `${prefix} ${title}${color.gray(desc)}
876
+ `;
877
+ }
878
+ }
879
+ this.out.write(this.outputText);
880
+ }
881
+ };
882
+ module.exports = SelectPrompt;
883
+ }
884
+ });
885
+
886
+ // node_modules/prompts/dist/elements/toggle.js
887
+ var require_toggle = __commonJS({
888
+ "node_modules/prompts/dist/elements/toggle.js"(exports, module) {
889
+ "use strict";
890
+ var color = require_kleur();
891
+ var Prompt = require_prompt();
892
+ var _require = require_util();
893
+ var style = _require.style;
894
+ var clear = _require.clear;
895
+ var _require2 = require_src();
896
+ var cursor = _require2.cursor;
897
+ var erase = _require2.erase;
898
+ var TogglePrompt = class extends Prompt {
899
+ constructor(opts = {}) {
900
+ super(opts);
901
+ this.msg = opts.message;
902
+ this.value = !!opts.initial;
903
+ this.active = opts.active || "on";
904
+ this.inactive = opts.inactive || "off";
905
+ this.initialValue = this.value;
906
+ this.render();
907
+ }
908
+ reset() {
909
+ this.value = this.initialValue;
910
+ this.fire();
911
+ this.render();
912
+ }
913
+ exit() {
914
+ this.abort();
915
+ }
916
+ abort() {
917
+ this.done = this.aborted = true;
918
+ this.fire();
919
+ this.render();
920
+ this.out.write("\n");
921
+ this.close();
922
+ }
923
+ submit() {
924
+ this.done = true;
925
+ this.aborted = false;
926
+ this.fire();
927
+ this.render();
928
+ this.out.write("\n");
929
+ this.close();
930
+ }
931
+ deactivate() {
932
+ if (this.value === false) return this.bell();
933
+ this.value = false;
934
+ this.render();
935
+ }
936
+ activate() {
937
+ if (this.value === true) return this.bell();
938
+ this.value = true;
939
+ this.render();
940
+ }
941
+ delete() {
942
+ this.deactivate();
943
+ }
944
+ left() {
945
+ this.deactivate();
946
+ }
947
+ right() {
948
+ this.activate();
949
+ }
950
+ down() {
951
+ this.deactivate();
952
+ }
953
+ up() {
954
+ this.activate();
955
+ }
956
+ next() {
957
+ this.value = !this.value;
958
+ this.fire();
959
+ this.render();
960
+ }
961
+ _(c, key) {
962
+ if (c === " ") {
963
+ this.value = !this.value;
964
+ } else if (c === "1") {
965
+ this.value = true;
966
+ } else if (c === "0") {
967
+ this.value = false;
968
+ } else return this.bell();
969
+ this.render();
970
+ }
971
+ render() {
972
+ if (this.closed) return;
973
+ if (this.firstRender) this.out.write(cursor.hide);
974
+ else this.out.write(clear(this.outputText, this.out.columns));
975
+ super.render();
976
+ this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.value ? this.inactive : color.cyan().underline(this.inactive), color.gray("/"), this.value ? color.cyan().underline(this.active) : this.active].join(" ");
977
+ this.out.write(erase.line + cursor.to(0) + this.outputText);
978
+ }
979
+ };
980
+ module.exports = TogglePrompt;
981
+ }
982
+ });
983
+
984
+ // node_modules/prompts/dist/dateparts/datepart.js
985
+ var require_datepart = __commonJS({
986
+ "node_modules/prompts/dist/dateparts/datepart.js"(exports, module) {
987
+ "use strict";
988
+ var DatePart = class _DatePart {
989
+ constructor({
990
+ token,
991
+ date,
992
+ parts,
993
+ locales
994
+ }) {
995
+ this.token = token;
996
+ this.date = date || /* @__PURE__ */ new Date();
997
+ this.parts = parts || [this];
998
+ this.locales = locales || {};
999
+ }
1000
+ up() {
1001
+ }
1002
+ down() {
1003
+ }
1004
+ next() {
1005
+ const currentIdx = this.parts.indexOf(this);
1006
+ return this.parts.find((part, idx) => idx > currentIdx && part instanceof _DatePart);
1007
+ }
1008
+ setTo(val) {
1009
+ }
1010
+ prev() {
1011
+ let parts = [].concat(this.parts).reverse();
1012
+ const currentIdx = parts.indexOf(this);
1013
+ return parts.find((part, idx) => idx > currentIdx && part instanceof _DatePart);
1014
+ }
1015
+ toString() {
1016
+ return String(this.date);
1017
+ }
1018
+ };
1019
+ module.exports = DatePart;
1020
+ }
1021
+ });
1022
+
1023
+ // node_modules/prompts/dist/dateparts/meridiem.js
1024
+ var require_meridiem = __commonJS({
1025
+ "node_modules/prompts/dist/dateparts/meridiem.js"(exports, module) {
1026
+ "use strict";
1027
+ var DatePart = require_datepart();
1028
+ var Meridiem = class extends DatePart {
1029
+ constructor(opts = {}) {
1030
+ super(opts);
1031
+ }
1032
+ up() {
1033
+ this.date.setHours((this.date.getHours() + 12) % 24);
1034
+ }
1035
+ down() {
1036
+ this.up();
1037
+ }
1038
+ toString() {
1039
+ let meridiem = this.date.getHours() > 12 ? "pm" : "am";
1040
+ return /\A/.test(this.token) ? meridiem.toUpperCase() : meridiem;
1041
+ }
1042
+ };
1043
+ module.exports = Meridiem;
1044
+ }
1045
+ });
1046
+
1047
+ // node_modules/prompts/dist/dateparts/day.js
1048
+ var require_day = __commonJS({
1049
+ "node_modules/prompts/dist/dateparts/day.js"(exports, module) {
1050
+ "use strict";
1051
+ var DatePart = require_datepart();
1052
+ var pos = (n) => {
1053
+ n = n % 10;
1054
+ return n === 1 ? "st" : n === 2 ? "nd" : n === 3 ? "rd" : "th";
1055
+ };
1056
+ var Day = class extends DatePart {
1057
+ constructor(opts = {}) {
1058
+ super(opts);
1059
+ }
1060
+ up() {
1061
+ this.date.setDate(this.date.getDate() + 1);
1062
+ }
1063
+ down() {
1064
+ this.date.setDate(this.date.getDate() - 1);
1065
+ }
1066
+ setTo(val) {
1067
+ this.date.setDate(parseInt(val.substr(-2)));
1068
+ }
1069
+ toString() {
1070
+ let date = this.date.getDate();
1071
+ let day = this.date.getDay();
1072
+ return this.token === "DD" ? String(date).padStart(2, "0") : this.token === "Do" ? date + pos(date) : this.token === "d" ? day + 1 : this.token === "ddd" ? this.locales.weekdaysShort[day] : this.token === "dddd" ? this.locales.weekdays[day] : date;
1073
+ }
1074
+ };
1075
+ module.exports = Day;
1076
+ }
1077
+ });
1078
+
1079
+ // node_modules/prompts/dist/dateparts/hours.js
1080
+ var require_hours = __commonJS({
1081
+ "node_modules/prompts/dist/dateparts/hours.js"(exports, module) {
1082
+ "use strict";
1083
+ var DatePart = require_datepart();
1084
+ var Hours = class extends DatePart {
1085
+ constructor(opts = {}) {
1086
+ super(opts);
1087
+ }
1088
+ up() {
1089
+ this.date.setHours(this.date.getHours() + 1);
1090
+ }
1091
+ down() {
1092
+ this.date.setHours(this.date.getHours() - 1);
1093
+ }
1094
+ setTo(val) {
1095
+ this.date.setHours(parseInt(val.substr(-2)));
1096
+ }
1097
+ toString() {
1098
+ let hours = this.date.getHours();
1099
+ if (/h/.test(this.token)) hours = hours % 12 || 12;
1100
+ return this.token.length > 1 ? String(hours).padStart(2, "0") : hours;
1101
+ }
1102
+ };
1103
+ module.exports = Hours;
1104
+ }
1105
+ });
1106
+
1107
+ // node_modules/prompts/dist/dateparts/milliseconds.js
1108
+ var require_milliseconds = __commonJS({
1109
+ "node_modules/prompts/dist/dateparts/milliseconds.js"(exports, module) {
1110
+ "use strict";
1111
+ var DatePart = require_datepart();
1112
+ var Milliseconds = class extends DatePart {
1113
+ constructor(opts = {}) {
1114
+ super(opts);
1115
+ }
1116
+ up() {
1117
+ this.date.setMilliseconds(this.date.getMilliseconds() + 1);
1118
+ }
1119
+ down() {
1120
+ this.date.setMilliseconds(this.date.getMilliseconds() - 1);
1121
+ }
1122
+ setTo(val) {
1123
+ this.date.setMilliseconds(parseInt(val.substr(-this.token.length)));
1124
+ }
1125
+ toString() {
1126
+ return String(this.date.getMilliseconds()).padStart(4, "0").substr(0, this.token.length);
1127
+ }
1128
+ };
1129
+ module.exports = Milliseconds;
1130
+ }
1131
+ });
1132
+
1133
+ // node_modules/prompts/dist/dateparts/minutes.js
1134
+ var require_minutes = __commonJS({
1135
+ "node_modules/prompts/dist/dateparts/minutes.js"(exports, module) {
1136
+ "use strict";
1137
+ var DatePart = require_datepart();
1138
+ var Minutes = class extends DatePart {
1139
+ constructor(opts = {}) {
1140
+ super(opts);
1141
+ }
1142
+ up() {
1143
+ this.date.setMinutes(this.date.getMinutes() + 1);
1144
+ }
1145
+ down() {
1146
+ this.date.setMinutes(this.date.getMinutes() - 1);
1147
+ }
1148
+ setTo(val) {
1149
+ this.date.setMinutes(parseInt(val.substr(-2)));
1150
+ }
1151
+ toString() {
1152
+ let m = this.date.getMinutes();
1153
+ return this.token.length > 1 ? String(m).padStart(2, "0") : m;
1154
+ }
1155
+ };
1156
+ module.exports = Minutes;
1157
+ }
1158
+ });
1159
+
1160
+ // node_modules/prompts/dist/dateparts/month.js
1161
+ var require_month = __commonJS({
1162
+ "node_modules/prompts/dist/dateparts/month.js"(exports, module) {
1163
+ "use strict";
1164
+ var DatePart = require_datepart();
1165
+ var Month = class extends DatePart {
1166
+ constructor(opts = {}) {
1167
+ super(opts);
1168
+ }
1169
+ up() {
1170
+ this.date.setMonth(this.date.getMonth() + 1);
1171
+ }
1172
+ down() {
1173
+ this.date.setMonth(this.date.getMonth() - 1);
1174
+ }
1175
+ setTo(val) {
1176
+ val = parseInt(val.substr(-2)) - 1;
1177
+ this.date.setMonth(val < 0 ? 0 : val);
1178
+ }
1179
+ toString() {
1180
+ let month = this.date.getMonth();
1181
+ let tl = this.token.length;
1182
+ return tl === 2 ? String(month + 1).padStart(2, "0") : tl === 3 ? this.locales.monthsShort[month] : tl === 4 ? this.locales.months[month] : String(month + 1);
1183
+ }
1184
+ };
1185
+ module.exports = Month;
1186
+ }
1187
+ });
1188
+
1189
+ // node_modules/prompts/dist/dateparts/seconds.js
1190
+ var require_seconds = __commonJS({
1191
+ "node_modules/prompts/dist/dateparts/seconds.js"(exports, module) {
1192
+ "use strict";
1193
+ var DatePart = require_datepart();
1194
+ var Seconds = class extends DatePart {
1195
+ constructor(opts = {}) {
1196
+ super(opts);
1197
+ }
1198
+ up() {
1199
+ this.date.setSeconds(this.date.getSeconds() + 1);
1200
+ }
1201
+ down() {
1202
+ this.date.setSeconds(this.date.getSeconds() - 1);
1203
+ }
1204
+ setTo(val) {
1205
+ this.date.setSeconds(parseInt(val.substr(-2)));
1206
+ }
1207
+ toString() {
1208
+ let s = this.date.getSeconds();
1209
+ return this.token.length > 1 ? String(s).padStart(2, "0") : s;
1210
+ }
1211
+ };
1212
+ module.exports = Seconds;
1213
+ }
1214
+ });
1215
+
1216
+ // node_modules/prompts/dist/dateparts/year.js
1217
+ var require_year = __commonJS({
1218
+ "node_modules/prompts/dist/dateparts/year.js"(exports, module) {
1219
+ "use strict";
1220
+ var DatePart = require_datepart();
1221
+ var Year = class extends DatePart {
1222
+ constructor(opts = {}) {
1223
+ super(opts);
1224
+ }
1225
+ up() {
1226
+ this.date.setFullYear(this.date.getFullYear() + 1);
1227
+ }
1228
+ down() {
1229
+ this.date.setFullYear(this.date.getFullYear() - 1);
1230
+ }
1231
+ setTo(val) {
1232
+ this.date.setFullYear(val.substr(-4));
1233
+ }
1234
+ toString() {
1235
+ let year = String(this.date.getFullYear()).padStart(4, "0");
1236
+ return this.token.length === 2 ? year.substr(-2) : year;
1237
+ }
1238
+ };
1239
+ module.exports = Year;
1240
+ }
1241
+ });
1242
+
1243
+ // node_modules/prompts/dist/dateparts/index.js
1244
+ var require_dateparts = __commonJS({
1245
+ "node_modules/prompts/dist/dateparts/index.js"(exports, module) {
1246
+ "use strict";
1247
+ module.exports = {
1248
+ DatePart: require_datepart(),
1249
+ Meridiem: require_meridiem(),
1250
+ Day: require_day(),
1251
+ Hours: require_hours(),
1252
+ Milliseconds: require_milliseconds(),
1253
+ Minutes: require_minutes(),
1254
+ Month: require_month(),
1255
+ Seconds: require_seconds(),
1256
+ Year: require_year()
1257
+ };
1258
+ }
1259
+ });
1260
+
1261
+ // node_modules/prompts/dist/elements/date.js
1262
+ var require_date = __commonJS({
1263
+ "node_modules/prompts/dist/elements/date.js"(exports, module) {
1264
+ "use strict";
1265
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1266
+ try {
1267
+ var info = gen[key](arg);
1268
+ var value = info.value;
1269
+ } catch (error) {
1270
+ reject(error);
1271
+ return;
1272
+ }
1273
+ if (info.done) {
1274
+ resolve(value);
1275
+ } else {
1276
+ Promise.resolve(value).then(_next, _throw);
1277
+ }
1278
+ }
1279
+ function _asyncToGenerator(fn) {
1280
+ return function() {
1281
+ var self = this, args2 = arguments;
1282
+ return new Promise(function(resolve, reject) {
1283
+ var gen = fn.apply(self, args2);
1284
+ function _next(value) {
1285
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1286
+ }
1287
+ function _throw(err) {
1288
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1289
+ }
1290
+ _next(void 0);
1291
+ });
1292
+ };
1293
+ }
1294
+ var color = require_kleur();
1295
+ var Prompt = require_prompt();
1296
+ var _require = require_util();
1297
+ var style = _require.style;
1298
+ var clear = _require.clear;
1299
+ var figures = _require.figures;
1300
+ var _require2 = require_src();
1301
+ var erase = _require2.erase;
1302
+ var cursor = _require2.cursor;
1303
+ var _require3 = require_dateparts();
1304
+ var DatePart = _require3.DatePart;
1305
+ var Meridiem = _require3.Meridiem;
1306
+ var Day = _require3.Day;
1307
+ var Hours = _require3.Hours;
1308
+ var Milliseconds = _require3.Milliseconds;
1309
+ var Minutes = _require3.Minutes;
1310
+ var Month = _require3.Month;
1311
+ var Seconds = _require3.Seconds;
1312
+ var Year = _require3.Year;
1313
+ var regex = /\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g;
1314
+ var regexGroups = {
1315
+ 1: ({
1316
+ token
1317
+ }) => token.replace(/\\(.)/g, "$1"),
1318
+ 2: (opts) => new Day(opts),
1319
+ // Day // TODO
1320
+ 3: (opts) => new Month(opts),
1321
+ // Month
1322
+ 4: (opts) => new Year(opts),
1323
+ // Year
1324
+ 5: (opts) => new Meridiem(opts),
1325
+ // AM/PM // TODO (special)
1326
+ 6: (opts) => new Hours(opts),
1327
+ // Hours
1328
+ 7: (opts) => new Minutes(opts),
1329
+ // Minutes
1330
+ 8: (opts) => new Seconds(opts),
1331
+ // Seconds
1332
+ 9: (opts) => new Milliseconds(opts)
1333
+ // Fractional seconds
1334
+ };
1335
+ var dfltLocales = {
1336
+ months: "January,February,March,April,May,June,July,August,September,October,November,December".split(","),
1337
+ monthsShort: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),
1338
+ weekdays: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),
1339
+ weekdaysShort: "Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")
1340
+ };
1341
+ var DatePrompt = class extends Prompt {
1342
+ constructor(opts = {}) {
1343
+ super(opts);
1344
+ this.msg = opts.message;
1345
+ this.cursor = 0;
1346
+ this.typed = "";
1347
+ this.locales = Object.assign(dfltLocales, opts.locales);
1348
+ this._date = opts.initial || /* @__PURE__ */ new Date();
1349
+ this.errorMsg = opts.error || "Please Enter A Valid Value";
1350
+ this.validator = opts.validate || (() => true);
1351
+ this.mask = opts.mask || "YYYY-MM-DD HH:mm:ss";
1352
+ this.clear = clear("", this.out.columns);
1353
+ this.render();
1354
+ }
1355
+ get value() {
1356
+ return this.date;
1357
+ }
1358
+ get date() {
1359
+ return this._date;
1360
+ }
1361
+ set date(date) {
1362
+ if (date) this._date.setTime(date.getTime());
1363
+ }
1364
+ set mask(mask) {
1365
+ let result;
1366
+ this.parts = [];
1367
+ while (result = regex.exec(mask)) {
1368
+ let match = result.shift();
1369
+ let idx = result.findIndex((gr) => gr != null);
1370
+ this.parts.push(idx in regexGroups ? regexGroups[idx]({
1371
+ token: result[idx] || match,
1372
+ date: this.date,
1373
+ parts: this.parts,
1374
+ locales: this.locales
1375
+ }) : result[idx] || match);
1376
+ }
1377
+ let parts = this.parts.reduce((arr, i) => {
1378
+ if (typeof i === "string" && typeof arr[arr.length - 1] === "string") arr[arr.length - 1] += i;
1379
+ else arr.push(i);
1380
+ return arr;
1381
+ }, []);
1382
+ this.parts.splice(0);
1383
+ this.parts.push(...parts);
1384
+ this.reset();
1385
+ }
1386
+ moveCursor(n) {
1387
+ this.typed = "";
1388
+ this.cursor = n;
1389
+ this.fire();
1390
+ }
1391
+ reset() {
1392
+ this.moveCursor(this.parts.findIndex((p) => p instanceof DatePart));
1393
+ this.fire();
1394
+ this.render();
1395
+ }
1396
+ exit() {
1397
+ this.abort();
1398
+ }
1399
+ abort() {
1400
+ this.done = this.aborted = true;
1401
+ this.error = false;
1402
+ this.fire();
1403
+ this.render();
1404
+ this.out.write("\n");
1405
+ this.close();
1406
+ }
1407
+ validate() {
1408
+ var _this = this;
1409
+ return _asyncToGenerator(function* () {
1410
+ let valid = yield _this.validator(_this.value);
1411
+ if (typeof valid === "string") {
1412
+ _this.errorMsg = valid;
1413
+ valid = false;
1414
+ }
1415
+ _this.error = !valid;
1416
+ })();
1417
+ }
1418
+ submit() {
1419
+ var _this2 = this;
1420
+ return _asyncToGenerator(function* () {
1421
+ yield _this2.validate();
1422
+ if (_this2.error) {
1423
+ _this2.color = "red";
1424
+ _this2.fire();
1425
+ _this2.render();
1426
+ return;
1427
+ }
1428
+ _this2.done = true;
1429
+ _this2.aborted = false;
1430
+ _this2.fire();
1431
+ _this2.render();
1432
+ _this2.out.write("\n");
1433
+ _this2.close();
1434
+ })();
1435
+ }
1436
+ up() {
1437
+ this.typed = "";
1438
+ this.parts[this.cursor].up();
1439
+ this.render();
1440
+ }
1441
+ down() {
1442
+ this.typed = "";
1443
+ this.parts[this.cursor].down();
1444
+ this.render();
1445
+ }
1446
+ left() {
1447
+ let prev = this.parts[this.cursor].prev();
1448
+ if (prev == null) return this.bell();
1449
+ this.moveCursor(this.parts.indexOf(prev));
1450
+ this.render();
1451
+ }
1452
+ right() {
1453
+ let next = this.parts[this.cursor].next();
1454
+ if (next == null) return this.bell();
1455
+ this.moveCursor(this.parts.indexOf(next));
1456
+ this.render();
1457
+ }
1458
+ next() {
1459
+ let next = this.parts[this.cursor].next();
1460
+ this.moveCursor(next ? this.parts.indexOf(next) : this.parts.findIndex((part) => part instanceof DatePart));
1461
+ this.render();
1462
+ }
1463
+ _(c) {
1464
+ if (/\d/.test(c)) {
1465
+ this.typed += c;
1466
+ this.parts[this.cursor].setTo(this.typed);
1467
+ this.render();
1468
+ }
1469
+ }
1470
+ render() {
1471
+ if (this.closed) return;
1472
+ if (this.firstRender) this.out.write(cursor.hide);
1473
+ else this.out.write(clear(this.outputText, this.out.columns));
1474
+ super.render();
1475
+ this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.parts.reduce((arr, p, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p.toString()) : p), []).join("")].join(" ");
1476
+ if (this.error) {
1477
+ this.outputText += this.errorMsg.split("\n").reduce((a, l, i) => a + `
1478
+ ${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
1479
+ }
1480
+ this.out.write(erase.line + cursor.to(0) + this.outputText);
1481
+ }
1482
+ };
1483
+ module.exports = DatePrompt;
1484
+ }
1485
+ });
1486
+
1487
+ // node_modules/prompts/dist/elements/number.js
1488
+ var require_number = __commonJS({
1489
+ "node_modules/prompts/dist/elements/number.js"(exports, module) {
1490
+ "use strict";
1491
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1492
+ try {
1493
+ var info = gen[key](arg);
1494
+ var value = info.value;
1495
+ } catch (error) {
1496
+ reject(error);
1497
+ return;
1498
+ }
1499
+ if (info.done) {
1500
+ resolve(value);
1501
+ } else {
1502
+ Promise.resolve(value).then(_next, _throw);
1503
+ }
1504
+ }
1505
+ function _asyncToGenerator(fn) {
1506
+ return function() {
1507
+ var self = this, args2 = arguments;
1508
+ return new Promise(function(resolve, reject) {
1509
+ var gen = fn.apply(self, args2);
1510
+ function _next(value) {
1511
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1512
+ }
1513
+ function _throw(err) {
1514
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1515
+ }
1516
+ _next(void 0);
1517
+ });
1518
+ };
1519
+ }
1520
+ var color = require_kleur();
1521
+ var Prompt = require_prompt();
1522
+ var _require = require_src();
1523
+ var cursor = _require.cursor;
1524
+ var erase = _require.erase;
1525
+ var _require2 = require_util();
1526
+ var style = _require2.style;
1527
+ var figures = _require2.figures;
1528
+ var clear = _require2.clear;
1529
+ var lines = _require2.lines;
1530
+ var isNumber = /[0-9]/;
1531
+ var isDef = (any) => any !== void 0;
1532
+ var round = (number, precision) => {
1533
+ let factor = Math.pow(10, precision);
1534
+ return Math.round(number * factor) / factor;
1535
+ };
1536
+ var NumberPrompt = class extends Prompt {
1537
+ constructor(opts = {}) {
1538
+ super(opts);
1539
+ this.transform = style.render(opts.style);
1540
+ this.msg = opts.message;
1541
+ this.initial = isDef(opts.initial) ? opts.initial : "";
1542
+ this.float = !!opts.float;
1543
+ this.round = opts.round || 2;
1544
+ this.inc = opts.increment || 1;
1545
+ this.min = isDef(opts.min) ? opts.min : -Infinity;
1546
+ this.max = isDef(opts.max) ? opts.max : Infinity;
1547
+ this.errorMsg = opts.error || `Please Enter A Valid Value`;
1548
+ this.validator = opts.validate || (() => true);
1549
+ this.color = `cyan`;
1550
+ this.value = ``;
1551
+ this.typed = ``;
1552
+ this.lastHit = 0;
1553
+ this.render();
1554
+ }
1555
+ set value(v) {
1556
+ if (!v && v !== 0) {
1557
+ this.placeholder = true;
1558
+ this.rendered = color.gray(this.transform.render(`${this.initial}`));
1559
+ this._value = ``;
1560
+ } else {
1561
+ this.placeholder = false;
1562
+ this.rendered = this.transform.render(`${round(v, this.round)}`);
1563
+ this._value = round(v, this.round);
1564
+ }
1565
+ this.fire();
1566
+ }
1567
+ get value() {
1568
+ return this._value;
1569
+ }
1570
+ parse(x) {
1571
+ return this.float ? parseFloat(x) : parseInt(x);
1572
+ }
1573
+ valid(c) {
1574
+ return c === `-` || c === `.` && this.float || isNumber.test(c);
1575
+ }
1576
+ reset() {
1577
+ this.typed = ``;
1578
+ this.value = ``;
1579
+ this.fire();
1580
+ this.render();
1581
+ }
1582
+ exit() {
1583
+ this.abort();
1584
+ }
1585
+ abort() {
1586
+ let x = this.value;
1587
+ this.value = x !== `` ? x : this.initial;
1588
+ this.done = this.aborted = true;
1589
+ this.error = false;
1590
+ this.fire();
1591
+ this.render();
1592
+ this.out.write(`
1593
+ `);
1594
+ this.close();
1595
+ }
1596
+ validate() {
1597
+ var _this = this;
1598
+ return _asyncToGenerator(function* () {
1599
+ let valid = yield _this.validator(_this.value);
1600
+ if (typeof valid === `string`) {
1601
+ _this.errorMsg = valid;
1602
+ valid = false;
1603
+ }
1604
+ _this.error = !valid;
1605
+ })();
1606
+ }
1607
+ submit() {
1608
+ var _this2 = this;
1609
+ return _asyncToGenerator(function* () {
1610
+ yield _this2.validate();
1611
+ if (_this2.error) {
1612
+ _this2.color = `red`;
1613
+ _this2.fire();
1614
+ _this2.render();
1615
+ return;
1616
+ }
1617
+ let x = _this2.value;
1618
+ _this2.value = x !== `` ? x : _this2.initial;
1619
+ _this2.done = true;
1620
+ _this2.aborted = false;
1621
+ _this2.error = false;
1622
+ _this2.fire();
1623
+ _this2.render();
1624
+ _this2.out.write(`
1625
+ `);
1626
+ _this2.close();
1627
+ })();
1628
+ }
1629
+ up() {
1630
+ this.typed = ``;
1631
+ if (this.value === "") {
1632
+ this.value = this.min - this.inc;
1633
+ }
1634
+ if (this.value >= this.max) return this.bell();
1635
+ this.value += this.inc;
1636
+ this.color = `cyan`;
1637
+ this.fire();
1638
+ this.render();
1639
+ }
1640
+ down() {
1641
+ this.typed = ``;
1642
+ if (this.value === "") {
1643
+ this.value = this.min + this.inc;
1644
+ }
1645
+ if (this.value <= this.min) return this.bell();
1646
+ this.value -= this.inc;
1647
+ this.color = `cyan`;
1648
+ this.fire();
1649
+ this.render();
1650
+ }
1651
+ delete() {
1652
+ let val = this.value.toString();
1653
+ if (val.length === 0) return this.bell();
1654
+ this.value = this.parse(val = val.slice(0, -1)) || ``;
1655
+ if (this.value !== "" && this.value < this.min) {
1656
+ this.value = this.min;
1657
+ }
1658
+ this.color = `cyan`;
1659
+ this.fire();
1660
+ this.render();
1661
+ }
1662
+ next() {
1663
+ this.value = this.initial;
1664
+ this.fire();
1665
+ this.render();
1666
+ }
1667
+ _(c, key) {
1668
+ if (!this.valid(c)) return this.bell();
1669
+ const now = Date.now();
1670
+ if (now - this.lastHit > 1e3) this.typed = ``;
1671
+ this.typed += c;
1672
+ this.lastHit = now;
1673
+ this.color = `cyan`;
1674
+ if (c === `.`) return this.fire();
1675
+ this.value = Math.min(this.parse(this.typed), this.max);
1676
+ if (this.value > this.max) this.value = this.max;
1677
+ if (this.value < this.min) this.value = this.min;
1678
+ this.fire();
1679
+ this.render();
1680
+ }
1681
+ render() {
1682
+ if (this.closed) return;
1683
+ if (!this.firstRender) {
1684
+ if (this.outputError) this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns));
1685
+ this.out.write(clear(this.outputText, this.out.columns));
1686
+ }
1687
+ super.render();
1688
+ this.outputError = "";
1689
+ this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), !this.done || !this.done && !this.placeholder ? color[this.color]().underline(this.rendered) : this.rendered].join(` `);
1690
+ if (this.error) {
1691
+ this.outputError += this.errorMsg.split(`
1692
+ `).reduce((a, l, i) => a + `
1693
+ ${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
1694
+ }
1695
+ this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore);
1696
+ }
1697
+ };
1698
+ module.exports = NumberPrompt;
1699
+ }
1700
+ });
1701
+
1702
+ // node_modules/prompts/dist/elements/multiselect.js
1703
+ var require_multiselect = __commonJS({
1704
+ "node_modules/prompts/dist/elements/multiselect.js"(exports, module) {
1705
+ "use strict";
1706
+ var color = require_kleur();
1707
+ var _require = require_src();
1708
+ var cursor = _require.cursor;
1709
+ var Prompt = require_prompt();
1710
+ var _require2 = require_util();
1711
+ var clear = _require2.clear;
1712
+ var figures = _require2.figures;
1713
+ var style = _require2.style;
1714
+ var wrap = _require2.wrap;
1715
+ var entriesToDisplay = _require2.entriesToDisplay;
1716
+ var MultiselectPrompt = class extends Prompt {
1717
+ constructor(opts = {}) {
1718
+ super(opts);
1719
+ this.msg = opts.message;
1720
+ this.cursor = opts.cursor || 0;
1721
+ this.scrollIndex = opts.cursor || 0;
1722
+ this.hint = opts.hint || "";
1723
+ this.warn = opts.warn || "- This option is disabled -";
1724
+ this.minSelected = opts.min;
1725
+ this.showMinError = false;
1726
+ this.maxChoices = opts.max;
1727
+ this.instructions = opts.instructions;
1728
+ this.optionsPerPage = opts.optionsPerPage || 10;
1729
+ this.value = opts.choices.map((ch, idx) => {
1730
+ if (typeof ch === "string") ch = {
1731
+ title: ch,
1732
+ value: idx
1733
+ };
1734
+ return {
1735
+ title: ch && (ch.title || ch.value || ch),
1736
+ description: ch && ch.description,
1737
+ value: ch && (ch.value === void 0 ? idx : ch.value),
1738
+ selected: ch && ch.selected,
1739
+ disabled: ch && ch.disabled
1740
+ };
1741
+ });
1742
+ this.clear = clear("", this.out.columns);
1743
+ if (!opts.overrideRender) {
1744
+ this.render();
1745
+ }
1746
+ }
1747
+ reset() {
1748
+ this.value.map((v) => !v.selected);
1749
+ this.cursor = 0;
1750
+ this.fire();
1751
+ this.render();
1752
+ }
1753
+ selected() {
1754
+ return this.value.filter((v) => v.selected);
1755
+ }
1756
+ exit() {
1757
+ this.abort();
1758
+ }
1759
+ abort() {
1760
+ this.done = this.aborted = true;
1761
+ this.fire();
1762
+ this.render();
1763
+ this.out.write("\n");
1764
+ this.close();
1765
+ }
1766
+ submit() {
1767
+ const selected = this.value.filter((e) => e.selected);
1768
+ if (this.minSelected && selected.length < this.minSelected) {
1769
+ this.showMinError = true;
1770
+ this.render();
1771
+ } else {
1772
+ this.done = true;
1773
+ this.aborted = false;
1774
+ this.fire();
1775
+ this.render();
1776
+ this.out.write("\n");
1777
+ this.close();
1778
+ }
1779
+ }
1780
+ first() {
1781
+ this.cursor = 0;
1782
+ this.render();
1783
+ }
1784
+ last() {
1785
+ this.cursor = this.value.length - 1;
1786
+ this.render();
1787
+ }
1788
+ next() {
1789
+ this.cursor = (this.cursor + 1) % this.value.length;
1790
+ this.render();
1791
+ }
1792
+ up() {
1793
+ if (this.cursor === 0) {
1794
+ this.cursor = this.value.length - 1;
1795
+ } else {
1796
+ this.cursor--;
1797
+ }
1798
+ this.render();
1799
+ }
1800
+ down() {
1801
+ if (this.cursor === this.value.length - 1) {
1802
+ this.cursor = 0;
1803
+ } else {
1804
+ this.cursor++;
1805
+ }
1806
+ this.render();
1807
+ }
1808
+ left() {
1809
+ this.value[this.cursor].selected = false;
1810
+ this.render();
1811
+ }
1812
+ right() {
1813
+ if (this.value.filter((e) => e.selected).length >= this.maxChoices) return this.bell();
1814
+ this.value[this.cursor].selected = true;
1815
+ this.render();
1816
+ }
1817
+ handleSpaceToggle() {
1818
+ const v = this.value[this.cursor];
1819
+ if (v.selected) {
1820
+ v.selected = false;
1821
+ this.render();
1822
+ } else if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) {
1823
+ return this.bell();
1824
+ } else {
1825
+ v.selected = true;
1826
+ this.render();
1827
+ }
1828
+ }
1829
+ toggleAll() {
1830
+ if (this.maxChoices !== void 0 || this.value[this.cursor].disabled) {
1831
+ return this.bell();
1832
+ }
1833
+ const newSelected = !this.value[this.cursor].selected;
1834
+ this.value.filter((v) => !v.disabled).forEach((v) => v.selected = newSelected);
1835
+ this.render();
1836
+ }
1837
+ _(c, key) {
1838
+ if (c === " ") {
1839
+ this.handleSpaceToggle();
1840
+ } else if (c === "a") {
1841
+ this.toggleAll();
1842
+ } else {
1843
+ return this.bell();
1844
+ }
1845
+ }
1846
+ renderInstructions() {
1847
+ if (this.instructions === void 0 || this.instructions) {
1848
+ if (typeof this.instructions === "string") {
1849
+ return this.instructions;
1850
+ }
1851
+ return `
1852
+ Instructions:
1853
+ ${figures.arrowUp}/${figures.arrowDown}: Highlight option
1854
+ ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
1855
+ ` + (this.maxChoices === void 0 ? ` a: Toggle all
1856
+ ` : "") + ` enter/return: Complete answer`;
1857
+ }
1858
+ return "";
1859
+ }
1860
+ renderOption(cursor2, v, i, arrowIndicator) {
1861
+ const prefix = (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + arrowIndicator + " ";
1862
+ let title, desc;
1863
+ if (v.disabled) {
1864
+ title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
1865
+ } else {
1866
+ title = cursor2 === i ? color.cyan().underline(v.title) : v.title;
1867
+ if (cursor2 === i && v.description) {
1868
+ desc = ` - ${v.description}`;
1869
+ if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
1870
+ desc = "\n" + wrap(v.description, {
1871
+ margin: prefix.length,
1872
+ width: this.out.columns
1873
+ });
1874
+ }
1875
+ }
1876
+ }
1877
+ return prefix + title + color.gray(desc || "");
1878
+ }
1879
+ // shared with autocompleteMultiselect
1880
+ paginateOptions(options) {
1881
+ if (options.length === 0) {
1882
+ return color.red("No matches for this query.");
1883
+ }
1884
+ let _entriesToDisplay = entriesToDisplay(this.cursor, options.length, this.optionsPerPage), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
1885
+ let prefix, styledOptions = [];
1886
+ for (let i = startIndex; i < endIndex; i++) {
1887
+ if (i === startIndex && startIndex > 0) {
1888
+ prefix = figures.arrowUp;
1889
+ } else if (i === endIndex - 1 && endIndex < options.length) {
1890
+ prefix = figures.arrowDown;
1891
+ } else {
1892
+ prefix = " ";
1893
+ }
1894
+ styledOptions.push(this.renderOption(this.cursor, options[i], i, prefix));
1895
+ }
1896
+ return "\n" + styledOptions.join("\n");
1897
+ }
1898
+ // shared with autocomleteMultiselect
1899
+ renderOptions(options) {
1900
+ if (!this.done) {
1901
+ return this.paginateOptions(options);
1902
+ }
1903
+ return "";
1904
+ }
1905
+ renderDoneOrInstructions() {
1906
+ if (this.done) {
1907
+ return this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
1908
+ }
1909
+ const output = [color.gray(this.hint), this.renderInstructions()];
1910
+ if (this.value[this.cursor].disabled) {
1911
+ output.push(color.yellow(this.warn));
1912
+ }
1913
+ return output.join(" ");
1914
+ }
1915
+ render() {
1916
+ if (this.closed) return;
1917
+ if (this.firstRender) this.out.write(cursor.hide);
1918
+ super.render();
1919
+ let prompt = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.renderDoneOrInstructions()].join(" ");
1920
+ if (this.showMinError) {
1921
+ prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
1922
+ this.showMinError = false;
1923
+ }
1924
+ prompt += this.renderOptions(this.value);
1925
+ this.out.write(this.clear + prompt);
1926
+ this.clear = clear(prompt, this.out.columns);
1927
+ }
1928
+ };
1929
+ module.exports = MultiselectPrompt;
1930
+ }
1931
+ });
1932
+
1933
+ // node_modules/prompts/dist/elements/autocomplete.js
1934
+ var require_autocomplete = __commonJS({
1935
+ "node_modules/prompts/dist/elements/autocomplete.js"(exports, module) {
1936
+ "use strict";
1937
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1938
+ try {
1939
+ var info = gen[key](arg);
1940
+ var value = info.value;
1941
+ } catch (error) {
1942
+ reject(error);
1943
+ return;
1944
+ }
1945
+ if (info.done) {
1946
+ resolve(value);
1947
+ } else {
1948
+ Promise.resolve(value).then(_next, _throw);
1949
+ }
1950
+ }
1951
+ function _asyncToGenerator(fn) {
1952
+ return function() {
1953
+ var self = this, args2 = arguments;
1954
+ return new Promise(function(resolve, reject) {
1955
+ var gen = fn.apply(self, args2);
1956
+ function _next(value) {
1957
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1958
+ }
1959
+ function _throw(err) {
1960
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1961
+ }
1962
+ _next(void 0);
1963
+ });
1964
+ };
1965
+ }
1966
+ var color = require_kleur();
1967
+ var Prompt = require_prompt();
1968
+ var _require = require_src();
1969
+ var erase = _require.erase;
1970
+ var cursor = _require.cursor;
1971
+ var _require2 = require_util();
1972
+ var style = _require2.style;
1973
+ var clear = _require2.clear;
1974
+ var figures = _require2.figures;
1975
+ var wrap = _require2.wrap;
1976
+ var entriesToDisplay = _require2.entriesToDisplay;
1977
+ var getVal = (arr, i) => arr[i] && (arr[i].value || arr[i].title || arr[i]);
1978
+ var getTitle = (arr, i) => arr[i] && (arr[i].title || arr[i].value || arr[i]);
1979
+ var getIndex = (arr, valOrTitle) => {
1980
+ const index = arr.findIndex((el) => el.value === valOrTitle || el.title === valOrTitle);
1981
+ return index > -1 ? index : void 0;
1982
+ };
1983
+ var AutocompletePrompt = class extends Prompt {
1984
+ constructor(opts = {}) {
1985
+ super(opts);
1986
+ this.msg = opts.message;
1987
+ this.suggest = opts.suggest;
1988
+ this.choices = opts.choices;
1989
+ this.initial = typeof opts.initial === "number" ? opts.initial : getIndex(opts.choices, opts.initial);
1990
+ this.select = this.initial || opts.cursor || 0;
1991
+ this.i18n = {
1992
+ noMatches: opts.noMatches || "no matches found"
1993
+ };
1994
+ this.fallback = opts.fallback || this.initial;
1995
+ this.clearFirst = opts.clearFirst || false;
1996
+ this.suggestions = [];
1997
+ this.input = "";
1998
+ this.limit = opts.limit || 10;
1999
+ this.cursor = 0;
2000
+ this.transform = style.render(opts.style);
2001
+ this.scale = this.transform.scale;
2002
+ this.render = this.render.bind(this);
2003
+ this.complete = this.complete.bind(this);
2004
+ this.clear = clear("", this.out.columns);
2005
+ this.complete(this.render);
2006
+ this.render();
2007
+ }
2008
+ set fallback(fb) {
2009
+ this._fb = Number.isSafeInteger(parseInt(fb)) ? parseInt(fb) : fb;
2010
+ }
2011
+ get fallback() {
2012
+ let choice;
2013
+ if (typeof this._fb === "number") choice = this.choices[this._fb];
2014
+ else if (typeof this._fb === "string") choice = {
2015
+ title: this._fb
2016
+ };
2017
+ return choice || this._fb || {
2018
+ title: this.i18n.noMatches
2019
+ };
2020
+ }
2021
+ moveSelect(i) {
2022
+ this.select = i;
2023
+ if (this.suggestions.length > 0) this.value = getVal(this.suggestions, i);
2024
+ else this.value = this.fallback.value;
2025
+ this.fire();
2026
+ }
2027
+ complete(cb) {
2028
+ var _this = this;
2029
+ return _asyncToGenerator(function* () {
2030
+ const p = _this.completing = _this.suggest(_this.input, _this.choices);
2031
+ const suggestions = yield p;
2032
+ if (_this.completing !== p) return;
2033
+ _this.suggestions = suggestions.map((s, i, arr) => ({
2034
+ title: getTitle(arr, i),
2035
+ value: getVal(arr, i),
2036
+ description: s.description
2037
+ }));
2038
+ _this.completing = false;
2039
+ const l = Math.max(suggestions.length - 1, 0);
2040
+ _this.moveSelect(Math.min(l, _this.select));
2041
+ cb && cb();
2042
+ })();
2043
+ }
2044
+ reset() {
2045
+ this.input = "";
2046
+ this.complete(() => {
2047
+ this.moveSelect(this.initial !== void 0 ? this.initial : 0);
2048
+ this.render();
2049
+ });
2050
+ this.render();
2051
+ }
2052
+ exit() {
2053
+ if (this.clearFirst && this.input.length > 0) {
2054
+ this.reset();
2055
+ } else {
2056
+ this.done = this.exited = true;
2057
+ this.aborted = false;
2058
+ this.fire();
2059
+ this.render();
2060
+ this.out.write("\n");
2061
+ this.close();
2062
+ }
2063
+ }
2064
+ abort() {
2065
+ this.done = this.aborted = true;
2066
+ this.exited = false;
2067
+ this.fire();
2068
+ this.render();
2069
+ this.out.write("\n");
2070
+ this.close();
2071
+ }
2072
+ submit() {
2073
+ this.done = true;
2074
+ this.aborted = this.exited = false;
2075
+ this.fire();
2076
+ this.render();
2077
+ this.out.write("\n");
2078
+ this.close();
2079
+ }
2080
+ _(c, key) {
2081
+ let s1 = this.input.slice(0, this.cursor);
2082
+ let s2 = this.input.slice(this.cursor);
2083
+ this.input = `${s1}${c}${s2}`;
2084
+ this.cursor = s1.length + 1;
2085
+ this.complete(this.render);
2086
+ this.render();
2087
+ }
2088
+ delete() {
2089
+ if (this.cursor === 0) return this.bell();
2090
+ let s1 = this.input.slice(0, this.cursor - 1);
2091
+ let s2 = this.input.slice(this.cursor);
2092
+ this.input = `${s1}${s2}`;
2093
+ this.complete(this.render);
2094
+ this.cursor = this.cursor - 1;
2095
+ this.render();
2096
+ }
2097
+ deleteForward() {
2098
+ if (this.cursor * this.scale >= this.rendered.length) return this.bell();
2099
+ let s1 = this.input.slice(0, this.cursor);
2100
+ let s2 = this.input.slice(this.cursor + 1);
2101
+ this.input = `${s1}${s2}`;
2102
+ this.complete(this.render);
2103
+ this.render();
2104
+ }
2105
+ first() {
2106
+ this.moveSelect(0);
2107
+ this.render();
2108
+ }
2109
+ last() {
2110
+ this.moveSelect(this.suggestions.length - 1);
2111
+ this.render();
2112
+ }
2113
+ up() {
2114
+ if (this.select === 0) {
2115
+ this.moveSelect(this.suggestions.length - 1);
2116
+ } else {
2117
+ this.moveSelect(this.select - 1);
2118
+ }
2119
+ this.render();
2120
+ }
2121
+ down() {
2122
+ if (this.select === this.suggestions.length - 1) {
2123
+ this.moveSelect(0);
2124
+ } else {
2125
+ this.moveSelect(this.select + 1);
2126
+ }
2127
+ this.render();
2128
+ }
2129
+ next() {
2130
+ if (this.select === this.suggestions.length - 1) {
2131
+ this.moveSelect(0);
2132
+ } else this.moveSelect(this.select + 1);
2133
+ this.render();
2134
+ }
2135
+ nextPage() {
2136
+ this.moveSelect(Math.min(this.select + this.limit, this.suggestions.length - 1));
2137
+ this.render();
2138
+ }
2139
+ prevPage() {
2140
+ this.moveSelect(Math.max(this.select - this.limit, 0));
2141
+ this.render();
2142
+ }
2143
+ left() {
2144
+ if (this.cursor <= 0) return this.bell();
2145
+ this.cursor = this.cursor - 1;
2146
+ this.render();
2147
+ }
2148
+ right() {
2149
+ if (this.cursor * this.scale >= this.rendered.length) return this.bell();
2150
+ this.cursor = this.cursor + 1;
2151
+ this.render();
2152
+ }
2153
+ renderOption(v, hovered, isStart, isEnd) {
2154
+ let desc;
2155
+ let prefix = isStart ? figures.arrowUp : isEnd ? figures.arrowDown : " ";
2156
+ let title = hovered ? color.cyan().underline(v.title) : v.title;
2157
+ prefix = (hovered ? color.cyan(figures.pointer) + " " : " ") + prefix;
2158
+ if (v.description) {
2159
+ desc = ` - ${v.description}`;
2160
+ if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
2161
+ desc = "\n" + wrap(v.description, {
2162
+ margin: 3,
2163
+ width: this.out.columns
2164
+ });
2165
+ }
2166
+ }
2167
+ return prefix + " " + title + color.gray(desc || "");
2168
+ }
2169
+ render() {
2170
+ if (this.closed) return;
2171
+ if (this.firstRender) this.out.write(cursor.hide);
2172
+ else this.out.write(clear(this.outputText, this.out.columns));
2173
+ super.render();
2174
+ let _entriesToDisplay = entriesToDisplay(this.select, this.choices.length, this.limit), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
2175
+ this.outputText = [style.symbol(this.done, this.aborted, this.exited), color.bold(this.msg), style.delimiter(this.completing), this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)].join(" ");
2176
+ if (!this.done) {
2177
+ const suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(item, this.select === i + startIndex, i === 0 && startIndex > 0, i + startIndex === endIndex - 1 && endIndex < this.choices.length)).join("\n");
2178
+ this.outputText += `
2179
+ ` + (suggestions || color.gray(this.fallback.title));
2180
+ }
2181
+ this.out.write(erase.line + cursor.to(0) + this.outputText);
2182
+ }
2183
+ };
2184
+ module.exports = AutocompletePrompt;
2185
+ }
2186
+ });
2187
+
2188
+ // node_modules/prompts/dist/elements/autocompleteMultiselect.js
2189
+ var require_autocompleteMultiselect = __commonJS({
2190
+ "node_modules/prompts/dist/elements/autocompleteMultiselect.js"(exports, module) {
2191
+ "use strict";
2192
+ var color = require_kleur();
2193
+ var _require = require_src();
2194
+ var cursor = _require.cursor;
2195
+ var MultiselectPrompt = require_multiselect();
2196
+ var _require2 = require_util();
2197
+ var clear = _require2.clear;
2198
+ var style = _require2.style;
2199
+ var figures = _require2.figures;
2200
+ var AutocompleteMultiselectPrompt = class extends MultiselectPrompt {
2201
+ constructor(opts = {}) {
2202
+ opts.overrideRender = true;
2203
+ super(opts);
2204
+ this.inputValue = "";
2205
+ this.clear = clear("", this.out.columns);
2206
+ this.filteredOptions = this.value;
2207
+ this.render();
2208
+ }
2209
+ last() {
2210
+ this.cursor = this.filteredOptions.length - 1;
2211
+ this.render();
2212
+ }
2213
+ next() {
2214
+ this.cursor = (this.cursor + 1) % this.filteredOptions.length;
2215
+ this.render();
2216
+ }
2217
+ up() {
2218
+ if (this.cursor === 0) {
2219
+ this.cursor = this.filteredOptions.length - 1;
2220
+ } else {
2221
+ this.cursor--;
2222
+ }
2223
+ this.render();
2224
+ }
2225
+ down() {
2226
+ if (this.cursor === this.filteredOptions.length - 1) {
2227
+ this.cursor = 0;
2228
+ } else {
2229
+ this.cursor++;
2230
+ }
2231
+ this.render();
2232
+ }
2233
+ left() {
2234
+ this.filteredOptions[this.cursor].selected = false;
2235
+ this.render();
2236
+ }
2237
+ right() {
2238
+ if (this.value.filter((e) => e.selected).length >= this.maxChoices) return this.bell();
2239
+ this.filteredOptions[this.cursor].selected = true;
2240
+ this.render();
2241
+ }
2242
+ delete() {
2243
+ if (this.inputValue.length) {
2244
+ this.inputValue = this.inputValue.substr(0, this.inputValue.length - 1);
2245
+ this.updateFilteredOptions();
2246
+ }
2247
+ }
2248
+ updateFilteredOptions() {
2249
+ const currentHighlight = this.filteredOptions[this.cursor];
2250
+ this.filteredOptions = this.value.filter((v) => {
2251
+ if (this.inputValue) {
2252
+ if (typeof v.title === "string") {
2253
+ if (v.title.toLowerCase().includes(this.inputValue.toLowerCase())) {
2254
+ return true;
2255
+ }
2256
+ }
2257
+ if (typeof v.value === "string") {
2258
+ if (v.value.toLowerCase().includes(this.inputValue.toLowerCase())) {
2259
+ return true;
2260
+ }
2261
+ }
2262
+ return false;
2263
+ }
2264
+ return true;
2265
+ });
2266
+ const newHighlightIndex = this.filteredOptions.findIndex((v) => v === currentHighlight);
2267
+ this.cursor = newHighlightIndex < 0 ? 0 : newHighlightIndex;
2268
+ this.render();
2269
+ }
2270
+ handleSpaceToggle() {
2271
+ const v = this.filteredOptions[this.cursor];
2272
+ if (v.selected) {
2273
+ v.selected = false;
2274
+ this.render();
2275
+ } else if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) {
2276
+ return this.bell();
2277
+ } else {
2278
+ v.selected = true;
2279
+ this.render();
2280
+ }
2281
+ }
2282
+ handleInputChange(c) {
2283
+ this.inputValue = this.inputValue + c;
2284
+ this.updateFilteredOptions();
2285
+ }
2286
+ _(c, key) {
2287
+ if (c === " ") {
2288
+ this.handleSpaceToggle();
2289
+ } else {
2290
+ this.handleInputChange(c);
2291
+ }
2292
+ }
2293
+ renderInstructions() {
2294
+ if (this.instructions === void 0 || this.instructions) {
2295
+ if (typeof this.instructions === "string") {
2296
+ return this.instructions;
2297
+ }
2298
+ return `
2299
+ Instructions:
2300
+ ${figures.arrowUp}/${figures.arrowDown}: Highlight option
2301
+ ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
2302
+ [a,b,c]/delete: Filter choices
2303
+ enter/return: Complete answer
2304
+ `;
2305
+ }
2306
+ return "";
2307
+ }
2308
+ renderCurrentInput() {
2309
+ return `
2310
+ Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
2311
+ `;
2312
+ }
2313
+ renderOption(cursor2, v, i) {
2314
+ let title;
2315
+ if (v.disabled) title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
2316
+ else title = cursor2 === i ? color.cyan().underline(v.title) : v.title;
2317
+ return (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + title;
2318
+ }
2319
+ renderDoneOrInstructions() {
2320
+ if (this.done) {
2321
+ return this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
2322
+ }
2323
+ const output = [color.gray(this.hint), this.renderInstructions(), this.renderCurrentInput()];
2324
+ if (this.filteredOptions.length && this.filteredOptions[this.cursor].disabled) {
2325
+ output.push(color.yellow(this.warn));
2326
+ }
2327
+ return output.join(" ");
2328
+ }
2329
+ render() {
2330
+ if (this.closed) return;
2331
+ if (this.firstRender) this.out.write(cursor.hide);
2332
+ super.render();
2333
+ let prompt = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.renderDoneOrInstructions()].join(" ");
2334
+ if (this.showMinError) {
2335
+ prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
2336
+ this.showMinError = false;
2337
+ }
2338
+ prompt += this.renderOptions(this.filteredOptions);
2339
+ this.out.write(this.clear + prompt);
2340
+ this.clear = clear(prompt, this.out.columns);
2341
+ }
2342
+ };
2343
+ module.exports = AutocompleteMultiselectPrompt;
2344
+ }
2345
+ });
2346
+
2347
+ // node_modules/prompts/dist/elements/confirm.js
2348
+ var require_confirm = __commonJS({
2349
+ "node_modules/prompts/dist/elements/confirm.js"(exports, module) {
2350
+ "use strict";
2351
+ var color = require_kleur();
2352
+ var Prompt = require_prompt();
2353
+ var _require = require_util();
2354
+ var style = _require.style;
2355
+ var clear = _require.clear;
2356
+ var _require2 = require_src();
2357
+ var erase = _require2.erase;
2358
+ var cursor = _require2.cursor;
2359
+ var ConfirmPrompt = class extends Prompt {
2360
+ constructor(opts = {}) {
2361
+ super(opts);
2362
+ this.msg = opts.message;
2363
+ this.value = opts.initial;
2364
+ this.initialValue = !!opts.initial;
2365
+ this.yesMsg = opts.yes || "yes";
2366
+ this.yesOption = opts.yesOption || "(Y/n)";
2367
+ this.noMsg = opts.no || "no";
2368
+ this.noOption = opts.noOption || "(y/N)";
2369
+ this.render();
2370
+ }
2371
+ reset() {
2372
+ this.value = this.initialValue;
2373
+ this.fire();
2374
+ this.render();
2375
+ }
2376
+ exit() {
2377
+ this.abort();
2378
+ }
2379
+ abort() {
2380
+ this.done = this.aborted = true;
2381
+ this.fire();
2382
+ this.render();
2383
+ this.out.write("\n");
2384
+ this.close();
2385
+ }
2386
+ submit() {
2387
+ this.value = this.value || false;
2388
+ this.done = true;
2389
+ this.aborted = false;
2390
+ this.fire();
2391
+ this.render();
2392
+ this.out.write("\n");
2393
+ this.close();
2394
+ }
2395
+ _(c, key) {
2396
+ if (c.toLowerCase() === "y") {
2397
+ this.value = true;
2398
+ return this.submit();
2399
+ }
2400
+ if (c.toLowerCase() === "n") {
2401
+ this.value = false;
2402
+ return this.submit();
2403
+ }
2404
+ return this.bell();
2405
+ }
2406
+ render() {
2407
+ if (this.closed) return;
2408
+ if (this.firstRender) this.out.write(cursor.hide);
2409
+ else this.out.write(clear(this.outputText, this.out.columns));
2410
+ super.render();
2411
+ this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.done ? this.value ? this.yesMsg : this.noMsg : color.gray(this.initialValue ? this.yesOption : this.noOption)].join(" ");
2412
+ this.out.write(erase.line + cursor.to(0) + this.outputText);
2413
+ }
2414
+ };
2415
+ module.exports = ConfirmPrompt;
2416
+ }
2417
+ });
2418
+
2419
+ // node_modules/prompts/dist/elements/index.js
2420
+ var require_elements = __commonJS({
2421
+ "node_modules/prompts/dist/elements/index.js"(exports, module) {
2422
+ "use strict";
2423
+ module.exports = {
2424
+ TextPrompt: require_text(),
2425
+ SelectPrompt: require_select(),
2426
+ TogglePrompt: require_toggle(),
2427
+ DatePrompt: require_date(),
2428
+ NumberPrompt: require_number(),
2429
+ MultiselectPrompt: require_multiselect(),
2430
+ AutocompletePrompt: require_autocomplete(),
2431
+ AutocompleteMultiselectPrompt: require_autocompleteMultiselect(),
2432
+ ConfirmPrompt: require_confirm()
2433
+ };
2434
+ }
2435
+ });
2436
+
2437
+ // node_modules/prompts/dist/prompts.js
2438
+ var require_prompts = __commonJS({
2439
+ "node_modules/prompts/dist/prompts.js"(exports) {
2440
+ "use strict";
2441
+ var $ = exports;
2442
+ var el = require_elements();
2443
+ var noop = (v) => v;
2444
+ function toPrompt(type, args2, opts = {}) {
2445
+ return new Promise((res, rej) => {
2446
+ const p = new el[type](args2);
2447
+ const onAbort = opts.onAbort || noop;
2448
+ const onSubmit = opts.onSubmit || noop;
2449
+ const onExit = opts.onExit || noop;
2450
+ p.on("state", args2.onState || noop);
2451
+ p.on("submit", (x) => res(onSubmit(x)));
2452
+ p.on("exit", (x) => res(onExit(x)));
2453
+ p.on("abort", (x) => rej(onAbort(x)));
2454
+ });
2455
+ }
2456
+ $.text = (args2) => toPrompt("TextPrompt", args2);
2457
+ $.password = (args2) => {
2458
+ args2.style = "password";
2459
+ return $.text(args2);
2460
+ };
2461
+ $.invisible = (args2) => {
2462
+ args2.style = "invisible";
2463
+ return $.text(args2);
2464
+ };
2465
+ $.number = (args2) => toPrompt("NumberPrompt", args2);
2466
+ $.date = (args2) => toPrompt("DatePrompt", args2);
2467
+ $.confirm = (args2) => toPrompt("ConfirmPrompt", args2);
2468
+ $.list = (args2) => {
2469
+ const sep = args2.separator || ",";
2470
+ return toPrompt("TextPrompt", args2, {
2471
+ onSubmit: (str) => str.split(sep).map((s) => s.trim())
2472
+ });
2473
+ };
2474
+ $.toggle = (args2) => toPrompt("TogglePrompt", args2);
2475
+ $.select = (args2) => toPrompt("SelectPrompt", args2);
2476
+ $.multiselect = (args2) => {
2477
+ args2.choices = [].concat(args2.choices || []);
2478
+ const toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
2479
+ return toPrompt("MultiselectPrompt", args2, {
2480
+ onAbort: toSelected,
2481
+ onSubmit: toSelected
2482
+ });
2483
+ };
2484
+ $.autocompleteMultiselect = (args2) => {
2485
+ args2.choices = [].concat(args2.choices || []);
2486
+ const toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
2487
+ return toPrompt("AutocompleteMultiselectPrompt", args2, {
2488
+ onAbort: toSelected,
2489
+ onSubmit: toSelected
2490
+ });
2491
+ };
2492
+ var byTitle = (input, choices) => Promise.resolve(choices.filter((item) => item.title.slice(0, input.length).toLowerCase() === input.toLowerCase()));
2493
+ $.autocomplete = (args2) => {
2494
+ args2.suggest = args2.suggest || byTitle;
2495
+ args2.choices = [].concat(args2.choices || []);
2496
+ return toPrompt("AutocompletePrompt", args2);
2497
+ };
2498
+ }
2499
+ });
2500
+
2501
+ // node_modules/prompts/dist/index.js
2502
+ var require_dist = __commonJS({
2503
+ "node_modules/prompts/dist/index.js"(exports, module) {
2504
+ "use strict";
2505
+ function ownKeys(object, enumerableOnly) {
2506
+ var keys = Object.keys(object);
2507
+ if (Object.getOwnPropertySymbols) {
2508
+ var symbols = Object.getOwnPropertySymbols(object);
2509
+ if (enumerableOnly) {
2510
+ symbols = symbols.filter(function(sym) {
2511
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2512
+ });
2513
+ }
2514
+ keys.push.apply(keys, symbols);
2515
+ }
2516
+ return keys;
2517
+ }
2518
+ function _objectSpread(target) {
2519
+ for (var i = 1; i < arguments.length; i++) {
2520
+ var source = arguments[i] != null ? arguments[i] : {};
2521
+ if (i % 2) {
2522
+ ownKeys(Object(source), true).forEach(function(key) {
2523
+ _defineProperty(target, key, source[key]);
2524
+ });
2525
+ } else if (Object.getOwnPropertyDescriptors) {
2526
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2527
+ } else {
2528
+ ownKeys(Object(source)).forEach(function(key) {
2529
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2530
+ });
2531
+ }
2532
+ }
2533
+ return target;
2534
+ }
2535
+ function _defineProperty(obj, key, value) {
2536
+ if (key in obj) {
2537
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
2538
+ } else {
2539
+ obj[key] = value;
2540
+ }
2541
+ return obj;
2542
+ }
2543
+ function _createForOfIteratorHelper(o, allowArrayLike) {
2544
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
2545
+ if (!it) {
2546
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
2547
+ if (it) o = it;
2548
+ var i = 0;
2549
+ var F = function F2() {
2550
+ };
2551
+ return { s: F, n: function n() {
2552
+ if (i >= o.length) return { done: true };
2553
+ return { done: false, value: o[i++] };
2554
+ }, e: function e(_e) {
2555
+ throw _e;
2556
+ }, f: F };
2557
+ }
2558
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2559
+ }
2560
+ var normalCompletion = true, didErr = false, err;
2561
+ return { s: function s() {
2562
+ it = it.call(o);
2563
+ }, n: function n() {
2564
+ var step = it.next();
2565
+ normalCompletion = step.done;
2566
+ return step;
2567
+ }, e: function e(_e2) {
2568
+ didErr = true;
2569
+ err = _e2;
2570
+ }, f: function f() {
2571
+ try {
2572
+ if (!normalCompletion && it.return != null) it.return();
2573
+ } finally {
2574
+ if (didErr) throw err;
2575
+ }
2576
+ } };
2577
+ }
2578
+ function _unsupportedIterableToArray(o, minLen) {
2579
+ if (!o) return;
2580
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
2581
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2582
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2583
+ if (n === "Map" || n === "Set") return Array.from(o);
2584
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
2585
+ }
2586
+ function _arrayLikeToArray(arr, len) {
2587
+ if (len == null || len > arr.length) len = arr.length;
2588
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
2589
+ return arr2;
2590
+ }
2591
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2592
+ try {
2593
+ var info = gen[key](arg);
2594
+ var value = info.value;
2595
+ } catch (error) {
2596
+ reject(error);
2597
+ return;
2598
+ }
2599
+ if (info.done) {
2600
+ resolve(value);
2601
+ } else {
2602
+ Promise.resolve(value).then(_next, _throw);
2603
+ }
2604
+ }
2605
+ function _asyncToGenerator(fn) {
2606
+ return function() {
2607
+ var self = this, args2 = arguments;
2608
+ return new Promise(function(resolve, reject) {
2609
+ var gen = fn.apply(self, args2);
2610
+ function _next(value) {
2611
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
2612
+ }
2613
+ function _throw(err) {
2614
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
2615
+ }
2616
+ _next(void 0);
2617
+ });
2618
+ };
2619
+ }
2620
+ var prompts2 = require_prompts();
2621
+ var passOn = ["suggest", "format", "onState", "validate", "onRender", "type"];
2622
+ var noop = () => {
2623
+ };
2624
+ function prompt() {
2625
+ return _prompt.apply(this, arguments);
2626
+ }
2627
+ function _prompt() {
2628
+ _prompt = _asyncToGenerator(function* (questions = [], {
2629
+ onSubmit = noop,
2630
+ onCancel = noop
2631
+ } = {}) {
2632
+ const answers = {};
2633
+ const override2 = prompt._override || {};
2634
+ questions = [].concat(questions);
2635
+ let answer, question, quit, name, type, lastPrompt;
2636
+ const getFormattedAnswer = /* @__PURE__ */ (function() {
2637
+ var _ref = _asyncToGenerator(function* (question2, answer2, skipValidation = false) {
2638
+ if (!skipValidation && question2.validate && question2.validate(answer2) !== true) {
2639
+ return;
2640
+ }
2641
+ return question2.format ? yield question2.format(answer2, answers) : answer2;
2642
+ });
2643
+ return function getFormattedAnswer2(_x, _x2) {
2644
+ return _ref.apply(this, arguments);
2645
+ };
2646
+ })();
2647
+ var _iterator = _createForOfIteratorHelper(questions), _step;
2648
+ try {
2649
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
2650
+ question = _step.value;
2651
+ var _question = question;
2652
+ name = _question.name;
2653
+ type = _question.type;
2654
+ if (typeof type === "function") {
2655
+ type = yield type(answer, _objectSpread({}, answers), question);
2656
+ question["type"] = type;
2657
+ }
2658
+ if (!type) continue;
2659
+ for (let key in question) {
2660
+ if (passOn.includes(key)) continue;
2661
+ let value = question[key];
2662
+ question[key] = typeof value === "function" ? yield value(answer, _objectSpread({}, answers), lastPrompt) : value;
2663
+ }
2664
+ lastPrompt = question;
2665
+ if (typeof question.message !== "string") {
2666
+ throw new Error("prompt message is required");
2667
+ }
2668
+ var _question2 = question;
2669
+ name = _question2.name;
2670
+ type = _question2.type;
2671
+ if (prompts2[type] === void 0) {
2672
+ throw new Error(`prompt type (${type}) is not defined`);
2673
+ }
2674
+ if (override2[question.name] !== void 0) {
2675
+ answer = yield getFormattedAnswer(question, override2[question.name]);
2676
+ if (answer !== void 0) {
2677
+ answers[name] = answer;
2678
+ continue;
2679
+ }
2680
+ }
2681
+ try {
2682
+ answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : yield prompts2[type](question);
2683
+ answers[name] = answer = yield getFormattedAnswer(question, answer, true);
2684
+ quit = yield onSubmit(question, answer, answers);
2685
+ } catch (err) {
2686
+ quit = !(yield onCancel(question, answers));
2687
+ }
2688
+ if (quit) return answers;
2689
+ }
2690
+ } catch (err) {
2691
+ _iterator.e(err);
2692
+ } finally {
2693
+ _iterator.f();
2694
+ }
2695
+ return answers;
2696
+ });
2697
+ return _prompt.apply(this, arguments);
2698
+ }
2699
+ function getInjectedAnswer(injected, deafultValue) {
2700
+ const answer = injected.shift();
2701
+ if (answer instanceof Error) {
2702
+ throw answer;
2703
+ }
2704
+ return answer === void 0 ? deafultValue : answer;
2705
+ }
2706
+ function inject(answers) {
2707
+ prompt._injected = (prompt._injected || []).concat(answers);
2708
+ }
2709
+ function override(answers) {
2710
+ prompt._override = Object.assign({}, answers);
2711
+ }
2712
+ module.exports = Object.assign(prompt, {
2713
+ prompt,
2714
+ prompts: prompts2,
2715
+ inject,
2716
+ override
2717
+ });
2718
+ }
2719
+ });
2720
+
2721
+ // node_modules/prompts/lib/util/action.js
2722
+ var require_action2 = __commonJS({
2723
+ "node_modules/prompts/lib/util/action.js"(exports, module) {
2724
+ "use strict";
2725
+ module.exports = (key, isSelect) => {
2726
+ if (key.meta && key.name !== "escape") return;
2727
+ if (key.ctrl) {
2728
+ if (key.name === "a") return "first";
2729
+ if (key.name === "c") return "abort";
2730
+ if (key.name === "d") return "abort";
2731
+ if (key.name === "e") return "last";
2732
+ if (key.name === "g") return "reset";
2733
+ }
2734
+ if (isSelect) {
2735
+ if (key.name === "j") return "down";
2736
+ if (key.name === "k") return "up";
2737
+ }
2738
+ if (key.name === "return") return "submit";
2739
+ if (key.name === "enter") return "submit";
2740
+ if (key.name === "backspace") return "delete";
2741
+ if (key.name === "delete") return "deleteForward";
2742
+ if (key.name === "abort") return "abort";
2743
+ if (key.name === "escape") return "exit";
2744
+ if (key.name === "tab") return "next";
2745
+ if (key.name === "pagedown") return "nextPage";
2746
+ if (key.name === "pageup") return "prevPage";
2747
+ if (key.name === "home") return "home";
2748
+ if (key.name === "end") return "end";
2749
+ if (key.name === "up") return "up";
2750
+ if (key.name === "down") return "down";
2751
+ if (key.name === "right") return "right";
2752
+ if (key.name === "left") return "left";
2753
+ return false;
2754
+ };
2755
+ }
2756
+ });
2757
+
2758
+ // node_modules/prompts/lib/util/strip.js
2759
+ var require_strip2 = __commonJS({
2760
+ "node_modules/prompts/lib/util/strip.js"(exports, module) {
2761
+ "use strict";
2762
+ module.exports = (str) => {
2763
+ const pattern = [
2764
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
2765
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
2766
+ ].join("|");
2767
+ const RGX = new RegExp(pattern, "g");
2768
+ return typeof str === "string" ? str.replace(RGX, "") : str;
2769
+ };
2770
+ }
2771
+ });
2772
+
2773
+ // node_modules/prompts/lib/util/clear.js
2774
+ var require_clear2 = __commonJS({
2775
+ "node_modules/prompts/lib/util/clear.js"(exports, module) {
2776
+ "use strict";
2777
+ var strip = require_strip2();
2778
+ var { erase, cursor } = require_src();
2779
+ var width = (str) => [...strip(str)].length;
2780
+ module.exports = function(prompt, perLine) {
2781
+ if (!perLine) return erase.line + cursor.to(0);
2782
+ let rows = 0;
2783
+ const lines = prompt.split(/\r?\n/);
2784
+ for (let line of lines) {
2785
+ rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / perLine);
2786
+ }
2787
+ return erase.lines(rows);
2788
+ };
2789
+ }
2790
+ });
2791
+
2792
+ // node_modules/prompts/lib/util/figures.js
2793
+ var require_figures2 = __commonJS({
2794
+ "node_modules/prompts/lib/util/figures.js"(exports, module) {
2795
+ "use strict";
2796
+ var main2 = {
2797
+ arrowUp: "\u2191",
2798
+ arrowDown: "\u2193",
2799
+ arrowLeft: "\u2190",
2800
+ arrowRight: "\u2192",
2801
+ radioOn: "\u25C9",
2802
+ radioOff: "\u25EF",
2803
+ tick: "\u2714",
2804
+ cross: "\u2716",
2805
+ ellipsis: "\u2026",
2806
+ pointerSmall: "\u203A",
2807
+ line: "\u2500",
2808
+ pointer: "\u276F"
2809
+ };
2810
+ var win = {
2811
+ arrowUp: main2.arrowUp,
2812
+ arrowDown: main2.arrowDown,
2813
+ arrowLeft: main2.arrowLeft,
2814
+ arrowRight: main2.arrowRight,
2815
+ radioOn: "(*)",
2816
+ radioOff: "( )",
2817
+ tick: "\u221A",
2818
+ cross: "\xD7",
2819
+ ellipsis: "...",
2820
+ pointerSmall: "\xBB",
2821
+ line: "\u2500",
2822
+ pointer: ">"
2823
+ };
2824
+ var figures = process.platform === "win32" ? win : main2;
2825
+ module.exports = figures;
2826
+ }
2827
+ });
2828
+
2829
+ // node_modules/prompts/lib/util/style.js
2830
+ var require_style2 = __commonJS({
2831
+ "node_modules/prompts/lib/util/style.js"(exports, module) {
2832
+ "use strict";
2833
+ var c = require_kleur();
2834
+ var figures = require_figures2();
2835
+ var styles = Object.freeze({
2836
+ password: { scale: 1, render: (input) => "*".repeat(input.length) },
2837
+ emoji: { scale: 2, render: (input) => "\u{1F603}".repeat(input.length) },
2838
+ invisible: { scale: 0, render: (input) => "" },
2839
+ default: { scale: 1, render: (input) => `${input}` }
2840
+ });
2841
+ var render = (type) => styles[type] || styles.default;
2842
+ var symbols = Object.freeze({
2843
+ aborted: c.red(figures.cross),
2844
+ done: c.green(figures.tick),
2845
+ exited: c.yellow(figures.cross),
2846
+ default: c.cyan("?")
2847
+ });
2848
+ var symbol = (done, aborted, exited) => aborted ? symbols.aborted : exited ? symbols.exited : done ? symbols.done : symbols.default;
2849
+ var delimiter = (completing) => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
2850
+ var item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : "+" : figures.line);
2851
+ module.exports = {
2852
+ styles,
2853
+ render,
2854
+ symbols,
2855
+ symbol,
2856
+ delimiter,
2857
+ item
2858
+ };
2859
+ }
2860
+ });
2861
+
2862
+ // node_modules/prompts/lib/util/lines.js
2863
+ var require_lines2 = __commonJS({
2864
+ "node_modules/prompts/lib/util/lines.js"(exports, module) {
2865
+ "use strict";
2866
+ var strip = require_strip2();
2867
+ module.exports = function(msg, perLine) {
2868
+ let lines = String(strip(msg) || "").split(/\r?\n/);
2869
+ if (!perLine) return lines.length;
2870
+ return lines.map((l) => Math.ceil(l.length / perLine)).reduce((a, b) => a + b);
2871
+ };
2872
+ }
2873
+ });
2874
+
2875
+ // node_modules/prompts/lib/util/wrap.js
2876
+ var require_wrap2 = __commonJS({
2877
+ "node_modules/prompts/lib/util/wrap.js"(exports, module) {
2878
+ "use strict";
2879
+ module.exports = (msg, opts = {}) => {
2880
+ const tab = Number.isSafeInteger(parseInt(opts.margin)) ? new Array(parseInt(opts.margin)).fill(" ").join("") : opts.margin || "";
2881
+ const width = opts.width;
2882
+ return (msg || "").split(/\r?\n/g).map((line) => line.split(/\s+/g).reduce((arr, w) => {
2883
+ if (w.length + tab.length >= width || arr[arr.length - 1].length + w.length + 1 < width)
2884
+ arr[arr.length - 1] += ` ${w}`;
2885
+ else arr.push(`${tab}${w}`);
2886
+ return arr;
2887
+ }, [tab]).join("\n")).join("\n");
2888
+ };
2889
+ }
2890
+ });
2891
+
2892
+ // node_modules/prompts/lib/util/entriesToDisplay.js
2893
+ var require_entriesToDisplay2 = __commonJS({
2894
+ "node_modules/prompts/lib/util/entriesToDisplay.js"(exports, module) {
2895
+ "use strict";
2896
+ module.exports = (cursor, total, maxVisible) => {
2897
+ maxVisible = maxVisible || total;
2898
+ let startIndex = Math.min(total - maxVisible, cursor - Math.floor(maxVisible / 2));
2899
+ if (startIndex < 0) startIndex = 0;
2900
+ let endIndex = Math.min(startIndex + maxVisible, total);
2901
+ return { startIndex, endIndex };
2902
+ };
2903
+ }
2904
+ });
2905
+
2906
+ // node_modules/prompts/lib/util/index.js
2907
+ var require_util2 = __commonJS({
2908
+ "node_modules/prompts/lib/util/index.js"(exports, module) {
2909
+ "use strict";
2910
+ module.exports = {
2911
+ action: require_action2(),
2912
+ clear: require_clear2(),
2913
+ style: require_style2(),
2914
+ strip: require_strip2(),
2915
+ figures: require_figures2(),
2916
+ lines: require_lines2(),
2917
+ wrap: require_wrap2(),
2918
+ entriesToDisplay: require_entriesToDisplay2()
2919
+ };
2920
+ }
2921
+ });
2922
+
2923
+ // node_modules/prompts/lib/elements/prompt.js
2924
+ var require_prompt2 = __commonJS({
2925
+ "node_modules/prompts/lib/elements/prompt.js"(exports, module) {
2926
+ "use strict";
2927
+ var readline = __require("readline");
2928
+ var { action } = require_util2();
2929
+ var EventEmitter = __require("events");
2930
+ var { beep, cursor } = require_src();
2931
+ var color = require_kleur();
2932
+ var Prompt = class extends EventEmitter {
2933
+ constructor(opts = {}) {
2934
+ super();
2935
+ this.firstRender = true;
2936
+ this.in = opts.stdin || process.stdin;
2937
+ this.out = opts.stdout || process.stdout;
2938
+ this.onRender = (opts.onRender || (() => void 0)).bind(this);
2939
+ const rl = readline.createInterface({ input: this.in, escapeCodeTimeout: 50 });
2940
+ readline.emitKeypressEvents(this.in, rl);
2941
+ if (this.in.isTTY) this.in.setRawMode(true);
2942
+ const isSelect = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1;
2943
+ const keypress = (str, key) => {
2944
+ let a = action(key, isSelect);
2945
+ if (a === false) {
2946
+ this._ && this._(str, key);
2947
+ } else if (typeof this[a] === "function") {
2948
+ this[a](key);
2949
+ } else {
2950
+ this.bell();
2951
+ }
2952
+ };
2953
+ this.close = () => {
2954
+ this.out.write(cursor.show);
2955
+ this.in.removeListener("keypress", keypress);
2956
+ if (this.in.isTTY) this.in.setRawMode(false);
2957
+ rl.close();
2958
+ this.emit(this.aborted ? "abort" : this.exited ? "exit" : "submit", this.value);
2959
+ this.closed = true;
2960
+ };
2961
+ this.in.on("keypress", keypress);
2962
+ }
2963
+ fire() {
2964
+ this.emit("state", {
2965
+ value: this.value,
2966
+ aborted: !!this.aborted,
2967
+ exited: !!this.exited
2968
+ });
2969
+ }
2970
+ bell() {
2971
+ this.out.write(beep);
2972
+ }
2973
+ render() {
2974
+ this.onRender(color);
2975
+ if (this.firstRender) this.firstRender = false;
2976
+ }
2977
+ };
2978
+ module.exports = Prompt;
2979
+ }
2980
+ });
2981
+
2982
+ // node_modules/prompts/lib/elements/text.js
2983
+ var require_text2 = __commonJS({
2984
+ "node_modules/prompts/lib/elements/text.js"(exports, module) {
2985
+ "use strict";
2986
+ var color = require_kleur();
2987
+ var Prompt = require_prompt2();
2988
+ var { erase, cursor } = require_src();
2989
+ var { style, clear, lines, figures } = require_util2();
2990
+ var TextPrompt = class extends Prompt {
2991
+ constructor(opts = {}) {
2992
+ super(opts);
2993
+ this.transform = style.render(opts.style);
2994
+ this.scale = this.transform.scale;
2995
+ this.msg = opts.message;
2996
+ this.initial = opts.initial || ``;
2997
+ this.validator = opts.validate || (() => true);
2998
+ this.value = ``;
2999
+ this.errorMsg = opts.error || `Please Enter A Valid Value`;
3000
+ this.cursor = Number(!!this.initial);
3001
+ this.cursorOffset = 0;
3002
+ this.clear = clear(``, this.out.columns);
3003
+ this.render();
3004
+ }
3005
+ set value(v) {
3006
+ if (!v && this.initial) {
3007
+ this.placeholder = true;
3008
+ this.rendered = color.gray(this.transform.render(this.initial));
3009
+ } else {
3010
+ this.placeholder = false;
3011
+ this.rendered = this.transform.render(v);
3012
+ }
3013
+ this._value = v;
3014
+ this.fire();
3015
+ }
3016
+ get value() {
3017
+ return this._value;
3018
+ }
3019
+ reset() {
3020
+ this.value = ``;
3021
+ this.cursor = Number(!!this.initial);
3022
+ this.cursorOffset = 0;
3023
+ this.fire();
3024
+ this.render();
3025
+ }
3026
+ exit() {
3027
+ this.abort();
3028
+ }
3029
+ abort() {
3030
+ this.value = this.value || this.initial;
3031
+ this.done = this.aborted = true;
3032
+ this.error = false;
3033
+ this.red = false;
3034
+ this.fire();
3035
+ this.render();
3036
+ this.out.write("\n");
3037
+ this.close();
3038
+ }
3039
+ async validate() {
3040
+ let valid = await this.validator(this.value);
3041
+ if (typeof valid === `string`) {
3042
+ this.errorMsg = valid;
3043
+ valid = false;
3044
+ }
3045
+ this.error = !valid;
3046
+ }
3047
+ async submit() {
3048
+ this.value = this.value || this.initial;
3049
+ this.cursorOffset = 0;
3050
+ this.cursor = this.rendered.length;
3051
+ await this.validate();
3052
+ if (this.error) {
3053
+ this.red = true;
3054
+ this.fire();
3055
+ this.render();
3056
+ return;
3057
+ }
3058
+ this.done = true;
3059
+ this.aborted = false;
3060
+ this.fire();
3061
+ this.render();
3062
+ this.out.write("\n");
3063
+ this.close();
3064
+ }
3065
+ next() {
3066
+ if (!this.placeholder) return this.bell();
3067
+ this.value = this.initial;
3068
+ this.cursor = this.rendered.length;
3069
+ this.fire();
3070
+ this.render();
3071
+ }
3072
+ moveCursor(n) {
3073
+ if (this.placeholder) return;
3074
+ this.cursor = this.cursor + n;
3075
+ this.cursorOffset += n;
3076
+ }
3077
+ _(c, key) {
3078
+ let s1 = this.value.slice(0, this.cursor);
3079
+ let s2 = this.value.slice(this.cursor);
3080
+ this.value = `${s1}${c}${s2}`;
3081
+ this.red = false;
3082
+ this.cursor = this.placeholder ? 0 : s1.length + 1;
3083
+ this.render();
3084
+ }
3085
+ delete() {
3086
+ if (this.isCursorAtStart()) return this.bell();
3087
+ let s1 = this.value.slice(0, this.cursor - 1);
3088
+ let s2 = this.value.slice(this.cursor);
3089
+ this.value = `${s1}${s2}`;
3090
+ this.red = false;
3091
+ if (this.isCursorAtStart()) {
3092
+ this.cursorOffset = 0;
3093
+ } else {
3094
+ this.cursorOffset++;
3095
+ this.moveCursor(-1);
3096
+ }
3097
+ this.render();
3098
+ }
3099
+ deleteForward() {
3100
+ if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();
3101
+ let s1 = this.value.slice(0, this.cursor);
3102
+ let s2 = this.value.slice(this.cursor + 1);
3103
+ this.value = `${s1}${s2}`;
3104
+ this.red = false;
3105
+ if (this.isCursorAtEnd()) {
3106
+ this.cursorOffset = 0;
3107
+ } else {
3108
+ this.cursorOffset++;
3109
+ }
3110
+ this.render();
3111
+ }
3112
+ first() {
3113
+ this.cursor = 0;
3114
+ this.render();
3115
+ }
3116
+ last() {
3117
+ this.cursor = this.value.length;
3118
+ this.render();
3119
+ }
3120
+ left() {
3121
+ if (this.cursor <= 0 || this.placeholder) return this.bell();
3122
+ this.moveCursor(-1);
3123
+ this.render();
3124
+ }
3125
+ right() {
3126
+ if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();
3127
+ this.moveCursor(1);
3128
+ this.render();
3129
+ }
3130
+ isCursorAtStart() {
3131
+ return this.cursor === 0 || this.placeholder && this.cursor === 1;
3132
+ }
3133
+ isCursorAtEnd() {
3134
+ return this.cursor === this.rendered.length || this.placeholder && this.cursor === this.rendered.length + 1;
3135
+ }
3136
+ render() {
3137
+ if (this.closed) return;
3138
+ if (!this.firstRender) {
3139
+ if (this.outputError)
3140
+ this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns));
3141
+ this.out.write(clear(this.outputText, this.out.columns));
3142
+ }
3143
+ super.render();
3144
+ this.outputError = "";
3145
+ this.outputText = [
3146
+ style.symbol(this.done, this.aborted),
3147
+ color.bold(this.msg),
3148
+ style.delimiter(this.done),
3149
+ this.red ? color.red(this.rendered) : this.rendered
3150
+ ].join(` `);
3151
+ if (this.error) {
3152
+ this.outputError += this.errorMsg.split(`
3153
+ `).reduce((a, l, i) => a + `
3154
+ ${i ? " " : figures.pointerSmall} ${color.red().italic(l)}`, ``);
3155
+ }
3156
+ this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore + cursor.move(this.cursorOffset, 0));
3157
+ }
3158
+ };
3159
+ module.exports = TextPrompt;
3160
+ }
3161
+ });
3162
+
3163
+ // node_modules/prompts/lib/elements/select.js
3164
+ var require_select2 = __commonJS({
3165
+ "node_modules/prompts/lib/elements/select.js"(exports, module) {
3166
+ "use strict";
3167
+ var color = require_kleur();
3168
+ var Prompt = require_prompt2();
3169
+ var { style, clear, figures, wrap, entriesToDisplay } = require_util2();
3170
+ var { cursor } = require_src();
3171
+ var SelectPrompt = class extends Prompt {
3172
+ constructor(opts = {}) {
3173
+ super(opts);
3174
+ this.msg = opts.message;
3175
+ this.hint = opts.hint || "- Use arrow-keys. Return to submit.";
3176
+ this.warn = opts.warn || "- This option is disabled";
3177
+ this.cursor = opts.initial || 0;
3178
+ this.choices = opts.choices.map((ch, idx) => {
3179
+ if (typeof ch === "string")
3180
+ ch = { title: ch, value: idx };
3181
+ return {
3182
+ title: ch && (ch.title || ch.value || ch),
3183
+ value: ch && (ch.value === void 0 ? idx : ch.value),
3184
+ description: ch && ch.description,
3185
+ selected: ch && ch.selected,
3186
+ disabled: ch && ch.disabled
3187
+ };
3188
+ });
3189
+ this.optionsPerPage = opts.optionsPerPage || 10;
3190
+ this.value = (this.choices[this.cursor] || {}).value;
3191
+ this.clear = clear("", this.out.columns);
3192
+ this.render();
3193
+ }
3194
+ moveCursor(n) {
3195
+ this.cursor = n;
3196
+ this.value = this.choices[n].value;
3197
+ this.fire();
3198
+ }
3199
+ reset() {
3200
+ this.moveCursor(0);
3201
+ this.fire();
3202
+ this.render();
3203
+ }
3204
+ exit() {
3205
+ this.abort();
3206
+ }
3207
+ abort() {
3208
+ this.done = this.aborted = true;
3209
+ this.fire();
3210
+ this.render();
3211
+ this.out.write("\n");
3212
+ this.close();
3213
+ }
3214
+ submit() {
3215
+ if (!this.selection.disabled) {
3216
+ this.done = true;
3217
+ this.aborted = false;
3218
+ this.fire();
3219
+ this.render();
3220
+ this.out.write("\n");
3221
+ this.close();
3222
+ } else
3223
+ this.bell();
3224
+ }
3225
+ first() {
3226
+ this.moveCursor(0);
3227
+ this.render();
3228
+ }
3229
+ last() {
3230
+ this.moveCursor(this.choices.length - 1);
3231
+ this.render();
3232
+ }
3233
+ up() {
3234
+ if (this.cursor === 0) {
3235
+ this.moveCursor(this.choices.length - 1);
3236
+ } else {
3237
+ this.moveCursor(this.cursor - 1);
3238
+ }
3239
+ this.render();
3240
+ }
3241
+ down() {
3242
+ if (this.cursor === this.choices.length - 1) {
3243
+ this.moveCursor(0);
3244
+ } else {
3245
+ this.moveCursor(this.cursor + 1);
3246
+ }
3247
+ this.render();
3248
+ }
3249
+ next() {
3250
+ this.moveCursor((this.cursor + 1) % this.choices.length);
3251
+ this.render();
3252
+ }
3253
+ _(c, key) {
3254
+ if (c === " ") return this.submit();
3255
+ }
3256
+ get selection() {
3257
+ return this.choices[this.cursor];
3258
+ }
3259
+ render() {
3260
+ if (this.closed) return;
3261
+ if (this.firstRender) this.out.write(cursor.hide);
3262
+ else this.out.write(clear(this.outputText, this.out.columns));
3263
+ super.render();
3264
+ let { startIndex, endIndex } = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage);
3265
+ this.outputText = [
3266
+ style.symbol(this.done, this.aborted),
3267
+ color.bold(this.msg),
3268
+ style.delimiter(false),
3269
+ this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)
3270
+ ].join(" ");
3271
+ if (!this.done) {
3272
+ this.outputText += "\n";
3273
+ for (let i = startIndex; i < endIndex; i++) {
3274
+ let title, prefix, desc = "", v = this.choices[i];
3275
+ if (i === startIndex && startIndex > 0) {
3276
+ prefix = figures.arrowUp;
3277
+ } else if (i === endIndex - 1 && endIndex < this.choices.length) {
3278
+ prefix = figures.arrowDown;
3279
+ } else {
3280
+ prefix = " ";
3281
+ }
3282
+ if (v.disabled) {
3283
+ title = this.cursor === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
3284
+ prefix = (this.cursor === i ? color.bold().gray(figures.pointer) + " " : " ") + prefix;
3285
+ } else {
3286
+ title = this.cursor === i ? color.cyan().underline(v.title) : v.title;
3287
+ prefix = (this.cursor === i ? color.cyan(figures.pointer) + " " : " ") + prefix;
3288
+ if (v.description && this.cursor === i) {
3289
+ desc = ` - ${v.description}`;
3290
+ if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
3291
+ desc = "\n" + wrap(v.description, { margin: 3, width: this.out.columns });
3292
+ }
3293
+ }
3294
+ }
3295
+ this.outputText += `${prefix} ${title}${color.gray(desc)}
3296
+ `;
3297
+ }
3298
+ }
3299
+ this.out.write(this.outputText);
3300
+ }
3301
+ };
3302
+ module.exports = SelectPrompt;
3303
+ }
3304
+ });
3305
+
3306
+ // node_modules/prompts/lib/elements/toggle.js
3307
+ var require_toggle2 = __commonJS({
3308
+ "node_modules/prompts/lib/elements/toggle.js"(exports, module) {
3309
+ "use strict";
3310
+ var color = require_kleur();
3311
+ var Prompt = require_prompt2();
3312
+ var { style, clear } = require_util2();
3313
+ var { cursor, erase } = require_src();
3314
+ var TogglePrompt = class extends Prompt {
3315
+ constructor(opts = {}) {
3316
+ super(opts);
3317
+ this.msg = opts.message;
3318
+ this.value = !!opts.initial;
3319
+ this.active = opts.active || "on";
3320
+ this.inactive = opts.inactive || "off";
3321
+ this.initialValue = this.value;
3322
+ this.render();
3323
+ }
3324
+ reset() {
3325
+ this.value = this.initialValue;
3326
+ this.fire();
3327
+ this.render();
3328
+ }
3329
+ exit() {
3330
+ this.abort();
3331
+ }
3332
+ abort() {
3333
+ this.done = this.aborted = true;
3334
+ this.fire();
3335
+ this.render();
3336
+ this.out.write("\n");
3337
+ this.close();
3338
+ }
3339
+ submit() {
3340
+ this.done = true;
3341
+ this.aborted = false;
3342
+ this.fire();
3343
+ this.render();
3344
+ this.out.write("\n");
3345
+ this.close();
3346
+ }
3347
+ deactivate() {
3348
+ if (this.value === false) return this.bell();
3349
+ this.value = false;
3350
+ this.render();
3351
+ }
3352
+ activate() {
3353
+ if (this.value === true) return this.bell();
3354
+ this.value = true;
3355
+ this.render();
3356
+ }
3357
+ delete() {
3358
+ this.deactivate();
3359
+ }
3360
+ left() {
3361
+ this.deactivate();
3362
+ }
3363
+ right() {
3364
+ this.activate();
3365
+ }
3366
+ down() {
3367
+ this.deactivate();
3368
+ }
3369
+ up() {
3370
+ this.activate();
3371
+ }
3372
+ next() {
3373
+ this.value = !this.value;
3374
+ this.fire();
3375
+ this.render();
3376
+ }
3377
+ _(c, key) {
3378
+ if (c === " ") {
3379
+ this.value = !this.value;
3380
+ } else if (c === "1") {
3381
+ this.value = true;
3382
+ } else if (c === "0") {
3383
+ this.value = false;
3384
+ } else return this.bell();
3385
+ this.render();
3386
+ }
3387
+ render() {
3388
+ if (this.closed) return;
3389
+ if (this.firstRender) this.out.write(cursor.hide);
3390
+ else this.out.write(clear(this.outputText, this.out.columns));
3391
+ super.render();
3392
+ this.outputText = [
3393
+ style.symbol(this.done, this.aborted),
3394
+ color.bold(this.msg),
3395
+ style.delimiter(this.done),
3396
+ this.value ? this.inactive : color.cyan().underline(this.inactive),
3397
+ color.gray("/"),
3398
+ this.value ? color.cyan().underline(this.active) : this.active
3399
+ ].join(" ");
3400
+ this.out.write(erase.line + cursor.to(0) + this.outputText);
3401
+ }
3402
+ };
3403
+ module.exports = TogglePrompt;
3404
+ }
3405
+ });
3406
+
3407
+ // node_modules/prompts/lib/dateparts/datepart.js
3408
+ var require_datepart2 = __commonJS({
3409
+ "node_modules/prompts/lib/dateparts/datepart.js"(exports, module) {
3410
+ "use strict";
3411
+ var DatePart = class _DatePart {
3412
+ constructor({ token, date, parts, locales }) {
3413
+ this.token = token;
3414
+ this.date = date || /* @__PURE__ */ new Date();
3415
+ this.parts = parts || [this];
3416
+ this.locales = locales || {};
3417
+ }
3418
+ up() {
3419
+ }
3420
+ down() {
3421
+ }
3422
+ next() {
3423
+ const currentIdx = this.parts.indexOf(this);
3424
+ return this.parts.find((part, idx) => idx > currentIdx && part instanceof _DatePart);
3425
+ }
3426
+ setTo(val) {
3427
+ }
3428
+ prev() {
3429
+ let parts = [].concat(this.parts).reverse();
3430
+ const currentIdx = parts.indexOf(this);
3431
+ return parts.find((part, idx) => idx > currentIdx && part instanceof _DatePart);
3432
+ }
3433
+ toString() {
3434
+ return String(this.date);
3435
+ }
3436
+ };
3437
+ module.exports = DatePart;
3438
+ }
3439
+ });
3440
+
3441
+ // node_modules/prompts/lib/dateparts/meridiem.js
3442
+ var require_meridiem2 = __commonJS({
3443
+ "node_modules/prompts/lib/dateparts/meridiem.js"(exports, module) {
3444
+ "use strict";
3445
+ var DatePart = require_datepart2();
3446
+ var Meridiem = class extends DatePart {
3447
+ constructor(opts = {}) {
3448
+ super(opts);
3449
+ }
3450
+ up() {
3451
+ this.date.setHours((this.date.getHours() + 12) % 24);
3452
+ }
3453
+ down() {
3454
+ this.up();
3455
+ }
3456
+ toString() {
3457
+ let meridiem = this.date.getHours() > 12 ? "pm" : "am";
3458
+ return /\A/.test(this.token) ? meridiem.toUpperCase() : meridiem;
3459
+ }
3460
+ };
3461
+ module.exports = Meridiem;
3462
+ }
3463
+ });
3464
+
3465
+ // node_modules/prompts/lib/dateparts/day.js
3466
+ var require_day2 = __commonJS({
3467
+ "node_modules/prompts/lib/dateparts/day.js"(exports, module) {
3468
+ "use strict";
3469
+ var DatePart = require_datepart2();
3470
+ var pos = (n) => {
3471
+ n = n % 10;
3472
+ return n === 1 ? "st" : n === 2 ? "nd" : n === 3 ? "rd" : "th";
3473
+ };
3474
+ var Day = class extends DatePart {
3475
+ constructor(opts = {}) {
3476
+ super(opts);
3477
+ }
3478
+ up() {
3479
+ this.date.setDate(this.date.getDate() + 1);
3480
+ }
3481
+ down() {
3482
+ this.date.setDate(this.date.getDate() - 1);
3483
+ }
3484
+ setTo(val) {
3485
+ this.date.setDate(parseInt(val.substr(-2)));
3486
+ }
3487
+ toString() {
3488
+ let date = this.date.getDate();
3489
+ let day = this.date.getDay();
3490
+ return this.token === "DD" ? String(date).padStart(2, "0") : this.token === "Do" ? date + pos(date) : this.token === "d" ? day + 1 : this.token === "ddd" ? this.locales.weekdaysShort[day] : this.token === "dddd" ? this.locales.weekdays[day] : date;
3491
+ }
3492
+ };
3493
+ module.exports = Day;
3494
+ }
3495
+ });
3496
+
3497
+ // node_modules/prompts/lib/dateparts/hours.js
3498
+ var require_hours2 = __commonJS({
3499
+ "node_modules/prompts/lib/dateparts/hours.js"(exports, module) {
3500
+ "use strict";
3501
+ var DatePart = require_datepart2();
3502
+ var Hours = class extends DatePart {
3503
+ constructor(opts = {}) {
3504
+ super(opts);
3505
+ }
3506
+ up() {
3507
+ this.date.setHours(this.date.getHours() + 1);
3508
+ }
3509
+ down() {
3510
+ this.date.setHours(this.date.getHours() - 1);
3511
+ }
3512
+ setTo(val) {
3513
+ this.date.setHours(parseInt(val.substr(-2)));
3514
+ }
3515
+ toString() {
3516
+ let hours = this.date.getHours();
3517
+ if (/h/.test(this.token))
3518
+ hours = hours % 12 || 12;
3519
+ return this.token.length > 1 ? String(hours).padStart(2, "0") : hours;
3520
+ }
3521
+ };
3522
+ module.exports = Hours;
3523
+ }
3524
+ });
3525
+
3526
+ // node_modules/prompts/lib/dateparts/milliseconds.js
3527
+ var require_milliseconds2 = __commonJS({
3528
+ "node_modules/prompts/lib/dateparts/milliseconds.js"(exports, module) {
3529
+ "use strict";
3530
+ var DatePart = require_datepart2();
3531
+ var Milliseconds = class extends DatePart {
3532
+ constructor(opts = {}) {
3533
+ super(opts);
3534
+ }
3535
+ up() {
3536
+ this.date.setMilliseconds(this.date.getMilliseconds() + 1);
3537
+ }
3538
+ down() {
3539
+ this.date.setMilliseconds(this.date.getMilliseconds() - 1);
3540
+ }
3541
+ setTo(val) {
3542
+ this.date.setMilliseconds(parseInt(val.substr(-this.token.length)));
3543
+ }
3544
+ toString() {
3545
+ return String(this.date.getMilliseconds()).padStart(4, "0").substr(0, this.token.length);
3546
+ }
3547
+ };
3548
+ module.exports = Milliseconds;
3549
+ }
3550
+ });
3551
+
3552
+ // node_modules/prompts/lib/dateparts/minutes.js
3553
+ var require_minutes2 = __commonJS({
3554
+ "node_modules/prompts/lib/dateparts/minutes.js"(exports, module) {
3555
+ "use strict";
3556
+ var DatePart = require_datepart2();
3557
+ var Minutes = class extends DatePart {
3558
+ constructor(opts = {}) {
3559
+ super(opts);
3560
+ }
3561
+ up() {
3562
+ this.date.setMinutes(this.date.getMinutes() + 1);
3563
+ }
3564
+ down() {
3565
+ this.date.setMinutes(this.date.getMinutes() - 1);
3566
+ }
3567
+ setTo(val) {
3568
+ this.date.setMinutes(parseInt(val.substr(-2)));
3569
+ }
3570
+ toString() {
3571
+ let m = this.date.getMinutes();
3572
+ return this.token.length > 1 ? String(m).padStart(2, "0") : m;
3573
+ }
3574
+ };
3575
+ module.exports = Minutes;
3576
+ }
3577
+ });
3578
+
3579
+ // node_modules/prompts/lib/dateparts/month.js
3580
+ var require_month2 = __commonJS({
3581
+ "node_modules/prompts/lib/dateparts/month.js"(exports, module) {
3582
+ "use strict";
3583
+ var DatePart = require_datepart2();
3584
+ var Month = class extends DatePart {
3585
+ constructor(opts = {}) {
3586
+ super(opts);
3587
+ }
3588
+ up() {
3589
+ this.date.setMonth(this.date.getMonth() + 1);
3590
+ }
3591
+ down() {
3592
+ this.date.setMonth(this.date.getMonth() - 1);
3593
+ }
3594
+ setTo(val) {
3595
+ val = parseInt(val.substr(-2)) - 1;
3596
+ this.date.setMonth(val < 0 ? 0 : val);
3597
+ }
3598
+ toString() {
3599
+ let month = this.date.getMonth();
3600
+ let tl = this.token.length;
3601
+ return tl === 2 ? String(month + 1).padStart(2, "0") : tl === 3 ? this.locales.monthsShort[month] : tl === 4 ? this.locales.months[month] : String(month + 1);
3602
+ }
3603
+ };
3604
+ module.exports = Month;
3605
+ }
3606
+ });
3607
+
3608
+ // node_modules/prompts/lib/dateparts/seconds.js
3609
+ var require_seconds2 = __commonJS({
3610
+ "node_modules/prompts/lib/dateparts/seconds.js"(exports, module) {
3611
+ "use strict";
3612
+ var DatePart = require_datepart2();
3613
+ var Seconds = class extends DatePart {
3614
+ constructor(opts = {}) {
3615
+ super(opts);
3616
+ }
3617
+ up() {
3618
+ this.date.setSeconds(this.date.getSeconds() + 1);
3619
+ }
3620
+ down() {
3621
+ this.date.setSeconds(this.date.getSeconds() - 1);
3622
+ }
3623
+ setTo(val) {
3624
+ this.date.setSeconds(parseInt(val.substr(-2)));
3625
+ }
3626
+ toString() {
3627
+ let s = this.date.getSeconds();
3628
+ return this.token.length > 1 ? String(s).padStart(2, "0") : s;
3629
+ }
3630
+ };
3631
+ module.exports = Seconds;
3632
+ }
3633
+ });
3634
+
3635
+ // node_modules/prompts/lib/dateparts/year.js
3636
+ var require_year2 = __commonJS({
3637
+ "node_modules/prompts/lib/dateparts/year.js"(exports, module) {
3638
+ "use strict";
3639
+ var DatePart = require_datepart2();
3640
+ var Year = class extends DatePart {
3641
+ constructor(opts = {}) {
3642
+ super(opts);
3643
+ }
3644
+ up() {
3645
+ this.date.setFullYear(this.date.getFullYear() + 1);
3646
+ }
3647
+ down() {
3648
+ this.date.setFullYear(this.date.getFullYear() - 1);
3649
+ }
3650
+ setTo(val) {
3651
+ this.date.setFullYear(val.substr(-4));
3652
+ }
3653
+ toString() {
3654
+ let year = String(this.date.getFullYear()).padStart(4, "0");
3655
+ return this.token.length === 2 ? year.substr(-2) : year;
3656
+ }
3657
+ };
3658
+ module.exports = Year;
3659
+ }
3660
+ });
3661
+
3662
+ // node_modules/prompts/lib/dateparts/index.js
3663
+ var require_dateparts2 = __commonJS({
3664
+ "node_modules/prompts/lib/dateparts/index.js"(exports, module) {
3665
+ "use strict";
3666
+ module.exports = {
3667
+ DatePart: require_datepart2(),
3668
+ Meridiem: require_meridiem2(),
3669
+ Day: require_day2(),
3670
+ Hours: require_hours2(),
3671
+ Milliseconds: require_milliseconds2(),
3672
+ Minutes: require_minutes2(),
3673
+ Month: require_month2(),
3674
+ Seconds: require_seconds2(),
3675
+ Year: require_year2()
3676
+ };
3677
+ }
3678
+ });
3679
+
3680
+ // node_modules/prompts/lib/elements/date.js
3681
+ var require_date2 = __commonJS({
3682
+ "node_modules/prompts/lib/elements/date.js"(exports, module) {
3683
+ "use strict";
3684
+ var color = require_kleur();
3685
+ var Prompt = require_prompt2();
3686
+ var { style, clear, figures } = require_util2();
3687
+ var { erase, cursor } = require_src();
3688
+ var { DatePart, Meridiem, Day, Hours, Milliseconds, Minutes, Month, Seconds, Year } = require_dateparts2();
3689
+ var regex = /\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g;
3690
+ var regexGroups = {
3691
+ 1: ({ token }) => token.replace(/\\(.)/g, "$1"),
3692
+ 2: (opts) => new Day(opts),
3693
+ // Day // TODO
3694
+ 3: (opts) => new Month(opts),
3695
+ // Month
3696
+ 4: (opts) => new Year(opts),
3697
+ // Year
3698
+ 5: (opts) => new Meridiem(opts),
3699
+ // AM/PM // TODO (special)
3700
+ 6: (opts) => new Hours(opts),
3701
+ // Hours
3702
+ 7: (opts) => new Minutes(opts),
3703
+ // Minutes
3704
+ 8: (opts) => new Seconds(opts),
3705
+ // Seconds
3706
+ 9: (opts) => new Milliseconds(opts)
3707
+ // Fractional seconds
3708
+ };
3709
+ var dfltLocales = {
3710
+ months: "January,February,March,April,May,June,July,August,September,October,November,December".split(","),
3711
+ monthsShort: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),
3712
+ weekdays: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),
3713
+ weekdaysShort: "Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")
3714
+ };
3715
+ var DatePrompt = class extends Prompt {
3716
+ constructor(opts = {}) {
3717
+ super(opts);
3718
+ this.msg = opts.message;
3719
+ this.cursor = 0;
3720
+ this.typed = "";
3721
+ this.locales = Object.assign(dfltLocales, opts.locales);
3722
+ this._date = opts.initial || /* @__PURE__ */ new Date();
3723
+ this.errorMsg = opts.error || "Please Enter A Valid Value";
3724
+ this.validator = opts.validate || (() => true);
3725
+ this.mask = opts.mask || "YYYY-MM-DD HH:mm:ss";
3726
+ this.clear = clear("", this.out.columns);
3727
+ this.render();
3728
+ }
3729
+ get value() {
3730
+ return this.date;
3731
+ }
3732
+ get date() {
3733
+ return this._date;
3734
+ }
3735
+ set date(date) {
3736
+ if (date) this._date.setTime(date.getTime());
3737
+ }
3738
+ set mask(mask) {
3739
+ let result;
3740
+ this.parts = [];
3741
+ while (result = regex.exec(mask)) {
3742
+ let match = result.shift();
3743
+ let idx = result.findIndex((gr) => gr != null);
3744
+ this.parts.push(idx in regexGroups ? regexGroups[idx]({ token: result[idx] || match, date: this.date, parts: this.parts, locales: this.locales }) : result[idx] || match);
3745
+ }
3746
+ let parts = this.parts.reduce((arr, i) => {
3747
+ if (typeof i === "string" && typeof arr[arr.length - 1] === "string")
3748
+ arr[arr.length - 1] += i;
3749
+ else arr.push(i);
3750
+ return arr;
3751
+ }, []);
3752
+ this.parts.splice(0);
3753
+ this.parts.push(...parts);
3754
+ this.reset();
3755
+ }
3756
+ moveCursor(n) {
3757
+ this.typed = "";
3758
+ this.cursor = n;
3759
+ this.fire();
3760
+ }
3761
+ reset() {
3762
+ this.moveCursor(this.parts.findIndex((p) => p instanceof DatePart));
3763
+ this.fire();
3764
+ this.render();
3765
+ }
3766
+ exit() {
3767
+ this.abort();
3768
+ }
3769
+ abort() {
3770
+ this.done = this.aborted = true;
3771
+ this.error = false;
3772
+ this.fire();
3773
+ this.render();
3774
+ this.out.write("\n");
3775
+ this.close();
3776
+ }
3777
+ async validate() {
3778
+ let valid = await this.validator(this.value);
3779
+ if (typeof valid === "string") {
3780
+ this.errorMsg = valid;
3781
+ valid = false;
3782
+ }
3783
+ this.error = !valid;
3784
+ }
3785
+ async submit() {
3786
+ await this.validate();
3787
+ if (this.error) {
3788
+ this.color = "red";
3789
+ this.fire();
3790
+ this.render();
3791
+ return;
3792
+ }
3793
+ this.done = true;
3794
+ this.aborted = false;
3795
+ this.fire();
3796
+ this.render();
3797
+ this.out.write("\n");
3798
+ this.close();
3799
+ }
3800
+ up() {
3801
+ this.typed = "";
3802
+ this.parts[this.cursor].up();
3803
+ this.render();
3804
+ }
3805
+ down() {
3806
+ this.typed = "";
3807
+ this.parts[this.cursor].down();
3808
+ this.render();
3809
+ }
3810
+ left() {
3811
+ let prev = this.parts[this.cursor].prev();
3812
+ if (prev == null) return this.bell();
3813
+ this.moveCursor(this.parts.indexOf(prev));
3814
+ this.render();
3815
+ }
3816
+ right() {
3817
+ let next = this.parts[this.cursor].next();
3818
+ if (next == null) return this.bell();
3819
+ this.moveCursor(this.parts.indexOf(next));
3820
+ this.render();
3821
+ }
3822
+ next() {
3823
+ let next = this.parts[this.cursor].next();
3824
+ this.moveCursor(next ? this.parts.indexOf(next) : this.parts.findIndex((part) => part instanceof DatePart));
3825
+ this.render();
3826
+ }
3827
+ _(c) {
3828
+ if (/\d/.test(c)) {
3829
+ this.typed += c;
3830
+ this.parts[this.cursor].setTo(this.typed);
3831
+ this.render();
3832
+ }
3833
+ }
3834
+ render() {
3835
+ if (this.closed) return;
3836
+ if (this.firstRender) this.out.write(cursor.hide);
3837
+ else this.out.write(clear(this.outputText, this.out.columns));
3838
+ super.render();
3839
+ this.outputText = [
3840
+ style.symbol(this.done, this.aborted),
3841
+ color.bold(this.msg),
3842
+ style.delimiter(false),
3843
+ this.parts.reduce((arr, p, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p.toString()) : p), []).join("")
3844
+ ].join(" ");
3845
+ if (this.error) {
3846
+ this.outputText += this.errorMsg.split("\n").reduce(
3847
+ (a, l, i) => a + `
3848
+ ${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`,
3849
+ ``
3850
+ );
3851
+ }
3852
+ this.out.write(erase.line + cursor.to(0) + this.outputText);
3853
+ }
3854
+ };
3855
+ module.exports = DatePrompt;
3856
+ }
3857
+ });
3858
+
3859
+ // node_modules/prompts/lib/elements/number.js
3860
+ var require_number2 = __commonJS({
3861
+ "node_modules/prompts/lib/elements/number.js"(exports, module) {
3862
+ "use strict";
3863
+ var color = require_kleur();
3864
+ var Prompt = require_prompt2();
3865
+ var { cursor, erase } = require_src();
3866
+ var { style, figures, clear, lines } = require_util2();
3867
+ var isNumber = /[0-9]/;
3868
+ var isDef = (any) => any !== void 0;
3869
+ var round = (number, precision) => {
3870
+ let factor = Math.pow(10, precision);
3871
+ return Math.round(number * factor) / factor;
3872
+ };
3873
+ var NumberPrompt = class extends Prompt {
3874
+ constructor(opts = {}) {
3875
+ super(opts);
3876
+ this.transform = style.render(opts.style);
3877
+ this.msg = opts.message;
3878
+ this.initial = isDef(opts.initial) ? opts.initial : "";
3879
+ this.float = !!opts.float;
3880
+ this.round = opts.round || 2;
3881
+ this.inc = opts.increment || 1;
3882
+ this.min = isDef(opts.min) ? opts.min : -Infinity;
3883
+ this.max = isDef(opts.max) ? opts.max : Infinity;
3884
+ this.errorMsg = opts.error || `Please Enter A Valid Value`;
3885
+ this.validator = opts.validate || (() => true);
3886
+ this.color = `cyan`;
3887
+ this.value = ``;
3888
+ this.typed = ``;
3889
+ this.lastHit = 0;
3890
+ this.render();
3891
+ }
3892
+ set value(v) {
3893
+ if (!v && v !== 0) {
3894
+ this.placeholder = true;
3895
+ this.rendered = color.gray(this.transform.render(`${this.initial}`));
3896
+ this._value = ``;
3897
+ } else {
3898
+ this.placeholder = false;
3899
+ this.rendered = this.transform.render(`${round(v, this.round)}`);
3900
+ this._value = round(v, this.round);
3901
+ }
3902
+ this.fire();
3903
+ }
3904
+ get value() {
3905
+ return this._value;
3906
+ }
3907
+ parse(x) {
3908
+ return this.float ? parseFloat(x) : parseInt(x);
3909
+ }
3910
+ valid(c) {
3911
+ return c === `-` || c === `.` && this.float || isNumber.test(c);
3912
+ }
3913
+ reset() {
3914
+ this.typed = ``;
3915
+ this.value = ``;
3916
+ this.fire();
3917
+ this.render();
3918
+ }
3919
+ exit() {
3920
+ this.abort();
3921
+ }
3922
+ abort() {
3923
+ let x = this.value;
3924
+ this.value = x !== `` ? x : this.initial;
3925
+ this.done = this.aborted = true;
3926
+ this.error = false;
3927
+ this.fire();
3928
+ this.render();
3929
+ this.out.write(`
3930
+ `);
3931
+ this.close();
3932
+ }
3933
+ async validate() {
3934
+ let valid = await this.validator(this.value);
3935
+ if (typeof valid === `string`) {
3936
+ this.errorMsg = valid;
3937
+ valid = false;
3938
+ }
3939
+ this.error = !valid;
3940
+ }
3941
+ async submit() {
3942
+ await this.validate();
3943
+ if (this.error) {
3944
+ this.color = `red`;
3945
+ this.fire();
3946
+ this.render();
3947
+ return;
3948
+ }
3949
+ let x = this.value;
3950
+ this.value = x !== `` ? x : this.initial;
3951
+ this.done = true;
3952
+ this.aborted = false;
3953
+ this.error = false;
3954
+ this.fire();
3955
+ this.render();
3956
+ this.out.write(`
3957
+ `);
3958
+ this.close();
3959
+ }
3960
+ up() {
3961
+ this.typed = ``;
3962
+ if (this.value === "") {
3963
+ this.value = this.min - this.inc;
3964
+ }
3965
+ if (this.value >= this.max) return this.bell();
3966
+ this.value += this.inc;
3967
+ this.color = `cyan`;
3968
+ this.fire();
3969
+ this.render();
3970
+ }
3971
+ down() {
3972
+ this.typed = ``;
3973
+ if (this.value === "") {
3974
+ this.value = this.min + this.inc;
3975
+ }
3976
+ if (this.value <= this.min) return this.bell();
3977
+ this.value -= this.inc;
3978
+ this.color = `cyan`;
3979
+ this.fire();
3980
+ this.render();
3981
+ }
3982
+ delete() {
3983
+ let val = this.value.toString();
3984
+ if (val.length === 0) return this.bell();
3985
+ this.value = this.parse(val = val.slice(0, -1)) || ``;
3986
+ if (this.value !== "" && this.value < this.min) {
3987
+ this.value = this.min;
3988
+ }
3989
+ this.color = `cyan`;
3990
+ this.fire();
3991
+ this.render();
3992
+ }
3993
+ next() {
3994
+ this.value = this.initial;
3995
+ this.fire();
3996
+ this.render();
3997
+ }
3998
+ _(c, key) {
3999
+ if (!this.valid(c)) return this.bell();
4000
+ const now = Date.now();
4001
+ if (now - this.lastHit > 1e3) this.typed = ``;
4002
+ this.typed += c;
4003
+ this.lastHit = now;
4004
+ this.color = `cyan`;
4005
+ if (c === `.`) return this.fire();
4006
+ this.value = Math.min(this.parse(this.typed), this.max);
4007
+ if (this.value > this.max) this.value = this.max;
4008
+ if (this.value < this.min) this.value = this.min;
4009
+ this.fire();
4010
+ this.render();
4011
+ }
4012
+ render() {
4013
+ if (this.closed) return;
4014
+ if (!this.firstRender) {
4015
+ if (this.outputError)
4016
+ this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns));
4017
+ this.out.write(clear(this.outputText, this.out.columns));
4018
+ }
4019
+ super.render();
4020
+ this.outputError = "";
4021
+ this.outputText = [
4022
+ style.symbol(this.done, this.aborted),
4023
+ color.bold(this.msg),
4024
+ style.delimiter(this.done),
4025
+ !this.done || !this.done && !this.placeholder ? color[this.color]().underline(this.rendered) : this.rendered
4026
+ ].join(` `);
4027
+ if (this.error) {
4028
+ this.outputError += this.errorMsg.split(`
4029
+ `).reduce((a, l, i) => a + `
4030
+ ${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
4031
+ }
4032
+ this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore);
4033
+ }
4034
+ };
4035
+ module.exports = NumberPrompt;
4036
+ }
4037
+ });
4038
+
4039
+ // node_modules/prompts/lib/elements/multiselect.js
4040
+ var require_multiselect2 = __commonJS({
4041
+ "node_modules/prompts/lib/elements/multiselect.js"(exports, module) {
4042
+ "use strict";
4043
+ var color = require_kleur();
4044
+ var { cursor } = require_src();
4045
+ var Prompt = require_prompt2();
4046
+ var { clear, figures, style, wrap, entriesToDisplay } = require_util2();
4047
+ var MultiselectPrompt = class extends Prompt {
4048
+ constructor(opts = {}) {
4049
+ super(opts);
4050
+ this.msg = opts.message;
4051
+ this.cursor = opts.cursor || 0;
4052
+ this.scrollIndex = opts.cursor || 0;
4053
+ this.hint = opts.hint || "";
4054
+ this.warn = opts.warn || "- This option is disabled -";
4055
+ this.minSelected = opts.min;
4056
+ this.showMinError = false;
4057
+ this.maxChoices = opts.max;
4058
+ this.instructions = opts.instructions;
4059
+ this.optionsPerPage = opts.optionsPerPage || 10;
4060
+ this.value = opts.choices.map((ch, idx) => {
4061
+ if (typeof ch === "string")
4062
+ ch = { title: ch, value: idx };
4063
+ return {
4064
+ title: ch && (ch.title || ch.value || ch),
4065
+ description: ch && ch.description,
4066
+ value: ch && (ch.value === void 0 ? idx : ch.value),
4067
+ selected: ch && ch.selected,
4068
+ disabled: ch && ch.disabled
4069
+ };
4070
+ });
4071
+ this.clear = clear("", this.out.columns);
4072
+ if (!opts.overrideRender) {
4073
+ this.render();
4074
+ }
4075
+ }
4076
+ reset() {
4077
+ this.value.map((v) => !v.selected);
4078
+ this.cursor = 0;
4079
+ this.fire();
4080
+ this.render();
4081
+ }
4082
+ selected() {
4083
+ return this.value.filter((v) => v.selected);
4084
+ }
4085
+ exit() {
4086
+ this.abort();
4087
+ }
4088
+ abort() {
4089
+ this.done = this.aborted = true;
4090
+ this.fire();
4091
+ this.render();
4092
+ this.out.write("\n");
4093
+ this.close();
4094
+ }
4095
+ submit() {
4096
+ const selected = this.value.filter((e) => e.selected);
4097
+ if (this.minSelected && selected.length < this.minSelected) {
4098
+ this.showMinError = true;
4099
+ this.render();
4100
+ } else {
4101
+ this.done = true;
4102
+ this.aborted = false;
4103
+ this.fire();
4104
+ this.render();
4105
+ this.out.write("\n");
4106
+ this.close();
4107
+ }
4108
+ }
4109
+ first() {
4110
+ this.cursor = 0;
4111
+ this.render();
4112
+ }
4113
+ last() {
4114
+ this.cursor = this.value.length - 1;
4115
+ this.render();
4116
+ }
4117
+ next() {
4118
+ this.cursor = (this.cursor + 1) % this.value.length;
4119
+ this.render();
4120
+ }
4121
+ up() {
4122
+ if (this.cursor === 0) {
4123
+ this.cursor = this.value.length - 1;
4124
+ } else {
4125
+ this.cursor--;
4126
+ }
4127
+ this.render();
4128
+ }
4129
+ down() {
4130
+ if (this.cursor === this.value.length - 1) {
4131
+ this.cursor = 0;
4132
+ } else {
4133
+ this.cursor++;
4134
+ }
4135
+ this.render();
4136
+ }
4137
+ left() {
4138
+ this.value[this.cursor].selected = false;
4139
+ this.render();
4140
+ }
4141
+ right() {
4142
+ if (this.value.filter((e) => e.selected).length >= this.maxChoices) return this.bell();
4143
+ this.value[this.cursor].selected = true;
4144
+ this.render();
4145
+ }
4146
+ handleSpaceToggle() {
4147
+ const v = this.value[this.cursor];
4148
+ if (v.selected) {
4149
+ v.selected = false;
4150
+ this.render();
4151
+ } else if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) {
4152
+ return this.bell();
4153
+ } else {
4154
+ v.selected = true;
4155
+ this.render();
4156
+ }
4157
+ }
4158
+ toggleAll() {
4159
+ if (this.maxChoices !== void 0 || this.value[this.cursor].disabled) {
4160
+ return this.bell();
4161
+ }
4162
+ const newSelected = !this.value[this.cursor].selected;
4163
+ this.value.filter((v) => !v.disabled).forEach((v) => v.selected = newSelected);
4164
+ this.render();
4165
+ }
4166
+ _(c, key) {
4167
+ if (c === " ") {
4168
+ this.handleSpaceToggle();
4169
+ } else if (c === "a") {
4170
+ this.toggleAll();
4171
+ } else {
4172
+ return this.bell();
4173
+ }
4174
+ }
4175
+ renderInstructions() {
4176
+ if (this.instructions === void 0 || this.instructions) {
4177
+ if (typeof this.instructions === "string") {
4178
+ return this.instructions;
4179
+ }
4180
+ return `
4181
+ Instructions:
4182
+ ${figures.arrowUp}/${figures.arrowDown}: Highlight option
4183
+ ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
4184
+ ` + (this.maxChoices === void 0 ? ` a: Toggle all
4185
+ ` : "") + ` enter/return: Complete answer`;
4186
+ }
4187
+ return "";
4188
+ }
4189
+ renderOption(cursor2, v, i, arrowIndicator) {
4190
+ const prefix = (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + arrowIndicator + " ";
4191
+ let title, desc;
4192
+ if (v.disabled) {
4193
+ title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
4194
+ } else {
4195
+ title = cursor2 === i ? color.cyan().underline(v.title) : v.title;
4196
+ if (cursor2 === i && v.description) {
4197
+ desc = ` - ${v.description}`;
4198
+ if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
4199
+ desc = "\n" + wrap(v.description, { margin: prefix.length, width: this.out.columns });
4200
+ }
4201
+ }
4202
+ }
4203
+ return prefix + title + color.gray(desc || "");
4204
+ }
4205
+ // shared with autocompleteMultiselect
4206
+ paginateOptions(options) {
4207
+ if (options.length === 0) {
4208
+ return color.red("No matches for this query.");
4209
+ }
4210
+ let { startIndex, endIndex } = entriesToDisplay(this.cursor, options.length, this.optionsPerPage);
4211
+ let prefix, styledOptions = [];
4212
+ for (let i = startIndex; i < endIndex; i++) {
4213
+ if (i === startIndex && startIndex > 0) {
4214
+ prefix = figures.arrowUp;
4215
+ } else if (i === endIndex - 1 && endIndex < options.length) {
4216
+ prefix = figures.arrowDown;
4217
+ } else {
4218
+ prefix = " ";
4219
+ }
4220
+ styledOptions.push(this.renderOption(this.cursor, options[i], i, prefix));
4221
+ }
4222
+ return "\n" + styledOptions.join("\n");
4223
+ }
4224
+ // shared with autocomleteMultiselect
4225
+ renderOptions(options) {
4226
+ if (!this.done) {
4227
+ return this.paginateOptions(options);
4228
+ }
4229
+ return "";
4230
+ }
4231
+ renderDoneOrInstructions() {
4232
+ if (this.done) {
4233
+ return this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
4234
+ }
4235
+ const output = [color.gray(this.hint), this.renderInstructions()];
4236
+ if (this.value[this.cursor].disabled) {
4237
+ output.push(color.yellow(this.warn));
4238
+ }
4239
+ return output.join(" ");
4240
+ }
4241
+ render() {
4242
+ if (this.closed) return;
4243
+ if (this.firstRender) this.out.write(cursor.hide);
4244
+ super.render();
4245
+ let prompt = [
4246
+ style.symbol(this.done, this.aborted),
4247
+ color.bold(this.msg),
4248
+ style.delimiter(false),
4249
+ this.renderDoneOrInstructions()
4250
+ ].join(" ");
4251
+ if (this.showMinError) {
4252
+ prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
4253
+ this.showMinError = false;
4254
+ }
4255
+ prompt += this.renderOptions(this.value);
4256
+ this.out.write(this.clear + prompt);
4257
+ this.clear = clear(prompt, this.out.columns);
4258
+ }
4259
+ };
4260
+ module.exports = MultiselectPrompt;
4261
+ }
4262
+ });
4263
+
4264
+ // node_modules/prompts/lib/elements/autocomplete.js
4265
+ var require_autocomplete2 = __commonJS({
4266
+ "node_modules/prompts/lib/elements/autocomplete.js"(exports, module) {
4267
+ "use strict";
4268
+ var color = require_kleur();
4269
+ var Prompt = require_prompt2();
4270
+ var { erase, cursor } = require_src();
4271
+ var { style, clear, figures, wrap, entriesToDisplay } = require_util2();
4272
+ var getVal = (arr, i) => arr[i] && (arr[i].value || arr[i].title || arr[i]);
4273
+ var getTitle = (arr, i) => arr[i] && (arr[i].title || arr[i].value || arr[i]);
4274
+ var getIndex = (arr, valOrTitle) => {
4275
+ const index = arr.findIndex((el) => el.value === valOrTitle || el.title === valOrTitle);
4276
+ return index > -1 ? index : void 0;
4277
+ };
4278
+ var AutocompletePrompt = class extends Prompt {
4279
+ constructor(opts = {}) {
4280
+ super(opts);
4281
+ this.msg = opts.message;
4282
+ this.suggest = opts.suggest;
4283
+ this.choices = opts.choices;
4284
+ this.initial = typeof opts.initial === "number" ? opts.initial : getIndex(opts.choices, opts.initial);
4285
+ this.select = this.initial || opts.cursor || 0;
4286
+ this.i18n = { noMatches: opts.noMatches || "no matches found" };
4287
+ this.fallback = opts.fallback || this.initial;
4288
+ this.clearFirst = opts.clearFirst || false;
4289
+ this.suggestions = [];
4290
+ this.input = "";
4291
+ this.limit = opts.limit || 10;
4292
+ this.cursor = 0;
4293
+ this.transform = style.render(opts.style);
4294
+ this.scale = this.transform.scale;
4295
+ this.render = this.render.bind(this);
4296
+ this.complete = this.complete.bind(this);
4297
+ this.clear = clear("", this.out.columns);
4298
+ this.complete(this.render);
4299
+ this.render();
4300
+ }
4301
+ set fallback(fb) {
4302
+ this._fb = Number.isSafeInteger(parseInt(fb)) ? parseInt(fb) : fb;
4303
+ }
4304
+ get fallback() {
4305
+ let choice;
4306
+ if (typeof this._fb === "number")
4307
+ choice = this.choices[this._fb];
4308
+ else if (typeof this._fb === "string")
4309
+ choice = { title: this._fb };
4310
+ return choice || this._fb || { title: this.i18n.noMatches };
4311
+ }
4312
+ moveSelect(i) {
4313
+ this.select = i;
4314
+ if (this.suggestions.length > 0)
4315
+ this.value = getVal(this.suggestions, i);
4316
+ else this.value = this.fallback.value;
4317
+ this.fire();
4318
+ }
4319
+ async complete(cb) {
4320
+ const p = this.completing = this.suggest(this.input, this.choices);
4321
+ const suggestions = await p;
4322
+ if (this.completing !== p) return;
4323
+ this.suggestions = suggestions.map((s, i, arr) => ({ title: getTitle(arr, i), value: getVal(arr, i), description: s.description }));
4324
+ this.completing = false;
4325
+ const l = Math.max(suggestions.length - 1, 0);
4326
+ this.moveSelect(Math.min(l, this.select));
4327
+ cb && cb();
4328
+ }
4329
+ reset() {
4330
+ this.input = "";
4331
+ this.complete(() => {
4332
+ this.moveSelect(this.initial !== void 0 ? this.initial : 0);
4333
+ this.render();
4334
+ });
4335
+ this.render();
4336
+ }
4337
+ exit() {
4338
+ if (this.clearFirst && this.input.length > 0) {
4339
+ this.reset();
4340
+ } else {
4341
+ this.done = this.exited = true;
4342
+ this.aborted = false;
4343
+ this.fire();
4344
+ this.render();
4345
+ this.out.write("\n");
4346
+ this.close();
4347
+ }
4348
+ }
4349
+ abort() {
4350
+ this.done = this.aborted = true;
4351
+ this.exited = false;
4352
+ this.fire();
4353
+ this.render();
4354
+ this.out.write("\n");
4355
+ this.close();
4356
+ }
4357
+ submit() {
4358
+ this.done = true;
4359
+ this.aborted = this.exited = false;
4360
+ this.fire();
4361
+ this.render();
4362
+ this.out.write("\n");
4363
+ this.close();
4364
+ }
4365
+ _(c, key) {
4366
+ let s1 = this.input.slice(0, this.cursor);
4367
+ let s2 = this.input.slice(this.cursor);
4368
+ this.input = `${s1}${c}${s2}`;
4369
+ this.cursor = s1.length + 1;
4370
+ this.complete(this.render);
4371
+ this.render();
4372
+ }
4373
+ delete() {
4374
+ if (this.cursor === 0) return this.bell();
4375
+ let s1 = this.input.slice(0, this.cursor - 1);
4376
+ let s2 = this.input.slice(this.cursor);
4377
+ this.input = `${s1}${s2}`;
4378
+ this.complete(this.render);
4379
+ this.cursor = this.cursor - 1;
4380
+ this.render();
4381
+ }
4382
+ deleteForward() {
4383
+ if (this.cursor * this.scale >= this.rendered.length) return this.bell();
4384
+ let s1 = this.input.slice(0, this.cursor);
4385
+ let s2 = this.input.slice(this.cursor + 1);
4386
+ this.input = `${s1}${s2}`;
4387
+ this.complete(this.render);
4388
+ this.render();
4389
+ }
4390
+ first() {
4391
+ this.moveSelect(0);
4392
+ this.render();
4393
+ }
4394
+ last() {
4395
+ this.moveSelect(this.suggestions.length - 1);
4396
+ this.render();
4397
+ }
4398
+ up() {
4399
+ if (this.select === 0) {
4400
+ this.moveSelect(this.suggestions.length - 1);
4401
+ } else {
4402
+ this.moveSelect(this.select - 1);
4403
+ }
4404
+ this.render();
4405
+ }
4406
+ down() {
4407
+ if (this.select === this.suggestions.length - 1) {
4408
+ this.moveSelect(0);
4409
+ } else {
4410
+ this.moveSelect(this.select + 1);
4411
+ }
4412
+ this.render();
4413
+ }
4414
+ next() {
4415
+ if (this.select === this.suggestions.length - 1) {
4416
+ this.moveSelect(0);
4417
+ } else this.moveSelect(this.select + 1);
4418
+ this.render();
4419
+ }
4420
+ nextPage() {
4421
+ this.moveSelect(Math.min(this.select + this.limit, this.suggestions.length - 1));
4422
+ this.render();
4423
+ }
4424
+ prevPage() {
4425
+ this.moveSelect(Math.max(this.select - this.limit, 0));
4426
+ this.render();
4427
+ }
4428
+ left() {
4429
+ if (this.cursor <= 0) return this.bell();
4430
+ this.cursor = this.cursor - 1;
4431
+ this.render();
4432
+ }
4433
+ right() {
4434
+ if (this.cursor * this.scale >= this.rendered.length) return this.bell();
4435
+ this.cursor = this.cursor + 1;
4436
+ this.render();
4437
+ }
4438
+ renderOption(v, hovered, isStart, isEnd) {
4439
+ let desc;
4440
+ let prefix = isStart ? figures.arrowUp : isEnd ? figures.arrowDown : " ";
4441
+ let title = hovered ? color.cyan().underline(v.title) : v.title;
4442
+ prefix = (hovered ? color.cyan(figures.pointer) + " " : " ") + prefix;
4443
+ if (v.description) {
4444
+ desc = ` - ${v.description}`;
4445
+ if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
4446
+ desc = "\n" + wrap(v.description, { margin: 3, width: this.out.columns });
4447
+ }
4448
+ }
4449
+ return prefix + " " + title + color.gray(desc || "");
4450
+ }
4451
+ render() {
4452
+ if (this.closed) return;
4453
+ if (this.firstRender) this.out.write(cursor.hide);
4454
+ else this.out.write(clear(this.outputText, this.out.columns));
4455
+ super.render();
4456
+ let { startIndex, endIndex } = entriesToDisplay(this.select, this.choices.length, this.limit);
4457
+ this.outputText = [
4458
+ style.symbol(this.done, this.aborted, this.exited),
4459
+ color.bold(this.msg),
4460
+ style.delimiter(this.completing),
4461
+ this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)
4462
+ ].join(" ");
4463
+ if (!this.done) {
4464
+ const suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(
4465
+ item,
4466
+ this.select === i + startIndex,
4467
+ i === 0 && startIndex > 0,
4468
+ i + startIndex === endIndex - 1 && endIndex < this.choices.length
4469
+ )).join("\n");
4470
+ this.outputText += `
4471
+ ` + (suggestions || color.gray(this.fallback.title));
4472
+ }
4473
+ this.out.write(erase.line + cursor.to(0) + this.outputText);
4474
+ }
4475
+ };
4476
+ module.exports = AutocompletePrompt;
4477
+ }
4478
+ });
4479
+
4480
+ // node_modules/prompts/lib/elements/autocompleteMultiselect.js
4481
+ var require_autocompleteMultiselect2 = __commonJS({
4482
+ "node_modules/prompts/lib/elements/autocompleteMultiselect.js"(exports, module) {
4483
+ "use strict";
4484
+ var color = require_kleur();
4485
+ var { cursor } = require_src();
4486
+ var MultiselectPrompt = require_multiselect2();
4487
+ var { clear, style, figures } = require_util2();
4488
+ var AutocompleteMultiselectPrompt = class extends MultiselectPrompt {
4489
+ constructor(opts = {}) {
4490
+ opts.overrideRender = true;
4491
+ super(opts);
4492
+ this.inputValue = "";
4493
+ this.clear = clear("", this.out.columns);
4494
+ this.filteredOptions = this.value;
4495
+ this.render();
4496
+ }
4497
+ last() {
4498
+ this.cursor = this.filteredOptions.length - 1;
4499
+ this.render();
4500
+ }
4501
+ next() {
4502
+ this.cursor = (this.cursor + 1) % this.filteredOptions.length;
4503
+ this.render();
4504
+ }
4505
+ up() {
4506
+ if (this.cursor === 0) {
4507
+ this.cursor = this.filteredOptions.length - 1;
4508
+ } else {
4509
+ this.cursor--;
4510
+ }
4511
+ this.render();
4512
+ }
4513
+ down() {
4514
+ if (this.cursor === this.filteredOptions.length - 1) {
4515
+ this.cursor = 0;
4516
+ } else {
4517
+ this.cursor++;
4518
+ }
4519
+ this.render();
4520
+ }
4521
+ left() {
4522
+ this.filteredOptions[this.cursor].selected = false;
4523
+ this.render();
4524
+ }
4525
+ right() {
4526
+ if (this.value.filter((e) => e.selected).length >= this.maxChoices) return this.bell();
4527
+ this.filteredOptions[this.cursor].selected = true;
4528
+ this.render();
4529
+ }
4530
+ delete() {
4531
+ if (this.inputValue.length) {
4532
+ this.inputValue = this.inputValue.substr(0, this.inputValue.length - 1);
4533
+ this.updateFilteredOptions();
4534
+ }
4535
+ }
4536
+ updateFilteredOptions() {
4537
+ const currentHighlight = this.filteredOptions[this.cursor];
4538
+ this.filteredOptions = this.value.filter((v) => {
4539
+ if (this.inputValue) {
4540
+ if (typeof v.title === "string") {
4541
+ if (v.title.toLowerCase().includes(this.inputValue.toLowerCase())) {
4542
+ return true;
4543
+ }
4544
+ }
4545
+ if (typeof v.value === "string") {
4546
+ if (v.value.toLowerCase().includes(this.inputValue.toLowerCase())) {
4547
+ return true;
4548
+ }
4549
+ }
4550
+ return false;
4551
+ }
4552
+ return true;
4553
+ });
4554
+ const newHighlightIndex = this.filteredOptions.findIndex((v) => v === currentHighlight);
4555
+ this.cursor = newHighlightIndex < 0 ? 0 : newHighlightIndex;
4556
+ this.render();
4557
+ }
4558
+ handleSpaceToggle() {
4559
+ const v = this.filteredOptions[this.cursor];
4560
+ if (v.selected) {
4561
+ v.selected = false;
4562
+ this.render();
4563
+ } else if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) {
4564
+ return this.bell();
4565
+ } else {
4566
+ v.selected = true;
4567
+ this.render();
4568
+ }
4569
+ }
4570
+ handleInputChange(c) {
4571
+ this.inputValue = this.inputValue + c;
4572
+ this.updateFilteredOptions();
4573
+ }
4574
+ _(c, key) {
4575
+ if (c === " ") {
4576
+ this.handleSpaceToggle();
4577
+ } else {
4578
+ this.handleInputChange(c);
4579
+ }
4580
+ }
4581
+ renderInstructions() {
4582
+ if (this.instructions === void 0 || this.instructions) {
4583
+ if (typeof this.instructions === "string") {
4584
+ return this.instructions;
4585
+ }
4586
+ return `
4587
+ Instructions:
4588
+ ${figures.arrowUp}/${figures.arrowDown}: Highlight option
4589
+ ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
4590
+ [a,b,c]/delete: Filter choices
4591
+ enter/return: Complete answer
4592
+ `;
4593
+ }
4594
+ return "";
4595
+ }
4596
+ renderCurrentInput() {
4597
+ return `
4598
+ Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
4599
+ `;
4600
+ }
4601
+ renderOption(cursor2, v, i) {
4602
+ let title;
4603
+ if (v.disabled) title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
4604
+ else title = cursor2 === i ? color.cyan().underline(v.title) : v.title;
4605
+ return (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + title;
4606
+ }
4607
+ renderDoneOrInstructions() {
4608
+ if (this.done) {
4609
+ return this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
4610
+ }
4611
+ const output = [color.gray(this.hint), this.renderInstructions(), this.renderCurrentInput()];
4612
+ if (this.filteredOptions.length && this.filteredOptions[this.cursor].disabled) {
4613
+ output.push(color.yellow(this.warn));
4614
+ }
4615
+ return output.join(" ");
4616
+ }
4617
+ render() {
4618
+ if (this.closed) return;
4619
+ if (this.firstRender) this.out.write(cursor.hide);
4620
+ super.render();
4621
+ let prompt = [
4622
+ style.symbol(this.done, this.aborted),
4623
+ color.bold(this.msg),
4624
+ style.delimiter(false),
4625
+ this.renderDoneOrInstructions()
4626
+ ].join(" ");
4627
+ if (this.showMinError) {
4628
+ prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
4629
+ this.showMinError = false;
4630
+ }
4631
+ prompt += this.renderOptions(this.filteredOptions);
4632
+ this.out.write(this.clear + prompt);
4633
+ this.clear = clear(prompt, this.out.columns);
4634
+ }
4635
+ };
4636
+ module.exports = AutocompleteMultiselectPrompt;
4637
+ }
4638
+ });
4639
+
4640
+ // node_modules/prompts/lib/elements/confirm.js
4641
+ var require_confirm2 = __commonJS({
4642
+ "node_modules/prompts/lib/elements/confirm.js"(exports, module) {
4643
+ "use strict";
4644
+ var color = require_kleur();
4645
+ var Prompt = require_prompt2();
4646
+ var { style, clear } = require_util2();
4647
+ var { erase, cursor } = require_src();
4648
+ var ConfirmPrompt = class extends Prompt {
4649
+ constructor(opts = {}) {
4650
+ super(opts);
4651
+ this.msg = opts.message;
4652
+ this.value = opts.initial;
4653
+ this.initialValue = !!opts.initial;
4654
+ this.yesMsg = opts.yes || "yes";
4655
+ this.yesOption = opts.yesOption || "(Y/n)";
4656
+ this.noMsg = opts.no || "no";
4657
+ this.noOption = opts.noOption || "(y/N)";
4658
+ this.render();
4659
+ }
4660
+ reset() {
4661
+ this.value = this.initialValue;
4662
+ this.fire();
4663
+ this.render();
4664
+ }
4665
+ exit() {
4666
+ this.abort();
4667
+ }
4668
+ abort() {
4669
+ this.done = this.aborted = true;
4670
+ this.fire();
4671
+ this.render();
4672
+ this.out.write("\n");
4673
+ this.close();
4674
+ }
4675
+ submit() {
4676
+ this.value = this.value || false;
4677
+ this.done = true;
4678
+ this.aborted = false;
4679
+ this.fire();
4680
+ this.render();
4681
+ this.out.write("\n");
4682
+ this.close();
4683
+ }
4684
+ _(c, key) {
4685
+ if (c.toLowerCase() === "y") {
4686
+ this.value = true;
4687
+ return this.submit();
4688
+ }
4689
+ if (c.toLowerCase() === "n") {
4690
+ this.value = false;
4691
+ return this.submit();
4692
+ }
4693
+ return this.bell();
4694
+ }
4695
+ render() {
4696
+ if (this.closed) return;
4697
+ if (this.firstRender) this.out.write(cursor.hide);
4698
+ else this.out.write(clear(this.outputText, this.out.columns));
4699
+ super.render();
4700
+ this.outputText = [
4701
+ style.symbol(this.done, this.aborted),
4702
+ color.bold(this.msg),
4703
+ style.delimiter(this.done),
4704
+ this.done ? this.value ? this.yesMsg : this.noMsg : color.gray(this.initialValue ? this.yesOption : this.noOption)
4705
+ ].join(" ");
4706
+ this.out.write(erase.line + cursor.to(0) + this.outputText);
4707
+ }
4708
+ };
4709
+ module.exports = ConfirmPrompt;
4710
+ }
4711
+ });
4712
+
4713
+ // node_modules/prompts/lib/elements/index.js
4714
+ var require_elements2 = __commonJS({
4715
+ "node_modules/prompts/lib/elements/index.js"(exports, module) {
4716
+ "use strict";
4717
+ module.exports = {
4718
+ TextPrompt: require_text2(),
4719
+ SelectPrompt: require_select2(),
4720
+ TogglePrompt: require_toggle2(),
4721
+ DatePrompt: require_date2(),
4722
+ NumberPrompt: require_number2(),
4723
+ MultiselectPrompt: require_multiselect2(),
4724
+ AutocompletePrompt: require_autocomplete2(),
4725
+ AutocompleteMultiselectPrompt: require_autocompleteMultiselect2(),
4726
+ ConfirmPrompt: require_confirm2()
4727
+ };
4728
+ }
4729
+ });
4730
+
4731
+ // node_modules/prompts/lib/prompts.js
4732
+ var require_prompts2 = __commonJS({
4733
+ "node_modules/prompts/lib/prompts.js"(exports) {
4734
+ "use strict";
4735
+ var $ = exports;
4736
+ var el = require_elements2();
4737
+ var noop = (v) => v;
4738
+ function toPrompt(type, args2, opts = {}) {
4739
+ return new Promise((res, rej) => {
4740
+ const p = new el[type](args2);
4741
+ const onAbort = opts.onAbort || noop;
4742
+ const onSubmit = opts.onSubmit || noop;
4743
+ const onExit = opts.onExit || noop;
4744
+ p.on("state", args2.onState || noop);
4745
+ p.on("submit", (x) => res(onSubmit(x)));
4746
+ p.on("exit", (x) => res(onExit(x)));
4747
+ p.on("abort", (x) => rej(onAbort(x)));
4748
+ });
4749
+ }
4750
+ $.text = (args2) => toPrompt("TextPrompt", args2);
4751
+ $.password = (args2) => {
4752
+ args2.style = "password";
4753
+ return $.text(args2);
4754
+ };
4755
+ $.invisible = (args2) => {
4756
+ args2.style = "invisible";
4757
+ return $.text(args2);
4758
+ };
4759
+ $.number = (args2) => toPrompt("NumberPrompt", args2);
4760
+ $.date = (args2) => toPrompt("DatePrompt", args2);
4761
+ $.confirm = (args2) => toPrompt("ConfirmPrompt", args2);
4762
+ $.list = (args2) => {
4763
+ const sep = args2.separator || ",";
4764
+ return toPrompt("TextPrompt", args2, {
4765
+ onSubmit: (str) => str.split(sep).map((s) => s.trim())
4766
+ });
4767
+ };
4768
+ $.toggle = (args2) => toPrompt("TogglePrompt", args2);
4769
+ $.select = (args2) => toPrompt("SelectPrompt", args2);
4770
+ $.multiselect = (args2) => {
4771
+ args2.choices = [].concat(args2.choices || []);
4772
+ const toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
4773
+ return toPrompt("MultiselectPrompt", args2, {
4774
+ onAbort: toSelected,
4775
+ onSubmit: toSelected
4776
+ });
4777
+ };
4778
+ $.autocompleteMultiselect = (args2) => {
4779
+ args2.choices = [].concat(args2.choices || []);
4780
+ const toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
4781
+ return toPrompt("AutocompleteMultiselectPrompt", args2, {
4782
+ onAbort: toSelected,
4783
+ onSubmit: toSelected
4784
+ });
4785
+ };
4786
+ var byTitle = (input, choices) => Promise.resolve(
4787
+ choices.filter((item) => item.title.slice(0, input.length).toLowerCase() === input.toLowerCase())
4788
+ );
4789
+ $.autocomplete = (args2) => {
4790
+ args2.suggest = args2.suggest || byTitle;
4791
+ args2.choices = [].concat(args2.choices || []);
4792
+ return toPrompt("AutocompletePrompt", args2);
4793
+ };
4794
+ }
4795
+ });
4796
+
4797
+ // node_modules/prompts/lib/index.js
4798
+ var require_lib = __commonJS({
4799
+ "node_modules/prompts/lib/index.js"(exports, module) {
4800
+ "use strict";
4801
+ var prompts2 = require_prompts2();
4802
+ var passOn = ["suggest", "format", "onState", "validate", "onRender", "type"];
4803
+ var noop = () => {
4804
+ };
4805
+ async function prompt(questions = [], { onSubmit = noop, onCancel = noop } = {}) {
4806
+ const answers = {};
4807
+ const override2 = prompt._override || {};
4808
+ questions = [].concat(questions);
4809
+ let answer, question, quit, name, type, lastPrompt;
4810
+ const getFormattedAnswer = async (question2, answer2, skipValidation = false) => {
4811
+ if (!skipValidation && question2.validate && question2.validate(answer2) !== true) {
4812
+ return;
4813
+ }
4814
+ return question2.format ? await question2.format(answer2, answers) : answer2;
4815
+ };
4816
+ for (question of questions) {
4817
+ ({ name, type } = question);
4818
+ if (typeof type === "function") {
4819
+ type = await type(answer, { ...answers }, question);
4820
+ question["type"] = type;
4821
+ }
4822
+ if (!type) continue;
4823
+ for (let key in question) {
4824
+ if (passOn.includes(key)) continue;
4825
+ let value = question[key];
4826
+ question[key] = typeof value === "function" ? await value(answer, { ...answers }, lastPrompt) : value;
4827
+ }
4828
+ lastPrompt = question;
4829
+ if (typeof question.message !== "string") {
4830
+ throw new Error("prompt message is required");
4831
+ }
4832
+ ({ name, type } = question);
4833
+ if (prompts2[type] === void 0) {
4834
+ throw new Error(`prompt type (${type}) is not defined`);
4835
+ }
4836
+ if (override2[question.name] !== void 0) {
4837
+ answer = await getFormattedAnswer(question, override2[question.name]);
4838
+ if (answer !== void 0) {
4839
+ answers[name] = answer;
4840
+ continue;
4841
+ }
4842
+ }
4843
+ try {
4844
+ answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : await prompts2[type](question);
4845
+ answers[name] = answer = await getFormattedAnswer(question, answer, true);
4846
+ quit = await onSubmit(question, answer, answers);
4847
+ } catch (err) {
4848
+ quit = !await onCancel(question, answers);
4849
+ }
4850
+ if (quit) return answers;
4851
+ }
4852
+ return answers;
4853
+ }
4854
+ function getInjectedAnswer(injected, deafultValue) {
4855
+ const answer = injected.shift();
4856
+ if (answer instanceof Error) {
4857
+ throw answer;
4858
+ }
4859
+ return answer === void 0 ? deafultValue : answer;
4860
+ }
4861
+ function inject(answers) {
4862
+ prompt._injected = (prompt._injected || []).concat(answers);
4863
+ }
4864
+ function override(answers) {
4865
+ prompt._override = Object.assign({}, answers);
4866
+ }
4867
+ module.exports = Object.assign(prompt, { prompt, prompts: prompts2, inject, override });
4868
+ }
4869
+ });
4870
+
4871
+ // node_modules/prompts/index.js
4872
+ var require_prompts3 = __commonJS({
4873
+ "node_modules/prompts/index.js"(exports, module) {
4874
+ "use strict";
4875
+ function isNodeLT(tar) {
4876
+ tar = (Array.isArray(tar) ? tar : tar.split(".")).map(Number);
4877
+ let i = 0, src = process.versions.node.split(".").map(Number);
4878
+ for (; i < tar.length; i++) {
4879
+ if (src[i] > tar[i]) return false;
4880
+ if (tar[i] > src[i]) return true;
4881
+ }
4882
+ return false;
4883
+ }
4884
+ module.exports = isNodeLT("8.6.0") ? require_dist() : require_lib();
4885
+ }
4886
+ });
4887
+
4888
+ // node_modules/picocolors/picocolors.js
4889
+ var require_picocolors = __commonJS({
4890
+ "node_modules/picocolors/picocolors.js"(exports, module) {
4891
+ "use strict";
4892
+ var p = process || {};
4893
+ var argv = p.argv || [];
4894
+ var env = p.env || {};
4895
+ var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
4896
+ var formatter = (open, close, replace = open) => (input) => {
4897
+ let string = "" + input, index = string.indexOf(close, open.length);
4898
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
4899
+ };
4900
+ var replaceClose = (string, close, replace, index) => {
4901
+ let result = "", cursor = 0;
4902
+ do {
4903
+ result += string.substring(cursor, index) + replace;
4904
+ cursor = index + close.length;
4905
+ index = string.indexOf(close, cursor);
4906
+ } while (~index);
4907
+ return result + string.substring(cursor);
4908
+ };
4909
+ var createColors = (enabled = isColorSupported) => {
4910
+ let f = enabled ? formatter : () => String;
4911
+ return {
4912
+ isColorSupported: enabled,
4913
+ reset: f("\x1B[0m", "\x1B[0m"),
4914
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
4915
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
4916
+ italic: f("\x1B[3m", "\x1B[23m"),
4917
+ underline: f("\x1B[4m", "\x1B[24m"),
4918
+ inverse: f("\x1B[7m", "\x1B[27m"),
4919
+ hidden: f("\x1B[8m", "\x1B[28m"),
4920
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
4921
+ black: f("\x1B[30m", "\x1B[39m"),
4922
+ red: f("\x1B[31m", "\x1B[39m"),
4923
+ green: f("\x1B[32m", "\x1B[39m"),
4924
+ yellow: f("\x1B[33m", "\x1B[39m"),
4925
+ blue: f("\x1B[34m", "\x1B[39m"),
4926
+ magenta: f("\x1B[35m", "\x1B[39m"),
4927
+ cyan: f("\x1B[36m", "\x1B[39m"),
4928
+ white: f("\x1B[37m", "\x1B[39m"),
4929
+ gray: f("\x1B[90m", "\x1B[39m"),
4930
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
4931
+ bgRed: f("\x1B[41m", "\x1B[49m"),
4932
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
4933
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
4934
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
4935
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
4936
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
4937
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
4938
+ blackBright: f("\x1B[90m", "\x1B[39m"),
4939
+ redBright: f("\x1B[91m", "\x1B[39m"),
4940
+ greenBright: f("\x1B[92m", "\x1B[39m"),
4941
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
4942
+ blueBright: f("\x1B[94m", "\x1B[39m"),
4943
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
4944
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
4945
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
4946
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
4947
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
4948
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
4949
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
4950
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
4951
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
4952
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
4953
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
4954
+ };
4955
+ };
4956
+ module.exports = createColors();
4957
+ module.exports.createColors = createColors;
4958
+ }
4959
+ });
4960
+
1
4961
  // src/index.ts
2
- import prompts from "prompts";
3
- import pc from "picocolors";
4962
+ var import_prompts = __toESM(require_prompts3(), 1);
4963
+ var import_picocolors = __toESM(require_picocolors(), 1);
4
4964
  import ora from "ora";
5
4965
  import fs from "fs";
6
4966
  import path from "path";
7
- console.log(pc.bgMagenta(pc.black(" DOMIS CLI ")), pc.magenta("v0.1.0 - Acelere seu Angular + Firebase\n"));
4967
+ console.log(import_picocolors.default.bgMagenta(import_picocolors.default.black(" DOMIS CLI ")), import_picocolors.default.magenta("v0.1.0 - Acelere seu Angular + Firebase\n"));
8
4968
  var args = process.argv.slice(2);
9
4969
  if (args.includes("--help") || args.includes("-h")) {
10
4970
  console.log(
@@ -25,7 +4985,7 @@ async function main() {
25
4985
  let proKey = hasKeyArg;
26
4986
  let projectName = "meu-app-domis";
27
4987
  if (!template) {
28
- const res = await prompts([
4988
+ const res = await (0, import_prompts.default)([
29
4989
  { type: "select", name: "template", message: "Qual pack?", choices: [
30
4990
  { title: "\u{1F525} Domflix LITE", value: "domflix-firebase-lite" },
31
4991
  { title: "\u{1F680} Domflix PRO", value: "domflix-firebase-pro" }
@@ -43,10 +5003,10 @@ async function main() {
43
5003
  await scaffold(template, cliProjectName, proKey);
44
5004
  }
45
5005
  async function scaffold(template, projectName, proKey) {
46
- const spinner = ora(`Baixando ${pc.cyan(template)}...`).start();
5006
+ const spinner = ora(`Baixando ${import_picocolors.default.cyan(template)}...`).start();
47
5007
  try {
48
5008
  if (template.includes("pro") && (!proKey || proKey.length < 5)) {
49
- spinner.fail(pc.red("Precisa de PRO_KEY"));
5009
+ spinner.fail(import_picocolors.default.red("Precisa de PRO_KEY"));
50
5010
  process.exit(1);
51
5011
  }
52
5012
  const localTemplatePath = path.resolve(process.cwd(), "templates", template);
@@ -57,13 +5017,13 @@ async function scaffold(template, projectName, proKey) {
57
5017
  fs.mkdirSync(projectName, { recursive: true });
58
5018
  fs.writeFileSync(path.join(projectName, "firebase.json"), JSON.stringify({ hosting: { public: "dist/seu-projeto/browser", rewrites: [{ source: "**", destination: "/index.html" }] } }, null, 2));
59
5019
  }
60
- spinner.succeed(pc.green(`Template ${template} em./${projectName}`));
5020
+ spinner.succeed(import_picocolors.default.green(`Template ${template} em./${projectName}`));
61
5021
  console.log(`
62
5022
  cd ${projectName}
63
5023
  npm install
64
5024
  firebase deploy`);
65
5025
  } catch (e) {
66
- spinner.fail(pc.red("Falha"));
5026
+ spinner.fail(import_picocolors.default.red("Falha"));
67
5027
  console.error(e.message);
68
5028
  }
69
5029
  }