opfs-worker 1.1.0 → 1.2.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.cjs CHANGED
@@ -1,61 +1,61 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("comlink"),n=require("./helpers-CKqaiMjI.cjs"),s=`/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("comlink"),e=require("./helpers-TAynP0fb.cjs"),c=`/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- const wt = Symbol("Comlink.proxy"), Mt = Symbol("Comlink.endpoint"), Pt = Symbol("Comlink.releaseProxy"), G = Symbol("Comlink.finalizer"), L = Symbol("Comlink.thrown"), mt = (n) => typeof n == "object" && n !== null || typeof n == "function", kt = {
7
- canHandle: (n) => mt(n) && n[wt],
8
- serialize(n) {
6
+ 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 = {
7
+ canHandle: (s) => gt(s) && s[pt],
8
+ serialize(s) {
9
9
  const { port1: t, port2: e } = new MessageChannel();
10
- return tt(n, t), [e, [e]];
10
+ return K(s, t), [e, [e]];
11
11
  },
12
- deserialize(n) {
13
- return n.start(), zt(n);
12
+ deserialize(s) {
13
+ return s.start(), Rt(s);
14
14
  }
15
- }, Rt = {
16
- canHandle: (n) => mt(n) && L in n,
17
- serialize({ value: n }) {
15
+ }, Pt = {
16
+ canHandle: (s) => gt(s) && z in s,
17
+ serialize({ value: s }) {
18
18
  let t;
19
- return n instanceof Error ? t = {
19
+ return s instanceof Error ? t = {
20
20
  isError: !0,
21
21
  value: {
22
- message: n.message,
23
- name: n.name,
24
- stack: n.stack
22
+ message: s.message,
23
+ name: s.name,
24
+ stack: s.stack
25
25
  }
26
- } : t = { isError: !1, value: n }, [t, []];
26
+ } : t = { isError: !1, value: s }, [t, []];
27
27
  },
28
- deserialize(n) {
29
- throw n.isError ? Object.assign(new Error(n.value.message), n.value) : n.value;
28
+ deserialize(s) {
29
+ throw s.isError ? Object.assign(new Error(s.value.message), s.value) : s.value;
30
30
  }
31
- }, yt = /* @__PURE__ */ new Map([
32
- ["proxy", kt],
33
- ["throw", Rt]
31
+ }, wt = /* @__PURE__ */ new Map([
32
+ ["proxy", Mt],
33
+ ["throw", Pt]
34
34
  ]);
35
- function Lt(n, t) {
36
- for (const e of n)
35
+ function It(s, t) {
36
+ for (const e of s)
37
37
  if (t === e || e === "*" || e instanceof RegExp && e.test(t))
38
38
  return !0;
39
39
  return !1;
40
40
  }
41
- function tt(n, t = globalThis, e = ["*"]) {
42
- t.addEventListener("message", function s(r) {
43
- if (!r || !r.data)
41
+ function K(s, t = globalThis, e = ["*"]) {
42
+ t.addEventListener("message", function n(i) {
43
+ if (!i || !i.data)
44
44
  return;
45
- if (!Lt(e, r.origin)) {
46
- console.warn(\`Invalid origin '\${r.origin}' for comlink proxy\`);
45
+ if (!It(e, i.origin)) {
46
+ console.warn(\`Invalid origin '\${i.origin}' for comlink proxy\`);
47
47
  return;
48
48
  }
49
- const { id: i, type: o, path: a } = Object.assign({ path: [] }, r.data), l = (r.data.argumentList || []).map(F);
49
+ const { id: r, type: o, path: a } = Object.assign({ path: [] }, i.data), l = (i.data.argumentList || []).map(F);
50
50
  let h;
51
51
  try {
52
- const c = a.slice(0, -1).reduce((u, d) => u[d], n), f = a.reduce((u, d) => u[d], n);
52
+ const c = a.slice(0, -1).reduce((u, d) => u[d], s), f = a.reduce((u, d) => u[d], s);
53
53
  switch (o) {
54
54
  case "GET":
55
55
  h = f;
56
56
  break;
57
57
  case "SET":
58
- c[a.slice(-1)[0]] = F(r.data.value), h = !0;
58
+ c[a.slice(-1)[0]] = F(i.data.value), h = !0;
59
59
  break;
60
60
  case "APPLY":
61
61
  h = f.apply(c, l);
@@ -63,13 +63,13 @@ function tt(n, t = globalThis, e = ["*"]) {
63
63
  case "CONSTRUCT":
64
64
  {
65
65
  const u = new f(...l);
66
- h = Ut(u);
66
+ h = Wt(u);
67
67
  }
68
68
  break;
69
69
  case "ENDPOINT":
70
70
  {
71
71
  const { port1: u, port2: d } = new MessageChannel();
72
- tt(n, d), h = K(u, [u]);
72
+ K(s, d), h = H(u, [u]);
73
73
  }
74
74
  break;
75
75
  case "RELEASE":
@@ -79,462 +79,326 @@ function tt(n, t = globalThis, e = ["*"]) {
79
79
  return;
80
80
  }
81
81
  } catch (c) {
82
- h = { value: c, [L]: 0 };
82
+ h = { value: c, [z]: 0 };
83
83
  }
84
- Promise.resolve(h).catch((c) => ({ value: c, [L]: 0 })).then((c) => {
85
- const [f, u] = W(c);
86
- t.postMessage(Object.assign(Object.assign({}, f), { id: i }), u), o === "RELEASE" && (t.removeEventListener("message", s), Et(t), G in n && typeof n[G] == "function" && n[G]());
84
+ Promise.resolve(h).catch((c) => ({ value: c, [z]: 0 })).then((c) => {
85
+ const [f, u] = B(c);
86
+ 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]());
87
87
  }).catch((c) => {
88
- const [f, u] = W({
88
+ const [f, u] = B({
89
89
  value: new TypeError("Unserializable return value"),
90
- [L]: 0
90
+ [z]: 0
91
91
  });
92
- t.postMessage(Object.assign(Object.assign({}, f), { id: i }), u);
92
+ t.postMessage(Object.assign(Object.assign({}, f), { id: r }), u);
93
93
  });
94
94
  }), t.start && t.start();
95
95
  }
96
- function Ht(n) {
97
- return n.constructor.name === "MessagePort";
96
+ function kt(s) {
97
+ return s.constructor.name === "MessagePort";
98
98
  }
99
- function Et(n) {
100
- Ht(n) && n.close();
99
+ function yt(s) {
100
+ kt(s) && s.close();
101
101
  }
102
- function zt(n, t) {
102
+ function Rt(s, t) {
103
103
  const e = /* @__PURE__ */ new Map();
104
- return n.addEventListener("message", function(r) {
105
- const { data: i } = r;
106
- if (!i || !i.id)
104
+ return s.addEventListener("message", function(i) {
105
+ const { data: r } = i;
106
+ if (!r || !r.id)
107
107
  return;
108
- const o = e.get(i.id);
108
+ const o = e.get(r.id);
109
109
  if (o)
110
110
  try {
111
- o(i);
111
+ o(r);
112
112
  } finally {
113
- e.delete(i.id);
113
+ e.delete(r.id);
114
114
  }
115
- }), J(n, e, [], t);
115
+ }), Z(s, e, [], t);
116
116
  }
117
- function P(n) {
118
- if (n)
117
+ function k(s) {
118
+ if (s)
119
119
  throw new Error("Proxy has been released and is not useable");
120
120
  }
121
- function St(n) {
122
- return N(n, /* @__PURE__ */ new Map(), {
121
+ function mt(s) {
122
+ return N(s, /* @__PURE__ */ new Map(), {
123
123
  type: "RELEASE"
124
124
  }).then(() => {
125
- Et(n);
125
+ yt(s);
126
126
  });
127
127
  }
128
- const z = /* @__PURE__ */ new WeakMap(), _ = "FinalizationRegistry" in globalThis && new FinalizationRegistry((n) => {
129
- const t = (z.get(n) || 0) - 1;
130
- z.set(n, t), t === 0 && St(n);
128
+ const _ = /* @__PURE__ */ new WeakMap(), j = "FinalizationRegistry" in globalThis && new FinalizationRegistry((s) => {
129
+ const t = (_.get(s) || 0) - 1;
130
+ _.set(s, t), t === 0 && mt(s);
131
131
  });
132
- function _t(n, t) {
133
- const e = (z.get(t) || 0) + 1;
134
- z.set(t, e), _ && _.register(n, t, n);
132
+ function Lt(s, t) {
133
+ const e = (_.get(t) || 0) + 1;
134
+ _.set(t, e), j && j.register(s, t, s);
135
135
  }
136
- function Wt(n) {
137
- _ && _.unregister(n);
136
+ function zt(s) {
137
+ j && j.unregister(s);
138
138
  }
139
- function J(n, t, e = [], s = function() {
139
+ function Z(s, t, e = [], n = function() {
140
140
  }) {
141
- let r = !1;
142
- const i = new Proxy(s, {
141
+ let i = !1;
142
+ const r = new Proxy(n, {
143
143
  get(o, a) {
144
- if (P(r), a === Pt)
144
+ if (k(i), a === Tt)
145
145
  return () => {
146
- Wt(i), St(n), t.clear(), r = !0;
146
+ zt(r), mt(s), t.clear(), i = !0;
147
147
  };
148
148
  if (a === "then") {
149
149
  if (e.length === 0)
150
- return { then: () => i };
151
- const l = N(n, t, {
150
+ return { then: () => r };
151
+ const l = N(s, t, {
152
152
  type: "GET",
153
153
  path: e.map((h) => h.toString())
154
154
  }).then(F);
155
155
  return l.then.bind(l);
156
156
  }
157
- return J(n, t, [...e, a]);
157
+ return Z(s, t, [...e, a]);
158
158
  },
159
159
  set(o, a, l) {
160
- P(r);
161
- const [h, c] = W(l);
162
- return N(n, t, {
160
+ k(i);
161
+ const [h, c] = B(l);
162
+ return N(s, t, {
163
163
  type: "SET",
164
164
  path: [...e, a].map((f) => f.toString()),
165
165
  value: h
166
166
  }, c).then(F);
167
167
  },
168
168
  apply(o, a, l) {
169
- P(r);
169
+ k(i);
170
170
  const h = e[e.length - 1];
171
- if (h === Mt)
172
- return N(n, t, {
171
+ if (h === Ct)
172
+ return N(s, t, {
173
173
  type: "ENDPOINT"
174
174
  }).then(F);
175
175
  if (h === "bind")
176
- return J(n, t, e.slice(0, -1));
177
- const [c, f] = rt(l);
178
- return N(n, t, {
176
+ return Z(s, t, e.slice(0, -1));
177
+ const [c, f] = st(l);
178
+ return N(s, t, {
179
179
  type: "APPLY",
180
180
  path: e.map((u) => u.toString()),
181
181
  argumentList: c
182
182
  }, f).then(F);
183
183
  },
184
184
  construct(o, a) {
185
- P(r);
186
- const [l, h] = rt(a);
187
- return N(n, t, {
185
+ k(i);
186
+ const [l, h] = st(a);
187
+ return N(s, t, {
188
188
  type: "CONSTRUCT",
189
189
  path: e.map((c) => c.toString()),
190
190
  argumentList: l
191
191
  }, h).then(F);
192
192
  }
193
193
  });
194
- return _t(i, n), i;
194
+ return Lt(r, s), r;
195
195
  }
196
- function jt(n) {
197
- return Array.prototype.concat.apply([], n);
196
+ function Ht(s) {
197
+ return Array.prototype.concat.apply([], s);
198
198
  }
199
- function rt(n) {
200
- const t = n.map(W);
201
- return [t.map((e) => e[0]), jt(t.map((e) => e[1]))];
199
+ function st(s) {
200
+ const t = s.map(B);
201
+ return [t.map((e) => e[0]), Ht(t.map((e) => e[1]))];
202
202
  }
203
- const xt = /* @__PURE__ */ new WeakMap();
204
- function K(n, t) {
205
- return xt.set(n, t), n;
203
+ const Et = /* @__PURE__ */ new WeakMap();
204
+ function H(s, t) {
205
+ return Et.set(s, t), s;
206
206
  }
207
- function Ut(n) {
208
- return Object.assign(n, { [wt]: !0 });
207
+ function Wt(s) {
208
+ return Object.assign(s, { [pt]: !0 });
209
209
  }
210
- function W(n) {
211
- for (const [t, e] of yt)
212
- if (e.canHandle(n)) {
213
- const [s, r] = e.serialize(n);
210
+ function B(s) {
211
+ for (const [t, e] of wt)
212
+ if (e.canHandle(s)) {
213
+ const [n, i] = e.serialize(s);
214
214
  return [
215
215
  {
216
216
  type: "HANDLER",
217
217
  name: t,
218
- value: s
218
+ value: n
219
219
  },
220
- r
220
+ i
221
221
  ];
222
222
  }
223
223
  return [
224
224
  {
225
225
  type: "RAW",
226
- value: n
226
+ value: s
227
227
  },
228
- xt.get(n) || []
228
+ Et.get(s) || []
229
229
  ];
230
230
  }
231
- function F(n) {
232
- switch (n.type) {
231
+ function F(s) {
232
+ switch (s.type) {
233
233
  case "HANDLER":
234
- return yt.get(n.name).deserialize(n.value);
234
+ return wt.get(s.name).deserialize(s.value);
235
235
  case "RAW":
236
- return n.value;
236
+ return s.value;
237
237
  }
238
238
  }
239
- function N(n, t, e, s) {
240
- return new Promise((r) => {
241
- const i = Bt();
242
- t.set(i, r), n.start && n.start(), n.postMessage(Object.assign({ id: i }, e), s);
239
+ function N(s, t, e, n) {
240
+ return new Promise((i) => {
241
+ const r = _t();
242
+ t.set(r, i), s.start && s.start(), s.postMessage(Object.assign({ id: r }, e), n);
243
243
  });
244
244
  }
245
- function Bt() {
245
+ function _t() {
246
246
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
247
247
  }
248
248
  class p extends Error {
249
- constructor(t, e, s, r) {
250
- super(t, { cause: r }), this.code = e, this.path = s, this.name = "OPFSError";
249
+ constructor(t, e, n, i) {
250
+ super(t, { cause: i }), this.code = e, this.path = n, this.name = "OPFSError";
251
251
  }
252
252
  }
253
- class Gt extends p {
253
+ class jt extends p {
254
254
  constructor(t) {
255
255
  super("OPFS is not supported in this browser", "OPFS_NOT_SUPPORTED", void 0, t);
256
256
  }
257
257
  }
258
- class qt extends p {
259
- constructor(t, e, s) {
260
- super(t, "INVALID_PATH", e, s);
258
+ class Bt extends p {
259
+ constructor(t, e, n) {
260
+ super(t, "INVALID_PATH", e, n);
261
261
  }
262
262
  }
263
- class q extends p {
263
+ class nt extends p {
264
264
  constructor(t, e) {
265
265
  super(\`File not found: \${t}\`, "FILE_NOT_FOUND", t, e);
266
266
  }
267
267
  }
268
- function k(n, t, e, s) {
269
- const r = \`\${n.toUpperCase()}_FAILED\`;
270
- return new p(\`Failed to \${n} file descriptor: \${t}\`, r, e, s);
268
+ function R(s, t, e, n) {
269
+ const i = \`\${s.toUpperCase()}_FAILED\`;
270
+ return new p(\`Failed to \${s} file descriptor: \${t}\`, i, e, n);
271
271
  }
272
- function Vt(n, t) {
272
+ function Ut(s, t) {
273
273
  const e = t?.path;
274
- switch (n.name) {
274
+ switch (s.name) {
275
275
  case "InvalidStateError":
276
- return new p(\`File is busy: \${e || "unknown"}\`, "EBUSY", e, n);
276
+ return new p(\`File is busy: \${e || "unknown"}\`, "EBUSY", e, s);
277
277
  case "QuotaExceededError":
278
- return new p(\`No space left on device: \${e || "unknown"}\`, "ENOSPC", e, n);
278
+ return new p(\`No space left on device: \${e || "unknown"}\`, "ENOSPC", e, s);
279
279
  case "NotFoundError":
280
- return new p(\`No such file or directory: \${e || "unknown"}\`, "ENOENT", e, n);
280
+ return new p(\`No such file or directory: \${e || "unknown"}\`, "ENOENT", e, s);
281
281
  case "TypeMismatchError":
282
- return new p(\`Is a directory: \${e || "unknown"}\`, "EISDIR", e, n);
282
+ return new p(\`Is a directory: \${e || "unknown"}\`, "EISDIR", e, s);
283
283
  case "NotAllowedError":
284
284
  case "SecurityError":
285
- return new p(\`Permission denied: \${e || "unknown"}\`, "EACCES", e, n);
285
+ return new p(\`Permission denied: \${e || "unknown"}\`, "EACCES", e, s);
286
286
  case "InvalidModificationError":
287
- return new p(\`Invalid modification: \${e || "unknown"}\`, "EINVAL", e, n);
287
+ return new p(\`Invalid modification: \${e || "unknown"}\`, "EINVAL", e, s);
288
288
  case "AbortError":
289
- return new p(\`Operation aborted: \${e || "unknown"}\`, "EINTR", e, n);
289
+ return new p(\`Operation aborted: \${e || "unknown"}\`, "EINTR", e, s);
290
290
  case "OperationError":
291
- return new p(\`Operation failed: \${e || "unknown"}\`, "EIO", e, n);
291
+ return new p(\`Operation failed: \${e || "unknown"}\`, "EIO", e, s);
292
292
  case "TypeError":
293
- return new p(\`Operation not supported: \${e || "unknown"}\`, "ENOTSUP", e, n);
293
+ return new p(\`Operation not supported: \${e || "unknown"}\`, "ENOTSUP", e, s);
294
294
  default:
295
- return new p(\`I/O error: \${e || "unknown"}\`, "EIO", e, n);
295
+ return new p(\`I/O error: \${e || "unknown"}\`, "EIO", e, s);
296
296
  }
297
297
  }
298
- const Xt = [
299
- // Images
300
- ".jpg",
301
- ".jpeg",
302
- ".png",
303
- ".gif",
304
- ".bmp",
305
- ".webp",
306
- ".ico",
307
- ".tiff",
308
- ".tga",
309
- // Audio
310
- ".mp3",
311
- ".wav",
312
- ".ogg",
313
- ".flac",
314
- ".aac",
315
- ".wma",
316
- ".m4a",
317
- // Video
318
- ".mp4",
319
- ".avi",
320
- ".mov",
321
- ".wmv",
322
- ".flv",
323
- ".webm",
324
- ".mkv",
325
- ".m4v",
326
- // Documents
327
- ".pdf",
328
- ".doc",
329
- ".docx",
330
- ".xls",
331
- ".xlsx",
332
- ".ppt",
333
- ".pptx",
334
- // Archives
335
- ".zip",
336
- ".rar",
337
- ".7z",
338
- ".tar",
339
- ".gz",
340
- ".bz2",
341
- // Executables
342
- ".exe",
343
- ".dll",
344
- ".so",
345
- ".dylib",
346
- // Other binary formats
347
- ".dat",
348
- ".db",
349
- ".sqlite",
350
- ".bin",
351
- ".obj",
352
- ".fbx",
353
- ".3ds"
354
- ];
355
- function V(n) {
356
- const t = n.lastIndexOf(".");
357
- if (t <= 0)
358
- return !0;
359
- const e = n.slice(t).toLowerCase();
360
- return Xt.includes(e);
361
- }
362
- function Yt(n, t = "utf-8") {
363
- switch (t) {
364
- case "utf8":
365
- case "utf-8":
366
- return new TextEncoder().encode(n);
367
- case "utf16le":
368
- case "ucs2":
369
- case "ucs-2":
370
- return Jt(n);
371
- case "ascii":
372
- return te(n);
373
- case "latin1":
374
- return Qt(n);
375
- case "binary":
376
- return Uint8Array.from(n, (e) => e.charCodeAt(0));
377
- case "base64":
378
- return Uint8Array.from(atob(n), (e) => e.charCodeAt(0));
379
- case "hex":
380
- if (!/^[\\da-f]+$/i.test(n) || n.length % 2 !== 0)
381
- throw new p("Invalid hex string", "INVALID_HEX_FORMAT");
382
- return Uint8Array.from(n.match(/.{1,2}/g).map((e) => parseInt(e, 16)));
383
- default:
384
- return console.warn("Encoding not supported, falling back to UTF-8"), new TextEncoder().encode(n);
385
- }
386
- }
387
- function Zt(n, t = "utf-8") {
388
- switch (t) {
389
- case "utf8":
390
- case "utf-8":
391
- return new TextDecoder().decode(n);
392
- case "utf16le":
393
- case "utf-16le":
394
- case "ucs2":
395
- case "ucs-2":
396
- return Kt(n);
397
- case "latin1":
398
- return String.fromCharCode(...n);
399
- case "ascii":
400
- return String.fromCharCode(...n.map((e) => e & 127));
401
- case "base64":
402
- return btoa(String.fromCharCode(...n));
403
- case "hex":
404
- return Array.from(n).map((e) => e.toString(16).padStart(2, "0")).join("");
405
- default:
406
- return console.warn("Unsupported encoding, falling back to UTF-8"), new TextDecoder().decode(n);
407
- }
408
- }
409
- function Jt(n) {
410
- const t = new Uint8Array(n.length * 2);
411
- for (let e = 0; e < n.length; e++) {
412
- const s = n.charCodeAt(e);
413
- t[e * 2] = s & 255, t[e * 2 + 1] = s >> 8;
414
- }
415
- return t;
416
- }
417
- function Kt(n) {
418
- n.length % 2 !== 0 && (console.warn("Invalid UTF-16LE buffer length, truncating last byte"), n = n.slice(0, n.length - 1));
419
- const t = new Uint16Array(n.buffer, n.byteOffset, n.byteLength / 2);
420
- return String.fromCharCode(...t);
421
- }
422
- function Qt(n) {
423
- const t = new Uint8Array(n.length);
424
- for (let e = 0; e < n.length; e++)
425
- t[e] = n.charCodeAt(e) & 255;
426
- return t;
427
- }
428
- function te(n) {
429
- const t = new Uint8Array(n.length);
430
- for (let e = 0; e < n.length; e++)
431
- t[e] = n.charCodeAt(e) & 127;
432
- return t;
433
- }
434
- const bt = (n, t, e) => {
435
- const s = n instanceof RegExp ? it(n, e) : n, r = t instanceof RegExp ? it(t, e) : t, i = s !== null && r != null && ee(s, r, e);
436
- return i && {
437
- start: i[0],
438
- end: i[1],
439
- pre: e.slice(0, i[0]),
440
- body: e.slice(i[0] + s.length, i[1]),
441
- post: e.slice(i[1] + r.length)
298
+ const St = (s, t, e) => {
299
+ 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);
300
+ return r && {
301
+ start: r[0],
302
+ end: r[1],
303
+ pre: e.slice(0, r[0]),
304
+ body: e.slice(r[0] + n.length, r[1]),
305
+ post: e.slice(r[1] + i.length)
442
306
  };
443
- }, it = (n, t) => {
444
- const e = t.match(n);
307
+ }, it = (s, t) => {
308
+ const e = t.match(s);
445
309
  return e ? e[0] : null;
446
- }, ee = (n, t, e) => {
447
- let s, r, i, o, a, l = e.indexOf(n), h = e.indexOf(t, l + 1), c = l;
310
+ }, Gt = (s, t, e) => {
311
+ let n, i, r, o, a, l = e.indexOf(s), h = e.indexOf(t, l + 1), c = l;
448
312
  if (l >= 0 && h > 0) {
449
- if (n === t)
313
+ if (s === t)
450
314
  return [l, h];
451
- for (s = [], i = e.length; c >= 0 && !a; ) {
315
+ for (n = [], r = e.length; c >= 0 && !a; ) {
452
316
  if (c === l)
453
- s.push(c), l = e.indexOf(n, c + 1);
454
- else if (s.length === 1) {
455
- const f = s.pop();
317
+ n.push(c), l = e.indexOf(s, c + 1);
318
+ else if (n.length === 1) {
319
+ const f = n.pop();
456
320
  f !== void 0 && (a = [f, h]);
457
321
  } else
458
- r = s.pop(), r !== void 0 && r < i && (i = r, o = h), h = e.indexOf(t, c + 1);
322
+ i = n.pop(), i !== void 0 && i < r && (r = i, o = h), h = e.indexOf(t, c + 1);
459
323
  c = l < h && l >= 0 ? l : h;
460
324
  }
461
- s.length && o !== void 0 && (a = [i, o]);
325
+ n.length && o !== void 0 && (a = [r, o]);
462
326
  }
463
327
  return a;
464
- }, vt = "\\0SLASH" + Math.random() + "\\0", At = "\\0OPEN" + Math.random() + "\\0", et = "\\0CLOSE" + Math.random() + "\\0", Ft = "\\0COMMA" + Math.random() + "\\0", Nt = "\\0PERIOD" + Math.random() + "\\0", ne = new RegExp(vt, "g"), se = new RegExp(At, "g"), re = new RegExp(et, "g"), ie = new RegExp(Ft, "g"), oe = new RegExp(Nt, "g"), ae = /\\\\\\\\/g, ce = /\\\\{/g, le = /\\\\}/g, he = /\\\\,/g, ue = /\\\\./g;
465
- function X(n) {
466
- return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
328
+ }, 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;
329
+ function V(s) {
330
+ return isNaN(s) ? s.charCodeAt(0) : parseInt(s, 10);
467
331
  }
468
- function fe(n) {
469
- return n.replace(ae, vt).replace(ce, At).replace(le, et).replace(he, Ft).replace(ue, Nt);
332
+ function se(s) {
333
+ return s.replace(Jt, xt).replace(Kt, bt).replace(Qt, Q).replace(te, vt).replace(ee, At);
470
334
  }
471
- function de(n) {
472
- return n.replace(ne, "\\\\").replace(se, "{").replace(re, "}").replace(ie, ",").replace(oe, ".");
335
+ function ne(s) {
336
+ return s.replace(qt, "\\\\").replace(Vt, "{").replace(Xt, "}").replace(Yt, ",").replace(Zt, ".");
473
337
  }
474
- function Ot(n) {
475
- if (!n)
338
+ function Ft(s) {
339
+ if (!s)
476
340
  return [""];
477
- const t = [], e = bt("{", "}", n);
341
+ const t = [], e = St("{", "}", s);
478
342
  if (!e)
479
- return n.split(",");
480
- const { pre: s, body: r, post: i } = e, o = s.split(",");
481
- o[o.length - 1] += "{" + r + "}";
482
- const a = Ot(i);
483
- return i.length && (o[o.length - 1] += a.shift(), o.push.apply(o, a)), t.push.apply(t, o), t;
343
+ return s.split(",");
344
+ const { pre: n, body: i, post: r } = e, o = n.split(",");
345
+ o[o.length - 1] += "{" + i + "}";
346
+ const a = Ft(r);
347
+ return r.length && (o[o.length - 1] += a.shift(), o.push.apply(o, a)), t.push.apply(t, o), t;
484
348
  }
485
- function pe(n) {
486
- return n ? (n.slice(0, 2) === "{}" && (n = "\\\\{\\\\}" + n.slice(2)), T(fe(n), !0).map(de)) : [];
349
+ function ie(s) {
350
+ return s ? (s.slice(0, 2) === "{}" && (s = "\\\\{\\\\}" + s.slice(2)), T(se(s), !0).map(ne)) : [];
487
351
  }
488
- function ge(n) {
489
- return "{" + n + "}";
352
+ function re(s) {
353
+ return "{" + s + "}";
490
354
  }
491
- function we(n) {
492
- return /^-?0\\d/.test(n);
355
+ function oe(s) {
356
+ return /^-?0\\d/.test(s);
493
357
  }
494
- function me(n, t) {
495
- return n <= t;
358
+ function ae(s, t) {
359
+ return s <= t;
496
360
  }
497
- function ye(n, t) {
498
- return n >= t;
361
+ function ce(s, t) {
362
+ return s >= t;
499
363
  }
500
- function T(n, t) {
501
- const e = [], s = bt("{", "}", n);
502
- if (!s)
503
- return [n];
504
- const r = s.pre, i = s.post.length ? T(s.post, !1) : [""];
505
- if (/\\$$/.test(s.pre))
506
- for (let o = 0; o < i.length; o++) {
507
- const a = r + "{" + s.body + "}" + i[o];
364
+ function T(s, t) {
365
+ const e = [], n = St("{", "}", s);
366
+ if (!n)
367
+ return [s];
368
+ const i = n.pre, r = n.post.length ? T(n.post, !1) : [""];
369
+ if (/\\$$/.test(n.pre))
370
+ for (let o = 0; o < r.length; o++) {
371
+ const a = i + "{" + n.body + "}" + r[o];
508
372
  e.push(a);
509
373
  }
510
374
  else {
511
- const o = /^-?\\d+\\.\\.-?\\d+(?:\\.\\.-?\\d+)?$/.test(s.body), a = /^[a-zA-Z]\\.\\.[a-zA-Z](?:\\.\\.-?\\d+)?$/.test(s.body), l = o || a, h = s.body.indexOf(",") >= 0;
375
+ 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;
512
376
  if (!l && !h)
513
- return s.post.match(/,(?!,).*\\}/) ? (n = s.pre + "{" + s.body + et + s.post, T(n)) : [n];
377
+ return n.post.match(/,(?!,).*\\}/) ? (s = n.pre + "{" + n.body + Q + n.post, T(s)) : [s];
514
378
  let c;
515
379
  if (l)
516
- c = s.body.split(/\\.\\./);
517
- else if (c = Ot(s.body), c.length === 1 && c[0] !== void 0 && (c = T(c[0], !1).map(ge), c.length === 1))
518
- return i.map((u) => s.pre + c[0] + u);
380
+ c = n.body.split(/\\.\\./);
381
+ else if (c = Ft(n.body), c.length === 1 && c[0] !== void 0 && (c = T(c[0], !1).map(re), c.length === 1))
382
+ return r.map((u) => n.pre + c[0] + u);
519
383
  let f;
520
384
  if (l && c[0] !== void 0 && c[1] !== void 0) {
521
- const u = X(c[0]), d = X(c[1]), w = Math.max(c[0].length, c[1].length);
522
- let g = c.length === 3 && c[2] !== void 0 ? Math.abs(X(c[2])) : 1, S = me;
523
- d < u && (g *= -1, S = ye);
524
- const D = c.some(we);
385
+ const u = V(c[0]), d = V(c[1]), w = Math.max(c[0].length, c[1].length);
386
+ let g = c.length === 3 && c[2] !== void 0 ? Math.abs(V(c[2])) : 1, S = ae;
387
+ d < u && (g *= -1, S = ce);
388
+ const O = c.some(oe);
525
389
  f = [];
526
390
  for (let x = u; S(x, d); x += g) {
527
- let m;
391
+ let y;
528
392
  if (a)
529
- m = String.fromCharCode(x), m === "\\\\" && (m = "");
530
- else if (m = String(x), D) {
531
- const C = w - m.length;
532
- if (C > 0) {
533
- const M = new Array(C + 1).join("0");
534
- x < 0 ? m = "-" + M + m.slice(1) : m = M + m;
393
+ y = String.fromCharCode(x), y === "\\\\" && (y = "");
394
+ else if (y = String(x), O) {
395
+ const $ = w - y.length;
396
+ if ($ > 0) {
397
+ const I = new Array($ + 1).join("0");
398
+ x < 0 ? y = "-" + I + y.slice(1) : y = I + y;
535
399
  }
536
400
  }
537
- f.push(m);
401
+ f.push(y);
538
402
  }
539
403
  } else {
540
404
  f = [];
@@ -542,19 +406,19 @@ function T(n, t) {
542
406
  f.push.apply(f, T(c[u], !1));
543
407
  }
544
408
  for (let u = 0; u < f.length; u++)
545
- for (let d = 0; d < i.length; d++) {
546
- const w = r + f[u] + i[d];
409
+ for (let d = 0; d < r.length; d++) {
410
+ const w = i + f[u] + r[d];
547
411
  (!t || l || w) && e.push(w);
548
412
  }
549
413
  }
550
414
  return e;
551
415
  }
552
- const Ee = 1024 * 64, j = (n) => {
553
- if (typeof n != "string")
416
+ const le = 1024 * 64, U = (s) => {
417
+ if (typeof s != "string")
554
418
  throw new TypeError("invalid pattern");
555
- if (n.length > Ee)
419
+ if (s.length > le)
556
420
  throw new TypeError("pattern is too long");
557
- }, Se = {
421
+ }, he = {
558
422
  "[:alnum:]": ["\\\\p{L}\\\\p{Nl}\\\\p{Nd}", !0],
559
423
  "[:alpha:]": ["\\\\p{L}\\\\p{Nl}", !0],
560
424
  "[:ascii:]": ["\\\\x00-\\\\x7f", !1],
@@ -569,92 +433,92 @@ const Ee = 1024 * 64, j = (n) => {
569
433
  "[:upper:]": ["\\\\p{Lu}", !0],
570
434
  "[:word:]": ["\\\\p{L}\\\\p{Nl}\\\\p{Nd}\\\\p{Pc}", !0],
571
435
  "[:xdigit:]": ["A-Fa-f0-9", !1]
572
- }, $ = (n) => n.replace(/[[\\]\\\\-]/g, "\\\\$&"), xe = (n) => n.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), ot = (n) => n.join(""), be = (n, t) => {
436
+ }, C = (s) => s.replace(/[[\\]\\\\-]/g, "\\\\$&"), ue = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), rt = (s) => s.join(""), fe = (s, t) => {
573
437
  const e = t;
574
- if (n.charAt(e) !== "[")
438
+ if (s.charAt(e) !== "[")
575
439
  throw new Error("not in a brace expression");
576
- const s = [], r = [];
577
- let i = e + 1, o = !1, a = !1, l = !1, h = !1, c = e, f = "";
578
- t: for (; i < n.length; ) {
579
- const g = n.charAt(i);
580
- if ((g === "!" || g === "^") && i === e + 1) {
581
- h = !0, i++;
440
+ const n = [], i = [];
441
+ let r = e + 1, o = !1, a = !1, l = !1, h = !1, c = e, f = "";
442
+ t: for (; r < s.length; ) {
443
+ const g = s.charAt(r);
444
+ if ((g === "!" || g === "^") && r === e + 1) {
445
+ h = !0, r++;
582
446
  continue;
583
447
  }
584
448
  if (g === "]" && o && !l) {
585
- c = i + 1;
449
+ c = r + 1;
586
450
  break;
587
451
  }
588
452
  if (o = !0, g === "\\\\" && !l) {
589
- l = !0, i++;
453
+ l = !0, r++;
590
454
  continue;
591
455
  }
592
456
  if (g === "[" && !l) {
593
- for (const [S, [A, D, x]] of Object.entries(Se))
594
- if (n.startsWith(S, i)) {
457
+ for (const [S, [A, O, x]] of Object.entries(he))
458
+ if (s.startsWith(S, r)) {
595
459
  if (f)
596
- return ["$.", !1, n.length - e, !0];
597
- i += S.length, x ? r.push(A) : s.push(A), a = a || D;
460
+ return ["$.", !1, s.length - e, !0];
461
+ r += S.length, x ? i.push(A) : n.push(A), a = a || O;
598
462
  continue t;
599
463
  }
600
464
  }
601
465
  if (l = !1, f) {
602
- g > f ? s.push($(f) + "-" + $(g)) : g === f && s.push($(g)), f = "", i++;
466
+ g > f ? n.push(C(f) + "-" + C(g)) : g === f && n.push(C(g)), f = "", r++;
603
467
  continue;
604
468
  }
605
- if (n.startsWith("-]", i + 1)) {
606
- s.push($(g + "-")), i += 2;
469
+ if (s.startsWith("-]", r + 1)) {
470
+ n.push(C(g + "-")), r += 2;
607
471
  continue;
608
472
  }
609
- if (n.startsWith("-", i + 1)) {
610
- f = g, i += 2;
473
+ if (s.startsWith("-", r + 1)) {
474
+ f = g, r += 2;
611
475
  continue;
612
476
  }
613
- s.push($(g)), i++;
477
+ n.push(C(g)), r++;
614
478
  }
615
- if (c < i)
479
+ if (c < r)
616
480
  return ["", !1, 0, !1];
617
- if (!s.length && !r.length)
618
- return ["$.", !1, n.length - e, !0];
619
- if (r.length === 0 && s.length === 1 && /^\\\\?.$/.test(s[0]) && !h) {
620
- const g = s[0].length === 2 ? s[0].slice(-1) : s[0];
621
- return [xe(g), !1, c - e, !1];
622
- }
623
- const u = "[" + (h ? "^" : "") + ot(s) + "]", d = "[" + (h ? "" : "^") + ot(r) + "]";
624
- return [s.length && r.length ? "(" + u + "|" + d + ")" : s.length ? u : d, a, c - e, !0];
625
- }, I = (n, { windowsPathsNoEscape: t = !1 } = {}) => t ? n.replace(/\\[([^\\/\\\\])\\]/g, "$1") : n.replace(/((?!\\\\).|^)\\[([^\\/\\\\])\\]/g, "$1$2").replace(/\\\\([^\\/])/g, "$1"), ve = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), at = (n) => ve.has(n), Ae = "(?!(?:^|/)\\\\.\\\\.?(?:$|/))", R = "(?!\\\\.)", Fe = /* @__PURE__ */ new Set(["[", "."]), Ne = /* @__PURE__ */ new Set(["..", "."]), Oe = new Set("().*{}+?[]^$\\\\!"), De = (n) => n.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&"), nt = "[^/]", ct = nt + "*?", lt = nt + "+?";
481
+ if (!n.length && !i.length)
482
+ return ["$.", !1, s.length - e, !0];
483
+ if (i.length === 0 && n.length === 1 && /^\\\\?.$/.test(n[0]) && !h) {
484
+ const g = n[0].length === 2 ? n[0].slice(-1) : n[0];
485
+ return [ue(g), !1, c - e, !1];
486
+ }
487
+ const u = "[" + (h ? "^" : "") + rt(n) + "]", d = "[" + (h ? "" : "^") + rt(i) + "]";
488
+ return [n.length && i.length ? "(" + u + "|" + d + ")" : n.length ? u : d, a, c - e, !0];
489
+ }, 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 + "+?";
626
490
  class E {
627
491
  type;
628
- #n;
629
492
  #s;
630
- #i = !1;
493
+ #n;
494
+ #r = !1;
631
495
  #t = [];
632
496
  #e;
633
497
  #o;
634
498
  #c;
635
499
  #a = !1;
636
- #r;
500
+ #i;
637
501
  #l;
638
502
  // set to true if it's an extglob with no children
639
503
  // (which really means one child of '')
640
504
  #u = !1;
641
- constructor(t, e, s = {}) {
642
- this.type = t, t && (this.#s = !0), this.#e = e, this.#n = this.#e ? this.#e.#n : this, this.#r = this.#n === this ? s : this.#n.#r, this.#c = this.#n === this ? [] : this.#n.#c, t === "!" && !this.#n.#a && this.#c.push(this), this.#o = this.#e ? this.#e.#t.length : 0;
505
+ constructor(t, e, n = {}) {
506
+ this.type = t, t && (this.#n = !0), this.#e = e, this.#s = this.#e ? this.#e.#s : this, this.#i = this.#s === this ? n : this.#s.#i, this.#c = this.#s === this ? [] : this.#s.#c, t === "!" && !this.#s.#a && this.#c.push(this), this.#o = this.#e ? this.#e.#t.length : 0;
643
507
  }
644
508
  get hasMagic() {
645
- if (this.#s !== void 0)
646
- return this.#s;
509
+ if (this.#n !== void 0)
510
+ return this.#n;
647
511
  for (const t of this.#t)
648
512
  if (typeof t != "string" && (t.type || t.hasMagic))
649
- return this.#s = !0;
650
- return this.#s;
513
+ return this.#n = !0;
514
+ return this.#n;
651
515
  }
652
516
  // reconstructs the pattern
653
517
  toString() {
654
518
  return this.#l !== void 0 ? this.#l : this.type ? this.#l = this.type + "(" + this.#t.map((t) => String(t)).join("|") + ")" : this.#l = this.#t.map((t) => String(t)).join("");
655
519
  }
656
520
  #d() {
657
- if (this !== this.#n)
521
+ if (this !== this.#s)
658
522
  throw new Error("should only call on root");
659
523
  if (this.#a)
660
524
  return this;
@@ -663,15 +527,15 @@ class E {
663
527
  for (; t = this.#c.pop(); ) {
664
528
  if (t.type !== "!")
665
529
  continue;
666
- let e = t, s = e.#e;
667
- for (; s; ) {
668
- for (let r = e.#o + 1; !s.type && r < s.#t.length; r++)
669
- for (const i of t.#t) {
670
- if (typeof i == "string")
530
+ let e = t, n = e.#e;
531
+ for (; n; ) {
532
+ for (let i = e.#o + 1; !n.type && i < n.#t.length; i++)
533
+ for (const r of t.#t) {
534
+ if (typeof r == "string")
671
535
  throw new Error("string part in extglob AST??");
672
- i.copyIn(s.#t[r]);
536
+ r.copyIn(n.#t[i]);
673
537
  }
674
- e = s, s = e.#e;
538
+ e = n, n = e.#e;
675
539
  }
676
540
  }
677
541
  return this;
@@ -686,10 +550,10 @@ class E {
686
550
  }
687
551
  toJSON() {
688
552
  const t = this.type === null ? this.#t.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#t.map((e) => e.toJSON())];
689
- return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#n || this.#n.#a && this.#e?.type === "!") && t.push({}), t;
553
+ return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#s || this.#s.#a && this.#e?.type === "!") && t.push({}), t;
690
554
  }
691
555
  isStart() {
692
- if (this.#n === this)
556
+ if (this.#s === this)
693
557
  return !0;
694
558
  if (!this.#e?.isStart())
695
559
  return !1;
@@ -697,14 +561,14 @@ class E {
697
561
  return !0;
698
562
  const t = this.#e;
699
563
  for (let e = 0; e < this.#o; e++) {
700
- const s = t.#t[e];
701
- if (!(s instanceof E && s.type === "!"))
564
+ const n = t.#t[e];
565
+ if (!(n instanceof E && n.type === "!"))
702
566
  return !1;
703
567
  }
704
568
  return !0;
705
569
  }
706
570
  isEnd() {
707
- if (this.#n === this || this.#e?.type === "!")
571
+ if (this.#s === this || this.#e?.type === "!")
708
572
  return !0;
709
573
  if (!this.#e?.isEnd())
710
574
  return !1;
@@ -718,18 +582,18 @@ class E {
718
582
  }
719
583
  clone(t) {
720
584
  const e = new E(this.type, t);
721
- for (const s of this.#t)
722
- e.copyIn(s);
585
+ for (const n of this.#t)
586
+ e.copyIn(n);
723
587
  return e;
724
588
  }
725
- static #h(t, e, s, r) {
726
- let i = !1, o = !1, a = -1, l = !1;
589
+ static #h(t, e, n, i) {
590
+ let r = !1, o = !1, a = -1, l = !1;
727
591
  if (e.type === null) {
728
- let d = s, w = "";
592
+ let d = n, w = "";
729
593
  for (; d < t.length; ) {
730
594
  const g = t.charAt(d++);
731
- if (i || g === "\\\\") {
732
- i = !i, w += g;
595
+ if (r || g === "\\\\") {
596
+ r = !r, w += g;
733
597
  continue;
734
598
  }
735
599
  if (o) {
@@ -739,23 +603,23 @@ class E {
739
603
  o = !0, a = d, l = !1, w += g;
740
604
  continue;
741
605
  }
742
- if (!r.noext && at(g) && t.charAt(d) === "(") {
606
+ if (!i.noext && ot(g) && t.charAt(d) === "(") {
743
607
  e.push(w), w = "";
744
608
  const S = new E(g, e);
745
- d = E.#h(t, S, d, r), e.push(S);
609
+ d = E.#h(t, S, d, i), e.push(S);
746
610
  continue;
747
611
  }
748
612
  w += g;
749
613
  }
750
614
  return e.push(w), d;
751
615
  }
752
- let h = s + 1, c = new E(null, e);
616
+ let h = n + 1, c = new E(null, e);
753
617
  const f = [];
754
618
  let u = "";
755
619
  for (; h < t.length; ) {
756
620
  const d = t.charAt(h++);
757
- if (i || d === "\\\\") {
758
- i = !i, u += d;
621
+ if (r || d === "\\\\") {
622
+ r = !r, u += d;
759
623
  continue;
760
624
  }
761
625
  if (o) {
@@ -765,10 +629,10 @@ class E {
765
629
  o = !0, a = h, l = !1, u += d;
766
630
  continue;
767
631
  }
768
- if (at(d) && t.charAt(h) === "(") {
632
+ if (ot(d) && t.charAt(h) === "(") {
769
633
  c.push(u), u = "";
770
634
  const w = new E(d, c);
771
- c.push(w), h = E.#h(t, w, h, r);
635
+ c.push(w), h = E.#h(t, w, h, i);
772
636
  continue;
773
637
  }
774
638
  if (d === "|") {
@@ -779,28 +643,28 @@ class E {
779
643
  return u === "" && e.#t.length === 0 && (e.#u = !0), c.push(u), u = "", e.push(...f, c), h;
780
644
  u += d;
781
645
  }
782
- return e.type = null, e.#s = void 0, e.#t = [t.substring(s - 1)], h;
646
+ return e.type = null, e.#n = void 0, e.#t = [t.substring(n - 1)], h;
783
647
  }
784
648
  static fromGlob(t, e = {}) {
785
- const s = new E(null, void 0, e);
786
- return E.#h(t, s, 0, e), s;
649
+ const n = new E(null, void 0, e);
650
+ return E.#h(t, n, 0, e), n;
787
651
  }
788
652
  // returns the regular expression if there's magic, or the unescaped
789
653
  // string if not.
790
654
  toMMPattern() {
791
- if (this !== this.#n)
792
- return this.#n.toMMPattern();
793
- const t = this.toString(), [e, s, r, i] = this.toRegExpSource();
794
- if (!(r || this.#s || this.#r.nocase && !this.#r.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase()))
795
- return s;
796
- const a = (this.#r.nocase ? "i" : "") + (i ? "u" : "");
655
+ if (this !== this.#s)
656
+ return this.#s.toMMPattern();
657
+ const t = this.toString(), [e, n, i, r] = this.toRegExpSource();
658
+ if (!(i || this.#n || this.#i.nocase && !this.#i.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase()))
659
+ return n;
660
+ const a = (this.#i.nocase ? "i" : "") + (r ? "u" : "");
797
661
  return Object.assign(new RegExp(\`^\${e}$\`, a), {
798
662
  _src: e,
799
663
  _glob: t
800
664
  });
801
665
  }
802
666
  get options() {
803
- return this.#r;
667
+ return this.#i;
804
668
  }
805
669
  // returns the string match, the regexp source, whether there's magic
806
670
  // in the regexp (so a regular expression is required) and whether or
@@ -872,168 +736,168 @@ class E {
872
736
  // is ^(?!\\.), we can just prepend (?!\\.) to the pattern (either root
873
737
  // or start or whatever) and prepend ^ or / at the Regexp construction.
874
738
  toRegExpSource(t) {
875
- const e = t ?? !!this.#r.dot;
876
- if (this.#n === this && this.#d(), !this.type) {
739
+ const e = t ?? !!this.#i.dot;
740
+ if (this.#s === this && this.#d(), !this.type) {
877
741
  const l = this.isStart() && this.isEnd(), h = this.#t.map((d) => {
878
- const [w, g, S, A] = typeof d == "string" ? E.#p(d, this.#s, l) : d.toRegExpSource(t);
879
- return this.#s = this.#s || S, this.#i = this.#i || A, w;
742
+ const [w, g, S, A] = typeof d == "string" ? E.#p(d, this.#n, l) : d.toRegExpSource(t);
743
+ return this.#n = this.#n || S, this.#r = this.#r || A, w;
880
744
  }).join("");
881
745
  let c = "";
882
- if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && Ne.has(this.#t[0]))) {
883
- const w = Fe, g = (
746
+ if (this.isStart() && typeof this.#t[0] == "string" && !(this.#t.length === 1 && we.has(this.#t[0]))) {
747
+ const w = ge, g = (
884
748
  // dots are allowed, and the pattern starts with [ or .
885
749
  e && w.has(h.charAt(0)) || // the pattern starts with \\., and then [ or .
886
750
  h.startsWith("\\\\.") && w.has(h.charAt(2)) || // the pattern starts with \\.\\., and then [ or .
887
751
  h.startsWith("\\\\.\\\\.") && w.has(h.charAt(4))
888
752
  ), S = !e && !t && w.has(h.charAt(0));
889
- c = g ? Ae : S ? R : "";
753
+ c = g ? pe : S ? L : "";
890
754
  }
891
755
  let f = "";
892
- return this.isEnd() && this.#n.#a && this.#e?.type === "!" && (f = "(?:$|\\\\/)"), [
756
+ return this.isEnd() && this.#s.#a && this.#e?.type === "!" && (f = "(?:$|\\\\/)"), [
893
757
  c + h + f,
894
- I(h),
895
- this.#s = !!this.#s,
896
- this.#i
758
+ M(h),
759
+ this.#n = !!this.#n,
760
+ this.#r
897
761
  ];
898
762
  }
899
- const s = this.type === "*" || this.type === "+", r = this.type === "!" ? "(?:(?!(?:" : "(?:";
900
- let i = this.#f(e);
901
- if (this.isStart() && this.isEnd() && !i && this.type !== "!") {
763
+ const n = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:";
764
+ let r = this.#f(e);
765
+ if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
902
766
  const l = this.toString();
903
- return this.#t = [l], this.type = null, this.#s = void 0, [l, I(this.toString()), !1, !1];
767
+ return this.#t = [l], this.type = null, this.#n = void 0, [l, M(this.toString()), !1, !1];
904
768
  }
905
- let o = !s || t || e || !R ? "" : this.#f(!0);
906
- o === i && (o = ""), o && (i = \`(?:\${i})(?:\${o})*?\`);
769
+ let o = !n || t || e || !L ? "" : this.#f(!0);
770
+ o === r && (o = ""), o && (r = \`(?:\${r})(?:\${o})*?\`);
907
771
  let a = "";
908
772
  if (this.type === "!" && this.#u)
909
- a = (this.isStart() && !e ? R : "") + lt;
773
+ a = (this.isStart() && !e ? L : "") + ct;
910
774
  else {
911
775
  const l = this.type === "!" ? (
912
776
  // !() must match something,but !(x) can match ''
913
- "))" + (this.isStart() && !e && !t ? R : "") + ct + ")"
777
+ "))" + (this.isStart() && !e && !t ? L : "") + at + ")"
914
778
  ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : \`)\${this.type}\`;
915
- a = r + i + l;
779
+ a = i + r + l;
916
780
  }
917
781
  return [
918
782
  a,
919
- I(i),
920
- this.#s = !!this.#s,
921
- this.#i
783
+ M(r),
784
+ this.#n = !!this.#n,
785
+ this.#r
922
786
  ];
923
787
  }
924
788
  #f(t) {
925
789
  return this.#t.map((e) => {
926
790
  if (typeof e == "string")
927
791
  throw new Error("string type in extglob ast??");
928
- const [s, r, i, o] = e.toRegExpSource(t);
929
- return this.#i = this.#i || o, s;
792
+ const [n, i, r, o] = e.toRegExpSource(t);
793
+ return this.#r = this.#r || o, n;
930
794
  }).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
931
795
  }
932
- static #p(t, e, s = !1) {
933
- let r = !1, i = "", o = !1;
796
+ static #p(t, e, n = !1) {
797
+ let i = !1, r = "", o = !1;
934
798
  for (let a = 0; a < t.length; a++) {
935
799
  const l = t.charAt(a);
936
- if (r) {
937
- r = !1, i += (Oe.has(l) ? "\\\\" : "") + l;
800
+ if (i) {
801
+ i = !1, r += (ye.has(l) ? "\\\\" : "") + l;
938
802
  continue;
939
803
  }
940
804
  if (l === "\\\\") {
941
- a === t.length - 1 ? i += "\\\\\\\\" : r = !0;
805
+ a === t.length - 1 ? r += "\\\\\\\\" : i = !0;
942
806
  continue;
943
807
  }
944
808
  if (l === "[") {
945
- const [h, c, f, u] = be(t, a);
809
+ const [h, c, f, u] = fe(t, a);
946
810
  if (f) {
947
- i += h, o = o || c, a += f - 1, e = e || u;
811
+ r += h, o = o || c, a += f - 1, e = e || u;
948
812
  continue;
949
813
  }
950
814
  }
951
815
  if (l === "*") {
952
- s && t === "*" ? i += lt : i += ct, e = !0;
816
+ n && t === "*" ? r += ct : r += at, e = !0;
953
817
  continue;
954
818
  }
955
819
  if (l === "?") {
956
- i += nt, e = !0;
820
+ r += tt, e = !0;
957
821
  continue;
958
822
  }
959
- i += De(l);
823
+ r += me(l);
960
824
  }
961
- return [i, I(t), !!e, o];
962
- }
963
- }
964
- const Ce = (n, { windowsPathsNoEscape: t = !1 } = {}) => t ? n.replace(/[?*()[\\]]/g, "[$&]") : n.replace(/[?*()[\\]\\\\]/g, "\\\\$&"), y = (n, t, e = {}) => (j(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new U(t, e).match(n)), $e = /^\\*+([^+@!?\\*\\[\\(]*)$/, Te = (n) => (t) => !t.startsWith(".") && t.endsWith(n), Ie = (n) => (t) => t.endsWith(n), Me = (n) => (n = n.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n)), Pe = (n) => (n = n.toLowerCase(), (t) => t.toLowerCase().endsWith(n)), ke = /^\\*+\\.\\*+$/, Re = (n) => !n.startsWith(".") && n.includes("."), Le = (n) => n !== "." && n !== ".." && n.includes("."), He = /^\\.\\*+$/, ze = (n) => n !== "." && n !== ".." && n.startsWith("."), _e = /^\\*+$/, We = (n) => n.length !== 0 && !n.startsWith("."), je = (n) => n.length !== 0 && n !== "." && n !== "..", Ue = /^\\?+([^+@!?\\*\\[\\(]*)?$/, Be = ([n, t = ""]) => {
965
- const e = Dt([n]);
966
- return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
967
- }, Ge = ([n, t = ""]) => {
968
- const e = Ct([n]);
969
- return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
970
- }, qe = ([n, t = ""]) => {
971
- const e = Ct([n]);
972
- return t ? (s) => e(s) && s.endsWith(t) : e;
973
- }, Ve = ([n, t = ""]) => {
974
- const e = Dt([n]);
975
- return t ? (s) => e(s) && s.endsWith(t) : e;
976
- }, Dt = ([n]) => {
977
- const t = n.length;
825
+ return [r, M(t), !!e, o];
826
+ }
827
+ }
828
+ 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 = ""]) => {
829
+ const e = Nt([s]);
830
+ return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
831
+ }, ke = ([s, t = ""]) => {
832
+ const e = Dt([s]);
833
+ return t ? (t = t.toLowerCase(), (n) => e(n) && n.toLowerCase().endsWith(t)) : e;
834
+ }, Re = ([s, t = ""]) => {
835
+ const e = Dt([s]);
836
+ return t ? (n) => e(n) && n.endsWith(t) : e;
837
+ }, Le = ([s, t = ""]) => {
838
+ const e = Nt([s]);
839
+ return t ? (n) => e(n) && n.endsWith(t) : e;
840
+ }, Nt = ([s]) => {
841
+ const t = s.length;
978
842
  return (e) => e.length === t && !e.startsWith(".");
979
- }, Ct = ([n]) => {
980
- const t = n.length;
843
+ }, Dt = ([s]) => {
844
+ const t = s.length;
981
845
  return (e) => e.length === t && e !== "." && e !== "..";
982
- }, $t = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", ht = {
846
+ }, Ot = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", lt = {
983
847
  win32: { sep: "\\\\" },
984
848
  posix: { sep: "/" }
985
- }, Xe = $t === "win32" ? ht.win32.sep : ht.posix.sep;
986
- y.sep = Xe;
849
+ }, ze = Ot === "win32" ? lt.win32.sep : lt.posix.sep;
850
+ m.sep = ze;
987
851
  const v = Symbol("globstar **");
988
- y.GLOBSTAR = v;
989
- const Ye = "[^/]", Ze = Ye + "*?", Je = "(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?", Ke = "(?:(?!(?:\\\\/|^)\\\\.).)*?", Qe = (n, t = {}) => (e) => y(e, n, t);
990
- y.filter = Qe;
991
- const b = (n, t = {}) => Object.assign({}, n, t), tn = (n) => {
992
- if (!n || typeof n != "object" || !Object.keys(n).length)
993
- return y;
994
- const t = y;
995
- return Object.assign((s, r, i = {}) => t(s, r, b(n, i)), {
852
+ m.GLOBSTAR = v;
853
+ const He = "[^/]", We = He + "*?", _e = "(?:(?!(?:\\\\/|^)(?:\\\\.{1,2})($|\\\\/)).)*?", je = "(?:(?!(?:\\\\/|^)\\\\.).)*?", Be = (s, t = {}) => (e) => m(e, s, t);
854
+ m.filter = Be;
855
+ const b = (s, t = {}) => Object.assign({}, s, t), Ue = (s) => {
856
+ if (!s || typeof s != "object" || !Object.keys(s).length)
857
+ return m;
858
+ const t = m;
859
+ return Object.assign((n, i, r = {}) => t(n, i, b(s, r)), {
996
860
  Minimatch: class extends t.Minimatch {
997
- constructor(r, i = {}) {
998
- super(r, b(n, i));
861
+ constructor(i, r = {}) {
862
+ super(i, b(s, r));
999
863
  }
1000
- static defaults(r) {
1001
- return t.defaults(b(n, r)).Minimatch;
864
+ static defaults(i) {
865
+ return t.defaults(b(s, i)).Minimatch;
1002
866
  }
1003
867
  },
1004
868
  AST: class extends t.AST {
1005
869
  /* c8 ignore start */
1006
- constructor(r, i, o = {}) {
1007
- super(r, i, b(n, o));
870
+ constructor(i, r, o = {}) {
871
+ super(i, r, b(s, o));
1008
872
  }
1009
873
  /* c8 ignore stop */
1010
- static fromGlob(r, i = {}) {
1011
- return t.AST.fromGlob(r, b(n, i));
874
+ static fromGlob(i, r = {}) {
875
+ return t.AST.fromGlob(i, b(s, r));
1012
876
  }
1013
877
  },
1014
- unescape: (s, r = {}) => t.unescape(s, b(n, r)),
1015
- escape: (s, r = {}) => t.escape(s, b(n, r)),
1016
- filter: (s, r = {}) => t.filter(s, b(n, r)),
1017
- defaults: (s) => t.defaults(b(n, s)),
1018
- makeRe: (s, r = {}) => t.makeRe(s, b(n, r)),
1019
- braceExpand: (s, r = {}) => t.braceExpand(s, b(n, r)),
1020
- match: (s, r, i = {}) => t.match(s, r, b(n, i)),
878
+ unescape: (n, i = {}) => t.unescape(n, b(s, i)),
879
+ escape: (n, i = {}) => t.escape(n, b(s, i)),
880
+ filter: (n, i = {}) => t.filter(n, b(s, i)),
881
+ defaults: (n) => t.defaults(b(s, n)),
882
+ makeRe: (n, i = {}) => t.makeRe(n, b(s, i)),
883
+ braceExpand: (n, i = {}) => t.braceExpand(n, b(s, i)),
884
+ match: (n, i, r = {}) => t.match(n, i, b(s, r)),
1021
885
  sep: t.sep,
1022
886
  GLOBSTAR: v
1023
887
  });
1024
888
  };
1025
- y.defaults = tn;
1026
- const Tt = (n, t = {}) => (j(n), t.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(n) ? [n] : pe(n));
1027
- y.braceExpand = Tt;
1028
- const en = (n, t = {}) => new U(n, t).makeRe();
1029
- y.makeRe = en;
1030
- const nn = (n, t, e = {}) => {
1031
- const s = new U(t, e);
1032
- return n = n.filter((r) => s.match(r)), s.options.nonull && !n.length && n.push(t), n;
889
+ m.defaults = Ue;
890
+ const $t = (s, t = {}) => (U(s), t.nobrace || !/\\{(?:(?!\\{).)*\\}/.test(s) ? [s] : ie(s));
891
+ m.braceExpand = $t;
892
+ const Ge = (s, t = {}) => new G(s, t).makeRe();
893
+ m.makeRe = Ge;
894
+ const qe = (s, t, e = {}) => {
895
+ const n = new G(t, e);
896
+ return s = s.filter((i) => n.match(i)), n.options.nonull && !s.length && s.push(t), s;
1033
897
  };
1034
- y.match = nn;
1035
- const ut = /[?*]|[+@!]\\(.*?\\)|\\[|\\]/, sn = (n) => n.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&");
1036
- class U {
898
+ m.match = qe;
899
+ const ht = /[?*]|[+@!]\\(.*?\\)|\\[|\\]/, Ve = (s) => s.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, "\\\\$&");
900
+ class G {
1037
901
  options;
1038
902
  set;
1039
903
  pattern;
@@ -1052,7 +916,7 @@ class U {
1052
916
  windowsNoMagicRoot;
1053
917
  regexp;
1054
918
  constructor(t, e = {}) {
1055
- j(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();
919
+ 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();
1056
920
  }
1057
921
  hasMagic() {
1058
922
  if (this.options.magicalBraces && this.set.length > 1)
@@ -1075,23 +939,23 @@ class U {
1075
939
  this.empty = !0;
1076
940
  return;
1077
941
  }
1078
- this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...i) => console.error(...i)), this.debug(this.pattern, this.globSet);
1079
- const s = this.globSet.map((i) => this.slashSplit(i));
1080
- this.globParts = this.preprocess(s), this.debug(this.pattern, this.globParts);
1081
- let r = this.globParts.map((i, o, a) => {
942
+ this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(this.pattern, this.globSet);
943
+ const n = this.globSet.map((r) => this.slashSplit(r));
944
+ this.globParts = this.preprocess(n), this.debug(this.pattern, this.globParts);
945
+ let i = this.globParts.map((r, o, a) => {
1082
946
  if (this.isWindows && this.windowsNoMagicRoot) {
1083
- const l = i[0] === "" && i[1] === "" && (i[2] === "?" || !ut.test(i[2])) && !ut.test(i[3]), h = /^[a-z]:/i.test(i[0]);
947
+ const l = r[0] === "" && r[1] === "" && (r[2] === "?" || !ht.test(r[2])) && !ht.test(r[3]), h = /^[a-z]:/i.test(r[0]);
1084
948
  if (l)
1085
- return [...i.slice(0, 4), ...i.slice(4).map((c) => this.parse(c))];
949
+ return [...r.slice(0, 4), ...r.slice(4).map((c) => this.parse(c))];
1086
950
  if (h)
1087
- return [i[0], ...i.slice(1).map((c) => this.parse(c))];
951
+ return [r[0], ...r.slice(1).map((c) => this.parse(c))];
1088
952
  }
1089
- return i.map((l) => this.parse(l));
953
+ return r.map((l) => this.parse(l));
1090
954
  });
1091
- if (this.debug(this.pattern, r), this.set = r.filter((i) => i.indexOf(!1) === -1), this.isWindows)
1092
- for (let i = 0; i < this.set.length; i++) {
1093
- const o = this.set[i];
1094
- o[0] === "" && o[1] === "" && this.globParts[i][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
955
+ if (this.debug(this.pattern, i), this.set = i.filter((r) => r.indexOf(!1) === -1), this.isWindows)
956
+ for (let r = 0; r < this.set.length; r++) {
957
+ const o = this.set[r];
958
+ o[0] === "" && o[1] === "" && this.globParts[r][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
1095
959
  }
1096
960
  this.debug(this.pattern, this.set);
1097
961
  }
@@ -1102,30 +966,30 @@ class U {
1102
966
  // of patterns that we have to process.
1103
967
  preprocess(t) {
1104
968
  if (this.options.noglobstar)
1105
- for (let s = 0; s < t.length; s++)
1106
- for (let r = 0; r < t[s].length; r++)
1107
- t[s][r] === "**" && (t[s][r] = "*");
969
+ for (let n = 0; n < t.length; n++)
970
+ for (let i = 0; i < t[n].length; i++)
971
+ t[n][i] === "**" && (t[n][i] = "*");
1108
972
  const { optimizationLevel: e = 1 } = this.options;
1109
973
  return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t;
1110
974
  }
1111
975
  // just get rid of adjascent ** portions
1112
976
  adjascentGlobstarOptimize(t) {
1113
977
  return t.map((e) => {
1114
- let s = -1;
1115
- for (; (s = e.indexOf("**", s + 1)) !== -1; ) {
1116
- let r = s;
1117
- for (; e[r + 1] === "**"; )
1118
- r++;
1119
- r !== s && e.splice(s, r - s);
978
+ let n = -1;
979
+ for (; (n = e.indexOf("**", n + 1)) !== -1; ) {
980
+ let i = n;
981
+ for (; e[i + 1] === "**"; )
982
+ i++;
983
+ i !== n && e.splice(n, i - n);
1120
984
  }
1121
985
  return e;
1122
986
  });
1123
987
  }
1124
988
  // get rid of adjascent ** and resolve .. portions
1125
989
  levelOneOptimize(t) {
1126
- return t.map((e) => (e = e.reduce((s, r) => {
1127
- const i = s[s.length - 1];
1128
- return r === "**" && i === "**" ? s : r === ".." && i && i !== ".." && i !== "." && i !== "**" ? (s.pop(), s) : (s.push(r), s);
990
+ return t.map((e) => (e = e.reduce((n, i) => {
991
+ const r = n[n.length - 1];
992
+ return i === "**" && r === "**" ? n : i === ".." && r && r !== ".." && r !== "." && r !== "**" ? (n.pop(), n) : (n.push(i), n);
1129
993
  }, []), e.length === 0 ? [""] : e));
1130
994
  }
1131
995
  levelTwoFileOptimize(t) {
@@ -1133,16 +997,16 @@ class U {
1133
997
  let e = !1;
1134
998
  do {
1135
999
  if (e = !1, !this.preserveMultipleSlashes) {
1136
- for (let r = 1; r < t.length - 1; r++) {
1137
- const i = t[r];
1138
- r === 1 && i === "" && t[0] === "" || (i === "." || i === "") && (e = !0, t.splice(r, 1), r--);
1000
+ for (let i = 1; i < t.length - 1; i++) {
1001
+ const r = t[i];
1002
+ i === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = !0, t.splice(i, 1), i--);
1139
1003
  }
1140
1004
  t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = !0, t.pop());
1141
1005
  }
1142
- let s = 0;
1143
- for (; (s = t.indexOf("..", s + 1)) !== -1; ) {
1144
- const r = t[s - 1];
1145
- r && r !== "." && r !== ".." && r !== "**" && (e = !0, t.splice(s - 1, 2), s -= 2);
1006
+ let n = 0;
1007
+ for (; (n = t.indexOf("..", n + 1)) !== -1; ) {
1008
+ const i = t[n - 1];
1009
+ i && i !== "." && i !== ".." && i !== "**" && (e = !0, t.splice(n - 1, 2), n -= 2);
1146
1010
  }
1147
1011
  } while (e);
1148
1012
  return t.length === 0 ? [""] : t;
@@ -1169,35 +1033,35 @@ class U {
1169
1033
  let e = !1;
1170
1034
  do {
1171
1035
  e = !1;
1172
- for (let s of t) {
1173
- let r = -1;
1174
- for (; (r = s.indexOf("**", r + 1)) !== -1; ) {
1175
- let o = r;
1176
- for (; s[o + 1] === "**"; )
1036
+ for (let n of t) {
1037
+ let i = -1;
1038
+ for (; (i = n.indexOf("**", i + 1)) !== -1; ) {
1039
+ let o = i;
1040
+ for (; n[o + 1] === "**"; )
1177
1041
  o++;
1178
- o > r && s.splice(r + 1, o - r);
1179
- let a = s[r + 1];
1180
- const l = s[r + 2], h = s[r + 3];
1042
+ o > i && n.splice(i + 1, o - i);
1043
+ let a = n[i + 1];
1044
+ const l = n[i + 2], h = n[i + 3];
1181
1045
  if (a !== ".." || !l || l === "." || l === ".." || !h || h === "." || h === "..")
1182
1046
  continue;
1183
- e = !0, s.splice(r, 1);
1184
- const c = s.slice(0);
1185
- c[r] = "**", t.push(c), r--;
1047
+ e = !0, n.splice(i, 1);
1048
+ const c = n.slice(0);
1049
+ c[i] = "**", t.push(c), i--;
1186
1050
  }
1187
1051
  if (!this.preserveMultipleSlashes) {
1188
- for (let o = 1; o < s.length - 1; o++) {
1189
- const a = s[o];
1190
- o === 1 && a === "" && s[0] === "" || (a === "." || a === "") && (e = !0, s.splice(o, 1), o--);
1052
+ for (let o = 1; o < n.length - 1; o++) {
1053
+ const a = n[o];
1054
+ o === 1 && a === "" && n[0] === "" || (a === "." || a === "") && (e = !0, n.splice(o, 1), o--);
1191
1055
  }
1192
- s[0] === "." && s.length === 2 && (s[1] === "." || s[1] === "") && (e = !0, s.pop());
1056
+ n[0] === "." && n.length === 2 && (n[1] === "." || n[1] === "") && (e = !0, n.pop());
1193
1057
  }
1194
- let i = 0;
1195
- for (; (i = s.indexOf("..", i + 1)) !== -1; ) {
1196
- const o = s[i - 1];
1058
+ let r = 0;
1059
+ for (; (r = n.indexOf("..", r + 1)) !== -1; ) {
1060
+ const o = n[r - 1];
1197
1061
  if (o && o !== "." && o !== ".." && o !== "**") {
1198
1062
  e = !0;
1199
- const l = i === 1 && s[i + 1] === "**" ? ["."] : [];
1200
- s.splice(i - 1, 2, ...l), s.length === 0 && s.push(""), i -= 2;
1063
+ const l = r === 1 && n[r + 1] === "**" ? ["."] : [];
1064
+ n.splice(r - 1, 2, ...l), n.length === 0 && n.push(""), r -= 2;
1201
1065
  }
1202
1066
  }
1203
1067
  }
@@ -1213,32 +1077,32 @@ class U {
1213
1077
  // ^-- not valid because ** doens't follow symlinks
1214
1078
  secondPhasePreProcess(t) {
1215
1079
  for (let e = 0; e < t.length - 1; e++)
1216
- for (let s = e + 1; s < t.length; s++) {
1217
- const r = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
1218
- if (r) {
1219
- t[e] = [], t[s] = r;
1080
+ for (let n = e + 1; n < t.length; n++) {
1081
+ const i = this.partsMatch(t[e], t[n], !this.preserveMultipleSlashes);
1082
+ if (i) {
1083
+ t[e] = [], t[n] = i;
1220
1084
  break;
1221
1085
  }
1222
1086
  }
1223
1087
  return t.filter((e) => e.length);
1224
1088
  }
1225
- partsMatch(t, e, s = !1) {
1226
- let r = 0, i = 0, o = [], a = "";
1227
- for (; r < t.length && i < e.length; )
1228
- if (t[r] === e[i])
1229
- o.push(a === "b" ? e[i] : t[r]), r++, i++;
1230
- else if (s && t[r] === "**" && e[i] === t[r + 1])
1231
- o.push(t[r]), r++;
1232
- else if (s && e[i] === "**" && t[r] === e[i + 1])
1233
- o.push(e[i]), i++;
1234
- else if (t[r] === "*" && e[i] && (this.options.dot || !e[i].startsWith(".")) && e[i] !== "**") {
1089
+ partsMatch(t, e, n = !1) {
1090
+ let i = 0, r = 0, o = [], a = "";
1091
+ for (; i < t.length && r < e.length; )
1092
+ if (t[i] === e[r])
1093
+ o.push(a === "b" ? e[r] : t[i]), i++, r++;
1094
+ else if (n && t[i] === "**" && e[r] === t[i + 1])
1095
+ o.push(t[i]), i++;
1096
+ else if (n && e[r] === "**" && t[i] === e[r + 1])
1097
+ o.push(e[r]), r++;
1098
+ else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
1235
1099
  if (a === "b")
1236
1100
  return !1;
1237
- a = "a", o.push(t[r]), r++, i++;
1238
- } else if (e[i] === "*" && t[r] && (this.options.dot || !t[r].startsWith(".")) && t[r] !== "**") {
1101
+ a = "a", o.push(t[i]), i++, r++;
1102
+ } else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
1239
1103
  if (a === "a")
1240
1104
  return !1;
1241
- a = "b", o.push(e[i]), r++, i++;
1105
+ a = "b", o.push(e[r]), i++, r++;
1242
1106
  } else
1243
1107
  return !1;
1244
1108
  return t.length === e.length && o;
@@ -1247,27 +1111,27 @@ class U {
1247
1111
  if (this.nonegate)
1248
1112
  return;
1249
1113
  const t = this.pattern;
1250
- let e = !1, s = 0;
1251
- for (let r = 0; r < t.length && t.charAt(r) === "!"; r++)
1252
- e = !e, s++;
1253
- s && (this.pattern = t.slice(s)), this.negate = e;
1114
+ let e = !1, n = 0;
1115
+ for (let i = 0; i < t.length && t.charAt(i) === "!"; i++)
1116
+ e = !e, n++;
1117
+ n && (this.pattern = t.slice(n)), this.negate = e;
1254
1118
  }
1255
1119
  // set partial to true to test if, for example,
1256
1120
  // "/a/b" matches the start of "/*/b/*/d"
1257
1121
  // Partial means, if you run out of file before you run
1258
1122
  // out of pattern, then that's fine, as long as all
1259
1123
  // the parts match.
1260
- matchOne(t, e, s = !1) {
1261
- const r = this.options;
1124
+ matchOne(t, e, n = !1) {
1125
+ const i = this.options;
1262
1126
  if (this.isWindows) {
1263
- 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]), D = !A && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), x = S ? 3 : g ? 0 : void 0, m = D ? 3 : A ? 0 : void 0;
1264
- if (typeof x == "number" && typeof m == "number") {
1265
- const [C, M] = [t[x], e[m]];
1266
- C.toLowerCase() === M.toLowerCase() && (e[m] = C, m > x ? e = e.slice(m) : x > m && (t = t.slice(x)));
1127
+ 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;
1128
+ if (typeof x == "number" && typeof y == "number") {
1129
+ const [$, I] = [t[x], e[y]];
1130
+ $.toLowerCase() === I.toLowerCase() && (e[y] = $, y > x ? e = e.slice(y) : x > y && (t = t.slice(x)));
1267
1131
  }
1268
1132
  }
1269
- const { optimizationLevel: i = 1 } = this.options;
1270
- i >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, { file: t, pattern: e }), this.debug("matchOne", t.length, e.length);
1133
+ const { optimizationLevel: r = 1 } = this.options;
1134
+ r >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, { file: t, pattern: e }), this.debug("matchOne", t.length, e.length);
1271
1135
  for (var o = 0, a = 0, l = t.length, h = e.length; o < l && a < h; o++, a++) {
1272
1136
  this.debug("matchOne loop");
1273
1137
  var c = e[a], f = t[o];
@@ -1278,22 +1142,22 @@ class U {
1278
1142
  var u = o, d = a + 1;
1279
1143
  if (d === h) {
1280
1144
  for (this.debug("** at the end"); o < l; o++)
1281
- if (t[o] === "." || t[o] === ".." || !r.dot && t[o].charAt(0) === ".")
1145
+ if (t[o] === "." || t[o] === ".." || !i.dot && t[o].charAt(0) === ".")
1282
1146
  return !1;
1283
1147
  return !0;
1284
1148
  }
1285
1149
  for (; u < l; ) {
1286
1150
  var w = t[u];
1287
1151
  if (this.debug(\`
1288
- globstar while\`, t, u, e, d, w), this.matchOne(t.slice(u), e.slice(d), s))
1152
+ globstar while\`, t, u, e, d, w), this.matchOne(t.slice(u), e.slice(d), n))
1289
1153
  return this.debug("globstar found match!", u, l, w), !0;
1290
- if (w === "." || w === ".." || !r.dot && w.charAt(0) === ".") {
1154
+ if (w === "." || w === ".." || !i.dot && w.charAt(0) === ".") {
1291
1155
  this.debug("dot detected!", t, u, e, d);
1292
1156
  break;
1293
1157
  }
1294
1158
  this.debug("globstar swallow a segment, and continue"), u++;
1295
1159
  }
1296
- return !!(s && (this.debug(\`
1160
+ return !!(n && (this.debug(\`
1297
1161
  >>> no match, partial?\`, t, u, e, d), u === l));
1298
1162
  }
1299
1163
  let g;
@@ -1303,25 +1167,25 @@ globstar while\`, t, u, e, d, w), this.matchOne(t.slice(u), e.slice(d), s))
1303
1167
  if (o === l && a === h)
1304
1168
  return !0;
1305
1169
  if (o === l)
1306
- return s;
1170
+ return n;
1307
1171
  if (a === h)
1308
1172
  return o === l - 1 && t[o] === "";
1309
1173
  throw new Error("wtf?");
1310
1174
  }
1311
1175
  braceExpand() {
1312
- return Tt(this.pattern, this.options);
1176
+ return $t(this.pattern, this.options);
1313
1177
  }
1314
1178
  parse(t) {
1315
- j(t);
1179
+ U(t);
1316
1180
  const e = this.options;
1317
1181
  if (t === "**")
1318
1182
  return v;
1319
1183
  if (t === "")
1320
1184
  return "";
1321
- let s, r = null;
1322
- (s = t.match(_e)) ? r = e.dot ? je : We : (s = t.match($e)) ? r = (e.nocase ? e.dot ? Pe : Me : e.dot ? Ie : Te)(s[1]) : (s = t.match(Ue)) ? r = (e.nocase ? e.dot ? Ge : Be : e.dot ? qe : Ve)(s) : (s = t.match(ke)) ? r = e.dot ? Le : Re : (s = t.match(He)) && (r = ze);
1323
- const i = E.fromGlob(t, this.options).toMMPattern();
1324
- return r && typeof i == "object" && Reflect.defineProperty(i, "test", { value: r }), i;
1185
+ let n, i = null;
1186
+ (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);
1187
+ const r = E.fromGlob(t, this.options).toMMPattern();
1188
+ return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
1325
1189
  }
1326
1190
  makeRe() {
1327
1191
  if (this.regexp || this.regexp === !1)
@@ -1329,23 +1193,23 @@ globstar while\`, t, u, e, d, w), this.matchOne(t.slice(u), e.slice(d), s))
1329
1193
  const t = this.set;
1330
1194
  if (!t.length)
1331
1195
  return this.regexp = !1, this.regexp;
1332
- const e = this.options, s = e.noglobstar ? Ze : e.dot ? Je : Ke, r = new Set(e.nocase ? ["i"] : []);
1333
- let i = t.map((l) => {
1196
+ const e = this.options, n = e.noglobstar ? We : e.dot ? _e : je, i = new Set(e.nocase ? ["i"] : []);
1197
+ let r = t.map((l) => {
1334
1198
  const h = l.map((c) => {
1335
1199
  if (c instanceof RegExp)
1336
1200
  for (const f of c.flags.split(""))
1337
- r.add(f);
1338
- return typeof c == "string" ? sn(c) : c === v ? v : c._src;
1201
+ i.add(f);
1202
+ return typeof c == "string" ? Ve(c) : c === v ? v : c._src;
1339
1203
  });
1340
1204
  return h.forEach((c, f) => {
1341
1205
  const u = h[f + 1], d = h[f - 1];
1342
- c !== v || d === v || (d === void 0 ? u !== void 0 && u !== v ? h[f + 1] = "(?:\\\\/|" + s + "\\\\/)?" + u : h[f] = s : u === void 0 ? h[f - 1] = d + "(?:\\\\/|" + s + ")?" : u !== v && (h[f - 1] = d + "(?:\\\\/|\\\\/" + s + "\\\\/)" + u, h[f + 1] = v));
1206
+ 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));
1343
1207
  }), h.filter((c) => c !== v).join("/");
1344
1208
  }).join("|");
1345
1209
  const [o, a] = t.length > 1 ? ["(?:", ")"] : ["", ""];
1346
- i = "^" + o + i + a + "$", this.negate && (i = "^(?!" + i + ").+$");
1210
+ r = "^" + o + r + a + "$", this.negate && (r = "^(?!" + r + ").+$");
1347
1211
  try {
1348
- this.regexp = new RegExp(i, [...r].join(""));
1212
+ this.regexp = new RegExp(r, [...i].join(""));
1349
1213
  } catch {
1350
1214
  this.regexp = !1;
1351
1215
  }
@@ -1361,161 +1225,133 @@ globstar while\`, t, u, e, d, w), this.matchOne(t.slice(u), e.slice(d), s))
1361
1225
  return t === "";
1362
1226
  if (t === "/" && e)
1363
1227
  return !0;
1364
- const s = this.options;
1228
+ const n = this.options;
1365
1229
  this.isWindows && (t = t.split("\\\\").join("/"));
1366
- const r = this.slashSplit(t);
1367
- this.debug(this.pattern, "split", r);
1368
- const i = this.set;
1369
- this.debug(this.pattern, "set", i);
1370
- let o = r[r.length - 1];
1230
+ const i = this.slashSplit(t);
1231
+ this.debug(this.pattern, "split", i);
1232
+ const r = this.set;
1233
+ this.debug(this.pattern, "set", r);
1234
+ let o = i[i.length - 1];
1371
1235
  if (!o)
1372
- for (let a = r.length - 2; !o && a >= 0; a--)
1373
- o = r[a];
1374
- for (let a = 0; a < i.length; a++) {
1375
- const l = i[a];
1376
- let h = r;
1377
- if (s.matchBase && l.length === 1 && (h = [o]), this.matchOne(h, l, e))
1378
- return s.flipNegate ? !0 : !this.negate;
1236
+ for (let a = i.length - 2; !o && a >= 0; a--)
1237
+ o = i[a];
1238
+ for (let a = 0; a < r.length; a++) {
1239
+ const l = r[a];
1240
+ let h = i;
1241
+ if (n.matchBase && l.length === 1 && (h = [o]), this.matchOne(h, l, e))
1242
+ return n.flipNegate ? !0 : !this.negate;
1379
1243
  }
1380
- return s.flipNegate ? !1 : this.negate;
1244
+ return n.flipNegate ? !1 : this.negate;
1381
1245
  }
1382
1246
  static defaults(t) {
1383
- return y.defaults(t).Minimatch;
1247
+ return m.defaults(t).Minimatch;
1384
1248
  }
1385
1249
  }
1386
- y.AST = E;
1387
- y.Minimatch = U;
1388
- y.escape = Ce;
1389
- y.unescape = I;
1390
- function rn() {
1250
+ m.AST = E;
1251
+ m.Minimatch = G;
1252
+ m.escape = Ee;
1253
+ m.unescape = M;
1254
+ function Xe() {
1391
1255
  if (!("storage" in navigator) || !("getDirectory" in navigator.storage))
1392
- throw new Gt();
1256
+ throw new jt();
1393
1257
  }
1394
- async function B(n, t, e) {
1395
- return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(\`opfs:\${n.replace(/\\/+/g, "/")}\`, { mode: t }, e) : e();
1258
+ async function P(s, t, e) {
1259
+ return typeof navigator < "u" && navigator.locks?.request ? navigator.locks.request(\`opfs:\${s.replace(/\\/+/g, "/")}\`, { mode: t }, e) : e();
1396
1260
  }
1397
- function O(n) {
1398
- return Array.isArray(n) ? n : (n.startsWith("~/") ? n.slice(2) : n).split("/").filter(Boolean);
1261
+ function D(s) {
1262
+ return Array.isArray(s) ? s : (s.startsWith("~/") ? s.slice(2) : s).split("/").filter(Boolean);
1399
1263
  }
1400
- function st(n) {
1401
- return typeof n == "string" ? n ?? "/" : \`/\${n.join("/")}\`;
1264
+ function et(s) {
1265
+ return typeof s == "string" ? s ?? "/" : \`/\${s.join("/")}\`;
1402
1266
  }
1403
- function Q(n) {
1404
- const t = O(n);
1267
+ function J(s) {
1268
+ const t = D(s);
1405
1269
  return t[t.length - 1] || "";
1406
1270
  }
1407
- function Y(n) {
1408
- const t = O(n);
1409
- return t.pop(), st(t);
1271
+ function X(s) {
1272
+ const t = D(s);
1273
+ return t.pop(), et(t);
1410
1274
  }
1411
- function H(n) {
1412
- return !n || n === "/" ? "/" : n.startsWith("~/") ? \`/\${n.slice(2)}\` : n.startsWith("/") ? n : \`/\${n}\`;
1275
+ function W(s) {
1276
+ return !s || s === "/" ? "/" : s.startsWith("~/") ? \`/\${s.slice(2)}\` : s.startsWith("/") ? s : \`/\${s}\`;
1413
1277
  }
1414
- function on(n, t = !1) {
1415
- return n = n.replace(/\\/$/, ""), t && !n.includes("*") ? \`\${n}/**\` : n;
1278
+ function Ye(s, t = !1) {
1279
+ return s = s.replace(/\\/$/, ""), t && !s.includes("*") ? \`\${s}/**\` : s;
1416
1280
  }
1417
- function Z(n, t) {
1418
- return y(n, t, {
1281
+ function Y(s, t) {
1282
+ return m(s, t, {
1419
1283
  dot: !0,
1420
1284
  matchBase: !0
1421
1285
  });
1422
1286
  }
1423
- function ft(n) {
1424
- const t = H(n), e = O(t), s = [];
1425
- for (const r of e)
1426
- if (!(r === "." || r === ""))
1427
- if (r === "..") {
1428
- if (s.length === 0)
1287
+ function ut(s) {
1288
+ const t = W(s), e = D(t), n = [];
1289
+ for (const i of e)
1290
+ if (!(i === "." || i === ""))
1291
+ if (i === "..") {
1292
+ if (n.length === 0)
1429
1293
  continue;
1430
- s.pop();
1294
+ n.pop();
1431
1295
  } else
1432
- s.push(r);
1433
- return st(s);
1296
+ n.push(i);
1297
+ return et(n);
1434
1298
  }
1435
- function an(n, t = "utf-8") {
1436
- return typeof n == "string" ? Yt(n, t) : n instanceof Uint8Array ? n : new Uint8Array(n);
1299
+ async function Ze(s, t = "SHA-1", e = 50 * 1024 * 1024) {
1300
+ if (s instanceof File && (s = await s.arrayBuffer()), s.byteLength > e)
1301
+ throw new Error(\`File size \${s.byteLength} bytes exceeds maximum allowed size \${e} bytes\`);
1302
+ const n = new Uint8Array(s), i = await crypto.subtle.digest(t, n);
1303
+ return Array.from(new Uint8Array(i)).map((o) => o.toString(16).padStart(2, "0")).join("");
1437
1304
  }
1438
- async function cn(n, t) {
1439
- return B(t, "shared", async () => {
1440
- const s = await (await n.getFile()).arrayBuffer();
1441
- return new Uint8Array(s);
1442
- });
1443
- }
1444
- async function dt(n, t, e, s, r = {}) {
1445
- const i = async () => {
1446
- const o = r.append || !1, a = !o && (r.truncate ?? !0), l = await It(n, s || "unknown");
1447
- try {
1448
- const h = an(t, e), c = o ? l.getSize() : 0;
1449
- l.write(h, { at: c }), a && l.truncate(h.byteLength), l.flush();
1450
- } catch (h) {
1451
- console.error(h);
1452
- const c = o ? "append" : "write";
1453
- throw new p(\`Failed to \${c} file\`, \`\${c.toUpperCase()}_FAILED\`, void 0, h);
1454
- } finally {
1455
- try {
1456
- l?.close();
1457
- } catch {
1458
- }
1459
- }
1460
- };
1461
- return s ? B(s, "exclusive", i) : i();
1462
- }
1463
- async function ln(n, t = "SHA-1", e = 50 * 1024 * 1024) {
1464
- if (n instanceof File && (n = await n.arrayBuffer()), n.byteLength > e)
1465
- throw new Error(\`File size \${n.byteLength} bytes exceeds maximum allowed size \${e} bytes\`);
1466
- const s = new Uint8Array(n), r = await crypto.subtle.digest(t, s);
1467
- return Array.from(new Uint8Array(r)).map((o) => o.toString(16).padStart(2, "0")).join("");
1468
- }
1469
- async function hn(n) {
1470
- const t = await n.arrayBuffer();
1305
+ async function Je(s) {
1306
+ const t = await s.arrayBuffer();
1471
1307
  return new Uint8Array(t);
1472
1308
  }
1473
- async function un(n, t, e = {}) {
1474
- const s = Q(t);
1475
- return B(t, "exclusive", async () => {
1476
- const r = e.recursive ?? !1, i = e.force ?? !1;
1309
+ async function Ke(s, t, e = {}) {
1310
+ const n = J(t);
1311
+ return P(t, "exclusive", async () => {
1312
+ const i = e.recursive ?? !1, r = e.force ?? !1;
1477
1313
  e.useTrash;
1478
1314
  try {
1479
- await n.removeEntry(s, { recursive: r });
1315
+ await s.removeEntry(n, { recursive: i });
1480
1316
  } catch (o) {
1481
1317
  if (o.name === "NotFoundError") {
1482
- if (!i)
1318
+ if (!r)
1483
1319
  throw new p(\`No such file or directory: \${t}\`, "ENOENT", void 0, o);
1484
- } else throw o.name === "InvalidModificationError" ? new p(\`Directory not empty: \${t}. Use recursive option to force removal.\`, "ENOTEMPTY", void 0, o) : o.name === "TypeMismatchError" && !r ? new p(\`Cannot remove directory without recursive option: \${t}\`, "EISDIR", void 0, o) : new p(\`Failed to remove entry: \${t}\`, "RM_FAILED", void 0, o);
1320
+ } else throw o.name === "InvalidModificationError" ? new p(\`Directory not empty: \${t}. Use recursive option to force removal.\`, "ENOTEMPTY", void 0, o) : o.name === "TypeMismatchError" && !i ? new p(\`Cannot remove directory without recursive option: \${t}\`, "EISDIR", void 0, o) : new p(\`Failed to remove entry: \${t}\`, "RM_FAILED", void 0, o);
1485
1321
  }
1486
1322
  });
1487
1323
  }
1488
- function pt(n, t, e, s) {
1324
+ function ft(s, t, e, n) {
1489
1325
  if (!Number.isInteger(t) || !Number.isInteger(e))
1490
1326
  throw new p("Invalid offset or length", "EINVAL");
1491
1327
  if (t < 0 || e < 0)
1492
1328
  throw new p("Negative offset or length not allowed", "EINVAL");
1493
- if (t + e > n)
1329
+ if (t + e > s)
1494
1330
  throw new p("Operation would overflow buffer", "ERANGE");
1495
- if (s != null && (!Number.isInteger(s) || s < 0))
1331
+ if (n != null && (!Number.isInteger(n) || n < 0))
1496
1332
  throw new p("Invalid position", "EINVAL");
1497
1333
  }
1498
- function gt(n, t, e) {
1334
+ function dt(s, t, e) {
1499
1335
  try {
1500
1336
  t.flush(), t.close();
1501
- } catch (s) {
1502
- console.warn(\`Warning: Failed to properly close file descriptor \${n} (\${e}):\`, s);
1337
+ } catch (n) {
1338
+ console.warn(\`Warning: Failed to properly close file descriptor \${s} (\${e}):\`, n);
1503
1339
  }
1504
1340
  }
1505
- function fn(n, t, e) {
1506
- if (n >= e)
1341
+ function Qe(s, t, e) {
1342
+ if (s >= e)
1507
1343
  return { isEOF: !0, actualLength: 0 };
1508
- const s = Math.min(t, e - n);
1509
- return s <= 0 ? { isEOF: !0, actualLength: 0 } : { isEOF: !1, actualLength: s };
1344
+ const n = Math.min(t, e - s);
1345
+ return n <= 0 ? { isEOF: !0, actualLength: 0 } : { isEOF: !1, actualLength: n };
1510
1346
  }
1511
- async function It(n, t) {
1347
+ async function ts(s, t) {
1512
1348
  try {
1513
- return await n.createSyncAccessHandle();
1349
+ return await s.createSyncAccessHandle();
1514
1350
  } catch (e) {
1515
- throw Vt(e, { path: t });
1351
+ throw Ut(e, { path: t });
1516
1352
  }
1517
1353
  }
1518
- class dn {
1354
+ class es {
1519
1355
  /** Root directory handle for the file system */
1520
1356
  root;
1521
1357
  /** Map of watched paths and options */
@@ -1529,7 +1365,7 @@ class dn {
1529
1365
  root: "/",
1530
1366
  namespace: "",
1531
1367
  maxFileSize: 50 * 1024 * 1024,
1532
- hashAlgorithm: null,
1368
+ hashAlgorithm: !1,
1533
1369
  broadcastChannel: "opfs-worker"
1534
1370
  };
1535
1371
  /** Map of open file descriptors to their metadata */
@@ -1559,25 +1395,25 @@ class dn {
1559
1395
  if (!this.options.broadcastChannel)
1560
1396
  return;
1561
1397
  const e = t.path;
1562
- if (![...this.watchers.values()].some((i) => Z(e, i.pattern) && i.include.some((o) => o && Z(e, o)) && !i.exclude.some((o) => o && Z(e, o))))
1398
+ 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))))
1563
1399
  return;
1564
- let r;
1400
+ let i;
1565
1401
  if (this.options.hashAlgorithm)
1566
1402
  try {
1567
- r = (await this.stat(e)).hash;
1403
+ i = (await this.stat(e)).hash;
1568
1404
  } catch {
1569
1405
  }
1570
1406
  try {
1571
1407
  this.broadcastChannel || (this.broadcastChannel = new BroadcastChannel(this.options.broadcastChannel));
1572
- const i = {
1408
+ const r = {
1573
1409
  namespace: this.options.namespace,
1574
1410
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1575
1411
  ...t,
1576
- ...r && { hash: r }
1412
+ ...i && { hash: i }
1577
1413
  };
1578
- this.broadcastChannel.postMessage(i);
1579
- } catch (i) {
1580
- console.warn("Failed to send event via BroadcastChannel:", i);
1414
+ this.broadcastChannel.postMessage(r);
1415
+ } catch (r) {
1416
+ console.warn("Failed to send event via BroadcastChannel:", r);
1581
1417
  }
1582
1418
  }
1583
1419
  /**
@@ -1591,7 +1427,7 @@ class dn {
1591
1427
  * @throws {OPFSError} If OPFS is not supported in the current browser
1592
1428
  */
1593
1429
  constructor(t) {
1594
- rn(), t && this.setOptions(t);
1430
+ Xe(), t && this.setOptions(t);
1595
1431
  }
1596
1432
  /**
1597
1433
  * Initialize the file system within a given directory
@@ -1616,12 +1452,12 @@ class dn {
1616
1452
  */
1617
1453
  async mount() {
1618
1454
  const t = this.options.root;
1619
- return this.mountingPromise && await this.mountingPromise, this.mountingPromise = new Promise(async (e, s) => {
1455
+ return this.mountingPromise && await this.mountingPromise, this.mountingPromise = new Promise(async (e, n) => {
1620
1456
  try {
1621
- const r = await navigator.storage.getDirectory();
1622
- this.root = t === "/" ? r : await this.getDirectoryHandle(t, !0, r), e(!0);
1623
- } catch (r) {
1624
- s(new p("Failed to initialize OPFS", "INIT_FAILED", t, r));
1457
+ const i = await navigator.storage.getDirectory();
1458
+ this.root = t === "/" ? i : await this.getDirectoryHandle(t, !0, i), e(!0);
1459
+ } catch (i) {
1460
+ n(new p("Failed to initialize OPFS", "INIT_FAILED", t, i));
1625
1461
  } finally {
1626
1462
  this.mountingPromise = null;
1627
1463
  }
@@ -1638,7 +1474,7 @@ class dn {
1638
1474
  * @param options.broadcastChannel - Custom name for the broadcast channel
1639
1475
  */
1640
1476
  async setOptions(t) {
1641
- 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 = H(t.root), this.options.namespace || (this.options.namespace = \`opfs-worker:\${this.options.root}\`), await this.mount());
1477
+ 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());
1642
1478
  }
1643
1479
  /**
1644
1480
  * Get a directory handle from a path
@@ -1658,12 +1494,12 @@ class dn {
1658
1494
  * const docsDir2 = await fs.getDirectoryHandle(['users', 'john', 'documents'], true);
1659
1495
  * \`\`\`
1660
1496
  */
1661
- async getDirectoryHandle(t, e = !1, s = this.root) {
1662
- const r = Array.isArray(t) ? t : O(t);
1663
- let i = s;
1664
- for (const o of r)
1665
- i = await i.getDirectoryHandle(o, { create: e });
1666
- return i;
1497
+ async getDirectoryHandle(t, e = !1, n = this.root) {
1498
+ const i = Array.isArray(t) ? t : D(t);
1499
+ let r = n;
1500
+ for (const o of i)
1501
+ r = await r.getDirectoryHandle(o, { create: e });
1502
+ return r;
1667
1503
  }
1668
1504
  /**
1669
1505
  * Get a file handle from a path
@@ -1684,12 +1520,12 @@ class dn {
1684
1520
  * const fileHandle2 = await fs.getFileHandle(['config', 'settings.json'], true);
1685
1521
  * \`\`\`
1686
1522
  */
1687
- async getFileHandle(t, e = !1, s = this.root) {
1688
- const r = O(t);
1689
- if (r.length === 0)
1690
- throw new qt("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
1691
- const i = r.pop();
1692
- return (await this.getDirectoryHandle(r, e, s)).getFileHandle(i, { create: e });
1523
+ async getFileHandle(t, e = !1, n = this.root) {
1524
+ const i = D(t);
1525
+ if (i.length === 0)
1526
+ throw new Bt("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
1527
+ const r = i.pop();
1528
+ return (await this.getDirectoryHandle(i, e, n)).getFileHandle(r, { create: e });
1693
1529
  }
1694
1530
  /**
1695
1531
  * Get a complete index of all files and directories in the file system
@@ -1711,10 +1547,10 @@ class dn {
1711
1547
  * \`\`\`
1712
1548
  */
1713
1549
  async index() {
1714
- const t = /* @__PURE__ */ new Map(), e = async (s) => {
1715
- const r = await this.readDir(s);
1716
- for (const i of r) {
1717
- const o = \`\${s === "/" ? "" : s}/\${i.name}\`;
1550
+ const t = /* @__PURE__ */ new Map(), e = async (n) => {
1551
+ const i = await this.readDir(n);
1552
+ for (const r of i) {
1553
+ const o = \`\${n === "/" ? "" : n}/\${r.name}\`;
1718
1554
  try {
1719
1555
  const a = await this.stat(o);
1720
1556
  t.set(o, a), a.isDirectory && await e(o);
@@ -1732,71 +1568,111 @@ class dn {
1732
1568
  isDirectory: !0
1733
1569
  }), await e("/"), t;
1734
1570
  }
1735
- async readFile(t, e) {
1736
- await this.mount(), e || (e = V(t) ? "binary" : "utf-8");
1571
+ /**
1572
+ * Read a file from the file system
1573
+ *
1574
+ * Reads the contents of a file and returns it as binary data.
1575
+ *
1576
+ * @param path - The path to the file to read
1577
+ * @returns Promise that resolves to the file contents as Uint8Array
1578
+ * @throws {FileNotFoundError} If the file does not exist
1579
+ * @throws {OPFSError} If reading the file fails
1580
+ *
1581
+ * @example
1582
+ * \`\`\`typescript
1583
+ * // Read as binary data
1584
+ * const content = await fs.readFile('/config/settings.json');
1585
+ *
1586
+ * // Read binary file
1587
+ * const binaryData = await fs.readFile('/images/logo.png');
1588
+ * \`\`\`
1589
+ */
1590
+ async readFile(t) {
1591
+ await this.mount();
1737
1592
  try {
1738
- const s = await this.getFileHandle(t, !1, this.root), r = await cn(s, t);
1739
- return e === "binary" ? r : Zt(r, e);
1740
- } catch (s) {
1741
- throw new q(t, s);
1593
+ return await P(t, "shared", async () => {
1594
+ const e = await this.open(t);
1595
+ try {
1596
+ const { size: n } = await this.fstat(e), i = new Uint8Array(n);
1597
+ return n > 0 && await this.read(e, i, 0, n, 0), H(i, [i.buffer]);
1598
+ } finally {
1599
+ await this.close(e);
1600
+ }
1601
+ });
1602
+ } catch (e) {
1603
+ throw new nt(t, e);
1742
1604
  }
1743
1605
  }
1744
1606
  /**
1745
1607
  * Write data to a file
1746
1608
  *
1747
- * Creates or overwrites a file with the specified data. If the file already
1609
+ * Creates or overwrites a file with the specified binary data. If the file already
1748
1610
  * exists, it will be truncated before writing.
1749
1611
  *
1750
1612
  * @param path - The path to the file to write
1751
- * @param data - The data to write to the file (string, Uint8Array, or ArrayBuffer)
1752
- * @param encoding - The encoding to use when writing string data (default: 'utf-8')
1613
+ * @param data - The binary data to write to the file (Uint8Array or ArrayBuffer)
1753
1614
  * @returns Promise that resolves when the write operation is complete
1754
1615
  * @throws {OPFSError} If writing the file fails
1755
1616
  *
1756
1617
  * @example
1757
1618
  * \`\`\`typescript
1758
- * // Write text data
1759
- * await fs.writeFile('/config/settings.json', JSON.stringify({ theme: 'dark' }));
1760
- *
1761
1619
  * // Write binary data
1762
1620
  * const binaryData = new Uint8Array([1, 2, 3, 4, 5]);
1763
1621
  * await fs.writeFile('/data/binary.dat', binaryData);
1764
1622
  *
1765
- * // Write with specific encoding
1766
- * await fs.writeFile('/data/utf16.txt', 'Hello World', 'utf-16le');
1623
+ * // Write from ArrayBuffer
1624
+ * const arrayBuffer = new ArrayBuffer(10);
1625
+ * await fs.writeFile('/data/buffer.dat', arrayBuffer);
1767
1626
  * \`\`\`
1768
1627
  */
1769
- async writeFile(t, e, s) {
1628
+ async writeFile(t, e) {
1770
1629
  await this.mount();
1771
- const r = await this.exists(t), i = await this.getFileHandle(t, !0);
1772
- s || (s = typeof e != "string" || V(t) ? "binary" : "utf-8"), await dt(i, e, s, t), r ? await this.notifyChange({ path: t, type: "changed", isDirectory: !1 }) : await this.notifyChange({ path: t, type: "added", isDirectory: !1 });
1630
+ const n = e instanceof Uint8Array ? e : new Uint8Array(e);
1631
+ await P(t, "exclusive", async () => {
1632
+ const i = await this.exists(t), r = await this.open(t, { create: !0, truncate: !0 });
1633
+ try {
1634
+ await this.write(r, n, 0, n.length, null, !1), await this.fsync(r);
1635
+ } finally {
1636
+ await this.close(r);
1637
+ }
1638
+ await this.notifyChange({ path: t, type: i ? "changed" : "added", isDirectory: !1 });
1639
+ });
1773
1640
  }
1774
1641
  /**
1775
1642
  * Append data to a file
1776
1643
  *
1777
- * Adds data to the end of an existing file. If the file doesn't exist,
1644
+ * Adds binary data to the end of an existing file. If the file doesn't exist,
1778
1645
  * it will be created.
1779
1646
  *
1780
1647
  * @param path - The path to the file to append to
1781
- * @param data - The data to append to the file (string, Uint8Array, or ArrayBuffer)
1782
- * @param encoding - The encoding to use when appending string data (default: 'utf-8')
1648
+ * @param data - The binary data to append to the file (Uint8Array or ArrayBuffer)
1783
1649
  * @returns Promise that resolves when the append operation is complete
1784
1650
  * @throws {OPFSError} If appending to the file fails
1785
1651
  *
1786
1652
  * @example
1787
1653
  * \`\`\`typescript
1788
- * // Append text to a log file
1789
- * await fs.appendFile('/logs/app.log', \`[\${new Date().toISOString()}] User logged in\\n\`);
1790
- *
1791
1654
  * // Append binary data
1792
1655
  * const additionalData = new Uint8Array([6, 7, 8]);
1793
1656
  * await fs.appendFile('/data/binary.dat', additionalData);
1657
+ *
1658
+ * // Append from ArrayBuffer
1659
+ * const arrayBuffer = new ArrayBuffer(5);
1660
+ * await fs.appendFile('/data/buffer.dat', arrayBuffer);
1794
1661
  * \`\`\`
1795
1662
  */
1796
- async appendFile(t, e, s) {
1663
+ async appendFile(t, e) {
1797
1664
  await this.mount();
1798
- const r = await this.getFileHandle(t, !0);
1799
- s || (s = typeof e != "string" || V(t) ? "binary" : "utf-8"), await dt(r, e, s, t, { append: !0 }), await this.notifyChange({ path: t, type: "changed", isDirectory: !1 });
1665
+ const n = e instanceof Uint8Array ? e : new Uint8Array(e);
1666
+ await P(t, "exclusive", async () => {
1667
+ const i = await this.open(t, { create: !0 });
1668
+ try {
1669
+ const { size: r } = await this.fstat(i);
1670
+ await this.write(i, n, 0, n.length, r, !1), await this.fsync(i);
1671
+ } finally {
1672
+ await this.close(i);
1673
+ }
1674
+ await this.notifyChange({ path: t, type: "changed", isDirectory: !1 });
1675
+ });
1800
1676
  }
1801
1677
  /**
1802
1678
  * Create a directory
@@ -1821,15 +1697,15 @@ class dn {
1821
1697
  */
1822
1698
  async mkdir(t, e) {
1823
1699
  await this.mount();
1824
- const s = e?.recursive ?? !1, r = O(t);
1825
- let i = this.root;
1826
- for (let o = 0; o < r.length; o++) {
1827
- const a = r[o];
1700
+ const n = e?.recursive ?? !1, i = D(t);
1701
+ let r = this.root;
1702
+ for (let o = 0; o < i.length; o++) {
1703
+ const a = i[o];
1828
1704
  try {
1829
- i = await i.getDirectoryHandle(a, { create: s || o === r.length - 1 });
1705
+ r = await r.getDirectoryHandle(a, { create: n || o === i.length - 1 });
1830
1706
  } catch (l) {
1831
1707
  throw l.name === "NotFoundError" ? new p(
1832
- \`Parent directory does not exist: \${st(r.slice(0, o + 1))}\`,
1708
+ \`Parent directory does not exist: \${et(i.slice(0, o + 1))}\`,
1833
1709
  "ENOENT",
1834
1710
  void 0,
1835
1711
  l
@@ -1870,9 +1746,9 @@ class dn {
1870
1746
  isFile: !1,
1871
1747
  isDirectory: !0
1872
1748
  };
1873
- const e = Q(t), s = await this.getDirectoryHandle(Y(t), !1), r = this.options.hashAlgorithm !== null;
1749
+ const e = J(t), n = await this.getDirectoryHandle(X(t), !1), i = this.options.hashAlgorithm !== null;
1874
1750
  try {
1875
- const o = await (await s.getFileHandle(e, { create: !1 })).getFile(), a = {
1751
+ const o = await (await n.getFileHandle(e, { create: !1 })).getFile(), a = {
1876
1752
  kind: "file",
1877
1753
  size: o.size,
1878
1754
  mtime: new Date(o.lastModified).toISOString(),
@@ -1880,20 +1756,20 @@ class dn {
1880
1756
  isFile: !0,
1881
1757
  isDirectory: !1
1882
1758
  };
1883
- if (r && this.options.hashAlgorithm)
1759
+ if (i && this.options.hashAlgorithm)
1884
1760
  try {
1885
- const l = await ln(o, this.options.hashAlgorithm, this.options.maxFileSize);
1761
+ const l = await Ze(o, this.options.hashAlgorithm, this.options.maxFileSize);
1886
1762
  a.hash = l;
1887
1763
  } catch (l) {
1888
1764
  console.warn(\`Failed to calculate hash for \${t}:\`, l);
1889
1765
  }
1890
1766
  return a;
1891
- } catch (i) {
1892
- if (i.name !== "TypeMismatchError" && i.name !== "NotFoundError")
1893
- throw new p("Failed to stat (file)", "STAT_FAILED", void 0, i);
1767
+ } catch (r) {
1768
+ if (r.name !== "TypeMismatchError" && r.name !== "NotFoundError")
1769
+ throw new p("Failed to stat (file)", "STAT_FAILED", void 0, r);
1894
1770
  }
1895
1771
  try {
1896
- return await s.getDirectoryHandle(e, { create: !1 }), {
1772
+ return await n.getDirectoryHandle(e, { create: !1 }), {
1897
1773
  kind: "directory",
1898
1774
  size: 0,
1899
1775
  mtime: (/* @__PURE__ */ new Date(0)).toISOString(),
@@ -1901,8 +1777,8 @@ class dn {
1901
1777
  isFile: !1,
1902
1778
  isDirectory: !0
1903
1779
  };
1904
- } catch (i) {
1905
- throw i.name === "NotFoundError" ? new p(\`No such file or directory: \${t}\`, "ENOENT", void 0, i) : new p("Failed to stat (directory)", "STAT_FAILED", void 0, i);
1780
+ } catch (r) {
1781
+ throw r.name === "NotFoundError" ? new p(\`No such file or directory: \${t}\`, "ENOENT", void 0, r) : new p("Failed to stat (directory)", "STAT_FAILED", void 0, r);
1906
1782
  }
1907
1783
  }
1908
1784
  /**
@@ -1925,17 +1801,17 @@ class dn {
1925
1801
  */
1926
1802
  async readDir(t) {
1927
1803
  await this.mount();
1928
- const e = await this.getDirectoryHandle(t, !1), s = [];
1929
- for await (const [r, i] of e.entries()) {
1930
- const o = i.kind === "file";
1931
- s.push({
1932
- name: r,
1933
- kind: i.kind,
1804
+ const e = await this.getDirectoryHandle(t, !1), n = [];
1805
+ for await (const [i, r] of e.entries()) {
1806
+ const o = r.kind === "file";
1807
+ n.push({
1808
+ name: i,
1809
+ kind: r.kind,
1934
1810
  isFile: o,
1935
1811
  isDirectory: !o
1936
1812
  });
1937
1813
  }
1938
- return s;
1814
+ return n;
1939
1815
  }
1940
1816
  /**
1941
1817
  * Check if a file or directory exists
@@ -1954,26 +1830,26 @@ class dn {
1954
1830
  async exists(t) {
1955
1831
  if (await this.mount(), t === "/")
1956
1832
  return !0;
1957
- const e = Q(t);
1958
- let s = null;
1833
+ const e = J(t);
1834
+ let n = null;
1959
1835
  try {
1960
- s = await this.getDirectoryHandle(Y(t), !1);
1961
- } catch (r) {
1962
- if (s = null, r.name !== "NotFoundError" && r.name !== "TypeMismatchError")
1963
- throw r;
1836
+ n = await this.getDirectoryHandle(X(t), !1);
1837
+ } catch (i) {
1838
+ if (n = null, i.name !== "NotFoundError" && i.name !== "TypeMismatchError")
1839
+ throw i;
1964
1840
  }
1965
- if (!s || !e)
1841
+ if (!n || !e)
1966
1842
  return !1;
1967
1843
  try {
1968
- return await s.getFileHandle(e, { create: !1 }), !0;
1969
- } catch (r) {
1970
- if (r.name !== "NotFoundError" && r.name !== "TypeMismatchError")
1971
- throw r;
1844
+ return await n.getFileHandle(e, { create: !1 }), !0;
1845
+ } catch (i) {
1846
+ if (i.name !== "NotFoundError" && i.name !== "TypeMismatchError")
1847
+ throw i;
1972
1848
  try {
1973
- return await s.getDirectoryHandle(e, { create: !1 }), !0;
1974
- } catch (i) {
1975
- if (i.name !== "NotFoundError" && i.name !== "TypeMismatchError")
1976
- throw i;
1849
+ return await n.getDirectoryHandle(e, { create: !1 }), !0;
1850
+ } catch (r) {
1851
+ if (r.name !== "NotFoundError" && r.name !== "TypeMismatchError")
1852
+ throw r;
1977
1853
  return !1;
1978
1854
  }
1979
1855
  }
@@ -2001,9 +1877,9 @@ class dn {
2001
1877
  await this.mount();
2002
1878
  try {
2003
1879
  const e = await this.readDir(t);
2004
- for (const s of e) {
2005
- const r = \`\${t === "/" ? "" : t}/\${s.name}\`;
2006
- await this.remove(r, { recursive: !0 });
1880
+ for (const n of e) {
1881
+ const i = \`\${t === "/" ? "" : t}/\${n.name}\`;
1882
+ await this.remove(i, { recursive: !0 });
2007
1883
  }
2008
1884
  await this.notifyChange({ path: t, type: "changed", isDirectory: !0 });
2009
1885
  } catch (e) {
@@ -2037,8 +1913,8 @@ class dn {
2037
1913
  async remove(t, e) {
2038
1914
  if (await this.mount(), t === "/")
2039
1915
  throw new p("Cannot remove root directory", "EROOT");
2040
- const { recursive: s = !1, force: r = !1 } = e || {}, i = await this.getDirectoryHandle(Y(t), !1);
2041
- await un(i, t, { recursive: s, force: r }), await this.notifyChange({ path: t, type: "removed", isDirectory: !1 });
1916
+ const { recursive: n = !1, force: i = !1 } = e || {}, r = await this.getDirectoryHandle(X(t), !1), o = await this.stat(t);
1917
+ await Ke(r, t, { recursive: n, force: i }), await this.notifyChange({ path: t, type: "removed", isDirectory: o.isDirectory });
2042
1918
  }
2043
1919
  /**
2044
1920
  * Resolve a path to an absolute path
@@ -2061,9 +1937,9 @@ class dn {
2061
1937
  async realpath(t) {
2062
1938
  await this.mount();
2063
1939
  try {
2064
- const e = ft(t);
1940
+ const e = ut(t);
2065
1941
  if (!await this.exists(e))
2066
- throw new q(e);
1942
+ throw new nt(e);
2067
1943
  return e;
2068
1944
  } catch (e) {
2069
1945
  throw e instanceof p ? e : new p(\`Failed to resolve path: \${t}\`, "REALPATH_FAILED", void 0, e);
@@ -2091,17 +1967,15 @@ class dn {
2091
1967
  * await fs.rename('/old/path/file.txt', '/new/path/renamed.txt', { overwrite: true });
2092
1968
  * \`\`\`
2093
1969
  */
2094
- async rename(t, e, s) {
1970
+ async rename(t, e, n) {
2095
1971
  await this.mount();
2096
1972
  try {
2097
- const r = s?.overwrite ?? !1;
2098
- if (!await this.exists(t))
2099
- throw new q(t);
2100
- if (await this.exists(e) && !r)
1973
+ const i = n?.overwrite ?? !1, r = await this.stat(t);
1974
+ if (await this.exists(e) && !i)
2101
1975
  throw new p(\`Destination already exists: \${e}\`, "EEXIST", void 0);
2102
- await this.copy(t, e, { recursive: !0, overwrite: r }), await this.remove(t, { recursive: !0 }), await this.notifyChange({ path: t, type: "removed", isDirectory: !1 }), await this.notifyChange({ path: e, type: "added", isDirectory: !1 });
2103
- } catch (r) {
2104
- throw r instanceof p ? r : new p(\`Failed to rename from \${t} to \${e}\`, "RENAME_FAILED", void 0, r);
1976
+ 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 });
1977
+ } catch (i) {
1978
+ throw i instanceof p ? i : new p(\`Failed to rename from \${t} to \${e}\`, "RENAME_FAILED", void 0, i);
2105
1979
  }
2106
1980
  }
2107
1981
  /**
@@ -2129,29 +2003,29 @@ class dn {
2129
2003
  * await fs.copy('/source', '/dest', { recursive: true, overwrite: false });
2130
2004
  * \`\`\`
2131
2005
  */
2132
- async copy(t, e, s) {
2006
+ async copy(t, e, n) {
2133
2007
  await this.mount();
2134
2008
  try {
2135
- const r = s?.recursive ?? !1, i = s?.overwrite ?? !0;
2009
+ const i = n?.recursive ?? !1, r = n?.overwrite ?? !0;
2136
2010
  if (!await this.exists(t))
2137
2011
  throw new p(\`Source does not exist: \${t}\`, "ENOENT", void 0);
2138
- if (await this.exists(e) && !i)
2012
+ if (await this.exists(e) && !r)
2139
2013
  throw new p(\`Destination already exists: \${e}\`, "EEXIST", void 0);
2140
2014
  if ((await this.stat(t)).isFile) {
2141
- const h = await this.readFile(t, "binary");
2015
+ const h = await this.readFile(t);
2142
2016
  await this.writeFile(e, h);
2143
2017
  } else {
2144
- if (!r)
2018
+ if (!i)
2145
2019
  throw new p(\`Cannot copy directory without recursive option: \${t}\`, "EISDIR", void 0);
2146
2020
  await this.mkdir(e, { recursive: !0 });
2147
2021
  const h = await this.readDir(t);
2148
2022
  for (const c of h) {
2149
2023
  const f = \`\${t}/\${c.name}\`, u = \`\${e}/\${c.name}\`;
2150
- await this.copy(f, u, { recursive: !0, overwrite: i });
2024
+ await this.copy(f, u, { recursive: !0, overwrite: r });
2151
2025
  }
2152
2026
  }
2153
- } catch (r) {
2154
- throw r instanceof p ? r : new p(\`Failed to copy from \${t} to \${e}\`, "CP_FAILED", void 0, r);
2027
+ } catch (i) {
2028
+ throw i instanceof p ? i : new p(\`Failed to copy from \${t} to \${e}\`, "CP_FAILED", void 0, i);
2155
2029
  }
2156
2030
  }
2157
2031
  /**
@@ -2182,12 +2056,12 @@ class dn {
2182
2056
  async watch(t, e) {
2183
2057
  if (!this.options.broadcastChannel)
2184
2058
  throw new p("This instance is not configured to send events. Please specify options.broadcastChannel to enable watching.", "ENOENT");
2185
- const s = {
2186
- pattern: on(t, e?.recursive ?? !0),
2059
+ const n = {
2060
+ pattern: Ye(t, e?.recursive ?? !0),
2187
2061
  include: Array.isArray(e?.include) ? e.include : [e?.include ?? "**"],
2188
2062
  exclude: Array.isArray(e?.exclude) ? e.exclude : [e?.exclude ?? ""]
2189
2063
  };
2190
- this.watchers.set(t, s);
2064
+ this.watchers.set(t, n);
2191
2065
  }
2192
2066
  /**
2193
2067
  * Stop watching a previously watched path
@@ -2224,13 +2098,13 @@ class dn {
2224
2098
  */
2225
2099
  async open(t, e) {
2226
2100
  await this.mount();
2227
- const { create: s = !1, exclusive: r = !1, truncate: i = !1 } = e || {}, o = H(ft(t));
2101
+ const { create: n = !1, exclusive: i = !1, truncate: r = !1 } = e || {}, o = W(ut(t));
2228
2102
  try {
2229
- return s && r ? await B(o, "exclusive", async () => {
2103
+ return n && i ? await P(o, "exclusive", async () => {
2230
2104
  if (await this.exists(o))
2231
2105
  throw new p(\`File already exists: \${o}\`, "EEXIST", o);
2232
- return this._openFile(o, s, i);
2233
- }) : await this._openFile(o, s, i);
2106
+ return this._openFile(o, n, r);
2107
+ }) : await this._openFile(o, n, r);
2234
2108
  } catch (a) {
2235
2109
  throw a instanceof p ? a : new p(\`Failed to open file: \${o}\`, "OPEN_FAILED", o, a);
2236
2110
  }
@@ -2239,20 +2113,20 @@ class dn {
2239
2113
  * Internal method to open a file (without locking)
2240
2114
  * @private
2241
2115
  */
2242
- async _openFile(t, e, s) {
2243
- const r = await this.getFileHandle(t, e);
2116
+ async _openFile(t, e, n) {
2117
+ const i = await this.getFileHandle(t, e);
2244
2118
  try {
2245
- await r.getFile();
2119
+ await i.getFile();
2246
2120
  } catch (a) {
2247
2121
  throw a.name === "TypeMismatchError" ? new p(\`Is a directory: \${t}\`, "EISDIR", t) : a;
2248
2122
  }
2249
- const i = await It(r, t);
2250
- s && (i.truncate(0), i.flush());
2123
+ const r = await ts(i, t);
2124
+ n && (r.truncate(0), r.flush());
2251
2125
  const o = this.nextFd++;
2252
2126
  return this.openFiles.set(o, {
2253
2127
  path: t,
2254
- fileHandle: r,
2255
- syncHandle: i,
2128
+ fileHandle: i,
2129
+ syncHandle: r,
2256
2130
  position: 0
2257
2131
  }), o;
2258
2132
  }
@@ -2272,7 +2146,7 @@ class dn {
2272
2146
  */
2273
2147
  async close(t) {
2274
2148
  const e = this._getFileDescriptor(t);
2275
- gt(t, e.syncHandle, e.path), this.openFiles.delete(t);
2149
+ dt(t, e.syncHandle, e.path), this.openFiles.delete(t);
2276
2150
  }
2277
2151
  /**
2278
2152
  * Read data from a file descriptor
@@ -2298,17 +2172,17 @@ class dn {
2298
2172
  * await fs.close(fd);
2299
2173
  * \`\`\`
2300
2174
  */
2301
- async read(t, e, s, r, i) {
2175
+ async read(t, e, n, i, r) {
2302
2176
  const o = this._getFileDescriptor(t);
2303
- pt(e.length, s, r, i);
2177
+ ft(e.length, n, i, r);
2304
2178
  try {
2305
- const a = i ?? o.position, l = o.syncHandle.getSize(), { isEOF: h, actualLength: c } = fn(a, r, l);
2179
+ const a = r ?? o.position, l = o.syncHandle.getSize(), { isEOF: h, actualLength: c } = Qe(a, i, l);
2306
2180
  if (h)
2307
- return K({ bytesRead: 0, buffer: e }, [e.buffer]);
2308
- const f = e.subarray(s, s + c), u = o.syncHandle.read(f, { at: a });
2309
- return i === null && (o.position = a + u), K({ bytesRead: u, buffer: e }, [e.buffer]);
2181
+ return H({ bytesRead: 0, buffer: e }, [e.buffer]);
2182
+ const f = e.subarray(n, n + c), u = o.syncHandle.read(f, { at: a });
2183
+ return r == null && (o.position = a + u), H({ bytesRead: u, buffer: e }, [e.buffer]);
2310
2184
  } catch (a) {
2311
- throw k("read", t, o.path, a);
2185
+ throw R("read", t, o.path, a);
2312
2186
  }
2313
2187
  }
2314
2188
  /**
@@ -2319,9 +2193,10 @@ class dn {
2319
2193
  * @param offset - The offset in the buffer to start reading from (default: 0)
2320
2194
  * @param length - The number of bytes to write (default: entire buffer)
2321
2195
  * @param position - The position in the file to write to (null/undefined for current position)
2196
+ * @param emitEvent - Whether to emit a change event (default: true)
2322
2197
  * @returns Promise that resolves to the number of bytes written
2323
2198
  * @throws {OPFSError} If the file descriptor is invalid or writing fails
2324
- *
2199
+ *
2325
2200
  * @example
2326
2201
  * \`\`\`typescript
2327
2202
  * const fd = await fs.open('/data/file.txt', { create: true });
@@ -2331,14 +2206,14 @@ class dn {
2331
2206
  * await fs.close(fd);
2332
2207
  * \`\`\`
2333
2208
  */
2334
- async write(t, e, s = 0, r, i) {
2335
- const o = this._getFileDescriptor(t), a = r ?? e.length - s;
2336
- pt(e.length, s, a, i);
2209
+ async write(t, e, n = 0, i, r, o = !0) {
2210
+ const a = this._getFileDescriptor(t), l = i ?? e.length - n;
2211
+ ft(e.length, n, l, r);
2337
2212
  try {
2338
- const l = i ?? o.position, h = e.subarray(s, s + a), c = o.syncHandle.write(h, { at: l });
2339
- return (i == null || i === o.position) && (o.position = l + c), await this.notifyChange({ path: o.path, type: "changed", isDirectory: !1 }), c;
2340
- } catch (l) {
2341
- throw k("write", t, o.path, l);
2213
+ const h = r ?? a.position, c = e.subarray(n, n + l), f = a.syncHandle.write(c, { at: h });
2214
+ return (r == null || r === a.position) && (a.position = h + f), o && await this.notifyChange({ path: a.path, type: "changed", isDirectory: !1 }), f;
2215
+ } catch (h) {
2216
+ throw R("write", t, a.path, h);
2342
2217
  }
2343
2218
  }
2344
2219
  /**
@@ -2380,13 +2255,13 @@ class dn {
2380
2255
  * \`\`\`
2381
2256
  */
2382
2257
  async ftruncate(t, e = 0) {
2383
- const s = this._getFileDescriptor(t);
2258
+ const n = this._getFileDescriptor(t);
2384
2259
  if (e < 0 || !Number.isInteger(e))
2385
2260
  throw new p("Invalid size", "EINVAL");
2386
2261
  try {
2387
- s.syncHandle.truncate(e), s.syncHandle.flush(), s.position > e && (s.position = e), await this.notifyChange({ path: s.path, type: "changed", isDirectory: !1 });
2388
- } catch (r) {
2389
- throw k("truncate", t, s.path, r);
2262
+ n.syncHandle.truncate(e), n.syncHandle.flush(), n.position > e && (n.position = e), await this.notifyChange({ path: n.path, type: "changed", isDirectory: !1 });
2263
+ } catch (i) {
2264
+ throw R("truncate", t, n.path, i);
2390
2265
  }
2391
2266
  }
2392
2267
  /**
@@ -2407,8 +2282,8 @@ class dn {
2407
2282
  const e = this._getFileDescriptor(t);
2408
2283
  try {
2409
2284
  e.syncHandle.flush();
2410
- } catch (s) {
2411
- throw k("sync", t, e.path, s);
2285
+ } catch (n) {
2286
+ throw R("sync", t, e.path, n);
2412
2287
  }
2413
2288
  }
2414
2289
  /**
@@ -2420,7 +2295,7 @@ class dn {
2420
2295
  dispose() {
2421
2296
  this.broadcastChannel && (this.broadcastChannel.close(), this.broadcastChannel = null), this.watchers.clear();
2422
2297
  for (const [t, e] of this.openFiles)
2423
- gt(t, e.syncHandle, e.path);
2298
+ dt(t, e.syncHandle, e.path);
2424
2299
  this.openFiles.clear(), this.nextFd = 1;
2425
2300
  }
2426
2301
  /**
@@ -2455,17 +2330,17 @@ class dn {
2455
2330
  await this.mount();
2456
2331
  try {
2457
2332
  (e?.cleanBefore ?? !1) && await this.clear("/");
2458
- for (const [r, i] of t) {
2459
- const o = H(r);
2333
+ for (const [i, r] of t) {
2334
+ const o = W(i);
2460
2335
  let a;
2461
- i instanceof Blob ? a = await hn(i) : a = i, await this.writeFile(o, a);
2336
+ r instanceof Blob ? a = await Je(r) : typeof r == "string" ? a = new TextEncoder().encode(r) : a = r, await this.writeFile(o, a);
2462
2337
  }
2463
- } catch (s) {
2464
- throw s instanceof p ? s : new p("Failed to sync file system", "SYNC_FAILED", void 0, s);
2338
+ } catch (n) {
2339
+ throw n instanceof p ? n : new p("Failed to sync file system", "SYNC_FAILED", void 0, n);
2465
2340
  }
2466
2341
  }
2467
2342
  }
2468
- typeof globalThis < "u" && globalThis.constructor.name === "DedicatedWorkerGlobalScope" && tt(new dn());
2469
- //# sourceMappingURL=worker-CvILLJKw.js.map
2470
- `,i=typeof self<"u"&&self.Blob&&new Blob(["URL.revokeObjectURL(import.meta.url);",s],{type:"text/javascript;charset=utf-8"});function a(t){let e;try{if(e=i&&(self.URL||self.webkitURL).createObjectURL(i),!e)throw"";const r=new Worker(e,{type:"module",name:t?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(s),{type:"module",name:t?.name})}}async function c(t){const e=o.wrap(new a);return t&&(t.broadcastChannel&&t.broadcastChannel instanceof BroadcastChannel&&(t.broadcastChannel=t.broadcastChannel.name),await e.setOptions(t)),e}exports.BINARY_FILE_EXTENSIONS=n.BINARY_FILE_EXTENSIONS;exports.DirectoryNotFoundError=n.DirectoryNotFoundError;exports.FileNotFoundError=n.FileNotFoundError;exports.OPFSError=n.OPFSError;exports.OPFSNotMountedError=n.OPFSNotMountedError;exports.OPFSNotSupportedError=n.OPFSNotSupportedError;exports.PathError=n.PathError;exports.PermissionError=n.PermissionError;exports.StorageError=n.StorageError;exports.TimeoutError=n.TimeoutError;exports.basename=n.basename;exports.buffersEqual=n.buffersEqual;exports.calculateFileHash=n.calculateFileHash;exports.calculateReadLength=n.calculateReadLength;exports.checkOPFSSupport=n.checkOPFSSupport;exports.convertBlobToUint8Array=n.convertBlobToUint8Array;exports.createBuffer=n.createBuffer;exports.createFDError=n.createFDError;exports.createSyncHandleSafe=n.createSyncHandleSafe;exports.decodeBuffer=n.decodeBuffer;exports.dirname=n.dirname;exports.encodeString=n.encodeString;exports.extname=n.extname;exports.isBinaryFileExtension=n.isBinaryFileExtension;exports.isPathExcluded=n.isPathExcluded;exports.joinPath=n.joinPath;exports.mapDomError=n.mapDomError;exports.matchMinimatch=n.matchMinimatch;exports.normalizeMinimatch=n.normalizeMinimatch;exports.normalizePath=n.normalizePath;exports.readFileData=n.readFileData;exports.removeEntry=n.removeEntry;exports.resolvePath=n.resolvePath;exports.safeCloseSyncHandle=n.safeCloseSyncHandle;exports.splitPath=n.splitPath;exports.validateReadWriteArgs=n.validateReadWriteArgs;exports.withLock=n.withLock;exports.writeFileData=n.writeFileData;exports.createWorker=c;
2343
+ typeof globalThis < "u" && globalThis.constructor.name === "DedicatedWorkerGlobalScope" && K(new es());
2344
+ //# sourceMappingURL=worker-CLvhwwfc.js.map
2345
+ `,h=typeof self<"u"&&self.Blob&&new Blob(["URL.revokeObjectURL(import.meta.url);",c],{type:"text/javascript;charset=utf-8"});function d(s){let n;try{if(n=h&&(self.URL||self.webkitURL).createObjectURL(h),!n)throw"";const t=new Worker(n,{type:"module",name:s?.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(n)}),t}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(c),{type:"module",name:s?.name})}}class l{#n;constructor(n){const t=f.wrap(new d);this.#n=t,n&&(n.broadcastChannel&&n.broadcastChannel instanceof BroadcastChannel&&(n.broadcastChannel=n.broadcastChannel.name),this.setOptions(n))}async setOptions(n){return this.#n.setOptions(n)}async index(){return this.#n.index()}async readFile(n,t){const r=await this.#n.readFile(n);return t||(t=e.isBinaryFileExtension(n)?"binary":"utf-8"),t==="binary"?r:e.decodeBuffer(r,t)}async writeFile(n,t,r){r||(r=typeof t!="string"||e.isBinaryFileExtension(n)?"binary":"utf-8");const i=typeof t=="string"?e.encodeString(t,r):t instanceof Uint8Array?t:new Uint8Array(t);return this.#n.writeFile(n,i)}async appendFile(n,t,r){r||(r=typeof t!="string"||e.isBinaryFileExtension(n)?"binary":"utf-8");const i=typeof t=="string"?e.encodeString(t,r):t instanceof Uint8Array?t:new Uint8Array(t);return this.#n.appendFile(n,i)}async mkdir(n,t){return this.#n.mkdir(n,t)}async stat(n){return this.#n.stat(n)}async readDir(n){return this.#n.readDir(n)}async exists(n){return this.#n.exists(n)}async clear(n){return this.#n.clear(n)}async remove(n,t){return this.#n.remove(n,t)}async realpath(n){return this.#n.realpath(n)}async rename(n,t,r){return this.#n.rename(n,t,r)}async copy(n,t,r){return this.#n.copy(n,t,r)}watch(n,t){return this.#n.watch(n,t),()=>this.unwatch(n)}unwatch(n){this.#n.unwatch(n)}async open(n,t){return this.#n.open(n,t)}async close(n){return this.#n.close(n)}async read(n,t,r,i,o){const{bytesRead:a,buffer:p}=await this.#n.read(n,new Uint8Array(i),0,i,o);return a>0&&t.set(p.subarray(0,a),r),{bytesRead:a,buffer:t}}async write(n,t,r,i,o,a){return this.#n.write(n,t,r,i,o,a)}async fstat(n){return this.#n.fstat(n)}async ftruncate(n,t){return this.#n.ftruncate(n,t)}async fsync(n){return this.#n.fsync(n)}dispose(){this.#n.dispose()}async sync(n,t){return this.#n.sync(n,t)}async readText(n,t="utf-8"){const r=await this.#n.readFile(n);return e.decodeBuffer(r,t)}async writeText(n,t,r="utf-8"){const i=e.encodeString(t,r);return this.#n.writeFile(n,i)}async appendText(n,t,r="utf-8"){const i=e.encodeString(t,r);return this.#n.appendFile(n,i)}}function u(s){return new l(s)}exports.BINARY_FILE_EXTENSIONS=e.BINARY_FILE_EXTENSIONS;exports.DirectoryNotFoundError=e.DirectoryNotFoundError;exports.FileNotFoundError=e.FileNotFoundError;exports.OPFSError=e.OPFSError;exports.OPFSNotMountedError=e.OPFSNotMountedError;exports.OPFSNotSupportedError=e.OPFSNotSupportedError;exports.PathError=e.PathError;exports.PermissionError=e.PermissionError;exports.StorageError=e.StorageError;exports.TimeoutError=e.TimeoutError;exports.basename=e.basename;exports.buffersEqual=e.buffersEqual;exports.calculateFileHash=e.calculateFileHash;exports.calculateReadLength=e.calculateReadLength;exports.checkOPFSSupport=e.checkOPFSSupport;exports.convertBlobToUint8Array=e.convertBlobToUint8Array;exports.createBuffer=e.createBuffer;exports.createFDError=e.createFDError;exports.createSyncHandleSafe=e.createSyncHandleSafe;exports.decodeBuffer=e.decodeBuffer;exports.dirname=e.dirname;exports.encodeString=e.encodeString;exports.extname=e.extname;exports.isBinaryFileExtension=e.isBinaryFileExtension;exports.isPathExcluded=e.isPathExcluded;exports.joinPath=e.joinPath;exports.mapDomError=e.mapDomError;exports.matchMinimatch=e.matchMinimatch;exports.normalizeMinimatch=e.normalizeMinimatch;exports.normalizePath=e.normalizePath;exports.removeEntry=e.removeEntry;exports.resolvePath=e.resolvePath;exports.safeCloseSyncHandle=e.safeCloseSyncHandle;exports.splitPath=e.splitPath;exports.validateReadWriteArgs=e.validateReadWriteArgs;exports.withLock=e.withLock;exports.OPFSFileSystem=l;exports.createWorker=u;
2471
2346
  //# sourceMappingURL=index.cjs.map