lakutata
Version:
An IoC-based universal application framework.
2,090 lines (1,889 loc) • 138 kB
JavaScript
/* Build Date: Mon Jan 05 2026 23:52:23 GMT+0800 (China Standard Time) */
import t from "os";
import * as e from "path";
import r from "path";
import { i as n } from "../../../vendor/Package.internal.8.mjs";
import s from "util";
import i from "stream";
import o from "events";
import a from "fs";
import { c as u } from "../../../vendor/Package.internal.2.mjs";
import { flatten as c } from "./Utils.mjs";
import "./FunctionTokenizer.mjs";
import "../../../vendor/Package.internal.7.mjs";
import "../../../vendor/Package.internal.3.mjs";
import "../base/internal/DataValidator.mjs";
import "../../../vendor/Package.internal.1.mjs";
import "node:util/types";
import "../validation/VLD.mjs";
import "url";
import "../../exceptions/dto/InvalidValueException.mjs";
import "../base/abstracts/Exception.mjs";
import "../../../vendor/Package.internal.5.mjs";
import "../helpers/As.mjs";
import "../../../vendor/Package.internal.6.mjs";
import "../base/internal/ThrowWarning.mjs";
import "../helpers/Templating.mjs";
import "../base/internal/CamelCase.mjs";
import "../helpers/NoCase.mjs";
import "../helpers/DevNull.mjs";
import "../helpers/IsHtml.mjs";
import "../helpers/IsXML.mjs";
import "../../constants/DTOMetadataKey.mjs";
import "../helpers/ObjectConstructor.mjs";
import "../helpers/ObjectParentConstructors.mjs";
import "../helpers/ObjectParentConstructor.mjs";
import "../helpers/ObjectPrototype.mjs";
var l = {};
var f = {};
var p = {};
Object.defineProperty(p, "__esModule", {
value: true
});
p.splitWhen = p.flatten = void 0;
function h(t) {
return t.reduce((t, e) => [].concat(t, e), []);
}
p.flatten = h;
function d(t, e) {
const r = [ [] ];
let n = 0;
for (const s of t) {
if (e(s)) {
n++;
r[n] = [];
} else {
r[n].push(s);
}
}
return r;
}
p.splitWhen = d;
var _ = {};
Object.defineProperty(_, "__esModule", {
value: true
});
_.isEnoentCodeError = void 0;
function g(t) {
return t.code === "ENOENT";
}
_.isEnoentCodeError = g;
var y = {};
Object.defineProperty(y, "__esModule", {
value: true
});
y.createDirentFromStats = void 0;
let m = class DirentFromStats {
constructor(t, e) {
this.name = t;
this.isBlockDevice = e.isBlockDevice.bind(e);
this.isCharacterDevice = e.isCharacterDevice.bind(e);
this.isDirectory = e.isDirectory.bind(e);
this.isFIFO = e.isFIFO.bind(e);
this.isFile = e.isFile.bind(e);
this.isSocket = e.isSocket.bind(e);
this.isSymbolicLink = e.isSymbolicLink.bind(e);
}
};
function v(t, e) {
return new m(t, e);
}
y.createDirentFromStats = v;
var S = {};
Object.defineProperty(S, "__esModule", {
value: true
});
S.convertPosixPathToPattern = S.convertWindowsPathToPattern = S.convertPathToPattern = S.escapePosixPath = S.escapeWindowsPath = S.escape = S.removeLeadingDotSegment = S.makeAbsolute = S.unixify = void 0;
const A = t;
const E = r;
const b = A.platform() === "win32";
const R = 2;
const P = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
const x = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
const C = /^\\\\([.?])/;
const w = /\\(?![!()+@[\]{}])/g;
function T(t) {
return t.replace(/\\/g, "/");
}
S.unixify = T;
function k(t, e) {
return E.resolve(t, e);
}
S.makeAbsolute = k;
function O(t) {
if (t.charAt(0) === ".") {
const e = t.charAt(1);
if (e === "/" || e === "\\") {
return t.slice(R);
}
}
return t;
}
S.removeLeadingDotSegment = O;
S.escape = b ? L : H;
function L(t) {
return t.replace(x, "\\$2");
}
S.escapeWindowsPath = L;
function H(t) {
return t.replace(P, "\\$2");
}
S.escapePosixPath = H;
S.convertPathToPattern = b ? $ : M;
function $(t) {
return L(t).replace(C, "//$1").replace(w, "/");
}
S.convertWindowsPathToPattern = $;
function M(t) {
return H(t);
}
S.convertPosixPathToPattern = M;
var D = {};
var F = n;
var I = r.posix.dirname;
var N = t.platform() === "win32";
var j = "/";
var B = /\\/g;
var G = /[\{\[].*[\}\]]$/;
var U = /(^|[^\\])([\{\[]|\([^\)]+$)/;
var W = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
var K = function t(e, r) {
var n = Object.assign({
flipBackslashes: true
}, r);
if (n.flipBackslashes && N && e.indexOf(j) < 0) {
e = e.replace(B, j);
}
if (G.test(e)) {
e += j;
}
e += "a";
do {
e = I(e);
} while (F(e) || U.test(e));
return e.replace(W, "$1");
};
var V = {};
(function(t) {
t.isInteger = t => {
if (typeof t === "number") {
return Number.isInteger(t);
}
if (typeof t === "string" && t.trim() !== "") {
return Number.isInteger(Number(t));
}
return false;
};
t.find = (t, e) => t.nodes.find(t => t.type === e);
t.exceedsLimit = (e, r, n = 1, s) => {
if (s === false) return false;
if (!t.isInteger(e) || !t.isInteger(r)) return false;
return (Number(r) - Number(e)) / Number(n) >= s;
};
t.escapeNode = (t, e = 0, r) => {
const n = t.nodes[e];
if (!n) return;
if (r && n.type === r || n.type === "open" || n.type === "close") {
if (n.escaped !== true) {
n.value = "\\" + n.value;
n.escaped = true;
}
}
};
t.encloseBrace = t => {
if (t.type !== "brace") return false;
if (t.commas >> 0 + t.ranges >> 0 === 0) {
t.invalid = true;
return true;
}
return false;
};
t.isInvalidBrace = t => {
if (t.type !== "brace") return false;
if (t.invalid === true || t.dollar) return true;
if (t.commas >> 0 + t.ranges >> 0 === 0) {
t.invalid = true;
return true;
}
if (t.open !== true || t.close !== true) {
t.invalid = true;
return true;
}
return false;
};
t.isOpenOrClose = t => {
if (t.type === "open" || t.type === "close") {
return true;
}
return t.open === true || t.close === true;
};
t.reduce = t => t.reduce((t, e) => {
if (e.type === "text") t.push(e.value);
if (e.type === "range") e.type = "text";
return t;
}, []);
t.flatten = (...t) => {
const e = [];
const r = t => {
for (let n = 0; n < t.length; n++) {
const s = t[n];
if (Array.isArray(s)) {
r(s);
continue;
}
if (s !== undefined) {
e.push(s);
}
}
return e;
};
r(t);
return e;
};
})(V);
const Q = V;
var q = (t, e = {}) => {
const r = (t, n = {}) => {
const s = e.escapeInvalid && Q.isInvalidBrace(n);
const i = t.invalid === true && e.escapeInvalid === true;
let o = "";
if (t.value) {
if ((s || i) && Q.isOpenOrClose(t)) {
return "\\" + t.value;
}
return t.value;
}
if (t.value) {
return t.value;
}
if (t.nodes) {
for (const e of t.nodes) {
o += r(e);
}
}
return o;
};
return r(t);
};
var X = function(t) {
if (typeof t === "number") {
return t - t === 0;
}
if (typeof t === "string" && t.trim() !== "") {
return Number.isFinite ? Number.isFinite(+t) : isFinite(+t);
}
return false;
};
const Y = X;
const Z = (t, e, r) => {
if (Y(t) === false) {
throw new TypeError("toRegexRange: expected the first argument to be a number");
}
if (e === void 0 || t === e) {
return String(t);
}
if (Y(e) === false) {
throw new TypeError("toRegexRange: expected the second argument to be a number.");
}
let n = {
relaxZeros: true,
...r
};
if (typeof n.strictZeros === "boolean") {
n.relaxZeros = n.strictZeros === false;
}
let s = String(n.relaxZeros);
let i = String(n.shorthand);
let o = String(n.capture);
let a = String(n.wrap);
let u = t + ":" + e + "=" + s + i + o + a;
if (Z.cache.hasOwnProperty(u)) {
return Z.cache[u].result;
}
let c = Math.min(t, e);
let l = Math.max(t, e);
if (Math.abs(c - l) === 1) {
let r = t + "|" + e;
if (n.capture) {
return `(${r})`;
}
if (n.wrap === false) {
return r;
}
return `(?:${r})`;
}
let f = lt(t) || lt(e);
let p = {
min: t,
max: e,
a: c,
b: l
};
let h = [];
let d = [];
if (f) {
p.isPadded = f;
p.maxLen = String(p.max).length;
}
if (c < 0) {
let t = l < 0 ? Math.abs(l) : 1;
d = et(t, Math.abs(c), p, n);
c = p.a = 0;
}
if (l >= 0) {
h = et(c, l, p, n);
}
p.negatives = d;
p.positives = h;
p.result = z(d, h);
if (n.capture === true) {
p.result = `(${p.result})`;
} else if (n.wrap !== false && h.length + d.length > 1) {
p.result = `(?:${p.result})`;
}
Z.cache[u] = p;
return p.result;
};
function z(t, e, r) {
let n = rt(t, e, "-", false) || [];
let s = rt(e, t, "", false) || [];
let i = rt(t, e, "-?", true) || [];
let o = n.concat(i).concat(s);
return o.join("|");
}
function J(t, e) {
let r = 1;
let n = 1;
let s = ot(t, r);
let i = new Set([ e ]);
while (t <= s && s <= e) {
i.add(s);
r += 1;
s = ot(t, r);
}
s = at(e + 1, n) - 1;
while (t < s && s <= e) {
i.add(s);
n += 1;
s = at(e + 1, n) - 1;
}
i = [ ...i ];
i.sort(st);
return i;
}
function tt(t, e, r) {
if (t === e) {
return {
pattern: t,
count: [],
digits: 0
};
}
let n = nt(t, e);
let s = n.length;
let i = "";
let o = 0;
for (let t = 0; t < s; t++) {
let [e, r] = n[t];
if (e === r) {
i += e;
} else if (e !== "0" || r !== "9") {
i += ct(e, r);
} else {
o++;
}
}
if (o) {
i += r.shorthand === true ? "\\d" : "[0-9]";
}
return {
pattern: i,
count: [ o ],
digits: s
};
}
function et(t, e, r, n) {
let s = J(t, e);
let i = [];
let o = t;
let a;
for (let t = 0; t < s.length; t++) {
let e = s[t];
let u = tt(String(o), String(e), n);
let c = "";
if (!r.isPadded && a && a.pattern === u.pattern) {
if (a.count.length > 1) {
a.count.pop();
}
a.count.push(u.count[0]);
a.string = a.pattern + ut(a.count);
o = e + 1;
continue;
}
if (r.isPadded) {
c = ft(e, r, n);
}
u.string = c + u.pattern + ut(u.count);
i.push(u);
o = e + 1;
a = u;
}
return i;
}
function rt(t, e, r, n, s) {
let i = [];
for (let s of t) {
let {string: t} = s;
if (!n && !it(e, "string", t)) {
i.push(r + t);
}
if (n && it(e, "string", t)) {
i.push(r + t);
}
}
return i;
}
function nt(t, e) {
let r = [];
for (let n = 0; n < t.length; n++) r.push([ t[n], e[n] ]);
return r;
}
function st(t, e) {
return t > e ? 1 : e > t ? -1 : 0;
}
function it(t, e, r) {
return t.some(t => t[e] === r);
}
function ot(t, e) {
return Number(String(t).slice(0, -e) + "9".repeat(e));
}
function at(t, e) {
return t - t % Math.pow(10, e);
}
function ut(t) {
let [e = 0, r = ""] = t;
if (r || e > 1) {
return `{${e + (r ? "," + r : "")}}`;
}
return "";
}
function ct(t, e, r) {
return `[${t}${e - t === 1 ? "" : "-"}${e}]`;
}
function lt(t) {
return /^-?(0+)\d/.test(t);
}
function ft(t, e, r) {
if (!e.isPadded) {
return t;
}
let n = Math.abs(e.maxLen - String(t).length);
let s = r.relaxZeros !== false;
switch (n) {
case 0:
return "";
case 1:
return s ? "0?" : "0";
case 2:
return s ? "0{0,2}" : "00";
default:
{
return s ? `0{0,${n}}` : `0{${n}}`;
}
}
}
Z.cache = {};
Z.clearCache = () => Z.cache = {};
var pt = Z;
const ht = s;
const dt = pt;
const _t = t => t !== null && typeof t === "object" && !Array.isArray(t);
const gt = t => e => t === true ? Number(e) : String(e);
const yt = t => typeof t === "number" || typeof t === "string" && t !== "";
const mt = t => Number.isInteger(+t);
const vt = t => {
let e = `${t}`;
let r = -1;
if (e[0] === "-") e = e.slice(1);
if (e === "0") return false;
while (e[++r] === "0") ;
return r > 0;
};
const St = (t, e, r) => {
if (typeof t === "string" || typeof e === "string") {
return true;
}
return r.stringify === true;
};
const At = (t, e, r) => {
if (e > 0) {
let r = t[0] === "-" ? "-" : "";
if (r) t = t.slice(1);
t = r + t.padStart(r ? e - 1 : e, "0");
}
if (r === false) {
return String(t);
}
return t;
};
const Et = (t, e) => {
let r = t[0] === "-" ? "-" : "";
if (r) {
t = t.slice(1);
e--;
}
while (t.length < e) t = "0" + t;
return r ? "-" + t : t;
};
const bt = (t, e, r) => {
t.negatives.sort((t, e) => t < e ? -1 : t > e ? 1 : 0);
t.positives.sort((t, e) => t < e ? -1 : t > e ? 1 : 0);
let n = e.capture ? "" : "?:";
let s = "";
let i = "";
let o;
if (t.positives.length) {
s = t.positives.map(t => Et(String(t), r)).join("|");
}
if (t.negatives.length) {
i = `-(${n}${t.negatives.map(t => Et(String(t), r)).join("|")})`;
}
if (s && i) {
o = `${s}|${i}`;
} else {
o = s || i;
}
if (e.wrap) {
return `(${n}${o})`;
}
return o;
};
const Rt = (t, e, r, n) => {
if (r) {
return dt(t, e, {
wrap: false,
...n
});
}
let s = String.fromCharCode(t);
if (t === e) return s;
let i = String.fromCharCode(e);
return `[${s}-${i}]`;
};
const Pt = (t, e, r) => {
if (Array.isArray(t)) {
let e = r.wrap === true;
let n = r.capture ? "" : "?:";
return e ? `(${n}${t.join("|")})` : t.join("|");
}
return dt(t, e, r);
};
const xt = (...t) => new RangeError("Invalid range arguments: " + ht.inspect(...t));
const Ct = (t, e, r) => {
if (r.strictRanges === true) throw xt([ t, e ]);
return [];
};
const wt = (t, e) => {
if (e.strictRanges === true) {
throw new TypeError(`Expected step "${t}" to be a number`);
}
return [];
};
const Tt = (t, e, r = 1, n = {}) => {
let s = Number(t);
let i = Number(e);
if (!Number.isInteger(s) || !Number.isInteger(i)) {
if (n.strictRanges === true) throw xt([ t, e ]);
return [];
}
if (s === 0) s = 0;
if (i === 0) i = 0;
let o = s > i;
let a = String(t);
let u = String(e);
let c = String(r);
r = Math.max(Math.abs(r), 1);
let l = vt(a) || vt(u) || vt(c);
let f = l ? Math.max(a.length, u.length, c.length) : 0;
let p = l === false && St(t, e, n) === false;
let h = n.transform || gt(p);
if (n.toRegex && r === 1) {
return Rt(Et(t, f), Et(e, f), true, n);
}
let d = {
negatives: [],
positives: []
};
let _ = t => d[t < 0 ? "negatives" : "positives"].push(Math.abs(t));
let g = [];
let y = 0;
while (o ? s >= i : s <= i) {
if (n.toRegex === true && r > 1) {
_(s);
} else {
g.push(At(h(s, y), f, p));
}
s = o ? s - r : s + r;
y++;
}
if (n.toRegex === true) {
return r > 1 ? bt(d, n, f) : Pt(g, null, {
wrap: false,
...n
});
}
return g;
};
const kt = (t, e, r = 1, n = {}) => {
if (!mt(t) && t.length > 1 || !mt(e) && e.length > 1) {
return Ct(t, e, n);
}
let s = n.transform || (t => String.fromCharCode(t));
let i = `${t}`.charCodeAt(0);
let o = `${e}`.charCodeAt(0);
let a = i > o;
let u = Math.min(i, o);
let c = Math.max(i, o);
if (n.toRegex && r === 1) {
return Rt(u, c, false, n);
}
let l = [];
let f = 0;
while (a ? i >= o : i <= o) {
l.push(s(i, f));
i = a ? i - r : i + r;
f++;
}
if (n.toRegex === true) {
return Pt(l, null, {
wrap: false,
options: n
});
}
return l;
};
const Ot = (t, e, r, n = {}) => {
if (e == null && yt(t)) {
return [ t ];
}
if (!yt(t) || !yt(e)) {
return Ct(t, e, n);
}
if (typeof r === "function") {
return Ot(t, e, 1, {
transform: r
});
}
if (_t(r)) {
return Ot(t, e, 0, r);
}
let s = {
...n
};
if (s.capture === true) s.wrap = true;
r = r || s.step || 1;
if (!mt(r)) {
if (r != null && !_t(r)) return wt(r, s);
return Ot(t, e, 1, r);
}
if (mt(t) && mt(e)) {
return Tt(t, e, r, s);
}
return kt(t, e, Math.max(Math.abs(r), 1), s);
};
var Lt = Ot;
const Ht = Lt;
const $t = V;
const Mt = (t, e = {}) => {
const r = (t, n = {}) => {
const s = $t.isInvalidBrace(n);
const i = t.invalid === true && e.escapeInvalid === true;
const o = s === true || i === true;
const a = e.escapeInvalid === true ? "\\" : "";
let u = "";
if (t.isOpen === true) {
return a + t.value;
}
if (t.isClose === true) {
console.log("node.isClose", a, t.value);
return a + t.value;
}
if (t.type === "open") {
return o ? a + t.value : "(";
}
if (t.type === "close") {
return o ? a + t.value : ")";
}
if (t.type === "comma") {
return t.prev.type === "comma" ? "" : o ? t.value : "|";
}
if (t.value) {
return t.value;
}
if (t.nodes && t.ranges > 0) {
const r = $t.reduce(t.nodes);
const n = Ht(...r, {
...e,
wrap: false,
toRegex: true,
strictZeros: true
});
if (n.length !== 0) {
return r.length > 1 && n.length > 1 ? `(${n})` : n;
}
}
if (t.nodes) {
for (const e of t.nodes) {
u += r(e, t);
}
}
return u;
};
return r(t);
};
var Dt = Mt;
const Ft = Lt;
const It = q;
const Nt = V;
const jt = (t = "", e = "", r = false) => {
const n = [];
t = [].concat(t);
e = [].concat(e);
if (!e.length) return t;
if (!t.length) {
return r ? Nt.flatten(e).map(t => `{${t}}`) : e;
}
for (const s of t) {
if (Array.isArray(s)) {
for (const t of s) {
n.push(jt(t, e, r));
}
} else {
for (let t of e) {
if (r === true && typeof t === "string") t = `{${t}}`;
n.push(Array.isArray(t) ? jt(s, t, r) : s + t);
}
}
}
return Nt.flatten(n);
};
const Bt = (t, e = {}) => {
const r = e.rangeLimit === undefined ? 1e3 : e.rangeLimit;
const n = (t, s = {}) => {
t.queue = [];
let i = s;
let o = s.queue;
while (i.type !== "brace" && i.type !== "root" && i.parent) {
i = i.parent;
o = i.queue;
}
if (t.invalid || t.dollar) {
o.push(jt(o.pop(), It(t, e)));
return;
}
if (t.type === "brace" && t.invalid !== true && t.nodes.length === 2) {
o.push(jt(o.pop(), [ "{}" ]));
return;
}
if (t.nodes && t.ranges > 0) {
const n = Nt.reduce(t.nodes);
if (Nt.exceedsLimit(...n, e.step, r)) {
throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
}
let s = Ft(...n, e);
if (s.length === 0) {
s = It(t, e);
}
o.push(jt(o.pop(), s));
t.nodes = [];
return;
}
const a = Nt.encloseBrace(t);
let u = t.queue;
let c = t;
while (c.type !== "brace" && c.type !== "root" && c.parent) {
c = c.parent;
u = c.queue;
}
for (let e = 0; e < t.nodes.length; e++) {
const r = t.nodes[e];
if (r.type === "comma" && t.type === "brace") {
if (e === 1) u.push("");
u.push("");
continue;
}
if (r.type === "close") {
o.push(jt(o.pop(), u, a));
continue;
}
if (r.value && r.type !== "open") {
u.push(jt(u.pop(), r.value));
continue;
}
if (r.nodes) {
n(r, t);
}
}
return u;
};
return Nt.flatten(n(t));
};
var Gt = Bt;
var Ut = {
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: " ",
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: "\t",
CHAR_UNDERSCORE: "_",
CHAR_VERTICAL_LINE: "|",
CHAR_ZERO_WIDTH_NOBREAK_SPACE: "\ufeff"
};
const Wt = q;
const {MAX_LENGTH: Kt, CHAR_BACKSLASH: Vt, CHAR_BACKTICK: Qt, CHAR_COMMA: qt, CHAR_DOT: Xt, CHAR_LEFT_PARENTHESES: Yt, CHAR_RIGHT_PARENTHESES: Zt, CHAR_LEFT_CURLY_BRACE: zt, CHAR_RIGHT_CURLY_BRACE: Jt, CHAR_LEFT_SQUARE_BRACKET: te, CHAR_RIGHT_SQUARE_BRACKET: ee, CHAR_DOUBLE_QUOTE: re, CHAR_SINGLE_QUOTE: ne, CHAR_NO_BREAK_SPACE: se, CHAR_ZERO_WIDTH_NOBREAK_SPACE: ie} = Ut;
const oe = (t, e = {}) => {
if (typeof t !== "string") {
throw new TypeError("Expected a string");
}
const r = e || {};
const n = typeof r.maxLength === "number" ? Math.min(Kt, r.maxLength) : Kt;
if (t.length > n) {
throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);
}
const s = {
type: "root",
input: t,
nodes: []
};
const i = [ s ];
let o = s;
let a = s;
let u = 0;
const c = t.length;
let l = 0;
let f = 0;
let p;
const h = () => t[l++];
const d = t => {
if (t.type === "text" && a.type === "dot") {
a.type = "text";
}
if (a && a.type === "text" && t.type === "text") {
a.value += t.value;
return;
}
o.nodes.push(t);
t.parent = o;
t.prev = a;
a = t;
return t;
};
d({
type: "bos"
});
while (l < c) {
o = i[i.length - 1];
p = h();
if (p === ie || p === se) {
continue;
}
if (p === Vt) {
d({
type: "text",
value: (e.keepEscaping ? p : "") + h()
});
continue;
}
if (p === ee) {
d({
type: "text",
value: "\\" + p
});
continue;
}
if (p === te) {
u++;
let t;
while (l < c && (t = h())) {
p += t;
if (t === te) {
u++;
continue;
}
if (t === Vt) {
p += h();
continue;
}
if (t === ee) {
u--;
if (u === 0) {
break;
}
}
}
d({
type: "text",
value: p
});
continue;
}
if (p === Yt) {
o = d({
type: "paren",
nodes: []
});
i.push(o);
d({
type: "text",
value: p
});
continue;
}
if (p === Zt) {
if (o.type !== "paren") {
d({
type: "text",
value: p
});
continue;
}
o = i.pop();
d({
type: "text",
value: p
});
o = i[i.length - 1];
continue;
}
if (p === re || p === ne || p === Qt) {
const t = p;
let r;
if (e.keepQuotes !== true) {
p = "";
}
while (l < c && (r = h())) {
if (r === Vt) {
p += r + h();
continue;
}
if (r === t) {
if (e.keepQuotes === true) p += r;
break;
}
p += r;
}
d({
type: "text",
value: p
});
continue;
}
if (p === zt) {
f++;
const t = a.value && a.value.slice(-1) === "$" || o.dollar === true;
const e = {
type: "brace",
open: true,
close: false,
dollar: t,
depth: f,
commas: 0,
ranges: 0,
nodes: []
};
o = d(e);
i.push(o);
d({
type: "open",
value: p
});
continue;
}
if (p === Jt) {
if (o.type !== "brace") {
d({
type: "text",
value: p
});
continue;
}
const t = "close";
o = i.pop();
o.close = true;
d({
type: t,
value: p
});
f--;
o = i[i.length - 1];
continue;
}
if (p === qt && f > 0) {
if (o.ranges > 0) {
o.ranges = 0;
const t = o.nodes.shift();
o.nodes = [ t, {
type: "text",
value: Wt(o)
} ];
}
d({
type: "comma",
value: p
});
o.commas++;
continue;
}
if (p === Xt && f > 0 && o.commas === 0) {
const t = o.nodes;
if (f === 0 || t.length === 0) {
d({
type: "text",
value: p
});
continue;
}
if (a.type === "dot") {
o.range = [];
a.value += p;
a.type = "range";
if (o.nodes.length !== 3 && o.nodes.length !== 5) {
o.invalid = true;
o.ranges = 0;
a.type = "text";
continue;
}
o.ranges++;
o.args = [];
continue;
}
if (a.type === "range") {
t.pop();
const e = t[t.length - 1];
e.value += a.value + p;
a = e;
o.ranges--;
continue;
}
d({
type: "dot",
value: p
});
continue;
}
d({
type: "text",
value: p
});
}
do {
o = i.pop();
if (o.type !== "root") {
o.nodes.forEach(t => {
if (!t.nodes) {
if (t.type === "open") t.isOpen = true;
if (t.type === "close") t.isClose = true;
if (!t.nodes) t.type = "text";
t.invalid = true;
}
});
const t = i[i.length - 1];
const e = t.nodes.indexOf(o);
t.nodes.splice(e, 1, ...o.nodes);
}
} while (i.length > 0);
d({
type: "eos"
});
return s;
};
var ae = oe;
const ue = q;
const ce = Dt;
const le = Gt;
const fe = ae;
const pe = (t, e = {}) => {
let r = [];
if (Array.isArray(t)) {
for (const n of t) {
const t = pe.create(n, e);
if (Array.isArray(t)) {
r.push(...t);
} else {
r.push(t);
}
}
} else {
r = [].concat(pe.create(t, e));
}
if (e && e.expand === true && e.nodupes === true) {
r = [ ...new Set(r) ];
}
return r;
};
pe.parse = (t, e = {}) => fe(t, e);
pe.stringify = (t, e = {}) => {
if (typeof t === "string") {
return ue(pe.parse(t, e), e);
}
return ue(t, e);
};
pe.compile = (t, e = {}) => {
if (typeof t === "string") {
t = pe.parse(t, e);
}
return ce(t, e);
};
pe.expand = (t, e = {}) => {
if (typeof t === "string") {
t = pe.parse(t, e);
}
let r = le(t, e);
if (e.noempty === true) {
r = r.filter(Boolean);
}
if (e.nodupes === true) {
r = [ ...new Set(r) ];
}
return r;
};
pe.create = (t, e = {}) => {
if (t === "" || t.length < 3) {
return [ t ];
}
return e.expand !== true ? pe.compile(t, e) : pe.expand(t, e);
};
var he = pe;
var de = {};
const _e = r;
const ge = "\\\\/";
const ye = `[^${ge}]`;
const me = "\\.";
const ve = "\\+";
const Se = "\\?";
const Ae = "\\/";
const Ee = "(?=.)";
const be = "[^/]";
const Re = `(?:${Ae}|$)`;
const Pe = `(?:^|${Ae})`;
const xe = `${me}{1,2}${Re}`;
const Ce = `(?!${me})`;
const we = `(?!${Pe}${xe})`;
const Te = `(?!${me}{0,1}${Re})`;
const ke = `(?!${xe})`;
const Oe = `[^.${Ae}]`;
const Le = `${be}*?`;
const He = {
DOT_LITERAL: me,
PLUS_LITERAL: ve,
QMARK_LITERAL: Se,
SLASH_LITERAL: Ae,
ONE_CHAR: Ee,
QMARK: be,
END_ANCHOR: Re,
DOTS_SLASH: xe,
NO_DOT: Ce,
NO_DOTS: we,
NO_DOT_SLASH: Te,
NO_DOTS_SLASH: ke,
QMARK_NO_DOT: Oe,
STAR: Le,
START_ANCHOR: Pe
};
const $e = {
...He,
SLASH_LITERAL: `[${ge}]`,
QMARK: ye,
STAR: `${ye}*?`,
DOTS_SLASH: `${me}{1,2}(?:[${ge}]|$)`,
NO_DOT: `(?!${me})`,
NO_DOTS: `(?!(?:^|[${ge}])${me}{1,2}(?:[${ge}]|$))`,
NO_DOT_SLASH: `(?!${me}{0,1}(?:[${ge}]|$))`,
NO_DOTS_SLASH: `(?!${me}{1,2}(?:[${ge}]|$))`,
QMARK_NO_DOT: `[^.${ge}]`,
START_ANCHOR: `(?:^|[${ge}])`,
END_ANCHOR: `(?:[${ge}]|$)`
};
const Me = {
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"
};
var De = {
MAX_LENGTH: 1024 * 64,
POSIX_REGEX_SOURCE: Me,
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: {
"***": "*",
"**/**": "**",
"**/**/**": "**"
},
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: _e.sep,
extglobChars(t) {
return {
"!": {
type: "negate",
open: "(?:(?!(?:",
close: `))${t.STAR})`
},
"?": {
type: "qmark",
open: "(?:",
close: ")?"
},
"+": {
type: "plus",
open: "(?:",
close: ")+"
},
"*": {
type: "star",
open: "(?:",
close: ")*"
},
"@": {
type: "at",
open: "(?:",
close: ")"
}
};
},
globChars(t) {
return t === true ? $e : He;
}
};
(function(t) {
const e = r;
const n = process.platform === "win32";
const {REGEX_BACKSLASH: s, REGEX_REMOVE_BACKSLASH: i, REGEX_SPECIAL_CHARS: o, REGEX_SPECIAL_CHARS_GLOBAL: a} = De;
t.isObject = t => t !== null && typeof t === "object" && !Array.isArray(t);
t.hasRegexChars = t => o.test(t);
t.isRegexChar = e => e.length === 1 && t.hasRegexChars(e);
t.escapeRegex = t => t.replace(a, "\\$1");
t.toPosixSlashes = t => t.replace(s, "/");
t.removeBackslashes = t => t.replace(i, t => t === "\\" ? "" : t);
t.supportsLookbehinds = () => {
const t = process.version.slice(1).split(".").map(Number);
if (t.length === 3 && t[0] >= 9 || t[0] === 8 && t[1] >= 10) {
return true;
}
return false;
};
t.isWindows = t => {
if (t && typeof t.windows === "boolean") {
return t.windows;
}
return n === true || e.sep === "\\";
};
t.escapeLast = (e, r, n) => {
const s = e.lastIndexOf(r, n);
if (s === -1) return e;
if (e[s - 1] === "\\") return t.escapeLast(e, r, s - 1);
return `${e.slice(0, s)}\\${e.slice(s)}`;
};
t.removePrefix = (t, e = {}) => {
let r = t;
if (r.startsWith("./")) {
r = r.slice(2);
e.prefix = "./";
}
return r;
};
t.wrapOutput = (t, e = {}, r = {}) => {
const n = r.contains ? "" : "^";
const s = r.contains ? "" : "$";
let i = `${n}(?:${t})${s}`;
if (e.negated === true) {
i = `(?:^(?!${i}).*$)`;
}
return i;
};
})(de);
const Fe = de;
const {CHAR_ASTERISK: Ie, CHAR_AT: Ne, CHAR_BACKWARD_SLASH: je, CHAR_COMMA: Be, CHAR_DOT: Ge, CHAR_EXCLAMATION_MARK: Ue, CHAR_FORWARD_SLASH: We, CHAR_LEFT_CURLY_BRACE: Ke, CHAR_LEFT_PARENTHESES: Ve, CHAR_LEFT_SQUARE_BRACKET: Qe, CHAR_PLUS: qe, CHAR_QUESTION_MARK: Xe, CHAR_RIGHT_CURLY_BRACE: Ye, CHAR_RIGHT_PARENTHESES: Ze, CHAR_RIGHT_SQUARE_BRACKET: ze} = De;
const Je = t => t === We || t === je;
const tr = t => {
if (t.isPrefix !== true) {
t.depth = t.isGlobstar ? Infinity : 1;
}
};
const er = (t, e) => {
const r = e || {};
const n = t.length - 1;
const s = r.parts === true || r.scanToEnd === true;
const i = [];
const o = [];
const a = [];
let u = t;
let c = -1;
let l = 0;
let f = 0;
let p = false;
let h = false;
let d = false;
let _ = false;
let g = false;
let y = false;
let m = false;
let v = false;
let S = false;
let A = false;
let E = 0;
let b;
let R;
let P = {
value: "",
depth: 0,
isGlob: false
};
const x = () => c >= n;
const C = () => u.charCodeAt(c + 1);
const w = () => {
b = R;
return u.charCodeAt(++c);
};
while (c < n) {
R = w();
let t;
if (R === je) {
m = P.backslashes = true;
R = w();
if (R === Ke) {
y = true;
}
continue;
}
if (y === true || R === Ke) {
E++;
while (x() !== true && (R = w())) {
if (R === je) {
m = P.backslashes = true;
w();
continue;
}
if (R === Ke) {
E++;
continue;
}
if (y !== true && R === Ge && (R = w()) === Ge) {
p = P.isBrace = true;
d = P.isGlob = true;
A = true;
if (s === true) {
continue;
}
break;
}
if (y !== true && R === Be) {
p = P.isBrace = true;
d = P.isGlob = true;
A = true;
if (s === true) {
continue;
}
break;
}
if (R === Ye) {
E--;
if (E === 0) {
y = false;
p = P.isBrace = true;
A = true;
break;
}
}
}
if (s === true) {
continue;
}
break;
}
if (R === We) {
i.push(c);
o.push(P);
P = {
value: "",
depth: 0,
isGlob: false
};
if (A === true) continue;
if (b === Ge && c === l + 1) {
l += 2;
continue;
}
f = c + 1;
continue;
}
if (r.noext !== true) {
const t = R === qe || R === Ne || R === Ie || R === Xe || R === Ue;
if (t === true && C() === Ve) {
d = P.isGlob = true;
_ = P.isExtglob = true;
A = true;
if (R === Ue && c === l) {
S = true;
}
if (s === true) {
while (x() !== true && (R = w())) {
if (R === je) {
m = P.backslashes = true;
R = w();
continue;
}
if (R === Ze) {
d = P.isGlob = true;
A = true;
break;
}
}
continue;
}
break;
}
}
if (R === Ie) {
if (b === Ie) g = P.isGlobstar = true;
d = P.isGlob = true;
A = true;
if (s === true) {
continue;
}
break;
}
if (R === Xe) {
d = P.isGlob = true;
A = true;
if (s === true) {
continue;
}
break;
}
if (R === Qe) {
while (x() !== true && (t = w())) {
if (t === je) {
m = P.backslashes = true;
w();
continue;
}
if (t === ze) {
h = P.isBracket = true;
d = P.isGlob = true;
A = true;
break;
}
}
if (s === true) {
continue;
}
break;
}
if (r.nonegate !== true && R === Ue && c === l) {
v = P.negated = true;
l++;
continue;
}
if (r.noparen !== true && R === Ve) {
d = P.isGlob = true;
if (s === true) {
while (x() !== true && (R = w())) {
if (R === Ve) {
m = P.backslashes = true;
R = w();
continue;
}
if (R === Ze) {
A = true;
break;
}
}
continue;
}
break;
}
if (d === true) {
A = true;
if (s === true) {
continue;
}
break;
}
}
if (r.noext === true) {
_ = false;
d = false;
}
let T = u;
let k = "";
let O = "";
if (l > 0) {
k = u.slice(0, l);
u = u.slice(l);
f -= l;
}
if (T && d === true && f > 0) {
T = u.slice(0, f);
O = u.slice(f);
} else if (d === true) {
T = "";
O = u;
} else {
T = u;
}
if (T && T !== "" && T !== "/" && T !== u) {
if (Je(T.charCodeAt(T.length - 1))) {
T = T.slice(0, -1);
}
}
if (r.unescape === true) {
if (O) O = Fe.removeBackslashes(O);
if (T && m === true) {
T = Fe.removeBackslashes(T);
}
}
const L = {
prefix: k,
input: t,
start: l,
base: T,
glob: O,
isBrace: p,
isBracket: h,
isGlob: d,
isExtglob: _,
isGlobstar: g,
negated: v,
negatedExtglob: S
};
if (r.tokens === true) {
L.maxDepth = 0;
if (!Je(R)) {
o.push(P);
}
L.tokens = o;
}
if (r.parts === true || r.tokens === true) {
let e;
for (let n = 0; n < i.length; n++) {
const s = e ? e + 1 : l;
const u = i[n];
const c = t.slice(s, u);
if (r.tokens) {
if (n === 0 && l !== 0) {
o[n].isPrefix = true;
o[n].value = k;
} else {
o[n].value = c;
}
tr(o[n]);
L.maxDepth += o[n].depth;
}
if (n !== 0 || c !== "") {
a.push(c);
}
e = u;
}
if (e && e + 1 < t.length) {
const n = t.slice(e + 1);
a.push(n);
if (r.tokens) {
o[o.length - 1].value = n;
tr(o[o.length - 1]);
L.maxDepth += o[o.length - 1].depth;
}
}
L.slashes = i;
L.parts = a;
}
return L;
};
var rr = er;
const nr = De;
const sr = de;
const {MAX_LENGTH: ir, POSIX_REGEX_SOURCE: or, REGEX_NON_SPECIAL_CHARS: ar, REGEX_SPECIAL_CHARS_BACKREF: ur, REPLACEMENTS: cr} = nr;
const lr = (t, e) => {
if (typeof e.expandRange === "function") {
return e.expandRange(...t, e);
}
t.sort();
const r = `[${t.join("-")}]`;
try {
new RegExp(r);
} catch (e) {
return t.map(t => sr.escapeRegex(t)).join("..");
}
return r;
};
const fr = (t, e) => `Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`;
const pr = (t, e) => {
if (typeof t !== "string") {
throw new TypeError("Expected a string");
}
t = cr[t] || t;
const r = {
...e
};
const n = typeof r.maxLength === "number" ? Math.min(ir, r.maxLength) : ir;
let s = t.length;
if (s > n) {
throw new SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${n}`);
}
const i = {
type: "bos",
value: "",
output: r.prepend || ""
};
const o = [ i ];
const a = r.capture ? "" : "?:";
const u = sr.isWindows(e);
const c = nr.globChars(u);
const l = nr.extglobChars(c);
const {DOT_LITERAL: f, PLUS_LITERAL: p, SLASH_LITERAL: h, ONE_CHAR: d, DOTS_SLASH: _, NO_DOT: g, NO_DOT_SLASH: y, NO_DOTS_SLASH: m, QMARK: v, QMARK_NO_DOT: S, STAR: A, START_ANCHOR: E} = c;
const b = t => `(${a}(?:(?!${E}${t.dot ? _ : f}).)*?)`;
const R = r.dot ? "" : g;
const P = r.dot ? v : S;
let x = r.bash === true ? b(r) : A;
if (r.capture) {
x = `(${x})`;
}
if (typeof r.noext === "boolean") {
r.noextglob = r.noext;
}
const C = {
input: t,
index: -1,
start: 0,
dot: r.dot === true,
consumed: "",
output: "",
prefix: "",
backtrack: false,
negated: false,
brackets: 0,
braces: 0,
parens: 0,
quotes: 0,
globstar: false,
tokens: o
};
t = sr.removePrefix(t, C);
s = t.length;
const w = [];
const T = [];
const k = [];
let O = i;
let L;
const H = () => C.index === s - 1;
const $ = C.peek = (e = 1) => t[C.index + e];
const M = C.advance = () => t[++C.index] || "";
const D = () => t.slice(C.index + 1);
const F = (t = "", e = 0) => {
C.consumed += t;
C.index += e;
};
const I = t => {
C.output += t.output != null ? t.output : t.value;
F(t.value);
};
const N = () => {
let t = 1;
while ($() === "!" && ($(2) !== "(" || $(3) === "?")) {
M();
C.start++;
t++;
}
if (t % 2 === 0) {
return false;
}
C.negated = true;
C.start++;
return true;
};
const j = t => {
C[t]++;
k.push(t);
};
const B = t => {
C[t]--;
k.pop();
};
const G = t => {
if (O.type === "globstar") {
const e = C.braces > 0 && (t.type === "comma" || t.type === "brace");
const r = t.extglob === true || w.length && (t.type === "pipe" || t.type === "paren");
if (t.type !== "slash" && t.type !== "paren" && !e && !r) {
C.output = C.output.slice(0, -O.output.length);
O.type = "star";
O.value = "*";
O.output = x;
C.output += O.output;
}
}
if (w.length && t.type !== "paren") {
w[w.length - 1].inner += t.value;
}
if (t.value || t.output) I(t);
if (O && O.type === "text" && t.type === "text") {
O.value += t.value;
O.output = (O.output || "") + t.value;
return;
}
t.prev = O;
o.push(t);
O = t;
};
const U = (t, e) => {
const n = {
...l[e],
conditions: 1,
inner: ""
};
n.prev = O;
n.parens = C.parens;
n.output = C.output;
const s = (r.capture ? "(" : "") + n.open;
j("parens");
G({
type: t,
value: e,
output: C.output ? "" : d
});
G({
type: "paren",
extglob: true,
value: M(),
output: s
});
w.push(n);
};
const W = t => {
let n = t.close + (r.capture ? ")" : "");
let s;
if (t.type === "negate") {
let i = x;
if (t.inner && t.inner.length > 1 && t.inner.includes("/")) {
i = b(r);
}
if (i !== x || H() || /^\)+$/.test(D())) {
n = t.close = `)$))${i}`;
}
if (t.inner.includes("*") && (s = D()) && /^\.[^\\/.]+$/.test(s)) {
const r = pr(s, {
...e,
fastpaths: false
}).output;
n = t.close = `)${r})${i})`;
}
if (t.prev.type === "bos") {
C.negatedExtglob = true;
}
}
G({
type: "paren",
extglob: true,
value: L,
output: n
});
B("parens");
};
if (r.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(t)) {
let n = false;
let s = t.replace(ur, (t, e, r, s, i, o) => {
if (s === "\\") {
n = true;
return t;