opfs-worker 0.4.2 → 0.5.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.
@@ -1,50 +1,50 @@
1
- class A extends Error {
2
- constructor(t, e, n) {
3
- super(t), this.code = e, this.path = n, this.name = "OPFSError";
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";
4
4
  }
5
5
  }
6
- class nt extends A {
7
- constructor() {
8
- super("OPFS is not supported in this browser", "OPFS_NOT_SUPPORTED");
6
+ class rt extends x {
7
+ constructor(t) {
8
+ super("OPFS is not supported in this browser", "OPFS_NOT_SUPPORTED", void 0, t);
9
9
  }
10
10
  }
11
- class ge extends A {
12
- constructor() {
13
- super("OPFS is not mounted", "OPFS_NOT_MOUNTED");
11
+ class me extends x {
12
+ constructor(t) {
13
+ super("OPFS is not mounted", "OPFS_NOT_MOUNTED", void 0, t);
14
14
  }
15
15
  }
16
- class de extends A {
17
- constructor(t, e) {
18
- super(t, "INVALID_PATH", e);
16
+ class ye extends x {
17
+ constructor(t, e, n) {
18
+ super(t, "INVALID_PATH", e, n);
19
19
  }
20
20
  }
21
- class me extends A {
22
- constructor(t) {
23
- super(`File not found: ${t}`, "FILE_NOT_FOUND", t);
21
+ class we extends x {
22
+ constructor(t, e) {
23
+ super(`File not found: ${t}`, "FILE_NOT_FOUND", t, e);
24
24
  }
25
25
  }
26
- class ye extends A {
27
- constructor(t) {
28
- super(`Directory not found: ${t}`, "DIRECTORY_NOT_FOUND", t);
26
+ class Ee extends x {
27
+ constructor(t, e) {
28
+ super(`Directory not found: ${t}`, "DIRECTORY_NOT_FOUND", t, e);
29
29
  }
30
30
  }
31
- class we extends A {
32
- constructor(t, e) {
33
- super(`Permission denied for ${e} on: ${t}`, "PERMISSION_DENIED", t);
31
+ class xe extends x {
32
+ constructor(t, e, n) {
33
+ super(`Permission denied for ${e} on: ${t}`, "PERMISSION_DENIED", t, n);
34
34
  }
35
35
  }
36
- class Se extends A {
37
- constructor(t, e) {
38
- super(t, "STORAGE_ERROR", e);
36
+ class Se extends x {
37
+ constructor(t, e, n) {
38
+ super(t, "STORAGE_ERROR", e, n);
39
39
  }
40
40
  }
41
- class Ee extends A {
42
- constructor(t, e) {
43
- super(`Operation timed out: ${t}`, "TIMEOUT_ERROR", e);
41
+ class be extends x {
42
+ constructor(t, e, n) {
43
+ super(`Operation timed out: ${t}`, "TIMEOUT_ERROR", e, n);
44
44
  }
45
45
  }
46
- const q = (s, t, e) => {
47
- const n = s instanceof RegExp ? j(s, e) : s, i = t instanceof RegExp ? j(t, e) : t, r = n !== null && i != null && it(n, i, e);
46
+ 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
48
  return r && {
49
49
  start: r[0],
50
50
  end: r[1],
@@ -52,10 +52,10 @@ const q = (s, t, e) => {
52
52
  body: e.slice(r[0] + n.length, r[1]),
53
53
  post: e.slice(r[1] + i.length)
54
54
  };
55
- }, j = (s, t) => {
55
+ }, W = (s, t) => {
56
56
  const e = t.match(s);
57
57
  return e ? e[0] : null;
58
- }, it = (s, t, e) => {
58
+ }, ot = (s, t, e) => {
59
59
  let n, i, r, o, a, h = e.indexOf(s), l = e.indexOf(t, h + 1), c = h;
60
60
  if (h >= 0 && l > 0) {
61
61
  if (s === t)
@@ -73,44 +73,44 @@ const q = (s, t, e) => {
73
73
  n.length && o !== void 0 && (a = [r, o]);
74
74
  }
75
75
  return a;
76
- }, H = "\0SLASH" + Math.random() + "\0", Z = "\0OPEN" + Math.random() + "\0", W = "\0CLOSE" + Math.random() + "\0", J = "\0COMMA" + Math.random() + "\0", V = "\0PERIOD" + Math.random() + "\0", rt = new RegExp(H, "g"), ot = new RegExp(Z, "g"), ct = new RegExp(W, "g"), at = new RegExp(J, "g"), ht = new RegExp(V, "g"), lt = /\\\\/g, ut = /\\{/g, ft = /\\}/g, pt = /\\,/g, gt = /\\./g;
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
77
  function L(s) {
78
78
  return isNaN(s) ? s.charCodeAt(0) : parseInt(s, 10);
79
79
  }
80
- function dt(s) {
81
- return s.replace(lt, H).replace(ut, Z).replace(ft, W).replace(pt, J).replace(gt, V);
80
+ function yt(s) {
81
+ return s.replace(ft, Z).replace(pt, J).replace(dt, F).replace(gt, V).replace(mt, X);
82
82
  }
83
- function mt(s) {
84
- return s.replace(rt, "\\").replace(ot, "{").replace(ct, "}").replace(at, ",").replace(ht, ".");
83
+ function wt(s) {
84
+ return s.replace(ct, "\\").replace(at, "{").replace(ht, "}").replace(lt, ",").replace(ut, ".");
85
85
  }
86
- function X(s) {
86
+ function Y(s) {
87
87
  if (!s)
88
88
  return [""];
89
- const t = [], e = q("{", "}", s);
89
+ const t = [], e = H("{", "}", s);
90
90
  if (!e)
91
91
  return s.split(",");
92
92
  const { pre: n, body: i, post: r } = e, o = n.split(",");
93
93
  o[o.length - 1] += "{" + i + "}";
94
- const a = X(r);
94
+ const a = Y(r);
95
95
  return r.length && (o[o.length - 1] += a.shift(), o.push.apply(o, a)), t.push.apply(t, o), t;
96
96
  }
97
- function yt(s) {
98
- return s ? (s.slice(0, 2) === "{}" && (s = "\\{\\}" + s.slice(2)), T(dt(s), !0).map(mt)) : [];
97
+ function Et(s) {
98
+ return s ? (s.slice(0, 2) === "{}" && (s = "\\{\\}" + s.slice(2)), T(yt(s), !0).map(wt)) : [];
99
99
  }
100
- function wt(s) {
100
+ function xt(s) {
101
101
  return "{" + s + "}";
102
102
  }
103
103
  function St(s) {
104
104
  return /^-?0\d/.test(s);
105
105
  }
106
- function Et(s, t) {
106
+ function bt(s, t) {
107
107
  return s <= t;
108
108
  }
109
- function xt(s, t) {
109
+ function Ot(s, t) {
110
110
  return s >= t;
111
111
  }
112
112
  function T(s, t) {
113
- const e = [], n = q("{", "}", s);
113
+ const e = [], n = H("{", "}", s);
114
114
  if (!n)
115
115
  return [s];
116
116
  const i = n.pre, r = n.post.length ? T(n.post, !1) : [""];
@@ -122,28 +122,28 @@ function T(s, t) {
122
122
  else {
123
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
124
  if (!h && !l)
125
- return n.post.match(/,(?!,).*\}/) ? (s = n.pre + "{" + n.body + W + n.post, T(s)) : [s];
125
+ return n.post.match(/,(?!,).*\}/) ? (s = n.pre + "{" + n.body + F + n.post, T(s)) : [s];
126
126
  let c;
127
127
  if (h)
128
128
  c = n.body.split(/\.\./);
129
- else if (c = X(n.body), c.length === 1 && c[0] !== void 0 && (c = T(c[0], !1).map(wt), c.length === 1))
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
130
  return r.map((f) => n.pre + c[0] + f);
131
131
  let p;
132
132
  if (h && c[0] !== void 0 && c[1] !== void 0) {
133
- const f = L(c[0]), u = L(c[1]), d = Math.max(c[0].length, c[1].length);
134
- let g = c.length === 3 && c[2] !== void 0 ? Math.abs(L(c[2])) : 1, S = Et;
135
- u < f && (g *= -1, S = xt);
136
- const N = c.some(St);
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);
137
137
  p = [];
138
- for (let E = f; S(E, u); E += g) {
138
+ for (let S = f; E(S, u); S += d) {
139
139
  let m;
140
140
  if (a)
141
- m = String.fromCharCode(E), m === "\\" && (m = "");
142
- else if (m = String(E), N) {
143
- const P = d - m.length;
144
- if (P > 0) {
145
- const R = new Array(P + 1).join("0");
146
- E < 0 ? m = "-" + R + m.slice(1) : m = R + m;
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;
147
147
  }
148
148
  }
149
149
  p.push(m);
@@ -155,16 +155,16 @@ function T(s, t) {
155
155
  }
156
156
  for (let f = 0; f < p.length; f++)
157
157
  for (let u = 0; u < r.length; u++) {
158
- const d = i + p[f] + r[u];
159
- (!t || h || d) && e.push(d);
158
+ const g = i + p[f] + r[u];
159
+ (!t || h || g) && e.push(g);
160
160
  }
161
161
  }
162
162
  return e;
163
163
  }
164
- const Ot = 1024 * 64, v = (s) => {
164
+ const vt = 1024 * 64, C = (s) => {
165
165
  if (typeof s != "string")
166
166
  throw new TypeError("invalid pattern");
167
- if (s.length > Ot)
167
+ if (s.length > vt)
168
168
  throw new TypeError("pattern is too long");
169
169
  }, At = {
170
170
  "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
@@ -181,60 +181,60 @@ const Ot = 1024 * 64, v = (s) => {
181
181
  "[:upper:]": ["\\p{Lu}", !0],
182
182
  "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
183
183
  "[:xdigit:]": ["A-Fa-f0-9", !1]
184
- }, $ = (s) => s.replace(/[[\]\\-]/g, "\\$&"), bt = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), k = (s) => s.join(""), Nt = (s, t) => {
184
+ }, $ = (s) => s.replace(/[[\]\\-]/g, "\\$&"), Nt = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), k = (s) => s.join(""), $t = (s, t) => {
185
185
  const e = t;
186
186
  if (s.charAt(e) !== "[")
187
187
  throw new Error("not in a brace expression");
188
188
  const n = [], i = [];
189
189
  let r = e + 1, o = !1, a = !1, h = !1, l = !1, c = e, p = "";
190
190
  t: for (; r < s.length; ) {
191
- const g = s.charAt(r);
192
- if ((g === "!" || g === "^") && r === e + 1) {
191
+ const d = s.charAt(r);
192
+ if ((d === "!" || d === "^") && r === e + 1) {
193
193
  l = !0, r++;
194
194
  continue;
195
195
  }
196
- if (g === "]" && o && !h) {
196
+ if (d === "]" && o && !h) {
197
197
  c = r + 1;
198
198
  break;
199
199
  }
200
- if (o = !0, g === "\\" && !h) {
200
+ if (o = !0, d === "\\" && !h) {
201
201
  h = !0, r++;
202
202
  continue;
203
203
  }
204
- if (g === "[" && !h) {
205
- for (const [S, [b, N, E]] of Object.entries(At))
206
- if (s.startsWith(S, r)) {
204
+ if (d === "[" && !h) {
205
+ for (const [E, [v, A, S]] of Object.entries(At))
206
+ if (s.startsWith(E, r)) {
207
207
  if (p)
208
208
  return ["$.", !1, s.length - e, !0];
209
- r += S.length, E ? i.push(b) : n.push(b), a = a || N;
209
+ r += E.length, S ? i.push(v) : n.push(v), a = a || A;
210
210
  continue t;
211
211
  }
212
212
  }
213
213
  if (h = !1, p) {
214
- g > p ? n.push($(p) + "-" + $(g)) : g === p && n.push($(g)), p = "", r++;
214
+ d > p ? n.push($(p) + "-" + $(d)) : d === p && n.push($(d)), p = "", r++;
215
215
  continue;
216
216
  }
217
217
  if (s.startsWith("-]", r + 1)) {
218
- n.push($(g + "-")), r += 2;
218
+ n.push($(d + "-")), r += 2;
219
219
  continue;
220
220
  }
221
221
  if (s.startsWith("-", r + 1)) {
222
- p = g, r += 2;
222
+ p = d, r += 2;
223
223
  continue;
224
224
  }
225
- n.push($(g)), r++;
225
+ n.push($(d)), r++;
226
226
  }
227
227
  if (c < r)
228
228
  return ["", !1, 0, !1];
229
229
  if (!n.length && !i.length)
230
230
  return ["$.", !1, s.length - e, !0];
231
231
  if (i.length === 0 && n.length === 1 && /^\\?.$/.test(n[0]) && !l) {
232
- const g = n[0].length === 2 ? n[0].slice(-1) : n[0];
233
- return [bt(g), !1, c - e, !1];
232
+ const d = n[0].length === 2 ? n[0].slice(-1) : n[0];
233
+ return [Nt(d), !1, c - e, !1];
234
234
  }
235
235
  const f = "[" + (l ? "^" : "") + k(n) + "]", u = "[" + (l ? "" : "^") + k(i) + "]";
236
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"), Pt = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), z = (s) => Pt.has(s), $t = "(?!(?:^|/)\\.\\.?(?:$|/))", C = "(?!\\.)", Tt = /* @__PURE__ */ new Set(["[", "."]), Mt = /* @__PURE__ */ new Set(["..", "."]), Rt = new Set("().*{}+?[]^$\\!"), Ct = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), F = "[^/]", I = F + "*?", _ = F + "+?";
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
238
  class w {
239
239
  type;
240
240
  #s;
@@ -337,29 +337,29 @@ class w {
337
337
  static #l(t, e, n, i) {
338
338
  let r = !1, o = !1, a = -1, h = !1;
339
339
  if (e.type === null) {
340
- let u = n, d = "";
340
+ let u = n, g = "";
341
341
  for (; u < t.length; ) {
342
- const g = t.charAt(u++);
343
- if (r || g === "\\") {
344
- r = !r, d += g;
342
+ const d = t.charAt(u++);
343
+ if (r || d === "\\") {
344
+ r = !r, g += d;
345
345
  continue;
346
346
  }
347
347
  if (o) {
348
- u === a + 1 ? (g === "^" || g === "!") && (h = !0) : g === "]" && !(u === a + 2 && h) && (o = !1), d += g;
348
+ u === a + 1 ? (d === "^" || d === "!") && (h = !0) : d === "]" && !(u === a + 2 && h) && (o = !1), g += d;
349
349
  continue;
350
- } else if (g === "[") {
351
- o = !0, a = u, h = !1, d += g;
350
+ } else if (d === "[") {
351
+ o = !0, a = u, h = !1, g += d;
352
352
  continue;
353
353
  }
354
- if (!i.noext && z(g) && t.charAt(u) === "(") {
355
- e.push(d), d = "";
356
- const S = new w(g, e);
357
- u = w.#l(t, S, u, i), e.push(S);
354
+ if (!i.noext && z(d) && t.charAt(u) === "(") {
355
+ e.push(g), g = "";
356
+ const E = new w(d, e);
357
+ u = w.#l(t, E, u, i), e.push(E);
358
358
  continue;
359
359
  }
360
- d += g;
360
+ g += d;
361
361
  }
362
- return e.push(d), u;
362
+ return e.push(g), u;
363
363
  }
364
364
  let l = n + 1, c = new w(null, e);
365
365
  const p = [];
@@ -379,8 +379,8 @@ class w {
379
379
  }
380
380
  if (z(u) && t.charAt(l) === "(") {
381
381
  c.push(f), f = "";
382
- const d = new w(u, c);
383
- c.push(d), l = w.#l(t, d, l, i);
382
+ const g = new w(u, c);
383
+ c.push(g), l = w.#l(t, g, l, i);
384
384
  continue;
385
385
  }
386
386
  if (u === "|") {
@@ -487,18 +487,18 @@ class w {
487
487
  const e = t ?? !!this.#i.dot;
488
488
  if (this.#s === this && this.#p(), !this.type) {
489
489
  const h = this.isStart() && this.isEnd(), l = this.#t.map((u) => {
490
- const [d, g, S, b] = typeof u == "string" ? w.#g(u, this.#n, h) : u.toRegExpSource(t);
491
- return this.#n = this.#n || S, this.#r = this.#r || b, d;
490
+ const [g, d, E, v] = typeof u == "string" ? w.#d(u, this.#n, h) : u.toRegExpSource(t);
491
+ return this.#n = this.#n || E, this.#r = this.#r || v, g;
492
492
  }).join("");
493
493
  let c = "";
494
- if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && Mt.has(this.#t[0]))) {
495
- const d = Tt, g = (
494
+ if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && Rt.has(this.#t[0]))) {
495
+ const g = Pt, d = (
496
496
  // dots are allowed, and the pattern starts with [ or .
497
- e && d.has(l.charAt(0)) || // the pattern starts with \., and then [ or .
498
- l.startsWith("\\.") && d.has(l.charAt(2)) || // the pattern starts with \.\., and then [ or .
499
- l.startsWith("\\.\\.") && d.has(l.charAt(4))
500
- ), S = !e && !t && d.has(l.charAt(0));
501
- c = g ? $t : S ? C : "";
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 : "";
502
502
  }
503
503
  let p = "";
504
504
  return this.isEnd() && this.#s.#c && this.#e?.type === "!" && (p = "(?:$|\\/)"), [
@@ -514,15 +514,15 @@ class w {
514
514
  const h = this.toString();
515
515
  return this.#t = [h], this.type = null, this.#n = void 0, [h, M(this.toString()), !1, !1];
516
516
  }
517
- let o = !n || t || e || !C ? "" : this.#f(!0);
517
+ let o = !n || t || e || !R ? "" : this.#f(!0);
518
518
  o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
519
519
  let a = "";
520
520
  if (this.type === "!" && this.#u)
521
- a = (this.isStart() && !e ? C : "") + _;
521
+ a = (this.isStart() && !e ? R : "") + B;
522
522
  else {
523
523
  const h = this.type === "!" ? (
524
524
  // !() must match something,but !(x) can match ''
525
- "))" + (this.isStart() && !e && !t ? C : "") + I + ")"
525
+ "))" + (this.isStart() && !e && !t ? R : "") + _ + ")"
526
526
  ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
527
527
  a = i + r + h;
528
528
  }
@@ -541,12 +541,12 @@ class w {
541
541
  return this.#r = this.#r || o, n;
542
542
  }).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
543
543
  }
544
- static #g(t, e, n = !1) {
544
+ static #d(t, e, n = !1) {
545
545
  let i = !1, r = "", o = !1;
546
546
  for (let a = 0; a < t.length; a++) {
547
547
  const h = t.charAt(a);
548
548
  if (i) {
549
- i = !1, r += (Rt.has(h) ? "\\" : "") + h;
549
+ i = !1, r += (Ct.has(h) ? "\\" : "") + h;
550
550
  continue;
551
551
  }
552
552
  if (h === "\\") {
@@ -554,97 +554,97 @@ class w {
554
554
  continue;
555
555
  }
556
556
  if (h === "[") {
557
- const [l, c, p, f] = Nt(t, a);
557
+ const [l, c, p, f] = $t(t, a);
558
558
  if (p) {
559
559
  r += l, o = o || c, a += p - 1, e = e || f;
560
560
  continue;
561
561
  }
562
562
  }
563
563
  if (h === "*") {
564
- n && t === "*" ? r += _ : r += I, e = !0;
564
+ n && t === "*" ? r += B : r += _, e = !0;
565
565
  continue;
566
566
  }
567
567
  if (h === "?") {
568
- r += F, e = !0;
568
+ r += j, e = !0;
569
569
  continue;
570
570
  }
571
- r += Ct(h);
571
+ r += Dt(h);
572
572
  }
573
573
  return [r, M(t), !!e, o];
574
574
  }
575
575
  }
576
- const vt = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&"), y = (s, t, e = {}) => (v(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D(t, e).match(s)), Dt = /^\*+([^+@!?\*\[\(]*)$/, Lt = (s) => (t) => !t.startsWith(".") && t.endsWith(s), Wt = (s) => (t) => t.endsWith(s), Ft = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), Ut = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), jt = /^\*+\.\*+$/, kt = (s) => !s.startsWith(".") && s.includes("."), zt = (s) => s !== "." && s !== ".." && s.includes("."), It = /^\.\*+$/, _t = (s) => s !== "." && s !== ".." && s.startsWith("."), Bt = /^\*+$/, Gt = (s) => s.length !== 0 && !s.startsWith("."), qt = (s) => s.length !== 0 && s !== "." && s !== "..", Ht = /^\?+([^+@!?\*\[\(]*)?$/, Zt = ([s, t = ""]) => {
577
- const e = Y([s]);
578
- return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
579
- }, Jt = ([s, t = ""]) => {
576
+ 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 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 = ""]) => {
580
577
  const e = K([s]);
581
578
  return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
582
- }, Vt = ([s, t = ""]) => {
583
- const e = K([s]);
584
- return t ? (n) => e(n) && n.endsWith(t) : e;
585
579
  }, Xt = ([s, t = ""]) => {
586
- const e = Y([s]);
580
+ const e = Q([s]);
581
+ return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
582
+ }, Yt = ([s, t = ""]) => {
583
+ const e = Q([s]);
587
584
  return t ? (n) => e(n) && n.endsWith(t) : e;
588
- }, Y = ([s]) => {
585
+ }, Kt = ([s, t = ""]) => {
586
+ const e = K([s]);
587
+ return t ? (n) => e(n) && n.endsWith(t) : e;
588
+ }, K = ([s]) => {
589
589
  const t = s.length;
590
590
  return (e) => e.length === t && !e.startsWith(".");
591
- }, K = ([s]) => {
591
+ }, Q = ([s]) => {
592
592
  const t = s.length;
593
593
  return (e) => e.length === t && e !== "." && e !== "..";
594
- }, Q = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", B = {
594
+ }, tt = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", q = {
595
595
  win32: { sep: "\\" },
596
596
  posix: { sep: "/" }
597
- }, Yt = Q === "win32" ? B.win32.sep : B.posix.sep;
598
- y.sep = Yt;
597
+ }, Qt = tt === "win32" ? q.win32.sep : q.posix.sep;
598
+ y.sep = Qt;
599
599
  const O = Symbol("globstar **");
600
600
  y.GLOBSTAR = O;
601
- const Kt = "[^/]", Qt = Kt + "*?", te = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", ee = "(?:(?!(?:\\/|^)\\.).)*?", se = (s, t = {}) => (e) => y(e, s, t);
602
- y.filter = se;
603
- const x = (s, t = {}) => Object.assign({}, s, t), ne = (s) => {
601
+ const te = "[^/]", ee = te + "*?", se = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", ne = "(?:(?!(?:\\/|^)\\.).)*?", ie = (s, t = {}) => (e) => y(e, s, t);
602
+ y.filter = ie;
603
+ const b = (s, t = {}) => Object.assign({}, s, t), re = (s) => {
604
604
  if (!s || typeof s != "object" || !Object.keys(s).length)
605
605
  return y;
606
606
  const t = y;
607
- return Object.assign((n, i, r = {}) => t(n, i, x(s, r)), {
607
+ return Object.assign((n, i, r = {}) => t(n, i, b(s, r)), {
608
608
  Minimatch: class extends t.Minimatch {
609
609
  constructor(i, r = {}) {
610
- super(i, x(s, r));
610
+ super(i, b(s, r));
611
611
  }
612
612
  static defaults(i) {
613
- return t.defaults(x(s, i)).Minimatch;
613
+ return t.defaults(b(s, i)).Minimatch;
614
614
  }
615
615
  },
616
616
  AST: class extends t.AST {
617
617
  /* c8 ignore start */
618
618
  constructor(i, r, o = {}) {
619
- super(i, r, x(s, o));
619
+ super(i, r, b(s, o));
620
620
  }
621
621
  /* c8 ignore stop */
622
622
  static fromGlob(i, r = {}) {
623
- return t.AST.fromGlob(i, x(s, r));
623
+ return t.AST.fromGlob(i, b(s, r));
624
624
  }
625
625
  },
626
- unescape: (n, i = {}) => t.unescape(n, x(s, i)),
627
- escape: (n, i = {}) => t.escape(n, x(s, i)),
628
- filter: (n, i = {}) => t.filter(n, x(s, i)),
629
- defaults: (n) => t.defaults(x(s, n)),
630
- makeRe: (n, i = {}) => t.makeRe(n, x(s, i)),
631
- braceExpand: (n, i = {}) => t.braceExpand(n, x(s, i)),
632
- match: (n, i, r = {}) => t.match(n, i, x(s, r)),
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)),
633
633
  sep: t.sep,
634
634
  GLOBSTAR: O
635
635
  });
636
636
  };
637
- y.defaults = ne;
638
- const tt = (s, t = {}) => (v(s), t.nobrace || !/\{(?:(?!\{).)*\}/.test(s) ? [s] : yt(s));
639
- y.braceExpand = tt;
640
- const ie = (s, t = {}) => new D(s, t).makeRe();
641
- y.makeRe = ie;
642
- const re = (s, t, e = {}) => {
637
+ y.defaults = re;
638
+ const et = (s, t = {}) => (C(s), t.nobrace || !/\{(?:(?!\{).)*\}/.test(s) ? [s] : Et(s));
639
+ y.braceExpand = et;
640
+ const oe = (s, t = {}) => new D(s, t).makeRe();
641
+ y.makeRe = oe;
642
+ const ce = (s, t, e = {}) => {
643
643
  const n = new D(t, e);
644
644
  return s = s.filter((i) => n.match(i)), n.options.nonull && !s.length && s.push(t), s;
645
645
  };
646
- y.match = re;
647
- const G = /[?*]|[+@!]\(.*?\)|\[|\]/, oe = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
646
+ y.match = ce;
647
+ const G = /[?*]|[+@!]\(.*?\)|\[|\]/, ae = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
648
648
  class D {
649
649
  options;
650
650
  set;
@@ -664,7 +664,7 @@ class D {
664
664
  windowsNoMagicRoot;
665
665
  regexp;
666
666
  constructor(t, e = {}) {
667
- v(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Q, 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();
667
+ C(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || tt, 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();
668
668
  }
669
669
  hasMagic() {
670
670
  if (this.options.magicalBraces && this.set.length > 1)
@@ -872,10 +872,10 @@ class D {
872
872
  matchOne(t, e, n = !1) {
873
873
  const i = this.options;
874
874
  if (this.isWindows) {
875
- const g = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), S = !g && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), b = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), N = !b && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), E = S ? 3 : g ? 0 : void 0, m = N ? 3 : b ? 0 : void 0;
876
- if (typeof E == "number" && typeof m == "number") {
877
- const [P, R] = [t[E], e[m]];
878
- P.toLowerCase() === R.toLowerCase() && (e[m] = P, m > E ? e = e.slice(m) : E > m && (t = t.slice(E)));
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)));
879
879
  }
880
880
  }
881
881
  const { optimizationLevel: r = 1 } = this.options;
@@ -895,11 +895,11 @@ class D {
895
895
  return !0;
896
896
  }
897
897
  for (; f < h; ) {
898
- var d = t[f];
898
+ var g = t[f];
899
899
  if (this.debug(`
900
- globstar while`, t, f, e, u, d), this.matchOne(t.slice(f), e.slice(u), n))
901
- return this.debug("globstar found match!", f, h, d), !0;
902
- if (d === "." || d === ".." || !i.dot && d.charAt(0) === ".") {
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) === ".") {
903
903
  this.debug("dot detected!", t, f, e, u);
904
904
  break;
905
905
  }
@@ -908,8 +908,8 @@ globstar while`, t, f, e, u, d), this.matchOne(t.slice(f), e.slice(u), n))
908
908
  return !!(n && (this.debug(`
909
909
  >>> no match, partial?`, t, f, e, u), f === h));
910
910
  }
911
- let g;
912
- if (typeof c == "string" ? (g = p === c, this.debug("string match", c, p, g)) : (g = c.test(p), this.debug("pattern match", c, p, g)), !g)
911
+ let d;
912
+ 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
913
  return !1;
914
914
  }
915
915
  if (o === h && a === l)
@@ -921,17 +921,17 @@ globstar while`, t, f, e, u, d), this.matchOne(t.slice(f), e.slice(u), n))
921
921
  throw new Error("wtf?");
922
922
  }
923
923
  braceExpand() {
924
- return tt(this.pattern, this.options);
924
+ return et(this.pattern, this.options);
925
925
  }
926
926
  parse(t) {
927
- v(t);
927
+ C(t);
928
928
  const e = this.options;
929
929
  if (t === "**")
930
930
  return O;
931
931
  if (t === "")
932
932
  return "";
933
933
  let n, i = null;
934
- (n = t.match(Bt)) ? i = e.dot ? qt : Gt : (n = t.match(Dt)) ? i = (e.nocase ? e.dot ? Ut : Ft : e.dot ? Wt : Lt)(n[1]) : (n = t.match(Ht)) ? i = (e.nocase ? e.dot ? Jt : Zt : e.dot ? Vt : Xt)(n) : (n = t.match(jt)) ? i = e.dot ? zt : kt : (n = t.match(It)) && (i = _t);
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
935
  const r = w.fromGlob(t, this.options).toMMPattern();
936
936
  return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
937
937
  }
@@ -941,13 +941,13 @@ globstar while`, t, f, e, u, d), this.matchOne(t.slice(f), e.slice(u), n))
941
941
  const t = this.set;
942
942
  if (!t.length)
943
943
  return this.regexp = !1, this.regexp;
944
- const e = this.options, n = e.noglobstar ? Qt : e.dot ? te : ee, i = new Set(e.nocase ? ["i"] : []);
944
+ const e = this.options, n = e.noglobstar ? ee : e.dot ? se : ne, i = new Set(e.nocase ? ["i"] : []);
945
945
  let r = t.map((h) => {
946
946
  const l = h.map((c) => {
947
947
  if (c instanceof RegExp)
948
948
  for (const p of c.flags.split(""))
949
949
  i.add(p);
950
- return typeof c == "string" ? oe(c) : c === O ? O : c._src;
950
+ return typeof c == "string" ? ae(c) : c === O ? O : c._src;
951
951
  });
952
952
  return l.forEach((c, p) => {
953
953
  const f = l[p + 1], u = l[p - 1];
@@ -997,9 +997,9 @@ globstar while`, t, f, e, u, d), this.matchOne(t.slice(f), e.slice(u), n))
997
997
  }
998
998
  y.AST = w;
999
999
  y.Minimatch = D;
1000
- y.escape = vt;
1000
+ y.escape = Lt;
1001
1001
  y.unescape = M;
1002
- function ce(s, t = "utf-8") {
1002
+ function he(s, t = "utf-8") {
1003
1003
  switch (t) {
1004
1004
  case "utf8":
1005
1005
  case "utf-8":
@@ -1007,18 +1007,18 @@ function ce(s, t = "utf-8") {
1007
1007
  case "utf16le":
1008
1008
  case "ucs2":
1009
1009
  case "ucs-2":
1010
- return ae(s);
1010
+ return le(s);
1011
1011
  case "ascii":
1012
- return ue(s);
1012
+ return pe(s);
1013
1013
  case "latin1":
1014
- return le(s);
1014
+ return fe(s);
1015
1015
  case "binary":
1016
1016
  return Uint8Array.from(s, (e) => e.charCodeAt(0));
1017
1017
  case "base64":
1018
1018
  return Uint8Array.from(atob(s), (e) => e.charCodeAt(0));
1019
1019
  case "hex":
1020
1020
  if (!/^[\da-f]+$/i.test(s) || s.length % 2 !== 0)
1021
- throw new A("Invalid hex string", "INVALID_HEX_FORMAT");
1021
+ throw new x("Invalid hex string", "INVALID_HEX_FORMAT");
1022
1022
  return Uint8Array.from(s.match(/.{1,2}/g).map((e) => parseInt(e, 16)));
1023
1023
  default:
1024
1024
  return console.warn("Encoding not supported, falling back to UTF-8"), new TextEncoder().encode(s);
@@ -1032,7 +1032,7 @@ function Ae(s, t = "utf-8") {
1032
1032
  case "utf16le":
1033
1033
  case "ucs2":
1034
1034
  case "ucs-2":
1035
- return he(s);
1035
+ return ue(s);
1036
1036
  case "latin1":
1037
1037
  return String.fromCharCode(...s);
1038
1038
  case "binary":
@@ -1047,7 +1047,7 @@ function Ae(s, t = "utf-8") {
1047
1047
  return console.warn("Unsupported encoding, falling back to UTF-8"), new TextDecoder().decode(s);
1048
1048
  }
1049
1049
  }
1050
- function ae(s) {
1050
+ function le(s) {
1051
1051
  const t = new Uint8Array(s.length * 2);
1052
1052
  for (let e = 0; e < s.length; e++) {
1053
1053
  const n = s.charCodeAt(e);
@@ -1055,52 +1055,127 @@ function ae(s) {
1055
1055
  }
1056
1056
  return t;
1057
1057
  }
1058
- function he(s) {
1058
+ function ue(s) {
1059
1059
  s.length % 2 !== 0 && (console.warn("Invalid UTF-16LE buffer length, truncating last byte"), s = s.slice(0, s.length - 1));
1060
1060
  const t = new Uint16Array(s.buffer, s.byteOffset, s.byteLength / 2);
1061
1061
  return String.fromCharCode(...t);
1062
1062
  }
1063
- function le(s) {
1063
+ function fe(s) {
1064
1064
  const t = new Uint8Array(s.length);
1065
1065
  for (let e = 0; e < s.length; e++)
1066
1066
  t[e] = s.charCodeAt(e) & 255;
1067
1067
  return t;
1068
1068
  }
1069
- function ue(s) {
1069
+ function pe(s) {
1070
1070
  const t = new Uint8Array(s.length);
1071
1071
  for (let e = 0; e < s.length; e++)
1072
1072
  t[e] = s.charCodeAt(e) & 127;
1073
1073
  return t;
1074
1074
  }
1075
- function be() {
1075
+ const de = [
1076
+ // Images
1077
+ ".jpg",
1078
+ ".jpeg",
1079
+ ".png",
1080
+ ".gif",
1081
+ ".bmp",
1082
+ ".webp",
1083
+ ".svg",
1084
+ ".ico",
1085
+ ".tiff",
1086
+ ".tga",
1087
+ // Audio
1088
+ ".mp3",
1089
+ ".wav",
1090
+ ".ogg",
1091
+ ".flac",
1092
+ ".aac",
1093
+ ".wma",
1094
+ ".m4a",
1095
+ // Video
1096
+ ".mp4",
1097
+ ".avi",
1098
+ ".mov",
1099
+ ".wmv",
1100
+ ".flv",
1101
+ ".webm",
1102
+ ".mkv",
1103
+ ".m4v",
1104
+ // Documents
1105
+ ".pdf",
1106
+ ".doc",
1107
+ ".docx",
1108
+ ".xls",
1109
+ ".xlsx",
1110
+ ".ppt",
1111
+ ".pptx",
1112
+ // Archives
1113
+ ".zip",
1114
+ ".rar",
1115
+ ".7z",
1116
+ ".tar",
1117
+ ".gz",
1118
+ ".bz2",
1119
+ // Executables
1120
+ ".exe",
1121
+ ".dll",
1122
+ ".so",
1123
+ ".dylib",
1124
+ ".bin",
1125
+ // Other binary formats
1126
+ ".dat",
1127
+ ".db",
1128
+ ".sqlite",
1129
+ ".bin",
1130
+ ".obj",
1131
+ ".fbx",
1132
+ ".3ds"
1133
+ ];
1134
+ function Ne(s) {
1135
+ const t = s.toLowerCase().substring(s.lastIndexOf("."));
1136
+ return de.includes(t);
1137
+ }
1138
+ function $e() {
1076
1139
  if (!("storage" in navigator) || !("getDirectory" in navigator.storage))
1077
- throw new nt();
1140
+ throw new rt();
1141
+ }
1142
+ async function I(s, t, e) {
1143
+ return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(`opfs:${s.replace(/\/+/g, "/").toLowerCase()}`, { mode: t }, e) : e();
1078
1144
  }
1079
1145
  function U(s) {
1080
1146
  return Array.isArray(s) ? s : (s.startsWith("~/") ? s.slice(2) : s).split("/").filter(Boolean);
1081
1147
  }
1082
- function et(s) {
1148
+ function st(s) {
1083
1149
  return typeof s == "string" ? s ?? "/" : `/${s.join("/")}`;
1084
1150
  }
1085
- function fe(s) {
1151
+ function nt(s) {
1086
1152
  const t = U(s);
1087
1153
  return t[t.length - 1] || "";
1088
1154
  }
1089
- function Ne(s) {
1155
+ function Te(s) {
1090
1156
  const t = U(s);
1091
- return t.pop(), et(t);
1157
+ return t.pop(), st(t);
1092
1158
  }
1093
- function st(s) {
1159
+ function it(s) {
1094
1160
  return !s || s === "/" ? "/" : s.startsWith("~/") ? `/${s.slice(2)}` : s.startsWith("/") ? s : `/${s}`;
1095
1161
  }
1162
+ function Me(s, t = !1) {
1163
+ return s = s.replace(/\/$/, ""), t && !s.includes("*") ? `${s}/**` : s;
1164
+ }
1096
1165
  function Pe(s, t) {
1166
+ return y(s, t, {
1167
+ dot: !0,
1168
+ matchBase: !0
1169
+ });
1170
+ }
1171
+ function Re(s, t) {
1097
1172
  if (!t || Array.isArray(t) && t.length === 0)
1098
1173
  return !1;
1099
- const e = st(s);
1174
+ const e = it(s);
1100
1175
  return (Array.isArray(t) ? t : [t]).some((i) => y(e, i, { dot: !0 }));
1101
1176
  }
1102
- function $e(s) {
1103
- const t = st(s), e = U(t), n = [];
1177
+ function Ce(s) {
1178
+ const t = it(s), e = U(t), n = [];
1104
1179
  for (const i of e)
1105
1180
  if (!(i === "." || i === ""))
1106
1181
  if (i === "..") {
@@ -1109,77 +1184,106 @@ function $e(s) {
1109
1184
  n.pop();
1110
1185
  } else
1111
1186
  n.push(i);
1112
- return et(n);
1187
+ return st(n);
1113
1188
  }
1114
- function Te(s) {
1115
- const t = fe(s), e = t.lastIndexOf(".");
1189
+ function De(s) {
1190
+ const t = nt(s), e = t.lastIndexOf(".");
1116
1191
  return e <= 0 || e === t.length - 1 ? "" : t.slice(e);
1117
1192
  }
1118
- function pe(s, t = "utf-8") {
1119
- return typeof s == "string" ? ce(s, t) : s instanceof Uint8Array ? s : new Uint8Array(s);
1193
+ function ge(s, t = "utf-8") {
1194
+ return typeof s == "string" ? he(s, t) : s instanceof Uint8Array ? s : new Uint8Array(s);
1120
1195
  }
1121
- async function Me(s) {
1122
- const t = await s.createSyncAccessHandle();
1123
- try {
1124
- const e = t.getSize(), n = new Uint8Array(e);
1125
- return t.read(n, { at: 0 }), n;
1126
- } finally {
1127
- t.close();
1128
- }
1196
+ async function Le(s, t) {
1197
+ return I(t, "shared", async () => {
1198
+ const n = await (await s.getFile()).arrayBuffer();
1199
+ return new Uint8Array(n);
1200
+ });
1129
1201
  }
1130
- async function Re(s, t, e, n = {}) {
1131
- let i = null;
1132
- try {
1133
- i = await s.createSyncAccessHandle();
1134
- const r = pe(t, e), o = n.append ? i.getSize() : 0;
1135
- i.write(r, { at: o }), n.truncate && !n.append && i.truncate(r.byteLength), i.flush();
1136
- } catch (r) {
1137
- console.error(r);
1138
- const o = n.append ? "append" : "write";
1139
- throw new A(`Failed to ${o} file`, `${o.toUpperCase()}_FAILED`);
1140
- } finally {
1141
- if (i)
1202
+ async function Fe(s, t, e, n, i = {}) {
1203
+ const r = async () => {
1204
+ let o = null;
1205
+ const a = i.append || !1, h = !a && (i.truncate ?? !0);
1206
+ try {
1207
+ o = await s.createSyncAccessHandle();
1208
+ const l = ge(t, e), c = a ? o.getSize() : 0;
1209
+ o.write(l, { at: c }), h && o.truncate(l.byteLength), o.flush();
1210
+ } catch (l) {
1211
+ console.error(l);
1212
+ const c = a ? "append" : "write";
1213
+ throw new x(`Failed to ${c} file`, `${c.toUpperCase()}_FAILED`, void 0, l);
1214
+ } finally {
1142
1215
  try {
1143
- i.close();
1216
+ o?.close();
1144
1217
  } catch {
1145
1218
  }
1146
- }
1219
+ }
1220
+ };
1221
+ return n ? I(n, "exclusive", r) : r();
1147
1222
  }
1148
- async function Ce(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1223
+ async function je(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1149
1224
  if (s instanceof File && (s = await s.arrayBuffer()), s.byteLength > e)
1150
1225
  throw new Error(`File size ${s.byteLength} bytes exceeds maximum allowed size ${e} bytes`);
1151
1226
  const n = new Uint8Array(s), i = await crypto.subtle.digest(t, n);
1152
1227
  return Array.from(new Uint8Array(i)).map((o) => o.toString(16).padStart(2, "0")).join("");
1153
1228
  }
1154
- async function ve(s) {
1229
+ function Ie(s, t) {
1230
+ if (s.length !== t.length)
1231
+ return !1;
1232
+ for (let e = 0; e < s.length; e++)
1233
+ if (s[e] !== t[e])
1234
+ return !1;
1235
+ return !0;
1236
+ }
1237
+ async function Ue(s) {
1155
1238
  const t = await s.arrayBuffer();
1156
1239
  return new Uint8Array(t);
1157
1240
  }
1241
+ async function We(s, t, e = {}) {
1242
+ const n = nt(t);
1243
+ return I(t, "exclusive", async () => {
1244
+ const i = e.recursive ?? !1, r = e.force ?? !1;
1245
+ try {
1246
+ await s.removeEntry(n, { recursive: i });
1247
+ } catch (o) {
1248
+ 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);
1252
+ }
1253
+ });
1254
+ }
1158
1255
  export {
1159
- ye as D,
1160
- me as F,
1161
- A as O,
1162
- de as P,
1256
+ de as B,
1257
+ Ee as D,
1258
+ we as F,
1259
+ x as O,
1260
+ ye as P,
1163
1261
  Se as S,
1164
- Ee as T,
1165
- nt as a,
1166
- ge as b,
1167
- we as c,
1168
- be as d,
1169
- fe as e,
1170
- Ne as f,
1171
- Te as g,
1172
- pe as h,
1173
- Pe as i,
1174
- et as j,
1175
- Me as k,
1176
- Ce as l,
1177
- ve as m,
1178
- st as n,
1179
- ce as o,
1180
- Ae as p,
1181
- $e as r,
1262
+ 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,
1272
+ st as j,
1273
+ 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,
1182
1281
  U as s,
1183
- Re as w
1282
+ Ie as t,
1283
+ Ue as u,
1284
+ We as v,
1285
+ I as w,
1286
+ he as x,
1287
+ Ae as y
1184
1288
  };
1185
- //# sourceMappingURL=helpers-BgMlBRWa.js.map
1289
+ //# sourceMappingURL=helpers-DcIl7KL0.js.map