npm-check-updates
Version:
Find newer versions of dependencies than what your package.json allows
20,126 lines • 702 kB
JavaScript
import { i as e, n as t, o as n, r, t as i } from "./chunks/rolldown-runtime-CJfroGDQ.js";
import { createRequire as a } from "node:module";
import o from "node:path";
import s from "node:fs/promises";
import c from "node:os";
import { format as l, isDeepStrictEqual as u, promisify as d, stripVTControlCharacters as f } from "node:util";
import p from "node:process";
import m from "node:tty";
import { URL as h, fileURLToPath as g } from "node:url";
import _, { execFile as v } from "node:child_process";
import y, { promises as b } from "node:fs";
import { text as x } from "node:stream/consumers";
//#region node_modules/kleur/index.js
var S = /* @__PURE__ */ i(((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;
})), C = /* @__PURE__ */ i(((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";
}
};
})), w = /* @__PURE__ */ i(((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;
};
})), T = /* @__PURE__ */ i(((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
};
})), E = /* @__PURE__ */ i(((e, t) => {
var n = w(), { erase: r, cursor: i } = T(), 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);
};
})), D = /* @__PURE__ */ i(((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;
})), O = /* @__PURE__ */ i(((e, t) => {
var n = S(), r = D(), 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)
};
})), k = /* @__PURE__ */ i(((e, t) => {
var n = w();
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;
};
})), A = /* @__PURE__ */ i(((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");
};
})), ee = /* @__PURE__ */ i(((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
};
};
})), j = /* @__PURE__ */ i(((e, t) => {
t.exports = {
action: C(),
clear: E(),
style: O(),
strip: w(),
figures: D(),
lines: k(),
wrap: A(),
entriesToDisplay: ee()
};
})), M = /* @__PURE__ */ i(((t, n) => {
var r = e("readline"), { action: i } = j(), a = e("events"), { beep: o, cursor: s } = T(), c = S();
n.exports = class extends a {
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 = r.createInterface({
input: this.in,
escapeCodeTimeout: 50
});
r.emitKeypressEvents(this.in, t), this.in.isTTY && this.in.setRawMode(!0);
let n = (e, t) => {
let n = i(t, this.isSelect);
n === !1 ? this._ && this._(e, t) : typeof this[n] == "function" ? this[n](t) : this.bell();
};
this.close = () => {
this.out.write(s.show), this.in.removeListener("keypress", n), 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", n);
}
fire() {
this.emit("state", {
value: this.value,
aborted: !!this.aborted,
exited: !!this.exited
});
}
bell() {
this.out.write(o);
}
render() {
this.onRender(c), this.firstRender &&= !1;
}
};
})), te = /* @__PURE__ */ i(((e, t) => {
var n = S(), r = M(), { erase: i, cursor: a } = T(), { style: o, clear: s, lines: c, figures: l } = j();
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)));
}
};
})), ne = /* @__PURE__ */ i(((e, t) => {
var n = S(), r = M(), { style: i, clear: a, figures: o, wrap: s, entriesToDisplay: c } = j(), { cursor: l } = T();
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);
}
};
})), re = /* @__PURE__ */ i(((e, t) => {
var n = S(), r = M(), { style: i, clear: a } = j(), { cursor: o, erase: s } = T();
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));
}
};
})), N = /* @__PURE__ */ i(((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);
}
};
})), P = /* @__PURE__ */ i(((e, t) => {
var n = N();
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;
}
};
})), F = /* @__PURE__ */ i(((e, t) => {
var n = N(), 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;
}
};
})), ie = /* @__PURE__ */ i(((e, t) => {
var n = N();
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;
}
};
})), I = /* @__PURE__ */ i(((e, t) => {
var n = N();
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);
}
};
})), L = /* @__PURE__ */ i(((e, t) => {
var n = N();
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;
}
};
})), R = /* @__PURE__ */ i(((e, t) => {
var n = N();
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);
}
};
})), z = /* @__PURE__ */ i(((e, t) => {
var n = N();
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;
}
};
})), B = /* @__PURE__ */ i(((e, t) => {
var n = N();
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;
}
};
})), V = /* @__PURE__ */ i(((e, t) => {
t.exports = {
DatePart: N(),
Meridiem: P(),
Day: F(),
Hours: ie(),
Milliseconds: I(),
Minutes: L(),
Month: R(),
Seconds: z(),
Year: B()
};
})), H = /* @__PURE__ */ i(((e, t) => {
var n = S(), r = M(), { style: i, clear: a, figures: o } = j(), { erase: s, cursor: c } = T(), { DatePart: l, Meridiem: u, Day: d, Hours: f, Milliseconds: p, Minutes: m, Month: h, Seconds: g, Year: _ } = V(), 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));
}
};
})), ae = /* @__PURE__ */ i(((e, t) => {
var n = S(), r = M(), { cursor: i, erase: a } = T(), { style: o, figures: s, clear: c, lines: l } = j(), 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));
}
};
})), oe = /* @__PURE__ */ i(((e, t) => {
var n = S(), { cursor: r } = T(), i = M(), { clear: a, figures: o, style: s, wrap: c, entriesToDisplay: l } = j();
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 ? o.pointer + " " : " ") + (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);
}
};
})), se = /* @__PURE__ */ i(((e, t) => {
var n = S(), r = M(), { erase: i, cursor: a } = T(), { style: o, clear: s, figures: c, wrap: l, entriesToDisplay: u } = j(), 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.value = this.suggestions.length > 0 ? d(this.suggestions, e) : 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);
}
};
})), ce = /* @__PURE__ */ i(((e, t) => {
var n = S(), { cursor: r } = T(), i = oe(), { clear: a, style: o, figures: s } = j();
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())));
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);
}
};
})), U = /* @__PURE__ */ i(((e, t) => {
var n = S(), r = M(), { style: i, clear: a } = j(), { erase: o, cursor: s } = T();
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);
}
};
})), W = /* @__PURE__ */ i(((e, t) => {
t.exports = {
TextPrompt: te(),
SelectPrompt: ne(),
TogglePrompt: re(),
DatePrompt: H(),
NumberPrompt: ae(),
MultiselectPrompt: oe(),
AutocompletePrompt: se(),
AutocompleteMultiselectPrompt: ce(),
ConfirmPrompt: U()
};
})), le = /* @__PURE__ */ i(((e) => {
var t = e, n = W(), 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("AutocompletePrompt", e));
})), ue = /* @__PURE__ */ i(((e, t) => {
var n = le(), r = [
"suggest",
"format",
"onState",
"validate",
"onRender",
"type"
], i = () => {};
async function a(e = [], { onSubmit: t = i, onCancel: s = i } = {}) {
let c = {}, l = a._override || {};
e = [].concat(e);
let u, d, f, p, m, h, g = async (e, t, n = !1) => {
if (!(!n && e.validate && e.validate(t) !== !0)) return e.format ? await e.format(t, c) : t;
};
for (d of e) if ({name: p, type: m} = d, typeof m == "function" && (m = await m(u, { ...c }, d), d.type = m), m) {
for (let e in d) {
if (r.includes(e)) continue;
let t = d[e];
d[e] = typeof t == "function" ? await t(u, { ...c }, h) : t;
}
if (h = d, typeof d.message != "string") throw Error("prompt message is required");
if ({name: p, type: m} = d, n[m] === void 0) throw Error(`prompt type (${m}) is not defined`);
if (l[d.name] !== void 0 && (u = await g(d, l[d.name]), u !== void 0)) {
c[p] = u;
continue;
}
try {
u = a._injected ? o(a._injected, d.initial) : await n[m](d), c[p] = u = await g(d, u, !0), f = await t(d, u, c);
} catch {
f = !await s(d, c);
}
if (f) return c;
}
return c;
}
function o(e, t) {
let n = e.shift();
if (n instanceof Error) throw n;
return n === void 0 ? t : n;
}
function s(e) {
a._injected = (a._injected || []).concat(e);
}
function c(e) {
a._override = Object.assign({}, e);
}
t.exports = Object.assign(a, {
prompt: a,
prompts: n,
inject: s,
override: c
});
})), de = /* @__PURE__ */ n((/* @__PURE__ */ i(((e, t) => {
t.exports = ue();
})))(), 1), fe = {
name: "npm-check-updates",
version: "23.1.0",
author: "Tomas Junnonen <tomas1@gmail.com>",
license: "Apache-2.0",
contributors: ["Raine Revere (https://github.com/raineorshine)", "Imamuzzaki Abu Salam <imamuzzaki@gmail.com>"],
description: "Find newer versions of dependencies than what your package.json allows",
keywords: [
"dependencies",
"npm",
"package.json",
"update",
"upgrade",
"versions"
],
engines: {
node: "^22.22.2 || ^24.15.0 || >=26.0.0",
npm: ">=10.0.0"
},
type: "module",
bin: {
"npm-check-updates": "build/cli.js",
ncu: "build/cli.js"
},
exports: {
".": {
types: "./build/index.d.ts",
default: "./build/index.js"
},
"./package.json": "./package.json"
},
scripts: {
build: "vite build",
"build:options": "node scripts/build-options.ts",
"build:analyze": "cross-env ANALYZER=true vite build",
lint: "cross-env FORCE_COLOR=1 npm-run-all --parallel --continue-on-error --aggregate-output lint:*",
"lint:lockfile": "lockfile-lint",
"lint:types": "tsc --noEmit",
"lint:markdown": "markdownlint-cli2 \"**/*.md\" \"!**/node_modules/**/*.md\" \"!build/**/*.md\"",
"lint:src": "eslint --cache --cache-location node_modules/.cache/.eslintcache",
prepare: "git config core.hooksPath .hooks || exit 0",
prepublishOnly: "npm run build",
prettier: "prettier . --check",
"prettier:fix": "prettier . --write",
vitest: "vitest",
test: "tsc --noEmit && npm run test:unit && npm run test:e2e",
"test:bun": "vitest run --config vitest.config.bun.js",
"test:unit": "vitest run",
"test:e2e": "bash ./test/e2e.sh",
ncu: "node build/cli.js"
},
repository: {
type: "git",
url: "git+https://github.com/raineorshine/npm-check-updates.git"
},
homepage: "https://github.com/raineorshine/npm-check-updates",
bugs: { url: "https://github.com/raineorshine/npm-check-updates/issues" },
overrides: {
typescript: "$typescript",
eslint: "$eslint",
"eslint-config-standard": {
"eslint-plugin-n": "$eslint-plugin-n",
"eslint-plugin-promise": "$eslint-plugin-promise"
}
},
devDependencies: {
"@eslint/compat": "^2.1.0",
"@eslint/js": "^10.0.1",
"@microsoft/api-extractor": "^7.58.12",
"@streamparser/json": "^0.0.25",
"@trivago/prettier-plugin-sort-imports": "^6.0.2",
"@types/bun": "^1.3.14",
"@types/hosted-git-info": "^3.0.5",
"@types/ini": "^4.1.1",
"@types/node": "^26.2.0",
"@types/npm-registry-fetch": "^8.0.9",
"@types/parse-github-url": "^1.0.3",
"@types/picomatch": "^4.0.3",
"@types/progress": "^2.0.7",
"@types/semver": "^7.8.0",
"@types/semver-utils": "^1.1.3",
"@types/update-notifier": "^6.0.8",
"@typescript-eslint/eslint-plugin": "^8.67.0",
"@typescript-eslint/parser": "^8.67.0",
camelcase: "^9.0.0",
chalk: "^6.0.0",
"cli-table3": "^0.6.5",
commander: "^15.0.0",
"cross-env": "^10.1.0",
eslint: "^10.8.1",
"eslint-config-prettier": "^10.1.8",
"eslint-config-raine": "^0.5.0",
"eslint-config-standard": "^17.1.0",
"eslint-import-resolver-typescript": "^4.4.5",
"eslint-plugin-import-x": "^4.17.1",
"eslint-plugin-jsdoc": "^64.2.1",
"eslint-plugin-n": "^18.3.0",
"eslint-plugin-promise": "^7.3.0",
"fast-glob": "^3.3.3",
"fast-memoize": "^2.5.2",
"find-up": "^8.0.0",
"fp-and-or": "^1.0.2",
globals: "^17.11.0",
"hosted-git-info": "^10.1.1",
ini: "^7.0.0",
"jsonc-parser": "^3.3.1",
lilconfig: "^3.1.3",
"lockfile-lint": "^5.0.1",
markdownlint: "^0.41.1",
"markdownlint-cli2": "^0.23.2",
"npm-registry-fetch": "^20.0.1",
"npm-run-all2": "^9.0.3",
"p-map": "^7.0.6",
"parse-github-url": "^1.0.4",
picomatch: "^4.0.5",
prettier: "^3.9.6",
progress: "^2.0.3",
"prompts-ncu": "^3.0.4",
semver: "^7.8.5",
"semver-utils": "^1.1.4",
"spawn-please": "^3.0.0",
"ts-json-schema-generator": "^2.9.0",
typescript: "^6.0.3",
"unplugin-dts": "^1.0.3",
untildify: "^6.0.0",
"update-notifier": "^7.3.1",
valibot: "^1.4.2",
verdaccio: "^6.10.0",
vite: "^8.2.1",
"vite-bundle-analyzer": "^1.3.9",
vitest: "^4.1.10",
yaml: "^2.9.0",
yarn: "^1.22.22"
},
files: ["build"],
allowScripts: {
"yarn@1.22.22": !0,
"unrs-resolver@1.12.2": !0,
"fsevents@2.3.3": !0
}
}, pe = /* @__PURE__ */ n((/* @__PURE__ */ i(((e, t) => {
(function() {
var e = /^v?((\d+)\.(\d+)\.(\d+))(?:-([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?(?:\+([\dA-Za-z\-]+(?:\.[\dA-Za-z\-]+)*))?$/, n = /\s*((\|\||\-)|(((?:(?:~?[<>]?)|\^?)=?)\s*(v)?([0-9]+)(\.(x|\*|[0-9]+))?(\.(x|\*|[0-9]+))?(([\-+])([a-zA-Z0-9\.-]+))?))\s*/g;
function r(e) {
var t = {};
for (var n in e) e[n] !== void 0 && (t[n] = e[n]);
return t;
}
function i(e) {
var t = "";
return t += e.major || "0", t += ".", t += e.minor || "0", t += ".", t += e.patch || "0", e.release && (t += "-" + e.release), e.build && (t += "+" + e.build), t;
}
function a(e) {
var t = "";
function n(e) {
e.operator && (t += e.operator + " "), e.major && (t += e.toString() + " ");
}
return e.forEach(n), t.trim();
}
function o(e) {
if (e) {
var t = this;
Object.keys(e).forEach(function(n) {
t[n] = e[n];
});
}
}
o.prototype.toString = function() {
return i(this);
};
function s(t) {
var n = e.exec(t) || [], i = new o(r({
semver: n[0],
version: n[1],
major: n[2],
minor: n[3],
patch: n[4],
release: n[5],
build: n[6]
}));
return n.length === 0 && (i = null), i;
}
function c(e) {
for (var t, i = [], a; t = n.exec(e);) a = {
semver: t[3],
operator: t[4] || t[2],
major: t[6],
minor: t[8],
patch: t[10]
}, t[12] === "+" && (a.build = t[13]), t[12] === "-" && (a.release = t[13]), i.push(new o(r(a)));
return i;
}
t.exports.parse = s, t.exports.stringify = i, t.exports.parseRange = c, t.exports.stringifyRange = a;
})();
})))(), 1), me = /* @__PURE__ */ i(((e, t) => {
var n = [], r = 0, i = (e, t) => {
r >= t && n.push(e);
};
i.WARN = 1, i.INFO = 2, i.DEBUG = 3, i.reset = () => {
n = [];
}, i.setDebugLevel = (e) => {
r = e;
}, i.warn = (e) => i(e, i.WARN), i.info = (e) => i(e, i.INFO), i.debug = (e) => i(e, i.DEBUG), i.debugMessages = () => n, t.exports = i;
})), he = /* @__PURE__ */ i(((e, t) => {
t.exports = ({ onlyFirst: e = !1 } = {}) => {
let t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
return new RegExp(t, e ? void 0 : "g");
};
})), ge = /* @__PURE__ */ i(((e, t) => {
var n = he();
t.exports = (e) => typeof e == "string" ? e.replace(n(), "") : e;
})), _e = /* @__PURE__ */ i(((e, t) => {
var n = (e) => !Number.isNaN(e) && e >= 4352 && (e <= 4447 || e === 9001 || e === 9002 || 11904 <= e && e <= 12871 && e !== 12351 || 12880 <= e && e <= 19903 || 19968 <= e && e <= 42182 || 43360 <= e && e <= 43388 || 44032 <= e && e <= 55203 || 63744 <= e && e <= 64255 || 65040 <= e && e <= 65049 || 65072 <= e && e <= 65131 || 65281 <= e && e <= 65376 || 65504 <= e && e <= 65510 || 110592 <= e && e <= 110593 || 127488 <= e && e <= 127569 || 131072 <= e && e <= 262141);
t.exports = n, t.exports.default = n;
})), ve = /* @__PURE__ */ i(((e, t) => {
t.exports = function() {
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
};
})), ye = /* @__PURE__ */ i(((e, t) => {
var n = ge(), r = _e(), i = ve(), a = (e) => {
if (typeof e != "string" || e.length === 0 || (e = n(e), e.length === 0)) return 0;
e = e.replace(i(), " ");
let t = 0;
for (let n = 0; n < e.length; n++) {
let i = e.codePointAt(n);
i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879 || (i > 65535 && n++, t += r(i) ? 2 : 1);
}
return t;
};
t.exports = a, t.exports.default = a;
})), be = /* @__PURE__ */ i(((e, t) => {
var n = ye();
function r(e) {
return e ? /\u001b\[((?:\d*;){0,5}\d*)m/g : /\u001b\[(?:\d*;){0,5}\d*m/g;
}
function i(e) {
let t = r();
return ("" + e).replace(t, "").split("\n").reduce(function(e, t) {
return n(t) > e ? n(t) : e;
}, 0);
}
function a(e, t) {
return Array(t + 1).join(e);
}
function o(e, t, n, r) {
let o = i(e);
if (t + 1 >= o) {
let i = t - o;
switch (r) {
case "right":
e = a(n, i) + e;
break;
case "center": {
let t = Math.ceil(i / 2);
e = a(n, i - t) + e + a(n, t);
break;
}
default: e += a(n, i);
}
}
return e;
}
var s = {};
function c(e, t, n) {
t = "\x1B[" + t + "m", n = "\x1B[" + n + "m", s[t] = {
set: e,
to: !0
}, s[n] = {
set: e,
to: !1
}, s[e] = {
on: t,
off: n
};
}
c("bold", 1, 22), c("italics", 3, 23), c("underline", 4, 24), c("inverse", 7, 27), c("strikethrough", 9, 29);
function l(e, t) {
let n = t[1] ? parseInt(t[1].split(";")[0]) : 0;
if (n >= 30 && n <= 39 || n >= 90 && n <= 97) {
e.lastForegroundAdded = t[0];
return;
}
if (n >= 40 && n <= 49 || n >= 100 && n <= 107) {
e.lastBackgroundAdded = t[0];
return;
}
if (n === 0) {
for (let t in e)
/* istanbul ignore else */
Object.prototype.hasOwnProperty.call(e, t) && delete e[t];
return;
}
let r = s[t[0]];
r && (e[r.set] = r.to);
}
function u(e) {
let t = r(!0), n = t.exec(e), i = {};
for (; n !== null;) l(i, n), n = t.exec(e);
return i;
}
function d(e, t) {
let n = e.lastBackgroundAdded, r = e.lastForegroundAdded;
return delete e.lastBackgroundAdded, delete e.lastForegroundAdded, Object.keys(e).forEach(function(n) {
e[n] && (t += s[n].off);
}), n && n != "\x1B[49m" && (t += "\x1B[49m"), r && r != "\x1B[39m" && (t += "\x1B[39m"), t;
}
function f(e, t) {
let n = e.lastBackgroundAdded, r = e.lastForegroundAdded;
return delete e.lastBackgroundAdded, delete e.lastForegroundAdded, Object.keys(e).forEach(function(n) {
e[n] && (t = s[n].on + t);
}), n && n != "\x1B[49m" && (t = n + t), r && r != "\x1B[39m" && (t = r + t), t;
}
function p(e, t) {
if (e.length === i(e)) return e.substr(0, t);
for (; i(e) > t;) e = e.slice(0, -1);
return e;
}
function m(e, t) {
let n = r(!0), a = e.split(r()), o = 0, s = 0, c = "", u, f = {};
for (; s < t;) {
u = n.exec(e);
let r = a[o];
if (o++, s + i(r) > t && (r = p(r, t - s)), c += r, s += i(r), s < t) {
if (!u) break;
c += u[0], l(f, u);
}
}
return d(f, c);
}
function h(e, t, n) {
if (n ||= "…", i(e) <= t) return e;
t -= i(n);
let r = m(e, t);
r += n;
let a = "\x1B]8;;\x07";
return e.includes(a) && !r.includes(a) && (r += a), r;
}
function g() {
return {
chars: {
top: "─",
"top-mid": "┬",
"top-left": "┌",
"top-right": "┐",
bottom: "─",
"bottom-mid": "┴",
"bottom-left": "└",
"bottom-right": "┘",
left: "│",
"left-mid": "├",
mid: "─",
"mid-mid": "┼",
right: "│",
"right-mid": "┤",
middle: "│"
},
truncate: "…",
colWidths: [],
rowHeights: [],
colAligns: [],
rowAligns: [],
style: {
"padding-left": 1,
"padding-right": 1,
head: ["red"],
border: ["grey"],
compact: !1
},
head: []
};
}
function _(e, t) {
e ||= {}, t ||= g();
let n = Object.assign({}, t, e);
return n.chars = Object.assign({}, t.chars, e.chars), n.style = Object.assign({}, t.style, e.style), n;
}
function v(e, t) {
let n = [], r = t.split(/(\s+)/g), a = [], o = 0, s;
for (let t = 0; t < r.length; t += 2) {
let c = r[t], l = o + i(c);
o > 0 && s && (l += s.length), l > e ? (o !== 0 && n.push(a.join("")), a = [c], o = i(c)) : (a.push(s || "", c), o = l), s = r[t + 1];
}
return o && n.push(a.join("")), n;
}
function y(e, t) {
let n = [], r = "";
function i(t, i) {
for (r.length && i && (r += i), r += t; r.length > e;) n.push(r.slice(0, e)), r = r.slice(e);
}
let a = t.split(/(\s+)/g);
for (let e = 0; e < a.length; e += 2) i(a[e], e && a[e - 1]);
return r.length && n.push(r), n;
}
function b(e, t, n = !0) {
let r = [];
t = t.split("\n");
let i = n ? v : y;
for (let n = 0; n < t.length; n++) r.push.apply(r, i(e, t[n]));
return r;
}
function x(e) {
let t = {}, n = [];
for (let r = 0; r < e.length; r++) {
let i = f(t, e[r]);
t = u(i);
let a = Object.assign({}, t);
n.push(d(a, i));
}
return n;
}
function S(e, t) {
return [
"\x1B]",
"8",
";",
";",
e || t,
"\x07",
t,
"\x1B]",
"8",
";",
";",
"\x07"
].join("");
}
t.exports = {
strlen: i,
repeat: a,
pad: o,
truncate: h,
mergeOptions: _,
wordWrap: b,
colorizeLines: x,
hyperlink: S
};
})), xe = /* @__PURE__ */ i(((e, t) => {
var n = {};
t.exports = n;
var r = {
reset: [0, 0],
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29],
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
gray: [90, 39],
grey: [90, 39],
brightRed: [91, 39],
brightGreen: [92, 39],
brightYellow: [93, 39],
brightBlue: [94, 39],
brightMagenta: [95, 39],
brightCyan: [96, 39],
brightWhite: [97, 39],
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
bgGray: [100, 49],
bgGrey: [100, 49],
bgBrightRed: [101, 49],
bgBrightGreen: [102, 49],
bgBrightYellow: [103, 49],
bgBrightBlue: [104, 49],
bgBrightMagenta: [105, 49],
bgBrightCyan: [106, 49],
bgBrightWhite: [107, 49],
blackBG: [40, 49],
redBG: [41, 49],
greenBG: [42, 49],
yellowBG: [43, 49],
blueBG: [44, 49],
magentaBG: [45, 49],
cyanBG: [46, 49],
whiteBG: [47, 49]
};
Object.keys(r).forEach(function(e) {
var t = r[e], i = n[e] = [];
i.open = "\x1B[" + t[0] + "m", i.close = "\x1B[" + t[1] + "m";
});
})), Se = /* @__PURE__ */ i(((e, t) => {
t.exports = function(e, t) {
t ||= process.argv;
var n = t.indexOf("--"), r = /^-{1,2}/.test(e) ? "" : "--", i = t.indexOf(r + e);
return i !== -1 && (n === -1 || i < n);
};
})), Ce = /* @__PURE__ */ i(((t, n) => {
var r = e("os"), i = Se(), a = process.env, o = void 0;
i("no-color") || i("no-colors") || i("color=false") ? o = !1 : (i("color") || i("colors") || i("color=true") || i("color=always")) && (o = !0), "FORCE_COLOR" in a && (o = a.FORCE_COLOR.length === 0 || parseInt(a.FORCE_COLOR, 10) !== 0);
function s(e) {
return e !== 0 && {
level: e,
hasBasic: !0,
has256: e >= 2,
has16m: e >= 3
};
}
function c(e) {
if (o === !1) return 0;
if (i("color=16m") || i("color=full") || i("color=truecolor")) return 3;
if (i("color=256")) return 2;
if (e && !e.isTTY && o !== !0) return 0;
var t = +!!o;
if (process.platform === "win32") {
var n = r.release().split(".");
return Number(process.versions.node.split(".")[0]) >= 8 && Number(n[0]) >= 10 && Number(n[2]) >= 10586 ? Number(n[2]) >= 14931 ? 3 : 2 : 1;
}
if ("CI" in a) return [
"TRAVIS",
"CIRCLECI",
"APPVEYOR",
"GITLAB_CI"
].some(function(e) {
return e in a;
}) || a.CI_NAME === "codeship" ? 1 : t;
if ("TEAMCITY_VERSION" in a) return +!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(a.TEAMCITY_VERSION);
if ("TERM_PROGRAM" in a) {
var s = parseInt((a.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
switch (a.TERM_PROGRAM) {
case "iTerm.app": return s >= 3 ? 3 : 2;
case "Hyper": return 3;
case "Apple_Terminal": return 2;
}
}
return /-256(color)?$/i.test(a.TERM) ? 2 : /^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(a.TERM) || "COLORTERM" in a ? 1 : (a.TERM, t);
}
function l(e) {
return s(c(e));
}
n.exports = {
supportsColor: l,
stdout: l(process.stdout),
stderr: l(process.stderr)
};
})), we = /* @__PURE__ */ i(((e, t) => {
t.exports = function(e, t) {
var n = "";
e ||= "Run the trap, drop the bass", e = e.split("");
var r = {
a: [
"@",
"Ą",
"Ⱥ",
"Ʌ",
"Δ",
"Λ",
"Д"
],
b: [
"ß",
"Ɓ",
"Ƀ",
"ɮ",
"β",
"฿"
],
c: [
"©",
"Ȼ",
"Ͼ"
],
d: [
"Ð",
"Ɗ",
"Ԁ",
"ԁ",
"Ԃ",
"ԃ"
],
e: [
"Ë",
"ĕ",
"Ǝ",
"ɘ",
"Σ",
"ξ",
"Ҽ",
"੬"
],
f: ["Ӻ"],
g: ["ɢ"],
h: [
"Ħ",
"ƕ",
"Ң",
"Һ",
"Ӈ",
"Ԋ"
],
i: ["༏"],
j: ["Ĵ"],
k: [
"ĸ",
"Ҡ",
"Ӄ",
"Ԟ"
],
l: ["Ĺ"],
m: [
"ʍ",
"Ӎ",
"ӎ",
"Ԡ",
"ԡ",
"൩"
],
n: [
"Ñ",
"ŋ",
"Ɲ",
"Ͷ",
"Π",
"Ҋ"
],
o: [
"Ø",
"õ",
"ø",
"Ǿ",
"ʘ",
"Ѻ",
"ם",
"",
"๏"
],
p: ["Ƿ", "Ҏ"],
q: ["্"],
r: [
"®",
"Ʀ",
"Ȑ",
"Ɍ",
"ʀ",
"Я"
],
s: [
"§",
"Ϟ",
"ϟ",
"Ϩ"
],
t: [
"Ł",
"Ŧ",
"ͳ"
],
u: ["Ʊ", "Ս"],
v: ["ט"],
w: [
"Ш",
"Ѡ",
"Ѽ",
"൰"
],
x: [
"Ҳ",
"Ӿ",
"Ӽ",
"ӽ"
],
y: [
"¥",
"Ұ",
"Ӌ"
],
z: ["Ƶ", "ɀ"]
};
return e.forEach(function(e) {
e = e.toLowerCase();
var t = r[e] || [" "], i = Math.floor(Math.random() * t.length);
r[e] === void 0 ? n += e : n += r[e][i];
}), n;
};
})), Te = /* @__PURE__ */ i(((e, t) => {
t.exports = function(e, t) {
e ||= " he is here ";
var n = {
up: /* @__PURE__ */ "̍.̎.̄.̅.̿.̑.̆.̐.͒.͗.͑.̇.̈.̊.͂.̓.̈.͊.͋.͌.̃.̂.̌.͐.̀.́.̋.̏.̒.̓.̔.̽.̉.ͣ.ͤ.ͥ.ͦ.ͧ.ͨ.ͩ.ͪ.ͫ.ͬ.ͭ.ͮ.ͯ.̾.͛.͆.̚".split("."),
down: /* @__PURE__ */ "̖.̗.̘.̙.̜.̝.̞.̟.̠.̤.̥.̦.̩.̪.̫.̬.̭.̮.̯.̰.̱.̲.̳.̹.̺.̻.̼.ͅ.͇.͈.͉.͍.͎.͓.͔.͕.͖.͙.͚.̣".split("."),
mid: [
"̕",
"̛",
"̀",
"́",
"͘",
"̡",
"̢",
"̧",
"̨",
"̴",
"̵",
"̶",
"͜",
"͝",
"͞",
"͟",
"͠",
"͢",
"̸",
"̷",
"͡",
" ҉"
]
}, r = [].concat(n.up, n.down, n.mid);
function i(e) {
return Math.floor(Math.random() * e);
}
function a(e) {
var t = !1;
return r.filter(function(n) {
t = n === e;
}), t;
}
function o(e, t) {
var r = "", o, s;
for (s in t ||= {}, t.up = t.up === void 0 || t.up, t.mid = t.mid === void 0 || t.mid, t.down = t.down === void 0 || t.down, t.size = t.size === void 0 ? "maxi" : t.size, e = e.split(""), e) if (!a(s)) {
switch (r += e[s], o = {
up: 0,
down: 0,
mid: 0
}, t.size) {
case "mini":
o.up = i(8), o.mid = i(2), o.down = i(8);
break;
case "maxi":
o.up = i(16) + 3, o.mid = i(4) + 1, o.down = i(64) + 3;
break;
default: o.up = i(8) + 1, o.mid = i(6) / 2, o.down = i(8) + 1;
}
var c = [
"up",
"mid",
"down"
];
for (var l in c) for (var u = c[l], d = 0; d <= o[u]; d++) t[u] && (r += n[u][i(n[u].length)]);
}
return r;
}
return o(e, t);
};
})), Ee = /* @__PURE__ */ i(((e, t) => {
t.exports = function(e) {
return function(t, n, r) {
if (t === " ") return t;
switch (n % 3) {
case 0: return e.red(t);
case 1: return e.white(t);
case 2: return e.blue(t);
}
};
};
})), De = /* @__PURE__ */ i(((e, t) => {
t.exports = function(e) {
return function(t, n, r) {
return n % 2 == 0 ? t : e.inverse(t);
};
};
})), Oe = /* @__PURE__ */ i(((e, t) => {
t.exports = function(e) {
var t = [
"red",
"yellow",
"green",
"blue",
"magenta"
];
return function(n, r, i) {
return n === " " ? n : e[t[r++ % t.length]](n);
};
};
})), ke = /* @__PURE__ */ i(((e, t) => {
t.exports = function(e) {
var t = [
"underline",
"inverse",
"grey",
"yellow",
"red",
"green",
"blue",
"white",
"cyan",
"magenta",
"brightYellow",
"brightRed",
"brightGreen",
"brightBlue",
"brightWhite",
"brightCyan",
"brightMagenta"
];
return function(n, r, i) {
return n === " " ? n : e[t[Math.round(Math.random() * (t.length - 2))]](n);
};
};
})), Ae = /* @__PURE__ */ i(((t, n) => {
var r = {};
n.exports = r, r.themes = {};
var i = e("util"), a = r.styles = xe(), o = Object.defineProperties, s = /* @__PURE__ */ new RegExp(/[\r\n]+/g);
r.supportsColor = Ce().supportsColor, r.enabled === void 0 && (r.enabled = r.supportsColor() !== !1), r.enable = function() {
r.enabled = !0;
}, r.disable = function() {
r.enabled = !1;
}, r.stripColors = r.strip = function(e) {
return ("" + e).replace(/\x1B\[\d+m/g, "");
}, r.stylize = function(e, t) {
if (!r.enabled) return e + "";
var n = a[t];
return !n && t in r ? r[t](e) : n.open + e + n.close;
};
var c = /[|\\{}()[\]^$+*?.]/g, l = function(e) {
if (typeof e != "string") throw TypeError("Expected a string");
return e.replace(c, "\\$&");
};
function u(e) {
var t = function e() {
return p.apply(e, arguments);
};
return t._styles = e, t.__proto__ = f, t;
}
var d = (function() {
var e = {};
return a.grey = a.gray, Object.keys(a).forEach(function(t) {
a[t].closeRe = new RegExp(l(a[t].close), "g"), e[t] = { get: function() {
return u(this._styles.concat(t));
} };
}), e;
})(), f = o(function() {}, d);
function p() {
var e = Array.prototype.slice.call(arguments).map(function(e) {
return e != null && e.constructor === String ? e : i.inspect(e);
}).join(" ");
if (!r.enabled || !e) return e;
for (var t = e.indexOf("\n") != -1, n = this._styles, o = n.length; o--;) {
var c = a[n[o]];
e = c.open + e.replace(c.closeRe, c.open) + c.close, t && (e = e.replace(s, function(e) {
return c.close + e + c.open;
}));
}
return e;
}
r.setTheme = function(e) {
if (typeof e == "string") {
console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");
return;
}
for (var t in e) (function(t) {
r[t] = function(n) {
if (typeof e[t] == "object") {
var i = n;
for (var a in e[t]) i = r[e[t][a]](i);
return i;
}
return r[e[t]](n);
};
})(t);
};
function m() {
var e = {};
return Object.keys(d).forEach(function(t) {
e[t] = { get: function() {
return u([t]);
} };
}), e;
}
var h = function(e, t) {
var n = t.split("");
return n = n.map(e), n.join("");
};
for (var g in r.trap = we(), r.zalgo = Te(), r.maps = {}, r.maps.america = Ee()(r), r.maps.zebra = De()(r), r.maps.rainbow = Oe()(r), r.maps.random = ke()(r), r.maps) (function(e) {
r[e] = function(t) {
return h(r.maps[e], t);
};
})(g);
o(r, m());
})), je = /* @__PURE__ */ i(((e, t) => {
t.exports = Ae();
})), Me = /* @__PURE__ */ i(((e, t) => {
var { info: n, debug: r } = me(), i = be(), a = class e {
constructor(e) {
this.setOptions(e), this.x = null, this.y = null;
}
setOptions(e) {
[
"boolean",
"number",
"bigint",
"string"
].indexOf(typeof e) !== -1 && (e = { content: "" + e }), e ||= {}, this.options = e;
let t = e.content;
if ([
"boolean",
"number",
"bigint",
"string"
].indexOf(typeof t) !== -1) this.content = String(t);
else if (!t) this.content = this.options.href || "";
else throw Error("Content needs to be a primitive, got: " + typeof t);
this.colSpan = e.colSpan || 1, this.rowSpan = e.rowSpan || 1, this.options.href && Object.defineProperty(this, "href", { get() {
return this.options.href;
} });
}
mergeTableOptions(e, t) {
this.cells = t;
let n = this.options.chars || {}, r = e.chars, a = this.chars = {};
f.forEach(function(e) {
l(n, r, e, a);
}), this.truncate = this.options.truncate || e.truncate;
let o = this.options.style = this.options.style || {}, s = e.style;
l(o, s, "padding-left", this), l(o, s, "padding-right", this), this.head = o.head || s.head, this.border = o.border || s.border, this.fixedWidth = e.colWidths[this.x], this.lines = this.computeLines(e), this.desiredWidth = i.strlen(this.content) + this.paddingLeft + this.paddingRight, this.desiredHeight = this.lines.length;
}
computeLines(e) {
let t = e.wordWrap || e.textWrap, { wordWrap: n = t } = this.options;
if (this.fixedWidth && n) {
if (this.fixedWidth -= this.paddingLeft + this.paddingRight, this.colSpan) {
let t = 1;
for (; t < this.colSpan;) this.fixedWidth += e.colWidths[this.x + t], t++;
}
let { wrapOnWordBoundary: t = !0 } = e, { wrapOnWordBoundary: n = t } = this.options;
return this.wrapLines(i.wordWrap(this.fixedWidth, this.content, n));
}
return this.wrapLines(this.content.split("\n"));
}
wrapLines(e) {
let t = i.colorizeLines(e);
return this.href ? t.map((e) => i.hyperlink(this.href, e)) : t;
}
init(e) {
let t = this.x, n = this.y;
this.widths = e.colWidths.slice(t, t + this.colSpan), this.heights = e.rowHeights.slice(n, n + this.rowSpan), this.width = this.widths.reduce(d, -1), this.height = this.heights.reduce(d, -1), this.hAlign = this.options.hAlign || e.colAligns[t], this.vAlign = this.options.vAlign || e.rowAligns[n], this.drawRight = t + this.colSpan == e.colWidths.length;
}
draw(e, t) {
if (e == "top") return this.drawTop(this.drawRight);
if (e == "bottom") return this.drawBottom(this.drawRight);
let r = i.truncate(this.content, 10, this.truncate);
e || n(`${this.y}-${this.x}: ${this.rowSpan - e}x${this.colSpan} Cell ${r}`);
let a = Math.max(this.height - this.lines.length, 0), o;
switch (this.vAlign) {
case "center":
o = Math.ceil(a / 2);
break;
case "bottom":
o = a;
break;
default: o = 0;
}
if (e < o || e >= o + this.lines.length) return this.drawEmpty(this.drawRight, t);
let s = this.lines.length > this.height && e + 1 >= this.height;
return this.drawLine(e - o, this.drawRight, s, t);
}
drawTop(e) {
let t = [];
return this.cells ? this.widths.forEach(function(e, n) {
t.push(this._topLeftChar(n)), t.push(i.repeat(this.chars[this.y == 0 ? "top" : "mid"], e));
}, this) : (t.push(this._topLeftChar(0)), t.push(i.repeat(this.chars[this.y == 0 ? "top" : "mid"], this.width))), e && t.push(this.chars[this.y == 0 ? "topRight" : "rightMid"]), this.wrapWithStyleColors("border", t.join(""));
}
_topLeftChar(t) {
let n = this.x + t, r;
if (this.y == 0) r = n == 0 ? "topLeft" : t == 0 ? "topMid" : "top";
else if (n == 0) r = "leftMid";
else if (r = t == 0 ? "midMid" : "bottomMid", this.cells && (this.cells[this.y - 1][n] instanceof e.ColSpanCell && (r = t == 0 ? "topMid" : "mid"), t == 0)) {
let t = 1;
for (; this.cells[this.y][n - t] instanceof e.ColSpanCell;) t++;
this.cells[this.y][n - t] instanceof e.RowSpanCell && (r = "leftMid");
}
return this.chars[r];
}
wrapWithStyleColors(e, t) {
if (this[e] && this[e].length) try {
let n = je();
for (let t = this[e].length - 1; t >= 0; t--) n = n[this[e][t]];
return n(t);
} catch {
return t;
}
return t;
}
drawLine(e, t, n, r) {
let a = this.chars[this.x == 0 ? "left" : "middle"];
if (this.x && r && this.cells) {
let e = this.cells[this.y + r][this.x - 1];
for (; e instanceof o;) e = this.cells[e.y][e.x - 1];
e instanceof s || (a = this.chars.rightMid);
}
let c = i.repeat(" ", this.paddingLeft), l = t ? this.chars.right : "", u = i.repeat(" ", this.paddingRight), d = this.lines[e], f = this.width - (this.paddingLeft + this.paddingRight);
n && (d += this.truncate || "…");
let p = i.truncate(d, f, this.truncate);
return p = i.pad(p, f, " ", this.hAlign), p = c + p + u, this.stylizeLine(a, p, l);
}
stylizeLine(e, t, n) {
return e = this.wrapWithStyleColors("border", e), n = this.wrapWithStyleColors("border", n), this.y === 0 && (t = this.wrapWithStyleColors("head", t)), e + t + n;
}
drawBottom(e) {
let t = this.chars[this.x == 0 ? "bottomLeft" : "bottomMid"], n = i.repeat(this.chars.bottom, this.width), r = e ? this.chars.bottomRight : "";
return this.wrapWithStyleColors("border", t + n + r);
}
drawEmpty(e, t) {
let n = this.chars[this.x == 0 ? "left" : "middle"];
if (this.x && t && this.cells) {
let e = this.cells[this.y + t][this.x - 1];
for (; e instanceof o;) e = this.cells[e.y][e.x - 1];
e instanceof s || (n = this.chars.rightMid);
}
let r = e ? this.chars.right : "", a = i.repeat(" ", this.width);
return this.stylizeLine(n, a, r);
}
}, o = class {
constructor() {}
draw(e) {
return typeof e == "number" && r(`${this.y}-${this.x}: 1x1 ColSpanCell`), "";
}
init() {}
mergeTableOptions() {}
}, s = class {
constructor(e) {
this.originalCell = e;
}
init(e) {
let t = this.y, n = this.originalCell.y;
this.cellOffset = t - n, this.offset = u(e.rowHeights, n, this.cellOffset);
}
draw(e) {
return e == "top" ? this.originalCell.draw(this.offset, this.cellOffset) : e == "bottom" ? this.originalCell.draw("bottom") : (r(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`), this.originalCell.draw(this.offset + 1 + e));
}
mergeTableOptions() {}
};
function c(...e) {
return e.filter((e) => e != null).shift();
}
function l(e, t, n, r) {
let i = n.split("-");
i.length > 1 ? (i[1] = i[1].charAt(0).toUpperCase() + i[1].substr(1), i = i.join(""), r[i] = c(e[i], e[n], t[i], t[n])) : r[n] = c(e[n], t[n]);
}
function u(e, t, n) {
let r = e[t];
for (let i = 1; i < n; i++) r += 1 + e[t + i];
return r;
}
function d(e, t) {
return e + t + 1;
}
var f = [
"top",
"top-mid",
"top-left",
"top-right",
"bottom",
"bottom-mid",
"bottom-left",
"bottom-right",
"left",
"left-mid",
"mid",
"mid-mid",
"right",
"right-mid",
"middle"
];
t.exports = a, t.exports.ColSpanCell = o, t.exports.RowSpanCell = s;
})), Ne = /* @__PURE__ */ i(((e, t) => {
var { warn: n, debug: r } = me(), i = Me(), { ColSpanCell: a, RowSpanCell: o } = i;
(function() {
function e(t, n) {
return t[n] > 0 ? e(t, n + 1) : n;
}
function c(t) {
let n = {};
t.forEach(function(t, r) {
let i = 0;
t.forEach(function(t) {
t.y = r, t.x = r ? e(n, i) : i;
let a = t.rowSpan || 1, o = t.colSpan || 1;
if (a > 1) for (let e = 0; e < o; e++) n[t.x + e] = a;
i = t.x + o;
}), Object.keys(n).forEach((e) => {
n[e]--, n[e] < 1 && delete n[e];
});
});
}
function l(e) {
let t = 0;
return e.forEach(function(e) {
e.forEach(function(e) {
t = Math.max(t, e.x + (e.colSpan || 1));
});
}), t;
}
function u(e) {
return e.length;
}
function d(e, t) {
let n = e.y, r = e.y - 1 + (e.rowSpan || 1), i = t.y, a = !(n > t.y - 1 + (t.rowSpan || 1) || i > r), o = e.x, s = e.x - 1 + (e.colSpan || 1), c = t.x, l = !(o > t.x - 1 + (t.colSpan || 1) || c > s);
return a && l;
}
function f(e, t, n) {
let r = Math.min(e.length - 1, n), i = {
x: t,
y: n
};
for (let t = 0; t <= r; t++) {
let n = e[t];
for (let e = 0; e < n.length; e++) if (d(i, n[e])) return !0;
}
return !1;
}
function p(e, t, n, r) {
for (let i = n; i < r; i++) if (f(e, i, t)) return !1;
return !0;
}
function m(e) {
e.forEach(function(t, n) {
t.forEach(function(t) {
for (let r = 1; r < t.rowSpan; r++) {
let i = new o(t);
i.x = t.x, i.y = t.y + r, i.colSpan = t.colSpan, g(i, e[n + r]);
}
});
});
}
function h(e) {
for (let t = e.length - 1; t >= 0; t--) {
let n = e[t];
for (let e = 0; e < n.length; e++) {
let t = n[e];
for (let r = 1; r < t.colSpan; r++) {
let i = new a();
i.x = t.x + r, i.y = t.y, n.splice(e + 1, 0, i);
}
}
}
}
function g(e, t) {
let n = 0;
for (; n < t.length && t[n].x < e.x;) n++;
t.splice(n, 0, e);
}
function _(e) {
let t = u(e), a = l(e);
r(`Max rows: ${t}; Max cols: ${a}`);
for (let r = 0; r < t; r++) for (let o = 0; o < a; o++) if (!f(e, o, r)) {
let s = {
x: o,
y: r,
colSpan: 1,
rowSpan: 1
};
for (o++; o < a && !f(e, o, r);) s.colSpan++, o++;
let c = r + 1;
for (; c < t && p(e, c, s.x, s.x + s.colSpan);) s.rowSpan++, c++;
let l = new i(s);
l.x = s.x, l.y = s.y, n(`Missing cell at ${l.y}-${l.x}.`), g(l, e[r]);
}
}
function v(e) {
return e.map(function(e) {
if (!Array.isArray(e)) {
let t = Object.keys(e)[0];
e = e[t], Array.isArray(e) ? (e = e.slice(), e.unshift(t)) : e = [t, e];
}
return e.map(function(e) {
return new i(e);
});
});
}
function y(e) {
let t = v(e);
return c(t), _(t), m(t), h(t), t;
}
t.exports = {
makeTableLayout: y,
layoutTable: c,
addRowSpanCells: m,
maxWidth: l,
fillInTable: _,
computeWidths: s("colSpan", "desiredWidth", "x", 1),
computeHeights: s("rowSpan", "desiredHeight", "y", 1)
};
})();
function s(e, t, n, r) {
return function(i, a) {
let o = [], s = [], c = {};
a.forEach(function(i) {
i.forEach(function(i) {
(i[e] || 1) > 1 ? s.push(i) : o[i[n]] = Math.max(o[i[n]] || 0, i[t] || 0, r);
});
}), i.forEach(function(e, t) {
typeof e == "number" && (o[t] = e);
});
for (let r = s.length - 1; r >= 0; r--) {
let a = s[r], l = a[e], u = a[n], d = o[u], f = typeof i[u] == "number" ? 0 : 1;
if (typeof d == "number") for (let e = 1; e < l; e++) d += 1 + o[u + e], typeof i[u + e] != "number" && f++;
else d = t === "desiredWidth" ? a.desiredWidth - 1 : 1, (!c[u] || c[u] < d) && (c[u] = d);
if (a[t] > d) {
let e = 0;
for (; f > 0 && a[t] > d;) {
if (typeof i[u + e] != "number") {
let n = Math.round((a[t] - d) / f);
d += n, o[u + e] += n, f--;
}
e++;
}
}
}
Object.assign(i, o, c);
for (let e = 0; e < i.length; e++) i[e] = Math.max(r, i[e] || 0);
};
}
})), Pe = /* @__PURE__ */ i(((e, t) => {
var n = me(), r = be(), i = Ne(), a = class extends Array {
constructor(e) {
super();
let t = r.mergeOptions(e);
if (Object.defineProperty(this, "options", {
value: t,
enumerable: t.debug
}), t.debug) {
switch (typeof t.debug) {
case "boolean":
n.setDebugLevel(n.WARN);
break;
case "number":
n.setDebugLevel(t.debug);
break;
case "string":
n.setDebugLevel(parseInt(t.debug, 10));
break;
default: n.setDebugLevel(n.WARN), n.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof t.debug}`);
}
Object.defineProperty(this, "messages", { get() {
return n.debugMessages();
} });
}
}
toString() {
let e = this, t = this.options.head && this.options.head.length;
t ? (e = [this.options.head], this.length && e.push.apply(e, this)) : this.options.style.head = [];
let n = i.makeTableLayout(e);
n.forEach(function(e) {
e.forEach(function(e) {
e.mergeTableOptions(this.options, n);
}, this);
}, this), i.computeWidths(this.options.colWidths, n), i.computeHeights(this.options.rowHeights, n), n.forEach(function(e) {
e.forEach(function(e) {
e.init(this.options);
}, this);
}, this);
let r = [];
for (let e = 0; e < n.length; e++) {
let i = n[e], a = this.options.rowHeights[e];
(e === 0 || !this.options.style.compact || e == 1 && t) && o(i, "top", r);
for (let e = 0; e < a; e++) o(i, e, r);
e + 1 == n.length && o(i, "bottom", r);
}
return r.join("\n");
}
get width() {
return this.toString().split("\n")[0].length;
}
};
a.reset = () => n.reset();
function o(e, t, n) {
let r = [];
e.forEach(function(e) {
r.push(e.draw(t));
});
let i = r.join("");
i.length && n.push(i);
}
t.exports = a;
})), Fe = /* @__PURE__ */ i(((e, t) => {
t.exports = Pe();
})), Ie = /* @__PURE__ */ i(((e, t) => {
t.exports = {
MAX_LENGTH: 256,
MAX_SAFE_COMPONENT_LENGTH: 16,
MAX_SAFE_BUILD_LENGTH: 250,
MAX_SAFE_INTEGER: 2 ** 53 - 1 ||
/* istanbul ignore next */ 9007199254740991,
RELEASE_TYPES: [
"major",
"premajor",
"minor",
"preminor",
"patch",
"prepatch",
"prerelease"
],
SEMVER_SPEC_VERSION: "2.0.0",
FLAG_INCLUDE_PRERELEASE: 1,
FLAG_LOOSE: 2
};
})), Le = /* @__PURE__ */ i(((e, t) => {
t.exports = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...e) => console.error("SEMVER", ...e) : () => {};
})), Re = /* @__PURE__ */ i(((e, t) => {
var { MAX_SAFE_COMPONENT_LENGTH: n, MAX_SAFE_BUILD_LENGTH: r, MAX_LENGTH: i } = Ie(), a = Le();
e = t.exports = {};
var o = e.re = [], s = e.safeRe = [], c = e.src = [], l = e.safeSrc = [], u = e.t = {}, d = 0, f = "[a-zA-Z0-9-]", p = [
["\\s", 1],
["\\d", i],
[f, r]
], m = (e) => {
for (let [t, n] of p) e = e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);
return e;
}, h = (e, t, n) => {
let r = m(t), i = d++;
a(e, i, t), u[e] = i, c[i] = t, l[i] = r, o[i] = new RegExp(t, n ? "g" : void 0), s[i] = new RegExp(r, n ? "g" : void 0);
};
h("NUMERICIDENTIFIER", "0|[1-9]\\d*"), h("NUMERICIDENTIFIERLOOSE", "\\d+"), h("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${f}*`), h("MAINVERSION", `(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`), h("MAINVERSIONLOOSE", `(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`), h("PRERELEASEIDENTIFIER", `(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`), h("PRERELEASEIDENTIFIERLOOSE", `(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`), h("PRERELEASE", `(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`), h("PRERELEASELOOSE", `(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`), h("BUILDIDENTIFIER", `${f}+`), h("BUILD", `(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`), h("FULLPLAIN", `v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`), h("FULL", `^${c[u.FULLPLAIN]}$`), h("LOOSEPLAIN", `[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`), h("LOOSE", `^${c[u.LOOSEPLAIN]}$`), h("GTLT", "((?:<|>)?=?)"), h("XRANGEIDENTIFIERLOOSE", `${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), h("XRANGEIDENTIFIER", `${c[u.NUMERICIDENTIFIER]}|x|X|\\*`), h("XRANGEPLAIN", `[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`), h("XRANGEPLAINLOOSE", `[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`), h("XRANGE", `^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`), h("XRANGELOOSE", `^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`), h("COERCEPLAIN", `(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`), h("COERCE", `${c[u.COERCEPLAIN]}(?:$|[^\\d])`), h("COERCEFULL", c[u.COERCEPLAIN] + `(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`), h("COERCERTL", c[u.COERCE], !0), h("COERCERTLFULL", c[u.COERCEFULL], !0), h("LONETILDE", "(?:~>?)"), h("TILDETRIM", `(\\s*)${c[u.LONETILDE]}\\s+`, !0), e.tildeTrimReplace = "$1~", h("TILDE", `^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`), h("TILDELOOSE", `^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`), h("LONECARET", "(?:\\^)"), h("CARETTRIM", `(\\s*)${c[u.LONECARET]}\\s+`, !0), e.caretTrimReplace = "$1^", h("CARET", `^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`), h("CARETLOOSE", `^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`), h("COMPARATORLOOSE", `^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`), h("COMPARATOR", `^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`), h("COMPARATORTRIM", `(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`, !0), e.comparatorTrimReplace = "$1$2$3", h("HYPHENRANGE", `^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`), h("HYPHENRANGELOOSE", `^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`), h("STAR", "(<|>)?=?\\s*\\*"), h("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), h("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
})), ze = /* @__PURE__ */ i(((e, t) => {
var n = Object.freeze({ loose: !0 }), r = Object.freeze({});
t.exports = (e) => e ? typeof e == "object" ? e : n : r;
})), Be = /* @__PURE__ */ i(((e, t) => {
var n = /^[0-9]+$/, r = (e, t) => {
if (typeof e == "number" && typeof t == "number") return e === t ? 0 : e < t ? -1 : 1;
let r = n.test(e), i = n.test(t);
return r && i && (e = +e, t = +t), e === t ? 0 : r && !i ? -1 : i && !r ? 1 : e < t ? -1 : 1;
};
t.exports = {
compareIdentifiers: r,
rcompareIdentifiers: (e, t) => r(t, e)
};
})), Ve = /* @__PURE__ */ i(((e, t) => {
var n = Le(), { MAX_LENGTH: r, MAX_SAFE_INTEGER: i } = Ie(), { safeRe: a, t: o } = Re(), s = ze(), { compareIdentifiers: c } = Be(), l = (e, t) => {
let n = t.split(".");
if (n.length > e.length) return !1;
for (let t = 0; t < n.length; t++) if (c(e[t], n[t]) !== 0) return !1;
return !0;
};
t.exports = class e {
constructor(t, c) {
if (c = s(c), t instanceof e) {
if (t.loose === !!c.loose && t.includePrerelease === !!c.includePrerelease) return t;
t = t.version;
} else if (typeof t != "string") throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);
if (t.length > r) throw TypeError(`version is longer than ${r} characters`);
n("SemVer", t, c), this.options = c, this.loose = !!c.loose, this.includePrerelease = !!c.includePrerelease;
let l = t.trim().match(c.loose ? a[o.LOOSE] : a[o.FULL]);
if (!l) throw TypeError(`Invalid Version: ${t}`);
if (this.raw = t, this.major = +l[1], this.minor = +l[2], this.patch = +l[3], this.major > i || this.major < 0) throw TypeError("Invalid major version");
if (this.minor > i || this.minor < 0) throw TypeError("Invalid minor version");
if (this.patch > i || this.patch < 0) throw TypeError("Invalid patch version");
this.prerelease = l[4] ? l[4].split(".").map((e) => {
if (/^[0-9]+$/.test(e)) {
let t = +e;
if (t >= 0 && t < i) return t;
}
return e;
}) : [], this.build = l[5] ? l[5].split(".") : [], this.format();
}
format() {
return this.version = `${this.major}.${this.minor}.${this.patch}`, this.prerelease.length && (this.version += `-${this.prerelease.join(".")}`), this.version;
}
toString() {
return this.version;
}
compare(t) {
if (n("SemVer.compare", this.version, this.options, t), !(t instanceof e)) {
if (typeof t == "string" && t === this.version) return 0;
t = new e(t, this.options);
}
return t.version === this.version ? 0 : this.compareMain(t) || this.comparePre(t);
}
compareMain(t) {
return t instanceof e || (t = new e(t, this.options)), this.major < t.major ? -1 : this.major > t.major ? 1 : this.minor < t.minor ? -1 : this.minor > t.minor ? 1 : this.patch < t.patch ? -1 : +(this.patch > t.patch);
}
comparePre(t) {
if (t instanceof e || (t = new e(t, this.options)), this.prerelease.length && !t.prerelease.length) return -1;
if (!this.prerelease.length && t.prerelease.length) return 1;
if (!this.prerelease.length && !t.prerelease.length) return 0;
let r = 0;
do {
let e = this.prerelease[r], i = t.prerelease[r];
if (n("prerelease compare", r, e, i), e === void 0 && i === void 0) return 0;
if (i === void 0) return 1;
if (e === void 0) return -1;
if (e !== i) return c(e, i);
} while (++r);
}
compareBuild(t) {
t instanceof e || (t = new e(t, this.options));
let r = 0;
do {
let e = this.build[r], i = t.build[r];
if (n("build compare", r, e, i), e === void 0 && i === void 0) return 0;
if (i === void 0) return 1;
if (e === void 0) return -1;
if (e !== i) return c(e, i);
} while (++r);
}
inc(e, t, n) {
if (e.startsWith("pre")) {
if (!t && n === !1) throw Error("invalid increment argument: identifier is empty");
if (t) {
let e = `-${t}`.match(this.options.loose ? a[o.PRERELEASELOOSE] : a[o.PRERELEASE]);
if (!e || e[1] !== t) throw Error(`invalid identifier: ${t}`);
}
}
switch (e) {
case "premajor":
this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", t, n);
break;
case "preminor":
this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", t, n);
break;
case "prepatch":
this.prerelease.length = 0, this.inc("patch", t, n), this.inc("pre", t, n);
break;
case "prerelease":
this.prerelease.length === 0 && this.inc("patch", t, n), this.inc("pre", t, n);
break;
case "release":
if (this.prerelease.length === 0) throw Error(`version ${this.raw} is not a prerelease`);
this.prerelease.length = 0;
break;
case "major":
(this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
break;
case "minor":
(this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
break;
case "patch":
this.prerelease.length === 0 && this.patch++, this.prerelease = [];
break;
case "pre": {
let e = +!!Number(n);
if (this.prerelease.length === 0) this.prerelease = [e];
else {
let r = this.prerelease.length;
for (; --r >= 0;) typeof this.prerelease[r] == "number" && (this.prerelease[r]++, r = -2);
if (r === -1) {
if (t === this.prerelease.join(".") && n === !1) throw Error("invalid increment argument: identifier already exists");
this.prerelease.push(e);
}
}
if (t) {
let r = [t, e];
if (n === !1 && (r = [t]), l(this.prerelease, t)) {
let e = this.prerelease[t.split(".").length];
isNaN(e) && (this.prerelease = r);
} else this.prerelease = r;
}
break;
}
default: throw Error(`invalid increment argument: ${e}`);
}
return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this;
}
};
})), He = /* @__PURE__ */ i(((e, t) => {
var n = Ve();
t.exports = (e, t, r = !1) => {
if (e instanceof n) return e;
try {
return new n(e, t);
} catch (e) {
if (!r) return null;
throw e;
}
};
})), Ue = /* @__PURE__ */ i(((e, t) => {
var n = He();
t.exports = (e, t) => {
let r = n(e, t);
return r ? r.version : null;
};
})), We = /* @__PURE__ */ i(((e, t) => {
var n = He();
t.exports = (e, t) => {
let r = n(e.trim().replace(/^[=v]+/, ""), t);
return r ? r.version : null;
};
})), Ge = /* @__PURE__ */ i(((e, t) => {
var n = Ve();
t.exports = (e, t, r, i, a) => {
typeof r == "string" && (a = i, i = r, r = void 0);
try {
return new n(e instanceof n ? e.version : e, r).inc(t, i, a).version;
} catch {
return null;
}
};
})), Ke = /* @__PURE__ */ i(((e, t) => {
var n = He();
t.exports = (e, t) => {
let r = n(e, null, !0), i = n(t, null, !0), a = r.compare(i);
if (a === 0) return null;
let o = a > 0, s = o ? r : i, c = o ? i : r, l = !!s.prerelease.length;
if (c.prerelease.length && !l) {
if (!c.patch && !c.minor) return "major";
if (c.compareMain(s) === 0) return c.minor && !c.patch ? "minor" : "patch";
}
let u = l ? "pre" : "";
return r.major === i.major ? r.minor === i.minor ? r.patch === i.patch ? "prerelease" : u + "patch" : u + "minor" : u + "major";
};
})), qe = /* @__PURE__ */ i(((e, t) => {
var n = Ve();
t.exports = (e, t) => new n(e, t).major;
})), Je = /* @__PURE__ */ i(((e, t) => {
var n = Ve();
t.exports = (e, t) => new n(e, t).minor;
})), Ye = /* @__PURE__ */ i(((e, t) => {
var n = Ve();
t.exports = (e, t) => new n(e, t).patch;
})), Xe = /* @__PURE__ */ i(((e, t) => {
var n = He();
t.exports = (e, t) => {
let r = n(e, t);
return r && r.prerelease.length ? r.prerelease : null;
};
})), Ze = /* @__PURE__ */ i(((e, t) => {
var n = Ve();
t.exports = (e, t, r) => new n(e, r).compare(new n(t, r));
})), Qe = /* @__PURE__ */ i(((e, t) => {
var n = Ze();
t.exports = (e, t, r) => n(t, e, r);
})), $e = /* @__PURE__ */ i(((e, t) => {
var n = Ze();
t.exports = (e, t) => n(e, t, !0);
})), et = /* @__PURE__ */ i(((e, t) => {
var n = Ve();
t.exports = (e, t, r) => {
let i = new n(e, r), a = new n(t, r);
return i.compare(a) || i.compareBuild(a);
};
})), tt = /* @__PURE__ */ i(((e, t) => {
var n = et();
t.exports = (e, t) => e.sort((e, r) => n(e, r, t));
})), nt = /* @__PURE__ */ i(((e, t) => {
var n = et();
t.exports = (e, t) => e.sort((e, r) => n(r, e, t));
})), rt = /* @__PURE__ */ i(((e, t) => {
var n = Ze();
t.exports = (e, t, r) => n(e, t, r) > 0;
})), it = /* @__PURE__ */ i(((e, t) => {
var n = Ze();
t.exports = (e, t, r) => n(e, t, r) < 0;
})), at = /* @__PURE__ */ i(((e, t) => {
var n = Ze();
t.exports = (e, t, r) => n(e, t, r) === 0;
})), ot = /* @__PURE__ */ i(((e, t) => {
var n = Ze();
t.exports = (e, t, r) => n(e, t, r) !== 0;
})), st = /* @__PURE__ */ i(((e, t) => {
var n = Ze();
t.exports = (e, t, r) => n(e, t, r) >= 0;
})), ct = /* @__PURE__ */ i(((e, t) => {
var n = Ze();
t.exports = (e, t, r) => n(e, t, r) <= 0;
})), lt = /* @__PURE__ */ i(((e, t) => {
var n = at(), r = ot(), i = rt(), a = st(), o = it(), s = ct();
t.exports = (e, t, c, l) => {
switch (t) {
case "===": return typeof e == "object" && (e = e.version), typeof c == "object" && (c = c.version), e === c;
case "!==": return typeof e == "object" && (e = e.version), typeof c == "object" && (c = c.version), e !== c;
case "":
case "=":
case "==": return n(e, c, l);
case "!=": return r(e, c, l);
case ">": return i(e, c, l);
case ">=": return a(e, c, l);
case "<": return o(e, c, l);
case "<=": return s(e, c, l);
default: throw TypeError(`Invalid operator: ${t}`);
}
};
})), ut = /* @__PURE__ */ i(((e, t) => {
var n = Ve(), r = He(), { safeRe: i, t: a } = Re();
t.exports = (e, t) => {
if (e instanceof n) return e;
if (typeof e == "number" && (e = String(e)), typeof e != "string") return null;
t ||= {};
let o = null;
if (!t.rtl) o = e.match(t.includePrerelease ? i[a.COERCEFULL] : i[a.COERCE]);
else {
let n = t.includePrerelease ? i[a.COERCERTLFULL] : i[a.COERCERTL], r;
for (; (r = n.exec(e)) && (!o || o.index + o[0].length !== e.length);) (!o || r.index + r[0].length !== o.index + o[0].length) && (o = r), n.lastIndex = r.index + r[1].length + r[2].length;
n.lastIndex = -1;
}
if (o === null) return null;
let s = o[2];
return r(`${s}.${o[3] || "0"}.${o[4] || "0"}${t.includePrerelease && o[5] ? `-${o[5]}` : ""}${t.includePrerelease && o[6] ? `+${o[6]}` : ""}`, t);
};
})), dt = /* @__PURE__ */ i(((e, t) => {
var n = He(), r = Ie(), i = Ve(), a = (e, t, n) => {
if (!r.RELEASE_TYPES.includes(t)) return null;
let i = o(e, n);
return i && s(i, t);
}, o = (e, t) => n(e instanceof i ? e.version : e, t), s = (e, t) => {
if (c(t)) return e.version;
switch (e.prerelease = [], t) {
case "major":
e.minor = 0, e.patch = 0;
break;
case "minor": e.patch = 0;
}
return e.format();
}, c = (e) => e.startsWith("pre");
t.exports = a;
})), ft = /* @__PURE__ */ i(((e, t) => {
t.exports = class {
constructor() {
this.max = 1e3, this.map = /* @__PURE__ */ new Map();
}
get(e) {
let t = this.map.get(e);
if (t !== void 0) return this.map.delete(e), this.map.set(e, t), t;
}
delete(e) {
return this.map.delete(e);
}
set(e, t) {
if (!this.delete(e) && t !== void 0) {
if (this.map.size >= this.max) {
let e = this.map.keys().next().value;
this.delete(e);
}
this.map.set(e, t);
}
return this;
}
};
})), pt = /* @__PURE__ */ i(((e, t) => {
var n = /\s+/g;
t.exports = class e {
constructor(t, r) {
if (r = i(r), t instanceof e) return t.loose === !!r.loose && t.includePrerelease === !!r.includePrerelease ? t : new e(t.raw, r);
if (t instanceof a) return this.raw = t.value, this.set = [[t]], this.formatted = void 0, this;
if (this.options = r, this.loose = !!r.loose, this.includePrerelease = !!r.includePrerelease, this.raw = t.trim().replace(n, " "), this.set = this.raw.split("||").map((e) => this.parseRange(e.trim())).filter((e) => e.length), !this.set.length) throw TypeError(`Invalid SemVer Range: ${this.raw}`);
if (this.set.length > 1) {
let e = this.set[0];
if (this.set = this.set.filter((e) => !_(e[0])), this.set.length === 0) this.set = [e];
else if (this.set.length > 1) {
for (let e of this.set) if (e.length === 1 && v(e[0])) {
this.set = [e];
break;
}
}
}
this.formatted = void 0;
}
get range() {
if (this.formatted === void 0) {
this.formatted = "";
for (let e = 0; e < this.set.length; e++) {
e > 0 && (this.formatted += "||");
let t = this.set[e];
for (let e = 0; e < t.length; e++) e > 0 && (this.formatted += " "), this.formatted += t[e].toString().trim();
}
}
return this.formatted;
}
format() {
return this.range;
}
toString() {
return this.range;
}
parseRange(e) {
e = e.replace(g, "");
let t = ((this.options.includePrerelease && m) | (this.options.loose && h)) + ":" + e, n = r.get(t);
if (n) return n;
let i = this.options.loose, s = i ? c[u.HYPHENRANGELOOSE] : c[u.HYPHENRANGE];
e = e.replace(s, ee(this.options.includePrerelease)), o("hyphen replace", e), e = e.replace(c[u.COMPARATORTRIM], d), o("comparator trim", e), e = e.replace(c[u.TILDETRIM], f), o("tilde trim", e), e = e.replace(c[u.CARETTRIM], p), o("caret trim", e);
let l = e.split(" ").map((e) => b(e, this.options)).join(" ").split(/\s+/).map((e) => A(e, this.options));
i && (l = l.filter((e) => (o("loose invalid filter", e, this.options), !!e.match(c[u.COMPARATORLOOSE])))), o("range list", l);
let v = /* @__PURE__ */ new Map(), y = l.map((e) => new a(e, this.options));
for (let e of y) {
if (_(e)) return [e];
v.set(e.value, e);
}
v.size > 1 && v.has("") && v.delete("");
let x = [...v.values()];
return r.set(t, x), x;
}
intersects(t, n) {
if (!(t instanceof e)) throw TypeError("a Range is required");
return this.set.some((e) => y(e, n) && t.set.some((t) => y(t, n) && e.every((e) => t.every((t) => e.intersects(t, n)))));
}
test(e) {
if (!e) return !1;
if (typeof e == "string") try {
e = new s(e, this.options);
} catch {
return !1;
}
for (let t = 0; t < this.set.length; t++) if (j(this.set[t], e, this.options)) return !0;
return !1;
}
};
var r = new (ft())(), i = ze(), a = mt(), o = Le(), s = Ve(), { safeRe: c, src: l, t: u, comparatorTrimReplace: d, tildeTrimReplace: f, caretTrimReplace: p } = Re(), { FLAG_INCLUDE_PRERELEASE: m, FLAG_LOOSE: h } = Ie(), g = new RegExp(l[u.BUILD], "g"), _ = (e) => e.value === "<0.0.0-0", v = (e) => e.value === "", y = (e, t) => {
let n = !0, r = e.slice(), i = r.pop();
for (; n && r.length;) n = r.every((e) => i.intersects(e, t)), i = r.pop();
return n;
}, b = (e, t) => (e = e.replace(c[u.BUILD], ""), o("comp", e, t), e = T(e, t), o("caret", e), e = C(e, t), o("tildes", e), e = D(e, t), o("xrange", e), e = k(e, t), o("stars", e), e), x = (e) => !e || e.toLowerCase() === "x" || e === "*", S = (e, t, n) => x(e) && !x(t) || x(t) && n && !x(n), C = (e, t) => e.trim().split(/\s+/).map((e) => w(e, t)).join(" "), w = (e, t) => {
let n = t.loose ? c[u.TILDELOOSE] : c[u.TILDE], r = t.includePrerelease ? "-0" : "";
return e.replace(n, (t, n, i, a, s) => {
o("tilde", e, t, n, i, a, s);
let c;
return x(n) ? c = "" : x(i) ? c = `>=${n}.0.0${r} <${+n + 1}.0.0-0` : x(a) ? c = `>=${n}.${i}.0${r} <${n}.${+i + 1}.0-0` : s ? (o("replaceTilde pr", s), c = `>=${n}.${i}.${a}-${s} <${n}.${+i + 1}.0-0`) : c = `>=${n}.${i}.${a} <${n}.${+i + 1}.0-0`, o("tilde return", c), c;
});
}, T = (e, t) => e.trim().split(/\s+/).map((e) => E(e, t)).join(" "), E = (e, t) => {
o("caret", e, t);
let n = t.loose ? c[u.CARETLOOSE] : c[u.CARET], r = t.includePrerelease ? "-0" : "";
return e.replace(n, (t, n, i, a, s) => {
o("caret", e, t, n, i, a, s);
let c;
return x(n) ? c = "" : x(i) ? c = `>=${n}.0.0${r} <${+n + 1}.0.0-0` : x(a) ? c = n === "0" ? `>=${n}.${i}.0${r} <${n}.${+i + 1}.0-0` : `>=${n}.${i}.0${r} <${+n + 1}.0.0-0` : s ? (o("replaceCaret pr", s), c = n === "0" ? i === "0" ? `>=${n}.${i}.${a}-${s} <${n}.${i}.${+a + 1}-0` : `>=${n}.${i}.${a}-${s} <${n}.${+i + 1}.0-0` : `>=${n}.${i}.${a}-${s} <${+n + 1}.0.0-0`) : (o("no pr"), c = n === "0" ? i === "0" ? `>=${n}.${i}.${a} <${n}.${i}.${+a + 1}-0` : `>=${n}.${i}.${a} <${n}.${+i + 1}.0-0` : `>=${n}.${i}.${a} <${+n + 1}.0.0-0`), o("caret return", c), c;
});
}, D = (e, t) => (o("replaceXRanges", e, t), e.split(/\s+/).map((e) => O(e, t)).join(" ")), O = (e, t) => {
e = e.trim();
let n = t.loose ? c[u.XRANGELOOSE] : c[u.XRANGE];
return e.replace(n, (n, r, i, a, s, c) => {
if (o("xRange", e, n, r, i, a, s, c), S(i, a, s)) return e;
let l = x(i), u = l || x(a), d = u || x(s), f = d;
return r === "=" && f && (r = ""), c = t.includePrerelease ? "-0" : "", l ? n = r === ">" || r === "<" ? "<0.0.0-0" : "*" : r && f ? (u && (a = 0), s = 0, r === ">" ? (r = ">=", u ? (i = +i + 1, a = 0, s = 0) : (a = +a + 1, s = 0)) : r === "<=" && (r = "<", u ? i = +i + 1 : a = +a + 1), r === "<" && (c = "-0"), n = `${r + i}.${a}.${s}${c}`) : u ? n = `>=${i}.0.0${c} <${+i + 1}.0.0-0` : d && (n = `>=${i}.${a}.0${c} <${i}.${+a + 1}.0-0`), o("xRange return", n), n;
});
}, k = (e, t) => (o("replaceStars", e, t), e.trim().replace(c[u.STAR], "")), A = (e, t) => (o("replaceGTE0", e, t), e.trim().replace(c[t.includePrerelease ? u.GTE0PRE : u.GTE0], "")), ee = (e) => (t, n, r, i, a, o, s, c, l, u, d, f) => (n = x(r) ? "" : x(i) ? `>=${r}.0.0${e ? "-0" : ""}` : x(a) ? `>=${r}.${i}.0${e ? "-0" : ""}` : o ? `>=${n}` : `>=${n}${e ? "-0" : ""}`, c = x(l) ? "" : x(u) ? `<${+l + 1}.0.0-0` : x(d) ? `<${l}.${+u + 1}.0-0` : f ? `<=${l}.${u}.${d}-${f}` : e ? `<${l}.${u}.${+d + 1}-0` : `<=${c}`, `${n} ${c}`.trim()), j = (e, t, n) => {
for (let n = 0; n < e.length; n++) if (!e[n].test(t)) return !1;
if (t.prerelease.length && !n.includePrerelease) {
for (let n = 0; n < e.length; n++) if (o(e[n].semver), e[n].semver !== a.ANY && e[n].semver.prerelease.length > 0) {
let r = e[n].semver;
if (r.major === t.major && r.minor === t.minor && r.patch === t.patch) return !0;
}
return !1;
}
return !0;
};
})), mt = /* @__PURE__ */ i(((e, t) => {
var n = Symbol("SemVer ANY");
t.exports = class e {
static get ANY() {
return n;
}
constructor(t, i) {
if (i = r(i), t instanceof e) {
if (t.loose === !!i.loose) return t;
t = t.value;
}
t = t.trim().split(/\s+/).join(" "), s("comparator", t, i), this.options = i, this.loose = !!i.loose, this.parse(t), this.value = this.semver === n ? "" : this.operator + this.semver.version, s("comp", this);
}
parse(e) {
let t = this.options.loose ? i[a.COMPARATORLOOSE] : i[a.COMPARATOR], r = e.match(t);
if (!r) throw TypeError(`Invalid comparator: ${e}`);
this.operator = r[1] === void 0 ? "" : r[1], this.operator === "=" && (this.operator = ""), this.semver = r[2] ? new c(r[2], this.options.loose) : n;
}
toString() {
return this.value;
}
test(e) {
if (s("Comparator.test", e, this.options.loose), this.semver === n || e === n) return !0;
if (typeof e == "string") try {
e = new c(e, this.options);
} catch {
return !1;
}
return o(e, this.operator, this.semver, this.options);
}
intersects(t, n) {
if (!(t instanceof e)) throw TypeError("a Comparator is required");
return this.operator === "" ? this.value === "" || new l(t.value, n).test(this.value) : t.operator === "" ? t.value === "" || new l(this.value, n).test(t.semver) : (n = r(n), n.includePrerelease && (this.value === "<0.0.0-0" || t.value === "<0.0.0-0") || !n.includePrerelease && (this.value.startsWith("<0.0.0") || t.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && t.operator.startsWith(">") || this.operator.startsWith("<") && t.operator.startsWith("<") || this.semver.version === t.semver.version && this.operator.includes("=") && t.operator.includes("=") || o(this.semver, "<", t.semver, n) && this.operator.startsWith(">") && t.operator.startsWith("<") || o(this.semver, ">", t.semver, n) && this.operator.startsWith("<") && t.operator.startsWith(">")));
}
};
var r = ze(), { safeRe: i, t: a } = Re(), o = lt(), s = Le(), c = Ve(), l = pt();
})), ht = /* @__PURE__ */ i(((e, t) => {
var n = pt();
t.exports = (e, t, r) => {
try {
t = new n(t, r);
} catch {
return !1;
}
return t.test(e);
};
})), gt = /* @__PURE__ */ i(((e, t) => {
var n = pt();
t.exports = (e, t) => new n(e, t).set.map((e) => e.map((e) => e.value).join(" ").trim().split(" "));
})), _t = /* @__PURE__ */ i(((e, t) => {
var n = Ve(), r = pt();
t.exports = (e, t, i) => {
let a = null, o = null, s = null;
try {
s = new r(t, i);
} catch {
return null;
}
return e.forEach((e) => {
s.test(e) && (!a || o.compare(e) === -1) && (a = e, o = new n(a, i));
}), a;
};
})), vt = /* @__PURE__ */ i(((e, t) => {
var n = Ve(), r = pt();
t.exports = (e, t, i) => {
let a = null, o = null, s = null;
try {
s = new r(t, i);
} catch {
return null;
}
return e.forEach((e) => {
s.test(e) && (!a || o.compare(e) === 1) && (a = e, o = new n(a, i));
}), a;
};
})), yt = /* @__PURE__ */ i(((e, t) => {
var n = Ve(), r = pt(), i = rt();
t.exports = (e, t) => {
e = new r(e, t);
let a = new n("0.0.0");
if (e.test(a) || (a = new n("0.0.0-0"), e.test(a))) return a;
a = null;
for (let t = 0; t < e.set.length; ++t) {
let r = e.set[t], o = null;
r.forEach((e) => {
let t = new n(e.semver.version);
switch (e.operator) {
case ">": t.prerelease.length === 0 ? t.patch++ : t.prerelease.push(0), t.raw = t.format();
case "":
case ">=":
(!o || i(t, o)) && (o = t);
break;
case "<":
case "<=": break;
/* istanbul ignore next */
default: throw Error(`Unexpected operation: ${e.operator}`);
}
}), o && (!a || i(a, o)) && (a = o);
}
return a && e.test(a) ? a : null;
};
})), bt = /* @__PURE__ */ i(((e, t) => {
var n = pt();
t.exports = (e, t) => {
try {
return new n(e, t).range || "*";
} catch {
return null;
}
};
})), xt = /* @__PURE__ */ i(((e, t) => {
var n = Ve(), r = mt(), { ANY: i } = r, a = pt(), o = ht(), s = rt(), c = it(), l = ct(), u = st();
t.exports = (e, t, d, f) => {
e = new n(e, f), t = new a(t, f);
let p, m, h, g, _;
switch (d) {
case ">":
p = s, m = l, h = c, g = ">", _ = ">=";
break;
case "<":
p = c, m = u, h = s, g = "<", _ = "<=";
break;
default: throw TypeError("Must provide a hilo val of \"<\" or \">\"");
}
if (o(e, t, f)) return !1;
for (let n = 0; n < t.set.length; ++n) {
let a = t.set[n], o = null, s = null;
if (a.forEach((e) => {
e.semver === i && (e = new r(">=0.0.0")), o ||= e, s ||= e, p(e.semver, o.semver, f) ? o = e : h(e.semver, s.semver, f) && (s = e);
}), o.operator === g || o.operator === _ || (!s.operator || s.operator === g) && m(e, s.semver) || s.operator === _ && h(e, s.semver)) return !1;
}
return !0;
};
})), St = /* @__PURE__ */ i(((e, t) => {
var n = xt();
t.exports = (e, t, r) => n(e, t, ">", r);
})), Ct = /* @__PURE__ */ i(((e, t) => {
var n = xt();
t.exports = (e, t, r) => n(e, t, "<", r);
})), wt = /* @__PURE__ */ i(((e, t) => {
var n = pt();
t.exports = (e, t, r) => (e = new n(e, r), t = new n(t, r), e.intersects(t, r));
})), Tt = /* @__PURE__ */ i(((e, t) => {
var n = ht(), r = Ze();
t.exports = (e, t, i) => {
let a = [], o = null, s = null, c = e.sort((e, t) => r(e, t, i));
for (let e of c) n(e, t, i) ? (s = e, o ||= e) : (s && a.push([o, s]), s = null, o = null);
o && a.push([o, null]);
let l = [];
for (let [e, t] of a) e === t ? l.push(e) : !t && e === c[0] ? l.push("*") : t ? e === c[0] ? l.push(`<=${t}`) : l.push(`${e} - ${t}`) : l.push(`>=${e}`);
let u = l.join(" || "), d = typeof t.raw == "string" ? t.raw : String(t);
return u.length < d.length ? u : t;
};
})), Et = /* @__PURE__ */ i(((e, t) => {
var n = pt(), r = mt(), { ANY: i } = r, a = ht(), o = Ze(), s = (e, t, r = {}) => {
if (e === t) return !0;
e = new n(e, r), t = new n(t, r);
let i = !1;
OUTER: for (let n of e.set) {
for (let e of t.set) {
let t = u(n, e, r);
if (i ||= t !== null, t) continue OUTER;
}
if (i) return !1;
}
return !0;
}, c = [new r(">=0.0.0-0")], l = [new r(">=0.0.0")], u = (e, t, n) => {
if (e === t) return !0;
if (e.length === 1 && e[0].semver === i) {
if (t.length === 1 && t[0].semver === i) return !0;
e = n.includePrerelease ? c : l;
}
if (t.length === 1 && t[0].semver === i) {
if (n.includePrerelease) return !0;
t = l;
}
let r = /* @__PURE__ */ new Set(), s, u;
for (let t of e) t.operator === ">" || t.operator === ">=" ? s = d(s, t, n) : t.operator === "<" || t.operator === "<=" ? u = f(u, t, n) : r.add(t.semver);
if (r.size > 1) return null;
let p;
if (s && u && (p = o(s.semver, u.semver, n), p > 0 || p === 0 && (s.operator !== ">=" || u.operator !== "<="))) return null;
for (let e of r) {
if (s && !a(e, String(s), n) || u && !a(e, String(u), n)) return null;
for (let r of t) if (!a(e, String(r), n)) return !1;
return !0;
}
let m, h, g, _, v = u && !n.includePrerelease && u.semver.prerelease.length ? u.semver : !1, y = s && !n.includePrerelease && s.semver.prerelease.length ? s.semver : !1;
v && v.prerelease.length === 1 && u.operator === "<" && v.prerelease[0] === 0 && (v = !1);
for (let e of t) {
if (_ = _ || e.operator === ">" || e.operator === ">=", g = g || e.operator === "<" || e.operator === "<=", s) {
if (y && e.semver.prerelease && e.semver.prerelease.length && e.semver.major === y.major && e.semver.minor === y.minor && e.semver.patch === y.patch && (y = !1), e.operator === ">" || e.operator === ">=") {
if (m = d(s, e, n), m === e && m !== s) return !1;
} else if (s.operator === ">=" && !e.test(s.semver)) return !1;
}
if (u) {
if (v && e.semver.prerelease && e.semver.prerelease.length && e.semver.major === v.major && e.semver.minor === v.minor && e.semver.patch === v.patch && (v = !1), e.operator === "<" || e.operator === "<=") {
if (h = f(u, e, n), h === e && h !== u) return !1;
} else if (u.operator === "<=" && !e.test(u.semver)) return !1;
}
if (!e.operator && (u || s) && p !== 0) return !1;
}
return !(s && g && !u && p !== 0 || u && _ && !s && p !== 0 || y || v);
}, d = (e, t, n) => {
if (!e) return t;
let r = o(e.semver, t.semver, n);
return r > 0 ? e : r < 0 || t.operator === ">" && e.operator === ">=" ? t : e;
}, f = (e, t, n) => {
if (!e) return t;
let r = o(e.semver, t.semver, n);
return r < 0 ? e : r > 0 || t.operator === "<" && e.operator === "<=" ? t : e;
};
t.exports = s;
})), Dt = /* @__PURE__ */ i(((e, t) => {
var n = Re(), r = Ie(), i = Ve(), a = Be();
t.exports = {
parse: He(),
valid: Ue(),
clean: We(),
inc: Ge(),
diff: Ke(),
major: qe(),
minor: Je(),
patch: Ye(),
prerelease: Xe(),
compare: Ze(),
rcompare: Qe(),
compareLoose: $e(),
compareBuild: et(),
sort: tt(),
rsort: nt(),
gt: rt(),
lt: it(),
eq: at(),
neq: ot(),
gte: st(),
lte: ct(),
cmp: lt(),
coerce: ut(),
truncate: dt(),
Comparator: mt(),
Range: pt(),
satisfies: ht(),
toComparators: gt(),
maxSatisfying: _t(),
minSatisfying: vt(),
minVersion: yt(),
validRange: bt(),
outside: xt(),
gtr: St(),
ltr: Ct(),
intersects: wt(),
simplifyRange: Tt(),
subset: Et(),
SemVer: i,
re: n.re,
src: n.src,
tokens: n.t,
SEMVER_SPEC_VERSION: r.SEMVER_SPEC_VERSION,
RELEASE_TYPES: r.RELEASE_TYPES,
compareIdentifiers: a.compareIdentifiers,
rcompareIdentifiers: a.rcompareIdentifiers
};
})), Ot = /* @__PURE__ */ n(Fe(), 1), G = /* @__PURE__ */ n(Dt(), 1);
function kt(e, t, n) {
let r = e.indexOf(t);
if (r === -1) return e;
let i = t.length, a = 0, o = "";
do
o += e.slice(a, r) + t + n, a = r + i, r = e.indexOf(t, a);
while (r !== -1);
return o += e.slice(a), o;
}
function At(e, t, n, r) {
let i = 0, a = "";
do {
let o = e[r - 1] === "\r";
a += e.slice(i, o ? r - 1 : r) + t + (o ? "\r\n" : "\n") + n, i = r + 1, r = e.indexOf("\n", i);
} while (r !== -1);
return a += e.slice(i), a;
}
//#endregion
//#region node_modules/chalk/source/vendor/ansi-styles/index.js
var jt = 10, Mt = 20, Nt = (e = 0) => (t) => `\u{1B}[${t + e}m`, Pt = (e = 0) => (t) => `\u{1B}[${38 + e};5;${t}m`, Ft = (e = 0) => (t, n, r) => `\u{1B}[${38 + e};2;${t};${n};${r}m`, It = (e) => `\u{1B}[58;5;${e < 90 ? e - 30 : e - 90 + 8}m`, K = {
modifier: {
reset: [0, 0],
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
underlineDouble: ["4:2", 24],
underlineCurly: ["4:3", 24],
underlineDotted: ["4:4", 24],
underlineDashed: ["4:5", 24],
overline: [53, 55],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
color: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
blackBright: [90, 39],
gray: [90, 39],
grey: [90, 39],
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
blueBright: [94, 39],
magentaBright: [95, 39],
cyanBright: [96, 39],
whiteBright: [97, 39]
},
bgColor: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
bgBlackBright: [100, 49],
bgGray: [100, 49],
bgGrey: [100, 49],
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49]
},
underlineColor: {
underlineBlack: ["58;5;0", 59],
underlineRed: ["58;5;1", 59],
underlineGreen: ["58;5;2", 59],
underlineYellow: ["58;5;3", 59],
underlineBlue: ["58;5;4", 59],
underlineMagenta: ["58;5;5", 59],
underlineCyan: ["58;5;6", 59],
underlineWhite: ["58;5;7", 59],
underlineBlackBright: ["58;5;8", 59],
underlineGray: ["58;5;8", 59],
underlineGrey: ["58;5;8", 59],
underlineRedBright: ["58;5;9", 59],
underlineGreenBright: ["58;5;10", 59],
underlineYellowBright: ["58;5;11", 59],
underlineBlueBright: ["58;5;12", 59],
underlineMagentaBright: ["58;5;13", 59],
underlineCyanBright: ["58;5;14", 59],
underlineWhiteBright: ["58;5;15", 59]
}
};
Object.keys(K.modifier);
var Lt = Object.keys(K.color), Rt = Object.keys(K.bgColor);
Object.keys(K.underlineColor), [...Lt, ...Rt];
function zt() {
let e = /* @__PURE__ */ new Map();
for (let [t, n] of Object.entries(K)) {
for (let [t, r] of Object.entries(n)) K[t] = {
open: `\u{1B}[${r[0]}m`,
close: `\u{1B}[${r[1]}m`
}, n[t] = K[t], e.set(Number.parseInt(r[0], 10), r[1]);
Object.defineProperty(K, t, {
value: n,
enumerable: !1
});
}
return Object.defineProperty(K, "codes", {
value: e,
enumerable: !1
}), K.color.close = "\x1B[39m", K.bgColor.close = "\x1B[49m", K.underlineColor.close = "\x1B[59m", K.color.ansi = Nt(), K.color.ansi256 = Pt(), K.color.ansi16m = Ft(), K.bgColor.ansi = Nt(jt), K.bgColor.ansi256 = Pt(jt), K.bgColor.ansi16m = Ft(jt), K.underlineColor.ansi = It, K.underlineColor.ansi256 = Pt(Mt), K.underlineColor.ansi16m = Ft(Mt), Object.defineProperties(K, {
rgbToAnsi256: {
value(e, t, n) {
return e === t && t === n ? e < 8 ? 16 : e > 248 ? 231 : Math.round((e - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(e / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(n / 255 * 5);
},
enumerable: !1
},
hexToRgb: {
value(e) {
let t = /[\da-f]{6}|[\da-f]{3}/i.exec(e.toString(16));
if (!t) return [
0,
0,
0
];
let [n] = t;
n.length === 3 && (n = [...n].map((e) => e + e).join(""));
let r = Number.parseInt(n, 16);
return [
r >> 16 & 255,
r >> 8 & 255,
r & 255
];
},
enumerable: !1
},
hexToAnsi256: {
value: (e) => K.rgbToAnsi256(...K.hexToRgb(e)),
enumerable: !1
},
ansi256ToAnsi: {
value(e) {
if (e < 8) return 30 + e;
if (e < 16) return 90 + (e - 8);
let t, n, r;
if (e >= 232) t = ((e - 232) * 10 + 8) / 255, n = t, r = t;
else {
e -= 16;
let i = e % 36;
t = Math.floor(e / 36) / 5, n = Math.floor(i / 6) / 5, r = i % 6 / 5;
}
let i = Math.max(t, n, r) * 2;
if (i === 0) return 30;
let a = 30 + (Math.round(r) << 2 | Math.round(n) << 1 | Math.round(t));
return i === 2 && (a += 60), a;
},
enumerable: !1
},
rgbToAnsi: {
value: (e, t, n) => K.ansi256ToAnsi(K.rgbToAnsi256(e, t, n)),
enumerable: !1
},
hexToAnsi: {
value: (e) => K.ansi256ToAnsi(K.hexToAnsi256(e)),
enumerable: !1
}
}), K;
}
var Bt = zt();
//#endregion
//#region node_modules/chalk/source/vendor/supports-color/index.js
function Vt(e, t = globalThis.Deno ? globalThis.Deno.args : p.argv) {
let n = e.startsWith("-") ? "" : e.length === 1 ? "-" : "--", r = t.indexOf(n + e), i = t.indexOf("--");
return r !== -1 && (i === -1 || r < i);
}
var { env: q } = p, Ht;
Vt("no-color") || Vt("no-colors") || Vt("color=false") || Vt("color=never") ? Ht = 0 : (Vt("color") || Vt("colors") || Vt("color=true") || Vt("color=always")) && (Ht = 1);
function Ut() {
return /^\d+$/.test(q.FORCE_COLOR);
}
function Wt() {
if ("FORCE_COLOR" in q) {
if (q.FORCE_COLOR === "false") return 0;
if (q.FORCE_COLOR === "true" || q.FORCE_COLOR.length === 0) return 1;
if (Ut()) return Math.min(Number.parseInt(q.FORCE_COLOR, 10), 3);
}
}
function Gt(e) {
return e !== 0 && {
level: e,
hasBasic: !0,
has256: e >= 2,
has16m: e >= 3
};
}
function Kt(e, { streamIsTTY: t, sniffFlags: n = !0 } = {}) {
let r = Wt();
r !== void 0 && (Ht = r);
let i = n ? Ht : r;
if (i === 0) return 0;
if (n) {
if (Vt("color=16m") || Vt("color=full") || Vt("color=truecolor")) return 3;
if (Vt("color=256")) return 2;
}
if (i !== void 0 && Ut()) return i;
if ("TF_BUILD" in q && "AGENT_NAME" in q) return 1;
if (e && !t && i === void 0) return 0;
let a = i || 0;
if (q.TERM === "dumb") return a;
if (p.platform === "win32") {
let e = c.release().split(".");
return Number(e[0]) >= 10 && Number(e[2]) >= 10586 ? Number(e[2]) >= 14931 ? 3 : 2 : 1;
}
if ("CI" in q) return [
"GITHUB_ACTIONS",
"GITEA_ACTIONS",
"CIRCLECI"
].some((e) => e in q) ? 3 : [
"TRAVIS",
"APPVEYOR",
"GITLAB_CI",
"BUILDKITE",
"DRONE"
].some((e) => e in q) || q.CI_NAME === "codeship" ? 1 : a;
if ("TEAMCITY_VERSION" in q) return +!!/^(?:9\.0*[1-9]\d*\.|\d{2,}\.)/.test(q.TEAMCITY_VERSION);
if (q.COLORTERM === "truecolor" || q.TERM === "xterm-kitty" || q.TERM === "xterm-ghostty" || q.TERM === "wezterm") return 3;
if ("TERM_PROGRAM" in q) {
let e = Number.parseInt((q.TERM_PROGRAM_VERSION || "").split(".", 1)[0], 10);
switch (q.TERM_PROGRAM) {
case "iTerm.app": return e >= 3 ? 3 : 2;
case "Apple_Terminal": return 2;
}
}
return /-256(?:color)?$/i.test(q.TERM) ? 2 : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(q.TERM) || "COLORTERM" in q ? 1 : a;
}
function qt(e, t = {}) {
return Gt(Kt(e, {
streamIsTTY: e && e.isTTY,
...t
}));
}
//#endregion
//#region node_modules/chalk/source/index.js
var { stdout: Jt, stderr: Yt } = {
stdout: qt({ isTTY: m.isatty(1) }),
stderr: qt({ isTTY: m.isatty(2) })
}, Xt = Symbol("GENERATOR"), Zt = Symbol("STYLER"), Qt = Symbol("IS_EMPTY"), $t = Symbol("LEVEL"), en = Object.create(null), tn = (e) => {
if (!Number.isSafeInteger(e) || e < 0 || e > 3) throw Error("The `level` should be an integer from 0 to 3");
}, nn = {
enumerable: !0,
get() {
return this[$t];
},
set(e) {
tn(e), this[$t] = e;
}
}, rn = (e, t = {}) => {
t.level !== void 0 && tn(t.level);
let n = Jt ? Jt.level : 0;
e[$t] = t.level === void 0 ? n : t.level;
}, an = class {
constructor(e) {
return on(e);
}
}, on = (e) => {
let t = (...e) => e.join(" ");
return rn(t, e), Object.setPrototypeOf(t, sn.prototype), t;
};
function sn(e) {
return on(e);
}
Object.setPrototypeOf(sn.prototype, Function.prototype);
for (let [e, t] of Object.entries(Bt)) en[e] = { get() {
let n = dn(this, un(t.open, t.close, this[Zt]), this[Qt]);
return Object.defineProperty(this, e, { value: n }), n;
} };
en.visible = { get() {
let e = dn(this, this[Zt], !0);
return Object.defineProperty(this, "visible", { value: e }), e;
} };
var cn = (e, t) => {
let n = Bt[t];
if (e === "rgb") {
let e = (e, t, r) => n.ansi(Bt.rgbToAnsi(e, t, r));
return [
e,
e,
(e, t, r) => n.ansi256(Bt.rgbToAnsi256(e, t, r)),
n.ansi16m
];
}
if (e === "hex") {
let e = (e) => n.ansi(Bt.hexToAnsi(e));
return [
e,
e,
(e) => n.ansi256(Bt.hexToAnsi256(e)),
(e) => n.ansi16m(...Bt.hexToRgb(e))
];
}
let r = (e) => n.ansi(Bt.ansi256ToAnsi(e));
return [
r,
r,
n.ansi256,
n.ansi256
];
};
for (let e of [
"rgb",
"hex",
"ansi256"
]) {
let t = e[0].toUpperCase() + e.slice(1);
for (let [n, r] of [
[e, "color"],
["bg" + t, "bgColor"],
["underline" + t, "underlineColor"]
]) {
let { close: t } = Bt[r], i = cn(e, r);
en[n] = { get() {
let e = function(e, n, r) {
let a = i[this.level](e, n, r);
return dn(this, un(a, t, this[Zt]), this[Qt]);
};
return Object.defineProperty(this, n, { value: e }), e;
} };
}
}
var ln = Object.defineProperties(() => {}, {
...en,
level: {
enumerable: !0,
get() {
return this[Xt].level;
},
set(e) {
this[Xt].level = e;
}
}
}), un = (e, t, n) => {
let r, i;
return n === void 0 ? (r = e, i = t) : (r = n.openAll + e, i = t + n.closeAll), {
open: e,
close: t,
openAll: r,
closeAll: i,
parent: n
};
}, dn = (e, t, n) => {
let r = (...e) => e.length === 1 ? fn(r, "" + e[0]) : e.length === 2 ? fn(r, e[0] + " " + e[1]) : fn(r, e.join(" "));
return Object.setPrototypeOf(r, ln), r[Xt] = e[Xt] ?? e, r[Zt] = t, r[Qt] = n, r;
}, fn = (e, t) => {
if (e[Xt][$t] <= 0 || !t) return e[Qt] ? "" : t;
let n = e[Zt];
if (n === void 0) return t;
let { openAll: r, closeAll: i } = n;
if (t.includes("\x1B")) for (; n !== void 0;) t = kt(t, n.close, n.open), n = n.parent;
let a = t.indexOf("\n");
return a !== -1 && (t = At(t, i, r, a)), r + t + i;
};
Object.defineProperties(sn.prototype, {
...en,
level: nn
});
var pn = sn();
sn({ level: Yt ? Yt.level : 0 });
//#endregion
//#region src/lib/keyValueBy.ts
function J(e, t, n = {}) {
let r = Array.isArray(e);
return t ||= ((e) => ({ [e]: !0 })), Object.entries(e || {}).forEach(([e, i], a) => {
let o = r ? t(i, a, n) : t(e, i, n);
for (let [e, t] of Object.entries(o || {})) n[e] = t;
}), n;
}
//#endregion
//#region src/lib/chalk.ts
var mn = {
blue: !0,
bold: !0,
cyan: !0,
dim: !0,
gray: !0,
green: !0,
magenta: !0,
red: !0,
reset: !0,
underline: !0,
yellow: !0
}, hn = J(mn, (e) => ({ [e]: Object.assign((e) => e.toString(), {
bold: (e) => e.toString(),
underline: (e) => e.toString()
}) })), gn, _n = (e) => e === !0 ? new an({ level: 1 }) : e === void 0 ? pn : hn, vn = (e) => {
gn = _n(e);
}, yn = () => {
if (!gn) throw Error("Chalk has not been imported yet.");
}, Y = J(mn, (e) => {
let t = (t) => (yn(), gn[e](t));
return t.bold = (t) => (yn(), gn[e].bold(t)), t.underline = (t) => (yn(), gn[e].underline(t)), { [e]: t };
}), bn = (e, t) => J(e, (e, n) => t(e, n) ? { [e]: n } : null), xn = [
{
amount: 60,
unit: "second"
},
{
amount: 60,
unit: "minute"
},
{
amount: 24,
unit: "hour"
},
{
amount: 7,
unit: "day"
},
{
amount: 365 / 7 / 12,
unit: "week"
},
{
amount: 12,
unit: "month"
}
], Sn, Cn = () => Sn ??= new Intl.RelativeTimeFormat("en", { numeric: "always" });
function wn(e) {
let t = typeof e == "string" && /^\d+$/.test(e) ? Number(e) : e, n = (new Date(t).getTime() - Date.now()) / 1e3;
if (Math.abs(n) < 10) return "just now";
let r = "year";
for (let e of xn) {
if (Math.abs(n) < e.amount) {
r = e.unit;
break;
}
n /= e.amount;
}
return Cn().format(Math.trunc(n), r);
}
//#endregion
//#region src/lib/exists.ts
var Tn = async (e) => {
try {
return await s.stat(e), !0;
} catch {
return !1;
}
}, En = a(import.meta.url);
async function Dn(e, { pkgFile: t } = {}) {
let n = En.resolve.paths(e) || [], r = t ? [o.join(o.dirname(t), "node_modules")] : [], i = [o.join(process.cwd(), "node_modules")], a = [
...r,
...i,
...n
];
for (let t of a) {
let n = o.join(t, e, "package.json");
if (await Tn(n)) try {
return JSON.parse(await s.readFile(n, "utf-8"));
} catch {}
}
return null;
}
//#endregion
//#region node_modules/lru-cache/dist/commonjs/node/index.min.js
var On = /* @__PURE__ */ i(((t) => {
var n = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), r = n((t) => {
Object.defineProperty(t, "__esModule", { value: !0 }), t.tracing = t.metrics = void 0;
var n = e("node:diagnostics_channel");
t.metrics = (0, n.channel)("lru-cache:metrics"), t.tracing = (0, n.tracingChannel)("lru-cache");
}), i = n((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.defaultPerf = void 0, e.defaultPerf = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
});
Object.defineProperty(t, "__esModule", { value: !0 }), t.LRUCache = void 0;
var a = r(), o = i(), s = () => a.metrics.hasSubscribers || a.tracing.hasSubscribers, c = /* @__PURE__ */ new Set(), l = typeof process == "object" && process ? process : {}, u = (e, t, n, r) => {
typeof l.emitWarning == "function" ? l.emitWarning(e, t, n, r) : console.error(`[${n}] ${t}: ${e}`);
}, d = (e) => !c.has(e), f = (e) => !!e && e === Math.floor(e) && e > 0 && isFinite(e), p = (e) => f(e) ? e <= 256 ? Uint8Array : e <= 2 ** 16 ? Uint16Array : e <= 2 ** 32 ? Uint32Array : e <= 2 ** 53 - 1 ? m : null : null, m = class extends Array {
constructor(e) {
super(e), this.fill(0);
}
}, h = class e {
heap;
length;
static #e = !1;
static create(t) {
let n = p(t);
if (!n) return [];
e.#e = !0;
let r = new e(t, n);
return e.#e = !1, r;
}
constructor(t, n) {
if (!e.#e) throw TypeError("instantiate Stack using Stack.create(n)");
this.heap = new n(t), this.length = 0;
}
push(e) {
this.heap[this.length++] = e;
}
pop() {
return this.heap[--this.length];
}
};
t.LRUCache = class e {
#e;
#t;
#n;
#r;
#i;
#a;
#o;
#s;
get perf() {
return this.#s;
}
ttl;
ttlResolution;
ttlAutopurge;
updateAgeOnGet;
updateAgeOnHas;
allowStale;
noDisposeOnSet;
noUpdateTTL;
maxEntrySize;
sizeCalculation;
noDeleteOnFetchRejection;
noDeleteOnStaleGet;
allowStaleOnFetchAbort;
allowStaleOnFetchRejection;
ignoreFetchAbort;
backgroundFetchSize;
#c;
#l;
#u;
#d;
#f;
#p;
#m;
#h;
#g;
#_;
#v;
#y;
#b;
#x;
#S;
#C;
#w;
#T;
#E;
static unsafeExposeInternals(e) {
return {
starts: e.#b,
ttls: e.#x,
autopurgeTimers: e.#S,
sizes: e.#y,
keyMap: e.#u,
keyList: e.#d,
valList: e.#f,
next: e.#p,
prev: e.#m,
get head() {
return e.#h;
},
get tail() {
return e.#g;
},
free: e.#_,
isBackgroundFetch: (t) => e.#W(t),
backgroundFetch: (t, n, r, i) => e.#U(t, n, r, i),
moveToTail: (t) => e.#X(t),
indexes: (t) => e.#I(t),
rindexes: (t) => e.#L(t),
isStale: (t) => e.#j(t)
};
}
get max() {
return this.#e;
}
get maxSize() {
return this.#t;
}
get calculatedSize() {
return this.#l;
}
get size() {
return this.#c;
}
get fetchMethod() {
return this.#a;
}
get memoMethod() {
return this.#o;
}
get dispose() {
return this.#n;
}
get onInsert() {
return this.#r;
}
get disposeAfter() {
return this.#i;
}
constructor(t) {
let { max: n = 0, ttl: r, ttlResolution: i = 1, ttlAutopurge: a, updateAgeOnGet: s, updateAgeOnHas: l, allowStale: m, dispose: g, onInsert: _, disposeAfter: v, noDisposeOnSet: y, noUpdateTTL: b, maxSize: x = 0, maxEntrySize: S = 0, sizeCalculation: C, fetchMethod: w, memoMethod: T, noDeleteOnFetchRejection: E, noDeleteOnStaleGet: D, allowStaleOnFetchRejection: O, allowStaleOnFetchAbort: k, ignoreFetchAbort: A, backgroundFetchSize: ee = 1, perf: j } = t;
if (this.backgroundFetchSize = ee, j !== void 0 && typeof j?.now != "function") throw TypeError("perf option must have a now() method if specified");
if (this.#s = j ?? o.defaultPerf, n !== 0 && !f(n)) throw TypeError("max option must be a nonnegative integer");
let M = n ? p(n) : Array;
if (!M) throw Error("invalid max value: " + n);
if (this.#e = n, this.#t = x, this.maxEntrySize = S || this.#t, this.sizeCalculation = C, this.sizeCalculation) {
if (!this.#t && !this.maxEntrySize) throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
if (typeof this.sizeCalculation != "function") throw TypeError("sizeCalculation set to non-function");
}
if (T !== void 0 && typeof T != "function") throw TypeError("memoMethod must be a function if defined");
if (this.#o = T, w !== void 0 && typeof w != "function") throw TypeError("fetchMethod must be a function if specified");
if (this.#a = w, this.#w = !!w, this.#u = /* @__PURE__ */ new Map(), this.#d = Array.from({ length: n }).fill(void 0), this.#f = Array.from({ length: n }).fill(void 0), this.#p = new M(n), this.#m = new M(n), this.#h = 0, this.#g = 0, this.#_ = h.create(n), this.#c = 0, this.#l = 0, typeof g == "function" && (this.#n = g), typeof _ == "function" && (this.#r = _), typeof v == "function" ? (this.#i = v, this.#v = []) : (this.#i = void 0, this.#v = void 0), this.#C = !!this.#n, this.#E = !!this.#r, this.#T = !!this.#i, this.noDisposeOnSet = !!y, this.noUpdateTTL = !!b, this.noDeleteOnFetchRejection = !!E, this.allowStaleOnFetchRejection = !!O, this.allowStaleOnFetchAbort = !!k, this.ignoreFetchAbort = !!A, this.maxEntrySize !== 0) {
if (this.#t !== 0 && !f(this.#t)) throw TypeError("maxSize must be a positive integer if specified");
if (!f(this.maxEntrySize)) throw TypeError("maxEntrySize must be a positive integer if specified");
this.#M();
}
if (this.allowStale = !!m, this.noDeleteOnStaleGet = !!D, this.updateAgeOnGet = !!s, this.updateAgeOnHas = !!l, this.ttlResolution = f(i) || i === 0 ? i : 1, this.ttlAutopurge = !!a, this.ttl = r || 0, this.ttl) {
if (!f(this.ttl)) throw TypeError("ttl must be a positive integer if specified");
this.#D();
}
if (this.#e === 0 && this.ttl === 0 && this.#t === 0) throw TypeError("At least one of max, maxSize, or ttl is required");
if (!this.ttlAutopurge && !this.#e && !this.#t) {
let t = "LRU_CACHE_UNBOUNDED";
d(t) && (c.add(t), u("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", t, e));
}
}
getRemainingTTL(e) {
return this.#u.has(e) ? 1 / 0 : 0;
}
#D() {
let e = new m(this.#e), t = new m(this.#e);
this.#x = e, this.#b = t;
let n = this.ttlAutopurge ? Array.from({ length: this.#e }) : void 0;
this.#S = n, this.#A = (n, i, a = this.#s.now()) => {
t[n] = i === 0 ? 0 : a, e[n] = i, r(n, i);
}, this.#O = (n) => {
t[n] = e[n] === 0 ? 0 : this.#s.now(), r(n, e[n]);
};
let r = this.ttlAutopurge ? (e, t) => {
if (n?.[e] && (clearTimeout(n[e]), n[e] = void 0), t && t !== 0 && n) {
let i = setTimeout(() => {
this.#j(e) ? (this.#Z(this.#d[e], "expire"), n[e] = void 0) : r(e, o(e));
}, t + 1);
i.unref && i.unref(), n[e] = i;
}
} : () => {};
this.#k = (n, r) => {
if (e[r]) {
let o = e[r], s = t[r];
if (!o || !s) return;
n.ttl = o, n.start = s, n.now = i || a(), n.remainingTTL = o - (n.now - s);
}
};
let i = 0, a = () => {
let e = this.#s.now();
if (this.ttlResolution > 0) {
i = e;
let t = setTimeout(() => i = 0, this.ttlResolution);
t.unref && t.unref();
}
return e;
};
this.getRemainingTTL = (e) => {
let t = this.#u.get(e);
return t === void 0 ? 0 : o(t);
};
let o = (n) => {
let r = e[n], o = t[n];
return !r || !o ? 1 / 0 : r - ((i || a()) - o);
};
this.#j = (n) => {
let r = t[n], o = e[n];
return !!o && !!r && (i || a()) - r > o;
};
}
#O = () => {};
#k = () => {};
#A = () => {};
#j = () => !1;
#M() {
let e = new m(this.#e);
this.#l = 0, this.#y = e, this.#N = (t) => {
this.#l -= e[t], e[t] = 0;
}, this.#F = (e, t, n, r) => {
if (!f(n)) {
if (this.#W(t)) return this.backgroundFetchSize;
if (r) {
if (typeof r != "function") throw TypeError("sizeCalculation must be a function");
if (n = r(t, e), !f(n)) throw TypeError("sizeCalculation return invalid (expect positive integer)");
} else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
}
return n;
}, this.#P = (t, n, r) => {
if (e[t] = n, this.#t) {
let n = this.#t - e[t];
for (; this.#l > n;) this.#B(!0);
}
this.#l += e[t], r && (r.entrySize = n, r.totalCalculatedSize = this.#l);
};
}
#N = (e) => {};
#P = (e, t, n) => {};
#F = (e, t, n, r) => {
if (n || r) throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
return 0;
};
*#I({ allowStale: e = this.allowStale } = {}) {
if (this.#c) for (let t = this.#g; this.#R(t) && ((e || !this.#j(t)) && (yield t), t !== this.#h);) t = this.#m[t];
}
*#L({ allowStale: e = this.allowStale } = {}) {
if (this.#c) for (let t = this.#h; this.#R(t) && ((e || !this.#j(t)) && (yield t), t !== this.#g);) t = this.#p[t];
}
#R(e) {
return e !== void 0 && this.#u.get(this.#d[e]) === e;
}
*entries() {
for (let e of this.#I()) this.#f[e] !== void 0 && this.#d[e] !== void 0 && !this.#W(this.#f[e]) && (yield [this.#d[e], this.#f[e]]);
}
*rentries() {
for (let e of this.#L()) this.#f[e] !== void 0 && this.#d[e] !== void 0 && !this.#W(this.#f[e]) && (yield [this.#d[e], this.#f[e]]);
}
*keys() {
for (let e of this.#I()) {
let t = this.#d[e];
t !== void 0 && !this.#W(this.#f[e]) && (yield t);
}
}
*rkeys() {
for (let e of this.#L()) {
let t = this.#d[e];
t !== void 0 && !this.#W(this.#f[e]) && (yield t);
}
}
*values() {
for (let e of this.#I()) this.#f[e] !== void 0 && !this.#W(this.#f[e]) && (yield this.#f[e]);
}
*rvalues() {
for (let e of this.#L()) this.#f[e] !== void 0 && !this.#W(this.#f[e]) && (yield this.#f[e]);
}
[Symbol.iterator]() {
return this.entries();
}
[Symbol.toStringTag] = "LRUCache";
find(e, t = {}) {
for (let n of this.#I()) {
let r = this.#f[n], i = this.#W(r) ? r.__staleWhileFetching : r;
if (i !== void 0 && e(i, this.#d[n], this)) return this.#J(this.#d[n], t);
}
}
forEach(e, t = this) {
for (let n of this.#I()) {
let r = this.#f[n], i = this.#W(r) ? r.__staleWhileFetching : r;
i !== void 0 && e.call(t, i, this.#d[n], this);
}
}
rforEach(e, t = this) {
for (let n of this.#L()) {
let r = this.#f[n], i = this.#W(r) ? r.__staleWhileFetching : r;
i !== void 0 && e.call(t, i, this.#d[n], this);
}
}
purgeStale() {
let e = !1;
for (let t of this.#L({ allowStale: !0 })) this.#j(t) && (this.#Z(this.#d[t], "expire"), e = !0);
return e;
}
info(e) {
let t = this.#u.get(e);
if (t === void 0) return;
let n = this.#f[t], r = this.#W(n) ? n.__staleWhileFetching : n;
if (r === void 0) return;
let i = { value: r };
if (this.#x && this.#b) {
let e = this.#x[t], n = this.#b[t];
e && n && (i.ttl = e - (this.#s.now() - n), i.start = Date.now());
}
return this.#y && (i.size = this.#y[t]), i;
}
dump() {
let e = [];
for (let t of this.#I({ allowStale: !0 })) {
let n = this.#d[t], r = this.#f[t], i = this.#W(r) ? r.__staleWhileFetching : r;
if (i === void 0 || n === void 0) continue;
let a = { value: i };
if (this.#x && this.#b) {
a.ttl = this.#x[t];
let e = this.#s.now() - this.#b[t];
a.start = Math.floor(Date.now() - e);
}
this.#y && (a.size = this.#y[t]), e.unshift([n, a]);
}
return e;
}
load(e) {
this.clear();
for (let [t, n] of e) {
if (n.start) {
let e = Date.now() - n.start;
n.start = this.#s.now() - e;
}
this.#z(t, n.value, n);
}
}
set(e, t, n = {}) {
let { status: r = a.metrics.hasSubscribers ? {} : void 0 } = n;
n.status = r, r && (r.op = "set", r.key = e, t !== void 0 && (r.value = t), r.cache = this);
let i = this.#z(e, t, n);
return r && a.metrics.hasSubscribers && a.metrics.publish(r), i;
}
#z(e, t, n, r) {
let { ttl: i = this.ttl, start: a, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: s = this.sizeCalculation, status: c } = n, l = this.#W(t);
if (t === void 0) return c && (c.set = "deleted"), this.delete(e), this;
let { noUpdateTTL: u = this.noUpdateTTL } = n;
c && !l && (c.value = t);
let d = this.#F(e, t, n.size || 0, s, c);
if (this.maxEntrySize && d > this.maxEntrySize) return this.#Z(e, "set"), c && (c.set = "miss", c.maxEntrySizeExceeded = !0), this;
let f = this.#c === 0 ? void 0 : this.#u.get(e);
if (f === void 0) f = this.#c === 0 ? this.#g : this.#_.length === 0 ? this.#c === this.#e ? this.#B(!1) : this.#c : this.#_.pop(), this.#d[f] = e, this.#f[f] = t, this.#u.set(e, f), this.#p[this.#g] = f, this.#m[f] = this.#g, this.#g = f, this.#c++, this.#P(f, d, c), c && (c.set = "add"), u = !1, this.#E && !l && this.#r?.(t, e, "add");
else {
this.#X(f);
let n = this.#f[f];
if (t !== n) {
if (!o) {
if (this.#W(n)) {
n !== r && n.__abortController.abort(/* @__PURE__ */ Error("replaced"));
let { __staleWhileFetching: i } = n;
i !== void 0 && i !== t && (this.#C && this.#n?.(i, e, "set"), this.#T && this.#v?.push([
i,
e,
"set"
]));
} else this.#C && this.#n?.(n, e, "set"), this.#T && this.#v?.push([
n,
e,
"set"
]);
}
if (this.#N(f), this.#P(f, d, c), this.#f[f] = t, !l) {
let r = n && this.#W(n) ? n.__staleWhileFetching : n, i = r === void 0 ? "add" : t === r ? "update" : "replace";
c && (c.set = i, r !== void 0 && (c.oldValue = r)), this.#E && this.onInsert?.(t, e, i);
}
} else l || (c && (c.set = "update"), this.#E && this.onInsert?.(t, e, "update"));
}
if (i !== 0 && !this.#x && this.#D(), this.#x && (u || this.#A(f, i, a), c && this.#k(c, f)), !o && this.#T && this.#v) {
let e = this.#v, t;
for (; t = e?.shift();) this.#i?.(...t);
}
return this;
}
pop() {
try {
for (; this.#c;) {
let e = this.#f[this.#h];
if (this.#B(!0), this.#W(e)) {
if (e.__staleWhileFetching) return e.__staleWhileFetching;
} else if (e !== void 0) return e;
}
} finally {
if (this.#T && this.#v) {
let e = this.#v, t;
for (; t = e?.shift();) this.#i?.(...t);
}
}
}
#B(e) {
let t = this.#h, n = this.#d[t], r = this.#f[t], i = this.#W(r);
i && r.__abortController.abort(/* @__PURE__ */ Error("evicted"));
let a = i ? r.__staleWhileFetching : r;
return (this.#C || this.#T) && a !== void 0 && (this.#C && this.#n?.(a, n, "evict"), this.#T && this.#v?.push([
a,
n,
"evict"
])), this.#N(t), this.#S?.[t] && (clearTimeout(this.#S[t]), this.#S[t] = void 0), e && (this.#d[t] = void 0, this.#f[t] = void 0, this.#_.push(t)), this.#c === 1 ? (this.#h = this.#g = 0, this.#_.length = 0) : this.#h = this.#p[t], this.#u.delete(n), this.#c--, t;
}
has(e, t = {}) {
let { status: n = a.metrics.hasSubscribers ? {} : void 0 } = t;
t.status = n, n && (n.op = "has", n.key = e, n.cache = this);
let r = this.#V(e, t);
return a.metrics.hasSubscribers && a.metrics.publish(n), r;
}
#V(e, t = {}) {
let { updateAgeOnHas: n = this.updateAgeOnHas, status: r } = t, i = this.#u.get(e);
if (i !== void 0) {
let e = this.#f[i];
if (this.#W(e) && e.__staleWhileFetching === void 0) return !1;
if (this.#j(i)) r && (r.has = "stale", this.#k(r, i));
else return n && this.#O(i), r && (r.has = "hit", this.#k(r, i)), !0;
} else r && (r.has = "miss");
return !1;
}
peek(e, t = {}) {
let { status: n = s() ? {} : void 0 } = t;
n && (n.op = "peek", n.key = e, n.cache = this), t.status = n;
let r = this.#H(e, t);
return a.metrics.hasSubscribers && a.metrics.publish(n), r;
}
#H(e, t) {
let { status: n, allowStale: r = this.allowStale } = t, i = this.#u.get(e);
if (i === void 0 || !r && this.#j(i)) {
n && (n.peek = i === void 0 ? "miss" : "stale");
return;
}
let a = this.#f[i], o = this.#W(a) ? a.__staleWhileFetching : a;
return n && (o === void 0 ? n.peek = "miss" : (n.peek = "hit", n.value = o)), o;
}
#U(e, t, n, r) {
let i = t === void 0 ? void 0 : this.#f[t];
if (this.#W(i)) return i;
let a = new AbortController(), { signal: o } = n;
o?.addEventListener("abort", () => a.abort(o.reason), { signal: a.signal });
let s = {
signal: a.signal,
options: n,
context: r
}, c = (r, i = !1) => {
let { aborted: o } = a.signal, c = n.ignoreFetchAbort && r !== void 0, l = n.ignoreFetchAbort || !!(n.allowStaleOnFetchAbort && r !== void 0);
if (n.status && (o && !i ? (n.status.fetchAborted = !0, n.status.fetchError = a.signal.reason, c && (n.status.fetchAbortIgnored = !0)) : n.status.fetchResolved = !0), o && !c && !i) return u(a.signal.reason, l);
let d = f, p = this.#f[t];
return (p === f || p === void 0 && c && i) && (r === void 0 ? d.__staleWhileFetching === void 0 ? this.#Z(e, "fetch") : this.#f[t] = d.__staleWhileFetching : (n.status && (n.status.fetchUpdated = !0), this.#z(e, r, s.options, d))), r;
}, l = (e) => (n.status && (n.status.fetchRejected = !0, n.status.fetchError = e), u(e, !1)), u = (r, i) => {
let { aborted: o } = a.signal, s = o && n.allowStaleOnFetchAbort, c = s || n.allowStaleOnFetchRejection, l = c || n.noDeleteOnFetchRejection, u = f;
if (this.#f[t] === f && (!l || !i && u.__staleWhileFetching === void 0 ? this.#Z(e, "fetch") : s || (this.#f[t] = u.__staleWhileFetching)), c) return n.status && u.__staleWhileFetching !== void 0 && (n.status.returnedStale = !0), u.__staleWhileFetching;
if (u.__returned === u) throw r;
}, d = (t, r) => {
let o = this.#a?.(e, i, s);
a.signal.addEventListener("abort", () => {
(!n.ignoreFetchAbort || n.allowStaleOnFetchAbort) && (t(void 0), n.allowStaleOnFetchAbort && (t = (e) => c(e, !0)));
}), o && o instanceof Promise ? o.then((e) => t(e === void 0 ? void 0 : e), r) : o !== void 0 && t(o);
};
n.status && (n.status.fetchDispatched = !0);
let f = new Promise(d).then(c, l), p = Object.assign(f, {
__abortController: a,
__staleWhileFetching: i,
__returned: void 0
});
return t === void 0 ? (this.#z(e, p, {
...s.options,
status: void 0
}), t = this.#u.get(e)) : this.#f[t] = p, p;
}
#W(e) {
if (!this.#w) return !1;
let t = e;
return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof AbortController;
}
fetch(e, t = {}) {
let n = a.tracing.hasSubscribers, { status: r = s() ? {} : void 0 } = t;
t.status = r, r && t.context && (r.context = t.context);
let i = this.#G(e, t);
return r && n && (r.trace = !0, a.tracing.tracePromise(() => i, r).catch(() => {})), i;
}
async #G(e, t = {}) {
let { allowStale: n = this.allowStale, updateAgeOnGet: r = this.updateAgeOnGet, noDeleteOnStaleGet: i = this.noDeleteOnStaleGet, ttl: a = this.ttl, noDisposeOnSet: o = this.noDisposeOnSet, size: s = 0, sizeCalculation: c = this.sizeCalculation, noUpdateTTL: l = this.noUpdateTTL, noDeleteOnFetchRejection: u = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: f = this.ignoreFetchAbort, allowStaleOnFetchAbort: p = this.allowStaleOnFetchAbort, context: m, forceRefresh: h = !1, status: g, signal: _ } = t;
if (g && (g.op = "fetch", g.key = e, h && (g.forceRefresh = !0), g.cache = this), !this.#w) return g && (g.fetch = "get"), this.#J(e, {
allowStale: n,
updateAgeOnGet: r,
noDeleteOnStaleGet: i,
status: g
});
let v = {
allowStale: n,
updateAgeOnGet: r,
noDeleteOnStaleGet: i,
ttl: a,
noDisposeOnSet: o,
size: s,
sizeCalculation: c,
noUpdateTTL: l,
noDeleteOnFetchRejection: u,
allowStaleOnFetchRejection: d,
allowStaleOnFetchAbort: p,
ignoreFetchAbort: f,
status: g,
signal: _
}, y = this.#u.get(e);
if (y === void 0) {
g && (g.fetch = "miss");
let t = this.#U(e, y, v, m);
return t.__returned = t;
}
{
let t = this.#f[y];
if (this.#W(t)) {
let e = n && t.__staleWhileFetching !== void 0;
return g && (g.fetch = "inflight", e && (g.returnedStale = !0)), e ? t.__staleWhileFetching : t.__returned = t;
}
let i = this.#j(y);
if (!h && !i) return g && (g.fetch = "hit"), this.#X(y), r && this.#O(y), g && this.#k(g, y), t;
let a = this.#U(e, y, v, m), o = a.__staleWhileFetching !== void 0 && n;
return g && (g.fetch = i ? "stale" : "refresh", o && i && (g.returnedStale = !0)), o ? a.__staleWhileFetching : a.__returned = a;
}
}
forceFetch(e, t = {}) {
let n = a.tracing.hasSubscribers, { status: r = s() ? {} : void 0 } = t;
t.status = r, r && t.context && (r.context = t.context);
let i = this.#K(e, t);
return r && n && (r.trace = !0, a.tracing.tracePromise(() => i, r).catch(() => {})), i;
}
async #K(e, t = {}) {
let n = await this.#G(e, t);
if (n === void 0) throw Error("fetch() returned undefined");
return n;
}
memo(e, t = {}) {
let { status: n = a.metrics.hasSubscribers ? {} : void 0 } = t;
t.status = n, n && (n.op = "memo", n.key = e, t.context && (n.context = t.context), n.cache = this);
let r = this.#q(e, t);
return n && (n.value = r), a.metrics.hasSubscribers && a.metrics.publish(n), r;
}
#q(e, t = {}) {
let n = this.#o;
if (!n) throw Error("no memoMethod provided to constructor");
let { context: r, status: i, forceRefresh: a, ...o } = t;
i && a && (i.forceRefresh = !0);
let s = this.#J(e, o), c = a || s === void 0;
if (i && (i.memo = c ? "miss" : "hit", c || (i.value = s)), !c) return s;
let l = n(e, s, {
options: o,
context: r
});
return i && (i.value = l), this.#z(e, l, o), l;
}
get(e, t = {}) {
let { status: n = a.metrics.hasSubscribers ? {} : void 0 } = t;
t.status = n, n && (n.op = "get", n.key = e, n.cache = this);
let r = this.#J(e, t);
return n && (r !== void 0 && (n.value = r), a.metrics.hasSubscribers && a.metrics.publish(n)), r;
}
#J(e, t = {}) {
let { allowStale: n = this.allowStale, updateAgeOnGet: r = this.updateAgeOnGet, noDeleteOnStaleGet: i = this.noDeleteOnStaleGet, status: a } = t, o = this.#u.get(e);
if (o === void 0) {
a && (a.get = "miss");
return;
}
let s = this.#f[o], c = this.#W(s);
return a && this.#k(a, o), this.#j(o) ? c ? (a && (a.get = "stale-fetching"), n && s.__staleWhileFetching !== void 0 ? (a && (a.returnedStale = !0), s.__staleWhileFetching) : void 0) : (i || this.#Z(e, "expire"), a && (a.get = "stale"), n ? (a && (a.returnedStale = !0), s) : void 0) : (a && (a.get = c ? "fetching" : "hit"), this.#X(o), r && this.#O(o), c ? s.__staleWhileFetching : s);
}
#Y(e, t) {
this.#m[t] = e, this.#p[e] = t;
}
#X(e) {
e !== this.#g && (e === this.#h ? this.#h = this.#p[e] : this.#Y(this.#m[e], this.#p[e]), this.#Y(this.#g, e), this.#g = e);
}
delete(e) {
return this.#Z(e, "delete");
}
#Z(e, t) {
a.metrics.hasSubscribers && a.metrics.publish({
op: "delete",
delete: t,
key: e,
cache: this
});
let n = !1;
if (this.#c !== 0) {
let r = this.#u.get(e);
if (r !== void 0) {
if (this.#S?.[r] && (clearTimeout(this.#S[r]), this.#S[r] = void 0), n = !0, this.#c === 1) this.#Q(t);
else {
this.#N(r);
let n = this.#f[r];
if (this.#W(n) ? n.__abortController.abort(/* @__PURE__ */ Error("deleted")) : (this.#C || this.#T) && (this.#C && this.#n?.(n, e, t), this.#T && this.#v?.push([
n,
e,
t
])), this.#u.delete(e), this.#d[r] = void 0, this.#f[r] = void 0, r === this.#g) this.#g = this.#m[r];
else if (r === this.#h) this.#h = this.#p[r];
else {
let e = this.#m[r];
this.#p[e] = this.#p[r];
let t = this.#p[r];
this.#m[t] = this.#m[r];
}
this.#c--, this.#_.push(r);
}
}
}
if (this.#T && this.#v?.length) {
let e = this.#v, t;
for (; t = e?.shift();) this.#i?.(...t);
}
return n;
}
clear() {
return this.#Q("delete");
}
#Q(e) {
for (let t of this.#L({ allowStale: !0 })) {
let n = this.#f[t];
if (this.#W(n)) n.__abortController.abort(/* @__PURE__ */ Error("deleted"));
else {
let r = this.#d[t];
this.#C && this.#n?.(n, r, e), this.#T && this.#v?.push([
n,
r,
e
]);
}
}
if (this.#u.clear(), this.#f.fill(void 0), this.#d.fill(void 0), this.#x && this.#b) {
this.#x.fill(0), this.#b.fill(0);
for (let e of this.#S ?? []) e !== void 0 && clearTimeout(e);
this.#S?.fill(void 0);
}
if (this.#y && this.#y.fill(0), this.#h = 0, this.#g = 0, this.#_.length = 0, this.#l = 0, this.#c = 0, this.#T && this.#v) {
let e = this.#v, t;
for (; t = e?.shift();) this.#i?.(...t);
}
}
};
})), kn = /* @__PURE__ */ i(((e, t) => {
var n = (...e) => e.every((e) => e) ? e.join("") : "", r = (e) => e ? encodeURIComponent(e) : "", i = (e) => e.toLowerCase().replace(/^\W+/g, "").replace(/(?<!\W)\W+$/, "").replace(/\//g, "").replace(/\W+/g, "-"), a = {
sshtemplate: ({ domain: e, user: t, project: r, committish: i }) => `git@${e}:${t}/${r}.git${n("#", i)}`,
sshurltemplate: ({ domain: e, user: t, project: r, committish: i }) => `git+ssh://git@${e}/${t}/${r}.git${n("#", i)}`,
edittemplate: ({ domain: e, user: t, project: i, committish: a, editpath: o, path: s }) => `https://${e}/${t}/${i}${n("/", o, "/", r(a || "HEAD"), "/", s)}`,
browsetemplate: ({ domain: e, user: t, project: i, committish: a, treepath: o }) => `https://${e}/${t}/${i}${n("/", o, "/", r(a))}`,
browsetreetemplate: ({ domain: e, user: t, project: i, committish: a, treepath: o, path: s, fragment: c, hashformat: l }) => `https://${e}/${t}/${i}/${o}/${r(a || "HEAD")}/${s}${n("#", l(c || ""))}`,
browseblobtemplate: ({ domain: e, user: t, project: i, committish: a, blobpath: o, path: s, fragment: c, hashformat: l }) => `https://${e}/${t}/${i}/${o}/${r(a || "HEAD")}/${s}${n("#", l(c || ""))}`,
docstemplate: ({ domain: e, user: t, project: i, treepath: a, committish: o }) => `https://${e}/${t}/${i}${n("/", a, "/", r(o))}#readme`,
httpstemplate: ({ auth: e, domain: t, user: r, project: i, committish: a }) => `git+https://${n(e, "@")}${t}/${r}/${i}.git${n("#", a)}`,
filetemplate: ({ domain: e, user: t, project: n, committish: i, path: a }) => `https://${e}/${t}/${n}/raw/${r(i || "HEAD")}/${a}`,
shortcuttemplate: ({ type: e, user: t, project: r, committish: i }) => `${e}:${t}/${r}${n("#", i)}`,
pathtemplate: ({ user: e, project: t, committish: r }) => `${e}/${t}${n("#", r)}`,
bugstemplate: ({ domain: e, user: t, project: n }) => `https://${e}/${t}/${n}/issues`,
hashformat: i
}, o = {};
o.github = {
protocols: [
"git:",
"http:",
"git+ssh:",
"git+https:",
"ssh:",
"https:"
],
domain: "github.com",
treepath: "tree",
blobpath: "blob",
editpath: "edit",
filetemplate: ({ auth: e, user: t, project: i, committish: a, path: o }) => `https://${n(e, "@")}raw.githubusercontent.com/${t}/${i}/${r(a || "HEAD")}/${o}`,
gittemplate: ({ auth: e, domain: t, user: r, project: i, committish: a }) => `git://${n(e, "@")}${t}/${r}/${i}.git${n("#", a)}`,
tarballtemplate: ({ domain: e, user: t, project: n, committish: i }) => `https://codeload.${e}/${t}/${n}/tar.gz/${r(i || "HEAD")}`,
extract: (e) => {
let [, t, n, r, i] = e.pathname.split("/", 5);
if (!(r && r !== "tree") && (r || (i = e.hash.slice(1)), n && n.endsWith(".git") && (n = n.slice(0, -4)), !(!t || !n))) return {
user: t,
project: n,
committish: i
};
}
}, o.bitbucket = {
protocols: [
"git+ssh:",
"git+https:",
"ssh:",
"https:"
],
domain: "bitbucket.org",
treepath: "src",
blobpath: "src",
editpath: "?mode=edit",
edittemplate: ({ domain: e, user: t, project: i, committish: a, treepath: o, path: s, editpath: c }) => `https://${e}/${t}/${i}${n("/", o, "/", r(a || "HEAD"), "/", s, c)}`,
tarballtemplate: ({ domain: e, user: t, project: n, committish: i }) => `https://${e}/${t}/${n}/get/${r(i || "HEAD")}.tar.gz`,
extract: (e) => {
let [, t, n, r] = e.pathname.split("/", 4);
if (!["get"].includes(r) && (n && n.endsWith(".git") && (n = n.slice(0, -4)), !(!t || !n))) return {
user: t,
project: n,
committish: e.hash.slice(1)
};
}
}, o.gitlab = {
protocols: [
"git+ssh:",
"git+https:",
"ssh:",
"https:"
],
domain: "gitlab.com",
treepath: "tree",
blobpath: "tree",
editpath: "-/edit",
tarballtemplate: ({ domain: e, user: t, project: n, committish: i }) => `https://${e}/api/v4/projects/${r(t + "/" + n)}/repository/archive.tar.gz?sha=${r(i || "HEAD")}`,
extract: (e) => {
let t = e.pathname.slice(1);
if (t.includes("/-/") || t.includes("/archive.tar.gz")) return;
let n = t.split("/"), r = n.pop();
r.endsWith(".git") && (r = r.slice(0, -4));
let i = n.join("/");
if (!(!i || !r)) return {
user: i,
project: r,
committish: e.hash.slice(1)
};
}
}, o.gist = {
protocols: [
"git:",
"git+ssh:",
"git+https:",
"ssh:",
"https:"
],
domain: "gist.github.com",
editpath: "edit",
sshtemplate: ({ domain: e, project: t, committish: r }) => `git@${e}:${t}.git${n("#", r)}`,
sshurltemplate: ({ domain: e, project: t, committish: r }) => `git+ssh://git@${e}/${t}.git${n("#", r)}`,
edittemplate: ({ domain: e, user: t, project: i, committish: a, editpath: o }) => `https://${e}/${t}/${i}${n("/", r(a))}/${o}`,
browsetemplate: ({ domain: e, project: t, committish: i }) => `https://${e}/${t}${n("/", r(i))}`,
browsetreetemplate: ({ domain: e, project: t, committish: i, path: a, hashformat: o }) => `https://${e}/${t}${n("/", r(i))}${n("#", o(a))}`,
browseblobtemplate: ({ domain: e, project: t, committish: i, path: a, hashformat: o }) => `https://${e}/${t}${n("/", r(i))}${n("#", o(a))}`,
docstemplate: ({ domain: e, project: t, committish: i }) => `https://${e}/${t}${n("/", r(i))}`,
httpstemplate: ({ domain: e, project: t, committish: r }) => `git+https://${e}/${t}.git${n("#", r)}`,
filetemplate: ({ user: e, project: t, committish: i, path: a }) => `https://gist.githubusercontent.com/${e}/${t}/raw${n("/", r(i))}/${a}`,
shortcuttemplate: ({ type: e, project: t, committish: r }) => `${e}:${t}${n("#", r)}`,
pathtemplate: ({ project: e, committish: t }) => `${e}${n("#", t)}`,
bugstemplate: ({ domain: e, project: t }) => `https://${e}/${t}`,
gittemplate: ({ domain: e, project: t, committish: r }) => `git://${e}/${t}.git${n("#", r)}`,
tarballtemplate: ({ project: e, committish: t }) => `https://codeload.github.com/gist/${e}/tar.gz/${r(t || "HEAD")}`,
extract: (e) => {
let [, t, n, r] = e.pathname.split("/", 4);
if (r !== "raw") {
if (!n) {
if (!t) return;
n = t, t = null;
}
return n.endsWith(".git") && (n = n.slice(0, -4)), {
user: t,
project: n,
committish: e.hash.slice(1)
};
}
},
hashformat: function(e) {
return e && "file-" + i(e);
}
}, o.sourcehut = {
protocols: ["git+ssh:", "https:"],
domain: "git.sr.ht",
treepath: "tree",
blobpath: "tree",
filetemplate: ({ domain: e, user: t, project: n, committish: i, path: a }) => `https://${e}/${t}/${n}/blob/${r(i) || "HEAD"}/${a}`,
httpstemplate: ({ domain: e, user: t, project: r, committish: i }) => `https://${e}/${t}/${r}${n("#", i)}`,
tarballtemplate: ({ domain: e, user: t, project: n, committish: i }) => `https://${e}/${t}/${n}/archive/${r(i) || "HEAD"}.tar.gz`,
bugstemplate: () => null,
extract: (e) => {
let [, t, n, r] = e.pathname.split("/", 4);
if (!["archive"].includes(r) && (n && n.endsWith(".git") && (n = n.slice(0, -4)), !(!t || !n))) return {
user: t,
project: n,
committish: e.hash.slice(1)
};
}
};
for (let [e, t] of Object.entries(o)) o[e] = Object.assign({}, a, t);
t.exports = o;
})), An = /* @__PURE__ */ i(((e, t) => {
var n = (e, t, n) => {
let r = e.indexOf(n);
return e.lastIndexOf(t, r > -1 ? r : Infinity);
}, r = (e) => {
try {
return new URL(e);
} catch {}
}, i = (e, t) => {
let n = e.indexOf(":"), r = e.slice(0, n + 1);
if (Object.prototype.hasOwnProperty.call(t, r) || e.substr(n, 3) === "://") return e;
let i = e.indexOf("@");
return i > -1 ? i > n ? `git+ssh://${e}` : e : `${e.slice(0, n + 1)}//${e.slice(n + 1)}`;
}, a = (e) => {
let t = n(e, "@", "#"), r = n(e, ":", "#");
return r > t && (e = e.slice(0, r) + "/" + e.slice(r + 1)), n(e, ":", "#") === -1 && e.indexOf("//") === -1 && (e = `git+ssh://${e}`), e;
};
t.exports = (e, t) => {
let n = t ? i(e, t) : e;
return r(n) || r(a(n));
};
})), jn = /* @__PURE__ */ i(((e, t) => {
var n = An(), r = (e) => {
let t = e.indexOf("#"), n = e.indexOf("/"), r = e.indexOf("/", n + 1), i = e.indexOf(":"), a = /\s/.exec(e), o = e.indexOf("@"), s = !a || t > -1 && a.index > t, c = o === -1 || t > -1 && o > t, l = i === -1 || t > -1 && i > t, u = r === -1 || t > -1 && r > t, d = n > 0, f = t > -1 ? e[t - 1] !== "/" : !e.endsWith("/"), p = !e.startsWith(".");
return s && d && f && p && c && l && u;
};
t.exports = (e, t, { gitHosts: i, protocols: a }) => {
if (!e) return;
let o = n(r(e) ? `github:${e}` : e, a);
if (!o) return;
let s = i.byShortcut[o.protocol], c = i.byDomain[o.hostname.startsWith("www.") ? o.hostname.slice(4) : o.hostname], l = s || c;
if (!l) return;
let u = i[s || c], d = null;
a[o.protocol]?.auth && (o.username || o.password) && (d = `${o.username}${o.password ? ":" + o.password : ""}`);
let f = null, p = null, m = null, h = null;
try {
if (s) {
let e = o.pathname.startsWith("/") ? o.pathname.slice(1) : o.pathname, t = e.indexOf("@");
t > -1 && (e = e.slice(t + 1));
let n = e.lastIndexOf("/");
n > -1 ? (p = decodeURIComponent(e.slice(0, n)), p ||= null, m = decodeURIComponent(e.slice(n + 1))) : m = decodeURIComponent(e), m.endsWith(".git") && (m = m.slice(0, -4)), o.hash && (f = decodeURIComponent(o.hash.slice(1))), h = "shortcut";
} else {
if (!u.protocols.includes(o.protocol)) return;
let e = u.extract(o);
if (!e) return;
p = e.user && decodeURIComponent(e.user), m = decodeURIComponent(e.project), f = decodeURIComponent(e.committish), h = a[o.protocol]?.name || o.protocol.slice(0, -1);
}
} catch (e) {
/* istanbul ignore else */
if (e instanceof URIError) return;
throw e;
}
return [
l,
p,
d,
m,
f,
h,
t
];
};
})), Mn = /* @__PURE__ */ i(((e, t) => {
var { LRUCache: n } = On(), r = kn(), i = jn(), a = An(), o = new n({ max: 1e3 });
function s(e) {
try {
let { protocol: t, hostname: n, pathname: r } = new URL(e);
return n ? `${/(?:git\+)http:$/.test(t) ? "http:" : "https:"}//${n}${r.replace(/\.git$/, "")}` : null;
} catch {
return null;
}
}
var c = class e {
constructor(t, n, r, i, a, o, s = {}) {
Object.assign(this, e.#e[t], {
type: t,
user: n,
auth: r,
project: i,
committish: a,
default: o,
opts: s
});
}
static #e = {
byShortcut: {},
byDomain: {}
};
static #t = {
"git+ssh:": { name: "sshurl" },
"ssh:": { name: "sshurl" },
"git+https:": {
name: "https",
auth: !0
},
"git:": { auth: !0 },
"http:": { auth: !0 },
"https:": { auth: !0 },
"git+http:": { auth: !0 }
};
static addHost(t, n) {
e.#e[t] = n, e.#e.byDomain[n.domain] = t, e.#e.byShortcut[`${t}:`] = t, e.#t[`${t}:`] = { name: t };
}
static fromUrl(t, n) {
if (typeof t != "string") return;
let r = t + JSON.stringify(n || {});
if (!o.has(r)) {
let a = i(t, n, {
gitHosts: e.#e,
protocols: e.#t
});
o.set(r, a ? new e(...a) : void 0);
}
return o.get(r);
}
static fromManifest(t, n = {}) {
if (!t || typeof t != "object") return;
let r = t.repository, i = r && (typeof r == "string" ? r : typeof r == "object" && typeof r.url == "string" ? r.url : null);
if (!i) throw Error("no repository");
let a = i && e.fromUrl(i.replace(/^git\+/, ""), n) || null;
if (a) return a;
let o = s(i);
return e.fromUrl(o, n) || o;
}
static parseUrl(e) {
return a(e);
}
#n(e, t) {
if (typeof e != "function") return null;
let n = {
...this,
...this.opts,
...t
};
n.path ||= "", n.path.startsWith("/") && (n.path = n.path.slice(1)), n.noCommittish && (n.committish = null);
let r = e(n);
return n.noGitPlus && r.startsWith("git+") ? r.slice(4) : r;
}
hash() {
return this.committish ? `#${this.committish}` : "";
}
ssh(e) {
return this.#n(this.sshtemplate, e);
}
sshurl(e) {
return this.#n(this.sshurltemplate, e);
}
browse(e, ...t) {
return typeof e == "string" ? typeof t[0] == "string" ? this.#n(this.browsetreetemplate, {
...t[1],
fragment: t[0],
path: e
}) : this.#n(this.browsetreetemplate, {
...t[0],
path: e
}) : this.#n(this.browsetemplate, e);
}
browseFile(e, ...t) {
return typeof t[0] == "string" ? this.#n(this.browseblobtemplate, {
...t[1],
fragment: t[0],
path: e
}) : this.#n(this.browseblobtemplate, {
...t[0],
path: e
});
}
docs(e) {
return this.#n(this.docstemplate, e);
}
bugs(e) {
return this.#n(this.bugstemplate, e);
}
https(e) {
return this.#n(this.httpstemplate, e);
}
git(e) {
return this.#n(this.gittemplate, e);
}
shortcut(e) {
return this.#n(this.shortcuttemplate, e);
}
path(e) {
return this.#n(this.pathtemplate, e);
}
tarball(e) {
return this.#n(this.tarballtemplate, {
...e,
noCommittish: !1
});
}
file(e, t) {
return this.#n(this.filetemplate, {
...t,
path: e
});
}
edit(e, t) {
return this.#n(this.edittemplate, {
...t,
path: e
});
}
getDefaultRepresentation() {
return this.default;
}
toString(e) {
return this.default && typeof this[this.default] == "function" ? this[this.default](e) : this.sshurl(e);
}
};
for (let [e, t] of Object.entries(r)) c.addHost(e, t);
t.exports = c;
})), Nn = /* @__PURE__ */ n(Mn(), 1);
async function Pn(e, { pkgFile: t } = {}) {
return (await Dn(e, { pkgFile: t }))?.repository ?? null;
}
async function Fn(e, t, { pkgFile: n } = {}) {
let r = t ? t.repository ? t.repository : null : await Pn(e, { pkgFile: n });
if (!r) return null;
let i, a = "";
if (typeof r == "string") {
i = r;
try {
let e = new h(i);
if (e.protocol === "https:" || e.protocol === "http:") return i;
} catch {}
} else typeof r.url == "string" && (i = r.url, typeof r.directory == "string" && (a = r.directory));
if (typeof i == "string" && typeof a == "string") {
let e = Nn.default.fromUrl(i)?.browse(a);
return e === void 0 ? i : e.replace(/\/$/, "").replace(/\/tree\/HEAD$/, "");
}
return null;
}
//#endregion
//#region src/lib/isPackageManagerProtocol.ts
function In(e) {
return e.startsWith("file:") || e.startsWith("link:") || e.startsWith("workspace:") || e.startsWith("catalog:") || e.startsWith("portal:");
}
//#endregion
//#region src/lib/isFetchable.ts
function Ln(e) {
return !In(e) && !/^[^/:@]+\/\w+/.test(e);
}
//#endregion
//#region src/lib/parseCooldown.ts
var Rn = /^(\d+(?:\.\d+)?)(d|h|m)$/;
function zn(e) {
let t = e.match(Rn);
if (!t) return null;
let n = parseFloat(t[1]), r = t[2];
return r === "d" ? n : r === "h" ? n / 24 : n / 1440;
}
//#endregion
//#region node_modules/parse-github-url/parse-url.js
var Bn = /* @__PURE__ */ i(((t, n) => {
var r = e("url"), i = typeof URL > "u" ? r.URL || null : URL, a = i ? null : r.parse;
function o(e) {
try {
var t = new i(e), n = null;
t.username && (n = t.password ? t.username + ":" + t.password : t.username);
var r = t.host || null, a = t.hostname || null, o = t.pathname || null, s = t.pathname + (t.search || "") || null;
if (!r && o && e.indexOf("//") === -1) {
var c = o.indexOf("/");
c === -1 ? (r = o, a = o, o = null, s = null) : (r = o.slice(0, c), a = r, o = o.slice(c), s = o + (t.search || ""));
}
return {
auth: n,
hash: t.hash || null,
host: r,
hostname: a,
href: t.href,
path: s,
pathname: o,
port: t.port || null,
protocol: t.protocol || null,
query: t.search ? t.search.slice(1) : null,
search: t.search || null,
slashes: e.indexOf("//") !== -1 || null
};
} catch {
var l = e.indexOf("#"), u = l === -1 ? null : e.slice(l), d = l === -1 ? e : e.slice(0, l), f = d.indexOf("?"), p = f === -1 ? null : d.slice(f), m = f === -1 ? d : d.slice(0, f);
return {
auth: null,
hash: u,
host: null,
hostname: null,
href: e,
path: d || null,
pathname: m || null,
port: null,
protocol: null,
query: p ? p.slice(1) : null,
search: p,
slashes: null
};
}
}
n.exports = i ? o : a;
})), Vn = /* @__PURE__ */ n((/* @__PURE__ */ i(((e, t) => {
var n = Bn(), r = { __proto__: null };
function i(e) {
return /^[a-f0-9]{40}$/i.test(e);
}
function a(e, t) {
var n = e.split("#"), r;
return n.length > 1 && (r = n[n.length - 1]), !r && t.hash && t.hash.charAt(0) === "#" && (r = t.hash.slice(1)), r || "master";
}
function o(e) {
return e.charAt(0) === "/" ? e.slice(1) : e;
}
function s(e) {
return e ? e.replace(/\.git$/, "") : null;
}
function c(e) {
if (!e) return null;
var t = e.indexOf(":");
return t > -1 ? e.slice(t + 1) : e;
}
function l(e) {
return n("http://" + e.replace(/git@([^:]+):/, "$1/")).host || null;
}
function u(e) {
if (typeof e != "string" || !e.length || e.indexOf("git@gist") !== -1 || e.indexOf("//gist") !== -1) return null;
var t = n(e);
if (typeof t.path != "string" || !t.path.length || typeof t.pathname != "string" || !t.pathname.length) return null;
!t.host && /^git@/.test(e) === !0 && (t.host = l(e)), t.path = o(t.path), t.pathname = o(t.pathname), t.filepath = null, t.path.indexOf("repos") === 0 && (t.path = t.path.slice(6));
var r = t.path.split("/").filter(Boolean), u = r[2] === "blob";
u && !i(r[3]) && (t.branch = r[3], r.length > 4 && (t.filepath = r.slice(4).join("/")));
var d = e.indexOf("blob");
u && d !== -1 && (t.blob = e.slice(d + 5));
var f = r[2] === "tree", p = e.indexOf("tree");
if (f && p !== -1) {
var m = p + 5, h = e.slice(m), g = h.indexOf("/");
g !== -1 && (h = h.slice(0, g)), t.branch = h;
}
if (t.owner = c(r[0]), t.name = s(r[1]), r.length > 1 && t.owner && t.name) t.repo = t.owner + "/" + t.name;
else {
var _ = t.href.split(":");
if (_.length === 2 && t.href.indexOf("//") === -1) {
t.repo = t.repo || _[_.length - 1];
var v = t.repo.split("/");
t.owner = v[0], t.name = v[1];
} else {
var y = t.href.match(/\/([^/]*)$/);
t.owner = y ? y[1] : null, t.repo = null;
}
if (t.repo && (!t.owner || !t.name)) {
var b = t.repo.split("/");
b.length === 2 && (t.owner = b[0], t.name = b[1]);
}
}
return t.branch || (t.branch = r[2] || a(t.path, t), r.length > 3 && (t.filepath = r.slice(3).join("/"))), t.host = t.host || "github.com", t.owner = t.owner || null, t.name = t.name || null, t.repository = t.repo, t;
}
t.exports = function(e) {
return r[e] || (r[e] = u(e)), r[e];
};
})))(), 1);
function Hn(e) {
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
//#endregion
//#region src/lib/sortBy.ts
function Un(e, t) {
return e ? e.map((e) => ({
item: e,
key: t(e)
})).sort((e, t) => e.key > t.key ? 1 : e.key < t.key ? -1 : 0).map(({ item: e }) => e) : [];
}
//#endregion
//#region src/lib/version-util.ts
var Wn = [
"major",
"minor",
"patch"
], Gn = ["release", "build"], Kn = [...Wn, ...Gn], qn = {
major: "",
minor: ".",
patch: ".",
release: "-",
build: "+"
}, Jn = [
"^",
"~",
".*",
".x"
], Yn = RegExp(`^(${[
"^",
"~",
"^*",
"*",
"x",
"x.x",
"x.x.x"
].map(Hn).join("|")})$`), Xn = /^npm:(.*)@(.*)/;
function Zn(e) {
let [t] = pe.default.parseRange(e);
if (!t) throw Error(l("semverutils.parseRange returned null when trying to parse \"%s\". This is probably a problem with the \"semver-utils\" dependency. Please report an issue at https://github.com/raineorshine/npm-check-updates/issues.", e));
return Kn.reduce((e, n) => t[n] ? e + 1 : e, 0);
}
function Qn(e, t) {
return (t ? Kn.slice(0, Kn.indexOf(t) + 1) : Kn).filter((n) => t && Wn.includes(t) || e[n]).map((t) => qn[t] + (e[t] || "0")).join("");
}
function $n(e) {
let [t] = pe.default.parseRange(e);
return Kn.slice().reverse().find((e) => t?.[e]);
}
function er(e, t) {
let [n] = pe.default.parseRange(e);
return Qn(n, t);
}
function tr(e, t) {
return t === "^" || t === "~" ? t + e : er(e, "major") + t;
}
function nr(e) {
return Yn.test(e);
}
function rr(e) {
return e === "*" || e === "x";
}
var ir = (e) => e.replace(/^[~^<>=]+/, ""), ar = 20, or = (e) => {
let t = e.match(/\+(\S+)$/)?.[1];
return !t || t.length <= ar ? e : e.slice(0, e.length - t.length) + t.slice(0, ar) + "...";
};
function sr(e, t) {
if (e === t) return "none";
t = ir(t), e = ir(e);
let n = t.split("."), r = e.split("."), i = n.findIndex((e, t) => e !== r[t]);
return i = i >= 0 ? i : n.length, n[0] === "0" ? "majorVersionZero" : i === 0 ? "major" : i === 1 ? "minor" : "patch";
}
function cr(e, t, n) {
let r = J(e, (r, i, a) => {
let o = t[r], s = sr(o, i), c = n.groupFunction?.(r, s, (0, pe.parseRange)(o), (0, pe.parseRange)(i), (0, pe.parse)(e[r])) ?? s;
return c === "none" ? a : {
...a,
[c]: {
...a[c],
[r]: i
}
};
}), i = {
patch: Y.green(Y.bold("Patch") + " Backwards-compatible bug fixes"),
minor: Y.cyan(Y.bold("Minor") + " Backwards-compatible features"),
major: Y.red(Y.bold("Major") + " Potentially breaking API changes"),
majorVersionZero: Y.magenta(Y.bold("Major version zero") + " Anything may change")
};
return Array.from(/* @__PURE__ */ new Set([
"patch",
"minor",
"major",
"majorVersionZero",
...Object.keys(r).sort()
])).filter((e) => e in r).map((e) => ({
groupName: e,
heading: e in i ? i[e] : e,
packages: r[e]
}));
}
function lr(e, t) {
let n = "";
/^[~^]/.test(t) && (n = t[0], t = t.slice(1));
let r = t.split("."), i = ir(e).split("."), a = ir(t).split("."), o = a.findIndex((e, t) => e !== i[t]);
o = o >= 0 ? o : a.length;
let s = o === 0 || a[0] === "0" ? "red" : o === 1 ? "cyan" : "green", c = o > 0 && o < r.length ? "." : "";
return n + r.slice(0, o).join(".") + c + Y[s](r.slice(o).join("."));
}
var ur = (e) => {
let t = G.default.prerelease(e);
return t && t.slice(0, -1).join(".");
};
function dr(e, t) {
let n = ur(e), r = ur(t);
return typeof n != "string" || typeof r != "string" || n === r;
}
function fr(e, t) {
return (G.default.valid(e) && G.default.valid(t) ? G.default.gt(e, t) : e > t) ? 1 : e === t ? 0 : -1;
}
function pr(e, t, n) {
let r = G.default.parse(e);
return r && (n === "major" || r.major === t?.major) && (n === "major" || n === "minor" || r.minor === t?.minor);
}
function mr(e, t, n) {
if (!G.default.validRange(t)) return null;
let r = G.default.minVersion(t);
return [...e].sort(fr).filter((e) => pr(e, r, n)).at(-1) || null;
}
function hr(e, t) {
if (!G.default.validRange(e)) return () => !1;
let n = G.default.minVersion(e);
return (e) => pr(e, n, t);
}
function gr(e) {
return (t) => G.default.satisfies(t, e);
}
function _r(e) {
return $n(e) === "release";
}
var vr = (e) => /^[vV]?\d+$/.test(e), yr = (e) => /^[vV]?\d+\.\d+$/.test(e), br = (e) => e.replace(/^[vV]/, ""), xr = (e) => vr(e) ? e + ".0.0" : e, Sr = (e) => yr(e) ? e + ".0" : e, Cr = (e) => Sr(xr(br(e)));
function wr(e) {
return e && (e[0] === "v" || e[1] === "v") ? "v" : "";
}
var Tr = (e, t) => `npm:${e}@${t}`, Er = (e) => {
let t = e && e.match && e.match(Xn);
return t && t.slice(1);
}, Dr = (e) => e && !!e.match(Xn), Or = (e, t) => {
let n = Er(e);
return n ? Tr(n[0], t) : null;
}, kr = (e) => {
if (!e) return !1;
let t = null;
try {
t = (0, Vn.default)(e);
} catch {}
if (!t || !t.branch) return !1;
let n = decodeURIComponent(t.branch).replace(/^semver:/, "");
return !!G.default.validRange(n);
}, Ar = (e) => {
if (!e) return null;
let t = (0, Vn.default)(e);
if (!t || !t.branch) return null;
let n = decodeURIComponent(t.branch).replace(/^semver:/, "");
return t && t.branch && G.default.validRange(n) ? n : null;
};
function jr(e, t, n = {}) {
if (n.wildcard = n.wildcard || "^", !t) return e;
let [r] = pe.default.parseRange(t);
if (!r) return e;
if (n.removeRange) return t;
if (nr(e)) return e;
let i = Un(pe.default.parseRange(e).filter((e) => e.operator !== "||" && e.operator !== "-"), (e) => Zn(Qn(e))), [a] = i, o = i.find((e) => e.operator === "<" || e.operator === "<="), s = i.find((e) => e.operator === "^" || e.operator === "~");
if (o && s && G.default.valid(t) && G.default.satisfies(t, e)) return `${jr(s.semver, t, n)} ${o.semver}`;
function c(e) {
return (rr(a[e]) ? a[e] : Wn.includes(e) && a[e] || Gn.includes(e) ? r[e] : null) || null;
}
let l = Qn(J(Kn, (e) => ({ [e]: c(e) }))), u = wr(a.semver) + l, d = Array.from(new Set(i.map((e) => e.operator))), f = d[0] || "", p = Jn.some((e) => l.includes(e)), m = d[0] === "<" || d[0] === "<=", h = d[0] === ">", g = d.length > 1;
return !p && (m || g) ? tr(u, n.wildcard) : (h ? ">=" : f) + u;
}
var Mr = (e, t) => {
let n = wr(e), r = n ? n + t : t;
return r = vr(e) ? r.slice(0, r.length - 4) : r, r = yr(e) ? r.slice(0, r.length - 2) : r, r;
}, Nr = (e, t) => {
let n = Cr(t), r = (0, Vn.default)(e);
if (!r) return e;
let i = decodeURIComponent(r.branch).replace(/^semver:/, ""), a = jr(i, Mr(i, n)), o = e.indexOf("#");
return o === -1 ? e.replace(i, a) : e.slice(0, o) + e.slice(o).replace(i, a);
}, Pr = (e) => e[0] === "^" || e[0] === "~" ? e[0] : "", Fr = {
silent: 0,
error: 1,
minimal: 2,
warn: 3,
info: 4,
verbose: 5,
silly: 6
};
function X(e, t, n = null, r = "log") {
!e.json && e.loglevel !== "silent" && (n == null || Fr[e.loglevel ?? "warn"] >= Fr[n]) && console[r](t);
}
function Ir(e, t) {
e.loglevel !== "silent" && console.log(JSON.stringify(t, null, 2));
}
function Lr(e, t) {
console.log(Object.keys(e).map((t) => t + "@" + e[t]).join(t));
}
function Rr(e, t, n) {
X(e, Object.keys(t).sort().reduce((e, n) => (e[n] = t[n], e), {}), n);
}
function zr(e) {
return f(e).replace(/[\u0000-\u001f\u007f-\u009f]/g, "");
}
function Br(e) {
let t = new Ot.default({
colAligns: [
"left",
"right",
"right",
"right",
"left",
"left"
],
chars: {
top: "",
"top-mid": "",
"top-left": "",
"top-right": "",
bottom: "",
"bottom-mid": "",
"bottom-left": "",
"bottom-right": "",
left: "",
"left-mid": "",
mid: "",
"mid-mid": "",
right: "",
"right-mid": "",
middle: ""
}
});
return t.push(...e), t.toString().split("\n").map((e) => e.trimEnd()).join("\n");
}
function Vr(e) {
return kr(e) ? Ar(e) : Dr(e) ? Er(e)[1] : e;
}
function Hr(e) {
if (e === void 0 || typeof e == "function") return "cooldown";
let t = String(e).trim().toLowerCase(), n = t.match(Rn), r = Number(n ? n[1] : t);
if (isNaN(r)) return "cooldown";
let i = n ? {
d: "day",
h: "hour",
m: "minute"
}[n[2]] : "day";
return `${+r.toFixed(1)}-${i} cooldown`;
}
async function Ur({ from: e, to: t, skippedByCooldown: n, format: r, ownersChangedDeps: i, pkgFile: a, time: o }) {
let c = r?.includes("dep") && a ? JSON.parse(await s.readFile(a, "utf-8")) : null, l = Object.keys(n || {}).length > 0;
return Br(await Promise.all(Object.keys(t).sort().map(async (s) => {
let u = r?.includes("installedVersion") || r?.includes("homepage") || r?.includes("repo") ? await Dn(s, { pkgFile: a }) : null, d = (r?.includes("installedVersion") ? u?.version : e[s]) || "", f = s in (c?.devDependencies ?? {}) ? "dev" : s in (c?.peerDependencies ?? {}) ? "peer" : s in (c?.optionalDependencies ?? {}) ? "optional" : "", p = Vr(t[s] || ""), m = i ? s in i ? i[s] ? "*owner changed*" : "" : "*unknown*" : "", h = lr(Vr(d), or(p)), g = r?.includes("homepage") ? zr(u?.homepage || "") : "", _ = r?.includes("repo") ? zr(await Fn(s, u ?? void 0, { pkgFile: a }) || "") : "", v = r?.includes("diff") ? `${process.env.NCU_DIFF || "https://npmdiff.dev"}/${encodeURIComponent(s)}/${d.replace(/^\W+/, "")}/${p.replace(/^\W+/, "")}` : "", y = r?.includes("cooldown"), b = r?.includes("time"), x = (b || y) && !o?.[s] ? "[missing time]" : "", S = b && o?.[s] ? o[s] : null, C = S ? wn(S) : b || !l ? x : "", w = n?.[s]?.version, T = "";
if (w) {
let e = Pr(p), t = G.default.coerce(w);
T = `[cooldown] ${lr(p, e + Vr(t && !w.endsWith(t.version) ? `${t.version}-+` : w)).replace(e, "")}`;
} else y && !b && (T = x);
return [
s,
...r?.includes("dep") ? [f ? Y.gray(f) : ""] : [],
or(d),
"→",
h,
...l ? [T] : [],
m,
...[
g,
_,
v,
C
].filter((e) => e)
];
})));
}
async function Wr({ skippedByCooldown: e, pkgFile: t, options: n }) {
let r = n.format;
if (!e || !r?.includes("cooldown") || r?.includes("lines")) return;
let i = {}, a = {}, o = {};
for (let t of Object.values(e)) {
let { name: e, version: n, currentVersion: r, fallbackVersion: s, time: c } = t;
if (!Ln(r) || !n) continue;
let l = Pr(r), u = l + ir(s ?? r), d = l + ir(n);
i[e] = u, a[e] = lr(u, d), o[e] = c || "";
}
if (!Object.keys(i).length) return !1;
let s = await Ur({
from: i,
to: a,
format: r.includes("time") ? r : [...r, "time"],
pkgFile: t || void 0,
time: o
}), c = n.raw?.cooldown ?? n.cooldown;
return X(n, "\n" + Y.yellow(Y.bold(`Skipped due to ${Hr(c)}`))), X(n, s), !0;
}
async function Gr({ current: e, upgraded: t, skippedByCooldown: n, ownersChangedDeps: r, pkgFile: i, time: a }, o) {
if (o.format?.includes("group")) {
let s = cr(t, e, o), c = await Promise.all(s.map(async ({ heading: t, packages: s }) => ({
heading: t,
table: await Ur({
from: e,
to: s,
skippedByCooldown: n,
format: o.format,
ownersChangedDeps: r,
pkgFile: i,
time: a
})
})));
for (let { heading: e, table: t } of c) X(o, "\n" + e), X(o, t);
} else o.format?.includes("lines") ? Lr(t, "\n") : X(o, await Ur({
from: e,
to: t,
skippedByCooldown: n,
format: o.format,
ownersChangedDeps: r,
pkgFile: i,
time: a
}));
}
function Kr(e, t) {
if (t && Object.keys(t).length > 0) {
let n = new Ot.default({
colAligns: [
"left",
"right",
"right",
"right",
"left",
"left"
],
chars: {
top: "",
"top-mid": "",
"top-left": "",
"top-right": "",
bottom: "",
"bottom-mid": "",
"bottom-left": "",
"bottom-right": "",
left: "",
"left-mid": "",
mid: "",
"mid-mid": "",
right: "",
"right-mid": "",
middle: ""
}
});
n.push(...Object.entries(t).map(([e, t]) => [e, Y.yellow(zr(t))])), X(e, "\n" + n.toString());
}
}
async function qr(e, { current: t, latest: n, upgraded: r, skippedByCooldown: i, total: a, numCooldown: o, ownersChangedDeps: s, pkgFile: c, time: l, errors: u }) {
let d = Object.keys(r).length, f = await Wr({
skippedByCooldown: i,
pkgFile: c,
options: e
});
!e.deep && !e.format?.includes("group") && (f && d ? X(e, "\n" + Y.blue(Y.bold("Updates"))) : X(e, ""));
let p = Y.green.bold(":)"), m = Object.keys(u || {}).length, h = typeof e.target == "string" ? e.target : "target";
d === 0 && a === 0 && m === 0 ? Object.keys(t).length === 0 ? X(e, "No dependencies.") : n && Object.keys(n).length === 0 && !o && Object.values(bn(t, (e, t) => Ln(t))).length > 0 ? X(e, `No package versions were returned. This may be a problem with your installed ${e.packageManager}, the npm registry, or your Internet connection. Make sure ${Y.cyan("npx pacote packument ncu-test-v2")} is working before reporting an issue.`) : e.global ? X(e, `All global packages are up-to-date ${p}`) : X(e, `All dependencies ${o ? "not in cooldown " : ""}match the ${h} package versions ${p}`) : d === 0 && a > 0 ? X(e, `No dependencies upgraded ${p}`) : d > 0 && await Gr({
current: t,
upgraded: r,
skippedByCooldown: i,
ownersChangedDeps: s,
pkgFile: c,
time: l
}, e), Kr(e, u);
}
function Jr(e, t) {
X(e, "\nIgnored incompatible updates (peer dependencies):\n"), X(e, Br(Object.entries(t).map(([e, { from: t, to: n, reason: r }]) => {
let i = zr("reason: " + Object.entries(r).map(([e, t]) => e + " requires " + t).join(", "));
return [
e,
t,
"→",
lr(t, n),
i
];
})));
}
function Yr(e, t) {
X(e, "\nIgnored incompatible updates (engines node):\n"), X(e, Br(Object.entries(t).map(([e, { from: t, to: n, enginesNode: r }]) => [
e,
t,
"→",
lr(t, n),
`reason: requires node ${zr(r)}`
])));
}
function Xr(e, t = 10) {
return e.schema !== 1 || typeof e.timestamp == "number" && e.timestamp + t * 6e4 < Date.now();
}
var Zr = ".ncu-cache.json", Qr = `~/${Zr}`, $r = o.join(c.homedir(), Zr);
function ei(e) {
return e === Qr ? $r : e;
}
async function ti(e) {
e.cacheFile && await s.rm(ei(e.cacheFile), { force: !0 });
}
async function ni(e) {
if (!e.cache || !e.cacheFile) return;
let t = ei(e.cacheFile), n = /* @__PURE__ */ new Set(), r = {
schema: 1,
timestamp: Date.now(),
packages: {},
peers: {}
};
try {
let n = await s.readFile(t, "utf-8"), i = JSON.parse(n);
if (Xr(i, e.cacheExpiration)) await s.rm(t, { force: !0 });
else {
let { schema: e, timestamp: t, packages: n = {}, peers: a = {} } = i;
r = {
schema: e,
timestamp: t,
packages: n,
peers: a
};
}
} catch {}
return {
get: (e, t) => {
let i = `${e}___${t}`, a = r.packages[i];
return a && n.add(e), a;
},
set: (e, t, n, i) => {
let a = `${e}___${t}`;
r.packages[a] = {
version: n,
time: i
};
},
getPeers: (e, t) => {
if (!r.peers) return;
let i = `${e}___${t}`, a = r.peers[i];
return a && n.add(e), a;
},
setPeers: (e, t, n) => {
let i = `${e}___${t}`;
r.peers && (r.peers[i] = n);
},
save: async () => {
await s.writeFile(t, JSON.stringify(r));
},
log: (t) => {
let r = n.size;
r !== 0 && (X(e, `\nUsing ${r} cached package ${t ? "peer" : "version"}${r > 1 ? "s" : ""}`, "warn"), X(e, n, "verbose"), n.clear());
}
};
}
//#endregion
//#region src/lib/uncode.ts
var ri = (e) => e.replaceAll("`", "").replaceAll(/\*\*(.+?)\*\*/g, "$1").replaceAll(/_(.+?)_/g, "$1"), ii = (e, t = 92) => {
let n = e.split("\n"), r = [];
for (let e of n) {
let n = 0;
if (e.length === 0) {
r.push("");
continue;
}
for (; n < e.length;) {
let i = e.slice(n, n + t + 1), a = i.trimEnd();
if (a.length <= t) {
r.push(a);
break;
}
let o = i.split("").reverse().join("").match(/[ -][^\W]/)?.index || 0, s = i.slice(0, i.length - o);
if (s.length === 0) break;
r.push(s.trimEnd()), n += s.length;
}
}
return r.join("\n").trim();
}, ai = (e) => e.map(([e, t]) => [e, ii(t)]), oi = (e) => e.replace(/`(.+?)`/g, "<code>$1</code>"), si = (e) => "\n <tr>" + e.map((e) => `<td>${oi(e)}</td>`).join("") + "</tr>", ci = ({ colAligns: e, markdown: t, rows: n }) => {
if (t) return `<table>${n.map(si).join("")}\n</table>`;
{
let t = n.map((e) => e.map((e) => ri(e))), r = new Ot.default({ ...e ? { colAligns: e } : null });
return r.push(...ai(t)), r.toString();
}
}, li = [
"latest",
"newest",
"greatest",
"minor",
"patch",
"semver"
], ui = (e, t) => e.split("\n").map((e) => e && `${"".padStart(t, " ")}${e}`).join("\n"), di = (e, { markdown: t, lang: n = "js" } = {}) => `${t ? "```" + n + "\n" : ""}${ui(e, t ? 0 : 4)}${t ? "\n```" : ""}`, fi = (e, t, { markdown: n } = {}) => n ? `[${e}](#${t})` : `https://github.com/raineorshine/npm-check-updates#${t}`, pi = (e) => (t) => {
if (typeof t == "number") return t;
if (typeof t == "string") {
let e = parseInt(t, 10);
if (!isNaN(e)) return e;
}
throw Error(`${e} must be a number`);
}, mi = (e, { markdown: t } = {}) => {
let n = "", r = [];
if (e.cli !== !1 && r.push(`ncu --${e.long}${e.arg ? ` [${e.arg}]` : ""}${e.long === "doctor" ? " -u" : ""}`), e.type === "boolean" && r.push(`ncu --no-${e.long}`), e.short && r.push(`ncu -${e.short}${e.arg ? ` [${e.arg}]` : ""}${e.long === "doctor" ? "u" : ""}`), r.length > 0 && (n = `Usage:\n\n${di(r.join("\n"), {
markdown: t,
lang: "sh"
})}\n`), e.default !== void 0 && !(Array.isArray(e.default) && e.default.length === 0) && (n += `\nDefault: ${e.default}\n`), e.help) {
let r = typeof e.help == "function" ? e.help({ markdown: t }) : e.help;
n += `\n${(t ? r : ri(r)).trim()}\n\n`;
} else e.description && (n += `\n${t ? e.description : ri(e.description)}\n`);
return n.trim();
}, hi = ({ markdown: e }) => `Iteratively installs upgrades and runs your project's tests to identify breaking upgrades. Reverts broken upgrades and updates package.json with working upgrades.
${Y.yellow("Requires `-u` to execute")} (modifies your package file, lock file, and node_modules)
To be more precise:
1. Runs \`npm install\` and \`npm test\` to ensure tests are currently passing.
2. Runs \`ncu -u\` to optimistically upgrade all dependencies.
3. If tests pass, hurray!
4. If tests fail, restores package file and lock file.
5. For each dependency, install upgrade and run tests.
6. Prints broken upgrades with test error.
7. Saves working upgrades to package.json.
Additional options:
${ci({
markdown: e,
rows: [[Y.cyan("--doctorInstall"), "specify a custom install script (default: `npm install` or `yarn`)"], [Y.cyan("--doctorTest"), "specify a custom test script (default: `npm test`)"]]
})}
Example:
${di("$ ncu --doctor -u\nRunning tests before upgrading\nnpm install\nnpm run test\nUpgrading all dependencies and re-running tests\nncu -u\nnpm install\nnpm run test\nTests failed\nIdentifying broken dependencies\nnpm install\nnpm install --no-save react@16.0.0\nnpm run test\n ✓ react 15.0.0 → 16.0.0\nnpm install --no-save react-redux@7.0.0\nnpm run test\n ✗ react-redux 6.0.0 → 7.0.0\n\n/projects/myproject/test.js:13\n throw new Error('Test failed!')\n ^\n\nnpm install --no-save react-dnd@11.1.3\nnpm run test\n ✓ react-dnd 10.0.0 → 11.1.3\nSaving partially upgraded package.json", {
markdown: e,
lang: "console"
})}
`, gi = ({ markdown: e }) => `Filters results based on a user provided predicate function after fetching new versions.
\`filterResults\` runs _after_ new versions are fetched, in contrast to \`filter\`, \`reject\`, \`filterVersion\`, and \`rejectVersion\`, which run _before_. This allows you to exclude upgrades with \`filterResults\` based on how the version has changed (e.g. a major version change).
> ⚠️ The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at ${fi("Config Functions", "config-functions", { markdown: e })}.
${di(`${Y.gray("/** Exclude major version updates. Note this could also be achieved with --target semver.\n @param {string} packageName The name of the dependency.\n @param {string} current Current version declaration (may be a range).\n @param {SemVer[]} currentVersionSemver Current version declaration in semantic versioning format (may be a range).\n @param {string} upgraded Upgraded version.\n @param {SemVer} upgradedVersionSemver Upgraded version in semantic versioning format.\n @returns {boolean} Return true if the upgrade should be kept; otherwise, it will be ignored.\n*/")}
${Y.green("filterResults")}: (packageName, { current, currentVersionSemver, upgraded, upgradedVersionSemver }) ${Y.cyan("=>")} {
${Y.cyan("const")} currentMajor ${Y.red("=")} parseInt(currentVersionSemver[${Y.cyan("0")}]?.major, ${Y.cyan("10")})
${Y.cyan("const")} upgradedMajor ${Y.red("=")} parseInt(upgradedVersionSemver?.major, ${Y.cyan("10")})
${Y.red("if")} (currentMajor ${Y.red("&&")} upgradedMajor) {
${Y.red("return")} currentMajor ${Y.red(">=")} upgradedMajor
}
${Y.red("return")} ${Y.cyan("true")}
}`, { markdown: e })}
For the SemVer type definition, see: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring
`, _i = ({ markdown: e }) => `Modify the output formatting or show additional information. Specify one or more comma-delimited values.\n\n${ui(ci({
colAligns: ["right", "left"],
markdown: e,
rows: [
["dep", "Prints the dependency type (dev, peer, optional) of each package."],
["group", "Groups packages by major, minor, patch, and major version zero updates."],
["homepage", "Displays links to the package's homepage if specified in its package.json."],
["installedVersion", "Prints the exact current version number instead of a range."],
["lines", "Prints name@version on separate lines. Useful for piping to npm install."],
["ownerChanged", "Shows if the package owner has changed."],
["repo", "Infers and displays links to the package's source code repository. Requires packages to be installed."],
["diff", "Display link to compare the changes between package versions."],
["time", "Shows the publish time of each upgrade."],
["cooldown", "Shows a list of packages that were skipped due to the --cooldown threshold."]
]
}), e ? 0 : 4)}
\`group\` is the only value included by default. Prefix it with "no-" to remove it instead of replacing the entire list, e.g. \`--format no-group\` to disable the default grouping.
`, vi = ({ markdown: e }) => `Control the auto-install behavior.\n\n${ui(ci({
colAligns: ["right", "left"],
markdown: e,
rows: [
["always", "Runs your package manager's install command automatically after upgrading."],
["never", "Does not install and does not prompt."],
["prompt", "Shows a message after upgrading that recommends an install, but does not install. In interactive mode, prompts for install. (default)"]
]
}), e ? 0 : 4)}
`, yi = ({ markdown: e }) => `Control which upgrades are pre-selected in interactive mode. Only applies with \`--interactive\`.
${ui(ci({
colAligns: ["right", "left"],
markdown: e,
rows: [
["auto", "Pre-selects patch and minor upgrades with `--format group`, which is enabled by default, and all upgrades otherwise. This is what `ncu -i` does. (default)"],
["none", "Nothing is pre-selected."],
["patch", "Patch upgrades are pre-selected."],
["minor", "Patch and minor upgrades are pre-selected."],
["all", "All upgrades are pre-selected, including major."]
]
}), e ? 0 : 4)}
Specify \`auto\` explicitly to restore the default when another value is set in your ${fi("config file", "config-file", { markdown: e })}.
Major version zero upgrades (e.g. 0.1.0 → 0.2.0) are only pre-selected by \`all\`, since anything may change before 1.0.0. Custom groups returned by ${fi("--groupFunction", "groupfunction", { markdown: e })} are likewise only pre-selected by \`all\`.
`, bi = ({ markdown: e }) => `Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. Only included packages will be checked with \`--peer\`.
\`--filter\` runs _before_ new versions are fetched, in contrast to \`--filterResults\` which runs _after_.
You can also specify a custom function in your .ncurc.js file, or when importing npm-check-updates as a module.
> ⚠️ The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at ${fi("Config Functions", "config-functions", { markdown: e })}.
${di(`${Y.gray("/**\n @param name The name of the dependency.\n @param semver A parsed Semver array of the current version.\n (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)\n @returns True if the package should be included, false if it should be excluded.\n*/")}
${Y.green("filter")}: (name, semver) ${Y.cyan("=>")} {
${Y.red("if")} (name.startsWith(${Y.yellow("'@myorg/'")})) {
${Y.red("return")} ${Y.cyan("false")}
}
${Y.red("return")} ${Y.cyan("true")}
}`, { markdown: e })}
`, xi = () => "Include only versions matching the given string, wildcard, glob, comma-or-space-delimited list, or /regex/.\n\n`--filterVersion` runs _before_ new versions are fetched, in contrast to `--filterResults` which runs _after_.\n\nTo filter with a predicate function, use `filter` instead. It receives the package name and the parsed current version, so it can match on both name and version.\n", Si = ({ markdown: e }) => `The inverse of \`--filter\`. Exclude package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. This will also exclude them from the \`--peer\` check.
\`--reject\` runs _before_ new versions are fetched, in contrast to \`--filterResults\` which runs _after_.
You can also specify a custom function in your .ncurc.js file, or when importing npm-check-updates as a module.
> ⚠️ The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at ${fi("Config Functions", "config-functions", { markdown: e })}.
${di(`${Y.gray("/**\n @param name The name of the dependency.\n @param semver A parsed Semver array of the current version.\n (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)\n @returns True if the package should be excluded, false if it should be included.\n*/")}
${Y.green("reject")}: (name, semver) ${Y.cyan("=>")} {
${Y.red("if")} (name.startsWith(${Y.yellow("'@myorg/'")})) {
${Y.red("return")} ${Y.cyan("true")}
}
${Y.red("return")} ${Y.cyan("false")}
}`, { markdown: e })}
`, Ci = () => "The inverse of `--filterVersion`. Exclude versions matching the given string, wildcard, glob, comma-or-space-delimited list, or /regex/.\n\n`--rejectVersion` runs _before_ new versions are fetched, in contrast to `--filterResults` which runs _after_.\n\nTo reject with a predicate function, use `reject` instead. It receives the package name and the parsed current version, so it can match on both name and version.\n\n", wi = ({ markdown: e }) => `Customize how packages are divided into groups when using \`--format group\`.
Only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at ${fi("Config Functions", "config-functions", { markdown: e })}.
${di(`${Y.gray("/**\n @param name The name of the dependency.\n @param defaultGroup The predefined group name which will be used by default.\n @param currentSpec The current version range in your package.json.\n @param upgradedSpec The upgraded version range that will be written to your package.json.\n @param upgradedVersion The upgraded version number returned by the registry.\n @returns A predefined group name ('major' | 'minor' | 'patch' | 'majorVersionZero' | 'none') or a custom string to create your own group.\n*/")}
${Y.green("groupFunction")}: (name, defaultGroup, currentSpec, upgradedSpec, upgradedVersion) ${Y.cyan("=>")} {
${Y.red("if")} (name ${Y.red("===")} ${Y.yellow("'typescript'")} ${Y.red("&&")} defaultGroup ${Y.red("===")} ${Y.yellow("'minor'")}) {
${Y.red("return")} ${Y.yellow("'major'")}
}
${Y.red("if")} (name.startsWith(${Y.yellow("'@myorg/'")})) {
${Y.red("return")} ${Y.yellow("'My Org'")}
}
${Y.red("return")} defaultGroup
}`, { markdown: e })}
`, Ti = ({ markdown: e }) => `Determines the version to upgrade to. (default: "latest")
${ui(ci({
colAligns: ["right", "left"],
markdown: e,
rows: [
["greatest", "Upgrade to the highest version number published, regardless of release date or tag. Includes prereleases."],
["latest", "Upgrade to whatever the package's \"latest\" dist-tag points to. When used with --cooldown, falls back to the greatest version that passes the cooldown threshold if the latest is too recent. Use --target \"@latest\" for strict behaviour that skips the package instead. Excludes prereleases unless --pre is specified."],
["minor", "Upgrade to the highest minor version without bumping the major version."],
["newest", "Upgrade to the version with the most recent publish date, even if there are other version numbers that are higher. Includes prereleases."],
["patch", "Upgrade to the highest patch version without bumping the minor or major versions."],
["semver", "Upgrade to the highest version within the semver range specified in your package.json."],
["@[tag]", "Upgrade to the version published to a specific tag, e.g. 'next' or 'beta'."]
]
}), e ? 0 : 4)}
e.g.
${di("ncu --target semver", {
markdown: e,
lang: "sh"
})}
You can also specify a custom function in your .ncurc.js file, or when importing npm-check-updates as a module.
> ⚠️ The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at ${fi("Config Functions", "config-functions", { markdown: e })}.
${di(`${Y.gray("/** Upgrade major version zero to the next minor version, and everything else to latest.\n @param name The name of the dependency.\n @param semver A parsed Semver object of the upgraded version.\n (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)\n @returns One of the valid target values (specified in the table above).\n*/")}
${Y.green("target")}: (name, semver) ${Y.cyan("=>")} {
${Y.red("if")} (parseInt(semver[0]?.major) ${Y.red("===")} ${Y.yellow("'0'")}) ${Y.red("return")} ${Y.yellow("'minor'")}
${Y.red("return")} ${Y.yellow("'latest'")}
}`, { markdown: e })}
`, Ei = ({ markdown: e }) => `Specifies the package manager to use when looking up versions.\n\n${ui(ci({
colAligns: ["right", "left"],
markdown: e,
rows: [
["npm", "System-installed npm. Default."],
["yarn", "System-installed yarn. Automatically used if yarn.lock is present."],
["pnpm", "System-installed pnpm. Automatically used if pnpm-lock.yaml is present."],
["bun", "System-installed bun. Automatically used if bun.lock or bun.lockb is present."]
]
}), e ? 0 : 4)}
`, Di = ({ markdown: e }) => `Specify whether \`--registry\` refers to a full npm registry or a simple JSON file.
${ui(ci({
colAligns: ["right", "left"],
markdown: e,
rows: [["npm", "Default npm registry"], ["json", `Checks versions from a file or url to a simple JSON registry. Must include the ${Y.cyan("`--registry`")} option.`]]
}), e ? 0 : 4)}
Example:
${di(`${Y.gray("# local file")}
ncu --registryType json --registry ./registry.json
${Y.gray("# url")}
ncu --registryType json --registry https://api.mydomain/registry.json
${Y.gray("# you can omit --registryType when the registry ends in .json")}
ncu --registry ./registry.json
ncu --registry https://api.mydomain/registry.json`, {
markdown: e,
lang: "sh"
})}
registry.json:
${di("{\n \"prettier\": \"2.7.1\",\n \"typescript\": \"4.7.4\"\n}", {
markdown: e,
lang: "json"
})}
`, Oi = ({ markdown: e }) => `Check peer dependencies of installed packages and filter updates to compatible versions.
${Y.bold("Example")}:
The following example demonstrates how \`--peer\` works, and how it uses peer dependencies from upgraded modules.
The package ${Y.bold("ncu-test-peer-update")} has two versions published:
- 1.0.0 has peer dependency \`"ncu-test-return-version": "1.0.x"\`
- 1.1.0 has peer dependency \`"ncu-test-return-version": "1.1.x"\`
Our test app has the following dependencies:
${di("\"ncu-test-peer-update\": \"1.0.0\",\n\"ncu-test-return-version\": \"1.0.0\"", {
markdown: e,
lang: "json"
})}
The latest versions of these packages are:
${di("\"ncu-test-peer-update\": \"1.1.0\",\n\"ncu-test-return-version\": \"2.0.0\"", {
markdown: e,
lang: "json"
})}
${Y.bold("With `--peer`")}:
ncu upgrades packages to the highest version that still adheres to the peer dependency constraints:
${di(`ncu-test-peer-update 1.0.0 → 1.${Y.cyan("1.0")}
ncu-test-return-version 1.0.0 → 1.${Y.cyan("1.0")}`, {
markdown: e,
lang: "text"
})}
${Y.bold("Without `--peer`")}:
As a comparison: without using the \`--peer\` option, ncu will suggest the latest versions, ignoring peer dependencies:
${di(`ncu-test-peer-update 1.0.0 → 1.${Y.cyan("1.0")}
ncu-test-return-version 1.0.0 → ${Y.red("2.0.0")}`, {
markdown: e,
lang: "text"
})}
`, ki = ({ markdown: e }) => `The cooldown option helps protect against supply chain attacks by requiring package versions to be published at least the given amount of time before considering them for upgrade.
The value can be a plain number (days) or a string with a unit suffix:
${di("--cooldown 7 7 days\n--cooldown 7d 7 days (same as above)\n--cooldown 12h 12 hours\n--cooldown 30m 30 minutes", {
markdown: e,
lang: "text"
})}
With the default \`--target latest\`, if the latest dist-tag version is within the cooldown window, ncu falls back to the greatest version that passes the cooldown threshold. To instead skip the package entirely (strict behaviour), use \`--target "@latest"\`.
${Y.bold("Example")}:
Let's examine how cooldown works with a package that has these versions available:
${di("1.0.0 Released 7 days ago (initial version)\n1.1.0 Released 6 days ago (minor update)\n1.1.1 Released 5 days ago (patch update)\n1.2.0 Released 5 days ago (minor update)\n2.0.0-beta.1 Released 5 days ago (beta release)\n1.2.1 Released 4 days ago (patch update)\n1.3.0 Released 4 days ago (minor update) [latest]\n2.0.0-beta.2 Released 3 days ago (beta release)\n2.0.0-beta.3 Released 2 days ago (beta release) [beta]", {
markdown: e,
lang: "text"
})}
${Y.bold("With default target (latest)")}:
${di("ncu --cooldown 5", {
markdown: e,
lang: "sh"
})}
Falls back to 1.2.0 because:
- Latest version (1.3.0) is only 4 days old (within 5-day cooldown)
- 1.2.0 is the greatest version that is at least 5 days old
${Y.bold("With `@latest` strict target")}:
${di("ncu --cooldown 5 --target @latest", {
markdown: e,
lang: "sh"
})}
No update will be suggested because:
- Latest version (1.3.0) is only 4 days old
- Cooldown requires versions to be at least 5 days old
- \`@latest\` is strict: no fallback to older versions
${Y.bold("With `@beta`/`@tag` target")}:
${di("ncu --cooldown 3 --target @beta", {
markdown: e,
lang: "sh"
})}
No update will be suggested because:
- Current beta (2.0.0-beta.3) is only 2 days old
- Cooldown requires versions to be at least 3 days old
- Use \`--cooldown 2\` or lower to allow this update
${Y.bold("With other targets")}:
${di("ncu --cooldown 5 --target greatest|newest|minor|patch|semver", {
markdown: e,
lang: "sh"
})}
Each target will select the best version that is at least 5 days old:
${di("greatest → 1.2.0 (highest version number outside cooldown)\nnewest → 2.0.0-beta.1 (most recently published version outside cooldown)\nminor → 1.2.0 (highest minor version outside cooldown)\npatch → 1.1.1 (highest patch version outside cooldown)", {
markdown: e,
lang: "text"
})}
You can also provide a custom function in your .ncurc.js file or when importing npm-check-updates as a module.
> ⚠️ The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. To convert a JSON config to a JS config, follow the instructions at ${fi("Config Functions", "config-functions", { markdown: e })}.
${di(`${Y.gray("/** Set cooldown to 3 days but skip it for `@my-company` packages.\n @param packageName The name of the dependency.\n @returns Cooldown days restriction for given package.\n*/")}
${Y.green("cooldown")}: packageName ${Y.cyan("=>")} (packageName.startsWith(${Y.yellow("'@my-company'")}) ? ${Y.cyan("0")} : ${Y.cyan("3")})`, { markdown: e })}
### Package Manager Configurations
If \`--cooldown\` is not set explicitly, \`ncu\` automatically reads the cooldown configuration from your package manager's own native config — each package manager only consults its own config and these are not cross-applied between package managers:
${ci({
colAligns: ["right", "left"],
markdown: e,
rows: [
["npm", "Reads `min-release-age` from `.npmrc`, excluding packages matched by `min-release-age-exclude`."],
["yarn", "Reads `npmMinimalAgeGate` from `.yarnrc.yml`, excluding packages matched by `npmPreapprovedPackages`."],
["pnpm", "Reads `minimumReleaseAge` from `pnpm-workspace.yaml`, excluding packages matched by `minimumReleaseAgeExclude`."]
]
})}
### Cooldown Formatting
When using \`--format cooldown\` alongside the \`--cooldown\` option, \`ncu\` will show a list of packages that were skipped due to the \`--cooldown\` threshold.
Example:
${di("$ ncu --format cooldown --cooldown 7\nSkipped due to 7-day cooldown\n @typescript-eslint/parser ^8.50.0 → ^8.59.1 5 days ago\n eslint ^10.0.1 → ^10.3.0 1 day ago", {
markdown: e,
lang: "console"
})}
`, Ai = ["group"], ji = [
{
long: "cache",
description: `Cache versions to a local cache file. Default \`--cacheFile\` is \`${Qr}\` and default \`--cacheExpiration\` is 10 minutes.`,
type: "boolean"
},
{
long: "cacheClear",
description: "Clear the default cache, or the cache file specified by `--cacheFile`.",
type: "boolean"
},
{
long: "cacheExpiration",
arg: "min",
description: "Cache expiration in minutes. Only works with `--cache`.",
parse: pi("cacheExpiration"),
default: 10,
type: "number"
},
{
long: "cacheFile",
arg: "path",
description: "Filepath for the cache file. Only works with `--cache`.",
parse: (e) => {
if (typeof e != "string") throw Error("cacheFile must be a string");
return o.isAbsolute(e) ? e : o.join(process.cwd(), e);
},
default: Qr,
type: "string"
},
{
long: "color",
description: "Force color in terminal.",
type: "boolean"
},
{
long: "concurrency",
arg: "n",
description: "Max number of concurrent HTTP requests to registry.",
parse: pi("concurrency"),
default: 8,
type: "number"
},
{
long: "configFileName",
arg: "s",
description: "Config file name. (default: .ncurc or .ncurc.{json,yaml,yml,js,mjs,cjs})",
type: "string"
},
{
long: "configFilePath",
arg: "path",
description: "Directory of .ncurc config file. (default: directory of `packageFile`)",
type: "string"
},
{
long: "cwd",
arg: "path",
description: "Working directory in which npm will be executed.",
type: "string"
},
{
long: "deep",
description: "Run recursively in current working directory. Alias of (`--packageFile '**/package.json'`).",
type: "boolean"
},
{
long: "dep",
arg: "value",
description: "Check one or more sections of dependencies only: dev, optional, peer, prod, or packageManager (comma-delimited).",
default: [
"prod",
"dev",
"optional",
"packageManager"
],
parse: (e) => typeof e == "string" ? e.split(/,|\s/) : e,
type: "string | readonly string[]"
},
{
long: "deprecated",
default: !0,
description: "Include deprecated packages. Use `--no-deprecated` to exclude deprecated packages (20–25% slower).",
type: "boolean"
},
{
long: "doctor",
short: "d",
description: "Iteratively installs upgrades and runs tests to identify breaking upgrades. Requires `-u` to execute.",
type: "boolean",
help: hi
},
{
long: "doctorInstall",
arg: "command",
description: "Specifies the install script to use in doctor mode. (default: `npm install` or the equivalent for your package manager)",
type: "string"
},
{
long: "doctorTest",
arg: "command",
description: "Specifies the test script to use in doctor mode. (default: `npm test`)",
type: "string"
},
{
long: "enginesNode",
description: "Include only packages that satisfy engines.node as specified in the package file.",
type: "boolean"
},
{
long: "errorLevel",
short: "e",
arg: "n",
description: "Set the error level. 1: exits with error code 0 if no errors occur. 2: exits with error code 0 if no packages need updating (useful for continuous integration).",
parse: pi("errorLevel"),
default: 1,
type: "number"
},
{
long: "filter",
short: "f",
arg: "p",
description: "Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.",
type: "string | RegExp | readonly (string | RegExp)[] | FilterFunction",
parse: (e, t) => [...t || [], e],
help: bi
},
{
long: "filterResults",
arg: "fn",
cli: !1,
description: "Filters results based on a user provided predicate function after fetching new versions.",
type: "FilterResultsFunction",
help: gi
},
{
long: "filterVersion",
arg: "p",
description: "Filter on package version using comma-or-space-delimited list or /regex/.",
type: "string | RegExp | readonly (string | RegExp)[]",
parse: (e, t) => [...t || [], e],
help: xi
},
{
long: "format",
arg: "value",
description: "Modify the output formatting or show additional information. Specify one or more comma-delimited values: dep, group, ownerChanged, repo, time, lines, installedVersion, cooldown. `group` is the only value included by default; use `--format no-group` to disable it.",
parse: (e) => {
if (typeof e != "string") return e;
let t = e.split(/,|\s/).filter(Boolean), n = t.filter((e) => e.startsWith("no-")).map((e) => e.slice(3));
if (n.length === 0) return t;
let r = t.filter((e) => !e.startsWith("no-"));
return [.../* @__PURE__ */ new Set([...Ai.filter((e) => !n.includes(e)), ...r])];
},
default: Ai,
type: "readonly string[]",
choices: [
"dep",
"group",
"homepage",
"ownerChanged",
"repo",
"diff",
"time",
"lines",
"installedVersion",
"cooldown"
],
help: _i
},
{
long: "global",
short: "g",
description: "Check global packages instead of in the current project.",
type: "boolean"
},
{
long: "groupFunction",
arg: "fn",
cli: !1,
description: "Customize how packages are divided into groups when using `--format group`.",
type: "GroupFunction",
help: wi
},
{
long: "install",
arg: "value",
description: "Control the auto-install behavior: always, never, prompt.",
help: vi,
default: "prompt",
choices: [
"always",
"never",
"prompt"
],
type: "'always' | 'never' | 'prompt'"
},
{
long: "interactive",
short: "i",
description: "Enable interactive prompts for each dependency; implies `-u` unless one of the json options are set.",
type: "boolean"
},
{
long: "interactiveSelect",
arg: "value",
description: "Control which upgrades are pre-selected in interactive mode: auto, none, patch, minor, all. Only applies with `--interactive`.",
help: yi,
default: "auto",
choices: [
"auto",
"none",
"patch",
"minor",
"all"
],
type: "'auto' | 'none' | 'patch' | 'minor' | 'all'"
},
{
long: "jsonAll",
short: "j",
description: "Output new package file instead of human-readable message.",
type: "boolean"
},
{
long: "jsonDeps",
description: "Like `jsonAll` but only lists `dependencies`, `devDependencies`, `optionalDependencies`, etc of the new package data.",
type: "boolean"
},
{
long: "jsonUpgraded",
description: "Output upgraded dependencies in json.",
type: "boolean"
},
{
long: "loglevel",
short: "l",
arg: "n",
description: "Amount to log: silent, error, minimal, warn, info, verbose, silly.",
default: "warn",
type: "string"
},
{
long: "mergeConfig",
description: "Merges nested configs with the root config file for `--deep` or `--packageFile` options. (default: false)",
type: "boolean"
},
{
long: "minimal",
short: "m",
description: "Do not upgrade newer versions that are already satisfied by the version range according to semver.",
type: "boolean"
},
{
long: "packageData",
arg: "value",
description: "Package file data (you can also use stdin).",
type: "string | PackageFile"
},
{
long: "packageFile",
arg: "path|glob",
description: "Package file(s) location. (default: ./package.json)",
type: "string"
},
{
long: "packageManager",
short: "p",
arg: "s",
description: "npm, yarn, pnpm, deno, bun, staticRegistry (default: npm).",
help: Ei,
type: "'npm' | 'yarn' | 'pnpm' | 'deno' | 'bun' | 'staticRegistry'"
},
{
long: "peer",
description: "Check peer dependencies of installed packages and filter updates to compatible versions.",
type: "boolean",
help: Oi
},
{
long: "pre",
arg: "n",
description: "Include prerelease versions, e.g. -alpha.0, -beta.5, -rc.2. Automatically set to 1 when `--target` is newest or greatest, or when the current version is a prerelease. (default: 0)",
parse: (e) => {
if (typeof e == "number") return !!e;
if (typeof e == "string") return !!parseInt(e, 10);
throw Error("pre must be a number");
},
type: "number"
},
{
long: "prefix",
arg: "path",
description: "Current working directory of npm.",
type: "string"
},
{
long: "registry",
short: "r",
arg: "uri",
description: "Specify the registry to use when looking up package versions.",
type: "string"
},
{
long: "registryType",
arg: "type",
description: "Specify whether --registry refers to a full npm registry or a simple JSON file or url: npm, json. (default: npm)",
help: Di,
type: "'npm' | 'json'"
},
{
long: "reject",
short: "x",
arg: "p",
description: "Exclude packages matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.",
type: "string | RegExp | readonly (string | RegExp)[] | FilterFunction",
parse: (e, t) => [...t || [], e],
help: Si
},
{
long: "rejectVersion",
arg: "p",
description: "Exclude package.json versions using comma-or-space-delimited list or /regex/.",
type: "string | RegExp | readonly (string | RegExp)[]",
parse: (e, t) => [...t || [], e],
help: Ci
},
{
long: "removeRange",
description: "Remove version ranges from the final package version.",
type: "boolean"
},
{
long: "root",
default: !0,
description: "Runs updates on the root project in addition to specified workspaces. Only allowed with `--workspace` or `--workspaces`.",
type: "boolean"
},
{
long: "retry",
arg: "n",
description: "Number of times to retry failed requests for package info.",
parse: pi("retry"),
default: 3,
type: "number"
},
{
long: "silent",
short: "s",
description: "Don't output anything. Alias for `--loglevel` silent.",
type: "boolean"
},
{
long: "stdin",
description: "Read package.json from stdin.",
type: "string"
},
{
long: "target",
short: "t",
arg: "value",
description: "Determines the version to upgrade to: latest, newest, greatest, minor, patch, semver, `@[tag]`, or [function]. (default: latest)",
help: Ti,
type: `${li.map((e) => `'${e}'`).join(" | ")} | \`@\${string}\` | TargetFunction`
},
{
long: "timeout",
arg: "ms",
description: "Global timeout in milliseconds. (default: no global timeout and 30 seconds per npm-registry-fetch)",
parse: pi("timeout"),
type: "number"
},
{
long: "upgrade",
short: "u",
description: "Overwrite package file with upgraded versions instead of just outputting to console.",
type: "boolean"
},
{
long: "verbose",
description: "Log additional information for debugging. Alias for `--loglevel` verbose.",
type: "boolean"
},
{
long: "workspace",
arg: "s",
parse: (e, t) => [...t, e],
default: [],
description: "Run on one or more specified workspaces. Add `--no-root` to exclude the root project.",
type: "readonly string[]"
},
{
long: "workspaces",
short: "w",
description: "Run on all workspaces. Add `--no-root` to exclude the root project.",
type: "boolean"
},
{
long: "cooldown",
short: "c",
arg: "period",
description: "Sets a minimum age for package versions to be considered for upgrade. Accepts a number (days) or a string with a unit: \"7d\" (days), \"12h\" (hours), \"30m\" (minutes). Reduces the risk of installing newly published, potentially compromised packages.",
type: "number | string | CooldownFunction",
help: ki,
parse: (e) => {
if (typeof e == "number" || typeof e == "function") return e;
if (typeof e == "string") {
let t = zn(e);
return t === null ? parseInt(e, 10) : t;
}
throw Error("cooldown must be a number, string, or function");
}
}
], Mi = ji.reduce((e, t) => ({
...e,
...t.short ? { [t.short]: t } : null,
...t.long ? { [t.long]: t } : null
}), {}), Ni = Un(ji, (e) => e.long);
//#endregion
//#region src/lib/defineConfig.ts
function Pi(e) {
return e;
}
//#endregion
//#region src/lib/findLockfile.ts
var Fi = [
"package-lock.json",
"yarn.lock",
"pnpm-lock.yaml",
"deno.json",
"deno.jsonc",
"bun.lock",
"bun.lockb"
];
async function Ii(e, t = s.readdir) {
try {
let n = c.homedir(), r = c.tmpdir(), i = e.cwd ? e.cwd : e.packageFile ? o.dirname(e.packageFile) : ".";
for (i = o.resolve(i);;) {
let e = await t(i);
for (let t of Fi) if (e.includes(t)) return {
directoryPath: i,
filename: t
};
let a = o.resolve(i, "..");
if ([
i,
n,
r
].includes(a)) break;
i = a;
}
} catch {}
return null;
}
//#endregion
//#region src/lib/determinePackageManager.ts
var Li = o.dirname(g(import.meta.url)), Ri = {
"package-lock": "npm",
yarn: "yarn",
"pnpm-lock": "pnpm",
deno: "deno",
bun: "bun"
}, zi = () => {
let e = process.env.npm_config_user_agent ?? "", t = process.env.npm_execpath ?? "";
return e.startsWith("yarn/") || t.includes("yarn") || Li.includes("/yarn/") || Li.includes("\\Yarn\\") ? "yarn" : e.startsWith("pnpm/") || t.includes("pnpm") || Li.includes("/pnpm/") || Li.includes("\\pnpm\\") ? "pnpm" : e.startsWith("bun/") || typeof Bun < "u" || process.versions.bun || Li.includes("/.bun/") || Li.includes("\\.bun\\") ? "bun" : "npm";
}, Bi = async (e, t = s.readdir) => {
if (e.packageManager) return e.packageManager;
if (e.global) return zi();
let n = (await Ii(e, t))?.filename;
return n ? Ri[n.split(".")[0]] : "npm";
}, Vi = /* @__PURE__ */ i(((t, n) => {
n.exports = o, o.sync = s;
var r = e("fs");
function i(e, t) {
var n = t.pathExt === void 0 ? process.env.PATHEXT : t.pathExt;
if (!n || (n = n.split(";"), n.indexOf("") !== -1)) return !0;
for (var r = 0; r < n.length; r++) {
var i = n[r].toLowerCase();
if (i && e.substr(-i.length).toLowerCase() === i) return !0;
}
return !1;
}
function a(e, t, n) {
return !e.isSymbolicLink() && !e.isFile() ? !1 : i(t, n);
}
function o(e, t, n) {
r.stat(e, function(r, i) {
n(r, !r && a(i, e, t));
});
}
function s(e, t) {
return a(r.statSync(e), e, t);
}
})), Hi = /* @__PURE__ */ i(((t, n) => {
n.exports = i, i.sync = a;
var r = e("fs");
function i(e, t, n) {
r.stat(e, function(e, r) {
n(e, !e && o(r, t));
});
}
function a(e, t) {
return o(r.statSync(e), t);
}
function o(e, t) {
return e.isFile() && s(e, t);
}
function s(e, t) {
var n = e.mode, r = e.uid, i = e.gid, a = t.uid === void 0 ? process.getuid && process.getuid() : t.uid, o = t.gid === void 0 ? process.getgid && process.getgid() : t.gid, s = 64, c = 8, l = 1, u = s | c;
return n & l || n & c && i === o || n & s && r === a || n & u && a === 0;
}
})), Ui = /* @__PURE__ */ i(((t, n) => {
e("fs");
var r = process.platform === "win32" || global.TESTING_WINDOWS ? Vi() : Hi();
n.exports = i, i.sync = a;
function i(e, t, n) {
if (typeof t == "function" && (n = t, t = {}), !n) {
if (typeof Promise != "function") throw TypeError("callback not provided");
return new Promise(function(n, r) {
i(e, t || {}, function(e, t) {
e ? r(e) : n(t);
});
});
}
r(e, t || {}, function(e, r) {
e && (e.code === "EACCES" || t && t.ignoreErrors) && (e = null, r = !1), n(e, r);
});
}
function a(e, t) {
try {
return r.sync(e, t || {});
} catch (e) {
if (t && t.ignoreErrors || e.code === "EACCES") return !1;
throw e;
}
}
})), Wi = /* @__PURE__ */ i(((t, n) => {
var r = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys", i = e("path"), a = r ? ";" : ":", o = Ui(), s = (e) => Object.assign(/* @__PURE__ */ Error(`not found: ${e}`), { code: "ENOENT" }), c = (e, t) => {
let n = t.colon || a, i = e.match(/\//) || r && e.match(/\\/) ? [""] : [...r ? [process.cwd()] : [], ...(t.path || process.env.PATH ||
/* istanbul ignore next: very unusual */ "").split(n)], o = r ? t.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "", s = r ? o.split(n) : [""];
return r && e.indexOf(".") !== -1 && s[0] !== "" && s.unshift(""), {
pathEnv: i,
pathExt: s,
pathExtExe: o
};
}, l = (e, t, n) => {
typeof t == "function" && (n = t, t = {}), t ||= {};
let { pathEnv: r, pathExt: a, pathExtExe: l } = c(e, t), u = [], d = (n) => new Promise((a, o) => {
if (n === r.length) return t.all && u.length ? a(u) : o(s(e));
let c = r[n], l = /^".*"$/.test(c) ? c.slice(1, -1) : c, d = i.join(l, e), p = !l && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d;
a(f(p, n, 0));
}), f = (e, n, r) => new Promise((i, s) => {
if (r === a.length) return i(d(n + 1));
let c = a[r];
o(e + c, { pathExt: l }, (a, o) => {
if (!a && o) {
if (t.all) u.push(e + c);
else return i(e + c);
}
return i(f(e, n, r + 1));
});
});
return n ? d(0).then((e) => n(null, e), n) : d(0);
};
n.exports = l, l.sync = (e, t) => {
t ||= {};
let { pathEnv: n, pathExt: r, pathExtExe: a } = c(e, t), l = [];
for (let s = 0; s < n.length; s++) {
let c = n[s], u = /^".*"$/.test(c) ? c.slice(1, -1) : c, d = i.join(u, e), f = !u && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d;
for (let e = 0; e < r.length; e++) {
let n = f + r[e];
try {
if (o.sync(n, { pathExt: a })) {
if (t.all) l.push(n);
else return n;
}
} catch {}
}
}
if (t.all && l.length) return l;
if (t.nothrow) return null;
throw s(e);
};
})), Gi = /* @__PURE__ */ i(((e, t) => {
var n = (e = {}) => {
let t = e.env || process.env;
return (e.platform || process.platform) === "win32" ? Object.keys(t).reverse().find((e) => e.toUpperCase() === "PATH") || "Path" : "PATH";
};
t.exports = n, t.exports.default = n;
})), Ki = /* @__PURE__ */ i(((t, n) => {
var r = e("path"), i = Wi(), a = Gi();
function o(e, t) {
let n = e.options.env || process.env, o = process.cwd(), s = e.options.cwd != null, c = s && process.chdir !== void 0 && !process.chdir.disabled;
if (c) try {
process.chdir(e.options.cwd);
} catch {}
let l;
try {
l = i.sync(e.command, {
path: n[a({ env: n })],
pathExt: t ? r.delimiter : void 0
});
} catch {} finally {
c && process.chdir(o);
}
return l &&= r.resolve(s ? e.options.cwd : "", l), l;
}
function s(e) {
return o(e) || o(e, !0);
}
n.exports = s;
})), qi = /* @__PURE__ */ i(((e, t) => {
var n = /([()\][%!^"`<>&|;, *?])/g;
function r(e) {
return e = e.replace(n, "^$1"), e;
}
function i(e, t) {
return e = `${e}`, e = e.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\""), e = e.replace(/(?=(\\+?)?)\1$/, "$1$1"), e = `"${e}"`, e = e.replace(n, "^$1"), t && (e = e.replace(n, "^$1")), e;
}
t.exports.command = r, t.exports.argument = i;
})), Ji = /* @__PURE__ */ i(((e, t) => {
t.exports = /^#!(.*)/;
})), Yi = /* @__PURE__ */ i(((e, t) => {
var n = Ji();
t.exports = (e = "") => {
let t = e.match(n);
if (!t) return null;
let [r, i] = t[0].replace(/#! ?/, "").split(" "), a = r.split("/").pop();
return a === "env" ? i : i ? `${a} ${i}` : a;
};
})), Xi = /* @__PURE__ */ i(((t, n) => {
var r = e("fs"), i = Yi();
function a(e) {
let t = Buffer.alloc(150), n;
try {
n = r.openSync(e, "r"), r.readSync(n, t, 0, 150, 0), r.closeSync(n);
} catch {}
return i(t.toString());
}
n.exports = a;
})), Zi = /* @__PURE__ */ i(((t, n) => {
var r = e("path"), i = Ki(), a = qi(), o = Xi(), s = process.platform === "win32", c = /\.(?:com|exe)$/i, l = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
function u(e) {
e.file = i(e);
let t = e.file && o(e.file);
return t ? (e.args.unshift(e.file), e.command = t, i(e)) : e.file;
}
function d(e) {
if (!s) return e;
let t = u(e), n = !c.test(t);
if (e.options.forceShell || n) {
let n = l.test(t);
e.command = r.normalize(e.command), e.command = a.command(e.command), e.args = e.args.map((e) => a.argument(e, n)), e.args = [
"/d",
"/s",
"/c",
`"${[e.command].concat(e.args).join(" ")}"`
], e.command = process.env.comspec || "cmd.exe", e.options.windowsVerbatimArguments = !0;
}
return e;
}
function f(e, t, n) {
t && !Array.isArray(t) && (n = t, t = null), t = t ? t.slice(0) : [], n = Object.assign({}, n);
let r = {
command: e,
args: t,
options: n,
file: void 0,
original: {
command: e,
args: t
}
};
return n.shell ? r : d(r);
}
n.exports = f;
})), Qi = /* @__PURE__ */ i(((e, t) => {
var n = process.platform === "win32";
function r(e, t) {
return Object.assign(/* @__PURE__ */ Error(`${t} ${e.command} ENOENT`), {
code: "ENOENT",
errno: "ENOENT",
syscall: `${t} ${e.command}`,
path: e.command,
spawnargs: e.args
});
}
function i(e, t) {
if (!n) return;
let r = e.emit;
e.emit = function(n, i) {
if (n === "exit") {
let n = a(i, t);
if (n) return r.call(e, "error", n);
}
return r.apply(e, arguments);
};
}
function a(e, t) {
return n && e === 1 && !t.file ? r(t.original, "spawn") : null;
}
function o(e, t) {
return n && e === 1 && !t.file ? r(t.original, "spawnSync") : null;
}
t.exports = {
hookChildProcess: i,
verifyENOENT: a,
verifyENOENTSync: o,
notFoundError: r
};
})), $i = /* @__PURE__ */ i(((t, n) => {
var r = e("child_process"), i = Zi(), a = Qi();
function o(e, t, n) {
let o = i(e, t, n), s = r.spawn(o.command, o.args, o.options);
return a.hookChildProcess(s, o), s;
}
function s(e, t, n) {
let o = i(e, t, n), s = r.spawnSync(o.command, o.args, o.options);
return s.error = s.error || a.verifyENOENTSync(s.status, o), s;
}
n.exports = o, n.exports.spawn = o, n.exports.sync = s, n.exports._parse = i, n.exports._enoent = a;
})), ea = /* @__PURE__ */ n((/* @__PURE__ */ i(((e, t) => {
var n = $i();
t.exports = (e, t, r = {}, i = {}) => {
r.rejectOnError === void 0 && (r.rejectOnError = !0);
let a = "", o = "", s = n(e, t, i);
return new Promise((e, t) => {
r.stdin !== void 0 && r.stdin != null && s.stdin.write(r.stdin), s.stdin.end(), s.stdout.on("data", (e) => {
a += e, r.stdout && r.stdout(e);
}), s.stderr.on("data", (e) => {
o += e, r.stderr && r.stderr(e);
}), r.rejectOnError && s.addListener("error", t), s.on("close", (n) => {
n !== 0 && r.rejectOnError ? t(o) : e({
stdout: a,
stderr: o
});
});
});
};
})))(), 1), ta = (e, t = process.platform) => t === "win32" && e !== "bun" ? [`${e}.cmd`, e] : [e];
async function na(e, t, n = {}, r) {
let i = ta(e), { rejectOnError: a = !0, stdout: o, stderr: s, ...c } = n;
for (let [e, n] of i.entries()) {
let l = "", u = "";
try {
return {
...await (0, ea.default)(n, t, {
...c,
rejectOnError: !0,
stdout: (e) => {
l += e, o?.(e);
},
stderr: (e) => {
u += e, s?.(e);
}
}, r),
command: [n, ...t].join(" ")
};
} catch (r) {
if (!(r instanceof Error)) {
if (a) throw r;
return {
stdout: l,
stderr: u,
command: [n, ...t].join(" ")
};
}
if (r.code !== "ENOENT" || e === i.length - 1) throw r;
}
}
throw Error(`No spawn commands available for ${e}`);
}
//#endregion
//#region node_modules/@streamparser/json/dist/mjs/utils/bufferedString.js
var ra = class {
constructor() {
this.decoder = new TextDecoder("utf-8", { fatal: !0 }), this.pending = [], this.string = "", this.byteLength = 0;
}
appendChar(e) {
this.pending.push(String.fromCharCode(e)), this.byteLength += 1;
}
appendBuf(e, t = 0, n = e.length) {
this.pending.push(this.decoder.decode(e.subarray(t, n))), this.byteLength += n - t;
}
appendCharCode(e) {
this.pending.push(String.fromCharCode(e));
}
reset() {
this.pending = [], this.string = "", this.byteLength = 0;
}
toString() {
return this.pending.length > 0 && (this.string += this.pending.join(""), this.pending = []), this.string;
}
}, ia = class {
constructor(e) {
this.decoder = new TextDecoder("utf-8", { fatal: !0 }), this.bufferOffset = 0, this.string = "", this.byteLength = 0, this.buffer = new Uint8Array(e);
}
appendChar(e) {
this.bufferOffset >= this.buffer.length && this.flushStringBuffer(), this.buffer[this.bufferOffset++] = e, this.byteLength += 1;
}
appendBuf(e, t = 0, n = e.length) {
let r = n - t;
if (this.bufferOffset + r > this.buffer.length && this.flushStringBuffer(), r > this.buffer.length) {
this.string += this.decoder.decode(e.subarray(t, n)), this.byteLength += r;
return;
}
this.buffer.set(e.subarray(t, n), this.bufferOffset), this.bufferOffset += r, this.byteLength += r;
}
appendCharCode(e) {
this.flushStringBuffer(), this.string += String.fromCharCode(e);
}
flushStringBuffer() {
this.string += this.decoder.decode(this.buffer.subarray(0, this.bufferOffset)), this.bufferOffset = 0;
}
reset() {
this.string = "", this.bufferOffset = 0, this.byteLength = 0;
}
toString() {
return this.flushStringBuffer(), this.string;
}
}, aa;
(function(e) {
e[e.LEFT_BRACE = 0] = "LEFT_BRACE", e[e.RIGHT_BRACE = 1] = "RIGHT_BRACE", e[e.LEFT_BRACKET = 2] = "LEFT_BRACKET", e[e.RIGHT_BRACKET = 3] = "RIGHT_BRACKET", e[e.COLON = 4] = "COLON", e[e.COMMA = 5] = "COMMA", e[e.TRUE = 6] = "TRUE", e[e.FALSE = 7] = "FALSE", e[e.NULL = 8] = "NULL", e[e.STRING = 9] = "STRING", e[e.NUMBER = 10] = "NUMBER", e[e.SEPARATOR = 11] = "SEPARATOR";
})(aa ||= {});
var Z = aa, oa;
(function(e) {
e[e.BACKSPACE = 8] = "BACKSPACE", e[e.FORM_FEED = 12] = "FORM_FEED", e[e.NEWLINE = 10] = "NEWLINE", e[e.CARRIAGE_RETURN = 13] = "CARRIAGE_RETURN", e[e.TAB = 9] = "TAB", e[e.SPACE = 32] = "SPACE", e[e.EXCLAMATION_MARK = 33] = "EXCLAMATION_MARK", e[e.QUOTATION_MARK = 34] = "QUOTATION_MARK", e[e.NUMBER_SIGN = 35] = "NUMBER_SIGN", e[e.DOLLAR_SIGN = 36] = "DOLLAR_SIGN", e[e.PERCENT_SIGN = 37] = "PERCENT_SIGN", e[e.AMPERSAND = 38] = "AMPERSAND", e[e.APOSTROPHE = 39] = "APOSTROPHE", e[e.LEFT_PARENTHESIS = 40] = "LEFT_PARENTHESIS", e[e.RIGHT_PARENTHESIS = 41] = "RIGHT_PARENTHESIS", e[e.ASTERISK = 42] = "ASTERISK", e[e.PLUS_SIGN = 43] = "PLUS_SIGN", e[e.COMMA = 44] = "COMMA", e[e.HYPHEN_MINUS = 45] = "HYPHEN_MINUS", e[e.FULL_STOP = 46] = "FULL_STOP", e[e.SOLIDUS = 47] = "SOLIDUS", e[e.DIGIT_ZERO = 48] = "DIGIT_ZERO", e[e.DIGIT_ONE = 49] = "DIGIT_ONE", e[e.DIGIT_TWO = 50] = "DIGIT_TWO", e[e.DIGIT_THREE = 51] = "DIGIT_THREE", e[e.DIGIT_FOUR = 52] = "DIGIT_FOUR", e[e.DIGIT_FIVE = 53] = "DIGIT_FIVE", e[e.DIGIT_SIX = 54] = "DIGIT_SIX", e[e.DIGIT_SEVEN = 55] = "DIGIT_SEVEN", e[e.DIGIT_EIGHT = 56] = "DIGIT_EIGHT", e[e.DIGIT_NINE = 57] = "DIGIT_NINE", e[e.COLON = 58] = "COLON", e[e.SEMICOLON = 59] = "SEMICOLON", e[e.LESS_THAN_SIGN = 60] = "LESS_THAN_SIGN", e[e.EQUALS_SIGN = 61] = "EQUALS_SIGN", e[e.GREATER_THAN_SIGN = 62] = "GREATER_THAN_SIGN", e[e.QUESTION_MARK = 63] = "QUESTION_MARK", e[e.COMMERCIAL_AT = 64] = "COMMERCIAL_AT", e[e.LATIN_CAPITAL_LETTER_A = 65] = "LATIN_CAPITAL_LETTER_A", e[e.LATIN_CAPITAL_LETTER_B = 66] = "LATIN_CAPITAL_LETTER_B", e[e.LATIN_CAPITAL_LETTER_C = 67] = "LATIN_CAPITAL_LETTER_C", e[e.LATIN_CAPITAL_LETTER_D = 68] = "LATIN_CAPITAL_LETTER_D", e[e.LATIN_CAPITAL_LETTER_E = 69] = "LATIN_CAPITAL_LETTER_E", e[e.LATIN_CAPITAL_LETTER_F = 70] = "LATIN_CAPITAL_LETTER_F", e[e.LATIN_CAPITAL_LETTER_G = 71] = "LATIN_CAPITAL_LETTER_G", e[e.LATIN_CAPITAL_LETTER_H = 72] = "LATIN_CAPITAL_LETTER_H", e[e.LATIN_CAPITAL_LETTER_I = 73] = "LATIN_CAPITAL_LETTER_I", e[e.LATIN_CAPITAL_LETTER_J = 74] = "LATIN_CAPITAL_LETTER_J", e[e.LATIN_CAPITAL_LETTER_K = 75] = "LATIN_CAPITAL_LETTER_K", e[e.LATIN_CAPITAL_LETTER_L = 76] = "LATIN_CAPITAL_LETTER_L", e[e.LATIN_CAPITAL_LETTER_M = 77] = "LATIN_CAPITAL_LETTER_M", e[e.LATIN_CAPITAL_LETTER_N = 78] = "LATIN_CAPITAL_LETTER_N", e[e.LATIN_CAPITAL_LETTER_O = 79] = "LATIN_CAPITAL_LETTER_O", e[e.LATIN_CAPITAL_LETTER_P = 80] = "LATIN_CAPITAL_LETTER_P", e[e.LATIN_CAPITAL_LETTER_Q = 81] = "LATIN_CAPITAL_LETTER_Q", e[e.LATIN_CAPITAL_LETTER_R = 82] = "LATIN_CAPITAL_LETTER_R", e[e.LATIN_CAPITAL_LETTER_S = 83] = "LATIN_CAPITAL_LETTER_S", e[e.LATIN_CAPITAL_LETTER_T = 84] = "LATIN_CAPITAL_LETTER_T", e[e.LATIN_CAPITAL_LETTER_U = 85] = "LATIN_CAPITAL_LETTER_U", e[e.LATIN_CAPITAL_LETTER_V = 86] = "LATIN_CAPITAL_LETTER_V", e[e.LATIN_CAPITAL_LETTER_W = 87] = "LATIN_CAPITAL_LETTER_W", e[e.LATIN_CAPITAL_LETTER_X = 88] = "LATIN_CAPITAL_LETTER_X", e[e.LATIN_CAPITAL_LETTER_Y = 89] = "LATIN_CAPITAL_LETTER_Y", e[e.LATIN_CAPITAL_LETTER_Z = 90] = "LATIN_CAPITAL_LETTER_Z", e[e.LEFT_SQUARE_BRACKET = 91] = "LEFT_SQUARE_BRACKET", e[e.REVERSE_SOLIDUS = 92] = "REVERSE_SOLIDUS", e[e.RIGHT_SQUARE_BRACKET = 93] = "RIGHT_SQUARE_BRACKET", e[e.CIRCUMFLEX_ACCENT = 94] = "CIRCUMFLEX_ACCENT", e[e.LOW_LINE = 95] = "LOW_LINE", e[e.GRAVE_ACCENT = 96] = "GRAVE_ACCENT", e[e.LATIN_SMALL_LETTER_A = 97] = "LATIN_SMALL_LETTER_A", e[e.LATIN_SMALL_LETTER_B = 98] = "LATIN_SMALL_LETTER_B", e[e.LATIN_SMALL_LETTER_C = 99] = "LATIN_SMALL_LETTER_C", e[e.LATIN_SMALL_LETTER_D = 100] = "LATIN_SMALL_LETTER_D", e[e.LATIN_SMALL_LETTER_E = 101] = "LATIN_SMALL_LETTER_E", e[e.LATIN_SMALL_LETTER_F = 102] = "LATIN_SMALL_LETTER_F", e[e.LATIN_SMALL_LETTER_G = 103] = "LATIN_SMALL_LETTER_G", e[e.LATIN_SMALL_LETTER_H = 104] = "LATIN_SMALL_LETTER_H", e[e.LATIN_SMALL_LETTER_I = 105] = "LATIN_SMALL_LETTER_I", e[e.LATIN_SMALL_LETTER_J = 106] = "LATIN_SMALL_LETTER_J", e[e.LATIN_SMALL_LETTER_K = 107] = "LATIN_SMALL_LETTER_K", e[e.LATIN_SMALL_LETTER_L = 108] = "LATIN_SMALL_LETTER_L", e[e.LATIN_SMALL_LETTER_M = 109] = "LATIN_SMALL_LETTER_M", e[e.LATIN_SMALL_LETTER_N = 110] = "LATIN_SMALL_LETTER_N", e[e.LATIN_SMALL_LETTER_O = 111] = "LATIN_SMALL_LETTER_O", e[e.LATIN_SMALL_LETTER_P = 112] = "LATIN_SMALL_LETTER_P", e[e.LATIN_SMALL_LETTER_Q = 113] = "LATIN_SMALL_LETTER_Q", e[e.LATIN_SMALL_LETTER_R = 114] = "LATIN_SMALL_LETTER_R", e[e.LATIN_SMALL_LETTER_S = 115] = "LATIN_SMALL_LETTER_S", e[e.LATIN_SMALL_LETTER_T = 116] = "LATIN_SMALL_LETTER_T", e[e.LATIN_SMALL_LETTER_U = 117] = "LATIN_SMALL_LETTER_U", e[e.LATIN_SMALL_LETTER_V = 118] = "LATIN_SMALL_LETTER_V", e[e.LATIN_SMALL_LETTER_W = 119] = "LATIN_SMALL_LETTER_W", e[e.LATIN_SMALL_LETTER_X = 120] = "LATIN_SMALL_LETTER_X", e[e.LATIN_SMALL_LETTER_Y = 121] = "LATIN_SMALL_LETTER_Y", e[e.LATIN_SMALL_LETTER_Z = 122] = "LATIN_SMALL_LETTER_Z", e[e.LEFT_CURLY_BRACKET = 123] = "LEFT_CURLY_BRACKET", e[e.VERTICAL_LINE = 124] = "VERTICAL_LINE", e[e.RIGHT_CURLY_BRACKET = 125] = "RIGHT_CURLY_BRACKET", e[e.TILDE = 126] = "TILDE";
})(oa ||= {});
var sa = {
34: 34,
92: 92,
47: 47,
98: 8,
102: 12,
110: 10,
114: 13,
116: 9
}, ca;
(function(e) {
e[e.START = 0] = "START", e[e.ENDED = 1] = "ENDED", e[e.ERROR = 2] = "ERROR", e[e.TRUE1 = 3] = "TRUE1", e[e.TRUE2 = 4] = "TRUE2", e[e.TRUE3 = 5] = "TRUE3", e[e.FALSE1 = 6] = "FALSE1", e[e.FALSE2 = 7] = "FALSE2", e[e.FALSE3 = 8] = "FALSE3", e[e.FALSE4 = 9] = "FALSE4", e[e.NULL1 = 10] = "NULL1", e[e.NULL2 = 11] = "NULL2", e[e.NULL3 = 12] = "NULL3", e[e.STRING_DEFAULT = 13] = "STRING_DEFAULT", e[e.STRING_AFTER_BACKSLASH = 14] = "STRING_AFTER_BACKSLASH", e[e.STRING_UNICODE_DIGIT_1 = 15] = "STRING_UNICODE_DIGIT_1", e[e.STRING_UNICODE_DIGIT_2 = 16] = "STRING_UNICODE_DIGIT_2", e[e.STRING_UNICODE_DIGIT_3 = 17] = "STRING_UNICODE_DIGIT_3", e[e.STRING_UNICODE_DIGIT_4 = 18] = "STRING_UNICODE_DIGIT_4", e[e.STRING_INCOMPLETE_CHAR = 19] = "STRING_INCOMPLETE_CHAR", e[e.NUMBER_AFTER_INITIAL_MINUS = 20] = "NUMBER_AFTER_INITIAL_MINUS", e[e.NUMBER_AFTER_INITIAL_ZERO = 21] = "NUMBER_AFTER_INITIAL_ZERO", e[e.NUMBER_AFTER_INITIAL_NON_ZERO = 22] = "NUMBER_AFTER_INITIAL_NON_ZERO", e[e.NUMBER_AFTER_FULL_STOP = 23] = "NUMBER_AFTER_FULL_STOP", e[e.NUMBER_AFTER_DECIMAL = 24] = "NUMBER_AFTER_DECIMAL", e[e.NUMBER_AFTER_E = 25] = "NUMBER_AFTER_E", e[e.NUMBER_AFTER_E_AND_SIGN = 26] = "NUMBER_AFTER_E_AND_SIGN", e[e.NUMBER_AFTER_E_AND_DIGIT = 27] = "NUMBER_AFTER_E_AND_DIGIT", e[e.SEPARATOR = 28] = "SEPARATOR", e[e.BOM_OR_START = 29] = "BOM_OR_START", e[e.BOM = 30] = "BOM";
})(ca ||= {});
function la(e) {
return (/* @__PURE__ */ "START.ENDED.ERROR.TRUE1.TRUE2.TRUE3.FALSE1.FALSE2.FALSE3.FALSE4.NULL1.NULL2.NULL3.STRING_DEFAULT.STRING_AFTER_BACKSLASH.STRING_UNICODE_DIGIT_1.STRING_UNICODE_DIGIT_2.STRING_UNICODE_DIGIT_3.STRING_UNICODE_DIGIT_4.STRING_INCOMPLETE_CHAR.NUMBER_AFTER_INITIAL_MINUS.NUMBER_AFTER_INITIAL_ZERO.NUMBER_AFTER_INITIAL_NON_ZERO.NUMBER_AFTER_FULL_STOP.NUMBER_AFTER_DECIMAL.NUMBER_AFTER_E.NUMBER_AFTER_E_AND_SIGN.NUMBER_AFTER_E_AND_DIGIT.SEPARATOR.BOM_OR_START.BOM".split("."))[e];
}
var ua = {
stringBufferSize: 0,
numberBufferSize: 0,
separator: void 0,
emitPartialTokens: !1
}, da = class e extends Error {
constructor(t) {
super(t), Object.setPrototypeOf(this, e.prototype);
}
};
function fa(e, t) {
if (t !== void 0 && (!Number.isInteger(t) || t < 0)) throw new da(`Invalid "${e}": ${t}. Expected a non-negative integer.`);
}
function pa(e) {
return e >= 194 && e <= 223 ? 2 : e <= 239 ? 3 : 4;
}
function ma(e, t) {
let n = t;
for (; n < e.length && e[n] >= 128;) {
let t = pa(e[n]);
if (n + t > e.length) break;
n += t;
}
return n;
}
var ha = class {
constructor(e) {
this.state = 29, this.bomIndex = 0, this.separatorIndex = 0, this.escapedCharsByteLength = 0, this.bytes_remaining = 0, this.bytes_in_sequence = 0, this.char_split_buffer = /* @__PURE__ */ new Uint8Array(4), this.encoder = new TextEncoder(), this.offset = -1, this.streamByteLength = 0, e = Object.assign(Object.assign({}, ua), e), fa("stringBufferSize", e.stringBufferSize), fa("numberBufferSize", e.numberBufferSize), this.emitPartialTokens = e.emitPartialTokens === !0, this.bufferedString = e.stringBufferSize && e.stringBufferSize > 4 ? new ia(e.stringBufferSize) : new ra(), this.bufferedNumber = e.numberBufferSize && e.numberBufferSize > 0 ? new ia(e.numberBufferSize) : new ra(), this.separator = e.separator, this.separatorBytes = e.separator ? this.encoder.encode(e.separator) : void 0;
}
get isEnded() {
return this.state === 1;
}
appendUnicodeCodeUnit(e) {
if (this.highSurrogate !== void 0) {
if (e >= 56320 && e <= 57343) {
let t = String.fromCharCode(this.highSurrogate, e), n = this.encoder.encode(t);
this.bufferedString.appendBuf(n), this.escapedCharsByteLength += 6 - n.byteLength, this.highSurrogate = void 0;
return;
}
this.flushPendingHighSurrogate();
}
if (e >= 55296 && e <= 56319) {
this.highSurrogate = e, this.escapedCharsByteLength += 6;
return;
}
if (e >= 56320 && e <= 57343) {
this.bufferedString.appendCharCode(e), this.escapedCharsByteLength += 6;
return;
}
let t = String.fromCharCode(e), n = this.encoder.encode(t);
this.bufferedString.appendBuf(n), this.escapedCharsByteLength += 6 - n.byteLength;
}
flushPendingHighSurrogate() {
this.highSurrogate !== void 0 && (this.bufferedString.appendCharCode(this.highSurrogate), this.highSurrogate = void 0);
}
startIncompleteChar(e, t) {
this.bytes_in_sequence = pa(e[t]), this.bytes_remaining = t + this.bytes_in_sequence - e.length, this.char_split_buffer.set(e.subarray(t)), this.state = 19;
}
write(e) {
try {
let t;
if (e instanceof Uint8Array) t = e;
else if (typeof e == "string") {
this.pendingStringSurrogate !== void 0 && (e = this.pendingStringSurrogate + e, this.pendingStringSurrogate = void 0);
let n = e.charCodeAt(e.length - 1);
n >= 55296 && n <= 56319 && (this.pendingStringSurrogate = e[e.length - 1], e = e.slice(0, -1)), t = this.encoder.encode(e);
} else if (ArrayBuffer.isView(e)) t = new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
else if (typeof e == "object" && e && typeof e[Symbol.iterator] == "function") t = Uint8Array.from(e);
else throw TypeError("Unexpected type. The `write` function only accepts Iterables (e.g. Arrays, Sets, Generators), TypedArrays and Strings.");
for (let n = 0; n < t.length; n += 1) {
let r = t[n];
switch (this.state) {
case 29:
if (r === 239) {
this.bom = [
239,
187,
191
], this.bomIndex += 1, this.state = 30;
continue;
}
if (e instanceof Uint16Array) {
if (r === 254) {
this.bom = [254, 255], this.bomIndex += 1, this.state = 30;
continue;
}
if (r === 255) {
this.bom = [255, 254], this.bomIndex += 1, this.state = 30;
continue;
}
}
if (e instanceof Uint32Array) {
if (r === 0) {
this.bom = [
0,
0,
254,
255
], this.bomIndex += 1, this.state = 30;
continue;
}
if (r === 255) {
this.bom = [
255,
254,
0,
0
], this.bomIndex += 1, this.state = 30;
continue;
}
}
case 0:
if (this.offset += 1, this.separatorBytes && r === this.separatorBytes[0]) {
if (this.separatorBytes.length === 1) {
this.state = 0, this.onToken({
token: Z.SEPARATOR,
value: this.separator,
offset: this.offset + this.separatorBytes.length - 1
});
continue;
}
this.state = 28;
continue;
}
if (r === 32 || r === 10 || r === 13 || r === 9) continue;
if (r === 123) {
this.onToken({
token: Z.LEFT_BRACE,
value: "{",
offset: this.offset
});
continue;
}
if (r === 125) {
this.onToken({
token: Z.RIGHT_BRACE,
value: "}",
offset: this.offset
});
continue;
}
if (r === 91) {
this.onToken({
token: Z.LEFT_BRACKET,
value: "[",
offset: this.offset
});
continue;
}
if (r === 93) {
this.onToken({
token: Z.RIGHT_BRACKET,
value: "]",
offset: this.offset
});
continue;
}
if (r === 58) {
this.onToken({
token: Z.COLON,
value: ":",
offset: this.offset
});
continue;
}
if (r === 44) {
this.onToken({
token: Z.COMMA,
value: ",",
offset: this.offset
});
continue;
}
if (r === 116) {
this.state = 3;
continue;
}
if (r === 102) {
this.state = 6;
continue;
}
if (r === 110) {
this.state = 10;
continue;
}
if (r === 34) {
this.bufferedString.reset(), this.escapedCharsByteLength = 0, this.state = 13;
continue;
}
if (r >= 49 && r <= 57) {
this.bufferedNumber.reset(), this.bufferedNumber.appendChar(r), this.state = 22;
continue;
}
if (r === 48) {
this.bufferedNumber.reset(), this.bufferedNumber.appendChar(r), this.state = 21;
continue;
}
if (r === 45) {
this.bufferedNumber.reset(), this.bufferedNumber.appendChar(r), this.state = 20;
continue;
}
break;
case 13:
if (r === 34) {
this.flushPendingHighSurrogate();
let e = this.bufferedString.toString();
this.state = 0, this.onToken({
token: Z.STRING,
value: e,
offset: this.offset
}), this.offset += this.escapedCharsByteLength + this.bufferedString.byteLength + 1;
continue;
}
if (r === 92) {
this.state = 14;
continue;
}
if (r >= 128) {
this.flushPendingHighSurrogate();
let e = ma(t, n);
e > n && (this.bufferedString.appendBuf(t, n, e), n = e - 1), e < t.length && t[e] >= 128 && (this.startIncompleteChar(t, e), n = t.length - 1);
continue;
}
if (r >= 32) {
this.flushPendingHighSurrogate();
let e = n;
for (; e < t.length;) {
let n = t[e];
if (n < 32 || n >= 128 || n === 34 || n === 92) break;
e += 1;
}
if (e - n >= 16) this.bufferedString.appendBuf(t, n, e);
else for (let r = n; r < e; r += 1) this.bufferedString.appendChar(t[r]);
n = e - 1;
continue;
}
break;
case 19: {
let e = Math.min(this.bytes_remaining, t.length - n);
if (this.char_split_buffer.set(t.subarray(n, n + e), this.bytes_in_sequence - this.bytes_remaining), this.bytes_remaining -= e, this.bytes_remaining > 0) {
n = t.length - 1;
continue;
}
this.bufferedString.appendBuf(this.char_split_buffer, 0, this.bytes_in_sequence), n += e - 1, this.state = 13;
continue;
}
case 14: {
let e = sa[r];
if (e) {
this.flushPendingHighSurrogate(), this.bufferedString.appendChar(e), this.escapedCharsByteLength += 1, this.state = 13;
continue;
}
if (r === 117) {
this.unicode = "", this.state = 15;
continue;
}
break;
}
case 15:
case 16:
case 17:
if (r >= 48 && r <= 57 || r >= 65 && r <= 70 || r >= 97 && r <= 102) {
this.unicode += String.fromCharCode(r), this.state += 1;
continue;
}
break;
case 18:
if (r >= 48 && r <= 57 || r >= 65 && r <= 70 || r >= 97 && r <= 102) {
let e = parseInt(this.unicode + String.fromCharCode(r), 16);
this.appendUnicodeCodeUnit(e), this.state = 13;
continue;
}
break;
case 20:
if (r === 48) {
this.bufferedNumber.appendChar(r), this.state = 21;
continue;
}
if (r >= 49 && r <= 57) {
this.bufferedNumber.appendChar(r), this.state = 22;
continue;
}
break;
case 21:
if (r === 46) {
this.bufferedNumber.appendChar(r), this.state = 23;
continue;
}
if (r === 101 || r === 69) {
this.bufferedNumber.appendChar(r), this.state = 25;
continue;
}
--n, this.state = 0, this.emitNumber();
continue;
case 22:
if (r >= 48 && r <= 57) {
this.bufferedNumber.appendChar(r);
continue;
}
if (r === 46) {
this.bufferedNumber.appendChar(r), this.state = 23;
continue;
}
if (r === 101 || r === 69) {
this.bufferedNumber.appendChar(r), this.state = 25;
continue;
}
--n, this.state = 0, this.emitNumber();
continue;
case 23:
if (r >= 48 && r <= 57) {
this.bufferedNumber.appendChar(r), this.state = 24;
continue;
}
break;
case 24:
if (r >= 48 && r <= 57) {
this.bufferedNumber.appendChar(r);
continue;
}
if (r === 101 || r === 69) {
this.bufferedNumber.appendChar(r), this.state = 25;
continue;
}
--n, this.state = 0, this.emitNumber();
continue;
case 25: if (r === 43 || r === 45) {
this.bufferedNumber.appendChar(r), this.state = 26;
continue;
}
case 26:
if (r >= 48 && r <= 57) {
this.bufferedNumber.appendChar(r), this.state = 27;
continue;
}
break;
case 27:
if (r >= 48 && r <= 57) {
this.bufferedNumber.appendChar(r);
continue;
}
--n, this.state = 0, this.emitNumber();
continue;
case 3:
if (r === 114) {
this.state = 4;
continue;
}
break;
case 4:
if (r === 117) {
this.state = 5;
continue;
}
break;
case 5:
if (r === 101) {
this.state = 0, this.onToken({
token: Z.TRUE,
value: !0,
offset: this.offset
}), this.offset += 3;
continue;
}
break;
case 6:
if (r === 97) {
this.state = 7;
continue;
}
break;
case 7:
if (r === 108) {
this.state = 8;
continue;
}
break;
case 8:
if (r === 115) {
this.state = 9;
continue;
}
break;
case 9:
if (r === 101) {
this.state = 0, this.onToken({
token: Z.FALSE,
value: !1,
offset: this.offset
}), this.offset += 4;
continue;
}
break;
case 10:
if (r === 117) {
this.state = 11;
continue;
}
break;
case 11:
if (r === 108) {
this.state = 12;
continue;
}
break;
case 12:
if (r === 108) {
this.state = 0, this.onToken({
token: Z.NULL,
value: null,
offset: this.offset
}), this.offset += 3;
continue;
}
break;
case 28:
if (this.separatorIndex += 1, !this.separatorBytes || r !== this.separatorBytes[this.separatorIndex]) break;
this.separatorIndex === this.separatorBytes.length - 1 && (this.state = 0, this.onToken({
token: Z.SEPARATOR,
value: this.separator,
offset: this.offset + this.separatorIndex
}), this.separatorIndex = 0);
continue;
case 30:
if (r === this.bom[this.bomIndex]) {
if (this.bomIndex === this.bom.length - 1) {
this.state = 0, this.bom = void 0, this.bomIndex = 0;
continue;
}
this.bomIndex += 1;
continue;
}
break;
case 1: if (r === 32 || r === 10 || r === 13 || r === 9) continue;
}
throw new da(`Unexpected "${String.fromCharCode(r)}" at chunk position "${n}" (absolute position "${this.streamByteLength + n}") in state ${la(this.state)}`);
}
if (this.streamByteLength += t.length, this.emitPartialTokens) switch (this.state) {
case 3:
case 4:
case 5:
this.onToken({
token: Z.TRUE,
value: !0,
offset: this.offset,
partial: !0
});
break;
case 6:
case 7:
case 8:
case 9:
this.onToken({
token: Z.FALSE,
value: !1,
offset: this.offset,
partial: !0
});
break;
case 10:
case 11:
case 12:
this.onToken({
token: Z.NULL,
value: null,
offset: this.offset,
partial: !0
});
break;
case 13: {
let e = this.bufferedString.toString();
this.onToken({
token: Z.STRING,
value: e,
offset: this.offset,
partial: !0
});
break;
}
case 21:
case 22:
case 24:
case 27: try {
this.onToken({
token: Z.NUMBER,
value: this.parseNumber(this.bufferedNumber.toString()),
offset: this.offset,
partial: !0
});
} catch {}
}
} catch (e) {
this.error(e);
}
}
emitNumber() {
this.onToken({
token: Z.NUMBER,
value: this.parseNumber(this.bufferedNumber.toString()),
offset: this.offset
}), this.offset += this.bufferedNumber.byteLength - 1;
}
parseNumber(e) {
return Number(e);
}
error(e) {
this.state !== 1 && (this.state = 2), this.onError(e);
}
end() {
switch (this.state) {
case 21:
case 22:
case 24:
case 27:
this.state = 1, this.emitNumber(), this.onEnd();
break;
case 29:
case 0:
case 2:
this.state = 1, this.onEnd();
break;
default: this.error(new da(`Tokenizer ended in the middle of a token (state: ${la(this.state)}). Either not all the data was received or the data was invalid.`));
}
}
onToken(e) {
throw new da("Can't emit tokens before the \"onToken\" callback has been set up.");
}
onError(e) {
throw e;
}
onEnd() {}
}, ga;
(function(e) {
e[e.VALUE = 0] = "VALUE", e[e.KEY = 1] = "KEY", e[e.COLON = 2] = "COLON", e[e.COMMA = 3] = "COMMA", e[e.ENDED = 4] = "ENDED", e[e.ERROR = 5] = "ERROR", e[e.SEPARATOR = 6] = "SEPARATOR";
})(ga ||= {});
function _a(e) {
return [
"VALUE",
"KEY",
"COLON",
"COMMA",
"ENDED",
"ERROR",
"SEPARATOR"
][e];
}
function va(e, t, n) {
if (t === "__proto__") {
Object.defineProperty(e, t, {
value: n,
writable: !0,
enumerable: !0,
configurable: !0
});
return;
}
e[t] = n;
}
var ya = {
paths: void 0,
keepStack: !0,
separator: void 0,
emitPartialValues: !1
}, ba = class e extends Error {
constructor(t) {
super(t), Object.setPrototypeOf(this, e.prototype);
}
}, xa = class {
constructor(e) {
if (this.state = 0, this.mode = void 0, this.key = void 0, this.value = void 0, this.stack = [], this.memberCount = 0, e = Object.assign(Object.assign({}, ya), e), e.paths) {
let t = {
children: /* @__PURE__ */ new Map(),
terminal: !1
}, n = !1;
for (let r of e.paths) {
if (r === void 0 || r === "$*") {
n = !0;
continue;
}
if (!r.startsWith("$")) throw new ba(`Invalid selector "${r}". Should start with "$".`);
let e = r.split(".").slice(1);
if (e.includes("")) throw new ba(`Invalid selector "${r}". ".." syntax not supported.`);
let i = t;
for (let t of e) {
let e = i.children.get(t);
e || (e = {
children: /* @__PURE__ */ new Map(),
terminal: !1
}, i.children.set(t, e)), i = e;
}
i.terminal = !0;
}
n || (this.selectorTrie = t);
}
this.keepStack = e.keepStack || !1, this.separator = e.separator, e.emitPartialValues || (this.emitPartial = () => {});
}
shouldEmit() {
return !this.selectorTrie || this.matchesSelector(this.selectorTrie, 0);
}
matchesSelector(e, t) {
let n = this.stack.length;
if (t === n) return e.terminal;
let r = t < n - 1 ? this.stack[t + 1].key : this.key, i = e.children.get("*");
if (i && this.matchesSelector(i, t + 1)) return !0;
if (e.children.size > +!!i) {
let n = r?.toString();
if (n !== void 0) {
let r = e.children.get(n);
if (r && this.matchesSelector(r, t + 1)) return !0;
}
}
return !1;
}
push() {
this.stack.push({
key: this.key,
value: this.value,
mode: this.mode,
emit: this.shouldEmit(),
memberCount: this.memberCount
});
}
pop() {
let e = this.value, t;
({key: this.key, value: this.value, mode: this.mode, emit: t, memberCount: this.memberCount} = this.stack.pop()), this.state = this.mode === void 0 ? 0 : 3, this.emit(e, t);
}
emit(e, t) {
!this.keepStack && this.value && this.stack.every((e) => !e.emit) && (Array.isArray(this.value) ? --this.value.length : delete this.value[this.key]), t && this.onValue({
value: e,
key: this.key,
parent: this.value,
stack: this.stack
}), this.stack.length === 0 && (this.separator ? this.state = 6 : this.separator === void 0 && this.end());
}
emitPartial(e) {
if (this.shouldEmit()) {
if (this.state === 1) {
this.onValue({
value: void 0,
key: e,
parent: this.value,
stack: this.stack,
partial: !0
});
return;
}
this.onValue({
value: e,
key: this.key,
parent: this.value,
stack: this.stack,
partial: !0
});
}
}
get isEnded() {
return this.state === 4;
}
write({ token: e, value: t, partial: n }) {
try {
if (n) {
if (this.state !== 0 && this.state !== 1) throw new ba(`Unexpected partial ${Z[e]} (${JSON.stringify(t)}) in state ${_a(this.state)}`);
this.emitPartial(t);
return;
}
if (this.state === 0) {
if (e === Z.STRING || e === Z.NUMBER || e === Z.TRUE || e === Z.FALSE || e === Z.NULL) {
this.mode === 0 ? (va(this.value, this.key, t), this.state = 3, this.memberCount++) : this.mode === 1 && (this.value.push(t), this.state = 3, this.memberCount++), this.emit(t, this.shouldEmit());
return;
}
if (e === Z.LEFT_BRACE) {
if (this.memberCount++, this.push(), this.mode === 0) {
let e = {};
va(this.value, this.key, e), this.value = e;
} else if (this.mode === 1) {
let e = {};
this.value.push(e), this.value = e;
} else this.value = {};
this.mode = 0, this.state = 1, this.key = void 0, this.memberCount = 0, this.emitPartial();
return;
}
if (e === Z.LEFT_BRACKET) {
if (this.memberCount++, this.push(), this.mode === 0) {
let e = [];
va(this.value, this.key, e), this.value = e;
} else if (this.mode === 1) {
let e = [];
this.value.push(e), this.value = e;
} else this.value = [];
this.mode = 1, this.state = 0, this.key = 0, this.memberCount = 0, this.emitPartial();
return;
}
if (this.mode === 1 && e === Z.RIGHT_BRACKET && this.memberCount === 0) {
this.pop();
return;
}
}
if (this.state === 1) {
if (e === Z.STRING) {
this.key = t, this.state = 2, this.emitPartial();
return;
}
if (e === Z.RIGHT_BRACE && this.memberCount === 0) {
this.pop();
return;
}
}
if (this.state === 2 && e === Z.COLON) {
this.state = 0;
return;
}
if (this.state === 3) {
if (e === Z.COMMA) {
if (this.mode === 1) {
this.state = 0, this.key += 1;
return;
}
/* istanbul ignore else */
if (this.mode === 0) {
this.state = 1;
return;
}
}
if (e === Z.RIGHT_BRACE && this.mode === 0 || e === Z.RIGHT_BRACKET && this.mode === 1) {
this.pop();
return;
}
}
if (this.state === 6 && e === Z.SEPARATOR && t === this.separator) {
this.state = 0;
return;
}
if (e === Z.SEPARATOR && this.state !== 6 && Array.from(t).map((e) => e.charCodeAt(0)).every((e) => e === 32 || e === 10 || e === 13 || e === 9)) return;
throw new ba(`Unexpected ${Z[e]} (${JSON.stringify(t)}) in state ${_a(this.state)}`);
} catch (e) {
this.error(e);
}
}
error(e) {
this.state !== 4 && (this.state = 5), this.onError(e);
}
end() {
this.state !== 0 && this.state !== 6 || this.stack.length > 0 ? this.error(/* @__PURE__ */ Error(`Parser ended in mid-parsing (state: ${_a(this.state)}). Either not all the data was received or the data was invalid.`)) : (this.state = 4, this.onEnd());
}
onValue(e) {
throw new ba("Can't emit data before the \"onValue\" callback has been set up.");
}
onError(e) {
throw e;
}
onEnd() {}
}, Sa = class {
constructor(e = {}) {
this.tokenizer = new ha(e), this.tokenParser = new xa(e), this.tokenizer.onToken = this.tokenParser.write.bind(this.tokenParser), this.tokenizer.onEnd = () => {
this.tokenParser.isEnded || this.tokenParser.end();
}, this.tokenParser.onError = this.tokenizer.error.bind(this.tokenizer), this.tokenParser.onEnd = () => {
this.tokenizer.isEnded || this.tokenizer.end();
};
}
get isEnded() {
return this.tokenizer.isEnded && this.tokenParser.isEnded;
}
write(e) {
this.tokenizer.write(e);
}
end() {
this.tokenizer.end();
}
set onToken(e) {
this.tokenizer.onToken = (t) => {
e(t), this.tokenParser.write(t);
};
}
set onValue(e) {
this.tokenParser.onValue = e;
}
set onError(e) {
this.tokenizer.onError = e;
}
set onEnd(e) {
this.tokenParser.onEnd = () => {
this.tokenizer.isEnded || this.tokenizer.end(), e.call(this.tokenParser);
};
}
}, Ca;
(function(e) {
e[e.OBJECT = 0] = "OBJECT", e[e.ARRAY = 1] = "ARRAY";
})(Ca ||= {});
//#endregion
//#region node_modules/camelcase/index.js
var wa = /[\p{Lu}]/u, Ta = /[\p{Ll}]/u, Ea = /^[\p{Lu}](?![\p{Lu}])/u, Da = /[_.\- ]+/, Oa = /([\p{Alpha}\p{N}_]|$)/u, ka = RegExp("^" + Da.source), Aa = new RegExp(Da.source + Oa.source, "gu"), ja = new RegExp(String.raw`\d+` + Oa.source, "gu"), Ma = (e, t, n, r) => {
let i = !1, a = !1, o = !1, s = !1;
for (let c = 0; c < e.length; c++) {
let l = e[c];
s = c > 2 ? e[c - 3] === "-" : !0, i && wa.test(l) ? (e = e.slice(0, c) + "-" + e.slice(c), i = !1, o = a, a = !0, c++) : a && o && Ta.test(l) && (!s || r) ? (e = e.slice(0, c - 1) + "-" + e.slice(c - 1), o = a, a = !1, i = !0) : (i = t(l) === l && n(l) !== l, o = a, a = n(l) === l && t(l) !== l);
}
return e;
}, Na = (e, t) => e.replace(Ea, (e) => t(e)), Pa = (e, t, n) => {
let r = "", i = !1, a = !1, o = [...e];
for (let e = 0; e < o.length; e++) {
let s = o[e], c = wa.test(s), l = e + 1 < o.length && wa.test(o[e + 1]);
i && /[\p{Alpha}]/u.test(s) ? (r += s, i = !1, a = c) : n && c && (a || l) ? (r += s, a = !0) : /\d/.test(s) ? (r += s, i = !0, a = !1) : Da.test(s) ? (r += s, a = !1) : (r += t(s), i = !1, a = !1);
}
return r;
}, Fa = (e, t, { capitalizeAfterNumber: n }) => {
let r = n ? (e, n, r, i) => {
let a = i.charAt(r + e.length);
return Da.test(a) ? e : n ? e.slice(0, -n.length) + t(n) : e;
} : (e) => e;
return e.replaceAll(ja, r).replaceAll(Aa, (e, n) => t(n));
};
function Ia(e, t) {
if (!(typeof e == "string" || Array.isArray(e))) throw TypeError("Expected the input to be `string | string[]`");
if (t = {
pascalCase: !1,
preserveConsecutiveUppercase: !1,
capitalizeAfterNumber: !0,
...t
}, e = Array.isArray(e) ? e.map((e) => e.trim()).filter((e) => e.length > 0).join("-") : e.trim(), e.length === 0) return "";
let n = e.match(/^[_$]*/)[0];
if (e = e.slice(n.length), e.length === 0) return n;
let r = t.locale === !1 ? (e) => e.toLowerCase() : (e) => e.toLocaleLowerCase(t.locale), i = t.locale === !1 ? (e) => e.toUpperCase() : (e) => e.toLocaleUpperCase(t.locale);
return e.length === 1 ? Da.test(e) ? n : n + (t.pascalCase ? i(e) : r(e)) : (e !== r(e) && (e = Ma(e, r, i, t.preserveConsecutiveUppercase)), e = e.replace(ka, ""), e = t.capitalizeAfterNumber ? t.preserveConsecutiveUppercase ? Na(e, r) : r(e) : Pa(e, r, t.preserveConsecutiveUppercase), t.pascalCase && e.length > 0 && (e = i(e[0]) + e.slice(1)), n + Fa(e, i, t));
}
//#endregion
//#region node_modules/yocto-queue/index.js
var La = /* @__PURE__ */ n((/* @__PURE__ */ i(((e, t) => {
function n(e, t) {
var n = t && t.cache ? t.cache : f, r = t && t.serializer ? t.serializer : u;
return (t && t.strategy ? t.strategy : s)(e, {
cache: n,
serializer: r
});
}
function r(e) {
return e == null || typeof e == "number" || typeof e == "boolean";
}
function i(e, t, n, i) {
var a = r(i) ? i : n(i), o = t.get(a);
return o === void 0 && (o = e.call(this, i), t.set(a, o)), o;
}
function a(e, t, n) {
var r = Array.prototype.slice.call(arguments, 3), i = n(r), a = t.get(i);
return a === void 0 && (a = e.apply(this, r), t.set(i, a)), a;
}
function o(e, t, n, r, i) {
return n.bind(t, e, r, i);
}
function s(e, t) {
var n = e.length === 1 ? i : a;
return o(e, this, n, t.cache.create(), t.serializer);
}
function c(e, t) {
var n = a;
return o(e, this, n, t.cache.create(), t.serializer);
}
function l(e, t) {
var n = i;
return o(e, this, n, t.cache.create(), t.serializer);
}
function u() {
return JSON.stringify(arguments);
}
function d() {
this.cache = Object.create(null);
}
d.prototype.has = function(e) {
return e in this.cache;
}, d.prototype.get = function(e) {
return this.cache[e];
}, d.prototype.set = function(e, t) {
this.cache[e] = t;
};
var f = { create: function() {
return new d();
} };
t.exports = n, t.exports.strategies = {
variadic: c,
monadic: l
};
})))(), 1), Ra = class {
value;
next;
constructor(e) {
this.value = e;
}
}, za = class {
#e;
#t;
#n;
constructor() {
this.clear();
}
enqueue(e) {
let t = new Ra(e);
this.#e ? (this.#t.next = t, this.#t = t) : (this.#e = t, this.#t = t), this.#n++;
}
dequeue() {
let e = this.#e;
if (e) return this.#e = this.#e.next, this.#n--, this.#e || (this.#t = void 0), e.value;
}
peek() {
if (this.#e) return this.#e.value;
}
clear() {
this.#e = void 0, this.#t = void 0, this.#n = 0;
}
get size() {
return this.#n;
}
*[Symbol.iterator]() {
let e = this.#e;
for (; e;) yield e.value, e = e.next;
}
*drain() {
for (; this.#e;) yield this.dequeue();
}
};
//#endregion
//#region node_modules/p-limit/index.js
function Ba(e) {
if (!((Number.isInteger(e) || e === Infinity) && e > 0)) throw TypeError("Expected `concurrency` to be a number from 1 and up");
let t = new za(), n = 0, r = () => {
n--, t.size > 0 && t.dequeue()();
}, i = async (e, t, i) => {
n++;
let a = (async () => e(...i))();
t(a);
try {
await a;
} catch {}
r();
}, a = (r, a, o) => {
t.enqueue(i.bind(void 0, r, a, o)), (async () => {
await Promise.resolve(), n < e && t.size > 0 && t.dequeue()();
})();
}, o = (e, ...t) => new Promise((n) => {
a(e, n, t);
});
return Object.defineProperties(o, {
activeCount: { get: () => n },
pendingCount: { get: () => t.size },
clearQueue: { value: () => {
t.clear();
} }
}), o;
}
//#endregion
//#region node_modules/p-locate/index.js
var Va = class extends Error {
constructor(e) {
super(), this.value = e;
}
}, Ha = async (e, t) => t(await e), Ua = async (e) => {
let t = await Promise.all(e);
if (t[1] === !0) throw new Va(t[0]);
return !1;
};
async function Wa(e, t, { concurrency: n = Infinity, preserveOrder: r = !0 } = {}) {
let i = Ba(n), a = [...e].map((e) => [e, i(Ha, e, t)]), o = Ba(r ? 1 : Infinity);
try {
await Promise.all(a.map((e) => o(Ua, e)));
} catch (e) {
if (e instanceof Va) return e.value;
throw e;
}
}
//#endregion
//#region node_modules/locate-path/index.js
var Ga = {
directory: "isDirectory",
file: "isFile"
};
function Ka(e) {
if (!(e === "both" || Object.hasOwn(Ga, e))) throw Error(`Invalid type specified: ${e}`);
}
var qa = (e, t) => e === "both" ? t.isFile() || t.isDirectory() : t[Ga[e]](), Ja = (e) => e instanceof URL ? g(e) : e;
async function Ya(e, { cwd: t = p.cwd(), type: n = "file", allowSymlinks: r = !0, concurrency: i, preserveOrder: a } = {}) {
Ka(n), t = Ja(t);
let s = r ? b.stat : b.lstat;
return Wa(e, async (e) => {
try {
return qa(n, await s(o.resolve(t, e)));
} catch {
return !1;
}
}, {
concurrency: i,
preserveOrder: a
});
}
function Xa(e, { cwd: t = p.cwd(), type: n = "file", allowSymlinks: r = !0 } = {}) {
Ka(n), t = Ja(t);
let i = r ? y.statSync : y.lstatSync;
for (let r of e) try {
let e = i(o.resolve(t, r), { throwIfNoEntry: !1 });
if (!e) continue;
if (qa(n, e)) return r;
} catch {}
}
d(v);
function Za(e) {
return e instanceof URL ? g(e) : e;
}
//#endregion
//#region node_modules/find-up/index.js
var Qa = Symbol("findUpStop");
async function $a(e, t = {}) {
let n = o.resolve(Za(t.cwd) ?? ""), { root: r } = o.parse(n), i = o.resolve(n, Za(t.stopAt) ?? r), a = t.limit ?? Infinity, s = [e].flat(), c = async (t) => {
if (typeof e != "function") return Ya(s, t);
let n = await e(t.cwd);
return typeof n == "string" ? Ya([n], t) : n;
}, l = [];
for (;;) {
let e = await c({
...t,
cwd: n
});
if (e === Qa || (e && l.push(o.resolve(n, e)), n === i || l.length >= a)) break;
n = o.dirname(n);
}
return l;
}
function eo(e, t = {}) {
let n = o.resolve(Za(t.cwd) ?? ""), { root: r } = o.parse(n), i = o.resolve(n, Za(t.stopAt) ?? r), a = t.limit ?? Infinity, s = [e].flat(), c = (t) => {
if (typeof e != "function") return Xa(s, t);
let n = e(t.cwd);
return typeof n == "string" ? Xa([n], t) : n;
}, l = [];
for (;;) {
let e = c({
...t,
cwd: n
});
if (e === Qa || (e && l.push(o.resolve(n, e)), n === i || l.length >= a)) break;
n = o.dirname(n);
}
return l;
}
async function to(e, t = {}) {
return (await $a(e, {
...t,
limit: 1
}))[0];
}
function no(e, t = {}) {
return eo(e, {
...t,
limit: 1
})[0];
}
//#endregion
//#region node_modules/untildify/index.js
var ro = /* @__PURE__ */ n((/* @__PURE__ */ i(((e, t) => {
var { hasOwnProperty: n } = Object.prototype, r = (e, t = {}) => {
typeof t == "string" && (t = { section: t }), t.align = t.align === !0, t.newline = t.newline === !0, t.sort = t.sort === !0, t.whitespace = t.whitespace === !0 || t.align === !0, t.platform = t.platform || typeof process < "u" && process.platform, t.bracketedArray = t.bracketedArray !== !1;
/* istanbul ignore next */
let n = t.platform === "win32" ? "\r\n" : "\n", a = t.whitespace ? " = " : "=", o = [], c = t.sort ? Object.keys(e).sort() : Object.keys(e), l = 0;
t.align && (l = s(c.filter((t) => e[t] === null || Array.isArray(e[t]) || typeof e[t] != "object").map((t) => Array.isArray(e[t]) ? `${t}[]` : t).concat([""]).reduce((e, t) => s(e).length >= s(t).length ? e : t)).length);
let u = "", d = t.bracketedArray ? "[]" : "";
for (let t of c) {
let r = e[t];
if (r && Array.isArray(r)) for (let e of r) u += s(`${t}${d}`).padEnd(l, " ") + a + s(e) + n;
else r && typeof r == "object" ? o.push(t) : u += s(t).padEnd(l, " ") + a + s(r) + n;
}
t.section && u.length && (u = "[" + s(t.section) + "]" + (t.newline ? n + n : n) + u);
for (let a of o) {
let o = i(a, ".").join("\\."), s = (t.section ? t.section + "." : "") + o, c = r(e[a], {
...t,
section: s
});
u.length && c.length && (u += n), u += c;
}
return u;
};
function i(e, t) {
var n = 0, r = 0, i = 0, a = [];
do
if (i = e.indexOf(t, n), i !== -1) {
if (n = i + t.length, i > 0 && e[i - 1] === "\\") continue;
a.push(e.slice(r, i)), r = i + t.length;
}
while (i !== -1);
return a.push(e.slice(r)), a;
}
var a = (e, t = {}) => {
t.bracketedArray = t.bracketedArray !== !1;
let r = Object.create(null), a = r, o = null, s = /^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i, l = e.split(/[\r\n]+/g), u = {};
for (let e of l) {
if (!e || e.match(/^\s*[;#]/) || e.match(/^\s*$/)) continue;
let i = e.match(s);
if (!i) continue;
if (i[1] !== void 0) {
if (o = c(i[1]), o === "__proto__") {
a = Object.create(null);
continue;
}
a = r[o] = r[o] || Object.create(null);
continue;
}
let l = c(i[2]), d;
t.bracketedArray ? d = l.length > 2 && l.slice(-2) === "[]" : (u[l] = (u?.[l] || 0) + 1, d = u[l] > 1);
let f = d && l.endsWith("[]") ? l.slice(0, -2) : l;
if (f === "__proto__") continue;
let p = !i[3] || c(i[4]), m = p === "true" || p === "false" || p === "null" ? JSON.parse(p) : p;
d && (n.call(a, f) ? Array.isArray(a[f]) || (a[f] = [a[f]]) : a[f] = []), Array.isArray(a[f]) ? a[f].push(m) : a[f] = m;
}
let d = [];
for (let e of Object.keys(r)) {
if (!n.call(r, e) || typeof r[e] != "object" || Array.isArray(r[e])) continue;
let t = i(e, ".");
a = r;
let o = t.pop(), s = o.replace(/\\\./g, ".");
for (let e of t) e !== "__proto__" && ((!n.call(a, e) || typeof a[e] != "object") && (a[e] = Object.create(null)), a = a[e]);
(a !== r || s !== o) && (a[s] = r[e], d.push(e));
}
for (let e of d) delete r[e];
return r;
}, o = (e) => e.startsWith("\"") && e.endsWith("\"") || e.startsWith("'") && e.endsWith("'"), s = (e) => typeof e != "string" || e.match(/[=\r\n]/) || e.match(/^\[/) || e.length > 1 && o(e) || e !== e.trim() ? JSON.stringify(e) : e.split(";").join("\\;").split("#").join("\\#"), c = (e) => {
if (e = (e || "").trim(), o(e)) {
e.charAt(0) === "'" && (e = e.slice(1, -1));
try {
e = JSON.parse(e);
} catch {}
} else {
let t = !1, n = "";
for (let r = 0, i = e.length; r < i; r++) {
let i = e.charAt(r);
if (t) "\\;#".indexOf(i) === -1 ? n += "\\" + i : n += i, t = !1;
else if (";#".indexOf(i) !== -1) break;
else i === "\\" ? t = !0 : n += i;
}
return t && (n += "\\"), n.trim();
}
return e;
};
t.exports = {
parse: a,
decode: a,
stringify: r,
encode: r,
safe: s,
unsafe: c
};
})))(), 1), io, ao;
function oo(e) {
if (typeof e != "string") throw TypeError(`Expected a string, got ${typeof e}`);
if (io === void 0 && (io = c.homedir()), io && /^~(?=$|\/|\\)/.test(e)) return e.replace(/^~/, io);
let t = e.match(/^~([^/\\]+)(.*)/);
if (t && (ao === void 0 && (ao = c.userInfo().username), ao)) {
let e = t[1], n = t[2];
if (e === ao) return io + n;
}
return e;
}
//#endregion
//#region src/package-managers/filters.ts
function so(e, t) {
return t.deprecated || !e.deprecated;
}
function co(e, t) {
return t.pre ? !0 : !e.version || !_r(e.version);
}
function lo(e, t) {
if (!t) return !0;
let n = G.default.minVersion(t)?.version;
if (!n) return !0;
let r = e?.engines?.node;
return !r || G.default.satisfies(n, r);
}
function uo(e, t) {
return !t || Object.values(t).every((t) => t[e.name] === void 0 || G.default.satisfies(e.version, t[e.name]));
}
var fo = (e, t, n, r) => {
if (!t) return !1;
if (!r || !n) return !0;
let i = new Date(n), a = typeof r == "function" ? r(e ?? "") ?? 0 : r, o = typeof a == "string" ? zn(a) ?? 0 : a;
return Date.now() - i.getTime() >= o * 864e5;
};
function po(e) {
let t = [
(t) => so(t, e),
(t) => co(t, e),
e.enginesNode ? (t) => lo(t, e.nodeEngineVersion) : null,
e.peerDependencies ? (t) => uo(t, e.peerDependencies) : null
];
return (e) => t.every((t) => !t || t(e));
}
//#endregion
//#region src/package-managers/npm.ts
var mo = /* @__PURE__ */ r({
default: () => Fo,
defaultPrefix: () => Io,
distTag: () => Ho,
getDistTags: () => zo,
getEngines: () => Bo,
getPeerDependencies: () => Ro,
greatest: () => Lo,
latest: () => Uo,
list: () => Vo,
minor: () => Go,
newest: () => Wo,
normalizeNpmConfig: () => To,
npmApi: () => Eo,
packageAuthorChanged: () => No,
parseJson: () => Ao,
patch: () => Ko,
semver: () => qo
}), ho = () => import("./chunks/lib-ClO25DK1.js").then((e) => /* @__PURE__ */ n(e.default, 1)), go, _o = async () => (await (go ??= ho())).default, vo = /* @__PURE__ */ new Set([
"-",
"||",
"&&",
"<",
"<=",
">",
">="
]), yo = (e) => (0, pe.parseRange)(e).some((e) => vo.has(e.operator || "")), bo = (e) => (0, pe.parseRange)(e).some((e) => e.operator === "^" || e.operator === "~"), xo = (e) => e && (!G.default.validRange(e) || nr(e)), So = async (e, t, n, r = {}, i) => {
let a = await _o(), o = a.pickRegistry(e, r), s = {
"user-agent": r.userAgent || `npm-check-updates/${fe.version} node/${process.version}`,
"ncu-version": fe.version,
"ncu-pkg-id": `registry:${e}`,
accept: r.fullMetadata ? "application/json" : "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*",
...r.headers
}, c = new URL(encodeURIComponent(e).replace(/^%40/, "@"), o.endsWith("/") ? o : `${o}/`);
i && (c.pathname += `/${i}`);
let l = {
...r,
headers: s,
spec: e
};
try {
if (r.fullMetadata) return a.json(c.href, l);
{
let n = new AbortController(), r = await a(c.href, {
...l,
signal: n.signal
}), i = new Sa({
paths: ["$.*"],
keepStack: !1
}), o = { name: e }, s = !1, u = null;
i.onValue = ({ key: e, value: n }) => {
if (s || e === void 0) return;
let r = e;
t.includes(r) && (o[r] = n, Object.keys(o).length === t.length + 1 && (s = !0));
}, i.onError = (e) => {
u = e;
};
for await (let e of r.body) {
if (i.write(e), u) throw u;
if (s) break;
}
return s && n.abort(), o;
}
} catch (a) {
if (a.code !== "E404" || r.fullMetadata) throw a;
return So(e, t, n, {
...r,
fullMetadata: !0
}, i);
}
}, Co = ({ packageName: e, currentVersion: t, options: n, versions: r, time: i, filter: a = () => !0, compare: o = fr }) => {
let s = po(n), c = G.default.validRange(t) ? G.default.minVersion(t)?.version : null;
if (!c) return {
targetVersion: null,
fallbackVersion: null,
targetBlockedByCooldown: !1
};
let l = !fo(e, c, i?.[c], n.cooldown), u = r.reduce((t, r) => {
let c = r.version;
if (!c || o(c, t.fallbackVersion) <= 0) return t;
let l = {
...r,
name: e
};
if (!s(l) || !a?.(c)) return t;
let u = i?.[c], d = !n.cooldown || fo(e, c, u, n.cooldown);
return o(c, t.targetVersion) > 0 && (t.targetVersion = c, t.targetBlockedByCooldown = !d), d && (t.fallbackVersion = c), t;
}, {
targetVersion: c,
fallbackVersion: c,
targetBlockedByCooldown: l
}), d = u.targetVersion, f = u.fallbackVersion;
return f === u.targetVersion && (f = null), f && !G.default.gt(f, c) && (f = null), l && d === c && (u.targetBlockedByCooldown = !1), {
...u,
targetVersion: d,
fallbackVersion: f
};
}, wo = ({ packageName: e, currentVersion: t, options: n, time: r, targetVersion: i, fallbackVersion: a, targetBlockedByCooldown: o }) => {
let s = {
version: i,
...i && r?.[i] ? { time: r[i] } : null
};
if (n.cooldown && i && o) {
let n = G.default.validRange(t) ? G.default.minVersion(t)?.version : null, i = {
name: e,
currentVersion: t,
...n ? { currentVersionTime: r?.[n] } : null,
...s
};
if (a) {
let e = r?.[a];
return i.fallbackVersion = a, {
version: a,
...e ? { time: e } : null,
cooldownInfo: i
};
}
return { cooldownInfo: i };
}
return s;
}, To = (e, t) => {
let n = {
cafile: (e) => {
if (!e) return;
let n = y.readFileSync(o.resolve(t || "", oo(e)), "utf8"), r = "-----END CERTIFICATE-----";
return { ca: n.split(r).filter((e) => !!e.trim()).map((e) => `${e.trimStart()}${r}`) };
},
maxsockets: "maxSockets",
"strict-ssl": "strictSSL"
}, r = {
all: "boolean",
allowsameversion: "boolean",
audit: "boolean",
binlinks: "boolean",
color: "boolean",
commithooks: "boolean",
description: "boolean",
dev: "boolean",
diffignoreallspace: "boolean",
diffnameonly: "boolean",
diffnoprefix: "boolean",
difftext: "boolean",
dryrun: "boolean",
enginestrict: "boolean",
force: "boolean",
foregroundscripts: "boolean",
formatpackagelock: "boolean",
fund: "boolean",
gittagversion: "boolean",
global: "boolean",
globalstyle: "boolean",
ifpresent: "boolean",
ignorescripts: "boolean",
includestaged: "boolean",
includeworkspaceroot: "boolean",
installlinks: "boolean",
json: "boolean",
legacybundling: "boolean",
legacypeerdeps: "boolean",
link: "boolean",
long: "boolean",
offline: "boolean",
omitlockfileregistryresolved: "boolean",
packagelock: "boolean",
packagelockonly: "boolean",
parseable: "boolean",
preferoffline: "boolean",
preferonline: "boolean",
progress: "boolean",
readonly: "boolean",
rebuildbundle: "boolean",
save: "boolean",
savebundle: "boolean",
savedev: "boolean",
saveexact: "boolean",
saveoptional: "boolean",
savepeer: "boolean",
saveprod: "boolean",
shrinkwrap: "boolean",
signgitcommit: "boolean",
signgittag: "boolean",
strictpeerdeps: "boolean",
strictssl: "boolean",
timing: "boolean",
unicode: "boolean",
updatenotifier: "boolean",
usage: "boolean",
version: "boolean",
versions: "boolean",
workspacesupdate: "boolean",
diffunified: "number",
fetchretries: "number",
fetchretryfactor: "number",
fetchretrymaxtimeout: "number",
fetchretrymintimeout: "number",
fetchtimeout: "number",
logsmax: "number",
maxsockets: "number",
searchlimit: "number",
searchstaleness: "number",
ssopollfrequency: "number",
timeout: "number"
}, i = (e) => !!e && e !== "false" && e !== "0", a = (e) => parseInt(e) || 0;
return J(e, (e, t) => {
let o = typeof t == "string" ? r[e.replace(/-/g, "").toLowerCase()] === "boolean" ? i(t) : r[e.replace(/-/g, "").toLowerCase()] === "number" ? a(t) : t.replace(/\${([^}]+)}/g, (e, t) => process.env[t]) : t, { [e]: s } = n;
return typeof s == "string" ? { [s]: o } : typeof s == "function" ? { ...s(o.toString()) } : { [e.match(/^[a-z]/i) ? Ia(e) : e]: o };
});
}, Eo = {}, Do = (0, La.default)((e) => {
let t;
try {
let n = y.readFileSync(e, "utf-8");
t = ro.default.parse(n);
} catch (e) {
if (e.code === "ENOENT") return null;
throw e;
}
return To(t, e);
}), Oo = (e) => {
try {
return ro.default.parse(y.readFileSync(e, "utf-8"));
} catch (e) {
if (e.code === "ENOENT") return {};
throw e;
}
}, ko = () => {
if (process.env.PREFIX) return process.env.PREFIX;
if (process.platform === "win32") return o.dirname(process.execPath);
let e = o.dirname(o.dirname(process.execPath));
return process.env.DESTDIR ? o.join(process.env.DESTDIR, e) : e;
};
Eo.findNpmConfig = (0, La.default)(() => {
let e = /^npm_config_/i, t = {};
for (let n of Object.keys(process.env)) {
if (!e.test(n)) continue;
let r = n.toLowerCase().replace(e, "").replace(/(?!^)_/g, "-");
t[r] = process.env[n];
}
let n = process.env.npm_config_userconfig || process.env.NPM_CONFIG_USERCONFIG || o.join(process.env.HOME || c.homedir(), ".npmrc"), r = Oo(o.join(ko(), "etc", "npmrc")), i = Oo(n), a = no(["npmrc", ".npmrc"]), s = a && a !== n ? Oo(a) : {};
return To({
...r,
...i,
...s,
...t,
cache: !1
});
});
function Ao(e, t) {
let n;
try {
n = JSON.parse(e);
} catch (n) {
let r = t.stderr?.trim();
throw Error(`Expected JSON from "${t.command}".${t.packageName ? ` There could be problems with the ${t.packageName} package.` : ""} ${e ? "Instead received: " + e : "Received empty response."}${r ? `\n\n${r}` : ""}`, { cause: n });
}
return n;
}
var jo = (e) => !!(e && (e.name || e.engines || e.version || e.versions));
Eo.mockFetchUpgradedPackument = (e) => (t, n, r, i) => {
let a = typeof e == "function" ? e(i)?.[t] : typeof e == "string" || jo(e) ? e : e[t], o = jo(a) ? a.version : a;
if (!o) throw Error(`fetchUpgradedPackument is mocked, but no mock version was supplied for ${t}. Make sure that all dependencies are mocked. `);
let s = jo(a) && a.time ? a.time?.[o] : (/* @__PURE__ */ new Date()).toISOString(), c = {
name: t,
"dist-tags": { [i.distTag || "latest"]: o },
engines: { node: "" },
time: { [o]: s },
version: o,
versions: {},
...jo(a) ? a : null
}, { versions: l, ...u } = c;
return Promise.resolve({
...c,
versions: { ...jo(a) && a.versions || { [o]: u } }
});
};
var Mo = (0, La.default)(({ npmConfigLocal: e, npmConfigUser: t, npmConfigWorkspaceProject: n }, r) => {
let i = r.packageFile ? o.join(r.packageFile, "../.npmrc") : void 0, a = i ? Do(i) : null, s = r.cwd ? o.join(r.cwd, ".npmrc") : void 0, c = s ? Do(s) : null;
if (n && Object.keys(n).length > 0) {
X(r, "\nnpm config (workspace project):", "verbose");
let { cache: e, ...t } = n;
Rr(r, t, "verbose");
}
if (t && Object.keys(t).length > 0) {
X(r, "\nnpm config (user):", "verbose");
let { cache: e, ...n } = t;
Rr(r, n, "verbose");
}
if (e && Object.keys(e).length > 0) {
X(r, "\nnpm config (local override):", "verbose");
let { cache: t, ...n } = e;
Rr(r, n, "verbose");
}
if (a && Object.keys(a).length > 0) {
X(r, `\nnpm config (project: ${i}):`, "verbose");
let { cache: e, ...t } = a;
Rr(r, t, "verbose");
}
if (c && Object.keys(c).length > 0) {
X(r, `\nnpm config (cwd: ${s}):`, "verbose");
let { cache: e, ...t } = c;
Rr(r, t, "verbose");
}
let l = {
...n,
...t,
...e,
...a,
...c,
...r.registry ? {
registry: r.registry,
silent: !0
} : null,
...r.timeout ? { timeout: r.timeout } : null
};
if (n || e || a || c) {
X(r, "\nmerged npm config:", "verbose");
let { cache: e, ...t } = l;
Rr(r, t, "verbose");
}
return l;
});
async function No(e, t, n, r = {}, i, a) {
let o = await So(e, ["versions"], null, Mo({
npmConfigUser: {
...Eo.findNpmConfig(),
fullMetadata: !0
},
npmConfigLocal: i,
npmConfigWorkspaceProject: a
}, r));
if (o.versions) {
let e = Object.keys(o.versions), r = G.default.minSatisfying(e, t), i = G.default.maxSatisfying(e, n);
if (r && i && o.versions[r]._npmUser && o.versions[i]._npmUser) return o.versions[r]._npmUser?.name !== o.versions[i]._npmUser?.name;
}
return !1;
}
async function Po(e, t, n, r, i = 0, a, o) {
let s = `STUB_VERSIONS_${process.env.VITEST_POOL_ID ?? "0"}`;
if (process.env[s]) {
let i = JSON.parse(process.env[s]);
return Eo.mockFetchUpgradedPackument(i)(e, t, n, r);
}
if (xo(n)) return {};
let c = r.format?.includes("time") && !t.includes("time") ? [...t, "time"] : t, l = c.includes("time"), u = Mo({
npmConfigUser: {
...Eo.findNpmConfig(),
fullMetadata: l
},
npmConfigLocal: a,
npmConfigWorkspaceProject: o
}, r), d;
try {
let n = r.distTag || "latest";
d = await So(e, Array.from(/* @__PURE__ */ new Set([
"dist-tags",
...t,
...r.deprecated ? [] : ["deprecated", "versions"],
...r.enginesNode ? ["engines", "versions"] : []
])), l ? null : n, u);
} catch (t) {
if (r.retry && ++i <= r.retry) return Po(e, c, n, r, i, a, o);
throw t;
}
return d;
}
Eo.fetchUpgradedPackumentMemo = (0, La.default)(Po, { serializer: (([e, t, n, r, i, a, o]) => {
let { packageFile: s, ...c } = r;
return JSON.stringify([
e,
t,
xo(n),
c,
i,
a,
o
]);
}) });
async function Fo(e, t = {}, n = {}, r = {}) {
return na("npm", [
...t.global ? ["--global"] : [],
...t.prefix ? [`--prefix=${t.prefix}`] : [],
"--json",
...Array.isArray(e) ? e : [e]
], n, r);
}
async function Io(e) {
if (e.prefix) return e.prefix;
let t;
try {
let { stdout: e } = await na("npm", [
"config",
"get",
"prefix"
]);
t = e;
} catch (t) {
X(e, "Error executing `npm config get prefix`. Caught and ignored. Unsolved: https://github.com/raineorshine/npm-check-updates/issues/703. ERROR: " + (t.message || t || "").toString(), "verbose", "error");
}
return e.global && t?.match("Cellar") ? "/usr/local" : process.platform === "win32" && e.global && !process.env.prefix ? t ? t.trim() : `${process.env.AppData}\\npm` : void 0;
}
var Lo = async (e, t, n = {}, r, i, a) => {
let o = ["versions"];
n.cooldown && o.push("time");
let s = await Eo.fetchUpgradedPackumentMemo(e, o, t, n, 0, r, i), c = {
packageName: e,
currentVersion: t,
options: n,
versions: Object.values(s?.versions ?? {}),
time: s?.time
}, l = Co(c);
if (a) {
let e = l.targetBlockedByCooldown ? l.fallbackVersion : l.targetVersion;
return {
version: e,
...e && s?.time?.[e] ? { time: s.time[e] } : null
};
}
return wo({
...c,
...l
});
}, Ro = async (e, t, n) => {
let { stdout: r, stderr: i, command: a } = await Fo([
"view",
`${e}@${t}`,
"peerDependencies"
], {}, { rejectOnError: !0 }, n);
if (!r) return {};
let o = Ao(r, {
command: a,
stderr: i
});
return Array.isArray(o) ? o.at(-1) ?? {} : o;
}, zo = async (e, t = {}, n, r) => (await Eo.fetchUpgradedPackumentMemo(e, ["dist-tags"], "", t, 0, n, r))?.["dist-tags"] || {}, Bo = async (e, t, n = {}, r, i) => (await So(e, ["engines"], null, Mo({
npmConfigUser: { ...Eo.findNpmConfig() },
npmConfigLocal: r,
npmConfigWorkspaceProject: i
}, n), t)).engines || {}, Vo = async (e = {}) => {
let { stdout: t, stderr: n, command: r } = await Fo(["ls", "--depth=0"], {
...e.global ? { global: !0 } : null,
...e.prefix ? { prefix: e.prefix } : null
}, { rejectOnError: !1 }, { ...e.cwd ? { cwd: e.cwd } : null }), i = Ao(t, {
command: r,
stderr: n
}).dependencies;
return J(i, (e, t) => ({ [e]: t.version || t.required?.version }));
}, Ho = async (e, t, n = {}, r, i) => {
let a = ["dist-tags"];
n.cooldown && a.push("time");
let o = await Eo.fetchUpgradedPackumentMemo(e, a, t, n, 0, r, i), s = o?.["dist-tags"]?.[n.distTag || "latest"];
if (!s) return {};
let c = o?.versions?.[s], l = c ?? {
name: e,
version: s
}, u = !c && (!n.deprecated || n.enginesNode), d = o?.time?.[s], f = d ? { time: d } : null, p = G.default.validRange(t) && G.default.minVersion(t)?.version || "0.0.0", m = l.version === p || fo(e, l.version, d, n.cooldown);
return m && !u && po(n)(l) ? {
version: l.version,
...f
} : n.cooldown && !m ? (X(n, `Skipping ${e}@${s} due to cooldown${d ? ` (published ${d})` : ""}.`, "verbose"), { cooldownInfo: {
name: e,
currentVersion: t,
currentVersionTime: o?.time?.[p],
version: l.version,
...f
} }) : n.distTag && n.distTag !== "latest" ? {} : Lo(e, t, n, r, i, "distTag");
}, Uo = async (e, t, n = {}, r, i) => {
let a = await Ho(e, t, {
...n,
distTag: "latest"
}, r, i);
if (a.cooldownInfo) {
let o = await Lo(e, t, n, r, i, "latest");
if (o.version) return a.cooldownInfo.fallbackVersion = o.version, {
...o,
...a
};
}
return a;
}, Wo = async (e, t, n = {}, r, i) => {
let a = await Eo.fetchUpgradedPackumentMemo(e, ["time", "versions"], t, n, 0, r, i), o = Object.values(a?.versions ?? {}), s = a?.time, c = !s || Object.keys(s).length === 0, l = {
packageName: e,
currentVersion: t,
options: n,
versions: o,
time: s
}, u = c ? {
targetVersion: t,
fallbackVersion: null,
targetBlockedByCooldown: !1
} : Co({
...l,
compare: (e, t) => {
let n = a?.time?.[e] || "", r = a?.time?.[t] || "";
return n > r ? 1 : n < r ? -1 : 0;
}
});
return wo({
...l,
...u
});
}, Go = async (e, t, n = {}, r, i) => {
let a = ["versions"];
n.cooldown && a.push("time");
let o = await Eo.fetchUpgradedPackumentMemo(e, a, t, n, 0, r, i), s = {
packageName: e,
currentVersion: t,
options: n,
versions: Object.values(o?.versions ?? {}),
time: o?.time
}, c = Co({
...s,
filter: hr(t, "minor")
});
return wo({
...s,
...c
});
}, Ko = async (e, t, n = {}, r, i) => {
let a = ["versions"];
n.cooldown && a.push("time");
let o = await Eo.fetchUpgradedPackumentMemo(e, a, t, n, 0, r, i), s = {
packageName: e,
currentVersion: t,
options: n,
versions: Object.values(o?.versions ?? {}),
time: o?.time
}, c = Co({
...s,
filter: hr(t, "patch")
});
return wo({
...s,
...c
});
}, qo = async (e, t, n = {}, r, i) => {
if (yo(t) && !bo(t)) return { version: null };
let a = ["versions"];
n.cooldown && a.push("time");
let o = await Eo.fetchUpgradedPackumentMemo(e, a, t, n, 0, r, i), s = {
packageName: e,
currentVersion: t,
options: n,
versions: Object.values(o?.versions ?? {}),
time: o?.time
}, c = Co({
...s,
filter: gr(t)
});
return wo({
...s,
...c
});
}, Jo = /* @__PURE__ */ r({
default: () => Yo,
defaultPrefix: () => Xo,
distTag: () => Ho,
getDistTags: () => zo,
getEngines: () => ts,
getPeerDependencies: () => es,
greatest: () => Lo,
latest: () => Uo,
list: () => Zo,
minor: () => Go,
newest: () => Wo,
packageAuthorChanged: () => $o,
patch: () => Ko,
semver: () => qo
});
async function Yo(e, t = {}, n = {}, r = {}) {
return na("bun", [
...t.global ? ["--global"] : [],
...t.prefix ? [`--prefix=${t.prefix}`] : [],
...Array.isArray(e) ? e : [e]
], n, r);
}
var Xo = async (e) => e.global ? e.prefix || process.env.BUN_INSTALL || o.dirname((await (0, ea.default)("bun", [
"pm",
"-g",
"bin"
])).stdout) : void 0, Zo = async (e = {}) => {
let { stdout: t } = await Yo(["pm", "ls"], {
...e.global ? { global: !0 } : null,
...e.prefix ? { prefix: e.prefix } : null
}, { rejectOnError: !1 }, {
env: {
...process.env,
NO_COLOR: "1"
},
...e.cwd ? { cwd: e.cwd } : null
});
return J(f(t).split("\n"), (e) => {
let t = e.match(/.* (.+?)@(.+)/);
if (t) {
let [, e, n] = t;
return { [e]: n };
}
return null;
});
};
async function Qo(e, t, n = {}, { rejectOnError: r = !1 } = {}) {
let { stdout: i } = await Yo([
"info",
e,
...t ? [t] : [],
"--json"
], {}, { rejectOnError: r }, { ...n.cwd ? { cwd: n.cwd } : null });
try {
let e = JSON.parse(f(i));
return e && typeof e == "object" && !Array.isArray(e) && "error" in e ? null : e;
} catch {
return null;
}
}
var $o = async (e, t, n, r = {}) => {
let i = await Qo(e, "versions", r);
if (!Array.isArray(i)) return !1;
let a = G.default.minSatisfying(i, t), o = G.default.maxSatisfying(i, n);
if (!a || !o) return !1;
let [s, c] = await Promise.all([Qo(`${e}@${a}`, void 0, r), Qo(`${e}@${o}`, void 0, r)]), l = s?._npmUser?.name, u = c?._npmUser?.name;
return !l || !u ? !1 : l !== u;
}, es = async (e, t, n) => {
let r = await Qo(`${e}@${t}`, void 0, { cwd: n.cwd });
if (!r) throw Error(`Could not read the manifest of ${e}@${t} from bun`);
return r.peerDependencies || {};
}, ts = async (e, t, n = {}) => (await Qo(`${e}@${t}`, void 0, n, { rejectOnError: !0 }))?.engines || {}, Q = /* @__PURE__ */ i(((e) => {
var t = Symbol.for("yaml.alias"), n = Symbol.for("yaml.document"), r = Symbol.for("yaml.map"), i = Symbol.for("yaml.pair"), a = Symbol.for("yaml.scalar"), o = Symbol.for("yaml.seq"), s = Symbol.for("yaml.node.type"), c = (e) => !!e && typeof e == "object" && e[s] === t, l = (e) => !!e && typeof e == "object" && e[s] === n, u = (e) => !!e && typeof e == "object" && e[s] === r, d = (e) => !!e && typeof e == "object" && e[s] === i, f = (e) => !!e && typeof e == "object" && e[s] === a, p = (e) => !!e && typeof e == "object" && e[s] === o;
function m(e) {
if (e && typeof e == "object") switch (e[s]) {
case r:
case o: return !0;
}
return !1;
}
function h(e) {
if (e && typeof e == "object") switch (e[s]) {
case t:
case r:
case a:
case o: return !0;
}
return !1;
}
e.ALIAS = t, e.DOC = n, e.MAP = r, e.NODE_TYPE = s, e.PAIR = i, e.SCALAR = a, e.SEQ = o, e.hasAnchor = (e) => (f(e) || m(e)) && !!e.anchor, e.isAlias = c, e.isCollection = m, e.isDocument = l, e.isMap = u, e.isNode = h, e.isPair = d, e.isScalar = f, e.isSeq = p;
})), ns = /* @__PURE__ */ i(((e) => {
var t = Q(), n = Symbol("break visit"), r = Symbol("skip children"), i = Symbol("remove node");
function a(e, n) {
let r = l(n);
t.isDocument(e) ? o(null, e.contents, r, Object.freeze([e])) === i && (e.contents = null) : o(null, e, r, Object.freeze([]));
}
a.BREAK = n, a.SKIP = r, a.REMOVE = i;
function o(e, r, a, s) {
let c = u(e, r, a, s);
if (t.isNode(c) || t.isPair(c)) return d(e, s, c), o(e, c, a, s);
if (typeof c != "symbol") {
if (t.isCollection(r)) {
s = Object.freeze(s.concat(r));
for (let e = 0; e < r.items.length; ++e) {
let t = o(e, r.items[e], a, s);
if (typeof t == "number") e = t - 1;
else if (t === n) return n;
else t === i && (r.items.splice(e, 1), --e);
}
} else if (t.isPair(r)) {
s = Object.freeze(s.concat(r));
let e = o("key", r.key, a, s);
if (e === n) return n;
e === i && (r.key = null);
let t = o("value", r.value, a, s);
if (t === n) return n;
t === i && (r.value = null);
}
}
return c;
}
async function s(e, n) {
let r = l(n);
t.isDocument(e) ? await c(null, e.contents, r, Object.freeze([e])) === i && (e.contents = null) : await c(null, e, r, Object.freeze([]));
}
s.BREAK = n, s.SKIP = r, s.REMOVE = i;
async function c(e, r, a, o) {
let s = await u(e, r, a, o);
if (t.isNode(s) || t.isPair(s)) return d(e, o, s), c(e, s, a, o);
if (typeof s != "symbol") {
if (t.isCollection(r)) {
o = Object.freeze(o.concat(r));
for (let e = 0; e < r.items.length; ++e) {
let t = await c(e, r.items[e], a, o);
if (typeof t == "number") e = t - 1;
else if (t === n) return n;
else t === i && (r.items.splice(e, 1), --e);
}
} else if (t.isPair(r)) {
o = Object.freeze(o.concat(r));
let e = await c("key", r.key, a, o);
if (e === n) return n;
e === i && (r.key = null);
let t = await c("value", r.value, a, o);
if (t === n) return n;
t === i && (r.value = null);
}
}
return s;
}
function l(e) {
return typeof e == "object" && (e.Collection || e.Node || e.Value) ? Object.assign({
Alias: e.Node,
Map: e.Node,
Scalar: e.Node,
Seq: e.Node
}, e.Value && {
Map: e.Value,
Scalar: e.Value,
Seq: e.Value
}, e.Collection && {
Map: e.Collection,
Seq: e.Collection
}, e) : e;
}
function u(e, n, r, i) {
if (typeof r == "function") return r(e, n, i);
if (t.isMap(n)) return r.Map?.(e, n, i);
if (t.isSeq(n)) return r.Seq?.(e, n, i);
if (t.isPair(n)) return r.Pair?.(e, n, i);
if (t.isScalar(n)) return r.Scalar?.(e, n, i);
if (t.isAlias(n)) return r.Alias?.(e, n, i);
}
function d(e, n, r) {
let i = n[n.length - 1];
if (t.isCollection(i)) i.items[e] = r;
else if (t.isPair(i)) e === "key" ? i.key = r : i.value = r;
else if (t.isDocument(i)) i.contents = r;
else {
let e = t.isAlias(i) ? "alias" : "scalar";
throw Error(`Cannot replace node with ${e} parent`);
}
}
e.visit = a, e.visitAsync = s;
})), rs = /* @__PURE__ */ i(((e) => {
var t = Q(), n = ns(), r = {
"!": "%21",
",": "%2C",
"[": "%5B",
"]": "%5D",
"{": "%7B",
"}": "%7D"
}, i = (e) => e.replace(/[!,[\]{}]/g, (e) => r[e]), a = class e {
constructor(t, n) {
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, e.defaultYaml, t), this.tags = Object.assign({}, e.defaultTags, n);
}
clone() {
let t = new e(this.yaml, this.tags);
return t.docStart = this.docStart, t;
}
atDocument() {
let t = new e(this.yaml, this.tags);
switch (this.yaml.version) {
case "1.1":
this.atNextDocument = !0;
break;
case "1.2": this.atNextDocument = !1, this.yaml = {
explicit: e.defaultYaml.explicit,
version: "1.2"
}, this.tags = Object.assign({}, e.defaultTags);
}
return t;
}
add(t, n) {
this.atNextDocument &&= (this.yaml = {
explicit: e.defaultYaml.explicit,
version: "1.1"
}, this.tags = Object.assign({}, e.defaultTags), !1);
let r = t.trim().split(/[ \t]+/), i = r.shift();
switch (i) {
case "%TAG": {
if (r.length !== 2 && (n(0, "%TAG directive should contain exactly two parts"), r.length < 2)) return !1;
let [e, t] = r;
return this.tags[e] = t, !0;
}
case "%YAML": {
if (this.yaml.explicit = !0, r.length !== 1) return n(0, "%YAML directive should contain exactly one part"), !1;
let [e] = r;
if (e === "1.1" || e === "1.2") return this.yaml.version = e, !0;
{
let t = /^\d+\.\d+$/.test(e);
return n(6, `Unsupported YAML version ${e}`, t), !1;
}
}
default: return n(0, `Unknown directive ${i}`, !0), !1;
}
}
tagName(e, t) {
if (e === "!") return "!";
if (e[0] !== "!") return t(`Not a valid tag: ${e}`), null;
if (e[1] === "<") {
let n = e.slice(2, -1);
return n === "!" || n === "!!" ? (t(`Verbatim tags aren't resolved, so ${e} is invalid.`), null) : (e[e.length - 1] !== ">" && t("Verbatim tags must end with a >"), n);
}
let [, n, r] = e.match(/^(.*!)([^!]*)$/s);
r || t(`The ${e} tag has no suffix`);
let i = this.tags[n];
if (i) try {
return i + decodeURIComponent(r);
} catch (e) {
return t(String(e)), null;
}
return n === "!" ? e : (t(`Could not resolve tag: ${e}`), null);
}
tagString(e) {
for (let [t, n] of Object.entries(this.tags)) if (e.startsWith(n)) return t + i(e.substring(n.length));
return e[0] === "!" ? e : `!<${e}>`;
}
toString(e) {
let r = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [], i = Object.entries(this.tags), a;
if (e && i.length > 0 && t.isNode(e.contents)) {
let r = {};
n.visit(e.contents, (e, n) => {
t.isNode(n) && n.tag && (r[n.tag] = !0);
}), a = Object.keys(r);
} else a = [];
for (let [t, n] of i) (t !== "!!" || n !== "tag:yaml.org,2002:") && (!e || a.some((e) => e.startsWith(n))) && r.push(`%TAG ${t} ${n}`);
return r.join("\n");
}
};
a.defaultYaml = {
explicit: !1,
version: "1.2"
}, a.defaultTags = { "!!": "tag:yaml.org,2002:" }, e.Directives = a;
})), is = /* @__PURE__ */ i(((e) => {
var t = Q(), n = ns();
function r(e) {
if (/[\x00-\x19\s,[\]{}]/.test(e)) {
let t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;
throw Error(t);
}
return !0;
}
function i(e) {
let t = /* @__PURE__ */ new Set();
return n.visit(e, { Value(e, n) {
n.anchor && t.add(n.anchor);
} }), t;
}
function a(e, t) {
for (let n = 1;; ++n) {
let r = `${e}${n}`;
if (!t.has(r)) return r;
}
}
function o(e, n) {
let r = [], o = /* @__PURE__ */ new Map(), s = null;
return {
onAnchor: (t) => {
r.push(t), s ??= i(e);
let o = a(n, s);
return s.add(o), o;
},
setAnchors: () => {
for (let e of r) {
let n = o.get(e);
if (typeof n == "object" && n.anchor && (t.isScalar(n.node) || t.isCollection(n.node))) n.node.anchor = n.anchor;
else {
let t = /* @__PURE__ */ Error("Failed to resolve repeated object (this should not happen)");
throw t.source = e, t;
}
}
},
sourceObjects: o
};
}
e.anchorIsValid = r, e.anchorNames = i, e.createNodeAnchors = o, e.findNewAnchor = a;
})), as = /* @__PURE__ */ i(((e) => {
function t(e, n, r, i) {
if (i && typeof i == "object") {
if (Array.isArray(i)) for (let n = 0, r = i.length; n < r; ++n) {
let r = i[n], a = t(e, i, String(n), r);
a === void 0 ? delete i[n] : a !== r && (i[n] = a);
}
else if (i instanceof Map) for (let n of Array.from(i.keys())) {
let r = i.get(n), a = t(e, i, n, r);
a === void 0 ? i.delete(n) : a !== r && i.set(n, a);
}
else if (i instanceof Set) for (let n of Array.from(i)) {
let r = t(e, i, n, n);
r === void 0 ? i.delete(n) : r !== n && (i.delete(n), i.add(r));
}
else for (let [n, r] of Object.entries(i)) {
let a = t(e, i, n, r);
a === void 0 ? delete i[n] : a !== r && (i[n] = a);
}
}
return e.call(n, r, i);
}
e.applyReviver = t;
})), os = /* @__PURE__ */ i(((e) => {
var t = Q();
function n(e, r, i) {
if (Array.isArray(e)) return e.map((e, t) => n(e, String(t), i));
if (e && typeof e.toJSON == "function") {
if (!i || !t.hasAnchor(e)) return e.toJSON(r, i);
let n = {
aliasCount: 0,
count: 1,
res: void 0
};
i.anchors.set(e, n), i.onCreate = (e) => {
n.res = e, delete i.onCreate;
};
let a = e.toJSON(r, i);
return i.onCreate && i.onCreate(a), a;
}
return typeof e == "bigint" && !i?.keep ? Number(e) : e;
}
e.toJS = n;
})), ss = /* @__PURE__ */ i(((e) => {
var t = as(), n = Q(), r = os();
e.NodeBase = class {
constructor(e) {
Object.defineProperty(this, n.NODE_TYPE, { value: e });
}
clone() {
let e = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
return this.range && (e.range = this.range.slice()), e;
}
toJS(e, { mapAsMap: i, maxAliasCount: a, onAnchor: o, reviver: s } = {}) {
if (!n.isDocument(e)) throw TypeError("A document argument is required");
let c = {
anchors: /* @__PURE__ */ new Map(),
doc: e,
keep: !0,
mapAsMap: i === !0,
mapKeyWarned: !1,
maxAliasCount: typeof a == "number" ? a : 100
}, l = r.toJS(this, "", c);
if (typeof o == "function") for (let { count: e, res: t } of c.anchors.values()) o(t, e);
return typeof s == "function" ? t.applyReviver(s, { "": l }, "", l) : l;
}
};
})), cs = /* @__PURE__ */ i(((e) => {
var t = is(), n = ns(), r = Q(), i = ss(), a = os(), o = class extends i.NodeBase {
constructor(e) {
super(r.ALIAS), this.source = e, Object.defineProperty(this, "tag", { set() {
throw Error("Alias nodes cannot have tags");
} });
}
resolve(e, t) {
if (t?.maxAliasCount === 0) throw ReferenceError("Alias resolution is disabled");
let i;
t?.aliasResolveCache ? i = t.aliasResolveCache : (i = [], n.visit(e, { Node: (e, t) => {
(r.isAlias(t) || r.hasAnchor(t)) && i.push(t);
} }), t && (t.aliasResolveCache = i));
let a;
for (let e of i) {
if (e === this) break;
e.anchor === this.source && (a = e);
}
return a;
}
toJSON(e, t) {
if (!t) return { source: this.source };
let { anchors: n, doc: r, maxAliasCount: i } = t, o = this.resolve(r, t);
if (!o) {
let e = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
throw ReferenceError(e);
}
let c = n.get(o);
/* istanbul ignore if */
if (c ||= (a.toJS(o, null, t), n.get(o)), c?.res === void 0) throw ReferenceError("This should not happen: Alias anchor was not resolved?");
if (i >= 0 && (c.count += 1, c.aliasCount === 0 && (c.aliasCount = s(r, o, n)), c.count * c.aliasCount > i)) throw ReferenceError("Excessive alias count indicates a resource exhaustion attack");
return c.res;
}
toString(e, n, r) {
let i = `*${this.source}`;
if (e) {
if (t.anchorIsValid(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
let e = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
throw Error(e);
}
if (e.implicitKey) return `${i} `;
}
return i;
}
};
function s(e, t, n) {
if (r.isAlias(t)) {
let r = t.resolve(e), i = n && r && n.get(r);
return i ? i.count * i.aliasCount : 0;
}
if (r.isCollection(t)) {
let r = 0;
for (let i of t.items) {
let t = s(e, i, n);
t > r && (r = t);
}
return r;
}
if (r.isPair(t)) {
let r = s(e, t.key, n), i = s(e, t.value, n);
return Math.max(r, i);
}
return 1;
}
e.Alias = o;
})), ls = /* @__PURE__ */ i(((e) => {
var t = Q(), n = ss(), r = os(), i = (e) => !e || typeof e != "function" && typeof e != "object", a = class extends n.NodeBase {
constructor(e) {
super(t.SCALAR), this.value = e;
}
toJSON(e, t) {
return t?.keep ? this.value : r.toJS(this.value, e, t);
}
toString() {
return String(this.value);
}
};
a.BLOCK_FOLDED = "BLOCK_FOLDED", a.BLOCK_LITERAL = "BLOCK_LITERAL", a.PLAIN = "PLAIN", a.QUOTE_DOUBLE = "QUOTE_DOUBLE", a.QUOTE_SINGLE = "QUOTE_SINGLE", e.Scalar = a, e.isScalarValue = i;
})), us = /* @__PURE__ */ i(((e) => {
var t = cs(), n = Q(), r = ls(), i = "tag:yaml.org,2002:";
function a(e, t, n) {
if (t) {
let e = n.filter((e) => e.tag === t), r = e.find((e) => !e.format) ?? e[0];
if (!r) throw Error(`Tag ${t} not found`);
return r;
}
return n.find((t) => t.identify?.(e) && !t.format);
}
function o(e, o, s) {
if (n.isDocument(e) && (e = e.contents), n.isNode(e)) return e;
if (n.isPair(e)) {
let t = s.schema[n.MAP].createNode?.(s.schema, null, s);
return t.items.push(e), t;
}
(e instanceof String || e instanceof Number || e instanceof Boolean || typeof BigInt < "u" && e instanceof BigInt) && (e = e.valueOf());
let { aliasDuplicateObjects: c, onAnchor: l, onTagObj: u, schema: d, sourceObjects: f } = s, p;
if (c && e && typeof e == "object") {
if (p = f.get(e), p) return p.anchor ?? (p.anchor = l(e)), new t.Alias(p.anchor);
p = {
anchor: null,
node: null
}, f.set(e, p);
}
o?.startsWith("!!") && (o = i + o.slice(2));
let m = a(e, o, d.tags);
if (!m) {
if (e && typeof e.toJSON == "function" && (e = e.toJSON()), !e || typeof e != "object") {
let t = new r.Scalar(e);
return p && (p.node = t), t;
}
m = e instanceof Map ? d[n.MAP] : Symbol.iterator in Object(e) ? d[n.SEQ] : d[n.MAP];
}
u && (u(m), delete s.onTagObj);
let h = m?.createNode ? m.createNode(s.schema, e, s) : typeof m?.nodeClass?.from == "function" ? m.nodeClass.from(s.schema, e, s) : new r.Scalar(e);
return o ? h.tag = o : m.default || (h.tag = m.tag), p && (p.node = h), h;
}
e.createNode = o;
})), ds = /* @__PURE__ */ i(((e) => {
var t = us(), n = Q(), r = ss();
function i(e, n, r) {
let i = r;
for (let e = n.length - 1; e >= 0; --e) {
let t = n[e];
if (typeof t == "number" && Number.isInteger(t) && t >= 0) {
let e = [];
e[t] = i, i = e;
} else i = /* @__PURE__ */ new Map([[t, i]]);
}
return t.createNode(i, void 0, {
aliasDuplicateObjects: !1,
keepUndefined: !1,
onAnchor: () => {
throw Error("This should not happen, please report a bug.");
},
schema: e,
sourceObjects: /* @__PURE__ */ new Map()
});
}
var a = (e) => e == null || typeof e == "object" && !!e[Symbol.iterator]().next().done;
e.Collection = class extends r.NodeBase {
constructor(e, t) {
super(e), Object.defineProperty(this, "schema", {
value: t,
configurable: !0,
enumerable: !1,
writable: !0
});
}
clone(e) {
let t = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
return e && (t.schema = e), t.items = t.items.map((t) => n.isNode(t) || n.isPair(t) ? t.clone(e) : t), this.range && (t.range = this.range.slice()), t;
}
addIn(e, t) {
if (a(e)) this.add(t);
else {
let [r, ...a] = e, o = this.get(r, !0);
if (n.isCollection(o)) o.addIn(a, t);
else if (o === void 0 && this.schema) this.set(r, i(this.schema, a, t));
else throw Error(`Expected YAML collection at ${r}. Remaining path: ${a}`);
}
}
deleteIn(e) {
let [t, ...r] = e;
if (r.length === 0) return this.delete(t);
let i = this.get(t, !0);
if (n.isCollection(i)) return i.deleteIn(r);
throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`);
}
getIn(e, t) {
let [r, ...i] = e, a = this.get(r, !0);
return i.length === 0 ? !t && n.isScalar(a) ? a.value : a : n.isCollection(a) ? a.getIn(i, t) : void 0;
}
hasAllNullValues(e) {
return this.items.every((t) => {
if (!n.isPair(t)) return !1;
let r = t.value;
return r == null || e && n.isScalar(r) && r.value == null && !r.commentBefore && !r.comment && !r.tag;
});
}
hasIn(e) {
let [t, ...r] = e;
if (r.length === 0) return this.has(t);
let i = this.get(t, !0);
return n.isCollection(i) ? i.hasIn(r) : !1;
}
setIn(e, t) {
let [r, ...a] = e;
if (a.length === 0) this.set(r, t);
else {
let e = this.get(r, !0);
if (n.isCollection(e)) e.setIn(a, t);
else if (e === void 0 && this.schema) this.set(r, i(this.schema, a, t));
else throw Error(`Expected YAML collection at ${r}. Remaining path: ${a}`);
}
}
}, e.collectionFromPath = i, e.isEmptyPath = a;
})), fs = /* @__PURE__ */ i(((e) => {
var t = (e) => e.replace(/^(?!$)(?: $)?/gm, "#");
function n(e, t) {
return /^\n+$/.test(e) ? e.substring(1) : t ? e.replace(/^(?! *$)/gm, t) : e;
}
e.indentComment = n, e.lineComment = (e, t, r) => e.endsWith("\n") ? n(r, t) : r.includes("\n") ? "\n" + n(r, t) : (e.endsWith(" ") ? "" : " ") + r, e.stringifyComment = t;
})), ps = /* @__PURE__ */ i(((e) => {
var t = "flow", n = "block", r = "quoted";
function i(e, t, i = "flow", { indentAtStart: o, lineWidth: s = 80, minContentWidth: c = 20, onFold: l, onOverflow: u } = {}) {
if (!s || s < 0) return e;
s < c && (c = 0);
let d = Math.max(1 + c, 1 + s - t.length);
if (e.length <= d) return e;
let f = [], p = {}, m = s - t.length;
typeof o == "number" && (o > s - Math.max(2, c) ? f.push(0) : m = s - o);
let h, g, _ = !1, v = -1, y = -1, b = -1;
i === n && (v = a(e, v, t.length), v !== -1 && (m = v + d));
for (let o; o = e[v += 1];) {
if (i === r && o === "\\") {
switch (y = v, e[v + 1]) {
case "x":
v += 3;
break;
case "u":
v += 5;
break;
case "U":
v += 9;
break;
default: v += 1;
}
b = v;
}
if (o === "\n") i === n && (v = a(e, v, t.length)), m = v + t.length + d, h = void 0;
else {
if (o === " " && g && g !== " " && g !== "\n" && g !== " ") {
let t = e[v + 1];
t && t !== " " && t !== "\n" && t !== " " && (h = v);
}
if (v >= m) {
if (h) f.push(h), m = h + d, h = void 0;
else if (i === r) {
for (; g === " " || g === " ";) g = o, o = e[v += 1], _ = !0;
let t = v > b + 1 ? v - 2 : y - 1;
if (p[t]) return e;
f.push(t), p[t] = !0, m = t + d, h = void 0;
} else _ = !0;
}
}
g = o;
}
if (_ && u && u(), f.length === 0) return e;
l && l();
let x = e.slice(0, f[0]);
for (let n = 0; n < f.length; ++n) {
let a = f[n], o = f[n + 1] || e.length;
a === 0 ? x = `\n${t}${e.slice(0, o)}` : (i === r && p[a] && (x += `${e[a]}\\`), x += `\n${t}${e.slice(a + 1, o)}`);
}
return x;
}
function a(e, t, n) {
let r = t, i = t + 1, a = e[i];
for (; a === " " || a === " ";) if (t < i + n) a = e[++t];
else {
do
a = e[++t];
while (a && a !== "\n");
r = t, i = t + 1, a = e[i];
}
return r;
}
e.FOLD_BLOCK = n, e.FOLD_FLOW = t, e.FOLD_QUOTED = r, e.foldFlowLines = i;
})), ms = /* @__PURE__ */ i(((e) => {
var t = ls(), n = ps(), r = (e, t) => ({
indentAtStart: t ? e.indent.length : e.indentAtStart,
lineWidth: e.options.lineWidth,
minContentWidth: e.options.minContentWidth
}), i = (e) => /^(%|---|\.\.\.)/m.test(e);
function a(e, t, n) {
if (!t || t < 0) return !1;
let r = t - n, i = e.length;
if (i <= r) return !1;
for (let t = 0, n = 0; t < i; ++t) if (e[t] === "\n") {
if (t - n > r) return !0;
if (n = t + 1, i - n <= r) return !1;
}
return !0;
}
function o(e, t) {
let a = JSON.stringify(e);
if (t.options.doubleQuotedAsJSON) return a;
let { implicitKey: o } = t, s = t.options.doubleQuotedMinMultiLineLength, c = t.indent || (i(e) ? " " : ""), l = "", u = 0;
for (let e = 0, t = a[e]; t; t = a[++e]) if (t === " " && a[e + 1] === "\\" && a[e + 2] === "n" && (l += a.slice(u, e) + "\\ ", e += 1, u = e, t = "\\"), t === "\\") switch (a[e + 1]) {
case "u":
{
l += a.slice(u, e);
let t = a.substr(e + 2, 4);
switch (t) {
case "0000":
l += "\\0";
break;
case "0007":
l += "\\a";
break;
case "000b":
l += "\\v";
break;
case "001b":
l += "\\e";
break;
case "0085":
l += "\\N";
break;
case "00a0":
l += "\\_";
break;
case "2028":
l += "\\L";
break;
case "2029":
l += "\\P";
break;
default: t.substr(0, 2) === "00" ? l += "\\x" + t.substr(2) : l += a.substr(e, 6);
}
e += 5, u = e + 1;
}
break;
case "n":
if (o || a[e + 2] === "\"" || a.length < s) e += 1;
else {
for (l += a.slice(u, e) + "\n\n"; a[e + 2] === "\\" && a[e + 3] === "n" && a[e + 4] !== "\"";) l += "\n", e += 2;
l += c, a[e + 2] === " " && (l += "\\"), e += 1, u = e + 1;
}
break;
default: e += 1;
}
return l = u ? l + a.slice(u) : a, o ? l : n.foldFlowLines(l, c, n.FOLD_QUOTED, r(t, !1));
}
function s(e, t) {
if (t.options.singleQuote === !1 || t.implicitKey && e.includes("\n") || /[ \t]\n|\n[ \t]/.test(e)) return o(e, t);
let a = t.indent || (i(e) ? " " : ""), s = "'" + e.replace(/'/g, "''").replace(/\n+/g, `$&\n${a}`) + "'";
return t.implicitKey ? s : n.foldFlowLines(s, a, n.FOLD_FLOW, r(t, !1));
}
function c(e, t) {
let { singleQuote: n } = t.options, r;
if (n === !1) r = o;
else {
let t = e.includes("\""), i = e.includes("'");
r = t && !i ? s : i && !t ? o : n ? s : o;
}
return r(e, t);
}
var l;
try {
l = /* @__PURE__ */ RegExp("(^|(?<!\n))\n+(?!\n|$)", "g");
} catch {
l = /\n+(?!\n|$)/g;
}
function u({ comment: e, type: o, value: s }, u, d, f) {
let { blockQuote: p, commentString: m, lineWidth: h } = u.options;
if (!p || /\n[\t ]+$/.test(s)) return c(s, u);
let g = u.indent || (u.forceBlockIndent || i(s) ? " " : ""), _ = p === "literal" ? !0 : p === "folded" || o === t.Scalar.BLOCK_FOLDED ? !1 : o === t.Scalar.BLOCK_LITERAL || !a(s, h, g.length);
if (!s) return _ ? "|\n" : ">\n";
let v, y;
for (y = s.length; y > 0; --y) {
let e = s[y - 1];
if (e !== "\n" && e !== " " && e !== " ") break;
}
let b = s.substring(y), x = b.indexOf("\n");
x === -1 ? v = "-" : s === b || x !== b.length - 1 ? (v = "+", f && f()) : v = "", b &&= (s = s.slice(0, -b.length), b[b.length - 1] === "\n" && (b = b.slice(0, -1)), b.replace(l, `$&${g}`));
let S = !1, C, w = -1;
for (C = 0; C < s.length; ++C) {
let e = s[C];
if (e === " ") S = !0;
else if (e === "\n") w = C;
else break;
}
let T = s.substring(0, w < C ? w + 1 : C);
T &&= (s = s.substring(T.length), T.replace(/\n+/g, `$&${g}`));
let E = (S ? g ? "2" : "1" : "") + v;
if (e && (E += " " + m(e.replace(/ ?[\r\n]+/g, " ")), d && d()), !_) {
let e = s.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${g}`), i = !1, a = r(u, !0);
p !== "folded" && o !== t.Scalar.BLOCK_FOLDED && (a.onOverflow = () => {
i = !0;
});
let c = n.foldFlowLines(`${T}${e}${b}`, g, n.FOLD_BLOCK, a);
if (!i) return `>${E}\n${g}${c}`;
}
return s = s.replace(/\n+/g, `$&${g}`), `|${E}\n${g}${T}${s}${b}`;
}
function d(e, a, o, s) {
let { type: l, value: d } = e, { actualString: f, implicitKey: p, indent: m, indentStep: h, inFlow: g } = a;
if (p && d.includes("\n") || g && /[[\]{},]/.test(d)) return c(d, a);
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(d)) return p || g || !d.includes("\n") ? c(d, a) : u(e, a, o, s);
if (!p && !g && l !== t.Scalar.PLAIN && d.includes("\n")) return u(e, a, o, s);
if (i(d)) {
if (m === "") return a.forceBlockIndent = !0, u(e, a, o, s);
if (p && m === h) return c(d, a);
}
let _ = d.replace(/\n+/g, `$&\n${m}`);
if (f) {
let e = (e) => e.default && e.tag !== "tag:yaml.org,2002:str" && e.test?.test(_), { compat: t, tags: n } = a.doc.schema;
if (n.some(e) || t?.some(e)) return c(d, a);
}
return p ? _ : n.foldFlowLines(_, m, n.FOLD_FLOW, r(a, !1));
}
function f(e, n, r, i) {
let { implicitKey: a, inFlow: l } = n, f = typeof e.value == "string" ? e : Object.assign({}, e, { value: String(e.value) }), { type: p } = e;
p !== t.Scalar.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(f.value) && (p = t.Scalar.QUOTE_DOUBLE);
let m = (e) => {
switch (e) {
case t.Scalar.BLOCK_FOLDED:
case t.Scalar.BLOCK_LITERAL: return a || l ? c(f.value, n) : u(f, n, r, i);
case t.Scalar.QUOTE_DOUBLE: return o(f.value, n);
case t.Scalar.QUOTE_SINGLE: return s(f.value, n);
case t.Scalar.PLAIN: return d(f, n, r, i);
default: return null;
}
}, h = m(p);
if (h === null) {
let { defaultKeyType: e, defaultStringType: t } = n.options, r = a && e || t;
if (h = m(r), h === null) throw Error(`Unsupported default string type ${r}`);
}
return h;
}
e.stringifyString = f;
})), hs = /* @__PURE__ */ i(((e) => {
var t = is(), n = Q(), r = fs(), i = ms();
function a(e, t) {
let n = Object.assign({
blockQuote: !0,
commentString: r.stringifyComment,
defaultKeyType: null,
defaultStringType: "PLAIN",
directives: null,
doubleQuotedAsJSON: !1,
doubleQuotedMinMultiLineLength: 40,
falseStr: "false",
flowCollectionPadding: !0,
indentSeq: !0,
lineWidth: 80,
minContentWidth: 20,
nullStr: "null",
simpleKeys: !1,
singleQuote: null,
trailingComma: !1,
trueStr: "true",
verifyAliasOrder: !0
}, e.schema.toStringOptions, t), i;
switch (n.collectionStyle) {
case "block":
i = !1;
break;
case "flow":
i = !0;
break;
default: i = null;
}
return {
anchors: /* @__PURE__ */ new Set(),
doc: e,
flowCollectionPadding: n.flowCollectionPadding ? " " : "",
indent: "",
indentStep: typeof n.indent == "number" ? " ".repeat(n.indent) : " ",
inFlow: i,
options: n
};
}
function o(e, t) {
if (t.tag) {
let n = e.filter((e) => e.tag === t.tag);
if (n.length > 0) return n.find((e) => e.format === t.format) ?? n[0];
}
let r, i;
if (n.isScalar(t)) {
i = t.value;
let n = e.filter((e) => e.identify?.(i));
if (n.length > 1) {
let e = n.filter((e) => e.test);
e.length > 0 && (n = e);
}
r = n.find((e) => e.format === t.format) ?? n.find((e) => !e.format);
} else i = t, r = e.find((e) => e.nodeClass && i instanceof e.nodeClass);
if (!r) {
let e = i?.constructor?.name ?? (i === null ? "null" : typeof i);
throw Error(`Tag not resolved for ${e} value`);
}
return r;
}
function s(e, r, { anchors: i, doc: a }) {
if (!a.directives) return "";
let o = [], s = (n.isScalar(e) || n.isCollection(e)) && e.anchor;
s && t.anchorIsValid(s) && (i.add(s), o.push(`&${s}`));
let c = e.tag ?? (r.default ? null : r.tag);
return c && o.push(a.directives.tagString(c)), o.join(" ");
}
function c(e, t, r, a) {
if (n.isPair(e)) return e.toString(t, r, a);
if (n.isAlias(e)) {
if (t.doc.directives) return e.toString(t);
if (t.resolvedAliases?.has(e)) throw TypeError("Cannot stringify circular structure without alias nodes");
t.resolvedAliases ? t.resolvedAliases.add(e) : t.resolvedAliases = /* @__PURE__ */ new Set([e]), e = e.resolve(t.doc);
}
let c, l = n.isNode(e) ? e : t.doc.createNode(e, { onTagObj: (e) => c = e });
c ??= o(t.doc.schema.tags, l);
let u = s(l, c, t);
u.length > 0 && (t.indentAtStart = (t.indentAtStart ?? 0) + u.length + 1);
let d = typeof c.stringify == "function" ? c.stringify(l, t, r, a) : n.isScalar(l) ? i.stringifyString(l, t, r, a) : l.toString(t, r, a);
return u ? n.isScalar(l) || d[0] === "{" || d[0] === "[" ? `${u} ${d}` : `${u}\n${t.indent}${d}` : d;
}
e.createStringifyContext = a, e.stringify = c;
})), gs = /* @__PURE__ */ i(((e) => {
var t = Q(), n = ls(), r = hs(), i = fs();
function a({ key: e, value: a }, o, s, c) {
let { allNullValues: l, doc: u, indent: d, indentStep: f, options: { commentString: p, indentSeq: m, simpleKeys: h } } = o, g = t.isNode(e) && e.comment || null;
if (h) {
if (g) throw Error("With simple keys, key nodes cannot have comments");
if (t.isCollection(e) || !t.isNode(e) && typeof e == "object") throw Error("With simple keys, collection cannot be used as a key value");
}
let _ = !h && (!e || g && a == null && !o.inFlow || t.isCollection(e) || (t.isScalar(e) ? e.type === n.Scalar.BLOCK_FOLDED || e.type === n.Scalar.BLOCK_LITERAL : typeof e == "object"));
o = Object.assign({}, o, {
allNullValues: !1,
implicitKey: !_ && (h || !l),
indent: d + f
});
let v = !1, y = !1, b = r.stringify(e, o, () => v = !0, () => y = !0);
if (!_ && !o.inFlow && b.length > 1024) {
if (h) throw Error("With simple keys, single line scalar must not span more than 1024 characters");
_ = !0;
}
if (o.inFlow) {
if (l || a == null) return v && s && s(), b === "" ? "?" : _ ? `? ${b}` : b;
} else if (l && !h || a == null && _) return b = `? ${b}`, g && !v ? b += i.lineComment(b, o.indent, p(g)) : y && c && c(), b;
v && (g = null), _ ? (g && (b += i.lineComment(b, o.indent, p(g))), b = `? ${b}\n${d}:`) : (b = `${b}:`, g && (b += i.lineComment(b, o.indent, p(g))));
let x, S, C;
t.isNode(a) ? (x = !!a.spaceBefore, S = a.commentBefore, C = a.comment) : (x = !1, S = null, C = null, a && typeof a == "object" && (a = u.createNode(a))), o.implicitKey = !1, !_ && !g && t.isScalar(a) && (o.indentAtStart = b.length + 1), y = !1, !m && f.length >= 2 && !o.inFlow && !_ && t.isSeq(a) && !a.flow && !a.tag && !a.anchor && (o.indent = o.indent.substring(2));
let w = !1, T = r.stringify(a, o, () => w = !0, () => y = !0), E = " ";
if (g || x || S) {
if (E = x ? "\n" : "", S) {
let e = p(S);
E += `\n${i.indentComment(e, o.indent)}`;
}
T === "" && !o.inFlow ? E === "\n" && C && (E = "\n\n") : E += `\n${o.indent}`;
} else if (!_ && t.isCollection(a)) {
let e = T[0], t = T.indexOf("\n"), n = t !== -1, r = o.inFlow ?? a.flow ?? a.items.length === 0;
if (n || !r) {
let r = !1;
if (n && (e === "&" || e === "!")) {
let n = T.indexOf(" ");
e === "&" && n !== -1 && n < t && T[n + 1] === "!" && (n = T.indexOf(" ", n + 1)), (n === -1 || t < n) && (r = !0);
}
r || (E = `\n${o.indent}`);
}
} else (T === "" || T[0] === "\n") && (E = "");
return b += E + T, o.inFlow ? w && s && s() : C && !w ? b += i.lineComment(b, o.indent, p(C)) : y && c && c(), b;
}
e.stringifyPair = a;
})), _s = /* @__PURE__ */ i(((t) => {
var n = e("process");
function r(e, ...t) {
e === "debug" && console.log(...t);
}
function i(e, t) {
(e === "debug" || e === "warn") && (typeof n.emitWarning == "function" ? n.emitWarning(t) : console.warn(t));
}
t.debug = r, t.warn = i;
})), vs = /* @__PURE__ */ i(((e) => {
var t = Q(), n = ls(), r = "<<", i = {
identify: (e) => e === r || typeof e == "symbol" && e.description === r,
default: "key",
tag: "tag:yaml.org,2002:merge",
test: /^<<$/,
resolve: () => Object.assign(new n.Scalar(Symbol(r)), { addToJSMap: o }),
stringify: () => r
}, a = (e, r) => (i.identify(r) || t.isScalar(r) && (!r.type || r.type === n.Scalar.PLAIN) && i.identify(r.value)) && e?.doc.schema.tags.some((e) => e.tag === i.tag && e.default);
function o(e, n, r) {
let i = c(e, r);
if (t.isSeq(i)) for (let t of i.items) s(e, n, t);
else if (Array.isArray(i)) for (let t of i) s(e, n, t);
else s(e, n, i);
}
function s(e, n, r) {
let i = c(e, r);
if (!t.isMap(i)) throw Error("Merge sources must be maps or map aliases");
let a = i.toJSON(null, e, Map);
for (let [e, t] of a) n instanceof Map ? n.has(e) || n.set(e, t) : n instanceof Set ? n.add(e) : Object.prototype.hasOwnProperty.call(n, e) || Object.defineProperty(n, e, {
value: t,
writable: !0,
enumerable: !0,
configurable: !0
});
return n;
}
function c(e, n) {
return e && t.isAlias(n) ? n.resolve(e.doc, e) : n;
}
e.addMergeToJSMap = o, e.isMergeKey = a, e.merge = i;
})), ys = /* @__PURE__ */ i(((e) => {
var t = _s(), n = vs(), r = hs(), i = Q(), a = os();
function o(e, t, { key: r, value: o }) {
if (i.isNode(r) && r.addToJSMap) r.addToJSMap(e, t, o);
else if (n.isMergeKey(e, r)) n.addMergeToJSMap(e, t, o);
else {
let n = a.toJS(r, "", e);
if (t instanceof Map) t.set(n, a.toJS(o, n, e));
else if (t instanceof Set) t.add(n);
else {
let i = s(r, n, e), c = a.toJS(o, i, e);
i in t ? Object.defineProperty(t, i, {
value: c,
writable: !0,
enumerable: !0,
configurable: !0
}) : t[i] = c;
}
}
return t;
}
function s(e, n, a) {
if (n === null) return "";
if (typeof n != "object") return String(n);
if (i.isNode(e) && a?.doc) {
let n = r.createStringifyContext(a.doc, {});
n.anchors = /* @__PURE__ */ new Set();
for (let e of a.anchors.keys()) n.anchors.add(e.anchor);
n.inFlow = !0, n.inStringifyKey = !0;
let i = e.toString(n);
if (!a.mapKeyWarned) {
let e = JSON.stringify(i);
e.length > 40 && (e = e.substring(0, 36) + "...\""), t.warn(a.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`), a.mapKeyWarned = !0;
}
return i;
}
return JSON.stringify(n);
}
e.addPairToJSMap = o;
})), bs = /* @__PURE__ */ i(((e) => {
var t = us(), n = gs(), r = ys(), i = Q();
function a(e, n, r) {
return new o(t.createNode(e, void 0, r), t.createNode(n, void 0, r));
}
var o = class e {
constructor(e, t = null) {
Object.defineProperty(this, i.NODE_TYPE, { value: i.PAIR }), this.key = e, this.value = t;
}
clone(t) {
let { key: n, value: r } = this;
return i.isNode(n) && (n = n.clone(t)), i.isNode(r) && (r = r.clone(t)), new e(n, r);
}
toJSON(e, t) {
let n = t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
return r.addPairToJSMap(t, n, this);
}
toString(e, t, r) {
return e?.doc ? n.stringifyPair(this, e, t, r) : JSON.stringify(this);
}
};
e.Pair = o, e.createPair = a;
})), xs = /* @__PURE__ */ i(((e) => {
var t = Q(), n = hs(), r = fs();
function i(e, t, n) {
return (t.inFlow ?? e.flow ? o : a)(e, t, n);
}
function a({ comment: e, items: i }, a, { blockItemPrefix: o, flowChars: c, itemIndent: l, onChompKeep: u, onComment: d }) {
let { indent: f, options: { commentString: p } } = a, m = Object.assign({}, a, {
indent: l,
type: null
}), h = !1, g = [];
for (let e = 0; e < i.length; ++e) {
let c = i[e], u = null;
if (t.isNode(c)) !h && c.spaceBefore && g.push(""), s(a, g, c.commentBefore, h), c.comment && (u = c.comment);
else if (t.isPair(c)) {
let e = t.isNode(c.key) ? c.key : null;
e && (!h && e.spaceBefore && g.push(""), s(a, g, e.commentBefore, h));
}
h = !1;
let d = n.stringify(c, m, () => u = null, () => h = !0);
u && (d += r.lineComment(d, l, p(u))), h && u && (h = !1), g.push(o + d);
}
let _;
if (g.length === 0) _ = c.start + c.end;
else {
_ = g[0];
for (let e = 1; e < g.length; ++e) {
let t = g[e];
_ += t ? `\n${f}${t}` : "\n";
}
}
return e ? (_ += "\n" + r.indentComment(p(e), f), d && d()) : h && u && u(), _;
}
function o({ items: e }, i, { flowChars: a, itemIndent: o }) {
let { indent: c, indentStep: l, flowCollectionPadding: u, options: { commentString: d } } = i;
o += l;
let f = Object.assign({}, i, {
indent: o,
inFlow: !0,
type: null
}), p = !1, m = 0, h = [];
for (let a = 0; a < e.length; ++a) {
let c = e[a], l = null;
if (t.isNode(c)) c.spaceBefore && h.push(""), s(i, h, c.commentBefore, !1), c.comment && (l = c.comment);
else if (t.isPair(c)) {
let e = t.isNode(c.key) ? c.key : null;
e && (e.spaceBefore && h.push(""), s(i, h, e.commentBefore, !1), e.comment && (p = !0));
let n = t.isNode(c.value) ? c.value : null;
n ? (n.comment && (l = n.comment), n.commentBefore && (p = !0)) : c.value == null && e?.comment && (l = e.comment);
}
l && (p = !0);
let u = n.stringify(c, f, () => l = null);
p ||= h.length > m || u.includes("\n"), a < e.length - 1 ? u += "," : i.options.trailingComma && (i.options.lineWidth > 0 && (p ||= h.reduce((e, t) => e + t.length + 2, 2) + (u.length + 2) > i.options.lineWidth), p && (u += ",")), l && (u += r.lineComment(u, o, d(l))), h.push(u), m = h.length;
}
let { start: g, end: _ } = a;
if (h.length === 0) return g + _;
if (!p) {
let e = h.reduce((e, t) => e + t.length + 2, 2);
p = i.options.lineWidth > 0 && e > i.options.lineWidth;
}
if (p) {
let e = g;
for (let t of h) e += t ? `\n${l}${c}${t}` : "\n";
return `${e}\n${c}${_}`;
}
return `${g}${u}${h.join(" ")}${u}${_}`;
}
function s({ indent: e, options: { commentString: t } }, n, i, a) {
if (i && a && (i = i.replace(/^\n+/, "")), i) {
let a = r.indentComment(t(i), e);
n.push(a.trimStart());
}
}
e.stringifyCollection = i;
})), Ss = /* @__PURE__ */ i(((e) => {
var t = xs(), n = ys(), r = ds(), i = Q(), a = bs(), o = ls();
function s(e, t) {
let n = i.isScalar(t) ? t.value : t;
for (let r of e) if (i.isPair(r) && (r.key === t || r.key === n || i.isScalar(r.key) && r.key.value === n)) return r;
}
e.YAMLMap = class extends r.Collection {
static get tagName() {
return "tag:yaml.org,2002:map";
}
constructor(e) {
super(i.MAP, e), this.items = [];
}
static from(e, t, n) {
let { keepUndefined: r, replacer: i } = n, o = new this(e), s = (e, s) => {
if (typeof i == "function") s = i.call(t, e, s);
else if (Array.isArray(i) && !i.includes(e)) return;
(s !== void 0 || r) && o.items.push(a.createPair(e, s, n));
};
if (t instanceof Map) for (let [e, n] of t) s(e, n);
else if (t && typeof t == "object") for (let e of Object.keys(t)) s(e, t[e]);
return typeof e.sortMapEntries == "function" && o.items.sort(e.sortMapEntries), o;
}
add(e, t) {
let n;
n = i.isPair(e) ? e : !e || typeof e != "object" || !("key" in e) ? new a.Pair(e, e?.value) : new a.Pair(e.key, e.value);
let r = s(this.items, n.key), c = this.schema?.sortMapEntries;
if (r) {
if (!t) throw Error(`Key ${n.key} already set`);
i.isScalar(r.value) && o.isScalarValue(n.value) ? r.value.value = n.value : r.value = n.value;
} else if (c) {
let e = this.items.findIndex((e) => c(n, e) < 0);
e === -1 ? this.items.push(n) : this.items.splice(e, 0, n);
} else this.items.push(n);
}
delete(e) {
let t = s(this.items, e);
return t ? this.items.splice(this.items.indexOf(t), 1).length > 0 : !1;
}
get(e, t) {
let n = s(this.items, e)?.value;
return (!t && i.isScalar(n) ? n.value : n) ?? void 0;
}
has(e) {
return !!s(this.items, e);
}
set(e, t) {
this.add(new a.Pair(e, t), !0);
}
toJSON(e, t, r) {
let i = r ? new r() : t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
t?.onCreate && t.onCreate(i);
for (let e of this.items) n.addPairToJSMap(t, i, e);
return i;
}
toString(e, n, r) {
if (!e) return JSON.stringify(this);
for (let e of this.items) if (!i.isPair(e)) throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), t.stringifyCollection(this, e, {
blockItemPrefix: "",
flowChars: {
start: "{",
end: "}"
},
itemIndent: e.indent || "",
onChompKeep: r,
onComment: n
});
}
}, e.findPair = s;
})), Cs = /* @__PURE__ */ i(((e) => {
var t = Q(), n = Ss();
e.map = {
collection: "map",
default: !0,
nodeClass: n.YAMLMap,
tag: "tag:yaml.org,2002:map",
resolve(e, n) {
return t.isMap(e) || n("Expected a mapping for this tag"), e;
},
createNode: (e, t, r) => n.YAMLMap.from(e, t, r)
};
})), ws = /* @__PURE__ */ i(((e) => {
var t = us(), n = xs(), r = ds(), i = Q(), a = ls(), o = os(), s = class extends r.Collection {
static get tagName() {
return "tag:yaml.org,2002:seq";
}
constructor(e) {
super(i.SEQ, e), this.items = [];
}
add(e) {
this.items.push(e);
}
delete(e) {
let t = c(e);
return typeof t == "number" && this.items.splice(t, 1).length > 0;
}
get(e, t) {
let n = c(e);
if (typeof n != "number") return;
let r = this.items[n];
return !t && i.isScalar(r) ? r.value : r;
}
has(e) {
let t = c(e);
return typeof t == "number" && t < this.items.length;
}
set(e, t) {
let n = c(e);
if (typeof n != "number") throw Error(`Expected a valid index, not ${e}.`);
let r = this.items[n];
i.isScalar(r) && a.isScalarValue(t) ? r.value = t : this.items[n] = t;
}
toJSON(e, t) {
let n = [];
t?.onCreate && t.onCreate(n);
let r = 0;
for (let e of this.items) n.push(o.toJS(e, String(r++), t));
return n;
}
toString(e, t, r) {
return e ? n.stringifyCollection(this, e, {
blockItemPrefix: "- ",
flowChars: {
start: "[",
end: "]"
},
itemIndent: (e.indent || "") + " ",
onChompKeep: r,
onComment: t
}) : JSON.stringify(this);
}
static from(e, n, r) {
let { replacer: i } = r, a = new this(e);
if (n && Symbol.iterator in Object(n)) {
let e = 0;
for (let o of n) {
if (typeof i == "function") {
let t = n instanceof Set ? o : String(e++);
o = i.call(n, t, o);
}
a.items.push(t.createNode(o, void 0, r));
}
}
return a;
}
};
function c(e) {
let t = i.isScalar(e) ? e.value : e;
return t && typeof t == "string" && (t = Number(t)), typeof t == "number" && Number.isInteger(t) && t >= 0 ? t : null;
}
e.YAMLSeq = s;
})), Ts = /* @__PURE__ */ i(((e) => {
var t = Q(), n = ws();
e.seq = {
collection: "seq",
default: !0,
nodeClass: n.YAMLSeq,
tag: "tag:yaml.org,2002:seq",
resolve(e, n) {
return t.isSeq(e) || n("Expected a sequence for this tag"), e;
},
createNode: (e, t, r) => n.YAMLSeq.from(e, t, r)
};
})), Es = /* @__PURE__ */ i(((e) => {
var t = ms();
e.string = {
identify: (e) => typeof e == "string",
default: !0,
tag: "tag:yaml.org,2002:str",
resolve: (e) => e,
stringify(e, n, r, i) {
return n = Object.assign({ actualString: !0 }, n), t.stringifyString(e, n, r, i);
}
};
})), Ds = /* @__PURE__ */ i(((e) => {
var t = ls(), n = {
identify: (e) => e == null,
createNode: () => new t.Scalar(null),
default: !0,
tag: "tag:yaml.org,2002:null",
test: /^(?:~|[Nn]ull|NULL)?$/,
resolve: () => new t.Scalar(null),
stringify: ({ source: e }, t) => typeof e == "string" && n.test.test(e) ? e : t.options.nullStr
};
e.nullTag = n;
})), Os = /* @__PURE__ */ i(((e) => {
var t = ls(), n = {
identify: (e) => typeof e == "boolean",
default: !0,
tag: "tag:yaml.org,2002:bool",
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
resolve: (e) => new t.Scalar(e[0] === "t" || e[0] === "T"),
stringify({ source: e, value: t }, r) {
return e && n.test.test(e) && t === (e[0] === "t" || e[0] === "T") ? e : t ? r.options.trueStr : r.options.falseStr;
}
};
e.boolTag = n;
})), ks = /* @__PURE__ */ i(((e) => {
function t({ format: e, minFractionDigits: t, tag: n, value: r }) {
if (typeof r == "bigint") return String(r);
let i = typeof r == "number" ? r : Number(r);
if (!isFinite(i)) return isNaN(i) ? ".nan" : i < 0 ? "-.inf" : ".inf";
let a = Object.is(r, -0) ? "-0" : JSON.stringify(r);
if (!e && t && (!n || n === "tag:yaml.org,2002:float") && /^-?\d/.test(a) && !a.includes("e")) {
let e = a.indexOf(".");
e < 0 && (e = a.length, a += ".");
let n = t - (a.length - e - 1);
for (; n-- > 0;) a += "0";
}
return a;
}
e.stringifyNumber = t;
})), As = /* @__PURE__ */ i(((e) => {
var t = ls(), n = ks(), r = {
identify: (e) => typeof e == "number",
default: !0,
tag: "tag:yaml.org,2002:float",
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
resolve: (e) => e.slice(-3).toLowerCase() === "nan" ? NaN : e[0] === "-" ? -Infinity : Infinity,
stringify: n.stringifyNumber
};
e.float = {
identify: (e) => typeof e == "number",
default: !0,
tag: "tag:yaml.org,2002:float",
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
resolve(e) {
let n = new t.Scalar(parseFloat(e)), r = e.indexOf(".");
return r !== -1 && e[e.length - 1] === "0" && (n.minFractionDigits = e.length - r - 1), n;
},
stringify: n.stringifyNumber
}, e.floatExp = {
identify: (e) => typeof e == "number",
default: !0,
tag: "tag:yaml.org,2002:float",
format: "EXP",
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
resolve: (e) => parseFloat(e),
stringify(e) {
let t = Number(e.value);
return isFinite(t) ? t.toExponential() : n.stringifyNumber(e);
}
}, e.floatNaN = r;
})), js = /* @__PURE__ */ i(((e) => {
var t = ks(), n = (e) => typeof e == "bigint" || Number.isInteger(e), r = (e, t, n, { intAsBigInt: r }) => r ? BigInt(e) : parseInt(e.substring(t), n);
function i(e, r, i) {
let { value: a } = e;
return n(a) && a >= 0 ? i + a.toString(r) : t.stringifyNumber(e);
}
e.int = {
identify: n,
default: !0,
tag: "tag:yaml.org,2002:int",
test: /^[-+]?[0-9]+$/,
resolve: (e, t, n) => r(e, 0, 10, n),
stringify: t.stringifyNumber
}, e.intHex = {
identify: (e) => n(e) && e >= 0,
default: !0,
tag: "tag:yaml.org,2002:int",
format: "HEX",
test: /^0x[0-9a-fA-F]+$/,
resolve: (e, t, n) => r(e, 2, 16, n),
stringify: (e) => i(e, 16, "0x")
}, e.intOct = {
identify: (e) => n(e) && e >= 0,
default: !0,
tag: "tag:yaml.org,2002:int",
format: "OCT",
test: /^0o[0-7]+$/,
resolve: (e, t, n) => r(e, 2, 8, n),
stringify: (e) => i(e, 8, "0o")
};
})), Ms = /* @__PURE__ */ i(((e) => {
var t = Cs(), n = Ds(), r = Ts(), i = Es(), a = Os(), o = As(), s = js();
e.schema = [
t.map,
r.seq,
i.string,
n.nullTag,
a.boolTag,
s.intOct,
s.int,
s.intHex,
o.floatNaN,
o.floatExp,
o.float
];
})), Ns = /* @__PURE__ */ i(((e) => {
var t = ls(), n = Cs(), r = Ts();
function i(e) {
return typeof e == "bigint" || Number.isInteger(e);
}
var a = ({ value: e }) => JSON.stringify(e), o = [
{
identify: (e) => typeof e == "string",
default: !0,
tag: "tag:yaml.org,2002:str",
resolve: (e) => e,
stringify: a
},
{
identify: (e) => e == null,
createNode: () => new t.Scalar(null),
default: !0,
tag: "tag:yaml.org,2002:null",
test: /^null$/,
resolve: () => null,
stringify: a
},
{
identify: (e) => typeof e == "boolean",
default: !0,
tag: "tag:yaml.org,2002:bool",
test: /^true$|^false$/,
resolve: (e) => e === "true",
stringify: a
},
{
identify: i,
default: !0,
tag: "tag:yaml.org,2002:int",
test: /^-?(?:0|[1-9][0-9]*)$/,
resolve: (e, t, { intAsBigInt: n }) => n ? BigInt(e) : parseInt(e, 10),
stringify: ({ value: e }) => i(e) ? e.toString() : JSON.stringify(e)
},
{
identify: (e) => typeof e == "number",
default: !0,
tag: "tag:yaml.org,2002:float",
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
resolve: (e) => parseFloat(e),
stringify: a
}
];
e.schema = [n.map, r.seq].concat(o, {
default: !0,
tag: "",
test: /^/,
resolve(e, t) {
return t(`Unresolved plain scalar ${JSON.stringify(e)}`), e;
}
});
})), Ps = /* @__PURE__ */ i(((t) => {
var n = e("buffer"), r = ls(), i = ms();
t.binary = {
identify: (e) => e instanceof Uint8Array,
default: !1,
tag: "tag:yaml.org,2002:binary",
resolve(e, t) {
if (typeof n.Buffer == "function") return n.Buffer.from(e, "base64");
if (typeof atob == "function") {
let t = atob(e.replace(/[\n\r]/g, "")), n = new Uint8Array(t.length);
for (let e = 0; e < t.length; ++e) n[e] = t.charCodeAt(e);
return n;
}
return t("This environment does not support reading binary tags; either Buffer or atob is required"), e;
},
stringify({ comment: e, type: t, value: a }, o, s, c) {
if (!a) return "";
let l = a, u;
if (typeof n.Buffer == "function") u = l instanceof n.Buffer ? l.toString("base64") : n.Buffer.from(l.buffer).toString("base64");
else if (typeof btoa == "function") {
let e = "";
for (let t = 0; t < l.length; ++t) e += String.fromCharCode(l[t]);
u = btoa(e);
} else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");
if (t ??= r.Scalar.BLOCK_LITERAL, t !== r.Scalar.QUOTE_DOUBLE) {
let e = Math.max(o.options.lineWidth - o.indent.length, o.options.minContentWidth), n = Math.ceil(u.length / e), i = Array(n);
for (let t = 0, r = 0; t < n; ++t, r += e) i[t] = u.substr(r, e);
u = i.join(t === r.Scalar.BLOCK_LITERAL ? "\n" : " ");
}
return i.stringifyString({
comment: e,
type: t,
value: u
}, o, s, c);
}
};
})), Fs = /* @__PURE__ */ i(((e) => {
var t = Q(), n = bs(), r = ls(), i = ws();
function a(e, i) {
if (t.isSeq(e)) for (let a = 0; a < e.items.length; ++a) {
let o = e.items[a];
if (!t.isPair(o)) {
if (t.isMap(o)) {
o.items.length > 1 && i("Each pair must have its own sequence indicator");
let e = o.items[0] || new n.Pair(new r.Scalar(null));
if (o.commentBefore && (e.key.commentBefore = e.key.commentBefore ? `${o.commentBefore}\n${e.key.commentBefore}` : o.commentBefore), o.comment) {
let t = e.value ?? e.key;
t.comment = t.comment ? `${o.comment}\n${t.comment}` : o.comment;
}
o = e;
}
e.items[a] = t.isPair(o) ? o : new n.Pair(o);
}
}
else i("Expected a sequence for this tag");
return e;
}
function o(e, t, r) {
let { replacer: a } = r, o = new i.YAMLSeq(e);
o.tag = "tag:yaml.org,2002:pairs";
let s = 0;
if (t && Symbol.iterator in Object(t)) for (let e of t) {
typeof a == "function" && (e = a.call(t, String(s++), e));
let i, c;
if (Array.isArray(e)) {
if (e.length === 2) i = e[0], c = e[1];
else throw TypeError(`Expected [key, value] tuple: ${e}`);
} else if (e && e instanceof Object) {
let t = Object.keys(e);
if (t.length === 1) i = t[0], c = e[i];
else throw TypeError(`Expected tuple with one key, not ${t.length} keys`);
} else i = e;
o.items.push(n.createPair(i, c, r));
}
return o;
}
var s = {
collection: "seq",
default: !1,
tag: "tag:yaml.org,2002:pairs",
resolve: a,
createNode: o
};
e.createPairs = o, e.pairs = s, e.resolvePairs = a;
})), Is = /* @__PURE__ */ i(((e) => {
var t = Q(), n = os(), r = Ss(), i = ws(), a = Fs(), o = class e extends i.YAMLSeq {
constructor() {
super(), this.add = r.YAMLMap.prototype.add.bind(this), this.delete = r.YAMLMap.prototype.delete.bind(this), this.get = r.YAMLMap.prototype.get.bind(this), this.has = r.YAMLMap.prototype.has.bind(this), this.set = r.YAMLMap.prototype.set.bind(this), this.tag = e.tag;
}
toJSON(e, r) {
if (!r) return super.toJSON(e);
let i = /* @__PURE__ */ new Map();
r?.onCreate && r.onCreate(i);
for (let e of this.items) {
let a, o;
if (t.isPair(e) ? (a = n.toJS(e.key, "", r), o = n.toJS(e.value, a, r)) : a = n.toJS(e, "", r), i.has(a)) throw Error("Ordered maps must not include duplicate keys");
i.set(a, o);
}
return i;
}
static from(e, t, n) {
let r = a.createPairs(e, t, n), i = new this();
return i.items = r.items, i;
}
};
o.tag = "tag:yaml.org,2002:omap";
var s = {
collection: "seq",
identify: (e) => e instanceof Map,
nodeClass: o,
default: !1,
tag: "tag:yaml.org,2002:omap",
resolve(e, n) {
let r = a.resolvePairs(e, n), i = [];
for (let { key: e } of r.items) t.isScalar(e) && (i.includes(e.value) ? n(`Ordered maps must not include duplicate keys: ${e.value}`) : i.push(e.value));
return Object.assign(new o(), r);
},
createNode: (e, t, n) => o.from(e, t, n)
};
e.YAMLOMap = o, e.omap = s;
})), Ls = /* @__PURE__ */ i(((e) => {
var t = ls();
function n({ value: e, source: t }, n) {
return t && (e ? r : i).test.test(t) ? t : e ? n.options.trueStr : n.options.falseStr;
}
var r = {
identify: (e) => e === !0,
default: !0,
tag: "tag:yaml.org,2002:bool",
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
resolve: () => new t.Scalar(!0),
stringify: n
}, i = {
identify: (e) => e === !1,
default: !0,
tag: "tag:yaml.org,2002:bool",
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
resolve: () => new t.Scalar(!1),
stringify: n
};
e.falseTag = i, e.trueTag = r;
})), Rs = /* @__PURE__ */ i(((e) => {
var t = ls(), n = ks(), r = {
identify: (e) => typeof e == "number",
default: !0,
tag: "tag:yaml.org,2002:float",
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
resolve: (e) => e.slice(-3).toLowerCase() === "nan" ? NaN : e[0] === "-" ? -Infinity : Infinity,
stringify: n.stringifyNumber
};
e.float = {
identify: (e) => typeof e == "number",
default: !0,
tag: "tag:yaml.org,2002:float",
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
resolve(e) {
let n = new t.Scalar(parseFloat(e.replace(/_/g, ""))), r = e.indexOf(".");
if (r !== -1) {
let t = e.substring(r + 1).replace(/_/g, "");
t[t.length - 1] === "0" && (n.minFractionDigits = t.length);
}
return n;
},
stringify: n.stringifyNumber
}, e.floatExp = {
identify: (e) => typeof e == "number",
default: !0,
tag: "tag:yaml.org,2002:float",
format: "EXP",
test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
resolve: (e) => parseFloat(e.replace(/_/g, "")),
stringify(e) {
let t = Number(e.value);
return isFinite(t) ? t.toExponential() : n.stringifyNumber(e);
}
}, e.floatNaN = r;
})), zs = /* @__PURE__ */ i(((e) => {
var t = ks(), n = (e) => typeof e == "bigint" || Number.isInteger(e);
function r(e, t, n, { intAsBigInt: r }) {
let i = e[0];
if ((i === "-" || i === "+") && (t += 1), e = e.substring(t).replace(/_/g, ""), r) {
switch (n) {
case 2:
e = `0b${e}`;
break;
case 8:
e = `0o${e}`;
break;
case 16: e = `0x${e}`;
}
let t = BigInt(e);
return i === "-" ? BigInt(-1) * t : t;
}
let a = parseInt(e, n);
return i === "-" ? -1 * a : a;
}
function i(e, r, i) {
let { value: a } = e;
if (n(a)) {
let e = a.toString(r);
return a < 0 ? "-" + i + e.substr(1) : i + e;
}
return t.stringifyNumber(e);
}
var a = {
identify: n,
default: !0,
tag: "tag:yaml.org,2002:int",
format: "BIN",
test: /^[-+]?0b[0-1_]+$/,
resolve: (e, t, n) => r(e, 2, 2, n),
stringify: (e) => i(e, 2, "0b")
}, o = {
identify: n,
default: !0,
tag: "tag:yaml.org,2002:int",
format: "OCT",
test: /^[-+]?0[0-7_]+$/,
resolve: (e, t, n) => r(e, 1, 8, n),
stringify: (e) => i(e, 8, "0")
}, s = {
identify: n,
default: !0,
tag: "tag:yaml.org,2002:int",
test: /^[-+]?[0-9][0-9_]*$/,
resolve: (e, t, n) => r(e, 0, 10, n),
stringify: t.stringifyNumber
}, c = {
identify: n,
default: !0,
tag: "tag:yaml.org,2002:int",
format: "HEX",
test: /^[-+]?0x[0-9a-fA-F_]+$/,
resolve: (e, t, n) => r(e, 2, 16, n),
stringify: (e) => i(e, 16, "0x")
};
e.int = s, e.intBin = a, e.intHex = c, e.intOct = o;
})), Bs = /* @__PURE__ */ i(((e) => {
var t = Q(), n = bs(), r = Ss(), i = class e extends r.YAMLMap {
constructor(t) {
super(t), this.tag = e.tag;
}
add(e) {
let i;
i = t.isPair(e) ? e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? new n.Pair(e.key, null) : new n.Pair(e, null), r.findPair(this.items, i.key) || this.items.push(i);
}
get(e, n) {
let i = r.findPair(this.items, e);
return !n && t.isPair(i) ? t.isScalar(i.key) ? i.key.value : i.key : i;
}
set(e, t) {
if (typeof t != "boolean") throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);
let i = r.findPair(this.items, e);
i && !t ? this.items.splice(this.items.indexOf(i), 1) : !i && t && this.items.push(new n.Pair(e));
}
toJSON(e, t) {
return super.toJSON(e, t, Set);
}
toString(e, t, n) {
if (!e) return JSON.stringify(this);
if (this.hasAllNullValues(!0)) return super.toString(Object.assign({}, e, { allNullValues: !0 }), t, n);
throw Error("Set items must all have null values");
}
static from(e, t, r) {
let { replacer: i } = r, a = new this(e);
if (t && Symbol.iterator in Object(t)) for (let e of t) typeof i == "function" && (e = i.call(t, e, e)), a.items.push(n.createPair(e, null, r));
return a;
}
};
i.tag = "tag:yaml.org,2002:set";
var a = {
collection: "map",
identify: (e) => e instanceof Set,
nodeClass: i,
default: !1,
tag: "tag:yaml.org,2002:set",
createNode: (e, t, n) => i.from(e, t, n),
resolve(e, n) {
if (t.isMap(e)) {
if (e.hasAllNullValues(!0)) return Object.assign(new i(), e);
n("Set items must all have null values");
} else n("Expected a mapping for this tag");
return e;
}
};
e.YAMLSet = i, e.set = a;
})), Vs = /* @__PURE__ */ i(((e) => {
var t = ks();
function n(e, t) {
let n = e[0], r = n === "-" || n === "+" ? e.substring(1) : e, i = (e) => t ? BigInt(e) : Number(e), a = r.replace(/_/g, "").split(":").reduce((e, t) => e * i(60) + i(t), i(0));
return n === "-" ? i(-1) * a : a;
}
function r(e) {
let { value: n } = e, r = (e) => e;
if (typeof n == "bigint") r = (e) => BigInt(e);
else if (isNaN(n) || !isFinite(n)) return t.stringifyNumber(e);
let i = "";
n < 0 && (i = "-", n *= r(-1));
let a = r(60), o = [n % a];
return n < 60 ? o.unshift(0) : (n = (n - o[0]) / a, o.unshift(n % a), n >= 60 && (n = (n - o[0]) / a, o.unshift(n))), i + o.map((e) => String(e).padStart(2, "0")).join(":").replace(/000000\d*$/, "");
}
var i = {
identify: (e) => typeof e == "bigint" || Number.isInteger(e),
default: !0,
tag: "tag:yaml.org,2002:int",
format: "TIME",
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
resolve: (e, t, { intAsBigInt: r }) => n(e, r),
stringify: r
}, a = {
identify: (e) => typeof e == "number",
default: !0,
tag: "tag:yaml.org,2002:float",
format: "TIME",
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
resolve: (e) => n(e, !1),
stringify: r
}, o = {
identify: (e) => e instanceof Date,
default: !0,
tag: "tag:yaml.org,2002:timestamp",
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
resolve(e) {
let t = e.match(o.test);
if (!t) throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");
let [, r, i, a, s, c, l] = t.map(Number), u = t[7] ? Number((t[7] + "00").substr(1, 3)) : 0, d = Date.UTC(r, i - 1, a, s || 0, c || 0, l || 0, u), f = t[8];
if (f && f !== "Z") {
let e = n(f, !1);
Math.abs(e) < 30 && (e *= 60), d -= 6e4 * e;
}
return new Date(d);
},
stringify: ({ value: e }) => e?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
};
e.floatTime = a, e.intTime = i, e.timestamp = o;
})), Hs = /* @__PURE__ */ i(((e) => {
var t = Cs(), n = Ds(), r = Ts(), i = Es(), a = Ps(), o = Ls(), s = Rs(), c = zs(), l = vs(), u = Is(), d = Fs(), f = Bs(), p = Vs();
e.schema = [
t.map,
r.seq,
i.string,
n.nullTag,
o.trueTag,
o.falseTag,
c.intBin,
c.intOct,
c.int,
c.intHex,
s.floatNaN,
s.floatExp,
s.float,
a.binary,
l.merge,
u.omap,
d.pairs,
f.set,
p.intTime,
p.floatTime,
p.timestamp
];
})), Us = /* @__PURE__ */ i(((e) => {
var t = Cs(), n = Ds(), r = Ts(), i = Es(), a = Os(), o = As(), s = js(), c = Ms(), l = Ns(), u = Ps(), d = vs(), f = Is(), p = Fs(), m = Hs(), h = Bs(), g = Vs(), _ = /* @__PURE__ */ new Map([
["core", c.schema],
["failsafe", [
t.map,
r.seq,
i.string
]],
["json", l.schema],
["yaml11", m.schema],
["yaml-1.1", m.schema]
]), v = {
binary: u.binary,
bool: a.boolTag,
float: o.float,
floatExp: o.floatExp,
floatNaN: o.floatNaN,
floatTime: g.floatTime,
int: s.int,
intHex: s.intHex,
intOct: s.intOct,
intTime: g.intTime,
map: t.map,
merge: d.merge,
null: n.nullTag,
omap: f.omap,
pairs: p.pairs,
seq: r.seq,
set: h.set,
timestamp: g.timestamp
}, y = {
"tag:yaml.org,2002:binary": u.binary,
"tag:yaml.org,2002:merge": d.merge,
"tag:yaml.org,2002:omap": f.omap,
"tag:yaml.org,2002:pairs": p.pairs,
"tag:yaml.org,2002:set": h.set,
"tag:yaml.org,2002:timestamp": g.timestamp
};
function b(e, t, n) {
let r = _.get(t);
if (r && !e) return n && !r.includes(d.merge) ? r.concat(d.merge) : r.slice();
let i = r;
if (!i) {
if (Array.isArray(e)) i = [];
else {
let e = Array.from(_.keys()).filter((e) => e !== "yaml11").map((e) => JSON.stringify(e)).join(", ");
throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`);
}
}
if (Array.isArray(e)) for (let t of e) i = i.concat(t);
else typeof e == "function" && (i = e(i.slice()));
return n && (i = i.concat(d.merge)), i.reduce((e, t) => {
let n = typeof t == "string" ? v[t] : t;
if (!n) {
let e = JSON.stringify(t), n = Object.keys(v).map((e) => JSON.stringify(e)).join(", ");
throw Error(`Unknown custom tag ${e}; use one of ${n}`);
}
return e.includes(n) || e.push(n), e;
}, []);
}
e.coreKnownTags = y, e.getTags = b;
})), Ws = /* @__PURE__ */ i(((e) => {
var t = Q(), n = Cs(), r = Ts(), i = Es(), a = Us(), o = (e, t) => e.key < t.key ? -1 : +(e.key > t.key);
e.Schema = class e {
constructor({ compat: e, customTags: s, merge: c, resolveKnownTags: l, schema: u, sortMapEntries: d, toStringDefaults: f }) {
this.compat = Array.isArray(e) ? a.getTags(e, "compat") : e ? a.getTags(null, e) : null, this.name = typeof u == "string" && u || "core", this.knownTags = l ? a.coreKnownTags : {}, this.tags = a.getTags(s, this.name, c), this.toStringOptions = f ?? null, Object.defineProperty(this, t.MAP, { value: n.map }), Object.defineProperty(this, t.SCALAR, { value: i.string }), Object.defineProperty(this, t.SEQ, { value: r.seq }), this.sortMapEntries = typeof d == "function" ? d : d === !0 ? o : null;
}
clone() {
let t = Object.create(e.prototype, Object.getOwnPropertyDescriptors(this));
return t.tags = this.tags.slice(), t;
}
};
})), Gs = /* @__PURE__ */ i(((e) => {
var t = Q(), n = hs(), r = fs();
function i(e, i) {
let a = [], o = i.directives === !0;
if (i.directives !== !1 && e.directives) {
let t = e.directives.toString(e);
t ? (a.push(t), o = !0) : e.directives.docStart && (o = !0);
}
o && a.push("---");
let s = n.createStringifyContext(e, i), { commentString: c } = s.options;
if (e.commentBefore) {
a.length !== 1 && a.unshift("");
let t = c(e.commentBefore);
a.unshift(r.indentComment(t, ""));
}
let l = !1, u = null;
if (e.contents) {
if (t.isNode(e.contents)) {
if (e.contents.spaceBefore && o && a.push(""), e.contents.commentBefore) {
let t = c(e.contents.commentBefore);
a.push(r.indentComment(t, ""));
}
s.forceBlockIndent = !!e.comment, u = e.contents.comment;
}
let i = u ? void 0 : () => l = !0, d = n.stringify(e.contents, s, () => u = null, i);
u && (d += r.lineComment(d, "", c(u))), (d[0] === "|" || d[0] === ">") && a[a.length - 1] === "---" ? a[a.length - 1] = `--- ${d}` : a.push(d);
} else a.push(n.stringify(e.contents, s));
if (e.directives?.docEnd) {
if (e.comment) {
let t = c(e.comment);
t.includes("\n") ? (a.push("..."), a.push(r.indentComment(t, ""))) : a.push(`... ${t}`);
} else a.push("...");
} else {
let t = e.comment;
t && l && (t = t.replace(/^\n+/, "")), t && ((!l || u) && a[a.length - 1] !== "" && a.push(""), a.push(r.indentComment(c(t), "")));
}
return a.join("\n") + "\n";
}
e.stringifyDocument = i;
})), Ks = /* @__PURE__ */ i(((e) => {
var t = cs(), n = ds(), r = Q(), i = bs(), a = os(), o = Ws(), s = Gs(), c = is(), l = as(), u = us(), d = rs(), f = class e {
constructor(e, t, n) {
this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, r.NODE_TYPE, { value: r.DOC });
let i = null;
typeof t == "function" || Array.isArray(t) ? i = t : n === void 0 && t && (n = t, t = void 0);
let a = Object.assign({
intAsBigInt: !1,
keepSourceTokens: !1,
logLevel: "warn",
prettyErrors: !0,
strict: !0,
stringKeys: !1,
uniqueKeys: !0,
version: "1.2"
}, n);
this.options = a;
let { version: o } = a;
n?._directives ? (this.directives = n._directives.atDocument(), this.directives.yaml.explicit && (o = this.directives.yaml.version)) : this.directives = new d.Directives({ version: o }), this.setSchema(o, n), this.contents = e === void 0 ? null : this.createNode(e, i, n);
}
clone() {
let t = Object.create(e.prototype, { [r.NODE_TYPE]: { value: r.DOC } });
return t.commentBefore = this.commentBefore, t.comment = this.comment, t.errors = this.errors.slice(), t.warnings = this.warnings.slice(), t.options = Object.assign({}, this.options), this.directives && (t.directives = this.directives.clone()), t.schema = this.schema.clone(), t.contents = r.isNode(this.contents) ? this.contents.clone(t.schema) : this.contents, this.range && (t.range = this.range.slice()), t;
}
add(e) {
p(this.contents) && this.contents.add(e);
}
addIn(e, t) {
p(this.contents) && this.contents.addIn(e, t);
}
createAlias(e, n) {
if (!e.anchor) {
let t = c.anchorNames(this);
e.anchor = !n || t.has(n) ? c.findNewAnchor(n || "a", t) : n;
}
return new t.Alias(e.anchor);
}
createNode(e, t, n) {
let i;
if (typeof t == "function") e = t.call({ "": e }, "", e), i = t;
else if (Array.isArray(t)) {
let e = t.filter((e) => typeof e == "number" || e instanceof String || e instanceof Number).map(String);
e.length > 0 && (t = t.concat(e)), i = t;
} else n === void 0 && t && (n = t, t = void 0);
let { aliasDuplicateObjects: a, anchorPrefix: o, flow: s, keepUndefined: l, onTagObj: d, tag: f } = n ?? {}, { onAnchor: p, setAnchors: m, sourceObjects: h } = c.createNodeAnchors(this, o || "a"), g = {
aliasDuplicateObjects: a ?? !0,
keepUndefined: l ?? !1,
onAnchor: p,
onTagObj: d,
replacer: i,
schema: this.schema,
sourceObjects: h
}, _ = u.createNode(e, f, g);
return s && r.isCollection(_) && (_.flow = !0), m(), _;
}
createPair(e, t, n = {}) {
let r = this.createNode(e, null, n), a = this.createNode(t, null, n);
return new i.Pair(r, a);
}
delete(e) {
return p(this.contents) ? this.contents.delete(e) : !1;
}
deleteIn(e) {
return n.isEmptyPath(e) ? this.contents != null && (this.contents = null, !0) : p(this.contents) ? this.contents.deleteIn(e) : !1;
}
get(e, t) {
return r.isCollection(this.contents) ? this.contents.get(e, t) : void 0;
}
getIn(e, t) {
return n.isEmptyPath(e) ? !t && r.isScalar(this.contents) ? this.contents.value : this.contents : r.isCollection(this.contents) ? this.contents.getIn(e, t) : void 0;
}
has(e) {
return r.isCollection(this.contents) ? this.contents.has(e) : !1;
}
hasIn(e) {
return n.isEmptyPath(e) ? this.contents !== void 0 : r.isCollection(this.contents) ? this.contents.hasIn(e) : !1;
}
set(e, t) {
this.contents == null ? this.contents = n.collectionFromPath(this.schema, [e], t) : p(this.contents) && this.contents.set(e, t);
}
setIn(e, t) {
n.isEmptyPath(e) ? this.contents = t : this.contents == null ? this.contents = n.collectionFromPath(this.schema, Array.from(e), t) : p(this.contents) && this.contents.setIn(e, t);
}
setSchema(e, t = {}) {
typeof e == "number" && (e = String(e));
let n;
switch (e) {
case "1.1":
this.directives ? this.directives.yaml.version = "1.1" : this.directives = new d.Directives({ version: "1.1" }), n = {
resolveKnownTags: !1,
schema: "yaml-1.1"
};
break;
case "1.2":
case "next":
this.directives ? this.directives.yaml.version = e : this.directives = new d.Directives({ version: e }), n = {
resolveKnownTags: !0,
schema: "core"
};
break;
case null:
this.directives && delete this.directives, n = null;
break;
default: {
let t = JSON.stringify(e);
throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`);
}
}
if (t.schema instanceof Object) this.schema = t.schema;
else if (n) this.schema = new o.Schema(Object.assign(n, t));
else throw Error("With a null YAML version, the { schema: Schema } option is required");
}
toJS({ json: e, jsonArg: t, mapAsMap: n, maxAliasCount: r, onAnchor: i, reviver: o } = {}) {
let s = {
anchors: /* @__PURE__ */ new Map(),
doc: this,
keep: !e,
mapAsMap: n === !0,
mapKeyWarned: !1,
maxAliasCount: typeof r == "number" ? r : 100
}, c = a.toJS(this.contents, t ?? "", s);
if (typeof i == "function") for (let { count: e, res: t } of s.anchors.values()) i(t, e);
return typeof o == "function" ? l.applyReviver(o, { "": c }, "", c) : c;
}
toJSON(e, t) {
return this.toJS({
json: !0,
jsonArg: e,
mapAsMap: !1,
onAnchor: t
});
}
toString(e = {}) {
if (this.errors.length > 0) throw Error("Document with errors cannot be stringified");
if ("indent" in e && (!Number.isInteger(e.indent) || Number(e.indent) <= 0)) {
let t = JSON.stringify(e.indent);
throw Error(`"indent" option must be a positive integer, not ${t}`);
}
return s.stringifyDocument(this, e);
}
};
function p(e) {
if (r.isCollection(e)) return !0;
throw Error("Expected a YAML collection as document contents");
}
e.Document = f;
})), qs = /* @__PURE__ */ i(((e) => {
var t = class extends Error {
constructor(e, t, n, r) {
super(), this.name = e, this.code = n, this.message = r, this.pos = t;
}
}, n = class extends t {
constructor(e, t, n) {
super("YAMLParseError", e, t, n);
}
}, r = class extends t {
constructor(e, t, n) {
super("YAMLWarning", e, t, n);
}
};
e.YAMLError = t, e.YAMLParseError = n, e.YAMLWarning = r, e.prettifyError = (e, t) => (n) => {
if (n.pos[0] === -1) return;
n.linePos = n.pos.map((e) => t.linePos(e));
let { line: r, col: i } = n.linePos[0];
n.message += ` at line ${r}, column ${i}`;
let a = i - 1, o = e.substring(t.lineStarts[r - 1], t.lineStarts[r]).replace(/[\n\r]+$/, "");
if (a >= 60 && o.length > 80) {
let e = Math.min(a - 39, o.length - 79);
o = "…" + o.substring(e), a -= e - 1;
}
if (o.length > 80 && (o = o.substring(0, 79) + "…"), r > 1 && /^ *$/.test(o.substring(0, a))) {
let n = e.substring(t.lineStarts[r - 2], t.lineStarts[r - 1]);
n.length > 80 && (n = n.substring(0, 79) + "…\n"), o = n + o;
}
if (/[^ ]/.test(o)) {
let e = 1, t = n.linePos[1];
t?.line === r && t.col > i && (e = Math.max(1, Math.min(t.col - i, 80 - a)));
let s = " ".repeat(a) + "^".repeat(e);
n.message += `:\n\n${o}\n${s}\n`;
}
};
})), Js = /* @__PURE__ */ i(((e) => {
function t(e, { flow: t, indicator: n, next: r, offset: i, onError: a, parentIndent: o, startOnNewline: s }) {
let c = !1, l = s, u = s, d = "", f = "", p = !1, m = !1, h = null, g = null, _ = null, v = null, y = null, b = null, x = null;
for (let i of e) switch (m &&= (i.type !== "space" && i.type !== "newline" && i.type !== "comma" && a(i.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), !1), h &&= (l && i.type !== "comment" && i.type !== "newline" && a(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), null), i.type) {
case "space":
!t && (n !== "doc-start" || r?.type !== "flow-collection") && i.source.includes(" ") && (h = i), u = !0;
break;
case "comment": {
u || a(i, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
let e = i.source.substring(1) || " ";
d ? d += f + e : d = e, f = "", l = !1;
break;
}
case "newline":
l ? d ? d += i.source : (!b || n !== "seq-item-ind") && (c = !0) : f += i.source, l = !0, p = !0, (g || _) && (v = i), u = !0;
break;
case "anchor":
g && a(i, "MULTIPLE_ANCHORS", "A node can have at most one anchor"), i.source.endsWith(":") && a(i.offset + i.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", !0), g = i, x ??= i.offset, l = !1, u = !1, m = !0;
break;
case "tag":
_ && a(i, "MULTIPLE_TAGS", "A node can have at most one tag"), _ = i, x ??= i.offset, l = !1, u = !1, m = !0;
break;
case n:
(g || _) && a(i, "BAD_PROP_ORDER", `Anchors and tags must be after the ${i.source} indicator`), b && a(i, "UNEXPECTED_TOKEN", `Unexpected ${i.source} in ${t ?? "collection"}`), b = i, l = n === "seq-item-ind" || n === "explicit-key-ind", u = !1;
break;
case "comma": if (t) {
y && a(i, "UNEXPECTED_TOKEN", `Unexpected , in ${t}`), y = i, l = !1, u = !1;
break;
}
default: a(i, "UNEXPECTED_TOKEN", `Unexpected ${i.type} token`), l = !1, u = !1;
}
let S = e[e.length - 1], C = S ? S.offset + S.source.length : i;
return m && r && r.type !== "space" && r.type !== "newline" && r.type !== "comma" && (r.type !== "scalar" || r.source !== "") && a(r.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), h && (l && h.indent <= o || r?.type === "block-map" || r?.type === "block-seq") && a(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), {
comma: y,
found: b,
spaceBefore: c,
comment: d,
hasNewline: p,
anchor: g,
tag: _,
newlineAfterProp: v,
end: C,
start: x ?? C
};
}
e.resolveProps = t;
})), Ys = /* @__PURE__ */ i(((e) => {
function t(e) {
if (!e) return null;
switch (e.type) {
case "alias":
case "scalar":
case "double-quoted-scalar":
case "single-quoted-scalar":
if (e.source.includes("\n")) return !0;
if (e.end) {
for (let t of e.end) if (t.type === "newline") return !0;
}
return !1;
case "flow-collection":
for (let n of e.items) {
for (let e of n.start) if (e.type === "newline") return !0;
if (n.sep) {
for (let e of n.sep) if (e.type === "newline") return !0;
}
if (t(n.key) || t(n.value)) return !0;
}
return !1;
default: return !0;
}
}
e.containsNewline = t;
})), Xs = /* @__PURE__ */ i(((e) => {
var t = Ys();
function n(e, n, r) {
if (n?.type === "flow-collection") {
let i = n.end[0];
i.indent === e && (i.source === "]" || i.source === "}") && t.containsNewline(n) && r(i, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
}
}
e.flowIndentCheck = n;
})), Zs = /* @__PURE__ */ i(((e) => {
var t = Q();
function n(e, n, r) {
let { uniqueKeys: i } = e.options;
if (i === !1) return !1;
let a = typeof i == "function" ? i : (e, n) => e === n || t.isScalar(e) && t.isScalar(n) && e.value === n.value;
return n.some((e) => a(e.key, r));
}
e.mapIncludes = n;
})), Qs = /* @__PURE__ */ i(((e) => {
var t = bs(), n = Ss(), r = Js(), i = Ys(), a = Xs(), o = Zs(), s = "All mapping items must start at the same column";
function c({ composeNode: e, composeEmptyNode: c }, l, u, d, f) {
let p = new ((f?.nodeClass) ?? n.YAMLMap)(l.schema);
l.atRoot &&= !1;
let m = u.offset, h = null;
for (let n of u.items) {
let { start: f, key: g, sep: _, value: v } = n, y = r.resolveProps(f, {
indicator: "explicit-key-ind",
next: g ?? _?.[0],
offset: m,
onError: d,
parentIndent: u.indent,
startOnNewline: !0
}), b = !y.found;
if (b) {
if (g && (g.type === "block-seq" ? d(m, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in g && g.indent !== u.indent && d(m, "BAD_INDENT", s)), !y.anchor && !y.tag && !_) {
h = y.end, y.comment && (p.comment ? p.comment += "\n" + y.comment : p.comment = y.comment);
continue;
}
(y.newlineAfterProp || i.containsNewline(g)) && d(g ?? f[f.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
} else y.found?.indent !== u.indent && d(m, "BAD_INDENT", s);
l.atKey = !0;
let x = y.end, S = g ? e(l, g, y, d) : c(l, x, f, null, y, d);
l.schema.compat && a.flowIndentCheck(u.indent, g, d), l.atKey = !1, o.mapIncludes(l, p.items, S) && d(x, "DUPLICATE_KEY", "Map keys must be unique");
let C = r.resolveProps(_ ?? [], {
indicator: "map-value-ind",
next: v,
offset: S.range[2],
onError: d,
parentIndent: u.indent,
startOnNewline: !g || g.type === "block-scalar"
});
if (m = C.end, C.found) {
b && (v?.type === "block-map" && !C.hasNewline && d(m, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), l.options.strict && y.start < C.found.offset - 1024 && d(S.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
let r = v ? e(l, v, C, d) : c(l, m, _, null, C, d);
l.schema.compat && a.flowIndentCheck(u.indent, v, d), m = r.range[2];
let i = new t.Pair(S, r);
l.options.keepSourceTokens && (i.srcToken = n), p.items.push(i);
} else {
b && d(S.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"), C.comment && (S.comment ? S.comment += "\n" + C.comment : S.comment = C.comment);
let e = new t.Pair(S);
l.options.keepSourceTokens && (e.srcToken = n), p.items.push(e);
}
}
return h && h < m && d(h, "IMPOSSIBLE", "Map comment with trailing content"), p.range = [
u.offset,
m,
h ?? m
], p;
}
e.resolveBlockMap = c;
})), $s = /* @__PURE__ */ i(((e) => {
var t = ws(), n = Js(), r = Xs();
function i({ composeNode: e, composeEmptyNode: i }, a, o, s, c) {
let l = new ((c?.nodeClass) ?? t.YAMLSeq)(a.schema);
a.atRoot &&= !1, a.atKey &&= !1;
let u = o.offset, d = null;
for (let { start: t, value: c } of o.items) {
let f = n.resolveProps(t, {
indicator: "seq-item-ind",
next: c,
offset: u,
onError: s,
parentIndent: o.indent,
startOnNewline: !0
});
if (!f.found) {
if (f.anchor || f.tag || c) c?.type === "block-seq" ? s(f.end, "BAD_INDENT", "All sequence items must start at the same column") : s(u, "MISSING_CHAR", "Sequence item without - indicator");
else {
d = f.end, f.comment && (l.comment = f.comment);
continue;
}
}
let p = c ? e(a, c, f, s) : i(a, f.end, t, null, f, s);
a.schema.compat && r.flowIndentCheck(o.indent, c, s), u = p.range[2], l.items.push(p);
}
return l.range = [
o.offset,
u,
d ?? u
], l;
}
e.resolveBlockSeq = i;
})), ec = /* @__PURE__ */ i(((e) => {
function t(e, t, n, r) {
let i = "";
if (e) {
let a = !1, o = "";
for (let s of e) {
let { source: e, type: c } = s;
switch (c) {
case "space":
a = !0;
break;
case "comment": {
n && !a && r(s, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
let t = e.substring(1) || " ";
i ? i += o + t : i = t, o = "";
break;
}
case "newline":
i && (o += e), a = !0;
break;
default: r(s, "UNEXPECTED_TOKEN", `Unexpected ${c} at node end`);
}
t += e.length;
}
}
return {
comment: i,
offset: t
};
}
e.resolveEnd = t;
})), tc = /* @__PURE__ */ i(((e) => {
var t = Q(), n = bs(), r = Ss(), i = ws(), a = ec(), o = Js(), s = Ys(), c = Zs(), l = "Block collections are not allowed within flow collections", u = (e) => e && (e.type === "block-map" || e.type === "block-seq");
function d({ composeNode: e, composeEmptyNode: d }, f, p, m, h) {
let g = p.start.source === "{", _ = g ? "flow map" : "flow sequence", v = new ((h?.nodeClass) ?? (g ? r.YAMLMap : i.YAMLSeq))(f.schema);
v.flow = !0;
let y = f.atRoot;
y && (f.atRoot = !1), f.atKey &&= !1;
let b = p.offset + p.start.source.length;
for (let i = 0; i < p.items.length; ++i) {
let a = p.items[i], { start: h, key: y, sep: x, value: S } = a, C = o.resolveProps(h, {
flow: _,
indicator: "explicit-key-ind",
next: y ?? x?.[0],
offset: b,
onError: m,
parentIndent: p.indent,
startOnNewline: !1
});
if (!C.found) {
if (!C.anchor && !C.tag && !x && !S) {
i === 0 && C.comma ? m(C.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${_}`) : i < p.items.length - 1 && m(C.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${_}`), C.comment && (v.comment ? v.comment += "\n" + C.comment : v.comment = C.comment), b = C.end;
continue;
}
!g && f.options.strict && s.containsNewline(y) && m(y, "MULTILINE_IMPLICIT_KEY", "Implicit keys of flow sequence pairs need to be on a single line");
}
if (i === 0) C.comma && m(C.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${_}`);
else if (C.comma || m(C.start, "MISSING_CHAR", `Missing , between ${_} items`), C.comment) {
let e = "";
loop: for (let t of h) switch (t.type) {
case "comma":
case "space": break;
case "comment":
e = t.source.substring(1);
break loop;
default: break loop;
}
if (e) {
let n = v.items[v.items.length - 1];
t.isPair(n) && (n = n.value ?? n.key), n.comment ? n.comment += "\n" + e : n.comment = e, C.comment = C.comment.substring(e.length + 1);
}
}
if (!g && !x && !C.found) {
let t = S ? e(f, S, C, m) : d(f, C.end, x, null, C, m);
v.items.push(t), b = t.range[2], u(S) && m(t.range, "BLOCK_IN_FLOW", l);
} else {
f.atKey = !0;
let t = C.end, i = y ? e(f, y, C, m) : d(f, t, h, null, C, m);
u(y) && m(i.range, "BLOCK_IN_FLOW", l), f.atKey = !1;
let s = o.resolveProps(x ?? [], {
flow: _,
indicator: "map-value-ind",
next: S,
offset: i.range[2],
onError: m,
parentIndent: p.indent,
startOnNewline: !1
});
if (s.found) {
if (!g && !C.found && f.options.strict) {
if (x) for (let e of x) {
if (e === s.found) break;
if (e.type === "newline") {
m(e, "MULTILINE_IMPLICIT_KEY", "Implicit keys of flow sequence pairs need to be on a single line");
break;
}
}
C.start < s.found.offset - 1024 && m(s.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
}
} else S && ("source" in S && S.source?.[0] === ":" ? m(S, "MISSING_CHAR", `Missing space after : in ${_}`) : m(s.start, "MISSING_CHAR", `Missing , or : between ${_} items`));
let w = S ? e(f, S, s, m) : s.found ? d(f, s.end, x, null, s, m) : null;
w ? u(S) && m(w.range, "BLOCK_IN_FLOW", l) : s.comment && (i.comment ? i.comment += "\n" + s.comment : i.comment = s.comment);
let T = new n.Pair(i, w);
if (f.options.keepSourceTokens && (T.srcToken = a), g) {
let e = v;
c.mapIncludes(f, e.items, i) && m(t, "DUPLICATE_KEY", "Map keys must be unique"), e.items.push(T);
} else {
let e = new r.YAMLMap(f.schema);
e.flow = !0, e.items.push(T);
let t = (w ?? i).range;
e.range = [
i.range[0],
t[1],
t[2]
], v.items.push(e);
}
b = w ? w.range[2] : s.end;
}
}
let x = g ? "}" : "]", [S, ...C] = p.end, w = b;
if (S?.source === x) w = S.offset + S.source.length;
else {
let e = _[0].toUpperCase() + _.substring(1), t = y ? `${e} must end with a ${x}` : `${e} in block collection must be sufficiently indented and end with a ${x}`;
m(b, y ? "MISSING_CHAR" : "BAD_INDENT", t), S && S.source.length !== 1 && C.unshift(S);
}
if (C.length > 0) {
let e = a.resolveEnd(C, w, f.options.strict, m);
e.comment && (v.comment ? v.comment += "\n" + e.comment : v.comment = e.comment), v.range = [
p.offset,
w,
e.offset
];
} else v.range = [
p.offset,
w,
w
];
return v;
}
e.resolveFlowCollection = d;
})), nc = /* @__PURE__ */ i(((e) => {
var t = Q(), n = ls(), r = Ss(), i = ws(), a = Qs(), o = $s(), s = tc();
function c(e, t, n, r, i, c) {
let l = n.type === "block-map" ? a.resolveBlockMap(e, t, n, r, c) : n.type === "block-seq" ? o.resolveBlockSeq(e, t, n, r, c) : s.resolveFlowCollection(e, t, n, r, c), u = l.constructor;
return i === "!" || i === u.tagName ? (l.tag = u.tagName, l) : (i && (l.tag = i), l);
}
function l(e, a, o, s, l) {
let u = s.tag, d = u ? a.directives.tagName(u.source, (e) => l(u, "TAG_RESOLVE_FAILED", e)) : null;
if (o.type === "block-seq") {
let { anchor: e, newlineAfterProp: t } = s, n = e && u ? e.offset > u.offset ? e : u : e ?? u;
n && (!t || t.offset < n.offset) && l(n, "MISSING_CHAR", "Missing newline after block sequence props");
}
let f = o.type === "block-map" ? "map" : o.type === "block-seq" ? "seq" : o.start.source === "{" ? "map" : "seq";
if (!u || !d || d === "!" || d === r.YAMLMap.tagName && f === "map" || d === i.YAMLSeq.tagName && f === "seq") return c(e, a, o, l, d);
let p = a.schema.tags.find((e) => e.tag === d && e.collection === f);
if (!p) {
let t = a.schema.knownTags[d];
if (t?.collection === f) a.schema.tags.push(Object.assign({}, t, { default: !1 })), p = t;
else return t ? l(u, "BAD_COLLECTION_TYPE", `${t.tag} used for ${f} collection, but expects ${t.collection ?? "scalar"}`, !0) : l(u, "TAG_RESOLVE_FAILED", `Unresolved tag: ${d}`, !0), c(e, a, o, l, d);
}
let m = c(e, a, o, l, d, p), h = p.resolve?.(m, (e) => l(u, "TAG_RESOLVE_FAILED", e), a.options) ?? m, g = t.isNode(h) ? h : new n.Scalar(h);
return g.range = m.range, g.tag = d, p?.format && (g.format = p.format), g;
}
e.composeCollection = l;
})), rc = /* @__PURE__ */ i(((e) => {
var t = ls();
function n(e, n, a) {
let o = n.offset, s = r(n, e.options.strict, a);
if (!s) return {
value: "",
type: null,
comment: "",
range: [
o,
o,
o
]
};
let c = s.mode === ">" ? t.Scalar.BLOCK_FOLDED : t.Scalar.BLOCK_LITERAL, l = n.source ? i(n.source) : [], u = l.length;
for (let e = l.length - 1; e >= 0; --e) {
let t = l[e][1];
if (t === "" || t === "\r") u = e;
else break;
}
if (u === 0) {
let e = s.chomp === "+" && l.length > 0 ? "\n".repeat(Math.max(1, l.length - 1)) : "", t = o + s.length;
return n.source && (t += n.source.length), {
value: e,
type: c,
comment: s.comment,
range: [
o,
t,
t
]
};
}
let d = n.indent + s.indent, f = n.offset + s.length, p = 0;
for (let t = 0; t < u; ++t) {
let [n, r] = l[t];
if (r === "" || r === "\r") s.indent === 0 && n.length > d && (d = n.length);
else {
n.length < d && a(f + n.length, "MISSING_CHAR", "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"), s.indent === 0 && (d = n.length), p = t, d === 0 && !e.atRoot && a(f, "BAD_INDENT", "Block scalar values in collections must be indented");
break;
}
f += n.length + r.length + 1;
}
for (let e = l.length - 1; e >= u; --e) l[e][0].length > d && (u = e + 1);
let m = "", h = "", g = !1;
for (let e = 0; e < p; ++e) m += l[e][0].slice(d) + "\n";
for (let e = p; e < u; ++e) {
let [n, r] = l[e];
f += n.length + r.length + 1;
let i = r[r.length - 1] === "\r";
/* istanbul ignore if already caught in lexer */
if (i && (r = r.slice(0, -1)), r && n.length < d) {
let e = `Block scalar lines must not be less indented than their ${s.indent ? "explicit indentation indicator" : "first line"}`;
a(f - r.length - (i ? 2 : 1), "BAD_INDENT", e), n = "";
}
c === t.Scalar.BLOCK_LITERAL ? (m += h + n.slice(d) + r, h = "\n") : n.length > d || r[0] === " " ? (h === " " ? h = "\n" : !g && h === "\n" && (h = "\n\n"), m += h + n.slice(d) + r, h = "\n", g = !0) : r === "" ? h === "\n" ? m += "\n" : h = "\n" : (m += h + r, h = " ", g = !1);
}
switch (s.chomp) {
case "-": break;
case "+":
for (let e = u; e < l.length; ++e) m += "\n" + l[e][0].slice(d);
m[m.length - 1] !== "\n" && (m += "\n");
break;
default: m += "\n";
}
let _ = o + s.length + n.source.length;
return {
value: m,
type: c,
comment: s.comment,
range: [
o,
_,
_
]
};
}
function r({ offset: e, props: t }, n, r) {
/* istanbul ignore if should not happen */
if (t[0].type !== "block-scalar-header") return r(t[0], "IMPOSSIBLE", "Block scalar header not found"), null;
let { source: i } = t[0], a = i[0], o = 0, s = "", c = -1;
for (let t = 1; t < i.length; ++t) {
let n = i[t];
if (!s && (n === "-" || n === "+")) s = n;
else {
let r = Number(n);
!o && r ? o = r : c === -1 && (c = e + t);
}
}
c !== -1 && r(c, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${i}`);
let l = !1, u = "", d = i.length;
for (let e = 1; e < t.length; ++e) {
let i = t[e];
switch (i.type) {
case "space": l = !0;
case "newline":
d += i.source.length;
break;
case "comment":
n && !l && r(i, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters"), d += i.source.length, u = i.source.substring(1);
break;
case "error":
r(i, "UNEXPECTED_TOKEN", i.message), d += i.source.length;
break;
/* istanbul ignore next should not happen */
default: {
r(i, "UNEXPECTED_TOKEN", `Unexpected token in block scalar header: ${i.type}`);
let e = i.source;
e && typeof e == "string" && (d += e.length);
}
}
}
return {
mode: a,
indent: o,
chomp: s,
comment: u,
length: d
};
}
function i(e) {
let t = e.split(/\n( *)/), n = t[0], r = n.match(/^( *)/), i = [r?.[1] ? [r[1], n.slice(r[1].length)] : ["", n]];
for (let e = 1; e < t.length; e += 2) i.push([t[e], t[e + 1]]);
return i;
}
e.resolveBlockScalar = n;
})), ic = /* @__PURE__ */ i(((e) => {
var t = ls(), n = ec();
function r(e, r, o) {
let { offset: c, type: l, source: u, end: d } = e, f, p, m = (e, t, n) => o(c + e, t, n);
switch (l) {
case "scalar":
f = t.Scalar.PLAIN, p = i(u, m);
break;
case "single-quoted-scalar":
f = t.Scalar.QUOTE_SINGLE, p = a(u, m);
break;
case "double-quoted-scalar":
f = t.Scalar.QUOTE_DOUBLE, p = s(u, m);
break;
/* istanbul ignore next should not happen */
default: return o(e, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${l}`), {
value: "",
type: null,
comment: "",
range: [
c,
c + u.length,
c + u.length
]
};
}
let h = c + u.length, g = n.resolveEnd(d, h, r, o);
return {
value: p,
type: f,
comment: g.comment,
range: [
c,
h,
g.offset
]
};
}
function i(e, t) {
let n = "";
switch (e[0]) {
/* istanbul ignore next should not happen */
case " ":
n = "a tab character";
break;
case ",":
n = "flow indicator character ,";
break;
case "%":
n = "directive indicator character %";
break;
case "|":
case ">":
n = `block scalar indicator ${e[0]}`;
break;
case "@":
case "`": n = `reserved character ${e[0]}`;
}
return n && t(0, "BAD_SCALAR_START", `Plain value cannot start with ${n}`), o(e);
}
function a(e, t) {
return (e[e.length - 1] !== "'" || e.length === 1) && t(e.length, "MISSING_CHAR", "Missing closing 'quote"), o(e.slice(1, -1)).replace(/''/g, "'");
}
function o(e) {
let t, n;
try {
t = /* @__PURE__ */ RegExp("(.*?)(?<![ ])[ ]*\r?\n", "sy"), n = /* @__PURE__ */ RegExp("[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?\n", "sy");
} catch {
t = /(.*?)[ \t]*\r?\n/sy, n = /[ \t]*(.*?)[ \t]*\r?\n/sy;
}
let r = t.exec(e);
if (!r) return e;
let i = r[1], a = " ", o = t.lastIndex;
for (n.lastIndex = o; r = n.exec(e);) r[1] === "" ? a === "\n" ? i += a : a = "\n" : (i += a + r[1], a = " "), o = n.lastIndex;
let s = /[ \t]*(.*)/sy;
return s.lastIndex = o, r = s.exec(e), i + a + (r?.[1] ?? "");
}
function s(e, t) {
let n = "";
for (let r = 1; r < e.length - 1; ++r) {
let i = e[r];
if (i !== "\r" || e[r + 1] !== "\n") {
if (i === "\n") {
let { fold: t, offset: i } = c(e, r);
n += t, r = i;
} else if (i === "\\") {
let i = e[++r], a = l[i];
if (a) n += a;
else if (i === "\n") for (i = e[r + 1]; i === " " || i === " ";) i = e[++r + 1];
else if (i === "\r" && e[r + 1] === "\n") for (i = e[++r + 1]; i === " " || i === " ";) i = e[++r + 1];
else if (i === "x" || i === "u" || i === "U") {
let a = i === "x" ? 2 : i === "u" ? 4 : 8;
n += u(e, r + 1, a, t), r += a;
} else {
let i = e.substr(r - 1, 2);
t(r - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${i}`), n += i;
}
} else if (i === " " || i === " ") {
let t = r, a = e[r + 1];
for (; a === " " || a === " ";) a = e[++r + 1];
a !== "\n" && (a !== "\r" || e[r + 2] !== "\n") && (n += r > t ? e.slice(t, r + 1) : i);
} else n += i;
}
}
return (e[e.length - 1] !== "\"" || e.length === 1) && t(e.length, "MISSING_CHAR", "Missing closing \"quote"), n;
}
function c(e, t) {
let n = "", r = e[t + 1];
for (; (r === " " || r === " " || r === "\n" || r === "\r") && (r !== "\r" || e[t + 2] === "\n");) r === "\n" && (n += "\n"), t += 1, r = e[t + 1];
return n ||= " ", {
fold: n,
offset: t
};
}
var l = {
0: "\0",
a: "\x07",
b: "\b",
e: "\x1B",
f: "\f",
n: "\n",
r: "\r",
t: " ",
v: "\v",
N: "
",
_: "\xA0",
L: "\u2028",
P: "\u2029",
" ": " ",
"\"": "\"",
"/": "/",
"\\": "\\",
" ": " "
};
function u(e, t, n, r) {
let i = e.substr(t, n), a = i.length === n && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
try {
return String.fromCodePoint(a);
} catch {
let i = e.substr(t - 2, n + 2);
return r(t - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${i}`), i;
}
}
e.resolveFlowScalar = r;
})), ac = /* @__PURE__ */ i(((e) => {
var t = Q(), n = ls(), r = rc(), i = ic();
function a(e, a, c, l) {
let { value: u, type: d, comment: f, range: p } = a.type === "block-scalar" ? r.resolveBlockScalar(e, a, l) : i.resolveFlowScalar(a, e.options.strict, l), m = c ? e.directives.tagName(c.source, (e) => l(c, "TAG_RESOLVE_FAILED", e)) : null, h;
h = e.options.stringKeys && e.atKey ? e.schema[t.SCALAR] : m ? o(e.schema, u, m, c, l) : a.type === "scalar" ? s(e, u, a, l) : e.schema[t.SCALAR];
let g;
try {
let r = h.resolve(u, (e) => l(c ?? a, "TAG_RESOLVE_FAILED", e), e.options);
g = t.isScalar(r) ? r : new n.Scalar(r);
} catch (e) {
let t = e instanceof Error ? e.message : String(e);
l(c ?? a, "TAG_RESOLVE_FAILED", t), g = new n.Scalar(u);
}
return g.range = p, g.source = u, d && (g.type = d), m && (g.tag = m), h.format && (g.format = h.format), f && (g.comment = f), g;
}
function o(e, n, r, i, a) {
if (r === "!") return e[t.SCALAR];
let o = [];
for (let t of e.tags) if (!t.collection && t.tag === r) {
if (t.default && t.test) o.push(t);
else return t;
}
for (let e of o) if (e.test?.test(n)) return e;
let s = e.knownTags[r];
return s && !s.collection ? (e.tags.push(Object.assign({}, s, {
default: !1,
test: void 0
})), s) : (a(i, "TAG_RESOLVE_FAILED", `Unresolved tag: ${r}`, r !== "tag:yaml.org,2002:str"), e[t.SCALAR]);
}
function s({ atKey: e, directives: n, schema: r }, i, a, o) {
let s = r.tags.find((t) => (t.default === !0 || e && t.default === "key") && t.test?.test(i)) || r[t.SCALAR];
if (r.compat) {
let e = r.compat.find((e) => e.default && e.test?.test(i)) ?? r[t.SCALAR];
s.tag !== e.tag && o(a, "TAG_RESOLVE_FAILED", `Value may be parsed as either ${n.tagString(s.tag)} or ${n.tagString(e.tag)}`, !0);
}
return s;
}
e.composeScalar = a;
})), oc = /* @__PURE__ */ i(((e) => {
function t(e, t, n) {
if (t) {
n ??= t.length;
for (let r = n - 1; r >= 0; --r) {
let n = t[r];
switch (n.type) {
case "space":
case "comment":
case "newline":
e -= n.source.length;
continue;
}
for (n = t[++r]; n?.type === "space";) e += n.source.length, n = t[++r];
break;
}
}
return e;
}
e.emptyScalarPosition = t;
})), sc = /* @__PURE__ */ i(((e) => {
var t = cs(), n = Q(), r = nc(), i = ac(), a = ec(), o = oc(), s = {
composeNode: c,
composeEmptyNode: l
};
function c(e, t, a, o) {
let c = e.atKey, { spaceBefore: d, comment: f, anchor: p, tag: m } = a, h, g = !0;
switch (t.type) {
case "alias":
h = u(e, t, o), (p || m) && o(t, "ALIAS_PROPS", "An alias node must not specify any properties");
break;
case "scalar":
case "single-quoted-scalar":
case "double-quoted-scalar":
case "block-scalar":
h = i.composeScalar(e, t, m, o), p && (h.anchor = p.source.substring(1));
break;
case "block-map":
case "block-seq":
case "flow-collection":
try {
h = r.composeCollection(s, e, t, a, o), p && (h.anchor = p.source.substring(1));
} catch (e) {
o(t, "RESOURCE_EXHAUSTION", e instanceof Error ? e.message : String(e));
}
break;
default: o(t, "UNEXPECTED_TOKEN", t.type === "error" ? t.message : `Unsupported token (type: ${t.type})`), g = !1;
}
return h ??= l(e, t.offset, void 0, null, a, o), p && h.anchor === "" && o(p, "BAD_ALIAS", "Anchor cannot be an empty string"), c && e.options.stringKeys && (!n.isScalar(h) || typeof h.value != "string" || h.tag && h.tag !== "tag:yaml.org,2002:str") && o(m ?? t, "NON_STRING_KEY", "With stringKeys, all keys must be strings"), d && (h.spaceBefore = !0), f && (t.type === "scalar" && t.source === "" ? h.comment = f : h.commentBefore = f), e.options.keepSourceTokens && g && (h.srcToken = t), h;
}
function l(e, t, n, r, { spaceBefore: a, comment: s, anchor: c, tag: l, end: u }, d) {
let f = {
type: "scalar",
offset: o.emptyScalarPosition(t, n, r),
indent: -1,
source: ""
}, p = i.composeScalar(e, f, l, d);
return c && (p.anchor = c.source.substring(1), p.anchor === "" && d(c, "BAD_ALIAS", "Anchor cannot be an empty string")), a && (p.spaceBefore = !0), s && (p.comment = s, p.range[2] = u), p;
}
function u({ options: e }, { offset: n, source: r, end: i }, o) {
let s = new t.Alias(r.substring(1));
s.source === "" && o(n, "BAD_ALIAS", "Alias cannot be an empty string"), s.source.endsWith(":") && o(n + r.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", !0);
let c = n + r.length, l = a.resolveEnd(i, c, e.strict, o);
return s.range = [
n,
c,
l.offset
], l.comment && (s.comment = l.comment), s;
}
e.composeEmptyNode = l, e.composeNode = c;
})), cc = /* @__PURE__ */ i(((e) => {
var t = Ks(), n = sc(), r = ec(), i = Js();
function a(e, a, { offset: o, start: s, value: c, end: l }, u) {
let d = Object.assign({ _directives: a }, e), f = new t.Document(void 0, d), p = {
atKey: !1,
atRoot: !0,
directives: f.directives,
options: f.options,
schema: f.schema
}, m = i.resolveProps(s, {
indicator: "doc-start",
next: c ?? l?.[0],
offset: o,
onError: u,
parentIndent: 0,
startOnNewline: !0
});
m.found && (f.directives.docStart = !0, c && (c.type === "block-map" || c.type === "block-seq") && !m.hasNewline && u(m.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), f.contents = c ? n.composeNode(p, c, m, u) : n.composeEmptyNode(p, m.end, s, null, m, u);
let h = f.contents.range[2], g = r.resolveEnd(l, h, !1, u);
return g.comment && (f.comment = g.comment), f.range = [
o,
h,
g.offset
], f;
}
e.composeDoc = a;
})), lc = /* @__PURE__ */ i(((t) => {
var n = e("process"), r = rs(), i = Ks(), a = qs(), o = Q(), s = cc(), c = ec();
function l(e) {
if (typeof e == "number") return [e, e + 1];
if (Array.isArray(e)) return e.length === 2 ? e : [e[0], e[1]];
let { offset: t, source: n } = e;
return [t, t + (typeof n == "string" ? n.length : 1)];
}
function u(e) {
let t = "", n = !1, r = !1;
for (let i = 0; i < e.length; ++i) {
let a = e[i];
switch (a[0]) {
case "#":
t += (t === "" ? "" : r ? "\n\n" : "\n") + (a.substring(1) || " "), n = !0, r = !1;
break;
case "%":
e[i + 1]?.[0] !== "#" && (i += 1), n = !1;
break;
default: n || (r = !0), n = !1;
}
}
return {
comment: t,
afterEmptyLine: r
};
}
t.Composer = class {
constructor(e = {}) {
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (e, t, n, r) => {
let i = l(e);
r ? this.warnings.push(new a.YAMLWarning(i, t, n)) : this.errors.push(new a.YAMLParseError(i, t, n));
}, this.directives = new r.Directives({ version: e.version || "1.2" }), this.options = e;
}
decorate(e, t) {
let { comment: n, afterEmptyLine: r } = u(this.prelude);
if (n) {
let i = e.contents;
if (t) e.comment = e.comment ? `${e.comment}\n${n}` : n;
else if (r || e.directives.docStart || !i) e.commentBefore = n;
else if (o.isCollection(i) && !i.flow && i.items.length > 0) {
let e = i.items[0];
o.isPair(e) && (e = e.key);
let t = e.commentBefore;
e.commentBefore = t ? `${n}\n${t}` : n;
} else {
let e = i.commentBefore;
i.commentBefore = e ? `${n}\n${e}` : n;
}
}
if (t) {
for (let t = 0; t < this.errors.length; ++t) e.errors.push(this.errors[t]);
for (let t = 0; t < this.warnings.length; ++t) e.warnings.push(this.warnings[t]);
} else e.errors = this.errors, e.warnings = this.warnings;
this.prelude = [], this.errors = [], this.warnings = [];
}
streamInfo() {
return {
comment: u(this.prelude).comment,
directives: this.directives,
errors: this.errors,
warnings: this.warnings
};
}
*compose(e, t = !1, n = -1) {
for (let t of e) yield* this.next(t);
yield* this.end(t, n);
}
*next(e) {
switch (n.env.LOG_STREAM && console.dir(e, { depth: null }), e.type) {
case "directive":
this.directives.add(e.source, (t, n, r) => {
let i = l(e);
i[0] += t, this.onError(i, "BAD_DIRECTIVE", n, r);
}), this.prelude.push(e.source), this.atDirectives = !0;
break;
case "document": {
let t = s.composeDoc(this.options, this.directives, e, this.onError);
this.atDirectives && !t.directives.docStart && this.onError(e, "MISSING_CHAR", "Missing directives-end/doc-start indicator line"), this.decorate(t, !1), this.doc && (yield this.doc), this.doc = t, this.atDirectives = !1;
break;
}
case "byte-order-mark":
case "space": break;
case "comment":
case "newline":
this.prelude.push(e.source);
break;
case "error": {
let t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new a.YAMLParseError(l(e), "UNEXPECTED_TOKEN", t);
this.atDirectives || !this.doc ? this.errors.push(n) : this.doc.errors.push(n);
break;
}
case "doc-end": {
if (!this.doc) {
this.errors.push(new a.YAMLParseError(l(e), "UNEXPECTED_TOKEN", "Unexpected doc-end without preceding document"));
break;
}
this.doc.directives.docEnd = !0;
let t = c.resolveEnd(e.end, e.offset + e.source.length, this.doc.options.strict, this.onError);
if (this.decorate(this.doc, !0), t.comment) {
let e = this.doc.comment;
this.doc.comment = e ? `${e}\n${t.comment}` : t.comment;
}
this.doc.range[2] = t.offset;
break;
}
default: this.errors.push(new a.YAMLParseError(l(e), "UNEXPECTED_TOKEN", `Unsupported token ${e.type}`));
}
}
*end(e = !1, t = -1) {
if (this.doc) this.decorate(this.doc, !0), yield this.doc, this.doc = null;
else if (e) {
let e = Object.assign({ _directives: this.directives }, this.options), n = new i.Document(void 0, e);
this.atDirectives && this.onError(t, "MISSING_CHAR", "Missing directives-end indicator line"), n.range = [
0,
t,
t
], this.decorate(n, !1), yield n;
}
}
};
})), uc = /* @__PURE__ */ i(((e) => {
var t = rc(), n = ic(), r = qs(), i = ms();
function a(e, i = !0, a) {
if (e) {
let o = (e, t, n) => {
let i = typeof e == "number" ? e : Array.isArray(e) ? e[0] : e.offset;
if (a) a(i, t, n);
else throw new r.YAMLParseError([i, i + 1], t, n);
};
switch (e.type) {
case "scalar":
case "single-quoted-scalar":
case "double-quoted-scalar": return n.resolveFlowScalar(e, i, o);
case "block-scalar": return t.resolveBlockScalar({ options: { strict: i } }, e, o);
}
}
return null;
}
function o(e, t) {
let { implicitKey: n = !1, indent: r, inFlow: a = !1, offset: o = -1, type: s = "PLAIN" } = t, c = i.stringifyString({
type: s,
value: e
}, {
implicitKey: n,
indent: r > 0 ? " ".repeat(r) : "",
inFlow: a,
options: {
blockQuote: !0,
lineWidth: -1
}
}), u = t.end ?? [{
type: "newline",
offset: -1,
indent: r,
source: "\n"
}];
switch (c[0]) {
case "|":
case ">": {
let e = c.indexOf("\n"), t = c.substring(0, e), n = c.substring(e + 1) + "\n", i = [{
type: "block-scalar-header",
offset: o,
indent: r,
source: t
}];
return l(i, u) || i.push({
type: "newline",
offset: -1,
indent: r,
source: "\n"
}), {
type: "block-scalar",
offset: o,
indent: r,
props: i,
source: n
};
}
case "\"": return {
type: "double-quoted-scalar",
offset: o,
indent: r,
source: c,
end: u
};
case "'": return {
type: "single-quoted-scalar",
offset: o,
indent: r,
source: c,
end: u
};
default: return {
type: "scalar",
offset: o,
indent: r,
source: c,
end: u
};
}
}
function s(e, t, n = {}) {
let { afterKey: r = !1, implicitKey: a = !1, inFlow: o = !1, type: s } = n, l = "indent" in e ? e.indent : null;
if (r && typeof l == "number" && (l += 2), !s) switch (e.type) {
case "single-quoted-scalar":
s = "QUOTE_SINGLE";
break;
case "double-quoted-scalar":
s = "QUOTE_DOUBLE";
break;
case "block-scalar": {
let t = e.props[0];
if (t.type !== "block-scalar-header") throw Error("Invalid block scalar header");
s = t.source[0] === ">" ? "BLOCK_FOLDED" : "BLOCK_LITERAL";
break;
}
default: s = "PLAIN";
}
let d = i.stringifyString({
type: s,
value: t
}, {
implicitKey: a || l === null,
indent: l !== null && l > 0 ? " ".repeat(l) : "",
inFlow: o,
options: {
blockQuote: !0,
lineWidth: -1
}
});
switch (d[0]) {
case "|":
case ">":
c(e, d);
break;
case "\"":
u(e, d, "double-quoted-scalar");
break;
case "'":
u(e, d, "single-quoted-scalar");
break;
default: u(e, d, "scalar");
}
}
function c(e, t) {
let n = t.indexOf("\n"), r = t.substring(0, n), i = t.substring(n + 1) + "\n";
if (e.type === "block-scalar") {
let t = e.props[0];
if (t.type !== "block-scalar-header") throw Error("Invalid block scalar header");
t.source = r, e.source = i;
} else {
let { offset: t } = e, n = "indent" in e ? e.indent : -1, a = [{
type: "block-scalar-header",
offset: t,
indent: n,
source: r
}];
l(a, "end" in e ? e.end : void 0) || a.push({
type: "newline",
offset: -1,
indent: n,
source: "\n"
});
for (let t of Object.keys(e)) t !== "type" && t !== "offset" && delete e[t];
Object.assign(e, {
type: "block-scalar",
indent: n,
props: a,
source: i
});
}
}
function l(e, t) {
if (t) for (let n of t) switch (n.type) {
case "space":
case "comment":
e.push(n);
break;
case "newline": return e.push(n), !0;
}
return !1;
}
function u(e, t, n) {
switch (e.type) {
case "scalar":
case "double-quoted-scalar":
case "single-quoted-scalar":
e.type = n, e.source = t;
break;
case "block-scalar": {
let r = e.props.slice(1), i = t.length;
e.props[0].type === "block-scalar-header" && (i -= e.props[0].source.length);
for (let e of r) e.offset += i;
delete e.props, Object.assign(e, {
type: n,
source: t,
end: r
});
break;
}
case "block-map":
case "block-seq": {
let r = {
type: "newline",
offset: e.offset + t.length,
indent: e.indent,
source: "\n"
};
delete e.items, Object.assign(e, {
type: n,
source: t,
end: [r]
});
break;
}
default: {
let r = "indent" in e ? e.indent : -1, i = "end" in e && Array.isArray(e.end) ? e.end.filter((e) => e.type === "space" || e.type === "comment" || e.type === "newline") : [];
for (let t of Object.keys(e)) t !== "type" && t !== "offset" && delete e[t];
Object.assign(e, {
type: n,
indent: r,
source: t,
end: i
});
}
}
}
e.createScalarToken = o, e.resolveAsScalar = a, e.setScalarValue = s;
})), dc = /* @__PURE__ */ i(((e) => {
var t = (e) => "type" in e ? n(e) : r(e);
function n(e) {
switch (e.type) {
case "block-scalar": {
let t = "";
for (let r of e.props) t += n(r);
return t + e.source;
}
case "block-map":
case "block-seq": {
let t = "";
for (let n of e.items) t += r(n);
return t;
}
case "flow-collection": {
let t = e.start.source;
for (let n of e.items) t += r(n);
for (let n of e.end) t += n.source;
return t;
}
case "document": {
let t = r(e);
if (e.end) for (let n of e.end) t += n.source;
return t;
}
default: {
let t = e.source;
if ("end" in e && e.end) for (let n of e.end) t += n.source;
return t;
}
}
}
function r({ start: e, key: t, sep: r, value: i }) {
let a = "";
for (let t of e) a += t.source;
if (t && (a += n(t)), r) for (let e of r) a += e.source;
return i && (a += n(i)), a;
}
e.stringify = t;
})), fc = /* @__PURE__ */ i(((e) => {
var t = Symbol("break visit"), n = Symbol("skip children"), r = Symbol("remove item");
function i(e, t) {
"type" in e && e.type === "document" && (e = {
start: e.start,
value: e.value
}), a(Object.freeze([]), e, t);
}
i.BREAK = t, i.SKIP = n, i.REMOVE = r, i.itemAtPath = (e, t) => {
let n = e;
for (let [e, r] of t) {
let t = n?.[e];
if (t && "items" in t) n = t.items[r];
else return;
}
return n;
}, i.parentCollection = (e, t) => {
let n = i.itemAtPath(e, t.slice(0, -1)), r = t[t.length - 1][0], a = n?.[r];
if (a && "items" in a) return a;
throw Error("Parent collection not found");
};
function a(e, n, i) {
let o = i(n, e);
if (typeof o == "symbol") return o;
for (let s of ["key", "value"]) {
let c = n[s];
if (c && "items" in c) {
for (let n = 0; n < c.items.length; ++n) {
let o = a(Object.freeze(e.concat([[s, n]])), c.items[n], i);
if (typeof o == "number") n = o - 1;
else if (o === t) return t;
else o === r && (c.items.splice(n, 1), --n);
}
typeof o == "function" && s === "key" && (o = o(n, e));
}
}
return typeof o == "function" ? o(n, e) : o;
}
e.visit = i;
})), pc = /* @__PURE__ */ i(((e) => {
var t = uc(), n = dc(), r = fc(), i = "", a = "", o = "", s = "", c = (e) => !!e && "items" in e, l = (e) => !!e && (e.type === "scalar" || e.type === "single-quoted-scalar" || e.type === "double-quoted-scalar" || e.type === "block-scalar");
/* istanbul ignore next */
function u(e) {
switch (e) {
case i: return "<BOM>";
case a: return "<DOC>";
case o: return "<FLOW_END>";
case s: return "<SCALAR>";
default: return JSON.stringify(e);
}
}
function d(e) {
switch (e) {
case i: return "byte-order-mark";
case a: return "doc-mode";
case o: return "flow-error-end";
case s: return "scalar";
case "---": return "doc-start";
case "...": return "doc-end";
case "":
case "\n":
case "\r\n": return "newline";
case "-": return "seq-item-ind";
case "?": return "explicit-key-ind";
case ":": return "map-value-ind";
case "{": return "flow-map-start";
case "}": return "flow-map-end";
case "[": return "flow-seq-start";
case "]": return "flow-seq-end";
case ",": return "comma";
}
switch (e[0]) {
case " ":
case " ": return "space";
case "#": return "comment";
case "%": return "directive-line";
case "*": return "alias";
case "&": return "anchor";
case "!": return "tag";
case "'": return "single-quoted-scalar";
case "\"": return "double-quoted-scalar";
case "|":
case ">": return "block-scalar-header";
}
return null;
}
e.createScalarToken = t.createScalarToken, e.resolveAsScalar = t.resolveAsScalar, e.setScalarValue = t.setScalarValue, e.stringify = n.stringify, e.visit = r.visit, e.BOM = i, e.DOCUMENT = a, e.FLOW_END = o, e.SCALAR = s, e.isCollection = c, e.isScalar = l, e.prettyToken = u, e.tokenType = d;
})), mc = /* @__PURE__ */ i(((e) => {
var t = pc();
function n(e) {
switch (e) {
case void 0:
case " ":
case "\n":
case "\r":
case " ": return !0;
default: return !1;
}
}
var r = /* @__PURE__ */ new Set("0123456789ABCDEFabcdef"), i = /* @__PURE__ */ new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), a = /* @__PURE__ */ new Set(",[]{}"), o = /* @__PURE__ */ new Set(" ,[]{}\n\r "), s = (e) => !e || o.has(e);
e.Lexer = class {
constructor() {
this.atEnd = !1, this.blockScalarIndent = -1, this.blockScalarKeep = !1, this.buffer = "", this.flowKey = !1, this.flowLevel = 0, this.indentNext = 0, this.indentValue = 0, this.lineEndPos = null, this.next = null, this.pos = 0;
}
*lex(e, t = !1) {
if (e) {
if (typeof e != "string") throw TypeError("source is not a string");
this.buffer = this.buffer ? this.buffer + e : e, this.lineEndPos = null;
}
this.atEnd = !t;
let n = this.next ?? "stream";
for (; n && (t || this.hasChars(1));) n = yield* this.parseNext(n);
}
atLineEnd() {
let e = this.pos, t = this.buffer[e];
for (; t === " " || t === " ";) t = this.buffer[++e];
return !t || t === "#" || t === "\n" || t === "\r" && this.buffer[e + 1] === "\n";
}
charAt(e) {
return this.buffer[this.pos + e];
}
continueScalar(e) {
let t = this.buffer[e];
if (this.indentNext > 0) {
let n = 0;
for (; t === " ";) t = this.buffer[++n + e];
if (t === "\r") {
let t = this.buffer[n + e + 1];
if (t === "\n" || !t && !this.atEnd) return e + n + 1;
}
return t === "\n" || n >= this.indentNext || !t && !this.atEnd ? e + n : -1;
}
if (t === "-" || t === ".") {
let t = this.buffer.substr(e, 3);
if ((t === "---" || t === "...") && n(this.buffer[e + 3])) return -1;
}
return e;
}
getLine() {
let e = this.lineEndPos;
return (typeof e != "number" || e !== -1 && e < this.pos) && (e = this.buffer.indexOf("\n", this.pos), this.lineEndPos = e), e === -1 ? this.atEnd ? this.buffer.substring(this.pos) : null : (this.buffer[e - 1] === "\r" && --e, this.buffer.substring(this.pos, e));
}
hasChars(e) {
return this.pos + e <= this.buffer.length;
}
setNext(e) {
return this.buffer = this.buffer.substring(this.pos), this.pos = 0, this.lineEndPos = null, this.next = e, null;
}
peek(e) {
return this.buffer.substr(this.pos, e);
}
*parseNext(e) {
switch (e) {
case "stream": return yield* this.parseStream();
case "line-start": return yield* this.parseLineStart();
case "block-start": return yield* this.parseBlockStart();
case "doc": return yield* this.parseDocument();
case "flow": return yield* this.parseFlowCollection();
case "quoted-scalar": return yield* this.parseQuotedScalar();
case "block-scalar": return yield* this.parseBlockScalar();
case "plain-scalar": return yield* this.parsePlainScalar();
}
}
*parseStream() {
let e = this.getLine();
if (e === null) return this.setNext("stream");
if (e[0] === t.BOM && (yield* this.pushCount(1), e = e.substring(1)), e[0] === "%") {
let t = e.length, n = e.indexOf("#");
for (; n !== -1;) {
let r = e[n - 1];
if (r === " " || r === " ") {
t = n - 1;
break;
}
n = e.indexOf("#", n + 1);
}
for (;;) {
let n = e[t - 1];
if (n === " " || n === " ") --t;
else break;
}
let r = (yield* this.pushCount(t)) + (yield* this.pushSpaces(!0));
return yield* this.pushCount(e.length - r), this.pushNewline(), "stream";
}
if (this.atLineEnd()) {
let t = yield* this.pushSpaces(!0);
return yield* this.pushCount(e.length - t), yield* this.pushNewline(), "stream";
}
return yield t.DOCUMENT, yield* this.parseLineStart();
}
*parseLineStart() {
let e = this.charAt(0);
if (!e && !this.atEnd) return this.setNext("line-start");
if (e === "-" || e === ".") {
if (!this.atEnd && !this.hasChars(4)) return this.setNext("line-start");
let e = this.peek(3);
if ((e === "---" || e === "...") && n(this.charAt(3))) return yield* this.pushCount(3), this.indentValue = 0, this.indentNext = 0, e === "---" ? "doc" : "stream";
}
return this.indentValue = yield* this.pushSpaces(!1), this.indentNext > this.indentValue && !n(this.charAt(1)) && (this.indentNext = this.indentValue), yield* this.parseBlockStart();
}
*parseBlockStart() {
let [e, t] = this.peek(2);
if (!t && !this.atEnd) return this.setNext("block-start");
if ((e === "-" || e === "?" || e === ":") && n(t)) {
let e = (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0));
return this.indentNext = this.indentValue + 1, this.indentValue += e, "block-start";
}
return "doc";
}
*parseDocument() {
yield* this.pushSpaces(!0);
let e = this.getLine();
if (e === null) return this.setNext("doc");
let t = yield* this.pushIndicators();
switch (e[t]) {
case "#": yield* this.pushCount(e.length - t);
case void 0: return yield* this.pushNewline(), yield* this.parseLineStart();
case "{":
case "[": return yield* this.pushCount(1), this.flowKey = !1, this.flowLevel = 1, "flow";
case "}":
case "]": return yield* this.pushCount(1), "doc";
case "*": return yield* this.pushUntil(s), "doc";
case "\"":
case "'": return yield* this.parseQuotedScalar();
case "|":
case ">": return t += yield* this.parseBlockScalarHeader(), t += yield* this.pushSpaces(!0), yield* this.pushCount(e.length - t), yield* this.pushNewline(), yield* this.parseBlockScalar();
default: return yield* this.parsePlainScalar();
}
}
*parseFlowCollection() {
let e, r, i = -1;
do
e = yield* this.pushNewline(), e > 0 ? (r = yield* this.pushSpaces(!1), this.indentValue = i = r) : r = 0, r += yield* this.pushSpaces(!0);
while (e + r > 0);
let a = this.getLine();
if (a === null) return this.setNext("flow");
if ((i !== -1 && i < this.indentNext && a[0] !== "#" || i === 0 && (a.startsWith("---") || a.startsWith("...")) && n(a[3])) && (i !== this.indentNext - 1 || this.flowLevel !== 1 || a[0] !== "]" && a[0] !== "}")) return this.flowLevel = 0, yield t.FLOW_END, yield* this.parseLineStart();
let o = 0;
for (; a[o] === ",";) o += yield* this.pushCount(1), o += yield* this.pushSpaces(!0), this.flowKey = !1;
switch (o += yield* this.pushIndicators(), a[o]) {
case void 0: return "flow";
case "#": return yield* this.pushCount(a.length - o), "flow";
case "{":
case "[": return yield* this.pushCount(1), this.flowKey = !1, this.flowLevel += 1, "flow";
case "}":
case "]": return yield* this.pushCount(1), this.flowKey = !0, --this.flowLevel, this.flowLevel ? "flow" : "doc";
case "*": return yield* this.pushUntil(s), "flow";
case "\"":
case "'": return this.flowKey = !0, yield* this.parseQuotedScalar();
case ":": {
let e = this.charAt(1);
if (this.flowKey || n(e) || e === ",") return this.flowKey = !1, yield* this.pushCount(1), yield* this.pushSpaces(!0), "flow";
}
default: return this.flowKey = !1, yield* this.parsePlainScalar();
}
}
*parseQuotedScalar() {
let e = this.charAt(0), t = this.buffer.indexOf(e, this.pos + 1);
if (e === "'") for (; t !== -1 && this.buffer[t + 1] === "'";) t = this.buffer.indexOf("'", t + 2);
else for (; t !== -1;) {
let e = 0;
for (; this.buffer[t - 1 - e] === "\\";) e += 1;
if (e % 2 == 0) break;
t = this.buffer.indexOf("\"", t + 1);
}
let n = this.buffer.substring(0, t), r = n.indexOf("\n", this.pos);
if (r !== -1) {
for (; r !== -1;) {
let e = this.continueScalar(r + 1);
if (e === -1) break;
r = n.indexOf("\n", e);
}
r !== -1 && (t = r - (n[r - 1] === "\r" ? 2 : 1));
}
if (t === -1) {
if (!this.atEnd) return this.setNext("quoted-scalar");
t = this.buffer.length;
}
return yield* this.pushToIndex(t + 1, !1), this.flowLevel ? "flow" : "doc";
}
*parseBlockScalarHeader() {
this.blockScalarIndent = -1, this.blockScalarKeep = !1;
let e = this.pos;
for (;;) {
let t = this.buffer[++e];
if (t === "+") this.blockScalarKeep = !0;
else if (t > "0" && t <= "9") this.blockScalarIndent = Number(t) - 1;
else if (t !== "-") break;
}
return yield* this.pushUntil((e) => n(e) || e === "#");
}
*parseBlockScalar() {
let e = this.pos - 1, n = 0, r;
loop: for (let t = this.pos; r = this.buffer[t]; ++t) switch (r) {
case " ":
n += 1;
break;
case "\n":
e = t, n = 0;
break;
case "\r": {
let e = this.buffer[t + 1];
if (!e && !this.atEnd) return this.setNext("block-scalar");
if (e === "\n") break;
}
default: break loop;
}
if (!r && !this.atEnd) return this.setNext("block-scalar");
if (n >= this.indentNext) {
this.indentNext = this.blockScalarIndent === -1 ? n : this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);
do {
let t = this.continueScalar(e + 1);
if (t === -1) break;
e = this.buffer.indexOf("\n", t);
} while (e !== -1);
if (e === -1) {
if (!this.atEnd) return this.setNext("block-scalar");
e = this.buffer.length;
}
}
let i = e + 1;
for (r = this.buffer[i]; r === " ";) r = this.buffer[++i];
if (r === " ") {
for (; r === " " || r === " " || r === "\r" || r === "\n";) r = this.buffer[++i];
e = i - 1;
} else if (!this.blockScalarKeep) do {
let t = e - 1, r = this.buffer[t];
r === "\r" && (r = this.buffer[--t]);
let i = t;
for (; r === " ";) r = this.buffer[--t];
if (r === "\n" && t >= this.pos && t + 1 + n > i) e = t;
else break;
} while (!0);
return yield t.SCALAR, yield* this.pushToIndex(e + 1, !0), yield* this.parseLineStart();
}
*parsePlainScalar() {
let e = this.flowLevel > 0, r = this.pos - 1, i = this.pos - 1, o;
for (; o = this.buffer[++i];) if (o === ":") {
let t = this.buffer[i + 1];
if (n(t) || e && a.has(t)) break;
r = i;
} else if (n(o)) {
let t = this.buffer[i + 1];
if (o === "\r" && (t === "\n" ? (i += 1, o = "\n", t = this.buffer[i + 1]) : r = i), t === "#" || e && a.has(t)) break;
if (o === "\n") {
let e = this.continueScalar(i + 1);
if (e === -1) break;
i = Math.max(i, e - 2);
}
} else {
if (e && a.has(o)) break;
r = i;
}
return !o && !this.atEnd ? this.setNext("plain-scalar") : (yield t.SCALAR, yield* this.pushToIndex(r + 1, !0), e ? "flow" : "doc");
}
*pushCount(e) {
return e > 0 ? (yield this.buffer.substr(this.pos, e), this.pos += e, e) : 0;
}
*pushToIndex(e, t) {
let n = this.buffer.slice(this.pos, e);
return n ? (yield n, this.pos += n.length, n.length) : (t && (yield ""), 0);
}
*pushIndicators() {
let e = 0;
loop: for (;;) {
switch (this.charAt(0)) {
case "!":
e += yield* this.pushTag(), e += yield* this.pushSpaces(!0);
continue loop;
case "&":
e += yield* this.pushUntil(s), e += yield* this.pushSpaces(!0);
continue loop;
case "-":
case "?":
case ":": {
let t = this.flowLevel > 0, r = this.charAt(1);
if (n(r) || t && a.has(r)) {
t ? this.flowKey &&= !1 : this.indentNext = this.indentValue + 1, e += yield* this.pushCount(1), e += yield* this.pushSpaces(!0);
continue loop;
}
}
}
break loop;
}
return e;
}
*pushTag() {
if (this.charAt(1) === "<") {
let e = this.pos + 2, t = this.buffer[e];
for (; !n(t) && t !== ">";) t = this.buffer[++e];
return yield* this.pushToIndex(t === ">" ? e + 1 : e, !1);
}
{
let e = this.pos + 1, t = this.buffer[e];
for (; t;) if (i.has(t)) t = this.buffer[++e];
else if (t === "%" && r.has(this.buffer[e + 1]) && r.has(this.buffer[e + 2])) t = this.buffer[e += 3];
else break;
return yield* this.pushToIndex(e, !1);
}
}
*pushNewline() {
let e = this.buffer[this.pos];
return e === "\n" ? yield* this.pushCount(1) : e === "\r" && this.charAt(1) === "\n" ? yield* this.pushCount(2) : 0;
}
*pushSpaces(e) {
let t = this.pos - 1, n;
do
n = this.buffer[++t];
while (n === " " || e && n === " ");
let r = t - this.pos;
return r > 0 && (yield this.buffer.substr(this.pos, r), this.pos = t), r;
}
*pushUntil(e) {
let t = this.pos, n = this.buffer[t];
for (; !e(n);) n = this.buffer[++t];
return yield* this.pushToIndex(t, !1);
}
};
})), hc = /* @__PURE__ */ i(((e) => {
e.LineCounter = class {
constructor() {
this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
let t = 0, n = this.lineStarts.length;
for (; t < n;) {
let r = t + n >> 1;
this.lineStarts[r] < e ? t = r + 1 : n = r;
}
if (this.lineStarts[t] === e) return {
line: t + 1,
col: 1
};
if (t === 0) return {
line: 0,
col: e
};
let r = this.lineStarts[t - 1];
return {
line: t,
col: e - r + 1
};
};
}
};
})), gc = /* @__PURE__ */ i(((t) => {
var n = e("process"), r = pc(), i = mc();
function a(e, t) {
for (let n = 0; n < e.length; ++n) if (e[n].type === t) return !0;
return !1;
}
function o(e) {
for (let t = 0; t < e.length; ++t) switch (e[t].type) {
case "space":
case "comment":
case "newline": break;
default: return t;
}
return -1;
}
function s(e) {
switch (e?.type) {
case "alias":
case "scalar":
case "single-quoted-scalar":
case "double-quoted-scalar":
case "flow-collection": return !0;
default: return !1;
}
}
function c(e) {
switch (e.type) {
case "document": return e.start;
case "block-map": {
let t = e.items[e.items.length - 1];
return t.sep ?? t.start;
}
case "block-seq": return e.items[e.items.length - 1].start;
/* istanbul ignore next should not happen */
default: return [];
}
}
function l(e) {
if (e.length === 0) return [];
let t = e.length;
loop: for (; --t >= 0;) switch (e[t].type) {
case "doc-start":
case "explicit-key-ind":
case "map-value-ind":
case "seq-item-ind":
case "newline": break loop;
}
for (; e[++t]?.type === "space";);
return e.splice(t, e.length);
}
function u(e, t) {
if (t.length < 1e5) Array.prototype.push.apply(e, t);
else for (let n = 0; n < t.length; ++n) e.push(t[n]);
}
function d(e) {
if (e.start.type === "flow-seq-start") for (let t of e.items) t.sep && !t.value && !a(t.start, "explicit-key-ind") && !a(t.sep, "map-value-ind") && (t.key && (t.value = t.key), delete t.key, s(t.value) ? t.value.end ? u(t.value.end, t.sep) : t.value.end = t.sep : u(t.start, t.sep), delete t.sep);
}
t.Parser = class {
constructor(e) {
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new i.Lexer(), this.onNewLine = e;
}
*parse(e, t = !1) {
this.onNewLine && this.offset === 0 && this.onNewLine(0);
for (let n of this.lexer.lex(e, t)) yield* this.next(n);
t || (yield* this.end());
}
*next(e) {
if (this.source = e, n.env.LOG_TOKENS && console.log("|", r.prettyToken(e)), this.atScalar) {
this.atScalar = !1, yield* this.step(), this.offset += e.length;
return;
}
let t = r.tokenType(e);
if (!t) {
let t = `Not a YAML token: ${e}`;
yield* this.pop({
type: "error",
offset: this.offset,
message: t,
source: e
}), this.offset += e.length;
} else if (t === "scalar") this.atNewLine = !1, this.atScalar = !0, this.type = "scalar";
else {
switch (this.type = t, yield* this.step(), t) {
case "newline":
this.atNewLine = !0, this.indent = 0, this.onNewLine && this.onNewLine(this.offset + e.length);
break;
case "space":
this.atNewLine && e[0] === " " && (this.indent += e.length);
break;
case "explicit-key-ind":
case "map-value-ind":
case "seq-item-ind":
this.atNewLine && (this.indent += e.length);
break;
case "doc-mode":
case "flow-error-end": return;
default: this.atNewLine = !1;
}
this.offset += e.length;
}
}
*end() {
for (; this.stack.length > 0;) yield* this.pop();
}
get sourceToken() {
return {
type: this.type,
offset: this.offset,
indent: this.indent,
source: this.source
};
}
*step() {
let e = this.peek(1);
if (this.type === "doc-end" && e?.type !== "doc-end") {
for (; this.stack.length > 0;) yield* this.pop();
this.stack.push({
type: "doc-end",
offset: this.offset,
source: this.source
});
return;
}
if (!e) return yield* this.stream();
switch (e.type) {
case "document": return yield* this.document(e);
case "alias":
case "scalar":
case "single-quoted-scalar":
case "double-quoted-scalar": return yield* this.scalar(e);
case "block-scalar": return yield* this.blockScalar(e);
case "block-map": return yield* this.blockMap(e);
case "block-seq": return yield* this.blockSequence(e);
case "flow-collection": return yield* this.flowCollection(e);
case "doc-end": return yield* this.documentEnd(e);
}
/* istanbul ignore next should not happen */
yield* this.pop();
}
peek(e) {
return this.stack[this.stack.length - e];
}
*pop(e) {
let t = e ?? this.stack.pop();
/* istanbul ignore if should not happen */
if (!t) yield {
type: "error",
offset: this.offset,
source: "",
message: "Tried to pop an empty stack"
};
else if (this.stack.length === 0) yield t;
else {
let e = this.peek(1);
switch (t.type === "block-scalar" ? t.indent = "indent" in e ? e.indent : 0 : t.type === "flow-collection" && e.type === "document" && (t.indent = 0), t.type === "flow-collection" && d(t), e.type) {
case "document":
e.value = t;
break;
case "block-scalar":
e.props.push(t);
break;
case "block-map": {
let n = e.items[e.items.length - 1];
if (n.value) {
e.items.push({
start: [],
key: t,
sep: []
}), this.onKeyLine = !0;
return;
}
if (n.sep) n.value = t;
else {
Object.assign(n, {
key: t,
sep: []
}), this.onKeyLine = !n.explicitKey;
return;
}
break;
}
case "block-seq": {
let n = e.items[e.items.length - 1];
n.value ? e.items.push({
start: [],
value: t
}) : n.value = t;
break;
}
case "flow-collection": {
let n = e.items[e.items.length - 1];
!n || n.value ? e.items.push({
start: [],
key: t,
sep: []
}) : n.sep ? n.value = t : Object.assign(n, {
key: t,
sep: []
});
return;
}
/* istanbul ignore next should not happen */
default: yield* this.pop(), yield* this.pop(t);
}
if ((e.type === "document" || e.type === "block-map" || e.type === "block-seq") && (t.type === "block-map" || t.type === "block-seq")) {
let n = t.items[t.items.length - 1];
n && !n.sep && !n.value && n.start.length > 0 && o(n.start) === -1 && (t.indent === 0 || n.start.every((e) => e.type !== "comment" || e.indent < t.indent)) && (e.type === "document" ? e.end = n.start : e.items.push({ start: n.start }), t.items.splice(-1, 1));
}
}
}
*stream() {
switch (this.type) {
case "directive-line":
yield {
type: "directive",
offset: this.offset,
source: this.source
};
return;
case "byte-order-mark":
case "space":
case "comment":
case "newline":
yield this.sourceToken;
return;
case "doc-mode":
case "doc-start": {
let e = {
type: "document",
offset: this.offset,
start: []
};
this.type === "doc-start" && e.start.push(this.sourceToken), this.stack.push(e);
return;
}
}
yield {
type: "error",
offset: this.offset,
message: `Unexpected ${this.type} token in YAML stream`,
source: this.source
};
}
*document(e) {
if (e.value) return yield* this.lineEnd(e);
switch (this.type) {
case "doc-start":
o(e.start) === -1 ? e.start.push(this.sourceToken) : (yield* this.pop(), yield* this.step());
return;
case "anchor":
case "tag":
case "space":
case "comment":
case "newline":
e.start.push(this.sourceToken);
return;
}
let t = this.startBlockValue(e);
t ? this.stack.push(t) : yield {
type: "error",
offset: this.offset,
message: `Unexpected ${this.type} token in YAML document`,
source: this.source
};
}
*scalar(e) {
if (this.type === "map-value-ind") {
let t = l(c(this.peek(2))), n;
e.end ? (n = e.end, n.push(this.sourceToken), delete e.end) : n = [this.sourceToken];
let r = {
type: "block-map",
offset: e.offset,
indent: e.indent,
items: [{
start: t,
key: e,
sep: n
}]
};
this.onKeyLine = !0, this.stack[this.stack.length - 1] = r;
} else yield* this.lineEnd(e);
}
*blockScalar(e) {
switch (this.type) {
case "space":
case "comment":
case "newline":
e.props.push(this.sourceToken);
return;
case "scalar":
if (e.source = this.source, this.atNewLine = !0, this.indent = 0, this.onNewLine) {
let e = this.source.indexOf("\n") + 1;
for (; e !== 0;) this.onNewLine(this.offset + e), e = this.source.indexOf("\n", e) + 1;
}
yield* this.pop();
break;
/* istanbul ignore next should not happen */
default: yield* this.pop(), yield* this.step();
}
}
*blockMap(e) {
let t = e.items[e.items.length - 1];
switch (this.type) {
case "newline":
if (this.onKeyLine = !1, t.value) {
let n = "end" in t.value ? t.value.end : void 0;
(Array.isArray(n) ? n[n.length - 1] : void 0)?.type === "comment" ? n?.push(this.sourceToken) : e.items.push({ start: [this.sourceToken] });
} else t.sep ? t.sep.push(this.sourceToken) : t.start.push(this.sourceToken);
return;
case "space":
case "comment":
if (t.value) e.items.push({ start: [this.sourceToken] });
else if (t.sep) t.sep.push(this.sourceToken);
else {
if (this.atIndentedComment(t.start, e.indent)) {
let n = e.items[e.items.length - 2]?.value?.end;
if (Array.isArray(n)) {
u(n, t.start), n.push(this.sourceToken), e.items.pop();
return;
}
}
t.start.push(this.sourceToken);
}
return;
}
if (this.indent >= e.indent) {
let n = !this.onKeyLine && this.indent === e.indent, r = n && (t.sep || t.explicitKey) && this.type !== "seq-item-ind", i = [];
if (r && t.sep && !t.value) {
let n = [];
for (let r = 0; r < t.sep.length; ++r) {
let i = t.sep[r];
switch (i.type) {
case "newline":
n.push(r);
break;
case "space": break;
case "comment":
i.indent > e.indent && (n.length = 0);
break;
default: n.length = 0;
}
}
n.length >= 2 && (i = t.sep.splice(n[1]));
}
switch (this.type) {
case "anchor":
case "tag":
r || t.value ? (i.push(this.sourceToken), e.items.push({ start: i }), this.onKeyLine = !0) : t.sep ? t.sep.push(this.sourceToken) : t.start.push(this.sourceToken);
return;
case "explicit-key-ind":
!t.sep && !t.explicitKey ? (t.start.push(this.sourceToken), t.explicitKey = !0) : r || t.value ? (i.push(this.sourceToken), e.items.push({
start: i,
explicitKey: !0
})) : this.stack.push({
type: "block-map",
offset: this.offset,
indent: this.indent,
items: [{
start: [this.sourceToken],
explicitKey: !0
}]
}), this.onKeyLine = !0;
return;
case "map-value-ind":
if (t.explicitKey) {
if (!t.sep) {
if (a(t.start, "newline")) Object.assign(t, {
key: null,
sep: [this.sourceToken]
});
else {
let e = l(t.start);
this.stack.push({
type: "block-map",
offset: this.offset,
indent: this.indent,
items: [{
start: e,
key: null,
sep: [this.sourceToken]
}]
});
}
} else if (t.value) e.items.push({
start: [],
key: null,
sep: [this.sourceToken]
});
else if (a(t.sep, "map-value-ind")) this.stack.push({
type: "block-map",
offset: this.offset,
indent: this.indent,
items: [{
start: i,
key: null,
sep: [this.sourceToken]
}]
});
else if (s(t.key) && !a(t.sep, "newline")) {
let e = l(t.start), n = t.key, r = t.sep;
r.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
type: "block-map",
offset: this.offset,
indent: this.indent,
items: [{
start: e,
key: n,
sep: r
}]
});
} else i.length > 0 ? t.sep = t.sep.concat(i, this.sourceToken) : t.sep.push(this.sourceToken);
} else t.sep ? t.value || r ? e.items.push({
start: i,
key: null,
sep: [this.sourceToken]
}) : a(t.sep, "map-value-ind") ? this.stack.push({
type: "block-map",
offset: this.offset,
indent: this.indent,
items: [{
start: [],
key: null,
sep: [this.sourceToken]
}]
}) : t.sep.push(this.sourceToken) : Object.assign(t, {
key: null,
sep: [this.sourceToken]
});
this.onKeyLine = !0;
return;
case "alias":
case "scalar":
case "single-quoted-scalar":
case "double-quoted-scalar": {
let n = this.flowScalar(this.type);
r || t.value ? (e.items.push({
start: i,
key: n,
sep: []
}), this.onKeyLine = !0) : t.sep ? this.stack.push(n) : (Object.assign(t, {
key: n,
sep: []
}), this.onKeyLine = !0);
return;
}
default: {
let r = this.startBlockValue(e);
if (r) {
if (r.type === "block-seq") {
if (!t.explicitKey && t.sep && !a(t.sep, "newline")) {
yield* this.pop({
type: "error",
offset: this.offset,
message: "Unexpected block-seq-ind on same line with key",
source: this.source
});
return;
}
} else n && e.items.push({ start: i });
this.stack.push(r);
return;
}
}
}
}
yield* this.pop(), yield* this.step();
}
*blockSequence(e) {
let t = e.items[e.items.length - 1];
switch (this.type) {
case "newline":
if (t.value) {
let n = "end" in t.value ? t.value.end : void 0;
(Array.isArray(n) ? n[n.length - 1] : void 0)?.type === "comment" ? n?.push(this.sourceToken) : e.items.push({ start: [this.sourceToken] });
} else t.start.push(this.sourceToken);
return;
case "space":
case "comment":
if (t.value) e.items.push({ start: [this.sourceToken] });
else {
if (this.atIndentedComment(t.start, e.indent)) {
let n = e.items[e.items.length - 2]?.value?.end;
if (Array.isArray(n)) {
u(n, t.start), n.push(this.sourceToken), e.items.pop();
return;
}
}
t.start.push(this.sourceToken);
}
return;
case "anchor":
case "tag":
if (t.value || this.indent <= e.indent) break;
t.start.push(this.sourceToken);
return;
case "seq-item-ind":
if (this.indent !== e.indent) break;
t.value || a(t.start, "seq-item-ind") ? e.items.push({ start: [this.sourceToken] }) : t.start.push(this.sourceToken);
return;
}
if (this.indent > e.indent) {
let t = this.startBlockValue(e);
if (t) {
this.stack.push(t);
return;
}
}
yield* this.pop(), yield* this.step();
}
*flowCollection(e) {
let t = e.items[e.items.length - 1];
if (this.type === "flow-error-end") {
let e;
do
yield* this.pop(), e = this.peek(1);
while (e?.type === "flow-collection");
} else if (e.end.length === 0) {
switch (this.type) {
case "comma":
case "explicit-key-ind":
!t || t.sep ? e.items.push({ start: [this.sourceToken] }) : t.start.push(this.sourceToken);
return;
case "map-value-ind":
!t || t.value ? e.items.push({
start: [],
key: null,
sep: [this.sourceToken]
}) : t.sep ? t.sep.push(this.sourceToken) : Object.assign(t, {
key: null,
sep: [this.sourceToken]
});
return;
case "space":
case "comment":
case "newline":
case "anchor":
case "tag":
!t || t.value ? e.items.push({ start: [this.sourceToken] }) : t.sep ? t.sep.push(this.sourceToken) : t.start.push(this.sourceToken);
return;
case "alias":
case "scalar":
case "single-quoted-scalar":
case "double-quoted-scalar": {
let n = this.flowScalar(this.type);
!t || t.value ? e.items.push({
start: [],
key: n,
sep: []
}) : t.sep ? this.stack.push(n) : Object.assign(t, {
key: n,
sep: []
});
return;
}
case "flow-map-end":
case "flow-seq-end":
e.end.push(this.sourceToken);
return;
}
let n = this.startBlockValue(e);
/* istanbul ignore else should not happen */
n ? this.stack.push(n) : (yield* this.pop(), yield* this.step());
} else {
let t = this.peek(2);
if (t.type === "block-map" && (this.type === "map-value-ind" && t.indent === e.indent || this.type === "newline" && !t.items[t.items.length - 1].sep)) yield* this.pop(), yield* this.step();
else if (this.type === "map-value-ind" && t.type !== "flow-collection") {
let n = l(c(t));
d(e);
let r = e.end.splice(1, e.end.length);
r.push(this.sourceToken);
let i = {
type: "block-map",
offset: e.offset,
indent: e.indent,
items: [{
start: n,
key: e,
sep: r
}]
};
this.onKeyLine = !0, this.stack[this.stack.length - 1] = i;
} else yield* this.lineEnd(e);
}
}
flowScalar(e) {
if (this.onNewLine) {
let e = this.source.indexOf("\n") + 1;
for (; e !== 0;) this.onNewLine(this.offset + e), e = this.source.indexOf("\n", e) + 1;
}
return {
type: e,
offset: this.offset,
indent: this.indent,
source: this.source
};
}
startBlockValue(e) {
switch (this.type) {
case "alias":
case "scalar":
case "single-quoted-scalar":
case "double-quoted-scalar": return this.flowScalar(this.type);
case "block-scalar-header": return {
type: "block-scalar",
offset: this.offset,
indent: this.indent,
props: [this.sourceToken],
source: ""
};
case "flow-map-start":
case "flow-seq-start": return {
type: "flow-collection",
offset: this.offset,
indent: this.indent,
start: this.sourceToken,
items: [],
end: []
};
case "seq-item-ind": return {
type: "block-seq",
offset: this.offset,
indent: this.indent,
items: [{ start: [this.sourceToken] }]
};
case "explicit-key-ind": {
this.onKeyLine = !0;
let t = l(c(e));
return t.push(this.sourceToken), {
type: "block-map",
offset: this.offset,
indent: this.indent,
items: [{
start: t,
explicitKey: !0
}]
};
}
case "map-value-ind": {
this.onKeyLine = !0;
let t = l(c(e));
return {
type: "block-map",
offset: this.offset,
indent: this.indent,
items: [{
start: t,
key: null,
sep: [this.sourceToken]
}]
};
}
}
return null;
}
atIndentedComment(e, t) {
return this.type !== "comment" || this.indent <= t ? !1 : e.every((e) => e.type === "newline" || e.type === "space");
}
*documentEnd(e) {
this.type !== "doc-mode" && (e.end ? e.end.push(this.sourceToken) : e.end = [this.sourceToken], this.type === "newline" && (yield* this.pop()));
}
*lineEnd(e) {
switch (this.type) {
case "comma":
case "doc-start":
case "doc-end":
case "flow-seq-end":
case "flow-map-end":
case "map-value-ind":
yield* this.pop(), yield* this.step();
break;
case "newline": this.onKeyLine = !1;
default: e.end ? e.end.push(this.sourceToken) : e.end = [this.sourceToken], this.type === "newline" && (yield* this.pop());
}
}
};
})), _c = /* @__PURE__ */ i(((e) => {
var t = lc(), n = Ks(), r = qs(), i = _s(), a = Q(), o = hc(), s = gc();
function c(e) {
let t = e.prettyErrors !== !1;
return {
lineCounter: e.lineCounter || t && new o.LineCounter() || null,
prettyErrors: t
};
}
function l(e, n = {}) {
let { lineCounter: i, prettyErrors: a } = c(n), o = new s.Parser(i?.addNewLine), l = new t.Composer(n), u = Array.from(l.compose(o.parse(e)));
if (a && i) for (let t of u) t.errors.forEach(r.prettifyError(e, i)), t.warnings.forEach(r.prettifyError(e, i));
return u.length > 0 ? u : Object.assign([], { empty: !0 }, l.streamInfo());
}
function u(e, n = {}) {
let { lineCounter: i, prettyErrors: a } = c(n), o = new s.Parser(i?.addNewLine), l = new t.Composer(n), u = null;
for (let t of l.compose(o.parse(e), !0, e.length)) if (!u) u = t;
else if (u.options.logLevel !== "silent") {
u.errors.push(new r.YAMLParseError(t.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
break;
}
return a && i && (u.errors.forEach(r.prettifyError(e, i)), u.warnings.forEach(r.prettifyError(e, i))), u;
}
function d(e, t, n) {
let r;
typeof t == "function" ? r = t : n === void 0 && t && typeof t == "object" && (n = t);
let a = u(e, n);
if (!a) return null;
if (a.warnings.forEach((e) => i.warn(a.options.logLevel, e)), a.errors.length > 0) {
if (a.options.logLevel !== "silent") throw a.errors[0];
a.errors = [];
}
return a.toJS(Object.assign({ reviver: r }, n));
}
function f(e, t, r) {
let i = null;
if (typeof t == "function" || Array.isArray(t) ? i = t : r === void 0 && t && (r = t), typeof r == "string" && (r = r.length), typeof r == "number") {
let e = Math.round(r);
r = e < 1 ? void 0 : e > 8 ? { indent: 8 } : { indent: e };
}
if (e === void 0) {
let { keepUndefined: e } = r ?? t ?? {};
if (!e) return;
}
return a.isDocument(e) && !i ? e.toString(r) : new n.Document(e, i, r).toString(r);
}
e.parse = d, e.parseAllDocuments = l, e.parseDocument = u, e.stringify = f;
})), vc = (/* @__PURE__ */ i(((e) => {
var t = lc(), n = Ks(), r = Ws(), i = qs(), a = cs(), o = Q(), s = bs(), c = ls(), l = Ss(), u = ws(), d = pc(), f = mc(), p = hc(), m = gc(), h = _c(), g = ns();
e.Composer = t.Composer, e.Document = n.Document, e.Schema = r.Schema, e.YAMLError = i.YAMLError, e.YAMLParseError = i.YAMLParseError, e.YAMLWarning = i.YAMLWarning, e.Alias = a.Alias, e.isAlias = o.isAlias, e.isCollection = o.isCollection, e.isDocument = o.isDocument, e.isMap = o.isMap, e.isNode = o.isNode, e.isPair = o.isPair, e.isScalar = o.isScalar, e.isSeq = o.isSeq, e.Pair = s.Pair, e.Scalar = c.Scalar, e.YAMLMap = l.YAMLMap, e.YAMLSeq = u.YAMLSeq, e.CST = d, e.Lexer = f.Lexer, e.LineCounter = p.LineCounter, e.Parser = m.Parser, e.parse = h.parse, e.parseAllDocuments = h.parseAllDocuments, e.parseDocument = h.parseDocument, e.stringify = h.stringify, e.visit = g.visit, e.visitAsync = g.visitAsync;
})))(), yc = (e, t) => e.replace(/\$\{(\w+)(?:(:)?-([^}]*))?\}/g, (e, n, r, i = "") => {
let a = t[n];
return r ? a || i : a ?? i;
}), bc = /* @__PURE__ */ r({
default: () => Vc,
defaultPrefix: () => Io,
distTag: () => Uc,
getDistTags: () => Xc,
getEngines: () => Zc,
getPeerDependencies: () => Ro,
greatest: () => Wc,
latest: () => Gc,
list: () => Fc,
minor: () => Kc,
newest: () => qc,
packageAuthorChanged: () => Qc,
patch: () => Jc,
pnpmApi: () => $c,
semver: () => Yc
}), xc = (e) => {
let t = typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
return typeof t == "number" && !isNaN(t) && t >= 0 ? t : void 0;
}, Sc = (e) => {
if (Array.isArray(e)) return e.filter((e) => typeof e == "string");
if (typeof e == "string") {
let t = e.trim();
if (t.startsWith("[")) try {
let e = JSON.parse(t);
if (Array.isArray(e)) return e.filter((e) => typeof e == "string");
} catch {}
return t === "" ? [] : [t];
}
return [];
}, Cc = (e) => ({
minimumReleaseAge: xc(e.minimumReleaseAge ?? e["minimum-release-age"]),
minimumReleaseAgeExclude: Sc(e.minimumReleaseAgeExclude ?? e["minimum-release-age-exclude"])
}), wc = () => {
if (process.env.XDG_CONFIG_HOME) return o.join(process.env.XDG_CONFIG_HOME, "pnpm");
if (process.platform === "win32") {
let e = process.env.LOCALAPPDATA || o.join(c.homedir(), "AppData", "Local");
return o.join(e, "pnpm", "config");
}
return process.platform === "darwin" ? o.join(c.homedir(), "Library", "Preferences", "pnpm") : o.join(c.homedir(), ".config", "pnpm");
}, Tc = (0, La.default)(async (e, t) => {
let n;
try {
n = await s.readFile(e, "utf-8");
} catch {
return null;
}
try {
return (t === "yaml" ? (0, vc.parse)(n) : ro.default.parse(n)) ?? {};
} catch {
return null;
}
}), Ec = async (e, t) => {
let n = await Tc(e, t);
return n ? Cc(n) : null;
}, Dc = async (e) => {
try {
return await s.access(e), !0;
} catch {
return !1;
}
}, Oc = async () => {
try {
let { stdout: e } = await na("pnpm", ["--version"]), t = Number.parseInt(e.trim(), 10);
return Number.isNaN(t) ? null : t;
} catch {
return null;
}
}, kc = async (e = {}) => {
let { pnpmMajorVersion: t, cwd: n } = e, r = wc(), i = await to("pnpm-workspace.yaml", { cwd: n }), a = o.join(r, "config.yaml"), s = o.join(r, "rc"), c = t;
if (c === void 0) {
let [e, t] = await Promise.all([Dc(a), Dc(s)]);
c = e && t ? await Oc() : e ? 11 : 10;
}
let l = await Promise.all([c == null || c >= 11 ? Ec(a, "yaml") : null, c == null || c <= 10 ? Ec(s, "ini") : null]), u = [i ? await Ec(i, "yaml") : null, ...l], d = u.find((e) => e?.minimumReleaseAge != null)?.minimumReleaseAge;
return d == null ? null : {
minimumReleaseAge: d,
minimumReleaseAgeExclude: [...new Set(u.flatMap((e) => e?.minimumReleaseAgeExclude ?? []))]
};
}, Ac = /\$\{[^}]*\}/, jc = (e, t) => {
let n = e?.registries, r = typeof n == "object" && n && !Array.isArray(n) ? n : {};
return J({
default: e?.registry,
...r
}, (e, n) => {
if (typeof n != "string") return null;
let r = t ? yc(n, process.env) : n;
return r.trim() === "" || Ac.test(r) ? null : { [e]: r };
});
}, Mc = async (e) => {
let [t, n] = await Promise.all([e ? Tc(e, "yaml") : null, Tc(o.join(wc(), "config.yaml"), "yaml")]), { default: r, ...i } = {
...jc(n, !0),
...jc(t, !1)
};
return {
default: r,
scoped: i
};
}, Nc = async (e = {}) => Mc(await to("pnpm-workspace.yaml", { cwd: e.cwd })), Pc = (e, t, n) => J(Ao(e, {
command: t,
stderr: n
})[0]?.dependencies || {}, (e, { version: t }) => ({ [e]: t })), Fc = async (e = {}) => {
if (!e.global) return Vo(e);
let t = [
"ls",
"-g",
"--json"
], { stdout: n, stderr: r, command: i } = await na("pnpm", t).catch((e) => {
throw e instanceof Error ? e : Error(`Error executing "pnpm ${t.join(" ")}". ${String(e).trim() || "No error output."}`);
});
return Pc(n, i, r);
}, Ic = (0, La.default)(async (e) => {
let t = o.join(e, ".npmrc"), n = await s.readFile(t, "utf-8").catch(() => null);
return n == null ? null : To(ro.default.parse(n), e);
}), Lc = async (e, t) => {
let n = await Ic(t);
return n == null ? {} : (X(e, `\nUsing pnpm workspace config at ${o.join(t, ".npmrc")}:`, "verbose"), n);
}, Rc = (0, La.default)(async (e) => {
let t = await to("pnpm-workspace.yaml", { cwd: e.cwd }), n = t ? o.dirname(t) : void 0, [r, { default: i, scoped: a }] = await Promise.all([n ? Lc(e, n) : {}, Mc(t)]), s = {
...J(a, (e, t) => ({ [`${e}:registry`]: t })),
...i ? { registry: i } : null
};
return Object.keys(s).length > 0 && (X(e, "\npnpm registries in npm format:", "verbose"), X(e, s, "verbose")), {
registries: s,
workspaceNpmrc: r
};
}), zc = (e) => async (t, n, r = {}) => {
let { registries: i, workspaceNpmrc: a } = await Rc(r);
return e(t, n, r, i, a);
}, Bc = (e, t) => [
...t.global ? ["global"] : [],
...Array.isArray(e) ? e : [e],
...t.prefix ? [`--prefix=${t.prefix}`] : []
];
async function Vc(e, t = {}, n, r) {
return na("pnpm", Bc(e, t), n, r);
}
var Hc = (e) => async (...t) => {
let n = t.slice(0, e.length), r = t[e.length] ?? {}, { registries: i, workspaceNpmrc: a } = await Rc(r);
return e(...n, r, i, a);
}, Uc = zc(Ho), Wc = zc(Lo), Gc = zc(Uo), Kc = zc(Go), qc = zc(Wo), Jc = zc(Ko), Yc = zc(qo), Xc = Hc(zo), Zc = Hc(Bo), Qc = Hc(No), $c = {
buildArgs: Bc,
getPnpmWorkspaceMinimumReleaseAge: kc,
getPnpmWorkspaceRegistries: Nc,
parseList: Pc
}, el = /* @__PURE__ */ r({
default: () => cl,
defaultPrefix: () => ll,
distTag: () => fl,
getDistTags: () => bl,
getEngines: () => xl,
getPathToLookForYarnrc: () => rl,
getPeerDependencies: () => yl,
greatest: () => pl,
latest: () => ml,
list: () => ul,
minor: () => hl,
newest: () => gl,
npmAuthTokenKeyValue: () => tl,
packageAuthorChanged: () => Sl,
patch: () => _l,
semver: () => vl,
yarnApi: () => Cl
}), tl = (e) => (t, n) => {
if (n.npmAuthToken) {
let r = n.npmRegistryServer || e[`@${t}:registry`];
if (r) {
let e = r.replace(/^https?:/, "");
return e.endsWith("/") && (e = e.slice(0, -1)), { [`${e}/:_authToken`]: yc(n.npmAuthToken, process.env) };
}
}
return null;
}, nl = (e, t) => t.npmRegistryServer ? { [`@${e}:registry`]: yc(t.npmRegistryServer, process.env) } : null;
async function rl(e, t = s.readdir) {
if (e.global) return;
let n = (await Ii(e, t))?.directoryPath;
if (n) return o.join(n, ".yarnrc.yml");
}
var il = (0, La.default)(async (e) => {
let t = await rl(e), n = o.join(c.homedir(), ".yarnrc.yml"), r = typeof t == "string" && await Tn(t), i = await Tn(n), a = r ? await s.readFile(t, "utf-8") : "", l = i ? await s.readFile(n, "utf-8") : "", u = (0, vc.parse)(a), d = (0, vc.parse)(l), f = {
...J(d?.npmScopes || {}, nl),
...J(u?.npmScopes || {}, nl)
};
return f = {
...f,
...J(d?.npmScopes || {}, tl(f)),
...J(u?.npmScopes || {}, tl(f))
}, r && (X(e, `\nUsing local yarn config at ${t}:`, "verbose"), X(e, u, "verbose")), i && (X(e, `\nUsing user yarn config at ${n}:`, "verbose"), X(e, d, "verbose")), Object.keys(f).length > 0 && (X(e, "\nMerged yarn config in npm format:", "verbose"), X(e, f, "verbose")), f;
}), al = (0, La.default)(async (e) => {
let t = await rl(e), n = o.join(c.homedir(), ".yarnrc.yml");
for (let e of [t, n]) {
if (!e || !await Tn(e)) continue;
let t;
try {
t = await s.readFile(e, "utf-8");
} catch {
continue;
}
let n;
try {
n = (0, vc.parse)(t) ?? {};
} catch {
continue;
}
let { npmMinimalAgeGate: r } = n, i;
if (typeof r == "number") {
if (isNaN(r) || r <= 0) continue;
i = r;
} else if (typeof r == "string") {
let e = zn(r);
if (e === null || e <= 0) continue;
i = e * 1440;
} else continue;
let a = n.npmPreapprovedPackages, o = Array.isArray(a) ? a.filter((e) => typeof e == "string") : [];
return {
npmMinimalAgeGate: i,
npmPreapprovedPackages: o
};
}
return null;
});
function ol(e) {
let t = {};
for (let n of e.split("\n")) {
if (!n.trim()) continue;
let e = JSON.parse(n);
if (e.type === "info" && !e.data.match(/^Visit/)) {
let [, n, r] = e.data.match(/"(@?[^@]*)@([^"]*)"/) || [];
if (!n) continue;
t[n] = {
version: r,
from: n
};
} else if (e.type === "error") throw Error(e.data);
}
return { dependencies: t };
}
function sl(e) {
for (let t of e.split("\n")) if (t.trim()) return JSON.stringify(JSON.parse(t));
throw Error("No JSON line found");
}
async function cl(e, t = {}, n = {}, r = {}) {
return na("yarn", [
...t.global ? ["global"] : [],
...t.prefix ? [`--prefix=${t.prefix}`] : [],
"--depth=0",
"--json",
"--no-progress",
...Array.isArray(e) ? e : [e]
], n, r);
}
async function ll(e) {
if (e.prefix) return e.prefix;
let t;
try {
t = (await na("yarn", ["global", "dir"])).stdout;
} catch {
t = null;
}
return e.global && t && t.match("Cellar") ? "/usr/local" : process.platform === "win32" && e.global && !process.env.prefix ? t ? t.trim() : `${process.env.LOCALAPPDATA}\\Yarn\\Data\\global` : null;
}
var ul = async (e = {}, t) => {
let { stdout: n } = await cl("list", e, {}, {
...e.cwd ? { cwd: e.cwd } : {},
...t
});
return J(ol(n).dependencies, (e, t) => ({ [e]: t.version || t.required?.version }));
}, dl = (e) => async (t, n, r = {}) => e(t, n, r, await il(r)), fl = dl(Ho), pl = dl(Lo), ml = dl(Uo), hl = dl(Go), gl = dl(Wo), _l = dl(Ko), vl = dl(qo), yl = async (e, t, n) => {
let { stdout: r } = await na("yarn", ["--version"], { rejectOnError: !1 }, n);
if (r.startsWith("1")) {
let r = [
"--json",
"info",
`${e}@${t}`,
"peerDependencies"
], { stdout: i } = await na("yarn", r, { rejectOnError: !1 }, n);
if (!i) throw Error(`No response from "yarn ${r.join(" ")}"`);
return Ao(i, { command: r.join(" ") }).data || {};
}
{
let r = [
"--json",
"npm",
"info",
`${e}@${t}`,
"--fields",
"peerDependencies"
], { stdout: i } = await na("yarn", r, { rejectOnError: !1 }, n);
if (!i) return {};
try {
return Ao(i, { command: r.join(" ") }).peerDependencies || {};
} catch (e) {
let t;
try {
t = Ao(sl(i), { command: r.join(" ") });
} catch {}
if (!t) throw e;
if (t.type === "error") throw Error(`yarn ${r.join(" ")}: ${t.data ?? "lookup failed"}`, { cause: e });
return t.peerDependencies || {};
}
}
}, bl = async (e, t = {}) => zo(e, t, await il(t)), xl = async (e, t, n = {}) => Bo(e, t, n, await il(n)), Sl = async (e, t, n, r = {}) => No(e, t, n, r, await il(r)), Cl = {
getYarnMinimalAgeGate: al,
parseJsonLines: ol,
extractFirstJsonLine: sl
};
//#endregion
//#region src/lib/programError.ts
function $(e, t, { color: n = !0 } = {}) {
if (e.cli) X(e, n ? Y.red(t) : t, null, "error"), process.exit(1);
else throw Error(t);
}
//#endregion
//#region src/lib/loadPackageInfoFromFile.ts
var wl = async (e, t) => {
let n, r;
try {
r = await s.readFile(t, "utf-8"), n = JSON.parse(r);
} catch {
$(e, `Missing or invalid ${t}`);
}
return {
name: void 0,
pkg: n,
pkgFile: r,
filepath: t
};
}, Tl, El = {
lang: void 0,
message: void 0,
abortEarly: void 0,
abortPipeEarly: void 0
};
/* @__NO_SIDE_EFFECTS__ */
function Dl(e) {
return !e && !Tl ? El : {
lang: e?.lang ?? Tl?.lang,
message: e?.message,
abortEarly: e?.abortEarly ?? Tl?.abortEarly,
abortPipeEarly: e?.abortPipeEarly ?? Tl?.abortPipeEarly
};
}
var Ol;
/* @__NO_SIDE_EFFECTS__ */
function kl(e) {
return Ol?.get(e);
}
var Al;
/* @__NO_SIDE_EFFECTS__ */
function jl(e) {
return Al?.get(e);
}
var Ml;
/* @__NO_SIDE_EFFECTS__ */
function Nl(e, t) {
return Ml?.get(e)?.get(t);
}
/* @__NO_SIDE_EFFECTS__ */
function Pl(e) {
let t = typeof e;
return t === "string" ? `"${e}"` : t === "number" || t === "bigint" || t === "boolean" ? `${e}` : t === "object" || t === "function" ? (e && Object.getPrototypeOf(e)?.constructor?.name) ?? "null" : t;
}
function Fl(e, t, n, r, i) {
let a = i && "input" in i ? i.input : n.value, o = i?.expected ?? e.expects ?? null, s = i?.received ?? /* @__PURE__ */ Pl(a), c = {
kind: e.kind,
type: e.type,
input: a,
expected: o,
received: s,
message: `Invalid ${t}: ${o ? `Expected ${o} but r` : "R"}eceived ${s}`,
requirement: e.requirement,
path: i?.path,
issues: i?.issues,
lang: r.lang,
abortEarly: r.abortEarly,
abortPipeEarly: r.abortPipeEarly
}, l = e.kind === "schema", u = i?.message ?? e.message ?? /* @__PURE__ */ Nl(e.reference, c.lang) ?? (l ? /* @__PURE__ */ jl(c.lang) : null) ?? r.message ?? /* @__PURE__ */ kl(c.lang);
u !== void 0 && (c.message = typeof u == "function" ? u(c) : u), l && (n.typed = !1), n.issues ? n.issues.push(c) : n.issues = [c];
}
var Il = /* @__PURE__ */ new WeakMap();
/* @__NO_SIDE_EFFECTS__ */
function Ll(e) {
let t = Il.get(e);
return t || (t = {
version: 1,
vendor: "valibot",
validate(t) {
return e["~run"]({ value: t }, /* @__PURE__ */ Dl());
}
}, Il.set(e, t)), t;
}
/* @__NO_SIDE_EFFECTS__ */
function Rl(e, t) {
return Object.prototype.hasOwnProperty.call(e, t) && t !== "__proto__" && t !== "prototype" && t !== "constructor";
}
/* @__NO_SIDE_EFFECTS__ */
function zl(e, t) {
let n = [...new Set(e)];
return n.length > 1 ? `(${n.join(` ${t} `)})` : n[0] ?? "never";
}
var Bl = class extends Error {
constructor(e) {
super(e[0].message), this.name = "ValiError", this.issues = e;
}
};
/* @__NO_SIDE_EFFECTS__ */
function Vl(e, t, n) {
return typeof e.fallback == "function" ? e.fallback(t, n) : e.fallback;
}
/* @__NO_SIDE_EFFECTS__ */
function Hl(e, t) {
return {
...e,
fallback: t,
get "~standard"() {
return /* @__PURE__ */ Ll(this);
},
"~run"(t, n) {
let r = e["~run"](t, n);
return r.issues ? {
typed: !0,
value: /* @__PURE__ */ Vl(this, r, n)
} : r;
}
};
}
/* @__NO_SIDE_EFFECTS__ */
function Ul(e, t, n) {
return typeof e.default == "function" ? e.default(t, n) : e.default;
}
/* @__NO_SIDE_EFFECTS__ */
function Wl(e, t) {
return {
kind: "schema",
type: "array",
reference: Wl,
expects: "Array",
async: !1,
item: e,
message: t,
get "~standard"() {
return /* @__PURE__ */ Ll(this);
},
"~run"(e, t) {
let n = e.value;
if (Array.isArray(n)) {
e.typed = !0, e.value = [];
for (let r = 0; r < n.length; r++) {
let i = n[r], a = this.item["~run"]({ value: i }, t);
if (a.issues) {
let o = {
type: "array",
origin: "value",
input: n,
key: r,
value: i
};
for (let t of a.issues) t.path ? t.path.unshift(o) : t.path = [o], e.issues?.push(t);
if (e.issues ||= a.issues, t.abortEarly) {
e.typed = !1;
break;
}
}
a.typed || (e.typed = !1), e.value.push(a.value);
}
} else Fl(this, "type", e, t);
return e;
}
};
}
/* @__NO_SIDE_EFFECTS__ */
function Gl(e, t) {
return {
kind: "schema",
type: "loose_object",
reference: Gl,
expects: "Object",
async: !1,
entries: e,
message: t,
get "~standard"() {
return /* @__PURE__ */ Ll(this);
},
"~run"(e, t) {
let n = e.value;
if (n && typeof n == "object") {
e.typed = !0, e.value = {};
for (let r in this.entries) {
let i = this.entries[r];
if (r in n || (i.type === "exact_optional" || i.type === "optional" || i.type === "nullish") && i.default !== void 0) {
let a = r in n ? n[r] : /* @__PURE__ */ Ul(i), o = i["~run"]({ value: a }, t);
if (o.issues) {
let i = {
type: "object",
origin: "value",
input: n,
key: r,
value: a
};
for (let t of o.issues) t.path ? t.path.unshift(i) : t.path = [i], e.issues?.push(t);
if (e.issues ||= o.issues, t.abortEarly) {
e.typed = !1;
break;
}
}
o.typed || (e.typed = !1), e.value[r] = o.value;
} else if (i.fallback !== void 0) e.value[r] = /* @__PURE__ */ Vl(i);
else if (i.type !== "exact_optional" && i.type !== "optional" && i.type !== "nullish" && (Fl(this, "key", e, t, {
input: void 0,
expected: `"${r}"`,
path: [{
type: "object",
origin: "key",
input: n,
key: r,
value: n[r]
}]
}), t.abortEarly)) break;
}
if (!e.issues || !t.abortEarly) for (let t in n) /* @__PURE__ */ Rl(n, t) && !(t in this.entries) && (e.value[t] = n[t]);
} else Fl(this, "type", e, t);
return e;
}
};
}
/* @__NO_SIDE_EFFECTS__ */
function Kl(e, t) {
return {
kind: "schema",
type: "object",
reference: Kl,
expects: "Object",
async: !1,
entries: e,
message: t,
get "~standard"() {
return /* @__PURE__ */ Ll(this);
},
"~run"(e, t) {
let n = e.value;
if (n && typeof n == "object") {
e.typed = !0, e.value = {};
for (let r in this.entries) {
let i = this.entries[r];
if (r in n || (i.type === "exact_optional" || i.type === "optional" || i.type === "nullish") && i.default !== void 0) {
let a = r in n ? n[r] : /* @__PURE__ */ Ul(i), o = i["~run"]({ value: a }, t);
if (o.issues) {
let i = {
type: "object",
origin: "value",
input: n,
key: r,
value: a
};
for (let t of o.issues) t.path ? t.path.unshift(i) : t.path = [i], e.issues?.push(t);
if (e.issues ||= o.issues, t.abortEarly) {
e.typed = !1;
break;
}
}
o.typed || (e.typed = !1), e.value[r] = o.value;
} else if (i.fallback !== void 0) e.value[r] = /* @__PURE__ */ Vl(i);
else if (i.type !== "exact_optional" && i.type !== "optional" && i.type !== "nullish" && (Fl(this, "key", e, t, {
input: void 0,
expected: `"${r}"`,
path: [{
type: "object",
origin: "key",
input: n,
key: r,
value: n[r]
}]
}), t.abortEarly)) break;
}
} else Fl(this, "type", e, t);
return e;
}
};
}
/* @__NO_SIDE_EFFECTS__ */
function ql(e, t) {
return {
kind: "schema",
type: "optional",
reference: ql,
expects: `(${e.expects} | undefined)`,
async: !1,
wrapped: e,
default: t,
get "~standard"() {
return /* @__PURE__ */ Ll(this);
},
"~run"(e, t) {
return e.value === void 0 && (this.default !== void 0 && (e.value = /* @__PURE__ */ Ul(this, e, t)), e.value === void 0) ? (e.typed = !0, e) : this.wrapped["~run"](e, t);
}
};
}
/* @__NO_SIDE_EFFECTS__ */
function Jl(e, t, n) {
return {
kind: "schema",
type: "record",
reference: Jl,
expects: "Object",
async: !1,
key: e,
value: t,
message: n,
get "~standard"() {
return /* @__PURE__ */ Ll(this);
},
"~run"(e, t) {
let n = e.value;
if (n && typeof n == "object") {
e.typed = !0, e.value = {};
for (let r in n) if (/* @__PURE__ */ Rl(n, r)) {
let i = n[r], a = this.key["~run"]({ value: r }, t);
if (a.issues) {
let o = {
type: "object",
origin: "key",
input: n,
key: r,
value: i
};
for (let t of a.issues) t.path = [o], e.issues?.push(t);
if (e.issues ||= a.issues, t.abortEarly) {
e.typed = !1;
break;
}
}
let o = this.value["~run"]({ value: i }, t);
if (o.issues) {
let a = {
type: "object",
origin: "value",
input: n,
key: r,
value: i
};
for (let t of o.issues) t.path ? t.path.unshift(a) : t.path = [a], e.issues?.push(t);
if (e.issues ||= o.issues, t.abortEarly) {
e.typed = !1;
break;
}
}
(!a.typed || !o.typed) && (e.typed = !1), a.typed && (e.value[a.value] = o.value);
}
} else Fl(this, "type", e, t);
return e;
}
};
}
/* @__NO_SIDE_EFFECTS__ */
function Yl(e) {
return {
kind: "schema",
type: "string",
reference: Yl,
expects: "string",
async: !1,
message: e,
get "~standard"() {
return /* @__PURE__ */ Ll(this);
},
"~run"(e, t) {
return typeof e.value == "string" ? e.typed = !0 : Fl(this, "type", e, t), e;
}
};
}
/* @__NO_SIDE_EFFECTS__ */
function Xl(e) {
let t;
if (e) for (let n of e) if (t) for (let e of n.issues) t.push(e);
else t = n.issues;
return t;
}
/* @__NO_SIDE_EFFECTS__ */
function Zl(e, t) {
return {
kind: "schema",
type: "union",
reference: Zl,
expects: /* @__PURE__ */ zl(e.map((e) => e.expects), "|"),
async: !1,
options: e,
message: t,
get "~standard"() {
return /* @__PURE__ */ Ll(this);
},
"~run"(e, t) {
let n, r, i;
for (let a of this.options) {
let o = a["~run"]({ value: e.value }, t);
if (o.typed) {
if (o.issues) r ? r.push(o) : r = [o];
else {
n = o;
break;
}
} else i ? i.push(o) : i = [o];
}
if (n) return n;
if (r) {
if (r.length === 1) return r[0];
Fl(this, "type", e, t, { issues: /* @__PURE__ */ Xl(r) }), e.typed = !0;
} else if (i?.length === 1) return i[0];
else Fl(this, "type", e, t, { issues: /* @__PURE__ */ Xl(i) });
return e;
}
};
}
function Ql(e, t, n) {
let r = e["~run"]({ value: t }, /* @__PURE__ */ Dl(n));
if (r.issues) throw new Bl(r.issues);
return r.value;
}
//#endregion
//#region src/types/CatalogConfig.ts
var $l = {
catalog: /* @__PURE__ */ ql(/* @__PURE__ */ Jl(/* @__PURE__ */ Yl(), /* @__PURE__ */ Yl())),
catalogs: /* @__PURE__ */ Hl(/* @__PURE__ */ ql(/* @__PURE__ */ Jl(/* @__PURE__ */ Yl(), /* @__PURE__ */ Jl(/* @__PURE__ */ Yl(), /* @__PURE__ */ Yl()))), void 0)
}, eu = /* @__PURE__ */ Kl({
...$l,
workspaces: /* @__PURE__ */ Hl(/* @__PURE__ */ ql(/* @__PURE__ */ Zl([/* @__PURE__ */ Wl(/* @__PURE__ */ Yl()), /* @__PURE__ */ Gl($l)])), void 0)
}), tu = (e) => Ql(eu, e);
//#endregion
//#region src/lib/pick.ts
function nu(e, t) {
let n = {};
for (let r of t) n[r] = e[r];
return n;
}
function ru(e, t) {
let n = {};
for (let [r, i] of Object.entries(e ?? {})) {
let e = r;
t(i, e) && (n[e] = i);
}
return n;
}
//#endregion
//#region src/lib/resolveDepSections.ts
var iu = {
dev: "devDependencies",
peer: "peerDependencies",
prod: "dependencies",
optional: "optionalDependencies"
}, au = (e) => (e ? typeof e == "string" ? e.split(",") : e : Mi.dep.default).map((e) => iu[e] || e);
//#endregion
//#region src/lib/getPreferredWildcard.ts
function ou(e) {
if (Object.keys(e).length === 0) return null;
let t = Object.values(e).reduce((e, t) => {
let n = Jn.find((e) => t && t.includes(e));
return n !== void 0 && (e[n] ||= [], e[n].push(t)), e;
}, {}), n = Un(Object.entries(t).map(([e, t]) => ({
wildcard: e,
instances: t
})), (e) => -e.instances.length);
return n.length > 0 ? n[0].wildcard : null;
}
//#endregion
//#region src/lib/isUpgradeable.ts
function su(e, t, { downgrade: n } = {}) {
if (!G.default.validRange(e) || nr(e)) return !1;
let [r] = pe.default.parseRange(e);
if (!r) throw Error(`"${e}" could not be parsed by semver-utils. This is probably a bug. Please file an issue at https://github.com/raineorshine/npm-check-updates.`);
let i = Cr(t), a = Qn(r), o = !!G.default.validRange(a), s = !!G.default.valid(i);
return o && s && (!dr(i, a) || !G.default.satisfies(i, r.operator === "<" ? e : a) && (n || !G.default.ltr(i, a)));
}
//#endregion
//#region src/lib/upgradeDependencies.ts
function cu(e, t, n = {}) {
let r = n.target || "latest";
e = bn(e, (e, t) => !!t);
let i = ou(e) || "^", a = (e, t) => jr(e, t, {
wildcard: i,
removeRange: n.removeRange
});
return [
(e) => ru(e, (e, n) => n in t),
(e) => Object.entries(e).reduce((e, [n, r]) => {
let i = t[n], a = null, o = null;
if (Dr(r) && (a = Er(r)[1]), Dr(i) && (o = Er(i)[1]), kr(r)) {
let e = Ar(r), [t] = (0, pe.parseRange)(e);
a = Qn(t);
}
if (kr(i)) {
let e = Ar(i), [t] = (0, pe.parseRange)(e);
o = Qn(t);
}
return e[n] = {
current: r,
currentParsed: a,
latest: i,
latestParsed: o
}, e;
}, {}),
(e) => ru(e, ({ current: e, currentParsed: t, latest: n, latestParsed: i }, a) => {
let o = _r(e) && (typeof r == "string" ? r : r(a, (0, pe.parseRange)(e))).startsWith("@");
return su(t || e, i || n, { downgrade: o });
}),
(e) => Object.entries(e).reduce((e, [t, { current: n, currentParsed: r, latest: i, latestParsed: o }]) => {
let s = a(r || n, o || i);
return e[t] = Dr(n) ? Or(n, s) : kr(n) ? Nr(n, s) : s, e;
}, {})
].reduce((e, t) => t(e), e);
}
//#endregion
//#region node_modules/jsonc-parser/lib/esm/impl/scanner.js
function lu(e, t = !1) {
let n = e.length, r = 0, i = "", a = 0, o = 16, s = 0, c = 0, l = 0, u = 0, d = 0;
function f(t, n) {
let i = 0, a = 0;
for (; i < t || !n;) {
let t = e.charCodeAt(r);
if (t >= 48 && t <= 57) a = a * 16 + t - 48;
else if (t >= 65 && t <= 70) a = a * 16 + t - 65 + 10;
else if (t >= 97 && t <= 102) a = a * 16 + t - 97 + 10;
else break;
r++, i++;
}
return i < t && (a = -1), a;
}
function p(e) {
r = e, i = "", a = 0, o = 16, d = 0;
}
function m() {
let t = r;
if (e.charCodeAt(r) === 48) r++;
else for (r++; r < e.length && fu(e.charCodeAt(r));) r++;
if (r < e.length && e.charCodeAt(r) === 46) {
if (r++, r < e.length && fu(e.charCodeAt(r))) for (r++; r < e.length && fu(e.charCodeAt(r));) r++;
else return d = 3, e.substring(t, r);
}
let n = r;
if (r < e.length && (e.charCodeAt(r) === 69 || e.charCodeAt(r) === 101)) {
if (r++, (r < e.length && e.charCodeAt(r) === 43 || e.charCodeAt(r) === 45) && r++, r < e.length && fu(e.charCodeAt(r))) {
for (r++; r < e.length && fu(e.charCodeAt(r));) r++;
n = r;
} else d = 3;
}
return e.substring(t, n);
}
function h() {
let t = "", i = r;
for (;;) {
if (r >= n) {
t += e.substring(i, r), d = 2;
break;
}
let a = e.charCodeAt(r);
if (a === 34) {
t += e.substring(i, r), r++;
break;
}
if (a === 92) {
if (t += e.substring(i, r), r++, r >= n) {
d = 2;
break;
}
switch (e.charCodeAt(r++)) {
case 34:
t += "\"";
break;
case 92:
t += "\\";
break;
case 47:
t += "/";
break;
case 98:
t += "\b";
break;
case 102:
t += "\f";
break;
case 110:
t += "\n";
break;
case 114:
t += "\r";
break;
case 116:
t += " ";
break;
case 117:
let e = f(4, !0);
e >= 0 ? t += String.fromCharCode(e) : d = 4;
break;
default: d = 5;
}
i = r;
continue;
}
if (a >= 0 && a <= 31) {
if (du(a)) {
t += e.substring(i, r), d = 2;
break;
}
d = 6;
}
r++;
}
return t;
}
function g() {
if (i = "", d = 0, a = r, c = s, u = l, r >= n) return a = n, o = 17;
let t = e.charCodeAt(r);
if (uu(t)) {
do
r++, i += String.fromCharCode(t), t = e.charCodeAt(r);
while (uu(t));
return o = 15;
}
if (du(t)) return r++, i += String.fromCharCode(t), t === 13 && e.charCodeAt(r) === 10 && (r++, i += "\n"), s++, l = r, o = 14;
switch (t) {
case 123: return r++, o = 1;
case 125: return r++, o = 2;
case 91: return r++, o = 3;
case 93: return r++, o = 4;
case 58: return r++, o = 6;
case 44: return r++, o = 5;
case 34: return r++, i = h(), o = 10;
case 47:
let c = r - 1;
if (e.charCodeAt(r + 1) === 47) {
for (r += 2; r < n && !du(e.charCodeAt(r));) r++;
return i = e.substring(c, r), o = 12;
}
if (e.charCodeAt(r + 1) === 42) {
r += 2;
let t = n - 1, a = !1;
for (; r < t;) {
let t = e.charCodeAt(r);
if (t === 42 && e.charCodeAt(r + 1) === 47) {
r += 2, a = !0;
break;
}
r++, du(t) && (t === 13 && e.charCodeAt(r) === 10 && r++, s++, l = r);
}
return a || (r++, d = 1), i = e.substring(c, r), o = 13;
}
return i += String.fromCharCode(t), r++, o = 16;
case 45: if (i += String.fromCharCode(t), r++, r === n || !fu(e.charCodeAt(r))) return o = 16;
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57: return i += m(), o = 11;
default:
for (; r < n && _(t);) r++, t = e.charCodeAt(r);
if (a !== r) {
switch (i = e.substring(a, r), i) {
case "true": return o = 8;
case "false": return o = 9;
case "null": return o = 7;
}
return o = 16;
}
return i += String.fromCharCode(t), r++, o = 16;
}
}
function _(e) {
if (uu(e) || du(e)) return !1;
switch (e) {
case 125:
case 93:
case 123:
case 91:
case 34:
case 58:
case 44:
case 47: return !1;
}
return !0;
}
function v() {
let e;
do
e = g();
while (e >= 12 && e <= 15);
return e;
}
return {
setPosition: p,
getPosition: () => r,
scan: t ? v : g,
getToken: () => o,
getTokenValue: () => i,
getTokenOffset: () => a,
getTokenLength: () => r - a,
getTokenStartLine: () => c,
getTokenStartCharacter: () => a - u,
getTokenError: () => d
};
}
function uu(e) {
return e === 32 || e === 9;
}
function du(e) {
return e === 10 || e === 13;
}
function fu(e) {
return e >= 48 && e <= 57;
}
var pu;
(function(e) {
e[e.lineFeed = 10] = "lineFeed", e[e.carriageReturn = 13] = "carriageReturn", e[e.space = 32] = "space", e[e._0 = 48] = "_0", e[e._1 = 49] = "_1", e[e._2 = 50] = "_2", e[e._3 = 51] = "_3", e[e._4 = 52] = "_4", e[e._5 = 53] = "_5", e[e._6 = 54] = "_6", e[e._7 = 55] = "_7", e[e._8 = 56] = "_8", e[e._9 = 57] = "_9", e[e.a = 97] = "a", e[e.b = 98] = "b", e[e.c = 99] = "c", e[e.d = 100] = "d", e[e.e = 101] = "e", e[e.f = 102] = "f", e[e.g = 103] = "g", e[e.h = 104] = "h", e[e.i = 105] = "i", e[e.j = 106] = "j", e[e.k = 107] = "k", e[e.l = 108] = "l", e[e.m = 109] = "m", e[e.n = 110] = "n", e[e.o = 111] = "o", e[e.p = 112] = "p", e[e.q = 113] = "q", e[e.r = 114] = "r", e[e.s = 115] = "s", e[e.t = 116] = "t", e[e.u = 117] = "u", e[e.v = 118] = "v", e[e.w = 119] = "w", e[e.x = 120] = "x", e[e.y = 121] = "y", e[e.z = 122] = "z", e[e.A = 65] = "A", e[e.B = 66] = "B", e[e.C = 67] = "C", e[e.D = 68] = "D", e[e.E = 69] = "E", e[e.F = 70] = "F", e[e.G = 71] = "G", e[e.H = 72] = "H", e[e.I = 73] = "I", e[e.J = 74] = "J", e[e.K = 75] = "K", e[e.L = 76] = "L", e[e.M = 77] = "M", e[e.N = 78] = "N", e[e.O = 79] = "O", e[e.P = 80] = "P", e[e.Q = 81] = "Q", e[e.R = 82] = "R", e[e.S = 83] = "S", e[e.T = 84] = "T", e[e.U = 85] = "U", e[e.V = 86] = "V", e[e.W = 87] = "W", e[e.X = 88] = "X", e[e.Y = 89] = "Y", e[e.Z = 90] = "Z", e[e.asterisk = 42] = "asterisk", e[e.backslash = 92] = "backslash", e[e.closeBrace = 125] = "closeBrace", e[e.closeBracket = 93] = "closeBracket", e[e.colon = 58] = "colon", e[e.comma = 44] = "comma", e[e.dot = 46] = "dot", e[e.doubleQuote = 34] = "doubleQuote", e[e.minus = 45] = "minus", e[e.openBrace = 123] = "openBrace", e[e.openBracket = 91] = "openBracket", e[e.plus = 43] = "plus", e[e.slash = 47] = "slash", e[e.formFeed = 12] = "formFeed", e[e.tab = 9] = "tab";
})(pu ||= {}), Array(20).fill(0).map((e, t) => " ".repeat(t));
var mu = 200;
Array(mu).fill(0).map((e, t) => "\n" + " ".repeat(t)), Array(mu).fill(0).map((e, t) => "\r" + " ".repeat(t)), Array(mu).fill(0).map((e, t) => "\r\n" + " ".repeat(t)), Array(mu).fill(0).map((e, t) => "\n" + " ".repeat(t)), Array(mu).fill(0).map((e, t) => "\r" + " ".repeat(t)), Array(mu).fill(0).map((e, t) => "\r\n" + " ".repeat(t));
//#endregion
//#region node_modules/jsonc-parser/lib/esm/impl/parser.js
var hu;
(function(e) {
e.DEFAULT = { allowTrailingComma: !1 };
})(hu ||= {});
function gu(e, t = [], n = hu.DEFAULT) {
let r = null, i = [], a = [];
function o(e) {
Array.isArray(i) ? i.push(e) : r !== null && (i[r] = e);
}
return yu(e, {
onObjectBegin: () => {
let e = {};
o(e), a.push(i), i = e, r = null;
},
onObjectProperty: (e) => {
r = e;
},
onObjectEnd: () => {
i = a.pop();
},
onArrayBegin: () => {
let e = [];
o(e), a.push(i), i = e, r = null;
},
onArrayEnd: () => {
i = a.pop();
},
onLiteralValue: o,
onError: (e, n, r) => {
t.push({
error: e,
offset: n,
length: r
});
}
}, n), i[0];
}
function _u(e, t = [], n = hu.DEFAULT) {
let r = {
type: "array",
offset: -1,
length: -1,
children: [],
parent: void 0
};
function i(e) {
r.type === "property" && (r.length = e - r.offset, r = r.parent);
}
function a(e) {
return r.children.push(e), e;
}
yu(e, {
onObjectBegin: (e) => {
r = a({
type: "object",
offset: e,
length: -1,
parent: r,
children: []
});
},
onObjectProperty: (e, t, n) => {
r = a({
type: "property",
offset: t,
length: -1,
parent: r,
children: []
}), r.children.push({
type: "string",
value: e,
offset: t,
length: n,
parent: r
});
},
onObjectEnd: (e, t) => {
i(e + t), r.length = e + t - r.offset, r = r.parent, i(e + t);
},
onArrayBegin: (e, t) => {
r = a({
type: "array",
offset: e,
length: -1,
parent: r,
children: []
});
},
onArrayEnd: (e, t) => {
r.length = e + t - r.offset, r = r.parent, i(e + t);
},
onLiteralValue: (e, t, n) => {
a({
type: xu(e),
offset: t,
length: n,
parent: r,
value: e
}), i(t + n);
},
onSeparator: (e, t, n) => {
r.type === "property" && (e === ":" ? r.colonOffset = t : e === "," && i(t));
},
onError: (e, n, r) => {
t.push({
error: e,
offset: n,
length: r
});
}
}, n);
let o = r.children[0];
return o && delete o.parent, o;
}
function vu(e, t) {
if (!e) return;
let n = e;
for (let e of t) if (typeof e == "string") {
if (n.type !== "object" || !Array.isArray(n.children)) return;
let t = !1;
for (let r of n.children) if (Array.isArray(r.children) && r.children[0].value === e && r.children.length === 2) {
n = r.children[1], t = !0;
break;
}
if (!t) return;
} else {
let t = e;
if (n.type !== "array" || t < 0 || !Array.isArray(n.children) || t >= n.children.length) return;
n = n.children[t];
}
return n;
}
function yu(e, t, n = hu.DEFAULT) {
let r = lu(e, !1), i = [], a = 0;
function o(e) {
return e ? () => a === 0 && e(r.getTokenOffset(), r.getTokenLength(), r.getTokenStartLine(), r.getTokenStartCharacter()) : () => !0;
}
function s(e) {
return e ? (t) => a === 0 && e(t, r.getTokenOffset(), r.getTokenLength(), r.getTokenStartLine(), r.getTokenStartCharacter()) : () => !0;
}
function c(e) {
return e ? (t) => a === 0 && e(t, r.getTokenOffset(), r.getTokenLength(), r.getTokenStartLine(), r.getTokenStartCharacter(), () => i.slice()) : () => !0;
}
function l(e) {
return e ? () => {
a > 0 ? a++ : e(r.getTokenOffset(), r.getTokenLength(), r.getTokenStartLine(), r.getTokenStartCharacter(), () => i.slice()) === !1 && (a = 1);
} : () => !0;
}
function u(e) {
return e ? () => {
a > 0 && a--, a === 0 && e(r.getTokenOffset(), r.getTokenLength(), r.getTokenStartLine(), r.getTokenStartCharacter());
} : () => !0;
}
let d = l(t.onObjectBegin), f = c(t.onObjectProperty), p = u(t.onObjectEnd), m = l(t.onArrayBegin), h = u(t.onArrayEnd), g = c(t.onLiteralValue), _ = s(t.onSeparator), v = o(t.onComment), y = s(t.onError), b = n && n.disallowComments, x = n && n.allowTrailingComma;
function S() {
for (;;) {
let e = r.scan();
switch (r.getTokenError()) {
case 4:
C(14);
break;
case 5:
C(15);
break;
case 3:
C(13);
break;
case 1:
b || C(11);
break;
case 2:
C(12);
break;
case 6: C(16);
}
switch (e) {
case 12:
case 13:
b ? C(10) : v();
break;
case 16:
C(1);
break;
case 15:
case 14: break;
default: return e;
}
}
}
function C(e, t = [], n = []) {
if (y(e), t.length + n.length > 0) {
let e = r.getToken();
for (; e !== 17;) {
if (t.indexOf(e) !== -1) {
S();
break;
}
if (n.indexOf(e) !== -1) break;
e = S();
}
}
}
function w(e) {
let t = r.getTokenValue();
return e ? g(t) : (f(t), i.push(t)), S(), !0;
}
function T() {
switch (r.getToken()) {
case 11:
let e = r.getTokenValue(), t = Number(e);
isNaN(t) && (C(2), t = 0), g(t);
break;
case 7:
g(null);
break;
case 8:
g(!0);
break;
case 9:
g(!1);
break;
default: return !1;
}
return S(), !0;
}
function E() {
return r.getToken() === 10 ? (w(!1), r.getToken() === 6 ? (_(":"), S(), k() || C(4, [], [2, 5])) : C(5, [], [2, 5]), i.pop(), !0) : (C(3, [], [2, 5]), !1);
}
function D() {
d(), S();
let e = !1;
for (; r.getToken() !== 2 && r.getToken() !== 17;) {
if (r.getToken() === 5) {
if (e || C(4, [], []), _(","), S(), r.getToken() === 2 && x) break;
} else e && C(6, [], []);
E() || C(4, [], [2, 5]), e = !0;
}
return p(), r.getToken() === 2 ? S() : C(7, [2], []), !0;
}
function O() {
m(), S();
let e = !0, t = !1;
for (; r.getToken() !== 4 && r.getToken() !== 17;) {
if (r.getToken() === 5) {
if (t || C(4, [], []), _(","), S(), r.getToken() === 4 && x) break;
} else t && C(6, [], []);
e ? (i.push(0), e = !1) : i[i.length - 1]++, k() || C(4, [], [4, 5]), t = !0;
}
return h(), e || i.pop(), r.getToken() === 4 ? S() : C(8, [4], []), !0;
}
function k() {
switch (r.getToken()) {
case 3: return O();
case 1: return D();
case 10: return w(!0);
default: return T();
}
}
return S(), r.getToken() === 17 ? n.allowEmptyContent ? !0 : (C(4, [], []), !1) : k() ? (r.getToken() !== 17 && C(9, [], []), !0) : (C(4, [], []), !1);
}
function bu(e, t) {
let n = lu(e), r = [], i, a = 0, o;
do
switch (o = n.getPosition(), i = n.scan(), i) {
case 12:
case 13:
case 17: a !== o && r.push(e.substring(a, o)), t !== void 0 && r.push(n.getTokenValue().replace(/[^\r\n]/g, t)), a = n.getPosition();
}
while (i !== 17);
return r.join("");
}
function xu(e) {
switch (typeof e) {
case "boolean": return "boolean";
case "number": return "number";
case "string": return "string";
case "object": return e ? Array.isArray(e) ? "array" : "object" : "null";
default: return "null";
}
}
//#endregion
//#region node_modules/jsonc-parser/lib/esm/impl/edit.js
function Su(e, t) {
return e.substring(0, t.offset) + t.content + e.substring(t.offset + t.length);
}
//#endregion
//#region node_modules/jsonc-parser/lib/esm/main.js
var Cu;
(function(e) {
e[e.None = 0] = "None", e[e.UnexpectedEndOfComment = 1] = "UnexpectedEndOfComment", e[e.UnexpectedEndOfString = 2] = "UnexpectedEndOfString", e[e.UnexpectedEndOfNumber = 3] = "UnexpectedEndOfNumber", e[e.InvalidUnicode = 4] = "InvalidUnicode", e[e.InvalidEscapeCharacter = 5] = "InvalidEscapeCharacter", e[e.InvalidCharacter = 6] = "InvalidCharacter";
})(Cu ||= {});
var wu;
(function(e) {
e[e.OpenBraceToken = 1] = "OpenBraceToken", e[e.CloseBraceToken = 2] = "CloseBraceToken", e[e.OpenBracketToken = 3] = "OpenBracketToken", e[e.CloseBracketToken = 4] = "CloseBracketToken", e[e.CommaToken = 5] = "CommaToken", e[e.ColonToken = 6] = "ColonToken", e[e.NullKeyword = 7] = "NullKeyword", e[e.TrueKeyword = 8] = "TrueKeyword", e[e.FalseKeyword = 9] = "FalseKeyword", e[e.StringLiteral = 10] = "StringLiteral", e[e.NumericLiteral = 11] = "NumericLiteral", e[e.LineCommentTrivia = 12] = "LineCommentTrivia", e[e.BlockCommentTrivia = 13] = "BlockCommentTrivia", e[e.LineBreakTrivia = 14] = "LineBreakTrivia", e[e.Trivia = 15] = "Trivia", e[e.Unknown = 16] = "Unknown", e[e.EOF = 17] = "EOF";
})(wu ||= {});
var Tu = gu, Eu = _u, Du = vu, Ou = bu, ku;
(function(e) {
e[e.InvalidSymbol = 1] = "InvalidSymbol", e[e.InvalidNumberFormat = 2] = "InvalidNumberFormat", e[e.PropertyNameExpected = 3] = "PropertyNameExpected", e[e.ValueExpected = 4] = "ValueExpected", e[e.ColonExpected = 5] = "ColonExpected", e[e.CommaExpected = 6] = "CommaExpected", e[e.CloseBraceExpected = 7] = "CloseBraceExpected", e[e.CloseBracketExpected = 8] = "CloseBracketExpected", e[e.EndOfFileExpected = 9] = "EndOfFileExpected", e[e.InvalidCommentToken = 10] = "InvalidCommentToken", e[e.UnexpectedEndOfComment = 11] = "UnexpectedEndOfComment", e[e.UnexpectedEndOfString = 12] = "UnexpectedEndOfString", e[e.UnexpectedEndOfNumber = 13] = "UnexpectedEndOfNumber", e[e.InvalidUnicode = 14] = "InvalidUnicode", e[e.InvalidEscapeCharacter = 15] = "InvalidEscapeCharacter", e[e.InvalidCharacter = 16] = "InvalidCharacter";
})(ku ||= {});
function Au(e) {
switch (e) {
case 1: return "InvalidSymbol";
case 2: return "InvalidNumberFormat";
case 3: return "PropertyNameExpected";
case 4: return "ValueExpected";
case 5: return "ColonExpected";
case 6: return "CommaExpected";
case 7: return "CloseBraceExpected";
case 8: return "CloseBracketExpected";
case 9: return "EndOfFileExpected";
case 10: return "InvalidCommentToken";
case 11: return "UnexpectedEndOfComment";
case 12: return "UnexpectedEndOfString";
case 13: return "UnexpectedEndOfNumber";
case 14: return "InvalidUnicode";
case 15: return "InvalidEscapeCharacter";
case 16: return "InvalidCharacter";
}
return "<unknown ParseErrorCode>";
}
function ju(e, t) {
let n = t.slice(0).sort((e, t) => {
let n = e.offset - t.offset;
return n === 0 ? e.length - t.length : n;
}), r = e.length;
for (let t = n.length - 1; t >= 0; t--) {
let i = n[t];
if (i.offset + i.length <= r) e = Su(e, i);
else throw Error("Overlapping edit");
r = i.offset;
}
return e;
}
//#endregion
//#region src/lib/utils/applyJsonValueEdits.ts
function Mu(e, t) {
let n = Eu(e);
if (!n) return e;
let r = [];
for (let { path: e, value: i } of t) {
let t = Du(n, e);
t && r.push({
offset: t.offset,
length: t.length,
content: JSON.stringify(i)
});
}
return ju(e, r);
}
//#endregion
//#region src/lib/utils/collectVersionEdits.ts
function Nu(e, t, n, r) {
if (!e || typeof e != "object" || Array.isArray(e)) return [];
let i = [];
for (let [a, o] of Object.entries(e)) a in r && (typeof o == "string" && o === n[a] ? i.push({
path: [...t, a],
value: r[a]
}) : o && typeof o == "object" && !Array.isArray(o) && o["."] === n[a] && i.push({
path: [
...t,
a,
"."
],
value: r[a]
})), i.push(...Nu(o, [...t, a], n, r));
return i;
}
//#endregion
//#region src/lib/utils/parseJson.ts
var Pu = process.stdout.columns || 80;
function Fu(e) {
return `${e.length ? e.slice(0, Math.min(e.length, Pu)) : "<empty>"}\n`;
}
function Iu(e) {
return e > Pu ? "" : `${" ".repeat(e - 1)}^\n`;
}
function Lu(e, t, n) {
let r = e.length;
if (r === 0) return "<empty>";
if (r === 1) return `${Fu(e[0])}${Iu(n)}`;
let i = Math.min(t + 2, r), a = "";
for (let r = Math.max(t - 2, 1); r <= i; r++) a += Fu(e[r - 1]), r === t && (a += Iu(n));
return `${a}\n`;
}
function Ru(e) {
e = Ou(e);
try {
return JSON.parse(e);
} catch {
let t = [], n = Tu(e, t);
if (t.length === 0) return n;
let r = "", i = e.split("\n");
for (let e of t) {
let t = e.offset, n = 1, a = 1, o = 0;
for (let e of i) {
if (o + e.length >= t) {
a = t - o + 1;
break;
}
o += e.length + 1, n++;
}
r += `Error at line ${n}, column ${a}: ${Au(e.error)}\n${Lu(i, n, a)}\n`;
}
throw SyntaxError(r);
}
}
//#endregion
//#region src/lib/upgradeJsonCatalogDependencies.ts
async function zu(e, t, n) {
let r = await s.readFile(e, "utf-8");
return Mu(r, Nu(Ru(r), [], t, n));
}
//#endregion
//#region src/lib/upgradeYamlCatalogDependencies.ts
function Bu(e, { options: t, filePath: n }) {
let r = e instanceof Error ? e.message : String(e), i = `Invalid YAML syntax${n ? ` in ${n}` : ""}. Unable to read catalog dependencies.\n${r}`;
throw t && $(t, i), Error(i);
}
function Vu(e, t, { newName: n, newValue: r }) {
let i = t.slice(0, -1), a = t.at(-1), o = e.getIn(i);
if (!o || !(0, vc.isCollection)(o)) return !1;
let s = o.items.find((e) => (0, vc.isPair)(e) && (0, vc.isScalar)(e.key) && e.key.value === a);
if (!s || !(0, vc.isPair)(s)) return !1;
if (n && vc.CST.setScalarValue(s.srcToken.key, n), r) {
if (!vc.CST.isScalar(s.srcToken?.value)) return !1;
vc.CST.setScalarValue(s.srcToken.value, r);
}
return !0;
}
function Hu({ fileContent: e, upgrade: t, options: n, filePath: r }) {
let { path: i } = t;
if (i.length < 2 || i[0] !== "catalog" && i[0] !== "catalogs" && i[0] !== "workspaces") return null;
let { newValue: a } = t, o, s, c;
try {
o = [...new vc.Parser().parse(e)], s = [...new vc.Composer({ keepSourceTokens: !0 }).compose(o)][0];
} catch (e) {
Bu(e, {
options: n,
filePath: r
});
}
s || Bu(/* @__PURE__ */ Error("No YAML document found."), {
options: n,
filePath: r
}), s.errors.length > 0 && Bu(s.errors[0], {
options: n,
filePath: r
});
try {
c = tu(s.toJSON());
} catch {
return null;
}
let l = c.workspaces && !Array.isArray(c.workspaces) ? c.workspaces : void 0;
return (i[0] === "catalog" ? c.catalog?.[i[1]] : i[0] === "catalogs" ? c.catalogs?.[i[1]]?.[i[2]] : i[0] === "workspaces" && i[1] === "catalog" ? l?.catalog?.[i[2]] : i[0] === "workspaces" && i[1] === "catalogs" ? l?.catalogs?.[i[2]]?.[i[3]] : void 0) === a ? e : Vu(s, i, {
newValue: a,
newName: t.path.at(-1)
}) ? o.map((e) => vc.CST.stringify(e)).join("") : null;
}
//#endregion
//#region src/lib/upgradePackageData.ts
function Uu(e, t, n, r, i, a) {
let o = Ru(e), s = (e) => {
let t = o?.[e];
if (!(a && e !== "overrides" && e !== "packageManager" && t && typeof t == "object" && !Array.isArray(t) && Object.values(t).every((e) => typeof e == "string"))) return [n, r];
let s = t;
return [s, ru(cu(s, a, i), (e, t) => t in r)];
}, c = [];
for (let e of t) {
let t = o?.[e];
if (!t || typeof t != "object" || Array.isArray(t)) continue;
let [n, r] = s(e);
c.push(...Nu(t, [e], n, r));
}
return Mu(e, c);
}
async function Wu(e, t, n, r, i, a) {
if (i) {
let a = o.basename(i), c = o.extname(i);
if (i.includes("#catalog")) {
let e = i.replace("#catalog", "");
if (o.extname(e) === ".json") return zu(e, t, n);
}
if (a === "pnpm-workspace.yaml" || a === ".yarnrc.yml") {
let e = await s.readFile(i, "utf-8"), t = tu((0, vc.parseDocument)(e).toJSON()), a = [];
if (t.catalogs) for (let [e, r] of Object.entries(t.catalogs)) for (let [t, i] of Object.entries(n)) r[t] && a.push({
path: [
"catalogs",
e,
t
],
newValue: i
});
if (t.catalog) for (let [e, r] of Object.entries(n)) t.catalog?.[e] && a.push({
path: ["catalog", e],
newValue: r
});
let o = t.workspaces;
if (o && !Array.isArray(o)) {
if (o.catalogs) for (let [e, t] of Object.entries(o.catalogs)) for (let [r, i] of Object.entries(n)) t[r] && a.push({
path: [
"workspaces",
"catalogs",
e,
r
],
newValue: i
});
if (o.catalog) for (let [e, t] of Object.entries(n)) o.catalog?.[e] && a.push({
path: [
"workspaces",
"catalog",
e
],
newValue: t
});
}
let c = e;
for (let e of a) {
let t = Hu({
fileContent: c,
upgrade: e,
options: r,
filePath: i
});
t && (c = t);
}
return c;
}
if (c === ".json") {
let r = JSON.parse(e), a = r.catalog || r.catalogs, o = r.workspaces && !Array.isArray(r.workspaces) && (r.workspaces.catalog || r.workspaces.catalogs);
if (a || o) return zu(i, t, n);
}
}
let c = [...au(r.dep), "overrides"], l = Uu(e, c, t, n, r, a);
if (c.includes("packageManager")) {
let t = Ru(e);
if (t.packageManager) {
let [e] = t.packageManager.split("@");
n[e] && (l = Mu(l, [{
path: ["packageManager"],
value: `${e}@${n[e]}`
}]));
}
}
return l;
}
//#endregion
//#region src/lib/doctor.ts
var Gu = /* @__PURE__ */ new Set([
"yarn",
"pnpm",
"bun"
]), Ku = (e, t, n, { spawnOptions: r, spawnPleaseOptions: i } = {}) => {
n && console.log(Y.blue([t.packageManager, ...e].join(" ")));
let a = {
cwd: t.cwd || process.cwd(),
env: {
...process.env,
...t.packageManager === "pnpm" ? null : { CI: "1" },
...t.color !== !1 && !process.env.NO_COLOR ? { FORCE_COLOR: "1" } : null,
...r?.env
},
...r
}, o = {
...t.global ? { global: !0 } : null,
...t.prefix ? { prefix: t.prefix } : null
};
return (t.packageManager === "pnpm" ? Vc : t.packageManager === "yarn" ? cl : t.packageManager === "bun" ? Yo : Fo)(e, o, i, a);
}, qu = async (e) => {
(e.packageData || e.packageFile) && (console.error("--packageData and --packageFile are not allowed with --doctor. You must execute \"ncu --doctor\" in a directory with a package file so it can install dependencies and test them."), process.exit(1));
let t;
try {
t = await wl(e, "package.json");
} catch {
console.error("Missing or invalid package.json"), process.exit(1);
}
return !e.doctorTest && !t.pkg.scripts?.test && (console.error("No npm \"test\" script defined. You must define a \"test\" script in the \"scripts\" section of your package.json to use --doctor."), process.exit(1)), t;
}, Ju = async (e, t) => {
vn(t.color);
let n = {
packageManager: t.packageManager,
color: t.color
}, r = t.packageManager === "yarn" ? "yarn.lock" : t.packageManager === "pnpm" ? "pnpm-lock.yaml" : t.packageManager === "bun" ? "bun.lock" : "package-lock.json", { pkg: i, pkgFile: a } = await qu(t), o = {
...i.dependencies,
...i.devDependencies,
...i.optionalDependencies
}, c = async () => {
if (t.doctorInstall) {
let [e, ...n] = t.doctorInstall.split(" ");
console.log(Y.blue(t.doctorInstall)), await (0, ea.default)(e, n);
} else await Ku(["install"], n, !0);
}, l = async () => {
let e = {
stderr: (e) => {
console.error(Y.red(e.toString()));
},
stdout: (e) => {
process.stdout.write(e.toString());
}
};
if (t.doctorTest) {
let n = t.doctorTest.matchAll(/"(.+?)"|'(.+?)'|[^ ]+/g), r = [];
for (let e of n) r = [...r, e[2] || e[1] || e[0]];
let [i, ...a] = r;
console.log(Y.blue(t.doctorTest)), await (0, ea.default)(i, a, e);
} else await Ku(["run", "test"], n, !0, { spawnPleaseOptions: e });
};
console.log("Running tests before upgrading"), await c();
let u = "";
try {
u = await s.readFile(r, "utf-8");
} catch {
if (t.packageManager === "bun") {
r = "bun.lockb";
try {
u = await s.readFile(r, "utf-8");
} catch {}
}
}
try {
await l();
} catch {
console.error("Tests failed before we even got started!"), process.exit(1);
}
t.interactive || console.log("Upgrading all dependencies and re-running tests"), console.log(Y.blue("ncu " + process.argv.slice(2).filter((e) => e !== "--doctor").join(" "))), process.env.NCU_DOCTOR = "1";
let d = await e({
...t,
silent: !0,
doctor: !1,
errorLevel: 1
});
if (Object.keys(d || {}).length === 0) {
console.log("All dependencies are up-to-date " + Y.green.bold(":)"));
return;
}
let f = !1;
try {
await c(), f = !0, await l(), console.log(`${Y.green("✓")} Tests pass`), await qr(t, {
current: o,
upgraded: d,
total: Object.keys(d || {}).length
}), console.log(`\n${t.interactive ? "Chosen" : "All"} dependencies upgraded and installed ${Y.green(":)")}`);
} catch {
console.error(Y.red(f ? "Tests failed" : "Install failed")), console.log("Identifying broken dependencies"), await s.writeFile("package.json", a), u ? await s.writeFile(r, u) : await s.rm(r, {
recursive: !0,
force: !0
});
let e = a;
if (f) try {
await c();
} catch (e) {
let n = (t.packageManager || "npm") + " install";
throw Error(`Error: Doctor mode was about to test individual upgrades, but ${Y.cyan(n)} failed after rolling back to your existing package and lock files. This is unexpected since the initial install before any upgrades succeeded. Either npm failed to revert a partial install, or failed anomalously on the second run. Please check your internet connection and retry. If doctor mode fails consistently, report a bug with your complete list of dependency versions at https://github.com/raineorshine/npm-check-updates/issues.`, { cause: e });
}
let p, m;
for ([p, m] of Object.entries(d)) try {
if (await Ku([...Gu.has(t.packageManager ?? "") ? ["add"] : ["install", "--no-save"], `${p}@${m}`], n, !0), i.scripts?.prepare) try {
await Ku(["run", "prepare"], n, !0);
} catch (e) {
throw console.error(Y.red("Prepare script failed")), e;
}
await l(), console.log(` ${Y.green("✓")} ${p} ${o[p]} → ${m}`), e = await Wu(e, { [p]: o[p] }, { [p]: m }, t), u = await s.readFile(r, "utf-8");
} catch (n) {
console.error(` ${Y.red("✗")} ${p} ${o[p]} → ${m}\n`), console.error(Y.red(n)), await s.writeFile(r, u), Gu.has(t.packageManager ?? "") && await s.writeFile("package.json", e);
}
e !== a && (console.log("Saving partially upgraded package.json"), await s.writeFile("package.json", e)), await c();
}
};
//#endregion
//#region src/lib/findPackage.ts
async function Yu(e) {
let t, n = null, r = e.packageFile || "package.json";
async function i(t, n) {
if (t != null) {
let n = o.resolve(t);
X(e, `${e.upgrade ? "Upgrading" : "Checking"} ${n}`);
} else $(e, `${Y.red(`No ${n}`)}\n\nPlease add a ${n} to the current directory, specify the ${Y.cyan("--packageFile")} or ${Y.cyan("--packageData")} options, or pipe a ${n} to stdin and specify ${Y.cyan("--stdin")}.`, { color: !1 });
try {
return await s.readFile(t, "utf-8");
} catch (t) {
$(e, t);
}
}
if (X(e, "Running in local mode", "verbose"), X(e, "Finding package file data", "verbose"), e.packageData) n = null, t = Promise.resolve(e.packageData);
else if (e.packageFile) n = e.packageFile, t = i(n, r);
else if (e.stdin) {
X(e, "Waiting for package data on stdin", "verbose");
let a = await x(process.stdin), o = a.trim().length > 0 ? a : null;
n = o || !r ? null : await to(r), t = o || i(n, r);
} else {
let a = e.cwd || process.cwd();
n = r ? !e.packageFile && e.packageManager === "deno" && await to(["deno.json", "deno.jsonc"], { cwd: a }) || await to(r, { cwd: a }) : null, t = i(n, r);
}
return {
pkgData: await t,
pkgFile: n || null,
pkgPath: r
};
}
//#endregion
//#region node_modules/fast-glob/out/utils/array.js
var Xu = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.splitWhen = e.flatten = void 0;
function t(e) {
return e.reduce((e, t) => [].concat(e, t), []);
}
e.flatten = t;
function n(e, t) {
let n = [[]], r = 0;
for (let i of e) t(i) ? (r++, n[r] = []) : n[r].push(i);
return n;
}
e.splitWhen = n;
})), Zu = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.isEnoentCodeError = void 0;
function t(e) {
return e.code === "ENOENT";
}
e.isEnoentCodeError = t;
})), Qu = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.createDirentFromStats = void 0;
var t = class {
constructor(e, t) {
this.name = e, this.isBlockDevice = t.isBlockDevice.bind(t), this.isCharacterDevice = t.isCharacterDevice.bind(t), this.isDirectory = t.isDirectory.bind(t), this.isFIFO = t.isFIFO.bind(t), this.isFile = t.isFile.bind(t), this.isSocket = t.isSocket.bind(t), this.isSymbolicLink = t.isSymbolicLink.bind(t);
}
};
function n(e, n) {
return new t(e, n);
}
e.createDirentFromStats = n;
})), $u = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 }), t.convertPosixPathToPattern = t.convertWindowsPathToPattern = t.convertPathToPattern = t.escapePosixPath = t.escapeWindowsPath = t.escape = t.removeLeadingDotSegment = t.makeAbsolute = t.unixify = void 0;
var n = e("os"), r = e("path"), i = n.platform() === "win32", a = 2, o = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g, s = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g, c = /^\\\\([.?])/, l = /\\(?![!()+@[\]{}])/g;
function u(e) {
return e.replace(/\\/g, "/");
}
t.unixify = u;
function d(e, t) {
return r.resolve(e, t);
}
t.makeAbsolute = d;
function f(e) {
if (e.charAt(0) === ".") {
let t = e.charAt(1);
if (t === "/" || t === "\\") return e.slice(a);
}
return e;
}
t.removeLeadingDotSegment = f, t.escape = i ? p : m;
function p(e) {
return e.replace(s, "\\$2");
}
t.escapeWindowsPath = p;
function m(e) {
return e.replace(o, "\\$2");
}
t.escapePosixPath = m, t.convertPathToPattern = i ? h : g;
function h(e) {
return p(e).replace(c, "//$1").replace(l, "/");
}
t.convertWindowsPathToPattern = h;
function g(e) {
return m(e);
}
t.convertPosixPathToPattern = g;
})), ed = /* @__PURE__ */ i(((e, t) => {
t.exports = function(e) {
if (typeof e != "string" || e === "") return !1;
for (var t; t = /(\\).|([@?!+*]\(.*\))/g.exec(e);) {
if (t[2]) return !0;
e = e.slice(t.index + t[0].length);
}
return !1;
};
})), td = /* @__PURE__ */ i(((e, t) => {
var n = ed(), r = {
"{": "}",
"(": ")",
"[": "]"
}, i = function(e) {
if (e[0] === "!") return !0;
for (var t = 0, n = -2, i = -2, a = -2, o = -2, s = -2; t < e.length;) {
if (e[t] === "*" || e[t + 1] === "?" && /[\].+)]/.test(e[t]) || i !== -1 && e[t] === "[" && e[t + 1] !== "]" && (i < t && (i = e.indexOf("]", t)), i > t && (s === -1 || s > i || (s = e.indexOf("\\", t), s === -1 || s > i))) || a !== -1 && e[t] === "{" && e[t + 1] !== "}" && (a = e.indexOf("}", t), a > t && (s = e.indexOf("\\", t), s === -1 || s > a)) || o !== -1 && e[t] === "(" && e[t + 1] === "?" && /[:!=]/.test(e[t + 2]) && e[t + 3] !== ")" && (o = e.indexOf(")", t), o > t && (s = e.indexOf("\\", t), s === -1 || s > o)) || n !== -1 && e[t] === "(" && e[t + 1] !== "|" && (n < t && (n = e.indexOf("|", t)), n !== -1 && e[n + 1] !== ")" && (o = e.indexOf(")", n), o > n && (s = e.indexOf("\\", n), s === -1 || s > o)))) return !0;
if (e[t] === "\\") {
var c = e[t + 1];
t += 2;
var l = r[c];
if (l) {
var u = e.indexOf(l, t);
u !== -1 && (t = u + 1);
}
if (e[t] === "!") return !0;
} else t++;
}
return !1;
}, a = function(e) {
if (e[0] === "!") return !0;
for (var t = 0; t < e.length;) {
if (/[*?{}()[\]]/.test(e[t])) return !0;
if (e[t] === "\\") {
var n = e[t + 1];
t += 2;
var i = r[n];
if (i) {
var a = e.indexOf(i, t);
a !== -1 && (t = a + 1);
}
if (e[t] === "!") return !0;
} else t++;
}
return !1;
};
t.exports = function(e, t) {
if (typeof e != "string" || e === "") return !1;
if (n(e)) return !0;
var r = i;
return t && t.strict === !1 && (r = a), r(e);
};
})), nd = /* @__PURE__ */ i(((t, n) => {
var r = td(), i = e("path").posix.dirname, a = e("os").platform() === "win32", o = "/", s = /\\/g, c = /[\{\[].*[\}\]]$/, l = /(^|[^\\])([\{\[]|\([^\)]+$)/, u = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
n.exports = function(e, t) {
Object.assign({ flipBackslashes: !0 }, t).flipBackslashes && a && e.indexOf(o) < 0 && (e = e.replace(s, o)), c.test(e) && (e += o), e += "a";
do
e = i(e);
while (r(e) || l.test(e));
return e.replace(u, "$1");
};
})), rd = /* @__PURE__ */ i(((e) => {
e.isInteger = (e) => typeof e == "number" ? Number.isInteger(e) : typeof e == "string" && e.trim() !== "" && Number.isInteger(Number(e)), e.find = (e, t) => e.nodes.find((e) => e.type === t), e.exceedsLimit = (t, n, r = 1, i) => i === !1 || !e.isInteger(t) || !e.isInteger(n) ? !1 : (Number(n) - Number(t)) / Number(r) >= i, e.escapeNode = (e, t = 0, n) => {
let r = e.nodes[t];
r && (n && r.type === n || r.type === "open" || r.type === "close") && r.escaped !== !0 && (r.value = "\\" + r.value, r.escaped = !0);
}, e.encloseBrace = (e) => e.type === "brace" ? e.commas >> 0 + e.ranges >> 0 ? !1 : (e.invalid = !0, !0) : !1, e.isInvalidBrace = (e) => e.type === "brace" ? e.invalid === !0 || e.dollar ? !0 : !(e.commas >> 0 + e.ranges >> 0) || e.open !== !0 || e.close !== !0 ? (e.invalid = !0, !0) : !1 : !1, e.isOpenOrClose = (e) => e.type === "open" || e.type === "close" || e.open === !0 || e.close === !0, e.reduce = (e) => e.reduce((e, t) => (t.type === "text" && e.push(t.value), t.type === "range" && (t.type = "text"), e), []), e.flatten = (...e) => {
let t = [], n = (e) => {
for (let r = 0; r < e.length; r++) {
let i = e[r];
if (Array.isArray(i)) {
n(i);
continue;
}
i !== void 0 && t.push(i);
}
return t;
};
return n(e), t;
};
})), id = /* @__PURE__ */ i(((e, t) => {
var n = rd();
t.exports = (e, t = {}) => {
let r = (e, i = {}) => {
let a = t.escapeInvalid && n.isInvalidBrace(i), o = e.invalid === !0 && t.escapeInvalid === !0, s = "";
if (e.value) return (a || o) && n.isOpenOrClose(e) ? "\\" + e.value : e.value;
if (e.value) return e.value;
if (e.nodes) for (let t of e.nodes) s += r(t);
return s;
};
return r(e);
};
})), ad = /* @__PURE__ */ i(((e, t) => {
t.exports = function(e) {
return typeof e == "number" ? e - e === 0 : typeof e == "string" && e.trim() !== "" ? Number.isFinite ? Number.isFinite(+e) : isFinite(+e) : !1;
};
})), od = /* @__PURE__ */ i(((e, t) => {
var n = ad(), r = (e, t, a) => {
if (n(e) === !1) throw TypeError("toRegexRange: expected the first argument to be a number");
if (t === void 0 || e === t) return String(e);
if (n(t) === !1) throw TypeError("toRegexRange: expected the second argument to be a number.");
let o = {
relaxZeros: !0,
...a
};
typeof o.strictZeros == "boolean" && (o.relaxZeros = o.strictZeros === !1);
let c = String(o.relaxZeros), l = String(o.shorthand), u = String(o.capture), d = String(o.wrap), f = e + ":" + t + "=" + c + l + u + d;
if (r.cache.hasOwnProperty(f)) return r.cache[f].result;
let p = Math.min(e, t), m = Math.max(e, t);
if (Math.abs(p - m) === 1) {
let n = e + "|" + t;
return o.capture ? `(${n})` : o.wrap === !1 ? n : `(?:${n})`;
}
let h = g(e) || g(t), _ = {
min: e,
max: t,
a: p,
b: m
}, v = [], y = [];
return h && (_.isPadded = h, _.maxLen = String(_.max).length), p < 0 && (y = s(m < 0 ? Math.abs(m) : 1, Math.abs(p), _, o), p = _.a = 0), m >= 0 && (v = s(p, m, _, o)), _.negatives = y, _.positives = v, _.result = i(y, v, o), o.capture === !0 ? _.result = `(${_.result})` : o.wrap !== !1 && v.length + y.length > 1 && (_.result = `(?:${_.result})`), r.cache[f] = _, _.result;
};
function i(e, t, n) {
let r = c(e, t, "-", !1, n) || [], i = c(t, e, "", !1, n) || [], a = c(e, t, "-?", !0, n) || [];
return r.concat(a).concat(i).join("|");
}
function a(e, t) {
let n = 1, r = 1, i = f(e, n), a = /* @__PURE__ */ new Set([t]);
for (; e <= i && i <= t;) a.add(i), n += 1, i = f(e, n);
for (i = p(t + 1, r) - 1; e < i && i <= t;) a.add(i), r += 1, i = p(t + 1, r) - 1;
return a = [...a], a.sort(u), a;
}
function o(e, t, n) {
if (e === t) return {
pattern: e,
count: [],
digits: 0
};
let r = l(e, t), i = r.length, a = "", o = 0;
for (let e = 0; e < i; e++) {
let [t, i] = r[e];
t === i ? a += t : t !== "0" || i !== "9" ? a += h(t, i, n) : o++;
}
return o && (a += n.shorthand === !0 ? "\\d" : "[0-9]"), {
pattern: a,
count: [o],
digits: i
};
}
function s(e, t, n, r) {
let i = a(e, t), s = [], c = e, l;
for (let e = 0; e < i.length; e++) {
let t = i[e], a = o(String(c), String(t), r), u = "";
if (!n.isPadded && l && l.pattern === a.pattern) {
l.count.length > 1 && l.count.pop(), l.count.push(a.count[0]), l.string = l.pattern + m(l.count), c = t + 1;
continue;
}
n.isPadded && (u = _(t, n, r)), a.string = u + a.pattern + m(a.count), s.push(a), c = t + 1, l = a;
}
return s;
}
function c(e, t, n, r, i) {
let a = [];
for (let i of e) {
let { string: e } = i;
!r && !d(t, "string", e) && a.push(n + e), r && d(t, "string", e) && a.push(n + e);
}
return a;
}
function l(e, t) {
let n = [];
for (let r = 0; r < e.length; r++) n.push([e[r], t[r]]);
return n;
}
function u(e, t) {
return e > t ? 1 : t > e ? -1 : 0;
}
function d(e, t, n) {
return e.some((e) => e[t] === n);
}
function f(e, t) {
return Number(String(e).slice(0, -t) + "9".repeat(t));
}
function p(e, t) {
return e - e % 10 ** t;
}
function m(e) {
let [t = 0, n = ""] = e;
return n || t > 1 ? `{${t + (n ? "," + n : "")}}` : "";
}
function h(e, t, n) {
return `[${e}${t - e === 1 ? "" : "-"}${t}]`;
}
function g(e) {
return /^-?(0+)\d/.test(e);
}
function _(e, t, n) {
if (!t.isPadded) return e;
let r = Math.abs(t.maxLen - String(e).length), i = n.relaxZeros !== !1;
switch (r) {
case 0: return "";
case 1: return i ? "0?" : "0";
case 2: return i ? "0{0,2}" : "00";
default: return i ? `0{0,${r}}` : `0{${r}}`;
}
}
r.cache = {}, r.clearCache = () => r.cache = {}, t.exports = r;
})), sd = /* @__PURE__ */ i(((t, n) => {
var r = e("util"), i = od(), a = (e) => typeof e == "object" && !!e && !Array.isArray(e), o = (e) => (t) => e === !0 ? Number(t) : String(t), s = (e) => typeof e == "number" || typeof e == "string" && e !== "", c = (e) => Number.isInteger(+e), l = (e) => {
let t = `${e}`, n = -1;
if (t[0] === "-" && (t = t.slice(1)), t === "0") return !1;
for (; t[++n] === "0";);
return n > 0;
}, u = (e, t, n) => typeof e == "string" || typeof t == "string" || n.stringify === !0, d = (e, t, n) => {
if (t > 0) {
let n = e[0] === "-" ? "-" : "";
n && (e = e.slice(1)), e = n + e.padStart(n ? t - 1 : t, "0");
}
return n === !1 ? String(e) : e;
}, f = (e, t) => {
let n = e[0] === "-" ? "-" : "";
for (n && (e = e.slice(1), t--); e.length < t;) e = "0" + e;
return n ? "-" + e : e;
}, p = (e, t, n) => {
e.negatives.sort((e, t) => e < t ? -1 : +(e > t)), e.positives.sort((e, t) => e < t ? -1 : +(e > t));
let r = t.capture ? "" : "?:", i = "", a = "", o;
return e.positives.length && (i = e.positives.map((e) => f(String(e), n)).join("|")), e.negatives.length && (a = `-(${r}${e.negatives.map((e) => f(String(e), n)).join("|")})`), o = i && a ? `${i}|${a}` : i || a, t.wrap ? `(${r}${o})` : o;
}, m = (e, t, n, r) => {
if (n) return i(e, t, {
wrap: !1,
...r
});
let a = String.fromCharCode(e);
return e === t ? a : `[${a}-${String.fromCharCode(t)}]`;
}, h = (e, t, n) => {
if (Array.isArray(e)) {
let t = n.wrap === !0, r = n.capture ? "" : "?:";
return t ? `(${r}${e.join("|")})` : e.join("|");
}
return i(e, t, n);
}, g = (...e) => /* @__PURE__ */ RangeError("Invalid range arguments: " + r.inspect(...e)), _ = (e, t, n) => {
if (n.strictRanges === !0) throw g([e, t]);
return [];
}, v = (e, t) => {
if (t.strictRanges === !0) throw TypeError(`Expected step "${e}" to be a number`);
return [];
}, y = (e, t, n = 1, r = {}) => {
let i = Number(e), a = Number(t);
if (!Number.isInteger(i) || !Number.isInteger(a)) {
if (r.strictRanges === !0) throw g([e, t]);
return [];
}
i === 0 && (i = 0), a === 0 && (a = 0);
let s = i > a, c = String(e), _ = String(t), v = String(n);
n = Math.max(Math.abs(n), 1);
let y = l(c) || l(_) || l(v), b = y ? Math.max(c.length, _.length, v.length) : 0, x = y === !1 && u(e, t, r) === !1, S = r.transform || o(x);
if (r.toRegex && n === 1) return m(f(e, b), f(t, b), !0, r);
let C = {
negatives: [],
positives: []
}, w = (e) => C[e < 0 ? "negatives" : "positives"].push(Math.abs(e)), T = [], E = 0;
for (; s ? i >= a : i <= a;) r.toRegex === !0 && n > 1 ? w(i) : T.push(d(S(i, E), b, x)), i = s ? i - n : i + n, E++;
return r.toRegex === !0 ? n > 1 ? p(C, r, b) : h(T, null, {
wrap: !1,
...r
}) : T;
}, b = (e, t, n = 1, r = {}) => {
if (!c(e) && e.length > 1 || !c(t) && t.length > 1) return _(e, t, r);
let i = r.transform || ((e) => String.fromCharCode(e)), a = `${e}`.charCodeAt(0), o = `${t}`.charCodeAt(0), s = a > o, l = Math.min(a, o), u = Math.max(a, o);
if (r.toRegex && n === 1) return m(l, u, !1, r);
let d = [], f = 0;
for (; s ? a >= o : a <= o;) d.push(i(a, f)), a = s ? a - n : a + n, f++;
return r.toRegex === !0 ? h(d, null, {
wrap: !1,
options: r
}) : d;
}, x = (e, t, n, r = {}) => {
if (t == null && s(e)) return [e];
if (!s(e) || !s(t)) return _(e, t, r);
if (typeof n == "function") return x(e, t, 1, { transform: n });
if (a(n)) return x(e, t, 0, n);
let i = { ...r };
return i.capture === !0 && (i.wrap = !0), n = n || i.step || 1, c(n) ? c(e) && c(t) ? y(e, t, n, i) : b(e, t, Math.max(Math.abs(n), 1), i) : n != null && !a(n) ? v(n, i) : x(e, t, 1, n);
};
n.exports = x;
})), cd = /* @__PURE__ */ i(((e, t) => {
var n = sd(), r = rd();
t.exports = (e, t = {}) => {
let i = (e, a = {}) => {
let o = r.isInvalidBrace(a), s = e.invalid === !0 && t.escapeInvalid === !0, c = o === !0 || s === !0, l = t.escapeInvalid === !0 ? "\\" : "", u = "";
if (e.isOpen === !0) return l + e.value;
if (e.isClose === !0) return console.log("node.isClose", l, e.value), l + e.value;
if (e.type === "open") return c ? l + e.value : "(";
if (e.type === "close") return c ? l + e.value : ")";
if (e.type === "comma") return e.prev.type === "comma" ? "" : c ? e.value : "|";
if (e.value) return e.value;
if (e.nodes && e.ranges > 0) {
let i = r.reduce(e.nodes), a = n(...i, {
...t,
wrap: !1,
toRegex: !0,
strictZeros: !0
});
if (a.length !== 0) return i.length > 1 && a.length > 1 ? `(${a})` : a;
}
if (e.nodes) for (let t of e.nodes) u += i(t, e);
return u;
};
return i(e);
};
})), ld = /* @__PURE__ */ i(((e, t) => {
var n = sd(), r = id(), i = rd(), a = (e = "", t = "", n = !1) => {
let r = [];
if (e = [].concat(e), t = [].concat(t), !t.length) return e;
if (!e.length) return n ? i.flatten(t).map((e) => `{${e}}`) : t;
for (let i of e) if (Array.isArray(i)) for (let e of i) r.push(a(e, t, n));
else for (let e of t) n === !0 && typeof e == "string" && (e = `{${e}}`), r.push(Array.isArray(e) ? a(i, e, n) : i + e);
return i.flatten(r);
};
t.exports = (e, t = {}) => {
let o = t.rangeLimit === void 0 ? 1e3 : t.rangeLimit, s = (e, c = {}) => {
e.queue = [];
let l = c, u = c.queue;
for (; l.type !== "brace" && l.type !== "root" && l.parent;) l = l.parent, u = l.queue;
if (e.invalid || e.dollar) {
u.push(a(u.pop(), r(e, t)));
return;
}
if (e.type === "brace" && e.invalid !== !0 && e.nodes.length === 2) {
u.push(a(u.pop(), ["{}"]));
return;
}
if (e.nodes && e.ranges > 0) {
let s = i.reduce(e.nodes);
if (i.exceedsLimit(...s, t.step, o)) throw RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
let c = n(...s, t);
c.length === 0 && (c = r(e, t)), u.push(a(u.pop(), c)), e.nodes = [];
return;
}
let d = i.encloseBrace(e), f = e.queue, p = e;
for (; p.type !== "brace" && p.type !== "root" && p.parent;) p = p.parent, f = p.queue;
for (let t = 0; t < e.nodes.length; t++) {
let n = e.nodes[t];
if (n.type === "comma" && e.type === "brace") {
t === 1 && f.push(""), f.push("");
continue;
}
if (n.type === "close") {
u.push(a(u.pop(), f, d));
continue;
}
if (n.value && n.type !== "open") {
f.push(a(f.pop(), n.value));
continue;
}
n.nodes && s(n, e);
}
return f;
};
return i.flatten(s(e));
};
})), ud = /* @__PURE__ */ i(((e, t) => {
t.exports = {
MAX_LENGTH: 1e4,
CHAR_0: "0",
CHAR_9: "9",
CHAR_UPPERCASE_A: "A",
CHAR_LOWERCASE_A: "a",
CHAR_UPPERCASE_Z: "Z",
CHAR_LOWERCASE_Z: "z",
CHAR_LEFT_PARENTHESES: "(",
CHAR_RIGHT_PARENTHESES: ")",
CHAR_ASTERISK: "*",
CHAR_AMPERSAND: "&",
CHAR_AT: "@",
CHAR_BACKSLASH: "\\",
CHAR_BACKTICK: "`",
CHAR_CARRIAGE_RETURN: "\r",
CHAR_CIRCUMFLEX_ACCENT: "^",
CHAR_COLON: ":",
CHAR_COMMA: ",",
CHAR_DOLLAR: "$",
CHAR_DOT: ".",
CHAR_DOUBLE_QUOTE: "\"",
CHAR_EQUAL: "=",
CHAR_EXCLAMATION_MARK: "!",
CHAR_FORM_FEED: "\f",
CHAR_FORWARD_SLASH: "/",
CHAR_HASH: "#",
CHAR_HYPHEN_MINUS: "-",
CHAR_LEFT_ANGLE_BRACKET: "<",
CHAR_LEFT_CURLY_BRACE: "{",
CHAR_LEFT_SQUARE_BRACKET: "[",
CHAR_LINE_FEED: "\n",
CHAR_NO_BREAK_SPACE: "\xA0",
CHAR_PERCENT: "%",
CHAR_PLUS: "+",
CHAR_QUESTION_MARK: "?",
CHAR_RIGHT_ANGLE_BRACKET: ">",
CHAR_RIGHT_CURLY_BRACE: "}",
CHAR_RIGHT_SQUARE_BRACKET: "]",
CHAR_SEMICOLON: ";",
CHAR_SINGLE_QUOTE: "'",
CHAR_SPACE: " ",
CHAR_TAB: " ",
CHAR_UNDERSCORE: "_",
CHAR_VERTICAL_LINE: "|",
CHAR_ZERO_WIDTH_NOBREAK_SPACE: ""
};
})), dd = /* @__PURE__ */ i(((e, t) => {
var n = id(), { MAX_LENGTH: r, CHAR_BACKSLASH: i, CHAR_BACKTICK: a, CHAR_COMMA: o, CHAR_DOT: s, CHAR_LEFT_PARENTHESES: c, CHAR_RIGHT_PARENTHESES: l, CHAR_LEFT_CURLY_BRACE: u, CHAR_RIGHT_CURLY_BRACE: d, CHAR_LEFT_SQUARE_BRACKET: f, CHAR_RIGHT_SQUARE_BRACKET: p, CHAR_DOUBLE_QUOTE: m, CHAR_SINGLE_QUOTE: h, CHAR_NO_BREAK_SPACE: g, CHAR_ZERO_WIDTH_NOBREAK_SPACE: _ } = ud();
t.exports = (e, t = {}) => {
if (typeof e != "string") throw TypeError("Expected a string");
let v = t || {}, y = typeof v.maxLength == "number" ? Math.min(r, v.maxLength) : r;
if (e.length > y) throw SyntaxError(`Input length (${e.length}), exceeds max characters (${y})`);
let b = {
type: "root",
input: e,
nodes: []
}, x = [b], S = b, C = b, w = 0, T = e.length, E = 0, D = 0, O, k = () => e[E++], A = (e) => {
if (e.type === "text" && C.type === "dot" && (C.type = "text"), C && C.type === "text" && e.type === "text") {
C.value += e.value;
return;
}
return S.nodes.push(e), e.parent = S, e.prev = C, C = e, e;
};
for (A({ type: "bos" }); E < T;) if (S = x[x.length - 1], O = k(), O !== _ && O !== g) {
if (O === i) {
A({
type: "text",
value: (t.keepEscaping ? O : "") + k()
});
continue;
}
if (O === p) {
A({
type: "text",
value: "\\" + O
});
continue;
}
if (O === f) {
w++;
let e;
for (; E < T && (e = k());) {
if (O += e, e === f) {
w++;
continue;
}
if (e === i) {
O += k();
continue;
}
if (e === p && (w--, w === 0)) break;
}
A({
type: "text",
value: O
});
continue;
}
if (O === c) {
S = A({
type: "paren",
nodes: []
}), x.push(S), A({
type: "text",
value: O
});
continue;
}
if (O === l) {
if (S.type !== "paren") {
A({
type: "text",
value: O
});
continue;
}
S = x.pop(), A({
type: "text",
value: O
}), S = x[x.length - 1];
continue;
}
if (O === m || O === h || O === a) {
let e = O, n;
for (t.keepQuotes !== !0 && (O = ""); E < T && (n = k());) {
if (n === i) {
O += n + k();
continue;
}
if (n === e) {
t.keepQuotes === !0 && (O += n);
break;
}
O += n;
}
A({
type: "text",
value: O
});
continue;
}
if (O === u) {
D++, S = A({
type: "brace",
open: !0,
close: !1,
dollar: C.value && C.value.slice(-1) === "$" || S.dollar === !0,
depth: D,
commas: 0,
ranges: 0,
nodes: []
}), x.push(S), A({
type: "open",
value: O
});
continue;
}
if (O === d) {
if (S.type !== "brace") {
A({
type: "text",
value: O
});
continue;
}
S = x.pop(), S.close = !0, A({
type: "close",
value: O
}), D--, S = x[x.length - 1];
continue;
}
if (O === o && D > 0) {
if (S.ranges > 0) {
S.ranges = 0;
let e = S.nodes.shift();
S.nodes = [e, {
type: "text",
value: n(S)
}];
}
A({
type: "comma",
value: O
}), S.commas++;
continue;
}
if (O === s && D > 0 && S.commas === 0) {
let e = S.nodes;
if (D === 0 || e.length === 0) {
A({
type: "text",
value: O
});
continue;
}
if (C.type === "dot") {
if (S.range = [], C.value += O, C.type = "range", S.nodes.length !== 3 && S.nodes.length !== 5) {
S.invalid = !0, S.ranges = 0, C.type = "text";
continue;
}
S.ranges++, S.args = [];
continue;
}
if (C.type === "range") {
e.pop();
let t = e[e.length - 1];
t.value += C.value + O, C = t, S.ranges--;
continue;
}
A({
type: "dot",
value: O
});
continue;
}
A({
type: "text",
value: O
});
}
do
if (S = x.pop(), S.type !== "root") {
S.nodes.forEach((e) => {
e.nodes || (e.type === "open" && (e.isOpen = !0), e.type === "close" && (e.isClose = !0), e.nodes || (e.type = "text"), e.invalid = !0);
});
let e = x[x.length - 1], t = e.nodes.indexOf(S);
e.nodes.splice(t, 1, ...S.nodes);
}
while (x.length > 0);
return A({ type: "eos" }), b;
};
})), fd = /* @__PURE__ */ i(((e, t) => {
var n = id(), r = cd(), i = ld(), a = dd(), o = (e, t = {}) => {
let n = [];
if (Array.isArray(e)) for (let r of e) {
let e = o.create(r, t);
Array.isArray(e) ? n.push(...e) : n.push(e);
}
else n = [].concat(o.create(e, t));
return t && t.expand === !0 && t.nodupes === !0 && (n = [...new Set(n)]), n;
};
o.parse = (e, t = {}) => a(e, t), o.stringify = (e, t = {}) => n(typeof e == "string" ? o.parse(e, t) : e, t), o.compile = (e, t = {}) => (typeof e == "string" && (e = o.parse(e, t)), r(e, t)), o.expand = (e, t = {}) => {
typeof e == "string" && (e = o.parse(e, t));
let n = i(e, t);
return t.noempty === !0 && (n = n.filter(Boolean)), t.nodupes === !0 && (n = [...new Set(n)]), n;
}, o.create = (e, t = {}) => e === "" || e.length < 3 ? [e] : t.expand === !0 ? o.expand(e, t) : o.compile(e, t), t.exports = o;
})), pd = /* @__PURE__ */ i(((t, n) => {
var r = e("path"), i = "\\\\/", a = `[^${i}]`, o = 0, s = "\\.", c = "\\+", l = "\\?", u = "\\/", d = "(?=.)", f = "[^/]", p = `(?:${u}|$)`, m = `(?:^|${u})`, h = `${s}{1,2}${p}`, g = {
DOT_LITERAL: s,
PLUS_LITERAL: c,
QMARK_LITERAL: l,
SLASH_LITERAL: u,
ONE_CHAR: d,
QMARK: f,
END_ANCHOR: p,
DOTS_SLASH: h,
NO_DOT: `(?!${s})`,
NO_DOTS: `(?!${m}${h})`,
NO_DOT_SLASH: `(?!${s}{0,1}${p})`,
NO_DOTS_SLASH: `(?!${h})`,
QMARK_NO_DOT: `[^.${u}]`,
STAR: `${f}*?`,
START_ANCHOR: m
}, _ = {
...g,
SLASH_LITERAL: `[${i}]`,
QMARK: a,
STAR: `${a}*?`,
DOTS_SLASH: `${s}{1,2}(?:[${i}]|$)`,
NO_DOT: `(?!${s})`,
NO_DOTS: `(?!(?:^|[${i}])${s}{1,2}(?:[${i}]|$))`,
NO_DOT_SLASH: `(?!${s}{0,1}(?:[${i}]|$))`,
NO_DOTS_SLASH: `(?!${s}{1,2}(?:[${i}]|$))`,
QMARK_NO_DOT: `[^.${i}]`,
START_ANCHOR: `(?:^|[${i}])`,
END_ANCHOR: `(?:[${i}]|$)`
};
n.exports = {
DEFAULT_MAX_EXTGLOB_RECURSION: o,
MAX_LENGTH: 65536,
POSIX_REGEX_SOURCE: {
__proto__: null,
alnum: "a-zA-Z0-9",
alpha: "a-zA-Z",
ascii: "\\x00-\\x7F",
blank: " \\t",
cntrl: "\\x00-\\x1F\\x7F",
digit: "0-9",
graph: "\\x21-\\x7E",
lower: "a-z",
print: "\\x20-\\x7E ",
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
space: " \\t\\r\\n\\v\\f",
upper: "A-Z",
word: "A-Za-z0-9_",
xdigit: "A-Fa-f0-9"
},
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
REPLACEMENTS: {
__proto__: null,
"***": "*",
"**/**": "**",
"**/**/**": "**"
},
CHAR_0: 48,
CHAR_9: 57,
CHAR_UPPERCASE_A: 65,
CHAR_LOWERCASE_A: 97,
CHAR_UPPERCASE_Z: 90,
CHAR_LOWERCASE_Z: 122,
CHAR_LEFT_PARENTHESES: 40,
CHAR_RIGHT_PARENTHESES: 41,
CHAR_ASTERISK: 42,
CHAR_AMPERSAND: 38,
CHAR_AT: 64,
CHAR_BACKWARD_SLASH: 92,
CHAR_CARRIAGE_RETURN: 13,
CHAR_CIRCUMFLEX_ACCENT: 94,
CHAR_COLON: 58,
CHAR_COMMA: 44,
CHAR_DOT: 46,
CHAR_DOUBLE_QUOTE: 34,
CHAR_EQUAL: 61,
CHAR_EXCLAMATION_MARK: 33,
CHAR_FORM_FEED: 12,
CHAR_FORWARD_SLASH: 47,
CHAR_GRAVE_ACCENT: 96,
CHAR_HASH: 35,
CHAR_HYPHEN_MINUS: 45,
CHAR_LEFT_ANGLE_BRACKET: 60,
CHAR_LEFT_CURLY_BRACE: 123,
CHAR_LEFT_SQUARE_BRACKET: 91,
CHAR_LINE_FEED: 10,
CHAR_NO_BREAK_SPACE: 160,
CHAR_PERCENT: 37,
CHAR_PLUS: 43,
CHAR_QUESTION_MARK: 63,
CHAR_RIGHT_ANGLE_BRACKET: 62,
CHAR_RIGHT_CURLY_BRACE: 125,
CHAR_RIGHT_SQUARE_BRACKET: 93,
CHAR_SEMICOLON: 59,
CHAR_SINGLE_QUOTE: 39,
CHAR_SPACE: 32,
CHAR_TAB: 9,
CHAR_UNDERSCORE: 95,
CHAR_VERTICAL_LINE: 124,
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
SEP: r.sep,
extglobChars(e) {
return {
"!": {
type: "negate",
open: "(?:(?!(?:",
close: `))${e.STAR})`
},
"?": {
type: "qmark",
open: "(?:",
close: ")?"
},
"+": {
type: "plus",
open: "(?:",
close: ")+"
},
"*": {
type: "star",
open: "(?:",
close: ")*"
},
"@": {
type: "at",
open: "(?:",
close: ")"
}
};
},
globChars(e) {
return e === !0 ? _ : g;
}
};
})), md = /* @__PURE__ */ i(((t) => {
var n = e("path"), r = process.platform === "win32", { REGEX_BACKSLASH: i, REGEX_REMOVE_BACKSLASH: a, REGEX_SPECIAL_CHARS: o, REGEX_SPECIAL_CHARS_GLOBAL: s } = pd();
t.isObject = (e) => typeof e == "object" && !!e && !Array.isArray(e), t.hasRegexChars = (e) => o.test(e), t.isRegexChar = (e) => e.length === 1 && t.hasRegexChars(e), t.escapeRegex = (e) => e.replace(s, "\\$1"), t.toPosixSlashes = (e) => e.replace(i, "/"), t.removeBackslashes = (e) => e.replace(a, (e) => e === "\\" ? "" : e), t.supportsLookbehinds = () => {
let e = process.version.slice(1).split(".").map(Number);
return e.length === 3 && e[0] >= 9 || e[0] === 8 && e[1] >= 10;
}, t.isWindows = (e) => e && typeof e.windows == "boolean" ? e.windows : r === !0 || n.sep === "\\", t.escapeLast = (e, n, r) => {
let i = e.lastIndexOf(n, r);
return i === -1 ? e : e[i - 1] === "\\" ? t.escapeLast(e, n, i - 1) : `${e.slice(0, i)}\\${e.slice(i)}`;
}, t.removePrefix = (e, t = {}) => {
let n = e;
return n.startsWith("./") && (n = n.slice(2), t.prefix = "./"), n;
}, t.wrapOutput = (e, t = {}, n = {}) => {
let r = `${n.contains ? "" : "^"}(?:${e})${n.contains ? "" : "$"}`;
return t.negated === !0 && (r = `(?:^(?!${r}).*$)`), r;
};
})), hd = /* @__PURE__ */ i(((e, t) => {
var n = md(), { CHAR_ASTERISK: r, CHAR_AT: i, CHAR_BACKWARD_SLASH: a, CHAR_COMMA: o, CHAR_DOT: s, CHAR_EXCLAMATION_MARK: c, CHAR_FORWARD_SLASH: l, CHAR_LEFT_CURLY_BRACE: u, CHAR_LEFT_PARENTHESES: d, CHAR_LEFT_SQUARE_BRACKET: f, CHAR_PLUS: p, CHAR_QUESTION_MARK: m, CHAR_RIGHT_CURLY_BRACE: h, CHAR_RIGHT_PARENTHESES: g, CHAR_RIGHT_SQUARE_BRACKET: _ } = pd(), v = (e) => e === l || e === a, y = (e) => {
e.isPrefix !== !0 && (e.depth = e.isGlobstar ? Infinity : 1);
};
t.exports = (e, t) => {
let b = t || {}, x = e.length - 1, S = b.parts === !0 || b.scanToEnd === !0, C = [], w = [], T = [], E = e, D = -1, O = 0, k = 0, A = !1, ee = !1, j = !1, M = !1, te = !1, ne = !1, re = !1, N = !1, P = !1, F = !1, ie = 0, I, L, R = {
value: "",
depth: 0,
isGlob: !1
}, z = () => D >= x, B = () => E.charCodeAt(D + 1), V = () => (I = L, E.charCodeAt(++D));
for (; D < x;) {
L = V();
let e;
if (L === a) {
re = R.backslashes = !0, L = V(), L === u && (ne = !0);
continue;
}
if (ne === !0 || L === u) {
for (ie++; z() !== !0 && (L = V());) {
if (L === a) {
re = R.backslashes = !0, V();
continue;
}
if (L === u) {
ie++;
continue;
}
if (ne !== !0 && L === s && (L = V()) === s) {
if (A = R.isBrace = !0, j = R.isGlob = !0, F = !0, S === !0) continue;
break;
}
if (ne !== !0 && L === o) {
if (A = R.isBrace = !0, j = R.isGlob = !0, F = !0, S === !0) continue;
break;
}
if (L === h && (ie--, ie === 0)) {
ne = !1, A = R.isBrace = !0, F = !0;
break;
}
}
if (S === !0) continue;
break;
}
if (L === l) {
if (C.push(D), w.push(R), R = {
value: "",
depth: 0,
isGlob: !1
}, F === !0) continue;
if (I === s && D === O + 1) {
O += 2;
continue;
}
k = D + 1;
continue;
}
if (b.noext !== !0 && (L === p || L === i || L === r || L === m || L === c) && B() === d) {
if (j = R.isGlob = !0, M = R.isExtglob = !0, F = !0, L === c && D === O && (P = !0), S === !0) {
for (; z() !== !0 && (L = V());) {
if (L === a) {
re = R.backslashes = !0, L = V();
continue;
}
if (L === g) {
j = R.isGlob = !0, F = !0;
break;
}
}
continue;
}
break;
}
if (L === r) {
if (I === r && (te = R.isGlobstar = !0), j = R.isGlob = !0, F = !0, S === !0) continue;
break;
}
if (L === m) {
if (j = R.isGlob = !0, F = !0, S === !0) continue;
break;
}
if (L === f) {
for (; z() !== !0 && (e = V());) {
if (e === a) {
re = R.backslashes = !0, V();
continue;
}
if (e === _) {
ee = R.isBracket = !0, j = R.isGlob = !0, F = !0;
break;
}
}
if (S === !0) continue;
break;
}
if (b.nonegate !== !0 && L === c && D === O) {
N = R.negated = !0, O++;
continue;
}
if (b.noparen !== !0 && L === d) {
if (j = R.isGlob = !0, S === !0) {
for (; z() !== !0 && (L = V());) {
if (L === d) {
re = R.backslashes = !0, L = V();
continue;
}
if (L === g) {
F = !0;
break;
}
}
continue;
}
break;
}
if (j === !0) {
if (F = !0, S === !0) continue;
break;
}
}
b.noext === !0 && (M = !1, j = !1);
let H = E, ae = "", oe = "";
O > 0 && (ae = E.slice(0, O), E = E.slice(O), k -= O), H && j === !0 && k > 0 ? (H = E.slice(0, k), oe = E.slice(k)) : j === !0 ? (H = "", oe = E) : H = E, H && H !== "" && H !== "/" && H !== E && v(H.charCodeAt(H.length - 1)) && (H = H.slice(0, -1)), b.unescape === !0 && (oe &&= n.removeBackslashes(oe), H && re === !0 && (H = n.removeBackslashes(H)));
let se = {
prefix: ae,
input: e,
start: O,
base: H,
glob: oe,
isBrace: A,
isBracket: ee,
isGlob: j,
isExtglob: M,
isGlobstar: te,
negated: N,
negatedExtglob: P
};
if (b.tokens === !0 && (se.maxDepth = 0, v(L) || w.push(R), se.tokens = w), b.parts === !0 || b.tokens === !0) {
let t;
for (let n = 0; n < C.length; n++) {
let r = t ? t + 1 : O, i = C[n], a = e.slice(r, i);
b.tokens && (n === 0 && O !== 0 ? (w[n].isPrefix = !0, w[n].value = ae) : w[n].value = a, y(w[n]), se.maxDepth += w[n].depth), (n !== 0 || a !== "") && T.push(a), t = i;
}
if (t && t + 1 < e.length) {
let n = e.slice(t + 1);
T.push(n), b.tokens && (w[w.length - 1].value = n, y(w[w.length - 1]), se.maxDepth += w[w.length - 1].depth);
}
se.slashes = C, se.parts = T;
}
return se;
};
})), gd = /* @__PURE__ */ i(((e, t) => {
var n = pd(), r = md(), { MAX_LENGTH: i, POSIX_REGEX_SOURCE: a, REGEX_NON_SPECIAL_CHARS: o, REGEX_SPECIAL_CHARS_BACKREF: s, REPLACEMENTS: c } = n, l = (e, t) => {
if (typeof t.expandRange == "function") return t.expandRange(...e, t);
e.sort();
let n = `[${e.join("-")}]`;
try {
new RegExp(n);
} catch {
return e.map((e) => r.escapeRegex(e)).join("..");
}
return n;
}, u = (e, t) => `Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`, d = (e) => {
let t = [], n = 0, r = 0, i = 0, a = "", o = !1;
for (let s of e) {
if (o === !0) {
a += s, o = !1;
continue;
}
if (s === "\\") {
a += s, o = !0;
continue;
}
if (s === "\"") {
i = i === 1 ? 0 : 1, a += s;
continue;
}
if (i === 0) {
if (s === "[") n++;
else if (s === "]" && n > 0) n--;
else if (n === 0) {
if (s === "(") r++;
else if (s === ")" && r > 0) r--;
else if (s === "|" && r === 0) {
t.push(a), a = "";
continue;
}
}
}
a += s;
}
return t.push(a), t;
}, f = (e) => {
let t = !1;
for (let n of e) {
if (t === !0) {
t = !1;
continue;
}
if (n === "\\") {
t = !0;
continue;
}
if (/[?*+@!()[\]{}]/.test(n)) return !1;
}
return !0;
}, p = (e) => {
let t = e.trim(), n = !0;
for (; n === !0;) n = !1, /^@\([^\\()[\]{}|]+\)$/.test(t) && (t = t.slice(2, -1), n = !0);
if (f(t)) return t.replace(/\\(.)/g, "$1");
}, m = (e) => {
let t = e.map(p).filter(Boolean);
for (let e = 0; e < t.length; e++) for (let n = e + 1; n < t.length; n++) {
let r = t[e], i = t[n], a = r[0];
if (!(!a || r !== a.repeat(r.length) || i !== a.repeat(i.length)) && (r === i || r.startsWith(i) || i.startsWith(r))) return !0;
}
return !1;
}, h = (e, t = !0) => {
if (e[0] !== "+" && e[0] !== "*" || e[1] !== "(") return;
let n = 0, r = 0, i = 0, a = !1;
for (let o = 1; o < e.length; o++) {
let s = e[o];
if (a === !0) {
a = !1;
continue;
}
if (s === "\\") {
a = !0;
continue;
}
if (s === "\"") {
i = i === 1 ? 0 : 1;
continue;
}
if (i !== 1) {
if (s === "[") {
n++;
continue;
}
if (s === "]" && n > 0) {
n--;
continue;
}
if (!(n > 0)) {
if (s === "(") {
r++;
continue;
}
if (s === ")" && (r--, r === 0)) return t === !0 && o !== e.length - 1 ? void 0 : {
type: e[0],
body: e.slice(2, o),
end: o
};
}
}
}
}, g = (e) => {
let t = 0, n = [];
for (; t < e.length;) {
let r = h(e.slice(t), !1);
if (!r || r.type !== "*") return;
let i = d(r.body).map((e) => e.trim());
if (i.length !== 1) return;
let a = p(i[0]);
if (!a || a.length !== 1) return;
n.push(a), t += r.end + 1;
}
if (!(n.length < 1)) return `${n.length === 1 ? r.escapeRegex(n[0]) : `[${n.map((e) => r.escapeRegex(e)).join("")}]`}*`;
}, _ = (e) => {
let t = 0, n = e.trim(), r = h(n);
for (; r;) t++, n = r.body.trim(), r = h(n);
return t;
}, v = (e, t) => {
if (t.maxExtglobRecursion === !1) return { risky: !1 };
let r = typeof t.maxExtglobRecursion == "number" ? t.maxExtglobRecursion : n.DEFAULT_MAX_EXTGLOB_RECURSION, i = d(e).map((e) => e.trim());
if (i.length > 1 && (i.some((e) => e === "") || i.some((e) => /^[*?]+$/.test(e)) || m(i))) return { risky: !0 };
for (let e of i) {
let t = g(e);
if (t) return {
risky: !0,
safeOutput: t
};
if (_(e) > r) return { risky: !0 };
}
return { risky: !1 };
}, y = (e, t) => {
if (typeof e != "string") throw TypeError("Expected a string");
e = c[e] || e;
let d = { ...t }, f = typeof d.maxLength == "number" ? Math.min(i, d.maxLength) : i, p = e.length;
if (p > f) throw SyntaxError(`Input length: ${p}, exceeds maximum allowed length: ${f}`);
let m = {
type: "bos",
value: "",
output: d.prepend || ""
}, h = [m], g = d.capture ? "" : "?:", _ = r.isWindows(t), b = n.globChars(_), x = n.extglobChars(b), { DOT_LITERAL: S, PLUS_LITERAL: C, SLASH_LITERAL: w, ONE_CHAR: T, DOTS_SLASH: E, NO_DOT: D, NO_DOT_SLASH: O, NO_DOTS_SLASH: k, QMARK: A, QMARK_NO_DOT: ee, STAR: j, START_ANCHOR: M } = b, te = (e) => `(${g}(?:(?!${M}${e.dot ? E : S}).)*?)`, ne = d.dot ? "" : D, re = d.dot ? A : ee, N = d.bash === !0 ? te(d) : j;
d.capture && (N = `(${N})`), typeof d.noext == "boolean" && (d.noextglob = d.noext);
let P = {
input: e,
index: -1,
start: 0,
dot: d.dot === !0,
consumed: "",
output: "",
prefix: "",
backtrack: !1,
negated: !1,
brackets: 0,
braces: 0,
parens: 0,
quotes: 0,
globstar: !1,
tokens: h
};
e = r.removePrefix(e, P), p = e.length;
let F = [], ie = [], I = [], L = m, R, z = () => P.index === p - 1, B = P.peek = (t = 1) => e[P.index + t], V = P.advance = () => e[++P.index] || "", H = () => e.slice(P.index + 1), ae = (e = "", t = 0) => {
P.consumed += e, P.index += t;
}, oe = (e) => {
P.output += e.output == null ? e.value : e.output, ae(e.value);
}, se = () => {
let e = 1;
for (; B() === "!" && (B(2) !== "(" || B(3) === "?");) V(), P.start++, e++;
return e % 2 != 0 && (P.negated = !0, P.start++, !0);
}, ce = (e) => {
P[e]++, I.push(e);
}, U = (e) => {
P[e]--, I.pop();
}, W = (e) => {
if (L.type === "globstar") {
let t = P.braces > 0 && (e.type === "comma" || e.type === "brace"), n = e.extglob === !0 || F.length && (e.type === "pipe" || e.type === "paren");
e.type !== "slash" && e.type !== "paren" && !t && !n && (P.output = P.output.slice(0, -L.output.length), L.type = "star", L.value = "*", L.output = N, P.output += L.output);
}
if (F.length && e.type !== "paren" && (F[F.length - 1].inner += e.value), (e.value || e.output) && oe(e), L && L.type === "text" && e.type === "text") {
L.value += e.value, L.output = (L.output || "") + e.value;
return;
}
e.prev = L, h.push(e), L = e;
}, le = (e, t) => {
let n = {
...x[t],
conditions: 1,
inner: ""
};
n.prev = L, n.parens = P.parens, n.output = P.output, n.startIndex = P.index, n.tokensIndex = h.length;
let r = (d.capture ? "(" : "") + n.open;
ce("parens"), W({
type: e,
value: t,
output: P.output ? "" : T
}), W({
type: "paren",
extglob: !0,
value: V(),
output: r
}), F.push(n);
}, ue = (n) => {
let i = e.slice(n.startIndex, P.index + 1), a = v(e.slice(n.startIndex + 2, P.index), d);
if ((n.type === "plus" || n.type === "star") && a.risky) {
let e = a.safeOutput ? (n.output ? "" : T) + (d.capture ? `(${a.safeOutput})` : a.safeOutput) : void 0, t = h[n.tokensIndex];
t.type = "text", t.value = i, t.output = e || r.escapeRegex(i);
for (let e = n.tokensIndex + 1; e < h.length; e++) h[e].value = "", h[e].output = "", delete h[e].suffix;
P.output = n.output + t.output, P.backtrack = !0, W({
type: "paren",
extglob: !0,
value: R,
output: ""
}), U("parens");
return;
}
let o = n.close + (d.capture ? ")" : ""), s;
if (n.type === "negate") {
let e = N;
n.inner && n.inner.length > 1 && n.inner.includes("/") && (e = te(d)), (e !== N || z() || /^\)+$/.test(H())) && (o = n.close = `)$))${e}`), n.inner.includes("*") && (s = H()) && /^\.[^\\/.]+$/.test(s) && (o = n.close = `)${y(s, {
...t,
fastpaths: !1
}).output})${e})`), n.prev.type === "bos" && (P.negatedExtglob = !0);
}
W({
type: "paren",
extglob: !0,
value: R,
output: o
}), U("parens");
};
if (d.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(e)) {
let n = !1, i = e.replace(s, (e, t, r, i, a, o) => i === "\\" ? (n = !0, e) : i === "?" ? t ? t + i + (a ? A.repeat(a.length) : "") : o === 0 ? re + (a ? A.repeat(a.length) : "") : A.repeat(r.length) : i === "." ? S.repeat(r.length) : i === "*" ? t ? t + i + (a ? N : "") : N : t ? e : `\\${e}`);
return n === !0 && (i = d.unescape === !0 ? i.replace(/\\/g, "") : i.replace(/\\+/g, (e) => e.length % 2 == 0 ? "\\\\" : e ? "\\" : "")), i === e && d.contains === !0 ? (P.output = e, P) : (P.output = r.wrapOutput(i, P, t), P);
}
for (; !z();) {
if (R = V(), R === "\0") continue;
if (R === "\\") {
let e = B();
if (e === "/" && d.bash !== !0 || e === "." || e === ";") continue;
if (!e) {
R += "\\", W({
type: "text",
value: R
});
continue;
}
let t = /^\\+/.exec(H()), n = 0;
if (t && t[0].length > 2 && (n = t[0].length, P.index += n, n % 2 != 0 && (R += "\\")), d.unescape === !0 ? R = V() : R += V(), P.brackets === 0) {
W({
type: "text",
value: R
});
continue;
}
}
if (P.brackets > 0 && (R !== "]" || L.value === "[" || L.value === "[^")) {
if (d.posix !== !1 && R === ":") {
let e = L.value.slice(1);
if (e.includes("[") && (L.posix = !0, e.includes(":"))) {
let e = L.value.lastIndexOf("["), t = L.value.slice(0, e), n = a[L.value.slice(e + 2)];
if (n) {
L.value = t + n, P.backtrack = !0, V(), !m.output && h.indexOf(L) === 1 && (m.output = T);
continue;
}
}
}
(R === "[" && B() !== ":" || R === "-" && B() === "]") && (R = `\\${R}`), R === "]" && (L.value === "[" || L.value === "[^") && (R = `\\${R}`), d.posix === !0 && R === "!" && L.value === "[" && (R = "^"), L.value += R, oe({ value: R });
continue;
}
if (P.quotes === 1 && R !== "\"") {
R = r.escapeRegex(R), L.value += R, oe({ value: R });
continue;
}
if (R === "\"") {
P.quotes = P.quotes === 1 ? 0 : 1, d.keepQuotes === !0 && W({
type: "text",
value: R
});
continue;
}
if (R === "(") {
ce("parens"), W({
type: "paren",
value: R
});
continue;
}
if (R === ")") {
if (P.parens === 0 && d.strictBrackets === !0) throw SyntaxError(u("opening", "("));
let e = F[F.length - 1];
if (e && P.parens === e.parens + 1) {
ue(F.pop());
continue;
}
W({
type: "paren",
value: R,
output: P.parens ? ")" : "\\)"
}), U("parens");
continue;
}
if (R === "[") {
if (d.nobracket === !0 || !H().includes("]")) {
if (d.nobracket !== !0 && d.strictBrackets === !0) throw SyntaxError(u("closing", "]"));
R = `\\${R}`;
} else ce("brackets");
W({
type: "bracket",
value: R
});
continue;
}
if (R === "]") {
if (d.nobracket === !0 || L && L.type === "bracket" && L.value.length === 1) {
W({
type: "text",
value: R,
output: `\\${R}`
});
continue;
}
if (P.brackets === 0) {
if (d.strictBrackets === !0) throw SyntaxError(u("opening", "["));
W({
type: "text",
value: R,
output: `\\${R}`
});
continue;
}
U("brackets");
let e = L.value.slice(1);
if (L.posix !== !0 && e[0] === "^" && !e.includes("/") && (R = `/${R}`), L.value += R, oe({ value: R }), d.literalBrackets === !1 || r.hasRegexChars(e)) continue;
let t = r.escapeRegex(L.value);
if (P.output = P.output.slice(0, -L.value.length), d.literalBrackets === !0) {
P.output += t, L.value = t;
continue;
}
L.value = `(${g}${t}|${L.value})`, P.output += L.value;
continue;
}
if (R === "{" && d.nobrace !== !0) {
ce("braces");
let e = {
type: "brace",
value: R,
output: "(",
outputIndex: P.output.length,
tokensIndex: P.tokens.length
};
ie.push(e), W(e);
continue;
}
if (R === "}") {
let e = ie[ie.length - 1];
if (d.nobrace === !0 || !e) {
W({
type: "text",
value: R,
output: R
});
continue;
}
let t = ")";
if (e.dots === !0) {
let e = h.slice(), n = [];
for (let t = e.length - 1; t >= 0 && (h.pop(), e[t].type !== "brace"); t--) e[t].type !== "dots" && n.unshift(e[t].value);
t = l(n, d), P.backtrack = !0;
}
if (e.comma !== !0 && e.dots !== !0) {
let n = P.output.slice(0, e.outputIndex), r = P.tokens.slice(e.tokensIndex);
e.value = e.output = "\\{", R = t = "\\}", P.output = n;
for (let e of r) P.output += e.output || e.value;
}
W({
type: "brace",
value: R,
output: t
}), U("braces"), ie.pop();
continue;
}
if (R === "|") {
F.length > 0 && F[F.length - 1].conditions++, W({
type: "text",
value: R
});
continue;
}
if (R === ",") {
let e = R, t = ie[ie.length - 1];
t && I[I.length - 1] === "braces" && (t.comma = !0, e = "|"), W({
type: "comma",
value: R,
output: e
});
continue;
}
if (R === "/") {
if (L.type === "dot" && P.index === P.start + 1) {
P.start = P.index + 1, P.consumed = "", P.output = "", h.pop(), L = m;
continue;
}
W({
type: "slash",
value: R,
output: w
});
continue;
}
if (R === ".") {
if (P.braces > 0 && L.type === "dot") {
L.value === "." && (L.output = S);
let e = ie[ie.length - 1];
L.type = "dots", L.output += R, L.value += R, e.dots = !0;
continue;
}
if (P.braces + P.parens === 0 && L.type !== "bos" && L.type !== "slash") {
W({
type: "text",
value: R,
output: S
});
continue;
}
W({
type: "dot",
value: R,
output: S
});
continue;
}
if (R === "?") {
if (!(L && L.value === "(") && d.noextglob !== !0 && B() === "(" && B(2) !== "?") {
le("qmark", R);
continue;
}
if (L && L.type === "paren") {
let e = B(), t = R;
if (e === "<" && !r.supportsLookbehinds()) throw Error("Node.js v10 or higher is required for regex lookbehinds");
(L.value === "(" && !/[!=<:]/.test(e) || e === "<" && !/<([!=]|\w+>)/.test(H())) && (t = `\\${R}`), W({
type: "text",
value: R,
output: t
});
continue;
}
if (d.dot !== !0 && (L.type === "slash" || L.type === "bos")) {
W({
type: "qmark",
value: R,
output: ee
});
continue;
}
W({
type: "qmark",
value: R,
output: A
});
continue;
}
if (R === "!") {
if (d.noextglob !== !0 && B() === "(" && (B(2) !== "?" || !/[!=<:]/.test(B(3)))) {
le("negate", R);
continue;
}
if (d.nonegate !== !0 && P.index === 0) {
se();
continue;
}
}
if (R === "+") {
if (d.noextglob !== !0 && B() === "(" && B(2) !== "?") {
le("plus", R);
continue;
}
if (L && L.value === "(" || d.regex === !1) {
W({
type: "plus",
value: R,
output: C
});
continue;
}
if (L && (L.type === "bracket" || L.type === "paren" || L.type === "brace") || P.parens > 0) {
W({
type: "plus",
value: R
});
continue;
}
W({
type: "plus",
value: C
});
continue;
}
if (R === "@") {
if (d.noextglob !== !0 && B() === "(" && B(2) !== "?") {
W({
type: "at",
extglob: !0,
value: R,
output: ""
});
continue;
}
W({
type: "text",
value: R
});
continue;
}
if (R !== "*") {
(R === "$" || R === "^") && (R = `\\${R}`);
let e = o.exec(H());
e && (R += e[0], P.index += e[0].length), W({
type: "text",
value: R
});
continue;
}
if (L && (L.type === "globstar" || L.star === !0)) {
L.type = "star", L.star = !0, L.value += R, L.output = N, P.backtrack = !0, P.globstar = !0, ae(R);
continue;
}
let t = H();
if (d.noextglob !== !0 && /^\([^?]/.test(t)) {
le("star", R);
continue;
}
if (L.type === "star") {
if (d.noglobstar === !0) {
ae(R);
continue;
}
let n = L.prev, r = n.prev, i = n.type === "slash" || n.type === "bos", a = r && (r.type === "star" || r.type === "globstar");
if (d.bash === !0 && (!i || t[0] && t[0] !== "/")) {
W({
type: "star",
value: R,
output: ""
});
continue;
}
let o = P.braces > 0 && (n.type === "comma" || n.type === "brace"), s = F.length && (n.type === "pipe" || n.type === "paren");
if (!i && n.type !== "paren" && !o && !s) {
W({
type: "star",
value: R,
output: ""
});
continue;
}
for (; t.slice(0, 3) === "/**";) {
let n = e[P.index + 4];
if (n && n !== "/") break;
t = t.slice(3), ae("/**", 3);
}
if (n.type === "bos" && z()) {
L.type = "globstar", L.value += R, L.output = te(d), P.output = L.output, P.globstar = !0, ae(R);
continue;
}
if (n.type === "slash" && n.prev.type !== "bos" && !a && z()) {
P.output = P.output.slice(0, -(n.output + L.output).length), n.output = `(?:${n.output}`, L.type = "globstar", L.output = te(d) + (d.strictSlashes ? ")" : "|$)"), L.value += R, P.globstar = !0, P.output += n.output + L.output, ae(R);
continue;
}
if (n.type === "slash" && n.prev.type !== "bos" && t[0] === "/") {
let e = t[1] === void 0 ? "" : "|$";
P.output = P.output.slice(0, -(n.output + L.output).length), n.output = `(?:${n.output}`, L.type = "globstar", L.output = `${te(d)}${w}|${w}${e})`, L.value += R, P.output += n.output + L.output, P.globstar = !0, ae(R + V()), W({
type: "slash",
value: "/",
output: ""
});
continue;
}
if (n.type === "bos" && t[0] === "/") {
L.type = "globstar", L.value += R, L.output = `(?:^|${w}|${te(d)}${w})`, P.output = L.output, P.globstar = !0, ae(R + V()), W({
type: "slash",
value: "/",
output: ""
});
continue;
}
P.output = P.output.slice(0, -L.output.length), L.type = "globstar", L.output = te(d), L.value += R, P.output += L.output, P.globstar = !0, ae(R);
continue;
}
let n = {
type: "star",
value: R,
output: N
};
if (d.bash === !0) {
n.output = ".*?", (L.type === "bos" || L.type === "slash") && (n.output = ne + n.output), W(n);
continue;
}
if (L && (L.type === "bracket" || L.type === "paren") && d.regex === !0) {
n.output = R, W(n);
continue;
}
(P.index === P.start || L.type === "slash" || L.type === "dot") && (L.type === "dot" ? (P.output += O, L.output += O) : d.dot === !0 ? (P.output += k, L.output += k) : (P.output += ne, L.output += ne), B() !== "*" && (P.output += T, L.output += T)), W(n);
}
for (; P.brackets > 0;) {
if (d.strictBrackets === !0) throw SyntaxError(u("closing", "]"));
P.output = r.escapeLast(P.output, "["), U("brackets");
}
for (; P.parens > 0;) {
if (d.strictBrackets === !0) throw SyntaxError(u("closing", ")"));
P.output = r.escapeLast(P.output, "("), U("parens");
}
for (; P.braces > 0;) {
if (d.strictBrackets === !0) throw SyntaxError(u("closing", "}"));
P.output = r.escapeLast(P.output, "{"), U("braces");
}
if (d.strictSlashes !== !0 && (L.type === "star" || L.type === "bracket") && W({
type: "maybe_slash",
value: "",
output: `${w}?`
}), P.backtrack === !0) {
P.output = "";
for (let e of P.tokens) P.output += e.output == null ? e.value : e.output, e.suffix && (P.output += e.suffix);
}
return P;
};
y.fastpaths = (e, t) => {
let a = { ...t }, o = typeof a.maxLength == "number" ? Math.min(i, a.maxLength) : i, s = e.length;
if (s > o) throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);
e = c[e] || e;
let l = r.isWindows(t), { DOT_LITERAL: u, SLASH_LITERAL: d, ONE_CHAR: f, DOTS_SLASH: p, NO_DOT: m, NO_DOTS: h, NO_DOTS_SLASH: g, STAR: _, START_ANCHOR: v } = n.globChars(l), y = a.dot ? h : m, b = a.dot ? g : m, x = a.capture ? "" : "?:", S = {
negated: !1,
prefix: ""
}, C = a.bash === !0 ? ".*?" : _;
a.capture && (C = `(${C})`);
let w = (e) => e.noglobstar === !0 ? C : `(${x}(?:(?!${v}${e.dot ? p : u}).)*?)`, T = (e) => {
switch (e) {
case "*": return `${y}${f}${C}`;
case ".*": return `${u}${f}${C}`;
case "*.*": return `${y}${C}${u}${f}${C}`;
case "*/*": return `${y}${C}${d}${f}${b}${C}`;
case "**": return y + w(a);
case "**/*": return `(?:${y}${w(a)}${d})?${b}${f}${C}`;
case "**/*.*": return `(?:${y}${w(a)}${d})?${b}${C}${u}${f}${C}`;
case "**/.*": return `(?:${y}${w(a)}${d})?${u}${f}${C}`;
default: {
let t = /^(.*?)\.(\w+)$/.exec(e);
if (!t) return;
let n = T(t[1]);
return n ? n + u + t[2] : void 0;
}
}
}, E = T(r.removePrefix(e, S));
return E && a.strictSlashes !== !0 && (E += `${d}?`), E;
}, t.exports = y;
})), _d = /* @__PURE__ */ i(((t, n) => {
var r = e("path"), i = hd(), a = gd(), o = md(), s = pd(), c = (e) => e && typeof e == "object" && !Array.isArray(e), l = (e, t, n = !1) => {
if (Array.isArray(e)) {
let r = e.map((e) => l(e, t, n));
return (e) => {
for (let t of r) {
let n = t(e);
if (n) return n;
}
return !1;
};
}
let r = c(e) && e.tokens && e.input;
if (e === "" || typeof e != "string" && !r) throw TypeError("Expected pattern to be a non-empty string");
let i = t || {}, a = o.isWindows(t), s = r ? l.compileRe(e, t) : l.makeRe(e, t, !1, !0), u = s.state;
delete s.state;
let d = () => !1;
if (i.ignore) {
let e = {
...t,
ignore: null,
onMatch: null,
onResult: null
};
d = l(i.ignore, e, n);
}
let f = (n, r = !1) => {
let { isMatch: o, match: c, output: f } = l.test(n, s, t, {
glob: e,
posix: a
}), p = {
glob: e,
state: u,
regex: s,
posix: a,
input: n,
output: f,
match: c,
isMatch: o
};
return typeof i.onResult == "function" && i.onResult(p), o === !1 ? (p.isMatch = !1, r ? p : !1) : d(n) ? (typeof i.onIgnore == "function" && i.onIgnore(p), p.isMatch = !1, r ? p : !1) : (typeof i.onMatch == "function" && i.onMatch(p), !r || p);
};
return n && (f.state = u), f;
};
l.test = (e, t, n, { glob: r, posix: i } = {}) => {
if (typeof e != "string") throw TypeError("Expected input to be a string");
if (e === "") return {
isMatch: !1,
output: ""
};
let a = n || {}, s = a.format || (i ? o.toPosixSlashes : null), c = e === r, u = c && s ? s(e) : e;
return c === !1 && (u = s ? s(e) : e, c = u === r), (c === !1 || a.capture === !0) && (c = a.matchBase === !0 || a.basename === !0 ? l.matchBase(e, t, n, i) : t.exec(u)), {
isMatch: !!c,
match: c,
output: u
};
}, l.matchBase = (e, t, n, i = o.isWindows(n)) => (t instanceof RegExp ? t : l.makeRe(t, n)).test(r.basename(e)), l.isMatch = (e, t, n) => l(t, n)(e), l.parse = (e, t) => Array.isArray(e) ? e.map((e) => l.parse(e, t)) : a(e, {
...t,
fastpaths: !1
}), l.scan = (e, t) => i(e, t), l.compileRe = (e, t, n = !1, r = !1) => {
if (n === !0) return e.output;
let i = t || {}, a = i.contains ? "" : "^", o = i.contains ? "" : "$", s = `${a}(?:${e.output})${o}`;
e && e.negated === !0 && (s = `^(?!${s}).*$`);
let c = l.toRegex(s, t);
return r === !0 && (c.state = e), c;
}, l.makeRe = (e, t = {}, n = !1, r = !1) => {
if (!e || typeof e != "string") throw TypeError("Expected a non-empty string");
let i = {
negated: !1,
fastpaths: !0
};
return t.fastpaths !== !1 && (e[0] === "." || e[0] === "*") && (i.output = a.fastpaths(e, t)), i.output || (i = a(e, t)), l.compileRe(i, t, n, r);
}, l.toRegex = (e, t) => {
try {
let n = t || {};
return new RegExp(e, n.flags || (n.nocase ? "i" : ""));
} catch (e) {
if (t && t.debug === !0) throw e;
return /$^/;
}
}, l.constants = s, n.exports = l;
})), vd = /* @__PURE__ */ i(((e, t) => {
t.exports = _d();
})), yd = /* @__PURE__ */ i(((t, n) => {
var r = e("util"), i = fd(), a = vd(), o = md(), s = (e) => e === "" || e === "./", c = (e) => {
let t = e.indexOf("{");
return t > -1 && e.indexOf("}", t) > -1;
}, l = (e, t, n) => {
t = [].concat(t), e = [].concat(e);
let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = 0, c = (e) => {
o.add(e.output), n && n.onResult && n.onResult(e);
};
for (let o = 0; o < t.length; o++) {
let l = a(String(t[o]), {
...n,
onResult: c
}, !0), u = l.state.negated || l.state.negatedExtglob;
u && s++;
for (let t of e) {
let e = l(t, !0);
(u ? !e.isMatch : e.isMatch) && (u ? r.add(e.output) : (r.delete(e.output), i.add(e.output)));
}
}
let l = (s === t.length ? [...o] : [...i]).filter((e) => !r.has(e));
if (n && l.length === 0) {
if (n.failglob === !0) throw Error(`No matches found for "${t.join(", ")}"`);
if (n.nonull === !0 || n.nullglob === !0) return n.unescape ? t.map((e) => e.replace(/\\/g, "")) : t;
}
return l;
};
l.match = l, l.matcher = (e, t) => a(e, t), l.isMatch = (e, t, n) => a(t, n)(e), l.any = l.isMatch, l.not = (e, t, n = {}) => {
t = [].concat(t).map(String);
let r = /* @__PURE__ */ new Set(), i = [], a = (e) => {
n.onResult && n.onResult(e), i.push(e.output);
}, o = new Set(l(e, t, {
...n,
onResult: a
}));
for (let e of i) o.has(e) || r.add(e);
return [...r];
}, l.contains = (e, t, n) => {
if (typeof e != "string") throw TypeError(`Expected a string: "${r.inspect(e)}"`);
if (Array.isArray(t)) return t.some((t) => l.contains(e, t, n));
if (typeof t == "string") {
if (s(e) || s(t)) return !1;
if (e.includes(t) || e.startsWith("./") && e.slice(2).includes(t)) return !0;
}
return l.isMatch(e, t, {
...n,
contains: !0
});
}, l.matchKeys = (e, t, n) => {
if (!o.isObject(e)) throw TypeError("Expected the first argument to be an object");
let r = l(Object.keys(e), t, n), i = {};
for (let t of r) i[t] = e[t];
return i;
}, l.some = (e, t, n) => {
let r = [].concat(e);
for (let e of [].concat(t)) {
let t = a(String(e), n);
if (r.some((e) => t(e))) return !0;
}
return !1;
}, l.every = (e, t, n) => {
let r = [].concat(e);
for (let e of [].concat(t)) {
let t = a(String(e), n);
if (!r.every((e) => t(e))) return !1;
}
return !0;
}, l.all = (e, t, n) => {
if (typeof e != "string") throw TypeError(`Expected a string: "${r.inspect(e)}"`);
return [].concat(t).every((t) => a(t, n)(e));
}, l.capture = (e, t, n) => {
let r = o.isWindows(n), i = a.makeRe(String(e), {
...n,
capture: !0
}).exec(r ? o.toPosixSlashes(t) : t);
if (i) return i.slice(1).map((e) => e === void 0 ? "" : e);
}, l.makeRe = (...e) => a.makeRe(...e), l.scan = (...e) => a.scan(...e), l.parse = (e, t) => {
let n = [];
for (let r of [].concat(e || [])) for (let e of i(String(r), t)) n.push(a.parse(e, t));
return n;
}, l.braces = (e, t) => {
if (typeof e != "string") throw TypeError("Expected a string");
return t && t.nobrace === !0 || !c(e) ? [e] : i(e, t);
}, l.braceExpand = (e, t) => {
if (typeof e != "string") throw TypeError("Expected a string");
return l.braces(e, {
...t,
expand: !0
});
}, l.hasBraces = c, n.exports = l;
})), bd = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 }), t.isAbsolute = t.partitionAbsoluteAndRelative = t.removeDuplicateSlashes = t.matchAny = t.convertPatternsToRe = t.makeRe = t.getPatternParts = t.expandBraceExpansion = t.expandPatternsWithBraceExpansion = t.isAffectDepthOfReadingPattern = t.endsWithSlashGlobStar = t.hasGlobStar = t.getBaseDirectory = t.isPatternRelatedToParentDirectory = t.getPatternsOutsideCurrentDirectory = t.getPatternsInsideCurrentDirectory = t.getPositivePatterns = t.getNegativePatterns = t.isPositivePattern = t.isNegativePattern = t.convertToNegativePattern = t.convertToPositivePattern = t.isDynamicPattern = t.isStaticPattern = void 0;
var n = e("path"), r = nd(), i = yd(), a = "**", o = "\\", s = /[*?]|^!/, c = /\[[^[]*]/, l = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/, u = /[!*+?@]\([^(]*\)/, d = /,|\.\./, f = /(?!^)\/{2,}/g;
function p(e, t = {}) {
return !m(e, t);
}
t.isStaticPattern = p;
function m(e, t = {}) {
return e !== "" && !!(t.caseSensitiveMatch === !1 || e.includes(o) || s.test(e) || c.test(e) || l.test(e) || t.extglob !== !1 && u.test(e) || t.braceExpansion !== !1 && h(e));
}
t.isDynamicPattern = m;
function h(e) {
let t = e.indexOf("{");
if (t === -1) return !1;
let n = e.indexOf("}", t + 1);
if (n === -1) return !1;
let r = e.slice(t, n);
return d.test(r);
}
function g(e) {
return v(e) ? e.slice(1) : e;
}
t.convertToPositivePattern = g;
function _(e) {
return "!" + e;
}
t.convertToNegativePattern = _;
function v(e) {
return e.startsWith("!") && e[1] !== "(";
}
t.isNegativePattern = v;
function y(e) {
return !v(e);
}
t.isPositivePattern = y;
function b(e) {
return e.filter(v);
}
t.getNegativePatterns = b;
function x(e) {
return e.filter(y);
}
t.getPositivePatterns = x;
function S(e) {
return e.filter((e) => !w(e));
}
t.getPatternsInsideCurrentDirectory = S;
function C(e) {
return e.filter(w);
}
t.getPatternsOutsideCurrentDirectory = C;
function w(e) {
return e.startsWith("..") || e.startsWith("./..");
}
t.isPatternRelatedToParentDirectory = w;
function T(e) {
return r(e, { flipBackslashes: !1 });
}
t.getBaseDirectory = T;
function E(e) {
return e.includes(a);
}
t.hasGlobStar = E;
function D(e) {
return e.endsWith("/**");
}
t.endsWithSlashGlobStar = D;
function O(e) {
let t = n.basename(e);
return D(e) || p(t);
}
t.isAffectDepthOfReadingPattern = O;
function k(e) {
return e.reduce((e, t) => e.concat(A(t)), []);
}
t.expandPatternsWithBraceExpansion = k;
function A(e) {
let t = i.braces(e, {
expand: !0,
nodupes: !0,
keepEscaping: !0
});
return t.sort((e, t) => e.length - t.length), t.filter((e) => e !== "");
}
t.expandBraceExpansion = A;
function ee(e, t) {
let { parts: n } = i.scan(e, Object.assign(Object.assign({}, t), { parts: !0 }));
return n.length === 0 && (n = [e]), n[0].startsWith("/") && (n[0] = n[0].slice(1), n.unshift("")), n;
}
t.getPatternParts = ee;
function j(e, t) {
return i.makeRe(e, t);
}
t.makeRe = j;
function M(e, t) {
return e.map((e) => j(e, t));
}
t.convertPatternsToRe = M;
function te(e, t) {
return t.some((t) => t.test(e));
}
t.matchAny = te;
function ne(e) {
return e.replace(f, "/");
}
t.removeDuplicateSlashes = ne;
function re(e) {
let t = [], n = [];
for (let r of e) N(r) ? t.push(r) : n.push(r);
return [t, n];
}
t.partitionAbsoluteAndRelative = re;
function N(e) {
return n.isAbsolute(e);
}
t.isAbsolute = N;
})), xd = /* @__PURE__ */ i(((t, n) => {
var r = e("stream").PassThrough, i = Array.prototype.slice;
n.exports = a;
function a() {
let e = [], t = i.call(arguments), n = !1, a = t[t.length - 1];
a && !Array.isArray(a) && a.pipe == null ? t.pop() : a = {};
let s = a.end !== !1, c = a.pipeError === !0;
a.objectMode ?? (a.objectMode = !0), a.highWaterMark ?? (a.highWaterMark = 65536);
let l = r(a);
function u() {
for (let t = 0, n = arguments.length; t < n; t++) e.push(o(arguments[t], a));
return d(), this;
}
function d() {
if (n) return;
n = !0;
let t = e.shift();
if (!t) {
process.nextTick(f);
return;
}
Array.isArray(t) || (t = [t]);
let r = t.length + 1;
function i() {
--r > 0 || (n = !1, d());
}
function a(e) {
function t() {
e.removeListener("merge2UnpipeEnd", t), e.removeListener("end", t), c && e.removeListener("error", n), i();
}
function n(e) {
l.emit("error", e);
}
if (e._readableState.endEmitted) return i();
e.on("merge2UnpipeEnd", t), e.on("end", t), c && e.on("error", n), e.pipe(l, { end: !1 }), e.resume();
}
for (let e = 0; e < t.length; e++) a(t[e]);
i();
}
function f() {
n = !1, l.emit("queueDrain"), s && l.end();
}
return l.setMaxListeners(0), l.add = u, l.on("unpipe", function(e) {
e.emit("merge2UnpipeEnd");
}), t.length && u.apply(null, t), l;
}
function o(e, t) {
if (Array.isArray(e)) for (let n = 0, r = e.length; n < r; n++) e[n] = o(e[n], t);
else {
if (!e._readableState && e.pipe && (e = e.pipe(r(t))), !e._readableState || !e.pause || !e.pipe) throw Error("Only readable stream can be merged.");
e.pause();
}
return e;
}
})), Sd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.merge = void 0;
var t = xd();
function n(e) {
let n = t(e);
return e.forEach((e) => {
e.once("error", (e) => n.emit("error", e));
}), n.once("close", () => r(e)), n.once("end", () => r(e)), n;
}
e.merge = n;
function r(e) {
e.forEach((e) => e.emit("close"));
}
})), Cd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.isEmpty = e.isString = void 0;
function t(e) {
return typeof e == "string";
}
e.isString = t;
function n(e) {
return e === "";
}
e.isEmpty = n;
})), wd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.string = e.stream = e.pattern = e.path = e.fs = e.errno = e.array = void 0, e.array = Xu(), e.errno = Zu(), e.fs = Qu(), e.path = $u(), e.pattern = bd(), e.stream = Sd(), e.string = Cd();
})), Td = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.convertPatternGroupToTask = e.convertPatternGroupsToTasks = e.groupPatternsByBaseDirectory = e.getNegativePatternsAsPositive = e.getPositivePatterns = e.convertPatternsToTasks = e.generate = void 0;
var t = wd();
function n(e, n) {
let s = r(e, n), c = r(n.ignore, n), l = a(s), u = o(s, c), d = l.filter((e) => t.pattern.isStaticPattern(e, n)), f = l.filter((e) => t.pattern.isDynamicPattern(e, n)), p = i(d, u, !1), m = i(f, u, !0);
return p.concat(m);
}
e.generate = n;
function r(e, n) {
let r = e;
return n.braceExpansion && (r = t.pattern.expandPatternsWithBraceExpansion(r)), n.baseNameMatch && (r = r.map((e) => e.includes("/") ? e : `**/${e}`)), r.map((e) => t.pattern.removeDuplicateSlashes(e));
}
function i(e, n, r) {
let i = [], a = t.pattern.getPatternsOutsideCurrentDirectory(e), o = t.pattern.getPatternsInsideCurrentDirectory(e), u = s(a), d = s(o);
return i.push(...c(u, n, r)), "." in d ? i.push(l(".", o, n, r)) : i.push(...c(d, n, r)), i;
}
e.convertPatternsToTasks = i;
function a(e) {
return t.pattern.getPositivePatterns(e);
}
e.getPositivePatterns = a;
function o(e, n) {
return t.pattern.getNegativePatterns(e).concat(n).map(t.pattern.convertToPositivePattern);
}
e.getNegativePatternsAsPositive = o;
function s(e) {
return e.reduce((e, n) => {
let r = t.pattern.getBaseDirectory(n);
return r in e ? e[r].push(n) : e[r] = [n], e;
}, {});
}
e.groupPatternsByBaseDirectory = s;
function c(e, t, n) {
return Object.keys(e).map((r) => l(r, e[r], t, n));
}
e.convertPatternGroupsToTasks = c;
function l(e, n, r, i) {
return {
dynamic: i,
positive: n,
negative: r,
base: e,
patterns: [].concat(n, r.map(t.pattern.convertToNegativePattern))
};
}
e.convertPatternGroupToTask = l;
})), Ed = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.read = void 0;
function t(e, t, i) {
t.fs.lstat(e, (a, o) => {
if (a !== null) {
n(i, a);
return;
}
if (!o.isSymbolicLink() || !t.followSymbolicLink) {
r(i, o);
return;
}
t.fs.stat(e, (e, a) => {
if (e !== null) {
if (t.throwErrorOnBrokenSymbolicLink) {
n(i, e);
return;
}
r(i, o);
return;
}
t.markSymbolicLink && (a.isSymbolicLink = () => !0), r(i, a);
});
});
}
e.read = t;
function n(e, t) {
e(t);
}
function r(e, t) {
e(null, t);
}
})), Dd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.read = void 0;
function t(e, t) {
let n = t.fs.lstatSync(e);
if (!n.isSymbolicLink() || !t.followSymbolicLink) return n;
try {
let n = t.fs.statSync(e);
return t.markSymbolicLink && (n.isSymbolicLink = () => !0), n;
} catch (e) {
if (!t.throwErrorOnBrokenSymbolicLink) return n;
throw e;
}
}
e.read = t;
})), Od = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 }), t.createFileSystemAdapter = t.FILE_SYSTEM_ADAPTER = void 0;
var n = e("fs");
t.FILE_SYSTEM_ADAPTER = {
lstat: n.lstat,
stat: n.stat,
lstatSync: n.lstatSync,
statSync: n.statSync
};
function r(e) {
return e === void 0 ? t.FILE_SYSTEM_ADAPTER : Object.assign(Object.assign({}, t.FILE_SYSTEM_ADAPTER), e);
}
t.createFileSystemAdapter = r;
})), kd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = Od();
e.default = class {
constructor(e = {}) {
this._options = e, this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, !0), this.fs = t.createFileSystemAdapter(this._options.fs), this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, !1), this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, !0);
}
_getValue(e, t) {
return e ?? t;
}
};
})), Ad = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.statSync = e.stat = e.Settings = void 0;
var t = Ed(), n = Dd(), r = kd();
e.Settings = r.default;
function i(e, n, r) {
if (typeof n == "function") {
t.read(e, o(), n);
return;
}
t.read(e, o(n), r);
}
e.stat = i;
function a(e, t) {
let r = o(t);
return n.read(e, r);
}
e.statSync = a;
function o(e = {}) {
return e instanceof r.default ? e : new r.default(e);
}
})), jd = /* @__PURE__ */ i(((e, t) => {
var n;
t.exports = typeof queueMicrotask == "function" ? queueMicrotask.bind(typeof window < "u" ? window : global) : (e) => (n ||= Promise.resolve()).then(e).catch((e) => setTimeout(() => {
throw e;
}, 0));
})), Md = /* @__PURE__ */ i(((e, t) => {
t.exports = r;
var n = jd();
function r(e, t) {
let r, i, a, o = !0;
Array.isArray(e) ? (r = [], i = e.length) : (a = Object.keys(e), r = {}, i = a.length);
function s(e) {
function i() {
t && t(e, r), t = null;
}
o ? n(i) : i();
}
function c(e, t, n) {
r[e] = n, (--i === 0 || t) && s(t);
}
i ? a ? a.forEach(function(t) {
e[t](function(e, n) {
c(t, e, n);
});
}) : e.forEach(function(e, t) {
e(function(e, n) {
c(t, e, n);
});
}) : s(null), o = !1;
}
})), Nd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
var t = process.versions.node.split(".");
if (t[0] === void 0 || t[1] === void 0) throw Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
var n = Number.parseInt(t[0], 10), r = Number.parseInt(t[1], 10), i = 10;
e.IS_SUPPORT_READDIR_WITH_FILE_TYPES = n > i || n === i && r >= 10;
})), Pd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.createDirentFromStats = void 0;
var t = class {
constructor(e, t) {
this.name = e, this.isBlockDevice = t.isBlockDevice.bind(t), this.isCharacterDevice = t.isCharacterDevice.bind(t), this.isDirectory = t.isDirectory.bind(t), this.isFIFO = t.isFIFO.bind(t), this.isFile = t.isFile.bind(t), this.isSocket = t.isSocket.bind(t), this.isSymbolicLink = t.isSymbolicLink.bind(t);
}
};
function n(e, n) {
return new t(e, n);
}
e.createDirentFromStats = n;
})), Fd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.fs = void 0, e.fs = Pd();
})), Id = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.joinPathSegments = void 0;
function t(e, t, n) {
return e.endsWith(n) ? e + t : e + n + t;
}
e.joinPathSegments = t;
})), Ld = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.readdir = e.readdirWithFileTypes = e.read = void 0;
var t = Ad(), n = Md(), r = Nd(), i = Fd(), a = Id();
function o(e, t, n) {
if (!t.stats && r.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
s(e, t, n);
return;
}
l(e, t, n);
}
e.read = o;
function s(e, t, r) {
t.fs.readdir(e, { withFileTypes: !0 }, (i, o) => {
if (i !== null) {
u(r, i);
return;
}
let s = o.map((n) => ({
dirent: n,
name: n.name,
path: a.joinPathSegments(e, n.name, t.pathSegmentSeparator)
}));
if (!t.followSymbolicLinks) {
d(r, s);
return;
}
n(s.map((e) => c(e, t)), (e, t) => {
if (e !== null) {
u(r, e);
return;
}
d(r, t);
});
});
}
e.readdirWithFileTypes = s;
function c(e, t) {
return (n) => {
if (!e.dirent.isSymbolicLink()) {
n(null, e);
return;
}
t.fs.stat(e.path, (r, a) => {
if (r !== null) {
if (t.throwErrorOnBrokenSymbolicLink) {
n(r);
return;
}
n(null, e);
return;
}
e.dirent = i.fs.createDirentFromStats(e.name, a), n(null, e);
});
};
}
function l(e, r, o) {
r.fs.readdir(e, (s, c) => {
if (s !== null) {
u(o, s);
return;
}
n(c.map((n) => {
let o = a.joinPathSegments(e, n, r.pathSegmentSeparator);
return (e) => {
t.stat(o, r.fsStatSettings, (t, a) => {
if (t !== null) {
e(t);
return;
}
let s = {
name: n,
path: o,
dirent: i.fs.createDirentFromStats(n, a)
};
r.stats && (s.stats = a), e(null, s);
});
};
}), (e, t) => {
if (e !== null) {
u(o, e);
return;
}
d(o, t);
});
});
}
e.readdir = l;
function u(e, t) {
e(t);
}
function d(e, t) {
e(null, t);
}
})), Rd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.readdir = e.readdirWithFileTypes = e.read = void 0;
var t = Ad(), n = Nd(), r = Fd(), i = Id();
function a(e, t) {
return !t.stats && n.IS_SUPPORT_READDIR_WITH_FILE_TYPES ? o(e, t) : s(e, t);
}
e.read = a;
function o(e, t) {
return t.fs.readdirSync(e, { withFileTypes: !0 }).map((n) => {
let a = {
dirent: n,
name: n.name,
path: i.joinPathSegments(e, n.name, t.pathSegmentSeparator)
};
if (a.dirent.isSymbolicLink() && t.followSymbolicLinks) try {
let e = t.fs.statSync(a.path);
a.dirent = r.fs.createDirentFromStats(a.name, e);
} catch (e) {
if (t.throwErrorOnBrokenSymbolicLink) throw e;
}
return a;
});
}
e.readdirWithFileTypes = o;
function s(e, n) {
return n.fs.readdirSync(e).map((a) => {
let o = i.joinPathSegments(e, a, n.pathSegmentSeparator), s = t.statSync(o, n.fsStatSettings), c = {
name: a,
path: o,
dirent: r.fs.createDirentFromStats(a, s)
};
return n.stats && (c.stats = s), c;
});
}
e.readdir = s;
})), zd = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 }), t.createFileSystemAdapter = t.FILE_SYSTEM_ADAPTER = void 0;
var n = e("fs");
t.FILE_SYSTEM_ADAPTER = {
lstat: n.lstat,
stat: n.stat,
lstatSync: n.lstatSync,
statSync: n.statSync,
readdir: n.readdir,
readdirSync: n.readdirSync
};
function r(e) {
return e === void 0 ? t.FILE_SYSTEM_ADAPTER : Object.assign(Object.assign({}, t.FILE_SYSTEM_ADAPTER), e);
}
t.createFileSystemAdapter = r;
})), Bd = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("path"), r = Ad(), i = zd();
t.default = class {
constructor(e = {}) {
this._options = e, this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, !1), this.fs = i.createFileSystemAdapter(this._options.fs), this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, n.sep), this.stats = this._getValue(this._options.stats, !1), this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, !0), this.fsStatSettings = new r.Settings({
followSymbolicLink: this.followSymbolicLinks,
fs: this.fs,
throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
});
}
_getValue(e, t) {
return e ?? t;
}
};
})), Vd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.Settings = e.scandirSync = e.scandir = void 0;
var t = Ld(), n = Rd(), r = Bd();
e.Settings = r.default;
function i(e, n, r) {
if (typeof n == "function") {
t.read(e, o(), n);
return;
}
t.read(e, o(n), r);
}
e.scandir = i;
function a(e, t) {
let r = o(t);
return n.read(e, r);
}
e.scandirSync = a;
function o(e = {}) {
return e instanceof r.default ? e : new r.default(e);
}
})), Hd = /* @__PURE__ */ i(((e, t) => {
function n(e) {
var t = new e(), n = t;
function r() {
var r = t;
return r.next ? t = r.next : (t = new e(), n = t), r.next = null, r;
}
function i(e) {
n.next = e, n = e;
}
return {
get: r,
release: i
};
}
t.exports = n;
})), Ud = /* @__PURE__ */ i(((e, t) => {
var n = Hd();
function r(e, t, r) {
if (typeof e == "function" && (r = t, t = e, e = null), !(r >= 1)) throw Error("fastqueue concurrency must be equal to or greater than 1");
var o = n(a), s = null, c = null, l = 0, u = null, d = {
push: v,
drain: i,
saturated: i,
pause: p,
paused: !1,
get concurrency() {
return r;
},
set concurrency(e) {
if (!(e >= 1)) throw Error("fastqueue concurrency must be equal to or greater than 1");
if (r = e, !d.paused) for (; s && l < r;) l++, b();
},
running: f,
resume: g,
idle: _,
length: m,
getQueue: h,
unshift: y,
empty: i,
kill: x,
killAndDrain: S,
error: w,
abort: C
};
return d;
function f() {
return l;
}
function p() {
d.paused = !0;
}
function m() {
for (var e = s, t = 0; e;) e = e.next, t++;
return t;
}
function h() {
for (var e = s, t = []; e;) t.push(e.value), e = e.next;
return t;
}
function g() {
if (d.paused) {
if (d.paused = !1, s === null) {
l++, b();
return;
}
for (; s && l < r;) l++, b();
}
}
function _() {
return l === 0 && d.length() === 0;
}
function v(n, a) {
var f = o.get();
f.context = e, f.release = b, f.value = n, f.callback = a || i, f.errorHandler = u, l >= r || d.paused ? c ? (c.next = f, c = f) : (s = f, c = f, d.saturated()) : (l++, t.call(e, f.value, f.worked));
}
function y(n, a) {
var f = o.get();
f.context = e, f.release = b, f.value = n, f.callback = a || i, f.errorHandler = u, l >= r || d.paused ? s ? (f.next = s, s = f) : (s = f, c = f, d.saturated()) : (l++, t.call(e, f.value, f.worked));
}
function b(n) {
n && o.release(n);
var i = s;
i && l <= r ? d.paused ? l-- : (c === s && (c = null), s = i.next, i.next = null, t.call(e, i.value, i.worked), c === null && d.empty()) : --l === 0 && d.drain();
}
function x() {
s = null, c = null, d.drain = i;
}
function S() {
s = null, c = null, d.drain(), d.drain = i;
}
function C() {
var e = s;
for (s = null, c = null; e;) {
var t = e.next, n = e.callback, r = e.errorHandler, a = e.value, o = e.context;
e.value = null, e.callback = i, e.errorHandler = null, r && r(/* @__PURE__ */ Error("abort"), a), n.call(o, /* @__PURE__ */ Error("abort")), e.release(e), e = t;
}
d.drain = i;
}
function w(e) {
u = e;
}
}
function i() {}
function a() {
this.value = null, this.callback = i, this.next = null, this.release = i, this.context = null, this.errorHandler = null;
var e = this;
this.worked = function(t, n) {
var r = e.callback, a = e.errorHandler, o = e.value;
e.value = null, e.callback = i, e.errorHandler && a(t, o), r.call(e.context, t, n), e.release(e);
};
}
function o(e, t, n) {
typeof e == "function" && (n = t, t = e, e = null);
function a(e, n) {
t.call(this, e).then(function(e) {
n(null, e);
}, n);
}
var o = r(e, a, n), s = o.push, c = o.unshift;
return o.push = l, o.unshift = u, o.drained = d, o;
function l(e) {
var t = new Promise(function(t, n) {
s(e, function(e, r) {
if (e) {
n(e);
return;
}
t(r);
});
});
return t.catch(i), t;
}
function u(e) {
var t = new Promise(function(t, n) {
c(e, function(e, r) {
if (e) {
n(e);
return;
}
t(r);
});
});
return t.catch(i), t;
}
function d() {
return new Promise(function(e) {
process.nextTick(function() {
if (o.idle()) e();
else {
var t = o.drain;
o.drain = function() {
typeof t == "function" && t(), e(), o.drain = t;
};
}
});
});
}
}
t.exports = r, t.exports.promise = o;
})), Wd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.joinPathSegments = e.replacePathSegmentSeparator = e.isAppliedFilter = e.isFatalError = void 0;
function t(e, t) {
return e.errorFilter === null || !e.errorFilter(t);
}
e.isFatalError = t;
function n(e, t) {
return e === null || e(t);
}
e.isAppliedFilter = n;
function r(e, t) {
return e.split(/[/\\]/).join(t);
}
e.replacePathSegmentSeparator = r;
function i(e, t, n) {
return e === "" ? t : e.endsWith(n) ? e + t : e + n + t;
}
e.joinPathSegments = i;
})), Gd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = Wd();
e.default = class {
constructor(e, n) {
this._root = e, this._settings = n, this._root = t.replacePathSegmentSeparator(e, n.pathSegmentSeparator);
}
};
})), Kd = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("events"), r = Vd(), i = Ud(), a = Wd(), o = Gd();
t.default = class extends o.default {
constructor(e, t) {
super(e, t), this._settings = t, this._scandir = r.scandir, this._emitter = new n.EventEmitter(), this._queue = i(this._worker.bind(this), this._settings.concurrency), this._isFatalError = !1, this._isDestroyed = !1, this._queue.drain = () => {
this._isFatalError || this._emitter.emit("end");
};
}
read() {
return this._isFatalError = !1, this._isDestroyed = !1, setImmediate(() => {
this._pushToQueue(this._root, this._settings.basePath);
}), this._emitter;
}
get isDestroyed() {
return this._isDestroyed;
}
destroy() {
if (this._isDestroyed) throw Error("The reader is already destroyed");
this._isDestroyed = !0, this._queue.killAndDrain();
}
onEntry(e) {
this._emitter.on("entry", e);
}
onError(e) {
this._emitter.once("error", e);
}
onEnd(e) {
this._emitter.once("end", e);
}
_pushToQueue(e, t) {
let n = {
directory: e,
base: t
};
this._queue.push(n, (e) => {
e !== null && this._handleError(e);
});
}
_worker(e, t) {
this._scandir(e.directory, this._settings.fsScandirSettings, (n, r) => {
if (n !== null) {
t(n, void 0);
return;
}
for (let t of r) this._handleEntry(t, e.base);
t(null, void 0);
});
}
_handleError(e) {
this._isDestroyed || !a.isFatalError(this._settings, e) || (this._isFatalError = !0, this._isDestroyed = !0, this._emitter.emit("error", e));
}
_handleEntry(e, t) {
if (this._isDestroyed || this._isFatalError) return;
let n = e.path;
t !== void 0 && (e.path = a.joinPathSegments(t, e.name, this._settings.pathSegmentSeparator)), a.isAppliedFilter(this._settings.entryFilter, e) && this._emitEntry(e), e.dirent.isDirectory() && a.isAppliedFilter(this._settings.deepFilter, e) && this._pushToQueue(n, t === void 0 ? void 0 : e.path);
}
_emitEntry(e) {
this._emitter.emit("entry", e);
}
};
})), qd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = Kd();
e.default = class {
constructor(e, n) {
this._root = e, this._settings = n, this._reader = new t.default(this._root, this._settings), this._storage = [];
}
read(e) {
this._reader.onError((t) => {
n(e, t);
}), this._reader.onEntry((e) => {
this._storage.push(e);
}), this._reader.onEnd(() => {
r(e, this._storage);
}), this._reader.read();
}
};
function n(e, t) {
e(t);
}
function r(e, t) {
e(null, t);
}
})), Jd = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("stream"), r = Kd();
t.default = class {
constructor(e, t) {
this._root = e, this._settings = t, this._reader = new r.default(this._root, this._settings), this._stream = new n.Readable({
objectMode: !0,
read: () => {},
destroy: () => {
this._reader.isDestroyed || this._reader.destroy();
}
});
}
read() {
return this._reader.onError((e) => {
this._stream.emit("error", e);
}), this._reader.onEntry((e) => {
this._stream.push(e);
}), this._reader.onEnd(() => {
this._stream.push(null);
}), this._reader.read(), this._stream;
}
};
})), Yd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = Vd(), n = Wd(), r = Gd();
e.default = class extends r.default {
constructor() {
super(...arguments), this._scandir = t.scandirSync, this._storage = [], this._queue = /* @__PURE__ */ new Set();
}
read() {
return this._pushToQueue(this._root, this._settings.basePath), this._handleQueue(), this._storage;
}
_pushToQueue(e, t) {
this._queue.add({
directory: e,
base: t
});
}
_handleQueue() {
for (let e of this._queue.values()) this._handleDirectory(e.directory, e.base);
}
_handleDirectory(e, t) {
try {
let n = this._scandir(e, this._settings.fsScandirSettings);
for (let e of n) this._handleEntry(e, t);
} catch (e) {
this._handleError(e);
}
}
_handleError(e) {
if (n.isFatalError(this._settings, e)) throw e;
}
_handleEntry(e, t) {
let r = e.path;
t !== void 0 && (e.path = n.joinPathSegments(t, e.name, this._settings.pathSegmentSeparator)), n.isAppliedFilter(this._settings.entryFilter, e) && this._pushToStorage(e), e.dirent.isDirectory() && n.isAppliedFilter(this._settings.deepFilter, e) && this._pushToQueue(r, t === void 0 ? void 0 : e.path);
}
_pushToStorage(e) {
this._storage.push(e);
}
};
})), Xd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = Yd();
e.default = class {
constructor(e, n) {
this._root = e, this._settings = n, this._reader = new t.default(this._root, this._settings);
}
read() {
return this._reader.read();
}
};
})), Zd = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("path"), r = Vd();
t.default = class {
constructor(e = {}) {
this._options = e, this.basePath = this._getValue(this._options.basePath, void 0), this.concurrency = this._getValue(this._options.concurrency, Infinity), this.deepFilter = this._getValue(this._options.deepFilter, null), this.entryFilter = this._getValue(this._options.entryFilter, null), this.errorFilter = this._getValue(this._options.errorFilter, null), this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, n.sep), this.fsScandirSettings = new r.Settings({
followSymbolicLinks: this._options.followSymbolicLinks,
fs: this._options.fs,
pathSegmentSeparator: this._options.pathSegmentSeparator,
stats: this._options.stats,
throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
});
}
_getValue(e, t) {
return e ?? t;
}
};
})), Qd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.Settings = e.walkStream = e.walkSync = e.walk = void 0;
var t = qd(), n = Jd(), r = Xd(), i = Zd();
e.Settings = i.default;
function a(e, n, r) {
if (typeof n == "function") {
new t.default(e, c()).read(n);
return;
}
new t.default(e, c(n)).read(r);
}
e.walk = a;
function o(e, t) {
let n = c(t);
return new r.default(e, n).read();
}
e.walkSync = o;
function s(e, t) {
let r = c(t);
return new n.default(e, r).read();
}
e.walkStream = s;
function c(e = {}) {
return e instanceof i.default ? e : new i.default(e);
}
})), $d = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("path"), r = Ad(), i = wd();
t.default = class {
constructor(e) {
this._settings = e, this._fsStatSettings = new r.Settings({
followSymbolicLink: this._settings.followSymbolicLinks,
fs: this._settings.fs,
throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
});
}
_getFullEntryPath(e) {
return n.resolve(this._settings.cwd, e);
}
_makeEntry(e, t) {
let n = {
name: t,
path: t,
dirent: i.fs.createDirentFromStats(t, e)
};
return this._settings.stats && (n.stats = e), n;
}
_isFatalError(e) {
return !i.errno.isEnoentCodeError(e) && !this._settings.suppressErrors;
}
};
})), ef = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("stream"), r = Ad(), i = Qd(), a = $d();
t.default = class extends a.default {
constructor() {
super(...arguments), this._walkStream = i.walkStream, this._stat = r.stat;
}
dynamic(e, t) {
return this._walkStream(e, t);
}
static(e, t) {
let r = e.map(this._getFullEntryPath, this), i = new n.PassThrough({ objectMode: !0 });
i._write = (n, a, o) => this._getEntry(r[n], e[n], t).then((e) => {
e !== null && t.entryFilter(e) && i.push(e), n === r.length - 1 && i.end(), o();
}).catch(o);
for (let e = 0; e < r.length; e++) i.write(e);
return i;
}
_getEntry(e, t, n) {
return this._getStat(e).then((e) => this._makeEntry(e, t)).catch((e) => {
if (n.errorFilter(e)) return null;
throw e;
});
}
_getStat(e) {
return new Promise((t, n) => {
this._stat(e, this._fsStatSettings, (e, r) => e === null ? t(r) : n(e));
});
}
};
})), tf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = Qd(), n = $d(), r = ef();
e.default = class extends n.default {
constructor() {
super(...arguments), this._walkAsync = t.walk, this._readerStream = new r.default(this._settings);
}
dynamic(e, t) {
return new Promise((n, r) => {
this._walkAsync(e, t, (e, t) => {
e === null ? n(t) : r(e);
});
});
}
async static(e, t) {
let n = [], r = this._readerStream.static(e, t);
return new Promise((e, t) => {
r.once("error", t), r.on("data", (e) => n.push(e)), r.once("end", () => e(n));
});
}
};
})), nf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = wd();
e.default = class {
constructor(e, t, n) {
this._patterns = e, this._settings = t, this._micromatchOptions = n, this._storage = [], this._fillStorage();
}
_fillStorage() {
for (let e of this._patterns) {
let t = this._getPatternSegments(e), n = this._splitSegmentsIntoSections(t);
this._storage.push({
complete: n.length <= 1,
pattern: e,
segments: t,
sections: n
});
}
}
_getPatternSegments(e) {
return t.pattern.getPatternParts(e, this._micromatchOptions).map((e) => t.pattern.isDynamicPattern(e, this._settings) ? {
dynamic: !0,
pattern: e,
patternRe: t.pattern.makeRe(e, this._micromatchOptions)
} : {
dynamic: !1,
pattern: e
});
}
_splitSegmentsIntoSections(e) {
return t.array.splitWhen(e, (e) => e.dynamic && t.pattern.hasGlobStar(e.pattern));
}
};
})), rf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = nf();
e.default = class extends t.default {
match(e) {
let t = e.split("/"), n = t.length, r = this._storage.filter((e) => !e.complete || e.segments.length > n);
for (let e of r) {
let r = e.sections[0];
if (!e.complete && n > r.length || t.every((t, n) => {
let r = e.segments[n];
return !!(r.dynamic && r.patternRe.test(t) || !r.dynamic && r.pattern === t);
})) return !0;
}
return !1;
}
};
})), af = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = wd(), n = rf();
e.default = class {
constructor(e, t) {
this._settings = e, this._micromatchOptions = t;
}
getFilter(e, t, n) {
let r = this._getMatcher(t), i = this._getNegativePatternsRe(n);
return (t) => this._filter(e, t, r, i);
}
_getMatcher(e) {
return new n.default(e, this._settings, this._micromatchOptions);
}
_getNegativePatternsRe(e) {
let n = e.filter(t.pattern.isAffectDepthOfReadingPattern);
return t.pattern.convertPatternsToRe(n, this._micromatchOptions);
}
_filter(e, n, r, i) {
if (this._isSkippedByDeep(e, n.path) || this._isSkippedSymbolicLink(n)) return !1;
let a = t.path.removeLeadingDotSegment(n.path);
return !this._isSkippedByPositivePatterns(a, r) && this._isSkippedByNegativePatterns(a, i);
}
_isSkippedByDeep(e, t) {
return this._settings.deep !== Infinity && this._getEntryLevel(e, t) >= this._settings.deep;
}
_getEntryLevel(e, t) {
let n = t.split("/").length;
return e === "" ? n : n - e.split("/").length;
}
_isSkippedSymbolicLink(e) {
return !this._settings.followSymbolicLinks && e.dirent.isSymbolicLink();
}
_isSkippedByPositivePatterns(e, t) {
return !this._settings.baseNameMatch && !t.match(e);
}
_isSkippedByNegativePatterns(e, n) {
return !t.pattern.matchAny(e, n);
}
};
})), of = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = wd();
e.default = class {
constructor(e, t) {
this._settings = e, this._micromatchOptions = t, this.index = /* @__PURE__ */ new Map();
}
getFilter(e, n) {
let [r, i] = t.pattern.partitionAbsoluteAndRelative(n), a = {
positive: { all: t.pattern.convertPatternsToRe(e, this._micromatchOptions) },
negative: {
absolute: t.pattern.convertPatternsToRe(r, Object.assign(Object.assign({}, this._micromatchOptions), { dot: !0 })),
relative: t.pattern.convertPatternsToRe(i, Object.assign(Object.assign({}, this._micromatchOptions), { dot: !0 }))
}
};
return (e) => this._filter(e, a);
}
_filter(e, n) {
let r = t.path.removeLeadingDotSegment(e.path);
if (this._settings.unique && this._isDuplicateEntry(r) || this._onlyFileFilter(e) || this._onlyDirectoryFilter(e)) return !1;
let i = this._isMatchToPatternsSet(r, n, e.dirent.isDirectory());
return this._settings.unique && i && this._createIndexRecord(r), i;
}
_isDuplicateEntry(e) {
return this.index.has(e);
}
_createIndexRecord(e) {
this.index.set(e, void 0);
}
_onlyFileFilter(e) {
return this._settings.onlyFiles && !e.dirent.isFile();
}
_onlyDirectoryFilter(e) {
return this._settings.onlyDirectories && !e.dirent.isDirectory();
}
_isMatchToPatternsSet(e, t, n) {
return !(!this._isMatchToPatterns(e, t.positive.all, n) || this._isMatchToPatterns(e, t.negative.relative, n) || this._isMatchToAbsoluteNegative(e, t.negative.absolute, n));
}
_isMatchToAbsoluteNegative(e, n, r) {
if (n.length === 0) return !1;
let i = t.path.makeAbsolute(this._settings.cwd, e);
return this._isMatchToPatterns(i, n, r);
}
_isMatchToPatterns(e, n, r) {
if (n.length === 0) return !1;
let i = t.pattern.matchAny(e, n);
return !i && r ? t.pattern.matchAny(e + "/", n) : i;
}
};
})), sf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = wd();
e.default = class {
constructor(e) {
this._settings = e;
}
getFilter() {
return (e) => this._isNonFatalError(e);
}
_isNonFatalError(e) {
return t.errno.isEnoentCodeError(e) || this._settings.suppressErrors;
}
};
})), cf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = wd();
e.default = class {
constructor(e) {
this._settings = e;
}
getTransformer() {
return (e) => this._transform(e);
}
_transform(e) {
let n = e.path;
return this._settings.absolute && (n = t.path.makeAbsolute(this._settings.cwd, n), n = t.path.unixify(n)), this._settings.markDirectories && e.dirent.isDirectory() && (n += "/"), this._settings.objectMode ? Object.assign(Object.assign({}, e), { path: n }) : n;
}
};
})), lf = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("path"), r = af(), i = of(), a = sf(), o = cf();
t.default = class {
constructor(e) {
this._settings = e, this.errorFilter = new a.default(this._settings), this.entryFilter = new i.default(this._settings, this._getMicromatchOptions()), this.deepFilter = new r.default(this._settings, this._getMicromatchOptions()), this.entryTransformer = new o.default(this._settings);
}
_getRootDirectory(e) {
return n.resolve(this._settings.cwd, e.base);
}
_getReaderOptions(e) {
let t = e.base === "." ? "" : e.base;
return {
basePath: t,
pathSegmentSeparator: "/",
concurrency: this._settings.concurrency,
deepFilter: this.deepFilter.getFilter(t, e.positive, e.negative),
entryFilter: this.entryFilter.getFilter(e.positive, e.negative),
errorFilter: this.errorFilter.getFilter(),
followSymbolicLinks: this._settings.followSymbolicLinks,
fs: this._settings.fs,
stats: this._settings.stats,
throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
transform: this.entryTransformer.getTransformer()
};
}
_getMicromatchOptions() {
return {
dot: this._settings.dot,
matchBase: this._settings.baseNameMatch,
nobrace: !this._settings.braceExpansion,
nocase: !this._settings.caseSensitiveMatch,
noext: !this._settings.extglob,
noglobstar: !this._settings.globstar,
posix: !0,
strictSlashes: !1
};
}
};
})), uf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = tf(), n = lf();
e.default = class extends n.default {
constructor() {
super(...arguments), this._reader = new t.default(this._settings);
}
async read(e) {
let t = this._getRootDirectory(e), n = this._getReaderOptions(e);
return (await this.api(t, e, n)).map((e) => n.transform(e));
}
api(e, t, n) {
return t.dynamic ? this._reader.dynamic(e, n) : this._reader.static(t.patterns, n);
}
};
})), df = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("stream"), r = ef(), i = lf();
t.default = class extends i.default {
constructor() {
super(...arguments), this._reader = new r.default(this._settings);
}
read(e) {
let t = this._getRootDirectory(e), r = this._getReaderOptions(e), i = this.api(t, e, r), a = new n.Readable({
objectMode: !0,
read: () => {}
});
return i.once("error", (e) => a.emit("error", e)).on("data", (e) => a.emit("data", r.transform(e))).once("end", () => a.emit("end")), a.once("close", () => i.destroy()), a;
}
api(e, t, n) {
return t.dynamic ? this._reader.dynamic(e, n) : this._reader.static(t.patterns, n);
}
};
})), ff = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = Ad(), n = Qd(), r = $d();
e.default = class extends r.default {
constructor() {
super(...arguments), this._walkSync = n.walkSync, this._statSync = t.statSync;
}
dynamic(e, t) {
return this._walkSync(e, t);
}
static(e, t) {
let n = [];
for (let r of e) {
let e = this._getFullEntryPath(r), i = this._getEntry(e, r, t);
i === null || !t.entryFilter(i) || n.push(i);
}
return n;
}
_getEntry(e, t, n) {
try {
let n = this._getStat(e);
return this._makeEntry(n, t);
} catch (e) {
if (n.errorFilter(e)) return null;
throw e;
}
}
_getStat(e) {
return this._statSync(e, this._fsStatSettings);
}
};
})), pf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = ff(), n = lf();
e.default = class extends n.default {
constructor() {
super(...arguments), this._reader = new t.default(this._settings);
}
read(e) {
let t = this._getRootDirectory(e), n = this._getReaderOptions(e);
return this.api(t, e, n).map(n.transform);
}
api(e, t, n) {
return t.dynamic ? this._reader.dynamic(e, n) : this._reader.static(t.patterns, n);
}
};
})), mf = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 }), t.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
var n = e("fs"), r = e("os"), i = Math.max(r.cpus().length, 1);
t.DEFAULT_FILE_SYSTEM_ADAPTER = {
lstat: n.lstat,
lstatSync: n.lstatSync,
stat: n.stat,
statSync: n.statSync,
readdir: n.readdir,
readdirSync: n.readdirSync
}, t.default = class {
constructor(e = {}) {
this._options = e, this.absolute = this._getValue(this._options.absolute, !1), this.baseNameMatch = this._getValue(this._options.baseNameMatch, !1), this.braceExpansion = this._getValue(this._options.braceExpansion, !0), this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, !0), this.concurrency = this._getValue(this._options.concurrency, i), this.cwd = this._getValue(this._options.cwd, process.cwd()), this.deep = this._getValue(this._options.deep, Infinity), this.dot = this._getValue(this._options.dot, !1), this.extglob = this._getValue(this._options.extglob, !0), this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, !0), this.fs = this._getFileSystemMethods(this._options.fs), this.globstar = this._getValue(this._options.globstar, !0), this.ignore = this._getValue(this._options.ignore, []), this.markDirectories = this._getValue(this._options.markDirectories, !1), this.objectMode = this._getValue(this._options.objectMode, !1), this.onlyDirectories = this._getValue(this._options.onlyDirectories, !1), this.onlyFiles = this._getValue(this._options.onlyFiles, !0), this.stats = this._getValue(this._options.stats, !1), this.suppressErrors = this._getValue(this._options.suppressErrors, !1), this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, !1), this.unique = this._getValue(this._options.unique, !0), this.onlyDirectories && (this.onlyFiles = !1), this.stats && (this.objectMode = !0), this.ignore = [].concat(this.ignore);
}
_getValue(e, t) {
return e === void 0 ? t : e;
}
_getFileSystemMethods(e = {}) {
return Object.assign(Object.assign({}, t.DEFAULT_FILE_SYSTEM_ADAPTER), e);
}
};
})), hf = /* @__PURE__ */ n((/* @__PURE__ */ i(((e, t) => {
var n = Td(), r = uf(), i = df(), a = pf(), o = mf(), s = wd();
async function c(e, t) {
u(e);
let n = l(e, r.default, t), i = await Promise.all(n);
return s.array.flatten(i);
}
(function(e) {
e.glob = e, e.globSync = t, e.globStream = r, e.async = e;
function t(e, t) {
u(e);
let n = l(e, a.default, t);
return s.array.flatten(n);
}
e.sync = t;
function r(e, t) {
u(e);
let n = l(e, i.default, t);
return s.stream.merge(n);
}
e.stream = r;
function c(e, t) {
u(e);
let r = [].concat(e), i = new o.default(t);
return n.generate(r, i);
}
e.generateTasks = c;
function d(e, t) {
u(e);
let n = new o.default(t);
return s.pattern.isDynamicPattern(e, n);
}
e.isDynamicPattern = d;
function f(e) {
return u(e), s.path.escape(e);
}
e.escapePath = f;
function p(e) {
return u(e), s.path.convertPathToPattern(e);
}
e.convertPathToPattern = p, (function(e) {
function t(e) {
return u(e), s.path.escapePosixPath(e);
}
e.escapePath = t;
function n(e) {
return u(e), s.path.convertPosixPathToPattern(e);
}
e.convertPathToPattern = n;
})(e.posix ||= {}), (function(e) {
function t(e) {
return u(e), s.path.escapeWindowsPath(e);
}
e.escapePath = t;
function n(e) {
return u(e), s.path.convertWindowsPathToPattern(e);
}
e.convertPathToPattern = n;
})(e.win32 ||= {});
})(c ||= {});
function l(e, t, r) {
let i = [].concat(e), a = new o.default(r), s = n.generate(i, a), c = new t(a);
return s.map(c.read, c);
}
function u(e) {
if (![].concat(e).every((e) => s.string.isString(e) && !s.string.isEmpty(e))) throw TypeError("Patterns must be a string (non empty) or an array of strings");
}
t.exports = c;
})))(), 1), gf = { ignore: ["**/node_modules/**", "**/.pnpm-store/**"] }, _f = async (e) => {
let t = o.join(o.dirname(e), "pnpm-workspace.yaml"), n;
try {
n = await s.readFile(t, "utf-8");
} catch {
return null;
}
return (0, vc.parse)(n);
}, vf = async (e) => {
let t = o.join(o.dirname(e), ".yarnrc.yml"), n;
try {
n = await s.readFile(t, "utf-8");
} catch {
return null;
}
return (0, vc.parse)(n);
}, yf = async (e, t) => {
let n = {};
if (e.packageManager === "pnpm") {
let e = await _f(t);
e && !Array.isArray(e) && (e.catalog && Object.assign(n, e.catalog), e.catalogs && Object.assign(n, ...Object.values(e.catalogs)), e.workspaces && !Array.isArray(e.workspaces) && (e.workspaces.catalog && Object.assign(n, e.workspaces.catalog), e.workspaces.catalogs && Object.assign(n, ...Object.values(e.workspaces.catalogs))));
}
if (e.packageManager === "yarn") {
let e = await vf(t);
e && (e.catalog && Object.assign(n, e.catalog), e.catalogs && Object.assign(n, ...Object.values(e.catalogs)));
}
let r = JSON.parse(await s.readFile(t, "utf-8"));
return Object.assign(n, r.catalog, ...Object.values(r.catalogs ?? {})), r.workspaces && !Array.isArray(r.workspaces) && Object.assign(n, r.workspaces.catalog, ...Object.values(r.workspaces.catalogs ?? {})), Object.keys(n).length > 0 ? n : null;
};
async function bf(e, t, n, r) {
let { pkgData: i, pkgPath: a } = await Yu({
...e,
packageFile: n,
loglevel: "silent"
}), s = (typeof i == "string" ? JSON.parse(i) : i).workspaces || await _f(a || ""), c = Array.isArray(s) ? s : s?.packages;
c || $(e, `workspaces property missing from package.json. --workspace${e.workspaces ? "s" : ""} only works when you specify a "workspaces" property in your package.json.`);
let l = e.packageFile ? o.dirname(o.resolve(e.packageFile)) : r, u = (c || []).map((e) => o.join(l, e, "package.json").replace(/\\/g, "/")), d = await (0, hf.default)(u, gf), f = await Promise.all(d.map(async (t) => {
let n = await wl(e, t);
return n.name = n.pkg.name || t.split("/").slice(-2)[0], n;
})), p = f.map((e) => e.name || "");
return e.workspaces === !0 ? [f, p] : [f.filter((n) => e.workspace?.some((e) => c?.some((r) => n.name === e || n.filepath === o.join(l, o.dirname(r), e, t).replace(/\\/g, "/")))), p];
}
async function xf(e, t) {
if (!t) return null;
let n = await yf(e, t);
if (!n) return null;
let r = {
name: "catalog-dependencies",
version: "1.0.0",
dependencies: n
};
return {
filepath: e.packageManager === "pnpm" ? o.join(o.dirname(t), "pnpm-workspace.yaml") : e.packageManager === "yarn" ? o.join(o.dirname(t), ".yarnrc.yml") : `${t}#catalog`,
pkg: r,
pkgFile: JSON.stringify(r, null, 2),
name: "catalogs"
};
}
async function Sf(e) {
let t = e.packageFile || "package.json", n = e.cwd ? oo(e.cwd) : "./", r = e.packageFile || (e.cwd ? o.join(n, "package.json") : "package.json"), i = e.workspaces === !0 || e.workspace !== void 0 && e.workspace.length !== 0, a = [];
if (!i || e.root === !0) {
let t = r.replace(/\\/g, "/"), n = await (0, hf.default)(t, gf), i = await Promise.all(n.map(async (t) => await wl(e, t)));
a = [...a, ...i];
}
if (!i) return [a, []];
let s = null;
if (i) {
let { pkgPath: t } = await Yu({
...e,
packageFile: r,
loglevel: "silent"
});
t && (s = await xf(e, t));
}
let [c, l] = await bf(e, t, r, n);
return a = [...a, ...c], s && (a = [...a, s]), [a, l];
}
//#endregion
//#region src/lib/getNcuRc.ts
var Cf = (/* @__PURE__ */ i(((t, n) => {
var r = e("path"), i = e("fs"), a = e("os"), o = e("url"), s = i.promises.readFile;
function c(e, t) {
return [
"package.json",
`.${e}rc.json`,
`.${e}rc.js`,
`.${e}rc.cjs`,
...t ? [] : [`.${e}rc.mjs`],
`.config/${e}rc`,
`.config/${e}rc.json`,
`.config/${e}rc.js`,
`.config/${e}rc.cjs`,
...t ? [] : [`.config/${e}rc.mjs`],
`${e}.config.js`,
`${e}.config.cjs`,
...t ? [] : [`${e}.config.mjs`]
];
}
function l(e) {
return r.dirname(e) || r.sep;
}
var u = (e, t) => JSON.parse(t), d = typeof __webpack_require__ == "function" ? __non_webpack_require__ : e, f = Object.freeze({
".js": d,
".json": d,
".cjs": d,
noExt: u
});
n.exports.defaultLoadersSync = f;
var p = async (e) => {
try {
return (await import(
/* webpackIgnore: true */
o.pathToFileURL(e).href
)).default;
} catch (t) {
try {
return d(e);
} catch (e) {
throw e.code === "ERR_REQUIRE_ESM" || e instanceof SyntaxError && e.toString().includes("Cannot use import statement outside a module") ? t : e;
}
}
}, m = Object.freeze({
".js": p,
".mjs": p,
".cjs": p,
".json": u,
noExt: u
});
n.exports.defaultLoaders = m;
function h(e, t, n) {
let i = {
stopDir: a.homedir(),
searchPlaces: c(e, n),
ignoreEmptySearchPlaces: !0,
cache: !0,
transform: (e) => e,
packageProp: [e],
...t,
loaders: {
...n ? f : m,
...t.loaders
}
};
return i.searchPlaces.forEach((e) => {
let t = r.extname(e) || "noExt", n = i.loaders[t];
if (!n) throw Error(`Missing loader for extension "${e}"`);
if (typeof n != "function") throw Error(`Loader for extension "${e}" is not a function: Received ${typeof n}.`);
}), i;
}
function g(e, t) {
return typeof e == "string" && e in t ? t[e] : (Array.isArray(e) ? e : e.split(".")).reduce((e, t) => e === void 0 ? e : e[t], t) || null;
}
function _(e) {
if (!e) throw Error("load must pass a non-empty string");
}
function v(e, t) {
if (!e) throw Error(`No loader specified for extension "${t}"`);
if (typeof e != "function") throw Error("loader is not a function");
}
var y = (e) => (t, n, r) => (e && t.set(n, r), r);
n.exports.lilconfig = function(e, t) {
let { ignoreEmptySearchPlaces: n, loaders: a, packageProp: o, searchPlaces: c, stopDir: u, transform: d, cache: f } = h(e, t ?? {}, !1), p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), b = y(f);
return {
async search(e = process.cwd()) {
let t = {
config: null,
filepath: ""
}, m = /* @__PURE__ */ new Set(), h = e;
dirLoop: for (;;) {
if (f) {
let e = p.get(h);
if (e !== void 0) {
for (let t of m) p.set(t, e);
return e;
}
m.add(h);
}
for (let e of c) {
let c = r.join(h, e);
try {
await i.promises.access(c);
} catch {
continue;
}
let l = String(await s(c)), u = r.extname(e) || "noExt", d = a[u];
if (e === "package.json") {
let e = await d(c, l), n = g(o, e);
if (n != null) {
t.config = n, t.filepath = c;
break dirLoop;
}
continue;
}
let f = l.trim() === "";
if (!(f && n)) {
f ? (t.isEmpty = !0, t.config = void 0) : (v(d, u), t.config = await d(c, l)), t.filepath = c;
break dirLoop;
}
}
if (h === u || h === l(h)) break dirLoop;
h = l(h);
}
let _ = t.filepath === "" && t.config === null ? d(null) : d(t);
if (f) for (let e of m) p.set(e, _);
return _;
},
async load(e) {
_(e);
let t = r.resolve(process.cwd(), e);
if (f && m.has(t)) return m.get(t);
let { base: i, ext: c } = r.parse(t), l = c || "noExt", u = a[l];
v(u, l);
let p = String(await s(t));
if (i === "package.json") {
let e = await u(t, p);
return b(m, t, d({
config: g(o, e),
filepath: t
}));
}
let h = {
config: null,
filepath: t
}, y = p.trim() === "";
return y && n ? b(m, t, d({
config: void 0,
filepath: t,
isEmpty: !0
})) : (h.config = y ? void 0 : await u(t, p), b(m, t, d(y ? {
...h,
isEmpty: y,
config: void 0
} : h)));
},
clearLoadCache() {
f && m.clear();
},
clearSearchCache() {
f && p.clear();
},
clearCaches() {
f && (m.clear(), p.clear());
}
};
}, n.exports.lilconfigSync = function(e, t) {
let { ignoreEmptySearchPlaces: n, loaders: a, packageProp: o, searchPlaces: s, stopDir: c, transform: u, cache: d } = h(e, t ?? {}, !0), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = y(d);
return {
search(e = process.cwd()) {
let t = {
config: null,
filepath: ""
}, p = /* @__PURE__ */ new Set(), m = e;
dirLoop: for (;;) {
if (d) {
let e = f.get(m);
if (e !== void 0) {
for (let t of p) f.set(t, e);
return e;
}
p.add(m);
}
for (let e of s) {
let s = r.join(m, e);
try {
i.accessSync(s);
} catch {
continue;
}
let c = r.extname(e) || "noExt", l = a[c], u = String(i.readFileSync(s));
if (e === "package.json") {
let e = l(s, u), n = g(o, e);
if (n != null) {
t.config = n, t.filepath = s;
break dirLoop;
}
continue;
}
let d = u.trim() === "";
if (!(d && n)) {
d ? (t.isEmpty = !0, t.config = void 0) : (v(l, c), t.config = l(s, u)), t.filepath = s;
break dirLoop;
}
}
if (m === c || m === l(m)) break dirLoop;
m = l(m);
}
let h = t.filepath === "" && t.config === null ? u(null) : u(t);
if (d) for (let e of p) f.set(e, h);
return h;
},
load(e) {
_(e);
let t = r.resolve(process.cwd(), e);
if (d && p.has(t)) return p.get(t);
let { base: s, ext: c } = r.parse(t), l = c || "noExt", f = a[l];
v(f, l);
let h = String(i.readFileSync(t));
if (s === "package.json") {
let e = f(t, h);
return u({
config: g(o, e),
filepath: t
});
}
let y = {
config: null,
filepath: t
}, b = h.trim() === "";
return b && n ? m(p, t, u({
filepath: t,
config: void 0,
isEmpty: !0
})) : (y.config = b ? void 0 : f(t, h), m(p, t, u(b ? {
...y,
isEmpty: b,
config: void 0
} : y)));
},
clearLoadCache() {
d && p.clear();
},
clearSearchCache() {
d && f.clear();
},
clearCaches() {
d && (p.clear(), f.clear());
}
};
};
})))(), wf = (e, t) => {
try {
return (0, vc.parse)(t);
} catch (t) {
throw Error(`YAML Error in ${e}:\n${t.message}`, { cause: t });
}
};
function Tf(e, t) {
let n = o.basename(t), r = e.includes("__filename is not defined") || e.includes("__dirname is not defined") || e.includes("require is not defined") || e.includes("module is not defined") || e.includes("exports is not defined"), i = e.includes("Cannot use import statement outside a module") || e.includes("Unexpected token 'export'") || e.includes("Unexpected token 'import'") || e.includes("SyntaxError: export ") || e.includes("SyntaxError") && e.includes("import"), a = t.endsWith(".js");
return r && a ? `${n} uses CommonJS syntax (require/module.exports) but your package.json has "type": "module".\n\nRecommended: Convert to ESM syntax:\n import { ... } from '...'\n export default { ... }\n\nAlternative: Rename to ${n.replace(".js", ".cjs")} to keep CommonJS syntax.` : i && a ? `${n} uses ESM syntax (import/export) but your package.json has "type": "commonjs".\n\nRecommended: Add "type": "module" to your package.json to use ESM throughout your project.\n\nAlternative: Rename to ${n.replace(".js", ".mjs")} to keep CommonJS in package.json.` : null;
}
async function Ef({ configFileName: e, configFilePath: t, packageFile: n, global: r, options: i }) {
let a = _n(i?.color), s = (0, Cf.lilconfig)("ncu", {
searchPlaces: [
".ncurc",
".ncurc.json",
".ncurc.yaml",
".ncurc.yml",
".ncurc.mjs",
".ncurc.cjs",
".ncurc.js"
],
loaders: {
noExt: wf,
".yaml": wf,
".yml": wf
}
}), l = t || (r ? c.homedir() : n ? o.dirname(n) : process.cwd()), u = null, d;
try {
e ? (d = o.isAbsolute(e) ? e : o.join(l, e), u = await s.load(d)) : u = await s.search(l);
} catch (t) {
let n = t.message || "", r = d || e || ".ncurc.js";
e && (t.code === "ENOENT" || n.includes("no such file or directory")) && $(i, `Config file ${e} not found in ${l}`);
let a = Tf(n, r);
a && $(i, a), $(i, `Config file error: ${n}`);
}
let f = u?.filepath, { $schema: p, ...m } = u?.config || {}, h = m || {};
typeof h.format == "string" && (h.format = Mi.format.parse(h.format));
let g = Object.keys(h).filter((e) => !Mi[e]);
return g.length > 0 && (console.error(a.red(`Unknown option${g.length === 1 ? "" : "s"} found in config file:`), a.gray(g.join(", "))), console.info("Using config file " + f), console.info(`You can change the config file path with ${a.blue("--configFilePath")}`)), {
filePath: f,
args: Object.entries(h).flatMap(([e, t]) => typeof t == "boolean" || Mi[e]?.type === "boolean" ? t ? [`--${e}`] : Mi[e]?.type === "boolean" ? [`--no-${e}`] : [] : [`--${e}`, t]),
config: h
};
}
//#endregion
//#region node_modules/picomatch/lib/constants.js
var Df = /* @__PURE__ */ i(((e, t) => {
var n = "\\\\/", r = `[^${n}]`, i = 0, a = "\\.", o = "\\+", s = "\\?", c = "\\/", l = "(?=.)", u = "[^/]", d = `(?:${c}|$)`, f = `(?:^|${c})`, p = `${a}{1,2}${d}`, m = {
DOT_LITERAL: a,
PLUS_LITERAL: o,
QMARK_LITERAL: s,
SLASH_LITERAL: c,
ONE_CHAR: l,
QMARK: u,
END_ANCHOR: d,
DOTS_SLASH: p,
NO_DOT: `(?!${a})`,
NO_DOTS: `(?!${f}${p})`,
NO_DOT_SLASH: `(?!${a}{0,1}${d})`,
NO_DOTS_SLASH: `(?!${p})`,
QMARK_NO_DOT: `[^.${c}]`,
STAR: `${u}*?`,
START_ANCHOR: f,
SEP: "/"
}, h = {
...m,
SLASH_LITERAL: `[${n}]`,
QMARK: r,
STAR: `${r}*?`,
DOTS_SLASH: `${a}{1,2}(?:[${n}]|$)`,
NO_DOT: `(?!${a})`,
NO_DOTS: `(?!(?:^|[${n}])${a}{1,2}(?:[${n}]|$))`,
NO_DOT_SLASH: `(?!${a}{0,1}(?:[${n}]|$))`,
NO_DOTS_SLASH: `(?!${a}{1,2}(?:[${n}]|$))`,
QMARK_NO_DOT: `[^.${n}]`,
START_ANCHOR: `(?:^|[${n}])`,
END_ANCHOR: `(?:[${n}]|$)`,
SEP: "\\"
};
t.exports = {
DEFAULT_MAX_EXTGLOB_RECURSION: i,
MAX_LENGTH: 65536,
POSIX_REGEX_SOURCE: {
__proto__: null,
alnum: "a-zA-Z0-9",
alpha: "a-zA-Z",
ascii: "\\x00-\\x7F",
blank: " \\t",
cntrl: "\\x00-\\x1F\\x7F",
digit: "0-9",
graph: "\\x21-\\x7E",
lower: "a-z",
print: "\\x20-\\x7E ",
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
space: " \\t\\r\\n\\v\\f",
upper: "A-Z",
word: "A-Za-z0-9_",
xdigit: "A-Fa-f0-9"
},
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
REPLACEMENTS: {
__proto__: null,
"***": "*",
"**/**": "**",
"**/**/**": "**"
},
CHAR_0: 48,
CHAR_9: 57,
CHAR_UPPERCASE_A: 65,
CHAR_LOWERCASE_A: 97,
CHAR_UPPERCASE_Z: 90,
CHAR_LOWERCASE_Z: 122,
CHAR_LEFT_PARENTHESES: 40,
CHAR_RIGHT_PARENTHESES: 41,
CHAR_ASTERISK: 42,
CHAR_AMPERSAND: 38,
CHAR_AT: 64,
CHAR_BACKWARD_SLASH: 92,
CHAR_CARRIAGE_RETURN: 13,
CHAR_CIRCUMFLEX_ACCENT: 94,
CHAR_COLON: 58,
CHAR_COMMA: 44,
CHAR_DOT: 46,
CHAR_DOUBLE_QUOTE: 34,
CHAR_EQUAL: 61,
CHAR_EXCLAMATION_MARK: 33,
CHAR_FORM_FEED: 12,
CHAR_FORWARD_SLASH: 47,
CHAR_GRAVE_ACCENT: 96,
CHAR_HASH: 35,
CHAR_HYPHEN_MINUS: 45,
CHAR_LEFT_ANGLE_BRACKET: 60,
CHAR_LEFT_CURLY_BRACE: 123,
CHAR_LEFT_SQUARE_BRACKET: 91,
CHAR_LINE_FEED: 10,
CHAR_NO_BREAK_SPACE: 160,
CHAR_PERCENT: 37,
CHAR_PLUS: 43,
CHAR_QUESTION_MARK: 63,
CHAR_RIGHT_ANGLE_BRACKET: 62,
CHAR_RIGHT_CURLY_BRACE: 125,
CHAR_RIGHT_SQUARE_BRACKET: 93,
CHAR_SEMICOLON: 59,
CHAR_SINGLE_QUOTE: 39,
CHAR_SPACE: 32,
CHAR_TAB: 9,
CHAR_UNDERSCORE: 95,
CHAR_VERTICAL_LINE: 124,
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
extglobChars(e) {
return {
"!": {
type: "negate",
open: "(?:(?!(?:",
close: `))${e.STAR})`
},
"?": {
type: "qmark",
open: "(?:",
close: ")?"
},
"+": {
type: "plus",
open: "(?:",
close: ")+"
},
"*": {
type: "star",
open: "(?:",
close: ")*"
},
"@": {
type: "at",
open: "(?:",
close: ")"
}
};
},
globChars(e) {
return e === !0 ? h : m;
}
};
})), Of = /* @__PURE__ */ i(((e) => {
var { REGEX_BACKSLASH: t, REGEX_REMOVE_BACKSLASH: n, REGEX_SPECIAL_CHARS: r, REGEX_SPECIAL_CHARS_GLOBAL: i } = Df();
e.isObject = (e) => typeof e == "object" && !!e && !Array.isArray(e), e.hasRegexChars = (e) => r.test(e), e.isRegexChar = (t) => t.length === 1 && e.hasRegexChars(t), e.escapeRegex = (e) => e.replace(i, "\\$1"), e.toPosixSlashes = (e) => e.replace(t, "/"), e.isWindows = () => {
if (typeof navigator < "u" && navigator.platform) {
let e = navigator.platform.toLowerCase();
return e === "win32" || e === "windows";
}
return typeof process < "u" && process.platform ? process.platform === "win32" : !1;
}, e.removeBackslashes = (e) => e.replace(n, (e) => e === "\\" ? "" : e), e.escapeLast = (t, n, r) => {
let i = t.lastIndexOf(n, r);
return i === -1 ? t : t[i - 1] === "\\" ? e.escapeLast(t, n, i - 1) : `${t.slice(0, i)}\\${t.slice(i)}`;
}, e.removePrefix = (e, t = {}) => {
let n = e;
return n.startsWith("./") && (n = n.slice(2), t.prefix = "./"), n;
}, e.wrapOutput = (e, t = {}, n = {}) => {
let r = `${n.contains ? "" : "^"}(?:${e})${n.contains ? "" : "$"}`;
return t.negated === !0 && (r = `(?:^(?!${r}).*$)`), r;
}, e.basename = (e, { windows: t } = {}) => {
let n = e.split(t ? /[\\/]/ : "/"), r = n[n.length - 1];
return r === "" ? n[n.length - 2] : r;
};
})), kf = /* @__PURE__ */ i(((e, t) => {
var n = Of(), { CHAR_ASTERISK: r, CHAR_AT: i, CHAR_BACKWARD_SLASH: a, CHAR_COMMA: o, CHAR_DOT: s, CHAR_EXCLAMATION_MARK: c, CHAR_FORWARD_SLASH: l, CHAR_LEFT_CURLY_BRACE: u, CHAR_LEFT_PARENTHESES: d, CHAR_LEFT_SQUARE_BRACKET: f, CHAR_PLUS: p, CHAR_QUESTION_MARK: m, CHAR_RIGHT_CURLY_BRACE: h, CHAR_RIGHT_PARENTHESES: g, CHAR_RIGHT_SQUARE_BRACKET: _ } = Df(), v = (e) => e === l || e === a, y = (e) => {
e.isPrefix !== !0 && (e.depth = e.isGlobstar ? Infinity : 1);
};
t.exports = (e, t) => {
let b = t || {}, x = e.length - 1, S = b.parts === !0 || b.scanToEnd === !0, C = [], w = [], T = [], E = e, D = -1, O = 0, k = 0, A = !1, ee = !1, j = !1, M = !1, te = !1, ne = !1, re = !1, N = !1, P = !1, F = !1, ie = 0, I, L, R = {
value: "",
depth: 0,
isGlob: !1
}, z = () => D >= x, B = () => E.charCodeAt(D + 1), V = () => (I = L, E.charCodeAt(++D));
for (; D < x;) {
L = V();
let e;
if (L === a) {
re = R.backslashes = !0, L = V(), L === u && (ne = !0);
continue;
}
if (ne === !0 || L === u) {
for (ie++; z() !== !0 && (L = V());) {
if (L === a) {
re = R.backslashes = !0, V();
continue;
}
if (L === u) {
ie++;
continue;
}
if (ne !== !0 && L === s && (L = V()) === s) {
if (A = R.isBrace = !0, j = R.isGlob = !0, F = !0, S === !0) continue;
break;
}
if (ne !== !0 && L === o) {
if (A = R.isBrace = !0, j = R.isGlob = !0, F = !0, S === !0) continue;
break;
}
if (L === h && (ie--, ie === 0)) {
ne = !1, A = R.isBrace = !0, F = !0;
break;
}
}
if (S === !0) continue;
break;
}
if (L === l) {
if (C.push(D), w.push(R), R = {
value: "",
depth: 0,
isGlob: !1
}, F === !0) continue;
if (I === s && D === O + 1) {
O += 2;
continue;
}
k = D + 1;
continue;
}
if (b.noext !== !0 && (L === p || L === i || L === r || L === m || L === c) && B() === d) {
if (j = R.isGlob = !0, M = R.isExtglob = !0, F = !0, L === c && D === O && (P = !0), S === !0) {
for (; z() !== !0 && (L = V());) {
if (L === a) {
re = R.backslashes = !0, L = V();
continue;
}
if (L === g) {
j = R.isGlob = !0, F = !0;
break;
}
}
continue;
}
break;
}
if (L === r) {
if (I === r && (te = R.isGlobstar = !0), j = R.isGlob = !0, F = !0, S === !0) continue;
break;
}
if (L === m) {
if (j = R.isGlob = !0, F = !0, S === !0) continue;
break;
}
if (L === f) {
for (; z() !== !0 && (e = V());) {
if (e === a) {
re = R.backslashes = !0, V();
continue;
}
if (e === _) {
ee = R.isBracket = !0, j = R.isGlob = !0, F = !0;
break;
}
}
if (S === !0) continue;
break;
}
if (b.nonegate !== !0 && L === c && D === O) {
N = R.negated = !0, O++;
continue;
}
if (b.noparen !== !0 && L === d) {
if (j = R.isGlob = !0, S === !0) {
for (; z() !== !0 && (L = V());) {
if (L === d) {
re = R.backslashes = !0, L = V();
continue;
}
if (L === g) {
F = !0;
break;
}
}
continue;
}
break;
}
if (j === !0) {
if (F = !0, S === !0) continue;
break;
}
}
b.noext === !0 && (M = !1, j = !1);
let H = E, ae = "", oe = "";
O > 0 && (ae = E.slice(0, O), E = E.slice(O), k -= O), H && j === !0 && k > 0 ? (H = E.slice(0, k), oe = E.slice(k)) : j === !0 ? (H = "", oe = E) : H = E, H && H !== "" && H !== "/" && H !== E && v(H.charCodeAt(H.length - 1)) && (H = H.slice(0, -1)), b.unescape === !0 && (oe &&= n.removeBackslashes(oe), H && re === !0 && (H = n.removeBackslashes(H)));
let se = {
prefix: ae,
input: e,
start: O,
base: H,
glob: oe,
isBrace: A,
isBracket: ee,
isGlob: j,
isExtglob: M,
isGlobstar: te,
negated: N,
negatedExtglob: P
};
if (b.tokens === !0 && (se.maxDepth = 0, v(L) || w.push(R), se.tokens = w), b.parts === !0 || b.tokens === !0) {
let t;
for (let n = 0; n < C.length; n++) {
let r = t ? t + 1 : O, i = C[n], a = e.slice(r, i);
b.tokens && (n === 0 && O !== 0 ? (w[n].isPrefix = !0, w[n].value = ae) : w[n].value = a, y(w[n]), se.maxDepth += w[n].depth), (n !== 0 || a !== "") && T.push(a), t = i;
}
if (t && t + 1 < e.length) {
let n = e.slice(t + 1);
T.push(n), b.tokens && (w[w.length - 1].value = n, y(w[w.length - 1]), se.maxDepth += w[w.length - 1].depth);
}
se.slashes = C, se.parts = T;
}
return se;
};
})), Af = /* @__PURE__ */ i(((e, t) => {
var n = Df(), r = Of(), { MAX_LENGTH: i, POSIX_REGEX_SOURCE: a, REGEX_NON_SPECIAL_CHARS: o, REGEX_SPECIAL_CHARS_BACKREF: s, REPLACEMENTS: c } = n, l = (e, t) => {
if (typeof t.expandRange == "function") return t.expandRange(...e, t);
e.sort();
let n = `[${e.join("-")}]`;
try {
new RegExp(n);
} catch {
return e.map((e) => r.escapeRegex(e)).join("..");
}
return n;
}, u = (e, t) => `Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`, d = (e) => {
let t = [], n = 0, r = 0, i = 0, a = "", o = !1;
for (let s of e) {
if (o === !0) {
a += s, o = !1;
continue;
}
if (s === "\\") {
a += s, o = !0;
continue;
}
if (s === "\"") {
i = i === 1 ? 0 : 1, a += s;
continue;
}
if (i === 0) {
if (s === "[") n++;
else if (s === "]" && n > 0) n--;
else if (n === 0) {
if (s === "(") r++;
else if (s === ")" && r > 0) r--;
else if (s === "|" && r === 0) {
t.push(a), a = "";
continue;
}
}
}
a += s;
}
return t.push(a), t;
}, f = (e) => {
let t = !1;
for (let n of e) {
if (t === !0) {
t = !1;
continue;
}
if (n === "\\") {
t = !0;
continue;
}
if (/[?*+@!()[\]{}]/.test(n)) return !1;
}
return !0;
}, p = (e) => {
let t = e.trim(), n = !0;
for (; n === !0;) n = !1, /^@\([^\\()[\]{}|]+\)$/.test(t) && (t = t.slice(2, -1), n = !0);
if (f(t)) return t.replace(/\\(.)/g, "$1");
}, m = (e) => {
let t = e.map(p).filter(Boolean);
for (let e = 0; e < t.length; e++) for (let n = e + 1; n < t.length; n++) {
let r = t[e], i = t[n], a = r[0];
if (!(!a || r !== a.repeat(r.length) || i !== a.repeat(i.length)) && (r === i || r.startsWith(i) || i.startsWith(r))) return !0;
}
return !1;
}, h = (e, t = !0) => {
if (e[0] !== "+" && e[0] !== "*" || e[1] !== "(") return;
let n = 0, r = 0, i = 0, a = !1;
for (let o = 1; o < e.length; o++) {
let s = e[o];
if (a === !0) {
a = !1;
continue;
}
if (s === "\\") {
a = !0;
continue;
}
if (s === "\"") {
i = i === 1 ? 0 : 1;
continue;
}
if (i !== 1) {
if (s === "[") {
n++;
continue;
}
if (s === "]" && n > 0) {
n--;
continue;
}
if (!(n > 0)) {
if (s === "(") {
r++;
continue;
}
if (s === ")" && (r--, r === 0)) return t === !0 && o !== e.length - 1 ? void 0 : {
type: e[0],
body: e.slice(2, o),
end: o
};
}
}
}
}, g = (e) => `${e.length === 1 ? r.escapeRegex(e[0]) : `[${e.map((e) => r.escapeRegex(e)).join("")}]`}*`, _ = (e) => {
let t = 0, n = [];
for (; t < e.length;) {
let r = h(e.slice(t), !1);
if (!r || r.type !== "*") return;
let i = d(r.body).map((e) => e.trim());
if (i.length !== 1) return;
let a = p(i[0]);
if (!a || a.length !== 1) return;
n.push(a), t += r.end + 1;
}
if (!(n.length < 1)) return n;
}, v = (e) => {
let t = 0, n = e.trim(), r = h(n);
for (; r;) t++, n = r.body.trim(), r = h(n);
return t;
}, y = (e, t) => {
if (t.maxExtglobRecursion === !1) return { risky: !1 };
let r = typeof t.maxExtglobRecursion == "number" ? t.maxExtglobRecursion : n.DEFAULT_MAX_EXTGLOB_RECURSION, i = d(e).map((e) => e.trim());
if (i.length > 1 && (i.some((e) => e === "") || i.some((e) => /^[*?]+$/.test(e)) || m(i))) return { risky: !0 };
let a = [], o = !1, s = !0;
for (let e of i) {
let t = _(e);
if (t) {
o = !0, a.push(...t);
continue;
}
let n = p(e);
if (n && n.length === 1) {
a.push(n);
continue;
}
if (s = !1, v(e) > r) return { risky: !0 };
}
return o ? s ? {
risky: !0,
safeOutput: g([...new Set(a)])
} : { risky: !0 } : { risky: !1 };
}, b = (e, t) => {
if (typeof e != "string") throw TypeError("Expected a string");
e = c[e] || e;
let d = { ...t }, f = typeof d.maxLength == "number" ? Math.min(i, d.maxLength) : i, p = e.length;
if (p > f) throw SyntaxError(`Input length: ${p}, exceeds maximum allowed length: ${f}`);
let m = {
type: "bos",
value: "",
output: d.prepend || ""
}, h = [m], g = d.capture ? "" : "?:", _ = n.globChars(d.windows), v = n.extglobChars(_), { DOT_LITERAL: x, PLUS_LITERAL: S, SLASH_LITERAL: C, ONE_CHAR: w, DOTS_SLASH: T, NO_DOT: E, NO_DOT_SLASH: D, NO_DOTS_SLASH: O, QMARK: k, QMARK_NO_DOT: A, STAR: ee, START_ANCHOR: j } = _, M = (e) => `(${g}(?:(?!${j}${e.dot ? T : x}).)*?)`, te = d.dot ? "" : E, ne = d.dot ? k : A, re = d.bash === !0 ? M(d) : ee;
d.capture && (re = `(${re})`), typeof d.noext == "boolean" && (d.noextglob = d.noext);
let N = {
input: e,
index: -1,
start: 0,
dot: d.dot === !0,
consumed: "",
output: "",
prefix: "",
backtrack: !1,
negated: !1,
brackets: 0,
braces: 0,
parens: 0,
quotes: 0,
globstar: !1,
tokens: h
};
e = r.removePrefix(e, N), p = e.length;
let P = [], F = [], ie = [], I = m, L, R = () => N.index === p - 1, z = N.peek = (t = 1) => e[N.index + t], B = N.advance = () => e[++N.index] || "", V = () => e.slice(N.index + 1), H = (e = "", t = 0) => {
N.consumed += e, N.index += t;
}, ae = (e) => {
N.output += e.output == null ? e.value : e.output, H(e.value);
}, oe = () => {
let e = 1;
for (; z() === "!" && (z(2) !== "(" || z(3) === "?");) B(), N.start++, e++;
return e % 2 != 0 && (N.negated = !0, N.start++, !0);
}, se = (e) => {
N[e]++, ie.push(e);
}, ce = (e) => {
N[e]--, ie.pop();
}, U = (e) => {
if (I.type === "globstar") {
let t = N.braces > 0 && (e.type === "comma" || e.type === "brace"), n = e.extglob === !0 || P.length && (e.type === "pipe" || e.type === "paren");
e.type !== "slash" && e.type !== "paren" && !t && !n && (N.output = N.output.slice(0, -I.output.length), I.type = "star", I.value = "*", I.output = re, N.output += I.output);
}
if (P.length && e.type !== "paren" && (P[P.length - 1].inner += e.value), (e.value || e.output) && ae(e), I && I.type === "text" && e.type === "text") {
I.output = (I.output || I.value) + e.value, I.value += e.value;
return;
}
e.prev = I, h.push(e), I = e;
}, W = (e, t) => {
let n = {
...v[t],
conditions: 1,
inner: ""
};
n.prev = I, n.parens = N.parens, n.output = N.output, n.startIndex = N.index, n.tokensIndex = h.length;
let r = (d.capture ? "(" : "") + n.open;
se("parens"), U({
type: e,
value: t,
output: N.output ? "" : w
}), U({
type: "paren",
extglob: !0,
value: B(),
output: r
}), P.push(n);
}, le = (n) => {
let i = e.slice(n.startIndex, N.index + 1), a = y(e.slice(n.startIndex + 2, N.index), d);
if ((n.type === "plus" || n.type === "star") && a.risky) {
let e = a.safeOutput ? (n.output ? "" : w) + (d.capture ? `(${a.safeOutput})` : a.safeOutput) : void 0, t = h[n.tokensIndex];
t.type = "text", t.value = i, t.output = e || r.escapeRegex(i);
for (let e = n.tokensIndex + 1; e < h.length; e++) h[e].value = "", h[e].output = "", delete h[e].suffix;
N.output = n.output + t.output, N.backtrack = !0, U({
type: "paren",
extglob: !0,
value: L,
output: ""
}), ce("parens");
return;
}
let o = n.close + (d.capture ? ")" : ""), s;
if (n.type === "negate") {
let e = re;
n.inner && n.inner.length > 1 && n.inner.includes("/") && (e = M(d)), (e !== re || R() || /^\)+$/.test(V())) && (o = n.close = `)$))${e}`), n.inner.includes("*") && (s = V()) && /^\.[^\\/.]+$/.test(s) && (o = n.close = `)${b(s, {
...t,
fastpaths: !1
}).output})${e})`), n.prev.type === "bos" && (N.negatedExtglob = !0);
}
U({
type: "paren",
extglob: !0,
value: L,
output: o
}), ce("parens");
};
if (d.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(e)) {
let n = !1, i = e.replace(s, (e, t, r, i, a, o) => i === "\\" ? (n = !0, e) : i === "?" ? t ? t + i + (a ? k.repeat(a.length) : "") : o === 0 ? ne + (a ? k.repeat(a.length) : "") : k.repeat(r.length) : i === "." ? x.repeat(r.length) : i === "*" ? t ? t + i + (a ? re : "") : re : t ? e : `\\${e}`);
return n === !0 && (i = d.unescape === !0 ? i.replace(/\\/g, "") : i.replace(/\\+/g, (e) => e.length % 2 == 0 ? "\\\\" : e ? "\\" : "")), i === e && d.contains === !0 ? (N.output = e, N) : (N.output = r.wrapOutput(i, N, t), N);
}
for (; !R();) {
if (L = B(), L === "\0") continue;
if (L === "\\") {
let e = z();
if (e === "/" && d.bash !== !0 || e === "." || e === ";") continue;
if (!e) {
L += "\\", U({
type: "text",
value: L
});
continue;
}
let t = /^\\+/.exec(V()), n = 0;
if (t && t[0].length > 2 && (n = t[0].length, N.index += n, n % 2 != 0 && (L += "\\")), d.unescape === !0 ? L = B() : L += B(), N.brackets === 0) {
U({
type: "text",
value: L
});
continue;
}
}
if (N.brackets > 0 && (L !== "]" || I.value === "[" || I.value === "[^")) {
if (d.posix !== !1 && L === ":") {
let e = I.value.slice(1);
if (e.includes("[") && (I.posix = !0, e.includes(":"))) {
let e = I.value.lastIndexOf("["), t = I.value.slice(0, e), n = a[I.value.slice(e + 2)];
if (n) {
I.value = t + n, N.backtrack = !0, B(), !m.output && h.indexOf(I) === 1 && (m.output = w);
continue;
}
}
}
(L === "[" && z() !== ":" || L === "-" && z() === "]") && (L = `\\${L}`), L === "]" && (I.value === "[" || I.value === "[^") && (L = `\\${L}`), d.posix === !0 && L === "!" && I.value === "[" && (L = "^"), I.value += L, ae({ value: L });
continue;
}
if (N.quotes === 1 && L !== "\"") {
L = r.escapeRegex(L), I.value += L, ae({ value: L });
continue;
}
if (L === "\"") {
N.quotes = N.quotes === 1 ? 0 : 1, d.keepQuotes === !0 && U({
type: "text",
value: L
});
continue;
}
if (L === "(") {
se("parens"), U({
type: "paren",
value: L
});
continue;
}
if (L === ")") {
if (N.parens === 0 && d.strictBrackets === !0) throw SyntaxError(u("opening", "("));
let e = P[P.length - 1];
if (e && N.parens === e.parens + 1) {
le(P.pop());
continue;
}
U({
type: "paren",
value: L,
output: N.parens ? ")" : "\\)"
}), ce("parens");
continue;
}
if (L === "[") {
if (d.nobracket === !0 || !V().includes("]")) {
if (d.nobracket !== !0 && d.strictBrackets === !0) throw SyntaxError(u("closing", "]"));
L = `\\${L}`;
} else se("brackets");
U({
type: "bracket",
value: L
});
continue;
}
if (L === "]") {
if (d.nobracket === !0 || I && I.type === "bracket" && I.value.length === 1) {
U({
type: "text",
value: L,
output: `\\${L}`
});
continue;
}
if (N.brackets === 0) {
if (d.strictBrackets === !0) throw SyntaxError(u("opening", "["));
U({
type: "text",
value: L,
output: `\\${L}`
});
continue;
}
ce("brackets");
let e = I.value.slice(1);
if (I.posix !== !0 && e[0] === "^" && !e.includes("/") && (L = `/${L}`), I.value += L, ae({ value: L }), d.literalBrackets === !1 || r.hasRegexChars(e)) continue;
let t = r.escapeRegex(I.value);
if (N.output = N.output.slice(0, -I.value.length), d.literalBrackets === !0) {
N.output += t, I.value = t;
continue;
}
I.value = `(${g}${t}|${I.value})`, N.output += I.value;
continue;
}
if (L === "{" && d.nobrace !== !0) {
se("braces");
let e = {
type: "brace",
value: L,
output: "(",
outputIndex: N.output.length,
tokensIndex: N.tokens.length
};
F.push(e), U(e);
continue;
}
if (L === "}") {
let e = F[F.length - 1];
if (d.nobrace === !0 || !e) {
U({
type: "text",
value: L,
output: L
});
continue;
}
let t = ")";
if (e.dots === !0) {
let e = h.slice(), n = [];
for (let t = e.length - 1; t >= 0 && (h.pop(), e[t].type !== "brace"); t--) e[t].type !== "dots" && n.unshift(e[t].value);
t = l(n, d), N.backtrack = !0;
}
if (e.comma !== !0 && e.dots !== !0) {
let n = N.output.slice(0, e.outputIndex), r = N.tokens.slice(e.tokensIndex);
e.value = e.output = "\\{", L = t = "\\}", N.output = n;
for (let e of r) N.output += e.output || e.value;
}
U({
type: "brace",
value: L,
output: t
}), ce("braces"), F.pop();
continue;
}
if (L === "|") {
P.length > 0 && P[P.length - 1].conditions++, U({
type: "text",
value: L
});
continue;
}
if (L === ",") {
let e = L, t = F[F.length - 1];
t && ie[ie.length - 1] === "braces" && (t.comma = !0, e = "|"), U({
type: "comma",
value: L,
output: e
});
continue;
}
if (L === "/") {
if (I.type === "dot" && N.index === N.start + 1) {
N.start = N.index + 1, N.consumed = "", N.output = "", h.pop(), I = m;
continue;
}
U({
type: "slash",
value: L,
output: C
});
continue;
}
if (L === ".") {
if (N.braces > 0 && I.type === "dot") {
I.value === "." && (I.output = x);
let e = F[F.length - 1];
I.type = "dots", I.output += L, I.value += L, e.dots = !0;
continue;
}
if (N.braces + N.parens === 0 && I.type !== "bos" && I.type !== "slash") {
U({
type: "text",
value: L,
output: x
});
continue;
}
U({
type: "dot",
value: L,
output: x
});
continue;
}
if (L === "?") {
if (!(I && I.value === "(") && d.noextglob !== !0 && z() === "(" && z(2) !== "?") {
W("qmark", L);
continue;
}
if (I && I.type === "paren") {
let e = z(), t = L;
(I.value === "(" && !/[!=<:]/.test(e) || e === "<" && !/<([!=]|\w+>)/.test(V())) && (t = `\\${L}`), U({
type: "text",
value: L,
output: t
});
continue;
}
if (d.dot !== !0 && (I.type === "slash" || I.type === "bos")) {
U({
type: "qmark",
value: L,
output: A
});
continue;
}
U({
type: "qmark",
value: L,
output: k
});
continue;
}
if (L === "!") {
if (d.noextglob !== !0 && z() === "(" && (z(2) !== "?" || !/[!=<:]/.test(z(3)))) {
W("negate", L);
continue;
}
if (d.nonegate !== !0 && N.index === 0) {
oe();
continue;
}
}
if (L === "+") {
if (d.noextglob !== !0 && z() === "(" && z(2) !== "?") {
W("plus", L);
continue;
}
if (I && I.value === "(" || d.regex === !1) {
U({
type: "plus",
value: L,
output: S
});
continue;
}
if (I && (I.type === "bracket" || I.type === "paren" || I.type === "brace") || N.parens > 0) {
U({
type: "plus",
value: L
});
continue;
}
U({
type: "plus",
value: S
});
continue;
}
if (L === "@") {
if (d.noextglob !== !0 && z() === "(" && z(2) !== "?") {
U({
type: "at",
extglob: !0,
value: L,
output: ""
});
continue;
}
U({
type: "text",
value: L
});
continue;
}
if (L !== "*") {
(L === "$" || L === "^") && (L = `\\${L}`);
let e = o.exec(V());
e && (L += e[0], N.index += e[0].length), U({
type: "text",
value: L
});
continue;
}
if (I && (I.type === "globstar" || I.star === !0)) {
I.type = "star", I.star = !0, I.value += L, I.output = re, N.backtrack = !0, N.globstar = !0, H(L);
continue;
}
let t = V();
if (d.noextglob !== !0 && /^\([^?]/.test(t)) {
W("star", L);
continue;
}
if (I.type === "star") {
if (d.noglobstar === !0) {
H(L);
continue;
}
let n = I.prev, r = n.prev, i = n.type === "slash" || n.type === "bos", a = r && (r.type === "star" || r.type === "globstar");
if (d.bash === !0 && (!i || t[0] && t[0] !== "/")) {
U({
type: "star",
value: L,
output: ""
});
continue;
}
let o = N.braces > 0 && (n.type === "comma" || n.type === "brace"), s = P.length && (n.type === "pipe" || n.type === "paren");
if (!i && n.type !== "paren" && !o && !s) {
U({
type: "star",
value: L,
output: ""
});
continue;
}
for (; t.slice(0, 3) === "/**";) {
let n = e[N.index + 4];
if (n && n !== "/") break;
t = t.slice(3), H("/**", 3);
}
if (n.type === "bos" && R()) {
I.type = "globstar", I.value += L, I.output = M(d), N.output = I.output, N.globstar = !0, H(L);
continue;
}
if (n.type === "slash" && n.prev.type !== "bos" && !a && R()) {
N.output = N.output.slice(0, -(n.output + I.output).length), n.output = `(?:${n.output}`, I.type = "globstar", I.output = M(d) + (d.strictSlashes ? ")" : "|$)"), I.value += L, N.globstar = !0, N.output += n.output + I.output, H(L);
continue;
}
if (n.type === "slash" && n.prev.type !== "bos" && t[0] === "/") {
let e = t[1] === void 0 ? "" : "|$";
N.output = N.output.slice(0, -(n.output + I.output).length), n.output = `(?:${n.output}`, I.type = "globstar", I.output = `${M(d)}${C}|${C}${e})`, I.value += L, N.output += n.output + I.output, N.globstar = !0, H(L + B()), U({
type: "slash",
value: "/",
output: ""
});
continue;
}
if (n.type === "bos" && t[0] === "/") {
I.type = "globstar", I.value += L, I.output = `(?:^|${C}|${M(d)}${C})`, N.output = I.output, N.globstar = !0, H(L + B()), U({
type: "slash",
value: "/",
output: ""
});
continue;
}
N.output = N.output.slice(0, -I.output.length), I.type = "globstar", I.output = M(d), I.value += L, N.output += I.output, N.globstar = !0, H(L);
continue;
}
let n = {
type: "star",
value: L,
output: re
};
if (d.bash === !0) {
n.output = ".*?", (I.type === "bos" || I.type === "slash") && (n.output = te + n.output), U(n);
continue;
}
if (I && (I.type === "bracket" || I.type === "paren") && d.regex === !0) {
n.output = L, U(n);
continue;
}
(N.index === N.start || I.type === "slash" || I.type === "dot") && (I.type === "dot" ? (N.output += D, I.output += D) : d.dot === !0 ? (N.output += O, I.output += O) : (N.output += te, I.output += te), z() !== "*" && (N.output += w, I.output += w)), U(n);
}
for (; N.brackets > 0;) {
if (d.strictBrackets === !0) throw SyntaxError(u("closing", "]"));
N.output = r.escapeLast(N.output, "["), ce("brackets");
}
for (; N.parens > 0;) {
if (d.strictBrackets === !0) throw SyntaxError(u("closing", ")"));
N.output = r.escapeLast(N.output, "("), ce("parens");
}
for (; N.braces > 0;) {
if (d.strictBrackets === !0) throw SyntaxError(u("closing", "}"));
N.output = r.escapeLast(N.output, "{"), ce("braces");
}
if (d.strictSlashes !== !0 && (I.type === "star" || I.type === "bracket") && U({
type: "maybe_slash",
value: "",
output: `${C}?`
}), N.backtrack === !0) {
N.output = "";
for (let e of N.tokens) N.output += e.output == null ? e.value : e.output, e.suffix && (N.output += e.suffix);
}
return N;
};
b.fastpaths = (e, t) => {
let a = { ...t }, o = typeof a.maxLength == "number" ? Math.min(i, a.maxLength) : i, s = e.length;
if (s > o) throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);
e = c[e] || e;
let { DOT_LITERAL: l, SLASH_LITERAL: u, ONE_CHAR: d, DOTS_SLASH: f, NO_DOT: p, NO_DOTS: m, NO_DOTS_SLASH: h, STAR: g, START_ANCHOR: _ } = n.globChars(a.windows), v = a.dot ? m : p, y = a.dot ? h : p, b = a.capture ? "" : "?:", x = {
negated: !1,
prefix: ""
}, S = a.bash === !0 ? ".*?" : g;
a.capture && (S = `(${S})`);
let C = (e) => e.noglobstar === !0 ? S : `(${b}(?:(?!${_}${e.dot ? f : l}).)*?)`, w = (e) => {
switch (e) {
case "*": return `${v}${d}${S}`;
case ".*": return `${l}${d}${S}`;
case "*.*": return `${v}${S}${l}${d}${S}`;
case "*/*": return `${v}${S}${u}${d}${y}${S}`;
case "**": return v + C(a);
case "**/*": return `(?:${v}${C(a)}${u})?${y}${d}${S}`;
case "**/*.*": return `(?:${v}${C(a)}${u})?${y}${S}${l}${d}${S}`;
case "**/.*": return `(?:${v}${C(a)}${u})?${l}${d}${S}`;
default: {
let t = /^(.*?)\.(\w+)$/.exec(e);
if (!t) return;
let n = w(t[1]);
return n ? n + l + t[2] : void 0;
}
}
}, T = w(r.removePrefix(e, x));
return T && a.strictSlashes !== !0 && (T += `${u}?`), T;
}, t.exports = b;
})), jf = /* @__PURE__ */ i(((e, t) => {
var n = kf(), r = Af(), i = Of(), a = Df(), o = (e) => e && typeof e == "object" && !Array.isArray(e), s = (e, t, n = !1) => {
if (Array.isArray(e)) {
let r = e.map((e) => s(e, t, n));
return (e) => {
for (let t of r) {
let n = t(e);
if (n) return n;
}
return !1;
};
}
let r = o(e) && e.tokens && e.input;
if (e === "" || typeof e != "string" && !r) throw TypeError("Expected pattern to be a non-empty string");
let i = t || {}, a = i.windows, c = r ? s.compileRe(e, t) : s.makeRe(e, t, !1, !0), l = c.state;
delete c.state;
let u = () => !1;
if (i.ignore) {
let e = {
...t,
ignore: null,
onMatch: null,
onResult: null
};
u = s(i.ignore, e, n);
}
let d = (n, r = !1) => {
let { isMatch: o, match: d, output: f } = s.test(n, c, t, {
glob: e,
posix: a
}), p = {
glob: e,
state: l,
regex: c,
posix: a,
input: n,
output: f,
match: d,
isMatch: o
};
return typeof i.onResult == "function" && i.onResult(p), o === !1 ? (p.isMatch = !1, r ? p : !1) : u(n) ? (typeof i.onIgnore == "function" && i.onIgnore(p), p.isMatch = !1, r ? p : !1) : (typeof i.onMatch == "function" && i.onMatch(p), !r || p);
};
return n && (d.state = l), d;
};
s.test = (e, t, n, { glob: r, posix: a } = {}) => {
if (typeof e != "string") throw TypeError("Expected input to be a string");
if (e === "") return {
isMatch: !1,
output: ""
};
let o = n || {}, c = o.format || (a ? i.toPosixSlashes : null), l = e === r, u = l && c ? c(e) : e;
return l === !1 && (u = c ? c(e) : e, l = u === r), (l === !1 || o.capture === !0) && (l = o.matchBase === !0 || o.basename === !0 ? s.matchBase(e, t, n, a) : t.exec(u)), {
isMatch: !!l,
match: l,
output: u
};
}, s.matchBase = (e, t, n, r = n && n.windows) => (t instanceof RegExp ? t : s.makeRe(t, n)).test(i.basename(e, { windows: r })), s.isMatch = (e, t, n) => s(t, n)(e), s.parse = (e, t) => Array.isArray(e) ? e.map((e) => s.parse(e, t)) : r(e, {
...t,
fastpaths: !1
}), s.scan = (e, t) => n(e, t), s.compileRe = (e, t, n = !1, r = !1) => {
if (n === !0) return e.output;
let i = t || {}, a = i.contains ? "" : "^", o = i.contains ? "" : "$", c = `${a}(?:${e.output})${o}`;
e && e.negated === !0 && (c = `^(?!${c}).*$`);
let l = s.toRegex(c, t);
return r === !0 && (l.state = e), l;
}, s.makeRe = (e, t = {}, n = !1, i = !1) => {
if (!e || typeof e != "string") throw TypeError("Expected a non-empty string");
let a = {
negated: !1,
fastpaths: !0
};
return t.fastpaths !== !1 && (e[0] === "." || e[0] === "*") && (a.output = r.fastpaths(e, t)), a.output || (a = r(e, t)), s.compileRe(a, t, n, i);
}, s.toRegex = (e, t) => {
try {
let n = t || {};
return new RegExp(e, n.flags || (n.nocase ? "i" : ""));
} catch (e) {
if (t && t.debug === !0) throw e;
return /$^/;
}
}, s.constants = a, t.exports = s;
})), Mf = /* @__PURE__ */ n((/* @__PURE__ */ i(((e, t) => {
var n = jf(), r = Of();
function i(e, t, i = !1) {
return t && (t.windows === null || t.windows === void 0) && (t = {
...t,
windows: r.isWindows()
}), n(e, t, i);
}
Object.assign(i, n), t.exports = i;
})))(), 1), Nf = /* @__PURE__ */ r({
greatest: () => Rf,
greatestLevel: () => zf,
latest: () => Lf,
minor: () => Bf,
newest: () => Uf,
patch: () => Vf,
semver: () => Hf
}), Pf = d(_.execFile);
async function Ff(e) {
let t = (await Pf("git", [
"ls-remote",
"--tags",
e
])).stdout, n = {};
for (let e of t.trim().split("\n")) {
let t = e.split(" ");
n[t[1].replace(/^refs\/tags\/|\^{}$/g, "")] = t[0];
}
return n;
}
async function If(e, t, n) {
t = t.replace(/^github:/, "");
let { auth: r, protocol: i, host: a, path: o } = (0, Vn.default)(t), s;
try {
if (i !== null) s = await Ff(`${i ? i.replace("git+", "") : "https:"}//${r ? r + "@" : ""}${a}/${o?.replace(/^:/, "")}`);
else try {
s = await Ff(`ssh://git@${a}/${o?.replace(/^:/, "")}`);
} catch {
s = await Ff(`https://${r ? r + "@" : ""}${a}/${o}`);
}
} catch {
X(n ?? {}, `Invalid, private repo, or no tags for ${e}: ${t}`, "verbose");
return;
}
return Object.keys(s).map(Cr).filter((e) => G.default.valid(e)).sort(fr);
}
var Lf = async (e, t, n) => {
let r = await If(e, t, n);
if (!r) return { version: null };
let i = n?.pre ? r : r.filter((e) => !_r(e)), a = i[i.length - 1];
return { version: a ? Nr(t, a) : null };
}, Rf = async (e, t, n) => {
let r = await If(e, t, n);
if (!r) return { version: null };
let i = r[r.length - 1];
return { version: i ? Nr(t, i) : null };
}, zf = (e) => async (t, n, r = {}) => {
let i = decodeURIComponent((0, Vn.default)(n).branch).replace(/^semver:/, ""), a = await If(t, n, r);
if (!a) return { version: null };
let o = mr(a.map((e) => e.replace(/^v/, "")), i, e);
return { version: o ? Nr(n, o) : null };
}, Bf = zf("minor"), Vf = zf("patch"), Hf = async (e, t, n) => ({ version: null }), Uf = Rf, Wf = /* @__PURE__ */ r({ latest: () => qf }), Gf = (e) => e && e.startsWith("http://") || e.startsWith("https://"), Kf = (0, La.default)(async (e) => {
let t = e.registry, n;
if (Gf(t)) n = await (await fetch(t)).text();
else try {
n = await s.readFile(t, "utf8");
} catch {
$(e, `\nThe specified static registry file does not exist: ${e.registry}`);
}
return JSON.parse(n);
}), qf = async (e, t, n) => ({ version: (await Kf(n || {}))[e] || null }), Jf = {
npm: mo,
pnpm: bc,
yarn: el,
bun: Jo,
gitTags: Nf,
staticRegistry: Wf
}, Yf = [
"latest",
"newest",
"greatest",
"minor",
"patch",
"semver"
];
//#endregion
//#region src/lib/initOptions.ts
function Xf(e) {
if (typeof e == "string") return e.trim();
if (Array.isArray(e) && (e.length === 0 || typeof e[0] == "string")) {
let t = e.map((e) => typeof e == "string" ? e.trim() : e).filter((e) => e);
return t.length > 0 ? t : void 0;
}
return e;
}
function Zf(e) {
try {
return new URL(e), !0;
} catch {
return !1;
}
}
var Qf = (e, t = Math.round(e * 10) / 10) => `${t} day${t === 1 ? "" : "s"}`;
async function $f(e, { cli: t } = {}) {
let n = _n(e.color), r, i;
if (!t) {
r = { ...e }, i = Object.keys(e);
let t = Ni.reduce((e, t) => ({
...e,
...t.default == null ? null : { [t.long]: t.default }
}), {}), n = {
jsonUpgraded: !0,
silent: e.silent || e.loglevel === void 0 && !e.verbose,
args: []
};
e = {
...t,
...n,
...e
};
}
let a = {
...e,
...e.packageData && typeof e.packageData != "string" ? { packageData: JSON.stringify(e.packageData, null, 2) } : null,
cli: t,
...t ? null : {
raw: r,
cliKeys: i
}
}, o = a.silent || a.format?.includes("lines") ? "silent" : a.verbose ? "verbose" : a.loglevel, s = Object.keys(a).filter((e) => e.startsWith("json")).some((e) => a[e]);
!s && o !== "silent" && a.rcConfigPath && !a.doctor && X(a, `Using config file ${a.rcConfigPath}`);
let c = Ni.filter(({ long: e, deprecated: t }) => t && a[e] || e === "packageManager" && a.packageManager === "staticRegistry");
if (c.length > 0) {
for (let { long: e, description: t } of c) {
let r = e === "packageManager" ? "--packageManager staticRegistry is deprecated. Use --registryType json." : `--${e}: ${t}`;
X(a, n.yellow(r), "warn");
}
X(a, "", "warn");
}
for (let { long: e, choices: t } of Ni) {
if (!t || t.length === 0) continue;
let n = a[e], r = Array.isArray(n) ? n : [n];
if (r.length === 0) continue;
let i = r.filter((e) => !t.includes(e));
i.length > 0 && $(a, `Invalid option value: --${e} ${i.join(",")}. Valid values are: ${t.join(", ")}.`);
}
a.cwd && !await Tn(a.cwd) && $(a, `No such directory: ${a.cwd}`);
let l = Xf(a.args), u = Xf(a.filter), d = Xf(a.filterVersion), f = Xf(a.reject), p = Xf(a.rejectVersion), m = a.registryType || (a.registry?.endsWith(".json") ? "json" : "npm");
a.filter && l && l.join(" ") !== (Array.isArray(u) ? u.join(" ") : u) ? $(a, "Cannot specify a filter using both --filter and args. Did you forget to quote an argument?\nSee: https://github.com/raineorshine/npm-check-updates/issues/759#issuecomment-723587297") : a.packageFile && a.deep ? $(a, "Cannot specify both --packageFile and --deep. --deep is an alias for --packageFile '**/package.json'") : a.format?.includes("lines") && a.jsonUpgraded ? $(a, "Cannot specify both --format lines and --jsonUpgraded.") : a.format?.includes("lines") && a.jsonAll ? $(a, "Cannot specify both --format lines and --jsonAll.") : a.format?.includes("lines") && a.format.length > 1 ? $(a, "Cannot use --format lines with other formatting options.") : a.workspace?.length && a.workspaces ? $(a, "Cannot specify both --workspace and --workspaces.") : a.deep && (a.workspace?.length || a.workspaces) ? $(a, `Cannot specify both --deep and --workspace${a.workspaces ? "s" : ""}.`) : a.doctor && (a.workspace?.length || a.workspaces) ? $(a, `Doctor mode is not currently supported with --workspace${a.workspaces ? "s" : ""}.`) : a.packageManager === "staticRegistry" && !a.registry ? $(a, "When --package-manager staticRegistry is specified, you must provide the path for the registry file with --registry.") : a.registryType === "json" && !a.registry ? $(a, "When --registryType json is specified, you must provide the path for the registry file with --registry. Run \"ncu --help registryType\" for details.") : m !== "json" && a.registry && !Zf(a.registry) && $(a, `--registry must be a valid URL. Invalid value: "${a.registry}"`);
let h = await Bi(a);
if (a.cooldown != null) {
if (typeof a.cooldown == "string") {
let e = zn(a.cooldown);
e === null ? $(a, `Invalid cooldown value: "${a.cooldown}". Use a number (days) or a string like "7d", "12h", or "30m".`) : a.cooldown = e;
}
let e = typeof a.cooldown == "number" && !isNaN(a.cooldown) && a.cooldown >= 0, t = typeof a.cooldown == "function";
!e && !t && $(a, "Cooldown must be a non-negative number (days), a string like \"7d\", \"12h\", or \"30m\", or a predicate function.");
} else if (h === "pnpm") {
let e = await $c.getPnpmWorkspaceMinimumReleaseAge({ cwd: a.cwd });
if (e != null) {
let { minimumReleaseAge: t, minimumReleaseAgeExclude: n } = e, r = t / 1440;
if (n.length > 0) {
let e = n.map((e) => (0, Mf.default)(e));
a.cooldown = (t) => e.some((e) => e(t)) ? null : r, X({
...a,
json: s
}, `Using minimumReleaseAge from pnpm-workspace.yaml: ${Qf(r)} (${n.length} excluded pattern${n.length === 1 ? "" : "s"})`);
} else a.cooldown = r, X({
...a,
json: s
}, `Using minimumReleaseAge from pnpm-workspace.yaml: ${Qf(r)}`);
}
} else if (h === "yarn") {
let e = await Cl.getYarnMinimalAgeGate(a);
if (e != null) {
let { npmMinimalAgeGate: t, npmPreapprovedPackages: n } = e, r = t / 1440;
if (n.length > 0) {
let e = n.map((e) => (0, Mf.default)(e));
a.cooldown = (t) => e.some((e) => e(t)) ? null : r, X({
...a,
json: s
}, `Using npmMinimalAgeGate from .yarnrc.yml: ${r} day${r === 1 ? "" : "s"} (${n.length} pre-approved package${n.length === 1 ? "" : "s"})`);
} else a.cooldown = r, X({
...a,
json: s
}, `Using npmMinimalAgeGate from .yarnrc.yml: ${Qf(r)}`);
}
} else {
let e = Eo.findNpmConfig(), t = e?.minReleaseAge;
if (t != null) {
let n = typeof t == "string" ? zn(t) ?? parseInt(t, 10) : typeof t == "number" ? t : null;
if (n != null && !isNaN(n)) {
let t = e?.minReleaseAgeExclude, r = [...new Set((Array.isArray(t) ? t : typeof t == "string" ? [t] : []).flatMap((e) => e.split(",")).map((e) => e.trim()).filter((e) => e))];
if (r.length > 0) {
let e = r.map((e) => ({
pattern: e,
match: (0, Mf.default)(e, {
nonegate: !0,
noext: !0
})
}));
a.cooldown = (t) => e.some(({ pattern: e, match: n }) => t === e || n(t)) ? null : n, X({
...a,
json: s
}, `Using min-release-age from .npmrc: ${Qf(n)} (${r.length} excluded pattern${r.length === 1 ? "" : "s"})`);
} else a.cooldown = n, X({
...a,
json: s
}, `Using min-release-age from .npmrc: ${Qf(n)}`);
}
}
}
let g = a.target || "latest", _ = g === "newest" || g === "greatest", v = {
...a,
...a.deep ? { packageFile: "**/package.json" } : null,
...h === "deno" ? { dep: [
"imports",
"prod",
"dev",
"optional",
"packageManager"
] } : null,
...a.format && a.format.length > 0 ? { format: a.format } : null,
filter: l || u,
filterVersion: d,
json: s,
loglevel: o,
minimal: a.minimal !== void 0 && a.minimal,
...a.pre != null || _ ? { pre: a.pre == null ? _ : !!a.pre } : null,
reject: f,
rejectVersion: p,
target: g,
...a.interactive && a.upgrade === void 0 ? { upgrade: !s } : null,
packageManager: h,
...a.prefix ? { prefix: await (Jf[h || ""]?.defaultPrefix || Jf.npm.defaultPrefix)(a) } : null,
registryType: m
};
v.cacher = await ni(v);
let y = J(v, (e, t) => t === void 0 ? null : { [e]: t });
return !a.packageManager && h !== "npm" && X(y, `Using ${h}`), y;
}
//#endregion
//#region src/lib/mergeOptions.ts
function ep(e, t) {
return Array.from(/* @__PURE__ */ new Set([...e || [], ...t || []]));
}
function tp(e, t) {
let n = e || {}, r = t || {}, i = {
...n,
...r
};
for (let e of Object.keys(i)) Array.isArray(n[e]) && Array.isArray(r[e]) && (i[e] = ep(n[e], r[e]));
return i;
}
//#endregion
//#region src/lib/filterAndReject.ts
var np = (/* @__PURE__ */ i(((e, t) => {
var n = (e) => typeof e == "function" ? e : () => e, r = (...e) => (...t) => e.length === 0 || !!n(e[0])(...t) && r(...e.slice(1))(...t), i = (...e) => (...t) => e.length > 0 && (!!n(e[0])(...t) || i(...e.slice(1))(...t));
t.exports = {
and: r,
or: i
};
})))();
function rp(e, { allowFunction: t = !0 } = {}) {
let n;
if (!e) n = () => !0;
else if (typeof e == "string") {
if (e[0] === "/" && e.at(-1) === "/") {
let t = new RegExp(e.slice(1, -1));
n = (e) => t.test(e);
} else {
let t = e.split(/[\s,]+/);
n = (e) => t.some((0, np.or)((t) => (0, Mf.default)(t)(e), (t) => !t.includes("/") && e.includes("/") && (0, Mf.default)(t)(e.replace(/\//g, "_"))));
}
} else if (Array.isArray(e)) n = (n, r) => e.some((e) => rp(e, { allowFunction: t })(n, r));
else if (e instanceof RegExp) n = (t) => e.test(t);
else if (typeof e == "function") {
if (!t) throw TypeError("filterVersion and rejectVersion do not support predicate functions. Use filter or reject instead, which receive the package name and parsed current version.");
n = (t, n) => e(t, (0, pe.parseRange)(n ?? t));
} else throw TypeError("Invalid filter. Must be a RegExp, array, or comma-or-space-delimited list.");
return n;
}
function ip(e, t, n, r) {
return (0, np.and)((n, r) => (0, np.and)(!e || rp(e), t ? (...e) => !rp(t)(...e) : !0)(n, r), (e, t) => (0, np.and)(!n || rp(n, { allowFunction: !1 }), r ? (...e) => !rp(r, { allowFunction: !1 })(...e) : !0)(t));
}
//#endregion
//#region src/lib/getPackageManager.ts
function ap(e, t) {
return !t || t === "deno" ? Jf.npm : e.registryType === "json" ? Jf.staticRegistry : (Jf[t] || $(e, `Invalid package manager: ${t}`), Jf[t]);
}
//#endregion
//#region src/lib/getInstalledPackages.ts
async function op(e = {}) {
let t = await ap(e, e.packageManager).list?.({
cwd: e.cwd,
prefix: e.prefix,
global: e.global
});
t || $(e, "Unable to retrieve package list");
let n = ip(e.filter, e.reject, e.filterVersion, e.rejectVersion), r = {};
try {
r = bn(t, (e, t) => !!t && !rr(t) && n(e, t));
} catch (t) {
$(e, "Invalid filter: " + (t.message || t));
}
return r;
}
//#endregion
//#region src/lib/quoteGlobalPackageSpec.ts
var sp = (e) => /^@[^/]*\./.test(e) ? `"${e}"` : e, cp = /* @__PURE__ */ r({
default: () => lp,
pMapSkip: () => up
});
async function lp(e, t, { concurrency: n = Infinity, stopOnError: r = !0, signal: i } = {}) {
return new Promise((a, o) => {
if (e[Symbol.iterator] === void 0 && e[Symbol.asyncIterator] === void 0) throw TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof e})`);
if (typeof t != "function") throw TypeError("Mapper function is required");
if (!(Number.isSafeInteger(n) && n >= 1 || n === Infinity)) throw TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${n}\` (${typeof n})`);
let s = [], c = [], l = /* @__PURE__ */ new Map(), u = !1, d = !1, f = !1, p = 0, m = 0, h = e[Symbol.iterator] === void 0 ? e[Symbol.asyncIterator]() : e[Symbol.iterator](), g = () => {
y(i.reason);
}, _ = () => {
i?.removeEventListener("abort", g);
}, v = (e) => {
a(e), _();
}, y = (e) => {
u = !0, d = !0, o(e), _();
};
if (i) {
if (i.aborted) {
y(i.reason);
return;
}
i.addEventListener("abort", g, { once: !0 });
}
let b = async () => {
if (d) return;
let e = await h.next(), n = m;
if (m++, e.done) {
if (f = !0, p === 0 && !d) {
if (!r && c.length > 0) {
y(AggregateError(c));
return;
}
if (d = !0, l.size === 0) {
v(s);
return;
}
let e = [];
for (let [t, n] of s.entries()) l.get(t) !== up && e.push(n);
v(e);
}
return;
}
p++, (async () => {
try {
let r = await e.value;
if (d) return;
let i = await t(r, n);
i === up && l.set(n, i), s[n] = i, p--, await b();
} catch (e) {
if (r) y(e);
else {
c.push(e), p--;
try {
await b();
} catch (e) {
y(e);
}
}
}
})();
};
(async () => {
for (let e = 0; e < n; e++) {
try {
await b();
} catch (e) {
y(e);
break;
}
if (f || u) break;
}
})();
});
}
var up, dp = t((() => {
up = Symbol("skip");
})), fp = /* @__PURE__ */ i(((e, t) => {
e = t.exports = n;
function n(e, t) {
if (this.stream = t.stream || process.stderr, typeof t == "number") {
var n = t;
t = {}, t.total = n;
} else {
if (t ||= {}, typeof e != "string") throw Error("format required");
if (typeof t.total != "number") throw Error("total required");
}
this.fmt = e, this.curr = t.curr || 0, this.total = t.total, this.width = t.width || this.total, this.clear = t.clear, this.chars = {
complete: t.complete || "=",
incomplete: t.incomplete || "-",
head: t.head || t.complete || "="
}, this.renderThrottle = t.renderThrottle === 0 ? 0 : t.renderThrottle || 16, this.lastRender = -Infinity, this.callback = t.callback || function() {}, this.tokens = {}, this.lastDraw = "";
}
n.prototype.tick = function(e, t) {
if (e !== 0 && (e ||= 1), typeof e == "object" && (t = e, e = 1), t && (this.tokens = t), this.curr == 0 && (this.start = /* @__PURE__ */ new Date()), this.curr += e, this.render(), this.curr >= this.total) {
this.render(void 0, !0), this.complete = !0, this.terminate(), this.callback(this);
return;
}
}, n.prototype.render = function(e, t) {
if (t = t !== void 0 && t, e && (this.tokens = e), this.stream.isTTY) {
var n = Date.now(), r = n - this.lastRender;
if (!(!t && r < this.renderThrottle)) {
this.lastRender = n;
var i = this.curr / this.total;
i = Math.min(Math.max(i, 0), 1);
var a = Math.floor(i * 100), o, s, c, l = /* @__PURE__ */ new Date() - this.start, u = a == 100 ? 0 : l * (this.total / this.curr - 1), d = this.curr / (l / 1e3), f = this.fmt.replace(":current", this.curr).replace(":total", this.total).replace(":elapsed", isNaN(l) ? "0.0" : (l / 1e3).toFixed(1)).replace(":eta", isNaN(u) || !isFinite(u) ? "0.0" : (u / 1e3).toFixed(1)).replace(":percent", a.toFixed(0) + "%").replace(":rate", Math.round(d)), p = Math.max(0, this.stream.columns - f.replace(":bar", "").length);
p && process.platform === "win32" && --p;
var m = Math.min(this.width, p);
if (c = Math.round(m * i), s = Array(Math.max(0, c + 1)).join(this.chars.complete), o = Array(Math.max(0, m - c + 1)).join(this.chars.incomplete), c > 0 && (s = s.slice(0, -1) + this.chars.head), f = f.replace(":bar", s + o), this.tokens) for (var h in this.tokens) f = f.replace(":" + h, this.tokens[h]);
this.lastDraw !== f && (this.stream.cursorTo(0), this.stream.write(f), this.stream.clearLine(1), this.lastDraw = f);
}
}
}, n.prototype.update = function(e, t) {
var n = Math.floor(e * this.total) - this.curr;
this.tick(n, t);
}, n.prototype.interrupt = function(e) {
this.stream.clearLine(), this.stream.cursorTo(0), this.stream.write(e), this.stream.write("\n"), this.stream.write(this.lastDraw);
}, n.prototype.terminate = function() {
this.clear ? this.stream.clearLine && (this.stream.clearLine(), this.stream.cursorTo(0)) : this.stream.write("\n");
};
})), pp = /* @__PURE__ */ i(((e, t) => {
t.exports = fp();
}));
//#endregion
//#region src/lib/resolveDistTagsInPeerDependencies.ts
dp();
var mp = /* @__PURE__ */ n(pp(), 1), hp = /^[a-z][a-z0-9._-]*$/i, gp = (e) => e.split("||").map((e) => e.trim()), _p = (e) => G.default.validRange(e) ? [] : gp(e).filter((e) => hp.test(e) && !G.default.validRange(e)), vp = (e, t) => {
let n = gp(e).map((e) => Object.hasOwn(t, e) ? t[e] : e).join(" || ");
return G.default.validRange(n) ? n : e;
};
async function yp(e, t) {
let n = ap(t, t.packageManager);
if (!n.getDistTags) return e;
let r = {}, i = {};
for (let [a, o] of Object.entries(e)) {
let e = {};
for (let [i, a] of Object.entries(o)) {
if (typeof a != "string" || _p(a).length === 0) {
e[i] = a;
continue;
}
e[i] = vp(a, r[i] ??= await n.getDistTags(i, t).catch(() => ({})));
}
i[a] = e;
}
return i;
}
//#endregion
//#region src/lib/getPeerDependenciesFromRegistry.ts
function bp(e, t) {
let n = /* @__PURE__ */ new Set(), r = [[t]];
for (; r.length > 0;) {
let t = [];
for (let i of r) {
let r = i[0];
if (n.has(r)) continue;
n.add(r);
let a = Object.keys(e[r] ?? {});
for (let e of a) {
if (e === i.at(-1)) return {
isCircular: !0,
offendingPackage: r
};
t.push([e, ...i]);
}
}
r = t;
}
return { isCircular: !1 };
}
async function xp(e, t) {
let n = ap(t, t.packageManager);
if (!n.getPeerDependencies) return {};
let r = Object.keys(e).length, i;
!t.json && t.loglevel !== "silent" && t.loglevel !== "verbose" && r > 0 && (i = new mp.default("[:bar] :current/:total :percent", {
total: r,
width: 20
}), i.render());
let a = Object.entries(e), o = [], s = await lp(a, async ([e, r]) => {
let a, s = t.cacher?.getPeers(e, r);
if (s) a = s;
else if (!r || In(r) || kr(r) || nr(r)) a = {};
else try {
a = await n.getPeerDependencies(e, r, { cwd: t.cwd }), t.cacher?.setPeers(e, r, a);
} catch (n) {
o.push(e), X(t, `\nFailed to get the peer dependencies of ${e}@${r}:\n${n instanceof Error ? n.message : n}`, "verbose"), a = {};
}
return i && i.tick(), {
pkg: e,
dependencies: a
};
}, { concurrency: t.concurrency }), c = {};
for (let { pkg: e, dependencies: t } of s) {
c[e] = t;
let n = bp(c, e);
n.isCircular && delete c[e][n.offendingPackage];
}
let l = t.peerDependenciesFailed ??= /* @__PURE__ */ new Set(), u = o.filter((e) => !l.has(e));
if (u.length > 0) {
for (let e of u) l.add(e);
X(t, `\nCould not determine the peer dependencies of ${u.slice(0, 5).join(", ")}${u.length > 5 ? ` (and ${u.length - 5} more)` : ""}. Incompatible updates of these packages will not be ignored. Run with --verbose for details.`, "warn");
}
return await t.cacher?.save(), t.cacher?.log(!0), yp(c, t);
}
//#endregion
//#region src/lib/queryVersions.ts
dp();
async function Sp(e, t = {}) {
let n = _n(t.color), r = Object.keys(e), i = ap(t, t.packageManager), a;
!t.json && t.loglevel !== "silent" && t.loglevel !== "verbose" && r.length > 0 && (a = new mp.default("[:bar] :current/:total :percent", {
total: r.length,
width: 20
}), a.render());
async function o(r) {
let o = Er(e[r]), [s, c] = o || [r, e[r]];
if (In(c)) return a?.tick(), { version: null };
let l = t.target || "latest", u = typeof l == "string" ? l : l(s, (0, pe.parseRange)(c)), [d, f] = u.startsWith("@") ? ["distTag", u.slice(1)] : [u, "latest"];
if (!t.cooldown) {
let e = t.cacher?.get(s, d);
if (e?.version && (e?.time || !t.format?.includes("time"))) return a?.tick(), e;
}
let p, m = kr(e[r]), h = m ? Jf.gitTags : i, g = m ? "github urls" : t.packageManager || "npm", _ = h[d];
if (!_) {
let e = Yf.filter((e) => e in h);
$(t, n.red(`\nUnsupported target "${d}" using ${g}`) + "\nSupported version targets are: " + e.join(", ") + (m ? "" : ", and tags (e.g. @next)"), { color: !1 });
}
let v = t.retry ?? 2;
try {
p = await _(s, c, {
...t,
distTag: f,
pre: t.pre == null ? u.startsWith("@") || _r(c) : t.pre,
retry: v
});
} catch (e) {
let t = e ? (e.message || e).toString() : "";
t.match(/E504|Gateway Timeout/i) ? p = { error: `${t}. All ${v} retry attempts failed.` } : t.match(/E400|E404|ENOTFOUND|404 Not Found|400 Bad Request/i) ? p = { error: `${t.replace(/ - Not found$/i, "")}. All ${v} retry attempts failed. Either your internet connection is down, the registry is inaccessible, the authentication credentials are invalid, or the package does not exist.` } : e?.code === "ERR_INVALID_URL" ? p = { error: t || "Invalid URL" } : (!process.env.NCU_TESTS && /(Response|network) timeout/i.test(t) && console.error("\n\n" + n.red("FetchError: Request Timeout. npm-registry-fetch defaults to 30000 (30 seconds). Try setting the --timeout option (in milliseconds) to override this.") + "\n"), p = { error: e?.body?.error || String(e) });
}
return p.version = !m && o && p?.version ? Tr(s, p.version) : p?.version ?? null, a?.tick(), p.version && !t.cooldown && t.cacher?.set(s, d, p.version, p.time), p;
}
let s = await lp(r, o, { concurrency: t.concurrency });
return await t.cacher?.save(), t.cacher?.log(), J(s, (e, t) => e.version || e.error || e.cooldownInfo ? { [r[t]]: e } : null);
}
//#endregion
//#region src/lib/upgradePackageDefinitions.ts
var Cp = (e, t, n) => {
let r = {
...e,
...t
}, i = ru(t, (e, t) => {
let i = n[t];
return !i || Object.entries(i).every(([e, t]) => r[e] === void 0 || !G.default.validRange(t) || !G.default.validRange(r[e]) || G.default.intersects(r[e], t));
}), a = Object.keys(t).length > Object.keys(i).length, o = n;
return a && (o = ru(n, (e, n) => i[n] || !t[n])), {
violated: a,
filteredUpgradedDependencies: i,
upgradedPeerDependencies: o
};
}, wp = (e, t) => J({
...e,
...t
}, (t, n) => ({ [t]: !n.version && !n.error && e[t]?.version ? e[t] : n }));
async function Tp(e, t) {
let n = await Sp(e, t), r = J(n, (n, r) => r?.version && (!t.filterResults || t.filterResults(n, {
currentVersion: e[n],
currentVersionSemver: (0, pe.parseRange)(e[n]),
upgradedVersion: r.version,
upgradedVersionSemver: (0, pe.parse)(r.version)
})) ? { [n]: r.version } : null), i = ru(cu(e, r, t), (n, i) => !t.jsonUpgraded || !t.minimal || !G.default.satisfies(r[i], e[i])), a = ru(r, (e, t) => i[t]), o = [
i,
n,
t.peerDependencies
];
if (!t.peer || Object.keys(a).length === 0) return o;
if (t.peer && Object.keys(a).length > 0) {
let r = await xp(a, t), s;
if (u(t.peerDependencies, {
...t.peerDependencies,
...r
})) {
if (s = Cp(e, i, t.peerDependencies), !s.violated) return o;
} else s = {
violated: !1,
filteredUpgradedDependencies: i,
upgradedPeerDependencies: r
};
let c = 0;
do {
if (c++ > 6) throw Error("Stuck in a while loop. Please report an issue");
let r = {
...t.peerDependencies,
...s.upgradedPeerDependencies
};
if (u(t.peerDependencies, r)) return [
{},
n,
t.peerDependencies
];
let [i, a, l] = await Tp({
...e,
...s.filteredUpgradedDependencies
}, {
...t,
peerDependencies: r,
loglevel: "silent"
});
o = [
{
...s.filteredUpgradedDependencies,
...i
},
wp(n, a),
l
], s = Cp(e, o[0], o[2]);
} while (s.violated);
}
return o;
}
//#endregion
//#region src/lib/runGlobal.ts
async function Ep(e) {
X(e, "\nOptions:", "verbose"), Rr(e, e, "verbose"), X(e, "\nGetting installed packages", "verbose");
let t = {};
try {
let { cli: n, cwd: r, filter: i, filterVersion: a, global: o, packageManager: s, prefix: c, reject: l, rejectVersion: u } = e;
t = await op({
cli: n,
cwd: r,
filter: i,
filterVersion: a,
global: o,
packageManager: s,
prefix: c,
reject: l,
rejectVersion: u
});
} catch (t) {
$(e, t.message);
}
X(e, "globalPackages:", "verbose"), X(e, t, "verbose"), X(e, "", "verbose"), X(e, `Fetching ${e.target} versions`, "verbose");
let [n, r] = await Tp(t, e);
X(e, r, "verbose");
let i = J(r, (e, t) => {
let n = t.time ?? t.cooldownInfo?.currentVersionTime;
return n ? { [e]: n } : null;
}), a = J(r, (e, t) => t.cooldownInfo ? { [e]: t.cooldownInfo } : null), o = Object.values(a).length, s = Object.keys(n);
await qr(e, {
current: t,
upgraded: n,
skippedByCooldown: a,
latest: r,
numCooldown: o,
total: s.length,
time: i
});
let c = n ? s.map((e) => sp(e + "@" + n[e])).join(" ") : "[package]";
if (e.json) Ir(e, n);
else if (c.length) {
let t = e.packageManager === "yarn" ? "yarn global upgrade" : e.packageManager === "pnpm" ? "pnpm -g add" : e.packageManager === "bun" ? "bun add -g" : "npm -g install";
X(e, "\n" + Y.cyan("ncu") + " itself cannot upgrade global packages. Run the following to upgrade all global packages: \n\n" + Y.cyan(`${t} ` + c) + "\n");
}
return e.cli && e.errorLevel === 2 && s.length > 0 && process.exit(1), n;
}
//#endregion
//#region src/lib/getCurrentDependencies.ts
var Dp = (e, t) => G.default.validRange(e) && G.default.validRange(t) && G.default.gt(G.default.minVersion(e), G.default.minVersion(t)), Op = (e) => {
if (!e.packageManager) return {};
let [t, n] = e.packageManager.split("@");
return { [t]: n };
};
function kp(e = {}, t = {}) {
let n = au(t.dep).reduce((t, n) => ({
...t,
...n === "packageManager" ? Op(e) : bn(e[n] || {}, (e, n) => !Dp(n, t[e]))
}), {}), r = J(t.workspacePackages || []), i = {};
try {
i = bn(bn(n, (e) => !r[e]), ip(t.filter || null, t.reject || null, t.filterVersion || null, t.rejectVersion || null));
} catch (e) {
$(t, "Invalid filter: " + (e.message || e));
}
return i;
}
//#endregion
//#region src/lib/getEnginesNodeFromRegistry.ts
async function Ap(e, t) {
let n = ap(t, t.packageManager);
if (!n.getEngines) return {};
let r = Object.keys(e).length, i;
!t.json && t.loglevel !== "silent" && t.loglevel !== "verbose" && r > 0 && (i = new mp.default("[:bar] :current/:total :percent", {
total: r,
width: 20
}), i.render());
let a = {};
for (let [r, o] of Object.entries(e)) {
let e = (await n.getEngines(r, o, t)).node;
i && i.tick(), a[r] = e;
}
return a;
}
//#endregion
//#region src/lib/getIgnoredUpgradesDueToEnginesNode.ts
var jp = (e, t) => !e || G.default.satisfies(t, e);
async function Mp(e, t, n = {}) {
if (!n.nodeEngineVersion) return {};
let r = G.default.minVersion(n.nodeEngineVersion)?.version;
if (!r) return {};
let [i, a] = await Tp(e, {
...n,
enginesNode: !1,
nodeEngineVersion: void 0,
loglevel: "silent"
}), o = await Ap(J(a, (e, t) => i[e] && t?.version ? { [e]: t.version } : null), n), s = {};
for (let [n, a] of Object.entries(i)) t[n] === a || jp(o[n], r) || (s[n] = {
from: e[n],
to: a,
enginesNode: o[n]
});
return s;
}
//#endregion
//#region src/lib/getIgnoredUpgradesDueToPeerDeps.ts
async function Np(e, t, n, r = {}) {
let i = {
...e,
...t
}, [a, o] = await Tp(e, {
...r,
peer: !1,
peerDependencies: void 0,
loglevel: "silent"
}), s = await xp(Object.fromEntries(Object.entries(a).map(([e, t]) => [e, t && !nr(t) && G.default.validRange(t) ? G.default.minVersion(t)?.version ?? t : t])), r), c = {};
for (let [r, l] of Object.entries(a)) {
if (t[r] === l) continue;
let a = {};
for (let [e, t] of Object.entries(n)) t[r] !== void 0 && o[r]?.version && !G.default.satisfies(o[r].version, t[r]) && (a[e] = G.default.validRange(t[r]) ? t[r] : `a range that semver does not understand: ${t[r]}. This range does not work with semver.satisfies or semver.intersects, which npm-check-updates relies on to determine peer dependency compatibility. Either this is a mistake in ${e}, or it relies on a new syntax that is not compatible with the semver package.`);
if (Object.keys(a).length === 0) {
let e = s?.[r] || {};
for (let [t, n] of Object.entries(e)) i[t] && G.default.validRange(i[t]) && !(!G.default.validRange(n) || G.default.intersects(i[t], n)) && (a[r] = `${t} ${n}`);
}
c[r] = {
from: e[r],
to: l,
reason: a
};
}
return c;
}
//#endregion
//#region src/lib/isPreSelected.ts
var Pp = {
none: [],
patch: ["patch"],
minor: ["patch", "minor"]
}, Fp = (e) => {
let t = e.interactiveSelect ?? "auto";
return t === "auto" ? e.format?.includes("group") ? "minor" : "all" : t;
}, Ip = (e, t) => t === "all" || Pp[t].includes(e), Lp = (e, t, n) => n === "all" || n !== "none" && Ip(sr(e, t), n);
//#endregion
//#region src/lib/runLocal.ts
dp();
var Rp = "\n ↑/↓: Select a package\n Space: Toggle selection\n a: Toggle all\n Esc/q: Quit\n Enter: Upgrade";
function zp(e, t) {
let n = e ? Rp.split("\n").length : 0;
return process.stdout.rows ? Math.max(3, process.stdout.rows - n - 1 - (t?.length ?? 0) * 2) : 50;
}
async function Bp(e, t, n) {
let r = ap(n, n.packageManager), i = Object.keys(t), a = await lp(i, (i) => {
let a = e[i] || null, o = t[i] || null;
return r.packageAuthorChanged(i, a, o, n);
}, { concurrency: n.concurrency });
return J(i, (e, t) => ({ [e]: a[t] }));
}
var Vp = async (e, t, n, r, i, a) => {
let o = [], s = process.stdout.rows > 18, c = J((await Ur({
from: e,
to: t,
skippedByCooldown: n,
format: a.format,
pkgFile: i || void 0,
time: r
})).toString().split("\n"), (e) => ({ [e.trim().split(" ")[0]]: e.trim() }));
if (Object.keys(t).length > 0) {
X(a, "");
let n = Fp(a);
if (a.format?.includes("group")) {
let r = cr(t, e, a), i = r.flatMap(({ heading: e, groupName: t, packages: r }) => [{
title: "\n" + e,
heading: !0
}, ...Object.keys(r).sort().map((e) => ({
title: c[e],
value: e,
selected: Ip(t, n)
}))]);
o = (await (0, de.default)({
choices: [...i, {
title: " ",
heading: !0
}],
hint: s && Rp,
instructions: !1,
message: "Choose which packages to update",
name: "value",
optionsPerPage: zp(s, r),
type: "multiselect",
onState: (e) => {
e.aborted && process.nextTick(() => process.exit(1));
}
})).value;
} else {
let r = Object.keys(t).sort().map((r) => ({
title: c[r],
value: r,
selected: Lp(e[r], t[r], n)
}));
o = (await (0, de.default)({
choices: [...r, {
title: " ",
heading: !0
}],
hint: s && Rp + "\n",
instructions: !1,
message: "Choose which packages to update",
name: "value",
optionsPerPage: zp(s),
type: "multiselect",
onState: (e) => {
e.aborted && process.nextTick(() => process.exit(1));
}
})).value;
}
}
return J(o, (e) => ({ [e]: t[e] }));
};
async function Hp(e, t, n) {
X(e, "\nOptions:", "verbose"), Rr(e, e, "verbose");
let r;
try {
t ? r = Ru(t) : $(e, "Missing package data");
} catch (t) {
$(e, `Invalid package file${n ? `: ${n}` : " from stdin"}. Error details:\n${t.message}`);
}
let i = kp(r, e);
X(e, "\nCurrent versions:", "verbose"), X(e, i, "verbose"), e.enginesNode && (e.nodeEngineVersion = r.engines?.node), e.peer && (e.peerDependencies = await xp(Object.fromEntries(Object.entries(i).map(([e, t]) => [e, t && !nr(t) && G.default.validRange(t) ? G.default.minVersion(t)?.version ?? t : t])), e));
let [a, o, c] = await Tp(i, e), l = J(o, (e, t) => t.version ? { [e]: t.version } : null), u = J(o, (e, t) => t.error ? { [e]: t.error } : null), d = J(o, (e, t) => {
let n = t.time ?? t.cooldownInfo?.currentVersionTime;
return n ? { [e]: n } : null;
}), f = J(o, (e, t) => t.cooldownInfo ? { [e]: t.cooldownInfo } : null), p = Object.values(f).length;
e.peer && (X(e, "\nupgradedPeerDependencies:", "verbose"), X(e, c, "verbose")), X(e, `\n${typeof e.target == "string" ? `${e.target[0].toUpperCase()}${e.target.slice(1)}` : "Fetched"} versions:`, "verbose"), X(e, l, "verbose"), X(e, "\nUpgraded versions:", "verbose"), X(e, a, "verbose");
let m = e.minimal ? J(a, (e, t) => G.default.satisfies(l[e], i[e]) ? null : { [e]: t }) : a, h = (e.format || []).includes("ownerChanged") ? await Bp(i, m, e) : void 0, g = e.interactive ? await Vp(i, m, f, d, n, e) : m;
if (!e.json || e.deep) {
if (await qr(e.interactive ? {
...e,
format: (e.format || []).filter((e) => e !== "group")
} : e, {
current: i,
upgraded: g,
skippedByCooldown: f,
total: Object.keys(a).length,
latest: o,
numCooldown: p,
ownersChangedDeps: h,
pkgFile: n || void 0,
errors: u,
time: d
}), e.peer) {
let t = await Np(i, a, c, e);
Object.keys(t).length > 0 && Jr(e, t);
}
if (e.enginesNode) {
let t = await Mp(i, a, e);
Object.keys(t).length > 0 && Yr(e, t);
}
}
let _ = await Wu(t, i, g, e, n || void 0, l), v = e.jsonAll ? n?.endsWith(".yaml") || n?.endsWith(".yml") ? (0, vc.parseDocument)(_).toJSON() : Ru(_) : e.jsonDeps && n?.endsWith(".json") ? nu(Ru(_), au(e.dep)) : g, y;
if (e.json && !e.deep && Ir(e, v), Object.keys(m).length > 0 && n) {
if (e.upgrade) y = s.writeFile(n.replace("#catalog", ""), _);
else {
let t = process.env.npm_lifecycle_event === "npx" ? "npx npm-check-updates" : "ncu", n = process.argv.slice(2).map((e) => e.includes(" ") ? `"${e}"` : e).join(" "), r = n && " " + n;
X(e, `\nRun ${Y.cyan(`${t}${r} -u`)} to upgrade ${e.packageFile || "package.json"}`);
}
}
return await y, v;
}
//#endregion
//#region src/index.ts
var Up = !1, Wp = null, Gp = !1;
function Kp() {
Gp || (Gp = !0, process.env.INJECT_PROMPTS && de.default.inject(JSON.parse(process.env.INJECT_PROMPTS)), process.on("unhandledRejection", (e) => {
console.error(e), Up = !0;
}), process.on("exit", () => {
Up && Wp && $(Wp, `Unhandled Rejection! This is a bug and should be reported: ${fe.bugs.url}`);
}));
}
var qp = (e) => {
e.global && (process.env.VOLTA_HOME || process.env.PATH?.includes("\\Volta")) && (X(e, "It appears you are using Volta. `npm-check-updates --global` cannot be used with Volta because Volta has its own system for managing global packages which circumvents npm.\n\nIf you are still receiving this message after uninstalling Volta, ensure your PATH does not contain an entry for Volta and your shell profile does not define VOLTA_HOME. You may need to reboot for changes to your shell profile to take effect.", "error"), process.exit(1));
}, Jp = async (e, t) => {
let n = {
...e,
cwd: e.cwd || o.resolve(t, ".."),
packageFile: t
};
return e.packageManager === "staticRegistry" ? await Bi({
...n,
packageManager: void 0
}) : e.packageManager && e.packageManager !== "npm" ? e.packageManager : await Bi(n);
}, Yp = (e, t, n) => {
let r = !n.deep && !n.workspaces && !n.workspace ? { [e[0]]: t } : t;
return Object.values(r).some((e) => Object.keys(e).length > 0);
}, Xp = async (e, t, n) => {
if (n.install === "never") {
X(n, "");
return;
}
if (!Yp(e, t, n)) return;
let r = await Jp(n, e[0]), i = `Run ${Y.cyan(r + " install")}${e.length > 1 && !n.workspace && !n.workspaces ? " in each project directory" : ""} to install new versions`, a = n.interactive && (process.env.NCU_TESTS || !process.env.NCU_DOCTOR), s;
if (a && n.install === "prompt" && (X(n, ""), s = await (0, de.default)({
type: "confirm",
name: "value",
message: `${i}?`,
initial: !0,
onState: (e) => {
e.aborted && process.nextTick(() => process.exit(1));
}
})), n.install === "always" || a && s.value) {
n.install === "always" && X(n, ""), X(n, "Installing dependencies...");
let t = n.workspaces || n.workspace?.length ? ["package.json"] : e;
for (let e of t) {
let t = await Jp(n, e), r = n.cwd || o.resolve(e, ".."), i = "";
try {
await na(t, ["install"], {
stdout: (e) => {
i += e;
},
stderr: (e) => {
console.error(Y.red(e.toString()));
}
}, {
cwd: r,
env: {
...process.env,
...n.color === !1 ? null : { FORCE_COLOR: !0 },
...t === "pnpm" ? { npm_config_strict_peer_dependencies: !1 } : null
}
}), X(n, i), X(n, "Done");
} catch (e) {
console.error(e?.message || e || i), $(n, "Install failed. This is not a bug in npm-check-updates. The most common causes are invalid peer dependencies, networking issues, or failing postinstall scripts. Consider using --peer to filter updates to compatible versions (takes longer) or --doctor to identify breaking upgrades.");
}
}
} else a || X(n, `\n${i}.`);
};
async function Zp(e, t) {
let [n, r] = await Sf(e), i = n.map((e) => e.filepath), a = e.workspaces || !!e.workspace?.length;
e.deep = e.deep || a || n.length > 1;
let s;
if (e.global) {
let n = await Ep(e);
return clearTimeout(t), n;
}
if (e.deep) {
let t = {};
for (let [i, a] of n.entries()) {
let n = i > 0, s = (await Ef({
packageFile: a.filepath,
options: e
})).config;
e.mergeConfig && Object.keys(s).length && (s = tp(e, s));
let c = {
...e,
...s
};
for (let t of e.cliKeys || []) t in e && (e.mergeConfig && Array.isArray(c[t]) && Array.isArray(e[t]) || (c[t] = e[t]));
c.packageFile = a.filepath, c.workspacePackages = r;
let l, u, d;
if (a.filepath.includes("#") || a.name === "catalogs") {
l = a.pkgFile, u = a.filepath, d = a.filepath.includes("#catalog") ? a.filepath.replace("#catalog", "") : a.filepath;
let e = o.resolve(d);
n && X(c, ""), X(c, `${c.upgrade ? "Upgrading" : "Checking"} ${e} catalog dependencies`);
} else {
n && X(c, "");
let e = await Yu(c);
l = e.pkgData, u = e.pkgFile || a.filepath, d = u;
}
let f = c.cwd ? o.relative(o.resolve(c.cwd), d).replace(/\\/g, "/") : d;
t[f] = await Hp(c, l, u);
}
s = t, e.json && Ir(e, s);
} else {
n.length === 1 && n[0].filepath !== (e.packageFile || "package.json") && (e.packageFile = n[0].filepath);
let { pkgData: t, pkgFile: r } = await Yu(e);
i.length === 0 && r && (i = [r]), s = await Hp(e, t, r);
}
return clearTimeout(t), e.errorLevel === 2 && Yp(i, s, e) && $(e, "\nDependencies not up-to-date"), e.upgrade && (e.packageManager === "deno" ? X(e, "") : await Xp(i, s, e)), s;
}
async function Qp(e = {}, { cli: t } = {}) {
t && Kp(), Up = !1;
let n = await $f(e, { cli: t });
Wp = n, vn(n.color), qp(n), X(n, "Initializing", "verbose"), n.cacheClear && await ti(n);
let r, i = new Promise(() => null);
if (n.timeout) {
let e = typeof n.timeout == "string" ? Number.parseInt(n.timeout, 10) : n.timeout;
i = new Promise((t, i) => {
r = setTimeout(() => {
let t = `Exceeded global timeout of ${e}ms`;
i(t);
try {
$(n, t);
} catch {}
}, e);
});
}
if (n.doctor) {
if (n.upgrade) return Promise.race([i, Ju(Qp, n)]);
X(n, `Usage: ncu --doctor\n\n${typeof Mi.doctor.help == "function" ? Mi.doctor.help({}) : Mi.doctor.help}`, "warn");
} else return Promise.race([i, Zp(n, r)]);
}
var $p = Qp;
$p.run = $p, $p.defineConfig = Pi;
//#endregion
export { fe as _, Mi as a, ri as c, vn as d, $p as default, $p as run, Pi as defineConfig, _n as f, _e as g, Ke as h, ru as i, Mn as l, rt as m, cp as n, Ni as o, Dt as p, Ef as r, mi as s, dp as t, On as u };
//# sourceMappingURL=index.js.map