rapidhash-wasm-vn 1.2.0 → 1.2.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.
@@ -1,51 +1,395 @@
1
- let wasm_bindgen;
2
- (function() {
3
- const __exports = {};
1
+ let wasm_bindgen = (function(exports) {
4
2
  let script_src;
5
3
  if (typeof document !== 'undefined' && document.currentScript !== null) {
6
4
  script_src = new URL(document.currentScript.src, location.href).toString();
7
5
  }
8
- let wasm = undefined;
9
6
 
10
- let cachedUint8ArrayMemory0 = null;
11
-
12
- function getUint8ArrayMemory0() {
13
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
14
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
7
+ class FastHasher {
8
+ __destroy_into_raw() {
9
+ const ptr = this.__wbg_ptr;
10
+ this.__wbg_ptr = 0;
11
+ FastHasherFinalization.unregister(this);
12
+ return ptr;
13
+ }
14
+ free() {
15
+ const ptr = this.__destroy_into_raw();
16
+ wasm.__wbg_fasthasher_free(ptr, 0);
17
+ }
18
+ /**
19
+ * Finalizes the hash and returns the result
20
+ * @returns {bigint}
21
+ */
22
+ digest() {
23
+ const ret = wasm.fasthasher_digest(this.__wbg_ptr);
24
+ return BigInt.asUintN(64, ret);
25
+ }
26
+ /**
27
+ * @param {bigint | null} [seed]
28
+ */
29
+ constructor(seed) {
30
+ const ret = wasm.fasthasher_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
31
+ this.__wbg_ptr = ret >>> 0;
32
+ FastHasherFinalization.register(this, this.__wbg_ptr, this);
33
+ return this;
34
+ }
35
+ /**
36
+ * Resets the hasher
37
+ */
38
+ reset() {
39
+ wasm.fasthasher_reset(this.__wbg_ptr);
40
+ }
41
+ /**
42
+ * Updates the hash with new data
43
+ * @param {Uint8Array} data
44
+ */
45
+ update(data) {
46
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
47
+ const len0 = WASM_VECTOR_LEN;
48
+ wasm.fasthasher_update(this.__wbg_ptr, ptr0, len0);
49
+ }
50
+ /**
51
+ * @param {bigint} data
52
+ */
53
+ update_i128(data) {
54
+ wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
55
+ }
56
+ /**
57
+ * @param {number} data
58
+ */
59
+ update_i16(data) {
60
+ wasm.fasthasher_update_i16(this.__wbg_ptr, data);
61
+ }
62
+ /**
63
+ * @param {number} data
64
+ */
65
+ update_i32(data) {
66
+ wasm.fasthasher_update_i32(this.__wbg_ptr, data);
67
+ }
68
+ /**
69
+ * @param {bigint} data
70
+ */
71
+ update_i64(data) {
72
+ wasm.fasthasher_update_i64(this.__wbg_ptr, data);
73
+ }
74
+ /**
75
+ * @param {number} data
76
+ */
77
+ update_i8(data) {
78
+ wasm.fasthasher_update_i8(this.__wbg_ptr, data);
79
+ }
80
+ /**
81
+ * @param {bigint} data
82
+ */
83
+ update_u128(data) {
84
+ wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
85
+ }
86
+ /**
87
+ * @param {number} data
88
+ */
89
+ update_u16(data) {
90
+ wasm.fasthasher_update_i16(this.__wbg_ptr, data);
91
+ }
92
+ /**
93
+ * @param {number} data
94
+ */
95
+ update_u32(data) {
96
+ wasm.fasthasher_update_i32(this.__wbg_ptr, data);
97
+ }
98
+ /**
99
+ * @param {bigint} data
100
+ */
101
+ update_u64(data) {
102
+ wasm.fasthasher_update_i64(this.__wbg_ptr, data);
103
+ }
104
+ /**
105
+ * @param {number} data
106
+ */
107
+ update_u8(data) {
108
+ wasm.fasthasher_update_i8(this.__wbg_ptr, data);
15
109
  }
16
- return cachedUint8ArrayMemory0;
17
110
  }
111
+ if (Symbol.dispose) FastHasher.prototype[Symbol.dispose] = FastHasher.prototype.free;
112
+ exports.FastHasher = FastHasher;
18
113
 
19
- function getArrayU8FromWasm0(ptr, len) {
20
- ptr = ptr >>> 0;
21
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
114
+ /**
115
+ * Streaming PortableHashV1
116
+ */
117
+ class PortableHashV1 {
118
+ __destroy_into_raw() {
119
+ const ptr = this.__wbg_ptr;
120
+ this.__wbg_ptr = 0;
121
+ PortableHashV1Finalization.unregister(this);
122
+ return ptr;
123
+ }
124
+ free() {
125
+ const ptr = this.__destroy_into_raw();
126
+ wasm.__wbg_portablehashv1_free(ptr, 0);
127
+ }
128
+ /**
129
+ * Finalizes the hash and returns the result
130
+ * @returns {bigint}
131
+ */
132
+ digest() {
133
+ const ret = wasm.portablehashv1_digest(this.__wbg_ptr);
134
+ return BigInt.asUintN(64, ret);
135
+ }
136
+ /**
137
+ * @param {bigint | null} [seed]
138
+ */
139
+ constructor(seed) {
140
+ const ret = wasm.portablehashv1_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
141
+ this.__wbg_ptr = ret >>> 0;
142
+ PortableHashV1Finalization.register(this, this.__wbg_ptr, this);
143
+ return this;
144
+ }
145
+ /**
146
+ * Resets the hasher with optional new seed
147
+ */
148
+ reset() {
149
+ wasm.portablehashv1_reset(this.__wbg_ptr);
150
+ }
151
+ /**
152
+ * Updates the hash with new data
153
+ * @param {Uint8Array} data
154
+ */
155
+ update(data) {
156
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
157
+ const len0 = WASM_VECTOR_LEN;
158
+ wasm.portablehashv1_update(this.__wbg_ptr, ptr0, len0);
159
+ }
22
160
  }
161
+ if (Symbol.dispose) PortableHashV1.prototype[Symbol.dispose] = PortableHashV1.prototype.free;
162
+ exports.PortableHashV1 = PortableHashV1;
23
163
 
24
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
25
-
26
- cachedTextDecoder.decode();
27
-
28
- function decodeText(ptr, len) {
29
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
164
+ /**
165
+ * Streaming PortableHashV2
166
+ */
167
+ class PortableHashV2 {
168
+ __destroy_into_raw() {
169
+ const ptr = this.__wbg_ptr;
170
+ this.__wbg_ptr = 0;
171
+ PortableHashV2Finalization.unregister(this);
172
+ return ptr;
173
+ }
174
+ free() {
175
+ const ptr = this.__destroy_into_raw();
176
+ wasm.__wbg_portablehashv2_free(ptr, 0);
177
+ }
178
+ /**
179
+ * Finalizes the hash and returns the result
180
+ * @returns {bigint}
181
+ */
182
+ digest() {
183
+ const ret = wasm.portablehashv2_digest(this.__wbg_ptr);
184
+ return BigInt.asUintN(64, ret);
185
+ }
186
+ /**
187
+ * @param {bigint | null} [seed]
188
+ */
189
+ constructor(seed) {
190
+ const ret = wasm.portablehashv2_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
191
+ this.__wbg_ptr = ret >>> 0;
192
+ PortableHashV2Finalization.register(this, this.__wbg_ptr, this);
193
+ return this;
194
+ }
195
+ /**
196
+ * Resets the hasher with optional new seed
197
+ */
198
+ reset() {
199
+ wasm.portablehashv2_reset(this.__wbg_ptr);
200
+ }
201
+ /**
202
+ * Updates the hash with new data
203
+ * @param {Uint8Array} data
204
+ */
205
+ update(data) {
206
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
207
+ const len0 = WASM_VECTOR_LEN;
208
+ wasm.portablehashv2_update(this.__wbg_ptr, ptr0, len0);
209
+ }
30
210
  }
211
+ if (Symbol.dispose) PortableHashV2.prototype[Symbol.dispose] = PortableHashV2.prototype.free;
212
+ exports.PortableHashV2 = PortableHashV2;
31
213
 
32
- function getStringFromWasm0(ptr, len) {
33
- ptr = ptr >>> 0;
34
- return decodeText(ptr, len);
214
+ /**
215
+ * Streaming PortableHashV3
216
+ */
217
+ class PortableHashV3 {
218
+ __destroy_into_raw() {
219
+ const ptr = this.__wbg_ptr;
220
+ this.__wbg_ptr = 0;
221
+ PortableHashV3Finalization.unregister(this);
222
+ return ptr;
223
+ }
224
+ free() {
225
+ const ptr = this.__destroy_into_raw();
226
+ wasm.__wbg_portablehashv3_free(ptr, 0);
227
+ }
228
+ /**
229
+ * Finalizes the hash and returns the result
230
+ * @returns {bigint}
231
+ */
232
+ digest() {
233
+ const ret = wasm.portablehashv3_digest(this.__wbg_ptr);
234
+ return BigInt.asUintN(64, ret);
235
+ }
236
+ /**
237
+ * @param {bigint | null} [seed]
238
+ */
239
+ constructor(seed) {
240
+ const ret = wasm.portablehashv2_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
241
+ this.__wbg_ptr = ret >>> 0;
242
+ PortableHashV3Finalization.register(this, this.__wbg_ptr, this);
243
+ return this;
244
+ }
245
+ /**
246
+ * Resets the hasher with optional new seed
247
+ */
248
+ reset() {
249
+ wasm.portablehashv2_reset(this.__wbg_ptr);
250
+ }
251
+ /**
252
+ * Updates the hash with new data
253
+ * @param {Uint8Array} data
254
+ */
255
+ update(data) {
256
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
257
+ const len0 = WASM_VECTOR_LEN;
258
+ wasm.portablehashv2_update(this.__wbg_ptr, ptr0, len0);
259
+ }
35
260
  }
261
+ if (Symbol.dispose) PortableHashV3.prototype[Symbol.dispose] = PortableHashV3.prototype.free;
262
+ exports.PortableHashV3 = PortableHashV3;
36
263
 
37
- let WASM_VECTOR_LEN = 0;
38
-
39
- function passArray8ToWasm0(arg, malloc) {
40
- const ptr = malloc(arg.length * 1, 1) >>> 0;
41
- getUint8ArrayMemory0().set(arg, ptr / 1);
42
- WASM_VECTOR_LEN = arg.length;
43
- return ptr;
264
+ class QualityHasher {
265
+ __destroy_into_raw() {
266
+ const ptr = this.__wbg_ptr;
267
+ this.__wbg_ptr = 0;
268
+ QualityHasherFinalization.unregister(this);
269
+ return ptr;
270
+ }
271
+ free() {
272
+ const ptr = this.__destroy_into_raw();
273
+ wasm.__wbg_qualityhasher_free(ptr, 0);
274
+ }
275
+ /**
276
+ * Finalizes the hash and returns the result
277
+ * @returns {bigint}
278
+ */
279
+ digest() {
280
+ const ret = wasm.qualityhasher_digest(this.__wbg_ptr);
281
+ return BigInt.asUintN(64, ret);
282
+ }
283
+ /**
284
+ * @param {bigint | null} [seed]
285
+ */
286
+ constructor(seed) {
287
+ const ret = wasm.fasthasher_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
288
+ this.__wbg_ptr = ret >>> 0;
289
+ QualityHasherFinalization.register(this, this.__wbg_ptr, this);
290
+ return this;
291
+ }
292
+ /**
293
+ * Resets the hasher
294
+ */
295
+ reset() {
296
+ wasm.fasthasher_reset(this.__wbg_ptr);
297
+ }
298
+ /**
299
+ * Updates the hash with new data
300
+ * @param {Uint8Array} data
301
+ */
302
+ update(data) {
303
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
304
+ const len0 = WASM_VECTOR_LEN;
305
+ wasm.qualityhasher_update(this.__wbg_ptr, ptr0, len0);
306
+ }
307
+ /**
308
+ * @param {bigint} data
309
+ */
310
+ update_i128(data) {
311
+ wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
312
+ }
313
+ /**
314
+ * @param {number} data
315
+ */
316
+ update_i16(data) {
317
+ wasm.fasthasher_update_i16(this.__wbg_ptr, data);
318
+ }
319
+ /**
320
+ * @param {number} data
321
+ */
322
+ update_i32(data) {
323
+ wasm.fasthasher_update_i32(this.__wbg_ptr, data);
324
+ }
325
+ /**
326
+ * @param {bigint} data
327
+ */
328
+ update_i64(data) {
329
+ wasm.fasthasher_update_i64(this.__wbg_ptr, data);
330
+ }
331
+ /**
332
+ * @param {number} data
333
+ */
334
+ update_i8(data) {
335
+ wasm.fasthasher_update_i8(this.__wbg_ptr, data);
336
+ }
337
+ /**
338
+ * @param {bigint} data
339
+ */
340
+ update_u128(data) {
341
+ wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
342
+ }
343
+ /**
344
+ * @param {number} data
345
+ */
346
+ update_u16(data) {
347
+ wasm.fasthasher_update_i16(this.__wbg_ptr, data);
348
+ }
349
+ /**
350
+ * @param {number} data
351
+ */
352
+ update_u32(data) {
353
+ wasm.fasthasher_update_i32(this.__wbg_ptr, data);
354
+ }
355
+ /**
356
+ * @param {bigint} data
357
+ */
358
+ update_u64(data) {
359
+ wasm.fasthasher_update_i64(this.__wbg_ptr, data);
360
+ }
361
+ /**
362
+ * @param {number} data
363
+ */
364
+ update_u8(data) {
365
+ wasm.fasthasher_update_i8(this.__wbg_ptr, data);
366
+ }
44
367
  }
368
+ if (Symbol.dispose) QualityHasher.prototype[Symbol.dispose] = QualityHasher.prototype.free;
369
+ exports.QualityHasher = QualityHasher;
45
370
 
46
- function isLikeNone(x) {
47
- return x === undefined || x === null;
371
+ /**
372
+ * RapidHash V3 - (64-bit) hash file
373
+ *
374
+ * # Arguments
375
+ *
376
+ * * `input` - Input data to hash
377
+ * * `seed` - Seed value for hash (default: 0)
378
+ * @param {Uint8Array} input
379
+ * @param {bigint | null} [seed]
380
+ * @returns {bigint}
381
+ */
382
+ function hash_file_v3(input, seed) {
383
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
384
+ const len0 = WASM_VECTOR_LEN;
385
+ const ret = wasm.hash_file_v3(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
386
+ if (ret[2]) {
387
+ throw takeFromExternrefTable0(ret[1]);
388
+ }
389
+ return BigInt.asUintN(64, ret[0]);
48
390
  }
391
+ exports.hash_file_v3 = hash_file_v3;
392
+
49
393
  /**
50
394
  * Computes RapidHash V1 (64-bit) hash
51
395
  *
@@ -57,64 +401,21 @@ let wasm_bindgen;
57
401
  * @param {bigint | null} [seed]
58
402
  * @returns {bigint}
59
403
  */
60
- __exports.hash_v1 = function(input, seed) {
404
+ function hash_v1(input, seed) {
61
405
  const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
62
406
  const len0 = WASM_VECTOR_LEN;
63
407
  const ret = wasm.hash_v1(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
64
408
  return BigInt.asUintN(64, ret);
65
- };
66
-
67
- let cachedDataViewMemory0 = null;
68
-
69
- function getDataViewMemory0() {
70
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
71
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
72
- }
73
- return cachedDataViewMemory0;
74
- }
75
-
76
- function addToExternrefTable0(obj) {
77
- const idx = wasm.__externref_table_alloc();
78
- wasm.__wbindgen_export_0.set(idx, obj);
79
- return idx;
80
409
  }
410
+ exports.hash_v1 = hash_v1;
81
411
 
82
- function passArrayJsValueToWasm0(array, malloc) {
83
- const ptr = malloc(array.length * 4, 4) >>> 0;
84
- for (let i = 0; i < array.length; i++) {
85
- const add = addToExternrefTable0(array[i]);
86
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
87
- }
88
- WASM_VECTOR_LEN = array.length;
89
- return ptr;
90
- }
91
-
92
- function takeFromExternrefTable0(idx) {
93
- const value = wasm.__wbindgen_export_0.get(idx);
94
- wasm.__externref_table_dealloc(idx);
95
- return value;
96
- }
97
-
98
- let cachedBigUint64ArrayMemory0 = null;
99
-
100
- function getBigUint64ArrayMemory0() {
101
- if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
102
- cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
103
- }
104
- return cachedBigUint64ArrayMemory0;
105
- }
106
-
107
- function getArrayU64FromWasm0(ptr, len) {
108
- ptr = ptr >>> 0;
109
- return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
110
- }
111
412
  /**
112
413
  * Computes multiple RapidHash V1 (64-bit) hashes in batch
113
414
  * @param {Uint8Array[]} chunks
114
415
  * @param {bigint | null} [seed]
115
416
  * @returns {BigUint64Array}
116
417
  */
117
- __exports.hash_v1_batch = function(chunks, seed) {
418
+ function hash_v1_batch(chunks, seed) {
118
419
  const ptr0 = passArrayJsValueToWasm0(chunks, wasm.__wbindgen_malloc);
119
420
  const len0 = WASM_VECTOR_LEN;
120
421
  const ret = wasm.hash_v1_batch(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
@@ -124,7 +425,8 @@ let wasm_bindgen;
124
425
  var v2 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
125
426
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
126
427
  return v2;
127
- };
428
+ }
429
+ exports.hash_v1_batch = hash_v1_batch;
128
430
 
129
431
  /**
130
432
  * Computes RapidHash V2 (64-bit) hash
@@ -137,12 +439,13 @@ let wasm_bindgen;
137
439
  * @param {bigint | null} [seed]
138
440
  * @returns {bigint}
139
441
  */
140
- __exports.hash_v2 = function(input, seed) {
442
+ function hash_v2(input, seed) {
141
443
  const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
142
444
  const len0 = WASM_VECTOR_LEN;
143
445
  const ret = wasm.hash_v2(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
144
446
  return BigInt.asUintN(64, ret);
145
- };
447
+ }
448
+ exports.hash_v2 = hash_v2;
146
449
 
147
450
  /**
148
451
  * Computes multiple RapidHash V2 (64-bit) hashes in batch
@@ -150,7 +453,7 @@ let wasm_bindgen;
150
453
  * @param {bigint | null} [seed]
151
454
  * @returns {BigUint64Array}
152
455
  */
153
- __exports.hash_v2_batch = function(chunks, seed) {
456
+ function hash_v2_batch(chunks, seed) {
154
457
  const ptr0 = passArrayJsValueToWasm0(chunks, wasm.__wbindgen_malloc);
155
458
  const len0 = WASM_VECTOR_LEN;
156
459
  const ret = wasm.hash_v2_batch(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
@@ -160,7 +463,8 @@ let wasm_bindgen;
160
463
  var v2 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
161
464
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
162
465
  return v2;
163
- };
466
+ }
467
+ exports.hash_v2_batch = hash_v2_batch;
164
468
 
165
469
  /**
166
470
  * Computes RapidHash V3 (64-bit) hash
@@ -173,12 +477,32 @@ let wasm_bindgen;
173
477
  * @param {bigint | null} [seed]
174
478
  * @returns {bigint}
175
479
  */
176
- __exports.hash_v3 = function(input, seed) {
480
+ function hash_v3(input, seed) {
177
481
  const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
178
482
  const len0 = WASM_VECTOR_LEN;
179
483
  const ret = wasm.hash_v3(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
180
484
  return BigInt.asUintN(64, ret);
181
- };
485
+ }
486
+ exports.hash_v3 = hash_v3;
487
+
488
+ /**
489
+ * Computes multiple RapidHash V3 (64-bit) hashes in batch
490
+ * @param {Uint8Array[]} chunks
491
+ * @param {bigint | null} [seed]
492
+ * @returns {BigUint64Array}
493
+ */
494
+ function hash_v3_batch(chunks, seed) {
495
+ const ptr0 = passArrayJsValueToWasm0(chunks, wasm.__wbindgen_malloc);
496
+ const len0 = WASM_VECTOR_LEN;
497
+ const ret = wasm.hash_v3_batch(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
498
+ if (ret[3]) {
499
+ throw takeFromExternrefTable0(ret[2]);
500
+ }
501
+ var v2 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
502
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
503
+ return v2;
504
+ }
505
+ exports.hash_v3_batch = hash_v3_batch;
182
506
 
183
507
  /**
184
508
  * Computes RapidHash V3 (64-bit) micro hash
@@ -191,12 +515,13 @@ let wasm_bindgen;
191
515
  * @param {bigint | null} [seed]
192
516
  * @returns {bigint}
193
517
  */
194
- __exports.hash_v3_micro = function(input, seed) {
518
+ function hash_v3_micro(input, seed) {
195
519
  const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
196
520
  const len0 = WASM_VECTOR_LEN;
197
521
  const ret = wasm.hash_v3_micro(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
198
522
  return BigInt.asUintN(64, ret);
199
- };
523
+ }
524
+ exports.hash_v3_micro = hash_v3_micro;
200
525
 
201
526
  /**
202
527
  * Computes RapidHash V3 (64-bit) nano hash
@@ -209,536 +534,195 @@ let wasm_bindgen;
209
534
  * @param {bigint | null} [seed]
210
535
  * @returns {bigint}
211
536
  */
212
- __exports.hash_v3_nano = function(input, seed) {
537
+ function hash_v3_nano(input, seed) {
213
538
  const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
214
539
  const len0 = WASM_VECTOR_LEN;
215
540
  const ret = wasm.hash_v3_nano(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
216
541
  return BigInt.asUintN(64, ret);
217
- };
218
-
219
- /**
220
- * RapidHash V3 - (64-bit) hash file
221
- *
222
- * # Arguments
223
- *
224
- * * `input` - Input data to hash
225
- * * `seed` - Seed value for hash (default: 0)
226
- * @param {Uint8Array} input
227
- * @param {bigint | null} [seed]
228
- * @returns {bigint}
229
- */
230
- __exports.hash_file_v3 = function(input, seed) {
231
- const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
232
- const len0 = WASM_VECTOR_LEN;
233
- const ret = wasm.hash_file_v3(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
234
- if (ret[2]) {
235
- throw takeFromExternrefTable0(ret[1]);
236
- }
237
- return BigInt.asUintN(64, ret[0]);
238
- };
542
+ }
543
+ exports.hash_v3_nano = hash_v3_nano;
239
544
 
240
- /**
241
- * Computes multiple RapidHash V3 (64-bit) hashes in batch
242
- * @param {Uint8Array[]} chunks
243
- * @param {bigint | null} [seed]
244
- * @returns {BigUint64Array}
245
- */
246
- __exports.hash_v3_batch = function(chunks, seed) {
247
- const ptr0 = passArrayJsValueToWasm0(chunks, wasm.__wbindgen_malloc);
248
- const len0 = WASM_VECTOR_LEN;
249
- const ret = wasm.hash_v3_batch(ptr0, len0, !isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
250
- if (ret[3]) {
251
- throw takeFromExternrefTable0(ret[2]);
252
- }
253
- var v2 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
254
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
255
- return v2;
256
- };
545
+ function __wbg_get_imports() {
546
+ const import0 = {
547
+ __proto__: null,
548
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
549
+ throw new Error(getStringFromWasm0(arg0, arg1));
550
+ },
551
+ __wbg_length_32ed9a279acd054c: function(arg0) {
552
+ const ret = arg0.length;
553
+ return ret;
554
+ },
555
+ __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
556
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
557
+ },
558
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
559
+ // Cast intrinsic for `Ref(String) -> Externref`.
560
+ const ret = getStringFromWasm0(arg0, arg1);
561
+ return ret;
562
+ },
563
+ __wbindgen_init_externref_table: function() {
564
+ const table = wasm.__wbindgen_externrefs;
565
+ const offset = table.grow(4);
566
+ table.set(0, undefined);
567
+ table.set(offset + 0, undefined);
568
+ table.set(offset + 1, null);
569
+ table.set(offset + 2, true);
570
+ table.set(offset + 3, false);
571
+ },
572
+ };
573
+ return {
574
+ __proto__: null,
575
+ "./rapidhash_wasm_vn_bg.js": import0,
576
+ };
577
+ }
257
578
 
258
579
  const FastHasherFinalization = (typeof FinalizationRegistry === 'undefined')
259
580
  ? { register: () => {}, unregister: () => {} }
260
581
  : new FinalizationRegistry(ptr => wasm.__wbg_fasthasher_free(ptr >>> 0, 1));
261
-
262
- class FastHasher {
263
-
264
- __destroy_into_raw() {
265
- const ptr = this.__wbg_ptr;
266
- this.__wbg_ptr = 0;
267
- FastHasherFinalization.unregister(this);
268
- return ptr;
269
- }
270
-
271
- free() {
272
- const ptr = this.__destroy_into_raw();
273
- wasm.__wbg_fasthasher_free(ptr, 0);
274
- }
275
- /**
276
- * @param {bigint | null} [seed]
277
- */
278
- constructor(seed) {
279
- const ret = wasm.fasthasher_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
280
- this.__wbg_ptr = ret >>> 0;
281
- FastHasherFinalization.register(this, this.__wbg_ptr, this);
282
- return this;
283
- }
284
- /**
285
- * Updates the hash with new data
286
- * @param {Uint8Array} data
287
- */
288
- update(data) {
289
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
290
- const len0 = WASM_VECTOR_LEN;
291
- wasm.fasthasher_update(this.__wbg_ptr, ptr0, len0);
292
- }
293
- /**
294
- * @param {number} data
295
- */
296
- update_u8(data) {
297
- wasm.fasthasher_update_i8(this.__wbg_ptr, data);
298
- }
299
- /**
300
- * @param {number} data
301
- */
302
- update_u16(data) {
303
- wasm.fasthasher_update_i16(this.__wbg_ptr, data);
304
- }
305
- /**
306
- * @param {number} data
307
- */
308
- update_u32(data) {
309
- wasm.fasthasher_update_i32(this.__wbg_ptr, data);
310
- }
311
- /**
312
- * @param {bigint} data
313
- */
314
- update_u64(data) {
315
- wasm.fasthasher_update_i64(this.__wbg_ptr, data);
316
- }
317
- /**
318
- * @param {bigint} data
319
- */
320
- update_u128(data) {
321
- wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
322
- }
323
- /**
324
- * @param {number} data
325
- */
326
- update_i8(data) {
327
- wasm.fasthasher_update_i8(this.__wbg_ptr, data);
328
- }
329
- /**
330
- * @param {number} data
331
- */
332
- update_i16(data) {
333
- wasm.fasthasher_update_i16(this.__wbg_ptr, data);
334
- }
335
- /**
336
- * @param {number} data
337
- */
338
- update_i32(data) {
339
- wasm.fasthasher_update_i32(this.__wbg_ptr, data);
340
- }
341
- /**
342
- * @param {bigint} data
343
- */
344
- update_i64(data) {
345
- wasm.fasthasher_update_i64(this.__wbg_ptr, data);
346
- }
347
- /**
348
- * @param {bigint} data
349
- */
350
- update_i128(data) {
351
- wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
352
- }
353
- /**
354
- * Finalizes the hash and returns the result
355
- * @returns {bigint}
356
- */
357
- digest() {
358
- const ret = wasm.fasthasher_digest(this.__wbg_ptr);
359
- return BigInt.asUintN(64, ret);
360
- }
361
- /**
362
- * Resets the hasher
363
- */
364
- reset() {
365
- wasm.fasthasher_reset(this.__wbg_ptr);
366
- }
367
- }
368
- if (Symbol.dispose) FastHasher.prototype[Symbol.dispose] = FastHasher.prototype.free;
369
-
370
- __exports.FastHasher = FastHasher;
371
-
372
582
  const PortableHashV1Finalization = (typeof FinalizationRegistry === 'undefined')
373
583
  ? { register: () => {}, unregister: () => {} }
374
584
  : new FinalizationRegistry(ptr => wasm.__wbg_portablehashv1_free(ptr >>> 0, 1));
375
- /**
376
- * Streaming PortableHashV1
377
- */
378
- class PortableHashV1 {
379
-
380
- __destroy_into_raw() {
381
- const ptr = this.__wbg_ptr;
382
- this.__wbg_ptr = 0;
383
- PortableHashV1Finalization.unregister(this);
384
- return ptr;
385
- }
386
-
387
- free() {
388
- const ptr = this.__destroy_into_raw();
389
- wasm.__wbg_portablehashv1_free(ptr, 0);
390
- }
391
- /**
392
- * @param {bigint | null} [seed]
393
- */
394
- constructor(seed) {
395
- const ret = wasm.portablehashv1_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
396
- this.__wbg_ptr = ret >>> 0;
397
- PortableHashV1Finalization.register(this, this.__wbg_ptr, this);
398
- return this;
399
- }
400
- /**
401
- * Updates the hash with new data
402
- * @param {Uint8Array} data
403
- */
404
- update(data) {
405
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
406
- const len0 = WASM_VECTOR_LEN;
407
- wasm.portablehashv1_update(this.__wbg_ptr, ptr0, len0);
408
- }
409
- /**
410
- * Finalizes the hash and returns the result
411
- * @returns {bigint}
412
- */
413
- digest() {
414
- const ret = wasm.portablehashv1_digest(this.__wbg_ptr);
415
- return BigInt.asUintN(64, ret);
416
- }
417
- /**
418
- * Resets the hasher with optional new seed
419
- */
420
- reset() {
421
- wasm.portablehashv1_reset(this.__wbg_ptr);
422
- }
423
- }
424
- if (Symbol.dispose) PortableHashV1.prototype[Symbol.dispose] = PortableHashV1.prototype.free;
425
-
426
- __exports.PortableHashV1 = PortableHashV1;
427
-
428
585
  const PortableHashV2Finalization = (typeof FinalizationRegistry === 'undefined')
429
586
  ? { register: () => {}, unregister: () => {} }
430
587
  : new FinalizationRegistry(ptr => wasm.__wbg_portablehashv2_free(ptr >>> 0, 1));
431
- /**
432
- * Streaming PortableHashV2
433
- */
434
- class PortableHashV2 {
435
-
436
- __destroy_into_raw() {
437
- const ptr = this.__wbg_ptr;
438
- this.__wbg_ptr = 0;
439
- PortableHashV2Finalization.unregister(this);
440
- return ptr;
441
- }
588
+ const PortableHashV3Finalization = (typeof FinalizationRegistry === 'undefined')
589
+ ? { register: () => {}, unregister: () => {} }
590
+ : new FinalizationRegistry(ptr => wasm.__wbg_portablehashv3_free(ptr >>> 0, 1));
591
+ const QualityHasherFinalization = (typeof FinalizationRegistry === 'undefined')
592
+ ? { register: () => {}, unregister: () => {} }
593
+ : new FinalizationRegistry(ptr => wasm.__wbg_qualityhasher_free(ptr >>> 0, 1));
442
594
 
443
- free() {
444
- const ptr = this.__destroy_into_raw();
445
- wasm.__wbg_portablehashv2_free(ptr, 0);
446
- }
447
- /**
448
- * @param {bigint | null} [seed]
449
- */
450
- constructor(seed) {
451
- const ret = wasm.portablehashv2_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
452
- this.__wbg_ptr = ret >>> 0;
453
- PortableHashV2Finalization.register(this, this.__wbg_ptr, this);
454
- return this;
455
- }
456
- /**
457
- * Updates the hash with new data
458
- * @param {Uint8Array} data
459
- */
460
- update(data) {
461
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
462
- const len0 = WASM_VECTOR_LEN;
463
- wasm.portablehashv2_update(this.__wbg_ptr, ptr0, len0);
464
- }
465
- /**
466
- * Finalizes the hash and returns the result
467
- * @returns {bigint}
468
- */
469
- digest() {
470
- const ret = wasm.portablehashv2_digest(this.__wbg_ptr);
471
- return BigInt.asUintN(64, ret);
472
- }
473
- /**
474
- * Resets the hasher with optional new seed
475
- */
476
- reset() {
477
- wasm.portablehashv2_reset(this.__wbg_ptr);
478
- }
595
+ function addToExternrefTable0(obj) {
596
+ const idx = wasm.__externref_table_alloc();
597
+ wasm.__wbindgen_externrefs.set(idx, obj);
598
+ return idx;
479
599
  }
480
- if (Symbol.dispose) PortableHashV2.prototype[Symbol.dispose] = PortableHashV2.prototype.free;
481
600
 
482
- __exports.PortableHashV2 = PortableHashV2;
601
+ function getArrayU64FromWasm0(ptr, len) {
602
+ ptr = ptr >>> 0;
603
+ return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
604
+ }
483
605
 
484
- const PortableHashV3Finalization = (typeof FinalizationRegistry === 'undefined')
485
- ? { register: () => {}, unregister: () => {} }
486
- : new FinalizationRegistry(ptr => wasm.__wbg_portablehashv3_free(ptr >>> 0, 1));
487
- /**
488
- * Streaming PortableHashV3
489
- */
490
- class PortableHashV3 {
606
+ function getArrayU8FromWasm0(ptr, len) {
607
+ ptr = ptr >>> 0;
608
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
609
+ }
491
610
 
492
- __destroy_into_raw() {
493
- const ptr = this.__wbg_ptr;
494
- this.__wbg_ptr = 0;
495
- PortableHashV3Finalization.unregister(this);
496
- return ptr;
611
+ let cachedBigUint64ArrayMemory0 = null;
612
+ function getBigUint64ArrayMemory0() {
613
+ if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
614
+ cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
497
615
  }
616
+ return cachedBigUint64ArrayMemory0;
617
+ }
498
618
 
499
- free() {
500
- const ptr = this.__destroy_into_raw();
501
- wasm.__wbg_portablehashv3_free(ptr, 0);
502
- }
503
- /**
504
- * @param {bigint | null} [seed]
505
- */
506
- constructor(seed) {
507
- const ret = wasm.portablehashv2_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
508
- this.__wbg_ptr = ret >>> 0;
509
- PortableHashV3Finalization.register(this, this.__wbg_ptr, this);
510
- return this;
511
- }
512
- /**
513
- * Updates the hash with new data
514
- * @param {Uint8Array} data
515
- */
516
- update(data) {
517
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
518
- const len0 = WASM_VECTOR_LEN;
519
- wasm.portablehashv2_update(this.__wbg_ptr, ptr0, len0);
520
- }
521
- /**
522
- * Finalizes the hash and returns the result
523
- * @returns {bigint}
524
- */
525
- digest() {
526
- const ret = wasm.portablehashv3_digest(this.__wbg_ptr);
527
- return BigInt.asUintN(64, ret);
528
- }
529
- /**
530
- * Resets the hasher with optional new seed
531
- */
532
- reset() {
533
- wasm.portablehashv2_reset(this.__wbg_ptr);
619
+ let cachedDataViewMemory0 = null;
620
+ function getDataViewMemory0() {
621
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
622
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
534
623
  }
624
+ return cachedDataViewMemory0;
535
625
  }
536
- if (Symbol.dispose) PortableHashV3.prototype[Symbol.dispose] = PortableHashV3.prototype.free;
537
626
 
538
- __exports.PortableHashV3 = PortableHashV3;
627
+ function getStringFromWasm0(ptr, len) {
628
+ ptr = ptr >>> 0;
629
+ return decodeText(ptr, len);
630
+ }
539
631
 
540
- const QualityHasherFinalization = (typeof FinalizationRegistry === 'undefined')
541
- ? { register: () => {}, unregister: () => {} }
542
- : new FinalizationRegistry(ptr => wasm.__wbg_qualityhasher_free(ptr >>> 0, 1));
632
+ let cachedUint8ArrayMemory0 = null;
633
+ function getUint8ArrayMemory0() {
634
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
635
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
636
+ }
637
+ return cachedUint8ArrayMemory0;
638
+ }
543
639
 
544
- class QualityHasher {
640
+ function isLikeNone(x) {
641
+ return x === undefined || x === null;
642
+ }
545
643
 
546
- __destroy_into_raw() {
547
- const ptr = this.__wbg_ptr;
548
- this.__wbg_ptr = 0;
549
- QualityHasherFinalization.unregister(this);
550
- return ptr;
551
- }
644
+ function passArray8ToWasm0(arg, malloc) {
645
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
646
+ getUint8ArrayMemory0().set(arg, ptr / 1);
647
+ WASM_VECTOR_LEN = arg.length;
648
+ return ptr;
649
+ }
552
650
 
553
- free() {
554
- const ptr = this.__destroy_into_raw();
555
- wasm.__wbg_qualityhasher_free(ptr, 0);
556
- }
557
- /**
558
- * @param {bigint | null} [seed]
559
- */
560
- constructor(seed) {
561
- const ret = wasm.fasthasher_new(!isLikeNone(seed), isLikeNone(seed) ? BigInt(0) : seed);
562
- this.__wbg_ptr = ret >>> 0;
563
- QualityHasherFinalization.register(this, this.__wbg_ptr, this);
564
- return this;
565
- }
566
- /**
567
- * Updates the hash with new data
568
- * @param {Uint8Array} data
569
- */
570
- update(data) {
571
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
572
- const len0 = WASM_VECTOR_LEN;
573
- wasm.qualityhasher_update(this.__wbg_ptr, ptr0, len0);
574
- }
575
- /**
576
- * @param {number} data
577
- */
578
- update_u8(data) {
579
- wasm.fasthasher_update_i8(this.__wbg_ptr, data);
580
- }
581
- /**
582
- * @param {number} data
583
- */
584
- update_u16(data) {
585
- wasm.fasthasher_update_i16(this.__wbg_ptr, data);
586
- }
587
- /**
588
- * @param {number} data
589
- */
590
- update_u32(data) {
591
- wasm.fasthasher_update_i32(this.__wbg_ptr, data);
592
- }
593
- /**
594
- * @param {bigint} data
595
- */
596
- update_u64(data) {
597
- wasm.fasthasher_update_i64(this.__wbg_ptr, data);
598
- }
599
- /**
600
- * @param {bigint} data
601
- */
602
- update_u128(data) {
603
- wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
604
- }
605
- /**
606
- * @param {number} data
607
- */
608
- update_i8(data) {
609
- wasm.fasthasher_update_i8(this.__wbg_ptr, data);
610
- }
611
- /**
612
- * @param {number} data
613
- */
614
- update_i16(data) {
615
- wasm.fasthasher_update_i16(this.__wbg_ptr, data);
616
- }
617
- /**
618
- * @param {number} data
619
- */
620
- update_i32(data) {
621
- wasm.fasthasher_update_i32(this.__wbg_ptr, data);
622
- }
623
- /**
624
- * @param {bigint} data
625
- */
626
- update_i64(data) {
627
- wasm.fasthasher_update_i64(this.__wbg_ptr, data);
628
- }
629
- /**
630
- * @param {bigint} data
631
- */
632
- update_i128(data) {
633
- wasm.fasthasher_update_i128(this.__wbg_ptr, data, data >> BigInt(64));
634
- }
635
- /**
636
- * Finalizes the hash and returns the result
637
- * @returns {bigint}
638
- */
639
- digest() {
640
- const ret = wasm.qualityhasher_digest(this.__wbg_ptr);
641
- return BigInt.asUintN(64, ret);
642
- }
643
- /**
644
- * Resets the hasher
645
- */
646
- reset() {
647
- wasm.fasthasher_reset(this.__wbg_ptr);
651
+ function passArrayJsValueToWasm0(array, malloc) {
652
+ const ptr = malloc(array.length * 4, 4) >>> 0;
653
+ for (let i = 0; i < array.length; i++) {
654
+ const add = addToExternrefTable0(array[i]);
655
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
648
656
  }
657
+ WASM_VECTOR_LEN = array.length;
658
+ return ptr;
659
+ }
660
+
661
+ function takeFromExternrefTable0(idx) {
662
+ const value = wasm.__wbindgen_externrefs.get(idx);
663
+ wasm.__externref_table_dealloc(idx);
664
+ return value;
649
665
  }
650
- if (Symbol.dispose) QualityHasher.prototype[Symbol.dispose] = QualityHasher.prototype.free;
651
666
 
652
- __exports.QualityHasher = QualityHasher;
667
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
668
+ cachedTextDecoder.decode();
669
+ function decodeText(ptr, len) {
670
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
671
+ }
672
+
673
+ let WASM_VECTOR_LEN = 0;
653
674
 
654
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
675
+ let wasmModule, wasm;
676
+ function __wbg_finalize_init(instance, module) {
677
+ wasm = instance.exports;
678
+ wasmModule = module;
679
+ cachedBigUint64ArrayMemory0 = null;
680
+ cachedDataViewMemory0 = null;
681
+ cachedUint8ArrayMemory0 = null;
682
+ wasm.__wbindgen_start();
683
+ return wasm;
684
+ }
655
685
 
656
686
  async function __wbg_load(module, imports) {
657
687
  if (typeof Response === 'function' && module instanceof Response) {
658
688
  if (typeof WebAssembly.instantiateStreaming === 'function') {
659
689
  try {
660
690
  return await WebAssembly.instantiateStreaming(module, imports);
661
-
662
691
  } catch (e) {
663
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
692
+ const validResponse = module.ok && expectedResponseType(module.type);
664
693
 
665
694
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
666
695
  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);
667
696
 
668
- } else {
669
- throw e;
670
- }
697
+ } else { throw e; }
671
698
  }
672
699
  }
673
700
 
674
701
  const bytes = await module.arrayBuffer();
675
702
  return await WebAssembly.instantiate(bytes, imports);
676
-
677
703
  } else {
678
704
  const instance = await WebAssembly.instantiate(module, imports);
679
705
 
680
706
  if (instance instanceof WebAssembly.Instance) {
681
707
  return { instance, module };
682
-
683
708
  } else {
684
709
  return instance;
685
710
  }
686
711
  }
687
- }
688
-
689
- function __wbg_get_imports() {
690
- const imports = {};
691
- imports.wbg = {};
692
- imports.wbg.__wbg_length_6bb7e81f9d7713e4 = function(arg0) {
693
- const ret = arg0.length;
694
- return ret;
695
- };
696
- imports.wbg.__wbg_prototypesetcall_3d4a26c1ed734349 = function(arg0, arg1, arg2) {
697
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
698
- };
699
- imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
700
- throw new Error(getStringFromWasm0(arg0, arg1));
701
- };
702
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
703
- // Cast intrinsic for `Ref(String) -> Externref`.
704
- const ret = getStringFromWasm0(arg0, arg1);
705
- return ret;
706
- };
707
- imports.wbg.__wbindgen_init_externref_table = function() {
708
- const table = wasm.__wbindgen_export_0;
709
- const offset = table.grow(4);
710
- table.set(0, undefined);
711
- table.set(offset + 0, undefined);
712
- table.set(offset + 1, null);
713
- table.set(offset + 2, true);
714
- table.set(offset + 3, false);
715
- ;
716
- };
717
-
718
- return imports;
719
- }
720
-
721
- function __wbg_init_memory(imports, memory) {
722
-
723
- }
724
-
725
- function __wbg_finalize_init(instance, module) {
726
- wasm = instance.exports;
727
- __wbg_init.__wbindgen_wasm_module = module;
728
- cachedBigUint64ArrayMemory0 = null;
729
- cachedDataViewMemory0 = null;
730
- cachedUint8ArrayMemory0 = null;
731
-
732
712
 
733
- wasm.__wbindgen_start();
734
- return wasm;
713
+ function expectedResponseType(type) {
714
+ switch (type) {
715
+ case 'basic': case 'cors': case 'default': return true;
716
+ }
717
+ return false;
718
+ }
735
719
  }
736
720
 
737
721
  function initSync(module) {
738
722
  if (wasm !== undefined) return wasm;
739
723
 
740
724
 
741
- if (typeof module !== 'undefined') {
725
+ if (module !== undefined) {
742
726
  if (Object.getPrototypeOf(module) === Object.prototype) {
743
727
  ({module} = module)
744
728
  } else {
@@ -747,15 +731,10 @@ let wasm_bindgen;
747
731
  }
748
732
 
749
733
  const imports = __wbg_get_imports();
750
-
751
- __wbg_init_memory(imports);
752
-
753
734
  if (!(module instanceof WebAssembly.Module)) {
754
735
  module = new WebAssembly.Module(module);
755
736
  }
756
-
757
737
  const instance = new WebAssembly.Instance(module, imports);
758
-
759
738
  return __wbg_finalize_init(instance, module);
760
739
  }
761
740
 
@@ -763,7 +742,7 @@ let wasm_bindgen;
763
742
  if (wasm !== undefined) return wasm;
764
743
 
765
744
 
766
- if (typeof module_or_path !== 'undefined') {
745
+ if (module_or_path !== undefined) {
767
746
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
768
747
  ({module_or_path} = module_or_path)
769
748
  } else {
@@ -771,8 +750,8 @@ let wasm_bindgen;
771
750
  }
772
751
  }
773
752
 
774
- if (typeof module_or_path === 'undefined' && typeof script_src !== 'undefined') {
775
- module_or_path = script_src.replace(/\.js$/, '_bg.wasm');
753
+ if (module_or_path === undefined && script_src !== undefined) {
754
+ module_or_path = script_src.replace(/\.js$/, "_bg.wasm");
776
755
  }
777
756
  const imports = __wbg_get_imports();
778
757
 
@@ -780,13 +759,10 @@ let wasm_bindgen;
780
759
  module_or_path = fetch(module_or_path);
781
760
  }
782
761
 
783
- __wbg_init_memory(imports);
784
-
785
762
  const { instance, module } = await __wbg_load(await module_or_path, imports);
786
763
 
787
764
  return __wbg_finalize_init(instance, module);
788
765
  }
789
766
 
790
- wasm_bindgen = Object.assign(__wbg_init, { initSync }, __exports);
791
-
792
- })();
767
+ return Object.assign(__wbg_init, { initSync }, exports);
768
+ })({ __proto__: null });