UNPKG

npm-check-updates

Version:

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

1,234 lines 1.77 MB
import { a as mt, i as ge, n as Ft, o as Nt, r as yt, t as P } from "./chunks/chunk-Njdj7H0c.js"; import { n as Gg, t as zg } from "./chunks/_stub_typescript-gMx00gpr.js"; import { n as th, t as rh } from "./chunks/p-map-OzxwbPLg.js"; import { createRequire as Wg } from "node:module"; import ze from "path"; import Wr from "fs"; import Zr from "os"; import Vg from "util"; import Qe from "fs/promises"; import Ui from "node:process"; import Oi from "node:os"; import uc from "node:tty"; import { URL as Yg } from "url"; import ot, { dirname as Kg } from "node:path"; import { fileURLToPath as No } from "node:url"; import { promisify as ih, stripVTControlCharacters as Zg } from "node:util"; import Qs, { promises as hc } from "node:fs"; import Jg, { execFile as Xg } from "node:child_process"; import { text as Qg } from "node:stream/consumers"; var Gt = /* @__PURE__ */ P(((e, t) => { var r, i, s, h, o = !0; typeof process < "u" && ({ FORCE_COLOR: r, NODE_DISABLE_COLORS: i, NO_COLOR: s, TERM: h } = process.env || {}, o = process.stdout && process.stdout.isTTY); var n = { enabled: !i && s == null && h !== "dumb" && (r != null && r !== "0" || o), 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(a, c) { let d = 0, p, m = "", g = ""; for (; d < a.length; d++) p = a[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(a, c) { let d = { has: a, keys: c }; return d.reset = n.reset.bind(d), d.bold = n.bold.bind(d), d.dim = n.dim.bind(d), d.italic = n.italic.bind(d), d.underline = n.underline.bind(d), d.inverse = n.inverse.bind(d), d.hidden = n.hidden.bind(d), d.strikethrough = n.strikethrough.bind(d), d.black = n.black.bind(d), d.red = n.red.bind(d), d.green = n.green.bind(d), d.yellow = n.yellow.bind(d), d.blue = n.blue.bind(d), d.magenta = n.magenta.bind(d), d.cyan = n.cyan.bind(d), d.white = n.white.bind(d), d.gray = n.gray.bind(d), d.grey = n.grey.bind(d), d.bgBlack = n.bgBlack.bind(d), d.bgRed = n.bgRed.bind(d), d.bgGreen = n.bgGreen.bind(d), d.bgYellow = n.bgYellow.bind(d), d.bgBlue = n.bgBlue.bind(d), d.bgMagenta = n.bgMagenta.bind(d), d.bgCyan = n.bgCyan.bind(d), d.bgWhite = n.bgWhite.bind(d), d; } function f(a, c) { let d = { open: `\x1B[${a}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(a) || (this.has.push(a), this.keys.push(d)), p === void 0 ? this : n.enabled ? u(this.keys, p + "") : p + "") : p === void 0 ? l([a], [d]) : n.enabled ? u([d], p + "") : p + ""; }; } t.exports = n; })), em = /* @__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; } }; })), xo = /* @__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("|"), s = new RegExp(i, "g"); return typeof r == "string" ? r.replace(s, "") : r; }; })), zt = /* @__PURE__ */ P(((e, t) => { var r = "\x1B", i = `${r}[`, s = "\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` }, o = { up: (u = 1) => `${i}S`.repeat(u), down: (u = 1) => `${i}T`.repeat(u) }, n = { 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: o, erase: n, beep: s }; })), tm = /* @__PURE__ */ P(((e, t) => { var r = xo(), { erase: i, cursor: s } = zt(), h = (o) => [...r(o)].length; t.exports = function(o, n) { if (!n) return i.line + s.to(0); let u = 0; const l = o.split(/\r?\n/); for (let f of l) u += 1 + Math.floor(Math.max(h(f) - 1, 0) / n); return i.lines(u); }; })), nh = /* @__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: ">" }, s = process.platform === "win32" ? i : r; t.exports = s; })), rm = /* @__PURE__ */ P(((e, t) => { var r = Gt(), i = nh(), s = 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) => s[f] || s.default, o = Object.freeze({ aborted: r.red(i.cross), done: r.green(i.tick), exited: r.yellow(i.cross), default: r.cyan("?") }), n = (f, a, c) => a ? o.aborted : c ? o.exited : f ? o.done : o.default, u = (f) => r.gray(f ? i.ellipsis : i.pointerSmall), l = (f, a) => r.gray(f ? a ? i.pointerSmall : "+" : i.line); t.exports = { styles: s, render: h, symbols: o, symbol: n, delimiter: u, item: l }; })), im = /* @__PURE__ */ P(((e, t) => { var r = xo(); t.exports = function(i, s) { let h = String(r(i) || "").split(/\r?\n/); return s ? h.map((o) => Math.ceil(o.length / s)).reduce((o, n) => o + n) : h.length; }; })), nm = /* @__PURE__ */ P(((e, t) => { t.exports = (r, i = {}) => { const s = Number.isSafeInteger(parseInt(i.margin)) ? new Array(parseInt(i.margin)).fill(" ").join("") : i.margin || "", h = i.width; return (r || "").split(/\r?\n/g).map((o) => o.split(/\s+/g).reduce((n, u) => (u.length + s.length >= h || n[n.length - 1].length + u.length + 1 < h ? n[n.length - 1] += ` ${u}` : n.push(`${s}${u}`), n), [s]).join(` `)).join(` `); }; })), sm = /* @__PURE__ */ P(((e, t) => { t.exports = (r, i, s) => { s = s || i; let h = Math.min(i - s, r - Math.floor(s / 2)); h < 0 && (h = 0); let o = Math.min(h + s, i); return { startIndex: h, endIndex: o }; }; })), er = /* @__PURE__ */ P(((e, t) => { t.exports = { action: em(), clear: tm(), style: rm(), strip: xo(), figures: nh(), lines: im(), wrap: nm(), entriesToDisplay: sm() }; })), fr = /* @__PURE__ */ P(((e, t) => { var r = ge("readline"), { action: i } = er(), s = ge("events"), { beep: h, cursor: o } = zt(), n = Gt(), u = class extends s { 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 a = (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(o.show), this.in.removeListener("keypress", a), 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", a); } fire() { this.emit("state", { value: this.value, aborted: !!this.aborted, exited: !!this.exited }); } bell() { this.out.write(h); } render() { this.onRender(n), this.firstRender && (this.firstRender = !1); } }; t.exports = u; })), am = /* @__PURE__ */ P(((e, t) => { var r = Gt(), i = fr(), { erase: s, cursor: h } = zt(), { style: o, clear: n, lines: u, figures: l } = er(), f = class extends i { constructor(a = {}) { super(a), this.transform = o.render(a.style), this.scale = this.transform.scale, this.msg = a.message, this.initial = a.initial || "", this.validator = a.validate || (() => !0), this.value = "", this.errorMsg = a.error || "Please Enter A Valid Value", this.cursor = +!!this.initial, this.cursorOffset = 0, this.clear = n("", this.out.columns), this.render(); } set value(a) { !a && this.initial ? (this.placeholder = !0, this.rendered = r.gray(this.transform.render(this.initial))) : (this.placeholder = !1, this.rendered = this.transform.render(a)), this._value = a, 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 a = await this.validator(this.value); typeof a == "string" && (this.errorMsg = a, a = !1), this.error = !a; } 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(a) { this.placeholder || (this.cursor = this.cursor + a, this.cursorOffset += a); } _(a, c) { let d = this.value.slice(0, this.cursor), p = this.value.slice(this.cursor); this.value = `${d}${a}${p}`, this.red = !1, this.cursor = this.placeholder ? 0 : d.length + 1, this.render(); } delete() { if (this.isCursorAtStart()) return this.bell(); let a = this.value.slice(0, this.cursor - 1), c = this.value.slice(this.cursor); this.value = `${a}${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 a = this.value.slice(0, this.cursor), c = this.value.slice(this.cursor + 1); this.value = `${a}${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) + n(this.outputError, this.out.columns)), this.out.write(n(this.outputText, this.out.columns))), super.render(), this.outputError = "", this.outputText = [ o.symbol(this.done, this.aborted), r.bold(this.msg), o.delimiter(this.done), this.red ? r.red(this.rendered) : this.rendered ].join(" "), this.error && (this.outputError += this.errorMsg.split(` `).reduce((a, c, d) => a + ` ${d ? " " : l.pointerSmall} ${r.red().italic(c)}`, "")), this.out.write(s.line + h.to(0) + this.outputText + h.save + this.outputError + h.restore + h.move(this.cursorOffset, 0))); } }; t.exports = f; })), om = /* @__PURE__ */ P(((e, t) => { var r = Gt(), i = fr(), { style: s, clear: h, figures: o, wrap: n, entriesToDisplay: u } = er(), { cursor: l } = zt(), f = class extends i { constructor(a = {}) { super(a), this.isSelect = !0, this.msg = a.message, this.hint = a.hint || "- Use arrow-keys. Return to submit.", this.warn = a.warn || "- This option is disabled", this.cursor = a.initial || 0, this.choices = a.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 = a.optionsPerPage || 10, this.value = (this.choices[this.cursor] || {}).value, this.clear = h("", this.out.columns), this.render(); } moveCursor(a) { this.cursor = a, this.value = this.choices[a].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(); } _(a, c) { if (a === " ") 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: a, endIndex: c } = u(this.cursor, this.choices.length, this.optionsPerPage); if (this.outputText = [ s.symbol(this.done, this.aborted), r.bold(this.msg), s.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 = a; d < c; d++) { let p, m, g = "", v = this.choices[d]; d === a && a > 0 ? m = o.arrowUp : d === c - 1 && c < this.choices.length ? m = o.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(o.pointer) + " " : " ") + m) : (p = this.cursor === d ? r.cyan().underline(v.title) : v.title, m = (this.cursor === d ? r.cyan(o.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 = ` ` + n(v.description, { margin: 3, width: this.out.columns })))), this.outputText += `${m} ${p}${r.gray(g)} `; } } this.out.write(this.outputText); } }; t.exports = f; })), lm = /* @__PURE__ */ P(((e, t) => { var r = Gt(), i = fr(), { style: s, clear: h } = er(), { cursor: o, erase: n } = 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(o.hide) : this.out.write(h(this.outputText, this.out.columns)), super.render(), this.outputText = [ s.symbol(this.done, this.aborted), r.bold(this.msg), s.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(n.line + o.to(0) + this.outputText)); } }; t.exports = u; })), nr = /* @__PURE__ */ P(((e, t) => { var r = class ea { constructor({ token: s, date: h, parts: o, locales: n }) { this.token = s, this.date = h || /* @__PURE__ */ new Date(), this.parts = o || [this], this.locales = n || {}; } up() { } down() { } next() { const s = this.parts.indexOf(this); return this.parts.find((h, o) => o > s && h instanceof ea); } setTo(s) { } prev() { let s = [].concat(this.parts).reverse(); const h = s.indexOf(this); return s.find((o, n) => n > h && o instanceof ea); } toString() { return String(this.date); } }; t.exports = r; })), cm = /* @__PURE__ */ P(((e, t) => { var r = nr(), i = class extends r { constructor(s = {}) { super(s); } up() { this.date.setHours((this.date.getHours() + 12) % 24); } down() { this.up(); } toString() { let s = this.date.getHours() > 12 ? "pm" : "am"; return /\A/.test(this.token) ? s.toUpperCase() : s; } }; t.exports = i; })), um = /* @__PURE__ */ P(((e, t) => { var r = nr(), i = (h) => (h = h % 10, h === 1 ? "st" : h === 2 ? "nd" : h === 3 ? "rd" : "th"), s = 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(), o = this.date.getDay(); return this.token === "DD" ? String(h).padStart(2, "0") : this.token === "Do" ? h + i(h) : this.token === "d" ? o + 1 : this.token === "ddd" ? this.locales.weekdaysShort[o] : this.token === "dddd" ? this.locales.weekdays[o] : h; } }; t.exports = s; })), hm = /* @__PURE__ */ P(((e, t) => { var r = nr(), i = class extends r { constructor(s = {}) { super(s); } up() { this.date.setHours(this.date.getHours() + 1); } down() { this.date.setHours(this.date.getHours() - 1); } setTo(s) { this.date.setHours(parseInt(s.substr(-2))); } toString() { let s = this.date.getHours(); return /h/.test(this.token) && (s = s % 12 || 12), this.token.length > 1 ? String(s).padStart(2, "0") : s; } }; t.exports = i; })), fm = /* @__PURE__ */ P(((e, t) => { var r = nr(), i = class extends r { constructor(s = {}) { super(s); } up() { this.date.setMilliseconds(this.date.getMilliseconds() + 1); } down() { this.date.setMilliseconds(this.date.getMilliseconds() - 1); } setTo(s) { this.date.setMilliseconds(parseInt(s.substr(-this.token.length))); } toString() { return String(this.date.getMilliseconds()).padStart(4, "0").substr(0, this.token.length); } }; t.exports = i; })), dm = /* @__PURE__ */ P(((e, t) => { var r = nr(), i = class extends r { constructor(s = {}) { super(s); } up() { this.date.setMinutes(this.date.getMinutes() + 1); } down() { this.date.setMinutes(this.date.getMinutes() - 1); } setTo(s) { this.date.setMinutes(parseInt(s.substr(-2))); } toString() { let s = this.date.getMinutes(); return this.token.length > 1 ? String(s).padStart(2, "0") : s; } }; t.exports = i; })), pm = /* @__PURE__ */ P(((e, t) => { var r = nr(), i = class extends r { constructor(s = {}) { super(s); } up() { this.date.setMonth(this.date.getMonth() + 1); } down() { this.date.setMonth(this.date.getMonth() - 1); } setTo(s) { s = parseInt(s.substr(-2)) - 1, this.date.setMonth(s < 0 ? 0 : s); } toString() { let s = this.date.getMonth(), h = this.token.length; return h === 2 ? String(s + 1).padStart(2, "0") : h === 3 ? this.locales.monthsShort[s] : h === 4 ? this.locales.months[s] : String(s + 1); } }; t.exports = i; })), gm = /* @__PURE__ */ P(((e, t) => { var r = nr(), i = class extends r { constructor(s = {}) { super(s); } up() { this.date.setSeconds(this.date.getSeconds() + 1); } down() { this.date.setSeconds(this.date.getSeconds() - 1); } setTo(s) { this.date.setSeconds(parseInt(s.substr(-2))); } toString() { let s = this.date.getSeconds(); return this.token.length > 1 ? String(s).padStart(2, "0") : s; } }; t.exports = i; })), mm = /* @__PURE__ */ P(((e, t) => { var r = nr(), i = class extends r { constructor(s = {}) { super(s); } up() { this.date.setFullYear(this.date.getFullYear() + 1); } down() { this.date.setFullYear(this.date.getFullYear() - 1); } setTo(s) { this.date.setFullYear(s.substr(-4)); } toString() { let s = String(this.date.getFullYear()).padStart(4, "0"); return this.token.length === 2 ? s.substr(-2) : s; } }; t.exports = i; })), vm = /* @__PURE__ */ P(((e, t) => { t.exports = { DatePart: nr(), Meridiem: cm(), Day: um(), Hours: hm(), Milliseconds: fm(), Minutes: dm(), Month: pm(), Seconds: gm(), Year: mm() }; })), ym = /* @__PURE__ */ P(((e, t) => { var r = Gt(), i = fr(), { style: s, clear: h, figures: o } = er(), { erase: n, cursor: u } = zt(), { DatePart: l, Meridiem: f, Day: a, Hours: c, Milliseconds: d, Minutes: p, Month: m, Seconds: g, Year: v } = vm(), 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 a(_), 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 = [ s.symbol(this.done, this.aborted), r.bold(this.msg), s.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 ? " " : o.pointerSmall} ${r.red().italic(S)}`, "")), this.out.write(n.line + u.to(0) + this.outputText)); } }; t.exports = w; })), _m = /* @__PURE__ */ P(((e, t) => { var r = Gt(), i = fr(), { cursor: s, erase: h } = zt(), { style: o, figures: n, clear: u, lines: l } = er(), f = /[0-9]/, a = (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 = o.render(p.style), this.msg = p.message, this.initial = a(p.initial) ? p.initial : "", this.float = !!p.float, this.round = p.round || 2, this.inc = p.increment || 1, this.min = a(p.min) ? p.min : -1 / 0, this.max = a(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(s.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 = [ o.symbol(this.done, this.aborted), r.bold(this.msg), o.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 ? " " : n.pointerSmall} ${r.red().italic(m)}`, "")), this.out.write(h.line + s.to(0) + this.outputText + s.save + this.outputError + s.restore)); } }; t.exports = d; })), sh = /* @__PURE__ */ P(((e, t) => { var r = Gt(), { cursor: i } = zt(), s = fr(), { clear: h, figures: o, style: n, wrap: u, entriesToDisplay: l } = er(), f = class extends s { constructor(a = {}) { super(a), this.isSelect = !0, this.msg = a.message, this.cursorStart = a.choices.findIndex((c) => !c.heading), this.cursor = a.cursor || this.cursorStart, this.scrollIndex = a.cursor || 0, this.hint = a.hint || "", this.warn = a.warn || "- This option is disabled -", this.minSelected = a.min, this.showMinError = !1, this.maxChoices = a.max, this.instructions = a.instructions, this.optionsPerPage = a.optionsPerPage || 10, this.value = a.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), a.overrideRender || this.render(); } reset() { this.value.map((a) => !a.selected), this.cursor = this.cursorStart, this.fire(), this.render(); } selected() { return this.value.filter((a) => a.selected); } exit() { this.abort(); } abort() { this.done = this.aborted = !0, this.fire(), this.render(), this.out.write(` `), this.close(); } submit() { const a = this.value.filter((c) => c.selected); this.minSelected && a.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((a) => a.selected).length >= this.maxChoices) return this.bell(); this.value[this.cursor].selected = !0, this.render(); } handleSpaceToggle() { const a = this.value[this.cursor]; if (a.selected) a.selected = !1, this.render(); else { if (a.disabled || this.value.filter((c) => c.selected).length >= this.maxChoices) return this.bell(); a.selected = !0, this.render(); } } toggleAll() { if (this.maxChoices !== void 0 || this.value[this.cursor].disabled) return this.bell(); const a = !this.value[this.cursor].selected; this.value.filter((c) => !c.disabled && !c.heading).forEach((c) => c.selected = a), this.render(); } _(a, c) { if (a === " ") this.handleSpaceToggle(); else if (a === "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 ${o.arrowLeft}/${o.arrowRight}/[space]: Toggle selection ` + (this.maxChoices === void 0 ? ` a: Toggle all ` : "") + " enter/return: Complete answer" : ""; } renderOption(a, c, d, p) { const m = (a === d ? "❯ " : " ") + (c.selected ? r.green(o.radioOn) : o.radioOff) + " "; let g, v; if (c.disabled) g = a === 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, a === 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(a) { if (a.length === 0) return r.red("No matches for this query."); let { startIndex: c, endIndex: d } = l(this.cursor, a.length, this.optionsPerPage), p, m = []; for (let g = c; g < d; g++) g === c && c > 0 ? p = o.arrowUp : g === d - 1 && d < a.length ? p = o.arrowDown : p = " ", m.push(this.renderOption(this.cursor, a[g], g, p)); return ` ` + m.join(` `); } renderOptions(a) { return this.done ? "" : this.paginateOptions(a); } renderDoneOrInstructions() { if (this.done) return ""; const a = [r.gray(this.hint), this.renderInstructions()]; return this.value[this.cursor].disabled && a.push(r.yellow(this.warn)), a.join(" "); } render() { if (this.closed) return; this.firstRender && this.out.write(i.hide), super.render(); let a = [ n.symbol(this.done, this.aborted), r.bold(this.msg), n.delimiter(!1), this.renderDoneOrInstructions() ].join(" "); this.showMinError && (a += r.red(`You must select a minimum of ${this.minSelected} choices.`), this.showMinError = !1), a += this.renderOptions(this.value), this.out.write(this.clear + a), this.clear = h(a, this.out.columns); } }; t.exports = f; })), bm = /* @__PURE__ */ P(((e, t) => { var r = Gt(), i = fr(), { erase: s, cursor: h } = zt(), { style: o, clear: n, figures: u, wrap: l, entriesToDisplay: f } = er(), a = (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 = o.render(m.style), this.scale = this.transform.scale, this.render = this.render.bind(this), this.complete = this.complete.bind(this), this.clear = n("", 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 = a(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: a(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(n(this.outputText, this.out.columns)), super.render(); let { startIndex: m, endIndex: g } = f(this.select, this.choices.length, this.limit); if (this.outputText = [ o.symbol(this.done, this.aborted, this.exited), r.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) { 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(s.line + h.to(0) + this.outputText); } }; t.exports = p; })), wm = /* @__PURE__ */ P(((e, t) => { var r = Gt(), { cursor: i } = zt(), s = sh(), { clear: h, style: o, figures: n } = er(), u = class extends s { 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((a) => this.inputValue ? !!(typeof a.title == "string" && a.title.toLowerCase().includes(this.inputValue.toLowerCase()) || typeof a.value == "string" && a.value.toLowerCase().includes(this.inputValue.toLowerCase())) : !0); const f = this.filteredOptions.findIndex((a) => a === 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: ${n.arrowUp}/${n.arrowDown}: Highlight option ${n.arrowLeft}/${n.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, a, c) { const d = (f.selected ? r.green(n.radioOn) : n.radioOff) + " " + c + " "; let p; return f.disabled ? p = l === a ? r.gray().underline(f.title) : r.strikethrough().gray(f.title) : p = l === a ? 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 = [ o.symbol(this.done, this.aborted), r.bold(this.msg), o.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; })), Em = /* @__PURE__ */ P(((e, t) => { var r = Gt(), i = fr(), { style: s, clear: h } = er(), { erase: o, cursor: n } = 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