opfs-worker 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,63 +1,63 @@
1
1
  import { wrap as i, proxy as o } from "comlink";
2
- import { D as u, F as d, O as p, b as w, a as y, P as m, c as g, S as v, T as E, e as S, k as F, d as b, l as P, h as x, o as A, f as T, m as O, g as I, j as _, n as D, i as k, r as C, s as U, w as R } from "./helpers-Co-qCBmA.js";
2
+ import { D as u, F as d, O as p, b as w, a as y, P as m, c as g, S as v, T as E, e as S, k as F, d as b, l as P, h as x, o as A, f as T, m as O, g as I, j as _, n as D, i as k, r as R, s as U, w as C } from "./helpers-Co-qCBmA.js";
3
3
  const a = `/**
4
4
  * @license
5
5
  * Copyright 2019 Google LLC
6
6
  * SPDX-License-Identifier: Apache-2.0
7
7
  */
8
- const H = Symbol("Comlink.proxy"), R = Symbol("Comlink.endpoint"), B = Symbol("Comlink.releaseProxy"), T = Symbol("Comlink.finalizer"), p = Symbol("Comlink.thrown"), $ = (e) => typeof e == "object" && e !== null || typeof e == "function", W = {
9
- canHandle: (e) => $(e) && e[H],
10
- serialize(e) {
11
- const { port1: t, port2: r } = new MessageChannel();
12
- return O(e, t), [r, [r]];
8
+ const H = Symbol("Comlink.proxy"), R = Symbol("Comlink.endpoint"), B = Symbol("Comlink.releaseProxy"), T = Symbol("Comlink.finalizer"), p = Symbol("Comlink.thrown"), $ = (t) => typeof t == "object" && t !== null || typeof t == "function", W = {
9
+ canHandle: (t) => $(t) && t[H],
10
+ serialize(t) {
11
+ const { port1: e, port2: r } = new MessageChannel();
12
+ return x(t, e), [r, [r]];
13
13
  },
14
- deserialize(e) {
15
- return e.start(), Y(e);
14
+ deserialize(t) {
15
+ return t.start(), Y(t);
16
16
  }
17
17
  }, j = {
18
- canHandle: (e) => $(e) && p in e,
19
- serialize({ value: e }) {
20
- let t;
21
- return e instanceof Error ? t = {
18
+ canHandle: (t) => $(t) && p in t,
19
+ serialize({ value: t }) {
20
+ let e;
21
+ return t instanceof Error ? e = {
22
22
  isError: !0,
23
23
  value: {
24
- message: e.message,
25
- name: e.name,
26
- stack: e.stack
24
+ message: t.message,
25
+ name: t.name,
26
+ stack: t.stack
27
27
  }
28
- } : t = { isError: !1, value: e }, [t, []];
28
+ } : e = { isError: !1, value: t }, [e, []];
29
29
  },
30
- deserialize(e) {
31
- throw e.isError ? Object.assign(new Error(e.value.message), e.value) : e.value;
30
+ deserialize(t) {
31
+ throw t.isError ? Object.assign(new Error(t.value.message), t.value) : t.value;
32
32
  }
33
33
  }, U = /* @__PURE__ */ new Map([
34
34
  ["proxy", W],
35
35
  ["throw", j]
36
36
  ]);
37
- function V(e, t) {
38
- for (const r of e)
39
- if (t === r || r === "*" || r instanceof RegExp && r.test(t))
37
+ function V(t, e) {
38
+ for (const r of t)
39
+ if (e === r || r === "*" || r instanceof RegExp && r.test(e))
40
40
  return !0;
41
41
  return !1;
42
42
  }
43
- function O(e, t = globalThis, r = ["*"]) {
44
- t.addEventListener("message", function a(n) {
43
+ function x(t, e = globalThis, r = ["*"]) {
44
+ e.addEventListener("message", function a(n) {
45
45
  if (!n || !n.data)
46
46
  return;
47
47
  if (!V(r, n.origin)) {
48
48
  console.warn(\`Invalid origin '\${n.origin}' for comlink proxy\`);
49
49
  return;
50
50
  }
51
- const { id: s, type: o, path: i } = Object.assign({ path: [] }, n.data), l = (n.data.argumentList || []).map(d);
51
+ const { id: i, type: o, path: s } = Object.assign({ path: [] }, n.data), l = (n.data.argumentList || []).map(d);
52
52
  let u;
53
53
  try {
54
- const f = i.slice(0, -1).reduce((h, g) => h[g], e), w = i.reduce((h, g) => h[g], e);
54
+ const f = s.slice(0, -1).reduce((h, g) => h[g], t), w = s.reduce((h, g) => h[g], t);
55
55
  switch (o) {
56
56
  case "GET":
57
57
  u = w;
58
58
  break;
59
59
  case "SET":
60
- f[i.slice(-1)[0]] = d(n.data.value), u = !0;
60
+ f[s.slice(-1)[0]] = d(n.data.value), u = !0;
61
61
  break;
62
62
  case "APPLY":
63
63
  u = w.apply(f, l);
@@ -71,7 +71,7 @@ function O(e, t = globalThis, r = ["*"]) {
71
71
  case "ENDPOINT":
72
72
  {
73
73
  const { port1: h, port2: g } = new MessageChannel();
74
- O(e, g), u = J(h, [h]);
74
+ x(t, g), u = J(h, [h]);
75
75
  }
76
76
  break;
77
77
  case "RELEASE":
@@ -85,138 +85,138 @@ function O(e, t = globalThis, r = ["*"]) {
85
85
  }
86
86
  Promise.resolve(u).catch((f) => ({ value: f, [p]: 0 })).then((f) => {
87
87
  const [w, h] = A(f);
88
- t.postMessage(Object.assign(Object.assign({}, w), { id: s }), h), o === "RELEASE" && (t.removeEventListener("message", a), L(t), T in e && typeof e[T] == "function" && e[T]());
88
+ e.postMessage(Object.assign(Object.assign({}, w), { id: i }), h), o === "RELEASE" && (e.removeEventListener("message", a), L(e), T in t && typeof t[T] == "function" && t[T]());
89
89
  }).catch((f) => {
90
90
  const [w, h] = A({
91
91
  value: new TypeError("Unserializable return value"),
92
92
  [p]: 0
93
93
  });
94
- t.postMessage(Object.assign(Object.assign({}, w), { id: s }), h);
94
+ e.postMessage(Object.assign(Object.assign({}, w), { id: i }), h);
95
95
  });
96
- }), t.start && t.start();
96
+ }), e.start && e.start();
97
97
  }
98
- function G(e) {
99
- return e.constructor.name === "MessagePort";
98
+ function G(t) {
99
+ return t.constructor.name === "MessagePort";
100
100
  }
101
- function L(e) {
102
- G(e) && e.close();
101
+ function L(t) {
102
+ G(t) && t.close();
103
103
  }
104
- function Y(e, t) {
104
+ function Y(t, e) {
105
105
  const r = /* @__PURE__ */ new Map();
106
- return e.addEventListener("message", function(n) {
107
- const { data: s } = n;
108
- if (!s || !s.id)
106
+ return t.addEventListener("message", function(n) {
107
+ const { data: i } = n;
108
+ if (!i || !i.id)
109
109
  return;
110
- const o = r.get(s.id);
110
+ const o = r.get(i.id);
111
111
  if (o)
112
112
  try {
113
- o(s);
113
+ o(i);
114
114
  } finally {
115
- r.delete(s.id);
115
+ r.delete(i.id);
116
116
  }
117
- }), x(e, r, [], t);
117
+ }), O(t, r, [], e);
118
118
  }
119
- function E(e) {
120
- if (e)
119
+ function E(t) {
120
+ if (t)
121
121
  throw new Error("Proxy has been released and is not useable");
122
122
  }
123
- function z(e) {
124
- return y(e, /* @__PURE__ */ new Map(), {
123
+ function z(t) {
124
+ return y(t, /* @__PURE__ */ new Map(), {
125
125
  type: "RELEASE"
126
126
  }).then(() => {
127
- L(e);
127
+ L(t);
128
128
  });
129
129
  }
130
- const F = /* @__PURE__ */ new WeakMap(), S = "FinalizationRegistry" in globalThis && new FinalizationRegistry((e) => {
131
- const t = (F.get(e) || 0) - 1;
132
- F.set(e, t), t === 0 && z(e);
130
+ const F = /* @__PURE__ */ new WeakMap(), S = "FinalizationRegistry" in globalThis && new FinalizationRegistry((t) => {
131
+ const e = (F.get(t) || 0) - 1;
132
+ F.set(t, e), e === 0 && z(t);
133
133
  });
134
- function X(e, t) {
135
- const r = (F.get(t) || 0) + 1;
136
- F.set(t, r), S && S.register(e, t, e);
134
+ function X(t, e) {
135
+ const r = (F.get(e) || 0) + 1;
136
+ F.set(e, r), S && S.register(t, e, t);
137
137
  }
138
- function q(e) {
139
- S && S.unregister(e);
138
+ function q(t) {
139
+ S && S.unregister(t);
140
140
  }
141
- function x(e, t, r = [], a = function() {
141
+ function O(t, e, r = [], a = function() {
142
142
  }) {
143
143
  let n = !1;
144
- const s = new Proxy(a, {
145
- get(o, i) {
146
- if (E(n), i === B)
144
+ const i = new Proxy(a, {
145
+ get(o, s) {
146
+ if (E(n), s === B)
147
147
  return () => {
148
- q(s), z(e), t.clear(), n = !0;
148
+ q(i), z(t), e.clear(), n = !0;
149
149
  };
150
- if (i === "then") {
150
+ if (s === "then") {
151
151
  if (r.length === 0)
152
- return { then: () => s };
153
- const l = y(e, t, {
152
+ return { then: () => i };
153
+ const l = y(t, e, {
154
154
  type: "GET",
155
155
  path: r.map((u) => u.toString())
156
156
  }).then(d);
157
157
  return l.then.bind(l);
158
158
  }
159
- return x(e, t, [...r, i]);
159
+ return O(t, e, [...r, s]);
160
160
  },
161
- set(o, i, l) {
161
+ set(o, s, l) {
162
162
  E(n);
163
163
  const [u, f] = A(l);
164
- return y(e, t, {
164
+ return y(t, e, {
165
165
  type: "SET",
166
- path: [...r, i].map((w) => w.toString()),
166
+ path: [...r, s].map((w) => w.toString()),
167
167
  value: u
168
168
  }, f).then(d);
169
169
  },
170
- apply(o, i, l) {
170
+ apply(o, s, l) {
171
171
  E(n);
172
172
  const u = r[r.length - 1];
173
173
  if (u === R)
174
- return y(e, t, {
174
+ return y(t, e, {
175
175
  type: "ENDPOINT"
176
176
  }).then(d);
177
177
  if (u === "bind")
178
- return x(e, t, r.slice(0, -1));
179
- const [f, w] = v(l);
180
- return y(e, t, {
178
+ return O(t, e, r.slice(0, -1));
179
+ const [f, w] = N(l);
180
+ return y(t, e, {
181
181
  type: "APPLY",
182
182
  path: r.map((h) => h.toString()),
183
183
  argumentList: f
184
184
  }, w).then(d);
185
185
  },
186
- construct(o, i) {
186
+ construct(o, s) {
187
187
  E(n);
188
- const [l, u] = v(i);
189
- return y(e, t, {
188
+ const [l, u] = N(s);
189
+ return y(t, e, {
190
190
  type: "CONSTRUCT",
191
191
  path: r.map((f) => f.toString()),
192
192
  argumentList: l
193
193
  }, u).then(d);
194
194
  }
195
195
  });
196
- return X(s, e), s;
196
+ return X(i, t), i;
197
197
  }
198
- function K(e) {
199
- return Array.prototype.concat.apply([], e);
198
+ function K(t) {
199
+ return Array.prototype.concat.apply([], t);
200
200
  }
201
- function v(e) {
202
- const t = e.map(A);
203
- return [t.map((r) => r[0]), K(t.map((r) => r[1]))];
201
+ function N(t) {
202
+ const e = t.map(A);
203
+ return [e.map((r) => r[0]), K(e.map((r) => r[1]))];
204
204
  }
205
205
  const _ = /* @__PURE__ */ new WeakMap();
206
- function J(e, t) {
207
- return _.set(e, t), e;
206
+ function J(t, e) {
207
+ return _.set(t, e), t;
208
208
  }
209
- function Q(e) {
210
- return Object.assign(e, { [H]: !0 });
209
+ function Q(t) {
210
+ return Object.assign(t, { [H]: !0 });
211
211
  }
212
- function A(e) {
213
- for (const [t, r] of U)
214
- if (r.canHandle(e)) {
215
- const [a, n] = r.serialize(e);
212
+ function A(t) {
213
+ for (const [e, r] of U)
214
+ if (r.canHandle(t)) {
215
+ const [a, n] = r.serialize(t);
216
216
  return [
217
217
  {
218
218
  type: "HANDLER",
219
- name: t,
219
+ name: e,
220
220
  value: a
221
221
  },
222
222
  n
@@ -225,31 +225,31 @@ function A(e) {
225
225
  return [
226
226
  {
227
227
  type: "RAW",
228
- value: e
228
+ value: t
229
229
  },
230
- _.get(e) || []
230
+ _.get(t) || []
231
231
  ];
232
232
  }
233
- function d(e) {
234
- switch (e.type) {
233
+ function d(t) {
234
+ switch (t.type) {
235
235
  case "HANDLER":
236
- return U.get(e.name).deserialize(e.value);
236
+ return U.get(t.name).deserialize(t.value);
237
237
  case "RAW":
238
- return e.value;
238
+ return t.value;
239
239
  }
240
240
  }
241
- function y(e, t, r, a) {
241
+ function y(t, e, r, a) {
242
242
  return new Promise((n) => {
243
- const s = Z();
244
- t.set(s, n), e.start && e.start(), e.postMessage(Object.assign({ id: s }, r), a);
243
+ const i = Z();
244
+ e.set(i, n), t.start && t.start(), t.postMessage(Object.assign({ id: i }, r), a);
245
245
  });
246
246
  }
247
247
  function Z() {
248
248
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
249
249
  }
250
250
  class c extends Error {
251
- constructor(t, r, a) {
252
- super(t), this.code = r, this.path = a, this.name = "OPFSError";
251
+ constructor(e, r, a) {
252
+ super(e), this.code = r, this.path = a, this.name = "OPFSError";
253
253
  }
254
254
  }
255
255
  class ee extends c {
@@ -263,112 +263,112 @@ class D extends c {
263
263
  }
264
264
  }
265
265
  class k extends c {
266
- constructor(t, r) {
267
- super(t, "INVALID_PATH", r);
266
+ constructor(e, r) {
267
+ super(e, "INVALID_PATH", r);
268
268
  }
269
269
  }
270
270
  class b extends c {
271
- constructor(t) {
272
- super(\`File not found: \${t}\`, "FILE_NOT_FOUND", t);
271
+ constructor(e) {
272
+ super(\`File not found: \${e}\`, "FILE_NOT_FOUND", e);
273
273
  }
274
274
  }
275
- function te(e, t = "utf-8") {
276
- switch (t) {
275
+ function te(t, e = "utf-8") {
276
+ switch (e) {
277
277
  case "utf8":
278
278
  case "utf-8":
279
- return new TextEncoder().encode(e);
279
+ return new TextEncoder().encode(t);
280
280
  case "utf16le":
281
281
  case "ucs2":
282
282
  case "ucs-2":
283
- return ne(e);
283
+ return ne(t);
284
284
  case "ascii":
285
- return ie(e);
285
+ return se(t);
286
286
  case "latin1":
287
- return se(e);
287
+ return ie(t);
288
288
  case "binary":
289
- return Uint8Array.from(e, (r) => r.charCodeAt(0));
289
+ return Uint8Array.from(t, (r) => r.charCodeAt(0));
290
290
  case "base64":
291
- return Uint8Array.from(atob(e), (r) => r.charCodeAt(0));
291
+ return Uint8Array.from(atob(t), (r) => r.charCodeAt(0));
292
292
  case "hex":
293
- if (!/^[\\da-f]+$/i.test(e) || e.length % 2 !== 0)
293
+ if (!/^[\\da-f]+$/i.test(t) || t.length % 2 !== 0)
294
294
  throw new c("Invalid hex string", "INVALID_HEX_FORMAT");
295
- return Uint8Array.from(e.match(/.{1,2}/g).map((r) => parseInt(r, 16)));
295
+ return Uint8Array.from(t.match(/.{1,2}/g).map((r) => parseInt(r, 16)));
296
296
  default:
297
- return console.warn("Encoding not supported, falling back to UTF-8"), new TextEncoder().encode(e);
297
+ return console.warn("Encoding not supported, falling back to UTF-8"), new TextEncoder().encode(t);
298
298
  }
299
299
  }
300
- function re(e, t = "utf-8") {
301
- switch (t) {
300
+ function re(t, e = "utf-8") {
301
+ switch (e) {
302
302
  case "utf8":
303
303
  case "utf-8":
304
- return new TextDecoder().decode(e);
304
+ return new TextDecoder().decode(t);
305
305
  case "utf16le":
306
306
  case "ucs2":
307
307
  case "ucs-2":
308
- return ae(e);
308
+ return ae(t);
309
309
  case "latin1":
310
- return String.fromCharCode(...e);
310
+ return String.fromCharCode(...t);
311
311
  case "binary":
312
- return String.fromCharCode(...e);
312
+ return String.fromCharCode(...t);
313
313
  case "ascii":
314
- return String.fromCharCode(...e.map((r) => r & 127));
314
+ return String.fromCharCode(...t.map((r) => r & 127));
315
315
  case "base64":
316
- return btoa(String.fromCharCode(...e));
316
+ return btoa(String.fromCharCode(...t));
317
317
  case "hex":
318
- return Array.from(e).map((r) => r.toString(16).padStart(2, "0")).join("");
318
+ return Array.from(t).map((r) => r.toString(16).padStart(2, "0")).join("");
319
319
  default:
320
- return console.warn("Unsupported encoding, falling back to UTF-8"), new TextDecoder().decode(e);
320
+ return console.warn("Unsupported encoding, falling back to UTF-8"), new TextDecoder().decode(t);
321
321
  }
322
322
  }
323
- function ne(e) {
324
- const t = new Uint8Array(e.length * 2);
325
- for (let r = 0; r < e.length; r++) {
326
- const a = e.charCodeAt(r);
327
- t[r * 2] = a & 255, t[r * 2 + 1] = a >> 8;
323
+ function ne(t) {
324
+ const e = new Uint8Array(t.length * 2);
325
+ for (let r = 0; r < t.length; r++) {
326
+ const a = t.charCodeAt(r);
327
+ e[r * 2] = a & 255, e[r * 2 + 1] = a >> 8;
328
328
  }
329
- return t;
329
+ return e;
330
330
  }
331
- function ae(e) {
332
- e.length % 2 !== 0 && (console.warn("Invalid UTF-16LE buffer length, truncating last byte"), e = e.slice(0, e.length - 1));
333
- const t = new Uint16Array(e.buffer, e.byteOffset, e.byteLength / 2);
334
- return String.fromCharCode(...t);
331
+ function ae(t) {
332
+ t.length % 2 !== 0 && (console.warn("Invalid UTF-16LE buffer length, truncating last byte"), t = t.slice(0, t.length - 1));
333
+ const e = new Uint16Array(t.buffer, t.byteOffset, t.byteLength / 2);
334
+ return String.fromCharCode(...e);
335
335
  }
336
- function se(e) {
337
- const t = new Uint8Array(e.length);
338
- for (let r = 0; r < e.length; r++)
339
- t[r] = e.charCodeAt(r) & 255;
340
- return t;
336
+ function ie(t) {
337
+ const e = new Uint8Array(t.length);
338
+ for (let r = 0; r < t.length; r++)
339
+ e[r] = t.charCodeAt(r) & 255;
340
+ return e;
341
341
  }
342
- function ie(e) {
343
- const t = new Uint8Array(e.length);
344
- for (let r = 0; r < e.length; r++)
345
- t[r] = e.charCodeAt(r) & 127;
346
- return t;
342
+ function se(t) {
343
+ const e = new Uint8Array(t.length);
344
+ for (let r = 0; r < t.length; r++)
345
+ e[r] = t.charCodeAt(r) & 127;
346
+ return e;
347
347
  }
348
348
  function oe() {
349
349
  if (!("storage" in navigator) || !("getDirectory" in navigator.storage))
350
350
  throw new ee();
351
351
  }
352
- function m(e) {
353
- return Array.isArray(e) ? e : e.split("/").filter(Boolean);
352
+ function m(t) {
353
+ return Array.isArray(t) ? t : t.split("/").filter(Boolean);
354
354
  }
355
- function N(e) {
356
- return typeof e == "string" ? e ?? "/" : \`/\${e.join("/")}\`;
355
+ function v(t) {
356
+ return typeof t == "string" ? t ?? "/" : \`/\${t.join("/")}\`;
357
357
  }
358
- function P(e) {
359
- const t = m(e);
360
- return t[t.length - 1] || "";
358
+ function I(t) {
359
+ const e = m(t);
360
+ return e[e.length - 1] || "";
361
361
  }
362
- function M(e) {
363
- const t = m(e);
364
- return t.pop(), N(t);
362
+ function P(t) {
363
+ const e = m(t);
364
+ return e.pop(), v(e);
365
365
  }
366
- function I(e) {
367
- return !e || e === "/" ? "/" : e.startsWith("/") ? e : \`/\${e}\`;
366
+ function M(t) {
367
+ return !t || t === "/" ? "/" : t.startsWith("/") ? t : \`/\${t}\`;
368
368
  }
369
- function ce(e) {
370
- const t = m(e), r = [];
371
- for (const a of t)
369
+ function ce(t) {
370
+ const e = m(t), r = [];
371
+ for (const a of e)
372
372
  if (!(a === "." || a === ""))
373
373
  if (a === "..") {
374
374
  if (r.length === 0)
@@ -376,28 +376,28 @@ function ce(e) {
376
376
  r.pop();
377
377
  } else
378
378
  r.push(a);
379
- return N(r);
379
+ return v(r);
380
380
  }
381
- function le(e, t = "utf-8") {
382
- return typeof e == "string" ? te(e, t) : e instanceof Uint8Array ? e : new Uint8Array(e);
381
+ function le(t, e = "utf-8") {
382
+ return typeof t == "string" ? te(t, e) : t instanceof Uint8Array ? t : new Uint8Array(t);
383
383
  }
384
- async function ue(e) {
385
- const t = await e.createSyncAccessHandle();
384
+ async function ue(t) {
385
+ const e = await t.createSyncAccessHandle();
386
386
  try {
387
- const r = t.getSize(), a = new Uint8Array(r);
388
- return t.read(a, { at: 0 }), a;
387
+ const r = e.getSize(), a = new Uint8Array(r);
388
+ return e.read(a, { at: 0 }), a;
389
389
  } finally {
390
- t.close();
390
+ e.close();
391
391
  }
392
392
  }
393
- async function C(e, t, r, a = {}) {
393
+ async function C(t, e, r, a = {}) {
394
394
  let n = null;
395
395
  try {
396
- n = await e.createSyncAccessHandle();
397
- const s = le(t, r), o = a.append ? n.getSize() : 0;
398
- n.write(s, { at: o }), a.truncate && !a.append && n.truncate(s.byteLength), n.flush();
399
- } catch (s) {
400
- console.error(s);
396
+ n = await t.createSyncAccessHandle();
397
+ const i = le(e, r), o = a.append ? n.getSize() : 0;
398
+ n.write(i, { at: o }), a.truncate && !a.append && n.truncate(i.byteLength), n.flush();
399
+ } catch (i) {
400
+ console.error(i);
401
401
  const o = a.append ? "append" : "write";
402
402
  throw new c(\`Failed to \${o} file\`, \`\${o.toUpperCase()}_FAILED\`);
403
403
  } finally {
@@ -408,17 +408,17 @@ async function C(e, t, r, a = {}) {
408
408
  }
409
409
  }
410
410
  }
411
- async function fe(e, t = "SHA-1") {
411
+ async function fe(t, e = "SHA-1") {
412
412
  try {
413
- const r = new Uint8Array(e), a = await crypto.subtle.digest(t, r);
414
- return Array.from(new Uint8Array(a)).map((s) => s.toString(16).padStart(2, "0")).join("");
413
+ const r = new Uint8Array(t), a = await crypto.subtle.digest(e, r);
414
+ return Array.from(new Uint8Array(a)).map((i) => i.toString(16).padStart(2, "0")).join("");
415
415
  } catch (r) {
416
- throw console.warn(\`Failed to calculate \${t} hash:\`, r), r;
416
+ throw console.warn(\`Failed to calculate \${e} hash:\`, r), r;
417
417
  }
418
418
  }
419
- async function he(e) {
420
- const t = await e.arrayBuffer();
421
- return new Uint8Array(t);
419
+ async function he(t) {
420
+ const e = await t.arrayBuffer();
421
+ return new Uint8Array(e);
422
422
  }
423
423
  class we {
424
424
  /** Root directory handle for the file system */
@@ -442,8 +442,8 @@ class we {
442
442
  * @param watchOptions - Optional configuration for watching
443
443
  * @throws {OPFSError} If OPFS is not supported in the current browser
444
444
  */
445
- constructor(t, r) {
446
- oe(), t && (this.watchCallback = t, r?.watchInterval && (this.watchInterval = r.watchInterval)), this.mount("/");
445
+ constructor(e, r) {
446
+ oe(), e && (this.watchCallback = e, r?.watchInterval && (this.watchInterval = r.watchInterval)), this.mount("/");
447
447
  }
448
448
  /**
449
449
  * Initialize the file system within a given directory
@@ -466,12 +466,12 @@ class we {
466
466
  * await fs.mount('/my-app');
467
467
  * \`\`\`
468
468
  */
469
- async mount(t = "/") {
469
+ async mount(e = "/") {
470
470
  return this.mountingPromise && await this.mountingPromise, this.mountingPromise = new Promise(async (r, a) => {
471
471
  this.root = null;
472
472
  try {
473
473
  const n = await navigator.storage.getDirectory();
474
- t === "/" ? this.root = n : this.root = await this.getDirectoryHandle(t, !0, n), r(!0);
474
+ e === "/" ? this.root = n : this.root = await this.getDirectoryHandle(e, !0, n), r(!0);
475
475
  } catch (n) {
476
476
  console.error(n), a(new c("Failed to initialize OPFS", "INIT_FAILED"));
477
477
  } finally {
@@ -485,8 +485,8 @@ class we {
485
485
  * @param callback - The callback function to invoke when files change
486
486
  * @param options - Optional configuration for watching
487
487
  */
488
- setWatchCallback(t, r) {
489
- this.watchCallback = t, r?.watchInterval && (this.watchInterval = r.watchInterval);
488
+ setWatchCallback(e, r) {
489
+ this.watchCallback = e, r?.watchInterval && (this.watchInterval = r.watchInterval);
490
490
  }
491
491
  /**
492
492
  * Automatically mount the OPFS root if not already mounted
@@ -524,14 +524,14 @@ class we {
524
524
  * const docsDir2 = await fs.getDirectoryHandle(['users', 'john', 'documents'], true);
525
525
  * \`\`\`
526
526
  */
527
- async getDirectoryHandle(t, r = !1, a = this.root) {
527
+ async getDirectoryHandle(e, r = !1, a = this.root) {
528
528
  if (!a)
529
529
  throw new D();
530
- const n = Array.isArray(t) ? t : m(t);
531
- let s = a;
530
+ const n = Array.isArray(e) ? e : m(e);
531
+ let i = a;
532
532
  for (const o of n)
533
- s = await s.getDirectoryHandle(o, { create: r });
534
- return s;
533
+ i = await i.getDirectoryHandle(o, { create: r });
534
+ return i;
535
535
  }
536
536
  /**
537
537
  * Get a file handle from a path
@@ -552,14 +552,14 @@ class we {
552
552
  * const fileHandle2 = await fs.getFileHandle(['config', 'settings.json'], true);
553
553
  * \`\`\`
554
554
  */
555
- async getFileHandle(t, r = !1, a = this.root) {
555
+ async getFileHandle(e, r = !1, a = this.root) {
556
556
  if (!a)
557
557
  throw new D();
558
- const n = m(t);
558
+ const n = m(e);
559
559
  if (n.length === 0)
560
- throw new k("Path must not be empty", Array.isArray(t) ? t.join("/") : t);
561
- const s = n.pop();
562
- return (await this.getDirectoryHandle(n, r, a)).getFileHandle(s, { create: r });
560
+ throw new k("Path must not be empty", Array.isArray(e) ? e.join("/") : e);
561
+ const i = n.pop();
562
+ return (await this.getDirectoryHandle(n, r, a)).getFileHandle(i, { create: r });
563
563
  }
564
564
  /**
565
565
  * Recursively list all files and directories with their stats
@@ -598,16 +598,16 @@ class we {
598
598
  * }
599
599
  * \`\`\`
600
600
  */
601
- async index(t) {
601
+ async index(e) {
602
602
  const r = /* @__PURE__ */ new Map(), a = async (n) => {
603
- const s = await this.readdir(n, { withFileTypes: !0 });
604
- for (const o of s) {
605
- const i = \`\${n === "/" ? "" : n}/\${o.name}\`;
603
+ const i = await this.readdir(n, { withFileTypes: !0 });
604
+ for (const o of i) {
605
+ const s = \`\${n === "/" ? "" : n}/\${o.name}\`;
606
606
  try {
607
- const l = await this.stat(i, t);
608
- r.set(i, l), l.isDirectory && await a(i);
607
+ const l = await this.stat(s, e);
608
+ r.set(s, l), l.isDirectory && await a(s);
609
609
  } catch (l) {
610
- console.warn(\`Skipping broken entry: \${i}\`, l);
610
+ console.warn(\`Skipping broken entry: \${s}\`, l);
611
611
  }
612
612
  }
613
613
  };
@@ -620,13 +620,13 @@ class we {
620
620
  isDirectory: !0
621
621
  }), await a("/"), r;
622
622
  }
623
- async readFile(t, r = "utf-8") {
623
+ async readFile(e, r = "utf-8") {
624
624
  await this.ensureMounted();
625
625
  try {
626
- const a = await this.getFileHandle(t, !1), n = await ue(a);
626
+ const a = await this.getFileHandle(e, !1), n = await ue(a);
627
627
  return r === "binary" ? n : re(n, r);
628
628
  } catch (a) {
629
- throw console.error(a), new b(t);
629
+ throw console.error(a), new b(e);
630
630
  }
631
631
  }
632
632
  /**
@@ -654,9 +654,9 @@ class we {
654
654
  * await fs.writeFile('/data/utf16.txt', 'Hello World', 'utf-16le');
655
655
  * \`\`\`
656
656
  */
657
- async writeFile(t, r, a) {
657
+ async writeFile(e, r, a) {
658
658
  await this.ensureMounted();
659
- const n = await this.getFileHandle(t, !0);
659
+ const n = await this.getFileHandle(e, !0);
660
660
  await C(n, r, a, { truncate: !0 });
661
661
  }
662
662
  /**
@@ -681,9 +681,9 @@ class we {
681
681
  * await fs.appendFile('/data/binary.dat', additionalData);
682
682
  * \`\`\`
683
683
  */
684
- async appendFile(t, r, a) {
684
+ async appendFile(e, r, a) {
685
685
  await this.ensureMounted();
686
- const n = await this.getFileHandle(t, !0);
686
+ const n = await this.getFileHandle(e, !0);
687
687
  await C(n, r, a, { append: !0 });
688
688
  }
689
689
  /**
@@ -707,20 +707,20 @@ class we {
707
707
  * await fs.mkdir('/users/john/documents/projects', { recursive: true });
708
708
  * \`\`\`
709
709
  */
710
- async mkdir(t, r) {
710
+ async mkdir(e, r) {
711
711
  if (await this.ensureMounted(), !this.root)
712
712
  throw new D();
713
- const a = r?.recursive ?? !1, n = m(t);
714
- let s = this.root;
713
+ const a = r?.recursive ?? !1, n = m(e);
714
+ let i = this.root;
715
715
  for (let o = 0; o < n.length; o++) {
716
- const i = n[o];
716
+ const s = n[o];
717
717
  try {
718
- s = await s.getDirectoryHandle(i, { create: a || o === n.length - 1 });
718
+ i = await i.getDirectoryHandle(s, { create: a || o === n.length - 1 });
719
719
  } catch (l) {
720
720
  throw l.name === "NotFoundError" ? new c(
721
- \`Parent directory does not exist: \${N(n.slice(0, o + 1))}\`,
721
+ \`Parent directory does not exist: \${v(n.slice(0, o + 1))}\`,
722
722
  "ENOENT"
723
- ) : l.name === "TypeMismatchError" ? new c(\`Path segment is not a directory: \${i}\`, "ENOTDIR") : new c("Failed to create directory", "MKDIR_FAILED");
723
+ ) : l.name === "TypeMismatchError" ? new c(\`Path segment is not a directory: \${s}\`, "ENOTDIR") : new c("Failed to create directory", "MKDIR_FAILED");
724
724
  }
725
725
  }
726
726
  }
@@ -753,9 +753,17 @@ class we {
753
753
  * console.log(\`Hash: \${statsWithHash.hash}\`);
754
754
  * \`\`\`
755
755
  */
756
- async stat(t, r) {
757
- await this.ensureMounted();
758
- const a = P(t), n = await this.getDirectoryHandle(M(t), !1), s = r?.includeHash ?? !1, o = r?.hashAlgorithm ?? "SHA-1";
756
+ async stat(e, r) {
757
+ if (await this.ensureMounted(), e === "/")
758
+ return {
759
+ kind: "directory",
760
+ size: 0,
761
+ mtime: (/* @__PURE__ */ new Date(0)).toISOString(),
762
+ ctime: (/* @__PURE__ */ new Date(0)).toISOString(),
763
+ isFile: !1,
764
+ isDirectory: !0
765
+ };
766
+ const a = I(e), n = await this.getDirectoryHandle(P(e), !1), i = r?.includeHash ?? !1, o = r?.hashAlgorithm ?? "SHA-1";
759
767
  try {
760
768
  const l = await (await n.getFileHandle(a, { create: !1 })).getFile(), u = {
761
769
  kind: "file",
@@ -765,16 +773,16 @@ class we {
765
773
  isFile: !0,
766
774
  isDirectory: !1
767
775
  };
768
- if (s)
776
+ if (i)
769
777
  try {
770
778
  const f = new Uint8Array(await l.arrayBuffer()), w = await fe(f, o);
771
779
  u.hash = w;
772
780
  } catch (f) {
773
- console.warn(\`Failed to calculate hash for \${t}:\`, f);
781
+ console.warn(\`Failed to calculate hash for \${e}:\`, f);
774
782
  }
775
783
  return u;
776
- } catch (i) {
777
- if (i.name !== "TypeMismatchError" && i.name !== "NotFoundError")
784
+ } catch (s) {
785
+ if (s.name !== "TypeMismatchError" && s.name !== "NotFoundError")
778
786
  throw new c("Failed to stat (file)", "STAT_FAILED");
779
787
  }
780
788
  try {
@@ -786,30 +794,30 @@ class we {
786
794
  isFile: !1,
787
795
  isDirectory: !0
788
796
  };
789
- } catch (i) {
790
- throw i.name === "NotFoundError" ? new c(\`No such file or directory: \${t}\`, "ENOENT") : new c("Failed to stat (directory)", "STAT_FAILED");
797
+ } catch (s) {
798
+ throw s.name === "NotFoundError" ? new c(\`No such file or directory: \${e}\`, "ENOENT") : new c("Failed to stat (directory)", "STAT_FAILED");
791
799
  }
792
800
  }
793
- async readdir(t, r) {
801
+ async readdir(e, r) {
794
802
  await this.ensureMounted();
795
- const a = r?.withFileTypes ?? !1, n = await this.getDirectoryHandle(t, !1);
803
+ const a = r?.withFileTypes ?? !1, n = await this.getDirectoryHandle(e, !1);
796
804
  if (a) {
797
- const s = [];
798
- for await (const [o, i] of n.entries()) {
799
- const l = i.kind === "file";
800
- s.push({
805
+ const i = [];
806
+ for await (const [o, s] of n.entries()) {
807
+ const l = s.kind === "file";
808
+ i.push({
801
809
  name: o,
802
- kind: i.kind,
810
+ kind: s.kind,
803
811
  isFile: l,
804
812
  isDirectory: !l
805
813
  });
806
814
  }
807
- return s;
815
+ return i;
808
816
  } else {
809
- const s = [];
817
+ const i = [];
810
818
  for await (const [o] of n.entries())
811
- s.push(o);
812
- return s;
819
+ i.push(o);
820
+ return i;
813
821
  }
814
822
  }
815
823
  /**
@@ -826,12 +834,13 @@ class we {
826
834
  * console.log(\`File exists: \${exists}\`);
827
835
  * \`\`\`
828
836
  */
829
- async exists(t) {
830
- await this.ensureMounted();
831
- const r = P(t);
837
+ async exists(e) {
838
+ if (await this.ensureMounted(), e === "/")
839
+ return !0;
840
+ const r = I(e);
832
841
  let a = null;
833
842
  try {
834
- a = await this.getDirectoryHandle(M(t), !1);
843
+ a = await this.getDirectoryHandle(P(e), !1);
835
844
  } catch (n) {
836
845
  throw (n.name === "NotFoundError" || n.name === "TypeMismatchError") && (a = null), n;
837
846
  }
@@ -870,16 +879,16 @@ class we {
870
879
  * await fs.clear('/data');
871
880
  * \`\`\`
872
881
  */
873
- async clear(t = "/") {
882
+ async clear(e = "/") {
874
883
  await this.ensureMounted();
875
884
  try {
876
- const r = await this.readdir(t, { withFileTypes: !0 });
885
+ const r = await this.readdir(e, { withFileTypes: !0 });
877
886
  for (const a of r) {
878
- const n = \`\${t === "/" ? "" : t}/\${a.name}\`;
887
+ const n = \`\${e === "/" ? "" : e}/\${a.name}\`;
879
888
  await this.remove(n, { recursive: !0 });
880
889
  }
881
890
  } catch (r) {
882
- throw r instanceof c ? r : new c(\`Failed to clear directory: \${t}\`, "CLEAR_FAILED");
891
+ throw r instanceof c ? r : new c(\`Failed to clear directory: \${e}\`, "CLEAR_FAILED");
883
892
  }
884
893
  }
885
894
  /**
@@ -906,19 +915,22 @@ class we {
906
915
  * await fs.rm('/maybe/exists', { force: true });
907
916
  * \`\`\`
908
917
  */
909
- async remove(t, r) {
918
+ async remove(e, r) {
910
919
  await this.ensureMounted();
911
- const a = r?.recursive ?? !1, n = r?.force ?? !1, s = P(t);
912
- if (!s)
913
- throw new k("Invalid path", t);
914
- const o = await this.getDirectoryHandle(M(t), !1);
920
+ const a = r?.recursive ?? !1, n = r?.force ?? !1;
921
+ if (e === "/")
922
+ throw new c("Cannot remove root directory", "EROOT");
923
+ const i = I(e);
924
+ if (!i)
925
+ throw new k("Invalid path", e);
926
+ const o = await this.getDirectoryHandle(P(e), !1);
915
927
  try {
916
- await o.removeEntry(s, { recursive: a });
917
- } catch (i) {
918
- if (i.name === "NotFoundError") {
928
+ await o.removeEntry(i, { recursive: a });
929
+ } catch (s) {
930
+ if (s.name === "NotFoundError") {
919
931
  if (!n)
920
- throw new c(\`No such file or directory: \${t}\`, "ENOENT");
921
- } else throw i.name === "InvalidModificationError" ? new c(\`Directory not empty: \${t}. Use recursive option to force removal.\`, "ENOTEMPTY") : i.name === "TypeMismatchError" && !a ? new c(\`Cannot remove directory without recursive option: \${t}\`, "EISDIR") : new c(\`Failed to remove path: \${t}\`, "RM_FAILED");
932
+ throw new c(\`No such file or directory: \${e}\`, "ENOENT");
933
+ } else throw s.name === "InvalidModificationError" ? new c(\`Directory not empty: \${e}. Use recursive option to force removal.\`, "ENOTEMPTY") : s.name === "TypeMismatchError" && !a ? new c(\`Cannot remove directory without recursive option: \${e}\`, "EISDIR") : new c(\`Failed to remove path: \${e}\`, "RM_FAILED");
922
934
  }
923
935
  }
924
936
  /**
@@ -939,15 +951,15 @@ class we {
939
951
  * console.log(absolute); // '/data/file.txt'
940
952
  * \`\`\`
941
953
  */
942
- async realpath(t) {
954
+ async realpath(e) {
943
955
  await this.ensureMounted();
944
956
  try {
945
- const r = ce(t);
957
+ const r = ce(e);
946
958
  if (!await this.exists(r))
947
959
  throw new b(r);
948
960
  return r;
949
961
  } catch (r) {
950
- throw r instanceof c ? r : new c(\`Failed to resolve path: \${t}\`, "REALPATH_FAILED");
962
+ throw r instanceof c ? r : new c(\`Failed to resolve path: \${e}\`, "REALPATH_FAILED");
951
963
  }
952
964
  }
953
965
  /**
@@ -966,14 +978,14 @@ class we {
966
978
  * await fs.rename('/old/path/file.txt', '/new/path/renamed.txt');
967
979
  * \`\`\`
968
980
  */
969
- async rename(t, r) {
981
+ async rename(e, r) {
970
982
  await this.ensureMounted();
971
983
  try {
972
- if (!await this.exists(t))
973
- throw new b(t);
974
- await this.copy(t, r, { recursive: !0 }), await this.remove(t, { recursive: !0 });
984
+ if (!await this.exists(e))
985
+ throw new b(e);
986
+ await this.copy(e, r, { recursive: !0 }), await this.remove(e, { recursive: !0 });
975
987
  } catch (a) {
976
- throw a instanceof c ? a : new c(\`Failed to rename from \${t} to \${r}\`, "RENAME_FAILED");
988
+ throw a instanceof c ? a : new c(\`Failed to rename from \${e} to \${r}\`, "RENAME_FAILED");
977
989
  }
978
990
  }
979
991
  /**
@@ -1001,37 +1013,37 @@ class we {
1001
1013
  * await fs.copy('/source', '/dest', { recursive: true, force: false });
1002
1014
  * \`\`\`
1003
1015
  */
1004
- async copy(t, r, a) {
1016
+ async copy(e, r, a) {
1005
1017
  await this.ensureMounted();
1006
1018
  try {
1007
- const n = a?.recursive ?? !1, s = a?.force ?? !0;
1008
- if (!await this.exists(t))
1009
- throw new c(\`Source does not exist: \${t}\`, "ENOENT");
1010
- if (await this.exists(r) && !s)
1019
+ const n = a?.recursive ?? !1, i = a?.force ?? !0;
1020
+ if (!await this.exists(e))
1021
+ throw new c(\`Source does not exist: \${e}\`, "ENOENT");
1022
+ if (await this.exists(r) && !i)
1011
1023
  throw new c(\`Destination already exists: \${r}\`, "EEXIST");
1012
- if ((await this.stat(t)).isFile) {
1013
- const u = await this.readFile(t, "binary");
1024
+ if ((await this.stat(e)).isFile) {
1025
+ const u = await this.readFile(e, "binary");
1014
1026
  await this.writeFile(r, u);
1015
1027
  } else {
1016
1028
  if (!n)
1017
- throw new c(\`Cannot copy directory without recursive option: \${t}\`, "EISDIR");
1029
+ throw new c(\`Cannot copy directory without recursive option: \${e}\`, "EISDIR");
1018
1030
  await this.mkdir(r, { recursive: !0 });
1019
- const u = await this.readdir(t, { withFileTypes: !0 });
1031
+ const u = await this.readdir(e, { withFileTypes: !0 });
1020
1032
  for (const f of u) {
1021
- const w = \`\${t}/\${f.name}\`, h = \`\${r}/\${f.name}\`;
1022
- await this.copy(w, h, { recursive: !0, force: s });
1033
+ const w = \`\${e}/\${f.name}\`, h = \`\${r}/\${f.name}\`;
1034
+ await this.copy(w, h, { recursive: !0, force: i });
1023
1035
  }
1024
1036
  }
1025
1037
  } catch (n) {
1026
- throw n instanceof c ? n : new c(\`Failed to copy from \${t} to \${r}\`, "CP_FAILED");
1038
+ throw n instanceof c ? n : new c(\`Failed to copy from \${e} to \${r}\`, "CP_FAILED");
1027
1039
  }
1028
1040
  }
1029
1041
  /**
1030
1042
  * Start watching a file or directory for changes
1031
1043
  */
1032
- async watch(t) {
1044
+ async watch(e) {
1033
1045
  await this.ensureMounted();
1034
- const r = I(t), a = await this.buildSnapshot(r);
1046
+ const r = M(e), a = await this.buildSnapshot(r);
1035
1047
  this.watchers.set(r, a), this.watchTimer || (this.watchTimer = setInterval(() => {
1036
1048
  this.scanWatches();
1037
1049
  }, this.watchInterval));
@@ -1039,46 +1051,46 @@ class we {
1039
1051
  /**
1040
1052
  * Stop watching a previously watched path
1041
1053
  */
1042
- unwatch(t) {
1043
- const r = I(t);
1054
+ unwatch(e) {
1055
+ const r = M(e);
1044
1056
  this.watchers.delete(r), this.watchers.size === 0 && this.watchTimer && (clearInterval(this.watchTimer), this.watchTimer = null);
1045
1057
  }
1046
- async buildSnapshot(t) {
1058
+ async buildSnapshot(e) {
1047
1059
  const r = /* @__PURE__ */ new Map(), a = async (n) => {
1048
- const s = await this.stat(n);
1049
- if (r.set(n, s), s.isDirectory) {
1060
+ const i = await this.stat(n);
1061
+ if (r.set(n, i), i.isDirectory) {
1050
1062
  const o = await this.readdir(n, { withFileTypes: !0 });
1051
- for (const i of o) {
1052
- const l = \`\${n === "/" ? "" : n}/\${i.name}\`;
1063
+ for (const s of o) {
1064
+ const l = \`\${n === "/" ? "" : n}/\${s.name}\`;
1053
1065
  await a(l);
1054
1066
  }
1055
1067
  }
1056
1068
  };
1057
- return await a(t), r;
1069
+ return await a(e), r;
1058
1070
  }
1059
1071
  async scanWatches() {
1060
1072
  if (!this.scanning) {
1061
1073
  this.scanning = !0;
1062
1074
  try {
1063
1075
  await Promise.all(
1064
- [...this.watchers.entries()].map(async ([t, r]) => {
1076
+ [...this.watchers.entries()].map(async ([e, r]) => {
1065
1077
  let a;
1066
1078
  try {
1067
- a = await this.buildSnapshot(t);
1079
+ a = await this.buildSnapshot(e);
1068
1080
  } catch {
1069
1081
  a = /* @__PURE__ */ new Map();
1070
1082
  }
1071
1083
  const n = [];
1072
- for (const [s, o] of a) {
1073
- const i = r.get(s);
1074
- i ? (i.mtime !== o.mtime || i.size !== o.size) && n.push({ path: s, type: "change" }) : n.push({ path: s, type: "create" });
1084
+ for (const [i, o] of a) {
1085
+ const s = r.get(i);
1086
+ s ? (s.mtime !== o.mtime || s.size !== o.size) && n.push({ path: i, type: "change" }) : n.push({ path: i, type: "create" });
1075
1087
  }
1076
- for (const s of r.keys())
1077
- a.has(s) || n.push({ path: s, type: "delete" });
1088
+ for (const i of r.keys())
1089
+ a.has(i) || n.push({ path: i, type: "delete" });
1078
1090
  if (n.length && this.watchCallback)
1079
- for (const s of n)
1080
- this.watchCallback(s);
1081
- this.watchers.set(t, a);
1091
+ for (const i of n)
1092
+ this.watchCallback(i);
1093
+ this.watchers.set(e, a);
1082
1094
  })
1083
1095
  );
1084
1096
  } finally {
@@ -1114,22 +1126,22 @@ class we {
1114
1126
  * await fs.sync(entries, { cleanBefore: true });
1115
1127
  * \`\`\`
1116
1128
  */
1117
- async sync(t, r) {
1129
+ async sync(e, r) {
1118
1130
  await this.ensureMounted();
1119
1131
  try {
1120
1132
  (r?.cleanBefore ?? !1) && await this.clear("/");
1121
- for (const [n, s] of t) {
1122
- const o = I(n);
1123
- let i;
1124
- s instanceof Blob ? i = await he(s) : i = s, await this.writeFile(o, i);
1133
+ for (const [n, i] of e) {
1134
+ const o = M(n);
1135
+ let s;
1136
+ i instanceof Blob ? s = await he(i) : s = i, await this.writeFile(o, s);
1125
1137
  }
1126
1138
  } catch (a) {
1127
1139
  throw a instanceof c ? a : new c("Failed to sync file system", "SYNC_FAILED");
1128
1140
  }
1129
1141
  }
1130
1142
  }
1131
- typeof self < "u" && self.constructor.name === "DedicatedWorkerGlobalScope" && O(new we());
1132
- //# sourceMappingURL=worker-CMvl9yOu.js.map
1143
+ typeof self < "u" && self.constructor.name === "DedicatedWorkerGlobalScope" && x(new we());
1144
+ //# sourceMappingURL=worker-CRHhlrlS.js.map
1133
1145
  `, r = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", a], { type: "text/javascript;charset=utf-8" });
1134
1146
  function s(e) {
1135
1147
  let n;
@@ -1179,8 +1191,8 @@ export {
1179
1191
  _ as joinPath,
1180
1192
  D as normalizePath,
1181
1193
  k as readFileData,
1182
- C as resolvePath,
1194
+ R as resolvePath,
1183
1195
  U as splitPath,
1184
- R as writeFileData
1196
+ C as writeFileData
1185
1197
  };
1186
1198
  //# sourceMappingURL=index.js.map