opfs-worker 0.5.0 → 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 S extends Error {
1
+ class x extends Error {
2
2
  constructor(t, e, n, i) {
3
3
  super(t, { cause: i }), this.code = e, this.path = n, this.name = "OPFSError";
4
4
  }
5
5
  }
6
- class rt extends S {
6
+ class rt extends x {
7
7
  constructor(t) {
8
8
  super("OPFS is not supported in this browser", "OPFS_NOT_SUPPORTED", void 0, t);
9
9
  }
10
10
  }
11
- class ge extends S {
11
+ class me extends x {
12
12
  constructor(t) {
13
13
  super("OPFS is not mounted", "OPFS_NOT_MOUNTED", void 0, t);
14
14
  }
15
15
  }
16
- class me extends S {
16
+ class ye extends x {
17
17
  constructor(t, e, n) {
18
18
  super(t, "INVALID_PATH", e, n);
19
19
  }
20
20
  }
21
- class ye extends S {
21
+ class we extends x {
22
22
  constructor(t, e) {
23
23
  super(`File not found: ${t}`, "FILE_NOT_FOUND", t, e);
24
24
  }
25
25
  }
26
- class we extends S {
26
+ class Ee extends x {
27
27
  constructor(t, e) {
28
28
  super(`Directory not found: ${t}`, "DIRECTORY_NOT_FOUND", t, e);
29
29
  }
30
30
  }
31
- class Ee extends S {
31
+ class xe extends x {
32
32
  constructor(t, e, n) {
33
33
  super(`Permission denied for ${e} on: ${t}`, "PERMISSION_DENIED", t, n);
34
34
  }
35
35
  }
36
- class Se extends S {
36
+ class Se extends x {
37
37
  constructor(t, e, n) {
38
38
  super(t, "STORAGE_ERROR", e, n);
39
39
  }
40
40
  }
41
- class xe extends S {
41
+ class be extends x {
42
42
  constructor(t, e, n) {
43
43
  super(`Operation timed out: ${t}`, "TIMEOUT_ERROR", e, n);
44
44
  }
45
45
  }
46
46
  const H = (s, t, e) => {
47
- const n = s instanceof RegExp ? k(s, e) : s, i = t instanceof RegExp ? k(t, e) : t, r = n !== null && i != null && ot(n, i, 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,7 +52,7 @@ const H = (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
- }, k = (s, t) => {
55
+ }, W = (s, t) => {
56
56
  const e = t.match(s);
57
57
  return e ? e[0] : null;
58
58
  }, ot = (s, t, e) => {
@@ -97,16 +97,16 @@ function Y(s) {
97
97
  function Et(s) {
98
98
  return s ? (s.slice(0, 2) === "{}" && (s = "\\{\\}" + s.slice(2)), T(yt(s), !0).map(wt)) : [];
99
99
  }
100
- function St(s) {
100
+ function xt(s) {
101
101
  return "{" + s + "}";
102
102
  }
103
- function xt(s) {
103
+ function St(s) {
104
104
  return /^-?0\d/.test(s);
105
105
  }
106
- function Ot(s, t) {
106
+ function bt(s, t) {
107
107
  return s <= t;
108
108
  }
109
- function At(s, t) {
109
+ function Ot(s, t) {
110
110
  return s >= t;
111
111
  }
112
112
  function T(s, t) {
@@ -126,24 +126,24 @@ function T(s, t) {
126
126
  let c;
127
127
  if (h)
128
128
  c = n.body.split(/\.\./);
129
- else if (c = Y(n.body), c.length === 1 && c[0] !== void 0 && (c = T(c[0], !1).map(St), 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
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 = Ot;
135
- u < f && (d *= -1, E = At);
136
- const N = c.some(xt);
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 x = f; E(x, u); x += d) {
138
+ for (let S = f; E(S, u); S += d) {
139
139
  let m;
140
140
  if (a)
141
- m = String.fromCharCode(x), m === "\\" && (m = "");
142
- else if (m = String(x), N) {
143
- const v = g - m.length;
144
- if (v > 0) {
145
- const P = new Array(v + 1).join("0");
146
- x < 0 ? m = "-" + P + m.slice(1) : m = P + 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);
@@ -161,12 +161,12 @@ function T(s, t) {
161
161
  }
162
162
  return e;
163
163
  }
164
- const bt = 1024 * 64, C = (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 > bt)
167
+ if (s.length > vt)
168
168
  throw new TypeError("pattern is too long");
169
- }, Nt = {
169
+ }, At = {
170
170
  "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
171
171
  "[:alpha:]": ["\\p{L}\\p{Nl}", !0],
172
172
  "[:ascii:]": ["\\x00-\\x7f", !1],
@@ -181,7 +181,7 @@ const bt = 1024 * 64, C = (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, "\\$&"), vt = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), I = (s) => s.join(""), $t = (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");
@@ -202,11 +202,11 @@ const bt = 1024 * 64, C = (s) => {
202
202
  continue;
203
203
  }
204
204
  if (d === "[" && !h) {
205
- for (const [E, [b, N, x]] of Object.entries(Nt))
205
+ for (const [E, [v, A, S]] of Object.entries(At))
206
206
  if (s.startsWith(E, r)) {
207
207
  if (p)
208
208
  return ["$.", !1, s.length - e, !0];
209
- r += E.length, x ? 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
  }
@@ -230,11 +230,11 @@ const bt = 1024 * 64, C = (s) => {
230
230
  return ["$.", !1, s.length - e, !0];
231
231
  if (i.length === 0 && n.length === 1 && /^\\?.$/.test(n[0]) && !l) {
232
232
  const d = n[0].length === 2 ? n[0].slice(-1) : n[0];
233
- return [vt(d), !1, c - e, !1];
233
+ return [Nt(d), !1, c - e, !1];
234
234
  }
235
- const f = "[" + (l ? "^" : "") + I(n) + "]", u = "[" + (l ? "" : "^") + I(i) + "]";
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"), 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, "\\$&"), U = "[^/]", _ = U + "*?", B = U + "+?";
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;
@@ -487,8 +487,8 @@ 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 [g, d, E, b] = typeof u == "string" ? w.#d(u, this.#n, h) : u.toRegExpSource(t);
491
- return this.#n = this.#n || E, this.#r = this.#r || b, g;
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
494
  if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && Rt.has(this.#t[0]))) {
@@ -565,7 +565,7 @@ class w {
565
565
  continue;
566
566
  }
567
567
  if (h === "?") {
568
- r += U, e = !0;
568
+ r += j, e = !0;
569
569
  continue;
570
570
  }
571
571
  r += Dt(h);
@@ -573,7 +573,7 @@ class w {
573
573
  return [r, M(t), !!e, o];
574
574
  }
575
575
  }
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 = /^\*+([^+@!?\*\[\(]*)$/, Ut = (s) => (t) => !t.startsWith(".") && t.endsWith(s), Wt = (s) => (t) => t.endsWith(s), jt = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), kt = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), It = /^\*+\.\*+$/, 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 = ""]) => {
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 = ""]) => {
577
577
  const e = K([s]);
578
578
  return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
579
579
  }, Xt = ([s, t = ""]) => {
@@ -596,42 +596,42 @@ const Lt = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\]
596
596
  posix: { sep: "/" }
597
597
  }, Qt = tt === "win32" ? q.win32.sep : q.posix.sep;
598
598
  y.sep = Qt;
599
- const A = Symbol("globstar **");
600
- y.GLOBSTAR = A;
599
+ const O = Symbol("globstar **");
600
+ y.GLOBSTAR = O;
601
601
  const te = "[^/]", ee = te + "*?", se = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", ne = "(?:(?!(?:\\/|^)\\.).)*?", ie = (s, t = {}) => (e) => y(e, s, t);
602
602
  y.filter = ie;
603
- const O = (s, t = {}) => Object.assign({}, s, t), re = (s) => {
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, O(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, O(s, r));
610
+ super(i, b(s, r));
611
611
  }
612
612
  static defaults(i) {
613
- return t.defaults(O(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, O(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, O(s, r));
623
+ return t.AST.fromGlob(i, b(s, r));
624
624
  }
625
625
  },
626
- unescape: (n, i = {}) => t.unescape(n, O(s, i)),
627
- escape: (n, i = {}) => t.escape(n, O(s, i)),
628
- filter: (n, i = {}) => t.filter(n, O(s, i)),
629
- defaults: (n) => t.defaults(O(s, n)),
630
- makeRe: (n, i = {}) => t.makeRe(n, O(s, i)),
631
- braceExpand: (n, i = {}) => t.braceExpand(n, O(s, i)),
632
- match: (n, i, r = {}) => t.match(n, i, O(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
- GLOBSTAR: A
634
+ GLOBSTAR: O
635
635
  });
636
636
  };
637
637
  y.defaults = re;
@@ -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 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]), 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]), x = E ? 3 : d ? 0 : void 0, m = N ? 3 : b ? 0 : void 0;
876
- if (typeof x == "number" && typeof m == "number") {
877
- const [v, P] = [t[x], e[m]];
878
- v.toLowerCase() === P.toLowerCase() && (e[m] = v, m > x ? e = e.slice(m) : x > m && (t = t.slice(x)));
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;
@@ -885,7 +885,7 @@ class D {
885
885
  var c = e[a], p = t[o];
886
886
  if (this.debug(e, c, p), c === !1)
887
887
  return !1;
888
- if (c === A) {
888
+ if (c === O) {
889
889
  this.debug("GLOBSTAR", [e, c, p]);
890
890
  var f = o, u = a + 1;
891
891
  if (u === l) {
@@ -927,11 +927,11 @@ globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
927
927
  C(t);
928
928
  const e = this.options;
929
929
  if (t === "**")
930
- return A;
930
+ return O;
931
931
  if (t === "")
932
932
  return "";
933
933
  let n, i = null;
934
- (n = t.match(Gt)) ? i = e.dot ? Zt : Ht : (n = t.match(Ft)) ? i = (e.nocase ? e.dot ? kt : jt : e.dot ? Wt : Ut)(n[1]) : (n = t.match(Jt)) ? i = (e.nocase ? e.dot ? Xt : Vt : e.dot ? Yt : Kt)(n) : (n = t.match(It)) ? i = e.dot ? _t : zt : (n = t.match(Bt)) && (i = qt);
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
  }
@@ -947,12 +947,12 @@ globstar while`, t, f, e, u, g), this.matchOne(t.slice(f), e.slice(u), n))
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" ? ae(c) : c === A ? A : 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];
954
- c !== A || u === A || (u === void 0 ? f !== void 0 && f !== A ? l[p + 1] = "(?:\\/|" + n + "\\/)?" + f : l[p] = n : f === void 0 ? l[p - 1] = u + "(?:\\/|" + n + ")?" : f !== A && (l[p - 1] = u + "(?:\\/|\\/" + n + "\\/)" + f, l[p + 1] = A));
955
- }), l.filter((c) => c !== A).join("/");
954
+ c !== O || u === O || (u === void 0 ? f !== void 0 && f !== O ? l[p + 1] = "(?:\\/|" + n + "\\/)?" + f : l[p] = n : f === void 0 ? l[p - 1] = u + "(?:\\/|" + n + ")?" : f !== O && (l[p - 1] = u + "(?:\\/|\\/" + n + "\\/)" + f, l[p + 1] = O));
955
+ }), l.filter((c) => c !== O).join("/");
956
956
  }).join("|");
957
957
  const [o, a] = t.length > 1 ? ["(?:", ")"] : ["", ""];
958
958
  r = "^" + o + r + a + "$", this.negate && (r = "^(?!" + r + ").+$");
@@ -1018,13 +1018,13 @@ function he(s, t = "utf-8") {
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 S("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);
1025
1025
  }
1026
1026
  }
1027
- function be(s, t = "utf-8") {
1027
+ function Ae(s, t = "utf-8") {
1028
1028
  switch (t) {
1029
1029
  case "utf8":
1030
1030
  case "utf-8":
@@ -1072,47 +1072,110 @@ function pe(s) {
1072
1072
  t[e] = s.charCodeAt(e) & 127;
1073
1073
  return t;
1074
1074
  }
1075
- function Ne() {
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
1140
  throw new rt();
1078
1141
  }
1079
- async function W(s, t, e) {
1142
+ async function I(s, t, e) {
1080
1143
  return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(`opfs:${s.replace(/\/+/g, "/").toLowerCase()}`, { mode: t }, e) : e();
1081
1144
  }
1082
- function j(s) {
1145
+ function U(s) {
1083
1146
  return Array.isArray(s) ? s : (s.startsWith("~/") ? s.slice(2) : s).split("/").filter(Boolean);
1084
1147
  }
1085
1148
  function st(s) {
1086
1149
  return typeof s == "string" ? s ?? "/" : `/${s.join("/")}`;
1087
1150
  }
1088
1151
  function nt(s) {
1089
- const t = j(s);
1152
+ const t = U(s);
1090
1153
  return t[t.length - 1] || "";
1091
1154
  }
1092
- function ve(s) {
1093
- const t = j(s);
1155
+ function Te(s) {
1156
+ const t = U(s);
1094
1157
  return t.pop(), st(t);
1095
1158
  }
1096
1159
  function it(s) {
1097
1160
  return !s || s === "/" ? "/" : s.startsWith("~/") ? `/${s.slice(2)}` : s.startsWith("/") ? s : `/${s}`;
1098
1161
  }
1099
- function $e(s, t = !1) {
1162
+ function Me(s, t = !1) {
1100
1163
  return s = s.replace(/\/$/, ""), t && !s.includes("*") ? `${s}/**` : s;
1101
1164
  }
1102
- function Te(s, t) {
1165
+ function Pe(s, t) {
1103
1166
  return y(s, t, {
1104
1167
  dot: !0,
1105
1168
  matchBase: !0
1106
1169
  });
1107
1170
  }
1108
- function Me(s, t) {
1171
+ function Re(s, t) {
1109
1172
  if (!t || Array.isArray(t) && t.length === 0)
1110
1173
  return !1;
1111
1174
  const e = it(s);
1112
1175
  return (Array.isArray(t) ? t : [t]).some((i) => y(e, i, { dot: !0 }));
1113
1176
  }
1114
- function Pe(s) {
1115
- const t = it(s), e = j(t), n = [];
1177
+ function Ce(s) {
1178
+ const t = it(s), e = U(t), n = [];
1116
1179
  for (const i of e)
1117
1180
  if (!(i === "." || i === ""))
1118
1181
  if (i === "..") {
@@ -1123,31 +1186,31 @@ function Pe(s) {
1123
1186
  n.push(i);
1124
1187
  return st(n);
1125
1188
  }
1126
- function Re(s) {
1189
+ function De(s) {
1127
1190
  const t = nt(s), e = t.lastIndexOf(".");
1128
1191
  return e <= 0 || e === t.length - 1 ? "" : t.slice(e);
1129
1192
  }
1130
- function de(s, t = "utf-8") {
1193
+ function ge(s, t = "utf-8") {
1131
1194
  return typeof s == "string" ? he(s, t) : s instanceof Uint8Array ? s : new Uint8Array(s);
1132
1195
  }
1133
- async function Ce(s, t) {
1134
- return W(t, "shared", async () => {
1196
+ async function Le(s, t) {
1197
+ return I(t, "shared", async () => {
1135
1198
  const n = await (await s.getFile()).arrayBuffer();
1136
1199
  return new Uint8Array(n);
1137
1200
  });
1138
1201
  }
1139
- async function De(s, t, e, n = {}, i) {
1202
+ async function Fe(s, t, e, n, i = {}) {
1140
1203
  const r = async () => {
1141
1204
  let o = null;
1142
- const a = n.append || !1, h = !a && (n.truncate ?? !0);
1205
+ const a = i.append || !1, h = !a && (i.truncate ?? !0);
1143
1206
  try {
1144
1207
  o = await s.createSyncAccessHandle();
1145
- const l = de(t, e), c = a ? o.getSize() : 0;
1208
+ const l = ge(t, e), c = a ? o.getSize() : 0;
1146
1209
  o.write(l, { at: c }), h && o.truncate(l.byteLength), o.flush();
1147
1210
  } catch (l) {
1148
1211
  console.error(l);
1149
1212
  const c = a ? "append" : "write";
1150
- throw new S(`Failed to ${c} file`, `${c.toUpperCase()}_FAILED`, void 0, l);
1213
+ throw new x(`Failed to ${c} file`, `${c.toUpperCase()}_FAILED`, void 0, l);
1151
1214
  } finally {
1152
1215
  try {
1153
1216
  o?.close();
@@ -1155,15 +1218,15 @@ async function De(s, t, e, n = {}, i) {
1155
1218
  }
1156
1219
  }
1157
1220
  };
1158
- return i ? W(i, "exclusive", r) : r();
1221
+ return n ? I(n, "exclusive", r) : r();
1159
1222
  }
1160
- async function Le(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1223
+ async function je(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1161
1224
  if (s instanceof File && (s = await s.arrayBuffer()), s.byteLength > e)
1162
1225
  throw new Error(`File size ${s.byteLength} bytes exceeds maximum allowed size ${e} bytes`);
1163
1226
  const n = new Uint8Array(s), i = await crypto.subtle.digest(t, n);
1164
1227
  return Array.from(new Uint8Array(i)).map((o) => o.toString(16).padStart(2, "0")).join("");
1165
1228
  }
1166
- function Fe(s, t) {
1229
+ function Ie(s, t) {
1167
1230
  if (s.length !== t.length)
1168
1231
  return !1;
1169
1232
  for (let e = 0; e < s.length; e++)
@@ -1177,48 +1240,50 @@ async function Ue(s) {
1177
1240
  }
1178
1241
  async function We(s, t, e = {}) {
1179
1242
  const n = nt(t);
1180
- return W(t, "exclusive", async () => {
1243
+ return I(t, "exclusive", async () => {
1181
1244
  const i = e.recursive ?? !1, r = e.force ?? !1;
1182
1245
  try {
1183
1246
  await s.removeEntry(n, { recursive: i });
1184
1247
  } catch (o) {
1185
1248
  if (o.name === "NotFoundError") {
1186
1249
  if (!r)
1187
- throw new S(`No such file or directory: ${t}`, "ENOENT", void 0, o);
1188
- } else throw o.name === "InvalidModificationError" ? new S(`Directory not empty: ${t}. Use recursive option to force removal.`, "ENOTEMPTY", void 0, o) : o.name === "TypeMismatchError" && !i ? new S(`Cannot remove directory without recursive option: ${t}`, "EISDIR", void 0, o) : new S(`Failed to remove entry: ${t}`, "RM_FAILED", void 0, o);
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);
1189
1252
  }
1190
1253
  });
1191
1254
  }
1192
1255
  export {
1193
- we as D,
1194
- ye as F,
1195
- S as O,
1196
- me as P,
1256
+ de as B,
1257
+ Ee as D,
1258
+ we as F,
1259
+ x as O,
1260
+ ye as P,
1197
1261
  Se as S,
1198
- xe as T,
1262
+ be as T,
1199
1263
  rt as a,
1200
- ge as b,
1201
- Ee as c,
1202
- Ne as d,
1264
+ me as b,
1265
+ xe as c,
1266
+ $e as d,
1203
1267
  nt as e,
1204
- ve as f,
1205
- $e as g,
1268
+ Te as f,
1269
+ Me as g,
1206
1270
  Re as h,
1207
- Me as i,
1271
+ Ne as i,
1208
1272
  st as j,
1209
- de as k,
1210
- Ce as l,
1211
- Te as m,
1273
+ De as k,
1274
+ ge as l,
1275
+ Pe as m,
1212
1276
  it as n,
1213
- De as o,
1214
- Le as p,
1215
- Fe as q,
1216
- Pe as r,
1217
- j as s,
1218
- Ue as t,
1219
- We as u,
1220
- he as v,
1221
- W as w,
1222
- be as x
1277
+ Le as o,
1278
+ Fe as p,
1279
+ je as q,
1280
+ Ce as r,
1281
+ U as s,
1282
+ Ie as t,
1283
+ Ue as u,
1284
+ We as v,
1285
+ I as w,
1286
+ he as x,
1287
+ Ae as y
1223
1288
  };
1224
- //# sourceMappingURL=helpers-Bm2TWyPQ.js.map
1289
+ //# sourceMappingURL=helpers-DcIl7KL0.js.map