opfs-worker 1.0.0 → 1.1.0

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.
@@ -1,152 +1,182 @@
1
- class x extends Error {
2
- constructor(t, e, n, i) {
3
- super(t, { cause: i }), this.code = e, this.path = n, this.name = "OPFSError";
1
+ class g extends Error {
2
+ constructor(t, e, n, r) {
3
+ super(t, { cause: r }), this.code = e, this.path = n, this.name = "OPFSError";
4
4
  }
5
5
  }
6
- class rt extends x {
6
+ class it extends g {
7
7
  constructor(t) {
8
8
  super("OPFS is not supported in this browser", "OPFS_NOT_SUPPORTED", void 0, t);
9
9
  }
10
10
  }
11
- class me extends x {
11
+ class ye extends g {
12
12
  constructor(t) {
13
13
  super("OPFS is not mounted", "OPFS_NOT_MOUNTED", void 0, t);
14
14
  }
15
15
  }
16
- class we extends x {
16
+ class Ee extends g {
17
17
  constructor(t, e, n) {
18
18
  super(t, "INVALID_PATH", e, n);
19
19
  }
20
20
  }
21
- class ye extends x {
21
+ class Se extends g {
22
22
  constructor(t, e) {
23
23
  super(`File not found: ${t}`, "FILE_NOT_FOUND", t, e);
24
24
  }
25
25
  }
26
- class Ee extends x {
26
+ class xe extends g {
27
27
  constructor(t, e) {
28
28
  super(`Directory not found: ${t}`, "DIRECTORY_NOT_FOUND", t, e);
29
29
  }
30
30
  }
31
- class xe extends x {
31
+ class Oe extends g {
32
32
  constructor(t, e, n) {
33
33
  super(`Permission denied for ${e} on: ${t}`, "PERMISSION_DENIED", t, n);
34
34
  }
35
35
  }
36
- class Se extends x {
36
+ class Ne extends g {
37
37
  constructor(t, e, n) {
38
38
  super(t, "STORAGE_ERROR", e, n);
39
39
  }
40
40
  }
41
- class be extends x {
41
+ class be extends g {
42
42
  constructor(t, e, n) {
43
43
  super(`Operation timed out: ${t}`, "TIMEOUT_ERROR", e, n);
44
44
  }
45
45
  }
46
+ function Ae(s, t, e, n) {
47
+ const r = `${s.toUpperCase()}_FAILED`;
48
+ return new g(`Failed to ${s} file descriptor: ${t}`, r, e, n);
49
+ }
50
+ function ot(s, t) {
51
+ const e = t?.path, n = t?.isDirectory;
52
+ switch (s.name) {
53
+ case "InvalidStateError":
54
+ return new g(`File is busy: ${e || "unknown"}`, "EBUSY", e, s);
55
+ case "QuotaExceededError":
56
+ return new g(`No space left on device: ${e || "unknown"}`, "ENOSPC", e, s);
57
+ case "NotFoundError":
58
+ return new g(`No such file or directory: ${e || "unknown"}`, "ENOENT", e, s);
59
+ case "TypeMismatchError":
60
+ return n !== void 0 ? n ? new g(`Not a directory: ${e || "unknown"}`, "ENOTDIR", e, s) : new g(`Is a directory: ${e || "unknown"}`, "EISDIR", e, s) : new g(`Type mismatch: ${e || "unknown"}`, "EINVAL", e, s);
61
+ case "NotAllowedError":
62
+ case "SecurityError":
63
+ return new g(`Permission denied: ${e || "unknown"}`, "EACCES", e, s);
64
+ case "InvalidModificationError":
65
+ return new g(`Invalid modification: ${e || "unknown"}`, "EINVAL", e, s);
66
+ case "AbortError":
67
+ return new g(`Operation aborted: ${e || "unknown"}`, "EINTR", e, s);
68
+ case "OperationError":
69
+ return new g(`Operation failed: ${e || "unknown"}`, "EIO", e, s);
70
+ case "TypeError":
71
+ return new g(`Operation not supported: ${e || "unknown"}`, "ENOTSUP", e, s);
72
+ default:
73
+ return new g(`I/O error: ${e || "unknown"}`, "EIO", e, s);
74
+ }
75
+ }
46
76
  const H = (s, t, e) => {
47
- const n = s instanceof RegExp ? W(s, e) : s, i = t instanceof RegExp ? W(t, e) : t, r = n !== null && i != null && ot(n, i, e);
48
- return r && {
49
- start: r[0],
50
- end: r[1],
51
- pre: e.slice(0, r[0]),
52
- body: e.slice(r[0] + n.length, r[1]),
53
- post: e.slice(r[1] + i.length)
77
+ const n = s instanceof RegExp ? W(s, e) : s, r = t instanceof RegExp ? W(t, e) : t, i = n !== null && r != null && ct(n, r, e);
78
+ return i && {
79
+ start: i[0],
80
+ end: i[1],
81
+ pre: e.slice(0, i[0]),
82
+ body: e.slice(i[0] + n.length, i[1]),
83
+ post: e.slice(i[1] + r.length)
54
84
  };
55
85
  }, W = (s, t) => {
56
86
  const e = t.match(s);
57
87
  return e ? e[0] : null;
58
- }, ot = (s, t, e) => {
59
- let n, i, r, o, a, h = e.indexOf(s), l = e.indexOf(t, h + 1), c = h;
60
- if (h >= 0 && l > 0) {
88
+ }, ct = (s, t, e) => {
89
+ let n, r, i, o, l, a = e.indexOf(s), h = e.indexOf(t, a + 1), c = a;
90
+ if (a >= 0 && h > 0) {
61
91
  if (s === t)
62
- return [h, l];
63
- for (n = [], r = e.length; c >= 0 && !a; ) {
64
- if (c === h)
65
- n.push(c), h = e.indexOf(s, c + 1);
92
+ return [a, h];
93
+ for (n = [], i = e.length; c >= 0 && !l; ) {
94
+ if (c === a)
95
+ n.push(c), a = e.indexOf(s, c + 1);
66
96
  else if (n.length === 1) {
67
97
  const p = n.pop();
68
- p !== void 0 && (a = [p, l]);
98
+ p !== void 0 && (l = [p, h]);
69
99
  } else
70
- i = n.pop(), i !== void 0 && i < r && (r = i, o = l), l = e.indexOf(t, c + 1);
71
- c = h < l && h >= 0 ? h : l;
100
+ r = n.pop(), r !== void 0 && r < i && (i = r, o = h), h = e.indexOf(t, c + 1);
101
+ c = a < h && a >= 0 ? a : h;
72
102
  }
73
- n.length && o !== void 0 && (a = [r, o]);
103
+ n.length && o !== void 0 && (l = [i, o]);
74
104
  }
75
- return a;
76
- }, Z = "\0SLASH" + Math.random() + "\0", J = "\0OPEN" + Math.random() + "\0", F = "\0CLOSE" + Math.random() + "\0", V = "\0COMMA" + Math.random() + "\0", X = "\0PERIOD" + Math.random() + "\0", ct = new RegExp(Z, "g"), at = new RegExp(J, "g"), ht = new RegExp(F, "g"), lt = new RegExp(V, "g"), ut = new RegExp(X, "g"), ft = /\\\\/g, pt = /\\{/g, dt = /\\}/g, gt = /\\,/g, mt = /\\./g;
77
- function L(s) {
105
+ return l;
106
+ }, V = "\0SLASH" + Math.random() + "\0", Z = "\0OPEN" + Math.random() + "\0", L = "\0CLOSE" + Math.random() + "\0", Y = "\0COMMA" + Math.random() + "\0", J = "\0PERIOD" + Math.random() + "\0", at = new RegExp(V, "g"), lt = new RegExp(Z, "g"), ht = new RegExp(L, "g"), ut = new RegExp(Y, "g"), ft = new RegExp(J, "g"), pt = /\\\\/g, dt = /\\{/g, gt = /\\}/g, mt = /\\,/g, wt = /\\./g;
107
+ function D(s) {
78
108
  return isNaN(s) ? s.charCodeAt(0) : parseInt(s, 10);
79
109
  }
80
- function wt(s) {
81
- return s.replace(ft, Z).replace(pt, J).replace(dt, F).replace(gt, V).replace(mt, X);
82
- }
83
110
  function yt(s) {
84
- return s.replace(ct, "\\").replace(at, "{").replace(ht, "}").replace(lt, ",").replace(ut, ".");
111
+ return s.replace(pt, V).replace(dt, Z).replace(gt, L).replace(mt, Y).replace(wt, J);
85
112
  }
86
- function Y(s) {
113
+ function Et(s) {
114
+ return s.replace(at, "\\").replace(lt, "{").replace(ht, "}").replace(ut, ",").replace(ft, ".");
115
+ }
116
+ function X(s) {
87
117
  if (!s)
88
118
  return [""];
89
119
  const t = [], e = H("{", "}", s);
90
120
  if (!e)
91
121
  return s.split(",");
92
- const { pre: n, body: i, post: r } = e, o = n.split(",");
93
- o[o.length - 1] += "{" + i + "}";
94
- const a = Y(r);
95
- return r.length && (o[o.length - 1] += a.shift(), o.push.apply(o, a)), t.push.apply(t, o), t;
122
+ const { pre: n, body: r, post: i } = e, o = n.split(",");
123
+ o[o.length - 1] += "{" + r + "}";
124
+ const l = X(i);
125
+ return i.length && (o[o.length - 1] += l.shift(), o.push.apply(o, l)), t.push.apply(t, o), t;
96
126
  }
97
- function Et(s) {
98
- return s ? (s.slice(0, 2) === "{}" && (s = "\\{\\}" + s.slice(2)), T(wt(s), !0).map(yt)) : [];
127
+ function St(s) {
128
+ return s ? (s.slice(0, 2) === "{}" && (s = "\\{\\}" + s.slice(2)), T(yt(s), !0).map(Et)) : [];
99
129
  }
100
130
  function xt(s) {
101
131
  return "{" + s + "}";
102
132
  }
103
- function St(s) {
133
+ function Ot(s) {
104
134
  return /^-?0\d/.test(s);
105
135
  }
106
- function bt(s, t) {
136
+ function Nt(s, t) {
107
137
  return s <= t;
108
138
  }
109
- function Ot(s, t) {
139
+ function bt(s, t) {
110
140
  return s >= t;
111
141
  }
112
142
  function T(s, t) {
113
143
  const e = [], n = H("{", "}", s);
114
144
  if (!n)
115
145
  return [s];
116
- const i = n.pre, r = n.post.length ? T(n.post, !1) : [""];
146
+ const r = n.pre, i = n.post.length ? T(n.post, !1) : [""];
117
147
  if (/\$$/.test(n.pre))
118
- for (let o = 0; o < r.length; o++) {
119
- const a = i + "{" + n.body + "}" + r[o];
120
- e.push(a);
148
+ for (let o = 0; o < i.length; o++) {
149
+ const l = r + "{" + n.body + "}" + i[o];
150
+ e.push(l);
121
151
  }
122
152
  else {
123
- const o = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body), h = o || a, l = n.body.indexOf(",") >= 0;
124
- if (!h && !l)
125
- return n.post.match(/,(?!,).*\}/) ? (s = n.pre + "{" + n.body + F + n.post, T(s)) : [s];
153
+ const o = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body), l = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body), a = o || l, h = n.body.indexOf(",") >= 0;
154
+ if (!a && !h)
155
+ return n.post.match(/,(?!,).*\}/) ? (s = n.pre + "{" + n.body + L + n.post, T(s)) : [s];
126
156
  let c;
127
- if (h)
157
+ if (a)
128
158
  c = n.body.split(/\.\./);
129
- else if (c = Y(n.body), c.length === 1 && c[0] !== void 0 && (c = T(c[0], !1).map(xt), c.length === 1))
130
- return r.map((f) => n.pre + c[0] + f);
159
+ else if (c = X(n.body), c.length === 1 && c[0] !== void 0 && (c = T(c[0], !1).map(xt), c.length === 1))
160
+ return i.map((f) => n.pre + c[0] + f);
131
161
  let p;
132
- if (h && c[0] !== void 0 && c[1] !== void 0) {
133
- const f = L(c[0]), u = L(c[1]), g = Math.max(c[0].length, c[1].length);
134
- let d = c.length === 3 && c[2] !== void 0 ? Math.abs(L(c[2])) : 1, E = bt;
135
- u < f && (d *= -1, E = Ot);
136
- const A = c.some(St);
162
+ if (a && c[0] !== void 0 && c[1] !== void 0) {
163
+ const f = D(c[0]), u = D(c[1]), m = Math.max(c[0].length, c[1].length);
164
+ let d = c.length === 3 && c[2] !== void 0 ? Math.abs(D(c[2])) : 1, S = Nt;
165
+ u < f && (d *= -1, S = bt);
166
+ const A = c.some(Ot);
137
167
  p = [];
138
- for (let S = f; E(S, u); S += d) {
139
- let m;
140
- if (a)
141
- m = String.fromCharCode(S), m === "\\" && (m = "");
142
- else if (m = String(S), A) {
143
- const N = g - m.length;
144
- if (N > 0) {
145
- const P = new Array(N + 1).join("0");
146
- S < 0 ? m = "-" + P + m.slice(1) : m = P + m;
168
+ for (let x = f; S(x, u); x += d) {
169
+ let w;
170
+ if (l)
171
+ w = String.fromCharCode(x), w === "\\" && (w = "");
172
+ else if (w = String(x), A) {
173
+ const v = m - w.length;
174
+ if (v > 0) {
175
+ const P = new Array(v + 1).join("0");
176
+ x < 0 ? w = "-" + P + w.slice(1) : w = P + w;
147
177
  }
148
178
  }
149
- p.push(m);
179
+ p.push(w);
150
180
  }
151
181
  } else {
152
182
  p = [];
@@ -154,19 +184,19 @@ function T(s, t) {
154
184
  p.push.apply(p, T(c[f], !1));
155
185
  }
156
186
  for (let f = 0; f < p.length; f++)
157
- for (let u = 0; u < r.length; u++) {
158
- const g = i + p[f] + r[u];
159
- (!t || h || g) && e.push(g);
187
+ for (let u = 0; u < i.length; u++) {
188
+ const m = r + p[f] + i[u];
189
+ (!t || a || m) && e.push(m);
160
190
  }
161
191
  }
162
192
  return e;
163
193
  }
164
- const vt = 1024 * 64, C = (s) => {
194
+ const At = 1024 * 64, C = (s) => {
165
195
  if (typeof s != "string")
166
196
  throw new TypeError("invalid pattern");
167
- if (s.length > vt)
197
+ if (s.length > At)
168
198
  throw new TypeError("pattern is too long");
169
- }, At = {
199
+ }, vt = {
170
200
  "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
171
201
  "[:alpha:]": ["\\p{L}\\p{Nl}", !0],
172
202
  "[:ascii:]": ["\\x00-\\x7f", !1],
@@ -181,77 +211,77 @@ const vt = 1024 * 64, C = (s) => {
181
211
  "[:upper:]": ["\\p{Lu}", !0],
182
212
  "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
183
213
  "[:xdigit:]": ["A-Fa-f0-9", !1]
184
- }, $ = (s) => s.replace(/[[\]\\-]/g, "\\$&"), Nt = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), k = (s) => s.join(""), $t = (s, t) => {
214
+ }, $ = (s) => s.replace(/[[\]\\-]/g, "\\$&"), $t = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), j = (s) => s.join(""), Tt = (s, t) => {
185
215
  const e = t;
186
216
  if (s.charAt(e) !== "[")
187
217
  throw new Error("not in a brace expression");
188
- const n = [], i = [];
189
- let r = e + 1, o = !1, a = !1, h = !1, l = !1, c = e, p = "";
190
- t: for (; r < s.length; ) {
191
- const d = s.charAt(r);
192
- if ((d === "!" || d === "^") && r === e + 1) {
193
- l = !0, r++;
218
+ const n = [], r = [];
219
+ let i = e + 1, o = !1, l = !1, a = !1, h = !1, c = e, p = "";
220
+ t: for (; i < s.length; ) {
221
+ const d = s.charAt(i);
222
+ if ((d === "!" || d === "^") && i === e + 1) {
223
+ h = !0, i++;
194
224
  continue;
195
225
  }
196
- if (d === "]" && o && !h) {
197
- c = r + 1;
226
+ if (d === "]" && o && !a) {
227
+ c = i + 1;
198
228
  break;
199
229
  }
200
- if (o = !0, d === "\\" && !h) {
201
- h = !0, r++;
230
+ if (o = !0, d === "\\" && !a) {
231
+ a = !0, i++;
202
232
  continue;
203
233
  }
204
- if (d === "[" && !h) {
205
- for (const [E, [v, A, S]] of Object.entries(At))
206
- if (s.startsWith(E, r)) {
234
+ if (d === "[" && !a) {
235
+ for (const [S, [b, A, x]] of Object.entries(vt))
236
+ if (s.startsWith(S, i)) {
207
237
  if (p)
208
238
  return ["$.", !1, s.length - e, !0];
209
- r += E.length, S ? i.push(v) : n.push(v), a = a || A;
239
+ i += S.length, x ? r.push(b) : n.push(b), l = l || A;
210
240
  continue t;
211
241
  }
212
242
  }
213
- if (h = !1, p) {
214
- d > p ? n.push($(p) + "-" + $(d)) : d === p && n.push($(d)), p = "", r++;
243
+ if (a = !1, p) {
244
+ d > p ? n.push($(p) + "-" + $(d)) : d === p && n.push($(d)), p = "", i++;
215
245
  continue;
216
246
  }
217
- if (s.startsWith("-]", r + 1)) {
218
- n.push($(d + "-")), r += 2;
247
+ if (s.startsWith("-]", i + 1)) {
248
+ n.push($(d + "-")), i += 2;
219
249
  continue;
220
250
  }
221
- if (s.startsWith("-", r + 1)) {
222
- p = d, r += 2;
251
+ if (s.startsWith("-", i + 1)) {
252
+ p = d, i += 2;
223
253
  continue;
224
254
  }
225
- n.push($(d)), r++;
255
+ n.push($(d)), i++;
226
256
  }
227
- if (c < r)
257
+ if (c < i)
228
258
  return ["", !1, 0, !1];
229
- if (!n.length && !i.length)
259
+ if (!n.length && !r.length)
230
260
  return ["$.", !1, s.length - e, !0];
231
- if (i.length === 0 && n.length === 1 && /^\\?.$/.test(n[0]) && !l) {
261
+ if (r.length === 0 && n.length === 1 && /^\\?.$/.test(n[0]) && !h) {
232
262
  const d = n[0].length === 2 ? n[0].slice(-1) : n[0];
233
- return [Nt(d), !1, c - e, !1];
263
+ return [$t(d), !1, c - e, !1];
234
264
  }
235
- const f = "[" + (l ? "^" : "") + k(n) + "]", u = "[" + (l ? "" : "^") + k(i) + "]";
236
- return [n.length && i.length ? "(" + f + "|" + u + ")" : n.length ? f : u, a, c - e, !0];
237
- }, M = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1"), Tt = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), z = (s) => Tt.has(s), Mt = "(?!(?:^|/)\\.\\.?(?:$|/))", R = "(?!\\.)", Pt = /* @__PURE__ */ new Set(["[", "."]), Rt = /* @__PURE__ */ new Set(["..", "."]), Ct = new Set("().*{}+?[]^$\\!"), Dt = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), j = "[^/]", _ = j + "*?", B = j + "+?";
238
- class y {
265
+ const f = "[" + (h ? "^" : "") + j(n) + "]", u = "[" + (h ? "" : "^") + j(r) + "]";
266
+ return [n.length && r.length ? "(" + f + "|" + u + ")" : n.length ? f : u, l, c - e, !0];
267
+ }, M = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1"), Mt = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), z = (s) => Mt.has(s), Pt = "(?!(?:^|/)\\.\\.?(?:$|/))", R = "(?!\\.)", Rt = /* @__PURE__ */ new Set(["[", "."]), Ct = /* @__PURE__ */ new Set(["..", "."]), It = new Set("().*{}+?[]^$\\!"), Dt = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), F = "[^/]", _ = F + "*?", B = F + "+?";
268
+ class E {
239
269
  type;
240
270
  #s;
241
271
  #n;
242
- #r = !1;
272
+ #i = !1;
243
273
  #t = [];
244
274
  #e;
245
275
  #o;
246
276
  #a;
247
277
  #c = !1;
248
- #i;
249
- #h;
278
+ #r;
279
+ #l;
250
280
  // set to true if it's an extglob with no children
251
281
  // (which really means one child of '')
252
282
  #u = !1;
253
283
  constructor(t, e, n = {}) {
254
- this.type = t, t && (this.#n = !0), this.#e = e, this.#s = this.#e ? this.#e.#s : this, this.#i = this.#s === this ? n : this.#s.#i, this.#a = this.#s === this ? [] : this.#s.#a, t === "!" && !this.#s.#c && this.#a.push(this), this.#o = this.#e ? this.#e.#t.length : 0;
284
+ this.type = t, t && (this.#n = !0), this.#e = e, this.#s = this.#e ? this.#e.#s : this, this.#r = this.#s === this ? n : this.#s.#r, this.#a = this.#s === this ? [] : this.#s.#a, t === "!" && !this.#s.#c && this.#a.push(this), this.#o = this.#e ? this.#e.#t.length : 0;
255
285
  }
256
286
  get hasMagic() {
257
287
  if (this.#n !== void 0)
@@ -263,7 +293,7 @@ class y {
263
293
  }
264
294
  // reconstructs the pattern
265
295
  toString() {
266
- return this.#h !== void 0 ? this.#h : this.type ? this.#h = this.type + "(" + this.#t.map((t) => String(t)).join("|") + ")" : this.#h = this.#t.map((t) => String(t)).join("");
296
+ return this.#l !== void 0 ? this.#l : this.type ? this.#l = this.type + "(" + this.#t.map((t) => String(t)).join("|") + ")" : this.#l = this.#t.map((t) => String(t)).join("");
267
297
  }
268
298
  #p() {
269
299
  if (this !== this.#s)
@@ -277,11 +307,11 @@ class y {
277
307
  continue;
278
308
  let e = t, n = e.#e;
279
309
  for (; n; ) {
280
- for (let i = e.#o + 1; !n.type && i < n.#t.length; i++)
281
- for (const r of t.#t) {
282
- if (typeof r == "string")
310
+ for (let r = e.#o + 1; !n.type && r < n.#t.length; r++)
311
+ for (const i of t.#t) {
312
+ if (typeof i == "string")
283
313
  throw new Error("string part in extglob AST??");
284
- r.copyIn(n.#t[i]);
314
+ i.copyIn(n.#t[r]);
285
315
  }
286
316
  e = n, n = e.#e;
287
317
  }
@@ -291,7 +321,7 @@ class y {
291
321
  push(...t) {
292
322
  for (const e of t)
293
323
  if (e !== "") {
294
- if (typeof e != "string" && !(e instanceof y && e.#e === this))
324
+ if (typeof e != "string" && !(e instanceof E && e.#e === this))
295
325
  throw new Error("invalid part: " + e);
296
326
  this.#t.push(e);
297
327
  }
@@ -310,7 +340,7 @@ class y {
310
340
  const t = this.#e;
311
341
  for (let e = 0; e < this.#o; e++) {
312
342
  const n = t.#t[e];
313
- if (!(n instanceof y && n.type === "!"))
343
+ if (!(n instanceof E && n.type === "!"))
314
344
  return !1;
315
345
  }
316
346
  return !0;
@@ -329,90 +359,90 @@ class y {
329
359
  typeof t == "string" ? this.push(t) : this.push(t.clone(this));
330
360
  }
331
361
  clone(t) {
332
- const e = new y(this.type, t);
362
+ const e = new E(this.type, t);
333
363
  for (const n of this.#t)
334
364
  e.copyIn(n);
335
365
  return e;
336
366
  }
337
- static #l(t, e, n, i) {
338
- let r = !1, o = !1, a = -1, h = !1;
367
+ static #h(t, e, n, r) {
368
+ let i = !1, o = !1, l = -1, a = !1;
339
369
  if (e.type === null) {
340
- let u = n, g = "";
370
+ let u = n, m = "";
341
371
  for (; u < t.length; ) {
342
372
  const d = t.charAt(u++);
343
- if (r || d === "\\") {
344
- r = !r, g += d;
373
+ if (i || d === "\\") {
374
+ i = !i, m += d;
345
375
  continue;
346
376
  }
347
377
  if (o) {
348
- u === a + 1 ? (d === "^" || d === "!") && (h = !0) : d === "]" && !(u === a + 2 && h) && (o = !1), g += d;
378
+ u === l + 1 ? (d === "^" || d === "!") && (a = !0) : d === "]" && !(u === l + 2 && a) && (o = !1), m += d;
349
379
  continue;
350
380
  } else if (d === "[") {
351
- o = !0, a = u, h = !1, g += d;
381
+ o = !0, l = u, a = !1, m += d;
352
382
  continue;
353
383
  }
354
- if (!i.noext && z(d) && t.charAt(u) === "(") {
355
- e.push(g), g = "";
356
- const E = new y(d, e);
357
- u = y.#l(t, E, u, i), e.push(E);
384
+ if (!r.noext && z(d) && t.charAt(u) === "(") {
385
+ e.push(m), m = "";
386
+ const S = new E(d, e);
387
+ u = E.#h(t, S, u, r), e.push(S);
358
388
  continue;
359
389
  }
360
- g += d;
390
+ m += d;
361
391
  }
362
- return e.push(g), u;
392
+ return e.push(m), u;
363
393
  }
364
- let l = n + 1, c = new y(null, e);
394
+ let h = n + 1, c = new E(null, e);
365
395
  const p = [];
366
396
  let f = "";
367
- for (; l < t.length; ) {
368
- const u = t.charAt(l++);
369
- if (r || u === "\\") {
370
- r = !r, f += u;
397
+ for (; h < t.length; ) {
398
+ const u = t.charAt(h++);
399
+ if (i || u === "\\") {
400
+ i = !i, f += u;
371
401
  continue;
372
402
  }
373
403
  if (o) {
374
- l === a + 1 ? (u === "^" || u === "!") && (h = !0) : u === "]" && !(l === a + 2 && h) && (o = !1), f += u;
404
+ h === l + 1 ? (u === "^" || u === "!") && (a = !0) : u === "]" && !(h === l + 2 && a) && (o = !1), f += u;
375
405
  continue;
376
406
  } else if (u === "[") {
377
- o = !0, a = l, h = !1, f += u;
407
+ o = !0, l = h, a = !1, f += u;
378
408
  continue;
379
409
  }
380
- if (z(u) && t.charAt(l) === "(") {
410
+ if (z(u) && t.charAt(h) === "(") {
381
411
  c.push(f), f = "";
382
- const g = new y(u, c);
383
- c.push(g), l = y.#l(t, g, l, i);
412
+ const m = new E(u, c);
413
+ c.push(m), h = E.#h(t, m, h, r);
384
414
  continue;
385
415
  }
386
416
  if (u === "|") {
387
- c.push(f), f = "", p.push(c), c = new y(null, e);
417
+ c.push(f), f = "", p.push(c), c = new E(null, e);
388
418
  continue;
389
419
  }
390
420
  if (u === ")")
391
- return f === "" && e.#t.length === 0 && (e.#u = !0), c.push(f), f = "", e.push(...p, c), l;
421
+ return f === "" && e.#t.length === 0 && (e.#u = !0), c.push(f), f = "", e.push(...p, c), h;
392
422
  f += u;
393
423
  }
394
- return e.type = null, e.#n = void 0, e.#t = [t.substring(n - 1)], l;
424
+ return e.type = null, e.#n = void 0, e.#t = [t.substring(n - 1)], h;
395
425
  }
396
426
  static fromGlob(t, e = {}) {
397
- const n = new y(null, void 0, e);
398
- return y.#l(t, n, 0, e), n;
427
+ const n = new E(null, void 0, e);
428
+ return E.#h(t, n, 0, e), n;
399
429
  }
400
430
  // returns the regular expression if there's magic, or the unescaped
401
431
  // string if not.
402
432
  toMMPattern() {
403
433
  if (this !== this.#s)
404
434
  return this.#s.toMMPattern();
405
- const t = this.toString(), [e, n, i, r] = this.toRegExpSource();
406
- if (!(i || this.#n || this.#i.nocase && !this.#i.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase()))
435
+ const t = this.toString(), [e, n, r, i] = this.toRegExpSource();
436
+ if (!(r || this.#n || this.#r.nocase && !this.#r.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase()))
407
437
  return n;
408
- const a = (this.#i.nocase ? "i" : "") + (r ? "u" : "");
409
- return Object.assign(new RegExp(`^${e}$`, a), {
438
+ const l = (this.#r.nocase ? "i" : "") + (i ? "u" : "");
439
+ return Object.assign(new RegExp(`^${e}$`, l), {
410
440
  _src: e,
411
441
  _glob: t
412
442
  });
413
443
  }
414
444
  get options() {
415
- return this.#i;
445
+ return this.#r;
416
446
  }
417
447
  // returns the string match, the regexp source, whether there's magic
418
448
  // in the regexp (so a regular expression is required) and whether or
@@ -484,168 +514,168 @@ class y {
484
514
  // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
485
515
  // or start or whatever) and prepend ^ or / at the Regexp construction.
486
516
  toRegExpSource(t) {
487
- const e = t ?? !!this.#i.dot;
517
+ const e = t ?? !!this.#r.dot;
488
518
  if (this.#s === this && this.#p(), !this.type) {
489
- const h = this.isStart() && this.isEnd(), l = this.#t.map((u) => {
490
- const [g, d, E, v] = typeof u == "string" ? y.#d(u, this.#n, h) : u.toRegExpSource(t);
491
- return this.#n = this.#n || E, this.#r = this.#r || v, g;
519
+ const a = this.isStart() && this.isEnd(), h = this.#t.map((u) => {
520
+ const [m, d, S, b] = typeof u == "string" ? E.#d(u, this.#n, a) : u.toRegExpSource(t);
521
+ return this.#n = this.#n || S, this.#i = this.#i || b, m;
492
522
  }).join("");
493
523
  let c = "";
494
- if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && Rt.has(this.#t[0]))) {
495
- const g = Pt, d = (
524
+ if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && Ct.has(this.#t[0]))) {
525
+ const m = Rt, d = (
496
526
  // dots are allowed, and the pattern starts with [ or .
497
- e && g.has(l.charAt(0)) || // the pattern starts with \., and then [ or .
498
- l.startsWith("\\.") && g.has(l.charAt(2)) || // the pattern starts with \.\., and then [ or .
499
- l.startsWith("\\.\\.") && g.has(l.charAt(4))
500
- ), E = !e && !t && g.has(l.charAt(0));
501
- c = d ? Mt : E ? R : "";
527
+ e && m.has(h.charAt(0)) || // the pattern starts with \., and then [ or .
528
+ h.startsWith("\\.") && m.has(h.charAt(2)) || // the pattern starts with \.\., and then [ or .
529
+ h.startsWith("\\.\\.") && m.has(h.charAt(4))
530
+ ), S = !e && !t && m.has(h.charAt(0));
531
+ c = d ? Pt : S ? R : "";
502
532
  }
503
533
  let p = "";
504
534
  return this.isEnd() && this.#s.#c && this.#e?.type === "!" && (p = "(?:$|\\/)"), [
505
- c + l + p,
506
- M(l),
535
+ c + h + p,
536
+ M(h),
507
537
  this.#n = !!this.#n,
508
- this.#r
538
+ this.#i
509
539
  ];
510
540
  }
511
- const n = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:";
512
- let r = this.#f(e);
513
- if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
514
- const h = this.toString();
515
- return this.#t = [h], this.type = null, this.#n = void 0, [h, M(this.toString()), !1, !1];
541
+ const n = this.type === "*" || this.type === "+", r = this.type === "!" ? "(?:(?!(?:" : "(?:";
542
+ let i = this.#f(e);
543
+ if (this.isStart() && this.isEnd() && !i && this.type !== "!") {
544
+ const a = this.toString();
545
+ return this.#t = [a], this.type = null, this.#n = void 0, [a, M(this.toString()), !1, !1];
516
546
  }
517
547
  let o = !n || t || e || !R ? "" : this.#f(!0);
518
- o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
519
- let a = "";
548
+ o === i && (o = ""), o && (i = `(?:${i})(?:${o})*?`);
549
+ let l = "";
520
550
  if (this.type === "!" && this.#u)
521
- a = (this.isStart() && !e ? R : "") + B;
551
+ l = (this.isStart() && !e ? R : "") + B;
522
552
  else {
523
- const h = this.type === "!" ? (
553
+ const a = this.type === "!" ? (
524
554
  // !() must match something,but !(x) can match ''
525
555
  "))" + (this.isStart() && !e && !t ? R : "") + _ + ")"
526
556
  ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
527
- a = i + r + h;
557
+ l = r + i + a;
528
558
  }
529
559
  return [
530
- a,
531
- M(r),
560
+ l,
561
+ M(i),
532
562
  this.#n = !!this.#n,
533
- this.#r
563
+ this.#i
534
564
  ];
535
565
  }
536
566
  #f(t) {
537
567
  return this.#t.map((e) => {
538
568
  if (typeof e == "string")
539
569
  throw new Error("string type in extglob ast??");
540
- const [n, i, r, o] = e.toRegExpSource(t);
541
- return this.#r = this.#r || o, n;
570
+ const [n, r, i, o] = e.toRegExpSource(t);
571
+ return this.#i = this.#i || o, n;
542
572
  }).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
543
573
  }
544
574
  static #d(t, e, n = !1) {
545
- let i = !1, r = "", o = !1;
546
- for (let a = 0; a < t.length; a++) {
547
- const h = t.charAt(a);
548
- if (i) {
549
- i = !1, r += (Ct.has(h) ? "\\" : "") + h;
575
+ let r = !1, i = "", o = !1;
576
+ for (let l = 0; l < t.length; l++) {
577
+ const a = t.charAt(l);
578
+ if (r) {
579
+ r = !1, i += (It.has(a) ? "\\" : "") + a;
550
580
  continue;
551
581
  }
552
- if (h === "\\") {
553
- a === t.length - 1 ? r += "\\\\" : i = !0;
582
+ if (a === "\\") {
583
+ l === t.length - 1 ? i += "\\\\" : r = !0;
554
584
  continue;
555
585
  }
556
- if (h === "[") {
557
- const [l, c, p, f] = $t(t, a);
586
+ if (a === "[") {
587
+ const [h, c, p, f] = Tt(t, l);
558
588
  if (p) {
559
- r += l, o = o || c, a += p - 1, e = e || f;
589
+ i += h, o = o || c, l += p - 1, e = e || f;
560
590
  continue;
561
591
  }
562
592
  }
563
- if (h === "*") {
564
- n && t === "*" ? r += B : r += _, e = !0;
593
+ if (a === "*") {
594
+ n && t === "*" ? i += B : i += _, e = !0;
565
595
  continue;
566
596
  }
567
- if (h === "?") {
568
- r += j, e = !0;
597
+ if (a === "?") {
598
+ i += F, e = !0;
569
599
  continue;
570
600
  }
571
- r += Dt(h);
601
+ i += Dt(a);
572
602
  }
573
- return [r, M(t), !!e, o];
603
+ return [i, M(t), !!e, o];
574
604
  }
575
605
  }
576
- const Lt = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&"), w = (s, t, e = {}) => (C(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D(t, e).match(s)), Ft = /^\*+([^+@!?\*\[\(]*)$/, jt = (s) => (t) => !t.startsWith(".") && t.endsWith(s), It = (s) => (t) => t.endsWith(s), Ut = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), Wt = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), kt = /^\*+\.\*+$/, zt = (s) => !s.startsWith(".") && s.includes("."), _t = (s) => s !== "." && s !== ".." && s.includes("."), Bt = /^\.\*+$/, qt = (s) => s !== "." && s !== ".." && s.startsWith("."), Gt = /^\*+$/, Ht = (s) => s.length !== 0 && !s.startsWith("."), Zt = (s) => s.length !== 0 && s !== "." && s !== "..", Jt = /^\?+([^+@!?\*\[\(]*)?$/, Vt = ([s, t = ""]) => {
577
- const e = K([s]);
606
+ const Lt = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&"), y = (s, t, e = {}) => (C(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new I(t, e).match(s)), Ft = /^\*+([^+@!?\*\[\(]*)$/, kt = (s) => (t) => !t.startsWith(".") && t.endsWith(s), Ut = (s) => (t) => t.endsWith(s), Wt = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), jt = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), zt = /^\*+\.\*+$/, _t = (s) => !s.startsWith(".") && s.includes("."), Bt = (s) => s !== "." && s !== ".." && s.includes("."), qt = /^\.\*+$/, Gt = (s) => s !== "." && s !== ".." && s.startsWith("."), Ht = /^\*+$/, Vt = (s) => s.length !== 0 && !s.startsWith("."), Zt = (s) => s.length !== 0 && s !== "." && s !== "..", Yt = /^\?+([^+@!?\*\[\(]*)?$/, Jt = ([s, t = ""]) => {
607
+ const e = Q([s]);
578
608
  return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
579
609
  }, Xt = ([s, t = ""]) => {
580
- const e = Q([s]);
610
+ const e = K([s]);
581
611
  return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
582
- }, Yt = ([s, t = ""]) => {
583
- const e = Q([s]);
612
+ }, Qt = ([s, t = ""]) => {
613
+ const e = K([s]);
584
614
  return t ? (n) => e(n) && n.endsWith(t) : e;
585
615
  }, Kt = ([s, t = ""]) => {
586
- const e = K([s]);
616
+ const e = Q([s]);
587
617
  return t ? (n) => e(n) && n.endsWith(t) : e;
588
- }, K = ([s]) => {
618
+ }, Q = ([s]) => {
589
619
  const t = s.length;
590
620
  return (e) => e.length === t && !e.startsWith(".");
591
- }, Q = ([s]) => {
621
+ }, K = ([s]) => {
592
622
  const t = s.length;
593
623
  return (e) => e.length === t && e !== "." && e !== "..";
594
624
  }, tt = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", q = {
595
625
  win32: { sep: "\\" },
596
626
  posix: { sep: "/" }
597
- }, Qt = tt === "win32" ? q.win32.sep : q.posix.sep;
598
- w.sep = Qt;
599
- const O = Symbol("globstar **");
600
- w.GLOBSTAR = O;
601
- const te = "[^/]", ee = te + "*?", se = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", ne = "(?:(?!(?:\\/|^)\\.).)*?", ie = (s, t = {}) => (e) => w(e, s, t);
602
- w.filter = ie;
603
- const b = (s, t = {}) => Object.assign({}, s, t), re = (s) => {
627
+ }, te = tt === "win32" ? q.win32.sep : q.posix.sep;
628
+ y.sep = te;
629
+ const N = Symbol("globstar **");
630
+ y.GLOBSTAR = N;
631
+ const ee = "[^/]", se = ee + "*?", ne = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", re = "(?:(?!(?:\\/|^)\\.).)*?", ie = (s, t = {}) => (e) => y(e, s, t);
632
+ y.filter = ie;
633
+ const O = (s, t = {}) => Object.assign({}, s, t), oe = (s) => {
604
634
  if (!s || typeof s != "object" || !Object.keys(s).length)
605
- return w;
606
- const t = w;
607
- return Object.assign((n, i, r = {}) => t(n, i, b(s, r)), {
635
+ return y;
636
+ const t = y;
637
+ return Object.assign((n, r, i = {}) => t(n, r, O(s, i)), {
608
638
  Minimatch: class extends t.Minimatch {
609
- constructor(i, r = {}) {
610
- super(i, b(s, r));
639
+ constructor(r, i = {}) {
640
+ super(r, O(s, i));
611
641
  }
612
- static defaults(i) {
613
- return t.defaults(b(s, i)).Minimatch;
642
+ static defaults(r) {
643
+ return t.defaults(O(s, r)).Minimatch;
614
644
  }
615
645
  },
616
646
  AST: class extends t.AST {
617
647
  /* c8 ignore start */
618
- constructor(i, r, o = {}) {
619
- super(i, r, b(s, o));
648
+ constructor(r, i, o = {}) {
649
+ super(r, i, O(s, o));
620
650
  }
621
651
  /* c8 ignore stop */
622
- static fromGlob(i, r = {}) {
623
- return t.AST.fromGlob(i, b(s, r));
652
+ static fromGlob(r, i = {}) {
653
+ return t.AST.fromGlob(r, O(s, i));
624
654
  }
625
655
  },
626
- unescape: (n, i = {}) => t.unescape(n, b(s, i)),
627
- escape: (n, i = {}) => t.escape(n, b(s, i)),
628
- filter: (n, i = {}) => t.filter(n, b(s, i)),
629
- defaults: (n) => t.defaults(b(s, n)),
630
- makeRe: (n, i = {}) => t.makeRe(n, b(s, i)),
631
- braceExpand: (n, i = {}) => t.braceExpand(n, b(s, i)),
632
- match: (n, i, r = {}) => t.match(n, i, b(s, r)),
656
+ unescape: (n, r = {}) => t.unescape(n, O(s, r)),
657
+ escape: (n, r = {}) => t.escape(n, O(s, r)),
658
+ filter: (n, r = {}) => t.filter(n, O(s, r)),
659
+ defaults: (n) => t.defaults(O(s, n)),
660
+ makeRe: (n, r = {}) => t.makeRe(n, O(s, r)),
661
+ braceExpand: (n, r = {}) => t.braceExpand(n, O(s, r)),
662
+ match: (n, r, i = {}) => t.match(n, r, O(s, i)),
633
663
  sep: t.sep,
634
- GLOBSTAR: O
664
+ GLOBSTAR: N
635
665
  });
636
666
  };
637
- w.defaults = re;
638
- const et = (s, t = {}) => (C(s), t.nobrace || !/\{(?:(?!\{).)*\}/.test(s) ? [s] : Et(s));
639
- w.braceExpand = et;
640
- const oe = (s, t = {}) => new D(s, t).makeRe();
641
- w.makeRe = oe;
642
- const ce = (s, t, e = {}) => {
643
- const n = new D(t, e);
644
- return s = s.filter((i) => n.match(i)), n.options.nonull && !s.length && s.push(t), s;
667
+ y.defaults = oe;
668
+ const et = (s, t = {}) => (C(s), t.nobrace || !/\{(?:(?!\{).)*\}/.test(s) ? [s] : St(s));
669
+ y.braceExpand = et;
670
+ const ce = (s, t = {}) => new I(s, t).makeRe();
671
+ y.makeRe = ce;
672
+ const ae = (s, t, e = {}) => {
673
+ const n = new I(t, e);
674
+ return s = s.filter((r) => n.match(r)), n.options.nonull && !s.length && s.push(t), s;
645
675
  };
646
- w.match = ce;
647
- const G = /[?*]|[+@!]\(.*?\)|\[|\]/, ae = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
648
- class D {
676
+ y.match = ae;
677
+ const G = /[?*]|[+@!]\(.*?\)|\[|\]/, le = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
678
+ class I {
649
679
  options;
650
680
  set;
651
681
  pattern;
@@ -687,23 +717,23 @@ class D {
687
717
  this.empty = !0;
688
718
  return;
689
719
  }
690
- this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(this.pattern, this.globSet);
691
- const n = this.globSet.map((r) => this.slashSplit(r));
720
+ this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...i) => console.error(...i)), this.debug(this.pattern, this.globSet);
721
+ const n = this.globSet.map((i) => this.slashSplit(i));
692
722
  this.globParts = this.preprocess(n), this.debug(this.pattern, this.globParts);
693
- let i = this.globParts.map((r, o, a) => {
723
+ let r = this.globParts.map((i, o, l) => {
694
724
  if (this.isWindows && this.windowsNoMagicRoot) {
695
- const h = r[0] === "" && r[1] === "" && (r[2] === "?" || !G.test(r[2])) && !G.test(r[3]), l = /^[a-z]:/i.test(r[0]);
725
+ const a = i[0] === "" && i[1] === "" && (i[2] === "?" || !G.test(i[2])) && !G.test(i[3]), h = /^[a-z]:/i.test(i[0]);
726
+ if (a)
727
+ return [...i.slice(0, 4), ...i.slice(4).map((c) => this.parse(c))];
696
728
  if (h)
697
- return [...r.slice(0, 4), ...r.slice(4).map((c) => this.parse(c))];
698
- if (l)
699
- return [r[0], ...r.slice(1).map((c) => this.parse(c))];
729
+ return [i[0], ...i.slice(1).map((c) => this.parse(c))];
700
730
  }
701
- return r.map((h) => this.parse(h));
731
+ return i.map((a) => this.parse(a));
702
732
  });
703
- if (this.debug(this.pattern, i), this.set = i.filter((r) => r.indexOf(!1) === -1), this.isWindows)
704
- for (let r = 0; r < this.set.length; r++) {
705
- const o = this.set[r];
706
- o[0] === "" && o[1] === "" && this.globParts[r][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
733
+ if (this.debug(this.pattern, r), this.set = r.filter((i) => i.indexOf(!1) === -1), this.isWindows)
734
+ for (let i = 0; i < this.set.length; i++) {
735
+ const o = this.set[i];
736
+ o[0] === "" && o[1] === "" && this.globParts[i][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
707
737
  }
708
738
  this.debug(this.pattern, this.set);
709
739
  }
@@ -715,8 +745,8 @@ class D {
715
745
  preprocess(t) {
716
746
  if (this.options.noglobstar)
717
747
  for (let n = 0; n < t.length; n++)
718
- for (let i = 0; i < t[n].length; i++)
719
- t[n][i] === "**" && (t[n][i] = "*");
748
+ for (let r = 0; r < t[n].length; r++)
749
+ t[n][r] === "**" && (t[n][r] = "*");
720
750
  const { optimizationLevel: e = 1 } = this.options;
721
751
  return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t;
722
752
  }
@@ -725,19 +755,19 @@ class D {
725
755
  return t.map((e) => {
726
756
  let n = -1;
727
757
  for (; (n = e.indexOf("**", n + 1)) !== -1; ) {
728
- let i = n;
729
- for (; e[i + 1] === "**"; )
730
- i++;
731
- i !== n && e.splice(n, i - n);
758
+ let r = n;
759
+ for (; e[r + 1] === "**"; )
760
+ r++;
761
+ r !== n && e.splice(n, r - n);
732
762
  }
733
763
  return e;
734
764
  });
735
765
  }
736
766
  // get rid of adjascent ** and resolve .. portions
737
767
  levelOneOptimize(t) {
738
- return t.map((e) => (e = e.reduce((n, i) => {
739
- const r = n[n.length - 1];
740
- return i === "**" && r === "**" ? n : i === ".." && r && r !== ".." && r !== "." && r !== "**" ? (n.pop(), n) : (n.push(i), n);
768
+ return t.map((e) => (e = e.reduce((n, r) => {
769
+ const i = n[n.length - 1];
770
+ return r === "**" && i === "**" ? n : r === ".." && i && i !== ".." && i !== "." && i !== "**" ? (n.pop(), n) : (n.push(r), n);
741
771
  }, []), e.length === 0 ? [""] : e));
742
772
  }
743
773
  levelTwoFileOptimize(t) {
@@ -745,16 +775,16 @@ class D {
745
775
  let e = !1;
746
776
  do {
747
777
  if (e = !1, !this.preserveMultipleSlashes) {
748
- for (let i = 1; i < t.length - 1; i++) {
749
- const r = t[i];
750
- i === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = !0, t.splice(i, 1), i--);
778
+ for (let r = 1; r < t.length - 1; r++) {
779
+ const i = t[r];
780
+ r === 1 && i === "" && t[0] === "" || (i === "." || i === "") && (e = !0, t.splice(r, 1), r--);
751
781
  }
752
782
  t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = !0, t.pop());
753
783
  }
754
784
  let n = 0;
755
785
  for (; (n = t.indexOf("..", n + 1)) !== -1; ) {
756
- const i = t[n - 1];
757
- i && i !== "." && i !== ".." && i !== "**" && (e = !0, t.splice(n - 1, 2), n -= 2);
786
+ const r = t[n - 1];
787
+ r && r !== "." && r !== ".." && r !== "**" && (e = !0, t.splice(n - 1, 2), n -= 2);
758
788
  }
759
789
  } while (e);
760
790
  return t.length === 0 ? [""] : t;
@@ -782,34 +812,34 @@ class D {
782
812
  do {
783
813
  e = !1;
784
814
  for (let n of t) {
785
- let i = -1;
786
- for (; (i = n.indexOf("**", i + 1)) !== -1; ) {
787
- let o = i;
815
+ let r = -1;
816
+ for (; (r = n.indexOf("**", r + 1)) !== -1; ) {
817
+ let o = r;
788
818
  for (; n[o + 1] === "**"; )
789
819
  o++;
790
- o > i && n.splice(i + 1, o - i);
791
- let a = n[i + 1];
792
- const h = n[i + 2], l = n[i + 3];
793
- if (a !== ".." || !h || h === "." || h === ".." || !l || l === "." || l === "..")
820
+ o > r && n.splice(r + 1, o - r);
821
+ let l = n[r + 1];
822
+ const a = n[r + 2], h = n[r + 3];
823
+ if (l !== ".." || !a || a === "." || a === ".." || !h || h === "." || h === "..")
794
824
  continue;
795
- e = !0, n.splice(i, 1);
825
+ e = !0, n.splice(r, 1);
796
826
  const c = n.slice(0);
797
- c[i] = "**", t.push(c), i--;
827
+ c[r] = "**", t.push(c), r--;
798
828
  }
799
829
  if (!this.preserveMultipleSlashes) {
800
830
  for (let o = 1; o < n.length - 1; o++) {
801
- const a = n[o];
802
- o === 1 && a === "" && n[0] === "" || (a === "." || a === "") && (e = !0, n.splice(o, 1), o--);
831
+ const l = n[o];
832
+ o === 1 && l === "" && n[0] === "" || (l === "." || l === "") && (e = !0, n.splice(o, 1), o--);
803
833
  }
804
834
  n[0] === "." && n.length === 2 && (n[1] === "." || n[1] === "") && (e = !0, n.pop());
805
835
  }
806
- let r = 0;
807
- for (; (r = n.indexOf("..", r + 1)) !== -1; ) {
808
- const o = n[r - 1];
836
+ let i = 0;
837
+ for (; (i = n.indexOf("..", i + 1)) !== -1; ) {
838
+ const o = n[i - 1];
809
839
  if (o && o !== "." && o !== ".." && o !== "**") {
810
840
  e = !0;
811
- const h = r === 1 && n[r + 1] === "**" ? ["."] : [];
812
- n.splice(r - 1, 2, ...h), n.length === 0 && n.push(""), r -= 2;
841
+ const a = i === 1 && n[i + 1] === "**" ? ["."] : [];
842
+ n.splice(i - 1, 2, ...a), n.length === 0 && n.push(""), i -= 2;
813
843
  }
814
844
  }
815
845
  }
@@ -826,31 +856,31 @@ class D {
826
856
  secondPhasePreProcess(t) {
827
857
  for (let e = 0; e < t.length - 1; e++)
828
858
  for (let n = e + 1; n < t.length; n++) {
829
- const i = this.partsMatch(t[e], t[n], !this.preserveMultipleSlashes);
830
- if (i) {
831
- t[e] = [], t[n] = i;
859
+ const r = this.partsMatch(t[e], t[n], !this.preserveMultipleSlashes);
860
+ if (r) {
861
+ t[e] = [], t[n] = r;
832
862
  break;
833
863
  }
834
864
  }
835
865
  return t.filter((e) => e.length);
836
866
  }
837
867
  partsMatch(t, e, n = !1) {
838
- let i = 0, r = 0, o = [], a = "";
839
- for (; i < t.length && r < e.length; )
840
- if (t[i] === e[r])
841
- o.push(a === "b" ? e[r] : t[i]), i++, r++;
842
- else if (n && t[i] === "**" && e[r] === t[i + 1])
843
- o.push(t[i]), i++;
844
- else if (n && e[r] === "**" && t[i] === e[r + 1])
845
- o.push(e[r]), r++;
846
- else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
847
- if (a === "b")
868
+ let r = 0, i = 0, o = [], l = "";
869
+ for (; r < t.length && i < e.length; )
870
+ if (t[r] === e[i])
871
+ o.push(l === "b" ? e[i] : t[r]), r++, i++;
872
+ else if (n && t[r] === "**" && e[i] === t[r + 1])
873
+ o.push(t[r]), r++;
874
+ else if (n && e[i] === "**" && t[r] === e[i + 1])
875
+ o.push(e[i]), i++;
876
+ else if (t[r] === "*" && e[i] && (this.options.dot || !e[i].startsWith(".")) && e[i] !== "**") {
877
+ if (l === "b")
848
878
  return !1;
849
- a = "a", o.push(t[i]), i++, r++;
850
- } else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
851
- if (a === "a")
879
+ l = "a", o.push(t[r]), r++, i++;
880
+ } else if (e[i] === "*" && t[r] && (this.options.dot || !t[r].startsWith(".")) && t[r] !== "**") {
881
+ if (l === "a")
852
882
  return !1;
853
- a = "b", o.push(e[r]), i++, r++;
883
+ l = "b", o.push(e[i]), r++, i++;
854
884
  } else
855
885
  return !1;
856
886
  return t.length === e.length && o;
@@ -860,7 +890,7 @@ class D {
860
890
  return;
861
891
  const t = this.pattern;
862
892
  let e = !1, n = 0;
863
- for (let i = 0; i < t.length && t.charAt(i) === "!"; i++)
893
+ for (let r = 0; r < t.length && t.charAt(r) === "!"; r++)
864
894
  e = !e, n++;
865
895
  n && (this.pattern = t.slice(n)), this.negate = e;
866
896
  }
@@ -870,54 +900,54 @@ class D {
870
900
  // out of pattern, then that's fine, as long as all
871
901
  // the parts match.
872
902
  matchOne(t, e, n = !1) {
873
- const i = this.options;
903
+ const r = this.options;
874
904
  if (this.isWindows) {
875
- const d = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), E = !d && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), v = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), A = !v && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), S = E ? 3 : d ? 0 : void 0, m = A ? 3 : v ? 0 : void 0;
876
- if (typeof S == "number" && typeof m == "number") {
877
- const [N, P] = [t[S], e[m]];
878
- N.toLowerCase() === P.toLowerCase() && (e[m] = N, m > S ? e = e.slice(m) : S > m && (t = t.slice(S)));
905
+ const d = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), S = !d && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), b = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), A = !b && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), x = S ? 3 : d ? 0 : void 0, w = A ? 3 : b ? 0 : void 0;
906
+ if (typeof x == "number" && typeof w == "number") {
907
+ const [v, P] = [t[x], e[w]];
908
+ v.toLowerCase() === P.toLowerCase() && (e[w] = v, w > x ? e = e.slice(w) : x > w && (t = t.slice(x)));
879
909
  }
880
910
  }
881
- const { optimizationLevel: r = 1 } = this.options;
882
- r >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, { file: t, pattern: e }), this.debug("matchOne", t.length, e.length);
883
- for (var o = 0, a = 0, h = t.length, l = e.length; o < h && a < l; o++, a++) {
911
+ const { optimizationLevel: i = 1 } = this.options;
912
+ i >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, { file: t, pattern: e }), this.debug("matchOne", t.length, e.length);
913
+ for (var o = 0, l = 0, a = t.length, h = e.length; o < a && l < h; o++, l++) {
884
914
  this.debug("matchOne loop");
885
- var c = e[a], p = t[o];
915
+ var c = e[l], p = t[o];
886
916
  if (this.debug(e, c, p), c === !1)
887
917
  return !1;
888
- if (c === O) {
918
+ if (c === N) {
889
919
  this.debug("GLOBSTAR", [e, c, p]);
890
- var f = o, u = a + 1;
891
- if (u === l) {
892
- for (this.debug("** at the end"); o < h; o++)
893
- if (t[o] === "." || t[o] === ".." || !i.dot && t[o].charAt(0) === ".")
920
+ var f = o, u = l + 1;
921
+ if (u === h) {
922
+ for (this.debug("** at the end"); o < a; o++)
923
+ if (t[o] === "." || t[o] === ".." || !r.dot && t[o].charAt(0) === ".")
894
924
  return !1;
895
925
  return !0;
896
926
  }
897
- for (; f < h; ) {
898
- var g = t[f];
927
+ for (; f < a; ) {
928
+ var m = t[f];
899
929
  if (this.debug(`
900
- globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
901
- return this.debug("globstar found match!", f, h, g), !0;
902
- if (g === "." || g === ".." || !i.dot && g.charAt(0) === ".") {
930
+ globstar while`, t, f, e, u, m), this.matchOne(t.slice(f), e.slice(u), n))
931
+ return this.debug("globstar found match!", f, a, m), !0;
932
+ if (m === "." || m === ".." || !r.dot && m.charAt(0) === ".") {
903
933
  this.debug("dot detected!", t, f, e, u);
904
934
  break;
905
935
  }
906
936
  this.debug("globstar swallow a segment, and continue"), f++;
907
937
  }
908
938
  return !!(n && (this.debug(`
909
- >>> no match, partial?`, t, f, e, u), f === h));
939
+ >>> no match, partial?`, t, f, e, u), f === a));
910
940
  }
911
941
  let d;
912
942
  if (typeof c == "string" ? (d = p === c, this.debug("string match", c, p, d)) : (d = c.test(p), this.debug("pattern match", c, p, d)), !d)
913
943
  return !1;
914
944
  }
915
- if (o === h && a === l)
945
+ if (o === a && l === h)
916
946
  return !0;
917
- if (o === h)
947
+ if (o === a)
918
948
  return n;
919
- if (a === l)
920
- return o === h - 1 && t[o] === "";
949
+ if (l === h)
950
+ return o === a - 1 && t[o] === "";
921
951
  throw new Error("wtf?");
922
952
  }
923
953
  braceExpand() {
@@ -927,13 +957,13 @@ globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
927
957
  C(t);
928
958
  const e = this.options;
929
959
  if (t === "**")
930
- return O;
960
+ return N;
931
961
  if (t === "")
932
962
  return "";
933
- let n, i = null;
934
- (n = t.match(Gt)) ? i = e.dot ? Zt : Ht : (n = t.match(Ft)) ? i = (e.nocase ? e.dot ? Wt : Ut : e.dot ? It : jt)(n[1]) : (n = t.match(Jt)) ? i = (e.nocase ? e.dot ? Xt : Vt : e.dot ? Yt : Kt)(n) : (n = t.match(kt)) ? i = e.dot ? _t : zt : (n = t.match(Bt)) && (i = qt);
935
- const r = y.fromGlob(t, this.options).toMMPattern();
936
- return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
963
+ let n, r = null;
964
+ (n = t.match(Ht)) ? r = e.dot ? Zt : Vt : (n = t.match(Ft)) ? r = (e.nocase ? e.dot ? jt : Wt : e.dot ? Ut : kt)(n[1]) : (n = t.match(Yt)) ? r = (e.nocase ? e.dot ? Xt : Jt : e.dot ? Qt : Kt)(n) : (n = t.match(zt)) ? r = e.dot ? Bt : _t : (n = t.match(qt)) && (r = Gt);
965
+ const i = E.fromGlob(t, this.options).toMMPattern();
966
+ return r && typeof i == "object" && Reflect.defineProperty(i, "test", { value: r }), i;
937
967
  }
938
968
  makeRe() {
939
969
  if (this.regexp || this.regexp === !1)
@@ -941,23 +971,23 @@ globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
941
971
  const t = this.set;
942
972
  if (!t.length)
943
973
  return this.regexp = !1, this.regexp;
944
- const e = this.options, n = e.noglobstar ? ee : e.dot ? se : ne, i = new Set(e.nocase ? ["i"] : []);
945
- let r = t.map((h) => {
946
- const l = h.map((c) => {
974
+ const e = this.options, n = e.noglobstar ? se : e.dot ? ne : re, r = new Set(e.nocase ? ["i"] : []);
975
+ let i = t.map((a) => {
976
+ const h = a.map((c) => {
947
977
  if (c instanceof RegExp)
948
978
  for (const p of c.flags.split(""))
949
- i.add(p);
950
- return typeof c == "string" ? ae(c) : c === O ? O : c._src;
979
+ r.add(p);
980
+ return typeof c == "string" ? le(c) : c === N ? N : c._src;
951
981
  });
952
- return l.forEach((c, p) => {
953
- const f = l[p + 1], u = l[p - 1];
954
- c !== O || u === O || (u === void 0 ? f !== void 0 && f !== O ? l[p + 1] = "(?:\\/|" + n + "\\/)?" + f : l[p] = n : f === void 0 ? l[p - 1] = u + "(?:\\/|" + n + ")?" : f !== O && (l[p - 1] = u + "(?:\\/|\\/" + n + "\\/)" + f, l[p + 1] = O));
955
- }), l.filter((c) => c !== O).join("/");
982
+ return h.forEach((c, p) => {
983
+ const f = h[p + 1], u = h[p - 1];
984
+ c !== N || u === N || (u === void 0 ? f !== void 0 && f !== N ? h[p + 1] = "(?:\\/|" + n + "\\/)?" + f : h[p] = n : f === void 0 ? h[p - 1] = u + "(?:\\/|" + n + ")?" : f !== N && (h[p - 1] = u + "(?:\\/|\\/" + n + "\\/)" + f, h[p + 1] = N));
985
+ }), h.filter((c) => c !== N).join("/");
956
986
  }).join("|");
957
- const [o, a] = t.length > 1 ? ["(?:", ")"] : ["", ""];
958
- r = "^" + o + r + a + "$", this.negate && (r = "^(?!" + r + ").+$");
987
+ const [o, l] = t.length > 1 ? ["(?:", ")"] : ["", ""];
988
+ i = "^" + o + i + l + "$", this.negate && (i = "^(?!" + i + ").+$");
959
989
  try {
960
- this.regexp = new RegExp(r, [...i].join(""));
990
+ this.regexp = new RegExp(i, [...r].join(""));
961
991
  } catch {
962
992
  this.regexp = !1;
963
993
  }
@@ -975,31 +1005,95 @@ globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
975
1005
  return !0;
976
1006
  const n = this.options;
977
1007
  this.isWindows && (t = t.split("\\").join("/"));
978
- const i = this.slashSplit(t);
979
- this.debug(this.pattern, "split", i);
980
- const r = this.set;
981
- this.debug(this.pattern, "set", r);
982
- let o = i[i.length - 1];
1008
+ const r = this.slashSplit(t);
1009
+ this.debug(this.pattern, "split", r);
1010
+ const i = this.set;
1011
+ this.debug(this.pattern, "set", i);
1012
+ let o = r[r.length - 1];
983
1013
  if (!o)
984
- for (let a = i.length - 2; !o && a >= 0; a--)
985
- o = i[a];
986
- for (let a = 0; a < r.length; a++) {
987
- const h = r[a];
988
- let l = i;
989
- if (n.matchBase && h.length === 1 && (l = [o]), this.matchOne(l, h, e))
1014
+ for (let l = r.length - 2; !o && l >= 0; l--)
1015
+ o = r[l];
1016
+ for (let l = 0; l < i.length; l++) {
1017
+ const a = i[l];
1018
+ let h = r;
1019
+ if (n.matchBase && a.length === 1 && (h = [o]), this.matchOne(h, a, e))
990
1020
  return n.flipNegate ? !0 : !this.negate;
991
1021
  }
992
1022
  return n.flipNegate ? !1 : this.negate;
993
1023
  }
994
1024
  static defaults(t) {
995
- return w.defaults(t).Minimatch;
1025
+ return y.defaults(t).Minimatch;
996
1026
  }
997
1027
  }
998
- w.AST = y;
999
- w.Minimatch = D;
1000
- w.escape = Lt;
1001
- w.unescape = M;
1002
- function he(s, t = "utf-8") {
1028
+ y.AST = E;
1029
+ y.Minimatch = I;
1030
+ y.escape = Lt;
1031
+ y.unescape = M;
1032
+ const he = [
1033
+ // Images
1034
+ ".jpg",
1035
+ ".jpeg",
1036
+ ".png",
1037
+ ".gif",
1038
+ ".bmp",
1039
+ ".webp",
1040
+ ".ico",
1041
+ ".tiff",
1042
+ ".tga",
1043
+ // Audio
1044
+ ".mp3",
1045
+ ".wav",
1046
+ ".ogg",
1047
+ ".flac",
1048
+ ".aac",
1049
+ ".wma",
1050
+ ".m4a",
1051
+ // Video
1052
+ ".mp4",
1053
+ ".avi",
1054
+ ".mov",
1055
+ ".wmv",
1056
+ ".flv",
1057
+ ".webm",
1058
+ ".mkv",
1059
+ ".m4v",
1060
+ // Documents
1061
+ ".pdf",
1062
+ ".doc",
1063
+ ".docx",
1064
+ ".xls",
1065
+ ".xlsx",
1066
+ ".ppt",
1067
+ ".pptx",
1068
+ // Archives
1069
+ ".zip",
1070
+ ".rar",
1071
+ ".7z",
1072
+ ".tar",
1073
+ ".gz",
1074
+ ".bz2",
1075
+ // Executables
1076
+ ".exe",
1077
+ ".dll",
1078
+ ".so",
1079
+ ".dylib",
1080
+ // Other binary formats
1081
+ ".dat",
1082
+ ".db",
1083
+ ".sqlite",
1084
+ ".bin",
1085
+ ".obj",
1086
+ ".fbx",
1087
+ ".3ds"
1088
+ ];
1089
+ function Te(s) {
1090
+ const t = s.lastIndexOf(".");
1091
+ if (t <= 0)
1092
+ return !0;
1093
+ const e = s.slice(t).toLowerCase();
1094
+ return he.includes(e);
1095
+ }
1096
+ function ue(s, t = "utf-8") {
1003
1097
  switch (t) {
1004
1098
  case "utf8":
1005
1099
  case "utf-8":
@@ -1007,24 +1101,24 @@ function he(s, t = "utf-8") {
1007
1101
  case "utf16le":
1008
1102
  case "ucs2":
1009
1103
  case "ucs-2":
1010
- return le(s);
1104
+ return fe(s);
1011
1105
  case "ascii":
1012
- return pe(s);
1106
+ return ge(s);
1013
1107
  case "latin1":
1014
- return fe(s);
1108
+ return de(s);
1015
1109
  case "binary":
1016
1110
  return Uint8Array.from(s, (e) => e.charCodeAt(0));
1017
1111
  case "base64":
1018
1112
  return Uint8Array.from(atob(s), (e) => e.charCodeAt(0));
1019
1113
  case "hex":
1020
1114
  if (!/^[\da-f]+$/i.test(s) || s.length % 2 !== 0)
1021
- throw new x("Invalid hex string", "INVALID_HEX_FORMAT");
1115
+ throw new g("Invalid hex string", "INVALID_HEX_FORMAT");
1022
1116
  return Uint8Array.from(s.match(/.{1,2}/g).map((e) => parseInt(e, 16)));
1023
1117
  default:
1024
1118
  return console.warn("Encoding not supported, falling back to UTF-8"), new TextEncoder().encode(s);
1025
1119
  }
1026
1120
  }
1027
- function Ae(s, t = "utf-8") {
1121
+ function Me(s, t = "utf-8") {
1028
1122
  switch (t) {
1029
1123
  case "utf8":
1030
1124
  case "utf-8":
@@ -1033,7 +1127,7 @@ function Ae(s, t = "utf-8") {
1033
1127
  case "utf-16le":
1034
1128
  case "ucs2":
1035
1129
  case "ucs-2":
1036
- return ue(s);
1130
+ return pe(s);
1037
1131
  case "latin1":
1038
1132
  return String.fromCharCode(...s);
1039
1133
  case "ascii":
@@ -1046,7 +1140,7 @@ function Ae(s, t = "utf-8") {
1046
1140
  return console.warn("Unsupported encoding, falling back to UTF-8"), new TextDecoder().decode(s);
1047
1141
  }
1048
1142
  }
1049
- function le(s) {
1143
+ function fe(s) {
1050
1144
  const t = new Uint8Array(s.length * 2);
1051
1145
  for (let e = 0; e < s.length; e++) {
1052
1146
  const n = s.charCodeAt(e);
@@ -1054,92 +1148,29 @@ function le(s) {
1054
1148
  }
1055
1149
  return t;
1056
1150
  }
1057
- function ue(s) {
1151
+ function pe(s) {
1058
1152
  s.length % 2 !== 0 && (console.warn("Invalid UTF-16LE buffer length, truncating last byte"), s = s.slice(0, s.length - 1));
1059
1153
  const t = new Uint16Array(s.buffer, s.byteOffset, s.byteLength / 2);
1060
1154
  return String.fromCharCode(...t);
1061
1155
  }
1062
- function fe(s) {
1156
+ function de(s) {
1063
1157
  const t = new Uint8Array(s.length);
1064
1158
  for (let e = 0; e < s.length; e++)
1065
1159
  t[e] = s.charCodeAt(e) & 255;
1066
1160
  return t;
1067
1161
  }
1068
- function pe(s) {
1162
+ function ge(s) {
1069
1163
  const t = new Uint8Array(s.length);
1070
1164
  for (let e = 0; e < s.length; e++)
1071
1165
  t[e] = s.charCodeAt(e) & 127;
1072
1166
  return t;
1073
1167
  }
1074
- const de = [
1075
- // Images
1076
- ".jpg",
1077
- ".jpeg",
1078
- ".png",
1079
- ".gif",
1080
- ".bmp",
1081
- ".webp",
1082
- ".svg",
1083
- ".ico",
1084
- ".tiff",
1085
- ".tga",
1086
- // Audio
1087
- ".mp3",
1088
- ".wav",
1089
- ".ogg",
1090
- ".flac",
1091
- ".aac",
1092
- ".wma",
1093
- ".m4a",
1094
- // Video
1095
- ".mp4",
1096
- ".avi",
1097
- ".mov",
1098
- ".wmv",
1099
- ".flv",
1100
- ".webm",
1101
- ".mkv",
1102
- ".m4v",
1103
- // Documents
1104
- ".pdf",
1105
- ".doc",
1106
- ".docx",
1107
- ".xls",
1108
- ".xlsx",
1109
- ".ppt",
1110
- ".pptx",
1111
- // Archives
1112
- ".zip",
1113
- ".rar",
1114
- ".7z",
1115
- ".tar",
1116
- ".gz",
1117
- ".bz2",
1118
- // Executables
1119
- ".exe",
1120
- ".dll",
1121
- ".so",
1122
- ".dylib",
1123
- ".bin",
1124
- // Other binary formats
1125
- ".dat",
1126
- ".db",
1127
- ".sqlite",
1128
- ".bin",
1129
- ".obj",
1130
- ".fbx",
1131
- ".3ds"
1132
- ];
1133
- function Ne(s) {
1134
- const t = s.toLowerCase().substring(s.lastIndexOf("."));
1135
- return de.includes(t);
1136
- }
1137
- function $e() {
1168
+ function Pe() {
1138
1169
  if (!("storage" in navigator) || !("getDirectory" in navigator.storage))
1139
- throw new rt();
1170
+ throw new it();
1140
1171
  }
1141
- async function I(s, t, e) {
1142
- return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(`opfs:${s.replace(/\/+/g, "/").toLowerCase()}`, { mode: t }, e) : e();
1172
+ async function k(s, t, e) {
1173
+ return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(`opfs:${s.replace(/\/+/g, "/")}`, { mode: t }, e) : e();
1143
1174
  }
1144
1175
  function U(s) {
1145
1176
  return Array.isArray(s) ? s : (s.startsWith("~/") ? s.slice(2) : s).split("/").filter(Boolean);
@@ -1151,81 +1182,79 @@ function nt(s) {
1151
1182
  const t = U(s);
1152
1183
  return t[t.length - 1] || "";
1153
1184
  }
1154
- function Te(s) {
1185
+ function Re(s) {
1155
1186
  const t = U(s);
1156
1187
  return t.pop(), st(t);
1157
1188
  }
1158
- function it(s) {
1189
+ function rt(s) {
1159
1190
  return !s || s === "/" ? "/" : s.startsWith("~/") ? `/${s.slice(2)}` : s.startsWith("/") ? s : `/${s}`;
1160
1191
  }
1161
- function Me(s, t = !1) {
1192
+ function Ce(s, t = !1) {
1162
1193
  return s = s.replace(/\/$/, ""), t && !s.includes("*") ? `${s}/**` : s;
1163
1194
  }
1164
- function Pe(s, t) {
1165
- return w(s, t, {
1195
+ function Ie(s, t) {
1196
+ return y(s, t, {
1166
1197
  dot: !0,
1167
1198
  matchBase: !0
1168
1199
  });
1169
1200
  }
1170
- function Re(s, t) {
1201
+ function De(s, t) {
1171
1202
  if (!t || Array.isArray(t) && t.length === 0)
1172
1203
  return !1;
1173
- const e = it(s);
1174
- return (Array.isArray(t) ? t : [t]).some((i) => w(e, i, { dot: !0 }));
1204
+ const e = rt(s);
1205
+ return (Array.isArray(t) ? t : [t]).some((r) => y(e, r, { dot: !0 }));
1175
1206
  }
1176
- function Ce(s) {
1177
- const t = it(s), e = U(t), n = [];
1178
- for (const i of e)
1179
- if (!(i === "." || i === ""))
1180
- if (i === "..") {
1207
+ function Le(s) {
1208
+ const t = rt(s), e = U(t), n = [];
1209
+ for (const r of e)
1210
+ if (!(r === "." || r === ""))
1211
+ if (r === "..") {
1181
1212
  if (n.length === 0)
1182
1213
  continue;
1183
1214
  n.pop();
1184
1215
  } else
1185
- n.push(i);
1216
+ n.push(r);
1186
1217
  return st(n);
1187
1218
  }
1188
- function De(s) {
1219
+ function Fe(s) {
1189
1220
  const t = nt(s), e = t.lastIndexOf(".");
1190
1221
  return e <= 0 || e === t.length - 1 ? "" : t.slice(e);
1191
1222
  }
1192
- function ge(s, t = "utf-8") {
1193
- return typeof s == "string" ? he(s, t) : s instanceof Uint8Array ? s : new Uint8Array(s);
1223
+ function me(s, t = "utf-8") {
1224
+ return typeof s == "string" ? ue(s, t) : s instanceof Uint8Array ? s : new Uint8Array(s);
1194
1225
  }
1195
- async function Le(s, t) {
1196
- return I(t, "shared", async () => {
1226
+ async function ke(s, t) {
1227
+ return k(t, "shared", async () => {
1197
1228
  const n = await (await s.getFile()).arrayBuffer();
1198
1229
  return new Uint8Array(n);
1199
1230
  });
1200
1231
  }
1201
- async function Fe(s, t, e, n, i = {}) {
1202
- const r = async () => {
1203
- let o = null;
1204
- const a = i.append || !1, h = !a && (i.truncate ?? !0);
1232
+ async function Ue(s, t, e, n, r = {}) {
1233
+ const i = async () => {
1234
+ const o = r.append || !1, l = !o && (r.truncate ?? !0), a = await we(s, n || "unknown");
1205
1235
  try {
1206
- o = await s.createSyncAccessHandle();
1207
- const l = ge(t, e), c = a ? o.getSize() : 0;
1208
- o.write(l, { at: c }), h && o.truncate(l.byteLength), o.flush();
1209
- } catch (l) {
1210
- console.error(l);
1211
- const c = a ? "append" : "write";
1212
- throw new x(`Failed to ${c} file`, `${c.toUpperCase()}_FAILED`, void 0, l);
1236
+ const h = me(t, e), c = o ? a.getSize() : 0;
1237
+ a.write(h, { at: c }), l && a.truncate(h.byteLength), a.flush();
1238
+ } catch (h) {
1239
+ console.error(h);
1240
+ const c = o ? "append" : "write";
1241
+ throw new g(`Failed to ${c} file`, `${c.toUpperCase()}_FAILED`, void 0, h);
1213
1242
  } finally {
1214
1243
  try {
1215
- o?.close();
1244
+ a?.close();
1216
1245
  } catch {
1217
1246
  }
1218
1247
  }
1219
1248
  };
1220
- return n ? I(n, "exclusive", r) : r();
1249
+ return n ? k(n, "exclusive", i) : i();
1221
1250
  }
1222
- async function je(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1251
+ async function We(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1223
1252
  if (s instanceof File && (s = await s.arrayBuffer()), s.byteLength > e)
1224
1253
  throw new Error(`File size ${s.byteLength} bytes exceeds maximum allowed size ${e} bytes`);
1225
- const n = new Uint8Array(s), i = await crypto.subtle.digest(t, n);
1226
- return Array.from(new Uint8Array(i)).map((o) => o.toString(16).padStart(2, "0")).join("");
1254
+ const n = new Uint8Array(s), r = await crypto.subtle.digest(t, n);
1255
+ return Array.from(new Uint8Array(r)).map((o) => o.toString(16).padStart(2, "0")).join("");
1227
1256
  }
1228
- function Ie(s, t) {
1257
+ function je(s, t) {
1229
1258
  if (s.length !== t.length)
1230
1259
  return !1;
1231
1260
  for (let e = 0; e < s.length; e++)
@@ -1233,57 +1262,93 @@ function Ie(s, t) {
1233
1262
  return !1;
1234
1263
  return !0;
1235
1264
  }
1236
- async function Ue(s) {
1265
+ async function ze(s) {
1237
1266
  const t = await s.arrayBuffer();
1238
1267
  return new Uint8Array(t);
1239
1268
  }
1240
- async function We(s, t, e = {}) {
1269
+ async function _e(s, t, e = {}) {
1241
1270
  const n = nt(t);
1242
- return I(t, "exclusive", async () => {
1243
- const i = e.recursive ?? !1, r = e.force ?? !1;
1271
+ return k(t, "exclusive", async () => {
1272
+ const r = e.recursive ?? !1, i = e.force ?? !1;
1244
1273
  e.useTrash;
1245
1274
  try {
1246
- await s.removeEntry(n, { recursive: i });
1275
+ await s.removeEntry(n, { recursive: r });
1247
1276
  } catch (o) {
1248
1277
  if (o.name === "NotFoundError") {
1249
- if (!r)
1250
- throw new x(`No such file or directory: ${t}`, "ENOENT", void 0, o);
1251
- } else throw o.name === "InvalidModificationError" ? new x(`Directory not empty: ${t}. Use recursive option to force removal.`, "ENOTEMPTY", void 0, o) : o.name === "TypeMismatchError" && !i ? new x(`Cannot remove directory without recursive option: ${t}`, "EISDIR", void 0, o) : new x(`Failed to remove entry: ${t}`, "RM_FAILED", void 0, o);
1278
+ if (!i)
1279
+ throw new g(`No such file or directory: ${t}`, "ENOENT", void 0, o);
1280
+ } else throw o.name === "InvalidModificationError" ? new g(`Directory not empty: ${t}. Use recursive option to force removal.`, "ENOTEMPTY", void 0, o) : o.name === "TypeMismatchError" && !r ? new g(`Cannot remove directory without recursive option: ${t}`, "EISDIR", void 0, o) : new g(`Failed to remove entry: ${t}`, "RM_FAILED", void 0, o);
1252
1281
  }
1253
1282
  });
1254
1283
  }
1284
+ function Be(s, t, e, n) {
1285
+ if (!Number.isInteger(t) || !Number.isInteger(e))
1286
+ throw new g("Invalid offset or length", "EINVAL");
1287
+ if (t < 0 || e < 0)
1288
+ throw new g("Negative offset or length not allowed", "EINVAL");
1289
+ if (t + e > s)
1290
+ throw new g("Operation would overflow buffer", "ERANGE");
1291
+ if (n != null && (!Number.isInteger(n) || n < 0))
1292
+ throw new g("Invalid position", "EINVAL");
1293
+ }
1294
+ function qe(s, t, e) {
1295
+ try {
1296
+ t.flush(), t.close();
1297
+ } catch (n) {
1298
+ console.warn(`Warning: Failed to properly close file descriptor ${s} (${e}):`, n);
1299
+ }
1300
+ }
1301
+ function Ge(s, t, e) {
1302
+ if (s >= e)
1303
+ return { isEOF: !0, actualLength: 0 };
1304
+ const n = Math.min(t, e - s);
1305
+ return n <= 0 ? { isEOF: !0, actualLength: 0 } : { isEOF: !1, actualLength: n };
1306
+ }
1307
+ async function we(s, t) {
1308
+ try {
1309
+ return await s.createSyncAccessHandle();
1310
+ } catch (e) {
1311
+ throw ot(e, { path: t, isDirectory: !1 });
1312
+ }
1313
+ }
1255
1314
  export {
1256
- de as B,
1257
- Ee as D,
1258
- ye as F,
1259
- x as O,
1260
- we as P,
1261
- Se as S,
1315
+ Ge as A,
1316
+ we as B,
1317
+ he as C,
1318
+ xe as D,
1319
+ Te as E,
1320
+ Se as F,
1321
+ ue as G,
1322
+ Me as H,
1323
+ g as O,
1324
+ Ee as P,
1325
+ Ne as S,
1262
1326
  be as T,
1263
- rt as a,
1264
- me as b,
1265
- xe as c,
1266
- $e as d,
1267
- nt as e,
1268
- Te as f,
1269
- Me as g,
1270
- Re as h,
1271
- Ne as i,
1327
+ it as a,
1328
+ ye as b,
1329
+ Oe as c,
1330
+ Ae as d,
1331
+ Pe as e,
1332
+ nt as f,
1333
+ Re as g,
1334
+ Ce as h,
1335
+ Ie as i,
1272
1336
  st as j,
1273
1337
  De as k,
1274
- ge as l,
1275
- Pe as m,
1276
- it as n,
1277
- Le as o,
1278
- Fe as p,
1279
- je as q,
1280
- Ce as r,
1338
+ Fe as l,
1339
+ ot as m,
1340
+ rt as n,
1341
+ me as o,
1342
+ ke as p,
1343
+ Ue as q,
1344
+ Le as r,
1281
1345
  U as s,
1282
- Ie as t,
1283
- Ue as u,
1284
- We as v,
1285
- I as w,
1286
- he as x,
1287
- Ae as y
1346
+ We as t,
1347
+ je as u,
1348
+ ze as v,
1349
+ k as w,
1350
+ _e as x,
1351
+ Be as y,
1352
+ qe as z
1288
1353
  };
1289
- //# sourceMappingURL=helpers-CTCvNFs1.js.map
1354
+ //# sourceMappingURL=helpers-DS5dyURe.js.map