@vltpkg/cli-js 1.0.2 → 1.0.3

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.
Files changed (82) hide show
  1. package/{access-DB347PPG.js → access-5WETTBDZ.js} +9 -7
  2. package/{bugs-QBKI62J6.js → bugs-KONFLIQQ.js} +19 -18
  3. package/{build-EFJ3FFGU.js → build-S7G2DU7I.js} +12 -10
  4. package/{cache-BQJCMDJN.js → cache-Z4OIMLXQ.js} +23 -21
  5. package/{chunk-RXNA2XCX.js → chunk-4KCU2KZL.js} +8 -1
  6. package/{chunk-3MBSXZ62.js → chunk-5B23EKN4.js} +4 -4
  7. package/{chunk-5OGQND6H.js → chunk-5QJEOGEM.js} +3 -1
  8. package/{chunk-DEMBZY23.js → chunk-5UPPEUG2.js} +11 -11
  9. package/chunk-BJBFEQRR.js +667 -0
  10. package/{chunk-L34LR5DV.js → chunk-DYCF76WI.js} +4 -4
  11. package/{chunk-ULCDRVY2.js → chunk-E737X73P.js} +38 -24
  12. package/{chunk-F2GLBPGQ.js → chunk-FFOXTPQA.js} +8 -6
  13. package/chunk-G7UPIJAP.js +903 -0
  14. package/{chunk-CNSTFT7U.js → chunk-HAYXR3MW.js} +1 -1
  15. package/{chunk-3HUTU5SO.js → chunk-HNCE3YE5.js} +1649 -1569
  16. package/{chunk-Q46JRSZU.js → chunk-IITIX4ID.js} +22 -3
  17. package/chunk-LPIBYUMT.js +854 -0
  18. package/{chunk-47IR6Z6C.js → chunk-LZGKX7JI.js} +87 -40
  19. package/{chunk-5PFGKHIS.js → chunk-NXEH3NQZ.js} +10 -10
  20. package/{chunk-FM5DQZVN.js → chunk-OCJDISSI.js} +2 -2
  21. package/chunk-RNJSI3NZ.js +75 -0
  22. package/{chunk-ONVLPT73.js → chunk-T4GYDWUJ.js} +1 -1
  23. package/{chunk-YDUHQU7N.js → chunk-TMBNGWXK.js} +3 -3
  24. package/{chunk-CTDFRLS4.js → chunk-UAAZW4N6.js} +4 -4
  25. package/{chunk-TM4LHSZV.js → chunk-UXIRAU5T.js} +3 -3
  26. package/{chunk-BSB4XGBB.js → chunk-VB3IWNHX.js} +1 -1
  27. package/chunk-VE6CCH33.js +3000 -0
  28. package/{chunk-42UTZKAU.js → chunk-W2Q5EIMH.js} +8 -8
  29. package/{chunk-YRMICBI4.js → chunk-XQSBCMSC.js} +5 -5
  30. package/{chunk-NS4VFXHX.js → chunk-XU5SMHXP.js} +1 -1
  31. package/{ci-A22A6TCQ.js → ci-RZZE375O.js} +17 -16
  32. package/cli-package.json +1 -1
  33. package/{config-JL4TW2AV.js → config-LL3RLMZG.js} +9 -12
  34. package/{config-VOLRKFYD.js → config-MDFY3ORD.js} +15 -18
  35. package/{create-SL7HEXCS.js → create-GVSDTOGQ.js} +23 -23
  36. package/{deprecate-ZK525LQW.js → deprecate-T4TQLGXQ.js} +16 -14
  37. package/{dist-tag-FY3FB5VH.js → dist-tag-GO46UQUN.js} +11 -9
  38. package/{docs-6BPWZJFW.js → docs-FJME563T.js} +19 -18
  39. package/{exec-JZ5J7DI7.js → exec-M22KBPCK.js} +23 -23
  40. package/{exec-cache-VGSXKZVF.js → exec-cache-3UNLDUAP.js} +22 -22
  41. package/{exec-local-GPZUSOSM.js → exec-local-YHVO5RLU.js} +20 -18
  42. package/{help-XI7TNIRU.js → help-ZEWMLOJX.js} +3 -3
  43. package/{init-6KWM7CDI.js → init-4HPZY2KN.js} +12 -10
  44. package/{install-4VLOKCWH.js → install-2TZIP4PJ.js} +18 -17
  45. package/{list-3VLGWGKU.js → list-NFFXER43.js} +20 -18
  46. package/{login-3DGPSWCG.js → login-KV5YC5Z2.js} +9 -7
  47. package/{logout-DBFMZC6J.js → logout-I2VT3NAR.js} +9 -7
  48. package/{pack-LHNYEZ5W.js → pack-47ZKFSHI.js} +16 -14
  49. package/package.json +1 -1
  50. package/{ping-VLLX5LIH.js → ping-Q7Y7QV63.js} +9 -7
  51. package/{pkg-FYPUMX7U.js → pkg-VTJS2ISJ.js} +13 -11
  52. package/{profile-FOQ74TB7.js → profile-YXZYVEUX.js} +9 -7
  53. package/{publish-DFURU7DW.js → publish-CBN67KN2.js} +21 -19
  54. package/{query-NC3EABMW.js → query-U3QHF3ZE.js} +20 -18
  55. package/{registry-5DUFCPD6.js → registry-CZPFR3OF.js} +3 -3
  56. package/registry-client-package.json +1 -1
  57. package/registry-client-src-revalidate.js +403 -328
  58. package/{repo-IZXACKQ2.js → repo-4UIQRBI7.js} +19 -18
  59. package/{chunk-UVZJFBYE.js → reporter-DKZTTACW.js} +5 -5
  60. package/{run-RDFVO7FY.js → run-5DUYI6GL.js} +20 -18
  61. package/{run-exec-OGMXEVN5.js → run-exec-HPNBVAXH.js} +20 -18
  62. package/security-archive-src-update-expired.js +11 -2
  63. package/{setup-KTJQPDJB.js → setup-23W5FQVW.js} +15 -13
  64. package/{src-BJU7XZNK.js → src-2NB67FPG.js} +22 -23
  65. package/{reporter-UU654STB.js → src-6OKPBJJT.js} +42 -7
  66. package/src-M5RRGKUM.js +913 -0
  67. package/{token-SKICECA4.js → token-SRCS5CRU.js} +9 -7
  68. package/{uninstall-MTZJ33TO.js → uninstall-JXHAFXZ2.js} +18 -17
  69. package/{unpublish-3QBJZFHQ.js → unpublish-GRYB5KQH.js} +12 -10
  70. package/{update-TH477PKA.js → update-GDLL4ER6.js} +17 -16
  71. package/{version-YIBQZLQS.js → version-JVG4CI4L.js} +13 -11
  72. package/{view-FG74OAOV.js → view-ABQLVL4L.js} +12 -14
  73. package/vlr.js +1 -1
  74. package/vlrx.js +1 -1
  75. package/vlt.js +1 -1
  76. package/vlx.js +1 -1
  77. package/vlxl.js +1 -1
  78. package/{whoami-LHJ4PRJQ.js → whoami-RCCZ7BXI.js} +9 -7
  79. package/chunk-7NHXV6AH.js +0 -4488
  80. package/chunk-WAFERMRI.js +0 -1663
  81. package/chunk-ZLZ4XF46.js +0 -75
  82. package/{chunk-Y7CQIZ7Y.js → chunk-FEIPJIEN.js} +3 -3
