UNPKG

npm-check-updates

Version:

Find newer versions of dependencies than what your package.json allows

1,244 lines 1.21 MB
import { createRequire as e } from "node:module"; import t from "node:path"; import n from "node:fs/promises"; import r from "node:os"; import i from "node:process"; import a from "node:tty"; import { URL as o, fileURLToPath as s } from "node:url"; import { format as c, isDeepStrictEqual as l, promisify as u, stripVTControlCharacters as d } from "node:util"; import f, { promises as p } from "node:fs"; import m, { execFile as h } from "node:child_process"; import { text as g } from "node:stream/consumers"; //#region \0rolldown/runtime.js var _ = Object.create, v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.getOwnPropertyNames, x = Object.getPrototypeOf, S = Object.prototype.hasOwnProperty, C = (e, t, n) => () => { if (n) throw n[0]; try { return e && (t = e(e = 0)), t; } catch (e) { throw n = [e], e; } }, w = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), T = (e, t) => { let n = {}; for (var r in e) v(n, r, { get: e[r], enumerable: !0 }); return t || v(n, Symbol.toStringTag, { value: "Module" }), n; }, E = (e, t, n, r) => { if (t && typeof t == "object" || typeof t == "function") for (var i = b(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !S.call(e, s) && s !== n && v(e, s, { get: ((e) => t[e]).bind(null, s), enumerable: !(r = y(t, s)) || r.enumerable }); return e; }, D = (e, t, n) => (n = e == null ? {} : _(x(e)), E(t || !e || !e.__esModule ? v(n, "default", { value: e, enumerable: !0 }) : n, e)), O = (e) => S.call(e, "module.exports") ? e["module.exports"] : E(v({}, "__esModule", { value: !0 }), e), k = /* @__PURE__ */ e(import.meta.url), A = /* @__PURE__ */ w(((e, t) => { var n, r, i, a, o = !0; typeof process < "u" && ({FORCE_COLOR: n, NODE_DISABLE_COLORS: r, NO_COLOR: i, TERM: a} = process.env || {}, o = process.stdout && process.stdout.isTTY); var s = { enabled: !r && i == null && a !== "dumb" && (n != null && n !== "0" || o), reset: u(0, 0), bold: u(1, 22), dim: u(2, 22), italic: u(3, 23), underline: u(4, 24), inverse: u(7, 27), hidden: u(8, 28), strikethrough: u(9, 29), black: u(30, 39), red: u(31, 39), green: u(32, 39), yellow: u(33, 39), blue: u(34, 39), magenta: u(35, 39), cyan: u(36, 39), white: u(37, 39), gray: u(90, 39), grey: u(90, 39), bgBlack: u(40, 49), bgRed: u(41, 49), bgGreen: u(42, 49), bgYellow: u(43, 49), bgBlue: u(44, 49), bgMagenta: u(45, 49), bgCyan: u(46, 49), bgWhite: u(47, 49) }; function c(e, t) { let n = 0, r, i = "", a = ""; for (; n < e.length; n++) r = e[n], i += r.open, a += r.close, ~t.indexOf(r.close) && (t = t.replace(r.rgx, r.close + r.open)); return i + t + a; } function l(e, t) { let n = { has: e, keys: t }; return n.reset = s.reset.bind(n), n.bold = s.bold.bind(n), n.dim = s.dim.bind(n), n.italic = s.italic.bind(n), n.underline = s.underline.bind(n), n.inverse = s.inverse.bind(n), n.hidden = s.hidden.bind(n), n.strikethrough = s.strikethrough.bind(n), n.black = s.black.bind(n), n.red = s.red.bind(n), n.green = s.green.bind(n), n.yellow = s.yellow.bind(n), n.blue = s.blue.bind(n), n.magenta = s.magenta.bind(n), n.cyan = s.cyan.bind(n), n.white = s.white.bind(n), n.gray = s.gray.bind(n), n.grey = s.grey.bind(n), n.bgBlack = s.bgBlack.bind(n), n.bgRed = s.bgRed.bind(n), n.bgGreen = s.bgGreen.bind(n), n.bgYellow = s.bgYellow.bind(n), n.bgBlue = s.bgBlue.bind(n), n.bgMagenta = s.bgMagenta.bind(n), n.bgCyan = s.bgCyan.bind(n), n.bgWhite = s.bgWhite.bind(n), n; } function u(e, t) { let n = { open: `\x1b[${e}m`, close: `\x1b[${t}m`, rgx: RegExp(`\\x1b\\[${t}m`, "g") }; return function(t) { return this !== void 0 && this.has !== void 0 ? (~this.has.indexOf(e) || (this.has.push(e), this.keys.push(n)), t === void 0 ? this : s.enabled ? c(this.keys, t + "") : t + "") : t === void 0 ? l([e], [n]) : s.enabled ? c([n], t + "") : t + ""; }; } t.exports = s; })), j = /* @__PURE__ */ w(((e, t) => { t.exports = (e, t) => { if (!(e.meta && e.name !== "escape")) { if (e.ctrl) { if (e.name === "a") return "first"; if (e.name === "c" || e.name === "d") return "abort"; if (e.name === "e") return "last"; if (e.name === "g") return "reset"; } if (t) { if (e.name === "j") return "down"; if (e.name === "k") return "up"; if (e.name === "q") return "abort"; } return e.name === "return" || e.name === "enter" ? "submit" : e.name === "backspace" ? "delete" : e.name === "delete" ? "deleteForward" : e.name === "abort" ? "abort" : e.name === "escape" ? "exit" : e.name === "tab" ? "next" : e.name === "pagedown" ? "nextPage" : e.name === "pageup" ? "prevPage" : e.name === "home" ? "home" : e.name === "end" ? "end" : e.name === "up" ? "up" : e.name === "down" ? "down" : e.name === "right" ? "right" : e.name === "left" ? "left" : !1; } }; })), M = /* @__PURE__ */ w(((e, t) => { t.exports = (e) => { let t = ["[\\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(t, "g"); return typeof e == "string" ? e.replace(n, "") : e; }; })), N = /* @__PURE__ */ w(((e, t) => { var n = "\x1B", r = `${n}[`, i = "\x07", a = { to(e, t) { return t ? `${r}${t + 1};${e + 1}H` : `${r}${e + 1}G`; }, move(e, t) { let n = ""; return e < 0 ? n += `${r}${-e}D` : e > 0 && (n += `${r}${e}C`), t < 0 ? n += `${r}${-t}A` : t > 0 && (n += `${r}${t}B`), n; }, up: (e = 1) => `${r}${e}A`, down: (e = 1) => `${r}${e}B`, forward: (e = 1) => `${r}${e}C`, backward: (e = 1) => `${r}${e}D`, nextLine: (e = 1) => `${r}E`.repeat(e), prevLine: (e = 1) => `${r}F`.repeat(e), left: `${r}G`, hide: `${r}?25l`, show: `${r}?25h`, save: `${n}7`, restore: `${n}8` }; t.exports = { cursor: a, scroll: { up: (e = 1) => `${r}S`.repeat(e), down: (e = 1) => `${r}T`.repeat(e) }, erase: { screen: `${r}2J`, up: (e = 1) => `${r}1J`.repeat(e), down: (e = 1) => `${r}J`.repeat(e), line: `${r}2K`, lineEnd: `${r}K`, lineStart: `${r}1K`, lines(e) { let t = ""; for (let n = 0; n < e; n++) t += this.line + (n < e - 1 ? a.up() : ""); return e && (t += a.left), t; } }, beep: i }; })), P = /* @__PURE__ */ w(((e, t) => { var n = M(), { erase: r, cursor: i } = N(), a = (e) => [...n(e)].length; t.exports = function(e, t) { if (!t) return r.line + i.to(0); let n = 0, o = e.split(/\r?\n/); for (let e of o) n += 1 + Math.floor(Math.max(a(e) - 1, 0) / t); return r.lines(n); }; })), F = /* @__PURE__ */ w(((e, t) => { var n = { arrowUp: "↑", arrowDown: "↓", arrowLeft: "←", arrowRight: "→", radioOn: "◉", radioOff: "◯", tick: "✔", cross: "✖", ellipsis: "…", pointerSmall: "›", line: "─", pointer: "❯" }, r = { arrowUp: n.arrowUp, arrowDown: n.arrowDown, arrowLeft: n.arrowLeft, arrowRight: n.arrowRight, radioOn: "(*)", radioOff: "( )", tick: "√", cross: "×", ellipsis: "...", pointerSmall: "»", line: "─", pointer: ">" }; t.exports = process.platform === "win32" ? r : n; })), I = /* @__PURE__ */ w(((e, t) => { var n = A(), r = F(), i = Object.freeze({ password: { scale: 1, render: (e) => "*".repeat(e.length) }, emoji: { scale: 2, render: (e) => "😃".repeat(e.length) }, invisible: { scale: 0, render: (e) => "" }, default: { scale: 1, render: (e) => `${e}` } }), a = (e) => i[e] || i.default, o = Object.freeze({ aborted: n.red(r.cross), done: n.green(r.tick), exited: n.yellow(r.cross), default: n.cyan("?") }); t.exports = { styles: i, render: a, symbols: o, symbol: (e, t, n) => t ? o.aborted : n ? o.exited : e ? o.done : o.default, delimiter: (e) => n.gray(e ? r.ellipsis : r.pointerSmall), item: (e, t) => n.gray(e ? t ? r.pointerSmall : "+" : r.line) }; })), L = /* @__PURE__ */ w(((e, t) => { var n = M(); t.exports = function(e, t) { let r = String(n(e) || "").split(/\r?\n/); return t ? r.map((e) => Math.ceil(e.length / t)).reduce((e, t) => e + t) : r.length; }; })), R = /* @__PURE__ */ w(((e, t) => { t.exports = (e, t = {}) => { let n = Number.isSafeInteger(parseInt(t.margin)) ? Array(parseInt(t.margin)).fill(" ").join("") : t.margin || "", r = t.width; return (e || "").split(/\r?\n/g).map((e) => e.split(/\s+/g).reduce((e, t) => (t.length + n.length >= r || e[e.length - 1].length + t.length + 1 < r ? e[e.length - 1] += ` ${t}` : e.push(`${n}${t}`), e), [n]).join("\n")).join("\n"); }; })), z = /* @__PURE__ */ w(((e, t) => { t.exports = (e, t, n) => { n ||= t; let r = Math.min(t - n, e - Math.floor(n / 2)); r < 0 && (r = 0); let i = Math.min(r + n, t); return { startIndex: r, endIndex: i }; }; })), ee = /* @__PURE__ */ w(((e, t) => { t.exports = { action: j(), clear: P(), style: I(), strip: M(), figures: F(), lines: L(), wrap: R(), entriesToDisplay: z() }; })), B = /* @__PURE__ */ w(((e, t) => { var n = k("readline"), { action: r } = ee(), i = k("events"), { beep: a, cursor: o } = N(), s = A(); t.exports = class extends i { constructor(e = {}) { super(), this.firstRender = !0, this.in = e.stdin || process.stdin, this.out = e.stdout || process.stdout, this.onRender = (e.onRender || (() => void 0)).bind(this); let t = n.createInterface({ input: this.in, escapeCodeTimeout: 50 }); n.emitKeypressEvents(this.in, t), this.in.isTTY && this.in.setRawMode(!0); let i = (e, t) => { let n = r(t, this.isSelect); n === !1 ? this._ && this._(e, t) : typeof this[n] == "function" ? this[n](t) : this.bell(); }; this.close = () => { this.out.write(o.show), this.in.removeListener("keypress", i), this.in.isTTY && this.in.setRawMode(!1), t.close(), this.emit(this.aborted ? "abort" : this.exited ? "exit" : "submit", this.value), this.closed = !0; }, this.in.on("keypress", i); } fire() { this.emit("state", { value: this.value, aborted: !!this.aborted, exited: !!this.exited }); } bell() { this.out.write(a); } render() { this.onRender(s), this.firstRender &&= !1; } }; })), V = /* @__PURE__ */ w(((e, t) => { var n = A(), r = B(), { erase: i, cursor: a } = N(), { style: o, clear: s, lines: c, figures: l } = ee(); t.exports = class extends r { constructor(e = {}) { super(e), this.transform = o.render(e.style), this.scale = this.transform.scale, this.msg = e.message, this.initial = e.initial || "", this.validator = e.validate || (() => !0), this.value = "", this.errorMsg = e.error || "Please Enter A Valid Value", this.cursor = Number(!!this.initial), this.cursorOffset = 0, this.clear = s("", this.out.columns), this.render(); } set value(e) { !e && this.initial ? (this.placeholder = !0, this.rendered = n.gray(this.transform.render(this.initial))) : (this.placeholder = !1, this.rendered = this.transform.render(e)), this._value = e, this.fire(); } get value() { return this._value; } reset() { this.value = "", this.cursor = Number(!!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("\n"), this.close(); } async validate() { let e = await this.validator(this.value); typeof e == "string" && (this.errorMsg = e, e = !1), this.error = !e; } 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("\n"), this.close(); } next() { if (!this.placeholder) return this.bell(); this.value = this.initial, this.cursor = this.rendered.length, this.fire(), this.render(); } moveCursor(e) { this.placeholder || (this.cursor += e, this.cursorOffset += e); } _(e, t) { let n = this.value.slice(0, this.cursor), r = this.value.slice(this.cursor); this.value = `${n}${e}${r}`, this.red = !1, this.cursor = this.placeholder ? 0 : n.length + 1, this.render(); } delete() { if (this.isCursorAtStart()) return this.bell(); let e = this.value.slice(0, this.cursor - 1), t = this.value.slice(this.cursor); this.value = `${e}${t}`, 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 e = this.value.slice(0, this.cursor), t = this.value.slice(this.cursor + 1); this.value = `${e}${t}`, 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(a.down(c(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 = [ o.symbol(this.done, this.aborted), n.bold(this.msg), o.delimiter(this.done), this.red ? n.red(this.rendered) : this.rendered ].join(" "), this.error && (this.outputError += this.errorMsg.split("\n").reduce((e, t, r) => e + `\n${r ? " " : l.pointerSmall} ${n.red().italic(t)}`, "")), this.out.write(i.line + a.to(0) + this.outputText + a.save + this.outputError + a.restore + a.move(this.cursorOffset, 0))); } }; })), H = /* @__PURE__ */ w(((e, t) => { var n = A(), r = B(), { style: i, clear: a, figures: o, wrap: s, entriesToDisplay: c } = ee(), { cursor: l } = N(); t.exports = class extends r { constructor(e = {}) { super(e), this.isSelect = !0, this.msg = e.message, this.hint = e.hint || "- Use arrow-keys. Return to submit.", this.warn = e.warn || "- This option is disabled", this.cursor = e.initial || 0, this.choices = e.choices.map((e, t) => (typeof e == "string" && (e = { title: e, value: t }), { title: e && (e.title || e.value || e), value: e && (e.value === void 0 ? t : e.value), description: e && e.description, selected: e && e.selected, disabled: e && e.disabled })), this.optionsPerPage = e.optionsPerPage || 10, this.value = (this.choices[this.cursor] || {}).value, this.clear = a("", this.out.columns), this.render(); } moveCursor(e) { this.cursor = e, this.value = this.choices[e].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("\n"), this.close(); } submit() { this.selection.disabled ? this.bell() : (this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write("\n"), 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(); } _(e, t) { if (e === " ") 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(a(this.outputText, this.out.columns)), super.render(); let { startIndex: e, endIndex: t } = c(this.cursor, this.choices.length, this.optionsPerPage); if (this.outputText = [ i.symbol(this.done, this.aborted), n.bold(this.msg), i.delimiter(!1), this.done ? this.selection.title : this.selection.disabled ? n.yellow(this.warn) : n.gray(this.hint) ].join(" "), !this.done) { this.outputText += "\n"; for (let r = e; r < t; r++) { let i, a, c = "", l = this.choices[r]; a = r === e && e > 0 ? o.arrowUp : r === t - 1 && t < this.choices.length ? o.arrowDown : " ", l.disabled ? (i = this.cursor === r ? n.gray().underline(l.title) : n.strikethrough().gray(l.title), a = (this.cursor === r ? n.bold().gray(o.pointer) + " " : " ") + a) : (i = this.cursor === r ? n.cyan().underline(l.title) : l.title, a = (this.cursor === r ? n.cyan(o.pointer) + " " : " ") + a, l.description && this.cursor === r && (c = ` - ${l.description}`, (a.length + i.length + c.length >= this.out.columns || l.description.split(/\r?\n/).length > 1) && (c = "\n" + s(l.description, { margin: 3, width: this.out.columns })))), this.outputText += `${a} ${i}${n.gray(c)}\n`; } } this.out.write(this.outputText); } }; })), te = /* @__PURE__ */ w(((e, t) => { var n = A(), r = B(), { style: i, clear: a } = ee(), { cursor: o, erase: s } = N(); t.exports = class extends r { constructor(e = {}) { super(e), this.msg = e.message, this.value = !!e.initial, this.active = e.active || "on", this.inactive = e.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("\n"), this.close(); } submit() { this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write("\n"), 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(); } _(e, t) { if (e === " ") this.value = !this.value; else if (e === "1") this.value = !0; else if (e === "0") this.value = !1; else return this.bell(); this.render(); } render() { this.closed || (this.firstRender ? this.out.write(o.hide) : this.out.write(a(this.outputText, this.out.columns)), super.render(), this.outputText = [ i.symbol(this.done, this.aborted), n.bold(this.msg), i.delimiter(this.done), this.value ? this.inactive : n.cyan().underline(this.inactive), n.gray("/"), this.value ? n.cyan().underline(this.active) : this.active ].join(" "), this.out.write(s.line + o.to(0) + this.outputText)); } }; })), U = /* @__PURE__ */ w(((e, t) => { t.exports = class e { constructor({ token: e, date: t, parts: n, locales: r }) { this.token = e, this.date = t || /* @__PURE__ */ new Date(), this.parts = n || [this], this.locales = r || {}; } up() {} down() {} next() { let t = this.parts.indexOf(this); return this.parts.find((n, r) => r > t && n instanceof e); } setTo(e) {} prev() { let t = [].concat(this.parts).reverse(), n = t.indexOf(this); return t.find((t, r) => r > n && t instanceof e); } toString() { return String(this.date); } }; })), W = /* @__PURE__ */ w(((e, t) => { var n = U(); t.exports = class extends n { constructor(e = {}) { super(e); } up() { this.date.setHours((this.date.getHours() + 12) % 24); } down() { this.up(); } toString() { let e = this.date.getHours() > 12 ? "pm" : "am"; return /\A/.test(this.token) ? e.toUpperCase() : e; } }; })), G = /* @__PURE__ */ w(((e, t) => { var n = U(), r = (e) => (e %= 10, e === 1 ? "st" : e === 2 ? "nd" : e === 3 ? "rd" : "th"); t.exports = class extends n { constructor(e = {}) { super(e); } up() { this.date.setDate(this.date.getDate() + 1); } down() { this.date.setDate(this.date.getDate() - 1); } setTo(e) { this.date.setDate(parseInt(e.substr(-2))); } toString() { let e = this.date.getDate(), t = this.date.getDay(); return this.token === "DD" ? String(e).padStart(2, "0") : this.token === "Do" ? e + r(e) : this.token === "d" ? t + 1 : this.token === "ddd" ? this.locales.weekdaysShort[t] : this.token === "dddd" ? this.locales.weekdays[t] : e; } }; })), ne = /* @__PURE__ */ w(((e, t) => { var n = U(); t.exports = class extends n { constructor(e = {}) { super(e); } up() { this.date.setHours(this.date.getHours() + 1); } down() { this.date.setHours(this.date.getHours() - 1); } setTo(e) { this.date.setHours(parseInt(e.substr(-2))); } toString() { let e = this.date.getHours(); return /h/.test(this.token) && (e = e % 12 || 12), this.token.length > 1 ? String(e).padStart(2, "0") : e; } }; })), re = /* @__PURE__ */ w(((e, t) => { var n = U(); t.exports = class extends n { constructor(e = {}) { super(e); } up() { this.date.setMilliseconds(this.date.getMilliseconds() + 1); } down() { this.date.setMilliseconds(this.date.getMilliseconds() - 1); } setTo(e) { this.date.setMilliseconds(parseInt(e.substr(-this.token.length))); } toString() { return String(this.date.getMilliseconds()).padStart(4, "0").substr(0, this.token.length); } }; })), ie = /* @__PURE__ */ w(((e, t) => { var n = U(); t.exports = class extends n { constructor(e = {}) { super(e); } up() { this.date.setMinutes(this.date.getMinutes() + 1); } down() { this.date.setMinutes(this.date.getMinutes() - 1); } setTo(e) { this.date.setMinutes(parseInt(e.substr(-2))); } toString() { let e = this.date.getMinutes(); return this.token.length > 1 ? String(e).padStart(2, "0") : e; } }; })), ae = /* @__PURE__ */ w(((e, t) => { var n = U(); t.exports = class extends n { constructor(e = {}) { super(e); } up() { this.date.setMonth(this.date.getMonth() + 1); } down() { this.date.setMonth(this.date.getMonth() - 1); } setTo(e) { e = parseInt(e.substr(-2)) - 1, this.date.setMonth(e < 0 ? 0 : e); } toString() { let e = this.date.getMonth(), t = this.token.length; return t === 2 ? String(e + 1).padStart(2, "0") : t === 3 ? this.locales.monthsShort[e] : t === 4 ? this.locales.months[e] : String(e + 1); } }; })), K = /* @__PURE__ */ w(((e, t) => { var n = U(); t.exports = class extends n { constructor(e = {}) { super(e); } up() { this.date.setSeconds(this.date.getSeconds() + 1); } down() { this.date.setSeconds(this.date.getSeconds() - 1); } setTo(e) { this.date.setSeconds(parseInt(e.substr(-2))); } toString() { let e = this.date.getSeconds(); return this.token.length > 1 ? String(e).padStart(2, "0") : e; } }; })), oe = /* @__PURE__ */ w(((e, t) => { var n = U(); t.exports = class extends n { constructor(e = {}) { super(e); } up() { this.date.setFullYear(this.date.getFullYear() + 1); } down() { this.date.setFullYear(this.date.getFullYear() - 1); } setTo(e) { this.date.setFullYear(e.substr(-4)); } toString() { let e = String(this.date.getFullYear()).padStart(4, "0"); return this.token.length === 2 ? e.substr(-2) : e; } }; })), se = /* @__PURE__ */ w(((e, t) => { t.exports = { DatePart: U(), Meridiem: W(), Day: G(), Hours: ne(), Milliseconds: re(), Minutes: ie(), Month: ae(), Seconds: K(), Year: oe() }; })), ce = /* @__PURE__ */ w(((e, t) => { var n = A(), r = B(), { style: i, clear: a, figures: o } = ee(), { erase: s, cursor: c } = N(), { DatePart: l, Meridiem: u, Day: d, Hours: f, Milliseconds: p, Minutes: m, Month: h, Seconds: g, Year: _ } = se(), v = /\\(.)|"((?:\\["\\]|[^"])+)"|(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, y = { 1: ({ token: e }) => e.replace(/\\(.)/g, "$1"), 2: (e) => new d(e), 3: (e) => new h(e), 4: (e) => new _(e), 5: (e) => new u(e), 6: (e) => new f(e), 7: (e) => new m(e), 8: (e) => new g(e), 9: (e) => new p(e) }, 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(",") }; t.exports = class extends r { constructor(e = {}) { super(e), this.msg = e.message, this.cursor = 0, this.typed = "", this.locales = Object.assign(b, e.locales), this._date = e.initial || /* @__PURE__ */ new Date(), this.errorMsg = e.error || "Please Enter A Valid Value", this.validator = e.validate || (() => !0), this.mask = e.mask || "YYYY-MM-DD HH:mm:ss", this.clear = a("", this.out.columns), this.render(); } get value() { return this.date; } get date() { return this._date; } set date(e) { e && this._date.setTime(e.getTime()); } set mask(e) { let t; for (this.parts = []; t = v.exec(e);) { let e = t.shift(), n = t.findIndex((e) => e != null); this.parts.push(n in y ? y[n]({ token: t[n] || e, date: this.date, parts: this.parts, locales: this.locales }) : t[n] || e); } let n = this.parts.reduce((e, t) => (typeof t == "string" && typeof e[e.length - 1] == "string" ? e[e.length - 1] += t : e.push(t), e), []); this.parts.splice(0), this.parts.push(...n), this.reset(); } moveCursor(e) { this.typed = "", this.cursor = e, this.fire(); } reset() { this.moveCursor(this.parts.findIndex((e) => e 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("\n"), this.close(); } async validate() { let e = await this.validator(this.value); typeof e == "string" && (this.errorMsg = e, e = !1), this.error = !e; } 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("\n"), this.close(); } up() { this.typed = "", this.parts[this.cursor].up(), this.render(); } down() { this.typed = "", this.parts[this.cursor].down(), this.render(); } left() { let e = this.parts[this.cursor].prev(); if (e == null) return this.bell(); this.moveCursor(this.parts.indexOf(e)), this.render(); } right() { let e = this.parts[this.cursor].next(); if (e == null) return this.bell(); this.moveCursor(this.parts.indexOf(e)), this.render(); } next() { let e = this.parts[this.cursor].next(); this.moveCursor(e ? this.parts.indexOf(e) : this.parts.findIndex((e) => e instanceof l)), this.render(); } _(e) { /\d/.test(e) && (this.typed += e, this.parts[this.cursor].setTo(this.typed), this.render()); } render() { this.closed || (this.firstRender ? this.out.write(c.hide) : this.out.write(a(this.outputText, this.out.columns)), super.render(), this.outputText = [ i.symbol(this.done, this.aborted), n.bold(this.msg), i.delimiter(!1), this.parts.reduce((e, t, r) => e.concat(r === this.cursor && !this.done ? n.cyan().underline(t.toString()) : t), []).join("") ].join(" "), this.error && (this.outputText += this.errorMsg.split("\n").reduce((e, t, r) => e + `\n${r ? " " : o.pointerSmall} ${n.red().italic(t)}`, "")), this.out.write(s.line + c.to(0) + this.outputText)); } }; })), le = /* @__PURE__ */ w(((e, t) => { var n = A(), r = B(), { cursor: i, erase: a } = N(), { style: o, figures: s, clear: c, lines: l } = ee(), u = /[0-9]/, d = (e) => e !== void 0, f = (e, t) => { let n = 10 ** t; return Math.round(e * n) / n; }; t.exports = class extends r { constructor(e = {}) { super(e), this.transform = o.render(e.style), this.msg = e.message, this.initial = d(e.initial) ? e.initial : "", this.float = !!e.float, this.round = e.round || 2, this.inc = e.increment || 1, this.min = d(e.min) ? e.min : -Infinity, this.max = d(e.max) ? e.max : Infinity, this.errorMsg = e.error || "Please Enter A Valid Value", this.validator = e.validate || (() => !0), this.color = "cyan", this.value = "", this.typed = "", this.lastHit = 0, this.render(); } set value(e) { !e && e !== 0 ? (this.placeholder = !0, this.rendered = n.gray(this.transform.render(`${this.initial}`)), this._value = "") : (this.placeholder = !1, this.rendered = this.transform.render(`${f(e, this.round)}`), this._value = f(e, this.round)), this.fire(); } get value() { return this._value; } parse(e) { return this.float ? parseFloat(e) : parseInt(e); } valid(e) { return e === "-" || e === "." && this.float || u.test(e); } reset() { this.typed = "", this.value = "", this.fire(), this.render(); } exit() { this.abort(); } abort() { let e = this.value; this.value = e === "" ? this.initial : e, this.done = this.aborted = !0, this.error = !1, this.fire(), this.render(), this.out.write("\n"), this.close(); } async validate() { let e = await this.validator(this.value); typeof e == "string" && (this.errorMsg = e, e = !1), this.error = !e; } async submit() { if (await this.validate(), this.error) { this.color = "red", this.fire(), this.render(); return; } let e = this.value; this.value = e === "" ? this.initial : e, this.done = !0, this.aborted = !1, this.error = !1, this.fire(), this.render(), this.out.write("\n"), this.close(); } up() { if (this.typed = "", this.value === "" && (this.value = this.min === -Infinity ? 0 - this.inc : 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 === -Infinity ? 0 + this.inc : this.min + this.inc), this.value <= this.min) return this.bell(); this.value -= this.inc, this.color = "cyan", this.fire(), this.render(); } delete() { let e = this.value.toString(); if (e.length === 0) return this.bell(); this.value = this.parse(e = e.slice(0, -1)) || "", this.value !== "" && this.value < this.min && (this.value = this.min === -Infinity ? 0 : this.min), this.color = "cyan", this.fire(), this.render(); } next() { this.value = this.initial, this.fire(), this.render(); } _(e, t) { if (!this.valid(e)) return this.bell(); let n = Date.now(); if (n - this.lastHit > 1e3 && (this.typed = ""), this.typed += e, this.lastHit = n, this.color = "cyan", e === ".") 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(i.down(l(this.outputError, this.out.columns) - 1) + c(this.outputError, this.out.columns)), this.out.write(c(this.outputText, this.out.columns))), super.render(), this.outputError = "", this.outputText = [ o.symbol(this.done, this.aborted), n.bold(this.msg), o.delimiter(this.done), !this.done || !this.done && !this.placeholder ? n[this.color]().underline(this.rendered) : this.rendered ].join(" "), this.error && (this.outputError += this.errorMsg.split("\n").reduce((e, t, r) => e + `\n${r ? " " : s.pointerSmall} ${n.red().italic(t)}`, "")), this.out.write(a.line + i.to(0) + this.outputText + i.save + this.outputError + i.restore)); } }; })), ue = /* @__PURE__ */ w(((e, t) => { var n = A(), { cursor: r } = N(), i = B(), { clear: a, figures: o, style: s, wrap: c, entriesToDisplay: l } = ee(); t.exports = class extends i { constructor(e = {}) { super(e), this.isSelect = !0, this.msg = e.message, this.cursorStart = e.choices.findIndex((e) => !e.heading), this.cursor = e.cursor || this.cursorStart, this.scrollIndex = e.cursor || 0, this.hint = e.hint || "", this.warn = e.warn || "- This option is disabled -", this.minSelected = e.min, this.showMinError = !1, this.maxChoices = e.max, this.instructions = e.instructions, this.optionsPerPage = e.optionsPerPage || 10, this.value = e.choices.map((e, t) => (typeof e == "string" && (e = { title: e, value: t }), { title: e && (e.title || e.value || e), description: e && e.description, value: e && (e.value === void 0 ? t : e.value), selected: e && e.selected, disabled: e && e.disabled, heading: e && e.heading })), this.clear = a("", this.out.columns), e.overrideRender || this.render(); } reset() { this.value.map((e) => !e.selected), this.cursor = this.cursorStart, this.fire(), this.render(); } selected() { return this.value.filter((e) => e.selected); } exit() { this.abort(); } abort() { this.done = this.aborted = !0, this.fire(), this.render(), this.out.write("\n"), this.close(); } submit() { let e = this.value.filter((e) => e.selected); this.minSelected && e.length < this.minSelected ? (this.showMinError = !0, this.render()) : (this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write("\n"), 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((e) => e.selected).length >= this.maxChoices) return this.bell(); this.value[this.cursor].selected = !0, this.render(); } handleSpaceToggle() { let e = this.value[this.cursor]; if (e.selected) e.selected = !1, this.render(); else if (e.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) return this.bell(); else e.selected = !0, this.render(); } toggleAll() { if (this.maxChoices !== void 0 || this.value[this.cursor].disabled) return this.bell(); let e = !this.value[this.cursor].selected; this.value.filter((e) => !e.disabled && !e.heading).forEach((t) => t.selected = e), this.render(); } _(e, t) { if (e === " ") this.handleSpaceToggle(); else if (e === "a") this.toggleAll(); else return this.bell(); } renderInstructions() { return this.instructions === void 0 || this.instructions ? typeof this.instructions == "string" ? this.instructions : ` Instructions: ${o.arrowUp}/${o.arrowDown}: Highlight option\n ${o.arrowLeft}/${o.arrowRight}/[space]: Toggle selection\n` + (this.maxChoices === void 0 ? " a: Toggle all\n" : "") + " enter/return: Complete answer" : ""; } renderOption(e, t, r, i) { let a = (e === r ? "❯ " : " ") + (t.selected ? n.green(o.radioOn) : o.radioOff) + " ", s, l; if (t.disabled) s = e === r ? n.gray(t.title) : n.strikethrough().gray(t.title); else if (t.heading) return s = t.title, s + n.gray(l || ""); else s = t.title, e === r && t.description && (l = ` - ${t.description}`, (a.length + s.length + l.length >= this.out.columns || t.description.split(/\r?\n/).length > 1) && (l = "\n" + c(t.description, { margin: a.length, width: this.out.columns }))); return a + s + n.gray(l || ""); } paginateOptions(e) { if (e.length === 0) return n.red("No matches for this query."); let { startIndex: t, endIndex: r } = l(this.cursor, e.length, this.optionsPerPage), i, a = []; for (let n = t; n < r; n++) i = n === t && t > 0 ? o.arrowUp : n === r - 1 && r < e.length ? o.arrowDown : " ", a.push(this.renderOption(this.cursor, e[n], n, i)); return "\n" + a.join("\n"); } renderOptions(e) { return this.done ? "" : this.paginateOptions(e); } renderDoneOrInstructions() { if (this.done) return ""; let e = [n.gray(this.hint), this.renderInstructions()]; return this.value[this.cursor].disabled && e.push(n.yellow(this.warn)), e.join(" "); } render() { if (this.closed) return; this.firstRender && this.out.write(r.hide), super.render(); let e = [ s.symbol(this.done, this.aborted), n.bold(this.msg), s.delimiter(!1), this.renderDoneOrInstructions() ].join(" "); this.showMinError &&= (e += n.red(`You must select a minimum of ${this.minSelected} choices.`), !1), e += this.renderOptions(this.value), this.out.write(this.clear + e), this.clear = a(e, this.out.columns); } }; })), de = /* @__PURE__ */ w(((e, t) => { var n = A(), r = B(), { erase: i, cursor: a } = N(), { style: o, clear: s, figures: c, wrap: l, entriesToDisplay: u } = ee(), d = (e, t) => e[t] && (e[t].value || e[t].title || e[t]), f = (e, t) => e[t] && (e[t].title || e[t].value || e[t]), p = (e, t) => { let n = e.findIndex((e) => e.value === t || e.title === t); return n > -1 ? n : void 0; }; t.exports = class extends r { constructor(e = {}) { super(e), this.msg = e.message, this.suggest = e.suggest, this.choices = e.choices, this.initial = typeof e.initial == "number" ? e.initial : p(e.choices, e.initial), this.select = this.initial || e.cursor || 0, this.i18n = { noMatches: e.noMatches || "no matches found" }, this.fallback = e.fallback || this.initial, this.clearFirst = e.clearFirst || !1, this.suggestions = [], this.input = "", this.limit = e.limit || 10, this.cursor = 0, this.transform = o.render(e.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(e) { this._fb = Number.isSafeInteger(parseInt(e)) ? parseInt(e) : e; } get fallback() { let e; return typeof this._fb == "number" ? e = this.choices[this._fb] : typeof this._fb == "string" && (e = { title: this._fb }), e || this._fb || { title: this.i18n.noMatches }; } moveSelect(e) { this.select = e, this.suggestions.length > 0 ? this.value = d(this.suggestions, e) : this.value = this.fallback.value, this.fire(); } async complete(e) { let t = this.completing = this.suggest(this.input, this.choices), n = await t; if (this.completing !== t) return; this.suggestions = n.map((e, t, n) => ({ title: f(n, t), value: d(n, t), description: e.description })), this.completing = !1; let r = Math.max(n.length - 1, 0); this.moveSelect(Math.min(r, this.select)), e && e(); } reset() { this.input = "", this.complete(() => { this.moveSelect(this.initial === void 0 ? 0 : this.initial), 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("\n"), this.close()); } abort() { this.done = this.aborted = !0, this.exited = !1, this.fire(), this.render(), this.out.write("\n"), this.close(); } submit() { this.done = !0, this.aborted = this.exited = !1, this.fire(), this.render(), this.out.write("\n"), this.close(); } _(e, t) { let n = this.input.slice(0, this.cursor), r = this.input.slice(this.cursor); this.input = `${n}${e}${r}`, this.cursor = n.length + 1, this.complete(this.render), this.render(); } delete() { if (this.cursor === 0) return this.bell(); let e = this.input.slice(0, this.cursor - 1), t = this.input.slice(this.cursor); this.input = `${e}${t}`, this.complete(this.render), --this.cursor, this.render(); } deleteForward() { if (this.cursor * this.scale >= this.rendered.length) return this.bell(); let e = this.input.slice(0, this.cursor), t = this.input.slice(this.cursor + 1); this.input = `${e}${t}`, 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.render(); } right() { if (this.cursor * this.scale >= this.rendered.length) return this.bell(); this.cursor += 1, this.render(); } renderOption(e, t, r, i) { let a, o = r ? c.arrowUp : i ? c.arrowDown : " ", s = t ? n.cyan().underline(e.title) : e.title; return o = (t ? n.cyan(c.pointer) + " " : " ") + o, e.description && (a = ` - ${e.description}`, (o.length + s.length + a.length >= this.out.columns || e.description.split(/\r?\n/).length > 1) && (a = "\n" + l(e.description, { margin: 3, width: this.out.columns }))), o + " " + s + n.gray(a || ""); } render() { if (this.closed) return; this.firstRender ? this.out.write(a.hide) : this.out.write(s(this.outputText, this.out.columns)), super.render(); let { startIndex: e, endIndex: t } = u(this.select, this.choices.length, this.limit); if (this.outputText = [ o.symbol(this.done, this.aborted, this.exited), n.bold(this.msg), o.delimiter(this.completing), this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input) ].join(" "), !this.done) { let r = this.suggestions.slice(e, t).map((n, r) => this.renderOption(n, this.select === r + e, r === 0 && e > 0, r + e === t - 1 && t < this.choices.length)).join("\n"); this.outputText += "\n" + (r || n.gray(this.fallback.title)); } this.out.write(i.line + a.to(0) + this.outputText); } }; })), fe = /* @__PURE__ */ w(((e, t) => { var n = A(), { cursor: r } = N(), i = ue(), { clear: a, style: o, figures: s } = ee(); t.exports = class extends i { constructor(e = {}) { e.overrideRender = !0, super(e), this.inputValue = "", this.clear = a("", 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((e) => e.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() { let e = this.filteredOptions[this.cursor]; this.filteredOptions = this.value.filter((e) => this.inputValue ? !!(typeof e.title == "string" && e.title.toLowerCase().includes(this.inputValue.toLowerCase()) || typeof e.value == "string" && e.value.toLowerCase().includes(this.inputValue.toLowerCase())) : !0); let t = this.filteredOptions.findIndex((t) => t === e); this.cursor = t < 0 ? 0 : t, this.render(); } handleSpaceToggle() { let e = this.filteredOptions[this.cursor]; if (e.selected) e.selected = !1, this.render(); else if (e.disabled || this.value.filter((e) => e.selected).length >= this.maxChoices) return this.bell(); else e.selected = !0, this.render(); } handleInputChange(e) { this.inputValue += e, this.updateFilteredOptions(); } _(e, t) { e === " " ? this.handleSpaceToggle() : this.handleInputChange(e); } 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 : n.gray("Enter something to filter")}\n`; } renderOption(e, t, r, i) { let a = (t.selected ? n.green(s.radioOn) : s.radioOff) + " " + i + " ", o; return o = t.disabled ? e === r ? n.gray().underline(t.title) : n.strikethrough().gray(t.title) : e === r ? n.cyan().underline(t.title) : t.title, a + o; } renderDoneOrInstructions() { if (this.done) return this.value.filter((e) => e.selected).map((e) => e.title).join(", "); let e = [ n.gray(this.hint), this.renderInstructions(), this.renderCurrentInput() ]; return this.filteredOptions.length && this.filteredOptions[this.cursor].disabled && e.push(n.yellow(this.warn)), e.join(" "); } render() { if (this.closed) return; this.firstRender && this.out.write(r.hide), super.render(); let e = [ o.symbol(this.done, this.aborted), n.bold(this.msg), o.delimiter(!1), this.renderDoneOrInstructions() ].join(" "); this.showMinError &&= (e += n.red(`You must select a minimum of ${this.minSelected} choices.`), !1), e += this.renderOptions(this.filteredOptions), this.out.write(this.clear + e), this.clear = a(e, this.out.columns); } }; })), pe = /* @__PURE__ */ w(((e, t) => { var n = A(), r = B(), { style: i, clear: a } = ee(), { erase: o, cursor: s } = N(); t.exports = class extends r { constructor(e = {}) { super(e), this.msg = e.message, this.value = e.initial, this.initialValue = !!e.initial, this.yesMsg = e.yes || "yes", this.yesOption = e.yesOption || "(Y/n)", this.noMsg = e.no || "no", this.noOption = e.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("\n"), this.close(); } submit() { this.value = this.value || !1, this.done = !0, this.aborted = !1, this.fire(), this.render(), this.out.write("\n"), this.close(); } _(e, t) { return e.toLowerCase() === "y" ? (this.value = !0, this.submit()) : e.toLowerCase() === "n" ? (this.value = !1, this.submit()) : this.bell(); } render() { if (this.closed) return; this.firstRender ? this.out.write(s.hide) : this.out.write(a(this.outputText, this.out.columns)), super.render(); let e = this.aborted || this.done && !this.value; this.outputText = [ i.symbol(this.done, e), n.bold(this.msg), i.delimiter(this.done), this.done ? this.value && !this.aborted ? this.yesMsg : this.noMsg : n.gray(this.initialValue ? this.yesOption : this.noOption) ].join(" "), this.out.write(o.line + s.to(0) + this.outputText); } }; })), me = /* @__PURE__ */ w(((e, t) => { t.exports = { TextPrompt: V(), SelectPrompt: H(), TogglePrompt: te(), DatePrompt: ce(), NumberPrompt: le(), MultiselectPrompt: ue(), AutocompletePrompt: de(), AutocompleteMultiselectPrompt: fe(), ConfirmPrompt: pe() }; })), he = /* @__PURE__ */ w(((e) => { var t = e, n = me(), r = (e) => e; function i(e, t, i = {}) { return new Promise((a, o) => { let s = new n[e](t), c = i.onAbort || r, l = i.onSubmit || r, u = i.onExit || r; s.on("state", t.onState || r), s.on("submit", (e) => a(l(e))), s.on("exit", (e) => a(u(e))), s.on("abort", (e) => o(c(e))); }); } t.text = (e) => i("TextPrompt", e), t.password = (e) => (e.style = "password", t.text(e)), t.invisible = (e) => (e.style = "invisible", t.text(e)), t.number = (e) => i("NumberPrompt", e), t.date = (e) => i("DatePrompt", e), t.confirm = (e) => i("ConfirmPrompt", e), t.list = (e) => { let t = e.separator || ","; return i("TextPrompt", e, { onSubmit: (e) => e.split(t).map((e) => e.trim()) }); }, t.toggle = (e) => i("TogglePrompt", e), t.select = (e) => i("SelectPrompt", e), t.multiselect = (e) => { e.choices = [].concat(e.choices || []); let t = (e) => e.filter((e) => e.selected).map((e) => e.value); return i("MultiselectPrompt", e, { onAbort: t, onSubmit: t }); }, t.autocompleteMultiselect = (e) => { e.choices = [].concat(e.choices || []); let t = (e) => e.filter((e) => e.selected).map((e) => e.value); return i("AutocompleteMultiselectPrompt", e, { onAbort: t, onSubmit: t }); }; var a = (e, t) => Promise.resolve(t.filter((t) => t.title.slice(0, e.length).toLowerCase() === e.toLowerCase())); t.autocomplete = (e) => (e.suggest = e.suggest || a, e.choices = [].concat(e.choices || []), i("Au