npm-check-updates
Version:
Find newer versions of dependencies than what your package.json allows
1,234 lines • 1.78 MB
JavaScript
import { a as mt, i as ge, n as Ft, o as xt, r as yt, t as P } from "./chunks/chunk-Njdj7H0c.js";
import { n as em, t as tm } from "./chunks/_stub_typescript-gMx00gpr.js";
import { n as ch, t as uh } from "./chunks/p-map-OzxwbPLg.js";
import { createRequire as rm } from "node:module";
import We from "path";
import zr from "fs";
import Zr from "os";
import im from "util";
import Qe from "fs/promises";
import Ui from "node:process";
import Ri from "node:os";
import pc from "node:tty";
import { URL as nm } from "url";
import ot, { dirname as sm } from "node:path";
import { fileURLToPath as jo } from "node:url";
import { promisify as hh, stripVTControlCharacters as am } from "node:util";
import aa, { promises as gc } from "node:fs";
import om, { execFile as lm } from "node:child_process";
import { text as cm } from "node:stream/consumers";
var Gt = /* @__PURE__ */ P(((e, t) => {
var r, i, n, h, a = !0;
typeof process < "u" && ({ FORCE_COLOR: r, NODE_DISABLE_COLORS: i, NO_COLOR: n, TERM: h } = process.env || {}, a = process.stdout && process.stdout.isTTY);
var s = {
enabled: !i && n == null && h !== "dumb" && (r != null && r !== "0" || a),
reset: f(0, 0),
bold: f(1, 22),
dim: f(2, 22),
italic: f(3, 23),
underline: f(4, 24),
inverse: f(7, 27),
hidden: f(8, 28),
strikethrough: f(9, 29),
black: f(30, 39),
red: f(31, 39),
green: f(32, 39),
yellow: f(33, 39),
blue: f(34, 39),
magenta: f(35, 39),
cyan: f(36, 39),
white: f(37, 39),
gray: f(90, 39),
grey: f(90, 39),
bgBlack: f(40, 49),
bgRed: f(41, 49),
bgGreen: f(42, 49),
bgYellow: f(43, 49),
bgBlue: f(44, 49),
bgMagenta: f(45, 49),
bgCyan: f(46, 49),
bgWhite: f(47, 49)
};
function u(o, c) {
let d = 0, p, m = "", g = "";
for (; d < o.length; d++)
p = o[d], m += p.open, g += p.close, ~c.indexOf(p.close) && (c = c.replace(p.rgx, p.close + p.open));
return m + c + g;
}
function l(o, c) {
let d = {
has: o,
keys: c
};
return d.reset = s.reset.bind(d), d.bold = s.bold.bind(d), d.dim = s.dim.bind(d), d.italic = s.italic.bind(d), d.underline = s.underline.bind(d), d.inverse = s.inverse.bind(d), d.hidden = s.hidden.bind(d), d.strikethrough = s.strikethrough.bind(d), d.black = s.black.bind(d), d.red = s.red.bind(d), d.green = s.green.bind(d), d.yellow = s.yellow.bind(d), d.blue = s.blue.bind(d), d.magenta = s.magenta.bind(d), d.cyan = s.cyan.bind(d), d.white = s.white.bind(d), d.gray = s.gray.bind(d), d.grey = s.grey.bind(d), d.bgBlack = s.bgBlack.bind(d), d.bgRed = s.bgRed.bind(d), d.bgGreen = s.bgGreen.bind(d), d.bgYellow = s.bgYellow.bind(d), d.bgBlue = s.bgBlue.bind(d), d.bgMagenta = s.bgMagenta.bind(d), d.bgCyan = s.bgCyan.bind(d), d.bgWhite = s.bgWhite.bind(d), d;
}
function f(o, c) {
let d = {
open: `\x1B[${o}m`,
close: `\x1B[${c}m`,
rgx: new RegExp(`\\x1b\\[${c}m`, "g")
};
return function(p) {
return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(o) || (this.has.push(o), this.keys.push(d)), p === void 0 ? this : s.enabled ? u(this.keys, p + "") : p + "") : p === void 0 ? l([o], [d]) : s.enabled ? u([d], p + "") : p + "";
};
}
t.exports = s;
})), um = /* @__PURE__ */ P(((e, t) => {
t.exports = (r, i) => {
if (!(r.meta && r.name !== "escape")) {
if (r.ctrl) {
if (r.name === "a") return "first";
if (r.name === "c" || r.name === "d") return "abort";
if (r.name === "e") return "last";
if (r.name === "g") return "reset";
}
if (i) {
if (r.name === "j") return "down";
if (r.name === "k") return "up";
}
return r.name === "return" || r.name === "enter" ? "submit" : r.name === "backspace" ? "delete" : r.name === "delete" ? "deleteForward" : r.name === "abort" ? "abort" : r.name === "escape" ? "exit" : r.name === "tab" ? "next" : r.name === "pagedown" ? "nextPage" : r.name === "pageup" ? "prevPage" : r.name === "home" ? "home" : r.name === "end" ? "end" : r.name === "up" ? "up" : r.name === "down" ? "down" : r.name === "right" ? "right" : r.name === "left" ? "left" : !1;
}
};
})), Uo = /* @__PURE__ */ P(((e, t) => {
t.exports = (r) => {
const i = ["[\\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("|"), n = new RegExp(i, "g");
return typeof r == "string" ? r.replace(n, "") : r;
};
})), zt = /* @__PURE__ */ P(((e, t) => {
var r = "\x1B", i = `${r}[`, n = "\x07", h = {
to(u, l) {
return l ? `${i}${l + 1};${u + 1}H` : `${i}${u + 1}G`;
},
move(u, l) {
let f = "";
return u < 0 ? f += `${i}${-u}D` : u > 0 && (f += `${i}${u}C`), l < 0 ? f += `${i}${-l}A` : l > 0 && (f += `${i}${l}B`), f;
},
up: (u = 1) => `${i}${u}A`,
down: (u = 1) => `${i}${u}B`,
forward: (u = 1) => `${i}${u}C`,
backward: (u = 1) => `${i}${u}D`,
nextLine: (u = 1) => `${i}E`.repeat(u),
prevLine: (u = 1) => `${i}F`.repeat(u),
left: `${i}G`,
hide: `${i}?25l`,
show: `${i}?25h`,
save: `${r}7`,
restore: `${r}8`
}, a = {
up: (u = 1) => `${i}S`.repeat(u),
down: (u = 1) => `${i}T`.repeat(u)
}, s = {
screen: `${i}2J`,
up: (u = 1) => `${i}1J`.repeat(u),
down: (u = 1) => `${i}J`.repeat(u),
line: `${i}2K`,
lineEnd: `${i}K`,
lineStart: `${i}1K`,
lines(u) {
let l = "";
for (let f = 0; f < u; f++) l += this.line + (f < u - 1 ? h.up() : "");
return u && (l += h.left), l;
}
};
t.exports = {
cursor: h,
scroll: a,
erase: s,
beep: n
};
})), hm = /* @__PURE__ */ P(((e, t) => {
var r = Uo(), { erase: i, cursor: n } = zt(), h = (a) => [...r(a)].length;
t.exports = function(a, s) {
if (!s) return i.line + n.to(0);
let u = 0;
const l = a.split(/\r?\n/);
for (let f of l) u += 1 + Math.floor(Math.max(h(f) - 1, 0) / s);
return i.lines(u);
};
})), fh = /* @__PURE__ */ P(((e, t) => {
var r = {
arrowUp: "↑",
arrowDown: "↓",
arrowLeft: "←",
arrowRight: "→",
radioOn: "◉",
radioOff: "◯",
tick: "✔",
cross: "✖",
ellipsis: "…",
pointerSmall: "›",
line: "─",
pointer: "❯"
}, i = {
arrowUp: r.arrowUp,
arrowDown: r.arrowDown,
arrowLeft: r.arrowLeft,
arrowRight: r.arrowRight,
radioOn: "(*)",
radioOff: "( )",
tick: "√",
cross: "×",
ellipsis: "...",
pointerSmall: "»",
line: "─",
pointer: ">"
}, n = process.platform === "win32" ? i : r;
t.exports = n;
})), fm = /* @__PURE__ */ P(((e, t) => {
var r = Gt(), i = fh(), n = Object.freeze({
password: {
scale: 1,
render: (f) => "*".repeat(f.length)
},
emoji: {
scale: 2,
render: (f) => "😃".repeat(f.length)
},
invisible: {
scale: 0,
render: (f) => ""
},
default: {
scale: 1,
render: (f) => `${f}`
}
}), h = (f) => n[f] || n.default, a = Object.freeze({
aborted: r.red(i.cross),
done: r.green(i.tick),
exited: r.yellow(i.cross),
default: r.cyan("?")
}), s = (f, o, c) => o ? a.aborted : c ? a.exited : f ? a.done : a.default, u = (f) => r.gray(f ? i.ellipsis : i.pointerSmall), l = (f, o) => r.gray(f ? o ? i.pointerSmall : "+" : i.line);
t.exports = {
styles: n,
render: h,
symbols: a,
symbol: s,
delimiter: u,
item: l
};
})), dm = /* @__PURE__ */ P(((e, t) => {
var r = Uo();
t.exports = function(i, n) {
let h = String(r(i) || "").split(/\r?\n/);
return n ? h.map((a) => Math.ceil(a.length / n)).reduce((a, s) => a + s) : h.length;
};
})), pm = /* @__PURE__ */ P(((e, t) => {
t.exports = (r, i = {}) => {
const n = Number.isSafeInteger(parseInt(i.margin)) ? new Array(parseInt(i.margin)).fill(" ").join("") : i.margin || "", h = i.width;
return (r || "").split(/\r?\n/g).map((a) => a.split(/\s+/g).reduce((s, u) => (u.length + n.length >= h || s[s.length - 1].length + u.length + 1 < h ? s[s.length - 1] += ` ${u}` : s.push(`${n}${u}`), s), [n]).join(`
`)).join(`
`);
};
})), gm = /* @__PURE__ */ P(((e, t) => {
t.exports = (r, i, n) => {
n = n || i;
let h = Math.min(i - n, r - Math.floor(n / 2));
h < 0 && (h = 0);
let a = Math.min(h + n, i);
return {
startIndex: h,
endIndex: a
};
};
})), er = /* @__PURE__ */ P(((e, t) => {
t.exports = {
action: um(),
clear: hm(),
style: fm(),
strip: Uo(),
figures: fh(),
lines: dm(),
wrap: pm(),
entriesToDisplay: gm()
};
})), fr = /* @__PURE__ */ P(((e, t) => {
var r = ge("readline"), { action: i } = er(), n = ge("events"), { beep: h, cursor: a } = zt(), s = Gt(), u = class extends n {
constructor(l = {}) {
super(), this.firstRender = !0, this.in = l.stdin || process.stdin, this.out = l.stdout || process.stdout, this.onRender = (l.onRender || (() => {
})).bind(this);
const f = r.createInterface({
input: this.in,
escapeCodeTimeout: 50
});
r.emitKeypressEvents(this.in, f), this.in.isTTY && this.in.setRawMode(!0);
const o = (c, d) => {
let p = i(d, this.isSelect);
p === !1 ? this._ && this._(c, d) : typeof this[p] == "function" ? this[p](d) : this.bell();
};
this.close = () => {
this.out.write(a.show), this.in.removeListener("keypress", o), this.in.isTTY && this.in.setRawMode(!1), f.close(), this.emit(this.aborted ? "abort" : this.exited ? "exit" : "submit", this.value), this.closed = !0;
}, this.in.on("keypress", o);
}
fire() {
this.emit("state", {
value: this.value,
aborted: !!this.aborted,
exited: !!this.exited
});
}
bell() {
this.out.write(h);
}
render() {
this.onRender(s), this.firstRender && (this.firstRender = !1);
}
};
t.exports = u;
})), mm = /* @__PURE__ */ P(((e, t) => {
var r = Gt(), i = fr(), { erase: n, cursor: h } = zt(), { style: a, clear: s, lines: u, figures: l } = er(), f = class extends i {
constructor(o = {}) {
super(o), this.transform = a.render(o.style), this.scale = this.transform.scale, this.msg = o.message, this.initial = o.initial || "", this.validator = o.validate || (() => !0), this.value = "", this.errorMsg = o.error || "Please Enter A Valid Value", this.cursor = +!!this.initial, this.cursorOffset = 0, this.clear = s("", this.out.columns), this.render();
}
set value(o) {
!o && this.initial ? (this.placeholder = !0, this.rendered = r.gray(this.transform.render(this.initial))) : (this.placeholder = !1, this.rendered = this.transform.render(o)), this._value = o, this.fire();
}
get value() {
return this._value;
}
reset() {
this.value = "", this.cursor = +!!this.initial, this.cursorOffset = 0, this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
this.value = this.value || this.initial, this.done = this.aborted = !0, this.error = !1, this.red = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
async validate() {
let o = await this.validator(this.value);
typeof o == "string" && (this.errorMsg = o, o = !1), this.error = !o;
}
async submit() {
if (this.value = this.value || this.initial, this.cursorOffset = 0, this.cursor = this.rendered.length, await this.validate(), this.error) {
this.red = !0, this.fire(), this.render();
return;
}
this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
next() {
if (!this.placeholder) return this.bell();
this.value = this.initial, this.cursor = this.rendered.length, this.fire(), this.render();
}
moveCursor(o) {
this.placeholder || (this.cursor = this.cursor + o, this.cursorOffset += o);
}
_(o, c) {
let d = this.value.slice(0, this.cursor), p = this.value.slice(this.cursor);
this.value = `${d}${o}${p}`, this.red = !1, this.cursor = this.placeholder ? 0 : d.length + 1, this.render();
}
delete() {
if (this.isCursorAtStart()) return this.bell();
let o = this.value.slice(0, this.cursor - 1), c = this.value.slice(this.cursor);
this.value = `${o}${c}`, this.red = !1, this.isCursorAtStart() ? this.cursorOffset = 0 : (this.cursorOffset++, this.moveCursor(-1)), this.render();
}
deleteForward() {
if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();
let o = this.value.slice(0, this.cursor), c = this.value.slice(this.cursor + 1);
this.value = `${o}${c}`, this.red = !1, this.isCursorAtEnd() ? this.cursorOffset = 0 : this.cursorOffset++, this.render();
}
first() {
this.cursor = 0, this.render();
}
last() {
this.cursor = this.value.length, this.render();
}
left() {
if (this.cursor <= 0 || this.placeholder) return this.bell();
this.moveCursor(-1), this.render();
}
right() {
if (this.cursor * this.scale >= this.rendered.length || this.placeholder) return this.bell();
this.moveCursor(1), this.render();
}
isCursorAtStart() {
return this.cursor === 0 || this.placeholder && this.cursor === 1;
}
isCursorAtEnd() {
return this.cursor === this.rendered.length || this.placeholder && this.cursor === this.rendered.length + 1;
}
render() {
this.closed || (this.firstRender || (this.outputError && this.out.write(h.down(u(this.outputError, this.out.columns) - 1) + s(this.outputError, this.out.columns)), this.out.write(s(this.outputText, this.out.columns))), super.render(), this.outputError = "", this.outputText = [
a.symbol(this.done, this.aborted),
r.bold(this.msg),
a.delimiter(this.done),
this.red ? r.red(this.rendered) : this.rendered
].join(" "), this.error && (this.outputError += this.errorMsg.split(`
`).reduce((o, c, d) => o + `
${d ? " " : l.pointerSmall} ${r.red().italic(c)}`, "")), this.out.write(n.line + h.to(0) + this.outputText + h.save + this.outputError + h.restore + h.move(this.cursorOffset, 0)));
}
};
t.exports = f;
})), vm = /* @__PURE__ */ P(((e, t) => {
var r = Gt(), i = fr(), { style: n, clear: h, figures: a, wrap: s, entriesToDisplay: u } = er(), { cursor: l } = zt(), f = class extends i {
constructor(o = {}) {
super(o), this.isSelect = !0, this.msg = o.message, this.hint = o.hint || "- Use arrow-keys. Return to submit.", this.warn = o.warn || "- This option is disabled", this.cursor = o.initial || 0, this.choices = o.choices.map((c, d) => (typeof c == "string" && (c = {
title: c,
value: d
}), {
title: c && (c.title || c.value || c),
value: c && (c.value === void 0 ? d : c.value),
description: c && c.description,
selected: c && c.selected,
disabled: c && c.disabled
})), this.optionsPerPage = o.optionsPerPage || 10, this.value = (this.choices[this.cursor] || {}).value, this.clear = h("", this.out.columns), this.render();
}
moveCursor(o) {
this.cursor = o, this.value = this.choices[o].value, this.fire();
}
reset() {
this.moveCursor(0), this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
`), this.close();
}
submit() {
this.selection.disabled ? this.bell() : (this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close());
}
first() {
this.moveCursor(0), this.render();
}
last() {
this.moveCursor(this.choices.length - 1), this.render();
}
up() {
this.cursor === 0 ? this.moveCursor(this.choices.length - 1) : this.moveCursor(this.cursor - 1), this.render();
}
down() {
this.cursor === this.choices.length - 1 ? this.moveCursor(0) : this.moveCursor(this.cursor + 1), this.render();
}
next() {
this.moveCursor((this.cursor + 1) % this.choices.length), this.render();
}
_(o, c) {
if (o === " ") return this.submit();
}
get selection() {
return this.choices[this.cursor];
}
render() {
if (this.closed) return;
this.firstRender ? this.out.write(l.hide) : this.out.write(h(this.outputText, this.out.columns)), super.render();
let { startIndex: o, endIndex: c } = u(this.cursor, this.choices.length, this.optionsPerPage);
if (this.outputText = [
n.symbol(this.done, this.aborted),
r.bold(this.msg),
n.delimiter(!1),
this.done ? this.selection.title : this.selection.disabled ? r.yellow(this.warn) : r.gray(this.hint)
].join(" "), !this.done) {
this.outputText += `
`;
for (let d = o; d < c; d++) {
let p, m, g = "", v = this.choices[d];
d === o && o > 0 ? m = a.arrowUp : d === c - 1 && c < this.choices.length ? m = a.arrowDown : m = " ", v.disabled ? (p = this.cursor === d ? r.gray().underline(v.title) : r.strikethrough().gray(v.title), m = (this.cursor === d ? r.bold().gray(a.pointer) + " " : " ") + m) : (p = this.cursor === d ? r.cyan().underline(v.title) : v.title, m = (this.cursor === d ? r.cyan(a.pointer) + " " : " ") + m, v.description && this.cursor === d && (g = ` - ${v.description}`, (m.length + p.length + g.length >= this.out.columns || v.description.split(/\r?\n/).length > 1) && (g = `
` + s(v.description, {
margin: 3,
width: this.out.columns
})))), this.outputText += `${m} ${p}${r.gray(g)}
`;
}
}
this.out.write(this.outputText);
}
};
t.exports = f;
})), ym = /* @__PURE__ */ P(((e, t) => {
var r = Gt(), i = fr(), { style: n, clear: h } = er(), { cursor: a, erase: s } = zt(), u = class extends i {
constructor(l = {}) {
super(l), this.msg = l.message, this.value = !!l.initial, this.active = l.active || "on", this.inactive = l.inactive || "off", this.initialValue = this.value, this.render();
}
reset() {
this.value = this.initialValue, this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
`), this.close();
}
submit() {
this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
deactivate() {
if (this.value === !1) return this.bell();
this.value = !1, this.render();
}
activate() {
if (this.value === !0) return this.bell();
this.value = !0, this.render();
}
delete() {
this.deactivate();
}
left() {
this.deactivate();
}
right() {
this.activate();
}
down() {
this.deactivate();
}
up() {
this.activate();
}
next() {
this.value = !this.value, this.fire(), this.render();
}
_(l, f) {
if (l === " ") this.value = !this.value;
else if (l === "1") this.value = !0;
else if (l === "0") this.value = !1;
else return this.bell();
this.render();
}
render() {
this.closed || (this.firstRender ? this.out.write(a.hide) : this.out.write(h(this.outputText, this.out.columns)), super.render(), this.outputText = [
n.symbol(this.done, this.aborted),
r.bold(this.msg),
n.delimiter(this.done),
this.value ? this.inactive : r.cyan().underline(this.inactive),
r.gray("/"),
this.value ? r.cyan().underline(this.active) : this.active
].join(" "), this.out.write(s.line + a.to(0) + this.outputText));
}
};
t.exports = u;
})), ar = /* @__PURE__ */ P(((e, t) => {
var r = class oa {
constructor({ token: n, date: h, parts: a, locales: s }) {
this.token = n, this.date = h || /* @__PURE__ */ new Date(), this.parts = a || [this], this.locales = s || {};
}
up() {
}
down() {
}
next() {
const n = this.parts.indexOf(this);
return this.parts.find((h, a) => a > n && h instanceof oa);
}
setTo(n) {
}
prev() {
let n = [].concat(this.parts).reverse();
const h = n.indexOf(this);
return n.find((a, s) => s > h && a instanceof oa);
}
toString() {
return String(this.date);
}
};
t.exports = r;
})), _m = /* @__PURE__ */ P(((e, t) => {
var r = ar(), i = class extends r {
constructor(n = {}) {
super(n);
}
up() {
this.date.setHours((this.date.getHours() + 12) % 24);
}
down() {
this.up();
}
toString() {
let n = this.date.getHours() > 12 ? "pm" : "am";
return /\A/.test(this.token) ? n.toUpperCase() : n;
}
};
t.exports = i;
})), bm = /* @__PURE__ */ P(((e, t) => {
var r = ar(), i = (h) => (h = h % 10, h === 1 ? "st" : h === 2 ? "nd" : h === 3 ? "rd" : "th"), n = class extends r {
constructor(h = {}) {
super(h);
}
up() {
this.date.setDate(this.date.getDate() + 1);
}
down() {
this.date.setDate(this.date.getDate() - 1);
}
setTo(h) {
this.date.setDate(parseInt(h.substr(-2)));
}
toString() {
let h = this.date.getDate(), a = this.date.getDay();
return this.token === "DD" ? String(h).padStart(2, "0") : this.token === "Do" ? h + i(h) : this.token === "d" ? a + 1 : this.token === "ddd" ? this.locales.weekdaysShort[a] : this.token === "dddd" ? this.locales.weekdays[a] : h;
}
};
t.exports = n;
})), wm = /* @__PURE__ */ P(((e, t) => {
var r = ar(), i = class extends r {
constructor(n = {}) {
super(n);
}
up() {
this.date.setHours(this.date.getHours() + 1);
}
down() {
this.date.setHours(this.date.getHours() - 1);
}
setTo(n) {
this.date.setHours(parseInt(n.substr(-2)));
}
toString() {
let n = this.date.getHours();
return /h/.test(this.token) && (n = n % 12 || 12), this.token.length > 1 ? String(n).padStart(2, "0") : n;
}
};
t.exports = i;
})), Em = /* @__PURE__ */ P(((e, t) => {
var r = ar(), i = class extends r {
constructor(n = {}) {
super(n);
}
up() {
this.date.setMilliseconds(this.date.getMilliseconds() + 1);
}
down() {
this.date.setMilliseconds(this.date.getMilliseconds() - 1);
}
setTo(n) {
this.date.setMilliseconds(parseInt(n.substr(-this.token.length)));
}
toString() {
return String(this.date.getMilliseconds()).padStart(4, "0").substr(0, this.token.length);
}
};
t.exports = i;
})), Sm = /* @__PURE__ */ P(((e, t) => {
var r = ar(), i = class extends r {
constructor(n = {}) {
super(n);
}
up() {
this.date.setMinutes(this.date.getMinutes() + 1);
}
down() {
this.date.setMinutes(this.date.getMinutes() - 1);
}
setTo(n) {
this.date.setMinutes(parseInt(n.substr(-2)));
}
toString() {
let n = this.date.getMinutes();
return this.token.length > 1 ? String(n).padStart(2, "0") : n;
}
};
t.exports = i;
})), Am = /* @__PURE__ */ P(((e, t) => {
var r = ar(), i = class extends r {
constructor(n = {}) {
super(n);
}
up() {
this.date.setMonth(this.date.getMonth() + 1);
}
down() {
this.date.setMonth(this.date.getMonth() - 1);
}
setTo(n) {
n = parseInt(n.substr(-2)) - 1, this.date.setMonth(n < 0 ? 0 : n);
}
toString() {
let n = this.date.getMonth(), h = this.token.length;
return h === 2 ? String(n + 1).padStart(2, "0") : h === 3 ? this.locales.monthsShort[n] : h === 4 ? this.locales.months[n] : String(n + 1);
}
};
t.exports = i;
})), Tm = /* @__PURE__ */ P(((e, t) => {
var r = ar(), i = class extends r {
constructor(n = {}) {
super(n);
}
up() {
this.date.setSeconds(this.date.getSeconds() + 1);
}
down() {
this.date.setSeconds(this.date.getSeconds() - 1);
}
setTo(n) {
this.date.setSeconds(parseInt(n.substr(-2)));
}
toString() {
let n = this.date.getSeconds();
return this.token.length > 1 ? String(n).padStart(2, "0") : n;
}
};
t.exports = i;
})), Dm = /* @__PURE__ */ P(((e, t) => {
var r = ar(), i = class extends r {
constructor(n = {}) {
super(n);
}
up() {
this.date.setFullYear(this.date.getFullYear() + 1);
}
down() {
this.date.setFullYear(this.date.getFullYear() - 1);
}
setTo(n) {
this.date.setFullYear(n.substr(-4));
}
toString() {
let n = String(this.date.getFullYear()).padStart(4, "0");
return this.token.length === 2 ? n.substr(-2) : n;
}
};
t.exports = i;
})), Rm = /* @__PURE__ */ P(((e, t) => {
t.exports = {
DatePart: ar(),
Meridiem: _m(),
Day: bm(),
Hours: wm(),
Milliseconds: Em(),
Minutes: Sm(),
Month: Am(),
Seconds: Tm(),
Year: Dm()
};
})), Om = /* @__PURE__ */ P(((e, t) => {
var r = Gt(), i = fr(), { style: n, clear: h, figures: a } = er(), { erase: s, cursor: u } = zt(), { DatePart: l, Meridiem: f, Day: o, Hours: c, Milliseconds: d, Minutes: p, Month: m, Seconds: g, Year: v } = Rm(), y = /\\(.)|"((?:\\["\\]|[^"])+)"|(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, E = {
1: ({ token: _ }) => _.replace(/\\(.)/g, "$1"),
2: (_) => new o(_),
3: (_) => new m(_),
4: (_) => new v(_),
5: (_) => new f(_),
6: (_) => new c(_),
7: (_) => new p(_),
8: (_) => new g(_),
9: (_) => new d(_)
}, b = {
months: "January,February,March,April,May,June,July,August,September,October,November,December".split(","),
monthsShort: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),
weekdays: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),
weekdaysShort: "Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")
}, w = class extends i {
constructor(_ = {}) {
super(_), this.msg = _.message, this.cursor = 0, this.typed = "", this.locales = Object.assign(b, _.locales), this._date = _.initial || /* @__PURE__ */ new Date(), this.errorMsg = _.error || "Please Enter A Valid Value", this.validator = _.validate || (() => !0), this.mask = _.mask || "YYYY-MM-DD HH:mm:ss", this.clear = h("", this.out.columns), this.render();
}
get value() {
return this.date;
}
get date() {
return this._date;
}
set date(_) {
_ && this._date.setTime(_.getTime());
}
set mask(_) {
let S;
for (this.parts = []; S = y.exec(_); ) {
let D = S.shift(), R = S.findIndex((j) => j != null);
this.parts.push(R in E ? E[R]({
token: S[R] || D,
date: this.date,
parts: this.parts,
locales: this.locales
}) : S[R] || D);
}
let T = this.parts.reduce((D, R) => (typeof R == "string" && typeof D[D.length - 1] == "string" ? D[D.length - 1] += R : D.push(R), D), []);
this.parts.splice(0), this.parts.push(...T), this.reset();
}
moveCursor(_) {
this.typed = "", this.cursor = _, this.fire();
}
reset() {
this.moveCursor(this.parts.findIndex((_) => _ instanceof l)), this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = !0, this.error = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
async validate() {
let _ = await this.validator(this.value);
typeof _ == "string" && (this.errorMsg = _, _ = !1), this.error = !_;
}
async submit() {
if (await this.validate(), this.error) {
this.color = "red", this.fire(), this.render();
return;
}
this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
up() {
this.typed = "", this.parts[this.cursor].up(), this.render();
}
down() {
this.typed = "", this.parts[this.cursor].down(), this.render();
}
left() {
let _ = this.parts[this.cursor].prev();
if (_ == null) return this.bell();
this.moveCursor(this.parts.indexOf(_)), this.render();
}
right() {
let _ = this.parts[this.cursor].next();
if (_ == null) return this.bell();
this.moveCursor(this.parts.indexOf(_)), this.render();
}
next() {
let _ = this.parts[this.cursor].next();
this.moveCursor(_ ? this.parts.indexOf(_) : this.parts.findIndex((S) => S instanceof l)), this.render();
}
_(_) {
/\d/.test(_) && (this.typed += _, this.parts[this.cursor].setTo(this.typed), this.render());
}
render() {
this.closed || (this.firstRender ? this.out.write(u.hide) : this.out.write(h(this.outputText, this.out.columns)), super.render(), this.outputText = [
n.symbol(this.done, this.aborted),
r.bold(this.msg),
n.delimiter(!1),
this.parts.reduce((_, S, T) => _.concat(T === this.cursor && !this.done ? r.cyan().underline(S.toString()) : S), []).join("")
].join(" "), this.error && (this.outputText += this.errorMsg.split(`
`).reduce((_, S, T) => _ + `
${T ? " " : a.pointerSmall} ${r.red().italic(S)}`, "")), this.out.write(s.line + u.to(0) + this.outputText));
}
};
t.exports = w;
})), Cm = /* @__PURE__ */ P(((e, t) => {
var r = Gt(), i = fr(), { cursor: n, erase: h } = zt(), { style: a, figures: s, clear: u, lines: l } = er(), f = /[0-9]/, o = (p) => p !== void 0, c = (p, m) => {
let g = Math.pow(10, m);
return Math.round(p * g) / g;
}, d = class extends i {
constructor(p = {}) {
super(p), this.transform = a.render(p.style), this.msg = p.message, this.initial = o(p.initial) ? p.initial : "", this.float = !!p.float, this.round = p.round || 2, this.inc = p.increment || 1, this.min = o(p.min) ? p.min : -1 / 0, this.max = o(p.max) ? p.max : 1 / 0, this.errorMsg = p.error || "Please Enter A Valid Value", this.validator = p.validate || (() => !0), this.color = "cyan", this.value = "", this.typed = "", this.lastHit = 0, this.render();
}
set value(p) {
!p && p !== 0 ? (this.placeholder = !0, this.rendered = r.gray(this.transform.render(`${this.initial}`)), this._value = "") : (this.placeholder = !1, this.rendered = this.transform.render(`${c(p, this.round)}`), this._value = c(p, this.round)), this.fire();
}
get value() {
return this._value;
}
parse(p) {
return this.float ? parseFloat(p) : parseInt(p);
}
valid(p) {
return p === "-" || p === "." && this.float || f.test(p);
}
reset() {
this.typed = "", this.value = "", this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
let p = this.value;
this.value = p !== "" ? p : this.initial, this.done = this.aborted = !0, this.error = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
async validate() {
let p = await this.validator(this.value);
typeof p == "string" && (this.errorMsg = p, p = !1), this.error = !p;
}
async submit() {
if (await this.validate(), this.error) {
this.color = "red", this.fire(), this.render();
return;
}
let p = this.value;
this.value = p !== "" ? p : this.initial, this.done = !0, this.aborted = !1, this.error = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
up() {
if (this.typed = "", this.value === "" && (this.value = this.min - this.inc), this.value >= this.max) return this.bell();
this.value += this.inc, this.color = "cyan", this.fire(), this.render();
}
down() {
if (this.typed = "", this.value === "" && (this.value = this.min + this.inc), this.value <= this.min) return this.bell();
this.value -= this.inc, this.color = "cyan", this.fire(), this.render();
}
delete() {
let p = this.value.toString();
if (p.length === 0) return this.bell();
this.value = this.parse(p = p.slice(0, -1)) || "", this.value !== "" && this.value < this.min && (this.value = this.min), this.color = "cyan", this.fire(), this.render();
}
next() {
this.value = this.initial, this.fire(), this.render();
}
_(p, m) {
if (!this.valid(p)) return this.bell();
const g = Date.now();
if (g - this.lastHit > 1e3 && (this.typed = ""), this.typed += p, this.lastHit = g, this.color = "cyan", p === ".") return this.fire();
this.value = Math.min(this.parse(this.typed), this.max), this.value > this.max && (this.value = this.max), this.value < this.min && (this.value = this.min), this.fire(), this.render();
}
render() {
this.closed || (this.firstRender || (this.outputError && this.out.write(n.down(l(this.outputError, this.out.columns) - 1) + u(this.outputError, this.out.columns)), this.out.write(u(this.outputText, this.out.columns))), super.render(), this.outputError = "", this.outputText = [
a.symbol(this.done, this.aborted),
r.bold(this.msg),
a.delimiter(this.done),
!this.done || !this.done && !this.placeholder ? r[this.color]().underline(this.rendered) : this.rendered
].join(" "), this.error && (this.outputError += this.errorMsg.split(`
`).reduce((p, m, g) => p + `
${g ? " " : s.pointerSmall} ${r.red().italic(m)}`, "")), this.out.write(h.line + n.to(0) + this.outputText + n.save + this.outputError + n.restore));
}
};
t.exports = d;
})), dh = /* @__PURE__ */ P(((e, t) => {
var r = Gt(), { cursor: i } = zt(), n = fr(), { clear: h, figures: a, style: s, wrap: u, entriesToDisplay: l } = er(), f = class extends n {
constructor(o = {}) {
super(o), this.isSelect = !0, this.msg = o.message, this.cursorStart = o.choices.findIndex((c) => !c.heading), this.cursor = o.cursor || this.cursorStart, this.scrollIndex = o.cursor || 0, this.hint = o.hint || "", this.warn = o.warn || "- This option is disabled -", this.minSelected = o.min, this.showMinError = !1, this.maxChoices = o.max, this.instructions = o.instructions, this.optionsPerPage = o.optionsPerPage || 10, this.value = o.choices.map((c, d) => (typeof c == "string" && (c = {
title: c,
value: d
}), {
title: c && (c.title || c.value || c),
description: c && c.description,
value: c && (c.value === void 0 ? d : c.value),
selected: c && c.selected,
disabled: c && c.disabled,
heading: c && c.heading
})), this.clear = h("", this.out.columns), o.overrideRender || this.render();
}
reset() {
this.value.map((o) => !o.selected), this.cursor = this.cursorStart, this.fire(), this.render();
}
selected() {
return this.value.filter((o) => o.selected);
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
`), this.close();
}
submit() {
const o = this.value.filter((c) => c.selected);
this.minSelected && o.length < this.minSelected ? (this.showMinError = !0, this.render()) : (this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close());
}
first() {
this.cursor = this.cursorStart, this.render();
}
last() {
this.cursor = this.value.length - 1, this.render();
}
next() {
this.cursor = (this.cursor + 1) % this.value.length, this.value[this.cursor].heading && this.next(), this.render();
}
up() {
this.cursor === this.cursorStart ? this.cursor = this.value.length - 1 : this.cursor--, this.value[this.cursor].heading && this.up(), this.render();
}
down() {
this.cursor === this.value.length - 1 ? this.cursor = this.cursorStart : this.cursor++, this.value[this.cursor].heading && this.down(), this.render();
}
left() {
this.value[this.cursor].selected = !1, this.render();
}
right() {
if (this.value.filter((o) => o.selected).length >= this.maxChoices) return this.bell();
this.value[this.cursor].selected = !0, this.render();
}
handleSpaceToggle() {
const o = this.value[this.cursor];
if (o.selected)
o.selected = !1, this.render();
else {
if (o.disabled || this.value.filter((c) => c.selected).length >= this.maxChoices) return this.bell();
o.selected = !0, this.render();
}
}
toggleAll() {
if (this.maxChoices !== void 0 || this.value[this.cursor].disabled) return this.bell();
const o = !this.value[this.cursor].selected;
this.value.filter((c) => !c.disabled && !c.heading).forEach((c) => c.selected = o), this.render();
}
_(o, c) {
if (o === " ") this.handleSpaceToggle();
else if (o === "a") this.toggleAll();
else return this.bell();
}
renderInstructions() {
return this.instructions === void 0 || this.instructions ? typeof this.instructions == "string" ? this.instructions : `
Instructions:
${a.arrowUp}/${a.arrowDown}: Highlight option
${a.arrowLeft}/${a.arrowRight}/[space]: Toggle selection
` + (this.maxChoices === void 0 ? ` a: Toggle all
` : "") + " enter/return: Complete answer" : "";
}
renderOption(o, c, d, p) {
const m = (o === d ? "❯ " : " ") + (c.selected ? r.green(a.radioOn) : a.radioOff) + " ";
let g, v;
if (c.disabled) g = o === d ? r.gray(c.title) : r.strikethrough().gray(c.title);
else {
if (c.heading)
return g = c.title, g + r.gray(v || "");
g = c.title, o === d && c.description && (v = ` - ${c.description}`, (m.length + g.length + v.length >= this.out.columns || c.description.split(/\r?\n/).length > 1) && (v = `
` + u(c.description, {
margin: m.length,
width: this.out.columns
})));
}
return m + g + r.gray(v || "");
}
paginateOptions(o) {
if (o.length === 0) return r.red("No matches for this query.");
let { startIndex: c, endIndex: d } = l(this.cursor, o.length, this.optionsPerPage), p, m = [];
for (let g = c; g < d; g++)
g === c && c > 0 ? p = a.arrowUp : g === d - 1 && d < o.length ? p = a.arrowDown : p = " ", m.push(this.renderOption(this.cursor, o[g], g, p));
return `
` + m.join(`
`);
}
renderOptions(o) {
return this.done ? "" : this.paginateOptions(o);
}
renderDoneOrInstructions() {
if (this.done) return "";
const o = [r.gray(this.hint), this.renderInstructions()];
return this.value[this.cursor].disabled && o.push(r.yellow(this.warn)), o.join(" ");
}
render() {
if (this.closed) return;
this.firstRender && this.out.write(i.hide), super.render();
let o = [
s.symbol(this.done, this.aborted),
r.bold(this.msg),
s.delimiter(!1),
this.renderDoneOrInstructions()
].join(" ");
this.showMinError && (o += r.red(`You must select a minimum of ${this.minSelected} choices.`), this.showMinError = !1), o += this.renderOptions(this.value), this.out.write(this.clear + o), this.clear = h(o, this.out.columns);
}
};
t.exports = f;
})), Im = /* @__PURE__ */ P(((e, t) => {
var r = Gt(), i = fr(), { erase: n, cursor: h } = zt(), { style: a, clear: s, figures: u, wrap: l, entriesToDisplay: f } = er(), o = (m, g) => m[g] && (m[g].value || m[g].title || m[g]), c = (m, g) => m[g] && (m[g].title || m[g].value || m[g]), d = (m, g) => {
const v = m.findIndex((y) => y.value === g || y.title === g);
return v > -1 ? v : void 0;
}, p = class extends i {
constructor(m = {}) {
super(m), this.msg = m.message, this.suggest = m.suggest, this.choices = m.choices, this.initial = typeof m.initial == "number" ? m.initial : d(m.choices, m.initial), this.select = this.initial || m.cursor || 0, this.i18n = { noMatches: m.noMatches || "no matches found" }, this.fallback = m.fallback || this.initial, this.clearFirst = m.clearFirst || !1, this.suggestions = [], this.input = "", this.limit = m.limit || 10, this.cursor = 0, this.transform = a.render(m.style), this.scale = this.transform.scale, this.render = this.render.bind(this), this.complete = this.complete.bind(this), this.clear = s("", this.out.columns), this.complete(this.render), this.render();
}
set fallback(m) {
this._fb = Number.isSafeInteger(parseInt(m)) ? parseInt(m) : m;
}
get fallback() {
let m;
return typeof this._fb == "number" ? m = this.choices[this._fb] : typeof this._fb == "string" && (m = { title: this._fb }), m || this._fb || { title: this.i18n.noMatches };
}
moveSelect(m) {
this.select = m, this.suggestions.length > 0 ? this.value = o(this.suggestions, m) : this.value = this.fallback.value, this.fire();
}
async complete(m) {
const g = this.completing = this.suggest(this.input, this.choices), v = await g;
if (this.completing !== g) return;
this.suggestions = v.map((E, b, w) => ({
title: c(w, b),
value: o(w, b),
description: E.description
})), this.completing = !1;
const y = Math.max(v.length - 1, 0);
this.moveSelect(Math.min(y, this.select)), m && m();
}
reset() {
this.input = "", this.complete(() => {
this.moveSelect(this.initial !== void 0 ? this.initial : 0), this.render();
}), this.render();
}
exit() {
this.clearFirst && this.input.length > 0 ? this.reset() : (this.done = this.exited = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close());
}
abort() {
this.done = this.aborted = !0, this.exited = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
submit() {
this.done = !0, this.aborted = this.exited = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
_(m, g) {
let v = this.input.slice(0, this.cursor), y = this.input.slice(this.cursor);
this.input = `${v}${m}${y}`, this.cursor = v.length + 1, this.complete(this.render), this.render();
}
delete() {
if (this.cursor === 0) return this.bell();
let m = this.input.slice(0, this.cursor - 1), g = this.input.slice(this.cursor);
this.input = `${m}${g}`, this.complete(this.render), this.cursor = this.cursor - 1, this.render();
}
deleteForward() {
if (this.cursor * this.scale >= this.rendered.length) return this.bell();
let m = this.input.slice(0, this.cursor), g = this.input.slice(this.cursor + 1);
this.input = `${m}${g}`, this.complete(this.render), this.render();
}
first() {
this.moveSelect(0), this.render();
}
last() {
this.moveSelect(this.suggestions.length - 1), this.render();
}
up() {
this.select === 0 ? this.moveSelect(this.suggestions.length - 1) : this.moveSelect(this.select - 1), this.render();
}
down() {
this.select === this.suggestions.length - 1 ? this.moveSelect(0) : this.moveSelect(this.select + 1), this.render();
}
next() {
this.select === this.suggestions.length - 1 ? this.moveSelect(0) : this.moveSelect(this.select + 1), this.render();
}
nextPage() {
this.moveSelect(Math.min(this.select + this.limit, this.suggestions.length - 1)), this.render();
}
prevPage() {
this.moveSelect(Math.max(this.select - this.limit, 0)), this.render();
}
left() {
if (this.cursor <= 0) return this.bell();
this.cursor = this.cursor - 1, this.render();
}
right() {
if (this.cursor * this.scale >= this.rendered.length) return this.bell();
this.cursor = this.cursor + 1, this.render();
}
renderOption(m, g, v, y) {
let E, b = v ? u.arrowUp : y ? u.arrowDown : " ", w = g ? r.cyan().underline(m.title) : m.title;
return b = (g ? r.cyan(u.pointer) + " " : " ") + b, m.description && (E = ` - ${m.description}`, (b.length + w.length + E.length >= this.out.columns || m.description.split(/\r?\n/).length > 1) && (E = `
` + l(m.description, {
margin: 3,
width: this.out.columns
}))), b + " " + w + r.gray(E || "");
}
render() {
if (this.closed) return;
this.firstRender ? this.out.write(h.hide) : this.out.write(s(this.outputText, this.out.columns)), super.render();
let { startIndex: m, endIndex: g } = f(this.select, this.choices.length, this.limit);
if (this.outputText = [
a.symbol(this.done, this.aborted, this.exited),
r.bold(this.msg),
a.delimiter(this.completing),
this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)
].join(" "), !this.done) {
const v = this.suggestions.slice(m, g).map((y, E) => this.renderOption(y, this.select === E + m, E === 0 && m > 0, E + m === g - 1 && g < this.choices.length)).join(`
`);
this.outputText += `
` + (v || r.gray(this.fallback.title));
}
this.out.write(n.line + h.to(0) + this.outputText);
}
};
t.exports = p;
})), km = /* @__PURE__ */ P(((e, t) => {
var r = Gt(), { cursor: i } = zt(), n = dh(), { clear: h, style: a, figures: s } = er(), u = class extends n {
constructor(l = {}) {
l.overrideRender = !0, super(l), this.inputValue = "", this.clear = h("", this.out.columns), this.filteredOptions = this.value, this.render();
}
last() {
this.cursor = this.filteredOptions.length - 1, this.render();
}
next() {
this.cursor = (this.cursor + 1) % this.filteredOptions.length, this.render();
}
up() {
this.cursor === 0 ? this.cursor = this.filteredOptions.length - 1 : this.cursor--, this.render();
}
down() {
this.cursor === this.filteredOptions.length - 1 ? this.cursor = 0 : this.cursor++, this.render();
}
left() {
this.filteredOptions[this.cursor].selected = !1, this.render();
}
right() {
if (this.value.filter((l) => l.selected).length >= this.maxChoices) return this.bell();
this.filteredOptions[this.cursor].selected = !0, this.render();
}
delete() {
this.inputValue.length && (this.inputValue = this.inputValue.substr(0, this.inputValue.length - 1), this.updateFilteredOptions());
}
updateFilteredOptions() {
const l = this.filteredOptions[this.cursor];
this.filteredOptions = this.value.filter((o) => this.inputValue ? !!(typeof o.title == "string" && o.title.toLowerCase().includes(this.inputValue.toLowerCase()) || typeof o.value == "string" && o.value.toLowerCase().includes(this.inputValue.toLowerCase())) : !0);
const f = this.filteredOptions.findIndex((o) => o === l);
this.cursor = f < 0 ? 0 : f, this.render();
}
handleSpaceToggle() {
const l = this.filteredOptions[this.cursor];
if (l.selected)
l.selected = !1, this.render();
else {
if (l.disabled || this.value.filter((f) => f.selected).length >= this.maxChoices) return this.bell();
l.selected = !0, this.render();
}
}
handleInputChange(l) {
this.inputValue = this.inputValue + l, this.updateFilteredOptions();
}
_(l, f) {
l === " " ? this.handleSpaceToggle() : this.handleInputChange(l);
}
renderInstructions() {
return this.instructions === void 0 || this.instructions ? typeof this.instructions == "string" ? this.instructions : `
Instructions:
${s.arrowUp}/${s.arrowDown}: Highlight option
${s.arrowLeft}/${s.arrowRight}/[space]: Toggle selection
[a,b,c]/delete: Filter choices
enter/return: Complete answer
` : "";
}
renderCurrentInput() {
return `
Filtered results for: ${this.inputValue ? this.inputValue : r.gray("Enter something to filter")}
`;
}
renderOption(l, f, o, c) {
const d = (f.selected ? r.green(s.radioOn) : s.radioOff) + " " + c + " ";
let p;
return f.disabled ? p = l === o ? r.gray().underline(f.title) : r.strikethrough().gray(f.title) : p = l === o ? r.cyan().underline(f.title) : f.title, d + p;
}
renderDoneOrInstructions() {
if (this.done) return this.value.filter((f) => f.selected).map((f) => f.title).join(", ");
const l = [
r.gray(this.hint),
this.renderInstructions(),
this.renderCurrentInput()
];
return this.filteredOptions.length && this.filteredOptions[this.cursor].disabled && l.push(r.yellow(this.warn)), l.join(" ");
}
render() {
if (this.closed) return;
this.firstRender && this.out.write(i.hide), super.render();
let l = [
a.symbol(this.done, this.aborted),
r.bold(this.msg),
a.delimiter(!1),
this.renderDoneOrInstructions()
].join(" ");
this.showMinError && (l += r.red(`You must select a minimum of ${this.minSelected} choices.`), this.showMinError = !1), l += this.renderOptions(this.filteredOptions), this.out.write(this.clear + l), this.clear = h(l, this.out.columns);
}
};
t.exports = u;
})), Lm = /* @__PURE__ */ P(((e, t) => {
var r = Gt(), i = fr(), { style: n, clear: h } = er(), { erase: a, cursor: s } = zt(), u = class extends i {
constructor(l = {}) {
super(l), this.msg = l.message, this.value = l.initial, this.initialValue = !!l.initial, this.yesMsg = l.yes || "yes", this.yesOption = l.yesOption || "(Y/n)", this.noMsg = l.no || "no", this.noOption = l.noOption || "(y/N)", this.render();
}
reset() {
this.value = this.initialValue, this.fire(), this.render();
}
exit() {
this.abort();
}
abort() {
this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(`
`), this.close();
}
submit() {
this.value = this.value || !1, this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write(`
`), this.close();
}
_(l, f) {
return l.toLowerCase() === "y" ? (this.value = !0, this.submit()) : l.toLowerCase() === "n" ? (this.value = !1, this.submit()) : this.bell();
}
render() {
if (t