opfs-worker 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,22 +1,22 @@
1
1
  import { wrap as u } from "comlink";
2
- import { i as c, d as l, e as h } from "./helpers-CkNHswLp.js";
3
- import { E as x, D as S, F as P, O as F, b as O, a as A, P as T, c as I, S as R, T as $, h as C, v as _, u as N, B as D, g as z, x as k, t as M, f as L, C as j, k as W, q as U, p as H, j as B, m as G, o as q, l as V, n as Y, y as X, r as Z, A as J, s as K, z as Q, w as nn } from "./helpers-CkNHswLp.js";
2
+ import { i as c, d as l, e as h } from "./helpers-BXhw_-Ar.js";
3
+ import { E as x, D as S, F as P, O as F, b as O, a as A, P as T, c as I, S as R, T as $, W as C, h as _, v as N, u as D, B as z, g as k, x as M, t as j, f as L, C as W, k as U, q as H, p as B, j as G, m as q, o as V, l as Y, n as X, y as Z, r as J, A as K, s as Q, z as nn, w as tn } from "./helpers-BXhw_-Ar.js";
4
4
  const f = `/**
5
5
  * @license
6
6
  * Copyright 2019 Google LLC
7
7
  * SPDX-License-Identifier: Apache-2.0
8
8
  */
9
- const pt = Symbol("Comlink.proxy"), Ct = Symbol("Comlink.endpoint"), Tt = Symbol("Comlink.releaseProxy"), q = Symbol("Comlink.finalizer"), z = Symbol("Comlink.thrown"), gt = (s) => typeof s == "object" && s !== null || typeof s == "function", Mt = {
10
- canHandle: (s) => gt(s) && s[pt],
9
+ const gt = Symbol("Comlink.proxy"), Mt = Symbol("Comlink.endpoint"), It = Symbol("Comlink.releaseProxy"), V = Symbol("Comlink.finalizer"), H = Symbol("Comlink.thrown"), wt = (s) => typeof s == "object" && s !== null || typeof s == "function", Pt = {
10
+ canHandle: (s) => wt(s) && s[gt],
11
11
  serialize(s) {
12
12
  const { port1: t, port2: e } = new MessageChannel();
13
- return K(s, t), [e, [e]];
13
+ return Q(s, t), [e, [e]];
14
14
  },
15
15
  deserialize(s) {
16
- return s.start(), Rt(s);
16
+ return s.start(), Lt(s);
17
17
  }
18
- }, Pt = {
19
- canHandle: (s) => gt(s) && z in s,
18
+ }, Tt = {
19
+ canHandle: (s) => wt(s) && H in s,
20
20
  serialize({ value: s }) {
21
21
  let t;
22
22
  return s instanceof Error ? t = {
@@ -31,25 +31,25 @@ const pt = Symbol("Comlink.proxy"), Ct = Symbol("Comlink.endpoint"), Tt = Symbol
31
31
  deserialize(s) {
32
32
  throw s.isError ? Object.assign(new Error(s.value.message), s.value) : s.value;
33
33
  }
34
- }, wt = /* @__PURE__ */ new Map([
35
- ["proxy", Mt],
36
- ["throw", Pt]
34
+ }, mt = /* @__PURE__ */ new Map([
35
+ ["proxy", Pt],
36
+ ["throw", Tt]
37
37
  ]);
38
- function It(s, t) {
38
+ function Rt(s, t) {
39
39
  for (const e of s)
40
40
  if (t === e || e === "*" || e instanceof RegExp && e.test(t))
41
41
  return !0;
42
42
  return !1;
43
43
  }
44
- function K(s, t = globalThis, e = ["*"]) {
44
+ function Q(s, t = globalThis, e = ["*"]) {
45
45
  t.addEventListener("message", function n(i) {
46
46
  if (!i || !i.data)
47
47
  return;
48
- if (!It(e, i.origin)) {
48
+ if (!Rt(e, i.origin)) {
49
49
  console.warn(\`Invalid origin '\${i.origin}' for comlink proxy\`);
50
50
  return;
51
51
  }
52
- const { id: r, type: o, path: a } = Object.assign({ path: [] }, i.data), l = (i.data.argumentList || []).map(F);
52
+ const { id: r, type: o, path: a } = Object.assign({ path: [] }, i.data), l = (i.data.argumentList || []).map(N);
53
53
  let h;
54
54
  try {
55
55
  const c = a.slice(0, -1).reduce((u, d) => u[d], s), f = a.reduce((u, d) => u[d], s);
@@ -58,7 +58,7 @@ function K(s, t = globalThis, e = ["*"]) {
58
58
  h = f;
59
59
  break;
60
60
  case "SET":
61
- c[a.slice(-1)[0]] = F(i.data.value), h = !0;
61
+ c[a.slice(-1)[0]] = N(i.data.value), h = !0;
62
62
  break;
63
63
  case "APPLY":
64
64
  h = f.apply(c, l);
@@ -66,13 +66,13 @@ function K(s, t = globalThis, e = ["*"]) {
66
66
  case "CONSTRUCT":
67
67
  {
68
68
  const u = new f(...l);
69
- h = Wt(u);
69
+ h = _t(u);
70
70
  }
71
71
  break;
72
72
  case "ENDPOINT":
73
73
  {
74
74
  const { port1: u, port2: d } = new MessageChannel();
75
- K(s, d), h = H(u, [u]);
75
+ Q(s, d), h = W(u, [u]);
76
76
  }
77
77
  break;
78
78
  case "RELEASE":
@@ -82,15 +82,15 @@ function K(s, t = globalThis, e = ["*"]) {
82
82
  return;
83
83
  }
84
84
  } catch (c) {
85
- h = { value: c, [z]: 0 };
85
+ h = { value: c, [H]: 0 };
86
86
  }
87
- Promise.resolve(h).catch((c) => ({ value: c, [z]: 0 })).then((c) => {
87
+ Promise.resolve(h).catch((c) => ({ value: c, [H]: 0 })).then((c) => {
88
88
  const [f, u] = B(c);
89
- t.postMessage(Object.assign(Object.assign({}, f), { id: r }), u), o === "RELEASE" && (t.removeEventListener("message", n), yt(t), q in s && typeof s[q] == "function" && s[q]());
89
+ t.postMessage(Object.assign(Object.assign({}, f), { id: r }), u), o === "RELEASE" && (t.removeEventListener("message", n), yt(t), V in s && typeof s[V] == "function" && s[V]());
90
90
  }).catch((c) => {
91
91
  const [f, u] = B({
92
92
  value: new TypeError("Unserializable return value"),
93
- [z]: 0
93
+ [H]: 0
94
94
  });
95
95
  t.postMessage(Object.assign(Object.assign({}, f), { id: r }), u);
96
96
  });
@@ -102,7 +102,7 @@ function kt(s) {
102
102
  function yt(s) {
103
103
  kt(s) && s.close();
104
104
  }
105
- function Rt(s, t) {
105
+ function Lt(s, t) {
106
106
  const e = /* @__PURE__ */ new Map();
107
107
  return s.addEventListener("message", function(i) {
108
108
  const { data: r } = i;
@@ -115,103 +115,103 @@ function Rt(s, t) {
115
115
  } finally {
116
116
  e.delete(r.id);
117
117
  }
118
- }), Z(s, e, [], t);
118
+ }), J(s, e, [], t);
119
119
  }
120
120
  function k(s) {
121
121
  if (s)
122
122
  throw new Error("Proxy has been released and is not useable");
123
123
  }
124
- function mt(s) {
125
- return N(s, /* @__PURE__ */ new Map(), {
124
+ function Et(s) {
125
+ return D(s, /* @__PURE__ */ new Map(), {
126
126
  type: "RELEASE"
127
127
  }).then(() => {
128
128
  yt(s);
129
129
  });
130
130
  }
131
- const _ = /* @__PURE__ */ new WeakMap(), j = "FinalizationRegistry" in globalThis && new FinalizationRegistry((s) => {
132
- const t = (_.get(s) || 0) - 1;
133
- _.set(s, t), t === 0 && mt(s);
131
+ const j = /* @__PURE__ */ new WeakMap(), U = "FinalizationRegistry" in globalThis && new FinalizationRegistry((s) => {
132
+ const t = (j.get(s) || 0) - 1;
133
+ j.set(s, t), t === 0 && Et(s);
134
134
  });
135
- function Lt(s, t) {
136
- const e = (_.get(t) || 0) + 1;
137
- _.set(t, e), j && j.register(s, t, s);
135
+ function zt(s, t) {
136
+ const e = (j.get(t) || 0) + 1;
137
+ j.set(t, e), U && U.register(s, t, s);
138
138
  }
139
- function zt(s) {
140
- j && j.unregister(s);
139
+ function Ht(s) {
140
+ U && U.unregister(s);
141
141
  }
142
- function Z(s, t, e = [], n = function() {
142
+ function J(s, t, e = [], n = function() {
143
143
  }) {
144
144
  let i = !1;
145
145
  const r = new Proxy(n, {
146
146
  get(o, a) {
147
- if (k(i), a === Tt)
147
+ if (k(i), a === It)
148
148
  return () => {
149
- zt(r), mt(s), t.clear(), i = !0;
149
+ Ht(r), Et(s), t.clear(), i = !0;
150
150
  };
151
151
  if (a === "then") {
152
152
  if (e.length === 0)
153
153
  return { then: () => r };
154
- const l = N(s, t, {
154
+ const l = D(s, t, {
155
155
  type: "GET",
156
156
  path: e.map((h) => h.toString())
157
- }).then(F);
157
+ }).then(N);
158
158
  return l.then.bind(l);
159
159
  }
160
- return Z(s, t, [...e, a]);
160
+ return J(s, t, [...e, a]);
161
161
  },
162
162
  set(o, a, l) {
163
163
  k(i);
164
164
  const [h, c] = B(l);
165
- return N(s, t, {
165
+ return D(s, t, {
166
166
  type: "SET",
167
167
  path: [...e, a].map((f) => f.toString()),
168
168
  value: h
169
- }, c).then(F);
169
+ }, c).then(N);
170
170
  },
171
171
  apply(o, a, l) {
172
172
  k(i);
173
173
  const h = e[e.length - 1];
174
- if (h === Ct)
175
- return N(s, t, {
174
+ if (h === Mt)
175
+ return D(s, t, {
176
176
  type: "ENDPOINT"
177
- }).then(F);
177
+ }).then(N);
178
178
  if (h === "bind")
179
- return Z(s, t, e.slice(0, -1));
180
- const [c, f] = st(l);
181
- return N(s, t, {
179
+ return J(s, t, e.slice(0, -1));
180
+ const [c, f] = nt(l);
181
+ return D(s, t, {
182
182
  type: "APPLY",
183
183
  path: e.map((u) => u.toString()),
184
184
  argumentList: c
185
- }, f).then(F);
185
+ }, f).then(N);
186
186
  },
187
187
  construct(o, a) {
188
188
  k(i);
189
- const [l, h] = st(a);
190
- return N(s, t, {
189
+ const [l, h] = nt(a);
190
+ return D(s, t, {
191
191
  type: "CONSTRUCT",
192
192
  path: e.map((c) => c.toString()),
193
193
  argumentList: l
194
- }, h).then(F);
194
+ }, h).then(N);
195
195
  }
196
196
  });
197
- return Lt(r, s), r;
197
+ return zt(r, s), r;
198
198
  }
199
- function Ht(s) {
199
+ function Wt(s) {
200
200
  return Array.prototype.concat.apply([], s);
201
201
  }
202
- function st(s) {
202
+ function nt(s) {
203
203
  const t = s.map(B);
204
- return [t.map((e) => e[0]), Ht(t.map((e) => e[1]))];
204
+ return [t.map((e) => e[0]), Wt(t.map((e) => e[1]))];
205
205
  }
206
- const Et = /* @__PURE__ */ new WeakMap();
207
- function H(s, t) {
208
- return Et.set(s, t), s;
206
+ const St = /* @__PURE__ */ new WeakMap();
207
+ function W(s, t) {
208
+ return St.set(s, t), s;
209
209
  }
210
- function Wt(s) {
211
- return Object.assign(s, { [pt]: !0 });
210
+ function _t(s) {
211
+ return Object.assign(s, { [gt]: !0 });
212
212
  }
213
213
  function B(s) {
214
- for (const [t, e] of wt)
214
+ for (const [t, e] of mt)
215
215
  if (e.canHandle(s)) {
216
216
  const [n, i] = e.serialize(s);
217
217
  return [
@@ -228,32 +228,33 @@ function B(s) {
228
228
  type: "RAW",
229
229
  value: s
230
230
  },
231
- Et.get(s) || []
231
+ St.get(s) || []
232
232
  ];
233
233
  }
234
- function F(s) {
234
+ function N(s) {
235
235
  switch (s.type) {
236
236
  case "HANDLER":
237
- return wt.get(s.name).deserialize(s.value);
237
+ return mt.get(s.name).deserialize(s.value);
238
238
  case "RAW":
239
239
  return s.value;
240
240
  }
241
241
  }
242
- function N(s, t, e, n) {
242
+ function D(s, t, e, n) {
243
243
  return new Promise((i) => {
244
- const r = _t();
244
+ const r = jt();
245
245
  t.set(r, i), s.start && s.start(), s.postMessage(Object.assign({ id: r }, e), n);
246
246
  });
247
247
  }
248
- function _t() {
248
+ function jt() {
249
249
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
250
250
  }
251
+ var A = /* @__PURE__ */ ((s) => (s.Added = "added", s.Changed = "changed", s.Removed = "removed", s))(A || {});
251
252
  class p extends Error {
252
253
  constructor(t, e, n, i) {
253
254
  super(t, { cause: i }), this.code = e, this.path = n, this.name = "OPFSError";
254
255
  }
255
256
  }
256
- class jt extends p {
257
+ class Ut extends p {
257
258
  constructor(t) {
258
259
  super("OPFS is not supported in this browser", "OPFS_NOT_SUPPORTED", void 0, t);
259
260
  }
@@ -263,16 +264,16 @@ class Bt extends p {
263
264
  super(t, "INVALID_PATH", e, n);
264
265
  }
265
266
  }
266
- class nt extends p {
267
+ class it extends p {
267
268
  constructor(t, e) {
268
269
  super(\`File not found: \${t}\`, "FILE_NOT_FOUND", t, e);
269
270
  }
270
271
  }
271
- function R(s, t, e, n) {
272
+ function L(s, t, e, n) {
272
273
  const i = \`\${s.toUpperCase()}_FAILED\`;
273
274
  return new p(\`Failed to \${s} file descriptor: \${t}\`, i, e, n);
274
275
  }
275
- function Ut(s, t) {
276
+ function Gt(s, t) {
276
277
  const e = t?.path;
277
278
  switch (s.name) {
278
279
  case "InvalidStateError":
@@ -298,8 +299,8 @@ function Ut(s, t) {
298
299
  return new p(\`I/O error: \${e || "unknown"}\`, "EIO", e, s);
299
300
  }
300
301
  }
301
- const St = (s, t, e) => {
302
- const n = s instanceof RegExp ? it(s, e) : s, i = t instanceof RegExp ? it(t, e) : t, r = n !== null && i != null && Gt(n, i, e);
302
+ const xt = (s, t, e) => {
303
+ const n = s instanceof RegExp ? rt(s, e) : s, i = t instanceof RegExp ? rt(t, e) : t, r = n !== null && i != null && qt(n, i, e);
303
304
  return r && {
304
305
  start: r[0],
305
306
  end: r[1],
@@ -307,10 +308,10 @@ const St = (s, t, e) => {
307
308
  body: e.slice(r[0] + n.length, r[1]),
308
309
  post: e.slice(r[1] + i.length)
309
310
  };
310
- }, it = (s, t) => {
311
+ }, rt = (s, t) => {
311
312
  const e = t.match(s);
312
313
  return e ? e[0] : null;
313
- }, Gt = (s, t, e) => {
314
+ }, qt = (s, t, e) => {
314
315
  let n, i, r, o, a, l = e.indexOf(s), h = e.indexOf(t, l + 1), c = l;
315
316
  if (l >= 0 && h > 0) {
316
317
  if (s === t)
@@ -328,47 +329,47 @@ const St = (s, t, e) => {
328
329
  n.length && o !== void 0 && (a = [r, o]);
329
330
  }
330
331
  return a;
331
- }, xt = "\\0SLASH" + Math.random() + "\\0", bt = "\\0OPEN" + Math.random() + "\\0", Q = "\\0CLOSE" + Math.random() + "\\0", vt = "\\0COMMA" + Math.random() + "\\0", At = "\\0PERIOD" + Math.random() + "\\0", qt = new RegExp(xt, "g"), Vt = new RegExp(bt, "g"), Xt = new RegExp(Q, "g"), Yt = new RegExp(vt, "g"), Zt = new RegExp(At, "g"), Jt = /\\\\\\\\/g, Kt = /\\\\{/g, Qt = /\\\\}/g, te = /\\\\,/g, ee = /\\\\./g;
332
- function V(s) {
332
+ }, bt = "\\0SLASH" + Math.random() + "\\0", vt = "\\0OPEN" + Math.random() + "\\0", tt = "\\0CLOSE" + Math.random() + "\\0", At = "\\0COMMA" + Math.random() + "\\0", Ft = "\\0PERIOD" + Math.random() + "\\0", Vt = new RegExp(bt, "g"), Xt = new RegExp(vt, "g"), Yt = new RegExp(tt, "g"), Zt = new RegExp(At, "g"), Jt = new RegExp(Ft, "g"), Kt = /\\\\\\\\/g, Qt = /\\\\{/g, te = /\\\\}/g, ee = /\\\\,/g, se = /\\\\./g;
333
+ function X(s) {
333
334
  return isNaN(s) ? s.charCodeAt(0) : parseInt(s, 10);
334
335
  }
335
- function se(s) {
336
- return s.replace(Jt, xt).replace(Kt, bt).replace(Qt, Q).replace(te, vt).replace(ee, At);
337
- }
338
336
  function ne(s) {
339
- return s.replace(qt, "\\\\").replace(Vt, "{").replace(Xt, "}").replace(Yt, ",").replace(Zt, ".");
337
+ return s.replace(Kt, bt).replace(Qt, vt).replace(te, tt).replace(ee, At).replace(se, Ft);
338
+ }
339
+ function ie(s) {
340
+ return s.replace(Vt, "\\\\").replace(Xt, "{").replace(Yt, "}").replace(Zt, ",").replace(Jt, ".");
340
341
  }
341
- function Ft(s) {
342
+ function Nt(s) {
342
343
  if (!s)
343
344
  return [""];
344
- const t = [], e = St("{", "}", s);
345
+ const t = [], e = xt("{", "}", s);
345
346
  if (!e)
346
347
  return s.split(",");
347
348
  const { pre: n, body: i, post: r } = e, o = n.split(",");
348
349
  o[o.length - 1] += "{" + i + "}";
349
- const a = Ft(r);
350
+ const a = Nt(r);
350
351
  return r.length && (o[o.length - 1] += a.shift(), o.push.apply(o, a)), t.push.apply(t, o), t;
351
352
  }
352
- function ie(s) {
353
- return s ? (s.slice(0, 2) === "{}" && (s = "\\\\{\\\\}" + s.slice(2)), T(se(s), !0).map(ne)) : [];
354
- }
355
353
  function re(s) {
356
- return "{" + s + "}";
354
+ return s ? (s.slice(0, 2) === "{}" && (s = "\\\\{\\\\}" + s.slice(2)), I(ne(s), !0).map(ie)) : [];
357
355
  }
358
356
  function oe(s) {
357
+ return "{" + s + "}";
358
+ }
359
+ function ae(s) {
359
360
  return /^-?0\\d/.test(s);
360
361
  }
361
- function ae(s, t) {
362
+ function ce(s, t) {
362
363
  return s <= t;
363
364
  }
364
- function ce(s, t) {
365
+ function le(s, t) {
365
366
  return s >= t;
366
367
  }
367
- function T(s, t) {
368
- const e = [], n = St("{", "}", s);
368
+ function I(s, t) {
369
+ const e = [], n = xt("{", "}", s);
369
370
  if (!n)
370
371
  return [s];
371
- const i = n.pre, r = n.post.length ? T(n.post, !1) : [""];
372
+ const i = n.pre, r = n.post.length ? I(n.post, !1) : [""];
372
373
  if (/\\$$/.test(n.pre))
373
374
  for (let o = 0; o < r.length; o++) {
374
375
  const a = i + "{" + n.body + "}" + r[o];
@@ -377,36 +378,36 @@ function T(s, t) {
377
378
  else {
378
379
  const o = /^-?\\d+\\.\\.-?\\d+(?:\\.\\.-?\\d+)?$/.test(n.body), a = /^[a-zA-Z]\\.\\.[a-zA-Z](?:\\.\\.-?\\d+)?$/.test(n.body), l = o || a, h = n.body.indexOf(",") >= 0;
379
380
  if (!l && !h)
380
- return n.post.match(/,(?!,).*\\}/) ? (s = n.pre + "{" + n.body + Q + n.post, T(s)) : [s];
381
+ return n.post.match(/,(?!,).*\\}/) ? (s = n.pre + "{" + n.body + tt + n.post, I(s)) : [s];
381
382
  let c;
382
383
  if (l)
383
384
  c = n.body.split(/\\.\\./);
384
- else if (c = Ft(n.body), c.length === 1 && c[0] !== void 0 && (c = T(c[0], !1).map(re), c.length === 1))
385
+ else if (c = Nt(n.body), c.length === 1 && c[0] !== void 0 && (c = I(c[0], !1).map(oe), c.length === 1))
385
386
  return r.map((u) => n.pre + c[0] + u);
386
387
  let f;
387
388
  if (l && c[0] !== void 0 && c[1] !== void 0) {
388
- const u = V(c[0]), d = V(c[1]), w = Math.max(c[0].length, c[1].length);
389
- let g = c.length === 3 && c[2] !== void 0 ? Math.abs(V(c[2])) : 1, S = ae;
390
- d < u && (g *= -1, S = ce);
391
- const O = c.some(oe);
389
+ const u = X(c[0]), d = X(c[1]), w = Math.max(c[0].length, c[1].length);
390
+ let g = c.length === 3 && c[2] !== void 0 ? Math.abs(X(c[2])) : 1, S = ce;
391
+ d < u && (g *= -1, S = le);
392
+ const $ = c.some(ae);
392
393
  f = [];
393
394
  for (let x = u; S(x, d); x += g) {
394
- let y;
395
+ let m;
395
396
  if (a)
396
- y = String.fromCharCode(x), y === "\\\\" && (y = "");
397
- else if (y = String(x), O) {
398
- const $ = w - y.length;
399
- if ($ > 0) {
400
- const I = new Array($ + 1).join("0");
401
- x < 0 ? y = "-" + I + y.slice(1) : y = I + y;
397
+ m = String.fromCharCode(x), m === "\\\\" && (m = "");
398
+ else if (m = String(x), $) {
399
+ const C = w - m.length;
400
+ if (C > 0) {
401
+ const R = new Array(C + 1).join("0");
402
+ x < 0 ? m = "-" + R + m.slice(1) : m = R + m;
402
403
  }
403
404
  }
404
- f.push(y);
405
+ f.push(m);
405
406
  }
406
407
  } else {
407
408
  f = [];
408
409
  for (let u = 0; u < c.length; u++)
409
- f.push.apply(f, T(c[u], !1));
410
+ f.push.apply(f, I(c[u], !1));
410
411
  }
411
412
  for (let u = 0; u < f.length; u++)
412
413
  for (let d = 0; d < r.length; d++) {
@@ -416,12 +417,12 @@ function T(s, t) {
416
417
  }
417
418
  return e;
418
419
  }
419
- const le = 1024 * 64, U = (s) => {
420
+ const he = 1024 * 64, G = (s) => {
420
421
  if (typeof s != "string")
421
422
  throw new TypeError("invalid pattern");
422
- if (s.length > le)
423
+ if (s.length > he)
423
424
  throw new TypeError("pattern is too long");
424
- }, he = {
425
+ }, ue = {
425
426
  "[:alnum:]": ["\\\\p{L}\\\\p{Nl}\\\\p{Nd}", !0],
426
427
  "[:alpha:]": ["\\\\p{L}\\\\p{Nl}", !0],
427
428
  "[:ascii:]": ["\\\\x00-\\\\x7f", !1],
@@ -436,7 +437,7 @@ const le = 1024 * 64, U = (s) => {
436
437
  "[:upper:]": ["\\\\p{Lu}", !0],
437
438
  "[:word:]": ["\\\\p{L}\\\\p{Nl}\\\\p{Nd}\\\\p{Pc}", !0],
438
439
  "[:xdigit:]": ["A-Fa-f0-9", !1]
439
- }, C = (s) => s.replace(/[[\\]\\\\-]/g, "\\\\$&"), ue = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), rt = (s) => s.join(""), fe = (s, t) => {
440
+ }, M = (s) => s.replace(/[[\\]\\\\-]/g, "\\\\$&"), fe = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), ot = (s) => s.join(""), de = (s, t) => {
440
441
  const e = t;
441
442
  if (s.charAt(e) !== "[")
442
443
  throw new Error("not in a brace expression");
@@ -457,27 +458,27 @@ const le = 1024 * 64, U = (s) => {
457
458
  continue;
458
459
  }
459
460
  if (g === "[" && !l) {
460
- for (const [S, [A, O, x]] of Object.entries(he))
461
+ for (const [S, [F, $, x]] of Object.entries(ue))
461
462
  if (s.startsWith(S, r)) {
462
463
  if (f)
463
464
  return ["$.", !1, s.length - e, !0];
464
- r += S.length, x ? i.push(A) : n.push(A), a = a || O;
465
+ r += S.length, x ? i.push(F) : n.push(F), a = a || $;
465
466
  continue t;
466
467
  }
467
468
  }
468
469
  if (l = !1, f) {
469
- g > f ? n.push(C(f) + "-" + C(g)) : g === f && n.push(C(g)), f = "", r++;
470
+ g > f ? n.push(M(f) + "-" + M(g)) : g === f && n.push(M(g)), f = "", r++;
470
471
  continue;
471
472
  }
472
473
  if (s.startsWith("-]", r + 1)) {
473
- n.push(C(g + "-")), r += 2;
474
+ n.push(M(g + "-")), r += 2;
474
475
  continue;
475
476
  }
476
477
  if (s.startsWith("-", r + 1)) {
477
478
  f = g, r += 2;
478
479
  continue;
479
480
  }
480
- n.push(C(g)), r++;
481
+ n.push(M(g)), r++;
481
482
  }
482
483
  if (c < r)
483
484
  return ["", !1, 0, !1];
@@ -485,11 +486,11 @@ const le = 1024 * 64, U = (s) => {
485
486
  return ["$.", !1, s.length - e, !0];
486
487
  if (i.length === 0 && n.length === 1 && /^\\\\?.$/.test(n[0]) && !h) {
487
488
  const g = n[0].length === 2 ? n[0].slice(-1) : n[0];
488
- return [ue(g), !1, c - e, !1];
489
+ return [fe(g), !1, c - e, !1];
489
490
  }
490
- const u = "[" + (h ? "^" : "") + rt(n) + "]", d = "[" + (h ? "" : "^") + rt(i) + "]";
491
+ const u = "[" + (h ? "^" : "") + ot(n) + "]", d = "[" + (h ? "" : "^") + ot(i) + "]";
491
492
  return [n.length && i.length ? "(" + u + "|" + d + ")" : n.length ? u : d, a, c - e, !0];
492
- }, M = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\\[([^\\/\\\\])\\]/g, "$1") : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, "$1$2").replace(/\\\\([^\\/])/g, "$1"), de = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), ot = (s) => de.has(s), pe = "(?!(?:^|/)\\\\.\\\\.?(?:$|/))", L = "(?!\\\\.)", ge = /* @__PURE__ */ new Set(["[", "."]), we = /* @__PURE__ */ new Set(["..", "."]), ye = new Set("().*{}+?[]^$\\\\!"), me = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), tt = "[^/]", at = tt + "*?", ct = tt + "+?";
493
+ }, P = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\\[([^\\/\\\\])\\]/g, "$1") : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, "$1$2").replace(/\\\\([^\\/])/g, "$1"), pe = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), at = (s) => pe.has(s), ge = "(?!(?:^|/)\\\\.\\\\.?(?:$|/))", z = "(?!\\\\.)", we = /* @__PURE__ */ new Set(["[", "."]), me = /* @__PURE__ */ new Set(["..", "."]), ye = new Set("().*{}+?[]^$\\\\!"), Ee = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), et = "[^/]", ct = et + "*?", lt = et + "+?";
493
494
  class E {
494
495
  type;
495
496
  #s;
@@ -606,7 +607,7 @@ class E {
606
607
  o = !0, a = d, l = !1, w += g;
607
608
  continue;
608
609
  }
609
- if (!i.noext && ot(g) && t.charAt(d) === "(") {
610
+ if (!i.noext && at(g) && t.charAt(d) === "(") {
610
611
  e.push(w), w = "";
611
612
  const S = new E(g, e);
612
613
  d = E.#h(t, S, d, i), e.push(S);
@@ -632,7 +633,7 @@ class E {
632
633
  o = !0, a = h, l = !1, u += d;
633
634
  continue;
634
635
  }
635
- if (ot(d) && t.charAt(h) === "(") {
636
+ if (at(d) && t.charAt(h) === "(") {
636
637
  c.push(u), u = "";
637
638
  const w = new E(d, c);
638
639
  c.push(w), h = E.#h(t, w, h, i);
@@ -742,23 +743,23 @@ class E {
742
743
  const e = t ?? !!this.#i.dot;
743
744
  if (this.#s === this && this.#d(), !this.type) {
744
745
  const l = this.isStart() && this.isEnd(), h = this.#t.map((d) => {
745
- const [w, g, S, A] = typeof d == "string" ? E.#p(d, this.#n, l) : d.toRegExpSource(t);
746
- return this.#n = this.#n || S, this.#r = this.#r || A, w;
746
+ const [w, g, S, F] = typeof d == "string" ? E.#p(d, this.#n, l) : d.toRegExpSource(t);
747
+ return this.#n = this.#n || S, this.#r = this.#r || F, w;
747
748
  }).join("");
748
749
  let c = "";
749
- if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && we.has(this.#t[0]))) {
750
- const w = ge, g = (
750
+ if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && me.has(this.#t[0]))) {
751
+ const w = we, g = (
751
752
  // dots are allowed, and the pattern starts with [ or .
752
753
  e && w.has(h.charAt(0)) || // the pattern starts with \\., and then [ or .
753
754
  h.startsWith("\\\\.") && w.has(h.charAt(2)) || // the pattern starts with \\.\\., and then [ or .
754
755
  h.startsWith("\\\\.\\\\.") && w.has(h.charAt(4))
755
756
  ), S = !e && !t && w.has(h.charAt(0));
756
- c = g ? pe : S ? L : "";
757
+ c = g ? ge : S ? z : "";
757
758
  }
758
759
  let f = "";
759
760
  return this.isEnd() && this.#s.#a && this.#e?.type === "!" && (f = "(?:$|\\\\/)"), [
760
761
  c + h + f,
761
- M(h),
762
+ P(h),
762
763
  this.#n = !!this.#n,
763
764
  this.#r
764
765
  ];
@@ -767,23 +768,23 @@ class E {
767
768
  let r = this.#f(e);
768
769
  if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
769
770
  const l = this.toString();
770
- return this.#t = [l], this.type = null, this.#n = void 0, [l, M(this.toString()), !1, !1];
771
+ return this.#t = [l], this.type = null, this.#n = void 0, [l, P(this.toString()), !1, !1];
771
772
  }
772
- let o = !n || t || e || !L ? "" : this.#f(!0);
773
+ let o = !n || t || e || !z ? "" : this.#f(!0);
773
774
  o === r && (o = ""), o && (r = \`(?:\${r})(?:\${o})*?\`);
774
775
  let a = "";
775
776
  if (this.type === "!" && this.#u)
776
- a = (this.isStart() && !e ? L : "") + ct;
777
+ a = (this.isStart() && !e ? z : "") + lt;
777
778
  else {
778
779
  const l = this.type === "!" ? (
779
780
  // !() must match something,but !(x) can match ''
780
- "))" + (this.isStart() && !e && !t ? L : "") + at + ")"
781
+ "))" + (this.isStart() && !e && !t ? z : "") + ct + ")"
781
782
  ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : \`)\${this.type}\`;
782
783
  a = i + r + l;
783
784
  }
784
785
  return [
785
786
  a,
786
- M(r),
787
+ P(r),
787
788
  this.#n = !!this.#n,
788
789
  this.#r
789
790
  ];
@@ -809,56 +810,56 @@ class E {
809
810
  continue;
810
811
  }
811
812
  if (l === "[") {
812
- const [h, c, f, u] = fe(t, a);
813
+ const [h, c, f, u] = de(t, a);
813
814
  if (f) {
814
815
  r += h, o = o || c, a += f - 1, e = e || u;
815
816
  continue;
816
817
  }
817
818
  }
818
819
  if (l === "*") {
819
- n && t === "*" ? r += ct : r += at, e = !0;
820
+ n && t === "*" ? r += lt : r += ct, e = !0;
820
821
  continue;
821
822
  }
822
823
  if (l === "?") {
823
- r += tt, e = !0;
824
+ r += et, e = !0;
824
825
  continue;
825
826
  }
826
- r += me(l);
827
+ r += Ee(l);
827
828
  }
828
- return [r, M(t), !!e, o];
829
+ return [r, P(t), !!e, o];
829
830
  }
830
831
  }
831
- const Ee = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\\]]/g, "[$&]") : s.replace(/[?*()[\\]\\\\]/g, "\\\\$&"), m = (s, t, e = {}) => (U(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new G(t, e).match(s)), Se = /^\\*+([^+@!?\\*\\[\\(]*)$/, xe = (s) => (t) => !t.startsWith(".") && t.endsWith(s), be = (s) => (t) => t.endsWith(s), ve = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), Ae = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), Fe = /^\\*+\\.\\*+$/, Ne = (s) => !s.startsWith(".") && s.includes("."), De = (s) => s !== "." && s !== ".." && s.includes("."), Oe = /^\\.\\*+$/, $e = (s) => s !== "." && s !== ".." && s.startsWith("."), Ce = /^\\*+$/, Te = (s) => s.length !== 0 && !s.startsWith("."), Me = (s) => s.length !== 0 && s !== "." && s !== "..", Pe = /^\\?+([^+@!?\\*\\[\\(]*)?$/, Ie = ([s, t = ""]) => {
832
- const e = Nt([s]);
832
+ const Se = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\\]]/g, "[$&]") : s.replace(/[?*()[\\]\\\\]/g, "\\\\$&"), y = (s, t, e = {}) => (G(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new q(t, e).match(s)), xe = /^\\*+([^+@!?\\*\\[\\(]*)$/, be = (s) => (t) => !t.startsWith(".") && t.endsWith(s), ve = (s) => (t) => t.endsWith(s), Ae = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), Fe = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), Ne = /^\\*+\\.\\*+$/, De = (s) => !s.startsWith(".") && s.includes("."), Oe = (s) => s !== "." && s !== ".." && s.includes("."), $e = /^\\.\\*+$/, Ce = (s) => s !== "." && s !== ".." && s.startsWith("."), Me = /^\\*+$/, Ie = (s) => s.length !== 0 && !s.startsWith("."), Pe = (s) => s.length !== 0 && s !== "." && s !== "..", Te = /^\\?+([^+@!?\\*\\[\\(]*)?$/, Re = ([s, t = ""]) => {
833
+ const e = Dt([s]);
833
834
  return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
834
835
  }, ke = ([s, t = ""]) => {
835
- const e = Dt([s]);
836
+ const e = Ot([s]);
836
837
  return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
837
- }, Re = ([s, t = ""]) => {
838
- const e = Dt([s]);
839
- return t ? (n) => e(n) && n.endsWith(t) : e;
840
838
  }, Le = ([s, t = ""]) => {
841
- const e = Nt([s]);
839
+ const e = Ot([s]);
842
840
  return t ? (n) => e(n) && n.endsWith(t) : e;
843
- }, Nt = ([s]) => {
841
+ }, ze = ([s, t = ""]) => {
842
+ const e = Dt([s]);
843
+ return t ? (n) => e(n) && n.endsWith(t) : e;
844
+ }, Dt = ([s]) => {
844
845
  const t = s.length;
845
846
  return (e) => e.length === t && !e.startsWith(".");
846
- }, Dt = ([s]) => {
847
+ }, Ot = ([s]) => {
847
848
  const t = s.length;
848
849
  return (e) => e.length === t && e !== "." && e !== "..";
849
- }, Ot = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", lt = {
850
+ }, $t = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", ht = {
850
851
  win32: { sep: "\\\\" },
851
852
  posix: { sep: "/" }
852
- }, ze = Ot === "win32" ? lt.win32.sep : lt.posix.sep;
853
- m.sep = ze;
853
+ }, He = $t === "win32" ? ht.win32.sep : ht.posix.sep;
854
+ y.sep = He;
854
855
  const v = Symbol("globstar **");
855
- m.GLOBSTAR = v;
856
- const He = "[^/]", We = He + "*?", _e = "(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?", je = "(?:(?!(?:\\\\/|^)\\\\.).)*?", Be = (s, t = {}) => (e) => m(e, s, t);
857
- m.filter = Be;
858
- const b = (s, t = {}) => Object.assign({}, s, t), Ue = (s) => {
856
+ y.GLOBSTAR = v;
857
+ const We = "[^/]", _e = We + "*?", je = "(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?", Ue = "(?:(?!(?:\\\\/|^)\\\\.).)*?", Be = (s, t = {}) => (e) => y(e, s, t);
858
+ y.filter = Be;
859
+ const b = (s, t = {}) => Object.assign({}, s, t), Ge = (s) => {
859
860
  if (!s || typeof s != "object" || !Object.keys(s).length)
860
- return m;
861
- const t = m;
861
+ return y;
862
+ const t = y;
862
863
  return Object.assign((n, i, r = {}) => t(n, i, b(s, r)), {
863
864
  Minimatch: class extends t.Minimatch {
864
865
  constructor(i, r = {}) {
@@ -889,18 +890,18 @@ const b = (s, t = {}) => Object.assign({}, s, t), Ue = (s) => {
889
890
  GLOBSTAR: v
890
891
  });
891
892
  };
892
- m.defaults = Ue;
893
- const $t = (s, t = {}) => (U(s), t.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(s) ? [s] : ie(s));
894
- m.braceExpand = $t;
895
- const Ge = (s, t = {}) => new G(s, t).makeRe();
896
- m.makeRe = Ge;
897
- const qe = (s, t, e = {}) => {
898
- const n = new G(t, e);
893
+ y.defaults = Ge;
894
+ const Ct = (s, t = {}) => (G(s), t.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(s) ? [s] : re(s));
895
+ y.braceExpand = Ct;
896
+ const qe = (s, t = {}) => new q(s, t).makeRe();
897
+ y.makeRe = qe;
898
+ const Ve = (s, t, e = {}) => {
899
+ const n = new q(t, e);
899
900
  return s = s.filter((i) => n.match(i)), n.options.nonull && !s.length && s.push(t), s;
900
901
  };
901
- m.match = qe;
902
- const ht = /[?*]|[+@!]\\(.*?\\)|\\[|\\]/, Ve = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&");
903
- class G {
902
+ y.match = Ve;
903
+ const ut = /[?*]|[+@!]\\(.*?\\)|\\[|\\]/, Xe = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&");
904
+ class q {
904
905
  options;
905
906
  set;
906
907
  pattern;
@@ -919,7 +920,7 @@ class G {
919
920
  windowsNoMagicRoot;
920
921
  regexp;
921
922
  constructor(t, e = {}) {
922
- U(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ot, 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();
923
+ G(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || $t, 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();
923
924
  }
924
925
  hasMagic() {
925
926
  if (this.options.magicalBraces && this.set.length > 1)
@@ -947,7 +948,7 @@ class G {
947
948
  this.globParts = this.preprocess(n), this.debug(this.pattern, this.globParts);
948
949
  let i = this.globParts.map((r, o, a) => {
949
950
  if (this.isWindows && this.windowsNoMagicRoot) {
950
- const l = r[0] === "" && r[1] === "" && (r[2] === "?" || !ht.test(r[2])) && !ht.test(r[3]), h = /^[a-z]:/i.test(r[0]);
951
+ const l = r[0] === "" && r[1] === "" && (r[2] === "?" || !ut.test(r[2])) && !ut.test(r[3]), h = /^[a-z]:/i.test(r[0]);
951
952
  if (l)
952
953
  return [...r.slice(0, 4), ...r.slice(4).map((c) => this.parse(c))];
953
954
  if (h)
@@ -1127,10 +1128,10 @@ class G {
1127
1128
  matchOne(t, e, n = !1) {
1128
1129
  const i = this.options;
1129
1130
  if (this.isWindows) {
1130
- 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]), A = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), O = !A && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), x = S ? 3 : g ? 0 : void 0, y = O ? 3 : A ? 0 : void 0;
1131
- if (typeof x == "number" && typeof y == "number") {
1132
- const [$, I] = [t[x], e[y]];
1133
- $.toLowerCase() === I.toLowerCase() && (e[y] = $, y > x ? e = e.slice(y) : x > y && (t = t.slice(x)));
1131
+ 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]), F = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), $ = !F && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), x = S ? 3 : g ? 0 : void 0, m = $ ? 3 : F ? 0 : void 0;
1132
+ if (typeof x == "number" && typeof m == "number") {
1133
+ const [C, R] = [t[x], e[m]];
1134
+ C.toLowerCase() === R.toLowerCase() && (e[m] = C, m > x ? e = e.slice(m) : x > m && (t = t.slice(x)));
1134
1135
  }
1135
1136
  }
1136
1137
  const { optimizationLevel: r = 1 } = this.options;
@@ -1176,17 +1177,17 @@ globstar while\`, t, u, e, d, w), this.matchOne(t.slice(u), e.slice(d), n))
1176
1177
  throw new Error("wtf?");
1177
1178
  }
1178
1179
  braceExpand() {
1179
- return $t(this.pattern, this.options);
1180
+ return Ct(this.pattern, this.options);
1180
1181
  }
1181
1182
  parse(t) {
1182
- U(t);
1183
+ G(t);
1183
1184
  const e = this.options;
1184
1185
  if (t === "**")
1185
1186
  return v;
1186
1187
  if (t === "")
1187
1188
  return "";
1188
1189
  let n, i = null;
1189
- (n = t.match(Ce)) ? i = e.dot ? Me : Te : (n = t.match(Se)) ? i = (e.nocase ? e.dot ? Ae : ve : e.dot ? be : xe)(n[1]) : (n = t.match(Pe)) ? i = (e.nocase ? e.dot ? ke : Ie : e.dot ? Re : Le)(n) : (n = t.match(Fe)) ? i = e.dot ? De : Ne : (n = t.match(Oe)) && (i = $e);
1190
+ (n = t.match(Me)) ? i = e.dot ? Pe : Ie : (n = t.match(xe)) ? i = (e.nocase ? e.dot ? Fe : Ae : e.dot ? ve : be)(n[1]) : (n = t.match(Te)) ? i = (e.nocase ? e.dot ? ke : Re : e.dot ? Le : ze)(n) : (n = t.match(Ne)) ? i = e.dot ? Oe : De : (n = t.match($e)) && (i = Ce);
1190
1191
  const r = E.fromGlob(t, this.options).toMMPattern();
1191
1192
  return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
1192
1193
  }
@@ -1196,13 +1197,13 @@ globstar while\`, t, u, e, d, w), this.matchOne(t.slice(u), e.slice(d), n))
1196
1197
  const t = this.set;
1197
1198
  if (!t.length)
1198
1199
  return this.regexp = !1, this.regexp;
1199
- const e = this.options, n = e.noglobstar ? We : e.dot ? _e : je, i = new Set(e.nocase ? ["i"] : []);
1200
+ const e = this.options, n = e.noglobstar ? _e : e.dot ? je : Ue, i = new Set(e.nocase ? ["i"] : []);
1200
1201
  let r = t.map((l) => {
1201
1202
  const h = l.map((c) => {
1202
1203
  if (c instanceof RegExp)
1203
1204
  for (const f of c.flags.split(""))
1204
1205
  i.add(f);
1205
- return typeof c == "string" ? Ve(c) : c === v ? v : c._src;
1206
+ return typeof c == "string" ? Xe(c) : c === v ? v : c._src;
1206
1207
  });
1207
1208
  return h.forEach((c, f) => {
1208
1209
  const u = h[f + 1], d = h[f - 1];
@@ -1247,48 +1248,48 @@ globstar while\`, t, u, e, d, w), this.matchOne(t.slice(u), e.slice(d), n))
1247
1248
  return n.flipNegate ? !1 : this.negate;
1248
1249
  }
1249
1250
  static defaults(t) {
1250
- return m.defaults(t).Minimatch;
1251
+ return y.defaults(t).Minimatch;
1251
1252
  }
1252
1253
  }
1253
- m.AST = E;
1254
- m.Minimatch = G;
1255
- m.escape = Ee;
1256
- m.unescape = M;
1257
- function Xe() {
1254
+ y.AST = E;
1255
+ y.Minimatch = q;
1256
+ y.escape = Se;
1257
+ y.unescape = P;
1258
+ function Ye() {
1258
1259
  if (!("storage" in navigator) || !("getDirectory" in navigator.storage))
1259
- throw new jt();
1260
+ throw new Ut();
1260
1261
  }
1261
- async function P(s, t, e) {
1262
+ async function T(s, t, e) {
1262
1263
  return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(\`opfs:\${s.replace(/\\/+/g, "/")}\`, { mode: t }, e) : e();
1263
1264
  }
1264
- function D(s) {
1265
+ function O(s) {
1265
1266
  return Array.isArray(s) ? s : (s.startsWith("~/") ? s.slice(2) : s).split("/").filter(Boolean);
1266
1267
  }
1267
- function et(s) {
1268
+ function st(s) {
1268
1269
  return typeof s == "string" ? s ?? "/" : \`/\${s.join("/")}\`;
1269
1270
  }
1270
- function J(s) {
1271
- const t = D(s);
1271
+ function K(s) {
1272
+ const t = O(s);
1272
1273
  return t[t.length - 1] || "";
1273
1274
  }
1274
- function X(s) {
1275
- const t = D(s);
1276
- return t.pop(), et(t);
1275
+ function Y(s) {
1276
+ const t = O(s);
1277
+ return t.pop(), st(t);
1277
1278
  }
1278
- function W(s) {
1279
+ function _(s) {
1279
1280
  return !s || s === "/" ? "/" : s.startsWith("~/") ? \`/\${s.slice(2)}\` : s.startsWith("/") ? s : \`/\${s}\`;
1280
1281
  }
1281
- function Ye(s, t = !1) {
1282
+ function Ze(s, t = !1) {
1282
1283
  return s = s.replace(/\\/$/, ""), t && !s.includes("*") ? \`\${s}/**\` : s;
1283
1284
  }
1284
- function Y(s, t) {
1285
- return m(s, t, {
1285
+ function Z(s, t) {
1286
+ return y(s, t, {
1286
1287
  dot: !0,
1287
1288
  matchBase: !0
1288
1289
  });
1289
1290
  }
1290
- function ut(s) {
1291
- const t = W(s), e = D(t), n = [];
1291
+ function ft(s) {
1292
+ const t = _(s), e = O(t), n = [];
1292
1293
  for (const i of e)
1293
1294
  if (!(i === "." || i === ""))
1294
1295
  if (i === "..") {
@@ -1297,21 +1298,21 @@ function ut(s) {
1297
1298
  n.pop();
1298
1299
  } else
1299
1300
  n.push(i);
1300
- return et(n);
1301
+ return st(n);
1301
1302
  }
1302
- async function Ze(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1303
+ async function Je(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1303
1304
  if (s instanceof File && (s = await s.arrayBuffer()), s.byteLength > e)
1304
1305
  throw new Error(\`File size \${s.byteLength} bytes exceeds maximum allowed size \${e} bytes\`);
1305
1306
  const n = new Uint8Array(s), i = await crypto.subtle.digest(t, n);
1306
1307
  return Array.from(new Uint8Array(i)).map((o) => o.toString(16).padStart(2, "0")).join("");
1307
1308
  }
1308
- async function Je(s) {
1309
+ async function Ke(s) {
1309
1310
  const t = await s.arrayBuffer();
1310
1311
  return new Uint8Array(t);
1311
1312
  }
1312
- async function Ke(s, t, e = {}) {
1313
- const n = J(t);
1314
- return P(t, "exclusive", async () => {
1313
+ async function Qe(s, t, e = {}) {
1314
+ const n = K(t);
1315
+ return T(t, "exclusive", async () => {
1315
1316
  const i = e.recursive ?? !1, r = e.force ?? !1;
1316
1317
  e.useTrash;
1317
1318
  try {
@@ -1324,7 +1325,7 @@ async function Ke(s, t, e = {}) {
1324
1325
  }
1325
1326
  });
1326
1327
  }
1327
- function ft(s, t, e, n) {
1328
+ function dt(s, t, e, n) {
1328
1329
  if (!Number.isInteger(t) || !Number.isInteger(e))
1329
1330
  throw new p("Invalid offset or length", "EINVAL");
1330
1331
  if (t < 0 || e < 0)
@@ -1334,27 +1335,27 @@ function ft(s, t, e, n) {
1334
1335
  if (n != null && (!Number.isInteger(n) || n < 0))
1335
1336
  throw new p("Invalid position", "EINVAL");
1336
1337
  }
1337
- function dt(s, t, e) {
1338
+ function pt(s, t, e) {
1338
1339
  try {
1339
1340
  t.flush(), t.close();
1340
1341
  } catch (n) {
1341
1342
  console.warn(\`Warning: Failed to properly close file descriptor \${s} (\${e}):\`, n);
1342
1343
  }
1343
1344
  }
1344
- function Qe(s, t, e) {
1345
+ function ts(s, t, e) {
1345
1346
  if (s >= e)
1346
1347
  return { isEOF: !0, actualLength: 0 };
1347
1348
  const n = Math.min(t, e - s);
1348
1349
  return n <= 0 ? { isEOF: !0, actualLength: 0 } : { isEOF: !1, actualLength: n };
1349
1350
  }
1350
- async function ts(s, t) {
1351
+ async function es(s, t) {
1351
1352
  try {
1352
1353
  return await s.createSyncAccessHandle();
1353
1354
  } catch (e) {
1354
- throw Ut(e, { path: t });
1355
+ throw Gt(e, { path: t });
1355
1356
  }
1356
1357
  }
1357
- class es {
1358
+ class ss {
1358
1359
  /** Root directory handle for the file system */
1359
1360
  root;
1360
1361
  /** Map of watched paths and options */
@@ -1398,7 +1399,7 @@ class es {
1398
1399
  if (!this.options.broadcastChannel)
1399
1400
  return;
1400
1401
  const e = t.path;
1401
- if (![...this.watchers.values()].some((r) => Y(e, r.pattern) && r.include.some((o) => o && Y(e, o)) && !r.exclude.some((o) => o && Y(e, o))))
1402
+ if (![...this.watchers.values()].some((r) => Z(e, r.pattern) && r.include.some((o) => o && Z(e, o)) && !r.exclude.some((o) => o && Z(e, o))))
1402
1403
  return;
1403
1404
  let i;
1404
1405
  if (this.options.hashAlgorithm)
@@ -1430,7 +1431,7 @@ class es {
1430
1431
  * @throws {OPFSError} If OPFS is not supported in the current browser
1431
1432
  */
1432
1433
  constructor(t) {
1433
- Xe(), t && this.setOptions(t);
1434
+ Ye(), t && this.setOptions(t);
1434
1435
  }
1435
1436
  /**
1436
1437
  * Initialize the file system within a given directory
@@ -1477,7 +1478,7 @@ class es {
1477
1478
  * @param options.broadcastChannel - Custom name for the broadcast channel
1478
1479
  */
1479
1480
  async setOptions(t) {
1480
- 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());
1481
+ 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 = _(t.root), this.options.namespace || (this.options.namespace = \`opfs-worker:\${this.options.root}\`), await this.mount());
1481
1482
  }
1482
1483
  /**
1483
1484
  * Get a directory handle from a path
@@ -1498,7 +1499,7 @@ class es {
1498
1499
  * \`\`\`
1499
1500
  */
1500
1501
  async getDirectoryHandle(t, e = !1, n = this.root) {
1501
- const i = Array.isArray(t) ? t : D(t);
1502
+ const i = Array.isArray(t) ? t : O(t);
1502
1503
  let r = n;
1503
1504
  for (const o of i)
1504
1505
  r = await r.getDirectoryHandle(o, { create: e });
@@ -1524,7 +1525,7 @@ class es {
1524
1525
  * \`\`\`
1525
1526
  */
1526
1527
  async getFileHandle(t, e = !1, n = this.root) {
1527
- const i = D(t);
1528
+ const i = O(t);
1528
1529
  if (i.length === 0)
1529
1530
  throw new Bt("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
1530
1531
  const r = i.pop();
@@ -1593,17 +1594,17 @@ class es {
1593
1594
  async readFile(t) {
1594
1595
  await this.mount();
1595
1596
  try {
1596
- return await P(t, "shared", async () => {
1597
+ return await T(t, "shared", async () => {
1597
1598
  const e = await this.open(t);
1598
1599
  try {
1599
1600
  const { size: n } = await this.fstat(e), i = new Uint8Array(n);
1600
- return n > 0 && await this.read(e, i, 0, n, 0), H(i, [i.buffer]);
1601
+ return n > 0 && await this.read(e, i, 0, n, 0), W(i, [i.buffer]);
1601
1602
  } finally {
1602
1603
  await this.close(e);
1603
1604
  }
1604
1605
  });
1605
1606
  } catch (e) {
1606
- throw new nt(t, e);
1607
+ throw new it(t, e);
1607
1608
  }
1608
1609
  }
1609
1610
  /**
@@ -1631,14 +1632,14 @@ class es {
1631
1632
  async writeFile(t, e) {
1632
1633
  await this.mount();
1633
1634
  const n = e instanceof Uint8Array ? e : new Uint8Array(e);
1634
- await P(t, "exclusive", async () => {
1635
+ await T(t, "exclusive", async () => {
1635
1636
  const i = await this.exists(t), r = await this.open(t, { create: !0, truncate: !0 });
1636
1637
  try {
1637
1638
  await this.write(r, n, 0, n.length, null, !1), await this.fsync(r);
1638
1639
  } finally {
1639
1640
  await this.close(r);
1640
1641
  }
1641
- await this.notifyChange({ path: t, type: i ? "changed" : "added", isDirectory: !1 });
1642
+ await this.notifyChange({ path: t, type: i ? A.Changed : A.Added, isDirectory: !1 });
1642
1643
  });
1643
1644
  }
1644
1645
  /**
@@ -1666,7 +1667,7 @@ class es {
1666
1667
  async appendFile(t, e) {
1667
1668
  await this.mount();
1668
1669
  const n = e instanceof Uint8Array ? e : new Uint8Array(e);
1669
- await P(t, "exclusive", async () => {
1670
+ await T(t, "exclusive", async () => {
1670
1671
  const i = await this.open(t, { create: !0 });
1671
1672
  try {
1672
1673
  const { size: r } = await this.fstat(i);
@@ -1674,7 +1675,7 @@ class es {
1674
1675
  } finally {
1675
1676
  await this.close(i);
1676
1677
  }
1677
- await this.notifyChange({ path: t, type: "changed", isDirectory: !1 });
1678
+ await this.notifyChange({ path: t, type: A.Changed, isDirectory: !1 });
1678
1679
  });
1679
1680
  }
1680
1681
  /**
@@ -1700,7 +1701,7 @@ class es {
1700
1701
  */
1701
1702
  async mkdir(t, e) {
1702
1703
  await this.mount();
1703
- const n = e?.recursive ?? !1, i = D(t);
1704
+ const n = e?.recursive ?? !1, i = O(t);
1704
1705
  let r = this.root;
1705
1706
  for (let o = 0; o < i.length; o++) {
1706
1707
  const a = i[o];
@@ -1708,14 +1709,14 @@ class es {
1708
1709
  r = await r.getDirectoryHandle(a, { create: n || o === i.length - 1 });
1709
1710
  } catch (l) {
1710
1711
  throw l.name === "NotFoundError" ? new p(
1711
- \`Parent directory does not exist: \${et(i.slice(0, o + 1))}\`,
1712
+ \`Parent directory does not exist: \${st(i.slice(0, o + 1))}\`,
1712
1713
  "ENOENT",
1713
1714
  void 0,
1714
1715
  l
1715
1716
  ) : l.name === "TypeMismatchError" ? new p(\`Path segment is not a directory: \${a}\`, "ENOTDIR", void 0, l) : new p("Failed to create directory", "MKDIR_FAILED", void 0, l);
1716
1717
  }
1717
1718
  }
1718
- await this.notifyChange({ path: t, type: "added", isDirectory: !0 });
1719
+ await this.notifyChange({ path: t, type: A.Added, isDirectory: !0 });
1719
1720
  }
1720
1721
  /**
1721
1722
  * Get file or directory statistics
@@ -1749,7 +1750,7 @@ class es {
1749
1750
  isFile: !1,
1750
1751
  isDirectory: !0
1751
1752
  };
1752
- const e = J(t), n = await this.getDirectoryHandle(X(t), !1), i = this.options.hashAlgorithm !== null;
1753
+ const e = K(t), n = await this.getDirectoryHandle(Y(t), !1), i = this.options.hashAlgorithm !== null;
1753
1754
  try {
1754
1755
  const o = await (await n.getFileHandle(e, { create: !1 })).getFile(), a = {
1755
1756
  kind: "file",
@@ -1761,7 +1762,7 @@ class es {
1761
1762
  };
1762
1763
  if (i && this.options.hashAlgorithm)
1763
1764
  try {
1764
- const l = await Ze(o, this.options.hashAlgorithm, this.options.maxFileSize);
1765
+ const l = await Je(o, this.options.hashAlgorithm, this.options.maxFileSize);
1765
1766
  a.hash = l;
1766
1767
  } catch (l) {
1767
1768
  console.warn(\`Failed to calculate hash for \${t}:\`, l);
@@ -1833,10 +1834,10 @@ class es {
1833
1834
  async exists(t) {
1834
1835
  if (await this.mount(), t === "/")
1835
1836
  return !0;
1836
- const e = J(t);
1837
+ const e = K(t);
1837
1838
  let n = null;
1838
1839
  try {
1839
- n = await this.getDirectoryHandle(X(t), !1);
1840
+ n = await this.getDirectoryHandle(Y(t), !1);
1840
1841
  } catch (i) {
1841
1842
  if (n = null, i.name !== "NotFoundError" && i.name !== "TypeMismatchError")
1842
1843
  throw i;
@@ -1884,7 +1885,7 @@ class es {
1884
1885
  const i = \`\${t === "/" ? "" : t}/\${n.name}\`;
1885
1886
  await this.remove(i, { recursive: !0 });
1886
1887
  }
1887
- await this.notifyChange({ path: t, type: "changed", isDirectory: !0 });
1888
+ await this.notifyChange({ path: t, type: A.Changed, isDirectory: !0 });
1888
1889
  } catch (e) {
1889
1890
  throw e instanceof p ? e : new p(\`Failed to clear directory: \${t}\`, "CLEAR_FAILED", void 0, e);
1890
1891
  }
@@ -1916,8 +1917,8 @@ class es {
1916
1917
  async remove(t, e) {
1917
1918
  if (await this.mount(), t === "/")
1918
1919
  throw new p("Cannot remove root directory", "EROOT");
1919
- const { recursive: n = !1, force: i = !1 } = e || {}, r = await this.getDirectoryHandle(X(t), !1), o = await this.stat(t);
1920
- await Ke(r, t, { recursive: n, force: i }), await this.notifyChange({ path: t, type: "removed", isDirectory: o.isDirectory });
1920
+ const { recursive: n = !1, force: i = !1 } = e || {}, r = await this.getDirectoryHandle(Y(t), !1), o = await this.stat(t);
1921
+ await Qe(r, t, { recursive: n, force: i }), await this.notifyChange({ path: t, type: A.Removed, isDirectory: o.isDirectory });
1921
1922
  }
1922
1923
  /**
1923
1924
  * Resolve a path to an absolute path
@@ -1940,9 +1941,9 @@ class es {
1940
1941
  async realpath(t) {
1941
1942
  await this.mount();
1942
1943
  try {
1943
- const e = ut(t);
1944
+ const e = ft(t);
1944
1945
  if (!await this.exists(e))
1945
- throw new nt(e);
1946
+ throw new it(e);
1946
1947
  return e;
1947
1948
  } catch (e) {
1948
1949
  throw e instanceof p ? e : new p(\`Failed to resolve path: \${t}\`, "REALPATH_FAILED", void 0, e);
@@ -1976,7 +1977,7 @@ class es {
1976
1977
  const i = n?.overwrite ?? !1, r = await this.stat(t);
1977
1978
  if (await this.exists(e) && !i)
1978
1979
  throw new p(\`Destination already exists: \${e}\`, "EEXIST", void 0);
1979
- await this.copy(t, e, { recursive: !0, overwrite: i }), await this.remove(t, { recursive: !0 }), await this.notifyChange({ path: t, type: "removed", isDirectory: r.isDirectory }), await this.notifyChange({ path: e, type: "added", isDirectory: r.isDirectory });
1980
+ await this.copy(t, e, { recursive: !0, overwrite: i }), await this.remove(t, { recursive: !0 }), await this.notifyChange({ path: t, type: A.Removed, isDirectory: r.isDirectory }), await this.notifyChange({ path: e, type: A.Added, isDirectory: r.isDirectory });
1980
1981
  } catch (i) {
1981
1982
  throw i instanceof p ? i : new p(\`Failed to rename from \${t} to \${e}\`, "RENAME_FAILED", void 0, i);
1982
1983
  }
@@ -2060,7 +2061,7 @@ class es {
2060
2061
  if (!this.options.broadcastChannel)
2061
2062
  throw new p("This instance is not configured to send events. Please specify options.broadcastChannel to enable watching.", "ENOENT");
2062
2063
  const n = {
2063
- pattern: Ye(t, e?.recursive ?? !0),
2064
+ pattern: Ze(t, e?.recursive ?? !0),
2064
2065
  include: Array.isArray(e?.include) ? e.include : [e?.include ?? "**"],
2065
2066
  exclude: Array.isArray(e?.exclude) ? e.exclude : [e?.exclude ?? ""]
2066
2067
  };
@@ -2101,9 +2102,9 @@ class es {
2101
2102
  */
2102
2103
  async open(t, e) {
2103
2104
  await this.mount();
2104
- const { create: n = !1, exclusive: i = !1, truncate: r = !1 } = e || {}, o = W(ut(t));
2105
+ const { create: n = !1, exclusive: i = !1, truncate: r = !1 } = e || {}, o = _(ft(t));
2105
2106
  try {
2106
- return n && i ? await P(o, "exclusive", async () => {
2107
+ return n && i ? await T(o, "exclusive", async () => {
2107
2108
  if (await this.exists(o))
2108
2109
  throw new p(\`File already exists: \${o}\`, "EEXIST", o);
2109
2110
  return this._openFile(o, n, r);
@@ -2123,7 +2124,7 @@ class es {
2123
2124
  } catch (a) {
2124
2125
  throw a.name === "TypeMismatchError" ? new p(\`Is a directory: \${t}\`, "EISDIR", t) : a;
2125
2126
  }
2126
- const r = await ts(i, t);
2127
+ const r = await es(i, t);
2127
2128
  n && (r.truncate(0), r.flush());
2128
2129
  const o = this.nextFd++;
2129
2130
  return this.openFiles.set(o, {
@@ -2149,7 +2150,7 @@ class es {
2149
2150
  */
2150
2151
  async close(t) {
2151
2152
  const e = this._getFileDescriptor(t);
2152
- dt(t, e.syncHandle, e.path), this.openFiles.delete(t);
2153
+ pt(t, e.syncHandle, e.path), this.openFiles.delete(t);
2153
2154
  }
2154
2155
  /**
2155
2156
  * Read data from a file descriptor
@@ -2177,15 +2178,15 @@ class es {
2177
2178
  */
2178
2179
  async read(t, e, n, i, r) {
2179
2180
  const o = this._getFileDescriptor(t);
2180
- ft(e.length, n, i, r);
2181
+ dt(e.length, n, i, r);
2181
2182
  try {
2182
- const a = r ?? o.position, l = o.syncHandle.getSize(), { isEOF: h, actualLength: c } = Qe(a, i, l);
2183
+ const a = r ?? o.position, l = o.syncHandle.getSize(), { isEOF: h, actualLength: c } = ts(a, i, l);
2183
2184
  if (h)
2184
- return H({ bytesRead: 0, buffer: e }, [e.buffer]);
2185
+ return W({ bytesRead: 0, buffer: e }, [e.buffer]);
2185
2186
  const f = e.subarray(n, n + c), u = o.syncHandle.read(f, { at: a });
2186
- return r == null && (o.position = a + u), H({ bytesRead: u, buffer: e }, [e.buffer]);
2187
+ return r == null && (o.position = a + u), W({ bytesRead: u, buffer: e }, [e.buffer]);
2187
2188
  } catch (a) {
2188
- throw R("read", t, o.path, a);
2189
+ throw L("read", t, o.path, a);
2189
2190
  }
2190
2191
  }
2191
2192
  /**
@@ -2211,12 +2212,12 @@ class es {
2211
2212
  */
2212
2213
  async write(t, e, n = 0, i, r, o = !0) {
2213
2214
  const a = this._getFileDescriptor(t), l = i ?? e.length - n;
2214
- ft(e.length, n, l, r);
2215
+ dt(e.length, n, l, r);
2215
2216
  try {
2216
2217
  const h = r ?? a.position, c = e.subarray(n, n + l), f = a.syncHandle.write(c, { at: h });
2217
- return (r == null || r === a.position) && (a.position = h + f), o && await this.notifyChange({ path: a.path, type: "changed", isDirectory: !1 }), f;
2218
+ return (r == null || r === a.position) && (a.position = h + f), o && await this.notifyChange({ path: a.path, type: A.Changed, isDirectory: !1 }), f;
2218
2219
  } catch (h) {
2219
- throw R("write", t, a.path, h);
2220
+ throw L("write", t, a.path, h);
2220
2221
  }
2221
2222
  }
2222
2223
  /**
@@ -2262,9 +2263,9 @@ class es {
2262
2263
  if (e < 0 || !Number.isInteger(e))
2263
2264
  throw new p("Invalid size", "EINVAL");
2264
2265
  try {
2265
- n.syncHandle.truncate(e), n.syncHandle.flush(), n.position > e && (n.position = e), await this.notifyChange({ path: n.path, type: "changed", isDirectory: !1 });
2266
+ n.syncHandle.truncate(e), n.syncHandle.flush(), n.position > e && (n.position = e), await this.notifyChange({ path: n.path, type: A.Changed, isDirectory: !1 });
2266
2267
  } catch (i) {
2267
- throw R("truncate", t, n.path, i);
2268
+ throw L("truncate", t, n.path, i);
2268
2269
  }
2269
2270
  }
2270
2271
  /**
@@ -2286,7 +2287,7 @@ class es {
2286
2287
  try {
2287
2288
  e.syncHandle.flush();
2288
2289
  } catch (n) {
2289
- throw R("sync", t, e.path, n);
2290
+ throw L("sync", t, e.path, n);
2290
2291
  }
2291
2292
  }
2292
2293
  /**
@@ -2298,7 +2299,7 @@ class es {
2298
2299
  dispose() {
2299
2300
  this.broadcastChannel && (this.broadcastChannel.close(), this.broadcastChannel = null), this.watchers.clear();
2300
2301
  for (const [t, e] of this.openFiles)
2301
- dt(t, e.syncHandle, e.path);
2302
+ pt(t, e.syncHandle, e.path);
2302
2303
  this.openFiles.clear(), this.nextFd = 1;
2303
2304
  }
2304
2305
  /**
@@ -2329,22 +2330,21 @@ class es {
2329
2330
  * await fs.sync(entries, { cleanBefore: true });
2330
2331
  * \`\`\`
2331
2332
  */
2332
- async sync(t, e) {
2333
+ async createIndex(t) {
2333
2334
  await this.mount();
2334
2335
  try {
2335
- (e?.cleanBefore ?? !1) && await this.clear("/");
2336
- for (const [i, r] of t) {
2337
- const o = W(i);
2338
- let a;
2339
- r instanceof Blob ? a = await Je(r) : typeof r == "string" ? a = new TextEncoder().encode(r) : a = r, await this.writeFile(o, a);
2336
+ for (const [e, n] of t) {
2337
+ const i = _(e);
2338
+ let r;
2339
+ n instanceof Blob ? r = await Ke(n) : typeof n == "string" ? r = new TextEncoder().encode(n) : r = n, await this.writeFile(i, r);
2340
2340
  }
2341
- } catch (n) {
2342
- throw n instanceof p ? n : new p("Failed to sync file system", "SYNC_FAILED", void 0, n);
2341
+ } catch (e) {
2342
+ throw e instanceof p ? e : new p("Failed to sync file system", "SYNC_FAILED", void 0, e);
2343
2343
  }
2344
2344
  }
2345
2345
  }
2346
- typeof globalThis < "u" && globalThis.constructor.name === "DedicatedWorkerGlobalScope" && K(new es());
2347
- //# sourceMappingURL=worker-CLvhwwfc.js.map
2346
+ typeof globalThis < "u" && globalThis.constructor.name === "DedicatedWorkerGlobalScope" && Q(new ss());
2347
+ //# sourceMappingURL=worker-CS9nvwsF.js.map
2348
2348
  `, p = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", f], { type: "text/javascript;charset=utf-8" });
