@webpodjs/fs-worker 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1724 @@
1
+ /* @ts-self-types="./webpod_fs_wasm.d.ts" */
2
+
3
+ /**
4
+ * The pod's two block devices for the FS Worker: `webpod-root` (lazy read-only base image)
5
+ * and `webpod-data` (persistent writable disk), served from channel-mode block messages.
6
+ */
7
+ export class BlockVolumes {
8
+ static __wrap(ptr) {
9
+ const obj = Object.create(BlockVolumes.prototype);
10
+ obj.__wbg_ptr = ptr;
11
+ BlockVolumesFinalization.register(obj, obj.__wbg_ptr, obj);
12
+ return obj;
13
+ }
14
+ __destroy_into_raw() {
15
+ const ptr = this.__wbg_ptr;
16
+ this.__wbg_ptr = 0;
17
+ BlockVolumesFinalization.unregister(this);
18
+ return ptr;
19
+ }
20
+ free() {
21
+ const ptr = this.__destroy_into_raw();
22
+ wasm.__wbg_blockvolumes_free(ptr, 0);
23
+ }
24
+ /**
25
+ * Flushes the data disk, closes both and releases the pod lock.
26
+ * @returns {Promise<any>}
27
+ */
28
+ close() {
29
+ const ret = wasm.blockvolumes_close(this.__wbg_ptr);
30
+ return ret;
31
+ }
32
+ /**
33
+ * True when nothing was ever written to the data disk when it was opened: a new pod (a
34
+ * boot snapshot's data disk can be restored onto it without losing anything).
35
+ * @returns {boolean}
36
+ */
37
+ get dataFresh() {
38
+ const ret = wasm.blockvolumes_dataFresh(this.__wbg_ptr);
39
+ return ret !== 0;
40
+ }
41
+ /**
42
+ * @returns {number}
43
+ */
44
+ get dataSize() {
45
+ const ret = wasm.blockvolumes_dataSize(this.__wbg_ptr);
46
+ return ret;
47
+ }
48
+ /**
49
+ * True when the data disk is in memory (another tab holds the pod, or memory backend).
50
+ * @returns {boolean}
51
+ */
52
+ get ephemeral() {
53
+ const ret = wasm.blockvolumes_ephemeral(this.__wbg_ptr);
54
+ return ret !== 0;
55
+ }
56
+ /**
57
+ * Flushes the data disk's writes to storage (the page is going away: `pagehide`), as a
58
+ * guest flush request does.
59
+ * @returns {Promise<any>}
60
+ */
61
+ flush() {
62
+ const ret = wasm.blockvolumes_flush(this.__wbg_ptr);
63
+ return ret;
64
+ }
65
+ /**
66
+ * Handles a batch of block request messages for disk `serial`; resolves to the encoded
67
+ * completion messages, in request order.
68
+ * @param {string} serial
69
+ * @param {Array<any>} msgs
70
+ * @returns {Promise<any>}
71
+ */
72
+ handle(serial, msgs) {
73
+ const ptr0 = passStringToWasm0(serial, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
74
+ const len0 = WASM_VECTOR_LEN;
75
+ const ret = wasm.blockvolumes_handle(this.__wbg_ptr, ptr0, len0, msgs);
76
+ return ret;
77
+ }
78
+ /**
79
+ * `dataBackend`: `"auto" | "opfs" | "idb" | "memory"`; `onConflict`: `"fail" | "ephemeral"`.
80
+ * `manifestUrl` defaults to `imageUrl + ".wpim"` when empty. `packedUrl`: the image's
81
+ * packed form, read instead of the blob when it is there (null: never).
82
+ * @param {string} pod_id
83
+ * @param {string} image_url
84
+ * @param {string} manifest_url
85
+ * @param {number} data_size
86
+ * @param {string} data_backend
87
+ * @param {string} on_conflict
88
+ * @param {string | null} [packed_url]
89
+ * @returns {Promise<BlockVolumes>}
90
+ */
91
+ static open(pod_id, image_url, manifest_url, data_size, data_backend, on_conflict, packed_url) {
92
+ const val7 = +data_size;
93
+ let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5;
94
+ try {
95
+ ptr0 = passStringToWasm0(pod_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
96
+ len0 = WASM_VECTOR_LEN;
97
+ ptr1 = passStringToWasm0(image_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
98
+ len1 = WASM_VECTOR_LEN;
99
+ ptr2 = passStringToWasm0(manifest_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
100
+ len2 = WASM_VECTOR_LEN;
101
+ ptr3 = passStringToWasm0(data_backend, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
102
+ len3 = WASM_VECTOR_LEN;
103
+ ptr4 = passStringToWasm0(on_conflict, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
104
+ len4 = WASM_VECTOR_LEN;
105
+ ptr5 = isLikeNone(packed_url) ? 0 : passStringToWasm0(packed_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
106
+ len5 = WASM_VECTOR_LEN;
107
+ } catch (e) {
108
+ if (ptr5) { wasm.__wbindgen_free(ptr5, len5 * 1, 1); }
109
+ if (ptr4) { wasm.__wbindgen_free(ptr4, len4 * 1, 1); }
110
+ if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 1, 1); }
111
+ if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
112
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
113
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
114
+ throw e;
115
+ }
116
+ const ret = wasm.blockvolumes_open(ptr0, len0, ptr1, len1, ptr2, len2, val7, ptr3, len3, ptr4, len4, ptr5, len5);
117
+ return ret;
118
+ }
119
+ /**
120
+ * Downloads root image chunks ahead of use (into memory and the chunk cache). Call with
121
+ * small batches so guest reads are not held up behind a long prefetch.
122
+ * @param {Uint32Array | number[]} chunks
123
+ * @returns {Promise<any>}
124
+ */
125
+ prefetch(chunks) {
126
+ const ptr0 = passArray32ToWasm0(chunks, wasm.__wbindgen_malloc);
127
+ const len0 = WASM_VECTOR_LEN;
128
+ const ret = wasm.blockvolumes_prefetch(this.__wbg_ptr, ptr0, len0);
129
+ return ret;
130
+ }
131
+ /**
132
+ * Replaces the data disk's contents by a snapshot (manifest bytes from `SnapshotStore`).
133
+ * Only before the engine attaches: the guest must not see the disk change under it.
134
+ * @param {Uint8Array | number[]} manifest
135
+ * @returns {Promise<any>}
136
+ */
137
+ restoreData(manifest) {
138
+ const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
139
+ const len0 = WASM_VECTOR_LEN;
140
+ const ret = wasm.blockvolumes_restoreData(this.__wbg_ptr, ptr0, len0);
141
+ return ret;
142
+ }
143
+ /**
144
+ * Manifest id of the root image (to match a prefetch list, and in snapshot bindings). Kept
145
+ * from `open`: the root's server is lent out while it serves a request (a prefetch too).
146
+ * @returns {string}
147
+ */
148
+ get rootManifestId() {
149
+ let deferred1_0;
150
+ let deferred1_1;
151
+ try {
152
+ const ret = wasm.blockvolumes_rootManifestId(this.__wbg_ptr);
153
+ deferred1_0 = ret[0];
154
+ deferred1_1 = ret[1];
155
+ return getStringFromWasm0(ret[0], ret[1]);
156
+ } finally {
157
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
158
+ }
159
+ }
160
+ /**
161
+ * @returns {number}
162
+ */
163
+ get rootSize() {
164
+ const ret = wasm.blockvolumes_rootSize(this.__wbg_ptr);
165
+ return ret;
166
+ }
167
+ /**
168
+ * Base image download counters (FS-010 / FS-011): resolves to `{fetchedBytes,
169
+ * transferredBytes, packed, packFallback?, fetchRequests, cacheHits, memoryHits}` (queued
170
+ * behind running requests and prefetches). `fetchedBytes` counts image bytes,
171
+ * `transferredBytes` what came over the network (less when reading the packed image).
172
+ * @returns {Promise<any>}
173
+ */
174
+ rootStats() {
175
+ const ret = wasm.blockvolumes_rootStats(this.__wbg_ptr);
176
+ return ret;
177
+ }
178
+ /**
179
+ * The boot profile so far: resolves to `{ manifest, chunks }`, the root image's manifest
180
+ * id and the chunk indices in first-touch order (see `webpod-build prefetch`).
181
+ * @returns {Promise<any>}
182
+ */
183
+ rootTrace() {
184
+ const ret = wasm.blockvolumes_rootTrace(this.__wbg_ptr);
185
+ return ret;
186
+ }
187
+ /**
188
+ * The engine's memory (the `SharedArrayBuffer` its rings and guest RAM live in): enables
189
+ * indirect requests, whose data the FS Worker reads from and writes to it in place
190
+ * (`docs/design/blk-indirect.md`).
191
+ * @param {any} memory
192
+ */
193
+ setEngineMemory(memory) {
194
+ wasm.blockvolumes_setEngineMemory(this.__wbg_ptr, memory);
195
+ }
196
+ /**
197
+ * Sets the largest read one completion can carry for `serial` (ring payload limit - 12).
198
+ * @param {string} serial
199
+ * @param {number} max_read_len
200
+ */
201
+ setMaxRead(serial, max_read_len) {
202
+ const val2 = +max_read_len;
203
+ const ptr0 = passStringToWasm0(serial, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
204
+ const len0 = WASM_VECTOR_LEN;
205
+ wasm.blockvolumes_setMaxRead(this.__wbg_ptr, ptr0, len0, val2);
206
+ }
207
+ /**
208
+ * Snapshots the data disk into the pod's snapshot store (`webpod-snapshots/<pod>`); resolves
209
+ * to the volume manifest bytes. Block requests wait meanwhile (crash-consistent). Only the
210
+ * chunks written since the previous snapshot or restore are reread.
211
+ * @returns {Promise<any>}
212
+ */
213
+ snapshotData() {
214
+ const ret = wasm.blockvolumes_snapshotData(this.__wbg_ptr);
215
+ return ret;
216
+ }
217
+ }
218
+ if (Symbol.dispose) BlockVolumes.prototype[Symbol.dispose] = BlockVolumes.prototype.free;
219
+
220
+ /**
221
+ * The pod's snapshots (`webpod-snapshots/<pod>` in OPFS): named sets of volume manifests.
222
+ */
223
+ export class SnapshotStore {
224
+ static __wrap(ptr) {
225
+ const obj = Object.create(SnapshotStore.prototype);
226
+ obj.__wbg_ptr = ptr;
227
+ SnapshotStoreFinalization.register(obj, obj.__wbg_ptr, obj);
228
+ return obj;
229
+ }
230
+ __destroy_into_raw() {
231
+ const ptr = this.__wbg_ptr;
232
+ this.__wbg_ptr = 0;
233
+ SnapshotStoreFinalization.unregister(this);
234
+ return ptr;
235
+ }
236
+ free() {
237
+ const ptr = this.__destroy_into_raw();
238
+ wasm.__wbg_snapshotstore_free(ptr, 0);
239
+ }
240
+ /**
241
+ * Mismatching binding keys between snapshot `name` and the machine described by
242
+ * `current` (`{engine, machine, cpus, ram, devices, kernel, cmdline, image}`); empty means
243
+ * the snapshot can resume on it.
244
+ * @param {string} name
245
+ * @param {any} current
246
+ * @returns {Promise<any>}
247
+ */
248
+ checkBinding(name, current) {
249
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
250
+ const len0 = WASM_VECTOR_LEN;
251
+ const ret = wasm.snapshotstore_checkBinding(this.__wbg_ptr, ptr0, len0, current);
252
+ return ret;
253
+ }
254
+ /**
255
+ * Resolves to whether a snapshot was deleted (unreferenced chunks are freed).
256
+ * @param {string} name
257
+ * @returns {Promise<any>}
258
+ */
259
+ delete(name) {
260
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
261
+ const len0 = WASM_VECTOR_LEN;
262
+ const ret = wasm.snapshotstore_delete(this.__wbg_ptr, ptr0, len0);
263
+ return ret;
264
+ }
265
+ /**
266
+ * Forgets the RAM chunks `importBoot` kept unstored (its pod did not resume from them: a
267
+ * later import downloads what the store lacks).
268
+ */
269
+ discardUnpersisted() {
270
+ wasm.snapshotstore_discardUnpersisted(this.__wbg_ptr);
271
+ }
272
+ /**
273
+ * Writes snapshot `name` as one tar file and resolves to it: a `File` in OPFS
274
+ * (`exports/<name>.tar` in the store), or an in-memory `Blob` with the IndexedDB store. Either
275
+ * can be posted to the page and downloaded.
276
+ * @param {string} name
277
+ * @returns {Promise<any>}
278
+ */
279
+ exportFile(name) {
280
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
281
+ const len0 = WASM_VECTOR_LEN;
282
+ const ret = wasm.snapshotstore_exportFile(this.__wbg_ptr, ptr0, len0);
283
+ return ret;
284
+ }
285
+ /**
286
+ * Imports an exported snapshot from a `File`/`Blob` (worker only), optionally renamed.
287
+ * @param {Blob} blob
288
+ * @param {string | null} [rename]
289
+ * @returns {Promise<any>}
290
+ */
291
+ importBlob(blob, rename) {
292
+ var ptr0 = isLikeNone(rename) ? 0 : passStringToWasm0(rename, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
293
+ var len0 = WASM_VECTOR_LEN;
294
+ const ret = wasm.snapshotstore_importBlob(this.__wbg_ptr, blob, ptr0, len0);
295
+ return ret;
296
+ }
297
+ /**
298
+ * Imports a published boot snapshot (`webpod-build snapshot` output under `base_url`,
299
+ * ending in `/`) as snapshot `name`: downloads the RAM and data disk chunks this store lacks
300
+ * over range requests and the device state, verifies everything, and records the binding
301
+ * metadata. Resolves to `{ info, fetchedBytes }`; a second import of the same snapshot
302
+ * downloads nothing but `boot.json` and the manifests.
303
+ * @param {string} base_url
304
+ * @param {string} name
305
+ * @returns {Promise<any>}
306
+ */
307
+ importBoot(base_url, name) {
308
+ let ptr0, len0, ptr1, len1;
309
+ try {
310
+ ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
311
+ len0 = WASM_VECTOR_LEN;
312
+ ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
313
+ len1 = WASM_VECTOR_LEN;
314
+ } catch (e) {
315
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
316
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
317
+ throw e;
318
+ }
319
+ const ret = wasm.snapshotstore_importBoot(this.__wbg_ptr, ptr0, len0, ptr1, len1);
320
+ return ret;
321
+ }
322
+ /**
323
+ * `[{name, created, volumes: {name: manifestId}, meta}]`.
324
+ * @returns {Promise<any>}
325
+ */
326
+ list() {
327
+ const ret = wasm.snapshotstore_list(this.__wbg_ptr);
328
+ return ret;
329
+ }
330
+ /**
331
+ * The manifest bytes of volume `volume` of snapshot `name`, for `restoreData` / `restore`.
332
+ * @param {string} name
333
+ * @param {string} volume
334
+ * @returns {Promise<any>}
335
+ */
336
+ manifest(name, volume) {
337
+ let ptr0, len0, ptr1, len1;
338
+ try {
339
+ ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
340
+ len0 = WASM_VECTOR_LEN;
341
+ ptr1 = passStringToWasm0(volume, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
342
+ len1 = WASM_VECTOR_LEN;
343
+ } catch (e) {
344
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
345
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
346
+ throw e;
347
+ }
348
+ const ret = wasm.snapshotstore_manifest(this.__wbg_ptr, ptr0, len0, ptr1, len1);
349
+ return ret;
350
+ }
351
+ /**
352
+ * @param {string} pod_id
353
+ * @returns {Promise<SnapshotStore>}
354
+ */
355
+ static open(pod_id) {
356
+ const ptr0 = passStringToWasm0(pod_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
357
+ const len0 = WASM_VECTOR_LEN;
358
+ const ret = wasm.snapshotstore_open(ptr0, len0);
359
+ return ret;
360
+ }
361
+ /**
362
+ * Stores the RAM chunks `importBoot` kept in memory, a few at a time with the Worker's other
363
+ * tasks in between (call it once the pod has resumed). Anything that reads RAM chunks from
364
+ * the store stores them first anyway.
365
+ * @returns {Promise<any>}
366
+ */
367
+ persistRam() {
368
+ const ret = wasm.snapshotstore_persistRam(this.__wbg_ptr);
369
+ return ret;
370
+ }
371
+ /**
372
+ * Writes a RAM snapshot (manifest bytes) into `ram`; `fresh`: the RAM is all zeros (a
373
+ * just-started engine), zero chunks are skipped. Resolves to the bytes written.
374
+ * Reads a RAM volume's chunks ahead (decompressed, in this Worker's memory) so that the
375
+ * next `restoreRam` of the same manifest only copies; resolves to the non-zero bytes held.
376
+ * @param {Uint8Array | number[]} manifest
377
+ * @returns {Promise<any>}
378
+ */
379
+ prefetchRam(manifest) {
380
+ const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
381
+ const len0 = WASM_VECTOR_LEN;
382
+ const ret = wasm.snapshotstore_prefetchRam(this.__wbg_ptr, ptr0, len0);
383
+ return ret;
384
+ }
385
+ /**
386
+ * Reads back bytes stored with `snapshotBytes`.
387
+ * @param {Uint8Array | number[]} manifest
388
+ * @returns {Promise<any>}
389
+ */
390
+ readBytes(manifest) {
391
+ const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
392
+ const len0 = WASM_VECTOR_LEN;
393
+ const ret = wasm.snapshotstore_readBytes(this.__wbg_ptr, ptr0, len0);
394
+ return ret;
395
+ }
396
+ /**
397
+ * @param {Uint8Array | number[]} manifest
398
+ * @param {Uint8Array} ram
399
+ * @param {boolean} fresh
400
+ * @returns {Promise<any>}
401
+ */
402
+ restoreRam(manifest, ram, fresh) {
403
+ const val2 = +fresh;
404
+ const ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
405
+ const len0 = WASM_VECTOR_LEN;
406
+ const ret = wasm.snapshotstore_restoreRam(this.__wbg_ptr, ptr0, len0, ram, val2);
407
+ return ret;
408
+ }
409
+ /**
410
+ * Records snapshot `name` from volume manifests (`{data: Uint8Array, workspace: ...}`,
411
+ * as returned by `snapshotData()` / `WorkspaceFs.snapshot()`) and string metadata.
412
+ * @param {string} name
413
+ * @param {number} created_ms
414
+ * @param {any} meta
415
+ * @param {any} volumes
416
+ * @returns {Promise<any>}
417
+ */
418
+ save(name, created_ms, meta, volumes) {
419
+ const val2 = +created_ms;
420
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
421
+ const len0 = WASM_VECTOR_LEN;
422
+ const ret = wasm.snapshotstore_save(this.__wbg_ptr, ptr0, len0, val2, meta, volumes);
423
+ return ret;
424
+ }
425
+ /**
426
+ * Stores an opaque byte string (the engine's device state) as a volume; resolves to its
427
+ * manifest.
428
+ * @param {Uint8Array | number[]} data
429
+ * @returns {Promise<any>}
430
+ */
431
+ snapshotBytes(data) {
432
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
433
+ const len0 = WASM_VECTOR_LEN;
434
+ const ret = wasm.snapshotstore_snapshotBytes(this.__wbg_ptr, ptr0, len0);
435
+ return ret;
436
+ }
437
+ /**
438
+ * Stores guest RAM (`ram`: a view of the engine's memory) and resolves to its manifest.
439
+ * Call with the guest stopped.
440
+ * @param {Uint8Array} ram
441
+ * @returns {Promise<any>}
442
+ */
443
+ snapshotRam(ram) {
444
+ const ret = wasm.snapshotstore_snapshotRam(this.__wbg_ptr, ram);
445
+ return ret;
446
+ }
447
+ }
448
+ if (Symbol.dispose) SnapshotStore.prototype[Symbol.dispose] = SnapshotStore.prototype.free;
449
+
450
+ /**
451
+ * The shared workspace, opened in the FS Worker.
452
+ */
453
+ export class WorkspaceFs {
454
+ static __wrap(ptr) {
455
+ const obj = Object.create(WorkspaceFs.prototype);
456
+ obj.__wbg_ptr = ptr;
457
+ WorkspaceFsFinalization.register(obj, obj.__wbg_ptr, obj);
458
+ return obj;
459
+ }
460
+ __destroy_into_raw() {
461
+ const ptr = this.__wbg_ptr;
462
+ this.__wbg_ptr = 0;
463
+ WorkspaceFsFinalization.unregister(this);
464
+ return ptr;
465
+ }
466
+ free() {
467
+ const ptr = this.__destroy_into_raw();
468
+ wasm.__wbg_workspacefs_free(ptr, 0);
469
+ }
470
+ /**
471
+ * @param {string} path
472
+ * @param {number} mode
473
+ * @returns {Promise<any>}
474
+ */
475
+ chmod(path, mode) {
476
+ const val2 = +mode;
477
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
478
+ const len0 = WASM_VECTOR_LEN;
479
+ const ret = wasm.workspacefs_chmod(this.__wbg_ptr, ptr0, len0, val2);
480
+ return ret;
481
+ }
482
+ /**
483
+ * Syncs, closes OPFS handles and releases the workspace lock.
484
+ * @returns {Promise<any>}
485
+ */
486
+ close() {
487
+ const ret = wasm.workspacefs_close(this.__wbg_ptr);
488
+ return ret;
489
+ }
490
+ /**
491
+ * `""` when persistent, else why not: `"no-opfs"` or `"locked"`.
492
+ * @returns {string}
493
+ */
494
+ get ephemeral() {
495
+ let deferred1_0;
496
+ let deferred1_1;
497
+ try {
498
+ const ret = wasm.workspacefs_ephemeral(this.__wbg_ptr);
499
+ deferred1_0 = ret[0];
500
+ deferred1_1 = ret[1];
501
+ return getStringFromWasm0(ret[0], ret[1]);
502
+ } finally {
503
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
504
+ }
505
+ }
506
+ /**
507
+ * The view serving another tab `client` (its page and its guest's 9P session); its changes
508
+ * are recorded as `"page:<client>"` and `"guest:<client>"`.
509
+ * @param {string} client
510
+ * @returns {WorkspaceFs}
511
+ */
512
+ forClient(client) {
513
+ const ptr0 = passStringToWasm0(client, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
514
+ const len0 = WASM_VECTOR_LEN;
515
+ const ret = wasm.workspacefs_forClient(this.__wbg_ptr, ptr0, len0);
516
+ return WorkspaceFs.__wrap(ret);
517
+ }
518
+ /**
519
+ * @param {string} path
520
+ * @param {boolean} recursive
521
+ * @param {number} mode
522
+ * @returns {Promise<any>}
523
+ */
524
+ mkdir(path, recursive, mode) {
525
+ const val2 = +recursive;
526
+ const val3 = +mode;
527
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
528
+ const len0 = WASM_VECTOR_LEN;
529
+ const ret = wasm.workspacefs_mkdir(this.__wbg_ptr, ptr0, len0, val2, val3);
530
+ return ret;
531
+ }
532
+ /**
533
+ * Opens the workspace of `podId` (OPFS, else in memory; see `ephemeral`). Files the page
534
+ * creates are owned by `uid`/`gid`; `msize` bounds 9P messages (ring payload limit).
535
+ * @param {string} pod_id
536
+ * @param {string} mount_point
537
+ * @param {number} uid
538
+ * @param {number} gid
539
+ * @param {number} msize
540
+ * @returns {Promise<WorkspaceFs>}
541
+ */
542
+ static open(pod_id, mount_point, uid, gid, msize) {
543
+ const val3 = +uid;
544
+ const val4 = +gid;
545
+ const val5 = +msize;
546
+ let ptr0, len0, ptr1, len1;
547
+ try {
548
+ ptr0 = passStringToWasm0(pod_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
549
+ len0 = WASM_VECTOR_LEN;
550
+ ptr1 = passStringToWasm0(mount_point, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
551
+ len1 = WASM_VECTOR_LEN;
552
+ } catch (e) {
553
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
554
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
555
+ throw e;
556
+ }
557
+ const ret = wasm.workspacefs_open(ptr0, len0, ptr1, len1, val3, val4, val5);
558
+ return ret;
559
+ }
560
+ /**
561
+ * Goes on with `session` (another tab's, from `p9Session` of the workspace's previous
562
+ * holder) as this view's 9P session: the fids of what this workspace has go on working,
563
+ * open ones pinned again. Resolves to the number of fids dropped.
564
+ * @param {Uint8Array | number[]} session
565
+ * @returns {Promise<any>}
566
+ */
567
+ p9Adopt(session) {
568
+ const ptr0 = passArray8ToWasm0(session, wasm.__wbindgen_malloc);
569
+ const len0 = WASM_VECTOR_LEN;
570
+ const ret = wasm.workspacefs_p9Adopt(this.__wbg_ptr, ptr0, len0);
571
+ return ret;
572
+ }
573
+ /**
574
+ * Ends the 9P session (guest reboot or disconnect): drops all fids. For another tab's view,
575
+ * also forgets the session (the tab is gone).
576
+ * @returns {Promise<any>}
577
+ */
578
+ p9Reset() {
579
+ const ret = wasm.workspacefs_p9Reset(this.__wbg_ptr);
580
+ return ret;
581
+ }
582
+ /**
583
+ * The 9P session of this view (`P9Server::save_session`), for the tab it serves to go on
584
+ * with if it takes the workspace over; `undefined` before its guest speaks 9P.
585
+ * @returns {Promise<any>}
586
+ */
587
+ p9Session() {
588
+ const ret = wasm.workspacefs_p9Session(this.__wbg_ptr);
589
+ return ret;
590
+ }
591
+ /**
592
+ * Answers one 9P request message; resolves to the reply, or `undefined` for a message
593
+ * too short to answer.
594
+ * @param {Uint8Array | number[]} msg
595
+ * @returns {Promise<any>}
596
+ */
597
+ p9(msg) {
598
+ const ptr0 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
599
+ const len0 = WASM_VECTOR_LEN;
600
+ const ret = wasm.workspacefs_p9(this.__wbg_ptr, ptr0, len0);
601
+ return ret;
602
+ }
603
+ /**
604
+ * @param {string} path
605
+ * @param {number} offset
606
+ * @param {number} len
607
+ * @returns {Promise<any>}
608
+ */
609
+ readAt(path, offset, len) {
610
+ const val2 = +offset;
611
+ const val3 = +len;
612
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
613
+ const len0 = WASM_VECTOR_LEN;
614
+ const ret = wasm.workspacefs_readAt(this.__wbg_ptr, ptr0, len0, val2, val3);
615
+ return ret;
616
+ }
617
+ /**
618
+ * @param {string} path
619
+ * @returns {Promise<any>}
620
+ */
621
+ readFile(path) {
622
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
623
+ const len0 = WASM_VECTOR_LEN;
624
+ const ret = wasm.workspacefs_readFile(this.__wbg_ptr, ptr0, len0);
625
+ return ret;
626
+ }
627
+ /**
628
+ * `[{name, type}]`.
629
+ * @param {string} path
630
+ * @returns {Promise<any>}
631
+ */
632
+ readdir(path) {
633
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
634
+ const len0 = WASM_VECTOR_LEN;
635
+ const ret = wasm.workspacefs_readdir(this.__wbg_ptr, ptr0, len0);
636
+ return ret;
637
+ }
638
+ /**
639
+ * @param {string} path
640
+ * @returns {Promise<any>}
641
+ */
642
+ readlink(path) {
643
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
644
+ const len0 = WASM_VECTOR_LEN;
645
+ const ret = wasm.workspacefs_readlink(this.__wbg_ptr, ptr0, len0);
646
+ return ret;
647
+ }
648
+ /**
649
+ * @param {string} from
650
+ * @param {string} to
651
+ * @returns {Promise<any>}
652
+ */
653
+ rename(from, to) {
654
+ let ptr0, len0, ptr1, len1;
655
+ try {
656
+ ptr0 = passStringToWasm0(from, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
657
+ len0 = WASM_VECTOR_LEN;
658
+ ptr1 = passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
659
+ len1 = WASM_VECTOR_LEN;
660
+ } catch (e) {
661
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
662
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
663
+ throw e;
664
+ }
665
+ const ret = wasm.workspacefs_rename(this.__wbg_ptr, ptr0, len0, ptr1, len1);
666
+ return ret;
667
+ }
668
+ /**
669
+ * Replaces the workspace by a dump (manifest bytes from `SnapshotStore`). Only before the
670
+ * engine attaches. Without `session` the 9P session is dropped (the guest mounts again);
671
+ * with the one saved by `snapshotWithSession` the resumed guest's fids go on working, open
672
+ * files unlinked before the snapshot included.
673
+ * @param {Uint8Array | number[]} manifest
674
+ * @param {Uint8Array | number[] | null} [session]
675
+ * @returns {Promise<any>}
676
+ */
677
+ restore(manifest, session) {
678
+ let ptr0, len0, ptr1, len1;
679
+ try {
680
+ ptr0 = passArray8ToWasm0(manifest, wasm.__wbindgen_malloc);
681
+ len0 = WASM_VECTOR_LEN;
682
+ ptr1 = isLikeNone(session) ? 0 : passArray8ToWasm0(session, wasm.__wbindgen_malloc);
683
+ len1 = WASM_VECTOR_LEN;
684
+ } catch (e) {
685
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
686
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
687
+ throw e;
688
+ }
689
+ const ret = wasm.workspacefs_restore(this.__wbg_ptr, ptr0, len0, ptr1, len1);
690
+ return ret;
691
+ }
692
+ /**
693
+ * @param {string} path
694
+ * @param {boolean} recursive
695
+ * @param {boolean} force
696
+ * @returns {Promise<any>}
697
+ */
698
+ rm(path, recursive, force) {
699
+ const val2 = +recursive;
700
+ const val3 = +force;
701
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
702
+ const len0 = WASM_VECTOR_LEN;
703
+ const ret = wasm.workspacefs_rm(this.__wbg_ptr, ptr0, len0, val2, val3);
704
+ return ret;
705
+ }
706
+ /**
707
+ * [`WorkspaceFs::snapshot`] and the 9P session at the same moment, for a memory snapshot
708
+ * (guest stopped): resolves to `{ workspace, p9 }`, the dump's manifest bytes and the
709
+ * session (`P9Server::save_session`), which `restore` takes back.
710
+ * @returns {Promise<any>}
711
+ */
712
+ snapshotWithSession() {
713
+ const ret = wasm.workspacefs_snapshotWithSession(this.__wbg_ptr);
714
+ return ret;
715
+ }
716
+ /**
717
+ * Dumps the whole workspace into the pod's snapshot store; resolves to the manifest bytes
718
+ * of the dump. Page and guest requests wait meanwhile.
719
+ * @returns {Promise<any>}
720
+ */
721
+ snapshot() {
722
+ const ret = wasm.workspacefs_snapshot(this.__wbg_ptr);
723
+ return ret;
724
+ }
725
+ /**
726
+ * `{type, size, mode, uid, gid, mtime (ms), ino}`; `follow` = stat, else lstat.
727
+ * @param {string} path
728
+ * @param {boolean} follow
729
+ * @returns {Promise<any>}
730
+ */
731
+ stat(path, follow) {
732
+ const val2 = +follow;
733
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
734
+ const len0 = WASM_VECTOR_LEN;
735
+ const ret = wasm.workspacefs_stat(this.__wbg_ptr, ptr0, len0, val2);
736
+ return ret;
737
+ }
738
+ /**
739
+ * @param {string} target
740
+ * @param {string} path
741
+ * @returns {Promise<any>}
742
+ */
743
+ symlink(target, path) {
744
+ let ptr0, len0, ptr1, len1;
745
+ try {
746
+ ptr0 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
747
+ len0 = WASM_VECTOR_LEN;
748
+ ptr1 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
749
+ len1 = WASM_VECTOR_LEN;
750
+ } catch (e) {
751
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
752
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
753
+ throw e;
754
+ }
755
+ const ret = wasm.workspacefs_symlink(this.__wbg_ptr, ptr0, len0, ptr1, len1);
756
+ return ret;
757
+ }
758
+ /**
759
+ * Flushes contents and metadata (call periodically and before closing).
760
+ * @returns {Promise<any>}
761
+ */
762
+ sync() {
763
+ const ret = wasm.workspacefs_sync(this.__wbg_ptr);
764
+ return ret;
765
+ }
766
+ /**
767
+ * Changes since the last call (through every view): `[{origin, type, path, dir?}]`, origin
768
+ * `"page"` or `"guest"` (this tab), `"page:<id>"` or `"guest:<id>"` (another, `forClient`);
769
+ * `dir: true` when the entry is a directory.
770
+ * @returns {Array<any>}
771
+ */
772
+ takeEvents() {
773
+ const ret = wasm.workspacefs_takeEvents(this.__wbg_ptr);
774
+ return ret;
775
+ }
776
+ /**
777
+ * For a tab that another serves the workspace to: waits until that one releases the
778
+ * workspace lock (closes or ends), then opens it from OPFS and goes on with the 9P session
779
+ * `session()` returns then (a `Uint8Array`, the last one of this tab's guest the other sent,
780
+ * `p9Session`; or nothing), dropping the fids of what the other had not synced. Resolves to
781
+ * the opened workspace.
782
+ * @param {string} pod_id
783
+ * @param {string} mount_point
784
+ * @param {number} uid
785
+ * @param {number} gid
786
+ * @param {number} msize
787
+ * @param {Function} session
788
+ * @returns {Promise<WorkspaceFs>}
789
+ */
790
+ static takeOver(pod_id, mount_point, uid, gid, msize, session) {
791
+ const val3 = +uid;
792
+ const val4 = +gid;
793
+ const val5 = +msize;
794
+ let ptr0, len0, ptr1, len1;
795
+ try {
796
+ ptr0 = passStringToWasm0(pod_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
797
+ len0 = WASM_VECTOR_LEN;
798
+ ptr1 = passStringToWasm0(mount_point, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
799
+ len1 = WASM_VECTOR_LEN;
800
+ } catch (e) {
801
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
802
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
803
+ throw e;
804
+ }
805
+ const ret = wasm.workspacefs_takeOver(ptr0, len0, ptr1, len1, val3, val4, val5, session);
806
+ return ret;
807
+ }
808
+ /**
809
+ * Writes `data` at `offset`; `create` makes a missing file with `mode`, `truncate` empties
810
+ * it first. A whole-file write is `write(path, 0, data, true, true, mode)`.
811
+ * @param {string} path
812
+ * @param {number} offset
813
+ * @param {Uint8Array | number[]} data
814
+ * @param {boolean} create
815
+ * @param {boolean} truncate
816
+ * @param {number} mode
817
+ * @returns {Promise<any>}
818
+ */
819
+ write(path, offset, data, create, truncate, mode) {
820
+ const val3 = +offset;
821
+ const val4 = +create;
822
+ const val5 = +truncate;
823
+ const val6 = +mode;
824
+ let ptr0, len0, ptr1, len1;
825
+ try {
826
+ ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
827
+ len0 = WASM_VECTOR_LEN;
828
+ ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
829
+ len1 = WASM_VECTOR_LEN;
830
+ } catch (e) {
831
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
832
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
833
+ throw e;
834
+ }
835
+ const ret = wasm.workspacefs_write(this.__wbg_ptr, ptr0, len0, val3, ptr1, len1, val4, val5, val6);
836
+ return ret;
837
+ }
838
+ }
839
+ if (Symbol.dispose) WorkspaceFs.prototype[Symbol.dispose] = WorkspaceFs.prototype.free;
840
+ function __wbg_get_imports() {
841
+ const import0 = {
842
+ __proto__: null,
843
+ __wbg_Error_208446807d0d1e30: function(arg0, arg1) {
844
+ const ret = Error(getStringFromWasm0(arg0, arg1));
845
+ return ret;
846
+ },
847
+ __wbg___wbindgen_boolean_get_4f1baf9a00be3c74: function(arg0) {
848
+ const v = arg0;
849
+ const ret = typeof(v) === 'boolean' ? v : undefined;
850
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
851
+ },
852
+ __wbg___wbindgen_debug_string_f249a2a76caa9a55: function(arg0, arg1) {
853
+ const ret = debugString(arg1);
854
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
855
+ const len1 = WASM_VECTOR_LEN;
856
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
857
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
858
+ },
859
+ __wbg___wbindgen_is_falsy_d864b623500ae65d: function(arg0) {
860
+ const ret = !arg0;
861
+ return ret;
862
+ },
863
+ __wbg___wbindgen_is_function_741ff2bb612836f5: function(arg0) {
864
+ const ret = typeof(arg0) === 'function';
865
+ return ret;
866
+ },
867
+ __wbg___wbindgen_is_null_c22311b1cc228e3a: function(arg0) {
868
+ const ret = arg0 === null;
869
+ return ret;
870
+ },
871
+ __wbg___wbindgen_is_object_8b968c3ab8e96595: function(arg0) {
872
+ const val = arg0;
873
+ const ret = typeof(val) === 'object' && val !== null;
874
+ return ret;
875
+ },
876
+ __wbg___wbindgen_is_undefined_be5b34249ff1fc15: function(arg0) {
877
+ const ret = arg0 === undefined;
878
+ return ret;
879
+ },
880
+ __wbg___wbindgen_number_get_934b640d0889af78: function(arg0, arg1) {
881
+ const obj = arg1;
882
+ const ret = typeof(obj) === 'number' ? obj : undefined;
883
+ getDataViewMemory0().setFloat64((arg0 >>> 0) + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
884
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, !isLikeNone(ret), true);
885
+ },
886
+ __wbg___wbindgen_string_get_7ce8eee7fd327545: function(arg0, arg1) {
887
+ const obj = arg1;
888
+ const ret = typeof(obj) === 'string' ? obj : undefined;
889
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
890
+ var len1 = WASM_VECTOR_LEN;
891
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
892
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
893
+ },
894
+ __wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
895
+ throw new Error(getStringFromWasm0(arg0, arg1));
896
+ },
897
+ __wbg__wbg_cb_unref_09736879a3f67559: function(arg0) {
898
+ arg0._wbg_cb_unref();
899
+ },
900
+ __wbg_blockvolumes_new: function(arg0) {
901
+ const ret = BlockVolumes.__wrap(arg0);
902
+ return ret;
903
+ },
904
+ __wbg_bound_2eafc1bd1cffbb0e: function() { return handleError(function (arg0, arg1) {
905
+ const ret = IDBKeyRange.bound(arg0, arg1);
906
+ return ret;
907
+ }, arguments); },
908
+ __wbg_call_275b78b3b6520b92: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
909
+ const ret = arg0.call(arg1, arg2, arg3, arg4);
910
+ return ret;
911
+ }, arguments); },
912
+ __wbg_call_40b008ba32f73991: function() { return handleError(function (arg0, arg1) {
913
+ const ret = arg0.call(arg1);
914
+ return ret;
915
+ }, arguments); },
916
+ __wbg_call_a410eb4b59ed5965: function() { return handleError(function (arg0, arg1, arg2) {
917
+ const ret = arg0.call(arg1, arg2);
918
+ return ret;
919
+ }, arguments); },
920
+ __wbg_call_fc92fee6137d452d: function() { return handleError(function (arg0, arg1, arg2, arg3) {
921
+ const ret = arg0.call(arg1, arg2, arg3);
922
+ return ret;
923
+ }, arguments); },
924
+ __wbg_close_264222edec0e3164: function(arg0) {
925
+ arg0.close();
926
+ },
927
+ __wbg_close_70d38255291ae4c8: function(arg0) {
928
+ arg0.close();
929
+ },
930
+ __wbg_contains_c7099563ab57a776: function(arg0, arg1, arg2) {
931
+ const ret = arg0.contains(getStringFromWasm0(arg1, arg2));
932
+ return ret;
933
+ },
934
+ __wbg_count_e2319028fdda4bd5: function() { return handleError(function (arg0) {
935
+ const ret = arg0.count();
936
+ return ret;
937
+ }, arguments); },
938
+ __wbg_count_f985983ff17ebffb: function() { return handleError(function (arg0, arg1) {
939
+ const ret = arg0.count(arg1);
940
+ return ret;
941
+ }, arguments); },
942
+ __wbg_createObjectStore_f7cf854ebb8a2b7f: function() { return handleError(function (arg0, arg1, arg2) {
943
+ const ret = arg0.createObjectStore(getStringFromWasm0(arg1, arg2));
944
+ return ret;
945
+ }, arguments); },
946
+ __wbg_createSyncAccessHandle_9fc3d780677bd197: function(arg0) {
947
+ const ret = arg0.createSyncAccessHandle();
948
+ return ret;
949
+ },
950
+ __wbg_delete_a1677b105dc0626e: function() { return handleError(function (arg0, arg1) {
951
+ const ret = arg0.delete(arg1);
952
+ return ret;
953
+ }, arguments); },
954
+ __wbg_error_029b9735617abe23: function() { return handleError(function (arg0) {
955
+ const ret = arg0.error;
956
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
957
+ }, arguments); },
958
+ __wbg_error_37b241daaafbc352: function(arg0) {
959
+ const ret = arg0.error;
960
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
961
+ },
962
+ __wbg_fill_6ab2ffab47cad7ab: function(arg0, arg1, arg2, arg3) {
963
+ const ret = arg0.fill(arg1, arg2 >>> 0, arg3 >>> 0);
964
+ return ret;
965
+ },
966
+ __wbg_flush_34f73503687e5840: function() { return handleError(function (arg0) {
967
+ arg0.flush();
968
+ }, arguments); },
969
+ __wbg_getAllKeys_08212b8e3f30bcdf: function() { return handleError(function (arg0, arg1) {
970
+ const ret = arg0.getAllKeys(arg1);
971
+ return ret;
972
+ }, arguments); },
973
+ __wbg_getDirectoryHandle_7250477470a7f35b: function(arg0, arg1, arg2, arg3) {
974
+ const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
975
+ return ret;
976
+ },
977
+ __wbg_getDirectory_50787a69f3a13110: function(arg0) {
978
+ const ret = arg0.getDirectory();
979
+ return ret;
980
+ },
981
+ __wbg_getFileHandle_1cb5562219601c4f: function(arg0, arg1, arg2, arg3) {
982
+ const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
983
+ return ret;
984
+ },
985
+ __wbg_getFile_ebc6243a91493807: function(arg0) {
986
+ const ret = arg0.getFile();
987
+ return ret;
988
+ },
989
+ __wbg_getSize_c72004a2a12e972a: function() { return handleError(function (arg0) {
990
+ const ret = arg0.getSize();
991
+ return ret;
992
+ }, arguments); },
993
+ __wbg_get_2080c49015e35254: function() { return handleError(function (arg0, arg1) {
994
+ const ret = Reflect.get(arg0, arg1);
995
+ return ret;
996
+ }, arguments); },
997
+ __wbg_get_3e7d0feae205d645: function() { return handleError(function (arg0, arg1) {
998
+ const ret = arg0.get(arg1);
999
+ return ret;
1000
+ }, arguments); },
1001
+ __wbg_get_unchecked_e6325ad374eff861: function(arg0, arg1) {
1002
+ const ret = arg0[arg1 >>> 0];
1003
+ return ret;
1004
+ },
1005
+ __wbg_instanceof_DomException_b0152473e22fa2bf: function(arg0) {
1006
+ let result;
1007
+ try {
1008
+ result = arg0 instanceof DOMException;
1009
+ } catch (_) {
1010
+ result = false;
1011
+ }
1012
+ const ret = result;
1013
+ return ret;
1014
+ },
1015
+ __wbg_instanceof_Error_74e3cca0c4a69161: function(arg0) {
1016
+ let result;
1017
+ try {
1018
+ result = arg0 instanceof Error;
1019
+ } catch (_) {
1020
+ result = false;
1021
+ }
1022
+ const ret = result;
1023
+ return ret;
1024
+ },
1025
+ __wbg_instanceof_IdbDatabase_3fd78b576d374c8e: function(arg0) {
1026
+ let result;
1027
+ try {
1028
+ result = arg0 instanceof IDBDatabase;
1029
+ } catch (_) {
1030
+ result = false;
1031
+ }
1032
+ const ret = result;
1033
+ return ret;
1034
+ },
1035
+ __wbg_instanceof_IdbFactory_c959b1be1ad153de: function(arg0) {
1036
+ let result;
1037
+ try {
1038
+ result = arg0 instanceof IDBFactory;
1039
+ } catch (_) {
1040
+ result = false;
1041
+ }
1042
+ const ret = result;
1043
+ return ret;
1044
+ },
1045
+ __wbg_instanceof_StorageManager_ec97b6c3ff74ba7d: function(arg0) {
1046
+ let result;
1047
+ try {
1048
+ result = arg0 instanceof StorageManager;
1049
+ } catch (_) {
1050
+ result = false;
1051
+ }
1052
+ const ret = result;
1053
+ return ret;
1054
+ },
1055
+ __wbg_instanceof_Uint8Array_d7aeb0dcb3108fea: function(arg0) {
1056
+ let result;
1057
+ try {
1058
+ result = arg0 instanceof Uint8Array;
1059
+ } catch (_) {
1060
+ result = false;
1061
+ }
1062
+ const ret = result;
1063
+ return ret;
1064
+ },
1065
+ __wbg_keys_105f5c0857898f84: function(arg0) {
1066
+ const ret = Object.keys(arg0);
1067
+ return ret;
1068
+ },
1069
+ __wbg_keys_731ce456e0f6f11b: function(arg0) {
1070
+ const ret = arg0.keys();
1071
+ return ret;
1072
+ },
1073
+ __wbg_length_186163212ffe79c3: function(arg0) {
1074
+ const ret = arg0.length;
1075
+ return ret;
1076
+ },
1077
+ __wbg_length_b03a0fabb109b1e9: function(arg0) {
1078
+ const ret = arg0.length;
1079
+ return ret;
1080
+ },
1081
+ __wbg_message_43d8c8f1d543a349: function(arg0) {
1082
+ const ret = arg0.message;
1083
+ return ret;
1084
+ },
1085
+ __wbg_message_fc58bc095885b5e5: function(arg0, arg1) {
1086
+ const ret = arg1.message;
1087
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1088
+ const len1 = WASM_VECTOR_LEN;
1089
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
1090
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
1091
+ },
1092
+ __wbg_name_7d5a865f2ff82e44: function(arg0, arg1) {
1093
+ const ret = arg1.name;
1094
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1095
+ const len1 = WASM_VECTOR_LEN;
1096
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
1097
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
1098
+ },
1099
+ __wbg_name_d1fa514fdca6a975: function(arg0) {
1100
+ const ret = arg0.name;
1101
+ return ret;
1102
+ },
1103
+ __wbg_new_13de428334042d26: function(arg0) {
1104
+ const ret = new Uint8Array(arg0);
1105
+ return ret;
1106
+ },
1107
+ __wbg_new_37eb45aaf5eeb820: function() {
1108
+ const ret = new Array();
1109
+ return ret;
1110
+ },
1111
+ __wbg_new_787b9fb330d55d78: function(arg0, arg1) {
1112
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
1113
+ return ret;
1114
+ },
1115
+ __wbg_new_ba40181b3f24ac80: function(arg0, arg1) {
1116
+ try {
1117
+ var state0 = {a: arg0, b: arg1};
1118
+ var cb0 = (arg0, arg1) => {
1119
+ const a = state0.a;
1120
+ state0.a = 0;
1121
+ try {
1122
+ return wasm_bindgen_5a2380350bab5903___convert__closures_____invoke___js_sys_173b2b1834468215___Function_fn_wasm_bindgen_5a2380350bab5903___JsValue_____wasm_bindgen_5a2380350bab5903___sys__Undefined___js_sys_173b2b1834468215___Function_fn_wasm_bindgen_5a2380350bab5903___JsValue_____wasm_bindgen_5a2380350bab5903___sys__Undefined_______true_(a, state0.b, arg0, arg1);
1123
+ } finally {
1124
+ state0.a = a;
1125
+ }
1126
+ };
1127
+ const ret = new Promise(cb0);
1128
+ return ret;
1129
+ } finally {
1130
+ state0.a = 0;
1131
+ }
1132
+ },
1133
+ __wbg_new_cd4348290afae586: function() {
1134
+ const ret = new Object();
1135
+ return ret;
1136
+ },
1137
+ __wbg_new_f2c208823248a2e7: function() { return handleError(function () {
1138
+ const ret = new FileReaderSync();
1139
+ return ret;
1140
+ }, arguments); },
1141
+ __wbg_new_from_slice_b8daf545a41c6aa0: function(arg0, arg1) {
1142
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1143
+ return ret;
1144
+ },
1145
+ __wbg_new_typed_e09da9dae6ee5935: function(arg0, arg1) {
1146
+ try {
1147
+ var state0 = {a: arg0, b: arg1};
1148
+ var cb0 = (arg0, arg1) => {
1149
+ const a = state0.a;
1150
+ state0.a = 0;
1151
+ try {
1152
+ return wasm_bindgen_5a2380350bab5903___convert__closures_____invoke___js_sys_173b2b1834468215___Function_fn_wasm_bindgen_5a2380350bab5903___JsValue_____wasm_bindgen_5a2380350bab5903___sys__Undefined___js_sys_173b2b1834468215___Function_fn_wasm_bindgen_5a2380350bab5903___JsValue_____wasm_bindgen_5a2380350bab5903___sys__Undefined_______true_(a, state0.b, arg0, arg1);
1153
+ } finally {
1154
+ state0.a = a;
1155
+ }
1156
+ };
1157
+ const ret = new Promise(cb0);
1158
+ return ret;
1159
+ } finally {
1160
+ state0.a = 0;
1161
+ }
1162
+ },
1163
+ __wbg_new_with_u8_array_sequence_9cda61cd48ab1b97: function() { return handleError(function (arg0) {
1164
+ const ret = new Blob(arg0);
1165
+ return ret;
1166
+ }, arguments); },
1167
+ __wbg_next_040cd66fe7246513: function() { return handleError(function (arg0) {
1168
+ const ret = arg0.next();
1169
+ return ret;
1170
+ }, arguments); },
1171
+ __wbg_now_463ac581d2fc7ea3: function() {
1172
+ const ret = Date.now();
1173
+ return ret;
1174
+ },
1175
+ __wbg_objectStoreNames_2b913d9b7111553d: function(arg0) {
1176
+ const ret = arg0.objectStoreNames;
1177
+ return ret;
1178
+ },
1179
+ __wbg_objectStore_a2b5ae038954c7ba: function() { return handleError(function (arg0, arg1, arg2) {
1180
+ const ret = arg0.objectStore(getStringFromWasm0(arg1, arg2));
1181
+ return ret;
1182
+ }, arguments); },
1183
+ __wbg_open_0b7832f51fde5a5f: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1184
+ const ret = arg0.open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
1185
+ return ret;
1186
+ }, arguments); },
1187
+ __wbg_parse_c3f72b5a24f83c01: function() { return handleError(function (arg0, arg1) {
1188
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
1189
+ return ret;
1190
+ }, arguments); },
1191
+ __wbg_prototypesetcall_13162965d1fe7aa3: function(arg0, arg1, arg2) {
1192
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1193
+ },
1194
+ __wbg_push_c9f4893fc209f768: function(arg0, arg1) {
1195
+ const ret = arg0.push(arg1);
1196
+ return ret;
1197
+ },
1198
+ __wbg_put_45e63ad2e48de8d7: function() { return handleError(function (arg0, arg1, arg2) {
1199
+ const ret = arg0.put(arg1, arg2);
1200
+ return ret;
1201
+ }, arguments); },
1202
+ __wbg_queueMicrotask_1e8503a8a690f0a3: function(arg0) {
1203
+ const ret = arg0.queueMicrotask;
1204
+ return ret;
1205
+ },
1206
+ __wbg_queueMicrotask_4a1a4d8dd332373b: function(arg0) {
1207
+ queueMicrotask(arg0);
1208
+ },
1209
+ __wbg_readAsArrayBuffer_b7018416df375ab3: function() { return handleError(function (arg0, arg1) {
1210
+ const ret = arg0.readAsArrayBuffer(arg1);
1211
+ return ret;
1212
+ }, arguments); },
1213
+ __wbg_read_fd16d549b57ad237: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1214
+ const ret = arg0.read(getArrayU8FromWasm0(arg1, arg2), arg3);
1215
+ return ret;
1216
+ }, arguments); },
1217
+ __wbg_removeEntry_81c62dd6ae8e3673: function(arg0, arg1, arg2) {
1218
+ const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
1219
+ return ret;
1220
+ },
1221
+ __wbg_resolve_dbf78ab4942478b0: function(arg0) {
1222
+ const ret = Promise.resolve(arg0);
1223
+ return ret;
1224
+ },
1225
+ __wbg_result_11a492b710594c52: function() { return handleError(function (arg0) {
1226
+ const ret = arg0.result;
1227
+ return ret;
1228
+ }, arguments); },
1229
+ __wbg_set_2793479888329cb6: function() { return handleError(function (arg0, arg1, arg2) {
1230
+ const ret = Reflect.set(arg0, arg1, arg2);
1231
+ return ret;
1232
+ }, arguments); },
1233
+ __wbg_set_at_f569a2586a7350aa: function(arg0, arg1) {
1234
+ arg0.at = arg1;
1235
+ },
1236
+ __wbg_set_create_29c03b2d68cbe451: function(arg0, arg1) {
1237
+ arg0.create = arg1 !== 0;
1238
+ },
1239
+ __wbg_set_create_8034c70deebee24f: function(arg0, arg1) {
1240
+ arg0.create = arg1 !== 0;
1241
+ },
1242
+ __wbg_set_feb3714f475485ba: function(arg0, arg1, arg2) {
1243
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
1244
+ },
1245
+ __wbg_set_onabort_7ebb01d240653002: function(arg0, arg1) {
1246
+ arg0.onabort = arg1;
1247
+ },
1248
+ __wbg_set_oncomplete_0d4e18f44844f3be: function(arg0, arg1) {
1249
+ arg0.oncomplete = arg1;
1250
+ },
1251
+ __wbg_set_onerror_01c46f9c43941951: function(arg0, arg1) {
1252
+ arg0.onerror = arg1;
1253
+ },
1254
+ __wbg_set_onerror_d0d22f3fd04b6cdf: function(arg0, arg1) {
1255
+ arg0.onerror = arg1;
1256
+ },
1257
+ __wbg_set_onsuccess_8fa3ed2b93e36cae: function(arg0, arg1) {
1258
+ arg0.onsuccess = arg1;
1259
+ },
1260
+ __wbg_set_onupgradeneeded_e977e06888863122: function(arg0, arg1) {
1261
+ arg0.onupgradeneeded = arg1;
1262
+ },
1263
+ __wbg_size_9d1084e29743663c: function(arg0) {
1264
+ const ret = arg0.size;
1265
+ return ret;
1266
+ },
1267
+ __wbg_slice_b94f88ac0a502e53: function() { return handleError(function (arg0, arg1, arg2) {
1268
+ const ret = arg0.slice(arg1, arg2);
1269
+ return ret;
1270
+ }, arguments); },
1271
+ __wbg_snapshotstore_new: function(arg0) {
1272
+ const ret = SnapshotStore.__wrap(arg0);
1273
+ return ret;
1274
+ },
1275
+ __wbg_static_accessor_GLOBAL_THIS_003ee833af9699fc: function() {
1276
+ const ret = typeof globalThis === 'undefined' ? undefined : globalThis;
1277
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1278
+ },
1279
+ __wbg_static_accessor_GLOBAL_e4293fb22cbe77da: function() {
1280
+ const ret = typeof global === 'undefined' ? undefined : global;
1281
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1282
+ },
1283
+ __wbg_static_accessor_SELF_53bb20457401453d: function() {
1284
+ const ret = typeof self === 'undefined' ? undefined : self;
1285
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1286
+ },
1287
+ __wbg_static_accessor_WINDOW_b5e0810bfecb7feb: function() {
1288
+ const ret = typeof window === 'undefined' ? undefined : window;
1289
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1290
+ },
1291
+ __wbg_subarray_58f388a9247ac0bb: function(arg0, arg1, arg2) {
1292
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1293
+ return ret;
1294
+ },
1295
+ __wbg_then_656f253a5dd7d8ea: function(arg0, arg1, arg2) {
1296
+ const ret = arg0.then(arg1, arg2);
1297
+ return ret;
1298
+ },
1299
+ __wbg_then_e3f7f2d365708be8: function(arg0, arg1) {
1300
+ const ret = arg0.then(arg1);
1301
+ return ret;
1302
+ },
1303
+ __wbg_transaction_f9e5d72d1bce352d: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1304
+ const ret = arg0.transaction(getStringFromWasm0(arg1, arg2), __wbindgen_enum_IdbTransactionMode[arg3]);
1305
+ return ret;
1306
+ }, arguments); },
1307
+ __wbg_truncate_5f8dea9c665ccb45: function() { return handleError(function (arg0, arg1) {
1308
+ arg0.truncate(arg1);
1309
+ }, arguments); },
1310
+ __wbg_workspacefs_new: function(arg0) {
1311
+ const ret = WorkspaceFs.__wrap(arg0);
1312
+ return ret;
1313
+ },
1314
+ __wbg_write_d97a1c0a72df2595: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1315
+ const ret = arg0.write(getArrayU8FromWasm0(arg1, arg2), arg3);
1316
+ return ret;
1317
+ }, arguments); },
1318
+ __wbindgen_generic_0000000000000001: function(arg0, arg1) {
1319
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 149, ret: Externref, inner_ret: Some(Externref) }, mutable: true }) -> Externref`.
1320
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_5a2380350bab5903___convert__closures_____invoke___wasm_bindgen_5a2380350bab5903___JsValue__wasm_bindgen_5a2380350bab5903___JsValue__true__1_);
1321
+ return ret;
1322
+ },
1323
+ __wbindgen_generic_0000000000000002: function(arg0, arg1) {
1324
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 45, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1325
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_5a2380350bab5903___convert__closures_____invoke___wasm_bindgen_5a2380350bab5903___JsValue__core_6a51abefd5362b2___result__Result_____wasm_bindgen_5a2380350bab5903___JsError___true_);
1326
+ return ret;
1327
+ },
1328
+ __wbindgen_generic_0000000000000003: function(arg0, arg1) {
1329
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 151, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1330
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_5a2380350bab5903___convert__closures_____invoke_______true_);
1331
+ return ret;
1332
+ },
1333
+ __wbindgen_generic_0000000000000004: function(arg0) {
1334
+ // Cast intrinsic for `F64 -> Externref`.
1335
+ const ret = arg0;
1336
+ return ret;
1337
+ },
1338
+ __wbindgen_generic_0000000000000005: function(arg0, arg1) {
1339
+ // Cast intrinsic for `Ref(String) -> Externref`.
1340
+ const ret = getStringFromWasm0(arg0, arg1);
1341
+ return ret;
1342
+ },
1343
+ __wbindgen_init_externref_table: function() {
1344
+ const table = wasm.__wbindgen_externrefs;
1345
+ table.set(0, undefined);
1346
+ table.set(1024, undefined);
1347
+ table.set(1025, null);
1348
+ table.set(1026, true);
1349
+ table.set(1027, false);
1350
+ },
1351
+ };
1352
+ return {
1353
+ __proto__: null,
1354
+ "./webpod_fs_wasm_bg.js": import0,
1355
+ };
1356
+ }
1357
+
1358
+ function wasm_bindgen_5a2380350bab5903___convert__closures_____invoke_______true_(arg0, arg1) {
1359
+ wasm.wasm_bindgen_5a2380350bab5903___convert__closures_____invoke_______true_(arg0, arg1);
1360
+ }
1361
+
1362
+ function wasm_bindgen_5a2380350bab5903___convert__closures_____invoke___wasm_bindgen_5a2380350bab5903___JsValue__wasm_bindgen_5a2380350bab5903___JsValue__true__1_(arg0, arg1, arg2) {
1363
+ const ret = wasm.wasm_bindgen_5a2380350bab5903___convert__closures_____invoke___wasm_bindgen_5a2380350bab5903___JsValue__wasm_bindgen_5a2380350bab5903___JsValue__true__1_(arg0, arg1, arg2);
1364
+ return ret;
1365
+ }
1366
+
1367
+ function wasm_bindgen_5a2380350bab5903___convert__closures_____invoke___wasm_bindgen_5a2380350bab5903___JsValue__core_6a51abefd5362b2___result__Result_____wasm_bindgen_5a2380350bab5903___JsError___true_(arg0, arg1, arg2) {
1368
+ const ret = wasm.wasm_bindgen_5a2380350bab5903___convert__closures_____invoke___wasm_bindgen_5a2380350bab5903___JsValue__core_6a51abefd5362b2___result__Result_____wasm_bindgen_5a2380350bab5903___JsError___true_(arg0, arg1, arg2);
1369
+ if (ret[1]) {
1370
+ throw takeFromExternrefTable0(ret[0]);
1371
+ }
1372
+ }
1373
+
1374
+ function wasm_bindgen_5a2380350bab5903___convert__closures_____invoke___js_sys_173b2b1834468215___Function_fn_wasm_bindgen_5a2380350bab5903___JsValue_____wasm_bindgen_5a2380350bab5903___sys__Undefined___js_sys_173b2b1834468215___Function_fn_wasm_bindgen_5a2380350bab5903___JsValue_____wasm_bindgen_5a2380350bab5903___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
1375
+ wasm.wasm_bindgen_5a2380350bab5903___convert__closures_____invoke___js_sys_173b2b1834468215___Function_fn_wasm_bindgen_5a2380350bab5903___JsValue_____wasm_bindgen_5a2380350bab5903___sys__Undefined___js_sys_173b2b1834468215___Function_fn_wasm_bindgen_5a2380350bab5903___JsValue_____wasm_bindgen_5a2380350bab5903___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
1376
+ }
1377
+
1378
+
1379
+ const __wbindgen_enum_IdbTransactionMode = ["readonly", "readwrite", "versionchange", "readwriteflush", "cleanup"];
1380
+ const BlockVolumesFinalization = (typeof FinalizationRegistry === 'undefined')
1381
+ ? { register: () => {}, unregister: () => {} }
1382
+ : new FinalizationRegistry(ptr => wasm.__wbg_blockvolumes_free(ptr, 1));
1383
+ const SnapshotStoreFinalization = (typeof FinalizationRegistry === 'undefined')
1384
+ ? { register: () => {}, unregister: () => {} }
1385
+ : new FinalizationRegistry(ptr => wasm.__wbg_snapshotstore_free(ptr, 1));
1386
+ const WorkspaceFsFinalization = (typeof FinalizationRegistry === 'undefined')
1387
+ ? { register: () => {}, unregister: () => {} }
1388
+ : new FinalizationRegistry(ptr => wasm.__wbg_workspacefs_free(ptr, 1));
1389
+
1390
+ function addToExternrefTable0(obj) {
1391
+ const idx = wasm.__externref_table_alloc();
1392
+ wasm.__wbindgen_externrefs.set(idx, obj);
1393
+ return idx;
1394
+ }
1395
+
1396
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
1397
+ ? { register: () => {}, unregister: () => {} }
1398
+ : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
1399
+
1400
+ function debugString(val) {
1401
+ switch (typeof val) {
1402
+ // primitive types
1403
+ case 'number':
1404
+ case 'boolean':
1405
+ case 'undefined':
1406
+ return `${val}`;
1407
+ case 'string':
1408
+ return JSON.stringify(val);
1409
+ case 'bigint':
1410
+ return `${val}n`;
1411
+ case 'symbol':
1412
+ return val.description !== undefined
1413
+ ? `Symbol(${val.description})`
1414
+ : 'Symbol';
1415
+ case 'function':
1416
+ return typeof val.name === 'string' && val.name !== ''
1417
+ ? `Function(${val.name})`
1418
+ : 'Function';
1419
+ case 'object': {
1420
+ if (val === null) {
1421
+ return 'null';
1422
+ }
1423
+ // objects
1424
+ if (Array.isArray(val)) {
1425
+ return '[' + Array.from(val, debugString).join(', ') + ']';
1426
+ }
1427
+ // errors
1428
+ if (val instanceof Error) {
1429
+ return `${val.name}: ${val.message}\n${val.stack}`;
1430
+ }
1431
+
1432
+ const toStringOutput = toString.call(val);
1433
+ // Test for built-in
1434
+ const className = /\[object ([^\]]+)\]/.exec(toStringOutput)?.[1];
1435
+
1436
+ // Failed to match the standard '[object ClassName]'
1437
+ if (className === undefined) {
1438
+ return toStringOutput;
1439
+ }
1440
+ if (className === 'Object') {
1441
+ // we're a user defined class or Object
1442
+ // JSON.stringify avoids problems with cycles, and is generally much
1443
+ // easier than looping through ownProperties of `val`.
1444
+ try {
1445
+ return 'Object(' + JSON.stringify(val) + ')';
1446
+ } catch (_) {
1447
+ return 'Object';
1448
+ }
1449
+ }
1450
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1451
+ return className;
1452
+ }
1453
+ // Per MDN: 'This list of values is exhaustive.'
1454
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#description
1455
+ }
1456
+ }
1457
+
1458
+ function getArrayU8FromWasm0(ptr, len) {
1459
+ ptr = ptr >>> 0;
1460
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1461
+ }
1462
+
1463
+ let cachedDataViewMemory0 = null;
1464
+ function getDataViewMemory0() {
1465
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1466
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1467
+ }
1468
+ return cachedDataViewMemory0;
1469
+ }
1470
+
1471
+ function getStringFromWasm0(ptr, len) {
1472
+ ptr = ptr >>> 0;
1473
+ return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1474
+ }
1475
+
1476
+ let cachedUint32ArrayMemory0 = null;
1477
+ function getUint32ArrayMemory0() {
1478
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
1479
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1480
+ }
1481
+ return cachedUint32ArrayMemory0;
1482
+ }
1483
+
1484
+ let cachedUint8ArrayMemory0 = null;
1485
+ function getUint8ArrayMemory0() {
1486
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1487
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1488
+ }
1489
+ return cachedUint8ArrayMemory0;
1490
+ }
1491
+
1492
+ function handleError(f, args) {
1493
+ try {
1494
+ return f.apply(this, args);
1495
+ } catch (e) {
1496
+ const idx = addToExternrefTable0(e);
1497
+ wasm.__wbindgen_exn_store(idx);
1498
+ }
1499
+ }
1500
+
1501
+ function isLikeNone(x) {
1502
+ return x === undefined || x === null;
1503
+ }
1504
+
1505
+ function makeMutClosure(arg0, arg1, f) {
1506
+ const state = { a: arg0, b: arg1, cnt: 1 };
1507
+ const real = (...args) => {
1508
+
1509
+ // First up with a closure we increment the internal reference
1510
+ // count. This ensures that the Rust closure environment won't
1511
+ // be deallocated while we're invoking it.
1512
+ state.cnt++;
1513
+ const a = state.a;
1514
+ state.a = 0;
1515
+ try {
1516
+ return f(a, state.b, ...args);
1517
+ } finally {
1518
+ state.a = a;
1519
+ real._wbg_cb_unref();
1520
+ }
1521
+ };
1522
+ real._wbg_cb_unref = () => {
1523
+ if (--state.cnt === 0) {
1524
+ wasm.__wbindgen_destroy_closure(state.a, state.b);
1525
+ state.a = 0;
1526
+ CLOSURE_DTORS.unregister(state);
1527
+ }
1528
+ };
1529
+ CLOSURE_DTORS.register(real, state, state);
1530
+ return real;
1531
+ }
1532
+
1533
+ function passArray32ToWasm0(arg, malloc) {
1534
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1535
+ getUint32ArrayMemory0().set(arg, ptr / 4);
1536
+ WASM_VECTOR_LEN = arg.length;
1537
+ return ptr;
1538
+ }
1539
+
1540
+ function passArray8ToWasm0(arg, malloc) {
1541
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
1542
+ getUint8ArrayMemory0().set(arg, ptr / 1);
1543
+ WASM_VECTOR_LEN = arg.length;
1544
+ return ptr;
1545
+ }
1546
+
1547
+ function passStringToWasm0(arg, malloc, realloc) {
1548
+ if (realloc === undefined) {
1549
+ const buf = cachedTextEncoder.encode(arg);
1550
+ const ptr = malloc(buf.length, 1) >>> 0;
1551
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1552
+ WASM_VECTOR_LEN = buf.length;
1553
+ return ptr;
1554
+ }
1555
+
1556
+ let len = arg.length;
1557
+ let ptr = malloc(len, 1) >>> 0;
1558
+
1559
+ const mem = getUint8ArrayMemory0();
1560
+
1561
+ let offset = 0;
1562
+
1563
+ for (; offset < len; offset++) {
1564
+ const code = arg.charCodeAt(offset);
1565
+ if (code > 0x7F) break;
1566
+ mem[ptr + offset] = code;
1567
+ }
1568
+ if (offset !== len) {
1569
+ if (offset !== 0) {
1570
+ arg = arg.slice(offset);
1571
+ }
1572
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1573
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1574
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1575
+
1576
+ offset += ret.written;
1577
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1578
+ }
1579
+
1580
+ WASM_VECTOR_LEN = offset;
1581
+ return ptr;
1582
+ }
1583
+
1584
+ function takeFromExternrefTable0(idx) {
1585
+ const value = wasm.__wbindgen_externrefs.get(idx);
1586
+ wasm.__externref_table_dealloc(idx);
1587
+ return value;
1588
+ }
1589
+
1590
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
1591
+ cachedTextDecoder.decode();
1592
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1593
+ let numBytesDecoded = 0;
1594
+ function decodeText(bytes) {
1595
+ numBytesDecoded += bytes.length;
1596
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1597
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
1598
+ cachedTextDecoder.decode();
1599
+ numBytesDecoded = bytes.length;
1600
+ }
1601
+ return cachedTextDecoder.decode(bytes);
1602
+ }
1603
+
1604
+ const cachedTextEncoder = new TextEncoder();
1605
+
1606
+ if (!('encodeInto' in cachedTextEncoder)) {
1607
+ cachedTextEncoder.encodeInto = function (arg, view) {
1608
+ const buf = cachedTextEncoder.encode(arg);
1609
+ view.set(buf);
1610
+ return {
1611
+ read: arg.length,
1612
+ written: buf.length
1613
+ };
1614
+ };
1615
+ }
1616
+
1617
+ let WASM_VECTOR_LEN = 0;
1618
+
1619
+ let wasmModule, wasmInstance, wasm;
1620
+ function __wbg_finalize_init(instance, module) {
1621
+ wasmInstance = instance;
1622
+ wasm = instance.exports;
1623
+ wasmModule = module;
1624
+ cachedDataViewMemory0 = null;
1625
+ cachedUint32ArrayMemory0 = null;
1626
+ cachedUint8ArrayMemory0 = null;
1627
+ wasm.__wbindgen_start();
1628
+ return wasm;
1629
+ }
1630
+
1631
+ async function __wbg_load(module, imports) {
1632
+ if (typeof Response === 'function' && module instanceof Response) {
1633
+ if (!module.ok) {
1634
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
1635
+ }
1636
+
1637
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1638
+ try {
1639
+ return await WebAssembly.instantiateStreaming(module, imports);
1640
+ } catch (e) {
1641
+ const validResponse = expectedResponseType(module.type);
1642
+
1643
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1644
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1645
+
1646
+ } else { throw e; }
1647
+ }
1648
+ }
1649
+
1650
+ const bytes = await module.arrayBuffer();
1651
+ return await WebAssembly.instantiate(bytes, imports);
1652
+ } else {
1653
+ const instance = await WebAssembly.instantiate(module, imports);
1654
+
1655
+ if (instance instanceof WebAssembly.Instance) {
1656
+ return { instance, module };
1657
+ } else {
1658
+ return instance;
1659
+ }
1660
+ }
1661
+
1662
+ function expectedResponseType(type) {
1663
+ switch (type) {
1664
+ case 'basic': case 'cors': case 'default': return true;
1665
+ }
1666
+ return false;
1667
+ }
1668
+ }
1669
+
1670
+ function initSync(module) {
1671
+ if (wasm !== undefined) return wasm;
1672
+
1673
+
1674
+ if (module !== undefined) {
1675
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1676
+ ({module} = module)
1677
+ } else {
1678
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1679
+ }
1680
+ }
1681
+
1682
+ const imports = __wbg_get_imports();
1683
+ if (!(module instanceof WebAssembly.Module)) {
1684
+ module = new WebAssembly.Module(module);
1685
+ }
1686
+ const instance = new WebAssembly.Instance(module, imports);
1687
+ return __wbg_finalize_init(instance, module);
1688
+ }
1689
+
1690
+ let __wbg_init_promise;
1691
+ async function __wbg_init(module_or_path) {
1692
+ if (wasm !== undefined) return wasm;
1693
+ if (__wbg_init_promise === undefined) {
1694
+ __wbg_init_promise = __wbg_init_once(module_or_path);
1695
+ __wbg_init_promise.catch(() => { __wbg_init_promise = undefined; });
1696
+ }
1697
+ return __wbg_init_promise;
1698
+ }
1699
+
1700
+ async function __wbg_init_once(module_or_path) {
1701
+
1702
+ if (module_or_path !== undefined) {
1703
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1704
+ ({module_or_path} = module_or_path)
1705
+ } else {
1706
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1707
+ }
1708
+ }
1709
+
1710
+ if (module_or_path === undefined) {
1711
+ module_or_path = new URL('webpod_fs_wasm_bg.wasm', import.meta.url);
1712
+ }
1713
+ const imports = __wbg_get_imports();
1714
+
1715
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1716
+ module_or_path = fetch(module_or_path);
1717
+ }
1718
+
1719
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1720
+
1721
+ return __wbg_finalize_init(instance, module);
1722
+ }
1723
+
1724
+ export { initSync, __wbg_init as default };