@rindo/core 4.17.0 → 4.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli/index.js CHANGED
@@ -1,11 +1,2433 @@
1
1
  /*!
2
- Rindo CLI v4.17.0 | MIT Licensed | https://rindojs.web.app
2
+ Rindo CLI v4.17.2 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
+ var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
11
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
12
+ }) : x)(function(x) {
13
+ if (typeof require !== "undefined")
14
+ return require.apply(this, arguments);
15
+ throw Error('Dynamic require of "' + x + '" is not supported');
16
+ });
17
+ var __commonJS = (cb, mod) => function __require2() {
18
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
19
+ };
5
20
  var __export = (target, all) => {
6
21
  for (var name in all)
7
22
  __defProp(target, name, { get: all[name], enumerable: true });
8
23
  };
24
+ var __copyProps = (to, from, except, desc) => {
25
+ if (from && typeof from === "object" || typeof from === "function") {
26
+ for (let key of __getOwnPropNames(from))
27
+ if (!__hasOwnProp.call(to, key) && key !== except)
28
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29
+ }
30
+ return to;
31
+ };
32
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
33
+ // If the importer is in node compatibility mode or this is not an ESM
34
+ // file that has been converted to a CommonJS file using a Babel-
35
+ // compatible transform (i.e. "__esModule" has not been set), then set
36
+ // "default" to the CommonJS "module.exports" for node compatibility.
37
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
38
+ mod
39
+ ));
40
+
41
+ // node_modules/kleur/index.js
42
+ var require_kleur = __commonJS({
43
+ "node_modules/kleur/index.js"(exports, module) {
44
+ "use strict";
45
+ var { FORCE_COLOR, NODE_DISABLE_COLORS, TERM } = process.env;
46
+ var $ = {
47
+ enabled: !NODE_DISABLE_COLORS && TERM !== "dumb" && FORCE_COLOR !== "0",
48
+ // modifiers
49
+ reset: init(0, 0),
50
+ bold: init(1, 22),
51
+ dim: init(2, 22),
52
+ italic: init(3, 23),
53
+ underline: init(4, 24),
54
+ inverse: init(7, 27),
55
+ hidden: init(8, 28),
56
+ strikethrough: init(9, 29),
57
+ // colors
58
+ black: init(30, 39),
59
+ red: init(31, 39),
60
+ green: init(32, 39),
61
+ yellow: init(33, 39),
62
+ blue: init(34, 39),
63
+ magenta: init(35, 39),
64
+ cyan: init(36, 39),
65
+ white: init(37, 39),
66
+ gray: init(90, 39),
67
+ grey: init(90, 39),
68
+ // background colors
69
+ bgBlack: init(40, 49),
70
+ bgRed: init(41, 49),
71
+ bgGreen: init(42, 49),
72
+ bgYellow: init(43, 49),
73
+ bgBlue: init(44, 49),
74
+ bgMagenta: init(45, 49),
75
+ bgCyan: init(46, 49),
76
+ bgWhite: init(47, 49)
77
+ };
78
+ function run2(arr, str) {
79
+ let i = 0, tmp, beg = "", end = "";
80
+ for (; i < arr.length; i++) {
81
+ tmp = arr[i];
82
+ beg += tmp.open;
83
+ end += tmp.close;
84
+ if (str.includes(tmp.close)) {
85
+ str = str.replace(tmp.rgx, tmp.close + tmp.open);
86
+ }
87
+ }
88
+ return beg + str + end;
89
+ }
90
+ function chain(has, keys) {
91
+ let ctx = { has, keys };
92
+ ctx.reset = $.reset.bind(ctx);
93
+ ctx.bold = $.bold.bind(ctx);
94
+ ctx.dim = $.dim.bind(ctx);
95
+ ctx.italic = $.italic.bind(ctx);
96
+ ctx.underline = $.underline.bind(ctx);
97
+ ctx.inverse = $.inverse.bind(ctx);
98
+ ctx.hidden = $.hidden.bind(ctx);
99
+ ctx.strikethrough = $.strikethrough.bind(ctx);
100
+ ctx.black = $.black.bind(ctx);
101
+ ctx.red = $.red.bind(ctx);
102
+ ctx.green = $.green.bind(ctx);
103
+ ctx.yellow = $.yellow.bind(ctx);
104
+ ctx.blue = $.blue.bind(ctx);
105
+ ctx.magenta = $.magenta.bind(ctx);
106
+ ctx.cyan = $.cyan.bind(ctx);
107
+ ctx.white = $.white.bind(ctx);
108
+ ctx.gray = $.gray.bind(ctx);
109
+ ctx.grey = $.grey.bind(ctx);
110
+ ctx.bgBlack = $.bgBlack.bind(ctx);
111
+ ctx.bgRed = $.bgRed.bind(ctx);
112
+ ctx.bgGreen = $.bgGreen.bind(ctx);
113
+ ctx.bgYellow = $.bgYellow.bind(ctx);
114
+ ctx.bgBlue = $.bgBlue.bind(ctx);
115
+ ctx.bgMagenta = $.bgMagenta.bind(ctx);
116
+ ctx.bgCyan = $.bgCyan.bind(ctx);
117
+ ctx.bgWhite = $.bgWhite.bind(ctx);
118
+ return ctx;
119
+ }
120
+ function init(open, close) {
121
+ let blk = {
122
+ open: `\x1B[${open}m`,
123
+ close: `\x1B[${close}m`,
124
+ rgx: new RegExp(`\\x1b\\[${close}m`, "g")
125
+ };
126
+ return function(txt) {
127
+ if (this !== void 0 && this.has !== void 0) {
128
+ this.has.includes(open) || (this.has.push(open), this.keys.push(blk));
129
+ return txt === void 0 ? this : $.enabled ? run2(this.keys, txt + "") : txt + "";
130
+ }
131
+ return txt === void 0 ? chain([open], [blk]) : $.enabled ? run2([blk], txt + "") : txt + "";
132
+ };
133
+ }
134
+ module.exports = $;
135
+ }
136
+ });
137
+
138
+ // node_modules/prompts/lib/util/action.js
139
+ var require_action = __commonJS({
140
+ "node_modules/prompts/lib/util/action.js"(exports, module) {
141
+ "use strict";
142
+ module.exports = (key, isSelect) => {
143
+ if (key.meta && key.name !== "escape")
144
+ return;
145
+ if (key.ctrl) {
146
+ if (key.name === "a")
147
+ return "first";
148
+ if (key.name === "c")
149
+ return "abort";
150
+ if (key.name === "d")
151
+ return "abort";
152
+ if (key.name === "e")
153
+ return "last";
154
+ if (key.name === "g")
155
+ return "reset";
156
+ }
157
+ if (isSelect) {
158
+ if (key.name === "j")
159
+ return "down";
160
+ if (key.name === "k")
161
+ return "up";
162
+ }
163
+ if (key.name === "return")
164
+ return "submit";
165
+ if (key.name === "enter")
166
+ return "submit";
167
+ if (key.name === "backspace")
168
+ return "delete";
169
+ if (key.name === "delete")
170
+ return "deleteForward";
171
+ if (key.name === "abort")
172
+ return "abort";
173
+ if (key.name === "escape")
174
+ return "exit";
175
+ if (key.name === "tab")
176
+ return "next";
177
+ if (key.name === "pagedown")
178
+ return "nextPage";
179
+ if (key.name === "pageup")
180
+ return "prevPage";
181
+ if (key.name === "home")
182
+ return "home";
183
+ if (key.name === "end")
184
+ return "end";
185
+ if (key.name === "up")
186
+ return "up";
187
+ if (key.name === "down")
188
+ return "down";
189
+ if (key.name === "right")
190
+ return "right";
191
+ if (key.name === "left")
192
+ return "left";
193
+ return false;
194
+ };
195
+ }
196
+ });
197
+
198
+ // node_modules/prompts/lib/util/strip.js
199
+ var require_strip = __commonJS({
200
+ "node_modules/prompts/lib/util/strip.js"(exports, module) {
201
+ "use strict";
202
+ module.exports = (str) => {
203
+ const pattern = [
204
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
205
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
206
+ ].join("|");
207
+ const RGX = new RegExp(pattern, "g");
208
+ return typeof str === "string" ? str.replace(RGX, "") : str;
209
+ };
210
+ }
211
+ });
212
+
213
+ // node_modules/sisteransi/src/index.js
214
+ var require_src = __commonJS({
215
+ "node_modules/sisteransi/src/index.js"(exports, module) {
216
+ "use strict";
217
+ var ESC = "\x1B";
218
+ var CSI = `${ESC}[`;
219
+ var beep = "\x07";
220
+ var cursor = {
221
+ to(x, y) {
222
+ if (!y)
223
+ return `${CSI}${x + 1}G`;
224
+ return `${CSI}${y + 1};${x + 1}H`;
225
+ },
226
+ move(x, y) {
227
+ let ret = "";
228
+ if (x < 0)
229
+ ret += `${CSI}${-x}D`;
230
+ else if (x > 0)
231
+ ret += `${CSI}${x}C`;
232
+ if (y < 0)
233
+ ret += `${CSI}${-y}A`;
234
+ else if (y > 0)
235
+ ret += `${CSI}${y}B`;
236
+ return ret;
237
+ },
238
+ up: (count = 1) => `${CSI}${count}A`,
239
+ down: (count = 1) => `${CSI}${count}B`,
240
+ forward: (count = 1) => `${CSI}${count}C`,
241
+ backward: (count = 1) => `${CSI}${count}D`,
242
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
243
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
244
+ left: `${CSI}G`,
245
+ hide: `${CSI}?25l`,
246
+ show: `${CSI}?25h`,
247
+ save: `${ESC}7`,
248
+ restore: `${ESC}8`
249
+ };
250
+ var scroll = {
251
+ up: (count = 1) => `${CSI}S`.repeat(count),
252
+ down: (count = 1) => `${CSI}T`.repeat(count)
253
+ };
254
+ var erase = {
255
+ screen: `${CSI}2J`,
256
+ up: (count = 1) => `${CSI}1J`.repeat(count),
257
+ down: (count = 1) => `${CSI}J`.repeat(count),
258
+ line: `${CSI}2K`,
259
+ lineEnd: `${CSI}K`,
260
+ lineStart: `${CSI}1K`,
261
+ lines(count) {
262
+ let clear = "";
263
+ for (let i = 0; i < count; i++)
264
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
265
+ if (count)
266
+ clear += cursor.left;
267
+ return clear;
268
+ }
269
+ };
270
+ module.exports = { cursor, scroll, erase, beep };
271
+ }
272
+ });
273
+
274
+ // node_modules/prompts/lib/util/clear.js
275
+ var require_clear = __commonJS({
276
+ "node_modules/prompts/lib/util/clear.js"(exports, module) {
277
+ "use strict";
278
+ var strip = require_strip();
279
+ var { erase, cursor } = require_src();
280
+ var width = (str) => [...strip(str)].length;
281
+ module.exports = function(prompt, perLine) {
282
+ if (!perLine)
283
+ return erase.line + cursor.to(0);
284
+ let rows = 0;
285
+ const lines = prompt.split(/\r?\n/);
286
+ for (let line of lines) {
287
+ rows += 1 + Math.floor(Math.max(width(line) - 1, 0) / perLine);
288
+ }
289
+ return erase.lines(rows);
290
+ };
291
+ }
292
+ });
293
+
294
+ // node_modules/prompts/lib/util/figures.js
295
+ var require_figures = __commonJS({
296
+ "node_modules/prompts/lib/util/figures.js"(exports, module) {
297
+ "use strict";
298
+ var main = {
299
+ arrowUp: "\u2191",
300
+ arrowDown: "\u2193",
301
+ arrowLeft: "\u2190",
302
+ arrowRight: "\u2192",
303
+ radioOn: "\u25C9",
304
+ radioOff: "\u25EF",
305
+ tick: "\u2714",
306
+ cross: "\u2716",
307
+ ellipsis: "\u2026",
308
+ pointerSmall: "\u203A",
309
+ line: "\u2500",
310
+ pointer: "\u276F"
311
+ };
312
+ var win = {
313
+ arrowUp: main.arrowUp,
314
+ arrowDown: main.arrowDown,
315
+ arrowLeft: main.arrowLeft,
316
+ arrowRight: main.arrowRight,
317
+ radioOn: "(*)",
318
+ radioOff: "( )",
319
+ tick: "\u221A",
320
+ cross: "\xD7",
321
+ ellipsis: "...",
322
+ pointerSmall: "\xBB",
323
+ line: "\u2500",
324
+ pointer: ">"
325
+ };
326
+ var figures = process.platform === "win32" ? win : main;
327
+ module.exports = figures;
328
+ }
329
+ });
330
+
331
+ // node_modules/prompts/lib/util/style.js
332
+ var require_style = __commonJS({
333
+ "node_modules/prompts/lib/util/style.js"(exports, module) {
334
+ "use strict";
335
+ var c = require_kleur();
336
+ var figures = require_figures();
337
+ var styles = Object.freeze({
338
+ password: { scale: 1, render: (input) => "*".repeat(input.length) },
339
+ emoji: { scale: 2, render: (input) => "\u{1F603}".repeat(input.length) },
340
+ invisible: { scale: 0, render: (input) => "" },
341
+ default: { scale: 1, render: (input) => `${input}` }
342
+ });
343
+ var render = (type) => styles[type] || styles.default;
344
+ var symbols = Object.freeze({
345
+ aborted: c.red(figures.cross),
346
+ done: c.green(figures.tick),
347
+ exited: c.yellow(figures.cross),
348
+ default: c.cyan("?")
349
+ });
350
+ var symbol = (done, aborted, exited) => aborted ? symbols.aborted : exited ? symbols.exited : done ? symbols.done : symbols.default;
351
+ var delimiter = (completing) => c.gray(completing ? figures.ellipsis : figures.pointerSmall);
352
+ var item = (expandable, expanded) => c.gray(expandable ? expanded ? figures.pointerSmall : "+" : figures.line);
353
+ module.exports = {
354
+ styles,
355
+ render,
356
+ symbols,
357
+ symbol,
358
+ delimiter,
359
+ item
360
+ };
361
+ }
362
+ });
363
+
364
+ // node_modules/prompts/lib/util/lines.js
365
+ var require_lines = __commonJS({
366
+ "node_modules/prompts/lib/util/lines.js"(exports, module) {
367
+ "use strict";
368
+ var strip = require_strip();
369
+ module.exports = function(msg, perLine) {
370
+ let lines = String(strip(msg) || "").split(/\r?\n/);
371
+ if (!perLine)
372
+ return lines.length;
373
+ return lines.map((l) => Math.ceil(l.length / perLine)).reduce((a, b) => a + b);
374
+ };
375
+ }
376
+ });
377
+
378
+ // node_modules/prompts/lib/util/wrap.js
379
+ var require_wrap = __commonJS({
380
+ "node_modules/prompts/lib/util/wrap.js"(exports, module) {
381
+ "use strict";
382
+ module.exports = (msg, opts = {}) => {
383
+ const tab = Number.isSafeInteger(parseInt(opts.margin)) ? new Array(parseInt(opts.margin)).fill(" ").join("") : opts.margin || "";
384
+ const width = opts.width;
385
+ return (msg || "").split(/\r?\n/g).map((line) => line.split(/\s+/g).reduce((arr, w) => {
386
+ if (w.length + tab.length >= width || arr[arr.length - 1].length + w.length + 1 < width)
387
+ arr[arr.length - 1] += ` ${w}`;
388
+ else
389
+ arr.push(`${tab}${w}`);
390
+ return arr;
391
+ }, [tab]).join("\n")).join("\n");
392
+ };
393
+ }
394
+ });
395
+
396
+ // node_modules/prompts/lib/util/entriesToDisplay.js
397
+ var require_entriesToDisplay = __commonJS({
398
+ "node_modules/prompts/lib/util/entriesToDisplay.js"(exports, module) {
399
+ "use strict";
400
+ module.exports = (cursor, total, maxVisible) => {
401
+ maxVisible = maxVisible || total;
402
+ let startIndex = Math.min(total - maxVisible, cursor - Math.floor(maxVisible / 2));
403
+ if (startIndex < 0)
404
+ startIndex = 0;
405
+ let endIndex = Math.min(startIndex + maxVisible, total);
406
+ return { startIndex, endIndex };
407
+ };
408
+ }
409
+ });
410
+
411
+ // node_modules/prompts/lib/util/index.js
412
+ var require_util = __commonJS({
413
+ "node_modules/prompts/lib/util/index.js"(exports, module) {
414
+ "use strict";
415
+ module.exports = {
416
+ action: require_action(),
417
+ clear: require_clear(),
418
+ style: require_style(),
419
+ strip: require_strip(),
420
+ figures: require_figures(),
421
+ lines: require_lines(),
422
+ wrap: require_wrap(),
423
+ entriesToDisplay: require_entriesToDisplay()
424
+ };
425
+ }
426
+ });
427
+
428
+ // node_modules/prompts/lib/elements/prompt.js
429
+ var require_prompt = __commonJS({
430
+ "node_modules/prompts/lib/elements/prompt.js"(exports, module) {
431
+ "use strict";
432
+ var readline = __require("readline");
433
+ var { action } = require_util();
434
+ var EventEmitter = __require("events");
435
+ var { beep, cursor } = require_src();
436
+ var color = require_kleur();
437
+ var Prompt = class extends EventEmitter {
438
+ constructor(opts = {}) {
439
+ super();
440
+ this.firstRender = true;
441
+ this.in = opts.stdin || process.stdin;
442
+ this.out = opts.stdout || process.stdout;
443
+ this.onRender = (opts.onRender || (() => void 0)).bind(this);
444
+ const rl = readline.createInterface({ input: this.in, escapeCodeTimeout: 50 });
445
+ readline.emitKeypressEvents(this.in, rl);
446
+ if (this.in.isTTY)
447
+ this.in.setRawMode(true);
448
+ const isSelect = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1;
449
+ const keypress = (str, key) => {
450
+ let a = action(key, isSelect);
451
+ if (a === false) {
452
+ this._ && this._(str, key);
453
+ } else if (typeof this[a] === "function") {
454
+ this[a](key);
455
+ } else {
456
+ this.bell();
457
+ }
458
+ };
459
+ this.close = () => {
460
+ this.out.write(cursor.show);
461
+ this.in.removeListener("keypress", keypress);
462
+ if (this.in.isTTY)
463
+ this.in.setRawMode(false);
464
+ rl.close();
465
+ this.emit(this.aborted ? "abort" : this.exited ? "exit" : "submit", this.value);
466
+ this.closed = true;
467
+ };
468
+ this.in.on("keypress", keypress);
469
+ }
470
+ fire() {
471
+ this.emit("state", {
472
+ value: this.value,
473
+ aborted: !!this.aborted,
474
+ exited: !!this.exited
475
+ });
476
+ }
477
+ bell() {
478
+ this.out.write(beep);
479
+ }
480
+ render() {
481
+ this.onRender(color);
482
+ if (this.firstRender)
483
+ this.firstRender = false;
484
+ }
485
+ };
486
+ module.exports = Prompt;
487
+ }
488
+ });
489
+
490
+ // node_modules/prompts/lib/elements/text.js
491
+ var require_text = __commonJS({
492
+ "node_modules/prompts/lib/elements/text.js"(exports, module) {
493
+ var color = require_kleur();
494
+ var Prompt = require_prompt();
495
+ var { erase, cursor } = require_src();
496
+ var { style, clear, lines, figures } = require_util();
497
+ var TextPrompt = class extends Prompt {
498
+ constructor(opts = {}) {
499
+ super(opts);
500
+ this.transform = style.render(opts.style);
501
+ this.scale = this.transform.scale;
502
+ this.msg = opts.message;
503
+ this.initial = opts.initial || ``;
504
+ this.validator = opts.validate || (() => true);
505
+ this.value = ``;
506
+ this.errorMsg = opts.error || `Please Enter A Valid Value`;
507
+ this.cursor = Number(!!this.initial);
508
+ this.cursorOffset = 0;
509
+ this.clear = clear(``, this.out.columns);
510
+ this.render();
511
+ }
512
+ set value(v) {
513
+ if (!v && this.initial) {
514
+ this.placeholder = true;
515
+ this.rendered = color.gray(this.transform.render(this.initial));
516
+ } else {
517
+ this.placeholder = false;
518
+ this.rendered = this.transform.render(v);
519
+ }
520
+ this._value = v;
521
+ this.fire();
522
+ }
523
+ get value() {
524
+ return this._value;
525
+ }
526
+ reset() {
527
+ this.value = ``;
528
+ this.cursor = Number(!!this.initial);
529
+ this.cursorOffset = 0;
530
+ this.fire();
531
+ this.render();
532
+ }
533
+ exit() {
534
+ this.abort();
535
+ }
536
+ abort() {
537
+ this.value = this.value || this.initial;
538
+ this.done = this.aborted = true;
539
+ this.error = false;
540
+ this.red = false;
541
+ this.fire();
542
+ this.render();
543
+ this.out.write("\n");
544
+ this.close();
545
+ }
546
+ async validate() {
547
+ let valid = await this.validator(this.value);
548
+ if (typeof valid === `string`) {
549
+ this.errorMsg = valid;
550
+ valid = false;
551
+ }
552
+ this.error = !valid;
553
+ }
554
+ async submit() {
555
+ this.value = this.value || this.initial;
556
+ this.cursorOffset = 0;
557
+ this.cursor = this.rendered.length;
558
+ await this.validate();
559
+ if (this.error) {
560
+ this.red = true;
561
+ this.fire();
562
+ this.render();
563
+ return;
564
+ }
565
+ this.done = true;
566
+ this.aborted = false;
567
+ this.fire();
568
+ this.render();
569
+ this.out.write("\n");
570
+ this.close();
571
+ }
572
+ next() {
573
+ if (!this.placeholder)
574
+ return this.bell();
575
+ this.value = this.initial;
576
+ this.cursor = this.rendered.length;
577
+ this.fire();
578
+ this.render();
579
+ }
580
+ moveCursor(n) {
581
+ if (this.placeholder)
582
+ return;
583
+ this.cursor = this.cursor + n;
584
+ this.cursorOffset += n;
585
+ }
586
+ _(c, key) {
587
+ let s1 = this.value.slice(0, this.cursor);
588
+ let s2 = this.value.slice(this.cursor);
589
+ this.value = `${s1}${c}${s2}`;
590
+ this.red = false;
591
+ this.cursor = this.placeholder ? 0 : s1.length + 1;
592
+ this.render();
593
+ }
594
+ delete() {
595
+ if (this.isCursorAtStart())
596
+ return this.bell();
597
+ let s1 = this.value.slice(0, this.cursor - 1);
598
+ let s2 = this.value.slice(this.cursor);
599
+ this.value = `${s1}${s2}`;
600
+ this.red = false;
601
+ if (this.isCursorAtStart()) {
602
+ this.cursorOffset = 0;
603
+ } else {
604
+ this.cursorOffset++;
605
+ this.moveCursor(-1);
606
+ }
607
+ this.render();
608
+ }
609
+ deleteForward() {
610
+ if (this.cursor * this.scale >= this.rendered.length || this.placeholder)
611
+ return this.bell();
612
+ let s1 = this.value.slice(0, this.cursor);
613
+ let s2 = this.value.slice(this.cursor + 1);
614
+ this.value = `${s1}${s2}`;
615
+ this.red = false;
616
+ if (this.isCursorAtEnd()) {
617
+ this.cursorOffset = 0;
618
+ } else {
619
+ this.cursorOffset++;
620
+ }
621
+ this.render();
622
+ }
623
+ first() {
624
+ this.cursor = 0;
625
+ this.render();
626
+ }
627
+ last() {
628
+ this.cursor = this.value.length;
629
+ this.render();
630
+ }
631
+ left() {
632
+ if (this.cursor <= 0 || this.placeholder)
633
+ return this.bell();
634
+ this.moveCursor(-1);
635
+ this.render();
636
+ }
637
+ right() {
638
+ if (this.cursor * this.scale >= this.rendered.length || this.placeholder)
639
+ return this.bell();
640
+ this.moveCursor(1);
641
+ this.render();
642
+ }
643
+ isCursorAtStart() {
644
+ return this.cursor === 0 || this.placeholder && this.cursor === 1;
645
+ }
646
+ isCursorAtEnd() {
647
+ return this.cursor === this.rendered.length || this.placeholder && this.cursor === this.rendered.length + 1;
648
+ }
649
+ render() {
650
+ if (this.closed)
651
+ return;
652
+ if (!this.firstRender) {
653
+ if (this.outputError)
654
+ this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns));
655
+ this.out.write(clear(this.outputText, this.out.columns));
656
+ }
657
+ super.render();
658
+ this.outputError = "";
659
+ this.outputText = [
660
+ style.symbol(this.done, this.aborted),
661
+ color.bold(this.msg),
662
+ style.delimiter(this.done),
663
+ this.red ? color.red(this.rendered) : this.rendered
664
+ ].join(` `);
665
+ if (this.error) {
666
+ this.outputError += this.errorMsg.split(`
667
+ `).reduce((a, l, i) => a + `
668
+ ${i ? " " : figures.pointerSmall} ${color.red().italic(l)}`, ``);
669
+ }
670
+ this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore + cursor.move(this.cursorOffset, 0));
671
+ }
672
+ };
673
+ module.exports = TextPrompt;
674
+ }
675
+ });
676
+
677
+ // node_modules/prompts/lib/elements/select.js
678
+ var require_select = __commonJS({
679
+ "node_modules/prompts/lib/elements/select.js"(exports, module) {
680
+ "use strict";
681
+ var color = require_kleur();
682
+ var Prompt = require_prompt();
683
+ var { style, clear, figures, wrap, entriesToDisplay } = require_util();
684
+ var { cursor } = require_src();
685
+ var SelectPrompt = class extends Prompt {
686
+ constructor(opts = {}) {
687
+ super(opts);
688
+ this.msg = opts.message;
689
+ this.hint = opts.hint || "- Use arrow-keys. Return to submit.";
690
+ this.warn = opts.warn || "- This option is disabled";
691
+ this.cursor = opts.initial || 0;
692
+ this.choices = opts.choices.map((ch, idx) => {
693
+ if (typeof ch === "string")
694
+ ch = { title: ch, value: idx };
695
+ return {
696
+ title: ch && (ch.title || ch.value || ch),
697
+ value: ch && (ch.value === void 0 ? idx : ch.value),
698
+ description: ch && ch.description,
699
+ selected: ch && ch.selected,
700
+ disabled: ch && ch.disabled
701
+ };
702
+ });
703
+ this.optionsPerPage = opts.optionsPerPage || 10;
704
+ this.value = (this.choices[this.cursor] || {}).value;
705
+ this.clear = clear("", this.out.columns);
706
+ this.render();
707
+ }
708
+ moveCursor(n) {
709
+ this.cursor = n;
710
+ this.value = this.choices[n].value;
711
+ this.fire();
712
+ }
713
+ reset() {
714
+ this.moveCursor(0);
715
+ this.fire();
716
+ this.render();
717
+ }
718
+ exit() {
719
+ this.abort();
720
+ }
721
+ abort() {
722
+ this.done = this.aborted = true;
723
+ this.fire();
724
+ this.render();
725
+ this.out.write("\n");
726
+ this.close();
727
+ }
728
+ submit() {
729
+ if (!this.selection.disabled) {
730
+ this.done = true;
731
+ this.aborted = false;
732
+ this.fire();
733
+ this.render();
734
+ this.out.write("\n");
735
+ this.close();
736
+ } else
737
+ this.bell();
738
+ }
739
+ first() {
740
+ this.moveCursor(0);
741
+ this.render();
742
+ }
743
+ last() {
744
+ this.moveCursor(this.choices.length - 1);
745
+ this.render();
746
+ }
747
+ up() {
748
+ if (this.cursor === 0) {
749
+ this.moveCursor(this.choices.length - 1);
750
+ } else {
751
+ this.moveCursor(this.cursor - 1);
752
+ }
753
+ this.render();
754
+ }
755
+ down() {
756
+ if (this.cursor === this.choices.length - 1) {
757
+ this.moveCursor(0);
758
+ } else {
759
+ this.moveCursor(this.cursor + 1);
760
+ }
761
+ this.render();
762
+ }
763
+ next() {
764
+ this.moveCursor((this.cursor + 1) % this.choices.length);
765
+ this.render();
766
+ }
767
+ _(c, key) {
768
+ if (c === " ")
769
+ return this.submit();
770
+ }
771
+ get selection() {
772
+ return this.choices[this.cursor];
773
+ }
774
+ render() {
775
+ if (this.closed)
776
+ return;
777
+ if (this.firstRender)
778
+ this.out.write(cursor.hide);
779
+ else
780
+ this.out.write(clear(this.outputText, this.out.columns));
781
+ super.render();
782
+ let { startIndex, endIndex } = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage);
783
+ this.outputText = [
784
+ style.symbol(this.done, this.aborted),
785
+ color.bold(this.msg),
786
+ style.delimiter(false),
787
+ this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)
788
+ ].join(" ");
789
+ if (!this.done) {
790
+ this.outputText += "\n";
791
+ for (let i = startIndex; i < endIndex; i++) {
792
+ let title, prefix, desc = "", v = this.choices[i];
793
+ if (i === startIndex && startIndex > 0) {
794
+ prefix = figures.arrowUp;
795
+ } else if (i === endIndex - 1 && endIndex < this.choices.length) {
796
+ prefix = figures.arrowDown;
797
+ } else {
798
+ prefix = " ";
799
+ }
800
+ if (v.disabled) {
801
+ title = this.cursor === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
802
+ prefix = (this.cursor === i ? color.bold().gray(figures.pointer) + " " : " ") + prefix;
803
+ } else {
804
+ title = this.cursor === i ? color.cyan().underline(v.title) : v.title;
805
+ prefix = (this.cursor === i ? color.cyan(figures.pointer) + " " : " ") + prefix;
806
+ if (v.description && this.cursor === i) {
807
+ desc = ` - ${v.description}`;
808
+ if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
809
+ desc = "\n" + wrap(v.description, { margin: 3, width: this.out.columns });
810
+ }
811
+ }
812
+ }
813
+ this.outputText += `${prefix} ${title}${color.gray(desc)}
814
+ `;
815
+ }
816
+ }
817
+ this.out.write(this.outputText);
818
+ }
819
+ };
820
+ module.exports = SelectPrompt;
821
+ }
822
+ });
823
+
824
+ // node_modules/prompts/lib/elements/toggle.js
825
+ var require_toggle = __commonJS({
826
+ "node_modules/prompts/lib/elements/toggle.js"(exports, module) {
827
+ var color = require_kleur();
828
+ var Prompt = require_prompt();
829
+ var { style, clear } = require_util();
830
+ var { cursor, erase } = require_src();
831
+ var TogglePrompt = class extends Prompt {
832
+ constructor(opts = {}) {
833
+ super(opts);
834
+ this.msg = opts.message;
835
+ this.value = !!opts.initial;
836
+ this.active = opts.active || "on";
837
+ this.inactive = opts.inactive || "off";
838
+ this.initialValue = this.value;
839
+ this.render();
840
+ }
841
+ reset() {
842
+ this.value = this.initialValue;
843
+ this.fire();
844
+ this.render();
845
+ }
846
+ exit() {
847
+ this.abort();
848
+ }
849
+ abort() {
850
+ this.done = this.aborted = true;
851
+ this.fire();
852
+ this.render();
853
+ this.out.write("\n");
854
+ this.close();
855
+ }
856
+ submit() {
857
+ this.done = true;
858
+ this.aborted = false;
859
+ this.fire();
860
+ this.render();
861
+ this.out.write("\n");
862
+ this.close();
863
+ }
864
+ deactivate() {
865
+ if (this.value === false)
866
+ return this.bell();
867
+ this.value = false;
868
+ this.render();
869
+ }
870
+ activate() {
871
+ if (this.value === true)
872
+ return this.bell();
873
+ this.value = true;
874
+ this.render();
875
+ }
876
+ delete() {
877
+ this.deactivate();
878
+ }
879
+ left() {
880
+ this.deactivate();
881
+ }
882
+ right() {
883
+ this.activate();
884
+ }
885
+ down() {
886
+ this.deactivate();
887
+ }
888
+ up() {
889
+ this.activate();
890
+ }
891
+ next() {
892
+ this.value = !this.value;
893
+ this.fire();
894
+ this.render();
895
+ }
896
+ _(c, key) {
897
+ if (c === " ") {
898
+ this.value = !this.value;
899
+ } else if (c === "1") {
900
+ this.value = true;
901
+ } else if (c === "0") {
902
+ this.value = false;
903
+ } else
904
+ return this.bell();
905
+ this.render();
906
+ }
907
+ render() {
908
+ if (this.closed)
909
+ return;
910
+ if (this.firstRender)
911
+ this.out.write(cursor.hide);
912
+ else
913
+ this.out.write(clear(this.outputText, this.out.columns));
914
+ super.render();
915
+ this.outputText = [
916
+ style.symbol(this.done, this.aborted),
917
+ color.bold(this.msg),
918
+ style.delimiter(this.done),
919
+ this.value ? this.inactive : color.cyan().underline(this.inactive),
920
+ color.gray("/"),
921
+ this.value ? color.cyan().underline(this.active) : this.active
922
+ ].join(" ");
923
+ this.out.write(erase.line + cursor.to(0) + this.outputText);
924
+ }
925
+ };
926
+ module.exports = TogglePrompt;
927
+ }
928
+ });
929
+
930
+ // node_modules/prompts/lib/dateparts/datepart.js
931
+ var require_datepart = __commonJS({
932
+ "node_modules/prompts/lib/dateparts/datepart.js"(exports, module) {
933
+ "use strict";
934
+ var DatePart = class _DatePart {
935
+ constructor({ token, date, parts, locales }) {
936
+ this.token = token;
937
+ this.date = date || /* @__PURE__ */ new Date();
938
+ this.parts = parts || [this];
939
+ this.locales = locales || {};
940
+ }
941
+ up() {
942
+ }
943
+ down() {
944
+ }
945
+ next() {
946
+ const currentIdx = this.parts.indexOf(this);
947
+ return this.parts.find((part, idx) => idx > currentIdx && part instanceof _DatePart);
948
+ }
949
+ setTo(val) {
950
+ }
951
+ prev() {
952
+ let parts = [].concat(this.parts).reverse();
953
+ const currentIdx = parts.indexOf(this);
954
+ return parts.find((part, idx) => idx > currentIdx && part instanceof _DatePart);
955
+ }
956
+ toString() {
957
+ return String(this.date);
958
+ }
959
+ };
960
+ module.exports = DatePart;
961
+ }
962
+ });
963
+
964
+ // node_modules/prompts/lib/dateparts/meridiem.js
965
+ var require_meridiem = __commonJS({
966
+ "node_modules/prompts/lib/dateparts/meridiem.js"(exports, module) {
967
+ "use strict";
968
+ var DatePart = require_datepart();
969
+ var Meridiem = class extends DatePart {
970
+ constructor(opts = {}) {
971
+ super(opts);
972
+ }
973
+ up() {
974
+ this.date.setHours((this.date.getHours() + 12) % 24);
975
+ }
976
+ down() {
977
+ this.up();
978
+ }
979
+ toString() {
980
+ let meridiem = this.date.getHours() > 12 ? "pm" : "am";
981
+ return /\A/.test(this.token) ? meridiem.toUpperCase() : meridiem;
982
+ }
983
+ };
984
+ module.exports = Meridiem;
985
+ }
986
+ });
987
+
988
+ // node_modules/prompts/lib/dateparts/day.js
989
+ var require_day = __commonJS({
990
+ "node_modules/prompts/lib/dateparts/day.js"(exports, module) {
991
+ "use strict";
992
+ var DatePart = require_datepart();
993
+ var pos = (n) => {
994
+ n = n % 10;
995
+ return n === 1 ? "st" : n === 2 ? "nd" : n === 3 ? "rd" : "th";
996
+ };
997
+ var Day = class extends DatePart {
998
+ constructor(opts = {}) {
999
+ super(opts);
1000
+ }
1001
+ up() {
1002
+ this.date.setDate(this.date.getDate() + 1);
1003
+ }
1004
+ down() {
1005
+ this.date.setDate(this.date.getDate() - 1);
1006
+ }
1007
+ setTo(val) {
1008
+ this.date.setDate(parseInt(val.substr(-2)));
1009
+ }
1010
+ toString() {
1011
+ let date = this.date.getDate();
1012
+ let day = this.date.getDay();
1013
+ 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;
1014
+ }
1015
+ };
1016
+ module.exports = Day;
1017
+ }
1018
+ });
1019
+
1020
+ // node_modules/prompts/lib/dateparts/hours.js
1021
+ var require_hours = __commonJS({
1022
+ "node_modules/prompts/lib/dateparts/hours.js"(exports, module) {
1023
+ "use strict";
1024
+ var DatePart = require_datepart();
1025
+ var Hours = class extends DatePart {
1026
+ constructor(opts = {}) {
1027
+ super(opts);
1028
+ }
1029
+ up() {
1030
+ this.date.setHours(this.date.getHours() + 1);
1031
+ }
1032
+ down() {
1033
+ this.date.setHours(this.date.getHours() - 1);
1034
+ }
1035
+ setTo(val) {
1036
+ this.date.setHours(parseInt(val.substr(-2)));
1037
+ }
1038
+ toString() {
1039
+ let hours = this.date.getHours();
1040
+ if (/h/.test(this.token))
1041
+ hours = hours % 12 || 12;
1042
+ return this.token.length > 1 ? String(hours).padStart(2, "0") : hours;
1043
+ }
1044
+ };
1045
+ module.exports = Hours;
1046
+ }
1047
+ });
1048
+
1049
+ // node_modules/prompts/lib/dateparts/milliseconds.js
1050
+ var require_milliseconds = __commonJS({
1051
+ "node_modules/prompts/lib/dateparts/milliseconds.js"(exports, module) {
1052
+ "use strict";
1053
+ var DatePart = require_datepart();
1054
+ var Milliseconds = class extends DatePart {
1055
+ constructor(opts = {}) {
1056
+ super(opts);
1057
+ }
1058
+ up() {
1059
+ this.date.setMilliseconds(this.date.getMilliseconds() + 1);
1060
+ }
1061
+ down() {
1062
+ this.date.setMilliseconds(this.date.getMilliseconds() - 1);
1063
+ }
1064
+ setTo(val) {
1065
+ this.date.setMilliseconds(parseInt(val.substr(-this.token.length)));
1066
+ }
1067
+ toString() {
1068
+ return String(this.date.getMilliseconds()).padStart(4, "0").substr(0, this.token.length);
1069
+ }
1070
+ };
1071
+ module.exports = Milliseconds;
1072
+ }
1073
+ });
1074
+
1075
+ // node_modules/prompts/lib/dateparts/minutes.js
1076
+ var require_minutes = __commonJS({
1077
+ "node_modules/prompts/lib/dateparts/minutes.js"(exports, module) {
1078
+ "use strict";
1079
+ var DatePart = require_datepart();
1080
+ var Minutes = class extends DatePart {
1081
+ constructor(opts = {}) {
1082
+ super(opts);
1083
+ }
1084
+ up() {
1085
+ this.date.setMinutes(this.date.getMinutes() + 1);
1086
+ }
1087
+ down() {
1088
+ this.date.setMinutes(this.date.getMinutes() - 1);
1089
+ }
1090
+ setTo(val) {
1091
+ this.date.setMinutes(parseInt(val.substr(-2)));
1092
+ }
1093
+ toString() {
1094
+ let m = this.date.getMinutes();
1095
+ return this.token.length > 1 ? String(m).padStart(2, "0") : m;
1096
+ }
1097
+ };
1098
+ module.exports = Minutes;
1099
+ }
1100
+ });
1101
+
1102
+ // node_modules/prompts/lib/dateparts/month.js
1103
+ var require_month = __commonJS({
1104
+ "node_modules/prompts/lib/dateparts/month.js"(exports, module) {
1105
+ "use strict";
1106
+ var DatePart = require_datepart();
1107
+ var Month = class extends DatePart {
1108
+ constructor(opts = {}) {
1109
+ super(opts);
1110
+ }
1111
+ up() {
1112
+ this.date.setMonth(this.date.getMonth() + 1);
1113
+ }
1114
+ down() {
1115
+ this.date.setMonth(this.date.getMonth() - 1);
1116
+ }
1117
+ setTo(val) {
1118
+ val = parseInt(val.substr(-2)) - 1;
1119
+ this.date.setMonth(val < 0 ? 0 : val);
1120
+ }
1121
+ toString() {
1122
+ let month = this.date.getMonth();
1123
+ let tl = this.token.length;
1124
+ return tl === 2 ? String(month + 1).padStart(2, "0") : tl === 3 ? this.locales.monthsShort[month] : tl === 4 ? this.locales.months[month] : String(month + 1);
1125
+ }
1126
+ };
1127
+ module.exports = Month;
1128
+ }
1129
+ });
1130
+
1131
+ // node_modules/prompts/lib/dateparts/seconds.js
1132
+ var require_seconds = __commonJS({
1133
+ "node_modules/prompts/lib/dateparts/seconds.js"(exports, module) {
1134
+ "use strict";
1135
+ var DatePart = require_datepart();
1136
+ var Seconds = class extends DatePart {
1137
+ constructor(opts = {}) {
1138
+ super(opts);
1139
+ }
1140
+ up() {
1141
+ this.date.setSeconds(this.date.getSeconds() + 1);
1142
+ }
1143
+ down() {
1144
+ this.date.setSeconds(this.date.getSeconds() - 1);
1145
+ }
1146
+ setTo(val) {
1147
+ this.date.setSeconds(parseInt(val.substr(-2)));
1148
+ }
1149
+ toString() {
1150
+ let s = this.date.getSeconds();
1151
+ return this.token.length > 1 ? String(s).padStart(2, "0") : s;
1152
+ }
1153
+ };
1154
+ module.exports = Seconds;
1155
+ }
1156
+ });
1157
+
1158
+ // node_modules/prompts/lib/dateparts/year.js
1159
+ var require_year = __commonJS({
1160
+ "node_modules/prompts/lib/dateparts/year.js"(exports, module) {
1161
+ "use strict";
1162
+ var DatePart = require_datepart();
1163
+ var Year = class extends DatePart {
1164
+ constructor(opts = {}) {
1165
+ super(opts);
1166
+ }
1167
+ up() {
1168
+ this.date.setFullYear(this.date.getFullYear() + 1);
1169
+ }
1170
+ down() {
1171
+ this.date.setFullYear(this.date.getFullYear() - 1);
1172
+ }
1173
+ setTo(val) {
1174
+ this.date.setFullYear(val.substr(-4));
1175
+ }
1176
+ toString() {
1177
+ let year = String(this.date.getFullYear()).padStart(4, "0");
1178
+ return this.token.length === 2 ? year.substr(-2) : year;
1179
+ }
1180
+ };
1181
+ module.exports = Year;
1182
+ }
1183
+ });
1184
+
1185
+ // node_modules/prompts/lib/dateparts/index.js
1186
+ var require_dateparts = __commonJS({
1187
+ "node_modules/prompts/lib/dateparts/index.js"(exports, module) {
1188
+ "use strict";
1189
+ module.exports = {
1190
+ DatePart: require_datepart(),
1191
+ Meridiem: require_meridiem(),
1192
+ Day: require_day(),
1193
+ Hours: require_hours(),
1194
+ Milliseconds: require_milliseconds(),
1195
+ Minutes: require_minutes(),
1196
+ Month: require_month(),
1197
+ Seconds: require_seconds(),
1198
+ Year: require_year()
1199
+ };
1200
+ }
1201
+ });
1202
+
1203
+ // node_modules/prompts/lib/elements/date.js
1204
+ var require_date = __commonJS({
1205
+ "node_modules/prompts/lib/elements/date.js"(exports, module) {
1206
+ "use strict";
1207
+ var color = require_kleur();
1208
+ var Prompt = require_prompt();
1209
+ var { style, clear, figures } = require_util();
1210
+ var { erase, cursor } = require_src();
1211
+ var { DatePart, Meridiem, Day, Hours, Milliseconds, Minutes, Month, Seconds, Year } = require_dateparts();
1212
+ 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;
1213
+ var regexGroups = {
1214
+ 1: ({ token }) => token.replace(/\\(.)/g, "$1"),
1215
+ 2: (opts) => new Day(opts),
1216
+ // Day // TODO
1217
+ 3: (opts) => new Month(opts),
1218
+ // Month
1219
+ 4: (opts) => new Year(opts),
1220
+ // Year
1221
+ 5: (opts) => new Meridiem(opts),
1222
+ // AM/PM // TODO (special)
1223
+ 6: (opts) => new Hours(opts),
1224
+ // Hours
1225
+ 7: (opts) => new Minutes(opts),
1226
+ // Minutes
1227
+ 8: (opts) => new Seconds(opts),
1228
+ // Seconds
1229
+ 9: (opts) => new Milliseconds(opts)
1230
+ // Fractional seconds
1231
+ };
1232
+ var dfltLocales = {
1233
+ months: "January,February,March,April,May,June,July,August,September,October,November,December".split(","),
1234
+ monthsShort: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),
1235
+ weekdays: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),
1236
+ weekdaysShort: "Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")
1237
+ };
1238
+ var DatePrompt = class extends Prompt {
1239
+ constructor(opts = {}) {
1240
+ super(opts);
1241
+ this.msg = opts.message;
1242
+ this.cursor = 0;
1243
+ this.typed = "";
1244
+ this.locales = Object.assign(dfltLocales, opts.locales);
1245
+ this._date = opts.initial || /* @__PURE__ */ new Date();
1246
+ this.errorMsg = opts.error || "Please Enter A Valid Value";
1247
+ this.validator = opts.validate || (() => true);
1248
+ this.mask = opts.mask || "YYYY-MM-DD HH:mm:ss";
1249
+ this.clear = clear("", this.out.columns);
1250
+ this.render();
1251
+ }
1252
+ get value() {
1253
+ return this.date;
1254
+ }
1255
+ get date() {
1256
+ return this._date;
1257
+ }
1258
+ set date(date) {
1259
+ if (date)
1260
+ this._date.setTime(date.getTime());
1261
+ }
1262
+ set mask(mask) {
1263
+ let result;
1264
+ this.parts = [];
1265
+ while (result = regex.exec(mask)) {
1266
+ let match = result.shift();
1267
+ let idx = result.findIndex((gr) => gr != null);
1268
+ this.parts.push(idx in regexGroups ? regexGroups[idx]({ token: result[idx] || match, date: this.date, parts: this.parts, locales: this.locales }) : result[idx] || match);
1269
+ }
1270
+ let parts = this.parts.reduce((arr, i) => {
1271
+ if (typeof i === "string" && typeof arr[arr.length - 1] === "string")
1272
+ arr[arr.length - 1] += i;
1273
+ else
1274
+ arr.push(i);
1275
+ return arr;
1276
+ }, []);
1277
+ this.parts.splice(0);
1278
+ this.parts.push(...parts);
1279
+ this.reset();
1280
+ }
1281
+ moveCursor(n) {
1282
+ this.typed = "";
1283
+ this.cursor = n;
1284
+ this.fire();
1285
+ }
1286
+ reset() {
1287
+ this.moveCursor(this.parts.findIndex((p) => p instanceof DatePart));
1288
+ this.fire();
1289
+ this.render();
1290
+ }
1291
+ exit() {
1292
+ this.abort();
1293
+ }
1294
+ abort() {
1295
+ this.done = this.aborted = true;
1296
+ this.error = false;
1297
+ this.fire();
1298
+ this.render();
1299
+ this.out.write("\n");
1300
+ this.close();
1301
+ }
1302
+ async validate() {
1303
+ let valid = await this.validator(this.value);
1304
+ if (typeof valid === "string") {
1305
+ this.errorMsg = valid;
1306
+ valid = false;
1307
+ }
1308
+ this.error = !valid;
1309
+ }
1310
+ async submit() {
1311
+ await this.validate();
1312
+ if (this.error) {
1313
+ this.color = "red";
1314
+ this.fire();
1315
+ this.render();
1316
+ return;
1317
+ }
1318
+ this.done = true;
1319
+ this.aborted = false;
1320
+ this.fire();
1321
+ this.render();
1322
+ this.out.write("\n");
1323
+ this.close();
1324
+ }
1325
+ up() {
1326
+ this.typed = "";
1327
+ this.parts[this.cursor].up();
1328
+ this.render();
1329
+ }
1330
+ down() {
1331
+ this.typed = "";
1332
+ this.parts[this.cursor].down();
1333
+ this.render();
1334
+ }
1335
+ left() {
1336
+ let prev = this.parts[this.cursor].prev();
1337
+ if (prev == null)
1338
+ return this.bell();
1339
+ this.moveCursor(this.parts.indexOf(prev));
1340
+ this.render();
1341
+ }
1342
+ right() {
1343
+ let next = this.parts[this.cursor].next();
1344
+ if (next == null)
1345
+ return this.bell();
1346
+ this.moveCursor(this.parts.indexOf(next));
1347
+ this.render();
1348
+ }
1349
+ next() {
1350
+ let next = this.parts[this.cursor].next();
1351
+ this.moveCursor(next ? this.parts.indexOf(next) : this.parts.findIndex((part) => part instanceof DatePart));
1352
+ this.render();
1353
+ }
1354
+ _(c) {
1355
+ if (/\d/.test(c)) {
1356
+ this.typed += c;
1357
+ this.parts[this.cursor].setTo(this.typed);
1358
+ this.render();
1359
+ }
1360
+ }
1361
+ render() {
1362
+ if (this.closed)
1363
+ return;
1364
+ if (this.firstRender)
1365
+ this.out.write(cursor.hide);
1366
+ else
1367
+ this.out.write(clear(this.outputText, this.out.columns));
1368
+ super.render();
1369
+ this.outputText = [
1370
+ style.symbol(this.done, this.aborted),
1371
+ color.bold(this.msg),
1372
+ style.delimiter(false),
1373
+ this.parts.reduce((arr, p, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p.toString()) : p), []).join("")
1374
+ ].join(" ");
1375
+ if (this.error) {
1376
+ this.outputText += this.errorMsg.split("\n").reduce(
1377
+ (a, l, i) => a + `
1378
+ ${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`,
1379
+ ``
1380
+ );
1381
+ }
1382
+ this.out.write(erase.line + cursor.to(0) + this.outputText);
1383
+ }
1384
+ };
1385
+ module.exports = DatePrompt;
1386
+ }
1387
+ });
1388
+
1389
+ // node_modules/prompts/lib/elements/number.js
1390
+ var require_number = __commonJS({
1391
+ "node_modules/prompts/lib/elements/number.js"(exports, module) {
1392
+ var color = require_kleur();
1393
+ var Prompt = require_prompt();
1394
+ var { cursor, erase } = require_src();
1395
+ var { style, figures, clear, lines } = require_util();
1396
+ var isNumber = /[0-9]/;
1397
+ var isDef = (any) => any !== void 0;
1398
+ var round = (number, precision) => {
1399
+ let factor = Math.pow(10, precision);
1400
+ return Math.round(number * factor) / factor;
1401
+ };
1402
+ var NumberPrompt = class extends Prompt {
1403
+ constructor(opts = {}) {
1404
+ super(opts);
1405
+ this.transform = style.render(opts.style);
1406
+ this.msg = opts.message;
1407
+ this.initial = isDef(opts.initial) ? opts.initial : "";
1408
+ this.float = !!opts.float;
1409
+ this.round = opts.round || 2;
1410
+ this.inc = opts.increment || 1;
1411
+ this.min = isDef(opts.min) ? opts.min : -Infinity;
1412
+ this.max = isDef(opts.max) ? opts.max : Infinity;
1413
+ this.errorMsg = opts.error || `Please Enter A Valid Value`;
1414
+ this.validator = opts.validate || (() => true);
1415
+ this.color = `cyan`;
1416
+ this.value = ``;
1417
+ this.typed = ``;
1418
+ this.lastHit = 0;
1419
+ this.render();
1420
+ }
1421
+ set value(v) {
1422
+ if (!v && v !== 0) {
1423
+ this.placeholder = true;
1424
+ this.rendered = color.gray(this.transform.render(`${this.initial}`));
1425
+ this._value = ``;
1426
+ } else {
1427
+ this.placeholder = false;
1428
+ this.rendered = this.transform.render(`${round(v, this.round)}`);
1429
+ this._value = round(v, this.round);
1430
+ }
1431
+ this.fire();
1432
+ }
1433
+ get value() {
1434
+ return this._value;
1435
+ }
1436
+ parse(x) {
1437
+ return this.float ? parseFloat(x) : parseInt(x);
1438
+ }
1439
+ valid(c) {
1440
+ return c === `-` || c === `.` && this.float || isNumber.test(c);
1441
+ }
1442
+ reset() {
1443
+ this.typed = ``;
1444
+ this.value = ``;
1445
+ this.fire();
1446
+ this.render();
1447
+ }
1448
+ exit() {
1449
+ this.abort();
1450
+ }
1451
+ abort() {
1452
+ let x = this.value;
1453
+ this.value = x !== `` ? x : this.initial;
1454
+ this.done = this.aborted = true;
1455
+ this.error = false;
1456
+ this.fire();
1457
+ this.render();
1458
+ this.out.write(`
1459
+ `);
1460
+ this.close();
1461
+ }
1462
+ async validate() {
1463
+ let valid = await this.validator(this.value);
1464
+ if (typeof valid === `string`) {
1465
+ this.errorMsg = valid;
1466
+ valid = false;
1467
+ }
1468
+ this.error = !valid;
1469
+ }
1470
+ async submit() {
1471
+ await this.validate();
1472
+ if (this.error) {
1473
+ this.color = `red`;
1474
+ this.fire();
1475
+ this.render();
1476
+ return;
1477
+ }
1478
+ let x = this.value;
1479
+ this.value = x !== `` ? x : this.initial;
1480
+ this.done = true;
1481
+ this.aborted = false;
1482
+ this.error = false;
1483
+ this.fire();
1484
+ this.render();
1485
+ this.out.write(`
1486
+ `);
1487
+ this.close();
1488
+ }
1489
+ up() {
1490
+ this.typed = ``;
1491
+ if (this.value === "") {
1492
+ this.value = this.min - this.inc;
1493
+ }
1494
+ if (this.value >= this.max)
1495
+ return this.bell();
1496
+ this.value += this.inc;
1497
+ this.color = `cyan`;
1498
+ this.fire();
1499
+ this.render();
1500
+ }
1501
+ down() {
1502
+ this.typed = ``;
1503
+ if (this.value === "") {
1504
+ this.value = this.min + this.inc;
1505
+ }
1506
+ if (this.value <= this.min)
1507
+ return this.bell();
1508
+ this.value -= this.inc;
1509
+ this.color = `cyan`;
1510
+ this.fire();
1511
+ this.render();
1512
+ }
1513
+ delete() {
1514
+ let val = this.value.toString();
1515
+ if (val.length === 0)
1516
+ return this.bell();
1517
+ this.value = this.parse(val = val.slice(0, -1)) || ``;
1518
+ if (this.value !== "" && this.value < this.min) {
1519
+ this.value = this.min;
1520
+ }
1521
+ this.color = `cyan`;
1522
+ this.fire();
1523
+ this.render();
1524
+ }
1525
+ next() {
1526
+ this.value = this.initial;
1527
+ this.fire();
1528
+ this.render();
1529
+ }
1530
+ _(c, key) {
1531
+ if (!this.valid(c))
1532
+ return this.bell();
1533
+ const now = Date.now();
1534
+ if (now - this.lastHit > 1e3)
1535
+ this.typed = ``;
1536
+ this.typed += c;
1537
+ this.lastHit = now;
1538
+ this.color = `cyan`;
1539
+ if (c === `.`)
1540
+ return this.fire();
1541
+ this.value = Math.min(this.parse(this.typed), this.max);
1542
+ if (this.value > this.max)
1543
+ this.value = this.max;
1544
+ if (this.value < this.min)
1545
+ this.value = this.min;
1546
+ this.fire();
1547
+ this.render();
1548
+ }
1549
+ render() {
1550
+ if (this.closed)
1551
+ return;
1552
+ if (!this.firstRender) {
1553
+ if (this.outputError)
1554
+ this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns));
1555
+ this.out.write(clear(this.outputText, this.out.columns));
1556
+ }
1557
+ super.render();
1558
+ this.outputError = "";
1559
+ this.outputText = [
1560
+ style.symbol(this.done, this.aborted),
1561
+ color.bold(this.msg),
1562
+ style.delimiter(this.done),
1563
+ !this.done || !this.done && !this.placeholder ? color[this.color]().underline(this.rendered) : this.rendered
1564
+ ].join(` `);
1565
+ if (this.error) {
1566
+ this.outputError += this.errorMsg.split(`
1567
+ `).reduce((a, l, i) => a + `
1568
+ ${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
1569
+ }
1570
+ this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore);
1571
+ }
1572
+ };
1573
+ module.exports = NumberPrompt;
1574
+ }
1575
+ });
1576
+
1577
+ // node_modules/prompts/lib/elements/multiselect.js
1578
+ var require_multiselect = __commonJS({
1579
+ "node_modules/prompts/lib/elements/multiselect.js"(exports, module) {
1580
+ "use strict";
1581
+ var color = require_kleur();
1582
+ var { cursor } = require_src();
1583
+ var Prompt = require_prompt();
1584
+ var { clear, figures, style, wrap, entriesToDisplay } = require_util();
1585
+ var MultiselectPrompt = class extends Prompt {
1586
+ constructor(opts = {}) {
1587
+ super(opts);
1588
+ this.msg = opts.message;
1589
+ this.cursor = opts.cursor || 0;
1590
+ this.scrollIndex = opts.cursor || 0;
1591
+ this.hint = opts.hint || "";
1592
+ this.warn = opts.warn || "- This option is disabled -";
1593
+ this.minSelected = opts.min;
1594
+ this.showMinError = false;
1595
+ this.maxChoices = opts.max;
1596
+ this.instructions = opts.instructions;
1597
+ this.optionsPerPage = opts.optionsPerPage || 10;
1598
+ this.value = opts.choices.map((ch, idx) => {
1599
+ if (typeof ch === "string")
1600
+ ch = { title: ch, value: idx };
1601
+ return {
1602
+ title: ch && (ch.title || ch.value || ch),
1603
+ description: ch && ch.description,
1604
+ value: ch && (ch.value === void 0 ? idx : ch.value),
1605
+ selected: ch && ch.selected,
1606
+ disabled: ch && ch.disabled
1607
+ };
1608
+ });
1609
+ this.clear = clear("", this.out.columns);
1610
+ if (!opts.overrideRender) {
1611
+ this.render();
1612
+ }
1613
+ }
1614
+ reset() {
1615
+ this.value.map((v) => !v.selected);
1616
+ this.cursor = 0;
1617
+ this.fire();
1618
+ this.render();
1619
+ }
1620
+ selected() {
1621
+ return this.value.filter((v) => v.selected);
1622
+ }
1623
+ exit() {
1624
+ this.abort();
1625
+ }
1626
+ abort() {
1627
+ this.done = this.aborted = true;
1628
+ this.fire();
1629
+ this.render();
1630
+ this.out.write("\n");
1631
+ this.close();
1632
+ }
1633
+ submit() {
1634
+ const selected = this.value.filter((e) => e.selected);
1635
+ if (this.minSelected && selected.length < this.minSelected) {
1636
+ this.showMinError = true;
1637
+ this.render();
1638
+ } else {
1639
+ this.done = true;
1640
+ this.aborted = false;
1641
+ this.fire();
1642
+ this.render();
1643
+ this.out.write("\n");
1644
+ this.close();
1645
+ }
1646
+ }
1647
+ first() {
1648
+ this.cursor = 0;
1649
+ this.render();
1650
+ }
1651
+ last() {
1652
+ this.cursor = this.value.length - 1;
1653
+ this.render();
1654
+ }
1655
+ next() {
1656
+ this.cursor = (this.cursor + 1) % this.value.length;
1657
+ this.render();
1658
+ }
1659
+ up() {
1660
+ if (this.cursor === 0) {
1661
+ this.cursor = this.value.length - 1;
1662
+ } else {
1663
+ this.cursor--;
1664
+ }
1665
+ this.render();
1666
+ }
1667
+ down() {
1668
+ if (this.cursor === this.value.length - 1) {
1669
+ this.cursor = 0;
1670
+ } else {
1671
+ this.cursor++;
1672
+ }
1673
+ this.render();
1674
+ }
1675
+ left() {
1676
+ this.value[this.cursor].selected = false;
1677
+ this.render();
1678
+ }
1679
+ right() {
1680
+ if (this.value.filter((e) => e.selected).length >= this.maxChoices)
1681
+ return this.bell();
1682
+ this.value[this.cursor].selected = true;
1683
+ this.render();
1684
+ }
1685
+ handleSpaceToggle() {
1686
+ const v = this.value[this.cursor];
1687
+ if (v.selected) {
1688
+ v.selected = false;
1689
+ this.render();
1690
+ } else if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) {
1691
+ return this.bell();
1692
+ } else {
1693
+ v.selected = true;
1694
+ this.render();
1695
+ }
1696
+ }
1697
+ toggleAll() {
1698
+ if (this.maxChoices !== void 0 || this.value[this.cursor].disabled) {
1699
+ return this.bell();
1700
+ }
1701
+ const newSelected = !this.value[this.cursor].selected;
1702
+ this.value.filter((v) => !v.disabled).forEach((v) => v.selected = newSelected);
1703
+ this.render();
1704
+ }
1705
+ _(c, key) {
1706
+ if (c === " ") {
1707
+ this.handleSpaceToggle();
1708
+ } else if (c === "a") {
1709
+ this.toggleAll();
1710
+ } else {
1711
+ return this.bell();
1712
+ }
1713
+ }
1714
+ renderInstructions() {
1715
+ if (this.instructions === void 0 || this.instructions) {
1716
+ if (typeof this.instructions === "string") {
1717
+ return this.instructions;
1718
+ }
1719
+ return `
1720
+ Instructions:
1721
+ ${figures.arrowUp}/${figures.arrowDown}: Highlight option
1722
+ ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
1723
+ ` + (this.maxChoices === void 0 ? ` a: Toggle all
1724
+ ` : "") + ` enter/return: Complete answer`;
1725
+ }
1726
+ return "";
1727
+ }
1728
+ renderOption(cursor2, v, i, arrowIndicator) {
1729
+ const prefix = (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + arrowIndicator + " ";
1730
+ let title, desc;
1731
+ if (v.disabled) {
1732
+ title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
1733
+ } else {
1734
+ title = cursor2 === i ? color.cyan().underline(v.title) : v.title;
1735
+ if (cursor2 === i && v.description) {
1736
+ desc = ` - ${v.description}`;
1737
+ if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
1738
+ desc = "\n" + wrap(v.description, { margin: prefix.length, width: this.out.columns });
1739
+ }
1740
+ }
1741
+ }
1742
+ return prefix + title + color.gray(desc || "");
1743
+ }
1744
+ // shared with autocompleteMultiselect
1745
+ paginateOptions(options) {
1746
+ if (options.length === 0) {
1747
+ return color.red("No matches for this query.");
1748
+ }
1749
+ let { startIndex, endIndex } = entriesToDisplay(this.cursor, options.length, this.optionsPerPage);
1750
+ let prefix, styledOptions = [];
1751
+ for (let i = startIndex; i < endIndex; i++) {
1752
+ if (i === startIndex && startIndex > 0) {
1753
+ prefix = figures.arrowUp;
1754
+ } else if (i === endIndex - 1 && endIndex < options.length) {
1755
+ prefix = figures.arrowDown;
1756
+ } else {
1757
+ prefix = " ";
1758
+ }
1759
+ styledOptions.push(this.renderOption(this.cursor, options[i], i, prefix));
1760
+ }
1761
+ return "\n" + styledOptions.join("\n");
1762
+ }
1763
+ // shared with autocomleteMultiselect
1764
+ renderOptions(options) {
1765
+ if (!this.done) {
1766
+ return this.paginateOptions(options);
1767
+ }
1768
+ return "";
1769
+ }
1770
+ renderDoneOrInstructions() {
1771
+ if (this.done) {
1772
+ return this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
1773
+ }
1774
+ const output = [color.gray(this.hint), this.renderInstructions()];
1775
+ if (this.value[this.cursor].disabled) {
1776
+ output.push(color.yellow(this.warn));
1777
+ }
1778
+ return output.join(" ");
1779
+ }
1780
+ render() {
1781
+ if (this.closed)
1782
+ return;
1783
+ if (this.firstRender)
1784
+ this.out.write(cursor.hide);
1785
+ super.render();
1786
+ let prompt = [
1787
+ style.symbol(this.done, this.aborted),
1788
+ color.bold(this.msg),
1789
+ style.delimiter(false),
1790
+ this.renderDoneOrInstructions()
1791
+ ].join(" ");
1792
+ if (this.showMinError) {
1793
+ prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
1794
+ this.showMinError = false;
1795
+ }
1796
+ prompt += this.renderOptions(this.value);
1797
+ this.out.write(this.clear + prompt);
1798
+ this.clear = clear(prompt, this.out.columns);
1799
+ }
1800
+ };
1801
+ module.exports = MultiselectPrompt;
1802
+ }
1803
+ });
1804
+
1805
+ // node_modules/prompts/lib/elements/autocomplete.js
1806
+ var require_autocomplete = __commonJS({
1807
+ "node_modules/prompts/lib/elements/autocomplete.js"(exports, module) {
1808
+ "use strict";
1809
+ var color = require_kleur();
1810
+ var Prompt = require_prompt();
1811
+ var { erase, cursor } = require_src();
1812
+ var { style, clear, figures, wrap, entriesToDisplay } = require_util();
1813
+ var getVal = (arr, i) => arr[i] && (arr[i].value || arr[i].title || arr[i]);
1814
+ var getTitle = (arr, i) => arr[i] && (arr[i].title || arr[i].value || arr[i]);
1815
+ var getIndex = (arr, valOrTitle) => {
1816
+ const index = arr.findIndex((el) => el.value === valOrTitle || el.title === valOrTitle);
1817
+ return index > -1 ? index : void 0;
1818
+ };
1819
+ var AutocompletePrompt = class extends Prompt {
1820
+ constructor(opts = {}) {
1821
+ super(opts);
1822
+ this.msg = opts.message;
1823
+ this.suggest = opts.suggest;
1824
+ this.choices = opts.choices;
1825
+ this.initial = typeof opts.initial === "number" ? opts.initial : getIndex(opts.choices, opts.initial);
1826
+ this.select = this.initial || opts.cursor || 0;
1827
+ this.i18n = { noMatches: opts.noMatches || "no matches found" };
1828
+ this.fallback = opts.fallback || this.initial;
1829
+ this.clearFirst = opts.clearFirst || false;
1830
+ this.suggestions = [];
1831
+ this.input = "";
1832
+ this.limit = opts.limit || 10;
1833
+ this.cursor = 0;
1834
+ this.transform = style.render(opts.style);
1835
+ this.scale = this.transform.scale;
1836
+ this.render = this.render.bind(this);
1837
+ this.complete = this.complete.bind(this);
1838
+ this.clear = clear("", this.out.columns);
1839
+ this.complete(this.render);
1840
+ this.render();
1841
+ }
1842
+ set fallback(fb) {
1843
+ this._fb = Number.isSafeInteger(parseInt(fb)) ? parseInt(fb) : fb;
1844
+ }
1845
+ get fallback() {
1846
+ let choice;
1847
+ if (typeof this._fb === "number")
1848
+ choice = this.choices[this._fb];
1849
+ else if (typeof this._fb === "string")
1850
+ choice = { title: this._fb };
1851
+ return choice || this._fb || { title: this.i18n.noMatches };
1852
+ }
1853
+ moveSelect(i) {
1854
+ this.select = i;
1855
+ if (this.suggestions.length > 0)
1856
+ this.value = getVal(this.suggestions, i);
1857
+ else
1858
+ this.value = this.fallback.value;
1859
+ this.fire();
1860
+ }
1861
+ async complete(cb) {
1862
+ const p = this.completing = this.suggest(this.input, this.choices);
1863
+ const suggestions = await p;
1864
+ if (this.completing !== p)
1865
+ return;
1866
+ this.suggestions = suggestions.map((s, i, arr) => ({ title: getTitle(arr, i), value: getVal(arr, i), description: s.description }));
1867
+ this.completing = false;
1868
+ const l = Math.max(suggestions.length - 1, 0);
1869
+ this.moveSelect(Math.min(l, this.select));
1870
+ cb && cb();
1871
+ }
1872
+ reset() {
1873
+ this.input = "";
1874
+ this.complete(() => {
1875
+ this.moveSelect(this.initial !== void 0 ? this.initial : 0);
1876
+ this.render();
1877
+ });
1878
+ this.render();
1879
+ }
1880
+ exit() {
1881
+ if (this.clearFirst && this.input.length > 0) {
1882
+ this.reset();
1883
+ } else {
1884
+ this.done = this.exited = true;
1885
+ this.aborted = false;
1886
+ this.fire();
1887
+ this.render();
1888
+ this.out.write("\n");
1889
+ this.close();
1890
+ }
1891
+ }
1892
+ abort() {
1893
+ this.done = this.aborted = true;
1894
+ this.exited = false;
1895
+ this.fire();
1896
+ this.render();
1897
+ this.out.write("\n");
1898
+ this.close();
1899
+ }
1900
+ submit() {
1901
+ this.done = true;
1902
+ this.aborted = this.exited = false;
1903
+ this.fire();
1904
+ this.render();
1905
+ this.out.write("\n");
1906
+ this.close();
1907
+ }
1908
+ _(c, key) {
1909
+ let s1 = this.input.slice(0, this.cursor);
1910
+ let s2 = this.input.slice(this.cursor);
1911
+ this.input = `${s1}${c}${s2}`;
1912
+ this.cursor = s1.length + 1;
1913
+ this.complete(this.render);
1914
+ this.render();
1915
+ }
1916
+ delete() {
1917
+ if (this.cursor === 0)
1918
+ return this.bell();
1919
+ let s1 = this.input.slice(0, this.cursor - 1);
1920
+ let s2 = this.input.slice(this.cursor);
1921
+ this.input = `${s1}${s2}`;
1922
+ this.complete(this.render);
1923
+ this.cursor = this.cursor - 1;
1924
+ this.render();
1925
+ }
1926
+ deleteForward() {
1927
+ if (this.cursor * this.scale >= this.rendered.length)
1928
+ return this.bell();
1929
+ let s1 = this.input.slice(0, this.cursor);
1930
+ let s2 = this.input.slice(this.cursor + 1);
1931
+ this.input = `${s1}${s2}`;
1932
+ this.complete(this.render);
1933
+ this.render();
1934
+ }
1935
+ first() {
1936
+ this.moveSelect(0);
1937
+ this.render();
1938
+ }
1939
+ last() {
1940
+ this.moveSelect(this.suggestions.length - 1);
1941
+ this.render();
1942
+ }
1943
+ up() {
1944
+ if (this.select === 0) {
1945
+ this.moveSelect(this.suggestions.length - 1);
1946
+ } else {
1947
+ this.moveSelect(this.select - 1);
1948
+ }
1949
+ this.render();
1950
+ }
1951
+ down() {
1952
+ if (this.select === this.suggestions.length - 1) {
1953
+ this.moveSelect(0);
1954
+ } else {
1955
+ this.moveSelect(this.select + 1);
1956
+ }
1957
+ this.render();
1958
+ }
1959
+ next() {
1960
+ if (this.select === this.suggestions.length - 1) {
1961
+ this.moveSelect(0);
1962
+ } else
1963
+ this.moveSelect(this.select + 1);
1964
+ this.render();
1965
+ }
1966
+ nextPage() {
1967
+ this.moveSelect(Math.min(this.select + this.limit, this.suggestions.length - 1));
1968
+ this.render();
1969
+ }
1970
+ prevPage() {
1971
+ this.moveSelect(Math.max(this.select - this.limit, 0));
1972
+ this.render();
1973
+ }
1974
+ left() {
1975
+ if (this.cursor <= 0)
1976
+ return this.bell();
1977
+ this.cursor = this.cursor - 1;
1978
+ this.render();
1979
+ }
1980
+ right() {
1981
+ if (this.cursor * this.scale >= this.rendered.length)
1982
+ return this.bell();
1983
+ this.cursor = this.cursor + 1;
1984
+ this.render();
1985
+ }
1986
+ renderOption(v, hovered, isStart, isEnd) {
1987
+ let desc;
1988
+ let prefix = isStart ? figures.arrowUp : isEnd ? figures.arrowDown : " ";
1989
+ let title = hovered ? color.cyan().underline(v.title) : v.title;
1990
+ prefix = (hovered ? color.cyan(figures.pointer) + " " : " ") + prefix;
1991
+ if (v.description) {
1992
+ desc = ` - ${v.description}`;
1993
+ if (prefix.length + title.length + desc.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) {
1994
+ desc = "\n" + wrap(v.description, { margin: 3, width: this.out.columns });
1995
+ }
1996
+ }
1997
+ return prefix + " " + title + color.gray(desc || "");
1998
+ }
1999
+ render() {
2000
+ if (this.closed)
2001
+ return;
2002
+ if (this.firstRender)
2003
+ this.out.write(cursor.hide);
2004
+ else
2005
+ this.out.write(clear(this.outputText, this.out.columns));
2006
+ super.render();
2007
+ let { startIndex, endIndex } = entriesToDisplay(this.select, this.choices.length, this.limit);
2008
+ this.outputText = [
2009
+ style.symbol(this.done, this.aborted, this.exited),
2010
+ color.bold(this.msg),
2011
+ style.delimiter(this.completing),
2012
+ this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)
2013
+ ].join(" ");
2014
+ if (!this.done) {
2015
+ const suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(
2016
+ item,
2017
+ this.select === i + startIndex,
2018
+ i === 0 && startIndex > 0,
2019
+ i + startIndex === endIndex - 1 && endIndex < this.choices.length
2020
+ )).join("\n");
2021
+ this.outputText += `
2022
+ ` + (suggestions || color.gray(this.fallback.title));
2023
+ }
2024
+ this.out.write(erase.line + cursor.to(0) + this.outputText);
2025
+ }
2026
+ };
2027
+ module.exports = AutocompletePrompt;
2028
+ }
2029
+ });
2030
+
2031
+ // node_modules/prompts/lib/elements/autocompleteMultiselect.js
2032
+ var require_autocompleteMultiselect = __commonJS({
2033
+ "node_modules/prompts/lib/elements/autocompleteMultiselect.js"(exports, module) {
2034
+ "use strict";
2035
+ var color = require_kleur();
2036
+ var { cursor } = require_src();
2037
+ var MultiselectPrompt = require_multiselect();
2038
+ var { clear, style, figures } = require_util();
2039
+ var AutocompleteMultiselectPrompt = class extends MultiselectPrompt {
2040
+ constructor(opts = {}) {
2041
+ opts.overrideRender = true;
2042
+ super(opts);
2043
+ this.inputValue = "";
2044
+ this.clear = clear("", this.out.columns);
2045
+ this.filteredOptions = this.value;
2046
+ this.render();
2047
+ }
2048
+ last() {
2049
+ this.cursor = this.filteredOptions.length - 1;
2050
+ this.render();
2051
+ }
2052
+ next() {
2053
+ this.cursor = (this.cursor + 1) % this.filteredOptions.length;
2054
+ this.render();
2055
+ }
2056
+ up() {
2057
+ if (this.cursor === 0) {
2058
+ this.cursor = this.filteredOptions.length - 1;
2059
+ } else {
2060
+ this.cursor--;
2061
+ }
2062
+ this.render();
2063
+ }
2064
+ down() {
2065
+ if (this.cursor === this.filteredOptions.length - 1) {
2066
+ this.cursor = 0;
2067
+ } else {
2068
+ this.cursor++;
2069
+ }
2070
+ this.render();
2071
+ }
2072
+ left() {
2073
+ this.filteredOptions[this.cursor].selected = false;
2074
+ this.render();
2075
+ }
2076
+ right() {
2077
+ if (this.value.filter((e) => e.selected).length >= this.maxChoices)
2078
+ return this.bell();
2079
+ this.filteredOptions[this.cursor].selected = true;
2080
+ this.render();
2081
+ }
2082
+ delete() {
2083
+ if (this.inputValue.length) {
2084
+ this.inputValue = this.inputValue.substr(0, this.inputValue.length - 1);
2085
+ this.updateFilteredOptions();
2086
+ }
2087
+ }
2088
+ updateFilteredOptions() {
2089
+ const currentHighlight = this.filteredOptions[this.cursor];
2090
+ this.filteredOptions = this.value.filter((v) => {
2091
+ if (this.inputValue) {
2092
+ if (typeof v.title === "string") {
2093
+ if (v.title.toLowerCase().includes(this.inputValue.toLowerCase())) {
2094
+ return true;
2095
+ }
2096
+ }
2097
+ if (typeof v.value === "string") {
2098
+ if (v.value.toLowerCase().includes(this.inputValue.toLowerCase())) {
2099
+ return true;
2100
+ }
2101
+ }
2102
+ return false;
2103
+ }
2104
+ return true;
2105
+ });
2106
+ const newHighlightIndex = this.filteredOptions.findIndex((v) => v === currentHighlight);
2107
+ this.cursor = newHighlightIndex < 0 ? 0 : newHighlightIndex;
2108
+ this.render();
2109
+ }
2110
+ handleSpaceToggle() {
2111
+ const v = this.filteredOptions[this.cursor];
2112
+ if (v.selected) {
2113
+ v.selected = false;
2114
+ this.render();
2115
+ } else if (v.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) {
2116
+ return this.bell();
2117
+ } else {
2118
+ v.selected = true;
2119
+ this.render();
2120
+ }
2121
+ }
2122
+ handleInputChange(c) {
2123
+ this.inputValue = this.inputValue + c;
2124
+ this.updateFilteredOptions();
2125
+ }
2126
+ _(c, key) {
2127
+ if (c === " ") {
2128
+ this.handleSpaceToggle();
2129
+ } else {
2130
+ this.handleInputChange(c);
2131
+ }
2132
+ }
2133
+ renderInstructions() {
2134
+ if (this.instructions === void 0 || this.instructions) {
2135
+ if (typeof this.instructions === "string") {
2136
+ return this.instructions;
2137
+ }
2138
+ return `
2139
+ Instructions:
2140
+ ${figures.arrowUp}/${figures.arrowDown}: Highlight option
2141
+ ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
2142
+ [a,b,c]/delete: Filter choices
2143
+ enter/return: Complete answer
2144
+ `;
2145
+ }
2146
+ return "";
2147
+ }
2148
+ renderCurrentInput() {
2149
+ return `
2150
+ Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
2151
+ `;
2152
+ }
2153
+ renderOption(cursor2, v, i) {
2154
+ let title;
2155
+ if (v.disabled)
2156
+ title = cursor2 === i ? color.gray().underline(v.title) : color.strikethrough().gray(v.title);
2157
+ else
2158
+ title = cursor2 === i ? color.cyan().underline(v.title) : v.title;
2159
+ return (v.selected ? color.green(figures.radioOn) : figures.radioOff) + " " + title;
2160
+ }
2161
+ renderDoneOrInstructions() {
2162
+ if (this.done) {
2163
+ return this.value.filter((e) => e.selected).map((v) => v.title).join(", ");
2164
+ }
2165
+ const output = [color.gray(this.hint), this.renderInstructions(), this.renderCurrentInput()];
2166
+ if (this.filteredOptions.length && this.filteredOptions[this.cursor].disabled) {
2167
+ output.push(color.yellow(this.warn));
2168
+ }
2169
+ return output.join(" ");
2170
+ }
2171
+ render() {
2172
+ if (this.closed)
2173
+ return;
2174
+ if (this.firstRender)
2175
+ this.out.write(cursor.hide);
2176
+ super.render();
2177
+ let prompt = [
2178
+ style.symbol(this.done, this.aborted),
2179
+ color.bold(this.msg),
2180
+ style.delimiter(false),
2181
+ this.renderDoneOrInstructions()
2182
+ ].join(" ");
2183
+ if (this.showMinError) {
2184
+ prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
2185
+ this.showMinError = false;
2186
+ }
2187
+ prompt += this.renderOptions(this.filteredOptions);
2188
+ this.out.write(this.clear + prompt);
2189
+ this.clear = clear(prompt, this.out.columns);
2190
+ }
2191
+ };
2192
+ module.exports = AutocompleteMultiselectPrompt;
2193
+ }
2194
+ });
2195
+
2196
+ // node_modules/prompts/lib/elements/confirm.js
2197
+ var require_confirm = __commonJS({
2198
+ "node_modules/prompts/lib/elements/confirm.js"(exports, module) {
2199
+ var color = require_kleur();
2200
+ var Prompt = require_prompt();
2201
+ var { style, clear } = require_util();
2202
+ var { erase, cursor } = require_src();
2203
+ var ConfirmPrompt = class extends Prompt {
2204
+ constructor(opts = {}) {
2205
+ super(opts);
2206
+ this.msg = opts.message;
2207
+ this.value = opts.initial;
2208
+ this.initialValue = !!opts.initial;
2209
+ this.yesMsg = opts.yes || "yes";
2210
+ this.yesOption = opts.yesOption || "(Y/n)";
2211
+ this.noMsg = opts.no || "no";
2212
+ this.noOption = opts.noOption || "(y/N)";
2213
+ this.render();
2214
+ }
2215
+ reset() {
2216
+ this.value = this.initialValue;
2217
+ this.fire();
2218
+ this.render();
2219
+ }
2220
+ exit() {
2221
+ this.abort();
2222
+ }
2223
+ abort() {
2224
+ this.done = this.aborted = true;
2225
+ this.fire();
2226
+ this.render();
2227
+ this.out.write("\n");
2228
+ this.close();
2229
+ }
2230
+ submit() {
2231
+ this.value = this.value || false;
2232
+ this.done = true;
2233
+ this.aborted = false;
2234
+ this.fire();
2235
+ this.render();
2236
+ this.out.write("\n");
2237
+ this.close();
2238
+ }
2239
+ _(c, key) {
2240
+ if (c.toLowerCase() === "y") {
2241
+ this.value = true;
2242
+ return this.submit();
2243
+ }
2244
+ if (c.toLowerCase() === "n") {
2245
+ this.value = false;
2246
+ return this.submit();
2247
+ }
2248
+ return this.bell();
2249
+ }
2250
+ render() {
2251
+ if (this.closed)
2252
+ return;
2253
+ if (this.firstRender)
2254
+ this.out.write(cursor.hide);
2255
+ else
2256
+ this.out.write(clear(this.outputText, this.out.columns));
2257
+ super.render();
2258
+ this.outputText = [
2259
+ style.symbol(this.done, this.aborted),
2260
+ color.bold(this.msg),
2261
+ style.delimiter(this.done),
2262
+ this.done ? this.value ? this.yesMsg : this.noMsg : color.gray(this.initialValue ? this.yesOption : this.noOption)
2263
+ ].join(" ");
2264
+ this.out.write(erase.line + cursor.to(0) + this.outputText);
2265
+ }
2266
+ };
2267
+ module.exports = ConfirmPrompt;
2268
+ }
2269
+ });
2270
+
2271
+ // node_modules/prompts/lib/elements/index.js
2272
+ var require_elements = __commonJS({
2273
+ "node_modules/prompts/lib/elements/index.js"(exports, module) {
2274
+ "use strict";
2275
+ module.exports = {
2276
+ TextPrompt: require_text(),
2277
+ SelectPrompt: require_select(),
2278
+ TogglePrompt: require_toggle(),
2279
+ DatePrompt: require_date(),
2280
+ NumberPrompt: require_number(),
2281
+ MultiselectPrompt: require_multiselect(),
2282
+ AutocompletePrompt: require_autocomplete(),
2283
+ AutocompleteMultiselectPrompt: require_autocompleteMultiselect(),
2284
+ ConfirmPrompt: require_confirm()
2285
+ };
2286
+ }
2287
+ });
2288
+
2289
+ // node_modules/prompts/lib/prompts.js
2290
+ var require_prompts = __commonJS({
2291
+ "node_modules/prompts/lib/prompts.js"(exports) {
2292
+ "use strict";
2293
+ var $ = exports;
2294
+ var el = require_elements();
2295
+ var noop = (v) => v;
2296
+ function toPrompt(type, args, opts = {}) {
2297
+ return new Promise((res, rej) => {
2298
+ const p = new el[type](args);
2299
+ const onAbort = opts.onAbort || noop;
2300
+ const onSubmit = opts.onSubmit || noop;
2301
+ const onExit = opts.onExit || noop;
2302
+ p.on("state", args.onState || noop);
2303
+ p.on("submit", (x) => res(onSubmit(x)));
2304
+ p.on("exit", (x) => res(onExit(x)));
2305
+ p.on("abort", (x) => rej(onAbort(x)));
2306
+ });
2307
+ }
2308
+ $.text = (args) => toPrompt("TextPrompt", args);
2309
+ $.password = (args) => {
2310
+ args.style = "password";
2311
+ return $.text(args);
2312
+ };
2313
+ $.invisible = (args) => {
2314
+ args.style = "invisible";
2315
+ return $.text(args);
2316
+ };
2317
+ $.number = (args) => toPrompt("NumberPrompt", args);
2318
+ $.date = (args) => toPrompt("DatePrompt", args);
2319
+ $.confirm = (args) => toPrompt("ConfirmPrompt", args);
2320
+ $.list = (args) => {
2321
+ const sep = args.separator || ",";
2322
+ return toPrompt("TextPrompt", args, {
2323
+ onSubmit: (str) => str.split(sep).map((s) => s.trim())
2324
+ });
2325
+ };
2326
+ $.toggle = (args) => toPrompt("TogglePrompt", args);
2327
+ $.select = (args) => toPrompt("SelectPrompt", args);
2328
+ $.multiselect = (args) => {
2329
+ args.choices = [].concat(args.choices || []);
2330
+ const toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
2331
+ return toPrompt("MultiselectPrompt", args, {
2332
+ onAbort: toSelected,
2333
+ onSubmit: toSelected
2334
+ });
2335
+ };
2336
+ $.autocompleteMultiselect = (args) => {
2337
+ args.choices = [].concat(args.choices || []);
2338
+ const toSelected = (items) => items.filter((item) => item.selected).map((item) => item.value);
2339
+ return toPrompt("AutocompleteMultiselectPrompt", args, {
2340
+ onAbort: toSelected,
2341
+ onSubmit: toSelected
2342
+ });
2343
+ };
2344
+ var byTitle = (input, choices) => Promise.resolve(
2345
+ choices.filter((item) => item.title.slice(0, input.length).toLowerCase() === input.toLowerCase())
2346
+ );
2347
+ $.autocomplete = (args) => {
2348
+ args.suggest = args.suggest || byTitle;
2349
+ args.choices = [].concat(args.choices || []);
2350
+ return toPrompt("AutocompletePrompt", args);
2351
+ };
2352
+ }
2353
+ });
2354
+
2355
+ // node_modules/prompts/lib/index.js
2356
+ var require_lib = __commonJS({
2357
+ "node_modules/prompts/lib/index.js"(exports, module) {
2358
+ "use strict";
2359
+ var prompts = require_prompts();
2360
+ var passOn = ["suggest", "format", "onState", "validate", "onRender", "type"];
2361
+ var noop = () => {
2362
+ };
2363
+ async function prompt(questions = [], { onSubmit = noop, onCancel = noop } = {}) {
2364
+ const answers = {};
2365
+ const override2 = prompt._override || {};
2366
+ questions = [].concat(questions);
2367
+ let answer, question, quit, name, type, lastPrompt;
2368
+ const getFormattedAnswer = async (question2, answer2, skipValidation = false) => {
2369
+ if (!skipValidation && question2.validate && question2.validate(answer2) !== true) {
2370
+ return;
2371
+ }
2372
+ return question2.format ? await question2.format(answer2, answers) : answer2;
2373
+ };
2374
+ for (question of questions) {
2375
+ ({ name, type } = question);
2376
+ if (typeof type === "function") {
2377
+ type = await type(answer, { ...answers }, question);
2378
+ question["type"] = type;
2379
+ }
2380
+ if (!type)
2381
+ continue;
2382
+ for (let key in question) {
2383
+ if (passOn.includes(key))
2384
+ continue;
2385
+ let value = question[key];
2386
+ question[key] = typeof value === "function" ? await value(answer, { ...answers }, lastPrompt) : value;
2387
+ }
2388
+ lastPrompt = question;
2389
+ if (typeof question.message !== "string") {
2390
+ throw new Error("prompt message is required");
2391
+ }
2392
+ ({ name, type } = question);
2393
+ if (prompts[type] === void 0) {
2394
+ throw new Error(`prompt type (${type}) is not defined`);
2395
+ }
2396
+ if (override2[question.name] !== void 0) {
2397
+ answer = await getFormattedAnswer(question, override2[question.name]);
2398
+ if (answer !== void 0) {
2399
+ answers[name] = answer;
2400
+ continue;
2401
+ }
2402
+ }
2403
+ try {
2404
+ answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : await prompts[type](question);
2405
+ answers[name] = answer = await getFormattedAnswer(question, answer, true);
2406
+ quit = await onSubmit(question, answer, answers);
2407
+ } catch (err2) {
2408
+ quit = !await onCancel(question, answers);
2409
+ }
2410
+ if (quit)
2411
+ return answers;
2412
+ }
2413
+ return answers;
2414
+ }
2415
+ function getInjectedAnswer(injected, deafultValue) {
2416
+ const answer = injected.shift();
2417
+ if (answer instanceof Error) {
2418
+ throw answer;
2419
+ }
2420
+ return answer === void 0 ? deafultValue : answer;
2421
+ }
2422
+ function inject(answers) {
2423
+ prompt._injected = (prompt._injected || []).concat(answers);
2424
+ }
2425
+ function override(answers) {
2426
+ prompt._override = Object.assign({}, answers);
2427
+ }
2428
+ module.exports = Object.assign(prompt, { prompt, prompts, inject, override });
2429
+ }
2430
+ });
9
2431
 
10
2432
  // src/cli/config-flags.ts
11
2433
  var BOOLEAN_CLI_FLAGS = [
@@ -1279,7 +3701,7 @@ var taskGenerate = async (config) => {
1279
3701
  config.logger.error(`Rindo's srcDir was not specified.`);
1280
3702
  return config.sys.exit(1);
1281
3703
  }
1282
- const { prompt } = await import("../sys/node/prompts.js");
3704
+ const { prompt } = await Promise.resolve().then(() => __toESM(require_lib()));
1283
3705
  const input = config.flags.unknownArgs.find((arg) => !arg.startsWith("-")) || (await prompt({ name: "tagName", type: "text", message: "Component tag name (dash-case):" })).tagName;
1284
3706
  if (void 0 === input) {
1285
3707
  return;
@@ -1319,7 +3741,7 @@ var taskGenerate = async (config) => {
1319
3741
  writtenFiles.map((file) => console.log(` - ${relative(absoluteRootDir, file)}`));
1320
3742
  };
1321
3743
  var chooseFilesToGenerate = async () => {
1322
- const { prompt } = await import("../sys/node/prompts.js");
3744
+ const { prompt } = await Promise.resolve().then(() => __toESM(require_lib()));
1323
3745
  return (await prompt({
1324
3746
  name: "filesToGenerate",
1325
3747
  type: "multiselect",