opfs-worker 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +40 -27
  2. package/dist/{BaseOPFS-Cylz6ijk.js → BaseOPFS-BusBkyJX.js} +436 -358
  3. package/dist/BaseOPFS-BusBkyJX.js.map +1 -0
  4. package/dist/{BaseOPFS-BPw9AIQ-.cjs → BaseOPFS-CYwrD7-q.cjs} +4 -4
  5. package/dist/BaseOPFS-CYwrD7-q.cjs.map +1 -0
  6. package/dist/{OPFSAsync-s2P7y3sw.cjs → OPFSAsync-B2dR-2VR.cjs} +2 -2
  7. package/dist/{OPFSAsync-s2P7y3sw.cjs.map → OPFSAsync-B2dR-2VR.cjs.map} +1 -1
  8. package/dist/{OPFSAsync-BKSAJJeh.js → OPFSAsync-CO44W23e.js} +2 -2
  9. package/dist/{OPFSAsync-BKSAJJeh.js.map → OPFSAsync-CO44W23e.js.map} +1 -1
  10. package/dist/OPFSFacade-CEaSqTut.js +308 -0
  11. package/dist/OPFSFacade-CEaSqTut.js.map +1 -0
  12. package/dist/OPFSFacade-hrNXCn6w.cjs +2 -0
  13. package/dist/OPFSFacade-hrNXCn6w.cjs.map +1 -0
  14. package/dist/{OPFSSync-C7KBepe_.cjs → OPFSSync-BPrNtvFS.cjs} +2 -2
  15. package/dist/{OPFSSync-C7KBepe_.cjs.map → OPFSSync-BPrNtvFS.cjs.map} +1 -1
  16. package/dist/{OPFSSync-CsSQkpk5.js → OPFSSync-D7obTsl3.js} +2 -2
  17. package/dist/{OPFSSync-CsSQkpk5.js.map → OPFSSync-D7obTsl3.js.map} +1 -1
  18. package/dist/assets/dedicated.worker-DW6UqFo0.js.map +1 -0
  19. package/dist/core/BaseOPFS.d.ts +38 -7
  20. package/dist/core/BaseOPFS.d.ts.map +1 -1
  21. package/dist/createOPFSAsync-DdhJYoC0.js +10 -0
  22. package/dist/{createOPFSAsync-Y4Mg6qte.js.map → createOPFSAsync-DdhJYoC0.js.map} +1 -1
  23. package/dist/createOPFSAsync-DyWpvmL-.cjs +2 -0
  24. package/dist/{createOPFSAsync-BwKDmHsy.cjs.map → createOPFSAsync-DyWpvmL-.cjs.map} +1 -1
  25. package/dist/{createOPFSDedicated-CsnV6MLP.js → createOPFSDedicated-BwTc0NV5.js} +289 -215
  26. package/dist/{createOPFSDedicated-CsnV6MLP.js.map → createOPFSDedicated-BwTc0NV5.js.map} +1 -1
  27. package/dist/{createOPFSDedicated-pKTRWLdz.cjs → createOPFSDedicated-CEeRexom.cjs} +286 -212
  28. package/dist/{createOPFSDedicated-pKTRWLdz.cjs.map → createOPFSDedicated-CEeRexom.cjs.map} +1 -1
  29. package/dist/{createOPFSShared-CGdd__PH.js → createOPFSShared-BSFWsoLe.js} +2 -2
  30. package/dist/{createOPFSShared-CGdd__PH.js.map → createOPFSShared-BSFWsoLe.js.map} +1 -1
  31. package/dist/{createOPFSShared-CskROt7U.cjs → createOPFSShared-BoCft_BS.cjs} +2 -2
  32. package/dist/{createOPFSShared-CskROt7U.cjs.map → createOPFSShared-BoCft_BS.cjs.map} +1 -1
  33. package/dist/dedicated.worker.js +282 -208
  34. package/dist/dedicated.worker.js.map +1 -1
  35. package/dist/facade/OPFSFacade.d.ts +21 -3
  36. package/dist/facade/OPFSFacade.d.ts.map +1 -1
  37. package/dist/index.async.cjs +1 -1
  38. package/dist/index.async.js +4 -4
  39. package/dist/index.cjs +1 -1
  40. package/dist/index.js +7 -7
  41. package/dist/index.pure.cjs +1 -1
  42. package/dist/index.pure.js +3 -3
  43. package/dist/index.sharedworker.cjs +1 -1
  44. package/dist/index.sharedworker.js +4 -4
  45. package/dist/index.sync.cjs +1 -1
  46. package/dist/index.sync.js +4 -4
  47. package/dist/shared.worker.js +430 -356
  48. package/dist/shared.worker.js.map +1 -1
  49. package/dist/types.d.ts +33 -0
  50. package/dist/types.d.ts.map +1 -1
  51. package/docs/api/backend.md +3 -3
  52. package/docs/api/create.md +1 -1
  53. package/docs/api/facade.md +28 -27
  54. package/docs/choosing-a-mode.md +6 -6
  55. package/docs/file-descriptors.md +46 -604
  56. package/docs/guides/async.md +2 -2
  57. package/docs/guides/dedicated.md +5 -5
  58. package/docs/guides/hashing.md +2 -2
  59. package/docs/guides/pure.md +3 -3
  60. package/docs/guides/sharedworker.md +1 -1
  61. package/docs/guides/streaming.md +145 -11
  62. package/docs/guides/watching.md +3 -3
  63. package/docs/migration.md +3 -3
  64. package/docs/types.md +92 -154
  65. package/package.json +12 -2
  66. package/src/core/BaseOPFS.ts +148 -25
  67. package/src/facade/OPFSFacade.ts +51 -4
  68. package/src/types.ts +37 -0
  69. package/dist/BaseOPFS-BPw9AIQ-.cjs.map +0 -1
  70. package/dist/BaseOPFS-Cylz6ijk.js.map +0 -1
  71. package/dist/OPFSFacade-DePnNRgt.cjs +0 -2
  72. package/dist/OPFSFacade-DePnNRgt.cjs.map +0 -1
  73. package/dist/OPFSFacade-XohWlHuu.js +0 -281
  74. package/dist/OPFSFacade-XohWlHuu.js.map +0 -1
  75. package/dist/assets/dedicated.worker-nY3tK4zi.js.map +0 -1
  76. package/dist/createOPFSAsync-BwKDmHsy.cjs +0 -2
  77. package/dist/createOPFSAsync-Y4Mg6qte.js +0 -10
  78. package/docs/README.md +0 -30
@@ -1,5 +1,5 @@
1
1
  var N = /* @__PURE__ */ ((s) => (s.Added = "added", s.Changed = "changed", s.Removed = "removed", s))(N || {});
