catlint 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4934 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x2)(function(x2) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x2 + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
14
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+
33
+ // src/config/types/config.ts
34
+ var defaultConfig = {
35
+ lint: {
36
+ includes: ["**/*.ts"],
37
+ excludes: ["node_modules/**"]
38
+ },
39
+ parsers: [],
40
+ rules: []
41
+ };
42
+
43
+ // src/rules/helpers/defaultAdapter.ts
44
+ var EMPTY_FN = () => [];
45
+ var defaultAdapter = (rule) => {
46
+ const { name, fn = EMPTY_FN, subrules = [] } = rule;
47
+ return {
48
+ name,
49
+ fn,
50
+ subrules: subrules.map(defaultAdapter)
51
+ };
52
+ };
53
+
54
+ // src/config/api/defineConfig.ts
55
+ function defineConfig(config) {
56
+ const normalizedConfig = {
57
+ ...config,
58
+ rules: config.rules.map((rule) => defaultAdapter(rule))
59
+ };
60
+ return normalizedConfig;
61
+ }
62
+
63
+ // src/config/types/configAdapter.ts
64
+ var adaptConfig = (config) => {
65
+ const normalizedConfig = {
66
+ ...config,
67
+ rules: config.rules.map((rule) => defaultAdapter(rule))
68
+ };
69
+ return normalizedConfig;
70
+ };
71
+
72
+ // src/config/api/loadConfig.ts
73
+ import path from "path";
74
+ import { pathToFileURL } from "url";
75
+ var loadConfigFromFile = async (filePath) => {
76
+ try {
77
+ const config = await import(pathToFileURL(filePath).href);
78
+ return adaptConfig(config.default);
79
+ } catch {
80
+ console.log(`No config file found at ${filePath}`);
81
+ return null;
82
+ }
83
+ };
84
+ var loadConfig = async (projectPath) => {
85
+ const configPath = path.join(process.cwd(), projectPath) + "/catlint.config";
86
+ const config = await loadConfigFromFile(configPath + ".js") ?? await loadConfigFromFile(configPath + ".ts");
87
+ if (!config) {
88
+ throw new Error("No config file found");
89
+ }
90
+ return config;
91
+ };
92
+
93
+ // src/core/api/linter.ts
94
+ function travelFile(file) {
95
+ const travelRule = (rule) => {
96
+ return {
97
+ name: rule.name,
98
+ messages: rule.fn(file),
99
+ subrules: rule.subrules.map(travelRule),
100
+ isCorrect: rule.fn(file).length === 0 && rule.subrules.every((r) => travelRule(r).isCorrect)
101
+ };
102
+ };
103
+ return travelRule;
104
+ }
105
+ function lintFile(file, rules) {
106
+ const results = rules.map((rule) => travelFile(file)(rule));
107
+ return results;
108
+ }
109
+
110
+ // node_modules/glob/dist/esm/index.min.js
111
+ import { fileURLToPath as Wi } from "url";
112
+ import { posix as mi, win32 as re } from "path";
113
+ import { fileURLToPath as gi } from "url";
114
+ import { lstatSync as wi, readdir as yi, readdirSync as bi, readlinkSync as Si, realpathSync as Ei } from "fs";
115
+ import * as xi from "fs";
116
+ import { lstat as Ci, readdir as Ti, readlink as Ai, realpath as ki } from "fs/promises";
117
+ import { EventEmitter as ee } from "events";
118
+ import Pe from "stream";
119
+ import { StringDecoder as ni } from "string_decoder";
120
+ var Gt = (n7, t, e) => {
121
+ let s = n7 instanceof RegExp ? ce(n7, e) : n7, i = t instanceof RegExp ? ce(t, e) : t, r = s !== null && i != null && ss(s, i, e);
122
+ return r && { start: r[0], end: r[1], pre: e.slice(0, r[0]), body: e.slice(r[0] + s.length, r[1]), post: e.slice(r[1] + i.length) };
123
+ };
124
+ var ce = (n7, t) => {
125
+ let e = t.match(n7);
126
+ return e ? e[0] : null;
127
+ };
128
+ var ss = (n7, t, e) => {
129
+ let s, i, r, o, h, a = e.indexOf(n7), l = e.indexOf(t, a + 1), u = a;
130
+ if (a >= 0 && l > 0) {
131
+ if (n7 === t) return [a, l];
132
+ for (s = [], r = e.length; u >= 0 && !h; ) {
133
+ if (u === a) s.push(u), a = e.indexOf(n7, u + 1);
134
+ else if (s.length === 1) {
135
+ let c = s.pop();
136
+ c !== void 0 && (h = [c, l]);
137
+ } else i = s.pop(), i !== void 0 && i < r && (r = i, o = l), l = e.indexOf(t, u + 1);
138
+ u = a < l && a >= 0 ? a : l;
139
+ }
140
+ s.length && o !== void 0 && (h = [r, o]);
141
+ }
142
+ return h;
143
+ };
144
+ var fe = "\0SLASH" + Math.random() + "\0";
145
+ var ue = "\0OPEN" + Math.random() + "\0";
146
+ var qt = "\0CLOSE" + Math.random() + "\0";
147
+ var de = "\0COMMA" + Math.random() + "\0";
148
+ var pe = "\0PERIOD" + Math.random() + "\0";
149
+ var is = new RegExp(fe, "g");
150
+ var rs = new RegExp(ue, "g");
151
+ var ns = new RegExp(qt, "g");
152
+ var os = new RegExp(de, "g");
153
+ var hs = new RegExp(pe, "g");
154
+ var as = /\\\\/g;
155
+ var ls = /\\{/g;
156
+ var cs = /\\}/g;
157
+ var fs = /\\,/g;
158
+ var us = /\\./g;
159
+ var ds = 1e5;
160
+ function Ht(n7) {
161
+ return isNaN(n7) ? n7.charCodeAt(0) : parseInt(n7, 10);
162
+ }
163
+ function ps(n7) {
164
+ return n7.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs, de).replace(us, pe);
165
+ }
166
+ function ms(n7) {
167
+ return n7.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os, ",").replace(hs, ".");
168
+ }
169
+ function me(n7) {
170
+ if (!n7) return [""];
171
+ let t = [], e = Gt("{", "}", n7);
172
+ if (!e) return n7.split(",");
173
+ let { pre: s, body: i, post: r } = e, o = s.split(",");
174
+ o[o.length - 1] += "{" + i + "}";
175
+ let h = me(r);
176
+ return r.length && (o[o.length - 1] += h.shift(), o.push.apply(o, h)), t.push.apply(t, o), t;
177
+ }
178
+ function ge(n7, t = {}) {
179
+ if (!n7) return [];
180
+ let { max: e = ds } = t;
181
+ return n7.slice(0, 2) === "{}" && (n7 = "\\{\\}" + n7.slice(2)), ht(ps(n7), e, true).map(ms);
182
+ }
183
+ function gs(n7) {
184
+ return "{" + n7 + "}";
185
+ }
186
+ function ws(n7) {
187
+ return /^-?0\d/.test(n7);
188
+ }
189
+ function ys(n7, t) {
190
+ return n7 <= t;
191
+ }
192
+ function bs(n7, t) {
193
+ return n7 >= t;
194
+ }
195
+ function ht(n7, t, e) {
196
+ let s = [], i = Gt("{", "}", n7);
197
+ if (!i) return [n7];
198
+ let r = i.pre, o = i.post.length ? ht(i.post, t, false) : [""];
199
+ if (/\$$/.test(i.pre)) for (let h = 0; h < o.length && h < t; h++) {
200
+ let a = r + "{" + i.body + "}" + o[h];
201
+ s.push(a);
202
+ }
203
+ else {
204
+ let h = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body), l = h || a, u = i.body.indexOf(",") >= 0;
205
+ if (!l && !u) return i.post.match(/,(?!,).*\}/) ? (n7 = i.pre + "{" + i.body + qt + i.post, ht(n7, t, true)) : [n7];
206
+ let c;
207
+ if (l) c = i.body.split(/\.\./);
208
+ else if (c = me(i.body), c.length === 1 && c[0] !== void 0 && (c = ht(c[0], t, false).map(gs), c.length === 1)) return o.map((f) => i.pre + c[0] + f);
209
+ let d;
210
+ if (l && c[0] !== void 0 && c[1] !== void 0) {
211
+ let f = Ht(c[0]), m = Ht(c[1]), p = Math.max(c[0].length, c[1].length), w = c.length === 3 && c[2] !== void 0 ? Math.abs(Ht(c[2])) : 1, g = ys;
212
+ m < f && (w *= -1, g = bs);
213
+ let E = c.some(ws);
214
+ d = [];
215
+ for (let y = f; g(y, m); y += w) {
216
+ let b;
217
+ if (a) b = String.fromCharCode(y), b === "\\" && (b = "");
218
+ else if (b = String(y), E) {
219
+ let z = p - b.length;
220
+ if (z > 0) {
221
+ let $ = new Array(z + 1).join("0");
222
+ y < 0 ? b = "-" + $ + b.slice(1) : b = $ + b;
223
+ }
224
+ }
225
+ d.push(b);
226
+ }
227
+ } else {
228
+ d = [];
229
+ for (let f = 0; f < c.length; f++) d.push.apply(d, ht(c[f], t, false));
230
+ }
231
+ for (let f = 0; f < d.length; f++) for (let m = 0; m < o.length && s.length < t; m++) {
232
+ let p = r + d[f] + o[m];
233
+ (!e || l || p) && s.push(p);
234
+ }
235
+ }
236
+ return s;
237
+ }
238
+ var at = (n7) => {
239
+ if (typeof n7 != "string") throw new TypeError("invalid pattern");
240
+ if (n7.length > 65536) throw new TypeError("pattern is too long");
241
+ };
242
+ var Ss = { "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true], "[:alpha:]": ["\\p{L}\\p{Nl}", true], "[:ascii:]": ["\\x00-\\x7f", false], "[:blank:]": ["\\p{Zs}\\t", true], "[:cntrl:]": ["\\p{Cc}", true], "[:digit:]": ["\\p{Nd}", true], "[:graph:]": ["\\p{Z}\\p{C}", true, true], "[:lower:]": ["\\p{Ll}", true], "[:print:]": ["\\p{C}", true], "[:punct:]": ["\\p{P}", true], "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true], "[:upper:]": ["\\p{Lu}", true], "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true], "[:xdigit:]": ["A-Fa-f0-9", false] };
243
+ var lt = (n7) => n7.replace(/[[\]\\-]/g, "\\$&");
244
+ var Es = (n7) => n7.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
245
+ var we = (n7) => n7.join("");
246
+ var ye = (n7, t) => {
247
+ let e = t;
248
+ if (n7.charAt(e) !== "[") throw new Error("not in a brace expression");
249
+ let s = [], i = [], r = e + 1, o = false, h = false, a = false, l = false, u = e, c = "";
250
+ t: for (; r < n7.length; ) {
251
+ let p = n7.charAt(r);
252
+ if ((p === "!" || p === "^") && r === e + 1) {
253
+ l = true, r++;
254
+ continue;
255
+ }
256
+ if (p === "]" && o && !a) {
257
+ u = r + 1;
258
+ break;
259
+ }
260
+ if (o = true, p === "\\" && !a) {
261
+ a = true, r++;
262
+ continue;
263
+ }
264
+ if (p === "[" && !a) {
265
+ for (let [w, [g, S, E]] of Object.entries(Ss)) if (n7.startsWith(w, r)) {
266
+ if (c) return ["$.", false, n7.length - e, true];
267
+ r += w.length, E ? i.push(g) : s.push(g), h = h || S;
268
+ continue t;
269
+ }
270
+ }
271
+ if (a = false, c) {
272
+ p > c ? s.push(lt(c) + "-" + lt(p)) : p === c && s.push(lt(p)), c = "", r++;
273
+ continue;
274
+ }
275
+ if (n7.startsWith("-]", r + 1)) {
276
+ s.push(lt(p + "-")), r += 2;
277
+ continue;
278
+ }
279
+ if (n7.startsWith("-", r + 1)) {
280
+ c = p, r += 2;
281
+ continue;
282
+ }
283
+ s.push(lt(p)), r++;
284
+ }
285
+ if (u < r) return ["", false, 0, false];
286
+ if (!s.length && !i.length) return ["$.", false, n7.length - e, true];
287
+ if (i.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !l) {
288
+ let p = s[0].length === 2 ? s[0].slice(-1) : s[0];
289
+ return [Es(p), false, u - e, false];
290
+ }
291
+ let d = "[" + (l ? "^" : "") + we(s) + "]", f = "[" + (l ? "" : "^") + we(i) + "]";
292
+ return [s.length && i.length ? "(" + d + "|" + f + ")" : s.length ? d : f, h, u - e, true];
293
+ };
294
+ var W = (n7, { windowsPathsNoEscape: t = false, magicalBraces: e = true } = {}) => e ? t ? n7.replace(/\[([^\/\\])\]/g, "$1") : n7.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1") : t ? n7.replace(/\[([^\/\\{}])\]/g, "$1") : n7.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
295
+ var xs = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
296
+ var be = (n7) => xs.has(n7);
297
+ var vs = "(?!(?:^|/)\\.\\.?(?:$|/))";
298
+ var Ct = "(?!\\.)";
299
+ var Cs = /* @__PURE__ */ new Set(["[", "."]);
300
+ var Ts = /* @__PURE__ */ new Set(["..", "."]);
301
+ var As = new Set("().*{}+?[]^$\\!");
302
+ var ks = (n7) => n7.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
303
+ var Kt = "[^/]";
304
+ var Se = Kt + "*?";
305
+ var Ee = Kt + "+?";
306
+ var Q = class n {
307
+ type;
308
+ #t;
309
+ #s;
310
+ #n = false;
311
+ #r = [];
312
+ #o;
313
+ #S;
314
+ #w;
315
+ #c = false;
316
+ #h;
317
+ #u;
318
+ #f = false;
319
+ constructor(t, e, s = {}) {
320
+ this.type = t, t && (this.#s = true), this.#o = e, this.#t = this.#o ? this.#o.#t : this, this.#h = this.#t === this ? s : this.#t.#h, this.#w = this.#t === this ? [] : this.#t.#w, t === "!" && !this.#t.#c && this.#w.push(this), this.#S = this.#o ? this.#o.#r.length : 0;
321
+ }
322
+ get hasMagic() {
323
+ if (this.#s !== void 0) return this.#s;
324
+ for (let t of this.#r) if (typeof t != "string" && (t.type || t.hasMagic)) return this.#s = true;
325
+ return this.#s;
326
+ }
327
+ toString() {
328
+ return this.#u !== void 0 ? this.#u : this.type ? this.#u = this.type + "(" + this.#r.map((t) => String(t)).join("|") + ")" : this.#u = this.#r.map((t) => String(t)).join("");
329
+ }
330
+ #a() {
331
+ if (this !== this.#t) throw new Error("should only call on root");
332
+ if (this.#c) return this;
333
+ this.toString(), this.#c = true;
334
+ let t;
335
+ for (; t = this.#w.pop(); ) {
336
+ if (t.type !== "!") continue;
337
+ let e = t, s = e.#o;
338
+ for (; s; ) {
339
+ for (let i = e.#S + 1; !s.type && i < s.#r.length; i++) for (let r of t.#r) {
340
+ if (typeof r == "string") throw new Error("string part in extglob AST??");
341
+ r.copyIn(s.#r[i]);
342
+ }
343
+ e = s, s = e.#o;
344
+ }
345
+ }
346
+ return this;
347
+ }
348
+ push(...t) {
349
+ for (let e of t) if (e !== "") {
350
+ if (typeof e != "string" && !(e instanceof n && e.#o === this)) throw new Error("invalid part: " + e);
351
+ this.#r.push(e);
352
+ }
353
+ }
354
+ toJSON() {
355
+ let t = this.type === null ? this.#r.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#r.map((e) => e.toJSON())];
356
+ return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#t || this.#t.#c && this.#o?.type === "!") && t.push({}), t;
357
+ }
358
+ isStart() {
359
+ if (this.#t === this) return true;
360
+ if (!this.#o?.isStart()) return false;
361
+ if (this.#S === 0) return true;
362
+ let t = this.#o;
363
+ for (let e = 0; e < this.#S; e++) {
364
+ let s = t.#r[e];
365
+ if (!(s instanceof n && s.type === "!")) return false;
366
+ }
367
+ return true;
368
+ }
369
+ isEnd() {
370
+ if (this.#t === this || this.#o?.type === "!") return true;
371
+ if (!this.#o?.isEnd()) return false;
372
+ if (!this.type) return this.#o?.isEnd();
373
+ let t = this.#o ? this.#o.#r.length : 0;
374
+ return this.#S === t - 1;
375
+ }
376
+ copyIn(t) {
377
+ typeof t == "string" ? this.push(t) : this.push(t.clone(this));
378
+ }
379
+ clone(t) {
380
+ let e = new n(this.type, t);
381
+ for (let s of this.#r) e.copyIn(s);
382
+ return e;
383
+ }
384
+ static #i(t, e, s, i) {
385
+ let r = false, o = false, h = -1, a = false;
386
+ if (e.type === null) {
387
+ let f = s, m = "";
388
+ for (; f < t.length; ) {
389
+ let p = t.charAt(f++);
390
+ if (r || p === "\\") {
391
+ r = !r, m += p;
392
+ continue;
393
+ }
394
+ if (o) {
395
+ f === h + 1 ? (p === "^" || p === "!") && (a = true) : p === "]" && !(f === h + 2 && a) && (o = false), m += p;
396
+ continue;
397
+ } else if (p === "[") {
398
+ o = true, h = f, a = false, m += p;
399
+ continue;
400
+ }
401
+ if (!i.noext && be(p) && t.charAt(f) === "(") {
402
+ e.push(m), m = "";
403
+ let w = new n(p, e);
404
+ f = n.#i(t, w, f, i), e.push(w);
405
+ continue;
406
+ }
407
+ m += p;
408
+ }
409
+ return e.push(m), f;
410
+ }
411
+ let l = s + 1, u = new n(null, e), c = [], d = "";
412
+ for (; l < t.length; ) {
413
+ let f = t.charAt(l++);
414
+ if (r || f === "\\") {
415
+ r = !r, d += f;
416
+ continue;
417
+ }
418
+ if (o) {
419
+ l === h + 1 ? (f === "^" || f === "!") && (a = true) : f === "]" && !(l === h + 2 && a) && (o = false), d += f;
420
+ continue;
421
+ } else if (f === "[") {
422
+ o = true, h = l, a = false, d += f;
423
+ continue;
424
+ }
425
+ if (be(f) && t.charAt(l) === "(") {
426
+ u.push(d), d = "";
427
+ let m = new n(f, u);
428
+ u.push(m), l = n.#i(t, m, l, i);
429
+ continue;
430
+ }
431
+ if (f === "|") {
432
+ u.push(d), d = "", c.push(u), u = new n(null, e);
433
+ continue;
434
+ }
435
+ if (f === ")") return d === "" && e.#r.length === 0 && (e.#f = true), u.push(d), d = "", e.push(...c, u), l;
436
+ d += f;
437
+ }
438
+ return e.type = null, e.#s = void 0, e.#r = [t.substring(s - 1)], l;
439
+ }
440
+ static fromGlob(t, e = {}) {
441
+ let s = new n(null, void 0, e);
442
+ return n.#i(t, s, 0, e), s;
443
+ }
444
+ toMMPattern() {
445
+ if (this !== this.#t) return this.#t.toMMPattern();
446
+ let t = this.toString(), [e, s, i, r] = this.toRegExpSource();
447
+ if (!(i || this.#s || this.#h.nocase && !this.#h.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase())) return s;
448
+ let h = (this.#h.nocase ? "i" : "") + (r ? "u" : "");
449
+ return Object.assign(new RegExp(`^${e}$`, h), { _src: e, _glob: t });
450
+ }
451
+ get options() {
452
+ return this.#h;
453
+ }
454
+ toRegExpSource(t) {
455
+ let e = t ?? !!this.#h.dot;
456
+ if (this.#t === this && this.#a(), !this.type) {
457
+ let a = this.isStart() && this.isEnd() && !this.#r.some((f) => typeof f != "string"), l = this.#r.map((f) => {
458
+ let [m, p, w, g] = typeof f == "string" ? n.#E(f, this.#s, a) : f.toRegExpSource(t);
459
+ return this.#s = this.#s || w, this.#n = this.#n || g, m;
460
+ }).join(""), u = "";
461
+ if (this.isStart() && typeof this.#r[0] == "string" && !(this.#r.length === 1 && Ts.has(this.#r[0]))) {
462
+ let m = Cs, p = e && m.has(l.charAt(0)) || l.startsWith("\\.") && m.has(l.charAt(2)) || l.startsWith("\\.\\.") && m.has(l.charAt(4)), w = !e && !t && m.has(l.charAt(0));
463
+ u = p ? vs : w ? Ct : "";
464
+ }
465
+ let c = "";
466
+ return this.isEnd() && this.#t.#c && this.#o?.type === "!" && (c = "(?:$|\\/)"), [u + l + c, W(l), this.#s = !!this.#s, this.#n];
467
+ }
468
+ let s = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:", r = this.#d(e);
469
+ if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
470
+ let a = this.toString();
471
+ return this.#r = [a], this.type = null, this.#s = void 0, [a, W(this.toString()), false, false];
472
+ }
473
+ let o = !s || t || e || !Ct ? "" : this.#d(true);
474
+ o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
475
+ let h = "";
476
+ if (this.type === "!" && this.#f) h = (this.isStart() && !e ? Ct : "") + Ee;
477
+ else {
478
+ let a = this.type === "!" ? "))" + (this.isStart() && !e && !t ? Ct : "") + Se + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
479
+ h = i + r + a;
480
+ }
481
+ return [h, W(r), this.#s = !!this.#s, this.#n];
482
+ }
483
+ #d(t) {
484
+ return this.#r.map((e) => {
485
+ if (typeof e == "string") throw new Error("string type in extglob ast??");
486
+ let [s, i, r, o] = e.toRegExpSource(t);
487
+ return this.#n = this.#n || o, s;
488
+ }).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
489
+ }
490
+ static #E(t, e, s = false) {
491
+ let i = false, r = "", o = false, h = false;
492
+ for (let a = 0; a < t.length; a++) {
493
+ let l = t.charAt(a);
494
+ if (i) {
495
+ i = false, r += (As.has(l) ? "\\" : "") + l;
496
+ continue;
497
+ }
498
+ if (l === "*") {
499
+ if (h) continue;
500
+ h = true, r += s && /^[*]+$/.test(t) ? Ee : Se, e = true;
501
+ continue;
502
+ } else h = false;
503
+ if (l === "\\") {
504
+ a === t.length - 1 ? r += "\\\\" : i = true;
505
+ continue;
506
+ }
507
+ if (l === "[") {
508
+ let [u, c, d, f] = ye(t, a);
509
+ if (d) {
510
+ r += u, o = o || c, a += d - 1, e = e || f;
511
+ continue;
512
+ }
513
+ }
514
+ if (l === "?") {
515
+ r += Kt, e = true;
516
+ continue;
517
+ }
518
+ r += ks(l);
519
+ }
520
+ return [r, W(t), !!e, o];
521
+ }
522
+ };
523
+ var tt = (n7, { windowsPathsNoEscape: t = false, magicalBraces: e = false } = {}) => e ? t ? n7.replace(/[?*()[\]{}]/g, "[$&]") : n7.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n7.replace(/[?*()[\]]/g, "[$&]") : n7.replace(/[?*()[\]\\]/g, "\\$&");
524
+ var O = (n7, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? false : new D(t, e).match(n7));
525
+ var Rs = /^\*+([^+@!?\*\[\(]*)$/;
526
+ var Os = (n7) => (t) => !t.startsWith(".") && t.endsWith(n7);
527
+ var Fs = (n7) => (t) => t.endsWith(n7);
528
+ var Ds = (n7) => (n7 = n7.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n7));
529
+ var Ms = (n7) => (n7 = n7.toLowerCase(), (t) => t.toLowerCase().endsWith(n7));
530
+ var Ns = /^\*+\.\*+$/;
531
+ var _s = (n7) => !n7.startsWith(".") && n7.includes(".");
532
+ var Ls = (n7) => n7 !== "." && n7 !== ".." && n7.includes(".");
533
+ var Ws = /^\.\*+$/;
534
+ var Ps = (n7) => n7 !== "." && n7 !== ".." && n7.startsWith(".");
535
+ var js = /^\*+$/;
536
+ var Is = (n7) => n7.length !== 0 && !n7.startsWith(".");
537
+ var zs = (n7) => n7.length !== 0 && n7 !== "." && n7 !== "..";
538
+ var Bs = /^\?+([^+@!?\*\[\(]*)?$/;
539
+ var Us = ([n7, t = ""]) => {
540
+ let e = Ce([n7]);
541
+ return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
542
+ };
543
+ var $s = ([n7, t = ""]) => {
544
+ let e = Te([n7]);
545
+ return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
546
+ };
547
+ var Gs = ([n7, t = ""]) => {
548
+ let e = Te([n7]);
549
+ return t ? (s) => e(s) && s.endsWith(t) : e;
550
+ };
551
+ var Hs = ([n7, t = ""]) => {
552
+ let e = Ce([n7]);
553
+ return t ? (s) => e(s) && s.endsWith(t) : e;
554
+ };
555
+ var Ce = ([n7]) => {
556
+ let t = n7.length;
557
+ return (e) => e.length === t && !e.startsWith(".");
558
+ };
559
+ var Te = ([n7]) => {
560
+ let t = n7.length;
561
+ return (e) => e.length === t && e !== "." && e !== "..";
562
+ };
563
+ var Ae = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
564
+ var xe = { win32: { sep: "\\" }, posix: { sep: "/" } };
565
+ var qs = Ae === "win32" ? xe.win32.sep : xe.posix.sep;
566
+ O.sep = qs;
567
+ var A = /* @__PURE__ */ Symbol("globstar **");
568
+ O.GLOBSTAR = A;
569
+ var Ks = "[^/]";
570
+ var Vs = Ks + "*?";
571
+ var Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
572
+ var Xs = "(?:(?!(?:\\/|^)\\.).)*?";
573
+ var Js = (n7, t = {}) => (e) => O(e, n7, t);
574
+ O.filter = Js;
575
+ var N = (n7, t = {}) => Object.assign({}, n7, t);
576
+ var Zs = (n7) => {
577
+ if (!n7 || typeof n7 != "object" || !Object.keys(n7).length) return O;
578
+ let t = O;
579
+ return Object.assign((s, i, r = {}) => t(s, i, N(n7, r)), { Minimatch: class extends t.Minimatch {
580
+ constructor(i, r = {}) {
581
+ super(i, N(n7, r));
582
+ }
583
+ static defaults(i) {
584
+ return t.defaults(N(n7, i)).Minimatch;
585
+ }
586
+ }, AST: class extends t.AST {
587
+ constructor(i, r, o = {}) {
588
+ super(i, r, N(n7, o));
589
+ }
590
+ static fromGlob(i, r = {}) {
591
+ return t.AST.fromGlob(i, N(n7, r));
592
+ }
593
+ }, unescape: (s, i = {}) => t.unescape(s, N(n7, i)), escape: (s, i = {}) => t.escape(s, N(n7, i)), filter: (s, i = {}) => t.filter(s, N(n7, i)), defaults: (s) => t.defaults(N(n7, s)), makeRe: (s, i = {}) => t.makeRe(s, N(n7, i)), braceExpand: (s, i = {}) => t.braceExpand(s, N(n7, i)), match: (s, i, r = {}) => t.match(s, i, N(n7, r)), sep: t.sep, GLOBSTAR: A });
594
+ };
595
+ O.defaults = Zs;
596
+ var ke = (n7, t = {}) => (at(n7), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n7) ? [n7] : ge(n7, { max: t.braceExpandMax }));
597
+ O.braceExpand = ke;
598
+ var Qs = (n7, t = {}) => new D(n7, t).makeRe();
599
+ O.makeRe = Qs;
600
+ var ti = (n7, t, e = {}) => {
601
+ let s = new D(t, e);
602
+ return n7 = n7.filter((i) => s.match(i)), s.options.nonull && !n7.length && n7.push(t), n7;
603
+ };
604
+ O.match = ti;
605
+ var ve = /[?*]|[+@!]\(.*?\)|\[|\]/;
606
+ var ei = (n7) => n7.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
607
+ var D = class {
608
+ options;
609
+ set;
610
+ pattern;
611
+ windowsPathsNoEscape;
612
+ nonegate;
613
+ negate;
614
+ comment;
615
+ empty;
616
+ preserveMultipleSlashes;
617
+ partial;
618
+ globSet;
619
+ globParts;
620
+ nocase;
621
+ isWindows;
622
+ platform;
623
+ windowsNoMagicRoot;
624
+ regexp;
625
+ constructor(t, e = {}) {
626
+ at(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ae, this.isWindows = this.platform === "win32";
627
+ let s = "allowWindowsEscape";
628
+ this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e[s] === false, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = false, this.nonegate = !!e.nonegate, this.comment = false, this.empty = false, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make();
629
+ }
630
+ hasMagic() {
631
+ if (this.options.magicalBraces && this.set.length > 1) return true;
632
+ for (let t of this.set) for (let e of t) if (typeof e != "string") return true;
633
+ return false;
634
+ }
635
+ debug(...t) {
636
+ }
637
+ make() {
638
+ let t = this.pattern, e = this.options;
639
+ if (!e.nocomment && t.charAt(0) === "#") {
640
+ this.comment = true;
641
+ return;
642
+ }
643
+ if (!t) {
644
+ this.empty = true;
645
+ return;
646
+ }
647
+ this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(this.pattern, this.globSet);
648
+ let s = this.globSet.map((r) => this.slashSplit(r));
649
+ this.globParts = this.preprocess(s), this.debug(this.pattern, this.globParts);
650
+ let i = this.globParts.map((r, o, h) => {
651
+ if (this.isWindows && this.windowsNoMagicRoot) {
652
+ let a = r[0] === "" && r[1] === "" && (r[2] === "?" || !ve.test(r[2])) && !ve.test(r[3]), l = /^[a-z]:/i.test(r[0]);
653
+ if (a) return [...r.slice(0, 4), ...r.slice(4).map((u) => this.parse(u))];
654
+ if (l) return [r[0], ...r.slice(1).map((u) => this.parse(u))];
655
+ }
656
+ return r.map((a) => this.parse(a));
657
+ });
658
+ if (this.debug(this.pattern, i), this.set = i.filter((r) => r.indexOf(false) === -1), this.isWindows) for (let r = 0; r < this.set.length; r++) {
659
+ let o = this.set[r];
660
+ o[0] === "" && o[1] === "" && this.globParts[r][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
661
+ }
662
+ this.debug(this.pattern, this.set);
663
+ }
664
+ preprocess(t) {
665
+ if (this.options.noglobstar) for (let s = 0; s < t.length; s++) for (let i = 0; i < t[s].length; i++) t[s][i] === "**" && (t[s][i] = "*");
666
+ let { optimizationLevel: e = 1 } = this.options;
667
+ return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t;
668
+ }
669
+ adjascentGlobstarOptimize(t) {
670
+ return t.map((e) => {
671
+ let s = -1;
672
+ for (; (s = e.indexOf("**", s + 1)) !== -1; ) {
673
+ let i = s;
674
+ for (; e[i + 1] === "**"; ) i++;
675
+ i !== s && e.splice(s, i - s);
676
+ }
677
+ return e;
678
+ });
679
+ }
680
+ levelOneOptimize(t) {
681
+ return t.map((e) => (e = e.reduce((s, i) => {
682
+ let r = s[s.length - 1];
683
+ return i === "**" && r === "**" ? s : i === ".." && r && r !== ".." && r !== "." && r !== "**" ? (s.pop(), s) : (s.push(i), s);
684
+ }, []), e.length === 0 ? [""] : e));
685
+ }
686
+ levelTwoFileOptimize(t) {
687
+ Array.isArray(t) || (t = this.slashSplit(t));
688
+ let e = false;
689
+ do {
690
+ if (e = false, !this.preserveMultipleSlashes) {
691
+ for (let i = 1; i < t.length - 1; i++) {
692
+ let r = t[i];
693
+ i === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = true, t.splice(i, 1), i--);
694
+ }
695
+ t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = true, t.pop());
696
+ }
697
+ let s = 0;
698
+ for (; (s = t.indexOf("..", s + 1)) !== -1; ) {
699
+ let i = t[s - 1];
700
+ i && i !== "." && i !== ".." && i !== "**" && (e = true, t.splice(s - 1, 2), s -= 2);
701
+ }
702
+ } while (e);
703
+ return t.length === 0 ? [""] : t;
704
+ }
705
+ firstPhasePreProcess(t) {
706
+ let e = false;
707
+ do {
708
+ e = false;
709
+ for (let s of t) {
710
+ let i = -1;
711
+ for (; (i = s.indexOf("**", i + 1)) !== -1; ) {
712
+ let o = i;
713
+ for (; s[o + 1] === "**"; ) o++;
714
+ o > i && s.splice(i + 1, o - i);
715
+ let h = s[i + 1], a = s[i + 2], l = s[i + 3];
716
+ if (h !== ".." || !a || a === "." || a === ".." || !l || l === "." || l === "..") continue;
717
+ e = true, s.splice(i, 1);
718
+ let u = s.slice(0);
719
+ u[i] = "**", t.push(u), i--;
720
+ }
721
+ if (!this.preserveMultipleSlashes) {
722
+ for (let o = 1; o < s.length - 1; o++) {
723
+ let h = s[o];
724
+ o === 1 && h === "" && s[0] === "" || (h === "." || h === "") && (e = true, s.splice(o, 1), o--);
725
+ }
726
+ s[0] === "." && s.length === 2 && (s[1] === "." || s[1] === "") && (e = true, s.pop());
727
+ }
728
+ let r = 0;
729
+ for (; (r = s.indexOf("..", r + 1)) !== -1; ) {
730
+ let o = s[r - 1];
731
+ if (o && o !== "." && o !== ".." && o !== "**") {
732
+ e = true;
733
+ let a = r === 1 && s[r + 1] === "**" ? ["."] : [];
734
+ s.splice(r - 1, 2, ...a), s.length === 0 && s.push(""), r -= 2;
735
+ }
736
+ }
737
+ }
738
+ } while (e);
739
+ return t;
740
+ }
741
+ secondPhasePreProcess(t) {
742
+ for (let e = 0; e < t.length - 1; e++) for (let s = e + 1; s < t.length; s++) {
743
+ let i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
744
+ if (i) {
745
+ t[e] = [], t[s] = i;
746
+ break;
747
+ }
748
+ }
749
+ return t.filter((e) => e.length);
750
+ }
751
+ partsMatch(t, e, s = false) {
752
+ let i = 0, r = 0, o = [], h = "";
753
+ for (; i < t.length && r < e.length; ) if (t[i] === e[r]) o.push(h === "b" ? e[r] : t[i]), i++, r++;
754
+ else if (s && t[i] === "**" && e[r] === t[i + 1]) o.push(t[i]), i++;
755
+ else if (s && e[r] === "**" && t[i] === e[r + 1]) o.push(e[r]), r++;
756
+ else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
757
+ if (h === "b") return false;
758
+ h = "a", o.push(t[i]), i++, r++;
759
+ } else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
760
+ if (h === "a") return false;
761
+ h = "b", o.push(e[r]), i++, r++;
762
+ } else return false;
763
+ return t.length === e.length && o;
764
+ }
765
+ parseNegate() {
766
+ if (this.nonegate) return;
767
+ let t = this.pattern, e = false, s = 0;
768
+ for (let i = 0; i < t.length && t.charAt(i) === "!"; i++) e = !e, s++;
769
+ s && (this.pattern = t.slice(s)), this.negate = e;
770
+ }
771
+ matchOne(t, e, s = false) {
772
+ let i = this.options;
773
+ if (this.isWindows) {
774
+ let p = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), w = !p && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), g = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), S = !g && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), E = w ? 3 : p ? 0 : void 0, y = S ? 3 : g ? 0 : void 0;
775
+ if (typeof E == "number" && typeof y == "number") {
776
+ let [b, z] = [t[E], e[y]];
777
+ b.toLowerCase() === z.toLowerCase() && (e[y] = b, y > E ? e = e.slice(y) : E > y && (t = t.slice(E)));
778
+ }
779
+ }
780
+ let { optimizationLevel: r = 1 } = this.options;
781
+ r >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, { file: t, pattern: e }), this.debug("matchOne", t.length, e.length);
782
+ for (var o = 0, h = 0, a = t.length, l = e.length; o < a && h < l; o++, h++) {
783
+ this.debug("matchOne loop");
784
+ var u = e[h], c = t[o];
785
+ if (this.debug(e, u, c), u === false) return false;
786
+ if (u === A) {
787
+ this.debug("GLOBSTAR", [e, u, c]);
788
+ var d = o, f = h + 1;
789
+ if (f === l) {
790
+ for (this.debug("** at the end"); o < a; o++) if (t[o] === "." || t[o] === ".." || !i.dot && t[o].charAt(0) === ".") return false;
791
+ return true;
792
+ }
793
+ for (; d < a; ) {
794
+ var m = t[d];
795
+ if (this.debug(`
796
+ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) return this.debug("globstar found match!", d, a, m), true;
797
+ if (m === "." || m === ".." || !i.dot && m.charAt(0) === ".") {
798
+ this.debug("dot detected!", t, d, e, f);
799
+ break;
800
+ }
801
+ this.debug("globstar swallow a segment, and continue"), d++;
802
+ }
803
+ return !!(s && (this.debug(`
804
+ >>> no match, partial?`, t, d, e, f), d === a));
805
+ }
806
+ let p;
807
+ if (typeof u == "string" ? (p = c === u, this.debug("string match", u, c, p)) : (p = u.test(c), this.debug("pattern match", u, c, p)), !p) return false;
808
+ }
809
+ if (o === a && h === l) return true;
810
+ if (o === a) return s;
811
+ if (h === l) return o === a - 1 && t[o] === "";
812
+ throw new Error("wtf?");
813
+ }
814
+ braceExpand() {
815
+ return ke(this.pattern, this.options);
816
+ }
817
+ parse(t) {
818
+ at(t);
819
+ let e = this.options;
820
+ if (t === "**") return A;
821
+ if (t === "") return "";
822
+ let s, i = null;
823
+ (s = t.match(js)) ? i = e.dot ? zs : Is : (s = t.match(Rs)) ? i = (e.nocase ? e.dot ? Ms : Ds : e.dot ? Fs : Os)(s[1]) : (s = t.match(Bs)) ? i = (e.nocase ? e.dot ? $s : Us : e.dot ? Gs : Hs)(s) : (s = t.match(Ns)) ? i = e.dot ? Ls : _s : (s = t.match(Ws)) && (i = Ps);
824
+ let r = Q.fromGlob(t, this.options).toMMPattern();
825
+ return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
826
+ }
827
+ makeRe() {
828
+ if (this.regexp || this.regexp === false) return this.regexp;
829
+ let t = this.set;
830
+ if (!t.length) return this.regexp = false, this.regexp;
831
+ let e = this.options, s = e.noglobstar ? Vs : e.dot ? Ys : Xs, i = new Set(e.nocase ? ["i"] : []), r = t.map((a) => {
832
+ let l = a.map((c) => {
833
+ if (c instanceof RegExp) for (let d of c.flags.split("")) i.add(d);
834
+ return typeof c == "string" ? ei(c) : c === A ? A : c._src;
835
+ });
836
+ l.forEach((c, d) => {
837
+ let f = l[d + 1], m = l[d - 1];
838
+ c !== A || m === A || (m === void 0 ? f !== void 0 && f !== A ? l[d + 1] = "(?:\\/|" + s + "\\/)?" + f : l[d] = s : f === void 0 ? l[d - 1] = m + "(?:\\/|\\/" + s + ")?" : f !== A && (l[d - 1] = m + "(?:\\/|\\/" + s + "\\/)" + f, l[d + 1] = A));
839
+ });
840
+ let u = l.filter((c) => c !== A);
841
+ if (this.partial && u.length >= 1) {
842
+ let c = [];
843
+ for (let d = 1; d <= u.length; d++) c.push(u.slice(0, d).join("/"));
844
+ return "(?:" + c.join("|") + ")";
845
+ }
846
+ return u.join("/");
847
+ }).join("|"), [o, h] = t.length > 1 ? ["(?:", ")"] : ["", ""];
848
+ r = "^" + o + r + h + "$", this.partial && (r = "^(?:\\/|" + o + r.slice(1, -1) + h + ")$"), this.negate && (r = "^(?!" + r + ").+$");
849
+ try {
850
+ this.regexp = new RegExp(r, [...i].join(""));
851
+ } catch {
852
+ this.regexp = false;
853
+ }
854
+ return this.regexp;
855
+ }
856
+ slashSplit(t) {
857
+ return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^\/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/);
858
+ }
859
+ match(t, e = this.partial) {
860
+ if (this.debug("match", t, this.pattern), this.comment) return false;
861
+ if (this.empty) return t === "";
862
+ if (t === "/" && e) return true;
863
+ let s = this.options;
864
+ this.isWindows && (t = t.split("\\").join("/"));
865
+ let i = this.slashSplit(t);
866
+ this.debug(this.pattern, "split", i);
867
+ let r = this.set;
868
+ this.debug(this.pattern, "set", r);
869
+ let o = i[i.length - 1];
870
+ if (!o) for (let h = i.length - 2; !o && h >= 0; h--) o = i[h];
871
+ for (let h = 0; h < r.length; h++) {
872
+ let a = r[h], l = i;
873
+ if (s.matchBase && a.length === 1 && (l = [o]), this.matchOne(l, a, e)) return s.flipNegate ? true : !this.negate;
874
+ }
875
+ return s.flipNegate ? false : this.negate;
876
+ }
877
+ static defaults(t) {
878
+ return O.defaults(t).Minimatch;
879
+ }
880
+ };
881
+ O.AST = Q;
882
+ O.Minimatch = D;
883
+ O.escape = tt;
884
+ O.unescape = W;
885
+ var si = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
886
+ var Oe = /* @__PURE__ */ new Set();
887
+ var Vt = typeof process == "object" && process ? process : {};
888
+ var Fe = (n7, t, e, s) => {
889
+ typeof Vt.emitWarning == "function" ? Vt.emitWarning(n7, t, e, s) : console.error(`[${e}] ${t}: ${n7}`);
890
+ };
891
+ var At = globalThis.AbortController;
892
+ var Re = globalThis.AbortSignal;
893
+ if (typeof At > "u") {
894
+ Re = class {
895
+ onabort;
896
+ _onabort = [];
897
+ reason;
898
+ aborted = false;
899
+ addEventListener(e, s) {
900
+ this._onabort.push(s);
901
+ }
902
+ }, At = class {
903
+ constructor() {
904
+ t();
905
+ }
906
+ signal = new Re();
907
+ abort(e) {
908
+ if (!this.signal.aborted) {
909
+ this.signal.reason = e, this.signal.aborted = true;
910
+ for (let s of this.signal._onabort) s(e);
911
+ this.signal.onabort?.(e);
912
+ }
913
+ }
914
+ };
915
+ let n7 = Vt.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
916
+ n7 && (n7 = false, Fe("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
917
+ };
918
+ }
919
+ var ii = (n7) => !Oe.has(n7);
920
+ var q = (n7) => n7 && n7 === Math.floor(n7) && n7 > 0 && isFinite(n7);
921
+ var De = (n7) => q(n7) ? n7 <= Math.pow(2, 8) ? Uint8Array : n7 <= Math.pow(2, 16) ? Uint16Array : n7 <= Math.pow(2, 32) ? Uint32Array : n7 <= Number.MAX_SAFE_INTEGER ? Tt : null : null;
922
+ var Tt = class extends Array {
923
+ constructor(n7) {
924
+ super(n7), this.fill(0);
925
+ }
926
+ };
927
+ var ri = class ct {
928
+ heap;
929
+ length;
930
+ static #t = false;
931
+ static create(t) {
932
+ let e = De(t);
933
+ if (!e) return [];
934
+ ct.#t = true;
935
+ let s = new ct(t, e);
936
+ return ct.#t = false, s;
937
+ }
938
+ constructor(t, e) {
939
+ if (!ct.#t) throw new TypeError("instantiate Stack using Stack.create(n)");
940
+ this.heap = new e(t), this.length = 0;
941
+ }
942
+ push(t) {
943
+ this.heap[this.length++] = t;
944
+ }
945
+ pop() {
946
+ return this.heap[--this.length];
947
+ }
948
+ };
949
+ var ft = class Me {
950
+ #t;
951
+ #s;
952
+ #n;
953
+ #r;
954
+ #o;
955
+ #S;
956
+ #w;
957
+ #c;
958
+ get perf() {
959
+ return this.#c;
960
+ }
961
+ ttl;
962
+ ttlResolution;
963
+ ttlAutopurge;
964
+ updateAgeOnGet;
965
+ updateAgeOnHas;
966
+ allowStale;
967
+ noDisposeOnSet;
968
+ noUpdateTTL;
969
+ maxEntrySize;
970
+ sizeCalculation;
971
+ noDeleteOnFetchRejection;
972
+ noDeleteOnStaleGet;
973
+ allowStaleOnFetchAbort;
974
+ allowStaleOnFetchRejection;
975
+ ignoreFetchAbort;
976
+ #h;
977
+ #u;
978
+ #f;
979
+ #a;
980
+ #i;
981
+ #d;
982
+ #E;
983
+ #b;
984
+ #p;
985
+ #R;
986
+ #m;
987
+ #C;
988
+ #T;
989
+ #g;
990
+ #y;
991
+ #x;
992
+ #A;
993
+ #e;
994
+ #_;
995
+ static unsafeExposeInternals(t) {
996
+ return { starts: t.#T, ttls: t.#g, autopurgeTimers: t.#y, sizes: t.#C, keyMap: t.#f, keyList: t.#a, valList: t.#i, next: t.#d, prev: t.#E, get head() {
997
+ return t.#b;
998
+ }, get tail() {
999
+ return t.#p;
1000
+ }, free: t.#R, isBackgroundFetch: (e) => t.#l(e), backgroundFetch: (e, s, i, r) => t.#U(e, s, i, r), moveToTail: (e) => t.#W(e), indexes: (e) => t.#F(e), rindexes: (e) => t.#D(e), isStale: (e) => t.#v(e) };
1001
+ }
1002
+ get max() {
1003
+ return this.#t;
1004
+ }
1005
+ get maxSize() {
1006
+ return this.#s;
1007
+ }
1008
+ get calculatedSize() {
1009
+ return this.#u;
1010
+ }
1011
+ get size() {
1012
+ return this.#h;
1013
+ }
1014
+ get fetchMethod() {
1015
+ return this.#S;
1016
+ }
1017
+ get memoMethod() {
1018
+ return this.#w;
1019
+ }
1020
+ get dispose() {
1021
+ return this.#n;
1022
+ }
1023
+ get onInsert() {
1024
+ return this.#r;
1025
+ }
1026
+ get disposeAfter() {
1027
+ return this.#o;
1028
+ }
1029
+ constructor(t) {
1030
+ let { max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: r, updateAgeOnGet: o, updateAgeOnHas: h, allowStale: a, dispose: l, onInsert: u, disposeAfter: c, noDisposeOnSet: d, noUpdateTTL: f, maxSize: m = 0, maxEntrySize: p = 0, sizeCalculation: w, fetchMethod: g, memoMethod: S, noDeleteOnFetchRejection: E, noDeleteOnStaleGet: y, allowStaleOnFetchRejection: b, allowStaleOnFetchAbort: z, ignoreFetchAbort: $, perf: J } = t;
1031
+ if (J !== void 0 && typeof J?.now != "function") throw new TypeError("perf option must have a now() method if specified");
1032
+ if (this.#c = J ?? si, e !== 0 && !q(e)) throw new TypeError("max option must be a nonnegative integer");
1033
+ let Z = e ? De(e) : Array;
1034
+ if (!Z) throw new Error("invalid max value: " + e);
1035
+ if (this.#t = e, this.#s = m, this.maxEntrySize = p || this.#s, this.sizeCalculation = w, this.sizeCalculation) {
1036
+ if (!this.#s && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
1037
+ if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
1038
+ }
1039
+ if (S !== void 0 && typeof S != "function") throw new TypeError("memoMethod must be a function if defined");
1040
+ if (this.#w = S, g !== void 0 && typeof g != "function") throw new TypeError("fetchMethod must be a function if specified");
1041
+ if (this.#S = g, this.#A = !!g, this.#f = /* @__PURE__ */ new Map(), this.#a = new Array(e).fill(void 0), this.#i = new Array(e).fill(void 0), this.#d = new Z(e), this.#E = new Z(e), this.#b = 0, this.#p = 0, this.#R = ri.create(e), this.#h = 0, this.#u = 0, typeof l == "function" && (this.#n = l), typeof u == "function" && (this.#r = u), typeof c == "function" ? (this.#o = c, this.#m = []) : (this.#o = void 0, this.#m = void 0), this.#x = !!this.#n, this.#_ = !!this.#r, this.#e = !!this.#o, this.noDisposeOnSet = !!d, this.noUpdateTTL = !!f, this.noDeleteOnFetchRejection = !!E, this.allowStaleOnFetchRejection = !!b, this.allowStaleOnFetchAbort = !!z, this.ignoreFetchAbort = !!$, this.maxEntrySize !== 0) {
1042
+ if (this.#s !== 0 && !q(this.#s)) throw new TypeError("maxSize must be a positive integer if specified");
1043
+ if (!q(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
1044
+ this.#G();
1045
+ }
1046
+ if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!y, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!h, this.ttlResolution = q(i) || i === 0 ? i : 1, this.ttlAutopurge = !!r, this.ttl = s || 0, this.ttl) {
1047
+ if (!q(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
1048
+ this.#M();
1049
+ }
1050
+ if (this.#t === 0 && this.ttl === 0 && this.#s === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
1051
+ if (!this.ttlAutopurge && !this.#t && !this.#s) {
1052
+ let $t = "LRU_CACHE_UNBOUNDED";
1053
+ ii($t) && (Oe.add($t), Fe("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", $t, Me));
1054
+ }
1055
+ }
1056
+ getRemainingTTL(t) {
1057
+ return this.#f.has(t) ? 1 / 0 : 0;
1058
+ }
1059
+ #M() {
1060
+ let t = new Tt(this.#t), e = new Tt(this.#t);
1061
+ this.#g = t, this.#T = e;
1062
+ let s = this.ttlAutopurge ? new Array(this.#t) : void 0;
1063
+ this.#y = s, this.#j = (o, h, a = this.#c.now()) => {
1064
+ if (e[o] = h !== 0 ? a : 0, t[o] = h, s?.[o] && (clearTimeout(s[o]), s[o] = void 0), h !== 0 && s) {
1065
+ let l = setTimeout(() => {
1066
+ this.#v(o) && this.#O(this.#a[o], "expire");
1067
+ }, h + 1);
1068
+ l.unref && l.unref(), s[o] = l;
1069
+ }
1070
+ }, this.#k = (o) => {
1071
+ e[o] = t[o] !== 0 ? this.#c.now() : 0;
1072
+ }, this.#N = (o, h) => {
1073
+ if (t[h]) {
1074
+ let a = t[h], l = e[h];
1075
+ if (!a || !l) return;
1076
+ o.ttl = a, o.start = l, o.now = i || r();
1077
+ let u = o.now - l;
1078
+ o.remainingTTL = a - u;
1079
+ }
1080
+ };
1081
+ let i = 0, r = () => {
1082
+ let o = this.#c.now();
1083
+ if (this.ttlResolution > 0) {
1084
+ i = o;
1085
+ let h = setTimeout(() => i = 0, this.ttlResolution);
1086
+ h.unref && h.unref();
1087
+ }
1088
+ return o;
1089
+ };
1090
+ this.getRemainingTTL = (o) => {
1091
+ let h = this.#f.get(o);
1092
+ if (h === void 0) return 0;
1093
+ let a = t[h], l = e[h];
1094
+ if (!a || !l) return 1 / 0;
1095
+ let u = (i || r()) - l;
1096
+ return a - u;
1097
+ }, this.#v = (o) => {
1098
+ let h = e[o], a = t[o];
1099
+ return !!a && !!h && (i || r()) - h > a;
1100
+ };
1101
+ }
1102
+ #k = () => {
1103
+ };
1104
+ #N = () => {
1105
+ };
1106
+ #j = () => {
1107
+ };
1108
+ #v = () => false;
1109
+ #G() {
1110
+ let t = new Tt(this.#t);
1111
+ this.#u = 0, this.#C = t, this.#P = (e) => {
1112
+ this.#u -= t[e], t[e] = 0;
1113
+ }, this.#I = (e, s, i, r) => {
1114
+ if (this.#l(s)) return 0;
1115
+ if (!q(i)) if (r) {
1116
+ if (typeof r != "function") throw new TypeError("sizeCalculation must be a function");
1117
+ if (i = r(s, e), !q(i)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
1118
+ } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
1119
+ return i;
1120
+ }, this.#L = (e, s, i) => {
1121
+ if (t[e] = s, this.#s) {
1122
+ let r = this.#s - t[e];
1123
+ for (; this.#u > r; ) this.#B(true);
1124
+ }
1125
+ this.#u += t[e], i && (i.entrySize = s, i.totalCalculatedSize = this.#u);
1126
+ };
1127
+ }
1128
+ #P = (t) => {
1129
+ };
1130
+ #L = (t, e, s) => {
1131
+ };
1132
+ #I = (t, e, s, i) => {
1133
+ if (s || i) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
1134
+ return 0;
1135
+ };
1136
+ *#F({ allowStale: t = this.allowStale } = {}) {
1137
+ if (this.#h) for (let e = this.#p; !(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#b)); ) e = this.#E[e];
1138
+ }
1139
+ *#D({ allowStale: t = this.allowStale } = {}) {
1140
+ if (this.#h) for (let e = this.#b; !(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#p)); ) e = this.#d[e];
1141
+ }
1142
+ #z(t) {
1143
+ return t !== void 0 && this.#f.get(this.#a[t]) === t;
1144
+ }
1145
+ *entries() {
1146
+ for (let t of this.#F()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]);
1147
+ }
1148
+ *rentries() {
1149
+ for (let t of this.#D()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]);
1150
+ }
1151
+ *keys() {
1152
+ for (let t of this.#F()) {
1153
+ let e = this.#a[t];
1154
+ e !== void 0 && !this.#l(this.#i[t]) && (yield e);
1155
+ }
1156
+ }
1157
+ *rkeys() {
1158
+ for (let t of this.#D()) {
1159
+ let e = this.#a[t];
1160
+ e !== void 0 && !this.#l(this.#i[t]) && (yield e);
1161
+ }
1162
+ }
1163
+ *values() {
1164
+ for (let t of this.#F()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]);
1165
+ }
1166
+ *rvalues() {
1167
+ for (let t of this.#D()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]);
1168
+ }
1169
+ [Symbol.iterator]() {
1170
+ return this.entries();
1171
+ }
1172
+ [Symbol.toStringTag] = "LRUCache";
1173
+ find(t, e = {}) {
1174
+ for (let s of this.#F()) {
1175
+ let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
1176
+ if (r !== void 0 && t(r, this.#a[s], this)) return this.get(this.#a[s], e);
1177
+ }
1178
+ }
1179
+ forEach(t, e = this) {
1180
+ for (let s of this.#F()) {
1181
+ let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
1182
+ r !== void 0 && t.call(e, r, this.#a[s], this);
1183
+ }
1184
+ }
1185
+ rforEach(t, e = this) {
1186
+ for (let s of this.#D()) {
1187
+ let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
1188
+ r !== void 0 && t.call(e, r, this.#a[s], this);
1189
+ }
1190
+ }
1191
+ purgeStale() {
1192
+ let t = false;
1193
+ for (let e of this.#D({ allowStale: true })) this.#v(e) && (this.#O(this.#a[e], "expire"), t = true);
1194
+ return t;
1195
+ }
1196
+ info(t) {
1197
+ let e = this.#f.get(t);
1198
+ if (e === void 0) return;
1199
+ let s = this.#i[e], i = this.#l(s) ? s.__staleWhileFetching : s;
1200
+ if (i === void 0) return;
1201
+ let r = { value: i };
1202
+ if (this.#g && this.#T) {
1203
+ let o = this.#g[e], h = this.#T[e];
1204
+ if (o && h) {
1205
+ let a = o - (this.#c.now() - h);
1206
+ r.ttl = a, r.start = Date.now();
1207
+ }
1208
+ }
1209
+ return this.#C && (r.size = this.#C[e]), r;
1210
+ }
1211
+ dump() {
1212
+ let t = [];
1213
+ for (let e of this.#F({ allowStale: true })) {
1214
+ let s = this.#a[e], i = this.#i[e], r = this.#l(i) ? i.__staleWhileFetching : i;
1215
+ if (r === void 0 || s === void 0) continue;
1216
+ let o = { value: r };
1217
+ if (this.#g && this.#T) {
1218
+ o.ttl = this.#g[e];
1219
+ let h = this.#c.now() - this.#T[e];
1220
+ o.start = Math.floor(Date.now() - h);
1221
+ }
1222
+ this.#C && (o.size = this.#C[e]), t.unshift([s, o]);
1223
+ }
1224
+ return t;
1225
+ }
1226
+ load(t) {
1227
+ this.clear();
1228
+ for (let [e, s] of t) {
1229
+ if (s.start) {
1230
+ let i = Date.now() - s.start;
1231
+ s.start = this.#c.now() - i;
1232
+ }
1233
+ this.set(e, s.value, s);
1234
+ }
1235
+ }
1236
+ set(t, e, s = {}) {
1237
+ if (e === void 0) return this.delete(t), this;
1238
+ let { ttl: i = this.ttl, start: r, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: a } = s, { noUpdateTTL: l = this.noUpdateTTL } = s, u = this.#I(t, e, s.size || 0, h);
1239
+ if (this.maxEntrySize && u > this.maxEntrySize) return a && (a.set = "miss", a.maxEntrySizeExceeded = true), this.#O(t, "set"), this;
1240
+ let c = this.#h === 0 ? void 0 : this.#f.get(t);
1241
+ if (c === void 0) c = this.#h === 0 ? this.#p : this.#R.length !== 0 ? this.#R.pop() : this.#h === this.#t ? this.#B(false) : this.#h, this.#a[c] = t, this.#i[c] = e, this.#f.set(t, c), this.#d[this.#p] = c, this.#E[c] = this.#p, this.#p = c, this.#h++, this.#L(c, u, a), a && (a.set = "add"), l = false, this.#_ && this.#r?.(e, t, "add");
1242
+ else {
1243
+ this.#W(c);
1244
+ let d = this.#i[c];
1245
+ if (e !== d) {
1246
+ if (this.#A && this.#l(d)) {
1247
+ d.__abortController.abort(new Error("replaced"));
1248
+ let { __staleWhileFetching: f } = d;
1249
+ f !== void 0 && !o && (this.#x && this.#n?.(f, t, "set"), this.#e && this.#m?.push([f, t, "set"]));
1250
+ } else o || (this.#x && this.#n?.(d, t, "set"), this.#e && this.#m?.push([d, t, "set"]));
1251
+ if (this.#P(c), this.#L(c, u, a), this.#i[c] = e, a) {
1252
+ a.set = "replace";
1253
+ let f = d && this.#l(d) ? d.__staleWhileFetching : d;
1254
+ f !== void 0 && (a.oldValue = f);
1255
+ }
1256
+ } else a && (a.set = "update");
1257
+ this.#_ && this.onInsert?.(e, t, e === d ? "update" : "replace");
1258
+ }
1259
+ if (i !== 0 && !this.#g && this.#M(), this.#g && (l || this.#j(c, i, r), a && this.#N(a, c)), !o && this.#e && this.#m) {
1260
+ let d = this.#m, f;
1261
+ for (; f = d?.shift(); ) this.#o?.(...f);
1262
+ }
1263
+ return this;
1264
+ }
1265
+ pop() {
1266
+ try {
1267
+ for (; this.#h; ) {
1268
+ let t = this.#i[this.#b];
1269
+ if (this.#B(true), this.#l(t)) {
1270
+ if (t.__staleWhileFetching) return t.__staleWhileFetching;
1271
+ } else if (t !== void 0) return t;
1272
+ }
1273
+ } finally {
1274
+ if (this.#e && this.#m) {
1275
+ let t = this.#m, e;
1276
+ for (; e = t?.shift(); ) this.#o?.(...e);
1277
+ }
1278
+ }
1279
+ }
1280
+ #B(t) {
1281
+ let e = this.#b, s = this.#a[e], i = this.#i[e];
1282
+ return this.#A && this.#l(i) ? i.__abortController.abort(new Error("evicted")) : (this.#x || this.#e) && (this.#x && this.#n?.(i, s, "evict"), this.#e && this.#m?.push([i, s, "evict"])), this.#P(e), this.#y?.[e] && (clearTimeout(this.#y[e]), this.#y[e] = void 0), t && (this.#a[e] = void 0, this.#i[e] = void 0, this.#R.push(e)), this.#h === 1 ? (this.#b = this.#p = 0, this.#R.length = 0) : this.#b = this.#d[e], this.#f.delete(s), this.#h--, e;
1283
+ }
1284
+ has(t, e = {}) {
1285
+ let { updateAgeOnHas: s = this.updateAgeOnHas, status: i } = e, r = this.#f.get(t);
1286
+ if (r !== void 0) {
1287
+ let o = this.#i[r];
1288
+ if (this.#l(o) && o.__staleWhileFetching === void 0) return false;
1289
+ if (this.#v(r)) i && (i.has = "stale", this.#N(i, r));
1290
+ else return s && this.#k(r), i && (i.has = "hit", this.#N(i, r)), true;
1291
+ } else i && (i.has = "miss");
1292
+ return false;
1293
+ }
1294
+ peek(t, e = {}) {
1295
+ let { allowStale: s = this.allowStale } = e, i = this.#f.get(t);
1296
+ if (i === void 0 || !s && this.#v(i)) return;
1297
+ let r = this.#i[i];
1298
+ return this.#l(r) ? r.__staleWhileFetching : r;
1299
+ }
1300
+ #U(t, e, s, i) {
1301
+ let r = e === void 0 ? void 0 : this.#i[e];
1302
+ if (this.#l(r)) return r;
1303
+ let o = new At(), { signal: h } = s;
1304
+ h?.addEventListener("abort", () => o.abort(h.reason), { signal: o.signal });
1305
+ let a = { signal: o.signal, options: s, context: i }, l = (p, w = false) => {
1306
+ let { aborted: g } = o.signal, S = s.ignoreFetchAbort && p !== void 0, E = s.ignoreFetchAbort || !!(s.allowStaleOnFetchAbort && p !== void 0);
1307
+ if (s.status && (g && !w ? (s.status.fetchAborted = true, s.status.fetchError = o.signal.reason, S && (s.status.fetchAbortIgnored = true)) : s.status.fetchResolved = true), g && !S && !w) return c(o.signal.reason, E);
1308
+ let y = f, b = this.#i[e];
1309
+ return (b === f || S && w && b === void 0) && (p === void 0 ? y.__staleWhileFetching !== void 0 ? this.#i[e] = y.__staleWhileFetching : this.#O(t, "fetch") : (s.status && (s.status.fetchUpdated = true), this.set(t, p, a.options))), p;
1310
+ }, u = (p) => (s.status && (s.status.fetchRejected = true, s.status.fetchError = p), c(p, false)), c = (p, w) => {
1311
+ let { aborted: g } = o.signal, S = g && s.allowStaleOnFetchAbort, E = S || s.allowStaleOnFetchRejection, y = E || s.noDeleteOnFetchRejection, b = f;
1312
+ if (this.#i[e] === f && (!y || !w && b.__staleWhileFetching === void 0 ? this.#O(t, "fetch") : S || (this.#i[e] = b.__staleWhileFetching)), E) return s.status && b.__staleWhileFetching !== void 0 && (s.status.returnedStale = true), b.__staleWhileFetching;
1313
+ if (b.__returned === b) throw p;
1314
+ }, d = (p, w) => {
1315
+ let g = this.#S?.(t, r, a);
1316
+ g && g instanceof Promise && g.then((S) => p(S === void 0 ? void 0 : S), w), o.signal.addEventListener("abort", () => {
1317
+ (!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (p(void 0), s.allowStaleOnFetchAbort && (p = (S) => l(S, true)));
1318
+ });
1319
+ };
1320
+ s.status && (s.status.fetchDispatched = true);
1321
+ let f = new Promise(d).then(l, u), m = Object.assign(f, { __abortController: o, __staleWhileFetching: r, __returned: void 0 });
1322
+ return e === void 0 ? (this.set(t, m, { ...a.options, status: void 0 }), e = this.#f.get(t)) : this.#i[e] = m, m;
1323
+ }
1324
+ #l(t) {
1325
+ if (!this.#A) return false;
1326
+ let e = t;
1327
+ return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof At;
1328
+ }
1329
+ async fetch(t, e = {}) {
1330
+ let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: h = this.noDisposeOnSet, size: a = 0, sizeCalculation: l = this.sizeCalculation, noUpdateTTL: u = this.noUpdateTTL, noDeleteOnFetchRejection: c = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: f = this.ignoreFetchAbort, allowStaleOnFetchAbort: m = this.allowStaleOnFetchAbort, context: p, forceRefresh: w = false, status: g, signal: S } = e;
1331
+ if (!this.#A) return g && (g.fetch = "get"), this.get(t, { allowStale: s, updateAgeOnGet: i, noDeleteOnStaleGet: r, status: g });
1332
+ let E = { allowStale: s, updateAgeOnGet: i, noDeleteOnStaleGet: r, ttl: o, noDisposeOnSet: h, size: a, sizeCalculation: l, noUpdateTTL: u, noDeleteOnFetchRejection: c, allowStaleOnFetchRejection: d, allowStaleOnFetchAbort: m, ignoreFetchAbort: f, status: g, signal: S }, y = this.#f.get(t);
1333
+ if (y === void 0) {
1334
+ g && (g.fetch = "miss");
1335
+ let b = this.#U(t, y, E, p);
1336
+ return b.__returned = b;
1337
+ } else {
1338
+ let b = this.#i[y];
1339
+ if (this.#l(b)) {
1340
+ let Z = s && b.__staleWhileFetching !== void 0;
1341
+ return g && (g.fetch = "inflight", Z && (g.returnedStale = true)), Z ? b.__staleWhileFetching : b.__returned = b;
1342
+ }
1343
+ let z = this.#v(y);
1344
+ if (!w && !z) return g && (g.fetch = "hit"), this.#W(y), i && this.#k(y), g && this.#N(g, y), b;
1345
+ let $ = this.#U(t, y, E, p), J = $.__staleWhileFetching !== void 0 && s;
1346
+ return g && (g.fetch = z ? "stale" : "refresh", J && z && (g.returnedStale = true)), J ? $.__staleWhileFetching : $.__returned = $;
1347
+ }
1348
+ }
1349
+ async forceFetch(t, e = {}) {
1350
+ let s = await this.fetch(t, e);
1351
+ if (s === void 0) throw new Error("fetch() returned undefined");
1352
+ return s;
1353
+ }
1354
+ memo(t, e = {}) {
1355
+ let s = this.#w;
1356
+ if (!s) throw new Error("no memoMethod provided to constructor");
1357
+ let { context: i, forceRefresh: r, ...o } = e, h = this.get(t, o);
1358
+ if (!r && h !== void 0) return h;
1359
+ let a = s(t, h, { options: o, context: i });
1360
+ return this.set(t, a, o), a;
1361
+ }
1362
+ get(t, e = {}) {
1363
+ let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, status: o } = e, h = this.#f.get(t);
1364
+ if (h !== void 0) {
1365
+ let a = this.#i[h], l = this.#l(a);
1366
+ return o && this.#N(o, h), this.#v(h) ? (o && (o.get = "stale"), l ? (o && s && a.__staleWhileFetching !== void 0 && (o.returnedStale = true), s ? a.__staleWhileFetching : void 0) : (r || this.#O(t, "expire"), o && s && (o.returnedStale = true), s ? a : void 0)) : (o && (o.get = "hit"), l ? a.__staleWhileFetching : (this.#W(h), i && this.#k(h), a));
1367
+ } else o && (o.get = "miss");
1368
+ }
1369
+ #$(t, e) {
1370
+ this.#E[e] = t, this.#d[t] = e;
1371
+ }
1372
+ #W(t) {
1373
+ t !== this.#p && (t === this.#b ? this.#b = this.#d[t] : this.#$(this.#E[t], this.#d[t]), this.#$(this.#p, t), this.#p = t);
1374
+ }
1375
+ delete(t) {
1376
+ return this.#O(t, "delete");
1377
+ }
1378
+ #O(t, e) {
1379
+ let s = false;
1380
+ if (this.#h !== 0) {
1381
+ let i = this.#f.get(t);
1382
+ if (i !== void 0) if (this.#y?.[i] && (clearTimeout(this.#y?.[i]), this.#y[i] = void 0), s = true, this.#h === 1) this.#H(e);
1383
+ else {
1384
+ this.#P(i);
1385
+ let r = this.#i[i];
1386
+ if (this.#l(r) ? r.__abortController.abort(new Error("deleted")) : (this.#x || this.#e) && (this.#x && this.#n?.(r, t, e), this.#e && this.#m?.push([r, t, e])), this.#f.delete(t), this.#a[i] = void 0, this.#i[i] = void 0, i === this.#p) this.#p = this.#E[i];
1387
+ else if (i === this.#b) this.#b = this.#d[i];
1388
+ else {
1389
+ let o = this.#E[i];
1390
+ this.#d[o] = this.#d[i];
1391
+ let h = this.#d[i];
1392
+ this.#E[h] = this.#E[i];
1393
+ }
1394
+ this.#h--, this.#R.push(i);
1395
+ }
1396
+ }
1397
+ if (this.#e && this.#m?.length) {
1398
+ let i = this.#m, r;
1399
+ for (; r = i?.shift(); ) this.#o?.(...r);
1400
+ }
1401
+ return s;
1402
+ }
1403
+ clear() {
1404
+ return this.#H("delete");
1405
+ }
1406
+ #H(t) {
1407
+ for (let e of this.#D({ allowStale: true })) {
1408
+ let s = this.#i[e];
1409
+ if (this.#l(s)) s.__abortController.abort(new Error("deleted"));
1410
+ else {
1411
+ let i = this.#a[e];
1412
+ this.#x && this.#n?.(s, i, t), this.#e && this.#m?.push([s, i, t]);
1413
+ }
1414
+ }
1415
+ if (this.#f.clear(), this.#i.fill(void 0), this.#a.fill(void 0), this.#g && this.#T) {
1416
+ this.#g.fill(0), this.#T.fill(0);
1417
+ for (let e of this.#y ?? []) e !== void 0 && clearTimeout(e);
1418
+ this.#y?.fill(void 0);
1419
+ }
1420
+ if (this.#C && this.#C.fill(0), this.#b = 0, this.#p = 0, this.#R.length = 0, this.#u = 0, this.#h = 0, this.#e && this.#m) {
1421
+ let e = this.#m, s;
1422
+ for (; s = e?.shift(); ) this.#o?.(...s);
1423
+ }
1424
+ }
1425
+ };
1426
+ var Ne = typeof process == "object" && process ? process : { stdout: null, stderr: null };
1427
+ var oi = (n7) => !!n7 && typeof n7 == "object" && (n7 instanceof V || n7 instanceof Pe || hi(n7) || ai(n7));
1428
+ var hi = (n7) => !!n7 && typeof n7 == "object" && n7 instanceof ee && typeof n7.pipe == "function" && n7.pipe !== Pe.Writable.prototype.pipe;
1429
+ var ai = (n7) => !!n7 && typeof n7 == "object" && n7 instanceof ee && typeof n7.write == "function" && typeof n7.end == "function";
1430
+ var G = /* @__PURE__ */ Symbol("EOF");
1431
+ var H = /* @__PURE__ */ Symbol("maybeEmitEnd");
1432
+ var K = /* @__PURE__ */ Symbol("emittedEnd");
1433
+ var kt = /* @__PURE__ */ Symbol("emittingEnd");
1434
+ var ut = /* @__PURE__ */ Symbol("emittedError");
1435
+ var Rt = /* @__PURE__ */ Symbol("closed");
1436
+ var _e = /* @__PURE__ */ Symbol("read");
1437
+ var Ot = /* @__PURE__ */ Symbol("flush");
1438
+ var Le = /* @__PURE__ */ Symbol("flushChunk");
1439
+ var P = /* @__PURE__ */ Symbol("encoding");
1440
+ var et = /* @__PURE__ */ Symbol("decoder");
1441
+ var v = /* @__PURE__ */ Symbol("flowing");
1442
+ var dt = /* @__PURE__ */ Symbol("paused");
1443
+ var st = /* @__PURE__ */ Symbol("resume");
1444
+ var C = /* @__PURE__ */ Symbol("buffer");
1445
+ var F = /* @__PURE__ */ Symbol("pipes");
1446
+ var T = /* @__PURE__ */ Symbol("bufferLength");
1447
+ var Yt = /* @__PURE__ */ Symbol("bufferPush");
1448
+ var Ft = /* @__PURE__ */ Symbol("bufferShift");
1449
+ var k = /* @__PURE__ */ Symbol("objectMode");
1450
+ var x = /* @__PURE__ */ Symbol("destroyed");
1451
+ var Xt = /* @__PURE__ */ Symbol("error");
1452
+ var Jt = /* @__PURE__ */ Symbol("emitData");
1453
+ var We = /* @__PURE__ */ Symbol("emitEnd");
1454
+ var Zt = /* @__PURE__ */ Symbol("emitEnd2");
1455
+ var B = /* @__PURE__ */ Symbol("async");
1456
+ var Qt = /* @__PURE__ */ Symbol("abort");
1457
+ var Dt = /* @__PURE__ */ Symbol("aborted");
1458
+ var pt = /* @__PURE__ */ Symbol("signal");
1459
+ var Y = /* @__PURE__ */ Symbol("dataListeners");
1460
+ var M = /* @__PURE__ */ Symbol("discarded");
1461
+ var mt = (n7) => Promise.resolve().then(n7);
1462
+ var li = (n7) => n7();
1463
+ var ci = (n7) => n7 === "end" || n7 === "finish" || n7 === "prefinish";
1464
+ var fi = (n7) => n7 instanceof ArrayBuffer || !!n7 && typeof n7 == "object" && n7.constructor && n7.constructor.name === "ArrayBuffer" && n7.byteLength >= 0;
1465
+ var ui = (n7) => !Buffer.isBuffer(n7) && ArrayBuffer.isView(n7);
1466
+ var Mt = class {
1467
+ src;
1468
+ dest;
1469
+ opts;
1470
+ ondrain;
1471
+ constructor(t, e, s) {
1472
+ this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[st](), this.dest.on("drain", this.ondrain);
1473
+ }
1474
+ unpipe() {
1475
+ this.dest.removeListener("drain", this.ondrain);
1476
+ }
1477
+ proxyErrors(t) {
1478
+ }
1479
+ end() {
1480
+ this.unpipe(), this.opts.end && this.dest.end();
1481
+ }
1482
+ };
1483
+ var te = class extends Mt {
1484
+ unpipe() {
1485
+ this.src.removeListener("error", this.proxyErrors), super.unpipe();
1486
+ }
1487
+ constructor(t, e, s) {
1488
+ super(t, e, s), this.proxyErrors = (i) => this.dest.emit("error", i), t.on("error", this.proxyErrors);
1489
+ }
1490
+ };
1491
+ var di = (n7) => !!n7.objectMode;
1492
+ var pi = (n7) => !n7.objectMode && !!n7.encoding && n7.encoding !== "buffer";
1493
+ var V = class extends ee {
1494
+ [v] = false;
1495
+ [dt] = false;
1496
+ [F] = [];
1497
+ [C] = [];
1498
+ [k];
1499
+ [P];
1500
+ [B];
1501
+ [et];
1502
+ [G] = false;
1503
+ [K] = false;
1504
+ [kt] = false;
1505
+ [Rt] = false;
1506
+ [ut] = null;
1507
+ [T] = 0;
1508
+ [x] = false;
1509
+ [pt];
1510
+ [Dt] = false;
1511
+ [Y] = 0;
1512
+ [M] = false;
1513
+ writable = true;
1514
+ readable = true;
1515
+ constructor(...t) {
1516
+ let e = t[0] || {};
1517
+ if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together");
1518
+ di(e) ? (this[k] = true, this[P] = null) : pi(e) ? (this[P] = e.encoding, this[k] = false) : (this[k] = false, this[P] = null), this[B] = !!e.async, this[et] = this[P] ? new ni(this[P]) : null, e && e.debugExposeBuffer === true && Object.defineProperty(this, "buffer", { get: () => this[C] }), e && e.debugExposePipes === true && Object.defineProperty(this, "pipes", { get: () => this[F] });
1519
+ let { signal: s } = e;
1520
+ s && (this[pt] = s, s.aborted ? this[Qt]() : s.addEventListener("abort", () => this[Qt]()));
1521
+ }
1522
+ get bufferLength() {
1523
+ return this[T];
1524
+ }
1525
+ get encoding() {
1526
+ return this[P];
1527
+ }
1528
+ set encoding(t) {
1529
+ throw new Error("Encoding must be set at instantiation time");
1530
+ }
1531
+ setEncoding(t) {
1532
+ throw new Error("Encoding must be set at instantiation time");
1533
+ }
1534
+ get objectMode() {
1535
+ return this[k];
1536
+ }
1537
+ set objectMode(t) {
1538
+ throw new Error("objectMode must be set at instantiation time");
1539
+ }
1540
+ get async() {
1541
+ return this[B];
1542
+ }
1543
+ set async(t) {
1544
+ this[B] = this[B] || !!t;
1545
+ }
1546
+ [Qt]() {
1547
+ this[Dt] = true, this.emit("abort", this[pt]?.reason), this.destroy(this[pt]?.reason);
1548
+ }
1549
+ get aborted() {
1550
+ return this[Dt];
1551
+ }
1552
+ set aborted(t) {
1553
+ }
1554
+ write(t, e, s) {
1555
+ if (this[Dt]) return false;
1556
+ if (this[G]) throw new Error("write after end");
1557
+ if (this[x]) return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
1558
+ typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
1559
+ let i = this[B] ? mt : li;
1560
+ if (!this[k] && !Buffer.isBuffer(t)) {
1561
+ if (ui(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
1562
+ else if (fi(t)) t = Buffer.from(t);
1563
+ else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream");
1564
+ }
1565
+ return this[k] ? (this[v] && this[T] !== 0 && this[Ot](true), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : t.length ? (typeof t == "string" && !(e === this[P] && !this[et]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[P] && (t = this[et].write(t)), this[v] && this[T] !== 0 && this[Ot](true), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : (this[T] !== 0 && this.emit("readable"), s && i(s), this[v]);
1566
+ }
1567
+ read(t) {
1568
+ if (this[x]) return null;
1569
+ if (this[M] = false, this[T] === 0 || t === 0 || t && t > this[T]) return this[H](), null;
1570
+ this[k] && (t = null), this[C].length > 1 && !this[k] && (this[C] = [this[P] ? this[C].join("") : Buffer.concat(this[C], this[T])]);
1571
+ let e = this[_e](t || null, this[C][0]);
1572
+ return this[H](), e;
1573
+ }
1574
+ [_e](t, e) {
1575
+ if (this[k]) this[Ft]();
1576
+ else {
1577
+ let s = e;
1578
+ t === s.length || t === null ? this[Ft]() : typeof s == "string" ? (this[C][0] = s.slice(t), e = s.slice(0, t), this[T] -= t) : (this[C][0] = s.subarray(t), e = s.subarray(0, t), this[T] -= t);
1579
+ }
1580
+ return this.emit("data", e), !this[C].length && !this[G] && this.emit("drain"), e;
1581
+ }
1582
+ end(t, e, s) {
1583
+ return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[G] = true, this.writable = false, (this[v] || !this[dt]) && this[H](), this;
1584
+ }
1585
+ [st]() {
1586
+ this[x] || (!this[Y] && !this[F].length && (this[M] = true), this[dt] = false, this[v] = true, this.emit("resume"), this[C].length ? this[Ot]() : this[G] ? this[H]() : this.emit("drain"));
1587
+ }
1588
+ resume() {
1589
+ return this[st]();
1590
+ }
1591
+ pause() {
1592
+ this[v] = false, this[dt] = true, this[M] = false;
1593
+ }
1594
+ get destroyed() {
1595
+ return this[x];
1596
+ }
1597
+ get flowing() {
1598
+ return this[v];
1599
+ }
1600
+ get paused() {
1601
+ return this[dt];
1602
+ }
1603
+ [Yt](t) {
1604
+ this[k] ? this[T] += 1 : this[T] += t.length, this[C].push(t);
1605
+ }
1606
+ [Ft]() {
1607
+ return this[k] ? this[T] -= 1 : this[T] -= this[C][0].length, this[C].shift();
1608
+ }
1609
+ [Ot](t = false) {
1610
+ do
1611
+ ;
1612
+ while (this[Le](this[Ft]()) && this[C].length);
1613
+ !t && !this[C].length && !this[G] && this.emit("drain");
1614
+ }
1615
+ [Le](t) {
1616
+ return this.emit("data", t), this[v];
1617
+ }
1618
+ pipe(t, e) {
1619
+ if (this[x]) return t;
1620
+ this[M] = false;
1621
+ let s = this[K];
1622
+ return e = e || {}, t === Ne.stdout || t === Ne.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[F].push(e.proxyErrors ? new te(this, t, e) : new Mt(this, t, e)), this[B] ? mt(() => this[st]()) : this[st]()), t;
1623
+ }
1624
+ unpipe(t) {
1625
+ let e = this[F].find((s) => s.dest === t);
1626
+ e && (this[F].length === 1 ? (this[v] && this[Y] === 0 && (this[v] = false), this[F] = []) : this[F].splice(this[F].indexOf(e), 1), e.unpipe());
1627
+ }
1628
+ addListener(t, e) {
1629
+ return this.on(t, e);
1630
+ }
1631
+ on(t, e) {
1632
+ let s = super.on(t, e);
1633
+ if (t === "data") this[M] = false, this[Y]++, !this[F].length && !this[v] && this[st]();
1634
+ else if (t === "readable" && this[T] !== 0) super.emit("readable");
1635
+ else if (ci(t) && this[K]) super.emit(t), this.removeAllListeners(t);
1636
+ else if (t === "error" && this[ut]) {
1637
+ let i = e;
1638
+ this[B] ? mt(() => i.call(this, this[ut])) : i.call(this, this[ut]);
1639
+ }
1640
+ return s;
1641
+ }
1642
+ removeListener(t, e) {
1643
+ return this.off(t, e);
1644
+ }
1645
+ off(t, e) {
1646
+ let s = super.off(t, e);
1647
+ return t === "data" && (this[Y] = this.listeners("data").length, this[Y] === 0 && !this[M] && !this[F].length && (this[v] = false)), s;
1648
+ }
1649
+ removeAllListeners(t) {
1650
+ let e = super.removeAllListeners(t);
1651
+ return (t === "data" || t === void 0) && (this[Y] = 0, !this[M] && !this[F].length && (this[v] = false)), e;
1652
+ }
1653
+ get emittedEnd() {
1654
+ return this[K];
1655
+ }
1656
+ [H]() {
1657
+ !this[kt] && !this[K] && !this[x] && this[C].length === 0 && this[G] && (this[kt] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Rt] && this.emit("close"), this[kt] = false);
1658
+ }
1659
+ emit(t, ...e) {
1660
+ let s = e[0];
1661
+ if (t !== "error" && t !== "close" && t !== x && this[x]) return false;
1662
+ if (t === "data") return !this[k] && !s ? false : this[B] ? (mt(() => this[Jt](s)), true) : this[Jt](s);
1663
+ if (t === "end") return this[We]();
1664
+ if (t === "close") {
1665
+ if (this[Rt] = true, !this[K] && !this[x]) return false;
1666
+ let r = super.emit("close");
1667
+ return this.removeAllListeners("close"), r;
1668
+ } else if (t === "error") {
1669
+ this[ut] = s, super.emit(Xt, s);
1670
+ let r = !this[pt] || this.listeners("error").length ? super.emit("error", s) : false;
1671
+ return this[H](), r;
1672
+ } else if (t === "resume") {
1673
+ let r = super.emit("resume");
1674
+ return this[H](), r;
1675
+ } else if (t === "finish" || t === "prefinish") {
1676
+ let r = super.emit(t);
1677
+ return this.removeAllListeners(t), r;
1678
+ }
1679
+ let i = super.emit(t, ...e);
1680
+ return this[H](), i;
1681
+ }
1682
+ [Jt](t) {
1683
+ for (let s of this[F]) s.dest.write(t) === false && this.pause();
1684
+ let e = this[M] ? false : super.emit("data", t);
1685
+ return this[H](), e;
1686
+ }
1687
+ [We]() {
1688
+ return this[K] ? false : (this[K] = true, this.readable = false, this[B] ? (mt(() => this[Zt]()), true) : this[Zt]());
1689
+ }
1690
+ [Zt]() {
1691
+ if (this[et]) {
1692
+ let e = this[et].end();
1693
+ if (e) {
1694
+ for (let s of this[F]) s.dest.write(e);
1695
+ this[M] || super.emit("data", e);
1696
+ }
1697
+ }
1698
+ for (let e of this[F]) e.end();
1699
+ let t = super.emit("end");
1700
+ return this.removeAllListeners("end"), t;
1701
+ }
1702
+ async collect() {
1703
+ let t = Object.assign([], { dataLength: 0 });
1704
+ this[k] || (t.dataLength = 0);
1705
+ let e = this.promise();
1706
+ return this.on("data", (s) => {
1707
+ t.push(s), this[k] || (t.dataLength += s.length);
1708
+ }), await e, t;
1709
+ }
1710
+ async concat() {
1711
+ if (this[k]) throw new Error("cannot concat in objectMode");
1712
+ let t = await this.collect();
1713
+ return this[P] ? t.join("") : Buffer.concat(t, t.dataLength);
1714
+ }
1715
+ async promise() {
1716
+ return new Promise((t, e) => {
1717
+ this.on(x, () => e(new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t());
1718
+ });
1719
+ }
1720
+ [Symbol.asyncIterator]() {
1721
+ this[M] = false;
1722
+ let t = false, e = async () => (this.pause(), t = true, { value: void 0, done: true });
1723
+ return { next: () => {
1724
+ if (t) return e();
1725
+ let i = this.read();
1726
+ if (i !== null) return Promise.resolve({ done: false, value: i });
1727
+ if (this[G]) return e();
1728
+ let r, o, h = (c) => {
1729
+ this.off("data", a), this.off("end", l), this.off(x, u), e(), o(c);
1730
+ }, a = (c) => {
1731
+ this.off("error", h), this.off("end", l), this.off(x, u), this.pause(), r({ value: c, done: !!this[G] });
1732
+ }, l = () => {
1733
+ this.off("error", h), this.off("data", a), this.off(x, u), e(), r({ done: true, value: void 0 });
1734
+ }, u = () => h(new Error("stream destroyed"));
1735
+ return new Promise((c, d) => {
1736
+ o = d, r = c, this.once(x, u), this.once("error", h), this.once("end", l), this.once("data", a);
1737
+ });
1738
+ }, throw: e, return: e, [Symbol.asyncIterator]() {
1739
+ return this;
1740
+ }, [Symbol.asyncDispose]: async () => {
1741
+ } };
1742
+ }
1743
+ [Symbol.iterator]() {
1744
+ this[M] = false;
1745
+ let t = false, e = () => (this.pause(), this.off(Xt, e), this.off(x, e), this.off("end", e), t = true, { done: true, value: void 0 }), s = () => {
1746
+ if (t) return e();
1747
+ let i = this.read();
1748
+ return i === null ? e() : { done: false, value: i };
1749
+ };
1750
+ return this.once("end", e), this.once(Xt, e), this.once(x, e), { next: s, throw: e, return: e, [Symbol.iterator]() {
1751
+ return this;
1752
+ }, [Symbol.dispose]: () => {
1753
+ } };
1754
+ }
1755
+ destroy(t) {
1756
+ if (this[x]) return t ? this.emit("error", t) : this.emit(x), this;
1757
+ this[x] = true, this[M] = true, this[C].length = 0, this[T] = 0;
1758
+ let e = this;
1759
+ return typeof e.close == "function" && !this[Rt] && e.close(), t ? this.emit("error", t) : this.emit(x), this;
1760
+ }
1761
+ static get isStream() {
1762
+ return oi;
1763
+ }
1764
+ };
1765
+ var vi = Ei.native;
1766
+ var wt = { lstatSync: wi, readdir: yi, readdirSync: bi, readlinkSync: Si, realpathSync: vi, promises: { lstat: Ci, readdir: Ti, readlink: Ai, realpath: ki } };
1767
+ var Ue = (n7) => !n7 || n7 === wt || n7 === xi ? wt : { ...wt, ...n7, promises: { ...wt.promises, ...n7.promises || {} } };
1768
+ var $e = /^\\\\\?\\([a-z]:)\\?$/i;
1769
+ var Ri = (n7) => n7.replace(/\//g, "\\").replace($e, "$1\\");
1770
+ var Oi = /[\\\/]/;
1771
+ var L = 0;
1772
+ var Ge = 1;
1773
+ var He = 2;
1774
+ var U = 4;
1775
+ var qe = 6;
1776
+ var Ke = 8;
1777
+ var X = 10;
1778
+ var Ve = 12;
1779
+ var _ = 15;
1780
+ var gt = ~_;
1781
+ var se = 16;
1782
+ var je = 32;
1783
+ var yt = 64;
1784
+ var j = 128;
1785
+ var Nt = 256;
1786
+ var Lt = 512;
1787
+ var Ie = yt | j | Lt;
1788
+ var Fi = 1023;
1789
+ var ie = (n7) => n7.isFile() ? Ke : n7.isDirectory() ? U : n7.isSymbolicLink() ? X : n7.isCharacterDevice() ? He : n7.isBlockDevice() ? qe : n7.isSocket() ? Ve : n7.isFIFO() ? Ge : L;
1790
+ var ze = new ft({ max: 2 ** 12 });
1791
+ var bt = (n7) => {
1792
+ let t = ze.get(n7);
1793
+ if (t) return t;
1794
+ let e = n7.normalize("NFKD");
1795
+ return ze.set(n7, e), e;
1796
+ };
1797
+ var Be = new ft({ max: 2 ** 12 });
1798
+ var _t = (n7) => {
1799
+ let t = Be.get(n7);
1800
+ if (t) return t;
1801
+ let e = bt(n7.toLowerCase());
1802
+ return Be.set(n7, e), e;
1803
+ };
1804
+ var Wt = class extends ft {
1805
+ constructor() {
1806
+ super({ max: 256 });
1807
+ }
1808
+ };
1809
+ var ne = class extends ft {
1810
+ constructor(t = 16 * 1024) {
1811
+ super({ maxSize: t, sizeCalculation: (e) => e.length + 1 });
1812
+ }
1813
+ };
1814
+ var Ye = /* @__PURE__ */ Symbol("PathScurry setAsCwd");
1815
+ var R = class {
1816
+ name;
1817
+ root;
1818
+ roots;
1819
+ parent;
1820
+ nocase;
1821
+ isCWD = false;
1822
+ #t;
1823
+ #s;
1824
+ get dev() {
1825
+ return this.#s;
1826
+ }
1827
+ #n;
1828
+ get mode() {
1829
+ return this.#n;
1830
+ }
1831
+ #r;
1832
+ get nlink() {
1833
+ return this.#r;
1834
+ }
1835
+ #o;
1836
+ get uid() {
1837
+ return this.#o;
1838
+ }
1839
+ #S;
1840
+ get gid() {
1841
+ return this.#S;
1842
+ }
1843
+ #w;
1844
+ get rdev() {
1845
+ return this.#w;
1846
+ }
1847
+ #c;
1848
+ get blksize() {
1849
+ return this.#c;
1850
+ }
1851
+ #h;
1852
+ get ino() {
1853
+ return this.#h;
1854
+ }
1855
+ #u;
1856
+ get size() {
1857
+ return this.#u;
1858
+ }
1859
+ #f;
1860
+ get blocks() {
1861
+ return this.#f;
1862
+ }
1863
+ #a;
1864
+ get atimeMs() {
1865
+ return this.#a;
1866
+ }
1867
+ #i;
1868
+ get mtimeMs() {
1869
+ return this.#i;
1870
+ }
1871
+ #d;
1872
+ get ctimeMs() {
1873
+ return this.#d;
1874
+ }
1875
+ #E;
1876
+ get birthtimeMs() {
1877
+ return this.#E;
1878
+ }
1879
+ #b;
1880
+ get atime() {
1881
+ return this.#b;
1882
+ }
1883
+ #p;
1884
+ get mtime() {
1885
+ return this.#p;
1886
+ }
1887
+ #R;
1888
+ get ctime() {
1889
+ return this.#R;
1890
+ }
1891
+ #m;
1892
+ get birthtime() {
1893
+ return this.#m;
1894
+ }
1895
+ #C;
1896
+ #T;
1897
+ #g;
1898
+ #y;
1899
+ #x;
1900
+ #A;
1901
+ #e;
1902
+ #_;
1903
+ #M;
1904
+ #k;
1905
+ get parentPath() {
1906
+ return (this.parent || this).fullpath();
1907
+ }
1908
+ get path() {
1909
+ return this.parentPath;
1910
+ }
1911
+ constructor(t, e = L, s, i, r, o, h) {
1912
+ this.name = t, this.#C = r ? _t(t) : bt(t), this.#e = e & Fi, this.nocase = r, this.roots = i, this.root = s || this, this.#_ = o, this.#g = h.fullpath, this.#x = h.relative, this.#A = h.relativePosix, this.parent = h.parent, this.parent ? this.#t = this.parent.#t : this.#t = Ue(h.fs);
1913
+ }
1914
+ depth() {
1915
+ return this.#T !== void 0 ? this.#T : this.parent ? this.#T = this.parent.depth() + 1 : this.#T = 0;
1916
+ }
1917
+ childrenCache() {
1918
+ return this.#_;
1919
+ }
1920
+ resolve(t) {
1921
+ if (!t) return this;
1922
+ let e = this.getRootString(t), i = t.substring(e.length).split(this.splitSep);
1923
+ return e ? this.getRoot(e).#N(i) : this.#N(i);
1924
+ }
1925
+ #N(t) {
1926
+ let e = this;
1927
+ for (let s of t) e = e.child(s);
1928
+ return e;
1929
+ }
1930
+ children() {
1931
+ let t = this.#_.get(this);
1932
+ if (t) return t;
1933
+ let e = Object.assign([], { provisional: 0 });
1934
+ return this.#_.set(this, e), this.#e &= ~se, e;
1935
+ }
1936
+ child(t, e) {
1937
+ if (t === "" || t === ".") return this;
1938
+ if (t === "..") return this.parent || this;
1939
+ let s = this.children(), i = this.nocase ? _t(t) : bt(t);
1940
+ for (let a of s) if (a.#C === i) return a;
1941
+ let r = this.parent ? this.sep : "", o = this.#g ? this.#g + r + t : void 0, h = this.newChild(t, L, { ...e, parent: this, fullpath: o });
1942
+ return this.canReaddir() || (h.#e |= j), s.push(h), h;
1943
+ }
1944
+ relative() {
1945
+ if (this.isCWD) return "";
1946
+ if (this.#x !== void 0) return this.#x;
1947
+ let t = this.name, e = this.parent;
1948
+ if (!e) return this.#x = this.name;
1949
+ let s = e.relative();
1950
+ return s + (!s || !e.parent ? "" : this.sep) + t;
1951
+ }
1952
+ relativePosix() {
1953
+ if (this.sep === "/") return this.relative();
1954
+ if (this.isCWD) return "";
1955
+ if (this.#A !== void 0) return this.#A;
1956
+ let t = this.name, e = this.parent;
1957
+ if (!e) return this.#A = this.fullpathPosix();
1958
+ let s = e.relativePosix();
1959
+ return s + (!s || !e.parent ? "" : "/") + t;
1960
+ }
1961
+ fullpath() {
1962
+ if (this.#g !== void 0) return this.#g;
1963
+ let t = this.name, e = this.parent;
1964
+ if (!e) return this.#g = this.name;
1965
+ let i = e.fullpath() + (e.parent ? this.sep : "") + t;
1966
+ return this.#g = i;
1967
+ }
1968
+ fullpathPosix() {
1969
+ if (this.#y !== void 0) return this.#y;
1970
+ if (this.sep === "/") return this.#y = this.fullpath();
1971
+ if (!this.parent) {
1972
+ let i = this.fullpath().replace(/\\/g, "/");
1973
+ return /^[a-z]:\//i.test(i) ? this.#y = `//?/${i}` : this.#y = i;
1974
+ }
1975
+ let t = this.parent, e = t.fullpathPosix(), s = e + (!e || !t.parent ? "" : "/") + this.name;
1976
+ return this.#y = s;
1977
+ }
1978
+ isUnknown() {
1979
+ return (this.#e & _) === L;
1980
+ }
1981
+ isType(t) {
1982
+ return this[`is${t}`]();
1983
+ }
1984
+ getType() {
1985
+ return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" : this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : this.isSocket() ? "Socket" : "Unknown";
1986
+ }
1987
+ isFile() {
1988
+ return (this.#e & _) === Ke;
1989
+ }
1990
+ isDirectory() {
1991
+ return (this.#e & _) === U;
1992
+ }
1993
+ isCharacterDevice() {
1994
+ return (this.#e & _) === He;
1995
+ }
1996
+ isBlockDevice() {
1997
+ return (this.#e & _) === qe;
1998
+ }
1999
+ isFIFO() {
2000
+ return (this.#e & _) === Ge;
2001
+ }
2002
+ isSocket() {
2003
+ return (this.#e & _) === Ve;
2004
+ }
2005
+ isSymbolicLink() {
2006
+ return (this.#e & X) === X;
2007
+ }
2008
+ lstatCached() {
2009
+ return this.#e & je ? this : void 0;
2010
+ }
2011
+ readlinkCached() {
2012
+ return this.#M;
2013
+ }
2014
+ realpathCached() {
2015
+ return this.#k;
2016
+ }
2017
+ readdirCached() {
2018
+ let t = this.children();
2019
+ return t.slice(0, t.provisional);
2020
+ }
2021
+ canReadlink() {
2022
+ if (this.#M) return true;
2023
+ if (!this.parent) return false;
2024
+ let t = this.#e & _;
2025
+ return !(t !== L && t !== X || this.#e & Nt || this.#e & j);
2026
+ }
2027
+ calledReaddir() {
2028
+ return !!(this.#e & se);
2029
+ }
2030
+ isENOENT() {
2031
+ return !!(this.#e & j);
2032
+ }
2033
+ isNamed(t) {
2034
+ return this.nocase ? this.#C === _t(t) : this.#C === bt(t);
2035
+ }
2036
+ async readlink() {
2037
+ let t = this.#M;
2038
+ if (t) return t;
2039
+ if (this.canReadlink() && this.parent) try {
2040
+ let e = await this.#t.promises.readlink(this.fullpath()), s = (await this.parent.realpath())?.resolve(e);
2041
+ if (s) return this.#M = s;
2042
+ } catch (e) {
2043
+ this.#D(e.code);
2044
+ return;
2045
+ }
2046
+ }
2047
+ readlinkSync() {
2048
+ let t = this.#M;
2049
+ if (t) return t;
2050
+ if (this.canReadlink() && this.parent) try {
2051
+ let e = this.#t.readlinkSync(this.fullpath()), s = this.parent.realpathSync()?.resolve(e);
2052
+ if (s) return this.#M = s;
2053
+ } catch (e) {
2054
+ this.#D(e.code);
2055
+ return;
2056
+ }
2057
+ }
2058
+ #j(t) {
2059
+ this.#e |= se;
2060
+ for (let e = t.provisional; e < t.length; e++) {
2061
+ let s = t[e];
2062
+ s && s.#v();
2063
+ }
2064
+ }
2065
+ #v() {
2066
+ this.#e & j || (this.#e = (this.#e | j) & gt, this.#G());
2067
+ }
2068
+ #G() {
2069
+ let t = this.children();
2070
+ t.provisional = 0;
2071
+ for (let e of t) e.#v();
2072
+ }
2073
+ #P() {
2074
+ this.#e |= Lt, this.#L();
2075
+ }
2076
+ #L() {
2077
+ if (this.#e & yt) return;
2078
+ let t = this.#e;
2079
+ (t & _) === U && (t &= gt), this.#e = t | yt, this.#G();
2080
+ }
2081
+ #I(t = "") {
2082
+ t === "ENOTDIR" || t === "EPERM" ? this.#L() : t === "ENOENT" ? this.#v() : this.children().provisional = 0;
2083
+ }
2084
+ #F(t = "") {
2085
+ t === "ENOTDIR" ? this.parent.#L() : t === "ENOENT" && this.#v();
2086
+ }
2087
+ #D(t = "") {
2088
+ let e = this.#e;
2089
+ e |= Nt, t === "ENOENT" && (e |= j), (t === "EINVAL" || t === "UNKNOWN") && (e &= gt), this.#e = e, t === "ENOTDIR" && this.parent && this.parent.#L();
2090
+ }
2091
+ #z(t, e) {
2092
+ return this.#U(t, e) || this.#B(t, e);
2093
+ }
2094
+ #B(t, e) {
2095
+ let s = ie(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & _;
2096
+ return r !== U && r !== X && r !== L && (i.#e |= yt), e.unshift(i), e.provisional++, i;
2097
+ }
2098
+ #U(t, e) {
2099
+ for (let s = e.provisional; s < e.length; s++) {
2100
+ let i = e[s];
2101
+ if ((this.nocase ? _t(t.name) : bt(t.name)) === i.#C) return this.#l(t, i, s, e);
2102
+ }
2103
+ }
2104
+ #l(t, e, s, i) {
2105
+ let r = e.name;
2106
+ return e.#e = e.#e & gt | ie(t), r !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1), i.unshift(e)), i.provisional++, e;
2107
+ }
2108
+ async lstat() {
2109
+ if ((this.#e & j) === 0) try {
2110
+ return this.#$(await this.#t.promises.lstat(this.fullpath())), this;
2111
+ } catch (t) {
2112
+ this.#F(t.code);
2113
+ }
2114
+ }
2115
+ lstatSync() {
2116
+ if ((this.#e & j) === 0) try {
2117
+ return this.#$(this.#t.lstatSync(this.fullpath())), this;
2118
+ } catch (t) {
2119
+ this.#F(t.code);
2120
+ }
2121
+ }
2122
+ #$(t) {
2123
+ let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: r, blksize: o, blocks: h, ctime: a, ctimeMs: l, dev: u, gid: c, ino: d, mode: f, mtime: m, mtimeMs: p, nlink: w, rdev: g, size: S, uid: E } = t;
2124
+ this.#b = e, this.#a = s, this.#m = i, this.#E = r, this.#c = o, this.#f = h, this.#R = a, this.#d = l, this.#s = u, this.#S = c, this.#h = d, this.#n = f, this.#p = m, this.#i = p, this.#r = w, this.#w = g, this.#u = S, this.#o = E;
2125
+ let y = ie(t);
2126
+ this.#e = this.#e & gt | y | je, y !== L && y !== U && y !== X && (this.#e |= yt);
2127
+ }
2128
+ #W = [];
2129
+ #O = false;
2130
+ #H(t) {
2131
+ this.#O = false;
2132
+ let e = this.#W.slice();
2133
+ this.#W.length = 0, e.forEach((s) => s(null, t));
2134
+ }
2135
+ readdirCB(t, e = false) {
2136
+ if (!this.canReaddir()) {
2137
+ e ? t(null, []) : queueMicrotask(() => t(null, []));
2138
+ return;
2139
+ }
2140
+ let s = this.children();
2141
+ if (this.calledReaddir()) {
2142
+ let r = s.slice(0, s.provisional);
2143
+ e ? t(null, r) : queueMicrotask(() => t(null, r));
2144
+ return;
2145
+ }
2146
+ if (this.#W.push(t), this.#O) return;
2147
+ this.#O = true;
2148
+ let i = this.fullpath();
2149
+ this.#t.readdir(i, { withFileTypes: true }, (r, o) => {
2150
+ if (r) this.#I(r.code), s.provisional = 0;
2151
+ else {
2152
+ for (let h of o) this.#z(h, s);
2153
+ this.#j(s);
2154
+ }
2155
+ this.#H(s.slice(0, s.provisional));
2156
+ });
2157
+ }
2158
+ #q;
2159
+ async readdir() {
2160
+ if (!this.canReaddir()) return [];
2161
+ let t = this.children();
2162
+ if (this.calledReaddir()) return t.slice(0, t.provisional);
2163
+ let e = this.fullpath();
2164
+ if (this.#q) await this.#q;
2165
+ else {
2166
+ let s = () => {
2167
+ };
2168
+ this.#q = new Promise((i) => s = i);
2169
+ try {
2170
+ for (let i of await this.#t.promises.readdir(e, { withFileTypes: true })) this.#z(i, t);
2171
+ this.#j(t);
2172
+ } catch (i) {
2173
+ this.#I(i.code), t.provisional = 0;
2174
+ }
2175
+ this.#q = void 0, s();
2176
+ }
2177
+ return t.slice(0, t.provisional);
2178
+ }
2179
+ readdirSync() {
2180
+ if (!this.canReaddir()) return [];
2181
+ let t = this.children();
2182
+ if (this.calledReaddir()) return t.slice(0, t.provisional);
2183
+ let e = this.fullpath();
2184
+ try {
2185
+ for (let s of this.#t.readdirSync(e, { withFileTypes: true })) this.#z(s, t);
2186
+ this.#j(t);
2187
+ } catch (s) {
2188
+ this.#I(s.code), t.provisional = 0;
2189
+ }
2190
+ return t.slice(0, t.provisional);
2191
+ }
2192
+ canReaddir() {
2193
+ if (this.#e & Ie) return false;
2194
+ let t = _ & this.#e;
2195
+ return t === L || t === U || t === X;
2196
+ }
2197
+ shouldWalk(t, e) {
2198
+ return (this.#e & U) === U && !(this.#e & Ie) && !t.has(this) && (!e || e(this));
2199
+ }
2200
+ async realpath() {
2201
+ if (this.#k) return this.#k;
2202
+ if (!((Lt | Nt | j) & this.#e)) try {
2203
+ let t = await this.#t.promises.realpath(this.fullpath());
2204
+ return this.#k = this.resolve(t);
2205
+ } catch {
2206
+ this.#P();
2207
+ }
2208
+ }
2209
+ realpathSync() {
2210
+ if (this.#k) return this.#k;
2211
+ if (!((Lt | Nt | j) & this.#e)) try {
2212
+ let t = this.#t.realpathSync(this.fullpath());
2213
+ return this.#k = this.resolve(t);
2214
+ } catch {
2215
+ this.#P();
2216
+ }
2217
+ }
2218
+ [Ye](t) {
2219
+ if (t === this) return;
2220
+ t.isCWD = false, this.isCWD = true;
2221
+ let e = /* @__PURE__ */ new Set([]), s = [], i = this;
2222
+ for (; i && i.parent; ) e.add(i), i.#x = s.join(this.sep), i.#A = s.join("/"), i = i.parent, s.push("..");
2223
+ for (i = t; i && i.parent && !e.has(i); ) i.#x = void 0, i.#A = void 0, i = i.parent;
2224
+ }
2225
+ };
2226
+ var Pt = class n2 extends R {
2227
+ sep = "\\";
2228
+ splitSep = Oi;
2229
+ constructor(t, e = L, s, i, r, o, h) {
2230
+ super(t, e, s, i, r, o, h);
2231
+ }
2232
+ newChild(t, e = L, s = {}) {
2233
+ return new n2(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
2234
+ }
2235
+ getRootString(t) {
2236
+ return re.parse(t).root;
2237
+ }
2238
+ getRoot(t) {
2239
+ if (t = Ri(t.toUpperCase()), t === this.root.name) return this.root;
2240
+ for (let [e, s] of Object.entries(this.roots)) if (this.sameRoot(t, e)) return this.roots[t] = s;
2241
+ return this.roots[t] = new it(t, this).root;
2242
+ }
2243
+ sameRoot(t, e = this.root.name) {
2244
+ return t = t.toUpperCase().replace(/\//g, "\\").replace($e, "$1\\"), t === e;
2245
+ }
2246
+ };
2247
+ var jt = class n3 extends R {
2248
+ splitSep = "/";
2249
+ sep = "/";
2250
+ constructor(t, e = L, s, i, r, o, h) {
2251
+ super(t, e, s, i, r, o, h);
2252
+ }
2253
+ getRootString(t) {
2254
+ return t.startsWith("/") ? "/" : "";
2255
+ }
2256
+ getRoot(t) {
2257
+ return this.root;
2258
+ }
2259
+ newChild(t, e = L, s = {}) {
2260
+ return new n3(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
2261
+ }
2262
+ };
2263
+ var It = class {
2264
+ root;
2265
+ rootPath;
2266
+ roots;
2267
+ cwd;
2268
+ #t;
2269
+ #s;
2270
+ #n;
2271
+ nocase;
2272
+ #r;
2273
+ constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16 * 1024, fs: o = wt } = {}) {
2274
+ this.#r = Ue(o), (t instanceof URL || t.startsWith("file://")) && (t = gi(t));
2275
+ let h = e.resolve(t);
2276
+ this.roots = /* @__PURE__ */ Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Wt(), this.#s = new Wt(), this.#n = new ne(r);
2277
+ let a = h.substring(this.rootPath.length).split(s);
2278
+ if (a.length === 1 && !a[0] && a.pop(), i === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor");
2279
+ this.nocase = i, this.root = this.newRoot(this.#r), this.roots[this.rootPath] = this.root;
2280
+ let l = this.root, u = a.length - 1, c = e.sep, d = this.rootPath, f = false;
2281
+ for (let m of a) {
2282
+ let p = u--;
2283
+ l = l.child(m, { relative: new Array(p).fill("..").join(c), relativePosix: new Array(p).fill("..").join("/"), fullpath: d += (f ? "" : c) + m }), f = true;
2284
+ }
2285
+ this.cwd = l;
2286
+ }
2287
+ depth(t = this.cwd) {
2288
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
2289
+ }
2290
+ childrenCache() {
2291
+ return this.#n;
2292
+ }
2293
+ resolve(...t) {
2294
+ let e = "";
2295
+ for (let r = t.length - 1; r >= 0; r--) {
2296
+ let o = t[r];
2297
+ if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
2298
+ }
2299
+ let s = this.#t.get(e);
2300
+ if (s !== void 0) return s;
2301
+ let i = this.cwd.resolve(e).fullpath();
2302
+ return this.#t.set(e, i), i;
2303
+ }
2304
+ resolvePosix(...t) {
2305
+ let e = "";
2306
+ for (let r = t.length - 1; r >= 0; r--) {
2307
+ let o = t[r];
2308
+ if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
2309
+ }
2310
+ let s = this.#s.get(e);
2311
+ if (s !== void 0) return s;
2312
+ let i = this.cwd.resolve(e).fullpathPosix();
2313
+ return this.#s.set(e, i), i;
2314
+ }
2315
+ relative(t = this.cwd) {
2316
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
2317
+ }
2318
+ relativePosix(t = this.cwd) {
2319
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix();
2320
+ }
2321
+ basename(t = this.cwd) {
2322
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.name;
2323
+ }
2324
+ dirname(t = this.cwd) {
2325
+ return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
2326
+ }
2327
+ async readdir(t = this.cwd, e = { withFileTypes: true }) {
2328
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2329
+ let { withFileTypes: s } = e;
2330
+ if (t.canReaddir()) {
2331
+ let i = await t.readdir();
2332
+ return s ? i : i.map((r) => r.name);
2333
+ } else return [];
2334
+ }
2335
+ readdirSync(t = this.cwd, e = { withFileTypes: true }) {
2336
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2337
+ let { withFileTypes: s = true } = e;
2338
+ return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
2339
+ }
2340
+ async lstat(t = this.cwd) {
2341
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat();
2342
+ }
2343
+ lstatSync(t = this.cwd) {
2344
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
2345
+ }
2346
+ async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
2347
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2348
+ let s = await t.readlink();
2349
+ return e ? s : s?.fullpath();
2350
+ }
2351
+ readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
2352
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2353
+ let s = t.readlinkSync();
2354
+ return e ? s : s?.fullpath();
2355
+ }
2356
+ async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
2357
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2358
+ let s = await t.realpath();
2359
+ return e ? s : s?.fullpath();
2360
+ }
2361
+ realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
2362
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2363
+ let s = t.realpathSync();
2364
+ return e ? s : s?.fullpath();
2365
+ }
2366
+ async walk(t = this.cwd, e = {}) {
2367
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2368
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = [];
2369
+ (!r || r(t)) && h.push(s ? t : t.fullpath());
2370
+ let a = /* @__PURE__ */ new Set(), l = (c, d) => {
2371
+ a.add(c), c.readdirCB((f, m) => {
2372
+ if (f) return d(f);
2373
+ let p = m.length;
2374
+ if (!p) return d();
2375
+ let w = () => {
2376
+ --p === 0 && d();
2377
+ };
2378
+ for (let g of m) (!r || r(g)) && h.push(s ? g : g.fullpath()), i && g.isSymbolicLink() ? g.realpath().then((S) => S?.isUnknown() ? S.lstat() : S).then((S) => S?.shouldWalk(a, o) ? l(S, w) : w()) : g.shouldWalk(a, o) ? l(g, w) : w();
2379
+ }, true);
2380
+ }, u = t;
2381
+ return new Promise((c, d) => {
2382
+ l(u, (f) => {
2383
+ if (f) return d(f);
2384
+ c(h);
2385
+ });
2386
+ });
2387
+ }
2388
+ walkSync(t = this.cwd, e = {}) {
2389
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2390
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = [];
2391
+ (!r || r(t)) && h.push(s ? t : t.fullpath());
2392
+ let a = /* @__PURE__ */ new Set([t]);
2393
+ for (let l of a) {
2394
+ let u = l.readdirSync();
2395
+ for (let c of u) {
2396
+ (!r || r(c)) && h.push(s ? c : c.fullpath());
2397
+ let d = c;
2398
+ if (c.isSymbolicLink()) {
2399
+ if (!(i && (d = c.realpathSync()))) continue;
2400
+ d.isUnknown() && d.lstatSync();
2401
+ }
2402
+ d.shouldWalk(a, o) && a.add(d);
2403
+ }
2404
+ }
2405
+ return h;
2406
+ }
2407
+ [Symbol.asyncIterator]() {
2408
+ return this.iterate();
2409
+ }
2410
+ iterate(t = this.cwd, e = {}) {
2411
+ return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
2412
+ }
2413
+ [Symbol.iterator]() {
2414
+ return this.iterateSync();
2415
+ }
2416
+ *iterateSync(t = this.cwd, e = {}) {
2417
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2418
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e;
2419
+ (!r || r(t)) && (yield s ? t : t.fullpath());
2420
+ let h = /* @__PURE__ */ new Set([t]);
2421
+ for (let a of h) {
2422
+ let l = a.readdirSync();
2423
+ for (let u of l) {
2424
+ (!r || r(u)) && (yield s ? u : u.fullpath());
2425
+ let c = u;
2426
+ if (u.isSymbolicLink()) {
2427
+ if (!(i && (c = u.realpathSync()))) continue;
2428
+ c.isUnknown() && c.lstatSync();
2429
+ }
2430
+ c.shouldWalk(h, o) && h.add(c);
2431
+ }
2432
+ }
2433
+ }
2434
+ stream(t = this.cwd, e = {}) {
2435
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2436
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = new V({ objectMode: true });
2437
+ (!r || r(t)) && h.write(s ? t : t.fullpath());
2438
+ let a = /* @__PURE__ */ new Set(), l = [t], u = 0, c = () => {
2439
+ let d = false;
2440
+ for (; !d; ) {
2441
+ let f = l.shift();
2442
+ if (!f) {
2443
+ u === 0 && h.end();
2444
+ return;
2445
+ }
2446
+ u++, a.add(f);
2447
+ let m = (w, g, S = false) => {
2448
+ if (w) return h.emit("error", w);
2449
+ if (i && !S) {
2450
+ let E = [];
2451
+ for (let y of g) y.isSymbolicLink() && E.push(y.realpath().then((b) => b?.isUnknown() ? b.lstat() : b));
2452
+ if (E.length) {
2453
+ Promise.all(E).then(() => m(null, g, true));
2454
+ return;
2455
+ }
2456
+ }
2457
+ for (let E of g) E && (!r || r(E)) && (h.write(s ? E : E.fullpath()) || (d = true));
2458
+ u--;
2459
+ for (let E of g) {
2460
+ let y = E.realpathCached() || E;
2461
+ y.shouldWalk(a, o) && l.push(y);
2462
+ }
2463
+ d && !h.flowing ? h.once("drain", c) : p || c();
2464
+ }, p = true;
2465
+ f.readdirCB(m, true), p = false;
2466
+ }
2467
+ };
2468
+ return c(), h;
2469
+ }
2470
+ streamSync(t = this.cwd, e = {}) {
2471
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2472
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = new V({ objectMode: true }), a = /* @__PURE__ */ new Set();
2473
+ (!r || r(t)) && h.write(s ? t : t.fullpath());
2474
+ let l = [t], u = 0, c = () => {
2475
+ let d = false;
2476
+ for (; !d; ) {
2477
+ let f = l.shift();
2478
+ if (!f) {
2479
+ u === 0 && h.end();
2480
+ return;
2481
+ }
2482
+ u++, a.add(f);
2483
+ let m = f.readdirSync();
2484
+ for (let p of m) (!r || r(p)) && (h.write(s ? p : p.fullpath()) || (d = true));
2485
+ u--;
2486
+ for (let p of m) {
2487
+ let w = p;
2488
+ if (p.isSymbolicLink()) {
2489
+ if (!(i && (w = p.realpathSync()))) continue;
2490
+ w.isUnknown() && w.lstatSync();
2491
+ }
2492
+ w.shouldWalk(a, o) && l.push(w);
2493
+ }
2494
+ }
2495
+ d && !h.flowing && h.once("drain", c);
2496
+ };
2497
+ return c(), h;
2498
+ }
2499
+ chdir(t = this.cwd) {
2500
+ let e = this.cwd;
2501
+ this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[Ye](e);
2502
+ }
2503
+ };
2504
+ var it = class extends It {
2505
+ sep = "\\";
2506
+ constructor(t = process.cwd(), e = {}) {
2507
+ let { nocase: s = true } = e;
2508
+ super(t, re, "\\", { ...e, nocase: s }), this.nocase = s;
2509
+ for (let i = this.cwd; i; i = i.parent) i.nocase = this.nocase;
2510
+ }
2511
+ parseRootPath(t) {
2512
+ return re.parse(t).root.toUpperCase();
2513
+ }
2514
+ newRoot(t) {
2515
+ return new Pt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
2516
+ }
2517
+ isAbsolute(t) {
2518
+ return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
2519
+ }
2520
+ };
2521
+ var rt = class extends It {
2522
+ sep = "/";
2523
+ constructor(t = process.cwd(), e = {}) {
2524
+ let { nocase: s = false } = e;
2525
+ super(t, mi, "/", { ...e, nocase: s }), this.nocase = s;
2526
+ }
2527
+ parseRootPath(t) {
2528
+ return "/";
2529
+ }
2530
+ newRoot(t) {
2531
+ return new jt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
2532
+ }
2533
+ isAbsolute(t) {
2534
+ return t.startsWith("/");
2535
+ }
2536
+ };
2537
+ var St = class extends rt {
2538
+ constructor(t = process.cwd(), e = {}) {
2539
+ let { nocase: s = true } = e;
2540
+ super(t, { ...e, nocase: s });
2541
+ }
2542
+ };
2543
+ var Cr = process.platform === "win32" ? Pt : jt;
2544
+ var Xe = process.platform === "win32" ? it : process.platform === "darwin" ? St : rt;
2545
+ var Di = (n7) => n7.length >= 1;
2546
+ var Mi = (n7) => n7.length >= 1;
2547
+ var Ni = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
2548
+ var nt = class n4 {
2549
+ #t;
2550
+ #s;
2551
+ #n;
2552
+ length;
2553
+ #r;
2554
+ #o;
2555
+ #S;
2556
+ #w;
2557
+ #c;
2558
+ #h;
2559
+ #u = true;
2560
+ constructor(t, e, s, i) {
2561
+ if (!Di(t)) throw new TypeError("empty pattern list");
2562
+ if (!Mi(e)) throw new TypeError("empty glob list");
2563
+ if (e.length !== t.length) throw new TypeError("mismatched pattern list and glob list lengths");
2564
+ if (this.length = t.length, s < 0 || s >= this.length) throw new TypeError("index out of range");
2565
+ if (this.#t = t, this.#s = e, this.#n = s, this.#r = i, this.#n === 0) {
2566
+ if (this.isUNC()) {
2567
+ let [r, o, h, a, ...l] = this.#t, [u, c, d, f, ...m] = this.#s;
2568
+ l[0] === "" && (l.shift(), m.shift());
2569
+ let p = [r, o, h, a, ""].join("/"), w = [u, c, d, f, ""].join("/");
2570
+ this.#t = [p, ...l], this.#s = [w, ...m], this.length = this.#t.length;
2571
+ } else if (this.isDrive() || this.isAbsolute()) {
2572
+ let [r, ...o] = this.#t, [h, ...a] = this.#s;
2573
+ o[0] === "" && (o.shift(), a.shift());
2574
+ let l = r + "/", u = h + "/";
2575
+ this.#t = [l, ...o], this.#s = [u, ...a], this.length = this.#t.length;
2576
+ }
2577
+ }
2578
+ }
2579
+ [Ni]() {
2580
+ return "Pattern <" + this.#s.slice(this.#n).join("/") + ">";
2581
+ }
2582
+ pattern() {
2583
+ return this.#t[this.#n];
2584
+ }
2585
+ isString() {
2586
+ return typeof this.#t[this.#n] == "string";
2587
+ }
2588
+ isGlobstar() {
2589
+ return this.#t[this.#n] === A;
2590
+ }
2591
+ isRegExp() {
2592
+ return this.#t[this.#n] instanceof RegExp;
2593
+ }
2594
+ globString() {
2595
+ return this.#S = this.#S || (this.#n === 0 ? this.isAbsolute() ? this.#s[0] + this.#s.slice(1).join("/") : this.#s.join("/") : this.#s.slice(this.#n).join("/"));
2596
+ }
2597
+ hasMore() {
2598
+ return this.length > this.#n + 1;
2599
+ }
2600
+ rest() {
2601
+ return this.#o !== void 0 ? this.#o : this.hasMore() ? (this.#o = new n4(this.#t, this.#s, this.#n + 1, this.#r), this.#o.#h = this.#h, this.#o.#c = this.#c, this.#o.#w = this.#w, this.#o) : this.#o = null;
2602
+ }
2603
+ isUNC() {
2604
+ let t = this.#t;
2605
+ return this.#c !== void 0 ? this.#c : this.#c = this.#r === "win32" && this.#n === 0 && t[0] === "" && t[1] === "" && typeof t[2] == "string" && !!t[2] && typeof t[3] == "string" && !!t[3];
2606
+ }
2607
+ isDrive() {
2608
+ let t = this.#t;
2609
+ return this.#w !== void 0 ? this.#w : this.#w = this.#r === "win32" && this.#n === 0 && this.length > 1 && typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]);
2610
+ }
2611
+ isAbsolute() {
2612
+ let t = this.#t;
2613
+ return this.#h !== void 0 ? this.#h : this.#h = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
2614
+ }
2615
+ root() {
2616
+ let t = this.#t[0];
2617
+ return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : "";
2618
+ }
2619
+ checkFollowGlobstar() {
2620
+ return !(this.#n === 0 || !this.isGlobstar() || !this.#u);
2621
+ }
2622
+ markFollowGlobstar() {
2623
+ return this.#n === 0 || !this.isGlobstar() || !this.#u ? false : (this.#u = false, true);
2624
+ }
2625
+ };
2626
+ var _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
2627
+ var ot = class {
2628
+ relative;
2629
+ relativeChildren;
2630
+ absolute;
2631
+ absoluteChildren;
2632
+ platform;
2633
+ mmopts;
2634
+ constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, platform: o = _i }) {
2635
+ this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = o, this.mmopts = { dot: true, nobrace: e, nocase: s, noext: i, noglobstar: r, optimizationLevel: 2, platform: o, nocomment: true, nonegate: true };
2636
+ for (let h of t) this.add(h);
2637
+ }
2638
+ add(t) {
2639
+ let e = new D(t, this.mmopts);
2640
+ for (let s = 0; s < e.set.length; s++) {
2641
+ let i = e.set[s], r = e.globParts[s];
2642
+ if (!i || !r) throw new Error("invalid pattern object");
2643
+ for (; i[0] === "." && r[0] === "."; ) i.shift(), r.shift();
2644
+ let o = new nt(i, r, 0, this.platform), h = new D(o.globString(), this.mmopts), a = r[r.length - 1] === "**", l = o.isAbsolute();
2645
+ l ? this.absolute.push(h) : this.relative.push(h), a && (l ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
2646
+ }
2647
+ }
2648
+ ignored(t) {
2649
+ let e = t.fullpath(), s = `${e}/`, i = t.relative() || ".", r = `${i}/`;
2650
+ for (let o of this.relative) if (o.match(i) || o.match(r)) return true;
2651
+ for (let o of this.absolute) if (o.match(e) || o.match(s)) return true;
2652
+ return false;
2653
+ }
2654
+ childrenIgnored(t) {
2655
+ let e = t.fullpath() + "/", s = (t.relative() || ".") + "/";
2656
+ for (let i of this.relativeChildren) if (i.match(s)) return true;
2657
+ for (let i of this.absoluteChildren) if (i.match(e)) return true;
2658
+ return false;
2659
+ }
2660
+ };
2661
+ var oe = class n5 {
2662
+ store;
2663
+ constructor(t = /* @__PURE__ */ new Map()) {
2664
+ this.store = t;
2665
+ }
2666
+ copy() {
2667
+ return new n5(new Map(this.store));
2668
+ }
2669
+ hasWalked(t, e) {
2670
+ return this.store.get(t.fullpath())?.has(e.globString());
2671
+ }
2672
+ storeWalked(t, e) {
2673
+ let s = t.fullpath(), i = this.store.get(s);
2674
+ i ? i.add(e.globString()) : this.store.set(s, /* @__PURE__ */ new Set([e.globString()]));
2675
+ }
2676
+ };
2677
+ var he = class {
2678
+ store = /* @__PURE__ */ new Map();
2679
+ add(t, e, s) {
2680
+ let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
2681
+ this.store.set(t, r === void 0 ? i : i & r);
2682
+ }
2683
+ entries() {
2684
+ return [...this.store.entries()].map(([t, e]) => [t, !!(e & 2), !!(e & 1)]);
2685
+ }
2686
+ };
2687
+ var ae = class {
2688
+ store = /* @__PURE__ */ new Map();
2689
+ add(t, e) {
2690
+ if (!t.canReaddir()) return;
2691
+ let s = this.store.get(t);
2692
+ s ? s.find((i) => i.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]);
2693
+ }
2694
+ get(t) {
2695
+ let e = this.store.get(t);
2696
+ if (!e) throw new Error("attempting to walk unknown path");
2697
+ return e;
2698
+ }
2699
+ entries() {
2700
+ return this.keys().map((t) => [t, this.store.get(t)]);
2701
+ }
2702
+ keys() {
2703
+ return [...this.store.keys()].filter((t) => t.canReaddir());
2704
+ }
2705
+ };
2706
+ var Et = class n6 {
2707
+ hasWalkedCache;
2708
+ matches = new he();
2709
+ subwalks = new ae();
2710
+ patterns;
2711
+ follow;
2712
+ dot;
2713
+ opts;
2714
+ constructor(t, e) {
2715
+ this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new oe();
2716
+ }
2717
+ processPatterns(t, e) {
2718
+ this.patterns = e;
2719
+ let s = e.map((i) => [t, i]);
2720
+ for (let [i, r] of s) {
2721
+ this.hasWalkedCache.storeWalked(i, r);
2722
+ let o = r.root(), h = r.isAbsolute() && this.opts.absolute !== false;
2723
+ if (o) {
2724
+ i = i.resolve(o === "/" && this.opts.root !== void 0 ? this.opts.root : o);
2725
+ let c = r.rest();
2726
+ if (c) r = c;
2727
+ else {
2728
+ this.matches.add(i, true, false);
2729
+ continue;
2730
+ }
2731
+ }
2732
+ if (i.isENOENT()) continue;
2733
+ let a, l, u = false;
2734
+ for (; typeof (a = r.pattern()) == "string" && (l = r.rest()); ) i = i.resolve(a), r = l, u = true;
2735
+ if (a = r.pattern(), l = r.rest(), u) {
2736
+ if (this.hasWalkedCache.hasWalked(i, r)) continue;
2737
+ this.hasWalkedCache.storeWalked(i, r);
2738
+ }
2739
+ if (typeof a == "string") {
2740
+ let c = a === ".." || a === "" || a === ".";
2741
+ this.matches.add(i.resolve(a), h, c);
2742
+ continue;
2743
+ } else if (a === A) {
2744
+ (!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r);
2745
+ let c = l?.pattern(), d = l?.rest();
2746
+ if (!l || (c === "" || c === ".") && !d) this.matches.add(i, h, c === "" || c === ".");
2747
+ else if (c === "..") {
2748
+ let f = i.parent || i;
2749
+ d ? this.hasWalkedCache.hasWalked(f, d) || this.subwalks.add(f, d) : this.matches.add(f, h, true);
2750
+ }
2751
+ } else a instanceof RegExp && this.subwalks.add(i, r);
2752
+ }
2753
+ return this;
2754
+ }
2755
+ subwalkTargets() {
2756
+ return this.subwalks.keys();
2757
+ }
2758
+ child() {
2759
+ return new n6(this.opts, this.hasWalkedCache);
2760
+ }
2761
+ filterEntries(t, e) {
2762
+ let s = this.subwalks.get(t), i = this.child();
2763
+ for (let r of e) for (let o of s) {
2764
+ let h = o.isAbsolute(), a = o.pattern(), l = o.rest();
2765
+ a === A ? i.testGlobstar(r, o, l, h) : a instanceof RegExp ? i.testRegExp(r, a, l, h) : i.testString(r, a, l, h);
2766
+ }
2767
+ return i;
2768
+ }
2769
+ testGlobstar(t, e, s, i) {
2770
+ if ((this.dot || !t.name.startsWith(".")) && (e.hasMore() || this.matches.add(t, i, false), t.canReaddir() && (this.follow || !t.isSymbolicLink() ? this.subwalks.add(t, e) : t.isSymbolicLink() && (s && e.checkFollowGlobstar() ? this.subwalks.add(t, s) : e.markFollowGlobstar() && this.subwalks.add(t, e)))), s) {
2771
+ let r = s.pattern();
2772
+ if (typeof r == "string" && r !== ".." && r !== "" && r !== ".") this.testString(t, r, s.rest(), i);
2773
+ else if (r === "..") {
2774
+ let o = t.parent || t;
2775
+ this.subwalks.add(o, s);
2776
+ } else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i);
2777
+ }
2778
+ }
2779
+ testRegExp(t, e, s, i) {
2780
+ e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false));
2781
+ }
2782
+ testString(t, e, s, i) {
2783
+ t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false));
2784
+ }
2785
+ };
2786
+ var Li = (n7, t) => typeof n7 == "string" ? new ot([n7], t) : Array.isArray(n7) ? new ot(n7, t) : n7;
2787
+ var zt = class {
2788
+ path;
2789
+ patterns;
2790
+ opts;
2791
+ seen = /* @__PURE__ */ new Set();
2792
+ paused = false;
2793
+ aborted = false;
2794
+ #t = [];
2795
+ #s;
2796
+ #n;
2797
+ signal;
2798
+ maxDepth;
2799
+ includeChildMatches;
2800
+ constructor(t, e, s) {
2801
+ if (this.patterns = t, this.path = e, this.opts = s, this.#n = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches = s.includeChildMatches !== false, (s.ignore || !this.includeChildMatches) && (this.#s = Li(s.ignore ?? [], s), !this.includeChildMatches && typeof this.#s.add != "function")) {
2802
+ let i = "cannot ignore child matches, ignore lacks add() method.";
2803
+ throw new Error(i);
2804
+ }
2805
+ this.maxDepth = s.maxDepth || 1 / 0, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
2806
+ this.#t.length = 0;
2807
+ }));
2808
+ }
2809
+ #r(t) {
2810
+ return this.seen.has(t) || !!this.#s?.ignored?.(t);
2811
+ }
2812
+ #o(t) {
2813
+ return !!this.#s?.childrenIgnored?.(t);
2814
+ }
2815
+ pause() {
2816
+ this.paused = true;
2817
+ }
2818
+ resume() {
2819
+ if (this.signal?.aborted) return;
2820
+ this.paused = false;
2821
+ let t;
2822
+ for (; !this.paused && (t = this.#t.shift()); ) t();
2823
+ }
2824
+ onResume(t) {
2825
+ this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
2826
+ }
2827
+ async matchCheck(t, e) {
2828
+ if (e && this.opts.nodir) return;
2829
+ let s;
2830
+ if (this.opts.realpath) {
2831
+ if (s = t.realpathCached() || await t.realpath(), !s) return;
2832
+ t = s;
2833
+ }
2834
+ let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
2835
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
2836
+ let o = await r.realpath();
2837
+ o && (o.isUnknown() || this.opts.stat) && await o.lstat();
2838
+ }
2839
+ return this.matchCheckTest(r, e);
2840
+ }
2841
+ matchCheckTest(t, e) {
2842
+ return t && (this.maxDepth === 1 / 0 || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#r(t) ? t : void 0;
2843
+ }
2844
+ matchCheckSync(t, e) {
2845
+ if (e && this.opts.nodir) return;
2846
+ let s;
2847
+ if (this.opts.realpath) {
2848
+ if (s = t.realpathCached() || t.realpathSync(), !s) return;
2849
+ t = s;
2850
+ }
2851
+ let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
2852
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
2853
+ let o = r.realpathSync();
2854
+ o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
2855
+ }
2856
+ return this.matchCheckTest(r, e);
2857
+ }
2858
+ matchFinish(t, e) {
2859
+ if (this.#r(t)) return;
2860
+ if (!this.includeChildMatches && this.#s?.add) {
2861
+ let r = `${t.relativePosix()}/**`;
2862
+ this.#s.add(r);
2863
+ }
2864
+ let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
2865
+ this.seen.add(t);
2866
+ let i = this.opts.mark && t.isDirectory() ? this.#n : "";
2867
+ if (this.opts.withFileTypes) this.matchEmit(t);
2868
+ else if (s) {
2869
+ let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
2870
+ this.matchEmit(r + i);
2871
+ } else {
2872
+ let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : "";
2873
+ this.matchEmit(r ? o + r + i : "." + i);
2874
+ }
2875
+ }
2876
+ async match(t, e, s) {
2877
+ let i = await this.matchCheck(t, s);
2878
+ i && this.matchFinish(i, e);
2879
+ }
2880
+ matchSync(t, e, s) {
2881
+ let i = this.matchCheckSync(t, s);
2882
+ i && this.matchFinish(i, e);
2883
+ }
2884
+ walkCB(t, e, s) {
2885
+ this.signal?.aborted && s(), this.walkCB2(t, e, new Et(this.opts), s);
2886
+ }
2887
+ walkCB2(t, e, s, i) {
2888
+ if (this.#o(t)) return i();
2889
+ if (this.signal?.aborted && i(), this.paused) {
2890
+ this.onResume(() => this.walkCB2(t, e, s, i));
2891
+ return;
2892
+ }
2893
+ s.processPatterns(t, e);
2894
+ let r = 1, o = () => {
2895
+ --r === 0 && i();
2896
+ };
2897
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
2898
+ for (let h of s.subwalkTargets()) {
2899
+ if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
2900
+ r++;
2901
+ let a = h.readdirCached();
2902
+ h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((l, u) => this.walkCB3(h, u, s, o), true);
2903
+ }
2904
+ o();
2905
+ }
2906
+ walkCB3(t, e, s, i) {
2907
+ s = s.filterEntries(t, e);
2908
+ let r = 1, o = () => {
2909
+ --r === 0 && i();
2910
+ };
2911
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
2912
+ for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2(h, a, s.child(), o);
2913
+ o();
2914
+ }
2915
+ walkCBSync(t, e, s) {
2916
+ this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Et(this.opts), s);
2917
+ }
2918
+ walkCB2Sync(t, e, s, i) {
2919
+ if (this.#o(t)) return i();
2920
+ if (this.signal?.aborted && i(), this.paused) {
2921
+ this.onResume(() => this.walkCB2Sync(t, e, s, i));
2922
+ return;
2923
+ }
2924
+ s.processPatterns(t, e);
2925
+ let r = 1, o = () => {
2926
+ --r === 0 && i();
2927
+ };
2928
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
2929
+ for (let h of s.subwalkTargets()) {
2930
+ if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
2931
+ r++;
2932
+ let a = h.readdirSync();
2933
+ this.walkCB3Sync(h, a, s, o);
2934
+ }
2935
+ o();
2936
+ }
2937
+ walkCB3Sync(t, e, s, i) {
2938
+ s = s.filterEntries(t, e);
2939
+ let r = 1, o = () => {
2940
+ --r === 0 && i();
2941
+ };
2942
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
2943
+ for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2Sync(h, a, s.child(), o);
2944
+ o();
2945
+ }
2946
+ };
2947
+ var xt = class extends zt {
2948
+ matches = /* @__PURE__ */ new Set();
2949
+ constructor(t, e, s) {
2950
+ super(t, e, s);
2951
+ }
2952
+ matchEmit(t) {
2953
+ this.matches.add(t);
2954
+ }
2955
+ async walk() {
2956
+ if (this.signal?.aborted) throw this.signal.reason;
2957
+ return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
2958
+ this.walkCB(this.path, this.patterns, () => {
2959
+ this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
2960
+ });
2961
+ }), this.matches;
2962
+ }
2963
+ walkSync() {
2964
+ if (this.signal?.aborted) throw this.signal.reason;
2965
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
2966
+ if (this.signal?.aborted) throw this.signal.reason;
2967
+ }), this.matches;
2968
+ }
2969
+ };
2970
+ var vt = class extends zt {
2971
+ results;
2972
+ constructor(t, e, s) {
2973
+ super(t, e, s), this.results = new V({ signal: this.signal, objectMode: true }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
2974
+ }
2975
+ matchEmit(t) {
2976
+ this.results.write(t), this.results.flowing || this.pause();
2977
+ }
2978
+ stream() {
2979
+ let t = this.path;
2980
+ return t.isUnknown() ? t.lstat().then(() => {
2981
+ this.walkCB(t, this.patterns, () => this.results.end());
2982
+ }) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
2983
+ }
2984
+ streamSync() {
2985
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
2986
+ }
2987
+ };
2988
+ var Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
2989
+ var I = class {
2990
+ absolute;
2991
+ cwd;
2992
+ root;
2993
+ dot;
2994
+ dotRelative;
2995
+ follow;
2996
+ ignore;
2997
+ magicalBraces;
2998
+ mark;
2999
+ matchBase;
3000
+ maxDepth;
3001
+ nobrace;
3002
+ nocase;
3003
+ nodir;
3004
+ noext;
3005
+ noglobstar;
3006
+ pattern;
3007
+ platform;
3008
+ realpath;
3009
+ scurry;
3010
+ stat;
3011
+ signal;
3012
+ windowsPathsNoEscape;
3013
+ withFileTypes;
3014
+ includeChildMatches;
3015
+ opts;
3016
+ patterns;
3017
+ constructor(t, e) {
3018
+ if (!e) throw new TypeError("glob options required");
3019
+ if (this.withFileTypes = !!e.withFileTypes, this.signal = e.signal, this.follow = !!e.follow, this.dot = !!e.dot, this.dotRelative = !!e.dotRelative, this.nodir = !!e.nodir, this.mark = !!e.mark, e.cwd ? (e.cwd instanceof URL || e.cwd.startsWith("file://")) && (e.cwd = Wi(e.cwd)) : this.cwd = "", this.cwd = e.cwd || "", this.root = e.root, this.magicalBraces = !!e.magicalBraces, this.nobrace = !!e.nobrace, this.noext = !!e.noext, this.realpath = !!e.realpath, this.absolute = e.absolute, this.includeChildMatches = e.includeChildMatches !== false, this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : 1 / 0, this.stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true");
3020
+ if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === false, this.windowsPathsNoEscape && (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) {
3021
+ if (e.noglobstar) throw new TypeError("base matching requires globstar");
3022
+ t = t.map((a) => a.includes("/") ? a : `./**/${a}`);
3023
+ }
3024
+ if (this.pattern = t, this.platform = e.platform || Pi, this.opts = { ...e, platform: this.platform }, e.scurry) {
3025
+ if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
3026
+ } else {
3027
+ let a = e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe;
3028
+ this.scurry = new a(this.cwd, { nocase: e.nocase, fs: e.fs });
3029
+ }
3030
+ this.nocase = this.scurry.nocase;
3031
+ let s = this.platform === "darwin" || this.platform === "win32", i = { braceExpandMax: 1e4, ...e, dot: this.dot, matchBase: this.matchBase, nobrace: this.nobrace, nocase: this.nocase, nocaseMagicOnly: s, nocomment: true, noext: this.noext, nonegate: true, optimizationLevel: 2, platform: this.platform, windowsPathsNoEscape: this.windowsPathsNoEscape, debug: !!this.opts.debug }, r = this.pattern.map((a) => new D(a, i)), [o, h] = r.reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
3032
+ this.patterns = o.map((a, l) => {
3033
+ let u = h[l];
3034
+ if (!u) throw new Error("invalid pattern object");
3035
+ return new nt(a, u, 0, this.platform);
3036
+ });
3037
+ }
3038
+ async walk() {
3039
+ return [...await new xt(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).walk()];
3040
+ }
3041
+ walkSync() {
3042
+ return [...new xt(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).walkSync()];
3043
+ }
3044
+ stream() {
3045
+ return new vt(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).stream();
3046
+ }
3047
+ streamSync() {
3048
+ return new vt(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).streamSync();
3049
+ }
3050
+ iterateSync() {
3051
+ return this.streamSync()[Symbol.iterator]();
3052
+ }
3053
+ [Symbol.iterator]() {
3054
+ return this.iterateSync();
3055
+ }
3056
+ iterate() {
3057
+ return this.stream()[Symbol.asyncIterator]();
3058
+ }
3059
+ [Symbol.asyncIterator]() {
3060
+ return this.iterate();
3061
+ }
3062
+ };
3063
+ var le = (n7, t = {}) => {
3064
+ Array.isArray(n7) || (n7 = [n7]);
3065
+ for (let e of n7) if (new D(e, t).hasMagic()) return true;
3066
+ return false;
3067
+ };
3068
+ function Bt(n7, t = {}) {
3069
+ return new I(n7, t).streamSync();
3070
+ }
3071
+ function Qe(n7, t = {}) {
3072
+ return new I(n7, t).stream();
3073
+ }
3074
+ function ts(n7, t = {}) {
3075
+ return new I(n7, t).walkSync();
3076
+ }
3077
+ async function Je(n7, t = {}) {
3078
+ return new I(n7, t).walk();
3079
+ }
3080
+ function Ut(n7, t = {}) {
3081
+ return new I(n7, t).iterateSync();
3082
+ }
3083
+ function es(n7, t = {}) {
3084
+ return new I(n7, t).iterate();
3085
+ }
3086
+ var ji = Bt;
3087
+ var Ii = Object.assign(Qe, { sync: Bt });
3088
+ var zi = Ut;
3089
+ var Bi = Object.assign(es, { sync: Ut });
3090
+ var Ui = Object.assign(ts, { stream: Bt, iterate: Ut });
3091
+ var Ze = Object.assign(Je, { glob: Je, globSync: ts, sync: Ui, globStream: Qe, stream: Ii, globStreamSync: Bt, streamSync: ji, globIterate: es, iterate: Bi, globIterateSync: Ut, iterateSync: zi, Glob: I, hasMagic: le, escape: tt, unescape: W });
3092
+ Ze.glob = Ze;
3093
+
3094
+ // src/shared/pattern/loadFiles.ts
3095
+ var loadFiles = async (baseDir, includes, excludes = []) => {
3096
+ const included = (await Promise.all(
3097
+ includes.map((pattern) => Ze(pattern, { cwd: baseDir, absolute: true }))
3098
+ )).flat();
3099
+ const excluded = (await Promise.all(
3100
+ excludes.map((pattern) => Ze(pattern, { cwd: baseDir, absolute: true }))
3101
+ )).flat();
3102
+ return included.filter((file) => !excluded.includes(file));
3103
+ };
3104
+
3105
+ // src/core/api/lintProject.ts
3106
+ import fs2 from "fs";
3107
+
3108
+ // node_modules/balanced-match/dist/esm/index.js
3109
+ var balanced = (a, b, str) => {
3110
+ const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
3111
+ const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
3112
+ const r = ma !== null && mb != null && range(ma, mb, str);
3113
+ return r && {
3114
+ start: r[0],
3115
+ end: r[1],
3116
+ pre: str.slice(0, r[0]),
3117
+ body: str.slice(r[0] + ma.length, r[1]),
3118
+ post: str.slice(r[1] + mb.length)
3119
+ };
3120
+ };
3121
+ var maybeMatch = (reg, str) => {
3122
+ const m = str.match(reg);
3123
+ return m ? m[0] : null;
3124
+ };
3125
+ var range = (a, b, str) => {
3126
+ let begs, beg, left, right = void 0, result;
3127
+ let ai2 = str.indexOf(a);
3128
+ let bi2 = str.indexOf(b, ai2 + 1);
3129
+ let i = ai2;
3130
+ if (ai2 >= 0 && bi2 > 0) {
3131
+ if (a === b) {
3132
+ return [ai2, bi2];
3133
+ }
3134
+ begs = [];
3135
+ left = str.length;
3136
+ while (i >= 0 && !result) {
3137
+ if (i === ai2) {
3138
+ begs.push(i);
3139
+ ai2 = str.indexOf(a, i + 1);
3140
+ } else if (begs.length === 1) {
3141
+ const r = begs.pop();
3142
+ if (r !== void 0)
3143
+ result = [r, bi2];
3144
+ } else {
3145
+ beg = begs.pop();
3146
+ if (beg !== void 0 && beg < left) {
3147
+ left = beg;
3148
+ right = bi2;
3149
+ }
3150
+ bi2 = str.indexOf(b, i + 1);
3151
+ }
3152
+ i = ai2 < bi2 && ai2 >= 0 ? ai2 : bi2;
3153
+ }
3154
+ if (begs.length && right !== void 0) {
3155
+ result = [left, right];
3156
+ }
3157
+ }
3158
+ return result;
3159
+ };
3160
+
3161
+ // node_modules/brace-expansion/dist/esm/index.js
3162
+ var escSlash = "\0SLASH" + Math.random() + "\0";
3163
+ var escOpen = "\0OPEN" + Math.random() + "\0";
3164
+ var escClose = "\0CLOSE" + Math.random() + "\0";
3165
+ var escComma = "\0COMMA" + Math.random() + "\0";
3166
+ var escPeriod = "\0PERIOD" + Math.random() + "\0";
3167
+ var escSlashPattern = new RegExp(escSlash, "g");
3168
+ var escOpenPattern = new RegExp(escOpen, "g");
3169
+ var escClosePattern = new RegExp(escClose, "g");
3170
+ var escCommaPattern = new RegExp(escComma, "g");
3171
+ var escPeriodPattern = new RegExp(escPeriod, "g");
3172
+ var slashPattern = /\\\\/g;
3173
+ var openPattern = /\\{/g;
3174
+ var closePattern = /\\}/g;
3175
+ var commaPattern = /\\,/g;
3176
+ var periodPattern = /\\\./g;
3177
+ var EXPANSION_MAX = 1e5;
3178
+ function numeric(str) {
3179
+ return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
3180
+ }
3181
+ function escapeBraces(str) {
3182
+ return str.replace(slashPattern, escSlash).replace(openPattern, escOpen).replace(closePattern, escClose).replace(commaPattern, escComma).replace(periodPattern, escPeriod);
3183
+ }
3184
+ function unescapeBraces(str) {
3185
+ return str.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
3186
+ }
3187
+ function parseCommaParts(str) {
3188
+ if (!str) {
3189
+ return [""];
3190
+ }
3191
+ const parts = [];
3192
+ const m = balanced("{", "}", str);
3193
+ if (!m) {
3194
+ return str.split(",");
3195
+ }
3196
+ const { pre, body, post } = m;
3197
+ const p = pre.split(",");
3198
+ p[p.length - 1] += "{" + body + "}";
3199
+ const postParts = parseCommaParts(post);
3200
+ if (post.length) {
3201
+ ;
3202
+ p[p.length - 1] += postParts.shift();
3203
+ p.push.apply(p, postParts);
3204
+ }
3205
+ parts.push.apply(parts, p);
3206
+ return parts;
3207
+ }
3208
+ function expand(str, options = {}) {
3209
+ if (!str) {
3210
+ return [];
3211
+ }
3212
+ const { max = EXPANSION_MAX } = options;
3213
+ if (str.slice(0, 2) === "{}") {
3214
+ str = "\\{\\}" + str.slice(2);
3215
+ }
3216
+ return expand_(escapeBraces(str), max, true).map(unescapeBraces);
3217
+ }
3218
+ function embrace(str) {
3219
+ return "{" + str + "}";
3220
+ }
3221
+ function isPadded(el) {
3222
+ return /^-?0\d/.test(el);
3223
+ }
3224
+ function lte(i, y) {
3225
+ return i <= y;
3226
+ }
3227
+ function gte(i, y) {
3228
+ return i >= y;
3229
+ }
3230
+ function expand_(str, max, isTop) {
3231
+ const expansions = [];
3232
+ const m = balanced("{", "}", str);
3233
+ if (!m)
3234
+ return [str];
3235
+ const pre = m.pre;
3236
+ const post = m.post.length ? expand_(m.post, max, false) : [""];
3237
+ if (/\$$/.test(m.pre)) {
3238
+ for (let k2 = 0; k2 < post.length && k2 < max; k2++) {
3239
+ const expansion = pre + "{" + m.body + "}" + post[k2];
3240
+ expansions.push(expansion);
3241
+ }
3242
+ } else {
3243
+ const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
3244
+ const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
3245
+ const isSequence = isNumericSequence || isAlphaSequence;
3246
+ const isOptions = m.body.indexOf(",") >= 0;
3247
+ if (!isSequence && !isOptions) {
3248
+ if (m.post.match(/,(?!,).*\}/)) {
3249
+ str = m.pre + "{" + m.body + escClose + m.post;
3250
+ return expand_(str, max, true);
3251
+ }
3252
+ return [str];
3253
+ }
3254
+ let n7;
3255
+ if (isSequence) {
3256
+ n7 = m.body.split(/\.\./);
3257
+ } else {
3258
+ n7 = parseCommaParts(m.body);
3259
+ if (n7.length === 1 && n7[0] !== void 0) {
3260
+ n7 = expand_(n7[0], max, false).map(embrace);
3261
+ if (n7.length === 1) {
3262
+ return post.map((p) => m.pre + n7[0] + p);
3263
+ }
3264
+ }
3265
+ }
3266
+ let N2;
3267
+ if (isSequence && n7[0] !== void 0 && n7[1] !== void 0) {
3268
+ const x2 = numeric(n7[0]);
3269
+ const y = numeric(n7[1]);
3270
+ const width = Math.max(n7[0].length, n7[1].length);
3271
+ let incr = n7.length === 3 && n7[2] !== void 0 ? Math.max(Math.abs(numeric(n7[2])), 1) : 1;
3272
+ let test = lte;
3273
+ const reverse = y < x2;
3274
+ if (reverse) {
3275
+ incr *= -1;
3276
+ test = gte;
3277
+ }
3278
+ const pad = n7.some(isPadded);
3279
+ N2 = [];
3280
+ for (let i = x2; test(i, y); i += incr) {
3281
+ let c;
3282
+ if (isAlphaSequence) {
3283
+ c = String.fromCharCode(i);
3284
+ if (c === "\\") {
3285
+ c = "";
3286
+ }
3287
+ } else {
3288
+ c = String(i);
3289
+ if (pad) {
3290
+ const need = width - c.length;
3291
+ if (need > 0) {
3292
+ const z = new Array(need + 1).join("0");
3293
+ if (i < 0) {
3294
+ c = "-" + z + c.slice(1);
3295
+ } else {
3296
+ c = z + c;
3297
+ }
3298
+ }
3299
+ }
3300
+ }
3301
+ N2.push(c);
3302
+ }
3303
+ } else {
3304
+ N2 = [];
3305
+ for (let j2 = 0; j2 < n7.length; j2++) {
3306
+ N2.push.apply(N2, expand_(n7[j2], max, false));
3307
+ }
3308
+ }
3309
+ for (let j2 = 0; j2 < N2.length; j2++) {
3310
+ for (let k2 = 0; k2 < post.length && expansions.length < max; k2++) {
3311
+ const expansion = pre + N2[j2] + post[k2];
3312
+ if (!isTop || isSequence || expansion) {
3313
+ expansions.push(expansion);
3314
+ }
3315
+ }
3316
+ }
3317
+ }
3318
+ return expansions;
3319
+ }
3320
+
3321
+ // node_modules/minimatch/dist/esm/assert-valid-pattern.js
3322
+ var MAX_PATTERN_LENGTH = 1024 * 64;
3323
+ var assertValidPattern = (pattern) => {
3324
+ if (typeof pattern !== "string") {
3325
+ throw new TypeError("invalid pattern");
3326
+ }
3327
+ if (pattern.length > MAX_PATTERN_LENGTH) {
3328
+ throw new TypeError("pattern is too long");
3329
+ }
3330
+ };
3331
+
3332
+ // node_modules/minimatch/dist/esm/brace-expressions.js
3333
+ var posixClasses = {
3334
+ "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
3335
+ "[:alpha:]": ["\\p{L}\\p{Nl}", true],
3336
+ "[:ascii:]": ["\\x00-\\x7f", false],
3337
+ "[:blank:]": ["\\p{Zs}\\t", true],
3338
+ "[:cntrl:]": ["\\p{Cc}", true],
3339
+ "[:digit:]": ["\\p{Nd}", true],
3340
+ "[:graph:]": ["\\p{Z}\\p{C}", true, true],
3341
+ "[:lower:]": ["\\p{Ll}", true],
3342
+ "[:print:]": ["\\p{C}", true],
3343
+ "[:punct:]": ["\\p{P}", true],
3344
+ "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
3345
+ "[:upper:]": ["\\p{Lu}", true],
3346
+ "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
3347
+ "[:xdigit:]": ["A-Fa-f0-9", false]
3348
+ };
3349
+ var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
3350
+ var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
3351
+ var rangesToString = (ranges) => ranges.join("");
3352
+ var parseClass = (glob, position) => {
3353
+ const pos = position;
3354
+ if (glob.charAt(pos) !== "[") {
3355
+ throw new Error("not in a brace expression");
3356
+ }
3357
+ const ranges = [];
3358
+ const negs = [];
3359
+ let i = pos + 1;
3360
+ let sawStart = false;
3361
+ let uflag = false;
3362
+ let escaping = false;
3363
+ let negate = false;
3364
+ let endPos = pos;
3365
+ let rangeStart = "";
3366
+ WHILE: while (i < glob.length) {
3367
+ const c = glob.charAt(i);
3368
+ if ((c === "!" || c === "^") && i === pos + 1) {
3369
+ negate = true;
3370
+ i++;
3371
+ continue;
3372
+ }
3373
+ if (c === "]" && sawStart && !escaping) {
3374
+ endPos = i + 1;
3375
+ break;
3376
+ }
3377
+ sawStart = true;
3378
+ if (c === "\\") {
3379
+ if (!escaping) {
3380
+ escaping = true;
3381
+ i++;
3382
+ continue;
3383
+ }
3384
+ }
3385
+ if (c === "[" && !escaping) {
3386
+ for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
3387
+ if (glob.startsWith(cls, i)) {
3388
+ if (rangeStart) {
3389
+ return ["$.", false, glob.length - pos, true];
3390
+ }
3391
+ i += cls.length;
3392
+ if (neg)
3393
+ negs.push(unip);
3394
+ else
3395
+ ranges.push(unip);
3396
+ uflag = uflag || u;
3397
+ continue WHILE;
3398
+ }
3399
+ }
3400
+ }
3401
+ escaping = false;
3402
+ if (rangeStart) {
3403
+ if (c > rangeStart) {
3404
+ ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
3405
+ } else if (c === rangeStart) {
3406
+ ranges.push(braceEscape(c));
3407
+ }
3408
+ rangeStart = "";
3409
+ i++;
3410
+ continue;
3411
+ }
3412
+ if (glob.startsWith("-]", i + 1)) {
3413
+ ranges.push(braceEscape(c + "-"));
3414
+ i += 2;
3415
+ continue;
3416
+ }
3417
+ if (glob.startsWith("-", i + 1)) {
3418
+ rangeStart = c;
3419
+ i += 2;
3420
+ continue;
3421
+ }
3422
+ ranges.push(braceEscape(c));
3423
+ i++;
3424
+ }
3425
+ if (endPos < i) {
3426
+ return ["", false, 0, false];
3427
+ }
3428
+ if (!ranges.length && !negs.length) {
3429
+ return ["$.", false, glob.length - pos, true];
3430
+ }
3431
+ if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
3432
+ const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
3433
+ return [regexpEscape(r), false, endPos - pos, false];
3434
+ }
3435
+ const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
3436
+ const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
3437
+ const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
3438
+ return [comb, uflag, endPos - pos, true];
3439
+ };
3440
+
3441
+ // node_modules/minimatch/dist/esm/unescape.js
3442
+ var unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
3443
+ if (magicalBraces) {
3444
+ return windowsPathsNoEscape ? s.replace(/\[([^/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
3445
+ }
3446
+ return windowsPathsNoEscape ? s.replace(/\[([^/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
3447
+ };
3448
+
3449
+ // node_modules/minimatch/dist/esm/ast.js
3450
+ var _a;
3451
+ var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
3452
+ var isExtglobType = (c) => types.has(c);
3453
+ var isExtglobAST = (c) => isExtglobType(c.type);
3454
+ var adoptionMap = /* @__PURE__ */ new Map([
3455
+ ["!", ["@"]],
3456
+ ["?", ["?", "@"]],
3457
+ ["@", ["@"]],
3458
+ ["*", ["*", "+", "?", "@"]],
3459
+ ["+", ["+", "@"]]
3460
+ ]);
3461
+ var adoptionWithSpaceMap = /* @__PURE__ */ new Map([
3462
+ ["!", ["?"]],
3463
+ ["@", ["?"]],
3464
+ ["+", ["?", "*"]]
3465
+ ]);
3466
+ var adoptionAnyMap = /* @__PURE__ */ new Map([
3467
+ ["!", ["?", "@"]],
3468
+ ["?", ["?", "@"]],
3469
+ ["@", ["?", "@"]],
3470
+ ["*", ["*", "+", "?", "@"]],
3471
+ ["+", ["+", "@", "?", "*"]]
3472
+ ]);
3473
+ var usurpMap = /* @__PURE__ */ new Map([
3474
+ ["!", /* @__PURE__ */ new Map([["!", "@"]])],
3475
+ [
3476
+ "?",
3477
+ /* @__PURE__ */ new Map([
3478
+ ["*", "*"],
3479
+ ["+", "*"]
3480
+ ])
3481
+ ],
3482
+ [
3483
+ "@",
3484
+ /* @__PURE__ */ new Map([
3485
+ ["!", "!"],
3486
+ ["?", "?"],
3487
+ ["@", "@"],
3488
+ ["*", "*"],
3489
+ ["+", "+"]
3490
+ ])
3491
+ ],
3492
+ [
3493
+ "+",
3494
+ /* @__PURE__ */ new Map([
3495
+ ["?", "*"],
3496
+ ["*", "*"]
3497
+ ])
3498
+ ]
3499
+ ]);
3500
+ var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
3501
+ var startNoDot = "(?!\\.)";
3502
+ var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
3503
+ var justDots = /* @__PURE__ */ new Set(["..", "."]);
3504
+ var reSpecials = new Set("().*{}+?[]^$\\!");
3505
+ var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
3506
+ var qmark = "[^/]";
3507
+ var star = qmark + "*?";
3508
+ var starNoEmpty = qmark + "+?";
3509
+ var ID = 0;
3510
+ var AST = class {
3511
+ type;
3512
+ #root;
3513
+ #hasMagic;
3514
+ #uflag = false;
3515
+ #parts = [];
3516
+ #parent;
3517
+ #parentIndex;
3518
+ #negs;
3519
+ #filledNegs = false;
3520
+ #options;
3521
+ #toString;
3522
+ // set to true if it's an extglob with no children
3523
+ // (which really means one child of '')
3524
+ #emptyExt = false;
3525
+ id = ++ID;
3526
+ get depth() {
3527
+ return (this.#parent?.depth ?? -1) + 1;
3528
+ }
3529
+ [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
3530
+ return {
3531
+ "@@type": "AST",
3532
+ id: this.id,
3533
+ type: this.type,
3534
+ root: this.#root.id,
3535
+ parent: this.#parent?.id,
3536
+ depth: this.depth,
3537
+ partsLength: this.#parts.length,
3538
+ parts: this.#parts
3539
+ };
3540
+ }
3541
+ constructor(type, parent, options = {}) {
3542
+ this.type = type;
3543
+ if (type)
3544
+ this.#hasMagic = true;
3545
+ this.#parent = parent;
3546
+ this.#root = this.#parent ? this.#parent.#root : this;
3547
+ this.#options = this.#root === this ? options : this.#root.#options;
3548
+ this.#negs = this.#root === this ? [] : this.#root.#negs;
3549
+ if (type === "!" && !this.#root.#filledNegs)
3550
+ this.#negs.push(this);
3551
+ this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
3552
+ }
3553
+ get hasMagic() {
3554
+ if (this.#hasMagic !== void 0)
3555
+ return this.#hasMagic;
3556
+ for (const p of this.#parts) {
3557
+ if (typeof p === "string")
3558
+ continue;
3559
+ if (p.type || p.hasMagic)
3560
+ return this.#hasMagic = true;
3561
+ }
3562
+ return this.#hasMagic;
3563
+ }
3564
+ // reconstructs the pattern
3565
+ toString() {
3566
+ return this.#toString !== void 0 ? this.#toString : !this.type ? this.#toString = this.#parts.map((p) => String(p)).join("") : this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
3567
+ }
3568
+ #fillNegs() {
3569
+ if (this !== this.#root)
3570
+ throw new Error("should only call on root");
3571
+ if (this.#filledNegs)
3572
+ return this;
3573
+ this.toString();
3574
+ this.#filledNegs = true;
3575
+ let n7;
3576
+ while (n7 = this.#negs.pop()) {
3577
+ if (n7.type !== "!")
3578
+ continue;
3579
+ let p = n7;
3580
+ let pp = p.#parent;
3581
+ while (pp) {
3582
+ for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) {
3583
+ for (const part of n7.#parts) {
3584
+ if (typeof part === "string") {
3585
+ throw new Error("string part in extglob AST??");
3586
+ }
3587
+ part.copyIn(pp.#parts[i]);
3588
+ }
3589
+ }
3590
+ p = pp;
3591
+ pp = p.#parent;
3592
+ }
3593
+ }
3594
+ return this;
3595
+ }
3596
+ push(...parts) {
3597
+ for (const p of parts) {
3598
+ if (p === "")
3599
+ continue;
3600
+ if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) {
3601
+ throw new Error("invalid part: " + p);
3602
+ }
3603
+ this.#parts.push(p);
3604
+ }
3605
+ }
3606
+ toJSON() {
3607
+ const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
3608
+ if (this.isStart() && !this.type)
3609
+ ret.unshift([]);
3610
+ if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) {
3611
+ ret.push({});
3612
+ }
3613
+ return ret;
3614
+ }
3615
+ isStart() {
3616
+ if (this.#root === this)
3617
+ return true;
3618
+ if (!this.#parent?.isStart())
3619
+ return false;
3620
+ if (this.#parentIndex === 0)
3621
+ return true;
3622
+ const p = this.#parent;
3623
+ for (let i = 0; i < this.#parentIndex; i++) {
3624
+ const pp = p.#parts[i];
3625
+ if (!(pp instanceof _a && pp.type === "!")) {
3626
+ return false;
3627
+ }
3628
+ }
3629
+ return true;
3630
+ }
3631
+ isEnd() {
3632
+ if (this.#root === this)
3633
+ return true;
3634
+ if (this.#parent?.type === "!")
3635
+ return true;
3636
+ if (!this.#parent?.isEnd())
3637
+ return false;
3638
+ if (!this.type)
3639
+ return this.#parent?.isEnd();
3640
+ const pl = this.#parent ? this.#parent.#parts.length : 0;
3641
+ return this.#parentIndex === pl - 1;
3642
+ }
3643
+ copyIn(part) {
3644
+ if (typeof part === "string")
3645
+ this.push(part);
3646
+ else
3647
+ this.push(part.clone(this));
3648
+ }
3649
+ clone(parent) {
3650
+ const c = new _a(this.type, parent);
3651
+ for (const p of this.#parts) {
3652
+ c.copyIn(p);
3653
+ }
3654
+ return c;
3655
+ }
3656
+ static #parseAST(str, ast, pos, opt, extDepth) {
3657
+ const maxDepth = opt.maxExtglobRecursion ?? 2;
3658
+ let escaping = false;
3659
+ let inBrace = false;
3660
+ let braceStart = -1;
3661
+ let braceNeg = false;
3662
+ if (ast.type === null) {
3663
+ let i2 = pos;
3664
+ let acc2 = "";
3665
+ while (i2 < str.length) {
3666
+ const c = str.charAt(i2++);
3667
+ if (escaping || c === "\\") {
3668
+ escaping = !escaping;
3669
+ acc2 += c;
3670
+ continue;
3671
+ }
3672
+ if (inBrace) {
3673
+ if (i2 === braceStart + 1) {
3674
+ if (c === "^" || c === "!") {
3675
+ braceNeg = true;
3676
+ }
3677
+ } else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
3678
+ inBrace = false;
3679
+ }
3680
+ acc2 += c;
3681
+ continue;
3682
+ } else if (c === "[") {
3683
+ inBrace = true;
3684
+ braceStart = i2;
3685
+ braceNeg = false;
3686
+ acc2 += c;
3687
+ continue;
3688
+ }
3689
+ const doRecurse = !opt.noext && isExtglobType(c) && str.charAt(i2) === "(" && extDepth <= maxDepth;
3690
+ if (doRecurse) {
3691
+ ast.push(acc2);
3692
+ acc2 = "";
3693
+ const ext2 = new _a(c, ast);
3694
+ i2 = _a.#parseAST(str, ext2, i2, opt, extDepth + 1);
3695
+ ast.push(ext2);
3696
+ continue;
3697
+ }
3698
+ acc2 += c;
3699
+ }
3700
+ ast.push(acc2);
3701
+ return i2;
3702
+ }
3703
+ let i = pos + 1;
3704
+ let part = new _a(null, ast);
3705
+ const parts = [];
3706
+ let acc = "";
3707
+ while (i < str.length) {
3708
+ const c = str.charAt(i++);
3709
+ if (escaping || c === "\\") {
3710
+ escaping = !escaping;
3711
+ acc += c;
3712
+ continue;
3713
+ }
3714
+ if (inBrace) {
3715
+ if (i === braceStart + 1) {
3716
+ if (c === "^" || c === "!") {
3717
+ braceNeg = true;
3718
+ }
3719
+ } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) {
3720
+ inBrace = false;
3721
+ }
3722
+ acc += c;
3723
+ continue;
3724
+ } else if (c === "[") {
3725
+ inBrace = true;
3726
+ braceStart = i;
3727
+ braceNeg = false;
3728
+ acc += c;
3729
+ continue;
3730
+ }
3731
+ const doRecurse = !opt.noext && isExtglobType(c) && str.charAt(i) === "(" && /* c8 ignore start - the maxDepth is sufficient here */
3732
+ (extDepth <= maxDepth || ast && ast.#canAdoptType(c));
3733
+ if (doRecurse) {
3734
+ const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
3735
+ part.push(acc);
3736
+ acc = "";
3737
+ const ext2 = new _a(c, part);
3738
+ part.push(ext2);
3739
+ i = _a.#parseAST(str, ext2, i, opt, extDepth + depthAdd);
3740
+ continue;
3741
+ }
3742
+ if (c === "|") {
3743
+ part.push(acc);
3744
+ acc = "";
3745
+ parts.push(part);
3746
+ part = new _a(null, ast);
3747
+ continue;
3748
+ }
3749
+ if (c === ")") {
3750
+ if (acc === "" && ast.#parts.length === 0) {
3751
+ ast.#emptyExt = true;
3752
+ }
3753
+ part.push(acc);
3754
+ acc = "";
3755
+ ast.push(...parts, part);
3756
+ return i;
3757
+ }
3758
+ acc += c;
3759
+ }
3760
+ ast.type = null;
3761
+ ast.#hasMagic = void 0;
3762
+ ast.#parts = [str.substring(pos - 1)];
3763
+ return i;
3764
+ }
3765
+ #canAdoptWithSpace(child) {
3766
+ return this.#canAdopt(child, adoptionWithSpaceMap);
3767
+ }
3768
+ #canAdopt(child, map = adoptionMap) {
3769
+ if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) {
3770
+ return false;
3771
+ }
3772
+ const gc = child.#parts[0];
3773
+ if (!gc || typeof gc !== "object" || gc.type === null) {
3774
+ return false;
3775
+ }
3776
+ return this.#canAdoptType(gc.type, map);
3777
+ }
3778
+ #canAdoptType(c, map = adoptionAnyMap) {
3779
+ return !!map.get(this.type)?.includes(c);
3780
+ }
3781
+ #adoptWithSpace(child, index) {
3782
+ const gc = child.#parts[0];
3783
+ const blank = new _a(null, gc, this.options);
3784
+ blank.#parts.push("");
3785
+ gc.push(blank);
3786
+ this.#adopt(child, index);
3787
+ }
3788
+ #adopt(child, index) {
3789
+ const gc = child.#parts[0];
3790
+ this.#parts.splice(index, 1, ...gc.#parts);
3791
+ for (const p of gc.#parts) {
3792
+ if (typeof p === "object")
3793
+ p.#parent = this;
3794
+ }
3795
+ this.#toString = void 0;
3796
+ }
3797
+ #canUsurpType(c) {
3798
+ const m = usurpMap.get(this.type);
3799
+ return !!m?.has(c);
3800
+ }
3801
+ #canUsurp(child) {
3802
+ if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) {
3803
+ return false;
3804
+ }
3805
+ const gc = child.#parts[0];
3806
+ if (!gc || typeof gc !== "object" || gc.type === null) {
3807
+ return false;
3808
+ }
3809
+ return this.#canUsurpType(gc.type);
3810
+ }
3811
+ #usurp(child) {
3812
+ const m = usurpMap.get(this.type);
3813
+ const gc = child.#parts[0];
3814
+ const nt2 = m?.get(gc.type);
3815
+ if (!nt2)
3816
+ return false;
3817
+ this.#parts = gc.#parts;
3818
+ for (const p of this.#parts) {
3819
+ if (typeof p === "object") {
3820
+ p.#parent = this;
3821
+ }
3822
+ }
3823
+ this.type = nt2;
3824
+ this.#toString = void 0;
3825
+ this.#emptyExt = false;
3826
+ }
3827
+ static fromGlob(pattern, options = {}) {
3828
+ const ast = new _a(null, void 0, options);
3829
+ _a.#parseAST(pattern, ast, 0, options, 0);
3830
+ return ast;
3831
+ }
3832
+ // returns the regular expression if there's magic, or the unescaped
3833
+ // string if not.
3834
+ toMMPattern() {
3835
+ if (this !== this.#root)
3836
+ return this.#root.toMMPattern();
3837
+ const glob = this.toString();
3838
+ const [re2, body, hasMagic, uflag] = this.toRegExpSource();
3839
+ const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
3840
+ if (!anyMagic) {
3841
+ return body;
3842
+ }
3843
+ const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
3844
+ return Object.assign(new RegExp(`^${re2}$`, flags), {
3845
+ _src: re2,
3846
+ _glob: glob
3847
+ });
3848
+ }
3849
+ get options() {
3850
+ return this.#options;
3851
+ }
3852
+ // returns the string match, the regexp source, whether there's magic
3853
+ // in the regexp (so a regular expression is required) and whether or
3854
+ // not the uflag is needed for the regular expression (for posix classes)
3855
+ // TODO: instead of injecting the start/end at this point, just return
3856
+ // the BODY of the regexp, along with the start/end portions suitable
3857
+ // for binding the start/end in either a joined full-path makeRe context
3858
+ // (where we bind to (^|/), or a standalone matchPart context (where
3859
+ // we bind to ^, and not /). Otherwise slashes get duped!
3860
+ //
3861
+ // In part-matching mode, the start is:
3862
+ // - if not isStart: nothing
3863
+ // - if traversal possible, but not allowed: ^(?!\.\.?$)
3864
+ // - if dots allowed or not possible: ^
3865
+ // - if dots possible and not allowed: ^(?!\.)
3866
+ // end is:
3867
+ // - if not isEnd(): nothing
3868
+ // - else: $
3869
+ //
3870
+ // In full-path matching mode, we put the slash at the START of the
3871
+ // pattern, so start is:
3872
+ // - if first pattern: same as part-matching mode
3873
+ // - if not isStart(): nothing
3874
+ // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
3875
+ // - if dots allowed or not possible: /
3876
+ // - if dots possible and not allowed: /(?!\.)
3877
+ // end is:
3878
+ // - if last pattern, same as part-matching mode
3879
+ // - else nothing
3880
+ //
3881
+ // Always put the (?:$|/) on negated tails, though, because that has to be
3882
+ // there to bind the end of the negated pattern portion, and it's easier to
3883
+ // just stick it in now rather than try to inject it later in the middle of
3884
+ // the pattern.
3885
+ //
3886
+ // We can just always return the same end, and leave it up to the caller
3887
+ // to know whether it's going to be used joined or in parts.
3888
+ // And, if the start is adjusted slightly, can do the same there:
3889
+ // - if not isStart: nothing
3890
+ // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
3891
+ // - if dots allowed or not possible: (?:/|^)
3892
+ // - if dots possible and not allowed: (?:/|^)(?!\.)
3893
+ //
3894
+ // But it's better to have a simpler binding without a conditional, for
3895
+ // performance, so probably better to return both start options.
3896
+ //
3897
+ // Then the caller just ignores the end if it's not the first pattern,
3898
+ // and the start always gets applied.
3899
+ //
3900
+ // But that's always going to be $ if it's the ending pattern, or nothing,
3901
+ // so the caller can just attach $ at the end of the pattern when building.
3902
+ //
3903
+ // So the todo is:
3904
+ // - better detect what kind of start is needed
3905
+ // - return both flavors of starting pattern
3906
+ // - attach $ at the end of the pattern when creating the actual RegExp
3907
+ //
3908
+ // Ah, but wait, no, that all only applies to the root when the first pattern
3909
+ // is not an extglob. If the first pattern IS an extglob, then we need all
3910
+ // that dot prevention biz to live in the extglob portions, because eg
3911
+ // +(*|.x*) can match .xy but not .yx.
3912
+ //
3913
+ // So, return the two flavors if it's #root and the first child is not an
3914
+ // AST, otherwise leave it to the child AST to handle it, and there,
3915
+ // use the (?:^|/) style of start binding.
3916
+ //
3917
+ // Even simplified further:
3918
+ // - Since the start for a join is eg /(?!\.) and the start for a part
3919
+ // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
3920
+ // or start or whatever) and prepend ^ or / at the Regexp construction.
3921
+ toRegExpSource(allowDot) {
3922
+ const dot = allowDot ?? !!this.#options.dot;
3923
+ if (this.#root === this) {
3924
+ this.#flatten();
3925
+ this.#fillNegs();
3926
+ }
3927
+ if (!isExtglobAST(this)) {
3928
+ const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
3929
+ const src = this.#parts.map((p) => {
3930
+ const [re2, _2, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
3931
+ this.#hasMagic = this.#hasMagic || hasMagic;
3932
+ this.#uflag = this.#uflag || uflag;
3933
+ return re2;
3934
+ }).join("");
3935
+ let start2 = "";
3936
+ if (this.isStart()) {
3937
+ if (typeof this.#parts[0] === "string") {
3938
+ const dotTravAllowed = this.#parts.length === 1 && justDots.has(this.#parts[0]);
3939
+ if (!dotTravAllowed) {
3940
+ const aps = addPatternStart;
3941
+ const needNoTrav = (
3942
+ // dots are allowed, and the pattern starts with [ or .
3943
+ dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
3944
+ src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
3945
+ src.startsWith("\\.\\.") && aps.has(src.charAt(4))
3946
+ );
3947
+ const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
3948
+ start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
3949
+ }
3950
+ }
3951
+ }
3952
+ let end = "";
3953
+ if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") {
3954
+ end = "(?:$|\\/)";
3955
+ }
3956
+ const final2 = start2 + src + end;
3957
+ return [
3958
+ final2,
3959
+ unescape(src),
3960
+ this.#hasMagic = !!this.#hasMagic,
3961
+ this.#uflag
3962
+ ];
3963
+ }
3964
+ const repeated = this.type === "*" || this.type === "+";
3965
+ const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
3966
+ let body = this.#partsToRegExp(dot);
3967
+ if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
3968
+ const s = this.toString();
3969
+ const me2 = this;
3970
+ me2.#parts = [s];
3971
+ me2.type = null;
3972
+ me2.#hasMagic = void 0;
3973
+ return [s, unescape(this.toString()), false, false];
3974
+ }
3975
+ let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
3976
+ if (bodyDotAllowed === body) {
3977
+ bodyDotAllowed = "";
3978
+ }
3979
+ if (bodyDotAllowed) {
3980
+ body = `(?:${body})(?:${bodyDotAllowed})*?`;
3981
+ }
3982
+ let final = "";
3983
+ if (this.type === "!" && this.#emptyExt) {
3984
+ final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
3985
+ } else {
3986
+ const close = this.type === "!" ? (
3987
+ // !() must match something,but !(x) can match ''
3988
+ "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
3989
+ ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
3990
+ final = start + body + close;
3991
+ }
3992
+ return [
3993
+ final,
3994
+ unescape(body),
3995
+ this.#hasMagic = !!this.#hasMagic,
3996
+ this.#uflag
3997
+ ];
3998
+ }
3999
+ #flatten() {
4000
+ if (!isExtglobAST(this)) {
4001
+ for (const p of this.#parts) {
4002
+ if (typeof p === "object") {
4003
+ p.#flatten();
4004
+ }
4005
+ }
4006
+ } else {
4007
+ let iterations = 0;
4008
+ let done = false;
4009
+ do {
4010
+ done = true;
4011
+ for (let i = 0; i < this.#parts.length; i++) {
4012
+ const c = this.#parts[i];
4013
+ if (typeof c === "object") {
4014
+ c.#flatten();
4015
+ if (this.#canAdopt(c)) {
4016
+ done = false;
4017
+ this.#adopt(c, i);
4018
+ } else if (this.#canAdoptWithSpace(c)) {
4019
+ done = false;
4020
+ this.#adoptWithSpace(c, i);
4021
+ } else if (this.#canUsurp(c)) {
4022
+ done = false;
4023
+ this.#usurp(c);
4024
+ }
4025
+ }
4026
+ }
4027
+ } while (!done && ++iterations < 10);
4028
+ }
4029
+ this.#toString = void 0;
4030
+ }
4031
+ #partsToRegExp(dot) {
4032
+ return this.#parts.map((p) => {
4033
+ if (typeof p === "string") {
4034
+ throw new Error("string type in extglob ast??");
4035
+ }
4036
+ const [re2, _2, _hasMagic, uflag] = p.toRegExpSource(dot);
4037
+ this.#uflag = this.#uflag || uflag;
4038
+ return re2;
4039
+ }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
4040
+ }
4041
+ static #parseGlob(glob, hasMagic, noEmpty = false) {
4042
+ let escaping = false;
4043
+ let re2 = "";
4044
+ let uflag = false;
4045
+ let inStar = false;
4046
+ for (let i = 0; i < glob.length; i++) {
4047
+ const c = glob.charAt(i);
4048
+ if (escaping) {
4049
+ escaping = false;
4050
+ re2 += (reSpecials.has(c) ? "\\" : "") + c;
4051
+ continue;
4052
+ }
4053
+ if (c === "*") {
4054
+ if (inStar)
4055
+ continue;
4056
+ inStar = true;
4057
+ re2 += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star;
4058
+ hasMagic = true;
4059
+ continue;
4060
+ } else {
4061
+ inStar = false;
4062
+ }
4063
+ if (c === "\\") {
4064
+ if (i === glob.length - 1) {
4065
+ re2 += "\\\\";
4066
+ } else {
4067
+ escaping = true;
4068
+ }
4069
+ continue;
4070
+ }
4071
+ if (c === "[") {
4072
+ const [src, needUflag, consumed, magic] = parseClass(glob, i);
4073
+ if (consumed) {
4074
+ re2 += src;
4075
+ uflag = uflag || needUflag;
4076
+ i += consumed - 1;
4077
+ hasMagic = hasMagic || magic;
4078
+ continue;
4079
+ }
4080
+ }
4081
+ if (c === "?") {
4082
+ re2 += qmark;
4083
+ hasMagic = true;
4084
+ continue;
4085
+ }
4086
+ re2 += regExpEscape(c);
4087
+ }
4088
+ return [re2, unescape(glob), !!hasMagic, uflag];
4089
+ }
4090
+ };
4091
+ _a = AST;
4092
+
4093
+ // node_modules/minimatch/dist/esm/escape.js
4094
+ var escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
4095
+ if (magicalBraces) {
4096
+ return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
4097
+ }
4098
+ return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
4099
+ };
4100
+
4101
+ // node_modules/minimatch/dist/esm/index.js
4102
+ var minimatch = (p, pattern, options = {}) => {
4103
+ assertValidPattern(pattern);
4104
+ if (!options.nocomment && pattern.charAt(0) === "#") {
4105
+ return false;
4106
+ }
4107
+ return new Minimatch(pattern, options).match(p);
4108
+ };
4109
+ var starDotExtRE = /^\*+([^+@!?*[(]*)$/;
4110
+ var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
4111
+ var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
4112
+ var starDotExtTestNocase = (ext2) => {
4113
+ ext2 = ext2.toLowerCase();
4114
+ return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
4115
+ };
4116
+ var starDotExtTestNocaseDot = (ext2) => {
4117
+ ext2 = ext2.toLowerCase();
4118
+ return (f) => f.toLowerCase().endsWith(ext2);
4119
+ };
4120
+ var starDotStarRE = /^\*+\.\*+$/;
4121
+ var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
4122
+ var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
4123
+ var dotStarRE = /^\.\*+$/;
4124
+ var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
4125
+ var starRE = /^\*+$/;
4126
+ var starTest = (f) => f.length !== 0 && !f.startsWith(".");
4127
+ var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
4128
+ var qmarksRE = /^\?+([^+@!?*[(]*)?$/;
4129
+ var qmarksTestNocase = ([$0, ext2 = ""]) => {
4130
+ const noext = qmarksTestNoExt([$0]);
4131
+ if (!ext2)
4132
+ return noext;
4133
+ ext2 = ext2.toLowerCase();
4134
+ return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
4135
+ };
4136
+ var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
4137
+ const noext = qmarksTestNoExtDot([$0]);
4138
+ if (!ext2)
4139
+ return noext;
4140
+ ext2 = ext2.toLowerCase();
4141
+ return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
4142
+ };
4143
+ var qmarksTestDot = ([$0, ext2 = ""]) => {
4144
+ const noext = qmarksTestNoExtDot([$0]);
4145
+ return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
4146
+ };
4147
+ var qmarksTest = ([$0, ext2 = ""]) => {
4148
+ const noext = qmarksTestNoExt([$0]);
4149
+ return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
4150
+ };
4151
+ var qmarksTestNoExt = ([$0]) => {
4152
+ const len = $0.length;
4153
+ return (f) => f.length === len && !f.startsWith(".");
4154
+ };
4155
+ var qmarksTestNoExtDot = ([$0]) => {
4156
+ const len = $0.length;
4157
+ return (f) => f.length === len && f !== "." && f !== "..";
4158
+ };
4159
+ var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
4160
+ var path2 = {
4161
+ win32: { sep: "\\" },
4162
+ posix: { sep: "/" }
4163
+ };
4164
+ var sep = defaultPlatform === "win32" ? path2.win32.sep : path2.posix.sep;
4165
+ minimatch.sep = sep;
4166
+ var GLOBSTAR = /* @__PURE__ */ Symbol("globstar **");
4167
+ minimatch.GLOBSTAR = GLOBSTAR;
4168
+ var qmark2 = "[^/]";
4169
+ var star2 = qmark2 + "*?";
4170
+ var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
4171
+ var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
4172
+ var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
4173
+ minimatch.filter = filter;
4174
+ var ext = (a, b = {}) => Object.assign({}, a, b);
4175
+ var defaults = (def) => {
4176
+ if (!def || typeof def !== "object" || !Object.keys(def).length) {
4177
+ return minimatch;
4178
+ }
4179
+ const orig = minimatch;
4180
+ const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
4181
+ return Object.assign(m, {
4182
+ Minimatch: class Minimatch extends orig.Minimatch {
4183
+ constructor(pattern, options = {}) {
4184
+ super(pattern, ext(def, options));
4185
+ }
4186
+ static defaults(options) {
4187
+ return orig.defaults(ext(def, options)).Minimatch;
4188
+ }
4189
+ },
4190
+ AST: class AST extends orig.AST {
4191
+ /* c8 ignore start */
4192
+ constructor(type, parent, options = {}) {
4193
+ super(type, parent, ext(def, options));
4194
+ }
4195
+ /* c8 ignore stop */
4196
+ static fromGlob(pattern, options = {}) {
4197
+ return orig.AST.fromGlob(pattern, ext(def, options));
4198
+ }
4199
+ },
4200
+ unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
4201
+ escape: (s, options = {}) => orig.escape(s, ext(def, options)),
4202
+ filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
4203
+ defaults: (options) => orig.defaults(ext(def, options)),
4204
+ makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
4205
+ braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
4206
+ match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
4207
+ sep: orig.sep,
4208
+ GLOBSTAR
4209
+ });
4210
+ };
4211
+ minimatch.defaults = defaults;
4212
+ var braceExpand = (pattern, options = {}) => {
4213
+ assertValidPattern(pattern);
4214
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
4215
+ return [pattern];
4216
+ }
4217
+ return expand(pattern, { max: options.braceExpandMax });
4218
+ };
4219
+ minimatch.braceExpand = braceExpand;
4220
+ var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
4221
+ minimatch.makeRe = makeRe;
4222
+ var match = (list, pattern, options = {}) => {
4223
+ const mm = new Minimatch(pattern, options);
4224
+ list = list.filter((f) => mm.match(f));
4225
+ if (mm.options.nonull && !list.length) {
4226
+ list.push(pattern);
4227
+ }
4228
+ return list;
4229
+ };
4230
+ minimatch.match = match;
4231
+ var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
4232
+ var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
4233
+ var Minimatch = class {
4234
+ options;
4235
+ set;
4236
+ pattern;
4237
+ windowsPathsNoEscape;
4238
+ nonegate;
4239
+ negate;
4240
+ comment;
4241
+ empty;
4242
+ preserveMultipleSlashes;
4243
+ partial;
4244
+ globSet;
4245
+ globParts;
4246
+ nocase;
4247
+ isWindows;
4248
+ platform;
4249
+ windowsNoMagicRoot;
4250
+ maxGlobstarRecursion;
4251
+ regexp;
4252
+ constructor(pattern, options = {}) {
4253
+ assertValidPattern(pattern);
4254
+ options = options || {};
4255
+ this.options = options;
4256
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
4257
+ this.pattern = pattern;
4258
+ this.platform = options.platform || defaultPlatform;
4259
+ this.isWindows = this.platform === "win32";
4260
+ const awe = "allowWindowsEscape";
4261
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false;
4262
+ if (this.windowsPathsNoEscape) {
4263
+ this.pattern = this.pattern.replace(/\\/g, "/");
4264
+ }
4265
+ this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
4266
+ this.regexp = null;
4267
+ this.negate = false;
4268
+ this.nonegate = !!options.nonegate;
4269
+ this.comment = false;
4270
+ this.empty = false;
4271
+ this.partial = !!options.partial;
4272
+ this.nocase = !!this.options.nocase;
4273
+ this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
4274
+ this.globSet = [];
4275
+ this.globParts = [];
4276
+ this.set = [];
4277
+ this.make();
4278
+ }
4279
+ hasMagic() {
4280
+ if (this.options.magicalBraces && this.set.length > 1) {
4281
+ return true;
4282
+ }
4283
+ for (const pattern of this.set) {
4284
+ for (const part of pattern) {
4285
+ if (typeof part !== "string")
4286
+ return true;
4287
+ }
4288
+ }
4289
+ return false;
4290
+ }
4291
+ debug(..._2) {
4292
+ }
4293
+ make() {
4294
+ const pattern = this.pattern;
4295
+ const options = this.options;
4296
+ if (!options.nocomment && pattern.charAt(0) === "#") {
4297
+ this.comment = true;
4298
+ return;
4299
+ }
4300
+ if (!pattern) {
4301
+ this.empty = true;
4302
+ return;
4303
+ }
4304
+ this.parseNegate();
4305
+ this.globSet = [...new Set(this.braceExpand())];
4306
+ if (options.debug) {
4307
+ this.debug = (...args) => console.error(...args);
4308
+ }
4309
+ this.debug(this.pattern, this.globSet);
4310
+ const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
4311
+ this.globParts = this.preprocess(rawGlobParts);
4312
+ this.debug(this.pattern, this.globParts);
4313
+ let set = this.globParts.map((s, _2, __) => {
4314
+ if (this.isWindows && this.windowsNoMagicRoot) {
4315
+ const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
4316
+ const isDrive = /^[a-z]:/i.test(s[0]);
4317
+ if (isUNC) {
4318
+ return [
4319
+ ...s.slice(0, 4),
4320
+ ...s.slice(4).map((ss2) => this.parse(ss2))
4321
+ ];
4322
+ } else if (isDrive) {
4323
+ return [s[0], ...s.slice(1).map((ss2) => this.parse(ss2))];
4324
+ }
4325
+ }
4326
+ return s.map((ss2) => this.parse(ss2));
4327
+ });
4328
+ this.debug(this.pattern, set);
4329
+ this.set = set.filter((s) => s.indexOf(false) === -1);
4330
+ if (this.isWindows) {
4331
+ for (let i = 0; i < this.set.length; i++) {
4332
+ const p = this.set[i];
4333
+ if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
4334
+ p[2] = "?";
4335
+ }
4336
+ }
4337
+ }
4338
+ this.debug(this.pattern, this.set);
4339
+ }
4340
+ // various transforms to equivalent pattern sets that are
4341
+ // faster to process in a filesystem walk. The goal is to
4342
+ // eliminate what we can, and push all ** patterns as far
4343
+ // to the right as possible, even if it increases the number
4344
+ // of patterns that we have to process.
4345
+ preprocess(globParts) {
4346
+ if (this.options.noglobstar) {
4347
+ for (const partset of globParts) {
4348
+ for (let j2 = 0; j2 < partset.length; j2++) {
4349
+ if (partset[j2] === "**") {
4350
+ partset[j2] = "*";
4351
+ }
4352
+ }
4353
+ }
4354
+ }
4355
+ const { optimizationLevel = 1 } = this.options;
4356
+ if (optimizationLevel >= 2) {
4357
+ globParts = this.firstPhasePreProcess(globParts);
4358
+ globParts = this.secondPhasePreProcess(globParts);
4359
+ } else if (optimizationLevel >= 1) {
4360
+ globParts = this.levelOneOptimize(globParts);
4361
+ } else {
4362
+ globParts = this.adjascentGlobstarOptimize(globParts);
4363
+ }
4364
+ return globParts;
4365
+ }
4366
+ // just get rid of adjascent ** portions
4367
+ adjascentGlobstarOptimize(globParts) {
4368
+ return globParts.map((parts) => {
4369
+ let gs2 = -1;
4370
+ while (-1 !== (gs2 = parts.indexOf("**", gs2 + 1))) {
4371
+ let i = gs2;
4372
+ while (parts[i + 1] === "**") {
4373
+ i++;
4374
+ }
4375
+ if (i !== gs2) {
4376
+ parts.splice(gs2, i - gs2);
4377
+ }
4378
+ }
4379
+ return parts;
4380
+ });
4381
+ }
4382
+ // get rid of adjascent ** and resolve .. portions
4383
+ levelOneOptimize(globParts) {
4384
+ return globParts.map((parts) => {
4385
+ parts = parts.reduce((set, part) => {
4386
+ const prev = set[set.length - 1];
4387
+ if (part === "**" && prev === "**") {
4388
+ return set;
4389
+ }
4390
+ if (part === "..") {
4391
+ if (prev && prev !== ".." && prev !== "." && prev !== "**") {
4392
+ set.pop();
4393
+ return set;
4394
+ }
4395
+ }
4396
+ set.push(part);
4397
+ return set;
4398
+ }, []);
4399
+ return parts.length === 0 ? [""] : parts;
4400
+ });
4401
+ }
4402
+ levelTwoFileOptimize(parts) {
4403
+ if (!Array.isArray(parts)) {
4404
+ parts = this.slashSplit(parts);
4405
+ }
4406
+ let didSomething = false;
4407
+ do {
4408
+ didSomething = false;
4409
+ if (!this.preserveMultipleSlashes) {
4410
+ for (let i = 1; i < parts.length - 1; i++) {
4411
+ const p = parts[i];
4412
+ if (i === 1 && p === "" && parts[0] === "")
4413
+ continue;
4414
+ if (p === "." || p === "") {
4415
+ didSomething = true;
4416
+ parts.splice(i, 1);
4417
+ i--;
4418
+ }
4419
+ }
4420
+ if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
4421
+ didSomething = true;
4422
+ parts.pop();
4423
+ }
4424
+ }
4425
+ let dd = 0;
4426
+ while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
4427
+ const p = parts[dd - 1];
4428
+ if (p && p !== "." && p !== ".." && p !== "**" && !(this.isWindows && /^[a-z]:$/i.test(p))) {
4429
+ didSomething = true;
4430
+ parts.splice(dd - 1, 2);
4431
+ dd -= 2;
4432
+ }
4433
+ }
4434
+ } while (didSomething);
4435
+ return parts.length === 0 ? [""] : parts;
4436
+ }
4437
+ // First phase: single-pattern processing
4438
+ // <pre> is 1 or more portions
4439
+ // <rest> is 1 or more portions
4440
+ // <p> is any portion other than ., .., '', or **
4441
+ // <e> is . or ''
4442
+ //
4443
+ // **/.. is *brutal* for filesystem walking performance, because
4444
+ // it effectively resets the recursive walk each time it occurs,
4445
+ // and ** cannot be reduced out by a .. pattern part like a regexp
4446
+ // or most strings (other than .., ., and '') can be.
4447
+ //
4448
+ // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
4449
+ // <pre>/<e>/<rest> -> <pre>/<rest>
4450
+ // <pre>/<p>/../<rest> -> <pre>/<rest>
4451
+ // **/**/<rest> -> **/<rest>
4452
+ //
4453
+ // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
4454
+ // this WOULD be allowed if ** did follow symlinks, or * didn't
4455
+ firstPhasePreProcess(globParts) {
4456
+ let didSomething = false;
4457
+ do {
4458
+ didSomething = false;
4459
+ for (let parts of globParts) {
4460
+ let gs2 = -1;
4461
+ while (-1 !== (gs2 = parts.indexOf("**", gs2 + 1))) {
4462
+ let gss = gs2;
4463
+ while (parts[gss + 1] === "**") {
4464
+ gss++;
4465
+ }
4466
+ if (gss > gs2) {
4467
+ parts.splice(gs2 + 1, gss - gs2);
4468
+ }
4469
+ let next = parts[gs2 + 1];
4470
+ const p = parts[gs2 + 2];
4471
+ const p2 = parts[gs2 + 3];
4472
+ if (next !== "..")
4473
+ continue;
4474
+ if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
4475
+ continue;
4476
+ }
4477
+ didSomething = true;
4478
+ parts.splice(gs2, 1);
4479
+ const other = parts.slice(0);
4480
+ other[gs2] = "**";
4481
+ globParts.push(other);
4482
+ gs2--;
4483
+ }
4484
+ if (!this.preserveMultipleSlashes) {
4485
+ for (let i = 1; i < parts.length - 1; i++) {
4486
+ const p = parts[i];
4487
+ if (i === 1 && p === "" && parts[0] === "")
4488
+ continue;
4489
+ if (p === "." || p === "") {
4490
+ didSomething = true;
4491
+ parts.splice(i, 1);
4492
+ i--;
4493
+ }
4494
+ }
4495
+ if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
4496
+ didSomething = true;
4497
+ parts.pop();
4498
+ }
4499
+ }
4500
+ let dd = 0;
4501
+ while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
4502
+ const p = parts[dd - 1];
4503
+ if (p && p !== "." && p !== ".." && p !== "**") {
4504
+ didSomething = true;
4505
+ const needDot = dd === 1 && parts[dd + 1] === "**";
4506
+ const splin = needDot ? ["."] : [];
4507
+ parts.splice(dd - 1, 2, ...splin);
4508
+ if (parts.length === 0)
4509
+ parts.push("");
4510
+ dd -= 2;
4511
+ }
4512
+ }
4513
+ }
4514
+ } while (didSomething);
4515
+ return globParts;
4516
+ }
4517
+ // second phase: multi-pattern dedupes
4518
+ // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
4519
+ // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
4520
+ // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
4521
+ //
4522
+ // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
4523
+ // ^-- not valid because ** doens't follow symlinks
4524
+ secondPhasePreProcess(globParts) {
4525
+ for (let i = 0; i < globParts.length - 1; i++) {
4526
+ for (let j2 = i + 1; j2 < globParts.length; j2++) {
4527
+ const matched = this.partsMatch(globParts[i], globParts[j2], !this.preserveMultipleSlashes);
4528
+ if (matched) {
4529
+ globParts[i] = [];
4530
+ globParts[j2] = matched;
4531
+ break;
4532
+ }
4533
+ }
4534
+ }
4535
+ return globParts.filter((gs2) => gs2.length);
4536
+ }
4537
+ partsMatch(a, b, emptyGSMatch = false) {
4538
+ let ai2 = 0;
4539
+ let bi2 = 0;
4540
+ let result = [];
4541
+ let which = "";
4542
+ while (ai2 < a.length && bi2 < b.length) {
4543
+ if (a[ai2] === b[bi2]) {
4544
+ result.push(which === "b" ? b[bi2] : a[ai2]);
4545
+ ai2++;
4546
+ bi2++;
4547
+ } else if (emptyGSMatch && a[ai2] === "**" && b[bi2] === a[ai2 + 1]) {
4548
+ result.push(a[ai2]);
4549
+ ai2++;
4550
+ } else if (emptyGSMatch && b[bi2] === "**" && a[ai2] === b[bi2 + 1]) {
4551
+ result.push(b[bi2]);
4552
+ bi2++;
4553
+ } else if (a[ai2] === "*" && b[bi2] && (this.options.dot || !b[bi2].startsWith(".")) && b[bi2] !== "**") {
4554
+ if (which === "b")
4555
+ return false;
4556
+ which = "a";
4557
+ result.push(a[ai2]);
4558
+ ai2++;
4559
+ bi2++;
4560
+ } else if (b[bi2] === "*" && a[ai2] && (this.options.dot || !a[ai2].startsWith(".")) && a[ai2] !== "**") {
4561
+ if (which === "a")
4562
+ return false;
4563
+ which = "b";
4564
+ result.push(b[bi2]);
4565
+ ai2++;
4566
+ bi2++;
4567
+ } else {
4568
+ return false;
4569
+ }
4570
+ }
4571
+ return a.length === b.length && result;
4572
+ }
4573
+ parseNegate() {
4574
+ if (this.nonegate)
4575
+ return;
4576
+ const pattern = this.pattern;
4577
+ let negate = false;
4578
+ let negateOffset = 0;
4579
+ for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
4580
+ negate = !negate;
4581
+ negateOffset++;
4582
+ }
4583
+ if (negateOffset)
4584
+ this.pattern = pattern.slice(negateOffset);
4585
+ this.negate = negate;
4586
+ }
4587
+ // set partial to true to test if, for example,
4588
+ // "/a/b" matches the start of "/*/b/*/d"
4589
+ // Partial means, if you run out of file before you run
4590
+ // out of pattern, then that's fine, as long as all
4591
+ // the parts match.
4592
+ matchOne(file, pattern, partial = false) {
4593
+ let fileStartIndex = 0;
4594
+ let patternStartIndex = 0;
4595
+ if (this.isWindows) {
4596
+ const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
4597
+ const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
4598
+ const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
4599
+ const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
4600
+ const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
4601
+ const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
4602
+ if (typeof fdi === "number" && typeof pdi === "number") {
4603
+ const [fd, pd] = [
4604
+ file[fdi],
4605
+ pattern[pdi]
4606
+ ];
4607
+ if (fd.toLowerCase() === pd.toLowerCase()) {
4608
+ pattern[pdi] = fd;
4609
+ patternStartIndex = pdi;
4610
+ fileStartIndex = fdi;
4611
+ }
4612
+ }
4613
+ }
4614
+ const { optimizationLevel = 1 } = this.options;
4615
+ if (optimizationLevel >= 2) {
4616
+ file = this.levelTwoFileOptimize(file);
4617
+ }
4618
+ if (pattern.includes(GLOBSTAR)) {
4619
+ return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
4620
+ }
4621
+ return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
4622
+ }
4623
+ #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
4624
+ const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
4625
+ const lastgs = pattern.lastIndexOf(GLOBSTAR);
4626
+ const [head, body, tail] = partial ? [
4627
+ pattern.slice(patternIndex, firstgs),
4628
+ pattern.slice(firstgs + 1),
4629
+ []
4630
+ ] : [
4631
+ pattern.slice(patternIndex, firstgs),
4632
+ pattern.slice(firstgs + 1, lastgs),
4633
+ pattern.slice(lastgs + 1)
4634
+ ];
4635
+ if (head.length) {
4636
+ const fileHead = file.slice(fileIndex, fileIndex + head.length);
4637
+ if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
4638
+ return false;
4639
+ }
4640
+ fileIndex += head.length;
4641
+ patternIndex += head.length;
4642
+ }
4643
+ let fileTailMatch = 0;
4644
+ if (tail.length) {
4645
+ if (tail.length + fileIndex > file.length)
4646
+ return false;
4647
+ let tailStart = file.length - tail.length;
4648
+ if (this.#matchOne(file, tail, partial, tailStart, 0)) {
4649
+ fileTailMatch = tail.length;
4650
+ } else {
4651
+ if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
4652
+ return false;
4653
+ }
4654
+ tailStart--;
4655
+ if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
4656
+ return false;
4657
+ }
4658
+ fileTailMatch = tail.length + 1;
4659
+ }
4660
+ }
4661
+ if (!body.length) {
4662
+ let sawSome = !!fileTailMatch;
4663
+ for (let i2 = fileIndex; i2 < file.length - fileTailMatch; i2++) {
4664
+ const f = String(file[i2]);
4665
+ sawSome = true;
4666
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
4667
+ return false;
4668
+ }
4669
+ }
4670
+ return partial || sawSome;
4671
+ }
4672
+ const bodySegments = [[[], 0]];
4673
+ let currentBody = bodySegments[0];
4674
+ let nonGsParts = 0;
4675
+ const nonGsPartsSums = [0];
4676
+ for (const b of body) {
4677
+ if (b === GLOBSTAR) {
4678
+ nonGsPartsSums.push(nonGsParts);
4679
+ currentBody = [[], 0];
4680
+ bodySegments.push(currentBody);
4681
+ } else {
4682
+ currentBody[0].push(b);
4683
+ nonGsParts++;
4684
+ }
4685
+ }
4686
+ let i = bodySegments.length - 1;
4687
+ const fileLength = file.length - fileTailMatch;
4688
+ for (const b of bodySegments) {
4689
+ b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
4690
+ }
4691
+ return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
4692
+ }
4693
+ // return false for "nope, not matching"
4694
+ // return null for "not matching, cannot keep trying"
4695
+ #matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
4696
+ const bs2 = bodySegments[bodyIndex];
4697
+ if (!bs2) {
4698
+ for (let i = fileIndex; i < file.length; i++) {
4699
+ sawTail = true;
4700
+ const f = file[i];
4701
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
4702
+ return false;
4703
+ }
4704
+ }
4705
+ return sawTail;
4706
+ }
4707
+ const [body, after] = bs2;
4708
+ while (fileIndex <= after) {
4709
+ const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
4710
+ if (m && globStarDepth < this.maxGlobstarRecursion) {
4711
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
4712
+ if (sub !== false) {
4713
+ return sub;
4714
+ }
4715
+ }
4716
+ const f = file[fileIndex];
4717
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
4718
+ return false;
4719
+ }
4720
+ fileIndex++;
4721
+ }
4722
+ return partial || null;
4723
+ }
4724
+ #matchOne(file, pattern, partial, fileIndex, patternIndex) {
4725
+ let fi2;
4726
+ let pi2;
4727
+ let pl;
4728
+ let fl;
4729
+ for (fi2 = fileIndex, pi2 = patternIndex, fl = file.length, pl = pattern.length; fi2 < fl && pi2 < pl; fi2++, pi2++) {
4730
+ this.debug("matchOne loop");
4731
+ let p = pattern[pi2];
4732
+ let f = file[fi2];
4733
+ this.debug(pattern, p, f);
4734
+ if (p === false || p === GLOBSTAR) {
4735
+ return false;
4736
+ }
4737
+ let hit;
4738
+ if (typeof p === "string") {
4739
+ hit = f === p;
4740
+ this.debug("string match", p, f, hit);
4741
+ } else {
4742
+ hit = p.test(f);
4743
+ this.debug("pattern match", p, f, hit);
4744
+ }
4745
+ if (!hit)
4746
+ return false;
4747
+ }
4748
+ if (fi2 === fl && pi2 === pl) {
4749
+ return true;
4750
+ } else if (fi2 === fl) {
4751
+ return partial;
4752
+ } else if (pi2 === pl) {
4753
+ return fi2 === fl - 1 && file[fi2] === "";
4754
+ } else {
4755
+ throw new Error("wtf?");
4756
+ }
4757
+ }
4758
+ braceExpand() {
4759
+ return braceExpand(this.pattern, this.options);
4760
+ }
4761
+ parse(pattern) {
4762
+ assertValidPattern(pattern);
4763
+ const options = this.options;
4764
+ if (pattern === "**")
4765
+ return GLOBSTAR;
4766
+ if (pattern === "")
4767
+ return "";
4768
+ let m;
4769
+ let fastTest = null;
4770
+ if (m = pattern.match(starRE)) {
4771
+ fastTest = options.dot ? starTestDot : starTest;
4772
+ } else if (m = pattern.match(starDotExtRE)) {
4773
+ fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
4774
+ } else if (m = pattern.match(qmarksRE)) {
4775
+ fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
4776
+ } else if (m = pattern.match(starDotStarRE)) {
4777
+ fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
4778
+ } else if (m = pattern.match(dotStarRE)) {
4779
+ fastTest = dotStarTest;
4780
+ }
4781
+ const re2 = AST.fromGlob(pattern, this.options).toMMPattern();
4782
+ if (fastTest && typeof re2 === "object") {
4783
+ Reflect.defineProperty(re2, "test", { value: fastTest });
4784
+ }
4785
+ return re2;
4786
+ }
4787
+ makeRe() {
4788
+ if (this.regexp || this.regexp === false)
4789
+ return this.regexp;
4790
+ const set = this.set;
4791
+ if (!set.length) {
4792
+ this.regexp = false;
4793
+ return this.regexp;
4794
+ }
4795
+ const options = this.options;
4796
+ const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
4797
+ const flags = new Set(options.nocase ? ["i"] : []);
4798
+ let re2 = set.map((pattern) => {
4799
+ const pp = pattern.map((p) => {
4800
+ if (p instanceof RegExp) {
4801
+ for (const f of p.flags.split(""))
4802
+ flags.add(f);
4803
+ }
4804
+ return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
4805
+ });
4806
+ pp.forEach((p, i) => {
4807
+ const next = pp[i + 1];
4808
+ const prev = pp[i - 1];
4809
+ if (p !== GLOBSTAR || prev === GLOBSTAR) {
4810
+ return;
4811
+ }
4812
+ if (prev === void 0) {
4813
+ if (next !== void 0 && next !== GLOBSTAR) {
4814
+ pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
4815
+ } else {
4816
+ pp[i] = twoStar;
4817
+ }
4818
+ } else if (next === void 0) {
4819
+ pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
4820
+ } else if (next !== GLOBSTAR) {
4821
+ pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
4822
+ pp[i + 1] = GLOBSTAR;
4823
+ }
4824
+ });
4825
+ const filtered = pp.filter((p) => p !== GLOBSTAR);
4826
+ if (this.partial && filtered.length >= 1) {
4827
+ const prefixes = [];
4828
+ for (let i = 1; i <= filtered.length; i++) {
4829
+ prefixes.push(filtered.slice(0, i).join("/"));
4830
+ }
4831
+ return "(?:" + prefixes.join("|") + ")";
4832
+ }
4833
+ return filtered.join("/");
4834
+ }).join("|");
4835
+ const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
4836
+ re2 = "^" + open + re2 + close + "$";
4837
+ if (this.partial) {
4838
+ re2 = "^(?:\\/|" + open + re2.slice(1, -1) + close + ")$";
4839
+ }
4840
+ if (this.negate)
4841
+ re2 = "^(?!" + re2 + ").+$";
4842
+ try {
4843
+ this.regexp = new RegExp(re2, [...flags].join(""));
4844
+ } catch {
4845
+ this.regexp = false;
4846
+ }
4847
+ return this.regexp;
4848
+ }
4849
+ slashSplit(p) {
4850
+ if (this.preserveMultipleSlashes) {
4851
+ return p.split("/");
4852
+ } else if (this.isWindows && /^\/\/[^/]+/.test(p)) {
4853
+ return ["", ...p.split(/\/+/)];
4854
+ } else {
4855
+ return p.split(/\/+/);
4856
+ }
4857
+ }
4858
+ match(f, partial = this.partial) {
4859
+ this.debug("match", f, this.pattern);
4860
+ if (this.comment) {
4861
+ return false;
4862
+ }
4863
+ if (this.empty) {
4864
+ return f === "";
4865
+ }
4866
+ if (f === "/" && partial) {
4867
+ return true;
4868
+ }
4869
+ const options = this.options;
4870
+ if (this.isWindows) {
4871
+ f = f.split("\\").join("/");
4872
+ }
4873
+ const ff = this.slashSplit(f);
4874
+ this.debug(this.pattern, "split", ff);
4875
+ const set = this.set;
4876
+ this.debug(this.pattern, "set", set);
4877
+ let filename = ff[ff.length - 1];
4878
+ if (!filename) {
4879
+ for (let i = ff.length - 2; !filename && i >= 0; i--) {
4880
+ filename = ff[i];
4881
+ }
4882
+ }
4883
+ for (const pattern of set) {
4884
+ let file = ff;
4885
+ if (options.matchBase && pattern.length === 1) {
4886
+ file = [filename];
4887
+ }
4888
+ const hit = this.matchOne(file, pattern, partial);
4889
+ if (hit) {
4890
+ if (options.flipNegate) {
4891
+ return true;
4892
+ }
4893
+ return !this.negate;
4894
+ }
4895
+ }
4896
+ if (options.flipNegate) {
4897
+ return false;
4898
+ }
4899
+ return this.negate;
4900
+ }
4901
+ static defaults(def) {
4902
+ return minimatch.defaults(def).Minimatch;
4903
+ }
4904
+ };
4905
+ minimatch.AST = AST;
4906
+ minimatch.Minimatch = Minimatch;
4907
+ minimatch.escape = escape;
4908
+ minimatch.unescape = unescape;
4909
+
4910
+ // src/core/api/lintProject.ts
4911
+ var lintProject = async (config, projectDir) => {
4912
+ const files = await loadFiles(projectDir, config.lint.includes, config.lint.excludes);
4913
+ return files.map((filePath) => {
4914
+ const fileContent = fs2.readFileSync(filePath, "utf-8");
4915
+ const parser = config.parsers.find(
4916
+ (parser2) => new Minimatch(parser2.pattern).match(filePath)
4917
+ );
4918
+ if (!parser) console.error(`No parser found for file ${filePath}`);
4919
+ return parser?.parser(fileContent, filePath) ?? {};
4920
+ }).map((file) => lintFile(file, config.rules));
4921
+ };
4922
+
4923
+ export {
4924
+ __require,
4925
+ __commonJS,
4926
+ __toESM,
4927
+ defaultConfig,
4928
+ defineConfig,
4929
+ loadConfigFromFile,
4930
+ loadConfig,
4931
+ travelFile,
4932
+ lintFile,
4933
+ lintProject
4934
+ };