opfs-worker 0.5.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
1
  import { wrap as i } from "comlink";
2
- import { D as p, F as f, O as d, b as u, a as g, P as m, c as w, S as y, T as b, e as v, q as S, p as x, d as E, t as P, k as A, x as F, f as O, v as C, h as T, i as R, j as $, m as _, g as D, n as I, l as M, u as j, r as N, s as k, w as L, o as U } from "./helpers-Bm2TWyPQ.js";
2
+ import { B as p, D as f, F as d, O as u, b as g, a as m, P as w, c as y, S as b, T as v, e as x, t as S, q as E, d as P, u as A, l as F, y as O, f as C, x as T, k as R, i as $, h as _, j as D, m as I, g as j, n as N, o as M, v as k, r as L, s as z, w as W, p as U } from "./helpers-CTCvNFs1.js";
3
3
  const r = `/**
4
4
  * @license
5
5
  * Copyright 2019 Google LLC
6
6
  * SPDX-License-Identifier: Apache-2.0
7
7
  */
8
- const ht = Symbol("Comlink.proxy"), Dt = Symbol("Comlink.endpoint"), Ot = Symbol("Comlink.releaseProxy"), U = Symbol("Comlink.finalizer"), L = Symbol("Comlink.thrown"), ut = (s) => typeof s == "object" && s !== null || typeof s == "function", Nt = {
9
- canHandle: (s) => ut(s) && s[ht],
8
+ const ut = Symbol("Comlink.proxy"), Dt = Symbol("Comlink.endpoint"), Nt = Symbol("Comlink.releaseProxy"), U = Symbol("Comlink.finalizer"), L = Symbol("Comlink.thrown"), ft = (s) => typeof s == "object" && s !== null || typeof s == "function", Tt = {
9
+ canHandle: (s) => ft(s) && s[ut],
10
10
  serialize(s) {
11
11
  const { port1: t, port2: e } = new MessageChannel();
12
- return Y(s, t), [e, [e]];
12
+ return J(s, t), [e, [e]];
13
13
  },
14
14
  deserialize(s) {
15
- return s.start(), $t(s);
15
+ return s.start(), Pt(s);
16
16
  }
17
17
  }, Ft = {
18
- canHandle: (s) => ut(s) && L in s,
18
+ canHandle: (s) => ft(s) && L in s,
19
19
  serialize({ value: s }) {
20
20
  let t;
21
21
  return s instanceof Error ? t = {
@@ -30,21 +30,21 @@ const ht = Symbol("Comlink.proxy"), Dt = Symbol("Comlink.endpoint"), Ot = Symbol
30
30
  deserialize(s) {
31
31
  throw s.isError ? Object.assign(new Error(s.value.message), s.value) : s.value;
32
32
  }
33
- }, ft = /* @__PURE__ */ new Map([
34
- ["proxy", Nt],
33
+ }, dt = /* @__PURE__ */ new Map([
34
+ ["proxy", Tt],
35
35
  ["throw", Ft]
36
36
  ]);
37
- function Tt(s, t) {
37
+ function Mt(s, t) {
38
38
  for (const e of s)
39
39
  if (t === e || e === "*" || e instanceof RegExp && e.test(t))
40
40
  return !0;
41
41
  return !1;
42
42
  }
43
- function Y(s, t = globalThis, e = ["*"]) {
43
+ function J(s, t = globalThis, e = ["*"]) {
44
44
  t.addEventListener("message", function n(i) {
45
45
  if (!i || !i.data)
46
46
  return;
47
- if (!Tt(e, i.origin)) {
47
+ if (!Mt(e, i.origin)) {
48
48
  console.warn(\`Invalid origin '\${i.origin}' for comlink proxy\`);
49
49
  return;
50
50
  }
@@ -65,13 +65,13 @@ function Y(s, t = globalThis, e = ["*"]) {
65
65
  case "CONSTRUCT":
66
66
  {
67
67
  const u = new f(...l);
68
- h = It(u);
68
+ h = zt(u);
69
69
  }
70
70
  break;
71
71
  case "ENDPOINT":
72
72
  {
73
73
  const { port1: u, port2: d } = new MessageChannel();
74
- Y(s, d), h = Lt(u, [u]);
74
+ J(s, d), h = It(u, [u]);
75
75
  }
76
76
  break;
77
77
  case "RELEASE":
@@ -85,7 +85,7 @@ function Y(s, t = globalThis, e = ["*"]) {
85
85
  }
86
86
  Promise.resolve(h).catch((c) => ({ value: c, [L]: 0 })).then((c) => {
87
87
  const [f, u] = H(c);
88
- t.postMessage(Object.assign(Object.assign({}, f), { id: r }), u), o === "RELEASE" && (t.removeEventListener("message", n), dt(t), U in s && typeof s[U] == "function" && s[U]());
88
+ t.postMessage(Object.assign(Object.assign({}, f), { id: r }), u), o === "RELEASE" && (t.removeEventListener("message", n), pt(t), U in s && typeof s[U] == "function" && s[U]());
89
89
  }).catch((c) => {
90
90
  const [f, u] = H({
91
91
  value: new TypeError("Unserializable return value"),
@@ -95,13 +95,13 @@ function Y(s, t = globalThis, e = ["*"]) {
95
95
  });
96
96
  }), t.start && t.start();
97
97
  }
98
- function Mt(s) {
98
+ function $t(s) {
99
99
  return s.constructor.name === "MessagePort";
100
100
  }
101
- function dt(s) {
102
- Mt(s) && s.close();
101
+ function pt(s) {
102
+ $t(s) && s.close();
103
103
  }
104
- function $t(s, t) {
104
+ function Pt(s, t) {
105
105
  const e = /* @__PURE__ */ new Map();
106
106
  return s.addEventListener("message", function(i) {
107
107
  const { data: r } = i;
@@ -114,54 +114,54 @@ function $t(s, t) {
114
114
  } finally {
115
115
  e.delete(r.id);
116
116
  }
117
- }), V(s, e, [], t);
117
+ }), X(s, e, [], t);
118
118
  }
119
119
  function R(s) {
120
120
  if (s)
121
121
  throw new Error("Proxy has been released and is not useable");
122
122
  }
123
- function pt(s) {
124
- return D(s, /* @__PURE__ */ new Map(), {
123
+ function gt(s) {
124
+ return O(s, /* @__PURE__ */ new Map(), {
125
125
  type: "RELEASE"
126
126
  }).then(() => {
127
- dt(s);
127
+ pt(s);
128
128
  });
129
129
  }
130
130
  const I = /* @__PURE__ */ new WeakMap(), z = "FinalizationRegistry" in globalThis && new FinalizationRegistry((s) => {
131
131
  const t = (I.get(s) || 0) - 1;
132
- I.set(s, t), t === 0 && pt(s);
132
+ I.set(s, t), t === 0 && gt(s);
133
133
  });
134
- function Pt(s, t) {
134
+ function Rt(s, t) {
135
135
  const e = (I.get(t) || 0) + 1;
136
136
  I.set(t, e), z && z.register(s, t, s);
137
137
  }
138
- function Rt(s) {
138
+ function kt(s) {
139
139
  z && z.unregister(s);
140
140
  }
141
- function V(s, t, e = [], n = function() {
141
+ function X(s, t, e = [], n = function() {
142
142
  }) {
143
143
  let i = !1;
144
144
  const r = new Proxy(n, {
145
145
  get(o, a) {
146
- if (R(i), a === Ot)
146
+ if (R(i), a === Nt)
147
147
  return () => {
148
- Rt(r), pt(s), t.clear(), i = !0;
148
+ kt(r), gt(s), t.clear(), i = !0;
149
149
  };
150
150
  if (a === "then") {
151
151
  if (e.length === 0)
152
152
  return { then: () => r };
153
- const l = D(s, t, {
153
+ const l = O(s, t, {
154
154
  type: "GET",
155
155
  path: e.map((h) => h.toString())
156
156
  }).then(C);
157
157
  return l.then.bind(l);
158
158
  }
159
- return V(s, t, [...e, a]);
159
+ return X(s, t, [...e, a]);
160
160
  },
161
161
  set(o, a, l) {
162
162
  R(i);
163
163
  const [h, c] = H(l);
164
- return D(s, t, {
164
+ return O(s, t, {
165
165
  type: "SET",
166
166
  path: [...e, a].map((f) => f.toString()),
167
167
  value: h
@@ -171,13 +171,13 @@ function V(s, t, e = [], n = function() {
171
171
  R(i);
172
172
  const h = e[e.length - 1];
173
173
  if (h === Dt)
174
- return D(s, t, {
174
+ return O(s, t, {
175
175
  type: "ENDPOINT"
176
176
  }).then(C);
177
177
  if (h === "bind")
178
- return V(s, t, e.slice(0, -1));
179
- const [c, f] = et(l);
180
- return D(s, t, {
178
+ return X(s, t, e.slice(0, -1));
179
+ const [c, f] = st(l);
180
+ return O(s, t, {
181
181
  type: "APPLY",
182
182
  path: e.map((u) => u.toString()),
183
183
  argumentList: c
@@ -185,32 +185,32 @@ function V(s, t, e = [], n = function() {
185
185
  },
186
186
  construct(o, a) {
187
187
  R(i);
188
- const [l, h] = et(a);
189
- return D(s, t, {
188
+ const [l, h] = st(a);
189
+ return O(s, t, {
190
190
  type: "CONSTRUCT",
191
191
  path: e.map((c) => c.toString()),
192
192
  argumentList: l
193
193
  }, h).then(C);
194
194
  }
195
195
  });
196
- return Pt(r, s), r;
196
+ return Rt(r, s), r;
197
197
  }
198
- function kt(s) {
198
+ function Lt(s) {
199
199
  return Array.prototype.concat.apply([], s);
200
200
  }
201
- function et(s) {
201
+ function st(s) {
202
202
  const t = s.map(H);
203
- return [t.map((e) => e[0]), kt(t.map((e) => e[1]))];
203
+ return [t.map((e) => e[0]), Lt(t.map((e) => e[1]))];
204
204
  }
205
- const gt = /* @__PURE__ */ new WeakMap();
206
- function Lt(s, t) {
207
- return gt.set(s, t), s;
205
+ const mt = /* @__PURE__ */ new WeakMap();
206
+ function It(s, t) {
207
+ return mt.set(s, t), s;
208
208
  }
209
- function It(s) {
210
- return Object.assign(s, { [ht]: !0 });
209
+ function zt(s) {
210
+ return Object.assign(s, { [ut]: !0 });
211
211
  }
212
212
  function H(s) {
213
- for (const [t, e] of ft)
213
+ for (const [t, e] of dt)
214
214
  if (e.canHandle(s)) {
215
215
  const [n, i] = e.serialize(s);
216
216
  return [
@@ -227,24 +227,24 @@ function H(s) {
227
227
  type: "RAW",
228
228
  value: s
229
229
  },
230
- gt.get(s) || []
230
+ mt.get(s) || []
231
231
  ];
232
232
  }
233
233
  function C(s) {
234
234
  switch (s.type) {
235
235
  case "HANDLER":
236
- return ft.get(s.name).deserialize(s.value);
236
+ return dt.get(s.name).deserialize(s.value);
237
237
  case "RAW":
238
238
  return s.value;
239
239
  }
240
240
  }
241
- function D(s, t, e, n) {
241
+ function O(s, t, e, n) {
242
242
  return new Promise((i) => {
243
- const r = zt();
243
+ const r = Ht();
244
244
  t.set(r, i), s.start && s.start(), s.postMessage(Object.assign({ id: r }, e), n);
245
245
  });
246
246
  }
247
- function zt() {
247
+ function Ht() {
248
248
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
249
249
  }
250
250
  class g extends Error {
@@ -252,12 +252,12 @@ class g extends Error {
252
252
  super(t, { cause: i }), this.code = e, this.path = n, this.name = "OPFSError";
253
253
  }
254
254
  }
255
- class Ht extends g {
255
+ class Wt extends g {
256
256
  constructor(t) {
257
257
  super("OPFS is not supported in this browser", "OPFS_NOT_SUPPORTED", void 0, t);
258
258
  }
259
259
  }
260
- class Wt extends g {
260
+ class jt extends g {
261
261
  constructor(t, e, n) {
262
262
  super(t, "INVALID_PATH", e, n);
263
263
  }
@@ -267,7 +267,7 @@ class _ extends g {
267
267
  super(\`File not found: \${t}\`, "FILE_NOT_FOUND", t, e);
268
268
  }
269
269
  }
270
- function jt(s, t = "utf-8") {
270
+ function Ut(s, t = "utf-8") {
271
271
  switch (t) {
272
272
  case "utf8":
273
273
  case "utf-8":
@@ -275,11 +275,11 @@ function jt(s, t = "utf-8") {
275
275
  case "utf16le":
276
276
  case "ucs2":
277
277
  case "ucs-2":
278
- return _t(s);
278
+ return Bt(s);
279
279
  case "ascii":
280
- return qt(s);
280
+ return Vt(s);
281
281
  case "latin1":
282
- return Gt(s);
282
+ return qt(s);
283
283
  case "binary":
284
284
  return Uint8Array.from(s, (e) => e.charCodeAt(0));
285
285
  case "base64":
@@ -292,19 +292,18 @@ function jt(s, t = "utf-8") {
292
292
  return console.warn("Encoding not supported, falling back to UTF-8"), new TextEncoder().encode(s);
293
293
  }
294
294
  }
295
- function Ut(s, t = "utf-8") {
295
+ function _t(s, t = "utf-8") {
296
296
  switch (t) {
297
297
  case "utf8":
298
298
  case "utf-8":
299
299
  return new TextDecoder().decode(s);
300
300
  case "utf16le":
301
+ case "utf-16le":
301
302
  case "ucs2":
302
303
  case "ucs-2":
303
- return Bt(s);
304
+ return Gt(s);
304
305
  case "latin1":
305
306
  return String.fromCharCode(...s);
306
- case "binary":
307
- return String.fromCharCode(...s);
308
307
  case "ascii":
309
308
  return String.fromCharCode(...s.map((e) => e & 127));
310
309
  case "base64":
@@ -315,7 +314,7 @@ function Ut(s, t = "utf-8") {
315
314
  return console.warn("Unsupported encoding, falling back to UTF-8"), new TextDecoder().decode(s);
316
315
  }
317
316
  }
318
- function _t(s) {
317
+ function Bt(s) {
319
318
  const t = new Uint8Array(s.length * 2);
320
319
  for (let e = 0; e < s.length; e++) {
321
320
  const n = s.charCodeAt(e);
@@ -323,25 +322,25 @@ function _t(s) {
323
322
  }
324
323
  return t;
325
324
  }
326
- function Bt(s) {
325
+ function Gt(s) {
327
326
  s.length % 2 !== 0 && (console.warn("Invalid UTF-16LE buffer length, truncating last byte"), s = s.slice(0, s.length - 1));
328
327
  const t = new Uint16Array(s.buffer, s.byteOffset, s.byteLength / 2);
329
328
  return String.fromCharCode(...t);
330
329
  }
331
- function Gt(s) {
330
+ function qt(s) {
332
331
  const t = new Uint8Array(s.length);
333
332
  for (let e = 0; e < s.length; e++)
334
333
  t[e] = s.charCodeAt(e) & 255;
335
334
  return t;
336
335
  }
337
- function qt(s) {
336
+ function Vt(s) {
338
337
  const t = new Uint8Array(s.length);
339
338
  for (let e = 0; e < s.length; e++)
340
339
  t[e] = s.charCodeAt(e) & 127;
341
340
  return t;
342
341
  }
343
- const mt = (s, t, e) => {
344
- const n = s instanceof RegExp ? st(s, e) : s, i = t instanceof RegExp ? st(t, e) : t, r = n !== null && i != null && Vt(n, i, e);
342
+ const wt = (s, t, e) => {
343
+ const n = s instanceof RegExp ? nt(s, e) : s, i = t instanceof RegExp ? nt(t, e) : t, r = n !== null && i != null && Xt(n, i, e);
345
344
  return r && {
346
345
  start: r[0],
347
346
  end: r[1],
@@ -349,10 +348,10 @@ const mt = (s, t, e) => {
349
348
  body: e.slice(r[0] + n.length, r[1]),
350
349
  post: e.slice(r[1] + i.length)
351
350
  };
352
- }, st = (s, t) => {
351
+ }, nt = (s, t) => {
353
352
  const e = t.match(s);
354
353
  return e ? e[0] : null;
355
- }, Vt = (s, t, e) => {
354
+ }, Xt = (s, t, e) => {
356
355
  let n, i, r, o, a, l = e.indexOf(s), h = e.indexOf(t, l + 1), c = l;
357
356
  if (l >= 0 && h > 0) {
358
357
  if (s === t)
@@ -370,44 +369,44 @@ const mt = (s, t, e) => {
370
369
  n.length && o !== void 0 && (a = [r, o]);
371
370
  }
372
371
  return a;
373
- }, wt = "\\0SLASH" + Math.random() + "\\0", yt = "\\0OPEN" + Math.random() + "\\0", J = "\\0CLOSE" + Math.random() + "\\0", Et = "\\0COMMA" + Math.random() + "\\0", St = "\\0PERIOD" + Math.random() + "\\0", Zt = new RegExp(wt, "g"), Xt = new RegExp(yt, "g"), Yt = new RegExp(J, "g"), Jt = new RegExp(Et, "g"), Kt = new RegExp(St, "g"), Qt = /\\\\\\\\/g, te = /\\\\{/g, ee = /\\\\}/g, se = /\\\\,/g, ne = /\\\\./g;
372
+ }, yt = "\\0SLASH" + Math.random() + "\\0", Et = "\\0OPEN" + Math.random() + "\\0", K = "\\0CLOSE" + Math.random() + "\\0", St = "\\0COMMA" + Math.random() + "\\0", xt = "\\0PERIOD" + Math.random() + "\\0", Yt = new RegExp(yt, "g"), Zt = new RegExp(Et, "g"), Jt = new RegExp(K, "g"), Kt = new RegExp(St, "g"), Qt = new RegExp(xt, "g"), te = /\\\\\\\\/g, ee = /\\\\{/g, se = /\\\\}/g, ne = /\\\\,/g, ie = /\\\\./g;
374
373
  function B(s) {
375
374
  return isNaN(s) ? s.charCodeAt(0) : parseInt(s, 10);
376
375
  }
377
- function ie(s) {
378
- return s.replace(Qt, wt).replace(te, yt).replace(ee, J).replace(se, Et).replace(ne, St);
379
- }
380
376
  function re(s) {
381
- return s.replace(Zt, "\\\\").replace(Xt, "{").replace(Yt, "}").replace(Jt, ",").replace(Kt, ".");
377
+ return s.replace(te, yt).replace(ee, Et).replace(se, K).replace(ne, St).replace(ie, xt);
382
378
  }
383
- function xt(s) {
379
+ function oe(s) {
380
+ return s.replace(Yt, "\\\\").replace(Zt, "{").replace(Jt, "}").replace(Kt, ",").replace(Qt, ".");
381
+ }
382
+ function bt(s) {
384
383
  if (!s)
385
384
  return [""];
386
- const t = [], e = mt("{", "}", s);
385
+ const t = [], e = wt("{", "}", s);
387
386
  if (!e)
388
387
  return s.split(",");
389
388
  const { pre: n, body: i, post: r } = e, o = n.split(",");
390
389
  o[o.length - 1] += "{" + i + "}";
391
- const a = xt(r);
390
+ const a = bt(r);
392
391
  return r.length && (o[o.length - 1] += a.shift(), o.push.apply(o, a)), t.push.apply(t, o), t;
393
392
  }
394
- function oe(s) {
395
- return s ? (s.slice(0, 2) === "{}" && (s = "\\\\{\\\\}" + s.slice(2)), M(ie(s), !0).map(re)) : [];
396
- }
397
393
  function ae(s) {
398
- return "{" + s + "}";
394
+ return s ? (s.slice(0, 2) === "{}" && (s = "\\\\{\\\\}" + s.slice(2)), M(re(s), !0).map(oe)) : [];
399
395
  }
400
396
  function ce(s) {
397
+ return "{" + s + "}";
398
+ }
399
+ function le(s) {
401
400
  return /^-?0\\d/.test(s);
402
401
  }
403
- function le(s, t) {
402
+ function he(s, t) {
404
403
  return s <= t;
405
404
  }
406
- function he(s, t) {
405
+ function ue(s, t) {
407
406
  return s >= t;
408
407
  }
409
408
  function M(s, t) {
410
- const e = [], n = mt("{", "}", s);
409
+ const e = [], n = wt("{", "}", s);
411
410
  if (!n)
412
411
  return [s];
413
412
  const i = n.pre, r = n.post.length ? M(n.post, !1) : [""];
@@ -419,27 +418,27 @@ function M(s, t) {
419
418
  else {
420
419
  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;
421
420
  if (!l && !h)
422
- return n.post.match(/,(?!,).*\\}/) ? (s = n.pre + "{" + n.body + J + n.post, M(s)) : [s];
421
+ return n.post.match(/,(?!,).*\\}/) ? (s = n.pre + "{" + n.body + K + n.post, M(s)) : [s];
423
422
  let c;
424
423
  if (l)
425
424
  c = n.body.split(/\\.\\./);
426
- else if (c = xt(n.body), c.length === 1 && c[0] !== void 0 && (c = M(c[0], !1).map(ae), c.length === 1))
425
+ else if (c = bt(n.body), c.length === 1 && c[0] !== void 0 && (c = M(c[0], !1).map(ce), c.length === 1))
427
426
  return r.map((u) => n.pre + c[0] + u);
428
427
  let f;
429
428
  if (l && c[0] !== void 0 && c[1] !== void 0) {
430
429
  const u = B(c[0]), d = B(c[1]), m = Math.max(c[0].length, c[1].length);
431
- let p = c.length === 3 && c[2] !== void 0 ? Math.abs(B(c[2])) : 1, S = le;
432
- d < u && (p *= -1, S = he);
433
- const N = c.some(ce);
430
+ let p = c.length === 3 && c[2] !== void 0 ? Math.abs(B(c[2])) : 1, S = he;
431
+ d < u && (p *= -1, S = ue);
432
+ const N = c.some(le);
434
433
  f = [];
435
434
  for (let x = u; S(x, d); x += p) {
436
435
  let w;
437
436
  if (a)
438
437
  w = String.fromCharCode(x), w === "\\\\" && (w = "");
439
438
  else if (w = String(x), N) {
440
- const F = m - w.length;
441
- if (F > 0) {
442
- const P = new Array(F + 1).join("0");
439
+ const T = m - w.length;
440
+ if (T > 0) {
441
+ const P = new Array(T + 1).join("0");
443
442
  x < 0 ? w = "-" + P + w.slice(1) : w = P + w;
444
443
  }
445
444
  }
@@ -458,12 +457,12 @@ function M(s, t) {
458
457
  }
459
458
  return e;
460
459
  }
461
- const ue = 1024 * 64, W = (s) => {
460
+ const fe = 1024 * 64, W = (s) => {
462
461
  if (typeof s != "string")
463
462
  throw new TypeError("invalid pattern");
464
- if (s.length > ue)
463
+ if (s.length > fe)
465
464
  throw new TypeError("pattern is too long");
466
- }, fe = {
465
+ }, de = {
467
466
  "[:alnum:]": ["\\\\p{L}\\\\p{Nl}\\\\p{Nd}", !0],
468
467
  "[:alpha:]": ["\\\\p{L}\\\\p{Nl}", !0],
469
468
  "[:ascii:]": ["\\\\x00-\\\\x7f", !1],
@@ -478,7 +477,7 @@ const ue = 1024 * 64, W = (s) => {
478
477
  "[:upper:]": ["\\\\p{Lu}", !0],
479
478
  "[:word:]": ["\\\\p{L}\\\\p{Nl}\\\\p{Nd}\\\\p{Pc}", !0],
480
479
  "[:xdigit:]": ["A-Fa-f0-9", !1]
481
- }, T = (s) => s.replace(/[[\\]\\\\-]/g, "\\\\$&"), de = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), nt = (s) => s.join(""), pe = (s, t) => {
480
+ }, F = (s) => s.replace(/[[\\]\\\\-]/g, "\\\\$&"), pe = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), it = (s) => s.join(""), ge = (s, t) => {
482
481
  const e = t;
483
482
  if (s.charAt(e) !== "[")
484
483
  throw new Error("not in a brace expression");
@@ -499,27 +498,27 @@ const ue = 1024 * 64, W = (s) => {
499
498
  continue;
500
499
  }
501
500
  if (p === "[" && !l) {
502
- for (const [S, [v, N, x]] of Object.entries(fe))
501
+ for (const [S, [A, N, x]] of Object.entries(de))
503
502
  if (s.startsWith(S, r)) {
504
503
  if (f)
505
504
  return ["$.", !1, s.length - e, !0];
506
- r += S.length, x ? i.push(v) : n.push(v), a = a || N;
505
+ r += S.length, x ? i.push(A) : n.push(A), a = a || N;
507
506
  continue t;
508
507
  }
509
508
  }
510
509
  if (l = !1, f) {
511
- p > f ? n.push(T(f) + "-" + T(p)) : p === f && n.push(T(p)), f = "", r++;
510
+ p > f ? n.push(F(f) + "-" + F(p)) : p === f && n.push(F(p)), f = "", r++;
512
511
  continue;
513
512
  }
514
513
  if (s.startsWith("-]", r + 1)) {
515
- n.push(T(p + "-")), r += 2;
514
+ n.push(F(p + "-")), r += 2;
516
515
  continue;
517
516
  }
518
517
  if (s.startsWith("-", r + 1)) {
519
518
  f = p, r += 2;
520
519
  continue;
521
520
  }
522
- n.push(T(p)), r++;
521
+ n.push(F(p)), r++;
523
522
  }
524
523
  if (c < r)
525
524
  return ["", !1, 0, !1];
@@ -527,11 +526,11 @@ const ue = 1024 * 64, W = (s) => {
527
526
  return ["$.", !1, s.length - e, !0];
528
527
  if (i.length === 0 && n.length === 1 && /^\\\\?.$/.test(n[0]) && !h) {
529
528
  const p = n[0].length === 2 ? n[0].slice(-1) : n[0];
530
- return [de(p), !1, c - e, !1];
529
+ return [pe(p), !1, c - e, !1];
531
530
  }
532
- const u = "[" + (h ? "^" : "") + nt(n) + "]", d = "[" + (h ? "" : "^") + nt(i) + "]";
531
+ const u = "[" + (h ? "^" : "") + it(n) + "]", d = "[" + (h ? "" : "^") + it(i) + "]";
533
532
  return [n.length && i.length ? "(" + u + "|" + d + ")" : n.length ? u : d, a, c - e, !0];
534
- }, $ = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\\[([^\\/\\\\])\\]/g, "$1") : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, "$1$2").replace(/\\\\([^\\/])/g, "$1"), ge = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), it = (s) => ge.has(s), me = "(?!(?:^|/)\\\\.\\\\.?(?:$|/))", k = "(?!\\\\.)", we = /* @__PURE__ */ new Set(["[", "."]), ye = /* @__PURE__ */ new Set(["..", "."]), Ee = new Set("().*{}+?[]^$\\\\!"), Se = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), K = "[^/]", rt = K + "*?", ot = K + "+?";
533
+ }, $ = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/\\[([^\\/\\\\])\\]/g, "$1") : s.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, "$1$2").replace(/\\\\([^\\/])/g, "$1"), me = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), rt = (s) => me.has(s), we = "(?!(?:^|/)\\\\.\\\\.?(?:$|/))", k = "(?!\\\\.)", ye = /* @__PURE__ */ new Set(["[", "."]), Ee = /* @__PURE__ */ new Set(["..", "."]), Se = new Set("().*{}+?[]^$\\\\!"), xe = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), Q = "[^/]", ot = Q + "*?", at = Q + "+?";
535
534
  class E {
536
535
  type;
537
536
  #s;
@@ -648,7 +647,7 @@ class E {
648
647
  o = !0, a = d, l = !1, m += p;
649
648
  continue;
650
649
  }
651
- if (!i.noext && it(p) && t.charAt(d) === "(") {
650
+ if (!i.noext && rt(p) && t.charAt(d) === "(") {
652
651
  e.push(m), m = "";
653
652
  const S = new E(p, e);
654
653
  d = E.#h(t, S, d, i), e.push(S);
@@ -674,7 +673,7 @@ class E {
674
673
  o = !0, a = h, l = !1, u += d;
675
674
  continue;
676
675
  }
677
- if (it(d) && t.charAt(h) === "(") {
676
+ if (rt(d) && t.charAt(h) === "(") {
678
677
  c.push(u), u = "";
679
678
  const m = new E(d, c);
680
679
  c.push(m), h = E.#h(t, m, h, i);
@@ -784,18 +783,18 @@ class E {
784
783
  const e = t ?? !!this.#i.dot;
785
784
  if (this.#s === this && this.#d(), !this.type) {
786
785
  const l = this.isStart() && this.isEnd(), h = this.#t.map((d) => {
787
- const [m, p, S, v] = typeof d == "string" ? E.#p(d, this.#n, l) : d.toRegExpSource(t);
788
- return this.#n = this.#n || S, this.#r = this.#r || v, m;
786
+ const [m, p, S, A] = typeof d == "string" ? E.#p(d, this.#n, l) : d.toRegExpSource(t);
787
+ return this.#n = this.#n || S, this.#r = this.#r || A, m;
789
788
  }).join("");
790
789
  let c = "";
791
- if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && ye.has(this.#t[0]))) {
792
- const m = we, p = (
790
+ if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && Ee.has(this.#t[0]))) {
791
+ const m = ye, p = (
793
792
  // dots are allowed, and the pattern starts with [ or .
794
793
  e && m.has(h.charAt(0)) || // the pattern starts with \\., and then [ or .
795
794
  h.startsWith("\\\\.") && m.has(h.charAt(2)) || // the pattern starts with \\.\\., and then [ or .
796
795
  h.startsWith("\\\\.\\\\.") && m.has(h.charAt(4))
797
796
  ), S = !e && !t && m.has(h.charAt(0));
798
- c = p ? me : S ? k : "";
797
+ c = p ? we : S ? k : "";
799
798
  }
800
799
  let f = "";
801
800
  return this.isEnd() && this.#s.#a && this.#e?.type === "!" && (f = "(?:$|\\\\/)"), [
@@ -815,11 +814,11 @@ class E {
815
814
  o === r && (o = ""), o && (r = \`(?:\${r})(?:\${o})*?\`);
816
815
  let a = "";
817
816
  if (this.type === "!" && this.#u)
818
- a = (this.isStart() && !e ? k : "") + ot;
817
+ a = (this.isStart() && !e ? k : "") + at;
819
818
  else {
820
819
  const l = this.type === "!" ? (
821
820
  // !() must match something,but !(x) can match ''
822
- "))" + (this.isStart() && !e && !t ? k : "") + rt + ")"
821
+ "))" + (this.isStart() && !e && !t ? k : "") + ot + ")"
823
822
  ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : \`)\${this.type}\`;
824
823
  a = i + r + l;
825
824
  }
@@ -843,7 +842,7 @@ class E {
843
842
  for (let a = 0; a < t.length; a++) {
844
843
  const l = t.charAt(a);
845
844
  if (i) {
846
- i = !1, r += (Ee.has(l) ? "\\\\" : "") + l;
845
+ i = !1, r += (Se.has(l) ? "\\\\" : "") + l;
847
846
  continue;
848
847
  }
849
848
  if (l === "\\\\") {
@@ -851,53 +850,53 @@ class E {
851
850
  continue;
852
851
  }
853
852
  if (l === "[") {
854
- const [h, c, f, u] = pe(t, a);
853
+ const [h, c, f, u] = ge(t, a);
855
854
  if (f) {
856
855
  r += h, o = o || c, a += f - 1, e = e || u;
857
856
  continue;
858
857
  }
859
858
  }
860
859
  if (l === "*") {
861
- n && t === "*" ? r += ot : r += rt, e = !0;
860
+ n && t === "*" ? r += at : r += ot, e = !0;
862
861
  continue;
863
862
  }
864
863
  if (l === "?") {
865
- r += K, e = !0;
864
+ r += Q, e = !0;
866
865
  continue;
867
866
  }
868
- r += Se(l);
867
+ r += xe(l);
869
868
  }
870
869
  return [r, $(t), !!e, o];
871
870
  }
872
871
  }
873
- const xe = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\\]]/g, "[$&]") : s.replace(/[?*()[\\]\\\\]/g, "\\\\$&"), y = (s, t, e = {}) => (W(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new j(t, e).match(s)), be = /^\\*+([^+@!?\\*\\[\\(]*)$/, Ae = (s) => (t) => !t.startsWith(".") && t.endsWith(s), ve = (s) => (t) => t.endsWith(s), Ce = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), De = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), Oe = /^\\*+\\.\\*+$/, Ne = (s) => !s.startsWith(".") && s.includes("."), Fe = (s) => s !== "." && s !== ".." && s.includes("."), Te = /^\\.\\*+$/, Me = (s) => s !== "." && s !== ".." && s.startsWith("."), $e = /^\\*+$/, Pe = (s) => s.length !== 0 && !s.startsWith("."), Re = (s) => s.length !== 0 && s !== "." && s !== "..", ke = /^\\?+([^+@!?\\*\\[\\(]*)?$/, Le = ([s, t = ""]) => {
874
- const e = bt([s]);
872
+ const be = (s, { windowsPathsNoEscape: t = !1 } = {}) => t ? s.replace(/[?*()[\\]]/g, "[$&]") : s.replace(/[?*()[\\]\\\\]/g, "\\\\$&"), y = (s, t, e = {}) => (W(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new j(t, e).match(s)), ve = /^\\*+([^+@!?\\*\\[\\(]*)$/, Ae = (s) => (t) => !t.startsWith(".") && t.endsWith(s), Ce = (s) => (t) => t.endsWith(s), Oe = (s) => (s = s.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(s)), De = (s) => (s = s.toLowerCase(), (t) => t.toLowerCase().endsWith(s)), Ne = /^\\*+\\.\\*+$/, Te = (s) => !s.startsWith(".") && s.includes("."), Fe = (s) => s !== "." && s !== ".." && s.includes("."), Me = /^\\.\\*+$/, $e = (s) => s !== "." && s !== ".." && s.startsWith("."), Pe = /^\\*+$/, Re = (s) => s.length !== 0 && !s.startsWith("."), ke = (s) => s.length !== 0 && s !== "." && s !== "..", Le = /^\\?+([^+@!?\\*\\[\\(]*)?$/, Ie = ([s, t = ""]) => {
873
+ const e = vt([s]);
875
874
  return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
876
- }, Ie = ([s, t = ""]) => {
875
+ }, ze = ([s, t = ""]) => {
877
876
  const e = At([s]);
878
877
  return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
879
- }, ze = ([s, t = ""]) => {
878
+ }, He = ([s, t = ""]) => {
880
879
  const e = At([s]);
881
880
  return t ? (n) => e(n) && n.endsWith(t) : e;
882
- }, He = ([s, t = ""]) => {
883
- const e = bt([s]);
881
+ }, We = ([s, t = ""]) => {
882
+ const e = vt([s]);
884
883
  return t ? (n) => e(n) && n.endsWith(t) : e;
885
- }, bt = ([s]) => {
884
+ }, vt = ([s]) => {
886
885
  const t = s.length;
887
886
  return (e) => e.length === t && !e.startsWith(".");
888
887
  }, At = ([s]) => {
889
888
  const t = s.length;
890
889
  return (e) => e.length === t && e !== "." && e !== "..";
891
- }, vt = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", at = {
890
+ }, Ct = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", ct = {
892
891
  win32: { sep: "\\\\" },
893
892
  posix: { sep: "/" }
894
- }, We = vt === "win32" ? at.win32.sep : at.posix.sep;
895
- y.sep = We;
896
- const A = Symbol("globstar **");
897
- y.GLOBSTAR = A;
898
- const je = "[^/]", Ue = je + "*?", _e = "(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?", Be = "(?:(?!(?:\\\\/|^)\\\\.).)*?", Ge = (s, t = {}) => (e) => y(e, s, t);
899
- y.filter = Ge;
900
- const b = (s, t = {}) => Object.assign({}, s, t), qe = (s) => {
893
+ }, je = Ct === "win32" ? ct.win32.sep : ct.posix.sep;
894
+ y.sep = je;
895
+ const v = Symbol("globstar **");
896
+ y.GLOBSTAR = v;
897
+ const Ue = "[^/]", _e = Ue + "*?", Be = "(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?", Ge = "(?:(?!(?:\\\\/|^)\\\\.).)*?", qe = (s, t = {}) => (e) => y(e, s, t);
898
+ y.filter = qe;
899
+ const b = (s, t = {}) => Object.assign({}, s, t), Ve = (s) => {
901
900
  if (!s || typeof s != "object" || !Object.keys(s).length)
902
901
  return y;
903
902
  const t = y;
@@ -928,20 +927,20 @@ const b = (s, t = {}) => Object.assign({}, s, t), qe = (s) => {
928
927
  braceExpand: (n, i = {}) => t.braceExpand(n, b(s, i)),
929
928
  match: (n, i, r = {}) => t.match(n, i, b(s, r)),
930
929
  sep: t.sep,
931
- GLOBSTAR: A
930
+ GLOBSTAR: v
932
931
  });
933
932
  };
934
- y.defaults = qe;
935
- const Ct = (s, t = {}) => (W(s), t.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(s) ? [s] : oe(s));
936
- y.braceExpand = Ct;
937
- const Ve = (s, t = {}) => new j(s, t).makeRe();
938
- y.makeRe = Ve;
939
- const Ze = (s, t, e = {}) => {
933
+ y.defaults = Ve;
934
+ const Ot = (s, t = {}) => (W(s), t.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(s) ? [s] : ae(s));
935
+ y.braceExpand = Ot;
936
+ const Xe = (s, t = {}) => new j(s, t).makeRe();
937
+ y.makeRe = Xe;
938
+ const Ye = (s, t, e = {}) => {
940
939
  const n = new j(t, e);
941
940
  return s = s.filter((i) => n.match(i)), n.options.nonull && !s.length && s.push(t), s;
942
941
  };
943
- y.match = Ze;
944
- const ct = /[?*]|[+@!]\\(.*?\\)|\\[|\\]/, Xe = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&");
942
+ y.match = Ye;
943
+ const lt = /[?*]|[+@!]\\(.*?\\)|\\[|\\]/, Ze = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&");
945
944
  class j {
946
945
  options;
947
946
  set;
@@ -961,7 +960,7 @@ class j {
961
960
  windowsNoMagicRoot;
962
961
  regexp;
963
962
  constructor(t, e = {}) {
964
- W(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || vt, 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();
963
+ W(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ct, 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();
965
964
  }
966
965
  hasMagic() {
967
966
  if (this.options.magicalBraces && this.set.length > 1)
@@ -989,7 +988,7 @@ class j {
989
988
  this.globParts = this.preprocess(n), this.debug(this.pattern, this.globParts);
990
989
  let i = this.globParts.map((r, o, a) => {
991
990
  if (this.isWindows && this.windowsNoMagicRoot) {
992
- const l = r[0] === "" && r[1] === "" && (r[2] === "?" || !ct.test(r[2])) && !ct.test(r[3]), h = /^[a-z]:/i.test(r[0]);
991
+ const l = r[0] === "" && r[1] === "" && (r[2] === "?" || !lt.test(r[2])) && !lt.test(r[3]), h = /^[a-z]:/i.test(r[0]);
993
992
  if (l)
994
993
  return [...r.slice(0, 4), ...r.slice(4).map((c) => this.parse(c))];
995
994
  if (h)
@@ -1169,10 +1168,10 @@ class j {
1169
1168
  matchOne(t, e, n = !1) {
1170
1169
  const i = this.options;
1171
1170
  if (this.isWindows) {
1172
- const p = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), S = !p && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), v = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), N = !v && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), x = S ? 3 : p ? 0 : void 0, w = N ? 3 : v ? 0 : void 0;
1171
+ const p = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), S = !p && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), A = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), N = !A && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), x = S ? 3 : p ? 0 : void 0, w = N ? 3 : A ? 0 : void 0;
1173
1172
  if (typeof x == "number" && typeof w == "number") {
1174
- const [F, P] = [t[x], e[w]];
1175
- F.toLowerCase() === P.toLowerCase() && (e[w] = F, w > x ? e = e.slice(w) : x > w && (t = t.slice(x)));
1173
+ const [T, P] = [t[x], e[w]];
1174
+ T.toLowerCase() === P.toLowerCase() && (e[w] = T, w > x ? e = e.slice(w) : x > w && (t = t.slice(x)));
1176
1175
  }
1177
1176
  }
1178
1177
  const { optimizationLevel: r = 1 } = this.options;
@@ -1182,7 +1181,7 @@ class j {
1182
1181
  var c = e[a], f = t[o];
1183
1182
  if (this.debug(e, c, f), c === !1)
1184
1183
  return !1;
1185
- if (c === A) {
1184
+ if (c === v) {
1186
1185
  this.debug("GLOBSTAR", [e, c, f]);
1187
1186
  var u = o, d = a + 1;
1188
1187
  if (d === h) {
@@ -1218,17 +1217,17 @@ globstar while\`, t, u, e, d, m), this.matchOne(t.slice(u), e.slice(d), n))
1218
1217
  throw new Error("wtf?");
1219
1218
  }
1220
1219
  braceExpand() {
1221
- return Ct(this.pattern, this.options);
1220
+ return Ot(this.pattern, this.options);
1222
1221
  }
1223
1222
  parse(t) {
1224
1223
  W(t);
1225
1224
  const e = this.options;
1226
1225
  if (t === "**")
1227
- return A;
1226
+ return v;
1228
1227
  if (t === "")
1229
1228
  return "";
1230
1229
  let n, i = null;
1231
- (n = t.match($e)) ? i = e.dot ? Re : Pe : (n = t.match(be)) ? i = (e.nocase ? e.dot ? De : Ce : e.dot ? ve : Ae)(n[1]) : (n = t.match(ke)) ? i = (e.nocase ? e.dot ? Ie : Le : e.dot ? ze : He)(n) : (n = t.match(Oe)) ? i = e.dot ? Fe : Ne : (n = t.match(Te)) && (i = Me);
1230
+ (n = t.match(Pe)) ? i = e.dot ? ke : Re : (n = t.match(ve)) ? i = (e.nocase ? e.dot ? De : Oe : e.dot ? Ce : Ae)(n[1]) : (n = t.match(Le)) ? i = (e.nocase ? e.dot ? ze : Ie : e.dot ? He : We)(n) : (n = t.match(Ne)) ? i = e.dot ? Fe : Te : (n = t.match(Me)) && (i = $e);
1232
1231
  const r = E.fromGlob(t, this.options).toMMPattern();
1233
1232
  return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
1234
1233
  }
@@ -1238,18 +1237,18 @@ globstar while\`, t, u, e, d, m), this.matchOne(t.slice(u), e.slice(d), n))
1238
1237
  const t = this.set;
1239
1238
  if (!t.length)
1240
1239
  return this.regexp = !1, this.regexp;
1241
- const e = this.options, n = e.noglobstar ? Ue : e.dot ? _e : Be, i = new Set(e.nocase ? ["i"] : []);
1240
+ const e = this.options, n = e.noglobstar ? _e : e.dot ? Be : Ge, i = new Set(e.nocase ? ["i"] : []);
1242
1241
  let r = t.map((l) => {
1243
1242
  const h = l.map((c) => {
1244
1243
  if (c instanceof RegExp)
1245
1244
  for (const f of c.flags.split(""))
1246
1245
  i.add(f);
1247
- return typeof c == "string" ? Xe(c) : c === A ? A : c._src;
1246
+ return typeof c == "string" ? Ze(c) : c === v ? v : c._src;
1248
1247
  });
1249
1248
  return h.forEach((c, f) => {
1250
1249
  const u = h[f + 1], d = h[f - 1];
1251
- c !== A || d === A || (d === void 0 ? u !== void 0 && u !== A ? h[f + 1] = "(?:\\\\/|" + n + "\\\\/)?" + u : h[f] = n : u === void 0 ? h[f - 1] = d + "(?:\\\\/|" + n + ")?" : u !== A && (h[f - 1] = d + "(?:\\\\/|\\\\/" + n + "\\\\/)" + u, h[f + 1] = A));
1252
- }), h.filter((c) => c !== A).join("/");
1250
+ c !== v || d === v || (d === void 0 ? u !== void 0 && u !== v ? h[f + 1] = "(?:\\\\/|" + n + "\\\\/)?" + u : h[f] = n : u === void 0 ? h[f - 1] = d + "(?:\\\\/|" + n + ")?" : u !== v && (h[f - 1] = d + "(?:\\\\/|\\\\/" + n + "\\\\/)" + u, h[f + 1] = v));
1251
+ }), h.filter((c) => c !== v).join("/");
1253
1252
  }).join("|");
1254
1253
  const [o, a] = t.length > 1 ? ["(?:", ")"] : ["", ""];
1255
1254
  r = "^" + o + r + a + "$", this.negate && (r = "^(?!" + r + ").+$");
@@ -1294,43 +1293,106 @@ globstar while\`, t, u, e, d, m), this.matchOne(t.slice(u), e.slice(d), n))
1294
1293
  }
1295
1294
  y.AST = E;
1296
1295
  y.Minimatch = j;
1297
- y.escape = xe;
1296
+ y.escape = be;
1298
1297
  y.unescape = $;
1299
- function Ye() {
1298
+ const Je = [
1299
+ // Images
1300
+ ".jpg",
1301
+ ".jpeg",
1302
+ ".png",
1303
+ ".gif",
1304
+ ".bmp",
1305
+ ".webp",
1306
+ ".svg",
1307
+ ".ico",
1308
+ ".tiff",
1309
+ ".tga",
1310
+ // Audio
1311
+ ".mp3",
1312
+ ".wav",
1313
+ ".ogg",
1314
+ ".flac",
1315
+ ".aac",
1316
+ ".wma",
1317
+ ".m4a",
1318
+ // Video
1319
+ ".mp4",
1320
+ ".avi",
1321
+ ".mov",
1322
+ ".wmv",
1323
+ ".flv",
1324
+ ".webm",
1325
+ ".mkv",
1326
+ ".m4v",
1327
+ // Documents
1328
+ ".pdf",
1329
+ ".doc",
1330
+ ".docx",
1331
+ ".xls",
1332
+ ".xlsx",
1333
+ ".ppt",
1334
+ ".pptx",
1335
+ // Archives
1336
+ ".zip",
1337
+ ".rar",
1338
+ ".7z",
1339
+ ".tar",
1340
+ ".gz",
1341
+ ".bz2",
1342
+ // Executables
1343
+ ".exe",
1344
+ ".dll",
1345
+ ".so",
1346
+ ".dylib",
1347
+ ".bin",
1348
+ // Other binary formats
1349
+ ".dat",
1350
+ ".db",
1351
+ ".sqlite",
1352
+ ".bin",
1353
+ ".obj",
1354
+ ".fbx",
1355
+ ".3ds"
1356
+ ];
1357
+ function G(s) {
1358
+ const t = s.toLowerCase().substring(s.lastIndexOf("."));
1359
+ return Je.includes(t);
1360
+ }
1361
+ function Ke() {
1300
1362
  if (!("storage" in navigator) || !("getDirectory" in navigator.storage))
1301
- throw new Ht();
1363
+ throw new Wt();
1302
1364
  }
1303
- async function Q(s, t, e) {
1365
+ async function tt(s, t, e) {
1304
1366
  return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(\`opfs:\${s.replace(/\\/+/g, "/").toLowerCase()}\`, { mode: t }, e) : e();
1305
1367
  }
1306
- function O(s) {
1368
+ function D(s) {
1307
1369
  return Array.isArray(s) ? s : (s.startsWith("~/") ? s.slice(2) : s).split("/").filter(Boolean);
1308
1370
  }
1309
- function tt(s) {
1371
+ function et(s) {
1310
1372
  return typeof s == "string" ? s ?? "/" : \`/\${s.join("/")}\`;
1311
1373
  }
1312
- function Z(s) {
1313
- const t = O(s);
1374
+ function Y(s) {
1375
+ const t = D(s);
1314
1376
  return t[t.length - 1] || "";
1315
1377
  }
1316
- function G(s) {
1317
- const t = O(s);
1318
- return t.pop(), tt(t);
1378
+ function q(s) {
1379
+ const t = D(s);
1380
+ return t.pop(), et(t);
1319
1381
  }
1320
- function X(s) {
1382
+ function Z(s) {
1321
1383
  return !s || s === "/" ? "/" : s.startsWith("~/") ? \`/\${s.slice(2)}\` : s.startsWith("/") ? s : \`/\${s}\`;
1322
1384
  }
1323
- function Je(s, t = !1) {
1385
+ function Qe(s, t = !1) {
1324
1386
  return s = s.replace(/\\/$/, ""), t && !s.includes("*") ? \`\${s}/**\` : s;
1325
1387
  }
1326
- function q(s, t) {
1388
+ function V(s, t) {
1327
1389
  return y(s, t, {
1328
1390
  dot: !0,
1329
1391
  matchBase: !0
1330
1392
  });
1331
1393
  }
1332
- function Ke(s) {
1333
- const t = X(s), e = O(t), n = [];
1394
+ function ts(s) {
1395
+ const t = Z(s), e = D(t), n = [];
1334
1396
  for (const i of e)
1335
1397
  if (!(i === "." || i === ""))
1336
1398
  if (i === "..") {
@@ -1339,24 +1401,24 @@ function Ke(s) {
1339
1401
  n.pop();
1340
1402
  } else
1341
1403
  n.push(i);
1342
- return tt(n);
1404
+ return et(n);
1343
1405
  }
1344
- function Qe(s, t = "utf-8") {
1345
- return typeof s == "string" ? jt(s, t) : s instanceof Uint8Array ? s : new Uint8Array(s);
1406
+ function es(s, t = "utf-8") {
1407
+ return typeof s == "string" ? Ut(s, t) : s instanceof Uint8Array ? s : new Uint8Array(s);
1346
1408
  }
1347
- async function ts(s, t) {
1348
- return Q(t, "shared", async () => {
1409
+ async function ss(s, t) {
1410
+ return tt(t, "shared", async () => {
1349
1411
  const n = await (await s.getFile()).arrayBuffer();
1350
1412
  return new Uint8Array(n);
1351
1413
  });
1352
1414
  }
1353
- async function lt(s, t, e, n = {}, i) {
1415
+ async function ht(s, t, e, n, i = {}) {
1354
1416
  const r = async () => {
1355
1417
  let o = null;
1356
- const a = n.append || !1, l = !a && (n.truncate ?? !0);
1418
+ const a = i.append || !1, l = !a && (i.truncate ?? !0);
1357
1419
  try {
1358
1420
  o = await s.createSyncAccessHandle();
1359
- const h = Qe(t, e), c = a ? o.getSize() : 0;
1421
+ const h = es(t, e), c = a ? o.getSize() : 0;
1360
1422
  o.write(h, { at: c }), l && o.truncate(h.byteLength), o.flush();
1361
1423
  } catch (h) {
1362
1424
  console.error(h);
@@ -1369,22 +1431,23 @@ async function lt(s, t, e, n = {}, i) {
1369
1431
  }
1370
1432
  }
1371
1433
  };
1372
- return i ? Q(i, "exclusive", r) : r();
1434
+ return n ? tt(n, "exclusive", r) : r();
1373
1435
  }
1374
- async function es(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1436
+ async function ns(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1375
1437
  if (s instanceof File && (s = await s.arrayBuffer()), s.byteLength > e)
1376
1438
  throw new Error(\`File size \${s.byteLength} bytes exceeds maximum allowed size \${e} bytes\`);
1377
1439
  const n = new Uint8Array(s), i = await crypto.subtle.digest(t, n);
1378
1440
  return Array.from(new Uint8Array(i)).map((o) => o.toString(16).padStart(2, "0")).join("");
1379
1441
  }
1380
- async function ss(s) {
1442
+ async function is(s) {
1381
1443
  const t = await s.arrayBuffer();
1382
1444
  return new Uint8Array(t);
1383
1445
  }
1384
- async function ns(s, t, e = {}) {
1385
- const n = Z(t);
1386
- return Q(t, "exclusive", async () => {
1446
+ async function rs(s, t, e = {}) {
1447
+ const n = Y(t);
1448
+ return tt(t, "exclusive", async () => {
1387
1449
  const i = e.recursive ?? !1, r = e.force ?? !1;
1450
+ e.useTrash;
1388
1451
  try {
1389
1452
  await s.removeEntry(n, { recursive: i });
1390
1453
  } catch (o) {
@@ -1395,9 +1458,9 @@ async function ns(s, t, e = {}) {
1395
1458
  }
1396
1459
  });
1397
1460
  }
1398
- class is {
1461
+ class os {
1399
1462
  /** Root directory handle for the file system */
1400
- root = null;
1463
+ root;
1401
1464
  /** Map of watched paths and options */
1402
1465
  watchers = /* @__PURE__ */ new Map();
1403
1466
  /** Promise to prevent concurrent mount operations */
@@ -1425,7 +1488,7 @@ class is {
1425
1488
  if (!this.options.broadcastChannel)
1426
1489
  return;
1427
1490
  const e = t.path;
1428
- if (![...this.watchers.values()].some((r) => q(e, r.pattern) && r.include.some((o) => o && q(e, o)) && !r.exclude.some((o) => o && q(e, o))))
1491
+ if (![...this.watchers.values()].some((r) => V(e, r.pattern) && r.include.some((o) => o && V(e, o)) && !r.exclude.some((o) => o && V(e, o))))
1429
1492
  return;
1430
1493
  let i;
1431
1494
  if (this.options.hashAlgorithm)
@@ -1457,7 +1520,7 @@ class is {
1457
1520
  * @throws {OPFSError} If OPFS is not supported in the current browser
1458
1521
  */
1459
1522
  constructor(t) {
1460
- Ye(), t && this.setOptions(t);
1523
+ Ke(), t && this.setOptions(t);
1461
1524
  }
1462
1525
  /**
1463
1526
  * Initialize the file system within a given directory
@@ -1480,13 +1543,14 @@ class is {
1480
1543
  * await fs.mount('/my-app');
1481
1544
  * \`\`\`
1482
1545
  */
1483
- async mount(t = this.options.root) {
1484
- return this.mountingPromise && await this.mountingPromise, t = X(t), this.mountingPromise = new Promise(async (e, n) => {
1546
+ async mount() {
1547
+ const t = this.options.root;
1548
+ return this.mountingPromise && await this.mountingPromise, this.mountingPromise = new Promise(async (e, n) => {
1485
1549
  try {
1486
1550
  const i = await navigator.storage.getDirectory();
1487
- t === "/" ? this.root = i : this.root = await this.getDirectoryHandle(t, !0, i), e(!0);
1488
- } catch {
1489
- n(new g("Failed to initialize OPFS", "INIT_FAILED"));
1551
+ this.root = t === "/" ? i : await this.getDirectoryHandle(t, !0, i), e(!0);
1552
+ } catch (i) {
1553
+ n(new g("Failed to initialize OPFS", "INIT_FAILED", t, i));
1490
1554
  } finally {
1491
1555
  this.mountingPromise = null;
1492
1556
  }
@@ -1503,7 +1567,7 @@ class is {
1503
1567
  * @param options.broadcastChannel - Custom name for the broadcast channel
1504
1568
  */
1505
1569
  async setOptions(t) {
1506
- 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(this.options.root));
1570
+ 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 = Z(t.root), this.options.namespace || (this.options.namespace = \`opfs-worker:\${this.options.root}\`), await this.mount());
1507
1571
  }
1508
1572
  /**
1509
1573
  * Get a directory handle from a path
@@ -1524,7 +1588,7 @@ class is {
1524
1588
  * \`\`\`
1525
1589
  */
1526
1590
  async getDirectoryHandle(t, e = !1, n = this.root) {
1527
- const i = Array.isArray(t) ? t : O(t);
1591
+ const i = Array.isArray(t) ? t : D(t);
1528
1592
  let r = n;
1529
1593
  for (const o of i)
1530
1594
  r = await r.getDirectoryHandle(o, { create: e });
@@ -1550,9 +1614,9 @@ class is {
1550
1614
  * \`\`\`
1551
1615
  */
1552
1616
  async getFileHandle(t, e = !1, n = this.root) {
1553
- const i = O(t);
1617
+ const i = D(t);
1554
1618
  if (i.length === 0)
1555
- throw new Wt("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
1619
+ throw new jt("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
1556
1620
  const r = i.pop();
1557
1621
  return (await this.getDirectoryHandle(i, e, n)).getFileHandle(r, { create: e });
1558
1622
  }
@@ -1597,11 +1661,11 @@ class is {
1597
1661
  isDirectory: !0
1598
1662
  }), await e("/"), t;
1599
1663
  }
1600
- async readFile(t, e = "utf-8") {
1601
- await this.mount();
1664
+ async readFile(t, e) {
1665
+ await this.mount(), e || (e = G(t) ? "binary" : "utf-8");
1602
1666
  try {
1603
- const n = await this.getFileHandle(t, !1), i = await ts(n, t);
1604
- return e === "binary" ? i : Ut(i, e);
1667
+ const n = await this.getFileHandle(t, !1, this.root), i = await ss(n, t);
1668
+ return e === "binary" ? i : _t(i, e);
1605
1669
  } catch (n) {
1606
1670
  throw new _(t, n);
1607
1671
  }
@@ -1634,7 +1698,7 @@ class is {
1634
1698
  async writeFile(t, e, n) {
1635
1699
  await this.mount();
1636
1700
  const i = await this.exists(t), r = await this.getFileHandle(t, !0);
1637
- await lt(r, e, n, {}, t), i ? await this.notifyChange({ path: t, type: "changed", isDirectory: !1 }) : await this.notifyChange({ path: t, type: "added", isDirectory: !1 });
1701
+ n || (n = typeof e != "string" || G(t) ? "binary" : "utf-8"), await ht(r, e, n, t), i ? await this.notifyChange({ path: t, type: "changed", isDirectory: !1 }) : await this.notifyChange({ path: t, type: "added", isDirectory: !1 });
1638
1702
  }
1639
1703
  /**
1640
1704
  * Append data to a file
@@ -1661,7 +1725,7 @@ class is {
1661
1725
  async appendFile(t, e, n) {
1662
1726
  await this.mount();
1663
1727
  const i = await this.getFileHandle(t, !0);
1664
- await lt(i, e, n, { append: !0 }, t), await this.notifyChange({ path: t, type: "changed", isDirectory: !1 });
1728
+ n || (n = typeof e != "string" || G(t) ? "binary" : "utf-8"), await ht(i, e, n, t, { append: !0 }), await this.notifyChange({ path: t, type: "changed", isDirectory: !1 });
1665
1729
  }
1666
1730
  /**
1667
1731
  * Create a directory
@@ -1686,7 +1750,7 @@ class is {
1686
1750
  */
1687
1751
  async mkdir(t, e) {
1688
1752
  await this.mount();
1689
- const n = e?.recursive ?? !1, i = O(t);
1753
+ const n = e?.recursive ?? !1, i = D(t);
1690
1754
  let r = this.root;
1691
1755
  for (let o = 0; o < i.length; o++) {
1692
1756
  const a = i[o];
@@ -1694,7 +1758,7 @@ class is {
1694
1758
  r = await r.getDirectoryHandle(a, { create: n || o === i.length - 1 });
1695
1759
  } catch (l) {
1696
1760
  throw l.name === "NotFoundError" ? new g(
1697
- \`Parent directory does not exist: \${tt(i.slice(0, o + 1))}\`,
1761
+ \`Parent directory does not exist: \${et(i.slice(0, o + 1))}\`,
1698
1762
  "ENOENT",
1699
1763
  void 0,
1700
1764
  l
@@ -1735,7 +1799,7 @@ class is {
1735
1799
  isFile: !1,
1736
1800
  isDirectory: !0
1737
1801
  };
1738
- const e = Z(t), n = await this.getDirectoryHandle(G(t), !1), i = this.options.hashAlgorithm !== null;
1802
+ const e = Y(t), n = await this.getDirectoryHandle(q(t), !1), i = this.options.hashAlgorithm !== null;
1739
1803
  try {
1740
1804
  const o = await (await n.getFileHandle(e, { create: !1 })).getFile(), a = {
1741
1805
  kind: "file",
@@ -1747,7 +1811,7 @@ class is {
1747
1811
  };
1748
1812
  if (i && this.options.hashAlgorithm)
1749
1813
  try {
1750
- const l = await es(o, this.options.hashAlgorithm, this.options.maxFileSize);
1814
+ const l = await ns(o, this.options.hashAlgorithm, this.options.maxFileSize);
1751
1815
  a.hash = l;
1752
1816
  } catch (l) {
1753
1817
  console.warn(\`Failed to calculate hash for \${t}:\`, l);
@@ -1819,10 +1883,10 @@ class is {
1819
1883
  async exists(t) {
1820
1884
  if (await this.mount(), t === "/")
1821
1885
  return !0;
1822
- const e = Z(t);
1886
+ const e = Y(t);
1823
1887
  let n = null;
1824
1888
  try {
1825
- n = await this.getDirectoryHandle(G(t), !1);
1889
+ n = await this.getDirectoryHandle(q(t), !1);
1826
1890
  } catch (i) {
1827
1891
  throw (i.name === "NotFoundError" || i.name === "TypeMismatchError") && (n = null), i;
1828
1892
  }
@@ -1901,8 +1965,8 @@ class is {
1901
1965
  async remove(t, e) {
1902
1966
  if (await this.mount(), t === "/")
1903
1967
  throw new g("Cannot remove root directory", "EROOT");
1904
- const n = await this.getDirectoryHandle(G(t), !1);
1905
- await ns(n, t, e), await this.notifyChange({ path: t, type: "removed", isDirectory: !1 });
1968
+ const { recursive: n = !1, force: i = !1 } = e || {}, r = await this.getDirectoryHandle(q(t), !1);
1969
+ await rs(r, t, { recursive: n, force: i }), await this.notifyChange({ path: t, type: "removed", isDirectory: !1 });
1906
1970
  }
1907
1971
  /**
1908
1972
  * Resolve a path to an absolute path
@@ -1925,7 +1989,7 @@ class is {
1925
1989
  async realpath(t) {
1926
1990
  await this.mount();
1927
1991
  try {
1928
- const e = Ke(t);
1992
+ const e = ts(t);
1929
1993
  if (!await this.exists(e))
1930
1994
  throw new _(e);
1931
1995
  return e;
@@ -1937,26 +2001,35 @@ class is {
1937
2001
  * Rename a file or directory
1938
2002
  *
1939
2003
  * Changes the name of a file or directory. If the target path already exists,
1940
- * it will be replaced.
2004
+ * it will be replaced only if overwrite option is enabled.
1941
2005
  *
1942
2006
  * @param oldPath - The current path of the file or directory
1943
2007
  * @param newPath - The new path for the file or directory
2008
+ * @param options - Options for renaming
2009
+ * @param options.overwrite - Whether to overwrite existing files (default: false)
1944
2010
  * @returns Promise that resolves when the rename operation is complete
1945
2011
  * @throws {OPFSError} If the rename operation fails
1946
2012
  *
1947
2013
  * @example
1948
2014
  * \`\`\`typescript
2015
+ * // Basic rename (fails if target exists)
1949
2016
  * await fs.rename('/old/path/file.txt', '/new/path/renamed.txt');
2017
+ *
2018
+ * // Rename with overwrite
2019
+ * await fs.rename('/old/path/file.txt', '/new/path/renamed.txt', { overwrite: true });
1950
2020
  * \`\`\`
1951
2021
  */
1952
- async rename(t, e) {
2022
+ async rename(t, e, n) {
1953
2023
  await this.mount();
1954
2024
  try {
2025
+ const i = n?.overwrite ?? !1;
1955
2026
  if (!await this.exists(t))
1956
2027
  throw new _(t);
1957
- await this.copy(t, e, { recursive: !0 }), await this.remove(t, { recursive: !0 }), await this.notifyChange({ path: t, type: "removed", isDirectory: !1 }), await this.notifyChange({ path: e, type: "added", isDirectory: !1 });
1958
- } catch (n) {
1959
- throw n instanceof g ? n : new g(\`Failed to rename from \${t} to \${e}\`, "RENAME_FAILED", void 0, n);
2028
+ if (await this.exists(e) && !i)
2029
+ throw new g(\`Destination already exists: \${e}\`, "EEXIST", void 0);
2030
+ await this.copy(t, e, { recursive: !0, overwrite: i }), await this.remove(t, { recursive: !0 }), await this.notifyChange({ path: t, type: "removed", isDirectory: !1 }), await this.notifyChange({ path: e, type: "added", isDirectory: !1 });
2031
+ } catch (i) {
2032
+ throw i instanceof g ? i : new g(\`Failed to rename from \${t} to \${e}\`, "RENAME_FAILED", void 0, i);
1960
2033
  }
1961
2034
  }
1962
2035
  /**
@@ -1968,7 +2041,7 @@ class is {
1968
2041
  * @param destination - The destination path to copy to
1969
2042
  * @param options - Options for copying
1970
2043
  * @param options.recursive - Whether to copy directories recursively (default: false)
1971
- * @param options.force - Whether to overwrite existing files (default: true)
2044
+ * @param options.overwrite - Whether to overwrite existing files (default: true)
1972
2045
  * @returns Promise that resolves when the copy operation is complete
1973
2046
  * @throws {OPFSError} If the copy operation fails
1974
2047
  *
@@ -1981,13 +2054,13 @@ class is {
1981
2054
  * await fs.copy('/source/dir', '/dest/dir', { recursive: true });
1982
2055
  *
1983
2056
  * // Copy without overwriting existing files
1984
- * await fs.copy('/source', '/dest', { recursive: true, force: false });
2057
+ * await fs.copy('/source', '/dest', { recursive: true, overwrite: false });
1985
2058
  * \`\`\`
1986
2059
  */
1987
2060
  async copy(t, e, n) {
1988
2061
  await this.mount();
1989
2062
  try {
1990
- const i = n?.recursive ?? !1, r = n?.force ?? !0;
2063
+ const i = n?.recursive ?? !1, r = n?.overwrite ?? !0;
1991
2064
  if (!await this.exists(t))
1992
2065
  throw new g(\`Source does not exist: \${t}\`, "ENOENT", void 0);
1993
2066
  if (await this.exists(e) && !r)
@@ -2002,7 +2075,7 @@ class is {
2002
2075
  const h = await this.readDir(t);
2003
2076
  for (const c of h) {
2004
2077
  const f = \`\${t}/\${c.name}\`, u = \`\${e}/\${c.name}\`;
2005
- await this.copy(f, u, { recursive: !0, force: r });
2078
+ await this.copy(f, u, { recursive: !0, overwrite: r });
2006
2079
  }
2007
2080
  }
2008
2081
  } catch (i) {
@@ -2038,7 +2111,7 @@ class is {
2038
2111
  if (!this.options.broadcastChannel)
2039
2112
  throw new g("This instance is not configured to send events. Please specify options.broadcastChannel to enable watching.", "ENOENT");
2040
2113
  const n = {
2041
- pattern: Je(t, e?.recursive ?? !0),
2114
+ pattern: Qe(t, e?.recursive ?? !0),
2042
2115
  include: Array.isArray(e?.include) ? e.include : [e?.include ?? "**"],
2043
2116
  exclude: Array.isArray(e?.exclude) ? e.exclude : [e?.exclude ?? ""]
2044
2117
  };
@@ -2092,17 +2165,17 @@ class is {
2092
2165
  try {
2093
2166
  (e?.cleanBefore ?? !1) && await this.clear("/");
2094
2167
  for (const [i, r] of t) {
2095
- const o = X(i);
2168
+ const o = Z(i);
2096
2169
  let a;
2097
- r instanceof Blob ? a = await ss(r) : a = r, await this.writeFile(o, a);
2170
+ r instanceof Blob ? a = await is(r) : a = r, await this.writeFile(o, a);
2098
2171
  }
2099
2172
  } catch (n) {
2100
2173
  throw n instanceof g ? n : new g("Failed to sync file system", "SYNC_FAILED", void 0, n);
2101
2174
  }
2102
2175
  }
2103
2176
  }
2104
- typeof globalThis < "u" && globalThis.constructor.name === "DedicatedWorkerGlobalScope" && Y(new is());
2105
- //# sourceMappingURL=worker-3SMz_DAt.js.map
2177
+ typeof globalThis < "u" && globalThis.constructor.name === "DedicatedWorkerGlobalScope" && J(new os());
2178
+ //# sourceMappingURL=worker-XHCzp1qX.js.map
2106
2179
  `, s = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", r], { type: "text/javascript;charset=utf-8" });