2
- const mt = {
2
+ const wt = {
3
3
  ENOENT: -2,
4
4
  // No such file or directory
5
5
  EISDIR: -21,
@@ -36,15 +36,15 @@ class m extends Error {
36
36
  syscall;
37
37
  path;
38
38
  constructor(t, e, n, r, i) {
39
- super(t, { cause: i }), this.name = e, this.errno = mt[e] || -1, this.path = n, this.syscall = r;
39
+ super(t, { cause: i }), this.name = e, this.errno = wt[e] || -1, this.path = n, this.syscall = r;
40
40
  }
41
41
  }
42
- class wt extends m {
42
+ class yt extends m {
43
43
  constructor(t) {
44
44
  super("OPFS is not supported in this browser", "ENOTSUP", void 0, void 0, t);
45
45
  }
46
46
  }
47
- class yt extends m {
47
+ class Et extends m {
48
48
  constructor(t, e, n) {
49
49
  super(t, "INVALID_PATH", e, "access", n);
50
50
  }
@@ -59,17 +59,17 @@ class k extends m {
59
59
  super(r[t], "ENOENT", e, "access", n);
60
60
  }
61
61
  }
62
- class Et extends m {
62
+ class St extends m {
63
63
  constructor(t, e, n) {
64
64
  super(`Permission denied for ${e} on: ${t}`, "EACCES", t, e, n);
65
65
  }
66
66
  }
67
- class St extends m {
67
+ class xt extends m {
68
68
  constructor(t, e, n) {
69
69
  super(t, "ENOSPC", e, "write", n);
70
70
  }
71
71
  }
72
- class xt extends m {
72
+ class bt extends m {
73
73
  constructor(t, e) {
74
74
  super(`File is busy: ${t}`, "EBUSY", t, "open", e);
75
75
  }
@@ -101,7 +101,7 @@ class J extends m {
101
101
  super(t, "EIO", e, "io", n);
102
102
  }
103
103
  }
104
- class it extends m {
104
+ class ot extends m {
105
105
  constructor(t, e) {
106
106
  super(`Operation not supported: ${t}`, "ENOTSUP", t, "operation", e);
107
107
  }
@@ -116,12 +116,12 @@ class G extends m {
116
116
  super(r[t] || `Directory operation failed: ${e}`, t, e, "unlink", n);
117
117
  }
118
118
  }
119
- class bt extends m {
119
+ class Ot extends m {
120
120
  constructor(t, e) {
121
121
  super("Failed to initialize OPFS", "INIT_FAILED", t, "init", e);
122
122
  }
123
123
  }
124
- class U extends m {
124
+ class j extends m {
125
125
  constructor(t, e, n) {
126
126
  super(`Failed to ${t}: ${e}`, `${t.toUpperCase()}_FAILED`, e, t, n);
127
127
  }
@@ -131,7 +131,7 @@ class X extends m {
131
131
  super(`Destination already exists: ${t}`, "EEXIST", t, "open", e);
132
132
  }
133
133
  }
134
- function We(s, t, e, n) {
134
+ function He(s, t, e, n) {
135
135
  const r = `${s.toUpperCase()}_FAILED`;
136
136
  return new m(`Failed to ${s} file descriptor: ${t}`, r, e, s, n);
137
137
  }
@@ -139,16 +139,16 @@ function O(s, t) {
139
139
  const e = t?.path, n = t?.isDirectory, r = t?.existenceType ?? "file", i = t?.operation;
140
140
  switch (s.name) {
141
141
  case "InvalidStateError":
142
- return new xt(e || "unknown", s);
142
+ return new bt(e || "unknown", s);
143
143
  case "QuotaExceededError":
144
- return new St(`No space left on device: ${e || "unknown"}`, e, s);
144
+ return new xt(`No space left on device: ${e || "unknown"}`, e, s);
145
145
  case "NotFoundError":
146
146
  return new k(r, e, s);
147
147
  case "TypeMismatchError":
148
148
  return n !== void 0 ? n ? new q("directory", e || "unknown", s) : new q("file", e || "unknown", s) : new D("argument", `Type mismatch: ${e || "unknown"}`, e, s);
149
149
  case "NotAllowedError":
150
150
  case "SecurityError":
151
- return new Et(e, "unknown", s);
151
+ return new St(e, "unknown", s);
152
152
  case "InvalidModificationError":
153
153
  return i === "remove" ? new G("ENOTEMPTY", e, s) : new D("argument", `Invalid modification: ${e || "unknown"}`, e, s);
154
154
  case "AbortError":
@@ -156,13 +156,13 @@ function O(s, t) {
156
156
  case "OperationError":
157
157
  return new J(`Operation failed: ${e || "unknown"}`, e, s);
158
158
  case "TypeError":
159
- return new it(e || "unknown", s);
159
+ return new ot(e || "unknown", s);
160
160
  default:
161
161
  return i === "remove" ? new G("RM_FAILED", e, s) : new J(`I/O error: ${e || "unknown"}`, e, s);
162
162
  }
163
163
  }
164
- const ot = (s, t, e) => {
165
- const n = s instanceof RegExp ? K(s, e) : s, r = t instanceof RegExp ? K(t, e) : t, i = n !== null && r != null && Ot(n, r, e);
164
+ const at = (s, t, e) => {
165
+ const n = s instanceof RegExp ? K(s, e) : s, r = t instanceof RegExp ? K(t, e) : t, i = n !== null && r != null && At(n, r, e);
166
166
  return i && {
167
167
  start: i[0],
168
168
  end: i[1],
@@ -173,118 +173,118 @@ const ot = (s, t, e) => {
173
173
  }, K = (s, t) => {
174
174
  const e = t.match(s);
175
175
  return e ? e[0] : null;
176
- }, Ot = (s, t, e) => {
177
- let n, r, i, o, a, c = e.indexOf(s), l = e.indexOf(t, c + 1), h = c;
178
- if (c >= 0 && l > 0) {
176
+ }, At = (s, t, e) => {
177
+ let n, r, i, o, c, a = e.indexOf(s), h = e.indexOf(t, a + 1), l = a;
178
+ if (a >= 0 && h > 0) {
179
179
  if (s === t)
180
- return [c, l];
181
- for (n = [], i = e.length; h >= 0 && !a; ) {
182
- if (h === c)
183
- n.push(h), c = e.indexOf(s, h + 1);
180
+ return [a, h];
181
+ for (n = [], i = e.length; l >= 0 && !c; ) {
182
+ if (l === a)
183
+ n.push(l), a = e.indexOf(s, l + 1);
184
184
  else if (n.length === 1) {
185
185
  const d = n.pop();
186
- d !== void 0 && (a = [d, l]);
186
+ d !== void 0 && (c = [d, h]);
187
187
  } else
188
- r = n.pop(), r !== void 0 && r < i && (i = r, o = l), l = e.indexOf(t, h + 1);
189
- h = c < l && c >= 0 ? c : l;
188
+ r = n.pop(), r !== void 0 && r < i && (i = r, o = h), h = e.indexOf(t, l + 1);
189
+ l = a < h && a >= 0 ? a : h;
190
190
  }
191
- n.length && o !== void 0 && (a = [i, o]);
191
+ n.length && o !== void 0 && (c = [i, o]);
192
192
  }
193
- return a;
194
- }, at = "\0SLASH" + Math.random() + "\0", ct = "\0OPEN" + Math.random() + "\0", V = "\0CLOSE" + Math.random() + "\0", ht = "\0COMMA" + Math.random() + "\0", lt = "\0PERIOD" + Math.random() + "\0", At = new RegExp(at, "g"), Dt = new RegExp(ct, "g"), Nt = new RegExp(V, "g"), $t = new RegExp(ht, "g"), Ct = new RegExp(lt, "g"), Tt = /\\\\/g, Mt = /\\{/g, Ft = /\\}/g, It = /\\,/g, Pt = /\\./g;
195
- function B(s) {
193
+ return c;
194
+ }, ct = "\0SLASH" + Math.random() + "\0", lt = "\0OPEN" + Math.random() + "\0", V = "\0CLOSE" + Math.random() + "\0", ht = "\0COMMA" + Math.random() + "\0", ut = "\0PERIOD" + Math.random() + "\0", Dt = new RegExp(ct, "g"), Nt = new RegExp(lt, "g"), $t = new RegExp(V, "g"), Ct = new RegExp(ht, "g"), Tt = new RegExp(ut, "g"), Ft = /\\\\/g, It = /\\{/g, Mt = /\\}/g, Rt = /\\,/g, Pt = /\\./g;
195
+ function U(s) {
196
196
  return isNaN(s) ? s.charCodeAt(0) : parseInt(s, 10);
197
197
  }
198
- function Rt(s) {
199
- return s.replace(Tt, at).replace(Mt, ct).replace(Ft, V).replace(It, ht).replace(Pt, lt);
200
- }
201
198
  function kt(s) {
202
- return s.replace(At, "\\").replace(Dt, "{").replace(Nt, "}").replace($t, ",").replace(Ct, ".");
199
+ return s.replace(Ft, ct).replace(It, lt).replace(Mt, V).replace(Rt, ht).replace(Pt, ut);
200
+ }
201
+ function Lt(s) {
202
+ return s.replace(Dt, "\\").replace(Nt, "{").replace($t, "}").replace(Ct, ",").replace(Tt, ".");
203
203
  }
204
- function ut(s) {
204
+ function ft(s) {
205
205
  if (!s)
206
206
  return [""];
207
- const t = [], e = ot("{", "}", s);
207
+ const t = [], e = at("{", "}", s);
208
208
  if (!e)
209
209
  return s.split(",");
210
210
  const { pre: n, body: r, post: i } = e, o = n.split(",");
211
211
  o[o.length - 1] += "{" + r + "}";
212
- const a = ut(i);
213
- return i.length && (o[o.length - 1] += a.shift(), o.push.apply(o, a)), t.push.apply(t, o), t;
214
- }
215
- function Lt(s) {
216
- return s ? (s.slice(0, 2) === "{}" && (s = "\\{\\}" + s.slice(2)), F(Rt(s), !0).map(kt)) : [];
212
+ const c = ft(i);
213
+ return i.length && (o[o.length - 1] += c.shift(), o.push.apply(o, c)), t.push.apply(t, o), t;
217
214
  }
218
215
  function zt(s) {
216
+ return s ? (s.slice(0, 2) === "{}" && (s = "\\{\\}" + s.slice(2)), I(kt(s), !0).map(Lt)) : [];
217
+ }
218
+ function Wt(s) {
219
219
  return "{" + s + "}";
220
220
  }
221
- function jt(s) {
221
+ function Bt(s) {
222
222
  return /^-?0\d/.test(s);
223
223
  }
224
- function Wt(s, t) {
224
+ function jt(s, t) {
225
225
  return s <= t;
226
226
  }
227
227
  function Ut(s, t) {
228
228
  return s >= t;
229
229
  }
230
- function F(s, t) {
231
- const e = [], n = ot("{", "}", s);
230
+ function I(s, t) {
231
+ const e = [], n = at("{", "}", s);
232
232
  if (!n)
233
233
  return [s];
234
- const r = n.pre, i = n.post.length ? F(n.post, !1) : [""];
234
+ const r = n.pre, i = n.post.length ? I(n.post, !1) : [""];
235
235
  if (/\$$/.test(n.pre))
236
236
  for (let o = 0; o < i.length; o++) {
237
- const a = r + "{" + n.body + "}" + i[o];
238
- e.push(a);
237
+ const c = r + "{" + n.body + "}" + i[o];
238
+ e.push(c);
239
239
  }
240
240
  else {
241
- const o = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body), c = o || a, l = n.body.indexOf(",") >= 0;
242
- if (!c && !l)
243
- return n.post.match(/,(?!,).*\}/) ? (s = n.pre + "{" + n.body + V + n.post, F(s)) : [s];
244
- let h;
245
- if (c)
246
- h = n.body.split(/\.\./);
247
- else if (h = ut(n.body), h.length === 1 && h[0] !== void 0 && (h = F(h[0], !1).map(zt), h.length === 1))
248
- return i.map((u) => n.pre + h[0] + u);
241
+ const o = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body), c = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body), a = o || c, h = n.body.indexOf(",") >= 0;
242
+ if (!a && !h)
243
+ return n.post.match(/,(?!,).*\}/) ? (s = n.pre + "{" + n.body + V + n.post, I(s)) : [s];
244
+ let l;
245
+ if (a)
246
+ l = n.body.split(/\.\./);
247
+ else if (l = ft(n.body), l.length === 1 && l[0] !== void 0 && (l = I(l[0], !1).map(Wt), l.length === 1))
248
+ return i.map((u) => n.pre + l[0] + u);
249
249
  let d;
250
- if (c && h[0] !== void 0 && h[1] !== void 0) {
251
- const u = B(h[0]), f = B(h[1]), g = Math.max(h[0].length, h[1].length);
252
- let p = h.length === 3 && h[2] !== void 0 ? Math.abs(B(h[2])) : 1, S = Wt;
250
+ if (a && l[0] !== void 0 && l[1] !== void 0) {
251
+ const u = U(l[0]), f = U(l[1]), g = Math.max(l[0].length, l[1].length);
252
+ let p = l.length === 3 && l[2] !== void 0 ? Math.abs(U(l[2])) : 1, S = jt;
253
253
  f < u && (p *= -1, S = Ut);
254
- const C = h.some(jt);
254
+ const C = l.some(Bt);
255
255
  d = [];
256
256
  for (let x = u; S(x, f); x += p) {
257
257
  let w;
258
- if (a)
258
+ if (c)
259
259
  w = String.fromCharCode(x), w === "\\" && (w = "");
260
260
  else if (w = String(x), C) {
261
261
  const T = g - w.length;
262
262
  if (T > 0) {
263
- const P = new Array(T + 1).join("0");
264
- x < 0 ? w = "-" + P + w.slice(1) : w = P + w;
263
+ const R = new Array(T + 1).join("0");
264
+ x < 0 ? w = "-" + R + w.slice(1) : w = R + w;
265
265
  }
266
266
  }
267
267
  d.push(w);
268
268
  }
269
269
  } else {
270
270
  d = [];
271
- for (let u = 0; u < h.length; u++)
272
- d.push.apply(d, F(h[u], !1));
271
+ for (let u = 0; u < l.length; u++)
272
+ d.push.apply(d, I(l[u], !1));
273
273
  }
274
274
  for (let u = 0; u < d.length; u++)
275
275
  for (let f = 0; f < i.length; f++) {
276
276
  const g = r + d[u] + i[f];
277
- (!t || c || g) && e.push(g);
277
+ (!t || a || g) && e.push(g);
278
278
  }
279
279
  }
280
280
  return e;
281
281
  }
282
- const Bt = 1024 * 64, L = (s) => {
282
+ const Ht = 1024 * 64, L = (s) => {
283
283
  if (typeof s != "string")
284
284
  throw new TypeError("invalid pattern");
285
- if (s.length > Bt)
285
+ if (s.length > Ht)
286
286
  throw new TypeError("pattern is too long");
287
- }, Ht = {
287
+ }, _t = {
288
288
  "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
289
289
  "[:alpha:]": ["\\p{L}\\p{Nl}", !0],
290
290
  "[:ascii:]": ["\\x00-\\x7f", !1],
@@ -299,60 +299,60 @@ const Bt = 1024 * 64, L = (s) => {
299
299
  "[:upper:]": ["\\p{Lu}", !0],
300
300
  "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
301
301
  "[:xdigit:]": ["A-Fa-f0-9", !1]
302
- }, M = (s) => s.replace(/[[\]\\-]/g, "\\$&"), _t = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Q = (s) => s.join(""), qt = (s, t) => {
302
+ }, F = (s) => s.replace(/[[\]\\-]/g, "\\$&"), qt = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Q = (s) => s.join(""), Gt = (s, t) => {
303
303
  const e = t;
304
304
  if (s.charAt(e) !== "[")
305
305
  throw new Error("not in a brace expression");
306
306
  const n = [], r = [];
307
- let i = e + 1, o = !1, a = !1, c = !1, l = !1, h = e, d = "";
307
+ let i = e + 1, o = !1, c = !1, a = !1, h = !1, l = e, d = "";
308
308
  t: for (; i < s.length; ) {
309
309
  const p = s.charAt(i);
310
310
  if ((p === "!" || p === "^") && i === e + 1) {
311
- l = !0, i++;
311
+ h = !0, i++;
312
312
  continue;
313
313
  }
314
- if (p === "]" && o && !c) {
315
- h = i + 1;
314
+ if (p === "]" && o && !a) {
315
+ l = i + 1;
316
316
  break;
317
317
  }
318
- if (o = !0, p === "\\" && !c) {
319
- c = !0, i++;
318
+ if (o = !0, p === "\\" && !a) {
319
+ a = !0, i++;
320
320
  continue;
321
321
  }
322
- if (p === "[" && !c) {
323
- for (const [S, [A, C, x]] of Object.entries(Ht))
322
+ if (p === "[" && !a) {
323
+ for (const [S, [A, C, x]] of Object.entries(_t))
324
324
  if (s.startsWith(S, i)) {
325
325
  if (d)
326
326
  return ["$.", !1, s.length - e, !0];
327
- i += S.length, x ? r.push(A) : n.push(A), a = a || C;
327
+ i += S.length, x ? r.push(A) : n.push(A), c = c || C;
328
328
  continue t;
329
329
  }
330
330
  }
331
- if (c = !1, d) {
332
- p > d ? n.push(M(d) + "-" + M(p)) : p === d && n.push(M(p)), d = "", i++;
331
+ if (a = !1, d) {
332
+ p > d ? n.push(F(d) + "-" + F(p)) : p === d && n.push(F(p)), d = "", i++;
333
333
  continue;
334
334
  }
335
335
  if (s.startsWith("-]", i + 1)) {
336
- n.push(M(p + "-")), i += 2;
336
+ n.push(F(p + "-")), i += 2;
337
337
  continue;
338
338
  }
339
339
  if (s.startsWith("-", i + 1)) {
340
340
  d = p, i += 2;
341
341
  continue;
342
342
  }
343
- n.push(M(p)), i++;
343
+ n.push(F(p)), i++;
344
344
  }
345
- if (h < i)
345
+ if (l < i)
346
346
  return ["", !1, 0, !1];
347
347
  if (!n.length && !r.length)
348
348
  return ["$.", !1, s.length - e, !0];
349
- if (r.length === 0 && n.length === 1 && /^\\?.$/.test(n[0]) && !l) {
349
+ if (r.length === 0 && n.length === 1 && /^\\?.$/.test(n[0]) && !h) {
350
350
  const p = n[0].length === 2 ? n[0].slice(-1) : n[0];
351
- return [_t(p), !1, h - e, !1];
351
+ return [qt(p), !1, l - e, !1];
352
352
  }
353
- const u = "[" + (l ? "^" : "") + Q(n) + "]", f = "[" + (l ? "" : "^") + Q(r) + "]";
354
- return [n.length && r.length ? "(" + u + "|" + f + ")" : n.length ? u : f, a, h - e, !0];
355
- }, I = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1"), Gt = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), tt = (s) => Gt.has(s), Vt = "(?!(?:^|/)\\.\\.?(?:$|/))", R = "(?!\\.)", Yt = /* @__PURE__ */ new Set(["[", "."]), Zt = /* @__PURE__ */ new Set(["..", "."]), Jt = new Set("().*{}+?[]^$\\!"), Xt = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Y = "[^/]", et = Y + "*?", st = Y + "+?";
353
+ const u = "[" + (h ? "^" : "") + Q(n) + "]", f = "[" + (h ? "" : "^") + Q(r) + "]";
354
+ return [n.length && r.length ? "(" + u + "|" + f + ")" : n.length ? u : f, c, l - e, !0];
355
+ }, M = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1"), Vt = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), tt = (s) => Vt.has(s), Yt = "(?!(?:^|/)\\.\\.?(?:$|/))", P = "(?!\\.)", Zt = /* @__PURE__ */ new Set(["[", "."]), Jt = /* @__PURE__ */ new Set(["..", "."]), Xt = new Set("().*{}+?[]^$\\!"), Kt = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Y = "[^/]", et = Y + "*?", st = Y + "+?";
356
356
  class E {
357
357
  type;
358
358
  #s;
@@ -364,7 +364,7 @@ class E {
364
364
  #c;
365
365
  #a = !1;
366
366
  #r;
367
- #h;
367
+ #l;
368
368
  // set to true if it's an extglob with no children
369
369
  // (which really means one child of '')
370
370
  #u = !1;
@@ -381,7 +381,7 @@ class E {
381
381
  }
382
382
  // reconstructs the pattern
383
383
  toString() {
384
- 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("");
384
+ 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("");
385
385
  }
386
386
  #d() {
387
387
  if (this !== this.#s)
@@ -452,8 +452,8 @@ class E {
452
452
  e.copyIn(n);
453
453
  return e;
454
454
  }
455
- static #l(t, e, n, r) {
456
- let i = !1, o = !1, a = -1, c = !1;
455
+ static #h(t, e, n, r) {
456
+ let i = !1, o = !1, c = -1, a = !1;
457
457
  if (e.type === null) {
458
458
  let f = n, g = "";
459
459
  for (; f < t.length; ) {
@@ -463,57 +463,57 @@ class E {
463
463
  continue;
464
464
  }
465
465
  if (o) {
466
- f === a + 1 ? (p === "^" || p === "!") && (c = !0) : p === "]" && !(f === a + 2 && c) && (o = !1), g += p;
466
+ f === c + 1 ? (p === "^" || p === "!") && (a = !0) : p === "]" && !(f === c + 2 && a) && (o = !1), g += p;
467
467
  continue;
468
468
  } else if (p === "[") {
469
- o = !0, a = f, c = !1, g += p;
469
+ o = !0, c = f, a = !1, g += p;
470
470
  continue;
471
471
  }
472
472
  if (!r.noext && tt(p) && t.charAt(f) === "(") {
473
473
  e.push(g), g = "";
474
474
  const S = new E(p, e);
475
- f = E.#l(t, S, f, r), e.push(S);
475
+ f = E.#h(t, S, f, r), e.push(S);
476
476
  continue;
477
477
  }
478
478
  g += p;
479
479
  }
480
480
  return e.push(g), f;
481
481
  }
482
- let l = n + 1, h = new E(null, e);
482
+ let h = n + 1, l = new E(null, e);
483
483
  const d = [];
484
484
  let u = "";
485
- for (; l < t.length; ) {
486
- const f = t.charAt(l++);
485
+ for (; h < t.length; ) {
486
+ const f = t.charAt(h++);
487
487
  if (i || f === "\\") {
488
488
  i = !i, u += f;
489
489
  continue;
490
490
  }
491
491
  if (o) {
492
- l === a + 1 ? (f === "^" || f === "!") && (c = !0) : f === "]" && !(l === a + 2 && c) && (o = !1), u += f;
492
+ h === c + 1 ? (f === "^" || f === "!") && (a = !0) : f === "]" && !(h === c + 2 && a) && (o = !1), u += f;
493
493
  continue;
494
494
  } else if (f === "[") {
495
- o = !0, a = l, c = !1, u += f;
495
+ o = !0, c = h, a = !1, u += f;
496
496
  continue;
497
497
  }
498
- if (tt(f) && t.charAt(l) === "(") {
499
- h.push(u), u = "";
500
- const g = new E(f, h);
501
- h.push(g), l = E.#l(t, g, l, r);
498
+ if (tt(f) && t.charAt(h) === "(") {
499
+ l.push(u), u = "";
500
+ const g = new E(f, l);
501
+ l.push(g), h = E.#h(t, g, h, r);
502
502
  continue;
503
503
  }
504
504
  if (f === "|") {
505
- h.push(u), u = "", d.push(h), h = new E(null, e);
505
+ l.push(u), u = "", d.push(l), l = new E(null, e);
506
506
  continue;
507
507
  }
508
508
  if (f === ")")
509
- return u === "" && e.#t.length === 0 && (e.#u = !0), h.push(u), u = "", e.push(...d, h), l;
509
+ return u === "" && e.#t.length === 0 && (e.#u = !0), l.push(u), u = "", e.push(...d, l), h;
510
510
  u += f;
511
511
  }
512
- return e.type = null, e.#n = void 0, e.#t = [t.substring(n - 1)], l;
512
+ return e.type = null, e.#n = void 0, e.#t = [t.substring(n - 1)], h;
513
513
  }
514
514
  static fromGlob(t, e = {}) {
515
515
  const n = new E(null, void 0, e);
516
- return E.#l(t, n, 0, e), n;
516
+ return E.#h(t, n, 0, e), n;
517
517
  }
518
518
  // returns the regular expression if there's magic, or the unescaped
519
519
  // string if not.
@@ -523,8 +523,8 @@ class E {
523
523
  const t = this.toString(), [e, n, r, i] = this.toRegExpSource();
524
524
  if (!(r || this.#n || this.#r.nocase && !this.#r.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase()))
525
525
  return n;
526
- const a = (this.#r.nocase ? "i" : "") + (i ? "u" : "");
527
- return Object.assign(new RegExp(`^${e}$`, a), {
526
+ const c = (this.#r.nocase ? "i" : "") + (i ? "u" : "");
527
+ return Object.assign(new RegExp(`^${e}$`, c), {
528
528
  _src: e,
529
529
  _glob: t
530
530
  });
@@ -604,24 +604,24 @@ class E {
604
604
  toRegExpSource(t) {
605
605
  const e = t ?? !!this.#r.dot;
606
606
  if (this.#s === this && this.#d(), !this.type) {
607
- const c = this.isStart() && this.isEnd(), l = this.#t.map((f) => {
608
- const [g, p, S, A] = typeof f == "string" ? E.#p(f, this.#n, c) : f.toRegExpSource(t);
607
+ const a = this.isStart() && this.isEnd(), h = this.#t.map((f) => {
608
+ const [g, p, S, A] = typeof f == "string" ? E.#p(f, this.#n, a) : f.toRegExpSource(t);
609
609
  return this.#n = this.#n || S, this.#i = this.#i || A, g;
610
610
  }).join("");
611
- let h = "";
612
- if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && Zt.has(this.#t[0]))) {
613
- const g = Yt, p = (
611
+ let l = "";
612
+ if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && Jt.has(this.#t[0]))) {
613
+ const g = Zt, p = (
614
614
  // dots are allowed, and the pattern starts with [ or .
615
- e && g.has(l.charAt(0)) || // the pattern starts with \., and then [ or .
616
- l.startsWith("\\.") && g.has(l.charAt(2)) || // the pattern starts with \.\., and then [ or .
617
- l.startsWith("\\.\\.") && g.has(l.charAt(4))
618
- ), S = !e && !t && g.has(l.charAt(0));
619
- h = p ? Vt : S ? R : "";
615
+ e && g.has(h.charAt(0)) || // the pattern starts with \., and then [ or .
616
+ h.startsWith("\\.") && g.has(h.charAt(2)) || // the pattern starts with \.\., and then [ or .
617
+ h.startsWith("\\.\\.") && g.has(h.charAt(4))
618
+ ), S = !e && !t && g.has(h.charAt(0));
619
+ l = p ? Yt : S ? P : "";
620
620
  }
621
621
  let d = "";
622
622
  return this.isEnd() && this.#s.#a && this.#e?.type === "!" && (d = "(?:$|\\/)"), [
623
- h + l + d,
624
- I(l),
623
+ l + h + d,
624
+ M(h),
625
625
  this.#n = !!this.#n,
626
626
  this.#i
627
627
  ];
@@ -629,24 +629,24 @@ class E {
629
629
  const n = this.type === "*" || this.type === "+", r = this.type === "!" ? "(?:(?!(?:" : "(?:";
630
630
  let i = this.#f(e);
631
631
  if (this.isStart() && this.isEnd() && !i && this.type !== "!") {
632
- const c = this.toString();
633
- return this.#t = [c], this.type = null, this.#n = void 0, [c, I(this.toString()), !1, !1];
632
+ const a = this.toString();
633
+ return this.#t = [a], this.type = null, this.#n = void 0, [a, M(this.toString()), !1, !1];
634
634
  }
635
- let o = !n || t || e || !R ? "" : this.#f(!0);
635
+ let o = !n || t || e || !P ? "" : this.#f(!0);
636
636
  o === i && (o = ""), o && (i = `(?:${i})(?:${o})*?`);
637
- let a = "";
637
+ let c = "";
638
638
  if (this.type === "!" && this.#u)
639
- a = (this.isStart() && !e ? R : "") + st;
639
+ c = (this.isStart() && !e ? P : "") + st;
640
640
  else {
641
- const c = this.type === "!" ? (
641
+ const a = this.type === "!" ? (
642
642
  // !() must match something,but !(x) can match ''
643
- "))" + (this.isStart() && !e && !t ? R : "") + et + ")"
643
+ "))" + (this.isStart() && !e && !t ? P : "") + et + ")"
644
644
  ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
645
- a = r + i + c;
645
+ c = r + i + a;
646
646
  }
647
647
  return [
648
- a,
649
- I(i),
648
+ c,
649
+ M(i),
650
650
  this.#n = !!this.#n,
651
651
  this.#i
652
652
  ];
@@ -661,109 +661,109 @@ class E {
661
661
  }
662
662
  static #p(t, e, n = !1) {
663
663
  let r = !1, i = "", o = !1;
664
- for (let a = 0; a < t.length; a++) {
665
- const c = t.charAt(a);
664
+ for (let c = 0; c < t.length; c++) {
665
+ const a = t.charAt(c);
666
666
  if (r) {
667
- r = !1, i += (Jt.has(c) ? "\\" : "") + c;
667
+ r = !1, i += (Xt.has(a) ? "\\" : "") + a;
668
668
  continue;
669
669
  }
670
- if (c === "\\") {
671
- a === t.length - 1 ? i += "\\\\" : r = !0;
670
+ if (a === "\\") {
671
+ c === t.length - 1 ? i += "\\\\" : r = !0;
672
672
  continue;
673
673
  }
674
- if (c === "[") {
675
- const [l, h, d, u] = qt(t, a);
674
+ if (a === "[") {
675
+ const [h, l, d, u] = Gt(t, c);
676
676
  if (d) {
677
- i += l, o = o || h, a += d - 1, e = e || u;
677
+ i += h, o = o || l, c += d - 1, e = e || u;
678
678
  continue;
679
679
  }
680
680
  }
681
- if (c === "*") {
681
+ if (a === "*") {
682
682
  n && t === "*" ? i += st : i += et, e = !0;
683
683
  continue;
684
684
  }
685
- if (c === "?") {
685
+ if (a === "?") {
686
686
  i += Y, e = !0;
687
687
  continue;
688
688
  }
689
- i += Xt(c);
689
+ i += Kt(a);
690
690
  }
691
- return [i, I(t), !!e, o];
691
+ return [i, M(t), !!e, o];
692
692
  }
693
693
  }
694
- const Kt = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&"), y = (s, t, e = {}) => (L(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new W(t, e).match(s)), Qt = /^\*+([^+@!?\*\[\(]*)$/, te = (s) => (t) => !t.startsWith(".") && t.endsWith(s), ee = (s) => (t) => t.endsWith(s), se = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), ne = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), re = /^\*+\.\*+$/, ie = (s) => !s.startsWith(".") && s.includes("."), oe = (s) => s !== "." && s !== ".." && s.includes("."), ae = /^\.\*+$/, ce = (s) => s !== "." && s !== ".." && s.startsWith("."), he = /^\*+$/, le = (s) => s.length !== 0 && !s.startsWith("."), ue = (s) => s.length !== 0 && s !== "." && s !== "..", fe = /^\?+([^+@!?\*\[\(]*)?$/, de = ([s, t = ""]) => {
695
- const e = ft([s]);
696
- return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
697
- }, pe = ([s, t = ""]) => {
694
+ const Qt = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&"), y = (s, t, e = {}) => (L(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new B(t, e).match(s)), te = /^\*+([^+@!?\*\[\(]*)$/, ee = (s) => (t) => !t.startsWith(".") && t.endsWith(s), se = (s) => (t) => t.endsWith(s), ne = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), re = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), ie = /^\*+\.\*+$/, oe = (s) => !s.startsWith(".") && s.includes("."), ae = (s) => s !== "." && s !== ".." && s.includes("."), ce = /^\.\*+$/, le = (s) => s !== "." && s !== ".." && s.startsWith("."), he = /^\*+$/, ue = (s) => s.length !== 0 && !s.startsWith("."), fe = (s) => s.length !== 0 && s !== "." && s !== "..", de = /^\?+([^+@!?\*\[\(]*)?$/, pe = ([s, t = ""]) => {
698
695
  const e = dt([s]);
699
696
  return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
700
697
  }, ge = ([s, t = ""]) => {
701
- const e = dt([s]);
702
- return t ? (n) => e(n) && n.endsWith(t) : e;
698
+ const e = pt([s]);
699
+ return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
703
700
  }, me = ([s, t = ""]) => {
704
- const e = ft([s]);
701
+ const e = pt([s]);
705
702
  return t ? (n) => e(n) && n.endsWith(t) : e;
706
- }, ft = ([s]) => {
703
+ }, we = ([s, t = ""]) => {
704
+ const e = dt([s]);
705
+ return t ? (n) => e(n) && n.endsWith(t) : e;
706
+ }, dt = ([s]) => {
707
707
  const t = s.length;
708
708
  return (e) => e.length === t && !e.startsWith(".");
709
- }, dt = ([s]) => {
709
+ }, pt = ([s]) => {
710
710
  const t = s.length;
711
711
  return (e) => e.length === t && e !== "." && e !== "..";
712
- }, pt = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", nt = {
712
+ }, gt = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", nt = {
713
713
  win32: { sep: "\\" },
714
714
  posix: { sep: "/" }
715
- }, we = pt === "win32" ? nt.win32.sep : nt.posix.sep;
716
- y.sep = we;
717
- const b = Symbol("globstar **");
718
- y.GLOBSTAR = b;
719
- const ye = "[^/]", Ee = ye + "*?", Se = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", xe = "(?:(?!(?:\\/|^)\\.).)*?", ve = (s, t = {}) => (e) => y(e, s, t);
715
+ }, ye = gt === "win32" ? nt.win32.sep : nt.posix.sep;
716
+ y.sep = ye;
717
+ const v = Symbol("globstar **");
718
+ y.GLOBSTAR = v;
719
+ const Ee = "[^/]", Se = Ee + "*?", xe = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", be = "(?:(?!(?:\\/|^)\\.).)*?", ve = (s, t = {}) => (e) => y(e, s, t);
720
720
  y.filter = ve;
721
- const v = (s, t = {}) => Object.assign({}, s, t), be = (s) => {
721
+ const b = (s, t = {}) => Object.assign({}, s, t), Oe = (s) => {
722
722
  if (!s || typeof s != "object" || !Object.keys(s).length)
723
723
  return y;
724
724
  const t = y;
725
- return Object.assign((n, r, i = {}) => t(n, r, v(s, i)), {
725
+ return Object.assign((n, r, i = {}) => t(n, r, b(s, i)), {
726
726
  Minimatch: class extends t.Minimatch {
727
727
  constructor(r, i = {}) {
728
- super(r, v(s, i));
728
+ super(r, b(s, i));
729
729
  }
730
730
  static defaults(r) {
731
- return t.defaults(v(s, r)).Minimatch;
731
+ return t.defaults(b(s, r)).Minimatch;
732
732
  }
733
733
  },
734
734
  AST: class extends t.AST {
735
735
  /* c8 ignore start */
736
736
  constructor(r, i, o = {}) {
737
- super(r, i, v(s, o));
737
+ super(r, i, b(s, o));
738
738
  }
739
739
  /* c8 ignore stop */
740
740
  static fromGlob(r, i = {}) {
741
- return t.AST.fromGlob(r, v(s, i));
741
+ return t.AST.fromGlob(r, b(s, i));
742
742
  }
743
743
  },
744
- unescape: (n, r = {}) => t.unescape(n, v(s, r)),
745
- escape: (n, r = {}) => t.escape(n, v(s, r)),
746
- filter: (n, r = {}) => t.filter(n, v(s, r)),
747
- defaults: (n) => t.defaults(v(s, n)),
748
- makeRe: (n, r = {}) => t.makeRe(n, v(s, r)),
749
- braceExpand: (n, r = {}) => t.braceExpand(n, v(s, r)),
750
- match: (n, r, i = {}) => t.match(n, r, v(s, i)),
744
+ unescape: (n, r = {}) => t.unescape(n, b(s, r)),
745
+ escape: (n, r = {}) => t.escape(n, b(s, r)),
746
+ filter: (n, r = {}) => t.filter(n, b(s, r)),
747
+ defaults: (n) => t.defaults(b(s, n)),
748
+ makeRe: (n, r = {}) => t.makeRe(n, b(s, r)),
749
+ braceExpand: (n, r = {}) => t.braceExpand(n, b(s, r)),
750
+ match: (n, r, i = {}) => t.match(n, r, b(s, i)),
751
751
  sep: t.sep,
752
- GLOBSTAR: b
752
+ GLOBSTAR: v
753
753
  });
754
754
  };
755
- y.defaults = be;
756
- const gt = (s, t = {}) => (L(s), t.nobrace || !/\{(?:(?!\{).)*\}/.test(s) ? [s] : Lt(s));
757
- y.braceExpand = gt;
758
- const Oe = (s, t = {}) => new W(s, t).makeRe();
759
- y.makeRe = Oe;
760
- const Ae = (s, t, e = {}) => {
761
- const n = new W(t, e);
755
+ y.defaults = Oe;
756
+ const mt = (s, t = {}) => (L(s), t.nobrace || !/\{(?:(?!\{).)*\}/.test(s) ? [s] : zt(s));
757
+ y.braceExpand = mt;
758
+ const Ae = (s, t = {}) => new B(s, t).makeRe();
759
+ y.makeRe = Ae;
760
+ const De = (s, t, e = {}) => {
761
+ const n = new B(t, e);
762
762
  return s = s.filter((r) => n.match(r)), n.options.nonull && !s.length && s.push(t), s;
763
763
  };
764
- y.match = Ae;
765
- const rt = /[?*]|[+@!]\(.*?\)|\[|\]/, De = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
766
- class W {
764
+ y.match = De;
765
+ const rt = /[?*]|[+@!]\(.*?\)|\[|\]/, Ne = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
766
+ class B {
767
767
  options;
768
768
  set;
769
769
  pattern;
@@ -782,7 +782,7 @@ class W {
782
782
  windowsNoMagicRoot;
783
783
  regexp;
784
784
  constructor(t, e = {}) {
785
- L(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || pt, this.isWindows = this.platform === "win32", this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!e.nonegate, this.comment = !1, this.empty = !1, 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();
785
+ L(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || gt, this.isWindows = this.platform === "win32", this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!e.nonegate, this.comment = !1, this.empty = !1, 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();
786
786
  }
787
787
  hasMagic() {
788
788
  if (this.options.magicalBraces && this.set.length > 1)
@@ -808,15 +808,15 @@ class W {
808
808
  this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...i) => console.error(...i)), this.debug(this.pattern, this.globSet);
809
809
  const n = this.globSet.map((i) => this.slashSplit(i));
810
810
  this.globParts = this.preprocess(n), this.debug(this.pattern, this.globParts);
811
- let r = this.globParts.map((i, o, a) => {
811
+ let r = this.globParts.map((i, o, c) => {
812
812
  if (this.isWindows && this.windowsNoMagicRoot) {
813
- const c = i[0] === "" && i[1] === "" && (i[2] === "?" || !rt.test(i[2])) && !rt.test(i[3]), l = /^[a-z]:/i.test(i[0]);
814
- if (c)
815
- return [...i.slice(0, 4), ...i.slice(4).map((h) => this.parse(h))];
816
- if (l)
817
- return [i[0], ...i.slice(1).map((h) => this.parse(h))];
813
+ const a = i[0] === "" && i[1] === "" && (i[2] === "?" || !rt.test(i[2])) && !rt.test(i[3]), h = /^[a-z]:/i.test(i[0]);
814
+ if (a)
815
+ return [...i.slice(0, 4), ...i.slice(4).map((l) => this.parse(l))];
816
+ if (h)
817
+ return [i[0], ...i.slice(1).map((l) => this.parse(l))];
818
818
  }
819
- return i.map((c) => this.parse(c));
819
+ return i.map((a) => this.parse(a));
820
820
  });
821
821
  if (this.debug(this.pattern, r), this.set = r.filter((i) => i.indexOf(!1) === -1), this.isWindows)
822
822
  for (let i = 0; i < this.set.length; i++) {
@@ -906,18 +906,18 @@ class W {
906
906
  for (; n[o + 1] === "**"; )
907
907
  o++;
908
908
  o > r && n.splice(r + 1, o - r);
909
- let a = n[r + 1];
910
- const c = n[r + 2], l = n[r + 3];
911
- if (a !== ".." || !c || c === "." || c === ".." || !l || l === "." || l === "..")
909
+ let c = n[r + 1];
910
+ const a = n[r + 2], h = n[r + 3];
911
+ if (c !== ".." || !a || a === "." || a === ".." || !h || h === "." || h === "..")
912
912
  continue;
913
913
  e = !0, n.splice(r, 1);
914
- const h = n.slice(0);
915
- h[r] = "**", t.push(h), r--;
914
+ const l = n.slice(0);
915
+ l[r] = "**", t.push(l), r--;
916
916
  }
917
917
  if (!this.preserveMultipleSlashes) {
918
918
  for (let o = 1; o < n.length - 1; o++) {
919
- const a = n[o];
920
- o === 1 && a === "" && n[0] === "" || (a === "." || a === "") && (e = !0, n.splice(o, 1), o--);
919
+ const c = n[o];
920
+ o === 1 && c === "" && n[0] === "" || (c === "." || c === "") && (e = !0, n.splice(o, 1), o--);
921
921
  }
922
922
  n[0] === "." && n.length === 2 && (n[1] === "." || n[1] === "") && (e = !0, n.pop());
923
923
  }
@@ -926,8 +926,8 @@ class W {
926
926
  const o = n[i - 1];
927
927
  if (o && o !== "." && o !== ".." && o !== "**") {
928
928
  e = !0;
929
- const c = i === 1 && n[i + 1] === "**" ? ["."] : [];
930
- n.splice(i - 1, 2, ...c), n.length === 0 && n.push(""), i -= 2;
929
+ const a = i === 1 && n[i + 1] === "**" ? ["."] : [];
930
+ n.splice(i - 1, 2, ...a), n.length === 0 && n.push(""), i -= 2;
931
931
  }
932
932
  }
933
933
  }
@@ -953,22 +953,22 @@ class W {
953
953
  return t.filter((e) => e.length);
954
954
  }
955
955
  partsMatch(t, e, n = !1) {
956
- let r = 0, i = 0, o = [], a = "";
956
+ let r = 0, i = 0, o = [], c = "";
957
957
  for (; r < t.length && i < e.length; )
958
958
  if (t[r] === e[i])
959
- o.push(a === "b" ? e[i] : t[r]), r++, i++;
959
+ o.push(c === "b" ? e[i] : t[r]), r++, i++;
960
960
  else if (n && t[r] === "**" && e[i] === t[r + 1])
961
961
  o.push(t[r]), r++;
962
962
  else if (n && e[i] === "**" && t[r] === e[i + 1])
963
963
  o.push(e[i]), i++;
964
964
  else if (t[r] === "*" && e[i] && (this.options.dot || !e[i].startsWith(".")) && e[i] !== "**") {
965
- if (a === "b")
965
+ if (c === "b")
966
966
  return !1;
967
- a = "a", o.push(t[r]), r++, i++;
967
+ c = "a", o.push(t[r]), r++, i++;
968
968
  } else if (e[i] === "*" && t[r] && (this.options.dot || !t[r].startsWith(".")) && t[r] !== "**") {
969
- if (a === "a")
969
+ if (c === "a")
970
970
  return !1;
971
- a = "b", o.push(e[i]), r++, i++;
971
+ c = "b", o.push(e[i]), r++, i++;
972
972
  } else
973
973
  return !1;
974
974
  return t.length === e.length && o;
@@ -992,31 +992,31 @@ class W {
992
992
  if (this.isWindows) {
993
993
  const p = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), S = !p && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), A = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), C = !A && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), x = S ? 3 : p ? 0 : void 0, w = C ? 3 : A ? 0 : void 0;
994
994
  if (typeof x == "number" && typeof w == "number") {
995
- const [T, P] = [t[x], e[w]];
996
- T.toLowerCase() === P.toLowerCase() && (e[w] = T, w > x ? e = e.slice(w) : x > w && (t = t.slice(x)));
995
+ const [T, R] = [t[x], e[w]];
996
+ T.toLowerCase() === R.toLowerCase() && (e[w] = T, w > x ? e = e.slice(w) : x > w && (t = t.slice(x)));
997
997
  }
998
998
  }
999
999
  const { optimizationLevel: i = 1 } = this.options;
1000
1000
  i >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, { file: t, pattern: e }), this.debug("matchOne", t.length, e.length);
1001
- for (var o = 0, a = 0, c = t.length, l = e.length; o < c && a < l; o++, a++) {
1001
+ for (var o = 0, c = 0, a = t.length, h = e.length; o < a && c < h; o++, c++) {
1002
1002
  this.debug("matchOne loop");
1003
- var h = e[a], d = t[o];
1004
- if (this.debug(e, h, d), h === !1)
1003
+ var l = e[c], d = t[o];
1004
+ if (this.debug(e, l, d), l === !1)
1005
1005
  return !1;
1006
- if (h === b) {
1007
- this.debug("GLOBSTAR", [e, h, d]);
1008
- var u = o, f = a + 1;
1009
- if (f === l) {
1010
- for (this.debug("** at the end"); o < c; o++)
1006
+ if (l === v) {
1007
+ this.debug("GLOBSTAR", [e, l, d]);
1008
+ var u = o, f = c + 1;
1009
+ if (f === h) {
1010
+ for (this.debug("** at the end"); o < a; o++)
1011
1011
  if (t[o] === "." || t[o] === ".." || !r.dot && t[o].charAt(0) === ".")
1012
1012
  return !1;
1013
1013
  return !0;
1014
1014
  }
1015
- for (; u < c; ) {
1015
+ for (; u < a; ) {
1016
1016
  var g = t[u];
1017
1017
  if (this.debug(`
1018
1018
  globstar while`, t, u, e, f, g), this.matchOne(t.slice(u), e.slice(f), n))
1019
- return this.debug("globstar found match!", u, c, g), !0;
1019
+ return this.debug("globstar found match!", u, a, g), !0;
1020
1020
  if (g === "." || g === ".." || !r.dot && g.charAt(0) === ".") {
1021
1021
  this.debug("dot detected!", t, u, e, f);
1022
1022
  break;
@@ -1024,32 +1024,32 @@ globstar while`, t, u, e, f, g), this.matchOne(t.slice(u), e.slice(f), n))
1024
1024
  this.debug("globstar swallow a segment, and continue"), u++;
1025
1025
  }
1026
1026
  return !!(n && (this.debug(`
1027
- >>> no match, partial?`, t, u, e, f), u === c));
1027
+ >>> no match, partial?`, t, u, e, f), u === a));
1028
1028
  }
1029
1029
  let p;
1030
- if (typeof h == "string" ? (p = d === h, this.debug("string match", h, d, p)) : (p = h.test(d), this.debug("pattern match", h, d, p)), !p)
1030
+ if (typeof l == "string" ? (p = d === l, this.debug("string match", l, d, p)) : (p = l.test(d), this.debug("pattern match", l, d, p)), !p)
1031
1031
  return !1;
1032
1032
  }
1033
- if (o === c && a === l)
1033
+ if (o === a && c === h)
1034
1034
  return !0;
1035
- if (o === c)
1035
+ if (o === a)
1036
1036
  return n;
1037
- if (a === l)
1038
- return o === c - 1 && t[o] === "";
1037
+ if (c === h)
1038
+ return o === a - 1 && t[o] === "";
1039
1039
  throw new Error("wtf?");
1040
1040
  }
1041
1041
  braceExpand() {
1042
- return gt(this.pattern, this.options);
1042
+ return mt(this.pattern, this.options);
1043
1043
  }
1044
1044
  parse(t) {
1045
1045
  L(t);
1046
1046
  const e = this.options;
1047
1047
  if (t === "**")
1048
- return b;
1048
+ return v;
1049
1049
  if (t === "")
1050
1050
  return "";
1051
1051
  let n, r = null;
1052
- (n = t.match(he)) ? r = e.dot ? ue : le : (n = t.match(Qt)) ? r = (e.nocase ? e.dot ? ne : se : e.dot ? ee : te)(n[1]) : (n = t.match(fe)) ? r = (e.nocase ? e.dot ? pe : de : e.dot ? ge : me)(n) : (n = t.match(re)) ? r = e.dot ? oe : ie : (n = t.match(ae)) && (r = ce);
1052
+ (n = t.match(he)) ? r = e.dot ? fe : ue : (n = t.match(te)) ? r = (e.nocase ? e.dot ? re : ne : e.dot ? se : ee)(n[1]) : (n = t.match(de)) ? r = (e.nocase ? e.dot ? ge : pe : e.dot ? me : we)(n) : (n = t.match(ie)) ? r = e.dot ? ae : oe : (n = t.match(ce)) && (r = le);
1053
1053
  const i = E.fromGlob(t, this.options).toMMPattern();
1054
1054
  return r && typeof i == "object" && Reflect.defineProperty(i, "test", { value: r }), i;
1055
1055
  }
@@ -1059,21 +1059,21 @@ globstar while`, t, u, e, f, g), this.matchOne(t.slice(u), e.slice(f), n))
1059
1059
  const t = this.set;
1060
1060
  if (!t.length)
1061
1061
  return this.regexp = !1, this.regexp;
1062
- const e = this.options, n = e.noglobstar ? Ee : e.dot ? Se : xe, r = new Set(e.nocase ? ["i"] : []);
1063
- let i = t.map((c) => {
1064
- const l = c.map((h) => {
1065
- if (h instanceof RegExp)
1066
- for (const d of h.flags.split(""))
1062
+ const e = this.options, n = e.noglobstar ? Se : e.dot ? xe : be, r = new Set(e.nocase ? ["i"] : []);
1063
+ let i = t.map((a) => {
1064
+ const h = a.map((l) => {
1065
+ if (l instanceof RegExp)
1066
+ for (const d of l.flags.split(""))
1067
1067
  r.add(d);
1068
- return typeof h == "string" ? De(h) : h === b ? b : h._src;
1068
+ return typeof l == "string" ? Ne(l) : l === v ? v : l._src;
1069
1069
  });
1070
- return l.forEach((h, d) => {
1071
- const u = l[d + 1], f = l[d - 1];
1072
- h !== b || f === b || (f === void 0 ? u !== void 0 && u !== b ? l[d + 1] = "(?:\\/|" + n + "\\/)?" + u : l[d] = n : u === void 0 ? l[d - 1] = f + "(?:\\/|" + n + ")?" : u !== b && (l[d - 1] = f + "(?:\\/|\\/" + n + "\\/)" + u, l[d + 1] = b));
1073
- }), l.filter((h) => h !== b).join("/");
1070
+ return h.forEach((l, d) => {
1071
+ const u = h[d + 1], f = h[d - 1];
1072
+ l !== v || f === v || (f === void 0 ? u !== void 0 && u !== v ? h[d + 1] = "(?:\\/|" + n + "\\/)?" + u : h[d] = n : u === void 0 ? h[d - 1] = f + "(?:\\/|" + n + ")?" : u !== v && (h[d - 1] = f + "(?:\\/|\\/" + n + "\\/)" + u, h[d + 1] = v));
1073
+ }), h.filter((l) => l !== v).join("/");
1074
1074
  }).join("|");
1075
- const [o, a] = t.length > 1 ? ["(?:", ")"] : ["", ""];
1076
- i = "^" + o + i + a + "$", this.negate && (i = "^(?!" + i + ").+$");
1075
+ const [o, c] = t.length > 1 ? ["(?:", ")"] : ["", ""];
1076
+ i = "^" + o + i + c + "$", this.negate && (i = "^(?!" + i + ").+$");
1077
1077
  try {
1078
1078
  this.regexp = new RegExp(i, [...r].join(""));
1079
1079
  } catch {
@@ -1099,12 +1099,12 @@ globstar while`, t, u, e, f, g), this.matchOne(t.slice(u), e.slice(f), n))
1099
1099
  this.debug(this.pattern, "set", i);
1100
1100
  let o = r[r.length - 1];
1101
1101
  if (!o)
1102
- for (let a = r.length - 2; !o && a >= 0; a--)
1103
- o = r[a];
1104
- for (let a = 0; a < i.length; a++) {
1105
- const c = i[a];
1106
- let l = r;
1107
- if (n.matchBase && c.length === 1 && (l = [o]), this.matchOne(l, c, e))
1102
+ for (let c = r.length - 2; !o && c >= 0; c--)
1103
+ o = r[c];
1104
+ for (let c = 0; c < i.length; c++) {
1105
+ const a = i[c];
1106
+ let h = r;
1107
+ if (n.matchBase && a.length === 1 && (h = [o]), this.matchOne(h, a, e))
1108
1108
  return n.flipNegate ? !0 : !this.negate;
1109
1109
  }
1110
1110
  return n.flipNegate ? !1 : this.negate;
@@ -1114,10 +1114,10 @@ globstar while`, t, u, e, f, g), this.matchOne(t.slice(u), e.slice(f), n))
1114
1114
  }
1115
1115
  }
1116
1116
  y.AST = E;
1117
- y.Minimatch = W;
1118
- y.escape = Kt;
1119
- y.unescape = I;
1120
- const Ne = [
1117
+ y.Minimatch = B;
1118
+ y.escape = Qt;
1119
+ y.unescape = M;
1120
+ const $e = [
1121
1121
  // Images
1122
1122
  ".jpg",
1123
1123
  ".jpeg",
@@ -1174,14 +1174,14 @@ const Ne = [
1174
1174
  ".fbx",
1175
1175
  ".3ds"
1176
1176
  ];
1177
- function He(s) {
1177
+ function Ge(s) {
1178
1178
  const t = s.lastIndexOf(".");
1179
1179
  if (t <= 0)
1180
1180
  return !0;
1181
1181
  const e = s.slice(t).toLowerCase();
1182
- return Ne.includes(e);
1182
+ return $e.includes(e);
1183
1183
  }
1184
- function $e(s, t = "utf-8") {
1184
+ function Ce(s, t = "utf-8") {
1185
1185
  switch (t) {
1186
1186
  case "utf8":
1187
1187
  case "utf-8":
@@ -1190,11 +1190,11 @@ function $e(s, t = "utf-8") {
1190
1190
  case "utf-16le":
1191
1191
  case "ucs2":
1192
1192
  case "ucs-2":
1193
- return Ce(s);
1193
+ return Te(s);
1194
1194
  case "ascii":
1195
- return Fe(s);
1196
- case "latin1":
1197
1195
  return Me(s);
1196
+ case "latin1":
1197
+ return Ie(s);
1198
1198
  case "binary":
1199
1199
  return Uint8Array.from(s, (e) => e.charCodeAt(0));
1200
1200
  case "base64":
@@ -1207,7 +1207,7 @@ function $e(s, t = "utf-8") {
1207
1207
  return console.warn("Encoding not supported, falling back to UTF-8"), new TextEncoder().encode(s);
1208
1208
  }
1209
1209
  }
1210
- function _e(s, t = "utf-8") {
1210
+ function Ve(s, t = "utf-8") {
1211
1211
  switch (t) {
1212
1212
  case "utf8":
1213
1213
  case "utf-8":
@@ -1216,7 +1216,7 @@ function _e(s, t = "utf-8") {
1216
1216
  case "utf-16le":
1217
1217
  case "ucs2":
1218
1218
  case "ucs-2":
1219
- return Te(s);
1219
+ return Fe(s);
1220
1220
  case "latin1":
1221
1221
  return String.fromCharCode(...s);
1222
1222
  case "ascii":
@@ -1229,7 +1229,7 @@ function _e(s, t = "utf-8") {
1229
1229
  return console.warn("Unsupported encoding, falling back to UTF-8"), new TextDecoder().decode(s);
1230
1230
  }
1231
1231
  }
1232
- function Ce(s) {
1232
+ function Te(s) {
1233
1233
  const t = new Uint8Array(s.length * 2);
1234
1234
  for (let e = 0; e < s.length; e++) {
1235
1235
  const n = s.charCodeAt(e);
@@ -1237,26 +1237,26 @@ function Ce(s) {
1237
1237
  }
1238
1238
  return t;
1239
1239
  }
1240
- function Te(s) {
1240
+ function Fe(s) {
1241
1241
  s.length % 2 !== 0 && (console.warn("Invalid UTF-16LE buffer length, truncating last byte"), s = s.slice(0, s.length - 1));
1242
1242
  const t = new Uint16Array(s.buffer, s.byteOffset, s.byteLength / 2);
1243
1243
  return String.fromCharCode(...t);
1244
1244
  }
1245
- function Me(s) {
1245
+ function Ie(s) {
1246
1246
  const t = new Uint8Array(s.length);
1247
1247
  for (let e = 0; e < s.length; e++)
1248
1248
  t[e] = s.charCodeAt(e) & 255;
1249
1249
  return t;
1250
1250
  }
1251
- function Fe(s) {
1251
+ function Me(s) {
1252
1252
  const t = new Uint8Array(s.length);
1253
1253
  for (let e = 0; e < s.length; e++)
1254
1254
  t[e] = s.charCodeAt(e) & 127;
1255
1255
  return t;
1256
1256
  }
1257
- function Ie() {
1257
+ function Re() {
1258
1258
  if (!("storage" in navigator) || !("getDirectory" in navigator.storage))
1259
- throw new wt();
1259
+ throw new yt();
1260
1260
  }
1261
1261
  async function Pe(s, t) {
1262
1262
  return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(`opfs:${s.replace(/\/+/g, "/")}`, { mode: "exclusive" }, t) : t();
@@ -1275,10 +1275,10 @@ function H(s) {
1275
1275
  const t = $(s);
1276
1276
  return t.pop(), Z(t);
1277
1277
  }
1278
- function j(s) {
1278
+ function W(s) {
1279
1279
  return !s || s === "/" ? "/" : s.startsWith("~/") ? `/${s.slice(2)}` : s.startsWith("/") ? s : `/${s}`;
1280
1280
  }
1281
- function Re(s, t = !1) {
1281
+ function ke(s, t = !1) {
1282
1282
  return s = s.replace(/\/$/, ""), t && !s.includes("*") ? `${s}/**` : s;
1283
1283
  }
1284
1284
  function _(s, t) {
@@ -1287,14 +1287,14 @@ function _(s, t) {
1287
1287
  matchBase: !0
1288
1288
  });
1289
1289
  }
1290
- function qe(s, t) {
1290
+ function Ye(s, t) {
1291
1291
  if (!t || Array.isArray(t) && t.length === 0)
1292
1292
  return !1;
1293
- const e = j(s);
1293
+ const e = W(s);
1294
1294
  return (Array.isArray(t) ? t : [t]).some((r) => y(e, r, { dot: !0 }));
1295
1295
  }
1296
- function ke(s) {
1297
- const t = j(s), e = $(t), n = [];
1296
+ function Le(s) {
1297
+ const t = W(s), e = $(t), n = [];
1298
1298
  for (const r of e)
1299
1299
  if (!(r === "." || r === ""))
1300
1300
  if (r === "..") {
@@ -1305,20 +1305,20 @@ function ke(s) {
1305
1305
  n.push(r);
1306
1306
  return Z(n);
1307
1307
  }
1308
- function Ge(s) {
1308
+ function Ze(s) {
1309
1309
  const t = z(s), e = t.lastIndexOf(".");
1310
1310
  return e <= 0 || e === t.length - 1 ? "" : t.slice(e);
1311
1311
  }
1312
- function Ve(s, t = "utf-8") {
1313
- return typeof s == "string" ? $e(s, t) : s instanceof Uint8Array ? s : new Uint8Array(s);
1312
+ function Je(s, t = "utf-8") {
1313
+ return typeof s == "string" ? Ce(s, t) : s instanceof Uint8Array ? s : new Uint8Array(s);
1314
1314
  }
1315
- async function Le(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1315
+ async function ze(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1316
1316
  if (s instanceof File && (s = await s.arrayBuffer()), s.byteLength > e)
1317
1317
  throw new Error(`File size ${s.byteLength} bytes exceeds maximum allowed size ${e} bytes`);
1318
1318
  const n = new Uint8Array(s), r = await crypto.subtle.digest(t, n);
1319
1319
  return Array.from(new Uint8Array(r)).map((o) => o.toString(16).padStart(2, "0")).join("");
1320
1320
  }
1321
- function Ye(s, t) {
1321
+ function Xe(s, t) {
1322
1322
  if (s.length !== t.length)
1323
1323
  return !1;
1324
1324
  for (let e = 0; e < s.length; e++)
@@ -1326,11 +1326,11 @@ function Ye(s, t) {
1326
1326
  return !1;
1327
1327
  return !0;
1328
1328
  }
1329
- async function ze(s) {
1329
+ async function Ke(s) {
1330
1330
  const t = await s.arrayBuffer();
1331
1331
  return new Uint8Array(t);
1332
1332
  }
1333
- async function je(s, t, e = {}) {
1333
+ async function We(s, t, e = {}) {
1334
1334
  const n = z(t);
1335
1335
  return Pe(t, async () => {
1336
1336
  const r = e.recursive ?? !1, i = e.force ?? !1;
@@ -1339,16 +1339,16 @@ async function je(s, t, e = {}) {
1339
1339
  } catch (o) {
1340
1340
  if (o.name === "NotFoundError" && i)
1341
1341
  return;
1342
- const a = o.name === "TypeMismatchError" && !r;
1342
+ const c = o.name === "TypeMismatchError" && !r;
1343
1343
  throw O(o, {
1344
1344
  path: t,
1345
1345
  operation: "remove",
1346
- isDirectory: a
1346
+ isDirectory: c
1347
1347
  });
1348
1348
  }
1349
1349
  });
1350
1350
  }
1351
- function Ze(s, t, e, n) {
1351
+ function Qe(s, t, e, n) {
1352
1352
  if (!Number.isInteger(t) || !Number.isInteger(e))
1353
1353
  throw new D("argument", "Invalid offset or length");
1354
1354
  if (t < 0 || e < 0)
@@ -1358,27 +1358,27 @@ function Ze(s, t, e, n) {
1358
1358
  if (n != null && (!Number.isInteger(n) || n < 0))
1359
1359
  throw new D("argument", "Invalid position");
1360
1360
  }
1361
- function Je(s, t, e) {
1361
+ function ts(s, t, e) {
1362
1362
  try {
1363
1363
  t.flush(), t.close();
1364
1364
  } catch (n) {
1365
1365
  console.warn(`Warning: Failed to properly close file descriptor ${s} (${e}):`, n);
1366
1366
  }
1367
1367
  }
1368
- function Xe(s, t, e) {
1368
+ function es(s, t, e) {
1369
1369
  if (s >= e)
1370
1370
  return { isEOF: !0, actualLength: 0 };
1371
1371
  const n = Math.min(t, e - s);
1372
1372
  return n <= 0 ? { isEOF: !0, actualLength: 0 } : { isEOF: !1, actualLength: n };
1373
1373
  }
1374
- async function Ke(s, t) {
1374
+ async function ss(s, t) {
1375
1375
  try {
1376
1376
  return await s.createSyncAccessHandle();
1377
1377
  } catch (e) {
1378
1378
  throw O(e, { path: t, isDirectory: !1 });
1379
1379
  }
1380
1380
  }
1381
- class Qe {
1381
+ class ns {
1382
1382
  /** Root directory handle for the file system */
1383
1383
  root;
1384
1384
  /** Map of watched paths and options */
@@ -1429,7 +1429,7 @@ class Qe {
1429
1429
  }
1430
1430
  }
1431
1431
  constructor(t) {
1432
- Ie(), t && this.setOptions(t);
1432
+ Re(), t && this.setOptions(t);
1433
1433
  }
1434
1434
  /**
1435
1435
  * Initialize the file system within a given directory.
@@ -1442,7 +1442,7 @@ class Qe {
1442
1442
  const r = await navigator.storage.getDirectory();
1443
1443
  this.root = t === "/" ? r : await this.getDirectoryHandle(t, !0, r), e(!0);
1444
1444
  } catch (r) {
1445
- n(new bt(t, r));
1445
+ n(new Ot(t, r));
1446
1446
  } finally {
1447
1447
  this.mountingPromise = null;
1448
1448
  }
@@ -1459,7 +1459,7 @@ class Qe {
1459
1459
  * @param options.broadcastChannel - Custom name for the broadcast channel
1460
1460
  */
1461
1461
  async setOptions(t) {
1462
- t.hashAlgorithm !== void 0 && (this.options.hashAlgorithm = t.hashAlgorithm), t.maxFileSize !== void 0 && (this.options.maxFileSize = t.maxFileSize), t.broadcastChannel !== void 0 && (this.broadcastChannel && this.options.broadcastChannel !== t.broadcastChannel && (this.broadcastChannel.close(), this.broadcastChannel = null), this.options.broadcastChannel = t.broadcastChannel), t.namespace && (this.options.namespace = t.namespace), t.root !== void 0 && (this.options.root = j(t.root), this.options.namespace || (this.options.namespace = `opfs-worker:${this.options.root}`), await this.mount());
1462
+ t.hashAlgorithm !== void 0 && (this.options.hashAlgorithm = t.hashAlgorithm), t.maxFileSize !== void 0 && (this.options.maxFileSize = t.maxFileSize), t.broadcastChannel !== void 0 && (this.broadcastChannel && this.options.broadcastChannel !== t.broadcastChannel && (this.broadcastChannel.close(), this.broadcastChannel = null), this.options.broadcastChannel = t.broadcastChannel), t.namespace && (this.options.namespace = t.namespace), t.root !== void 0 && (this.options.root = W(t.root), this.options.namespace || (this.options.namespace = `opfs-worker:${this.options.root}`), await this.mount());
1463
1463
  }
1464
1464
  /**
1465
1465
  * Get a directory handle from a path
@@ -1508,7 +1508,7 @@ class Qe {
1508
1508
  async getFileHandle(t, e = !1, n = this.root) {
1509
1509
  const r = $(t);
1510
1510
  if (r.length === 0)
1511
- throw new yt("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
1511
+ throw new Et("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
1512
1512
  const i = r.pop();
1513
1513
  return (await this.getDirectoryHandle(r, e, n)).getFileHandle(i, { create: e });
1514
1514
  }
@@ -1537,10 +1537,10 @@ class Qe {
1537
1537
  for (const i of r) {
1538
1538
  const o = `${n === "/" ? "" : n}/${i.name}`;
1539
1539
  try {
1540
- const a = await this.stat(o);
1541
- t.set(o, a), a.isDirectory && await e(o);
1542
- } catch (a) {
1543
- console.warn(`Skipping broken entry: ${o}`, a);
1540
+ const c = await this.stat(o);
1541
+ t.set(o, c), c.isDirectory && await e(o);
1542
+ } catch (c) {
1543
+ console.warn(`Skipping broken entry: ${o}`, c);
1544
1544
  }
1545
1545
  }
1546
1546
  };
@@ -1579,14 +1579,14 @@ class Qe {
1579
1579
  const n = e?.recursive ?? !1, r = $(t);
1580
1580
  let i = this.root;
1581
1581
  for (let o = 0; o < r.length; o++) {
1582
- const a = r[o];
1582
+ const c = r[o];
1583
1583
  try {
1584
- i = await i.getDirectoryHandle(a, { create: n || o === r.length - 1 });
1585
- } catch (c) {
1586
- throw c.name === "NotFoundError" ? O(c, {
1584
+ i = await i.getDirectoryHandle(c, { create: n || o === r.length - 1 });
1585
+ } catch (a) {
1586
+ throw a.name === "NotFoundError" ? O(a, {
1587
1587
  path: Z(r.slice(0, o + 1)),
1588
1588
  existenceType: "directory"
1589
- }) : c.name === "TypeMismatchError" ? O(c, { path: a, isDirectory: !1 }) : new U("create directory", a, c);
1589
+ }) : a.name === "TypeMismatchError" ? O(a, { path: c, isDirectory: !1 }) : new j("create directory", c, a);
1590
1590
  }
1591
1591
  }
1592
1592
  await this.notifyChange({ path: t, type: N.Added, isDirectory: !0 });
@@ -1627,7 +1627,7 @@ class Qe {
1627
1627
  let n;
1628
1628
  try {
1629
1629
  n = await this.getDirectoryHandle(H(t), !1);
1630
- const r = this.options.hashAlgorithm, o = await (await n.getFileHandle(e, { create: !1 })).getFile(), a = {
1630
+ const r = this.options.hashAlgorithm, o = await (await n.getFileHandle(e, { create: !1 })).getFile(), c = {
1631
1631
  kind: "file",
1632
1632
  size: o.size,
1633
1633
  mtime: new Date(o.lastModified).toISOString(),
@@ -1636,20 +1636,20 @@ class Qe {
1636
1636
  isDirectory: !1
1637
1637
  };
1638
1638
  if (r === "etag")
1639
- a.hash = `${o.lastModified.toString(36)}-${o.size.toString(36)}`;
1639
+ c.hash = `${o.lastModified.toString(36)}-${o.size.toString(36)}`;
1640
1640
  else if (typeof r == "string")
1641
1641
  try {
1642
- const c = await Le(o, r, this.options.maxFileSize);
1643
- a.hash = c;
1644
- } catch (c) {
1645
- console.warn(`Failed to calculate hash for ${t}:`, c);
1642
+ const a = await ze(o, r, this.options.maxFileSize);
1643
+ c.hash = a;
1644
+ } catch (a) {
1645
+ console.warn(`Failed to calculate hash for ${t}:`, a);
1646
1646
  }
1647
- return a;
1647
+ return c;
1648
1648
  } catch (r) {
1649
1649
  if (r.name === "NotFoundError")
1650
1650
  throw new k("file", t, r);
1651
1651
  if (r.name !== "TypeMismatchError")
1652
- throw new U("stat", t, r);
1652
+ throw new j("stat", t, r);
1653
1653
  }
1654
1654
  try {
1655
1655
  return await n.getDirectoryHandle(e, { create: !1 }), {
@@ -1661,7 +1661,7 @@ class Qe {
1661
1661
  isDirectory: !0
1662
1662
  };
1663
1663
  } catch (r) {
1664
- throw new U("stat", t, r);
1664
+ throw new j("stat", t, r);
1665
1665
  }
1666
1666
  }
1667
1667
  /**
@@ -1797,7 +1797,7 @@ class Qe {
1797
1797
  if (await this.mount(), t === "/")
1798
1798
  throw new G("EROOT", t);
1799
1799
  const { recursive: n = !1, force: r = !1 } = e || {}, i = await this.getDirectoryHandle(H(t), !1), o = await this.stat(t);
1800
- await je(i, t, { recursive: n, force: r }), await this.notifyChange({ path: t, type: N.Removed, isDirectory: o.isDirectory });
1800
+ await We(i, t, { recursive: n, force: r }), await this.notifyChange({ path: t, type: N.Removed, isDirectory: o.isDirectory });
1801
1801
  }
1802
1802
  /**
1803
1803
  * Resolve a path to an absolute path
@@ -1820,7 +1820,7 @@ class Qe {
1820
1820
  async realpath(t) {
1821
1821
  await this.mount();
1822
1822
  try {
1823
- const e = ke(t);
1823
+ const e = Le(t);
1824
1824
  if (!await this.exists(e))
1825
1825
  throw new k("file", e);
1826
1826
  return e;
@@ -1895,15 +1895,15 @@ class Qe {
1895
1895
  if (await this.exists(e) && !i)
1896
1896
  throw new X(e);
1897
1897
  if ((await this.stat(t)).isFile) {
1898
- const l = await this.readFile(t);
1899
- await this.writeFile(e, l);
1898
+ const h = await this.readFile(t);
1899
+ await this.writeFile(e, h);
1900
1900
  } else {
1901
1901
  if (!r)
1902
1902
  throw new q("directory", t);
1903
1903
  await this.mkdir(e, { recursive: !0 });
1904
- const l = await this.readDir(t);
1905
- for (const h of l) {
1906
- const d = `${t}/${h.name}`, u = `${e}/${h.name}`;
1904
+ const h = await this.readDir(t);
1905
+ for (const l of h) {
1906
+ const d = `${t}/${l.name}`, u = `${e}/${l.name}`;
1907
1907
  await this.copy(d, u, { recursive: !0, overwrite: i });
1908
1908
  }
1909
1909
  }
@@ -1938,9 +1938,9 @@ class Qe {
1938
1938
  */
1939
1939
  async watch(t, e) {
1940
1940
  if (!this.options.broadcastChannel)
1941
- throw new it("This instance is not configured to send events. Please specify options.broadcastChannel to enable watching.");
1941
+ throw new ot("This instance is not configured to send events. Please specify options.broadcastChannel to enable watching.");
1942
1942
  const n = {
1943
- pattern: Re(t, e?.recursive ?? !0),
1943
+ pattern: ke(t, e?.recursive ?? !0),
1944
1944
  include: Array.isArray(e?.include) ? e.include : [e?.include ?? "**"],
1945
1945
  exclude: Array.isArray(e?.exclude) ? e.exclude : [e?.exclude ?? ""]
1946
1946
  };
@@ -1953,32 +1953,90 @@ class Qe {
1953
1953
  this.watchers.delete(t);
1954
1954
  }
1955
1955
  /**
1956
- * Bulk-create files from `[path, data]` entries (strings, bytes, or Blobs).
1956
+ * Read a file as a `Blob` without copying its bytes into memory.
1957
+ *
1958
+ * OPFS hands back a disk-backed `File`, so the browser can stream it on
1959
+ * demand — pass it to `URL.createObjectURL()` for `<video>` / `<audio>` /
1960
+ * `<img>` and only the played range is actually read. Structured clone keeps
1961
+ * the reference intact when the file system runs in a worker.
1962
+ *
1963
+ * @param path - Path to the file
1964
+ * @returns Lazy `File` handle backed by OPFS storage
1965
+ * @throws {OPFSError} If the path is missing or is a directory
1957
1966
  *
1958
- * @param entries - Array of `[path, data]` tuples
1967
+ * @example
1968
+ * ```typescript
1969
+ * const blob = await fs.readBlob('/media/clip.mp4');
1970
+ * video.src = URL.createObjectURL(blob);
1971
+ * ```
1972
+ */
1973
+ async readBlob(t) {
1974
+ await this.mount();
1975
+ try {
1976
+ return await (await this.getFileHandle(t, !1)).getFile();
1977
+ } catch (e) {
1978
+ throw e instanceof m ? e : O(e, { path: t, isDirectory: e?.name === "TypeMismatchError" });
1979
+ }
1980
+ }
1981
+ /**
1982
+ * Bulk-import files from `[path, data]` entries (strings, bytes, Blobs, or Files).
1983
+ * Each entry is written via {@link writeStream} so large Blobs/Files are not
1984
+ * fully buffered in memory.
1985
+ *
1986
+ * Accepts an array of tuples, a `Map`, or any iterable of `[path, data]` pairs.
1987
+ *
1988
+ * @param entries - Files to write
1989
+ * @param onProgress - Per-chunk progress with path, index, and byte counts
1990
+ * @returns Written paths, count, and total bytes
1959
1991
  * @throws {OPFSError} If a write fails
1960
1992
  *
1961
1993
  * @example
1962
1994
  * ```typescript
1963
- * await fs.createIndex([
1995
+ * const result = await fs.importFiles([
1964
1996
  * ['/config.json', JSON.stringify({ theme: 'dark' })],
1965
1997
  * ['/data/binary.dat', new Uint8Array([1, 2, 3, 4])],
1966
- * ['/upload.txt', new Blob(['file content'], { type: 'text/plain' })],
1967
- * ]);
1998
+ * ['/upload.txt', fileFromInput],
1999
+ * ], (p) => console.log(`${p.path}: ${p.bytesWritten}/${p.bytesTotal}`));
2000
+ *
2001
+ * console.log(result.count, result.bytesWritten, result.paths);
1968
2002
  * ```
1969
2003
  */
1970
- async createIndex(t) {
2004
+ async importFiles(t, e) {
1971
2005
  await this.mount();
2006
+ const n = [...t].map(([a, h]) => [W(a), h]), r = n.length, i = n.map(([a]) => a), o = n.reduce((a, [, h]) => a + Be(h), 0);
2007
+ let c = 0;
1972
2008
  try {
1973
- for (const [e, n] of t) {
1974
- const r = j(e);
1975
- let i;
1976
- n instanceof Blob ? i = await ze(n) : typeof n == "string" ? i = new TextEncoder().encode(n) : i = n, await this.writeFile(r, i);
2009
+ for (let a = 0; a < r; a++) {
2010
+ const [h, l] = n[a], { stream: d, size: u } = je(l), f = c, g = await this.writeStream(
2011
+ h,
2012
+ d,
2013
+ e ? (p) => e({
2014
+ path: h,
2015
+ index: a,
2016
+ count: r,
2017
+ bytesWritten: p,
2018
+ bytesTotal: u,
2019
+ totalBytesWritten: f + p,
2020
+ totalBytes: o
2021
+ }) : void 0
2022
+ );
2023
+ c += g;
1977
2024
  }
1978
- } catch (e) {
1979
- throw e instanceof m ? e : O(e);
2025
+ return {
2026
+ paths: i,
2027
+ count: r,
2028
+ bytesWritten: c
2029
+ };
2030
+ } catch (a) {
2031
+ throw a instanceof m ? a : O(a);
1980
2032
  }
1981
2033
  }
2034
+ /**
2035
+ * @deprecated Use {@link importFiles} instead.
2036
+ */
2037
+ async createIndex(t) {
2038
+ Ue(), await this.importFiles(t);
2039
+ }
1982
2040
  /**
1983
2041
  * Dispose of resources and clean up the file system instance
1984
2042
  */
@@ -1986,51 +2044,71 @@ class Qe {
1986
2044
  this.broadcastChannel && (this.broadcastChannel.close(), this.broadcastChannel = null), this.watchers.clear();
1987
2045
  }
1988
2046
  }
2047
+ function Be(s) {
2048
+ return typeof s == "string" ? new TextEncoder().encode(s).byteLength : s instanceof Blob ? s.size : s.byteLength;
2049
+ }
2050
+ function je(s) {
2051
+ if (s instanceof Blob)
2052
+ return { stream: s.stream(), size: s.size };
2053
+ const t = typeof s == "string" ? new TextEncoder().encode(s) : s;
2054
+ return {
2055
+ size: t.byteLength,
2056
+ stream: new ReadableStream({
2057
+ start(e) {
2058
+ e.enqueue(t), e.close();
2059
+ }
2060
+ })
2061
+ };
2062
+ }
2063
+ let it = !1;
2064
+ function Ue() {
2065
+ it || (it = !0, console.warn("[opfs-worker] createIndex() is deprecated; use importFiles() instead"));
2066
+ }
1989
2067
  export {
1990
2068
  X as A,
1991
- Qe as B,
1992
- Ze as C,
2069
+ ns as B,
2070
+ Qe as C,
1993
2071
  G as D,
1994
2072
  k as E,
1995
- xt as F,
1996
- Je as G,
1997
- Xe as H,
2073
+ bt as F,
2074
+ ts as G,
2075
+ es as H,
1998
2076
  J as I,
1999
- Ke as J,
2000
- Ne as K,
2001
- He as L,
2002
- $e as M,
2003
- _e as N,
2077
+ ss as J,
2078
+ $e as K,
2079
+ Ge as L,
2080
+ Ce as M,
2081
+ Ve as N,
2004
2082
  m as O,
2005
- yt as P,
2006
- St as S,
2083
+ Et as P,
2084
+ xt as S,
2007
2085
  D as V,
2008
2086
  N as W,
2009
- wt as a,
2010
- Et as b,
2087
+ yt as a,
2088
+ St as b,
2011
2089
  q as c,
2012
2090
  vt as d,
2013
- it as e,
2014
- bt as f,
2015
- U as g,
2016
- We as h,
2017
- Ie as i,
2091
+ ot as e,
2092
+ Ot as f,
2093
+ j as g,
2094
+ He as h,
2095
+ Re as i,
2018
2096
  Z as j,
2019
2097
  z as k,
2020
2098
  H as l,
2021
2099
  O as m,
2022
- j as n,
2023
- Re as o,
2100
+ W as n,
2101
+ ke as o,
2024
2102
  _ as p,
2025
- qe as q,
2026
- ke as r,
2103
+ Ye as q,
2104
+ Le as r,
2027
2105
  $ as s,
2028
- Ge as t,
2029
- Ve as u,
2030
- Le as v,
2106
+ Ze as t,
2107
+ Je as u,
2108
+ ze as v,
2031
2109
  Pe as w,
2032
- Ye as x,
2033
- ze as y,
2034
- je as z
2110
+ Xe as x,
2111
+ Ke as y,
2112
+ We as z
2035
2113
  };
2036
- //# sourceMappingURL=BaseOPFS-Cylz6ijk.js.map
2114
+ //# sourceMappingURL=BaseOPFS-BusBkyJX.js.map