@functionland/fula-client 0.2.8 → 0.2.10

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/fula_js.js ADDED
@@ -0,0 +1,1282 @@
1
+ let wasm;
2
+
3
+ function addHeapObject(obj) {
4
+ if (heap_next === heap.length) heap.push(heap.length + 1);
5
+ const idx = heap_next;
6
+ heap_next = heap[idx];
7
+
8
+ heap[idx] = obj;
9
+ return idx;
10
+ }
11
+
12
+ function _assertClass(instance, klass) {
13
+ if (!(instance instanceof klass)) {
14
+ throw new Error(`expected instance of ${klass.name}`);
15
+ }
16
+ }
17
+
18
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
19
+ ? { register: () => {}, unregister: () => {} }
20
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
21
+
22
+ function debugString(val) {
23
+ // primitive types
24
+ const type = typeof val;
25
+ if (type == 'number' || type == 'boolean' || val == null) {
26
+ return `${val}`;
27
+ }
28
+ if (type == 'string') {
29
+ return `"${val}"`;
30
+ }
31
+ if (type == 'symbol') {
32
+ const description = val.description;
33
+ if (description == null) {
34
+ return 'Symbol';
35
+ } else {
36
+ return `Symbol(${description})`;
37
+ }
38
+ }
39
+ if (type == 'function') {
40
+ const name = val.name;
41
+ if (typeof name == 'string' && name.length > 0) {
42
+ return `Function(${name})`;
43
+ } else {
44
+ return 'Function';
45
+ }
46
+ }
47
+ // objects
48
+ if (Array.isArray(val)) {
49
+ const length = val.length;
50
+ let debug = '[';
51
+ if (length > 0) {
52
+ debug += debugString(val[0]);
53
+ }
54
+ for(let i = 1; i < length; i++) {
55
+ debug += ', ' + debugString(val[i]);
56
+ }
57
+ debug += ']';
58
+ return debug;
59
+ }
60
+ // Test for built-in
61
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
62
+ let className;
63
+ if (builtInMatches && builtInMatches.length > 1) {
64
+ className = builtInMatches[1];
65
+ } else {
66
+ // Failed to match the standard '[object ClassName]'
67
+ return toString.call(val);
68
+ }
69
+ if (className == 'Object') {
70
+ // we're a user defined class or Object
71
+ // JSON.stringify avoids problems with cycles, and is generally much
72
+ // easier than looping through ownProperties of `val`.
73
+ try {
74
+ return 'Object(' + JSON.stringify(val) + ')';
75
+ } catch (_) {
76
+ return 'Object';
77
+ }
78
+ }
79
+ // errors
80
+ if (val instanceof Error) {
81
+ return `${val.name}: ${val.message}\n${val.stack}`;
82
+ }
83
+ // TODO we could test for more things here, like `Set`s and `Map`s.
84
+ return className;
85
+ }
86
+
87
+ function dropObject(idx) {
88
+ if (idx < 132) return;
89
+ heap[idx] = heap_next;
90
+ heap_next = idx;
91
+ }
92
+
93
+ function getArrayU8FromWasm0(ptr, len) {
94
+ ptr = ptr >>> 0;
95
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
96
+ }
97
+
98
+ let cachedDataViewMemory0 = null;
99
+ function getDataViewMemory0() {
100
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
101
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
102
+ }
103
+ return cachedDataViewMemory0;
104
+ }
105
+
106
+ function getStringFromWasm0(ptr, len) {
107
+ ptr = ptr >>> 0;
108
+ return decodeText(ptr, len);
109
+ }
110
+
111
+ let cachedUint8ArrayMemory0 = null;
112
+ function getUint8ArrayMemory0() {
113
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
114
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
115
+ }
116
+ return cachedUint8ArrayMemory0;
117
+ }
118
+
119
+ function getObject(idx) { return heap[idx]; }
120
+
121
+ function handleError(f, args) {
122
+ try {
123
+ return f.apply(this, args);
124
+ } catch (e) {
125
+ wasm.__wbindgen_export3(addHeapObject(e));
126
+ }
127
+ }
128
+
129
+ let heap = new Array(128).fill(undefined);
130
+ heap.push(undefined, null, true, false);
131
+
132
+ let heap_next = heap.length;
133
+
134
+ function isLikeNone(x) {
135
+ return x === undefined || x === null;
136
+ }
137
+
138
+ function makeMutClosure(arg0, arg1, dtor, f) {
139
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
140
+ const real = (...args) => {
141
+
142
+ // First up with a closure we increment the internal reference
143
+ // count. This ensures that the Rust closure environment won't
144
+ // be deallocated while we're invoking it.
145
+ state.cnt++;
146
+ const a = state.a;
147
+ state.a = 0;
148
+ try {
149
+ return f(a, state.b, ...args);
150
+ } finally {
151
+ state.a = a;
152
+ real._wbg_cb_unref();
153
+ }
154
+ };
155
+ real._wbg_cb_unref = () => {
156
+ if (--state.cnt === 0) {
157
+ state.dtor(state.a, state.b);
158
+ state.a = 0;
159
+ CLOSURE_DTORS.unregister(state);
160
+ }
161
+ };
162
+ CLOSURE_DTORS.register(real, state, state);
163
+ return real;
164
+ }
165
+
166
+ function passArray8ToWasm0(arg, malloc) {
167
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
168
+ getUint8ArrayMemory0().set(arg, ptr / 1);
169
+ WASM_VECTOR_LEN = arg.length;
170
+ return ptr;
171
+ }
172
+
173
+ function passStringToWasm0(arg, malloc, realloc) {
174
+ if (realloc === undefined) {
175
+ const buf = cachedTextEncoder.encode(arg);
176
+ const ptr = malloc(buf.length, 1) >>> 0;
177
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
178
+ WASM_VECTOR_LEN = buf.length;
179
+ return ptr;
180
+ }
181
+
182
+ let len = arg.length;
183
+ let ptr = malloc(len, 1) >>> 0;
184
+
185
+ const mem = getUint8ArrayMemory0();
186
+
187
+ let offset = 0;
188
+
189
+ for (; offset < len; offset++) {
190
+ const code = arg.charCodeAt(offset);
191
+ if (code > 0x7F) break;
192
+ mem[ptr + offset] = code;
193
+ }
194
+ if (offset !== len) {
195
+ if (offset !== 0) {
196
+ arg = arg.slice(offset);
197
+ }
198
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
199
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
200
+ const ret = cachedTextEncoder.encodeInto(arg, view);
201
+
202
+ offset += ret.written;
203
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
204
+ }
205
+
206
+ WASM_VECTOR_LEN = offset;
207
+ return ptr;
208
+ }
209
+
210
+ function takeObject(idx) {
211
+ const ret = getObject(idx);
212
+ dropObject(idx);
213
+ return ret;
214
+ }
215
+
216
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
217
+ cachedTextDecoder.decode();
218
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
219
+ let numBytesDecoded = 0;
220
+ function decodeText(ptr, len) {
221
+ numBytesDecoded += len;
222
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
223
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
224
+ cachedTextDecoder.decode();
225
+ numBytesDecoded = len;
226
+ }
227
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
228
+ }
229
+
230
+ const cachedTextEncoder = new TextEncoder();
231
+
232
+ if (!('encodeInto' in cachedTextEncoder)) {
233
+ cachedTextEncoder.encodeInto = function (arg, view) {
234
+ const buf = cachedTextEncoder.encode(arg);
235
+ view.set(buf);
236
+ return {
237
+ read: arg.length,
238
+ written: buf.length
239
+ };
240
+ }
241
+ }
242
+
243
+ let WASM_VECTOR_LEN = 0;
244
+
245
+ function __wasm_bindgen_func_elem_975(arg0, arg1) {
246
+ wasm.__wasm_bindgen_func_elem_975(arg0, arg1);
247
+ }
248
+
249
+ function __wasm_bindgen_func_elem_1047(arg0, arg1, arg2) {
250
+ wasm.__wasm_bindgen_func_elem_1047(arg0, arg1, addHeapObject(arg2));
251
+ }
252
+
253
+ function __wasm_bindgen_func_elem_1445(arg0, arg1, arg2, arg3) {
254
+ wasm.__wasm_bindgen_func_elem_1445(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
255
+ }
256
+
257
+ const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
258
+
259
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
260
+
261
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
262
+
263
+ const AcceptedShareFinalization = (typeof FinalizationRegistry === 'undefined')
264
+ ? { register: () => {}, unregister: () => {} }
265
+ : new FinalizationRegistry(ptr => wasm.__wbg_acceptedshare_free(ptr >>> 0, 1));
266
+
267
+ const EncryptedClientFinalization = (typeof FinalizationRegistry === 'undefined')
268
+ ? { register: () => {}, unregister: () => {} }
269
+ : new FinalizationRegistry(ptr => wasm.__wbg_encryptedclient_free(ptr >>> 0, 1));
270
+
271
+ /**
272
+ * Handle to an accepted share for accessing shared files
273
+ */
274
+ export class AcceptedShare {
275
+ static __wrap(ptr) {
276
+ ptr = ptr >>> 0;
277
+ const obj = Object.create(AcceptedShare.prototype);
278
+ obj.__wbg_ptr = ptr;
279
+ AcceptedShareFinalization.register(obj, obj.__wbg_ptr, obj);
280
+ return obj;
281
+ }
282
+ __destroy_into_raw() {
283
+ const ptr = this.__wbg_ptr;
284
+ this.__wbg_ptr = 0;
285
+ AcceptedShareFinalization.unregister(this);
286
+ return ptr;
287
+ }
288
+ free() {
289
+ const ptr = this.__destroy_into_raw();
290
+ wasm.__wbg_acceptedshare_free(ptr, 0);
291
+ }
292
+ }
293
+ if (Symbol.dispose) AcceptedShare.prototype[Symbol.dispose] = AcceptedShare.prototype.free;
294
+
295
+ /**
296
+ * Handle to an encrypted Fula client
297
+ */
298
+ export class EncryptedClient {
299
+ static __wrap(ptr) {
300
+ ptr = ptr >>> 0;
301
+ const obj = Object.create(EncryptedClient.prototype);
302
+ obj.__wbg_ptr = ptr;
303
+ EncryptedClientFinalization.register(obj, obj.__wbg_ptr, obj);
304
+ return obj;
305
+ }
306
+ __destroy_into_raw() {
307
+ const ptr = this.__wbg_ptr;
308
+ this.__wbg_ptr = 0;
309
+ EncryptedClientFinalization.unregister(this);
310
+ return ptr;
311
+ }
312
+ free() {
313
+ const ptr = this.__destroy_into_raw();
314
+ wasm.__wbg_encryptedclient_free(ptr, 0);
315
+ }
316
+ }
317
+ if (Symbol.dispose) EncryptedClient.prototype[Symbol.dispose] = EncryptedClient.prototype.free;
318
+
319
+ /**
320
+ * Accept a share token and get an AcceptedShare for accessing shared files
321
+ *
322
+ * @param client - EncryptedClient handle
323
+ * @param token_json - JSON string containing the ShareToken
324
+ * @returns AcceptedShare handle
325
+ * @param {EncryptedClient} client
326
+ * @param {string} token_json
327
+ * @returns {Promise<AcceptedShare>}
328
+ */
329
+ export function acceptShare(client, token_json) {
330
+ _assertClass(client, EncryptedClient);
331
+ const ptr0 = passStringToWasm0(token_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
332
+ const len0 = WASM_VECTOR_LEN;
333
+ const ret = wasm.acceptShare(client.__wbg_ptr, ptr0, len0);
334
+ return takeObject(ret);
335
+ }
336
+
337
+ /**
338
+ * Create a bucket
339
+ * @param {EncryptedClient} client
340
+ * @param {string} name
341
+ * @returns {Promise<void>}
342
+ */
343
+ export function createBucket(client, name) {
344
+ _assertClass(client, EncryptedClient);
345
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
346
+ const len0 = WASM_VECTOR_LEN;
347
+ const ret = wasm.createBucket(client.__wbg_ptr, ptr0, len0);
348
+ return takeObject(ret);
349
+ }
350
+
351
+ /**
352
+ * Create an encrypted client for secure storage operations
353
+ *
354
+ * @param config - Client configuration (endpoint, accessToken, etc.)
355
+ * @param encryption - Encryption configuration (secretKey, obfuscationMode, etc.)
356
+ * @returns EncryptedClient handle
357
+ * @param {any} config
358
+ * @param {any} encryption
359
+ * @returns {Promise<EncryptedClient>}
360
+ */
361
+ export function createEncryptedClient(config, encryption) {
362
+ const ret = wasm.createEncryptedClient(addHeapObject(config), addHeapObject(encryption));
363
+ return takeObject(ret);
364
+ }
365
+
366
+ /**
367
+ * Delete a bucket
368
+ * @param {EncryptedClient} client
369
+ * @param {string} name
370
+ * @returns {Promise<void>}
371
+ */
372
+ export function deleteBucket(client, name) {
373
+ _assertClass(client, EncryptedClient);
374
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
375
+ const len0 = WASM_VECTOR_LEN;
376
+ const ret = wasm.deleteBucket(client.__wbg_ptr, ptr0, len0);
377
+ return takeObject(ret);
378
+ }
379
+
380
+ /**
381
+ * Delete an encrypted object
382
+ * @param {EncryptedClient} client
383
+ * @param {string} bucket
384
+ * @param {string} key
385
+ * @returns {Promise<void>}
386
+ */
387
+ export function deleteEncrypted(client, bucket, key) {
388
+ _assertClass(client, EncryptedClient);
389
+ const ptr0 = passStringToWasm0(bucket, wasm.__wbindgen_export, wasm.__wbindgen_export2);
390
+ const len0 = WASM_VECTOR_LEN;
391
+ const ptr1 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
392
+ const len1 = WASM_VECTOR_LEN;
393
+ const ret = wasm.deleteEncrypted(client.__wbg_ptr, ptr0, len0, ptr1, len1);
394
+ return takeObject(ret);
395
+ }
396
+
397
+ /**
398
+ * Derive a 32-byte key from context and input
399
+ *
400
+ * Use this to derive encryption keys from Google credentials:
401
+ * ```javascript
402
+ * const key = deriveKey('my-app-v1', new TextEncoder().encode(userId + email));
403
+ * ```
404
+ * @param {string} context
405
+ * @param {Uint8Array} input
406
+ * @returns {Uint8Array}
407
+ */
408
+ export function deriveKey(context, input) {
409
+ try {
410
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
411
+ const ptr0 = passStringToWasm0(context, wasm.__wbindgen_export, wasm.__wbindgen_export2);
412
+ const len0 = WASM_VECTOR_LEN;
413
+ const ptr1 = passArray8ToWasm0(input, wasm.__wbindgen_export);
414
+ const len1 = WASM_VECTOR_LEN;
415
+ wasm.deriveKey(retptr, ptr0, len0, ptr1, len1);
416
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
417
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
418
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
419
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
420
+ return v3;
421
+ } finally {
422
+ wasm.__wbindgen_add_to_stack_pointer(16);
423
+ }
424
+ }
425
+
426
+ /**
427
+ * Export the secret key for backup (32 bytes)
428
+ *
429
+ * Store this securely - it's the master encryption key!
430
+ * @param {EncryptedClient} client
431
+ * @returns {Promise<Uint8Array>}
432
+ */
433
+ export function exportSecretKey(client) {
434
+ _assertClass(client, EncryptedClient);
435
+ const ret = wasm.exportSecretKey(client.__wbg_ptr);
436
+ return takeObject(ret);
437
+ }
438
+
439
+ /**
440
+ * Download and decrypt data by original key
441
+ *
442
+ * @param client - EncryptedClient handle
443
+ * @param bucket - Bucket name
444
+ * @param key - Original object key (path)
445
+ * @returns Decrypted data as Uint8Array
446
+ * @param {EncryptedClient} client
447
+ * @param {string} bucket
448
+ * @param {string} key
449
+ * @returns {Promise<Uint8Array>}
450
+ */
451
+ export function getDecrypted(client, bucket, key) {
452
+ _assertClass(client, EncryptedClient);
453
+ const ptr0 = passStringToWasm0(bucket, wasm.__wbindgen_export, wasm.__wbindgen_export2);
454
+ const len0 = WASM_VECTOR_LEN;
455
+ const ptr1 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
456
+ const len1 = WASM_VECTOR_LEN;
457
+ const ret = wasm.getDecrypted(client.__wbg_ptr, ptr0, len0, ptr1, len1);
458
+ return takeObject(ret);
459
+ }
460
+
461
+ /**
462
+ * Download and decrypt data by storage key
463
+ * @param {EncryptedClient} client
464
+ * @param {string} bucket
465
+ * @param {string} storage_key
466
+ * @returns {Promise<Uint8Array>}
467
+ */
468
+ export function getDecryptedByStorageKey(client, bucket, storage_key) {
469
+ _assertClass(client, EncryptedClient);
470
+ const ptr0 = passStringToWasm0(bucket, wasm.__wbindgen_export, wasm.__wbindgen_export2);
471
+ const len0 = WASM_VECTOR_LEN;
472
+ const ptr1 = passStringToWasm0(storage_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
473
+ const len1 = WASM_VECTOR_LEN;
474
+ const ret = wasm.getDecryptedByStorageKey(client.__wbg_ptr, ptr0, len0, ptr1, len1);
475
+ return takeObject(ret);
476
+ }
477
+
478
+ /**
479
+ * Get the public key for sharing (32 bytes)
480
+ * @param {EncryptedClient} client
481
+ * @returns {Promise<Uint8Array>}
482
+ */
483
+ export function getPublicKey(client) {
484
+ _assertClass(client, EncryptedClient);
485
+ const ret = wasm.getPublicKey(client.__wbg_ptr);
486
+ return takeObject(ret);
487
+ }
488
+
489
+ /**
490
+ * Get share permissions
491
+ * @param {AcceptedShare} share
492
+ * @returns {any}
493
+ */
494
+ export function getSharePermissions(share) {
495
+ try {
496
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
497
+ _assertClass(share, AcceptedShare);
498
+ wasm.getSharePermissions(retptr, share.__wbg_ptr);
499
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
500
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
501
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
502
+ if (r2) {
503
+ throw takeObject(r1);
504
+ }
505
+ return takeObject(r0);
506
+ } finally {
507
+ wasm.__wbindgen_add_to_stack_pointer(16);
508
+ }
509
+ }
510
+
511
+ /**
512
+ * Get SDK version
513
+ * @returns {string}
514
+ */
515
+ export function getVersion() {
516
+ let deferred1_0;
517
+ let deferred1_1;
518
+ try {
519
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
520
+ wasm.getVersion(retptr);
521
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
522
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
523
+ deferred1_0 = r0;
524
+ deferred1_1 = r1;
525
+ return getStringFromWasm0(r0, r1);
526
+ } finally {
527
+ wasm.__wbindgen_add_to_stack_pointer(16);
528
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
529
+ }
530
+ }
531
+
532
+ /**
533
+ * Get a shared file using an accepted share
534
+ *
535
+ * @param client - EncryptedClient handle
536
+ * @param bucket - Bucket name
537
+ * @param storage_key - Storage key of the shared file
538
+ * @param share - AcceptedShare handle
539
+ * @returns Decrypted data as Uint8Array
540
+ * @param {EncryptedClient} client
541
+ * @param {string} bucket
542
+ * @param {string} storage_key
543
+ * @param {AcceptedShare} share
544
+ * @returns {Promise<Uint8Array>}
545
+ */
546
+ export function getWithShare(client, bucket, storage_key, share) {
547
+ _assertClass(client, EncryptedClient);
548
+ const ptr0 = passStringToWasm0(bucket, wasm.__wbindgen_export, wasm.__wbindgen_export2);
549
+ const len0 = WASM_VECTOR_LEN;
550
+ const ptr1 = passStringToWasm0(storage_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
551
+ const len1 = WASM_VECTOR_LEN;
552
+ _assertClass(share, AcceptedShare);
553
+ const ret = wasm.getWithShare(client.__wbg_ptr, ptr0, len0, ptr1, len1, share.__wbg_ptr);
554
+ return takeObject(ret);
555
+ }
556
+
557
+ /**
558
+ * Get a shared file directly using a share token JSON
559
+ *
560
+ * @param client - EncryptedClient handle
561
+ * @param bucket - Bucket name
562
+ * @param storage_key - Storage key of the shared file
563
+ * @param token_json - JSON string containing the ShareToken
564
+ * @returns Decrypted data as Uint8Array
565
+ * @param {EncryptedClient} client
566
+ * @param {string} bucket
567
+ * @param {string} storage_key
568
+ * @param {string} token_json
569
+ * @returns {Promise<Uint8Array>}
570
+ */
571
+ export function getWithToken(client, bucket, storage_key, token_json) {
572
+ _assertClass(client, EncryptedClient);
573
+ const ptr0 = passStringToWasm0(bucket, wasm.__wbindgen_export, wasm.__wbindgen_export2);
574
+ const len0 = WASM_VECTOR_LEN;
575
+ const ptr1 = passStringToWasm0(storage_key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
576
+ const len1 = WASM_VECTOR_LEN;
577
+ const ptr2 = passStringToWasm0(token_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
578
+ const len2 = WASM_VECTOR_LEN;
579
+ const ret = wasm.getWithToken(client.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
580
+ return takeObject(ret);
581
+ }
582
+
583
+ /**
584
+ * Initialize the WASM module. Call this before any other functions.
585
+ */
586
+ export function init() {
587
+ wasm.init();
588
+ }
589
+
590
+ /**
591
+ * Check if client uses FlatNamespace mode
592
+ * @param {EncryptedClient} client
593
+ * @returns {Promise<boolean>}
594
+ */
595
+ export function isFlatNamespace(client) {
596
+ _assertClass(client, EncryptedClient);
597
+ const ret = wasm.isFlatNamespace(client.__wbg_ptr);
598
+ return takeObject(ret);
599
+ }
600
+
601
+ /**
602
+ * Check if a share is still valid (not expired)
603
+ * @param {AcceptedShare} share
604
+ * @returns {boolean}
605
+ */
606
+ export function isShareValid(share) {
607
+ _assertClass(share, AcceptedShare);
608
+ const ret = wasm.isShareValid(share.__wbg_ptr);
609
+ return ret !== 0;
610
+ }
611
+
612
+ /**
613
+ * List all buckets
614
+ * @param {EncryptedClient} client
615
+ * @returns {Promise<any>}
616
+ */
617
+ export function listBuckets(client) {
618
+ _assertClass(client, EncryptedClient);
619
+ const ret = wasm.listBuckets(client.__wbg_ptr);
620
+ return takeObject(ret);
621
+ }
622
+
623
+ /**
624
+ * List objects with decrypted metadata
625
+ *
626
+ * @param client - EncryptedClient handle
627
+ * @param bucket - Bucket name
628
+ * @param options - List options (prefix, maxKeys, etc.)
629
+ * @returns Array of FileMetadata
630
+ * @param {EncryptedClient} client
631
+ * @param {string} bucket
632
+ * @param {any} options
633
+ * @returns {Promise<any>}
634
+ */
635
+ export function listDecrypted(client, bucket, options) {
636
+ _assertClass(client, EncryptedClient);
637
+ const ptr0 = passStringToWasm0(bucket, wasm.__wbindgen_export, wasm.__wbindgen_export2);
638
+ const len0 = WASM_VECTOR_LEN;
639
+ const ret = wasm.listDecrypted(client.__wbg_ptr, ptr0, len0, addHeapObject(options));
640
+ return takeObject(ret);
641
+ }
642
+
643
+ /**
644
+ * List directory structure
645
+ * @param {EncryptedClient} client
646
+ * @param {string} bucket
647
+ * @param {string | null} [prefix]
648
+ * @returns {Promise<any>}
649
+ */
650
+ export function listDirectory(client, bucket, prefix) {
651
+ _assertClass(client, EncryptedClient);
652
+ const ptr0 = passStringToWasm0(bucket, wasm.__wbindgen_export, wasm.__wbindgen_export2);
653
+ const len0 = WASM_VECTOR_LEN;
654
+ var ptr1 = isLikeNone(prefix) ? 0 : passStringToWasm0(prefix, wasm.__wbindgen_export, wasm.__wbindgen_export2);
655
+ var len1 = WASM_VECTOR_LEN;
656
+ const ret = wasm.listDirectory(client.__wbg_ptr, ptr0, len0, ptr1, len1);
657
+ return takeObject(ret);
658
+ }
659
+
660
+ /**
661
+ * Upload encrypted data
662
+ *
663
+ * @param client - EncryptedClient handle
664
+ * @param bucket - Bucket name
665
+ * @param key - Object key (path)
666
+ * @param data - Data to upload (Uint8Array)
667
+ * @returns PutResult with etag
668
+ * @param {EncryptedClient} client
669
+ * @param {string} bucket
670
+ * @param {string} key
671
+ * @param {Uint8Array} data
672
+ * @returns {Promise<any>}
673
+ */
674
+ export function putEncrypted(client, bucket, key, data) {
675
+ _assertClass(client, EncryptedClient);
676
+ const ptr0 = passStringToWasm0(bucket, wasm.__wbindgen_export, wasm.__wbindgen_export2);
677
+ const len0 = WASM_VECTOR_LEN;
678
+ const ptr1 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
679
+ const len1 = WASM_VECTOR_LEN;
680
+ const ptr2 = passArray8ToWasm0(data, wasm.__wbindgen_export);
681
+ const len2 = WASM_VECTOR_LEN;
682
+ const ret = wasm.putEncrypted(client.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
683
+ return takeObject(ret);
684
+ }
685
+
686
+ /**
687
+ * Upload encrypted data with content type
688
+ * @param {EncryptedClient} client
689
+ * @param {string} bucket
690
+ * @param {string} key
691
+ * @param {Uint8Array} data
692
+ * @param {string} content_type
693
+ * @returns {Promise<any>}
694
+ */
695
+ export function putEncryptedWithType(client, bucket, key, data, content_type) {
696
+ _assertClass(client, EncryptedClient);
697
+ const ptr0 = passStringToWasm0(bucket, wasm.__wbindgen_export, wasm.__wbindgen_export2);
698
+ const len0 = WASM_VECTOR_LEN;
699
+ const ptr1 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
700
+ const len1 = WASM_VECTOR_LEN;
701
+ const ptr2 = passArray8ToWasm0(data, wasm.__wbindgen_export);
702
+ const len2 = WASM_VECTOR_LEN;
703
+ const ptr3 = passStringToWasm0(content_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
704
+ const len3 = WASM_VECTOR_LEN;
705
+ const ret = wasm.putEncryptedWithType(client.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
706
+ return takeObject(ret);
707
+ }
708
+
709
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
710
+
711
+ async function __wbg_load(module, imports) {
712
+ if (typeof Response === 'function' && module instanceof Response) {
713
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
714
+ try {
715
+ return await WebAssembly.instantiateStreaming(module, imports);
716
+ } catch (e) {
717
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
718
+
719
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
720
+ 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);
721
+
722
+ } else {
723
+ throw e;
724
+ }
725
+ }
726
+ }
727
+
728
+ const bytes = await module.arrayBuffer();
729
+ return await WebAssembly.instantiate(bytes, imports);
730
+ } else {
731
+ const instance = await WebAssembly.instantiate(module, imports);
732
+
733
+ if (instance instanceof WebAssembly.Instance) {
734
+ return { instance, module };
735
+ } else {
736
+ return instance;
737
+ }
738
+ }
739
+ }
740
+
741
+ function __wbg_get_imports() {
742
+ const imports = {};
743
+ imports.wbg = {};
744
+ imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
745
+ const ret = Error(getStringFromWasm0(arg0, arg1));
746
+ return addHeapObject(ret);
747
+ };
748
+ imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
749
+ const ret = Number(getObject(arg0));
750
+ return ret;
751
+ };
752
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
753
+ const ret = String(getObject(arg1));
754
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
755
+ const len1 = WASM_VECTOR_LEN;
756
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
757
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
758
+ };
759
+ imports.wbg.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) {
760
+ const v = getObject(arg1);
761
+ const ret = typeof(v) === 'bigint' ? v : undefined;
762
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
763
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
764
+ };
765
+ imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
766
+ const v = getObject(arg0);
767
+ const ret = typeof(v) === 'boolean' ? v : undefined;
768
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
769
+ };
770
+ imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
771
+ const ret = debugString(getObject(arg1));
772
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
773
+ const len1 = WASM_VECTOR_LEN;
774
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
775
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
776
+ };
777
+ imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
778
+ const ret = getObject(arg0) in getObject(arg1);
779
+ return ret;
780
+ };
781
+ imports.wbg.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) {
782
+ const ret = typeof(getObject(arg0)) === 'bigint';
783
+ return ret;
784
+ };
785
+ imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
786
+ const ret = typeof(getObject(arg0)) === 'function';
787
+ return ret;
788
+ };
789
+ imports.wbg.__wbg___wbindgen_is_null_dfda7d66506c95b5 = function(arg0) {
790
+ const ret = getObject(arg0) === null;
791
+ return ret;
792
+ };
793
+ imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
794
+ const val = getObject(arg0);
795
+ const ret = typeof(val) === 'object' && val !== null;
796
+ return ret;
797
+ };
798
+ imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
799
+ const ret = typeof(getObject(arg0)) === 'string';
800
+ return ret;
801
+ };
802
+ imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
803
+ const ret = getObject(arg0) === undefined;
804
+ return ret;
805
+ };
806
+ imports.wbg.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) {
807
+ const ret = getObject(arg0) === getObject(arg1);
808
+ return ret;
809
+ };
810
+ imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
811
+ const ret = getObject(arg0) == getObject(arg1);
812
+ return ret;
813
+ };
814
+ imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
815
+ const obj = getObject(arg1);
816
+ const ret = typeof(obj) === 'number' ? obj : undefined;
817
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
818
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
819
+ };
820
+ imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
821
+ const obj = getObject(arg1);
822
+ const ret = typeof(obj) === 'string' ? obj : undefined;
823
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
824
+ var len1 = WASM_VECTOR_LEN;
825
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
826
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
827
+ };
828
+ imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
829
+ throw new Error(getStringFromWasm0(arg0, arg1));
830
+ };
831
+ imports.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
832
+ getObject(arg0)._wbg_cb_unref();
833
+ };
834
+ imports.wbg.__wbg_abort_07646c894ebbf2bd = function(arg0) {
835
+ getObject(arg0).abort();
836
+ };
837
+ imports.wbg.__wbg_abort_399ecbcfd6ef3c8e = function(arg0, arg1) {
838
+ getObject(arg0).abort(getObject(arg1));
839
+ };
840
+ imports.wbg.__wbg_acceptedshare_new = function(arg0) {
841
+ const ret = AcceptedShare.__wrap(arg0);
842
+ return addHeapObject(ret);
843
+ };
844
+ imports.wbg.__wbg_append_c5cbdf46455cc776 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
845
+ getObject(arg0).append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
846
+ }, arguments) };
847
+ imports.wbg.__wbg_arrayBuffer_c04af4fce566092d = function() { return handleError(function (arg0) {
848
+ const ret = getObject(arg0).arrayBuffer();
849
+ return addHeapObject(ret);
850
+ }, arguments) };
851
+ imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
852
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
853
+ return addHeapObject(ret);
854
+ }, arguments) };
855
+ imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
856
+ const ret = getObject(arg0).call(getObject(arg1));
857
+ return addHeapObject(ret);
858
+ }, arguments) };
859
+ imports.wbg.__wbg_clearTimeout_7a42b49784aea641 = function(arg0) {
860
+ const ret = clearTimeout(takeObject(arg0));
861
+ return addHeapObject(ret);
862
+ };
863
+ imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
864
+ const ret = getObject(arg0).crypto;
865
+ return addHeapObject(ret);
866
+ };
867
+ imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
868
+ const ret = getObject(arg0).done;
869
+ return ret;
870
+ };
871
+ imports.wbg.__wbg_encryptedclient_new = function(arg0) {
872
+ const ret = EncryptedClient.__wrap(arg0);
873
+ return addHeapObject(ret);
874
+ };
875
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
876
+ let deferred0_0;
877
+ let deferred0_1;
878
+ try {
879
+ deferred0_0 = arg0;
880
+ deferred0_1 = arg1;
881
+ console.error(getStringFromWasm0(arg0, arg1));
882
+ } finally {
883
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
884
+ }
885
+ };
886
+ imports.wbg.__wbg_fetch_74a3e84ebd2c9a0e = function(arg0) {
887
+ const ret = fetch(getObject(arg0));
888
+ return addHeapObject(ret);
889
+ };
890
+ imports.wbg.__wbg_fetch_90447c28cc0b095e = function(arg0, arg1) {
891
+ const ret = getObject(arg0).fetch(getObject(arg1));
892
+ return addHeapObject(ret);
893
+ };
894
+ imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
895
+ getObject(arg0).getRandomValues(getObject(arg1));
896
+ }, arguments) };
897
+ imports.wbg.__wbg_getTime_ad1e9878a735af08 = function(arg0) {
898
+ const ret = getObject(arg0).getTime();
899
+ return ret;
900
+ };
901
+ imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
902
+ const ret = getObject(arg0)[arg1 >>> 0];
903
+ return addHeapObject(ret);
904
+ };
905
+ imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
906
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
907
+ return addHeapObject(ret);
908
+ }, arguments) };
909
+ imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
910
+ const ret = getObject(arg0)[getObject(arg1)];
911
+ return addHeapObject(ret);
912
+ };
913
+ imports.wbg.__wbg_has_0e670569d65d3a45 = function() { return handleError(function (arg0, arg1) {
914
+ const ret = Reflect.has(getObject(arg0), getObject(arg1));
915
+ return ret;
916
+ }, arguments) };
917
+ imports.wbg.__wbg_headers_654c30e1bcccc552 = function(arg0) {
918
+ const ret = getObject(arg0).headers;
919
+ return addHeapObject(ret);
920
+ };
921
+ imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
922
+ let result;
923
+ try {
924
+ result = getObject(arg0) instanceof ArrayBuffer;
925
+ } catch (_) {
926
+ result = false;
927
+ }
928
+ const ret = result;
929
+ return ret;
930
+ };
931
+ imports.wbg.__wbg_instanceof_Response_cd74d1c2ac92cb0b = function(arg0) {
932
+ let result;
933
+ try {
934
+ result = getObject(arg0) instanceof Response;
935
+ } catch (_) {
936
+ result = false;
937
+ }
938
+ const ret = result;
939
+ return ret;
940
+ };
941
+ imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
942
+ let result;
943
+ try {
944
+ result = getObject(arg0) instanceof Uint8Array;
945
+ } catch (_) {
946
+ result = false;
947
+ }
948
+ const ret = result;
949
+ return ret;
950
+ };
951
+ imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
952
+ const ret = Array.isArray(getObject(arg0));
953
+ return ret;
954
+ };
955
+ imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
956
+ const ret = Number.isSafeInteger(getObject(arg0));
957
+ return ret;
958
+ };
959
+ imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() {
960
+ const ret = Symbol.iterator;
961
+ return addHeapObject(ret);
962
+ };
963
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
964
+ const ret = getObject(arg0).length;
965
+ return ret;
966
+ };
967
+ imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
968
+ const ret = getObject(arg0).length;
969
+ return ret;
970
+ };
971
+ imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
972
+ const ret = getObject(arg0).msCrypto;
973
+ return addHeapObject(ret);
974
+ };
975
+ imports.wbg.__wbg_new_0_23cedd11d9b40c9d = function() {
976
+ const ret = new Date();
977
+ return addHeapObject(ret);
978
+ };
979
+ imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
980
+ const ret = new Object();
981
+ return addHeapObject(ret);
982
+ };
983
+ imports.wbg.__wbg_new_25f239778d6112b9 = function() {
984
+ const ret = new Array();
985
+ return addHeapObject(ret);
986
+ };
987
+ imports.wbg.__wbg_new_3c79b3bb1b32b7d3 = function() { return handleError(function () {
988
+ const ret = new Headers();
989
+ return addHeapObject(ret);
990
+ }, arguments) };
991
+ imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
992
+ const ret = new Uint8Array(getObject(arg0));
993
+ return addHeapObject(ret);
994
+ };
995
+ imports.wbg.__wbg_new_881a222c65f168fc = function() { return handleError(function () {
996
+ const ret = new AbortController();
997
+ return addHeapObject(ret);
998
+ }, arguments) };
999
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
1000
+ const ret = new Error();
1001
+ return addHeapObject(ret);
1002
+ };
1003
+ imports.wbg.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
1004
+ try {
1005
+ var state0 = {a: arg0, b: arg1};
1006
+ var cb0 = (arg0, arg1) => {
1007
+ const a = state0.a;
1008
+ state0.a = 0;
1009
+ try {
1010
+ return __wasm_bindgen_func_elem_1445(a, state0.b, arg0, arg1);
1011
+ } finally {
1012
+ state0.a = a;
1013
+ }
1014
+ };
1015
+ const ret = new Promise(cb0);
1016
+ return addHeapObject(ret);
1017
+ } finally {
1018
+ state0.a = state0.b = 0;
1019
+ }
1020
+ };
1021
+ imports.wbg.__wbg_new_from_slice_f9c22b9153b26992 = function(arg0, arg1) {
1022
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1023
+ return addHeapObject(ret);
1024
+ };
1025
+ imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
1026
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
1027
+ return addHeapObject(ret);
1028
+ };
1029
+ imports.wbg.__wbg_new_with_length_aa5eaf41d35235e5 = function(arg0) {
1030
+ const ret = new Uint8Array(arg0 >>> 0);
1031
+ return addHeapObject(ret);
1032
+ };
1033
+ imports.wbg.__wbg_new_with_str_and_init_c5748f76f5108934 = function() { return handleError(function (arg0, arg1, arg2) {
1034
+ const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
1035
+ return addHeapObject(ret);
1036
+ }, arguments) };
1037
+ imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) {
1038
+ const ret = getObject(arg0).next;
1039
+ return addHeapObject(ret);
1040
+ };
1041
+ imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
1042
+ const ret = getObject(arg0).next();
1043
+ return addHeapObject(ret);
1044
+ }, arguments) };
1045
+ imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
1046
+ const ret = getObject(arg0).node;
1047
+ return addHeapObject(ret);
1048
+ };
1049
+ imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
1050
+ const ret = getObject(arg0).process;
1051
+ return addHeapObject(ret);
1052
+ };
1053
+ imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
1054
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1055
+ };
1056
+ imports.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
1057
+ const ret = getObject(arg0).queueMicrotask;
1058
+ return addHeapObject(ret);
1059
+ };
1060
+ imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
1061
+ queueMicrotask(getObject(arg0));
1062
+ };
1063
+ imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
1064
+ getObject(arg0).randomFillSync(takeObject(arg1));
1065
+ }, arguments) };
1066
+ imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
1067
+ const ret = module.require;
1068
+ return addHeapObject(ret);
1069
+ }, arguments) };
1070
+ imports.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
1071
+ const ret = Promise.resolve(getObject(arg0));
1072
+ return addHeapObject(ret);
1073
+ };
1074
+ imports.wbg.__wbg_setTimeout_7bb3429662ab1e70 = function(arg0, arg1) {
1075
+ const ret = setTimeout(getObject(arg0), arg1);
1076
+ return addHeapObject(ret);
1077
+ };
1078
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
1079
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1080
+ };
1081
+ imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
1082
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1083
+ };
1084
+ imports.wbg.__wbg_set_body_8e743242d6076a4f = function(arg0, arg1) {
1085
+ getObject(arg0).body = getObject(arg1);
1086
+ };
1087
+ imports.wbg.__wbg_set_cache_0e437c7c8e838b9b = function(arg0, arg1) {
1088
+ getObject(arg0).cache = __wbindgen_enum_RequestCache[arg1];
1089
+ };
1090
+ imports.wbg.__wbg_set_credentials_55ae7c3c106fd5be = function(arg0, arg1) {
1091
+ getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
1092
+ };
1093
+ imports.wbg.__wbg_set_headers_5671cf088e114d2b = function(arg0, arg1) {
1094
+ getObject(arg0).headers = getObject(arg1);
1095
+ };
1096
+ imports.wbg.__wbg_set_method_76c69e41b3570627 = function(arg0, arg1, arg2) {
1097
+ getObject(arg0).method = getStringFromWasm0(arg1, arg2);
1098
+ };
1099
+ imports.wbg.__wbg_set_mode_611016a6818fc690 = function(arg0, arg1) {
1100
+ getObject(arg0).mode = __wbindgen_enum_RequestMode[arg1];
1101
+ };
1102
+ imports.wbg.__wbg_set_signal_e89be862d0091009 = function(arg0, arg1) {
1103
+ getObject(arg0).signal = getObject(arg1);
1104
+ };
1105
+ imports.wbg.__wbg_signal_3c14fbdc89694b39 = function(arg0) {
1106
+ const ret = getObject(arg0).signal;
1107
+ return addHeapObject(ret);
1108
+ };
1109
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
1110
+ const ret = getObject(arg1).stack;
1111
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1112
+ const len1 = WASM_VECTOR_LEN;
1113
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1114
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1115
+ };
1116
+ imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
1117
+ const ret = typeof global === 'undefined' ? null : global;
1118
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1119
+ };
1120
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
1121
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1122
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1123
+ };
1124
+ imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
1125
+ const ret = typeof self === 'undefined' ? null : self;
1126
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1127
+ };
1128
+ imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
1129
+ const ret = typeof window === 'undefined' ? null : window;
1130
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
1131
+ };
1132
+ imports.wbg.__wbg_status_9bfc680efca4bdfd = function(arg0) {
1133
+ const ret = getObject(arg0).status;
1134
+ return ret;
1135
+ };
1136
+ imports.wbg.__wbg_stringify_655a6390e1f5eb6b = function() { return handleError(function (arg0) {
1137
+ const ret = JSON.stringify(getObject(arg0));
1138
+ return addHeapObject(ret);
1139
+ }, arguments) };
1140
+ imports.wbg.__wbg_subarray_845f2f5bce7d061a = function(arg0, arg1, arg2) {
1141
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
1142
+ return addHeapObject(ret);
1143
+ };
1144
+ imports.wbg.__wbg_text_51046bb33d257f63 = function() { return handleError(function (arg0) {
1145
+ const ret = getObject(arg0).text();
1146
+ return addHeapObject(ret);
1147
+ }, arguments) };
1148
+ imports.wbg.__wbg_then_429f7caf1026411d = function(arg0, arg1, arg2) {
1149
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
1150
+ return addHeapObject(ret);
1151
+ };
1152
+ imports.wbg.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
1153
+ const ret = getObject(arg0).then(getObject(arg1));
1154
+ return addHeapObject(ret);
1155
+ };
1156
+ imports.wbg.__wbg_url_b6d11838a4f95198 = function(arg0, arg1) {
1157
+ const ret = getObject(arg1).url;
1158
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1159
+ const len1 = WASM_VECTOR_LEN;
1160
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1161
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1162
+ };
1163
+ imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
1164
+ const ret = getObject(arg0).value;
1165
+ return addHeapObject(ret);
1166
+ };
1167
+ imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
1168
+ const ret = getObject(arg0).versions;
1169
+ return addHeapObject(ret);
1170
+ };
1171
+ imports.wbg.__wbindgen_cast_04a5579367ffcd92 = function(arg0, arg1) {
1172
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 283, function: Function { arguments: [], shim_idx: 284, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1173
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_974, __wasm_bindgen_func_elem_975);
1174
+ return addHeapObject(ret);
1175
+ };
1176
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1177
+ // Cast intrinsic for `Ref(String) -> Externref`.
1178
+ const ret = getStringFromWasm0(arg0, arg1);
1179
+ return addHeapObject(ret);
1180
+ };
1181
+ imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
1182
+ // Cast intrinsic for `U64 -> Externref`.
1183
+ const ret = BigInt.asUintN(64, arg0);
1184
+ return addHeapObject(ret);
1185
+ };
1186
+ imports.wbg.__wbindgen_cast_5885937ba6005174 = function(arg0, arg1) {
1187
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 318, function: Function { arguments: [Externref], shim_idx: 319, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1188
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1046, __wasm_bindgen_func_elem_1047);
1189
+ return addHeapObject(ret);
1190
+ };
1191
+ imports.wbg.__wbindgen_cast_77bc3e92745e9a35 = function(arg0, arg1) {
1192
+ var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
1193
+ wasm.__wbindgen_export4(arg0, arg1 * 1, 1);
1194
+ // Cast intrinsic for `Vector(U8) -> Externref`.
1195
+ const ret = v0;
1196
+ return addHeapObject(ret);
1197
+ };
1198
+ imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
1199
+ // Cast intrinsic for `I64 -> Externref`.
1200
+ const ret = arg0;
1201
+ return addHeapObject(ret);
1202
+ };
1203
+ imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
1204
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
1205
+ const ret = getArrayU8FromWasm0(arg0, arg1);
1206
+ return addHeapObject(ret);
1207
+ };
1208
+ imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1209
+ // Cast intrinsic for `F64 -> Externref`.
1210
+ const ret = arg0;
1211
+ return addHeapObject(ret);
1212
+ };
1213
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
1214
+ const ret = getObject(arg0);
1215
+ return addHeapObject(ret);
1216
+ };
1217
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
1218
+ takeObject(arg0);
1219
+ };
1220
+
1221
+ return imports;
1222
+ }
1223
+
1224
+ function __wbg_finalize_init(instance, module) {
1225
+ wasm = instance.exports;
1226
+ __wbg_init.__wbindgen_wasm_module = module;
1227
+ cachedDataViewMemory0 = null;
1228
+ cachedUint8ArrayMemory0 = null;
1229
+
1230
+
1231
+ wasm.__wbindgen_start();
1232
+ return wasm;
1233
+ }
1234
+
1235
+ function initSync(module) {
1236
+ if (wasm !== undefined) return wasm;
1237
+
1238
+
1239
+ if (typeof module !== 'undefined') {
1240
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1241
+ ({module} = module)
1242
+ } else {
1243
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1244
+ }
1245
+ }
1246
+
1247
+ const imports = __wbg_get_imports();
1248
+ if (!(module instanceof WebAssembly.Module)) {
1249
+ module = new WebAssembly.Module(module);
1250
+ }
1251
+ const instance = new WebAssembly.Instance(module, imports);
1252
+ return __wbg_finalize_init(instance, module);
1253
+ }
1254
+
1255
+ async function __wbg_init(module_or_path) {
1256
+ if (wasm !== undefined) return wasm;
1257
+
1258
+
1259
+ if (typeof module_or_path !== 'undefined') {
1260
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1261
+ ({module_or_path} = module_or_path)
1262
+ } else {
1263
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1264
+ }
1265
+ }
1266
+
1267
+ if (typeof module_or_path === 'undefined') {
1268
+ module_or_path = new URL('fula_js_bg.wasm', import.meta.url);
1269
+ }
1270
+ const imports = __wbg_get_imports();
1271
+
1272
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1273
+ module_or_path = fetch(module_or_path);
1274
+ }
1275
+
1276
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1277
+
1278
+ return __wbg_finalize_init(instance, module);
1279
+ }
1280
+
1281
+ export { initSync };
1282
+ export default __wbg_init;