2107
2180
  function o(n) {
2108
2181
  let t;
@@ -2130,36 +2203,38 @@ async function h(n) {
2130
2203
  return n && (n.broadcastChannel && n.broadcastChannel instanceof BroadcastChannel && (n.broadcastChannel = n.broadcastChannel.name), await t.setOptions(n)), t;
2131
2204
  }
2132
2205
  export {
2133
- p as DirectoryNotFoundError,
2134
- f as FileNotFoundError,
2135
- d as OPFSError,
2136
- u as OPFSNotMountedError,
2137
- g as OPFSNotSupportedError,
2138
- m as PathError,
2139
- w as PermissionError,
2140
- y as StorageError,
2141
- b as TimeoutError,
2142
- v as basename,
2206
+ p as BINARY_FILE_EXTENSIONS,
2207
+ f as DirectoryNotFoundError,
2208
+ d as FileNotFoundError,
2209
+ u as OPFSError,
2210
+ g as OPFSNotMountedError,
2211
+ m as OPFSNotSupportedError,
2212
+ w as PathError,
2213
+ y as PermissionError,
2214
+ b as StorageError,
2215
+ v as TimeoutError,
2216
+ x as basename,
2143
2217
  S as buffersEqual,
2144
- x as calculateFileHash,
2145
- E as checkOPFSSupport,
2146
- P as convertBlobToUint8Array,
2147
- A as createBuffer,
2218
+ E as calculateFileHash,
2219
+ P as checkOPFSSupport,
2220
+ A as convertBlobToUint8Array,
2221
+ F as createBuffer,
2148
2222
  h as createWorker,
2149
- F as decodeBuffer,
2150
- O as dirname,
2151
- C as encodeString,
2152
- T as extname,
2153
- R as isPathExcluded,
2154
- $ as joinPath,
2155
- _ as matchMinimatch,
2156
- D as normalizeMinimatch,
2157
- I as normalizePath,
2223
+ O as decodeBuffer,
2224
+ C as dirname,
2225
+ T as encodeString,
2226
+ R as extname,
2227
+ $ as isBinaryFileExtension,
2228
+ _ as isPathExcluded,
2229
+ D as joinPath,
2230
+ I as matchMinimatch,
2231
+ j as normalizeMinimatch,
2232
+ N as normalizePath,
2158
2233
  M as readFileData,
2159
- j as removeEntry,
2160
- N as resolvePath,
2161
- k as splitPath,
2162
- L as withLock,
2234
+ k as removeEntry,
2235
+ L as resolvePath,
2236
+ z as splitPath,
2237
+ W as withLock,
2163
2238
  U as writeFileData
2164
2239
  };
2165
2240
  //# sourceMappingURL=index.js.map