npm-check-updates
Version:
Find newer versions of dependencies than what your package.json allows
19,697 lines • 691 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, styleText as p } from "node:util";
import { URL as m, fileURLToPath as h } from "node:url";
import g, { execFile as _ } from "node:child_process";
import v, { promises as y } from "node:fs";
import b from "node:process";
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);
}
};
})), N = /* @__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));
}
};
})), P = /* @__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);
}
};
})), F = /* @__PURE__ */ i(((e, t) => {
var n = P();
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;
}
};
})), I = /* @__PURE__ */ i(((e, t) => {
var n = P(), 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;
}
};
})), re = /* @__PURE__ */ i(((e, t) => {
var n = P();
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;
}
};
})), L = /* @__PURE__ */ i(((e, t) => {
var n = P();
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);
}
};
})), R = /* @__PURE__ */ i(((e, t) => {
var n = P();
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;
}
};
})), z = /* @__PURE__ */ i(((e, t) => {
var n = P();
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);
}
};
})), B = /* @__PURE__ */ i(((e, t) => {
var n = P();
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;
}
};
})), V = /* @__PURE__ */ i(((e, t) => {
var n = P();
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;
}
};
})), H = /* @__PURE__ */ i(((e, t) => {
t.exports = {
DatePart: P(),
Meridiem: F(),
Day: I(),
Hours: re(),
Milliseconds: L(),
Minutes: R(),
Month: z(),
Seconds: B(),
Year: V()
};
})), U = /* @__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: _ } = H(), 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));
}
};
})), ie = /* @__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));
}
};
})), ae = /* @__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);
}
};
})), oe = /* @__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);
}
};
})), se = /* @__PURE__ */ i(((e, t) => {
var n = S(), { cursor: r } = T(), i = ae(), { 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);
}
};
})), W = /* @__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);
}
};
})), G = /* @__PURE__ */ i(((e, t) => {
t.exports = {
TextPrompt: te(),
SelectPrompt: ne(),
TogglePrompt: N(),
DatePrompt: U(),
NumberPrompt: ie(),
MultiselectPrompt: ae(),
AutocompletePrompt: oe(),
AutocompleteMultiselectPrompt: se(),
ConfirmPrompt: W()
};
})), ce = /* @__PURE__ */ i(((e) => {
var t = e, n = G(), 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));
})), le = /* @__PURE__ */ i(((e, t) => {
var n = ce(), 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
});
})), ue = /* @__PURE__ */ i(((e, t) => {
t.exports = le();
})), de = /* @__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);
}
})), fe = /* @__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;
}
})), pe = /* @__PURE__ */ i(((t, n) => {
e("fs");
var r = process.platform === "win32" || global.TESTING_WINDOWS ? de() : fe();
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;
}
}
})), me = /* @__PURE__ */ i(((t, n) => {
var r = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys", i = e("path"), a = r ? ";" : ":", o = pe(), 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);
};
})), he = /* @__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;
})), ge = /* @__PURE__ */ i(((t, n) => {
var r = e("path"), i = me(), a = he();
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;
})), _e = /* @__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;
})), ve = /* @__PURE__ */ i(((e, t) => {
t.exports = /^#!(.*)/;
})), ye = /* @__PURE__ */ i(((e, t) => {
var n = ve();
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;
};
})), be = /* @__PURE__ */ i(((t, n) => {
var r = e("fs"), i = ye();
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;
})), xe = /* @__PURE__ */ i(((t, n) => {
var r = e("path"), i = ge(), a = _e(), o = be(), 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;
})), Se = /* @__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
};
})), Ce = /* @__PURE__ */ i(((t, n) => {
var r = e("child_process"), i = xe(), a = Se();
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;
})), we = /* @__PURE__ */ i(((e, t) => {
var n = Ce();
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
});
});
});
};
})), Te = /* @__PURE__ */ n(ue(), 1), Ee = /* @__PURE__ */ n(we(), 1), De = {
name: "npm-check-updates",
version: "23.1.1",
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:changelog": "node scripts/build-changelog.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: "npm run lint:types && 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.1",
"@eslint/js": "^10.0.1",
"@microsoft/api-extractor": "^7.59.4",
"@streamparser/json": "^0.0.26",
"@trivago/prettier-plugin-sort-imports": "^6.0.2",
"@types/bun": "^1.4.2",
"@types/hosted-git-info": "^3.0.5",
"@types/ini": "^4.1.1",
"@types/node": "^26.6.5",
"@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.71.1",
"@typescript-eslint/parser": "^8.71.1",
camelcase: "^9.0.0",
"cli-table3": "^0.6.5",
commander: "^15.0.0",
"cross-env": "^10.1.0",
eslint: "^10.12.0",
"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": "^65.2.4",
"eslint-plugin-n": "^18.4.1",
"eslint-plugin-promise": "^7.3.0",
"fast-glob": "^3.3.3",
"fast-memoize": "^2.5.2",
"find-up": "^8.0.0",
globals: "^17.13.0",
"hosted-git-info": "^10.1.1",
ini: "^7.0.0",
"jsonc-parser": "^3.3.1",
lilconfig: "^3.1.3",
"lockfile-lint": "^5.1.0",
"markdown-it": "^15.0.2",
"markdownlint-cli2": "^0.23.3",
"npm-registry-fetch": "^20.0.1",
"npm-run-all2": "^9.0.3",
"p-map": "^7.1.0",
"parse-github-url": "^1.0.4",
picomatch: "^4.0.7",
prettier: "^3.9.10",
progress: "^2.0.3",
"prompts-ncu": "^3.0.4",
semver: "^7.8.5",
"semver-utils": "^1.1.4",
"spawn-please": "^4.0.0",
"ts-json-schema-generator": "^2.9.0",
typescript: "^6.0.3",
"unplugin-dts": "^1.1.2",
untildify: "^6.0.0",
"update-notifier": "^7.3.1",
valibot: "^1.5.0",
verdaccio: "^6.10.5",
vite: "^8.3.4",
"vite-bundle-analyzer": "^1.3.9",
vitest: "^5.0.3",
yaml: "^2.9.1",
yarn: "^1.22.22"
},
files: ["build"],
allowScripts: {
"yarn@1.22.22": !0,
"unrs-resolver@1.12.2": !0,
"fsevents@2.3.3": !0
}
}, Oe = /* @__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), ke = /* @__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;
})), Ae = /* @__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");
};
})), je = /* @__PURE__ */ i(((e, t) => {
var n = Ae();
t.exports = (e) => typeof e == "string" ? e.replace(n(), "") : e;
})), Me = /* @__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;
})), Ne = /* @__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;
};
})), Pe = /* @__PURE__ */ i(((e, t) => {
var n = je(), r = Me(), i = Ne(), 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;
})), Fe = /* @__PURE__ */ i(((e, t) => {
var n = Pe();
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
};
})), Ie = /* @__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";
});
})), Le = /* @__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);
};
})), Re = /* @__PURE__ */ i(((t, n) => {
var r = e("os"), i = Le(), 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)
};
})), ze = /* @__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;
};
})), Be = /* @__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);
};
})), Ve = /* @__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);
}
};
};
})), He = /* @__PURE__ */ i(((e, t) => {
t.exports = function(e) {
return function(t, n, r) {
return n % 2 == 0 ? t : e.inverse(t);
};
};
})), Ue = /* @__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);
};
};
})), We = /* @__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);
};
};
})), Ge = /* @__PURE__ */ i(((t, n) => {
var r = {};
n.exports = r, r.themes = {};
var i = e("util"), a = r.styles = Ie(), o = Object.defineProperties, s = /* @__PURE__ */ new RegExp(/[\r\n]+/g);
r.supportsColor = Re().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 = ze(), r.zalgo = Be(), r.maps = {}, r.maps.america = Ve()(r), r.maps.zebra = He()(r), r.maps.rainbow = Ue()(r), r.maps.random = We()(r), r.maps) (function(e) {
r[e] = function(t) {
return h(r.maps[e], t);
};
})(g);
o(r, m());
})), Ke = /* @__PURE__ */ i(((e, t) => {
t.exports = Ge();
})), qe = /* @__PURE__ */ i(((e, t) => {
var { info: n, debug: r } = ke(), i = Fe(), 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 = Ke();
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;
})), Je = /* @__PURE__ */ i(((e, t) => {
var { warn: n, debug: r } = ke(), i = qe(), { 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);
};
}
})), Ye = /* @__PURE__ */ i(((e, t) => {
var n = ke(), r = Fe(), i = Je(), 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;
})), Xe = /* @__PURE__ */ i(((e, t) => {
t.exports = Ye();
})), Ze = /* @__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");
};
})), Qe = /* @__PURE__ */ i(((e, t) => {
t.exports = Ze();
})), $e = /* @__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
};
})), et = /* @__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) : () => {};
})), tt = /* @__PURE__ */ i(((e, t) => {
var { MAX_SAFE_COMPONENT_LENGTH: n, MAX_SAFE_BUILD_LENGTH: r, MAX_LENGTH: i } = $e(), a = et();
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*$");
})), nt = /* @__PURE__ */ i(((e, t) => {
var n = Object.freeze({ loose: !0 }), r = Object.freeze({});
t.exports = (e) => e ? typeof e == "object" ? e : n : r;
})), rt = /* @__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)
};
})), it = /* @__PURE__ */ i(((e, t) => {
var n = et(), { MAX_LENGTH: r, MAX_SAFE_INTEGER: i } = $e(), { safeRe: a, t: o } = tt(), s = nt(), { compareIdentifiers: c } = rt(), 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;
}
};
})), at = /* @__PURE__ */ i(((e, t) => {
var n = it();
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;
}
};
})), ot = /* @__PURE__ */ i(((e, t) => {
var n = at();
t.exports = (e, t) => {
let r = n(e, t);
return r ? r.version : null;
};
})), st = /* @__PURE__ */ i(((e, t) => {
var n = at();
t.exports = (e, t) => {
let r = n(e.trim().replace(/^[=v]+/, ""), t);
return r ? r.version : null;
};
})), ct = /* @__PURE__ */ i(((e, t) => {
var n = it();
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;
}
};
})), lt = /* @__PURE__ */ i(((e, t) => {
var n = at();
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";
};
})), ut = /* @__PURE__ */ i(((e, t) => {
var n = it();
t.exports = (e, t) => new n(e, t).major;
})), dt = /* @__PURE__ */ i(((e, t) => {
var n = it();
t.exports = (e, t) => new n(e, t).minor;
})), ft = /* @__PURE__ */ i(((e, t) => {
var n = it();
t.exports = (e, t) => new n(e, t).patch;
})), pt = /* @__PURE__ */ i(((e, t) => {
var n = at();
t.exports = (e, t) => {
let r = n(e, t);
return r && r.prerelease.length ? r.prerelease : null;
};
})), mt = /* @__PURE__ */ i(((e, t) => {
var n = it();
t.exports = (e, t, r) => new n(e, r).compare(new n(t, r));
})), ht = /* @__PURE__ */ i(((e, t) => {
var n = mt();
t.exports = (e, t, r) => n(t, e, r);
})), gt = /* @__PURE__ */ i(((e, t) => {
var n = mt();
t.exports = (e, t) => n(e, t, !0);
})), _t = /* @__PURE__ */ i(((e, t) => {
var n = it();
t.exports = (e, t, r) => {
let i = new n(e, r), a = new n(t, r);
return i.compare(a) || i.compareBuild(a);
};
})), vt = /* @__PURE__ */ i(((e, t) => {
var n = _t();
t.exports = (e, t) => e.sort((e, r) => n(e, r, t));
})), yt = /* @__PURE__ */ i(((e, t) => {
var n = _t();
t.exports = (e, t) => e.sort((e, r) => n(r, e, t));
})), bt = /* @__PURE__ */ i(((e, t) => {
var n = mt();
t.exports = (e, t, r) => n(e, t, r) > 0;
})), xt = /* @__PURE__ */ i(((e, t) => {
var n = mt();
t.exports = (e, t, r) => n(e, t, r) < 0;
})), St = /* @__PURE__ */ i(((e, t) => {
var n = mt();
t.exports = (e, t, r) => n(e, t, r) === 0;
})), Ct = /* @__PURE__ */ i(((e, t) => {
var n = mt();
t.exports = (e, t, r) => n(e, t, r) !== 0;
})), wt = /* @__PURE__ */ i(((e, t) => {
var n = mt();
t.exports = (e, t, r) => n(e, t, r) >= 0;
})), Tt = /* @__PURE__ */ i(((e, t) => {
var n = mt();
t.exports = (e, t, r) => n(e, t, r) <= 0;
})), Et = /* @__PURE__ */ i(((e, t) => {
var n = St(), r = Ct(), i = bt(), a = wt(), o = xt(), s = Tt();
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}`);
}
};
})), Dt = /* @__PURE__ */ i(((e, t) => {
var n = it(), r = at(), { safeRe: i, t: a } = tt();
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);
};
})), Ot = /* @__PURE__ */ i(((e, t) => {
var n = at(), r = $e(), i = it(), 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;
})), kt = /* @__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;
}
};
})), At = /* @__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 (kt())(), i = nt(), a = jt(), o = et(), s = it(), { safeRe: c, src: l, t: u, comparatorTrimReplace: d, tildeTrimReplace: f, caretTrimReplace: p } = tt(), { FLAG_INCLUDE_PRERELEASE: m, FLAG_LOOSE: h } = $e(), 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;
};
})), jt = /* @__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 = nt(), { safeRe: i, t: a } = tt(), o = Et(), s = et(), c = it(), l = At();
})), Mt = /* @__PURE__ */ i(((e, t) => {
var n = At();
t.exports = (e, t, r) => {
try {
t = new n(t, r);
} catch {
return !1;
}
return t.test(e);
};
})), Nt = /* @__PURE__ */ i(((e, t) => {
var n = At();
t.exports = (e, t) => new n(e, t).set.map((e) => e.map((e) => e.value).join(" ").trim().split(" "));
})), Pt = /* @__PURE__ */ i(((e, t) => {
var n = it(), r = At();
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;
};
})), Ft = /* @__PURE__ */ i(((e, t) => {
var n = it(), r = At();
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;
};
})), It = /* @__PURE__ */ i(((e, t) => {
var n = it(), r = At(), i = bt();
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;
};
})), Lt = /* @__PURE__ */ i(((e, t) => {
var n = At();
t.exports = (e, t) => {
try {
return new n(e, t).range || "*";
} catch {
return null;
}
};
})), Rt = /* @__PURE__ */ i(((e, t) => {
var n = it(), r = jt(), { ANY: i } = r, a = At(), o = Mt(), s = bt(), c = xt(), l = Tt(), u = wt();
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;
};
})), zt = /* @__PURE__ */ i(((e, t) => {
var n = Rt();
t.exports = (e, t, r) => n(e, t, ">", r);
})), Bt = /* @__PURE__ */ i(((e, t) => {
var n = Rt();
t.exports = (e, t, r) => n(e, t, "<", r);
})), Vt = /* @__PURE__ */ i(((e, t) => {
var n = At();
t.exports = (e, t, r) => (e = new n(e, r), t = new n(t, r), e.intersects(t, r));
})), Ht = /* @__PURE__ */ i(((e, t) => {
var n = Mt(), r = mt();
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;
};
})), Ut = /* @__PURE__ */ i(((e, t) => {
var n = At(), r = jt(), { ANY: i } = r, a = Mt(), o = mt(), 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;
})), Wt = /* @__PURE__ */ i(((e, t) => {
var n = tt(), r = $e(), i = it(), a = rt();
t.exports = {
parse: at(),
valid: ot(),
clean: st(),
inc: ct(),
diff: lt(),
major: ut(),
minor: dt(),
patch: ft(),
prerelease: pt(),
compare: mt(),
rcompare: ht(),
compareLoose: gt(),
compareBuild: _t(),
sort: vt(),
rsort: yt(),
gt: bt(),
lt: xt(),
eq: St(),
neq: Ct(),
gte: wt(),
lte: Tt(),
cmp: Et(),
coerce: Dt(),
truncate: Ot(),
Comparator: jt(),
Range: At(),
satisfies: Mt(),
toComparators: Nt(),
maxSatisfying: Pt(),
minSatisfying: Ft(),
minVersion: It(),
validRange: Lt(),
outside: Rt(),
gtr: zt(),
ltr: Bt(),
intersects: Vt(),
simplifyRange: Ht(),
subset: Ut(),
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
};
})), Gt = /* @__PURE__ */ n(Xe(), 1), Kt = /* @__PURE__ */ n(Qe(), 1), K = /* @__PURE__ */ n(Wt(), 1);
function q(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/filterObject.ts
var qt = (e, t) => q(e, (e, n) => t(e, n) ? { [e]: n } : null), Jt = [
{
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"
}
], Yt, Xt = () => Yt ??= new Intl.RelativeTimeFormat("en", { numeric: "always" });
function Zt(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 Jt) {
if (Math.abs(n) < e.amount) {
r = e.unit;
break;
}
n /= e.amount;
}
return Xt().format(Math.trunc(n), r);
}
//#endregion
//#region src/lib/exists.ts
var Qt = async (e) => {
try {
return await s.stat(e), !0;
} catch {
return !1;
}
}, $t = a(import.meta.url);
async function en(e, { pkgFile: t } = {}) {
let n = $t.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 Qt(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 tn = /* @__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);
}
}
};
})), nn = /* @__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;
})), rn = /* @__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));
};
})), an = /* @__PURE__ */ i(((e, t) => {
var n = rn(), 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
];
};
})), on = /* @__PURE__ */ i(((e, t) => {
var { LRUCache: n } = tn(), r = nn(), i = an(), a = rn(), 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;
})), sn = /* @__PURE__ */ n(on(), 1);
async function cn(e, { pkgFile: t } = {}) {
return (await en(e, { pkgFile: t }))?.repository ?? null;
}
async function ln(e, t, { pkgFile: n } = {}) {
let r = t ? t.repository ? t.repository : null : await cn(e, { pkgFile: n });
if (!r) return null;
let i, a = "";
if (typeof r == "string") {
i = r;
try {
let e = new m(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 = sn.default.fromUrl(i)?.browse(a);
return e === void 0 ? i : e.replace(/\/$/, "").replace(/\/tree\/HEAD$/, "");
}
return null;
}
//#endregion
//#region src/lib/isPackageManagerProtocol.ts
function un(e) {
return e.startsWith("file:") || e.startsWith("link:") || e.startsWith("workspace:") || e.startsWith("catalog:") || e.startsWith("portal:");
}
//#endregion
//#region src/lib/isFetchable.ts
function dn(e) {
return !un(e) && !/^[^/:@]+\/\w+/.test(e);
}
//#endregion
//#region src/lib/parseCooldown.ts
var fn = /^(\d+(?:\.\d+)?)(d|h|m)$/;
function pn(e) {
let t = e.match(fn);
if (!t) return null;
let n = parseFloat(t[1]), r = t[2];
return r === "d" ? n : r === "h" ? n / 24 : n / 1440;
}
//#endregion
//#region src/lib/style.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 = (e) => q(mn, (t) => {
let n = t;
return { [t]: Object.assign((t) => e([n], t), {
bold: (t) => e([n, "bold"], t),
underline: (t) => e([n, "underline"], t)
}) };
}), gn = (e, t) => p(e, t, { validateStream: !1 }), _n = hn((e, t) => {
let n = String(t);
return n === "" ? n : n.includes("\n") ? n.split(/(\r?\n)/).map((t) => t === "" || t === "\n" || t === "\r\n" ? t : gn(e, t)).join("") : gn(e, n);
}), vn = hn((e, t) => String(t)), yn, bn = () => p("red", "x") !== "x", xn = (e) => e === void 0 ? bn() ? _n : vn : e ? _n : vn, Sn = (e) => {
yn = xn(e);
}, Cn = () => {
if (!yn) throw Error("Style has not been initialized yet.");
}, J = q(mn, (e) => {
let t = (t) => (Cn(), yn[e](t));
return t.bold = (t) => (Cn(), yn[e].bold(t)), t.underline = (t) => (Cn(), yn[e].underline(t)), { [e]: t };
}), wn = /* @__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;
})), Tn = /* @__PURE__ */ n((/* @__PURE__ */ i(((e, t) => {
var n = wn(), 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 En(e) {
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
//#endregion
//#region src/lib/sortBy.ts
function Dn(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 On = [
"major",
"minor",
"patch"
], kn = ["release", "build"], An = [...On, ...kn], jn = {
major: "",
minor: ".",
patch: ".",
release: "-",
build: "+"
}, Mn = [
"^",
"~",
".*",
".x"
], Nn = RegExp(`^(${[
"^",
"~",
"^*",
"*",
"x",
"x.x",
"x.x.x"
].map(En).join("|")})$`), Pn = /^npm:(.*)@(.*)/;
function Fn(e) {
let [t] = Oe.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 An.reduce((e, n) => t[n] ? e + 1 : e, 0);
}
function In(e, t) {
return (t ? An.slice(0, An.indexOf(t) + 1) : An).filter((n) => t && On.includes(t) || e[n]).map((t) => jn[t] + (e[t] || "0")).join("");
}
function Ln(e) {
let [t] = Oe.default.parseRange(e);
return An.slice().reverse().find((e) => t?.[e]);
}
function Rn(e, t) {
let [n] = Oe.default.parseRange(e);
return In(n, t);
}
function zn(e, t) {
return t === "^" || t === "~" ? t + e : Rn(e, "major") + t;
}
function Bn(e) {
return Nn.test(e);
}
function Vn(e) {
return e === "*" || e === "x";
}
var Hn = (e) => e.replace(/^[~^<>=]+/, ""), Un = 20, Wn = (e) => {
let t = e.match(/\+(\S+)$/)?.[1];
return !t || t.length <= Un ? e : e.slice(0, e.length - t.length) + t.slice(0, Un) + "...";
};
function Gn(e, t) {
let n = Hn(e).split("."), r = Hn(t).split("."), i = r.findIndex((e, t) => e !== n[t]);
return {
index: i >= 0 ? i : r.length,
parts: r
};
}
function Kn(e, t) {
if (e === t) return "none";
let { index: n, parts: r } = Gn(e, t);
return r[0] === "0" ? "majorVersionZero" : n === 0 ? "major" : n === 1 ? "minor" : "patch";
}
function qn(e, t, n) {
let r = q(e, (r, i, a) => {
let o = t[r], s = Kn(o, i), c = n.groupFunction?.(r, s, (0, Oe.parseRange)(o), (0, Oe.parseRange)(i), (0, Oe.parse)(e[r])) ?? s;
return c === "none" ? a : {
...a,
[c]: {
...a[c],
[r]: i
}
};
}), i = {
patch: J.green(J.bold("Patch") + " Backwards-compatible bug fixes"),
minor: J.cyan(J.bold("Minor") + " Backwards-compatible features"),
major: J.red(J.bold("Major") + " Potentially breaking API changes"),
majorVersionZero: J.magenta(J.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 Jn(e, t) {
let n = "";
/^[~^]/.test(t) && (n = t[0], t = t.slice(1));
let r = t.split("."), { index: i, parts: a } = Gn(e, t), o = i === 0 || a[0] === "0" ? "red" : i === 1 ? "cyan" : "green", s = i > 0 && i < r.length ? "." : "";
return n + r.slice(0, i).join(".") + s + J[o](r.slice(i).join("."));
}
var Yn = (e) => {
let t = K.default.prerelease(e);
return t && t.slice(0, -1).join(".");
};
function Xn(e, t) {
let n = Yn(e), r = Yn(t);
return typeof n != "string" || typeof r != "string" || n === r;
}
function Zn(e, t) {
return (K.default.valid(e) && K.default.valid(t) ? K.default.gt(e, t) : e > t) ? 1 : e === t ? 0 : -1;
}
function Qn(e, t, n) {
let r = K.default.parse(e);
return r && (n === "major" || r.major === t?.major) && (n === "major" || n === "minor" || r.minor === t?.minor);
}
function $n(e, t, n) {
if (!K.default.validRange(t)) return null;
let r = K.default.minVersion(t);
return [...e].sort(Zn).filter((e) => Qn(e, r, n)).at(-1) || null;
}
function er(e, t) {
if (!K.default.validRange(e)) return () => !1;
let n = K.default.minVersion(e);
return (e) => Qn(e, n, t);
}
function tr(e) {
return (t) => K.default.satisfies(t, e);
}
function nr(e) {
return Ln(e) === "release";
}
var rr = (e) => /^[vV]?\d+$/.test(e), ir = (e) => /^[vV]?\d+\.\d+$/.test(e), ar = (e) => e.replace(/^[vV]/, ""), or = (e) => rr(e) ? e + ".0.0" : e, sr = (e) => ir(e) ? e + ".0" : e, cr = (e) => sr(or(ar(e)));
function lr(e) {
return e && (e[0] === "v" || e[1] === "v") ? "v" : "";
}
var ur = (e, t) => `npm:${e}@${t}`, dr = (e) => {
let t = e && e.match && e.match(Pn);
return t && t.slice(1);
}, fr = (e) => e && !!e.match(Pn), pr = (e, t) => {
let n = dr(e);
return n ? ur(n[0], t) : null;
}, mr = (e) => {
if (!e) return !1;
let t = null;
try {
t = (0, Tn.default)(e);
} catch {}
if (!t || !t.branch) return !1;
let n = decodeURIComponent(t.branch).replace(/^semver:/, "");
return !!K.default.validRange(n);
}, hr = (e) => {
if (!e) return null;
let t = (0, Tn.default)(e);
if (!t || !t.branch) return null;
let n = decodeURIComponent(t.branch).replace(/^semver:/, "");
return t && t.branch && K.default.validRange(n) ? n : null;
};
function gr(e, t, n = {}) {
if (n.wildcard = n.wildcard || "^", !t) return e;
let [r] = Oe.default.parseRange(t);
if (!r) return e;
if (n.removeRange) return t;
if (Bn(e)) return e;
let i = Dn(Oe.default.parseRange(e).filter((e) => e.operator !== "||" && e.operator !== "-"), (e) => Fn(In(e))), [a] = i, o = i.find((e) => e.operator === "<" || e.operator === "<="), s = i.find((e) => e.operator === "^" || e.operator === "~");
if (o && s && K.default.valid(t) && K.default.satisfies(t, e)) return `${gr(s.semver, t, n)} ${o.semver}`;
function c(e) {
return (Vn(a[e]) ? a[e] : On.includes(e) && a[e] || kn.includes(e) ? r[e] : null) || null;
}
let l = In(q(An, (e) => ({ [e]: c(e) }))), u = lr(a.semver) + l, d = Array.from(new Set(i.map((e) => e.operator))), f = d[0] || "", p = Mn.some((e) => l.includes(e)), m = d[0] === "<" || d[0] === "<=", h = d[0] === ">", g = d.length > 1;
return !p && (m || g) ? zn(u, n.wildcard) : (h ? ">=" : f) + u;
}
var _r = (e, t) => {
let n = lr(e), r = n ? n + t : t;
return r = rr(e) ? r.slice(0, r.length - 4) : r, r = ir(e) ? r.slice(0, r.length - 2) : r, r;
}, vr = (e, t) => {
let n = cr(t), r = (0, Tn.default)(e);
if (!r) return e;
let i = decodeURIComponent(r.branch).replace(/^semver:/, ""), a = gr(i, _r(i, n)), o = e.indexOf("#");
return o === -1 ? e.replace(i, a) : e.slice(0, o) + e.slice(o).replace(i, a);
}, yr = (e) => e[0] === "^" || e[0] === "~" ? e[0] : "", br = {
silent: 0,
error: 1,
minimal: 2,
warn: 3,
info: 4,
verbose: 5,
silly: 6
};
function Y(e, t, n = null, r = "log") {
!e.json && e.loglevel !== "silent" && (n == null || br[e.loglevel ?? "warn"] >= br[n]) && console[r](t);
}
function xr(e) {
return f(e).replace(/[\u0000-\u001f\u007f-\u009f]/g, "");
}
function Sr(e) {
return xr(e instanceof Error ? e.stack ?? e.message : String(e));
}
function Cr(e, t) {
e.loglevel !== "silent" && console.log(JSON.stringify(t, null, 2));
}
function wr(e, t) {
console.log(Object.keys(e).map((t) => t + "@" + e[t]).join(t));
}
function Tr(e, t, n) {
Y(e, Object.keys(t).sort().reduce((e, n) => (e[n] = t[n], e), {}), n);
}
function Er(e, t) {
if (e.json || e.loglevel === "silent" || e.loglevel === "verbose" || t <= 0) return;
let n = new Kt.default("[:bar] :current/:total :percent", {
total: t,
width: 20
});
return n.render(), n;
}
function Dr(e) {
let t = new Gt.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 Or(e) {
return mr(e) ? hr(e) : fr(e) ? dr(e)[1] : e;
}
function kr(e) {
if (e === void 0 || typeof e == "function") return "cooldown";
let t = String(e).trim().toLowerCase(), n = t.match(fn), 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 Ar({ 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 Dr(await Promise.all(Object.keys(t).sort().map(async (s) => {
let u = r?.includes("installedVersion") || r?.includes("homepage") || r?.includes("repo") ? await en(s, { pkgFile: a }) : null, d = r?.includes("installedVersion") ? u?.version : void 0, f = (d && d.trim() === d && K.default.valid(d) ? d : e[s]) || "", p = s in (c?.devDependencies ?? {}) ? "dev" : s in (c?.peerDependencies ?? {}) ? "peer" : s in (c?.optionalDependencies ?? {}) ? "optional" : "", m = Or(t[s] || ""), h = i ? s in i ? i[s] ? "*owner changed*" : "" : "*unknown*" : "", g = Jn(Or(f), Wn(m)), _ = r?.includes("homepage") ? xr(u?.homepage || "") : "", v = r?.includes("repo") ? xr(await ln(s, u ?? void 0, { pkgFile: a }) || "") : "", y = r?.includes("diff") ? `${process.env.NCU_DIFF || "https://npmdiff.dev"}/${encodeURIComponent(s)}/${f.replace(/^\W+/, "")}/${m.replace(/^\W+/, "")}` : "", b = r?.includes("cooldown"), x = r?.includes("time"), S = (x || b) && !o?.[s] ? "[missing time]" : "", C = x && o?.[s] ? o[s] : null, w = C ? Zt(C) : x || !l ? S : "", T = n?.[s]?.version, E = "";
if (T) {
let e = yr(m), t = K.default.coerce(T);
E = `[cooldown] ${Jn(m, e + Or(t && !T.endsWith(t.version) ? `${t.version}-+` : T)).replace(e, "")}`;
} else b && !x && (E = S);
return [
s,
...r?.includes("dep") ? [p ? J.gray(p) : ""] : [],
Wn(f),
"→",
g,
...l ? [E] : [],
h,
...[
_,
v,
y,
w
].filter((e) => e)
];
})));
}
async function jr({ 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 (!dn(r) || !n) continue;
let l = yr(r), u = l + Hn(s ?? r), d = l + Hn(n);
i[e] = u, a[e] = Jn(u, d), o[e] = c || "";
}
if (!Object.keys(i).length) return !1;
let s = await Ar({
from: i,
to: a,
format: r.includes("time") ? r : [...r, "time"],
pkgFile: t || void 0,
time: o
}), c = n.raw?.cooldown ?? n.cooldown;
return Y(n, "\n" + J.yellow(J.bold(`Skipped due to ${kr(c)}`))), Y(n, s), !0;
}
async function Mr({ current: e, upgraded: t, skippedByCooldown: n, ownersChangedDeps: r, pkgFile: i, time: a }, o) {
if (o.format?.includes("group")) {
let s = qn(t, e, o), c = await Promise.all(s.map(async ({ heading: t, packages: s }) => ({
heading: t,
table: await Ar({
from: e,
to: s,
skippedByCooldown: n,
format: o.format,
ownersChangedDeps: r,
pkgFile: i,
time: a
})
})));
for (let { heading: e, table: t } of c) Y(o, "\n" + e), Y(o, t);
} else o.format?.includes("lines") ? wr(t, "\n") : Y(o, await Ar({
from: e,
to: t,
skippedByCooldown: n,
format: o.format,
ownersChangedDeps: r,
pkgFile: i,
time: a
}));
}
function Nr(e, t) {
t && Object.keys(t).length > 0 && Y(e, "\n" + Dr(Object.entries(t).map(([e, t]) => [e, J.yellow(xr(t))])));
}
async function Pr(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 jr({
skippedByCooldown: i,
pkgFile: c,
options: e
});
!e.deep && !e.format?.includes("group") && (f && d ? Y(e, "\n" + J.blue(J.bold("Updates"))) : Y(e, ""));
let p = J.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 ? Y(e, "No dependencies.") : n && Object.keys(n).length === 0 && !o && Object.values(qt(t, (e, t) => dn(t))).length > 0 ? Y(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 ${J.cyan("npx pacote packument ncu-test-v2")} is working before reporting an issue.`) : e.global ? Y(e, `All global packages are up-to-date ${p}`) : Y(e, `All dependencies ${o ? "not in cooldown " : ""}match the ${h} package versions ${p}`) : d === 0 && a > 0 ? Y(e, `No dependencies upgraded ${p}`) : d > 0 && await Mr({
current: t,
upgraded: r,
skippedByCooldown: i,
ownersChangedDeps: s,
pkgFile: c,
time: l
}, e), Nr(e, u);
}
function Fr(e, t) {
Y(e, "\nIgnored incompatible updates (peer dependencies):\n"), Y(e, Dr(Object.entries(t).map(([e, { from: t, to: n, reason: r }]) => {
let i = xr("reason: " + Object.entries(r).map(([e, t]) => e + " requires " + t).join(", "));
return [
e,
t,
"→",
Jn(t, n),
i
];
})));
}
function Ir(e, t) {
Y(e, "\nIgnored incompatible updates (engines node):\n"), Y(e, Dr(Object.entries(t).map(([e, { from: t, to: n, enginesNode: r }]) => [
e,
t,
"→",
Jn(t, n),
`reason: requires node ${xr(r)}`
])));
}
function Lr(e, t = 10) {
return e.schema !== 1 || typeof e.timestamp == "number" && e.timestamp + t * 6e4 < Date.now();
}
var Rr = ".ncu-cache.json", zr = `~/${Rr}`, Br = o.join(c.homedir(), Rr);
function Vr(e) {
return e === zr ? Br : e;
}
async function Hr(e) {
e.cacheFile && await s.rm(Vr(e.cacheFile), { force: !0 });
}
async function Ur(e) {
if (!e.cache || !e.cacheFile) return;
let t = Vr(e.cacheFile), n = /* @__PURE__ */ new Set(), r = !1, i = {
schema: 1,
timestamp: Date.now(),
packages: {},
peers: {}
};
try {
let n = await s.readFile(t, "utf-8"), r = JSON.parse(n);
if (Lr(r, e.cacheExpiration)) await s.rm(t, { force: !0 });
else {
let { schema: e, timestamp: t, packages: n = {}, peers: a = {} } = r;
i = {
schema: e,
timestamp: t,
packages: n,
peers: a
};
}
} catch {}
return {
get: (e, t) => {
let r = `${e}___${t}`, a = i.packages[r];
return a && n.add(e), a;
},
set: (e, t, n, a) => {
let o = `${e}___${t}`;
i.packages[o] = {
version: n,
time: a
}, r = !0;
},
getPeers: (e, t) => {
if (!i.peers) return;
let r = `${e}___${t}`, a = i.peers[r];
return a && n.add(e), a;
},
setPeers: (e, t, n) => {
let a = `${e}___${t}`;
i.peers && (i.peers[a] = n, r = !0);
},
save: async () => {
r &&= (await s.writeFile(t, JSON.stringify(i)), !1);
},
log: (t) => {
let r = n.size;
r !== 0 && (Y(e, `\nUsing ${r} cached package ${t ? "peer" : "version"}${r > 1 ? "s" : ""}`, "warn"), Y(e, n, "verbose"), n.clear());
}
};
}
//#endregion
//#region src/lib/uncode.ts
var Wr = (e) => e.replaceAll("`", "").replaceAll(/\*\*(.+?)\*\*/g, "$1").replaceAll(/_(.+?)_/g, "$1"), Gr = (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();
}, Kr = (e) => e.map(([e, t]) => [e, Gr(t)]), qr = (e) => e.replace(/`(.+?)`/g, "<code>$1</code>"), Jr = (e) => "\n <tr>" + e.map((e) => `<td>${qr(e)}</td>`).join("") + "</tr>", Yr = ({ colAligns: e, markdown: t, rows: n }) => {
if (t) return `<table>${n.map(Jr).join("")}\n</table>`;
{
let t = n.map((e) => e.map((e) => Wr(e))), r = new Gt.default({ ...e ? { colAligns: e } : null });
return r.push(...Kr(t)), r.toString();
}
}, Xr = [
"latest",
"newest",
"greatest",
"minor",
"patch",
"semver"
], Zr = (e, t) => e.split("\n").map((e) => e && `${"".padStart(t, " ")}${e}`).join("\n"), X = (e, { markdown: t, lang: n = "js" } = {}) => `${t ? "```" + n + "\n" : ""}${Zr(e, t ? 0 : 4)}${t ? "\n```" : ""}`, Qr = (e, t, { markdown: n } = {}) => n ? `[${e}](#${t})` : `https://github.com/raineorshine/npm-check-updates#${t}`, $r = (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`);
}, ei = (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${X(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 : Wr(r)).trim()}\n\n`;
} else e.description && (n += `\n${t ? e.description : Wr(e.description)}\n`);
return n.trim();
}, ti = ({ 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.
${J.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:
${Yr({
markdown: e,
rows: [[J.cyan("--doctorInstall"), "specify a custom install script (default: `npm install` or `yarn`)"], [J.cyan("--doctorTest"), "specify a custom test script (default: `npm test`)"]]
})}
Example:
${X("$ 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"
})}
`, ni = ({ 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 ${Qr("Config Functions", "config-functions", { markdown: e })}.
${X(`${J.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*/")}
${J.green("filterResults")}: (packageName, { current, currentVersionSemver, upgraded, upgradedVersionSemver }) ${J.cyan("=>")} {
${J.cyan("const")} currentMajor ${J.red("=")} parseInt(currentVersionSemver[${J.cyan("0")}]?.major, ${J.cyan("10")})
${J.cyan("const")} upgradedMajor ${J.red("=")} parseInt(upgradedVersionSemver?.major, ${J.cyan("10")})
${J.red("if")} (currentMajor ${J.red("&&")} upgradedMajor) {
${J.red("return")} currentMajor ${J.red(">=")} upgradedMajor
}
${J.red("return")} ${J.cyan("true")}
}`, { markdown: e })}
For the SemVer type definition, see: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring
`, ri = ({ markdown: e }) => `Modify the output formatting or show additional information. Specify one or more comma-delimited values.\n\n${Zr(Yr({
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.
`, ii = ({ markdown: e }) => `Control the auto-install behavior.\n\n${Zr(Yr({
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)}
`, ai = ({ markdown: e }) => `Control which upgrades are pre-selected in interactive mode. Only applies with \`--interactive\`.
${Zr(Yr({
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 ${Qr("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 ${Qr("--groupFunction", "groupfunction", { markdown: e })} are likewise only pre-selected by \`all\`.
`, oi = ({ 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 ${Qr("Config Functions", "config-functions", { markdown: e })}.
${X(`${J.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*/")}
${J.green("filter")}: (name, semver) ${J.cyan("=>")} {
${J.red("if")} (name.startsWith(${J.yellow("'@myorg/'")})) {
${J.red("return")} ${J.cyan("false")}
}
${J.red("return")} ${J.cyan("true")}
}`, { markdown: e })}
`, si = () => "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", ci = ({ 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 ${Qr("Config Functions", "config-functions", { markdown: e })}.
${X(`${J.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*/")}
${J.green("reject")}: (name, semver) ${J.cyan("=>")} {
${J.red("if")} (name.startsWith(${J.yellow("'@myorg/'")})) {
${J.red("return")} ${J.cyan("true")}
}
${J.red("return")} ${J.cyan("false")}
}`, { markdown: e })}
`, li = () => "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", ui = ({ 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 ${Qr("Config Functions", "config-functions", { markdown: e })}.
${X(`${J.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*/")}
${J.green("groupFunction")}: (name, defaultGroup, currentSpec, upgradedSpec, upgradedVersion) ${J.cyan("=>")} {
${J.red("if")} (name ${J.red("===")} ${J.yellow("'typescript'")} ${J.red("&&")} defaultGroup ${J.red("===")} ${J.yellow("'minor'")}) {
${J.red("return")} ${J.yellow("'major'")}
}
${J.red("if")} (name.startsWith(${J.yellow("'@myorg/'")})) {
${J.red("return")} ${J.yellow("'My Org'")}
}
${J.red("return")} defaultGroup
}`, { markdown: e })}
`, di = ({ markdown: e }) => `Determines the version to upgrade to. (default: "latest")
${Zr(Yr({
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.
${X("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 ${Qr("Config Functions", "config-functions", { markdown: e })}.
${X(`${J.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*/")}
${J.green("target")}: (name, semver) ${J.cyan("=>")} {
${J.red("if")} (parseInt(semver[0]?.major) ${J.red("===")} ${J.yellow("'0'")}) ${J.red("return")} ${J.yellow("'minor'")}
${J.red("return")} ${J.yellow("'latest'")}
}`, { markdown: e })}
`, fi = ({ markdown: e }) => `Specifies the package manager to use when looking up versions.\n\n${Zr(Yr({
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)}
`, pi = ({ markdown: e }) => `Specify whether \`--registry\` refers to a full npm registry or a simple JSON file.
${Zr(Yr({
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 ${J.cyan("`--registry`")} option.`]]
}), e ? 0 : 4)}
Example:
${X(`${J.gray("# local file")}
ncu --registryType json --registry ./registry.json
${J.gray("# url")}
ncu --registryType json --registry https://api.mydomain/registry.json
${J.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:
${X("{\n \"prettier\": \"2.7.1\",\n \"typescript\": \"4.7.4\"\n}", {
markdown: e,
lang: "json"
})}
`, mi = ({ markdown: e }) => `Check peer dependencies of installed packages and filter updates to compatible versions.
${J.bold("Example")}:
The following example demonstrates how \`--peer\` works, and how it uses peer dependencies from upgraded modules.
The package ${J.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:
${X("\"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:
${X("\"ncu-test-peer-update\": \"1.1.0\",\n\"ncu-test-return-version\": \"2.0.0\"", {
markdown: e,
lang: "json"
})}
${J.bold("With `--peer`")}:
ncu upgrades packages to the highest version that still adheres to the peer dependency constraints:
${X(`ncu-test-peer-update 1.0.0 → 1.${J.cyan("1.0")}
ncu-test-return-version 1.0.0 → 1.${J.cyan("1.0")}`, {
markdown: e,
lang: "text"
})}
${J.bold("Without `--peer`")}:
As a comparison: without using the \`--peer\` option, ncu will suggest the latest versions, ignoring peer dependencies:
${X(`ncu-test-peer-update 1.0.0 → 1.${J.cyan("1.0")}
ncu-test-return-version 1.0.0 → ${J.red("2.0.0")}`, {
markdown: e,
lang: "text"
})}
`, hi = ({ 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:
${X("--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"\`.
${J.bold("Example")}:
Let's examine how cooldown works with a package that has these versions available:
${X("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"
})}
${J.bold("With default target (latest)")}:
${X("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
${J.bold("With `@latest` strict target")}:
${X("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
${J.bold("With `@beta`/`@tag` target")}:
${X("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
${J.bold("With other targets")}:
${X("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:
${X("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 ${Qr("Config Functions", "config-functions", { markdown: e })}.
${X(`${J.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*/")}
${J.green("cooldown")}: packageName ${J.cyan("=>")} (packageName.startsWith(${J.yellow("'@my-company'")}) ? ${J.cyan("0")} : ${J.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:
${Yr({
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:
${X("$ 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"
})}
`, gi = ["group"], _i = [
{
long: "cache",
description: `Cache versions to a local cache file. Default \`--cacheFile\` is \`${zr}\` 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: $r("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: zr,
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: $r("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, packageManager, or devEngines (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.",
type: "boolean"
},
{
long: "doctor",
short: "d",
description: "Iteratively installs upgrades and runs tests to identify breaking upgrades. Requires `-u` to execute.",
type: "boolean",
help: ti
},
{
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: $r("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",
accumulate: !0,
parse: (e, t) => [...t || [], e],
help: oi
},
{
long: "filterResults",
arg: "fn",
cli: !1,
description: "Filters results based on a user provided predicate function after fetching new versions.",
type: "FilterResultsFunction",
help: ni
},
{
long: "filterVersion",
arg: "p",
description: "Filter on package version using comma-or-space-delimited list or /regex/.",
type: "string | RegExp | readonly (string | RegExp)[]",
accumulate: !0,
parse: (e, t) => [...t || [], e],
help: si
},
{
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([...gi.filter((e) => !n.includes(e)), ...r])];
},
default: gi,
type: "readonly string[]",
choices: [
"dep",
"group",
"homepage",
"ownerChanged",
"repo",
"diff",
"time",
"lines",
"installedVersion",
"cooldown"
],
help: ri
},
{
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: ui
},
{
long: "install",
arg: "value",
description: "Control the auto-install behavior: always, never, prompt.",
help: ii,
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: ai,
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: fi,
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: mi
},
{
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 == "boolean") return e;
if (typeof e == "number") return !!e;
if (typeof e == "string") return !!parseInt(e, 10);
throw Error("pre must be a number");
},
type: "number",
typePublic: "boolean"
},
{
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: pi,
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",
accumulate: !0,
parse: (e, t) => [...t || [], e],
help: ci
},
{
long: "rejectVersion",
arg: "p",
description: "Exclude package.json versions using comma-or-space-delimited list or /regex/.",
type: "string | RegExp | readonly (string | RegExp)[]",
accumulate: !0,
parse: (e, t) => [...t || [], e],
help: li
},
{
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: $r("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: di,
type: `${Xr.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: $r("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",
accumulate: !0,
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: hi,
parse: (e) => {
if (typeof e == "number" || typeof e == "function") return e;
if (typeof e == "string") {
let t = pn(e);
if (t !== null) return t;
let n = e.trim(), r = n === "" ? NaN : Number(n);
return Number.isFinite(r) ? r : NaN;
}
throw Error("cooldown must be a number, string, or function");
}
}
], vi = q(_i, (e) => ({
...e.short ? { [e.short]: e } : null,
...e.long ? { [e.long]: e } : null
})), yi = Dn(_i, (e) => e.long);
//#endregion
//#region src/lib/defineConfig.ts
function bi(e) {
return e;
}
//#endregion
//#region src/lib/lockfiles.ts
var xi = {
npm: ["package-lock.json"],
yarn: ["yarn.lock"],
pnpm: ["pnpm-lock.yaml"],
deno: ["deno.json", "deno.jsonc"],
bun: ["bun.lock", "bun.lockb"]
}, Si = Object.values(xi).flat();
function Ci(e) {
for (let [t, n] of Object.entries(xi)) if (n.includes(e)) return t;
return null;
}
function wi(e) {
return xi[e]?.[0] ?? xi.npm[0];
}
//#endregion
//#region src/lib/findLockfile.ts
async function Ti(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 Si) 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 Ei = o.dirname(h(import.meta.url)), Di = () => {
let e = process.env.npm_config_user_agent ?? "", t = process.env.npm_execpath ?? "";
return e.startsWith("yarn/") || t.includes("yarn") || Ei.includes("/yarn/") || Ei.includes("\\Yarn\\") ? "yarn" : e.startsWith("pnpm/") || t.includes("pnpm") || Ei.includes("/pnpm/") || Ei.includes("\\pnpm\\") ? "pnpm" : e.startsWith("bun/") || typeof Bun < "u" || process.versions.bun || Ei.includes("/.bun/") || Ei.includes("\\.bun\\") ? "bun" : "npm";
}, Oi = async (e, t = s.readdir) => {
if (e.packageManager) return e.packageManager;
if (e.global) return Di();
let n = (await Ti(e, t))?.filename;
return n && Ci(n) || "npm";
}, ki = (e, t = process.platform) => t === "win32" && e !== "bun" ? [`${e}.cmd`, e] : [e];
async function Ai(e, t, n, r) {
let i = ki(e);
for (let [e, a] of i.entries()) try {
return {
...await (0, Ee.default)(a, t, n, r),
command: [a, ...t].join(" ")
};
} catch (t) {
if (t.code !== "ENOENT" || e === i.length - 1) throw t;
}
throw Error(`No spawn commands available for ${e}`);
}
//#endregion
//#region node_modules/@streamparser/json/dist/mjs/utils/bufferedString.js
var ji = 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;
}
}, Mi = 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;
}
}, Ni;
(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";
})(Ni ||= {});
var Z = Ni, Pi;
(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";
})(Pi ||= {});
var Fi = {
34: 34,
92: 92,
47: 47,
98: 8,
102: 12,
110: 10,
114: 13,
116: 9
}, Ii;
(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";
})(Ii ||= {});
function Li(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 Ri = {
stringBufferSize: 0,
numberBufferSize: 0,
separator: void 0,
emitPartialTokens: !1
}, zi = class e extends Error {
constructor(t) {
super(t), Object.setPrototypeOf(this, e.prototype);
}
};
function Bi(e, t) {
if (t !== void 0 && (!Number.isInteger(t) || t < 0)) throw new zi(`Invalid "${e}": ${t}. Expected a non-negative integer.`);
}
function Vi(e) {
return e >= 194 && e <= 223 ? 2 : e <= 239 ? 3 : 4;
}
function Hi(e, t) {
let n = t;
for (; n < e.length && e[n] >= 128;) {
let t = Vi(e[n]);
if (n + t > e.length) break;
n += t;
}
return n;
}
var Ui = 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({}, Ri), e), Bi("stringBufferSize", e.stringBufferSize), Bi("numberBufferSize", e.numberBufferSize), this.emitPartialTokens = e.emitPartialTokens === !0, this.bufferedString = e.stringBufferSize && e.stringBufferSize > 4 ? new Mi(e.stringBufferSize) : new ji(), this.bufferedNumber = e.numberBufferSize && e.numberBufferSize > 0 ? new Mi(e.numberBufferSize) : new ji(), 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 = Vi(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 = Hi(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 = Fi[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 zi(`Unexpected "${String.fromCharCode(r)}" at chunk position "${n}" (absolute position "${this.streamByteLength + n}") in state ${Li(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 zi(`Tokenizer ended in the middle of a token (state: ${Li(this.state)}). Either not all the data was received or the data was invalid.`));
}
}
onToken(e) {
throw new zi("Can't emit tokens before the \"onToken\" callback has been set up.");
}
onError(e) {
throw e;
}
onEnd() {}
}, Wi;
(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";
})(Wi ||= {});
function Gi(e) {
return [
"VALUE",
"KEY",
"COLON",
"COMMA",
"ENDED",
"ERROR",
"SEPARATOR"
][e];
}
function Ki(e, t, n) {
if (t === "__proto__") {
Object.defineProperty(e, t, {
value: n,
writable: !0,
enumerable: !0,
configurable: !0
});
return;
}
e[t] = n;
}
var qi = {
paths: void 0,
keepStack: !0,
separator: void 0,
emitPartialValues: !1
}, Ji = class e extends Error {
constructor(t) {
super(t), Object.setPrototypeOf(this, e.prototype);
}
}, Yi = 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({}, qi), 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 Ji(`Invalid selector "${r}". Should start with "$".`);
let e = r.split(".").slice(1);
if (e.includes("")) throw new Ji(`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 Ji(`Unexpected partial ${Z[e]} (${JSON.stringify(t)}) in state ${Gi(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 ? (Ki(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 = {};
Ki(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 = [];
Ki(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 Ji(`Unexpected ${Z[e]} (${JSON.stringify(t)}) in state ${Gi(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: ${Gi(this.state)}). Either not all the data was received or the data was invalid.`)) : (this.state = 4, this.onEnd());
}
onValue(e) {
throw new Ji("Can't emit data before the \"onValue\" callback has been set up.");
}
onError(e) {
throw e;
}
onEnd() {}
}, Xi = class {
constructor(e = {}) {
this.tokenizer = new Ui(e), this.tokenParser = new Yi(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);
};
}
}, Zi;
(function(e) {
e[e.OBJECT = 0] = "OBJECT", e[e.ARRAY = 1] = "ARRAY";
})(Zi ||= {});
//#endregion
//#region node_modules/camelcase/index.js
var Qi = /[\p{Lu}]/u, $i = /[\p{Ll}]/u, ea = /^[\p{Lu}](?![\p{Lu}])/u, ta = /[_.\- ]+/, na = /([\p{Alpha}\p{N}_]|$)/u, ra = RegExp("^" + ta.source), ia = new RegExp(ta.source + na.source, "gu"), aa = new RegExp(String.raw`\d+` + na.source, "gu"), oa = (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 && Qi.test(l) ? (e = e.slice(0, c) + "-" + e.slice(c), i = !1, o = a, a = !0, c++) : a && o && $i.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;
}, sa = (e, t) => e.replace(ea, (e) => t(e)), ca = (e, t, n) => {
let r = "", i = !1, a = !1, o = [...e];
for (let e = 0; e < o.length; e++) {
let s = o[e], c = Qi.test(s), l = e + 1 < o.length && Qi.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) : ta.test(s) ? (r += s, a = !1) : (r += t(s), i = !1, a = !1);
}
return r;
}, la = (e, t, { capitalizeAfterNumber: n }) => {
let r = n ? (e, n, r, i) => {
let a = i.charAt(r + e.length);
return ta.test(a) ? e : n ? e.slice(0, -n.length) + t(n) : e;
} : (e) => e;
return e.replaceAll(aa, r).replaceAll(ia, (e, n) => t(n));
};
function ua(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 ? ta.test(e) ? n : n + (t.pascalCase ? i(e) : r(e)) : (e !== r(e) && (e = oa(e, r, i, t.preserveConsecutiveUppercase)), e = e.replace(ra, ""), e = t.capitalizeAfterNumber ? t.preserveConsecutiveUppercase ? sa(e, r) : r(e) : ca(e, r, t.preserveConsecutiveUppercase), t.pascalCase && e.length > 0 && (e = i(e[0]) + e.slice(1)), n + la(e, i, t));
}
//#endregion
//#region node_modules/yocto-queue/index.js
var da = /* @__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), fa = class {
value;
next;
constructor(e) {
this.value = e;
}
}, pa = class {
#e;
#t;
#n;
constructor() {
this.clear();
}
enqueue(e) {
let t = new fa(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 ma(e) {
if (!((Number.isInteger(e) || e === Infinity) && e > 0)) throw TypeError("Expected `concurrency` to be a number from 1 and up");
let t = new pa(), 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 ha = class extends Error {
constructor(e) {
super(), this.value = e;
}
}, ga = async (e, t) => t(await e), _a = async (e) => {
let t = await Promise.all(e);
if (t[1] === !0) throw new ha(t[0]);
return !1;
};
async function va(e, t, { concurrency: n = Infinity, preserveOrder: r = !0 } = {}) {
let i = ma(n), a = [...e].map((e) => [e, i(ga, e, t)]), o = ma(r ? 1 : Infinity);
try {
await Promise.all(a.map((e) => o(_a, e)));
} catch (e) {
if (e instanceof ha) return e.value;
throw e;
}
}
//#endregion
//#region node_modules/locate-path/index.js
var ya = {
directory: "isDirectory",
file: "isFile"
};
function ba(e) {
if (!(e === "both" || Object.hasOwn(ya, e))) throw Error(`Invalid type specified: ${e}`);
}
var xa = (e, t) => e === "both" ? t.isFile() || t.isDirectory() : t[ya[e]](), Sa = (e) => e instanceof URL ? h(e) : e;
async function Ca(e, { cwd: t = b.cwd(), type: n = "file", allowSymlinks: r = !0, concurrency: i, preserveOrder: a } = {}) {
ba(n), t = Sa(t);
let s = r ? y.stat : y.lstat;
return va(e, async (e) => {
try {
return xa(n, await s(o.resolve(t, e)));
} catch {
return !1;
}
}, {
concurrency: i,
preserveOrder: a
});
}
function wa(e, { cwd: t = b.cwd(), type: n = "file", allowSymlinks: r = !0 } = {}) {
ba(n), t = Sa(t);
let i = r ? v.statSync : v.lstatSync;
for (let r of e) try {
let e = i(o.resolve(t, r), { throwIfNoEntry: !1 });
if (!e) continue;
if (xa(n, e)) return r;
} catch {}
}
d(_);
function Ta(e) {
return e instanceof URL ? h(e) : e;
}
//#endregion
//#region node_modules/find-up/index.js
var Ea = Symbol("findUpStop");
async function Da(e, t = {}) {
let n = o.resolve(Ta(t.cwd) ?? ""), { root: r } = o.parse(n), i = o.resolve(n, Ta(t.stopAt) ?? r), a = t.limit ?? Infinity, s = [e].flat(), c = async (t) => {
if (typeof e != "function") return Ca(s, t);
let n = await e(t.cwd);
return typeof n == "string" ? Ca([n], t) : n;
}, l = [];
for (;;) {
let e = await c({
...t,
cwd: n
});
if (e === Ea || (e && l.push(o.resolve(n, e)), n === i || l.length >= a)) break;
n = o.dirname(n);
}
return l;
}
function Oa(e, t = {}) {
let n = o.resolve(Ta(t.cwd) ?? ""), { root: r } = o.parse(n), i = o.resolve(n, Ta(t.stopAt) ?? r), a = t.limit ?? Infinity, s = [e].flat(), c = (t) => {
if (typeof e != "function") return wa(s, t);
let n = e(t.cwd);
return typeof n == "string" ? wa([n], t) : n;
}, l = [];
for (;;) {
let e = c({
...t,
cwd: n
});
if (e === Ea || (e && l.push(o.resolve(n, e)), n === i || l.length >= a)) break;
n = o.dirname(n);
}
return l;
}
async function ka(e, t = {}) {
return (await Da(e, {
...t,
limit: 1
}))[0];
}
function Aa(e, t = {}) {
return Oa(e, {
...t,
limit: 1
})[0];
}
//#endregion
//#region node_modules/ini/lib/ini.js
var ja = /* @__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
};
})), Ma = /* @__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;
}
};
})), Na = /* @__PURE__ */ i(((e) => {
var { REGEX_BACKSLASH: t, REGEX_REMOVE_BACKSLASH: n, REGEX_SPECIAL_CHARS: r, REGEX_SPECIAL_CHARS_GLOBAL: i } = Ma();
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;
};
})), Pa = /* @__PURE__ */ i(((e, t) => {
var n = Na(), { 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: _ } = Ma(), 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, N = !1, P = !1, F = !1, I = !1, re = 0, L, R, z = {
value: "",
depth: 0,
isGlob: !1
}, B = () => D >= x, V = () => E.charCodeAt(D + 1), H = () => (L = R, E.charCodeAt(++D));
for (; D < x;) {
R = H();
let e;
if (R === a) {
N = z.backslashes = !0, R = H(), R === u && (ne = !0);
continue;
}
if (ne === !0 || R === u) {
for (re++; B() !== !0 && (R = H());) {
if (R === a) {
N = z.backslashes = !0, H();
continue;
}
if (R === u) {
re++;
continue;
}
if (ne !== !0 && R === s && (R = H()) === s) {
if (A = z.isBrace = !0, j = z.isGlob = !0, I = !0, S === !0) continue;
break;
}
if (ne !== !0 && R === o) {
if (A = z.isBrace = !0, j = z.isGlob = !0, I = !0, S === !0) continue;
break;
}
if (R === h && (re--, re === 0)) {
ne = !1, A = z.isBrace = !0, I = !0;
break;
}
}
if (S === !0) continue;
break;
}
if (R === l) {
if (C.push(D), w.push(z), z = {
value: "",
depth: 0,
isGlob: !1
}, I === !0) continue;
if (L === s && D === O + 1) {
O += 2;
continue;
}
k = D + 1;
continue;
}
if (b.noext !== !0 && (R === p || R === i || R === r || R === m || R === c) && V() === d) {
if (j = z.isGlob = !0, M = z.isExtglob = !0, I = !0, R === c && D === O && (F = !0), S === !0) {
for (; B() !== !0 && (R = H());) {
if (R === a) {
N = z.backslashes = !0, R = H();
continue;
}
if (R === g) {
j = z.isGlob = !0, I = !0;
break;
}
}
continue;
}
break;
}
if (R === r) {
if (L === r && (te = z.isGlobstar = !0), j = z.isGlob = !0, I = !0, S === !0) continue;
break;
}
if (R === m) {
if (j = z.isGlob = !0, I = !0, S === !0) continue;
break;
}
if (R === f) {
for (; B() !== !0 && (e = H());) {
if (e === a) {
N = z.backslashes = !0, H();
continue;
}
if (e === _) {
ee = z.isBracket = !0, j = z.isGlob = !0, I = !0;
break;
}
}
if (S === !0) continue;
break;
}
if (b.nonegate !== !0 && R === c && D === O) {
P = z.negated = !0, O++;
continue;
}
if (b.noparen !== !0 && R === d) {
if (j = z.isGlob = !0, S === !0) {
for (; B() !== !0 && (R = H());) {
if (R === d) {
N = z.backslashes = !0, R = H();
continue;
}
if (R === g) {
I = !0;
break;
}
}
continue;
}
break;
}
if (j === !0) {
if (I = !0, S === !0) continue;
break;
}
}
b.noext === !0 && (M = !1, j = !1);
let U = E, ie = "", ae = "";
O > 0 && (ie = E.slice(0, O), E = E.slice(O), k -= O), U && j === !0 && k > 0 ? (U = E.slice(0, k), ae = E.slice(k)) : j === !0 ? (U = "", ae = E) : U = E, U && U !== "" && U !== "/" && U !== E && v(U.charCodeAt(U.length - 1)) && (U = U.slice(0, -1)), b.unescape === !0 && (ae &&= n.removeBackslashes(ae), U && N === !0 && (U = n.removeBackslashes(U)));
let oe = {
prefix: ie,
input: e,
start: O,
base: U,
glob: ae,
isBrace: A,
isBracket: ee,
isGlob: j,
isExtglob: M,
isGlobstar: te,
negated: P,
negatedExtglob: F
};
if (b.tokens === !0 && (oe.maxDepth = 0, v(R) || w.push(z), oe.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 = ie) : w[n].value = a, y(w[n]), oe.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]), oe.maxDepth += w[w.length - 1].depth);
}
oe.slashes = C, oe.parts = T;
}
return oe;
};
})), Fa = /* @__PURE__ */ i(((e, t) => {
var n = Ma(), r = Na(), { 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, N = d.bash === !0 ? M(d) : ee;
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 = [], I = [], re = [], 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), U = (e = "", t = 0) => {
P.consumed += e, P.index += t;
}, ie = (e) => {
P.output += e.output == null ? e.value : e.output, U(e.value);
}, ae = () => {
let e = 1;
for (; B() === "!" && (B(2) !== "(" || B(3) === "?");) V(), P.start++, e++;
return e % 2 != 0 && (P.negated = !0, P.start++, !0);
}, oe = (e) => {
P[e]++, re.push(e);
}, se = (e) => {
P[e]--, re.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) && ie(e), L && L.type === "text" && e.type === "text") {
L.output = (L.output || L.value) + e.value, L.value += e.value;
return;
}
e.prev = L, h.push(e), L = e;
}, G = (e, t) => {
let n = {
...v[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;
oe("parens"), W({
type: e,
value: t,
output: P.output ? "" : w
}), W({
type: "paren",
extglob: !0,
value: V(),
output: r
}), F.push(n);
}, ce = (n) => {
let i = e.slice(n.startIndex, P.index + 1), a = y(e.slice(n.startIndex + 2, P.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;
P.output = n.output + t.output, P.backtrack = !0, W({
type: "paren",
extglob: !0,
value: R,
output: ""
}), se("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 = M(d)), (e !== N || z() || /^\)+$/.test(H())) && (o = n.close = `)$))${e}`), n.inner.includes("*") && (s = H()) && /^\.[^\\/.]+$/.test(s) && (o = n.close = `)${b(s, {
...t,
fastpaths: !1
}).output})${e})`), n.prev.type === "bos" && (P.negatedExtglob = !0);
}
W({
type: "paren",
extglob: !0,
value: R,
output: o
}), se("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 ? 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 = w);
continue;
}
}
}
(R === "[" && B() !== ":" || R === "-" && B() === "]") && (R = `\\${R}`), R === "]" && (L.value === "[" || L.value === "[^") && (R = `\\${R}`), d.posix === !0 && R === "!" && L.value === "[" && (R = "^"), L.value += R, ie({ value: R });
continue;
}
if (P.quotes === 1 && R !== "\"") {
R = r.escapeRegex(R), L.value += R, ie({ value: R });
continue;
}
if (R === "\"") {
P.quotes = P.quotes === 1 ? 0 : 1, d.keepQuotes === !0 && W({
type: "text",
value: R
});
continue;
}
if (R === "(") {
oe("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) {
ce(F.pop());
continue;
}
W({
type: "paren",
value: R,
output: P.parens ? ")" : "\\)"
}), se("parens");
continue;
}
if (R === "[") {
if (d.nobracket === !0 || !H().includes("]")) {
if (d.nobracket !== !0 && d.strictBrackets === !0) throw SyntaxError(u("closing", "]"));
R = `\\${R}`;
} else oe("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;
}
se("brackets");
let e = L.value.slice(1);
if (L.posix !== !0 && e[0] === "^" && !e.includes("/") && (R = `/${R}`), L.value += R, ie({ 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) {
oe("braces");
let e = {
type: "brace",
value: R,
output: "(",
outputIndex: P.output.length,
tokensIndex: P.tokens.length
};
I.push(e), W(e);
continue;
}
if (R === "}") {
let e = I[I.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
}), se("braces"), I.pop();
continue;
}
if (R === "|") {
F.length > 0 && F[F.length - 1].conditions++, W({
type: "text",
value: R
});
continue;
}
if (R === ",") {
let e = R, t = I[I.length - 1];
t && re[re.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: C
});
continue;
}
if (R === ".") {
if (P.braces > 0 && L.type === "dot") {
L.value === "." && (L.output = x);
let e = I[I.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: x
});
continue;
}
W({
type: "dot",
value: R,
output: x
});
continue;
}
if (R === "?") {
if (!(L && L.value === "(") && d.noextglob !== !0 && B() === "(" && B(2) !== "?") {
G("qmark", R);
continue;
}
if (L && L.type === "paren") {
let e = B(), t = R;
(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: A
});
continue;
}
W({
type: "qmark",
value: R,
output: k
});
continue;
}
if (R === "!") {
if (d.noextglob !== !0 && B() === "(" && (B(2) !== "?" || !/[!=<:]/.test(B(3)))) {
G("negate", R);
continue;
}
if (d.nonegate !== !0 && P.index === 0) {
ae();
continue;
}
}
if (R === "+") {
if (d.noextglob !== !0 && B() === "(" && B(2) !== "?") {
G("plus", R);
continue;
}
if (L && L.value === "(" || d.regex === !1) {
W({
type: "plus",
value: R,
output: S
});
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: S
});
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, U(R);
continue;
}
let t = H();
if (d.noextglob !== !0 && /^\([^?]/.test(t)) {
G("star", R);
continue;
}
if (L.type === "star") {
if (d.noglobstar === !0) {
U(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), U("/**", 3);
}
if (n.type === "bos" && z()) {
L.type = "globstar", L.value += R, L.output = M(d), P.output = L.output, P.globstar = !0, U(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 = M(d) + (d.strictSlashes ? ")" : "|$)"), L.value += R, P.globstar = !0, P.output += n.output + L.output, U(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 = `${M(d)}${C}|${C}${e})`, L.value += R, P.output += n.output + L.output, P.globstar = !0, U(R + V()), W({
type: "slash",
value: "/",
output: ""
});
continue;
}
if (n.type === "bos" && t[0] === "/") {
L.type = "globstar", L.value += R, L.output = `(?:^|${C}|${M(d)}${C})`, P.output = L.output, P.globstar = !0, U(R + V()), W({
type: "slash",
value: "/",
output: ""
});
continue;
}
P.output = P.output.slice(0, -L.output.length), L.type = "globstar", L.output = M(d), L.value += R, P.output += L.output, P.globstar = !0, U(R);
continue;
}
let n = {
type: "star",
value: R,
output: N
};
if (d.bash === !0) {
n.output = ".*?", (L.type === "bos" || L.type === "slash") && (n.output = te + 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 += D, L.output += D) : d.dot === !0 ? (P.output += O, L.output += O) : (P.output += te, L.output += te), B() !== "*" && (P.output += w, L.output += w)), W(n);
}
for (; P.brackets > 0;) {
if (d.strictBrackets === !0) throw SyntaxError(u("closing", "]"));
P.output = r.escapeLast(P.output, "["), se("brackets");
}
for (; P.parens > 0;) {
if (d.strictBrackets === !0) throw SyntaxError(u("closing", ")"));
P.output = r.escapeLast(P.output, "("), se("parens");
}
for (; P.braces > 0;) {
if (d.strictBrackets === !0) throw SyntaxError(u("closing", "}"));
P.output = r.escapeLast(P.output, "{"), se("braces");
}
if (d.strictSlashes !== !0 && (L.type === "star" || L.type === "bracket") && W({
type: "maybe_slash",
value: "",
output: `${C}?`
}), 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;
};
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;
})), Ia = /* @__PURE__ */ i(((e, t) => {
var n = Pa(), r = Fa(), i = Na(), a = Ma(), 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;
})), La = /* @__PURE__ */ i(((e, t) => {
var n = Ia(), r = Na();
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;
})), Ra = /* @__PURE__ */ n(ja(), 1), za = /* @__PURE__ */ n(La(), 1), Ba, Va;
function Ha(e) {
if (typeof e != "string") throw TypeError(`Expected a string, got ${typeof e}`);
if (Ba === void 0 && (Ba = c.homedir()), Ba && /^~(?=$|\/|\\)/.test(e)) return e.replace(/^~/, Ba);
let t = e.match(/^~([^/\\]+)(.*)/);
if (t && (Va === void 0 && (Va = c.userInfo().username), Va)) {
let e = t[1], n = t[2];
if (e === Va) return Ba + n;
}
return e;
}
//#endregion
//#region src/lib/interpolate.ts
var Ua = (e, t) => e.replace(/\$\{(\w+)(?:(:)?-([^}]*))?\}/g, (e, n, r, i = "") => {
let a = t[n];
return r ? a || i : a ?? i;
});
//#endregion
//#region src/package-managers/filters.ts
function Wa(e, t) {
return t.deprecated || !e.deprecated;
}
function Ga(e, t) {
return t.pre ? !0 : !e.version || !nr(e.version);
}
var Ka = (e, t) => {
if (!t) return !0;
let n = e?.engines?.node;
return !n || K.default.satisfies(t, n);
}, qa = (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" ? pn(a) ?? 0 : a;
return Date.now() - i.getTime() >= o * 864e5;
};
function Ja(e) {
let t = e.enginesNode && e.nodeEngineVersion ? K.default.minVersion(e.nodeEngineVersion)?.version : null, n = /* @__PURE__ */ new Map(), r = e.peerDependencies;
if (r) for (let e of Object.values(r)) for (let [t, r] of Object.entries(e)) {
let e = n.get(t);
e ? e.push(r) : n.set(t, [r]);
}
let i = [
(t) => Wa(t, e),
(t) => Ga(t, e),
e.enginesNode ? (e) => Ka(e, t) : null,
e.peerDependencies ? (e) => (n.get(e.name) ?? []).every((t) => K.default.satisfies(e.version, t)) : null
];
return (e) => i.every((t) => !t || t(e));
}
//#endregion
//#region src/package-managers/npm.ts
var Ya = /* @__PURE__ */ r({
default: () => yo,
defaultPrefix: () => bo,
distTag: () => Do,
getCooldown: () => No,
getDistTags: () => wo,
getEngines: () => To,
getPeerDependencies: () => Co,
greatest: () => So,
latest: () => Oo,
list: () => Eo,
minor: () => Ao,
newest: () => ko,
normalizeNpmConfig: () => co,
npmApi: () => lo,
packageAuthorChanged: () => _o,
parseJson: () => mo,
patch: () => jo,
semver: () => Mo,
spawn: () => yo
}), Xa = () => import("./chunks/lib-DQyQ2Yp2.js").then((e) => /* @__PURE__ */ n(e.default, 1)), Za, Qa = async () => (await (Za ??= Xa())).default, $a = /* @__PURE__ */ new Set([
"-",
"||",
"&&",
"<",
"<=",
">",
">="
]), eo = (e) => (0, Oe.parseRange)(e).some((e) => $a.has(e.operator || "")), to = (e) => (0, Oe.parseRange)(e).some((e) => e.operator === "^" || e.operator === "~"), no = (e) => !!e && e.trim() === e && !!K.default.valid(e), ro = (e) => e && (!K.default.validRange(e) || Bn(e)), io = async (e, t, n, r = {}, i) => {
let a = await Qa(), o = a.pickRegistry(e, r), s = {
"user-agent": r.userAgent || `npm-check-updates/${De.version} node/${process.version}`,
"ncu-version": De.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 Xi({
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 io(e, t, n, {
...r,
fullMetadata: !0
}, i);
}
}, ao = async (e, t, n) => {
let r;
try {
r = await io(e, [], null, {
...n,
fullMetadata: !0
}, t);
} catch (e) {
if (e.statusCode >= 400 && e.statusCode < 500) return null;
throw e;
}
return r?.version ? {
name: e,
"dist-tags": { [t]: r.version },
versions: { [r.version]: r }
} : null;
}, oo = ({ packageName: e, currentVersion: t, options: n, versions: r, time: i, filter: a = () => !0, compare: o = Zn }) => {
let s = Ja(n), c = K.default.validRange(t) ? K.default.minVersion(t)?.version : null;
if (!c) return {
targetVersion: null,
fallbackVersion: null,
targetBlockedByCooldown: !1
};
let l = !qa(e, c, i?.[c], n.cooldown), u = r.reduce((t, r) => {
let c = r.version;
if (!no(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 || qa(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 && !K.default.gt(f, c) && (f = null), l && d === c && (u.targetBlockedByCooldown = !1), {
...u,
targetVersion: d,
fallbackVersion: f
};
}, so = ({ 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 = K.default.validRange(t) ? K.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;
}, co = (e, t) => {
let n = {
cafile: (e) => {
if (!e) return;
let n = v.readFileSync(o.resolve(t || "", Ha(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 q(e, (e, t) => {
let o = Ua(e, process.env), s = typeof t == "string" ? r[o.replace(/-/g, "").toLowerCase()] === "boolean" ? i(t) : r[o.replace(/-/g, "").toLowerCase()] === "number" ? a(t) : Ua(t, process.env) : t, { [o]: c } = n;
return typeof c == "string" ? { [c]: s } : typeof c == "function" ? { ...c(s.toString()) } : { [o.match(/^[a-z]/i) ? ua(o) : o]: s };
});
}, lo = {}, uo = (0, da.default)((e) => {
let t;
try {
let n = v.readFileSync(e, "utf-8");
t = Ra.default.parse(n);
} catch (e) {
if (e.code === "ENOENT") return null;
throw e;
}
return co(t, e);
}), fo = (e) => {
try {
return Ra.default.parse(v.readFileSync(e, "utf-8"));
} catch (e) {
if (e.code === "ENOENT") return {};
throw e;
}
}, po = () => {
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;
};
lo.findNpmConfig = (0, da.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 = fo(o.join(po(), "etc", "npmrc")), i = fo(n), a = Aa(["npmrc", ".npmrc"]), s = a && a !== n ? fo(a) : {};
return co({
...r,
...i,
...s,
...t,
cache: !1
});
});
function mo(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 ho = (e) => !!(e && (e.name || e.engines || e.version || e.versions));
lo.mockFetchUpgradedPackument = (e) => (t, n, r, i) => {
let a = typeof e == "function" ? e(i)?.[t] : typeof e == "string" || ho(e) ? e : e[t], o = ho(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 = ho(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: {},
...ho(a) ? a : null
}, { versions: l, ...u } = c;
return Promise.resolve({
...c,
versions: { ...ho(a) && a.versions || { [o]: u } }
});
};
var go = (0, da.default)(({ npmConfigLocal: e, npmConfigUser: t, npmConfigWorkspaceProject: n }, r) => {
let i = r.packageFile ? o.join(r.packageFile, "../.npmrc") : void 0, a = i ? uo(i) : null, s = r.cwd ? o.join(r.cwd, ".npmrc") : void 0, c = s ? uo(s) : null, l = (e, t) => {
if (!t || Object.keys(t).length === 0) return;
Y(r, `\n${e}:`, "verbose");
let { cache: n, ...i } = t;
Tr(r, i, "verbose");
};
l("npm config (workspace project)", n), l("npm config (user)", t), l("npm config (local override)", e), l(`npm config (project: ${i})`, a), l(`npm config (cwd: ${s})`, c);
let u = {
...n,
...t,
...e,
...a,
...c,
...r.registry ? {
registry: r.registry,
silent: !0
} : null,
...r.timeout ? { timeout: r.timeout } : null
};
return (n || e || a || c) && l("merged npm config", u), u;
});
async function _o(e, t, n, r = {}, i, a) {
let o = await io(e, ["versions"], null, go({
npmConfigUser: {
...lo.findNpmConfig(),
fullMetadata: !0
},
npmConfigLocal: i,
npmConfigWorkspaceProject: a
}, r));
if (o.versions) {
let e = Object.keys(o.versions), r = K.default.minSatisfying(e, t), i = K.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 vo(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 lo.mockFetchUpgradedPackument(i)(e, t, n, r);
}
if (ro(n)) return {};
let c = r.format?.includes("time") && !t.includes("time") ? [...t, "time"] : t, l = c.includes("time"), u = go({
npmConfigUser: {
...lo.findNpmConfig(),
fullMetadata: l
},
npmConfigLocal: a,
npmConfigWorkspaceProject: o
}, r), d;
try {
let n = r.distTag || "latest";
if (r.distTag && !r.deprecated && !l && t.length === 1 && t[0] === "dist-tags") {
let t = await ao(e, n, u);
if (t) return t;
let r = await io(e, ["dist-tags"], n, u);
if (!r["dist-tags"]?.[n]) return r;
}
d = await io(e, Array.from(/* @__PURE__ */ new Set([
"dist-tags",
...t,
...!r.deprecated || r.enginesNode ? ["versions"] : []
])), l ? null : n, u);
} catch (t) {
if (r.retry && ++i <= r.retry) return vo(e, c, n, r, i, a, o);
throw t;
}
return d;
}
lo.fetchUpgradedPackumentMemo = (0, da.default)(vo, { serializer: (([e, t, n, r, i, a, o]) => {
let { packageFile: s, ...c } = r;
return JSON.stringify([
e,
t,
ro(n),
c,
i,
a,
o
]);
}) });
async function yo(e, t = {}, n = {}, r = {}) {
return Ai("npm", [
...t.global ? ["--global"] : [],
...t.prefix ? [`--prefix=${t.prefix}`] : [],
"--json",
...Array.isArray(e) ? e : [e]
], n, r);
}
async function bo(e) {
if (e.prefix) return e.prefix;
let t;
try {
let { stdout: e } = await Ai("npm", [
"config",
"get",
"prefix"
]);
t = e;
} catch (t) {
Y(e, "Error executing `npm config get prefix`. Caught and ignored. Unsolved: https://github.com/raineorshine/npm-check-updates/issues/703. ERROR: " + (t instanceof Error ? t.message : String(t)), "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 xo = async (e, t, n, r, i) => {
let a = ["versions"];
n.cooldown && a.push("time");
let o = await lo.fetchUpgradedPackumentMemo(e, a, t, n, 0, r, i);
return {
packument: o,
packageInfo: {
packageName: e,
currentVersion: t,
options: n,
versions: Object.values(o?.versions ?? {}),
time: o?.time
}
};
}, So = async (e, t, n = {}, r, i, a) => {
let { packument: o, packageInfo: s } = await xo(e, t, n, r, i), c = oo(s);
if (a) {
let e = c.targetBlockedByCooldown ? c.fallbackVersion : c.targetVersion;
return {
version: e,
...e && o?.time?.[e] ? { time: o.time[e] } : null
};
}
return so({
...s,
...c
});
}, Co = async (e, t, n = {}, r) => {
let i = go({
npmConfigUser: { ...lo.findNpmConfig() },
npmConfigLocal: r
}, n);
if (K.default.valid(t)) return (await io(e, ["peerDependencies"], null, i, t)).peerDependencies || {};
let a = await io(e, ["versions"], null, i), o = K.default.maxSatisfying(Object.keys(a.versions ?? {}), t);
return o && a.versions?.[o]?.peerDependencies || {};
}, wo = async (e, t = {}, n, r) => (await lo.fetchUpgradedPackumentMemo(e, ["dist-tags"], "", {
...t,
distTag: void 0
}, 0, n, r))?.["dist-tags"] || {}, To = async (e, t, n = {}, r, i) => (await io(e, ["engines"], null, go({
npmConfigUser: { ...lo.findNpmConfig() },
npmConfigLocal: r,
npmConfigWorkspaceProject: i
}, n), t)).engines || {}, Eo = async (e = {}) => {
let { stdout: t, stderr: n, command: r } = await yo(["ls", "--depth=0"], {
...e.global ? { global: !0 } : null,
...e.prefix ? { prefix: e.prefix } : null
}, { rejectOnError: !1 }, { ...e.cwd ? { cwd: e.cwd } : null }), i = mo(t, {
command: r,
stderr: n
}).dependencies;
return q(i, (e, t) => ({ [e]: t.version || t.required?.version }));
}, Do = async (e, t, n = {}, r, i) => {
let a = ["dist-tags"];
n.cooldown && a.push("time");
let o = await lo.fetchUpgradedPackumentMemo(e, a, t, n, 0, r, i), s = o?.["dist-tags"]?.[n.distTag || "latest"];
if (!no(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 = K.default.validRange(t) && K.default.minVersion(t)?.version || "0.0.0", m = l.version === p || qa(e, l.version, d, n.cooldown);
return m && !u && Ja(n)(l) ? {
version: l.version,
...f
} : n.cooldown && !m ? (Y(n, `Skipping ${e}@${s} due to cooldown${d ? ` (published ${xr(d)})` : ""}.`, "verbose"), { cooldownInfo: {
name: e,
currentVersion: t,
currentVersionTime: o?.time?.[p],
version: l.version,
...f
} }) : n.distTag && n.distTag !== "latest" ? {} : So(e, t, n, r, i, "distTag");
}, Oo = async (e, t, n = {}, r, i) => {
let a = await Do(e, t, {
...n,
distTag: "latest"
}, r, i);
if (a.cooldownInfo) {
let o = await So(e, t, n, r, i, "latest");
if (o.version) return a.cooldownInfo.fallbackVersion = o.version, {
...o,
...a
};
}
return a;
}, ko = async (e, t, n = {}, r, i) => {
let a = await lo.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
} : oo({
...l,
compare: (e, t) => {
let n = a?.time?.[e] || "", r = a?.time?.[t] || "";
return n > r ? 1 : n < r ? -1 : 0;
}
});
return so({
...l,
...u
});
}, Ao = async (e, t, n = {}, r, i) => {
let { packageInfo: a } = await xo(e, t, n, r, i), o = oo({
...a,
filter: er(t, "minor")
});
return so({
...a,
...o
});
}, jo = async (e, t, n = {}, r, i) => {
let { packageInfo: a } = await xo(e, t, n, r, i), o = oo({
...a,
filter: er(t, "patch")
});
return so({
...a,
...o
});
}, Mo = async (e, t, n = {}, r, i) => {
if (eo(t) && !to(t)) return { version: null };
let { packageInfo: a } = await xo(e, t, n, r, i), o = oo({
...a,
filter: tr(t)
});
return so({
...a,
...o
});
}, No = async () => {
let e = lo.findNpmConfig(), t = e?.minReleaseAge;
if (t == null) return null;
let n = typeof t == "string" ? pn(t) ?? parseInt(t, 10) : typeof t == "number" ? t : null;
if (n == null || isNaN(n)) return null;
let r = e?.minReleaseAgeExclude;
return {
days: n,
exclude: [...new Set((Array.isArray(r) ? r : typeof r == "string" ? [r] : []).flatMap((e) => e.split(",")).map((e) => e.trim()).filter((e) => e))],
source: "min-release-age from .npmrc",
excludeLabel: "excluded pattern",
createMatcher: (e) => {
let t = (0, za.default)(e, {
nonegate: !0,
noext: !0
});
return (n) => n === e || t(n);
}
};
}, Po = /* @__PURE__ */ r({
default: () => Fo,
defaultPrefix: () => Io,
distTag: () => Do,
getDistTags: () => wo,
getEngines: () => Vo,
getPeerDependencies: () => Bo,
greatest: () => So,
latest: () => Oo,
list: () => Lo,
minor: () => Ao,
newest: () => ko,
packageAuthorChanged: () => zo,
patch: () => jo,
semver: () => Mo,
spawn: () => Fo,
usesAddCommand: () => !0
});
async function Fo(e, t = {}, n = {}, r = {}) {
return Ai("bun", [
...t.global ? ["--global"] : [],
...t.prefix ? [`--prefix=${t.prefix}`] : [],
...Array.isArray(e) ? e : [e]
], n, r);
}
var Io = async (e) => e.global ? e.prefix || process.env.BUN_INSTALL || o.dirname((await (0, Ee.default)("bun", [
"pm",
"-g",
"bin"
])).stdout) : void 0, Lo = async (e = {}) => {
let { stdout: t } = await Fo(["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 q(f(t).split("\n"), (e) => {
let t = e.match(/.* (.+?)@(.+)/);
if (t) {
let [, e, n] = t;
return { [e]: n };
}
return null;
});
};
async function Ro(e, t, n = {}, { rejectOnError: r = !1 } = {}) {
let { stdout: i } = await Fo([
"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 zo = async (e, t, n, r = {}) => {
let i = await Ro(e, "versions", r);
if (!Array.isArray(i)) return !1;
let a = K.default.minSatisfying(i, t), o = K.default.maxSatisfying(i, n);
if (!a || !o) return !1;
let [s, c] = await Promise.all([Ro(`${e}@${a}`, void 0, r), Ro(`${e}@${o}`, void 0, r)]), l = s?._npmUser?.name, u = c?._npmUser?.name;
return !l || !u ? !1 : l !== u;
}, Bo = async (e, t, n = {}) => {
let r = await Ro(`${e}@${t}`, void 0, { cwd: n.cwd });
if (!r) throw Error(`Could not read the manifest of ${e}@${t} from bun`);
return r.peerDependencies || {};
}, Vo = async (e, t, n = {}) => (await Ro(`${e}@${t}`, void 0, n, { rejectOnError: !0 }))?.engines || {}, Ho = /* @__PURE__ */ r({
greatest: () => qo,
greatestLevel: () => Jo,
latest: () => Ko,
minor: () => Yo,
newest: () => Qo,
patch: () => Xo,
semver: () => Zo
}), Uo = d(g.execFile);
async function Wo(e) {
let t = (await Uo("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 Go(e, t, n) {
t = t.replace(/^github:/, "");
let { auth: r, protocol: i, host: a, path: o } = (0, Tn.default)(t), s;
try {
if (i !== null) s = await Wo(`${i ? i.replace("git+", "") : "https:"}//${r ? r + "@" : ""}${a}/${o?.replace(/^:/, "")}`);
else try {
s = await Wo(`ssh://git@${a}/${o?.replace(/^:/, "")}`);
} catch {
s = await Wo(`https://${r ? r + "@" : ""}${a}/${o}`);
}
} catch {
Y(n ?? {}, `Invalid, private repo, or no tags for ${e}: ${t}`, "verbose");
return;
}
return Object.keys(s).map(cr).filter((e) => K.default.valid(e)).sort(Zn);
}
var Ko = async (e, t, n) => {
let r = await Go(e, t, n);
if (!r) return { version: null };
let i = n?.pre ? r : r.filter((e) => !nr(e)), a = i[i.length - 1];
return { version: a ? vr(t, a) : null };
}, qo = async (e, t, n) => {
let r = await Go(e, t, n);
if (!r) return { version: null };
let i = r[r.length - 1];
return { version: i ? vr(t, i) : null };
}, Jo = (e) => async (t, n, r = {}) => {
let i = decodeURIComponent((0, Tn.default)(n).branch).replace(/^semver:/, ""), a = await Go(t, n, r);
if (!a) return { version: null };
let o = $n(a.map((e) => e.replace(/^v/, "")), i, e);
return { version: o ? vr(n, o) : null };
}, Yo = Jo("minor"), Xo = Jo("patch"), Zo = async (e, t, n) => ({ version: null }), Qo = qo, 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;
})), $o = /* @__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;
})), es = /* @__PURE__ */ i(((e) => {
var t = Q(), n = $o(), 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;
})), ts = /* @__PURE__ */ i(((e) => {
var t = Q(), n = $o();
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;
})), ns = /* @__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;
})), rs = /* @__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;
})), is = /* @__PURE__ */ i(((e) => {
var t = ns(), n = Q(), r = rs();
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;
}
};
})), as = /* @__PURE__ */ i(((e) => {
var t = ts(), n = $o(), r = Q(), i = is(), a = rs(), 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;
})), os = /* @__PURE__ */ i(((e) => {
var t = Q(), n = is(), r = rs(), 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;
})), ss = /* @__PURE__ */ i(((e) => {
var t = as(), n = Q(), r = os(), 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;
})), cs = /* @__PURE__ */ i(((e) => {
var t = ss(), n = Q(), r = is();
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;
})), ls = /* @__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;
})), us = /* @__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;
})), ds = /* @__PURE__ */ i(((e) => {
var t = os(), n = us(), 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;
})), fs = /* @__PURE__ */ i(((e) => {
var t = ts(), n = Q(), r = ls(), i = ds();
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;
})), ps = /* @__PURE__ */ i(((e) => {
var t = Q(), n = os(), r = fs(), i = ls();
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;
})), ms = /* @__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;
})), hs = /* @__PURE__ */ i(((e) => {
var t = Q(), n = os(), 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;
})), gs = /* @__PURE__ */ i(((e) => {
var t = ms(), n = hs(), r = fs(), i = Q(), a = rs();
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;
})), _s = /* @__PURE__ */ i(((e) => {
var t = ss(), n = ps(), r = gs(), 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;
})), vs = /* @__PURE__ */ i(((e) => {
var t = Q(), n = fs(), r = ls();
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;
})), ys = /* @__PURE__ */ i(((e) => {
var t = vs(), n = gs(), r = cs(), i = Q(), a = _s(), o = os();
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;
})), bs = /* @__PURE__ */ i(((e) => {
var t = Q(), n = ys();
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)
};
})), xs = /* @__PURE__ */ i(((e) => {
var t = ss(), n = vs(), r = cs(), i = Q(), a = os(), o = rs(), 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;
})), Ss = /* @__PURE__ */ i(((e) => {
var t = Q(), n = xs();
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)
};
})), Cs = /* @__PURE__ */ i(((e) => {
var t = ds();
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);
}
};
})), ws = /* @__PURE__ */ i(((e) => {
var t = os(), 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;
})), Ts = /* @__PURE__ */ i(((e) => {
var t = os(), 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;
})), Es = /* @__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;
})), Ds = /* @__PURE__ */ i(((e) => {
var t = os(), n = Es(), 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;
})), Os = /* @__PURE__ */ i(((e) => {
var t = Es(), 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")
};
})), ks = /* @__PURE__ */ i(((e) => {
var t = bs(), n = ws(), r = Ss(), i = Cs(), a = Ts(), o = Ds(), s = Os();
e.schema = [
t.map,
r.seq,
i.string,
n.nullTag,
a.boolTag,
s.intOct,
s.int,
s.intHex,
o.floatNaN,
o.floatExp,
o.float
];
})), As = /* @__PURE__ */ i(((e) => {
var t = os(), n = bs(), r = Ss();
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;
}
});
})), js = /* @__PURE__ */ i(((t) => {
var n = e("buffer"), r = os(), i = ds();
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);
}
};
})), Ms = /* @__PURE__ */ i(((e) => {
var t = Q(), n = _s(), r = os(), i = xs();
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;
})), Ns = /* @__PURE__ */ i(((e) => {
var t = Q(), n = rs(), r = ys(), i = xs(), a = Ms(), 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;
})), Ps = /* @__PURE__ */ i(((e) => {
var t = os();
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;
})), Fs = /* @__PURE__ */ i(((e) => {
var t = os(), n = Es(), 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;
})), Is = /* @__PURE__ */ i(((e) => {
var t = Es(), 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;
})), Ls = /* @__PURE__ */ i(((e) => {
var t = Q(), n = _s(), r = ys(), 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;
})), Rs = /* @__PURE__ */ i(((e) => {
var t = Es();
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;
})), zs = /* @__PURE__ */ i(((e) => {
var t = bs(), n = ws(), r = Ss(), i = Cs(), a = js(), o = Ps(), s = Fs(), c = Is(), l = hs(), u = Ns(), d = Ms(), f = Ls(), p = Rs();
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
];
})), Bs = /* @__PURE__ */ i(((e) => {
var t = bs(), n = ws(), r = Ss(), i = Cs(), a = Ts(), o = Ds(), s = Os(), c = ks(), l = As(), u = js(), d = hs(), f = Ns(), p = Ms(), m = zs(), h = Ls(), g = Rs(), _ = /* @__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;
})), Vs = /* @__PURE__ */ i(((e) => {
var t = Q(), n = bs(), r = Ss(), i = Cs(), a = Bs(), 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;
}
};
})), Hs = /* @__PURE__ */ i(((e) => {
var t = Q(), n = fs(), r = ls();
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;
})), Us = /* @__PURE__ */ i(((e) => {
var t = as(), n = cs(), r = Q(), i = _s(), a = rs(), o = Vs(), s = Hs(), c = ts(), l = ns(), u = ss(), d = es(), 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;
})), Ws = /* @__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`;
}
};
})), Gs = /* @__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;
})), Ks = /* @__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;
})), qs = /* @__PURE__ */ i(((e) => {
var t = Ks();
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;
})), Js = /* @__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;
})), Ys = /* @__PURE__ */ i(((e) => {
var t = _s(), n = ys(), r = Gs(), i = Ks(), a = qs(), o = Js(), 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;
})), Xs = /* @__PURE__ */ i(((e) => {
var t = xs(), n = Gs(), r = qs();
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;
})), Zs = /* @__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;
})), Qs = /* @__PURE__ */ i(((e) => {
var t = Q(), n = _s(), r = ys(), i = xs(), a = Zs(), o = Gs(), s = Ks(), c = Js(), 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;
})), $s = /* @__PURE__ */ i(((e) => {
var t = Q(), n = os(), r = ys(), i = xs(), a = Ys(), o = Xs(), s = Qs();
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;
})), ec = /* @__PURE__ */ i(((e) => {
var t = os();
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;
})), tc = /* @__PURE__ */ i(((e) => {
var t = os(), n = Zs();
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;
})), nc = /* @__PURE__ */ i(((e) => {
var t = Q(), n = os(), r = ec(), i = tc();
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;
})), rc = /* @__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;
})), ic = /* @__PURE__ */ i(((e) => {
var t = as(), n = Q(), r = $s(), i = nc(), a = Zs(), o = rc(), 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;
})), ac = /* @__PURE__ */ i(((e) => {
var t = Us(), n = ic(), r = Zs(), i = Gs();
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;
})), oc = /* @__PURE__ */ i(((t) => {
var n = e("process"), r = es(), i = Us(), a = Ws(), o = Q(), s = ac(), c = Zs();
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;
}
}
};
})), sc = /* @__PURE__ */ i(((e) => {
var t = ec(), n = tc(), r = Ws(), i = ds();
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;
})), cc = /* @__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;
})), lc = /* @__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;
})), uc = /* @__PURE__ */ i(((e) => {
var t = sc(), n = cc(), r = lc(), 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;
})), dc = /* @__PURE__ */ i(((e) => {
var t = uc();
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);
}
};
})), fc = /* @__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
};
};
}
};
})), pc = /* @__PURE__ */ i(((t) => {
var n = e("process"), r = uc(), i = dc();
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());
}
}
};
})), mc = /* @__PURE__ */ i(((e) => {
var t = oc(), n = Us(), r = Ws(), i = ms(), a = Q(), o = fc(), s = pc();
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;
})), hc = /* @__PURE__ */ i(((e) => {
var t = oc(), n = Us(), r = Vs(), i = Ws(), a = as(), o = Q(), s = _s(), c = os(), l = ys(), u = xs(), d = uc(), f = dc(), p = fc(), m = pc(), h = mc(), g = $o();
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;
})), gc = /* @__PURE__ */ r({
default: () => Lc,
defaultPrefix: () => bo,
distTag: () => zc,
getCooldown: () => Xc,
getDistTags: () => Kc,
getEngines: () => qc,
getPeerDependencies: () => Co,
greatest: () => Bc,
latest: () => Vc,
list: () => jc,
minor: () => Hc,
newest: () => Uc,
packageAuthorChanged: () => Jc,
patch: () => Wc,
pnpmApi: () => Yc,
semver: () => Gc,
spawn: () => Lc,
usesAddCommand: () => !0
}), _c = hc(), vc = (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;
}, yc = (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 [];
}, bc = (e) => ({
minimumReleaseAge: vc(e.minimumReleaseAge ?? e["minimum-release-age"]),
minimumReleaseAgeExclude: yc(e.minimumReleaseAgeExclude ?? e["minimum-release-age-exclude"])
}), xc = () => {
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");
}, Sc = (0, da.default)(async (e, t) => {
let n;
try {
n = await s.readFile(e, "utf-8");
} catch {
return null;
}
try {
return (t === "yaml" ? (0, _c.parse)(n) : Ra.default.parse(n)) ?? {};
} catch {
return null;
}
}), Cc = async (e, t) => {
let n = await Sc(e, t);
return n ? bc(n) : null;
}, wc = async () => {
try {
let { stdout: e } = await Ai("pnpm", ["--version"]), t = Number.parseInt(e.trim(), 10);
return Number.isNaN(t) ? null : t;
} catch {
return null;
}
}, Tc = async (e = {}) => {
let { pnpmMajorVersion: t, cwd: n } = e, r = xc(), i = await ka("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([Qt(a), Qt(s)]);
c = e && t ? await wc() : e ? 11 : 10;
}
let l = await Promise.all([c == null || c >= 11 ? Cc(a, "yaml") : null, c == null || c <= 10 ? Cc(s, "ini") : null]), u = [i ? await Cc(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 ?? []))]
};
}, Ec = /\$\{[^}]*\}/, Dc = (e, t) => {
let n = e?.registries, r = typeof n == "object" && n && !Array.isArray(n) ? n : {};
return q({
default: e?.registry,
...r
}, (e, n) => {
if (typeof n != "string") return null;
let r = t ? Ua(n, process.env) : n;
return r.trim() === "" || Ec.test(r) ? null : { [e]: r };
});
}, Oc = async (e) => {
let [t, n] = await Promise.all([e ? Sc(e, "yaml") : null, Sc(o.join(xc(), "config.yaml"), "yaml")]), { default: r, ...i } = {
...Dc(n, !0),
...Dc(t, !1)
};
return {
default: r,
scoped: i
};
}, kc = async (e = {}) => Oc(await ka("pnpm-workspace.yaml", { cwd: e.cwd })), Ac = (e, t, n) => q(mo(e, {
command: t,
stderr: n
})[0]?.dependencies || {}, (e, { version: t }) => ({ [e]: t })), jc = async (e = {}) => {
if (!e.global) return Eo(e);
let { stdout: t, stderr: n, command: r } = await Ai("pnpm", [
"ls",
"-g",
"--json"
]);
return Ac(t, r, n);
}, Mc = (0, da.default)(async (e) => {
let t = o.join(e, ".npmrc"), n = await s.readFile(t, "utf-8").catch(() => null);
return n == null ? null : co(Ra.default.parse(n), e);
}), Nc = async (e, t) => {
let n = await Mc(t);
return n == null ? {} : (Y(e, `\nUsing pnpm workspace config at ${o.join(t, ".npmrc")}:`, "verbose"), n);
}, Pc = (0, da.default)(async (e) => {
let t = await ka("pnpm-workspace.yaml", { cwd: e.cwd }), n = t ? o.dirname(t) : void 0, [r, { default: i, scoped: a }] = await Promise.all([n ? Nc(e, n) : {}, Oc(t)]), s = {
...q(a, (e, t) => ({ [`${e}:registry`]: t })),
...i ? { registry: i } : null
};
return Object.keys(s).length > 0 && (Y(e, "\npnpm registries in npm format:", "verbose"), Y(e, s, "verbose")), {
registries: s,
workspaceNpmrc: r
};
}), Fc = (e) => async (t, n, r = {}) => {
let { registries: i, workspaceNpmrc: a } = await Pc(r);
return e(t, n, r, i, a);
}, Ic = (e, t) => [
...t.global ? ["global"] : [],
...Array.isArray(e) ? e : [e],
...t.prefix ? [`--prefix=${t.prefix}`] : []
];
async function Lc(e, t = {}, n, r) {
return Ai("pnpm", Ic(e, t), n, r);
}
var Rc = (e) => async (...t) => {
let n = t.slice(0, e.length), r = t[e.length] ?? {}, { registries: i, workspaceNpmrc: a } = await Pc(r);
return e(...n, r, i, a);
}, zc = Fc(Do), Bc = Fc(So), Vc = Fc(Oo), Hc = Fc(Ao), Uc = Fc(ko), Wc = Fc(jo), Gc = Fc(Mo), Kc = Rc(wo), qc = Rc(To), Jc = Rc(_o), Yc = {
buildArgs: Ic,
getPnpmWorkspaceMinimumReleaseAge: Tc,
getPnpmWorkspaceRegistries: kc,
parseList: Ac
}, Xc = async (e) => {
let t = await Tc({ cwd: e.cwd });
return t == null ? null : {
days: t.minimumReleaseAge / 1440,
exclude: t.minimumReleaseAgeExclude,
source: "minimumReleaseAge from pnpm-workspace.yaml",
excludeLabel: "excluded pattern"
};
};
//#endregion
//#region src/lib/programError.ts
function $(e, t, { color: n = !0 } = {}) {
let r = xr(String(t));
if (e.cli) Y(e, n ? J.red(r) : r, null, "error"), process.exit(1);
else throw Error(r);
}
//#endregion
//#region src/package-managers/staticRegistry.ts
var Zc = /* @__PURE__ */ r({ latest: () => el }), Qc = (e) => e && e.startsWith("http://") || e.startsWith("https://"), $c = (0, da.default)(async (e) => {
let t = e.registry, n;
if (Qc(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);
}), el = async (e, t, n) => ({ version: (await $c(n || {}))[e] || null }), tl = /* @__PURE__ */ r({
default: () => ll,
defaultPrefix: () => ul,
distTag: () => pl,
getCooldown: () => El,
getDistTags: () => Sl,
getEngines: () => Cl,
getPathToLookForYarnrc: () => il,
getPeerDependencies: () => xl,
greatest: () => ml,
latest: () => hl,
list: () => dl,
minor: () => gl,
newest: () => _l,
npmAuthTokenKeyValue: () => nl,
packageAuthorChanged: () => wl,
patch: () => vl,
semver: () => yl,
spawn: () => ll,
usesAddCommand: () => !0,
yarnApi: () => Tl
}), nl = (e) => (t, n) => {
if (n.npmAuthToken) {
let r = n.npmRegistryServer ? Ua(n.npmRegistryServer, process.env) : e[`@${t}:registry`];
if (r) {
let e = r.replace(/^https?:/, "");
return e.endsWith("/") && (e = e.slice(0, -1)), { [`${e}/:_authToken`]: Ua(n.npmAuthToken, process.env) };
}
}
return null;
}, rl = (e, t) => t.npmRegistryServer ? { [`@${e}:registry`]: Ua(t.npmRegistryServer, process.env) } : null;
async function il(e, t = s.readdir) {
if (e.global) return;
let n = (await Ti(e, t))?.directoryPath;
if (n) return o.join(n, ".yarnrc.yml");
}
var al = (0, da.default)(async (e) => {
let t = await il(e), n = o.join(c.homedir(), ".yarnrc.yml"), r = typeof t == "string" && await Qt(t), i = await Qt(n), a = r ? await s.readFile(t, "utf-8") : "", l = i ? await s.readFile(n, "utf-8") : "", u = (0, _c.parse)(a), d = (0, _c.parse)(l), f = {
...q(d?.npmScopes || {}, rl),
...q(u?.npmScopes || {}, rl)
};
return f = {
...f,
...q(d?.npmScopes || {}, nl(f)),
...q(u?.npmScopes || {}, nl(f))
}, r && (Y(e, `\nUsing local yarn config at ${t}:`, "verbose"), Y(e, u, "verbose")), i && (Y(e, `\nUsing user yarn config at ${n}:`, "verbose"), Y(e, d, "verbose")), Object.keys(f).length > 0 && (Y(e, "\nMerged yarn config in npm format:", "verbose"), Y(e, f, "verbose")), f;
}), ol = (0, da.default)(async (e) => {
let t = await il(e), n = o.join(c.homedir(), ".yarnrc.yml");
for (let e of [t, n]) {
if (!e || !await Qt(e)) continue;
let t;
try {
t = await s.readFile(e, "utf-8");
} catch {
continue;
}
let n;
try {
n = (0, _c.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 = pn(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 sl(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 cl(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 ll(e, t = {}, n = {}, r = {}) {
return Ai("yarn", [
...t.global ? ["global"] : [],
...t.prefix ? [`--prefix=${t.prefix}`] : [],
"--depth=0",
"--json",
"--no-progress",
...Array.isArray(e) ? e : [e]
], n, r);
}
async function ul(e) {
if (e.prefix) return e.prefix;
let t;
try {
t = (await Ai("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 dl = async (e = {}, t) => {
let { stdout: n } = await ll("list", e, {}, {
...e.cwd ? { cwd: e.cwd } : {},
...t
});
return q(sl(n).dependencies, (e, t) => ({ [e]: t.version || t.required?.version }));
}, fl = (e) => async (t, n, r = {}) => e(t, n, r, await al(r)), pl = fl(Do), ml = fl(So), hl = fl(Oo), gl = fl(Ao), _l = fl(ko), vl = fl(jo), yl = fl(Mo), bl = (0, da.default)(async (e) => {
let { stdout: t } = await Ai("yarn", ["--version"], { rejectOnError: !1 }, e);
return t;
}), xl = async (e, t, n = {}, r) => {
let i = {
cwd: n.cwd,
...r
};
if ((await bl(i)).startsWith("1")) {
let n = [
"--json",
"info",
`${e}@${t}`,
"peerDependencies"
], { stdout: r } = await Ai("yarn", n, { rejectOnError: !1 }, i);
if (!r) throw Error(`No response from "yarn ${n.join(" ")}"`);
return mo(r, { command: n.join(" ") }).data || {};
}
{
let n = [
"--json",
"npm",
"info",
`${e}@${t}`,
"--fields",
"peerDependencies"
], { stdout: r } = await Ai("yarn", n, { rejectOnError: !1 }, i);
if (!r) return {};
try {
return mo(r, { command: n.join(" ") }).peerDependencies || {};
} catch (e) {
let t;
try {
t = mo(cl(r), { command: n.join(" ") });
} catch {}
if (!t) throw e;
if (t.type === "error") throw Error(`yarn ${n.join(" ")}: ${t.data ?? "lookup failed"}`, { cause: e });
return t.peerDependencies || {};
}
}
}, Sl = async (e, t = {}) => wo(e, t, await al(t)), Cl = async (e, t, n = {}) => To(e, t, n, await al(n)), wl = async (e, t, n, r = {}) => _o(e, t, n, r, await al(r)), Tl = {
getYarnMinimalAgeGate: ol,
parseJsonLines: sl,
extractFirstJsonLine: cl
}, El = async (e) => {
let t = await ol(e);
return t == null ? null : {
days: t.npmMinimalAgeGate / 1440,
exclude: t.npmPreapprovedPackages,
source: "npmMinimalAgeGate from .yarnrc.yml",
excludeLabel: "pre-approved package"
};
}, Dl = {
npm: Ya,
pnpm: gc,
yarn: tl,
bun: Po,
gitTags: Ho,
staticRegistry: Zc
}, Ol = 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
};
}, kl, Al = {
lang: void 0,
message: void 0,
abortEarly: void 0,
abortPipeEarly: void 0
};
/* @__NO_SIDE_EFFECTS__ */
function jl(e) {
return !e && !kl ? Al : {
lang: e?.lang ?? kl?.lang,
message: e?.message,
abortEarly: e?.abortEarly ?? kl?.abortEarly,
abortPipeEarly: e?.abortPipeEarly ?? kl?.abortPipeEarly
};
}
var Ml;
/* @__NO_SIDE_EFFECTS__ */
function Nl(e) {
return Ml?.get(e);
}
var Pl;
/* @__NO_SIDE_EFFECTS__ */
function Fl(e) {
return Pl?.get(e);
}
var Il;
/* @__NO_SIDE_EFFECTS__ */
function Ll(e, t) {
return Il?.get(e)?.get(t);
}
/* @__NO_SIDE_EFFECTS__ */
function Rl(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 zl(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__ */ Rl(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__ */ Ll(e.reference, c.lang) ?? (l ? /* @__PURE__ */ Fl(c.lang) : null) ?? r.message ?? /* @__PURE__ */ Nl(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 Bl = /* @__PURE__ */ new WeakMap();
/* @__NO_SIDE_EFFECTS__ */
function Vl(e) {
let t = Bl.get(e);
return t || (t = {
version: 1,
vendor: "valibot",
validate(t) {
return e["~run"]({ value: t }, /* @__PURE__ */ jl());
}
}, Bl.set(e, t)), t;
}
/* @__NO_SIDE_EFFECTS__ */
function Hl(e, t) {
return Object.prototype.hasOwnProperty.call(e, t) && t !== "__proto__" && t !== "prototype" && t !== "constructor";
}
/* @__NO_SIDE_EFFECTS__ */
function Ul(e, t) {
let n = [...new Set(e)];
return n.length > 1 ? `(${n.join(` ${t} `)})` : n[0] ?? "never";
}
var Wl = class extends Error {
constructor(e) {
super(e[0].message), this.name = "ValiError", this.issues = e;
}
};
/* @__NO_SIDE_EFFECTS__ */
function Gl(e, t, n) {
return typeof e.fallback == "function" ? e.fallback(t, n) : e.fallback;
}
/* @__NO_SIDE_EFFECTS__ */
function Kl(e, t) {
return {
...e,
fallback: t,
get "~standard"() {
return /* @__PURE__ */ Vl(this);
},
"~run"(t, n) {
let r = e["~run"](t, n);
return r.issues ? {
typed: !0,
value: /* @__PURE__ */ Gl(this, r, n)
} : r;
}
};
}
/* @__NO_SIDE_EFFECTS__ */
function ql(e, t, n) {
return typeof e.default == "function" ? e.default(t, n) : e.default;
}
/* @__NO_SIDE_EFFECTS__ */
function Jl(e, t) {
return {
kind: "schema",
type: "array",
reference: Jl,
expects: "Array",
async: !1,
item: e,
message: t,
get "~standard"() {
return /* @__PURE__ */ Vl(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 zl(this, "type", e, t);
return e;
}
};
}
/* @__NO_SIDE_EFFECTS__ */
function Yl(e, t) {
return {
kind: "schema",
type: "loose_object",
reference: Yl,
expects: "Object",
async: !1,
entries: e,
message: t,
get "~standard"() {
return /* @__PURE__ */ Vl(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__ */ ql(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__ */ Gl(i);
else if (i.type !== "exact_optional" && i.type !== "optional" && i.type !== "nullish" && (zl(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__ */ Hl(n, t) && !(t in this.entries) && (e.value[t] = n[t]);
} else zl(this, "type", e, t);
return e;
}
};
}
/* @__NO_SIDE_EFFECTS__ */
function Xl(e, t) {
return {
kind: "schema",
type: "object",
reference: Xl,
expects: "Object",
async: !1,
entries: e,
message: t,
get "~standard"() {
return /* @__PURE__ */ Vl(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__ */ ql(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__ */ Gl(i);
else if (i.type !== "exact_optional" && i.type !== "optional" && i.type !== "nullish" && (zl(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 zl(this, "type", e, t);
return e;
}
};
}
/* @__NO_SIDE_EFFECTS__ */
function Zl(e, t) {
return {
kind: "schema",
type: "optional",
reference: Zl,
expects: `(${e.expects} | undefined)`,
async: !1,
wrapped: e,
default: t,
get "~standard"() {
return /* @__PURE__ */ Vl(this);
},
"~run"(e, t) {
return e.value === void 0 && (this.default !== void 0 && (e.value = /* @__PURE__ */ ql(this, e, t)), e.value === void 0) ? (e.typed = !0, e) : this.wrapped["~run"](e, t);
}
};
}
/* @__NO_SIDE_EFFECTS__ */
function Ql(e, t, n) {
return {
kind: "schema",
type: "record",
reference: Ql,
expects: "Object",
async: !1,
key: e,
value: t,
message: n,
get "~standard"() {
return /* @__PURE__ */ Vl(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__ */ Hl(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 zl(this, "type", e, t);
return e;
}
};
}
/* @__NO_SIDE_EFFECTS__ */
function $l(e) {
return {
kind: "schema",
type: "string",
reference: $l,
expects: "string",
async: !1,
message: e,
get "~standard"() {
return /* @__PURE__ */ Vl(this);
},
"~run"(e, t) {
return typeof e.value == "string" ? e.typed = !0 : zl(this, "type", e, t), e;
}
};
}
/* @__NO_SIDE_EFFECTS__ */
function eu(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 tu(e, t) {
return {
kind: "schema",
type: "union",
reference: tu,
expects: /* @__PURE__ */ Ul(e.map((e) => e.expects), "|"),
async: !1,
options: e,
message: t,
get "~standard"() {
return /* @__PURE__ */ Vl(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];
zl(this, "type", e, t, { issues: /* @__PURE__ */ eu(r) }), e.typed = !0;
} else if (i?.length === 1) return i[0];
else zl(this, "type", e, t, { issues: /* @__PURE__ */ eu(i) });
return e;
}
};
}
function nu(e, t, n) {
let r = e["~run"]({ value: t }, /* @__PURE__ */ jl(n));
if (r.issues) throw new Wl(r.issues);
return r.value;
}
//#endregion
//#region src/types/CatalogConfig.ts
var ru = {
catalog: /* @__PURE__ */ Zl(/* @__PURE__ */ Ql(/* @__PURE__ */ $l(), /* @__PURE__ */ $l())),
catalogs: /* @__PURE__ */ Kl(/* @__PURE__ */ Zl(/* @__PURE__ */ Ql(/* @__PURE__ */ $l(), /* @__PURE__ */ Ql(/* @__PURE__ */ $l(), /* @__PURE__ */ $l()))), void 0)
}, iu = /* @__PURE__ */ Xl({
...ru,
workspaces: /* @__PURE__ */ Kl(/* @__PURE__ */ Zl(/* @__PURE__ */ tu([/* @__PURE__ */ Jl(/* @__PURE__ */ $l()), /* @__PURE__ */ Yl(ru)])), void 0)
}), au = (e) => nu(iu, e), ou = {
pnpm: "pnpm-workspace.yaml",
yarn: ".yarnrc.yml"
}, su = (e) => e && ou[e] || null, cu = (e) => Object.values(ou).includes(o.basename(e));
//#endregion
//#region src/lib/getDevEnginesPackageManagers.ts
function lu(e) {
let t = e.devEngines?.packageManager;
if (!t) return [];
let n = Array.isArray(t) ? t : [t], r = [];
for (let [e, i] of n.entries()) !i?.name || typeof i.version != "string" || r.push({
entry: i,
path: Array.isArray(t) ? [
"devEngines",
"packageManager",
e
] : ["devEngines", "packageManager"]
});
return r;
}
//#endregion
//#region src/lib/pick.ts
function uu(e, t) {
let n = {};
for (let r of t) n[r] = e[r];
return n;
}
function du(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 fu = {
dev: "devDependencies",
peer: "peerDependencies",
prod: "dependencies",
optional: "optionalDependencies"
}, pu = (e) => (e ? typeof e == "string" ? e.split(",") : e : vi.dep.default).map((e) => fu[e] || e);
//#endregion
//#region src/lib/getPreferredWildcard.ts
function mu(e) {
if (Object.keys(e).length === 0) return null;
let t = Object.values(e).reduce((e, t) => {
let n = Mn.find((e) => t && t.includes(e));
return n !== void 0 && (e[n] ||= [], e[n].push(t)), e;
}, {}), n = Dn(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 hu(e, t, { downgrade: n } = {}) {
if (!K.default.validRange(e) || Bn(e)) return !1;
let [r] = Oe.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 = In(r), o = !!K.default.validRange(a), s = !!K.default.valid(i);
return o && s && (!Xn(i, a) || !K.default.satisfies(i, r.operator === "<" ? e : a) && (n || !K.default.ltr(i, a)));
}
//#endregion
//#region src/lib/upgradeDependencies.ts
function gu(e, t, n = {}) {
let r = n.target || "latest";
e = qt(e, (e, t) => !!t);
let i = mu(e) || "^", a = (e, t) => gr(e, t, {
wildcard: i,
removeRange: n.removeRange
});
return [
(e) => du(e, (e, n) => n in t),
(e) => Object.entries(e).reduce((e, [n, r]) => {
let i = t[n], a = null, o = null;
if (fr(r) && (a = dr(r)[1]), fr(i) && (o = dr(i)[1]), mr(r)) {
let e = hr(r), [t] = (0, Oe.parseRange)(e);
a = In(t);
}
if (mr(i)) {
let e = hr(i), [t] = (0, Oe.parseRange)(e);
o = In(t);
}
return e[n] = {
current: r,
currentParsed: a,
latest: i,
latestParsed: o
}, e;
}, {}),
(e) => du(e, ({ current: e, currentParsed: t, latest: n, latestParsed: i }, a) => {
let o = nr(e) && (typeof r == "string" ? r : r(a, (0, Oe.parseRange)(e))).startsWith("@");
return hu(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] = fr(n) ? pr(n, s) : mr(n) ? vr(n, s) : s, e;
}, {})
].reduce((e, t) => t(e), e);
}
//#endregion
//#region node_modules/jsonc-parser/lib/esm/impl/scanner.js
function _u(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 && bu(e.charCodeAt(r));) r++;
if (r < e.length && e.charCodeAt(r) === 46) {
if (r++, r < e.length && bu(e.charCodeAt(r))) for (r++; r < e.length && bu(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 && bu(e.charCodeAt(r))) {
for (r++; r < e.length && bu(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 (yu(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 (vu(t)) {
do
r++, i += String.fromCharCode(t), t = e.charCodeAt(r);
while (vu(t));
return o = 15;
}
if (yu(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 && !yu(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++, yu(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 || !bu(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 (vu(e) || yu(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 vu(e) {
return e === 32 || e === 9;
}
function yu(e) {
return e === 10 || e === 13;
}
function bu(e) {
return e >= 48 && e <= 57;
}
var xu;
(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";
})(xu ||= {}), Array(20).fill(0).map((e, t) => " ".repeat(t));
var Su = 200;
Array(Su).fill(0).map((e, t) => "\n" + " ".repeat(t)), Array(Su).fill(0).map((e, t) => "\r" + " ".repeat(t)), Array(Su).fill(0).map((e, t) => "\r\n" + " ".repeat(t)), Array(Su).fill(0).map((e, t) => "\n" + " ".repeat(t)), Array(Su).fill(0).map((e, t) => "\r" + " ".repeat(t)), Array(Su).fill(0).map((e, t) => "\r\n" + " ".repeat(t));
//#endregion
//#region node_modules/jsonc-parser/lib/esm/impl/parser.js
var Cu;
(function(e) {
e.DEFAULT = { allowTrailingComma: !1 };
})(Cu ||= {});
function wu(e, t = [], n = Cu.DEFAULT) {
let r = null, i = [], a = [];
function o(e) {
Array.isArray(i) ? i.push(e) : r !== null && (i[r] = e);
}
return Du(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 Tu(e, t = [], n = Cu.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;
}
Du(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: ku(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 Eu(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 Du(e, t, n = Cu.DEFAULT) {
let r = _u(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 Ou(e, t) {
let n = _u(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 ku(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 Au(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 ju;
(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";
})(ju ||= {});
var Mu;
(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";
})(Mu ||= {});
var Nu = wu, Pu = Tu, Fu = Eu, Iu = Ou, Lu;
(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";
})(Lu ||= {});
function Ru(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 zu(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 = Au(e, i);
else throw Error("Overlapping edit");
r = i.offset;
}
return e;
}
//#endregion
//#region src/lib/utils/applyJsonValueEdits.ts
function Bu(e, t) {
let n = Pu(e);
if (!n) return e;
let r = [];
for (let { path: e, value: i } of t) {
let t = Fu(n, e);
t && r.push({
offset: t.offset,
length: t.length,
content: JSON.stringify(i)
});
}
return zu(e, r);
}
//#endregion
//#region src/lib/utils/collectVersionEdits.ts
function Vu(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(...Vu(o, [...t, a], n, r));
return i;
}
//#endregion
//#region src/lib/utils/parseJson.ts
var Hu = process.stdout.columns || 80;
function Uu(e) {
return `${e.length ? e.slice(0, Math.min(e.length, Hu)) : "<empty>"}\n`;
}
function Wu(e) {
return e > Hu ? "" : `${" ".repeat(e - 1)}^\n`;
}
function Gu(e, t, n) {
let r = e.length;
if (r === 0) return "<empty>";
if (r === 1) return `${Uu(e[0])}${Wu(n)}`;
let i = Math.min(t + 2, r), a = "";
for (let r = Math.max(t - 2, 1); r <= i; r++) a += Uu(e[r - 1]), r === t && (a += Wu(n));
return `${a}\n`;
}
function Ku(e) {
e = Iu(e);
try {
return JSON.parse(e);
} catch {
let t = [], n = Nu(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}: ${Ru(e.error)}\n${Gu(i, n, a)}\n`;
}
throw SyntaxError(r);
}
}
//#endregion
//#region src/lib/upgradeJsonCatalogDependencies.ts
async function qu(e, t, n) {
let r = await s.readFile(e, "utf-8");
return Bu(r, Vu(Ku(r), [], t, n));
}
//#endregion
//#region src/lib/upgradeYamlCatalogDependencies.ts
function Ju(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 Yu(e) {
return e.length >= 2 && (e[0] === "catalog" || e[0] === "catalogs" || e[0] === "workspaces");
}
function Xu(e, t) {
let n = e.workspaces && !Array.isArray(e.workspaces) ? e.workspaces : void 0;
return t[0] === "catalog" ? e.catalog?.[t[1]] : t[0] === "catalogs" ? e.catalogs?.[t[1]]?.[t[2]] : t[0] === "workspaces" && t[1] === "catalog" ? n?.catalog?.[t[2]] : t[0] === "workspaces" && t[1] === "catalogs" ? n?.catalogs?.[t[2]]?.[t[3]] : void 0;
}
function Zu(e, { options: t, filePath: n }) {
let r, i;
try {
r = [...new _c.Parser().parse(e)], i = [...new _c.Composer({ keepSourceTokens: !0 }).compose(r)][0];
} catch (e) {
Ju(e, {
options: t,
filePath: n
});
}
return i || Ju(/* @__PURE__ */ Error("No YAML document found."), {
options: t,
filePath: n
}), i.errors.length > 0 && Ju(i.errors[0], {
options: t,
filePath: n
}), {
tokens: r,
document: i
};
}
function Qu(e, t, { newName: n, newValue: r }) {
let i = t.slice(0, -1), a = t.at(-1), o = e.getIn(i);
if (!o || !(0, _c.isCollection)(o)) return !1;
let s = o.items.find((e) => (0, _c.isPair)(e) && (0, _c.isScalar)(e.key) && e.key.value === a);
if (!s || !(0, _c.isPair)(s)) return !1;
if (n && _c.CST.setScalarValue(s.srcToken.key, n), r) {
if (!_c.CST.isScalar(s.srcToken?.value)) return !1;
_c.CST.setScalarValue(s.srcToken.value, r);
}
return !0;
}
function $u({ fileContent: e, upgrades: t, options: n, filePath: r }) {
if (t.length === 0) return e;
let { tokens: i, document: a } = Zu(e, {
options: n,
filePath: r
}), o;
try {
o = au(a.toJSON());
} catch {
return e;
}
let s = !1;
for (let { path: e, newValue: n } of t) Yu(e) && Xu(o, e) !== n && Qu(a, e, {
newValue: n,
newName: e.at(-1)
}) && (s = !0);
return s ? i.map((e) => _c.CST.stringify(e)).join("") : e;
}
//#endregion
//#region src/lib/upgradePackageData.ts
function ed(e, t, n, r, i, a) {
let o = Ku(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, du(gu(s, a, i), (e, t) => t in r)];
}, c = [];
for (let e of t) {
if (e === "devEngines") continue;
let t = o?.[e];
if (!t || typeof t != "object" || Array.isArray(t)) continue;
let [n, r] = s(e);
c.push(...Vu(t, [e], n, r));
}
return Bu(e, c);
}
function td(e, t) {
return e && cu(e) ? (0, _c.parseDocument)(t).toJSON() : Ku(t);
}
async function nd(e, t, n, r, i, a, c) {
if (i) {
let a = o.extname(i);
if (cu(i)) {
let e = await s.readFile(i, "utf-8"), t = au((0, _c.parseDocument)(e).toJSON()), a = t.workspaces, o = [
...Object.entries(t.catalogs ?? {}).map(([e, t]) => [["catalogs", e], t]),
[["catalog"], t.catalog],
...a && !Array.isArray(a) ? [...Object.entries(a.catalogs ?? {}).map(([e, t]) => [[
"workspaces",
"catalogs",
e
], t]), [["workspaces", "catalog"], a.catalog]] : []
], c = [];
for (let [e, t] of o) if (t) for (let [r, i] of Object.entries(n)) t[r] && c.push({
path: [...e, r],
newValue: i
});
return $u({
fileContent: e,
upgrades: c,
options: r,
filePath: i
});
}
if (a === ".json") {
if (c) return qu(i, t, n);
let r = Ku(e), a = r.catalog || r.catalogs, o = r.workspaces && !Array.isArray(r.workspaces) && (r.workspaces.catalog || r.workspaces.catalogs);
if (a || o) return qu(i, t, n);
}
}
let l = [...pu(r.dep), "overrides"], u = ed(e, l, t, n, r, a), d = (e, i) => n[e] ? a?.[e] ? gu({ [e]: i }, { [e]: a[e] }, r)[e] : t[e] === i ? n[e] : null : null, f = [], p = Ku(e);
if (l.includes("packageManager") && p.packageManager) {
let [e, t] = p.packageManager.split("@"), n = d(e, t);
n && f.push({
path: ["packageManager"],
value: `${e}@${n}`
});
}
if (l.includes("devEngines")) for (let { entry: e, path: t } of lu(p)) {
let n = d(e.name, e.version);
n && f.push({
path: [...t, "version"],
value: n
});
}
return f.length > 0 && (u = Bu(u, f)), u;
}
//#endregion
//#region src/lib/doctor.ts
var rd = (e) => Dl[e ?? "npm"] ?? Dl.npm, id = (e, t, n, { spawnOptions: r, spawnPleaseOptions: i } = {}) => {
n && console.log(J.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 (rd(t.packageManager).spawn ?? yo)(e, o, i, a);
}, ad = 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 Ol(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;
}, od = async (e, t) => {
Sn(t.color);
let n = {
packageManager: t.packageManager,
color: t.color
}, r = wi(t.packageManager), { pkg: i, pkgFile: a } = await ad(t), o = {
...i.dependencies,
...i.devDependencies,
...i.optionalDependencies
}, c = async () => {
if (t.doctorInstall) {
let [e, ...n] = t.doctorInstall.split(" ");
console.log(J.blue(t.doctorInstall)), await (0, Ee.default)(e, n);
} else await id(["install"], n, !0);
}, l = async () => {
let e = {
stderr: (e) => {
console.error(J.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(J.blue(t.doctorTest)), await (0, Ee.default)(i, a, e);
} else await id(["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(J.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 " + J.green.bold(":)"));
return;
}
let f = !1;
try {
await c(), f = !0, await l(), console.log(`${J.green("✓")} Tests pass`), await Pr(t, {
current: o,
upgraded: d,
total: Object.keys(d || {}).length
}), console.log(`\n${t.interactive ? "Chosen" : "All"} dependencies upgraded and installed ${J.green(":)")}`);
} catch {
console.error(J.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 ${J.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 id([...rd(t.packageManager).usesAddCommand ? ["add"] : ["install", "--no-save"], `${p}@${m}`], n, !0), i.scripts?.prepare) try {
await id(["run", "prepare"], n, !0);
} catch (e) {
throw console.error(J.red("Prepare script failed")), e;
}
await l(), console.log(` ${J.green("✓")} ${p} ${o[p]} → ${m}`), e = await nd(e, { [p]: o[p] }, { [p]: m }, t), u = await s.readFile(r, "utf-8");
} catch (n) {
console.error(` ${J.red("✗")} ${p} ${o[p]} → ${m}\n`), Y(t, J.red(Sr(n)), null, "error"), await s.writeFile(r, u), rd(t.packageManager).usesAddCommand && 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 sd(e) {
let t, n = null, r = e.packageFile || "package.json";
async function i(t, n) {
if (t != null) {
let n = o.resolve(t);
Y(e, `${e.upgrade ? "Upgrading" : "Checking"} ${n}`);
} else $(e, `${J.red(`No ${n}`)}\n\nPlease add a ${n} to the current directory, specify the ${J.cyan("--packageFile")} or ${J.cyan("--packageData")} options, or pipe a ${n} to stdin and specify ${J.cyan("--stdin")}.`, { color: !1 });
try {
return await s.readFile(t, "utf-8");
} catch (t) {
$(e, t);
}
}
if (Y(e, "Running in local mode", "verbose"), Y(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) {
Y(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 ka(r), t = o || i(n, r);
} else {
let a = e.cwd || process.cwd();
n = r ? !e.packageFile && e.packageManager === "deno" && await ka(["deno.json", "deno.jsonc"], { cwd: a }) || await ka(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 cd = /* @__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;
})), ld = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.isEnoentCodeError = void 0;
function t(e) {
return e.code === "ENOENT";
}
e.isEnoentCodeError = t;
})), ud = /* @__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;
})), dd = /* @__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;
})), fd = /* @__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;
};
})), pd = /* @__PURE__ */ i(((e, t) => {
var n = fd(), 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);
};
})), md = /* @__PURE__ */ i(((t, n) => {
var r = pd(), 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");
};
})), hd = /* @__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;
};
})), gd = /* @__PURE__ */ i(((e, t) => {
var n = hd();
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);
};
})), _d = /* @__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;
};
})), vd = /* @__PURE__ */ i(((e, t) => {
var n = _d(), 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;
})), yd = /* @__PURE__ */ i(((t, n) => {
var r = e("util"), i = vd(), 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;
})), bd = /* @__PURE__ */ i(((e, t) => {
var n = yd(), r = hd();
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);
};
})), xd = /* @__PURE__ */ i(((e, t) => {
var n = yd(), r = gd(), i = hd(), 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));
};
})), Sd = /* @__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: ""
};
})), Cd = /* @__PURE__ */ i(((e, t) => {
var n = gd(), { 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: _ } = Sd();
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;
};
})), wd = /* @__PURE__ */ i(((e, t) => {
var n = gd(), r = bd(), i = xd(), a = Cd(), 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;
})), Td = /* @__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;
}
};
})), Ed = /* @__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 } = Td();
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;
};
})), Dd = /* @__PURE__ */ i(((e, t) => {
var n = Ed(), { 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: _ } = Td(), 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, N = !1, P = !1, F = !1, I = !1, re = 0, L, R, z = {
value: "",
depth: 0,
isGlob: !1
}, B = () => D >= x, V = () => E.charCodeAt(D + 1), H = () => (L = R, E.charCodeAt(++D));
for (; D < x;) {
R = H();
let e;
if (R === a) {
N = z.backslashes = !0, R = H(), R === u && (ne = !0);
continue;
}
if (ne === !0 || R === u) {
for (re++; B() !== !0 && (R = H());) {
if (R === a) {
N = z.backslashes = !0, H();
continue;
}
if (R === u) {
re++;
continue;
}
if (ne !== !0 && R === s && (R = H()) === s) {
if (A = z.isBrace = !0, j = z.isGlob = !0, I = !0, S === !0) continue;
break;
}
if (ne !== !0 && R === o) {
if (A = z.isBrace = !0, j = z.isGlob = !0, I = !0, S === !0) continue;
break;
}
if (R === h && (re--, re === 0)) {
ne = !1, A = z.isBrace = !0, I = !0;
break;
}
}
if (S === !0) continue;
break;
}
if (R === l) {
if (C.push(D), w.push(z), z = {
value: "",
depth: 0,
isGlob: !1
}, I === !0) continue;
if (L === s && D === O + 1) {
O += 2;
continue;
}
k = D + 1;
continue;
}
if (b.noext !== !0 && (R === p || R === i || R === r || R === m || R === c) && V() === d) {
if (j = z.isGlob = !0, M = z.isExtglob = !0, I = !0, R === c && D === O && (F = !0), S === !0) {
for (; B() !== !0 && (R = H());) {
if (R === a) {
N = z.backslashes = !0, R = H();
continue;
}
if (R === g) {
j = z.isGlob = !0, I = !0;
break;
}
}
continue;
}
break;
}
if (R === r) {
if (L === r && (te = z.isGlobstar = !0), j = z.isGlob = !0, I = !0, S === !0) continue;
break;
}
if (R === m) {
if (j = z.isGlob = !0, I = !0, S === !0) continue;
break;
}
if (R === f) {
for (; B() !== !0 && (e = H());) {
if (e === a) {
N = z.backslashes = !0, H();
continue;
}
if (e === _) {
ee = z.isBracket = !0, j = z.isGlob = !0, I = !0;
break;
}
}
if (S === !0) continue;
break;
}
if (b.nonegate !== !0 && R === c && D === O) {
P = z.negated = !0, O++;
continue;
}
if (b.noparen !== !0 && R === d) {
if (j = z.isGlob = !0, S === !0) {
for (; B() !== !0 && (R = H());) {
if (R === d) {
N = z.backslashes = !0, R = H();
continue;
}
if (R === g) {
I = !0;
break;
}
}
continue;
}
break;
}
if (j === !0) {
if (I = !0, S === !0) continue;
break;
}
}
b.noext === !0 && (M = !1, j = !1);
let U = E, ie = "", ae = "";
O > 0 && (ie = E.slice(0, O), E = E.slice(O), k -= O), U && j === !0 && k > 0 ? (U = E.slice(0, k), ae = E.slice(k)) : j === !0 ? (U = "", ae = E) : U = E, U && U !== "" && U !== "/" && U !== E && v(U.charCodeAt(U.length - 1)) && (U = U.slice(0, -1)), b.unescape === !0 && (ae &&= n.removeBackslashes(ae), U && N === !0 && (U = n.removeBackslashes(U)));
let oe = {
prefix: ie,
input: e,
start: O,
base: U,
glob: ae,
isBrace: A,
isBracket: ee,
isGlob: j,
isExtglob: M,
isGlobstar: te,
negated: P,
negatedExtglob: F
};
if (b.tokens === !0 && (oe.maxDepth = 0, v(R) || w.push(z), oe.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 = ie) : w[n].value = a, y(w[n]), oe.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]), oe.maxDepth += w[w.length - 1].depth);
}
oe.slashes = C, oe.parts = T;
}
return oe;
};
})), Od = /* @__PURE__ */ i(((e, t) => {
var n = Td(), r = Ed(), { 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, N = d.dot ? A : ee, P = d.bash === !0 ? te(d) : j;
d.capture && (P = `(${P})`), typeof d.noext == "boolean" && (d.noextglob = d.noext);
let F = {
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, F), p = e.length;
let I = [], re = [], L = [], R = m, z, B = () => F.index === p - 1, V = F.peek = (t = 1) => e[F.index + t], H = F.advance = () => e[++F.index] || "", U = () => e.slice(F.index + 1), ie = (e = "", t = 0) => {
F.consumed += e, F.index += t;
}, ae = (e) => {
F.output += e.output == null ? e.value : e.output, ie(e.value);
}, oe = () => {
let e = 1;
for (; V() === "!" && (V(2) !== "(" || V(3) === "?");) H(), F.start++, e++;
return e % 2 != 0 && (F.negated = !0, F.start++, !0);
}, se = (e) => {
F[e]++, L.push(e);
}, W = (e) => {
F[e]--, L.pop();
}, G = (e) => {
if (R.type === "globstar") {
let t = F.braces > 0 && (e.type === "comma" || e.type === "brace"), n = e.extglob === !0 || I.length && (e.type === "pipe" || e.type === "paren");
e.type !== "slash" && e.type !== "paren" && !t && !n && (F.output = F.output.slice(0, -R.output.length), R.type = "star", R.value = "*", R.output = P, F.output += R.output);
}
if (I.length && e.type !== "paren" && (I[I.length - 1].inner += e.value), (e.value || e.output) && ae(e), R && R.type === "text" && e.type === "text") {
R.value += e.value, R.output = (R.output || "") + e.value;
return;
}
e.prev = R, h.push(e), R = e;
}, ce = (e, t) => {
let n = {
...x[t],
conditions: 1,
inner: ""
};
n.prev = R, n.parens = F.parens, n.output = F.output, n.startIndex = F.index, n.tokensIndex = h.length;
let r = (d.capture ? "(" : "") + n.open;
se("parens"), G({
type: e,
value: t,
output: F.output ? "" : T
}), G({
type: "paren",
extglob: !0,
value: H(),
output: r
}), I.push(n);
}, le = (n) => {
let i = e.slice(n.startIndex, F.index + 1), a = v(e.slice(n.startIndex + 2, F.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;
F.output = n.output + t.output, F.backtrack = !0, G({
type: "paren",
extglob: !0,
value: z,
output: ""
}), W("parens");
return;
}
let o = n.close + (d.capture ? ")" : ""), s;
if (n.type === "negate") {
let e = P;
n.inner && n.inner.length > 1 && n.inner.includes("/") && (e = te(d)), (e !== P || B() || /^\)+$/.test(U())) && (o = n.close = `)$))${e}`), n.inner.includes("*") && (s = U()) && /^\.[^\\/.]+$/.test(s) && (o = n.close = `)${y(s, {
...t,
fastpaths: !1
}).output})${e})`), n.prev.type === "bos" && (F.negatedExtglob = !0);
}
G({
type: "paren",
extglob: !0,
value: z,
output: o
}), W("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 ? N + (a ? A.repeat(a.length) : "") : A.repeat(r.length) : i === "." ? S.repeat(r.length) : i === "*" ? t ? t + i + (a ? P : "") : P : 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 ? (F.output = e, F) : (F.output = r.wrapOutput(i, F, t), F);
}
for (; !B();) {
if (z = H(), z === "\0") continue;
if (z === "\\") {
let e = V();
if (e === "/" && d.bash !== !0 || e === "." || e === ";") continue;
if (!e) {
z += "\\", G({
type: "text",
value: z
});
continue;
}
let t = /^\\+/.exec(U()), n = 0;
if (t && t[0].length > 2 && (n = t[0].length, F.index += n, n % 2 != 0 && (z += "\\")), d.unescape === !0 ? z = H() : z += H(), F.brackets === 0) {
G({
type: "text",
value: z
});
continue;
}
}
if (F.brackets > 0 && (z !== "]" || R.value === "[" || R.value === "[^")) {
if (d.posix !== !1 && z === ":") {
let e = R.value.slice(1);
if (e.includes("[") && (R.posix = !0, e.includes(":"))) {
let e = R.value.lastIndexOf("["), t = R.value.slice(0, e), n = a[R.value.slice(e + 2)];
if (n) {
R.value = t + n, F.backtrack = !0, H(), !m.output && h.indexOf(R) === 1 && (m.output = T);
continue;
}
}
}
(z === "[" && V() !== ":" || z === "-" && V() === "]") && (z = `\\${z}`), z === "]" && (R.value === "[" || R.value === "[^") && (z = `\\${z}`), d.posix === !0 && z === "!" && R.value === "[" && (z = "^"), R.value += z, ae({ value: z });
continue;
}
if (F.quotes === 1 && z !== "\"") {
z = r.escapeRegex(z), R.value += z, ae({ value: z });
continue;
}
if (z === "\"") {
F.quotes = F.quotes === 1 ? 0 : 1, d.keepQuotes === !0 && G({
type: "text",
value: z
});
continue;
}
if (z === "(") {
se("parens"), G({
type: "paren",
value: z
});
continue;
}
if (z === ")") {
if (F.parens === 0 && d.strictBrackets === !0) throw SyntaxError(u("opening", "("));
let e = I[I.length - 1];
if (e && F.parens === e.parens + 1) {
le(I.pop());
continue;
}
G({
type: "paren",
value: z,
output: F.parens ? ")" : "\\)"
}), W("parens");
continue;
}
if (z === "[") {
if (d.nobracket === !0 || !U().includes("]")) {
if (d.nobracket !== !0 && d.strictBrackets === !0) throw SyntaxError(u("closing", "]"));
z = `\\${z}`;
} else se("brackets");
G({
type: "bracket",
value: z
});
continue;
}
if (z === "]") {
if (d.nobracket === !0 || R && R.type === "bracket" && R.value.length === 1) {
G({
type: "text",
value: z,
output: `\\${z}`
});
continue;
}
if (F.brackets === 0) {
if (d.strictBrackets === !0) throw SyntaxError(u("opening", "["));
G({
type: "text",
value: z,
output: `\\${z}`
});
continue;
}
W("brackets");
let e = R.value.slice(1);
if (R.posix !== !0 && e[0] === "^" && !e.includes("/") && (z = `/${z}`), R.value += z, ae({ value: z }), d.literalBrackets === !1 || r.hasRegexChars(e)) continue;
let t = r.escapeRegex(R.value);
if (F.output = F.output.slice(0, -R.value.length), d.literalBrackets === !0) {
F.output += t, R.value = t;
continue;
}
R.value = `(${g}${t}|${R.value})`, F.output += R.value;
continue;
}
if (z === "{" && d.nobrace !== !0) {
se("braces");
let e = {
type: "brace",
value: z,
output: "(",
outputIndex: F.output.length,
tokensIndex: F.tokens.length
};
re.push(e), G(e);
continue;
}
if (z === "}") {
let e = re[re.length - 1];
if (d.nobrace === !0 || !e) {
G({
type: "text",
value: z,
output: z
});
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), F.backtrack = !0;
}
if (e.comma !== !0 && e.dots !== !0) {
let n = F.output.slice(0, e.outputIndex), r = F.tokens.slice(e.tokensIndex);
e.value = e.output = "\\{", z = t = "\\}", F.output = n;
for (let e of r) F.output += e.output || e.value;
}
G({
type: "brace",
value: z,
output: t
}), W("braces"), re.pop();
continue;
}
if (z === "|") {
I.length > 0 && I[I.length - 1].conditions++, G({
type: "text",
value: z
});
continue;
}
if (z === ",") {
let e = z, t = re[re.length - 1];
t && L[L.length - 1] === "braces" && (t.comma = !0, e = "|"), G({
type: "comma",
value: z,
output: e
});
continue;
}
if (z === "/") {
if (R.type === "dot" && F.index === F.start + 1) {
F.start = F.index + 1, F.consumed = "", F.output = "", h.pop(), R = m;
continue;
}
G({
type: "slash",
value: z,
output: w
});
continue;
}
if (z === ".") {
if (F.braces > 0 && R.type === "dot") {
R.value === "." && (R.output = S);
let e = re[re.length - 1];
R.type = "dots", R.output += z, R.value += z, e.dots = !0;
continue;
}
if (F.braces + F.parens === 0 && R.type !== "bos" && R.type !== "slash") {
G({
type: "text",
value: z,
output: S
});
continue;
}
G({
type: "dot",
value: z,
output: S
});
continue;
}
if (z === "?") {
if (!(R && R.value === "(") && d.noextglob !== !0 && V() === "(" && V(2) !== "?") {
ce("qmark", z);
continue;
}
if (R && R.type === "paren") {
let e = V(), t = z;
if (e === "<" && !r.supportsLookbehinds()) throw Error("Node.js v10 or higher is required for regex lookbehinds");
(R.value === "(" && !/[!=<:]/.test(e) || e === "<" && !/<([!=]|\w+>)/.test(U())) && (t = `\\${z}`), G({
type: "text",
value: z,
output: t
});
continue;
}
if (d.dot !== !0 && (R.type === "slash" || R.type === "bos")) {
G({
type: "qmark",
value: z,
output: ee
});
continue;
}
G({
type: "qmark",
value: z,
output: A
});
continue;
}
if (z === "!") {
if (d.noextglob !== !0 && V() === "(" && (V(2) !== "?" || !/[!=<:]/.test(V(3)))) {
ce("negate", z);
continue;
}
if (d.nonegate !== !0 && F.index === 0) {
oe();
continue;
}
}
if (z === "+") {
if (d.noextglob !== !0 && V() === "(" && V(2) !== "?") {
ce("plus", z);
continue;
}
if (R && R.value === "(" || d.regex === !1) {
G({
type: "plus",
value: z,
output: C
});
continue;
}
if (R && (R.type === "bracket" || R.type === "paren" || R.type === "brace") || F.parens > 0) {
G({
type: "plus",
value: z
});
continue;
}
G({
type: "plus",
value: C
});
continue;
}
if (z === "@") {
if (d.noextglob !== !0 && V() === "(" && V(2) !== "?") {
G({
type: "at",
extglob: !0,
value: z,
output: ""
});
continue;
}
G({
type: "text",
value: z
});
continue;
}
if (z !== "*") {
(z === "$" || z === "^") && (z = `\\${z}`);
let e = o.exec(U());
e && (z += e[0], F.index += e[0].length), G({
type: "text",
value: z
});
continue;
}
if (R && (R.type === "globstar" || R.star === !0)) {
R.type = "star", R.star = !0, R.value += z, R.output = P, F.backtrack = !0, F.globstar = !0, ie(z);
continue;
}
let t = U();
if (d.noextglob !== !0 && /^\([^?]/.test(t)) {
ce("star", z);
continue;
}
if (R.type === "star") {
if (d.noglobstar === !0) {
ie(z);
continue;
}
let n = R.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] !== "/")) {
G({
type: "star",
value: z,
output: ""
});
continue;
}
let o = F.braces > 0 && (n.type === "comma" || n.type === "brace"), s = I.length && (n.type === "pipe" || n.type === "paren");
if (!i && n.type !== "paren" && !o && !s) {
G({
type: "star",
value: z,
output: ""
});
continue;
}
for (; t.slice(0, 3) === "/**";) {
let n = e[F.index + 4];
if (n && n !== "/") break;
t = t.slice(3), ie("/**", 3);
}
if (n.type === "bos" && B()) {
R.type = "globstar", R.value += z, R.output = te(d), F.output = R.output, F.globstar = !0, ie(z);
continue;
}
if (n.type === "slash" && n.prev.type !== "bos" && !a && B()) {
F.output = F.output.slice(0, -(n.output + R.output).length), n.output = `(?:${n.output}`, R.type = "globstar", R.output = te(d) + (d.strictSlashes ? ")" : "|$)"), R.value += z, F.globstar = !0, F.output += n.output + R.output, ie(z);
continue;
}
if (n.type === "slash" && n.prev.type !== "bos" && t[0] === "/") {
let e = t[1] === void 0 ? "" : "|$";
F.output = F.output.slice(0, -(n.output + R.output).length), n.output = `(?:${n.output}`, R.type = "globstar", R.output = `${te(d)}${w}|${w}${e})`, R.value += z, F.output += n.output + R.output, F.globstar = !0, ie(z + H()), G({
type: "slash",
value: "/",
output: ""
});
continue;
}
if (n.type === "bos" && t[0] === "/") {
R.type = "globstar", R.value += z, R.output = `(?:^|${w}|${te(d)}${w})`, F.output = R.output, F.globstar = !0, ie(z + H()), G({
type: "slash",
value: "/",
output: ""
});
continue;
}
F.output = F.output.slice(0, -R.output.length), R.type = "globstar", R.output = te(d), R.value += z, F.output += R.output, F.globstar = !0, ie(z);
continue;
}
let n = {
type: "star",
value: z,
output: P
};
if (d.bash === !0) {
n.output = ".*?", (R.type === "bos" || R.type === "slash") && (n.output = ne + n.output), G(n);
continue;
}
if (R && (R.type === "bracket" || R.type === "paren") && d.regex === !0) {
n.output = z, G(n);
continue;
}
(F.index === F.start || R.type === "slash" || R.type === "dot") && (R.type === "dot" ? (F.output += O, R.output += O) : d.dot === !0 ? (F.output += k, R.output += k) : (F.output += ne, R.output += ne), V() !== "*" && (F.output += T, R.output += T)), G(n);
}
for (; F.brackets > 0;) {
if (d.strictBrackets === !0) throw SyntaxError(u("closing", "]"));
F.output = r.escapeLast(F.output, "["), W("brackets");
}
for (; F.parens > 0;) {
if (d.strictBrackets === !0) throw SyntaxError(u("closing", ")"));
F.output = r.escapeLast(F.output, "("), W("parens");
}
for (; F.braces > 0;) {
if (d.strictBrackets === !0) throw SyntaxError(u("closing", "}"));
F.output = r.escapeLast(F.output, "{"), W("braces");
}
if (d.strictSlashes !== !0 && (R.type === "star" || R.type === "bracket") && G({
type: "maybe_slash",
value: "",
output: `${w}?`
}), F.backtrack === !0) {
F.output = "";
for (let e of F.tokens) F.output += e.output == null ? e.value : e.output, e.suffix && (F.output += e.suffix);
}
return F;
};
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;
})), kd = /* @__PURE__ */ i(((t, n) => {
var r = e("path"), i = Dd(), a = Od(), o = Ed(), s = Td(), 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;
})), Ad = /* @__PURE__ */ i(((e, t) => {
t.exports = kd();
})), jd = /* @__PURE__ */ i(((t, n) => {
var r = e("util"), i = wd(), a = Ad(), o = Ed(), 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;
})), Md = /* @__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 = md(), i = jd(), 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 N(e) {
let t = [], n = [];
for (let r of e) P(r) ? t.push(r) : n.push(r);
return [t, n];
}
t.partitionAbsoluteAndRelative = N;
function P(e) {
return n.isAbsolute(e);
}
t.isAbsolute = P;
})), Nd = /* @__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;
}
})), Pd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.merge = void 0;
var t = Nd();
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"));
}
})), Fd = /* @__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;
})), Id = /* @__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 = cd(), e.errno = ld(), e.fs = ud(), e.path = dd(), e.pattern = Md(), e.stream = Pd(), e.string = Fd();
})), Ld = /* @__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 = Id();
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;
})), Rd = /* @__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);
}
})), zd = /* @__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;
})), Bd = /* @__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;
})), Vd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = Bd();
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;
}
};
})), Hd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.statSync = e.stat = e.Settings = void 0;
var t = Rd(), n = zd(), r = Vd();
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);
}
})), Ud = /* @__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));
})), Wd = /* @__PURE__ */ i(((e, t) => {
t.exports = r;
var n = Ud();
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;
}
})), Gd = /* @__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;
})), Kd = /* @__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;
})), qd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.fs = void 0, e.fs = Kd();
})), Jd = /* @__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;
})), Yd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.readdir = e.readdirWithFileTypes = e.read = void 0;
var t = Hd(), n = Wd(), r = Gd(), i = qd(), a = Jd();
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);
}
})), Xd = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.readdir = e.readdirWithFileTypes = e.read = void 0;
var t = Hd(), n = Gd(), r = qd(), i = Jd();
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;
})), Qd = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("path"), r = Hd(), 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;
}
};
})), $d = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.Settings = e.scandirSync = e.scandir = void 0;
var t = Yd(), n = Xd(), r = Qd();
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);
}
})), ef = /* @__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;
})), tf = /* @__PURE__ */ i(((e, t) => {
var n = ef();
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;
})), nf = /* @__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;
})), rf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = nf();
e.default = class {
constructor(e, n) {
this._root = e, this._settings = n, this._root = t.replacePathSegmentSeparator(e, n.pathSegmentSeparator);
}
};
})), af = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("events"), r = $d(), i = tf(), a = nf(), o = rf();
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);
}
};
})), of = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = af();
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);
}
})), sf = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("stream"), r = af();
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;
}
};
})), cf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = $d(), n = nf(), r = rf();
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);
}
};
})), lf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = cf();
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();
}
};
})), uf = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("path"), r = $d();
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;
}
};
})), df = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 }), e.Settings = e.walkStream = e.walkSync = e.walk = void 0;
var t = of(), n = sf(), r = lf(), i = uf();
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);
}
})), ff = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("path"), r = Hd(), i = Id();
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;
}
};
})), pf = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("stream"), r = Hd(), i = df(), a = ff();
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));
});
}
};
})), mf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = df(), n = ff(), r = pf();
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));
});
}
};
})), hf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = Id();
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));
}
};
})), gf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = hf();
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;
}
};
})), _f = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = Id(), n = gf();
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);
}
};
})), vf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = Id();
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;
}
};
})), yf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = Id();
e.default = class {
constructor(e) {
this._settings = e;
}
getFilter() {
return (e) => this._isNonFatalError(e);
}
_isNonFatalError(e) {
return t.errno.isEnoentCodeError(e) || this._settings.suppressErrors;
}
};
})), bf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = Id();
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;
}
};
})), xf = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("path"), r = _f(), i = vf(), a = yf(), o = bf();
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
};
}
};
})), Sf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = mf(), n = xf();
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);
}
};
})), Cf = /* @__PURE__ */ i(((t) => {
Object.defineProperty(t, "__esModule", { value: !0 });
var n = e("stream"), r = pf(), i = xf();
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);
}
};
})), wf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = Hd(), n = df(), r = ff();
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);
}
};
})), Tf = /* @__PURE__ */ i(((e) => {
Object.defineProperty(e, "__esModule", { value: !0 });
var t = wf(), n = xf();
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);
}
};
})), Ef = /* @__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);
}
};
})), Df = /* @__PURE__ */ n((/* @__PURE__ */ i(((e, t) => {
var n = Ld(), r = Sf(), i = Cf(), a = Tf(), o = Ef(), s = Id();
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), Of = { ignore: ["**/node_modules/**", "**/.pnpm-store/**"] }, kf = async (e, t) => {
let n;
try {
n = await s.readFile(o.join(o.dirname(e), t), "utf-8");
} catch {
return null;
}
return (0, _c.parse)(n);
}, Af = (e, t) => {
t.catalog && Object.assign(e, t.catalog), t.catalogs && Object.assign(e, ...Object.values(t.catalogs));
}, jf = async (e, t) => {
let n = {}, r = su(e.packageManager);
if (r) {
let e = await kf(t, r);
e && !Array.isArray(e) && (Af(n, e), e.workspaces && !Array.isArray(e.workspaces) && Af(n, e.workspaces));
}
let i = JSON.parse(await s.readFile(t, "utf-8"));
return Af(n, i), i.workspaces && !Array.isArray(i.workspaces) && Af(n, i.workspaces), Object.keys(n).length > 0 ? n : null;
};
async function Mf(e, t, n, r) {
let { pkgData: i, pkgPath: a } = await sd({
...e,
packageFile: n,
loglevel: "silent"
}), s = (typeof i == "string" ? JSON.parse(i) : i).workspaces || await kf(a || "", "pnpm-workspace.yaml"), 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, Df.default)(u, Of), f = await Promise.all(d.map(async (t) => {
let n = await Ol(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 Nf(e, t) {
if (!t) return null;
let n = await jf(e, t);
if (!n) return null;
let r = {
name: "catalog-dependencies",
version: "1.0.0",
dependencies: n
}, i = su(e.packageManager);
return {
filepath: i ? o.join(o.dirname(t), i) : t,
pkg: r,
pkgFile: JSON.stringify(r, null, 2),
name: "catalogs",
catalog: !0
};
}
async function Pf(e) {
let t = e.packageFile || "package.json", n = e.cwd ? Ha(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, Df.default)(t, Of), i = await Promise.all(n.map(async (t) => await Ol(e, t)));
a = [...a, ...i];
}
if (!i) return [a, []];
let { pkgPath: s } = await sd({
...e,
packageFile: r,
loglevel: "silent"
}), c = s ? await Nf(e, s) : null, [l, u] = await Mf(e, t, r, n);
return a = [...a, ...l], c && (a = [...a, c]), [a, u];
}
//#endregion
//#region src/lib/getNcuRc.ts
var Ff = (/* @__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());
}
};
};
})))(), If = (e, t) => {
try {
return (0, _c.parse)(t);
} catch (t) {
throw Error(`YAML Error in ${e}:\n${t.message}`, { cause: t });
}
};
function Lf(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 Rf({ configFileName: e, configFilePath: t, packageFile: n, global: r, options: i }) {
let a = xn(i?.color), s = (0, Ff.lilconfig)("ncu", {
searchPlaces: [
".ncurc",
".ncurc.json",
".ncurc.yaml",
".ncurc.yml",
".ncurc.mjs",
".ncurc.cjs",
".ncurc.js"
],
loaders: {
noExt: If,
".yaml": If,
".yml": If
}
}), 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 = Lf(n, r);
a && $(i, a), $(i, `Config file error: ${n}`);
}
let f = u?.filepath, { $schema: p, ...m } = u?.config || {}, h = m, g = Object.keys(h).filter((e) => !vi[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" || vi[e]?.type === "boolean" ? t ? [`--${e}`] : vi[e]?.type === "boolean" ? [`--no-${e}`] : [] : [`--${e}`, t]),
config: h
};
}
//#endregion
//#region src/types/Target.ts
var zf = [
"latest",
"newest",
"greatest",
"minor",
"patch",
"semver"
];
//#endregion
//#region src/lib/parseOptions.ts
function Bf(e, t = e) {
let n = e.cooldown;
for (let n of yi) {
let { parse: r, accumulate: i } = n;
if (!r || i) continue;
let a = n.long, o = e[a];
if (o !== void 0 && o !== n.default) try {
e[a] = r(o);
} catch (e) {
$(t, e.message || e);
}
}
return typeof n == "string" && typeof e.cooldown == "number" && isNaN(e.cooldown) && $(t, `Invalid cooldown value: "${n}". Use a number (days) or a string like "7d", "12h", or "30m".`), e;
}
//#endregion
//#region src/lib/initOptions.ts
function Vf(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 Hf(e) {
try {
return new URL(e), !0;
} catch {
return !1;
}
}
var Uf = (e, t = Math.round(e * 10) / 10) => `${t} day${t === 1 ? "" : "s"}`, Wf = (e, t, { source: n, excludeLabel: r, createMatcher: i = (e) => (0, za.default)(e) }) => {
if (t.length === 0) return [e, `Using ${n}: ${Uf(e)}`];
let a = t.map(i);
return [(t) => a.some((e) => e(t)) ? null : e, `Using ${n}: ${Uf(e)} (${t.length} ${r}${t.length === 1 ? "" : "s"})`];
};
async function Gf(e, { cli: t } = {}) {
let n = xn(e.color), r, i;
if (!t) {
r = { ...e }, i = Object.keys(e);
let t = q(yi, (e) => e.default == null ? null : { [e.long]: e.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
}
};
Bf(a);
let 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 && Y(a, `Using config file ${a.rcConfigPath}`);
let c = yi.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}`;
Y(a, n.yellow(r), "warn");
}
Y(a, "", "warn");
}
for (let { long: e, choices: t } of yi) {
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 Qt(a.cwd) && $(a, `No such directory: ${a.cwd}`);
let l = Vf(a.args), u = Vf(a.filter), d = Vf(a.filterVersion), f = Vf(a.reject), p = Vf(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 && !Hf(a.registry) && $(a, `--registry must be a valid URL. Invalid value: "${a.registry}"`);
let h = await Oi(a);
if (a.cooldown != null) {
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 {
let e = await (Dl[h]?.getCooldown ?? Dl.npm.getCooldown)(a);
if (e) {
let [t, n] = Wf(e.days, e.exclude, e);
a.cooldown = t, Y({
...a,
json: s
}, 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 (Dl[h || ""]?.defaultPrefix || Dl.npm.defaultPrefix)(a) } : null,
registryType: m
};
v.cacher = await Ur(v);
let y = q(v, (e, t) => t === void 0 ? null : { [e]: t });
return !a.packageManager && h !== "npm" && Y(y, `Using ${h}`), y;
}
//#endregion
//#region src/lib/mergeOptions.ts
function Kf(e, t) {
return Array.from(/* @__PURE__ */ new Set([...e || [], ...t || []]));
}
function qf(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] = Kf(n[e], r[e]));
return i;
}
//#endregion
//#region src/lib/getCooldownInfo.ts
var Jf = (e) => {
let t = q(e, (e, t) => {
let n = t.time ?? t.cooldownInfo?.currentVersionTime;
return n ? { [e]: n } : null;
}), n = q(e, (e, t) => t.cooldownInfo ? { [e]: t.cooldownInfo } : null);
return {
time: t,
skippedByCooldown: n,
numCooldown: Object.keys(n).length
};
};
//#endregion
//#region src/lib/filterAndReject.ts
function Yf(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,]+/).map((e) => ({
isMatch: (0, za.default)(e),
unscoped: !e.includes("/")
}));
n = (e) => t.some(({ isMatch: t, unscoped: n }) => t(e) || n && e.includes("/") && t(e.replace(/\//g, "_")));
}
} else if (Array.isArray(e)) {
let r = e.map((e) => Yf(e, { allowFunction: t }));
n = (e, t) => r.some((n) => n(e, t));
} 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, Oe.parseRange)(n ?? t));
} else throw TypeError("Invalid filter. Must be a RegExp, array, or comma-or-space-delimited list.");
return n;
}
function Xf(e, t, n, r) {
let i = e ? Yf(e) : null, a = t ? Yf(t) : null, o = n ? Yf(n, { allowFunction: !1 }) : null, s = r ? Yf(r, { allowFunction: !1 }) : null;
return (e, t) => (!i || i(e, t)) && (!a || !a(e, t)) && (!o || o(t)) && (!s || !s(t));
}
//#endregion
//#region src/lib/getPackageManager.ts
function Zf(e, t) {
return !t || t === "deno" ? Dl.npm : e.registryType === "json" ? Dl.staticRegistry : (Dl[t] || $(e, `Invalid package manager: ${t}`), Dl[t]);
}
//#endregion
//#region src/lib/getInstalledPackages.ts
async function Qf(e = {}) {
let t = await Zf(e, e.packageManager).list?.({
cwd: e.cwd,
prefix: e.prefix,
global: e.global
});
t || $(e, "Unable to retrieve package list");
let n = {};
try {
let r = Xf(e.filter, e.reject, e.filterVersion, e.rejectVersion);
n = qt(t, (e, t) => !!t && !Vn(t) && r(e, t));
} catch (t) {
$(e, "Invalid filter: " + (t.message || t));
}
return n;
}
//#endregion
//#region src/lib/quoteGlobalPackageSpec.ts
var $f = (e) => /^@[^/]*\./.test(e) ? `"${e}"` : e, ep = /* @__PURE__ */ r({
default: () => tp,
pMapSkip: () => np
});
async function tp(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) !== np && e.push(n);
v(e);
}
return;
}
p++, (async () => {
try {
let r = await e.value;
if (d) return;
let i = await t(r, n);
i === np && 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 np, rp = t((() => {
np = Symbol("skip");
}));
//#endregion
//#region src/lib/resolveDistTagsInPeerDependencies.ts
rp();
var ip = /^[a-z][a-z0-9._-]*$/i, ap = (e) => e.split("||").map((e) => e.trim()), op = (e) => K.default.validRange(e) ? [] : ap(e).filter((e) => ip.test(e) && !K.default.validRange(e)), sp = (e, t) => {
let n = ap(e).map((e) => Object.hasOwn(t, e) ? t[e] : e).join(" || ");
return K.default.validRange(n) ? n : e;
};
async function cp(e, t) {
let n = Zf(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" || op(a).length === 0) {
e[i] = a;
continue;
}
e[i] = sp(a, r[i] ??= await n.getDistTags(i, t).catch(() => ({})));
}
i[a] = e;
}
return i;
}
//#endregion
//#region src/lib/getPeerDependenciesFromRegistry.ts
function lp(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 up(e, t) {
let n = Zf(t, t.packageManager);
if (!n.getPeerDependencies) return {};
let r = Er(t, Object.keys(e).length), i = Object.entries(e), a = [], o = await tp(i, async ([e, i]) => {
let o, s = t.cacher?.getPeers(e, i);
if (s) o = s;
else if (!i || un(i) || mr(i) || Bn(i)) o = {};
else try {
o = await n.getPeerDependencies(e, i, t), t.cacher?.setPeers(e, i, o);
} catch (n) {
a.push(e), Y(t, `\nFailed to get the peer dependencies of ${e}@${i}:\n${Sr(n)}`, "verbose"), o = {};
}
return r && r.tick(), {
pkg: e,
dependencies: o
};
}, { concurrency: t.concurrency }), s = {};
for (let { pkg: e, dependencies: t } of o) {
s[e] = t;
let n = lp(s, e);
n.isCircular && delete s[e][n.offendingPackage];
}
let c = t.peerDependenciesFailed ??= /* @__PURE__ */ new Set(), l = a.filter((e) => !c.has(e));
if (l.length > 0) {
for (let e of l) c.add(e);
Y(t, `\nCould not determine the peer dependencies of ${l.slice(0, 5).join(", ")}${l.length > 5 ? ` (and ${l.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), cp(s, t);
}
//#endregion
//#region src/lib/queryVersions.ts
rp();
async function dp(e, t = {}) {
let n = xn(t.color), r = Object.keys(e), i = Zf(t, t.packageManager), a = Er(t, r.length);
async function o(r) {
let o = dr(e[r]), [s, c] = o || [r, e[r]];
if (un(c)) return a?.tick(), { version: null };
let l = t.target || "latest", u = typeof l == "string" ? l : l(s, (0, Oe.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 = mr(e[r]), h = m ? Dl.gitTags : i, g = m ? "github urls" : t.packageManager || "npm", _ = h[d];
if (!_) {
let e = zf.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("@") || nr(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 ? ur(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 tp(r, o, { concurrency: t.concurrency });
return await t.cacher?.save(), t.cacher?.log(), q(s, (e, t) => e.version || e.error || e.cooldownInfo ? { [r[t]]: e } : null);
}
//#endregion
//#region src/lib/upgradePackageDefinitions.ts
var fp = (e, t, n) => {
let r = {
...e,
...t
}, i = du(t, (e, t) => {
let i = n[t];
return !i || Object.entries(i).every(([e, t]) => r[e] === void 0 || !K.default.validRange(t) || !K.default.validRange(r[e]) || K.default.intersects(r[e], t));
}), a = Object.keys(t).length > Object.keys(i).length, o = n;
return a && (o = du(n, (e, n) => i[n] || !t[n])), {
violated: a,
filteredUpgradedDependencies: i,
upgradedPeerDependencies: o
};
}, pp = (e, t) => q({
...e,
...t
}, (t, n) => ({ [t]: !n.version && !n.error && e[t]?.version ? e[t] : n }));
async function mp(e, t) {
let n = await dp(e, t), r = q(n, (n, r) => r?.version && (!t.filterResults || t.filterResults(n, {
currentVersion: e[n],
currentVersionSemver: (0, Oe.parseRange)(e[n]),
upgradedVersion: r.version,
upgradedVersionSemver: (0, Oe.parse)(r.version)
})) ? { [n]: r.version } : null), i = du(gu(e, r, t), (n, i) => !t.jsonUpgraded || !t.minimal || !K.default.satisfies(r[i], e[i])), a = du(r, (e, t) => i[t]), o = [
i,
n,
t.peerDependencies
];
if (!t.peer || Object.keys(a).length === 0) return o;
let s = await up(a, t), c;
if (u(t.peerDependencies, {
...t.peerDependencies,
...s
})) {
if (c = fp(e, i, t.peerDependencies), !c.violated) return o;
} else c = {
violated: !1,
filteredUpgradedDependencies: i,
upgradedPeerDependencies: s
};
let l = 0;
do {
if (l++ > 6) throw Error("Stuck in a while loop. Please report an issue");
let r = {
...t.peerDependencies,
...c.upgradedPeerDependencies
};
if (u(t.peerDependencies, r)) {
let r = c;
for (; r.violated;) r = fp(e, r.filteredUpgradedDependencies, r.upgradedPeerDependencies);
return [
r.filteredUpgradedDependencies,
n,
t.peerDependencies
];
}
let [i, a, s] = await mp({
...e,
...c.filteredUpgradedDependencies
}, {
...t,
peerDependencies: r,
loglevel: "silent"
});
o = [
{
...c.filteredUpgradedDependencies,
...i
},
pp(n, a),
s
], c = fp(e, o[0], o[2]);
} while (c.violated);
return o;
}
//#endregion
//#region src/lib/runGlobal.ts
async function hp(e) {
Y(e, "\nOptions:", "verbose"), Tr(e, e, "verbose"), Y(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 Qf({
cli: n,
cwd: r,
filter: i,
filterVersion: a,
global: o,
packageManager: s,
prefix: c,
reject: l,
rejectVersion: u
});
} catch (t) {
$(e, t.message);
}
Y(e, "globalPackages:", "verbose"), Y(e, t, "verbose"), Y(e, "", "verbose"), Y(e, `Fetching ${e.target} versions`, "verbose");
let [n, r] = await mp(t, e);
Y(e, r, "verbose");
let { time: i, skippedByCooldown: a, numCooldown: o } = Jf(r), s = Object.keys(n);
await Pr(e, {
current: t,
upgraded: n,
skippedByCooldown: a,
latest: r,
numCooldown: o,
total: s.length,
time: i
});
let c = n ? s.map((e) => $f(e + "@" + n[e])).join(" ") : "[package]";
if (e.json) Cr(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";
Y(e, "\n" + J.cyan("ncu") + " itself cannot upgrade global packages. Run the following to upgrade all global packages: \n\n" + J.cyan(`${t} ` + c) + "\n");
}
return e.cli && e.errorLevel === 2 && s.length > 0 && process.exit(1), n;
}
//#endregion
//#region src/lib/getCurrentDependencies.ts
var gp = (e, t) => K.default.validRange(e) && K.default.validRange(t) && K.default.gt(K.default.minVersion(e), K.default.minVersion(t)), _p = (e) => {
if (!e.packageManager) return {};
let [t, n] = e.packageManager.split("@");
return n ? { [t]: n } : {};
}, vp = (e) => q(lu(e), ({ entry: e }) => ({ [e.name]: e.version }));
function yp(e = {}, t = {}) {
let n = pu(t.dep).reduce((t, n) => ({
...t,
...n === "packageManager" ? _p(e) : qt(n === "devEngines" ? vp(e) : e[n] || {}, (e, n) => !gp(n, t[e]))
}), {}), r = q(t.workspacePackages || []), i = {};
try {
i = qt(qt(n, (e) => !r[e]), Xf(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
rp();
async function bp(e, t) {
let n = Zf(t, t.packageManager);
if (!n.getEngines) return {};
let r = Er(t, Object.keys(e).length), i = await tp(Object.entries(e), async ([e, i]) => {
let a = (await n.getEngines(e, i, t)).node;
return r?.tick(), [e, a];
}, { concurrency: t.concurrency });
return Object.fromEntries(i);
}
//#endregion
//#region src/lib/getIgnoredUpgradesDueToEnginesNode.ts
var xp = (e, t) => !e || K.default.satisfies(t, e);
async function Sp(e, t, n = {}) {
if (!n.nodeEngineVersion) return {};
let r = K.default.minVersion(n.nodeEngineVersion)?.version;
if (!r) return {};
let [i, a] = await mp(e, {
...n,
enginesNode: !1,
nodeEngineVersion: void 0,
loglevel: "silent"
}), o = await bp(q(a, (e, t) => i[e] && t?.version ? { [e]: t.version } : null), n), s = {};
for (let [n, a] of Object.entries(i)) t[n] === a || xp(o[n], r) || (s[n] = {
from: e[n],
to: a,
enginesNode: o[n]
});
return s;
}
//#endregion
//#region src/lib/getIgnoredUpgradesDueToPeerDeps.ts
async function Cp(e, t, n, r = {}) {
let i = {
...e,
...t
}, [a, o] = await mp(e, {
...r,
peer: !1,
peerDependencies: void 0,
loglevel: "silent"
}), s = await up(Object.fromEntries(Object.entries(a).map(([e, t]) => [e, t && !Bn(t) && K.default.validRange(t) ? K.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 && !K.default.satisfies(o[r].version, t[r]) && (a[e] = K.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] && K.default.validRange(i[t]) && !(!K.default.validRange(n) || K.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 wp = {
none: [],
patch: ["patch"],
minor: ["patch", "minor"]
}, Tp = (e) => {
let t = e.interactiveSelect ?? "auto";
return t === "auto" ? e.format?.includes("group") ? "minor" : "all" : t;
}, Ep = (e, t) => t === "all" || wp[t].includes(e), Dp = (e, t, n) => n === "all" || n !== "none" && Ep(Kn(e, t), n);
//#endregion
//#region src/lib/runLocal.ts
rp();
var Op = "\n ↑/↓: Select a package\n Space: Toggle selection\n a: Toggle all\n Esc/q: Quit\n Enter: Upgrade";
function kp(e, t) {
let n = e ? Op.split("\n").length : 0;
return process.stdout.rows ? Math.max(3, process.stdout.rows - n - 1 - (t?.length ?? 0) * 2) : 50;
}
async function Ap(e, t, n) {
let r = Zf(n, n.packageManager), i = Object.keys(t), a = await tp(i, (i) => {
let a = e[i] || null, o = t[i] || null;
return r.packageAuthorChanged(i, a, o, n);
}, { concurrency: n.concurrency });
return q(i, (e, t) => ({ [e]: a[t] }));
}
var jp = async (e, t, n, r, i, a) => {
let o = [], s = process.stdout.rows > 18, c = q((await Ar({
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) {
Y(a, "");
let n = Tp(a), r = a.format?.includes("group") ? qn(t, e, a) : null, i = r ? 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: Ep(t, n)
}))]) : Object.keys(t).sort().map((r) => ({
title: c[r],
value: r,
selected: Dp(e[r], t[r], n)
}));
o = (await (0, Te.default)({
choices: [...i, {
title: " ",
heading: !0
}],
hint: s && Op + (r ? "" : "\n"),
instructions: !1,
message: "Choose which packages to update",
name: "value",
optionsPerPage: kp(s, r ?? void 0),
type: "multiselect",
onState: (e) => {
e.aborted && process.nextTick(() => process.exit(1));
}
})).value;
}
return q(o, (e) => ({ [e]: t[e] }));
};
async function Mp(e, t, n, r) {
Y(e, "\nOptions:", "verbose"), Tr(e, e, "verbose");
let i;
try {
t ? i = Ku(t) : $(e, "Missing package data");
} catch (t) {
$(e, `Invalid package file${n ? `: ${n}` : " from stdin"}. Error details:\n${t.message}`);
}
let a = yp(i, e);
Y(e, "\nCurrent versions:", "verbose"), Y(e, a, "verbose"), e.enginesNode && (e.nodeEngineVersion = i.engines?.node), e.peer && (e.peerDependencies = await up(Object.fromEntries(Object.entries(a).map(([e, t]) => [e, t && !Bn(t) && K.default.validRange(t) ? K.default.minVersion(t)?.version ?? t : t])), e));
let [o, c, l] = await mp(a, e), u = q(c, (e, t) => t.version ? { [e]: t.version } : null), d = q(c, (e, t) => t.error ? { [e]: t.error } : null), { time: f, skippedByCooldown: p, numCooldown: m } = Jf(c);
e.peer && (Y(e, "\nupgradedPeerDependencies:", "verbose"), Y(e, l, "verbose")), Y(e, `\n${typeof e.target == "string" ? `${e.target[0].toUpperCase()}${e.target.slice(1)}` : "Fetched"} versions:`, "verbose"), Y(e, u, "verbose"), Y(e, "\nUpgraded versions:", "verbose"), Y(e, o, "verbose");
let h = e.minimal ? q(o, (e, t) => K.default.satisfies(u[e], a[e]) ? null : { [e]: t }) : o, g = (e.format || []).includes("ownerChanged") ? await Ap(a, h, e) : void 0, _ = e.interactive ? await jp(a, h, p, f, n, e) : h;
if (!e.json || e.deep) {
if (await Pr(e.interactive ? {
...e,
format: (e.format || []).filter((e) => e !== "group")
} : e, {
current: a,
upgraded: _,
skippedByCooldown: p,
total: Object.keys(o).length,
latest: c,
numCooldown: m,
ownersChangedDeps: g,
pkgFile: n || void 0,
errors: d,
time: f
}), e.peer) {
let t = await Cp(a, o, l, e);
Object.keys(t).length > 0 && Fr(e, t);
}
if (e.enginesNode) {
let t = await Sp(a, o, e);
Object.keys(t).length > 0 && Ir(e, t);
}
}
let v = await nd(t, a, _, e, n || void 0, u, r), y = e.jsonAll ? td(n, v) : e.jsonDeps && n?.endsWith(".json") ? uu(Ku(v), pu(e.dep)) : _, b;
if (e.json && !e.deep && Cr(e, y), Object.keys(h).length > 0 && n) {
if (e.upgrade) b = s.writeFile(n, v);
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;
Y(e, `\nRun ${J.cyan(`${t}${r} -u`)} to upgrade ${e.packageFile || "package.json"}`);
}
}
return await b, y;
}
//#endregion
//#region src/index.ts
var Np = !1, Pp = null, Fp = !1;
function Ip() {
Fp || (Fp = !0, process.env.INJECT_PROMPTS && Te.default.inject(JSON.parse(process.env.INJECT_PROMPTS)), process.on("unhandledRejection", (e) => {
Y(Pp ?? {}, Sr(e), null, "error"), Np = !0;
}), process.on("exit", () => {
Np && Pp && $(Pp, `Unhandled Rejection! This is a bug and should be reported: ${De.bugs.url}`);
}));
}
var Lp = (e) => {
e.global && (process.env.VOLTA_HOME || process.env.PATH?.includes("\\Volta")) && (Y(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));
}, Rp = async (e, t) => {
let n = {
...e,
cwd: e.cwd || o.resolve(t, ".."),
packageFile: t
};
return e.packageManager === "staticRegistry" ? await Oi({
...n,
packageManager: void 0
}) : e.packageManager && e.packageManager !== "npm" ? e.packageManager : await Oi(n);
}, zp = (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);
}, Bp = async (e, t, n) => {
if (n.install === "never") {
Y(n, "");
return;
}
if (!zp(e, t, n)) return;
let r = await Rp(n, e[0]), i = `Run ${J.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" && (Y(n, ""), s = await (0, Te.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" && Y(n, ""), Y(n, "Installing dependencies...");
let t = n.workspaces || n.workspace?.length ? ["package.json"] : e;
for (let e of t) {
let t = await Rp(n, e), r = n.cwd || o.resolve(e, ".."), i = "";
try {
await Ai(t, ["install"], {
stdout: (e) => {
i += e;
},
stderr: (e) => {
console.error(J.red(e.toString()));
}
}, {
cwd: r,
env: {
...process.env,
...n.color === !1 ? null : { FORCE_COLOR: !0 },
...t === "pnpm" ? { npm_config_strict_peer_dependencies: !1 } : null
}
}), Y(n, i), Y(n, "Done");
} catch (e) {
let t = e instanceof Error ? e.message : String(e);
Y(n, Sr(e instanceof Ee.SpawnError && !e.stderr.trim() && i ? i : t), null, "error"), $(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 || Y(n, `\n${i}.`);
};
async function Vp(e, t) {
let [n, r] = await Pf(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 hp(e);
return clearTimeout(t), n;
}
if (e.deep) {
let t = {};
for (let [i, a] of n.entries()) {
let n = i > 0, s = Bf((await Rf({
packageFile: a.filepath,
options: e
})).config, e);
e.mergeConfig && Object.keys(s).length && (s = qf(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.catalog) {
l = a.pkgFile, u = a.filepath, d = a.filepath;
let e = o.resolve(d);
n && Y(c, ""), Y(c, `${c.upgrade ? "Upgrading" : "Checking"} ${e} catalog dependencies`);
} else {
n && Y(c, "");
let e = await sd(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 Mp(c, l, u, a.catalog);
}
s = t, e.json && Cr(e, s);
} else {
n.length === 1 && n[0].filepath !== (e.packageFile || "package.json") && (e.packageFile = n[0].filepath);
let { pkgData: t, pkgFile: r } = await sd(e);
i.length === 0 && r && (i = [r]), s = await Mp(e, t, r);
}
return clearTimeout(t), e.errorLevel === 2 && zp(i, s, e) && $(e, "\nDependencies not up-to-date"), e.upgrade && (e.packageManager === "deno" ? Y(e, "") : await Bp(i, s, e)), s;
}
async function Hp(e = {}, { cli: t } = {}) {
t && Ip(), Np = !1;
let n = await Gf(e, { cli: t });
Pp = n, Sn(n.color), Lp(n), Y(n, "Initializing", "verbose"), n.cacheClear && await Hr(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, od(Hp, n)]);
Y(n, `Usage: ncu --doctor\n\n${typeof vi.doctor.help == "function" ? vi.doctor.help({}) : vi.doctor.help}`, "warn");
} else return Promise.race([i, Vp(n, r)]);
}
var Up = Hp;
Up.run = Up, Up.defineConfig = bi;
//#endregion
export { De as _, vi as a, Wr as c, on as d, Up as default, Up as run, bi as defineConfig, tn as f, Me as g, lt as h, du as i, xn as l, bt as m, ep as n, yi as o, Wt as p, Rf as r, ei as s, rp as t, Sn as u };
//# sourceMappingURL=index.js.map