2349
2349
  function m(a) {
2350
2350
  let n;
@@ -2367,14 +2367,28 @@ function m(a) {
2367
2367
  );
2368
2368
  }
2369
2369
  }
2370
- function s(a) {
2370
+ function i(a) {
2371
2371
  return a instanceof URL ? a.pathname : a;
2372
2372
  }
2373
2373
  class w {
2374
2374
  #n;
2375
+ promises = this;
2375
2376
  constructor(n) {
2376
- const t = u(new m());
2377
- this.#n = t, n && (n.broadcastChannel && n.broadcastChannel instanceof BroadcastChannel && (n.broadcastChannel = n.broadcastChannel.name), this.setOptions(n));
2377
+ this.#n = u(new m()), n && (n.broadcastChannel && n.broadcastChannel instanceof BroadcastChannel && (n.broadcastChannel = n.broadcastChannel.name), this.setOptions(n));
2378
+ }
2379
+ /**
2380
+ * Start watching a file or directory for changes
2381
+ */
2382
+ watch(n, t) {
2383
+ const e = i(n);
2384
+ return this.#n.watch(e, t), () => this.unwatch(e);
2385
+ }
2386
+ /**
2387
+ * Stop watching a previously watched path
2388
+ */
2389
+ unwatch(n) {
2390
+ const t = i(n);
2391
+ this.#n.unwatch(t);
2378
2392
  }
2379
2393
  /**
2380
2394
  * Update configuration options
@@ -2388,110 +2402,138 @@ class w {
2388
2402
  async index() {
2389
2403
  return this.#n.index();
2390
2404
  }
2405
+ // Implementation
2391
2406
  async readFile(n, t) {
2392
- const e = s(n), r = await this.#n.readFile(e);
2393
- return t || (t = c(e) ? "binary" : "utf-8"), t === "binary" ? r : l(r, t);
2407
+ const e = i(n);
2408
+ let r;
2409
+ typeof t == "string" ? r = t : t && typeof t == "object" && (r = t.encoding);
2410
+ const s = await this.#n.readFile(e);
2411
+ return r || (r = c(e) ? "binary" : "utf-8"), r === "binary" ? s : l(s, r);
2394
2412
  }
2395
2413
  /**
2396
2414
  * Write data to a file
2397
2415
  */
2398
2416
  async writeFile(n, t, e) {
2399
- const r = s(n);
2400
- e || (e = typeof t != "string" || c(r) ? "binary" : "utf-8");
2401
- const i = typeof t == "string" ? h(t, e) : t instanceof Uint8Array ? t : new Uint8Array(t);
2402
- return this.#n.writeFile(r, i);
2417
+ const r = i(n);
2418
+ let s;
2419
+ typeof e == "string" ? s = e : e && typeof e == "object" && (s = e.encoding), s || (s = typeof t != "string" || c(r) ? "binary" : "utf-8");
2420
+ const o = typeof t == "string" ? h(t, s) : t instanceof Uint8Array ? t : new Uint8Array(t);
2421
+ return this.#n.writeFile(r, o);
2403
2422
  }
2404
2423
  /**
2405
2424
  * Append data to a file
2406
2425
  */
2407
2426
  async appendFile(n, t, e) {
2408
- const r = s(n);
2427
+ const r = i(n);
2409
2428
  e || (e = typeof t != "string" || c(r) ? "binary" : "utf-8");
2410
- const i = typeof t == "string" ? h(t, e) : t instanceof Uint8Array ? t : new Uint8Array(t);
2411
- return this.#n.appendFile(r, i);
2429
+ const s = typeof t == "string" ? h(t, e) : t instanceof Uint8Array ? t : new Uint8Array(t);
2430
+ return this.#n.appendFile(r, s);
2412
2431
  }
2413
2432
  /**
2414
2433
  * Create a directory
2415
2434
  */
2416
2435
  async mkdir(n, t) {
2417
- const e = s(n);
2418
- return this.#n.mkdir(e, t);
2436
+ const e = i(n);
2437
+ let r;
2438
+ return typeof t == "number" ? r = { recursive: !1 } : r = t, this.#n.mkdir(e, r);
2419
2439
  }
2420
2440
  /**
2421
2441
  * Get file or directory statistics
2422
2442
  */
2423
2443
  async stat(n) {
2424
- const t = s(n);
2444
+ const t = i(n);
2425
2445
  return this.#n.stat(t);
2426
2446
  }
2427
2447
  /**
2428
2448
  * Read a directory's contents
2429
2449
  */
2430
2450
  async readDir(n) {
2431
- const t = s(n);
2451
+ const t = i(n);
2432
2452
  return this.#n.readDir(t);
2433
2453
  }
2434
2454
  /**
2435
2455
  * Check if a file or directory exists
2436
2456
  */
2437
2457
  async exists(n) {
2438
- const t = s(n);
2458
+ const t = i(n);
2439
2459
  return this.#n.exists(t);
2440
2460
  }
2441
2461
  /**
2442
2462
  * Clear all contents of a directory without removing the directory itself
2443
2463
  */
2444
2464
  async clear(n) {
2445
- const t = n ? s(n) : void 0;
2465
+ const t = n ? i(n) : void 0;
2446
2466
  return this.#n.clear(t);
2447
2467
  }
2448
2468
  /**
2449
2469
  * Remove files and directories
2450
2470
  */
2451
2471
  async remove(n, t) {
2452
- const e = s(n);
2472
+ const e = i(n);
2453
2473
  return this.#n.remove(e, t);
2454
2474
  }
2475
+ /**
2476
+ * Alias for remove() for NodeJS like API compatibility
2477
+ */
2478
+ async unlink(n) {
2479
+ return this.remove(n);
2480
+ }
2481
+ /**
2482
+ * Alias for remove() for NodeJS like API compatibility
2483
+ */
2484
+ async rm(n, t) {
2485
+ return this.remove(n, t);
2486
+ }
2487
+ /**
2488
+ * Alias for remove() for NodeJS like API compatibility
2489
+ */
2490
+ async rmdir(n) {
2491
+ return this.remove(n);
2492
+ }
2493
+ /**
2494
+ * Alias for readDir() for NodeJS like API compatibility
2495
+ */
2496
+ async readdir(n, t) {
2497
+ return this.readDir(n);
2498
+ }
2499
+ /**
2500
+ * Alias for stat() for NodeJS like API compatibility
2501
+ */
2502
+ async lstat(n) {
2503
+ return this.stat(n);
2504
+ }
2505
+ /**
2506
+ * Note: OPFS doesn't support file modes, so this is a no-op and exists only for compatibility with tools like isomorphic-git
2507
+ */
2508
+ async chmod(n, t) {
2509
+ return Promise.resolve();
2510
+ }
2455
2511
  /**
2456
2512
  * Resolve a path to an absolute path
2457
2513
  */
2458
2514
  async realpath(n) {
2459
- const t = s(n);
2515
+ const t = i(n);
2460
2516
  return this.#n.realpath(t);
2461
2517
  }
2462
2518
  /**
2463
2519
  * Rename a file or directory
2464
2520
  */
2465
2521
  async rename(n, t, e) {
2466
- const r = s(n), i = s(t);
2467
- return this.#n.rename(r, i, e);
2522
+ const r = i(n), s = i(t);
2523
+ return this.#n.rename(r, s, e);
2468
2524
  }
2469
2525
  /**
2470
2526
  * Copy files and directories
2471
2527
  */
2472
2528
  async copy(n, t, e) {
2473
- const r = s(n), i = s(t);
2474
- return this.#n.copy(r, i, e);
2475
- }
2476
- /**
2477
- * Start watching a file or directory for changes
2478
- */
2479
- watch(n, t) {
2480
- const e = s(n);
2481
- return this.#n.watch(e, t), () => this.unwatch(e);
2482
- }
2483
- /**
2484
- * Stop watching a previously watched path
2485
- */
2486
- unwatch(n) {
2487
- const t = s(n);
2488
- this.#n.unwatch(t);
2529
+ const r = i(n), s = i(t);
2530
+ return this.#n.copy(r, s, e);
2489
2531
  }
2490
2532
  /**
2491
2533
  * Open a file and return a file descriptor
2492
2534
  */
2493
2535
  async open(n, t) {
2494
- const e = s(n);
2536
+ const e = i(n);
2495
2537
  return this.#n.open(e, t);
2496
2538
  }
2497
2539
  /**
@@ -2507,22 +2549,22 @@ class w {
2507
2549
  * The buffer is transferred to the worker and back, so the original buffer
2508
2550
  * becomes unusable after the call.
2509
2551
  */
2510
- async read(n, t, e, r, i) {
2552
+ async read(n, t, e, r, s) {
2511
2553
  const { bytesRead: o, buffer: d } = await this.#n.read(
2512
2554
  n,
2513
2555
  // Temp buffer to preserve the original buffer
2514
2556
  new Uint8Array(r),
2515
2557
  0,
2516
2558
  r,
2517
- i
2559
+ s
2518
2560
  );
2519
2561
  return o > 0 && t.set(d.subarray(0, o), e), { bytesRead: o, buffer: t };
2520
2562
  }
2521
2563
  /**
2522
2564
  * Write data to a file descriptor
2523
2565
  */
2524
- async write(n, t, e, r, i, o) {
2525
- return this.#n.write(n, t, e, r, i, o);
2566
+ async write(n, t, e, r, s, o) {
2567
+ return this.#n.write(n, t, e, r, s, o);
2526
2568
  }
2527
2569
  /**
2528
2570
  * Get file status information by file descriptor
@@ -2551,30 +2593,30 @@ class w {
2551
2593
  /**
2552
2594
  * Synchronize the file system with external data
2553
2595
  */
2554
- async sync(n, t) {
2555
- const e = n.map(([r, i]) => [s(r), i]);
2556
- return this.#n.sync(e, t);
2596
+ async createIndex(n) {
2597
+ const t = n.map(([e, r]) => [i(e), r]);
2598
+ return this.#n.createIndex(t);
2557
2599
  }
2558
2600
  /**
2559
2601
  * Read a file as text with automatic encoding detection
2560
2602
  */
2561
2603
  async readText(n, t = "utf-8") {
2562
- const e = s(n), r = await this.#n.readFile(e);
2604
+ const e = i(n), r = await this.#n.readFile(e);
2563
2605
  return l(r, t);
2564
2606
  }
2565
2607
  /**
2566
2608
  * Write text to a file with specified encoding
2567
2609
  */
2568
2610
  async writeText(n, t, e = "utf-8") {
2569
- const r = s(n), i = h(t, e);
2570
- return this.#n.writeFile(r, i);
2611
+ const r = i(n), s = h(t, e);
2612
+ return this.#n.writeFile(r, s);
2571
2613
  }
2572
2614
  /**
2573
2615
  * Append text to a file with specified encoding
2574
2616
  */
2575
2617
  async appendText(n, t, e = "utf-8") {
2576
- const r = s(n), i = h(t, e);
2577
- return this.#n.appendFile(r, i);
2618
+ const r = i(n), s = h(t, e);
2619
+ return this.#n.appendFile(r, s);
2578
2620
  }
2579
2621
  }
2580
2622
  function b(a) {
@@ -2592,32 +2634,33 @@ export {
2592
2634
  I as PermissionError,
2593
2635
  R as StorageError,
2594
2636
  $ as TimeoutError,
2595
- C as basename,
2596
- _ as buffersEqual,
2597
- N as calculateFileHash,
2598
- D as calculateReadLength,
2599
- z as checkOPFSSupport,
2600
- k as convertBlobToUint8Array,
2601
- M as createBuffer,
2637
+ C as WatchEventType,
2638
+ _ as basename,
2639
+ N as buffersEqual,
2640
+ D as calculateFileHash,
2641
+ z as calculateReadLength,
2642
+ k as checkOPFSSupport,
2643
+ M as convertBlobToUint8Array,
2644
+ j as createBuffer,
2602
2645
  L as createFDError,
2603
- j as createSyncHandleSafe,
2646
+ W as createSyncHandleSafe,
2604
2647
  b as createWorker,
2605
2648
  l as decodeBuffer,
2606
- W as dirname,
2649
+ U as dirname,
2607
2650
  h as encodeString,
2608
- U as extname,
2651
+ H as extname,
2609
2652
  c as isBinaryFileExtension,
2610
- H as isPathExcluded,
2611
- B as joinPath,
2612
- G as mapDomError,
2613
- q as matchMinimatch,
2614
- V as normalizeMinimatch,
2615
- Y as normalizePath,
2616
- X as removeEntry,
2617
- Z as resolvePath,
2618
- J as safeCloseSyncHandle,
2619
- K as splitPath,
2620
- Q as validateReadWriteArgs,
2621
- nn as withLock
2653
+ B as isPathExcluded,
2654
+ G as joinPath,
2655
+ q as mapDomError,
2656
+ V as matchMinimatch,
2657
+ Y as normalizeMinimatch,
2658
+ X as normalizePath,
2659
+ Z as removeEntry,
2660
+ J as resolvePath,
2661
+ K as safeCloseSyncHandle,
2662
+ Q as splitPath,
2663
+ nn as validateReadWriteArgs,
2664
+ tn as withLock
2622
2665
  };
2623
2666
  //# sourceMappingURL=index.js.map