@@ -0,0 +1,3000 @@
1
+ var global = globalThis;
2
+ import {Buffer} from "node:buffer";
3
+ import {setTimeout as _vlt_setTimeout,clearTimeout as _vlt_clearTimeout,setImmediate as _vlt_setImmediate,clearImmediate as _vlt_clearImmediate,setInterval as _vlt_setInterval,clearInterval as _vlt_clearInterval} from "node:timers";
4
+ globalThis.setTimeout = _vlt_setTimeout;
5
+ globalThis.clearTimeout = _vlt_clearTimeout;
6
+ globalThis.setImmediate = _vlt_setImmediate;
7
+ globalThis.clearImmediate = _vlt_clearImmediate;
8
+ globalThis.setInterval = _vlt_setInterval;
9
+ globalThis.clearInterval = _vlt_clearInterval;
10
+ import {createRequire as _vlt_createRequire} from "node:module";
11
+ var require = _vlt_createRequire(import.meta.filename);
12
+
13
+ // ../../node_modules/.vlt/~npm~glob@13.0.6/node_modules/glob/dist/esm/index.min.js
14
+ import { fileURLToPath as Wi } from "node:url";
15
+ import { posix as mi, win32 as re } from "node:path";
16
+ import { fileURLToPath as gi } from "node:url";
17
+ import { lstatSync as wi, readdir as yi, readdirSync as bi, readlinkSync as Si, realpathSync as Ei } from "node:fs";
18
+ import * as xi from "node:fs";
19
+ import { lstat as Ci, readdir as Ti, readlink as Ai, realpath as ki } from "node:fs/promises";
20
+ import { EventEmitter as ee } from "node:events";
21
+ import Pe from "node:stream";
22
+ import { StringDecoder as ni } from "node:string_decoder";
23
+ var Gt = (n7, t, e) => {
24
+ 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);
25
+ 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) };
26
+ };
27
+ var ce = (n7, t) => {
28
+ let e = t.match(n7);
29
+ return e ? e[0] : null;
30
+ };
31
+ var ss = (n7, t, e) => {
32
+ let s, i, r, o, h, a = e.indexOf(n7), l = e.indexOf(t, a + 1), u = a;
33
+ if (a >= 0 && l > 0) {
34
+ if (n7 === t) return [a, l];
35
+ for (s = [], r = e.length; u >= 0 && !h; ) {
36
+ if (u === a) s.push(u), a = e.indexOf(n7, u + 1);
37
+ else if (s.length === 1) {
38
+ let c = s.pop();
39
+ c !== void 0 && (h = [c, l]);
40
+ } else i = s.pop(), i !== void 0 && i < r && (r = i, o = l), l = e.indexOf(t, u + 1);
41
+ u = a < l && a >= 0 ? a : l;
42
+ }
43
+ s.length && o !== void 0 && (h = [r, o]);
44
+ }
45
+ return h;
46
+ };
47
+ var fe = "\0SLASH" + Math.random() + "\0";
48
+ var ue = "\0OPEN" + Math.random() + "\0";
49
+ var qt = "\0CLOSE" + Math.random() + "\0";
50
+ var de = "\0COMMA" + Math.random() + "\0";
51
+ var pe = "\0PERIOD" + Math.random() + "\0";
52
+ var is = new RegExp(fe, "g");
53
+ var rs = new RegExp(ue, "g");
54
+ var ns = new RegExp(qt, "g");
55
+ var os = new RegExp(de, "g");
56
+ var hs = new RegExp(pe, "g");
57
+ var as = /\\\\/g;
58
+ var ls = /\\{/g;
59
+ var cs = /\\}/g;
60
+ var fs = /\\,/g;
61
+ var us = /\\./g;
62
+ var ds = 1e5;
63
+ function Ht(n7) {
64
+ return isNaN(n7) ? n7.charCodeAt(0) : parseInt(n7, 10);
65
+ }
66
+ function ps(n7) {
67
+ return n7.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs, de).replace(us, pe);
68
+ }
69
+ function ms(n7) {
70
+ return n7.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os, ",").replace(hs, ".");
71
+ }
72
+ function me(n7) {
73
+ if (!n7) return [""];
74
+ let t = [], e = Gt("{", "}", n7);
75
+ if (!e) return n7.split(",");
76
+ let { pre: s, body: i, post: r } = e, o = s.split(",");
77
+ o[o.length - 1] += "{" + i + "}";
78
+ let h = me(r);
79
+ return r.length && (o[o.length - 1] += h.shift(), o.push.apply(o, h)), t.push.apply(t, o), t;
80
+ }
81
+ function ge(n7, t = {}) {
82
+ if (!n7) return [];
83
+ let { max: e = ds } = t;
84
+ return n7.slice(0, 2) === "{}" && (n7 = "\\{\\}" + n7.slice(2)), ht(ps(n7), e, true).map(ms);
85
+ }
86
+ function gs(n7) {
87
+ return "{" + n7 + "}";
88
+ }
89
+ function ws(n7) {
90
+ return /^-?0\d/.test(n7);
91
+ }
92
+ function ys(n7, t) {
93
+ return n7 <= t;
94
+ }
95
+ function bs(n7, t) {
96
+ return n7 >= t;
97
+ }
98
+ function ht(n7, t, e) {
99
+ let s = [], i = Gt("{", "}", n7);
100
+ if (!i) return [n7];
101
+ let r = i.pre, o = i.post.length ? ht(i.post, t, false) : [""];
102
+ if (/\$$/.test(i.pre)) for (let h = 0; h < o.length && h < t; h++) {
103
+ let a = r + "{" + i.body + "}" + o[h];
104
+ s.push(a);
105
+ }
106
+ else {
107
+ 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;
108
+ if (!l && !u) return i.post.match(/,(?!,).*\}/) ? (n7 = i.pre + "{" + i.body + qt + i.post, ht(n7, t, true)) : [n7];
109
+ let c;
110
+ if (l) c = i.body.split(/\.\./);
111
+ 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);
112
+ let d;
113
+ if (l && c[0] !== void 0 && c[1] !== void 0) {
114
+ 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;
115
+ m < f && (w *= -1, g = bs);
116
+ let E = c.some(ws);
117
+ d = [];
118
+ for (let y = f; g(y, m); y += w) {
119
+ let b;
120
+ if (a) b = String.fromCharCode(y), b === "\\" && (b = "");
121
+ else if (b = String(y), E) {
122
+ let z = p - b.length;
123
+ if (z > 0) {
124
+ let $ = new Array(z + 1).join("0");
125
+ y < 0 ? b = "-" + $ + b.slice(1) : b = $ + b;
126
+ }
127
+ }
128
+ d.push(b);
129
+ }
130
+ } else {
131
+ d = [];
132
+ for (let f = 0; f < c.length; f++) d.push.apply(d, ht(c[f], t, false));
133
+ }
134
+ for (let f = 0; f < d.length; f++) for (let m = 0; m < o.length && s.length < t; m++) {
135
+ let p = r + d[f] + o[m];
136
+ (!e || l || p) && s.push(p);
137
+ }
138
+ }
139
+ return s;
140
+ }
141
+ var at = (n7) => {
142
+ if (typeof n7 != "string") throw new TypeError("invalid pattern");
143
+ if (n7.length > 65536) throw new TypeError("pattern is too long");
144
+ };
145
+ 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] };
146
+ var lt = (n7) => n7.replace(/[[\]\\-]/g, "\\$&");
147
+ var Es = (n7) => n7.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
148
+ var we = (n7) => n7.join("");
149
+ var ye = (n7, t) => {
150
+ let e = t;
151
+ if (n7.charAt(e) !== "[") throw new Error("not in a brace expression");
152
+ let s = [], i = [], r = e + 1, o = false, h = false, a = false, l = false, u = e, c = "";
153
+ t: for (; r < n7.length; ) {
154
+ let p = n7.charAt(r);
155
+ if ((p === "!" || p === "^") && r === e + 1) {
156
+ l = true, r++;
157
+ continue;
158
+ }
159
+ if (p === "]" && o && !a) {
160
+ u = r + 1;
161
+ break;
162
+ }
163
+ if (o = true, p === "\\" && !a) {
164
+ a = true, r++;
165
+ continue;
166
+ }
167
+ if (p === "[" && !a) {
168
+ for (let [w, [g, S, E]] of Object.entries(Ss)) if (n7.startsWith(w, r)) {
169
+ if (c) return ["$.", false, n7.length - e, true];
170
+ r += w.length, E ? i.push(g) : s.push(g), h = h || S;
171
+ continue t;
172
+ }
173
+ }
174
+ if (a = false, c) {
175
+ p > c ? s.push(lt(c) + "-" + lt(p)) : p === c && s.push(lt(p)), c = "", r++;
176
+ continue;
177
+ }
178
+ if (n7.startsWith("-]", r + 1)) {
179
+ s.push(lt(p + "-")), r += 2;
180
+ continue;
181
+ }
182
+ if (n7.startsWith("-", r + 1)) {
183
+ c = p, r += 2;
184
+ continue;
185
+ }
186
+ s.push(lt(p)), r++;
187
+ }
188
+ if (u < r) return ["", false, 0, false];
189
+ if (!s.length && !i.length) return ["$.", false, n7.length - e, true];
190
+ if (i.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !l) {
191
+ let p = s[0].length === 2 ? s[0].slice(-1) : s[0];
192
+ return [Es(p), false, u - e, false];
193
+ }
194
+ let d = "[" + (l ? "^" : "") + we(s) + "]", f = "[" + (l ? "" : "^") + we(i) + "]";
195
+ return [s.length && i.length ? "(" + d + "|" + f + ")" : s.length ? d : f, h, u - e, true];
196
+ };
197
+ 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");
198
+ var xs = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
199
+ var be = (n7) => xs.has(n7);
200
+ var vs = "(?!(?:^|/)\\.\\.?(?:$|/))";
201
+ var Ct = "(?!\\.)";
202
+ var Cs = /* @__PURE__ */ new Set(["[", "."]);
203
+ var Ts = /* @__PURE__ */ new Set(["..", "."]);
204
+ var As = new Set("().*{}+?[]^$\\!");
205
+ var ks = (n7) => n7.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
206
+ var Kt = "[^/]";
207
+ var Se = Kt + "*?";
208
+ var Ee = Kt + "+?";
209
+ var Q = class n {
210
+ type;
211
+ #t;
212
+ #s;
213
+ #n = false;
214
+ #r = [];
215
+ #o;
216
+ #S;
217
+ #w;
218
+ #c = false;
219
+ #h;
220
+ #u;
221
+ #f = false;
222
+ constructor(t, e, s = {}) {
223
+ 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;
224
+ }
225
+ get hasMagic() {
226
+ if (this.#s !== void 0) return this.#s;
227
+ for (let t of this.#r) if (typeof t != "string" && (t.type || t.hasMagic)) return this.#s = true;
228
+ return this.#s;
229
+ }
230
+ toString() {
231
+ 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("");
232
+ }
233
+ #a() {
234
+ if (this !== this.#t) throw new Error("should only call on root");
235
+ if (this.#c) return this;
236
+ this.toString(), this.#c = true;
237
+ let t;
238
+ for (; t = this.#w.pop(); ) {
239
+ if (t.type !== "!") continue;
240
+ let e = t, s = e.#o;
241
+ for (; s; ) {
242
+ for (let i = e.#S + 1; !s.type && i < s.#r.length; i++) for (let r of t.#r) {
243
+ if (typeof r == "string") throw new Error("string part in extglob AST??");
244
+ r.copyIn(s.#r[i]);
245
+ }
246
+ e = s, s = e.#o;
247
+ }
248
+ }
249
+ return this;
250
+ }
251
+ push(...t) {
252
+ for (let e of t) if (e !== "") {
253
+ if (typeof e != "string" && !(e instanceof n && e.#o === this)) throw new Error("invalid part: " + e);
254
+ this.#r.push(e);
255
+ }
256
+ }
257
+ toJSON() {
258
+ let t = this.type === null ? this.#r.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#r.map((e) => e.toJSON())];
259
+ return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#t || this.#t.#c && this.#o?.type === "!") && t.push({}), t;
260
+ }
261
+ isStart() {
262
+ if (this.#t === this) return true;
263
+ if (!this.#o?.isStart()) return false;
264
+ if (this.#S === 0) return true;
265
+ let t = this.#o;
266
+ for (let e = 0; e < this.#S; e++) {
267
+ let s = t.#r[e];
268
+ if (!(s instanceof n && s.type === "!")) return false;
269
+ }
270
+ return true;
271
+ }
272
+ isEnd() {
273
+ if (this.#t === this || this.#o?.type === "!") return true;
274
+ if (!this.#o?.isEnd()) return false;
275
+ if (!this.type) return this.#o?.isEnd();
276
+ let t = this.#o ? this.#o.#r.length : 0;
277
+ return this.#S === t - 1;
278
+ }
279
+ copyIn(t) {
280
+ typeof t == "string" ? this.push(t) : this.push(t.clone(this));
281
+ }
282
+ clone(t) {
283
+ let e = new n(this.type, t);
284
+ for (let s of this.#r) e.copyIn(s);
285
+ return e;
286
+ }
287
+ static #i(t, e, s, i) {
288
+ let r = false, o = false, h = -1, a = false;
289
+ if (e.type === null) {
290
+ let f = s, m = "";
291
+ for (; f < t.length; ) {
292
+ let p = t.charAt(f++);
293
+ if (r || p === "\\") {
294
+ r = !r, m += p;
295
+ continue;
296
+ }
297
+ if (o) {
298
+ f === h + 1 ? (p === "^" || p === "!") && (a = true) : p === "]" && !(f === h + 2 && a) && (o = false), m += p;
299
+ continue;
300
+ } else if (p === "[") {
301
+ o = true, h = f, a = false, m += p;
302
+ continue;
303
+ }
304
+ if (!i.noext && be(p) && t.charAt(f) === "(") {
305
+ e.push(m), m = "";
306
+ let w = new n(p, e);
307
+ f = n.#i(t, w, f, i), e.push(w);
308
+ continue;
309
+ }
310
+ m += p;
311
+ }
312
+ return e.push(m), f;
313
+ }
314
+ let l = s + 1, u = new n(null, e), c = [], d = "";
315
+ for (; l < t.length; ) {
316
+ let f = t.charAt(l++);
317
+ if (r || f === "\\") {
318
+ r = !r, d += f;
319
+ continue;
320
+ }
321
+ if (o) {
322
+ l === h + 1 ? (f === "^" || f === "!") && (a = true) : f === "]" && !(l === h + 2 && a) && (o = false), d += f;
323
+ continue;
324
+ } else if (f === "[") {
325
+ o = true, h = l, a = false, d += f;
326
+ continue;
327
+ }
328
+ if (be(f) && t.charAt(l) === "(") {
329
+ u.push(d), d = "";
330
+ let m = new n(f, u);
331
+ u.push(m), l = n.#i(t, m, l, i);
332
+ continue;
333
+ }
334
+ if (f === "|") {
335
+ u.push(d), d = "", c.push(u), u = new n(null, e);
336
+ continue;
337
+ }
338
+ if (f === ")") return d === "" && e.#r.length === 0 && (e.#f = true), u.push(d), d = "", e.push(...c, u), l;
339
+ d += f;
340
+ }
341
+ return e.type = null, e.#s = void 0, e.#r = [t.substring(s - 1)], l;
342
+ }
343
+ static fromGlob(t, e = {}) {
344
+ let s = new n(null, void 0, e);
345
+ return n.#i(t, s, 0, e), s;
346
+ }
347
+ toMMPattern() {
348
+ if (this !== this.#t) return this.#t.toMMPattern();
349
+ let t = this.toString(), [e, s, i, r] = this.toRegExpSource();
350
+ if (!(i || this.#s || this.#h.nocase && !this.#h.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase())) return s;
351
+ let h = (this.#h.nocase ? "i" : "") + (r ? "u" : "");
352
+ return Object.assign(new RegExp(`^${e}$`, h), { _src: e, _glob: t });
353
+ }
354
+ get options() {
355
+ return this.#h;
356
+ }
357
+ toRegExpSource(t) {
358
+ let e = t ?? !!this.#h.dot;
359
+ if (this.#t === this && this.#a(), !this.type) {
360
+ let a = this.isStart() && this.isEnd() && !this.#r.some((f) => typeof f != "string"), l = this.#r.map((f) => {
361
+ let [m, p, w, g] = typeof f == "string" ? n.#E(f, this.#s, a) : f.toRegExpSource(t);
362
+ return this.#s = this.#s || w, this.#n = this.#n || g, m;
363
+ }).join(""), u = "";
364
+ if (this.isStart() && typeof this.#r[0] == "string" && !(this.#r.length === 1 && Ts.has(this.#r[0]))) {
365
+ 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));
366
+ u = p ? vs : w ? Ct : "";
367
+ }
368
+ let c = "";
369
+ return this.isEnd() && this.#t.#c && this.#o?.type === "!" && (c = "(?:$|\\/)"), [u + l + c, W(l), this.#s = !!this.#s, this.#n];
370
+ }
371
+ let s = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:", r = this.#d(e);
372
+ if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
373
+ let a = this.toString();
374
+ return this.#r = [a], this.type = null, this.#s = void 0, [a, W(this.toString()), false, false];
375
+ }
376
+ let o = !s || t || e || !Ct ? "" : this.#d(true);
377
+ o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
378
+ let h = "";
379
+ if (this.type === "!" && this.#f) h = (this.isStart() && !e ? Ct : "") + Ee;
380
+ else {
381
+ let a = this.type === "!" ? "))" + (this.isStart() && !e && !t ? Ct : "") + Se + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
382
+ h = i + r + a;
383
+ }
384
+ return [h, W(r), this.#s = !!this.#s, this.#n];
385
+ }
386
+ #d(t) {
387
+ return this.#r.map((e) => {
388
+ if (typeof e == "string") throw new Error("string type in extglob ast??");
389
+ let [s, i, r, o] = e.toRegExpSource(t);
390
+ return this.#n = this.#n || o, s;
391
+ }).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
392
+ }
393
+ static #E(t, e, s = false) {
394
+ let i = false, r = "", o = false, h = false;
395
+ for (let a = 0; a < t.length; a++) {
396
+ let l = t.charAt(a);
397
+ if (i) {
398
+ i = false, r += (As.has(l) ? "\\" : "") + l;
399
+ continue;
400
+ }
401
+ if (l === "*") {
402
+ if (h) continue;
403
+ h = true, r += s && /^[*]+$/.test(t) ? Ee : Se, e = true;
404
+ continue;
405
+ } else h = false;
406
+ if (l === "\\") {
407
+ a === t.length - 1 ? r += "\\\\" : i = true;
408
+ continue;
409
+ }
410
+ if (l === "[") {
411
+ let [u, c, d, f] = ye(t, a);
412
+ if (d) {
413
+ r += u, o = o || c, a += d - 1, e = e || f;
414
+ continue;
415
+ }
416
+ }
417
+ if (l === "?") {
418
+ r += Kt, e = true;
419
+ continue;
420
+ }
421
+ r += ks(l);
422
+ }
423
+ return [r, W(t), !!e, o];
424
+ }
425
+ };
426
+ var tt = (n7, { windowsPathsNoEscape: t = false, magicalBraces: e = false } = {}) => e ? t ? n7.replace(/[?*()[\]{}]/g, "[$&]") : n7.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n7.replace(/[?*()[\]]/g, "[$&]") : n7.replace(/[?*()[\]\\]/g, "\\$&");
427
+ var O = (n7, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? false : new D(t, e).match(n7));
428
+ var Rs = /^\*+([^+@!?\*\[\(]*)$/;
429
+ var Os = (n7) => (t) => !t.startsWith(".") && t.endsWith(n7);
430
+ var Fs = (n7) => (t) => t.endsWith(n7);
431
+ var Ds = (n7) => (n7 = n7.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n7));
432
+ var Ms = (n7) => (n7 = n7.toLowerCase(), (t) => t.toLowerCase().endsWith(n7));
433
+ var Ns = /^\*+\.\*+$/;
434
+ var _s = (n7) => !n7.startsWith(".") && n7.includes(".");
435
+ var Ls = (n7) => n7 !== "." && n7 !== ".." && n7.includes(".");
436
+ var Ws = /^\.\*+$/;
437
+ var Ps = (n7) => n7 !== "." && n7 !== ".." && n7.startsWith(".");
438
+ var js = /^\*+$/;
439
+ var Is = (n7) => n7.length !== 0 && !n7.startsWith(".");
440
+ var zs = (n7) => n7.length !== 0 && n7 !== "." && n7 !== "..";
441
+ var Bs = /^\?+([^+@!?\*\[\(]*)?$/;
442
+ var Us = ([n7, t = ""]) => {
443
+ let e = Ce([n7]);
444
+ return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
445
+ };
446
+ var $s = ([n7, t = ""]) => {
447
+ let e = Te([n7]);
448
+ return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
449
+ };
450
+ var Gs = ([n7, t = ""]) => {
451
+ let e = Te([n7]);
452
+ return t ? (s) => e(s) && s.endsWith(t) : e;
453
+ };
454
+ var Hs = ([n7, t = ""]) => {
455
+ let e = Ce([n7]);
456
+ return t ? (s) => e(s) && s.endsWith(t) : e;
457
+ };
458
+ var Ce = ([n7]) => {
459
+ let t = n7.length;
460
+ return (e) => e.length === t && !e.startsWith(".");
461
+ };
462
+ var Te = ([n7]) => {
463
+ let t = n7.length;
464
+ return (e) => e.length === t && e !== "." && e !== "..";
465
+ };
466
+ var Ae = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
467
+ var xe = { win32: { sep: "\\" }, posix: { sep: "/" } };
468
+ var qs = Ae === "win32" ? xe.win32.sep : xe.posix.sep;
469
+ O.sep = qs;
470
+ var A = /* @__PURE__ */ Symbol("globstar **");
471
+ O.GLOBSTAR = A;
472
+ var Ks = "[^/]";
473
+ var Vs = Ks + "*?";
474
+ var Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
475
+ var Xs = "(?:(?!(?:\\/|^)\\.).)*?";
476
+ var Js = (n7, t = {}) => (e) => O(e, n7, t);
477
+ O.filter = Js;
478
+ var N = (n7, t = {}) => Object.assign({}, n7, t);
479
+ var Zs = (n7) => {
480
+ if (!n7 || typeof n7 != "object" || !Object.keys(n7).length) return O;
481
+ let t = O;
482
+ return Object.assign((s, i, r = {}) => t(s, i, N(n7, r)), { Minimatch: class extends t.Minimatch {
483
+ constructor(i, r = {}) {
484
+ super(i, N(n7, r));
485
+ }
486
+ static defaults(i) {
487
+ return t.defaults(N(n7, i)).Minimatch;
488
+ }
489
+ }, AST: class extends t.AST {
490
+ constructor(i, r, o = {}) {
491
+ super(i, r, N(n7, o));
492
+ }
493
+ static fromGlob(i, r = {}) {
494
+ return t.AST.fromGlob(i, N(n7, r));
495
+ }
496
+ }, 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 });
497
+ };
498
+ O.defaults = Zs;
499
+ var ke = (n7, t = {}) => (at(n7), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n7) ? [n7] : ge(n7, { max: t.braceExpandMax }));
500
+ O.braceExpand = ke;
501
+ var Qs = (n7, t = {}) => new D(n7, t).makeRe();
502
+ O.makeRe = Qs;
503
+ var ti = (n7, t, e = {}) => {
504
+ let s = new D(t, e);
505
+ return n7 = n7.filter((i) => s.match(i)), s.options.nonull && !n7.length && n7.push(t), n7;
506
+ };
507
+ O.match = ti;
508
+ var ve = /[?*]|[+@!]\(.*?\)|\[|\]/;
509
+ var ei = (n7) => n7.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
510
+ var D = class {
511
+ options;
512
+ set;
513
+ pattern;
514
+ windowsPathsNoEscape;
515
+ nonegate;
516
+ negate;
517
+ comment;
518
+ empty;
519
+ preserveMultipleSlashes;
520
+ partial;
521
+ globSet;
522
+ globParts;
523
+ nocase;
524
+ isWindows;
525
+ platform;
526
+ windowsNoMagicRoot;
527
+ regexp;
528
+ constructor(t, e = {}) {
529
+ at(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ae, this.isWindows = this.platform === "win32";
530
+ let s = "allowWindowsEscape";
531
+ 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();
532
+ }
533
+ hasMagic() {
534
+ if (this.options.magicalBraces && this.set.length > 1) return true;
535
+ for (let t of this.set) for (let e of t) if (typeof e != "string") return true;
536
+ return false;
537
+ }
538
+ debug(...t) {
539
+ }
540
+ make() {
541
+ let t = this.pattern, e = this.options;
542
+ if (!e.nocomment && t.charAt(0) === "#") {
543
+ this.comment = true;
544
+ return;
545
+ }
546
+ if (!t) {
547
+ this.empty = true;
548
+ return;
549
+ }
550
+ this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(this.pattern, this.globSet);
551
+ let s = this.globSet.map((r) => this.slashSplit(r));
552
+ this.globParts = this.preprocess(s), this.debug(this.pattern, this.globParts);
553
+ let i = this.globParts.map((r, o, h) => {
554
+ if (this.isWindows && this.windowsNoMagicRoot) {
555
+ let a = r[0] === "" && r[1] === "" && (r[2] === "?" || !ve.test(r[2])) && !ve.test(r[3]), l = /^[a-z]:/i.test(r[0]);
556
+ if (a) return [...r.slice(0, 4), ...r.slice(4).map((u) => this.parse(u))];
557
+ if (l) return [r[0], ...r.slice(1).map((u) => this.parse(u))];
558
+ }
559
+ return r.map((a) => this.parse(a));
560
+ });
561
+ 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++) {
562
+ let o = this.set[r];
563
+ o[0] === "" && o[1] === "" && this.globParts[r][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
564
+ }
565
+ this.debug(this.pattern, this.set);
566
+ }
567
+ preprocess(t) {
568
+ 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] = "*");
569
+ let { optimizationLevel: e = 1 } = this.options;
570
+ return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t;
571
+ }
572
+ adjascentGlobstarOptimize(t) {
573
+ return t.map((e) => {
574
+ let s = -1;
575
+ for (; (s = e.indexOf("**", s + 1)) !== -1; ) {
576
+ let i = s;
577
+ for (; e[i + 1] === "**"; ) i++;
578
+ i !== s && e.splice(s, i - s);
579
+ }
580
+ return e;
581
+ });
582
+ }
583
+ levelOneOptimize(t) {
584
+ return t.map((e) => (e = e.reduce((s, i) => {
585
+ let r = s[s.length - 1];
586
+ return i === "**" && r === "**" ? s : i === ".." && r && r !== ".." && r !== "." && r !== "**" ? (s.pop(), s) : (s.push(i), s);
587
+ }, []), e.length === 0 ? [""] : e));
588
+ }
589
+ levelTwoFileOptimize(t) {
590
+ Array.isArray(t) || (t = this.slashSplit(t));
591
+ let e = false;
592
+ do {
593
+ if (e = false, !this.preserveMultipleSlashes) {
594
+ for (let i = 1; i < t.length - 1; i++) {
595
+ let r = t[i];
596
+ i === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = true, t.splice(i, 1), i--);
597
+ }
598
+ t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = true, t.pop());
599
+ }
600
+ let s = 0;
601
+ for (; (s = t.indexOf("..", s + 1)) !== -1; ) {
602
+ let i = t[s - 1];
603
+ i && i !== "." && i !== ".." && i !== "**" && (e = true, t.splice(s - 1, 2), s -= 2);
604
+ }
605
+ } while (e);
606
+ return t.length === 0 ? [""] : t;
607
+ }
608
+ firstPhasePreProcess(t) {
609
+ let e = false;
610
+ do {
611
+ e = false;
612
+ for (let s of t) {
613
+ let i = -1;
614
+ for (; (i = s.indexOf("**", i + 1)) !== -1; ) {
615
+ let o = i;
616
+ for (; s[o + 1] === "**"; ) o++;
617
+ o > i && s.splice(i + 1, o - i);
618
+ let h = s[i + 1], a = s[i + 2], l = s[i + 3];
619
+ if (h !== ".." || !a || a === "." || a === ".." || !l || l === "." || l === "..") continue;
620
+ e = true, s.splice(i, 1);
621
+ let u = s.slice(0);
622
+ u[i] = "**", t.push(u), i--;
623
+ }
624
+ if (!this.preserveMultipleSlashes) {
625
+ for (let o = 1; o < s.length - 1; o++) {
626
+ let h = s[o];
627
+ o === 1 && h === "" && s[0] === "" || (h === "." || h === "") && (e = true, s.splice(o, 1), o--);
628
+ }
629
+ s[0] === "." && s.length === 2 && (s[1] === "." || s[1] === "") && (e = true, s.pop());
630
+ }
631
+ let r = 0;
632
+ for (; (r = s.indexOf("..", r + 1)) !== -1; ) {
633
+ let o = s[r - 1];
634
+ if (o && o !== "." && o !== ".." && o !== "**") {
635
+ e = true;
636
+ let a = r === 1 && s[r + 1] === "**" ? ["."] : [];
637
+ s.splice(r - 1, 2, ...a), s.length === 0 && s.push(""), r -= 2;
638
+ }
639
+ }
640
+ }
641
+ } while (e);
642
+ return t;
643
+ }
644
+ secondPhasePreProcess(t) {
645
+ for (let e = 0; e < t.length - 1; e++) for (let s = e + 1; s < t.length; s++) {
646
+ let i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
647
+ if (i) {
648
+ t[e] = [], t[s] = i;
649
+ break;
650
+ }
651
+ }
652
+ return t.filter((e) => e.length);
653
+ }
654
+ partsMatch(t, e, s = false) {
655
+ let i = 0, r = 0, o = [], h = "";
656
+ for (; i < t.length && r < e.length; ) if (t[i] === e[r]) o.push(h === "b" ? e[r] : t[i]), i++, r++;
657
+ else if (s && t[i] === "**" && e[r] === t[i + 1]) o.push(t[i]), i++;
658
+ else if (s && e[r] === "**" && t[i] === e[r + 1]) o.push(e[r]), r++;
659
+ else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
660
+ if (h === "b") return false;
661
+ h = "a", o.push(t[i]), i++, r++;
662
+ } else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
663
+ if (h === "a") return false;
664
+ h = "b", o.push(e[r]), i++, r++;
665
+ } else return false;
666
+ return t.length === e.length && o;
667
+ }
668
+ parseNegate() {
669
+ if (this.nonegate) return;
670
+ let t = this.pattern, e = false, s = 0;
671
+ for (let i = 0; i < t.length && t.charAt(i) === "!"; i++) e = !e, s++;
672
+ s && (this.pattern = t.slice(s)), this.negate = e;
673
+ }
674
+ matchOne(t, e, s = false) {
675
+ let i = this.options;
676
+ if (this.isWindows) {
677
+ 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;
678
+ if (typeof E == "number" && typeof y == "number") {
679
+ let [b, z] = [t[E], e[y]];
680
+ b.toLowerCase() === z.toLowerCase() && (e[y] = b, y > E ? e = e.slice(y) : E > y && (t = t.slice(E)));
681
+ }
682
+ }
683
+ let { optimizationLevel: r = 1 } = this.options;
684
+ r >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, { file: t, pattern: e }), this.debug("matchOne", t.length, e.length);
685
+ for (var o = 0, h = 0, a = t.length, l = e.length; o < a && h < l; o++, h++) {
686
+ this.debug("matchOne loop");
687
+ var u = e[h], c = t[o];
688
+ if (this.debug(e, u, c), u === false) return false;
689
+ if (u === A) {
690
+ this.debug("GLOBSTAR", [e, u, c]);
691
+ var d = o, f = h + 1;
692
+ if (f === l) {
693
+ for (this.debug("** at the end"); o < a; o++) if (t[o] === "." || t[o] === ".." || !i.dot && t[o].charAt(0) === ".") return false;
694
+ return true;
695
+ }
696
+ for (; d < a; ) {
697
+ var m = t[d];
698
+ if (this.debug(`
699
+ 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;
700
+ if (m === "." || m === ".." || !i.dot && m.charAt(0) === ".") {
701
+ this.debug("dot detected!", t, d, e, f);
702
+ break;
703
+ }
704
+ this.debug("globstar swallow a segment, and continue"), d++;
705
+ }
706
+ return !!(s && (this.debug(`
707
+ >>> no match, partial?`, t, d, e, f), d === a));
708
+ }
709
+ let p;
710
+ 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;
711
+ }
712
+ if (o === a && h === l) return true;
713
+ if (o === a) return s;
714
+ if (h === l) return o === a - 1 && t[o] === "";
715
+ throw new Error("wtf?");
716
+ }
717
+ braceExpand() {
718
+ return ke(this.pattern, this.options);
719
+ }
720
+ parse(t) {
721
+ at(t);
722
+ let e = this.options;
723
+ if (t === "**") return A;
724
+ if (t === "") return "";
725
+ let s, i = null;
726
+ (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);
727
+ let r = Q.fromGlob(t, this.options).toMMPattern();
728
+ return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
729
+ }
730
+ makeRe() {
731
+ if (this.regexp || this.regexp === false) return this.regexp;
732
+ let t = this.set;
733
+ if (!t.length) return this.regexp = false, this.regexp;
734
+ let e = this.options, s = e.noglobstar ? Vs : e.dot ? Ys : Xs, i = new Set(e.nocase ? ["i"] : []), r = t.map((a) => {
735
+ let l = a.map((c) => {
736
+ if (c instanceof RegExp) for (let d of c.flags.split("")) i.add(d);
737
+ return typeof c == "string" ? ei(c) : c === A ? A : c._src;
738
+ });
739
+ l.forEach((c, d) => {
740
+ let f = l[d + 1], m = l[d - 1];
741
+ 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));
742
+ });
743
+ let u = l.filter((c) => c !== A);
744
+ if (this.partial && u.length >= 1) {
745
+ let c = [];
746
+ for (let d = 1; d <= u.length; d++) c.push(u.slice(0, d).join("/"));
747
+ return "(?:" + c.join("|") + ")";
748
+ }
749
+ return u.join("/");
750
+ }).join("|"), [o, h] = t.length > 1 ? ["(?:", ")"] : ["", ""];
751
+ r = "^" + o + r + h + "$", this.partial && (r = "^(?:\\/|" + o + r.slice(1, -1) + h + ")$"), this.negate && (r = "^(?!" + r + ").+$");
752
+ try {
753
+ this.regexp = new RegExp(r, [...i].join(""));
754
+ } catch {
755
+ this.regexp = false;
756
+ }
757
+ return this.regexp;
758
+ }
759
+ slashSplit(t) {
760
+ return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^\/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/);
761
+ }
762
+ match(t, e = this.partial) {
763
+ if (this.debug("match", t, this.pattern), this.comment) return false;
764
+ if (this.empty) return t === "";
765
+ if (t === "/" && e) return true;
766
+ let s = this.options;
767
+ this.isWindows && (t = t.split("\\").join("/"));
768
+ let i = this.slashSplit(t);
769
+ this.debug(this.pattern, "split", i);
770
+ let r = this.set;
771
+ this.debug(this.pattern, "set", r);
772
+ let o = i[i.length - 1];
773
+ if (!o) for (let h = i.length - 2; !o && h >= 0; h--) o = i[h];
774
+ for (let h = 0; h < r.length; h++) {
775
+ let a = r[h], l = i;
776
+ if (s.matchBase && a.length === 1 && (l = [o]), this.matchOne(l, a, e)) return s.flipNegate ? true : !this.negate;
777
+ }
778
+ return s.flipNegate ? false : this.negate;
779
+ }
780
+ static defaults(t) {
781
+ return O.defaults(t).Minimatch;
782
+ }
783
+ };
784
+ O.AST = Q;
785
+ O.Minimatch = D;
786
+ O.escape = tt;
787
+ O.unescape = W;
788
+ var si = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
789
+ var Oe = /* @__PURE__ */ new Set();
790
+ var Vt = typeof process == "object" && process ? process : {};
791
+ var Fe = (n7, t, e, s) => {
792
+ typeof Vt.emitWarning == "function" ? Vt.emitWarning(n7, t, e, s) : console.error(`[${e}] ${t}: ${n7}`);
793
+ };
794
+ var At = globalThis.AbortController;
795
+ var Re = globalThis.AbortSignal;
796
+ if (typeof At > "u") {
797
+ Re = class {
798
+ onabort;
799
+ _onabort = [];
800
+ reason;
801
+ aborted = false;
802
+ addEventListener(e, s) {
803
+ this._onabort.push(s);
804
+ }
805
+ }, At = class {
806
+ constructor() {
807
+ t();
808
+ }
809
+ signal = new Re();
810
+ abort(e) {
811
+ if (!this.signal.aborted) {
812
+ this.signal.reason = e, this.signal.aborted = true;
813
+ for (let s of this.signal._onabort) s(e);
814
+ this.signal.onabort?.(e);
815
+ }
816
+ }
817
+ };
818
+ let n7 = Vt.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
819
+ 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));
820
+ };
821
+ }
822
+ var ii = (n7) => !Oe.has(n7);
823
+ var q = (n7) => n7 && n7 === Math.floor(n7) && n7 > 0 && isFinite(n7);
824
+ 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;
825
+ var Tt = class extends Array {
826
+ constructor(n7) {
827
+ super(n7), this.fill(0);
828
+ }
829
+ };
830
+ var ri = class ct {
831
+ heap;
832
+ length;
833
+ static #t = false;
834
+ static create(t) {
835
+ let e = De(t);
836
+ if (!e) return [];
837
+ ct.#t = true;
838
+ let s = new ct(t, e);
839
+ return ct.#t = false, s;
840
+ }
841
+ constructor(t, e) {
842
+ if (!ct.#t) throw new TypeError("instantiate Stack using Stack.create(n)");
843
+ this.heap = new e(t), this.length = 0;
844
+ }
845
+ push(t) {
846
+ this.heap[this.length++] = t;
847
+ }
848
+ pop() {
849
+ return this.heap[--this.length];
850
+ }
851
+ };
852
+ var ft = class Me {
853
+ #t;
854
+ #s;
855
+ #n;
856
+ #r;
857
+ #o;
858
+ #S;
859
+ #w;
860
+ #c;
861
+ get perf() {
862
+ return this.#c;
863
+ }
864
+ ttl;
865
+ ttlResolution;
866
+ ttlAutopurge;
867
+ updateAgeOnGet;
868
+ updateAgeOnHas;
869
+ allowStale;
870
+ noDisposeOnSet;
871
+ noUpdateTTL;
872
+ maxEntrySize;
873
+ sizeCalculation;
874
+ noDeleteOnFetchRejection;
875
+ noDeleteOnStaleGet;
876
+ allowStaleOnFetchAbort;
877
+ allowStaleOnFetchRejection;
878
+ ignoreFetchAbort;
879
+ #h;
880
+ #u;
881
+ #f;
882
+ #a;
883
+ #i;
884
+ #d;
885
+ #E;
886
+ #b;
887
+ #p;
888
+ #R;
889
+ #m;
890
+ #C;
891
+ #T;
892
+ #g;
893
+ #y;
894
+ #x;
895
+ #A;
896
+ #e;
897
+ #_;
898
+ static unsafeExposeInternals(t) {
899
+ 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() {
900
+ return t.#b;
901
+ }, get tail() {
902
+ return t.#p;
903
+ }, 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) };
904
+ }
905
+ get max() {
906
+ return this.#t;
907
+ }
908
+ get maxSize() {
909
+ return this.#s;
910
+ }
911
+ get calculatedSize() {
912
+ return this.#u;
913
+ }
914
+ get size() {
915
+ return this.#h;
916
+ }
917
+ get fetchMethod() {
918
+ return this.#S;
919
+ }
920
+ get memoMethod() {
921
+ return this.#w;
922
+ }
923
+ get dispose() {
924
+ return this.#n;
925
+ }
926
+ get onInsert() {
927
+ return this.#r;
928
+ }
929
+ get disposeAfter() {
930
+ return this.#o;
931
+ }
932
+ constructor(t) {
933
+ 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;
934
+ if (J !== void 0 && typeof J?.now != "function") throw new TypeError("perf option must have a now() method if specified");
935
+ if (this.#c = J ?? si, e !== 0 && !q(e)) throw new TypeError("max option must be a nonnegative integer");
936
+ let Z = e ? De(e) : Array;
937
+ if (!Z) throw new Error("invalid max value: " + e);
938
+ if (this.#t = e, this.#s = m, this.maxEntrySize = p || this.#s, this.sizeCalculation = w, this.sizeCalculation) {
939
+ if (!this.#s && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
940
+ if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
941
+ }
942
+ if (S !== void 0 && typeof S != "function") throw new TypeError("memoMethod must be a function if defined");
943
+ if (this.#w = S, g !== void 0 && typeof g != "function") throw new TypeError("fetchMethod must be a function if specified");
944
+ 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) {
945
+ if (this.#s !== 0 && !q(this.#s)) throw new TypeError("maxSize must be a positive integer if specified");
946
+ if (!q(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
947
+ this.#G();
948
+ }
949
+ 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) {
950
+ if (!q(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
951
+ this.#M();
952
+ }
953
+ if (this.#t === 0 && this.ttl === 0 && this.#s === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
954
+ if (!this.ttlAutopurge && !this.#t && !this.#s) {
955
+ let $t = "LRU_CACHE_UNBOUNDED";
956
+ ii($t) && (Oe.add($t), Fe("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", $t, Me));
957
+ }
958
+ }
959
+ getRemainingTTL(t) {
960
+ return this.#f.has(t) ? 1 / 0 : 0;
961
+ }
962
+ #M() {
963
+ let t = new Tt(this.#t), e = new Tt(this.#t);
964
+ this.#g = t, this.#T = e;
965
+ let s = this.ttlAutopurge ? new Array(this.#t) : void 0;
966
+ this.#y = s, this.#j = (o, h, a = this.#c.now()) => {
967
+ if (e[o] = h !== 0 ? a : 0, t[o] = h, s?.[o] && (clearTimeout(s[o]), s[o] = void 0), h !== 0 && s) {
968
+ let l = setTimeout(() => {
969
+ this.#v(o) && this.#O(this.#a[o], "expire");
970
+ }, h + 1);
971
+ l.unref && l.unref(), s[o] = l;
972
+ }
973
+ }, this.#k = (o) => {
974
+ e[o] = t[o] !== 0 ? this.#c.now() : 0;
975
+ }, this.#N = (o, h) => {
976
+ if (t[h]) {
977
+ let a = t[h], l = e[h];
978
+ if (!a || !l) return;
979
+ o.ttl = a, o.start = l, o.now = i || r();
980
+ let u = o.now - l;
981
+ o.remainingTTL = a - u;
982
+ }
983
+ };
984
+ let i = 0, r = () => {
985
+ let o = this.#c.now();
986
+ if (this.ttlResolution > 0) {
987
+ i = o;
988
+ let h = setTimeout(() => i = 0, this.ttlResolution);
989
+ h.unref && h.unref();
990
+ }
991
+ return o;
992
+ };
993
+ this.getRemainingTTL = (o) => {
994
+ let h = this.#f.get(o);
995
+ if (h === void 0) return 0;
996
+ let a = t[h], l = e[h];
997
+ if (!a || !l) return 1 / 0;
998
+ let u = (i || r()) - l;
999
+ return a - u;
1000
+ }, this.#v = (o) => {
1001
+ let h = e[o], a = t[o];
1002
+ return !!a && !!h && (i || r()) - h > a;
1003
+ };
1004
+ }
1005
+ #k = () => {
1006
+ };
1007
+ #N = () => {
1008
+ };
1009
+ #j = () => {
1010
+ };
1011
+ #v = () => false;
1012
+ #G() {
1013
+ let t = new Tt(this.#t);
1014
+ this.#u = 0, this.#C = t, this.#P = (e) => {
1015
+ this.#u -= t[e], t[e] = 0;
1016
+ }, this.#I = (e, s, i, r) => {
1017
+ if (this.#l(s)) return 0;
1018
+ if (!q(i)) if (r) {
1019
+ if (typeof r != "function") throw new TypeError("sizeCalculation must be a function");
1020
+ if (i = r(s, e), !q(i)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
1021
+ } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
1022
+ return i;
1023
+ }, this.#L = (e, s, i) => {
1024
+ if (t[e] = s, this.#s) {
1025
+ let r = this.#s - t[e];
1026
+ for (; this.#u > r; ) this.#B(true);
1027
+ }
1028
+ this.#u += t[e], i && (i.entrySize = s, i.totalCalculatedSize = this.#u);
1029
+ };
1030
+ }
1031
+ #P = (t) => {
1032
+ };
1033
+ #L = (t, e, s) => {
1034
+ };
1035
+ #I = (t, e, s, i) => {
1036
+ if (s || i) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
1037
+ return 0;
1038
+ };
1039
+ *#F({ allowStale: t = this.allowStale } = {}) {
1040
+ if (this.#h) for (let e = this.#p; !(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#b)); ) e = this.#E[e];
1041
+ }
1042
+ *#D({ allowStale: t = this.allowStale } = {}) {
1043
+ if (this.#h) for (let e = this.#b; !(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#p)); ) e = this.#d[e];
1044
+ }
1045
+ #z(t) {
1046
+ return t !== void 0 && this.#f.get(this.#a[t]) === t;
1047
+ }
1048
+ *entries() {
1049
+ 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]]);
1050
+ }
1051
+ *rentries() {
1052
+ 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]]);
1053
+ }
1054
+ *keys() {
1055
+ for (let t of this.#F()) {
1056
+ let e = this.#a[t];
1057
+ e !== void 0 && !this.#l(this.#i[t]) && (yield e);
1058
+ }
1059
+ }
1060
+ *rkeys() {
1061
+ for (let t of this.#D()) {
1062
+ let e = this.#a[t];
1063
+ e !== void 0 && !this.#l(this.#i[t]) && (yield e);
1064
+ }
1065
+ }
1066
+ *values() {
1067
+ for (let t of this.#F()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]);
1068
+ }
1069
+ *rvalues() {
1070
+ for (let t of this.#D()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]);
1071
+ }
1072
+ [Symbol.iterator]() {
1073
+ return this.entries();
1074
+ }
1075
+ [Symbol.toStringTag] = "LRUCache";
1076
+ find(t, e = {}) {
1077
+ for (let s of this.#F()) {
1078
+ let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
1079
+ if (r !== void 0 && t(r, this.#a[s], this)) return this.get(this.#a[s], e);
1080
+ }
1081
+ }
1082
+ forEach(t, e = this) {
1083
+ for (let s of this.#F()) {
1084
+ let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
1085
+ r !== void 0 && t.call(e, r, this.#a[s], this);
1086
+ }
1087
+ }
1088
+ rforEach(t, e = this) {
1089
+ for (let s of this.#D()) {
1090
+ let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
1091
+ r !== void 0 && t.call(e, r, this.#a[s], this);
1092
+ }
1093
+ }
1094
+ purgeStale() {
1095
+ let t = false;
1096
+ for (let e of this.#D({ allowStale: true })) this.#v(e) && (this.#O(this.#a[e], "expire"), t = true);
1097
+ return t;
1098
+ }
1099
+ info(t) {
1100
+ let e = this.#f.get(t);
1101
+ if (e === void 0) return;
1102
+ let s = this.#i[e], i = this.#l(s) ? s.__staleWhileFetching : s;
1103
+ if (i === void 0) return;
1104
+ let r = { value: i };
1105
+ if (this.#g && this.#T) {
1106
+ let o = this.#g[e], h = this.#T[e];
1107
+ if (o && h) {
1108
+ let a = o - (this.#c.now() - h);
1109
+ r.ttl = a, r.start = Date.now();
1110
+ }
1111
+ }
1112
+ return this.#C && (r.size = this.#C[e]), r;
1113
+ }
1114
+ dump() {
1115
+ let t = [];
1116
+ for (let e of this.#F({ allowStale: true })) {
1117
+ let s = this.#a[e], i = this.#i[e], r = this.#l(i) ? i.__staleWhileFetching : i;
1118
+ if (r === void 0 || s === void 0) continue;
1119
+ let o = { value: r };
1120
+ if (this.#g && this.#T) {
1121
+ o.ttl = this.#g[e];
1122
+ let h = this.#c.now() - this.#T[e];
1123
+ o.start = Math.floor(Date.now() - h);
1124
+ }
1125
+ this.#C && (o.size = this.#C[e]), t.unshift([s, o]);
1126
+ }
1127
+ return t;
1128
+ }
1129
+ load(t) {
1130
+ this.clear();
1131
+ for (let [e, s] of t) {
1132
+ if (s.start) {
1133
+ let i = Date.now() - s.start;
1134
+ s.start = this.#c.now() - i;
1135
+ }
1136
+ this.set(e, s.value, s);
1137
+ }
1138
+ }
1139
+ set(t, e, s = {}) {
1140
+ if (e === void 0) return this.delete(t), this;
1141
+ 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);
1142
+ if (this.maxEntrySize && u > this.maxEntrySize) return a && (a.set = "miss", a.maxEntrySizeExceeded = true), this.#O(t, "set"), this;
1143
+ let c = this.#h === 0 ? void 0 : this.#f.get(t);
1144
+ 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");
1145
+ else {
1146
+ this.#W(c);
1147
+ let d = this.#i[c];
1148
+ if (e !== d) {
1149
+ if (this.#A && this.#l(d)) {
1150
+ d.__abortController.abort(new Error("replaced"));
1151
+ let { __staleWhileFetching: f } = d;
1152
+ f !== void 0 && !o && (this.#x && this.#n?.(f, t, "set"), this.#e && this.#m?.push([f, t, "set"]));
1153
+ } else o || (this.#x && this.#n?.(d, t, "set"), this.#e && this.#m?.push([d, t, "set"]));
1154
+ if (this.#P(c), this.#L(c, u, a), this.#i[c] = e, a) {
1155
+ a.set = "replace";
1156
+ let f = d && this.#l(d) ? d.__staleWhileFetching : d;
1157
+ f !== void 0 && (a.oldValue = f);
1158
+ }
1159
+ } else a && (a.set = "update");
1160
+ this.#_ && this.onInsert?.(e, t, e === d ? "update" : "replace");
1161
+ }
1162
+ 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) {
1163
+ let d = this.#m, f;
1164
+ for (; f = d?.shift(); ) this.#o?.(...f);
1165
+ }
1166
+ return this;
1167
+ }
1168
+ pop() {
1169
+ try {
1170
+ for (; this.#h; ) {
1171
+ let t = this.#i[this.#b];
1172
+ if (this.#B(true), this.#l(t)) {
1173
+ if (t.__staleWhileFetching) return t.__staleWhileFetching;
1174
+ } else if (t !== void 0) return t;
1175
+ }
1176
+ } finally {
1177
+ if (this.#e && this.#m) {
1178
+ let t = this.#m, e;
1179
+ for (; e = t?.shift(); ) this.#o?.(...e);
1180
+ }
1181
+ }
1182
+ }
1183
+ #B(t) {
1184
+ let e = this.#b, s = this.#a[e], i = this.#i[e];
1185
+ 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;
1186
+ }
1187
+ has(t, e = {}) {
1188
+ let { updateAgeOnHas: s = this.updateAgeOnHas, status: i } = e, r = this.#f.get(t);
1189
+ if (r !== void 0) {
1190
+ let o = this.#i[r];
1191
+ if (this.#l(o) && o.__staleWhileFetching === void 0) return false;
1192
+ if (this.#v(r)) i && (i.has = "stale", this.#N(i, r));
1193
+ else return s && this.#k(r), i && (i.has = "hit", this.#N(i, r)), true;
1194
+ } else i && (i.has = "miss");
1195
+ return false;
1196
+ }
1197
+ peek(t, e = {}) {
1198
+ let { allowStale: s = this.allowStale } = e, i = this.#f.get(t);
1199
+ if (i === void 0 || !s && this.#v(i)) return;
1200
+ let r = this.#i[i];
1201
+ return this.#l(r) ? r.__staleWhileFetching : r;
1202
+ }
1203
+ #U(t, e, s, i) {
1204
+ let r = e === void 0 ? void 0 : this.#i[e];
1205
+ if (this.#l(r)) return r;
1206
+ let o = new At(), { signal: h } = s;
1207
+ h?.addEventListener("abort", () => o.abort(h.reason), { signal: o.signal });
1208
+ let a = { signal: o.signal, options: s, context: i }, l = (p, w = false) => {
1209
+ let { aborted: g } = o.signal, S = s.ignoreFetchAbort && p !== void 0, E = s.ignoreFetchAbort || !!(s.allowStaleOnFetchAbort && p !== void 0);
1210
+ 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);
1211
+ let y = f, b = this.#i[e];
1212
+ 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;
1213
+ }, u = (p) => (s.status && (s.status.fetchRejected = true, s.status.fetchError = p), c(p, false)), c = (p, w) => {
1214
+ let { aborted: g } = o.signal, S = g && s.allowStaleOnFetchAbort, E = S || s.allowStaleOnFetchRejection, y = E || s.noDeleteOnFetchRejection, b = f;
1215
+ 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;
1216
+ if (b.__returned === b) throw p;
1217
+ }, d = (p, w) => {
1218
+ let g = this.#S?.(t, r, a);
1219
+ g && g instanceof Promise && g.then((S) => p(S === void 0 ? void 0 : S), w), o.signal.addEventListener("abort", () => {
1220
+ (!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (p(void 0), s.allowStaleOnFetchAbort && (p = (S) => l(S, true)));
1221
+ });
1222
+ };
1223
+ s.status && (s.status.fetchDispatched = true);
1224
+ let f = new Promise(d).then(l, u), m = Object.assign(f, { __abortController: o, __staleWhileFetching: r, __returned: void 0 });
1225
+ return e === void 0 ? (this.set(t, m, { ...a.options, status: void 0 }), e = this.#f.get(t)) : this.#i[e] = m, m;
1226
+ }
1227
+ #l(t) {
1228
+ if (!this.#A) return false;
1229
+ let e = t;
1230
+ return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof At;
1231
+ }
1232
+ async fetch(t, e = {}) {
1233
+ 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;
1234
+ if (!this.#A) return g && (g.fetch = "get"), this.get(t, { allowStale: s, updateAgeOnGet: i, noDeleteOnStaleGet: r, status: g });
1235
+ 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);
1236
+ if (y === void 0) {
1237
+ g && (g.fetch = "miss");
1238
+ let b = this.#U(t, y, E, p);
1239
+ return b.__returned = b;
1240
+ } else {
1241
+ let b = this.#i[y];
1242
+ if (this.#l(b)) {
1243
+ let Z = s && b.__staleWhileFetching !== void 0;
1244
+ return g && (g.fetch = "inflight", Z && (g.returnedStale = true)), Z ? b.__staleWhileFetching : b.__returned = b;
1245
+ }
1246
+ let z = this.#v(y);
1247
+ if (!w && !z) return g && (g.fetch = "hit"), this.#W(y), i && this.#k(y), g && this.#N(g, y), b;
1248
+ let $ = this.#U(t, y, E, p), J = $.__staleWhileFetching !== void 0 && s;
1249
+ return g && (g.fetch = z ? "stale" : "refresh", J && z && (g.returnedStale = true)), J ? $.__staleWhileFetching : $.__returned = $;
1250
+ }
1251
+ }
1252
+ async forceFetch(t, e = {}) {
1253
+ let s = await this.fetch(t, e);
1254
+ if (s === void 0) throw new Error("fetch() returned undefined");
1255
+ return s;
1256
+ }
1257
+ memo(t, e = {}) {
1258
+ let s = this.#w;
1259
+ if (!s) throw new Error("no memoMethod provided to constructor");
1260
+ let { context: i, forceRefresh: r, ...o } = e, h = this.get(t, o);
1261
+ if (!r && h !== void 0) return h;
1262
+ let a = s(t, h, { options: o, context: i });
1263
+ return this.set(t, a, o), a;
1264
+ }
1265
+ get(t, e = {}) {
1266
+ let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, status: o } = e, h = this.#f.get(t);
1267
+ if (h !== void 0) {
1268
+ let a = this.#i[h], l = this.#l(a);
1269
+ 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));
1270
+ } else o && (o.get = "miss");
1271
+ }
1272
+ #$(t, e) {
1273
+ this.#E[e] = t, this.#d[t] = e;
1274
+ }
1275
+ #W(t) {
1276
+ 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);
1277
+ }
1278
+ delete(t) {
1279
+ return this.#O(t, "delete");
1280
+ }
1281
+ #O(t, e) {
1282
+ let s = false;
1283
+ if (this.#h !== 0) {
1284
+ let i = this.#f.get(t);
1285
+ 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);
1286
+ else {
1287
+ this.#P(i);
1288
+ let r = this.#i[i];
1289
+ 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];
1290
+ else if (i === this.#b) this.#b = this.#d[i];
1291
+ else {
1292
+ let o = this.#E[i];
1293
+ this.#d[o] = this.#d[i];
1294
+ let h = this.#d[i];
1295
+ this.#E[h] = this.#E[i];
1296
+ }
1297
+ this.#h--, this.#R.push(i);
1298
+ }
1299
+ }
1300
+ if (this.#e && this.#m?.length) {
1301
+ let i = this.#m, r;
1302
+ for (; r = i?.shift(); ) this.#o?.(...r);
1303
+ }
1304
+ return s;
1305
+ }
1306
+ clear() {
1307
+ return this.#H("delete");
1308
+ }
1309
+ #H(t) {
1310
+ for (let e of this.#D({ allowStale: true })) {
1311
+ let s = this.#i[e];
1312
+ if (this.#l(s)) s.__abortController.abort(new Error("deleted"));
1313
+ else {
1314
+ let i = this.#a[e];
1315
+ this.#x && this.#n?.(s, i, t), this.#e && this.#m?.push([s, i, t]);
1316
+ }
1317
+ }
1318
+ if (this.#f.clear(), this.#i.fill(void 0), this.#a.fill(void 0), this.#g && this.#T) {
1319
+ this.#g.fill(0), this.#T.fill(0);
1320
+ for (let e of this.#y ?? []) e !== void 0 && clearTimeout(e);
1321
+ this.#y?.fill(void 0);
1322
+ }
1323
+ 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) {
1324
+ let e = this.#m, s;
1325
+ for (; s = e?.shift(); ) this.#o?.(...s);
1326
+ }
1327
+ }
1328
+ };
1329
+ var Ne = typeof process == "object" && process ? process : { stdout: null, stderr: null };
1330
+ var oi = (n7) => !!n7 && typeof n7 == "object" && (n7 instanceof V || n7 instanceof Pe || hi(n7) || ai(n7));
1331
+ var hi = (n7) => !!n7 && typeof n7 == "object" && n7 instanceof ee && typeof n7.pipe == "function" && n7.pipe !== Pe.Writable.prototype.pipe;
1332
+ var ai = (n7) => !!n7 && typeof n7 == "object" && n7 instanceof ee && typeof n7.write == "function" && typeof n7.end == "function";
1333
+ var G = /* @__PURE__ */ Symbol("EOF");
1334
+ var H = /* @__PURE__ */ Symbol("maybeEmitEnd");
1335
+ var K = /* @__PURE__ */ Symbol("emittedEnd");
1336
+ var kt = /* @__PURE__ */ Symbol("emittingEnd");
1337
+ var ut = /* @__PURE__ */ Symbol("emittedError");
1338
+ var Rt = /* @__PURE__ */ Symbol("closed");
1339
+ var _e = /* @__PURE__ */ Symbol("read");
1340
+ var Ot = /* @__PURE__ */ Symbol("flush");
1341
+ var Le = /* @__PURE__ */ Symbol("flushChunk");
1342
+ var P = /* @__PURE__ */ Symbol("encoding");
1343
+ var et = /* @__PURE__ */ Symbol("decoder");
1344
+ var v = /* @__PURE__ */ Symbol("flowing");
1345
+ var dt = /* @__PURE__ */ Symbol("paused");
1346
+ var st = /* @__PURE__ */ Symbol("resume");
1347
+ var C = /* @__PURE__ */ Symbol("buffer");
1348
+ var F = /* @__PURE__ */ Symbol("pipes");
1349
+ var T = /* @__PURE__ */ Symbol("bufferLength");
1350
+ var Yt = /* @__PURE__ */ Symbol("bufferPush");
1351
+ var Ft = /* @__PURE__ */ Symbol("bufferShift");
1352
+ var k = /* @__PURE__ */ Symbol("objectMode");
1353
+ var x = /* @__PURE__ */ Symbol("destroyed");
1354
+ var Xt = /* @__PURE__ */ Symbol("error");
1355
+ var Jt = /* @__PURE__ */ Symbol("emitData");
1356
+ var We = /* @__PURE__ */ Symbol("emitEnd");
1357
+ var Zt = /* @__PURE__ */ Symbol("emitEnd2");
1358
+ var B = /* @__PURE__ */ Symbol("async");
1359
+ var Qt = /* @__PURE__ */ Symbol("abort");
1360
+ var Dt = /* @__PURE__ */ Symbol("aborted");
1361
+ var pt = /* @__PURE__ */ Symbol("signal");
1362
+ var Y = /* @__PURE__ */ Symbol("dataListeners");
1363
+ var M = /* @__PURE__ */ Symbol("discarded");
1364
+ var mt = (n7) => Promise.resolve().then(n7);
1365
+ var li = (n7) => n7();
1366
+ var ci = (n7) => n7 === "end" || n7 === "finish" || n7 === "prefinish";
1367
+ var fi = (n7) => n7 instanceof ArrayBuffer || !!n7 && typeof n7 == "object" && n7.constructor && n7.constructor.name === "ArrayBuffer" && n7.byteLength >= 0;
1368
+ var ui = (n7) => !Buffer.isBuffer(n7) && ArrayBuffer.isView(n7);
1369
+ var Mt = class {
1370
+ src;
1371
+ dest;
1372
+ opts;
1373
+ ondrain;
1374
+ constructor(t, e, s) {
1375
+ this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[st](), this.dest.on("drain", this.ondrain);
1376
+ }
1377
+ unpipe() {
1378
+ this.dest.removeListener("drain", this.ondrain);
1379
+ }
1380
+ proxyErrors(t) {
1381
+ }
1382
+ end() {
1383
+ this.unpipe(), this.opts.end && this.dest.end();
1384
+ }
1385
+ };
1386
+ var te = class extends Mt {
1387
+ unpipe() {
1388
+ this.src.removeListener("error", this.proxyErrors), super.unpipe();
1389
+ }
1390
+ constructor(t, e, s) {
1391
+ super(t, e, s), this.proxyErrors = (i) => this.dest.emit("error", i), t.on("error", this.proxyErrors);
1392
+ }
1393
+ };
1394
+ var di = (n7) => !!n7.objectMode;
1395
+ var pi = (n7) => !n7.objectMode && !!n7.encoding && n7.encoding !== "buffer";
1396
+ var V = class extends ee {
1397
+ [v] = false;
1398
+ [dt] = false;
1399
+ [F] = [];
1400
+ [C] = [];
1401
+ [k];
1402
+ [P];
1403
+ [B];
1404
+ [et];
1405
+ [G] = false;
1406
+ [K] = false;
1407
+ [kt] = false;
1408
+ [Rt] = false;
1409
+ [ut] = null;
1410
+ [T] = 0;
1411
+ [x] = false;
1412
+ [pt];
1413
+ [Dt] = false;
1414
+ [Y] = 0;
1415
+ [M] = false;
1416
+ writable = true;
1417
+ readable = true;
1418
+ constructor(...t) {
1419
+ let e = t[0] || {};
1420
+ if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together");
1421
+ 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] });
1422
+ let { signal: s } = e;
1423
+ s && (this[pt] = s, s.aborted ? this[Qt]() : s.addEventListener("abort", () => this[Qt]()));
1424
+ }
1425
+ get bufferLength() {
1426
+ return this[T];
1427
+ }
1428
+ get encoding() {
1429
+ return this[P];
1430
+ }
1431
+ set encoding(t) {
1432
+ throw new Error("Encoding must be set at instantiation time");
1433
+ }
1434
+ setEncoding(t) {
1435
+ throw new Error("Encoding must be set at instantiation time");
1436
+ }
1437
+ get objectMode() {
1438
+ return this[k];
1439
+ }
1440
+ set objectMode(t) {
1441
+ throw new Error("objectMode must be set at instantiation time");
1442
+ }
1443
+ get async() {
1444
+ return this[B];
1445
+ }
1446
+ set async(t) {
1447
+ this[B] = this[B] || !!t;
1448
+ }
1449
+ [Qt]() {
1450
+ this[Dt] = true, this.emit("abort", this[pt]?.reason), this.destroy(this[pt]?.reason);
1451
+ }
1452
+ get aborted() {
1453
+ return this[Dt];
1454
+ }
1455
+ set aborted(t) {
1456
+ }
1457
+ write(t, e, s) {
1458
+ if (this[Dt]) return false;
1459
+ if (this[G]) throw new Error("write after end");
1460
+ if (this[x]) return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
1461
+ typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
1462
+ let i = this[B] ? mt : li;
1463
+ if (!this[k] && !Buffer.isBuffer(t)) {
1464
+ if (ui(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
1465
+ else if (fi(t)) t = Buffer.from(t);
1466
+ else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream");
1467
+ }
1468
+ 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]);
1469
+ }
1470
+ read(t) {
1471
+ if (this[x]) return null;
1472
+ if (this[M] = false, this[T] === 0 || t === 0 || t && t > this[T]) return this[H](), null;
1473
+ this[k] && (t = null), this[C].length > 1 && !this[k] && (this[C] = [this[P] ? this[C].join("") : Buffer.concat(this[C], this[T])]);
1474
+ let e = this[_e](t || null, this[C][0]);
1475
+ return this[H](), e;
1476
+ }
1477
+ [_e](t, e) {
1478
+ if (this[k]) this[Ft]();
1479
+ else {
1480
+ let s = e;
1481
+ 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);
1482
+ }
1483
+ return this.emit("data", e), !this[C].length && !this[G] && this.emit("drain"), e;
1484
+ }
1485
+ end(t, e, s) {
1486
+ 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;
1487
+ }
1488
+ [st]() {
1489
+ 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"));
1490
+ }
1491
+ resume() {
1492
+ return this[st]();
1493
+ }
1494
+ pause() {
1495
+ this[v] = false, this[dt] = true, this[M] = false;
1496
+ }
1497
+ get destroyed() {
1498
+ return this[x];
1499
+ }
1500
+ get flowing() {
1501
+ return this[v];
1502
+ }
1503
+ get paused() {
1504
+ return this[dt];
1505
+ }
1506
+ [Yt](t) {
1507
+ this[k] ? this[T] += 1 : this[T] += t.length, this[C].push(t);
1508
+ }
1509
+ [Ft]() {
1510
+ return this[k] ? this[T] -= 1 : this[T] -= this[C][0].length, this[C].shift();
1511
+ }
1512
+ [Ot](t = false) {
1513
+ do
1514
+ ;
1515
+ while (this[Le](this[Ft]()) && this[C].length);
1516
+ !t && !this[C].length && !this[G] && this.emit("drain");
1517
+ }
1518
+ [Le](t) {
1519
+ return this.emit("data", t), this[v];
1520
+ }
1521
+ pipe(t, e) {
1522
+ if (this[x]) return t;
1523
+ this[M] = false;
1524
+ let s = this[K];
1525
+ 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;
1526
+ }
1527
+ unpipe(t) {
1528
+ let e = this[F].find((s) => s.dest === t);
1529
+ 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());
1530
+ }
1531
+ addListener(t, e) {
1532
+ return this.on(t, e);
1533
+ }
1534
+ on(t, e) {
1535
+ let s = super.on(t, e);
1536
+ if (t === "data") this[M] = false, this[Y]++, !this[F].length && !this[v] && this[st]();
1537
+ else if (t === "readable" && this[T] !== 0) super.emit("readable");
1538
+ else if (ci(t) && this[K]) super.emit(t), this.removeAllListeners(t);
1539
+ else if (t === "error" && this[ut]) {
1540
+ let i = e;
1541
+ this[B] ? mt(() => i.call(this, this[ut])) : i.call(this, this[ut]);
1542
+ }
1543
+ return s;
1544
+ }
1545
+ removeListener(t, e) {
1546
+ return this.off(t, e);
1547
+ }
1548
+ off(t, e) {
1549
+ let s = super.off(t, e);
1550
+ return t === "data" && (this[Y] = this.listeners("data").length, this[Y] === 0 && !this[M] && !this[F].length && (this[v] = false)), s;
1551
+ }
1552
+ removeAllListeners(t) {
1553
+ let e = super.removeAllListeners(t);
1554
+ return (t === "data" || t === void 0) && (this[Y] = 0, !this[M] && !this[F].length && (this[v] = false)), e;
1555
+ }
1556
+ get emittedEnd() {
1557
+ return this[K];
1558
+ }
1559
+ [H]() {
1560
+ !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);
1561
+ }
1562
+ emit(t, ...e) {
1563
+ let s = e[0];
1564
+ if (t !== "error" && t !== "close" && t !== x && this[x]) return false;
1565
+ if (t === "data") return !this[k] && !s ? false : this[B] ? (mt(() => this[Jt](s)), true) : this[Jt](s);
1566
+ if (t === "end") return this[We]();
1567
+ if (t === "close") {
1568
+ if (this[Rt] = true, !this[K] && !this[x]) return false;
1569
+ let r = super.emit("close");
1570
+ return this.removeAllListeners("close"), r;
1571
+ } else if (t === "error") {
1572
+ this[ut] = s, super.emit(Xt, s);
1573
+ let r = !this[pt] || this.listeners("error").length ? super.emit("error", s) : false;
1574
+ return this[H](), r;
1575
+ } else if (t === "resume") {
1576
+ let r = super.emit("resume");
1577
+ return this[H](), r;
1578
+ } else if (t === "finish" || t === "prefinish") {
1579
+ let r = super.emit(t);
1580
+ return this.removeAllListeners(t), r;
1581
+ }
1582
+ let i = super.emit(t, ...e);
1583
+ return this[H](), i;
1584
+ }
1585
+ [Jt](t) {
1586
+ for (let s of this[F]) s.dest.write(t) === false && this.pause();
1587
+ let e = this[M] ? false : super.emit("data", t);
1588
+ return this[H](), e;
1589
+ }
1590
+ [We]() {
1591
+ return this[K] ? false : (this[K] = true, this.readable = false, this[B] ? (mt(() => this[Zt]()), true) : this[Zt]());
1592
+ }
1593
+ [Zt]() {
1594
+ if (this[et]) {
1595
+ let e = this[et].end();
1596
+ if (e) {
1597
+ for (let s of this[F]) s.dest.write(e);
1598
+ this[M] || super.emit("data", e);
1599
+ }
1600
+ }
1601
+ for (let e of this[F]) e.end();
1602
+ let t = super.emit("end");
1603
+ return this.removeAllListeners("end"), t;
1604
+ }
1605
+ async collect() {
1606
+ let t = Object.assign([], { dataLength: 0 });
1607
+ this[k] || (t.dataLength = 0);
1608
+ let e = this.promise();
1609
+ return this.on("data", (s) => {
1610
+ t.push(s), this[k] || (t.dataLength += s.length);
1611
+ }), await e, t;
1612
+ }
1613
+ async concat() {
1614
+ if (this[k]) throw new Error("cannot concat in objectMode");
1615
+ let t = await this.collect();
1616
+ return this[P] ? t.join("") : Buffer.concat(t, t.dataLength);
1617
+ }
1618
+ async promise() {
1619
+ return new Promise((t, e) => {
1620
+ this.on(x, () => e(new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t());
1621
+ });
1622
+ }
1623
+ [Symbol.asyncIterator]() {
1624
+ this[M] = false;
1625
+ let t = false, e = async () => (this.pause(), t = true, { value: void 0, done: true });
1626
+ return { next: () => {
1627
+ if (t) return e();
1628
+ let i = this.read();
1629
+ if (i !== null) return Promise.resolve({ done: false, value: i });
1630
+ if (this[G]) return e();
1631
+ let r, o, h = (c) => {
1632
+ this.off("data", a), this.off("end", l), this.off(x, u), e(), o(c);
1633
+ }, a = (c) => {
1634
+ this.off("error", h), this.off("end", l), this.off(x, u), this.pause(), r({ value: c, done: !!this[G] });
1635
+ }, l = () => {
1636
+ this.off("error", h), this.off("data", a), this.off(x, u), e(), r({ done: true, value: void 0 });
1637
+ }, u = () => h(new Error("stream destroyed"));
1638
+ return new Promise((c, d) => {
1639
+ o = d, r = c, this.once(x, u), this.once("error", h), this.once("end", l), this.once("data", a);
1640
+ });
1641
+ }, throw: e, return: e, [Symbol.asyncIterator]() {
1642
+ return this;
1643
+ }, [Symbol.asyncDispose]: async () => {
1644
+ } };
1645
+ }
1646
+ [Symbol.iterator]() {
1647
+ this[M] = false;
1648
+ 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 = () => {
1649
+ if (t) return e();
1650
+ let i = this.read();
1651
+ return i === null ? e() : { done: false, value: i };
1652
+ };
1653
+ return this.once("end", e), this.once(Xt, e), this.once(x, e), { next: s, throw: e, return: e, [Symbol.iterator]() {
1654
+ return this;
1655
+ }, [Symbol.dispose]: () => {
1656
+ } };
1657
+ }
1658
+ destroy(t) {
1659
+ if (this[x]) return t ? this.emit("error", t) : this.emit(x), this;
1660
+ this[x] = true, this[M] = true, this[C].length = 0, this[T] = 0;
1661
+ let e = this;
1662
+ return typeof e.close == "function" && !this[Rt] && e.close(), t ? this.emit("error", t) : this.emit(x), this;
1663
+ }
1664
+ static get isStream() {
1665
+ return oi;
1666
+ }
1667
+ };
1668
+ var vi = Ei.native;
1669
+ var wt = { lstatSync: wi, readdir: yi, readdirSync: bi, readlinkSync: Si, realpathSync: vi, promises: { lstat: Ci, readdir: Ti, readlink: Ai, realpath: ki } };
1670
+ var Ue = (n7) => !n7 || n7 === wt || n7 === xi ? wt : { ...wt, ...n7, promises: { ...wt.promises, ...n7.promises || {} } };
1671
+ var $e = /^\\\\\?\\([a-z]:)\\?$/i;
1672
+ var Ri = (n7) => n7.replace(/\//g, "\\").replace($e, "$1\\");
1673
+ var Oi = /[\\\/]/;
1674
+ var L = 0;
1675
+ var Ge = 1;
1676
+ var He = 2;
1677
+ var U = 4;
1678
+ var qe = 6;
1679
+ var Ke = 8;
1680
+ var X = 10;
1681
+ var Ve = 12;
1682
+ var _ = 15;
1683
+ var gt = ~_;
1684
+ var se = 16;
1685
+ var je = 32;
1686
+ var yt = 64;
1687
+ var j = 128;
1688
+ var Nt = 256;
1689
+ var Lt = 512;
1690
+ var Ie = yt | j | Lt;
1691
+ var Fi = 1023;
1692
+ 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;
1693
+ var ze = new ft({ max: 2 ** 12 });
1694
+ var bt = (n7) => {
1695
+ let t = ze.get(n7);
1696
+ if (t) return t;
1697
+ let e = n7.normalize("NFKD");
1698
+ return ze.set(n7, e), e;
1699
+ };
1700
+ var Be = new ft({ max: 2 ** 12 });
1701
+ var _t = (n7) => {
1702
+ let t = Be.get(n7);
1703
+ if (t) return t;
1704
+ let e = bt(n7.toLowerCase());
1705
+ return Be.set(n7, e), e;
1706
+ };
1707
+ var Wt = class extends ft {
1708
+ constructor() {
1709
+ super({ max: 256 });
1710
+ }
1711
+ };
1712
+ var ne = class extends ft {
1713
+ constructor(t = 16 * 1024) {
1714
+ super({ maxSize: t, sizeCalculation: (e) => e.length + 1 });
1715
+ }
1716
+ };
1717
+ var Ye = /* @__PURE__ */ Symbol("PathScurry setAsCwd");
1718
+ var R = class {
1719
+ name;
1720
+ root;
1721
+ roots;
1722
+ parent;
1723
+ nocase;
1724
+ isCWD = false;
1725
+ #t;
1726
+ #s;
1727
+ get dev() {
1728
+ return this.#s;
1729
+ }
1730
+ #n;
1731
+ get mode() {
1732
+ return this.#n;
1733
+ }
1734
+ #r;
1735
+ get nlink() {
1736
+ return this.#r;
1737
+ }
1738
+ #o;
1739
+ get uid() {
1740
+ return this.#o;
1741
+ }
1742
+ #S;
1743
+ get gid() {
1744
+ return this.#S;
1745
+ }
1746
+ #w;
1747
+ get rdev() {
1748
+ return this.#w;
1749
+ }
1750
+ #c;
1751
+ get blksize() {
1752
+ return this.#c;
1753
+ }
1754
+ #h;
1755
+ get ino() {
1756
+ return this.#h;
1757
+ }
1758
+ #u;
1759
+ get size() {
1760
+ return this.#u;
1761
+ }
1762
+ #f;
1763
+ get blocks() {
1764
+ return this.#f;
1765
+ }
1766
+ #a;
1767
+ get atimeMs() {
1768
+ return this.#a;
1769
+ }
1770
+ #i;
1771
+ get mtimeMs() {
1772
+ return this.#i;
1773
+ }
1774
+ #d;
1775
+ get ctimeMs() {
1776
+ return this.#d;
1777
+ }
1778
+ #E;
1779
+ get birthtimeMs() {
1780
+ return this.#E;
1781
+ }
1782
+ #b;
1783
+ get atime() {
1784
+ return this.#b;
1785
+ }
1786
+ #p;
1787
+ get mtime() {
1788
+ return this.#p;
1789
+ }
1790
+ #R;
1791
+ get ctime() {
1792
+ return this.#R;
1793
+ }
1794
+ #m;
1795
+ get birthtime() {
1796
+ return this.#m;
1797
+ }
1798
+ #C;
1799
+ #T;
1800
+ #g;
1801
+ #y;
1802
+ #x;
1803
+ #A;
1804
+ #e;
1805
+ #_;
1806
+ #M;
1807
+ #k;
1808
+ get parentPath() {
1809
+ return (this.parent || this).fullpath();
1810
+ }
1811
+ get path() {
1812
+ return this.parentPath;
1813
+ }
1814
+ constructor(t, e = L, s, i, r, o, h) {
1815
+ 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);
1816
+ }
1817
+ depth() {
1818
+ return this.#T !== void 0 ? this.#T : this.parent ? this.#T = this.parent.depth() + 1 : this.#T = 0;
1819
+ }
1820
+ childrenCache() {
1821
+ return this.#_;
1822
+ }
1823
+ resolve(t) {
1824
+ if (!t) return this;
1825
+ let e = this.getRootString(t), i = t.substring(e.length).split(this.splitSep);
1826
+ return e ? this.getRoot(e).#N(i) : this.#N(i);
1827
+ }
1828
+ #N(t) {
1829
+ let e = this;
1830
+ for (let s of t) e = e.child(s);
1831
+ return e;
1832
+ }
1833
+ children() {
1834
+ let t = this.#_.get(this);
1835
+ if (t) return t;
1836
+ let e = Object.assign([], { provisional: 0 });
1837
+ return this.#_.set(this, e), this.#e &= ~se, e;
1838
+ }
1839
+ child(t, e) {
1840
+ if (t === "" || t === ".") return this;
1841
+ if (t === "..") return this.parent || this;
1842
+ let s = this.children(), i = this.nocase ? _t(t) : bt(t);
1843
+ for (let a of s) if (a.#C === i) return a;
1844
+ 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 });
1845
+ return this.canReaddir() || (h.#e |= j), s.push(h), h;
1846
+ }
1847
+ relative() {
1848
+ if (this.isCWD) return "";
1849
+ if (this.#x !== void 0) return this.#x;
1850
+ let t = this.name, e = this.parent;
1851
+ if (!e) return this.#x = this.name;
1852
+ let s = e.relative();
1853
+ return s + (!s || !e.parent ? "" : this.sep) + t;
1854
+ }
1855
+ relativePosix() {
1856
+ if (this.sep === "/") return this.relative();
1857
+ if (this.isCWD) return "";
1858
+ if (this.#A !== void 0) return this.#A;
1859
+ let t = this.name, e = this.parent;
1860
+ if (!e) return this.#A = this.fullpathPosix();
1861
+ let s = e.relativePosix();
1862
+ return s + (!s || !e.parent ? "" : "/") + t;
1863
+ }
1864
+ fullpath() {
1865
+ if (this.#g !== void 0) return this.#g;
1866
+ let t = this.name, e = this.parent;
1867
+ if (!e) return this.#g = this.name;
1868
+ let i = e.fullpath() + (e.parent ? this.sep : "") + t;
1869
+ return this.#g = i;
1870
+ }
1871
+ fullpathPosix() {
1872
+ if (this.#y !== void 0) return this.#y;
1873
+ if (this.sep === "/") return this.#y = this.fullpath();
1874
+ if (!this.parent) {
1875
+ let i = this.fullpath().replace(/\\/g, "/");
1876
+ return /^[a-z]:\//i.test(i) ? this.#y = `//?/${i}` : this.#y = i;
1877
+ }
1878
+ let t = this.parent, e = t.fullpathPosix(), s = e + (!e || !t.parent ? "" : "/") + this.name;
1879
+ return this.#y = s;
1880
+ }
1881
+ isUnknown() {
1882
+ return (this.#e & _) === L;
1883
+ }
1884
+ isType(t) {
1885
+ return this[`is${t}`]();
1886
+ }
1887
+ getType() {
1888
+ 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";
1889
+ }
1890
+ isFile() {
1891
+ return (this.#e & _) === Ke;
1892
+ }
1893
+ isDirectory() {
1894
+ return (this.#e & _) === U;
1895
+ }
1896
+ isCharacterDevice() {
1897
+ return (this.#e & _) === He;
1898
+ }
1899
+ isBlockDevice() {
1900
+ return (this.#e & _) === qe;
1901
+ }
1902
+ isFIFO() {
1903
+ return (this.#e & _) === Ge;
1904
+ }
1905
+ isSocket() {
1906
+ return (this.#e & _) === Ve;
1907
+ }
1908
+ isSymbolicLink() {
1909
+ return (this.#e & X) === X;
1910
+ }
1911
+ lstatCached() {
1912
+ return this.#e & je ? this : void 0;
1913
+ }
1914
+ readlinkCached() {
1915
+ return this.#M;
1916
+ }
1917
+ realpathCached() {
1918
+ return this.#k;
1919
+ }
1920
+ readdirCached() {
1921
+ let t = this.children();
1922
+ return t.slice(0, t.provisional);
1923
+ }
1924
+ canReadlink() {
1925
+ if (this.#M) return true;
1926
+ if (!this.parent) return false;
1927
+ let t = this.#e & _;
1928
+ return !(t !== L && t !== X || this.#e & Nt || this.#e & j);
1929
+ }
1930
+ calledReaddir() {
1931
+ return !!(this.#e & se);
1932
+ }
1933
+ isENOENT() {
1934
+ return !!(this.#e & j);
1935
+ }
1936
+ isNamed(t) {
1937
+ return this.nocase ? this.#C === _t(t) : this.#C === bt(t);
1938
+ }
1939
+ async readlink() {
1940
+ let t = this.#M;
1941
+ if (t) return t;
1942
+ if (this.canReadlink() && this.parent) try {
1943
+ let e = await this.#t.promises.readlink(this.fullpath()), s = (await this.parent.realpath())?.resolve(e);
1944
+ if (s) return this.#M = s;
1945
+ } catch (e) {
1946
+ this.#D(e.code);
1947
+ return;
1948
+ }
1949
+ }
1950
+ readlinkSync() {
1951
+ let t = this.#M;
1952
+ if (t) return t;
1953
+ if (this.canReadlink() && this.parent) try {
1954
+ let e = this.#t.readlinkSync(this.fullpath()), s = this.parent.realpathSync()?.resolve(e);
1955
+ if (s) return this.#M = s;
1956
+ } catch (e) {
1957
+ this.#D(e.code);
1958
+ return;
1959
+ }
1960
+ }
1961
+ #j(t) {
1962
+ this.#e |= se;
1963
+ for (let e = t.provisional; e < t.length; e++) {
1964
+ let s = t[e];
1965
+ s && s.#v();
1966
+ }
1967
+ }
1968
+ #v() {
1969
+ this.#e & j || (this.#e = (this.#e | j) & gt, this.#G());
1970
+ }
1971
+ #G() {
1972
+ let t = this.children();
1973
+ t.provisional = 0;
1974
+ for (let e of t) e.#v();
1975
+ }
1976
+ #P() {
1977
+ this.#e |= Lt, this.#L();
1978
+ }
1979
+ #L() {
1980
+ if (this.#e & yt) return;
1981
+ let t = this.#e;
1982
+ (t & _) === U && (t &= gt), this.#e = t | yt, this.#G();
1983
+ }
1984
+ #I(t = "") {
1985
+ t === "ENOTDIR" || t === "EPERM" ? this.#L() : t === "ENOENT" ? this.#v() : this.children().provisional = 0;
1986
+ }
1987
+ #F(t = "") {
1988
+ t === "ENOTDIR" ? this.parent.#L() : t === "ENOENT" && this.#v();
1989
+ }
1990
+ #D(t = "") {
1991
+ let e = this.#e;
1992
+ e |= Nt, t === "ENOENT" && (e |= j), (t === "EINVAL" || t === "UNKNOWN") && (e &= gt), this.#e = e, t === "ENOTDIR" && this.parent && this.parent.#L();
1993
+ }
1994
+ #z(t, e) {
1995
+ return this.#U(t, e) || this.#B(t, e);
1996
+ }
1997
+ #B(t, e) {
1998
+ let s = ie(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & _;
1999
+ return r !== U && r !== X && r !== L && (i.#e |= yt), e.unshift(i), e.provisional++, i;
2000
+ }
2001
+ #U(t, e) {
2002
+ for (let s = e.provisional; s < e.length; s++) {
2003
+ let i = e[s];
2004
+ if ((this.nocase ? _t(t.name) : bt(t.name)) === i.#C) return this.#l(t, i, s, e);
2005
+ }
2006
+ }
2007
+ #l(t, e, s, i) {
2008
+ let r = e.name;
2009
+ 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;
2010
+ }
2011
+ async lstat() {
2012
+ if ((this.#e & j) === 0) try {
2013
+ return this.#$(await this.#t.promises.lstat(this.fullpath())), this;
2014
+ } catch (t) {
2015
+ this.#F(t.code);
2016
+ }
2017
+ }
2018
+ lstatSync() {
2019
+ if ((this.#e & j) === 0) try {
2020
+ return this.#$(this.#t.lstatSync(this.fullpath())), this;
2021
+ } catch (t) {
2022
+ this.#F(t.code);
2023
+ }
2024
+ }
2025
+ #$(t) {
2026
+ 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;
2027
+ 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;
2028
+ let y = ie(t);
2029
+ this.#e = this.#e & gt | y | je, y !== L && y !== U && y !== X && (this.#e |= yt);
2030
+ }
2031
+ #W = [];
2032
+ #O = false;
2033
+ #H(t) {
2034
+ this.#O = false;
2035
+ let e = this.#W.slice();
2036
+ this.#W.length = 0, e.forEach((s) => s(null, t));
2037
+ }
2038
+ readdirCB(t, e = false) {
2039
+ if (!this.canReaddir()) {
2040
+ e ? t(null, []) : queueMicrotask(() => t(null, []));
2041
+ return;
2042
+ }
2043
+ let s = this.children();
2044
+ if (this.calledReaddir()) {
2045
+ let r = s.slice(0, s.provisional);
2046
+ e ? t(null, r) : queueMicrotask(() => t(null, r));
2047
+ return;
2048
+ }
2049
+ if (this.#W.push(t), this.#O) return;
2050
+ this.#O = true;
2051
+ let i = this.fullpath();
2052
+ this.#t.readdir(i, { withFileTypes: true }, (r, o) => {
2053
+ if (r) this.#I(r.code), s.provisional = 0;
2054
+ else {
2055
+ for (let h of o) this.#z(h, s);
2056
+ this.#j(s);
2057
+ }
2058
+ this.#H(s.slice(0, s.provisional));
2059
+ });
2060
+ }
2061
+ #q;
2062
+ async readdir() {
2063
+ if (!this.canReaddir()) return [];
2064
+ let t = this.children();
2065
+ if (this.calledReaddir()) return t.slice(0, t.provisional);
2066
+ let e = this.fullpath();
2067
+ if (this.#q) await this.#q;
2068
+ else {
2069
+ let s = () => {
2070
+ };
2071
+ this.#q = new Promise((i) => s = i);
2072
+ try {
2073
+ for (let i of await this.#t.promises.readdir(e, { withFileTypes: true })) this.#z(i, t);
2074
+ this.#j(t);
2075
+ } catch (i) {
2076
+ this.#I(i.code), t.provisional = 0;
2077
+ }
2078
+ this.#q = void 0, s();
2079
+ }
2080
+ return t.slice(0, t.provisional);
2081
+ }
2082
+ readdirSync() {
2083
+ if (!this.canReaddir()) return [];
2084
+ let t = this.children();
2085
+ if (this.calledReaddir()) return t.slice(0, t.provisional);
2086
+ let e = this.fullpath();
2087
+ try {
2088
+ for (let s of this.#t.readdirSync(e, { withFileTypes: true })) this.#z(s, t);
2089
+ this.#j(t);
2090
+ } catch (s) {
2091
+ this.#I(s.code), t.provisional = 0;
2092
+ }
2093
+ return t.slice(0, t.provisional);
2094
+ }
2095
+ canReaddir() {
2096
+ if (this.#e & Ie) return false;
2097
+ let t = _ & this.#e;
2098
+ return t === L || t === U || t === X;
2099
+ }
2100
+ shouldWalk(t, e) {
2101
+ return (this.#e & U) === U && !(this.#e & Ie) && !t.has(this) && (!e || e(this));
2102
+ }
2103
+ async realpath() {
2104
+ if (this.#k) return this.#k;
2105
+ if (!((Lt | Nt | j) & this.#e)) try {
2106
+ let t = await this.#t.promises.realpath(this.fullpath());
2107
+ return this.#k = this.resolve(t);
2108
+ } catch {
2109
+ this.#P();
2110
+ }
2111
+ }
2112
+ realpathSync() {
2113
+ if (this.#k) return this.#k;
2114
+ if (!((Lt | Nt | j) & this.#e)) try {
2115
+ let t = this.#t.realpathSync(this.fullpath());
2116
+ return this.#k = this.resolve(t);
2117
+ } catch {
2118
+ this.#P();
2119
+ }
2120
+ }
2121
+ [Ye](t) {
2122
+ if (t === this) return;
2123
+ t.isCWD = false, this.isCWD = true;
2124
+ let e = /* @__PURE__ */ new Set([]), s = [], i = this;
2125
+ for (; i && i.parent; ) e.add(i), i.#x = s.join(this.sep), i.#A = s.join("/"), i = i.parent, s.push("..");
2126
+ for (i = t; i && i.parent && !e.has(i); ) i.#x = void 0, i.#A = void 0, i = i.parent;
2127
+ }
2128
+ };
2129
+ var Pt = class n2 extends R {
2130
+ sep = "\\";
2131
+ splitSep = Oi;
2132
+ constructor(t, e = L, s, i, r, o, h) {
2133
+ super(t, e, s, i, r, o, h);
2134
+ }
2135
+ newChild(t, e = L, s = {}) {
2136
+ return new n2(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
2137
+ }
2138
+ getRootString(t) {
2139
+ return re.parse(t).root;
2140
+ }
2141
+ getRoot(t) {
2142
+ if (t = Ri(t.toUpperCase()), t === this.root.name) return this.root;
2143
+ for (let [e, s] of Object.entries(this.roots)) if (this.sameRoot(t, e)) return this.roots[t] = s;
2144
+ return this.roots[t] = new it(t, this).root;
2145
+ }
2146
+ sameRoot(t, e = this.root.name) {
2147
+ return t = t.toUpperCase().replace(/\//g, "\\").replace($e, "$1\\"), t === e;
2148
+ }
2149
+ };
2150
+ var jt = class n3 extends R {
2151
+ splitSep = "/";
2152
+ sep = "/";
2153
+ constructor(t, e = L, s, i, r, o, h) {
2154
+ super(t, e, s, i, r, o, h);
2155
+ }
2156
+ getRootString(t) {
2157
+ return t.startsWith("/") ? "/" : "";
2158
+ }
2159
+ getRoot(t) {
2160
+ return this.root;
2161
+ }
2162
+ newChild(t, e = L, s = {}) {
2163
+ return new n3(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
2164
+ }
2165
+ };
2166
+ var It = class {
2167
+ root;
2168
+ rootPath;
2169
+ roots;
2170
+ cwd;
2171
+ #t;
2172
+ #s;
2173
+ #n;
2174
+ nocase;
2175
+ #r;
2176
+ constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16 * 1024, fs: o = wt } = {}) {
2177
+ this.#r = Ue(o), (t instanceof URL || t.startsWith("file://")) && (t = gi(t));
2178
+ let h = e.resolve(t);
2179
+ this.roots = /* @__PURE__ */ Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Wt(), this.#s = new Wt(), this.#n = new ne(r);
2180
+ let a = h.substring(this.rootPath.length).split(s);
2181
+ if (a.length === 1 && !a[0] && a.pop(), i === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor");
2182
+ this.nocase = i, this.root = this.newRoot(this.#r), this.roots[this.rootPath] = this.root;
2183
+ let l = this.root, u = a.length - 1, c = e.sep, d = this.rootPath, f = false;
2184
+ for (let m of a) {
2185
+ let p = u--;
2186
+ l = l.child(m, { relative: new Array(p).fill("..").join(c), relativePosix: new Array(p).fill("..").join("/"), fullpath: d += (f ? "" : c) + m }), f = true;
2187
+ }
2188
+ this.cwd = l;
2189
+ }
2190
+ depth(t = this.cwd) {
2191
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
2192
+ }
2193
+ childrenCache() {
2194
+ return this.#n;
2195
+ }
2196
+ resolve(...t) {
2197
+ let e = "";
2198
+ for (let r = t.length - 1; r >= 0; r--) {
2199
+ let o = t[r];
2200
+ if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
2201
+ }
2202
+ let s = this.#t.get(e);
2203
+ if (s !== void 0) return s;
2204
+ let i = this.cwd.resolve(e).fullpath();
2205
+ return this.#t.set(e, i), i;
2206
+ }
2207
+ resolvePosix(...t) {
2208
+ let e = "";
2209
+ for (let r = t.length - 1; r >= 0; r--) {
2210
+ let o = t[r];
2211
+ if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
2212
+ }
2213
+ let s = this.#s.get(e);
2214
+ if (s !== void 0) return s;
2215
+ let i = this.cwd.resolve(e).fullpathPosix();
2216
+ return this.#s.set(e, i), i;
2217
+ }
2218
+ relative(t = this.cwd) {
2219
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
2220
+ }
2221
+ relativePosix(t = this.cwd) {
2222
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix();
2223
+ }
2224
+ basename(t = this.cwd) {
2225
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.name;
2226
+ }
2227
+ dirname(t = this.cwd) {
2228
+ return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
2229
+ }
2230
+ async readdir(t = this.cwd, e = { withFileTypes: true }) {
2231
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2232
+ let { withFileTypes: s } = e;
2233
+ if (t.canReaddir()) {
2234
+ let i = await t.readdir();
2235
+ return s ? i : i.map((r) => r.name);
2236
+ } else return [];
2237
+ }
2238
+ readdirSync(t = this.cwd, e = { withFileTypes: true }) {
2239
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2240
+ let { withFileTypes: s = true } = e;
2241
+ return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
2242
+ }
2243
+ async lstat(t = this.cwd) {
2244
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat();
2245
+ }
2246
+ lstatSync(t = this.cwd) {
2247
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
2248
+ }
2249
+ async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
2250
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2251
+ let s = await t.readlink();
2252
+ return e ? s : s?.fullpath();
2253
+ }
2254
+ readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
2255
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2256
+ let s = t.readlinkSync();
2257
+ return e ? s : s?.fullpath();
2258
+ }
2259
+ async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
2260
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2261
+ let s = await t.realpath();
2262
+ return e ? s : s?.fullpath();
2263
+ }
2264
+ realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
2265
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2266
+ let s = t.realpathSync();
2267
+ return e ? s : s?.fullpath();
2268
+ }
2269
+ async walk(t = this.cwd, e = {}) {
2270
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2271
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = [];
2272
+ (!r || r(t)) && h.push(s ? t : t.fullpath());
2273
+ let a = /* @__PURE__ */ new Set(), l = (c, d) => {
2274
+ a.add(c), c.readdirCB((f, m) => {
2275
+ if (f) return d(f);
2276
+ let p = m.length;
2277
+ if (!p) return d();
2278
+ let w = () => {
2279
+ --p === 0 && d();
2280
+ };
2281
+ 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();
2282
+ }, true);
2283
+ }, u = t;
2284
+ return new Promise((c, d) => {
2285
+ l(u, (f) => {
2286
+ if (f) return d(f);
2287
+ c(h);
2288
+ });
2289
+ });
2290
+ }
2291
+ walkSync(t = this.cwd, e = {}) {
2292
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2293
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = [];
2294
+ (!r || r(t)) && h.push(s ? t : t.fullpath());
2295
+ let a = /* @__PURE__ */ new Set([t]);
2296
+ for (let l of a) {
2297
+ let u = l.readdirSync();
2298
+ for (let c of u) {
2299
+ (!r || r(c)) && h.push(s ? c : c.fullpath());
2300
+ let d = c;
2301
+ if (c.isSymbolicLink()) {
2302
+ if (!(i && (d = c.realpathSync()))) continue;
2303
+ d.isUnknown() && d.lstatSync();
2304
+ }
2305
+ d.shouldWalk(a, o) && a.add(d);
2306
+ }
2307
+ }
2308
+ return h;
2309
+ }
2310
+ [Symbol.asyncIterator]() {
2311
+ return this.iterate();
2312
+ }
2313
+ iterate(t = this.cwd, e = {}) {
2314
+ return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
2315
+ }
2316
+ [Symbol.iterator]() {
2317
+ return this.iterateSync();
2318
+ }
2319
+ *iterateSync(t = this.cwd, e = {}) {
2320
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2321
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e;
2322
+ (!r || r(t)) && (yield s ? t : t.fullpath());
2323
+ let h = /* @__PURE__ */ new Set([t]);
2324
+ for (let a of h) {
2325
+ let l = a.readdirSync();
2326
+ for (let u of l) {
2327
+ (!r || r(u)) && (yield s ? u : u.fullpath());
2328
+ let c = u;
2329
+ if (u.isSymbolicLink()) {
2330
+ if (!(i && (c = u.realpathSync()))) continue;
2331
+ c.isUnknown() && c.lstatSync();
2332
+ }
2333
+ c.shouldWalk(h, o) && h.add(c);
2334
+ }
2335
+ }
2336
+ }
2337
+ stream(t = this.cwd, e = {}) {
2338
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2339
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = new V({ objectMode: true });
2340
+ (!r || r(t)) && h.write(s ? t : t.fullpath());
2341
+ let a = /* @__PURE__ */ new Set(), l = [t], u = 0, c = () => {
2342
+ let d = false;
2343
+ for (; !d; ) {
2344
+ let f = l.shift();
2345
+ if (!f) {
2346
+ u === 0 && h.end();
2347
+ return;
2348
+ }
2349
+ u++, a.add(f);
2350
+ let m = (w, g, S = false) => {
2351
+ if (w) return h.emit("error", w);
2352
+ if (i && !S) {
2353
+ let E = [];
2354
+ for (let y of g) y.isSymbolicLink() && E.push(y.realpath().then((b) => b?.isUnknown() ? b.lstat() : b));
2355
+ if (E.length) {
2356
+ Promise.all(E).then(() => m(null, g, true));
2357
+ return;
2358
+ }
2359
+ }
2360
+ for (let E of g) E && (!r || r(E)) && (h.write(s ? E : E.fullpath()) || (d = true));
2361
+ u--;
2362
+ for (let E of g) {
2363
+ let y = E.realpathCached() || E;
2364
+ y.shouldWalk(a, o) && l.push(y);
2365
+ }
2366
+ d && !h.flowing ? h.once("drain", c) : p || c();
2367
+ }, p = true;
2368
+ f.readdirCB(m, true), p = false;
2369
+ }
2370
+ };
2371
+ return c(), h;
2372
+ }
2373
+ streamSync(t = this.cwd, e = {}) {
2374
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2375
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = new V({ objectMode: true }), a = /* @__PURE__ */ new Set();
2376
+ (!r || r(t)) && h.write(s ? t : t.fullpath());
2377
+ let l = [t], u = 0, c = () => {
2378
+ let d = false;
2379
+ for (; !d; ) {
2380
+ let f = l.shift();
2381
+ if (!f) {
2382
+ u === 0 && h.end();
2383
+ return;
2384
+ }
2385
+ u++, a.add(f);
2386
+ let m = f.readdirSync();
2387
+ for (let p of m) (!r || r(p)) && (h.write(s ? p : p.fullpath()) || (d = true));
2388
+ u--;
2389
+ for (let p of m) {
2390
+ let w = p;
2391
+ if (p.isSymbolicLink()) {
2392
+ if (!(i && (w = p.realpathSync()))) continue;
2393
+ w.isUnknown() && w.lstatSync();
2394
+ }
2395
+ w.shouldWalk(a, o) && l.push(w);
2396
+ }
2397
+ }
2398
+ d && !h.flowing && h.once("drain", c);
2399
+ };
2400
+ return c(), h;
2401
+ }
2402
+ chdir(t = this.cwd) {
2403
+ let e = this.cwd;
2404
+ this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[Ye](e);
2405
+ }
2406
+ };
2407
+ var it = class extends It {
2408
+ sep = "\\";
2409
+ constructor(t = process.cwd(), e = {}) {
2410
+ let { nocase: s = true } = e;
2411
+ super(t, re, "\\", { ...e, nocase: s }), this.nocase = s;
2412
+ for (let i = this.cwd; i; i = i.parent) i.nocase = this.nocase;
2413
+ }
2414
+ parseRootPath(t) {
2415
+ return re.parse(t).root.toUpperCase();
2416
+ }
2417
+ newRoot(t) {
2418
+ return new Pt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
2419
+ }
2420
+ isAbsolute(t) {
2421
+ return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
2422
+ }
2423
+ };
2424
+ var rt = class extends It {
2425
+ sep = "/";
2426
+ constructor(t = process.cwd(), e = {}) {
2427
+ let { nocase: s = false } = e;
2428
+ super(t, mi, "/", { ...e, nocase: s }), this.nocase = s;
2429
+ }
2430
+ parseRootPath(t) {
2431
+ return "/";
2432
+ }
2433
+ newRoot(t) {
2434
+ return new jt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
2435
+ }
2436
+ isAbsolute(t) {
2437
+ return t.startsWith("/");
2438
+ }
2439
+ };
2440
+ var St = class extends rt {
2441
+ constructor(t = process.cwd(), e = {}) {
2442
+ let { nocase: s = true } = e;
2443
+ super(t, { ...e, nocase: s });
2444
+ }
2445
+ };
2446
+ var Cr = process.platform === "win32" ? Pt : jt;
2447
+ var Xe = process.platform === "win32" ? it : process.platform === "darwin" ? St : rt;
2448
+ var Di = (n7) => n7.length >= 1;
2449
+ var Mi = (n7) => n7.length >= 1;
2450
+ var Ni = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
2451
+ var nt = class n4 {
2452
+ #t;
2453
+ #s;
2454
+ #n;
2455
+ length;
2456
+ #r;
2457
+ #o;
2458
+ #S;
2459
+ #w;
2460
+ #c;
2461
+ #h;
2462
+ #u = true;
2463
+ constructor(t, e, s, i) {
2464
+ if (!Di(t)) throw new TypeError("empty pattern list");
2465
+ if (!Mi(e)) throw new TypeError("empty glob list");
2466
+ if (e.length !== t.length) throw new TypeError("mismatched pattern list and glob list lengths");
2467
+ if (this.length = t.length, s < 0 || s >= this.length) throw new TypeError("index out of range");
2468
+ if (this.#t = t, this.#s = e, this.#n = s, this.#r = i, this.#n === 0) {
2469
+ if (this.isUNC()) {
2470
+ let [r, o, h, a, ...l] = this.#t, [u, c, d, f, ...m] = this.#s;
2471
+ l[0] === "" && (l.shift(), m.shift());
2472
+ let p = [r, o, h, a, ""].join("/"), w = [u, c, d, f, ""].join("/");
2473
+ this.#t = [p, ...l], this.#s = [w, ...m], this.length = this.#t.length;
2474
+ } else if (this.isDrive() || this.isAbsolute()) {
2475
+ let [r, ...o] = this.#t, [h, ...a] = this.#s;
2476
+ o[0] === "" && (o.shift(), a.shift());
2477
+ let l = r + "/", u = h + "/";
2478
+ this.#t = [l, ...o], this.#s = [u, ...a], this.length = this.#t.length;
2479
+ }
2480
+ }
2481
+ }
2482
+ [Ni]() {
2483
+ return "Pattern <" + this.#s.slice(this.#n).join("/") + ">";
2484
+ }
2485
+ pattern() {
2486
+ return this.#t[this.#n];
2487
+ }
2488
+ isString() {
2489
+ return typeof this.#t[this.#n] == "string";
2490
+ }
2491
+ isGlobstar() {
2492
+ return this.#t[this.#n] === A;
2493
+ }
2494
+ isRegExp() {
2495
+ return this.#t[this.#n] instanceof RegExp;
2496
+ }
2497
+ globString() {
2498
+ 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("/"));
2499
+ }
2500
+ hasMore() {
2501
+ return this.length > this.#n + 1;
2502
+ }
2503
+ rest() {
2504
+ 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;
2505
+ }
2506
+ isUNC() {
2507
+ let t = this.#t;
2508
+ 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];
2509
+ }
2510
+ isDrive() {
2511
+ let t = this.#t;
2512
+ 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]);
2513
+ }
2514
+ isAbsolute() {
2515
+ let t = this.#t;
2516
+ return this.#h !== void 0 ? this.#h : this.#h = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
2517
+ }
2518
+ root() {
2519
+ let t = this.#t[0];
2520
+ return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : "";
2521
+ }
2522
+ checkFollowGlobstar() {
2523
+ return !(this.#n === 0 || !this.isGlobstar() || !this.#u);
2524
+ }
2525
+ markFollowGlobstar() {
2526
+ return this.#n === 0 || !this.isGlobstar() || !this.#u ? false : (this.#u = false, true);
2527
+ }
2528
+ };
2529
+ var _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
2530
+ var ot = class {
2531
+ relative;
2532
+ relativeChildren;
2533
+ absolute;
2534
+ absoluteChildren;
2535
+ platform;
2536
+ mmopts;
2537
+ constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, platform: o = _i }) {
2538
+ 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 };
2539
+ for (let h of t) this.add(h);
2540
+ }
2541
+ add(t) {
2542
+ let e = new D(t, this.mmopts);
2543
+ for (let s = 0; s < e.set.length; s++) {
2544
+ let i = e.set[s], r = e.globParts[s];
2545
+ if (!i || !r) throw new Error("invalid pattern object");
2546
+ for (; i[0] === "." && r[0] === "."; ) i.shift(), r.shift();
2547
+ let o = new nt(i, r, 0, this.platform), h = new D(o.globString(), this.mmopts), a = r[r.length - 1] === "**", l = o.isAbsolute();
2548
+ l ? this.absolute.push(h) : this.relative.push(h), a && (l ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
2549
+ }
2550
+ }
2551
+ ignored(t) {
2552
+ let e = t.fullpath(), s = `${e}/`, i = t.relative() || ".", r = `${i}/`;
2553
+ for (let o of this.relative) if (o.match(i) || o.match(r)) return true;
2554
+ for (let o of this.absolute) if (o.match(e) || o.match(s)) return true;
2555
+ return false;
2556
+ }
2557
+ childrenIgnored(t) {
2558
+ let e = t.fullpath() + "/", s = (t.relative() || ".") + "/";
2559
+ for (let i of this.relativeChildren) if (i.match(s)) return true;
2560
+ for (let i of this.absoluteChildren) if (i.match(e)) return true;
2561
+ return false;
2562
+ }
2563
+ };
2564
+ var oe = class n5 {
2565
+ store;
2566
+ constructor(t = /* @__PURE__ */ new Map()) {
2567
+ this.store = t;
2568
+ }
2569
+ copy() {
2570
+ return new n5(new Map(this.store));
2571
+ }
2572
+ hasWalked(t, e) {
2573
+ return this.store.get(t.fullpath())?.has(e.globString());
2574
+ }
2575
+ storeWalked(t, e) {
2576
+ let s = t.fullpath(), i = this.store.get(s);
2577
+ i ? i.add(e.globString()) : this.store.set(s, /* @__PURE__ */ new Set([e.globString()]));
2578
+ }
2579
+ };
2580
+ var he = class {
2581
+ store = /* @__PURE__ */ new Map();
2582
+ add(t, e, s) {
2583
+ let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
2584
+ this.store.set(t, r === void 0 ? i : i & r);
2585
+ }
2586
+ entries() {
2587
+ return [...this.store.entries()].map(([t, e]) => [t, !!(e & 2), !!(e & 1)]);
2588
+ }
2589
+ };
2590
+ var ae = class {
2591
+ store = /* @__PURE__ */ new Map();
2592
+ add(t, e) {
2593
+ if (!t.canReaddir()) return;
2594
+ let s = this.store.get(t);
2595
+ s ? s.find((i) => i.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]);
2596
+ }
2597
+ get(t) {
2598
+ let e = this.store.get(t);
2599
+ if (!e) throw new Error("attempting to walk unknown path");
2600
+ return e;
2601
+ }
2602
+ entries() {
2603
+ return this.keys().map((t) => [t, this.store.get(t)]);
2604
+ }
2605
+ keys() {
2606
+ return [...this.store.keys()].filter((t) => t.canReaddir());
2607
+ }
2608
+ };
2609
+ var Et = class n6 {
2610
+ hasWalkedCache;
2611
+ matches = new he();
2612
+ subwalks = new ae();
2613
+ patterns;
2614
+ follow;
2615
+ dot;
2616
+ opts;
2617
+ constructor(t, e) {
2618
+ this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new oe();
2619
+ }
2620
+ processPatterns(t, e) {
2621
+ this.patterns = e;
2622
+ let s = e.map((i) => [t, i]);
2623
+ for (let [i, r] of s) {
2624
+ this.hasWalkedCache.storeWalked(i, r);
2625
+ let o = r.root(), h = r.isAbsolute() && this.opts.absolute !== false;
2626
+ if (o) {
2627
+ i = i.resolve(o === "/" && this.opts.root !== void 0 ? this.opts.root : o);
2628
+ let c = r.rest();
2629
+ if (c) r = c;
2630
+ else {
2631
+ this.matches.add(i, true, false);
2632
+ continue;
2633
+ }
2634
+ }
2635
+ if (i.isENOENT()) continue;
2636
+ let a, l, u = false;
2637
+ for (; typeof (a = r.pattern()) == "string" && (l = r.rest()); ) i = i.resolve(a), r = l, u = true;
2638
+ if (a = r.pattern(), l = r.rest(), u) {
2639
+ if (this.hasWalkedCache.hasWalked(i, r)) continue;
2640
+ this.hasWalkedCache.storeWalked(i, r);
2641
+ }
2642
+ if (typeof a == "string") {
2643
+ let c = a === ".." || a === "" || a === ".";
2644
+ this.matches.add(i.resolve(a), h, c);
2645
+ continue;
2646
+ } else if (a === A) {
2647
+ (!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r);
2648
+ let c = l?.pattern(), d = l?.rest();
2649
+ if (!l || (c === "" || c === ".") && !d) this.matches.add(i, h, c === "" || c === ".");
2650
+ else if (c === "..") {
2651
+ let f = i.parent || i;
2652
+ d ? this.hasWalkedCache.hasWalked(f, d) || this.subwalks.add(f, d) : this.matches.add(f, h, true);
2653
+ }
2654
+ } else a instanceof RegExp && this.subwalks.add(i, r);
2655
+ }
2656
+ return this;
2657
+ }
2658
+ subwalkTargets() {
2659
+ return this.subwalks.keys();
2660
+ }
2661
+ child() {
2662
+ return new n6(this.opts, this.hasWalkedCache);
2663
+ }
2664
+ filterEntries(t, e) {
2665
+ let s = this.subwalks.get(t), i = this.child();
2666
+ for (let r of e) for (let o of s) {
2667
+ let h = o.isAbsolute(), a = o.pattern(), l = o.rest();
2668
+ a === A ? i.testGlobstar(r, o, l, h) : a instanceof RegExp ? i.testRegExp(r, a, l, h) : i.testString(r, a, l, h);
2669
+ }
2670
+ return i;
2671
+ }
2672
+ testGlobstar(t, e, s, i) {
2673
+ 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) {
2674
+ let r = s.pattern();
2675
+ if (typeof r == "string" && r !== ".." && r !== "" && r !== ".") this.testString(t, r, s.rest(), i);
2676
+ else if (r === "..") {
2677
+ let o = t.parent || t;
2678
+ this.subwalks.add(o, s);
2679
+ } else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i);
2680
+ }
2681
+ }
2682
+ testRegExp(t, e, s, i) {
2683
+ e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false));
2684
+ }
2685
+ testString(t, e, s, i) {
2686
+ t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false));
2687
+ }
2688
+ };
2689
+ var Li = (n7, t) => typeof n7 == "string" ? new ot([n7], t) : Array.isArray(n7) ? new ot(n7, t) : n7;
2690
+ var zt = class {
2691
+ path;
2692
+ patterns;
2693
+ opts;
2694
+ seen = /* @__PURE__ */ new Set();
2695
+ paused = false;
2696
+ aborted = false;
2697
+ #t = [];
2698
+ #s;
2699
+ #n;
2700
+ signal;
2701
+ maxDepth;
2702
+ includeChildMatches;
2703
+ constructor(t, e, s) {
2704
+ 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")) {
2705
+ let i = "cannot ignore child matches, ignore lacks add() method.";
2706
+ throw new Error(i);
2707
+ }
2708
+ this.maxDepth = s.maxDepth || 1 / 0, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
2709
+ this.#t.length = 0;
2710
+ }));
2711
+ }
2712
+ #r(t) {
2713
+ return this.seen.has(t) || !!this.#s?.ignored?.(t);
2714
+ }
2715
+ #o(t) {
2716
+ return !!this.#s?.childrenIgnored?.(t);
2717
+ }
2718
+ pause() {
2719
+ this.paused = true;
2720
+ }
2721
+ resume() {
2722
+ if (this.signal?.aborted) return;
2723
+ this.paused = false;
2724
+ let t;
2725
+ for (; !this.paused && (t = this.#t.shift()); ) t();
2726
+ }
2727
+ onResume(t) {
2728
+ this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
2729
+ }
2730
+ async matchCheck(t, e) {
2731
+ if (e && this.opts.nodir) return;
2732
+ let s;
2733
+ if (this.opts.realpath) {
2734
+ if (s = t.realpathCached() || await t.realpath(), !s) return;
2735
+ t = s;
2736
+ }
2737
+ let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
2738
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
2739
+ let o = await r.realpath();
2740
+ o && (o.isUnknown() || this.opts.stat) && await o.lstat();
2741
+ }
2742
+ return this.matchCheckTest(r, e);
2743
+ }
2744
+ matchCheckTest(t, e) {
2745
+ 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;
2746
+ }
2747
+ matchCheckSync(t, e) {
2748
+ if (e && this.opts.nodir) return;
2749
+ let s;
2750
+ if (this.opts.realpath) {
2751
+ if (s = t.realpathCached() || t.realpathSync(), !s) return;
2752
+ t = s;
2753
+ }
2754
+ let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
2755
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
2756
+ let o = r.realpathSync();
2757
+ o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
2758
+ }
2759
+ return this.matchCheckTest(r, e);
2760
+ }
2761
+ matchFinish(t, e) {
2762
+ if (this.#r(t)) return;
2763
+ if (!this.includeChildMatches && this.#s?.add) {
2764
+ let r = `${t.relativePosix()}/**`;
2765
+ this.#s.add(r);
2766
+ }
2767
+ let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
2768
+ this.seen.add(t);
2769
+ let i = this.opts.mark && t.isDirectory() ? this.#n : "";
2770
+ if (this.opts.withFileTypes) this.matchEmit(t);
2771
+ else if (s) {
2772
+ let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
2773
+ this.matchEmit(r + i);
2774
+ } else {
2775
+ let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : "";
2776
+ this.matchEmit(r ? o + r + i : "." + i);
2777
+ }
2778
+ }
2779
+ async match(t, e, s) {
2780
+ let i = await this.matchCheck(t, s);
2781
+ i && this.matchFinish(i, e);
2782
+ }
2783
+ matchSync(t, e, s) {
2784
+ let i = this.matchCheckSync(t, s);
2785
+ i && this.matchFinish(i, e);
2786
+ }
2787
+ walkCB(t, e, s) {
2788
+ this.signal?.aborted && s(), this.walkCB2(t, e, new Et(this.opts), s);
2789
+ }
2790
+ walkCB2(t, e, s, i) {
2791
+ if (this.#o(t)) return i();
2792
+ if (this.signal?.aborted && i(), this.paused) {
2793
+ this.onResume(() => this.walkCB2(t, e, s, i));
2794
+ return;
2795
+ }
2796
+ s.processPatterns(t, e);
2797
+ let r = 1, o = () => {
2798
+ --r === 0 && i();
2799
+ };
2800
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
2801
+ for (let h of s.subwalkTargets()) {
2802
+ if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
2803
+ r++;
2804
+ let a = h.readdirCached();
2805
+ h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((l, u) => this.walkCB3(h, u, s, o), true);
2806
+ }
2807
+ o();
2808
+ }
2809
+ walkCB3(t, e, s, i) {
2810
+ s = s.filterEntries(t, e);
2811
+ let r = 1, o = () => {
2812
+ --r === 0 && i();
2813
+ };
2814
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
2815
+ for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2(h, a, s.child(), o);
2816
+ o();
2817
+ }
2818
+ walkCBSync(t, e, s) {
2819
+ this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Et(this.opts), s);
2820
+ }
2821
+ walkCB2Sync(t, e, s, i) {
2822
+ if (this.#o(t)) return i();
2823
+ if (this.signal?.aborted && i(), this.paused) {
2824
+ this.onResume(() => this.walkCB2Sync(t, e, s, i));
2825
+ return;
2826
+ }
2827
+ s.processPatterns(t, e);
2828
+ let r = 1, o = () => {
2829
+ --r === 0 && i();
2830
+ };
2831
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
2832
+ for (let h of s.subwalkTargets()) {
2833
+ if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
2834
+ r++;
2835
+ let a = h.readdirSync();
2836
+ this.walkCB3Sync(h, a, s, o);
2837
+ }
2838
+ o();
2839
+ }
2840
+ walkCB3Sync(t, e, s, i) {
2841
+ s = s.filterEntries(t, e);
2842
+ let r = 1, o = () => {
2843
+ --r === 0 && i();
2844
+ };
2845
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
2846
+ for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2Sync(h, a, s.child(), o);
2847
+ o();
2848
+ }
2849
+ };
2850
+ var xt = class extends zt {
2851
+ matches = /* @__PURE__ */ new Set();
2852
+ constructor(t, e, s) {
2853
+ super(t, e, s);
2854
+ }
2855
+ matchEmit(t) {
2856
+ this.matches.add(t);
2857
+ }
2858
+ async walk() {
2859
+ if (this.signal?.aborted) throw this.signal.reason;
2860
+ return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
2861
+ this.walkCB(this.path, this.patterns, () => {
2862
+ this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
2863
+ });
2864
+ }), this.matches;
2865
+ }
2866
+ walkSync() {
2867
+ if (this.signal?.aborted) throw this.signal.reason;
2868
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
2869
+ if (this.signal?.aborted) throw this.signal.reason;
2870
+ }), this.matches;
2871
+ }
2872
+ };
2873
+ var vt = class extends zt {
2874
+ results;
2875
+ constructor(t, e, s) {
2876
+ 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());
2877
+ }
2878
+ matchEmit(t) {
2879
+ this.results.write(t), this.results.flowing || this.pause();
2880
+ }
2881
+ stream() {
2882
+ let t = this.path;
2883
+ return t.isUnknown() ? t.lstat().then(() => {
2884
+ this.walkCB(t, this.patterns, () => this.results.end());
2885
+ }) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
2886
+ }
2887
+ streamSync() {
2888
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
2889
+ }
2890
+ };
2891
+ var Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
2892
+ var I = class {
2893
+ absolute;
2894
+ cwd;
2895
+ root;
2896
+ dot;
2897
+ dotRelative;
2898
+ follow;
2899
+ ignore;
2900
+ magicalBraces;
2901
+ mark;
2902
+ matchBase;
2903
+ maxDepth;
2904
+ nobrace;
2905
+ nocase;
2906
+ nodir;
2907
+ noext;
2908
+ noglobstar;
2909
+ pattern;
2910
+ platform;
2911
+ realpath;
2912
+ scurry;
2913
+ stat;
2914
+ signal;
2915
+ windowsPathsNoEscape;
2916
+ withFileTypes;
2917
+ includeChildMatches;
2918
+ opts;
2919
+ patterns;
2920
+ constructor(t, e) {
2921
+ if (!e) throw new TypeError("glob options required");
2922
+ 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");
2923
+ if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === false, this.windowsPathsNoEscape && (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) {
2924
+ if (e.noglobstar) throw new TypeError("base matching requires globstar");
2925
+ t = t.map((a) => a.includes("/") ? a : `./**/${a}`);
2926
+ }
2927
+ if (this.pattern = t, this.platform = e.platform || Pi, this.opts = { ...e, platform: this.platform }, e.scurry) {
2928
+ if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
2929
+ } else {
2930
+ let a = e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe;
2931
+ this.scurry = new a(this.cwd, { nocase: e.nocase, fs: e.fs });
2932
+ }
2933
+ this.nocase = this.scurry.nocase;
2934
+ 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), [[], []]);
2935
+ this.patterns = o.map((a, l) => {
2936
+ let u = h[l];
2937
+ if (!u) throw new Error("invalid pattern object");
2938
+ return new nt(a, u, 0, this.platform);
2939
+ });
2940
+ }
2941
+ async walk() {
2942
+ 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()];
2943
+ }
2944
+ walkSync() {
2945
+ 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()];
2946
+ }
2947
+ stream() {
2948
+ 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();
2949
+ }
2950
+ streamSync() {
2951
+ 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();
2952
+ }
2953
+ iterateSync() {
2954
+ return this.streamSync()[Symbol.iterator]();
2955
+ }
2956
+ [Symbol.iterator]() {
2957
+ return this.iterateSync();
2958
+ }
2959
+ iterate() {
2960
+ return this.stream()[Symbol.asyncIterator]();
2961
+ }
2962
+ [Symbol.asyncIterator]() {
2963
+ return this.iterate();
2964
+ }
2965
+ };
2966
+ var le = (n7, t = {}) => {
2967
+ Array.isArray(n7) || (n7 = [n7]);
2968
+ for (let e of n7) if (new D(e, t).hasMagic()) return true;
2969
+ return false;
2970
+ };
2971
+ function Bt(n7, t = {}) {
2972
+ return new I(n7, t).streamSync();
2973
+ }
2974
+ function Qe(n7, t = {}) {
2975
+ return new I(n7, t).stream();
2976
+ }
2977
+ function ts(n7, t = {}) {
2978
+ return new I(n7, t).walkSync();
2979
+ }
2980
+ async function Je(n7, t = {}) {
2981
+ return new I(n7, t).walk();
2982
+ }
2983
+ function Ut(n7, t = {}) {
2984
+ return new I(n7, t).iterateSync();
2985
+ }
2986
+ function es(n7, t = {}) {
2987
+ return new I(n7, t).iterate();
2988
+ }
2989
+ var ji = Bt;
2990
+ var Ii = Object.assign(Qe, { sync: Bt });
2991
+ var zi = Ut;
2992
+ var Bi = Object.assign(es, { sync: Ut });
2993
+ var Ui = Object.assign(ts, { stream: Bt, iterate: Ut });
2994
+ 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 });
2995
+ Ze.glob = Ze;
2996
+
2997
+ export {
2998
+ ts,
2999
+ Ze
3000
+ };